@carbon/react 1.83.0 → 1.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +909 -874
- package/README.md +1 -1
- package/es/components/AILabel/index.js +27 -30
- package/es/components/AISkeleton/AISkeletonIcon.js +4 -5
- package/es/components/AISkeleton/AISkeletonPlaceholder.js +4 -5
- package/es/components/AISkeleton/AISkeletonText.js +4 -5
- package/es/components/Accordion/Accordion.Skeleton.js +9 -10
- package/es/components/Accordion/Accordion.js +10 -11
- package/es/components/Accordion/AccordionItem.js +13 -14
- package/es/components/Accordion/AccordionProvider.js +4 -5
- package/es/components/AspectRatio/AspectRatio.js +7 -8
- package/es/components/BadgeIndicator/index.js +5 -6
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +4 -5
- package/es/components/Button/Button.Skeleton.js +7 -8
- package/es/components/Button/ButtonBase.js +23 -24
- package/es/components/ChatButton/ChatButton.Skeleton.js +5 -6
- package/es/components/ChatButton/ChatButton.js +11 -12
- package/es/components/Checkbox/Checkbox.Skeleton.js +4 -5
- package/es/components/Checkbox/Checkbox.js +19 -20
- package/es/components/CheckboxGroup/CheckboxGroup.js +16 -17
- package/es/components/ClassPrefix/index.js +4 -5
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +5 -6
- package/es/components/CodeSnippet/CodeSnippet.js +25 -26
- package/es/components/ComboBox/ComboBox.js +24 -30
- package/es/components/ComboBox/tools/filter.js +9 -12
- package/es/components/ComboButton/index.js +16 -18
- package/es/components/ComposedModal/ComposedModal.js +50 -36
- package/es/components/ComposedModal/ModalFooter.js +37 -42
- package/es/components/ComposedModal/ModalHeader.js +14 -15
- package/es/components/ContainedList/ContainedList.js +10 -11
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +9 -29
- package/es/components/ContentSwitcher/ContentSwitcher.js +96 -128
- package/es/components/ContentSwitcher/index.d.ts +3 -4
- package/es/components/ContextMenu/useContextMenu.js +1 -2
- package/es/components/Copy/Copy.js +11 -12
- package/es/components/CopyButton/CopyButton.js +10 -11
- package/es/components/DataTable/DataTable.js +45 -53
- package/es/components/DataTable/Table.js +15 -18
- package/es/components/DataTable/TableBatchAction.js +8 -11
- package/es/components/DataTable/TableBatchActions.js +18 -20
- package/es/components/DataTable/TableBody.js +8 -11
- package/es/components/DataTable/TableContainer.js +9 -10
- package/es/components/DataTable/TableDecoratorRow.js +4 -5
- package/es/components/DataTable/TableExpandHeader.js +14 -15
- package/es/components/DataTable/TableExpandRow.js +13 -14
- package/es/components/DataTable/TableExpandedRow.js +6 -7
- package/es/components/DataTable/TableHeader.js +15 -16
- package/es/components/DataTable/TableSelectAll.js +11 -12
- package/es/components/DataTable/TableSelectRow.js +12 -13
- package/es/components/DataTable/TableSlugRow.js +4 -5
- package/es/components/DataTable/TableToolbar.js +7 -8
- package/es/components/DataTable/TableToolbarMenu.js +8 -9
- package/es/components/DataTable/TableToolbarSearch.js +22 -24
- package/es/components/DataTable/state/sorting.js +3 -4
- package/es/components/DataTable/tools/filter.js +10 -12
- package/es/components/DataTable/tools/normalize.js +6 -8
- package/es/components/DataTable/tools/sorting.js +24 -30
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +11 -12
- package/es/components/DatePicker/DatePicker.Skeleton.js +7 -8
- package/es/components/DatePicker/DatePicker.js +88 -65
- package/es/components/DatePickerInput/DatePickerInput.js +5 -6
- package/es/components/Dialog/index.d.ts +193 -8
- package/es/components/Dialog/index.js +454 -35
- package/es/components/Dropdown/Dropdown.Skeleton.js +6 -7
- package/es/components/Dropdown/Dropdown.js +40 -43
- package/es/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/es/components/ExpandableSearch/ExpandableSearch.js +9 -10
- package/es/components/FeatureFlags/index.js +11 -12
- package/es/components/FileUploader/FileUploader.Skeleton.js +4 -5
- package/es/components/FileUploader/FileUploader.js +22 -24
- package/es/components/FileUploader/FileUploaderButton.js +16 -17
- package/es/components/FileUploader/FileUploaderDropContainer.js +15 -16
- package/es/components/FileUploader/FileUploaderItem.js +13 -14
- package/es/components/FileUploader/Filename.js +9 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +4 -5
- package/es/components/FluidComboBox/FluidComboBox.js +5 -6
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +5 -6
- package/es/components/FluidDatePicker/FluidDatePicker.js +10 -11
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +4 -5
- package/es/components/FluidDropdown/FluidDropdown.js +5 -6
- package/es/components/FluidForm/FluidForm.js +5 -6
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +4 -5
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +6 -7
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +4 -5
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/es/components/FluidNumberInput/FluidNumberInput.js +38 -5
- package/es/components/FluidSearch/FluidSearch.Skeleton.js +4 -5
- package/es/components/FluidSearch/FluidSearch.js +4 -5
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +4 -5
- package/es/components/FluidSelect/FluidSelect.js +5 -6
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +4 -5
- package/es/components/FluidTextArea/FluidTextArea.js +4 -5
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +4 -5
- package/es/components/FluidTextInput/FluidTextInput.js +5 -6
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +5 -6
- package/es/components/FluidTimePicker/FluidTimePicker.js +11 -12
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +5 -6
- package/es/components/Form/Form.js +5 -6
- package/es/components/FormGroup/FormGroup.js +11 -12
- package/es/components/FormItem/FormItem.js +5 -6
- package/es/components/FormLabel/FormLabel.js +6 -7
- package/es/components/Grid/CSSGrid.js +17 -19
- package/es/components/Grid/Column.js +28 -27
- package/es/components/Grid/ColumnHang.js +6 -7
- package/es/components/Grid/FlexGrid.js +9 -10
- package/es/components/Grid/GridContext.js +5 -6
- package/es/components/Grid/Row.js +8 -9
- package/es/components/Heading/index.js +5 -6
- package/es/components/Icon/Icon.Skeleton.js +4 -5
- package/es/components/IconButton/index.js +20 -21
- package/es/components/IconIndicator/index.js +7 -8
- package/es/components/IdPrefix/index.js +4 -5
- package/es/components/InlineLoading/InlineLoading.js +9 -10
- package/es/components/Layer/index.js +8 -9
- package/es/components/Layout/index.js +21 -26
- package/es/components/LayoutDirection/LayoutDirection.js +6 -7
- package/es/components/Link/Link.d.ts +1 -1
- package/es/components/Link/Link.js +14 -15
- package/es/components/ListBox/ListBoxField.js +6 -7
- package/es/components/ListBox/ListBoxMenu.js +5 -6
- package/es/components/ListBox/ListBoxMenuIcon.js +4 -5
- package/es/components/ListBox/ListBoxMenuItem.js +8 -10
- package/es/components/ListBox/ListBoxSelection.js +8 -9
- package/es/components/ListBox/next/ListBoxSelection.js +9 -10
- package/es/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/es/components/ListItem/ListItem.js +5 -6
- package/es/components/Loading/Loading.js +8 -9
- package/es/components/Menu/Menu.js +23 -24
- package/es/components/Menu/MenuItem.js +39 -44
- package/es/components/MenuButton/index.js +16 -18
- package/es/components/Modal/Modal.js +74 -65
- package/es/components/ModalWrapper/ModalWrapper.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +67 -48
- package/es/components/MultiSelect/MultiSelect.js +43 -45
- package/es/components/MultiSelect/tools/sorting.js +11 -15
- package/es/components/Notification/Notification.js +96 -105
- package/es/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/es/components/NumberInput/NumberFormatPropTypes.js +40 -0
- package/es/components/NumberInput/NumberInput.Skeleton.js +6 -7
- package/es/components/NumberInput/NumberInput.d.ts +39 -3
- package/es/components/NumberInput/NumberInput.js +174 -44
- package/es/components/OrderedList/OrderedList.js +7 -8
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +39 -46
- package/es/components/OverflowMenu/next/index.js +12 -13
- package/es/components/PageHeader/PageHeader.d.ts +39 -14
- package/es/components/PageHeader/PageHeader.js +187 -81
- package/es/components/PageHeader/index.d.ts +2 -2
- package/es/components/PageHeader/index.js +1 -1
- package/es/components/Pagination/Pagination.Skeleton.js +4 -5
- package/es/components/Pagination/Pagination.js +24 -25
- package/es/components/Pagination/experimental/PageSelector.js +8 -9
- package/es/components/Pagination/experimental/Pagination.js +20 -21
- package/es/components/PaginationNav/PaginationNav.js +33 -38
- package/es/components/Popover/index.js +26 -28
- package/es/components/ProgressBar/ProgressBar.js +11 -12
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
- package/es/components/ProgressIndicator/ProgressIndicator.js +29 -32
- package/es/components/RadioTile/RadioTile.js +17 -18
- package/es/components/Search/Search.Skeleton.js +5 -6
- package/es/components/Search/Search.js +26 -29
- package/es/components/Select/Select.Skeleton.js +5 -6
- package/es/components/Select/Select.js +24 -25
- package/es/components/SelectItem/SelectItem.js +8 -9
- package/es/components/SelectItemGroup/SelectItemGroup.js +7 -8
- package/es/components/ShapeIndicator/index.js +7 -8
- package/es/components/SkeletonIcon/SkeletonIcon.js +4 -5
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -5
- package/es/components/SkeletonText/SkeletonText.js +8 -9
- package/es/components/Slider/Slider.Skeleton.js +8 -9
- package/es/components/Slider/Slider.js +75 -83
- package/es/components/Slider/SliderHandles.js +6 -6
- package/es/components/StructuredList/StructuredList.Skeleton.js +5 -6
- package/es/components/Tabs/Tabs.Skeleton.js +5 -6
- package/es/components/Tabs/Tabs.js +83 -98
- package/es/components/Tabs/usePressable.js +7 -8
- package/es/components/Tag/DismissibleTag.js +16 -17
- package/es/components/Tag/OperationalTag.js +10 -11
- package/es/components/Tag/SelectableTag.js +13 -14
- package/es/components/Tag/Tag.Skeleton.js +5 -6
- package/es/components/Tag/Tag.js +19 -20
- package/es/components/Text/Text.js +6 -7
- package/es/components/Text/TextDirection.js +5 -6
- package/es/components/TextArea/TextArea.js +7 -7
- package/es/components/TextInput/ControlledPasswordInput.js +24 -25
- package/es/components/TextInput/PasswordInput.js +26 -27
- package/es/components/TextInput/TextInput.Skeleton.js +5 -6
- package/es/components/TextInput/TextInput.js +27 -28
- package/es/components/TextInput/util.js +14 -17
- package/es/components/Theme/index.js +10 -12
- package/es/components/Tile/Tile.js +68 -74
- package/es/components/TileGroup/TileGroup.d.ts +4 -4
- package/es/components/TileGroup/TileGroup.js +45 -53
- package/es/components/TileGroup/index.d.ts +3 -3
- package/es/components/Toggle/Toggle.Skeleton.js +4 -5
- package/es/components/Toggle/Toggle.js +17 -18
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +6 -7
- package/es/components/Toggletip/index.js +33 -39
- package/es/components/Tooltip/DefinitionTooltip.js +13 -14
- package/es/components/Tooltip/Tooltip.js +15 -16
- package/es/components/TreeView/TreeNode.js +20 -21
- package/es/components/TreeView/TreeView.js +14 -16
- package/es/components/UIShell/Content.js +6 -7
- package/es/components/UIShell/Header.js +5 -6
- package/es/components/UIShell/HeaderContainer.js +5 -6
- package/es/components/UIShell/HeaderGlobalAction.js +12 -13
- package/es/components/UIShell/HeaderMenu.d.ts +10 -112
- package/es/components/UIShell/HeaderMenu.js +154 -201
- package/es/components/UIShell/HeaderMenuButton.js +10 -11
- package/es/components/UIShell/HeaderMenuItem.js +12 -12
- package/es/components/UIShell/HeaderName.js +6 -7
- package/es/components/UIShell/HeaderNavigation.js +7 -8
- package/es/components/UIShell/HeaderPanel.js +9 -10
- package/es/components/UIShell/HeaderSideNavItems.js +5 -6
- package/es/components/UIShell/Link.js +8 -9
- package/es/components/UIShell/SideNav.js +23 -25
- package/es/components/UIShell/SideNavDetails.js +6 -7
- package/es/components/UIShell/SideNavDivider.js +3 -4
- package/es/components/UIShell/SideNavFooter.js +6 -7
- package/es/components/UIShell/SideNavHeader.js +5 -6
- package/es/components/UIShell/SideNavIcon.js +5 -6
- package/es/components/UIShell/SideNavItem.js +5 -6
- package/es/components/UIShell/SideNavItems.js +5 -6
- package/es/components/UIShell/SideNavLink.js +10 -11
- package/es/components/UIShell/SideNavLinkText.js +5 -6
- package/es/components/UIShell/SideNavMenu.js +11 -12
- package/es/components/UIShell/SkipToContent.js +7 -8
- package/es/components/UIShell/Switcher.js +4 -5
- package/es/components/UIShell/SwitcherDivider.js +4 -5
- package/es/components/UnorderedList/UnorderedList.js +6 -7
- package/es/index.js +3 -3
- package/es/internal/FloatingMenu.js +26 -28
- package/es/internal/Selection.js +15 -17
- package/es/internal/getAnnouncement.d.ts +8 -0
- package/es/internal/getAnnouncement.js +22 -0
- package/es/internal/keyboard/match.js +6 -7
- package/es/internal/useControllableState.d.ts +1 -1
- package/es/internal/useControllableState.js +8 -9
- package/es/internal/useDelayedState.js +1 -2
- package/es/internal/useDocumentLang.d.ts +12 -0
- package/es/internal/useId.js +2 -4
- package/es/internal/useMatchMedia.js +1 -2
- package/es/internal/useMergedRefs.d.ts +1 -1
- package/es/internal/useNoInteractiveChildren.js +2 -4
- package/es/internal/useNormalizedInputProps.js +9 -10
- package/es/internal/useOverflowItems.d.ts +29 -0
- package/es/internal/useOverflowItems.js +122 -0
- package/es/internal/useResizeObserver.js +4 -5
- package/es/internal/useSavedCallback.js +1 -3
- package/es/internal/wrapFocus.js +20 -29
- package/es/prop-types/deprecate.js +1 -4
- package/es/prop-types/deprecateValuesWithin.js +1 -4
- package/es/prop-types/isRequiredOneOf.js +1 -4
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
- package/es/tools/events.js +1 -4
- package/es/tools/mergeRefs.js +9 -14
- package/es/tools/uniqueId.js +1 -2
- package/es/tools/wrapComponent.js +9 -11
- package/lib/components/AILabel/index.js +27 -30
- package/lib/components/AISkeleton/AISkeletonIcon.js +4 -5
- package/lib/components/AISkeleton/AISkeletonPlaceholder.js +4 -5
- package/lib/components/AISkeleton/AISkeletonText.js +4 -5
- package/lib/components/Accordion/Accordion.Skeleton.js +9 -10
- package/lib/components/Accordion/Accordion.js +10 -11
- package/lib/components/Accordion/AccordionItem.js +13 -14
- package/lib/components/Accordion/AccordionProvider.js +4 -5
- package/lib/components/AspectRatio/AspectRatio.js +7 -8
- package/lib/components/BadgeIndicator/index.js +5 -6
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +4 -5
- package/lib/components/Button/Button.Skeleton.js +7 -8
- package/lib/components/Button/ButtonBase.js +23 -24
- package/lib/components/ChatButton/ChatButton.Skeleton.js +5 -6
- package/lib/components/ChatButton/ChatButton.js +11 -12
- package/lib/components/Checkbox/Checkbox.Skeleton.js +4 -5
- package/lib/components/Checkbox/Checkbox.js +19 -20
- package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -17
- package/lib/components/ClassPrefix/index.js +4 -5
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +5 -6
- package/lib/components/CodeSnippet/CodeSnippet.js +25 -26
- package/lib/components/ComboBox/ComboBox.js +24 -30
- package/lib/components/ComboBox/tools/filter.js +9 -12
- package/lib/components/ComboButton/index.js +16 -18
- package/lib/components/ComposedModal/ComposedModal.js +50 -36
- package/lib/components/ComposedModal/ModalFooter.js +37 -42
- package/lib/components/ComposedModal/ModalHeader.js +14 -15
- package/lib/components/ContainedList/ContainedList.js +10 -11
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +9 -29
- package/lib/components/ContentSwitcher/ContentSwitcher.js +94 -126
- package/lib/components/ContentSwitcher/index.d.ts +3 -4
- package/lib/components/ContextMenu/useContextMenu.js +1 -2
- package/lib/components/Copy/Copy.js +11 -12
- package/lib/components/CopyButton/CopyButton.js +10 -11
- package/lib/components/DataTable/DataTable.js +45 -53
- package/lib/components/DataTable/Table.js +15 -18
- package/lib/components/DataTable/TableBatchAction.js +8 -11
- package/lib/components/DataTable/TableBatchActions.js +18 -20
- package/lib/components/DataTable/TableBody.js +8 -11
- package/lib/components/DataTable/TableContainer.js +9 -10
- package/lib/components/DataTable/TableDecoratorRow.js +4 -5
- package/lib/components/DataTable/TableExpandHeader.js +14 -15
- package/lib/components/DataTable/TableExpandRow.js +13 -14
- package/lib/components/DataTable/TableExpandedRow.js +6 -7
- package/lib/components/DataTable/TableHeader.js +15 -16
- package/lib/components/DataTable/TableSelectAll.js +11 -12
- package/lib/components/DataTable/TableSelectRow.js +12 -13
- package/lib/components/DataTable/TableSlugRow.js +4 -5
- package/lib/components/DataTable/TableToolbar.js +7 -8
- package/lib/components/DataTable/TableToolbarMenu.js +8 -9
- package/lib/components/DataTable/TableToolbarSearch.js +22 -24
- package/lib/components/DataTable/state/sorting.js +3 -4
- package/lib/components/DataTable/tools/filter.js +10 -12
- package/lib/components/DataTable/tools/normalize.js +6 -8
- package/lib/components/DataTable/tools/sorting.js +24 -30
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +11 -12
- package/lib/components/DatePicker/DatePicker.Skeleton.js +7 -8
- package/lib/components/DatePicker/DatePicker.js +87 -64
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -6
- package/lib/components/Dialog/index.d.ts +193 -8
- package/lib/components/Dialog/index.js +457 -33
- package/lib/components/Dropdown/Dropdown.Skeleton.js +6 -7
- package/lib/components/Dropdown/Dropdown.js +40 -43
- package/lib/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.js +9 -10
- package/lib/components/FeatureFlags/index.js +11 -12
- package/lib/components/FileUploader/FileUploader.Skeleton.js +4 -5
- package/lib/components/FileUploader/FileUploader.js +22 -24
- package/lib/components/FileUploader/FileUploaderButton.js +16 -17
- package/lib/components/FileUploader/FileUploaderDropContainer.js +15 -16
- package/lib/components/FileUploader/FileUploaderItem.js +13 -14
- package/lib/components/FileUploader/Filename.js +9 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +4 -5
- package/lib/components/FluidComboBox/FluidComboBox.js +5 -6
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +5 -6
- package/lib/components/FluidDatePicker/FluidDatePicker.js +10 -11
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +4 -5
- package/lib/components/FluidDropdown/FluidDropdown.js +5 -6
- package/lib/components/FluidForm/FluidForm.js +5 -6
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +4 -5
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +6 -7
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +4 -5
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/lib/components/FluidNumberInput/FluidNumberInput.js +38 -5
- package/lib/components/FluidSearch/FluidSearch.Skeleton.js +4 -5
- package/lib/components/FluidSearch/FluidSearch.js +4 -5
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +4 -5
- package/lib/components/FluidSelect/FluidSelect.js +5 -6
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +4 -5
- package/lib/components/FluidTextArea/FluidTextArea.js +4 -5
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +4 -5
- package/lib/components/FluidTextInput/FluidTextInput.js +5 -6
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +5 -6
- package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -12
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +5 -6
- package/lib/components/Form/Form.js +5 -6
- package/lib/components/FormGroup/FormGroup.js +11 -12
- package/lib/components/FormItem/FormItem.js +5 -6
- package/lib/components/FormLabel/FormLabel.js +6 -7
- package/lib/components/Grid/CSSGrid.js +17 -19
- package/lib/components/Grid/Column.js +28 -27
- package/lib/components/Grid/ColumnHang.js +6 -7
- package/lib/components/Grid/FlexGrid.js +9 -10
- package/lib/components/Grid/GridContext.js +5 -6
- package/lib/components/Grid/Row.js +8 -9
- package/lib/components/Heading/index.js +5 -6
- package/lib/components/Icon/Icon.Skeleton.js +4 -5
- package/lib/components/IconButton/index.js +20 -21
- package/lib/components/IconIndicator/index.js +7 -8
- package/lib/components/IdPrefix/index.js +4 -5
- package/lib/components/InlineLoading/InlineLoading.js +9 -10
- package/lib/components/Layer/index.js +8 -9
- package/lib/components/Layout/index.js +21 -26
- package/lib/components/LayoutDirection/LayoutDirection.js +6 -7
- package/lib/components/Link/Link.d.ts +1 -1
- package/lib/components/Link/Link.js +14 -15
- package/lib/components/ListBox/ListBoxField.js +6 -7
- package/lib/components/ListBox/ListBoxMenu.js +5 -6
- package/lib/components/ListBox/ListBoxMenuIcon.js +4 -5
- package/lib/components/ListBox/ListBoxMenuItem.js +8 -10
- package/lib/components/ListBox/ListBoxSelection.js +8 -9
- package/lib/components/ListBox/next/ListBoxSelection.js +9 -10
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/lib/components/ListItem/ListItem.js +5 -6
- package/lib/components/Loading/Loading.js +8 -9
- package/lib/components/Menu/Menu.js +23 -24
- package/lib/components/Menu/MenuItem.js +39 -44
- package/lib/components/MenuButton/index.js +16 -18
- package/lib/components/Modal/Modal.js +74 -65
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +66 -47
- package/lib/components/MultiSelect/MultiSelect.js +43 -45
- package/lib/components/MultiSelect/tools/sorting.js +11 -15
- package/lib/components/Notification/Notification.js +96 -105
- package/lib/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/lib/components/NumberInput/NumberFormatPropTypes.js +48 -0
- package/lib/components/NumberInput/NumberInput.Skeleton.js +6 -7
- package/lib/components/NumberInput/NumberInput.d.ts +39 -3
- package/lib/components/NumberInput/NumberInput.js +173 -43
- package/lib/components/OrderedList/OrderedList.js +7 -8
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +39 -46
- package/lib/components/OverflowMenu/next/index.js +12 -13
- package/lib/components/PageHeader/PageHeader.d.ts +39 -14
- package/lib/components/PageHeader/PageHeader.js +185 -81
- package/lib/components/PageHeader/index.d.ts +2 -2
- package/lib/components/PageHeader/index.js +0 -2
- package/lib/components/Pagination/Pagination.Skeleton.js +4 -5
- package/lib/components/Pagination/Pagination.js +24 -25
- package/lib/components/Pagination/experimental/PageSelector.js +8 -9
- package/lib/components/Pagination/experimental/Pagination.js +20 -21
- package/lib/components/PaginationNav/PaginationNav.js +33 -38
- package/lib/components/Popover/index.js +26 -28
- package/lib/components/ProgressBar/ProgressBar.js +11 -12
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
- package/lib/components/ProgressIndicator/ProgressIndicator.js +29 -32
- package/lib/components/RadioTile/RadioTile.js +17 -18
- package/lib/components/Search/Search.Skeleton.js +5 -6
- package/lib/components/Search/Search.js +26 -29
- package/lib/components/Select/Select.Skeleton.js +5 -6
- package/lib/components/Select/Select.js +24 -25
- package/lib/components/SelectItem/SelectItem.js +8 -9
- package/lib/components/SelectItemGroup/SelectItemGroup.js +7 -8
- package/lib/components/ShapeIndicator/index.js +7 -8
- package/lib/components/SkeletonIcon/SkeletonIcon.js +4 -5
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -5
- package/lib/components/SkeletonText/SkeletonText.js +8 -9
- package/lib/components/Slider/Slider.Skeleton.js +8 -9
- package/lib/components/Slider/Slider.js +75 -83
- package/lib/components/Slider/SliderHandles.js +6 -6
- package/lib/components/StructuredList/StructuredList.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.js +83 -98
- package/lib/components/Tabs/usePressable.js +7 -8
- package/lib/components/Tag/DismissibleTag.js +16 -17
- package/lib/components/Tag/OperationalTag.js +10 -11
- package/lib/components/Tag/SelectableTag.js +13 -14
- package/lib/components/Tag/Tag.Skeleton.js +5 -6
- package/lib/components/Tag/Tag.js +19 -20
- package/lib/components/Text/Text.js +6 -7
- package/lib/components/Text/TextDirection.js +5 -6
- package/lib/components/TextArea/TextArea.js +7 -7
- package/lib/components/TextInput/ControlledPasswordInput.js +24 -25
- package/lib/components/TextInput/PasswordInput.js +26 -27
- package/lib/components/TextInput/TextInput.Skeleton.js +5 -6
- package/lib/components/TextInput/TextInput.js +27 -28
- package/lib/components/TextInput/util.js +14 -17
- package/lib/components/Theme/index.js +10 -12
- package/lib/components/Tile/Tile.js +68 -74
- package/lib/components/TileGroup/TileGroup.d.ts +4 -4
- package/lib/components/TileGroup/TileGroup.js +44 -52
- package/lib/components/TileGroup/index.d.ts +3 -3
- package/lib/components/Toggle/Toggle.Skeleton.js +4 -5
- package/lib/components/Toggle/Toggle.js +17 -18
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +6 -7
- package/lib/components/Toggletip/index.js +33 -39
- package/lib/components/Tooltip/DefinitionTooltip.js +13 -14
- package/lib/components/Tooltip/Tooltip.js +15 -16
- package/lib/components/TreeView/TreeNode.js +20 -21
- package/lib/components/TreeView/TreeView.js +14 -16
- package/lib/components/UIShell/Content.js +6 -7
- package/lib/components/UIShell/Header.js +5 -6
- package/lib/components/UIShell/HeaderContainer.js +5 -6
- package/lib/components/UIShell/HeaderGlobalAction.js +12 -13
- package/lib/components/UIShell/HeaderMenu.d.ts +10 -112
- package/lib/components/UIShell/HeaderMenu.js +152 -199
- package/lib/components/UIShell/HeaderMenuButton.js +10 -11
- package/lib/components/UIShell/HeaderMenuItem.js +12 -12
- package/lib/components/UIShell/HeaderName.js +6 -7
- package/lib/components/UIShell/HeaderNavigation.js +7 -8
- package/lib/components/UIShell/HeaderPanel.js +9 -10
- package/lib/components/UIShell/HeaderSideNavItems.js +5 -6
- package/lib/components/UIShell/Link.js +8 -9
- package/lib/components/UIShell/SideNav.js +23 -25
- package/lib/components/UIShell/SideNavDetails.js +6 -7
- package/lib/components/UIShell/SideNavDivider.js +3 -4
- package/lib/components/UIShell/SideNavFooter.js +6 -7
- package/lib/components/UIShell/SideNavHeader.js +5 -6
- package/lib/components/UIShell/SideNavIcon.js +5 -6
- package/lib/components/UIShell/SideNavItem.js +5 -6
- package/lib/components/UIShell/SideNavItems.js +5 -6
- package/lib/components/UIShell/SideNavLink.js +10 -11
- package/lib/components/UIShell/SideNavLinkText.js +5 -6
- package/lib/components/UIShell/SideNavMenu.js +11 -12
- package/lib/components/UIShell/SkipToContent.js +7 -8
- package/lib/components/UIShell/Switcher.js +4 -5
- package/lib/components/UIShell/SwitcherDivider.js +4 -5
- package/lib/components/UnorderedList/UnorderedList.js +6 -7
- package/lib/index.js +36 -36
- package/lib/internal/FloatingMenu.js +26 -28
- package/lib/internal/Selection.js +15 -17
- package/lib/internal/getAnnouncement.d.ts +8 -0
- package/lib/internal/getAnnouncement.js +26 -0
- package/lib/internal/keyboard/match.js +6 -7
- package/lib/internal/useControllableState.d.ts +1 -1
- package/lib/internal/useControllableState.js +8 -9
- package/lib/internal/useDelayedState.js +1 -2
- package/lib/internal/useDocumentLang.d.ts +12 -0
- package/lib/internal/useId.js +2 -4
- package/lib/internal/useMatchMedia.js +1 -2
- package/lib/internal/useMergedRefs.d.ts +1 -1
- package/lib/internal/useNoInteractiveChildren.js +2 -4
- package/lib/internal/useNormalizedInputProps.js +9 -10
- package/lib/internal/useOverflowItems.d.ts +29 -0
- package/lib/internal/useOverflowItems.js +126 -0
- package/lib/internal/useResizeObserver.js +4 -5
- package/lib/internal/useSavedCallback.js +1 -3
- package/lib/internal/wrapFocus.js +20 -29
- package/lib/prop-types/deprecate.js +1 -4
- package/lib/prop-types/deprecateValuesWithin.js +1 -4
- package/lib/prop-types/isRequiredOneOf.js +1 -4
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
- package/lib/tools/events.js +1 -4
- package/lib/tools/mergeRefs.js +9 -14
- package/lib/tools/uniqueId.js +1 -2
- package/lib/tools/wrapComponent.js +9 -11
- package/package.json +21 -19
- package/telemetry.yml +25 -1
- package/es/components/ContentSwitcher/index.js +0 -13
- package/es/feature-flags.d.ts +0 -7
- package/es/internal/useAnnouncer.js +0 -21
- package/lib/components/ContentSwitcher/index.js +0 -18
- package/lib/feature-flags.d.ts +0 -7
- package/lib/internal/useAnnouncer.js +0 -25
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import { Subtract, Add } from '@carbon/icons-react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React, { useContext, useState, useRef, useEffect } from 'react';
|
|
12
|
+
import React, { useContext, useState, useMemo, useCallback, useRef, useEffect } from 'react';
|
|
13
13
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
14
14
|
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -18,6 +18,11 @@ import '../FluidForm/FluidForm.js';
|
|
|
18
18
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
19
19
|
import '../Text/index.js';
|
|
20
20
|
import { clamp } from '../../internal/clamp.js';
|
|
21
|
+
import { useControllableState } from '../../internal/useControllableState.js';
|
|
22
|
+
import { NumberParser, NumberFormatter } from '@carbon/utilities';
|
|
23
|
+
import { ArrowUp, ArrowDown } from '../../internal/keyboard/keys.js';
|
|
24
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
25
|
+
import { NumberFormatOptionsPropType } from './NumberFormatPropTypes.js';
|
|
21
26
|
import { Text } from '../Text/Text.js';
|
|
22
27
|
|
|
23
28
|
var _Subtract, _Add;
|
|
@@ -42,25 +47,30 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
42
47
|
disabled = false,
|
|
43
48
|
disableWheel: disableWheelProp = false,
|
|
44
49
|
defaultValue = 0,
|
|
50
|
+
formatOptions,
|
|
45
51
|
helperText = '',
|
|
46
52
|
hideLabel = false,
|
|
47
53
|
hideSteppers,
|
|
48
54
|
iconDescription,
|
|
49
55
|
id,
|
|
50
|
-
|
|
56
|
+
inputMode,
|
|
51
57
|
invalid = false,
|
|
52
58
|
invalidText,
|
|
59
|
+
label,
|
|
53
60
|
light,
|
|
61
|
+
locale = 'en-US',
|
|
54
62
|
max,
|
|
55
63
|
min,
|
|
56
64
|
onChange,
|
|
57
65
|
onClick,
|
|
58
66
|
onKeyUp,
|
|
67
|
+
pattern = '[0-9]*',
|
|
59
68
|
readOnly,
|
|
60
69
|
size = 'md',
|
|
61
70
|
slug,
|
|
62
71
|
step = 1,
|
|
63
72
|
translateWithId: t = id => defaultTranslations[id],
|
|
73
|
+
type = 'number',
|
|
64
74
|
warn = false,
|
|
65
75
|
warnText = '',
|
|
66
76
|
value: controlledValue,
|
|
@@ -71,6 +81,10 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
71
81
|
isFluid
|
|
72
82
|
} = useContext(FormContext);
|
|
73
83
|
const [isFocused, setIsFocused] = useState(false);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The input value, only used when type=number
|
|
87
|
+
*/
|
|
74
88
|
const [value, setValue] = useState(() => {
|
|
75
89
|
if (controlledValue !== undefined) {
|
|
76
90
|
return controlledValue;
|
|
@@ -84,6 +98,30 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
84
98
|
return 0;
|
|
85
99
|
});
|
|
86
100
|
const [prevControlledValue, setPrevControlledValue] = useState(controlledValue);
|
|
101
|
+
const numberParser = useMemo(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);
|
|
102
|
+
/**
|
|
103
|
+
* The currently parsed number value.
|
|
104
|
+
* Only used when type=text
|
|
105
|
+
* Updated based on the `value` as the user types.
|
|
106
|
+
*/
|
|
107
|
+
const [numberValue, setNumberValue, isControlled] = useControllableState({
|
|
108
|
+
name: 'NumberInput',
|
|
109
|
+
defaultValue: typeof defaultValue === 'string' ? numberParser.parse(defaultValue) : defaultValue,
|
|
110
|
+
value: typeof controlledValue === 'string' ? numberParser.parse(controlledValue) : controlledValue
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The current text value of the input.
|
|
115
|
+
* Only used when type=text
|
|
116
|
+
* Updated as the user types and formatted on blur.
|
|
117
|
+
*/
|
|
118
|
+
const [inputValue, setInputValue] = React.useState(() => isNaN(numberValue) ? '' : new NumberFormatter(locale, formatOptions).format(numberValue));
|
|
119
|
+
const numberingSystem = useMemo(() => numberParser.getNumberingSystem(inputValue), [numberParser, inputValue]);
|
|
120
|
+
const numberFormatter = useMemo(() => new NumberFormatter(locale, {
|
|
121
|
+
...formatOptions,
|
|
122
|
+
numberingSystem
|
|
123
|
+
}), [locale, formatOptions, numberingSystem]);
|
|
124
|
+
const format = useCallback(value => isNaN(value) || value === null ? '' : numberFormatter.format(value), [numberFormatter]);
|
|
87
125
|
const inputRef = useRef(null);
|
|
88
126
|
const ref = useMergedRefs([forwardRef, inputRef]);
|
|
89
127
|
const numberInputClasses = cx({
|
|
@@ -98,7 +136,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
98
136
|
const isInputValid = getInputValidity({
|
|
99
137
|
allowEmpty,
|
|
100
138
|
invalid,
|
|
101
|
-
value,
|
|
139
|
+
value: type === 'number' ? value : numberValue,
|
|
102
140
|
max,
|
|
103
141
|
min
|
|
104
142
|
});
|
|
@@ -140,13 +178,24 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
140
178
|
if (disabled) {
|
|
141
179
|
return;
|
|
142
180
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
onChange
|
|
181
|
+
if (type === 'number') {
|
|
182
|
+
const state = {
|
|
183
|
+
value: allowEmpty && event.target.value === '' ? '' : Number(event.target.value),
|
|
184
|
+
direction: value < event.target.value ? 'up' : 'down'
|
|
185
|
+
};
|
|
186
|
+
setValue(state.value);
|
|
187
|
+
if (onChange) {
|
|
188
|
+
onChange(event, state);
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (type === 'text') {
|
|
193
|
+
const _value = allowEmpty && event.target.value === '' ? '' : event.target.value;
|
|
194
|
+
setNumberValue(numberParser.parse(_value));
|
|
195
|
+
setInputValue(_value);
|
|
196
|
+
// The onChange prop isn't called here because it will be called on blur
|
|
197
|
+
// or on click of a stepper, after the number is parsed and formatted
|
|
198
|
+
// according to the locale.
|
|
150
199
|
}
|
|
151
200
|
}
|
|
152
201
|
const handleFocus = evt => {
|
|
@@ -168,21 +217,44 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
168
217
|
const parts = num.toString().split('.');
|
|
169
218
|
return parts[1] ? parts[1].length : 0;
|
|
170
219
|
};
|
|
171
|
-
const
|
|
220
|
+
const handleStep = (event, direction) => {
|
|
172
221
|
if (inputRef.current) {
|
|
173
|
-
const currentValue = Number(inputRef.current.value);
|
|
222
|
+
const currentValue = type === 'number' ? Number(inputRef.current.value) : numberParser.parse(inputRef.current.value);
|
|
174
223
|
const rawValue = direction === 'up' ? currentValue + step : currentValue - step;
|
|
175
224
|
const precision = Math.max(getDecimalPlaces(currentValue), getDecimalPlaces(step));
|
|
176
225
|
const floatValue = parseFloat(rawValue.toFixed(precision));
|
|
177
226
|
const newValue = clamp(floatValue, min ?? -Infinity, max ?? Infinity);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
227
|
+
let state;
|
|
228
|
+
if (type === 'number') {
|
|
229
|
+
state = {
|
|
230
|
+
value: allowEmpty && inputRef.current.value === '' && step === 0 ? '' : newValue,
|
|
231
|
+
direction
|
|
232
|
+
};
|
|
233
|
+
setValue(state.value);
|
|
234
|
+
}
|
|
235
|
+
if (type === 'text') {
|
|
236
|
+
const formattedNewValue = format(newValue);
|
|
237
|
+
state = {
|
|
238
|
+
value: allowEmpty && inputRef.current.value === '' && step === 0 ? '' : formattedNewValue,
|
|
239
|
+
direction
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// newValue does not need to be parsed because it is derived from
|
|
243
|
+
// currentValue, which is parsed at the beginning of this function
|
|
244
|
+
setNumberValue(newValue);
|
|
245
|
+
setInputValue(formattedNewValue);
|
|
246
|
+
}
|
|
183
247
|
if (onChange) {
|
|
184
248
|
onChange(event, state);
|
|
185
249
|
}
|
|
250
|
+
return state;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
const handleStepperClick = (event, direction) => {
|
|
254
|
+
if (inputRef.current) {
|
|
255
|
+
const {
|
|
256
|
+
state
|
|
257
|
+
} = handleStep(event, direction);
|
|
186
258
|
if (onClick) {
|
|
187
259
|
onClick(event, state);
|
|
188
260
|
}
|
|
@@ -234,6 +306,15 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
234
306
|
onClick: onClick,
|
|
235
307
|
onChange: handleOnChange,
|
|
236
308
|
onKeyUp: onKeyUp,
|
|
309
|
+
onKeyDown: e => {
|
|
310
|
+
if (type === 'text') {
|
|
311
|
+
match(e, ArrowUp) && handleStep(e, 'up');
|
|
312
|
+
match(e, ArrowDown) && handleStep(e, 'down');
|
|
313
|
+
}
|
|
314
|
+
if (rest?.onKeyDown) {
|
|
315
|
+
rest?.onKeyDown(e);
|
|
316
|
+
}
|
|
317
|
+
},
|
|
237
318
|
onFocus: e => {
|
|
238
319
|
if (disableWheelProp) {
|
|
239
320
|
e.target.addEventListener('wheel', disableWheel);
|
|
@@ -246,15 +327,32 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
246
327
|
if (disableWheelProp) {
|
|
247
328
|
e.target.removeEventListener('wheel', disableWheel);
|
|
248
329
|
}
|
|
330
|
+
if (type === 'text') {
|
|
331
|
+
// When isControlled, the current inputValue needs re-parsed
|
|
332
|
+
// because the consumer's onChange hasn't been called yet and
|
|
333
|
+
// the `numberValue` we have in state is the (stale) value
|
|
334
|
+
// they've passed in.
|
|
335
|
+
const _numberValue = isControlled ? numberParser.parse(inputValue) : numberValue;
|
|
336
|
+
const formattedValue = isNaN(_numberValue) ? '' : format(_numberValue);
|
|
337
|
+
setInputValue(formattedValue);
|
|
338
|
+
if (onChange) {
|
|
339
|
+
const state = {
|
|
340
|
+
value: formattedValue,
|
|
341
|
+
direction: value < e.target.value ? 'up' : 'down'
|
|
342
|
+
};
|
|
343
|
+
onChange(e, state);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
249
346
|
if (rest.onBlur) {
|
|
250
347
|
rest.onBlur(e);
|
|
251
348
|
}
|
|
252
349
|
},
|
|
253
|
-
pattern:
|
|
350
|
+
pattern: pattern,
|
|
351
|
+
inputMode: inputMode,
|
|
254
352
|
readOnly: readOnly,
|
|
255
353
|
step: step,
|
|
256
|
-
type:
|
|
257
|
-
value: value
|
|
354
|
+
type: type,
|
|
355
|
+
value: type === 'number' ? value : inputValue
|
|
258
356
|
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
259
357
|
className: `${prefix}--number__input-inner-wrapper--decorator`
|
|
260
358
|
}, normalizedDecorator) : '', Icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -311,13 +409,20 @@ NumberInput.propTypes = {
|
|
|
311
409
|
*/
|
|
312
410
|
defaultValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
313
411
|
/**
|
|
314
|
-
* Specify if the wheel functionality for the input should be disabled, or
|
|
412
|
+
* Specify if the wheel functionality for the input should be disabled, or no t
|
|
315
413
|
*/
|
|
316
414
|
disableWheel: PropTypes.bool,
|
|
317
415
|
/**
|
|
318
416
|
* Specify if the control should be disabled, or not
|
|
319
417
|
*/
|
|
320
418
|
disabled: PropTypes.bool,
|
|
419
|
+
/**
|
|
420
|
+
* **Experimental:** Specify Intl.NumberFormat options applied to internal
|
|
421
|
+
* number parsing and formatting. Use with `type="text"`, has no effect when
|
|
422
|
+
* `type="number"`.
|
|
423
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
424
|
+
*/
|
|
425
|
+
formatOptions: NumberFormatOptionsPropType,
|
|
321
426
|
/**
|
|
322
427
|
* Provide text that is used alongside the control label for additional help
|
|
323
428
|
*/
|
|
@@ -338,6 +443,12 @@ NumberInput.propTypes = {
|
|
|
338
443
|
* Specify a custom `id` for the input
|
|
339
444
|
*/
|
|
340
445
|
id: PropTypes.string.isRequired,
|
|
446
|
+
/**
|
|
447
|
+
* Instruct the browser which keyboard to display on mobile devices. Note that
|
|
448
|
+
* standard numeric keyboards vary across devices and operating systems.
|
|
449
|
+
* @see https://css-tricks.com/everything-you-ever-wanted-to-know-about-inputmode/
|
|
450
|
+
*/
|
|
451
|
+
inputMode: PropTypes.oneOf(['none', 'text', 'tel', 'url', 'email', 'numeric', 'decimal', 'search']),
|
|
341
452
|
/**
|
|
342
453
|
* Specify if the currently value is invalid.
|
|
343
454
|
*/
|
|
@@ -355,6 +466,12 @@ NumberInput.propTypes = {
|
|
|
355
466
|
* `true` to use the light version.
|
|
356
467
|
*/
|
|
357
468
|
light: deprecate(PropTypes.bool, 'The `light` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
|
|
469
|
+
/**
|
|
470
|
+
* **Experimental:** Specify a [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt)
|
|
471
|
+
* language code for parsing and formatting. Use with `type="text"`, has no
|
|
472
|
+
* effect when `type="number"`.
|
|
473
|
+
*/
|
|
474
|
+
locale: PropTypes.string,
|
|
358
475
|
/**
|
|
359
476
|
* The maximum value.
|
|
360
477
|
*/
|
|
@@ -366,6 +483,9 @@ NumberInput.propTypes = {
|
|
|
366
483
|
/**
|
|
367
484
|
* Provide an optional handler that is called when the internal state of
|
|
368
485
|
* NumberInput changes. This handler is called with event and state info.
|
|
486
|
+
* When type="number", this is called on every change of the input.
|
|
487
|
+
* When type="text", this is only called on blur after the number has been
|
|
488
|
+
* parsed and formatted.
|
|
369
489
|
* `(event, { value, direction }) => void`
|
|
370
490
|
*/
|
|
371
491
|
onChange: PropTypes.func,
|
|
@@ -377,6 +497,11 @@ NumberInput.propTypes = {
|
|
|
377
497
|
* Provide an optional function to be called when a key is pressed in the number input
|
|
378
498
|
*/
|
|
379
499
|
onKeyUp: PropTypes.func,
|
|
500
|
+
/**
|
|
501
|
+
* When type="text", provide an optional pattern to restrict user input. Has
|
|
502
|
+
* no effect when type="number".
|
|
503
|
+
*/
|
|
504
|
+
pattern: PropTypes.string,
|
|
380
505
|
/**
|
|
381
506
|
* Specify if the component should be read-only
|
|
382
507
|
*/
|
|
@@ -386,17 +511,25 @@ NumberInput.propTypes = {
|
|
|
386
511
|
*/
|
|
387
512
|
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
388
513
|
/**
|
|
389
|
-
* **Experimental**: Provide a `Slug` component to be rendered inside the
|
|
514
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the
|
|
515
|
+
* `NumberInput` component
|
|
390
516
|
*/
|
|
391
517
|
slug: deprecate(PropTypes.node, 'The `slug` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `decorator` prop. It will be moved in the next major release.'),
|
|
392
518
|
/**
|
|
393
|
-
* Specify how much the values should increase/decrease upon clicking on
|
|
519
|
+
* Specify how much the values should increase/decrease upon clicking on
|
|
520
|
+
* up/down button
|
|
394
521
|
*/
|
|
395
522
|
step: PropTypes.number,
|
|
396
523
|
/**
|
|
397
524
|
* Provide custom text for the component for each translation id
|
|
398
525
|
*/
|
|
399
526
|
translateWithId: PropTypes.func,
|
|
527
|
+
/**
|
|
528
|
+
* **Experimental**: Specify if the input should be of type text or number.
|
|
529
|
+
* Use type="text" with `locale`, `formatOptions`, and guide user input with
|
|
530
|
+
* `pattern` and `inputMode`.
|
|
531
|
+
*/
|
|
532
|
+
type: PropTypes.oneOf(['number', 'text']),
|
|
400
533
|
/**
|
|
401
534
|
* Specify the value of the input
|
|
402
535
|
*/
|
|
@@ -410,13 +543,12 @@ NumberInput.propTypes = {
|
|
|
410
543
|
*/
|
|
411
544
|
warnText: PropTypes.node
|
|
412
545
|
};
|
|
413
|
-
const Label =
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
} = _ref;
|
|
546
|
+
const Label = ({
|
|
547
|
+
disabled,
|
|
548
|
+
id,
|
|
549
|
+
hideLabel,
|
|
550
|
+
label
|
|
551
|
+
}) => {
|
|
420
552
|
const prefix = usePrefix();
|
|
421
553
|
const className = cx({
|
|
422
554
|
[`${prefix}--label`]: true,
|
|
@@ -438,12 +570,11 @@ Label.propTypes = {
|
|
|
438
570
|
id: PropTypes.string,
|
|
439
571
|
label: PropTypes.node
|
|
440
572
|
};
|
|
441
|
-
function HelperText(
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
} = _ref2;
|
|
573
|
+
function HelperText({
|
|
574
|
+
disabled,
|
|
575
|
+
description,
|
|
576
|
+
id
|
|
577
|
+
}) {
|
|
447
578
|
const prefix = usePrefix();
|
|
448
579
|
const className = cx(`${prefix}--form__helper-text`, {
|
|
449
580
|
[`${prefix}--form__helper-text--disabled`]: disabled
|
|
@@ -476,14 +607,13 @@ HelperText.propTypes = {
|
|
|
476
607
|
* @param {number} config.min
|
|
477
608
|
* @returns {boolean}
|
|
478
609
|
*/
|
|
479
|
-
function getInputValidity(
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
} = _ref3;
|
|
610
|
+
function getInputValidity({
|
|
611
|
+
allowEmpty,
|
|
612
|
+
invalid,
|
|
613
|
+
value,
|
|
614
|
+
max,
|
|
615
|
+
min
|
|
616
|
+
}) {
|
|
487
617
|
if (invalid) {
|
|
488
618
|
return false;
|
|
489
619
|
}
|
|
@@ -11,14 +11,13 @@ import React from 'react';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
function OrderedList(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
14
|
+
function OrderedList({
|
|
15
|
+
className,
|
|
16
|
+
nested = false,
|
|
17
|
+
native = false,
|
|
18
|
+
isExpressive = false,
|
|
19
|
+
...other
|
|
20
|
+
}) {
|
|
22
21
|
const prefix = usePrefix();
|
|
23
22
|
const classNames = cx({
|
|
24
23
|
[`${prefix}--list--ordered`]: !native,
|
|
@@ -106,7 +106,7 @@ export interface OverflowMenuProps {
|
|
|
106
106
|
*/
|
|
107
107
|
selectorPrimaryFocus?: string;
|
|
108
108
|
/**
|
|
109
|
-
* Specify the size of the OverflowMenu. Currently supports either `sm`,
|
|
109
|
+
* Specify the size of the OverflowMenu. Currently supports either `sm`, `md` (default) or `lg` as an option.
|
|
110
110
|
*/
|
|
111
111
|
size?: 'sm' | 'md' | 'lg';
|
|
112
112
|
/**
|
|
@@ -25,10 +25,7 @@ import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
|
25
25
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
26
26
|
|
|
27
27
|
const getInstanceId = setupGetInstanceId();
|
|
28
|
-
const on =
|
|
29
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
30
|
-
args[_key - 1] = arguments[_key];
|
|
31
|
-
}
|
|
28
|
+
const on = (target, ...args) => {
|
|
32
29
|
target.addEventListener(...args);
|
|
33
30
|
return {
|
|
34
31
|
release() {
|
|
@@ -91,33 +88,32 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
91
88
|
};
|
|
92
89
|
}
|
|
93
90
|
};
|
|
94
|
-
const OverflowMenu = /*#__PURE__*/forwardRef((
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
} = _ref;
|
|
91
|
+
const OverflowMenu = /*#__PURE__*/forwardRef(({
|
|
92
|
+
align,
|
|
93
|
+
['aria-label']: ariaLabel = null,
|
|
94
|
+
ariaLabel: deprecatedAriaLabel,
|
|
95
|
+
children,
|
|
96
|
+
className,
|
|
97
|
+
direction = DIRECTION_BOTTOM,
|
|
98
|
+
flipped = false,
|
|
99
|
+
focusTrap = true,
|
|
100
|
+
iconClass,
|
|
101
|
+
iconDescription = 'Options',
|
|
102
|
+
id,
|
|
103
|
+
light,
|
|
104
|
+
menuOffset = getMenuOffset,
|
|
105
|
+
menuOffsetFlip = getMenuOffset,
|
|
106
|
+
menuOptionsClass,
|
|
107
|
+
onClick = noopFn,
|
|
108
|
+
onClose = noopFn,
|
|
109
|
+
onOpen = noopFn,
|
|
110
|
+
open: openProp,
|
|
111
|
+
renderIcon: IconElement = OverflowMenuVertical,
|
|
112
|
+
selectorPrimaryFocus = '[data-floating-menu-primary-focus]',
|
|
113
|
+
size = 'md',
|
|
114
|
+
innerRef,
|
|
115
|
+
...other
|
|
116
|
+
}, ref) => {
|
|
121
117
|
const prefix = useContext(PrefixContext);
|
|
122
118
|
const [open, setOpen] = useState(openProp ?? false);
|
|
123
119
|
const [click, setClick] = useState(false);
|
|
@@ -147,18 +143,17 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
147
143
|
setHasMountedTrigger(true);
|
|
148
144
|
}
|
|
149
145
|
}, []);
|
|
150
|
-
|
|
151
|
-
// Call `onClose` when menu closes.
|
|
152
146
|
useEffect(() => {
|
|
153
|
-
if (
|
|
147
|
+
if (open && !prevOpenState.current) {
|
|
148
|
+
onOpen();
|
|
149
|
+
} else if (!open && prevOpenState.current) {
|
|
154
150
|
onClose();
|
|
155
151
|
}
|
|
156
152
|
prevOpenState.current = open;
|
|
157
|
-
}, [open, onClose]);
|
|
158
|
-
useOutsideClick(wrapperRef,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
} = _ref2;
|
|
153
|
+
}, [open, onClose, onOpen]);
|
|
154
|
+
useOutsideClick(wrapperRef, ({
|
|
155
|
+
target
|
|
156
|
+
}) => {
|
|
162
157
|
if (open && (!menuBodyRef.current || target instanceof Node && !menuBodyRef.current.contains(target))) {
|
|
163
158
|
closeMenu();
|
|
164
159
|
}
|
|
@@ -218,11 +213,10 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
218
213
|
* Focuses the next enabled overflow menu item given the currently focused
|
|
219
214
|
* item index and direction to move.
|
|
220
215
|
*/
|
|
221
|
-
const handleOverflowMenuItemFocus =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
} = _ref3;
|
|
216
|
+
const handleOverflowMenuItemFocus = ({
|
|
217
|
+
currentIndex = 0,
|
|
218
|
+
direction
|
|
219
|
+
}) => {
|
|
226
220
|
const enabledIndices = Children.toArray(children).reduce((acc, curr, i) => {
|
|
227
221
|
if (/*#__PURE__*/React.isValidElement(curr) && !curr.props.disabled) {
|
|
228
222
|
acc.push(i);
|
|
@@ -265,7 +259,6 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
265
259
|
}
|
|
266
260
|
}
|
|
267
261
|
}, !hasFocusin);
|
|
268
|
-
onOpen();
|
|
269
262
|
};
|
|
270
263
|
const getTarget = () => {
|
|
271
264
|
const triggerEl = triggerRef.current;
|
|
@@ -469,7 +462,7 @@ OverflowMenu.propTypes = {
|
|
|
469
462
|
*/
|
|
470
463
|
selectorPrimaryFocus: PropTypes.string,
|
|
471
464
|
/**
|
|
472
|
-
* Specify the size of the OverflowMenu. Currently supports either `sm`,
|
|
465
|
+
* Specify the size of the OverflowMenu. Currently supports either `sm`, `md` (default) or `lg` as an option.
|
|
473
466
|
*/
|
|
474
467
|
size: PropTypes.oneOf(['sm', 'md', 'lg'])
|
|
475
468
|
};
|
|
@@ -23,19 +23,18 @@ import deprecateValuesWithin from '../../../prop-types/deprecateValuesWithin.js'
|
|
|
23
23
|
import { mapPopoverAlign } from '../../../tools/mapPopoverAlign.js';
|
|
24
24
|
|
|
25
25
|
const defaultSize = 'md';
|
|
26
|
-
const OverflowMenu = /*#__PURE__*/React.forwardRef(function OverflowMenu(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} = _ref;
|
|
26
|
+
const OverflowMenu = /*#__PURE__*/React.forwardRef(function OverflowMenu({
|
|
27
|
+
autoAlign = false,
|
|
28
|
+
children,
|
|
29
|
+
className,
|
|
30
|
+
label = 'Options',
|
|
31
|
+
renderIcon: IconElement = OverflowMenuVertical,
|
|
32
|
+
size = defaultSize,
|
|
33
|
+
menuAlignment = 'bottom-start',
|
|
34
|
+
tooltipAlignment,
|
|
35
|
+
menuTarget,
|
|
36
|
+
...rest
|
|
37
|
+
}, forwardRef) {
|
|
39
38
|
const enableFloatingStyles = useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
|
|
40
39
|
const {
|
|
41
40
|
refs,
|