@instructure/ui-tabs 8.33.1 → 8.33.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = exports.Tab = void 0;
11
-
12
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
-
14
10
  var _react = _interopRequireWildcard(require("react"));
15
-
16
11
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
17
-
18
12
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
19
-
20
13
  var _View = require("@instructure/ui-view/lib/View");
21
-
22
14
  var _emotion = require("@instructure/emotion");
23
-
24
15
  var _styles = _interopRequireDefault(require("./styles"));
25
-
26
16
  var _theme = _interopRequireDefault(require("./theme"));
27
-
28
17
  var _props = require("./props");
29
-
30
18
  const _excluded = ["id", "variant", "isSelected", "isDisabled", "controls", "children", "styles"];
31
-
32
19
  var _dec, _class, _class2;
33
-
34
20
  /**
35
21
  ---
36
22
  parent: Tabs
@@ -41,18 +27,15 @@ id: Tabs.Tab
41
27
  let Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_class2 = class Tab extends _react.Component {
42
28
  constructor() {
43
29
  super(...arguments);
44
-
45
30
  this.handleClick = event => {
46
31
  const _this$props = this.props,
47
- onClick = _this$props.onClick,
48
- index = _this$props.index,
49
- id = _this$props.id,
50
- isDisabled = _this$props.isDisabled;
51
-
32
+ onClick = _this$props.onClick,
33
+ index = _this$props.index,
34
+ id = _this$props.id,
35
+ isDisabled = _this$props.isDisabled;
52
36
  if (isDisabled) {
53
37
  return;
54
38
  }
55
-
56
39
  if (typeof onClick === 'function') {
57
40
  onClick(event, {
58
41
  index,
@@ -60,18 +43,15 @@ let Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
60
43
  });
61
44
  }
62
45
  };
63
-
64
46
  this.handleKeyDown = event => {
65
47
  const _this$props2 = this.props,
66
- onKeyDown = _this$props2.onKeyDown,
67
- index = _this$props2.index,
68
- id = _this$props2.id,
69
- isDisabled = _this$props2.isDisabled;
70
-
48
+ onKeyDown = _this$props2.onKeyDown,
49
+ index = _this$props2.index,
50
+ id = _this$props2.id,
51
+ isDisabled = _this$props2.isDisabled;
71
52
  if (isDisabled) {
72
53
  return;
73
54
  }
74
-
75
55
  if (typeof onKeyDown === 'function') {
76
56
  onKeyDown(event, {
77
57
  index,
@@ -80,29 +60,24 @@ let Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
80
60
  }
81
61
  };
82
62
  }
83
-
84
63
  componentDidMount() {
85
64
  var _this$props$makeStyle, _this$props3;
86
-
87
65
  (_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3);
88
66
  }
89
-
90
67
  componentDidUpdate() {
91
68
  var _this$props$makeStyle2, _this$props4;
92
-
93
69
  (_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
94
70
  }
95
-
96
71
  render() {
97
72
  const _this$props5 = this.props,
98
- id = _this$props5.id,
99
- variant = _this$props5.variant,
100
- isSelected = _this$props5.isSelected,
101
- isDisabled = _this$props5.isDisabled,
102
- controls = _this$props5.controls,
103
- children = _this$props5.children,
104
- styles = _this$props5.styles,
105
- props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
73
+ id = _this$props5.id,
74
+ variant = _this$props5.variant,
75
+ isSelected = _this$props5.isSelected,
76
+ isDisabled = _this$props5.isDisabled,
77
+ controls = _this$props5.controls,
78
+ children = _this$props5.children,
79
+ styles = _this$props5.styles,
80
+ props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
106
81
  return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
107
82
  as: "div",
108
83
  role: "tab",
@@ -118,7 +93,6 @@ let Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
118
93
  focusPosition: "inset"
119
94
  }), (0, _callRenderProp.callRenderProp)(children));
120
95
  }
121
-
122
96
  }, _class2.displayName = "Tab", _class2.componentId = 'Tabs.Tab', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
123
97
  variant: 'default',
124
98
  isDisabled: false,
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  const propTypes = {
36
34
  variant: _propTypes.default.oneOf(['default', 'secondary']),
37
35
  id: _propTypes.default.string.isRequired,
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _emotion = require("@instructure/emotion");
9
-
10
8
  /*
11
9
  * The MIT License (MIT)
12
10
  *
@@ -30,6 +28,7 @@ var _emotion = require("@instructure/emotion");
30
28
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
29
  * SOFTWARE.
32
30
  */
31
+
33
32
  // keyframes have to be outside of 'generateStyle',
34
33
  // since it is causing problems in style recalculation
35
34
  const selectedTab = (0, _emotion.keyframes)`
@@ -37,6 +36,7 @@ const selectedTab = (0, _emotion.keyframes)`
37
36
  opacity: 1;
38
37
  transform: translate3d(0, 0, 0) scaleX(1);
39
38
  }`;
39
+
40
40
  /**
41
41
  * ---
42
42
  * private: true
@@ -47,11 +47,10 @@ const selectedTab = (0, _emotion.keyframes)`
47
47
  * @param {Object} state the state of the component, the style is applied to
48
48
  * @return {Object} The final style object, which will be used in the component
49
49
  */
50
-
51
50
  const generateStyle = (componentTheme, props) => {
52
51
  const variant = props.variant,
53
- isSelected = props.isSelected,
54
- isDisabled = props.isDisabled;
52
+ isSelected = props.isSelected,
53
+ isDisabled = props.isDisabled;
55
54
  const variants = {
56
55
  default: {
57
56
  padding: '1rem 1.25rem',
@@ -80,7 +79,8 @@ const generateStyle = (componentTheme, props) => {
80
79
  animationTimingFunction: 'ease-out'
81
80
  })
82
81
  },
83
- '&:hover': { ...(!isDisabled && !isSelected && {
82
+ '&:hover': {
83
+ ...(!isDisabled && !isSelected && {
84
84
  borderBottomColor: componentTheme.defaultHoverBorderColor
85
85
  })
86
86
  }
@@ -104,14 +104,16 @@ const generateStyle = (componentTheme, props) => {
104
104
  '&:first-of-type': {
105
105
  marginInlineStart: '0'
106
106
  },
107
- '&:hover': { ...(!isDisabled && !isSelected && {
107
+ '&:hover': {
108
+ ...(!isDisabled && !isSelected && {
108
109
  background: componentTheme.secondarySelectedBackground,
109
110
  borderColor: componentTheme.secondarySelectedBorderColor
110
111
  })
111
112
  }
112
113
  }
113
- }; // overrides for View default focus ring
114
+ };
114
115
 
116
+ // overrides for View default focus ring
115
117
  const focusRingStyles = {
116
118
  '&:before': {
117
119
  inset: '0.5rem',
@@ -144,6 +146,5 @@ const generateStyle = (componentTheme, props) => {
144
146
  }
145
147
  };
146
148
  };
147
-
148
149
  var _default = generateStyle;
149
150
  exports.default = _default;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -36,9 +35,9 @@ exports.default = void 0;
36
35
  */
37
36
  const generateComponentTheme = theme => {
38
37
  const colors = theme.colors,
39
- typography = theme.typography,
40
- stacking = theme.stacking,
41
- themeName = theme.key;
38
+ typography = theme.typography,
39
+ stacking = theme.stacking,
40
+ themeName = theme.key;
42
41
  const themeSpecificStyle = {
43
42
  canvas: {
44
43
  defaultColor: theme['ic-brand-font-color-dark'],
@@ -59,10 +58,10 @@ const generateComponentTheme = theme => {
59
58
  secondarySelectedBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
60
59
  zIndex: stacking === null || stacking === void 0 ? void 0 : stacking.above
61
60
  };
62
- return { ...componentVariables,
61
+ return {
62
+ ...componentVariables,
63
63
  ...themeSpecificStyle[themeName]
64
64
  };
65
65
  };
66
-
67
66
  var _default = generateComponentTheme;
68
67
  exports.default = _default;
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TabsLocator = void 0;
7
-
8
7
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
-
10
8
  var _index = require("./index");
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,10 +29,12 @@ var _index = require("./index");
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  const TabLocator = (0, _locator.locator)('[role="tab"]');
36
34
  const PanelLocator = (0, _locator.locator)('[role="tabpanel"]');
37
- const SelectedTabLocator = (0, _locator.locator)('[role="tab"][aria-selected="true"]'); // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
35
+ const SelectedTabLocator = (0, _locator.locator)('[role="tab"][aria-selected="true"]');
38
36
 
37
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
39
38
  const TabsLocator = (0, _locator.locator)(_index.Tabs.selector, {
40
39
  findTab: function () {
41
40
  return TabLocator.find(...arguments);
package/lib/Tabs/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
@@ -14,51 +12,28 @@ Object.defineProperty(exports, "Panel", {
14
12
  }
15
13
  });
16
14
  exports.default = exports.Tabs = void 0;
17
-
18
15
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
19
-
20
16
  var _react = _interopRequireWildcard(require("react"));
21
-
22
17
  var _keycode = _interopRequireDefault(require("keycode"));
23
-
24
18
  var _View = require("@instructure/ui-view/lib/View");
25
-
26
19
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
27
-
28
20
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
29
-
30
21
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
31
-
32
22
  var _console = require("@instructure/console");
33
-
34
23
  var _uid = require("@instructure/uid");
35
-
36
24
  var _testable = require("@instructure/ui-testable/lib/testable.js");
37
-
38
25
  var _Focusable = require("@instructure/ui-focusable/lib/Focusable");
39
-
40
26
  var _getBoundingClientRect = require("@instructure/ui-dom-utils/lib/getBoundingClientRect.js");
41
-
42
27
  var _debounce = require("@instructure/debounce");
43
-
44
28
  var _px = require("@instructure/ui-utils/lib/px.js");
45
-
46
29
  var _emotion = require("@instructure/emotion");
47
-
48
30
  var _styles = _interopRequireDefault(require("./styles"));
49
-
50
31
  var _theme = _interopRequireDefault(require("./theme"));
51
-
52
32
  var _Tab = require("./Tab");
53
-
54
33
  var _Panel = require("./Panel");
55
-
56
34
  var _props = require("./props");
57
-
58
35
  const _excluded = ["children", "elementRef", "maxWidth", "variant", "margin", "screenReaderLabel", "onRequestTabChange", "tabOverflow", "styles"];
59
-
60
36
  var _dec, _dec2, _class, _class2;
61
-
62
37
  /**
63
38
  ---
64
39
  category: components
@@ -74,26 +49,21 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
74
49
  this._debounced = void 0;
75
50
  this._resizeListener = void 0;
76
51
  this.ref = null;
77
-
78
52
  this.handleRef = el => {
79
53
  const elementRef = this.props.elementRef;
80
54
  this.ref = el;
81
-
82
55
  if (typeof elementRef === 'function') {
83
56
  elementRef(el);
84
57
  }
85
58
  };
86
-
87
59
  this.handleTabClick = (event, _ref) => {
88
60
  let index = _ref.index;
89
61
  const nextTab = this.getNextTab(index, 0);
90
62
  this.fireOnChange(event, nextTab);
91
63
  };
92
-
93
64
  this.handleTabKeyDown = (event, _ref2) => {
94
65
  let index = _ref2.index;
95
66
  let nextTab;
96
-
97
67
  if (event.keyCode === _keycode.default.codes.up || event.keyCode === _keycode.default.codes.left) {
98
68
  // Select next tab to the left
99
69
  nextTab = this.getNextTab(index, -1);
@@ -101,34 +71,28 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
101
71
  // Select next tab to the right
102
72
  nextTab = this.getNextTab(index, 1);
103
73
  }
104
-
105
74
  if (nextTab) {
106
75
  event.preventDefault();
107
76
  this.fireOnChange(event, nextTab);
108
77
  }
109
78
  };
110
-
111
79
  this.handleResize = () => {
112
80
  this.setState({
113
81
  withTabListOverflow: this._tabList.scrollWidth > this._tabList.offsetWidth
114
82
  });
115
83
  this._tabListPosition = (0, _getBoundingClientRect.getBoundingClientRect)(this._tabList);
116
84
  };
117
-
118
85
  this.handleFocusableRef = el => {
119
86
  this._focusable = el;
120
87
  };
121
-
122
88
  this.handleTabListRef = el => {
123
89
  this._tabList = el;
124
90
  };
125
-
126
91
  this.handleScroll = event => {
127
92
  if (this.props.tabOverflow !== 'scroll' || !this.state.withTabListOverflow) {
128
93
  event.preventDefault();
129
94
  return;
130
95
  }
131
-
132
96
  const tabList = event.currentTarget;
133
97
  const scrollLeftMax = Math.round(tabList.scrollWidth - (0, _getBoundingClientRect.getBoundingClientRect)(tabList).width);
134
98
  const scrollLeft = Math.floor(Math.abs(tabList.scrollLeft));
@@ -137,65 +101,54 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
137
101
  showEndOverLay: scrollLeft < scrollLeftMax
138
102
  });
139
103
  };
140
-
141
104
  this.state = {
142
105
  withTabListOverflow: false,
143
106
  showStartOverLay: false,
144
107
  showEndOverLay: false
145
108
  };
146
109
  }
147
-
148
110
  componentDidMount() {
149
111
  var _this$props$makeStyle, _this$props;
150
-
151
112
  if (this.props.tabOverflow === 'scroll' && this._tabList) {
152
113
  this.startScrollOverflow();
153
114
  }
154
-
155
115
  if (this.props.shouldFocusOnRender) {
156
116
  this.focus();
157
117
  }
158
-
159
118
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
160
119
  }
161
-
162
120
  componentDidUpdate(prevProps, prevState) {
163
121
  var _this$props$makeStyle2, _this$props2;
164
-
165
122
  if (this.props.shouldFocusOnRender && !prevProps.shouldFocusOnRender) {
166
123
  this.focus();
167
- } // start event listeners for scroll overflow
168
-
124
+ }
169
125
 
126
+ // start event listeners for scroll overflow
170
127
  if (prevProps.tabOverflow === 'stack' && this.props.tabOverflow === 'scroll') {
171
128
  this.startScrollOverflow();
172
- } // cancel event listeners for scroll overflow
173
-
129
+ }
174
130
 
131
+ // cancel event listeners for scroll overflow
175
132
  if (prevProps.tabOverflow === 'scroll' && this.props.tabOverflow === 'stack') {
176
133
  this.cancelScrollOverflow();
177
- } // we need to recalculate the scroll overflow if the style changes
178
-
134
+ }
179
135
 
136
+ // we need to recalculate the scroll overflow if the style changes
180
137
  if (this.props.tabOverflow === 'scroll' && prevProps.styles !== this.props.styles) {
181
138
  this.handleResize();
182
- } // when tabList is set as overflown,
183
- // make sure active tab is always visible
184
-
139
+ }
185
140
 
141
+ // when tabList is set as overflown,
142
+ // make sure active tab is always visible
186
143
  if (this.props.tabOverflow === 'scroll' && this._tabList && !prevState.withTabListOverflow && this.state.withTabListOverflow) {
187
144
  const activeTabEl = this._tabList.querySelector('[aria-selected="true"]');
188
-
189
145
  this.showActiveTabIfOverlayed(activeTabEl);
190
146
  }
191
-
192
147
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
193
148
  }
194
-
195
149
  componentWillUnmount() {
196
150
  this.cancelScrollOverflow();
197
151
  }
198
-
199
152
  startScrollOverflow() {
200
153
  this.handleResize();
201
154
  this._debounced = (0, _debounce.debounce)(this.handleResize, 300, {
@@ -206,34 +159,27 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
206
159
  this._resizeListener = new ResizeObserver(entries => {
207
160
  for (const entry of entries) {
208
161
  const newWidth = entry.contentRect.width;
209
-
210
162
  if (this._tabListPosition.width !== newWidth) {
211
163
  var _this$_debounced;
212
-
213
164
  (_this$_debounced = this._debounced) === null || _this$_debounced === void 0 ? void 0 : _this$_debounced.call(this);
214
165
  }
215
166
  }
216
167
  });
217
-
218
168
  this._resizeListener.observe(this._tabList);
219
169
  }
220
-
221
170
  cancelScrollOverflow() {
222
171
  if (this._resizeListener) {
223
172
  this._resizeListener.disconnect();
224
173
  }
225
-
226
174
  if (this._debounced) {
227
175
  this._debounced.cancel();
228
176
  }
229
177
  }
230
-
231
178
  getOverlayWidth() {
232
179
  const _this$props3 = this.props,
233
- variant = _this$props3.variant,
234
- tabOverflow = _this$props3.tabOverflow,
235
- styles = _this$props3.styles;
236
-
180
+ variant = _this$props3.variant,
181
+ tabOverflow = _this$props3.tabOverflow,
182
+ styles = _this$props3.styles;
237
183
  if (styles && tabOverflow === 'scroll') {
238
184
  if (variant === 'default') {
239
185
  return (0, _px.px)(styles === null || styles === void 0 ? void 0 : styles.scrollOverlayWidthDefault);
@@ -241,10 +187,8 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
241
187
  return (0, _px.px)(styles === null || styles === void 0 ? void 0 : styles.scrollOverlayWidthSecondary);
242
188
  }
243
189
  }
244
-
245
190
  return 0;
246
191
  }
247
-
248
192
  showActiveTabIfOverlayed(activeTabEl) {
249
193
  if (this._tabList && this._tabListPosition && typeof this._tabList.scrollTo === 'function' // test for scrollTo support
250
194
  ) {
@@ -254,10 +198,8 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
254
198
  const tabListBoundEnd = tabListPosition.right + this.getOverlayWidth();
255
199
  const tabPositionStart = tabPosition.left;
256
200
  const tabPositionEnd = tabPosition.right;
257
-
258
201
  if (tabListBoundEnd > tabPositionEnd) {
259
202
  const offset = Math.round(tabListBoundEnd - tabPositionEnd);
260
-
261
203
  this._tabList.scrollTo({
262
204
  top: 0,
263
205
  left: this._tabList.scrollLeft + offset,
@@ -265,7 +207,6 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
265
207
  });
266
208
  } else if (tabListBoundStart > tabPositionStart) {
267
209
  const offset = Math.round(tabListBoundStart - tabPositionStart);
268
-
269
210
  this._tabList.scrollTo({
270
211
  top: 0,
271
212
  left: this._tabList.scrollLeft - offset,
@@ -274,42 +215,34 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
274
215
  }
275
216
  }
276
217
  }
277
-
278
218
  getNextTab(startIndex, step) {
279
219
  const tabs = _react.default.Children.toArray(this.props.children).map(child => (0, _matchComponentTypes.matchComponentTypes)(child, [_Panel.Panel]) && child);
280
-
281
220
  const count = tabs.length;
282
221
  const change = step < 0 ? step + count : step;
283
222
  (0, _console.logError)(startIndex >= 0 && startIndex < count, `[Tabs] Invalid tab index: '${startIndex}'.`);
284
223
  let nextIndex = startIndex;
285
224
  let nextTab;
286
-
287
225
  do {
288
226
  nextIndex = (nextIndex + change) % count;
289
227
  nextTab = tabs[nextIndex];
290
228
  } while (nextTab && nextTab.props && nextTab.props.isDisabled);
291
-
292
229
  (0, _console.logError)(nextIndex >= 0 && nextIndex < count, `[Tabs] Invalid tab index: '${nextIndex}'.`);
293
230
  return {
294
231
  index: nextIndex,
295
232
  id: nextTab.props.id
296
233
  };
297
234
  }
298
-
299
235
  fireOnChange(event, _ref3) {
300
236
  let index = _ref3.index,
301
- id = _ref3.id;
302
-
237
+ id = _ref3.id;
303
238
  if (typeof this.props.onRequestTabChange === 'function') {
304
239
  this.props.onRequestTabChange(event, {
305
240
  index,
306
241
  id
307
242
  });
308
243
  }
309
-
310
244
  this.state.withTabListOverflow && this.showActiveTabIfOverlayed(this._tabList.querySelector(`#tab-${id}`));
311
245
  }
312
-
313
246
  createTab(index, generatedId, selected, panel) {
314
247
  const id = panel.props.id || generatedId;
315
248
  return /*#__PURE__*/(0, _react.createElement)(_Tab.Tab, {
@@ -325,10 +258,10 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
325
258
  onKeyDown: this.handleTabKeyDown
326
259
  });
327
260
  }
328
-
329
261
  clonePanel(_index, generatedId, selected, panel) {
330
- const id = panel.props.id || generatedId; // fixHeight can be 0, so simply `fixheight` could return falsy value
262
+ const id = panel.props.id || generatedId;
331
263
 
264
+ // fixHeight can be 0, so simply `fixheight` could return falsy value
332
265
  const hasFixedHeight = typeof this.props.fixHeight !== 'undefined';
333
266
  return (0, _safeCloneElement.safeCloneElement)(panel, {
334
267
  id: panel.props.id || `panel-${id}`,
@@ -342,31 +275,26 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
342
275
  minHeight: !hasFixedHeight ? this.props.minHeight : '100%'
343
276
  });
344
277
  }
345
-
346
278
  focus() {
347
279
  this._focusable && typeof this._focusable.focus === 'function' && this._focusable.focus();
348
280
  }
349
-
350
281
  render() {
351
282
  const panels = [];
352
283
  const tabs = [];
353
284
  const _this$props4 = this.props,
354
- children = _this$props4.children,
355
- elementRef = _this$props4.elementRef,
356
- maxWidth = _this$props4.maxWidth,
357
- variant = _this$props4.variant,
358
- margin = _this$props4.margin,
359
- screenReaderLabel = _this$props4.screenReaderLabel,
360
- onRequestTabChange = _this$props4.onRequestTabChange,
361
- tabOverflow = _this$props4.tabOverflow,
362
- styles = _this$props4.styles,
363
- props = (0, _objectWithoutProperties2.default)(_this$props4, _excluded);
364
-
285
+ children = _this$props4.children,
286
+ elementRef = _this$props4.elementRef,
287
+ maxWidth = _this$props4.maxWidth,
288
+ variant = _this$props4.variant,
289
+ margin = _this$props4.margin,
290
+ screenReaderLabel = _this$props4.screenReaderLabel,
291
+ onRequestTabChange = _this$props4.onRequestTabChange,
292
+ tabOverflow = _this$props4.tabOverflow,
293
+ styles = _this$props4.styles,
294
+ props = (0, _objectWithoutProperties2.default)(_this$props4, _excluded);
365
295
  const selectedChildIndex = _react.default.Children.toArray(children).filter(child => (0, _matchComponentTypes.matchComponentTypes)(child, [_Panel.Panel])).findIndex(child => child.props.isSelected && !child.props.isDisabled);
366
-
367
296
  let index = 0;
368
297
  const selectedIndex = selectedChildIndex >= 0 ? selectedChildIndex : 0;
369
-
370
298
  _react.default.Children.forEach(children, child => {
371
299
  if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Panel.Panel])) {
372
300
  const selected = !child.props.isDisabled && (child.props.isSelected || selectedIndex === index);
@@ -378,9 +306,9 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
378
306
  panels.push(child);
379
307
  }
380
308
  });
309
+ const withScrollFade = tabOverflow === 'scroll' && this.state.withTabListOverflow;
381
310
 
382
- const withScrollFade = tabOverflow === 'scroll' && this.state.withTabListOverflow; // suppress overlay whenever final Tab is active, or Firefox will cover it
383
-
311
+ // suppress overlay whenever final Tab is active, or Firefox will cover it
384
312
  const startScrollOverlay = this.state.showStartOverLay ? (0, _emotion.jsx)("span", {
385
313
  key: "start-overlay",
386
314
  css: styles === null || styles === void 0 ? void 0 : styles.startScrollOverlay
@@ -414,7 +342,6 @@ let Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
414
342
  css: styles === null || styles === void 0 ? void 0 : styles.panelsContainer
415
343
  }, panels));
416
344
  }
417
-
418
345
  }, _class2.displayName = "Tabs", _class2.componentId = 'Tabs', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
419
346
  variant: 'default',
420
347
  shouldFocusOnRender: false,
@@ -10,9 +10,7 @@ Object.defineProperty(exports, "TabsLocator", {
10
10
  }
11
11
  });
12
12
  exports.default = void 0;
13
-
14
13
  var _TabsLocator = require("./TabsLocator");
15
-
16
14
  /*
17
15
  * The MIT License (MIT)
18
16
  *