@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
|
@@ -30,5 +30,5 @@ interface UseControllableStateConfig<T> {
|
|
|
30
30
|
* Note: This hook will warn if the component switches between controlled and
|
|
31
31
|
* uncontrolled states.
|
|
32
32
|
*/
|
|
33
|
-
export declare const useControllableState: <T>({ defaultValue, name, onChange, value, }: UseControllableStateConfig<T>) => [T, (stateOrUpdater: T | ((prev: T) => T)) => void];
|
|
33
|
+
export declare const useControllableState: <T>({ defaultValue, name, onChange, value, }: UseControllableStateConfig<T>) => [T, (stateOrUpdater: T | ((prev: T) => T)) => void, boolean];
|
|
34
34
|
export {};
|
|
@@ -20,13 +20,12 @@ var warning = require('./warning.js');
|
|
|
20
20
|
* Note: This hook will warn if the component switches between controlled and
|
|
21
21
|
* uncontrolled states.
|
|
22
22
|
*/
|
|
23
|
-
const useControllableState =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
23
|
+
const useControllableState = ({
|
|
24
|
+
defaultValue,
|
|
25
|
+
name = 'custom',
|
|
26
|
+
onChange,
|
|
27
|
+
value
|
|
28
|
+
}) => {
|
|
30
29
|
const [state, internalSetState] = React.useState(typeof value !== 'undefined' ? value : defaultValue);
|
|
31
30
|
const controlled = React.useRef(null);
|
|
32
31
|
if (controlled.current === null) {
|
|
@@ -55,9 +54,9 @@ const useControllableState = _ref => {
|
|
|
55
54
|
}
|
|
56
55
|
}, [name, value]);
|
|
57
56
|
if (controlled.current === true) {
|
|
58
|
-
return [value, setState];
|
|
57
|
+
return [value, setState, controlled.current];
|
|
59
58
|
}
|
|
60
|
-
return [state, setState];
|
|
59
|
+
return [state, setState, controlled.current];
|
|
61
60
|
};
|
|
62
61
|
|
|
63
62
|
exports.useControllableState = useControllableState;
|
|
@@ -27,8 +27,7 @@ function useDelayedState(initialState) {
|
|
|
27
27
|
const timeoutId = React.useRef(null);
|
|
28
28
|
// We use `useCallback` to match the signature of React's `useState` which will
|
|
29
29
|
// always return the same reference for the `setState` updater
|
|
30
|
-
const setStateWithDelay = React.useCallback(
|
|
31
|
-
let delayMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
30
|
+
const setStateWithDelay = React.useCallback((stateToSet, delayMs = 0) => {
|
|
32
31
|
window.clearTimeout(timeoutId.current ?? undefined);
|
|
33
32
|
timeoutId.current = null;
|
|
34
33
|
if (delayMs === 0) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* React hook that returns the current document language and updates on changes.
|
|
9
|
+
*
|
|
10
|
+
* @returns {string} The current document language code.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDocumentLang(): string;
|
package/lib/internal/useId.js
CHANGED
|
@@ -38,8 +38,7 @@ const defaultId = 'id';
|
|
|
38
38
|
* @param {string} [prefix]
|
|
39
39
|
* @returns {string}
|
|
40
40
|
*/
|
|
41
|
-
function useCompatibleId() {
|
|
42
|
-
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
|
|
41
|
+
function useCompatibleId(prefix = defaultId) {
|
|
43
42
|
const contextPrefix = useIdPrefix.useIdPrefix();
|
|
44
43
|
const [id, setId] = React.useState(() => {
|
|
45
44
|
if (serverHandoffCompleted) {
|
|
@@ -66,8 +65,7 @@ function useCompatibleId() {
|
|
|
66
65
|
* @param {string} [prefix]
|
|
67
66
|
* @returns {string}
|
|
68
67
|
*/
|
|
69
|
-
function useReactId() {
|
|
70
|
-
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
|
|
68
|
+
function useReactId(prefix = defaultId) {
|
|
71
69
|
const contextPrefix = useIdPrefix.useIdPrefix();
|
|
72
70
|
return `${contextPrefix ? `${contextPrefix}-` : ``}${prefix}-${_React.useId()}`;
|
|
73
71
|
}
|
|
@@ -17,8 +17,7 @@ var React = require('react');
|
|
|
17
17
|
* @param defaultState - The initial state to return before the media query is evaluated. Defaults to `false`.
|
|
18
18
|
* @returns Whether the media query matches.
|
|
19
19
|
*/
|
|
20
|
-
const useMatchMedia =
|
|
21
|
-
let defaultState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
20
|
+
const useMatchMedia = (mediaQuery, defaultState = false) => {
|
|
22
21
|
const [matches, setMatches] = React.useState(defaultState);
|
|
23
22
|
React.useEffect(() => {
|
|
24
23
|
const listener = event => {
|
|
@@ -13,4 +13,4 @@ import { type ForwardedRef, type Ref } from 'react';
|
|
|
13
13
|
* accepts an array of refs and returns a callback ref that, when attached to a
|
|
14
14
|
* node, assigns that node to every ref in the array.
|
|
15
15
|
*/
|
|
16
|
-
export declare const useMergedRefs: <T>(refs: ForwardedRef<T>[]) => Ref<T>;
|
|
16
|
+
export declare const useMergedRefs: <T>(refs: (ForwardedRef<T> | undefined)[]) => Ref<T>;
|
|
@@ -11,8 +11,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var React = require('react');
|
|
13
13
|
|
|
14
|
-
function useNoInteractiveChildren(ref) {
|
|
15
|
-
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'component should have no interactive child nodes';
|
|
14
|
+
function useNoInteractiveChildren(ref, message = 'component should have no interactive child nodes') {
|
|
16
15
|
if (process.env.NODE_ENV !== 'production') {
|
|
17
16
|
// TODO: https://github.com/carbon-design-system/carbon/issues/19005
|
|
18
17
|
/*
|
|
@@ -29,8 +28,7 @@ function useNoInteractiveChildren(ref) {
|
|
|
29
28
|
}, []);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
function useInteractiveChildrenNeedDescription(ref) {
|
|
33
|
-
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `interactive child node(s) should have an \`aria-describedby\` property`;
|
|
31
|
+
function useInteractiveChildrenNeedDescription(ref, message = `interactive child node(s) should have an \`aria-describedby\` property`) {
|
|
34
32
|
if (process.env.NODE_ENV !== 'production') {
|
|
35
33
|
// TODO: https://github.com/carbon-design-system/carbon/issues/19005
|
|
36
34
|
/*
|
|
@@ -28,16 +28,15 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
28
28
|
* helper messages, and conditionally provides the appropriate validation
|
|
29
29
|
* message and accompanying icon.
|
|
30
30
|
*/
|
|
31
|
-
const useNormalizedInputProps =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = _ref;
|
|
31
|
+
const useNormalizedInputProps = ({
|
|
32
|
+
id,
|
|
33
|
+
readOnly,
|
|
34
|
+
disabled,
|
|
35
|
+
invalid,
|
|
36
|
+
invalidText,
|
|
37
|
+
warn,
|
|
38
|
+
warnText
|
|
39
|
+
}) => {
|
|
41
40
|
const prefix = usePrefix.usePrefix();
|
|
42
41
|
const normalizedProps = {
|
|
43
42
|
disabled: !readOnly && disabled,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { ReactNode, RefObject } from 'react';
|
|
8
|
+
type Item = {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Manages overflow items in a container by automatically hiding items that don't fit.
|
|
13
|
+
* @param items - Array of items to manage for overflow, each must have an `id` property.
|
|
14
|
+
* @param containerRef - React ref to the container element that holds the items.
|
|
15
|
+
* @param offsetRef - Optional ref to an offset element (like a "more" button) whose width is reserved when calculating available space.
|
|
16
|
+
* @param maxItems - Optional maximum number of visible items. If undefined, only container space constrains visibility.
|
|
17
|
+
* @param onChange - Optional callback called when hidden items change. Receives array of currently hidden items.
|
|
18
|
+
* @returns Object with `visibleItems` (items to display), `hiddenItems` (items that don't fit), and `itemRefHandler` (function to attach refs to items for width measurement).
|
|
19
|
+
*/
|
|
20
|
+
declare const useOverflowItems: <T extends Item>(items: T[] | ReactNode, containerRef: RefObject<HTMLDivElement>, offsetRef?: RefObject<HTMLDivElement>, maxItems?: number, onChange?: (hiddenItems: T[]) => void) => {
|
|
21
|
+
visibleItems: T[];
|
|
22
|
+
hiddenItems: T[];
|
|
23
|
+
itemRefHandler: () => void;
|
|
24
|
+
} | {
|
|
25
|
+
visibleItems: T[];
|
|
26
|
+
itemRefHandler: (id: string, node: HTMLDivElement | null) => () => void;
|
|
27
|
+
hiddenItems: T[];
|
|
28
|
+
};
|
|
29
|
+
export default useOverflowItems;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var React = require('react');
|
|
13
|
+
var useResizeObserver = require('./useResizeObserver.js');
|
|
14
|
+
var usePreviousValue = require('./usePreviousValue.js');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Manages overflow items in a container by automatically hiding items that don't fit.
|
|
18
|
+
* @param items - Array of items to manage for overflow, each must have an `id` property.
|
|
19
|
+
* @param containerRef - React ref to the container element that holds the items.
|
|
20
|
+
* @param offsetRef - Optional ref to an offset element (like a "more" button) whose width is reserved when calculating available space.
|
|
21
|
+
* @param maxItems - Optional maximum number of visible items. If undefined, only container space constrains visibility.
|
|
22
|
+
* @param onChange - Optional callback called when hidden items change. Receives array of currently hidden items.
|
|
23
|
+
* @returns Object with `visibleItems` (items to display), `hiddenItems` (items that don't fit), and `itemRefHandler` (function to attach refs to items for width measurement).
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) => {
|
|
27
|
+
const itemsRef = React.useRef(null);
|
|
28
|
+
const [maxWidth, setMaxWidth] = React.useState(0);
|
|
29
|
+
if (!items || !Array.isArray(items)) {
|
|
30
|
+
return {
|
|
31
|
+
visibleItems: [],
|
|
32
|
+
hiddenItems: [],
|
|
33
|
+
itemRefHandler: () => {}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const handleResize = () => {
|
|
37
|
+
if (containerRef.current) {
|
|
38
|
+
const offset = offsetRef?.current?.offsetWidth || 0;
|
|
39
|
+
const newMax = containerRef.current.offsetWidth - offset;
|
|
40
|
+
setMaxWidth(newMax);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
useResizeObserver.useResizeObserver({
|
|
44
|
+
ref: containerRef,
|
|
45
|
+
onResize: handleResize
|
|
46
|
+
});
|
|
47
|
+
const getMap = () => {
|
|
48
|
+
if (!itemsRef.current) {
|
|
49
|
+
itemsRef.current = new Map();
|
|
50
|
+
}
|
|
51
|
+
return itemsRef.current;
|
|
52
|
+
};
|
|
53
|
+
const itemRefHandler = (id, node) => {
|
|
54
|
+
const map = getMap();
|
|
55
|
+
if (node) {
|
|
56
|
+
const style = getComputedStyle?.(node);
|
|
57
|
+
const totalWidth = node.offsetWidth + parseInt(style.marginLeft) + parseInt(style.marginRight);
|
|
58
|
+
map.set(id, totalWidth);
|
|
59
|
+
}
|
|
60
|
+
return () => {
|
|
61
|
+
map.delete(id);
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const getVisibleItems = () => {
|
|
65
|
+
if (!items || Array.isArray(items) === false) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
if (!containerRef) {
|
|
69
|
+
return items;
|
|
70
|
+
}
|
|
71
|
+
const map = getMap();
|
|
72
|
+
let maxReached = false;
|
|
73
|
+
let accumulatedWidth = 0;
|
|
74
|
+
const visibleItems = items.slice(0, maxItems).reduce((prev, cur) => {
|
|
75
|
+
if (maxReached) {
|
|
76
|
+
return prev;
|
|
77
|
+
}
|
|
78
|
+
const itemWidth = map.get(cur.id) || 0;
|
|
79
|
+
const willFit = accumulatedWidth + itemWidth <= maxWidth;
|
|
80
|
+
if (willFit) {
|
|
81
|
+
accumulatedWidth += itemWidth;
|
|
82
|
+
prev.push(cur);
|
|
83
|
+
} else {
|
|
84
|
+
maxReached = true;
|
|
85
|
+
}
|
|
86
|
+
return prev;
|
|
87
|
+
}, []);
|
|
88
|
+
return visibleItems;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Memoize visible items calculation to avoid recalculating on every render
|
|
92
|
+
const visibleItems = React.useMemo(() => {
|
|
93
|
+
if (!Array.isArray(items)) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
return getVisibleItems();
|
|
97
|
+
}, [items, maxWidth, maxItems]);
|
|
98
|
+
|
|
99
|
+
// Memoize hidden items calculation
|
|
100
|
+
const hiddenItems = React.useMemo(() => {
|
|
101
|
+
if (!Array.isArray(items)) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
return items.slice(visibleItems.length);
|
|
105
|
+
}, [items, visibleItems]);
|
|
106
|
+
|
|
107
|
+
// Use previous value to compare and only call onChange when needed
|
|
108
|
+
const previousHiddenItems = usePreviousValue.usePreviousValue(hiddenItems);
|
|
109
|
+
|
|
110
|
+
// Only call onChange if hidden items actually changed
|
|
111
|
+
React.useEffect(() => {
|
|
112
|
+
if (previousHiddenItems && onChange) {
|
|
113
|
+
const hasChanged = hiddenItems.length !== previousHiddenItems.length || hiddenItems.some((item, index) => item !== previousHiddenItems[index]);
|
|
114
|
+
if (hasChanged) {
|
|
115
|
+
onChange(hiddenItems);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, [hiddenItems, previousHiddenItems, onChange]);
|
|
119
|
+
return {
|
|
120
|
+
visibleItems,
|
|
121
|
+
itemRefHandler,
|
|
122
|
+
hiddenItems
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
exports["default"] = useOverflowItems;
|
|
@@ -11,11 +11,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var React = require('react');
|
|
13
13
|
|
|
14
|
-
const useResizeObserver =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
14
|
+
const useResizeObserver = ({
|
|
15
|
+
ref,
|
|
16
|
+
onResize
|
|
17
|
+
}) => {
|
|
19
18
|
const [width, setWidth] = React.useState(-1);
|
|
20
19
|
const [height, setHeight] = React.useState(-1);
|
|
21
20
|
const entriesToHandle = React.useRef(null);
|
|
@@ -24,9 +24,7 @@ const useSavedCallback = callback => {
|
|
|
24
24
|
React.useEffect(() => {
|
|
25
25
|
savedCallback.current = callback;
|
|
26
26
|
}, [callback]);
|
|
27
|
-
return React.useCallback(
|
|
28
|
-
return savedCallback.current ? savedCallback.current(...arguments) : undefined;
|
|
29
|
-
}, []);
|
|
27
|
+
return React.useCallback((...args) => savedCallback.current ? savedCallback.current(...args) : undefined, []);
|
|
30
28
|
};
|
|
31
29
|
|
|
32
30
|
exports.useSavedCallback = useSavedCallback;
|
|
@@ -34,8 +34,7 @@ const DOCUMENT_POSITION_BROAD_FOLLOWING = typeof Node !== 'undefined' ? Node.DOC
|
|
|
34
34
|
* @returns {boolean} Whether the node or one of its ancestors is in a floating
|
|
35
35
|
* menu.
|
|
36
36
|
*/
|
|
37
|
-
const elementOrParentIsFloatingMenu =
|
|
38
|
-
let selectorsFloatingMenus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
37
|
+
const elementOrParentIsFloatingMenu = (node, selectorsFloatingMenus = []) => {
|
|
39
38
|
if (node instanceof Element && typeof node.closest === 'function') {
|
|
40
39
|
const allSelectorsFloatingMenus = ['.cds--overflow-menu-options', '.cds--tooltip', '.flatpickr-calendar', ...selectorsFloatingMenus];
|
|
41
40
|
return allSelectorsFloatingMenus.some(selector => !!node.closest(selector));
|
|
@@ -47,36 +46,29 @@ const elementOrParentIsFloatingMenu = function (node) {
|
|
|
47
46
|
* Ensures the focus is kept within the given container by implementing
|
|
48
47
|
* "focus-wrap" behavior.
|
|
49
48
|
*/
|
|
50
|
-
const wrapFocus =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} = _ref;
|
|
49
|
+
const wrapFocus = ({
|
|
50
|
+
bodyNode,
|
|
51
|
+
startTrapNode,
|
|
52
|
+
endTrapNode,
|
|
53
|
+
currentActiveNode,
|
|
54
|
+
oldActiveNode,
|
|
55
|
+
selectorsFloatingMenus
|
|
56
|
+
}) => {
|
|
59
57
|
if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus)) {
|
|
60
58
|
const comparisonResult = oldActiveNode.compareDocumentPosition(currentActiveNode);
|
|
61
59
|
if (currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING) {
|
|
62
|
-
const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).reverse().find(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} = _ref2;
|
|
66
|
-
return Boolean(offsetParent);
|
|
67
|
-
});
|
|
60
|
+
const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).reverse().find(({
|
|
61
|
+
offsetParent
|
|
62
|
+
}) => Boolean(offsetParent));
|
|
68
63
|
if (tabbableElement) {
|
|
69
64
|
tabbableElement.focus();
|
|
70
65
|
} else if (bodyNode !== oldActiveNode) {
|
|
71
66
|
bodyNode.focus();
|
|
72
67
|
}
|
|
73
68
|
} else if (currentActiveNode === endTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_FOLLOWING) {
|
|
74
|
-
const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).find(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} = _ref3;
|
|
78
|
-
return Boolean(offsetParent);
|
|
79
|
-
});
|
|
69
|
+
const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).find(({
|
|
70
|
+
offsetParent
|
|
71
|
+
}) => Boolean(offsetParent));
|
|
80
72
|
if (tabbableElement) {
|
|
81
73
|
tabbableElement.focus();
|
|
82
74
|
} else if (bodyNode !== oldActiveNode) {
|
|
@@ -92,12 +84,11 @@ const wrapFocus = _ref => {
|
|
|
92
84
|
*
|
|
93
85
|
* Note: This must be called *before* focus moves using `onKeyDown` or similar.
|
|
94
86
|
*/
|
|
95
|
-
const wrapFocusWithoutSentinels =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
} = _ref4;
|
|
87
|
+
const wrapFocusWithoutSentinels = ({
|
|
88
|
+
containerNode,
|
|
89
|
+
currentActiveNode,
|
|
90
|
+
event
|
|
91
|
+
}) => {
|
|
101
92
|
if (!containerNode) return;
|
|
102
93
|
if (['blur', 'focusout', 'focusin', 'focus'].includes(event.type) && process.env.NODE_ENV !== 'production') {
|
|
103
94
|
throw new Error(`Error: wrapFocusWithoutSentinels(...) called in unsupported ${event.type} event.\n\nCall wrapFocusWithoutSentinels(...) from onKeyDown instead.`);
|
|
@@ -13,7 +13,7 @@ var warning = require('../internal/warning.js');
|
|
|
13
13
|
|
|
14
14
|
const didWarnAboutDeprecation = {};
|
|
15
15
|
function deprecate(propType, message) {
|
|
16
|
-
function checker(props, propName, componentName) {
|
|
16
|
+
function checker(props, propName, componentName, ...rest) {
|
|
17
17
|
if (props[propName] === undefined) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -24,9 +24,6 @@ function deprecate(propType, message) {
|
|
|
24
24
|
};
|
|
25
25
|
process.env.NODE_ENV !== "production" ? warning.warning(false, message || `The prop \`${propName}\` has been deprecated for the ` + `${componentName} component. It will be removed in the next major ` + `release`) : void 0;
|
|
26
26
|
}
|
|
27
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
28
|
-
rest[_key - 3] = arguments[_key];
|
|
29
|
-
}
|
|
30
27
|
return propType(props, propName, componentName, ...rest);
|
|
31
28
|
}
|
|
32
29
|
return checker;
|
|
@@ -13,7 +13,7 @@ var warning = require('../internal/warning.js');
|
|
|
13
13
|
|
|
14
14
|
const didWarnAboutDeprecation = {};
|
|
15
15
|
function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
|
|
16
|
-
return function checker(props, propName, componentName) {
|
|
16
|
+
return function checker(props, propName, componentName, ...rest) {
|
|
17
17
|
if (props[propName] === undefined) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -29,9 +29,6 @@ function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
|
|
|
29
29
|
process.env.NODE_ENV !== "production" ? warning.warning(false, message) : void 0;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
33
|
-
rest[_key - 3] = arguments[_key];
|
|
34
|
-
}
|
|
35
32
|
return propType(props, propName, componentName, ...rest);
|
|
36
33
|
};
|
|
37
34
|
}
|
|
@@ -19,13 +19,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
19
19
|
*/
|
|
20
20
|
const isRequiredOneOf = propTypes => {
|
|
21
21
|
const names = Object.keys(propTypes);
|
|
22
|
-
const checker = propType =>
|
|
22
|
+
const checker = propType => (props, propName, componentName, ...rest) => {
|
|
23
23
|
if (process.env.NODE_ENV !== 'production' && names.every(name => typeof props[name] === 'undefined')) {
|
|
24
24
|
return new Error(`${componentName} requires one of the following props: ${names.join(', ')}`);
|
|
25
25
|
}
|
|
26
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
27
|
-
rest[_key - 3] = arguments[_key];
|
|
28
|
-
}
|
|
29
26
|
return propType(props, propName, componentName, ...rest);
|
|
30
27
|
};
|
|
31
28
|
return names.reduce((acc, name) => ({
|
|
@@ -17,13 +17,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
17
17
|
* becomes required if the prop corresponding to the provided prop name exists.
|
|
18
18
|
*/
|
|
19
19
|
function requiredIfGivenPropIsTruthy(name, propType) {
|
|
20
|
-
return function check(props, propName, componentName) {
|
|
20
|
+
return function check(props, propName, componentName, ...rest) {
|
|
21
21
|
if (process.env.NODE_ENV !== 'production' && props[name] == true && props[propName] == null) {
|
|
22
22
|
return new Error(`You must provide a value for \`${propName}\` in \`${componentName}\` if \`${name}\` exists.`);
|
|
23
23
|
}
|
|
24
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
25
|
-
rest[_key - 3] = arguments[_key];
|
|
26
|
-
}
|
|
27
24
|
return propType(props, propName, componentName, ...rest);
|
|
28
25
|
};
|
|
29
26
|
}
|
package/lib/tools/events.js
CHANGED
|
@@ -18,10 +18,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
18
18
|
* @param handlers - An array of event handler functions.
|
|
19
19
|
* @returns A composite event handler.
|
|
20
20
|
*/
|
|
21
|
-
const composeEventHandlers = handlers =>
|
|
22
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
23
|
-
args[_key - 1] = arguments[_key];
|
|
24
|
-
}
|
|
21
|
+
const composeEventHandlers = handlers => (event, ...args) => {
|
|
25
22
|
for (const handler of handlers) {
|
|
26
23
|
if (event.defaultPrevented) {
|
|
27
24
|
break;
|
package/lib/tools/mergeRefs.js
CHANGED
|
@@ -13,20 +13,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
13
13
|
* @param {...Ref<Element>} refs List of React refs to merge.
|
|
14
14
|
* @returns {Ref<Element>} Merged React ref.
|
|
15
15
|
*/
|
|
16
|
-
const mergeRefs =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} else if (Object(ref) === ref) {
|
|
26
|
-
ref.current = el;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
};
|
|
16
|
+
const mergeRefs = (...refs) => el => {
|
|
17
|
+
refs.forEach(ref => {
|
|
18
|
+
// https://github.com/facebook/react/issues/13029#issuecomment-410002316
|
|
19
|
+
if (typeof ref === 'function') {
|
|
20
|
+
ref(el);
|
|
21
|
+
} else if (Object(ref) === ref) {
|
|
22
|
+
ref.current = el;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
30
25
|
};
|
|
31
26
|
var mergeRefs$1 = mergeRefs;
|
|
32
27
|
|
package/lib/tools/uniqueId.js
CHANGED
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
let lastId = 0;
|
|
13
|
-
const uniqueId =
|
|
14
|
-
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'id';
|
|
13
|
+
const uniqueId = (prefix = 'id') => {
|
|
15
14
|
lastId++;
|
|
16
15
|
return `${prefix}${lastId}`;
|
|
17
16
|
};
|
|
@@ -24,22 +24,20 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
24
24
|
* @param {{ name: string, type: string, className?: string | (prefix: string) => string }} props
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
|
-
const wrapComponent =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} = _ref;
|
|
27
|
+
const wrapComponent = ({
|
|
28
|
+
name,
|
|
29
|
+
className: getClassName,
|
|
30
|
+
type
|
|
31
|
+
}) => {
|
|
33
32
|
/**
|
|
34
33
|
*
|
|
35
34
|
* @param {{ className?: string, [x: string]: any}} param0
|
|
36
35
|
* @returns
|
|
37
36
|
*/
|
|
38
|
-
function Component(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} = _ref2;
|
|
37
|
+
function Component({
|
|
38
|
+
className: baseClassName,
|
|
39
|
+
...other
|
|
40
|
+
}) {
|
|
43
41
|
const prefix = usePrefix.usePrefix();
|
|
44
42
|
const componentClass = cx__default["default"](typeof getClassName === 'function' ? getClassName(prefix) : getClassName, baseClassName);
|
|
45
43
|
return /*#__PURE__*/React__default["default"].createElement(type, {
|