@carbon/react 0.17.0 → 1.0.1
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/README.md +1 -1
- package/es/_virtual/ResizeObserver.es.js +13 -0
- package/es/_virtual/_commonjsHelpers.js +29 -0
- package/es/_virtual/_rollupPluginBabelHelpers.js +354 -0
- package/es/{prefix.js → _virtual/index.js} +2 -2
- package/es/_virtual/rangePlugin.js +10 -0
- package/es/components/Accordion/Accordion.Skeleton.js +97 -0
- package/es/components/Accordion/Accordion.js +68 -0
- package/es/components/Accordion/AccordionItem.js +176 -0
- package/es/components/Accordion/index.js +9 -0
- package/es/components/AccordionItem/index.js +11 -0
- package/es/components/AspectRatio/AspectRatio.js +67 -0
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +45 -0
- package/es/components/Breadcrumb/Breadcrumb.js +58 -0
- package/es/components/Breadcrumb/BreadcrumbItem.js +94 -0
- package/es/components/Button/Button.Skeleton.js +69 -0
- package/es/components/Button/Button.js +289 -0
- package/es/components/ButtonSet/ButtonSet.js +48 -0
- package/es/components/Checkbox/Checkbox.Skeleton.js +36 -0
- package/es/components/Checkbox/Checkbox.js +123 -0
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +58 -0
- package/es/components/CodeSnippet/CodeSnippet.js +364 -0
- package/es/components/ComboBox/ComboBox.js +530 -0
- package/es/components/ComboBox/tools/filter.js +20 -0
- package/es/components/ComposedModal/ComposedModal.js +630 -0
- package/es/components/ComposedModal/index.js +19 -0
- package/es/components/ComposedModal/next/ComposedModal.js +223 -0
- package/es/components/ComposedModal/next/ModalFooter.js +213 -0
- package/es/components/ComposedModal/next/ModalHeader.js +127 -0
- package/es/components/ContentSwitcher/ContentSwitcher.js +185 -0
- package/es/components/ContentSwitcher/index.js +13 -0
- package/es/components/ContextMenu/useContextMenu.js +57 -0
- package/es/components/Copy/Copy.js +124 -0
- package/es/components/CopyButton/CopyButton.js +67 -0
- package/es/components/DangerButton/DangerButton.js +20 -0
- package/es/components/DataTable/DataTable.js +629 -0
- package/es/components/DataTable/Table.js +82 -0
- package/es/components/DataTable/TableActionList.js +17 -0
- package/es/components/DataTable/TableBatchAction.js +46 -0
- package/es/components/DataTable/TableBatchActions.js +110 -0
- package/es/components/DataTable/TableBody.js +37 -0
- package/es/components/DataTable/TableCell.js +16 -0
- package/es/components/DataTable/TableContainer.js +66 -0
- package/es/components/DataTable/TableExpandHeader.js +86 -0
- package/es/components/DataTable/TableExpandRow.js +93 -0
- package/es/components/DataTable/TableExpandedRow.js +75 -0
- package/es/components/DataTable/TableHead.js +16 -0
- package/es/components/DataTable/TableHeader.js +187 -0
- package/es/components/DataTable/TableRow.js +41 -0
- package/es/components/DataTable/TableSelectAll.js +84 -0
- package/es/components/DataTable/TableSelectRow.js +97 -0
- package/es/components/DataTable/TableToolbar.js +47 -0
- package/es/components/DataTable/TableToolbarAction.js +31 -0
- package/es/components/DataTable/TableToolbarContent.js +17 -0
- package/es/components/DataTable/TableToolbarMenu.js +61 -0
- package/es/components/DataTable/TableToolbarSearch.js +233 -0
- package/es/components/DataTable/index.js +72 -0
- package/es/components/DataTable/state/getDerivedStateFromProps.js +52 -0
- package/es/components/DataTable/state/sortStates.js +19 -0
- package/es/components/DataTable/state/sorting.js +93 -0
- package/es/components/DataTable/tools/cells.js +21 -0
- package/es/components/DataTable/tools/denormalize.js +43 -0
- package/es/components/DataTable/tools/filter.js +42 -0
- package/es/components/DataTable/tools/instanceId.js +21 -0
- package/es/components/DataTable/tools/normalize.js +78 -0
- package/es/components/DataTable/tools/sorting.js +110 -0
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +133 -0
- package/es/components/DatePicker/DatePicker.Skeleton.js +69 -0
- package/es/components/DatePicker/DatePicker.js +622 -0
- package/es/components/DatePicker/index.js +15 -0
- package/es/components/DatePicker/next/DatePicker.js +558 -0
- package/es/components/DatePicker/plugins/appendToPlugin.js +58 -0
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +89 -0
- package/es/components/DatePicker/plugins/rangePlugin.js +51 -0
- package/es/components/DatePickerInput/DatePickerInput.js +271 -0
- package/es/components/DatePickerInput/index.js +15 -0
- package/es/components/DatePickerInput/next/DatePickerInput.js +244 -0
- package/es/components/Dropdown/Dropdown.Skeleton.js +46 -0
- package/es/components/Dropdown/Dropdown.js +322 -0
- package/es/components/ErrorBoundary/ErrorBoundary.js +96 -0
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +16 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +61 -0
- package/es/components/ExpandableSearch/index.js +9 -0
- package/es/components/FeatureFlags/index.js +169 -0
- package/es/components/FileUploader/FileUploader.Skeleton.js +43 -0
- package/es/components/FileUploader/FileUploader.js +284 -0
- package/es/components/FileUploader/FileUploaderButton.js +198 -0
- package/es/components/FileUploader/FileUploaderDropContainer.js +223 -0
- package/es/components/FileUploader/FileUploaderItem.js +130 -0
- package/es/components/FileUploader/Filename.js +82 -0
- package/es/components/FileUploader/index.js +14 -0
- package/es/components/FluidForm/FluidForm.js +46 -0
- package/es/components/FluidForm/FormContext.js +14 -0
- package/es/components/Form/Form.js +41 -0
- package/es/components/FormGroup/FormGroup.js +87 -0
- package/es/components/FormItem/FormItem.js +41 -0
- package/es/components/FormLabel/FormLabel.js +48 -0
- package/es/components/Grid/CSSGrid.js +139 -0
- package/es/components/Grid/Column.js +363 -0
- package/es/components/Grid/ColumnHang.js +51 -0
- package/es/components/Grid/FlexGrid.js +76 -0
- package/es/components/Grid/Grid.js +63 -0
- package/es/components/Grid/GridContext.js +60 -0
- package/es/components/Grid/Row.js +65 -0
- package/es/components/Heading/index.js +62 -0
- package/es/components/Icon/Icon.Skeleton.js +45 -0
- package/es/components/IconButton/index.js +88 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +122 -0
- package/es/components/InlineLoading/InlineLoading.js +111 -0
- package/es/components/Layer/LayerContext.js +12 -0
- package/es/components/Layer/index.js +62 -0
- package/es/components/Link/Link.js +95 -0
- package/es/components/ListBox/ListBox.js +139 -0
- package/es/components/ListBox/ListBoxField.js +62 -0
- package/es/components/ListBox/ListBoxMenu.js +56 -0
- package/es/components/ListBox/ListBoxMenuIcon.js +61 -0
- package/es/components/ListBox/ListBoxMenuItem.js +87 -0
- package/es/components/ListBox/ListBoxPropTypes.js +14 -0
- package/es/components/ListBox/ListBoxSelection.js +148 -0
- package/es/components/ListBox/index.js +20 -0
- package/es/components/ListBox/next/ListBoxSelection.js +155 -0
- package/es/components/ListBox/next/ListBoxTrigger.js +68 -0
- package/es/components/ListItem/ListItem.js +41 -0
- package/es/components/Loading/Loading.js +102 -0
- package/es/components/Menu/Menu.js +328 -0
- package/es/components/Menu/MenuDivider.js +19 -0
- package/es/components/Menu/MenuGroup.js +34 -0
- package/es/components/Menu/MenuItem.js +58 -0
- package/es/components/Menu/MenuOption.js +250 -0
- package/es/components/Menu/MenuRadioGroup.js +50 -0
- package/es/components/Menu/MenuRadioGroupOptions.js +64 -0
- package/es/components/Menu/MenuSelectableItem.js +57 -0
- package/es/components/Menu/_utils.js +177 -0
- package/es/components/Menu/index.js +25 -0
- package/es/components/Modal/Modal.js +343 -0
- package/es/components/Modal/index.js +15 -0
- package/es/components/Modal/next/Modal.js +274 -0
- package/es/components/ModalWrapper/ModalWrapper.js +164 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +575 -0
- package/es/components/MultiSelect/MultiSelect.js +467 -0
- package/es/components/MultiSelect/MultiSelectPropTypes.js +41 -0
- package/es/components/MultiSelect/index.js +23 -0
- package/es/components/MultiSelect/next/FilterableMultiSelect.js +531 -0
- package/es/components/MultiSelect/tools/itemToString.js +24 -0
- package/es/components/MultiSelect/tools/sorting.js +53 -0
- package/es/components/Notification/Notification.js +530 -0
- package/es/components/Notification/index.js +42 -0
- package/es/components/Notification/next/Notification.js +663 -0
- package/es/components/NumberInput/NumberInput.Skeleton.js +44 -0
- package/es/components/NumberInput/NumberInput.js +515 -0
- package/es/components/OrderedList/OrderedList.js +66 -0
- package/es/components/OverflowMenu/OverflowMenu.js +516 -0
- package/es/components/OverflowMenu/index.js +14 -0
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +213 -0
- package/es/components/OverflowMenuItem/index.js +12 -0
- package/es/components/OverflowMenuV2/index.js +137 -0
- package/es/components/Pagination/Pagination.Skeleton.js +48 -0
- package/es/components/Pagination/Pagination.js +420 -0
- package/es/components/Pagination/experimental/PageSelector.js +81 -0
- package/es/components/Pagination/experimental/Pagination.js +281 -0
- package/es/components/Pagination/index.js +14 -0
- package/es/components/Pagination/next/Pagination.js +401 -0
- package/es/components/PaginationNav/PaginationNav.js +436 -0
- package/es/components/Popover/index.js +118 -0
- package/es/components/PrimaryButton/PrimaryButton.js +20 -0
- package/es/components/ProgressBar/ProgressBar.js +110 -0
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +50 -0
- package/es/components/ProgressIndicator/ProgressIndicator.js +323 -0
- package/es/components/ProgressIndicator/index.js +15 -0
- package/es/components/ProgressIndicator/next/ProgressIndicator.js +117 -0
- package/es/components/RadioButton/RadioButton.Skeleton.js +37 -0
- package/es/components/RadioButton/RadioButton.js +172 -0
- package/es/components/RadioButton/index.js +15 -0
- package/es/components/RadioButton/next/RadioButton.js +128 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +190 -0
- package/es/components/RadioButtonGroup/index.js +15 -0
- package/es/components/RadioButtonGroup/next/RadioButtonGroup.js +141 -0
- package/es/components/RadioTile/RadioTile.js +140 -0
- package/es/components/Search/Search.Skeleton.js +50 -0
- package/es/components/Search/Search.js +289 -0
- package/es/components/Search/index.js +15 -0
- package/es/components/Search/next/Search.js +268 -0
- package/es/components/SearchFilterButton/SearchFilterButton.js +61 -0
- package/es/components/SearchLayoutButton/SearchLayoutButton.js +151 -0
- package/es/components/SecondaryButton/SecondaryButton.js +20 -0
- package/es/components/Select/Select.Skeleton.js +46 -0
- package/es/components/Select/Select.js +203 -0
- package/es/components/SelectItem/SelectItem.js +70 -0
- package/es/components/SelectItemGroup/SelectItemGroup.js +60 -0
- package/es/components/SkeletonIcon/SkeletonIcon.js +42 -0
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +37 -0
- package/es/components/SkeletonText/SkeletonText.js +114 -0
- package/es/components/Slider/Slider.Skeleton.js +56 -0
- package/es/components/Slider/Slider.js +639 -0
- package/es/components/Slider/index.js +14 -0
- package/es/components/Stack/Stack.js +102 -0
- package/es/components/Stack/index.js +26 -0
- package/es/components/StructuredList/StructuredList.Skeleton.js +82 -0
- package/es/components/StructuredList/StructuredList.js +307 -0
- package/es/components/StructuredList/index.js +43 -0
- package/es/components/StructuredList/next/StructuredList.js +326 -0
- package/es/components/Switch/Switch.js +124 -0
- package/es/components/Tab/Tab.js +191 -0
- package/es/components/Tab/index.js +15 -0
- package/es/components/TabContent/TabContent.js +77 -0
- package/es/components/Tabs/Tabs.Skeleton.js +53 -0
- package/es/components/Tabs/Tabs.js +618 -0
- package/es/components/Tabs/index.js +19 -0
- package/es/components/Tabs/next/Tabs.Skeleton.js +53 -0
- package/es/components/Tabs/next/Tabs.js +648 -0
- package/es/components/Tabs/next/usePressable.js +145 -0
- package/es/components/Tag/Tag.Skeleton.js +40 -0
- package/es/components/Tag/Tag.js +146 -0
- package/es/components/Text/Text.js +98 -0
- package/es/components/Text/TextDirectionContext.js +12 -0
- package/es/components/Text/createTextComponent.js +33 -0
- package/es/components/Text/index.js +13 -0
- package/es/components/TextArea/TextArea.Skeleton.js +44 -0
- package/es/components/TextArea/TextArea.js +220 -0
- package/es/components/TextInput/ControlledPasswordInput.js +234 -0
- package/es/components/TextInput/PasswordInput.js +286 -0
- package/es/components/TextInput/TextInput.Skeleton.js +44 -0
- package/es/components/TextInput/TextInput.js +239 -0
- package/es/components/TextInput/index.js +20 -0
- package/es/components/TextInput/util.js +33 -0
- package/es/components/Theme/index.js +103 -0
- package/es/components/Tile/Tile.js +767 -0
- package/es/components/Tile/index.js +19 -0
- package/es/components/Tile/next/Tile.js +608 -0
- package/es/components/TileGroup/TileGroup.js +164 -0
- package/es/components/TileGroup/index.js +13 -0
- package/es/components/TimePicker/TimePicker.js +256 -0
- package/es/components/TimePicker/index.js +15 -0
- package/es/components/TimePicker/next/TimePicker.js +218 -0
- package/es/components/TimePickerSelect/TimePickerSelect.js +82 -0
- package/es/components/TimePickerSelect/index.js +15 -0
- package/es/components/TimePickerSelect/next/TimePickerSelect.js +71 -0
- package/es/components/Toggle/Toggle.Skeleton.js +74 -0
- package/es/components/Toggle/Toggle.js +120 -0
- package/es/components/Toggle/index.js +19 -0
- package/es/components/Toggle/next/Toggle.js +158 -0
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +71 -0
- package/es/components/ToggleSmall/ToggleSmall.js +104 -0
- package/es/components/Toolbar/Toolbar.js +121 -0
- package/es/components/ToolbarSearch/ToolbarSearch.js +168 -0
- package/es/components/Tooltip/next/DefinitionTooltip.js +122 -0
- package/es/components/Tooltip/next/Tooltip.js +154 -0
- package/es/components/TreeView/TreeNode.js +325 -0
- package/es/components/TreeView/TreeView.js +252 -0
- package/es/components/TreeView/index.js +13 -0
- package/es/components/UIShell/Content.js +50 -0
- package/es/components/UIShell/Header.js +37 -0
- package/es/components/UIShell/HeaderContainer.js +44 -0
- package/es/components/UIShell/HeaderGlobalAction.js +87 -0
- package/es/components/UIShell/HeaderGlobalBar.js +20 -0
- package/es/components/UIShell/HeaderMenu.js +240 -0
- package/es/components/UIShell/HeaderMenuButton.js +69 -0
- package/es/components/UIShell/HeaderMenuItem.js +73 -0
- package/es/components/UIShell/HeaderName.js +62 -0
- package/es/components/UIShell/HeaderNavigation.js +100 -0
- package/es/components/UIShell/HeaderPanel.js +52 -0
- package/es/components/UIShell/HeaderSideNavItems.js +50 -0
- package/es/components/UIShell/Link.js +49 -0
- package/es/components/UIShell/SideNav.js +227 -0
- package/es/components/UIShell/SideNavDetails.js +46 -0
- package/es/components/UIShell/SideNavDivider.js +30 -0
- package/es/components/UIShell/SideNavFooter.js +78 -0
- package/es/components/UIShell/SideNavHeader.js +50 -0
- package/es/components/UIShell/SideNavIcon.js +49 -0
- package/es/components/UIShell/SideNavItem.js +47 -0
- package/es/components/UIShell/SideNavItems.js +56 -0
- package/es/components/UIShell/SideNavLink.js +74 -0
- package/es/components/UIShell/SideNavLinkText.js +41 -0
- package/es/components/UIShell/SideNavMenu.js +198 -0
- package/es/components/UIShell/SideNavMenuItem.js +57 -0
- package/es/components/UIShell/SideNavSwitcher.js +80 -0
- package/es/components/UIShell/SkipToContent.js +57 -0
- package/es/components/UIShell/Switcher.js +45 -0
- package/es/components/UIShell/SwitcherDivider.js +35 -0
- package/es/components/UIShell/SwitcherItem.js +62 -0
- package/es/components/UIShell/_utils.js +10 -0
- package/es/components/UIShell/index.js +17 -0
- package/es/components/UIShell/next/HeaderNavigation.js +52 -0
- package/es/components/UIShell/next/SideNavMenu.js +160 -0
- package/es/components/UnorderedList/UnorderedList.js +59 -0
- package/es/index.js +188 -2
- package/es/internal/ClickListener.js +101 -0
- package/es/internal/ComponentToggle.js +42 -0
- package/es/internal/FeatureFlags.js +52 -0
- package/es/internal/FloatingMenu.js +483 -0
- package/es/internal/OptimizedResize.js +65 -0
- package/es/internal/Selection.js +243 -0
- package/es/internal/createClassWrapper.js +31 -0
- package/es/internal/deprecateFieldOnObject.js +26 -0
- package/es/internal/environment.js +15 -0
- package/es/internal/focus/index.js +16 -0
- package/es/internal/keyboard/keys.js +65 -0
- package/es/internal/keyboard/match.js +82 -0
- package/es/internal/keyboard/navigation.js +61 -0
- package/es/internal/useControllableState.js +86 -0
- package/es/internal/useDelayedState.js +54 -0
- package/es/internal/useEffectOnce.js +31 -0
- package/es/internal/useId.js +59 -0
- package/es/internal/useIsomorphicEffect.js +13 -0
- package/es/internal/useMatchMedia.js +51 -0
- package/es/internal/useMergedRefs.js +31 -0
- package/es/internal/useNoInteractiveChildren.js +92 -0
- package/es/internal/useNormalizedInputProps.js +88 -0
- package/es/internal/usePrefix.js +15 -0
- package/es/internal/useSavedCallback.js +32 -0
- package/es/internal/warning.js +28 -0
- package/es/internal/wrapFocus.js +75 -0
- package/es/node_modules/flatpickr/dist/l10n/index.js +1423 -0
- package/es/node_modules/flatpickr/dist/plugins/rangePlugin.js +196 -0
- package/es/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +1112 -0
- package/es/node_modules/use-resize-observer/polyfilled.js +112 -0
- package/es/prop-types/AriaPropTypes.js +16 -0
- package/es/prop-types/deprecate.js +33 -0
- package/es/prop-types/isRequiredOneOf.js +47 -0
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +29 -0
- package/es/prop-types/requiredIfValueExists.js +32 -0
- package/es/prop-types/types.js +10 -0
- package/es/tools/array.js +32 -0
- package/es/tools/events.js +35 -0
- package/es/tools/mergeRefs.js +31 -0
- package/es/tools/setupGetInstanceId.js +19 -0
- package/es/tools/toggleClass.js +14 -0
- package/es/tools/uniqueId.js +15 -0
- package/es/tools/wrapComponent.js +42 -0
- package/icons/es/index.js +1 -1
- package/icons/lib/index.js +7 -1952
- package/index.scss +1 -0
- package/lib/_virtual/ResizeObserver.es.js +17 -0
- package/lib/_virtual/_commonjsHelpers.js +35 -0
- package/lib/_virtual/_rollupPluginBabelHelpers.js +383 -0
- package/lib/{prefix.js → _virtual/index.js} +4 -2
- package/lib/_virtual/rangePlugin.js +14 -0
- package/lib/components/Accordion/Accordion.Skeleton.js +107 -0
- package/lib/components/Accordion/Accordion.js +97 -0
- package/lib/components/Accordion/AccordionItem.js +186 -0
- package/lib/components/Accordion/index.js +16 -0
- package/lib/components/AccordionItem/index.js +16 -0
- package/lib/components/AspectRatio/AspectRatio.js +77 -0
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +55 -0
- package/lib/components/Breadcrumb/Breadcrumb.js +68 -0
- package/lib/components/Breadcrumb/BreadcrumbItem.js +104 -0
- package/lib/components/Button/Button.Skeleton.js +98 -0
- package/lib/components/Button/Button.js +299 -0
- package/lib/components/ButtonSet/ButtonSet.js +58 -0
- package/lib/components/Checkbox/Checkbox.Skeleton.js +46 -0
- package/lib/components/Checkbox/Checkbox.js +133 -0
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +68 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +375 -0
- package/lib/components/ComboBox/ComboBox.js +541 -0
- package/lib/components/ComboBox/tools/filter.js +24 -0
- package/lib/components/ComposedModal/ComposedModal.js +643 -0
- package/lib/components/ComposedModal/index.js +45 -0
- package/lib/components/ComposedModal/next/ComposedModal.js +234 -0
- package/lib/components/ComposedModal/next/ModalFooter.js +223 -0
- package/lib/components/ComposedModal/next/ModalHeader.js +137 -0
- package/lib/components/ContentSwitcher/ContentSwitcher.js +195 -0
- package/lib/components/ContentSwitcher/index.js +17 -0
- package/lib/components/ContextMenu/useContextMenu.js +61 -0
- package/lib/components/Copy/Copy.js +154 -0
- package/lib/components/CopyButton/CopyButton.js +77 -0
- package/lib/components/DangerButton/DangerButton.js +28 -0
- package/lib/components/DataTable/DataTable.js +639 -0
- package/lib/components/DataTable/Table.js +93 -0
- package/lib/components/DataTable/TableActionList.js +21 -0
- package/lib/components/DataTable/TableBatchAction.js +55 -0
- package/lib/components/DataTable/TableBatchActions.js +120 -0
- package/lib/components/DataTable/TableBody.js +46 -0
- package/lib/components/DataTable/TableCell.js +20 -0
- package/lib/components/DataTable/TableContainer.js +76 -0
- package/lib/components/DataTable/TableExpandHeader.js +96 -0
- package/lib/components/DataTable/TableExpandRow.js +103 -0
- package/lib/components/DataTable/TableExpandedRow.js +85 -0
- package/lib/components/DataTable/TableHead.js +20 -0
- package/lib/components/DataTable/TableHeader.js +197 -0
- package/lib/components/DataTable/TableRow.js +52 -0
- package/lib/components/DataTable/TableSelectAll.js +94 -0
- package/lib/components/DataTable/TableSelectRow.js +107 -0
- package/lib/components/DataTable/TableToolbar.js +57 -0
- package/lib/components/DataTable/TableToolbarAction.js +40 -0
- package/lib/components/DataTable/TableToolbarContent.js +21 -0
- package/lib/components/DataTable/TableToolbarMenu.js +71 -0
- package/lib/components/DataTable/TableToolbarSearch.js +243 -0
- package/lib/components/DataTable/index.js +76 -0
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +56 -0
- package/lib/components/DataTable/state/sortStates.js +23 -0
- package/lib/components/DataTable/state/sorting.js +100 -0
- package/lib/components/DataTable/tools/cells.js +25 -0
- package/lib/components/DataTable/tools/denormalize.js +47 -0
- package/lib/components/DataTable/tools/filter.js +46 -0
- package/lib/components/DataTable/tools/instanceId.js +25 -0
- package/lib/components/DataTable/tools/normalize.js +82 -0
- package/lib/components/DataTable/tools/sorting.js +117 -0
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +143 -0
- package/lib/components/DatePicker/DatePicker.Skeleton.js +79 -0
- package/lib/components/DatePicker/DatePicker.js +633 -0
- package/lib/components/DatePicker/index.js +39 -0
- package/lib/components/DatePicker/next/DatePicker.js +569 -0
- package/lib/components/DatePicker/plugins/appendToPlugin.js +62 -0
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +93 -0
- package/lib/components/DatePicker/plugins/rangePlugin.js +55 -0
- package/lib/components/DatePickerInput/DatePickerInput.js +281 -0
- package/lib/components/DatePickerInput/index.js +39 -0
- package/lib/components/DatePickerInput/next/DatePickerInput.js +254 -0
- package/lib/components/Dropdown/Dropdown.Skeleton.js +56 -0
- package/lib/components/Dropdown/Dropdown.js +332 -0
- package/lib/components/ErrorBoundary/ErrorBoundary.js +105 -0
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +20 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +70 -0
- package/lib/components/ExpandableSearch/index.js +16 -0
- package/lib/components/FeatureFlags/index.js +181 -0
- package/lib/components/FileUploader/FileUploader.Skeleton.js +53 -0
- package/lib/components/FileUploader/FileUploader.js +313 -0
- package/lib/components/FileUploader/FileUploaderButton.js +227 -0
- package/lib/components/FileUploader/FileUploaderDropContainer.js +233 -0
- package/lib/components/FileUploader/FileUploaderItem.js +159 -0
- package/lib/components/FileUploader/Filename.js +91 -0
- package/lib/components/FileUploader/index.js +38 -0
- package/lib/components/FluidForm/FluidForm.js +56 -0
- package/lib/components/FluidForm/FormContext.js +18 -0
- package/lib/components/Form/Form.js +51 -0
- package/lib/components/FormGroup/FormGroup.js +97 -0
- package/lib/components/FormItem/FormItem.js +51 -0
- package/lib/components/FormLabel/FormLabel.js +77 -0
- package/lib/components/Grid/CSSGrid.js +149 -0
- package/lib/components/Grid/Column.js +392 -0
- package/lib/components/Grid/ColumnHang.js +61 -0
- package/lib/components/Grid/FlexGrid.js +86 -0
- package/lib/components/Grid/Grid.js +72 -0
- package/lib/components/Grid/GridContext.js +88 -0
- package/lib/components/Grid/Row.js +75 -0
- package/lib/components/Heading/index.js +72 -0
- package/lib/components/Icon/Icon.Skeleton.js +55 -0
- package/lib/components/IconButton/index.js +97 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +131 -0
- package/lib/components/InlineLoading/InlineLoading.js +121 -0
- package/lib/components/Layer/LayerContext.js +20 -0
- package/lib/components/Layer/index.js +72 -0
- package/lib/components/Link/Link.js +105 -0
- package/lib/components/ListBox/ListBox.js +149 -0
- package/lib/components/ListBox/ListBoxField.js +71 -0
- package/lib/components/ListBox/ListBoxMenu.js +65 -0
- package/lib/components/ListBox/ListBoxMenuIcon.js +72 -0
- package/lib/components/ListBox/ListBoxMenuItem.js +97 -0
- package/lib/components/ListBox/ListBoxPropTypes.js +42 -0
- package/lib/components/ListBox/ListBoxSelection.js +159 -0
- package/lib/components/ListBox/index.js +25 -0
- package/lib/components/ListBox/next/ListBoxSelection.js +166 -0
- package/lib/components/ListBox/next/ListBoxTrigger.js +79 -0
- package/lib/components/ListItem/ListItem.js +51 -0
- package/lib/components/Loading/Loading.js +112 -0
- package/lib/components/Menu/Menu.js +339 -0
- package/lib/components/Menu/MenuDivider.js +27 -0
- package/lib/components/Menu/MenuGroup.js +43 -0
- package/lib/components/Menu/MenuItem.js +67 -0
- package/lib/components/Menu/MenuOption.js +260 -0
- package/lib/components/Menu/MenuRadioGroup.js +59 -0
- package/lib/components/Menu/MenuRadioGroupOptions.js +73 -0
- package/lib/components/Menu/MenuSelectableItem.js +66 -0
- package/lib/components/Menu/_utils.js +191 -0
- package/lib/components/Menu/index.js +30 -0
- package/lib/components/Modal/Modal.js +353 -0
- package/lib/components/Modal/index.js +39 -0
- package/lib/components/Modal/next/Modal.js +284 -0
- package/lib/components/ModalWrapper/ModalWrapper.js +173 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +587 -0
- package/lib/components/MultiSelect/MultiSelect.js +479 -0
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +49 -0
- package/lib/components/MultiSelect/index.js +47 -0
- package/lib/components/MultiSelect/next/FilterableMultiSelect.js +543 -0
- package/lib/components/MultiSelect/tools/itemToString.js +32 -0
- package/lib/components/MultiSelect/tools/sorting.js +58 -0
- package/lib/components/Notification/Notification.js +544 -0
- package/lib/components/Notification/index.js +51 -0
- package/lib/components/Notification/next/Notification.js +677 -0
- package/lib/components/NumberInput/NumberInput.Skeleton.js +54 -0
- package/lib/components/NumberInput/NumberInput.js +546 -0
- package/lib/components/OrderedList/OrderedList.js +76 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +547 -0
- package/lib/components/OverflowMenu/index.js +38 -0
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +242 -0
- package/lib/components/OverflowMenuItem/index.js +16 -0
- package/lib/components/OverflowMenuV2/index.js +147 -0
- package/lib/components/Pagination/Pagination.Skeleton.js +58 -0
- package/lib/components/Pagination/Pagination.js +430 -0
- package/lib/components/Pagination/experimental/PageSelector.js +91 -0
- package/lib/components/Pagination/experimental/Pagination.js +310 -0
- package/lib/components/Pagination/index.js +38 -0
- package/lib/components/Pagination/next/Pagination.js +411 -0
- package/lib/components/PaginationNav/PaginationNav.js +465 -0
- package/lib/components/Popover/index.js +129 -0
- package/lib/components/PrimaryButton/PrimaryButton.js +28 -0
- package/lib/components/ProgressBar/ProgressBar.js +120 -0
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +60 -0
- package/lib/components/ProgressIndicator/ProgressIndicator.js +334 -0
- package/lib/components/ProgressIndicator/index.js +39 -0
- package/lib/components/ProgressIndicator/next/ProgressIndicator.js +127 -0
- package/lib/components/RadioButton/RadioButton.Skeleton.js +47 -0
- package/lib/components/RadioButton/RadioButton.js +183 -0
- package/lib/components/RadioButton/index.js +39 -0
- package/lib/components/RadioButton/next/RadioButton.js +138 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +200 -0
- package/lib/components/RadioButtonGroup/index.js +39 -0
- package/lib/components/RadioButtonGroup/next/RadioButtonGroup.js +151 -0
- package/lib/components/RadioTile/RadioTile.js +150 -0
- package/lib/components/Search/Search.Skeleton.js +60 -0
- package/lib/components/Search/Search.js +299 -0
- package/lib/components/Search/index.js +39 -0
- package/lib/components/Search/next/Search.js +278 -0
- package/lib/components/SearchFilterButton/SearchFilterButton.js +70 -0
- package/lib/components/SearchLayoutButton/SearchLayoutButton.js +160 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +28 -0
- package/lib/components/Select/Select.Skeleton.js +56 -0
- package/lib/components/Select/Select.js +213 -0
- package/lib/components/SelectItem/SelectItem.js +80 -0
- package/lib/components/SelectItemGroup/SelectItemGroup.js +89 -0
- package/lib/components/SkeletonIcon/SkeletonIcon.js +52 -0
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +47 -0
- package/lib/components/SkeletonText/SkeletonText.js +124 -0
- package/lib/components/Slider/Slider.Skeleton.js +66 -0
- package/lib/components/Slider/Slider.js +669 -0
- package/lib/components/Slider/index.js +38 -0
- package/lib/components/Stack/Stack.js +112 -0
- package/lib/components/Stack/index.js +35 -0
- package/lib/components/StructuredList/StructuredList.Skeleton.js +92 -0
- package/lib/components/StructuredList/StructuredList.js +322 -0
- package/lib/components/StructuredList/index.js +52 -0
- package/lib/components/StructuredList/next/StructuredList.js +341 -0
- package/lib/components/Switch/Switch.js +134 -0
- package/lib/components/Tab/Tab.js +220 -0
- package/lib/components/Tab/index.js +39 -0
- package/lib/components/TabContent/TabContent.js +87 -0
- package/lib/components/Tabs/Tabs.Skeleton.js +63 -0
- package/lib/components/Tabs/Tabs.js +629 -0
- package/lib/components/Tabs/index.js +47 -0
- package/lib/components/Tabs/next/Tabs.Skeleton.js +63 -0
- package/lib/components/Tabs/next/Tabs.js +664 -0
- package/lib/components/Tabs/next/usePressable.js +149 -0
- package/lib/components/Tag/Tag.Skeleton.js +50 -0
- package/lib/components/Tag/Tag.js +156 -0
- package/lib/components/Text/Text.js +107 -0
- package/lib/components/Text/TextDirectionContext.js +16 -0
- package/lib/components/Text/createTextComponent.js +41 -0
- package/lib/components/Text/index.js +17 -0
- package/lib/components/TextArea/TextArea.Skeleton.js +54 -0
- package/lib/components/TextArea/TextArea.js +230 -0
- package/lib/components/TextInput/ControlledPasswordInput.js +244 -0
- package/lib/components/TextInput/PasswordInput.js +315 -0
- package/lib/components/TextInput/TextInput.Skeleton.js +54 -0
- package/lib/components/TextInput/TextInput.js +268 -0
- package/lib/components/TextInput/index.js +25 -0
- package/lib/components/TextInput/util.js +37 -0
- package/lib/components/Theme/index.js +116 -0
- package/lib/components/Tile/Tile.js +782 -0
- package/lib/components/Tile/index.js +48 -0
- package/lib/components/Tile/next/Tile.js +623 -0
- package/lib/components/TileGroup/TileGroup.js +173 -0
- package/lib/components/TileGroup/index.js +17 -0
- package/lib/components/TimePicker/TimePicker.js +266 -0
- package/lib/components/TimePicker/index.js +39 -0
- package/lib/components/TimePicker/next/TimePicker.js +228 -0
- package/lib/components/TimePickerSelect/TimePickerSelect.js +92 -0
- package/lib/components/TimePickerSelect/index.js +39 -0
- package/lib/components/TimePickerSelect/next/TimePickerSelect.js +81 -0
- package/lib/components/Toggle/Toggle.Skeleton.js +84 -0
- package/lib/components/Toggle/Toggle.js +130 -0
- package/lib/components/Toggle/index.js +23 -0
- package/lib/components/Toggle/next/Toggle.js +169 -0
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +81 -0
- package/lib/components/ToggleSmall/ToggleSmall.js +114 -0
- package/lib/components/Toolbar/Toolbar.js +135 -0
- package/lib/components/ToolbarSearch/ToolbarSearch.js +178 -0
- package/lib/components/Tooltip/next/DefinitionTooltip.js +132 -0
- package/lib/components/Tooltip/next/Tooltip.js +164 -0
- package/lib/components/TreeView/TreeNode.js +335 -0
- package/lib/components/TreeView/TreeView.js +281 -0
- package/lib/components/TreeView/index.js +18 -0
- package/lib/components/UIShell/Content.js +60 -0
- package/lib/components/UIShell/Header.js +47 -0
- package/lib/components/UIShell/HeaderContainer.js +53 -0
- package/lib/components/UIShell/HeaderGlobalAction.js +97 -0
- package/lib/components/UIShell/HeaderGlobalBar.js +24 -0
- package/lib/components/UIShell/HeaderMenu.js +250 -0
- package/lib/components/UIShell/HeaderMenuButton.js +79 -0
- package/lib/components/UIShell/HeaderMenuItem.js +83 -0
- package/lib/components/UIShell/HeaderName.js +72 -0
- package/lib/components/UIShell/HeaderNavigation.js +110 -0
- package/lib/components/UIShell/HeaderPanel.js +62 -0
- package/lib/components/UIShell/HeaderSideNavItems.js +60 -0
- package/lib/components/UIShell/Link.js +59 -0
- package/lib/components/UIShell/SideNav.js +237 -0
- package/lib/components/UIShell/SideNavDetails.js +56 -0
- package/lib/components/UIShell/SideNavDivider.js +40 -0
- package/lib/components/UIShell/SideNavFooter.js +88 -0
- package/lib/components/UIShell/SideNavHeader.js +60 -0
- package/lib/components/UIShell/SideNavIcon.js +59 -0
- package/lib/components/UIShell/SideNavItem.js +57 -0
- package/lib/components/UIShell/SideNavItems.js +66 -0
- package/lib/components/UIShell/SideNavLink.js +84 -0
- package/lib/components/UIShell/SideNavLinkText.js +51 -0
- package/lib/components/UIShell/SideNavMenu.js +209 -0
- package/lib/components/UIShell/SideNavMenuItem.js +67 -0
- package/lib/components/UIShell/SideNavSwitcher.js +90 -0
- package/lib/components/UIShell/SkipToContent.js +67 -0
- package/lib/components/UIShell/Switcher.js +55 -0
- package/lib/components/UIShell/SwitcherDivider.js +45 -0
- package/lib/components/UIShell/SwitcherItem.js +72 -0
- package/lib/components/UIShell/_utils.js +14 -0
- package/lib/components/UIShell/index.js +42 -0
- package/lib/components/UIShell/next/HeaderNavigation.js +62 -0
- package/lib/components/UIShell/next/SideNavMenu.js +170 -0
- package/lib/components/UnorderedList/UnorderedList.js +69 -0
- package/lib/index.js +405 -858
- package/lib/internal/ClickListener.js +110 -0
- package/lib/internal/ComponentToggle.js +50 -0
- package/lib/internal/FeatureFlags.js +56 -0
- package/lib/internal/FloatingMenu.js +498 -0
- package/lib/internal/OptimizedResize.js +73 -0
- package/lib/internal/Selection.js +254 -0
- package/lib/internal/createClassWrapper.js +39 -0
- package/lib/internal/deprecateFieldOnObject.js +30 -0
- package/lib/internal/environment.js +19 -0
- package/lib/internal/focus/index.js +20 -0
- package/lib/internal/keyboard/keys.js +79 -0
- package/lib/internal/keyboard/match.js +87 -0
- package/lib/internal/keyboard/navigation.js +69 -0
- package/lib/internal/useControllableState.js +90 -0
- package/lib/internal/useDelayedState.js +58 -0
- package/lib/internal/useEffectOnce.js +35 -0
- package/lib/internal/useId.js +64 -0
- package/lib/internal/useIsomorphicEffect.js +17 -0
- package/lib/internal/useMatchMedia.js +55 -0
- package/lib/internal/useMergedRefs.js +35 -0
- package/lib/internal/useNoInteractiveChildren.js +97 -0
- package/lib/internal/useNormalizedInputProps.js +96 -0
- package/lib/internal/usePrefix.js +24 -0
- package/lib/internal/useSavedCallback.js +36 -0
- package/lib/internal/warning.js +32 -0
- package/lib/internal/wrapFocus.js +84 -0
- package/lib/node_modules/flatpickr/dist/l10n/index.js +1427 -0
- package/lib/node_modules/flatpickr/dist/plugins/rangePlugin.js +200 -0
- package/lib/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +1116 -0
- package/lib/node_modules/use-resize-observer/polyfilled.js +120 -0
- package/lib/prop-types/AriaPropTypes.js +24 -0
- package/lib/prop-types/deprecate.js +37 -0
- package/lib/prop-types/isRequiredOneOf.js +51 -0
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +33 -0
- package/lib/prop-types/requiredIfValueExists.js +36 -0
- package/lib/prop-types/types.js +14 -0
- package/lib/tools/array.js +36 -0
- package/lib/tools/events.js +39 -0
- package/lib/tools/mergeRefs.js +35 -0
- package/lib/tools/setupGetInstanceId.js +23 -0
- package/lib/tools/toggleClass.js +18 -0
- package/lib/tools/uniqueId.js +19 -0
- package/lib/tools/wrapComponent.js +52 -0
- package/package.json +49 -18
- package/scss/{grid/_config.scss → components/_index.scss} +1 -1
- package/scss/components/accordion/_accordion.scss +9 -0
- package/scss/components/aspect-ratio/_aspect-ratio.scss +9 -0
- package/scss/components/breadcrumb/_breadcrumb.scss +9 -0
- package/scss/components/button/_button.scss +9 -0
- package/scss/components/button/_tokens.scss +9 -0
- package/scss/components/checkbox/_checkbox.scss +9 -0
- package/scss/components/code-snippet/_code-snippet.scss +9 -0
- package/scss/components/combo-box/_combo-box.scss +9 -0
- package/scss/components/content-switcher/_content-switcher.scss +9 -0
- package/scss/components/copy-button/_copy-button.scss +9 -0
- package/scss/components/data-table/_data-table.scss +9 -0
- package/scss/components/data-table/action/_data-table-action.scss +9 -0
- package/scss/components/data-table/action/_index.scss +9 -0
- package/scss/components/data-table/expandable/_data-table-expandable.scss +9 -0
- package/scss/components/data-table/expandable/_index.scss +9 -0
- package/scss/components/data-table/skeleton/_data-table-skeleton.scss +9 -0
- package/scss/components/data-table/skeleton/_index.scss +9 -0
- package/scss/components/data-table/sort/_data-table-sort.scss +9 -0
- package/scss/components/data-table/sort/_index.scss +9 -0
- package/scss/components/date-picker/_date-picker.scss +9 -0
- package/scss/components/dropdown/_dropdown.scss +9 -0
- package/scss/components/file-uploader/_file-uploader.scss +9 -0
- package/scss/components/form/_form.scss +9 -0
- package/scss/components/inline-loading/_inline-loading.scss +9 -0
- package/scss/components/link/_link.scss +9 -0
- package/scss/components/list/_list.scss +9 -0
- package/scss/components/list-box/_index.scss +9 -0
- package/scss/components/list-box/_list-box.scss +9 -0
- package/scss/components/loading/_loading.scss +9 -0
- package/scss/components/menu/_menu.scss +9 -0
- package/scss/components/modal/_modal.scss +9 -0
- package/scss/components/multiselect/_multiselect.scss +9 -0
- package/scss/components/notification/_actionable-notification.scss +9 -0
- package/scss/components/notification/_inline-notification.scss +9 -0
- package/scss/components/notification/_toast-notification.scss +9 -0
- package/scss/components/notification/_tokens.scss +9 -0
- package/scss/components/number-input/_number-input.scss +9 -0
- package/scss/components/overflow-menu/_overflow-menu.scss +9 -0
- package/scss/components/pagination/_pagination.scss +9 -0
- package/scss/components/pagination/_unstable_pagination.scss +9 -0
- package/scss/components/pagination-nav/_pagination-nav.scss +9 -0
- package/scss/components/popover/_index.scss +9 -0
- package/scss/components/popover/_popover.scss +9 -0
- package/scss/components/progress-bar/_index.scss +9 -0
- package/scss/components/progress-bar/_progress-bar.scss +9 -0
- package/scss/components/progress-indicator/_progress-indicator.scss +9 -0
- package/scss/components/radio-button/_radio-button.scss +9 -0
- package/scss/components/search/_search.scss +9 -0
- package/scss/components/select/_select.scss +9 -0
- package/scss/components/skeleton-styles/_index.scss +9 -0
- package/scss/components/skeleton-styles/_skeleton-styles.scss +9 -0
- package/scss/components/slider/_slider.scss +9 -0
- package/scss/components/stack/_stack.scss +9 -0
- package/scss/components/structured-list/_structured-list.scss +9 -0
- package/scss/components/tabs/_tabs.scss +9 -0
- package/scss/components/tag/_tag.scss +9 -0
- package/scss/components/tag/_tokens.scss +9 -0
- package/scss/components/text-area/_text-area.scss +9 -0
- package/scss/components/text-input/_text-input.scss +9 -0
- package/scss/components/tile/_tile.scss +9 -0
- package/scss/components/time-picker/_time-picker.scss +9 -0
- package/scss/components/toggle/_toggle.scss +9 -0
- package/scss/components/toggletip/_index.scss +9 -0
- package/scss/components/toggletip/_toggletip.scss +9 -0
- package/scss/components/tooltip/_tooltip.scss +9 -0
- package/scss/components/treeview/_treeview.scss +9 -0
- package/scss/components/ui-shell/_ui-shell.scss +9 -0
- package/scss/components/ui-shell/content/_content.scss +9 -0
- package/scss/components/ui-shell/content/_index.scss +9 -0
- package/scss/components/ui-shell/header/_header.scss +9 -0
- package/scss/components/ui-shell/header/_index.scss +9 -0
- package/scss/components/ui-shell/header-panel/_header-panel.scss +9 -0
- package/scss/components/ui-shell/header-panel/_index.scss +9 -0
- package/scss/components/ui-shell/side-nav/_index.scss +9 -0
- package/scss/components/ui-shell/side-nav/_side-nav.scss +9 -0
- package/scss/components/ui-shell/switcher/_index.scss +9 -0
- package/scss/components/ui-shell/switcher/_switcher.scss +9 -0
- package/scss/fonts/_src.scss +9 -0
- package/scss/grid/_css-grid.scss +9 -0
- package/scss/grid/_mixins.scss +9 -0
- package/scss/type/_index.scss +9 -0
- package/scss/type/_reset.scss +9 -0
- package/scss/utilities/_box-shadow.scss +9 -0
- package/scss/utilities/_button-reset.scss +9 -0
- package/scss/utilities/_component-reset.scss +9 -0
- package/scss/utilities/_component-tokens.scss +9 -0
- package/scss/utilities/_custom-property.scss +9 -0
- package/scss/utilities/_focus-outline.scss +9 -0
- package/scss/utilities/_high-contrast-mode.scss +9 -0
- package/scss/utilities/_index.scss +9 -0
- package/scss/utilities/_keyframes.scss +9 -0
- package/scss/utilities/_placeholder-colors.scss +9 -0
- package/scss/utilities/_rotate.scss +9 -0
- package/scss/utilities/_skeleton.scss +9 -0
- package/scss/utilities/_text-overflow.scss +9 -0
- package/scss/utilities/_text-truncate.scss +9 -0
- package/scss/utilities/_visually-hidden.scss +9 -0
- package/icons/es/icon-helpers/es/index.js +0 -141
- package/icons/es/icons-react/next/index.esm.js +0 -14
- package/icons/lib/icon-helpers/es/index.js +0 -146
- package/icons/lib/icons-react/next/index.esm.js +0 -1973
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2021
|
|
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
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var PropTypes = require('prop-types');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var cx = require('classnames');
|
|
16
|
+
var flatpickr = require('flatpickr');
|
|
17
|
+
var index = require('../../node_modules/flatpickr/dist/l10n/index.js');
|
|
18
|
+
var index$2 = require('../DatePickerInput/index.js');
|
|
19
|
+
var appendToPlugin = require('./plugins/appendToPlugin.js');
|
|
20
|
+
var fixEventsPlugin = require('./plugins/fixEventsPlugin.js');
|
|
21
|
+
var rangePlugin = require('./plugins/rangePlugin.js');
|
|
22
|
+
var index$1 = require('../FeatureFlags/index.js');
|
|
23
|
+
var usePrefix = require('../../internal/usePrefix.js');
|
|
24
|
+
var match = require('../../internal/keyboard/match.js');
|
|
25
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
26
|
+
|
|
27
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
|
+
|
|
29
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
30
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
31
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
32
|
+
var flatpickr__default = /*#__PURE__*/_interopDefaultLegacy(flatpickr);
|
|
33
|
+
|
|
34
|
+
var _excluded = ["allowInput", "appendTo", "datePickerType", "dateFormat", "locale", "minDate", "maxDate", "value", "onClose", "disable", "enable"],
|
|
35
|
+
_excluded2 = ["dateFormat", "minDate", "maxDate", "value", "disable", "enable"],
|
|
36
|
+
_excluded3 = ["dateFormat", "minDate", "maxDate", "value", "disable", "enable"],
|
|
37
|
+
_excluded4 = ["allowInput", "appendTo", "children", "className", "short", "light", "datePickerType", "minDate", "maxDate", "dateFormat", "onChange", "locale", "value", "onOpen"];
|
|
38
|
+
|
|
39
|
+
index["default"].en.weekdays.shorthand.forEach(function (day, index$1) {
|
|
40
|
+
var currentDay = index["default"].en.weekdays.shorthand;
|
|
41
|
+
|
|
42
|
+
if (currentDay[index$1] === 'Thu' || currentDay[index$1] === 'Th') {
|
|
43
|
+
currentDay[index$1] = 'Th';
|
|
44
|
+
} else {
|
|
45
|
+
currentDay[index$1] = currentDay[index$1].charAt(0);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var forEach = Array.prototype.forEach;
|
|
49
|
+
/**
|
|
50
|
+
* @param {number} monthNumber The month number.
|
|
51
|
+
* @param {boolean} shorthand `true` to use shorthand month.
|
|
52
|
+
* @param {Locale} locale The Flatpickr locale data.
|
|
53
|
+
* @returns {string} The month string.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
var monthToStr = function monthToStr(monthNumber, shorthand, locale) {
|
|
57
|
+
return locale.months[shorthand ? 'shorthand' : 'longhand'][monthNumber];
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* @param {object} config Plugin configuration.
|
|
61
|
+
* @param {boolean} [config.shorthand] `true` to use shorthand month.
|
|
62
|
+
* @param {string} config.selectorFlatpickrMonthYearContainer The CSS selector for the container of month/year selection UI.
|
|
63
|
+
* @param {string} config.selectorFlatpickrYearContainer The CSS selector for the container of year selection UI.
|
|
64
|
+
* @param {string} config.selectorFlatpickrCurrentMonth The CSS selector for the text-based month selection UI.
|
|
65
|
+
* @param {string} config.classFlatpickrCurrentMonth The CSS class for the text-based month selection UI.
|
|
66
|
+
* @returns {Plugin} A Flatpickr plugin to use text instead of `<select>` for month picker.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
var carbonFlatpickrMonthSelectPlugin = function carbonFlatpickrMonthSelectPlugin(config) {
|
|
71
|
+
return function (fp) {
|
|
72
|
+
var setupElements = function setupElements() {
|
|
73
|
+
var _fp$monthElements;
|
|
74
|
+
|
|
75
|
+
if (!fp.monthElements) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
fp.monthElements.forEach(function (elem) {
|
|
80
|
+
if (!elem.parentNode) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
elem.parentNode.removeChild(elem);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
(_fp$monthElements = fp.monthElements).splice.apply(_fp$monthElements, [0, fp.monthElements.length].concat(_rollupPluginBabelHelpers.toConsumableArray(fp.monthElements.map(function () {
|
|
88
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
89
|
+
var monthElement = fp._createElement('span', config.classFlatpickrCurrentMonth);
|
|
90
|
+
|
|
91
|
+
monthElement.textContent = monthToStr(fp.currentMonth, config.shorthand === true, fp.l10n);
|
|
92
|
+
fp.yearElements[0].closest(config.selectorFlatpickrMonthYearContainer).insertBefore(monthElement, fp.yearElements[0].closest(config.selectorFlatpickrYearContainer));
|
|
93
|
+
return monthElement;
|
|
94
|
+
}))));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
var updateCurrentMonth = function updateCurrentMonth() {
|
|
98
|
+
var monthStr = monthToStr(fp.currentMonth, config.shorthand === true, fp.l10n);
|
|
99
|
+
fp.yearElements.forEach(function (elem) {
|
|
100
|
+
var currentMonthContainer = elem.closest(config.selectorFlatpickrMonthYearContainer);
|
|
101
|
+
Array.prototype.forEach.call(currentMonthContainer.querySelectorAll('.cur-month'), function (monthElement) {
|
|
102
|
+
monthElement.textContent = monthStr;
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
var register = function register() {
|
|
108
|
+
fp.loadedPlugins.push('carbonFlatpickrMonthSelectPlugin');
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
onMonthChange: updateCurrentMonth,
|
|
113
|
+
onValueUpdate: updateCurrentMonth,
|
|
114
|
+
onOpen: updateCurrentMonth,
|
|
115
|
+
onReady: [setupElements, updateCurrentMonth, register]
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
var DatePicker = /*#__PURE__*/function (_Component) {
|
|
121
|
+
_rollupPluginBabelHelpers.inherits(DatePicker, _Component);
|
|
122
|
+
|
|
123
|
+
var _super = _rollupPluginBabelHelpers.createSuper(DatePicker);
|
|
124
|
+
|
|
125
|
+
function DatePicker() {
|
|
126
|
+
var _this;
|
|
127
|
+
|
|
128
|
+
_rollupPluginBabelHelpers.classCallCheck(this, DatePicker);
|
|
129
|
+
|
|
130
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
131
|
+
args[_key] = arguments[_key];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
135
|
+
|
|
136
|
+
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "onChange", function () {
|
|
137
|
+
var _this$cal;
|
|
138
|
+
|
|
139
|
+
if (_this.inputField.value === '' && (_this$cal = _this.cal) !== null && _this$cal !== void 0 && _this$cal.selectedDates.length) {
|
|
140
|
+
_this.cal.clear();
|
|
141
|
+
|
|
142
|
+
_this.cal.input.focus();
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "addRoleAttributeToDialog", function () {
|
|
147
|
+
if (_this.inputField) {
|
|
148
|
+
_this.cal.calendarContainer.setAttribute('role', 'region'); // IBM EAAC requires an aria-label on a role='region'
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
_this.cal.calendarContainer.setAttribute('aria-label', 'calendar-container');
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "addKeyboardEvents", function (cal) {
|
|
156
|
+
var initArrowDownListener = function initArrowDownListener(element) {
|
|
157
|
+
if (element) {
|
|
158
|
+
element.addEventListener('keydown', function (e) {
|
|
159
|
+
if (match.match(e, keys.ArrowDown)) {
|
|
160
|
+
var calendarContainer = cal.calendarContainer,
|
|
161
|
+
fpSelectedDateElem = cal.selectedDateElem,
|
|
162
|
+
fptodayDateElem = cal.todayDateElem;
|
|
163
|
+
var selectedDateElem = calendarContainer.querySelector('.selected') && fpSelectedDateElem;
|
|
164
|
+
var todayDateElem = calendarContainer.querySelector('.today') && fptodayDateElem;
|
|
165
|
+
(selectedDateElem || todayDateElem || calendarContainer.querySelector('.flatpickr-day[tabindex]') || calendarContainer).focus();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
element.addEventListener('change', _this.onChange);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
initArrowDownListener(_this.inputField);
|
|
173
|
+
initArrowDownListener(_this.toInputField);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "updateClassNames", function (calendar) {
|
|
177
|
+
var calendarContainer = calendar.calendarContainer;
|
|
178
|
+
var daysContainer = calendar.days;
|
|
179
|
+
|
|
180
|
+
if (calendarContainer && daysContainer) {
|
|
181
|
+
// calendarContainer and daysContainer are undefined if flatpickr detects a mobile device
|
|
182
|
+
calendarContainer.classList.add("".concat(_this.context, "--date-picker__calendar"));
|
|
183
|
+
calendarContainer.querySelector('.flatpickr-month').classList.add("".concat(_this.context, "--date-picker__month"));
|
|
184
|
+
calendarContainer.querySelector('.flatpickr-weekdays').classList.add("".concat(_this.context, "--date-picker__weekdays"));
|
|
185
|
+
calendarContainer.querySelector('.flatpickr-days').classList.add("".concat(_this.context, "--date-picker__days"));
|
|
186
|
+
forEach.call(calendarContainer.querySelectorAll('.flatpickr-weekday'), function (item) {
|
|
187
|
+
var currentItem = item;
|
|
188
|
+
currentItem.innerHTML = currentItem.innerHTML.replace(/\s+/g, '');
|
|
189
|
+
currentItem.classList.add("".concat(_this.context, "--date-picker__weekday"));
|
|
190
|
+
});
|
|
191
|
+
forEach.call(daysContainer.querySelectorAll('.flatpickr-day'), function (item) {
|
|
192
|
+
item.classList.add("".concat(_this.context, "--date-picker__day"));
|
|
193
|
+
|
|
194
|
+
if (item.classList.contains('today') && calendar.selectedDates.length > 0) {
|
|
195
|
+
item.classList.add('no-border');
|
|
196
|
+
} else if (item.classList.contains('today') && calendar.selectedDates.length === 0) {
|
|
197
|
+
item.classList.remove('no-border');
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "assignInputFieldRef", function (node) {
|
|
204
|
+
_this.inputField = !node ? null : // Child is a regular DOM node, seen in tests
|
|
205
|
+
node.nodeType === Node.ELEMENT_NODE ? node.querySelector(".".concat(_this.context, "--date-picker__input")) : // Child is a React component
|
|
206
|
+
node.input && node.input.nodeType === Node.ELEMENT_NODE ? node.input : null;
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "assignToInputFieldRef", function (node) {
|
|
210
|
+
_this.toInputField = !node ? null : // Child is a regular DOM node, seen in tests
|
|
211
|
+
node.nodeType === Node.ELEMENT_NODE ? node.querySelector(".".concat(_this.context, "--date-picker__input")) : // Child is a React component
|
|
212
|
+
node.input && node.input.nodeType === Node.ELEMENT_NODE ? node.input : null;
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "isLabelTextEmpty", function (children) {
|
|
216
|
+
return children.every(function (child) {
|
|
217
|
+
return !child.props.labelText;
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
return _this;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
_rollupPluginBabelHelpers.createClass(DatePicker, [{
|
|
225
|
+
key: "componentDidMount",
|
|
226
|
+
value: function componentDidMount() {
|
|
227
|
+
var _this2 = this;
|
|
228
|
+
|
|
229
|
+
var _this$props = this.props,
|
|
230
|
+
allowInput = _this$props.allowInput,
|
|
231
|
+
appendTo = _this$props.appendTo,
|
|
232
|
+
datePickerType = _this$props.datePickerType,
|
|
233
|
+
dateFormat = _this$props.dateFormat,
|
|
234
|
+
locale = _this$props.locale,
|
|
235
|
+
minDate = _this$props.minDate,
|
|
236
|
+
maxDate = _this$props.maxDate,
|
|
237
|
+
value = _this$props.value,
|
|
238
|
+
onClose = _this$props.onClose,
|
|
239
|
+
disable = _this$props.disable,
|
|
240
|
+
enable = _this$props.enable,
|
|
241
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_this$props, _excluded);
|
|
242
|
+
|
|
243
|
+
if (datePickerType === 'single' || datePickerType === 'range') {
|
|
244
|
+
var onHook = function onHook(electedDates, dateStr, instance) {
|
|
245
|
+
_this2.updateClassNames(instance);
|
|
246
|
+
}; // Logic to determine if `enable` or `disable` will be passed down. If neither
|
|
247
|
+
// is provided, we return the default empty disabled array, allowing all dates.
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
var enableOrDisable = enable ? 'enable' : 'disable';
|
|
251
|
+
var enableOrDisableArr;
|
|
252
|
+
|
|
253
|
+
if (!enable && !disable) {
|
|
254
|
+
enableOrDisableArr = [];
|
|
255
|
+
} else if (enable) {
|
|
256
|
+
enableOrDisableArr = enable;
|
|
257
|
+
} else {
|
|
258
|
+
enableOrDisableArr = disable;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
var localeData;
|
|
262
|
+
|
|
263
|
+
if (_rollupPluginBabelHelpers["typeof"](locale) === 'object') {
|
|
264
|
+
var location = locale.locale ? locale.locale : 'en';
|
|
265
|
+
localeData = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, index["default"][location]), locale);
|
|
266
|
+
} else {
|
|
267
|
+
localeData = index["default"][locale];
|
|
268
|
+
} // inputField ref might not be set in enzyme tests
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
if (this.inputField) {
|
|
272
|
+
var _rest$inline, _flatpickr;
|
|
273
|
+
|
|
274
|
+
this.cal = new flatpickr__default["default"](this.inputField, (_flatpickr = {
|
|
275
|
+
inline: (_rest$inline = rest.inline) !== null && _rest$inline !== void 0 ? _rest$inline : false,
|
|
276
|
+
disableMobile: true,
|
|
277
|
+
defaultDate: value,
|
|
278
|
+
mode: datePickerType,
|
|
279
|
+
allowInput: allowInput !== null && allowInput !== void 0 ? allowInput : true,
|
|
280
|
+
dateFormat: dateFormat,
|
|
281
|
+
locale: localeData
|
|
282
|
+
}, _rollupPluginBabelHelpers.defineProperty(_flatpickr, enableOrDisable, enableOrDisableArr), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "minDate", minDate), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "maxDate", maxDate), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "plugins", [datePickerType === 'range' ? new rangePlugin["default"]({
|
|
283
|
+
input: this.toInputField
|
|
284
|
+
}) : function () {}, appendTo ? appendToPlugin["default"]({
|
|
285
|
+
appendTo: appendTo
|
|
286
|
+
}) : function () {}, carbonFlatpickrMonthSelectPlugin({
|
|
287
|
+
selectorFlatpickrMonthYearContainer: '.flatpickr-current-month',
|
|
288
|
+
selectorFlatpickrYearContainer: '.numInputWrapper',
|
|
289
|
+
selectorFlatpickrCurrentMonth: '.cur-month',
|
|
290
|
+
classFlatpickrCurrentMonth: 'cur-month'
|
|
291
|
+
}), fixEventsPlugin["default"]({
|
|
292
|
+
inputFrom: this.inputField,
|
|
293
|
+
inputTo: this.toInputField
|
|
294
|
+
})]), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "clickOpens", true), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "nextArrow", this.rightArrowHTML()), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "prevArrow", this.leftArrowHTML()), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "onChange", function onChange() {
|
|
295
|
+
var onChange = _this2.props.onChange;
|
|
296
|
+
|
|
297
|
+
if (onChange) {
|
|
298
|
+
onChange.apply(void 0, arguments);
|
|
299
|
+
}
|
|
300
|
+
}), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "onClose", onClose), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "onReady", onHook), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "onMonthChange", onHook), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "onYearChange", onHook), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "onOpen", function onOpen() {
|
|
301
|
+
var onOpen = _this2.props.onOpen;
|
|
302
|
+
onHook.apply(void 0, arguments);
|
|
303
|
+
|
|
304
|
+
if (onOpen) {
|
|
305
|
+
onOpen.apply(void 0, arguments);
|
|
306
|
+
}
|
|
307
|
+
}), _rollupPluginBabelHelpers.defineProperty(_flatpickr, "onValueUpdate", onHook), _flatpickr));
|
|
308
|
+
this.addKeyboardEvents(this.cal);
|
|
309
|
+
this.addRoleAttributeToDialog();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}, {
|
|
314
|
+
key: "componentDidUpdate",
|
|
315
|
+
value: function componentDidUpdate(_ref) {
|
|
316
|
+
var prevDateFormat = _ref.dateFormat,
|
|
317
|
+
prevMinDate = _ref.minDate,
|
|
318
|
+
prevMaxDate = _ref.maxDate,
|
|
319
|
+
prevValue = _ref.value,
|
|
320
|
+
prevDisable = _ref.disable,
|
|
321
|
+
prevEnable = _ref.enable,
|
|
322
|
+
prevRest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded2);
|
|
323
|
+
|
|
324
|
+
var _this$props2 = this.props,
|
|
325
|
+
dateFormat = _this$props2.dateFormat,
|
|
326
|
+
minDate = _this$props2.minDate,
|
|
327
|
+
maxDate = _this$props2.maxDate,
|
|
328
|
+
value = _this$props2.value,
|
|
329
|
+
disable = _this$props2.disable,
|
|
330
|
+
enable = _this$props2.enable,
|
|
331
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_this$props2, _excluded3);
|
|
332
|
+
|
|
333
|
+
if (this.cal) {
|
|
334
|
+
if (prevDateFormat !== dateFormat) {
|
|
335
|
+
this.cal.set({
|
|
336
|
+
dateFormat: dateFormat
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (prevMinDate !== minDate) {
|
|
341
|
+
this.cal.set('minDate', minDate);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (prevMaxDate !== maxDate) {
|
|
345
|
+
this.cal.set('maxDate', maxDate);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (disable !== prevDisable) {
|
|
349
|
+
this.cal.set('disable', disable);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (enable !== prevEnable) {
|
|
353
|
+
this.cal.set('enable', enable);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (rest.inline && rest.inline !== (prevRest === null || prevRest === void 0 ? void 0 : prevRest.inline)) {
|
|
357
|
+
this.cal.set('inline', rest.inline);
|
|
358
|
+
}
|
|
359
|
+
} // Coordinate when the given `value` prop changes. When this happens, we
|
|
360
|
+
// should update the calendar to the new value.
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
if (prevValue !== value) {
|
|
364
|
+
if (this.cal) {
|
|
365
|
+
this.cal.setDate(this.props.value);
|
|
366
|
+
this.updateClassNames(this.cal);
|
|
367
|
+
} else if (this.inputField) {
|
|
368
|
+
this.inputField.value = this.props.value;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}, {
|
|
373
|
+
key: "componentWillUnmount",
|
|
374
|
+
value: function componentWillUnmount() {
|
|
375
|
+
if (this.cal) {
|
|
376
|
+
this.cal.destroy();
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (this.inputField) {
|
|
380
|
+
this.inputField.removeEventListener('change', this.onChange);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (this.toInputField) {
|
|
384
|
+
this.toInputField.removeEventListener('change', this.onChange);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}, {
|
|
388
|
+
key: "rightArrowHTML",
|
|
389
|
+
value: function rightArrowHTML() {
|
|
390
|
+
return "\n <svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n <polygon points=\"11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 \"/>\n <rect width=\"16\" height=\"16\" style=\"fill:none\" />\n </svg>";
|
|
391
|
+
}
|
|
392
|
+
}, {
|
|
393
|
+
key: "leftArrowHTML",
|
|
394
|
+
value: function leftArrowHTML() {
|
|
395
|
+
return "\n <svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n <polygon points=\"5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 \"/>\n <rect width=\"16\" height=\"16\" style=\"fill:none\" />\n </svg>";
|
|
396
|
+
}
|
|
397
|
+
}, {
|
|
398
|
+
key: "render",
|
|
399
|
+
value: function render() {
|
|
400
|
+
var _this3 = this;
|
|
401
|
+
|
|
402
|
+
return /*#__PURE__*/React__default["default"].createElement(index$1.FeatureFlagContext.Consumer, null, function (scope) {
|
|
403
|
+
var _classNames;
|
|
404
|
+
|
|
405
|
+
var _this3$props = _this3.props;
|
|
406
|
+
_this3$props.allowInput;
|
|
407
|
+
_this3$props.appendTo;
|
|
408
|
+
var children = _this3$props.children,
|
|
409
|
+
className = _this3$props.className,
|
|
410
|
+
short = _this3$props.short,
|
|
411
|
+
light = _this3$props.light,
|
|
412
|
+
datePickerType = _this3$props.datePickerType;
|
|
413
|
+
_this3$props.minDate;
|
|
414
|
+
_this3$props.maxDate;
|
|
415
|
+
_this3$props.dateFormat;
|
|
416
|
+
_this3$props.onChange;
|
|
417
|
+
_this3$props.locale;
|
|
418
|
+
_this3$props.value;
|
|
419
|
+
_this3$props.onOpen;
|
|
420
|
+
var other = _rollupPluginBabelHelpers.objectWithoutProperties(_this3$props, _excluded4);
|
|
421
|
+
|
|
422
|
+
var enabled;
|
|
423
|
+
|
|
424
|
+
if (scope.enabled) {
|
|
425
|
+
enabled = scope.enabled('enable-v11-release');
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
var datePickerClasses = cx__default["default"]("".concat(_this3.context, "--date-picker"), [enabled ? null : className], (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(_this3.context, "--date-picker--short"), short), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(_this3.context, "--date-picker--light"), light), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(_this3.context, "--date-picker--simple"), datePickerType === 'simple'), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(_this3.context, "--date-picker--single"), datePickerType === 'single'), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(_this3.context, "--date-picker--range"), datePickerType === 'range'), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(_this3.context, "--date-picker--nolabel"), datePickerType === 'range' && _this3.isLabelTextEmpty(children)), _classNames));
|
|
429
|
+
var wrapperClasses = cx__default["default"]("".concat(_this3.context, "--form-item"), [enabled ? className : null]);
|
|
430
|
+
var childArray = React__default["default"].Children.toArray(children);
|
|
431
|
+
var childrenWithProps = childArray.map(function (child, index) {
|
|
432
|
+
if (index === 0 && child.type === React__default["default"].createElement(index$2["default"], child.props).type) {
|
|
433
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
434
|
+
datePickerType: datePickerType,
|
|
435
|
+
ref: _this3.assignInputFieldRef
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (index === 1 && child.type === React__default["default"].createElement(index$2["default"], child.props).type) {
|
|
440
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
441
|
+
datePickerType: datePickerType,
|
|
442
|
+
ref: _this3.assignToInputFieldRef
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (index === 0) {
|
|
447
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
448
|
+
ref: _this3.assignInputFieldRef
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (index === 1) {
|
|
453
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
454
|
+
ref: _this3.assignToInputFieldRef
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
459
|
+
className: wrapperClasses
|
|
460
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
461
|
+
className: datePickerClasses
|
|
462
|
+
}, other), childrenWithProps));
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}]);
|
|
466
|
+
|
|
467
|
+
return DatePicker;
|
|
468
|
+
}(React.Component);
|
|
469
|
+
|
|
470
|
+
_rollupPluginBabelHelpers.defineProperty(DatePicker, "propTypes", {
|
|
471
|
+
/**
|
|
472
|
+
* flatpickr prop passthrough. Allows the user to enter a date directly
|
|
473
|
+
* into the input field
|
|
474
|
+
*/
|
|
475
|
+
allowInput: PropTypes__default["default"].bool,
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* The DOM element the Flatpicker should be inserted into. `<body>` by default.
|
|
479
|
+
*/
|
|
480
|
+
appendTo: PropTypes__default["default"].object,
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* The child nodes.
|
|
484
|
+
*/
|
|
485
|
+
children: PropTypes__default["default"].node,
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* The CSS class names.
|
|
489
|
+
*/
|
|
490
|
+
className: PropTypes__default["default"].string,
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* The date format.
|
|
494
|
+
*/
|
|
495
|
+
dateFormat: PropTypes__default["default"].string,
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* The type of the date picker:
|
|
499
|
+
*
|
|
500
|
+
* * `simple` - Without calendar dropdown.
|
|
501
|
+
* * `single` - With calendar dropdown and single date.
|
|
502
|
+
* * `range` - With calendar dropdown and a date range.
|
|
503
|
+
*/
|
|
504
|
+
datePickerType: PropTypes__default["default"].oneOf(['simple', 'single', 'range']),
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* The flatpickr `disable` option that allows a user to disable certain dates.
|
|
508
|
+
*/
|
|
509
|
+
disable: PropTypes__default["default"].array,
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* The flatpickr `enable` option that allows a user to enable certain dates.
|
|
513
|
+
*/
|
|
514
|
+
enable: PropTypes__default["default"].array,
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* `true` to use the light version.
|
|
518
|
+
*/
|
|
519
|
+
light: PropTypes__default["default"].bool,
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* The language locale used to format the days of the week, months, and numbers. The full list of supported locales can be found here https://github.com/flatpickr/flatpickr/tree/master/src/l10n
|
|
523
|
+
*/
|
|
524
|
+
locale: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].oneOf(['ar', // Arabic
|
|
525
|
+
'at', // Austria
|
|
526
|
+
'az', // Azerbaijan
|
|
527
|
+
'be', // Belarusian
|
|
528
|
+
'bg', // Bulgarian
|
|
529
|
+
'bn', // Bangla
|
|
530
|
+
'bs', // Bosnia
|
|
531
|
+
'cat', // Catalan
|
|
532
|
+
'cs', // Czech
|
|
533
|
+
'cy', // Welsh
|
|
534
|
+
'da', // Danish
|
|
535
|
+
'de', // German
|
|
536
|
+
'en', // English
|
|
537
|
+
'eo', // Esperanto
|
|
538
|
+
'es', // Spanish
|
|
539
|
+
'et', // Estonian
|
|
540
|
+
'fa', // Persian
|
|
541
|
+
'fi', // Finnish
|
|
542
|
+
'fo', // Faroese
|
|
543
|
+
'fr', // French
|
|
544
|
+
'ga', // Gaelic
|
|
545
|
+
'gr', // Greek
|
|
546
|
+
'he', // Hebrew
|
|
547
|
+
'hi', // Hindi
|
|
548
|
+
'hr', // Croatian
|
|
549
|
+
'hu', // Hungarian
|
|
550
|
+
'id', // Indonesian
|
|
551
|
+
'is', // Icelandic
|
|
552
|
+
'it', // Italian
|
|
553
|
+
'ja', // Japanese
|
|
554
|
+
'ka', // Georgian
|
|
555
|
+
'km', // Khmer
|
|
556
|
+
'ko', // Korean
|
|
557
|
+
'kz', // Kazakh
|
|
558
|
+
'lt', // Lithuanian
|
|
559
|
+
'lv', // Latvian
|
|
560
|
+
'mk', // Macedonian
|
|
561
|
+
'mn', // Mongolian
|
|
562
|
+
'ms', // Malaysian
|
|
563
|
+
'my', // Burmese
|
|
564
|
+
'nl', // Dutch
|
|
565
|
+
'no', // Norwegian
|
|
566
|
+
'pa', // Punjabi
|
|
567
|
+
'pl', // Polish
|
|
568
|
+
'pt', // Portuguese
|
|
569
|
+
'ro', // Romanian
|
|
570
|
+
'ru', // Russian
|
|
571
|
+
'si', // Sinhala
|
|
572
|
+
'sk', // Slovak
|
|
573
|
+
'sl', // Slovenian
|
|
574
|
+
'sq', // Albanian
|
|
575
|
+
'sr', // Serbian
|
|
576
|
+
'sv', // Swedish
|
|
577
|
+
'th', // Thai
|
|
578
|
+
'tr', // Turkish
|
|
579
|
+
'uk', // Ukrainian
|
|
580
|
+
'uz', // Uzbek
|
|
581
|
+
'uz_latn', // Uzbek Latin
|
|
582
|
+
'vn', // Vietnamese
|
|
583
|
+
'zh_tw', // Mandarin Traditional
|
|
584
|
+
'zh' // Mandarin
|
|
585
|
+
])]),
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The maximum date that a user can pick to.
|
|
589
|
+
*/
|
|
590
|
+
maxDate: PropTypes__default["default"].string,
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* The minimum date that a user can start picking from.
|
|
594
|
+
*/
|
|
595
|
+
minDate: PropTypes__default["default"].string,
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* The `change` event handler.
|
|
599
|
+
*/
|
|
600
|
+
onChange: PropTypes__default["default"].func,
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* The `close` event handler.
|
|
604
|
+
*/
|
|
605
|
+
onClose: PropTypes__default["default"].func,
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* The `open` event handler.
|
|
609
|
+
*/
|
|
610
|
+
onOpen: PropTypes__default["default"].func,
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* `true` to use the short version.
|
|
614
|
+
*/
|
|
615
|
+
short: PropTypes__default["default"].bool,
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* The value of the date value provided to flatpickr, could
|
|
619
|
+
* be a date, a date number, a date string, an array of dates.
|
|
620
|
+
*/
|
|
621
|
+
value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].arrayOf(PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number, PropTypes__default["default"].object])), PropTypes__default["default"].object, PropTypes__default["default"].number])
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
_rollupPluginBabelHelpers.defineProperty(DatePicker, "defaultProps", {
|
|
625
|
+
short: false,
|
|
626
|
+
light: false,
|
|
627
|
+
dateFormat: 'm/d/Y',
|
|
628
|
+
locale: 'en'
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
_rollupPluginBabelHelpers.defineProperty(DatePicker, "contextType", usePrefix.PrefixContext);
|
|
632
|
+
|
|
633
|
+
exports["default"] = DatePicker;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2021
|
|
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
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var FeatureFlags = require('@carbon/feature-flags');
|
|
13
|
+
var DatePicker$2 = require('./next/DatePicker.js');
|
|
14
|
+
var DatePicker$3 = require('./DatePicker.js');
|
|
15
|
+
|
|
16
|
+
function _interopNamespace(e) {
|
|
17
|
+
if (e && e.__esModule) return e;
|
|
18
|
+
var n = Object.create(null);
|
|
19
|
+
if (e) {
|
|
20
|
+
Object.keys(e).forEach(function (k) {
|
|
21
|
+
if (k !== 'default') {
|
|
22
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
23
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return e[k]; }
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
n["default"] = e;
|
|
31
|
+
return Object.freeze(n);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var FeatureFlags__namespace = /*#__PURE__*/_interopNamespace(FeatureFlags);
|
|
35
|
+
|
|
36
|
+
var DatePicker = FeatureFlags__namespace.enabled('enable-v11-release') ? DatePicker$2["default"] : DatePicker$3["default"];
|
|
37
|
+
var DatePicker$1 = DatePicker;
|
|
38
|
+
|
|
39
|
+
exports["default"] = DatePicker$1;
|