@carbon/react 1.83.0-rc.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 +895 -790
- package/README.md +1 -1
- package/es/components/AILabel/index.js +37 -40
- package/es/components/AISkeleton/AISkeletonIcon.js +6 -7
- package/es/components/AISkeleton/AISkeletonPlaceholder.js +6 -7
- package/es/components/AISkeleton/AISkeletonText.js +6 -7
- package/es/components/Accordion/Accordion.Skeleton.js +24 -25
- package/es/components/Accordion/Accordion.js +13 -14
- package/es/components/Accordion/AccordionItem.js +22 -23
- package/es/components/Accordion/AccordionProvider.js +6 -7
- package/es/components/AspectRatio/AspectRatio.js +9 -10
- package/es/components/BadgeIndicator/index.js +7 -8
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +9 -10
- package/es/components/Breadcrumb/Breadcrumb.js +3 -3
- package/es/components/Breadcrumb/BreadcrumbItem.js +9 -9
- package/es/components/Button/Button.Skeleton.js +10 -11
- package/es/components/Button/Button.js +5 -5
- package/es/components/Button/ButtonBase.js +27 -28
- package/es/components/ButtonSet/ButtonSet.js +2 -2
- package/es/components/ChatButton/ChatButton.Skeleton.js +7 -8
- package/es/components/ChatButton/ChatButton.js +13 -14
- package/es/components/Checkbox/Checkbox.Skeleton.js +8 -9
- package/es/components/Checkbox/Checkbox.js +33 -34
- package/es/components/CheckboxGroup/CheckboxGroup.js +28 -29
- package/es/components/ClassPrefix/index.js +6 -7
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +12 -13
- package/es/components/CodeSnippet/CodeSnippet.js +41 -42
- package/es/components/ComboBox/ComboBox.js +42 -48
- package/es/components/ComboBox/tools/filter.js +9 -12
- package/es/components/ComboButton/index.js +22 -24
- package/es/components/ComposedModal/ComposedModal.js +49 -52
- package/es/components/ComposedModal/ModalFooter.js +42 -47
- package/es/components/ComposedModal/ModalHeader.js +21 -22
- package/es/components/ContainedList/ContainedList.js +17 -18
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +16 -17
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +17 -29
- package/es/components/ContentSwitcher/ContentSwitcher.js +100 -126
- package/es/components/ContentSwitcher/index.d.ts +3 -4
- package/es/components/ContextMenu/useContextMenu.js +1 -2
- package/es/components/Copy/Copy.js +13 -14
- package/es/components/CopyButton/CopyButton.js +14 -15
- package/es/components/DangerButton/DangerButton.js +2 -2
- package/es/components/DataTable/DataTable.d.ts +81 -283
- package/es/components/DataTable/DataTable.js +124 -172
- package/es/components/DataTable/Table.d.ts +2 -2
- package/es/components/DataTable/Table.js +19 -22
- package/es/components/DataTable/TableActionList.d.ts +1 -1
- package/es/components/DataTable/TableBatchAction.js +9 -12
- package/es/components/DataTable/TableBatchActions.js +27 -29
- package/es/components/DataTable/TableBody.d.ts +3 -3
- package/es/components/DataTable/TableBody.js +9 -12
- package/es/components/DataTable/TableCell.d.ts +3 -4
- package/es/components/DataTable/TableCell.js +2 -2
- package/es/components/DataTable/TableContainer.d.ts +2 -3
- package/es/components/DataTable/TableContainer.js +15 -16
- package/es/components/DataTable/TableDecoratorRow.js +8 -9
- package/es/components/DataTable/TableExpandHeader.d.ts +2 -3
- package/es/components/DataTable/TableExpandHeader.js +18 -19
- package/es/components/DataTable/TableExpandRow.js +20 -21
- package/es/components/DataTable/TableExpandedRow.d.ts +3 -3
- package/es/components/DataTable/TableExpandedRow.js +10 -11
- package/es/components/DataTable/TableHead.d.ts +1 -1
- package/es/components/DataTable/TableHeader.d.ts +4 -4
- package/es/components/DataTable/TableHeader.js +29 -30
- package/es/components/DataTable/TableRow.d.ts +3 -4
- package/es/components/DataTable/TableRow.js +4 -4
- package/es/components/DataTable/TableSelectAll.js +14 -15
- package/es/components/DataTable/TableSelectRow.js +16 -17
- package/es/components/DataTable/TableSlugRow.js +7 -8
- package/es/components/DataTable/TableToolbar.js +9 -10
- package/es/components/DataTable/TableToolbarAction.js +2 -2
- package/es/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +10 -11
- package/es/components/DataTable/TableToolbarSearch.js +24 -26
- package/es/components/DataTable/index.d.ts +1 -1
- 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 +26 -27
- package/es/components/DatePicker/DatePicker.Skeleton.js +15 -16
- package/es/components/DatePicker/DatePicker.js +104 -81
- package/es/components/DatePickerInput/DatePickerInput.d.ts +3 -4
- package/es/components/DatePickerInput/DatePickerInput.js +24 -25
- package/es/components/Dialog/index.d.ts +194 -10
- package/es/components/Dialog/index.js +458 -39
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -3
- package/es/components/Dropdown/Dropdown.Skeleton.js +10 -11
- package/es/components/Dropdown/Dropdown.d.ts +3 -3
- package/es/components/Dropdown/Dropdown.js +57 -60
- package/es/components/ErrorBoundary/ErrorBoundary.js +4 -4
- package/es/components/ExpandableSearch/ExpandableSearch.js +11 -12
- package/es/components/FeatureFlags/index.js +13 -14
- package/es/components/FileUploader/FileUploader.Skeleton.d.ts +3 -3
- package/es/components/FileUploader/FileUploader.Skeleton.js +9 -10
- package/es/components/FileUploader/FileUploader.d.ts +2 -3
- package/es/components/FileUploader/FileUploader.js +33 -35
- package/es/components/FileUploader/FileUploaderButton.d.ts +2 -3
- package/es/components/FileUploader/FileUploaderButton.js +20 -21
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +2 -3
- package/es/components/FileUploader/FileUploaderDropContainer.js +20 -21
- package/es/components/FileUploader/FileUploaderItem.d.ts +2 -3
- package/es/components/FileUploader/FileUploaderItem.js +26 -27
- package/es/components/FileUploader/Filename.d.ts +3 -4
- package/es/components/FileUploader/Filename.js +16 -17
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +9 -10
- package/es/components/FluidComboBox/FluidComboBox.js +8 -9
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +16 -17
- package/es/components/FluidDatePicker/FluidDatePicker.js +13 -14
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +9 -10
- package/es/components/FluidDropdown/FluidDropdown.js +8 -9
- package/es/components/FluidForm/FluidForm.d.ts +3 -4
- package/es/components/FluidForm/FluidForm.js +8 -9
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +9 -10
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +10 -11
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +9 -10
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/es/components/FluidNumberInput/FluidNumberInput.js +41 -8
- package/es/components/FluidSearch/FluidSearch.Skeleton.js +9 -10
- package/es/components/FluidSearch/FluidSearch.js +7 -8
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +9 -10
- package/es/components/FluidSelect/FluidSelect.js +8 -9
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +9 -10
- package/es/components/FluidTextArea/FluidTextArea.js +7 -8
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +9 -10
- package/es/components/FluidTextInput/FluidTextInput.js +9 -10
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +8 -9
- package/es/components/FluidTimePicker/FluidTimePicker.js +23 -24
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +7 -8
- package/es/components/Form/Form.js +7 -8
- package/es/components/FormGroup/FormGroup.d.ts +3 -4
- package/es/components/FormGroup/FormGroup.js +15 -16
- package/es/components/FormItem/FormItem.js +7 -8
- package/es/components/FormLabel/FormLabel.js +8 -9
- package/es/components/Grid/CSSGrid.js +23 -25
- package/es/components/Grid/Column.js +32 -31
- package/es/components/Grid/ColumnHang.js +8 -9
- package/es/components/Grid/FlexGrid.js +12 -13
- package/es/components/Grid/Grid.js +3 -3
- package/es/components/Grid/GridContext.d.ts +2 -2
- package/es/components/Grid/GridContext.js +6 -7
- package/es/components/Grid/Row.js +10 -11
- package/es/components/Heading/index.js +13 -14
- package/es/components/Icon/Icon.Skeleton.js +6 -7
- package/es/components/IconButton/index.js +30 -26
- package/es/components/IconIndicator/index.js +10 -11
- package/es/components/IdPrefix/index.js +6 -7
- package/es/components/InlineCheckbox/InlineCheckbox.js +6 -6
- package/es/components/InlineLoading/InlineLoading.js +19 -20
- package/es/components/Layer/LayerContext.js +2 -2
- package/es/components/Layer/index.d.ts +4 -0
- package/es/components/Layer/index.js +21 -15
- package/es/components/Layout/index.js +24 -29
- package/es/components/LayoutDirection/LayoutDirection.js +10 -11
- package/es/components/LayoutDirection/LayoutDirectionContext.js +2 -2
- package/es/components/Link/Link.d.ts +1 -1
- package/es/components/Link/Link.js +19 -20
- package/es/components/ListBox/ListBox.d.ts +2 -3
- package/es/components/ListBox/ListBox.js +5 -5
- package/es/components/ListBox/ListBoxField.d.ts +3 -4
- package/es/components/ListBox/ListBoxField.js +8 -9
- package/es/components/ListBox/ListBoxMenu.d.ts +2 -3
- package/es/components/ListBox/ListBoxMenu.js +7 -8
- package/es/components/ListBox/ListBoxMenuIcon.js +8 -9
- package/es/components/ListBox/ListBoxMenuItem.d.ts +2 -3
- package/es/components/ListBox/ListBoxMenuItem.js +11 -13
- package/es/components/ListBox/ListBoxSelection.js +14 -15
- package/es/components/ListBox/next/ListBoxSelection.js +16 -17
- package/es/components/ListBox/next/ListBoxTrigger.js +8 -9
- package/es/components/ListItem/ListItem.js +7 -8
- package/es/components/Loading/Loading.d.ts +3 -3
- package/es/components/Loading/Loading.js +14 -15
- package/es/components/Menu/Menu.js +26 -27
- package/es/components/Menu/MenuItem.js +55 -60
- package/es/components/MenuButton/index.js +20 -22
- package/es/components/Modal/Modal.d.ts +2 -3
- package/es/components/Modal/Modal.js +85 -93
- package/es/components/ModalWrapper/ModalWrapper.js +9 -9
- package/es/components/MultiSelect/FilterableMultiSelect.js +68 -74
- package/es/components/MultiSelect/MultiSelect.js +65 -67
- package/es/components/MultiSelect/tools/sorting.js +11 -15
- package/es/components/Notification/Notification.js +137 -146
- package/es/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/es/components/NumberInput/NumberFormatPropTypes.js +40 -0
- package/es/components/NumberInput/NumberInput.Skeleton.js +10 -11
- package/es/components/NumberInput/NumberInput.d.ts +39 -3
- package/es/components/NumberInput/NumberInput.js +195 -65
- package/es/components/OrderedList/OrderedList.js +9 -10
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +42 -48
- package/es/components/OverflowMenu/index.js +3 -3
- package/es/components/OverflowMenu/next/index.js +17 -18
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +4 -4
- package/es/components/OverflowMenuV2/index.js +3 -3
- package/es/components/PageHeader/PageHeader.d.ts +29 -5
- package/es/components/PageHeader/PageHeader.js +136 -90
- package/es/components/Pagination/Pagination.Skeleton.js +12 -13
- package/es/components/Pagination/Pagination.js +40 -41
- package/es/components/Pagination/experimental/PageSelector.js +11 -12
- package/es/components/Pagination/experimental/Pagination.js +34 -35
- package/es/components/PaginationNav/PaginationNav.js +63 -68
- package/es/components/Popover/index.js +40 -42
- package/es/components/PrimaryButton/PrimaryButton.js +2 -2
- package/es/components/ProgressBar/ProgressBar.js +24 -25
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +12 -13
- package/es/components/ProgressIndicator/ProgressIndicator.js +49 -52
- package/es/components/RadioButton/RadioButton.Skeleton.js +4 -4
- package/es/components/RadioButton/RadioButton.js +10 -10
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +16 -16
- package/es/components/RadioTile/RadioTile.js +28 -29
- package/es/components/Search/Search.Skeleton.js +9 -10
- package/es/components/Search/Search.js +36 -38
- package/es/components/SecondaryButton/SecondaryButton.js +2 -2
- package/es/components/Select/Select.Skeleton.js +10 -11
- package/es/components/Select/Select.js +42 -43
- package/es/components/SelectItem/SelectItem.js +10 -11
- package/es/components/SelectItemGroup/SelectItemGroup.js +9 -10
- package/es/components/ShapeIndicator/index.js +13 -14
- package/es/components/SkeletonIcon/SkeletonIcon.d.ts +0 -4
- package/es/components/SkeletonIcon/SkeletonIcon.js +7 -12
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +6 -7
- package/es/components/SkeletonText/SkeletonText.js +12 -13
- package/es/components/Slider/Slider.Skeleton.js +25 -26
- package/es/components/Slider/Slider.js +99 -113
- package/es/components/Slider/SliderHandles.js +20 -20
- package/es/components/Stack/HStack.js +2 -2
- package/es/components/Stack/Stack.js +2 -2
- package/es/components/Stack/VStack.js +2 -2
- package/es/components/StructuredList/StructuredList.Skeleton.js +17 -18
- package/es/components/StructuredList/StructuredList.js +24 -24
- package/es/components/Switch/IconSwitch.js +3 -3
- package/es/components/Switch/Switch.js +4 -4
- package/es/components/TabContent/TabContent.js +2 -2
- package/es/components/Tabs/Tabs.Skeleton.js +12 -13
- package/es/components/Tabs/Tabs.js +141 -156
- package/es/components/Tabs/usePressable.js +7 -8
- package/es/components/Tag/DismissibleTag.js +26 -27
- package/es/components/Tag/OperationalTag.js +16 -17
- package/es/components/Tag/SelectableTag.js +19 -20
- package/es/components/Tag/Tag.Skeleton.js +7 -8
- package/es/components/Tag/Tag.js +33 -34
- package/es/components/Text/Text.js +9 -10
- package/es/components/Text/TextDirection.js +7 -8
- package/es/components/Text/createTextComponent.js +2 -2
- package/es/components/TextArea/TextArea.Skeleton.js +4 -4
- package/es/components/TextArea/TextArea.js +22 -22
- package/es/components/TextInput/ControlledPasswordInput.d.ts +2 -3
- package/es/components/TextInput/ControlledPasswordInput.js +36 -37
- package/es/components/TextInput/PasswordInput.js +40 -41
- package/es/components/TextInput/TextInput.Skeleton.js +9 -10
- package/es/components/TextInput/TextInput.js +43 -44
- package/es/components/TextInput/util.js +14 -17
- package/es/components/Theme/index.js +19 -21
- package/es/components/Tile/Tile.js +98 -104
- package/es/components/TileGroup/TileGroup.d.ts +3 -4
- package/es/components/TileGroup/TileGroup.js +8 -8
- package/es/components/TimePicker/TimePicker.d.ts +2 -3
- package/es/components/TimePicker/TimePicker.js +14 -14
- package/es/components/TimePickerSelect/TimePickerSelect.js +4 -4
- package/es/components/Toggle/Toggle.Skeleton.js +8 -9
- package/es/components/Toggle/Toggle.js +27 -28
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +14 -15
- package/es/components/Toggletip/index.js +43 -49
- package/es/components/Tooltip/DefinitionTooltip.js +17 -18
- package/es/components/Tooltip/Tooltip.d.ts +3 -0
- package/es/components/Tooltip/Tooltip.js +39 -28
- package/es/components/TreeView/TreeNode.js +64 -56
- package/es/components/TreeView/TreeView.js +44 -37
- package/es/components/UIShell/Content.js +8 -9
- package/es/components/UIShell/Header.js +7 -8
- package/es/components/UIShell/HeaderContainer.js +7 -8
- package/es/components/UIShell/HeaderGlobalAction.js +14 -15
- package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/es/components/UIShell/HeaderMenu.d.ts +10 -112
- package/es/components/UIShell/HeaderMenu.js +154 -201
- package/es/components/UIShell/HeaderMenuButton.js +14 -15
- package/es/components/UIShell/HeaderMenuItem.js +21 -20
- package/es/components/UIShell/HeaderName.js +9 -10
- package/es/components/UIShell/HeaderNavigation.js +10 -11
- package/es/components/UIShell/HeaderPanel.js +11 -12
- package/es/components/UIShell/HeaderSideNavItems.js +7 -8
- package/es/components/UIShell/Link.js +11 -12
- package/es/components/UIShell/SideNav.js +30 -32
- package/es/components/UIShell/SideNavDetails.js +9 -10
- package/es/components/UIShell/SideNavDivider.js +6 -7
- package/es/components/UIShell/SideNavFooter.js +13 -14
- package/es/components/UIShell/SideNavHeader.js +8 -9
- package/es/components/UIShell/SideNavIcon.js +7 -8
- package/es/components/UIShell/SideNavItem.js +7 -8
- package/es/components/UIShell/SideNavItems.js +10 -11
- package/es/components/UIShell/SideNavLink.js +15 -16
- package/es/components/UIShell/SideNavLinkText.js +7 -8
- package/es/components/UIShell/SideNavMenu.js +20 -21
- package/es/components/UIShell/SideNavMenuItem.js +5 -5
- package/es/components/UIShell/SideNavSwitcher.js +8 -8
- package/es/components/UIShell/SkipToContent.js +9 -10
- package/es/components/UIShell/Switcher.js +12 -13
- package/es/components/UIShell/SwitcherDivider.js +6 -7
- package/es/components/UIShell/SwitcherItem.js +3 -3
- package/es/components/UnorderedList/UnorderedList.js +8 -9
- package/es/index.js +25 -26
- package/es/internal/FloatingMenu.js +30 -32
- package/es/internal/Selection.js +15 -17
- package/{lib/feature-flags.d.ts → es/internal/__mocks__/mockHTMLElement.d.ts} +4 -2
- package/es/internal/createClassWrapper.js +2 -2
- 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 +4 -6
- package/es/internal/useIdPrefix.js +3 -3
- 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 +12 -13
- package/es/internal/usePrefix.js +3 -3
- package/es/internal/useResizeObserver.d.ts +14 -0
- package/es/internal/useResizeObserver.js +73 -0
- package/es/internal/useSavedCallback.js +1 -3
- package/es/internal/wrapFocus.js +23 -35
- 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.d.ts +3 -4
- package/es/tools/wrapComponent.js +11 -13
- package/es/types/common.d.ts +0 -2
- 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 +27 -29
- 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 +17 -29
- package/lib/components/ContentSwitcher/ContentSwitcher.js +98 -124
- 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.d.ts +81 -283
- package/lib/components/DataTable/DataTable.js +123 -172
- package/lib/components/DataTable/Table.d.ts +2 -2
- package/lib/components/DataTable/Table.js +15 -18
- package/lib/components/DataTable/TableActionList.d.ts +1 -1
- package/lib/components/DataTable/TableBatchAction.js +8 -11
- package/lib/components/DataTable/TableBatchActions.js +18 -20
- package/lib/components/DataTable/TableBody.d.ts +3 -3
- package/lib/components/DataTable/TableBody.js +8 -11
- package/lib/components/DataTable/TableCell.d.ts +3 -4
- package/lib/components/DataTable/TableContainer.d.ts +2 -3
- package/lib/components/DataTable/TableContainer.js +9 -10
- package/lib/components/DataTable/TableDecoratorRow.js +4 -5
- package/lib/components/DataTable/TableExpandHeader.d.ts +2 -3
- package/lib/components/DataTable/TableExpandHeader.js +14 -15
- package/lib/components/DataTable/TableExpandRow.js +13 -14
- package/lib/components/DataTable/TableExpandedRow.d.ts +3 -3
- package/lib/components/DataTable/TableExpandedRow.js +6 -7
- package/lib/components/DataTable/TableHead.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +4 -4
- package/lib/components/DataTable/TableHeader.js +15 -16
- package/lib/components/DataTable/TableRow.d.ts +3 -4
- 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/TableToolbarContent.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +8 -9
- package/lib/components/DataTable/TableToolbarSearch.js +22 -24
- package/lib/components/DataTable/index.d.ts +1 -1
- 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.d.ts +3 -4
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -6
- package/lib/components/Dialog/index.d.ts +194 -10
- package/lib/components/Dialog/index.js +457 -33
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -3
- package/lib/components/Dropdown/Dropdown.Skeleton.js +6 -7
- package/lib/components/Dropdown/Dropdown.d.ts +3 -3
- 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.d.ts +3 -3
- package/lib/components/FileUploader/FileUploader.Skeleton.js +4 -5
- package/lib/components/FileUploader/FileUploader.d.ts +2 -3
- package/lib/components/FileUploader/FileUploader.js +22 -24
- package/lib/components/FileUploader/FileUploaderButton.d.ts +2 -3
- package/lib/components/FileUploader/FileUploaderButton.js +16 -17
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +2 -3
- package/lib/components/FileUploader/FileUploaderDropContainer.js +15 -16
- package/lib/components/FileUploader/FileUploaderItem.d.ts +2 -3
- package/lib/components/FileUploader/FileUploaderItem.js +13 -14
- package/lib/components/FileUploader/Filename.d.ts +3 -4
- 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.d.ts +3 -4
- 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.d.ts +3 -4
- 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.d.ts +2 -2
- package/lib/components/Grid/GridContext.js +10 -29
- 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 +26 -22
- 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.d.ts +4 -0
- package/lib/components/Layer/index.js +16 -10
- 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 +15 -16
- package/lib/components/ListBox/ListBox.d.ts +2 -3
- package/lib/components/ListBox/ListBoxField.d.ts +3 -4
- package/lib/components/ListBox/ListBoxField.js +6 -7
- package/lib/components/ListBox/ListBoxMenu.d.ts +2 -3
- package/lib/components/ListBox/ListBoxMenu.js +5 -6
- package/lib/components/ListBox/ListBoxMenuIcon.js +4 -5
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +2 -3
- 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.d.ts +3 -3
- 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.d.ts +2 -3
- package/lib/components/Modal/Modal.js +55 -63
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +46 -52
- 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.d.ts +0 -4
- package/lib/components/SkeletonIcon/SkeletonIcon.js +5 -10
- 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.d.ts +2 -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/TileGroup/TileGroup.d.ts +3 -4
- package/lib/components/TimePicker/TimePicker.d.ts +2 -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.d.ts +3 -0
- package/lib/components/Tooltip/Tooltip.js +33 -22
- package/lib/components/TreeView/TreeNode.js +40 -32
- package/lib/components/TreeView/TreeView.js +41 -34
- 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/HeaderGlobalBar.d.ts +1 -1
- 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 +17 -16
- 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 +81 -82
- package/lib/internal/FloatingMenu.js +26 -28
- package/lib/internal/Selection.js +15 -17
- package/{es/feature-flags.d.ts → lib/internal/__mocks__/mockHTMLElement.d.ts} +4 -2
- 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.d.ts +14 -0
- package/lib/internal/useResizeObserver.js +77 -0
- package/lib/internal/useSavedCallback.js +1 -3
- package/lib/internal/wrapFocus.js +23 -35
- 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.d.ts +3 -4
- package/lib/tools/wrapComponent.js +9 -11
- package/lib/types/common.d.ts +0 -2
- package/package.json +21 -20
- package/scss/components/content-switcher/_tokens.scss +9 -0
- package/telemetry.yml +27 -2
- package/es/components/ContentSwitcher/index.js +0 -13
- package/es/components/DataTable/index.js +0 -76
- package/es/internal/useAnnouncer.js +0 -21
- package/lib/components/ContentSwitcher/index.js +0 -18
- package/lib/components/DataTable/index.js +0 -82
- package/lib/internal/useAnnouncer.js +0 -25
|
@@ -7,21 +7,20 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
|
-
import
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
function SkipToContent(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
14
|
+
function SkipToContent({
|
|
15
|
+
children = 'Skip to main content',
|
|
16
|
+
className: customClassName,
|
|
17
|
+
href = '#main-content',
|
|
18
|
+
tabIndex = 0,
|
|
19
|
+
...rest
|
|
20
|
+
}) {
|
|
22
21
|
const prefix = usePrefix();
|
|
23
22
|
const className = cx(`${prefix}--skip-to-content`, customClassName);
|
|
24
|
-
return /*#__PURE__*/
|
|
23
|
+
return /*#__PURE__*/React.createElement("a", _extends({}, rest, {
|
|
25
24
|
className: className,
|
|
26
25
|
href: href,
|
|
27
26
|
tabIndex: tabIndex
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import
|
|
9
|
+
import React, { forwardRef, useRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
12
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
@@ -32,13 +32,12 @@ const Switcher = /*#__PURE__*/forwardRef(function Switcher(props, forwardRef) {
|
|
|
32
32
|
const className = cx(`${prefix}--switcher`, {
|
|
33
33
|
[customClassName || '']: !!customClassName
|
|
34
34
|
});
|
|
35
|
-
const handleSwitcherItemFocus =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (/*#__PURE__*/React__default.isValidElement(curr) && Object.keys(curr.props).length !== 0 && curr.type === SwitcherItem) {
|
|
35
|
+
const handleSwitcherItemFocus = ({
|
|
36
|
+
currentIndex,
|
|
37
|
+
direction
|
|
38
|
+
}) => {
|
|
39
|
+
const enabledIndices = React.Children.toArray(children).reduce((acc, curr, i) => {
|
|
40
|
+
if (/*#__PURE__*/React.isValidElement(curr) && Object.keys(curr.props).length !== 0 && curr.type === SwitcherItem) {
|
|
42
41
|
acc.push(i);
|
|
43
42
|
}
|
|
44
43
|
return acc;
|
|
@@ -64,23 +63,23 @@ const Switcher = /*#__PURE__*/forwardRef(function Switcher(props, forwardRef) {
|
|
|
64
63
|
switcherItem.focus();
|
|
65
64
|
}
|
|
66
65
|
};
|
|
67
|
-
const childrenWithProps =
|
|
66
|
+
const childrenWithProps = React.Children.toArray(children).map((child, index) => {
|
|
68
67
|
// only setup click handlers if onChange event is passed
|
|
69
|
-
if (/*#__PURE__*/
|
|
70
|
-
return /*#__PURE__*/
|
|
68
|
+
if (/*#__PURE__*/React.isValidElement(child) && child.type === SwitcherItem) {
|
|
69
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
71
70
|
handleSwitcherItemFocus,
|
|
72
71
|
index,
|
|
73
72
|
key: index,
|
|
74
73
|
expanded
|
|
75
74
|
});
|
|
76
75
|
}
|
|
77
|
-
return /*#__PURE__*/
|
|
76
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
78
77
|
index,
|
|
79
78
|
key: index,
|
|
80
79
|
expanded
|
|
81
80
|
});
|
|
82
81
|
});
|
|
83
|
-
return /*#__PURE__*/
|
|
82
|
+
return /*#__PURE__*/React.createElement("ul", _extends({
|
|
84
83
|
ref: ref,
|
|
85
84
|
className: className
|
|
86
85
|
}, accessibilityLabel), childrenWithProps);
|
|
@@ -6,21 +6,20 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import
|
|
9
|
+
import React from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
const SwitcherDivider =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
14
|
+
const SwitcherDivider = ({
|
|
15
|
+
className: customClassName,
|
|
16
|
+
...other
|
|
17
|
+
}) => {
|
|
19
18
|
const prefix = usePrefix();
|
|
20
19
|
const classNames = cx(`${prefix}--switcher__item--divider`, {
|
|
21
20
|
[customClassName || '']: !!customClassName
|
|
22
21
|
});
|
|
23
|
-
return /*#__PURE__*/
|
|
22
|
+
return /*#__PURE__*/React.createElement("hr", _extends({}, other, {
|
|
24
23
|
className: classNames
|
|
25
24
|
}));
|
|
26
25
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import
|
|
9
|
+
import React, { forwardRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import Link from './Link.js';
|
|
@@ -59,9 +59,9 @@ const SwitcherItem = /*#__PURE__*/forwardRef(function SwitcherItem(props, forwar
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
return /*#__PURE__*/
|
|
62
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
63
63
|
className: classNames
|
|
64
|
-
}, /*#__PURE__*/
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Link, _extends({
|
|
65
65
|
onKeyDown: evt => {
|
|
66
66
|
setTabFocus(evt);
|
|
67
67
|
onKeyDown(evt);
|
|
@@ -7,23 +7,22 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
function UnorderedList(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
14
|
+
function UnorderedList({
|
|
15
|
+
className,
|
|
16
|
+
nested = false,
|
|
17
|
+
isExpressive = false,
|
|
18
|
+
...other
|
|
19
|
+
}) {
|
|
21
20
|
const prefix = usePrefix();
|
|
22
21
|
const classNames = cx(`${prefix}--list--unordered`, className, {
|
|
23
22
|
[`${prefix}--list--nested`]: nested,
|
|
24
23
|
[`${prefix}--list--expressive`]: isExpressive
|
|
25
24
|
});
|
|
26
|
-
return /*#__PURE__*/
|
|
25
|
+
return /*#__PURE__*/React.createElement("ul", _extends({
|
|
27
26
|
className: classNames
|
|
28
27
|
}, other));
|
|
29
28
|
}
|
package/es/index.js
CHANGED
|
@@ -28,12 +28,34 @@ export { default as ComposedModal, ModalBody } from './components/ComposedModal/
|
|
|
28
28
|
export { ModalHeader } from './components/ComposedModal/ModalHeader.js';
|
|
29
29
|
export { ModalFooter } from './components/ComposedModal/ModalFooter.js';
|
|
30
30
|
import './components/ContainedList/index.js';
|
|
31
|
-
export {
|
|
31
|
+
export { ContentSwitcher } from './components/ContentSwitcher/ContentSwitcher.js';
|
|
32
32
|
export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
|
|
33
33
|
export { default as Copy } from './components/Copy/Copy.js';
|
|
34
34
|
export { default as CopyButton } from './components/CopyButton/CopyButton.js';
|
|
35
35
|
export { default as DangerButton } from './components/DangerButton/DangerButton.js';
|
|
36
|
-
|
|
36
|
+
export { default as DataTable } from './components/DataTable/DataTable.js';
|
|
37
|
+
export { Table } from './components/DataTable/Table.js';
|
|
38
|
+
export { default as TableActionList } from './components/DataTable/TableActionList.js';
|
|
39
|
+
export { default as TableBatchAction } from './components/DataTable/TableBatchAction.js';
|
|
40
|
+
export { default as TableBatchActions } from './components/DataTable/TableBatchActions.js';
|
|
41
|
+
export { default as TableBody } from './components/DataTable/TableBody.js';
|
|
42
|
+
export { default as TableCell } from './components/DataTable/TableCell.js';
|
|
43
|
+
export { default as TableContainer } from './components/DataTable/TableContainer.js';
|
|
44
|
+
export { default as TableExpandHeader } from './components/DataTable/TableExpandHeader.js';
|
|
45
|
+
export { default as TableDecoratorRow } from './components/DataTable/TableDecoratorRow.js';
|
|
46
|
+
export { default as TableExpandRow } from './components/DataTable/TableExpandRow.js';
|
|
47
|
+
export { default as TableExpandedRow } from './components/DataTable/TableExpandedRow.js';
|
|
48
|
+
export { default as TableHead } from './components/DataTable/TableHead.js';
|
|
49
|
+
export { default as TableHeader } from './components/DataTable/TableHeader.js';
|
|
50
|
+
export { default as TableRow } from './components/DataTable/TableRow.js';
|
|
51
|
+
export { default as TableSelectAll } from './components/DataTable/TableSelectAll.js';
|
|
52
|
+
export { default as TableSelectRow } from './components/DataTable/TableSelectRow.js';
|
|
53
|
+
export { default as TableSlugRow } from './components/DataTable/TableSlugRow.js';
|
|
54
|
+
export { default as TableToolbar } from './components/DataTable/TableToolbar.js';
|
|
55
|
+
export { default as TableToolbarAction } from './components/DataTable/TableToolbarAction.js';
|
|
56
|
+
export { default as TableToolbarContent } from './components/DataTable/TableToolbarContent.js';
|
|
57
|
+
export { default as TableToolbarSearch } from './components/DataTable/TableToolbarSearch.js';
|
|
58
|
+
export { default as TableToolbarMenu } from './components/DataTable/TableToolbarMenu.js';
|
|
37
59
|
export { default as DataTableSkeleton } from './components/DataTableSkeleton/DataTableSkeleton.js';
|
|
38
60
|
export { default as DatePicker } from './components/DatePicker/DatePicker.js';
|
|
39
61
|
export { default as DatePickerSkeleton } from './components/DatePicker/DatePicker.Skeleton.js';
|
|
@@ -140,7 +162,7 @@ export { default as Header } from './components/UIShell/Header.js';
|
|
|
140
162
|
export { default as HeaderContainer } from './components/UIShell/HeaderContainer.js';
|
|
141
163
|
export { default as HeaderGlobalAction } from './components/UIShell/HeaderGlobalAction.js';
|
|
142
164
|
export { default as HeaderGlobalBar } from './components/UIShell/HeaderGlobalBar.js';
|
|
143
|
-
export {
|
|
165
|
+
export { HeaderMenu } from './components/UIShell/HeaderMenu.js';
|
|
144
166
|
export { default as HeaderMenuButton } from './components/UIShell/HeaderMenuButton.js';
|
|
145
167
|
export { default as HeaderMenuItem } from './components/UIShell/HeaderMenuItem.js';
|
|
146
168
|
export { default as HeaderName } from './components/UIShell/HeaderName.js';
|
|
@@ -218,26 +240,3 @@ export { default as ContainedList } from './components/ContainedList/ContainedLi
|
|
|
218
240
|
export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
|
|
219
241
|
export { Text as unstable_Text } from './components/Text/Text.js';
|
|
220
242
|
export { TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
|
|
221
|
-
export { default as DataTable } from './components/DataTable/DataTable.js';
|
|
222
|
-
export { Table } from './components/DataTable/Table.js';
|
|
223
|
-
export { default as TableActionList } from './components/DataTable/TableActionList.js';
|
|
224
|
-
export { default as TableBatchAction } from './components/DataTable/TableBatchAction.js';
|
|
225
|
-
export { default as TableBatchActions } from './components/DataTable/TableBatchActions.js';
|
|
226
|
-
export { default as TableBody } from './components/DataTable/TableBody.js';
|
|
227
|
-
export { default as TableCell } from './components/DataTable/TableCell.js';
|
|
228
|
-
export { default as TableContainer } from './components/DataTable/TableContainer.js';
|
|
229
|
-
export { default as TableDecoratorRow } from './components/DataTable/TableDecoratorRow.js';
|
|
230
|
-
export { default as TableExpandHeader } from './components/DataTable/TableExpandHeader.js';
|
|
231
|
-
export { default as TableExpandRow } from './components/DataTable/TableExpandRow.js';
|
|
232
|
-
export { default as TableExpandedRow } from './components/DataTable/TableExpandedRow.js';
|
|
233
|
-
export { default as TableHead } from './components/DataTable/TableHead.js';
|
|
234
|
-
export { default as TableHeader } from './components/DataTable/TableHeader.js';
|
|
235
|
-
export { default as TableRow } from './components/DataTable/TableRow.js';
|
|
236
|
-
export { default as TableSelectAll } from './components/DataTable/TableSelectAll.js';
|
|
237
|
-
export { default as TableSelectRow } from './components/DataTable/TableSelectRow.js';
|
|
238
|
-
export { default as TableSlugRow } from './components/DataTable/TableSlugRow.js';
|
|
239
|
-
export { default as TableToolbar } from './components/DataTable/TableToolbar.js';
|
|
240
|
-
export { default as TableToolbarAction } from './components/DataTable/TableToolbarAction.js';
|
|
241
|
-
export { default as TableToolbarContent } from './components/DataTable/TableToolbarContent.js';
|
|
242
|
-
export { default as TableToolbarSearch } from './components/DataTable/TableToolbarSearch.js';
|
|
243
|
-
export { default as TableToolbarMenu } from './components/DataTable/TableToolbarMenu.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import React, { useContext, useState, useRef, useCallback, useEffect, cloneElement } from 'react';
|
|
9
9
|
import * as FeatureFlags from '@carbon/feature-flags';
|
|
10
10
|
import ReactDOM from 'react-dom';
|
|
11
11
|
import window from 'window-or-global';
|
|
@@ -25,16 +25,15 @@ const DIRECTION_BOTTOM = 'bottom';
|
|
|
25
25
|
* Computes the floating menu's position based on the menu size, trigger element
|
|
26
26
|
* position, offset, direction, and container.
|
|
27
27
|
*/
|
|
28
|
-
const getFloatingPosition =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _ref;
|
|
28
|
+
const getFloatingPosition = ({
|
|
29
|
+
menuSize,
|
|
30
|
+
refPosition,
|
|
31
|
+
offset,
|
|
32
|
+
direction,
|
|
33
|
+
scrollX,
|
|
34
|
+
scrollY,
|
|
35
|
+
container
|
|
36
|
+
}) => {
|
|
38
37
|
const {
|
|
39
38
|
left: refLeft = 0,
|
|
40
39
|
top: refTop = 0,
|
|
@@ -77,24 +76,23 @@ const getFloatingPosition = _ref => {
|
|
|
77
76
|
};
|
|
78
77
|
return positions[direction]();
|
|
79
78
|
};
|
|
80
|
-
const FloatingMenu =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
} = _ref2;
|
|
79
|
+
const FloatingMenu = ({
|
|
80
|
+
children,
|
|
81
|
+
flipped,
|
|
82
|
+
focusTrap,
|
|
83
|
+
menuDirection = DIRECTION_BOTTOM,
|
|
84
|
+
menuOffset = {
|
|
85
|
+
top: 0,
|
|
86
|
+
left: 0
|
|
87
|
+
},
|
|
88
|
+
menuRef: externalMenuRef,
|
|
89
|
+
onPlace,
|
|
90
|
+
selectorPrimaryFocus,
|
|
91
|
+
styles,
|
|
92
|
+
target = () => document.body,
|
|
93
|
+
triggerRef,
|
|
94
|
+
updateOrientation
|
|
95
|
+
}) => {
|
|
98
96
|
const prefix = useContext(PrefixContext);
|
|
99
97
|
const [floatingPosition, setFloatingPosition] = useState(undefined);
|
|
100
98
|
const menuBodyRef = useRef(null);
|
|
@@ -276,15 +274,15 @@ const FloatingMenu = _ref2 => {
|
|
|
276
274
|
const focusTrapWithoutSentinels = FeatureFlags.enabled('enable-experimental-focus-wrap-without-sentinels');
|
|
277
275
|
if (typeof document !== 'undefined') {
|
|
278
276
|
const portalTarget = target ? target() : document.body;
|
|
279
|
-
return /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/
|
|
277
|
+
return /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", {
|
|
280
278
|
onBlur: focusTrap && !focusTrapWithoutSentinels ? handleBlur : undefined,
|
|
281
279
|
onKeyDown: focusTrapWithoutSentinels ? handleKeyDown : undefined
|
|
282
|
-
}, !focusTrapWithoutSentinels && /*#__PURE__*/
|
|
280
|
+
}, !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("span", {
|
|
283
281
|
ref: startSentinelRef,
|
|
284
282
|
tabIndex: 0,
|
|
285
283
|
role: "link",
|
|
286
284
|
className: `${prefix}--visually-hidden`
|
|
287
|
-
}, "Focus sentinel"), getChildrenWithProps(), !focusTrapWithoutSentinels && /*#__PURE__*/
|
|
285
|
+
}, "Focus sentinel"), getChildrenWithProps(), !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("span", {
|
|
288
286
|
ref: endSentinelRef,
|
|
289
287
|
tabIndex: 0,
|
|
290
288
|
role: "link",
|
package/es/internal/Selection.js
CHANGED
|
@@ -8,14 +8,13 @@
|
|
|
8
8
|
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
9
9
|
import isEqual from 'react-fast-compare';
|
|
10
10
|
|
|
11
|
-
const callOnChangeHandler =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
11
|
+
const callOnChangeHandler = ({
|
|
12
|
+
isControlled,
|
|
13
|
+
isMounted,
|
|
14
|
+
onChangeHandlerControlled,
|
|
15
|
+
onChangeHandlerUncontrolled,
|
|
16
|
+
selectedItems
|
|
17
|
+
}) => {
|
|
19
18
|
if (isControlled) {
|
|
20
19
|
if (isMounted && onChangeHandlerControlled) {
|
|
21
20
|
onChangeHandlerControlled({
|
|
@@ -26,15 +25,14 @@ const callOnChangeHandler = _ref => {
|
|
|
26
25
|
onChangeHandlerUncontrolled(selectedItems);
|
|
27
26
|
}
|
|
28
27
|
};
|
|
29
|
-
const useSelection =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _ref2;
|
|
28
|
+
const useSelection = ({
|
|
29
|
+
disabled,
|
|
30
|
+
onChange,
|
|
31
|
+
initialSelectedItems = [],
|
|
32
|
+
selectedItems: controlledItems,
|
|
33
|
+
selectAll = false,
|
|
34
|
+
filteredItems = []
|
|
35
|
+
}) => {
|
|
38
36
|
const isMounted = useRef(false);
|
|
39
37
|
const savedOnChange = useRef(onChange);
|
|
40
38
|
const [uncontrolledItems, setUncontrolledItems] = useState(initialSelectedItems);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp.
|
|
2
|
+
* Copyright IBM Corp. 2025, 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
|
-
export {
|
|
7
|
+
export declare const mockHTMLElement: (options: HTMLElement) => {
|
|
8
|
+
mockRestore: () => void;
|
|
9
|
+
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import React from 'react';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Wrap a class component with a functional component. This prevents an end-user
|
|
@@ -13,7 +13,7 @@ import React__default from 'react';
|
|
|
13
13
|
*/
|
|
14
14
|
const createClassWrapper = Component => {
|
|
15
15
|
const ClassWrapper = props => {
|
|
16
|
-
return /*#__PURE__*/
|
|
16
|
+
return /*#__PURE__*/React.createElement(Component, props);
|
|
17
17
|
};
|
|
18
18
|
const name = Component.displayName || Component.name;
|
|
19
19
|
ClassWrapper.displayName = `ClassWrapper(${name})`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/** Returns an announcement message when the remaining count is low. */
|
|
8
|
+
export declare const getAnnouncement: (count: number, maxCount?: number, singularEntityName?: string, pluralEntityName?: string) => string | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
/** Returns an announcement message when the remaining count is low. */
|
|
9
|
+
const getAnnouncement = (count, maxCount, singularEntityName = 'character', pluralEntityName = 'characters') => {
|
|
10
|
+
if (typeof maxCount === 'undefined') return null;
|
|
11
|
+
const remaining = maxCount - count;
|
|
12
|
+
if (remaining <= 10 && remaining > 0) {
|
|
13
|
+
const entityName = remaining === 1 ? singularEntityName : pluralEntityName;
|
|
14
|
+
return `${remaining} ${entityName} left.`;
|
|
15
|
+
}
|
|
16
|
+
if (remaining <= 0) {
|
|
17
|
+
return `Maximum ${pluralEntityName} reached.`;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { getAnnouncement };
|
|
@@ -30,13 +30,12 @@ const matches = (event, keysToMatch) => {
|
|
|
30
30
|
* @param keyObj - An object with key properties to match against.
|
|
31
31
|
* @returns `true` if the event or code matches the key definition.
|
|
32
32
|
*/
|
|
33
|
-
const match = (eventOrCode,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} = _ref;
|
|
33
|
+
const match = (eventOrCode, {
|
|
34
|
+
key,
|
|
35
|
+
which,
|
|
36
|
+
keyCode,
|
|
37
|
+
code
|
|
38
|
+
}) => {
|
|
40
39
|
if (typeof eventOrCode === 'string') {
|
|
41
40
|
return eventOrCode === key;
|
|
42
41
|
}
|
|
@@ -30,5 +30,5 @@ interface UseControllableStateConfig<T> {
|
|
|
30
30
|
* Note: This hook will warn if the component switches between controlled and
|
|
31
31
|
* uncontrolled states.
|
|
32
32
|
*/
|
|
33
|
-
export declare const useControllableState: <T>({ defaultValue, name, onChange, value, }: UseControllableStateConfig<T>) => [T, (stateOrUpdater: T | ((prev: T) => T)) => void];
|
|
33
|
+
export declare const useControllableState: <T>({ defaultValue, name, onChange, value, }: UseControllableStateConfig<T>) => [T, (stateOrUpdater: T | ((prev: T) => T)) => void, boolean];
|
|
34
34
|
export {};
|
|
@@ -16,13 +16,12 @@ import { warning } from './warning.js';
|
|
|
16
16
|
* Note: This hook will warn if the component switches between controlled and
|
|
17
17
|
* uncontrolled states.
|
|
18
18
|
*/
|
|
19
|
-
const useControllableState =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref;
|
|
19
|
+
const useControllableState = ({
|
|
20
|
+
defaultValue,
|
|
21
|
+
name = 'custom',
|
|
22
|
+
onChange,
|
|
23
|
+
value
|
|
24
|
+
}) => {
|
|
26
25
|
const [state, internalSetState] = useState(typeof value !== 'undefined' ? value : defaultValue);
|
|
27
26
|
const controlled = useRef(null);
|
|
28
27
|
if (controlled.current === null) {
|
|
@@ -51,9 +50,9 @@ const useControllableState = _ref => {
|
|
|
51
50
|
}
|
|
52
51
|
}, [name, value]);
|
|
53
52
|
if (controlled.current === true) {
|
|
54
|
-
return [value, setState];
|
|
53
|
+
return [value, setState, controlled.current];
|
|
55
54
|
}
|
|
56
|
-
return [state, setState];
|
|
55
|
+
return [state, setState, controlled.current];
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
export { useControllableState };
|
|
@@ -23,8 +23,7 @@ function useDelayedState(initialState) {
|
|
|
23
23
|
const timeoutId = useRef(null);
|
|
24
24
|
// We use `useCallback` to match the signature of React's `useState` which will
|
|
25
25
|
// always return the same reference for the `setState` updater
|
|
26
|
-
const setStateWithDelay = useCallback(
|
|
27
|
-
let delayMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
26
|
+
const setStateWithDelay = useCallback((stateToSet, delayMs = 0) => {
|
|
28
27
|
window.clearTimeout(timeoutId.current ?? undefined);
|
|
29
28
|
timeoutId.current = null;
|
|
30
29
|
if (delayMs === 0) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* React hook that returns the current document language and updates on changes.
|
|
9
|
+
*
|
|
10
|
+
* @returns {string} The current document language code.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDocumentLang(): string;
|
package/es/internal/useId.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import React, { useState, useEffect, useLayoutEffect } from 'react';
|
|
9
9
|
import { setupGetInstanceId } from '../tools/setupGetInstanceId.js';
|
|
10
10
|
import { canUseDOM } from './environment.js';
|
|
11
11
|
import { useIdPrefix } from './useIdPrefix.js';
|
|
@@ -17,7 +17,7 @@ import { useIdPrefix } from './useIdPrefix.js';
|
|
|
17
17
|
// https://github.com/webpack/webpack/issues/14814
|
|
18
18
|
// https://github.com/mui/material-ui/issues/41190
|
|
19
19
|
const _React = {
|
|
20
|
-
...
|
|
20
|
+
...React
|
|
21
21
|
};
|
|
22
22
|
const instanceId = setupGetInstanceId();
|
|
23
23
|
const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
|
|
@@ -30,8 +30,7 @@ const defaultId = 'id';
|
|
|
30
30
|
* @param {string} [prefix]
|
|
31
31
|
* @returns {string}
|
|
32
32
|
*/
|
|
33
|
-
function useCompatibleId() {
|
|
34
|
-
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
|
|
33
|
+
function useCompatibleId(prefix = defaultId) {
|
|
35
34
|
const contextPrefix = useIdPrefix();
|
|
36
35
|
const [id, setId] = useState(() => {
|
|
37
36
|
if (serverHandoffCompleted) {
|
|
@@ -58,8 +57,7 @@ function useCompatibleId() {
|
|
|
58
57
|
* @param {string} [prefix]
|
|
59
58
|
* @returns {string}
|
|
60
59
|
*/
|
|
61
|
-
function useReactId() {
|
|
62
|
-
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
|
|
60
|
+
function useReactId(prefix = defaultId) {
|
|
63
61
|
const contextPrefix = useIdPrefix();
|
|
64
62
|
return `${contextPrefix ? `${contextPrefix}-` : ``}${prefix}-${_React.useId()}`;
|
|
65
63
|
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import React from 'react';
|
|
9
9
|
|
|
10
|
-
const IdPrefixContext = /*#__PURE__*/
|
|
10
|
+
const IdPrefixContext = /*#__PURE__*/React.createContext(null);
|
|
11
11
|
function useIdPrefix() {
|
|
12
|
-
return
|
|
12
|
+
return React.useContext(IdPrefixContext);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { IdPrefixContext, useIdPrefix };
|
|
@@ -13,8 +13,7 @@ import { useState, useEffect } from 'react';
|
|
|
13
13
|
* @param defaultState - The initial state to return before the media query is evaluated. Defaults to `false`.
|
|
14
14
|
* @returns Whether the media query matches.
|
|
15
15
|
*/
|
|
16
|
-
const useMatchMedia =
|
|
17
|
-
let defaultState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
16
|
+
const useMatchMedia = (mediaQuery, defaultState = false) => {
|
|
18
17
|
const [matches, setMatches] = useState(defaultState);
|
|
19
18
|
useEffect(() => {
|
|
20
19
|
const listener = event => {
|
|
@@ -13,4 +13,4 @@ import { type ForwardedRef, type Ref } from 'react';
|
|
|
13
13
|
* accepts an array of refs and returns a callback ref that, when attached to a
|
|
14
14
|
* node, assigns that node to every ref in the array.
|
|
15
15
|
*/
|
|
16
|
-
export declare const useMergedRefs: <T>(refs: ForwardedRef<T>[]) => Ref<T>;
|
|
16
|
+
export declare const useMergedRefs: <T>(refs: (ForwardedRef<T> | undefined)[]) => Ref<T>;
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { useEffect } from 'react';
|
|
9
9
|
|
|
10
|
-
function useNoInteractiveChildren(ref) {
|
|
11
|
-
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'component should have no interactive child nodes';
|
|
10
|
+
function useNoInteractiveChildren(ref, message = 'component should have no interactive child nodes') {
|
|
12
11
|
if (process.env.NODE_ENV !== 'production') {
|
|
13
12
|
// TODO: https://github.com/carbon-design-system/carbon/issues/19005
|
|
14
13
|
/*
|
|
@@ -25,8 +24,7 @@ function useNoInteractiveChildren(ref) {
|
|
|
25
24
|
}, []);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
function useInteractiveChildrenNeedDescription(ref) {
|
|
29
|
-
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `interactive child node(s) should have an \`aria-describedby\` property`;
|
|
27
|
+
function useInteractiveChildrenNeedDescription(ref, message = `interactive child node(s) should have an \`aria-describedby\` property`) {
|
|
30
28
|
if (process.env.NODE_ENV !== 'production') {
|
|
31
29
|
// TODO: https://github.com/carbon-design-system/carbon/issues/19005
|
|
32
30
|
/*
|