@carbon/react 1.90.0-rc.0 → 1.91.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 +923 -964
- package/es/components/AILabel/index.js +8 -6
- package/es/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/es/components/Button/Button.js +3 -0
- package/es/components/ChatButton/ChatButton.js +1 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +21 -2
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +1 -1
- package/es/components/ComboBox/ComboBox.js +18 -13
- package/es/components/ComboButton/index.js +2 -1
- package/es/components/ComposedModal/ComposedModal.js +5 -2
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/Copy/Copy.js +1 -1
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.js +1 -1
- package/es/components/DataTable/DataTable.d.ts +60 -15
- package/es/components/DataTable/DataTable.js +119 -178
- package/es/components/DataTable/Table.d.ts +2 -2
- package/es/components/DataTable/Table.js +4 -4
- package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/es/components/DataTable/TableExpandHeader.js +6 -2
- package/es/components/DataTable/TableExpandRow.js +1 -0
- package/es/components/DataTable/TableHeader.js +2 -0
- package/es/components/DataTable/TableRow.js +5 -0
- package/es/components/DataTable/TableSlugRow.js +1 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -0
- package/es/components/DataTable/state/sorting.d.ts +3 -1
- package/es/components/DataTable/state/sorting.js +2 -0
- package/es/components/DataTable/tools/sorting.js +1 -0
- package/es/components/DatePicker/DatePicker.d.ts +0 -12
- package/es/components/DatePicker/DatePicker.js +17 -6
- package/es/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/es/components/DatePicker/plugins/rangePlugin.js +18 -14
- package/es/components/DatePickerInput/DatePickerInput.js +6 -0
- package/es/components/Dialog/Dialog.js +10 -2
- package/es/components/Dropdown/Dropdown.js +17 -16
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
- package/es/components/FeatureFlags/index.js +1 -0
- package/es/components/FileUploader/FileUploader.js +9 -2
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +3 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
- package/es/components/FluidNumberInput/FluidNumberInput.js +3 -2
- package/es/components/FluidSearch/FluidSearch.js +3 -2
- package/es/components/FluidSelect/FluidSelect.js +3 -2
- package/es/components/FluidTextInput/FluidTextInput.js +3 -2
- package/es/components/FluidTimePicker/FluidTimePicker.js +11 -4
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
- package/es/components/Grid/CSSGrid.js +5 -0
- package/es/components/Grid/Column.js +3 -0
- package/es/components/Grid/ColumnHang.js +1 -0
- package/es/components/Grid/FlexGrid.js +1 -0
- package/es/components/Grid/Row.js +1 -0
- package/es/components/Heading/index.js +3 -1
- package/es/components/IconButton/index.js +5 -3
- package/es/components/IconIndicator/index.js +4 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +3 -2
- package/es/components/Layout/index.js +6 -4
- package/es/components/LayoutDirection/LayoutDirection.js +2 -0
- package/es/components/Link/Link.js +3 -0
- package/es/components/ListBox/ListBoxMenuItem.js +4 -1
- package/es/components/ListBox/next/ListBoxTrigger.js +3 -2
- package/es/components/Menu/Menu.js +6 -9
- package/es/components/Menu/MenuContext.js +1 -0
- package/es/components/Menu/MenuItem.d.ts +1 -1
- package/es/components/Menu/MenuItem.js +10 -18
- package/es/components/MenuButton/index.js +7 -2
- package/es/components/Modal/Modal.js +4 -1
- package/es/components/ModalWrapper/ModalWrapper.js +2 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +25 -6
- package/es/components/MultiSelect/MultiSelect.js +22 -17
- package/es/components/Notification/Notification.d.ts +6 -6
- package/es/components/Notification/Notification.js +7 -7
- package/es/components/NumberInput/NumberInput.js +7 -1
- package/es/components/OverflowMenu/OverflowMenu.js +3 -1
- package/es/components/OverflowMenu/next/index.js +4 -3
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
- package/es/components/PageHeader/PageHeader.d.ts +3 -3
- package/es/components/PageHeader/PageHeader.js +22 -8
- package/es/components/Pagination/Pagination.js +6 -2
- package/es/components/PaginationNav/PaginationNav.js +2 -5
- package/es/components/Popover/index.js +15 -5
- package/es/components/ProgressBar/ProgressBar.js +4 -2
- package/es/components/RadioTile/RadioTile.js +2 -2
- package/es/components/Search/Search.d.ts +4 -2
- package/es/components/Search/Search.js +7 -6
- package/es/components/Select/Select.js +2 -3
- package/es/components/ShapeIndicator/index.js +4 -2
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
- package/es/components/SkeletonText/SkeletonText.js +0 -2
- package/es/components/Slider/Slider.d.ts +144 -188
- package/es/components/Slider/Slider.js +798 -726
- package/es/components/Slider/index.d.ts +2 -2
- package/es/components/Stack/HStack.js +1 -0
- package/es/components/Stack/Stack.js +6 -9
- package/es/components/Stack/VStack.js +1 -0
- package/es/components/StructuredList/StructuredList.js +3 -0
- package/es/components/Switch/Switch.js +1 -1
- package/es/components/Tabs/Tabs.d.ts +4 -0
- package/es/components/Tabs/Tabs.js +28 -17
- package/es/components/Tag/DismissibleTag.js +2 -0
- package/es/components/Tag/OperationalTag.js +2 -0
- package/es/components/Tag/SelectableTag.js +2 -0
- package/es/components/Tag/Tag.js +4 -0
- package/es/components/Tag/isEllipsisActive.js +1 -0
- package/es/components/Text/Text.js +1 -0
- package/es/components/TextArea/TextArea.js +13 -6
- package/es/components/TextInput/ControlledPasswordInput.js +4 -6
- package/es/components/TextInput/PasswordInput.js +9 -4
- package/es/components/TextInput/TextInput.js +6 -4
- package/es/components/TextInput/util.d.ts +17 -5
- package/es/components/TextInput/util.js +2 -7
- package/es/components/Theme/index.js +8 -3
- package/es/components/Tile/Tile.js +14 -17
- package/es/components/TimePicker/TimePicker.js +1 -0
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/Toggletip/index.js +4 -0
- package/es/components/Tooltip/DefinitionTooltip.js +1 -0
- package/es/components/Tooltip/Tooltip.js +30 -23
- package/es/components/TreeView/TreeNode.js +13 -5
- package/es/components/TreeView/TreeView.js +7 -0
- package/es/components/UIShell/HeaderContainer.js +3 -1
- package/es/components/UIShell/HeaderGlobalAction.js +2 -2
- package/es/components/UIShell/HeaderMenu.js +3 -3
- package/es/components/UIShell/HeaderPanel.d.ts +1 -1
- package/es/components/UIShell/HeaderPanel.js +2 -2
- package/es/components/UIShell/Link.js +2 -0
- package/es/components/UIShell/SideNavItems.js +1 -0
- package/es/components/UIShell/SideNavMenu.js +2 -2
- package/es/components/UIShell/SideNavMenuItem.js +1 -1
- package/es/components/UIShell/SideNavSwitcher.js +1 -1
- package/es/components/UIShell/Switcher.js +2 -1
- package/es/components/UIShell/SwitcherItem.js +4 -2
- package/es/index.d.ts +12 -13
- package/es/index.js +25 -24
- package/es/internal/FloatingMenu.js +7 -1
- package/es/internal/Selection.js +12 -3
- package/es/internal/defaultItemToString.d.ts +7 -0
- package/es/internal/defaultItemToString.js +17 -0
- package/es/internal/index.d.ts +1 -0
- package/es/internal/useMergedRefs.js +1 -0
- package/es/internal/useNoInteractiveChildren.js +4 -0
- package/es/internal/useOutsideClick.js +1 -0
- package/es/internal/useOverflowItems.js +6 -0
- package/es/internal/useResizeObserver.js +4 -0
- package/es/internal/useSavedCallback.js +1 -0
- package/es/internal/warning.js +1 -0
- package/es/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/es/prop-types/deprecateValuesWithin.js +6 -6
- package/es/prop-types/isRequiredOneOf.js +4 -1
- package/es/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +10 -10
- package/es/tools/events.js +3 -1
- package/es/tools/wrapComponent.js +1 -0
- package/lib/components/AILabel/index.js +8 -6
- package/lib/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/lib/components/Button/Button.js +3 -0
- package/lib/components/ChatButton/ChatButton.js +1 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +20 -1
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +20 -15
- package/lib/components/ComboButton/index.js +2 -1
- package/lib/components/ComposedModal/ComposedModal.js +5 -2
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/Copy/Copy.js +1 -1
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.js +1 -1
- package/lib/components/DataTable/DataTable.d.ts +60 -15
- package/lib/components/DataTable/DataTable.js +119 -178
- package/lib/components/DataTable/Table.d.ts +2 -2
- package/lib/components/DataTable/Table.js +4 -4
- package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/lib/components/DataTable/TableExpandHeader.js +6 -2
- package/lib/components/DataTable/TableExpandRow.js +1 -0
- package/lib/components/DataTable/TableHeader.js +2 -0
- package/lib/components/DataTable/TableRow.js +5 -0
- package/lib/components/DataTable/TableSlugRow.js +1 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -0
- package/lib/components/DataTable/state/sorting.d.ts +3 -1
- package/lib/components/DataTable/state/sorting.js +2 -0
- package/lib/components/DataTable/tools/sorting.js +1 -0
- package/lib/components/DatePicker/DatePicker.d.ts +0 -12
- package/lib/components/DatePicker/DatePicker.js +16 -5
- package/lib/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/lib/components/DatePicker/plugins/rangePlugin.js +18 -16
- package/lib/components/DatePickerInput/DatePickerInput.js +6 -0
- package/lib/components/Dialog/Dialog.js +10 -2
- package/lib/components/Dropdown/Dropdown.js +19 -18
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
- package/lib/components/FeatureFlags/index.js +1 -0
- package/lib/components/FileUploader/FileUploader.js +9 -2
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +3 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
- package/lib/components/FluidNumberInput/FluidNumberInput.js +3 -2
- package/lib/components/FluidSearch/FluidSearch.js +3 -2
- package/lib/components/FluidSelect/FluidSelect.js +3 -2
- package/lib/components/FluidTextInput/FluidTextInput.js +3 -2
- package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -4
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
- package/lib/components/Grid/CSSGrid.js +5 -0
- package/lib/components/Grid/Column.js +3 -0
- package/lib/components/Grid/ColumnHang.js +1 -0
- package/lib/components/Grid/FlexGrid.js +1 -0
- package/lib/components/Grid/Row.js +1 -0
- package/lib/components/Heading/index.js +3 -1
- package/lib/components/IconButton/index.js +5 -3
- package/lib/components/IconIndicator/index.js +4 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -2
- package/lib/components/Layout/index.js +6 -4
- package/lib/components/LayoutDirection/LayoutDirection.js +2 -0
- package/lib/components/Link/Link.js +3 -0
- package/lib/components/ListBox/ListBoxMenuItem.js +4 -1
- package/lib/components/ListBox/next/ListBoxTrigger.js +3 -2
- package/lib/components/Menu/Menu.js +6 -9
- package/lib/components/Menu/MenuContext.js +1 -0
- package/lib/components/Menu/MenuItem.d.ts +1 -1
- package/lib/components/Menu/MenuItem.js +11 -19
- package/lib/components/MenuButton/index.js +7 -2
- package/lib/components/Modal/Modal.js +4 -1
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +32 -13
- package/lib/components/MultiSelect/MultiSelect.js +23 -18
- package/lib/components/Notification/Notification.d.ts +6 -6
- package/lib/components/Notification/Notification.js +7 -7
- package/lib/components/NumberInput/NumberInput.js +7 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +3 -1
- package/lib/components/OverflowMenu/next/index.js +4 -3
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
- package/lib/components/PageHeader/PageHeader.d.ts +3 -3
- package/lib/components/PageHeader/PageHeader.js +22 -8
- package/lib/components/Pagination/Pagination.js +6 -2
- package/lib/components/PaginationNav/PaginationNav.js +2 -5
- package/lib/components/Popover/index.js +15 -5
- package/lib/components/ProgressBar/ProgressBar.js +4 -2
- package/lib/components/RadioTile/RadioTile.js +2 -2
- package/lib/components/Search/Search.d.ts +4 -2
- package/lib/components/Search/Search.js +7 -6
- package/lib/components/Select/Select.js +2 -3
- package/lib/components/ShapeIndicator/index.js +4 -2
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
- package/lib/components/SkeletonText/SkeletonText.js +0 -2
- package/lib/components/Slider/Slider.d.ts +144 -188
- package/lib/components/Slider/Slider.js +795 -725
- package/lib/components/Slider/index.d.ts +2 -2
- package/lib/components/Stack/HStack.js +1 -0
- package/lib/components/Stack/Stack.js +6 -9
- package/lib/components/Stack/VStack.js +1 -0
- package/lib/components/StructuredList/StructuredList.js +3 -0
- package/lib/components/Switch/Switch.js +1 -1
- package/lib/components/Tabs/Tabs.d.ts +4 -0
- package/lib/components/Tabs/Tabs.js +28 -17
- package/lib/components/Tag/DismissibleTag.js +2 -0
- package/lib/components/Tag/OperationalTag.js +2 -0
- package/lib/components/Tag/SelectableTag.js +2 -0
- package/lib/components/Tag/Tag.js +4 -0
- package/lib/components/Tag/isEllipsisActive.js +1 -0
- package/lib/components/Text/Text.js +1 -0
- package/lib/components/TextArea/TextArea.js +13 -6
- package/lib/components/TextInput/ControlledPasswordInput.js +3 -5
- package/lib/components/TextInput/PasswordInput.js +8 -3
- package/lib/components/TextInput/TextInput.js +5 -3
- package/lib/components/TextInput/util.d.ts +17 -5
- package/lib/components/TextInput/util.js +2 -7
- package/lib/components/Theme/index.js +8 -3
- package/lib/components/Tile/Tile.js +14 -17
- package/lib/components/TimePicker/TimePicker.js +1 -0
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/Toggletip/index.js +4 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -0
- package/lib/components/Tooltip/Tooltip.js +30 -23
- package/lib/components/TreeView/TreeNode.js +13 -5
- package/lib/components/TreeView/TreeView.js +7 -0
- package/lib/components/UIShell/HeaderContainer.js +3 -1
- package/lib/components/UIShell/HeaderGlobalAction.js +2 -2
- package/lib/components/UIShell/HeaderMenu.js +3 -3
- package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
- package/lib/components/UIShell/HeaderPanel.js +2 -2
- package/lib/components/UIShell/Link.js +2 -0
- package/lib/components/UIShell/SideNavItems.js +1 -0
- package/lib/components/UIShell/SideNavMenu.js +2 -2
- package/lib/components/UIShell/SideNavMenuItem.js +1 -1
- package/lib/components/UIShell/SideNavSwitcher.js +1 -1
- package/lib/components/UIShell/Switcher.js +2 -1
- package/lib/components/UIShell/SwitcherItem.js +4 -2
- package/lib/index.d.ts +12 -13
- package/lib/index.js +51 -28
- package/lib/internal/FloatingMenu.js +7 -1
- package/lib/internal/Selection.js +12 -3
- package/lib/internal/defaultItemToString.d.ts +7 -0
- package/lib/internal/defaultItemToString.js +19 -0
- package/lib/internal/index.d.ts +1 -0
- package/lib/internal/useMergedRefs.js +1 -0
- package/lib/internal/useNoInteractiveChildren.js +4 -0
- package/lib/internal/useOutsideClick.js +1 -0
- package/lib/internal/useOverflowItems.js +6 -0
- package/lib/internal/useResizeObserver.js +4 -0
- package/lib/internal/useSavedCallback.js +1 -0
- package/lib/internal/warning.js +1 -0
- package/lib/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/lib/prop-types/deprecateValuesWithin.js +6 -8
- package/lib/prop-types/isRequiredOneOf.js +4 -1
- package/lib/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +10 -12
- package/lib/tools/events.js +3 -1
- package/lib/tools/wrapComponent.js +1 -0
- package/package.json +10 -9
- package/es/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/es/components/MultiSelect/tools/itemToString.js +0 -21
- package/es/components/Slider/index.js +0 -14
- package/es/internal/createClassWrapper.js +0 -23
- package/lib/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/lib/components/MultiSelect/tools/itemToString.js +0 -23
- package/lib/components/Slider/index.js +0 -20
- package/lib/internal/createClassWrapper.js +0 -25
|
@@ -31,6 +31,7 @@ var FormContext = require('../FluidForm/FormContext.js');
|
|
|
31
31
|
var react = require('@floating-ui/react');
|
|
32
32
|
var index = require('../FeatureFlags/index.js');
|
|
33
33
|
var index$1 = require('../AILabel/index.js');
|
|
34
|
+
var defaultItemToString = require('../../internal/defaultItemToString.js');
|
|
34
35
|
var utils = require('../../internal/utils.js');
|
|
35
36
|
var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
|
|
36
37
|
var Text = require('../Text/Text.js');
|
|
@@ -47,18 +48,6 @@ const {
|
|
|
47
48
|
ItemClick,
|
|
48
49
|
FunctionSelectItem
|
|
49
50
|
} = Downshift.useCombobox.stateChangeTypes;
|
|
50
|
-
const defaultItemToString = item => {
|
|
51
|
-
if (typeof item === 'string') {
|
|
52
|
-
return item;
|
|
53
|
-
}
|
|
54
|
-
if (typeof item === 'number') {
|
|
55
|
-
return `${item}`;
|
|
56
|
-
}
|
|
57
|
-
if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
|
|
58
|
-
return item['label'];
|
|
59
|
-
}
|
|
60
|
-
return '';
|
|
61
|
-
};
|
|
62
51
|
const defaultShouldFilterItem = () => true;
|
|
63
52
|
const autocompleteCustomFilter = ({
|
|
64
53
|
item,
|
|
@@ -94,7 +83,7 @@ const getInputValue = ({
|
|
|
94
83
|
};
|
|
95
84
|
const findHighlightedIndex = ({
|
|
96
85
|
items,
|
|
97
|
-
itemToString = defaultItemToString
|
|
86
|
+
itemToString = defaultItemToString.defaultItemToString
|
|
98
87
|
}, inputValue) => {
|
|
99
88
|
if (!inputValue) {
|
|
100
89
|
return -1;
|
|
@@ -137,7 +126,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
137
126
|
invalidText,
|
|
138
127
|
items,
|
|
139
128
|
itemToElement = null,
|
|
140
|
-
itemToString = defaultItemToString,
|
|
129
|
+
itemToString = defaultItemToString.defaultItemToString,
|
|
141
130
|
light,
|
|
142
131
|
onChange,
|
|
143
132
|
onInputChange,
|
|
@@ -184,6 +173,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
184
173
|
refs.floating.current.style.width = parentWidth + 'px';
|
|
185
174
|
}
|
|
186
175
|
}
|
|
176
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
187
177
|
}, [enableFloatingStyles, floatingStyles, refs.floating, parentWidth]);
|
|
188
178
|
const [inputValue, setInputValue] = React.useState(getInputValue({
|
|
189
179
|
initialSelectedItem,
|
|
@@ -213,6 +203,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
213
203
|
}
|
|
214
204
|
prevInputLengthRef.current = inputValue.length;
|
|
215
205
|
}
|
|
206
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
216
207
|
}, [typeahead, inputValue, items, itemToString, autocompleteCustomFilter]);
|
|
217
208
|
const isManualClearingRef = React.useRef(false);
|
|
218
209
|
const [isClearing, setIsClearing] = React.useState(false);
|
|
@@ -253,6 +244,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
253
244
|
}
|
|
254
245
|
prevSelectedItemProp.current = selectedItemProp;
|
|
255
246
|
}
|
|
247
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
256
248
|
}, [selectedItemProp]);
|
|
257
249
|
const filterItems = (items, itemToString, inputValue) => items.filter(item => typeahead ? autocompleteCustomFilter({
|
|
258
250
|
item: itemToString(item),
|
|
@@ -267,8 +259,10 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
267
259
|
React.useEffect(() => {
|
|
268
260
|
if (prevInputValue.current !== inputValue) {
|
|
269
261
|
prevInputValue.current = inputValue;
|
|
262
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
270
263
|
onInputChange && onInputChange(inputValue);
|
|
271
264
|
}
|
|
265
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
272
266
|
}, [inputValue]);
|
|
273
267
|
const handleSelectionClear = () => {
|
|
274
268
|
if (textInput?.current) {
|
|
@@ -321,6 +315,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
321
315
|
if (state.highlightedIndex !== -1) {
|
|
322
316
|
const filteredList = filterItems(items, itemToString, inputValue);
|
|
323
317
|
const highlightedItem = filteredList[state.highlightedIndex];
|
|
318
|
+
|
|
319
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
324
320
|
if (highlightedItem && !highlightedItem.disabled) {
|
|
325
321
|
return {
|
|
326
322
|
...changes,
|
|
@@ -332,6 +328,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
332
328
|
const autoIndex = indexToHighlight(inputValue);
|
|
333
329
|
if (autoIndex !== -1) {
|
|
334
330
|
const matchingItem = items[autoIndex];
|
|
331
|
+
|
|
332
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
335
333
|
if (matchingItem && !matchingItem.disabled) {
|
|
336
334
|
return {
|
|
337
335
|
...changes,
|
|
@@ -484,8 +482,10 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
484
482
|
onHighlightedIndexChange: ({
|
|
485
483
|
highlightedIndex
|
|
486
484
|
}) => {
|
|
485
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion , valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
487
486
|
if (highlightedIndex > -1 && typeof window !== undefined) {
|
|
488
487
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
488
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
489
489
|
const highlightedItem = itemArray[highlightedIndex];
|
|
490
490
|
if (highlightedItem) {
|
|
491
491
|
highlightedItem.scrollIntoView({
|
|
@@ -498,7 +498,9 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
498
498
|
initialSelectedItem: initialSelectedItem,
|
|
499
499
|
inputId: id,
|
|
500
500
|
stateReducer,
|
|
501
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
501
502
|
isItemDisabled(item, _index) {
|
|
503
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
502
504
|
return item?.disabled;
|
|
503
505
|
},
|
|
504
506
|
...downshiftProps,
|
|
@@ -535,6 +537,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
535
537
|
toggleMenu
|
|
536
538
|
};
|
|
537
539
|
}
|
|
540
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
538
541
|
}, [closeMenu, openMenu, reset, selectItem, setHighlightedIndex, downshiftSetInputValue, toggleMenu]);
|
|
539
542
|
const buttonProps = getToggleButtonProps({
|
|
540
543
|
disabled: disabled || readOnly,
|
|
@@ -583,7 +586,9 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
583
586
|
// Memoize the value of getMenuProps to avoid an infinite loop
|
|
584
587
|
const menuProps = React.useMemo(() => getMenuProps({
|
|
585
588
|
ref: enableFloatingStyles ? refs.setFloating : null
|
|
586
|
-
}),
|
|
589
|
+
}),
|
|
590
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
591
|
+
[enableFloatingStyles, deprecatedAriaLabel, ariaLabel, getMenuProps, refs.setFloating]);
|
|
587
592
|
React.useEffect(() => {
|
|
588
593
|
if (textInput.current) {
|
|
589
594
|
if (inputRef.current && typeaheadText) {
|
|
@@ -56,6 +56,7 @@ const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
|
|
|
56
56
|
const id = useId.useId('combobutton');
|
|
57
57
|
const prefix = usePrefix.usePrefix();
|
|
58
58
|
const containerRef = React.useRef(null);
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
59
60
|
let middlewares = [];
|
|
60
61
|
if (!enableOnlyFloatingStyles) {
|
|
61
62
|
middlewares = [react.flip({
|
|
@@ -191,7 +192,7 @@ ComboButton.propTypes = {
|
|
|
191
192
|
/**
|
|
192
193
|
* Specify how the trigger tooltip should be aligned.
|
|
193
194
|
*/
|
|
194
|
-
tooltipAlignment: deprecateValuesWithin.
|
|
195
|
+
tooltipAlignment: deprecateValuesWithin.deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
195
196
|
// deprecated use top-start instead
|
|
196
197
|
'top-right',
|
|
197
198
|
// deprecated use top-end instead
|
|
@@ -79,7 +79,7 @@ ModalBody.propTypes = {
|
|
|
79
79
|
/**
|
|
80
80
|
* Required props for the accessibility label of the header
|
|
81
81
|
*/
|
|
82
|
-
['aria-label']: requiredIfGivenPropIsTruthy.
|
|
82
|
+
['aria-label']: requiredIfGivenPropIsTruthy.requiredIfGivenPropIsTruthy('hasScrollingContent', PropTypes.string),
|
|
83
83
|
/**
|
|
84
84
|
* Specify the content to be placed in the ModalBody
|
|
85
85
|
*/
|
|
@@ -138,6 +138,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
138
138
|
setWasOpen(!!open);
|
|
139
139
|
toggleClass.toggleClass(document.body, `${prefix}--body--with-modal-open`, !!open);
|
|
140
140
|
}
|
|
141
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
141
142
|
}, [open, wasOpen, prefix]);
|
|
142
143
|
// Remove the document.body className on unmount
|
|
143
144
|
React.useEffect(() => {
|
|
@@ -213,7 +214,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
213
214
|
}
|
|
214
215
|
const lastContent = modalContent.children[modalContent.children.length - 1];
|
|
215
216
|
const gradientSpacing = modalContent.scrollHeight - lastContent.offsetTop - lastContent.clientHeight;
|
|
216
|
-
for (
|
|
217
|
+
for (const elem of modalContent.children) {
|
|
217
218
|
if (elem.contains(currentActiveNode)) {
|
|
218
219
|
const spaceBelow = modalContent.clientHeight - elem.offsetTop + modalContent.scrollTop - elem.clientHeight;
|
|
219
220
|
if (spaceBelow < gradientSpacing) {
|
|
@@ -280,6 +281,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
280
281
|
return () => {
|
|
281
282
|
document.removeEventListener('keydown', handleEscapeKey, true);
|
|
282
283
|
};
|
|
284
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
283
285
|
}, [open]);
|
|
284
286
|
React.useEffect(() => {
|
|
285
287
|
if (!enableDialogElement && !open && launcherButtonRef) {
|
|
@@ -311,6 +313,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
311
313
|
focusButton(innerModal.current);
|
|
312
314
|
}
|
|
313
315
|
}
|
|
316
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
314
317
|
}, [open, selectorPrimaryFocus, isOpen]);
|
|
315
318
|
|
|
316
319
|
// AILabel is always size `sm`
|
|
@@ -50,7 +50,7 @@ declare namespace Copy {
|
|
|
50
50
|
/**
|
|
51
51
|
* Specify how the trigger should align with the tooltip
|
|
52
52
|
*/
|
|
53
|
-
align:
|
|
53
|
+
align: PropTypes.Requireable<string> | PropTypes.Validator<string>;
|
|
54
54
|
/**
|
|
55
55
|
* **Experimental**: Will attempt to automatically align the tooltip. Requires
|
|
56
56
|
* React v17+
|
|
@@ -72,7 +72,7 @@ Copy.propTypes = {
|
|
|
72
72
|
/**
|
|
73
73
|
* Specify how the trigger should align with the tooltip
|
|
74
74
|
*/
|
|
75
|
-
align: deprecateValuesWithin.
|
|
75
|
+
align: deprecateValuesWithin.deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
76
76
|
// deprecated use top-start instead
|
|
77
77
|
'top-right',
|
|
78
78
|
// deprecated use top-end instead
|
|
@@ -51,7 +51,7 @@ declare namespace CopyButton {
|
|
|
51
51
|
/**
|
|
52
52
|
* Specify how the trigger should align with the tooltip
|
|
53
53
|
*/
|
|
54
|
-
align:
|
|
54
|
+
align: PropTypes.Requireable<string> | PropTypes.Validator<string>;
|
|
55
55
|
/**
|
|
56
56
|
* **Experimental**: Will attempt to automatically align the tooltip. Requires
|
|
57
57
|
* React v17+
|
|
@@ -53,7 +53,7 @@ CopyButton.propTypes = {
|
|
|
53
53
|
/**
|
|
54
54
|
* Specify how the trigger should align with the tooltip
|
|
55
55
|
*/
|
|
56
|
-
align: deprecateValuesWithin.
|
|
56
|
+
align: deprecateValuesWithin.deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
57
57
|
// deprecated use top-start instead
|
|
58
58
|
'top-right',
|
|
59
59
|
// deprecated use top-end instead
|
|
@@ -20,7 +20,7 @@ declare const translationKeys: {
|
|
|
20
20
|
readonly unselectRow: "carbon.table.row.unselect";
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
* Message
|
|
23
|
+
* Message IDs that will be passed to translateWithId().
|
|
24
24
|
*/
|
|
25
25
|
type TranslationKey = (typeof translationKeys)[keyof typeof translationKeys];
|
|
26
26
|
export type DataTableSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -35,7 +35,6 @@ export interface DataTableCell<T> {
|
|
|
35
35
|
header: string;
|
|
36
36
|
};
|
|
37
37
|
hasAILabelHeader?: boolean;
|
|
38
|
-
hasDecoratorHeader?: boolean;
|
|
39
38
|
}
|
|
40
39
|
type DataTableCells<T extends any[]> = {
|
|
41
40
|
[K in keyof T]: DataTableCell<T[K]>;
|
|
@@ -54,8 +53,17 @@ export interface DataTableHeader {
|
|
|
54
53
|
decorator?: ReactElement;
|
|
55
54
|
}
|
|
56
55
|
export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
56
|
+
/**
|
|
57
|
+
* The headers for the table.
|
|
58
|
+
*/
|
|
57
59
|
headers: DataTableHeader[];
|
|
60
|
+
/**
|
|
61
|
+
* The rows for the table.
|
|
62
|
+
*/
|
|
58
63
|
rows: (DataTableRow<ColTypes> & RowType)[];
|
|
64
|
+
/**
|
|
65
|
+
* The rows that are currently selected.
|
|
66
|
+
*/
|
|
59
67
|
selectedRows: (DataTableRow<ColTypes> & RowType)[];
|
|
60
68
|
getHeaderProps: (options: {
|
|
61
69
|
header: DataTableHeader;
|
|
@@ -154,14 +162,36 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
154
162
|
}) => {
|
|
155
163
|
[key: string]: unknown;
|
|
156
164
|
hasAILabelHeader?: boolean;
|
|
157
|
-
|
|
165
|
+
key: string;
|
|
158
166
|
};
|
|
167
|
+
/**
|
|
168
|
+
* Handles input value changes.
|
|
169
|
+
*/
|
|
159
170
|
onInputChange: (event: ChangeEvent<HTMLInputElement>, defaultValue?: string) => void;
|
|
171
|
+
/**
|
|
172
|
+
* Sorts the table by a specific header.
|
|
173
|
+
*/
|
|
160
174
|
sortBy: (headerKey: string) => void;
|
|
175
|
+
/**
|
|
176
|
+
* Selects all rows.
|
|
177
|
+
*/
|
|
161
178
|
selectAll: () => void;
|
|
179
|
+
/**
|
|
180
|
+
* Selects or deselects a specific row.
|
|
181
|
+
*/
|
|
162
182
|
selectRow: (rowId: string) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Expands or collapses a specific row.
|
|
185
|
+
*/
|
|
163
186
|
expandRow: (rowId: string) => void;
|
|
187
|
+
/**
|
|
188
|
+
* Expands or collapses all rows.
|
|
189
|
+
*/
|
|
164
190
|
expandAll: () => void;
|
|
191
|
+
/**
|
|
192
|
+
* Whether the table is using radio buttons for selection instead of
|
|
193
|
+
* checkboxes.
|
|
194
|
+
*/
|
|
165
195
|
radio: boolean | undefined;
|
|
166
196
|
}
|
|
167
197
|
export interface DataTableProps<RowType, ColTypes extends any[]> extends TranslateWithId<TranslationKey> {
|
|
@@ -179,6 +209,12 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
|
|
|
179
209
|
locale?: string;
|
|
180
210
|
overflowMenuOnHover?: boolean;
|
|
181
211
|
radio?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* @deprecated Use `children` instead. This prop will be removed in
|
|
214
|
+
* the next major version.
|
|
215
|
+
*
|
|
216
|
+
* https://www.patterns.dev/react/render-props-pattern/#children-as-a-function
|
|
217
|
+
*/
|
|
182
218
|
render?: (renderProps: DataTableRenderProps<RowType, ColTypes>) => ReactElement;
|
|
183
219
|
rows: Omit<DataTableRow<ColTypes>, 'cells'>[];
|
|
184
220
|
size?: DataTableSize;
|
|
@@ -188,14 +224,12 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
|
|
|
188
224
|
useZebraStyles?: boolean;
|
|
189
225
|
}
|
|
190
226
|
/**
|
|
191
|
-
*
|
|
192
|
-
* subset of their fields in columns, or headers. We prioritize
|
|
193
|
-
* to the state of what we're rendering, so internally we
|
|
194
|
-
* given data and then
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* and updating the state of the single entity will cascade updates to the
|
|
198
|
-
* consumer.
|
|
227
|
+
* DataTable components are used to represent a collection of resources,
|
|
228
|
+
* displaying a subset of their fields in columns, or headers. We prioritize
|
|
229
|
+
* direct updates to the state of what we're rendering, so internally we
|
|
230
|
+
* normalize the given data and then denormalize it at render time. Each part of
|
|
231
|
+
* the DataTable is accessible through look-up by ID, and updating the state of
|
|
232
|
+
* a single entity cascades updates to the consumer.
|
|
199
233
|
*/
|
|
200
234
|
export declare const DataTable: {
|
|
201
235
|
<RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
@@ -266,7 +300,7 @@ export declare const DataTable: {
|
|
|
266
300
|
enableToggle: PropTypes.Requireable<boolean>;
|
|
267
301
|
expandIconDescription: PropTypes.Requireable<string>;
|
|
268
302
|
id: PropTypes.Requireable<string>;
|
|
269
|
-
isExpanded:
|
|
303
|
+
isExpanded: PropTypes.Validator<boolean | null | undefined>;
|
|
270
304
|
onExpand: PropTypes.Requireable<any>;
|
|
271
305
|
};
|
|
272
306
|
};
|
|
@@ -348,6 +382,10 @@ export declare const DataTable: {
|
|
|
348
382
|
};
|
|
349
383
|
TableToolbarMenu: React.FC<import("./TableToolbarMenu").TableToolbarMenuProps>;
|
|
350
384
|
propTypes: {
|
|
385
|
+
/**
|
|
386
|
+
* Pass in the children that will be rendered within the Table
|
|
387
|
+
*/
|
|
388
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
351
389
|
/**
|
|
352
390
|
* Experimental property. Allows table to align cell contents to the top if there is text wrapping in the content. Might have performance issues, intended for smaller tables
|
|
353
391
|
*/
|
|
@@ -383,6 +421,13 @@ export declare const DataTable: {
|
|
|
383
421
|
* Specify whether the control should be a radio button or inline checkbox
|
|
384
422
|
*/
|
|
385
423
|
radio: PropTypes.Requireable<boolean>;
|
|
424
|
+
/**
|
|
425
|
+
* @deprecated Use `children` instead. This prop will be removed in
|
|
426
|
+
* the next major version.
|
|
427
|
+
*
|
|
428
|
+
* https://www.patterns.dev/react/render-props-pattern/#children-as-a-function
|
|
429
|
+
*/
|
|
430
|
+
render: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
|
|
386
431
|
/**
|
|
387
432
|
* The `rows` prop is where you provide us with a list of all the rows that
|
|
388
433
|
* you want to render in the table. The only hard requirement is that this
|
|
@@ -409,13 +454,13 @@ export declare const DataTable: {
|
|
|
409
454
|
*/
|
|
410
455
|
stickyHeader: PropTypes.Requireable<boolean>;
|
|
411
456
|
/**
|
|
412
|
-
* Optional method that takes in a message
|
|
457
|
+
* Optional method that takes in a message ID and returns an
|
|
413
458
|
* internationalized string. See `DataTable.translationKeys` for all
|
|
414
|
-
* available message
|
|
459
|
+
* available message IDs.
|
|
415
460
|
*/
|
|
416
461
|
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
417
462
|
/**
|
|
418
|
-
*
|
|
463
|
+
* If `true`, sets the table width to `auto` instead of `100%`.
|
|
419
464
|
*/
|
|
420
465
|
useStaticWidth: PropTypes.Requireable<boolean>;
|
|
421
466
|
/**
|