@carbon/react 1.103.0-rc.0 → 1.104.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 +950 -950
- package/es/_virtual/_rolldown/runtime.js +25 -0
- package/es/components/AILabel/index.d.ts +29 -2
- package/es/components/AILabel/index.js +114 -169
- package/es/components/AISkeleton/AISkeletonIcon.js +23 -27
- package/es/components/AISkeleton/AISkeletonPlaceholder.js +19 -27
- package/es/components/AISkeleton/AISkeletonText.js +26 -39
- package/es/components/Accordion/Accordion.Skeleton.js +55 -79
- package/es/components/Accordion/Accordion.js +43 -61
- package/es/components/Accordion/AccordionItem.js +102 -156
- package/es/components/Accordion/AccordionProvider.js +18 -15
- package/es/components/AspectRatio/AspectRatio.js +41 -47
- package/es/components/BadgeIndicator/index.js +28 -33
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +39 -50
- package/es/components/Breadcrumb/Breadcrumb.js +39 -51
- package/es/components/Breadcrumb/BreadcrumbItem.js +80 -83
- package/es/components/Button/Button.Skeleton.js +49 -58
- package/es/components/Button/Button.d.ts +1 -1
- package/es/components/Button/Button.js +146 -240
- package/es/components/Button/ButtonBase.js +82 -104
- package/es/components/Button/index.js +13 -6
- package/es/components/ButtonSet/ButtonSet.js +74 -98
- package/es/components/ButtonSet/index.js +12 -4
- package/es/components/ChatButton/ChatButton.Skeleton.js +27 -27
- package/es/components/ChatButton/ChatButton.js +64 -79
- package/es/components/Checkbox/Checkbox.Skeleton.js +26 -25
- package/es/components/Checkbox/Checkbox.js +116 -195
- package/es/components/Checkbox/index.js +13 -5
- package/es/components/CheckboxGroup/CheckboxGroup.js +100 -148
- package/es/components/ClassPrefix/index.js +21 -17
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +45 -42
- package/es/components/CodeSnippet/CodeSnippet.js +210 -299
- package/es/components/ComboBox/ComboBox.js +621 -970
- package/es/components/ComboBox/index.js +12 -4
- package/es/components/ComboButton/index.js +172 -208
- package/es/components/ComposedModal/ComposedModal.js +311 -450
- package/es/components/ComposedModal/ComposedModalPresence.js +47 -42
- package/es/components/ComposedModal/ModalFooter.js +127 -207
- package/es/components/ComposedModal/ModalHeader.js +71 -101
- package/es/components/ComposedModal/useComposedModalState.js +21 -15
- package/es/components/ContainedList/ContainedList.js +67 -102
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +49 -67
- package/es/components/ContainedList/ContainedListItem/index.js +12 -4
- package/es/components/ContainedList/index.js +15 -12
- package/es/components/ContentSwitcher/ContentSwitcher.js +108 -140
- package/es/components/ContextMenu/useContextMenu.js +41 -36
- package/es/components/Copy/Copy.js +97 -117
- package/es/components/Copy/index.js +12 -4
- package/es/components/CopyButton/CopyButton.js +81 -94
- package/es/components/CopyButton/index.js +12 -4
- package/es/components/DangerButton/DangerButton.js +11 -9
- package/es/components/DataTable/DataTable.d.ts +11 -11
- package/es/components/DataTable/DataTable.js +448 -630
- package/es/components/DataTable/Table.js +111 -156
- package/es/components/DataTable/TableActionList.js +14 -6
- package/es/components/DataTable/TableBatchAction.js +25 -34
- package/es/components/DataTable/TableBatchActions.js +78 -113
- package/es/components/DataTable/TableBody.js +26 -19
- package/es/components/DataTable/TableCell.js +31 -46
- package/es/components/DataTable/TableContainer.js +75 -82
- package/es/components/DataTable/TableContext.js +14 -6
- package/es/components/DataTable/TableDecoratorRow.js +30 -36
- package/es/components/DataTable/TableExpandHeader.js +53 -90
- package/es/components/DataTable/TableExpandRow.js +82 -119
- package/es/components/DataTable/TableExpandedRow.js +45 -51
- package/es/components/DataTable/TableHead.js +7 -5
- package/es/components/DataTable/TableHeader.js +138 -181
- package/es/components/DataTable/TableRow.d.ts +1 -1
- package/es/components/DataTable/TableRow.js +42 -76
- package/es/components/DataTable/TableSelectAll.js +42 -70
- package/es/components/DataTable/TableSelectRow.js +63 -98
- package/es/components/DataTable/TableSlugRow.js +35 -43
- package/es/components/DataTable/TableToolbar.js +33 -45
- package/es/components/DataTable/TableToolbarAction.js +25 -20
- package/es/components/DataTable/TableToolbarContent.js +14 -6
- package/es/components/DataTable/TableToolbarMenu.js +35 -46
- package/es/components/DataTable/TableToolbarSearch.js +97 -187
- package/es/components/DataTable/state/getDerivedStateFromProps.js +38 -43
- package/es/components/DataTable/state/sortStates.js +11 -9
- package/es/components/DataTable/state/sorting.js +53 -72
- package/es/components/DataTable/tools/cells.js +15 -7
- package/es/components/DataTable/tools/denormalize.js +27 -19
- package/es/components/DataTable/tools/filter.js +21 -22
- package/es/components/DataTable/tools/normalize.js +57 -72
- package/es/components/DataTable/tools/sorting.js +50 -71
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +66 -94
- package/es/components/DatePicker/DatePicker.Skeleton.js +44 -51
- package/es/components/DatePicker/DatePicker.d.ts +4 -2
- package/es/components/DatePicker/DatePicker.js +485 -749
- package/es/components/DatePicker/DatePickerLocales.js +75 -126
- package/es/components/DatePicker/index.js +13 -5
- package/es/components/DatePicker/plugins/appendToPlugin.js +31 -45
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +127 -171
- package/es/components/DatePicker/plugins/rangePlugin.d.ts +1 -1
- package/es/components/DatePicker/plugins/rangePlugin.js +40 -47
- package/es/components/DatePicker/utils.d.ts +7 -0
- package/es/components/DatePicker/utils.js +18 -0
- package/es/components/DatePickerInput/DatePickerInput.js +179 -289
- package/es/components/DatePickerInput/index.js +12 -4
- package/es/components/Dialog/Dialog.js +303 -574
- package/es/components/Dialog/index.js +18 -2
- package/es/components/Dropdown/Dropdown.Skeleton.js +26 -38
- package/es/components/Dropdown/Dropdown.js +344 -535
- package/es/components/Dropdown/index.js +13 -5
- package/es/components/ErrorBoundary/ErrorBoundary.js +36 -58
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +14 -9
- package/es/components/ExpandableSearch/ExpandableSearch.js +60 -69
- package/es/components/ExpandableSearch/index.js +12 -4
- package/es/components/FeatureFlags/index.d.ts +11 -2
- package/es/components/FeatureFlags/index.js +79 -77
- package/es/components/FileUploader/FileUploader.Skeleton.js +35 -30
- package/es/components/FileUploader/FileUploader.js +269 -343
- package/es/components/FileUploader/FileUploaderButton.js +110 -160
- package/es/components/FileUploader/FileUploaderDropContainer.js +144 -221
- package/es/components/FileUploader/FileUploaderItem.js +138 -157
- package/es/components/FileUploader/Filename.d.ts +1 -1
- package/es/components/FileUploader/Filename.js +53 -72
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +26 -28
- package/es/components/FluidComboBox/FluidComboBox.js +54 -105
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +56 -53
- package/es/components/FluidDatePicker/FluidDatePicker.js +46 -68
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +23 -16
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +26 -28
- package/es/components/FluidDropdown/FluidDropdown.js +55 -111
- package/es/components/FluidForm/FluidForm.js +29 -31
- package/es/components/FluidForm/FormContext.js +12 -6
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +26 -28
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +67 -197
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +27 -30
- package/es/components/FluidNumberInput/FluidNumberInput.js +63 -147
- package/es/components/FluidSearch/FluidSearch.Skeleton.js +27 -30
- package/es/components/FluidSearch/FluidSearch.js +41 -84
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +26 -28
- package/es/components/FluidSelect/FluidSelect.js +40 -76
- package/es/components/FluidSelect/index.js +13 -5
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +27 -30
- package/es/components/FluidTextArea/FluidTextArea.js +48 -112
- package/es/components/FluidTextInput/FluidPasswordInput.js +44 -99
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +27 -30
- package/es/components/FluidTextInput/FluidTextInput.js +49 -104
- package/es/components/FluidTextInput/index.js +14 -6
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +30 -33
- package/es/components/FluidTimePicker/FluidTimePicker.js +68 -115
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +28 -47
- package/es/components/Form/Form.js +23 -25
- package/es/components/FormGroup/FormGroup.js +45 -67
- package/es/components/FormItem/FormItem.js +23 -25
- package/es/components/FormLabel/FormLabel.js +28 -34
- package/es/components/Grid/CSSGrid.d.ts +1 -1
- package/es/components/Grid/CSSGrid.js +85 -127
- package/es/components/Grid/Column.js +192 -324
- package/es/components/Grid/ColumnHang.js +28 -36
- package/es/components/Grid/FlexGrid.js +40 -60
- package/es/components/Grid/Grid.js +29 -42
- package/es/components/Grid/GridContext.js +36 -42
- package/es/components/Grid/Row.js +31 -49
- package/es/components/Heading/index.js +36 -51
- package/es/components/Icon/Icon.Skeleton.js +21 -21
- package/es/components/IconButton/index.js +117 -178
- package/es/components/IconIndicator/index.d.ts +1 -1
- package/es/components/IconIndicator/index.js +59 -60
- package/es/components/IdPrefix/index.js +21 -17
- package/es/components/InlineCheckbox/InlineCheckbox.js +69 -113
- package/es/components/InlineCheckbox/index.js +12 -4
- package/es/components/InlineLoading/InlineLoading.js +83 -100
- package/es/components/InlineLoading/index.js +12 -4
- package/es/components/Layer/LayerContext.js +12 -4
- package/es/components/Layer/LayerLevel.js +20 -4
- package/es/components/Layer/index.js +54 -66
- package/es/components/Layout/index.js +77 -109
- package/es/components/LayoutDirection/LayoutDirection.d.ts +1 -1
- package/es/components/LayoutDirection/LayoutDirection.js +33 -37
- package/es/components/LayoutDirection/LayoutDirectionContext.js +12 -6
- package/es/components/LayoutDirection/useLayoutDirection.js +15 -7
- package/es/components/Link/Link.js +63 -108
- package/es/components/Link/index.js +12 -4
- package/es/components/ListBox/ListBox.js +78 -126
- package/es/components/ListBox/ListBoxField.js +24 -43
- package/es/components/ListBox/ListBoxMenu.js +36 -42
- package/es/components/ListBox/ListBoxMenuIcon.js +39 -40
- package/es/components/ListBox/ListBoxMenuItem.js +67 -88
- package/es/components/ListBox/ListBoxPropTypes.js +17 -5
- package/es/components/ListBox/ListBoxSelection.js +71 -96
- package/es/components/ListBox/index.js +16 -14
- package/es/components/ListBox/next/ListBoxSelection.js +79 -117
- package/es/components/ListBox/next/ListBoxTrigger.js +44 -48
- package/es/components/ListItem/ListItem.js +25 -28
- package/es/components/Loading/Loading.js +64 -73
- package/es/components/Loading/index.js +12 -4
- package/es/components/Menu/Menu.js +220 -363
- package/es/components/Menu/MenuContext.d.ts +1 -1
- package/es/components/Menu/MenuContext.js +41 -38
- package/es/components/Menu/MenuItem.js +282 -413
- package/es/components/MenuButton/index.js +134 -195
- package/es/components/Modal/Modal.js +500 -660
- package/es/components/Modal/ModalPresence.js +39 -37
- package/es/components/Modal/index.js +13 -5
- package/es/components/ModalWrapper/ModalWrapper.d.ts +2 -2
- package/es/components/ModalWrapper/ModalWrapper.js +106 -130
- package/es/components/MultiSelect/FilterableMultiSelect.js +605 -918
- package/es/components/MultiSelect/MultiSelect.js +454 -716
- package/es/components/MultiSelect/MultiSelectPropTypes.js +13 -30
- package/es/components/MultiSelect/filter.js +14 -9
- package/es/components/MultiSelect/tools/sorting.js +21 -34
- package/es/components/Notification/Notification.js +508 -785
- package/es/components/NumberInput/NumberFormatPropTypes.js +69 -30
- package/es/components/NumberInput/NumberInput.Skeleton.js +29 -33
- package/es/components/NumberInput/NumberInput.js +567 -947
- package/es/components/OrderedList/OrderedList.js +31 -44
- package/es/components/OverflowMenu/OverflowMenu.js +335 -450
- package/es/components/OverflowMenu/index.js +25 -16
- package/es/components/OverflowMenu/next/index.js +154 -186
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +100 -160
- package/es/components/OverflowMenuItem/index.js +12 -4
- package/es/components/OverflowMenuV2/index.js +15 -13
- package/es/components/PageHeader/PageHeader.js +297 -442
- package/es/components/PageHeader/index.js +24 -2
- package/es/components/Pagination/Pagination.Skeleton.js +34 -35
- package/es/components/Pagination/Pagination.d.ts +1 -1
- package/es/components/Pagination/Pagination.js +251 -356
- package/es/components/Pagination/experimental/PageSelector.js +38 -54
- package/es/components/Pagination/experimental/Pagination-story.d.ts +114 -0
- package/es/components/Pagination/experimental/Pagination.js +144 -196
- package/es/components/PaginationNav/PaginationNav.js +320 -426
- package/es/components/Popover/index.js +318 -437
- package/es/components/PrimaryButton/PrimaryButton.js +11 -9
- package/es/components/ProgressBar/ProgressBar.js +117 -143
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +42 -38
- package/es/components/ProgressIndicator/ProgressIndicator.js +146 -243
- package/es/components/RadioButton/RadioButton.Skeleton.js +23 -25
- package/es/components/RadioButton/RadioButton.js +101 -174
- package/es/components/RadioButton/index.js +12 -4
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +135 -207
- package/es/components/RadioTile/RadioTile.js +104 -168
- package/es/components/RadioTile/index.js +12 -4
- package/es/components/Search/Search.Skeleton.js +28 -33
- package/es/components/Search/Search.js +182 -278
- package/es/components/Search/index.js +13 -5
- package/es/components/Search/utils.js +11 -3
- package/es/components/SecondaryButton/SecondaryButton.js +11 -9
- package/es/components/Select/Select.Skeleton.js +27 -30
- package/es/components/Select/Select.js +178 -257
- package/es/components/Select/index.js +13 -5
- package/es/components/SelectItem/SelectItem.js +33 -48
- package/es/components/SelectItem/index.js +12 -4
- package/es/components/SelectItemGroup/SelectItemGroup.js +27 -37
- package/es/components/ShapeIndicator/index.d.ts +1 -1
- package/es/components/ShapeIndicator/index.js +74 -80
- package/es/components/SkeletonIcon/SkeletonIcon.js +21 -24
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +15 -24
- package/es/components/SkeletonText/SkeletonText.js +67 -81
- package/es/components/SkeletonText/index.js +12 -4
- package/es/components/Slider/Slider.Skeleton.js +68 -91
- package/es/components/Slider/Slider.js +864 -1315
- package/es/components/Slider/SliderHandles.js +73 -66
- package/es/components/Stack/HStack.js +19 -11
- package/es/components/Stack/Stack.js +56 -80
- package/es/components/Stack/VStack.js +19 -11
- package/es/components/StructuredList/StructuredList.Skeleton.js +55 -48
- package/es/components/StructuredList/StructuredList.js +178 -317
- package/es/components/Switch/IconSwitch.js +99 -145
- package/es/components/Switch/Switch.js +66 -99
- package/es/components/TabContent/TabContent.js +28 -34
- package/es/components/Tabs/Tabs.Skeleton.js +41 -36
- package/es/components/Tabs/Tabs.js +732 -1147
- package/es/components/Tabs/usePressable.js +97 -112
- package/es/components/Tag/DismissibleTag.js +119 -156
- package/es/components/Tag/OperationalTag.js +91 -111
- package/es/components/Tag/SelectableTag.js +94 -129
- package/es/components/Tag/Tag.Skeleton.js +26 -30
- package/es/components/Tag/Tag.js +152 -200
- package/es/components/Tag/isEllipsisActive.js +13 -8
- package/es/components/Text/Text.js +66 -79
- package/es/components/Text/TextDirection.js +36 -37
- package/es/components/Text/TextDirectionContext.js +14 -8
- package/es/components/Text/createTextComponent.js +21 -20
- package/es/components/TextArea/TextArea.Skeleton.js +25 -29
- package/es/components/TextArea/TextArea.js +315 -422
- package/es/components/TextArea/index.js +13 -5
- package/es/components/TextInput/ControlledPasswordInput.js +133 -198
- package/es/components/TextInput/PasswordInput.js +196 -303
- package/es/components/TextInput/TextInput.Skeleton.js +24 -28
- package/es/components/TextInput/TextInput.js +219 -317
- package/es/components/TextInput/index.js +13 -5
- package/es/components/TextInput/util.js +21 -25
- package/es/components/Theme/index.js +79 -95
- package/es/components/Tile/Tile.d.ts +2 -2
- package/es/components/Tile/Tile.js +394 -588
- package/es/components/TileGroup/TileGroup.js +70 -111
- package/es/components/TimePicker/TimePicker.d.ts +1 -1
- package/es/components/TimePicker/TimePicker.js +148 -247
- package/es/components/TimePickerSelect/TimePickerSelect.js +43 -58
- package/es/components/Toggle/Toggle.Skeleton.js +24 -22
- package/es/components/Toggle/Toggle.js +102 -171
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +46 -51
- package/es/components/Toggletip/index.d.ts +2 -2
- package/es/components/Toggletip/index.js +170 -256
- package/es/components/Tooltip/DefinitionTooltip.js +98 -138
- package/es/components/Tooltip/Tooltip.js +188 -263
- package/es/components/TreeView/TreeContext.js +13 -5
- package/es/components/TreeView/TreeNode.js +361 -500
- package/es/components/TreeView/TreeView.js +164 -237
- package/es/components/UIShell/Content.js +23 -30
- package/es/components/UIShell/Header.js +25 -29
- package/es/components/UIShell/HeaderContainer.js +31 -40
- package/es/components/UIShell/HeaderGlobalAction.js +65 -90
- package/es/components/UIShell/HeaderGlobalBar.js +16 -9
- package/es/components/UIShell/HeaderMenu.js +141 -215
- package/es/components/UIShell/HeaderMenuButton.js +43 -66
- package/es/components/UIShell/HeaderMenuItem.js +49 -76
- package/es/components/UIShell/HeaderName.js +32 -44
- package/es/components/UIShell/HeaderNavigation.js +32 -37
- package/es/components/UIShell/HeaderPanel.js +74 -97
- package/es/components/UIShell/HeaderSideNavItems.js +27 -33
- package/es/components/UIShell/Link.js +29 -50
- package/es/components/UIShell/SideNav.js +132 -241
- package/es/components/UIShell/SideNavContext.js +21 -15
- package/es/components/UIShell/SideNavDetails.js +29 -34
- package/es/components/UIShell/SideNavDivider.js +21 -21
- package/es/components/UIShell/SideNavFooter.js +43 -52
- package/es/components/UIShell/SideNavHeader.js +26 -35
- package/es/components/UIShell/SideNavIcon.js +28 -33
- package/es/components/UIShell/SideNavItem.js +28 -33
- package/es/components/UIShell/SideNavItems.js +31 -40
- package/es/components/UIShell/SideNavLink.js +52 -79
- package/es/components/UIShell/SideNavLinkText.js +24 -25
- package/es/components/UIShell/SideNavMenu.js +102 -143
- package/es/components/UIShell/SideNavMenuItem.js +40 -52
- package/es/components/UIShell/SideNavSwitcher.js +59 -68
- package/es/components/UIShell/SkipToContent.js +28 -36
- package/es/components/UIShell/Switcher.js +69 -99
- package/es/components/UIShell/SwitcherDivider.js +16 -24
- package/es/components/UIShell/SwitcherItem.js +74 -114
- package/es/components/UnorderedList/UnorderedList.js +28 -37
- package/es/feature-flags.js +19 -10
- package/es/index.js +249 -242
- package/es/internal/FloatingMenu.js +246 -292
- package/es/internal/OptimizedResize.js +35 -46
- package/es/internal/Selection.js +99 -132
- package/es/internal/clamp.js +12 -4
- package/es/internal/defaultItemToString.js +15 -9
- package/es/internal/deprecateFieldOnObject.js +22 -14
- package/es/internal/environment.js +15 -7
- package/es/internal/getAnnouncement.js +16 -13
- package/es/internal/keyboard/keys.js +48 -48
- package/es/internal/keyboard/match.js +25 -42
- package/es/internal/keyboard/navigation.js +22 -27
- package/es/internal/noopFn.js +10 -2
- package/es/internal/useAttachedMenu.js +43 -51
- package/es/internal/useControllableState.js +43 -48
- package/es/internal/useDelayedState.js +30 -35
- package/es/internal/useEvent.js +39 -35
- package/es/internal/useId.js +51 -87
- package/es/internal/useIdPrefix.js +13 -5
- package/es/internal/useIsomorphicEffect.js +12 -4
- package/es/internal/useMatchMedia.js +29 -21
- package/es/internal/useMergedRefs.js +26 -22
- package/es/internal/useNoInteractiveChildren.js +70 -99
- package/es/internal/useNormalizedInputProps.js +47 -51
- package/es/internal/useOutsideClick.js +21 -24
- package/es/internal/useOverflowItems.js +89 -90
- package/es/internal/usePrefix.js +13 -5
- package/es/internal/usePresence.js +51 -54
- package/es/internal/usePresenceContext.js +35 -35
- package/es/internal/usePreviousValue.js +26 -18
- package/es/internal/useResizeObserver.js +57 -66
- package/es/internal/useSavedCallback.js +24 -17
- package/es/internal/utils.js +17 -9
- package/es/internal/warning.js +17 -22
- package/es/internal/wrapFocus.js +77 -98
- package/es/prop-types/AriaPropTypes.js +14 -6
- package/es/prop-types/deprecate.js +30 -27
- package/es/prop-types/deprecateComponent.js +17 -8
- package/es/prop-types/deprecateValuesWithin.js +18 -21
- package/es/prop-types/isRequiredOneOf.js +21 -24
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +14 -14
- package/es/tools/events.js +17 -21
- package/es/tools/mapPopoverAlign.js +19 -18
- package/es/tools/mergeRefs.js +14 -17
- package/es/tools/setupGetInstanceId.js +16 -8
- package/es/tools/toggleClass.js +17 -9
- package/es/tools/wrapComponent.js +34 -39
- package/icons/index.d.ts +2 -1
- package/icons/index.esm.js +2 -2
- package/icons/index.js +7 -10
- package/lib/_virtual/_rolldown/runtime.js +50 -0
- package/lib/components/AILabel/index.d.ts +29 -2
- package/lib/components/AILabel/index.js +118 -171
- package/lib/components/AISkeleton/AISkeletonIcon.js +27 -31
- package/lib/components/AISkeleton/AISkeletonPlaceholder.js +29 -31
- package/lib/components/AISkeleton/AISkeletonText.js +30 -43
- package/lib/components/Accordion/Accordion.Skeleton.js +59 -84
- package/lib/components/Accordion/Accordion.js +47 -65
- package/lib/components/Accordion/AccordionItem.js +106 -160
- package/lib/components/Accordion/AccordionProvider.js +20 -17
- package/lib/components/AspectRatio/AspectRatio.js +45 -51
- package/lib/components/BadgeIndicator/index.js +33 -39
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +43 -55
- package/lib/components/Breadcrumb/Breadcrumb.js +43 -55
- package/lib/components/Breadcrumb/BreadcrumbItem.js +84 -87
- package/lib/components/Button/Button.Skeleton.js +53 -63
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.js +149 -244
- package/lib/components/Button/ButtonBase.js +85 -108
- package/lib/components/Button/index.js +13 -15
- package/lib/components/ButtonSet/ButtonSet.js +78 -102
- package/lib/components/ButtonSet/index.js +12 -9
- package/lib/components/ChatButton/ChatButton.Skeleton.js +31 -31
- package/lib/components/ChatButton/ChatButton.js +68 -83
- package/lib/components/Checkbox/Checkbox.Skeleton.js +30 -30
- package/lib/components/Checkbox/Checkbox.js +119 -198
- package/lib/components/Checkbox/index.js +13 -11
- package/lib/components/CheckboxGroup/CheckboxGroup.js +104 -152
- package/lib/components/ClassPrefix/index.js +24 -19
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +49 -47
- package/lib/components/CodeSnippet/CodeSnippet.js +215 -303
- package/lib/components/ComboBox/ComboBox.js +626 -974
- package/lib/components/ComboBox/index.js +12 -9
- package/lib/components/ComboButton/index.js +176 -210
- package/lib/components/ComposedModal/ComposedModal.js +315 -454
- package/lib/components/ComposedModal/ComposedModalPresence.js +49 -44
- package/lib/components/ComposedModal/ModalFooter.js +131 -209
- package/lib/components/ComposedModal/ModalHeader.js +75 -103
- package/lib/components/ComposedModal/useComposedModalState.js +22 -17
- package/lib/components/ContainedList/ContainedList.js +77 -106
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +59 -71
- package/lib/components/ContainedList/ContainedListItem/index.js +12 -9
- package/lib/components/ContainedList/index.js +18 -15
- package/lib/components/ContentSwitcher/ContentSwitcher.js +112 -142
- package/lib/components/ContextMenu/useContextMenu.js +42 -40
- package/lib/components/Copy/Copy.js +101 -121
- package/lib/components/Copy/index.js +12 -9
- package/lib/components/CopyButton/CopyButton.js +85 -98
- package/lib/components/CopyButton/index.js +12 -9
- package/lib/components/DangerButton/DangerButton.js +19 -13
- package/lib/components/DataTable/DataTable.d.ts +11 -11
- package/lib/components/DataTable/DataTable.js +474 -655
- package/lib/components/DataTable/Table.js +115 -161
- package/lib/components/DataTable/TableActionList.js +15 -11
- package/lib/components/DataTable/TableBatchAction.js +28 -38
- package/lib/components/DataTable/TableBatchActions.js +82 -117
- package/lib/components/DataTable/TableBody.js +29 -23
- package/lib/components/DataTable/TableCell.js +35 -50
- package/lib/components/DataTable/TableContainer.js +79 -86
- package/lib/components/DataTable/TableContext.js +15 -8
- package/lib/components/DataTable/TableDecoratorRow.js +34 -40
- package/lib/components/DataTable/TableExpandHeader.js +57 -94
- package/lib/components/DataTable/TableExpandRow.js +86 -123
- package/lib/components/DataTable/TableExpandedRow.js +49 -55
- package/lib/components/DataTable/TableHead.js +8 -10
- package/lib/components/DataTable/TableHeader.js +142 -185
- package/lib/components/DataTable/TableRow.d.ts +1 -1
- package/lib/components/DataTable/TableRow.js +46 -80
- package/lib/components/DataTable/TableSelectAll.js +46 -74
- package/lib/components/DataTable/TableSelectRow.js +67 -102
- package/lib/components/DataTable/TableSlugRow.js +39 -47
- package/lib/components/DataTable/TableToolbar.js +37 -49
- package/lib/components/DataTable/TableToolbarAction.js +28 -24
- package/lib/components/DataTable/TableToolbarContent.js +15 -11
- package/lib/components/DataTable/TableToolbarMenu.js +39 -50
- package/lib/components/DataTable/TableToolbarSearch.js +101 -191
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +38 -47
- package/lib/components/DataTable/state/sortStates.js +11 -10
- package/lib/components/DataTable/state/sorting.js +54 -76
- package/lib/components/DataTable/tools/cells.js +15 -8
- package/lib/components/DataTable/tools/denormalize.js +27 -22
- package/lib/components/DataTable/tools/filter.js +21 -23
- package/lib/components/DataTable/tools/normalize.js +57 -76
- package/lib/components/DataTable/tools/sorting.js +50 -75
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +70 -98
- package/lib/components/DatePicker/DatePicker.Skeleton.js +48 -56
- package/lib/components/DatePicker/DatePicker.d.ts +4 -2
- package/lib/components/DatePicker/DatePicker.js +491 -753
- package/lib/components/DatePicker/DatePickerLocales.js +75 -127
- package/lib/components/DatePicker/index.js +13 -11
- package/lib/components/DatePicker/plugins/appendToPlugin.js +31 -46
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +127 -175
- package/lib/components/DatePicker/plugins/rangePlugin.d.ts +1 -1
- package/lib/components/DatePicker/plugins/rangePlugin.js +42 -49
- package/lib/components/DatePicker/utils.d.ts +7 -0
- package/lib/components/DatePicker/utils.js +19 -0
- package/lib/components/DatePickerInput/DatePickerInput.js +183 -293
- package/lib/components/DatePickerInput/index.js +12 -9
- package/lib/components/Dialog/Dialog.js +307 -576
- package/lib/components/Dialog/index.js +21 -13
- package/lib/components/Dropdown/Dropdown.Skeleton.js +30 -43
- package/lib/components/Dropdown/Dropdown.js +348 -539
- package/lib/components/Dropdown/index.js +13 -11
- package/lib/components/ErrorBoundary/ErrorBoundary.js +39 -62
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +15 -11
- package/lib/components/ExpandableSearch/ExpandableSearch.js +63 -73
- package/lib/components/ExpandableSearch/index.js +12 -9
- package/lib/components/FeatureFlags/index.d.ts +11 -2
- package/lib/components/FeatureFlags/index.js +82 -79
- package/lib/components/FileUploader/FileUploader.Skeleton.js +39 -35
- package/lib/components/FileUploader/FileUploader.js +273 -347
- package/lib/components/FileUploader/FileUploaderButton.js +114 -164
- package/lib/components/FileUploader/FileUploaderDropContainer.js +148 -225
- package/lib/components/FileUploader/FileUploaderItem.js +142 -161
- package/lib/components/FileUploader/Filename.d.ts +1 -1
- package/lib/components/FileUploader/Filename.js +56 -76
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +30 -32
- package/lib/components/FluidComboBox/FluidComboBox.js +58 -109
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +60 -57
- package/lib/components/FluidDatePicker/FluidDatePicker.js +50 -72
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +25 -20
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +30 -32
- package/lib/components/FluidDropdown/FluidDropdown.js +59 -115
- package/lib/components/FluidForm/FluidForm.js +33 -35
- package/lib/components/FluidForm/FormContext.js +13 -8
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +30 -32
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +71 -201
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +31 -34
- package/lib/components/FluidNumberInput/FluidNumberInput.js +67 -151
- package/lib/components/FluidSearch/FluidSearch.Skeleton.js +31 -34
- package/lib/components/FluidSearch/FluidSearch.js +45 -88
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +30 -32
- package/lib/components/FluidSelect/FluidSelect.js +44 -80
- package/lib/components/FluidSelect/index.js +13 -11
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +31 -34
- package/lib/components/FluidTextArea/FluidTextArea.js +52 -116
- package/lib/components/FluidTextInput/FluidPasswordInput.js +48 -103
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +31 -34
- package/lib/components/FluidTextInput/FluidTextInput.js +53 -108
- package/lib/components/FluidTextInput/index.js +14 -13
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +34 -37
- package/lib/components/FluidTimePicker/FluidTimePicker.js +72 -119
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +31 -51
- package/lib/components/Form/Form.js +27 -29
- package/lib/components/FormGroup/FormGroup.js +49 -71
- package/lib/components/FormItem/FormItem.js +27 -29
- package/lib/components/FormLabel/FormLabel.js +32 -38
- package/lib/components/Grid/CSSGrid.d.ts +1 -1
- package/lib/components/Grid/CSSGrid.js +89 -129
- package/lib/components/Grid/Column.js +196 -328
- package/lib/components/Grid/ColumnHang.js +32 -38
- package/lib/components/Grid/FlexGrid.js +44 -62
- package/lib/components/Grid/Grid.js +32 -44
- package/lib/components/Grid/GridContext.js +39 -44
- package/lib/components/Grid/Row.js +35 -53
- package/lib/components/Heading/index.js +39 -53
- package/lib/components/Icon/Icon.Skeleton.js +25 -23
- package/lib/components/IconButton/index.js +121 -180
- package/lib/components/IconIndicator/index.d.ts +1 -1
- package/lib/components/IconIndicator/index.js +63 -63
- package/lib/components/IdPrefix/index.js +24 -19
- package/lib/components/InlineCheckbox/InlineCheckbox.js +72 -117
- package/lib/components/InlineCheckbox/index.js +12 -9
- package/lib/components/InlineLoading/InlineLoading.js +87 -104
- package/lib/components/InlineLoading/index.js +12 -9
- package/lib/components/Layer/LayerContext.js +14 -6
- package/lib/components/Layer/LayerLevel.js +20 -6
- package/lib/components/Layer/index.js +58 -68
- package/lib/components/Layout/index.js +81 -111
- package/lib/components/LayoutDirection/LayoutDirection.d.ts +1 -1
- package/lib/components/LayoutDirection/LayoutDirection.js +36 -40
- package/lib/components/LayoutDirection/LayoutDirectionContext.js +14 -8
- package/lib/components/LayoutDirection/useLayoutDirection.js +16 -9
- package/lib/components/Link/Link.js +67 -112
- package/lib/components/Link/index.js +12 -9
- package/lib/components/ListBox/ListBox.js +82 -130
- package/lib/components/ListBox/ListBoxField.js +33 -47
- package/lib/components/ListBox/ListBoxMenu.js +39 -46
- package/lib/components/ListBox/ListBoxMenuIcon.js +43 -44
- package/lib/components/ListBox/ListBoxMenuItem.js +71 -92
- package/lib/components/ListBox/ListBoxPropTypes.js +21 -9
- package/lib/components/ListBox/ListBoxSelection.js +75 -100
- package/lib/components/ListBox/index.js +17 -21
- package/lib/components/ListBox/next/ListBoxSelection.js +83 -121
- package/lib/components/ListBox/next/ListBoxTrigger.js +48 -52
- package/lib/components/ListItem/ListItem.js +29 -32
- package/lib/components/Loading/Loading.js +68 -77
- package/lib/components/Loading/index.js +12 -9
- package/lib/components/Menu/Menu.js +224 -365
- package/lib/components/Menu/MenuContext.d.ts +1 -1
- package/lib/components/Menu/MenuContext.js +42 -40
- package/lib/components/Menu/MenuItem.js +286 -415
- package/lib/components/MenuButton/index.js +138 -197
- package/lib/components/Modal/Modal.js +504 -665
- package/lib/components/Modal/ModalPresence.js +41 -39
- package/lib/components/Modal/index.js +13 -10
- package/lib/components/ModalWrapper/ModalWrapper.d.ts +2 -2
- package/lib/components/ModalWrapper/ModalWrapper.js +112 -134
- package/lib/components/MultiSelect/FilterableMultiSelect.js +611 -920
- package/lib/components/MultiSelect/MultiSelect.js +459 -718
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +15 -32
- package/lib/components/MultiSelect/filter.js +14 -10
- package/lib/components/MultiSelect/tools/sorting.js +21 -35
- package/lib/components/Notification/Notification.js +514 -787
- package/lib/components/NumberInput/NumberFormatPropTypes.js +72 -33
- package/lib/components/NumberInput/NumberInput.Skeleton.js +33 -37
- package/lib/components/NumberInput/NumberInput.js +571 -950
- package/lib/components/OrderedList/OrderedList.js +35 -48
- package/lib/components/OverflowMenu/OverflowMenu.js +341 -454
- package/lib/components/OverflowMenu/index.js +27 -21
- package/lib/components/OverflowMenu/next/index.js +158 -188
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +104 -164
- package/lib/components/OverflowMenuItem/index.js +12 -9
- package/lib/components/OverflowMenuV2/index.js +25 -15
- package/lib/components/PageHeader/PageHeader.js +301 -444
- package/lib/components/PageHeader/index.js +27 -19
- package/lib/components/Pagination/Pagination.Skeleton.js +38 -37
- package/lib/components/Pagination/Pagination.d.ts +1 -1
- package/lib/components/Pagination/Pagination.js +256 -360
- package/lib/components/Pagination/experimental/PageSelector.js +48 -58
- package/lib/components/Pagination/experimental/Pagination-story.d.ts +114 -0
- package/lib/components/Pagination/experimental/Pagination.js +148 -200
- package/lib/components/PaginationNav/PaginationNav.js +324 -430
- package/lib/components/Popover/index.js +323 -440
- package/lib/components/PrimaryButton/PrimaryButton.js +19 -13
- package/lib/components/ProgressBar/ProgressBar.js +121 -147
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +46 -43
- package/lib/components/ProgressIndicator/ProgressIndicator.js +150 -245
- package/lib/components/RadioButton/RadioButton.Skeleton.js +27 -27
- package/lib/components/RadioButton/RadioButton.js +105 -178
- package/lib/components/RadioButton/index.js +12 -9
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +139 -211
- package/lib/components/RadioTile/RadioTile.js +108 -172
- package/lib/components/RadioTile/index.js +12 -9
- package/lib/components/Search/Search.Skeleton.js +32 -38
- package/lib/components/Search/Search.js +185 -281
- package/lib/components/Search/index.js +13 -11
- package/lib/components/Search/utils.js +11 -4
- package/lib/components/SecondaryButton/SecondaryButton.js +19 -13
- package/lib/components/Select/Select.Skeleton.js +31 -35
- package/lib/components/Select/Select.js +182 -261
- package/lib/components/Select/index.js +13 -11
- package/lib/components/SelectItem/SelectItem.js +37 -52
- package/lib/components/SelectItem/index.js +12 -9
- package/lib/components/SelectItemGroup/SelectItemGroup.js +31 -41
- package/lib/components/ShapeIndicator/index.d.ts +1 -1
- package/lib/components/ShapeIndicator/index.js +78 -83
- package/lib/components/SkeletonIcon/SkeletonIcon.js +25 -28
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +25 -28
- package/lib/components/SkeletonText/SkeletonText.js +71 -85
- package/lib/components/SkeletonText/index.js +12 -9
- package/lib/components/Slider/Slider.Skeleton.js +72 -95
- package/lib/components/Slider/Slider.js +868 -1319
- package/lib/components/Slider/SliderHandles.js +75 -68
- package/lib/components/Stack/HStack.js +22 -14
- package/lib/components/Stack/Stack.js +60 -82
- package/lib/components/Stack/VStack.js +22 -14
- package/lib/components/StructuredList/StructuredList.Skeleton.js +59 -52
- package/lib/components/StructuredList/StructuredList.js +182 -319
- package/lib/components/Switch/IconSwitch.js +103 -149
- package/lib/components/Switch/Switch.js +70 -103
- package/lib/components/TabContent/TabContent.js +32 -38
- package/lib/components/Tabs/Tabs.Skeleton.js +45 -41
- package/lib/components/Tabs/Tabs.js +738 -1151
- package/lib/components/Tabs/usePressable.js +98 -114
- package/lib/components/Tag/DismissibleTag.js +123 -160
- package/lib/components/Tag/OperationalTag.js +95 -115
- package/lib/components/Tag/SelectableTag.js +98 -133
- package/lib/components/Tag/Tag.Skeleton.js +30 -32
- package/lib/components/Tag/Tag.js +156 -204
- package/lib/components/Tag/isEllipsisActive.js +13 -9
- package/lib/components/Text/Text.js +69 -81
- package/lib/components/Text/TextDirection.js +39 -39
- package/lib/components/Text/TextDirectionContext.js +15 -10
- package/lib/components/Text/createTextComponent.js +29 -22
- package/lib/components/TextArea/TextArea.Skeleton.js +29 -34
- package/lib/components/TextArea/TextArea.js +319 -426
- package/lib/components/TextArea/index.js +13 -11
- package/lib/components/TextInput/ControlledPasswordInput.js +137 -202
- package/lib/components/TextInput/PasswordInput.js +200 -307
- package/lib/components/TextInput/TextInput.Skeleton.js +28 -33
- package/lib/components/TextInput/TextInput.js +223 -321
- package/lib/components/TextInput/index.js +13 -11
- package/lib/components/TextInput/util.js +21 -26
- package/lib/components/Theme/index.js +83 -97
- package/lib/components/Tile/Tile.d.ts +2 -2
- package/lib/components/Tile/Tile.js +398 -590
- package/lib/components/TileGroup/TileGroup.js +73 -113
- package/lib/components/TimePicker/TimePicker.d.ts +1 -1
- package/lib/components/TimePicker/TimePicker.js +152 -251
- package/lib/components/TimePickerSelect/TimePickerSelect.js +47 -62
- package/lib/components/Toggle/Toggle.Skeleton.js +28 -24
- package/lib/components/Toggle/Toggle.js +106 -176
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +50 -53
- package/lib/components/Toggletip/index.d.ts +2 -2
- package/lib/components/Toggletip/index.js +174 -258
- package/lib/components/Tooltip/DefinitionTooltip.js +102 -140
- package/lib/components/Tooltip/Tooltip.js +192 -265
- package/lib/components/TreeView/TreeContext.js +14 -7
- package/lib/components/TreeView/TreeNode.js +365 -504
- package/lib/components/TreeView/TreeView.js +169 -242
- package/lib/components/UIShell/Content.js +27 -34
- package/lib/components/UIShell/Header.js +29 -33
- package/lib/components/UIShell/HeaderContainer.js +34 -44
- package/lib/components/UIShell/HeaderGlobalAction.js +69 -94
- package/lib/components/UIShell/HeaderGlobalBar.js +17 -14
- package/lib/components/UIShell/HeaderMenu.js +146 -221
- package/lib/components/UIShell/HeaderMenuButton.js +47 -70
- package/lib/components/UIShell/HeaderMenuItem.js +53 -80
- package/lib/components/UIShell/HeaderName.js +36 -48
- package/lib/components/UIShell/HeaderNavigation.js +36 -41
- package/lib/components/UIShell/HeaderPanel.js +78 -101
- package/lib/components/UIShell/HeaderSideNavItems.js +31 -37
- package/lib/components/UIShell/Link.js +32 -54
- package/lib/components/UIShell/SideNav.js +136 -245
- package/lib/components/UIShell/SideNavContext.js +23 -17
- package/lib/components/UIShell/SideNavDetails.js +33 -38
- package/lib/components/UIShell/SideNavDivider.js +25 -25
- package/lib/components/UIShell/SideNavFooter.js +47 -56
- package/lib/components/UIShell/SideNavHeader.js +30 -39
- package/lib/components/UIShell/SideNavIcon.js +32 -37
- package/lib/components/UIShell/SideNavItem.js +32 -37
- package/lib/components/UIShell/SideNavItems.js +35 -44
- package/lib/components/UIShell/SideNavLink.js +56 -83
- package/lib/components/UIShell/SideNavLinkText.js +28 -29
- package/lib/components/UIShell/SideNavMenu.js +106 -148
- package/lib/components/UIShell/SideNavMenuItem.js +44 -56
- package/lib/components/UIShell/SideNavSwitcher.js +63 -72
- package/lib/components/UIShell/SkipToContent.js +32 -40
- package/lib/components/UIShell/Switcher.js +73 -103
- package/lib/components/UIShell/SwitcherDivider.js +26 -28
- package/lib/components/UIShell/SwitcherItem.js +78 -118
- package/lib/components/UnorderedList/UnorderedList.js +32 -41
- package/lib/feature-flags.js +21 -13
- package/lib/index.js +622 -602
- package/lib/internal/FloatingMenu.js +249 -296
- package/lib/internal/OptimizedResize.js +35 -47
- package/lib/internal/Selection.js +102 -134
- package/lib/internal/clamp.js +12 -5
- package/lib/internal/defaultItemToString.js +15 -10
- package/lib/internal/deprecateFieldOnObject.js +23 -16
- package/lib/internal/environment.js +15 -8
- package/lib/internal/getAnnouncement.js +16 -14
- package/lib/internal/keyboard/keys.js +48 -49
- package/lib/internal/keyboard/match.js +25 -43
- package/lib/internal/keyboard/navigation.js +22 -29
- package/lib/internal/noopFn.js +10 -3
- package/lib/internal/useAttachedMenu.js +44 -53
- package/lib/internal/useControllableState.js +44 -50
- package/lib/internal/useDelayedState.js +31 -37
- package/lib/internal/useEvent.js +40 -37
- package/lib/internal/useId.js +54 -91
- package/lib/internal/useIdPrefix.js +15 -7
- package/lib/internal/useIsomorphicEffect.js +13 -8
- package/lib/internal/useMatchMedia.js +30 -23
- package/lib/internal/useMergedRefs.js +27 -24
- package/lib/internal/useNoInteractiveChildren.js +73 -101
- package/lib/internal/useNormalizedInputProps.js +55 -53
- package/lib/internal/useOutsideClick.js +22 -26
- package/lib/internal/useOverflowItems.js +90 -94
- package/lib/internal/usePrefix.js +15 -7
- package/lib/internal/usePresence.js +52 -56
- package/lib/internal/usePresenceContext.js +36 -37
- package/lib/internal/usePreviousValue.js +27 -20
- package/lib/internal/useResizeObserver.js +58 -68
- package/lib/internal/useSavedCallback.js +25 -19
- package/lib/internal/utils.js +18 -11
- package/lib/internal/warning.js +24 -23
- package/lib/internal/wrapFocus.js +78 -100
- package/lib/prop-types/AriaPropTypes.js +17 -9
- package/lib/prop-types/deprecate.js +30 -29
- package/lib/prop-types/deprecateComponent.js +17 -10
- package/lib/prop-types/deprecateValuesWithin.js +18 -23
- package/lib/prop-types/isRequiredOneOf.js +21 -25
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +14 -15
- package/lib/tools/events.js +17 -22
- package/lib/tools/mapPopoverAlign.js +19 -19
- package/lib/tools/mergeRefs.js +14 -18
- package/lib/tools/setupGetInstanceId.js +16 -9
- package/lib/tools/toggleClass.js +17 -10
- package/lib/tools/wrapComponent.js +38 -43
- package/package.json +10 -16
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -40
- package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +0 -54
- package/es/node_modules/es-toolkit/dist/compat/function/debounce.js +0 -55
- package/es/node_modules/es-toolkit/dist/compat/function/throttle.js +0 -23
- package/es/node_modules/es-toolkit/dist/function/debounce.js +0 -70
- package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -45
- package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +0 -54
- package/lib/node_modules/es-toolkit/dist/compat/function/debounce.js +0 -57
- package/lib/node_modules/es-toolkit/dist/compat/function/throttle.js +0 -25
- package/lib/node_modules/es-toolkit/dist/function/debounce.js +0 -72
|
@@ -1,562 +1,432 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
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.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { getNextSortState } from
|
|
13
|
-
import
|
|
14
|
-
import denormalize from
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
8
|
+
import { setupGetInstanceId } from "../../tools/setupGetInstanceId.js";
|
|
9
|
+
import { deprecate } from "../../prop-types/deprecate.js";
|
|
10
|
+
import { composeEventHandlers } from "../../tools/events.js";
|
|
11
|
+
import { getCellId } from "./tools/cells.js";
|
|
12
|
+
import { getNextSortState } from "./state/sorting.js";
|
|
13
|
+
import getDerivedStateFromProps from "./state/getDerivedStateFromProps.js";
|
|
14
|
+
import denormalize from "./tools/denormalize.js";
|
|
15
|
+
import { defaultFilterRows } from "./tools/filter.js";
|
|
16
|
+
import Table from "./Table.js";
|
|
17
|
+
import TableActionList from "./TableActionList.js";
|
|
18
|
+
import TableBatchAction from "./TableBatchAction.js";
|
|
19
|
+
import TableBatchActions from "./TableBatchActions.js";
|
|
20
|
+
import TableBody from "./TableBody.js";
|
|
21
|
+
import TableCell from "./TableCell.js";
|
|
22
|
+
import TableContainer from "./TableContainer.js";
|
|
23
|
+
import TableDecoratorRow from "./TableDecoratorRow.js";
|
|
24
|
+
import TableExpandHeader from "./TableExpandHeader.js";
|
|
25
|
+
import TableSlugRow from "./TableSlugRow.js";
|
|
26
|
+
import TableExpandRow from "./TableExpandRow.js";
|
|
27
|
+
import TableExpandedRow from "./TableExpandedRow.js";
|
|
28
|
+
import TableHead from "./TableHead.js";
|
|
29
|
+
import TableHeader from "./TableHeader.js";
|
|
30
|
+
import TableRow from "./TableRow.js";
|
|
31
|
+
import TableSelectAll from "./TableSelectAll.js";
|
|
32
|
+
import TableSelectRow from "./TableSelectRow.js";
|
|
33
|
+
import TableToolbar from "./TableToolbar.js";
|
|
34
|
+
import TableToolbarAction from "./TableToolbarAction.js";
|
|
35
|
+
import TableToolbarContent from "./TableToolbarContent.js";
|
|
36
|
+
import TableToolbarSearch from "./TableToolbarSearch.js";
|
|
37
|
+
import TableToolbarMenu from "./TableToolbarMenu.js";
|
|
38
|
+
import { useEffect, useMemo, useState } from "react";
|
|
39
|
+
import PropTypes from "prop-types";
|
|
40
|
+
import isEqual from "react-fast-compare";
|
|
41
41
|
|
|
42
|
+
//#region src/components/DataTable/DataTable.tsx
|
|
43
|
+
/**
|
|
44
|
+
* Copyright IBM Corp. 2016, 2026
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/
|
|
42
49
|
const getInstanceId = setupGetInstanceId();
|
|
43
50
|
const translationIds = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
"carbon.table.row.expand": "carbon.table.row.expand",
|
|
52
|
+
"carbon.table.row.collapse": "carbon.table.row.collapse",
|
|
53
|
+
"carbon.table.all.expand": "carbon.table.all.expand",
|
|
54
|
+
"carbon.table.all.collapse": "carbon.table.all.collapse",
|
|
55
|
+
"carbon.table.all.select": "carbon.table.all.select",
|
|
56
|
+
"carbon.table.all.unselect": "carbon.table.all.unselect",
|
|
57
|
+
"carbon.table.row.select": "carbon.table.row.select",
|
|
58
|
+
"carbon.table.row.unselect": "carbon.table.row.unselect"
|
|
52
59
|
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Message IDs that will be passed to translateWithId().
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
60
|
const defaultTranslations = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
[translationIds["carbon.table.all.expand"]]: "Expand all rows",
|
|
62
|
+
[translationIds["carbon.table.all.collapse"]]: "Collapse all rows",
|
|
63
|
+
[translationIds["carbon.table.row.expand"]]: "Expand current row",
|
|
64
|
+
[translationIds["carbon.table.row.collapse"]]: "Collapse current row",
|
|
65
|
+
[translationIds["carbon.table.all.select"]]: "Select all rows",
|
|
66
|
+
[translationIds["carbon.table.all.unselect"]]: "Unselect all rows",
|
|
67
|
+
[translationIds["carbon.table.row.select"]]: "Select row",
|
|
68
|
+
[translationIds["carbon.table.row.unselect"]]: "Unselect row"
|
|
67
69
|
};
|
|
68
|
-
const defaultTranslateWithId = messageId => {
|
|
69
|
-
|
|
70
|
+
const defaultTranslateWithId = (messageId) => {
|
|
71
|
+
return defaultTranslations[messageId];
|
|
70
72
|
};
|
|
71
|
-
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
73
|
-
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
75
|
-
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
77
|
-
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
79
|
-
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
81
|
-
|
|
82
73
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
const selectedRows = prev.rowIds.filter(id => prev.rowsById[id].isSelected).length;
|
|
443
|
-
// Predict the length of the selected rows after this change occurs
|
|
444
|
-
const selectedRowsCount = !row.isSelected ? selectedRows + 1 : selectedRows - 1;
|
|
445
|
-
return {
|
|
446
|
-
...prev,
|
|
447
|
-
// Show batch action toolbar if selecting, or if there are other
|
|
448
|
-
// selected rows remaining.
|
|
449
|
-
shouldShowBatchActions: !row.isSelected || selectedRowsCount > 0,
|
|
450
|
-
rowsById: {
|
|
451
|
-
...prev.rowsById,
|
|
452
|
-
[rowId]: {
|
|
453
|
-
...row,
|
|
454
|
-
isSelected: !row.isSelected
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
});
|
|
459
|
-
};
|
|
460
|
-
const handleOnExpandRow = rowId => () => {
|
|
461
|
-
setState(prev => {
|
|
462
|
-
const row = prev.rowsById[rowId];
|
|
463
|
-
const {
|
|
464
|
-
isExpandedAll
|
|
465
|
-
} = prev;
|
|
466
|
-
return {
|
|
467
|
-
...prev,
|
|
468
|
-
isExpandedAll: row.isExpanded ? false : isExpandedAll,
|
|
469
|
-
rowsById: {
|
|
470
|
-
...prev.rowsById,
|
|
471
|
-
[rowId]: {
|
|
472
|
-
...row,
|
|
473
|
-
isExpanded: !row.isExpanded
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
});
|
|
478
|
-
};
|
|
479
|
-
const handleOnExpandAll = () => {
|
|
480
|
-
setState(prev => {
|
|
481
|
-
const {
|
|
482
|
-
rowIds,
|
|
483
|
-
isExpandedAll
|
|
484
|
-
} = prev;
|
|
485
|
-
return {
|
|
486
|
-
...prev,
|
|
487
|
-
isExpandedAll: !isExpandedAll,
|
|
488
|
-
rowsById: rowIds.reduce((acc, id) => {
|
|
489
|
-
acc[id] = {
|
|
490
|
-
...prev.rowsById[id],
|
|
491
|
-
isExpanded: !isExpandedAll
|
|
492
|
-
};
|
|
493
|
-
return acc;
|
|
494
|
-
}, {})
|
|
495
|
-
};
|
|
496
|
-
});
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Transitions to the next sort state of the table.
|
|
501
|
-
*/
|
|
502
|
-
const handleSortBy = headerKey => () => {
|
|
503
|
-
setState(prev => {
|
|
504
|
-
const sortState = getNextSortState(props, prev, {
|
|
505
|
-
key: headerKey
|
|
506
|
-
});
|
|
507
|
-
return {
|
|
508
|
-
...prev,
|
|
509
|
-
// Preserve ALL existing state
|
|
510
|
-
...sortState // Then apply only the sorting changes
|
|
511
|
-
};
|
|
512
|
-
});
|
|
513
|
-
};
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* Event handler for table filter input changes.
|
|
517
|
-
*/
|
|
518
|
-
const handleOnInputValueChange = (event, defaultValue) => {
|
|
519
|
-
// TODO: Remove `''` sentinel support once `TableToolbarSearch` no
|
|
520
|
-
// longer emits it on mount.
|
|
521
|
-
const value = defaultValue ?? (event === '' ? event : event.target.value);
|
|
522
|
-
setState(prev => ({
|
|
523
|
-
...prev,
|
|
524
|
-
filterInputValue: value
|
|
525
|
-
}));
|
|
526
|
-
};
|
|
527
|
-
const renderProps = {
|
|
528
|
-
// Data derived from state
|
|
529
|
-
rows: denormalize(filteredRowIds, state.rowsById, state.cellsById),
|
|
530
|
-
headers: headers,
|
|
531
|
-
selectedRows: denormalize(selectedRows, state.rowsById, state.cellsById),
|
|
532
|
-
// Prop accessors/getters
|
|
533
|
-
getHeaderProps,
|
|
534
|
-
getExpandHeaderProps,
|
|
535
|
-
getRowProps,
|
|
536
|
-
getExpandedRowProps,
|
|
537
|
-
getSelectionProps,
|
|
538
|
-
getToolbarProps,
|
|
539
|
-
getBatchActionProps,
|
|
540
|
-
getTableProps,
|
|
541
|
-
getTableContainerProps,
|
|
542
|
-
getCellProps,
|
|
543
|
-
// Custom event handlers
|
|
544
|
-
onInputChange: handleOnInputValueChange,
|
|
545
|
-
// Expose internal state change actions
|
|
546
|
-
sortBy: headerKey => handleSortBy(headerKey)(),
|
|
547
|
-
selectAll: handleSelectAll,
|
|
548
|
-
selectRow: rowId => handleOnSelectRow(rowId)(),
|
|
549
|
-
expandRow: rowId => handleOnExpandRow(rowId)(),
|
|
550
|
-
expandAll: handleOnExpandAll,
|
|
551
|
-
radio: radio
|
|
552
|
-
};
|
|
553
|
-
if (typeof render !== 'undefined') {
|
|
554
|
-
return render(renderProps);
|
|
555
|
-
}
|
|
556
|
-
if (typeof children !== 'undefined') {
|
|
557
|
-
return children(renderProps);
|
|
558
|
-
}
|
|
559
|
-
return null;
|
|
74
|
+
* DataTable components are used to represent a collection of resources,
|
|
75
|
+
* displaying a subset of their fields in columns, or headers. We prioritize
|
|
76
|
+
* direct updates to the state of what we're rendering, so internally we
|
|
77
|
+
* normalize the given data and then denormalize it at render time. Each part of
|
|
78
|
+
* the DataTable is accessible through look-up by ID, and updating the state of
|
|
79
|
+
* a single entity cascades updates to the consumer.
|
|
80
|
+
*/
|
|
81
|
+
const DataTable = (props) => {
|
|
82
|
+
const { children, filterRows = defaultFilterRows, headers, render, translateWithId: t = defaultTranslateWithId, size, isSortable, useZebraStyles, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, radio, rows } = props;
|
|
83
|
+
const instanceId = useMemo(() => getInstanceId(), []);
|
|
84
|
+
const [state, setState] = useState(() => ({
|
|
85
|
+
...getDerivedStateFromProps(props, {}),
|
|
86
|
+
isExpandedAll: false
|
|
87
|
+
}));
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const nextRowIds = rows.map((row) => row.id);
|
|
90
|
+
const nextHeaders = headers.map((header) => header.key);
|
|
91
|
+
const hasRowIdsChanged = !isEqual(nextRowIds, state.rowIds);
|
|
92
|
+
const hasHeadersChanged = !isEqual(nextHeaders, Array.from(new Set(Object.keys(state.cellsById).map((id) => id.split(":")[1]))));
|
|
93
|
+
const hasRowsChanged = !isEqual(rows, state.rowIds.map((id) => {
|
|
94
|
+
const row = state.rowsById[id];
|
|
95
|
+
return {
|
|
96
|
+
id: row.id,
|
|
97
|
+
disabled: row.disabled,
|
|
98
|
+
isExpanded: row.isExpanded,
|
|
99
|
+
isSelected: row.isSelected
|
|
100
|
+
};
|
|
101
|
+
}));
|
|
102
|
+
if (hasRowIdsChanged || hasHeadersChanged || hasRowsChanged) setState((prev) => getDerivedStateFromProps(props, prev));
|
|
103
|
+
}, [headers, rows]);
|
|
104
|
+
const getHeaderProps = ({ header, onClick, isSortable: headerIsSortable, ...rest }) => {
|
|
105
|
+
const { sortDirection, sortHeaderKey } = state;
|
|
106
|
+
const { key, slug, decorator } = header;
|
|
107
|
+
return {
|
|
108
|
+
...rest,
|
|
109
|
+
key,
|
|
110
|
+
sortDirection,
|
|
111
|
+
isSortable: headerIsSortable ?? header.isSortable ?? isSortable,
|
|
112
|
+
isSortHeader: sortHeaderKey === key,
|
|
113
|
+
slug,
|
|
114
|
+
decorator,
|
|
115
|
+
onClick: (event) => {
|
|
116
|
+
const nextSortState = getNextSortState(props, state, { key });
|
|
117
|
+
setState((prev) => ({
|
|
118
|
+
...prev,
|
|
119
|
+
...nextSortState
|
|
120
|
+
}));
|
|
121
|
+
if (onClick) handleOnHeaderClick(onClick, {
|
|
122
|
+
sortHeaderKey: key,
|
|
123
|
+
sortDirection: nextSortState.sortDirection
|
|
124
|
+
})(event);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const getExpandHeaderProps = ({ onClick, onExpand, ...rest } = {}) => {
|
|
129
|
+
const { isExpandedAll, rowIds, rowsById } = state;
|
|
130
|
+
const isExpanded = isExpandedAll || rowIds.every((id) => rowsById[id].isExpanded);
|
|
131
|
+
const translationKey = isExpanded ? translationIds["carbon.table.all.collapse"] : translationIds["carbon.table.all.expand"];
|
|
132
|
+
const handlers = [handleOnExpandAll, onExpand];
|
|
133
|
+
if (onClick) handlers.push(handleOnExpandHeaderClick(onClick, { isExpanded }));
|
|
134
|
+
return {
|
|
135
|
+
...rest,
|
|
136
|
+
"aria-label": t(translationKey),
|
|
137
|
+
"aria-controls": rowIds.map((id) => `${getTablePrefix()}-expanded-row-${id}`).join(" "),
|
|
138
|
+
isExpanded,
|
|
139
|
+
onExpand: composeEventHandlers(handlers),
|
|
140
|
+
id: `${getTablePrefix()}-expand`
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Wraps the consumer's `onClick` with sorting metadata.
|
|
145
|
+
*/
|
|
146
|
+
const handleOnHeaderClick = (onClick, sortParams) => {
|
|
147
|
+
return (event) => onClick(event, sortParams);
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Wraps the consumer's `onClick` with sorting metadata.
|
|
151
|
+
*/
|
|
152
|
+
const handleOnExpandHeaderClick = (onClick, expandParams) => {
|
|
153
|
+
return (event) => onClick(event, expandParams);
|
|
154
|
+
};
|
|
155
|
+
const getRowProps = ({ row, onClick, ...rest }) => {
|
|
156
|
+
const translationKey = row.isExpanded ? translationIds["carbon.table.row.collapse"] : translationIds["carbon.table.row.expand"];
|
|
157
|
+
return {
|
|
158
|
+
...rest,
|
|
159
|
+
key: row.id,
|
|
160
|
+
onClick,
|
|
161
|
+
onExpand: composeEventHandlers([handleOnExpandRow(row.id), onClick]),
|
|
162
|
+
isExpanded: row.isExpanded,
|
|
163
|
+
"aria-label": t(translationKey),
|
|
164
|
+
"aria-controls": `${getTablePrefix()}-expanded-row-${row.id}`,
|
|
165
|
+
isSelected: row.isSelected,
|
|
166
|
+
disabled: row.disabled,
|
|
167
|
+
expandHeader: `${getTablePrefix()}-expand`
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
const getExpandedRowProps = ({ row, ...rest }) => {
|
|
171
|
+
return {
|
|
172
|
+
...rest,
|
|
173
|
+
id: `${getTablePrefix()}-expanded-row-${row.id}`
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Gets the props associated with selection for a header or a row.
|
|
178
|
+
*/
|
|
179
|
+
const getSelectionProps = ({ onClick, row, ...rest } = {}) => {
|
|
180
|
+
if (row) {
|
|
181
|
+
const translationKey = row.isSelected ? translationIds["carbon.table.row.unselect"] : translationIds["carbon.table.row.select"];
|
|
182
|
+
return {
|
|
183
|
+
...rest,
|
|
184
|
+
checked: row.isSelected,
|
|
185
|
+
onSelect: composeEventHandlers([handleOnSelectRow(row.id), onClick]),
|
|
186
|
+
id: `${getTablePrefix()}__select-row-${row.id}`,
|
|
187
|
+
name: `select-row-${instanceId}`,
|
|
188
|
+
"aria-label": t(translationKey),
|
|
189
|
+
disabled: row.disabled,
|
|
190
|
+
radio
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const rowCount = state.rowIds.length;
|
|
194
|
+
const selectedRowCount = selectedRows.length;
|
|
195
|
+
const checked = rowCount > 0 && selectedRowCount === rowCount;
|
|
196
|
+
const indeterminate = rowCount > 0 && selectedRowCount > 0 && selectedRowCount !== rowCount;
|
|
197
|
+
const translationKey = checked || indeterminate ? translationIds["carbon.table.all.unselect"] : translationIds["carbon.table.all.select"];
|
|
198
|
+
return {
|
|
199
|
+
...rest,
|
|
200
|
+
"aria-label": t(translationKey),
|
|
201
|
+
checked,
|
|
202
|
+
id: `${getTablePrefix()}__select-all`,
|
|
203
|
+
indeterminate,
|
|
204
|
+
name: `select-all-${instanceId}`,
|
|
205
|
+
onSelect: composeEventHandlers([handleSelectAll, onClick])
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
const getToolbarProps = (props) => {
|
|
209
|
+
const isSmall = size === "xs" || size === "sm";
|
|
210
|
+
return {
|
|
211
|
+
...props,
|
|
212
|
+
size: isSmall ? "sm" : void 0
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
const getBatchActionProps = (props) => {
|
|
216
|
+
const { shouldShowBatchActions } = state;
|
|
217
|
+
const selectedRowCount = selectedRows.length;
|
|
218
|
+
return {
|
|
219
|
+
onSelectAll: void 0,
|
|
220
|
+
totalCount: state.rowIds.length,
|
|
221
|
+
...props,
|
|
222
|
+
shouldShowBatchActions: shouldShowBatchActions && selectedRowCount > 0,
|
|
223
|
+
totalSelected: selectedRowCount,
|
|
224
|
+
onCancel: handleOnCancel
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
const getTableProps = () => {
|
|
228
|
+
return {
|
|
229
|
+
useZebraStyles,
|
|
230
|
+
size: size ?? "lg",
|
|
231
|
+
isSortable,
|
|
232
|
+
useStaticWidth,
|
|
233
|
+
stickyHeader,
|
|
234
|
+
overflowMenuOnHover: overflowMenuOnHover ?? false,
|
|
235
|
+
experimentalAutoAlign
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
const getTableContainerProps = () => {
|
|
239
|
+
return {
|
|
240
|
+
stickyHeader,
|
|
241
|
+
useStaticWidth
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
const getCellProps = ({ cell: { hasAILabelHeader, id }, ...rest }) => {
|
|
245
|
+
return {
|
|
246
|
+
...rest,
|
|
247
|
+
hasAILabelHeader,
|
|
248
|
+
key: id
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Selected row IDs, excluding disabled rows.
|
|
253
|
+
*/
|
|
254
|
+
const selectedRows = state.rowIds.filter((id) => {
|
|
255
|
+
const row = state.rowsById[id];
|
|
256
|
+
return row.isSelected && !row.disabled;
|
|
257
|
+
});
|
|
258
|
+
const filteredRowIds = typeof state.filterInputValue === "string" ? filterRows({
|
|
259
|
+
cellsById: state.cellsById,
|
|
260
|
+
getCellId,
|
|
261
|
+
headers,
|
|
262
|
+
inputValue: state.filterInputValue,
|
|
263
|
+
rowIds: state.rowIds
|
|
264
|
+
}) : state.rowIds;
|
|
265
|
+
/**
|
|
266
|
+
* Generates a prefix for table related IDs.
|
|
267
|
+
*/
|
|
268
|
+
const getTablePrefix = () => `data-table-${instanceId}`;
|
|
269
|
+
/**
|
|
270
|
+
* Generates a new `rowsById` object with updated selection state.
|
|
271
|
+
*/
|
|
272
|
+
const getUpdatedSelectionState = (initialState, isSelected) => {
|
|
273
|
+
const { rowIds } = initialState;
|
|
274
|
+
const isFiltered = rowIds.length !== filteredRowIds.length;
|
|
275
|
+
return { rowsById: rowIds.reduce((acc, id) => {
|
|
276
|
+
const row = { ...initialState.rowsById[id] };
|
|
277
|
+
if (!row.disabled && (!isFiltered || filteredRowIds.includes(id))) row.isSelected = isSelected;
|
|
278
|
+
acc[id] = row;
|
|
279
|
+
return acc;
|
|
280
|
+
}, {}) };
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Handler for `onCancel` to hide the batch action toolbar and deselect all
|
|
284
|
+
* rows.
|
|
285
|
+
*/
|
|
286
|
+
const handleOnCancel = () => {
|
|
287
|
+
setState((prev) => {
|
|
288
|
+
return {
|
|
289
|
+
...prev,
|
|
290
|
+
shouldShowBatchActions: false,
|
|
291
|
+
...getUpdatedSelectionState(prev, false)
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Handler for toggling the selection state of all rows.
|
|
297
|
+
*/
|
|
298
|
+
const handleSelectAll = () => {
|
|
299
|
+
setState((prev) => {
|
|
300
|
+
const { rowsById } = prev;
|
|
301
|
+
const isSelected = !Object.values(rowsById).filter((row) => row.isSelected && !row.disabled).length;
|
|
302
|
+
return {
|
|
303
|
+
...prev,
|
|
304
|
+
shouldShowBatchActions: isSelected,
|
|
305
|
+
...getUpdatedSelectionState(prev, isSelected)
|
|
306
|
+
};
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Handler for toggling selection state of a given row.
|
|
311
|
+
*/
|
|
312
|
+
const handleOnSelectRow = (rowId) => () => {
|
|
313
|
+
setState((prev) => {
|
|
314
|
+
const row = prev.rowsById[rowId];
|
|
315
|
+
if (radio) {
|
|
316
|
+
const rowsById = Object.entries(prev.rowsById).reduce((acc, [id, row]) => {
|
|
317
|
+
acc[id] = {
|
|
318
|
+
...row,
|
|
319
|
+
isSelected: false
|
|
320
|
+
};
|
|
321
|
+
return acc;
|
|
322
|
+
}, {});
|
|
323
|
+
return {
|
|
324
|
+
...prev,
|
|
325
|
+
shouldShowBatchActions: false,
|
|
326
|
+
rowsById: {
|
|
327
|
+
...rowsById,
|
|
328
|
+
[rowId]: {
|
|
329
|
+
...rowsById[rowId],
|
|
330
|
+
isSelected: !rowsById[rowId].isSelected
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
const selectedRows = prev.rowIds.filter((id) => prev.rowsById[id].isSelected).length;
|
|
336
|
+
const selectedRowsCount = !row.isSelected ? selectedRows + 1 : selectedRows - 1;
|
|
337
|
+
return {
|
|
338
|
+
...prev,
|
|
339
|
+
shouldShowBatchActions: !row.isSelected || selectedRowsCount > 0,
|
|
340
|
+
rowsById: {
|
|
341
|
+
...prev.rowsById,
|
|
342
|
+
[rowId]: {
|
|
343
|
+
...row,
|
|
344
|
+
isSelected: !row.isSelected
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
const handleOnExpandRow = (rowId) => () => {
|
|
351
|
+
setState((prev) => {
|
|
352
|
+
const row = prev.rowsById[rowId];
|
|
353
|
+
const { isExpandedAll } = prev;
|
|
354
|
+
return {
|
|
355
|
+
...prev,
|
|
356
|
+
isExpandedAll: row.isExpanded ? false : isExpandedAll,
|
|
357
|
+
rowsById: {
|
|
358
|
+
...prev.rowsById,
|
|
359
|
+
[rowId]: {
|
|
360
|
+
...row,
|
|
361
|
+
isExpanded: !row.isExpanded
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
const handleOnExpandAll = () => {
|
|
368
|
+
setState((prev) => {
|
|
369
|
+
const { rowIds, isExpandedAll } = prev;
|
|
370
|
+
return {
|
|
371
|
+
...prev,
|
|
372
|
+
isExpandedAll: !isExpandedAll,
|
|
373
|
+
rowsById: rowIds.reduce((acc, id) => {
|
|
374
|
+
acc[id] = {
|
|
375
|
+
...prev.rowsById[id],
|
|
376
|
+
isExpanded: !isExpandedAll
|
|
377
|
+
};
|
|
378
|
+
return acc;
|
|
379
|
+
}, {})
|
|
380
|
+
};
|
|
381
|
+
});
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Transitions to the next sort state of the table.
|
|
385
|
+
*/
|
|
386
|
+
const handleSortBy = (headerKey) => () => {
|
|
387
|
+
setState((prev) => {
|
|
388
|
+
const sortState = getNextSortState(props, prev, { key: headerKey });
|
|
389
|
+
return {
|
|
390
|
+
...prev,
|
|
391
|
+
...sortState
|
|
392
|
+
};
|
|
393
|
+
});
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Event handler for table filter input changes.
|
|
397
|
+
*/
|
|
398
|
+
const handleOnInputValueChange = (event, defaultValue) => {
|
|
399
|
+
const value = defaultValue ?? (event === "" ? event : event.target.value);
|
|
400
|
+
setState((prev) => ({
|
|
401
|
+
...prev,
|
|
402
|
+
filterInputValue: value
|
|
403
|
+
}));
|
|
404
|
+
};
|
|
405
|
+
const renderProps = {
|
|
406
|
+
rows: denormalize(filteredRowIds, state.rowsById, state.cellsById),
|
|
407
|
+
headers,
|
|
408
|
+
selectedRows: denormalize(selectedRows, state.rowsById, state.cellsById),
|
|
409
|
+
getHeaderProps,
|
|
410
|
+
getExpandHeaderProps,
|
|
411
|
+
getRowProps,
|
|
412
|
+
getExpandedRowProps,
|
|
413
|
+
getSelectionProps,
|
|
414
|
+
getToolbarProps,
|
|
415
|
+
getBatchActionProps,
|
|
416
|
+
getTableProps,
|
|
417
|
+
getTableContainerProps,
|
|
418
|
+
getCellProps,
|
|
419
|
+
onInputChange: handleOnInputValueChange,
|
|
420
|
+
sortBy: (headerKey) => handleSortBy(headerKey)(),
|
|
421
|
+
selectAll: handleSelectAll,
|
|
422
|
+
selectRow: (rowId) => handleOnSelectRow(rowId)(),
|
|
423
|
+
expandRow: (rowId) => handleOnExpandRow(rowId)(),
|
|
424
|
+
expandAll: handleOnExpandAll,
|
|
425
|
+
radio
|
|
426
|
+
};
|
|
427
|
+
if (typeof render !== "undefined") return render(renderProps);
|
|
428
|
+
if (typeof children !== "undefined") return children(renderProps);
|
|
429
|
+
return null;
|
|
560
430
|
};
|
|
561
431
|
DataTable.Table = Table;
|
|
562
432
|
DataTable.TableActionList = TableActionList;
|
|
@@ -581,90 +451,38 @@ DataTable.TableToolbarContent = TableToolbarContent;
|
|
|
581
451
|
DataTable.TableToolbarSearch = TableToolbarSearch;
|
|
582
452
|
DataTable.TableToolbarMenu = TableToolbarMenu;
|
|
583
453
|
DataTable.propTypes = {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
locale: PropTypes.string,
|
|
616
|
-
/**
|
|
617
|
-
* Specify whether the overflow menu (if it exists) should be shown always, or only on hover
|
|
618
|
-
*/
|
|
619
|
-
overflowMenuOnHover: PropTypes.bool,
|
|
620
|
-
/**
|
|
621
|
-
* Specify whether the control should be a radio button or inline checkbox
|
|
622
|
-
*/
|
|
623
|
-
radio: PropTypes.bool,
|
|
624
|
-
/**
|
|
625
|
-
* @deprecated Use `children` instead. This prop will be removed in
|
|
626
|
-
* the next major version.
|
|
627
|
-
*
|
|
628
|
-
* https://www.patterns.dev/react/render-props-pattern/#children-as-a-function
|
|
629
|
-
*/
|
|
630
|
-
render: deprecate(PropTypes.func),
|
|
631
|
-
/**
|
|
632
|
-
* The `rows` prop is where you provide us with a list of all the rows that
|
|
633
|
-
* you want to render in the table. The only hard requirement is that this
|
|
634
|
-
* is an array of objects, and that each object has a unique `id` field
|
|
635
|
-
* available on it.
|
|
636
|
-
*/
|
|
637
|
-
rows: PropTypes.arrayOf(PropTypes.shape({
|
|
638
|
-
id: PropTypes.string.isRequired,
|
|
639
|
-
disabled: PropTypes.bool,
|
|
640
|
-
isSelected: PropTypes.bool,
|
|
641
|
-
isExpanded: PropTypes.bool
|
|
642
|
-
})).isRequired,
|
|
643
|
-
/**
|
|
644
|
-
* Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
|
|
645
|
-
*/
|
|
646
|
-
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
|
647
|
-
/**
|
|
648
|
-
* Optional hook to manually control sorting of the rows.
|
|
649
|
-
*/
|
|
650
|
-
sortRow: PropTypes.func,
|
|
651
|
-
/**
|
|
652
|
-
* Specify whether the header should be sticky.
|
|
653
|
-
* Still experimental: may not work with every combination of table props
|
|
654
|
-
*/
|
|
655
|
-
stickyHeader: PropTypes.bool,
|
|
656
|
-
/**
|
|
657
|
-
* Translates component strings using your i18n tool.
|
|
658
|
-
*/
|
|
659
|
-
translateWithId: PropTypes.func,
|
|
660
|
-
/**
|
|
661
|
-
* If `true`, sets the table width to `auto` instead of `100%`.
|
|
662
|
-
*/
|
|
663
|
-
useStaticWidth: PropTypes.bool,
|
|
664
|
-
/**
|
|
665
|
-
* `true` to add useZebraStyles striping.
|
|
666
|
-
*/
|
|
667
|
-
useZebraStyles: PropTypes.bool
|
|
454
|
+
children: PropTypes.func,
|
|
455
|
+
experimentalAutoAlign: PropTypes.bool,
|
|
456
|
+
filterRows: PropTypes.func,
|
|
457
|
+
headers: PropTypes.arrayOf(PropTypes.shape({
|
|
458
|
+
key: PropTypes.string.isRequired,
|
|
459
|
+
header: PropTypes.node.isRequired,
|
|
460
|
+
isSortable: PropTypes.bool
|
|
461
|
+
})).isRequired,
|
|
462
|
+
isSortable: PropTypes.bool,
|
|
463
|
+
locale: PropTypes.string,
|
|
464
|
+
overflowMenuOnHover: PropTypes.bool,
|
|
465
|
+
radio: PropTypes.bool,
|
|
466
|
+
render: deprecate(PropTypes.func),
|
|
467
|
+
rows: PropTypes.arrayOf(PropTypes.shape({
|
|
468
|
+
id: PropTypes.string.isRequired,
|
|
469
|
+
disabled: PropTypes.bool,
|
|
470
|
+
isSelected: PropTypes.bool,
|
|
471
|
+
isExpanded: PropTypes.bool
|
|
472
|
+
})).isRequired,
|
|
473
|
+
size: PropTypes.oneOf([
|
|
474
|
+
"xs",
|
|
475
|
+
"sm",
|
|
476
|
+
"md",
|
|
477
|
+
"lg",
|
|
478
|
+
"xl"
|
|
479
|
+
]),
|
|
480
|
+
sortRow: PropTypes.func,
|
|
481
|
+
stickyHeader: PropTypes.bool,
|
|
482
|
+
translateWithId: PropTypes.func,
|
|
483
|
+
useStaticWidth: PropTypes.bool,
|
|
484
|
+
useZebraStyles: PropTypes.bool
|
|
668
485
|
};
|
|
669
486
|
|
|
670
|
-
|
|
487
|
+
//#endregion
|
|
488
|
+
export { DataTable };
|