@carbon/react 1.42.1 → 1.44.0-rc.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +2843 -1416
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -2
- package/es/components/ComboBox/ComboBox.d.ts +5 -0
- package/es/components/ComboBox/ComboBox.js +28 -2
- package/es/components/ComboButton/index.js +2 -1
- package/es/components/ComposedModal/ComposedModal.d.ts +3 -3
- package/es/components/ComposedModal/ComposedModal.js +3 -3
- package/es/components/ComposedModal/ModalFooter.d.ts +18 -0
- package/es/components/ComposedModal/ModalFooter.js +48 -16
- package/es/components/ContextMenu/useContextMenu.js +2 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
- package/es/components/DatePickerInput/DatePickerInput.d.ts +4 -0
- package/es/components/DatePickerInput/DatePickerInput.js +16 -2
- package/es/components/Dropdown/Dropdown.d.ts +5 -0
- package/es/components/Dropdown/Dropdown.js +20 -3
- package/es/components/InlineLoading/index.js +9 -0
- package/es/components/Link/Link.d.ts +5 -0
- package/es/components/Link/Link.js +9 -2
- package/es/components/Menu/Menu.js +14 -0
- package/es/components/Menu/MenuContext.js +1 -0
- package/es/components/Menu/MenuItem.js +19 -4
- package/es/components/MenuButton/index.js +3 -1
- package/es/components/Modal/Modal.d.ts +17 -0
- package/es/components/Modal/Modal.js +38 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +17 -3
- package/es/components/MultiSelect/MultiSelect.d.ts +5 -0
- package/es/components/MultiSelect/MultiSelect.js +17 -3
- package/es/components/NumberInput/NumberInput.d.ts +5 -0
- package/es/components/NumberInput/NumberInput.js +29 -4
- package/es/components/Select/Select.d.ts +6 -1
- package/es/components/Select/Select.js +16 -2
- package/es/components/Slug/index.js +187 -0
- package/es/components/TextArea/TextArea.d.ts +4 -0
- package/es/components/TextArea/TextArea.js +47 -31
- package/es/components/TextInput/TextInput.d.ts +5 -0
- package/es/components/TextInput/TextInput.js +16 -2
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/components/UIShell/SideNavHeader.d.ts +29 -0
- package/es/components/UIShell/SideNavHeader.js +3 -3
- package/es/components/UIShell/Switcher.d.ts +38 -0
- package/es/components/UIShell/Switcher.js +14 -13
- package/es/components/UIShell/SwitcherDivider.d.ts +9 -0
- package/es/components/UIShell/SwitcherDivider.js +4 -5
- package/es/components/UIShell/SwitcherItem.d.ts +49 -0
- package/es/components/UIShell/SwitcherItem.js +13 -17
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/prop-types/tools/getDisplayName.js +34 -0
- package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -2
- package/lib/components/ComboBox/ComboBox.d.ts +5 -0
- package/lib/components/ComboBox/ComboBox.js +28 -2
- package/lib/components/ComboButton/index.js +2 -1
- package/lib/components/ComposedModal/ComposedModal.d.ts +3 -3
- package/lib/components/ComposedModal/ComposedModal.js +3 -3
- package/lib/components/ComposedModal/ModalFooter.d.ts +18 -0
- package/lib/components/ComposedModal/ModalFooter.js +48 -16
- package/lib/components/ContextMenu/useContextMenu.js +2 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +4 -0
- package/lib/components/DatePickerInput/DatePickerInput.js +16 -2
- package/lib/components/Dropdown/Dropdown.d.ts +5 -0
- package/lib/components/Dropdown/Dropdown.js +20 -3
- package/lib/components/InlineLoading/index.js +17 -0
- package/lib/components/Link/Link.d.ts +5 -0
- package/lib/components/Link/Link.js +9 -2
- package/lib/components/Menu/Menu.js +14 -0
- package/lib/components/Menu/MenuContext.js +1 -0
- package/lib/components/Menu/MenuItem.js +19 -4
- package/lib/components/MenuButton/index.js +3 -1
- package/lib/components/Modal/Modal.d.ts +17 -0
- package/lib/components/Modal/Modal.js +38 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +17 -3
- package/lib/components/MultiSelect/MultiSelect.d.ts +5 -0
- package/lib/components/MultiSelect/MultiSelect.js +17 -3
- package/lib/components/NumberInput/NumberInput.d.ts +5 -0
- package/lib/components/NumberInput/NumberInput.js +28 -3
- package/lib/components/Select/Select.d.ts +6 -1
- package/lib/components/Select/Select.js +16 -2
- package/lib/components/Slug/index.js +199 -0
- package/lib/components/TextArea/TextArea.d.ts +4 -0
- package/lib/components/TextArea/TextArea.js +47 -31
- package/lib/components/TextInput/TextInput.d.ts +5 -0
- package/lib/components/TextInput/TextInput.js +16 -2
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/components/UIShell/SideNavHeader.d.ts +29 -0
- package/lib/components/UIShell/SideNavHeader.js +3 -3
- package/lib/components/UIShell/Switcher.d.ts +38 -0
- package/lib/components/UIShell/Switcher.js +13 -12
- package/lib/components/UIShell/SwitcherDivider.d.ts +9 -0
- package/lib/components/UIShell/SwitcherDivider.js +4 -5
- package/lib/components/UIShell/SwitcherItem.d.ts +49 -0
- package/lib/components/UIShell/SwitcherItem.js +12 -16
- package/lib/index.d.ts +1 -0
- package/lib/index.js +45 -41
- package/lib/prop-types/tools/getDisplayName.js +38 -0
- package/package.json +6 -6
- package/scss/utilities/_ai-gradient.scss +9 -0
|
@@ -23,6 +23,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
23
23
|
|
|
24
24
|
const Link = /*#__PURE__*/React__default["default"].forwardRef(function Link(_ref, ref) {
|
|
25
25
|
let {
|
|
26
|
+
as: BaseComponent,
|
|
26
27
|
children,
|
|
27
28
|
className: customClassName,
|
|
28
29
|
href,
|
|
@@ -43,7 +44,7 @@ const Link = /*#__PURE__*/React__default["default"].forwardRef(function Link(_re
|
|
|
43
44
|
});
|
|
44
45
|
const rel = target === '_blank' ? 'noopener' : undefined;
|
|
45
46
|
const linkProps = {
|
|
46
|
-
className,
|
|
47
|
+
className: BaseComponent ? undefined : className,
|
|
47
48
|
rel,
|
|
48
49
|
target
|
|
49
50
|
};
|
|
@@ -56,7 +57,8 @@ const Link = /*#__PURE__*/React__default["default"].forwardRef(function Link(_re
|
|
|
56
57
|
linkProps.role = 'link';
|
|
57
58
|
linkProps['aria-disabled'] = true;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
const BaseComponentAsAny = BaseComponent ?? 'a';
|
|
61
|
+
return /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({
|
|
60
62
|
ref: ref
|
|
61
63
|
}, linkProps, rest), children, !inline && Icon && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
62
64
|
className: `${prefix}--link__icon`
|
|
@@ -64,6 +66,11 @@ const Link = /*#__PURE__*/React__default["default"].forwardRef(function Link(_re
|
|
|
64
66
|
});
|
|
65
67
|
Link.displayName = 'Link';
|
|
66
68
|
Link.propTypes = {
|
|
69
|
+
/**
|
|
70
|
+
* Provide a custom element or component to render the top-level node for the
|
|
71
|
+
* component.
|
|
72
|
+
*/
|
|
73
|
+
as: PropTypes__default["default"].string,
|
|
67
74
|
/**
|
|
68
75
|
* Provide the content for the Link
|
|
69
76
|
*/
|
|
@@ -16,6 +16,7 @@ var React = require('react');
|
|
|
16
16
|
var ReactDOM = require('react-dom');
|
|
17
17
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
|
+
var warning = require('../../internal/warning.js');
|
|
19
20
|
var MenuContext = require('./MenuContext.js');
|
|
20
21
|
var useLayoutDirection = require('../LayoutDirection/useLayoutDirection.js');
|
|
21
22
|
var match = require('../../internal/keyboard/match.js');
|
|
@@ -34,6 +35,7 @@ const Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_re
|
|
|
34
35
|
children,
|
|
35
36
|
className,
|
|
36
37
|
label,
|
|
38
|
+
mode = 'full',
|
|
37
39
|
onClose,
|
|
38
40
|
onOpen,
|
|
39
41
|
open,
|
|
@@ -47,10 +49,14 @@ const Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_re
|
|
|
47
49
|
const focusReturn = React.useRef(null);
|
|
48
50
|
const context = React.useContext(MenuContext.MenuContext);
|
|
49
51
|
const isRoot = context.state.isRoot;
|
|
52
|
+
if (context.state.mode === 'basic' && !isRoot) {
|
|
53
|
+
process.env.NODE_ENV !== "production" ? warning.warning(false, 'Nested menus are not supported when the menu is in "basic" mode.') : void 0;
|
|
54
|
+
}
|
|
50
55
|
const menuSize = isRoot ? size : context.state.size;
|
|
51
56
|
const [childState, childDispatch] = React.useReducer(MenuContext.menuReducer, {
|
|
52
57
|
...context.state,
|
|
53
58
|
isRoot: false,
|
|
59
|
+
mode,
|
|
54
60
|
size,
|
|
55
61
|
requestCloseRoot: isRoot ? handleClose : context.state.requestCloseRoot
|
|
56
62
|
});
|
|
@@ -255,6 +261,14 @@ Menu.propTypes = {
|
|
|
255
261
|
* A label describing the Menu.
|
|
256
262
|
*/
|
|
257
263
|
label: PropTypes__default["default"].string,
|
|
264
|
+
/**
|
|
265
|
+
* The mode of this menu. Defaults to full.
|
|
266
|
+
* `full` supports nesting and selectable menu items, but no icons.
|
|
267
|
+
* `basic` supports icons but no nesting or selectable menu items.
|
|
268
|
+
*
|
|
269
|
+
* **This prop is not intended for use and will be set by the respective implementation (like useContextMenu, MenuButton, and ComboButton).**
|
|
270
|
+
*/
|
|
271
|
+
mode: PropTypes__default["default"].oneOf(['full', 'basic']),
|
|
258
272
|
/**
|
|
259
273
|
* Provide an optional function to be called when the Menu should be closed.
|
|
260
274
|
*/
|
|
@@ -17,6 +17,7 @@ var iconsReact = require('@carbon/icons-react');
|
|
|
17
17
|
var useControllableState = require('../../internal/useControllableState.js');
|
|
18
18
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
19
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
|
+
var warning = require('../../internal/warning.js');
|
|
20
21
|
var Menu = require('./Menu.js');
|
|
21
22
|
var MenuContext = require('./MenuContext.js');
|
|
22
23
|
require('../Text/index.js');
|
|
@@ -153,6 +154,14 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function Menu
|
|
|
153
154
|
setRtl(false);
|
|
154
155
|
}
|
|
155
156
|
}, [direction]);
|
|
157
|
+
const iconsAllowed = context.state.mode === 'basic' || rest.role === 'menuitemcheckbox' || rest.role === 'menuitemradio';
|
|
158
|
+
React.useEffect(() => {
|
|
159
|
+
if (iconsAllowed && IconElement && !context.state.hasIcons) {
|
|
160
|
+
context.dispatch({
|
|
161
|
+
type: 'enableIcons'
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}, [iconsAllowed, IconElement, context.state.hasIcons, context]);
|
|
156
165
|
return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
|
|
157
166
|
role: "menuitem"
|
|
158
167
|
}, rest, {
|
|
@@ -168,7 +177,7 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function Menu
|
|
|
168
177
|
onKeyDown: handleKeyDown
|
|
169
178
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
170
179
|
className: `${prefix}--menu-item__icon`
|
|
171
|
-
}, IconElement && /*#__PURE__*/React__default["default"].createElement(IconElement, null)), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
180
|
+
}, iconsAllowed && IconElement && /*#__PURE__*/React__default["default"].createElement(IconElement, null)), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
172
181
|
as: "div",
|
|
173
182
|
className: `${prefix}--menu-item__label`
|
|
174
183
|
}, label), shortcut && !hasChildren && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -212,7 +221,7 @@ MenuItem.propTypes = {
|
|
|
212
221
|
*/
|
|
213
222
|
onClick: PropTypes__default["default"].func,
|
|
214
223
|
/**
|
|
215
|
-
*
|
|
224
|
+
* Only applicable if the parent menu is in `basic` mode. Sets the menu item's icon.
|
|
216
225
|
*/
|
|
217
226
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
218
227
|
/**
|
|
@@ -231,6 +240,9 @@ const MenuItemSelectable = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
|
231
240
|
} = _ref2;
|
|
232
241
|
const prefix = usePrefix.usePrefix();
|
|
233
242
|
const context = React.useContext(MenuContext.MenuContext);
|
|
243
|
+
if (context.state.mode === 'basic') {
|
|
244
|
+
process.env.NODE_ENV !== "production" ? warning.warning(false, 'MenuItemSelectable is not supported when the menu is in "basic" mode.') : void 0;
|
|
245
|
+
}
|
|
234
246
|
const [checked, setChecked] = useControllableState.useControllableState({
|
|
235
247
|
value: selected,
|
|
236
248
|
onChange,
|
|
@@ -256,7 +268,7 @@ const MenuItemSelectable = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
|
256
268
|
className: classNames,
|
|
257
269
|
role: "menuitemcheckbox",
|
|
258
270
|
"aria-checked": checked,
|
|
259
|
-
renderIcon: checked
|
|
271
|
+
renderIcon: checked ? iconsReact.Checkmark : undefined,
|
|
260
272
|
onClick: handleClick
|
|
261
273
|
}));
|
|
262
274
|
});
|
|
@@ -328,6 +340,9 @@ const MenuItemRadioGroup = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
|
328
340
|
} = _ref4;
|
|
329
341
|
const prefix = usePrefix.usePrefix();
|
|
330
342
|
const context = React.useContext(MenuContext.MenuContext);
|
|
343
|
+
if (context.state.mode === 'basic') {
|
|
344
|
+
process.env.NODE_ENV !== "production" ? warning.warning(false, 'MenuItemRadioGroup is not supported when the menu is in "basic" mode.') : void 0;
|
|
345
|
+
}
|
|
331
346
|
const [selection, setSelection] = useControllableState.useControllableState({
|
|
332
347
|
value: selectedItem,
|
|
333
348
|
onChange,
|
|
@@ -359,7 +374,7 @@ const MenuItemRadioGroup = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
|
359
374
|
label: itemToString(item),
|
|
360
375
|
role: "menuitemradio",
|
|
361
376
|
"aria-checked": item === selection,
|
|
362
|
-
renderIcon: item === selection
|
|
377
|
+
renderIcon: item === selection ? iconsReact.Checkmark : undefined,
|
|
363
378
|
onClick: e => {
|
|
364
379
|
handleClick(item, e);
|
|
365
380
|
}
|
|
@@ -67,6 +67,7 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function Me
|
|
|
67
67
|
function handleOpen() {
|
|
68
68
|
menuRef.current.style.inlineSize = `${width}px`;
|
|
69
69
|
}
|
|
70
|
+
const containerClasses = cx__default["default"](`${prefix}--menu-button__container`, className);
|
|
70
71
|
const triggerClasses = cx__default["default"](`${prefix}--menu-button__trigger`, {
|
|
71
72
|
[`${prefix}--menu-button__trigger--open`]: open
|
|
72
73
|
});
|
|
@@ -74,7 +75,7 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function Me
|
|
|
74
75
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
75
76
|
ref: ref,
|
|
76
77
|
"aria-owns": open ? id : null,
|
|
77
|
-
className:
|
|
78
|
+
className: containerClasses
|
|
78
79
|
}), /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
79
80
|
className: triggerClasses,
|
|
80
81
|
size: size,
|
|
@@ -90,6 +91,7 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function Me
|
|
|
90
91
|
ref: menuRef,
|
|
91
92
|
id: id,
|
|
92
93
|
label: label,
|
|
94
|
+
mode: "basic",
|
|
93
95
|
size: size,
|
|
94
96
|
open: open,
|
|
95
97
|
onClose: handleClose,
|
|
@@ -54,6 +54,18 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
54
54
|
* Provide a ref to return focus to once the modal is closed.
|
|
55
55
|
*/
|
|
56
56
|
launcherButtonRef?: any;
|
|
57
|
+
/**
|
|
58
|
+
* Specify the description for the loading text
|
|
59
|
+
*/
|
|
60
|
+
loadingDescription?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Specify the description for the loading text
|
|
63
|
+
*/
|
|
64
|
+
loadingIconDescription?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Specify loading status
|
|
67
|
+
*/
|
|
68
|
+
loadingStatus?: string;
|
|
57
69
|
/**
|
|
58
70
|
* Specify a label to be read by screen readers on the modal root node
|
|
59
71
|
*/
|
|
@@ -71,6 +83,11 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
71
83
|
* @deprecated this property is unused
|
|
72
84
|
*/
|
|
73
85
|
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
86
|
+
/**
|
|
87
|
+
* Specify an optional handler to be invoked when loading is
|
|
88
|
+
* successful
|
|
89
|
+
*/
|
|
90
|
+
onLoadingSuccess?: React.ReactEventHandler<HTMLElement>;
|
|
74
91
|
/**
|
|
75
92
|
* Specify a handler for closing modal.
|
|
76
93
|
* The handler should care of closing modal, e.g. changing `open` prop.
|
|
@@ -18,6 +18,7 @@ var toggleClass = require('../../tools/toggleClass.js');
|
|
|
18
18
|
var Button = require('../Button/Button.js');
|
|
19
19
|
require('../Button/Button.Skeleton.js');
|
|
20
20
|
var ButtonSet = require('../ButtonSet/ButtonSet.js');
|
|
21
|
+
var InlineLoading = require('../InlineLoading/InlineLoading.js');
|
|
21
22
|
var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropIsTruthy.js');
|
|
22
23
|
var wrapFocus = require('../../internal/wrapFocus.js');
|
|
23
24
|
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
@@ -64,6 +65,10 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
64
65
|
preventCloseOnClickOutside = false,
|
|
65
66
|
isFullWidth,
|
|
66
67
|
launcherButtonRef,
|
|
68
|
+
loadingStatus = 'inactive',
|
|
69
|
+
loadingDescription,
|
|
70
|
+
loadingIconDescription,
|
|
71
|
+
onLoadingSuccess = noopFn.noopFn,
|
|
67
72
|
...rest
|
|
68
73
|
} = _ref;
|
|
69
74
|
const prefix = usePrefix.usePrefix();
|
|
@@ -77,6 +82,10 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
77
82
|
const modalHeadingId = `${prefix}--modal-header__heading--${modalInstanceId}`;
|
|
78
83
|
const modalBodyId = `${prefix}--modal-body--${modalInstanceId}`;
|
|
79
84
|
const modalCloseButtonClass = `${prefix}--modal-close`;
|
|
85
|
+
const primaryButtonClass = cx__default["default"]({
|
|
86
|
+
[`${prefix}--btn--loading`]: loadingStatus !== 'inactive'
|
|
87
|
+
});
|
|
88
|
+
const loadingActive = loadingStatus !== 'inactive';
|
|
80
89
|
function isCloseButton(element) {
|
|
81
90
|
return !onSecondarySubmit && element === secondaryButton.current || element.classList.contains(modalCloseButtonClass);
|
|
82
91
|
}
|
|
@@ -229,7 +238,8 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
229
238
|
}, hasScrollingContentProps), children), hasScrollingContent && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
230
239
|
className: `${prefix}--modal-content--overflow-indicator`
|
|
231
240
|
}), !passiveModal && /*#__PURE__*/React__default["default"].createElement(ButtonSet["default"], {
|
|
232
|
-
className: footerClasses
|
|
241
|
+
className: footerClasses,
|
|
242
|
+
"aria-busy": loadingActive
|
|
233
243
|
}, Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map((_ref3, i) => {
|
|
234
244
|
let {
|
|
235
245
|
buttonText,
|
|
@@ -241,15 +251,23 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
241
251
|
onClick: onButtonClick
|
|
242
252
|
}, buttonText);
|
|
243
253
|
}) : secondaryButtonText && /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
254
|
+
disabled: loadingActive,
|
|
244
255
|
kind: "secondary",
|
|
245
256
|
onClick: onSecondaryButtonClick,
|
|
246
257
|
ref: secondaryButton
|
|
247
258
|
}, secondaryButtonText), /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
259
|
+
className: primaryButtonClass,
|
|
248
260
|
kind: danger ? 'danger' : 'primary',
|
|
249
|
-
disabled: primaryButtonDisabled,
|
|
261
|
+
disabled: loadingActive || primaryButtonDisabled,
|
|
250
262
|
onClick: onRequestSubmit,
|
|
251
263
|
ref: button
|
|
252
|
-
}, primaryButtonText
|
|
264
|
+
}, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/React__default["default"].createElement(InlineLoading["default"], {
|
|
265
|
+
status: loadingStatus,
|
|
266
|
+
description: loadingDescription,
|
|
267
|
+
iconDescription: loadingIconDescription,
|
|
268
|
+
className: `${prefix}--inline-loading--btn`,
|
|
269
|
+
onSuccess: onLoadingSuccess
|
|
270
|
+
}))));
|
|
253
271
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
254
272
|
onKeyDown: handleKeyDown,
|
|
255
273
|
onMouseDown: handleMousedown,
|
|
@@ -313,6 +331,18 @@ Modal.propTypes = {
|
|
|
313
331
|
launcherButtonRef: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].shape({
|
|
314
332
|
current: PropTypes__default["default"].any
|
|
315
333
|
})]),
|
|
334
|
+
/**
|
|
335
|
+
* Specify the description for the loading text
|
|
336
|
+
*/
|
|
337
|
+
loadingDescription: PropTypes__default["default"].string,
|
|
338
|
+
/**
|
|
339
|
+
* Specify the description for the loading text
|
|
340
|
+
*/
|
|
341
|
+
loadingIconDescription: PropTypes__default["default"].string,
|
|
342
|
+
/**
|
|
343
|
+
* loading status
|
|
344
|
+
*/
|
|
345
|
+
loadingStatus: PropTypes__default["default"].oneOf(['inactive', 'active', 'finished', 'error']),
|
|
316
346
|
/**
|
|
317
347
|
* Specify a label to be read by screen readers on the modal root node
|
|
318
348
|
*/
|
|
@@ -329,6 +359,11 @@ Modal.propTypes = {
|
|
|
329
359
|
* Specify a handler for keypresses.
|
|
330
360
|
*/
|
|
331
361
|
onKeyDown: PropTypes__default["default"].func,
|
|
362
|
+
/**
|
|
363
|
+
* Provide an optional handler to be invoked when loading is
|
|
364
|
+
* successful
|
|
365
|
+
*/
|
|
366
|
+
onLoadingSuccess: PropTypes__default["default"].func,
|
|
332
367
|
/**
|
|
333
368
|
* Specify a handler for closing modal.
|
|
334
369
|
* The handler should care of closing modal, e.g. changing `open` prop.
|
|
@@ -77,7 +77,8 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
77
77
|
translateWithId,
|
|
78
78
|
useTitleInItem,
|
|
79
79
|
warn,
|
|
80
|
-
warnText
|
|
80
|
+
warnText,
|
|
81
|
+
slug
|
|
81
82
|
} = _ref;
|
|
82
83
|
const {
|
|
83
84
|
isFluid
|
|
@@ -106,7 +107,8 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
106
107
|
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
107
108
|
[`${prefix}--list-box--up`]: direction === 'top',
|
|
108
109
|
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
109
|
-
[`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused
|
|
110
|
+
[`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused,
|
|
111
|
+
[`${prefix}--list-box__wrapper--slug`]: slug
|
|
110
112
|
});
|
|
111
113
|
const helperId = !helperText ? undefined : `filterablemultiselect-helper-text-${filterableMultiSelectInstanceId}`;
|
|
112
114
|
const labelId = `${id}-label`;
|
|
@@ -200,6 +202,14 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
200
202
|
textInput.current.focus();
|
|
201
203
|
}
|
|
202
204
|
}
|
|
205
|
+
|
|
206
|
+
// Slug is always size `mini`
|
|
207
|
+
let normalizedSlug;
|
|
208
|
+
if (slug) {
|
|
209
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
210
|
+
size: 'mini'
|
|
211
|
+
});
|
|
212
|
+
}
|
|
203
213
|
return /*#__PURE__*/React__default["default"].createElement(Selection["default"], {
|
|
204
214
|
disabled: disabled,
|
|
205
215
|
onChange: handleOnChange,
|
|
@@ -393,7 +403,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
393
403
|
}), /*#__PURE__*/React__default["default"].createElement(ListBoxTrigger["default"], _rollupPluginBabelHelpers["extends"]({}, buttonProps, {
|
|
394
404
|
isOpen: isOpen,
|
|
395
405
|
translateWithId: translateWithId
|
|
396
|
-
}))), isOpen ? /*#__PURE__*/React__default["default"].createElement(index["default"].Menu, menuProps, sortItems(filterItems(items, {
|
|
406
|
+
}))), normalizedSlug, isOpen ? /*#__PURE__*/React__default["default"].createElement(index["default"].Menu, menuProps, sortItems(filterItems(items, {
|
|
397
407
|
itemToString: itemToString$1,
|
|
398
408
|
inputValue
|
|
399
409
|
}), {
|
|
@@ -546,6 +556,10 @@ FilterableMultiSelect.propTypes = {
|
|
|
546
556
|
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
547
557
|
*/
|
|
548
558
|
size: ListBoxPropTypes.ListBoxSize,
|
|
559
|
+
/**
|
|
560
|
+
* Provide a `Slug` component to be rendered inside the `FilterableMultiSelect` component
|
|
561
|
+
*/
|
|
562
|
+
slug: PropTypes__default["default"].node,
|
|
549
563
|
...MultiSelectPropTypes.sortingPropTypes,
|
|
550
564
|
/**
|
|
551
565
|
* Callback function for translating ListBoxMenuIcon SVG title
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { UseSelectProps } from 'downshift';
|
|
8
|
+
import { ReactNodeLike } from 'prop-types';
|
|
8
9
|
import React from 'react';
|
|
9
10
|
import { ListBoxSize, ListBoxType } from '../ListBox';
|
|
10
11
|
import { ListBoxProps } from '../ListBox/ListBox';
|
|
@@ -162,6 +163,10 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
162
163
|
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
163
164
|
*/
|
|
164
165
|
size?: ListBoxSize;
|
|
166
|
+
/**
|
|
167
|
+
* Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
168
|
+
*/
|
|
169
|
+
slug?: ReactNodeLike;
|
|
165
170
|
/**
|
|
166
171
|
* Provide text to be used in a `<label>` element that is tied to the
|
|
167
172
|
* multiselect via ARIA attributes.
|
|
@@ -98,7 +98,8 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
98
98
|
direction = 'bottom',
|
|
99
99
|
selectedItems: selected,
|
|
100
100
|
readOnly,
|
|
101
|
-
locale = 'en'
|
|
101
|
+
locale = 'en',
|
|
102
|
+
slug
|
|
102
103
|
} = _ref;
|
|
103
104
|
const prefix = usePrefix.usePrefix();
|
|
104
105
|
const {
|
|
@@ -192,7 +193,8 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
192
193
|
[`${prefix}--multi-select__wrapper--inline--invalid`]: inline && invalid,
|
|
193
194
|
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
194
195
|
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
195
|
-
[`${prefix}--list-box__wrapper--fluid--focus`]: !isOpen && isFluid && isFocused
|
|
196
|
+
[`${prefix}--list-box__wrapper--fluid--focus`]: !isOpen && isFluid && isFocused,
|
|
197
|
+
[`${prefix}--list-box__wrapper--slug`]: slug
|
|
196
198
|
});
|
|
197
199
|
const titleClasses = cx__default["default"](`${prefix}--label`, {
|
|
198
200
|
[`${prefix}--label--disabled`]: disabled,
|
|
@@ -304,6 +306,14 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
304
306
|
}
|
|
305
307
|
}
|
|
306
308
|
} : {};
|
|
309
|
+
|
|
310
|
+
// Slug is always size `mini`
|
|
311
|
+
let normalizedSlug;
|
|
312
|
+
if (slug) {
|
|
313
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
314
|
+
size: 'mini'
|
|
315
|
+
});
|
|
316
|
+
}
|
|
307
317
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
308
318
|
className: wrapperClasses
|
|
309
319
|
}, /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({
|
|
@@ -352,7 +362,7 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
352
362
|
}, label), /*#__PURE__*/React__default["default"].createElement(index["default"].MenuIcon, {
|
|
353
363
|
isOpen: isOpen,
|
|
354
364
|
translateWithId: translateWithId
|
|
355
|
-
}))), /*#__PURE__*/React__default["default"].createElement(index["default"].Menu, getMenuProps(), isOpen &&
|
|
365
|
+
})), normalizedSlug), /*#__PURE__*/React__default["default"].createElement(index["default"].Menu, getMenuProps(), isOpen &&
|
|
356
366
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
357
367
|
sortItems(items, sortOptions).map((item, index$1) => {
|
|
358
368
|
const isChecked = selectedItems.filter(selected => isEqual__default["default"](selected, item)).length > 0;
|
|
@@ -507,6 +517,10 @@ MultiSelect.propTypes = {
|
|
|
507
517
|
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
508
518
|
*/
|
|
509
519
|
size: ListBoxPropTypes.ListBoxSize,
|
|
520
|
+
/**
|
|
521
|
+
* Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
522
|
+
*/
|
|
523
|
+
slug: PropTypes__default["default"].node,
|
|
510
524
|
/**
|
|
511
525
|
* Provide a method that sorts all options in the control. Overriding this
|
|
512
526
|
* prop means that you also have to handle the sort logic for selected versus
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import { ReactNodeLike } from 'prop-types';
|
|
7
8
|
import React, { ReactNode } from 'react';
|
|
8
9
|
export declare const translationIds: {
|
|
9
10
|
'increment.number': string;
|
|
@@ -107,6 +108,10 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
107
108
|
* Specify the size of the Number Input.
|
|
108
109
|
*/
|
|
109
110
|
size?: 'sm' | 'md' | 'lg';
|
|
111
|
+
/**
|
|
112
|
+
* Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
113
|
+
*/
|
|
114
|
+
slug?: ReactNodeLike;
|
|
110
115
|
/**
|
|
111
116
|
* Specify how much the values should increase/decrease upon clicking on up/down button
|
|
112
117
|
*/
|
|
@@ -44,7 +44,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
44
44
|
className: customClassName,
|
|
45
45
|
disabled = false,
|
|
46
46
|
disableWheel: disableWheelProp = false,
|
|
47
|
-
defaultValue,
|
|
47
|
+
defaultValue = 0,
|
|
48
48
|
helperText = '',
|
|
49
49
|
hideLabel = false,
|
|
50
50
|
hideSteppers,
|
|
@@ -61,6 +61,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
61
61
|
onKeyUp,
|
|
62
62
|
readOnly,
|
|
63
63
|
size = 'md',
|
|
64
|
+
slug,
|
|
64
65
|
step = 1,
|
|
65
66
|
translateWithId: t = id => defaultTranslations[id],
|
|
66
67
|
warn = false,
|
|
@@ -112,7 +113,8 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
112
113
|
});
|
|
113
114
|
const [incrementNumLabel, decrementNumLabel] = [t('increment.number'), t('decrement.number')];
|
|
114
115
|
const wrapperClasses = cx__default["default"](`${prefix}--number__input-wrapper`, {
|
|
115
|
-
[`${prefix}--number__input-wrapper--warning`]: normalizedProps.warn
|
|
116
|
+
[`${prefix}--number__input-wrapper--warning`]: normalizedProps.warn,
|
|
117
|
+
[`${prefix}--number__input-wrapper--slug`]: slug
|
|
116
118
|
});
|
|
117
119
|
const iconClasses = cx__default["default"]({
|
|
118
120
|
[`${prefix}--number__invalid`]: normalizedProps.invalid || normalizedProps.warn,
|
|
@@ -177,6 +179,25 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
}
|
|
182
|
+
|
|
183
|
+
// Slug is always size `mini`
|
|
184
|
+
let normalizedSlug;
|
|
185
|
+
if (slug) {
|
|
186
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
187
|
+
size: 'mini'
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Need to update the internal value when the revert button is clicked
|
|
192
|
+
let isRevertActive;
|
|
193
|
+
if (slug) {
|
|
194
|
+
isRevertActive = normalizedSlug.props.revertActive;
|
|
195
|
+
}
|
|
196
|
+
React.useEffect(() => {
|
|
197
|
+
if (!isRevertActive && slug && defaultValue) {
|
|
198
|
+
setValue(defaultValue);
|
|
199
|
+
}
|
|
200
|
+
}, [defaultValue, isRevertActive, slug]);
|
|
180
201
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
181
202
|
className: outerElementClasses,
|
|
182
203
|
onFocus: isFluid ? handleFocus : undefined,
|
|
@@ -224,7 +245,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
224
245
|
step: step,
|
|
225
246
|
type: "number",
|
|
226
247
|
value: value
|
|
227
|
-
})), Icon ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
248
|
+
})), normalizedSlug, Icon ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
228
249
|
className: iconClasses
|
|
229
250
|
}) : null, !hideSteppers && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
230
251
|
className: `${prefix}--number__controls`
|
|
@@ -348,6 +369,10 @@ NumberInput.propTypes = {
|
|
|
348
369
|
* Specify the size of the Number Input.
|
|
349
370
|
*/
|
|
350
371
|
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
372
|
+
/**
|
|
373
|
+
* Provide a `Slug` component to be rendered inside the `NumberInput` component
|
|
374
|
+
*/
|
|
375
|
+
slug: PropTypes__default["default"].node,
|
|
351
376
|
/**
|
|
352
377
|
* Specify how much the values should increase/decrease upon clicking on up/down button
|
|
353
378
|
*/
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import { ReactNodeLike } from 'prop-types';
|
|
7
8
|
import React, { ChangeEventHandler, ComponentPropsWithRef, ReactNode } from 'react';
|
|
8
9
|
type ExcludedAttributes = 'size';
|
|
9
10
|
interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
|
|
@@ -76,6 +77,10 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
76
77
|
* Specify the size of the Select Input.
|
|
77
78
|
*/
|
|
78
79
|
size?: 'sm' | 'md' | 'lg';
|
|
80
|
+
/**
|
|
81
|
+
* Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
82
|
+
*/
|
|
83
|
+
slug?: ReactNodeLike;
|
|
79
84
|
/**
|
|
80
85
|
* Specify whether the control is currently in warning state
|
|
81
86
|
*/
|
|
@@ -85,5 +90,5 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
85
90
|
*/
|
|
86
91
|
warnText?: ReactNode;
|
|
87
92
|
}
|
|
88
|
-
declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "disabled" | "form" | "slot" | "style" | "title" | "className" | "size" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onAnimationEnd" | "onKeyDown" | "tabIndex" | "color" | "lang" | "name" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "inline" | "readOnly" | "required" | "light" | "invalid" | "labelText" | "helperText" | "invalidText" | "hideLabel" | "warn" | "warnText" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
|
|
93
|
+
declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "disabled" | "form" | "slot" | "style" | "title" | "className" | "size" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onAnimationEnd" | "onKeyDown" | "tabIndex" | "color" | "lang" | "name" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "inline" | "readOnly" | "required" | "light" | "invalid" | "labelText" | "helperText" | "invalidText" | "hideLabel" | "warn" | "warnText" | "slug" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
|
|
89
94
|
export default Select;
|
|
@@ -51,6 +51,7 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
51
51
|
warn = false,
|
|
52
52
|
warnText,
|
|
53
53
|
onChange,
|
|
54
|
+
slug,
|
|
54
55
|
...other
|
|
55
56
|
} = _ref;
|
|
56
57
|
const prefix = usePrefix.usePrefix();
|
|
@@ -71,7 +72,8 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
71
72
|
[`${prefix}--select--readonly`]: readOnly,
|
|
72
73
|
[`${prefix}--select--warning`]: warn,
|
|
73
74
|
[`${prefix}--select--fluid--invalid`]: isFluid && invalid,
|
|
74
|
-
[`${prefix}--select--fluid--focus`]: isFluid && isFocused
|
|
75
|
+
[`${prefix}--select--fluid--focus`]: isFluid && isFocused,
|
|
76
|
+
[`${prefix}--select--slug`]: slug
|
|
75
77
|
});
|
|
76
78
|
const labelClasses = cx__default["default"](`${prefix}--label`, {
|
|
77
79
|
[`${prefix}--visually-hidden`]: hideLabel,
|
|
@@ -133,6 +135,14 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
137
|
};
|
|
138
|
+
|
|
139
|
+
// Slug is always size `mini`
|
|
140
|
+
let normalizedSlug;
|
|
141
|
+
if (slug) {
|
|
142
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
143
|
+
size: 'mini'
|
|
144
|
+
});
|
|
145
|
+
}
|
|
136
146
|
const input = (() => {
|
|
137
147
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("select", _rollupPluginBabelHelpers["extends"]({}, other, ariaProps, {
|
|
138
148
|
id: id,
|
|
@@ -170,7 +180,7 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
170
180
|
"data-invalid": invalid || null,
|
|
171
181
|
onFocus: handleFocus,
|
|
172
182
|
onBlur: handleFocus
|
|
173
|
-
}, input, isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
183
|
+
}, input, normalizedSlug, isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
174
184
|
className: `${prefix}--select__divider`
|
|
175
185
|
}), isFluid && error ? error : null), !inline && !isFluid && error ? error : helper));
|
|
176
186
|
});
|
|
@@ -244,6 +254,10 @@ Select.propTypes = {
|
|
|
244
254
|
* Specify the size of the Select Input.
|
|
245
255
|
*/
|
|
246
256
|
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
257
|
+
/**
|
|
258
|
+
* Provide a `Slug` component to be rendered inside the `Select` component
|
|
259
|
+
*/
|
|
260
|
+
slug: PropTypes__default["default"].node,
|
|
247
261
|
/**
|
|
248
262
|
* Specify whether the control is currently in warning state
|
|
249
263
|
*/
|