@carbon/react 1.87.0-rc.0 → 1.87.1-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 +739 -739
- 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
|
@@ -38,18 +38,12 @@ var index$2 = require('../Dialog/index.js');
|
|
|
38
38
|
var index$1 = require('../AILabel/index.js');
|
|
39
39
|
var utils = require('../../internal/utils.js');
|
|
40
40
|
var warning = require('../../internal/warning.js');
|
|
41
|
-
var debounce = require('../../node_modules/es-toolkit/dist/compat/function/debounce.
|
|
41
|
+
var debounce = require('../../node_modules/es-toolkit/dist/compat/function/debounce.js');
|
|
42
42
|
var Text = require('../Text/Text.js');
|
|
43
43
|
|
|
44
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
45
|
-
|
|
46
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
47
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
48
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
49
|
-
|
|
50
44
|
const ModalSizes = ['xs', 'sm', 'md', 'lg'];
|
|
51
45
|
const invalidOutsideClickMessage = '`Modal`: `preventCloseOnClickOutside` should not be `false` when `passiveModal` is `false`. Non-passive `Modal`s should not be dismissible by clicking outside.';
|
|
52
|
-
const Modal = /*#__PURE__*/
|
|
46
|
+
const Modal = /*#__PURE__*/React.forwardRef(function Modal({
|
|
53
47
|
'aria-label': ariaLabelProp,
|
|
54
48
|
children,
|
|
55
49
|
className,
|
|
@@ -98,7 +92,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal({
|
|
|
98
92
|
const modalHeadingId = `${prefix}--modal-header__heading--${modalInstanceId}`;
|
|
99
93
|
const modalBodyId = `${prefix}--modal-body--${modalInstanceId}`;
|
|
100
94
|
const modalCloseButtonClass = `${prefix}--modal-close`;
|
|
101
|
-
const primaryButtonClass =
|
|
95
|
+
const primaryButtonClass = cx({
|
|
102
96
|
[`${prefix}--btn--loading`]: loadingStatus !== 'inactive'
|
|
103
97
|
});
|
|
104
98
|
const loadingActive = loadingStatus !== 'inactive';
|
|
@@ -117,9 +111,6 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal({
|
|
|
117
111
|
} = evt;
|
|
118
112
|
evt.stopPropagation();
|
|
119
113
|
if (open && target instanceof HTMLElement) {
|
|
120
|
-
if (match.match(evt, keys.Escape)) {
|
|
121
|
-
onRequestClose(evt);
|
|
122
|
-
}
|
|
123
114
|
if (match.match(evt, keys.Enter) && shouldSubmitOnEnter && !isCloseButton(target) && document.activeElement !== button.current) {
|
|
124
115
|
onRequestSubmit(evt);
|
|
125
116
|
}
|
|
@@ -183,21 +174,21 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal({
|
|
|
183
174
|
}
|
|
184
175
|
}
|
|
185
176
|
const onSecondaryButtonClick = onSecondarySubmit ? onSecondarySubmit : onRequestClose;
|
|
186
|
-
const modalClasses =
|
|
177
|
+
const modalClasses = cx(`${prefix}--modal`, {
|
|
187
178
|
[`${prefix}--modal-tall`]: !passiveModal,
|
|
188
179
|
'is-visible': open,
|
|
189
180
|
[`${prefix}--modal--danger`]: danger,
|
|
190
181
|
[`${prefix}--modal--slug`]: slug,
|
|
191
182
|
[`${prefix}--modal--decorator`]: decorator
|
|
192
183
|
}, className);
|
|
193
|
-
const containerClasses =
|
|
184
|
+
const containerClasses = cx(`${prefix}--modal-container`, {
|
|
194
185
|
[`${prefix}--modal-container--${size}`]: size,
|
|
195
186
|
[`${prefix}--modal-container--full-width`]: isFullWidth
|
|
196
187
|
});
|
|
197
|
-
const contentClasses =
|
|
188
|
+
const contentClasses = cx(`${prefix}--modal-content`, {
|
|
198
189
|
[`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable
|
|
199
190
|
});
|
|
200
|
-
const footerClasses =
|
|
191
|
+
const footerClasses = cx(`${prefix}--modal-footer`, {
|
|
201
192
|
[`${prefix}--modal-footer--three-button`]: Array.isArray(secondaryButtons) && secondaryButtons.length === 2
|
|
202
193
|
});
|
|
203
194
|
const asStringOrUndefined = node => {
|
|
@@ -221,6 +212,20 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal({
|
|
|
221
212
|
alertDialogProps.role = 'alertdialog';
|
|
222
213
|
alertDialogProps['aria-describedby'] = modalBodyId;
|
|
223
214
|
}
|
|
215
|
+
React.useEffect(() => {
|
|
216
|
+
if (!open) return;
|
|
217
|
+
const handleEscapeKey = event => {
|
|
218
|
+
if (match.match(event, keys.Escape)) {
|
|
219
|
+
event.preventDefault();
|
|
220
|
+
event.stopPropagation();
|
|
221
|
+
onRequestClose(event);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
document.addEventListener('keydown', handleEscapeKey, true);
|
|
225
|
+
return () => {
|
|
226
|
+
document.removeEventListener('keydown', handleEscapeKey, true);
|
|
227
|
+
};
|
|
228
|
+
}, [open]);
|
|
224
229
|
React.useEffect(() => {
|
|
225
230
|
return () => {
|
|
226
231
|
if (!enableDialogElement) {
|
|
@@ -263,7 +268,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal({
|
|
|
263
268
|
}
|
|
264
269
|
}
|
|
265
270
|
}, [open, selectorPrimaryFocus, danger, prefix, enableDialogElement]);
|
|
266
|
-
useIsomorphicEffect
|
|
271
|
+
useIsomorphicEffect.default(() => {
|
|
267
272
|
if (contentRef.current) {
|
|
268
273
|
setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
|
|
269
274
|
}
|
|
@@ -286,16 +291,16 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal({
|
|
|
286
291
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
|
|
287
292
|
size: 'sm'
|
|
288
293
|
}) : null;
|
|
289
|
-
const modalButton = /*#__PURE__*/
|
|
294
|
+
const modalButton = /*#__PURE__*/React.createElement("div", {
|
|
290
295
|
className: `${prefix}--modal-close-button`
|
|
291
|
-
}, /*#__PURE__*/
|
|
296
|
+
}, /*#__PURE__*/React.createElement(index$3.IconButton, {
|
|
292
297
|
className: modalCloseButtonClass,
|
|
293
298
|
label: closeButtonLabel,
|
|
294
299
|
onClick: onRequestClose,
|
|
295
300
|
"aria-label": closeButtonLabel,
|
|
296
301
|
align: "left",
|
|
297
302
|
ref: button
|
|
298
|
-
}, /*#__PURE__*/
|
|
303
|
+
}, /*#__PURE__*/React.createElement(iconsReact.Close, {
|
|
299
304
|
size: 20,
|
|
300
305
|
"aria-hidden": "true",
|
|
301
306
|
tabIndex: "-1",
|
|
@@ -305,7 +310,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal({
|
|
|
305
310
|
// alertdialog is the only permitted aria role for a native dialog element
|
|
306
311
|
// https://www.w3.org/TR/html-aria/#docconformance:~:text=Role%3A-,alertdialog,-.%20(dialog%20is
|
|
307
312
|
const isAlertDialog = alert && !passiveModal;
|
|
308
|
-
const modalBody = enableDialogElement ? /*#__PURE__*/
|
|
313
|
+
const modalBody = enableDialogElement ? /*#__PURE__*/React.createElement(index$2.unstable__Dialog, {
|
|
309
314
|
open: open,
|
|
310
315
|
focusAfterCloseRef: launcherButtonRef,
|
|
311
316
|
modal: true,
|
|
@@ -314,69 +319,69 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal({
|
|
|
314
319
|
"aria-describedby": isAlertDialog ? modalBodyId : '',
|
|
315
320
|
className: containerClasses,
|
|
316
321
|
"aria-label": ariaLabel
|
|
317
|
-
}, /*#__PURE__*/
|
|
322
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
318
323
|
className: `${prefix}--modal-header`
|
|
319
|
-
}, modalLabel && /*#__PURE__*/
|
|
324
|
+
}, modalLabel && /*#__PURE__*/React.createElement(Text.Text, {
|
|
320
325
|
as: "h2",
|
|
321
326
|
id: modalLabelId,
|
|
322
327
|
className: `${prefix}--modal-header__label`
|
|
323
|
-
}, modalLabel), /*#__PURE__*/
|
|
328
|
+
}, modalLabel), /*#__PURE__*/React.createElement(Text.Text, {
|
|
324
329
|
as: "h2",
|
|
325
330
|
id: modalHeadingId,
|
|
326
331
|
className: `${prefix}--modal-header__heading`
|
|
327
|
-
}, modalHeading), decorator ? /*#__PURE__*/
|
|
332
|
+
}, modalHeading), decorator ? /*#__PURE__*/React.createElement("div", {
|
|
328
333
|
className: `${prefix}--modal--inner__decorator`
|
|
329
|
-
}, normalizedDecorator) : '', /*#__PURE__*/
|
|
334
|
+
}, normalizedDecorator) : '', /*#__PURE__*/React.createElement("div", {
|
|
330
335
|
className: `${prefix}--modal-close-button`
|
|
331
|
-
}, /*#__PURE__*/
|
|
336
|
+
}, /*#__PURE__*/React.createElement(index$3.IconButton, {
|
|
332
337
|
className: modalCloseButtonClass,
|
|
333
338
|
label: closeButtonLabel,
|
|
334
339
|
onClick: onRequestClose,
|
|
335
340
|
"aria-label": closeButtonLabel,
|
|
336
341
|
align: "left",
|
|
337
342
|
ref: button
|
|
338
|
-
}, /*#__PURE__*/
|
|
343
|
+
}, /*#__PURE__*/React.createElement(iconsReact.Close, {
|
|
339
344
|
size: 20,
|
|
340
345
|
"aria-hidden": "true",
|
|
341
346
|
tabIndex: "-1",
|
|
342
347
|
className: `${modalCloseButtonClass}__icon`
|
|
343
|
-
})))), /*#__PURE__*/
|
|
348
|
+
})))), /*#__PURE__*/React.createElement(index$4.Layer, _rollupPluginBabelHelpers.extends({
|
|
344
349
|
ref: contentRef,
|
|
345
350
|
id: modalBodyId,
|
|
346
351
|
className: contentClasses
|
|
347
|
-
}, hasScrollingContentProps), children), !passiveModal && /*#__PURE__*/
|
|
352
|
+
}, hasScrollingContentProps), children), !passiveModal && /*#__PURE__*/React.createElement(ButtonSet.default, {
|
|
348
353
|
className: footerClasses,
|
|
349
354
|
"aria-busy": loadingActive
|
|
350
355
|
}, Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map(({
|
|
351
356
|
buttonText,
|
|
352
357
|
onClick: onButtonClick
|
|
353
|
-
}, i) => /*#__PURE__*/
|
|
358
|
+
}, i) => /*#__PURE__*/React.createElement(Button.default, {
|
|
354
359
|
key: `${buttonText}-${i}`,
|
|
355
360
|
kind: "secondary",
|
|
356
361
|
onClick: onButtonClick
|
|
357
|
-
}, buttonText)) : secondaryButtonText && /*#__PURE__*/
|
|
362
|
+
}, buttonText)) : secondaryButtonText && /*#__PURE__*/React.createElement(Button.default, {
|
|
358
363
|
disabled: loadingActive,
|
|
359
364
|
kind: "secondary",
|
|
360
365
|
onClick: onSecondaryButtonClick,
|
|
361
366
|
ref: secondaryButton
|
|
362
|
-
}, secondaryButtonText), /*#__PURE__*/
|
|
367
|
+
}, secondaryButtonText), /*#__PURE__*/React.createElement(Button.default, {
|
|
363
368
|
className: primaryButtonClass,
|
|
364
369
|
kind: danger ? 'danger' : 'primary',
|
|
365
370
|
disabled: loadingActive || primaryButtonDisabled,
|
|
366
371
|
onClick: onRequestSubmit,
|
|
367
372
|
ref: button
|
|
368
|
-
}, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/
|
|
373
|
+
}, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/React.createElement(InlineLoading.default, {
|
|
369
374
|
status: loadingStatus,
|
|
370
375
|
description: loadingDescription,
|
|
371
376
|
iconDescription: loadingIconDescription,
|
|
372
377
|
className: `${prefix}--inline-loading--btn`,
|
|
373
378
|
onSuccess: onLoadingSuccess
|
|
374
|
-
})))) : /*#__PURE__*/
|
|
379
|
+
})))) : /*#__PURE__*/React.createElement(React.Fragment, null, !enableDialogElement && !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("span", {
|
|
375
380
|
ref: startTrap,
|
|
376
381
|
tabIndex: 0,
|
|
377
382
|
role: "link",
|
|
378
383
|
className: `${prefix}--visually-hidden`
|
|
379
|
-
}, "Focus sentinel"), /*#__PURE__*/
|
|
384
|
+
}, "Focus sentinel"), /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
380
385
|
ref: innerModal,
|
|
381
386
|
role: "dialog"
|
|
382
387
|
}, alertDialogProps, {
|
|
@@ -384,56 +389,56 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal({
|
|
|
384
389
|
"aria-label": ariaLabel,
|
|
385
390
|
"aria-modal": "true",
|
|
386
391
|
tabIndex: -1
|
|
387
|
-
}), /*#__PURE__*/
|
|
392
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
388
393
|
className: `${prefix}--modal-header`
|
|
389
|
-
}, passiveModal && modalButton, modalLabel && /*#__PURE__*/
|
|
394
|
+
}, passiveModal && modalButton, modalLabel && /*#__PURE__*/React.createElement(Text.Text, {
|
|
390
395
|
as: "h2",
|
|
391
396
|
id: modalLabelId,
|
|
392
397
|
className: `${prefix}--modal-header__label`
|
|
393
|
-
}, modalLabel), /*#__PURE__*/
|
|
398
|
+
}, modalLabel), /*#__PURE__*/React.createElement(Text.Text, {
|
|
394
399
|
as: "h2",
|
|
395
400
|
id: modalHeadingId,
|
|
396
401
|
className: `${prefix}--modal-header__heading`
|
|
397
|
-
}, modalHeading), slug ? normalizedDecorator : decorator ? /*#__PURE__*/
|
|
402
|
+
}, modalHeading), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
398
403
|
className: `${prefix}--modal--inner__decorator`
|
|
399
|
-
}, normalizedDecorator) : '', !passiveModal && modalButton), /*#__PURE__*/
|
|
404
|
+
}, normalizedDecorator) : '', !passiveModal && modalButton), /*#__PURE__*/React.createElement(index$4.Layer, _rollupPluginBabelHelpers.extends({
|
|
400
405
|
ref: contentRef,
|
|
401
406
|
id: modalBodyId,
|
|
402
407
|
className: contentClasses
|
|
403
|
-
}, hasScrollingContentProps), children), !passiveModal && /*#__PURE__*/
|
|
408
|
+
}, hasScrollingContentProps), children), !passiveModal && /*#__PURE__*/React.createElement(ButtonSet.default, {
|
|
404
409
|
className: footerClasses,
|
|
405
410
|
"aria-busy": loadingActive
|
|
406
411
|
}, Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map(({
|
|
407
412
|
buttonText,
|
|
408
413
|
onClick: onButtonClick
|
|
409
|
-
}, i) => /*#__PURE__*/
|
|
414
|
+
}, i) => /*#__PURE__*/React.createElement(Button.default, {
|
|
410
415
|
key: `${buttonText}-${i}`,
|
|
411
416
|
kind: "secondary",
|
|
412
417
|
onClick: onButtonClick
|
|
413
|
-
}, buttonText)) : secondaryButtonText && /*#__PURE__*/
|
|
418
|
+
}, buttonText)) : secondaryButtonText && /*#__PURE__*/React.createElement(Button.default, {
|
|
414
419
|
disabled: loadingActive,
|
|
415
420
|
kind: "secondary",
|
|
416
421
|
onClick: onSecondaryButtonClick,
|
|
417
422
|
ref: secondaryButton
|
|
418
|
-
}, secondaryButtonText), /*#__PURE__*/
|
|
423
|
+
}, secondaryButtonText), /*#__PURE__*/React.createElement(Button.default, {
|
|
419
424
|
className: primaryButtonClass,
|
|
420
425
|
kind: danger ? 'danger' : 'primary',
|
|
421
426
|
disabled: loadingActive || primaryButtonDisabled,
|
|
422
427
|
onClick: onRequestSubmit,
|
|
423
428
|
ref: button
|
|
424
|
-
}, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/
|
|
429
|
+
}, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/React.createElement(InlineLoading.default, {
|
|
425
430
|
status: loadingStatus,
|
|
426
431
|
description: loadingDescription,
|
|
427
432
|
iconDescription: loadingIconDescription,
|
|
428
433
|
className: `${prefix}--inline-loading--btn`,
|
|
429
434
|
onSuccess: onLoadingSuccess
|
|
430
|
-
})))), !enableDialogElement && !focusTrapWithoutSentinels && /*#__PURE__*/
|
|
435
|
+
})))), !enableDialogElement && !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("span", {
|
|
431
436
|
ref: endTrap,
|
|
432
437
|
tabIndex: 0,
|
|
433
438
|
role: "link",
|
|
434
439
|
className: `${prefix}--visually-hidden`
|
|
435
440
|
}, "Focus sentinel"));
|
|
436
|
-
return /*#__PURE__*/
|
|
441
|
+
return /*#__PURE__*/React.createElement(index$4.Layer, _rollupPluginBabelHelpers.extends({}, rest, {
|
|
437
442
|
level: 0,
|
|
438
443
|
onKeyDown: handleKeyDown,
|
|
439
444
|
onClick: events.composeEventHandlers([rest?.onClick, handleOnClick]),
|
|
@@ -448,109 +453,109 @@ Modal.propTypes = {
|
|
|
448
453
|
* Specify whether the Modal is displaying an alert, error or warning
|
|
449
454
|
* Should go hand in hand with the danger prop.
|
|
450
455
|
*/
|
|
451
|
-
alert:
|
|
456
|
+
alert: PropTypes.bool,
|
|
452
457
|
/**
|
|
453
458
|
* Required props for the accessibility label of the header
|
|
454
459
|
*/
|
|
455
|
-
['aria-label']: requiredIfGivenPropIsTruthy
|
|
460
|
+
['aria-label']: requiredIfGivenPropIsTruthy.default('hasScrollingContent', PropTypes.string),
|
|
456
461
|
/**
|
|
457
462
|
* Provide the contents of your Modal
|
|
458
463
|
*/
|
|
459
|
-
children:
|
|
464
|
+
children: PropTypes.node,
|
|
460
465
|
/**
|
|
461
466
|
* Specify an optional className to be applied to the modal root node
|
|
462
467
|
*/
|
|
463
|
-
className:
|
|
468
|
+
className: PropTypes.string,
|
|
464
469
|
/**
|
|
465
470
|
* Specify label for the close button of the modal; defaults to close
|
|
466
471
|
*/
|
|
467
|
-
closeButtonLabel:
|
|
472
|
+
closeButtonLabel: PropTypes.string,
|
|
468
473
|
/**
|
|
469
474
|
* Specify whether the Modal is for dangerous actions
|
|
470
475
|
*/
|
|
471
|
-
danger:
|
|
476
|
+
danger: PropTypes.bool,
|
|
472
477
|
/**
|
|
473
478
|
* **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
|
|
474
479
|
*/
|
|
475
|
-
decorator:
|
|
480
|
+
decorator: PropTypes.node,
|
|
476
481
|
/**
|
|
477
482
|
* Specify whether the modal contains scrolling content
|
|
478
483
|
*/
|
|
479
|
-
hasScrollingContent:
|
|
484
|
+
hasScrollingContent: PropTypes.bool,
|
|
480
485
|
/**
|
|
481
486
|
* Specify the DOM element ID of the top-level node.
|
|
482
487
|
*/
|
|
483
|
-
id:
|
|
488
|
+
id: PropTypes.string,
|
|
484
489
|
/**
|
|
485
490
|
* Specify whether or not the Modal content should have any inner padding.
|
|
486
491
|
*/
|
|
487
|
-
isFullWidth:
|
|
492
|
+
isFullWidth: PropTypes.bool,
|
|
488
493
|
/**
|
|
489
494
|
* Provide a ref to return focus to once the modal is closed.
|
|
490
495
|
*/
|
|
491
|
-
launcherButtonRef:
|
|
492
|
-
current:
|
|
496
|
+
launcherButtonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
497
|
+
current: PropTypes.oneOfType([
|
|
493
498
|
// `PropTypes.instanceOf(HTMLButtonElement)` alone won't work because
|
|
494
499
|
// `HTMLButtonElement` is not defined in the test environment even
|
|
495
500
|
// though `testEnvironment` is set to `jsdom`.
|
|
496
|
-
typeof HTMLButtonElement !== 'undefined' ?
|
|
501
|
+
typeof HTMLButtonElement !== 'undefined' ? PropTypes.instanceOf(HTMLButtonElement) : PropTypes.any, PropTypes.oneOf([null])]).isRequired
|
|
497
502
|
})]),
|
|
498
503
|
/**
|
|
499
504
|
* Specify the description for the loading text
|
|
500
505
|
*/
|
|
501
|
-
loadingDescription:
|
|
506
|
+
loadingDescription: PropTypes.string,
|
|
502
507
|
/**
|
|
503
508
|
* Specify the description for the loading text
|
|
504
509
|
*/
|
|
505
|
-
loadingIconDescription:
|
|
510
|
+
loadingIconDescription: PropTypes.string,
|
|
506
511
|
/**
|
|
507
512
|
* loading status
|
|
508
513
|
*/
|
|
509
|
-
loadingStatus:
|
|
514
|
+
loadingStatus: PropTypes.oneOf(['inactive', 'active', 'finished', 'error']),
|
|
510
515
|
/**
|
|
511
516
|
* Specify a label to be read by screen readers on the modal root node
|
|
512
517
|
*/
|
|
513
|
-
modalAriaLabel:
|
|
518
|
+
modalAriaLabel: PropTypes.string,
|
|
514
519
|
/**
|
|
515
520
|
* Specify the content of the modal header title.
|
|
516
521
|
*/
|
|
517
|
-
modalHeading:
|
|
522
|
+
modalHeading: PropTypes.node,
|
|
518
523
|
/**
|
|
519
524
|
* Specify the content of the modal header label.
|
|
520
525
|
*/
|
|
521
|
-
modalLabel:
|
|
526
|
+
modalLabel: PropTypes.node,
|
|
522
527
|
/**
|
|
523
528
|
* Specify a handler for keypresses.
|
|
524
529
|
*/
|
|
525
|
-
onKeyDown:
|
|
530
|
+
onKeyDown: PropTypes.func,
|
|
526
531
|
/**
|
|
527
532
|
* Provide an optional handler to be invoked when loading is
|
|
528
533
|
* successful
|
|
529
534
|
*/
|
|
530
|
-
onLoadingSuccess:
|
|
535
|
+
onLoadingSuccess: PropTypes.func,
|
|
531
536
|
/**
|
|
532
537
|
* Specify a handler for closing modal.
|
|
533
538
|
* The handler should care of closing modal, e.g. changing `open` prop.
|
|
534
539
|
*/
|
|
535
|
-
onRequestClose:
|
|
540
|
+
onRequestClose: PropTypes.func,
|
|
536
541
|
/**
|
|
537
542
|
* Specify a handler for "submitting" modal.
|
|
538
543
|
* The handler should care of closing modal, e.g. changing `open` prop, if necessary.
|
|
539
544
|
*/
|
|
540
|
-
onRequestSubmit:
|
|
545
|
+
onRequestSubmit: PropTypes.func,
|
|
541
546
|
/**
|
|
542
547
|
* Specify a handler for the secondary button.
|
|
543
548
|
* Useful if separate handler from `onRequestClose` is desirable
|
|
544
549
|
*/
|
|
545
|
-
onSecondarySubmit:
|
|
550
|
+
onSecondarySubmit: PropTypes.func,
|
|
546
551
|
/**
|
|
547
552
|
* Specify whether the Modal is currently open
|
|
548
553
|
*/
|
|
549
|
-
open:
|
|
554
|
+
open: PropTypes.bool,
|
|
550
555
|
/**
|
|
551
556
|
* Specify whether the modal should be button-less
|
|
552
557
|
*/
|
|
553
|
-
passiveModal:
|
|
558
|
+
passiveModal: PropTypes.bool,
|
|
554
559
|
/**
|
|
555
560
|
* Prevent closing on click outside of modal
|
|
556
561
|
*/
|
|
@@ -563,15 +568,15 @@ Modal.propTypes = {
|
|
|
563
568
|
/**
|
|
564
569
|
* Specify whether the Button should be disabled, or not
|
|
565
570
|
*/
|
|
566
|
-
primaryButtonDisabled:
|
|
571
|
+
primaryButtonDisabled: PropTypes.bool,
|
|
567
572
|
/**
|
|
568
573
|
* Specify the text for the primary button
|
|
569
574
|
*/
|
|
570
|
-
primaryButtonText:
|
|
575
|
+
primaryButtonText: PropTypes.node,
|
|
571
576
|
/**
|
|
572
577
|
* Specify the text for the secondary button
|
|
573
578
|
*/
|
|
574
|
-
secondaryButtonText:
|
|
579
|
+
secondaryButtonText: PropTypes.node,
|
|
575
580
|
/**
|
|
576
581
|
* Specify an array of config objects for secondary buttons
|
|
577
582
|
* (`Array<{
|
|
@@ -585,11 +590,11 @@ Modal.propTypes = {
|
|
|
585
590
|
return new Error(`${propName} needs to be an array of two button config objects`);
|
|
586
591
|
}
|
|
587
592
|
const shape = {
|
|
588
|
-
buttonText:
|
|
589
|
-
onClick:
|
|
593
|
+
buttonText: PropTypes.node,
|
|
594
|
+
onClick: PropTypes.func
|
|
590
595
|
};
|
|
591
596
|
props[propName].forEach(secondaryButton => {
|
|
592
|
-
|
|
597
|
+
PropTypes.checkPropTypes(shape, secondaryButton, propName, componentName);
|
|
593
598
|
});
|
|
594
599
|
}
|
|
595
600
|
return null;
|
|
@@ -598,22 +603,22 @@ Modal.propTypes = {
|
|
|
598
603
|
* Specify a CSS selector that matches the DOM element that should
|
|
599
604
|
* be focused when the Modal opens
|
|
600
605
|
*/
|
|
601
|
-
selectorPrimaryFocus:
|
|
606
|
+
selectorPrimaryFocus: PropTypes.string,
|
|
602
607
|
/**
|
|
603
608
|
* Specify CSS selectors that match DOM elements working as floating menus.
|
|
604
609
|
* Focusing on those elements won't trigger "focus-wrap" behavior
|
|
605
610
|
*/
|
|
606
|
-
selectorsFloatingMenus:
|
|
611
|
+
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
607
612
|
/**
|
|
608
613
|
* Specify if Enter key should be used as "submit" action
|
|
609
614
|
*/
|
|
610
|
-
shouldSubmitOnEnter:
|
|
615
|
+
shouldSubmitOnEnter: PropTypes.bool,
|
|
611
616
|
/**
|
|
612
617
|
* Specify the size variant.
|
|
613
618
|
*/
|
|
614
|
-
size:
|
|
615
|
-
slug: deprecate.deprecate(
|
|
619
|
+
size: PropTypes.oneOf(ModalSizes),
|
|
620
|
+
slug: deprecate.deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.')
|
|
616
621
|
};
|
|
617
622
|
|
|
618
623
|
exports.ModalSizes = ModalSizes;
|
|
619
|
-
exports
|
|
624
|
+
exports.default = Modal;
|
|
@@ -20,18 +20,13 @@ var noopFn = require('../../internal/noopFn.js');
|
|
|
20
20
|
var keys = require('../../internal/keyboard/keys.js');
|
|
21
21
|
var match = require('../../internal/keyboard/match.js');
|
|
22
22
|
|
|
23
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
|
-
|
|
25
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
26
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
27
|
-
|
|
28
23
|
let didWarnAboutDeprecation = false;
|
|
29
24
|
process.env.NODE_ENV !== 'production';
|
|
30
|
-
class ModalWrapper extends
|
|
25
|
+
class ModalWrapper extends React.Component {
|
|
31
26
|
constructor(...args) {
|
|
32
27
|
super(...args);
|
|
33
|
-
_rollupPluginBabelHelpers.defineProperty(this, "triggerButton", /*#__PURE__*/
|
|
34
|
-
_rollupPluginBabelHelpers.defineProperty(this, "modal", /*#__PURE__*/
|
|
28
|
+
_rollupPluginBabelHelpers.defineProperty(this, "triggerButton", /*#__PURE__*/React.createRef());
|
|
29
|
+
_rollupPluginBabelHelpers.defineProperty(this, "modal", /*#__PURE__*/React.createRef());
|
|
35
30
|
_rollupPluginBabelHelpers.defineProperty(this, "state", {
|
|
36
31
|
isOpen: false
|
|
37
32
|
});
|
|
@@ -94,7 +89,7 @@ class ModalWrapper extends React__default["default"].Component {
|
|
|
94
89
|
onRequestClose: this.handleClose,
|
|
95
90
|
onRequestSubmit: this.handleOnRequestSubmit
|
|
96
91
|
};
|
|
97
|
-
return /*#__PURE__*/
|
|
92
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
98
93
|
role: "presentation",
|
|
99
94
|
onKeyDown: evt => {
|
|
100
95
|
if (match.match(evt, keys.Escape)) {
|
|
@@ -102,7 +97,7 @@ class ModalWrapper extends React__default["default"].Component {
|
|
|
102
97
|
onKeyDown(evt);
|
|
103
98
|
}
|
|
104
99
|
}
|
|
105
|
-
}, /*#__PURE__*/
|
|
100
|
+
}, /*#__PURE__*/React.createElement(Button.default, {
|
|
106
101
|
className: buttonTriggerClassName,
|
|
107
102
|
disabled: disabled,
|
|
108
103
|
kind: triggerButtonKind,
|
|
@@ -110,7 +105,7 @@ class ModalWrapper extends React__default["default"].Component {
|
|
|
110
105
|
iconDescription: triggerButtonIconDescription,
|
|
111
106
|
onClick: this.handleOpen,
|
|
112
107
|
ref: this.triggerButton
|
|
113
|
-
}, buttonTriggerText), /*#__PURE__*/
|
|
108
|
+
}, buttonTriggerText), /*#__PURE__*/React.createElement(Modal.default, _rollupPluginBabelHelpers.extends({
|
|
114
109
|
ref: this.modal,
|
|
115
110
|
primaryButtonText: primaryButtonText,
|
|
116
111
|
secondaryButtonText: secondaryButtonText
|
|
@@ -118,29 +113,29 @@ class ModalWrapper extends React__default["default"].Component {
|
|
|
118
113
|
}
|
|
119
114
|
}
|
|
120
115
|
_rollupPluginBabelHelpers.defineProperty(ModalWrapper, "propTypes", {
|
|
121
|
-
buttonTriggerClassName:
|
|
122
|
-
buttonTriggerText:
|
|
123
|
-
children:
|
|
124
|
-
disabled:
|
|
125
|
-
handleOpen:
|
|
126
|
-
handleSubmit:
|
|
127
|
-
id:
|
|
128
|
-
modalBeforeContent:
|
|
129
|
-
modalHeading:
|
|
130
|
-
modalLabel:
|
|
131
|
-
modalText:
|
|
132
|
-
onKeyDown:
|
|
133
|
-
passiveModal:
|
|
134
|
-
preventCloseOnClickOutside:
|
|
135
|
-
primaryButtonText:
|
|
136
|
-
renderTriggerButtonIcon:
|
|
137
|
-
secondaryButtonText:
|
|
138
|
-
selectorPrimaryFocus:
|
|
139
|
-
shouldCloseAfterSubmit:
|
|
140
|
-
status:
|
|
141
|
-
triggerButtonIconDescription:
|
|
142
|
-
triggerButtonKind:
|
|
143
|
-
withHeader:
|
|
116
|
+
buttonTriggerClassName: PropTypes.string,
|
|
117
|
+
buttonTriggerText: PropTypes.node,
|
|
118
|
+
children: PropTypes.node,
|
|
119
|
+
disabled: PropTypes.bool,
|
|
120
|
+
handleOpen: PropTypes.func,
|
|
121
|
+
handleSubmit: PropTypes.func,
|
|
122
|
+
id: PropTypes.string,
|
|
123
|
+
modalBeforeContent: PropTypes.bool,
|
|
124
|
+
modalHeading: PropTypes.string,
|
|
125
|
+
modalLabel: PropTypes.string,
|
|
126
|
+
modalText: PropTypes.string,
|
|
127
|
+
onKeyDown: PropTypes.func,
|
|
128
|
+
passiveModal: PropTypes.bool,
|
|
129
|
+
preventCloseOnClickOutside: PropTypes.bool,
|
|
130
|
+
primaryButtonText: PropTypes.string,
|
|
131
|
+
renderTriggerButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
132
|
+
secondaryButtonText: PropTypes.string,
|
|
133
|
+
selectorPrimaryFocus: PropTypes.string,
|
|
134
|
+
shouldCloseAfterSubmit: PropTypes.bool,
|
|
135
|
+
status: PropTypes.string,
|
|
136
|
+
triggerButtonIconDescription: PropTypes.string,
|
|
137
|
+
triggerButtonKind: PropTypes.oneOf(Button.ButtonKinds),
|
|
138
|
+
withHeader: PropTypes.bool
|
|
144
139
|
});
|
|
145
140
|
|
|
146
|
-
exports
|
|
141
|
+
exports.default = ModalWrapper;
|