@carbon/react 1.27.0 → 1.28.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/es/_virtual/_rollupPluginBabelHelpers.js +1 -313
- package/es/components/Accordion/Accordion.Skeleton.js +28 -30
- package/es/components/Accordion/Accordion.js +18 -21
- package/es/components/Accordion/AccordionItem.js +37 -49
- package/es/components/AspectRatio/AspectRatio.js +10 -12
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +10 -11
- package/es/components/Breadcrumb/Breadcrumb.js +14 -13
- package/es/components/Breadcrumb/BreadcrumbItem.js +24 -22
- package/es/components/Button/Button.Skeleton.js +25 -23
- package/es/components/Button/Button.js +77 -72
- package/es/components/ButtonSet/ButtonSet.js +12 -10
- package/es/components/Checkbox/Checkbox.Skeleton.js +10 -11
- package/es/components/Checkbox/Checkbox.js +55 -52
- package/es/components/CheckboxGroup/CheckboxGroup.js +33 -31
- package/es/components/ClassPrefix/index.js +4 -2
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +15 -14
- package/es/components/CodeSnippet/CodeSnippet.js +199 -102
- package/es/components/ComboBox/ComboBox.js +349 -178
- package/es/components/ComboBox/tools/filter.js +6 -4
- package/es/components/ComboButton/index.js +38 -43
- package/es/components/ComposedModal/ComposedModal.js +187 -85
- package/es/components/ComposedModal/ModalFooter.js +54 -49
- package/es/components/ComposedModal/ModalHeader.js +39 -26
- package/es/components/ContainedList/ContainedList.js +66 -20
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +20 -18
- package/es/components/ContentSwitcher/ContentSwitcher.js +83 -98
- package/es/components/ContentSwitcher/index.js +1 -1
- package/es/components/ContextMenu/useContextMenu.js +12 -21
- package/es/components/Copy/Copy.js +24 -29
- package/es/components/CopyButton/CopyButton.js +10 -10
- package/es/components/DangerButton/DangerButton.js +3 -5
- package/es/components/DataTable/DataTable.js +333 -359
- package/es/components/DataTable/Table.js +29 -26
- package/es/components/DataTable/TableActionList.js +2 -4
- package/es/components/DataTable/TableBatchAction.js +2 -4
- package/es/components/DataTable/TableBatchActions.js +29 -30
- package/es/components/DataTable/TableBody.js +7 -8
- package/es/components/DataTable/TableCell.js +1 -1
- package/es/components/DataTable/TableContainer.js +23 -23
- package/es/components/DataTable/TableContext.js +1 -1
- package/es/components/DataTable/TableExpandHeader.js +19 -21
- package/es/components/DataTable/TableExpandRow.js +23 -23
- package/es/components/DataTable/TableExpandedRow.js +18 -23
- package/es/components/DataTable/TableHead.js +1 -1
- package/es/components/DataTable/TableHeader.js +45 -41
- package/es/components/DataTable/TableRow.js +7 -8
- package/es/components/DataTable/TableSelectAll.js +13 -11
- package/es/components/DataTable/TableSelectRow.js +29 -21
- package/es/components/DataTable/TableToolbar.js +19 -14
- package/es/components/DataTable/TableToolbarAction.js +6 -6
- package/es/components/DataTable/TableToolbarContent.js +2 -4
- package/es/components/DataTable/TableToolbarMenu.js +11 -12
- package/es/components/DataTable/TableToolbarSearch.js +52 -71
- package/es/components/DataTable/state/getDerivedStateFromProps.js +15 -15
- package/es/components/DataTable/state/sortStates.js +1 -1
- package/es/components/DataTable/state/sorting.js +28 -20
- package/es/components/DataTable/tools/cells.js +1 -3
- package/es/components/DataTable/tools/denormalize.js +4 -17
- package/es/components/DataTable/tools/filter.js +18 -16
- package/es/components/DataTable/tools/instanceId.js +2 -2
- package/es/components/DataTable/tools/normalize.js +28 -25
- package/es/components/DataTable/tools/sorting.js +28 -25
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +36 -38
- package/es/components/DatePicker/DatePicker.Skeleton.d.ts +30 -0
- package/es/components/DatePicker/DatePicker.Skeleton.js +18 -20
- package/es/components/DatePicker/DatePicker.d.ts +131 -0
- package/es/components/DatePicker/DatePicker.js +215 -200
- package/es/components/DatePicker/index.d.ts +10 -0
- package/es/components/DatePicker/index.js +1 -0
- package/es/components/DatePicker/plugins/appendToPlugin.js +45 -43
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +117 -107
- package/es/components/DatePicker/plugins/rangePlugin.js +19 -11
- package/es/components/DatePickerInput/DatePickerInput.d.ts +93 -0
- package/es/components/DatePickerInput/DatePickerInput.js +83 -74
- package/es/components/Dropdown/Dropdown.Skeleton.js +13 -12
- package/es/components/Dropdown/Dropdown.js +266 -109
- package/es/components/ErrorBoundary/ErrorBoundary.js +27 -48
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +3 -2
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +14 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +19 -25
- package/es/components/FeatureFlags/index.js +25 -43
- package/es/components/FileUploader/FileUploader.Skeleton.js +8 -9
- package/es/components/FileUploader/FileUploader.js +120 -147
- package/es/components/FileUploader/FileUploaderButton.js +36 -48
- package/es/components/FileUploader/FileUploaderDropContainer.js +49 -53
- package/es/components/FileUploader/FileUploaderItem.js +30 -30
- package/es/components/FileUploader/Filename.js +13 -14
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +11 -12
- package/es/components/FluidComboBox/FluidComboBox.js +11 -9
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +18 -18
- package/es/components/FluidDatePicker/FluidDatePicker.js +20 -16
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +11 -12
- package/es/components/FluidDropdown/FluidDropdown.js +11 -9
- package/es/components/FluidForm/FluidForm.js +9 -10
- package/es/components/FluidForm/FormContext.js +1 -1
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +11 -12
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +12 -10
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +11 -12
- package/es/components/FluidSelect/FluidSelect.js +9 -9
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +9 -10
- package/es/components/FluidTextArea/FluidTextArea.js +7 -8
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +9 -10
- package/es/components/FluidTextInput/FluidTextInput.js +10 -9
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +11 -10
- package/es/components/FluidTimePicker/FluidTimePicker.js +30 -26
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +7 -7
- package/es/components/Form/Form.js +9 -10
- package/es/components/FormGroup/FormGroup.js +16 -17
- package/es/components/FormItem/FormItem.js +8 -9
- package/es/components/FormLabel/FormLabel.js +11 -10
- package/es/components/Grid/CSSGrid.js +38 -39
- package/es/components/Grid/Column.js +86 -79
- package/es/components/Grid/ColumnHang.js +12 -14
- package/es/components/Grid/FlexGrid.js +19 -21
- package/es/components/Grid/Grid.js +2 -2
- package/es/components/Grid/GridContext.js +12 -11
- package/es/components/Grid/Row.js +16 -18
- package/es/components/Heading/index.js +11 -13
- package/es/components/Icon/Icon.Skeleton.js +10 -12
- package/es/components/IconButton/index.js +19 -22
- package/es/components/IdPrefix/index.js +4 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +89 -36
- package/es/components/InlineLoading/InlineLoading.js +23 -25
- package/es/components/Layer/LayerContext.js +1 -1
- package/es/components/Layer/index.js +17 -18
- package/es/components/Layout/LayoutDirection.js +8 -10
- package/es/components/Layout/LayoutDirectionContext.js +1 -1
- package/es/components/Link/Link.js +25 -25
- package/es/components/ListBox/ListBox.js +38 -31
- package/es/components/ListBox/ListBoxField.js +9 -10
- package/es/components/ListBox/ListBoxMenu.js +9 -10
- package/es/components/ListBox/ListBoxMenuIcon.js +16 -14
- package/es/components/ListBox/ListBoxMenuItem.js +23 -26
- package/es/components/ListBox/ListBoxPropTypes.js +4 -4
- package/es/components/ListBox/ListBoxSelection.js +30 -25
- package/es/components/ListBox/index.js +1 -1
- package/es/components/ListBox/next/ListBoxSelection.js +27 -24
- package/es/components/ListBox/next/ListBoxTrigger.js +20 -19
- package/es/components/ListItem/ListItem.js +9 -10
- package/es/components/Loading/Loading.js +24 -24
- package/es/components/Menu/Menu.js +67 -80
- package/es/components/Menu/MenuContext.js +9 -12
- package/es/components/Menu/MenuItem.js +104 -128
- package/es/components/MenuButton/index.js +37 -41
- package/es/components/Modal/Modal.js +281 -120
- package/es/components/ModalWrapper/ModalWrapper.js +72 -96
- package/es/components/MultiSelect/FilterableMultiSelect.js +299 -163
- package/es/components/MultiSelect/MultiSelect.js +162 -174
- package/es/components/MultiSelect/MultiSelectPropTypes.js +1 -1
- package/es/components/MultiSelect/tools/itemToString.js +3 -4
- package/es/components/MultiSelect/tools/sorting.js +15 -13
- package/es/components/Notification/Notification.js +436 -164
- package/es/components/NumberInput/NumberInput.Skeleton.js +10 -11
- package/es/components/NumberInput/NumberInput.js +140 -139
- package/es/components/OrderedList/OrderedList.js +17 -15
- package/es/components/OverflowMenu/OverflowMenu.js +360 -227
- package/es/components/OverflowMenu/index.js +1 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +32 -37
- package/es/components/OverflowMenuV2/index.js +26 -28
- package/es/components/Pagination/Pagination.Skeleton.js +9 -10
- package/es/components/Pagination/Pagination.js +98 -140
- package/es/components/Pagination/experimental/PageSelector.js +16 -16
- package/es/components/Pagination/experimental/Pagination.js +73 -94
- package/es/components/PaginationNav/PaginationNav.js +98 -117
- package/es/components/Popover/index.js +74 -80
- package/es/components/PrimaryButton/PrimaryButton.js +3 -5
- package/es/components/ProgressBar/ProgressBar.js +39 -37
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +15 -14
- package/es/components/ProgressIndicator/ProgressIndicator.js +71 -71
- package/es/components/RadioButton/RadioButton.Skeleton.js +9 -10
- package/es/components/RadioButton/RadioButton.js +27 -27
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +55 -65
- package/es/components/RadioTile/RadioTile.js +27 -25
- package/es/components/Search/Search.Skeleton.js +16 -16
- package/es/components/Search/Search.d.ts +83 -0
- package/es/components/Search/Search.js +65 -72
- package/es/components/Search/index.d.ts +11 -0
- package/es/components/SecondaryButton/SecondaryButton.js +3 -5
- package/es/components/Select/Select.Skeleton.js +12 -13
- package/es/components/Select/Select.js +79 -73
- package/es/components/SelectItem/SelectItem.js +17 -13
- package/es/components/SelectItemGroup/SelectItemGroup.js +11 -12
- package/es/components/SkeletonIcon/SkeletonIcon.js +11 -11
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +11 -11
- package/es/components/SkeletonText/SkeletonText.js +29 -29
- package/es/components/Slider/Slider.Skeleton.js +17 -18
- package/es/components/Slider/Slider.js +306 -329
- package/es/components/Slider/index.js +1 -1
- package/es/components/Stack/Stack.js +19 -20
- package/es/components/Stack/index.js +2 -2
- package/es/components/StructuredList/StructuredList.Skeleton.js +25 -24
- package/es/components/StructuredList/StructuredList.js +134 -106
- package/es/components/Switch/IconSwitch.js +48 -54
- package/es/components/Switch/Switch.js +33 -31
- package/es/components/Tab/Tab.js +77 -83
- package/es/components/Tab/index.js +1 -1
- package/es/components/TabContent/TabContent.js +16 -18
- package/es/components/Tabs/Tabs.Skeleton.js +14 -13
- package/es/components/Tabs/Tabs.js +195 -206
- package/es/components/Tabs/usePressable.js +27 -36
- package/es/components/Tag/Tag.Skeleton.js +10 -9
- package/es/components/Tag/Tag.js +34 -31
- package/es/components/Text/Text.js +20 -20
- package/es/components/Text/TextDirection.js +8 -7
- package/es/components/Text/TextDirectionContext.js +1 -1
- package/es/components/Text/index.js +1 -1
- package/es/components/TextArea/TextArea.Skeleton.js +11 -12
- package/es/components/TextArea/TextArea.js +89 -83
- package/es/components/TextInput/ControlledPasswordInput.js +79 -73
- package/es/components/TextInput/PasswordInput.js +101 -91
- package/es/components/TextInput/TextInput.Skeleton.js +11 -12
- package/es/components/TextInput/TextInput.js +104 -92
- package/es/components/TextInput/util.js +26 -28
- package/es/components/Theme/index.js +25 -20
- package/es/components/Tile/Tile.js +135 -176
- package/es/components/TileGroup/TileGroup.js +55 -70
- package/es/components/TileGroup/index.js +1 -1
- package/es/components/TimePicker/TimePicker.js +60 -67
- package/es/components/TimePickerSelect/TimePickerSelect.js +20 -18
- package/es/components/TimePickerSelect/index.js +1 -1
- package/es/components/Toggle/Toggle.Skeleton.js +63 -52
- package/es/components/Toggle/Toggle.js +44 -48
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +56 -50
- package/es/components/Toggletip/index.js +52 -48
- package/es/components/Tooltip/DefinitionTooltip.js +24 -31
- package/es/components/Tooltip/Tooltip.js +35 -50
- package/es/components/TreeView/TreeNode.js +94 -74
- package/es/components/TreeView/TreeView.js +72 -83
- package/es/components/UIShell/Content.js +12 -14
- package/es/components/UIShell/Header.js +16 -12
- package/es/components/UIShell/HeaderContainer.js +8 -14
- package/es/components/UIShell/HeaderGlobalAction.js +26 -19
- package/es/components/UIShell/HeaderGlobalBar.js +1 -3
- package/es/components/UIShell/HeaderMenu.js +114 -129
- package/es/components/UIShell/HeaderMenuButton.js +31 -22
- package/es/components/UIShell/HeaderMenuItem.js +28 -20
- package/es/components/UIShell/HeaderName.js +19 -14
- package/es/components/UIShell/HeaderNavigation.js +19 -15
- package/es/components/UIShell/HeaderPanel.js +23 -17
- package/es/components/UIShell/HeaderSideNavItems.js +11 -9
- package/es/components/UIShell/Link.js +11 -11
- package/es/components/UIShell/SideNav.js +66 -62
- package/es/components/UIShell/SideNavDetails.js +11 -12
- package/es/components/UIShell/SideNavDivider.js +5 -3
- package/es/components/UIShell/SideNavFooter.js +13 -12
- package/es/components/UIShell/SideNavHeader.js +9 -6
- package/es/components/UIShell/SideNavIcon.js +11 -8
- package/es/components/UIShell/SideNavItem.js +11 -9
- package/es/components/UIShell/SideNavItems.js +14 -11
- package/es/components/UIShell/SideNavLink.js +19 -17
- package/es/components/UIShell/SideNavLinkText.js +8 -9
- package/es/components/UIShell/SideNavMenu.js +29 -35
- package/es/components/UIShell/SideNavMenuItem.js +14 -14
- package/es/components/UIShell/SideNavSwitcher.js +19 -19
- package/es/components/UIShell/SkipToContent.js +10 -11
- package/es/components/UIShell/Switcher.js +20 -11
- package/es/components/UIShell/SwitcherDivider.js +10 -9
- package/es/components/UIShell/SwitcherItem.js +26 -19
- package/es/components/UIShell/_utils.js +1 -1
- package/es/components/UnorderedList/UnorderedList.js +14 -14
- package/es/index.js +7 -7
- package/es/internal/ClickListener.js +49 -65
- package/es/internal/FloatingMenu.js +193 -200
- package/es/internal/OptimizedResize.js +9 -8
- package/es/internal/Selection.js +92 -111
- package/es/internal/createClassWrapper.js +2 -2
- package/es/internal/deprecateFieldOnObject.js +5 -3
- package/es/internal/environment.js +1 -1
- package/es/internal/focus/index.js +1 -1
- package/es/internal/keyboard/keys.js +11 -11
- package/es/internal/keyboard/match.js +7 -6
- package/es/internal/keyboard/navigation.js +15 -5
- package/es/internal/useAnnouncer.js +2 -2
- package/es/internal/useAttachedMenu.js +12 -20
- package/es/internal/useControllableState.js +11 -16
- package/es/internal/useDelayedState.js +9 -18
- package/es/internal/useEffectOnce.js +4 -4
- package/es/internal/useEvent.js +4 -4
- package/es/internal/useId.js +15 -19
- package/es/internal/useIdPrefix.js +1 -1
- package/es/internal/useIsomorphicEffect.js +1 -1
- package/es/internal/useMergedRefs.js +3 -3
- package/es/internal/useNoInteractiveChildren.js +8 -19
- package/es/internal/useNormalizedInputProps.js +16 -14
- package/es/internal/usePrefix.js +1 -1
- package/es/internal/useSavedCallback.js +3 -3
- package/es/internal/warning.js +4 -4
- package/es/internal/wrapFocus.js +16 -21
- package/es/prop-types/AriaPropTypes.js +1 -1
- package/es/prop-types/deprecate.js +6 -5
- package/es/prop-types/isRequiredOneOf.js +12 -25
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
- package/es/prop-types/types.js +1 -1
- package/es/tools/array.js +1 -1
- package/es/tools/events.js +21 -14
- package/es/tools/mergeRefs.js +3 -3
- package/es/tools/setupGetInstanceId.js +1 -1
- package/es/tools/uniqueId.js +3 -3
- package/es/tools/wrapComponent.js +14 -13
- package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -336
- package/lib/components/Accordion/Accordion.Skeleton.js +27 -29
- package/lib/components/Accordion/Accordion.js +17 -20
- package/lib/components/Accordion/AccordionItem.js +36 -48
- package/lib/components/AspectRatio/AspectRatio.js +9 -11
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +9 -10
- package/lib/components/Breadcrumb/Breadcrumb.js +13 -12
- package/lib/components/Breadcrumb/BreadcrumbItem.js +23 -21
- package/lib/components/Button/Button.Skeleton.js +24 -22
- package/lib/components/Button/Button.js +76 -71
- package/lib/components/ButtonSet/ButtonSet.js +11 -9
- package/lib/components/Checkbox/Checkbox.Skeleton.js +9 -10
- package/lib/components/Checkbox/Checkbox.js +54 -51
- package/lib/components/CheckboxGroup/CheckboxGroup.js +32 -30
- package/lib/components/ClassPrefix/index.js +4 -2
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +14 -13
- package/lib/components/CodeSnippet/CodeSnippet.js +198 -101
- package/lib/components/ComboBox/ComboBox.js +348 -177
- package/lib/components/ComboBox/tools/filter.js +6 -4
- package/lib/components/ComboButton/index.js +37 -42
- package/lib/components/ComposedModal/ComposedModal.js +187 -85
- package/lib/components/ComposedModal/ModalFooter.js +53 -48
- package/lib/components/ComposedModal/ModalHeader.js +38 -25
- package/lib/components/ContainedList/ContainedList.js +66 -20
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +20 -18
- package/lib/components/ContentSwitcher/ContentSwitcher.js +82 -97
- package/lib/components/ContentSwitcher/index.js +1 -1
- package/lib/components/ContextMenu/useContextMenu.js +12 -21
- package/lib/components/Copy/Copy.js +23 -28
- package/lib/components/CopyButton/CopyButton.js +9 -9
- package/lib/components/DangerButton/DangerButton.js +3 -5
- package/lib/components/DataTable/DataTable.js +331 -357
- package/lib/components/DataTable/Table.js +28 -25
- package/lib/components/DataTable/TableActionList.js +2 -4
- package/lib/components/DataTable/TableBatchAction.js +2 -4
- package/lib/components/DataTable/TableBatchActions.js +28 -29
- package/lib/components/DataTable/TableBody.js +6 -7
- package/lib/components/DataTable/TableCell.js +1 -1
- package/lib/components/DataTable/TableContainer.js +22 -22
- package/lib/components/DataTable/TableContext.js +1 -1
- package/lib/components/DataTable/TableExpandHeader.js +18 -20
- package/lib/components/DataTable/TableExpandRow.js +22 -22
- package/lib/components/DataTable/TableExpandedRow.js +17 -22
- package/lib/components/DataTable/TableHead.js +1 -1
- package/lib/components/DataTable/TableHeader.js +43 -39
- package/lib/components/DataTable/TableRow.js +7 -8
- package/lib/components/DataTable/TableSelectAll.js +13 -11
- package/lib/components/DataTable/TableSelectRow.js +28 -20
- package/lib/components/DataTable/TableToolbar.js +18 -13
- package/lib/components/DataTable/TableToolbarAction.js +5 -5
- package/lib/components/DataTable/TableToolbarContent.js +2 -4
- package/lib/components/DataTable/TableToolbarMenu.js +10 -11
- package/lib/components/DataTable/TableToolbarSearch.js +51 -70
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +15 -15
- package/lib/components/DataTable/state/sortStates.js +1 -1
- package/lib/components/DataTable/state/sorting.js +28 -20
- package/lib/components/DataTable/tools/cells.js +1 -3
- package/lib/components/DataTable/tools/denormalize.js +4 -17
- package/lib/components/DataTable/tools/filter.js +18 -16
- package/lib/components/DataTable/tools/instanceId.js +2 -2
- package/lib/components/DataTable/tools/normalize.js +28 -25
- package/lib/components/DataTable/tools/sorting.js +27 -24
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +35 -37
- package/lib/components/DatePicker/DatePicker.Skeleton.d.ts +30 -0
- package/lib/components/DatePicker/DatePicker.Skeleton.js +17 -19
- package/lib/components/DatePicker/DatePicker.d.ts +131 -0
- package/lib/components/DatePicker/DatePicker.js +214 -199
- package/lib/components/DatePicker/index.d.ts +10 -0
- package/lib/components/DatePicker/index.js +2 -0
- package/lib/components/DatePicker/plugins/appendToPlugin.js +45 -43
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +117 -107
- package/lib/components/DatePicker/plugins/rangePlugin.js +19 -11
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +93 -0
- package/lib/components/DatePickerInput/DatePickerInput.js +83 -74
- package/lib/components/Dropdown/Dropdown.Skeleton.js +12 -11
- package/lib/components/Dropdown/Dropdown.js +265 -108
- package/lib/components/ErrorBoundary/ErrorBoundary.js +27 -48
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +3 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +14 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +18 -24
- package/lib/components/FeatureFlags/index.js +25 -43
- package/lib/components/FileUploader/FileUploader.Skeleton.js +7 -8
- package/lib/components/FileUploader/FileUploader.js +119 -146
- package/lib/components/FileUploader/FileUploaderButton.js +35 -47
- package/lib/components/FileUploader/FileUploaderDropContainer.js +48 -52
- package/lib/components/FileUploader/FileUploaderItem.js +29 -29
- package/lib/components/FileUploader/Filename.js +12 -13
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +10 -11
- package/lib/components/FluidComboBox/FluidComboBox.js +10 -8
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +17 -17
- package/lib/components/FluidDatePicker/FluidDatePicker.js +19 -15
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +10 -11
- package/lib/components/FluidDropdown/FluidDropdown.js +10 -8
- package/lib/components/FluidForm/FluidForm.js +8 -9
- package/lib/components/FluidForm/FormContext.js +1 -1
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +10 -11
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +11 -9
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +10 -11
- package/lib/components/FluidSelect/FluidSelect.js +8 -8
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +8 -9
- package/lib/components/FluidTextArea/FluidTextArea.js +6 -7
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +8 -9
- package/lib/components/FluidTextInput/FluidTextInput.js +9 -8
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +10 -9
- package/lib/components/FluidTimePicker/FluidTimePicker.js +30 -26
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +6 -6
- package/lib/components/Form/Form.js +8 -9
- package/lib/components/FormGroup/FormGroup.js +15 -16
- package/lib/components/FormItem/FormItem.js +7 -8
- package/lib/components/FormLabel/FormLabel.js +10 -9
- package/lib/components/Grid/CSSGrid.js +37 -38
- package/lib/components/Grid/Column.js +85 -78
- package/lib/components/Grid/ColumnHang.js +11 -13
- package/lib/components/Grid/FlexGrid.js +19 -21
- package/lib/components/Grid/Grid.js +2 -2
- package/lib/components/Grid/GridContext.js +12 -11
- package/lib/components/Grid/Row.js +16 -18
- package/lib/components/Heading/index.js +11 -13
- package/lib/components/Icon/Icon.Skeleton.js +9 -11
- package/lib/components/IconButton/index.js +18 -21
- package/lib/components/IdPrefix/index.js +4 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +89 -36
- package/lib/components/InlineLoading/InlineLoading.js +22 -24
- package/lib/components/Layer/LayerContext.js +1 -1
- package/lib/components/Layer/index.js +16 -17
- package/lib/components/Layout/LayoutDirection.js +7 -9
- package/lib/components/Layout/LayoutDirectionContext.js +1 -1
- package/lib/components/Link/Link.js +24 -24
- package/lib/components/ListBox/ListBox.js +37 -30
- package/lib/components/ListBox/ListBoxField.js +8 -9
- package/lib/components/ListBox/ListBoxMenu.js +8 -9
- package/lib/components/ListBox/ListBoxMenuIcon.js +16 -14
- package/lib/components/ListBox/ListBoxMenuItem.js +22 -25
- package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
- package/lib/components/ListBox/ListBoxSelection.js +30 -25
- package/lib/components/ListBox/index.js +1 -1
- package/lib/components/ListBox/next/ListBoxSelection.js +26 -23
- package/lib/components/ListBox/next/ListBoxTrigger.js +19 -18
- package/lib/components/ListItem/ListItem.js +8 -9
- package/lib/components/Loading/Loading.js +23 -23
- package/lib/components/Menu/Menu.js +66 -79
- package/lib/components/Menu/MenuContext.js +9 -12
- package/lib/components/Menu/MenuItem.js +103 -127
- package/lib/components/MenuButton/index.js +36 -40
- package/lib/components/Modal/Modal.js +280 -119
- package/lib/components/ModalWrapper/ModalWrapper.js +71 -95
- package/lib/components/MultiSelect/FilterableMultiSelect.js +298 -162
- package/lib/components/MultiSelect/MultiSelect.js +163 -175
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +1 -1
- package/lib/components/MultiSelect/tools/itemToString.js +3 -4
- package/lib/components/MultiSelect/tools/sorting.js +15 -13
- package/lib/components/Notification/Notification.js +434 -162
- package/lib/components/NumberInput/NumberInput.Skeleton.js +9 -10
- package/lib/components/NumberInput/NumberInput.js +139 -138
- package/lib/components/OrderedList/OrderedList.js +16 -14
- package/lib/components/OverflowMenu/OverflowMenu.js +359 -226
- package/lib/components/OverflowMenu/index.js +1 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +31 -36
- package/lib/components/OverflowMenuV2/index.js +25 -27
- package/lib/components/Pagination/Pagination.Skeleton.js +8 -9
- package/lib/components/Pagination/Pagination.js +97 -139
- package/lib/components/Pagination/experimental/PageSelector.js +17 -17
- package/lib/components/Pagination/experimental/Pagination.js +72 -93
- package/lib/components/PaginationNav/PaginationNav.js +97 -116
- package/lib/components/Popover/index.js +73 -79
- package/lib/components/PrimaryButton/PrimaryButton.js +3 -5
- package/lib/components/ProgressBar/ProgressBar.js +38 -36
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +14 -13
- package/lib/components/ProgressIndicator/ProgressIndicator.js +70 -70
- package/lib/components/RadioButton/RadioButton.Skeleton.js +8 -9
- package/lib/components/RadioButton/RadioButton.js +26 -26
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +54 -64
- package/lib/components/RadioTile/RadioTile.js +26 -24
- package/lib/components/Search/Search.Skeleton.js +15 -15
- package/lib/components/Search/Search.d.ts +83 -0
- package/lib/components/Search/Search.js +62 -69
- package/lib/components/Search/index.d.ts +11 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +3 -5
- package/lib/components/Select/Select.Skeleton.js +11 -12
- package/lib/components/Select/Select.js +78 -72
- package/lib/components/SelectItem/SelectItem.js +16 -12
- package/lib/components/SelectItemGroup/SelectItemGroup.js +10 -11
- package/lib/components/SkeletonIcon/SkeletonIcon.js +10 -10
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +10 -10
- package/lib/components/SkeletonText/SkeletonText.js +28 -28
- package/lib/components/Slider/Slider.Skeleton.js +16 -17
- package/lib/components/Slider/Slider.js +305 -328
- package/lib/components/Slider/index.js +1 -1
- package/lib/components/Stack/Stack.js +18 -19
- package/lib/components/Stack/index.js +2 -2
- package/lib/components/StructuredList/StructuredList.Skeleton.js +24 -23
- package/lib/components/StructuredList/StructuredList.js +133 -105
- package/lib/components/Switch/IconSwitch.js +45 -51
- package/lib/components/Switch/Switch.js +33 -31
- package/lib/components/Tab/Tab.js +76 -82
- package/lib/components/Tab/index.js +1 -1
- package/lib/components/TabContent/TabContent.js +15 -17
- package/lib/components/Tabs/Tabs.Skeleton.js +13 -12
- package/lib/components/Tabs/Tabs.js +194 -205
- package/lib/components/Tabs/usePressable.js +27 -36
- package/lib/components/Tag/Tag.Skeleton.js +9 -8
- package/lib/components/Tag/Tag.js +33 -30
- package/lib/components/Text/Text.js +19 -19
- package/lib/components/Text/TextDirection.js +8 -7
- package/lib/components/Text/TextDirectionContext.js +1 -1
- package/lib/components/Text/index.js +1 -1
- package/lib/components/TextArea/TextArea.Skeleton.js +10 -11
- package/lib/components/TextArea/TextArea.js +88 -82
- package/lib/components/TextInput/ControlledPasswordInput.js +78 -72
- package/lib/components/TextInput/PasswordInput.js +100 -90
- package/lib/components/TextInput/TextInput.Skeleton.js +10 -11
- package/lib/components/TextInput/TextInput.js +104 -92
- package/lib/components/TextInput/util.js +28 -30
- package/lib/components/Theme/index.js +24 -19
- package/lib/components/Tile/Tile.js +134 -175
- package/lib/components/TileGroup/TileGroup.js +54 -69
- package/lib/components/TileGroup/index.js +1 -1
- package/lib/components/TimePicker/TimePicker.js +59 -66
- package/lib/components/TimePickerSelect/TimePickerSelect.js +19 -17
- package/lib/components/TimePickerSelect/index.js +1 -1
- package/lib/components/Toggle/Toggle.Skeleton.js +68 -57
- package/lib/components/Toggle/Toggle.js +43 -47
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +60 -54
- package/lib/components/Toggletip/index.js +51 -47
- package/lib/components/Tooltip/DefinitionTooltip.js +23 -30
- package/lib/components/Tooltip/Tooltip.js +34 -49
- package/lib/components/TreeView/TreeNode.js +93 -73
- package/lib/components/TreeView/TreeView.js +71 -82
- package/lib/components/UIShell/Content.js +12 -14
- package/lib/components/UIShell/Header.js +15 -11
- package/lib/components/UIShell/HeaderContainer.js +8 -14
- package/lib/components/UIShell/HeaderGlobalAction.js +25 -18
- package/lib/components/UIShell/HeaderGlobalBar.js +1 -3
- package/lib/components/UIShell/HeaderMenu.js +113 -128
- package/lib/components/UIShell/HeaderMenuButton.js +30 -21
- package/lib/components/UIShell/HeaderMenuItem.js +27 -19
- package/lib/components/UIShell/HeaderName.js +18 -13
- package/lib/components/UIShell/HeaderNavigation.js +18 -14
- package/lib/components/UIShell/HeaderPanel.js +22 -16
- package/lib/components/UIShell/HeaderSideNavItems.js +11 -9
- package/lib/components/UIShell/Link.js +11 -11
- package/lib/components/UIShell/SideNav.js +65 -61
- package/lib/components/UIShell/SideNavDetails.js +10 -11
- package/lib/components/UIShell/SideNavDivider.js +5 -3
- package/lib/components/UIShell/SideNavFooter.js +13 -12
- package/lib/components/UIShell/SideNavHeader.js +9 -6
- package/lib/components/UIShell/SideNavIcon.js +11 -8
- package/lib/components/UIShell/SideNavItem.js +11 -9
- package/lib/components/UIShell/SideNavItems.js +14 -11
- package/lib/components/UIShell/SideNavLink.js +18 -16
- package/lib/components/UIShell/SideNavLinkText.js +7 -8
- package/lib/components/UIShell/SideNavMenu.js +29 -35
- package/lib/components/UIShell/SideNavMenuItem.js +13 -13
- package/lib/components/UIShell/SideNavSwitcher.js +19 -19
- package/lib/components/UIShell/SkipToContent.js +9 -10
- package/lib/components/UIShell/Switcher.js +19 -10
- package/lib/components/UIShell/SwitcherDivider.js +9 -8
- package/lib/components/UIShell/SwitcherItem.js +25 -18
- package/lib/components/UIShell/_utils.js +1 -1
- package/lib/components/UnorderedList/UnorderedList.js +13 -13
- package/lib/index.js +14 -14
- package/lib/internal/ClickListener.js +49 -65
- package/lib/internal/FloatingMenu.js +192 -199
- package/lib/internal/OptimizedResize.js +9 -8
- package/lib/internal/Selection.js +91 -110
- package/lib/internal/createClassWrapper.js +2 -2
- package/lib/internal/deprecateFieldOnObject.js +5 -3
- package/lib/internal/environment.js +1 -1
- package/lib/internal/focus/index.js +1 -1
- package/lib/internal/keyboard/keys.js +11 -11
- package/lib/internal/keyboard/match.js +7 -6
- package/lib/internal/keyboard/navigation.js +15 -5
- package/lib/internal/useAnnouncer.js +2 -2
- package/lib/internal/useAttachedMenu.js +12 -20
- package/lib/internal/useControllableState.js +11 -16
- package/lib/internal/useDelayedState.js +9 -18
- package/lib/internal/useEffectOnce.js +4 -4
- package/lib/internal/useEvent.js +4 -4
- package/lib/internal/useId.js +14 -18
- package/lib/internal/useIdPrefix.js +1 -1
- package/lib/internal/useIsomorphicEffect.js +1 -1
- package/lib/internal/useMergedRefs.js +3 -3
- package/lib/internal/useNoInteractiveChildren.js +8 -19
- package/lib/internal/useNormalizedInputProps.js +16 -14
- package/lib/internal/usePrefix.js +1 -1
- package/lib/internal/useSavedCallback.js +3 -3
- package/lib/internal/warning.js +4 -4
- package/lib/internal/wrapFocus.js +16 -21
- package/lib/prop-types/AriaPropTypes.js +1 -1
- package/lib/prop-types/deprecate.js +6 -5
- package/lib/prop-types/isRequiredOneOf.js +15 -28
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
- package/lib/prop-types/types.js +1 -1
- package/lib/tools/array.js +1 -1
- package/lib/tools/events.js +21 -14
- package/lib/tools/mergeRefs.js +3 -3
- package/lib/tools/setupGetInstanceId.js +1 -1
- package/lib/tools/uniqueId.js +3 -3
- package/lib/tools/wrapComponent.js +14 -13
- package/package.json +6 -6
|
@@ -23,83 +23,67 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
23
23
|
* given `children` element.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
class ClickListener extends React__default["default"].Component {
|
|
27
|
+
static getEventTarget(evt) {
|
|
28
|
+
// support Shadow DOM
|
|
29
|
+
if (evt.composed && typeof evt.composedPath === 'function') {
|
|
30
|
+
return evt.composedPath()[0];
|
|
31
|
+
}
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
return evt.target;
|
|
34
|
+
}
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
constructor(props) {
|
|
37
|
+
super(props); // We manually bind handlers in this Component, versus using class
|
|
38
|
+
// properties, so that we can properly test the `handleRef` handler.
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
this.handleRef = this.handleRef.bind(this);
|
|
41
|
+
this.handleDocumentClick = this.handleDocumentClick.bind(this);
|
|
42
|
+
}
|
|
35
43
|
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
componentDidMount() {
|
|
45
|
+
document.addEventListener('click', this.handleDocumentClick);
|
|
46
|
+
}
|
|
38
47
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return _this;
|
|
48
|
+
componentWillUnmount() {
|
|
49
|
+
document.removeEventListener('click', this.handleDocumentClick);
|
|
42
50
|
}
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "componentWillUnmount",
|
|
51
|
-
value: function componentWillUnmount() {
|
|
52
|
-
document.removeEventListener('click', this.handleDocumentClick);
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
key: "handleDocumentClick",
|
|
56
|
-
value: function handleDocumentClick(evt) {
|
|
57
|
-
if (this.element) {
|
|
58
|
-
if (this.element.contains && !this.element.contains(ClickListener.getEventTarget(evt))) {
|
|
59
|
-
this.props.onClickOutside(evt);
|
|
60
|
-
}
|
|
52
|
+
handleDocumentClick(evt) {
|
|
53
|
+
if (this.element) {
|
|
54
|
+
if (this.element.contains && !this.element.contains(ClickListener.getEventTarget(evt))) {
|
|
55
|
+
this.props.onClickOutside(evt);
|
|
61
56
|
}
|
|
62
57
|
}
|
|
63
|
-
}
|
|
64
|
-
key: "handleRef",
|
|
65
|
-
value: function handleRef(el) {
|
|
66
|
-
var children = this.props.children;
|
|
67
|
-
this.element = el;
|
|
68
|
-
/**
|
|
69
|
-
* One important note, `children.ref` corresponds to a `ref` prop passed in
|
|
70
|
-
* directly to the child, not necessarily a `ref` defined in the component.
|
|
71
|
-
* This means that here we target the following `ref` location:
|
|
72
|
-
*
|
|
73
|
-
* <ClickListener onClickOutside={() => {}}>
|
|
74
|
-
* <Child ref={targetedRefHere} />
|
|
75
|
-
* </ClickListener>
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
if (children.ref && typeof children.ref === 'function') {
|
|
79
|
-
children.ref(el);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
key: "render",
|
|
84
|
-
value: function render() {
|
|
85
|
-
return /*#__PURE__*/React__default["default"].cloneElement(this.props.children, {
|
|
86
|
-
ref: this.handleRef
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}], [{
|
|
90
|
-
key: "getEventTarget",
|
|
91
|
-
value: function getEventTarget(evt) {
|
|
92
|
-
// support Shadow DOM
|
|
93
|
-
if (evt.composed && typeof evt.composedPath === 'function') {
|
|
94
|
-
return evt.composedPath()[0];
|
|
95
|
-
}
|
|
58
|
+
}
|
|
96
59
|
|
|
97
|
-
|
|
60
|
+
handleRef(el) {
|
|
61
|
+
const {
|
|
62
|
+
children
|
|
63
|
+
} = this.props;
|
|
64
|
+
this.element = el;
|
|
65
|
+
/**
|
|
66
|
+
* One important note, `children.ref` corresponds to a `ref` prop passed in
|
|
67
|
+
* directly to the child, not necessarily a `ref` defined in the component.
|
|
68
|
+
* This means that here we target the following `ref` location:
|
|
69
|
+
*
|
|
70
|
+
* <ClickListener onClickOutside={() => {}}>
|
|
71
|
+
* <Child ref={targetedRefHere} />
|
|
72
|
+
* </ClickListener>
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
if (children.ref && typeof children.ref === 'function') {
|
|
76
|
+
children.ref(el);
|
|
98
77
|
}
|
|
99
|
-
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
render() {
|
|
81
|
+
return /*#__PURE__*/React__default["default"].cloneElement(this.props.children, {
|
|
82
|
+
ref: this.handleRef
|
|
83
|
+
});
|
|
84
|
+
}
|
|
100
85
|
|
|
101
|
-
|
|
102
|
-
}(React__default["default"].Component);
|
|
86
|
+
}
|
|
103
87
|
|
|
104
88
|
_rollupPluginBabelHelpers.defineProperty(ClickListener, "propTypes", {
|
|
105
89
|
children: PropTypes__default["default"].element.isRequired,
|
|
@@ -57,10 +57,10 @@ var window__default = /*#__PURE__*/_interopDefaultLegacy(window);
|
|
|
57
57
|
* @property {string} position Position style (static, absolute, relative...)
|
|
58
58
|
*/
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const DIRECTION_LEFT = 'left';
|
|
61
|
+
const DIRECTION_TOP = 'top';
|
|
62
|
+
const DIRECTION_RIGHT = 'right';
|
|
63
|
+
const DIRECTION_BOTTOM = 'bottom';
|
|
64
64
|
/**
|
|
65
65
|
* @param {FloatingMenu~offset} [oldMenuOffset={}] The old value.
|
|
66
66
|
* @param {FloatingMenu~offset} [menuOffset={}] The new value.
|
|
@@ -68,11 +68,11 @@ var DIRECTION_BOTTOM = 'bottom';
|
|
|
68
68
|
* @private
|
|
69
69
|
*/
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const hasChangeInOffset = function () {
|
|
72
|
+
let oldMenuOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
73
|
+
let menuOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
74
74
|
|
|
75
|
-
if (
|
|
75
|
+
if (typeof oldMenuOffset !== typeof menuOffset) {
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -96,64 +96,56 @@ var hasChangeInOffset = function hasChangeInOffset() {
|
|
|
96
96
|
*/
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
_refPosition$right = refPosition.right,
|
|
119
|
-
refRight = _refPosition$right === void 0 ? 0 : _refPosition$right,
|
|
120
|
-
_refPosition$bottom = refPosition.bottom,
|
|
121
|
-
refBottom = _refPosition$bottom === void 0 ? 0 : _refPosition$bottom;
|
|
122
|
-
var scrollX = container.position !== 'static' ? 0 : pageXOffset;
|
|
123
|
-
var scrollY = container.position !== 'static' ? 0 : pageYOffset;
|
|
124
|
-
var relativeDiff = {
|
|
99
|
+
const getFloatingPosition = _ref => {
|
|
100
|
+
let {
|
|
101
|
+
menuSize,
|
|
102
|
+
refPosition = {},
|
|
103
|
+
offset = {},
|
|
104
|
+
direction = DIRECTION_BOTTOM,
|
|
105
|
+
scrollX: pageXOffset = 0,
|
|
106
|
+
scrollY: pageYOffset = 0,
|
|
107
|
+
container
|
|
108
|
+
} = _ref;
|
|
109
|
+
const {
|
|
110
|
+
left: refLeft = 0,
|
|
111
|
+
top: refTop = 0,
|
|
112
|
+
right: refRight = 0,
|
|
113
|
+
bottom: refBottom = 0
|
|
114
|
+
} = refPosition;
|
|
115
|
+
const scrollX = container.position !== 'static' ? 0 : pageXOffset;
|
|
116
|
+
const scrollY = container.position !== 'static' ? 0 : pageYOffset;
|
|
117
|
+
const relativeDiff = {
|
|
125
118
|
top: container.position !== 'static' ? container.rect.top : 0,
|
|
126
119
|
left: container.position !== 'static' ? container.rect.left : 0
|
|
127
120
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
121
|
+
const {
|
|
122
|
+
width,
|
|
123
|
+
height
|
|
124
|
+
} = menuSize;
|
|
125
|
+
const {
|
|
126
|
+
top = 0,
|
|
127
|
+
left = 0
|
|
128
|
+
} = offset;
|
|
129
|
+
const refCenterHorizontal = (refLeft + refRight) / 2;
|
|
130
|
+
const refCenterVertical = (refTop + refBottom) / 2;
|
|
131
|
+
return {
|
|
132
|
+
[DIRECTION_LEFT]: () => ({
|
|
138
133
|
left: refLeft - width + scrollX - left - relativeDiff.left,
|
|
139
134
|
top: refCenterVertical - height / 2 + scrollY + top - 9 - relativeDiff.top
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return {
|
|
135
|
+
}),
|
|
136
|
+
[DIRECTION_TOP]: () => ({
|
|
143
137
|
left: refCenterHorizontal - width / 2 + scrollX + left - relativeDiff.left,
|
|
144
138
|
top: refTop - height + scrollY - top - relativeDiff.top
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return {
|
|
139
|
+
}),
|
|
140
|
+
[DIRECTION_RIGHT]: () => ({
|
|
148
141
|
left: refRight + scrollX + left - relativeDiff.left,
|
|
149
142
|
top: refCenterVertical - height / 2 + scrollY + top + 3 - relativeDiff.top
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return {
|
|
143
|
+
}),
|
|
144
|
+
[DIRECTION_BOTTOM]: () => ({
|
|
153
145
|
left: refCenterHorizontal - width / 2 + scrollX + left - relativeDiff.left,
|
|
154
146
|
top: refBottom + scrollY + top - relativeDiff.top
|
|
155
|
-
}
|
|
156
|
-
}
|
|
147
|
+
})
|
|
148
|
+
}[direction]();
|
|
157
149
|
};
|
|
158
150
|
/**
|
|
159
151
|
* A menu that is detached from the triggering element.
|
|
@@ -161,25 +153,16 @@ var getFloatingPosition = function getFloatingPosition(_ref) {
|
|
|
161
153
|
*/
|
|
162
154
|
|
|
163
155
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var _super = _rollupPluginBabelHelpers.createSuper(FloatingMenu);
|
|
168
|
-
|
|
169
|
-
function FloatingMenu() {
|
|
156
|
+
class FloatingMenu extends React__default["default"].Component {
|
|
157
|
+
constructor() {
|
|
170
158
|
var _this;
|
|
171
159
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
175
|
-
args[_key] = arguments[_key];
|
|
176
|
-
}
|
|
160
|
+
super(...arguments);
|
|
161
|
+
_this = this;
|
|
177
162
|
|
|
178
|
-
|
|
163
|
+
_rollupPluginBabelHelpers.defineProperty(this, "_placeInProgress", false);
|
|
179
164
|
|
|
180
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
181
|
-
|
|
182
|
-
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "state", {
|
|
165
|
+
_rollupPluginBabelHelpers.defineProperty(this, "state", {
|
|
183
166
|
/**
|
|
184
167
|
* The position of the menu, relative to the top-left corner of the viewport.
|
|
185
168
|
* @type {FloatingMenu~offset}
|
|
@@ -187,49 +170,53 @@ var FloatingMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
187
170
|
floatingPosition: undefined
|
|
188
171
|
});
|
|
189
172
|
|
|
190
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
173
|
+
_rollupPluginBabelHelpers.defineProperty(this, "_menuContainer", null);
|
|
191
174
|
|
|
192
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
175
|
+
_rollupPluginBabelHelpers.defineProperty(this, "_menuBody", null);
|
|
193
176
|
|
|
194
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
177
|
+
_rollupPluginBabelHelpers.defineProperty(this, "startSentinel", /*#__PURE__*/React__default["default"].createRef());
|
|
195
178
|
|
|
196
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
179
|
+
_rollupPluginBabelHelpers.defineProperty(this, "endSentinel", /*#__PURE__*/React__default["default"].createRef());
|
|
197
180
|
|
|
198
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
181
|
+
_rollupPluginBabelHelpers.defineProperty(this, "_updateMenuSize", function () {
|
|
182
|
+
let prevProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
183
|
+
let isAdjustment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
184
|
+
const menuBody = _this._menuBody;
|
|
202
185
|
process.env.NODE_ENV !== "production" ? warning.warning(menuBody, 'The DOM node for menu body for calculating its position is not available. Skipping...') : void 0;
|
|
203
186
|
|
|
204
187
|
if (!menuBody) {
|
|
205
188
|
return;
|
|
206
189
|
}
|
|
207
190
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
191
|
+
const {
|
|
192
|
+
menuOffset: oldMenuOffset = {},
|
|
193
|
+
menuDirection: oldMenuDirection
|
|
194
|
+
} = prevProps;
|
|
195
|
+
const {
|
|
196
|
+
menuOffset = {},
|
|
197
|
+
menuDirection
|
|
198
|
+
} = _this.props;
|
|
215
199
|
|
|
216
200
|
if (hasChangeInOffset(oldMenuOffset, menuOffset) || oldMenuDirection !== menuDirection || isAdjustment) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
201
|
+
const {
|
|
202
|
+
flipped,
|
|
203
|
+
triggerRef,
|
|
204
|
+
updateOrientation
|
|
205
|
+
} = _this.props;
|
|
206
|
+
const {
|
|
207
|
+
current: triggerEl
|
|
208
|
+
} = triggerRef;
|
|
209
|
+
const menuSize = menuBody.getBoundingClientRect();
|
|
210
|
+
const refPosition = triggerEl && triggerEl.getBoundingClientRect();
|
|
211
|
+
const offset = typeof menuOffset !== 'function' ? menuOffset : menuOffset(menuBody, menuDirection, triggerEl, flipped); // Optional function to allow parent component to check
|
|
225
212
|
// if the orientation needs to be changed based on params
|
|
226
213
|
|
|
227
214
|
if (updateOrientation) {
|
|
228
215
|
updateOrientation({
|
|
229
|
-
menuSize
|
|
230
|
-
refPosition
|
|
216
|
+
menuSize,
|
|
217
|
+
refPosition,
|
|
231
218
|
direction: menuDirection,
|
|
232
|
-
offset
|
|
219
|
+
offset,
|
|
233
220
|
scrollX: window__default["default"].pageXOffset,
|
|
234
221
|
scrollY: window__default["default"].pageYOffset,
|
|
235
222
|
container: {
|
|
@@ -245,10 +232,10 @@ var FloatingMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
245
232
|
if (menuSize.width > 0 && menuSize.height > 0 || !offset) {
|
|
246
233
|
_this.setState({
|
|
247
234
|
floatingPosition: getFloatingPosition({
|
|
248
|
-
menuSize
|
|
249
|
-
refPosition
|
|
235
|
+
menuSize,
|
|
236
|
+
refPosition,
|
|
250
237
|
direction: menuDirection,
|
|
251
|
-
offset
|
|
238
|
+
offset,
|
|
252
239
|
scrollX: window__default["default"].pageXOffset,
|
|
253
240
|
scrollY: window__default["default"].pageYOffset,
|
|
254
241
|
container: {
|
|
@@ -256,9 +243,9 @@ var FloatingMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
256
243
|
position: getComputedStyle(_this.props.target()).position
|
|
257
244
|
}
|
|
258
245
|
})
|
|
259
|
-
},
|
|
246
|
+
}, () => {
|
|
260
247
|
if (!isAdjustment) {
|
|
261
|
-
|
|
248
|
+
const newMenuSize = menuBody.getBoundingClientRect();
|
|
262
249
|
|
|
263
250
|
if (newMenuSize !== menuSize) {
|
|
264
251
|
_this._updateMenuSize(_this.props, true);
|
|
@@ -269,11 +256,11 @@ var FloatingMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
269
256
|
}
|
|
270
257
|
});
|
|
271
258
|
|
|
272
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
259
|
+
_rollupPluginBabelHelpers.defineProperty(this, "_focusMenuContent", menuBody => {
|
|
260
|
+
const primaryFocusNode = menuBody.querySelector(this.props.selectorPrimaryFocus || null);
|
|
261
|
+
const tabbableNode = menuBody.querySelector(navigation.selectorTabbable);
|
|
262
|
+
const focusableNode = menuBody.querySelector(navigation.selectorFocusable);
|
|
263
|
+
const focusTarget = primaryFocusNode || // User defined focusable node
|
|
277
264
|
tabbableNode || // First sequentially focusable node
|
|
278
265
|
focusableNode || // First programmatic focusable node
|
|
279
266
|
menuBody;
|
|
@@ -284,133 +271,139 @@ var FloatingMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
284
271
|
}
|
|
285
272
|
});
|
|
286
273
|
|
|
287
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
274
|
+
_rollupPluginBabelHelpers.defineProperty(this, "_menuRef", menuBody => {
|
|
275
|
+
const {
|
|
276
|
+
menuRef
|
|
277
|
+
} = this.props;
|
|
278
|
+
this._placeInProgress = !!menuBody;
|
|
279
|
+
menuRef && menuRef(this._menuBody = menuBody);
|
|
291
280
|
|
|
292
281
|
if (menuBody) {
|
|
293
|
-
|
|
282
|
+
this._updateMenuSize();
|
|
294
283
|
}
|
|
295
284
|
});
|
|
296
285
|
|
|
297
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
286
|
+
_rollupPluginBabelHelpers.defineProperty(this, "_getChildrenWithProps", () => {
|
|
287
|
+
const {
|
|
288
|
+
styles,
|
|
289
|
+
children
|
|
290
|
+
} = this.props;
|
|
291
|
+
const {
|
|
292
|
+
floatingPosition: pos
|
|
293
|
+
} = this.state; // If no pos available, we need to hide the element (offscreen to the left)
|
|
302
294
|
// This is done so we can measure the content before positioning it correctly.
|
|
303
295
|
|
|
304
|
-
|
|
305
|
-
left:
|
|
306
|
-
top:
|
|
296
|
+
const positioningStyle = pos ? {
|
|
297
|
+
left: `${pos.left}px`,
|
|
298
|
+
top: `${pos.top}px`,
|
|
307
299
|
right: 'auto'
|
|
308
300
|
} : {
|
|
309
301
|
visibility: 'hidden',
|
|
310
302
|
top: '0px'
|
|
311
303
|
};
|
|
312
304
|
return /*#__PURE__*/React__default["default"].cloneElement(children, {
|
|
313
|
-
ref:
|
|
314
|
-
style:
|
|
305
|
+
ref: this._menuRef,
|
|
306
|
+
style: { ...styles,
|
|
307
|
+
...positioningStyle,
|
|
315
308
|
position: 'absolute',
|
|
316
309
|
opacity: 1
|
|
317
|
-
}
|
|
310
|
+
}
|
|
318
311
|
});
|
|
319
312
|
});
|
|
320
313
|
|
|
321
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
322
|
-
|
|
323
|
-
|
|
314
|
+
_rollupPluginBabelHelpers.defineProperty(this, "handleBlur", _ref2 => {
|
|
315
|
+
let {
|
|
316
|
+
target: oldActiveNode,
|
|
317
|
+
relatedTarget: currentActiveNode
|
|
318
|
+
} = _ref2;
|
|
324
319
|
|
|
325
320
|
if (currentActiveNode && oldActiveNode) {
|
|
326
|
-
|
|
327
|
-
|
|
321
|
+
const {
|
|
322
|
+
current: startSentinelNode
|
|
323
|
+
} = this.startSentinel;
|
|
324
|
+
const {
|
|
325
|
+
current: endSentinelNode
|
|
326
|
+
} = this.endSentinel;
|
|
328
327
|
wrapFocus["default"]({
|
|
329
|
-
bodyNode:
|
|
330
|
-
startSentinelNode
|
|
331
|
-
endSentinelNode
|
|
332
|
-
currentActiveNode
|
|
333
|
-
oldActiveNode
|
|
328
|
+
bodyNode: this._menuBody,
|
|
329
|
+
startSentinelNode,
|
|
330
|
+
endSentinelNode,
|
|
331
|
+
currentActiveNode,
|
|
332
|
+
oldActiveNode
|
|
334
333
|
});
|
|
335
334
|
}
|
|
336
335
|
});
|
|
336
|
+
}
|
|
337
337
|
|
|
338
|
-
|
|
338
|
+
componentWillUnmount() {
|
|
339
|
+
this.hResize.release();
|
|
339
340
|
}
|
|
340
341
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
342
|
+
componentDidMount() {
|
|
343
|
+
this.hResize = OptimizedResize["default"].add(() => {
|
|
344
|
+
this._updateMenuSize();
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Set focus on floating menu content after menu placement.
|
|
349
|
+
* @param {Element} menuBody The DOM element of the menu body.
|
|
350
|
+
* @private
|
|
351
|
+
*/
|
|
350
352
|
|
|
351
|
-
this.hResize = OptimizedResize["default"].add(function () {
|
|
352
|
-
_this2._updateMenuSize();
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Set focus on floating menu content after menu placement.
|
|
357
|
-
* @param {Element} menuBody The DOM element of the menu body.
|
|
358
|
-
* @private
|
|
359
|
-
*/
|
|
360
|
-
|
|
361
|
-
}, {
|
|
362
|
-
key: "componentDidUpdate",
|
|
363
|
-
value: function componentDidUpdate(prevProps) {
|
|
364
|
-
this._updateMenuSize(prevProps);
|
|
365
|
-
|
|
366
|
-
var onPlace = this.props.onPlace;
|
|
367
|
-
|
|
368
|
-
if (this._placeInProgress && this.state.floatingPosition) {
|
|
369
|
-
if (this._menuBody && !this._menuBody.contains(document.activeElement)) {
|
|
370
|
-
this._focusMenuContent(this._menuBody);
|
|
371
|
-
}
|
|
372
353
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
354
|
+
componentDidUpdate(prevProps) {
|
|
355
|
+
this._updateMenuSize(prevProps);
|
|
356
|
+
|
|
357
|
+
const {
|
|
358
|
+
onPlace
|
|
359
|
+
} = this.props;
|
|
360
|
+
|
|
361
|
+
if (this._placeInProgress && this.state.floatingPosition) {
|
|
362
|
+
if (this._menuBody && !this._menuBody.contains(document.activeElement)) {
|
|
363
|
+
this._focusMenuContent(this._menuBody);
|
|
377
364
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
*/
|
|
383
|
-
|
|
384
|
-
}, {
|
|
385
|
-
key: "render",
|
|
386
|
-
value: function render() {
|
|
387
|
-
var prefix = this.context;
|
|
388
|
-
|
|
389
|
-
if (typeof document !== 'undefined') {
|
|
390
|
-
var _this$props4 = this.props,
|
|
391
|
-
focusTrap = _this$props4.focusTrap,
|
|
392
|
-
target = _this$props4.target;
|
|
393
|
-
return /*#__PURE__*/ReactDOM__default["default"].createPortal( /*#__PURE__*/React__default["default"].createElement("div", {
|
|
394
|
-
onBlur: focusTrap ? this.handleBlur : null
|
|
395
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
396
|
-
ref: this.startSentinel,
|
|
397
|
-
tabIndex: "0",
|
|
398
|
-
role: "link",
|
|
399
|
-
className: "".concat(prefix, "--visually-hidden")
|
|
400
|
-
}, "Focus sentinel"), this._getChildrenWithProps(), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
401
|
-
ref: this.endSentinel,
|
|
402
|
-
tabIndex: "0",
|
|
403
|
-
role: "link",
|
|
404
|
-
className: "".concat(prefix, "--visually-hidden")
|
|
405
|
-
}, "Focus sentinel")), !target ? document.body : target());
|
|
365
|
+
|
|
366
|
+
if (typeof onPlace === 'function') {
|
|
367
|
+
onPlace(this._menuBody);
|
|
368
|
+
this._placeInProgress = false;
|
|
406
369
|
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* A callback for called when menu body is mounted or unmounted.
|
|
374
|
+
* @param {Element} menuBody The menu body being mounted. `null` if the menu body is being unmounted.
|
|
375
|
+
*/
|
|
407
376
|
|
|
408
|
-
|
|
377
|
+
|
|
378
|
+
render() {
|
|
379
|
+
const {
|
|
380
|
+
context: prefix
|
|
381
|
+
} = this;
|
|
382
|
+
|
|
383
|
+
if (typeof document !== 'undefined') {
|
|
384
|
+
const {
|
|
385
|
+
focusTrap,
|
|
386
|
+
target
|
|
387
|
+
} = this.props;
|
|
388
|
+
return /*#__PURE__*/ReactDOM__default["default"].createPortal( /*#__PURE__*/React__default["default"].createElement("div", {
|
|
389
|
+
onBlur: focusTrap ? this.handleBlur : null
|
|
390
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
391
|
+
ref: this.startSentinel,
|
|
392
|
+
tabIndex: "0",
|
|
393
|
+
role: "link",
|
|
394
|
+
className: `${prefix}--visually-hidden`
|
|
395
|
+
}, "Focus sentinel"), this._getChildrenWithProps(), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
396
|
+
ref: this.endSentinel,
|
|
397
|
+
tabIndex: "0",
|
|
398
|
+
role: "link",
|
|
399
|
+
className: `${prefix}--visually-hidden`
|
|
400
|
+
}, "Focus sentinel")), !target ? document.body : target());
|
|
409
401
|
}
|
|
410
|
-
}]);
|
|
411
402
|
|
|
412
|
-
|
|
413
|
-
}
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
}
|
|
414
407
|
|
|
415
408
|
_rollupPluginBabelHelpers.defineProperty(FloatingMenu, "contextType", usePrefix.PrefixContext);
|
|
416
409
|
|