@instructure/ui-tabs 11.7.8 → 11.7.9-snapshot-1
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.
- package/CHANGELOG.md +8 -0
- package/lib/Tabs/v1/Panel/index.js +4 -4
- package/lib/Tabs/v1/Tab/index.js +3 -4
- package/lib/Tabs/v1/index.js +19 -22
- package/lib/Tabs/v2/Panel/index.js +4 -4
- package/lib/Tabs/v2/Tab/index.js +3 -4
- package/lib/Tabs/v2/index.js +19 -22
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-tabs
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-tabs
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Panel = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _v11_ = require("@instructure/ui-view/v11_6");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
11
|
+
var _uiMotion = require("@instructure/ui-motion");
|
|
12
12
|
var _emotion = require("@instructure/emotion");
|
|
13
13
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
14
14
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
@@ -104,7 +104,7 @@ let Panel = exports.Panel = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
104
104
|
...props
|
|
105
105
|
} = this.props;
|
|
106
106
|
return (0, _jsxRuntime.jsx)("div", {
|
|
107
|
-
...(0,
|
|
107
|
+
...(0, _uiReactUtils.passthroughProps)(props),
|
|
108
108
|
css: styles?.panel,
|
|
109
109
|
role: "tabpanel",
|
|
110
110
|
id: id,
|
|
@@ -112,7 +112,7 @@ let Panel = exports.Panel = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
112
112
|
"aria-hidden": this.isHidden ? 'true' : undefined,
|
|
113
113
|
tabIndex: this.isHidden ? undefined : tabIndex,
|
|
114
114
|
ref: this.handleRef,
|
|
115
|
-
children: (0, _jsxRuntime.jsx)(
|
|
115
|
+
children: (0, _jsxRuntime.jsx)(_uiMotion.Transition, {
|
|
116
116
|
type: "fade",
|
|
117
117
|
in: !this.isHidden,
|
|
118
118
|
unmountOnExit: unmountOnExit,
|
package/lib/Tabs/v1/Tab/index.js
CHANGED
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.Tab = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
11
10
|
var _v11_ = require("@instructure/ui-view/v11_6");
|
|
12
11
|
var _emotion = require("@instructure/emotion");
|
|
13
12
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
@@ -105,7 +104,7 @@ let Tab = exports.Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
|
|
|
105
104
|
...props
|
|
106
105
|
} = this.props;
|
|
107
106
|
return (0, _jsxRuntime.jsx)(_v11_.View, {
|
|
108
|
-
...(0,
|
|
107
|
+
...(0, _uiReactUtils.passthroughProps)(props),
|
|
109
108
|
as: "div",
|
|
110
109
|
role: "tab",
|
|
111
110
|
id: id,
|
|
@@ -118,7 +117,7 @@ let Tab = exports.Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
|
|
|
118
117
|
tabIndex: isSelected && !isDisabled ? 0 : undefined,
|
|
119
118
|
position: "relative",
|
|
120
119
|
focusPosition: "inset",
|
|
121
|
-
children: (0,
|
|
120
|
+
children: (0, _uiReactUtils.callRenderProp)(children)
|
|
122
121
|
});
|
|
123
122
|
}
|
|
124
123
|
}) || _class);
|
package/lib/Tabs/v1/index.js
CHANGED
|
@@ -14,15 +14,12 @@ exports.default = exports.Tabs = void 0;
|
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
16
16
|
var _v11_ = require("@instructure/ui-view/v11_6");
|
|
17
|
-
var
|
|
18
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
19
|
-
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
20
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
17
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
21
18
|
var _console = require("@instructure/console");
|
|
22
|
-
var
|
|
23
|
-
var
|
|
19
|
+
var _uiFocusable = require("@instructure/ui-focusable");
|
|
20
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
24
21
|
var _debounce = require("@instructure/debounce");
|
|
25
|
-
var
|
|
22
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
26
23
|
var _emotion = require("@instructure/emotion");
|
|
27
24
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
28
25
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
@@ -59,7 +56,7 @@ var _dec, _dec2, _class;
|
|
|
59
56
|
category: components
|
|
60
57
|
---
|
|
61
58
|
**/
|
|
62
|
-
let Tabs = exports.Tabs = (_dec = (0,
|
|
59
|
+
let Tabs = exports.Tabs = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class Tabs extends _react.Component {
|
|
63
60
|
static displayName = 'Tabs';
|
|
64
61
|
static componentId = 'Tabs';
|
|
65
62
|
static allowedProps = _props.allowedProps;
|
|
@@ -139,7 +136,7 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
139
136
|
leading: true,
|
|
140
137
|
trailing: true
|
|
141
138
|
});
|
|
142
|
-
this._tabListPosition = (0,
|
|
139
|
+
this._tabListPosition = (0, _uiDomUtils.getBoundingClientRect)(this._tabList);
|
|
143
140
|
this._resizeListener = new ResizeObserver(entries => {
|
|
144
141
|
for (const entry of entries) {
|
|
145
142
|
const {
|
|
@@ -168,9 +165,9 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
168
165
|
} = this.props;
|
|
169
166
|
if (styles && tabOverflow === 'scroll') {
|
|
170
167
|
if (variant === 'default') {
|
|
171
|
-
return (0,
|
|
168
|
+
return (0, _uiUtils.px)(styles?.scrollOverlayWidthDefault);
|
|
172
169
|
} else {
|
|
173
|
-
return (0,
|
|
170
|
+
return (0, _uiUtils.px)(styles?.scrollOverlayWidthSecondary);
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
173
|
return 0;
|
|
@@ -178,7 +175,7 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
178
175
|
showActiveTabIfOverlayed(activeTabEl) {
|
|
179
176
|
if (this._tabList && this._tabListPosition && typeof this._tabList.scrollTo === 'function' // test for scrollTo support
|
|
180
177
|
) {
|
|
181
|
-
const tabPosition = (0,
|
|
178
|
+
const tabPosition = (0, _uiDomUtils.getBoundingClientRect)(activeTabEl);
|
|
182
179
|
const tabListPosition = this._tabListPosition;
|
|
183
180
|
const tabListBoundStart = tabListPosition.left + this.getOverlayWidth();
|
|
184
181
|
const tabListBoundEnd = tabListPosition.right + this.getOverlayWidth();
|
|
@@ -227,10 +224,10 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
227
224
|
this.setState({
|
|
228
225
|
withTabListOverflow: this._tabList.scrollWidth > this._tabList.offsetWidth
|
|
229
226
|
});
|
|
230
|
-
this._tabListPosition = (0,
|
|
227
|
+
this._tabListPosition = (0, _uiDomUtils.getBoundingClientRect)(this._tabList);
|
|
231
228
|
};
|
|
232
229
|
getNextTab(startIndex, step) {
|
|
233
|
-
const tabs = _react.Children.toArray(this.props.children).map(child => (0,
|
|
230
|
+
const tabs = _react.Children.toArray(this.props.children).map(child => (0, _uiReactUtils.matchComponentTypes)(child, [_index2.Panel]) && child);
|
|
234
231
|
const count = tabs.length;
|
|
235
232
|
const change = step < 0 ? step + count : step;
|
|
236
233
|
(0, _console.logError)(startIndex >= 0 && startIndex < count, `[Tabs] Invalid tab index: '${startIndex}'.`);
|
|
@@ -301,13 +298,13 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
301
298
|
activePanelClone = /*#__PURE__*/(0, _react.cloneElement)(activePanel, {
|
|
302
299
|
key: `panel-${index}`
|
|
303
300
|
});
|
|
304
|
-
return (0,
|
|
301
|
+
return (0, _uiReactUtils.safeCloneElement)(activePanelClone, {
|
|
305
302
|
padding: activePanelClone.props.padding || this.props.padding,
|
|
306
303
|
textAlign: activePanelClone.props.textAlign || this.props.textAlign,
|
|
307
304
|
...commonProps
|
|
308
305
|
});
|
|
309
306
|
} else {
|
|
310
|
-
return (0,
|
|
307
|
+
return (0, _uiReactUtils.safeCloneElement)(panel, {
|
|
311
308
|
key: `panel-${index}`,
|
|
312
309
|
padding: panel.props.padding || this.props.padding,
|
|
313
310
|
textAlign: panel.props.textAlign || this.props.textAlign,
|
|
@@ -330,7 +327,7 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
330
327
|
return;
|
|
331
328
|
}
|
|
332
329
|
const tabList = event.currentTarget;
|
|
333
|
-
const scrollLeftMax = Math.round(tabList.scrollWidth - (0,
|
|
330
|
+
const scrollLeftMax = Math.round(tabList.scrollWidth - (0, _uiDomUtils.getBoundingClientRect)(tabList).width);
|
|
334
331
|
const scrollLeft = Math.floor(Math.abs(tabList.scrollLeft));
|
|
335
332
|
this.setState({
|
|
336
333
|
showStartOverLay: scrollLeft > 0,
|
|
@@ -352,14 +349,14 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
352
349
|
styles,
|
|
353
350
|
...props
|
|
354
351
|
} = this.props;
|
|
355
|
-
const activePanels = _react.Children.toArray(children).filter(child => (0,
|
|
352
|
+
const activePanels = _react.Children.toArray(children).filter(child => (0, _uiReactUtils.matchComponentTypes)(child, [_index2.Panel])).filter(child => child.props.active);
|
|
356
353
|
if (activePanels.length > 1) {
|
|
357
354
|
(0, _console.logError)(false, `[Tabs] Only one Panel can be marked as active.`);
|
|
358
355
|
}
|
|
359
|
-
const selectedChildIndex = _react.Children.toArray(children).filter(child => (0,
|
|
356
|
+
const selectedChildIndex = _react.Children.toArray(children).filter(child => (0, _uiReactUtils.matchComponentTypes)(child, [_index2.Panel])).findIndex(child => child.props.isSelected && !child.props.isDisabled);
|
|
360
357
|
const selectedIndex = selectedChildIndex >= 0 ? selectedChildIndex : 0;
|
|
361
358
|
_react.Children.toArray(children).map((child, index) => {
|
|
362
|
-
if ((0,
|
|
359
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.Panel])) {
|
|
363
360
|
const selected = !child.props.isDisabled && (child.props.isSelected || selectedIndex === index);
|
|
364
361
|
const id = this.props.deterministicId(`Tabs_${index}`);
|
|
365
362
|
tabs.push(this.createTab(index, id, selected, child));
|
|
@@ -382,14 +379,14 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
382
379
|
css: styles?.endScrollOverlay
|
|
383
380
|
}, "end-overlay") : null;
|
|
384
381
|
return (0, _jsxRuntime.jsxs)(_v11_.View, {
|
|
385
|
-
...(0,
|
|
382
|
+
...(0, _uiReactUtils.passthroughProps)(props),
|
|
386
383
|
elementRef: this.handleRef,
|
|
387
384
|
maxWidth: maxWidth,
|
|
388
385
|
margin: margin,
|
|
389
386
|
as: "div",
|
|
390
387
|
css: styles?.container,
|
|
391
388
|
"data-cid": "Tabs",
|
|
392
|
-
children: [(0, _jsxRuntime.jsx)(
|
|
389
|
+
children: [(0, _jsxRuntime.jsx)(_uiFocusable.Focusable, {
|
|
393
390
|
ref: this.handleFocusableRef,
|
|
394
391
|
children: () => (0, _jsxRuntime.jsx)(_v11_.View, {
|
|
395
392
|
as: "div",
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Panel = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _latest = require("@instructure/ui-view/latest");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
11
|
+
var _uiMotion = require("@instructure/ui-motion");
|
|
12
12
|
var _emotion = require("@instructure/emotion");
|
|
13
13
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
14
14
|
var _props = require("./props.js");
|
|
@@ -103,7 +103,7 @@ let Panel = exports.Panel = (_dec = (0, _emotion.withStyleNew)(_styles.default),
|
|
|
103
103
|
...props
|
|
104
104
|
} = this.props;
|
|
105
105
|
return (0, _jsxRuntime.jsx)("div", {
|
|
106
|
-
...(0,
|
|
106
|
+
...(0, _uiReactUtils.passthroughProps)(props),
|
|
107
107
|
css: styles?.panel,
|
|
108
108
|
role: "tabpanel",
|
|
109
109
|
id: id,
|
|
@@ -111,7 +111,7 @@ let Panel = exports.Panel = (_dec = (0, _emotion.withStyleNew)(_styles.default),
|
|
|
111
111
|
"aria-hidden": this.isHidden ? 'true' : undefined,
|
|
112
112
|
tabIndex: this.isHidden ? undefined : tabIndex,
|
|
113
113
|
ref: this.handleRef,
|
|
114
|
-
children: (0, _jsxRuntime.jsx)(
|
|
114
|
+
children: (0, _jsxRuntime.jsx)(_uiMotion.Transition, {
|
|
115
115
|
type: "fade",
|
|
116
116
|
in: !this.isHidden,
|
|
117
117
|
unmountOnExit: unmountOnExit,
|
package/lib/Tabs/v2/Tab/index.js
CHANGED
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.Tab = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
11
10
|
var _latest = require("@instructure/ui-view/latest");
|
|
12
11
|
var _emotion = require("@instructure/emotion");
|
|
13
12
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
@@ -104,7 +103,7 @@ let Tab = exports.Tab = (_dec = (0, _emotion.withStyleNew)(_styles.default), _de
|
|
|
104
103
|
...props
|
|
105
104
|
} = this.props;
|
|
106
105
|
return (0, _jsxRuntime.jsx)(_latest.View, {
|
|
107
|
-
...(0,
|
|
106
|
+
...(0, _uiReactUtils.passthroughProps)(props),
|
|
108
107
|
as: "div",
|
|
109
108
|
role: "tab",
|
|
110
109
|
id: id,
|
|
@@ -117,7 +116,7 @@ let Tab = exports.Tab = (_dec = (0, _emotion.withStyleNew)(_styles.default), _de
|
|
|
117
116
|
tabIndex: isSelected && !isDisabled ? 0 : undefined,
|
|
118
117
|
position: "relative",
|
|
119
118
|
focusPosition: "offset",
|
|
120
|
-
children: (0,
|
|
119
|
+
children: (0, _uiReactUtils.callRenderProp)(children)
|
|
121
120
|
});
|
|
122
121
|
}
|
|
123
122
|
}) || _class);
|
package/lib/Tabs/v2/index.js
CHANGED
|
@@ -14,15 +14,12 @@ exports.default = exports.Tabs = void 0;
|
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
16
16
|
var _latest = require("@instructure/ui-view/latest");
|
|
17
|
-
var
|
|
18
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
19
|
-
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
20
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
17
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
21
18
|
var _console = require("@instructure/console");
|
|
22
|
-
var
|
|
23
|
-
var
|
|
19
|
+
var _uiFocusable = require("@instructure/ui-focusable");
|
|
20
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
24
21
|
var _debounce = require("@instructure/debounce");
|
|
25
|
-
var
|
|
22
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
26
23
|
var _emotion = require("@instructure/emotion");
|
|
27
24
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
28
25
|
var _index = require("./Tab/index.js");
|
|
@@ -58,7 +55,7 @@ var _dec, _dec2, _class;
|
|
|
58
55
|
category: components
|
|
59
56
|
---
|
|
60
57
|
**/
|
|
61
|
-
let Tabs = exports.Tabs = (_dec = (0,
|
|
58
|
+
let Tabs = exports.Tabs = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = _dec2(_class = class Tabs extends _react.Component {
|
|
62
59
|
static displayName = 'Tabs';
|
|
63
60
|
static componentId = 'Tabs';
|
|
64
61
|
static allowedProps = _props.allowedProps;
|
|
@@ -138,7 +135,7 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
138
135
|
leading: true,
|
|
139
136
|
trailing: true
|
|
140
137
|
});
|
|
141
|
-
this._tabListPosition = (0,
|
|
138
|
+
this._tabListPosition = (0, _uiDomUtils.getBoundingClientRect)(this._tabList);
|
|
142
139
|
this._resizeListener = new ResizeObserver(entries => {
|
|
143
140
|
for (const entry of entries) {
|
|
144
141
|
const {
|
|
@@ -167,9 +164,9 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
167
164
|
} = this.props;
|
|
168
165
|
if (styles && tabOverflow === 'scroll') {
|
|
169
166
|
if (variant === 'default') {
|
|
170
|
-
return (0,
|
|
167
|
+
return (0, _uiUtils.px)(styles?.scrollOverlayWidthDefault);
|
|
171
168
|
} else {
|
|
172
|
-
return (0,
|
|
169
|
+
return (0, _uiUtils.px)(styles?.scrollOverlayWidthSecondary);
|
|
173
170
|
}
|
|
174
171
|
}
|
|
175
172
|
return 0;
|
|
@@ -177,7 +174,7 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
177
174
|
showActiveTabIfOverlayed(activeTabEl) {
|
|
178
175
|
if (this._tabList && this._tabListPosition && typeof this._tabList.scrollTo === 'function' // test for scrollTo support
|
|
179
176
|
) {
|
|
180
|
-
const tabPosition = (0,
|
|
177
|
+
const tabPosition = (0, _uiDomUtils.getBoundingClientRect)(activeTabEl);
|
|
181
178
|
const tabListPosition = this._tabListPosition;
|
|
182
179
|
const tabListBoundStart = tabListPosition.left + this.getOverlayWidth();
|
|
183
180
|
const tabListBoundEnd = tabListPosition.right + this.getOverlayWidth();
|
|
@@ -226,10 +223,10 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
226
223
|
this.setState({
|
|
227
224
|
withTabListOverflow: this._tabList.scrollWidth > this._tabList.offsetWidth
|
|
228
225
|
});
|
|
229
|
-
this._tabListPosition = (0,
|
|
226
|
+
this._tabListPosition = (0, _uiDomUtils.getBoundingClientRect)(this._tabList);
|
|
230
227
|
};
|
|
231
228
|
getNextTab(startIndex, step) {
|
|
232
|
-
const tabs = _react.Children.toArray(this.props.children).map(child => (0,
|
|
229
|
+
const tabs = _react.Children.toArray(this.props.children).map(child => (0, _uiReactUtils.matchComponentTypes)(child, [_index2.Panel]) && child);
|
|
233
230
|
const count = tabs.length;
|
|
234
231
|
const change = step < 0 ? step + count : step;
|
|
235
232
|
(0, _console.logError)(startIndex >= 0 && startIndex < count, `[Tabs] Invalid tab index: '${startIndex}'.`);
|
|
@@ -300,13 +297,13 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
300
297
|
activePanelClone = /*#__PURE__*/(0, _react.cloneElement)(activePanel, {
|
|
301
298
|
key: `panel-${index}`
|
|
302
299
|
});
|
|
303
|
-
return (0,
|
|
300
|
+
return (0, _uiReactUtils.safeCloneElement)(activePanelClone, {
|
|
304
301
|
padding: activePanelClone.props.padding || this.props.padding,
|
|
305
302
|
textAlign: activePanelClone.props.textAlign || this.props.textAlign,
|
|
306
303
|
...commonProps
|
|
307
304
|
});
|
|
308
305
|
} else {
|
|
309
|
-
return (0,
|
|
306
|
+
return (0, _uiReactUtils.safeCloneElement)(panel, {
|
|
310
307
|
key: `panel-${index}`,
|
|
311
308
|
padding: panel.props.padding || this.props.padding,
|
|
312
309
|
textAlign: panel.props.textAlign || this.props.textAlign,
|
|
@@ -329,7 +326,7 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
329
326
|
return;
|
|
330
327
|
}
|
|
331
328
|
const tabList = event.currentTarget;
|
|
332
|
-
const scrollLeftMax = Math.round(tabList.scrollWidth - (0,
|
|
329
|
+
const scrollLeftMax = Math.round(tabList.scrollWidth - (0, _uiDomUtils.getBoundingClientRect)(tabList).width);
|
|
333
330
|
const scrollLeft = Math.floor(Math.abs(tabList.scrollLeft));
|
|
334
331
|
this.setState({
|
|
335
332
|
showStartOverLay: scrollLeft > 0,
|
|
@@ -351,14 +348,14 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
351
348
|
styles,
|
|
352
349
|
...props
|
|
353
350
|
} = this.props;
|
|
354
|
-
const activePanels = _react.Children.toArray(children).filter(child => (0,
|
|
351
|
+
const activePanels = _react.Children.toArray(children).filter(child => (0, _uiReactUtils.matchComponentTypes)(child, [_index2.Panel])).filter(child => child.props.active);
|
|
355
352
|
if (activePanels.length > 1) {
|
|
356
353
|
(0, _console.logError)(false, `[Tabs] Only one Panel can be marked as active.`);
|
|
357
354
|
}
|
|
358
|
-
const selectedChildIndex = _react.Children.toArray(children).filter(child => (0,
|
|
355
|
+
const selectedChildIndex = _react.Children.toArray(children).filter(child => (0, _uiReactUtils.matchComponentTypes)(child, [_index2.Panel])).findIndex(child => child.props.isSelected && !child.props.isDisabled);
|
|
359
356
|
const selectedIndex = selectedChildIndex >= 0 ? selectedChildIndex : 0;
|
|
360
357
|
_react.Children.toArray(children).map((child, index) => {
|
|
361
|
-
if ((0,
|
|
358
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.Panel])) {
|
|
362
359
|
const selected = !child.props.isDisabled && (child.props.isSelected || selectedIndex === index);
|
|
363
360
|
const id = this.props.deterministicId(`Tabs_${index}`);
|
|
364
361
|
tabs.push(this.createTab(index, id, selected, child));
|
|
@@ -381,14 +378,14 @@ let Tabs = exports.Tabs = (_dec = (0, _withDeterministicId.withDeterministicId)(
|
|
|
381
378
|
css: styles?.endScrollOverlay
|
|
382
379
|
}, "end-overlay") : null;
|
|
383
380
|
return (0, _jsxRuntime.jsxs)(_latest.View, {
|
|
384
|
-
...(0,
|
|
381
|
+
...(0, _uiReactUtils.passthroughProps)(props),
|
|
385
382
|
elementRef: this.handleRef,
|
|
386
383
|
maxWidth: maxWidth,
|
|
387
384
|
margin: margin,
|
|
388
385
|
as: "div",
|
|
389
386
|
css: styles?.container,
|
|
390
387
|
"data-cid": "Tabs",
|
|
391
|
-
children: [(0, _jsxRuntime.jsx)(
|
|
388
|
+
children: [(0, _jsxRuntime.jsx)(_uiFocusable.Focusable, {
|
|
392
389
|
ref: this.handleFocusableRef,
|
|
393
390
|
children: () => (0, _jsxRuntime.jsx)(_latest.View, {
|
|
394
391
|
as: "div",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-tabs",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-snapshot-1",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -16,24 +16,24 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
18
|
"keycode": "^2",
|
|
19
|
-
"@instructure/console": "11.7.
|
|
20
|
-
"@instructure/emotion": "11.7.
|
|
21
|
-
"@instructure/
|
|
22
|
-
"@instructure/
|
|
23
|
-
"@instructure/
|
|
24
|
-
"@instructure/ui-focusable": "11.7.
|
|
25
|
-
"@instructure/ui-i18n": "11.7.
|
|
26
|
-
"@instructure/ui-motion": "11.7.
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
19
|
+
"@instructure/console": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/emotion": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/debounce": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/ui-dom-utils": "11.7.9-snapshot-1",
|
|
24
|
+
"@instructure/ui-focusable": "11.7.9-snapshot-1",
|
|
25
|
+
"@instructure/ui-i18n": "11.7.9-snapshot-1",
|
|
26
|
+
"@instructure/ui-motion": "11.7.9-snapshot-1",
|
|
27
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
28
|
+
"@instructure/ui-themes": "11.7.9-snapshot-1",
|
|
29
|
+
"@instructure/ui-view": "11.7.9-snapshot-1",
|
|
30
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"vitest": "^5.0.0",
|
|
34
|
-
"@instructure/ui-
|
|
35
|
-
"@instructure/ui-
|
|
36
|
-
"@instructure/ui-color-utils": "11.7.
|
|
34
|
+
"@instructure/ui-axe-check": "11.7.9-snapshot-1",
|
|
35
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1",
|
|
36
|
+
"@instructure/ui-color-utils": "11.7.9-snapshot-1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": ">=18 <=19"
|