@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
@@ -26,14 +26,13 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-c
26
26
  var _react = _interopRequireWildcard(require("react"));
27
27
  var _reactAria = require("react-aria");
28
28
  var _reactStately = require("react-stately");
29
- var _propTypes = _interopRequireDefault(require("prop-types"));
30
29
  var _hooks = require("../../hooks");
31
30
  var _orientation = _interopRequireDefault(require("../../utils/devUtils/constants/orientation"));
32
31
  var _Box = _interopRequireDefault(require("../Box"));
33
32
  var _Tab = require("../Tab");
34
33
  var _react2 = require("@emotion/react");
35
34
  var _excluded = ["state"],
36
- _excluded2 = ["children", "isDisabled", "items", "onSelectionChange", "orientation", "mode", "tabListProps", "tabPanelProps"];
35
+ _excluded2 = ["isDisabled", "items", "onSelectionChange", "orientation", "mode", "tabListProps", "tabPanelProps"];
37
36
  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); }
38
37
  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; }
39
38
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -43,23 +42,19 @@ exports.TabsContext = TabsContext;
43
42
  var TabPanel = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
44
43
  var state = _ref.state,
45
44
  props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
46
- var tabPanelRef = (0, _react.useRef)();
47
45
  var children = props.children,
48
46
  tabPanelProps = props.tabPanelProps;
49
- /* istanbul ignore next */
50
- (0, _react.useImperativeHandle)(ref, function () {
51
- return tabPanelRef.current;
52
- });
53
- var _useTabPanel = (0, _reactAria.useTabPanel)(props, state, tabPanelRef),
54
- raTabPanelProps = _useTabPanel.tabPanelProps;
47
+ var tabPanelRef = (0, _hooks.useLocalOrForwardRef)(ref);
48
+ var _ref2 = (0, _reactAria.useTabPanel)(props, state, tabPanelRef),
49
+ raTabPanelProps = _ref2.tabPanelProps;
55
50
  return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({}, tabPanelProps, raTabPanelProps, {
56
- ref: tabPanelRef
51
+ ref: tabPanelRef,
52
+ role: "tabpanel"
57
53
  }), children);
58
54
  });
59
55
  var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
60
56
  var _context4, _context5, _state$selectedItem, _state$selectedItem2, _state$selectedItem3;
61
- var children = props.children,
62
- isDisabled = props.isDisabled,
57
+ var isDisabled = props.isDisabled,
63
58
  items = props.items,
64
59
  onSelectionChange = props.onSelectionChange,
65
60
  orientation = props.orientation,
@@ -67,14 +62,10 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
67
62
  tabListProps = props.tabListProps,
68
63
  tabPanelProps = props.tabPanelProps,
69
64
  others = (0, _objectWithoutProperties2["default"])(props, _excluded2);
70
- var tabListRef = (0, _react.useRef)();
71
65
  (0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
72
- /* istanbul ignore next */
73
- (0, _react.useImperativeHandle)(ref, function () {
74
- return tabListRef.current;
75
- });
66
+ var tabListRef = (0, _hooks.useLocalOrForwardRef)(ref);
76
67
  var allItems = [];
77
- if (mode === 'list') {
68
+ if (mode === 'list' && items) {
78
69
  (0, _forEach["default"])(items).call(items, function (item) {
79
70
  var _context;
80
71
  allItems = (0, _concat["default"])(_context = []).call(_context, allItems, [item]);
@@ -94,7 +85,8 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
94
85
  items: mode === 'list' ? allItems : items
95
86
  }));
96
87
  var _useTabList = (0, _reactAria.useTabList)(props, state, tabListRef),
97
- raTabListProps = _useTabList.tabListProps;
88
+ raTabListProps = _useTabList.tabListProps; //= useTabList(props, state, tabListRef);
89
+
98
90
  return (0, _react2.jsx)(TabsContext.Provider, {
99
91
  value: state
100
92
  }, (0, _react2.jsx)(_Box["default"], others, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
@@ -102,19 +94,20 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
102
94
  gap: "25px",
103
95
  isRow: orientation === _orientation["default"].HORIZONTAL
104
96
  }, tabListProps, raTabListProps, {
105
- ref: tabListRef
97
+ ref: tabListRef,
98
+ role: "tablist"
106
99
  }), (0, _map["default"])(_context4 = (0, _filter["default"])(_context5 = (0, _from["default"])(state.collection)).call(_context5, function (item) {
107
- var _item$value;
108
- return !(item !== null && item !== void 0 && (_item$value = item.value) !== null && _item$value !== void 0 && _item$value.isListItem);
109
- })).call(_context4, function (item) {
110
100
  var _item$props;
101
+ return !(item !== null && item !== void 0 && (_item$props = item.props) !== null && _item$props !== void 0 && _item$props.isListItem);
102
+ })).call(_context4, function (item) {
103
+ var _item$props2;
111
104
  return (0, _react2.jsx)(_Tab.CollectionTab, {
112
105
  key: item.key,
113
106
  item: item,
114
107
  isDisabled: isDisabled,
115
108
  orientation: orientation,
116
109
  mode: mode,
117
- slots: item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.slots
110
+ slots: item === null || item === void 0 || (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.slots
118
111
  });
119
112
  })), (0, _react2.jsx)(TabPanel, {
120
113
  key: (_state$selectedItem = state.selectedItem) === null || _state$selectedItem === void 0 ? void 0 : _state$selectedItem.key,
@@ -122,43 +115,12 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
122
115
  tabPanelProps: tabPanelProps
123
116
  }, ((_state$selectedItem2 = state.selectedItem) === null || _state$selectedItem2 === void 0 ? void 0 : _state$selectedItem2.props.children) || ((_state$selectedItem3 = state.selectedItem) === null || _state$selectedItem3 === void 0 ? void 0 : _state$selectedItem3.props.content))));
124
117
  });
125
- Tabs.propTypes = {
126
- /** The default tab key to be selected. (uncontrolled) */
127
- defaultSelectedKey: _propTypes["default"].string,
128
- /** Array of keys to disable within the tab list. */
129
- disabledKeys: _propTypes["default"].arrayOf(_propTypes["default"].string),
130
- /** The tab key that is currently selected. (controlled) */
131
- selectedKey: _propTypes["default"].string,
132
- /** Determines the arrangement of the tablist. */
133
- orientation: _propTypes["default"].oneOf(['horizontal', 'vertical']),
134
- /** Determines the behavior model for the tabs. */
135
- mode: _propTypes["default"].oneOf(['default', 'tooltip', 'list']),
136
- /**
137
- * *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
138
- * For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
139
- */
140
- items: _propTypes["default"].arrayOf(_propTypes["default"].shape({})),
141
- /** Whether the entire tablist is disabled. */
142
- isDisabled: _propTypes["default"].bool,
143
- /** Handler that is called when the selected tab has changed. */
144
- onSelectionChange: _propTypes["default"].func,
145
- /** A props object that is subsequently spread into the rendered tablist. */
146
- tabListProps: _propTypes["default"].shape({}),
147
- /** Props object that is spread directly into all of the tab panel wrapper elements. */
148
- tabPanelProps: _propTypes["default"].shape({}),
149
- /** Whether tabs are activated automatically on focus or manually¸ */
150
- keyboardActivation: _propTypes["default"].oneOf(['automatic', 'manual'])
151
- };
152
118
  Tabs.defaultProps = {
153
119
  isDisabled: false,
154
120
  orientation: 'horizontal',
155
121
  mode: 'default',
156
122
  keyboardActivation: 'manual'
157
123
  };
158
- TabPanel.propTypes = {
159
- state: _propTypes["default"].shape({}),
160
- tabPanelProps: _propTypes["default"].shape({})
161
- };
162
124
  Tabs.displayName = 'Tabs';
163
125
  var _default = Tabs;
164
126
  exports["default"] = _default;
@@ -0,0 +1,14 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ import { TabsProps } from '../../types';
3
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
4
+ export default _default;
5
+ export declare const Uncontrolled: StoryFn<TabsProps>;
6
+ export declare const Controlled: StoryFn;
7
+ export declare const WithTooltips: StoryFn;
8
+ export declare const Centered: StoryFn;
9
+ export declare const DisabledSingleTab: StoryFn;
10
+ export declare const DisabledAllTabs: StoryFn;
11
+ export declare const CustomTabLine: StoryFn;
12
+ export declare const TabPanelProps: StoryFn;
13
+ export declare const ContentSlots: StoryFn;
14
+ export declare const WithList: StoryFn;
@@ -0,0 +1,52 @@
1
+ export declare const tab: {
2
+ pt: number;
3
+ cursor: string;
4
+ alignItems: string;
5
+ display: string;
6
+ outline: string;
7
+ transform: string;
8
+ '&.is-focused': {
9
+ '& > span': {
10
+ boxShadow: string;
11
+ outline: string;
12
+ outlineColor: string;
13
+ outlineOffset: string;
14
+ };
15
+ };
16
+ '&.is-disabled': {
17
+ cursor: string;
18
+ };
19
+ '&.is-selected.is-vertical': {
20
+ bg: string;
21
+ };
22
+ '& > svg': {
23
+ flexShrink: number;
24
+ };
25
+ };
26
+ export declare const tabLine: {
27
+ height: string;
28
+ width: string;
29
+ bg: string;
30
+ flexShrink: number;
31
+ };
32
+ export declare const tabPanel: {
33
+ outline: string;
34
+ };
35
+ export declare const tabs: {
36
+ borderBottomWidth: number;
37
+ borderBottomStyle: string;
38
+ borderBottomColor: string;
39
+ mb: string;
40
+ };
41
+ export declare const menuTab: {
42
+ color: string;
43
+ alignItems: string;
44
+ '&.is-selected *, &.is-hovered *': {
45
+ color: string;
46
+ };
47
+ '& + *:not(div:first-of-type)': {
48
+ ml: string;
49
+ };
50
+ all: string;
51
+ display: string;
52
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -38,17 +38,21 @@ emotionCache.compat = true;
38
38
  var testId = 'testId';
39
39
  var defaultTabs = [{
40
40
  name: 'Tab 1',
41
- children: 'Tab 1 body'
41
+ children: 'Tab 1 body',
42
+ props: {}
42
43
  }, {
43
44
  name: 'Tab 2',
44
- children: 'Tab 2 body'
45
+ children: 'Tab 2 body',
46
+ props: {}
45
47
  }, {
46
48
  name: 'Tab 3',
47
- children: 'Tab 3 body'
49
+ children: 'Tab 3 body',
50
+ props: {}
48
51
  }];
49
52
  var tabsWithList = [{
50
53
  name: 'Tab 1',
51
- children: 'Tab 1 body'
54
+ children: 'Tab 1 body',
55
+ props: {}
52
56
  }, {
53
57
  name: 'Tab 2',
54
58
  list: [{
@@ -61,7 +65,8 @@ var tabsWithList = [{
61
65
  name: 'Tab 2 list',
62
66
  children: 'Tab 2 from list',
63
67
  role: 'menuitemradio'
64
- }]
68
+ }],
69
+ props: {}
65
70
  }];
66
71
  var defaultProps = {
67
72
  'data-testid': testId,
@@ -78,8 +83,8 @@ var getComponent = function getComponent() {
78
83
  value: emotionCache
79
84
  }, (0, _react2.jsx)(_Tabs["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _map["default"])(tabs).call(tabs, function (_ref2) {
80
85
  var name = _ref2.name,
81
- tabProps = _ref2.props,
82
- children = _ref2.children;
86
+ children = _ref2.children,
87
+ tabProps = _ref2.props;
83
88
  return (0, _react2.jsx)(_Tab["default"], (0, _extends2["default"])({
84
89
  key: name,
85
90
  title: name
@@ -115,7 +120,10 @@ var getTabs = function getTabs() {
115
120
  var testTabPanel = function testTabPanel(expectedTabIndex) {
116
121
  return (0, _forEach["default"])(defaultTabs).call(defaultTabs, function (_ref4, index) {
117
122
  var children = _ref4.children;
118
- return index === expectedTabIndex ? expect(_testWrapper.screen.queryByText(children)).toBeInTheDocument() : expect(_testWrapper.screen.queryByText(children)).not.toBeInTheDocument();
123
+ if (typeof children === 'string') {
124
+ return index === expectedTabIndex ? expect(_testWrapper.screen.queryByText(children)).toBeInTheDocument() : expect(_testWrapper.screen.queryByText(children)).not.toBeInTheDocument();
125
+ }
126
+ return null;
119
127
  });
120
128
  };
121
129
  var testSingleTab = function testSingleTab(tabs, tab, thisTest) {
@@ -265,9 +273,11 @@ test('disabled all tabs', function () {
265
273
 
266
274
  // Tabs cannot be DOM disabled so must check visuals
267
275
  (0, _forEach["default"])(defaultTabs).call(defaultTabs, function (tab) {
268
- var tabText = _testWrapper.screen.getByText(tab.name);
269
- var parentElement = tabText.parentElement;
270
- expect(parentElement).toHaveClass('is-disabled');
276
+ if (tab.name) {
277
+ var tabText = _testWrapper.screen.getByText(tab.name);
278
+ var parentElement = tabText.parentElement;
279
+ expect(parentElement).toHaveClass('is-disabled');
280
+ }
271
281
  });
272
282
  expect(tabLine).not.toBeInTheDocument();
273
283
 
@@ -414,7 +424,7 @@ test('tabs without selected keys show null tab panel content', function () {
414
424
  getComponent({
415
425
  defaultSelectedKey: undefined
416
426
  });
417
- expect(_testWrapper.screen.queryByRole('tabpanel')).not.toHaveTextContent();
427
+ expect(_testWrapper.screen.queryByRole('tabpanel')).not.toHaveTextContent('');
418
428
  });
419
429
  test('hover tab style', function () {
420
430
  getComponent();
@@ -469,17 +479,21 @@ test('will render tab with list if provided', /*#__PURE__*/(0, _asyncToGenerator
469
479
  });
470
480
  testTabPanel(0);
471
481
  _getTabs12 = getTabs(), menuBtn = _getTabs12.tab1.parentElement;
472
- _userEvent["default"].click(menuBtn);
482
+ if (menuBtn) _userEvent["default"].click(menuBtn);
473
483
  expect(_testWrapper.screen.queryByRole('menu')).toBeInTheDocument();
474
484
  testTabPanel(0);
475
485
  menuItems = _testWrapper.screen.queryAllByRole('menuitemradio');
476
- expect(menuItems).toHaveLength(tabsWithList[1].list.length);
486
+ if (tabsWithList[1].list) {
487
+ expect(menuItems).toHaveLength(tabsWithList[1].list.length);
488
+ }
477
489
  expect(menuItems[0]).not.toHaveFocus();
478
490
  _userEvent["default"].click(menuItems[0]);
479
- firstListItemContent = tabsWithList[1].list[0].children;
480
- expect(_testWrapper.screen.queryByRole('tabpanel')).toHaveTextContent(firstListItemContent);
491
+ if (tabsWithList[1].list) {
492
+ firstListItemContent = tabsWithList[1].list[0].children;
493
+ expect(_testWrapper.screen.queryByRole('tabpanel')).toHaveTextContent(firstListItemContent);
494
+ }
481
495
  expect(_testWrapper.screen.queryByRole('menu')).not.toBeInTheDocument();
482
- case 13:
496
+ case 12:
483
497
  case "end":
484
498
  return _context2.stop();
485
499
  }
@@ -511,13 +525,17 @@ test('tab list is accessible via keyboard', function () {
511
525
  expect(_testWrapper.screen.queryByRole('menu')).toBeInTheDocument();
512
526
  testTabPanel(0);
513
527
  var menuItems = _testWrapper.screen.queryAllByRole('menuitemradio');
514
- expect(menuItems).toHaveLength(tabsWithList[1].list.length);
528
+ if (tabsWithList[1].list) {
529
+ expect(menuItems).toHaveLength(tabsWithList[1].list.length);
530
+ }
515
531
  expect(menuItems[0]).toHaveFocus();
516
532
  _testWrapper.fireEvent.keyDown(menuItems[0], {
517
533
  key: 'Enter',
518
534
  code: 'Enter'
519
535
  });
520
- var firstListItemContent = tabsWithList[1].list[0].children;
521
- expect(_testWrapper.screen.queryByRole('tabpanel')).toHaveTextContent(firstListItemContent);
536
+ if (tabsWithList[1].list) {
537
+ var firstListItemContent = tabsWithList[1].list[0].children;
538
+ expect(_testWrapper.screen.queryByRole('tabpanel')).toHaveTextContent(firstListItemContent);
539
+ }
522
540
  expect(_testWrapper.screen.queryByRole('menu')).not.toBeInTheDocument();
523
541
  });
@@ -0,0 +1,2 @@
1
+ export { default } from './Tabs';
2
+ export * from './Tabs';
@@ -34,6 +34,8 @@ export * from './rockerButtonGroup';
34
34
  export * from './scrollBox';
35
35
  export * from './separator';
36
36
  export * from './shared';
37
+ export * from './tab';
37
38
  export * from './table';
39
+ export * from './tabs';
38
40
  export * from './text';
39
41
  export * from './tooltipTrigger';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39;
3
+ var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41;
4
4
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
5
  var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
6
6
  var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
@@ -403,8 +403,19 @@ _forEachInstanceProperty(_context36 = _Object$keys(_shared)).call(_context36, fu
403
403
  }
404
404
  });
405
405
  });
406
+ var _tab = require("./tab");
407
+ _forEachInstanceProperty(_context37 = _Object$keys(_tab)).call(_context37, function (key) {
408
+ if (key === "default" || key === "__esModule") return;
409
+ if (key in exports && exports[key] === _tab[key]) return;
410
+ _Object$defineProperty(exports, key, {
411
+ enumerable: true,
412
+ get: function get() {
413
+ return _tab[key];
414
+ }
415
+ });
416
+ });
406
417
  var _table = require("./table");
407
- _forEachInstanceProperty(_context37 = _Object$keys(_table)).call(_context37, function (key) {
418
+ _forEachInstanceProperty(_context38 = _Object$keys(_table)).call(_context38, function (key) {
408
419
  if (key === "default" || key === "__esModule") return;
409
420
  if (key in exports && exports[key] === _table[key]) return;
410
421
  _Object$defineProperty(exports, key, {
@@ -414,8 +425,19 @@ _forEachInstanceProperty(_context37 = _Object$keys(_table)).call(_context37, fun
414
425
  }
415
426
  });
416
427
  });
428
+ var _tabs = require("./tabs");
429
+ _forEachInstanceProperty(_context39 = _Object$keys(_tabs)).call(_context39, function (key) {
430
+ if (key === "default" || key === "__esModule") return;
431
+ if (key in exports && exports[key] === _tabs[key]) return;
432
+ _Object$defineProperty(exports, key, {
433
+ enumerable: true,
434
+ get: function get() {
435
+ return _tabs[key];
436
+ }
437
+ });
438
+ });
417
439
  var _text = require("./text");
418
- _forEachInstanceProperty(_context38 = _Object$keys(_text)).call(_context38, function (key) {
440
+ _forEachInstanceProperty(_context40 = _Object$keys(_text)).call(_context40, function (key) {
419
441
  if (key === "default" || key === "__esModule") return;
420
442
  if (key in exports && exports[key] === _text[key]) return;
421
443
  _Object$defineProperty(exports, key, {
@@ -426,7 +448,7 @@ _forEachInstanceProperty(_context38 = _Object$keys(_text)).call(_context38, func
426
448
  });
427
449
  });
428
450
  var _tooltipTrigger = require("./tooltipTrigger");
429
- _forEachInstanceProperty(_context39 = _Object$keys(_tooltipTrigger)).call(_context39, function (key) {
451
+ _forEachInstanceProperty(_context41 = _Object$keys(_tooltipTrigger)).call(_context41, function (key) {
430
452
  if (key === "default" || key === "__esModule") return;
431
453
  if (key in exports && exports[key] === _tooltipTrigger[key]) return;
432
454
  _Object$defineProperty(exports, key, {
@@ -1,4 +1,4 @@
1
- import { ElementType, Key } from 'react';
1
+ import { ElementType, Key, ReactNode } from 'react';
2
2
  import type { ItemProps } from '@react-types/shared';
3
3
  import { IconTypeExtended } from './icon';
4
4
  import { DOMAttributes, StyleProps } from './shared';
@@ -8,13 +8,15 @@ export interface Status {
8
8
  declare module '@react-types/shared' {
9
9
  interface ItemProps<T> extends StyleProps, DOMAttributes {
10
10
  /** The rendered label for the item. */
11
- label?: string | React.ReactNode;
11
+ label?: string | ReactNode;
12
12
  /** Props for the accordion item content element. */
13
13
  regionProps?: StyleProps;
14
14
  /** Props for the accordion item content element. */
15
15
  containerProps?: StyleProps;
16
16
  /** Props for the accordion item button element. */
17
17
  buttonProps?: StyleProps;
18
+ /** Props for the tab line element. */
19
+ tabLineProps?: StyleProps;
18
20
  /** Whether the item has a separator */
19
21
  isSeparator?: boolean;
20
22
  /** Whether the item is pressed */
@@ -30,7 +32,9 @@ declare module '@react-types/shared' {
30
32
  /** Key for the item. */
31
33
  key?: Key;
32
34
  slots?: {
33
- postHeading: React.ReactNode;
35
+ postHeading?: ReactNode;
36
+ afterTab?: ReactNode;
37
+ beforeTab?: ReactNode;
34
38
  };
35
39
  icon?: IconTypeExtended;
36
40
  /** isCurrent for the Breadcrumbs item. */
@@ -0,0 +1,32 @@
1
+ import { ElementType, ReactNode } from 'react';
2
+ import { ThemeUICSSProperties } from 'theme-ui';
3
+ import { TestingAttributes } from './shared/test';
4
+ import { DOMAttributes, OrientationProps, StyleProps } from './shared';
5
+ export interface TabProps extends StyleProps, DOMAttributes, OrientationProps, TestingAttributes {
6
+ isDisabled?: boolean;
7
+ item: {
8
+ key: string | number;
9
+ props?: {
10
+ icon: ElementType | ReactNode;
11
+ isDisabled: boolean;
12
+ textValue: string;
13
+ tabLineProps?: ThemeUICSSProperties;
14
+ tabLabelProps: object;
15
+ content: object;
16
+ titleAttr: string;
17
+ title: string;
18
+ separator: Element | boolean;
19
+ list: object[];
20
+ };
21
+ rendered?: string | ReactNode;
22
+ };
23
+ mode?: 'default' | 'tooltip' | 'list';
24
+ tooltipTriggerProps?: object;
25
+ title?: string;
26
+ textValue?: string;
27
+ tabLineProps?: object;
28
+ slots?: {
29
+ beforeTab?: ReactNode;
30
+ afterTab?: ReactNode;
31
+ };
32
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
@@ -0,0 +1,51 @@
1
+ import { Dispatch, ReactNode, SetStateAction } from 'react';
2
+ import { AriaTabListProps } from '@react-aria/tabs';
3
+ import { TabListState } from '@react-stately/tabs';
4
+ import type { CollectionChildren } from '@react-types/shared';
5
+ import { TestingAttributes } from './shared/test';
6
+ import { DOMAttributes, OrientationProps, StyleProps } from './shared';
7
+ export interface TabsProps extends StyleProps, TestingAttributes, OrientationProps {
8
+ /** The default tab key to be selected. (uncontrolled) */
9
+ defaultSelectedKey?: string;
10
+ /** Array of keys to disable within the tab list. */
11
+ disabledKeys?: string[];
12
+ /** The tab key that is currently selected. (controlled) */
13
+ selectedKey?: string;
14
+ /** Determines the behavior model for the tabs. */
15
+ mode?: 'default' | 'tooltip' | 'list';
16
+ /**
17
+ * *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
18
+ * For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
19
+ */
20
+ items?: Array<TabListItemProps>;
21
+ /** Whether the entire tablist is disabled. */
22
+ isDisabled?: boolean;
23
+ /** Handler that is called when the selected tab has changed. */
24
+ onSelectionChange?: Dispatch<SetStateAction<string | undefined>>;
25
+ /** A props object that is subsequently spread into the rendered tablist. */
26
+ tabListProps?: object;
27
+ /** Props object that is spread directly into all of the tab panel wrapper elements. */
28
+ tabPanelProps?: object;
29
+ /** Whether tabs are activated automatically on focus or manually¸ */
30
+ keyboardActivation?: 'automatic' | 'manual';
31
+ children?: CollectionChildren<object>;
32
+ }
33
+ export interface AriaTabListOptions<T> extends Omit<AriaTabListProps<T>, 'children'> {
34
+ children: CollectionChildren<T>;
35
+ }
36
+ export interface TabPanelProps extends StyleProps, DOMAttributes {
37
+ state?: TabListState<object>;
38
+ tabPanelProps?: object;
39
+ children?: ReactNode | string;
40
+ }
41
+ export interface TabListItemProps {
42
+ name?: string;
43
+ children?: ReactNode | string;
44
+ list?: Array<{
45
+ key?: string | number;
46
+ name: string;
47
+ children: string;
48
+ role?: string;
49
+ }>;
50
+ props?: object;
51
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
@@ -17,8 +17,8 @@ import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
17
17
  import { mergeProps } from 'react-aria';
18
18
  import { useCollator } from '@react-aria/i18n';
19
19
  import { useListBox } from '@react-aria/listbox';
20
- import { Virtualizer, VirtualizerItem } from '@react-aria/virtualizer';
21
- import { ListLayout } from '@react-stately/layout';
20
+ import { ListLayout } from 'listbox-layout';
21
+ import { Virtualizer, VirtualizerItem } from 'listbox-virtualizer';
22
22
  import { useLocalOrForwardRef } from '../../hooks';
23
23
  import Loader from '../Loader';
24
24
  import { Option } from './index';
@@ -243,17 +243,17 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
243
243
  selectionManager.toggleSelection(selectionManager.focusedKey);
244
244
  setFilterString('');
245
245
  }
246
- } else if (hasCustomValue && filteredItems.length === 1) {
247
- selectTheOnlyFilteredItem();
248
- } else if (!hasCustomValue) {
249
- setFilterString('');
250
- close();
251
- } else if (hasCustomValue) {
246
+ } else if (hasCustomValue && !selectionManager.focusedKey) {
252
247
  var _key = e.target.value;
253
248
  if (_key === '') {
254
249
  return;
255
250
  }
256
251
  addNewBadgeFromInput(e.target.value);
252
+ } else if (hasCustomValue && filteredItems.length === 1) {
253
+ selectTheOnlyFilteredItem();
254
+ } else if (!hasCustomValue) {
255
+ setFilterString('');
256
+ close();
257
257
  }
258
258
  break;
259
259
  }
@@ -700,6 +700,36 @@ test('should clear the input text onBlur and enter when a single filter result i
700
700
  });
701
701
  expect(input).toHaveValue('');
702
702
  });
703
+ test('in non-restrictive mode the partial string values should be accepted', function () {
704
+ var itemsWithDuplicatePartialString = [{
705
+ id: 1,
706
+ name: 'echo:read',
707
+ key: 'echo:read'
708
+ }, {
709
+ id: 2,
710
+ name: 'echo:write',
711
+ key: 'echo:write'
712
+ }, {
713
+ id: 3,
714
+ name: 'echo:delete',
715
+ key: 'echo:delete'
716
+ }];
717
+ getComponent({
718
+ mode: 'non-restrictive',
719
+ items: itemsWithDuplicatePartialString
720
+ });
721
+ var input = screen.getByRole('combobox');
722
+ expect(input).toHaveValue('');
723
+ var value = 'echo:r';
724
+ userEvent.type(input, value);
725
+ userEvent.type(input, '{enter}');
726
+ expect(input).toHaveValue('');
727
+ expect(screen.queryByText(value)).toBeInTheDocument();
728
+ userEvent.type(input, value);
729
+ userEvent.type(input, '{enter}');
730
+ expect(input).not.toHaveValue('');
731
+ expect(input).toHaveValue(value);
732
+ });
703
733
 
704
734
  // Needs to be added to each components test file
705
735
  universalComponentTests({