@carbon/react 1.83.0-rc.0 → 1.84.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 +895 -790
- package/README.md +1 -1
- package/es/components/AILabel/index.js +37 -40
- package/es/components/AISkeleton/AISkeletonIcon.js +6 -7
- package/es/components/AISkeleton/AISkeletonPlaceholder.js +6 -7
- package/es/components/AISkeleton/AISkeletonText.js +6 -7
- package/es/components/Accordion/Accordion.Skeleton.js +24 -25
- package/es/components/Accordion/Accordion.js +13 -14
- package/es/components/Accordion/AccordionItem.js +22 -23
- package/es/components/Accordion/AccordionProvider.js +6 -7
- package/es/components/AspectRatio/AspectRatio.js +9 -10
- package/es/components/BadgeIndicator/index.js +7 -8
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +9 -10
- package/es/components/Breadcrumb/Breadcrumb.js +3 -3
- package/es/components/Breadcrumb/BreadcrumbItem.js +9 -9
- package/es/components/Button/Button.Skeleton.js +10 -11
- package/es/components/Button/Button.js +5 -5
- package/es/components/Button/ButtonBase.js +27 -28
- package/es/components/ButtonSet/ButtonSet.js +2 -2
- package/es/components/ChatButton/ChatButton.Skeleton.js +7 -8
- package/es/components/ChatButton/ChatButton.js +13 -14
- package/es/components/Checkbox/Checkbox.Skeleton.js +8 -9
- package/es/components/Checkbox/Checkbox.js +33 -34
- package/es/components/CheckboxGroup/CheckboxGroup.js +28 -29
- package/es/components/ClassPrefix/index.js +6 -7
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +12 -13
- package/es/components/CodeSnippet/CodeSnippet.js +41 -42
- package/es/components/ComboBox/ComboBox.js +42 -48
- package/es/components/ComboBox/tools/filter.js +9 -12
- package/es/components/ComboButton/index.js +22 -24
- package/es/components/ComposedModal/ComposedModal.js +49 -52
- package/es/components/ComposedModal/ModalFooter.js +42 -47
- package/es/components/ComposedModal/ModalHeader.js +21 -22
- package/es/components/ContainedList/ContainedList.js +17 -18
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +16 -17
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +17 -29
- package/es/components/ContentSwitcher/ContentSwitcher.js +100 -126
- package/es/components/ContentSwitcher/index.d.ts +3 -4
- package/es/components/ContextMenu/useContextMenu.js +1 -2
- package/es/components/Copy/Copy.js +13 -14
- package/es/components/CopyButton/CopyButton.js +14 -15
- package/es/components/DangerButton/DangerButton.js +2 -2
- package/es/components/DataTable/DataTable.d.ts +81 -283
- package/es/components/DataTable/DataTable.js +124 -172
- package/es/components/DataTable/Table.d.ts +2 -2
- package/es/components/DataTable/Table.js +19 -22
- package/es/components/DataTable/TableActionList.d.ts +1 -1
- package/es/components/DataTable/TableBatchAction.js +9 -12
- package/es/components/DataTable/TableBatchActions.js +27 -29
- package/es/components/DataTable/TableBody.d.ts +3 -3
- package/es/components/DataTable/TableBody.js +9 -12
- package/es/components/DataTable/TableCell.d.ts +3 -4
- package/es/components/DataTable/TableCell.js +2 -2
- package/es/components/DataTable/TableContainer.d.ts +2 -3
- package/es/components/DataTable/TableContainer.js +15 -16
- package/es/components/DataTable/TableDecoratorRow.js +8 -9
- package/es/components/DataTable/TableExpandHeader.d.ts +2 -3
- package/es/components/DataTable/TableExpandHeader.js +18 -19
- package/es/components/DataTable/TableExpandRow.js +20 -21
- package/es/components/DataTable/TableExpandedRow.d.ts +3 -3
- package/es/components/DataTable/TableExpandedRow.js +10 -11
- package/es/components/DataTable/TableHead.d.ts +1 -1
- package/es/components/DataTable/TableHeader.d.ts +4 -4
- package/es/components/DataTable/TableHeader.js +29 -30
- package/es/components/DataTable/TableRow.d.ts +3 -4
- package/es/components/DataTable/TableRow.js +4 -4
- package/es/components/DataTable/TableSelectAll.js +14 -15
- package/es/components/DataTable/TableSelectRow.js +16 -17
- package/es/components/DataTable/TableSlugRow.js +7 -8
- package/es/components/DataTable/TableToolbar.js +9 -10
- package/es/components/DataTable/TableToolbarAction.js +2 -2
- package/es/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +10 -11
- package/es/components/DataTable/TableToolbarSearch.js +24 -26
- package/es/components/DataTable/index.d.ts +1 -1
- package/es/components/DataTable/state/sorting.js +3 -4
- package/es/components/DataTable/tools/filter.js +10 -12
- package/es/components/DataTable/tools/normalize.js +6 -8
- package/es/components/DataTable/tools/sorting.js +24 -30
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +26 -27
- package/es/components/DatePicker/DatePicker.Skeleton.js +15 -16
- package/es/components/DatePicker/DatePicker.js +104 -81
- package/es/components/DatePickerInput/DatePickerInput.d.ts +3 -4
- package/es/components/DatePickerInput/DatePickerInput.js +24 -25
- package/es/components/Dialog/index.d.ts +194 -10
- package/es/components/Dialog/index.js +458 -39
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -3
- package/es/components/Dropdown/Dropdown.Skeleton.js +10 -11
- package/es/components/Dropdown/Dropdown.d.ts +3 -3
- package/es/components/Dropdown/Dropdown.js +57 -60
- package/es/components/ErrorBoundary/ErrorBoundary.js +4 -4
- package/es/components/ExpandableSearch/ExpandableSearch.js +11 -12
- package/es/components/FeatureFlags/index.js +13 -14
- package/es/components/FileUploader/FileUploader.Skeleton.d.ts +3 -3
- package/es/components/FileUploader/FileUploader.Skeleton.js +9 -10
- package/es/components/FileUploader/FileUploader.d.ts +2 -3
- package/es/components/FileUploader/FileUploader.js +33 -35
- package/es/components/FileUploader/FileUploaderButton.d.ts +2 -3
- package/es/components/FileUploader/FileUploaderButton.js +20 -21
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +2 -3
- package/es/components/FileUploader/FileUploaderDropContainer.js +20 -21
- package/es/components/FileUploader/FileUploaderItem.d.ts +2 -3
- package/es/components/FileUploader/FileUploaderItem.js +26 -27
- package/es/components/FileUploader/Filename.d.ts +3 -4
- package/es/components/FileUploader/Filename.js +16 -17
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +9 -10
- package/es/components/FluidComboBox/FluidComboBox.js +8 -9
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +16 -17
- package/es/components/FluidDatePicker/FluidDatePicker.js +13 -14
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +9 -10
- package/es/components/FluidDropdown/FluidDropdown.js +8 -9
- package/es/components/FluidForm/FluidForm.d.ts +3 -4
- package/es/components/FluidForm/FluidForm.js +8 -9
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +9 -10
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +10 -11
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +9 -10
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/es/components/FluidNumberInput/FluidNumberInput.js +41 -8
- package/es/components/FluidSearch/FluidSearch.Skeleton.js +9 -10
- package/es/components/FluidSearch/FluidSearch.js +7 -8
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +9 -10
- package/es/components/FluidSelect/FluidSelect.js +8 -9
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +9 -10
- package/es/components/FluidTextArea/FluidTextArea.js +7 -8
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +9 -10
- package/es/components/FluidTextInput/FluidTextInput.js +9 -10
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +8 -9
- package/es/components/FluidTimePicker/FluidTimePicker.js +23 -24
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +7 -8
- package/es/components/Form/Form.js +7 -8
- package/es/components/FormGroup/FormGroup.d.ts +3 -4
- package/es/components/FormGroup/FormGroup.js +15 -16
- package/es/components/FormItem/FormItem.js +7 -8
- package/es/components/FormLabel/FormLabel.js +8 -9
- package/es/components/Grid/CSSGrid.js +23 -25
- package/es/components/Grid/Column.js +32 -31
- package/es/components/Grid/ColumnHang.js +8 -9
- package/es/components/Grid/FlexGrid.js +12 -13
- package/es/components/Grid/Grid.js +3 -3
- package/es/components/Grid/GridContext.d.ts +2 -2
- package/es/components/Grid/GridContext.js +6 -7
- package/es/components/Grid/Row.js +10 -11
- package/es/components/Heading/index.js +13 -14
- package/es/components/Icon/Icon.Skeleton.js +6 -7
- package/es/components/IconButton/index.js +30 -26
- package/es/components/IconIndicator/index.js +10 -11
- package/es/components/IdPrefix/index.js +6 -7
- package/es/components/InlineCheckbox/InlineCheckbox.js +6 -6
- package/es/components/InlineLoading/InlineLoading.js +19 -20
- package/es/components/Layer/LayerContext.js +2 -2
- package/es/components/Layer/index.d.ts +4 -0
- package/es/components/Layer/index.js +21 -15
- package/es/components/Layout/index.js +24 -29
- package/es/components/LayoutDirection/LayoutDirection.js +10 -11
- package/es/components/LayoutDirection/LayoutDirectionContext.js +2 -2
- package/es/components/Link/Link.d.ts +1 -1
- package/es/components/Link/Link.js +19 -20
- package/es/components/ListBox/ListBox.d.ts +2 -3
- package/es/components/ListBox/ListBox.js +5 -5
- package/es/components/ListBox/ListBoxField.d.ts +3 -4
- package/es/components/ListBox/ListBoxField.js +8 -9
- package/es/components/ListBox/ListBoxMenu.d.ts +2 -3
- package/es/components/ListBox/ListBoxMenu.js +7 -8
- package/es/components/ListBox/ListBoxMenuIcon.js +8 -9
- package/es/components/ListBox/ListBoxMenuItem.d.ts +2 -3
- package/es/components/ListBox/ListBoxMenuItem.js +11 -13
- package/es/components/ListBox/ListBoxSelection.js +14 -15
- package/es/components/ListBox/next/ListBoxSelection.js +16 -17
- package/es/components/ListBox/next/ListBoxTrigger.js +8 -9
- package/es/components/ListItem/ListItem.js +7 -8
- package/es/components/Loading/Loading.d.ts +3 -3
- package/es/components/Loading/Loading.js +14 -15
- package/es/components/Menu/Menu.js +26 -27
- package/es/components/Menu/MenuItem.js +55 -60
- package/es/components/MenuButton/index.js +20 -22
- package/es/components/Modal/Modal.d.ts +2 -3
- package/es/components/Modal/Modal.js +85 -93
- package/es/components/ModalWrapper/ModalWrapper.js +9 -9
- package/es/components/MultiSelect/FilterableMultiSelect.js +68 -74
- package/es/components/MultiSelect/MultiSelect.js +65 -67
- package/es/components/MultiSelect/tools/sorting.js +11 -15
- package/es/components/Notification/Notification.js +137 -146
- package/es/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/es/components/NumberInput/NumberFormatPropTypes.js +40 -0
- package/es/components/NumberInput/NumberInput.Skeleton.js +10 -11
- package/es/components/NumberInput/NumberInput.d.ts +39 -3
- package/es/components/NumberInput/NumberInput.js +195 -65
- package/es/components/OrderedList/OrderedList.js +9 -10
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +42 -48
- package/es/components/OverflowMenu/index.js +3 -3
- package/es/components/OverflowMenu/next/index.js +17 -18
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +4 -4
- package/es/components/OverflowMenuV2/index.js +3 -3
- package/es/components/PageHeader/PageHeader.d.ts +29 -5
- package/es/components/PageHeader/PageHeader.js +136 -90
- package/es/components/Pagination/Pagination.Skeleton.js +12 -13
- package/es/components/Pagination/Pagination.js +40 -41
- package/es/components/Pagination/experimental/PageSelector.js +11 -12
- package/es/components/Pagination/experimental/Pagination.js +34 -35
- package/es/components/PaginationNav/PaginationNav.js +63 -68
- package/es/components/Popover/index.js +40 -42
- package/es/components/PrimaryButton/PrimaryButton.js +2 -2
- package/es/components/ProgressBar/ProgressBar.js +24 -25
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +12 -13
- package/es/components/ProgressIndicator/ProgressIndicator.js +49 -52
- package/es/components/RadioButton/RadioButton.Skeleton.js +4 -4
- package/es/components/RadioButton/RadioButton.js +10 -10
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +16 -16
- package/es/components/RadioTile/RadioTile.js +28 -29
- package/es/components/Search/Search.Skeleton.js +9 -10
- package/es/components/Search/Search.js +36 -38
- package/es/components/SecondaryButton/SecondaryButton.js +2 -2
- package/es/components/Select/Select.Skeleton.js +10 -11
- package/es/components/Select/Select.js +42 -43
- package/es/components/SelectItem/SelectItem.js +10 -11
- package/es/components/SelectItemGroup/SelectItemGroup.js +9 -10
- package/es/components/ShapeIndicator/index.js +13 -14
- package/es/components/SkeletonIcon/SkeletonIcon.d.ts +0 -4
- package/es/components/SkeletonIcon/SkeletonIcon.js +7 -12
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +6 -7
- package/es/components/SkeletonText/SkeletonText.js +12 -13
- package/es/components/Slider/Slider.Skeleton.js +25 -26
- package/es/components/Slider/Slider.js +99 -113
- package/es/components/Slider/SliderHandles.js +20 -20
- package/es/components/Stack/HStack.js +2 -2
- package/es/components/Stack/Stack.js +2 -2
- package/es/components/Stack/VStack.js +2 -2
- package/es/components/StructuredList/StructuredList.Skeleton.js +17 -18
- package/es/components/StructuredList/StructuredList.js +24 -24
- package/es/components/Switch/IconSwitch.js +3 -3
- package/es/components/Switch/Switch.js +4 -4
- package/es/components/TabContent/TabContent.js +2 -2
- package/es/components/Tabs/Tabs.Skeleton.js +12 -13
- package/es/components/Tabs/Tabs.js +141 -156
- package/es/components/Tabs/usePressable.js +7 -8
- package/es/components/Tag/DismissibleTag.js +26 -27
- package/es/components/Tag/OperationalTag.js +16 -17
- package/es/components/Tag/SelectableTag.js +19 -20
- package/es/components/Tag/Tag.Skeleton.js +7 -8
- package/es/components/Tag/Tag.js +33 -34
- package/es/components/Text/Text.js +9 -10
- package/es/components/Text/TextDirection.js +7 -8
- package/es/components/Text/createTextComponent.js +2 -2
- package/es/components/TextArea/TextArea.Skeleton.js +4 -4
- package/es/components/TextArea/TextArea.js +22 -22
- package/es/components/TextInput/ControlledPasswordInput.d.ts +2 -3
- package/es/components/TextInput/ControlledPasswordInput.js +36 -37
- package/es/components/TextInput/PasswordInput.js +40 -41
- package/es/components/TextInput/TextInput.Skeleton.js +9 -10
- package/es/components/TextInput/TextInput.js +43 -44
- package/es/components/TextInput/util.js +14 -17
- package/es/components/Theme/index.js +19 -21
- package/es/components/Tile/Tile.js +98 -104
- package/es/components/TileGroup/TileGroup.d.ts +3 -4
- package/es/components/TileGroup/TileGroup.js +8 -8
- package/es/components/TimePicker/TimePicker.d.ts +2 -3
- package/es/components/TimePicker/TimePicker.js +14 -14
- package/es/components/TimePickerSelect/TimePickerSelect.js +4 -4
- package/es/components/Toggle/Toggle.Skeleton.js +8 -9
- package/es/components/Toggle/Toggle.js +27 -28
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +14 -15
- package/es/components/Toggletip/index.js +43 -49
- package/es/components/Tooltip/DefinitionTooltip.js +17 -18
- package/es/components/Tooltip/Tooltip.d.ts +3 -0
- package/es/components/Tooltip/Tooltip.js +39 -28
- package/es/components/TreeView/TreeNode.js +64 -56
- package/es/components/TreeView/TreeView.js +44 -37
- package/es/components/UIShell/Content.js +8 -9
- package/es/components/UIShell/Header.js +7 -8
- package/es/components/UIShell/HeaderContainer.js +7 -8
- package/es/components/UIShell/HeaderGlobalAction.js +14 -15
- package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/es/components/UIShell/HeaderMenu.d.ts +10 -112
- package/es/components/UIShell/HeaderMenu.js +154 -201
- package/es/components/UIShell/HeaderMenuButton.js +14 -15
- package/es/components/UIShell/HeaderMenuItem.js +21 -20
- package/es/components/UIShell/HeaderName.js +9 -10
- package/es/components/UIShell/HeaderNavigation.js +10 -11
- package/es/components/UIShell/HeaderPanel.js +11 -12
- package/es/components/UIShell/HeaderSideNavItems.js +7 -8
- package/es/components/UIShell/Link.js +11 -12
- package/es/components/UIShell/SideNav.js +30 -32
- package/es/components/UIShell/SideNavDetails.js +9 -10
- package/es/components/UIShell/SideNavDivider.js +6 -7
- package/es/components/UIShell/SideNavFooter.js +13 -14
- package/es/components/UIShell/SideNavHeader.js +8 -9
- package/es/components/UIShell/SideNavIcon.js +7 -8
- package/es/components/UIShell/SideNavItem.js +7 -8
- package/es/components/UIShell/SideNavItems.js +10 -11
- package/es/components/UIShell/SideNavLink.js +15 -16
- package/es/components/UIShell/SideNavLinkText.js +7 -8
- package/es/components/UIShell/SideNavMenu.js +20 -21
- package/es/components/UIShell/SideNavMenuItem.js +5 -5
- package/es/components/UIShell/SideNavSwitcher.js +8 -8
- package/es/components/UIShell/SkipToContent.js +9 -10
- package/es/components/UIShell/Switcher.js +12 -13
- package/es/components/UIShell/SwitcherDivider.js +6 -7
- package/es/components/UIShell/SwitcherItem.js +3 -3
- package/es/components/UnorderedList/UnorderedList.js +8 -9
- package/es/index.js +25 -26
- package/es/internal/FloatingMenu.js +30 -32
- package/es/internal/Selection.js +15 -17
- package/{lib/feature-flags.d.ts → es/internal/__mocks__/mockHTMLElement.d.ts} +4 -2
- package/es/internal/createClassWrapper.js +2 -2
- package/es/internal/getAnnouncement.d.ts +8 -0
- package/es/internal/getAnnouncement.js +22 -0
- package/es/internal/keyboard/match.js +6 -7
- package/es/internal/useControllableState.d.ts +1 -1
- package/es/internal/useControllableState.js +8 -9
- package/es/internal/useDelayedState.js +1 -2
- package/es/internal/useDocumentLang.d.ts +12 -0
- package/es/internal/useId.js +4 -6
- package/es/internal/useIdPrefix.js +3 -3
- package/es/internal/useMatchMedia.js +1 -2
- package/es/internal/useMergedRefs.d.ts +1 -1
- package/es/internal/useNoInteractiveChildren.js +2 -4
- package/es/internal/useNormalizedInputProps.js +12 -13
- package/es/internal/usePrefix.js +3 -3
- package/es/internal/useResizeObserver.d.ts +14 -0
- package/es/internal/useResizeObserver.js +73 -0
- package/es/internal/useSavedCallback.js +1 -3
- package/es/internal/wrapFocus.js +23 -35
- package/es/prop-types/deprecate.js +1 -4
- package/es/prop-types/deprecateValuesWithin.js +1 -4
- package/es/prop-types/isRequiredOneOf.js +1 -4
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
- package/es/tools/events.js +1 -4
- package/es/tools/mergeRefs.js +9 -14
- package/es/tools/uniqueId.js +1 -2
- package/es/tools/wrapComponent.d.ts +3 -4
- package/es/tools/wrapComponent.js +11 -13
- package/es/types/common.d.ts +0 -2
- package/lib/components/AILabel/index.js +27 -30
- package/lib/components/AISkeleton/AISkeletonIcon.js +4 -5
- package/lib/components/AISkeleton/AISkeletonPlaceholder.js +4 -5
- package/lib/components/AISkeleton/AISkeletonText.js +4 -5
- package/lib/components/Accordion/Accordion.Skeleton.js +9 -10
- package/lib/components/Accordion/Accordion.js +10 -11
- package/lib/components/Accordion/AccordionItem.js +13 -14
- package/lib/components/Accordion/AccordionProvider.js +4 -5
- package/lib/components/AspectRatio/AspectRatio.js +7 -8
- package/lib/components/BadgeIndicator/index.js +5 -6
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +4 -5
- package/lib/components/Button/Button.Skeleton.js +7 -8
- package/lib/components/Button/ButtonBase.js +23 -24
- package/lib/components/ChatButton/ChatButton.Skeleton.js +5 -6
- package/lib/components/ChatButton/ChatButton.js +11 -12
- package/lib/components/Checkbox/Checkbox.Skeleton.js +4 -5
- package/lib/components/Checkbox/Checkbox.js +19 -20
- package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -17
- package/lib/components/ClassPrefix/index.js +4 -5
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +5 -6
- package/lib/components/CodeSnippet/CodeSnippet.js +27 -29
- package/lib/components/ComboBox/ComboBox.js +24 -30
- package/lib/components/ComboBox/tools/filter.js +9 -12
- package/lib/components/ComboButton/index.js +16 -18
- package/lib/components/ComposedModal/ComposedModal.js +31 -34
- package/lib/components/ComposedModal/ModalFooter.js +37 -42
- package/lib/components/ComposedModal/ModalHeader.js +14 -15
- package/lib/components/ContainedList/ContainedList.js +10 -11
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +17 -29
- package/lib/components/ContentSwitcher/ContentSwitcher.js +98 -124
- package/lib/components/ContentSwitcher/index.d.ts +3 -4
- package/lib/components/ContextMenu/useContextMenu.js +1 -2
- package/lib/components/Copy/Copy.js +11 -12
- package/lib/components/CopyButton/CopyButton.js +10 -11
- package/lib/components/DataTable/DataTable.d.ts +81 -283
- package/lib/components/DataTable/DataTable.js +123 -172
- package/lib/components/DataTable/Table.d.ts +2 -2
- package/lib/components/DataTable/Table.js +15 -18
- package/lib/components/DataTable/TableActionList.d.ts +1 -1
- package/lib/components/DataTable/TableBatchAction.js +8 -11
- package/lib/components/DataTable/TableBatchActions.js +18 -20
- package/lib/components/DataTable/TableBody.d.ts +3 -3
- package/lib/components/DataTable/TableBody.js +8 -11
- package/lib/components/DataTable/TableCell.d.ts +3 -4
- package/lib/components/DataTable/TableContainer.d.ts +2 -3
- package/lib/components/DataTable/TableContainer.js +9 -10
- package/lib/components/DataTable/TableDecoratorRow.js +4 -5
- package/lib/components/DataTable/TableExpandHeader.d.ts +2 -3
- package/lib/components/DataTable/TableExpandHeader.js +14 -15
- package/lib/components/DataTable/TableExpandRow.js +13 -14
- package/lib/components/DataTable/TableExpandedRow.d.ts +3 -3
- package/lib/components/DataTable/TableExpandedRow.js +6 -7
- package/lib/components/DataTable/TableHead.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +4 -4
- package/lib/components/DataTable/TableHeader.js +15 -16
- package/lib/components/DataTable/TableRow.d.ts +3 -4
- package/lib/components/DataTable/TableSelectAll.js +11 -12
- package/lib/components/DataTable/TableSelectRow.js +12 -13
- package/lib/components/DataTable/TableSlugRow.js +4 -5
- package/lib/components/DataTable/TableToolbar.js +7 -8
- package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +8 -9
- package/lib/components/DataTable/TableToolbarSearch.js +22 -24
- package/lib/components/DataTable/index.d.ts +1 -1
- package/lib/components/DataTable/state/sorting.js +3 -4
- package/lib/components/DataTable/tools/filter.js +10 -12
- package/lib/components/DataTable/tools/normalize.js +6 -8
- package/lib/components/DataTable/tools/sorting.js +24 -30
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +11 -12
- package/lib/components/DatePicker/DatePicker.Skeleton.js +7 -8
- package/lib/components/DatePicker/DatePicker.js +87 -64
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +3 -4
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -6
- package/lib/components/Dialog/index.d.ts +194 -10
- package/lib/components/Dialog/index.js +457 -33
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -3
- package/lib/components/Dropdown/Dropdown.Skeleton.js +6 -7
- package/lib/components/Dropdown/Dropdown.d.ts +3 -3
- package/lib/components/Dropdown/Dropdown.js +40 -43
- package/lib/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.js +9 -10
- package/lib/components/FeatureFlags/index.js +11 -12
- package/lib/components/FileUploader/FileUploader.Skeleton.d.ts +3 -3
- package/lib/components/FileUploader/FileUploader.Skeleton.js +4 -5
- package/lib/components/FileUploader/FileUploader.d.ts +2 -3
- package/lib/components/FileUploader/FileUploader.js +22 -24
- package/lib/components/FileUploader/FileUploaderButton.d.ts +2 -3
- package/lib/components/FileUploader/FileUploaderButton.js +16 -17
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +2 -3
- package/lib/components/FileUploader/FileUploaderDropContainer.js +15 -16
- package/lib/components/FileUploader/FileUploaderItem.d.ts +2 -3
- package/lib/components/FileUploader/FileUploaderItem.js +13 -14
- package/lib/components/FileUploader/Filename.d.ts +3 -4
- package/lib/components/FileUploader/Filename.js +9 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +4 -5
- package/lib/components/FluidComboBox/FluidComboBox.js +5 -6
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +5 -6
- package/lib/components/FluidDatePicker/FluidDatePicker.js +10 -11
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +4 -5
- package/lib/components/FluidDropdown/FluidDropdown.js +5 -6
- package/lib/components/FluidForm/FluidForm.d.ts +3 -4
- package/lib/components/FluidForm/FluidForm.js +5 -6
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +4 -5
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +6 -7
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +4 -5
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/lib/components/FluidNumberInput/FluidNumberInput.js +38 -5
- package/lib/components/FluidSearch/FluidSearch.Skeleton.js +4 -5
- package/lib/components/FluidSearch/FluidSearch.js +4 -5
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +4 -5
- package/lib/components/FluidSelect/FluidSelect.js +5 -6
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +4 -5
- package/lib/components/FluidTextArea/FluidTextArea.js +4 -5
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +4 -5
- package/lib/components/FluidTextInput/FluidTextInput.js +5 -6
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +5 -6
- package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -12
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +5 -6
- package/lib/components/Form/Form.js +5 -6
- package/lib/components/FormGroup/FormGroup.d.ts +3 -4
- package/lib/components/FormGroup/FormGroup.js +11 -12
- package/lib/components/FormItem/FormItem.js +5 -6
- package/lib/components/FormLabel/FormLabel.js +6 -7
- package/lib/components/Grid/CSSGrid.js +17 -19
- package/lib/components/Grid/Column.js +28 -27
- package/lib/components/Grid/ColumnHang.js +6 -7
- package/lib/components/Grid/FlexGrid.js +9 -10
- package/lib/components/Grid/GridContext.d.ts +2 -2
- package/lib/components/Grid/GridContext.js +10 -29
- package/lib/components/Grid/Row.js +8 -9
- package/lib/components/Heading/index.js +5 -6
- package/lib/components/Icon/Icon.Skeleton.js +4 -5
- package/lib/components/IconButton/index.js +26 -22
- package/lib/components/IconIndicator/index.js +7 -8
- package/lib/components/IdPrefix/index.js +4 -5
- package/lib/components/InlineLoading/InlineLoading.js +9 -10
- package/lib/components/Layer/index.d.ts +4 -0
- package/lib/components/Layer/index.js +16 -10
- package/lib/components/Layout/index.js +21 -26
- package/lib/components/LayoutDirection/LayoutDirection.js +6 -7
- package/lib/components/Link/Link.d.ts +1 -1
- package/lib/components/Link/Link.js +15 -16
- package/lib/components/ListBox/ListBox.d.ts +2 -3
- package/lib/components/ListBox/ListBoxField.d.ts +3 -4
- package/lib/components/ListBox/ListBoxField.js +6 -7
- package/lib/components/ListBox/ListBoxMenu.d.ts +2 -3
- package/lib/components/ListBox/ListBoxMenu.js +5 -6
- package/lib/components/ListBox/ListBoxMenuIcon.js +4 -5
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +2 -3
- package/lib/components/ListBox/ListBoxMenuItem.js +8 -10
- package/lib/components/ListBox/ListBoxSelection.js +8 -9
- package/lib/components/ListBox/next/ListBoxSelection.js +9 -10
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/lib/components/ListItem/ListItem.js +5 -6
- package/lib/components/Loading/Loading.d.ts +3 -3
- package/lib/components/Loading/Loading.js +8 -9
- package/lib/components/Menu/Menu.js +23 -24
- package/lib/components/Menu/MenuItem.js +39 -44
- package/lib/components/MenuButton/index.js +16 -18
- package/lib/components/Modal/Modal.d.ts +2 -3
- package/lib/components/Modal/Modal.js +55 -63
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +46 -52
- package/lib/components/MultiSelect/MultiSelect.js +43 -45
- package/lib/components/MultiSelect/tools/sorting.js +11 -15
- package/lib/components/Notification/Notification.js +96 -105
- package/lib/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/lib/components/NumberInput/NumberFormatPropTypes.js +48 -0
- package/lib/components/NumberInput/NumberInput.Skeleton.js +6 -7
- package/lib/components/NumberInput/NumberInput.d.ts +39 -3
- package/lib/components/NumberInput/NumberInput.js +173 -43
- package/lib/components/OrderedList/OrderedList.js +7 -8
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +35 -41
- package/lib/components/OverflowMenu/next/index.js +12 -13
- package/lib/components/PageHeader/PageHeader.d.ts +29 -5
- package/lib/components/PageHeader/PageHeader.js +119 -73
- package/lib/components/Pagination/Pagination.Skeleton.js +4 -5
- package/lib/components/Pagination/Pagination.js +24 -25
- package/lib/components/Pagination/experimental/PageSelector.js +8 -9
- package/lib/components/Pagination/experimental/Pagination.js +20 -21
- package/lib/components/PaginationNav/PaginationNav.js +33 -38
- package/lib/components/Popover/index.js +26 -28
- package/lib/components/ProgressBar/ProgressBar.js +11 -12
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
- package/lib/components/ProgressIndicator/ProgressIndicator.js +29 -32
- package/lib/components/RadioTile/RadioTile.js +17 -18
- package/lib/components/Search/Search.Skeleton.js +5 -6
- package/lib/components/Search/Search.js +26 -28
- package/lib/components/Select/Select.Skeleton.js +5 -6
- package/lib/components/Select/Select.js +24 -25
- package/lib/components/SelectItem/SelectItem.js +8 -9
- package/lib/components/SelectItemGroup/SelectItemGroup.js +7 -8
- package/lib/components/ShapeIndicator/index.js +7 -8
- package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +0 -4
- package/lib/components/SkeletonIcon/SkeletonIcon.js +5 -10
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -5
- package/lib/components/SkeletonText/SkeletonText.js +8 -9
- package/lib/components/Slider/Slider.Skeleton.js +8 -9
- package/lib/components/Slider/Slider.js +69 -83
- package/lib/components/Slider/SliderHandles.js +6 -6
- package/lib/components/StructuredList/StructuredList.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.js +83 -98
- package/lib/components/Tabs/usePressable.js +7 -8
- package/lib/components/Tag/DismissibleTag.js +16 -17
- package/lib/components/Tag/OperationalTag.js +10 -11
- package/lib/components/Tag/SelectableTag.js +13 -14
- package/lib/components/Tag/Tag.Skeleton.js +5 -6
- package/lib/components/Tag/Tag.js +19 -20
- package/lib/components/Text/Text.js +6 -7
- package/lib/components/Text/TextDirection.js +5 -6
- package/lib/components/TextArea/TextArea.js +3 -3
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +2 -3
- package/lib/components/TextInput/ControlledPasswordInput.js +24 -25
- package/lib/components/TextInput/PasswordInput.js +26 -27
- package/lib/components/TextInput/TextInput.Skeleton.js +5 -6
- package/lib/components/TextInput/TextInput.js +27 -28
- package/lib/components/TextInput/util.js +14 -17
- package/lib/components/Theme/index.js +10 -12
- package/lib/components/Tile/Tile.js +68 -74
- package/lib/components/TileGroup/TileGroup.d.ts +3 -4
- package/lib/components/TimePicker/TimePicker.d.ts +2 -3
- package/lib/components/Toggle/Toggle.Skeleton.js +4 -5
- package/lib/components/Toggle/Toggle.js +17 -18
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +6 -7
- package/lib/components/Toggletip/index.js +33 -39
- package/lib/components/Tooltip/DefinitionTooltip.js +13 -14
- package/lib/components/Tooltip/Tooltip.d.ts +3 -0
- package/lib/components/Tooltip/Tooltip.js +33 -22
- package/lib/components/TreeView/TreeNode.js +40 -32
- package/lib/components/TreeView/TreeView.js +41 -34
- package/lib/components/UIShell/Content.js +6 -7
- package/lib/components/UIShell/Header.js +5 -6
- package/lib/components/UIShell/HeaderContainer.js +5 -6
- package/lib/components/UIShell/HeaderGlobalAction.js +12 -13
- package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/lib/components/UIShell/HeaderMenu.d.ts +10 -112
- package/lib/components/UIShell/HeaderMenu.js +152 -199
- package/lib/components/UIShell/HeaderMenuButton.js +10 -11
- package/lib/components/UIShell/HeaderMenuItem.js +17 -16
- package/lib/components/UIShell/HeaderName.js +6 -7
- package/lib/components/UIShell/HeaderNavigation.js +7 -8
- package/lib/components/UIShell/HeaderPanel.js +9 -10
- package/lib/components/UIShell/HeaderSideNavItems.js +5 -6
- package/lib/components/UIShell/Link.js +8 -9
- package/lib/components/UIShell/SideNav.js +23 -25
- package/lib/components/UIShell/SideNavDetails.js +6 -7
- package/lib/components/UIShell/SideNavDivider.js +3 -4
- package/lib/components/UIShell/SideNavFooter.js +6 -7
- package/lib/components/UIShell/SideNavHeader.js +5 -6
- package/lib/components/UIShell/SideNavIcon.js +5 -6
- package/lib/components/UIShell/SideNavItem.js +5 -6
- package/lib/components/UIShell/SideNavItems.js +5 -6
- package/lib/components/UIShell/SideNavLink.js +10 -11
- package/lib/components/UIShell/SideNavLinkText.js +5 -6
- package/lib/components/UIShell/SideNavMenu.js +11 -12
- package/lib/components/UIShell/SkipToContent.js +7 -8
- package/lib/components/UIShell/Switcher.js +4 -5
- package/lib/components/UIShell/SwitcherDivider.js +4 -5
- package/lib/components/UnorderedList/UnorderedList.js +6 -7
- package/lib/index.js +81 -82
- package/lib/internal/FloatingMenu.js +26 -28
- package/lib/internal/Selection.js +15 -17
- package/{es/feature-flags.d.ts → lib/internal/__mocks__/mockHTMLElement.d.ts} +4 -2
- package/lib/internal/getAnnouncement.d.ts +8 -0
- package/lib/internal/getAnnouncement.js +26 -0
- package/lib/internal/keyboard/match.js +6 -7
- package/lib/internal/useControllableState.d.ts +1 -1
- package/lib/internal/useControllableState.js +8 -9
- package/lib/internal/useDelayedState.js +1 -2
- package/lib/internal/useDocumentLang.d.ts +12 -0
- package/lib/internal/useId.js +2 -4
- package/lib/internal/useMatchMedia.js +1 -2
- package/lib/internal/useMergedRefs.d.ts +1 -1
- package/lib/internal/useNoInteractiveChildren.js +2 -4
- package/lib/internal/useNormalizedInputProps.js +9 -10
- package/lib/internal/useResizeObserver.d.ts +14 -0
- package/lib/internal/useResizeObserver.js +77 -0
- package/lib/internal/useSavedCallback.js +1 -3
- package/lib/internal/wrapFocus.js +23 -35
- package/lib/prop-types/deprecate.js +1 -4
- package/lib/prop-types/deprecateValuesWithin.js +1 -4
- package/lib/prop-types/isRequiredOneOf.js +1 -4
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
- package/lib/tools/events.js +1 -4
- package/lib/tools/mergeRefs.js +9 -14
- package/lib/tools/uniqueId.js +1 -2
- package/lib/tools/wrapComponent.d.ts +3 -4
- package/lib/tools/wrapComponent.js +9 -11
- package/lib/types/common.d.ts +0 -2
- package/package.json +21 -20
- package/scss/components/content-switcher/_tokens.scss +9 -0
- package/telemetry.yml +27 -2
- package/es/components/ContentSwitcher/index.js +0 -13
- package/es/components/DataTable/index.js +0 -76
- package/es/internal/useAnnouncer.js +0 -21
- package/lib/components/ContentSwitcher/index.js +0 -18
- package/lib/components/DataTable/index.js +0 -82
- package/lib/internal/useAnnouncer.js +0 -25
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import
|
|
10
|
+
import { Component } from 'react';
|
|
11
11
|
import isEqual from 'react-fast-compare';
|
|
12
12
|
import getDerivedStateFromProps from './state/getDerivedStateFromProps.js';
|
|
13
13
|
import { getNextSortState } from './state/sorting.js';
|
|
@@ -76,29 +76,23 @@ const translateWithId = id => defaultTranslations[id];
|
|
|
76
76
|
* and updating the state of the single entity will cascade updates to the
|
|
77
77
|
* consumer.
|
|
78
78
|
*/
|
|
79
|
-
class DataTable extends
|
|
79
|
+
class DataTable extends Component {
|
|
80
80
|
constructor(_props) {
|
|
81
|
-
var _this;
|
|
82
81
|
super(_props);
|
|
83
|
-
_this = this;
|
|
84
82
|
_defineProperty(this, "instanceId", void 0);
|
|
83
|
+
// TODO: Replace with a `type` when this component is converted to a
|
|
84
|
+
// functional component.
|
|
85
|
+
_defineProperty(this, "rp", void 0);
|
|
85
86
|
/**
|
|
86
87
|
* Get the props associated with the given header. Mostly used for adding in
|
|
87
88
|
* sorting behavior.
|
|
88
|
-
*
|
|
89
|
-
* @param {object} config
|
|
90
|
-
* @param {string} config.header the header we want the props for
|
|
91
|
-
* @param {Function} config.onClick a custom click handler for the header
|
|
92
|
-
* @param {boolean} config.isSortable
|
|
93
|
-
* @returns {object}
|
|
94
89
|
*/
|
|
95
|
-
_defineProperty(this, "getHeaderProps",
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
} = _ref;
|
|
90
|
+
_defineProperty(this, "getHeaderProps", ({
|
|
91
|
+
header,
|
|
92
|
+
onClick,
|
|
93
|
+
isSortable = this.props.isSortable,
|
|
94
|
+
...rest
|
|
95
|
+
}) => {
|
|
102
96
|
const {
|
|
103
97
|
sortDirection,
|
|
104
98
|
sortHeaderKey
|
|
@@ -126,26 +120,20 @@ class DataTable extends React__default.Component {
|
|
|
126
120
|
});
|
|
127
121
|
/**
|
|
128
122
|
* Get the props associated with the given expand header.
|
|
129
|
-
*
|
|
130
|
-
* @param {object} config
|
|
131
|
-
* @param {Function} config.onClick a custom click handler for the expand header
|
|
132
|
-
* @param {Function} config.onExpand a custom click handler called when header is expanded
|
|
133
|
-
* @returns {object}
|
|
134
123
|
*/
|
|
135
|
-
_defineProperty(this, "getExpandHeaderProps",
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
124
|
+
_defineProperty(this, "getExpandHeaderProps", ({
|
|
125
|
+
onClick,
|
|
126
|
+
onExpand,
|
|
127
|
+
...rest
|
|
128
|
+
} = {}) => {
|
|
141
129
|
const {
|
|
142
130
|
translateWithId: t = translateWithId
|
|
143
|
-
} =
|
|
131
|
+
} = this.props;
|
|
144
132
|
const {
|
|
145
133
|
isExpandedAll,
|
|
146
134
|
rowIds,
|
|
147
135
|
rowsById
|
|
148
|
-
} =
|
|
136
|
+
} = this.state;
|
|
149
137
|
const isExpanded = isExpandedAll || rowIds.every(id => rowsById[id].isExpanded);
|
|
150
138
|
const translationKey = isExpanded ? translationKeys.collapseAll : translationKeys.expandAll;
|
|
151
139
|
return {
|
|
@@ -156,45 +144,31 @@ class DataTable extends React__default.Component {
|
|
|
156
144
|
isExpanded,
|
|
157
145
|
// Compose the event handlers so we don't overwrite a consumer's `onClick`
|
|
158
146
|
// handler
|
|
159
|
-
onExpand: composeEventHandlers([
|
|
147
|
+
onExpand: composeEventHandlers([this.handleOnExpandAll, onExpand, onClick && this.handleOnExpandHeaderClick(onClick, {
|
|
160
148
|
isExpanded
|
|
161
149
|
})])
|
|
162
150
|
};
|
|
163
151
|
});
|
|
164
152
|
/**
|
|
165
153
|
* Decorate consumer's `onClick` event handler with sort parameters
|
|
166
|
-
*
|
|
167
|
-
* @param {Function} onClick
|
|
168
|
-
* @param {object} sortParams
|
|
169
|
-
* @returns {Function}
|
|
170
154
|
*/
|
|
171
155
|
_defineProperty(this, "handleOnHeaderClick", (onClick, sortParams) => {
|
|
172
|
-
return
|
|
156
|
+
return event => onClick(event, sortParams);
|
|
173
157
|
});
|
|
174
158
|
/**
|
|
175
|
-
* Decorate consumer's `onClick` event handler with
|
|
176
|
-
*
|
|
177
|
-
* @param {Function} onClick
|
|
178
|
-
* @param {object} expandParams
|
|
179
|
-
* @returns {Function}
|
|
159
|
+
* Decorate consumer's `onClick` event handler with expand parameters
|
|
180
160
|
*/
|
|
181
161
|
_defineProperty(this, "handleOnExpandHeaderClick", (onClick, expandParams) => {
|
|
182
|
-
return
|
|
162
|
+
return event => onClick(event, expandParams);
|
|
183
163
|
});
|
|
184
164
|
/**
|
|
185
165
|
* Get the props associated with the given row. Mostly used for expansion.
|
|
186
|
-
*
|
|
187
|
-
* @param {object} config
|
|
188
|
-
* @param {object} config.row the row we want the props for
|
|
189
|
-
* @param {Function} config.onClick a custom click handler for the header
|
|
190
|
-
* @returns {object}
|
|
191
166
|
*/
|
|
192
|
-
_defineProperty(this, "getRowProps",
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
} = _ref2;
|
|
167
|
+
_defineProperty(this, "getRowProps", ({
|
|
168
|
+
row,
|
|
169
|
+
onClick,
|
|
170
|
+
...rest
|
|
171
|
+
}) => {
|
|
198
172
|
const {
|
|
199
173
|
translateWithId: t = translateWithId
|
|
200
174
|
} = this.props;
|
|
@@ -214,16 +188,11 @@ class DataTable extends React__default.Component {
|
|
|
214
188
|
});
|
|
215
189
|
/**
|
|
216
190
|
* Get the props associated with an expanded row
|
|
217
|
-
*
|
|
218
|
-
* @param {object} config
|
|
219
|
-
* @param {object} config.row the parent row we want the props for
|
|
220
|
-
* @returns {object}
|
|
221
191
|
*/
|
|
222
|
-
_defineProperty(this, "getExpandedRowProps",
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
} = _ref3;
|
|
192
|
+
_defineProperty(this, "getExpandedRowProps", ({
|
|
193
|
+
row,
|
|
194
|
+
...rest
|
|
195
|
+
}) => {
|
|
227
196
|
return {
|
|
228
197
|
...rest,
|
|
229
198
|
id: `expanded-row-${row.id}`
|
|
@@ -234,15 +203,14 @@ class DataTable extends React__default.Component {
|
|
|
234
203
|
* applicable. Most often used to indicate selection status of the table or
|
|
235
204
|
* for a specific row.
|
|
236
205
|
*/
|
|
237
|
-
_defineProperty(this, "getSelectionProps",
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
206
|
+
_defineProperty(this, "getSelectionProps", ({
|
|
207
|
+
onClick,
|
|
208
|
+
row,
|
|
209
|
+
...rest
|
|
210
|
+
} = {}) => {
|
|
243
211
|
const {
|
|
244
212
|
translateWithId: t = translateWithId
|
|
245
|
-
} =
|
|
213
|
+
} = this.props;
|
|
246
214
|
|
|
247
215
|
// If we're given a row, return the selection state values for that row
|
|
248
216
|
if (row) {
|
|
@@ -250,19 +218,19 @@ class DataTable extends React__default.Component {
|
|
|
250
218
|
return {
|
|
251
219
|
...rest,
|
|
252
220
|
checked: row.isSelected,
|
|
253
|
-
onSelect: composeEventHandlers([
|
|
254
|
-
id: `${
|
|
255
|
-
name: `select-row-${
|
|
221
|
+
onSelect: composeEventHandlers([this.handleOnSelectRow(row.id), onClick]),
|
|
222
|
+
id: `${this.getTablePrefix()}__select-row-${row.id}`,
|
|
223
|
+
name: `select-row-${this.instanceId}`,
|
|
256
224
|
'aria-label': t(translationKey),
|
|
257
225
|
disabled: row.disabled,
|
|
258
|
-
radio:
|
|
226
|
+
radio: this.props.radio
|
|
259
227
|
};
|
|
260
228
|
}
|
|
261
229
|
|
|
262
230
|
// Otherwise, we're working on `TableSelectAll` which handles toggling the
|
|
263
231
|
// selection state of all rows.
|
|
264
|
-
const rowCount =
|
|
265
|
-
const selectedRowCount =
|
|
232
|
+
const rowCount = this.state.rowIds.length;
|
|
233
|
+
const selectedRowCount = this.getSelectedRows().length;
|
|
266
234
|
const checked = rowCount > 0 && selectedRowCount === rowCount;
|
|
267
235
|
const indeterminate = rowCount > 0 && selectedRowCount > 0 && selectedRowCount !== rowCount;
|
|
268
236
|
const translationKey = checked || indeterminate ? translationKeys.unselectAll : translationKeys.selectAll;
|
|
@@ -270,41 +238,36 @@ class DataTable extends React__default.Component {
|
|
|
270
238
|
...rest,
|
|
271
239
|
'aria-label': t(translationKey),
|
|
272
240
|
checked,
|
|
273
|
-
id: `${
|
|
241
|
+
id: `${this.getTablePrefix()}__select-all`,
|
|
274
242
|
indeterminate,
|
|
275
|
-
name: `select-all-${
|
|
276
|
-
onSelect: composeEventHandlers([
|
|
243
|
+
name: `select-all-${this.instanceId}`,
|
|
244
|
+
onSelect: composeEventHandlers([this.handleSelectAll, onClick])
|
|
277
245
|
};
|
|
278
246
|
});
|
|
279
|
-
_defineProperty(this, "getToolbarProps",
|
|
280
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
247
|
+
_defineProperty(this, "getToolbarProps", props => {
|
|
281
248
|
const {
|
|
282
249
|
size
|
|
283
|
-
} =
|
|
250
|
+
} = this.props;
|
|
284
251
|
const isSmall = size === 'xs' || size === 'sm';
|
|
285
252
|
return {
|
|
286
253
|
...props,
|
|
287
254
|
size: isSmall ? 'sm' : undefined
|
|
288
255
|
};
|
|
289
256
|
});
|
|
290
|
-
_defineProperty(this, "getBatchActionProps",
|
|
291
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
257
|
+
_defineProperty(this, "getBatchActionProps", props => {
|
|
292
258
|
const {
|
|
293
259
|
shouldShowBatchActions
|
|
294
|
-
} =
|
|
295
|
-
const totalSelected =
|
|
260
|
+
} = this.state;
|
|
261
|
+
const totalSelected = this.getSelectedRows().length;
|
|
296
262
|
return {
|
|
297
263
|
onSelectAll: undefined,
|
|
298
|
-
totalCount:
|
|
264
|
+
totalCount: this.state.rowIds.length || 0,
|
|
299
265
|
...props,
|
|
300
266
|
shouldShowBatchActions: shouldShowBatchActions && totalSelected > 0,
|
|
301
267
|
totalSelected,
|
|
302
|
-
onCancel:
|
|
268
|
+
onCancel: this.handleOnCancel
|
|
303
269
|
};
|
|
304
270
|
});
|
|
305
|
-
/**
|
|
306
|
-
* Helper utility to get the Table Props.
|
|
307
|
-
*/
|
|
308
271
|
_defineProperty(this, "getTableProps", () => {
|
|
309
272
|
const {
|
|
310
273
|
useZebraStyles,
|
|
@@ -325,9 +288,6 @@ class DataTable extends React__default.Component {
|
|
|
325
288
|
experimentalAutoAlign
|
|
326
289
|
};
|
|
327
290
|
});
|
|
328
|
-
/**
|
|
329
|
-
* Helper utility to get the TableContainer Props.
|
|
330
|
-
*/
|
|
331
291
|
_defineProperty(this, "getTableContainerProps", () => {
|
|
332
292
|
const {
|
|
333
293
|
stickyHeader,
|
|
@@ -340,25 +300,24 @@ class DataTable extends React__default.Component {
|
|
|
340
300
|
});
|
|
341
301
|
/**
|
|
342
302
|
* Get the props associated with the given table cell.
|
|
343
|
-
*
|
|
344
|
-
* @param {object} config
|
|
345
|
-
* @param {object} config.cell the cell we want the props for
|
|
346
|
-
* @returns {object}
|
|
347
303
|
*/
|
|
348
|
-
_defineProperty(this, "getCellProps",
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
304
|
+
_defineProperty(this, "getCellProps", ({
|
|
305
|
+
cell: {
|
|
306
|
+
hasAILabelHeader,
|
|
307
|
+
hasDecoratorHeader
|
|
308
|
+
},
|
|
309
|
+
...rest
|
|
310
|
+
}) => {
|
|
353
311
|
return {
|
|
354
312
|
...rest,
|
|
355
|
-
hasAILabelHeader
|
|
356
|
-
hasDecoratorHeader
|
|
313
|
+
hasAILabelHeader,
|
|
314
|
+
hasDecoratorHeader
|
|
357
315
|
};
|
|
358
316
|
});
|
|
359
317
|
/**
|
|
360
318
|
* Helper utility to get all the currently selected rows
|
|
361
|
-
*
|
|
319
|
+
*
|
|
320
|
+
* @returns the array of rowIds that are currently selected
|
|
362
321
|
*/
|
|
363
322
|
_defineProperty(this, "getSelectedRows", () => this.state.rowIds.filter(id => {
|
|
364
323
|
const row = this.state.rowsById[id];
|
|
@@ -366,8 +325,9 @@ class DataTable extends React__default.Component {
|
|
|
366
325
|
}));
|
|
367
326
|
/**
|
|
368
327
|
* Helper utility to get all of the available rows after applying the filter
|
|
369
|
-
*
|
|
370
|
-
*
|
|
328
|
+
*
|
|
329
|
+
* @returns the array of rowIds that are currently included through the filter
|
|
330
|
+
*/
|
|
371
331
|
_defineProperty(this, "getFilteredRowIds", () => {
|
|
372
332
|
const {
|
|
373
333
|
filterRows = defaultFilterRows
|
|
@@ -387,15 +347,13 @@ class DataTable extends React__default.Component {
|
|
|
387
347
|
/**
|
|
388
348
|
* Helper for getting the table prefix for elements that require an
|
|
389
349
|
* `id` attribute that is unique.
|
|
390
|
-
*
|
|
391
|
-
* @returns {string}
|
|
392
350
|
*/
|
|
393
351
|
_defineProperty(this, "getTablePrefix", () => `data-table-${this.instanceId}`);
|
|
394
352
|
/**
|
|
395
353
|
* Helper for toggling all selected items in a state. Does not call
|
|
396
354
|
* setState, so use it when setting state.
|
|
397
|
-
*
|
|
398
|
-
* @returns
|
|
355
|
+
*
|
|
356
|
+
* @returns object to put into this.setState (use spread operator)
|
|
399
357
|
*/
|
|
400
358
|
_defineProperty(this, "setAllSelectedState", (initialState, isSelected, filteredRowIds) => {
|
|
401
359
|
const {
|
|
@@ -445,9 +403,6 @@ class DataTable extends React__default.Component {
|
|
|
445
403
|
});
|
|
446
404
|
/**
|
|
447
405
|
* Handler for toggling the selection state of a given row.
|
|
448
|
-
*
|
|
449
|
-
* @param {string} rowId
|
|
450
|
-
* @returns {Function}
|
|
451
406
|
*/
|
|
452
407
|
_defineProperty(this, "handleOnSelectRow", rowId => () => {
|
|
453
408
|
this.setState(state => {
|
|
@@ -492,9 +447,6 @@ class DataTable extends React__default.Component {
|
|
|
492
447
|
});
|
|
493
448
|
/**
|
|
494
449
|
* Handler for toggling the expansion state of a given row.
|
|
495
|
-
*
|
|
496
|
-
* @param {string} rowId
|
|
497
|
-
* @returns {Function}
|
|
498
450
|
*/
|
|
499
451
|
_defineProperty(this, "handleOnExpandRow", rowId => () => {
|
|
500
452
|
this.setState(state => {
|
|
@@ -538,8 +490,7 @@ class DataTable extends React__default.Component {
|
|
|
538
490
|
/**
|
|
539
491
|
* Handler for transitioning to the next sort state of the table
|
|
540
492
|
*
|
|
541
|
-
* @param
|
|
542
|
-
* @returns {Function}
|
|
493
|
+
* @param headerKey - The field for the header that we are sorting by.
|
|
543
494
|
*/
|
|
544
495
|
_defineProperty(this, "handleSortBy", headerKey => () => {
|
|
545
496
|
this.setState(state => getNextSortState(this.props, state, {
|
|
@@ -549,8 +500,6 @@ class DataTable extends React__default.Component {
|
|
|
549
500
|
/**
|
|
550
501
|
* Event handler for transitioning input value state changes for the table
|
|
551
502
|
* filter component.
|
|
552
|
-
*
|
|
553
|
-
* @param {Event} event
|
|
554
503
|
*/
|
|
555
504
|
_defineProperty(this, "handleOnInputValueChange", (event, defaultValue) => {
|
|
556
505
|
if (event.target) {
|
|
@@ -571,7 +520,7 @@ class DataTable extends React__default.Component {
|
|
|
571
520
|
this.instanceId = getInstanceId();
|
|
572
521
|
}
|
|
573
522
|
|
|
574
|
-
//
|
|
523
|
+
// If state needs to be updated, defer render until after the update completes.
|
|
575
524
|
shouldComponentUpdate(nextProps) {
|
|
576
525
|
if (this.props !== nextProps) {
|
|
577
526
|
const nextRowIds = nextProps.rows.map(row => row.id);
|
|
@@ -639,16 +588,65 @@ class DataTable extends React__default.Component {
|
|
|
639
588
|
expandAll: this.handleOnExpandAll,
|
|
640
589
|
radio: this.props.radio
|
|
641
590
|
};
|
|
642
|
-
if (render !== undefined) {
|
|
591
|
+
if (typeof render !== 'undefined') {
|
|
643
592
|
return render(renderProps);
|
|
644
593
|
}
|
|
645
|
-
if (children !== undefined) {
|
|
594
|
+
if (typeof children !== 'undefined') {
|
|
646
595
|
return children(renderProps);
|
|
647
596
|
}
|
|
648
597
|
return null;
|
|
649
598
|
}
|
|
650
599
|
}
|
|
651
|
-
_defineProperty(DataTable, "
|
|
600
|
+
_defineProperty(DataTable, "translationKeys", Object.values(translationKeys));
|
|
601
|
+
// TODO: Delete these static properties when the components are converted to a
|
|
602
|
+
// functional component.
|
|
603
|
+
//
|
|
604
|
+
// Static properties for sub-components
|
|
605
|
+
_defineProperty(DataTable, "Table", void 0);
|
|
606
|
+
_defineProperty(DataTable, "TableActionList", void 0);
|
|
607
|
+
_defineProperty(DataTable, "TableBatchAction", void 0);
|
|
608
|
+
_defineProperty(DataTable, "TableBatchActions", void 0);
|
|
609
|
+
_defineProperty(DataTable, "TableBody", void 0);
|
|
610
|
+
_defineProperty(DataTable, "TableCell", void 0);
|
|
611
|
+
_defineProperty(DataTable, "TableContainer", void 0);
|
|
612
|
+
_defineProperty(DataTable, "TableDecoratorRow", void 0);
|
|
613
|
+
_defineProperty(DataTable, "TableExpandHeader", void 0);
|
|
614
|
+
_defineProperty(DataTable, "TableExpandRow", void 0);
|
|
615
|
+
_defineProperty(DataTable, "TableExpandedRow", void 0);
|
|
616
|
+
_defineProperty(DataTable, "TableHead", void 0);
|
|
617
|
+
_defineProperty(DataTable, "TableHeader", void 0);
|
|
618
|
+
_defineProperty(DataTable, "TableRow", void 0);
|
|
619
|
+
_defineProperty(DataTable, "TableSelectAll", void 0);
|
|
620
|
+
_defineProperty(DataTable, "TableSelectRow", void 0);
|
|
621
|
+
_defineProperty(DataTable, "TableSlugRow", void 0);
|
|
622
|
+
_defineProperty(DataTable, "TableToolbar", void 0);
|
|
623
|
+
_defineProperty(DataTable, "TableToolbarAction", void 0);
|
|
624
|
+
_defineProperty(DataTable, "TableToolbarContent", void 0);
|
|
625
|
+
_defineProperty(DataTable, "TableToolbarSearch", void 0);
|
|
626
|
+
_defineProperty(DataTable, "TableToolbarMenu", void 0);
|
|
627
|
+
DataTable.Table = Table;
|
|
628
|
+
DataTable.TableActionList = TableActionList;
|
|
629
|
+
DataTable.TableBatchAction = TableBatchAction;
|
|
630
|
+
DataTable.TableBatchActions = TableBatchActions;
|
|
631
|
+
DataTable.TableBody = TableBody;
|
|
632
|
+
DataTable.TableCell = TableCell;
|
|
633
|
+
DataTable.TableContainer = TableContainer;
|
|
634
|
+
DataTable.TableDecoratorRow = TableDecoratorRow;
|
|
635
|
+
DataTable.TableExpandHeader = TableExpandHeader;
|
|
636
|
+
DataTable.TableExpandRow = TableExpandRow;
|
|
637
|
+
DataTable.TableExpandedRow = TableExpandedRow;
|
|
638
|
+
DataTable.TableHead = TableHead;
|
|
639
|
+
DataTable.TableHeader = TableHeader;
|
|
640
|
+
DataTable.TableRow = TableRow;
|
|
641
|
+
DataTable.TableSelectAll = TableSelectAll;
|
|
642
|
+
DataTable.TableSelectRow = TableSelectRow;
|
|
643
|
+
DataTable.TableSlugRow = TableSlugRow;
|
|
644
|
+
DataTable.TableToolbar = TableToolbar;
|
|
645
|
+
DataTable.TableToolbarAction = TableToolbarAction;
|
|
646
|
+
DataTable.TableToolbarContent = TableToolbarContent;
|
|
647
|
+
DataTable.TableToolbarSearch = TableToolbarSearch;
|
|
648
|
+
DataTable.TableToolbarMenu = TableToolbarMenu;
|
|
649
|
+
DataTable.propTypes = {
|
|
652
650
|
/**
|
|
653
651
|
* 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
|
|
654
652
|
*/
|
|
@@ -723,52 +721,6 @@ _defineProperty(DataTable, "propTypes", {
|
|
|
723
721
|
* `true` to add useZebraStyles striping.
|
|
724
722
|
*/
|
|
725
723
|
useZebraStyles: PropTypes.bool
|
|
726
|
-
}
|
|
727
|
-
_defineProperty(DataTable, "translationKeys", Object.values(translationKeys));
|
|
728
|
-
// Static properties for sub-components
|
|
729
|
-
_defineProperty(DataTable, "Table", void 0);
|
|
730
|
-
_defineProperty(DataTable, "TableActionList", void 0);
|
|
731
|
-
_defineProperty(DataTable, "TableBatchAction", void 0);
|
|
732
|
-
_defineProperty(DataTable, "TableBatchActions", void 0);
|
|
733
|
-
_defineProperty(DataTable, "TableBody", void 0);
|
|
734
|
-
_defineProperty(DataTable, "TableCell", void 0);
|
|
735
|
-
_defineProperty(DataTable, "TableContainer", void 0);
|
|
736
|
-
_defineProperty(DataTable, "TableDecoratorRow", void 0);
|
|
737
|
-
_defineProperty(DataTable, "TableExpandHeader", void 0);
|
|
738
|
-
_defineProperty(DataTable, "TableExpandRow", void 0);
|
|
739
|
-
_defineProperty(DataTable, "TableExpandedRow", void 0);
|
|
740
|
-
_defineProperty(DataTable, "TableHead", void 0);
|
|
741
|
-
_defineProperty(DataTable, "TableHeader", void 0);
|
|
742
|
-
_defineProperty(DataTable, "TableRow", void 0);
|
|
743
|
-
_defineProperty(DataTable, "TableSelectAll", void 0);
|
|
744
|
-
_defineProperty(DataTable, "TableSelectRow", void 0);
|
|
745
|
-
_defineProperty(DataTable, "TableSlugRow", void 0);
|
|
746
|
-
_defineProperty(DataTable, "TableToolbar", void 0);
|
|
747
|
-
_defineProperty(DataTable, "TableToolbarAction", void 0);
|
|
748
|
-
_defineProperty(DataTable, "TableToolbarContent", void 0);
|
|
749
|
-
_defineProperty(DataTable, "TableToolbarSearch", void 0);
|
|
750
|
-
_defineProperty(DataTable, "TableToolbarMenu", void 0);
|
|
751
|
-
DataTable.Table = Table;
|
|
752
|
-
DataTable.TableActionList = TableActionList;
|
|
753
|
-
DataTable.TableBatchAction = TableBatchAction;
|
|
754
|
-
DataTable.TableBatchActions = TableBatchActions;
|
|
755
|
-
DataTable.TableBody = TableBody;
|
|
756
|
-
DataTable.TableCell = TableCell;
|
|
757
|
-
DataTable.TableContainer = TableContainer;
|
|
758
|
-
DataTable.TableDecoratorRow = TableDecoratorRow;
|
|
759
|
-
DataTable.TableExpandHeader = TableExpandHeader;
|
|
760
|
-
DataTable.TableExpandRow = TableExpandRow;
|
|
761
|
-
DataTable.TableExpandedRow = TableExpandedRow;
|
|
762
|
-
DataTable.TableHead = TableHead;
|
|
763
|
-
DataTable.TableHeader = TableHeader;
|
|
764
|
-
DataTable.TableRow = TableRow;
|
|
765
|
-
DataTable.TableSelectAll = TableSelectAll;
|
|
766
|
-
DataTable.TableSelectRow = TableSelectRow;
|
|
767
|
-
DataTable.TableSlugRow = TableSlugRow;
|
|
768
|
-
DataTable.TableToolbar = TableToolbar;
|
|
769
|
-
DataTable.TableToolbarAction = TableToolbarAction;
|
|
770
|
-
DataTable.TableToolbarContent = TableToolbarContent;
|
|
771
|
-
DataTable.TableToolbarSearch = TableToolbarSearch;
|
|
772
|
-
DataTable.TableToolbarMenu = TableToolbarMenu;
|
|
724
|
+
};
|
|
773
725
|
|
|
774
726
|
export { DataTable as default };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { PropsWithChildren } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
-
interface TableProps {
|
|
9
|
+
export interface TableProps {
|
|
10
10
|
experimentalAutoAlign?: boolean;
|
|
11
11
|
className?: string;
|
|
12
12
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import
|
|
9
|
+
import React, { useContext, useState, useRef, useCallback } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -43,20 +43,19 @@ const isElementWrappingContent = (element, context) => {
|
|
|
43
43
|
}
|
|
44
44
|
return false;
|
|
45
45
|
};
|
|
46
|
-
const Table =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} = _ref;
|
|
46
|
+
const Table = ({
|
|
47
|
+
className,
|
|
48
|
+
children,
|
|
49
|
+
useZebraStyles,
|
|
50
|
+
size = 'lg',
|
|
51
|
+
isSortable = false,
|
|
52
|
+
useStaticWidth,
|
|
53
|
+
stickyHeader,
|
|
54
|
+
overflowMenuOnHover = true,
|
|
55
|
+
experimentalAutoAlign = false,
|
|
56
|
+
tabIndex,
|
|
57
|
+
...other
|
|
58
|
+
}) => {
|
|
60
59
|
const {
|
|
61
60
|
titleId,
|
|
62
61
|
descriptionId
|
|
@@ -72,12 +71,10 @@ const Table = _ref => {
|
|
|
72
71
|
[`${prefix}--data-table--sticky-header`]: stickyHeader,
|
|
73
72
|
[`${prefix}--data-table--visible-overflow-menu`]: !overflowMenuOnHover
|
|
74
73
|
});
|
|
75
|
-
const toggleTableBodyAlignmentClass = useCallback(
|
|
76
|
-
let alignTop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
74
|
+
const toggleTableBodyAlignmentClass = useCallback((alignTop = false) => {
|
|
77
75
|
alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-body`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-body`);
|
|
78
76
|
}, [prefix]);
|
|
79
|
-
const toggleTableHeaderAlignmentClass = useCallback(
|
|
80
|
-
let alignTop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
77
|
+
const toggleTableHeaderAlignmentClass = useCallback((alignTop = false) => {
|
|
81
78
|
alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-header`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-header`);
|
|
82
79
|
}, [prefix]);
|
|
83
80
|
const setTableAlignment = useCallback(() => {
|
|
@@ -126,19 +123,19 @@ const Table = _ref => {
|
|
|
126
123
|
useIsomorphicEffect(() => {
|
|
127
124
|
setTableAlignment();
|
|
128
125
|
}, [setTableAlignment, size]);
|
|
129
|
-
const table = /*#__PURE__*/
|
|
126
|
+
const table = /*#__PURE__*/React.createElement("div", {
|
|
130
127
|
className: `${prefix}--data-table-content`
|
|
131
128
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
132
129
|
,
|
|
133
130
|
tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
|
|
134
|
-
}, /*#__PURE__*/
|
|
131
|
+
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
135
132
|
"aria-labelledby": titleId,
|
|
136
133
|
"aria-describedby": descriptionId
|
|
137
134
|
}, other, {
|
|
138
135
|
className: componentClass,
|
|
139
136
|
ref: tableRef
|
|
140
137
|
}), children));
|
|
141
|
-
return stickyHeader ? /*#__PURE__*/
|
|
138
|
+
return stickyHeader ? /*#__PURE__*/React.createElement("section", {
|
|
142
139
|
className: `${prefix}--data-table_inner-container`
|
|
143
140
|
}, table) : table;
|
|
144
141
|
};
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
declare const TableActionList: (props: import("
|
|
7
|
+
declare const TableActionList: (props: import("react").HTMLAttributes<"div">) => React.ReactElement<any>;
|
|
8
8
|
export default TableActionList;
|
|
@@ -7,22 +7,19 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { AddFilled } from '@carbon/icons-react';
|
|
12
12
|
import Button from '../Button/Button.js';
|
|
13
13
|
import '../Button/Button.Skeleton.js';
|
|
14
14
|
|
|
15
|
-
const TableBatchAction =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
iconDescription: iconDescription
|
|
24
|
-
}, props));
|
|
25
|
-
};
|
|
15
|
+
const TableBatchAction = ({
|
|
16
|
+
renderIcon = AddFilled,
|
|
17
|
+
iconDescription = 'Add',
|
|
18
|
+
...props
|
|
19
|
+
}) => /*#__PURE__*/React.createElement(Button, _extends({
|
|
20
|
+
renderIcon: renderIcon,
|
|
21
|
+
iconDescription: iconDescription
|
|
22
|
+
}, props));
|
|
26
23
|
TableBatchAction.propTypes = {
|
|
27
24
|
/**
|
|
28
25
|
* Specify if the button is an icon-only button
|