@pingux/astro 2.57.0 → 2.58.0

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.
Files changed (37) hide show
  1. package/lib/cjs/components/ListBox/ListBox.d.ts +1 -1
  2. package/lib/cjs/components/ListBox/ListBox.js +5 -5
  3. package/lib/cjs/components/MultivaluesField/MultivaluesField.js +6 -6
  4. package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +30 -0
  5. package/lib/cjs/components/Stepper/Stepper.mdx +20 -14
  6. package/lib/cjs/components/Stepper/Stepper.stories.js +115 -34
  7. package/lib/cjs/components/Stepper/Stepper.styles.js +2 -1
  8. package/lib/cjs/components/Tab/Tab.d.ts +10 -0
  9. package/lib/cjs/components/Tab/Tab.js +18 -58
  10. package/lib/cjs/components/Tab/index.d.ts +2 -0
  11. package/lib/cjs/components/Tabs/Tabs.d.ts +5 -0
  12. package/lib/cjs/components/Tabs/Tabs.js +17 -55
  13. package/lib/cjs/components/Tabs/Tabs.stories.d.ts +14 -0
  14. package/lib/cjs/components/Tabs/Tabs.style.d.ts +52 -0
  15. package/lib/cjs/components/Tabs/Tabs.test.d.ts +1 -0
  16. package/lib/cjs/components/Tabs/Tabs.test.js +38 -20
  17. package/lib/cjs/components/Tabs/index.d.ts +2 -0
  18. package/lib/cjs/types/index.d.ts +2 -0
  19. package/lib/cjs/types/index.js +26 -4
  20. package/lib/cjs/types/item.d.ts +7 -3
  21. package/lib/cjs/types/tab.d.ts +32 -0
  22. package/lib/cjs/types/tab.js +6 -0
  23. package/lib/cjs/types/tabs.d.ts +51 -0
  24. package/lib/cjs/types/tabs.js +6 -0
  25. package/lib/components/ListBox/ListBox.js +2 -2
  26. package/lib/components/MultivaluesField/MultivaluesField.js +6 -6
  27. package/lib/components/MultivaluesField/MultivaluesField.test.js +30 -0
  28. package/lib/components/Stepper/Stepper.mdx +20 -14
  29. package/lib/components/Stepper/Stepper.stories.js +115 -34
  30. package/lib/components/Stepper/Stepper.styles.js +2 -1
  31. package/lib/components/Tab/Tab.js +17 -58
  32. package/lib/components/Tabs/Tabs.js +19 -57
  33. package/lib/components/Tabs/Tabs.test.js +38 -20
  34. package/lib/types/index.js +2 -0
  35. package/lib/types/tab.js +1 -0
  36. package/lib/types/tabs.js +1 -0
  37. package/package.json +4 -2
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ListLayout } from '@react-stately/layout';
2
+ import { ListLayout } from 'listbox-layout';
3
3
  import { ListBoxProps } from '../../types';
4
4
  export declare const collectionTypes: {
5
5
  ITEM: string;
@@ -25,8 +25,8 @@ var _react = _interopRequireWildcard(require("react"));
25
25
  var _reactAria = require("react-aria");
26
26
  var _i18n = require("@react-aria/i18n");
27
27
  var _listbox = require("@react-aria/listbox");
28
- var _virtualizer = require("@react-aria/virtualizer");
29
- var _layout = require("@react-stately/layout");
28
+ var _listboxLayout = require("listbox-layout");
29
+ var _listboxVirtualizer = require("listbox-virtualizer");
30
30
  var _hooks = require("../../hooks");
31
31
  var _Loader = _interopRequireDefault(require("../Loader"));
32
32
  var _index = require("./index");
@@ -50,7 +50,7 @@ function useListBoxLayout(state) {
50
50
  sensitivity: 'base'
51
51
  });
52
52
  var layout = (0, _react.useMemo)(function () {
53
- return new _layout.ListLayout({
53
+ return new _listboxLayout.ListLayout({
54
54
  estimatedRowHeight: 41,
55
55
  estimatedHeadingHeight: 26,
56
56
  padding: 4,
@@ -145,7 +145,7 @@ var ListBox = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
145
145
  return c.viewType === 'item';
146
146
  })));
147
147
  }
148
- return (0, _react2.jsx)(_virtualizer.VirtualizerItem, {
148
+ return (0, _react2.jsx)(_listboxVirtualizer.VirtualizerItem, {
149
149
  key: reusableView.key,
150
150
  reusableView: reusableView,
151
151
  parent: parent
@@ -153,7 +153,7 @@ var ListBox = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
153
153
  };
154
154
  return (0, _react2.jsx)(_ListBoxContext.ListBoxContext.Provider, {
155
155
  value: state
156
- }, (0, _react2.jsx)(_virtualizer.Virtualizer, (0, _extends2["default"])({}, (0, _reactAria.mergeProps)(listBoxProps, others), {
156
+ }, (0, _react2.jsx)(_listboxVirtualizer.Virtualizer, (0, _extends2["default"])({}, (0, _reactAria.mergeProps)(listBoxProps, others), {
157
157
  autoFocus: hasAutoFocus,
158
158
  style: {
159
159
  outline: 'none'
@@ -255,17 +255,17 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
255
255
  selectionManager.toggleSelection(selectionManager.focusedKey);
256
256
  setFilterString('');
257
257
  }
258
- } else if (hasCustomValue && filteredItems.length === 1) {
259
- selectTheOnlyFilteredItem();
260
- } else if (!hasCustomValue) {
261
- setFilterString('');
262
- close();
263
- } else if (hasCustomValue) {
258
+ } else if (hasCustomValue && !selectionManager.focusedKey) {
264
259
  var _key = e.target.value;
265
260
  if (_key === '') {
266
261
  return;
267
262
  }
268
263
  addNewBadgeFromInput(e.target.value);
264
+ } else if (hasCustomValue && filteredItems.length === 1) {
265
+ selectTheOnlyFilteredItem();
266
+ } else if (!hasCustomValue) {
267
+ setFilterString('');
268
+ close();
269
269
  }
270
270
  break;
271
271
  }
@@ -703,6 +703,36 @@ test('should clear the input text onBlur and enter when a single filter result i
703
703
  });
704
704
  expect(input).toHaveValue('');
705
705
  });
706
+ test('in non-restrictive mode the partial string values should be accepted', function () {
707
+ var itemsWithDuplicatePartialString = [{
708
+ id: 1,
709
+ name: 'echo:read',
710
+ key: 'echo:read'
711
+ }, {
712
+ id: 2,
713
+ name: 'echo:write',
714
+ key: 'echo:write'
715
+ }, {
716
+ id: 3,
717
+ name: 'echo:delete',
718
+ key: 'echo:delete'
719
+ }];
720
+ getComponent({
721
+ mode: 'non-restrictive',
722
+ items: itemsWithDuplicatePartialString
723
+ });
724
+ var input = _testWrapper.screen.getByRole('combobox');
725
+ expect(input).toHaveValue('');
726
+ var value = 'echo:r';
727
+ _userEvent["default"].type(input, value);
728
+ _userEvent["default"].type(input, '{enter}');
729
+ expect(input).toHaveValue('');
730
+ expect(_testWrapper.screen.queryByText(value)).toBeInTheDocument();
731
+ _userEvent["default"].type(input, value);
732
+ _userEvent["default"].type(input, '{enter}');
733
+ expect(input).not.toHaveValue('');
734
+ expect(input).toHaveValue(value);
735
+ });
706
736
 
707
737
  // Needs to be added to each components test file
708
738
  (0, _universalComponentTest.universalComponentTests)({
@@ -1,13 +1,14 @@
1
- import { Meta } from '@storybook/addon-docs';
1
+ import { Meta } from "@storybook/addon-docs";
2
2
 
3
3
  <Meta title="Components/Stepper/Stepper" />
4
4
 
5
5
  # Stepper
6
6
 
7
- The Stepper component acts as a wrapper for individual step components.
7
+ The Stepper component acts as a wrapper for individual step components.
8
8
  It is used to display progress through a sequence of logical and numbered steps, usually within a configuration wizard.
9
9
 
10
10
  This component should be used:
11
+
11
12
  - To reveal or hide sections of content.
12
13
  - For progressive disclosure.
13
14
 
@@ -19,23 +20,28 @@ This component requires the Item originating from [react-stately/collections](ht
19
20
 
20
21
  ### Accessibility
21
22
 
22
- This component should adhere to the [WAI-ARIA Stepper](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/) accessibility guidelines.
23
+ This component should adhere to the [WAI-ARIA Stepper](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/) accessibility guidelines.
23
24
 
24
25
  #### Keyboard Navigation
25
26
 
26
- These keys provide additional functionality to the component.
27
+ These keys provide additional functionality to the component.
27
28
 
28
- | Keys | Function |
29
- | ---- | ---- |
30
- | Tab | The field is focusable using the Tab key and follows the page tab sequence. |
31
- | Arrow keys | When this field is focused, the arrow keys can be used to navigate through the steps. |
32
- | Shift + Tab | Moves focus to the previous focusable component. |
33
- | Home(Fn + Right Arrow Key) Or Control/Command + Home| Shifts the focus to the first step. |
34
- | End(Fn + Left Arrow Key) Or Control/Command + End | Shifts the focus to the last step. |
29
+ | Keys | Function |
30
+ | ---------------------------------------------------- | ------------------------------------------------------------------------------------- |
31
+ | Tab | The field is focusable using the Tab key and follows the page tab sequence. |
32
+ | Arrow keys | When this field is focused, the arrow keys can be used to navigate through the steps. |
33
+ | Shift + Tab | Moves focus to the previous focusable component. |
34
+ | Home(Fn + Right Arrow Key) Or Control/Command + Home | Shifts the focus to the first step. |
35
+ | End(Fn + Left Arrow Key) Or Control/Command + End | Shifts the focus to the last step. |
35
36
 
36
37
  #### Screen Readers
37
38
 
38
39
  This component uses the following attributes to assist screen readers:
39
- - The **`aria-orientation`** attribute indicates whether the orientation is horizontal, vertical, unknown, or ambiguous.
40
- - Each step uses the **`aria-selected`** attribute to indicate the selection status, and the **`aria-control`** attribute is supplied with the associated panel ID that displays the content.
41
- - Each step uses the **`aria-labelledby`** with the label ID to reference it.
40
+
41
+ - The **`aria-orientation`** attribute indicates whether the orientation is horizontal, vertical, unknown, or ambiguous.
42
+ - Each step uses the **`aria-selected`** attribute to indicate the selection status, and the **`aria-control`** attribute is supplied with the associated panel ID that displays the content.
43
+ - Each step uses the **`aria-labelledby`** with the label ID to reference it.
44
+
45
+ #### Usage
46
+
47
+ - The stepper component is always center-aligned in its context, whether it's in a page, a panel, or a popup.
@@ -8,12 +8,14 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
8
8
  _Object$defineProperty(exports, "__esModule", {
9
9
  value: true
10
10
  });
11
- exports["default"] = exports.WithoutContent = exports.Default = exports.ControlledStepper = void 0;
11
+ exports["default"] = exports.Panel = exports.Default = exports.ControlledStepper = void 0;
12
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _reactStately = require("react-stately");
15
+ var _CreationOutlineIcon = _interopRequireDefault(require("@pingux/mdi-react/CreationOutlineIcon"));
15
16
  var _storybookAddonDesigns = require("storybook-addon-designs");
16
17
  var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
18
+ var _hooks = require("../../hooks");
17
19
  var _index = require("../../index");
18
20
  var _figmaLinks = require("../../utils/designUtils/figmaLinks.ts");
19
21
  var _Stepper = _interopRequireDefault(require("./Stepper.mdx"));
@@ -70,30 +72,69 @@ var _default = {
70
72
  };
71
73
  exports["default"] = _default;
72
74
  var steps = [{
73
- label: 'Label 1',
74
- children: 'This is content for step 1',
75
+ label: 'Duis Aute',
76
+ children: 'Quis autem vel eum iure reprehenderit qui in ea voluptate',
77
+ title: 'Duis Aute',
75
78
  name: 'step1'
76
79
  }, {
77
- label: 'Label 2',
78
- children: 'This is content for step 2',
80
+ label: 'Lorem Ipsum',
81
+ children: 'Sed ut perspiciatis unde omnis',
82
+ title: 'Lorem Ipsum',
79
83
  name: 'step2'
80
84
  }, {
81
- label: 'Label 3',
82
- children: 'This is content for step 3',
85
+ label: 'Excepteur Sint',
86
+ children: 'Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam',
87
+ title: 'Excepteur Sint',
83
88
  name: 'step3'
84
89
  }];
90
+ var sx = {
91
+ overlayPanel: {
92
+ padding: '0px',
93
+ transition: 'width 500ms, right 500ms'
94
+ },
95
+ stepperContainer: {
96
+ padding: 'lg'
97
+ },
98
+ contentContainer: {
99
+ marginTop: 'lg',
100
+ gap: 'sm'
101
+ },
102
+ buttonStyle: {
103
+ margin: '50px 0px'
104
+ }
105
+ };
85
106
  var Default = function Default(args) {
86
107
  return (0, _react2.jsx)(_index.Stepper, args, (0, _react2.jsx)(_reactStately.Item, {
87
108
  key: "step1",
88
- textValue: "Step 1"
109
+ textValue: "Duis Aute"
110
+ }, (0, _react2.jsx)(_index.Box, {
111
+ sx: sx.contentContainer
89
112
  }, (0, _react2.jsx)(_index.Text, {
90
- pt: "lg"
91
- }, "This is content for step 1")), (0, _react2.jsx)(_reactStately.Item, {
113
+ fontSize: "md",
114
+ fontWeight: "3"
115
+ }, "Duis Aute"), (0, _react2.jsx)(_index.Text, {
116
+ fontSize: "md"
117
+ }, "Quis autem vel eum iure reprehenderit qui in ea voluptate"))), (0, _react2.jsx)(_reactStately.Item, {
92
118
  key: "step2",
93
- textValue: "Step 2"
119
+ textValue: "Lorem Ipsum"
120
+ }, (0, _react2.jsx)(_index.Box, {
121
+ sx: sx.contentContainer
122
+ }, (0, _react2.jsx)(_index.Text, {
123
+ fontSize: "md",
124
+ fontWeight: "3"
125
+ }, "Lorem Ipsum"), (0, _react2.jsx)(_index.Text, {
126
+ fontSize: "md"
127
+ }, "Sed ut perspiciatis unde omnis"))), (0, _react2.jsx)(_reactStately.Item, {
128
+ key: "step3",
129
+ textValue: "Excepteur Sint"
130
+ }, (0, _react2.jsx)(_index.Box, {
131
+ sx: sx.contentContainer
94
132
  }, (0, _react2.jsx)(_index.Text, {
95
- pt: "lg"
96
- }, "This is content for step 2")));
133
+ fontSize: "md",
134
+ fontWeight: "3"
135
+ }, "Excepteur Sint"), (0, _react2.jsx)(_index.Text, {
136
+ fontSize: "md"
137
+ }, "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam"))));
97
138
  };
98
139
  exports.Default = Default;
99
140
  Default.parameters = {
@@ -107,12 +148,6 @@ var ControlledStepper = function ControlledStepper() {
107
148
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
108
149
  activeStep = _useState2[0],
109
150
  setActiveStep = _useState2[1];
110
-
111
- // steps = [
112
- // { label: 'Label 1', children: 'This is content for step 1', name: 'step1' },
113
- // { label: 'Label 2', children: 'This is content for step 2', name: 'step2' },
114
- // { label: 'Label 3', children: 'This is content for step 3', name: 'step3' },
115
- // ];
116
151
  return (0, _react2.jsx)(_index.Stepper, {
117
152
  items: steps,
118
153
  activeStep: activeStep,
@@ -120,23 +155,69 @@ var ControlledStepper = function ControlledStepper() {
120
155
  }, function (item) {
121
156
  return (0, _react2.jsx)(_reactStately.Item, {
122
157
  key: item.name,
123
- textValue: item.name
158
+ textValue: item.title
159
+ }, (0, _react2.jsx)(_index.Box, {
160
+ sx: sx.contentContainer
124
161
  }, (0, _react2.jsx)(_index.Text, {
125
- pt: "lg"
126
- }, item.children));
162
+ fontSize: "md",
163
+ fontWeight: "3"
164
+ }, item.title), (0, _react2.jsx)(_index.Text, {
165
+ fontSize: "md"
166
+ }, item.children)));
127
167
  });
128
168
  };
129
169
  exports.ControlledStepper = ControlledStepper;
130
- var WithoutContent = function WithoutContent() {
131
- return (0, _react2.jsx)(_index.Stepper, null, (0, _react2.jsx)(_reactStately.Item, {
132
- key: "step1",
133
- textValue: "Step 1"
134
- }), (0, _react2.jsx)(_reactStately.Item, {
135
- key: "step2",
136
- textValue: "Step 2"
137
- }), (0, _react2.jsx)(_reactStately.Item, {
138
- key: "step3",
139
- textValue: "Step 3"
140
- }));
170
+ var Panel = function Panel() {
171
+ var _useState3 = (0, _react.useState)(1),
172
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
173
+ activeStep = _useState4[0],
174
+ setActiveStep = _useState4[1];
175
+ var _useOverlayPanelState = (0, _hooks.useOverlayPanelState)(),
176
+ state = _useOverlayPanelState.state,
177
+ onClose = _useOverlayPanelState.onClose;
178
+ var triggerRef = _react.useRef < HTMLButtonElement > null;
179
+ var onCloseHandler = function onCloseHandler() {
180
+ return onClose(state, triggerRef);
181
+ };
182
+ return (
183
+ // Application must be wrapped in an OverlayProvider so that it can be hidden from screen
184
+ // readers when an overlay opens.
185
+ (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Button, {
186
+ onPress: state.open,
187
+ "aria-expanded": state.isOpen,
188
+ sx: sx.buttonStyle
189
+ }, "Open Panel"), (state.isOpen || state.isTransitioning) && (0, _react2.jsx)(_index.OverlayPanel, {
190
+ isTransitioning: state.isTransitioning,
191
+ isOpen: state.isOpen,
192
+ state: state,
193
+ triggerRef: triggerRef,
194
+ sx: sx.overlayPanel,
195
+ size: "full"
196
+ }, (0, _react2.jsx)(_index.PanelHeader, {
197
+ data: {
198
+ icon: _CreationOutlineIcon["default"],
199
+ text: 'Sed Ut Perspiciatis'
200
+ }
201
+ }, (0, _react2.jsx)(_index.PanelHeaderCloseButton, {
202
+ onPress: onCloseHandler
203
+ })), (0, _react2.jsx)(_index.Stepper, {
204
+ items: steps,
205
+ activeStep: activeStep,
206
+ onStepChange: setActiveStep,
207
+ sx: sx.stepperContainer
208
+ }, function (item) {
209
+ return (0, _react2.jsx)(_reactStately.Item, {
210
+ key: item.name,
211
+ textValue: item.title
212
+ }, (0, _react2.jsx)(_index.Box, {
213
+ sx: sx.contentContainer
214
+ }, (0, _react2.jsx)(_index.Text, {
215
+ fontSize: "md",
216
+ fontWeight: "3"
217
+ }, item.title), (0, _react2.jsx)(_index.Text, {
218
+ fontSize: "md"
219
+ }, item.children)));
220
+ })))
221
+ );
141
222
  };
142
- exports.WithoutContent = WithoutContent;
223
+ exports.Panel = Panel;
@@ -24,7 +24,8 @@ var tabs = {
24
24
  outline: 'none',
25
25
  borderBottom: 'none',
26
26
  mb: 0,
27
- width: '100%'
27
+ width: '100%',
28
+ justifyContent: 'center'
28
29
  };
29
30
  var tab = {
30
31
  mb: 0,
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Item as Tab } from 'react-stately';
3
+ import { TabProps } from '../../types';
4
+ /**
5
+ * Tab control for dividing up closely-related content.
6
+ * Typically used as a child of the Tabs component.
7
+ */
8
+ export declare const CollectionTab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLElement>>;
9
+ export declare const TabLine: (props: any) => React.JSX.Element;
10
+ export default Tab;
@@ -10,12 +10,10 @@ _Object$defineProperty(exports, "__esModule", {
10
10
  });
11
11
  exports["default"] = exports.TabLine = exports.CollectionTab = void 0;
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
13
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
14
13
  var _react = _interopRequireWildcard(require("react"));
15
14
  var _reactAria = require("react-aria");
16
15
  var _reactStately = require("react-stately");
17
16
  var _interactions = require("@react-aria/interactions");
18
- var _propTypes = _interopRequireDefault(require("prop-types"));
19
17
  var _ = require("../..");
20
18
  var _hooks = require("../../hooks");
21
19
  var _orientation = _interopRequireDefault(require("../../utils/devUtils/constants/orientation"));
@@ -23,13 +21,13 @@ var _pendoID = require("../../utils/devUtils/constants/pendoID");
23
21
  var _TabPicker = _interopRequireDefault(require("../TabPicker"));
24
22
  var _Tabs = require("../Tabs");
25
23
  var _react2 = require("@emotion/react");
26
- var _excluded = ["icon", "isDisabled", "separator", "tabLabelProps", "tabLineProps", "content", "titleAttr", "title"];
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
26
  /**
28
27
  * Tab control for dividing up closely-related content.
29
28
  * Typically used as a child of the Tabs component.
30
29
  */
31
- function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
30
+
33
31
  var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
34
32
  var className = props.className,
35
33
  item = props.item,
@@ -41,17 +39,8 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
41
39
  var key = item.key,
42
40
  rendered = item.rendered,
43
41
  itemProps = item.props;
44
- var icon = itemProps.icon,
45
- tabDisabled = itemProps.isDisabled,
46
- separator = itemProps.separator,
47
- tabLabelProps = itemProps.tabLabelProps,
48
- tabLineProps = itemProps.tabLineProps,
49
- content = itemProps.content,
50
- titleAttr = itemProps.titleAttr,
51
- title = itemProps.title,
52
- otherItemProps = (0, _objectWithoutProperties2["default"])(itemProps, _excluded);
53
42
  var state = (0, _react.useContext)(_Tabs.TabsContext);
54
- var isDisabled = tabsDisabled || tabDisabled || state.disabledKeys.has(key);
43
+ var isDisabled = tabsDisabled || (itemProps === null || itemProps === void 0 ? void 0 : itemProps.isDisabled) || state.disabledKeys.has(key);
55
44
  var isSelected = state.selectedKey === key;
56
45
  var _useFocusRing = (0, _reactAria.useFocusRing)(),
57
46
  isFocusVisible = _useFocusRing.isFocusVisible,
@@ -68,12 +57,8 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
68
57
  isSelected: isSelected
69
58
  }),
70
59
  classNames = _useStatusClasses.classNames;
71
- var tabRef = (0, _react.useRef)();
72
60
  (0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
73
- /* istanbul ignore next */
74
- (0, _react.useImperativeHandle)(ref, function () {
75
- return tabRef.current;
76
- });
61
+ var tabRef = (0, _hooks.useLocalOrForwardRef)(ref);
77
62
  var _useTab = (0, _reactAria.useTab)({
78
63
  key: key,
79
64
  isDisabled: isDisabled
@@ -84,58 +69,33 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
84
69
  }, slots === null || slots === void 0 ? void 0 : slots.beforeTab, (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
85
70
  className: classNames,
86
71
  variant: "tab"
87
- }, (0, _reactAria.mergeProps)(focusProps, hoverProps, tabProps), (0, _pendoID.getPendoID)('Tab'), otherItemProps, {
88
- ref: tabRef,
89
- title: titleAttr || undefined
90
- }), icon, (0, _react2.jsx)(_.Text, (0, _extends2["default"])({
72
+ // title={itemProps?.titleAttr || undefined}
73
+ }, (0, _reactAria.mergeProps)(focusProps, hoverProps, tabProps), (0, _pendoID.getPendoID)('Tab'), {
74
+ // {...otherItemProps}
75
+ ref: tabRef
76
+ }, itemProps, {
77
+ role: "tab"
78
+ }), (0, _react2.jsx)(_react["default"].Fragment, null, itemProps === null || itemProps === void 0 ? void 0 : itemProps.icon, (0, _react2.jsx)(_.Text, (0, _extends2["default"])({
91
79
  variant: "tabLabel"
92
- }, tabLabelProps), rendered), isSelected && !isDisabled && (0, _react2.jsx)(TabLine, tabLineProps)), slots === null || slots === void 0 ? void 0 : slots.afterTab);
93
- if (mode === 'list' && itemProps.list) {
80
+ }, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLabelProps), rendered), isSelected && !isDisabled && (0, _react2.jsx)(TabLine, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLineProps))), slots === null || slots === void 0 ? void 0 : slots.afterTab);
81
+ if (mode === 'list' && itemProps !== null && itemProps !== void 0 && itemProps.list) {
94
82
  return (0, _react2.jsx)(_TabPicker["default"], (0, _extends2["default"])({
95
83
  ref: tabRef,
96
84
  className: classNames,
97
- items: itemProps.list,
85
+ items: itemProps === null || itemProps === void 0 ? void 0 : itemProps.list,
98
86
  state: state,
99
87
  item: item
100
- }, (0, _reactAria.mergeProps)(focusProps, hoverProps, tabProps), otherItemProps));
88
+ }, (0, _reactAria.mergeProps)(focusProps, hoverProps, tabProps), itemProps));
101
89
  }
102
90
  if (mode === 'tooltip') {
103
- return (0, _react2.jsx)(_react["default"].Fragment, null, separator, (0, _react2.jsx)(_.TooltipTrigger, (0, _extends2["default"])({}, tooltipTriggerProps, {
91
+ return (0, _react2.jsx)(_react["default"].Fragment, null, itemProps === null || itemProps === void 0 ? void 0 : itemProps.separator, (0, _react2.jsx)(_.TooltipTrigger, (0, _extends2["default"])({}, tooltipTriggerProps, {
104
92
  isOpen: isHovered || isFocusVisible
105
- }), (0, _react2.jsx)(_interactions.Pressable, null, (0, _react2.jsx)("span", {
106
- variant: "quiet"
107
- }, tab)), (0, _react2.jsx)(_.Tooltip, null, itemProps.textValue || itemProps.title)));
93
+ }), (0, _react2.jsx)(_interactions.Pressable, null, (0, _react2.jsx)("span", null, tab)), (0, _react2.jsx)(_.Tooltip, null, (itemProps === null || itemProps === void 0 ? void 0 : itemProps.textValue) || (itemProps === null || itemProps === void 0 ? void 0 : itemProps.title))));
108
94
  }
109
95
  return tab;
110
96
  });
111
97
  exports.CollectionTab = CollectionTab;
112
98
  CollectionTab.displayName = 'CollectionTab';
113
- CollectionTab.propTypes = {
114
- isDisabled: _propTypes["default"].bool,
115
- item: _propTypes["default"].shape({
116
- key: _propTypes["default"].string,
117
- props: _propTypes["default"].shape({
118
- icon: _propTypes["default"].shape({}),
119
- isDisabled: _propTypes["default"].bool,
120
- textValue: _propTypes["default"].string,
121
- tabLineProps: _propTypes["default"].shape({}),
122
- tabLabelProps: _propTypes["default"].shape({}),
123
- content: _propTypes["default"].shape({}),
124
- titleAttr: _propTypes["default"].string,
125
- title: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].string, _propTypes["default"].object]),
126
- separator: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].bool]),
127
- list: _propTypes["default"].arrayOf(_propTypes["default"].shape({}))
128
- }),
129
- rendered: _propTypes["default"].node
130
- }),
131
- mode: _propTypes["default"].oneOf(['default', 'tooltip', 'list']),
132
- orientation: _propTypes["default"].oneOf(['horizontal', 'vertical']),
133
- tooltipTriggerProps: _propTypes["default"].shape({}),
134
- slots: _propTypes["default"].shape({
135
- beforeTab: _propTypes["default"].node,
136
- afterTab: _propTypes["default"].node
137
- })
138
- };
139
99
  var TabLine = function TabLine(props) {
140
100
  return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
141
101
  role: "presentation",
@@ -0,0 +1,2 @@
1
+ export { default } from './Tab';
2
+ export * from './Tab';
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { TabsProps } from '../../types';
3
+ export declare const TabsContext: React.Context<{}>;
4
+ declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLElement>>;
5
+ export default Tabs;