@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.
- package/lib/cjs/components/ComboBox/ComboBox.styles.d.ts +897 -0
- package/lib/cjs/components/ComboBox/ComboBoxInput.d.ts +4 -0
- package/lib/cjs/components/ComboBox/ComboBoxInput.js +8 -37
- package/lib/cjs/components/ComboBox/index.d.ts +1 -0
- package/lib/cjs/components/ComboBoxField/ComboBoxField.d.ts +9 -0
- package/lib/cjs/components/ComboBoxField/ComboBoxField.js +11 -133
- package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +5 -4
- package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +2 -3
- package/lib/cjs/components/ComboBoxField/index.d.ts +1 -0
- package/lib/cjs/components/Tree/Tree.d.ts +9 -0
- package/lib/cjs/components/Tree/Tree.js +48 -0
- package/lib/cjs/components/Tree/Tree.mdx +58 -0
- package/lib/cjs/components/Tree/Tree.stories.js +786 -0
- package/lib/cjs/components/Tree/Tree.styles.d.ts +4 -0
- package/lib/cjs/components/Tree/Tree.styles.js +332 -0
- package/lib/cjs/components/Tree/Tree.test.js +300 -0
- package/lib/cjs/components/Tree/TreeItem.d.ts +22 -0
- package/lib/cjs/components/Tree/TreeItem.js +82 -0
- package/lib/cjs/components/Tree/TreeItemContent.d.ts +11 -0
- package/lib/cjs/components/Tree/TreeItemContent.js +102 -0
- package/lib/cjs/components/Tree/index.d.ts +5 -0
- package/lib/cjs/components/Tree/index.js +52 -0
- package/lib/cjs/components/Tree/useTreeDragAndDrop.d.ts +46 -0
- package/lib/cjs/components/Tree/useTreeDragAndDrop.js +76 -0
- package/lib/cjs/context/TooltipContext/index.js +2 -1
- package/lib/cjs/hooks/useCircularLoader/useCircularLoader.d.ts +1 -0
- package/lib/cjs/hooks/useCircularLoader/useCircularLoader.js +3 -2
- package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +4 -0
- package/lib/cjs/hooks/useGridListItem/useGridListItem.d.ts +4 -4
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.js +3 -1
- package/lib/cjs/hooks/usePagination/usePagination.d.ts +8 -8
- package/lib/cjs/hooks/useStatusClasses/useStatusClasses.js +2 -8
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +43 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.d.ts +1 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.js +7 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/icons.d.ts +2 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/index.d.ts +2 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.d.ts +15 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +15 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/tree.d.ts +15 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/tree.js +160 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +9 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +3 -1
- package/lib/cjs/styles/themeOverrides/onyxSideNav.d.ts +2 -0
- package/lib/cjs/styles/themes/astro/customProperties/icons.d.ts +2 -0
- package/lib/cjs/styles/themes/astro/customProperties/icons.js +3 -1
- package/lib/cjs/styles/themes/astro/customProperties/index.d.ts +2 -0
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/cjs/styles/themes/next-gen/customProperties/icons.d.ts +2 -0
- package/lib/cjs/styles/themes/next-gen/customProperties/icons.js +1 -1
- package/lib/cjs/styles/themes/next-gen/customProperties/index.d.ts +2 -0
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +27 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +15 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.js +11 -0
- package/lib/cjs/styles/themes/next-gen/variants/tree.d.ts +16 -0
- package/lib/cjs/styles/themes/next-gen/variants/tree.js +153 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +10 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +2 -0
- package/lib/cjs/styles/variants/index.js +3 -1
- package/lib/cjs/styles/variants/variants.js +2 -0
- package/lib/cjs/types/ComboBox.d.ts +36 -0
- package/lib/cjs/types/ComboBox.js +6 -0
- package/lib/cjs/types/ComboBoxField.d.ts +110 -0
- package/lib/cjs/types/ComboBoxField.js +6 -0
- package/lib/cjs/types/index.d.ts +2 -0
- package/lib/cjs/types/index.js +79 -57
- package/lib/cjs/types/popoverContainer.d.ts +1 -0
- package/lib/cjs/types/textField.d.ts +6 -0
- package/lib/cjs/utils/getStatusClasses.d.ts +13 -0
- package/lib/cjs/utils/getStatusClasses.js +29 -0
- package/lib/components/ComboBox/ComboBoxInput.js +8 -37
- package/lib/components/ComboBoxField/ComboBoxField.js +12 -134
- package/lib/components/ComboBoxField/ComboBoxField.stories.js +5 -4
- package/lib/components/ComboBoxField/ComboBoxField.test.js +2 -3
- package/lib/components/Tree/Tree.js +33 -0
- package/lib/components/Tree/Tree.mdx +58 -0
- package/lib/components/Tree/Tree.stories.js +775 -0
- package/lib/components/Tree/Tree.styles.js +325 -0
- package/lib/components/Tree/Tree.test.js +297 -0
- package/lib/components/Tree/TreeItem.js +70 -0
- package/lib/components/Tree/TreeItemContent.js +94 -0
- package/lib/components/Tree/index.js +5 -0
- package/lib/components/Tree/useTreeDragAndDrop.js +69 -0
- package/lib/context/TooltipContext/index.js +2 -1
- package/lib/hooks/useCircularLoader/useCircularLoader.js +3 -2
- package/lib/hooks/useOverlayPanelState/useOverlayPanelState.test.js +3 -1
- package/lib/hooks/useStatusClasses/useStatusClasses.js +2 -8
- package/lib/index.js +1 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/colors.js +7 -1
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +15 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/tree.js +154 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +3 -1
- package/lib/styles/themes/astro/customProperties/icons.js +3 -1
- package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/styles/themes/next-gen/customProperties/icons.js +1 -1
- package/lib/styles/themes/next-gen/variants/button.js +11 -0
- package/lib/styles/themes/next-gen/variants/tree.js +147 -0
- package/lib/styles/themes/next-gen/variants/variants.js +2 -0
- package/lib/styles/variants/index.js +3 -1
- package/lib/styles/variants/variants.js +2 -0
- package/lib/types/ComboBox.js +1 -0
- package/lib/types/ComboBoxField.js +1 -0
- package/lib/types/index.js +2 -0
- package/lib/utils/getStatusClasses.js +22 -0
- package/package.json +9 -6
|
@@ -15,20 +15,16 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
exports["default"] = void 0;
|
|
18
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
|
19
18
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
20
19
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
21
20
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
|
22
21
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
22
|
var _reactAria = require("react-aria");
|
|
24
23
|
var _interactions = require("@react-aria/interactions");
|
|
25
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
26
24
|
var _ = require("../..");
|
|
27
25
|
var _hooks = require("../../hooks");
|
|
28
26
|
var _useGetTheme2 = _interopRequireDefault(require("../../hooks/useGetTheme"));
|
|
29
27
|
var _loadingStates = _interopRequireDefault(require("../../utils/devUtils/constants/loadingStates"));
|
|
30
|
-
var _ariaAttributes = require("../../utils/docUtils/ariaAttributes");
|
|
31
|
-
var _statusProp = require("../../utils/docUtils/statusProp");
|
|
32
28
|
var _react2 = require("@emotion/react");
|
|
33
29
|
var _excluded = ["controlProps", "containerProps", "hasAutoFocus", "isDisabled", "isReadOnly", "isOpen", "loadingState", "style", "inputWrapperRef", "inputRef", "inputProps", "triggerRef", "triggerProps", "menuTrigger", "onInputChange", "onLoadMore", "onOpenChange", "onSelectionChange", "wrapperProps"];
|
|
34
30
|
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -55,6 +51,9 @@ var ComboBoxInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
55
51
|
onSelectionChange = props.onSelectionChange,
|
|
56
52
|
wrapperProps = props.wrapperProps,
|
|
57
53
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
54
|
+
var _useHover = (0, _interactions.useHover)({}),
|
|
55
|
+
hoverProps = _useHover.hoverProps,
|
|
56
|
+
isHovered = _useHover.isHovered;
|
|
58
57
|
var textFieldProps = _objectSpread({
|
|
59
58
|
isDisabled: isDisabled,
|
|
60
59
|
isReadOnly: isReadOnly,
|
|
@@ -69,12 +68,10 @@ var ComboBoxInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
69
68
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
70
69
|
return inputRef.current;
|
|
71
70
|
});
|
|
72
|
-
var _useHover = (0, _interactions.useHover)({}),
|
|
73
|
-
hoverProps = _useHover.hoverProps,
|
|
74
|
-
isHovered = _useHover.isHovered;
|
|
75
71
|
var _useInputLoader = (0, _hooks.useInputLoader)({
|
|
76
72
|
loadingState: loadingState,
|
|
77
|
-
|
|
73
|
+
// eslint-disable-next-line max-len
|
|
74
|
+
inputValue: inputProps === null || inputProps === void 0 ? void 0 : inputProps.value
|
|
78
75
|
}),
|
|
79
76
|
isLoading = _useInputLoader.isLoading;
|
|
80
77
|
(0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
|
|
@@ -101,7 +98,7 @@ var ComboBoxInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
101
98
|
size: isOnyx ? 'sm' : 'md',
|
|
102
99
|
sx: isOpen ? {
|
|
103
100
|
transform: 'rotate(180deg)'
|
|
104
|
-
} :
|
|
101
|
+
} : undefined,
|
|
105
102
|
title: {
|
|
106
103
|
name: ''
|
|
107
104
|
},
|
|
@@ -124,40 +121,14 @@ var ComboBoxInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
124
121
|
controlProps: _objectSpread({
|
|
125
122
|
variant: 'forms.comboBox.input'
|
|
126
123
|
}, controlProps),
|
|
124
|
+
tabIndex: -1,
|
|
127
125
|
statusClasses: {
|
|
128
126
|
isHovered: isHovered
|
|
129
127
|
},
|
|
130
128
|
ref: inputRef,
|
|
131
129
|
slots: {
|
|
132
130
|
inContainer: button
|
|
133
|
-
}
|
|
134
|
-
tabIndex: -1
|
|
131
|
+
}
|
|
135
132
|
}))));
|
|
136
133
|
});
|
|
137
|
-
ComboBoxInput.propTypes = _objectSpread(_objectSpread({
|
|
138
|
-
containerProps: _propTypes["default"].shape({}),
|
|
139
|
-
controlProps: _propTypes["default"].shape({}),
|
|
140
|
-
hasAutoFocus: _propTypes["default"].bool,
|
|
141
|
-
helperText: _propTypes["default"].node,
|
|
142
|
-
inputProps: _propTypes["default"].shape({
|
|
143
|
-
value: _propTypes["default"].string
|
|
144
|
-
}),
|
|
145
|
-
inputRef: _propTypes["default"].shape({}),
|
|
146
|
-
inputWrapperRef: _propTypes["default"].shape({}),
|
|
147
|
-
isDisabled: _propTypes["default"].bool,
|
|
148
|
-
isOpen: _propTypes["default"].bool,
|
|
149
|
-
isReadOnly: _propTypes["default"].bool,
|
|
150
|
-
label: _propTypes["default"].node,
|
|
151
|
-
labelProps: _propTypes["default"].shape({}),
|
|
152
|
-
loadingState: _propTypes["default"].oneOf((0, _values["default"])(_loadingStates["default"])),
|
|
153
|
-
menuTrigger: _propTypes["default"].oneOf(['focus', 'input', 'manual']),
|
|
154
|
-
onInputChange: _propTypes["default"].func,
|
|
155
|
-
onLoadMore: _propTypes["default"].func,
|
|
156
|
-
onOpenChange: _propTypes["default"].func,
|
|
157
|
-
onSelectionChange: _propTypes["default"].func,
|
|
158
|
-
style: _propTypes["default"].shape({}),
|
|
159
|
-
triggerProps: _propTypes["default"].shape({}),
|
|
160
|
-
triggerRef: _propTypes["default"].shape({}),
|
|
161
|
-
wrapperProps: _propTypes["default"].shape({})
|
|
162
|
-
}, _statusProp.statusPropTypes), _ariaAttributes.ariaAttributesBasePropTypes);
|
|
163
134
|
var _default = exports["default"] = ComboBoxInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ComboBoxInput';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComboBoxFieldProps } from '../../types';
|
|
3
|
+
interface ComboBoxFieldFC {
|
|
4
|
+
<T extends object>(props: ComboBoxFieldProps<T> & React.RefAttributes<HTMLInputElement>): React.ReactElement | null;
|
|
5
|
+
displayName?: string;
|
|
6
|
+
defaultProps?: Partial<ComboBoxFieldProps> | undefined;
|
|
7
|
+
}
|
|
8
|
+
declare const ComboBoxField: ComboBoxFieldFC;
|
|
9
|
+
export default ComboBoxField;
|
|
@@ -17,7 +17,6 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
17
17
|
exports["default"] = void 0;
|
|
18
18
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
19
19
|
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
20
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
|
21
20
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
22
21
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
23
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
@@ -27,13 +26,10 @@ var _reactAria = require("react-aria");
|
|
|
27
26
|
var _reactStately = require("react-stately");
|
|
28
27
|
var _i18n = require("@react-aria/i18n");
|
|
29
28
|
var _utils = require("@react-aria/utils");
|
|
30
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
29
|
var _hooks = require("../../hooks");
|
|
32
30
|
var _loadingStates = _interopRequireDefault(require("../../utils/devUtils/constants/loadingStates"));
|
|
33
31
|
var _pendoID = require("../../utils/devUtils/constants/pendoID");
|
|
34
|
-
var _isIterable = require("../../utils/devUtils/props/isIterable");
|
|
35
32
|
var _ariaAttributes = require("../../utils/docUtils/ariaAttributes");
|
|
36
|
-
var _statusProp = require("../../utils/docUtils/statusProp");
|
|
37
33
|
var _ComboBox = _interopRequireDefault(require("../ComboBox"));
|
|
38
34
|
var _ListBox = _interopRequireDefault(require("../ListBox"));
|
|
39
35
|
var _Popover = _interopRequireDefault(require("../Popover"));
|
|
@@ -86,11 +82,11 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
86
82
|
label: 'default',
|
|
87
83
|
allowsEmptyCollection: allowsEmptyCollection
|
|
88
84
|
}, nonAriaProps);
|
|
89
|
-
var popoverRef = (0, _react.useRef)();
|
|
90
|
-
var buttonRef = (0, _react.useRef)();
|
|
91
|
-
var listBoxRef = (0, _react.useRef)();
|
|
92
|
-
var inputRef = (0, _react.useRef)();
|
|
93
|
-
var inputWrapperRef = (0, _react.useRef)();
|
|
85
|
+
var popoverRef = (0, _react.useRef)(null);
|
|
86
|
+
var buttonRef = (0, _react.useRef)(null);
|
|
87
|
+
var listBoxRef = (0, _react.useRef)(null);
|
|
88
|
+
var inputRef = (0, _react.useRef)(null);
|
|
89
|
+
var inputWrapperRef = (0, _react.useRef)(null);
|
|
94
90
|
(0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
|
|
95
91
|
/* istanbul ignore next */
|
|
96
92
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
@@ -101,7 +97,7 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
101
97
|
var getItemsArr = function getItemsArr(initialArr) {
|
|
102
98
|
if (initialArr && shouldShowAddOption) {
|
|
103
99
|
var _context;
|
|
104
|
-
return (0, _concat["default"])(_context = []).call(_context, initialArr, [{
|
|
100
|
+
return (0, _concat["default"])(_context = []).call(_context, (0, _from["default"])(initialArr), [{
|
|
105
101
|
name: addOption,
|
|
106
102
|
key: addOption
|
|
107
103
|
}]);
|
|
@@ -143,10 +139,11 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
143
139
|
inputProps = _useComboBox.inputProps,
|
|
144
140
|
listBoxProps = _useComboBox.listBoxProps,
|
|
145
141
|
labelProps = _useComboBox.labelProps;
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
var _ref = listBoxProps,
|
|
143
|
+
shouldFocusOnHover = _ref.shouldFocusOnHover,
|
|
144
|
+
shouldSelectOnPressUp = _ref.shouldSelectOnPressUp,
|
|
145
|
+
action = _ref['UNSTABLE_itemBehavior'],
|
|
146
|
+
otherListBoxProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
|
|
150
147
|
var _useOverlayPosition = (0, _reactAria.useOverlayPosition)({
|
|
151
148
|
offset: 1,
|
|
152
149
|
targetRef: inputWrapperRef,
|
|
@@ -234,125 +231,6 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
234
231
|
"aria-invalid": status === 'error' && true
|
|
235
232
|
})), listBox);
|
|
236
233
|
});
|
|
237
|
-
ComboBoxField.propTypes = _objectSpread(_objectSpread({
|
|
238
|
-
/* Whether or not adding new options to the list is enabled. */
|
|
239
|
-
hasAddOption: _propTypes["default"].bool,
|
|
240
|
-
/** Whether the ComboBox allows a non-item matching input value to be set. */
|
|
241
|
-
hasCustomValue: _propTypes["default"].bool,
|
|
242
|
-
/** Whether the collection allows empty selection. */
|
|
243
|
-
hasNoEmptySelection: _propTypes["default"].bool,
|
|
244
|
-
/**
|
|
245
|
-
* The item keys that are disabled. These items cannot be selected, focused, or otherwise
|
|
246
|
-
* interacted with.
|
|
247
|
-
*/
|
|
248
|
-
disabledKeys: _isIterable.isIterableProp,
|
|
249
|
-
/** The interaction required to display the ComboBox menu. */
|
|
250
|
-
menuTrigger: _propTypes["default"].oneOf(['focus', 'input', 'manual']),
|
|
251
|
-
/**
|
|
252
|
-
* Whether the ComboBox menu is prevented from flipping directions when insufficient space is
|
|
253
|
-
* available for the given `direction` placement.
|
|
254
|
-
*/
|
|
255
|
-
isNotFlippable: _propTypes["default"].bool,
|
|
256
|
-
/** Where the ComboBox menu opens relative to its trigger. */
|
|
257
|
-
direction: _propTypes["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
|
258
|
-
/** Text rendered below the input. */
|
|
259
|
-
helperText: _propTypes["default"].node,
|
|
260
|
-
/** The initial selected key in the collection (uncontrolled). */
|
|
261
|
-
defaultSelectedKey: _propTypes["default"].string,
|
|
262
|
-
/** The currently selected key in the collection (controlled). */
|
|
263
|
-
selectedKey: _propTypes["default"].string,
|
|
264
|
-
/**
|
|
265
|
-
* Handler that is called when the selection changes.
|
|
266
|
-
*
|
|
267
|
-
* `(key: Key) => any`
|
|
268
|
-
*/
|
|
269
|
-
onSelectionChange: _propTypes["default"].func,
|
|
270
|
-
/** The list of ComboBox items (uncontrolled). */
|
|
271
|
-
defaultItems: _isIterable.isIterableProp,
|
|
272
|
-
/** The list of ComboBox items (controlled). */
|
|
273
|
-
items: _isIterable.isIterableProp,
|
|
274
|
-
/**
|
|
275
|
-
* Method that is called when the open state of the menu changes.
|
|
276
|
-
* Returns the new open state and the action that caused the opening of the menu.
|
|
277
|
-
*
|
|
278
|
-
* `(isOpen: boolean, menuTrigger: MenuTriggerAction) => void`
|
|
279
|
-
*/
|
|
280
|
-
onOpenChange: _propTypes["default"].func,
|
|
281
|
-
loadingState: _propTypes["default"].oneOf((0, _values["default"])(_loadingStates["default"])),
|
|
282
|
-
onLoadMore: _propTypes["default"].func,
|
|
283
|
-
/** The default value of the ComboBox input (uncontrolled). */
|
|
284
|
-
defaultInputValue: _propTypes["default"].string,
|
|
285
|
-
/** The value of the ComboBox input (controlled). */
|
|
286
|
-
inputValue: _propTypes["default"].string,
|
|
287
|
-
/**
|
|
288
|
-
* Handler that is called when the ComboBox input value changes.
|
|
289
|
-
*
|
|
290
|
-
* `(value: string) => void`
|
|
291
|
-
*/
|
|
292
|
-
onInputChange: _propTypes["default"].func,
|
|
293
|
-
/** Whether user input is required on the input before form submission. */
|
|
294
|
-
isRequired: _propTypes["default"].bool,
|
|
295
|
-
/** Whether the input is disabled. */
|
|
296
|
-
isDisabled: _propTypes["default"].bool,
|
|
297
|
-
/** Whether the input can be selected but not changed by the user. */
|
|
298
|
-
isReadOnly: _propTypes["default"].bool,
|
|
299
|
-
/** The rendered label for the field. */
|
|
300
|
-
label: _propTypes["default"].node,
|
|
301
|
-
/** Temporary text that occupies the text input when it is empty. */
|
|
302
|
-
placeholder: _propTypes["default"].string,
|
|
303
|
-
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
|
304
|
-
id: _propTypes["default"].string,
|
|
305
|
-
/** Whether the element should receive focus on render. */
|
|
306
|
-
hasAutoFocus: _propTypes["default"].bool,
|
|
307
|
-
/** Whether the field has a status indicator. */
|
|
308
|
-
hasNoStatusIndicator: _propTypes["default"].bool,
|
|
309
|
-
/**
|
|
310
|
-
* Handler that is called when the element receives focus.
|
|
311
|
-
*
|
|
312
|
-
* `(e: FocusEvent) => void`
|
|
313
|
-
*/
|
|
314
|
-
onFocus: _propTypes["default"].func,
|
|
315
|
-
/**
|
|
316
|
-
* Handler that is called when the element loses focus.
|
|
317
|
-
*
|
|
318
|
-
* `(e: FocusEvent) => void`
|
|
319
|
-
*/
|
|
320
|
-
onBlur: _propTypes["default"].func,
|
|
321
|
-
/**
|
|
322
|
-
* Handler that is called when the element's focus status changes.
|
|
323
|
-
*
|
|
324
|
-
* `(isFocused: boolean) => void`
|
|
325
|
-
*/
|
|
326
|
-
onFocusChange: _propTypes["default"].func,
|
|
327
|
-
/**
|
|
328
|
-
* Handler that is called when a key is pressed.
|
|
329
|
-
*
|
|
330
|
-
* `(e: KeyboardEvent) => void`
|
|
331
|
-
*/
|
|
332
|
-
onKeyDown: _propTypes["default"].func,
|
|
333
|
-
/**
|
|
334
|
-
* Handler that is called when a key is released.
|
|
335
|
-
*
|
|
336
|
-
* `(e: KeyboardEvent) => void`
|
|
337
|
-
*/
|
|
338
|
-
onKeyUp: _propTypes["default"].func,
|
|
339
|
-
/**
|
|
340
|
-
* Handler that determines the default filtering for items. If undefined, `contains` from
|
|
341
|
-
* [useFilter](https://react-spectrum.adobe.com/react-aria/useFilter.html) is used.
|
|
342
|
-
*
|
|
343
|
-
* `(option: string, inputValue: string) => boolean`
|
|
344
|
-
*/
|
|
345
|
-
defaultFilter: _propTypes["default"].func,
|
|
346
|
-
// /** Props object that is spread directly into the ScrollBox element. */
|
|
347
|
-
/** @ignore */
|
|
348
|
-
scrollBoxProps: _propTypes["default"].shape({
|
|
349
|
-
maxHeight: _propTypes["default"].string
|
|
350
|
-
}),
|
|
351
|
-
/** Props object that is spread directly into the ComboBoxInput element. */
|
|
352
|
-
controlProps: _propTypes["default"].shape({
|
|
353
|
-
onClick: _propTypes["default"].func
|
|
354
|
-
})
|
|
355
|
-
}, _statusProp.statusPropTypes), _ariaAttributes.ariaAttributesBasePropTypes);
|
|
356
234
|
ComboBoxField.defaultProps = {
|
|
357
235
|
menuTrigger: 'focus',
|
|
358
236
|
direction: 'bottom',
|
|
@@ -340,9 +340,10 @@ var AsyncLoading = exports.AsyncLoading = function AsyncLoading() {
|
|
|
340
340
|
loadingState: loading,
|
|
341
341
|
onLoadMore: handleLoadMore
|
|
342
342
|
}), function (item) {
|
|
343
|
+
var _item$name, _item$name2;
|
|
343
344
|
return (0, _react2.jsx)(_index.Item, {
|
|
344
|
-
key: item.name.given
|
|
345
|
-
}, item.name.given);
|
|
345
|
+
key: (_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.given
|
|
346
|
+
}, (_item$name2 = item.name) === null || _item$name2 === void 0 ? void 0 : _item$name2.given);
|
|
346
347
|
}));
|
|
347
348
|
};
|
|
348
349
|
var ControlledInput = exports.ControlledInput = function ControlledInput() {
|
|
@@ -421,8 +422,8 @@ var ControlledFiltering = exports.ControlledFiltering = function ControlledFilte
|
|
|
421
422
|
inputValue: selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name,
|
|
422
423
|
selectedKey: key,
|
|
423
424
|
itemsList: (0, _filter["default"])(items).call(items, function (item) {
|
|
424
|
-
var
|
|
425
|
-
return startsWith(item.name, (
|
|
425
|
+
var _name;
|
|
426
|
+
return startsWith(item.name, (_name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _name !== void 0 ? _name : '');
|
|
426
427
|
})
|
|
427
428
|
});
|
|
428
429
|
};
|
|
@@ -152,8 +152,8 @@ var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
|
|
|
152
152
|
inputValue: selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name,
|
|
153
153
|
selectedKey: key,
|
|
154
154
|
itemsList: (0, _filter["default"])(items).call(items, function (item) {
|
|
155
|
-
var
|
|
156
|
-
return startsWith(item.name, (
|
|
155
|
+
var _name;
|
|
156
|
+
return startsWith(item.name, (_name = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _name !== void 0 ? _name : '');
|
|
157
157
|
})
|
|
158
158
|
});
|
|
159
159
|
};
|
|
@@ -180,7 +180,6 @@ var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
|
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
182
|
return (0, _react3.jsx)(_index.OverlayProvider, null, (0, _react3.jsx)(_index.ComboBoxField, (0, _extends2["default"])({
|
|
183
|
-
label: "Example label",
|
|
184
183
|
items: fieldState.itemsList,
|
|
185
184
|
inputValue: fieldState.inputValue,
|
|
186
185
|
selectedKey: fieldState.selectedKey,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ComboBoxField';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TreeProps, useDragAndDrop } from 'react-aria-components';
|
|
3
|
+
export interface TreeDragAndDropOptions {
|
|
4
|
+
/** Options that configure drag and drop behavior, returned by useDragAndDrop. */
|
|
5
|
+
dragAndDropHooks?: TreeProps<unknown>['dragAndDropHooks'];
|
|
6
|
+
}
|
|
7
|
+
declare const Tree: React.ForwardRefExoticComponent<TreeProps<unknown> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export { useDragAndDrop };
|
|
9
|
+
export default Tree;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof3 = require("@babel/runtime-corejs3/helpers/typeof");
|
|
4
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
6
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
9
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
10
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
11
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
12
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
13
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
14
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
exports["default"] = void 0;
|
|
18
|
+
_Object$defineProperty(exports, "useDragAndDrop", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _reactAriaComponents.useDragAndDrop;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
25
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
26
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
27
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
28
|
+
var _reactAriaComponents = require("react-aria-components");
|
|
29
|
+
var _Box = _interopRequireDefault(require("../Box"));
|
|
30
|
+
var _react2 = require("@emotion/react");
|
|
31
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
32
|
+
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; }
|
|
33
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
34
|
+
var Tree = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
35
|
+
return (0, _react2.jsx)(_reactAriaComponents.Tree, (0, _extends2["default"])({}, props, {
|
|
36
|
+
ref: ref,
|
|
37
|
+
render: function render(domProps) {
|
|
38
|
+
return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({}, domProps, {
|
|
39
|
+
ref: domProps.ref,
|
|
40
|
+
isRow: false,
|
|
41
|
+
variant: "tree.container",
|
|
42
|
+
sx: _objectSpread({}, (0, _typeof2["default"])(props.style) === 'object' ? props.style : {})
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
Tree.displayName = 'Tree';
|
|
48
|
+
var _default = exports["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.
|