@carbon/react 1.83.0 → 1.84.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +980 -945
- package/README.md +1 -1
- package/es/components/AILabel/index.js +27 -30
- package/es/components/AISkeleton/AISkeletonIcon.js +4 -5
- package/es/components/AISkeleton/AISkeletonPlaceholder.js +4 -5
- package/es/components/AISkeleton/AISkeletonText.js +4 -5
- package/es/components/Accordion/Accordion.Skeleton.js +9 -10
- package/es/components/Accordion/Accordion.js +10 -11
- package/es/components/Accordion/AccordionItem.js +13 -14
- package/es/components/Accordion/AccordionProvider.js +4 -5
- package/es/components/AspectRatio/AspectRatio.js +7 -8
- package/es/components/BadgeIndicator/index.js +5 -6
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +4 -5
- package/es/components/Button/Button.Skeleton.js +7 -8
- package/es/components/Button/ButtonBase.js +23 -24
- package/es/components/ChatButton/ChatButton.Skeleton.js +5 -6
- package/es/components/ChatButton/ChatButton.js +11 -12
- package/es/components/Checkbox/Checkbox.Skeleton.js +4 -5
- package/es/components/Checkbox/Checkbox.js +19 -20
- package/es/components/CheckboxGroup/CheckboxGroup.js +16 -17
- package/es/components/ClassPrefix/index.js +4 -5
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +5 -6
- package/es/components/CodeSnippet/CodeSnippet.js +25 -26
- package/es/components/ComboBox/ComboBox.js +24 -30
- package/es/components/ComboBox/tools/filter.js +9 -12
- package/es/components/ComboButton/index.js +16 -18
- package/es/components/ComposedModal/ComposedModal.js +31 -34
- package/es/components/ComposedModal/ModalFooter.js +37 -42
- package/es/components/ComposedModal/ModalHeader.js +14 -15
- package/es/components/ContainedList/ContainedList.js +10 -11
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +9 -29
- package/es/components/ContentSwitcher/ContentSwitcher.js +96 -128
- package/es/components/ContentSwitcher/index.d.ts +3 -4
- package/es/components/ContextMenu/useContextMenu.js +1 -2
- package/es/components/Copy/Copy.js +11 -12
- package/es/components/CopyButton/CopyButton.js +10 -11
- package/es/components/DataTable/DataTable.js +45 -53
- package/es/components/DataTable/Table.js +15 -18
- package/es/components/DataTable/TableBatchAction.js +8 -11
- package/es/components/DataTable/TableBatchActions.js +18 -20
- package/es/components/DataTable/TableBody.js +8 -11
- package/es/components/DataTable/TableContainer.js +9 -10
- package/es/components/DataTable/TableDecoratorRow.js +4 -5
- package/es/components/DataTable/TableExpandHeader.js +14 -15
- package/es/components/DataTable/TableExpandRow.js +13 -14
- package/es/components/DataTable/TableExpandedRow.js +6 -7
- package/es/components/DataTable/TableHeader.js +15 -16
- package/es/components/DataTable/TableSelectAll.js +11 -12
- package/es/components/DataTable/TableSelectRow.js +12 -13
- package/es/components/DataTable/TableSlugRow.js +4 -5
- package/es/components/DataTable/TableToolbar.js +7 -8
- package/es/components/DataTable/TableToolbarMenu.js +8 -9
- package/es/components/DataTable/TableToolbarSearch.js +22 -24
- package/es/components/DataTable/state/sorting.js +3 -4
- package/es/components/DataTable/tools/filter.js +10 -12
- package/es/components/DataTable/tools/normalize.js +6 -8
- package/es/components/DataTable/tools/sorting.js +24 -30
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +11 -12
- package/es/components/DatePicker/DatePicker.Skeleton.js +7 -8
- package/es/components/DatePicker/DatePicker.js +88 -65
- package/es/components/DatePickerInput/DatePickerInput.js +5 -6
- package/es/components/Dialog/index.d.ts +193 -8
- package/es/components/Dialog/index.js +454 -35
- package/es/components/Dropdown/Dropdown.Skeleton.js +6 -7
- package/es/components/Dropdown/Dropdown.js +40 -43
- package/es/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/es/components/ExpandableSearch/ExpandableSearch.js +9 -10
- package/es/components/FeatureFlags/index.js +11 -12
- package/es/components/FileUploader/FileUploader.Skeleton.js +4 -5
- package/es/components/FileUploader/FileUploader.js +22 -24
- package/es/components/FileUploader/FileUploaderButton.js +16 -17
- package/es/components/FileUploader/FileUploaderDropContainer.js +15 -16
- package/es/components/FileUploader/FileUploaderItem.js +13 -14
- package/es/components/FileUploader/Filename.js +9 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +4 -5
- package/es/components/FluidComboBox/FluidComboBox.js +5 -6
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +5 -6
- package/es/components/FluidDatePicker/FluidDatePicker.js +10 -11
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +4 -5
- package/es/components/FluidDropdown/FluidDropdown.js +5 -6
- package/es/components/FluidForm/FluidForm.js +5 -6
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +4 -5
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +6 -7
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +4 -5
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/es/components/FluidNumberInput/FluidNumberInput.js +38 -5
- package/es/components/FluidSearch/FluidSearch.Skeleton.js +4 -5
- package/es/components/FluidSearch/FluidSearch.js +4 -5
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +4 -5
- package/es/components/FluidSelect/FluidSelect.js +5 -6
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +4 -5
- package/es/components/FluidTextArea/FluidTextArea.js +4 -5
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +4 -5
- package/es/components/FluidTextInput/FluidTextInput.js +5 -6
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +5 -6
- package/es/components/FluidTimePicker/FluidTimePicker.js +11 -12
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +5 -6
- package/es/components/Form/Form.js +5 -6
- package/es/components/FormGroup/FormGroup.js +11 -12
- package/es/components/FormItem/FormItem.js +5 -6
- package/es/components/FormLabel/FormLabel.js +6 -7
- package/es/components/Grid/CSSGrid.js +17 -19
- package/es/components/Grid/Column.js +28 -27
- package/es/components/Grid/ColumnHang.js +6 -7
- package/es/components/Grid/FlexGrid.js +9 -10
- package/es/components/Grid/GridContext.js +5 -6
- package/es/components/Grid/Row.js +8 -9
- package/es/components/Heading/index.js +5 -6
- package/es/components/Icon/Icon.Skeleton.js +4 -5
- package/es/components/IconButton/index.js +20 -21
- package/es/components/IconIndicator/index.js +7 -8
- package/es/components/IdPrefix/index.js +4 -5
- package/es/components/InlineLoading/InlineLoading.js +9 -10
- package/es/components/Layer/index.js +8 -9
- package/es/components/Layout/index.js +21 -26
- package/es/components/LayoutDirection/LayoutDirection.js +6 -7
- package/es/components/Link/Link.d.ts +1 -1
- package/es/components/Link/Link.js +14 -15
- package/es/components/ListBox/ListBoxField.js +6 -7
- package/es/components/ListBox/ListBoxMenu.js +5 -6
- package/es/components/ListBox/ListBoxMenuIcon.js +4 -5
- package/es/components/ListBox/ListBoxMenuItem.js +8 -10
- package/es/components/ListBox/ListBoxSelection.js +8 -9
- package/es/components/ListBox/next/ListBoxSelection.js +9 -10
- package/es/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/es/components/ListItem/ListItem.js +5 -6
- package/es/components/Loading/Loading.js +8 -9
- package/es/components/Menu/Menu.js +23 -24
- package/es/components/Menu/MenuItem.js +39 -44
- package/es/components/MenuButton/index.js +16 -18
- package/es/components/Modal/Modal.js +55 -63
- package/es/components/ModalWrapper/ModalWrapper.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +46 -48
- package/es/components/MultiSelect/MultiSelect.js +43 -45
- package/es/components/MultiSelect/tools/sorting.js +11 -15
- package/es/components/Notification/Notification.js +96 -105
- package/es/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/es/components/NumberInput/NumberFormatPropTypes.js +40 -0
- package/es/components/NumberInput/NumberInput.Skeleton.js +6 -7
- package/es/components/NumberInput/NumberInput.d.ts +39 -3
- package/es/components/NumberInput/NumberInput.js +174 -44
- package/es/components/OrderedList/OrderedList.js +7 -8
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +35 -41
- package/es/components/OverflowMenu/next/index.js +12 -13
- package/es/components/PageHeader/PageHeader.d.ts +29 -5
- package/es/components/PageHeader/PageHeader.js +119 -73
- package/es/components/Pagination/Pagination.Skeleton.js +4 -5
- package/es/components/Pagination/Pagination.js +24 -25
- package/es/components/Pagination/experimental/PageSelector.js +8 -9
- package/es/components/Pagination/experimental/Pagination.js +20 -21
- package/es/components/PaginationNav/PaginationNav.js +33 -38
- package/es/components/Popover/index.js +26 -28
- package/es/components/ProgressBar/ProgressBar.js +11 -12
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
- package/es/components/ProgressIndicator/ProgressIndicator.js +29 -32
- package/es/components/RadioTile/RadioTile.js +17 -18
- package/es/components/Search/Search.Skeleton.js +5 -6
- package/es/components/Search/Search.js +26 -28
- package/es/components/Select/Select.Skeleton.js +5 -6
- package/es/components/Select/Select.js +24 -25
- package/es/components/SelectItem/SelectItem.js +8 -9
- package/es/components/SelectItemGroup/SelectItemGroup.js +7 -8
- package/es/components/ShapeIndicator/index.js +7 -8
- package/es/components/SkeletonIcon/SkeletonIcon.js +4 -5
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -5
- package/es/components/SkeletonText/SkeletonText.js +8 -9
- package/es/components/Slider/Slider.Skeleton.js +8 -9
- package/es/components/Slider/Slider.js +69 -83
- package/es/components/Slider/SliderHandles.js +6 -6
- package/es/components/StructuredList/StructuredList.Skeleton.js +5 -6
- package/es/components/Tabs/Tabs.Skeleton.js +5 -6
- package/es/components/Tabs/Tabs.js +83 -98
- package/es/components/Tabs/usePressable.js +7 -8
- package/es/components/Tag/DismissibleTag.js +16 -17
- package/es/components/Tag/OperationalTag.js +10 -11
- package/es/components/Tag/SelectableTag.js +13 -14
- package/es/components/Tag/Tag.Skeleton.js +5 -6
- package/es/components/Tag/Tag.js +19 -20
- package/es/components/Text/Text.js +6 -7
- package/es/components/Text/TextDirection.js +5 -6
- package/es/components/TextArea/TextArea.js +3 -3
- package/es/components/TextInput/ControlledPasswordInput.js +24 -25
- package/es/components/TextInput/PasswordInput.js +26 -27
- package/es/components/TextInput/TextInput.Skeleton.js +5 -6
- package/es/components/TextInput/TextInput.js +27 -28
- package/es/components/TextInput/util.js +14 -17
- package/es/components/Theme/index.js +10 -12
- package/es/components/Tile/Tile.js +68 -74
- package/es/components/Toggle/Toggle.Skeleton.js +4 -5
- package/es/components/Toggle/Toggle.js +17 -18
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +6 -7
- package/es/components/Toggletip/index.js +33 -39
- package/es/components/Tooltip/DefinitionTooltip.js +13 -14
- package/es/components/Tooltip/Tooltip.js +15 -16
- package/es/components/TreeView/TreeNode.js +20 -21
- package/es/components/TreeView/TreeView.js +14 -16
- package/es/components/UIShell/Content.js +6 -7
- package/es/components/UIShell/Header.js +5 -6
- package/es/components/UIShell/HeaderContainer.js +5 -6
- package/es/components/UIShell/HeaderGlobalAction.js +12 -13
- package/es/components/UIShell/HeaderMenu.d.ts +10 -112
- package/es/components/UIShell/HeaderMenu.js +154 -201
- package/es/components/UIShell/HeaderMenuButton.js +10 -11
- package/es/components/UIShell/HeaderMenuItem.js +10 -11
- package/es/components/UIShell/HeaderName.js +6 -7
- package/es/components/UIShell/HeaderNavigation.js +7 -8
- package/es/components/UIShell/HeaderPanel.js +9 -10
- package/es/components/UIShell/HeaderSideNavItems.js +5 -6
- package/es/components/UIShell/Link.js +8 -9
- package/es/components/UIShell/SideNav.js +23 -25
- package/es/components/UIShell/SideNavDetails.js +6 -7
- package/es/components/UIShell/SideNavDivider.js +3 -4
- package/es/components/UIShell/SideNavFooter.js +6 -7
- package/es/components/UIShell/SideNavHeader.js +5 -6
- package/es/components/UIShell/SideNavIcon.js +5 -6
- package/es/components/UIShell/SideNavItem.js +5 -6
- package/es/components/UIShell/SideNavItems.js +5 -6
- package/es/components/UIShell/SideNavLink.js +10 -11
- package/es/components/UIShell/SideNavLinkText.js +5 -6
- package/es/components/UIShell/SideNavMenu.js +11 -12
- package/es/components/UIShell/SkipToContent.js +7 -8
- package/es/components/UIShell/Switcher.js +4 -5
- package/es/components/UIShell/SwitcherDivider.js +4 -5
- package/es/components/UnorderedList/UnorderedList.js +6 -7
- package/es/index.js +2 -2
- package/es/internal/FloatingMenu.js +26 -28
- package/es/internal/Selection.js +15 -17
- package/es/internal/getAnnouncement.d.ts +8 -0
- package/es/internal/getAnnouncement.js +22 -0
- package/es/internal/keyboard/match.js +6 -7
- package/es/internal/useControllableState.d.ts +1 -1
- package/es/internal/useControllableState.js +8 -9
- package/es/internal/useDelayedState.js +1 -2
- package/es/internal/useDocumentLang.d.ts +12 -0
- package/es/internal/useId.js +2 -4
- package/es/internal/useMatchMedia.js +1 -2
- package/es/internal/useMergedRefs.d.ts +1 -1
- package/es/internal/useNoInteractiveChildren.js +2 -4
- package/es/internal/useNormalizedInputProps.js +9 -10
- package/es/internal/useResizeObserver.js +4 -5
- package/es/internal/useSavedCallback.js +1 -3
- package/es/internal/wrapFocus.js +20 -29
- package/es/prop-types/deprecate.js +1 -4
- package/es/prop-types/deprecateValuesWithin.js +1 -4
- package/es/prop-types/isRequiredOneOf.js +1 -4
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
- package/es/tools/events.js +1 -4
- package/es/tools/mergeRefs.js +9 -14
- package/es/tools/uniqueId.js +1 -2
- package/es/tools/wrapComponent.js +9 -11
- package/lib/components/AILabel/index.js +27 -30
- package/lib/components/AISkeleton/AISkeletonIcon.js +4 -5
- package/lib/components/AISkeleton/AISkeletonPlaceholder.js +4 -5
- package/lib/components/AISkeleton/AISkeletonText.js +4 -5
- package/lib/components/Accordion/Accordion.Skeleton.js +9 -10
- package/lib/components/Accordion/Accordion.js +10 -11
- package/lib/components/Accordion/AccordionItem.js +13 -14
- package/lib/components/Accordion/AccordionProvider.js +4 -5
- package/lib/components/AspectRatio/AspectRatio.js +7 -8
- package/lib/components/BadgeIndicator/index.js +5 -6
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +4 -5
- package/lib/components/Button/Button.Skeleton.js +7 -8
- package/lib/components/Button/ButtonBase.js +23 -24
- package/lib/components/ChatButton/ChatButton.Skeleton.js +5 -6
- package/lib/components/ChatButton/ChatButton.js +11 -12
- package/lib/components/Checkbox/Checkbox.Skeleton.js +4 -5
- package/lib/components/Checkbox/Checkbox.js +19 -20
- package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -17
- package/lib/components/ClassPrefix/index.js +4 -5
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +5 -6
- package/lib/components/CodeSnippet/CodeSnippet.js +25 -26
- package/lib/components/ComboBox/ComboBox.js +24 -30
- package/lib/components/ComboBox/tools/filter.js +9 -12
- package/lib/components/ComboButton/index.js +16 -18
- package/lib/components/ComposedModal/ComposedModal.js +31 -34
- package/lib/components/ComposedModal/ModalFooter.js +37 -42
- package/lib/components/ComposedModal/ModalHeader.js +14 -15
- package/lib/components/ContainedList/ContainedList.js +10 -11
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +9 -29
- package/lib/components/ContentSwitcher/ContentSwitcher.js +94 -126
- package/lib/components/ContentSwitcher/index.d.ts +3 -4
- package/lib/components/ContextMenu/useContextMenu.js +1 -2
- package/lib/components/Copy/Copy.js +11 -12
- package/lib/components/CopyButton/CopyButton.js +10 -11
- package/lib/components/DataTable/DataTable.js +45 -53
- package/lib/components/DataTable/Table.js +15 -18
- package/lib/components/DataTable/TableBatchAction.js +8 -11
- package/lib/components/DataTable/TableBatchActions.js +18 -20
- package/lib/components/DataTable/TableBody.js +8 -11
- package/lib/components/DataTable/TableContainer.js +9 -10
- package/lib/components/DataTable/TableDecoratorRow.js +4 -5
- package/lib/components/DataTable/TableExpandHeader.js +14 -15
- package/lib/components/DataTable/TableExpandRow.js +13 -14
- package/lib/components/DataTable/TableExpandedRow.js +6 -7
- package/lib/components/DataTable/TableHeader.js +15 -16
- package/lib/components/DataTable/TableSelectAll.js +11 -12
- package/lib/components/DataTable/TableSelectRow.js +12 -13
- package/lib/components/DataTable/TableSlugRow.js +4 -5
- package/lib/components/DataTable/TableToolbar.js +7 -8
- package/lib/components/DataTable/TableToolbarMenu.js +8 -9
- package/lib/components/DataTable/TableToolbarSearch.js +22 -24
- package/lib/components/DataTable/state/sorting.js +3 -4
- package/lib/components/DataTable/tools/filter.js +10 -12
- package/lib/components/DataTable/tools/normalize.js +6 -8
- package/lib/components/DataTable/tools/sorting.js +24 -30
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +11 -12
- package/lib/components/DatePicker/DatePicker.Skeleton.js +7 -8
- package/lib/components/DatePicker/DatePicker.js +87 -64
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -6
- package/lib/components/Dialog/index.d.ts +193 -8
- package/lib/components/Dialog/index.js +457 -33
- package/lib/components/Dropdown/Dropdown.Skeleton.js +6 -7
- package/lib/components/Dropdown/Dropdown.js +40 -43
- package/lib/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.js +9 -10
- package/lib/components/FeatureFlags/index.js +11 -12
- package/lib/components/FileUploader/FileUploader.Skeleton.js +4 -5
- package/lib/components/FileUploader/FileUploader.js +22 -24
- package/lib/components/FileUploader/FileUploaderButton.js +16 -17
- package/lib/components/FileUploader/FileUploaderDropContainer.js +15 -16
- package/lib/components/FileUploader/FileUploaderItem.js +13 -14
- package/lib/components/FileUploader/Filename.js +9 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +4 -5
- package/lib/components/FluidComboBox/FluidComboBox.js +5 -6
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +5 -6
- package/lib/components/FluidDatePicker/FluidDatePicker.js +10 -11
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +4 -5
- package/lib/components/FluidDropdown/FluidDropdown.js +5 -6
- package/lib/components/FluidForm/FluidForm.js +5 -6
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +4 -5
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +6 -7
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +4 -5
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/lib/components/FluidNumberInput/FluidNumberInput.js +38 -5
- package/lib/components/FluidSearch/FluidSearch.Skeleton.js +4 -5
- package/lib/components/FluidSearch/FluidSearch.js +4 -5
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +4 -5
- package/lib/components/FluidSelect/FluidSelect.js +5 -6
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +4 -5
- package/lib/components/FluidTextArea/FluidTextArea.js +4 -5
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +4 -5
- package/lib/components/FluidTextInput/FluidTextInput.js +5 -6
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +5 -6
- package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -12
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +5 -6
- package/lib/components/Form/Form.js +5 -6
- package/lib/components/FormGroup/FormGroup.js +11 -12
- package/lib/components/FormItem/FormItem.js +5 -6
- package/lib/components/FormLabel/FormLabel.js +6 -7
- package/lib/components/Grid/CSSGrid.js +17 -19
- package/lib/components/Grid/Column.js +28 -27
- package/lib/components/Grid/ColumnHang.js +6 -7
- package/lib/components/Grid/FlexGrid.js +9 -10
- package/lib/components/Grid/GridContext.js +5 -6
- package/lib/components/Grid/Row.js +8 -9
- package/lib/components/Heading/index.js +5 -6
- package/lib/components/Icon/Icon.Skeleton.js +4 -5
- package/lib/components/IconButton/index.js +20 -21
- package/lib/components/IconIndicator/index.js +7 -8
- package/lib/components/IdPrefix/index.js +4 -5
- package/lib/components/InlineLoading/InlineLoading.js +9 -10
- package/lib/components/Layer/index.js +8 -9
- package/lib/components/Layout/index.js +21 -26
- package/lib/components/LayoutDirection/LayoutDirection.js +6 -7
- package/lib/components/Link/Link.d.ts +1 -1
- package/lib/components/Link/Link.js +14 -15
- package/lib/components/ListBox/ListBoxField.js +6 -7
- package/lib/components/ListBox/ListBoxMenu.js +5 -6
- package/lib/components/ListBox/ListBoxMenuIcon.js +4 -5
- package/lib/components/ListBox/ListBoxMenuItem.js +8 -10
- package/lib/components/ListBox/ListBoxSelection.js +8 -9
- package/lib/components/ListBox/next/ListBoxSelection.js +9 -10
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/lib/components/ListItem/ListItem.js +5 -6
- package/lib/components/Loading/Loading.js +8 -9
- package/lib/components/Menu/Menu.js +23 -24
- package/lib/components/Menu/MenuItem.js +39 -44
- package/lib/components/MenuButton/index.js +16 -18
- package/lib/components/Modal/Modal.js +55 -63
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +45 -47
- package/lib/components/MultiSelect/MultiSelect.js +43 -45
- package/lib/components/MultiSelect/tools/sorting.js +11 -15
- package/lib/components/Notification/Notification.js +96 -105
- package/lib/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/lib/components/NumberInput/NumberFormatPropTypes.js +48 -0
- package/lib/components/NumberInput/NumberInput.Skeleton.js +6 -7
- package/lib/components/NumberInput/NumberInput.d.ts +39 -3
- package/lib/components/NumberInput/NumberInput.js +173 -43
- package/lib/components/OrderedList/OrderedList.js +7 -8
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +35 -41
- package/lib/components/OverflowMenu/next/index.js +12 -13
- package/lib/components/PageHeader/PageHeader.d.ts +29 -5
- package/lib/components/PageHeader/PageHeader.js +119 -73
- package/lib/components/Pagination/Pagination.Skeleton.js +4 -5
- package/lib/components/Pagination/Pagination.js +24 -25
- package/lib/components/Pagination/experimental/PageSelector.js +8 -9
- package/lib/components/Pagination/experimental/Pagination.js +20 -21
- package/lib/components/PaginationNav/PaginationNav.js +33 -38
- package/lib/components/Popover/index.js +26 -28
- package/lib/components/ProgressBar/ProgressBar.js +11 -12
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
- package/lib/components/ProgressIndicator/ProgressIndicator.js +29 -32
- package/lib/components/RadioTile/RadioTile.js +17 -18
- package/lib/components/Search/Search.Skeleton.js +5 -6
- package/lib/components/Search/Search.js +26 -28
- package/lib/components/Select/Select.Skeleton.js +5 -6
- package/lib/components/Select/Select.js +24 -25
- package/lib/components/SelectItem/SelectItem.js +8 -9
- package/lib/components/SelectItemGroup/SelectItemGroup.js +7 -8
- package/lib/components/ShapeIndicator/index.js +7 -8
- package/lib/components/SkeletonIcon/SkeletonIcon.js +4 -5
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -5
- package/lib/components/SkeletonText/SkeletonText.js +8 -9
- package/lib/components/Slider/Slider.Skeleton.js +8 -9
- package/lib/components/Slider/Slider.js +69 -83
- package/lib/components/Slider/SliderHandles.js +6 -6
- package/lib/components/StructuredList/StructuredList.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.js +83 -98
- package/lib/components/Tabs/usePressable.js +7 -8
- package/lib/components/Tag/DismissibleTag.js +16 -17
- package/lib/components/Tag/OperationalTag.js +10 -11
- package/lib/components/Tag/SelectableTag.js +13 -14
- package/lib/components/Tag/Tag.Skeleton.js +5 -6
- package/lib/components/Tag/Tag.js +19 -20
- package/lib/components/Text/Text.js +6 -7
- package/lib/components/Text/TextDirection.js +5 -6
- package/lib/components/TextArea/TextArea.js +3 -3
- package/lib/components/TextInput/ControlledPasswordInput.js +24 -25
- package/lib/components/TextInput/PasswordInput.js +26 -27
- package/lib/components/TextInput/TextInput.Skeleton.js +5 -6
- package/lib/components/TextInput/TextInput.js +27 -28
- package/lib/components/TextInput/util.js +14 -17
- package/lib/components/Theme/index.js +10 -12
- package/lib/components/Tile/Tile.js +68 -74
- package/lib/components/Toggle/Toggle.Skeleton.js +4 -5
- package/lib/components/Toggle/Toggle.js +17 -18
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +6 -7
- package/lib/components/Toggletip/index.js +33 -39
- package/lib/components/Tooltip/DefinitionTooltip.js +13 -14
- package/lib/components/Tooltip/Tooltip.js +15 -16
- package/lib/components/TreeView/TreeNode.js +20 -21
- package/lib/components/TreeView/TreeView.js +14 -16
- package/lib/components/UIShell/Content.js +6 -7
- package/lib/components/UIShell/Header.js +5 -6
- package/lib/components/UIShell/HeaderContainer.js +5 -6
- package/lib/components/UIShell/HeaderGlobalAction.js +12 -13
- package/lib/components/UIShell/HeaderMenu.d.ts +10 -112
- package/lib/components/UIShell/HeaderMenu.js +152 -199
- package/lib/components/UIShell/HeaderMenuButton.js +10 -11
- package/lib/components/UIShell/HeaderMenuItem.js +10 -11
- package/lib/components/UIShell/HeaderName.js +6 -7
- package/lib/components/UIShell/HeaderNavigation.js +7 -8
- package/lib/components/UIShell/HeaderPanel.js +9 -10
- package/lib/components/UIShell/HeaderSideNavItems.js +5 -6
- package/lib/components/UIShell/Link.js +8 -9
- package/lib/components/UIShell/SideNav.js +23 -25
- package/lib/components/UIShell/SideNavDetails.js +6 -7
- package/lib/components/UIShell/SideNavDivider.js +3 -4
- package/lib/components/UIShell/SideNavFooter.js +6 -7
- package/lib/components/UIShell/SideNavHeader.js +5 -6
- package/lib/components/UIShell/SideNavIcon.js +5 -6
- package/lib/components/UIShell/SideNavItem.js +5 -6
- package/lib/components/UIShell/SideNavItems.js +5 -6
- package/lib/components/UIShell/SideNavLink.js +10 -11
- package/lib/components/UIShell/SideNavLinkText.js +5 -6
- package/lib/components/UIShell/SideNavMenu.js +11 -12
- package/lib/components/UIShell/SkipToContent.js +7 -8
- package/lib/components/UIShell/Switcher.js +4 -5
- package/lib/components/UIShell/SwitcherDivider.js +4 -5
- package/lib/components/UnorderedList/UnorderedList.js +6 -7
- package/lib/index.js +35 -35
- package/lib/internal/FloatingMenu.js +26 -28
- package/lib/internal/Selection.js +15 -17
- package/lib/internal/getAnnouncement.d.ts +8 -0
- package/lib/internal/getAnnouncement.js +26 -0
- package/lib/internal/keyboard/match.js +6 -7
- package/lib/internal/useControllableState.d.ts +1 -1
- package/lib/internal/useControllableState.js +8 -9
- package/lib/internal/useDelayedState.js +1 -2
- package/lib/internal/useDocumentLang.d.ts +12 -0
- package/lib/internal/useId.js +2 -4
- package/lib/internal/useMatchMedia.js +1 -2
- package/lib/internal/useMergedRefs.d.ts +1 -1
- package/lib/internal/useNoInteractiveChildren.js +2 -4
- package/lib/internal/useNormalizedInputProps.js +9 -10
- package/lib/internal/useResizeObserver.js +4 -5
- package/lib/internal/useSavedCallback.js +1 -3
- package/lib/internal/wrapFocus.js +20 -29
- package/lib/prop-types/deprecate.js +1 -4
- package/lib/prop-types/deprecateValuesWithin.js +1 -4
- package/lib/prop-types/isRequiredOneOf.js +1 -4
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
- package/lib/tools/events.js +1 -4
- package/lib/tools/mergeRefs.js +9 -14
- package/lib/tools/uniqueId.js +1 -2
- package/lib/tools/wrapComponent.js +9 -11
- package/package.json +21 -19
- package/telemetry.yml +23 -1
- package/es/components/ContentSwitcher/index.js +0 -13
- package/es/feature-flags.d.ts +0 -7
- package/es/internal/useAnnouncer.js +0 -21
- package/lib/components/ContentSwitcher/index.js +0 -18
- package/lib/feature-flags.d.ts +0 -7
- package/lib/internal/useAnnouncer.js +0 -25
|
@@ -7,26 +7,50 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React, { useRef, useEffect } from 'react';
|
|
10
|
+
import React, { useRef, useEffect, useContext, useState, createContext } from 'react';
|
|
11
|
+
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
11
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
13
|
import cx from 'classnames';
|
|
13
14
|
import { Close } from '@carbon/icons-react';
|
|
14
15
|
import { IconButton } from '../IconButton/index.js';
|
|
15
16
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
|
+
import '../Text/index.js';
|
|
18
|
+
import { Layer } from '../Layer/index.js';
|
|
19
|
+
import ButtonSet from '../ButtonSet/ButtonSet.js';
|
|
20
|
+
import Button from '../Button/Button.js';
|
|
21
|
+
import '../Button/Button.Skeleton.js';
|
|
22
|
+
import { useId } from '../../internal/useId.js';
|
|
23
|
+
import InlineLoading from '../InlineLoading/InlineLoading.js';
|
|
24
|
+
import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
|
|
25
|
+
import { Text } from '../Text/Text.js';
|
|
16
26
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const DialogContext = /*#__PURE__*/createContext({});
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ----------
|
|
31
|
+
* Dialog
|
|
32
|
+
* ----------
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const unstable__Dialog = /*#__PURE__*/React.forwardRef(({
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
modal,
|
|
39
|
+
onCancel = noopFn,
|
|
40
|
+
onClick = noopFn,
|
|
41
|
+
onClose = noopFn,
|
|
42
|
+
onRequestClose = noopFn,
|
|
43
|
+
open = false,
|
|
44
|
+
role,
|
|
45
|
+
ariaLabel,
|
|
46
|
+
ariaLabelledBy,
|
|
47
|
+
ariaDescribedBy,
|
|
48
|
+
...rest
|
|
49
|
+
}, forwardRef) => {
|
|
29
50
|
const prefix = usePrefix();
|
|
51
|
+
const dialogId = useId();
|
|
52
|
+
const titleId = `${prefix}--dialog-header__heading--${dialogId}`;
|
|
53
|
+
const subtitleId = `${prefix}--dialog-header__label--${dialogId}`;
|
|
30
54
|
|
|
31
55
|
// This component needs access to a ref, placed on the dialog, to call the
|
|
32
56
|
// various imperative dialog functions (show(), close(), etc.).
|
|
@@ -69,15 +93,40 @@ const unstable__Dialog = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
|
|
|
69
93
|
}
|
|
70
94
|
}
|
|
71
95
|
}, [modal, open]);
|
|
72
|
-
|
|
96
|
+
const containerClasses = cx(`${prefix}--dialog-container`);
|
|
97
|
+
const contextValue = {
|
|
98
|
+
dialogId,
|
|
99
|
+
titleId,
|
|
100
|
+
subtitleId,
|
|
101
|
+
isOpen: open
|
|
102
|
+
};
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (ref.current && open && !ariaLabel && !ariaLabelledBy) {
|
|
105
|
+
const title = ref.current.querySelector(`.${prefix}--dialog-header__heading`);
|
|
106
|
+
|
|
107
|
+
// Set aria-labelledby to the title's ID if it exists
|
|
108
|
+
if (title && title.id) {
|
|
109
|
+
ref.current.setAttribute('aria-labelledby', title.id);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}, [open, ariaLabel, ariaLabelledBy, prefix]);
|
|
113
|
+
return /*#__PURE__*/React.createElement(DialogContext.Provider, {
|
|
114
|
+
value: contextValue
|
|
115
|
+
}, /*#__PURE__*/React.createElement("dialog", _extends({}, rest, {
|
|
73
116
|
className: cx(`${prefix}--dialog`, {
|
|
74
117
|
[`${prefix}--dialog--modal`]: modal
|
|
75
118
|
}, className),
|
|
76
119
|
ref: ref,
|
|
77
120
|
onCancel: onCancel,
|
|
78
121
|
onClick: handleClick,
|
|
79
|
-
onClose: onClose
|
|
80
|
-
|
|
122
|
+
onClose: onClose,
|
|
123
|
+
role: role,
|
|
124
|
+
"aria-label": ariaLabel,
|
|
125
|
+
"aria-labelledby": !ariaLabel ? ariaLabelledBy || titleId : undefined,
|
|
126
|
+
"aria-describedby": ariaDescribedBy
|
|
127
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
className: containerClasses
|
|
129
|
+
}, children)));
|
|
81
130
|
});
|
|
82
131
|
unstable__Dialog.displayName = 'Dialog';
|
|
83
132
|
unstable__Dialog.propTypes = {
|
|
@@ -102,30 +151,59 @@ unstable__Dialog.propTypes = {
|
|
|
102
151
|
/**
|
|
103
152
|
* open initial state
|
|
104
153
|
*/
|
|
105
|
-
open: PropTypes.bool
|
|
154
|
+
open: PropTypes.bool,
|
|
155
|
+
/**
|
|
156
|
+
* Specify the role of the dialog for accessibility
|
|
157
|
+
*/
|
|
158
|
+
role: PropTypes.oneOf(['dialog', 'alertdialog']),
|
|
159
|
+
/**
|
|
160
|
+
* Specify a label for screen readers
|
|
161
|
+
*/
|
|
162
|
+
'aria-label': PropTypes.string,
|
|
163
|
+
/**
|
|
164
|
+
* Specify the ID of an element that labels this dialog
|
|
165
|
+
*/
|
|
166
|
+
'aria-labelledby': PropTypes.string,
|
|
167
|
+
/**
|
|
168
|
+
* Specify the ID of an element that describes this dialog
|
|
169
|
+
*/
|
|
170
|
+
ariaDescribedBy: PropTypes.string
|
|
106
171
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* -------------
|
|
175
|
+
* DialogHeader
|
|
176
|
+
* -------------
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
const DialogHeader = /*#__PURE__*/React.forwardRef(({
|
|
180
|
+
children,
|
|
181
|
+
...rest
|
|
182
|
+
}, ref) => {
|
|
112
183
|
const prefix = usePrefix();
|
|
113
184
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
114
185
|
className: `${prefix}--dialog__header`,
|
|
115
186
|
ref: ref
|
|
116
187
|
}, rest), children);
|
|
117
188
|
});
|
|
189
|
+
DialogHeader.displayName = 'DialogHeader';
|
|
118
190
|
DialogHeader.propTypes = {
|
|
119
191
|
/**
|
|
120
192
|
* Provide the contents to be rendered inside of this component
|
|
121
193
|
*/
|
|
122
194
|
children: PropTypes.node
|
|
123
195
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* ---------------
|
|
199
|
+
* DialogControls
|
|
200
|
+
* ---------------
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
const DialogControls = /*#__PURE__*/React.forwardRef(({
|
|
204
|
+
children,
|
|
205
|
+
...rest
|
|
206
|
+
}, ref) => {
|
|
129
207
|
const prefix = usePrefix();
|
|
130
208
|
return (
|
|
131
209
|
/*#__PURE__*/
|
|
@@ -136,17 +214,24 @@ const DialogControls = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
136
214
|
}, rest), children)
|
|
137
215
|
);
|
|
138
216
|
});
|
|
217
|
+
DialogControls.displayName = 'DialogControls';
|
|
139
218
|
DialogControls.propTypes = {
|
|
140
219
|
/**
|
|
141
220
|
* Provide children to be rendered inside of this component
|
|
142
221
|
*/
|
|
143
222
|
children: PropTypes.node
|
|
144
223
|
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* -------------------
|
|
227
|
+
* DialogCloseButton
|
|
228
|
+
* -------------------
|
|
229
|
+
*/
|
|
230
|
+
|
|
231
|
+
const DialogCloseButton = /*#__PURE__*/React.forwardRef(({
|
|
232
|
+
onClick,
|
|
233
|
+
...rest
|
|
234
|
+
}, ref) => {
|
|
150
235
|
const prefix = usePrefix();
|
|
151
236
|
return (
|
|
152
237
|
/*#__PURE__*/
|
|
@@ -158,15 +243,17 @@ const DialogCloseButton = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
158
243
|
title: "Close",
|
|
159
244
|
"aria-label": "Close",
|
|
160
245
|
align: "left",
|
|
161
|
-
onClick: onClick
|
|
246
|
+
onClick: onClick,
|
|
247
|
+
ref: ref
|
|
162
248
|
}, rest), /*#__PURE__*/React.createElement(Close, {
|
|
163
249
|
size: 20,
|
|
164
250
|
"aria-hidden": "true",
|
|
165
|
-
tabIndex:
|
|
251
|
+
tabIndex: -1,
|
|
166
252
|
className: `${prefix}--icon__close`
|
|
167
253
|
}))
|
|
168
254
|
);
|
|
169
255
|
});
|
|
256
|
+
DialogCloseButton.displayName = 'DialogCloseButton';
|
|
170
257
|
DialogCloseButton.propTypes = {
|
|
171
258
|
/**
|
|
172
259
|
* Specify a click handler applied to the IconButton
|
|
@@ -174,4 +261,336 @@ DialogCloseButton.propTypes = {
|
|
|
174
261
|
onClick: PropTypes.func
|
|
175
262
|
};
|
|
176
263
|
|
|
177
|
-
|
|
264
|
+
/**
|
|
265
|
+
* ------------
|
|
266
|
+
* DialogTitle
|
|
267
|
+
* ------------
|
|
268
|
+
*/
|
|
269
|
+
|
|
270
|
+
const DialogTitle = /*#__PURE__*/React.forwardRef(({
|
|
271
|
+
children,
|
|
272
|
+
className,
|
|
273
|
+
id,
|
|
274
|
+
...rest
|
|
275
|
+
}, ref) => {
|
|
276
|
+
const prefix = usePrefix();
|
|
277
|
+
const {
|
|
278
|
+
titleId
|
|
279
|
+
} = useContext(DialogContext);
|
|
280
|
+
const headingId = id || titleId;
|
|
281
|
+
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
282
|
+
as: "h2",
|
|
283
|
+
id: headingId,
|
|
284
|
+
className: cx(`${prefix}--dialog-header__heading`, className),
|
|
285
|
+
ref: ref
|
|
286
|
+
}, rest), children);
|
|
287
|
+
});
|
|
288
|
+
DialogTitle.displayName = 'DialogTitle';
|
|
289
|
+
DialogTitle.propTypes = {
|
|
290
|
+
/**
|
|
291
|
+
* Provide the contents to be rendered inside of this component
|
|
292
|
+
*/
|
|
293
|
+
children: PropTypes.node,
|
|
294
|
+
/**
|
|
295
|
+
* Specify an optional className to be applied to the title node
|
|
296
|
+
*/
|
|
297
|
+
className: PropTypes.string,
|
|
298
|
+
/**
|
|
299
|
+
* Specify an optional id for the title element
|
|
300
|
+
*/
|
|
301
|
+
id: PropTypes.string
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* ---------------
|
|
306
|
+
* DialogSubtitle
|
|
307
|
+
* ---------------
|
|
308
|
+
*/
|
|
309
|
+
|
|
310
|
+
const DialogSubtitle = /*#__PURE__*/React.forwardRef(({
|
|
311
|
+
children,
|
|
312
|
+
className,
|
|
313
|
+
id,
|
|
314
|
+
...rest
|
|
315
|
+
}, ref) => {
|
|
316
|
+
const prefix = usePrefix();
|
|
317
|
+
const {
|
|
318
|
+
subtitleId
|
|
319
|
+
} = useContext(DialogContext);
|
|
320
|
+
const labelId = id || subtitleId;
|
|
321
|
+
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
322
|
+
as: "h2",
|
|
323
|
+
id: labelId,
|
|
324
|
+
className: cx(`${prefix}--dialog-header__label`, className),
|
|
325
|
+
ref: ref
|
|
326
|
+
}, rest), children);
|
|
327
|
+
});
|
|
328
|
+
DialogSubtitle.displayName = 'DialogSubtitle';
|
|
329
|
+
DialogSubtitle.propTypes = {
|
|
330
|
+
/**
|
|
331
|
+
* Provide the contents to be rendered inside of this component
|
|
332
|
+
*/
|
|
333
|
+
children: PropTypes.node,
|
|
334
|
+
/**
|
|
335
|
+
* Specify an optional className to be applied to the subtitle node
|
|
336
|
+
*/
|
|
337
|
+
className: PropTypes.string,
|
|
338
|
+
/**
|
|
339
|
+
* Specify an optional id for the subtitle element
|
|
340
|
+
*/
|
|
341
|
+
id: PropTypes.string
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* -----------
|
|
346
|
+
* DialogBody
|
|
347
|
+
* -----------
|
|
348
|
+
*/
|
|
349
|
+
|
|
350
|
+
const DialogBody = /*#__PURE__*/React.forwardRef(({
|
|
351
|
+
children,
|
|
352
|
+
className,
|
|
353
|
+
hasScrollingContent,
|
|
354
|
+
...rest
|
|
355
|
+
}, ref) => {
|
|
356
|
+
const prefix = usePrefix();
|
|
357
|
+
const contentRef = useRef(null);
|
|
358
|
+
const [isScrollable, setIsScrollable] = useState(false);
|
|
359
|
+
const dialogId = useId();
|
|
360
|
+
const dialogBodyId = `${prefix}--dialog-body--${dialogId}`;
|
|
361
|
+
useIsomorphicEffect(() => {
|
|
362
|
+
if (contentRef.current) {
|
|
363
|
+
setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
|
|
364
|
+
}
|
|
365
|
+
function handler() {
|
|
366
|
+
if (contentRef.current) {
|
|
367
|
+
setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const debouncedHandler = debounce(handler, 200);
|
|
371
|
+
window.addEventListener('resize', debouncedHandler);
|
|
372
|
+
return () => {
|
|
373
|
+
debouncedHandler.cancel();
|
|
374
|
+
window.removeEventListener('resize', debouncedHandler);
|
|
375
|
+
};
|
|
376
|
+
}, []);
|
|
377
|
+
const contentClasses = cx(`${prefix}--dialog-content`, {
|
|
378
|
+
[`${prefix}--dialog-scroll-content`]: hasScrollingContent || isScrollable
|
|
379
|
+
}, className);
|
|
380
|
+
const hasScrollingContentProps = hasScrollingContent || isScrollable ? {
|
|
381
|
+
tabIndex: 0,
|
|
382
|
+
role: 'region'
|
|
383
|
+
} : {};
|
|
384
|
+
const combinedRef = el => {
|
|
385
|
+
if (typeof ref === 'function') {
|
|
386
|
+
ref(el);
|
|
387
|
+
} else if (ref) {
|
|
388
|
+
ref.current = el;
|
|
389
|
+
}
|
|
390
|
+
contentRef.current = el;
|
|
391
|
+
};
|
|
392
|
+
return /*#__PURE__*/React.createElement(Layer, _extends({
|
|
393
|
+
ref: combinedRef,
|
|
394
|
+
id: dialogBodyId,
|
|
395
|
+
className: contentClasses
|
|
396
|
+
}, hasScrollingContentProps, rest), children);
|
|
397
|
+
});
|
|
398
|
+
DialogBody.displayName = 'DialogBody';
|
|
399
|
+
DialogBody.propTypes = {
|
|
400
|
+
/**
|
|
401
|
+
* Provide the contents to be rendered inside of this component
|
|
402
|
+
*/
|
|
403
|
+
children: PropTypes.node,
|
|
404
|
+
/**
|
|
405
|
+
* Specify an optional className to be applied to the body node
|
|
406
|
+
*/
|
|
407
|
+
className: PropTypes.string,
|
|
408
|
+
/**
|
|
409
|
+
* Specify whether the content has overflow that should be scrollable
|
|
410
|
+
*/
|
|
411
|
+
hasScrollingContent: PropTypes.bool
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* -------------
|
|
416
|
+
* DialogFooter
|
|
417
|
+
* -------------
|
|
418
|
+
*/
|
|
419
|
+
|
|
420
|
+
const DialogFooter = /*#__PURE__*/React.forwardRef(({
|
|
421
|
+
children,
|
|
422
|
+
className,
|
|
423
|
+
onRequestClose = noopFn,
|
|
424
|
+
onSecondarySubmit,
|
|
425
|
+
onRequestSubmit = noopFn,
|
|
426
|
+
primaryButtonText = 'Save',
|
|
427
|
+
primaryButtonDisabled = false,
|
|
428
|
+
secondaryButtonText = 'Cancel',
|
|
429
|
+
secondaryButtons,
|
|
430
|
+
loadingStatus = 'inactive',
|
|
431
|
+
loadingDescription,
|
|
432
|
+
loadingIconDescription,
|
|
433
|
+
onLoadingSuccess = noopFn,
|
|
434
|
+
danger = false,
|
|
435
|
+
...rest
|
|
436
|
+
}, ref) => {
|
|
437
|
+
const prefix = usePrefix();
|
|
438
|
+
const button = useRef(null);
|
|
439
|
+
const {
|
|
440
|
+
isOpen
|
|
441
|
+
} = useContext(DialogContext);
|
|
442
|
+
const [secondaryButtonRef, setSecondaryButtonRef] = useState(null);
|
|
443
|
+
useEffect(() => {
|
|
444
|
+
if (danger && secondaryButtonRef) {
|
|
445
|
+
const focusFrame = requestAnimationFrame(() => {
|
|
446
|
+
secondaryButtonRef.focus();
|
|
447
|
+
});
|
|
448
|
+
return () => cancelAnimationFrame(focusFrame);
|
|
449
|
+
}
|
|
450
|
+
}, [danger, secondaryButtonRef, isOpen]);
|
|
451
|
+
const classes = cx(`${prefix}--dialog-footer`, className, {
|
|
452
|
+
[`${prefix}--dialog-footer--three-button`]: Array.isArray(secondaryButtons) && secondaryButtons.length === 2
|
|
453
|
+
});
|
|
454
|
+
const loadingActive = loadingStatus !== 'inactive';
|
|
455
|
+
const primaryButtonClass = cx({
|
|
456
|
+
[`${prefix}--btn--loading`]: loadingStatus !== 'inactive'
|
|
457
|
+
});
|
|
458
|
+
const onSecondaryButtonClick = onSecondarySubmit ? onSecondarySubmit : onRequestClose;
|
|
459
|
+
if (children) {
|
|
460
|
+
return /*#__PURE__*/React.createElement(ButtonSet, _extends({
|
|
461
|
+
className: classes,
|
|
462
|
+
ref: ref
|
|
463
|
+
}, rest), children);
|
|
464
|
+
}
|
|
465
|
+
return /*#__PURE__*/React.createElement(ButtonSet, _extends({
|
|
466
|
+
className: classes,
|
|
467
|
+
"aria-busy": loadingActive,
|
|
468
|
+
ref: ref
|
|
469
|
+
}, rest), Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map(({
|
|
470
|
+
buttonText,
|
|
471
|
+
onClick: onButtonClick
|
|
472
|
+
}, i) => /*#__PURE__*/React.createElement(Button, {
|
|
473
|
+
key: `${buttonText}-${i}`,
|
|
474
|
+
autoFocus: danger,
|
|
475
|
+
kind: "secondary",
|
|
476
|
+
ref: i === 0 && danger ? setSecondaryButtonRef : undefined,
|
|
477
|
+
onClick: onButtonClick
|
|
478
|
+
}, buttonText)) : secondaryButtonText && /*#__PURE__*/React.createElement(Button, {
|
|
479
|
+
ref: danger ? setSecondaryButtonRef : undefined,
|
|
480
|
+
disabled: loadingActive,
|
|
481
|
+
kind: "secondary",
|
|
482
|
+
autoFocus: danger,
|
|
483
|
+
onClick: onSecondaryButtonClick
|
|
484
|
+
}, secondaryButtonText), /*#__PURE__*/React.createElement(Button, {
|
|
485
|
+
className: primaryButtonClass,
|
|
486
|
+
kind: danger ? 'danger' : 'primary',
|
|
487
|
+
disabled: loadingActive || primaryButtonDisabled,
|
|
488
|
+
onClick: onRequestSubmit,
|
|
489
|
+
ref: button
|
|
490
|
+
}, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/React.createElement(InlineLoading, {
|
|
491
|
+
status: loadingStatus,
|
|
492
|
+
description: loadingDescription,
|
|
493
|
+
iconDescription: loadingIconDescription,
|
|
494
|
+
className: `${prefix}--inline-loading--btn`,
|
|
495
|
+
onSuccess: onLoadingSuccess
|
|
496
|
+
})));
|
|
497
|
+
});
|
|
498
|
+
DialogFooter.displayName = 'DialogFooter';
|
|
499
|
+
DialogFooter.propTypes = {
|
|
500
|
+
/**
|
|
501
|
+
* Provide the contents to be rendered inside of this component
|
|
502
|
+
*/
|
|
503
|
+
children: PropTypes.node,
|
|
504
|
+
/**
|
|
505
|
+
* Specify an optional className to be applied to the footer node
|
|
506
|
+
*/
|
|
507
|
+
className: PropTypes.string,
|
|
508
|
+
/**
|
|
509
|
+
* Specify a handler for closing dialog.
|
|
510
|
+
*/
|
|
511
|
+
onRequestClose: PropTypes.func,
|
|
512
|
+
/**
|
|
513
|
+
* Specify a handler for the secondary button.
|
|
514
|
+
*/
|
|
515
|
+
onSecondarySubmit: PropTypes.func,
|
|
516
|
+
/**
|
|
517
|
+
* Specify a handler for submitting dialog.
|
|
518
|
+
*/
|
|
519
|
+
onRequestSubmit: PropTypes.func,
|
|
520
|
+
/**
|
|
521
|
+
* Specify the text for the primary button
|
|
522
|
+
*/
|
|
523
|
+
primaryButtonText: PropTypes.node,
|
|
524
|
+
/**
|
|
525
|
+
* Specify whether the Button should be disabled, or not
|
|
526
|
+
*/
|
|
527
|
+
primaryButtonDisabled: PropTypes.bool,
|
|
528
|
+
/**
|
|
529
|
+
* Specify the text for the secondary button
|
|
530
|
+
*/
|
|
531
|
+
secondaryButtonText: PropTypes.node,
|
|
532
|
+
/**
|
|
533
|
+
* Specify an array of config objects for secondary buttons
|
|
534
|
+
*/
|
|
535
|
+
secondaryButtons: (props, propName, componentName) => {
|
|
536
|
+
if (props.secondaryButtons) {
|
|
537
|
+
if (!Array.isArray(props.secondaryButtons) || props.secondaryButtons.length !== 2) {
|
|
538
|
+
return new Error(`${propName} needs to be an array of two button config objects`);
|
|
539
|
+
}
|
|
540
|
+
const shape = {
|
|
541
|
+
buttonText: PropTypes.node,
|
|
542
|
+
onClick: PropTypes.func
|
|
543
|
+
};
|
|
544
|
+
props[propName].forEach(secondaryButton => {
|
|
545
|
+
PropTypes.checkPropTypes(shape, secondaryButton, propName, componentName);
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
return null;
|
|
549
|
+
},
|
|
550
|
+
/**
|
|
551
|
+
* Specify whether the Dialog is for dangerous actions
|
|
552
|
+
*/
|
|
553
|
+
danger: PropTypes.bool,
|
|
554
|
+
/**
|
|
555
|
+
* Specify loading status
|
|
556
|
+
*/
|
|
557
|
+
loadingStatus: PropTypes.oneOf(['inactive', 'active', 'finished', 'error']),
|
|
558
|
+
/**
|
|
559
|
+
* Specify the description for the loading text
|
|
560
|
+
*/
|
|
561
|
+
loadingDescription: PropTypes.string,
|
|
562
|
+
/**
|
|
563
|
+
* Specify the description for the loading icon
|
|
564
|
+
*/
|
|
565
|
+
loadingIconDescription: PropTypes.string,
|
|
566
|
+
/**
|
|
567
|
+
* Provide an optional handler to be invoked when loading is
|
|
568
|
+
* successful
|
|
569
|
+
*/
|
|
570
|
+
onLoadingSuccess: PropTypes.func
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* -------
|
|
574
|
+
* Exports
|
|
575
|
+
* -------
|
|
576
|
+
*/
|
|
577
|
+
|
|
578
|
+
const Dialog = unstable__Dialog;
|
|
579
|
+
Dialog.Root = unstable__Dialog;
|
|
580
|
+
Dialog.Root.displayName = 'Dialog.Root';
|
|
581
|
+
Dialog.Header = DialogHeader;
|
|
582
|
+
Dialog.Header.displayName = 'Dialog.Header';
|
|
583
|
+
Dialog.Controls = DialogControls;
|
|
584
|
+
Dialog.Controls.displayName = 'Dialog.Controls';
|
|
585
|
+
Dialog.CloseButton = DialogCloseButton;
|
|
586
|
+
Dialog.CloseButton.displayName = 'Dialog.CloseButton';
|
|
587
|
+
Dialog.Title = DialogTitle;
|
|
588
|
+
Dialog.Title.displayName = 'Dialog.Title';
|
|
589
|
+
Dialog.Subtitle = DialogSubtitle;
|
|
590
|
+
Dialog.Subtitle.displayName = 'Dialog.Subtitle';
|
|
591
|
+
Dialog.Body = DialogBody;
|
|
592
|
+
Dialog.Body.displayName = 'Dialog.Body';
|
|
593
|
+
Dialog.Footer = DialogFooter;
|
|
594
|
+
Dialog.Footer.displayName = 'Dialog.Footer';
|
|
595
|
+
|
|
596
|
+
export { Dialog, DialogBody, DialogCloseButton, DialogControls, DialogFooter, DialogHeader, DialogSubtitle, DialogTitle, unstable__Dialog };
|
|
@@ -13,13 +13,12 @@ import '../ListBox/index.js';
|
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import { ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
15
15
|
|
|
16
|
-
const DropdownSkeleton =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = _ref;
|
|
16
|
+
const DropdownSkeleton = ({
|
|
17
|
+
className,
|
|
18
|
+
size,
|
|
19
|
+
hideLabel,
|
|
20
|
+
...rest
|
|
21
|
+
}) => {
|
|
23
22
|
const prefix = usePrefix();
|
|
24
23
|
const wrapperClasses = cx(className, `${prefix}--skeleton`, `${prefix}--form-item`, {
|
|
25
24
|
[`${prefix}--list-box--${size}`]: size
|
|
@@ -74,40 +74,39 @@ function stateReducer(state, actionAndChanges) {
|
|
|
74
74
|
return changes;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
const Dropdown = /*#__PURE__*/React.forwardRef((
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
} = _ref;
|
|
77
|
+
const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
78
|
+
autoAlign = false,
|
|
79
|
+
className: containerClassName,
|
|
80
|
+
decorator,
|
|
81
|
+
disabled = false,
|
|
82
|
+
direction = 'bottom',
|
|
83
|
+
items: itemsProp,
|
|
84
|
+
label,
|
|
85
|
+
['aria-label']: ariaLabel,
|
|
86
|
+
ariaLabel: deprecatedAriaLabel,
|
|
87
|
+
itemToString = defaultItemToString,
|
|
88
|
+
itemToElement = null,
|
|
89
|
+
renderSelectedItem,
|
|
90
|
+
type = 'default',
|
|
91
|
+
size: size$1,
|
|
92
|
+
onChange,
|
|
93
|
+
id,
|
|
94
|
+
titleText = '',
|
|
95
|
+
hideLabel,
|
|
96
|
+
helperText = '',
|
|
97
|
+
translateWithId,
|
|
98
|
+
light,
|
|
99
|
+
invalid,
|
|
100
|
+
invalidText,
|
|
101
|
+
warn,
|
|
102
|
+
warnText,
|
|
103
|
+
initialSelectedItem,
|
|
104
|
+
selectedItem: controlledSelectedItem,
|
|
105
|
+
downshiftProps,
|
|
106
|
+
readOnly,
|
|
107
|
+
slug,
|
|
108
|
+
...other
|
|
109
|
+
}, ref) => {
|
|
111
110
|
const enableFloatingStyles = useFeatureFlag('enable-v12-dynamic-floating-styles');
|
|
112
111
|
const {
|
|
113
112
|
refs,
|
|
@@ -122,11 +121,10 @@ const Dropdown = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
122
121
|
strategy: 'fixed',
|
|
123
122
|
// Middleware order matters, arrow should be last
|
|
124
123
|
middleware: [size({
|
|
125
|
-
apply(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
} = _ref2;
|
|
124
|
+
apply({
|
|
125
|
+
rects,
|
|
126
|
+
elements
|
|
127
|
+
}) {
|
|
130
128
|
Object.assign(elements.floating.style, {
|
|
131
129
|
width: `${rects.reference.width}px`
|
|
132
130
|
});
|
|
@@ -154,10 +152,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
154
152
|
const {
|
|
155
153
|
isFluid
|
|
156
154
|
} = useContext(FormContext);
|
|
157
|
-
const onSelectedItemChange = useCallback(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
} = _ref3;
|
|
155
|
+
const onSelectedItemChange = useCallback(({
|
|
156
|
+
selectedItem
|
|
157
|
+
}) => {
|
|
161
158
|
if (onChange) {
|
|
162
159
|
onChange({
|
|
163
160
|
selectedItem: selectedItem ?? null
|
|
@@ -29,8 +29,8 @@ import { ErrorBoundaryContext } from './ErrorBoundaryContext.js';
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
class ErrorBoundary extends React.Component {
|
|
32
|
-
constructor() {
|
|
33
|
-
super(...
|
|
32
|
+
constructor(...args) {
|
|
33
|
+
super(...args);
|
|
34
34
|
_defineProperty(this, "context", void 0);
|
|
35
35
|
_defineProperty(this, "state", {
|
|
36
36
|
hasError: false
|