@pingux/astro 2.234.1 → 2.236.0-alpha.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 (106) hide show
  1. package/lib/cjs/components/ComboBox/ComboBox.styles.d.ts +897 -0
  2. package/lib/cjs/components/ComboBox/ComboBoxInput.d.ts +4 -0
  3. package/lib/cjs/components/ComboBox/ComboBoxInput.js +8 -37
  4. package/lib/cjs/components/ComboBox/index.d.ts +1 -0
  5. package/lib/cjs/components/ComboBoxField/ComboBoxField.d.ts +9 -0
  6. package/lib/cjs/components/ComboBoxField/ComboBoxField.js +11 -133
  7. package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +5 -4
  8. package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +2 -3
  9. package/lib/cjs/components/ComboBoxField/index.d.ts +1 -0
  10. package/lib/cjs/components/Tree/Tree.d.ts +9 -0
  11. package/lib/cjs/components/Tree/Tree.js +48 -0
  12. package/lib/cjs/components/Tree/Tree.mdx +58 -0
  13. package/lib/cjs/components/Tree/Tree.stories.js +786 -0
  14. package/lib/cjs/components/Tree/Tree.styles.d.ts +4 -0
  15. package/lib/cjs/components/Tree/Tree.styles.js +332 -0
  16. package/lib/cjs/components/Tree/Tree.test.js +300 -0
  17. package/lib/cjs/components/Tree/TreeItem.d.ts +22 -0
  18. package/lib/cjs/components/Tree/TreeItem.js +82 -0
  19. package/lib/cjs/components/Tree/TreeItemContent.d.ts +11 -0
  20. package/lib/cjs/components/Tree/TreeItemContent.js +102 -0
  21. package/lib/cjs/components/Tree/index.d.ts +5 -0
  22. package/lib/cjs/components/Tree/index.js +52 -0
  23. package/lib/cjs/components/Tree/useTreeDragAndDrop.d.ts +46 -0
  24. package/lib/cjs/components/Tree/useTreeDragAndDrop.js +76 -0
  25. package/lib/cjs/context/TooltipContext/index.js +2 -1
  26. package/lib/cjs/hooks/useCircularLoader/useCircularLoader.d.ts +1 -0
  27. package/lib/cjs/hooks/useCircularLoader/useCircularLoader.js +3 -2
  28. package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +4 -0
  29. package/lib/cjs/hooks/useGridListItem/useGridListItem.d.ts +4 -4
  30. package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.js +3 -1
  31. package/lib/cjs/hooks/usePagination/usePagination.d.ts +8 -8
  32. package/lib/cjs/hooks/useStatusClasses/useStatusClasses.js +2 -8
  33. package/lib/cjs/index.d.ts +1 -0
  34. package/lib/cjs/index.js +43 -0
  35. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.d.ts +1 -0
  36. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.js +7 -1
  37. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/icons.d.ts +2 -0
  38. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/index.d.ts +2 -0
  39. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.d.ts +15 -0
  40. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +15 -0
  41. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/tree.d.ts +15 -0
  42. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/tree.js +160 -0
  43. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +9 -0
  44. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +3 -1
  45. package/lib/cjs/styles/themeOverrides/onyxSideNav.d.ts +2 -0
  46. package/lib/cjs/styles/themes/astro/customProperties/icons.d.ts +2 -0
  47. package/lib/cjs/styles/themes/astro/customProperties/icons.js +3 -1
  48. package/lib/cjs/styles/themes/astro/customProperties/index.d.ts +2 -0
  49. package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
  50. package/lib/cjs/styles/themes/next-gen/customProperties/icons.d.ts +2 -0
  51. package/lib/cjs/styles/themes/next-gen/customProperties/icons.js +1 -1
  52. package/lib/cjs/styles/themes/next-gen/customProperties/index.d.ts +2 -0
  53. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +27 -0
  54. package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +15 -0
  55. package/lib/cjs/styles/themes/next-gen/variants/button.js +11 -0
  56. package/lib/cjs/styles/themes/next-gen/variants/tree.d.ts +16 -0
  57. package/lib/cjs/styles/themes/next-gen/variants/tree.js +153 -0
  58. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +10 -0
  59. package/lib/cjs/styles/themes/next-gen/variants/variants.js +2 -0
  60. package/lib/cjs/styles/variants/index.js +3 -1
  61. package/lib/cjs/styles/variants/variants.js +2 -0
  62. package/lib/cjs/types/ComboBox.d.ts +36 -0
  63. package/lib/cjs/types/ComboBox.js +6 -0
  64. package/lib/cjs/types/ComboBoxField.d.ts +110 -0
  65. package/lib/cjs/types/ComboBoxField.js +6 -0
  66. package/lib/cjs/types/index.d.ts +2 -0
  67. package/lib/cjs/types/index.js +79 -57
  68. package/lib/cjs/types/popoverContainer.d.ts +1 -0
  69. package/lib/cjs/types/textField.d.ts +6 -0
  70. package/lib/cjs/utils/getStatusClasses.d.ts +13 -0
  71. package/lib/cjs/utils/getStatusClasses.js +29 -0
  72. package/lib/components/ComboBox/ComboBoxInput.js +8 -37
  73. package/lib/components/ComboBoxField/ComboBoxField.js +12 -134
  74. package/lib/components/ComboBoxField/ComboBoxField.stories.js +5 -4
  75. package/lib/components/ComboBoxField/ComboBoxField.test.js +2 -3
  76. package/lib/components/Tree/Tree.js +33 -0
  77. package/lib/components/Tree/Tree.mdx +58 -0
  78. package/lib/components/Tree/Tree.stories.js +775 -0
  79. package/lib/components/Tree/Tree.styles.js +325 -0
  80. package/lib/components/Tree/Tree.test.js +297 -0
  81. package/lib/components/Tree/TreeItem.js +70 -0
  82. package/lib/components/Tree/TreeItemContent.js +94 -0
  83. package/lib/components/Tree/index.js +5 -0
  84. package/lib/components/Tree/useTreeDragAndDrop.js +69 -0
  85. package/lib/context/TooltipContext/index.js +2 -1
  86. package/lib/hooks/useCircularLoader/useCircularLoader.js +3 -2
  87. package/lib/hooks/useOverlayPanelState/useOverlayPanelState.test.js +3 -1
  88. package/lib/hooks/useStatusClasses/useStatusClasses.js +2 -8
  89. package/lib/index.js +1 -0
  90. package/lib/styles/themeOverrides/nextGenDarkMode/colors.js +7 -1
  91. package/lib/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +15 -0
  92. package/lib/styles/themeOverrides/nextGenDarkMode/variants/tree.js +154 -0
  93. package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +3 -1
  94. package/lib/styles/themes/astro/customProperties/icons.js +3 -1
  95. package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
  96. package/lib/styles/themes/next-gen/customProperties/icons.js +1 -1
  97. package/lib/styles/themes/next-gen/variants/button.js +11 -0
  98. package/lib/styles/themes/next-gen/variants/tree.js +147 -0
  99. package/lib/styles/themes/next-gen/variants/variants.js +2 -0
  100. package/lib/styles/variants/index.js +3 -1
  101. package/lib/styles/variants/variants.js +2 -0
  102. package/lib/types/ComboBox.js +1 -0
  103. package/lib/types/ComboBoxField.js +1 -0
  104. package/lib/types/index.js +2 -0
  105. package/lib/utils/getStatusClasses.js +22 -0
  106. package/package.json +9 -6
@@ -10,19 +10,15 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
10
10
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
11
11
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
12
12
  var _excluded = ["controlProps", "containerProps", "hasAutoFocus", "isDisabled", "isReadOnly", "isOpen", "loadingState", "style", "inputWrapperRef", "inputRef", "inputProps", "triggerRef", "triggerProps", "menuTrigger", "onInputChange", "onLoadMore", "onOpenChange", "onSelectionChange", "wrapperProps"];
13
- import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
14
13
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
14
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
16
15
  import React, { forwardRef, useImperativeHandle } from 'react';
17
16
  import { FocusRing, mergeProps } from 'react-aria';
18
17
  import { PressResponder, useHover } from '@react-aria/interactions';
19
- import PropTypes from 'prop-types';
20
18
  import { Box, Button, Icon, Loader, TextField } from '../..';
21
19
  import { useInputLoader, usePropWarning } from '../../hooks';
22
20
  import useGetTheme from '../../hooks/useGetTheme';
23
21
  import loadingStates from '../../utils/devUtils/constants/loadingStates';
24
- import { ariaAttributesBasePropTypes } from '../../utils/docUtils/ariaAttributes';
25
- import { statusPropTypes } from '../../utils/docUtils/statusProp';
26
22
  import { jsx as ___EmotionJSX } from "@emotion/react";
27
23
  var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
28
24
  var controlProps = props.controlProps,
@@ -45,6 +41,9 @@ var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
45
41
  onSelectionChange = props.onSelectionChange,
46
42
  wrapperProps = props.wrapperProps,
47
43
  others = _objectWithoutProperties(props, _excluded);
44
+ var _useHover = useHover({}),
45
+ hoverProps = _useHover.hoverProps,
46
+ isHovered = _useHover.isHovered;
48
47
  var textFieldProps = _objectSpread({
49
48
  isDisabled: isDisabled,
50
49
  isReadOnly: isReadOnly,
@@ -59,12 +58,10 @@ var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
59
58
  useImperativeHandle(ref, function () {
60
59
  return inputRef.current;
61
60
  });
62
- var _useHover = useHover({}),
63
- hoverProps = _useHover.hoverProps,
64
- isHovered = _useHover.isHovered;
65
61
  var _useInputLoader = useInputLoader({
66
62
  loadingState: loadingState,
67
- inputValue: inputProps.value
63
+ // eslint-disable-next-line max-len
64
+ inputValue: inputProps === null || inputProps === void 0 ? void 0 : inputProps.value
68
65
  }),
69
66
  isLoading = _useInputLoader.isLoading;
70
67
  usePropWarning(props, 'disabled', 'isDisabled');
@@ -91,7 +88,7 @@ var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
91
88
  size: isOnyx ? 'sm' : 'md',
92
89
  sx: isOpen ? {
93
90
  transform: 'rotate(180deg)'
94
- } : null,
91
+ } : undefined,
95
92
  title: {
96
93
  name: ''
97
94
  },
@@ -114,40 +111,14 @@ var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
114
111
  controlProps: _objectSpread({
115
112
  variant: 'forms.comboBox.input'
116
113
  }, controlProps),
114
+ tabIndex: -1,
117
115
  statusClasses: {
118
116
  isHovered: isHovered
119
117
  },
120
118
  ref: inputRef,
121
119
  slots: {
122
120
  inContainer: button
123
- },
124
- tabIndex: -1
121
+ }
125
122
  }))));
126
123
  });
127
- ComboBoxInput.propTypes = _objectSpread(_objectSpread({
128
- containerProps: PropTypes.shape({}),
129
- controlProps: PropTypes.shape({}),
130
- hasAutoFocus: PropTypes.bool,
131
- helperText: PropTypes.node,
132
- inputProps: PropTypes.shape({
133
- value: PropTypes.string
134
- }),
135
- inputRef: PropTypes.shape({}),
136
- inputWrapperRef: PropTypes.shape({}),
137
- isDisabled: PropTypes.bool,
138
- isOpen: PropTypes.bool,
139
- isReadOnly: PropTypes.bool,
140
- label: PropTypes.node,
141
- labelProps: PropTypes.shape({}),
142
- loadingState: PropTypes.oneOf(_Object$values(loadingStates)),
143
- menuTrigger: PropTypes.oneOf(['focus', 'input', 'manual']),
144
- onInputChange: PropTypes.func,
145
- onLoadMore: PropTypes.func,
146
- onOpenChange: PropTypes.func,
147
- onSelectionChange: PropTypes.func,
148
- style: PropTypes.shape({}),
149
- triggerProps: PropTypes.shape({}),
150
- triggerRef: PropTypes.shape({}),
151
- wrapperProps: PropTypes.shape({})
152
- }, statusPropTypes), ariaAttributesBasePropTypes);
153
124
  export default ComboBoxInput;
@@ -14,7 +14,6 @@ var _excluded = ["hasAutoFocus", "hasAddOption", "hasCustomValue", "hasNoEmptySe
14
14
  _excluded2 = ["shouldFocusOnHover", "shouldSelectOnPressUp", "UNSTABLE_itemBehavior"];
15
15
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
16
16
  import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
17
- import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
18
17
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
18
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
20
19
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
@@ -22,13 +21,10 @@ import { DismissButton, FocusScope, useComboBox, useOverlayPosition } from 'reac
22
21
  import { useComboBoxState } from 'react-stately';
23
22
  import { useFilter } from '@react-aria/i18n';
24
23
  import { useLayoutEffect, useResizeObserver } from '@react-aria/utils';
25
- import PropTypes from 'prop-types';
26
24
  import { usePropWarning } from '../../hooks';
27
25
  import loadingStates from '../../utils/devUtils/constants/loadingStates';
28
26
  import { getPendoID } from '../../utils/devUtils/constants/pendoID';
29
- import { isIterableProp } from '../../utils/devUtils/props/isIterable';
30
- import { ariaAttributesBasePropTypes, getAriaAttributeProps } from '../../utils/docUtils/ariaAttributes';
31
- import { statusPropTypes } from '../../utils/docUtils/statusProp';
27
+ import { getAriaAttributeProps } from '../../utils/docUtils/ariaAttributes';
32
28
  import ComboBoxInput from '../ComboBox';
33
29
  import ListBox from '../ListBox';
34
30
  import Popover from '../Popover';
@@ -76,11 +72,11 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
76
72
  label: 'default',
77
73
  allowsEmptyCollection: allowsEmptyCollection
78
74
  }, nonAriaProps);
79
- var popoverRef = useRef();
80
- var buttonRef = useRef();
81
- var listBoxRef = useRef();
82
- var inputRef = useRef();
83
- var inputWrapperRef = useRef();
75
+ var popoverRef = useRef(null);
76
+ var buttonRef = useRef(null);
77
+ var listBoxRef = useRef(null);
78
+ var inputRef = useRef(null);
79
+ var inputWrapperRef = useRef(null);
84
80
  usePropWarning(props, 'disabled', 'isDisabled');
85
81
  /* istanbul ignore next */
86
82
  useImperativeHandle(ref, function () {
@@ -91,7 +87,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
91
87
  var getItemsArr = function getItemsArr(initialArr) {
92
88
  if (initialArr && shouldShowAddOption) {
93
89
  var _context;
94
- return _concatInstanceProperty(_context = []).call(_context, initialArr, [{
90
+ return _concatInstanceProperty(_context = []).call(_context, _Array$from(initialArr), [{
95
91
  name: addOption,
96
92
  key: addOption
97
93
  }]);
@@ -133,10 +129,11 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
133
129
  inputProps = _useComboBox.inputProps,
134
130
  listBoxProps = _useComboBox.listBoxProps,
135
131
  labelProps = _useComboBox.labelProps;
136
- var shouldFocusOnHover = listBoxProps.shouldFocusOnHover,
137
- shouldSelectOnPressUp = listBoxProps.shouldSelectOnPressUp,
138
- action = listBoxProps['UNSTABLE_itemBehavior'],
139
- otherListBoxProps = _objectWithoutProperties(listBoxProps, _excluded2);
132
+ var _ref = listBoxProps,
133
+ shouldFocusOnHover = _ref.shouldFocusOnHover,
134
+ shouldSelectOnPressUp = _ref.shouldSelectOnPressUp,
135
+ action = _ref['UNSTABLE_itemBehavior'],
136
+ otherListBoxProps = _objectWithoutProperties(_ref, _excluded2);
140
137
  var _useOverlayPosition = useOverlayPosition({
141
138
  offset: 1,
142
139
  targetRef: inputWrapperRef,
@@ -224,125 +221,6 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
224
221
  "aria-invalid": status === 'error' && true
225
222
  })), listBox);
226
223
  });
227
- ComboBoxField.propTypes = _objectSpread(_objectSpread({
228
- /* Whether or not adding new options to the list is enabled. */
229
- hasAddOption: PropTypes.bool,
230
- /** Whether the ComboBox allows a non-item matching input value to be set. */
231
- hasCustomValue: PropTypes.bool,
232
- /** Whether the collection allows empty selection. */
233
- hasNoEmptySelection: PropTypes.bool,
234
- /**
235
- * The item keys that are disabled. These items cannot be selected, focused, or otherwise
236
- * interacted with.
237
- */
238
- disabledKeys: isIterableProp,
239
- /** The interaction required to display the ComboBox menu. */
240
- menuTrigger: PropTypes.oneOf(['focus', 'input', 'manual']),
241
- /**
242
- * Whether the ComboBox menu is prevented from flipping directions when insufficient space is
243
- * available for the given `direction` placement.
244
- */
245
- isNotFlippable: PropTypes.bool,
246
- /** Where the ComboBox menu opens relative to its trigger. */
247
- direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
248
- /** Text rendered below the input. */
249
- helperText: PropTypes.node,
250
- /** The initial selected key in the collection (uncontrolled). */
251
- defaultSelectedKey: PropTypes.string,
252
- /** The currently selected key in the collection (controlled). */
253
- selectedKey: PropTypes.string,
254
- /**
255
- * Handler that is called when the selection changes.
256
- *
257
- * `(key: Key) => any`
258
- */
259
- onSelectionChange: PropTypes.func,
260
- /** The list of ComboBox items (uncontrolled). */
261
- defaultItems: isIterableProp,
262
- /** The list of ComboBox items (controlled). */
263
- items: isIterableProp,
264
- /**
265
- * Method that is called when the open state of the menu changes.
266
- * Returns the new open state and the action that caused the opening of the menu.
267
- *
268
- * `(isOpen: boolean, menuTrigger: MenuTriggerAction) => void`
269
- */
270
- onOpenChange: PropTypes.func,
271
- loadingState: PropTypes.oneOf(_Object$values(loadingStates)),
272
- onLoadMore: PropTypes.func,
273
- /** The default value of the ComboBox input (uncontrolled). */
274
- defaultInputValue: PropTypes.string,
275
- /** The value of the ComboBox input (controlled). */
276
- inputValue: PropTypes.string,
277
- /**
278
- * Handler that is called when the ComboBox input value changes.
279
- *
280
- * `(value: string) => void`
281
- */
282
- onInputChange: PropTypes.func,
283
- /** Whether user input is required on the input before form submission. */
284
- isRequired: PropTypes.bool,
285
- /** Whether the input is disabled. */
286
- isDisabled: PropTypes.bool,
287
- /** Whether the input can be selected but not changed by the user. */
288
- isReadOnly: PropTypes.bool,
289
- /** The rendered label for the field. */
290
- label: PropTypes.node,
291
- /** Temporary text that occupies the text input when it is empty. */
292
- placeholder: PropTypes.string,
293
- /** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
294
- id: PropTypes.string,
295
- /** Whether the element should receive focus on render. */
296
- hasAutoFocus: PropTypes.bool,
297
- /** Whether the field has a status indicator. */
298
- hasNoStatusIndicator: PropTypes.bool,
299
- /**
300
- * Handler that is called when the element receives focus.
301
- *
302
- * `(e: FocusEvent) => void`
303
- */
304
- onFocus: PropTypes.func,
305
- /**
306
- * Handler that is called when the element loses focus.
307
- *
308
- * `(e: FocusEvent) => void`
309
- */
310
- onBlur: PropTypes.func,
311
- /**
312
- * Handler that is called when the element's focus status changes.
313
- *
314
- * `(isFocused: boolean) => void`
315
- */
316
- onFocusChange: PropTypes.func,
317
- /**
318
- * Handler that is called when a key is pressed.
319
- *
320
- * `(e: KeyboardEvent) => void`
321
- */
322
- onKeyDown: PropTypes.func,
323
- /**
324
- * Handler that is called when a key is released.
325
- *
326
- * `(e: KeyboardEvent) => void`
327
- */
328
- onKeyUp: PropTypes.func,
329
- /**
330
- * Handler that determines the default filtering for items. If undefined, `contains` from
331
- * [useFilter](https://react-spectrum.adobe.com/react-aria/useFilter.html) is used.
332
- *
333
- * `(option: string, inputValue: string) => boolean`
334
- */
335
- defaultFilter: PropTypes.func,
336
- // /** Props object that is spread directly into the ScrollBox element. */
337
- /** @ignore */
338
- scrollBoxProps: PropTypes.shape({
339
- maxHeight: PropTypes.string
340
- }),
341
- /** Props object that is spread directly into the ComboBoxInput element. */
342
- controlProps: PropTypes.shape({
343
- onClick: PropTypes.func
344
- })
345
- }, statusPropTypes), ariaAttributesBasePropTypes);
346
224
  ComboBoxField.defaultProps = {
347
225
  menuTrigger: 'focus',
348
226
  direction: 'bottom',
@@ -330,9 +330,10 @@ export var AsyncLoading = function AsyncLoading() {
330
330
  loadingState: loading,
331
331
  onLoadMore: handleLoadMore
332
332
  }), function (item) {
333
+ var _item$name, _item$name2;
333
334
  return ___EmotionJSX(Item, {
334
- key: item.name.given
335
- }, item.name.given);
335
+ key: (_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.given
336
+ }, (_item$name2 = item.name) === null || _item$name2 === void 0 ? void 0 : _item$name2.given);
336
337
  }));
337
338
  };
338
339
  export var ControlledInput = function ControlledInput() {
@@ -411,8 +412,8 @@ export var ControlledFiltering = function ControlledFiltering() {
411
412
  inputValue: selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name,
412
413
  selectedKey: key,
413
414
  itemsList: _filterInstanceProperty(items).call(items, function (item) {
414
- var _selectedItem$name;
415
- return startsWith(item.name, (_selectedItem$name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _selectedItem$name !== void 0 ? _selectedItem$name : '');
415
+ var _name;
416
+ return startsWith(item.name, (_name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _name !== void 0 ? _name : '');
416
417
  })
417
418
  });
418
419
  };
@@ -145,8 +145,8 @@ var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
145
145
  inputValue: selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name,
146
146
  selectedKey: key,
147
147
  itemsList: _filterInstanceProperty(items).call(items, function (item) {
148
- var _selectedItem$name;
149
- return startsWith(item.name, (_selectedItem$name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _selectedItem$name !== void 0 ? _selectedItem$name : '');
148
+ var _name;
149
+ return startsWith(item.name, (_name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _name !== void 0 ? _name : '');
150
150
  })
151
151
  });
152
152
  };
@@ -173,7 +173,6 @@ var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
173
173
  }
174
174
  };
175
175
  return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
176
- label: "Example label",
177
176
  items: fieldState.itemsList,
178
177
  inputValue: fieldState.inputValue,
179
178
  selectedKey: fieldState.selectedKey,
@@ -0,0 +1,33 @@
1
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
2
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
3
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
4
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
5
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
6
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
10
+ import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
11
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
12
+ function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ import React, { forwardRef } from 'react';
15
+ import { Tree as AriaTree, useDragAndDrop } from 'react-aria-components';
16
+ import Box from '../Box';
17
+ import { jsx as ___EmotionJSX } from "@emotion/react";
18
+ var Tree = /*#__PURE__*/forwardRef(function (props, ref) {
19
+ return ___EmotionJSX(AriaTree, _extends({}, props, {
20
+ ref: ref,
21
+ render: function render(domProps) {
22
+ return ___EmotionJSX(Box, _extends({}, domProps, {
23
+ ref: domProps.ref,
24
+ isRow: false,
25
+ variant: "tree.container",
26
+ sx: _objectSpread({}, _typeof(props.style) === 'object' ? props.style : {})
27
+ }));
28
+ }
29
+ }));
30
+ });
31
+ Tree.displayName = 'Tree';
32
+ export { useDragAndDrop };
33
+ export default Tree;
@@ -0,0 +1,58 @@
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
+ import * as TreeStories from './Tree.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
4
+ import { KeyboardRows } from '../../utils/docUtils/accessibilityTableConstants';
5
+
6
+ <Meta of={TreeStories} isTemplate />
7
+
8
+ # Tree
9
+
10
+ The Tree component displays hierarchical data in an expandable, collapsible tree structure. Users can expand and collapse levels, select one or many items, and — optionally — reorder and re-parent items with drag and drop.
11
+
12
+ A Tree should:
13
+ - Be used for data with a clear parent/child relationship, such as environments, regions, folders, or organization structures.
14
+ - Be used when users need to navigate a nested structure that is deeper than a flat list.
15
+
16
+ A Tree shouldn't:
17
+ - Be used for flat data — use a [ListView](./?path=/docs/components-listview--docs) instead.
18
+ - Be used for navigation that fits a menu or breadcrumbs.
19
+ - Expose too many levels of depth; keep nesting shallow enough to stay scannable.
20
+
21
+ ### Required Components
22
+
23
+ This component can be used with `TreeItem`, `TreeItemContent`, and `TreeLoadMoreItem` from this package. A chevron and expand/collapse behavior are provided by default. `TreeItem` children render as row content directly; place them inside `TreeItemContent` only when you need its render props or its built-in folder/file and lock icons.
24
+
25
+ ### Authoring Modes
26
+
27
+ - **Static**: declare `TreeItem` children directly in JSX (see the *Static Nested Tree* story). Best for small, fixed trees.
28
+ - **Dynamic**: pass a nested array via the `items` prop and render nodes with a recursive render function (see the *Dynamic Recursive Tree* story). Best for trees backed by data.
29
+
30
+ ### Accessibility
31
+
32
+ This component should adhere to the [WAI-ARIA Tree View](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/) accessibility guidelines.
33
+
34
+ <AccessibilityTable keyboardRows={[
35
+ { key: 'Space or Enter', description: 'When focused, selects the item (with selectionMode enabled) or toggles expand/collapse.' },
36
+ KeyboardRows.tabFocusesItem,
37
+ KeyboardRows.shiftTabFocusPrevious,
38
+ { key: 'Right Arrow', description: 'Expands a collapsed parent item, or moves focus to its first child when expanded.' },
39
+ { key: 'Left Arrow', description: 'Collapses an expanded parent item, or moves focus to its parent when collapsed.' },
40
+ { key: 'Down / Up Arrow', description: 'Moves focus to the next or previous visible item.' },
41
+ {
42
+ key: 'Home (Fn + Right Arrow Key) Or Control/Command + Home',
43
+ description: 'Shifts the focus to the first item in the tree.',
44
+ },
45
+ {
46
+ key: 'End (Fn + Left Arrow Key) Or Control/Command + End',
47
+ description: 'Shifts the focus to the last item in the tree.',
48
+ },
49
+ ]} screenReaderRows={[
50
+ 'The Tree uses the **`role="tree"`** attribute with each TreeItem using **`role="treeitem"`**.',
51
+ 'Parent items use the **`aria-expanded`** attribute to indicate whether they are expanded or collapsed.',
52
+ 'Selected items use the **`aria-selected`** attribute; disabled items use **`aria-disabled`**.',
53
+ 'The Tree requires an **`aria-label`** to provide an accessible name.',
54
+ ]} />
55
+
56
+ ### Keyboard Drag and Drop
57
+
58
+ When drag and drop is enabled, the drag handle is focusable. Press **Enter** to start a drag session, use the arrow keys to move the drop target, then press **Enter** to drop or **Escape** to cancel.