@carbon/react 1.76.0-rc.0 → 1.77.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 +908 -873
- package/es/components/Button/Button.d.ts +9 -1
- package/es/components/Button/Button.js +8 -0
- package/es/components/CodeSnippet/CodeSnippet.d.ts +2 -2
- package/es/components/ComboBox/ComboBox.d.ts +2 -2
- package/es/components/ComboBox/ComboBox.js +36 -13
- package/es/components/ComboButton/index.js +1 -2
- package/es/components/ComposedModal/ComposedModal.js +1 -1
- package/es/components/ContentSwitcher/index.d.ts +0 -1
- package/es/components/ContextMenu/useContextMenu.d.ts +0 -1
- package/es/components/Copy/Copy.js +1 -1
- package/es/components/DataTable/DataTable.d.ts +12 -20
- package/es/components/DataTable/DataTable.js +1 -9
- package/es/components/DataTable/Table.js +1 -1
- package/es/components/DataTable/TableActionList.d.ts +1 -1
- package/es/components/DataTable/TableBody.js +1 -1
- package/es/components/DataTable/TableContext.d.ts +0 -1
- package/es/components/DataTable/TableHead.d.ts +1 -1
- package/es/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/es/components/DatePickerInput/DatePickerInput.js +1 -1
- package/es/components/Dropdown/Dropdown.js +1 -2
- package/es/components/FluidForm/FormContext.d.ts +0 -1
- package/es/components/FluidTextInput/FluidTextInput.d.ts +8 -0
- package/es/components/FluidTextInput/FluidTextInput.js +8 -0
- package/es/components/Grid/CSSGrid.js +1 -1
- package/es/components/Grid/Grid.js +1 -1
- package/es/components/Grid/GridTypes.d.ts +0 -1
- package/es/components/Heading/index.d.ts +1 -1
- package/es/components/IconButton/index.d.ts +17 -1
- package/es/components/IconButton/index.js +20 -1
- package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/es/components/InlineLoading/InlineLoading.d.ts +1 -1
- package/es/components/InlineLoading/InlineLoading.js +21 -7
- package/es/components/Menu/Menu.js +2 -2
- package/es/components/Menu/MenuContext.d.ts +1 -1
- package/es/components/MenuButton/index.d.ts +1 -1
- package/es/components/MenuButton/index.js +1 -2
- package/es/components/Modal/Modal.js +1 -1
- package/es/components/Modal/next/index.d.ts +175 -0
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +1 -2
- package/es/components/Popover/index.js +2 -3
- package/es/components/PrimaryButton/PrimaryButton.d.ts +1 -1
- package/es/components/RadioTile/RadioTile.d.ts +1 -1
- package/es/components/SecondaryButton/SecondaryButton.d.ts +1 -1
- package/es/components/Slider/Slider.d.ts +1 -1
- package/es/components/Slider/Slider.js +1 -1
- package/es/components/Slider/index.d.ts +0 -1
- package/es/components/Tabs/Tabs.d.ts +3 -3
- package/es/components/Tabs/Tabs.js +4 -4
- package/es/components/Tag/DismissibleTag.d.ts +2 -2
- package/es/components/Tag/OperationalTag.d.ts +1 -1
- package/es/components/Tag/SelectableTag.d.ts +2 -2
- package/es/components/Text/index.d.ts +2 -2
- package/es/components/TextArea/TextArea.js +2 -1
- package/es/components/TextInput/PasswordInput.d.ts +1 -1
- package/es/components/Theme/index.d.ts +1 -1
- package/es/components/Tile/Tile.d.ts +1 -1
- package/es/components/Tile/Tile.js +1 -1
- package/es/components/Toggletip/index.d.ts +3 -3
- package/es/components/Toggletip/index.js +5 -4
- package/es/components/Tooltip/Tooltip.d.ts +17 -1
- package/es/components/Tooltip/Tooltip.js +12 -2
- package/es/components/TreeView/TreeNode.d.ts +27 -19
- package/es/components/TreeView/TreeNode.js +100 -31
- package/es/components/TreeView/TreeView.js +1 -1
- package/es/components/UIShell/Content.d.ts +9 -9
- package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/es/components/UIShell/HeaderMenu.d.ts +69 -25
- package/es/components/UIShell/HeaderMenuButton.d.ts +69 -27
- package/es/components/UIShell/HeaderMenuItem.d.ts +4 -3
- package/es/components/UIShell/HeaderMenuItem.js +1 -1
- package/es/components/UIShell/HeaderName.js +1 -1
- package/es/components/UIShell/HeaderNavigation.d.ts +69 -25
- package/es/components/UIShell/Link.d.ts +14 -11
- package/es/components/UIShell/Link.js +5 -6
- package/es/components/UIShell/SideNav.js +3 -3
- package/es/components/UIShell/SideNavLink.js +1 -1
- package/es/components/UIShell/SideNavMenuItem.d.ts +51 -3
- package/es/components/UIShell/SideNavMenuItem.js +6 -6
- package/es/components/UIShell/SwitcherItem.d.ts +2 -2
- package/es/components/UIShell/SwitcherItem.js +1 -1
- package/es/internal/PolymorphicProps.d.ts +0 -1
- package/es/internal/Selection.d.ts +38 -0
- package/es/internal/Selection.js +26 -113
- package/es/node_modules/es-toolkit/dist/compat/function/debounce.mjs.js +55 -0
- package/es/node_modules/es-toolkit/dist/compat/function/throttle.mjs.js +23 -0
- package/es/node_modules/es-toolkit/dist/function/debounce.mjs.js +70 -0
- package/es/tools/wrapComponent.d.ts +1 -1
- package/lib/components/Button/Button.d.ts +9 -1
- package/lib/components/Button/Button.js +8 -0
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +2 -2
- package/lib/components/ComboBox/ComboBox.d.ts +2 -2
- package/lib/components/ComboBox/ComboBox.js +36 -13
- package/lib/components/ComboButton/index.js +1 -2
- package/lib/components/ComposedModal/ComposedModal.js +2 -2
- package/lib/components/ContentSwitcher/index.d.ts +0 -1
- package/lib/components/ContextMenu/useContextMenu.d.ts +0 -1
- package/lib/components/Copy/Copy.js +2 -2
- package/lib/components/DataTable/DataTable.d.ts +12 -20
- package/lib/components/DataTable/DataTable.js +1 -9
- package/lib/components/DataTable/Table.js +3 -3
- package/lib/components/DataTable/TableActionList.d.ts +1 -1
- package/lib/components/DataTable/TableBody.js +1 -1
- package/lib/components/DataTable/TableContext.d.ts +0 -1
- package/lib/components/DataTable/TableHead.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +1 -2
- package/lib/components/FluidForm/FormContext.d.ts +0 -1
- package/lib/components/FluidTextInput/FluidTextInput.d.ts +8 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +8 -0
- package/lib/components/Grid/CSSGrid.js +1 -1
- package/lib/components/Grid/Grid.js +1 -1
- package/lib/components/Grid/GridTypes.d.ts +0 -1
- package/lib/components/Heading/index.d.ts +1 -1
- package/lib/components/IconButton/index.d.ts +17 -1
- package/lib/components/IconButton/index.js +20 -1
- package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/lib/components/InlineLoading/InlineLoading.d.ts +1 -1
- package/lib/components/InlineLoading/InlineLoading.js +20 -6
- package/lib/components/Menu/Menu.js +2 -2
- package/lib/components/Menu/MenuContext.d.ts +1 -1
- package/lib/components/MenuButton/index.d.ts +1 -1
- package/lib/components/MenuButton/index.js +1 -2
- package/lib/components/Modal/Modal.js +2 -2
- package/lib/components/Modal/next/index.d.ts +175 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +1 -2
- package/lib/components/Popover/index.js +2 -3
- package/lib/components/PrimaryButton/PrimaryButton.d.ts +1 -1
- package/lib/components/RadioTile/RadioTile.d.ts +1 -1
- package/lib/components/SecondaryButton/SecondaryButton.d.ts +1 -1
- package/lib/components/Slider/Slider.d.ts +1 -1
- package/lib/components/Slider/Slider.js +2 -2
- package/lib/components/Slider/index.d.ts +0 -1
- package/lib/components/Tabs/Tabs.d.ts +3 -3
- package/lib/components/Tabs/Tabs.js +6 -6
- package/lib/components/Tag/DismissibleTag.d.ts +2 -2
- package/lib/components/Tag/OperationalTag.d.ts +1 -1
- package/lib/components/Tag/SelectableTag.d.ts +2 -2
- package/lib/components/Text/index.d.ts +2 -2
- package/lib/components/TextArea/TextArea.js +2 -1
- package/lib/components/TextInput/PasswordInput.d.ts +1 -1
- package/lib/components/Theme/index.d.ts +1 -1
- package/lib/components/Tile/Tile.d.ts +1 -1
- package/lib/components/Tile/Tile.js +1 -1
- package/lib/components/Toggletip/index.d.ts +3 -3
- package/lib/components/Toggletip/index.js +5 -4
- package/lib/components/Tooltip/Tooltip.d.ts +17 -1
- package/lib/components/Tooltip/Tooltip.js +12 -2
- package/lib/components/TreeView/TreeNode.d.ts +27 -19
- package/lib/components/TreeView/TreeNode.js +100 -31
- package/lib/components/TreeView/TreeView.js +1 -1
- package/lib/components/UIShell/Content.d.ts +9 -9
- package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/lib/components/UIShell/HeaderMenu.d.ts +69 -25
- package/lib/components/UIShell/HeaderMenuButton.d.ts +69 -27
- package/lib/components/UIShell/HeaderMenuItem.d.ts +4 -3
- package/lib/components/UIShell/HeaderMenuItem.js +1 -1
- package/lib/components/UIShell/HeaderName.js +1 -1
- package/lib/components/UIShell/HeaderNavigation.d.ts +69 -25
- package/lib/components/UIShell/Link.d.ts +14 -11
- package/lib/components/UIShell/Link.js +4 -4
- package/lib/components/UIShell/SideNav.js +3 -3
- package/lib/components/UIShell/SideNavLink.js +1 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +51 -3
- package/lib/components/UIShell/SideNavMenuItem.js +6 -6
- package/lib/components/UIShell/SwitcherItem.d.ts +2 -2
- package/lib/components/UIShell/SwitcherItem.js +1 -1
- package/lib/internal/PolymorphicProps.d.ts +0 -1
- package/lib/internal/Selection.d.ts +38 -0
- package/lib/internal/Selection.js +24 -114
- package/lib/node_modules/es-toolkit/dist/compat/function/debounce.mjs.js +59 -0
- package/lib/node_modules/es-toolkit/dist/compat/function/throttle.mjs.js +27 -0
- package/lib/node_modules/es-toolkit/dist/function/debounce.mjs.js +74 -0
- package/lib/tools/wrapComponent.d.ts +1 -1
- package/package.json +10 -9
- package/es/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +0 -896
- package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +0 -76
- package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +0 -139
- package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +0 -909
- package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +0 -80
- package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +0 -163
|
@@ -27,7 +27,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
27
27
|
/**
|
|
28
28
|
* Optionally specify an href for your Button to become an `<a>` element
|
|
29
29
|
*/
|
|
30
|
-
href?:
|
|
30
|
+
href?: React.AnchorHTMLAttributes<HTMLAnchorElement>['href'];
|
|
31
31
|
/**
|
|
32
32
|
* If specifying the `renderIcon` prop, provide a description for that icon that can
|
|
33
33
|
* be read by screen readers
|
|
@@ -45,6 +45,10 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
45
45
|
* Specify the kind of Button you want to create
|
|
46
46
|
*/
|
|
47
47
|
kind?: ButtonBaseProps['hasIconOnly'] extends true ? IconButtonKind : ButtonKind;
|
|
48
|
+
/**
|
|
49
|
+
* Optionally specify a `rel` when using an `<a>` element.
|
|
50
|
+
*/
|
|
51
|
+
rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
|
|
48
52
|
/**
|
|
49
53
|
* Optional prop to allow overriding the icon rendering.
|
|
50
54
|
* Can be a React component class
|
|
@@ -54,6 +58,10 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
54
58
|
* Specify the size of the button, from the following list of sizes:
|
|
55
59
|
*/
|
|
56
60
|
size?: ButtonSize;
|
|
61
|
+
/**
|
|
62
|
+
* Optionally specify a `target` when using an `<a>` element.
|
|
63
|
+
*/
|
|
64
|
+
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
57
65
|
/**
|
|
58
66
|
* Specify the alignment of the tooltip to the icon-only button.
|
|
59
67
|
* Can be one of: start, center, or end.
|
|
@@ -185,6 +185,10 @@ Button.propTypes = {
|
|
|
185
185
|
* leaves the button element
|
|
186
186
|
*/
|
|
187
187
|
onMouseLeave: PropTypes.func,
|
|
188
|
+
/**
|
|
189
|
+
* Optionally specify a `rel` when using an `<a>` element.
|
|
190
|
+
*/
|
|
191
|
+
rel: PropTypes.string,
|
|
188
192
|
/**
|
|
189
193
|
* Optional prop to allow overriding the icon rendering.
|
|
190
194
|
* Can be a React component class
|
|
@@ -202,6 +206,10 @@ Button.propTypes = {
|
|
|
202
206
|
* Optional prop to specify the tabIndex of the Button
|
|
203
207
|
*/
|
|
204
208
|
tabIndex: PropTypes.number,
|
|
209
|
+
/**
|
|
210
|
+
* Optionally specify a `target` when using an `<a>` element.
|
|
211
|
+
*/
|
|
212
|
+
target: PropTypes.string,
|
|
205
213
|
/**
|
|
206
214
|
* Specify the alignment of the tooltip to the icon-only button.
|
|
207
215
|
* Can be one of: start, center, or end.
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { PropsWithChildren } from 'react';
|
|
9
9
|
export type DeprecatedCodeSnippetAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
10
|
-
export type
|
|
11
|
-
export type CodeSnippetAlignment = DeprecatedCodeSnippetAlignment |
|
|
10
|
+
export type NewCodeSnippetAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
11
|
+
export type CodeSnippetAlignment = DeprecatedCodeSnippetAlignment | NewCodeSnippetAlignment;
|
|
12
12
|
export interface CodeSnippetProps {
|
|
13
13
|
/**
|
|
14
14
|
* Specify how the trigger should align with the tooltip
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
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.
|
|
@@ -184,7 +184,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
|
|
|
184
184
|
*/
|
|
185
185
|
titleText?: ReactNode;
|
|
186
186
|
/**
|
|
187
|
-
* **Experimental**: will enable
|
|
187
|
+
* **Experimental**: will enable autocomplete and typeahead for the input field
|
|
188
188
|
*/
|
|
189
189
|
typeahead?: boolean;
|
|
190
190
|
/**
|
|
@@ -22,8 +22,7 @@ import deprecate from '../../prop-types/deprecate.js';
|
|
|
22
22
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
23
23
|
import '../FluidForm/FluidForm.js';
|
|
24
24
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
25
|
-
import { useFloating, flip, autoUpdate } from '@floating-ui/react';
|
|
26
|
-
import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
|
|
25
|
+
import { useFloating, flip, hide, autoUpdate } from '@floating-ui/react';
|
|
27
26
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
28
27
|
import { Text } from '../Text/Text.js';
|
|
29
28
|
import { match } from '../../internal/keyboard/match.js';
|
|
@@ -68,21 +67,24 @@ const autocompleteCustomFilter = _ref => {
|
|
|
68
67
|
const getInputValue = _ref2 => {
|
|
69
68
|
let {
|
|
70
69
|
initialSelectedItem,
|
|
71
|
-
inputValue,
|
|
72
70
|
itemToString,
|
|
73
71
|
selectedItem,
|
|
74
72
|
prevSelectedItem
|
|
75
73
|
} = _ref2;
|
|
76
|
-
if
|
|
74
|
+
// If there's a current selection (even if it's an object or string), use it.
|
|
75
|
+
if (selectedItem !== null && typeof selectedItem !== 'undefined') {
|
|
77
76
|
return itemToString(selectedItem);
|
|
78
77
|
}
|
|
79
|
-
|
|
78
|
+
|
|
79
|
+
// On the very first render (when no previous value exists), use
|
|
80
|
+
// `initialSelectedItem`.
|
|
81
|
+
if (typeof prevSelectedItem === 'undefined' && initialSelectedItem !== null && typeof initialSelectedItem !== 'undefined') {
|
|
80
82
|
return itemToString(initialSelectedItem);
|
|
81
83
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return
|
|
84
|
+
|
|
85
|
+
// Otherwise (i.e., after the user has cleared the selection), return an empty
|
|
86
|
+
// string.
|
|
87
|
+
return '';
|
|
86
88
|
};
|
|
87
89
|
const findHighlightedIndex = (_ref3, inputValue) => {
|
|
88
90
|
let {
|
|
@@ -179,7 +181,6 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
179
181
|
}, [enableFloatingStyles, floatingStyles, refs.floating, parentWidth]);
|
|
180
182
|
const [inputValue, setInputValue] = useState(getInputValue({
|
|
181
183
|
initialSelectedItem,
|
|
182
|
-
inputValue: '',
|
|
183
184
|
itemToString,
|
|
184
185
|
selectedItem: selectedItemProp
|
|
185
186
|
}));
|
|
@@ -222,7 +223,6 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
222
223
|
if (prevSelectedItemProp.current !== selectedItemProp) {
|
|
223
224
|
const currentInputValue = getInputValue({
|
|
224
225
|
initialSelectedItem,
|
|
225
|
-
inputValue,
|
|
226
226
|
itemToString,
|
|
227
227
|
selectedItem: selectedItemProp,
|
|
228
228
|
prevSelectedItem: prevSelectedItemProp.current
|
|
@@ -301,6 +301,13 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
301
301
|
return changes;
|
|
302
302
|
}
|
|
303
303
|
case InputKeyDownEnter:
|
|
304
|
+
if (highlightedIndex === -1 && !allowCustomValue && state.selectedItem) {
|
|
305
|
+
return {
|
|
306
|
+
...changes,
|
|
307
|
+
selectedItem: null,
|
|
308
|
+
inputValue: state.inputValue
|
|
309
|
+
};
|
|
310
|
+
}
|
|
304
311
|
if (allowCustomValue) {
|
|
305
312
|
setInputValue(inputValue);
|
|
306
313
|
setHighlightedIndex(changes.selectedItem);
|
|
@@ -321,6 +328,12 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
321
328
|
}
|
|
322
329
|
case FunctionToggleMenu:
|
|
323
330
|
case ToggleButtonClick:
|
|
331
|
+
if (!changes.isOpen && state.inputValue && highlightedIndex === -1 && !allowCustomValue) {
|
|
332
|
+
return {
|
|
333
|
+
...changes,
|
|
334
|
+
inputValue: '' // Clear the input
|
|
335
|
+
};
|
|
336
|
+
}
|
|
324
337
|
if (changes.isOpen && !changes.selectedItem) {
|
|
325
338
|
return {
|
|
326
339
|
...changes
|
|
@@ -462,7 +475,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
462
475
|
selectedItem: newSelectedItem
|
|
463
476
|
});
|
|
464
477
|
}
|
|
465
|
-
if (type === useCombobox.stateChangeTypes.FunctionSelectItem || type === useCombobox.stateChangeTypes.InputKeyDownEnter)
|
|
478
|
+
if ((type === useCombobox.stateChangeTypes.FunctionSelectItem || type === useCombobox.stateChangeTypes.InputKeyDownEnter) && !isEqual(selectedItemProp, newSelectedItem) // Only fire if there's an actual change
|
|
479
|
+
) {
|
|
466
480
|
onChange({
|
|
467
481
|
selectedItem: newSelectedItem
|
|
468
482
|
});
|
|
@@ -512,6 +526,9 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
512
526
|
});
|
|
513
527
|
const handleFocus = evt => {
|
|
514
528
|
setIsFocused(evt.type === 'focus');
|
|
529
|
+
if (!inputRef.current?.value && evt.type === 'blur') {
|
|
530
|
+
selectItem(null);
|
|
531
|
+
}
|
|
515
532
|
};
|
|
516
533
|
const readOnlyEventHandlers = readOnly ? {
|
|
517
534
|
onKeyDown: evt => {
|
|
@@ -634,6 +651,12 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
634
651
|
toggleMenu();
|
|
635
652
|
}
|
|
636
653
|
}
|
|
654
|
+
if (!inputValue && highlightedIndex == -1 && event.key == 'Enter') {
|
|
655
|
+
if (!isOpen) toggleMenu();
|
|
656
|
+
selectItem(null);
|
|
657
|
+
event.preventDownshiftDefault = true;
|
|
658
|
+
if (event.currentTarget.ariaExpanded === 'false') openMenu();
|
|
659
|
+
}
|
|
637
660
|
if (typeahead && event.key === 'Tab') {
|
|
638
661
|
// event.preventDefault();
|
|
639
662
|
const matchingItem = items.find(item => itemToString(item).toLowerCase().startsWith(inputValue.toLowerCase()));
|
|
@@ -860,7 +883,7 @@ ComboBox.propTypes = {
|
|
|
860
883
|
*/
|
|
861
884
|
translateWithId: PropTypes.func,
|
|
862
885
|
/**
|
|
863
|
-
* **Experimental**: will enable
|
|
886
|
+
* **Experimental**: will enable autocomplete and typeahead for the input field
|
|
864
887
|
*/
|
|
865
888
|
typeahead: PropTypes.bool,
|
|
866
889
|
/**
|
|
@@ -18,8 +18,7 @@ import '../Menu/MenuItem.js';
|
|
|
18
18
|
import { useAttachedMenu } from '../../internal/useAttachedMenu.js';
|
|
19
19
|
import { useId } from '../../internal/useId.js';
|
|
20
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
21
|
-
import { flip, size, useFloating, autoUpdate } from '@floating-ui/react';
|
|
22
|
-
import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
|
|
21
|
+
import { flip, hide, size, useFloating, autoUpdate } from '@floating-ui/react';
|
|
23
22
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
24
23
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
25
24
|
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
@@ -12,7 +12,6 @@ import PropTypes from 'prop-types';
|
|
|
12
12
|
import { Layer } from '../Layer/index.js';
|
|
13
13
|
import { ModalHeader } from './ModalHeader.js';
|
|
14
14
|
import { ModalFooter } from './ModalFooter.js';
|
|
15
|
-
import { debounce } from 'es-toolkit/compat';
|
|
16
15
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
17
16
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
18
17
|
import cx from 'classnames';
|
|
@@ -23,6 +22,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
23
22
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
24
23
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
25
24
|
import deprecate from '../../prop-types/deprecate.js';
|
|
25
|
+
import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
|
|
26
26
|
import { match } from '../../internal/keyboard/match.js';
|
|
27
27
|
import { Escape, Tab } from '../../internal/keyboard/keys.js';
|
|
28
28
|
|
|
@@ -4,7 +4,6 @@
|
|
|
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
|
-
/// <reference types="react" />
|
|
8
7
|
import { ContentSwitcherProps } from './ContentSwitcher';
|
|
9
8
|
declare const ContentSwitcher: import("react").FunctionComponent<ContentSwitcherProps>;
|
|
10
9
|
export default ContentSwitcher;
|
|
@@ -4,7 +4,6 @@
|
|
|
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
|
-
/// <reference types="react" />
|
|
8
7
|
type TriggerType = Element | Document | Window | React.RefObject<Element>;
|
|
9
8
|
export interface ContextMenuProps {
|
|
10
9
|
open: boolean;
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default, { useState, useCallback, useEffect } from 'react';
|
|
11
|
-
import { debounce } from 'es-toolkit/compat';
|
|
12
11
|
import cx from 'classnames';
|
|
13
12
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
14
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
14
|
import { IconButton } from '../IconButton/index.js';
|
|
16
15
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
16
|
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
17
|
+
import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
|
|
18
18
|
|
|
19
19
|
const propMappingFunction = deprecatedValue => {
|
|
20
20
|
const mapping = {
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import type { MouseEvent } from 'react';
|
|
10
9
|
import type { DataTableSortState } from './state/sortStates';
|
|
11
10
|
import Table from './Table';
|
|
12
11
|
import TableActionList from './TableActionList';
|
|
@@ -100,7 +99,6 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
100
99
|
onExpand?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
101
100
|
[key: string]: unknown;
|
|
102
101
|
}) => {
|
|
103
|
-
ariaLabel: string;
|
|
104
102
|
['aria-label']: string;
|
|
105
103
|
isExpanded: boolean;
|
|
106
104
|
onExpand: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -111,7 +109,6 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
111
109
|
row: DataTableRow<ColTypes>;
|
|
112
110
|
[key: string]: unknown;
|
|
113
111
|
}) => {
|
|
114
|
-
ariaLabel: string;
|
|
115
112
|
['aria-label']: string;
|
|
116
113
|
disabled: boolean | undefined;
|
|
117
114
|
isExpanded?: boolean;
|
|
@@ -132,7 +129,6 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
132
129
|
row: DataTableRow<ColTypes>;
|
|
133
130
|
[key: string]: unknown;
|
|
134
131
|
}) => {
|
|
135
|
-
ariaLabel: string;
|
|
136
132
|
'aria-label': string;
|
|
137
133
|
checked?: boolean | undefined;
|
|
138
134
|
disabled?: boolean | undefined;
|
|
@@ -349,13 +345,13 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
349
345
|
* @returns {object}
|
|
350
346
|
*/
|
|
351
347
|
getHeaderProps: ({ header, onClick, isSortable, ...rest }: {
|
|
352
|
-
[key: string]: unknown;
|
|
353
348
|
header: DataTableHeader;
|
|
354
|
-
onClick?: (
|
|
349
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>, sortState: {
|
|
355
350
|
sortHeaderKey: string;
|
|
356
351
|
sortDirection: DataTableSortState;
|
|
357
|
-
}) => void
|
|
358
|
-
isSortable?: boolean
|
|
352
|
+
}) => void;
|
|
353
|
+
isSortable?: boolean;
|
|
354
|
+
[key: string]: unknown;
|
|
359
355
|
}) => {
|
|
360
356
|
key: string;
|
|
361
357
|
sortDirection: DataTableSortState;
|
|
@@ -375,12 +371,11 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
375
371
|
*/
|
|
376
372
|
getExpandHeaderProps: ({ onClick, onExpand, ...rest }?: {
|
|
377
373
|
[key: string]: unknown;
|
|
378
|
-
onClick?: (
|
|
374
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>, expandState: {
|
|
379
375
|
isExpanded: boolean;
|
|
380
|
-
}) => void
|
|
381
|
-
onExpand?: (
|
|
376
|
+
}) => void;
|
|
377
|
+
onExpand?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
382
378
|
}) => {
|
|
383
|
-
ariaLabel: any;
|
|
384
379
|
'aria-label': any;
|
|
385
380
|
'aria-controls': string;
|
|
386
381
|
isExpanded: boolean;
|
|
@@ -411,14 +406,13 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
411
406
|
* @returns {object}
|
|
412
407
|
*/
|
|
413
408
|
getRowProps: ({ row, onClick, ...rest }: {
|
|
414
|
-
|
|
415
|
-
onClick?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
409
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
416
410
|
row: DataTableRow<ColTypes>;
|
|
411
|
+
[key: string]: unknown;
|
|
417
412
|
}) => {
|
|
418
413
|
key: string;
|
|
419
414
|
onExpand: any;
|
|
420
415
|
isExpanded: boolean | undefined;
|
|
421
|
-
ariaLabel: any;
|
|
422
416
|
'aria-label': any;
|
|
423
417
|
'aria-controls': string;
|
|
424
418
|
isSelected: boolean | undefined;
|
|
@@ -432,8 +426,8 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
432
426
|
* @returns {object}
|
|
433
427
|
*/
|
|
434
428
|
getExpandedRowProps: ({ row, ...rest }: {
|
|
435
|
-
[key: string]: unknown;
|
|
436
429
|
row: DataTableRow<ColTypes>;
|
|
430
|
+
[key: string]: unknown;
|
|
437
431
|
}) => {
|
|
438
432
|
id: string;
|
|
439
433
|
};
|
|
@@ -449,19 +443,17 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
449
443
|
*/
|
|
450
444
|
getSelectionProps: ({ onClick, row, ...rest }?: {
|
|
451
445
|
[key: string]: unknown;
|
|
452
|
-
onClick?: (
|
|
446
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
453
447
|
row: DataTableRow<ColTypes>;
|
|
454
448
|
}) => {
|
|
455
449
|
checked: boolean | undefined;
|
|
456
450
|
onSelect: any;
|
|
457
451
|
id: string;
|
|
458
452
|
name: string;
|
|
459
|
-
ariaLabel: any;
|
|
460
453
|
'aria-label': any;
|
|
461
454
|
disabled: boolean | undefined;
|
|
462
455
|
radio: boolean | undefined;
|
|
463
456
|
} | {
|
|
464
|
-
ariaLabel: any;
|
|
465
457
|
'aria-label': any;
|
|
466
458
|
checked: boolean;
|
|
467
459
|
id: string;
|
|
@@ -470,8 +462,8 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
470
462
|
onSelect: any;
|
|
471
463
|
};
|
|
472
464
|
getToolbarProps: (props?: {}) => {
|
|
465
|
+
size: "sm" | undefined;
|
|
473
466
|
[key: string]: unknown;
|
|
474
|
-
size: 'sm' | undefined;
|
|
475
467
|
};
|
|
476
468
|
getBatchActionProps: (props?: {}) => {
|
|
477
469
|
shouldShowBatchActions: boolean;
|
|
@@ -150,8 +150,6 @@ class DataTable extends React__default.Component {
|
|
|
150
150
|
const translationKey = isExpanded ? translationKeys.collapseAll : translationKeys.expandAll;
|
|
151
151
|
return {
|
|
152
152
|
...rest,
|
|
153
|
-
ariaLabel: t(translationKey),
|
|
154
|
-
// TODO: remove in v12
|
|
155
153
|
'aria-label': t(translationKey),
|
|
156
154
|
// Provide a string of all the expanded row id's, separated by a space.
|
|
157
155
|
'aria-controls': rowIds.map(id => `expanded-row-${id}`).join(' '),
|
|
@@ -208,8 +206,6 @@ class DataTable extends React__default.Component {
|
|
|
208
206
|
// handler
|
|
209
207
|
onExpand: composeEventHandlers([this.handleOnExpandRow(row.id), onClick]),
|
|
210
208
|
isExpanded: row.isExpanded,
|
|
211
|
-
ariaLabel: t(translationKey),
|
|
212
|
-
// TODO remove in v12
|
|
213
209
|
'aria-label': t(translationKey),
|
|
214
210
|
'aria-controls': `expanded-row-${row.id}`,
|
|
215
211
|
isSelected: row.isSelected,
|
|
@@ -262,8 +258,6 @@ class DataTable extends React__default.Component {
|
|
|
262
258
|
onSelect: composeEventHandlers([_this.handleOnSelectRow(row.id), onClick]),
|
|
263
259
|
id: `${_this.getTablePrefix()}__select-row-${row.id}`,
|
|
264
260
|
name: `select-row-${_this.instanceId}`,
|
|
265
|
-
ariaLabel: t(translationKey),
|
|
266
|
-
// TODO remove in v12
|
|
267
261
|
'aria-label': t(translationKey),
|
|
268
262
|
disabled: row.disabled,
|
|
269
263
|
radio: _this.props.radio
|
|
@@ -279,13 +273,11 @@ class DataTable extends React__default.Component {
|
|
|
279
273
|
const translationKey = checked || indeterminate ? translationKeys.unselectAll : translationKeys.selectAll;
|
|
280
274
|
return {
|
|
281
275
|
...rest,
|
|
282
|
-
ariaLabel: t(translationKey),
|
|
283
|
-
// TODO remove in v12
|
|
284
276
|
'aria-label': t(translationKey),
|
|
285
277
|
checked,
|
|
286
278
|
id: `${_this.getTablePrefix()}__select-all`,
|
|
287
279
|
indeterminate,
|
|
288
|
-
name:
|
|
280
|
+
name: `select-all-${_this.instanceId}`,
|
|
289
281
|
onSelect: composeEventHandlers([_this.handleSelectAll, onClick])
|
|
290
282
|
};
|
|
291
283
|
});
|
|
@@ -9,11 +9,11 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import React__default, { useContext, useState, useRef, useCallback } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
-
import { debounce } from 'es-toolkit/compat';
|
|
13
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
13
|
import { TableContext } from './TableContext.js';
|
|
15
14
|
import { useWindowEvent } from '../../internal/useEvent.js';
|
|
16
15
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
16
|
+
import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
|
|
17
17
|
|
|
18
18
|
const isElementWrappingContent = (element, context) => {
|
|
19
19
|
if (element.children.length > 0) {
|
|
@@ -4,5 +4,5 @@
|
|
|
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
|
-
declare const TableActionList: (props: import("../../types/common").ReactAttr<"div">) =>
|
|
7
|
+
declare const TableActionList: (props: import("../../types/common").ReactAttr<"div">) => React.ReactElement;
|
|
8
8
|
export default TableActionList;
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { ThHTMLAttributes } from 'react';
|
|
8
8
|
export type TableHeadProps = ThHTMLAttributes<HTMLTableSectionElement>;
|
|
9
|
-
declare const TableHead: (props: import("../../types/common").ReactAttr<"thead">) =>
|
|
9
|
+
declare const TableHead: (props: import("../../types/common").ReactAttr<"thead">) => React.ReactElement;
|
|
10
10
|
export default TableHead;
|
|
@@ -4,5 +4,5 @@
|
|
|
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
|
-
declare const TableToolbarContent: (props: import("../../types/common").ReactAttr<"div">) =>
|
|
7
|
+
declare const TableToolbarContent: (props: import("../../types/common").ReactAttr<"div">) => React.ReactElement;
|
|
8
8
|
export default TableToolbarContent;
|
|
@@ -81,7 +81,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
|
81
81
|
const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
|
|
82
82
|
|
|
83
83
|
// The date should only be set if both dates are valid dates, and they don't match.
|
|
84
|
-
// When they don't match, this
|
|
84
|
+
// When they don't match, this indicates that the date selected in the calendar is stale,
|
|
85
85
|
// and the current value in the input should be set for the calendar to update.
|
|
86
86
|
if (selectedToDate && currentValueToDate && selectedToDate !== currentValueToDate) {
|
|
87
87
|
// Update the calendar with the value of the `to` date input
|
|
@@ -89,7 +89,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
const isValidDate = date => date?.toString() !== 'Invalid Date';
|
|
92
|
-
// save end date in calendar
|
|
92
|
+
// save end date in calendar immediately after it's been written down
|
|
93
93
|
if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
|
|
94
94
|
if (isValidDate(parseDateWithFormat(inputTo.value))) {
|
|
95
95
|
fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
|
|
@@ -84,7 +84,7 @@ const DatePickerInput = /*#__PURE__*/React__default.forwardRef(function DatePick
|
|
|
84
84
|
[`${prefix}--date-picker--fluid--invalid`]: isFluid && invalid,
|
|
85
85
|
[`${prefix}--date-picker--fluid--warn`]: isFluid && warn
|
|
86
86
|
});
|
|
87
|
-
const datePickerInputHelperId = !helperText ? undefined : `
|
|
87
|
+
const datePickerInputHelperId = !helperText ? undefined : `datepicker-input-helper-text-${datePickerInputInstanceId}`;
|
|
88
88
|
const inputProps = {
|
|
89
89
|
...rest,
|
|
90
90
|
...datePickerInputProps,
|
|
@@ -18,8 +18,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
18
18
|
import '../FluidForm/FluidForm.js';
|
|
19
19
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
20
20
|
import { useId } from '../../internal/useId.js';
|
|
21
|
-
import { useFloating, size, flip, autoUpdate } from '@floating-ui/react';
|
|
22
|
-
import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
|
|
21
|
+
import { useFloating, size, flip, hide, autoUpdate } from '@floating-ui/react';
|
|
23
22
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
24
23
|
import { ListBoxSize, ListBoxType } from '../ListBox/ListBoxPropTypes.js';
|
|
25
24
|
|
|
@@ -34,6 +34,14 @@ export interface FluidTextInputProps {
|
|
|
34
34
|
* Specify whether the control is a password input
|
|
35
35
|
*/
|
|
36
36
|
isPassword?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Max character count allowed for the textInput. This is needed in order for enableCounter to display
|
|
39
|
+
*/
|
|
40
|
+
maxCount?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Specify whether to display the character counter
|
|
43
|
+
*/
|
|
44
|
+
enableCounter?: boolean;
|
|
37
45
|
/**
|
|
38
46
|
* Provide the text that will be read by a screen reader when visiting this
|
|
39
47
|
* control
|
|
@@ -67,6 +67,14 @@ FluidTextInput.propTypes = {
|
|
|
67
67
|
* Specify whether the control is a password input
|
|
68
68
|
*/
|
|
69
69
|
isPassword: PropTypes.bool,
|
|
70
|
+
/**
|
|
71
|
+
* Max character count allowed for the textInput. This is needed in order for enableCounter to display
|
|
72
|
+
*/
|
|
73
|
+
maxCount: PropTypes.number,
|
|
74
|
+
/**
|
|
75
|
+
* Specify whether to display the character counter
|
|
76
|
+
*/
|
|
77
|
+
enableCounter: PropTypes.bool,
|
|
70
78
|
/**
|
|
71
79
|
* Provide the text that will be read by a screen reader when visiting this
|
|
72
80
|
* control
|
|
@@ -4,7 +4,6 @@
|
|
|
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
|
-
/// <reference types="react" />
|
|
8
7
|
import { PolymorphicProps } from '../../types/common';
|
|
9
8
|
export interface GridBaseProps {
|
|
10
9
|
/**
|
|
@@ -11,6 +11,6 @@ type SectionBaseProps = {
|
|
|
11
11
|
level?: HeadingLevel;
|
|
12
12
|
};
|
|
13
13
|
export type SectionProps<E extends ElementType> = PolymorphicProps<E, SectionBaseProps>;
|
|
14
|
-
export declare const Section: React.ForwardRefExoticComponent<Omit<SectionProps<React.ElementType
|
|
14
|
+
export declare const Section: React.ForwardRefExoticComponent<Omit<SectionProps<React.ElementType>, "ref"> & React.RefAttributes<unknown>>;
|
|
15
15
|
export declare const Heading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
16
16
|
export {};
|