Browse Source

feat(deps): update atlaskit/tabs to 8.0.8

There are (at least) two changes that are breaking:
- defaultTab is gone
- The re-rendering logic looks to have been re-written so that
  passing in a new array of tabs causes a re-render, which can
  reset the currently selected tab.

The fixes involved removing defaultTab from each tab configuration,
as it is no longer respected anyway. Also, instead of letting Tabs
be uncontrolled and allowing it to set its own selected, which
would result in the first tab automatically being selected on
Tabs re-render, use Tabs a controlled prop to dicate which
tab is selected; this is accomplished by specifying a selected
prop.
master
Leonard Kim 7 years ago
parent
commit
7c88de20fe

+ 6
- 6
css/_atlaskit_overrides.scss View File

@@ -18,23 +18,23 @@
18 18
     /**
19 19
      * The text color of the selected tab and hovered tabs.
20 20
      */
21
-    li.bcVmZW,
22
-    li.bcVmZW:hover,
23
-    li.kheoEp:hover {
21
+    .bVobOt,
22
+    .bVobOt:hover,
23
+    .ebveIl:hover {
24 24
         color: #172B4D;
25 25
     }
26 26
 
27 27
     /**
28 28
      * The color of the inactive tab text.
29 29
      */
30
-    li.kheoEp {
30
+    .ebveIl {
31 31
         color: #FFFFFF;
32 32
     }
33 33
 
34 34
     /**
35 35
      * The color of the underline of a selected tab.
36 36
      */
37
-    li>span.kByArU {
37
+    .kByArU {
38 38
         background-color: #172B4D;
39 39
     }
40 40
 }
@@ -54,4 +54,4 @@
54 54
     .gBLqhw[data-role=droplistContent] {
55 55
         border: 1px solid #455166;
56 56
     }
57
-}
57
+}

+ 9
- 30
package-lock.json View File

@@ -420,37 +420,16 @@
420 420
       }
421 421
     },
422 422
     "@atlaskit/tabs": {
423
-      "version": "4.0.1",
424
-      "resolved": "https://registry.npmjs.org/@atlaskit/tabs/-/tabs-4.0.1.tgz",
425
-      "integrity": "sha1-vM2WQ8nSO9kR+0GCK4U1oYJHHM8=",
423
+      "version": "8.0.8",
424
+      "resolved": "https://registry.npmjs.org/@atlaskit/tabs/-/tabs-8.0.8.tgz",
425
+      "integrity": "sha512-zNzF/vwazWWrSHLLleIVzuRszALy9xRN7jAaS/u1aaJwrGF5exYbtQ4RZQ9Bx46d7p4HLx3mb+/74GmR6yJ6Gw==",
426 426
       "requires": {
427
-        "@atlaskit/theme": "^2.0.0",
428
-        "@atlaskit/util-shared-styles": "^1.0.0",
427
+        "@atlaskit/analytics-next": "^3.0.6",
428
+        "@atlaskit/theme": "^6.0.2",
429 429
         "classnames": "^2.2.5",
430 430
         "css-element-queries": "^0.3.2",
431 431
         "debounce": "^1.0.0",
432
-        "keycode": "^2.1.4",
433
-        "prop-types": "^15.5.10",
434
-        "styled-components": "^1.3.0"
435
-      },
436
-      "dependencies": {
437
-        "@atlaskit/theme": {
438
-          "version": "2.4.1",
439
-          "resolved": "http://registry.npmjs.org/@atlaskit/theme/-/theme-2.4.1.tgz",
440
-          "integrity": "sha512-I4AMg+asUUwaruwsWDaUzub2zhEKYHhZ5tRlaNQ+8dhATpO1RSu6g9FSgwnAZ20M4Cf+YITVND/wyNpAON5HCQ==",
441
-          "requires": {
442
-            "prop-types": "^15.5.10",
443
-            "styled-components": "1.4.6 - 3"
444
-          }
445
-        },
446
-        "@atlaskit/util-shared-styles": {
447
-          "version": "1.7.1",
448
-          "resolved": "https://registry.npmjs.org/@atlaskit/util-shared-styles/-/util-shared-styles-1.7.1.tgz",
449
-          "integrity": "sha1-CDLLbMF5dDHEzPZ9F4qkES3zBeI=",
450
-          "requires": {
451
-            "babel-runtime": "^6.11.6"
452
-          }
453
-        }
432
+        "keycode": "^2.1.7"
454 433
       }
455 434
     },
456 435
     "@atlaskit/tag": {
@@ -5229,9 +5208,9 @@
5229 5208
       "dev": true
5230 5209
     },
5231 5210
     "debounce": {
5232
-      "version": "1.1.0",
5233
-      "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.1.0.tgz",
5234
-      "integrity": "sha512-ZQVKfRVlwRfD150ndzEK8M90ABT+Y/JQKs4Y7U4MXdpuoUkkrr4DwKbVux3YjylA5bUMUj0Nc3pMxPJX6N2QQQ=="
5211
+      "version": "1.2.0",
5212
+      "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.0.tgz",
5213
+      "integrity": "sha512-mYtLl1xfZLi1m4RtQYlZgJUNQjl4ZxVnHzIR8nLLgi4q1YT8o/WM+MK/f8yfcc9s5Ir5zRaPZyZU6xs1Syoocg=="
5235 5214
     },
5236 5215
     "debug": {
5237 5216
       "version": "2.6.9",

+ 1
- 1
package.json View File

@@ -30,7 +30,7 @@
30 30
     "@atlaskit/modal-dialog": "6.0.12",
31 31
     "@atlaskit/multi-select": "11.0.6",
32 32
     "@atlaskit/spinner": "9.0.8",
33
-    "@atlaskit/tabs": "4.0.1",
33
+    "@atlaskit/tabs": "8.0.8",
34 34
     "@atlaskit/theme": "6.0.2",
35 35
     "@atlaskit/tooltip": "12.0.14",
36 36
     "@microsoft/microsoft-graph-client": "1.1.0",

+ 26
- 2
react/features/base/dialog/components/DialogWithTabs.web.js View File

@@ -53,6 +53,11 @@ export type Props = {
53 53
  */
54 54
 type State = {
55 55
 
56
+    /**
57
+     * The index of the tab that should be displayed.
58
+     */
59
+    selectedTab: number,
60
+
56 61
     /**
57 62
      * An array of the states of the tabs.
58 63
      */
@@ -74,9 +79,11 @@ class DialogWithTabs extends Component<Props, State> {
74 79
     constructor(props: Props) {
75 80
         super(props);
76 81
         this.state = {
82
+            selectedTab: this.props.defaultTab || 0,
77 83
             tabStates: this.props.tabs.map(tab => tab.props)
78 84
         };
79 85
         this._onSubmit = this._onSubmit.bind(this);
86
+        this._onTabSelected = this._onTabSelected.bind(this);
80 87
         this._onTabStateChange = this._onTabStateChange.bind(this);
81 88
     }
82 89
 
@@ -125,13 +132,29 @@ class DialogWithTabs extends Component<Props, State> {
125 132
         return { ...currentTabState };
126 133
     }
127 134
 
135
+    _onTabSelected: (Object, number) => void;
136
+
137
+    /**
138
+     * Callback invoked when the desired tab to display should be changed.
139
+     *
140
+     * @param {Object} tab - The configuration passed into atlaskit tabs to
141
+     * describe how to display the selected tab.
142
+     * @param {number} tabIndex - The index of the tab within the array of
143
+     * displayed tabs.
144
+     * @private
145
+     * @returns {void}
146
+     */
147
+    _onTabSelected(tab, tabIndex) { // eslint-disable-line no-unused-vars
148
+        this.setState({ selectedTab: tabIndex });
149
+    }
150
+
128 151
     /**
129 152
      * Renders the tabs from the tab information passed on props.
130 153
      *
131 154
      * @returns {void}
132 155
      */
133 156
     _renderTabs() {
134
-        const { defaultTab = 0, t, tabs } = this.props;
157
+        const { t, tabs } = this.props;
135 158
 
136 159
         if (tabs.length === 1) {
137 160
             return this._renderTab({
@@ -143,6 +166,8 @@ class DialogWithTabs extends Component<Props, State> {
143 166
         if (tabs.length > 1) {
144 167
             return (
145 168
                 <Tabs
169
+                    onSelect = { this._onTabSelected }
170
+                    selected = { this.state.selectedTab }
146 171
                     tabs = {
147 172
                         tabs.map(({ component, label, styles }, idx) => {
148 173
                             return {
@@ -151,7 +176,6 @@ class DialogWithTabs extends Component<Props, State> {
151 176
                                     styles,
152 177
                                     tabId: idx
153 178
                                 }),
154
-                                defaultSelected: defaultTab === idx,
155 179
                                 label: t(label)
156 180
                             };
157 181
                         })

+ 10
- 5
react/features/desktop-picker/components/DesktopPicker.js View File

@@ -81,6 +81,7 @@ class DesktopPicker extends Component<*, *> {
81 81
 
82 82
     state = {
83 83
         selectedSource: {},
84
+        selectedTab: 0,
84 85
         sources: {},
85 86
         types: []
86 87
     };
@@ -283,15 +284,19 @@ class DesktopPicker extends Component<*, *> {
283 284
      * Stores the selected tab and updates the selected source via
284 285
      * {@code _getSelectedSource}.
285 286
      *
286
-     * @param {int} idx - The index of the selected tab.
287
+     * @param {Object} tab - The configuration passed into atlaskit tabs to
288
+     * describe how to display the selected tab.
289
+     * @param {number} tabIndex - The index of the tab within the array of
290
+     * displayed tabs.
287 291
      * @returns {void}
288 292
      */
289
-    _onTabSelected(idx) {
293
+    _onTabSelected(tab, tabIndex) { // eslint-disable-line no-unused-vars
290 294
         const { types, sources } = this.state;
291 295
 
292
-        this._selectedTabType = types[idx];
296
+        this._selectedTabType = types[tabIndex];
293 297
         this.setState({
294
-            selectedSource: this._getSelectedSource(sources)
298
+            selectedSource: this._getSelectedSource(sources),
299
+            selectedTab: tabIndex
295 300
         });
296 301
     }
297 302
 
@@ -315,7 +320,6 @@ class DesktopPicker extends Component<*, *> {
315 320
                             selectedSourceId = { selectedSource.id }
316 321
                             sources = { sources[type] }
317 322
                             type = { type } />,
318
-                        defaultSelected: type === DEFAULT_TAB_TYPE,
319 323
                         label: t(TAB_LABELS[type])
320 324
                     };
321 325
                 });
@@ -323,6 +327,7 @@ class DesktopPicker extends Component<*, *> {
323 327
         return (
324 328
             <Tabs
325 329
                 onSelect = { this._onTabSelected }
330
+                selected = { this.state.selectedTab }
326 331
                 tabs = { tabs } />);
327 332
     }
328 333
 

+ 6
- 4
react/features/device-selection/components/AudioInputPreview.js View File

@@ -1,12 +1,12 @@
1 1
 import PropTypes from 'prop-types';
2
-import React, { PureComponent } from 'react';
2
+import React, { Component } from 'react';
3 3
 
4 4
 import { JitsiTrackEvents } from '../../base/lib-jitsi-meet';
5 5
 
6 6
 /**
7 7
  * React component for displaying a audio level meter for a JitsiLocalTrack.
8 8
  */
9
-class AudioInputPreview extends PureComponent {
9
+class AudioInputPreview extends Component {
10 10
     /**
11 11
      * AudioInputPreview component's property types.
12 12
      *
@@ -53,8 +53,10 @@ class AudioInputPreview extends PureComponent {
53 53
      * @returns {void}
54 54
      */
55 55
     componentWillReceiveProps(nextProps) {
56
-        this._listenForAudioUpdates(nextProps.track);
57
-        this._updateAudioLevel(0);
56
+        if (nextProps.track !== this.props.track) {
57
+            this._listenForAudioUpdates(nextProps.track);
58
+            this._updateAudioLevel(0);
59
+        }
58 60
     }
59 61
 
60 62
     /**

+ 22
- 4
react/features/welcome/components/WelcomePage.web.js View File

@@ -43,7 +43,8 @@ class WelcomePage extends AbstractWelcomePage {
43 43
             ...this.state,
44 44
 
45 45
             generateRoomnames:
46
-                interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE
46
+                interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE,
47
+            selectedTab: 0
47 48
         };
48 49
 
49 50
         /**
@@ -70,6 +71,7 @@ class WelcomePage extends AbstractWelcomePage {
70 71
         this._onRoomChange = this._onRoomChange.bind(this);
71 72
         this._setAdditionalContentRef
72 73
             = this._setAdditionalContentRef.bind(this);
74
+        this._onTabSelected = this._onTabSelected.bind(this);
73 75
     }
74 76
 
75 77
     /**
@@ -198,6 +200,20 @@ class WelcomePage extends AbstractWelcomePage {
198 200
         super._onRoomChange(event.target.value);
199 201
     }
200 202
 
203
+    /**
204
+     * Callback invoked when the desired tab to display should be changed.
205
+     *
206
+     * @param {Object} tab - The configuration passed into atlaskit tabs to
207
+     * describe how to display the selected tab.
208
+     * @param {number} tabIndex - The index of the tab within the array of
209
+     * displayed tabs.
210
+     * @private
211
+     * @returns {void}
212
+     */
213
+    _onTabSelected(tab, tabIndex) { // eslint-disable-line no-unused-vars
214
+        this.setState({ selectedTab: tabIndex });
215
+    }
216
+
201 217
     /**
202 218
      * Renders tabs to show previous meetings and upcoming calendar events. The
203 219
      * tabs are purposefully hidden on mobile browsers.
@@ -219,8 +235,7 @@ class WelcomePage extends AbstractWelcomePage {
219 235
         if (CalendarList) {
220 236
             tabs.push({
221 237
                 label: t('welcomepage.calendar'),
222
-                content: <CalendarList />,
223
-                defaultSelected: true
238
+                content: <CalendarList />
224 239
             });
225 240
         }
226 241
 
@@ -235,7 +250,10 @@ class WelcomePage extends AbstractWelcomePage {
235 250
                 <div className = 'welcome-page-settings'>
236 251
                     <SettingsButton defaultTab = { SETTINGS_TABS.CALENDAR } />
237 252
                 </div>
238
-                <Tabs tabs = { tabs } />
253
+                <Tabs
254
+                    onSelect = { this._onTabSelected }
255
+                    selected = { this.state.selectedTab }
256
+                    tabs = { tabs } />
239 257
             </div>);
240 258
     }
241 259
 

Loading…
Cancel
Save