@carbon/react 1.83.0 → 1.84.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +980 -945
- 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 +31 -34
- 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 +55 -63
- package/es/components/ModalWrapper/ModalWrapper.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +46 -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 +35 -41
- package/es/components/OverflowMenu/next/index.js +12 -13
- package/es/components/PageHeader/PageHeader.d.ts +29 -5
- package/es/components/PageHeader/PageHeader.js +119 -73
- 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 -28
- 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 +69 -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 +3 -3
- 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/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 +10 -11
- 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 +2 -2
- 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/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 +31 -34
- package/lib/components/ComposedModal/ModalFooter.js +37 -42
- package/lib/components/ComposedModal/ModalHeader.js +14 -15
- package/lib/components/ContainedList/ContainedList.js +10 -11
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +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 +55 -63
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +45 -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 +35 -41
- package/lib/components/OverflowMenu/next/index.js +12 -13
- package/lib/components/PageHeader/PageHeader.d.ts +29 -5
- package/lib/components/PageHeader/PageHeader.js +119 -73
- package/lib/components/Pagination/Pagination.Skeleton.js +4 -5
- package/lib/components/Pagination/Pagination.js +24 -25
- package/lib/components/Pagination/experimental/PageSelector.js +8 -9
- package/lib/components/Pagination/experimental/Pagination.js +20 -21
- package/lib/components/PaginationNav/PaginationNav.js +33 -38
- package/lib/components/Popover/index.js +26 -28
- package/lib/components/ProgressBar/ProgressBar.js +11 -12
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
- package/lib/components/ProgressIndicator/ProgressIndicator.js +29 -32
- package/lib/components/RadioTile/RadioTile.js +17 -18
- package/lib/components/Search/Search.Skeleton.js +5 -6
- package/lib/components/Search/Search.js +26 -28
- package/lib/components/Select/Select.Skeleton.js +5 -6
- package/lib/components/Select/Select.js +24 -25
- package/lib/components/SelectItem/SelectItem.js +8 -9
- package/lib/components/SelectItemGroup/SelectItemGroup.js +7 -8
- package/lib/components/ShapeIndicator/index.js +7 -8
- package/lib/components/SkeletonIcon/SkeletonIcon.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 +69 -83
- package/lib/components/Slider/SliderHandles.js +6 -6
- package/lib/components/StructuredList/StructuredList.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.js +83 -98
- package/lib/components/Tabs/usePressable.js +7 -8
- package/lib/components/Tag/DismissibleTag.js +16 -17
- package/lib/components/Tag/OperationalTag.js +10 -11
- package/lib/components/Tag/SelectableTag.js +13 -14
- package/lib/components/Tag/Tag.Skeleton.js +5 -6
- package/lib/components/Tag/Tag.js +19 -20
- package/lib/components/Text/Text.js +6 -7
- package/lib/components/Text/TextDirection.js +5 -6
- package/lib/components/TextArea/TextArea.js +3 -3
- package/lib/components/TextInput/ControlledPasswordInput.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/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 +10 -11
- 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 +35 -35
- 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/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 +23 -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
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { type
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
/**
|
|
10
|
-
* `HeaderMenu` is used to render submenu's in the `Header`. Most often children
|
|
11
|
-
* will be a `HeaderMenuItem`. It handles certain keyboard events to help
|
|
12
|
-
* with managing focus. It also passes along refs to each child so that it can
|
|
13
|
-
* help manage focus state of its children.
|
|
14
|
-
*/
|
|
7
|
+
import React, { type FocusEvent, type KeyboardEvent, type MouseEvent, type ReactNode, type Ref } from 'react';
|
|
15
8
|
export interface HeaderMenuProps {
|
|
16
9
|
/**
|
|
17
10
|
* Required props for the accessibility label of the menu
|
|
@@ -25,7 +18,7 @@ export interface HeaderMenuProps {
|
|
|
25
18
|
/**
|
|
26
19
|
* Provide a custom ref handler for the menu button
|
|
27
20
|
*/
|
|
28
|
-
focusRef?:
|
|
21
|
+
focusRef?: Ref<any>;
|
|
29
22
|
/**
|
|
30
23
|
* Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
|
|
31
24
|
*/
|
|
@@ -43,21 +36,21 @@ export interface HeaderMenuProps {
|
|
|
43
36
|
* Optionally provide an onBlur handler that is called when the underlying
|
|
44
37
|
* button fires it's onblur event
|
|
45
38
|
*/
|
|
46
|
-
onBlur?: (event:
|
|
39
|
+
onBlur?: (event: FocusEvent<HTMLLIElement>) => void;
|
|
47
40
|
/**
|
|
48
41
|
* Optionally provide an onClick handler that is called when the underlying
|
|
49
42
|
* button fires it's onclick event
|
|
50
43
|
*/
|
|
51
|
-
onClick?: (event:
|
|
44
|
+
onClick?: (event: MouseEvent<HTMLLIElement>) => void;
|
|
52
45
|
/**
|
|
53
46
|
* Optionally provide an onKeyDown handler that is called when the underlying
|
|
54
47
|
* button fires it's onkeydown event
|
|
55
48
|
*/
|
|
56
|
-
onKeyDown?: (event:
|
|
49
|
+
onKeyDown?: (event: KeyboardEvent<HTMLLIElement>) => void;
|
|
57
50
|
/**
|
|
58
51
|
* Optional component to render instead of string
|
|
59
52
|
*/
|
|
60
|
-
renderMenuContent?: () =>
|
|
53
|
+
renderMenuContent?: () => ReactNode;
|
|
61
54
|
/**
|
|
62
55
|
* Optionally provide a tabIndex for the underlying menu button
|
|
63
56
|
*/
|
|
@@ -65,102 +58,7 @@ export interface HeaderMenuProps {
|
|
|
65
58
|
/**
|
|
66
59
|
* The children should be a series of `HeaderMenuItem` components.
|
|
67
60
|
*/
|
|
68
|
-
children?:
|
|
69
|
-
}
|
|
70
|
-
interface HeaderMenuState {
|
|
71
|
-
expanded: boolean;
|
|
72
|
-
selectedIndex: number | null;
|
|
73
|
-
}
|
|
74
|
-
declare class HeaderMenu extends React.Component<HeaderMenuProps, HeaderMenuState> {
|
|
75
|
-
static propTypes: {
|
|
76
|
-
/**
|
|
77
|
-
* Optionally provide a custom class to apply to the underlying `<li>` node
|
|
78
|
-
*/
|
|
79
|
-
className: PropTypes.Requireable<string>;
|
|
80
|
-
/**
|
|
81
|
-
* Provide a custom ref handler for the menu button
|
|
82
|
-
*/
|
|
83
|
-
focusRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
84
|
-
/**
|
|
85
|
-
* Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
|
|
86
|
-
*/
|
|
87
|
-
isActive: PropTypes.Requireable<boolean>;
|
|
88
|
-
/**
|
|
89
|
-
* Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
|
|
90
|
-
* @deprecated Please use `isActive` instead. This will be removed in the next major release.
|
|
91
|
-
*/
|
|
92
|
-
isCurrentPage: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
93
|
-
/**
|
|
94
|
-
* Provide a label for the link text
|
|
95
|
-
*/
|
|
96
|
-
menuLinkName: PropTypes.Validator<string>;
|
|
97
|
-
/**
|
|
98
|
-
* Optionally provide an onBlur handler that is called when the underlying
|
|
99
|
-
* button fires it's onblur event
|
|
100
|
-
*/
|
|
101
|
-
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
102
|
-
/**
|
|
103
|
-
* Optionally provide an onClick handler that is called when the underlying
|
|
104
|
-
* button fires it's onclick event
|
|
105
|
-
*/
|
|
106
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
107
|
-
/**
|
|
108
|
-
* Optionally provide an onKeyDown handler that is called when the underlying
|
|
109
|
-
* button fires it's onkeydown event
|
|
110
|
-
*/
|
|
111
|
-
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
112
|
-
/**
|
|
113
|
-
* Optional component to render instead of string
|
|
114
|
-
*/
|
|
115
|
-
renderMenuContent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
116
|
-
/**
|
|
117
|
-
* Optionally provide a tabIndex for the underlying menu button
|
|
118
|
-
*/
|
|
119
|
-
tabIndex: PropTypes.Requireable<number>;
|
|
120
|
-
};
|
|
121
|
-
static contextType: React.Context<string>;
|
|
122
|
-
_subMenus: React.RefObject<HTMLUListElement | null>;
|
|
123
|
-
private items;
|
|
124
|
-
private menuButtonRef;
|
|
125
|
-
constructor(props: any);
|
|
126
|
-
/**
|
|
127
|
-
* Toggle the expanded state of the menu on click.
|
|
128
|
-
*/
|
|
129
|
-
handleOnClick: (e: any) => void;
|
|
130
|
-
/**
|
|
131
|
-
* Keyboard event handler for the entire menu.
|
|
132
|
-
*/
|
|
133
|
-
handleOnKeyDown: (event: any) => void;
|
|
134
|
-
/**
|
|
135
|
-
* Handle our blur event from our underlying menuitems. Will mostly be used
|
|
136
|
-
* for closing our menu in response to a user clicking off or tabbing out of
|
|
137
|
-
* the menu or menubar.
|
|
138
|
-
*/
|
|
139
|
-
handleOnBlur: (event: any) => void;
|
|
140
|
-
/**
|
|
141
|
-
* ref handler for our menu button. If we are supplied a `focusRef` prop, we also
|
|
142
|
-
* forward along the node.
|
|
143
|
-
*
|
|
144
|
-
* This is useful when this component is a child in a
|
|
145
|
-
* menu or menubar as it will allow the parent to explicitly focus the menu
|
|
146
|
-
* button node when that child should receive focus.
|
|
147
|
-
*/
|
|
148
|
-
handleMenuButtonRef: (node: any) => void;
|
|
149
|
-
/**
|
|
150
|
-
* Handles individual menuitem refs. We assign them to a class instance
|
|
151
|
-
* property so that we can properly manage focus of our children.
|
|
152
|
-
*/
|
|
153
|
-
handleItemRef: (index: any) => (node: any) => void;
|
|
154
|
-
handleMenuClose: (event: any) => void;
|
|
155
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
156
|
-
/**
|
|
157
|
-
* We capture the `ref` for each child inside of `this.items` to properly
|
|
158
|
-
* manage focus. In addition to this focus management, all items receive a
|
|
159
|
-
* `tabIndex: -1` so the user won't hit a large number of items in their tab
|
|
160
|
-
* sequence when they might not want to go through all the items.
|
|
161
|
-
*/
|
|
162
|
-
_renderMenuItem: (item: React.ReactNode, index: number) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
61
|
+
children?: ReactNode;
|
|
163
62
|
}
|
|
164
|
-
declare const
|
|
165
|
-
export
|
|
166
|
-
export default HeaderMenuForwardRef;
|
|
63
|
+
export declare const HeaderMenu: React.ForwardRefExoticComponent<HeaderMenuProps & React.RefAttributes<HTMLLIElement>>;
|
|
64
|
+
export default HeaderMenu;
|
|
@@ -20,6 +20,7 @@ var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
|
|
|
20
20
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
21
21
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
22
22
|
var events = require('../../tools/events.js');
|
|
23
|
+
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
23
24
|
|
|
24
25
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
26
|
|
|
@@ -27,204 +28,163 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
27
28
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
28
29
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const frFn = React.forwardRef;
|
|
32
|
+
const HeaderMenu = frFn((props, ref) => {
|
|
33
|
+
const {
|
|
34
|
+
isActive,
|
|
35
|
+
isCurrentPage,
|
|
36
|
+
'aria-label': ariaLabel,
|
|
37
|
+
'aria-labelledby': ariaLabelledBy,
|
|
38
|
+
className: customClassName,
|
|
39
|
+
children,
|
|
40
|
+
renderMenuContent: MenuContent,
|
|
41
|
+
menuLinkName,
|
|
42
|
+
focusRef,
|
|
43
|
+
onBlur,
|
|
44
|
+
onClick,
|
|
45
|
+
onKeyDown,
|
|
46
|
+
...rest
|
|
47
|
+
} = props;
|
|
48
|
+
const prefix = React.useContext(usePrefix.PrefixContext);
|
|
49
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
50
|
+
const menuButtonRef = React.useRef(null);
|
|
51
|
+
const subMenusRef = React.useRef(null);
|
|
52
|
+
const itemRefs = React.useRef([]);
|
|
53
|
+
const mergedButtonRef = useMergedRefs.useMergedRefs([ref, focusRef, menuButtonRef]);
|
|
36
54
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_rollupPluginBabelHelpers.defineProperty(this, "handleOnClick", e => {
|
|
47
|
-
const {
|
|
48
|
-
current: subMenusNode
|
|
49
|
-
} = this._subMenus;
|
|
50
|
-
if (!subMenusNode || !subMenusNode.contains(e.target)) {
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
}
|
|
53
|
-
this.setState(prevState => ({
|
|
54
|
-
expanded: !prevState.expanded
|
|
55
|
-
}));
|
|
56
|
-
});
|
|
57
|
-
/**
|
|
58
|
-
* Keyboard event handler for the entire menu.
|
|
59
|
-
*/
|
|
60
|
-
_rollupPluginBabelHelpers.defineProperty(this, "handleOnKeyDown", event => {
|
|
61
|
-
// Handle enter or space key for toggling the expanded state of the menu.
|
|
62
|
-
if (match.matches(event, [keys.Enter, keys.Space])) {
|
|
63
|
-
event.stopPropagation();
|
|
64
|
-
event.preventDefault();
|
|
65
|
-
this.setState(prevState => ({
|
|
66
|
-
expanded: !prevState.expanded
|
|
67
|
-
}));
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
/**
|
|
72
|
-
* Handle our blur event from our underlying menuitems. Will mostly be used
|
|
73
|
-
* for closing our menu in response to a user clicking off or tabbing out of
|
|
74
|
-
* the menu or menubar.
|
|
75
|
-
*/
|
|
76
|
-
_rollupPluginBabelHelpers.defineProperty(this, "handleOnBlur", event => {
|
|
77
|
-
// Close the menu on blur when the related target is not a sibling menu item
|
|
78
|
-
// or a child in a submenu
|
|
79
|
-
const siblingItemBlurredTo = this.items.find(element => element === event.relatedTarget);
|
|
80
|
-
const childItemBlurredTo = this._subMenus.current?.contains(event.relatedTarget);
|
|
81
|
-
if (!siblingItemBlurredTo && !childItemBlurredTo) {
|
|
82
|
-
this.setState({
|
|
83
|
-
expanded: false,
|
|
84
|
-
selectedIndex: null
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
/**
|
|
89
|
-
* ref handler for our menu button. If we are supplied a `focusRef` prop, we also
|
|
90
|
-
* forward along the node.
|
|
91
|
-
*
|
|
92
|
-
* This is useful when this component is a child in a
|
|
93
|
-
* menu or menubar as it will allow the parent to explicitly focus the menu
|
|
94
|
-
* button node when that child should receive focus.
|
|
95
|
-
*/
|
|
96
|
-
_rollupPluginBabelHelpers.defineProperty(this, "handleMenuButtonRef", node => {
|
|
97
|
-
const {
|
|
98
|
-
focusRef
|
|
99
|
-
} = this.props;
|
|
100
|
-
// Check if focusRef is a function before calling it
|
|
101
|
-
if (typeof focusRef === 'function') {
|
|
102
|
-
focusRef(node);
|
|
103
|
-
}
|
|
104
|
-
this.menuButtonRef = node;
|
|
105
|
-
});
|
|
106
|
-
/**
|
|
107
|
-
* Handles individual menuitem refs. We assign them to a class instance
|
|
108
|
-
* property so that we can properly manage focus of our children.
|
|
109
|
-
*/
|
|
110
|
-
_rollupPluginBabelHelpers.defineProperty(this, "handleItemRef", index => node => {
|
|
111
|
-
this.items[index] = node;
|
|
112
|
-
});
|
|
113
|
-
_rollupPluginBabelHelpers.defineProperty(this, "handleMenuClose", event => {
|
|
114
|
-
// Handle ESC keydown for closing the expanded menu.
|
|
115
|
-
if (match.matches(event, [keys.Escape]) && this.state.expanded) {
|
|
116
|
-
event.stopPropagation();
|
|
117
|
-
event.preventDefault();
|
|
118
|
-
this.setState(() => ({
|
|
119
|
-
expanded: false,
|
|
120
|
-
selectedIndex: null
|
|
121
|
-
}));
|
|
55
|
+
/**
|
|
56
|
+
* Toggle the expanded state of the menu on click.
|
|
57
|
+
*/
|
|
58
|
+
const handleOnClick = e => {
|
|
59
|
+
if (!subMenusRef.current || e.target instanceof Node && !subMenusRef.current.contains(e.target)) {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
}
|
|
62
|
+
setExpanded(prev => !prev);
|
|
63
|
+
};
|
|
122
64
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Keyboard event handler for the entire menu.
|
|
67
|
+
*/
|
|
68
|
+
const handleOnKeyDown = event => {
|
|
69
|
+
// Handle enter or space key for toggling the expanded state of the menu.
|
|
70
|
+
if (match.matches(event, [keys.Enter, keys.Space])) {
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
setExpanded(prev => !prev);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Handle our blur event from our underlying menuitems. Will mostly be used
|
|
80
|
+
* for closing our menu in response to a user clicking off or tabbing out of
|
|
81
|
+
* the menu or menubar.
|
|
82
|
+
*/
|
|
83
|
+
const handleOnBlur = event => {
|
|
84
|
+
// Close the menu on blur when the related target is not a sibling menu item
|
|
85
|
+
// or a child in a submenu
|
|
86
|
+
const siblingItemBlurredTo = itemRefs.current.find(element => element === event.relatedTarget);
|
|
87
|
+
const childItemBlurredTo = subMenusRef.current?.contains(event.relatedTarget);
|
|
88
|
+
if (!siblingItemBlurredTo && !childItemBlurredTo) {
|
|
89
|
+
setExpanded(false);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Handles individual menuitem refs. We assign them to a class instance
|
|
95
|
+
* property so that we can properly manage focus of our children.
|
|
96
|
+
*/
|
|
97
|
+
const handleItemRef = index => node => {
|
|
98
|
+
itemRefs.current[index] = node;
|
|
99
|
+
};
|
|
100
|
+
const handleMenuClose = event => {
|
|
101
|
+
// Handle ESC keydown for closing the expanded menu.
|
|
102
|
+
if (match.matches(event, [keys.Escape]) && expanded) {
|
|
103
|
+
event.stopPropagation();
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
setExpanded(false);
|
|
106
|
+
|
|
107
|
+
// Return focus to menu button when the user hits ESC.
|
|
108
|
+
if (menuButtonRef.current) {
|
|
109
|
+
menuButtonRef.current.focus();
|
|
141
110
|
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
selectedIndex: null
|
|
149
|
-
};
|
|
150
|
-
this.items = [];
|
|
151
|
-
}
|
|
152
|
-
render() {
|
|
153
|
-
const prefix = this.context;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const hasActiveDescendant = childrenArg => React.Children.toArray(childrenArg).some(child => {
|
|
114
|
+
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
154
117
|
const {
|
|
155
118
|
isActive,
|
|
156
119
|
isCurrentPage,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
renderMenuContent: MenuContent,
|
|
162
|
-
menuLinkName,
|
|
163
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
164
|
-
focusRef,
|
|
165
|
-
onBlur,
|
|
166
|
-
onClick,
|
|
167
|
-
onKeyDown,
|
|
168
|
-
...rest
|
|
169
|
-
} = this.props;
|
|
170
|
-
const hasActiveDescendant = childrenArg => React__default["default"].Children.toArray(childrenArg).some(child => {
|
|
171
|
-
if (! /*#__PURE__*/React__default["default"].isValidElement(child)) {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
120
|
+
children
|
|
121
|
+
} = child.props;
|
|
122
|
+
return isActive || isCurrentPage || Array.isArray(children) && hasActiveDescendant(children);
|
|
123
|
+
});
|
|
174
124
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
125
|
+
/**
|
|
126
|
+
* We capture the `ref` for each child inside of `this.items` to properly
|
|
127
|
+
* manage focus. In addition to this focus management, all items receive a
|
|
128
|
+
* `tabIndex: -1` so the user won't hit a large number of items in their tab
|
|
129
|
+
* sequence when they might not want to go through all the items.
|
|
130
|
+
*/
|
|
131
|
+
const renderMenuItem = (item, index) => {
|
|
132
|
+
if (/*#__PURE__*/React.isValidElement(item)) {
|
|
133
|
+
return /*#__PURE__*/React.cloneElement(item, {
|
|
134
|
+
ref: handleItemRef(index)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return item;
|
|
138
|
+
};
|
|
139
|
+
const accessibilityLabel = {
|
|
140
|
+
'aria-label': ariaLabel,
|
|
141
|
+
'aria-labelledby': ariaLabelledBy
|
|
142
|
+
};
|
|
143
|
+
const itemClassName = cx__default["default"]({
|
|
144
|
+
[`${prefix}--header__submenu`]: true,
|
|
145
|
+
[`${customClassName}`]: !!customClassName
|
|
146
|
+
});
|
|
147
|
+
const isActivePage = isActive ? isActive : isCurrentPage;
|
|
148
|
+
const linkClassName = cx__default["default"]({
|
|
149
|
+
[`${prefix}--header__menu-item`]: true,
|
|
150
|
+
[`${prefix}--header__menu-title`]: true,
|
|
151
|
+
// We set the current class only if `isActive` is passed in and we do
|
|
152
|
+
// not have an `aria-current="page"` set for the breadcrumb item
|
|
153
|
+
[`${prefix}--header__menu-item--current`]: isActivePage || hasActiveDescendant(children) && !expanded
|
|
154
|
+
});
|
|
195
155
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
156
|
+
// Notes on eslint comments and based on the examples in:
|
|
157
|
+
// https://www.w3.org/TR/wai-aria-practices/examples/menubar/menubar-1/menubar-1.html#
|
|
158
|
+
// - The focus is handled by the <a> menuitem, onMouseOver is for mouse
|
|
159
|
+
// users
|
|
160
|
+
// - aria-haspopup can definitely have the value "menu"
|
|
161
|
+
// - aria-expanded is on their example node with role="menuitem"
|
|
162
|
+
// - href can be set to javascript:void(0), ideally this will be a button
|
|
163
|
+
return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
164
|
+
className: itemClassName,
|
|
165
|
+
onKeyDown: events.composeEventHandlers([onKeyDown, handleMenuClose]),
|
|
166
|
+
onClick: events.composeEventHandlers([onClick, handleOnClick]),
|
|
167
|
+
onBlur: events.composeEventHandlers([onBlur, handleOnBlur]),
|
|
168
|
+
ref: ref
|
|
169
|
+
}), /*#__PURE__*/React__default["default"].createElement("a", _rollupPluginBabelHelpers["extends"]({
|
|
170
|
+
// eslint-disable-line jsx-a11y/role-supports-aria-props,jsx-a11y/anchor-is-valid
|
|
171
|
+
"aria-haspopup": "menu" // eslint-disable-line jsx-a11y/aria-proptypes
|
|
172
|
+
,
|
|
173
|
+
"aria-expanded": expanded,
|
|
174
|
+
className: linkClassName,
|
|
175
|
+
href: "#",
|
|
176
|
+
onKeyDown: handleOnKeyDown,
|
|
177
|
+
ref: mergedButtonRef,
|
|
178
|
+
tabIndex: 0
|
|
179
|
+
}, accessibilityLabel), menuLinkName, MenuContent ? /*#__PURE__*/React__default["default"].createElement(MenuContent, null) : /*#__PURE__*/React__default["default"].createElement(iconsReact.ChevronDown, {
|
|
180
|
+
className: `${prefix}--header__menu-arrow`
|
|
181
|
+
})), /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({}, accessibilityLabel, {
|
|
182
|
+
ref: subMenusRef,
|
|
183
|
+
className: `${prefix}--header__menu`
|
|
184
|
+
}), React.Children.map(children, renderMenuItem)));
|
|
185
|
+
});
|
|
186
|
+
HeaderMenu.displayName = 'HeaderMenu';
|
|
187
|
+
HeaderMenu.propTypes = {
|
|
228
188
|
/**
|
|
229
189
|
* Required props for the accessibility label of the menu
|
|
230
190
|
*/
|
|
@@ -273,14 +233,7 @@ _rollupPluginBabelHelpers.defineProperty(HeaderMenu, "propTypes", {
|
|
|
273
233
|
* Optionally provide a tabIndex for the underlying menu button
|
|
274
234
|
*/
|
|
275
235
|
tabIndex: PropTypes__default["default"].number
|
|
276
|
-
}
|
|
277
|
-
_rollupPluginBabelHelpers.defineProperty(HeaderMenu, "contextType", usePrefix.PrefixContext);
|
|
278
|
-
const HeaderMenuForwardRef = /*#__PURE__*/React__default["default"].forwardRef((props, ref) => {
|
|
279
|
-
return /*#__PURE__*/React__default["default"].createElement(HeaderMenu, _rollupPluginBabelHelpers["extends"]({}, props, {
|
|
280
|
-
focusRef: ref
|
|
281
|
-
}));
|
|
282
|
-
});
|
|
283
|
-
HeaderMenuForwardRef.displayName = 'HeaderMenu';
|
|
236
|
+
};
|
|
284
237
|
|
|
285
238
|
exports.HeaderMenu = HeaderMenu;
|
|
286
|
-
exports["default"] =
|
|
239
|
+
exports["default"] = HeaderMenu;
|
|
@@ -24,17 +24,16 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
24
24
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
25
25
|
|
|
26
26
|
var _Menu, _Close;
|
|
27
|
-
function HeaderMenuButton(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _ref;
|
|
27
|
+
function HeaderMenuButton({
|
|
28
|
+
'aria-label': ariaLabel,
|
|
29
|
+
'aria-labelledby': ariaLabelledBy,
|
|
30
|
+
className: customClassName,
|
|
31
|
+
renderMenuIcon,
|
|
32
|
+
renderCloseIcon,
|
|
33
|
+
isActive,
|
|
34
|
+
isCollapsible,
|
|
35
|
+
...rest
|
|
36
|
+
}) {
|
|
38
37
|
const prefix = usePrefix.usePrefix();
|
|
39
38
|
const className = cx__default["default"]({
|
|
40
39
|
...(typeof customClassName === 'string' && {
|
|
@@ -23,17 +23,16 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
23
23
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
24
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
25
25
|
|
|
26
|
-
const HeaderMenuItem = /*#__PURE__*/React.forwardRef(function HeaderMenuItem(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} = _ref;
|
|
26
|
+
const HeaderMenuItem = /*#__PURE__*/React.forwardRef(function HeaderMenuItem({
|
|
27
|
+
className,
|
|
28
|
+
isActive,
|
|
29
|
+
isCurrentPage,
|
|
30
|
+
'aria-current': ariaCurrent,
|
|
31
|
+
children,
|
|
32
|
+
role,
|
|
33
|
+
tabIndex,
|
|
34
|
+
...rest
|
|
35
|
+
}, ref) {
|
|
37
36
|
const prefix = usePrefix.usePrefix();
|
|
38
37
|
if (isCurrentPage) {
|
|
39
38
|
isActive = isCurrentPage;
|
|
@@ -22,13 +22,12 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
24
24
|
|
|
25
|
-
function HeaderName(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _ref;
|
|
25
|
+
function HeaderName({
|
|
26
|
+
children,
|
|
27
|
+
className: customClassName,
|
|
28
|
+
prefix = 'IBM',
|
|
29
|
+
...rest
|
|
30
|
+
}) {
|
|
32
31
|
const selectorPrefix = usePrefix.usePrefix();
|
|
33
32
|
const className = cx__default["default"](`${selectorPrefix}--header__name`, customClassName);
|
|
34
33
|
return /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
@@ -22,14 +22,13 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
24
24
|
|
|
25
|
-
function HeaderNavigation(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} = _ref;
|
|
25
|
+
function HeaderNavigation({
|
|
26
|
+
'aria-label': ariaLabel,
|
|
27
|
+
'aria-labelledby': ariaLabelledBy,
|
|
28
|
+
children,
|
|
29
|
+
className: customClassName,
|
|
30
|
+
...rest
|
|
31
|
+
}) {
|
|
33
32
|
const prefix = usePrefix.usePrefix();
|
|
34
33
|
const className = cx__default["default"](`${prefix}--header__nav`, customClassName);
|
|
35
34
|
return /*#__PURE__*/React__default["default"].createElement("nav", _rollupPluginBabelHelpers["extends"]({}, rest, {
|