@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.
Files changed (601) hide show
  1. package/es/_virtual/_rollupPluginBabelHelpers.js +1 -313
  2. package/es/components/Accordion/Accordion.Skeleton.js +28 -30
  3. package/es/components/Accordion/Accordion.js +18 -21
  4. package/es/components/Accordion/AccordionItem.js +37 -49
  5. package/es/components/AspectRatio/AspectRatio.js +10 -12
  6. package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +10 -11
  7. package/es/components/Breadcrumb/Breadcrumb.js +14 -13
  8. package/es/components/Breadcrumb/BreadcrumbItem.js +24 -22
  9. package/es/components/Button/Button.Skeleton.js +25 -23
  10. package/es/components/Button/Button.js +77 -72
  11. package/es/components/ButtonSet/ButtonSet.js +12 -10
  12. package/es/components/Checkbox/Checkbox.Skeleton.js +10 -11
  13. package/es/components/Checkbox/Checkbox.js +55 -52
  14. package/es/components/CheckboxGroup/CheckboxGroup.js +33 -31
  15. package/es/components/ClassPrefix/index.js +4 -2
  16. package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +15 -14
  17. package/es/components/CodeSnippet/CodeSnippet.js +199 -102
  18. package/es/components/ComboBox/ComboBox.js +349 -178
  19. package/es/components/ComboBox/tools/filter.js +6 -4
  20. package/es/components/ComboButton/index.js +38 -43
  21. package/es/components/ComposedModal/ComposedModal.js +187 -85
  22. package/es/components/ComposedModal/ModalFooter.js +54 -49
  23. package/es/components/ComposedModal/ModalHeader.js +39 -26
  24. package/es/components/ContainedList/ContainedList.js +66 -20
  25. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +20 -18
  26. package/es/components/ContentSwitcher/ContentSwitcher.js +83 -98
  27. package/es/components/ContentSwitcher/index.js +1 -1
  28. package/es/components/ContextMenu/useContextMenu.js +12 -21
  29. package/es/components/Copy/Copy.js +24 -29
  30. package/es/components/CopyButton/CopyButton.js +10 -10
  31. package/es/components/DangerButton/DangerButton.js +3 -5
  32. package/es/components/DataTable/DataTable.js +333 -359
  33. package/es/components/DataTable/Table.js +29 -26
  34. package/es/components/DataTable/TableActionList.js +2 -4
  35. package/es/components/DataTable/TableBatchAction.js +2 -4
  36. package/es/components/DataTable/TableBatchActions.js +29 -30
  37. package/es/components/DataTable/TableBody.js +7 -8
  38. package/es/components/DataTable/TableCell.js +1 -1
  39. package/es/components/DataTable/TableContainer.js +23 -23
  40. package/es/components/DataTable/TableContext.js +1 -1
  41. package/es/components/DataTable/TableExpandHeader.js +19 -21
  42. package/es/components/DataTable/TableExpandRow.js +23 -23
  43. package/es/components/DataTable/TableExpandedRow.js +18 -23
  44. package/es/components/DataTable/TableHead.js +1 -1
  45. package/es/components/DataTable/TableHeader.js +45 -41
  46. package/es/components/DataTable/TableRow.js +7 -8
  47. package/es/components/DataTable/TableSelectAll.js +13 -11
  48. package/es/components/DataTable/TableSelectRow.js +29 -21
  49. package/es/components/DataTable/TableToolbar.js +19 -14
  50. package/es/components/DataTable/TableToolbarAction.js +6 -6
  51. package/es/components/DataTable/TableToolbarContent.js +2 -4
  52. package/es/components/DataTable/TableToolbarMenu.js +11 -12
  53. package/es/components/DataTable/TableToolbarSearch.js +52 -71
  54. package/es/components/DataTable/state/getDerivedStateFromProps.js +15 -15
  55. package/es/components/DataTable/state/sortStates.js +1 -1
  56. package/es/components/DataTable/state/sorting.js +28 -20
  57. package/es/components/DataTable/tools/cells.js +1 -3
  58. package/es/components/DataTable/tools/denormalize.js +4 -17
  59. package/es/components/DataTable/tools/filter.js +18 -16
  60. package/es/components/DataTable/tools/instanceId.js +2 -2
  61. package/es/components/DataTable/tools/normalize.js +28 -25
  62. package/es/components/DataTable/tools/sorting.js +28 -25
  63. package/es/components/DataTableSkeleton/DataTableSkeleton.js +36 -38
  64. package/es/components/DatePicker/DatePicker.Skeleton.d.ts +30 -0
  65. package/es/components/DatePicker/DatePicker.Skeleton.js +18 -20
  66. package/es/components/DatePicker/DatePicker.d.ts +131 -0
  67. package/es/components/DatePicker/DatePicker.js +215 -200
  68. package/es/components/DatePicker/index.d.ts +10 -0
  69. package/es/components/DatePicker/index.js +1 -0
  70. package/es/components/DatePicker/plugins/appendToPlugin.js +45 -43
  71. package/es/components/DatePicker/plugins/fixEventsPlugin.js +117 -107
  72. package/es/components/DatePicker/plugins/rangePlugin.js +19 -11
  73. package/es/components/DatePickerInput/DatePickerInput.d.ts +93 -0
  74. package/es/components/DatePickerInput/DatePickerInput.js +83 -74
  75. package/es/components/Dropdown/Dropdown.Skeleton.js +13 -12
  76. package/es/components/Dropdown/Dropdown.js +266 -109
  77. package/es/components/ErrorBoundary/ErrorBoundary.js +27 -48
  78. package/es/components/ErrorBoundary/ErrorBoundaryContext.js +3 -2
  79. package/es/components/ExpandableSearch/ExpandableSearch.d.ts +14 -0
  80. package/es/components/ExpandableSearch/ExpandableSearch.js +19 -25
  81. package/es/components/FeatureFlags/index.js +25 -43
  82. package/es/components/FileUploader/FileUploader.Skeleton.js +8 -9
  83. package/es/components/FileUploader/FileUploader.js +120 -147
  84. package/es/components/FileUploader/FileUploaderButton.js +36 -48
  85. package/es/components/FileUploader/FileUploaderDropContainer.js +49 -53
  86. package/es/components/FileUploader/FileUploaderItem.js +30 -30
  87. package/es/components/FileUploader/Filename.js +13 -14
  88. package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +11 -12
  89. package/es/components/FluidComboBox/FluidComboBox.js +11 -9
  90. package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +18 -18
  91. package/es/components/FluidDatePicker/FluidDatePicker.js +20 -16
  92. package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
  93. package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +11 -12
  94. package/es/components/FluidDropdown/FluidDropdown.js +11 -9
  95. package/es/components/FluidForm/FluidForm.js +9 -10
  96. package/es/components/FluidForm/FormContext.js +1 -1
  97. package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +11 -12
  98. package/es/components/FluidMultiSelect/FluidMultiSelect.js +12 -10
  99. package/es/components/FluidSelect/FluidSelect.Skeleton.js +11 -12
  100. package/es/components/FluidSelect/FluidSelect.js +9 -9
  101. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +9 -10
  102. package/es/components/FluidTextArea/FluidTextArea.js +7 -8
  103. package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +9 -10
  104. package/es/components/FluidTextInput/FluidTextInput.js +10 -9
  105. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +11 -10
  106. package/es/components/FluidTimePicker/FluidTimePicker.js +30 -26
  107. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +7 -7
  108. package/es/components/Form/Form.js +9 -10
  109. package/es/components/FormGroup/FormGroup.js +16 -17
  110. package/es/components/FormItem/FormItem.js +8 -9
  111. package/es/components/FormLabel/FormLabel.js +11 -10
  112. package/es/components/Grid/CSSGrid.js +38 -39
  113. package/es/components/Grid/Column.js +86 -79
  114. package/es/components/Grid/ColumnHang.js +12 -14
  115. package/es/components/Grid/FlexGrid.js +19 -21
  116. package/es/components/Grid/Grid.js +2 -2
  117. package/es/components/Grid/GridContext.js +12 -11
  118. package/es/components/Grid/Row.js +16 -18
  119. package/es/components/Heading/index.js +11 -13
  120. package/es/components/Icon/Icon.Skeleton.js +10 -12
  121. package/es/components/IconButton/index.js +19 -22
  122. package/es/components/IdPrefix/index.js +4 -2
  123. package/es/components/InlineCheckbox/InlineCheckbox.js +89 -36
  124. package/es/components/InlineLoading/InlineLoading.js +23 -25
  125. package/es/components/Layer/LayerContext.js +1 -1
  126. package/es/components/Layer/index.js +17 -18
  127. package/es/components/Layout/LayoutDirection.js +8 -10
  128. package/es/components/Layout/LayoutDirectionContext.js +1 -1
  129. package/es/components/Link/Link.js +25 -25
  130. package/es/components/ListBox/ListBox.js +38 -31
  131. package/es/components/ListBox/ListBoxField.js +9 -10
  132. package/es/components/ListBox/ListBoxMenu.js +9 -10
  133. package/es/components/ListBox/ListBoxMenuIcon.js +16 -14
  134. package/es/components/ListBox/ListBoxMenuItem.js +23 -26
  135. package/es/components/ListBox/ListBoxPropTypes.js +4 -4
  136. package/es/components/ListBox/ListBoxSelection.js +30 -25
  137. package/es/components/ListBox/index.js +1 -1
  138. package/es/components/ListBox/next/ListBoxSelection.js +27 -24
  139. package/es/components/ListBox/next/ListBoxTrigger.js +20 -19
  140. package/es/components/ListItem/ListItem.js +9 -10
  141. package/es/components/Loading/Loading.js +24 -24
  142. package/es/components/Menu/Menu.js +67 -80
  143. package/es/components/Menu/MenuContext.js +9 -12
  144. package/es/components/Menu/MenuItem.js +104 -128
  145. package/es/components/MenuButton/index.js +37 -41
  146. package/es/components/Modal/Modal.js +281 -120
  147. package/es/components/ModalWrapper/ModalWrapper.js +72 -96
  148. package/es/components/MultiSelect/FilterableMultiSelect.js +299 -163
  149. package/es/components/MultiSelect/MultiSelect.js +162 -174
  150. package/es/components/MultiSelect/MultiSelectPropTypes.js +1 -1
  151. package/es/components/MultiSelect/tools/itemToString.js +3 -4
  152. package/es/components/MultiSelect/tools/sorting.js +15 -13
  153. package/es/components/Notification/Notification.js +436 -164
  154. package/es/components/NumberInput/NumberInput.Skeleton.js +10 -11
  155. package/es/components/NumberInput/NumberInput.js +140 -139
  156. package/es/components/OrderedList/OrderedList.js +17 -15
  157. package/es/components/OverflowMenu/OverflowMenu.js +360 -227
  158. package/es/components/OverflowMenu/index.js +1 -1
  159. package/es/components/OverflowMenuItem/OverflowMenuItem.js +32 -37
  160. package/es/components/OverflowMenuV2/index.js +26 -28
  161. package/es/components/Pagination/Pagination.Skeleton.js +9 -10
  162. package/es/components/Pagination/Pagination.js +98 -140
  163. package/es/components/Pagination/experimental/PageSelector.js +16 -16
  164. package/es/components/Pagination/experimental/Pagination.js +73 -94
  165. package/es/components/PaginationNav/PaginationNav.js +98 -117
  166. package/es/components/Popover/index.js +74 -80
  167. package/es/components/PrimaryButton/PrimaryButton.js +3 -5
  168. package/es/components/ProgressBar/ProgressBar.js +39 -37
  169. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +15 -14
  170. package/es/components/ProgressIndicator/ProgressIndicator.js +71 -71
  171. package/es/components/RadioButton/RadioButton.Skeleton.js +9 -10
  172. package/es/components/RadioButton/RadioButton.js +27 -27
  173. package/es/components/RadioButtonGroup/RadioButtonGroup.js +55 -65
  174. package/es/components/RadioTile/RadioTile.js +27 -25
  175. package/es/components/Search/Search.Skeleton.js +16 -16
  176. package/es/components/Search/Search.d.ts +83 -0
  177. package/es/components/Search/Search.js +65 -72
  178. package/es/components/Search/index.d.ts +11 -0
  179. package/es/components/SecondaryButton/SecondaryButton.js +3 -5
  180. package/es/components/Select/Select.Skeleton.js +12 -13
  181. package/es/components/Select/Select.js +79 -73
  182. package/es/components/SelectItem/SelectItem.js +17 -13
  183. package/es/components/SelectItemGroup/SelectItemGroup.js +11 -12
  184. package/es/components/SkeletonIcon/SkeletonIcon.js +11 -11
  185. package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +11 -11
  186. package/es/components/SkeletonText/SkeletonText.js +29 -29
  187. package/es/components/Slider/Slider.Skeleton.js +17 -18
  188. package/es/components/Slider/Slider.js +306 -329
  189. package/es/components/Slider/index.js +1 -1
  190. package/es/components/Stack/Stack.js +19 -20
  191. package/es/components/Stack/index.js +2 -2
  192. package/es/components/StructuredList/StructuredList.Skeleton.js +25 -24
  193. package/es/components/StructuredList/StructuredList.js +134 -106
  194. package/es/components/Switch/IconSwitch.js +48 -54
  195. package/es/components/Switch/Switch.js +33 -31
  196. package/es/components/Tab/Tab.js +77 -83
  197. package/es/components/Tab/index.js +1 -1
  198. package/es/components/TabContent/TabContent.js +16 -18
  199. package/es/components/Tabs/Tabs.Skeleton.js +14 -13
  200. package/es/components/Tabs/Tabs.js +195 -206
  201. package/es/components/Tabs/usePressable.js +27 -36
  202. package/es/components/Tag/Tag.Skeleton.js +10 -9
  203. package/es/components/Tag/Tag.js +34 -31
  204. package/es/components/Text/Text.js +20 -20
  205. package/es/components/Text/TextDirection.js +8 -7
  206. package/es/components/Text/TextDirectionContext.js +1 -1
  207. package/es/components/Text/index.js +1 -1
  208. package/es/components/TextArea/TextArea.Skeleton.js +11 -12
  209. package/es/components/TextArea/TextArea.js +89 -83
  210. package/es/components/TextInput/ControlledPasswordInput.js +79 -73
  211. package/es/components/TextInput/PasswordInput.js +101 -91
  212. package/es/components/TextInput/TextInput.Skeleton.js +11 -12
  213. package/es/components/TextInput/TextInput.js +104 -92
  214. package/es/components/TextInput/util.js +26 -28
  215. package/es/components/Theme/index.js +25 -20
  216. package/es/components/Tile/Tile.js +135 -176
  217. package/es/components/TileGroup/TileGroup.js +55 -70
  218. package/es/components/TileGroup/index.js +1 -1
  219. package/es/components/TimePicker/TimePicker.js +60 -67
  220. package/es/components/TimePickerSelect/TimePickerSelect.js +20 -18
  221. package/es/components/TimePickerSelect/index.js +1 -1
  222. package/es/components/Toggle/Toggle.Skeleton.js +63 -52
  223. package/es/components/Toggle/Toggle.js +44 -48
  224. package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +56 -50
  225. package/es/components/Toggletip/index.js +52 -48
  226. package/es/components/Tooltip/DefinitionTooltip.js +24 -31
  227. package/es/components/Tooltip/Tooltip.js +35 -50
  228. package/es/components/TreeView/TreeNode.js +94 -74
  229. package/es/components/TreeView/TreeView.js +72 -83
  230. package/es/components/UIShell/Content.js +12 -14
  231. package/es/components/UIShell/Header.js +16 -12
  232. package/es/components/UIShell/HeaderContainer.js +8 -14
  233. package/es/components/UIShell/HeaderGlobalAction.js +26 -19
  234. package/es/components/UIShell/HeaderGlobalBar.js +1 -3
  235. package/es/components/UIShell/HeaderMenu.js +114 -129
  236. package/es/components/UIShell/HeaderMenuButton.js +31 -22
  237. package/es/components/UIShell/HeaderMenuItem.js +28 -20
  238. package/es/components/UIShell/HeaderName.js +19 -14
  239. package/es/components/UIShell/HeaderNavigation.js +19 -15
  240. package/es/components/UIShell/HeaderPanel.js +23 -17
  241. package/es/components/UIShell/HeaderSideNavItems.js +11 -9
  242. package/es/components/UIShell/Link.js +11 -11
  243. package/es/components/UIShell/SideNav.js +66 -62
  244. package/es/components/UIShell/SideNavDetails.js +11 -12
  245. package/es/components/UIShell/SideNavDivider.js +5 -3
  246. package/es/components/UIShell/SideNavFooter.js +13 -12
  247. package/es/components/UIShell/SideNavHeader.js +9 -6
  248. package/es/components/UIShell/SideNavIcon.js +11 -8
  249. package/es/components/UIShell/SideNavItem.js +11 -9
  250. package/es/components/UIShell/SideNavItems.js +14 -11
  251. package/es/components/UIShell/SideNavLink.js +19 -17
  252. package/es/components/UIShell/SideNavLinkText.js +8 -9
  253. package/es/components/UIShell/SideNavMenu.js +29 -35
  254. package/es/components/UIShell/SideNavMenuItem.js +14 -14
  255. package/es/components/UIShell/SideNavSwitcher.js +19 -19
  256. package/es/components/UIShell/SkipToContent.js +10 -11
  257. package/es/components/UIShell/Switcher.js +20 -11
  258. package/es/components/UIShell/SwitcherDivider.js +10 -9
  259. package/es/components/UIShell/SwitcherItem.js +26 -19
  260. package/es/components/UIShell/_utils.js +1 -1
  261. package/es/components/UnorderedList/UnorderedList.js +14 -14
  262. package/es/index.js +7 -7
  263. package/es/internal/ClickListener.js +49 -65
  264. package/es/internal/FloatingMenu.js +193 -200
  265. package/es/internal/OptimizedResize.js +9 -8
  266. package/es/internal/Selection.js +92 -111
  267. package/es/internal/createClassWrapper.js +2 -2
  268. package/es/internal/deprecateFieldOnObject.js +5 -3
  269. package/es/internal/environment.js +1 -1
  270. package/es/internal/focus/index.js +1 -1
  271. package/es/internal/keyboard/keys.js +11 -11
  272. package/es/internal/keyboard/match.js +7 -6
  273. package/es/internal/keyboard/navigation.js +15 -5
  274. package/es/internal/useAnnouncer.js +2 -2
  275. package/es/internal/useAttachedMenu.js +12 -20
  276. package/es/internal/useControllableState.js +11 -16
  277. package/es/internal/useDelayedState.js +9 -18
  278. package/es/internal/useEffectOnce.js +4 -4
  279. package/es/internal/useEvent.js +4 -4
  280. package/es/internal/useId.js +15 -19
  281. package/es/internal/useIdPrefix.js +1 -1
  282. package/es/internal/useIsomorphicEffect.js +1 -1
  283. package/es/internal/useMergedRefs.js +3 -3
  284. package/es/internal/useNoInteractiveChildren.js +8 -19
  285. package/es/internal/useNormalizedInputProps.js +16 -14
  286. package/es/internal/usePrefix.js +1 -1
  287. package/es/internal/useSavedCallback.js +3 -3
  288. package/es/internal/warning.js +4 -4
  289. package/es/internal/wrapFocus.js +16 -21
  290. package/es/prop-types/AriaPropTypes.js +1 -1
  291. package/es/prop-types/deprecate.js +6 -5
  292. package/es/prop-types/isRequiredOneOf.js +12 -25
  293. package/es/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
  294. package/es/prop-types/types.js +1 -1
  295. package/es/tools/array.js +1 -1
  296. package/es/tools/events.js +21 -14
  297. package/es/tools/mergeRefs.js +3 -3
  298. package/es/tools/setupGetInstanceId.js +1 -1
  299. package/es/tools/uniqueId.js +3 -3
  300. package/es/tools/wrapComponent.js +14 -13
  301. package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -336
  302. package/lib/components/Accordion/Accordion.Skeleton.js +27 -29
  303. package/lib/components/Accordion/Accordion.js +17 -20
  304. package/lib/components/Accordion/AccordionItem.js +36 -48
  305. package/lib/components/AspectRatio/AspectRatio.js +9 -11
  306. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +9 -10
  307. package/lib/components/Breadcrumb/Breadcrumb.js +13 -12
  308. package/lib/components/Breadcrumb/BreadcrumbItem.js +23 -21
  309. package/lib/components/Button/Button.Skeleton.js +24 -22
  310. package/lib/components/Button/Button.js +76 -71
  311. package/lib/components/ButtonSet/ButtonSet.js +11 -9
  312. package/lib/components/Checkbox/Checkbox.Skeleton.js +9 -10
  313. package/lib/components/Checkbox/Checkbox.js +54 -51
  314. package/lib/components/CheckboxGroup/CheckboxGroup.js +32 -30
  315. package/lib/components/ClassPrefix/index.js +4 -2
  316. package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +14 -13
  317. package/lib/components/CodeSnippet/CodeSnippet.js +198 -101
  318. package/lib/components/ComboBox/ComboBox.js +348 -177
  319. package/lib/components/ComboBox/tools/filter.js +6 -4
  320. package/lib/components/ComboButton/index.js +37 -42
  321. package/lib/components/ComposedModal/ComposedModal.js +187 -85
  322. package/lib/components/ComposedModal/ModalFooter.js +53 -48
  323. package/lib/components/ComposedModal/ModalHeader.js +38 -25
  324. package/lib/components/ContainedList/ContainedList.js +66 -20
  325. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +20 -18
  326. package/lib/components/ContentSwitcher/ContentSwitcher.js +82 -97
  327. package/lib/components/ContentSwitcher/index.js +1 -1
  328. package/lib/components/ContextMenu/useContextMenu.js +12 -21
  329. package/lib/components/Copy/Copy.js +23 -28
  330. package/lib/components/CopyButton/CopyButton.js +9 -9
  331. package/lib/components/DangerButton/DangerButton.js +3 -5
  332. package/lib/components/DataTable/DataTable.js +331 -357
  333. package/lib/components/DataTable/Table.js +28 -25
  334. package/lib/components/DataTable/TableActionList.js +2 -4
  335. package/lib/components/DataTable/TableBatchAction.js +2 -4
  336. package/lib/components/DataTable/TableBatchActions.js +28 -29
  337. package/lib/components/DataTable/TableBody.js +6 -7
  338. package/lib/components/DataTable/TableCell.js +1 -1
  339. package/lib/components/DataTable/TableContainer.js +22 -22
  340. package/lib/components/DataTable/TableContext.js +1 -1
  341. package/lib/components/DataTable/TableExpandHeader.js +18 -20
  342. package/lib/components/DataTable/TableExpandRow.js +22 -22
  343. package/lib/components/DataTable/TableExpandedRow.js +17 -22
  344. package/lib/components/DataTable/TableHead.js +1 -1
  345. package/lib/components/DataTable/TableHeader.js +43 -39
  346. package/lib/components/DataTable/TableRow.js +7 -8
  347. package/lib/components/DataTable/TableSelectAll.js +13 -11
  348. package/lib/components/DataTable/TableSelectRow.js +28 -20
  349. package/lib/components/DataTable/TableToolbar.js +18 -13
  350. package/lib/components/DataTable/TableToolbarAction.js +5 -5
  351. package/lib/components/DataTable/TableToolbarContent.js +2 -4
  352. package/lib/components/DataTable/TableToolbarMenu.js +10 -11
  353. package/lib/components/DataTable/TableToolbarSearch.js +51 -70
  354. package/lib/components/DataTable/state/getDerivedStateFromProps.js +15 -15
  355. package/lib/components/DataTable/state/sortStates.js +1 -1
  356. package/lib/components/DataTable/state/sorting.js +28 -20
  357. package/lib/components/DataTable/tools/cells.js +1 -3
  358. package/lib/components/DataTable/tools/denormalize.js +4 -17
  359. package/lib/components/DataTable/tools/filter.js +18 -16
  360. package/lib/components/DataTable/tools/instanceId.js +2 -2
  361. package/lib/components/DataTable/tools/normalize.js +28 -25
  362. package/lib/components/DataTable/tools/sorting.js +27 -24
  363. package/lib/components/DataTableSkeleton/DataTableSkeleton.js +35 -37
  364. package/lib/components/DatePicker/DatePicker.Skeleton.d.ts +30 -0
  365. package/lib/components/DatePicker/DatePicker.Skeleton.js +17 -19
  366. package/lib/components/DatePicker/DatePicker.d.ts +131 -0
  367. package/lib/components/DatePicker/DatePicker.js +214 -199
  368. package/lib/components/DatePicker/index.d.ts +10 -0
  369. package/lib/components/DatePicker/index.js +2 -0
  370. package/lib/components/DatePicker/plugins/appendToPlugin.js +45 -43
  371. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +117 -107
  372. package/lib/components/DatePicker/plugins/rangePlugin.js +19 -11
  373. package/lib/components/DatePickerInput/DatePickerInput.d.ts +93 -0
  374. package/lib/components/DatePickerInput/DatePickerInput.js +83 -74
  375. package/lib/components/Dropdown/Dropdown.Skeleton.js +12 -11
  376. package/lib/components/Dropdown/Dropdown.js +265 -108
  377. package/lib/components/ErrorBoundary/ErrorBoundary.js +27 -48
  378. package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +3 -2
  379. package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +14 -0
  380. package/lib/components/ExpandableSearch/ExpandableSearch.js +18 -24
  381. package/lib/components/FeatureFlags/index.js +25 -43
  382. package/lib/components/FileUploader/FileUploader.Skeleton.js +7 -8
  383. package/lib/components/FileUploader/FileUploader.js +119 -146
  384. package/lib/components/FileUploader/FileUploaderButton.js +35 -47
  385. package/lib/components/FileUploader/FileUploaderDropContainer.js +48 -52
  386. package/lib/components/FileUploader/FileUploaderItem.js +29 -29
  387. package/lib/components/FileUploader/Filename.js +12 -13
  388. package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +10 -11
  389. package/lib/components/FluidComboBox/FluidComboBox.js +10 -8
  390. package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +17 -17
  391. package/lib/components/FluidDatePicker/FluidDatePicker.js +19 -15
  392. package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
  393. package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +10 -11
  394. package/lib/components/FluidDropdown/FluidDropdown.js +10 -8
  395. package/lib/components/FluidForm/FluidForm.js +8 -9
  396. package/lib/components/FluidForm/FormContext.js +1 -1
  397. package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +10 -11
  398. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +11 -9
  399. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +10 -11
  400. package/lib/components/FluidSelect/FluidSelect.js +8 -8
  401. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +8 -9
  402. package/lib/components/FluidTextArea/FluidTextArea.js +6 -7
  403. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +8 -9
  404. package/lib/components/FluidTextInput/FluidTextInput.js +9 -8
  405. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +10 -9
  406. package/lib/components/FluidTimePicker/FluidTimePicker.js +30 -26
  407. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +6 -6
  408. package/lib/components/Form/Form.js +8 -9
  409. package/lib/components/FormGroup/FormGroup.js +15 -16
  410. package/lib/components/FormItem/FormItem.js +7 -8
  411. package/lib/components/FormLabel/FormLabel.js +10 -9
  412. package/lib/components/Grid/CSSGrid.js +37 -38
  413. package/lib/components/Grid/Column.js +85 -78
  414. package/lib/components/Grid/ColumnHang.js +11 -13
  415. package/lib/components/Grid/FlexGrid.js +19 -21
  416. package/lib/components/Grid/Grid.js +2 -2
  417. package/lib/components/Grid/GridContext.js +12 -11
  418. package/lib/components/Grid/Row.js +16 -18
  419. package/lib/components/Heading/index.js +11 -13
  420. package/lib/components/Icon/Icon.Skeleton.js +9 -11
  421. package/lib/components/IconButton/index.js +18 -21
  422. package/lib/components/IdPrefix/index.js +4 -2
  423. package/lib/components/InlineCheckbox/InlineCheckbox.js +89 -36
  424. package/lib/components/InlineLoading/InlineLoading.js +22 -24
  425. package/lib/components/Layer/LayerContext.js +1 -1
  426. package/lib/components/Layer/index.js +16 -17
  427. package/lib/components/Layout/LayoutDirection.js +7 -9
  428. package/lib/components/Layout/LayoutDirectionContext.js +1 -1
  429. package/lib/components/Link/Link.js +24 -24
  430. package/lib/components/ListBox/ListBox.js +37 -30
  431. package/lib/components/ListBox/ListBoxField.js +8 -9
  432. package/lib/components/ListBox/ListBoxMenu.js +8 -9
  433. package/lib/components/ListBox/ListBoxMenuIcon.js +16 -14
  434. package/lib/components/ListBox/ListBoxMenuItem.js +22 -25
  435. package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
  436. package/lib/components/ListBox/ListBoxSelection.js +30 -25
  437. package/lib/components/ListBox/index.js +1 -1
  438. package/lib/components/ListBox/next/ListBoxSelection.js +26 -23
  439. package/lib/components/ListBox/next/ListBoxTrigger.js +19 -18
  440. package/lib/components/ListItem/ListItem.js +8 -9
  441. package/lib/components/Loading/Loading.js +23 -23
  442. package/lib/components/Menu/Menu.js +66 -79
  443. package/lib/components/Menu/MenuContext.js +9 -12
  444. package/lib/components/Menu/MenuItem.js +103 -127
  445. package/lib/components/MenuButton/index.js +36 -40
  446. package/lib/components/Modal/Modal.js +280 -119
  447. package/lib/components/ModalWrapper/ModalWrapper.js +71 -95
  448. package/lib/components/MultiSelect/FilterableMultiSelect.js +298 -162
  449. package/lib/components/MultiSelect/MultiSelect.js +163 -175
  450. package/lib/components/MultiSelect/MultiSelectPropTypes.js +1 -1
  451. package/lib/components/MultiSelect/tools/itemToString.js +3 -4
  452. package/lib/components/MultiSelect/tools/sorting.js +15 -13
  453. package/lib/components/Notification/Notification.js +434 -162
  454. package/lib/components/NumberInput/NumberInput.Skeleton.js +9 -10
  455. package/lib/components/NumberInput/NumberInput.js +139 -138
  456. package/lib/components/OrderedList/OrderedList.js +16 -14
  457. package/lib/components/OverflowMenu/OverflowMenu.js +359 -226
  458. package/lib/components/OverflowMenu/index.js +1 -1
  459. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +31 -36
  460. package/lib/components/OverflowMenuV2/index.js +25 -27
  461. package/lib/components/Pagination/Pagination.Skeleton.js +8 -9
  462. package/lib/components/Pagination/Pagination.js +97 -139
  463. package/lib/components/Pagination/experimental/PageSelector.js +17 -17
  464. package/lib/components/Pagination/experimental/Pagination.js +72 -93
  465. package/lib/components/PaginationNav/PaginationNav.js +97 -116
  466. package/lib/components/Popover/index.js +73 -79
  467. package/lib/components/PrimaryButton/PrimaryButton.js +3 -5
  468. package/lib/components/ProgressBar/ProgressBar.js +38 -36
  469. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +14 -13
  470. package/lib/components/ProgressIndicator/ProgressIndicator.js +70 -70
  471. package/lib/components/RadioButton/RadioButton.Skeleton.js +8 -9
  472. package/lib/components/RadioButton/RadioButton.js +26 -26
  473. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +54 -64
  474. package/lib/components/RadioTile/RadioTile.js +26 -24
  475. package/lib/components/Search/Search.Skeleton.js +15 -15
  476. package/lib/components/Search/Search.d.ts +83 -0
  477. package/lib/components/Search/Search.js +62 -69
  478. package/lib/components/Search/index.d.ts +11 -0
  479. package/lib/components/SecondaryButton/SecondaryButton.js +3 -5
  480. package/lib/components/Select/Select.Skeleton.js +11 -12
  481. package/lib/components/Select/Select.js +78 -72
  482. package/lib/components/SelectItem/SelectItem.js +16 -12
  483. package/lib/components/SelectItemGroup/SelectItemGroup.js +10 -11
  484. package/lib/components/SkeletonIcon/SkeletonIcon.js +10 -10
  485. package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +10 -10
  486. package/lib/components/SkeletonText/SkeletonText.js +28 -28
  487. package/lib/components/Slider/Slider.Skeleton.js +16 -17
  488. package/lib/components/Slider/Slider.js +305 -328
  489. package/lib/components/Slider/index.js +1 -1
  490. package/lib/components/Stack/Stack.js +18 -19
  491. package/lib/components/Stack/index.js +2 -2
  492. package/lib/components/StructuredList/StructuredList.Skeleton.js +24 -23
  493. package/lib/components/StructuredList/StructuredList.js +133 -105
  494. package/lib/components/Switch/IconSwitch.js +45 -51
  495. package/lib/components/Switch/Switch.js +33 -31
  496. package/lib/components/Tab/Tab.js +76 -82
  497. package/lib/components/Tab/index.js +1 -1
  498. package/lib/components/TabContent/TabContent.js +15 -17
  499. package/lib/components/Tabs/Tabs.Skeleton.js +13 -12
  500. package/lib/components/Tabs/Tabs.js +194 -205
  501. package/lib/components/Tabs/usePressable.js +27 -36
  502. package/lib/components/Tag/Tag.Skeleton.js +9 -8
  503. package/lib/components/Tag/Tag.js +33 -30
  504. package/lib/components/Text/Text.js +19 -19
  505. package/lib/components/Text/TextDirection.js +8 -7
  506. package/lib/components/Text/TextDirectionContext.js +1 -1
  507. package/lib/components/Text/index.js +1 -1
  508. package/lib/components/TextArea/TextArea.Skeleton.js +10 -11
  509. package/lib/components/TextArea/TextArea.js +88 -82
  510. package/lib/components/TextInput/ControlledPasswordInput.js +78 -72
  511. package/lib/components/TextInput/PasswordInput.js +100 -90
  512. package/lib/components/TextInput/TextInput.Skeleton.js +10 -11
  513. package/lib/components/TextInput/TextInput.js +104 -92
  514. package/lib/components/TextInput/util.js +28 -30
  515. package/lib/components/Theme/index.js +24 -19
  516. package/lib/components/Tile/Tile.js +134 -175
  517. package/lib/components/TileGroup/TileGroup.js +54 -69
  518. package/lib/components/TileGroup/index.js +1 -1
  519. package/lib/components/TimePicker/TimePicker.js +59 -66
  520. package/lib/components/TimePickerSelect/TimePickerSelect.js +19 -17
  521. package/lib/components/TimePickerSelect/index.js +1 -1
  522. package/lib/components/Toggle/Toggle.Skeleton.js +68 -57
  523. package/lib/components/Toggle/Toggle.js +43 -47
  524. package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +60 -54
  525. package/lib/components/Toggletip/index.js +51 -47
  526. package/lib/components/Tooltip/DefinitionTooltip.js +23 -30
  527. package/lib/components/Tooltip/Tooltip.js +34 -49
  528. package/lib/components/TreeView/TreeNode.js +93 -73
  529. package/lib/components/TreeView/TreeView.js +71 -82
  530. package/lib/components/UIShell/Content.js +12 -14
  531. package/lib/components/UIShell/Header.js +15 -11
  532. package/lib/components/UIShell/HeaderContainer.js +8 -14
  533. package/lib/components/UIShell/HeaderGlobalAction.js +25 -18
  534. package/lib/components/UIShell/HeaderGlobalBar.js +1 -3
  535. package/lib/components/UIShell/HeaderMenu.js +113 -128
  536. package/lib/components/UIShell/HeaderMenuButton.js +30 -21
  537. package/lib/components/UIShell/HeaderMenuItem.js +27 -19
  538. package/lib/components/UIShell/HeaderName.js +18 -13
  539. package/lib/components/UIShell/HeaderNavigation.js +18 -14
  540. package/lib/components/UIShell/HeaderPanel.js +22 -16
  541. package/lib/components/UIShell/HeaderSideNavItems.js +11 -9
  542. package/lib/components/UIShell/Link.js +11 -11
  543. package/lib/components/UIShell/SideNav.js +65 -61
  544. package/lib/components/UIShell/SideNavDetails.js +10 -11
  545. package/lib/components/UIShell/SideNavDivider.js +5 -3
  546. package/lib/components/UIShell/SideNavFooter.js +13 -12
  547. package/lib/components/UIShell/SideNavHeader.js +9 -6
  548. package/lib/components/UIShell/SideNavIcon.js +11 -8
  549. package/lib/components/UIShell/SideNavItem.js +11 -9
  550. package/lib/components/UIShell/SideNavItems.js +14 -11
  551. package/lib/components/UIShell/SideNavLink.js +18 -16
  552. package/lib/components/UIShell/SideNavLinkText.js +7 -8
  553. package/lib/components/UIShell/SideNavMenu.js +29 -35
  554. package/lib/components/UIShell/SideNavMenuItem.js +13 -13
  555. package/lib/components/UIShell/SideNavSwitcher.js +19 -19
  556. package/lib/components/UIShell/SkipToContent.js +9 -10
  557. package/lib/components/UIShell/Switcher.js +19 -10
  558. package/lib/components/UIShell/SwitcherDivider.js +9 -8
  559. package/lib/components/UIShell/SwitcherItem.js +25 -18
  560. package/lib/components/UIShell/_utils.js +1 -1
  561. package/lib/components/UnorderedList/UnorderedList.js +13 -13
  562. package/lib/index.js +14 -14
  563. package/lib/internal/ClickListener.js +49 -65
  564. package/lib/internal/FloatingMenu.js +192 -199
  565. package/lib/internal/OptimizedResize.js +9 -8
  566. package/lib/internal/Selection.js +91 -110
  567. package/lib/internal/createClassWrapper.js +2 -2
  568. package/lib/internal/deprecateFieldOnObject.js +5 -3
  569. package/lib/internal/environment.js +1 -1
  570. package/lib/internal/focus/index.js +1 -1
  571. package/lib/internal/keyboard/keys.js +11 -11
  572. package/lib/internal/keyboard/match.js +7 -6
  573. package/lib/internal/keyboard/navigation.js +15 -5
  574. package/lib/internal/useAnnouncer.js +2 -2
  575. package/lib/internal/useAttachedMenu.js +12 -20
  576. package/lib/internal/useControllableState.js +11 -16
  577. package/lib/internal/useDelayedState.js +9 -18
  578. package/lib/internal/useEffectOnce.js +4 -4
  579. package/lib/internal/useEvent.js +4 -4
  580. package/lib/internal/useId.js +14 -18
  581. package/lib/internal/useIdPrefix.js +1 -1
  582. package/lib/internal/useIsomorphicEffect.js +1 -1
  583. package/lib/internal/useMergedRefs.js +3 -3
  584. package/lib/internal/useNoInteractiveChildren.js +8 -19
  585. package/lib/internal/useNormalizedInputProps.js +16 -14
  586. package/lib/internal/usePrefix.js +1 -1
  587. package/lib/internal/useSavedCallback.js +3 -3
  588. package/lib/internal/warning.js +4 -4
  589. package/lib/internal/wrapFocus.js +16 -21
  590. package/lib/prop-types/AriaPropTypes.js +1 -1
  591. package/lib/prop-types/deprecate.js +6 -5
  592. package/lib/prop-types/isRequiredOneOf.js +15 -28
  593. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
  594. package/lib/prop-types/types.js +1 -1
  595. package/lib/tools/array.js +1 -1
  596. package/lib/tools/events.js +21 -14
  597. package/lib/tools/mergeRefs.js +3 -3
  598. package/lib/tools/setupGetInstanceId.js +1 -1
  599. package/lib/tools/uniqueId.js +3 -3
  600. package/lib/tools/wrapComponent.js +14 -13
  601. 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 = (function (config) {
17
- return function (fp) {
18
- /**
19
- * Adjusts the floating menu position after Flatpicker sets it.
20
- */
21
- var handlePreCalendarPosition = function handlePreCalendarPosition() {
22
- Promise.resolve().then(function () {
23
- var calendarContainer = fp.calendarContainer,
24
- fpConfig = fp.config,
25
- positionElement = fp._positionElement;
26
- var appendTo = fpConfig.appendTo;
27
-
28
- var _appendTo$getBounding = appendTo.getBoundingClientRect(),
29
- containerLeft = _appendTo$getBounding.left,
30
- containerTop = _appendTo$getBounding.top;
31
-
32
- var _positionElement$getB = positionElement.getBoundingClientRect(),
33
- refLeft = _positionElement$getB.left,
34
- refBottom = _positionElement$getB.bottom;
35
-
36
- if ((appendTo !== appendTo.ownerDocument.body || containerLeft !== 0 || containerTop !== 0) && appendTo.ownerDocument.defaultView.getComputedStyle(appendTo).getPropertyValue('position') === 'static') {
37
- throw new Error('Floating menu container must not have `position:static`.');
38
- } // `2` for negative margin on calendar dropdown
39
-
40
-
41
- calendarContainer.style.top = "".concat(refBottom - containerTop + 2, "px");
42
- calendarContainer.style.left = "".concat(refLeft - containerLeft, "px");
43
- });
44
- };
45
- /**
46
- * Registers this Flatpickr plugin.
47
- */
48
-
49
-
50
- var register = function register() {
51
- fp.loadedPlugins.push('carbonFlatpickrAppendToPlugin');
52
- };
53
-
54
- return {
55
- appendTo: config.appendTo,
56
- onReady: register,
57
- onPreCalendarPosition: handlePreCalendarPosition
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 = (function (config) {
21
- return function (fp) {
22
- /**
23
- * Handles `keydown` event.
24
- */
25
- var handleKeydown = function handleKeydown(event) {
26
- var inputFrom = config.inputFrom,
27
- inputTo = config.inputTo;
28
- var target = event.target;
29
-
30
- if (inputFrom === target || inputTo === target) {
31
- if (match.match(event, keys.Enter)) {
32
- // Makes sure the hitting enter key picks up pending values of both `<input>`
33
- // Workaround for: https://github.com/flatpickr/flatpickr/issues/1942
34
- fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
35
- event.stopPropagation();
36
- } else if (match.match(event, keys.ArrowLeft) || match.match(event, keys.ArrowRight)) {
37
- // Prevents Flatpickr code from canceling the event if left/right arrow keys are hit on `<input>`,
38
- // so user can move the keyboard cursor for editing dates
39
- // Workaround for: https://github.com/flatpickr/flatpickr/issues/1943
40
- event.stopPropagation();
41
- } else if (match.match(event, keys.ArrowDown)) {
42
- event.preventDefault();
43
- fp.open();
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
- * Handles `blur` event.
49
- *
50
- * For whatever reason, manual changes within the `to` input do not update the
51
- * calendar on blur. If a manual change is made within the input, this block will
52
- * set the date again, triggering the calendar to update.
53
- */
54
-
55
-
56
- var handleBlur = function handleBlur(event) {
57
- var inputFrom = config.inputFrom,
58
- inputTo = config.inputTo,
59
- lastStartValue = config.lastStartValue;
60
- var target = event.target; // Only fall into this logic if the event is on the `to` input and there is a
61
- // `to` date selected
62
-
63
- if (inputTo === target && fp.selectedDates[1]) {
64
- // Using getTime() enables the ability to more readily compare the date currently
65
- // selected in the calendar and the date currently in the value of the input
66
- var selectedToDate = new Date(fp.selectedDates[1]).setHours(0, 0, 0, 0);
67
- var 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.
68
- // When they don't match, this indiciates that the date selected in the calendar is stale,
69
- // and the current value in the input should be set for the calendar to update.
70
-
71
- if (selectedToDate && currentValueToDate && selectedToDate !== currentValueToDate) {
72
- // Update the calendar with the value of the `to` date input
73
- fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
74
- }
75
- } // save end date in calendar inmediately after it's been written down
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
- if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
79
- var currentEndDate = new Date(inputTo.value);
85
+ if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
86
+ let currentEndDate = new Date(inputTo.value);
80
87
 
81
- if (currentEndDate.toString() !== 'Invalid Date') {
82
- fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
83
- }
84
- } // overriding the flatpickr bug where the startDate gets deleted on blur
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
- if (inputTo === target && !inputFrom.value && lastStartValue.current) {
88
- var currentStartDate = new Date(lastStartValue.current);
94
+ if (inputTo === target && !inputFrom.value && lastStartValue.current) {
95
+ let currentStartDate = new Date(lastStartValue.current);
89
96
 
90
- if (currentStartDate.toString() !== 'Invalid Date') {
91
- inputFrom.value = lastStartValue.current;
97
+ if (currentStartDate.toString() !== 'Invalid Date') {
98
+ inputFrom.value = lastStartValue.current;
92
99
 
93
- if (inputTo.value) {
94
- fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
95
- }
100
+ if (inputTo.value) {
101
+ fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
96
102
  }
97
103
  }
98
- };
99
- /**
100
- * Releases event listeners used in this Flatpickr plugin.
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
- var init = function init() {
121
- release();
122
- var inputFrom = config.inputFrom,
123
- inputTo = config.inputTo;
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
- if (inputTo) {
127
- inputTo.addEventListener('keydown', handleKeydown, true);
128
- inputTo.addEventListener('blur', handleBlur, true);
129
- }
130
- };
131
- /**
132
- * Registers this Flatpickr plugin.
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
- var register = function register() {
137
- fp.loadedPlugins.push('carbonFlatpickrFixEventsPlugin');
138
- };
147
+ const register = () => {
148
+ fp.loadedPlugins.push('carbonFlatpickrFixEventsPlugin');
149
+ };
139
150
 
140
- return {
141
- onReady: [register, init],
142
- onDestroy: [release]
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 = (function (config) {
27
- var factory = rangePlugin__default["default"](Object.assign({
26
+ var carbonFlatpickrRangePlugin = (config => {
27
+ const factory = rangePlugin__default["default"](Object.assign({
28
28
  position: 'left'
29
29
  }, config));
30
- return function (fp) {
31
- var origSetDate = fp.setDate;
30
+ return fp => {
31
+ const origSetDate = fp.setDate;
32
32
 
33
- var init = function init() {
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
- var inputFrom = fp._input;
40
- var inputTo = config.input;
41
- [inputFrom, inputTo].forEach(function (input, i) {
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
- var origRangePlugin = factory(fp);
51
- var origOnReady = origRangePlugin.onReady;
54
+ const origRangePlugin = factory(fp);
55
+ const {
56
+ onReady: origOnReady
57
+ } = origRangePlugin;
52
58
  return Object.assign(origRangePlugin, {
53
59
  onReady: [init, origOnReady],
54
- onPreCalendarPosition: function onPreCalendarPosition() {}
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;