@carbon/react 1.83.0 → 1.84.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 +909 -874
- package/README.md +1 -1
- package/es/components/AILabel/index.js +27 -30
- package/es/components/AISkeleton/AISkeletonIcon.js +4 -5
- package/es/components/AISkeleton/AISkeletonPlaceholder.js +4 -5
- package/es/components/AISkeleton/AISkeletonText.js +4 -5
- package/es/components/Accordion/Accordion.Skeleton.js +9 -10
- package/es/components/Accordion/Accordion.js +10 -11
- package/es/components/Accordion/AccordionItem.js +13 -14
- package/es/components/Accordion/AccordionProvider.js +4 -5
- package/es/components/AspectRatio/AspectRatio.js +7 -8
- package/es/components/BadgeIndicator/index.js +5 -6
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +4 -5
- package/es/components/Button/Button.Skeleton.js +7 -8
- package/es/components/Button/ButtonBase.js +23 -24
- package/es/components/ChatButton/ChatButton.Skeleton.js +5 -6
- package/es/components/ChatButton/ChatButton.js +11 -12
- package/es/components/Checkbox/Checkbox.Skeleton.js +4 -5
- package/es/components/Checkbox/Checkbox.js +19 -20
- package/es/components/CheckboxGroup/CheckboxGroup.js +16 -17
- package/es/components/ClassPrefix/index.js +4 -5
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +5 -6
- package/es/components/CodeSnippet/CodeSnippet.js +25 -26
- package/es/components/ComboBox/ComboBox.js +24 -30
- package/es/components/ComboBox/tools/filter.js +9 -12
- package/es/components/ComboButton/index.js +16 -18
- package/es/components/ComposedModal/ComposedModal.js +50 -36
- package/es/components/ComposedModal/ModalFooter.js +37 -42
- package/es/components/ComposedModal/ModalHeader.js +14 -15
- package/es/components/ContainedList/ContainedList.js +10 -11
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +9 -29
- package/es/components/ContentSwitcher/ContentSwitcher.js +96 -128
- package/es/components/ContentSwitcher/index.d.ts +3 -4
- package/es/components/ContextMenu/useContextMenu.js +1 -2
- package/es/components/Copy/Copy.js +11 -12
- package/es/components/CopyButton/CopyButton.js +10 -11
- package/es/components/DataTable/DataTable.js +45 -53
- package/es/components/DataTable/Table.js +15 -18
- package/es/components/DataTable/TableBatchAction.js +8 -11
- package/es/components/DataTable/TableBatchActions.js +18 -20
- package/es/components/DataTable/TableBody.js +8 -11
- package/es/components/DataTable/TableContainer.js +9 -10
- package/es/components/DataTable/TableDecoratorRow.js +4 -5
- package/es/components/DataTable/TableExpandHeader.js +14 -15
- package/es/components/DataTable/TableExpandRow.js +13 -14
- package/es/components/DataTable/TableExpandedRow.js +6 -7
- package/es/components/DataTable/TableHeader.js +15 -16
- package/es/components/DataTable/TableSelectAll.js +11 -12
- package/es/components/DataTable/TableSelectRow.js +12 -13
- package/es/components/DataTable/TableSlugRow.js +4 -5
- package/es/components/DataTable/TableToolbar.js +7 -8
- package/es/components/DataTable/TableToolbarMenu.js +8 -9
- package/es/components/DataTable/TableToolbarSearch.js +22 -24
- 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 +11 -12
- package/es/components/DatePicker/DatePicker.Skeleton.js +7 -8
- package/es/components/DatePicker/DatePicker.js +88 -65
- package/es/components/DatePickerInput/DatePickerInput.js +5 -6
- package/es/components/Dialog/index.d.ts +193 -8
- package/es/components/Dialog/index.js +454 -35
- package/es/components/Dropdown/Dropdown.Skeleton.js +6 -7
- package/es/components/Dropdown/Dropdown.js +40 -43
- package/es/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/es/components/ExpandableSearch/ExpandableSearch.js +9 -10
- package/es/components/FeatureFlags/index.js +11 -12
- package/es/components/FileUploader/FileUploader.Skeleton.js +4 -5
- package/es/components/FileUploader/FileUploader.js +22 -24
- package/es/components/FileUploader/FileUploaderButton.js +16 -17
- package/es/components/FileUploader/FileUploaderDropContainer.js +15 -16
- package/es/components/FileUploader/FileUploaderItem.js +13 -14
- package/es/components/FileUploader/Filename.js +9 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +4 -5
- package/es/components/FluidComboBox/FluidComboBox.js +5 -6
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +5 -6
- package/es/components/FluidDatePicker/FluidDatePicker.js +10 -11
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +4 -5
- package/es/components/FluidDropdown/FluidDropdown.js +5 -6
- package/es/components/FluidForm/FluidForm.js +5 -6
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +4 -5
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +6 -7
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +4 -5
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/es/components/FluidNumberInput/FluidNumberInput.js +38 -5
- package/es/components/FluidSearch/FluidSearch.Skeleton.js +4 -5
- package/es/components/FluidSearch/FluidSearch.js +4 -5
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +4 -5
- package/es/components/FluidSelect/FluidSelect.js +5 -6
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +4 -5
- package/es/components/FluidTextArea/FluidTextArea.js +4 -5
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +4 -5
- package/es/components/FluidTextInput/FluidTextInput.js +5 -6
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +5 -6
- package/es/components/FluidTimePicker/FluidTimePicker.js +11 -12
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +5 -6
- package/es/components/Form/Form.js +5 -6
- package/es/components/FormGroup/FormGroup.js +11 -12
- package/es/components/FormItem/FormItem.js +5 -6
- package/es/components/FormLabel/FormLabel.js +6 -7
- package/es/components/Grid/CSSGrid.js +17 -19
- package/es/components/Grid/Column.js +28 -27
- package/es/components/Grid/ColumnHang.js +6 -7
- package/es/components/Grid/FlexGrid.js +9 -10
- package/es/components/Grid/GridContext.js +5 -6
- package/es/components/Grid/Row.js +8 -9
- package/es/components/Heading/index.js +5 -6
- package/es/components/Icon/Icon.Skeleton.js +4 -5
- package/es/components/IconButton/index.js +20 -21
- package/es/components/IconIndicator/index.js +7 -8
- package/es/components/IdPrefix/index.js +4 -5
- package/es/components/InlineLoading/InlineLoading.js +9 -10
- package/es/components/Layer/index.js +8 -9
- package/es/components/Layout/index.js +21 -26
- package/es/components/LayoutDirection/LayoutDirection.js +6 -7
- package/es/components/Link/Link.d.ts +1 -1
- package/es/components/Link/Link.js +14 -15
- package/es/components/ListBox/ListBoxField.js +6 -7
- package/es/components/ListBox/ListBoxMenu.js +5 -6
- package/es/components/ListBox/ListBoxMenuIcon.js +4 -5
- package/es/components/ListBox/ListBoxMenuItem.js +8 -10
- package/es/components/ListBox/ListBoxSelection.js +8 -9
- package/es/components/ListBox/next/ListBoxSelection.js +9 -10
- package/es/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/es/components/ListItem/ListItem.js +5 -6
- package/es/components/Loading/Loading.js +8 -9
- package/es/components/Menu/Menu.js +23 -24
- package/es/components/Menu/MenuItem.js +39 -44
- package/es/components/MenuButton/index.js +16 -18
- package/es/components/Modal/Modal.js +74 -65
- package/es/components/ModalWrapper/ModalWrapper.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +67 -48
- package/es/components/MultiSelect/MultiSelect.js +43 -45
- package/es/components/MultiSelect/tools/sorting.js +11 -15
- package/es/components/Notification/Notification.js +96 -105
- package/es/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/es/components/NumberInput/NumberFormatPropTypes.js +40 -0
- package/es/components/NumberInput/NumberInput.Skeleton.js +6 -7
- package/es/components/NumberInput/NumberInput.d.ts +39 -3
- package/es/components/NumberInput/NumberInput.js +174 -44
- package/es/components/OrderedList/OrderedList.js +7 -8
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +39 -46
- package/es/components/OverflowMenu/next/index.js +12 -13
- package/es/components/PageHeader/PageHeader.d.ts +39 -14
- package/es/components/PageHeader/PageHeader.js +187 -81
- package/es/components/PageHeader/index.d.ts +2 -2
- package/es/components/PageHeader/index.js +1 -1
- package/es/components/Pagination/Pagination.Skeleton.js +4 -5
- package/es/components/Pagination/Pagination.js +24 -25
- package/es/components/Pagination/experimental/PageSelector.js +8 -9
- package/es/components/Pagination/experimental/Pagination.js +20 -21
- package/es/components/PaginationNav/PaginationNav.js +33 -38
- package/es/components/Popover/index.js +26 -28
- package/es/components/ProgressBar/ProgressBar.js +11 -12
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
- package/es/components/ProgressIndicator/ProgressIndicator.js +29 -32
- package/es/components/RadioTile/RadioTile.js +17 -18
- package/es/components/Search/Search.Skeleton.js +5 -6
- package/es/components/Search/Search.js +26 -29
- package/es/components/Select/Select.Skeleton.js +5 -6
- package/es/components/Select/Select.js +24 -25
- package/es/components/SelectItem/SelectItem.js +8 -9
- package/es/components/SelectItemGroup/SelectItemGroup.js +7 -8
- package/es/components/ShapeIndicator/index.js +7 -8
- package/es/components/SkeletonIcon/SkeletonIcon.js +4 -5
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -5
- package/es/components/SkeletonText/SkeletonText.js +8 -9
- package/es/components/Slider/Slider.Skeleton.js +8 -9
- package/es/components/Slider/Slider.js +75 -83
- package/es/components/Slider/SliderHandles.js +6 -6
- package/es/components/StructuredList/StructuredList.Skeleton.js +5 -6
- package/es/components/Tabs/Tabs.Skeleton.js +5 -6
- package/es/components/Tabs/Tabs.js +83 -98
- package/es/components/Tabs/usePressable.js +7 -8
- package/es/components/Tag/DismissibleTag.js +16 -17
- package/es/components/Tag/OperationalTag.js +10 -11
- package/es/components/Tag/SelectableTag.js +13 -14
- package/es/components/Tag/Tag.Skeleton.js +5 -6
- package/es/components/Tag/Tag.js +19 -20
- package/es/components/Text/Text.js +6 -7
- package/es/components/Text/TextDirection.js +5 -6
- package/es/components/TextArea/TextArea.js +7 -7
- package/es/components/TextInput/ControlledPasswordInput.js +24 -25
- package/es/components/TextInput/PasswordInput.js +26 -27
- package/es/components/TextInput/TextInput.Skeleton.js +5 -6
- package/es/components/TextInput/TextInput.js +27 -28
- package/es/components/TextInput/util.js +14 -17
- package/es/components/Theme/index.js +10 -12
- package/es/components/Tile/Tile.js +68 -74
- package/es/components/TileGroup/TileGroup.d.ts +4 -4
- package/es/components/TileGroup/TileGroup.js +45 -53
- package/es/components/TileGroup/index.d.ts +3 -3
- package/es/components/Toggle/Toggle.Skeleton.js +4 -5
- package/es/components/Toggle/Toggle.js +17 -18
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +6 -7
- package/es/components/Toggletip/index.js +33 -39
- package/es/components/Tooltip/DefinitionTooltip.js +13 -14
- package/es/components/Tooltip/Tooltip.js +15 -16
- package/es/components/TreeView/TreeNode.js +20 -21
- package/es/components/TreeView/TreeView.js +14 -16
- package/es/components/UIShell/Content.js +6 -7
- package/es/components/UIShell/Header.js +5 -6
- package/es/components/UIShell/HeaderContainer.js +5 -6
- package/es/components/UIShell/HeaderGlobalAction.js +12 -13
- package/es/components/UIShell/HeaderMenu.d.ts +10 -112
- package/es/components/UIShell/HeaderMenu.js +154 -201
- package/es/components/UIShell/HeaderMenuButton.js +10 -11
- package/es/components/UIShell/HeaderMenuItem.js +12 -12
- package/es/components/UIShell/HeaderName.js +6 -7
- package/es/components/UIShell/HeaderNavigation.js +7 -8
- package/es/components/UIShell/HeaderPanel.js +9 -10
- package/es/components/UIShell/HeaderSideNavItems.js +5 -6
- package/es/components/UIShell/Link.js +8 -9
- package/es/components/UIShell/SideNav.js +23 -25
- package/es/components/UIShell/SideNavDetails.js +6 -7
- package/es/components/UIShell/SideNavDivider.js +3 -4
- package/es/components/UIShell/SideNavFooter.js +6 -7
- package/es/components/UIShell/SideNavHeader.js +5 -6
- package/es/components/UIShell/SideNavIcon.js +5 -6
- package/es/components/UIShell/SideNavItem.js +5 -6
- package/es/components/UIShell/SideNavItems.js +5 -6
- package/es/components/UIShell/SideNavLink.js +10 -11
- package/es/components/UIShell/SideNavLinkText.js +5 -6
- package/es/components/UIShell/SideNavMenu.js +11 -12
- package/es/components/UIShell/SkipToContent.js +7 -8
- package/es/components/UIShell/Switcher.js +4 -5
- package/es/components/UIShell/SwitcherDivider.js +4 -5
- package/es/components/UnorderedList/UnorderedList.js +6 -7
- package/es/index.js +3 -3
- package/es/internal/FloatingMenu.js +26 -28
- package/es/internal/Selection.js +15 -17
- 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 +2 -4
- 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 +9 -10
- package/es/internal/useOverflowItems.d.ts +29 -0
- package/es/internal/useOverflowItems.js +122 -0
- package/es/internal/useResizeObserver.js +4 -5
- package/es/internal/useSavedCallback.js +1 -3
- package/es/internal/wrapFocus.js +20 -29
- 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.js +9 -11
- 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 +25 -26
- 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 +50 -36
- 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 +9 -29
- package/lib/components/ContentSwitcher/ContentSwitcher.js +94 -126
- 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.js +45 -53
- package/lib/components/DataTable/Table.js +15 -18
- package/lib/components/DataTable/TableBatchAction.js +8 -11
- package/lib/components/DataTable/TableBatchActions.js +18 -20
- package/lib/components/DataTable/TableBody.js +8 -11
- package/lib/components/DataTable/TableContainer.js +9 -10
- package/lib/components/DataTable/TableDecoratorRow.js +4 -5
- package/lib/components/DataTable/TableExpandHeader.js +14 -15
- package/lib/components/DataTable/TableExpandRow.js +13 -14
- package/lib/components/DataTable/TableExpandedRow.js +6 -7
- package/lib/components/DataTable/TableHeader.js +15 -16
- 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/TableToolbarMenu.js +8 -9
- package/lib/components/DataTable/TableToolbarSearch.js +22 -24
- 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.js +5 -6
- package/lib/components/Dialog/index.d.ts +193 -8
- package/lib/components/Dialog/index.js +457 -33
- package/lib/components/Dropdown/Dropdown.Skeleton.js +6 -7
- 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.js +4 -5
- package/lib/components/FileUploader/FileUploader.js +22 -24
- package/lib/components/FileUploader/FileUploaderButton.js +16 -17
- package/lib/components/FileUploader/FileUploaderDropContainer.js +15 -16
- package/lib/components/FileUploader/FileUploaderItem.js +13 -14
- 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.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.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.js +5 -6
- 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 +20 -21
- 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.js +8 -9
- 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 +14 -15
- package/lib/components/ListBox/ListBoxField.js +6 -7
- package/lib/components/ListBox/ListBoxMenu.js +5 -6
- package/lib/components/ListBox/ListBoxMenuIcon.js +4 -5
- 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.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.js +74 -65
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +66 -47
- 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 +39 -46
- package/lib/components/OverflowMenu/next/index.js +12 -13
- package/lib/components/PageHeader/PageHeader.d.ts +39 -14
- package/lib/components/PageHeader/PageHeader.js +185 -81
- package/lib/components/PageHeader/index.d.ts +2 -2
- package/lib/components/PageHeader/index.js +0 -2
- 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 -29
- 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.js +4 -5
- 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 +75 -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 +7 -7
- 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 +4 -4
- package/lib/components/TileGroup/TileGroup.js +44 -52
- package/lib/components/TileGroup/index.d.ts +3 -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.js +15 -16
- package/lib/components/TreeView/TreeNode.js +20 -21
- package/lib/components/TreeView/TreeView.js +14 -16
- 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/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 +12 -12
- 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 +36 -36
- package/lib/internal/FloatingMenu.js +26 -28
- package/lib/internal/Selection.js +15 -17
- 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/useOverflowItems.d.ts +29 -0
- package/lib/internal/useOverflowItems.js +126 -0
- package/lib/internal/useResizeObserver.js +4 -5
- package/lib/internal/useSavedCallback.js +1 -3
- package/lib/internal/wrapFocus.js +20 -29
- 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.js +9 -11
- package/package.json +21 -19
- package/telemetry.yml +25 -1
- package/es/components/ContentSwitcher/index.js +0 -13
- package/es/feature-flags.d.ts +0 -7
- package/es/internal/useAnnouncer.js +0 -21
- package/lib/components/ContentSwitcher/index.js +0 -18
- package/lib/feature-flags.d.ts +0 -7
- package/lib/internal/useAnnouncer.js +0 -25
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React from 'react';
|
|
10
|
+
import React, { useContext, useState, useRef, Children, useEffect, cloneElement, isValidElement } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import deprecate from '../../prop-types/deprecate.js';
|
|
13
13
|
import { LayoutConstraint } from '../Layout/index.js';
|
|
@@ -18,131 +18,100 @@ import { getNextIndex } from '../../internal/keyboard/navigation.js';
|
|
|
18
18
|
import { PrefixContext } from '../../internal/usePrefix.js';
|
|
19
19
|
import { noopFn } from '../../internal/noopFn.js';
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
21
|
+
const ContentSwitcher = ({
|
|
22
|
+
children,
|
|
23
|
+
className,
|
|
24
|
+
light,
|
|
25
|
+
lowContrast,
|
|
26
|
+
selectedIndex: selectedIndexProp = 0,
|
|
27
|
+
selectionMode = 'automatic',
|
|
28
|
+
size,
|
|
29
|
+
onChange = noopFn,
|
|
30
|
+
...other
|
|
31
|
+
}) => {
|
|
32
|
+
const prefix = useContext(PrefixContext);
|
|
33
|
+
const [selectedIndex, setSelectedIndex] = useState(selectedIndexProp);
|
|
34
|
+
const prevSelectedIndexRef = useRef(selectedIndexProp);
|
|
35
|
+
const switchRefs = useRef([]);
|
|
36
|
+
const childrenArray = Children.toArray(children);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (prevSelectedIndexRef.current !== selectedIndexProp) {
|
|
39
|
+
setSelectedIndex(selectedIndexProp);
|
|
40
|
+
prevSelectedIndexRef.current = selectedIndexProp;
|
|
41
|
+
}
|
|
42
|
+
}, [selectedIndexProp]);
|
|
43
|
+
const handleItemRef = index => ref => {
|
|
44
|
+
if (ref) {
|
|
45
|
+
switchRefs.current[index] = ref;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const focusSwitch = index => {
|
|
49
|
+
const ref = switchRefs.current[index];
|
|
50
|
+
if (ref) {
|
|
51
|
+
ref.focus();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const isKeyboardEvent = event => event && typeof event === 'object' && 'key' in event;
|
|
55
|
+
const handleChildChange = event => {
|
|
56
|
+
if (typeof event.index === 'undefined') return;
|
|
57
|
+
const {
|
|
58
|
+
index
|
|
59
|
+
} = event;
|
|
60
|
+
if (isKeyboardEvent(event) && matches(event, [ArrowRight, ArrowLeft])) {
|
|
61
|
+
const nextIndex = getNextIndex(event.key, index, childrenArray.length);
|
|
62
|
+
if (typeof nextIndex !== 'number') return;
|
|
63
|
+
focusSwitch(nextIndex);
|
|
64
|
+
if (selectionMode !== 'manual') {
|
|
65
|
+
const child = childrenArray[nextIndex];
|
|
66
|
+
setSelectedIndex(nextIndex);
|
|
67
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
|
68
|
+
onChange({
|
|
69
|
+
...event,
|
|
70
|
+
index: nextIndex,
|
|
71
|
+
name: child.props.name,
|
|
72
|
+
text: child.props.text
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
} else if (selectedIndex !== index) {
|
|
76
|
-
this.setState({
|
|
77
|
-
selectedIndex: index
|
|
78
|
-
}, () => {
|
|
79
|
-
const switchRef = this._switchRefs[index];
|
|
80
|
-
switchRef && switchRef.focus();
|
|
81
|
-
this.props.onChange(data);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
static getDerivedStateFromProps(_ref, state) {
|
|
87
|
-
let {
|
|
88
|
-
selectedIndex = 0
|
|
89
|
-
} = _ref;
|
|
90
|
-
const {
|
|
91
|
-
prevSelectedIndex
|
|
92
|
-
} = state;
|
|
93
|
-
return prevSelectedIndex === selectedIndex ? null : {
|
|
94
|
-
selectedIndex,
|
|
95
|
-
prevSelectedIndex: selectedIndex
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
render() {
|
|
99
|
-
const prefix = this.context;
|
|
100
|
-
const {
|
|
101
|
-
children,
|
|
102
|
-
className,
|
|
103
|
-
light,
|
|
104
|
-
lowContrast,
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
106
|
-
selectedIndex = 0,
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
108
|
-
selectionMode = 'automatic',
|
|
109
|
-
size,
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
111
|
-
onChange = noopFn,
|
|
112
|
-
...other
|
|
113
|
-
} = this.props;
|
|
114
|
-
const isIconOnly = React.Children?.map(children, child => {
|
|
115
|
-
return child.type.displayName === 'IconSwitch';
|
|
116
|
-
})?.every(val => val === true);
|
|
117
|
-
const classes = cx(`${prefix}--content-switcher`, className, {
|
|
118
|
-
[`${prefix}--content-switcher--light`]: light,
|
|
119
|
-
[`${prefix}--content-switcher--${size}`]: size,
|
|
120
|
-
// TODO: V12 - Remove this class
|
|
121
|
-
[`${prefix}--layout--size-${size}`]: size,
|
|
122
|
-
[`${prefix}--content-switcher--icon-only`]: isIconOnly,
|
|
123
|
-
[`${prefix}--content-switcher--low-contrast`]: lowContrast
|
|
124
|
-
});
|
|
125
|
-
return /*#__PURE__*/React.createElement(LayoutConstraint, _extends({
|
|
126
|
-
size: {
|
|
127
|
-
default: 'md',
|
|
128
|
-
min: 'sm',
|
|
129
|
-
max: 'lg'
|
|
130
75
|
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
onChange
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
76
|
+
} else if (selectedIndex !== index) {
|
|
77
|
+
setSelectedIndex(index);
|
|
78
|
+
focusSwitch(index);
|
|
79
|
+
onChange(event);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const isIconOnly = childrenArray.every(
|
|
83
|
+
// TODO: Update this code when
|
|
84
|
+
// https://github.com/carbon-design-system/carbon/pull/18971 is merged.
|
|
85
|
+
child => child.type.displayName === 'IconSwitch');
|
|
86
|
+
const classes = cx(`${prefix}--content-switcher`, className, {
|
|
87
|
+
[`${prefix}--content-switcher--light`]: light,
|
|
88
|
+
[`${prefix}--content-switcher--${size}`]: size,
|
|
89
|
+
// TODO: V12 - Remove this class
|
|
90
|
+
[`${prefix}--layout--size-${size}`]: size,
|
|
91
|
+
[`${prefix}--content-switcher--icon-only`]: isIconOnly,
|
|
92
|
+
[`${prefix}--content-switcher--low-contrast`]: lowContrast
|
|
93
|
+
});
|
|
94
|
+
return /*#__PURE__*/React.createElement(LayoutConstraint, _extends({
|
|
95
|
+
size: {
|
|
96
|
+
default: 'md',
|
|
97
|
+
min: 'sm',
|
|
98
|
+
max: 'lg'
|
|
99
|
+
}
|
|
100
|
+
}, other, {
|
|
101
|
+
className: classes,
|
|
102
|
+
role: "tablist",
|
|
103
|
+
onChange: undefined
|
|
104
|
+
}), children && Children.map(children, (child, index) => /*#__PURE__*/cloneElement(child, {
|
|
105
|
+
index,
|
|
106
|
+
onClick: composeEventHandlers([handleChildChange, child.props.onClick]),
|
|
107
|
+
onKeyDown: composeEventHandlers([handleChildChange, child.props.onKeyDown]),
|
|
108
|
+
selected: index === selectedIndex,
|
|
109
|
+
ref: handleItemRef(index),
|
|
110
|
+
size
|
|
111
|
+
})));
|
|
112
|
+
};
|
|
113
|
+
ContentSwitcher.displayName = 'ContentSwitcher';
|
|
114
|
+
ContentSwitcher.propTypes = {
|
|
146
115
|
/**
|
|
147
116
|
* Pass in Switch components to be rendered in the ContentSwitcher
|
|
148
117
|
*/
|
|
@@ -173,10 +142,9 @@ _defineProperty(ContentSwitcher, "propTypes", {
|
|
|
173
142
|
*/
|
|
174
143
|
selectionMode: PropTypes.oneOf(['automatic', 'manual']),
|
|
175
144
|
/**
|
|
176
|
-
* Specify the size of the Content Switcher. Currently supports either `sm`,
|
|
145
|
+
* Specify the size of the Content Switcher. Currently supports either `sm`, `md` (default) or `lg` as an option.
|
|
177
146
|
*/
|
|
178
147
|
size: PropTypes.oneOf(['sm', 'md', 'lg'])
|
|
179
|
-
}
|
|
180
|
-
_defineProperty(ContentSwitcher, "contextType", PrefixContext);
|
|
148
|
+
};
|
|
181
149
|
|
|
182
|
-
export { ContentSwitcher
|
|
150
|
+
export { ContentSwitcher };
|
|
@@ -1,10 +1,9 @@
|
|
|
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
|
-
import {
|
|
8
|
-
declare const ContentSwitcher: import("react").FunctionComponent<ContentSwitcherProps>;
|
|
7
|
+
import { ContentSwitcher } from './ContentSwitcher';
|
|
9
8
|
export default ContentSwitcher;
|
|
10
|
-
export
|
|
9
|
+
export * from './ContentSwitcher';
|
|
@@ -11,8 +11,7 @@ import { useState, useEffect } from 'react';
|
|
|
11
11
|
* @param {TriggerType} [trigger=document] The element or ref which should trigger the Menu on right-click
|
|
12
12
|
* @returns {ContextMenuProps} Props object to pass onto Menu component
|
|
13
13
|
*/
|
|
14
|
-
function useContextMenu() {
|
|
15
|
-
let trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
14
|
+
function useContextMenu(trigger = document) {
|
|
16
15
|
const [open, setOpen] = useState(false);
|
|
17
16
|
const [position, setPosition] = useState([0, 0]);
|
|
18
17
|
function openContextMenu(e) {
|
|
@@ -17,18 +17,17 @@ import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
|
17
17
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
18
18
|
import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
|
|
19
19
|
|
|
20
|
-
function Copy(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _ref;
|
|
20
|
+
function Copy({
|
|
21
|
+
align = 'bottom',
|
|
22
|
+
autoAlign = false,
|
|
23
|
+
children,
|
|
24
|
+
className,
|
|
25
|
+
feedback = 'Copied!',
|
|
26
|
+
feedbackTimeout = 2000,
|
|
27
|
+
onAnimationEnd,
|
|
28
|
+
onClick = noopFn,
|
|
29
|
+
...other
|
|
30
|
+
}) {
|
|
32
31
|
const [animation, setAnimation] = useState('');
|
|
33
32
|
const prefix = usePrefix();
|
|
34
33
|
const classNames = cx(className, `${prefix}--copy`, {
|
|
@@ -17,17 +17,16 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
17
17
|
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
18
18
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
19
19
|
|
|
20
|
-
function CopyButton(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
20
|
+
function CopyButton({
|
|
21
|
+
align = 'bottom',
|
|
22
|
+
autoAlign = false,
|
|
23
|
+
feedback = 'Copied!',
|
|
24
|
+
feedbackTimeout = 2000,
|
|
25
|
+
iconDescription = 'Copy to clipboard',
|
|
26
|
+
className,
|
|
27
|
+
onClick = noopFn,
|
|
28
|
+
...other
|
|
29
|
+
}) {
|
|
31
30
|
const prefix = usePrefix();
|
|
32
31
|
return /*#__PURE__*/React.createElement(LayoutConstraint, {
|
|
33
32
|
size: {
|
|
@@ -78,9 +78,7 @@ const translateWithId = id => defaultTranslations[id];
|
|
|
78
78
|
*/
|
|
79
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);
|
|
85
83
|
// TODO: Replace with a `type` when this component is converted to a
|
|
86
84
|
// functional component.
|
|
@@ -89,13 +87,12 @@ class DataTable extends Component {
|
|
|
89
87
|
* Get the props associated with the given header. Mostly used for adding in
|
|
90
88
|
* sorting behavior.
|
|
91
89
|
*/
|
|
92
|
-
_defineProperty(this, "getHeaderProps",
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} = _ref;
|
|
90
|
+
_defineProperty(this, "getHeaderProps", ({
|
|
91
|
+
header,
|
|
92
|
+
onClick,
|
|
93
|
+
isSortable = this.props.isSortable,
|
|
94
|
+
...rest
|
|
95
|
+
}) => {
|
|
99
96
|
const {
|
|
100
97
|
sortDirection,
|
|
101
98
|
sortHeaderKey
|
|
@@ -124,20 +121,19 @@ class DataTable extends Component {
|
|
|
124
121
|
/**
|
|
125
122
|
* Get the props associated with the given expand header.
|
|
126
123
|
*/
|
|
127
|
-
_defineProperty(this, "getExpandHeaderProps",
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
124
|
+
_defineProperty(this, "getExpandHeaderProps", ({
|
|
125
|
+
onClick,
|
|
126
|
+
onExpand,
|
|
127
|
+
...rest
|
|
128
|
+
} = {}) => {
|
|
133
129
|
const {
|
|
134
130
|
translateWithId: t = translateWithId
|
|
135
|
-
} =
|
|
131
|
+
} = this.props;
|
|
136
132
|
const {
|
|
137
133
|
isExpandedAll,
|
|
138
134
|
rowIds,
|
|
139
135
|
rowsById
|
|
140
|
-
} =
|
|
136
|
+
} = this.state;
|
|
141
137
|
const isExpanded = isExpandedAll || rowIds.every(id => rowsById[id].isExpanded);
|
|
142
138
|
const translationKey = isExpanded ? translationKeys.collapseAll : translationKeys.expandAll;
|
|
143
139
|
return {
|
|
@@ -148,7 +144,7 @@ class DataTable extends Component {
|
|
|
148
144
|
isExpanded,
|
|
149
145
|
// Compose the event handlers so we don't overwrite a consumer's `onClick`
|
|
150
146
|
// handler
|
|
151
|
-
onExpand: composeEventHandlers([
|
|
147
|
+
onExpand: composeEventHandlers([this.handleOnExpandAll, onExpand, onClick && this.handleOnExpandHeaderClick(onClick, {
|
|
152
148
|
isExpanded
|
|
153
149
|
})])
|
|
154
150
|
};
|
|
@@ -168,12 +164,11 @@ class DataTable extends Component {
|
|
|
168
164
|
/**
|
|
169
165
|
* Get the props associated with the given row. Mostly used for expansion.
|
|
170
166
|
*/
|
|
171
|
-
_defineProperty(this, "getRowProps",
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
} = _ref2;
|
|
167
|
+
_defineProperty(this, "getRowProps", ({
|
|
168
|
+
row,
|
|
169
|
+
onClick,
|
|
170
|
+
...rest
|
|
171
|
+
}) => {
|
|
177
172
|
const {
|
|
178
173
|
translateWithId: t = translateWithId
|
|
179
174
|
} = this.props;
|
|
@@ -194,11 +189,10 @@ class DataTable extends Component {
|
|
|
194
189
|
/**
|
|
195
190
|
* Get the props associated with an expanded row
|
|
196
191
|
*/
|
|
197
|
-
_defineProperty(this, "getExpandedRowProps",
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
} = _ref3;
|
|
192
|
+
_defineProperty(this, "getExpandedRowProps", ({
|
|
193
|
+
row,
|
|
194
|
+
...rest
|
|
195
|
+
}) => {
|
|
202
196
|
return {
|
|
203
197
|
...rest,
|
|
204
198
|
id: `expanded-row-${row.id}`
|
|
@@ -209,15 +203,14 @@ class DataTable extends Component {
|
|
|
209
203
|
* applicable. Most often used to indicate selection status of the table or
|
|
210
204
|
* for a specific row.
|
|
211
205
|
*/
|
|
212
|
-
_defineProperty(this, "getSelectionProps",
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
206
|
+
_defineProperty(this, "getSelectionProps", ({
|
|
207
|
+
onClick,
|
|
208
|
+
row,
|
|
209
|
+
...rest
|
|
210
|
+
} = {}) => {
|
|
218
211
|
const {
|
|
219
212
|
translateWithId: t = translateWithId
|
|
220
|
-
} =
|
|
213
|
+
} = this.props;
|
|
221
214
|
|
|
222
215
|
// If we're given a row, return the selection state values for that row
|
|
223
216
|
if (row) {
|
|
@@ -225,19 +218,19 @@ class DataTable extends Component {
|
|
|
225
218
|
return {
|
|
226
219
|
...rest,
|
|
227
220
|
checked: row.isSelected,
|
|
228
|
-
onSelect: composeEventHandlers([
|
|
229
|
-
id: `${
|
|
230
|
-
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}`,
|
|
231
224
|
'aria-label': t(translationKey),
|
|
232
225
|
disabled: row.disabled,
|
|
233
|
-
radio:
|
|
226
|
+
radio: this.props.radio
|
|
234
227
|
};
|
|
235
228
|
}
|
|
236
229
|
|
|
237
230
|
// Otherwise, we're working on `TableSelectAll` which handles toggling the
|
|
238
231
|
// selection state of all rows.
|
|
239
|
-
const rowCount =
|
|
240
|
-
const selectedRowCount =
|
|
232
|
+
const rowCount = this.state.rowIds.length;
|
|
233
|
+
const selectedRowCount = this.getSelectedRows().length;
|
|
241
234
|
const checked = rowCount > 0 && selectedRowCount === rowCount;
|
|
242
235
|
const indeterminate = rowCount > 0 && selectedRowCount > 0 && selectedRowCount !== rowCount;
|
|
243
236
|
const translationKey = checked || indeterminate ? translationKeys.unselectAll : translationKeys.selectAll;
|
|
@@ -245,10 +238,10 @@ class DataTable extends Component {
|
|
|
245
238
|
...rest,
|
|
246
239
|
'aria-label': t(translationKey),
|
|
247
240
|
checked,
|
|
248
|
-
id: `${
|
|
241
|
+
id: `${this.getTablePrefix()}__select-all`,
|
|
249
242
|
indeterminate,
|
|
250
|
-
name: `select-all-${
|
|
251
|
-
onSelect: composeEventHandlers([
|
|
243
|
+
name: `select-all-${this.instanceId}`,
|
|
244
|
+
onSelect: composeEventHandlers([this.handleSelectAll, onClick])
|
|
252
245
|
};
|
|
253
246
|
});
|
|
254
247
|
_defineProperty(this, "getToolbarProps", props => {
|
|
@@ -308,14 +301,13 @@ class DataTable extends Component {
|
|
|
308
301
|
/**
|
|
309
302
|
* Get the props associated with the given table cell.
|
|
310
303
|
*/
|
|
311
|
-
_defineProperty(this, "getCellProps",
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
} = _ref4;
|
|
304
|
+
_defineProperty(this, "getCellProps", ({
|
|
305
|
+
cell: {
|
|
306
|
+
hasAILabelHeader,
|
|
307
|
+
hasDecoratorHeader
|
|
308
|
+
},
|
|
309
|
+
...rest
|
|
310
|
+
}) => {
|
|
319
311
|
return {
|
|
320
312
|
...rest,
|
|
321
313
|
hasAILabelHeader,
|
|
@@ -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(() => {
|
|
@@ -12,17 +12,14 @@ 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
|
|
@@ -23,14 +23,13 @@ const translationKeys = {
|
|
|
23
23
|
'carbon.table.batch.item.selected': 'item selected',
|
|
24
24
|
'carbon.table.batch.selectAll': 'Select all'
|
|
25
25
|
};
|
|
26
|
-
const translateWithId =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
26
|
+
const translateWithId = (id, {
|
|
27
|
+
totalSelected,
|
|
28
|
+
totalCount
|
|
29
|
+
} = {
|
|
30
|
+
totalSelected: 0,
|
|
31
|
+
totalCount: 0
|
|
32
|
+
}) => {
|
|
34
33
|
if (id === 'carbon.table.batch.cancel') {
|
|
35
34
|
return translationKeys[id];
|
|
36
35
|
}
|
|
@@ -39,18 +38,17 @@ const translateWithId = function (id) {
|
|
|
39
38
|
}
|
|
40
39
|
return `${totalSelected} ${translationKeys[id]}`;
|
|
41
40
|
};
|
|
42
|
-
const TableBatchActions =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} = _ref;
|
|
41
|
+
const TableBatchActions = ({
|
|
42
|
+
className,
|
|
43
|
+
children,
|
|
44
|
+
shouldShowBatchActions,
|
|
45
|
+
totalSelected,
|
|
46
|
+
totalCount,
|
|
47
|
+
onCancel,
|
|
48
|
+
onSelectAll,
|
|
49
|
+
translateWithId: t = translateWithId,
|
|
50
|
+
...rest
|
|
51
|
+
}) => {
|
|
54
52
|
const [isScrolling, setIsScrolling] = React.useState(false);
|
|
55
53
|
const prefix = usePrefix();
|
|
56
54
|
const batchActionsClasses = cx({
|