@carbon/react 1.29.0 → 1.30.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/es/_virtual/_rollupPluginBabelHelpers.js +16 -5
- package/es/components/Accordion/Accordion.Skeleton.js +0 -7
- package/es/components/Accordion/Accordion.js +1 -8
- package/es/components/Accordion/AccordionItem.js +5 -19
- package/es/components/AspectRatio/AspectRatio.js +0 -5
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +0 -3
- package/es/components/Breadcrumb/Breadcrumb.js +0 -3
- package/es/components/Breadcrumb/BreadcrumbItem.js +0 -7
- package/es/components/Button/Button.Skeleton.js +2 -7
- package/es/components/Button/Button.js +2 -36
- package/es/components/ButtonSet/ButtonSet.js +0 -2
- package/es/components/Checkbox/Checkbox.Skeleton.js +0 -1
- package/es/components/Checkbox/Checkbox.js +4 -20
- package/es/components/CheckboxGroup/CheckboxGroup.js +0 -11
- package/es/components/ClassPrefix/index.d.ts +26 -0
- package/es/components/ClassPrefix/index.js +0 -2
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +0 -5
- package/es/components/CodeSnippet/CodeSnippet.js +6 -45
- package/es/components/ComboBox/ComboBox.js +12 -79
- package/es/components/ComboBox/tools/filter.js +0 -1
- package/es/components/ComboButton/index.js +0 -14
- package/es/components/ComposedModal/ComposedModal.js +2 -32
- package/es/components/ComposedModal/ModalFooter.js +0 -21
- package/es/components/ComposedModal/ModalHeader.js +0 -12
- package/es/components/ContainedList/ContainedList.js +5 -32
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -6
- package/es/components/ContentSwitcher/ContentSwitcher.js +11 -23
- package/es/components/ContextMenu/useContextMenu.js +1 -6
- package/es/components/Copy/Copy.js +8 -31
- package/es/components/CopyButton/CopyButton.js +0 -4
- package/es/components/DangerButton/DangerButton.js +0 -1
- package/es/components/DataTable/DataTable.js +171 -91
- package/es/components/DataTable/Table.js +0 -6
- package/es/components/DataTable/TableBatchAction.js +0 -4
- package/es/components/DataTable/TableBatchActions.js +0 -8
- package/es/components/DataTable/TableBody.js +0 -1
- package/es/components/DataTable/TableContainer.js +0 -5
- package/es/components/DataTable/TableExpandHeader.js +0 -7
- package/es/components/DataTable/TableExpandRow.js +0 -6
- package/es/components/DataTable/TableExpandedRow.js +0 -6
- package/es/components/DataTable/TableHeader.d.ts +1 -1
- package/es/components/DataTable/TableHeader.js +3 -19
- package/es/components/DataTable/TableRow.js +4 -5
- package/es/components/DataTable/TableSelectAll.js +0 -8
- package/es/components/DataTable/TableSelectRow.js +2 -10
- package/es/components/DataTable/TableToolbar.js +0 -3
- package/es/components/DataTable/TableToolbarMenu.d.ts +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +3 -6
- package/es/components/DataTable/TableToolbarSearch.js +2 -30
- package/es/components/DataTable/state/getDerivedStateFromProps.js +0 -4
- package/es/components/DataTable/state/sorting.js +5 -8
- package/es/components/DataTable/tools/denormalize.js +2 -2
- package/es/components/DataTable/tools/filter.js +0 -2
- package/es/components/DataTable/tools/instanceId.js +0 -1
- package/es/components/DataTable/tools/normalize.js +10 -10
- package/es/components/DataTable/tools/sorting.js +5 -13
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +5 -20
- package/es/components/DatePicker/DatePicker.Skeleton.js +0 -6
- package/es/components/DatePicker/DatePicker.js +154 -177
- package/es/components/DatePicker/plugins/appendToPlugin.js +3 -7
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +14 -25
- package/es/components/DatePicker/plugins/rangePlugin.js +2 -7
- package/es/components/DatePickerInput/DatePickerInput.js +2 -28
- package/es/components/Dropdown/Dropdown.Skeleton.js +0 -2
- package/es/components/Dropdown/Dropdown.js +43 -52
- package/es/components/ErrorBoundary/ErrorBoundary.js +0 -10
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +0 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -10
- package/es/components/FeatureFlags/index.js +8 -20
- package/es/components/FileUploader/FileUploader.Skeleton.js +0 -2
- package/es/components/FileUploader/FileUploader.js +3 -38
- package/es/components/FileUploader/FileUploaderButton.js +3 -24
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -28
- package/es/components/FileUploader/FileUploaderItem.js +1 -11
- package/es/components/FileUploader/Filename.js +0 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +0 -1
- package/es/components/FluidComboBox/FluidComboBox.js +0 -18
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +0 -2
- package/es/components/FluidDatePicker/FluidDatePicker.js +0 -6
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +2 -1
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +0 -1
- package/es/components/FluidDropdown/FluidDropdown.js +0 -18
- package/es/components/FluidForm/FluidForm.js +0 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +0 -1
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +0 -19
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +0 -1
- package/es/components/FluidSelect/FluidSelect.js +0 -10
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +0 -1
- package/es/components/FluidTextArea/FluidTextArea.js +0 -20
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +0 -1
- package/es/components/FluidTextInput/FluidTextInput.js +0 -14
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +0 -3
- package/es/components/FluidTimePicker/FluidTimePicker.js +1 -11
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +0 -6
- package/es/components/Form/Form.d.ts +23 -0
- package/es/components/Form/Form.js +3 -6
- package/es/components/Form/index.d.ts +7 -0
- package/es/components/FormGroup/FormGroup.js +0 -7
- package/es/components/FormItem/FormItem.js +0 -2
- package/es/components/FormLabel/FormLabel.js +1 -7
- package/es/components/Grid/CSSGrid.js +2 -15
- package/es/components/Grid/Column.js +18 -59
- package/es/components/Grid/ColumnHang.js +2 -5
- package/es/components/Grid/FlexGrid.js +2 -8
- package/es/components/Grid/Grid.js +0 -8
- package/es/components/Grid/GridContext.js +1 -3
- package/es/components/Grid/Row.js +2 -7
- package/es/components/Heading/index.js +0 -4
- package/es/components/Icon/Icon.Skeleton.js +2 -2
- package/es/components/IconButton/index.js +0 -10
- package/es/components/IdPrefix/index.js +0 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +0 -14
- package/es/components/InlineLoading/InlineLoading.js +0 -12
- package/es/components/Layer/index.js +3 -6
- package/es/components/Layout/LayoutDirection.js +0 -3
- package/es/components/Layout/useLayoutDirection.js +0 -1
- package/es/components/Link/Link.js +3 -10
- package/es/components/ListBox/ListBox.js +2 -13
- package/es/components/ListBox/ListBoxField.js +0 -5
- package/es/components/ListBox/ListBoxMenuIcon.js +0 -4
- package/es/components/ListBox/ListBoxMenuItem.js +2 -6
- package/es/components/ListBox/ListBoxPropTypes.d.ts +2 -2
- package/es/components/ListBox/ListBoxSelection.js +1 -13
- package/es/components/ListBox/next/ListBoxSelection.js +1 -14
- package/es/components/ListBox/next/ListBoxTrigger.js +1 -3
- package/es/components/ListItem/ListItem.d.ts +23 -0
- package/es/components/ListItem/ListItem.js +4 -8
- package/es/components/ListItem/index.d.ts +7 -0
- package/es/components/Loading/Loading.js +0 -6
- package/es/components/Menu/Menu.js +22 -40
- package/es/components/Menu/MenuContext.js +4 -5
- package/es/components/Menu/MenuItem.js +5 -39
- package/es/components/MenuButton/index.js +0 -9
- package/es/components/Modal/Modal.js +0 -43
- package/es/components/ModalWrapper/ModalWrapper.js +2 -15
- package/es/components/MultiSelect/FilterableMultiSelect.js +2 -60
- package/es/components/MultiSelect/MultiSelect.js +22 -70
- package/es/components/MultiSelect/MultiSelectPropTypes.js +0 -1
- package/es/components/MultiSelect/index.js +0 -1
- package/es/components/MultiSelect/tools/itemToString.js +0 -2
- package/es/components/MultiSelect/tools/sorting.js +3 -4
- package/es/components/Notification/Notification.js +0 -78
- package/es/components/NumberInput/NumberInput.Skeleton.js +0 -2
- package/es/components/NumberInput/NumberInput.js +3 -60
- package/es/components/OrderedList/OrderedList.d.ts +39 -0
- package/es/components/OrderedList/OrderedList.js +7 -19
- package/es/components/{Form/index.js → OrderedList/index.d.ts} +1 -3
- package/es/components/OverflowMenu/OverflowMenu.js +65 -86
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +6 -23
- package/es/components/OverflowMenuV2/index.js +0 -5
- package/es/components/Pagination/Pagination.Skeleton.js +0 -2
- package/es/components/Pagination/Pagination.js +11 -47
- package/es/components/Pagination/experimental/PageSelector.js +0 -10
- package/es/components/Pagination/experimental/Pagination.js +2 -48
- package/es/components/PaginationNav/PaginationNav.js +15 -59
- package/es/components/Popover/index.d.ts +14 -8
- package/es/components/Popover/index.js +44 -48
- package/es/components/PrimaryButton/PrimaryButton.js +0 -1
- package/es/components/ProgressBar/ProgressBar.js +0 -15
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +0 -4
- package/es/components/ProgressIndicator/ProgressIndicator.js +2 -40
- package/es/components/RadioButton/RadioButton.Skeleton.js +0 -1
- package/es/components/RadioButton/RadioButton.js +0 -13
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +3 -23
- package/es/components/RadioTile/RadioTile.js +0 -12
- package/es/components/Search/Search.Skeleton.js +0 -2
- package/es/components/Search/Search.js +1 -28
- package/es/components/SecondaryButton/SecondaryButton.js +0 -1
- package/es/components/Select/Select.Skeleton.js +0 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Select/Select.js +6 -33
- package/es/components/SelectItem/SelectItem.js +0 -5
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +0 -1
- package/es/components/SelectItemGroup/SelectItemGroup.js +1 -7
- package/es/components/SkeletonIcon/SkeletonIcon.js +0 -2
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +0 -1
- package/es/components/SkeletonText/SkeletonText.js +0 -12
- package/es/components/Slider/Slider.Skeleton.js +0 -2
- package/es/components/Slider/Slider.d.ts +0 -1
- package/es/components/Slider/Slider.js +112 -135
- package/es/components/Stack/Stack.js +1 -8
- package/es/components/StructuredList/StructuredList.Skeleton.js +0 -5
- package/es/components/StructuredList/StructuredList.js +1 -25
- package/es/components/Switch/IconSwitch.js +0 -18
- package/es/components/Switch/Switch.js +0 -11
- package/es/components/TabContent/TabContent.js +2 -6
- package/es/components/Tabs/Tabs.Skeleton.js +0 -4
- package/es/components/Tabs/Tabs.js +135 -104
- package/es/components/Tabs/usePressable.js +18 -31
- package/es/components/Tag/Tag.Skeleton.js +0 -2
- package/es/components/Tag/Tag.js +0 -15
- package/es/components/Text/Text.js +5 -18
- package/es/components/Text/TextDirection.js +0 -3
- package/es/components/Text/TextDirectionContext.js +0 -1
- package/es/components/Text/createTextComponent.js +0 -3
- package/es/components/TextArea/TextArea.Skeleton.js +0 -2
- package/es/components/TextArea/TextArea.js +11 -33
- package/es/components/TextInput/ControlledPasswordInput.js +0 -20
- package/es/components/TextInput/PasswordInput.js +0 -25
- package/es/components/TextInput/TextInput.Skeleton.js +0 -2
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +5 -33
- package/es/components/TextInput/util.js +3 -5
- package/es/components/Theme/index.js +1 -6
- package/es/components/Tile/Tile.js +32 -59
- package/es/components/TileGroup/TileGroup.js +1 -22
- package/es/components/TimePicker/TimePicker.js +6 -32
- package/es/components/TimePickerSelect/TimePickerSelect.js +2 -5
- package/es/components/Toggle/Toggle.Skeleton.js +0 -8
- package/es/components/Toggle/Toggle.js +0 -16
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +0 -7
- package/es/components/Toggletip/index.d.ts +148 -0
- package/es/components/Toggletip/index.js +20 -44
- package/es/components/Tooltip/DefinitionTooltip.js +0 -11
- package/es/components/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/Tooltip/Tooltip.js +4 -21
- package/es/components/TreeView/TreeNode.js +21 -66
- package/es/components/TreeView/TreeView.js +11 -67
- package/es/components/UIShell/Content.js +2 -4
- package/es/components/UIShell/Header.js +0 -2
- package/es/components/UIShell/HeaderContainer.d.ts +33 -0
- package/es/components/UIShell/HeaderContainer.js +13 -11
- package/es/components/UIShell/HeaderGlobalAction.js +0 -6
- package/es/components/UIShell/HeaderGlobalBar.js +0 -1
- package/es/components/UIShell/HeaderMenu.js +32 -31
- package/es/components/UIShell/HeaderMenuButton.js +2 -4
- package/es/components/UIShell/HeaderMenuItem.js +0 -8
- package/es/components/UIShell/HeaderName.js +0 -5
- package/es/components/UIShell/HeaderNavigation.js +0 -2
- package/es/components/UIShell/HeaderPanel.js +0 -2
- package/es/components/UIShell/HeaderSideNavItems.js +0 -2
- package/es/components/UIShell/Link.js +2 -3
- package/es/components/UIShell/SideNav.d.ts +3 -1
- package/es/components/UIShell/SideNav.js +44 -36
- package/es/components/UIShell/SideNavDetails.js +0 -3
- package/es/components/UIShell/SideNavDivider.js +0 -1
- package/es/components/UIShell/SideNavFooter.js +1 -4
- package/es/components/UIShell/SideNavHeader.js +0 -4
- package/es/components/UIShell/SideNavIcon.js +0 -3
- package/es/components/UIShell/SideNavItem.js +0 -3
- package/es/components/UIShell/SideNavItems.js +2 -6
- package/es/components/UIShell/SideNavLink.js +3 -7
- package/es/components/UIShell/SideNavLinkText.js +0 -2
- package/es/components/UIShell/SideNavMenu.js +0 -16
- package/es/components/UIShell/SideNavMenuItem.js +0 -2
- package/es/components/UIShell/SideNavSwitcher.js +2 -5
- package/es/components/UIShell/SkipToContent.d.ts +32 -0
- package/es/components/UIShell/SkipToContent.js +8 -15
- package/es/components/UIShell/Switcher.js +0 -2
- package/es/components/UIShell/SwitcherDivider.js +0 -1
- package/es/components/UIShell/SwitcherItem.js +0 -3
- package/es/components/UnorderedList/UnorderedList.d.ts +34 -0
- package/es/components/UnorderedList/UnorderedList.js +6 -16
- package/es/components/UnorderedList/index.d.ts +7 -0
- package/es/index.js +7 -8
- package/es/internal/ClickListener.js +3 -13
- package/es/internal/FloatingMenu.js +57 -63
- package/es/internal/OptimizedResize.js +6 -12
- package/es/internal/Selection.js +2 -25
- package/es/internal/createClassWrapper.js +0 -2
- package/es/internal/deprecateFieldOnObject.js +0 -4
- package/es/internal/focus/index.js +0 -1
- package/es/internal/keyboard/keys.js +2 -1
- package/es/internal/keyboard/match.js +1 -6
- package/es/internal/keyboard/navigation.js +8 -7
- package/es/internal/useAnnouncer.js +0 -1
- package/es/internal/useAttachedMenu.js +1 -9
- package/es/internal/useControllableState.js +6 -13
- package/es/internal/useDelayedState.js +2 -4
- package/es/internal/useEffectOnce.js +0 -1
- package/es/internal/useEvent.js +61 -3
- package/es/internal/useId.js +2 -5
- package/es/internal/useIsomorphicEffect.js +1 -0
- package/es/internal/useMergedRefs.js +2 -2
- package/es/internal/useNoInteractiveChildren.js +2 -13
- package/es/internal/useNormalizedInputProps.js +0 -3
- package/es/internal/useSavedCallback.js +1 -2
- package/es/internal/warning.js +0 -3
- package/es/internal/wrapFocus.js +1 -8
- package/es/prop-types/deprecate.js +2 -5
- package/es/prop-types/isRequiredOneOf.js +2 -5
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +0 -2
- package/es/tools/array.js +0 -3
- package/es/tools/events.js +0 -3
- package/es/tools/mergeRefs.js +0 -2
- package/es/tools/wrapComponent.js +2 -5
- package/lib/_virtual/_rollupPluginBabelHelpers.js +17 -4
- package/lib/components/Accordion/Accordion.Skeleton.js +0 -7
- package/lib/components/Accordion/Accordion.js +1 -27
- package/lib/components/Accordion/AccordionItem.js +5 -19
- package/lib/components/AspectRatio/AspectRatio.js +0 -5
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +0 -3
- package/lib/components/Breadcrumb/Breadcrumb.js +0 -3
- package/lib/components/Breadcrumb/BreadcrumbItem.js +0 -7
- package/lib/components/Button/Button.Skeleton.js +2 -26
- package/lib/components/Button/Button.js +2 -36
- package/lib/components/ButtonSet/ButtonSet.js +0 -2
- package/lib/components/Checkbox/Checkbox.Skeleton.js +0 -1
- package/lib/components/Checkbox/Checkbox.js +4 -20
- package/lib/components/CheckboxGroup/CheckboxGroup.js +0 -11
- package/lib/components/ClassPrefix/index.d.ts +26 -0
- package/lib/components/ClassPrefix/index.js +0 -2
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +0 -5
- package/lib/components/CodeSnippet/CodeSnippet.js +6 -45
- package/lib/components/ComboBox/ComboBox.js +19 -86
- package/lib/components/ComboBox/tools/filter.js +0 -1
- package/lib/components/ComboButton/index.js +0 -14
- package/lib/components/ComposedModal/ComposedModal.js +2 -32
- package/lib/components/ComposedModal/ModalFooter.js +0 -21
- package/lib/components/ComposedModal/ModalHeader.js +0 -12
- package/lib/components/ContainedList/ContainedList.js +5 -32
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -6
- package/lib/components/ContentSwitcher/ContentSwitcher.js +11 -23
- package/lib/components/ContextMenu/useContextMenu.js +1 -6
- package/lib/components/Copy/Copy.js +8 -50
- package/lib/components/CopyButton/CopyButton.js +0 -4
- package/lib/components/DangerButton/DangerButton.js +0 -1
- package/lib/components/DataTable/DataTable.js +171 -91
- package/lib/components/DataTable/Table.js +0 -6
- package/lib/components/DataTable/TableBatchAction.js +0 -4
- package/lib/components/DataTable/TableBatchActions.js +0 -8
- package/lib/components/DataTable/TableBody.js +0 -1
- package/lib/components/DataTable/TableContainer.js +0 -5
- package/lib/components/DataTable/TableExpandHeader.js +0 -7
- package/lib/components/DataTable/TableExpandRow.js +0 -6
- package/lib/components/DataTable/TableExpandedRow.js +0 -6
- package/lib/components/DataTable/TableHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.js +3 -19
- package/lib/components/DataTable/TableRow.js +4 -5
- package/lib/components/DataTable/TableSelectAll.js +0 -8
- package/lib/components/DataTable/TableSelectRow.js +2 -10
- package/lib/components/DataTable/TableToolbar.js +0 -3
- package/lib/components/DataTable/TableToolbarMenu.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +3 -6
- package/lib/components/DataTable/TableToolbarSearch.js +2 -30
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +0 -4
- package/lib/components/DataTable/state/sorting.js +5 -8
- package/lib/components/DataTable/tools/denormalize.js +2 -2
- package/lib/components/DataTable/tools/filter.js +0 -2
- package/lib/components/DataTable/tools/instanceId.js +0 -1
- package/lib/components/DataTable/tools/normalize.js +10 -10
- package/lib/components/DataTable/tools/sorting.js +5 -13
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +5 -20
- package/lib/components/DatePicker/DatePicker.Skeleton.js +0 -6
- package/lib/components/DatePicker/DatePicker.js +154 -177
- package/lib/components/DatePicker/plugins/appendToPlugin.js +3 -7
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +14 -25
- package/lib/components/DatePicker/plugins/rangePlugin.js +2 -7
- package/lib/components/DatePickerInput/DatePickerInput.js +2 -28
- package/lib/components/Dropdown/Dropdown.Skeleton.js +0 -2
- package/lib/components/Dropdown/Dropdown.js +50 -59
- package/lib/components/ErrorBoundary/ErrorBoundary.js +0 -10
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +0 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -10
- package/lib/components/FeatureFlags/index.js +8 -20
- package/lib/components/FileUploader/FileUploader.Skeleton.js +0 -2
- package/lib/components/FileUploader/FileUploader.js +3 -57
- package/lib/components/FileUploader/FileUploaderButton.js +3 -43
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -28
- package/lib/components/FileUploader/FileUploaderItem.js +1 -30
- package/lib/components/FileUploader/Filename.js +0 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +0 -1
- package/lib/components/FluidComboBox/FluidComboBox.js +0 -18
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +0 -2
- package/lib/components/FluidDatePicker/FluidDatePicker.js +0 -6
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +2 -1
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +0 -1
- package/lib/components/FluidDropdown/FluidDropdown.js +0 -18
- package/lib/components/FluidForm/FluidForm.js +0 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +0 -1
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +0 -19
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +0 -1
- package/lib/components/FluidSelect/FluidSelect.js +0 -10
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +0 -1
- package/lib/components/FluidTextArea/FluidTextArea.js +0 -20
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +0 -1
- package/lib/components/FluidTextInput/FluidTextInput.js +0 -14
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +0 -3
- package/lib/components/FluidTimePicker/FluidTimePicker.js +1 -11
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +0 -6
- package/lib/components/Form/Form.d.ts +23 -0
- package/lib/components/Form/Form.js +3 -6
- package/lib/components/Form/index.d.ts +7 -0
- package/lib/components/FormGroup/FormGroup.js +0 -7
- package/lib/components/FormItem/FormItem.js +0 -2
- package/lib/components/FormLabel/FormLabel.js +1 -26
- package/lib/components/Grid/CSSGrid.js +2 -15
- package/lib/components/Grid/Column.js +18 -59
- package/lib/components/Grid/ColumnHang.js +2 -5
- package/lib/components/Grid/FlexGrid.js +2 -8
- package/lib/components/Grid/Grid.js +0 -8
- package/lib/components/Grid/GridContext.js +1 -3
- package/lib/components/Grid/Row.js +2 -7
- package/lib/components/Heading/index.js +0 -4
- package/lib/components/Icon/Icon.Skeleton.js +2 -2
- package/lib/components/IconButton/index.js +0 -10
- package/lib/components/IdPrefix/index.js +0 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +0 -14
- package/lib/components/InlineLoading/InlineLoading.js +0 -12
- package/lib/components/Layer/index.js +3 -6
- package/lib/components/Layout/LayoutDirection.js +0 -3
- package/lib/components/Layout/useLayoutDirection.js +0 -1
- package/lib/components/Link/Link.js +3 -10
- package/lib/components/ListBox/ListBox.js +2 -13
- package/lib/components/ListBox/ListBoxField.js +0 -5
- package/lib/components/ListBox/ListBoxMenuIcon.js +0 -4
- package/lib/components/ListBox/ListBoxMenuItem.js +2 -6
- package/lib/components/ListBox/ListBoxPropTypes.d.ts +2 -2
- package/lib/components/ListBox/ListBoxSelection.js +1 -13
- package/lib/components/ListBox/next/ListBoxSelection.js +1 -14
- package/lib/components/ListBox/next/ListBoxTrigger.js +1 -3
- package/lib/components/ListItem/ListItem.d.ts +23 -0
- package/lib/components/ListItem/ListItem.js +4 -8
- package/lib/components/ListItem/index.d.ts +7 -0
- package/lib/components/Loading/Loading.js +0 -6
- package/lib/components/Menu/Menu.js +22 -40
- package/lib/components/Menu/MenuContext.js +4 -5
- package/lib/components/Menu/MenuItem.js +5 -39
- package/lib/components/MenuButton/index.js +0 -9
- package/lib/components/Modal/Modal.js +0 -43
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -15
- package/lib/components/MultiSelect/FilterableMultiSelect.js +8 -66
- package/lib/components/MultiSelect/MultiSelect.js +30 -78
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +0 -1
- package/lib/components/MultiSelect/index.js +0 -1
- package/lib/components/MultiSelect/tools/itemToString.js +0 -2
- package/lib/components/MultiSelect/tools/sorting.js +3 -4
- package/lib/components/Notification/Notification.js +0 -78
- package/lib/components/NumberInput/NumberInput.Skeleton.js +0 -2
- package/lib/components/NumberInput/NumberInput.js +3 -60
- package/lib/components/OrderedList/OrderedList.d.ts +39 -0
- package/lib/components/OrderedList/OrderedList.js +7 -19
- package/lib/components/OrderedList/index.d.ts +7 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +65 -86
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +6 -23
- package/lib/components/OverflowMenuV2/index.js +0 -5
- package/lib/components/Pagination/Pagination.Skeleton.js +0 -2
- package/lib/components/Pagination/Pagination.js +11 -47
- package/lib/components/Pagination/experimental/PageSelector.js +0 -10
- package/lib/components/Pagination/experimental/Pagination.js +2 -67
- package/lib/components/PaginationNav/PaginationNav.js +15 -78
- package/lib/components/Popover/index.d.ts +14 -8
- package/lib/components/Popover/index.js +44 -48
- package/lib/components/PrimaryButton/PrimaryButton.js +0 -1
- package/lib/components/ProgressBar/ProgressBar.js +0 -15
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +0 -4
- package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -40
- package/lib/components/RadioButton/RadioButton.Skeleton.js +0 -1
- package/lib/components/RadioButton/RadioButton.js +0 -13
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +3 -23
- package/lib/components/RadioTile/RadioTile.js +0 -12
- package/lib/components/Search/Search.Skeleton.js +0 -2
- package/lib/components/Search/Search.js +1 -28
- package/lib/components/SecondaryButton/SecondaryButton.js +0 -1
- package/lib/components/Select/Select.Skeleton.js +0 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/Select.js +6 -33
- package/lib/components/SelectItem/SelectItem.js +0 -5
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +0 -1
- package/lib/components/SelectItemGroup/SelectItemGroup.js +1 -26
- package/lib/components/SkeletonIcon/SkeletonIcon.js +0 -2
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +0 -1
- package/lib/components/SkeletonText/SkeletonText.js +0 -12
- package/lib/components/Slider/Slider.Skeleton.js +0 -2
- package/lib/components/Slider/Slider.d.ts +0 -1
- package/lib/components/Slider/Slider.js +112 -154
- package/lib/components/Stack/Stack.js +1 -8
- package/lib/components/StructuredList/StructuredList.Skeleton.js +0 -5
- package/lib/components/StructuredList/StructuredList.js +1 -25
- package/lib/components/Switch/IconSwitch.js +0 -18
- package/lib/components/Switch/Switch.js +0 -11
- package/lib/components/TabContent/TabContent.js +2 -6
- package/lib/components/Tabs/Tabs.Skeleton.js +0 -4
- package/lib/components/Tabs/Tabs.js +133 -102
- package/lib/components/Tabs/usePressable.js +18 -31
- package/lib/components/Tag/Tag.Skeleton.js +0 -2
- package/lib/components/Tag/Tag.js +0 -15
- package/lib/components/Text/Text.js +5 -18
- package/lib/components/Text/TextDirection.js +0 -3
- package/lib/components/Text/TextDirectionContext.js +0 -1
- package/lib/components/Text/createTextComponent.js +0 -3
- package/lib/components/TextArea/TextArea.Skeleton.js +0 -2
- package/lib/components/TextArea/TextArea.js +10 -32
- package/lib/components/TextInput/ControlledPasswordInput.js +0 -20
- package/lib/components/TextInput/PasswordInput.js +0 -25
- package/lib/components/TextInput/TextInput.Skeleton.js +0 -2
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.js +5 -52
- package/lib/components/TextInput/util.js +3 -5
- package/lib/components/Theme/index.js +1 -6
- package/lib/components/Tile/Tile.js +31 -58
- package/lib/components/TileGroup/TileGroup.js +1 -22
- package/lib/components/TimePicker/TimePicker.js +6 -32
- package/lib/components/TimePickerSelect/TimePickerSelect.js +2 -5
- package/lib/components/Toggle/Toggle.Skeleton.js +0 -8
- package/lib/components/Toggle/Toggle.js +0 -16
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +0 -7
- package/lib/components/Toggletip/index.d.ts +148 -0
- package/lib/components/Toggletip/index.js +20 -44
- package/lib/components/Tooltip/DefinitionTooltip.js +0 -11
- package/lib/components/Tooltip/Tooltip.d.ts +1 -1
- package/lib/components/Tooltip/Tooltip.js +4 -21
- package/lib/components/TreeView/TreeNode.js +21 -66
- package/lib/components/TreeView/TreeView.js +11 -67
- package/lib/components/UIShell/Content.js +2 -4
- package/lib/components/UIShell/Header.js +0 -2
- package/lib/components/UIShell/HeaderContainer.d.ts +33 -0
- package/lib/components/UIShell/HeaderContainer.js +13 -11
- package/lib/components/UIShell/HeaderGlobalAction.js +0 -6
- package/lib/components/UIShell/HeaderGlobalBar.js +0 -1
- package/lib/components/UIShell/HeaderMenu.js +32 -31
- package/lib/components/UIShell/HeaderMenuButton.js +2 -4
- package/lib/components/UIShell/HeaderMenuItem.js +0 -8
- package/lib/components/UIShell/HeaderName.js +0 -5
- package/lib/components/UIShell/HeaderNavigation.js +0 -2
- package/lib/components/UIShell/HeaderPanel.js +0 -2
- package/lib/components/UIShell/HeaderSideNavItems.js +0 -2
- package/lib/components/UIShell/Link.js +2 -3
- package/lib/components/UIShell/SideNav.d.ts +3 -1
- package/lib/components/UIShell/SideNav.js +43 -35
- package/lib/components/UIShell/SideNavDetails.js +0 -3
- package/lib/components/UIShell/SideNavDivider.js +0 -1
- package/lib/components/UIShell/SideNavFooter.js +1 -4
- package/lib/components/UIShell/SideNavHeader.js +0 -4
- package/lib/components/UIShell/SideNavIcon.js +0 -3
- package/lib/components/UIShell/SideNavItem.js +0 -3
- package/lib/components/UIShell/SideNavItems.js +2 -6
- package/lib/components/UIShell/SideNavLink.js +3 -7
- package/lib/components/UIShell/SideNavLinkText.js +0 -2
- package/lib/components/UIShell/SideNavMenu.js +0 -16
- package/lib/components/UIShell/SideNavMenuItem.js +0 -2
- package/lib/components/UIShell/SideNavSwitcher.js +2 -5
- package/lib/components/UIShell/SkipToContent.d.ts +32 -0
- package/lib/components/UIShell/SkipToContent.js +8 -15
- package/lib/components/UIShell/Switcher.js +0 -2
- package/lib/components/UIShell/SwitcherDivider.js +0 -1
- package/lib/components/UIShell/SwitcherItem.js +0 -3
- package/lib/components/UnorderedList/UnorderedList.d.ts +34 -0
- package/lib/components/UnorderedList/UnorderedList.js +6 -16
- package/lib/components/UnorderedList/index.d.ts +7 -0
- package/lib/index.js +42 -43
- package/lib/internal/ClickListener.js +3 -13
- package/lib/internal/FloatingMenu.js +57 -63
- package/lib/internal/OptimizedResize.js +6 -12
- package/lib/internal/Selection.js +2 -25
- package/lib/internal/createClassWrapper.js +0 -2
- package/lib/internal/deprecateFieldOnObject.js +0 -4
- package/lib/internal/focus/index.js +0 -1
- package/lib/internal/keyboard/keys.js +2 -1
- package/lib/internal/keyboard/match.js +1 -6
- package/lib/internal/keyboard/navigation.js +8 -7
- package/lib/internal/useAnnouncer.js +0 -1
- package/lib/internal/useAttachedMenu.js +1 -9
- package/lib/internal/useControllableState.js +6 -13
- package/lib/internal/useDelayedState.js +2 -4
- package/lib/internal/useEffectOnce.js +0 -1
- package/lib/internal/useEvent.js +61 -2
- package/lib/internal/useId.js +2 -5
- package/lib/internal/useIsomorphicEffect.js +1 -0
- package/lib/internal/useMergedRefs.js +2 -2
- package/lib/internal/useNoInteractiveChildren.js +2 -13
- package/lib/internal/useNormalizedInputProps.js +0 -3
- package/lib/internal/useSavedCallback.js +1 -2
- package/lib/internal/warning.js +0 -3
- package/lib/internal/wrapFocus.js +1 -8
- package/lib/prop-types/deprecate.js +2 -5
- package/lib/prop-types/isRequiredOneOf.js +2 -5
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +0 -2
- package/lib/tools/array.js +0 -3
- package/lib/tools/events.js +0 -3
- package/lib/tools/mergeRefs.js +0 -2
- package/lib/tools/wrapComponent.js +2 -5
- package/package.json +9 -9
- package/es/components/Tab/Tab.js +0 -185
- package/es/components/Tab/index.js +0 -14
- package/es/components/TimePickerSelect/index.js +0 -13
- package/lib/components/Form/index.js +0 -17
- package/lib/components/Tab/Tab.js +0 -214
- package/lib/components/Tab/index.js +0 -39
- package/lib/components/TimePickerSelect/index.js +0 -38
|
@@ -59,8 +59,8 @@ const defaultTranslations = {
|
|
|
59
59
|
[translationKeys.selectRow]: 'Select row',
|
|
60
60
|
[translationKeys.unselectRow]: 'Unselect row'
|
|
61
61
|
};
|
|
62
|
-
|
|
63
62
|
const translateWithId = id => defaultTranslations[id];
|
|
63
|
+
|
|
64
64
|
/**
|
|
65
65
|
* Data Tables are used to represent a collection of resources, displaying a
|
|
66
66
|
* subset of their fields in columns, or headers. We prioritize direct updates
|
|
@@ -71,15 +71,11 @@ const translateWithId = id => defaultTranslations[id];
|
|
|
71
71
|
* and updating the state of the single entity will cascade updates to the
|
|
72
72
|
* consumer.
|
|
73
73
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
74
|
class DataTable extends React__default.Component {
|
|
77
75
|
constructor(_props) {
|
|
78
76
|
var _this;
|
|
79
|
-
|
|
80
77
|
super(_props);
|
|
81
78
|
_this = this;
|
|
82
|
-
|
|
83
79
|
_defineProperty(this, "getHeaderProps", _ref => {
|
|
84
80
|
let {
|
|
85
81
|
header,
|
|
@@ -91,7 +87,8 @@ class DataTable extends React__default.Component {
|
|
|
91
87
|
sortDirection,
|
|
92
88
|
sortHeaderKey
|
|
93
89
|
} = this.state;
|
|
94
|
-
return {
|
|
90
|
+
return {
|
|
91
|
+
...rest,
|
|
95
92
|
key: header.key,
|
|
96
93
|
sortDirection,
|
|
97
94
|
isSortable,
|
|
@@ -109,7 +106,6 @@ class DataTable extends React__default.Component {
|
|
|
109
106
|
}
|
|
110
107
|
};
|
|
111
108
|
});
|
|
112
|
-
|
|
113
109
|
_defineProperty(this, "getExpandHeaderProps", function () {
|
|
114
110
|
let {
|
|
115
111
|
onClick,
|
|
@@ -126,7 +122,8 @@ class DataTable extends React__default.Component {
|
|
|
126
122
|
} = _this.state;
|
|
127
123
|
const isExpanded = isExpandedAll || rowIds.every(id => rowsById[id].isExpanded);
|
|
128
124
|
const translationKey = isExpanded ? translationKeys.collapseAll : translationKeys.expandAll;
|
|
129
|
-
return {
|
|
125
|
+
return {
|
|
126
|
+
...rest,
|
|
130
127
|
ariaLabel: t(translationKey),
|
|
131
128
|
isExpanded,
|
|
132
129
|
// Compose the event handlers so we don't overwrite a consumer's `onClick`
|
|
@@ -136,15 +133,12 @@ class DataTable extends React__default.Component {
|
|
|
136
133
|
}) : null])
|
|
137
134
|
};
|
|
138
135
|
});
|
|
139
|
-
|
|
140
136
|
_defineProperty(this, "handleOnHeaderClick", (onClick, sortParams) => {
|
|
141
137
|
return e => onClick(e, sortParams);
|
|
142
138
|
});
|
|
143
|
-
|
|
144
139
|
_defineProperty(this, "handleOnExpandHeaderClick", (onClick, expandParams) => {
|
|
145
140
|
return e => onClick(e, expandParams);
|
|
146
141
|
});
|
|
147
|
-
|
|
148
142
|
_defineProperty(this, "getRowProps", _ref2 => {
|
|
149
143
|
let {
|
|
150
144
|
row,
|
|
@@ -155,7 +149,8 @@ class DataTable extends React__default.Component {
|
|
|
155
149
|
translateWithId: t
|
|
156
150
|
} = this.props;
|
|
157
151
|
const translationKey = row.isExpanded ? translationKeys.collapseRow : translationKeys.expandRow;
|
|
158
|
-
return {
|
|
152
|
+
return {
|
|
153
|
+
...rest,
|
|
159
154
|
key: row.id,
|
|
160
155
|
// Compose the event handlers so we don't overwrite a consumer's `onClick`
|
|
161
156
|
// handler
|
|
@@ -166,7 +161,6 @@ class DataTable extends React__default.Component {
|
|
|
166
161
|
disabled: row.disabled
|
|
167
162
|
};
|
|
168
163
|
});
|
|
169
|
-
|
|
170
164
|
_defineProperty(this, "getSelectionProps", function () {
|
|
171
165
|
let {
|
|
172
166
|
onClick,
|
|
@@ -175,11 +169,13 @@ class DataTable extends React__default.Component {
|
|
|
175
169
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
176
170
|
const {
|
|
177
171
|
translateWithId: t
|
|
178
|
-
} = _this.props;
|
|
172
|
+
} = _this.props;
|
|
179
173
|
|
|
174
|
+
// If we're given a row, return the selection state values for that row
|
|
180
175
|
if (row) {
|
|
181
176
|
const translationKey = row.isSelected ? translationKeys.unselectRow : translationKeys.selectRow;
|
|
182
|
-
return {
|
|
177
|
+
return {
|
|
178
|
+
...rest,
|
|
183
179
|
checked: row.isSelected,
|
|
184
180
|
onSelect: composeEventHandlers([_this.handleOnSelectRow(row.id), onClick]),
|
|
185
181
|
id: `${_this.getTablePrefix()}__select-row-${row.id}`,
|
|
@@ -188,18 +184,17 @@ class DataTable extends React__default.Component {
|
|
|
188
184
|
disabled: row.disabled,
|
|
189
185
|
radio: _this.props.radio || null
|
|
190
186
|
};
|
|
191
|
-
}
|
|
192
|
-
// selection state of all rows.
|
|
193
|
-
|
|
187
|
+
}
|
|
194
188
|
|
|
189
|
+
// Otherwise, we're working on `TableSelectAll` which handles toggling the
|
|
190
|
+
// selection state of all rows.
|
|
195
191
|
const rowCount = _this.state.rowIds.length;
|
|
196
|
-
|
|
197
192
|
const selectedRowCount = _this.getSelectedRows().length;
|
|
198
|
-
|
|
199
193
|
const checked = rowCount > 0 && selectedRowCount === rowCount;
|
|
200
194
|
const indeterminate = rowCount > 0 && selectedRowCount > 0 && selectedRowCount !== rowCount;
|
|
201
195
|
const translationKey = checked || indeterminate ? translationKeys.unselectAll : translationKeys.selectAll;
|
|
202
|
-
return {
|
|
196
|
+
return {
|
|
197
|
+
...rest,
|
|
203
198
|
ariaLabel: t(translationKey),
|
|
204
199
|
checked,
|
|
205
200
|
id: `${_this.getTablePrefix()}__select-all`,
|
|
@@ -208,33 +203,30 @@ class DataTable extends React__default.Component {
|
|
|
208
203
|
onSelect: composeEventHandlers([_this.handleSelectAll, onClick])
|
|
209
204
|
};
|
|
210
205
|
});
|
|
211
|
-
|
|
212
206
|
_defineProperty(this, "getToolbarProps", function () {
|
|
213
207
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
214
208
|
const {
|
|
215
209
|
size
|
|
216
210
|
} = _this.props;
|
|
217
211
|
let isSmall = size === 'xs' || size === 'sm';
|
|
218
|
-
return {
|
|
212
|
+
return {
|
|
213
|
+
...props,
|
|
219
214
|
size: isSmall ? 'sm' : undefined
|
|
220
215
|
};
|
|
221
216
|
});
|
|
222
|
-
|
|
223
217
|
_defineProperty(this, "getBatchActionProps", function () {
|
|
224
218
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
225
219
|
const {
|
|
226
220
|
shouldShowBatchActions
|
|
227
221
|
} = _this.state;
|
|
228
|
-
|
|
229
222
|
const totalSelected = _this.getSelectedRows().length;
|
|
230
|
-
|
|
231
|
-
|
|
223
|
+
return {
|
|
224
|
+
...props,
|
|
232
225
|
shouldShowBatchActions: shouldShowBatchActions && totalSelected > 0,
|
|
233
226
|
totalSelected,
|
|
234
227
|
onCancel: _this.handleOnCancel
|
|
235
228
|
};
|
|
236
229
|
});
|
|
237
|
-
|
|
238
230
|
_defineProperty(this, "getTableProps", () => {
|
|
239
231
|
const {
|
|
240
232
|
useZebraStyles,
|
|
@@ -253,7 +245,6 @@ class DataTable extends React__default.Component {
|
|
|
253
245
|
overflowMenuOnHover
|
|
254
246
|
};
|
|
255
247
|
});
|
|
256
|
-
|
|
257
248
|
_defineProperty(this, "getTableContainerProps", () => {
|
|
258
249
|
const {
|
|
259
250
|
stickyHeader,
|
|
@@ -264,12 +255,10 @@ class DataTable extends React__default.Component {
|
|
|
264
255
|
useStaticWidth
|
|
265
256
|
};
|
|
266
257
|
});
|
|
267
|
-
|
|
268
258
|
_defineProperty(this, "getSelectedRows", () => this.state.rowIds.filter(id => {
|
|
269
259
|
const row = this.state.rowsById[id];
|
|
270
260
|
return row.isSelected && !row.disabled;
|
|
271
261
|
}));
|
|
272
|
-
|
|
273
262
|
_defineProperty(this, "getFilteredRowIds", () => {
|
|
274
263
|
const filteredRowIds = typeof this.state.filterInputValue === 'string' ? this.props.filterRows({
|
|
275
264
|
rowIds: this.state.rowIds,
|
|
@@ -278,31 +267,30 @@ class DataTable extends React__default.Component {
|
|
|
278
267
|
inputValue: this.state.filterInputValue,
|
|
279
268
|
getCellId
|
|
280
269
|
}) : this.state.rowIds;
|
|
281
|
-
|
|
282
270
|
if (filteredRowIds.length == 0) {
|
|
283
271
|
return [];
|
|
284
272
|
}
|
|
285
|
-
|
|
286
273
|
return filteredRowIds;
|
|
287
274
|
});
|
|
288
|
-
|
|
289
275
|
_defineProperty(this, "getTablePrefix", () => `data-table-${this.instanceId}`);
|
|
290
|
-
|
|
291
276
|
_defineProperty(this, "setAllSelectedState", (initialState, isSelected, filteredRowIds) => {
|
|
292
277
|
const {
|
|
293
278
|
rowIds
|
|
294
279
|
} = initialState;
|
|
280
|
+
const isFiltered = rowIds.length != filteredRowIds.length;
|
|
295
281
|
return {
|
|
296
|
-
rowsById: rowIds.reduce((acc, id) =>
|
|
297
|
-
|
|
298
|
-
...
|
|
299
|
-
|
|
300
|
-
|
|
282
|
+
rowsById: rowIds.reduce((acc, id) => {
|
|
283
|
+
const row = {
|
|
284
|
+
...initialState.rowsById[id]
|
|
285
|
+
};
|
|
286
|
+
if (!row.disabled && (!isFiltered || filteredRowIds.includes(id))) {
|
|
287
|
+
row.isSelected = isSelected;
|
|
301
288
|
}
|
|
302
|
-
|
|
289
|
+
acc[id] = row; // Local mutation for performance with large tables
|
|
290
|
+
return acc;
|
|
291
|
+
}, {})
|
|
303
292
|
};
|
|
304
293
|
});
|
|
305
|
-
|
|
306
294
|
_defineProperty(this, "handleOnCancel", () => {
|
|
307
295
|
this.setState(state => {
|
|
308
296
|
return {
|
|
@@ -311,7 +299,6 @@ class DataTable extends React__default.Component {
|
|
|
311
299
|
};
|
|
312
300
|
});
|
|
313
301
|
});
|
|
314
|
-
|
|
315
302
|
_defineProperty(this, "handleSelectAll", () => {
|
|
316
303
|
this.setState(state => {
|
|
317
304
|
const filteredRowIds = this.getFilteredRowIds();
|
|
@@ -325,11 +312,9 @@ class DataTable extends React__default.Component {
|
|
|
325
312
|
};
|
|
326
313
|
});
|
|
327
314
|
});
|
|
328
|
-
|
|
329
315
|
_defineProperty(this, "handleOnSelectRow", rowId => () => {
|
|
330
316
|
this.setState(state => {
|
|
331
317
|
const row = state.rowsById[rowId];
|
|
332
|
-
|
|
333
318
|
if (this.props.radio) {
|
|
334
319
|
// deselect all radio buttons
|
|
335
320
|
const rowsById = Object.entries(state.rowsById).reduce((p, c) => {
|
|
@@ -340,16 +325,17 @@ class DataTable extends React__default.Component {
|
|
|
340
325
|
}, {});
|
|
341
326
|
return {
|
|
342
327
|
shouldShowBatchActions: false,
|
|
343
|
-
rowsById: {
|
|
344
|
-
|
|
328
|
+
rowsById: {
|
|
329
|
+
...rowsById,
|
|
330
|
+
[rowId]: {
|
|
331
|
+
...row,
|
|
345
332
|
isSelected: !row.isSelected
|
|
346
333
|
}
|
|
347
334
|
}
|
|
348
335
|
};
|
|
349
336
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
337
|
+
const selectedRows = state.rowIds.filter(id => state.rowsById[id].isSelected).length;
|
|
338
|
+
// Predict the length of the selected rows after this change occurs
|
|
353
339
|
const selectedRowsCount = !row.isSelected ? selectedRows + 1 : selectedRows - 1;
|
|
354
340
|
return {
|
|
355
341
|
// Basic assumption here is that we want to show the batch action bar if
|
|
@@ -357,15 +343,16 @@ class DataTable extends React__default.Component {
|
|
|
357
343
|
// have a non-zero number of selected rows that batch actions could
|
|
358
344
|
// still apply to
|
|
359
345
|
shouldShowBatchActions: !row.isSelected || selectedRowsCount > 0,
|
|
360
|
-
rowsById: {
|
|
361
|
-
|
|
346
|
+
rowsById: {
|
|
347
|
+
...state.rowsById,
|
|
348
|
+
[rowId]: {
|
|
349
|
+
...row,
|
|
362
350
|
isSelected: !row.isSelected
|
|
363
351
|
}
|
|
364
352
|
}
|
|
365
353
|
};
|
|
366
354
|
});
|
|
367
355
|
});
|
|
368
|
-
|
|
369
356
|
_defineProperty(this, "handleOnExpandRow", rowId => () => {
|
|
370
357
|
this.setState(state => {
|
|
371
358
|
const row = state.rowsById[rowId];
|
|
@@ -374,15 +361,16 @@ class DataTable extends React__default.Component {
|
|
|
374
361
|
} = state;
|
|
375
362
|
return {
|
|
376
363
|
isExpandedAll: row.isExpanded ? false : isExpandedAll,
|
|
377
|
-
rowsById: {
|
|
378
|
-
|
|
364
|
+
rowsById: {
|
|
365
|
+
...state.rowsById,
|
|
366
|
+
[rowId]: {
|
|
367
|
+
...row,
|
|
379
368
|
isExpanded: !row.isExpanded
|
|
380
369
|
}
|
|
381
370
|
}
|
|
382
371
|
};
|
|
383
372
|
});
|
|
384
373
|
});
|
|
385
|
-
|
|
386
374
|
_defineProperty(this, "handleOnExpandAll", () => {
|
|
387
375
|
this.setState(state => {
|
|
388
376
|
const {
|
|
@@ -391,69 +379,64 @@ class DataTable extends React__default.Component {
|
|
|
391
379
|
} = state;
|
|
392
380
|
return {
|
|
393
381
|
isExpandedAll: !isExpandedAll,
|
|
394
|
-
rowsById: rowIds.reduce((acc, id) => ({
|
|
395
|
-
|
|
382
|
+
rowsById: rowIds.reduce((acc, id) => ({
|
|
383
|
+
...acc,
|
|
384
|
+
[id]: {
|
|
385
|
+
...state.rowsById[id],
|
|
396
386
|
isExpanded: !isExpandedAll
|
|
397
387
|
}
|
|
398
388
|
}), {})
|
|
399
389
|
};
|
|
400
390
|
});
|
|
401
391
|
});
|
|
402
|
-
|
|
403
392
|
_defineProperty(this, "handleSortBy", headerKey => () => {
|
|
404
393
|
this.setState(state => getNextSortState(this.props, state, {
|
|
405
394
|
key: headerKey
|
|
406
395
|
}));
|
|
407
396
|
});
|
|
408
|
-
|
|
409
397
|
_defineProperty(this, "handleOnInputValueChange", (event, defaultValue) => {
|
|
410
398
|
if (event.target) {
|
|
411
399
|
this.setState({
|
|
412
400
|
filterInputValue: event.target.value
|
|
413
401
|
});
|
|
414
402
|
}
|
|
415
|
-
|
|
416
403
|
if (defaultValue) {
|
|
417
404
|
this.setState({
|
|
418
405
|
filterInputValue: defaultValue
|
|
419
406
|
});
|
|
420
407
|
}
|
|
421
408
|
});
|
|
422
|
-
|
|
423
|
-
|
|
409
|
+
this.state = {
|
|
410
|
+
...getDerivedStateFromProps(_props, {}),
|
|
424
411
|
isExpandedAll: false // Start with collapsed state, treat `undefined` as neutral state
|
|
425
|
-
|
|
426
412
|
};
|
|
427
|
-
this.instanceId = getInstanceId();
|
|
428
|
-
} // if state needs to be updated then wait for only update after state is finished
|
|
429
413
|
|
|
414
|
+
this.instanceId = getInstanceId();
|
|
415
|
+
}
|
|
430
416
|
|
|
417
|
+
// if state needs to be updated then wait for only update after state is finished
|
|
431
418
|
shouldComponentUpdate(nextProps) {
|
|
432
419
|
if (this.props !== nextProps) {
|
|
433
420
|
const nextRowIds = nextProps.rows.map(row => row.id);
|
|
434
421
|
const rowIds = this.props.rows.map(row => row.id);
|
|
435
|
-
|
|
436
422
|
if (!isEqual(nextRowIds, rowIds)) {
|
|
437
423
|
this.setState(state => getDerivedStateFromProps(this.props, state));
|
|
438
424
|
return false;
|
|
439
425
|
}
|
|
440
|
-
|
|
441
426
|
const nextHeaders = nextProps.headers.map(header => header.key);
|
|
442
427
|
const headers = this.props.headers.map(header => header.key);
|
|
443
|
-
|
|
444
428
|
if (!isEqual(nextHeaders, headers)) {
|
|
445
429
|
this.setState(state => getDerivedStateFromProps(this.props, state));
|
|
446
430
|
return false;
|
|
447
431
|
}
|
|
448
|
-
|
|
449
432
|
if (!isEqual(nextProps.rows, this.props.rows)) {
|
|
450
433
|
this.setState(state => getDerivedStateFromProps(this.props, state));
|
|
451
434
|
return false;
|
|
452
435
|
}
|
|
453
436
|
}
|
|
454
|
-
|
|
455
437
|
return true;
|
|
456
438
|
}
|
|
439
|
+
|
|
457
440
|
/**
|
|
458
441
|
* Get the props associated with the given header. Mostly used for adding in
|
|
459
442
|
* sorting behavior.
|
|
@@ -465,6 +448,123 @@ class DataTable extends React__default.Component {
|
|
|
465
448
|
* @returns {object}
|
|
466
449
|
*/
|
|
467
450
|
|
|
451
|
+
/**
|
|
452
|
+
* Get the props associated with the given expand header.
|
|
453
|
+
*
|
|
454
|
+
* @param {object} config
|
|
455
|
+
* @param {Function} config.onClick a custom click handler for the expand header
|
|
456
|
+
* @param {Function} config.onExpand a custom click handler called when header is expanded
|
|
457
|
+
* @returns {object}
|
|
458
|
+
*/
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Decorate consumer's `onClick` event handler with sort parameters
|
|
462
|
+
*
|
|
463
|
+
* @param {Function} onClick
|
|
464
|
+
* @param {object} sortParams
|
|
465
|
+
* @returns {Function}
|
|
466
|
+
*/
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Decorate consumer's `onClick` event handler with sort parameters
|
|
470
|
+
*
|
|
471
|
+
* @param {Function} onClick
|
|
472
|
+
* @param {object} expandParams
|
|
473
|
+
* @returns {Function}
|
|
474
|
+
*/
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Get the props associated with the given row. Mostly used for expansion.
|
|
478
|
+
*
|
|
479
|
+
* @param {object} config
|
|
480
|
+
* @param {object} config.row the row we want the props for
|
|
481
|
+
* @param {Function} config.onClick a custom click handler for the header
|
|
482
|
+
* @returns {object}
|
|
483
|
+
*/
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Gets the props associated with selection for a header or a row, where
|
|
487
|
+
* applicable. Most often used to indicate selection status of the table or
|
|
488
|
+
* for a specific row.
|
|
489
|
+
*
|
|
490
|
+
* @param {object} [row] an optional row that we want to access the props for
|
|
491
|
+
* @param {Function} row.onClick
|
|
492
|
+
* @param {object} row.row
|
|
493
|
+
* @returns {object}
|
|
494
|
+
*/
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Helper utility to get the Table Props.
|
|
498
|
+
*/
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Helper utility to get the TableContainer Props.
|
|
502
|
+
*/
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Helper utility to get all the currently selected rows
|
|
506
|
+
* @returns {Array<string>} the array of rowIds that are currently selected
|
|
507
|
+
*/
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Helper utility to get all of the available rows after applying the filter
|
|
511
|
+
* @returns {Array<string>} the array of rowIds that are currently included through the filter
|
|
512
|
+
* */
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Helper for getting the table prefix for elements that require an
|
|
516
|
+
* `id` attribute that is unique.
|
|
517
|
+
*
|
|
518
|
+
* @returns {string}
|
|
519
|
+
*/
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Helper for toggling all selected items in a state. Does not call
|
|
523
|
+
* setState, so use it when setting state.
|
|
524
|
+
* @param {object} initialState
|
|
525
|
+
* @returns {object} object to put into this.setState (use spread operator)
|
|
526
|
+
*/
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Handler for the `onCancel` event to hide the batch action bar and
|
|
530
|
+
* deselect all selected rows
|
|
531
|
+
*/
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Handler for toggling the selection state of all rows in the database
|
|
535
|
+
*/
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Handler for toggling the selection state of a given row.
|
|
539
|
+
*
|
|
540
|
+
* @param {string} rowId
|
|
541
|
+
* @returns {Function}
|
|
542
|
+
*/
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Handler for toggling the expansion state of a given row.
|
|
546
|
+
*
|
|
547
|
+
* @param {string} rowId
|
|
548
|
+
* @returns {Function}
|
|
549
|
+
*/
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Handler for changing the expansion state of all rows.
|
|
553
|
+
*/
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Handler for transitioning to the next sort state of the table
|
|
557
|
+
*
|
|
558
|
+
* @param {string} headerKey the field for the header that we are sorting by
|
|
559
|
+
* @returns {Function}
|
|
560
|
+
*/
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Event handler for transitioning input value state changes for the table
|
|
564
|
+
* filter component.
|
|
565
|
+
*
|
|
566
|
+
* @param {Event} event
|
|
567
|
+
*/
|
|
468
568
|
|
|
469
569
|
render() {
|
|
470
570
|
// eslint-disable-next-line react/prop-types
|
|
@@ -511,27 +611,21 @@ class DataTable extends React__default.Component {
|
|
|
511
611
|
expandAll: this.handleOnExpandAll,
|
|
512
612
|
radio: this.props.radio
|
|
513
613
|
};
|
|
514
|
-
|
|
515
614
|
if (render !== undefined) {
|
|
516
615
|
return render(renderProps);
|
|
517
616
|
}
|
|
518
|
-
|
|
519
617
|
if (children !== undefined) {
|
|
520
618
|
return children(renderProps);
|
|
521
619
|
}
|
|
522
|
-
|
|
523
620
|
return null;
|
|
524
621
|
}
|
|
525
|
-
|
|
526
622
|
}
|
|
527
|
-
|
|
528
623
|
_defineProperty(DataTable, "propTypes", {
|
|
529
624
|
/**
|
|
530
625
|
* Optional hook to manually control filtering of the rows from the
|
|
531
626
|
* TableToolbarSearch component
|
|
532
627
|
*/
|
|
533
628
|
filterRows: PropTypes.func,
|
|
534
|
-
|
|
535
629
|
/**
|
|
536
630
|
* The `headers` prop represents the order in which the headers should
|
|
537
631
|
* appear in the table. We expect an array of objects to be passed in, where
|
|
@@ -542,27 +636,22 @@ _defineProperty(DataTable, "propTypes", {
|
|
|
542
636
|
key: PropTypes.string.isRequired,
|
|
543
637
|
header: PropTypes.node.isRequired
|
|
544
638
|
})).isRequired,
|
|
545
|
-
|
|
546
639
|
/**
|
|
547
640
|
* Specify whether the table should be able to be sorted by its headers
|
|
548
641
|
*/
|
|
549
642
|
isSortable: PropTypes.bool,
|
|
550
|
-
|
|
551
643
|
/**
|
|
552
644
|
* Provide a string for the current locale
|
|
553
645
|
*/
|
|
554
646
|
locale: PropTypes.string,
|
|
555
|
-
|
|
556
647
|
/**
|
|
557
648
|
* Specify whether the overflow menu (if it exists) should be shown always, or only on hover
|
|
558
649
|
*/
|
|
559
650
|
overflowMenuOnHover: PropTypes.bool,
|
|
560
|
-
|
|
561
651
|
/**
|
|
562
652
|
* Specify whether the control should be a radio button or inline checkbox
|
|
563
653
|
*/
|
|
564
654
|
radio: PropTypes.bool,
|
|
565
|
-
|
|
566
655
|
/**
|
|
567
656
|
* The `rows` prop is where you provide us with a list of all the rows that
|
|
568
657
|
* you want to render in the table. The only hard requirement is that this
|
|
@@ -575,41 +664,34 @@ _defineProperty(DataTable, "propTypes", {
|
|
|
575
664
|
isSelected: PropTypes.bool,
|
|
576
665
|
isExpanded: PropTypes.bool
|
|
577
666
|
})).isRequired,
|
|
578
|
-
|
|
579
667
|
/**
|
|
580
668
|
* Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
|
|
581
669
|
*/
|
|
582
670
|
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
|
583
|
-
|
|
584
671
|
/**
|
|
585
672
|
* Optional hook to manually control sorting of the rows.
|
|
586
673
|
*/
|
|
587
674
|
sortRow: PropTypes.func,
|
|
588
|
-
|
|
589
675
|
/**
|
|
590
676
|
* Specify whether the header should be sticky.
|
|
591
677
|
* Still experimental: may not work with every combination of table props
|
|
592
678
|
*/
|
|
593
679
|
stickyHeader: PropTypes.bool,
|
|
594
|
-
|
|
595
680
|
/**
|
|
596
681
|
* Optional method that takes in a message id and returns an
|
|
597
682
|
* internationalized string. See `DataTable.translationKeys` for all
|
|
598
683
|
* available message ids.
|
|
599
684
|
*/
|
|
600
685
|
translateWithId: PropTypes.func,
|
|
601
|
-
|
|
602
686
|
/**
|
|
603
687
|
* `false` If true, will use a width of 'auto' instead of 100%
|
|
604
688
|
*/
|
|
605
689
|
useStaticWidth: PropTypes.bool,
|
|
606
|
-
|
|
607
690
|
/**
|
|
608
691
|
* `true` to add useZebraStyles striping.
|
|
609
692
|
*/
|
|
610
693
|
useZebraStyles: PropTypes.bool
|
|
611
694
|
});
|
|
612
|
-
|
|
613
695
|
_defineProperty(DataTable, "defaultProps", {
|
|
614
696
|
sortRow: defaultSortRow,
|
|
615
697
|
filterRows: defaultFilterRows,
|
|
@@ -618,9 +700,7 @@ _defineProperty(DataTable, "defaultProps", {
|
|
|
618
700
|
overflowMenuOnHover: true,
|
|
619
701
|
translateWithId
|
|
620
702
|
});
|
|
621
|
-
|
|
622
703
|
_defineProperty(DataTable, "translationKeys", Object.values(translationKeys));
|
|
623
|
-
|
|
624
704
|
DataTable.Table = Table;
|
|
625
705
|
DataTable.TableActionList = TableActionList;
|
|
626
706
|
DataTable.TableBatchAction = TableBatchAction;
|
|
@@ -55,32 +55,26 @@ Table.propTypes = {
|
|
|
55
55
|
*/
|
|
56
56
|
children: PropTypes.node,
|
|
57
57
|
className: PropTypes.string,
|
|
58
|
-
|
|
59
58
|
/**
|
|
60
59
|
* `false` If true, will apply sorting styles
|
|
61
60
|
*/
|
|
62
61
|
isSortable: PropTypes.bool,
|
|
63
|
-
|
|
64
62
|
/**
|
|
65
63
|
* Specify whether the overflow menu (if it exists) should be shown always, or only on hover
|
|
66
64
|
*/
|
|
67
65
|
overflowMenuOnHover: PropTypes.bool,
|
|
68
|
-
|
|
69
66
|
/**
|
|
70
67
|
* Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
|
|
71
68
|
*/
|
|
72
69
|
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
|
73
|
-
|
|
74
70
|
/**
|
|
75
71
|
* `false` If true, will keep the header sticky (only data rows will scroll)
|
|
76
72
|
*/
|
|
77
73
|
stickyHeader: PropTypes.bool,
|
|
78
|
-
|
|
79
74
|
/**
|
|
80
75
|
* `false` If true, will use a width of 'auto' instead of 100%
|
|
81
76
|
*/
|
|
82
77
|
useStaticWidth: PropTypes.bool,
|
|
83
|
-
|
|
84
78
|
/**
|
|
85
79
|
* `true` to add useZebraStyles striping.
|
|
86
80
|
*/
|
|
@@ -11,13 +11,11 @@ import { AddFilled } from '@carbon/icons-react';
|
|
|
11
11
|
import Button from '../Button/Button.js';
|
|
12
12
|
|
|
13
13
|
const TableBatchAction = props => /*#__PURE__*/React__default.createElement(Button, props);
|
|
14
|
-
|
|
15
14
|
TableBatchAction.propTypes = {
|
|
16
15
|
/**
|
|
17
16
|
* Specify if the button is an icon-only button
|
|
18
17
|
*/
|
|
19
18
|
hasIconOnly: PropTypes.bool,
|
|
20
|
-
|
|
21
19
|
/**
|
|
22
20
|
* If specifying the `renderIcon` prop, provide a description for that icon that can
|
|
23
21
|
* be read by screen readers
|
|
@@ -26,10 +24,8 @@ TableBatchAction.propTypes = {
|
|
|
26
24
|
if (props.renderIcon && !props.children && !props.iconDescription) {
|
|
27
25
|
return new Error('renderIcon property specified without also providing an iconDescription property.');
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
return undefined;
|
|
31
28
|
},
|
|
32
|
-
|
|
33
29
|
/**
|
|
34
30
|
* Optional function to render your own icon in the underlying button
|
|
35
31
|
*/
|