@carbon/react 1.87.0-rc.0 → 1.87.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 +853 -853
- package/es/_virtual/_rollupPluginBabelHelpers.js +4 -4
- package/es/components/Button/Button.js +1 -1
- package/es/components/Button/index.js +5 -1
- package/es/components/ButtonSet/index.js +4 -1
- package/es/components/Checkbox/index.js +4 -1
- package/es/components/ComboBox/ComboBox.js +1 -1
- package/es/components/ComboBox/index.js +4 -1
- package/es/components/ComposedModal/ComposedModal.js +18 -8
- package/es/components/ContainedList/ContainedListItem/index.js +4 -1
- package/es/components/ContainedList/index.js +2 -2
- package/es/components/Copy/Copy.js +1 -1
- package/es/components/Copy/index.js +4 -1
- package/es/components/CopyButton/index.js +4 -1
- package/es/components/DataTable/Table.js +1 -1
- package/es/components/DataTable/state/getDerivedStateFromProps.d.ts +19 -0
- package/es/components/DataTable/state/getDerivedStateFromProps.js +1 -2
- package/es/components/DataTable/state/sorting.d.ts +15 -0
- package/es/components/DataTable/state/sorting.js +1 -2
- package/es/components/DataTable/tools/denormalize.d.ts +22 -0
- package/es/components/DataTable/tools/denormalize.js +1 -2
- package/es/components/DataTable/tools/normalize.d.ts +9 -0
- package/es/components/DataTable/tools/normalize.js +1 -2
- package/es/components/DatePicker/DatePicker.js +18 -11
- package/es/components/DatePicker/index.js +4 -1
- package/es/components/DatePicker/plugins/fixEventsPlugin.d.ts +2 -0
- package/es/components/DatePicker/plugins/rangePlugin.d.ts +2 -0
- package/es/components/DatePickerInput/DatePickerInput.js +6 -0
- package/es/components/DatePickerInput/index.js +4 -1
- package/es/components/Dialog/index.js +2 -2
- package/es/components/Dropdown/Dropdown.js +2 -2
- package/es/components/Dropdown/index.js +4 -1
- package/es/components/FeatureFlags/index.js +2 -2
- package/es/components/FluidSelect/index.js +4 -1
- package/es/components/FluidTextInput/index.js +4 -1
- package/es/components/IconIndicator/index.js +1 -1
- package/es/components/InlineCheckbox/index.js +4 -1
- package/es/components/InlineLoading/index.js +4 -1
- package/es/components/LayoutDirection/LayoutDirection.js +1 -2
- package/es/components/Link/index.js +4 -1
- package/es/components/ListBox/ListBox.js +1 -1
- package/es/components/Loading/index.js +4 -1
- package/es/components/Menu/Menu.d.ts +3 -1
- package/es/components/Menu/Menu.js +3 -1
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/Modal/Modal.js +16 -5
- package/es/components/Modal/index.js +4 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
- package/es/components/MultiSelect/MultiSelect.js +2 -2
- package/es/components/MultiSelect/filter.js +0 -4
- package/es/components/MultiSelect/tools/itemToString.d.ts +1 -0
- package/es/components/MultiSelect/tools/sorting.d.ts +9 -0
- package/es/components/Notification/Notification.js +2 -2
- package/es/components/NumberInput/NumberInput.js +1 -1
- package/es/components/OverflowMenu/next/index.js +1 -1
- package/es/components/OverflowMenuItem/index.js +4 -1
- package/es/components/OverflowMenuV2/index.d.ts +1 -0
- package/es/components/PageHeader/PageHeader.js +1 -1
- package/es/components/Pagination/experimental/PageSelector.d.ts +19 -0
- package/es/components/Pagination/experimental/Pagination.d.ts +43 -0
- package/es/components/Pagination/experimental/index.d.ts +3 -0
- package/es/components/Popover/index.js +21 -4
- package/es/components/RadioButton/index.js +4 -1
- package/es/components/RadioTile/index.js +4 -1
- package/es/components/Search/Search.js +1 -1
- package/es/components/Search/index.js +4 -1
- package/es/components/Select/index.js +4 -1
- package/es/components/SelectItem/index.js +4 -1
- package/es/components/ShapeIndicator/index.js +1 -1
- package/es/components/SkeletonText/index.js +4 -1
- package/es/components/Slider/Slider.js +1 -1
- package/es/components/Switch/IconSwitch.d.ts +3 -0
- package/es/components/Switch/IconSwitch.js +1 -2
- package/es/components/TabContent/TabContent.js +2 -22
- package/es/components/Tabs/Tabs.js +5 -5
- package/es/components/Tag/DismissibleTag.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextArea/index.js +4 -1
- package/es/components/TextInput/index.js +4 -1
- package/es/components/TextInput/util.d.ts +9 -0
- package/es/components/Toggletip/index.js +2 -2
- package/es/components/UIShell/HeaderMenu.js +2 -2
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/components/UIShell/_utils.d.ts +7 -0
- package/es/feature-flags.d.ts +1 -0
- package/es/internal/FloatingMenu.js +1 -1
- package/es/internal/deprecateFieldOnObject.js +1 -1
- package/es/internal/useId.d.ts +21 -0
- package/es/internal/useId.js +27 -1
- package/es/internal/useOverflowItems.js +0 -6
- package/es/node_modules/es-toolkit/dist/compat/function/{debounce.mjs.js → debounce.js} +1 -1
- package/es/node_modules/es-toolkit/dist/compat/function/{throttle.mjs.js → throttle.js} +1 -1
- package/es/prop-types/deprecateComponent.d.ts +1 -0
- package/es/prop-types/deprecateComponent.js +1 -4
- package/es/prop-types/deprecateValuesWithin.d.ts +1 -0
- package/es/prop-types/requiredIfGivenPropIsTruthy.d.ts +14 -0
- package/es/tools/mergeRefs.d.ts +12 -0
- package/es/tools/mergeRefs.js +1 -2
- package/icons/index.js +1 -3
- package/lib/_virtual/_rollupPluginBabelHelpers.js +5 -7
- package/lib/components/AILabel/index.js +35 -43
- package/lib/components/AISkeleton/AISkeletonIcon.js +5 -11
- package/lib/components/AISkeleton/AISkeletonPlaceholder.js +4 -10
- package/lib/components/AISkeleton/AISkeletonText.js +8 -14
- package/lib/components/Accordion/Accordion.Skeleton.js +21 -27
- package/lib/components/Accordion/Accordion.js +11 -17
- package/lib/components/Accordion/AccordionItem.js +19 -25
- package/lib/components/Accordion/AccordionProvider.js +1 -7
- package/lib/components/AspectRatio/AspectRatio.js +7 -13
- package/lib/components/BadgeIndicator/index.js +7 -13
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +7 -13
- package/lib/components/Breadcrumb/Breadcrumb.js +9 -15
- package/lib/components/Breadcrumb/BreadcrumbItem.js +16 -22
- package/lib/components/Button/Button.Skeleton.js +8 -14
- package/lib/components/Button/Button.js +31 -36
- package/lib/components/Button/ButtonBase.js +6 -11
- package/lib/components/Button/index.js +3 -3
- package/lib/components/ButtonSet/ButtonSet.js +6 -12
- package/lib/components/ButtonSet/index.js +2 -2
- package/lib/components/ChatButton/ChatButton.Skeleton.js +5 -11
- package/lib/components/ChatButton/ChatButton.js +12 -18
- package/lib/components/Checkbox/Checkbox.Skeleton.js +6 -12
- package/lib/components/Checkbox/Checkbox.js +33 -39
- package/lib/components/Checkbox/index.js +3 -3
- package/lib/components/CheckboxGroup/CheckboxGroup.js +24 -30
- package/lib/components/ClassPrefix/index.js +3 -10
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +10 -16
- package/lib/components/CodeSnippet/CodeSnippet.js +39 -46
- package/lib/components/ComboBox/ComboBox.js +57 -64
- package/lib/components/ComboBox/index.js +2 -2
- package/lib/components/ComboButton/index.js +20 -28
- package/lib/components/ComposedModal/ComposedModal.js +61 -57
- package/lib/components/ComposedModal/ModalFooter.js +37 -45
- package/lib/components/ComposedModal/ModalHeader.js +23 -31
- package/lib/components/ContainedList/ContainedList.js +18 -24
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +14 -20
- package/lib/components/ContainedList/ContainedListItem/index.js +2 -2
- package/lib/components/ContainedList/index.js +5 -5
- package/lib/components/ContentSwitcher/ContentSwitcher.js +11 -19
- package/lib/components/ContextMenu/useContextMenu.js +1 -1
- package/lib/components/Copy/Copy.js +12 -18
- package/lib/components/Copy/index.js +2 -2
- package/lib/components/CopyButton/CopyButton.js +12 -18
- package/lib/components/CopyButton/index.js +2 -2
- package/lib/components/DangerButton/DangerButton.js +2 -6
- package/lib/components/DataTable/DataTable.js +48 -55
- package/lib/components/DataTable/Table.js +18 -24
- package/lib/components/DataTable/TableActionList.js +2 -2
- package/lib/components/DataTable/TableBatchAction.js +4 -9
- package/lib/components/DataTable/TableBatchActions.js +19 -25
- package/lib/components/DataTable/TableBody.js +5 -10
- package/lib/components/DataTable/TableCell.js +8 -14
- package/lib/components/DataTable/TableContainer.js +14 -20
- package/lib/components/DataTable/TableContext.js +0 -2
- package/lib/components/DataTable/TableDecoratorRow.js +5 -11
- package/lib/components/DataTable/TableExpandHeader.js +16 -22
- package/lib/components/DataTable/TableExpandRow.js +20 -26
- package/lib/components/DataTable/TableExpandedRow.js +8 -14
- package/lib/components/DataTable/TableHead.js +2 -2
- package/lib/components/DataTable/TableHeader.js +26 -32
- package/lib/components/DataTable/TableRow.js +8 -14
- package/lib/components/DataTable/TableSelectAll.js +13 -19
- package/lib/components/DataTable/TableSelectRow.js +15 -21
- package/lib/components/DataTable/TableSlugRow.js +7 -13
- package/lib/components/DataTable/TableToolbar.js +7 -13
- package/lib/components/DataTable/TableToolbarAction.js +5 -10
- package/lib/components/DataTable/TableToolbarContent.js +2 -2
- package/lib/components/DataTable/TableToolbarMenu.js +9 -15
- package/lib/components/DataTable/TableToolbarSearch.js +22 -28
- package/lib/components/DataTable/state/getDerivedStateFromProps.d.ts +19 -0
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +2 -3
- package/lib/components/DataTable/state/sortStates.js +0 -2
- package/lib/components/DataTable/state/sorting.d.ts +15 -0
- package/lib/components/DataTable/state/sorting.js +0 -2
- package/lib/components/DataTable/tools/cells.js +0 -2
- package/lib/components/DataTable/tools/denormalize.d.ts +22 -0
- package/lib/components/DataTable/tools/denormalize.js +1 -2
- package/lib/components/DataTable/tools/filter.js +0 -2
- package/lib/components/DataTable/tools/normalize.d.ts +9 -0
- package/lib/components/DataTable/tools/normalize.js +1 -2
- package/lib/components/DataTable/tools/sorting.js +0 -2
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +25 -31
- package/lib/components/DatePicker/DatePicker.Skeleton.js +14 -20
- package/lib/components/DatePicker/DatePicker.js +65 -66
- package/lib/components/DatePicker/index.js +3 -3
- package/lib/components/DatePicker/plugins/appendToPlugin.js +0 -2
- package/lib/components/DatePicker/plugins/fixEventsPlugin.d.ts +2 -0
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
- package/lib/components/DatePicker/plugins/rangePlugin.d.ts +2 -0
- package/lib/components/DatePicker/plugins/rangePlugin.js +2 -6
- package/lib/components/DatePickerInput/DatePickerInput.js +49 -49
- package/lib/components/DatePickerInput/index.js +2 -2
- package/lib/components/Dialog/index.js +72 -80
- package/lib/components/Dropdown/Dropdown.Skeleton.js +8 -14
- package/lib/components/Dropdown/Dropdown.js +49 -55
- package/lib/components/Dropdown/index.js +3 -3
- package/lib/components/ErrorBoundary/ErrorBoundary.js +4 -9
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +0 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.js +6 -11
- package/lib/components/FeatureFlags/index.js +10 -17
- package/lib/components/FileUploader/FileUploader.Skeleton.js +7 -13
- package/lib/components/FileUploader/FileUploader.js +30 -36
- package/lib/components/FileUploader/FileUploaderButton.js +19 -25
- package/lib/components/FileUploader/FileUploaderDropContainer.js +18 -24
- package/lib/components/FileUploader/FileUploaderItem.js +23 -29
- package/lib/components/FileUploader/Filename.js +13 -18
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +7 -13
- package/lib/components/FluidComboBox/FluidComboBox.js +24 -30
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +14 -20
- package/lib/components/FluidDatePicker/FluidDatePicker.js +12 -18
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +4 -8
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +7 -13
- package/lib/components/FluidDropdown/FluidDropdown.js +24 -30
- package/lib/components/FluidForm/FluidForm.js +6 -12
- package/lib/components/FluidForm/FormContext.js +0 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +7 -13
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +36 -42
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +7 -13
- package/lib/components/FluidNumberInput/FluidNumberInput.js +30 -36
- package/lib/components/FluidSearch/FluidSearch.Skeleton.js +7 -13
- package/lib/components/FluidSearch/FluidSearch.js +19 -25
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +7 -13
- package/lib/components/FluidSelect/FluidSelect.js +17 -23
- package/lib/components/FluidSelect/index.js +3 -3
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +7 -13
- package/lib/components/FluidTextArea/FluidTextArea.js +25 -31
- package/lib/components/FluidTextInput/FluidPasswordInput.js +18 -22
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +7 -13
- package/lib/components/FluidTextInput/FluidTextInput.js +23 -29
- package/lib/components/FluidTextInput/index.js +3 -3
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +6 -12
- package/lib/components/FluidTimePicker/FluidTimePicker.js +23 -29
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +10 -15
- package/lib/components/Form/Form.js +5 -11
- package/lib/components/FormGroup/FormGroup.js +13 -19
- package/lib/components/FormItem/FormItem.js +5 -11
- package/lib/components/FormLabel/FormLabel.js +6 -12
- package/lib/components/Grid/CSSGrid.js +20 -28
- package/lib/components/Grid/Column.js +31 -37
- package/lib/components/Grid/ColumnHang.js +5 -13
- package/lib/components/Grid/FlexGrid.js +10 -18
- package/lib/components/Grid/Grid.js +9 -16
- package/lib/components/Grid/GridContext.js +7 -14
- package/lib/components/Grid/Row.js +8 -14
- package/lib/components/Heading/index.js +14 -21
- package/lib/components/Icon/Icon.Skeleton.js +4 -10
- package/lib/components/IconButton/index.js +25 -33
- package/lib/components/IconIndicator/index.js +9 -15
- package/lib/components/IdPrefix/index.js +3 -10
- package/lib/components/InlineCheckbox/InlineCheckbox.js +17 -22
- package/lib/components/InlineCheckbox/index.js +2 -2
- package/lib/components/InlineLoading/InlineLoading.js +17 -23
- package/lib/components/InlineLoading/index.js +2 -2
- package/lib/components/Layer/LayerContext.js +1 -7
- package/lib/components/Layer/LayerLevel.js +0 -2
- package/lib/components/Layer/index.js +11 -19
- package/lib/components/Layout/index.js +22 -30
- package/lib/components/LayoutDirection/LayoutDirection.js +6 -13
- package/lib/components/LayoutDirection/LayoutDirectionContext.js +1 -7
- package/lib/components/LayoutDirection/useLayoutDirection.js +0 -2
- package/lib/components/Link/Link.js +15 -21
- package/lib/components/Link/index.js +2 -2
- package/lib/components/ListBox/ListBox.js +17 -23
- package/lib/components/ListBox/ListBoxField.js +7 -12
- package/lib/components/ListBox/ListBoxMenu.js +7 -12
- package/lib/components/ListBox/ListBoxMenuIcon.js +7 -13
- package/lib/components/ListBox/ListBoxMenuItem.js +9 -15
- package/lib/components/ListBox/ListBoxPropTypes.js +2 -8
- package/lib/components/ListBox/ListBoxSelection.js +14 -20
- package/lib/components/ListBox/index.js +7 -7
- package/lib/components/ListBox/next/ListBoxSelection.js +18 -24
- package/lib/components/ListBox/next/ListBoxTrigger.js +7 -13
- package/lib/components/ListItem/ListItem.js +5 -11
- package/lib/components/Loading/Loading.js +14 -20
- package/lib/components/Loading/index.js +2 -2
- package/lib/components/Menu/Menu.d.ts +3 -1
- package/lib/components/Menu/Menu.js +18 -24
- package/lib/components/Menu/MenuContext.js +0 -2
- package/lib/components/Menu/MenuItem.js +44 -52
- package/lib/components/MenuButton/index.js +16 -24
- package/lib/components/Modal/Modal.js +91 -86
- package/lib/components/Modal/index.js +2 -2
- package/lib/components/ModalWrapper/ModalWrapper.js +30 -35
- package/lib/components/MultiSelect/FilterableMultiSelect.js +57 -67
- package/lib/components/MultiSelect/MultiSelect.js +61 -70
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +2 -8
- package/lib/components/MultiSelect/filter.js +0 -6
- package/lib/components/MultiSelect/tools/itemToString.d.ts +1 -0
- package/lib/components/MultiSelect/tools/itemToString.js +1 -7
- package/lib/components/MultiSelect/tools/sorting.d.ts +9 -0
- package/lib/components/MultiSelect/tools/sorting.js +0 -2
- package/lib/components/Notification/Notification.js +118 -126
- package/lib/components/NumberInput/NumberFormatPropTypes.js +21 -27
- package/lib/components/NumberInput/NumberInput.Skeleton.js +8 -14
- package/lib/components/NumberInput/NumberInput.js +66 -74
- package/lib/components/OrderedList/OrderedList.js +8 -14
- package/lib/components/OverflowMenu/OverflowMenu.js +42 -49
- package/lib/components/OverflowMenu/index.js +3 -7
- package/lib/components/OverflowMenu/next/index.js +18 -26
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +27 -33
- package/lib/components/OverflowMenuItem/index.js +2 -2
- package/lib/components/OverflowMenuV2/index.d.ts +1 -0
- package/lib/components/OverflowMenuV2/index.js +2 -8
- package/lib/components/PageHeader/PageHeader.js +70 -78
- package/lib/components/PageHeader/index.js +0 -2
- package/lib/components/Pagination/Pagination.Skeleton.js +10 -16
- package/lib/components/Pagination/Pagination.js +44 -51
- package/lib/components/Pagination/experimental/PageSelector.d.ts +19 -0
- package/lib/components/Pagination/experimental/PageSelector.js +9 -15
- package/lib/components/Pagination/experimental/Pagination.d.ts +43 -0
- package/lib/components/Pagination/experimental/Pagination.js +34 -40
- package/lib/components/Pagination/experimental/index.d.ts +3 -0
- package/lib/components/PaginationNav/PaginationNav.js +54 -60
- package/lib/components/Popover/index.js +56 -47
- package/lib/components/PrimaryButton/PrimaryButton.js +2 -6
- package/lib/components/ProgressBar/ProgressBar.js +25 -31
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +10 -16
- package/lib/components/ProgressIndicator/ProgressIndicator.js +41 -49
- package/lib/components/RadioButton/RadioButton.Skeleton.js +6 -12
- package/lib/components/RadioButton/RadioButton.js +26 -32
- package/lib/components/RadioButton/index.js +2 -2
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +37 -43
- package/lib/components/RadioTile/RadioTile.js +25 -31
- package/lib/components/RadioTile/index.js +2 -2
- package/lib/components/Search/Search.Skeleton.js +7 -13
- package/lib/components/Search/Search.js +33 -39
- package/lib/components/Search/index.js +3 -3
- package/lib/components/SecondaryButton/SecondaryButton.js +2 -6
- package/lib/components/Select/Select.Skeleton.js +8 -14
- package/lib/components/Select/Select.js +42 -48
- package/lib/components/Select/index.js +3 -3
- package/lib/components/SelectItem/SelectItem.js +8 -14
- package/lib/components/SelectItem/index.js +2 -2
- package/lib/components/SelectItemGroup/SelectItemGroup.js +7 -13
- package/lib/components/ShapeIndicator/index.js +12 -18
- package/lib/components/SkeletonIcon/SkeletonIcon.js +4 -10
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -10
- package/lib/components/SkeletonText/SkeletonText.js +11 -17
- package/lib/components/SkeletonText/index.js +2 -2
- package/lib/components/Slider/Slider.Skeleton.js +29 -35
- package/lib/components/Slider/Slider.js +84 -90
- package/lib/components/Slider/SliderHandles.js +18 -24
- package/lib/components/Slider/index.js +3 -3
- package/lib/components/Stack/HStack.js +1 -7
- package/lib/components/Stack/Stack.js +7 -15
- package/lib/components/Stack/VStack.js +1 -7
- package/lib/components/StructuredList/StructuredList.Skeleton.js +15 -21
- package/lib/components/StructuredList/StructuredList.js +60 -68
- package/lib/components/Switch/IconSwitch.d.ts +3 -0
- package/lib/components/Switch/IconSwitch.js +18 -25
- package/lib/components/Switch/Switch.js +14 -20
- package/lib/components/TabContent/TabContent.js +7 -33
- package/lib/components/Tabs/Tabs.Skeleton.js +10 -16
- package/lib/components/Tabs/Tabs.js +121 -129
- package/lib/components/Tabs/usePressable.js +0 -2
- package/lib/components/Tag/DismissibleTag.js +24 -30
- package/lib/components/Tag/OperationalTag.js +16 -22
- package/lib/components/Tag/SelectableTag.js +19 -25
- package/lib/components/Tag/Tag.Skeleton.js +5 -11
- package/lib/components/Tag/Tag.js +28 -34
- package/lib/components/Tag/isEllipsisActive.js +0 -2
- package/lib/components/Text/Text.js +6 -13
- package/lib/components/Text/TextDirection.js +4 -11
- package/lib/components/Text/TextDirectionContext.js +0 -2
- package/lib/components/Text/createTextComponent.js +1 -7
- package/lib/components/Text/index.js +0 -2
- package/lib/components/TextArea/TextArea.Skeleton.js +7 -13
- package/lib/components/TextArea/TextArea.js +49 -55
- package/lib/components/TextArea/index.js +3 -3
- package/lib/components/TextInput/ControlledPasswordInput.js +36 -42
- package/lib/components/TextInput/PasswordInput.js +48 -54
- package/lib/components/TextInput/TextInput.Skeleton.js +7 -13
- package/lib/components/TextInput/TextInput.js +47 -53
- package/lib/components/TextInput/index.js +3 -3
- package/lib/components/TextInput/util.d.ts +9 -0
- package/lib/components/TextInput/util.js +0 -2
- package/lib/components/Theme/index.js +16 -24
- package/lib/components/Tile/Tile.js +92 -100
- package/lib/components/TileGroup/TileGroup.js +15 -22
- package/lib/components/TimePicker/TimePicker.js +39 -45
- package/lib/components/TimePickerSelect/TimePickerSelect.js +10 -16
- package/lib/components/Toggle/Toggle.Skeleton.js +7 -13
- package/lib/components/Toggle/Toggle.js +28 -34
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +12 -20
- package/lib/components/Toggletip/index.js +32 -40
- package/lib/components/Tooltip/DefinitionTooltip.js +14 -22
- package/lib/components/Tooltip/Tooltip.js +19 -27
- package/lib/components/TreeView/TreeContext.js +0 -2
- package/lib/components/TreeView/TreeNode.js +41 -47
- package/lib/components/TreeView/TreeView.js +17 -23
- package/lib/components/UIShell/Content.js +6 -12
- package/lib/components/UIShell/Header.js +4 -10
- package/lib/components/UIShell/HeaderContainer.js +4 -9
- package/lib/components/UIShell/HeaderGlobalAction.js +11 -17
- package/lib/components/UIShell/HeaderGlobalBar.js +2 -2
- package/lib/components/UIShell/HeaderMenu.js +17 -23
- package/lib/components/UIShell/HeaderMenuButton.js +9 -15
- package/lib/components/UIShell/HeaderMenuItem.js +11 -17
- package/lib/components/UIShell/HeaderName.js +8 -14
- package/lib/components/UIShell/HeaderNavigation.js +6 -12
- package/lib/components/UIShell/HeaderPanel.js +11 -17
- package/lib/components/UIShell/HeaderSideNavItems.js +6 -12
- package/lib/components/UIShell/Link.js +6 -11
- package/lib/components/UIShell/SideNav.js +23 -29
- package/lib/components/UIShell/SideNavDetails.js +7 -13
- package/lib/components/UIShell/SideNavDivider.js +5 -11
- package/lib/components/UIShell/SideNavFooter.js +12 -18
- package/lib/components/UIShell/SideNavHeader.js +8 -14
- package/lib/components/UIShell/SideNavIcon.js +6 -12
- package/lib/components/UIShell/SideNavItem.js +6 -12
- package/lib/components/UIShell/SideNavItems.js +9 -15
- package/lib/components/UIShell/SideNavLink.js +13 -19
- package/lib/components/UIShell/SideNavLinkText.js +5 -11
- package/lib/components/UIShell/SideNavMenu.js +20 -26
- package/lib/components/UIShell/SideNavMenuItem.js +13 -19
- package/lib/components/UIShell/SideNavSwitcher.js +13 -19
- package/lib/components/UIShell/SkipToContent.js +7 -13
- package/lib/components/UIShell/Switcher.js +9 -15
- package/lib/components/UIShell/SwitcherDivider.js +4 -10
- package/lib/components/UIShell/SwitcherItem.js +15 -21
- package/lib/components/UIShell/_utils.d.ts +7 -0
- package/lib/components/UIShell/_utils.js +0 -2
- package/lib/components/UnorderedList/UnorderedList.js +7 -13
- package/lib/feature-flags.d.ts +1 -0
- package/lib/feature-flags.js +3 -4
- package/lib/index.js +180 -182
- package/lib/internal/FloatingMenu.js +10 -18
- package/lib/internal/OptimizedResize.js +2 -8
- package/lib/internal/Selection.js +1 -7
- package/lib/internal/clamp.js +0 -2
- package/lib/internal/createClassWrapper.js +1 -7
- package/lib/internal/deprecateFieldOnObject.js +1 -3
- package/lib/internal/environment.js +0 -2
- package/lib/internal/getAnnouncement.js +0 -2
- package/lib/internal/keyboard/keys.js +0 -2
- package/lib/internal/keyboard/match.js +0 -2
- package/lib/internal/keyboard/navigation.js +0 -2
- package/lib/internal/noopFn.js +0 -2
- package/lib/internal/useAttachedMenu.js +0 -2
- package/lib/internal/useControllableState.js +0 -2
- package/lib/internal/useDelayedState.js +0 -2
- package/lib/internal/useEvent.js +0 -2
- package/lib/internal/useId.d.ts +21 -0
- package/lib/internal/useId.js +27 -7
- package/lib/internal/useIdPrefix.js +2 -8
- package/lib/internal/useIsomorphicEffect.js +1 -1
- package/lib/internal/useMatchMedia.js +0 -2
- package/lib/internal/useMergedRefs.js +0 -2
- package/lib/internal/useNoInteractiveChildren.js +0 -2
- package/lib/internal/useNormalizedInputProps.js +2 -8
- package/lib/internal/useOutsideClick.js +0 -2
- package/lib/internal/useOverflowItems.js +1 -7
- package/lib/internal/usePrefix.js +2 -8
- package/lib/internal/usePreviousValue.js +0 -2
- package/lib/internal/useResizeObserver.js +0 -2
- package/lib/internal/useSavedCallback.js +0 -2
- package/lib/internal/utils.js +0 -2
- package/lib/internal/warning.js +0 -2
- package/lib/internal/wrapFocus.js +0 -2
- package/lib/node_modules/es-toolkit/dist/compat/function/{debounce.mjs.js → debounce.js} +1 -3
- package/lib/node_modules/es-toolkit/dist/compat/function/{throttle.mjs.js → throttle.js} +1 -3
- package/lib/node_modules/es-toolkit/dist/function/{debounce.mjs.js → debounce.js} +0 -2
- package/lib/prop-types/AriaPropTypes.js +2 -8
- package/lib/prop-types/deprecate.js +0 -2
- package/lib/prop-types/deprecateComponent.d.ts +1 -0
- package/lib/prop-types/deprecateComponent.js +2 -5
- package/lib/prop-types/deprecateValuesWithin.d.ts +1 -0
- package/lib/prop-types/deprecateValuesWithin.js +1 -1
- package/lib/prop-types/isRequiredOneOf.js +0 -2
- package/lib/prop-types/requiredIfGivenPropIsTruthy.d.ts +14 -0
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/lib/tools/events.js +0 -2
- package/lib/tools/mapPopoverAlign.js +0 -2
- package/lib/tools/mergeRefs.d.ts +12 -0
- package/lib/tools/mergeRefs.js +1 -2
- package/lib/tools/setupGetInstanceId.js +0 -2
- package/lib/tools/toggleClass.js +0 -2
- package/lib/tools/wrapComponent.js +4 -10
- package/package.json +11 -11
- /package/es/node_modules/es-toolkit/dist/function/{debounce.mjs.js → debounce.js} +0 -0
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
11
|
var React = require('react');
|
|
14
12
|
var PropTypes = require('prop-types');
|
|
@@ -28,12 +26,6 @@ var mergeRefs = require('../../tools/mergeRefs.js');
|
|
|
28
26
|
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
29
27
|
var mapPopoverAlign = require('../../tools/mapPopoverAlign.js');
|
|
30
28
|
|
|
31
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
32
|
-
|
|
33
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
34
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
35
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
36
|
-
|
|
37
29
|
var _ChevronDown;
|
|
38
30
|
const defaultTranslations = {
|
|
39
31
|
'carbon.combo-button.additional-actions': 'Additional actions'
|
|
@@ -46,7 +38,7 @@ const defaultTranslations = {
|
|
|
46
38
|
function defaultTranslateWithId(messageId) {
|
|
47
39
|
return defaultTranslations[messageId];
|
|
48
40
|
}
|
|
49
|
-
const ComboButton = /*#__PURE__*/
|
|
41
|
+
const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
|
|
50
42
|
children,
|
|
51
43
|
className,
|
|
52
44
|
disabled,
|
|
@@ -98,7 +90,7 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
|
|
|
98
90
|
middleware: middlewares,
|
|
99
91
|
whileElementsMounted: react.autoUpdate
|
|
100
92
|
});
|
|
101
|
-
const ref = mergeRefs
|
|
93
|
+
const ref = mergeRefs.default(forwardRef, containerRef, refs.setReference);
|
|
102
94
|
const {
|
|
103
95
|
open,
|
|
104
96
|
handleClick: hookOnClick,
|
|
@@ -126,24 +118,24 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
|
|
|
126
118
|
onClick(e);
|
|
127
119
|
}
|
|
128
120
|
}
|
|
129
|
-
const containerClasses =
|
|
121
|
+
const containerClasses = cx(`${prefix}--combo-button__container`, `${prefix}--combo-button__container--${size}`, {
|
|
130
122
|
[`${prefix}--combo-button__container--open`]: open
|
|
131
123
|
}, className);
|
|
132
|
-
const menuClasses =
|
|
133
|
-
const primaryActionClasses =
|
|
134
|
-
const triggerClasses =
|
|
135
|
-
return /*#__PURE__*/
|
|
124
|
+
const menuClasses = cx(`${prefix}--combo-button__${menuAlignment}`);
|
|
125
|
+
const primaryActionClasses = cx(`${prefix}--combo-button__primary-action`);
|
|
126
|
+
const triggerClasses = cx(`${prefix}--combo-button__trigger`);
|
|
127
|
+
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
|
136
128
|
className: containerClasses,
|
|
137
129
|
ref: ref,
|
|
138
130
|
"aria-owns": open ? id : undefined
|
|
139
|
-
}), /*#__PURE__*/
|
|
131
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
140
132
|
className: primaryActionClasses
|
|
141
|
-
}, /*#__PURE__*/
|
|
133
|
+
}, /*#__PURE__*/React.createElement(Button.default, {
|
|
142
134
|
title: label,
|
|
143
135
|
size: size,
|
|
144
136
|
disabled: disabled,
|
|
145
137
|
onClick: handlePrimaryActionClick
|
|
146
|
-
}, label)), /*#__PURE__*/
|
|
138
|
+
}, label)), /*#__PURE__*/React.createElement(index$1.IconButton, {
|
|
147
139
|
ref: refs.setReference,
|
|
148
140
|
className: triggerClasses,
|
|
149
141
|
label: t('carbon.combo-button.additional-actions'),
|
|
@@ -155,7 +147,7 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
|
|
|
155
147
|
onClick: handleTriggerClick,
|
|
156
148
|
onMouseDown: handleTriggerMousedown,
|
|
157
149
|
"aria-controls": open ? id : undefined
|
|
158
|
-
}, _ChevronDown || (_ChevronDown = /*#__PURE__*/
|
|
150
|
+
}, _ChevronDown || (_ChevronDown = /*#__PURE__*/React.createElement(iconsReact.ChevronDown, null))), /*#__PURE__*/React.createElement(Menu.Menu, {
|
|
159
151
|
containerRef: containerRef,
|
|
160
152
|
menuAlignment: menuAlignment,
|
|
161
153
|
className: menuClasses,
|
|
@@ -171,35 +163,35 @@ ComboButton.propTypes = {
|
|
|
171
163
|
/**
|
|
172
164
|
* A collection of MenuItems to be rendered as additional actions for this ComboButton.
|
|
173
165
|
*/
|
|
174
|
-
children:
|
|
166
|
+
children: PropTypes.node.isRequired,
|
|
175
167
|
/**
|
|
176
168
|
* Additional CSS class names.
|
|
177
169
|
*/
|
|
178
|
-
className:
|
|
170
|
+
className: PropTypes.string,
|
|
179
171
|
/**
|
|
180
172
|
* Specify whether the ComboButton should be disabled, or not.
|
|
181
173
|
*/
|
|
182
|
-
disabled:
|
|
174
|
+
disabled: PropTypes.bool,
|
|
183
175
|
/**
|
|
184
176
|
* Provide the label to be rendered on the primary action button.
|
|
185
177
|
*/
|
|
186
|
-
label:
|
|
178
|
+
label: PropTypes.string.isRequired,
|
|
187
179
|
/**
|
|
188
180
|
* Experimental property. Specify how the menu should align with the button element
|
|
189
181
|
*/
|
|
190
|
-
menuAlignment:
|
|
182
|
+
menuAlignment: PropTypes.oneOf(['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end']),
|
|
191
183
|
/**
|
|
192
184
|
* Provide an optional function to be called when the primary action element is clicked.
|
|
193
185
|
*/
|
|
194
|
-
onClick:
|
|
186
|
+
onClick: PropTypes.func,
|
|
195
187
|
/**
|
|
196
188
|
* Specify the size of the buttons and menu.
|
|
197
189
|
*/
|
|
198
|
-
size:
|
|
190
|
+
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
199
191
|
/**
|
|
200
192
|
* Specify how the trigger tooltip should be aligned.
|
|
201
193
|
*/
|
|
202
|
-
tooltipAlignment: deprecateValuesWithin
|
|
194
|
+
tooltipAlignment: deprecateValuesWithin.default(PropTypes.oneOf(['top', 'top-left',
|
|
203
195
|
// deprecated use top-start instead
|
|
204
196
|
'top-right',
|
|
205
197
|
// deprecated use top-end instead
|
|
@@ -225,7 +217,7 @@ ComboButton.propTypes = {
|
|
|
225
217
|
* Optional method that takes in a message id and returns an
|
|
226
218
|
* internationalized string.
|
|
227
219
|
*/
|
|
228
|
-
translateWithId:
|
|
220
|
+
translateWithId: PropTypes.func
|
|
229
221
|
};
|
|
230
222
|
|
|
231
223
|
exports.ComboButton = ComboButton;
|
|
@@ -32,15 +32,9 @@ var index$3 = require('../Dialog/index.js');
|
|
|
32
32
|
var warning = require('../../internal/warning.js');
|
|
33
33
|
var index$2 = require('../AILabel/index.js');
|
|
34
34
|
var utils = require('../../internal/utils.js');
|
|
35
|
-
var debounce = require('../../node_modules/es-toolkit/dist/compat/function/debounce.
|
|
35
|
+
var debounce = require('../../node_modules/es-toolkit/dist/compat/function/debounce.js');
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
40
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
41
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
42
|
-
|
|
43
|
-
const ModalBody = /*#__PURE__*/React__default["default"].forwardRef(function ModalBody({
|
|
37
|
+
const ModalBody = /*#__PURE__*/React.forwardRef(function ModalBody({
|
|
44
38
|
className: customClassName,
|
|
45
39
|
children,
|
|
46
40
|
hasForm,
|
|
@@ -50,12 +44,12 @@ const ModalBody = /*#__PURE__*/React__default["default"].forwardRef(function Mod
|
|
|
50
44
|
const prefix = usePrefix.usePrefix();
|
|
51
45
|
const contentRef = React.useRef(null);
|
|
52
46
|
const [isScrollable, setIsScrollable] = React.useState(false);
|
|
53
|
-
const contentClass =
|
|
47
|
+
const contentClass = cx({
|
|
54
48
|
[`${prefix}--modal-content`]: true,
|
|
55
49
|
[`${prefix}--modal-content--with-form`]: hasForm,
|
|
56
50
|
[`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable
|
|
57
51
|
}, customClassName);
|
|
58
|
-
useIsomorphicEffect
|
|
52
|
+
useIsomorphicEffect.default(() => {
|
|
59
53
|
if (contentRef.current) {
|
|
60
54
|
setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
|
|
61
55
|
}
|
|
@@ -75,36 +69,36 @@ const ModalBody = /*#__PURE__*/React__default["default"].forwardRef(function Mod
|
|
|
75
69
|
tabIndex: 0,
|
|
76
70
|
role: 'region'
|
|
77
71
|
} : {};
|
|
78
|
-
return /*#__PURE__*/
|
|
72
|
+
return /*#__PURE__*/React.createElement(index.Layer, _rollupPluginBabelHelpers.extends({
|
|
79
73
|
className: contentClass
|
|
80
74
|
}, hasScrollingContentProps, rest, {
|
|
81
|
-
ref: mergeRefs
|
|
75
|
+
ref: mergeRefs.default(contentRef, ref)
|
|
82
76
|
}), children);
|
|
83
77
|
});
|
|
84
78
|
ModalBody.propTypes = {
|
|
85
79
|
/**
|
|
86
80
|
* Required props for the accessibility label of the header
|
|
87
81
|
*/
|
|
88
|
-
['aria-label']: requiredIfGivenPropIsTruthy
|
|
82
|
+
['aria-label']: requiredIfGivenPropIsTruthy.default('hasScrollingContent', PropTypes.string),
|
|
89
83
|
/**
|
|
90
84
|
* Specify the content to be placed in the ModalBody
|
|
91
85
|
*/
|
|
92
|
-
children:
|
|
86
|
+
children: PropTypes.node,
|
|
93
87
|
/**
|
|
94
88
|
* Specify an optional className to be added to the Modal Body node
|
|
95
89
|
*/
|
|
96
|
-
className:
|
|
90
|
+
className: PropTypes.string,
|
|
97
91
|
/**
|
|
98
92
|
* Provide whether the modal content has a form element.
|
|
99
93
|
* If `true` is used here, non-form child content should have `cds--modal-content__regular-content` class.
|
|
100
94
|
*/
|
|
101
|
-
hasForm:
|
|
95
|
+
hasForm: PropTypes.bool,
|
|
102
96
|
/**
|
|
103
97
|
* Specify whether the modal contains scrolling content
|
|
104
98
|
*/
|
|
105
|
-
hasScrollingContent:
|
|
99
|
+
hasScrollingContent: PropTypes.bool
|
|
106
100
|
};
|
|
107
|
-
const ComposedModal = /*#__PURE__*/
|
|
101
|
+
const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
108
102
|
['aria-labelledby']: ariaLabelledBy,
|
|
109
103
|
['aria-label']: ariaLabel,
|
|
110
104
|
children,
|
|
@@ -156,10 +150,6 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
156
150
|
|
|
157
151
|
function handleKeyDown(event) {
|
|
158
152
|
if (!enableDialogElement) {
|
|
159
|
-
event.stopPropagation();
|
|
160
|
-
if (match.match(event, keys.Escape)) {
|
|
161
|
-
closeModal(event);
|
|
162
|
-
}
|
|
163
153
|
if (focusTrapWithoutSentinels && open && match.match(event, keys.Tab) && innerModal.current) {
|
|
164
154
|
wrapFocus.wrapFocusWithoutSentinels({
|
|
165
155
|
containerNode: innerModal.current,
|
|
@@ -233,30 +223,30 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
233
223
|
setIsOpen(false);
|
|
234
224
|
}
|
|
235
225
|
}
|
|
236
|
-
const modalClass =
|
|
226
|
+
const modalClass = cx(`${prefix}--modal`, {
|
|
237
227
|
'is-visible': isOpen,
|
|
238
228
|
[`${prefix}--modal--danger`]: danger,
|
|
239
229
|
[`${prefix}--modal--slug`]: slug,
|
|
240
230
|
[`${prefix}--modal--decorator`]: decorator
|
|
241
231
|
}, customClassName);
|
|
242
|
-
const containerClass =
|
|
232
|
+
const containerClass = cx(`${prefix}--modal-container`, size && `${prefix}--modal-container--${size}`, isFullWidth && `${prefix}--modal-container--full-width`, containerClassName);
|
|
243
233
|
|
|
244
234
|
// Generate aria-label based on Modal Header label if one is not provided (L253)
|
|
245
235
|
let generatedAriaLabel;
|
|
246
|
-
const childrenWithProps =
|
|
236
|
+
const childrenWithProps = React.Children.toArray(children).map(child => {
|
|
247
237
|
switch (true) {
|
|
248
|
-
case reactIs.isElement(child) && child.type ===
|
|
238
|
+
case reactIs.isElement(child) && child.type === /*#__PURE__*/React.createElement(ModalHeader.ModalHeader).type:
|
|
249
239
|
{
|
|
250
240
|
const el = child;
|
|
251
241
|
generatedAriaLabel = el.props.label;
|
|
252
|
-
return /*#__PURE__*/
|
|
242
|
+
return /*#__PURE__*/React.cloneElement(el, {
|
|
253
243
|
closeModal
|
|
254
244
|
});
|
|
255
245
|
}
|
|
256
|
-
case reactIs.isElement(child) && child.type ===
|
|
246
|
+
case reactIs.isElement(child) && child.type === /*#__PURE__*/React.createElement(ModalFooter.ModalFooter).type:
|
|
257
247
|
{
|
|
258
248
|
const el = child;
|
|
259
|
-
return /*#__PURE__*/
|
|
249
|
+
return /*#__PURE__*/React.cloneElement(el, {
|
|
260
250
|
closeModal,
|
|
261
251
|
inputref: button,
|
|
262
252
|
danger
|
|
@@ -266,6 +256,20 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
266
256
|
return child;
|
|
267
257
|
}
|
|
268
258
|
});
|
|
259
|
+
React.useEffect(() => {
|
|
260
|
+
if (!open) return;
|
|
261
|
+
const handleEscapeKey = event => {
|
|
262
|
+
if (match.match(event, keys.Escape)) {
|
|
263
|
+
event.preventDefault();
|
|
264
|
+
event.stopPropagation();
|
|
265
|
+
closeModal(event);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
document.addEventListener('keydown', handleEscapeKey, true);
|
|
269
|
+
return () => {
|
|
270
|
+
document.removeEventListener('keydown', handleEscapeKey, true);
|
|
271
|
+
};
|
|
272
|
+
}, [open]);
|
|
269
273
|
React.useEffect(() => {
|
|
270
274
|
if (!enableDialogElement && !open && launcherButtonRef) {
|
|
271
275
|
setTimeout(() => {
|
|
@@ -304,39 +308,39 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
304
308
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
|
|
305
309
|
size: 'sm'
|
|
306
310
|
}) : null;
|
|
307
|
-
const modalBody = enableDialogElement ? /*#__PURE__*/
|
|
311
|
+
const modalBody = enableDialogElement ? /*#__PURE__*/React.createElement(index$3.unstable__Dialog, {
|
|
308
312
|
open: open,
|
|
309
313
|
focusAfterCloseRef: launcherButtonRef,
|
|
310
314
|
modal: true,
|
|
311
315
|
className: containerClass,
|
|
312
316
|
"aria-label": ariaLabel ? ariaLabel : generatedAriaLabel,
|
|
313
317
|
"aria-labelledby": ariaLabelledBy
|
|
314
|
-
}, /*#__PURE__*/
|
|
318
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
315
319
|
ref: innerModal,
|
|
316
320
|
className: `${prefix}--modal-container-body`
|
|
317
|
-
}, slug ? normalizedDecorator : decorator ? /*#__PURE__*/
|
|
321
|
+
}, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
318
322
|
className: `${prefix}--modal--inner__decorator`
|
|
319
|
-
}, normalizedDecorator) : '', childrenWithProps)) : /*#__PURE__*/
|
|
323
|
+
}, normalizedDecorator) : '', childrenWithProps)) : /*#__PURE__*/React.createElement("div", {
|
|
320
324
|
className: containerClass,
|
|
321
325
|
role: "dialog",
|
|
322
326
|
"aria-modal": "true",
|
|
323
327
|
"aria-label": ariaLabel ? ariaLabel : generatedAriaLabel,
|
|
324
328
|
"aria-labelledby": ariaLabelledBy
|
|
325
|
-
}, !focusTrapWithoutSentinels && /*#__PURE__*/
|
|
329
|
+
}, !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("button", {
|
|
326
330
|
type: "button",
|
|
327
331
|
ref: startSentinel,
|
|
328
332
|
className: `${prefix}--visually-hidden`
|
|
329
|
-
}, "Focus sentinel"), /*#__PURE__*/
|
|
333
|
+
}, "Focus sentinel"), /*#__PURE__*/React.createElement("div", {
|
|
330
334
|
ref: innerModal,
|
|
331
335
|
className: `${prefix}--modal-container-body`
|
|
332
|
-
}, slug ? normalizedDecorator : decorator ? /*#__PURE__*/
|
|
336
|
+
}, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
333
337
|
className: `${prefix}--modal--inner__decorator`
|
|
334
|
-
}, normalizedDecorator) : '', childrenWithProps), !focusTrapWithoutSentinels && /*#__PURE__*/
|
|
338
|
+
}, normalizedDecorator) : '', childrenWithProps), !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("button", {
|
|
335
339
|
type: "button",
|
|
336
340
|
ref: endSentinel,
|
|
337
341
|
className: `${prefix}--visually-hidden`
|
|
338
342
|
}, "Focus sentinel"));
|
|
339
|
-
return /*#__PURE__*/
|
|
343
|
+
return /*#__PURE__*/React.createElement(index.Layer, _rollupPluginBabelHelpers.extends({}, rest, {
|
|
340
344
|
level: 0,
|
|
341
345
|
role: "presentation",
|
|
342
346
|
ref: ref,
|
|
@@ -352,72 +356,72 @@ ComposedModal.propTypes = {
|
|
|
352
356
|
/**
|
|
353
357
|
* Specify the aria-label for cds--modal-container
|
|
354
358
|
*/
|
|
355
|
-
['aria-label']:
|
|
359
|
+
['aria-label']: PropTypes.string,
|
|
356
360
|
/**
|
|
357
361
|
* Specify the aria-labelledby for cds--modal-container
|
|
358
362
|
*/
|
|
359
|
-
['aria-labelledby']:
|
|
363
|
+
['aria-labelledby']: PropTypes.string,
|
|
360
364
|
/**
|
|
361
365
|
* Specify the content to be placed in the ComposedModal
|
|
362
366
|
*/
|
|
363
|
-
children:
|
|
367
|
+
children: PropTypes.node,
|
|
364
368
|
/**
|
|
365
369
|
* Specify an optional className to be applied to the modal root node
|
|
366
370
|
*/
|
|
367
|
-
className:
|
|
371
|
+
className: PropTypes.string,
|
|
368
372
|
/**
|
|
369
373
|
* Specify an optional className to be applied to the modal node
|
|
370
374
|
*/
|
|
371
|
-
containerClassName:
|
|
375
|
+
containerClassName: PropTypes.string,
|
|
372
376
|
/**
|
|
373
377
|
* Specify whether the primary button should be replaced with danger button.
|
|
374
378
|
* Note that this prop is not applied if you render primary/danger button by yourself
|
|
375
379
|
*/
|
|
376
|
-
danger:
|
|
380
|
+
danger: PropTypes.bool,
|
|
377
381
|
/**
|
|
378
382
|
* **Experimental**: Provide a `decorator` component to be rendered inside the `ComposedModal` component
|
|
379
383
|
*/
|
|
380
|
-
decorator:
|
|
384
|
+
decorator: PropTypes.node,
|
|
381
385
|
/**
|
|
382
386
|
* Specify whether the Modal content should have any inner padding.
|
|
383
387
|
*/
|
|
384
|
-
isFullWidth:
|
|
388
|
+
isFullWidth: PropTypes.bool,
|
|
385
389
|
/**
|
|
386
390
|
* Provide a ref to return focus to once the modal is closed.
|
|
387
391
|
*/
|
|
388
|
-
launcherButtonRef:
|
|
389
|
-
current:
|
|
392
|
+
launcherButtonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
393
|
+
current: PropTypes.any
|
|
390
394
|
})]),
|
|
391
395
|
/**
|
|
392
396
|
* Specify an optional handler for closing modal.
|
|
393
397
|
* Returning `false` here prevents closing modal.
|
|
394
398
|
*/
|
|
395
|
-
onClose:
|
|
399
|
+
onClose: PropTypes.func,
|
|
396
400
|
/**
|
|
397
401
|
* Specify an optional handler for the `onKeyDown` event. Called for all
|
|
398
402
|
* `onKeyDown` events that do not close the modal
|
|
399
403
|
*/
|
|
400
|
-
onKeyDown:
|
|
404
|
+
onKeyDown: PropTypes.func,
|
|
401
405
|
/**
|
|
402
406
|
* Specify whether the Modal is currently open
|
|
403
407
|
*/
|
|
404
|
-
open:
|
|
405
|
-
preventCloseOnClickOutside:
|
|
408
|
+
open: PropTypes.bool,
|
|
409
|
+
preventCloseOnClickOutside: PropTypes.bool,
|
|
406
410
|
/**
|
|
407
411
|
* Specify a CSS selector that matches the DOM element that should be
|
|
408
412
|
* focused when the Modal opens
|
|
409
413
|
*/
|
|
410
|
-
selectorPrimaryFocus:
|
|
414
|
+
selectorPrimaryFocus: PropTypes.string,
|
|
411
415
|
/**
|
|
412
416
|
* Specify the CSS selectors that match the floating menus
|
|
413
417
|
*/
|
|
414
|
-
selectorsFloatingMenus:
|
|
418
|
+
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
415
419
|
/**
|
|
416
420
|
* Specify the size variant.
|
|
417
421
|
*/
|
|
418
|
-
size:
|
|
419
|
-
slug: deprecate.deprecate(
|
|
422
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
423
|
+
slug: deprecate.deprecate(PropTypes.node, 'The `slug` prop for `ComposedModal` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.')
|
|
420
424
|
};
|
|
421
425
|
|
|
422
426
|
exports.ModalBody = ModalBody;
|
|
423
|
-
exports
|
|
427
|
+
exports.default = ComposedModal;
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
11
|
var React = require('react');
|
|
14
12
|
var PropTypes = require('prop-types');
|
|
@@ -20,12 +18,6 @@ var usePrefix = require('../../internal/usePrefix.js');
|
|
|
20
18
|
var noopFn = require('../../internal/noopFn.js');
|
|
21
19
|
var InlineLoading = require('../InlineLoading/InlineLoading.js');
|
|
22
20
|
|
|
23
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
|
-
|
|
25
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
27
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
28
|
-
|
|
29
21
|
function SecondaryButtonSet({
|
|
30
22
|
secondaryButtons,
|
|
31
23
|
secondaryButtonText,
|
|
@@ -39,10 +31,10 @@ function SecondaryButtonSet({
|
|
|
39
31
|
onRequestClose(evt);
|
|
40
32
|
}
|
|
41
33
|
if (Array.isArray(secondaryButtons) && secondaryButtons.length <= 2) {
|
|
42
|
-
return /*#__PURE__*/
|
|
34
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, secondaryButtons.map(({
|
|
43
35
|
buttonText,
|
|
44
36
|
onClick: onButtonClick
|
|
45
|
-
}, i) => /*#__PURE__*/
|
|
37
|
+
}, i) => /*#__PURE__*/React.createElement(Button.default, {
|
|
46
38
|
key: `${buttonText}-${i}`,
|
|
47
39
|
className: secondaryClassName,
|
|
48
40
|
kind: "secondary",
|
|
@@ -50,7 +42,7 @@ function SecondaryButtonSet({
|
|
|
50
42
|
}, buttonText)));
|
|
51
43
|
}
|
|
52
44
|
if (secondaryButtonText) {
|
|
53
|
-
return /*#__PURE__*/
|
|
45
|
+
return /*#__PURE__*/React.createElement(Button.default, {
|
|
54
46
|
disabled: disabled,
|
|
55
47
|
className: secondaryClassName,
|
|
56
48
|
onClick: handleRequestClose,
|
|
@@ -60,28 +52,28 @@ function SecondaryButtonSet({
|
|
|
60
52
|
return null;
|
|
61
53
|
}
|
|
62
54
|
SecondaryButtonSet.propTypes = {
|
|
63
|
-
closeModal:
|
|
64
|
-
disabled:
|
|
65
|
-
onRequestClose:
|
|
66
|
-
secondaryButtonText:
|
|
55
|
+
closeModal: PropTypes.func,
|
|
56
|
+
disabled: PropTypes.bool,
|
|
57
|
+
onRequestClose: PropTypes.func,
|
|
58
|
+
secondaryButtonText: PropTypes.string,
|
|
67
59
|
secondaryButtons: (props, propName, componentName) => {
|
|
68
60
|
if (props.secondaryButtons) {
|
|
69
61
|
if (!Array.isArray(props.secondaryButtons) || props.secondaryButtons.length !== 2) {
|
|
70
62
|
return new Error(`${propName} needs to be an array of two button config objects`);
|
|
71
63
|
}
|
|
72
64
|
const shape = {
|
|
73
|
-
buttonText:
|
|
74
|
-
onClick:
|
|
65
|
+
buttonText: PropTypes.node,
|
|
66
|
+
onClick: PropTypes.func
|
|
75
67
|
};
|
|
76
68
|
props[propName].forEach(secondaryButton => {
|
|
77
|
-
|
|
69
|
+
PropTypes.checkPropTypes(shape, secondaryButton, propName, componentName);
|
|
78
70
|
});
|
|
79
71
|
}
|
|
80
72
|
return null;
|
|
81
73
|
},
|
|
82
|
-
secondaryClassName:
|
|
74
|
+
secondaryClassName: PropTypes.string
|
|
83
75
|
};
|
|
84
|
-
const ModalFooter = /*#__PURE__*/
|
|
76
|
+
const ModalFooter = /*#__PURE__*/React.forwardRef(function ModalFooter({
|
|
85
77
|
children,
|
|
86
78
|
className: customClassName,
|
|
87
79
|
closeModal = noopFn.noopFn,
|
|
@@ -102,8 +94,8 @@ const ModalFooter = /*#__PURE__*/React__default["default"].forwardRef(function M
|
|
|
102
94
|
...rest
|
|
103
95
|
}, ref) {
|
|
104
96
|
const prefix = usePrefix.usePrefix();
|
|
105
|
-
const footerClass =
|
|
106
|
-
const primaryButtonClass =
|
|
97
|
+
const footerClass = cx(`${prefix}--modal-footer`, customClassName, Array.isArray(secondaryButtons) && secondaryButtons.length === 2 ? `${prefix}--modal-footer--three-button` : null);
|
|
98
|
+
const primaryButtonClass = cx(primaryClassName, loadingStatus !== 'inactive' ? `${prefix}--btn--loading` : null);
|
|
107
99
|
const loadingActive = loadingStatus !== 'inactive';
|
|
108
100
|
const secondaryButtonProps = {
|
|
109
101
|
closeModal,
|
|
@@ -113,19 +105,19 @@ const ModalFooter = /*#__PURE__*/React__default["default"].forwardRef(function M
|
|
|
113
105
|
onRequestClose,
|
|
114
106
|
disabled: loadingActive
|
|
115
107
|
};
|
|
116
|
-
return /*#__PURE__*/
|
|
108
|
+
return /*#__PURE__*/React.createElement(ButtonSet.default, _rollupPluginBabelHelpers.extends({
|
|
117
109
|
className: footerClass
|
|
118
110
|
}, rest, {
|
|
119
111
|
// @ts-expect-error: Invalid derived types, will be fine once explicit types are added
|
|
120
112
|
ref: ref,
|
|
121
113
|
"aria-busy": loadingActive
|
|
122
|
-
}), /*#__PURE__*/
|
|
114
|
+
}), /*#__PURE__*/React.createElement(SecondaryButtonSet, secondaryButtonProps), primaryButtonText && /*#__PURE__*/React.createElement(Button.default, {
|
|
123
115
|
onClick: onRequestSubmit,
|
|
124
116
|
className: primaryButtonClass,
|
|
125
117
|
disabled: loadingActive || primaryButtonDisabled,
|
|
126
118
|
kind: danger ? 'danger' : 'primary',
|
|
127
119
|
ref: inputref
|
|
128
|
-
}, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/
|
|
120
|
+
}, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/React.createElement(InlineLoading.default, {
|
|
129
121
|
status: loadingStatus,
|
|
130
122
|
description: loadingDescription,
|
|
131
123
|
iconDescription: loadingIconDescription,
|
|
@@ -137,69 +129,69 @@ ModalFooter.propTypes = {
|
|
|
137
129
|
/**
|
|
138
130
|
* Pass in content that will be rendered in the Modal Footer
|
|
139
131
|
*/
|
|
140
|
-
children:
|
|
132
|
+
children: PropTypes.node,
|
|
141
133
|
/**
|
|
142
134
|
* Specify a custom className to be applied to the Modal Footer container
|
|
143
135
|
*/
|
|
144
|
-
className:
|
|
136
|
+
className: PropTypes.string,
|
|
145
137
|
/**
|
|
146
138
|
* Specify an optional function that is called whenever the modal is closed
|
|
147
139
|
*/
|
|
148
|
-
closeModal:
|
|
140
|
+
closeModal: PropTypes.func,
|
|
149
141
|
/**
|
|
150
142
|
* Specify whether the primary button should be replaced with danger button.
|
|
151
143
|
* Note that this prop is not applied if you render primary/danger button by yourself
|
|
152
144
|
*/
|
|
153
|
-
danger:
|
|
145
|
+
danger: PropTypes.bool,
|
|
154
146
|
/**
|
|
155
147
|
* The `ref` callback for the primary button.
|
|
156
148
|
*/
|
|
157
|
-
inputref:
|
|
158
|
-
current:
|
|
149
|
+
inputref: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
150
|
+
current: PropTypes.any
|
|
159
151
|
})]),
|
|
160
152
|
/**
|
|
161
153
|
* Specify the description for the loading text
|
|
162
154
|
*/
|
|
163
|
-
loadingDescription:
|
|
155
|
+
loadingDescription: PropTypes.string,
|
|
164
156
|
/**
|
|
165
157
|
* Specify the description for the loading text
|
|
166
158
|
*/
|
|
167
|
-
loadingIconDescription:
|
|
159
|
+
loadingIconDescription: PropTypes.string,
|
|
168
160
|
/**
|
|
169
161
|
* loading status
|
|
170
162
|
*/
|
|
171
|
-
loadingStatus:
|
|
163
|
+
loadingStatus: PropTypes.oneOf(['inactive', 'active', 'finished', 'error']),
|
|
172
164
|
/**
|
|
173
165
|
* Provide an optional handler to be invoked when loading is
|
|
174
166
|
* successful
|
|
175
167
|
*/
|
|
176
|
-
onLoadingSuccess:
|
|
168
|
+
onLoadingSuccess: PropTypes.func,
|
|
177
169
|
/**
|
|
178
170
|
* Specify an optional function for when the modal is requesting to be
|
|
179
171
|
* closed
|
|
180
172
|
*/
|
|
181
|
-
onRequestClose:
|
|
173
|
+
onRequestClose: PropTypes.func,
|
|
182
174
|
/**
|
|
183
175
|
* Specify an optional function for when the modal is requesting to be
|
|
184
176
|
* submitted
|
|
185
177
|
*/
|
|
186
|
-
onRequestSubmit:
|
|
178
|
+
onRequestSubmit: PropTypes.func,
|
|
187
179
|
/**
|
|
188
180
|
* Specify whether the primary button should be disabled
|
|
189
181
|
*/
|
|
190
|
-
primaryButtonDisabled:
|
|
182
|
+
primaryButtonDisabled: PropTypes.bool,
|
|
191
183
|
/**
|
|
192
184
|
* Specify the text for the primary button
|
|
193
185
|
*/
|
|
194
|
-
primaryButtonText:
|
|
186
|
+
primaryButtonText: PropTypes.string,
|
|
195
187
|
/**
|
|
196
188
|
* Specify a custom className to be applied to the primary button
|
|
197
189
|
*/
|
|
198
|
-
primaryClassName:
|
|
190
|
+
primaryClassName: PropTypes.string,
|
|
199
191
|
/**
|
|
200
192
|
* Specify the text for the secondary button
|
|
201
193
|
*/
|
|
202
|
-
secondaryButtonText:
|
|
194
|
+
secondaryButtonText: PropTypes.string,
|
|
203
195
|
/**
|
|
204
196
|
* Specify an array of config objects for secondary buttons
|
|
205
197
|
* (`Array<{
|
|
@@ -213,11 +205,11 @@ ModalFooter.propTypes = {
|
|
|
213
205
|
return new Error(`${propName} needs to be an array of two button config objects`);
|
|
214
206
|
}
|
|
215
207
|
const shape = {
|
|
216
|
-
buttonText:
|
|
217
|
-
onClick:
|
|
208
|
+
buttonText: PropTypes.node,
|
|
209
|
+
onClick: PropTypes.func
|
|
218
210
|
};
|
|
219
211
|
props[propName].forEach(secondaryButton => {
|
|
220
|
-
|
|
212
|
+
PropTypes.checkPropTypes(shape, secondaryButton, propName, componentName);
|
|
221
213
|
});
|
|
222
214
|
}
|
|
223
215
|
return null;
|
|
@@ -225,7 +217,7 @@ ModalFooter.propTypes = {
|
|
|
225
217
|
/**
|
|
226
218
|
* Specify a custom className to be applied to the secondary button
|
|
227
219
|
*/
|
|
228
|
-
secondaryClassName:
|
|
220
|
+
secondaryClassName: PropTypes.string
|
|
229
221
|
};
|
|
230
222
|
|
|
231
223
|
exports.ModalFooter = ModalFooter;
|