@instructure/ui-tabs 8.56.1 → 8.56.2-pr-snapshot-1721749364069

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 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
+ ## [8.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-tabs
9
+
10
+
11
+
12
+
13
+
6
14
  ## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
7
15
 
8
16
 
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = exports.Panel = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
9
  var _react = require("react");
10
- var _View = require("@instructure/ui-view/lib/View");
11
- var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
12
- var _Transition = require("@instructure/ui-motion/lib/Transition");
10
+ var _uiView = require("@instructure/ui-view");
11
+ var _uiReactUtils = require("@instructure/ui-react-utils");
12
+ var _uiMotion = require("@instructure/ui-motion");
13
13
  var _emotion = require("@instructure/emotion");
14
14
  var _styles = _interopRequireDefault(require("./styles"));
15
15
  var _theme = _interopRequireDefault(require("./theme"));
@@ -83,19 +83,19 @@ let Panel = exports.Panel = (_dec = (0, _emotion.withStyle)(_styles.default, _th
83
83
  active = _this$props3.active,
84
84
  props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
85
85
  const isHidden = !isSelected || !!isDisabled;
86
- return (0, _emotion.jsx)("div", Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
86
+ return (0, _emotion.jsx)("div", Object.assign({}, (0, _uiReactUtils.passthroughProps)(props), {
87
87
  css: styles === null || styles === void 0 ? void 0 : styles.panel,
88
88
  role: "tabpanel",
89
89
  id: id,
90
90
  "aria-labelledby": labelledBy,
91
91
  "aria-hidden": isHidden ? 'true' : void 0,
92
92
  ref: this.handleRef
93
- }), (0, _emotion.jsx)(_Transition.Transition, {
93
+ }), (0, _emotion.jsx)(_uiMotion.Transition, {
94
94
  type: "fade",
95
95
  in: !isHidden,
96
96
  unmountOnExit: true,
97
97
  transitionExit: false
98
- }, (0, _emotion.jsx)(_View.View, {
98
+ }, (0, _emotion.jsx)(_uiView.View, {
99
99
  css: styles === null || styles === void 0 ? void 0 : styles.content,
100
100
  maxHeight: maxHeight,
101
101
  minHeight: minHeight,
@@ -8,9 +8,8 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = exports.Tab = void 0;
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
- var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
12
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
13
- var _View = require("@instructure/ui-view/lib/View");
11
+ var _uiReactUtils = require("@instructure/ui-react-utils");
12
+ var _uiView = require("@instructure/ui-view");
14
13
  var _emotion = require("@instructure/emotion");
15
14
  var _styles = _interopRequireDefault(require("./styles"));
16
15
  var _theme = _interopRequireDefault(require("./theme"));
@@ -100,7 +99,7 @@ let Tab = exports.Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
100
99
  children = _this$props5.children,
101
100
  styles = _this$props5.styles,
102
101
  props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
103
- return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
102
+ return (0, _emotion.jsx)(_uiView.View, Object.assign({}, (0, _uiReactUtils.passthroughProps)(props), {
104
103
  as: "div",
105
104
  role: "tab",
106
105
  id: id,
@@ -113,7 +112,7 @@ let Tab = exports.Tab = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
113
112
  tabIndex: isSelected && !isDisabled ? 0 : void 0,
114
113
  position: "relative",
115
114
  focusPosition: "inset"
116
- }), (0, _callRenderProp.callRenderProp)(children));
115
+ }), (0, _uiReactUtils.callRenderProp)(children));
117
116
  }
118
117
  }, _class2.displayName = "Tab", _class2.componentId = 'Tabs.Tab', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
119
118
  variant: 'default',
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TabsLocator = void 0;
7
- var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
7
+ var _uiTestLocator = require("@instructure/ui-test-locator");
8
8
  var _index = require("./index");
9
9
  /*
10
10
  * The MIT License (MIT)
@@ -30,12 +30,12 @@ var _index = require("./index");
30
30
  * SOFTWARE.
31
31
  */
32
32
 
33
- const TabLocator = (0, _locator.locator)('[role="tab"]');
34
- const PanelLocator = (0, _locator.locator)('[role="tabpanel"]');
35
- const SelectedTabLocator = (0, _locator.locator)('[role="tab"][aria-selected="true"]');
33
+ const TabLocator = (0, _uiTestLocator.locator)('[role="tab"]');
34
+ const PanelLocator = (0, _uiTestLocator.locator)('[role="tabpanel"]');
35
+ const SelectedTabLocator = (0, _uiTestLocator.locator)('[role="tab"][aria-selected="true"]');
36
36
 
37
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
38
- const TabsLocator = exports.TabsLocator = (0, _locator.locator)(_index.Tabs.selector, {
38
+ const TabsLocator = exports.TabsLocator = (0, _uiTestLocator.locator)(_index.Tabs.selector, {
39
39
  findTab: (...args) => {
40
40
  return TabLocator.find(...args);
41
41
  },
package/lib/Tabs/index.js CHANGED
@@ -15,17 +15,15 @@ exports.default = exports.Tabs = void 0;
15
15
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
16
16
  var _react = _interopRequireWildcard(require("react"));
17
17
  var _keycode = _interopRequireDefault(require("keycode"));
18
- var _View = require("@instructure/ui-view/lib/View");
19
- var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
20
- var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
21
- var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
18
+ var _uiView = require("@instructure/ui-view");
19
+ var _uiReactUtils = require("@instructure/ui-react-utils");
22
20
  var _console = require("@instructure/console");
23
21
  var _uid = require("@instructure/uid");
24
- var _testable = require("@instructure/ui-testable/lib/testable.js");
25
- var _Focusable = require("@instructure/ui-focusable/lib/Focusable");
26
- var _getBoundingClientRect = require("@instructure/ui-dom-utils/lib/getBoundingClientRect.js");
22
+ var _uiTestable = require("@instructure/ui-testable");
23
+ var _uiFocusable = require("@instructure/ui-focusable");
24
+ var _uiDomUtils = require("@instructure/ui-dom-utils");
27
25
  var _debounce = require("@instructure/debounce");
28
- var _px = require("@instructure/ui-utils/lib/px.js");
26
+ var _uiUtils = require("@instructure/ui-utils");
29
27
  var _emotion = require("@instructure/emotion");
30
28
  var _styles = _interopRequireDefault(require("./styles"));
31
29
  var _theme = _interopRequireDefault(require("./theme"));
@@ -63,7 +61,7 @@ var _dec, _dec2, _class, _class2;
63
61
  category: components
64
62
  ---
65
63
  **/
66
- let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class Tabs extends _react.Component {
64
+ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class Tabs extends _react.Component {
67
65
  constructor(props) {
68
66
  super(props);
69
67
  this._tabList = null;
@@ -105,7 +103,7 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
105
103
  this.setState({
106
104
  withTabListOverflow: this._tabList.scrollWidth > this._tabList.offsetWidth
107
105
  });
108
- this._tabListPosition = (0, _getBoundingClientRect.getBoundingClientRect)(this._tabList);
106
+ this._tabListPosition = (0, _uiDomUtils.getBoundingClientRect)(this._tabList);
109
107
  };
110
108
  this.handleFocusableRef = el => {
111
109
  this._focusable = el;
@@ -119,7 +117,7 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
119
117
  return;
120
118
  }
121
119
  const tabList = event.currentTarget;
122
- const scrollLeftMax = Math.round(tabList.scrollWidth - (0, _getBoundingClientRect.getBoundingClientRect)(tabList).width);
120
+ const scrollLeftMax = Math.round(tabList.scrollWidth - (0, _uiDomUtils.getBoundingClientRect)(tabList).width);
123
121
  const scrollLeft = Math.floor(Math.abs(tabList.scrollLeft));
124
122
  this.setState({
125
123
  showStartOverLay: scrollLeft > 0,
@@ -180,7 +178,7 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
180
178
  leading: true,
181
179
  trailing: true
182
180
  });
183
- this._tabListPosition = (0, _getBoundingClientRect.getBoundingClientRect)(this._tabList);
181
+ this._tabListPosition = (0, _uiDomUtils.getBoundingClientRect)(this._tabList);
184
182
  this._resizeListener = new ResizeObserver(entries => {
185
183
  for (const entry of entries) {
186
184
  const newWidth = entry.contentRect.width;
@@ -207,9 +205,9 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
207
205
  styles = _this$props3.styles;
208
206
  if (styles && tabOverflow === 'scroll') {
209
207
  if (variant === 'default') {
210
- return (0, _px.px)(styles === null || styles === void 0 ? void 0 : styles.scrollOverlayWidthDefault);
208
+ return (0, _uiUtils.px)(styles === null || styles === void 0 ? void 0 : styles.scrollOverlayWidthDefault);
211
209
  } else {
212
- return (0, _px.px)(styles === null || styles === void 0 ? void 0 : styles.scrollOverlayWidthSecondary);
210
+ return (0, _uiUtils.px)(styles === null || styles === void 0 ? void 0 : styles.scrollOverlayWidthSecondary);
213
211
  }
214
212
  }
215
213
  return 0;
@@ -217,7 +215,7 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
217
215
  showActiveTabIfOverlayed(activeTabEl) {
218
216
  if (this._tabList && this._tabListPosition && typeof this._tabList.scrollTo === 'function' // test for scrollTo support
219
217
  ) {
220
- const tabPosition = (0, _getBoundingClientRect.getBoundingClientRect)(activeTabEl);
218
+ const tabPosition = (0, _uiDomUtils.getBoundingClientRect)(activeTabEl);
221
219
  const tabListPosition = this._tabListPosition;
222
220
  const tabListBoundStart = tabListPosition.left + this.getOverlayWidth();
223
221
  const tabListBoundEnd = tabListPosition.right + this.getOverlayWidth();
@@ -241,7 +239,7 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
241
239
  }
242
240
  }
243
241
  getNextTab(startIndex, step) {
244
- const tabs = _react.default.Children.toArray(this.props.children).map(child => (0, _matchComponentTypes.matchComponentTypes)(child, [_Panel.Panel]) && child);
242
+ const tabs = _react.default.Children.toArray(this.props.children).map(child => (0, _uiReactUtils.matchComponentTypes)(child, [_Panel.Panel]) && child);
245
243
  const count = tabs.length;
246
244
  const change = step < 0 ? step + count : step;
247
245
  (0, _console.logError)(startIndex >= 0 && startIndex < count, `[Tabs] Invalid tab index: '${startIndex}'.`);
@@ -309,13 +307,13 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
309
307
  activePanelClone = /*#__PURE__*/_react.default.cloneElement(activePanel, {
310
308
  key: `panel-${index}`
311
309
  });
312
- return (0, _safeCloneElement.safeCloneElement)(activePanelClone, {
310
+ return (0, _uiReactUtils.safeCloneElement)(activePanelClone, {
313
311
  padding: activePanelClone.props.padding || this.props.padding,
314
312
  textAlign: activePanelClone.props.textAlign || this.props.textAlign,
315
313
  ...commonProps
316
314
  });
317
315
  } else {
318
- return (0, _safeCloneElement.safeCloneElement)(panel, {
316
+ return (0, _uiReactUtils.safeCloneElement)(panel, {
319
317
  key: `panel-${index}`,
320
318
  padding: panel.props.padding || this.props.padding,
321
319
  textAlign: panel.props.textAlign || this.props.textAlign,
@@ -340,14 +338,14 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
340
338
  tabOverflow = _this$props4.tabOverflow,
341
339
  styles = _this$props4.styles,
342
340
  props = (0, _objectWithoutProperties2.default)(_this$props4, _excluded);
343
- const activePanels = _react.default.Children.toArray(children).filter(child => (0, _matchComponentTypes.matchComponentTypes)(child, [_Panel.Panel])).filter(child => child.props.active);
341
+ const activePanels = _react.default.Children.toArray(children).filter(child => (0, _uiReactUtils.matchComponentTypes)(child, [_Panel.Panel])).filter(child => child.props.active);
344
342
  if (activePanels.length > 1) {
345
343
  (0, _console.logError)(false, `[Tabs] Only one Panel can be marked as active.`);
346
344
  }
347
- const selectedChildIndex = _react.default.Children.toArray(children).filter(child => (0, _matchComponentTypes.matchComponentTypes)(child, [_Panel.Panel])).findIndex(child => child.props.isSelected && !child.props.isDisabled);
345
+ const selectedChildIndex = _react.default.Children.toArray(children).filter(child => (0, _uiReactUtils.matchComponentTypes)(child, [_Panel.Panel])).findIndex(child => child.props.isSelected && !child.props.isDisabled);
348
346
  const selectedIndex = selectedChildIndex >= 0 ? selectedChildIndex : 0;
349
347
  _react.default.Children.toArray(children).map((child, index) => {
350
- if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Panel.Panel])) {
348
+ if ((0, _uiReactUtils.matchComponentTypes)(child, [_Panel.Panel])) {
351
349
  const selected = !child.props.isDisabled && (child.props.isSelected || selectedIndex === index);
352
350
  const id = (0, _uid.uid)();
353
351
  tabs.push(this.createTab(index, id, selected, child));
@@ -371,21 +369,21 @@ let Tabs = exports.Tabs = (_dec = (0, _emotion.withStyle)(_styles.default, _them
371
369
  key: "end-overlay",
372
370
  css: styles === null || styles === void 0 ? void 0 : styles.endScrollOverlay
373
371
  }) : null;
374
- return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
372
+ return (0, _emotion.jsx)(_uiView.View, Object.assign({}, (0, _uiReactUtils.passthroughProps)(props), {
375
373
  elementRef: this.handleRef,
376
374
  maxWidth: maxWidth,
377
375
  margin: margin,
378
376
  as: "div",
379
377
  css: styles === null || styles === void 0 ? void 0 : styles.container
380
- }), (0, _emotion.jsx)(_Focusable.Focusable, {
378
+ }), (0, _emotion.jsx)(_uiFocusable.Focusable, {
381
379
  ref: this.handleFocusableRef
382
- }, () => (0, _emotion.jsx)(_View.View, {
380
+ }, () => (0, _emotion.jsx)(_uiView.View, {
383
381
  as: "div",
384
382
  position: "relative",
385
383
  borderRadius: "medium",
386
384
  shouldAnimateFocus: false,
387
385
  css: styles === null || styles === void 0 ? void 0 : styles.tabs
388
- }, (0, _emotion.jsx)(_View.View, {
386
+ }, (0, _emotion.jsx)(_uiView.View, {
389
387
  as: "div",
390
388
  role: "tablist",
391
389
  css: styles === null || styles === void 0 ? void 0 : styles.tabList,
package/lib/Tabs/props.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.propTypes = exports.allowedProps = void 0;
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _Children = require("@instructure/ui-prop-types/lib/Children.js");
9
+ var _uiPropTypes = require("@instructure/ui-prop-types");
10
10
  var _emotion = require("@instructure/emotion");
11
11
  var _Panel = require("./Panel");
12
12
  /*
@@ -34,7 +34,7 @@ var _Panel = require("./Panel");
34
34
  */
35
35
 
36
36
  const propTypes = exports.propTypes = {
37
- children: _Children.Children.oneOf([_Panel.Panel, null]),
37
+ children: _uiPropTypes.Children.oneOf([_Panel.Panel, null]),
38
38
  variant: _propTypes.default.oneOf(['default', 'secondary']),
39
39
  screenReaderLabel: _propTypes.default.string,
40
40
  onRequestTabChange: _propTypes.default.func,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-tabs",
3
- "version": "8.56.1",
3
+ "version": "8.56.2-pr-snapshot-1721749364069",
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",
@@ -23,30 +23,30 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.56.1",
27
- "@instructure/ui-color-utils": "8.56.1",
28
- "@instructure/ui-test-locator": "8.56.1",
29
- "@instructure/ui-test-utils": "8.56.1",
30
- "@instructure/ui-themes": "8.56.1",
26
+ "@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
27
+ "@instructure/ui-color-utils": "8.56.2-pr-snapshot-1721749364069",
28
+ "@instructure/ui-test-locator": "8.56.2-pr-snapshot-1721749364069",
29
+ "@instructure/ui-test-utils": "8.56.2-pr-snapshot-1721749364069",
30
+ "@instructure/ui-themes": "8.56.2-pr-snapshot-1721749364069",
31
31
  "@testing-library/jest-dom": "^6.1.4",
32
32
  "@testing-library/react": "^14.1.2"
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/runtime": "^7.23.2",
36
- "@instructure/console": "8.56.1",
37
- "@instructure/debounce": "8.56.1",
38
- "@instructure/emotion": "8.56.1",
39
- "@instructure/shared-types": "8.56.1",
40
- "@instructure/ui-dom-utils": "8.56.1",
41
- "@instructure/ui-focusable": "8.56.1",
42
- "@instructure/ui-i18n": "8.56.1",
43
- "@instructure/ui-motion": "8.56.1",
44
- "@instructure/ui-prop-types": "8.56.1",
45
- "@instructure/ui-react-utils": "8.56.1",
46
- "@instructure/ui-testable": "8.56.1",
47
- "@instructure/ui-utils": "8.56.1",
48
- "@instructure/ui-view": "8.56.1",
49
- "@instructure/uid": "8.56.1",
36
+ "@instructure/console": "8.56.2-pr-snapshot-1721749364069",
37
+ "@instructure/debounce": "8.56.2-pr-snapshot-1721749364069",
38
+ "@instructure/emotion": "8.56.2-pr-snapshot-1721749364069",
39
+ "@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
40
+ "@instructure/ui-dom-utils": "8.56.2-pr-snapshot-1721749364069",
41
+ "@instructure/ui-focusable": "8.56.2-pr-snapshot-1721749364069",
42
+ "@instructure/ui-i18n": "8.56.2-pr-snapshot-1721749364069",
43
+ "@instructure/ui-motion": "8.56.2-pr-snapshot-1721749364069",
44
+ "@instructure/ui-prop-types": "8.56.2-pr-snapshot-1721749364069",
45
+ "@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
46
+ "@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
47
+ "@instructure/ui-utils": "8.56.2-pr-snapshot-1721749364069",
48
+ "@instructure/ui-view": "8.56.2-pr-snapshot-1721749364069",
49
+ "@instructure/uid": "8.56.2-pr-snapshot-1721749364069",
50
50
  "keycode": "^2.2.1",
51
51
  "prop-types": "^15.8.1"
52
52
  },