@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
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var DatePicker = require('./DatePicker.js');
|
|
13
|
+
var DatePicker_Skeleton = require('./DatePicker.Skeleton.js');
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
exports.DatePicker = DatePicker["default"];
|
|
17
18
|
exports["default"] = DatePicker["default"];
|
|
19
|
+
exports.DatePickerSkeleton = DatePicker_Skeleton["default"];
|
|
@@ -13,49 +13,51 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
13
13
|
* @param {object} config Plugin configuration.
|
|
14
14
|
* @returns {Plugin} A Flatpickr plugin to put adjust the position of calendar dropdown.
|
|
15
15
|
*/
|
|
16
|
-
var carbonFlatpickrAppendToPlugin = (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
16
|
+
var carbonFlatpickrAppendToPlugin = (config => fp => {
|
|
17
|
+
/**
|
|
18
|
+
* Adjusts the floating menu position after Flatpicker sets it.
|
|
19
|
+
*/
|
|
20
|
+
const handlePreCalendarPosition = () => {
|
|
21
|
+
Promise.resolve().then(() => {
|
|
22
|
+
const {
|
|
23
|
+
calendarContainer,
|
|
24
|
+
config: fpConfig,
|
|
25
|
+
_positionElement: positionElement
|
|
26
|
+
} = fp;
|
|
27
|
+
const {
|
|
28
|
+
appendTo
|
|
29
|
+
} = fpConfig;
|
|
30
|
+
const {
|
|
31
|
+
left: containerLeft,
|
|
32
|
+
top: containerTop
|
|
33
|
+
} = appendTo.getBoundingClientRect();
|
|
34
|
+
const {
|
|
35
|
+
left: refLeft,
|
|
36
|
+
bottom: refBottom
|
|
37
|
+
} = positionElement.getBoundingClientRect();
|
|
38
|
+
|
|
39
|
+
if ((appendTo !== appendTo.ownerDocument.body || containerLeft !== 0 || containerTop !== 0) && appendTo.ownerDocument.defaultView.getComputedStyle(appendTo).getPropertyValue('position') === 'static') {
|
|
40
|
+
throw new Error('Floating menu container must not have `position:static`.');
|
|
41
|
+
} // `2` for negative margin on calendar dropdown
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
calendarContainer.style.top = `${refBottom - containerTop + 2}px`;
|
|
45
|
+
calendarContainer.style.left = `${refLeft - containerLeft}px`;
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Registers this Flatpickr plugin.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
const register = () => {
|
|
54
|
+
fp.loadedPlugins.push('carbonFlatpickrAppendToPlugin');
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
appendTo: config.appendTo,
|
|
59
|
+
onReady: register,
|
|
60
|
+
onPreCalendarPosition: handlePreCalendarPosition
|
|
59
61
|
};
|
|
60
62
|
});
|
|
61
63
|
|
|
@@ -17,130 +17,140 @@ var keys = require('../../../internal/keyboard/keys.js');
|
|
|
17
17
|
* @returns {Plugin} A Flatpickr plugin to fix Flatpickr's behavior of certain events.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
var carbonFlatpickrFixEventsPlugin = (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
20
|
+
var carbonFlatpickrFixEventsPlugin = (config => fp => {
|
|
21
|
+
/**
|
|
22
|
+
* Handles `keydown` event.
|
|
23
|
+
*/
|
|
24
|
+
const handleKeydown = event => {
|
|
25
|
+
const {
|
|
26
|
+
inputFrom,
|
|
27
|
+
inputTo
|
|
28
|
+
} = config;
|
|
29
|
+
const {
|
|
30
|
+
target
|
|
31
|
+
} = event;
|
|
32
|
+
|
|
33
|
+
if (inputFrom === target || inputTo === target) {
|
|
34
|
+
if (match.match(event, keys.Enter)) {
|
|
35
|
+
// Makes sure the hitting enter key picks up pending values of both `<input>`
|
|
36
|
+
// Workaround for: https://github.com/flatpickr/flatpickr/issues/1942
|
|
37
|
+
fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
|
|
38
|
+
event.stopPropagation();
|
|
39
|
+
} else if (match.match(event, keys.ArrowLeft) || match.match(event, keys.ArrowRight)) {
|
|
40
|
+
// Prevents Flatpickr code from canceling the event if left/right arrow keys are hit on `<input>`,
|
|
41
|
+
// so user can move the keyboard cursor for editing dates
|
|
42
|
+
// Workaround for: https://github.com/flatpickr/flatpickr/issues/1943
|
|
43
|
+
event.stopPropagation();
|
|
44
|
+
} else if (match.match(event, keys.ArrowDown)) {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
fp.open();
|
|
45
47
|
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Handles `blur` event.
|
|
52
|
+
*
|
|
53
|
+
* For whatever reason, manual changes within the `to` input do not update the
|
|
54
|
+
* calendar on blur. If a manual change is made within the input, this block will
|
|
55
|
+
* set the date again, triggering the calendar to update.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const handleBlur = event => {
|
|
60
|
+
const {
|
|
61
|
+
inputFrom,
|
|
62
|
+
inputTo,
|
|
63
|
+
lastStartValue
|
|
64
|
+
} = config;
|
|
65
|
+
const {
|
|
66
|
+
target
|
|
67
|
+
} = event; // Only fall into this logic if the event is on the `to` input and there is a
|
|
68
|
+
// `to` date selected
|
|
69
|
+
|
|
70
|
+
if (inputTo === target && fp.selectedDates[1]) {
|
|
71
|
+
// Using getTime() enables the ability to more readily compare the date currently
|
|
72
|
+
// selected in the calendar and the date currently in the value of the input
|
|
73
|
+
const selectedToDate = new Date(fp.selectedDates[1]).setHours(0, 0, 0, 0);
|
|
74
|
+
const currentValueToDate = new Date(inputTo.value).setHours(0, 0, 0, 0); // The date should only be set if both dates are valid dates, and they don't match.
|
|
75
|
+
// When they don't match, this indiciates that the date selected in the calendar is stale,
|
|
76
|
+
// and the current value in the input should be set for the calendar to update.
|
|
77
|
+
|
|
78
|
+
if (selectedToDate && currentValueToDate && selectedToDate !== currentValueToDate) {
|
|
79
|
+
// Update the calendar with the value of the `to` date input
|
|
80
|
+
fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
|
|
81
|
+
}
|
|
82
|
+
} // save end date in calendar inmediately after it's been written down
|
|
76
83
|
|
|
77
84
|
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
|
|
86
|
+
let currentEndDate = new Date(inputTo.value);
|
|
80
87
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
if (currentEndDate.toString() !== 'Invalid Date') {
|
|
89
|
+
fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
|
|
90
|
+
}
|
|
91
|
+
} // overriding the flatpickr bug where the startDate gets deleted on blur
|
|
85
92
|
|
|
86
93
|
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
if (inputTo === target && !inputFrom.value && lastStartValue.current) {
|
|
95
|
+
let currentStartDate = new Date(lastStartValue.current);
|
|
89
96
|
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
if (currentStartDate.toString() !== 'Invalid Date') {
|
|
98
|
+
inputFrom.value = lastStartValue.current;
|
|
92
99
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
100
|
+
if (inputTo.value) {
|
|
101
|
+
fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var release = function release() {
|
|
105
|
-
var inputFrom = config.inputFrom,
|
|
106
|
-
inputTo = config.inputTo;
|
|
107
|
-
|
|
108
|
-
if (inputTo) {
|
|
109
|
-
inputTo.removeEventListener('keydown', handleKeydown, true);
|
|
110
|
-
inputTo.removeEventListener('blur', handleBlur, true);
|
|
111
|
-
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Releases event listeners used in this Flatpickr plugin.
|
|
108
|
+
*/
|
|
112
109
|
|
|
113
|
-
inputFrom.removeEventListener('keydown', handleKeydown, true);
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Sets up event listeners used for this Flatpickr plugin.
|
|
117
|
-
*/
|
|
118
110
|
|
|
111
|
+
const release = () => {
|
|
112
|
+
const {
|
|
113
|
+
inputFrom,
|
|
114
|
+
inputTo
|
|
115
|
+
} = config;
|
|
119
116
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
inputFrom.addEventListener('keydown', handleKeydown, true);
|
|
117
|
+
if (inputTo) {
|
|
118
|
+
inputTo.removeEventListener('keydown', handleKeydown, true);
|
|
119
|
+
inputTo.removeEventListener('blur', handleBlur, true);
|
|
120
|
+
}
|
|
125
121
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
122
|
+
inputFrom.removeEventListener('keydown', handleKeydown, true);
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Sets up event listeners used for this Flatpickr plugin.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
const init = () => {
|
|
130
|
+
release();
|
|
131
|
+
const {
|
|
132
|
+
inputFrom,
|
|
133
|
+
inputTo
|
|
134
|
+
} = config;
|
|
135
|
+
inputFrom.addEventListener('keydown', handleKeydown, true);
|
|
136
|
+
|
|
137
|
+
if (inputTo) {
|
|
138
|
+
inputTo.addEventListener('keydown', handleKeydown, true);
|
|
139
|
+
inputTo.addEventListener('blur', handleBlur, true);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Registers this Flatpickr plugin.
|
|
144
|
+
*/
|
|
134
145
|
|
|
135
146
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
const register = () => {
|
|
148
|
+
fp.loadedPlugins.push('carbonFlatpickrFixEventsPlugin');
|
|
149
|
+
};
|
|
139
150
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
};
|
|
151
|
+
return {
|
|
152
|
+
onReady: [register, init],
|
|
153
|
+
onDestroy: [release]
|
|
144
154
|
};
|
|
145
155
|
});
|
|
146
156
|
|
|
@@ -23,22 +23,26 @@ var rangePlugin__default = /*#__PURE__*/_interopDefaultLegacy(rangePlugin);
|
|
|
23
23
|
* * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
var carbonFlatpickrRangePlugin = (
|
|
27
|
-
|
|
26
|
+
var carbonFlatpickrRangePlugin = (config => {
|
|
27
|
+
const factory = rangePlugin__default["default"](Object.assign({
|
|
28
28
|
position: 'left'
|
|
29
29
|
}, config));
|
|
30
|
-
return
|
|
31
|
-
|
|
30
|
+
return fp => {
|
|
31
|
+
const origSetDate = fp.setDate;
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
const init = () => {
|
|
34
34
|
fp.setDate = function setDate(dates, triggerChange, format) {
|
|
35
35
|
origSetDate.call(this, dates, triggerChange, format); // If `triggerChange` is `true`, `onValueUpdate` Flatpickr event is fired
|
|
36
36
|
// where Flatpickr's range plugin takes care of fixing the first `<input>`
|
|
37
37
|
|
|
38
38
|
if (!triggerChange) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const {
|
|
40
|
+
_input: inputFrom
|
|
41
|
+
} = fp;
|
|
42
|
+
const {
|
|
43
|
+
input: inputTo
|
|
44
|
+
} = config;
|
|
45
|
+
[inputFrom, inputTo].forEach((input, i) => {
|
|
42
46
|
if (input) {
|
|
43
47
|
input.value = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
|
|
44
48
|
}
|
|
@@ -47,11 +51,15 @@ var carbonFlatpickrRangePlugin = (function (config) {
|
|
|
47
51
|
};
|
|
48
52
|
};
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
const origRangePlugin = factory(fp);
|
|
55
|
+
const {
|
|
56
|
+
onReady: origOnReady
|
|
57
|
+
} = origRangePlugin;
|
|
52
58
|
return Object.assign(origRangePlugin, {
|
|
53
59
|
onReady: [init, origOnReady],
|
|
54
|
-
|
|
60
|
+
|
|
61
|
+
onPreCalendarPosition() {}
|
|
62
|
+
|
|
55
63
|
});
|
|
56
64
|
};
|
|
57
65
|
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { ReactElementLike, ReactNodeArray } from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { ReactAttr } from '../../types/common';
|
|
10
|
+
type ExcludedAttributes = 'value' | 'onChange' | 'locale' | 'children';
|
|
11
|
+
export type ReactNodeLike = ReactElementLike | ReactNodeArray | string | number | boolean | null | undefined;
|
|
12
|
+
export type func = (...args: any[]) => any;
|
|
13
|
+
interface DatePickerInputProps extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes> {
|
|
14
|
+
/**
|
|
15
|
+
* The type of the date picker:
|
|
16
|
+
*
|
|
17
|
+
* * `simple` - Without calendar dropdown.
|
|
18
|
+
* * `single` - With calendar dropdown and single date.
|
|
19
|
+
* * `range` - With calendar dropdown and a date range.
|
|
20
|
+
*/
|
|
21
|
+
datePickerType?: 'simple' | 'single' | 'range';
|
|
22
|
+
/**
|
|
23
|
+
* Specify whether or not the input should be disabled
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Provide text that is used alongside the control label for additional help
|
|
28
|
+
*/
|
|
29
|
+
helperText?: ReactNodeLike;
|
|
30
|
+
/**
|
|
31
|
+
* Specify if the label should be hidden
|
|
32
|
+
*/
|
|
33
|
+
hideLabel?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Specify an id that uniquely identifies the `<input>`
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Specify whether or not the input should be invalid
|
|
40
|
+
*/
|
|
41
|
+
invalid?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Specify the text to be rendered when the input is invalid
|
|
44
|
+
*/
|
|
45
|
+
invalidText: ReactNodeLike;
|
|
46
|
+
/**
|
|
47
|
+
* Provide the text that will be read by a screen reader when visiting this
|
|
48
|
+
* control
|
|
49
|
+
*/
|
|
50
|
+
labelText: ReactNodeLike;
|
|
51
|
+
/**
|
|
52
|
+
* Specify an `onChange` handler that is called whenever a change in the
|
|
53
|
+
* input field has occurred
|
|
54
|
+
*/
|
|
55
|
+
onChange?: func;
|
|
56
|
+
/**
|
|
57
|
+
* Provide a function to be called when the input field is clicked
|
|
58
|
+
*/
|
|
59
|
+
onClick?: func;
|
|
60
|
+
/**
|
|
61
|
+
* Provide a regular expression that the input value must match
|
|
62
|
+
* TODO:need to be rewritten
|
|
63
|
+
*/
|
|
64
|
+
pattern: (props: {
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
}, propName: string, componentName: string) => null | any | Error;
|
|
67
|
+
/**
|
|
68
|
+
* Specify the placeholder text
|
|
69
|
+
*/
|
|
70
|
+
placeholder?: string;
|
|
71
|
+
/**
|
|
72
|
+
* whether the DatePicker is to be readOnly
|
|
73
|
+
*/
|
|
74
|
+
readOnly?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Specify the size of the Date Picker Input. Currently supports either `sm`, `md`, or `lg` as an option.
|
|
77
|
+
*/
|
|
78
|
+
size?: 'sm' | 'md' | 'lg';
|
|
79
|
+
/**
|
|
80
|
+
* Specify the type of the `<input>`
|
|
81
|
+
*/
|
|
82
|
+
type?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Specify whether the control is currently in warning state
|
|
85
|
+
*/
|
|
86
|
+
warn?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Provide the text that is displayed when the control is in warning state
|
|
89
|
+
*/
|
|
90
|
+
warnText?: ReactNodeLike;
|
|
91
|
+
}
|
|
92
|
+
declare const DatePickerInput: React.ForwardRefExoticComponent<DatePickerInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
+
export default DatePickerInput;
|