@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
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
9
|
+
import { useResizeObserver } from './useResizeObserver.js';
|
|
10
|
+
import { usePreviousValue } from './usePreviousValue.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Manages overflow items in a container by automatically hiding items that don't fit.
|
|
14
|
+
* @param items - Array of items to manage for overflow, each must have an `id` property.
|
|
15
|
+
* @param containerRef - React ref to the container element that holds the items.
|
|
16
|
+
* @param offsetRef - Optional ref to an offset element (like a "more" button) whose width is reserved when calculating available space.
|
|
17
|
+
* @param maxItems - Optional maximum number of visible items. If undefined, only container space constrains visibility.
|
|
18
|
+
* @param onChange - Optional callback called when hidden items change. Receives array of currently hidden items.
|
|
19
|
+
* @returns Object with `visibleItems` (items to display), `hiddenItems` (items that don't fit), and `itemRefHandler` (function to attach refs to items for width measurement).
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) => {
|
|
23
|
+
const itemsRef = useRef(null);
|
|
24
|
+
const [maxWidth, setMaxWidth] = useState(0);
|
|
25
|
+
if (!items || !Array.isArray(items)) {
|
|
26
|
+
return {
|
|
27
|
+
visibleItems: [],
|
|
28
|
+
hiddenItems: [],
|
|
29
|
+
itemRefHandler: () => {}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const handleResize = () => {
|
|
33
|
+
if (containerRef.current) {
|
|
34
|
+
const offset = offsetRef?.current?.offsetWidth || 0;
|
|
35
|
+
const newMax = containerRef.current.offsetWidth - offset;
|
|
36
|
+
setMaxWidth(newMax);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
useResizeObserver({
|
|
40
|
+
ref: containerRef,
|
|
41
|
+
onResize: handleResize
|
|
42
|
+
});
|
|
43
|
+
const getMap = () => {
|
|
44
|
+
if (!itemsRef.current) {
|
|
45
|
+
itemsRef.current = new Map();
|
|
46
|
+
}
|
|
47
|
+
return itemsRef.current;
|
|
48
|
+
};
|
|
49
|
+
const itemRefHandler = (id, node) => {
|
|
50
|
+
const map = getMap();
|
|
51
|
+
if (node) {
|
|
52
|
+
const style = getComputedStyle?.(node);
|
|
53
|
+
const totalWidth = node.offsetWidth + parseInt(style.marginLeft) + parseInt(style.marginRight);
|
|
54
|
+
map.set(id, totalWidth);
|
|
55
|
+
}
|
|
56
|
+
return () => {
|
|
57
|
+
map.delete(id);
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const getVisibleItems = () => {
|
|
61
|
+
if (!items || Array.isArray(items) === false) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
if (!containerRef) {
|
|
65
|
+
return items;
|
|
66
|
+
}
|
|
67
|
+
const map = getMap();
|
|
68
|
+
let maxReached = false;
|
|
69
|
+
let accumulatedWidth = 0;
|
|
70
|
+
const visibleItems = items.slice(0, maxItems).reduce((prev, cur) => {
|
|
71
|
+
if (maxReached) {
|
|
72
|
+
return prev;
|
|
73
|
+
}
|
|
74
|
+
const itemWidth = map.get(cur.id) || 0;
|
|
75
|
+
const willFit = accumulatedWidth + itemWidth <= maxWidth;
|
|
76
|
+
if (willFit) {
|
|
77
|
+
accumulatedWidth += itemWidth;
|
|
78
|
+
prev.push(cur);
|
|
79
|
+
} else {
|
|
80
|
+
maxReached = true;
|
|
81
|
+
}
|
|
82
|
+
return prev;
|
|
83
|
+
}, []);
|
|
84
|
+
return visibleItems;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Memoize visible items calculation to avoid recalculating on every render
|
|
88
|
+
const visibleItems = useMemo(() => {
|
|
89
|
+
if (!Array.isArray(items)) {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
return getVisibleItems();
|
|
93
|
+
}, [items, maxWidth, maxItems]);
|
|
94
|
+
|
|
95
|
+
// Memoize hidden items calculation
|
|
96
|
+
const hiddenItems = useMemo(() => {
|
|
97
|
+
if (!Array.isArray(items)) {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
return items.slice(visibleItems.length);
|
|
101
|
+
}, [items, visibleItems]);
|
|
102
|
+
|
|
103
|
+
// Use previous value to compare and only call onChange when needed
|
|
104
|
+
const previousHiddenItems = usePreviousValue(hiddenItems);
|
|
105
|
+
|
|
106
|
+
// Only call onChange if hidden items actually changed
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (previousHiddenItems && onChange) {
|
|
109
|
+
const hasChanged = hiddenItems.length !== previousHiddenItems.length || hiddenItems.some((item, index) => item !== previousHiddenItems[index]);
|
|
110
|
+
if (hasChanged) {
|
|
111
|
+
onChange(hiddenItems);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, [hiddenItems, previousHiddenItems, onChange]);
|
|
115
|
+
return {
|
|
116
|
+
visibleItems,
|
|
117
|
+
itemRefHandler,
|
|
118
|
+
hiddenItems
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export { useOverflowItems as default };
|
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
import { useState, useRef, useEffect, useLayoutEffect } from 'react';
|
|
9
9
|
|
|
10
|
-
const useResizeObserver =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} = _ref;
|
|
10
|
+
const useResizeObserver = ({
|
|
11
|
+
ref,
|
|
12
|
+
onResize
|
|
13
|
+
}) => {
|
|
15
14
|
const [width, setWidth] = useState(-1);
|
|
16
15
|
const [height, setHeight] = useState(-1);
|
|
17
16
|
const entriesToHandle = useRef(null);
|
|
@@ -20,9 +20,7 @@ const useSavedCallback = callback => {
|
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
savedCallback.current = callback;
|
|
22
22
|
}, [callback]);
|
|
23
|
-
return useCallback(
|
|
24
|
-
return savedCallback.current ? savedCallback.current(...arguments) : undefined;
|
|
25
|
-
}, []);
|
|
23
|
+
return useCallback((...args) => savedCallback.current ? savedCallback.current(...args) : undefined, []);
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
export { useSavedCallback };
|
package/es/internal/wrapFocus.js
CHANGED
|
@@ -30,8 +30,7 @@ const DOCUMENT_POSITION_BROAD_FOLLOWING = typeof Node !== 'undefined' ? Node.DOC
|
|
|
30
30
|
* @returns {boolean} Whether the node or one of its ancestors is in a floating
|
|
31
31
|
* menu.
|
|
32
32
|
*/
|
|
33
|
-
const elementOrParentIsFloatingMenu =
|
|
34
|
-
let selectorsFloatingMenus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
33
|
+
const elementOrParentIsFloatingMenu = (node, selectorsFloatingMenus = []) => {
|
|
35
34
|
if (node instanceof Element && typeof node.closest === 'function') {
|
|
36
35
|
const allSelectorsFloatingMenus = ['.cds--overflow-menu-options', '.cds--tooltip', '.flatpickr-calendar', ...selectorsFloatingMenus];
|
|
37
36
|
return allSelectorsFloatingMenus.some(selector => !!node.closest(selector));
|
|
@@ -43,36 +42,29 @@ const elementOrParentIsFloatingMenu = function (node) {
|
|
|
43
42
|
* Ensures the focus is kept within the given container by implementing
|
|
44
43
|
* "focus-wrap" behavior.
|
|
45
44
|
*/
|
|
46
|
-
const wrapFocus =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} = _ref;
|
|
45
|
+
const wrapFocus = ({
|
|
46
|
+
bodyNode,
|
|
47
|
+
startTrapNode,
|
|
48
|
+
endTrapNode,
|
|
49
|
+
currentActiveNode,
|
|
50
|
+
oldActiveNode,
|
|
51
|
+
selectorsFloatingMenus
|
|
52
|
+
}) => {
|
|
55
53
|
if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus)) {
|
|
56
54
|
const comparisonResult = oldActiveNode.compareDocumentPosition(currentActiveNode);
|
|
57
55
|
if (currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING) {
|
|
58
|
-
const tabbableElement = Array.from(bodyNode.querySelectorAll(selectorTabbable)).reverse().find(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} = _ref2;
|
|
62
|
-
return Boolean(offsetParent);
|
|
63
|
-
});
|
|
56
|
+
const tabbableElement = Array.from(bodyNode.querySelectorAll(selectorTabbable)).reverse().find(({
|
|
57
|
+
offsetParent
|
|
58
|
+
}) => Boolean(offsetParent));
|
|
64
59
|
if (tabbableElement) {
|
|
65
60
|
tabbableElement.focus();
|
|
66
61
|
} else if (bodyNode !== oldActiveNode) {
|
|
67
62
|
bodyNode.focus();
|
|
68
63
|
}
|
|
69
64
|
} else if (currentActiveNode === endTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_FOLLOWING) {
|
|
70
|
-
const tabbableElement = Array.from(bodyNode.querySelectorAll(selectorTabbable)).find(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} = _ref3;
|
|
74
|
-
return Boolean(offsetParent);
|
|
75
|
-
});
|
|
65
|
+
const tabbableElement = Array.from(bodyNode.querySelectorAll(selectorTabbable)).find(({
|
|
66
|
+
offsetParent
|
|
67
|
+
}) => Boolean(offsetParent));
|
|
76
68
|
if (tabbableElement) {
|
|
77
69
|
tabbableElement.focus();
|
|
78
70
|
} else if (bodyNode !== oldActiveNode) {
|
|
@@ -88,12 +80,11 @@ const wrapFocus = _ref => {
|
|
|
88
80
|
*
|
|
89
81
|
* Note: This must be called *before* focus moves using `onKeyDown` or similar.
|
|
90
82
|
*/
|
|
91
|
-
const wrapFocusWithoutSentinels =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
} = _ref4;
|
|
83
|
+
const wrapFocusWithoutSentinels = ({
|
|
84
|
+
containerNode,
|
|
85
|
+
currentActiveNode,
|
|
86
|
+
event
|
|
87
|
+
}) => {
|
|
97
88
|
if (!containerNode) return;
|
|
98
89
|
if (['blur', 'focusout', 'focusin', 'focus'].includes(event.type) && process.env.NODE_ENV !== 'production') {
|
|
99
90
|
throw new Error(`Error: wrapFocusWithoutSentinels(...) called in unsupported ${event.type} event.\n\nCall wrapFocusWithoutSentinels(...) from onKeyDown instead.`);
|
|
@@ -9,7 +9,7 @@ import { warning } from '../internal/warning.js';
|
|
|
9
9
|
|
|
10
10
|
const didWarnAboutDeprecation = {};
|
|
11
11
|
function deprecate(propType, message) {
|
|
12
|
-
function checker(props, propName, componentName) {
|
|
12
|
+
function checker(props, propName, componentName, ...rest) {
|
|
13
13
|
if (props[propName] === undefined) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -20,9 +20,6 @@ function deprecate(propType, message) {
|
|
|
20
20
|
};
|
|
21
21
|
process.env.NODE_ENV !== "production" ? warning(false, message || `The prop \`${propName}\` has been deprecated for the ` + `${componentName} component. It will be removed in the next major ` + `release`) : void 0;
|
|
22
22
|
}
|
|
23
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
24
|
-
rest[_key - 3] = arguments[_key];
|
|
25
|
-
}
|
|
26
23
|
return propType(props, propName, componentName, ...rest);
|
|
27
24
|
}
|
|
28
25
|
return checker;
|
|
@@ -9,7 +9,7 @@ import { warning } from '../internal/warning.js';
|
|
|
9
9
|
|
|
10
10
|
const didWarnAboutDeprecation = {};
|
|
11
11
|
function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
|
|
12
|
-
return function checker(props, propName, componentName) {
|
|
12
|
+
return function checker(props, propName, componentName, ...rest) {
|
|
13
13
|
if (props[propName] === undefined) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -25,9 +25,6 @@ function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
|
|
|
25
25
|
process.env.NODE_ENV !== "production" ? warning(false, message) : void 0;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
29
|
-
rest[_key - 3] = arguments[_key];
|
|
30
|
-
}
|
|
31
28
|
return propType(props, propName, componentName, ...rest);
|
|
32
29
|
};
|
|
33
30
|
}
|
|
@@ -15,13 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
const isRequiredOneOf = propTypes => {
|
|
17
17
|
const names = Object.keys(propTypes);
|
|
18
|
-
const checker = propType =>
|
|
18
|
+
const checker = propType => (props, propName, componentName, ...rest) => {
|
|
19
19
|
if (process.env.NODE_ENV !== 'production' && names.every(name => typeof props[name] === 'undefined')) {
|
|
20
20
|
return new Error(`${componentName} requires one of the following props: ${names.join(', ')}`);
|
|
21
21
|
}
|
|
22
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
23
|
-
rest[_key - 3] = arguments[_key];
|
|
24
|
-
}
|
|
25
22
|
return propType(props, propName, componentName, ...rest);
|
|
26
23
|
};
|
|
27
24
|
return names.reduce((acc, name) => ({
|
|
@@ -13,13 +13,10 @@
|
|
|
13
13
|
* becomes required if the prop corresponding to the provided prop name exists.
|
|
14
14
|
*/
|
|
15
15
|
function requiredIfGivenPropIsTruthy(name, propType) {
|
|
16
|
-
return function check(props, propName, componentName) {
|
|
16
|
+
return function check(props, propName, componentName, ...rest) {
|
|
17
17
|
if (process.env.NODE_ENV !== 'production' && props[name] == true && props[propName] == null) {
|
|
18
18
|
return new Error(`You must provide a value for \`${propName}\` in \`${componentName}\` if \`${name}\` exists.`);
|
|
19
19
|
}
|
|
20
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
21
|
-
rest[_key - 3] = arguments[_key];
|
|
22
|
-
}
|
|
23
20
|
return propType(props, propName, componentName, ...rest);
|
|
24
21
|
};
|
|
25
22
|
}
|
package/es/tools/events.js
CHANGED
|
@@ -14,10 +14,7 @@
|
|
|
14
14
|
* @param handlers - An array of event handler functions.
|
|
15
15
|
* @returns A composite event handler.
|
|
16
16
|
*/
|
|
17
|
-
const composeEventHandlers = handlers =>
|
|
18
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
19
|
-
args[_key - 1] = arguments[_key];
|
|
20
|
-
}
|
|
17
|
+
const composeEventHandlers = handlers => (event, ...args) => {
|
|
21
18
|
for (const handler of handlers) {
|
|
22
19
|
if (event.defaultPrevented) {
|
|
23
20
|
break;
|
package/es/tools/mergeRefs.js
CHANGED
|
@@ -9,20 +9,15 @@
|
|
|
9
9
|
* @param {...Ref<Element>} refs List of React refs to merge.
|
|
10
10
|
* @returns {Ref<Element>} Merged React ref.
|
|
11
11
|
*/
|
|
12
|
-
const mergeRefs =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} else if (Object(ref) === ref) {
|
|
22
|
-
ref.current = el;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
};
|
|
12
|
+
const mergeRefs = (...refs) => el => {
|
|
13
|
+
refs.forEach(ref => {
|
|
14
|
+
// https://github.com/facebook/react/issues/13029#issuecomment-410002316
|
|
15
|
+
if (typeof ref === 'function') {
|
|
16
|
+
ref(el);
|
|
17
|
+
} else if (Object(ref) === ref) {
|
|
18
|
+
ref.current = el;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
26
21
|
};
|
|
27
22
|
var mergeRefs$1 = mergeRefs;
|
|
28
23
|
|
package/es/tools/uniqueId.js
CHANGED
|
@@ -14,22 +14,20 @@ import { usePrefix } from '../internal/usePrefix.js';
|
|
|
14
14
|
* @param {{ name: string, type: string, className?: string | (prefix: string) => string }} props
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
|
-
const wrapComponent =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = _ref;
|
|
17
|
+
const wrapComponent = ({
|
|
18
|
+
name,
|
|
19
|
+
className: getClassName,
|
|
20
|
+
type
|
|
21
|
+
}) => {
|
|
23
22
|
/**
|
|
24
23
|
*
|
|
25
24
|
* @param {{ className?: string, [x: string]: any}} param0
|
|
26
25
|
* @returns
|
|
27
26
|
*/
|
|
28
|
-
function Component(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} = _ref2;
|
|
27
|
+
function Component({
|
|
28
|
+
className: baseClassName,
|
|
29
|
+
...other
|
|
30
|
+
}) {
|
|
33
31
|
const prefix = usePrefix();
|
|
34
32
|
const componentClass = cx(typeof getClassName === 'function' ? getClassName(prefix) : getClassName, baseClassName);
|
|
35
33
|
return /*#__PURE__*/React.createElement(type, {
|
|
@@ -29,12 +29,11 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
29
29
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
30
30
|
|
|
31
31
|
var _Undo;
|
|
32
|
-
const AILabelContent = /*#__PURE__*/React__default["default"].forwardRef(function AILabelContent(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _ref;
|
|
32
|
+
const AILabelContent = /*#__PURE__*/React__default["default"].forwardRef(function AILabelContent({
|
|
33
|
+
className,
|
|
34
|
+
children,
|
|
35
|
+
...rest
|
|
36
|
+
}, ref) {
|
|
38
37
|
const prefix = usePrefix.usePrefix();
|
|
39
38
|
const hasAILabelActions = React__default["default"].Children.toArray(children).some(child => {
|
|
40
39
|
const item = child;
|
|
@@ -59,12 +58,11 @@ AILabelContent.propTypes = {
|
|
|
59
58
|
*/
|
|
60
59
|
className: PropTypes__default["default"].string
|
|
61
60
|
};
|
|
62
|
-
const AILabelActions = /*#__PURE__*/React__default["default"].forwardRef(function AILabelActions(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} = _ref2;
|
|
61
|
+
const AILabelActions = /*#__PURE__*/React__default["default"].forwardRef(function AILabelActions({
|
|
62
|
+
className,
|
|
63
|
+
children,
|
|
64
|
+
...rest
|
|
65
|
+
}, ref) {
|
|
68
66
|
const prefix = usePrefix.usePrefix();
|
|
69
67
|
const aiLabelActionsClasses = cx__default["default"](className, {
|
|
70
68
|
[`${prefix}--ai-label-actions`]: true
|
|
@@ -90,24 +88,23 @@ AILabelActions.propTypes = {
|
|
|
90
88
|
* @deprecated Use NewPopoverAlignment instead.
|
|
91
89
|
*/
|
|
92
90
|
|
|
93
|
-
const AILabel = /*#__PURE__*/React__default["default"].forwardRef(function AILabel(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
} = _ref3;
|
|
91
|
+
const AILabel = /*#__PURE__*/React__default["default"].forwardRef(function AILabel({
|
|
92
|
+
aiText = 'AI',
|
|
93
|
+
aiTextLabel,
|
|
94
|
+
textLabel,
|
|
95
|
+
align,
|
|
96
|
+
autoAlign = true,
|
|
97
|
+
children,
|
|
98
|
+
className,
|
|
99
|
+
kind = 'default',
|
|
100
|
+
onRevertClick,
|
|
101
|
+
revertActive,
|
|
102
|
+
revertLabel = 'Revert to AI input',
|
|
103
|
+
slugLabel = 'Show information',
|
|
104
|
+
['aria-label']: ariaLabel = 'Show information',
|
|
105
|
+
size = 'xs',
|
|
106
|
+
...rest
|
|
107
|
+
}, ref) {
|
|
111
108
|
const prefix = usePrefix.usePrefix();
|
|
112
109
|
const id = useId.useId('AILabel');
|
|
113
110
|
const aiLabelClasses = cx__default["default"](className, {
|
|
@@ -22,11 +22,10 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
const AISkeletonIcon =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
25
|
+
const AISkeletonIcon = ({
|
|
26
|
+
className,
|
|
27
|
+
...rest
|
|
28
|
+
}) => {
|
|
30
29
|
const prefix = usePrefix.usePrefix();
|
|
31
30
|
const AISkeletonIconClasses = cx__default["default"](className, {
|
|
32
31
|
[`${prefix}--skeleton__icon--ai`]: true
|
|
@@ -22,11 +22,10 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
22
22
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
const AISkeletonPlaceholder =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
25
|
+
const AISkeletonPlaceholder = ({
|
|
26
|
+
className,
|
|
27
|
+
...other
|
|
28
|
+
}) => {
|
|
30
29
|
const prefix = usePrefix.usePrefix();
|
|
31
30
|
const AISkeletonPlaceholderClasses = cx__default["default"]({
|
|
32
31
|
className,
|
|
@@ -22,11 +22,10 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
const AISkeletonText =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
25
|
+
const AISkeletonText = ({
|
|
26
|
+
className,
|
|
27
|
+
...rest
|
|
28
|
+
}) => {
|
|
30
29
|
const prefix = usePrefix.usePrefix();
|
|
31
30
|
const aiSkeletonTextClasses = cx__default["default"](className, {
|
|
32
31
|
[`${prefix}--skeleton__text--ai`]: true
|
|
@@ -24,16 +24,15 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
24
24
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
25
25
|
|
|
26
26
|
var _SkeletonText, _SkeletonText2, _SkeletonText3;
|
|
27
|
-
function AccordionSkeleton(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} = _ref;
|
|
27
|
+
function AccordionSkeleton({
|
|
28
|
+
align = 'end',
|
|
29
|
+
className,
|
|
30
|
+
count = 4,
|
|
31
|
+
isFlush,
|
|
32
|
+
open = true,
|
|
33
|
+
ordered = false,
|
|
34
|
+
...rest
|
|
35
|
+
}) {
|
|
37
36
|
const prefix = usePrefix.usePrefix();
|
|
38
37
|
const classes = cx__default["default"](`${prefix}--accordion`, `${prefix}--skeleton`, className, {
|
|
39
38
|
[`${prefix}--accordion--${align}`]: align,
|
|
@@ -22,17 +22,16 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
22
22
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
23
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
24
|
|
|
25
|
-
function Accordion(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = _ref;
|
|
25
|
+
function Accordion({
|
|
26
|
+
align = 'end',
|
|
27
|
+
children,
|
|
28
|
+
className: customClassName,
|
|
29
|
+
disabled = false,
|
|
30
|
+
isFlush = false,
|
|
31
|
+
ordered = false,
|
|
32
|
+
size,
|
|
33
|
+
...rest
|
|
34
|
+
}) {
|
|
36
35
|
const prefix = usePrefix.usePrefix();
|
|
37
36
|
const className = cx__default["default"](`${prefix}--accordion`, customClassName, {
|
|
38
37
|
[`${prefix}--accordion--${align}`]: align,
|
|
@@ -32,20 +32,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
32
32
|
const defaultRenderToggle = props => /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
|
|
33
33
|
type: "button"
|
|
34
34
|
}, props));
|
|
35
|
-
function AccordionItem(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} = _ref;
|
|
35
|
+
function AccordionItem({
|
|
36
|
+
children,
|
|
37
|
+
className: customClassName = '',
|
|
38
|
+
open = false,
|
|
39
|
+
onHeadingClick,
|
|
40
|
+
renderExpando = defaultRenderToggle,
|
|
41
|
+
// remove renderExpando in next major release
|
|
42
|
+
renderToggle,
|
|
43
|
+
title = 'title',
|
|
44
|
+
disabled: controlledDisabled,
|
|
45
|
+
handleAnimationEnd,
|
|
46
|
+
...rest
|
|
47
|
+
}) {
|
|
49
48
|
const [isOpen, setIsOpen] = React.useState(open);
|
|
50
49
|
const [prevIsOpen, setPrevIsOpen] = React.useState(open);
|
|
51
50
|
const accordionState = React.useContext(AccordionProvider.AccordionContext);
|
|
@@ -18,11 +18,10 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
18
18
|
const AccordionContext = /*#__PURE__*/React.createContext({
|
|
19
19
|
disabled: false
|
|
20
20
|
});
|
|
21
|
-
const AccordionProvider =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref;
|
|
21
|
+
const AccordionProvider = ({
|
|
22
|
+
disabled,
|
|
23
|
+
children
|
|
24
|
+
}) => {
|
|
26
25
|
return /*#__PURE__*/React__default["default"].createElement(AccordionContext.Provider, {
|
|
27
26
|
value: {
|
|
28
27
|
disabled
|
|
@@ -27,14 +27,13 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
27
27
|
* This is often useful alongside our grid components, or for media assets like
|
|
28
28
|
* images or videos.
|
|
29
29
|
*/
|
|
30
|
-
const AspectRatio =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _ref;
|
|
30
|
+
const AspectRatio = ({
|
|
31
|
+
as: BaseComponent = 'div',
|
|
32
|
+
className: containerClassName,
|
|
33
|
+
children,
|
|
34
|
+
ratio = '1x1',
|
|
35
|
+
...rest
|
|
36
|
+
}) => {
|
|
38
37
|
const prefix = usePrefix.usePrefix();
|
|
39
38
|
const className = cx__default["default"](containerClassName, `${prefix}--aspect-ratio`, `${prefix}--aspect-ratio--${ratio}`);
|
|
40
39
|
return /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({
|