@itwin/itwinui-react 3.11.3 → 3.12.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.
Files changed (727) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/cjs/core/Alert/Alert.d.ts +3 -7
  3. package/cjs/core/Alert/Alert.js +130 -121
  4. package/cjs/core/Avatar/Avatar.js +77 -70
  5. package/cjs/core/AvatarGroup/AvatarGroup.js +73 -83
  6. package/cjs/core/Backdrop/Backdrop.js +27 -38
  7. package/cjs/core/Badge/Badge.js +49 -65
  8. package/cjs/core/Breadcrumbs/Breadcrumbs.js +169 -129
  9. package/cjs/core/ButtonGroup/ButtonGroup.js +153 -108
  10. package/cjs/core/Buttons/Button.js +97 -55
  11. package/cjs/core/Buttons/DropdownButton.js +58 -54
  12. package/cjs/core/Buttons/IconButton.js +75 -52
  13. package/cjs/core/Buttons/IdeasButton.js +31 -44
  14. package/cjs/core/Buttons/SplitButton.js +105 -87
  15. package/cjs/core/Carousel/Carousel.d.ts +13 -119
  16. package/cjs/core/Carousel/Carousel.js +80 -103
  17. package/cjs/core/Carousel/CarouselContext.js +12 -31
  18. package/cjs/core/Carousel/CarouselDot.js +32 -46
  19. package/cjs/core/Carousel/CarouselDotsList.js +162 -144
  20. package/cjs/core/Carousel/CarouselNavigation.d.ts +6 -112
  21. package/cjs/core/Carousel/CarouselNavigation.js +102 -83
  22. package/cjs/core/Carousel/CarouselSlide.js +54 -61
  23. package/cjs/core/Carousel/CarouselSlider.d.ts +1 -1
  24. package/cjs/core/Carousel/CarouselSlider.js +74 -80
  25. package/cjs/core/Checkbox/Checkbox.js +97 -74
  26. package/cjs/core/ColorPicker/ColorBuilder.d.ts +1 -1
  27. package/cjs/core/ColorPicker/ColorBuilder.js +300 -209
  28. package/cjs/core/ColorPicker/ColorInputPanel.js +431 -285
  29. package/cjs/core/ColorPicker/ColorPalette.js +60 -64
  30. package/cjs/core/ColorPicker/ColorPicker.js +101 -97
  31. package/cjs/core/ColorPicker/ColorPickerContext.d.ts +2 -2
  32. package/cjs/core/ColorPicker/ColorPickerContext.js +28 -37
  33. package/cjs/core/ColorPicker/ColorSwatch.js +51 -51
  34. package/cjs/core/ComboBox/ComboBox.d.ts +13 -3
  35. package/cjs/core/ComboBox/ComboBox.js +422 -323
  36. package/cjs/core/ComboBox/ComboBox.types-test.js +92 -0
  37. package/cjs/core/ComboBox/ComboBoxEndIcon.js +38 -43
  38. package/cjs/core/ComboBox/ComboBoxInput.js +214 -172
  39. package/cjs/core/ComboBox/ComboBoxInputContainer.js +42 -40
  40. package/cjs/core/ComboBox/ComboBoxMenu.d.ts +1 -1
  41. package/cjs/core/ComboBox/ComboBoxMenu.js +102 -76
  42. package/cjs/core/ComboBox/ComboBoxMenuItem.js +87 -49
  43. package/cjs/core/ComboBox/ComboBoxMultipleContainer.js +20 -35
  44. package/cjs/core/ComboBox/helpers.d.ts +4 -27
  45. package/cjs/core/ComboBox/helpers.js +24 -78
  46. package/cjs/core/DatePicker/DatePicker.js +599 -379
  47. package/cjs/core/Dialog/Dialog.js +89 -91
  48. package/cjs/core/Dialog/DialogBackdrop.js +57 -63
  49. package/cjs/core/Dialog/DialogButtonBar.js +12 -17
  50. package/cjs/core/Dialog/DialogContent.js +12 -16
  51. package/cjs/core/Dialog/DialogContext.js +22 -33
  52. package/cjs/core/Dialog/DialogDragContext.d.ts +1 -1
  53. package/cjs/core/Dialog/DialogDragContext.js +25 -36
  54. package/cjs/core/Dialog/DialogMain.js +192 -161
  55. package/cjs/core/Dialog/DialogTitleBar.js +73 -68
  56. package/cjs/core/Dialog/DialogTitleBarTitle.js +12 -14
  57. package/cjs/core/Divider/Divider.js +23 -41
  58. package/cjs/core/DropdownMenu/DropdownMenu.d.ts +1 -1
  59. package/cjs/core/DropdownMenu/DropdownMenu.js +74 -113
  60. package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +3 -3
  61. package/cjs/core/ExpandableBlock/ExpandableBlock.js +207 -177
  62. package/cjs/core/Fieldset/Fieldset.js +36 -55
  63. package/cjs/core/FileUpload/FileEmptyCard.js +47 -71
  64. package/cjs/core/FileUpload/FileUpload.js +97 -76
  65. package/cjs/core/FileUpload/FileUploadCard.d.ts +2 -2
  66. package/cjs/core/FileUpload/FileUploadCard.js +197 -163
  67. package/cjs/core/FileUpload/FileUploadTemplate.js +64 -54
  68. package/cjs/core/Flex/Flex.js +81 -146
  69. package/cjs/core/Footer/Footer.js +129 -113
  70. package/cjs/core/Footer/FooterItem.js +12 -12
  71. package/cjs/core/Footer/FooterList.js +12 -12
  72. package/cjs/core/Footer/FooterSeparator.js +13 -13
  73. package/cjs/core/Header/Header.js +87 -79
  74. package/cjs/core/Header/HeaderBasicButton.js +33 -43
  75. package/cjs/core/Header/HeaderBreadcrumbs.js +61 -54
  76. package/cjs/core/Header/HeaderButton.js +92 -59
  77. package/cjs/core/Header/HeaderDropdownButton.js +59 -50
  78. package/cjs/core/Header/HeaderLogo.js +54 -48
  79. package/cjs/core/Header/HeaderSplitButton.js +81 -51
  80. package/cjs/core/Icon/Icon.js +41 -62
  81. package/cjs/core/InformationPanel/InformationPanel.js +108 -98
  82. package/cjs/core/InformationPanel/InformationPanelBody.js +12 -12
  83. package/cjs/core/InformationPanel/InformationPanelContent.js +31 -61
  84. package/cjs/core/InformationPanel/InformationPanelHeader.js +52 -60
  85. package/cjs/core/InformationPanel/InformationPanelWrapper.js +14 -18
  86. package/cjs/core/Input/Input.js +27 -46
  87. package/cjs/core/InputGrid/InputGrid.js +172 -206
  88. package/cjs/core/InputGroup/InputGroup.js +93 -75
  89. package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +2 -2
  90. package/cjs/core/InputWithDecorations/InputWithDecorations.js +67 -82
  91. package/cjs/core/Label/Label.js +41 -48
  92. package/cjs/core/LabeledInput/LabeledInput.js +90 -58
  93. package/cjs/core/LabeledSelect/LabeledSelect.d.ts +3 -389
  94. package/cjs/core/LabeledSelect/LabeledSelect.js +74 -73
  95. package/cjs/core/LabeledSelect/LabeledSelect.types-test.js +106 -0
  96. package/cjs/core/LabeledTextarea/LabeledTextarea.js +19 -58
  97. package/cjs/core/LinkAction/LinkAction.d.ts +1 -1
  98. package/cjs/core/LinkAction/LinkAction.js +35 -63
  99. package/cjs/core/List/List.js +15 -10
  100. package/cjs/core/List/ListItem.d.ts +3 -3
  101. package/cjs/core/List/ListItem.js +47 -99
  102. package/cjs/core/Menu/Menu.d.ts +80 -6
  103. package/cjs/core/Menu/Menu.js +223 -94
  104. package/cjs/core/Menu/MenuDivider.d.ts +1 -1
  105. package/cjs/core/Menu/MenuDivider.js +13 -25
  106. package/cjs/core/Menu/MenuExtraContent.js +13 -30
  107. package/cjs/core/Menu/MenuItem.d.ts +0 -8
  108. package/cjs/core/Menu/MenuItem.js +142 -173
  109. package/cjs/core/Menu/MenuItemSkeleton.js +68 -52
  110. package/cjs/core/Modal/Modal.js +56 -59
  111. package/cjs/core/Modal/ModalButtonBar.js +12 -12
  112. package/cjs/core/Modal/ModalContent.js +12 -12
  113. package/cjs/core/NonIdealState/ErrorPage.js +232 -164
  114. package/cjs/core/NonIdealState/NonIdealState.js +86 -49
  115. package/cjs/core/NotificationMarker/NotificationMarker.js +40 -50
  116. package/cjs/core/Overlay/Overlay.d.ts +3 -3
  117. package/cjs/core/Overlay/Overlay.js +55 -75
  118. package/cjs/core/Popover/Popover.d.ts +23 -30
  119. package/cjs/core/Popover/Popover.js +279 -192
  120. package/cjs/core/ProgressIndicators/ProgressLinear.js +72 -69
  121. package/cjs/core/ProgressIndicators/ProgressRadial.js +71 -71
  122. package/cjs/core/Radio/Radio.js +66 -52
  123. package/cjs/core/RadioTiles/RadioTile.js +89 -49
  124. package/cjs/core/RadioTiles/RadioTileGroup.js +30 -44
  125. package/cjs/core/SearchBox/SearchBox.js +220 -167
  126. package/cjs/core/Select/Select.d.ts +1 -1
  127. package/cjs/core/Select/Select.js +473 -303
  128. package/cjs/core/Select/Select.types-test.js +119 -0
  129. package/cjs/core/Select/SelectTag.js +33 -43
  130. package/cjs/core/Select/SelectTagContainer.js +39 -46
  131. package/cjs/core/SideNavigation/SideNavigation.js +139 -72
  132. package/cjs/core/SideNavigation/SidenavButton.js +56 -46
  133. package/cjs/core/SideNavigation/SidenavSubmenu.d.ts +1 -1
  134. package/cjs/core/SideNavigation/SidenavSubmenu.js +34 -47
  135. package/cjs/core/SideNavigation/SidenavSubmenuHeader.js +42 -54
  136. package/cjs/core/SkipToContentLink/SkipToContentLink.js +29 -46
  137. package/cjs/core/Slider/Slider.js +380 -236
  138. package/cjs/core/Slider/Thumb.js +120 -92
  139. package/cjs/core/Slider/Track.js +99 -89
  140. package/cjs/core/StatusMessage/StatusMessage.js +47 -50
  141. package/cjs/core/Stepper/Stepper.js +93 -51
  142. package/cjs/core/Stepper/StepperStep.js +123 -66
  143. package/cjs/core/Stepper/WorkflowDiagram.js +42 -45
  144. package/cjs/core/Stepper/WorkflowDiagramStep.js +49 -41
  145. package/cjs/core/Surface/Surface.js +110 -109
  146. package/cjs/core/Table/SubRowExpander.js +45 -42
  147. package/cjs/core/Table/Table.js +826 -500
  148. package/cjs/core/Table/TableCell.js +110 -79
  149. package/cjs/core/Table/TablePaginator.js +330 -173
  150. package/cjs/core/Table/TableRowMemoized.d.ts +9 -29
  151. package/cjs/core/Table/TableRowMemoized.js +160 -102
  152. package/cjs/core/Table/actionHandlers/expandHandler.d.ts +1 -1
  153. package/cjs/core/Table/actionHandlers/expandHandler.js +20 -14
  154. package/cjs/core/Table/actionHandlers/filterHandler.d.ts +1 -1
  155. package/cjs/core/Table/actionHandlers/filterHandler.js +33 -19
  156. package/cjs/core/Table/actionHandlers/index.js +38 -18
  157. package/cjs/core/Table/actionHandlers/resizeHandler.d.ts +18 -18
  158. package/cjs/core/Table/actionHandlers/resizeHandler.js +33 -16
  159. package/cjs/core/Table/actionHandlers/selectHandler.d.ts +12 -12
  160. package/cjs/core/Table/actionHandlers/selectHandler.js +136 -116
  161. package/cjs/core/Table/cells/DefaultCell.js +92 -62
  162. package/cjs/core/Table/cells/EditableCell.js +91 -87
  163. package/cjs/core/Table/cells/index.js +21 -11
  164. package/cjs/core/Table/columns/actionColumn.d.ts +2 -2
  165. package/cjs/core/Table/columns/actionColumn.js +108 -113
  166. package/cjs/core/Table/columns/expanderColumn.d.ts +2 -2
  167. package/cjs/core/Table/columns/expanderColumn.js +63 -83
  168. package/cjs/core/Table/columns/index.js +31 -15
  169. package/cjs/core/Table/columns/selectionColumn.d.ts +2 -2
  170. package/cjs/core/Table/columns/selectionColumn.js +86 -77
  171. package/cjs/core/Table/filters/BaseFilter.js +28 -57
  172. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +134 -79
  173. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +130 -87
  174. package/cjs/core/Table/filters/FilterButtonBar.js +55 -51
  175. package/cjs/core/Table/filters/FilterToggle.js +74 -59
  176. package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +68 -63
  177. package/cjs/core/Table/filters/TextFilter/TextFilter.js +47 -55
  178. package/cjs/core/Table/filters/customFilterFunctions.js +25 -26
  179. package/cjs/core/Table/filters/defaultFilterFunctions.d.ts +7 -7
  180. package/cjs/core/Table/filters/defaultFilterFunctions.js +94 -83
  181. package/cjs/core/Table/filters/index.js +29 -15
  182. package/cjs/core/Table/filters/tableFilters.d.ts +2 -2
  183. package/cjs/core/Table/filters/tableFilters.js +30 -59
  184. package/cjs/core/Table/filters/types.js +4 -2
  185. package/cjs/core/Table/hooks/index.js +45 -23
  186. package/cjs/core/Table/hooks/useColumnDragAndDrop.js +108 -90
  187. package/cjs/core/Table/hooks/useExpanderCell.d.ts +1 -1
  188. package/cjs/core/Table/hooks/useExpanderCell.js +40 -52
  189. package/cjs/core/Table/hooks/useResizeColumns.js +362 -299
  190. package/cjs/core/Table/hooks/useScrollToRow.js +50 -65
  191. package/cjs/core/Table/hooks/useSelectionCell.d.ts +1 -1
  192. package/cjs/core/Table/hooks/useSelectionCell.js +25 -12
  193. package/cjs/core/Table/hooks/useStickyColumns.js +71 -70
  194. package/cjs/core/Table/hooks/useSubRowFiltering.js +99 -115
  195. package/cjs/core/Table/hooks/useSubRowSelection.js +39 -58
  196. package/cjs/core/Table/index.js +48 -22
  197. package/cjs/core/Table/utils.d.ts +1 -1
  198. package/cjs/core/Table/utils.js +79 -86
  199. package/cjs/core/Tabs/Tabs.d.ts +3 -3
  200. package/cjs/core/Tabs/Tabs.js +421 -358
  201. package/cjs/core/Tag/Tag.js +81 -56
  202. package/cjs/core/Tag/TagContainer.js +32 -47
  203. package/cjs/core/Textarea/Textarea.js +19 -39
  204. package/cjs/core/ThemeProvider/ThemeContext.d.ts +3 -3
  205. package/cjs/core/ThemeProvider/ThemeContext.js +12 -31
  206. package/cjs/core/ThemeProvider/ThemeProvider.js +233 -215
  207. package/cjs/core/Tile/Tile.d.ts +11 -80
  208. package/cjs/core/Tile/Tile.js +327 -336
  209. package/cjs/core/TimePicker/TimePicker.js +476 -269
  210. package/cjs/core/Toast/Toast.js +242 -149
  211. package/cjs/core/Toast/Toaster.js +150 -117
  212. package/cjs/core/ToggleSwitch/ToggleSwitch.js +77 -65
  213. package/cjs/core/Tooltip/Tooltip.d.ts +12 -11
  214. package/cjs/core/Tooltip/Tooltip.js +216 -175
  215. package/cjs/core/TransferList/TransferList.d.ts +4 -4
  216. package/cjs/core/TransferList/TransferList.js +191 -136
  217. package/cjs/core/Tree/Tree.js +214 -213
  218. package/cjs/core/Tree/TreeContext.js +26 -37
  219. package/cjs/core/Tree/TreeNode.d.ts +11 -4
  220. package/cjs/core/Tree/TreeNode.js +274 -154
  221. package/cjs/core/Tree/TreeNodeExpander.js +41 -45
  222. package/cjs/core/Typography/Anchor.js +42 -58
  223. package/cjs/core/Typography/Blockquote.js +27 -48
  224. package/cjs/core/Typography/Code.js +12 -14
  225. package/cjs/core/Typography/Kbd.js +49 -61
  226. package/cjs/core/Typography/Text.js +51 -59
  227. package/cjs/core/VisuallyHidden/VisuallyHidden.js +49 -56
  228. package/cjs/index.d.ts +1 -0
  229. package/cjs/index.js +481 -233
  230. package/cjs/react-table/react-table.js +4 -9
  231. package/cjs/react-table/react-table.types-test.js +653 -0
  232. package/cjs/styles.d.ts +2 -1
  233. package/cjs/styles.js +17 -1
  234. package/cjs/utils/color/ColorValue.js +465 -485
  235. package/cjs/utils/color/index.js +6 -21
  236. package/cjs/utils/components/AutoclearingHiddenLiveRegion.js +31 -48
  237. package/cjs/utils/components/Box.js +12 -14
  238. package/cjs/utils/components/ButtonBase.js +45 -51
  239. package/cjs/utils/components/FocusTrap.js +54 -69
  240. package/cjs/utils/components/InputContainer.js +68 -55
  241. package/cjs/utils/components/InputFlexContainer.d.ts +2 -2
  242. package/cjs/utils/components/InputFlexContainer.js +70 -36
  243. package/cjs/utils/components/InputWithIcon.js +13 -11
  244. package/cjs/utils/components/LineClamp.d.ts +1 -1
  245. package/cjs/utils/components/LineClamp.js +35 -40
  246. package/cjs/utils/components/MiddleTextTruncation.js +39 -65
  247. package/cjs/utils/components/Portal.d.ts +1 -1
  248. package/cjs/utils/components/Portal.js +43 -59
  249. package/cjs/utils/components/Resizer.js +239 -192
  250. package/cjs/utils/components/ShadowRoot.js +92 -108
  251. package/cjs/utils/components/VirtualScroll.js +314 -292
  252. package/cjs/utils/components/WithCSSTransition.d.ts +1 -1
  253. package/cjs/utils/components/WithCSSTransition.js +56 -62
  254. package/cjs/utils/components/index.js +19 -34
  255. package/cjs/utils/functions/colors.d.ts +1 -1
  256. package/cjs/utils/functions/colors.js +43 -35
  257. package/cjs/utils/functions/date.js +18 -19
  258. package/cjs/utils/functions/dev.js +37 -34
  259. package/cjs/utils/functions/dom.d.ts +1 -1
  260. package/cjs/utils/functions/dom.js +46 -44
  261. package/cjs/utils/functions/focusable.d.ts +23 -0
  262. package/cjs/utils/functions/focusable.js +91 -30
  263. package/cjs/utils/functions/import.js +29 -32
  264. package/cjs/utils/functions/index.js +15 -30
  265. package/cjs/utils/functions/numbers.js +31 -31
  266. package/cjs/utils/functions/polymorphic.d.ts +3 -180
  267. package/cjs/utils/functions/polymorphic.js +61 -95
  268. package/cjs/utils/functions/react.js +29 -56
  269. package/cjs/utils/functions/supports.js +13 -13
  270. package/cjs/utils/hooks/index.js +20 -35
  271. package/cjs/utils/hooks/useContainerWidth.js +34 -61
  272. package/cjs/utils/hooks/useControlledState.d.ts +1 -1
  273. package/cjs/utils/hooks/useControlledState.js +30 -50
  274. package/cjs/utils/hooks/useDragAndDrop.js +122 -122
  275. package/cjs/utils/hooks/useEventListener.js +25 -58
  276. package/cjs/utils/hooks/useGlobals.d.ts +3 -3
  277. package/cjs/utils/hooks/useGlobals.js +49 -65
  278. package/cjs/utils/hooks/useId.js +18 -42
  279. package/cjs/utils/hooks/useIntersection.js +41 -63
  280. package/cjs/utils/hooks/useIsClient.js +16 -36
  281. package/cjs/utils/hooks/useIsomorphicLayoutEffect.js +13 -39
  282. package/cjs/utils/hooks/useLatestRef.js +16 -43
  283. package/cjs/utils/hooks/useMediaQuery.js +30 -43
  284. package/cjs/utils/hooks/useMergedRefs.d.ts +2 -2
  285. package/cjs/utils/hooks/useMergedRefs.js +30 -50
  286. package/cjs/utils/hooks/useOverflow.d.ts +1 -1
  287. package/cjs/utils/hooks/useOverflow.js +70 -107
  288. package/cjs/utils/hooks/useResizeObserver.js +35 -67
  289. package/cjs/utils/hooks/useSafeContext.js +16 -40
  290. package/cjs/utils/hooks/useSyncExternalStore.js +42 -65
  291. package/cjs/utils/icons/StatusIconMap.d.ts +4 -5
  292. package/cjs/utils/icons/StatusIconMap.js +36 -39
  293. package/cjs/utils/icons/Svg.js +15 -12
  294. package/cjs/utils/icons/SvgCalendar.d.ts +1 -1
  295. package/cjs/utils/icons/SvgCalendar.js +19 -34
  296. package/cjs/utils/icons/SvgCaretDownSmall.d.ts +1 -1
  297. package/cjs/utils/icons/SvgCaretDownSmall.js +19 -34
  298. package/cjs/utils/icons/SvgCaretRightSmall.d.ts +1 -1
  299. package/cjs/utils/icons/SvgCaretRightSmall.js +19 -34
  300. package/cjs/utils/icons/SvgCaretUpSmall.d.ts +1 -1
  301. package/cjs/utils/icons/SvgCaretUpSmall.js +19 -34
  302. package/cjs/utils/icons/SvgCheckmark.d.ts +1 -1
  303. package/cjs/utils/icons/SvgCheckmark.js +19 -34
  304. package/cjs/utils/icons/SvgCheckmarkSmall.d.ts +1 -1
  305. package/cjs/utils/icons/SvgCheckmarkSmall.js +19 -34
  306. package/cjs/utils/icons/SvgChevronLeft.d.ts +1 -1
  307. package/cjs/utils/icons/SvgChevronLeft.js +19 -34
  308. package/cjs/utils/icons/SvgChevronLeftDouble.d.ts +1 -1
  309. package/cjs/utils/icons/SvgChevronLeftDouble.js +19 -34
  310. package/cjs/utils/icons/SvgChevronRight.d.ts +1 -1
  311. package/cjs/utils/icons/SvgChevronRight.js +19 -34
  312. package/cjs/utils/icons/SvgChevronRightDouble.d.ts +1 -1
  313. package/cjs/utils/icons/SvgChevronRightDouble.js +19 -34
  314. package/cjs/utils/icons/SvgChevronRightSmall.d.ts +1 -1
  315. package/cjs/utils/icons/SvgChevronRightSmall.js +19 -34
  316. package/cjs/utils/icons/SvgClose.d.ts +1 -1
  317. package/cjs/utils/icons/SvgClose.js +19 -34
  318. package/cjs/utils/icons/SvgCloseSmall.d.ts +1 -1
  319. package/cjs/utils/icons/SvgCloseSmall.js +19 -34
  320. package/cjs/utils/icons/SvgColumnManager.d.ts +1 -1
  321. package/cjs/utils/icons/SvgColumnManager.js +19 -34
  322. package/cjs/utils/icons/SvgDocument.d.ts +1 -1
  323. package/cjs/utils/icons/SvgDocument.js +19 -34
  324. package/cjs/utils/icons/SvgFilter.d.ts +1 -1
  325. package/cjs/utils/icons/SvgFilter.js +19 -34
  326. package/cjs/utils/icons/SvgFilterHollow.d.ts +1 -1
  327. package/cjs/utils/icons/SvgFilterHollow.js +19 -34
  328. package/cjs/utils/icons/SvgImportantSmall.d.ts +1 -1
  329. package/cjs/utils/icons/SvgImportantSmall.js +19 -34
  330. package/cjs/utils/icons/SvgInfoCircular.d.ts +1 -1
  331. package/cjs/utils/icons/SvgInfoCircular.js +19 -34
  332. package/cjs/utils/icons/SvgMore.d.ts +1 -1
  333. package/cjs/utils/icons/SvgMore.js +19 -34
  334. package/cjs/utils/icons/SvgMoreVertical.d.ts +1 -1
  335. package/cjs/utils/icons/SvgMoreVertical.js +19 -34
  336. package/cjs/utils/icons/SvgNew.d.ts +1 -1
  337. package/cjs/utils/icons/SvgNew.js +19 -34
  338. package/cjs/utils/icons/SvgSearch.d.ts +1 -1
  339. package/cjs/utils/icons/SvgSearch.js +19 -34
  340. package/cjs/utils/icons/SvgSmileyHappy.d.ts +1 -1
  341. package/cjs/utils/icons/SvgSmileyHappy.js +19 -34
  342. package/cjs/utils/icons/SvgSortDown.d.ts +1 -1
  343. package/cjs/utils/icons/SvgSortDown.js +19 -34
  344. package/cjs/utils/icons/SvgSortUp.d.ts +1 -1
  345. package/cjs/utils/icons/SvgSortUp.js +19 -34
  346. package/cjs/utils/icons/SvgStatusError.d.ts +1 -1
  347. package/cjs/utils/icons/SvgStatusError.js +19 -34
  348. package/cjs/utils/icons/SvgStatusSuccess.d.ts +1 -1
  349. package/cjs/utils/icons/SvgStatusSuccess.js +19 -34
  350. package/cjs/utils/icons/SvgStatusWarning.d.ts +1 -1
  351. package/cjs/utils/icons/SvgStatusWarning.js +19 -34
  352. package/cjs/utils/icons/SvgSwap.d.ts +1 -1
  353. package/cjs/utils/icons/SvgSwap.js +19 -34
  354. package/cjs/utils/icons/SvgUpload.d.ts +1 -1
  355. package/cjs/utils/icons/SvgUpload.js +19 -34
  356. package/cjs/utils/icons/index.js +37 -52
  357. package/cjs/utils/index.js +13 -28
  358. package/cjs/utils/meta.d.ts +7 -0
  359. package/cjs/utils/meta.js +16 -0
  360. package/cjs/utils/props.js +4 -2
  361. package/cjs/utils/providers/HydrationProvider.js +55 -68
  362. package/cjs/utils/providers/ScopeProvider.js +60 -71
  363. package/cjs/utils/providers/index.js +7 -22
  364. package/cjs/utils/types.js +4 -2
  365. package/esm/core/Alert/Alert.d.ts +3 -7
  366. package/esm/core/Alert/Alert.js +108 -80
  367. package/esm/core/Avatar/Avatar.js +45 -36
  368. package/esm/core/AvatarGroup/AvatarGroup.js +58 -51
  369. package/esm/core/Backdrop/Backdrop.js +12 -6
  370. package/esm/core/Badge/Badge.js +32 -33
  371. package/esm/core/Breadcrumbs/Breadcrumbs.js +150 -93
  372. package/esm/core/ButtonGroup/ButtonGroup.js +129 -72
  373. package/esm/core/Buttons/Button.js +72 -22
  374. package/esm/core/Buttons/DropdownButton.js +41 -20
  375. package/esm/core/Buttons/IconButton.js +50 -17
  376. package/esm/core/Buttons/IdeasButton.js +15 -11
  377. package/esm/core/Buttons/SplitButton.js +93 -53
  378. package/esm/core/Carousel/Carousel.d.ts +13 -119
  379. package/esm/core/Carousel/Carousel.js +58 -64
  380. package/esm/core/Carousel/CarouselContext.js +0 -4
  381. package/esm/core/Carousel/CarouselDot.js +17 -14
  382. package/esm/core/Carousel/CarouselDotsList.js +147 -111
  383. package/esm/core/Carousel/CarouselNavigation.d.ts +6 -112
  384. package/esm/core/Carousel/CarouselNavigation.js +80 -44
  385. package/esm/core/Carousel/CarouselSlide.js +41 -29
  386. package/esm/core/Carousel/CarouselSlider.d.ts +1 -1
  387. package/esm/core/Carousel/CarouselSlider.js +64 -48
  388. package/esm/core/Checkbox/Checkbox.js +78 -41
  389. package/esm/core/ColorPicker/ColorBuilder.d.ts +1 -1
  390. package/esm/core/ColorPicker/ColorBuilder.js +287 -176
  391. package/esm/core/ColorPicker/ColorInputPanel.js +413 -250
  392. package/esm/core/ColorPicker/ColorPalette.js +40 -30
  393. package/esm/core/ColorPicker/ColorPicker.js +75 -63
  394. package/esm/core/ColorPicker/ColorPickerContext.d.ts +2 -2
  395. package/esm/core/ColorPicker/ColorPickerContext.js +7 -9
  396. package/esm/core/ColorPicker/ColorSwatch.js +31 -18
  397. package/esm/core/ComboBox/ComboBox.d.ts +13 -3
  398. package/esm/core/ComboBox/ComboBox.js +407 -286
  399. package/esm/core/ComboBox/ComboBox.types-test.js +88 -0
  400. package/esm/core/ComboBox/ComboBoxEndIcon.js +21 -9
  401. package/esm/core/ComboBox/ComboBoxInput.js +193 -142
  402. package/esm/core/ComboBox/ComboBoxInputContainer.js +33 -10
  403. package/esm/core/ComboBox/ComboBoxMenu.d.ts +1 -1
  404. package/esm/core/ComboBox/ComboBoxMenu.js +85 -43
  405. package/esm/core/ComboBox/ComboBoxMenuItem.js +74 -19
  406. package/esm/core/ComboBox/ComboBoxMultipleContainer.js +6 -6
  407. package/esm/core/ComboBox/helpers.d.ts +4 -27
  408. package/esm/core/ComboBox/helpers.js +0 -47
  409. package/esm/core/DatePicker/DatePicker.js +564 -345
  410. package/esm/core/Dialog/Dialog.js +66 -51
  411. package/esm/core/Dialog/DialogBackdrop.js +40 -29
  412. package/esm/core/Dialog/DialogButtonBar.js +0 -12
  413. package/esm/core/Dialog/DialogContent.js +0 -11
  414. package/esm/core/Dialog/DialogContext.js +1 -5
  415. package/esm/core/Dialog/DialogDragContext.d.ts +1 -1
  416. package/esm/core/Dialog/DialogDragContext.js +4 -8
  417. package/esm/core/Dialog/DialogMain.js +182 -126
  418. package/esm/core/Dialog/DialogTitleBar.js +46 -31
  419. package/esm/core/Dialog/DialogTitleBarTitle.js +0 -9
  420. package/esm/core/Divider/Divider.js +8 -9
  421. package/esm/core/DropdownMenu/DropdownMenu.d.ts +1 -1
  422. package/esm/core/DropdownMenu/DropdownMenu.js +60 -84
  423. package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +3 -3
  424. package/esm/core/ExpandableBlock/ExpandableBlock.js +173 -133
  425. package/esm/core/Fieldset/Fieldset.js +21 -23
  426. package/esm/core/FileUpload/FileEmptyCard.js +23 -34
  427. package/esm/core/FileUpload/FileUpload.js +67 -44
  428. package/esm/core/FileUpload/FileUploadCard.d.ts +2 -2
  429. package/esm/core/FileUpload/FileUploadCard.js +162 -118
  430. package/esm/core/FileUpload/FileUploadTemplate.js +45 -21
  431. package/esm/core/Flex/Flex.js +63 -111
  432. package/esm/core/Footer/Footer.js +96 -73
  433. package/esm/core/Footer/FooterItem.js +0 -7
  434. package/esm/core/Footer/FooterList.js +0 -7
  435. package/esm/core/Footer/FooterSeparator.js +1 -8
  436. package/esm/core/Header/Header.js +70 -45
  437. package/esm/core/Header/HeaderBasicButton.js +15 -11
  438. package/esm/core/Header/HeaderBreadcrumbs.js +39 -22
  439. package/esm/core/Header/HeaderButton.js +70 -28
  440. package/esm/core/Header/HeaderDropdownButton.js +44 -17
  441. package/esm/core/Header/HeaderLogo.js +39 -16
  442. package/esm/core/Header/HeaderSplitButton.js +67 -18
  443. package/esm/core/Icon/Icon.js +26 -30
  444. package/esm/core/InformationPanel/InformationPanel.js +93 -66
  445. package/esm/core/InformationPanel/InformationPanelBody.js +0 -7
  446. package/esm/core/InformationPanel/InformationPanelContent.js +19 -30
  447. package/esm/core/InformationPanel/InformationPanelHeader.js +39 -28
  448. package/esm/core/InformationPanel/InformationPanelWrapper.js +3 -14
  449. package/esm/core/Input/Input.js +12 -14
  450. package/esm/core/InputGrid/InputGrid.js +145 -165
  451. package/esm/core/InputGroup/InputGroup.js +72 -40
  452. package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +2 -2
  453. package/esm/core/InputWithDecorations/InputWithDecorations.js +58 -49
  454. package/esm/core/Label/Label.js +26 -16
  455. package/esm/core/LabeledInput/LabeledInput.js +67 -21
  456. package/esm/core/LabeledSelect/LabeledSelect.d.ts +3 -389
  457. package/esm/core/LabeledSelect/LabeledSelect.js +58 -43
  458. package/esm/core/LabeledSelect/LabeledSelect.types-test.js +102 -0
  459. package/esm/core/LabeledTextarea/LabeledTextarea.js +6 -32
  460. package/esm/core/LinkAction/LinkAction.d.ts +1 -1
  461. package/esm/core/LinkAction/LinkAction.js +7 -27
  462. package/esm/core/List/List.js +3 -5
  463. package/esm/core/List/ListItem.d.ts +3 -3
  464. package/esm/core/List/ListItem.js +24 -61
  465. package/esm/core/Menu/Menu.d.ts +80 -6
  466. package/esm/core/Menu/Menu.js +211 -61
  467. package/esm/core/Menu/MenuDivider.d.ts +1 -1
  468. package/esm/core/Menu/MenuDivider.js +1 -20
  469. package/esm/core/Menu/MenuExtraContent.js +1 -25
  470. package/esm/core/Menu/MenuItem.d.ts +0 -8
  471. package/esm/core/Menu/MenuItem.js +132 -145
  472. package/esm/core/Menu/MenuItemSkeleton.js +48 -19
  473. package/esm/core/Modal/Modal.js +43 -31
  474. package/esm/core/Modal/ModalButtonBar.js +0 -7
  475. package/esm/core/Modal/ModalContent.js +0 -7
  476. package/esm/core/NonIdealState/ErrorPage.js +181 -134
  477. package/esm/core/NonIdealState/NonIdealState.js +65 -17
  478. package/esm/core/NotificationMarker/NotificationMarker.js +25 -18
  479. package/esm/core/Overlay/Overlay.d.ts +3 -3
  480. package/esm/core/Overlay/Overlay.js +36 -63
  481. package/esm/core/Popover/Popover.d.ts +23 -30
  482. package/esm/core/Popover/Popover.js +276 -157
  483. package/esm/core/ProgressIndicators/ProgressLinear.js +52 -36
  484. package/esm/core/ProgressIndicators/ProgressRadial.js +54 -39
  485. package/esm/core/Radio/Radio.js +48 -20
  486. package/esm/core/RadioTiles/RadioTile.js +62 -17
  487. package/esm/core/RadioTiles/RadioTileGroup.js +16 -15
  488. package/esm/core/SearchBox/SearchBox.js +203 -128
  489. package/esm/core/Select/Select.d.ts +1 -1
  490. package/esm/core/Select/Select.js +442 -260
  491. package/esm/core/Select/Select.types-test.js +115 -0
  492. package/esm/core/Select/SelectTag.js +18 -11
  493. package/esm/core/Select/SelectTagContainer.js +20 -13
  494. package/esm/core/SideNavigation/SideNavigation.js +104 -39
  495. package/esm/core/SideNavigation/SidenavButton.js +38 -12
  496. package/esm/core/SideNavigation/SidenavSubmenu.d.ts +1 -1
  497. package/esm/core/SideNavigation/SidenavSubmenu.js +16 -15
  498. package/esm/core/SideNavigation/SidenavSubmenuHeader.js +24 -22
  499. package/esm/core/SkipToContentLink/SkipToContentLink.js +11 -14
  500. package/esm/core/Slider/Slider.js +339 -202
  501. package/esm/core/Slider/Thumb.js +105 -59
  502. package/esm/core/Slider/Track.js +82 -57
  503. package/esm/core/StatusMessage/StatusMessage.js +31 -17
  504. package/esm/core/Stepper/Stepper.js +74 -18
  505. package/esm/core/Stepper/StepperStep.js +101 -33
  506. package/esm/core/Stepper/WorkflowDiagram.js +27 -13
  507. package/esm/core/Stepper/WorkflowDiagramStep.js +28 -8
  508. package/esm/core/Surface/Surface.js +92 -74
  509. package/esm/core/Table/SubRowExpander.js +32 -13
  510. package/esm/core/Table/Table.js +828 -461
  511. package/esm/core/Table/TableCell.js +85 -43
  512. package/esm/core/Table/TablePaginator.js +320 -137
  513. package/esm/core/Table/TableRowMemoized.d.ts +9 -29
  514. package/esm/core/Table/TableRowMemoized.js +135 -70
  515. package/esm/core/Table/actionHandlers/expandHandler.d.ts +1 -1
  516. package/esm/core/Table/actionHandlers/expandHandler.js +10 -10
  517. package/esm/core/Table/actionHandlers/filterHandler.d.ts +1 -1
  518. package/esm/core/Table/actionHandlers/filterHandler.js +23 -15
  519. package/esm/core/Table/actionHandlers/index.js +5 -5
  520. package/esm/core/Table/actionHandlers/resizeHandler.d.ts +18 -18
  521. package/esm/core/Table/actionHandlers/resizeHandler.js +14 -11
  522. package/esm/core/Table/actionHandlers/selectHandler.d.ts +12 -12
  523. package/esm/core/Table/actionHandlers/selectHandler.js +114 -110
  524. package/esm/core/Table/cells/DefaultCell.js +77 -29
  525. package/esm/core/Table/cells/EditableCell.js +77 -55
  526. package/esm/core/Table/cells/index.js +0 -4
  527. package/esm/core/Table/columns/actionColumn.d.ts +2 -2
  528. package/esm/core/Table/columns/actionColumn.js +89 -78
  529. package/esm/core/Table/columns/expanderColumn.d.ts +2 -2
  530. package/esm/core/Table/columns/expanderColumn.js +39 -52
  531. package/esm/core/Table/columns/index.js +0 -4
  532. package/esm/core/Table/columns/selectionColumn.d.ts +2 -2
  533. package/esm/core/Table/columns/selectionColumn.js +63 -47
  534. package/esm/core/Table/filters/BaseFilter.js +14 -25
  535. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +116 -46
  536. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +115 -56
  537. package/esm/core/Table/filters/FilterButtonBar.js +40 -18
  538. package/esm/core/Table/filters/FilterToggle.js +60 -26
  539. package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +53 -32
  540. package/esm/core/Table/filters/TextFilter/TextFilter.js +32 -24
  541. package/esm/core/Table/filters/customFilterFunctions.js +14 -22
  542. package/esm/core/Table/filters/defaultFilterFunctions.d.ts +7 -7
  543. package/esm/core/Table/filters/defaultFilterFunctions.js +83 -79
  544. package/esm/core/Table/filters/index.js +0 -4
  545. package/esm/core/Table/filters/tableFilters.d.ts +2 -2
  546. package/esm/core/Table/filters/tableFilters.js +15 -29
  547. package/esm/core/Table/hooks/index.js +0 -4
  548. package/esm/core/Table/hooks/useColumnDragAndDrop.js +89 -82
  549. package/esm/core/Table/hooks/useExpanderCell.d.ts +1 -1
  550. package/esm/core/Table/hooks/useExpanderCell.js +26 -24
  551. package/esm/core/Table/hooks/useResizeColumns.js +346 -292
  552. package/esm/core/Table/hooks/useScrollToRow.js +39 -38
  553. package/esm/core/Table/hooks/useSelectionCell.d.ts +1 -1
  554. package/esm/core/Table/hooks/useSelectionCell.js +14 -7
  555. package/esm/core/Table/hooks/useStickyColumns.js +58 -63
  556. package/esm/core/Table/hooks/useSubRowFiltering.js +87 -87
  557. package/esm/core/Table/hooks/useSubRowSelection.js +28 -31
  558. package/esm/core/Table/index.js +5 -5
  559. package/esm/core/Table/utils.d.ts +1 -1
  560. package/esm/core/Table/utils.js +55 -59
  561. package/esm/core/Tabs/Tabs.d.ts +3 -3
  562. package/esm/core/Tabs/Tabs.js +385 -315
  563. package/esm/core/Tag/Tag.js +54 -22
  564. package/esm/core/Tag/TagContainer.js +17 -15
  565. package/esm/core/Textarea/Textarea.js +6 -11
  566. package/esm/core/ThemeProvider/ThemeContext.d.ts +3 -3
  567. package/esm/core/ThemeProvider/ThemeContext.js +0 -4
  568. package/esm/core/ThemeProvider/ThemeProvider.js +210 -174
  569. package/esm/core/Tile/Tile.d.ts +11 -80
  570. package/esm/core/Tile/Tile.js +283 -283
  571. package/esm/core/TimePicker/TimePicker.js +461 -237
  572. package/esm/core/Toast/Toast.js +209 -114
  573. package/esm/core/Toast/Toaster.js +114 -79
  574. package/esm/core/ToggleSwitch/ToggleSwitch.js +59 -33
  575. package/esm/core/Tooltip/Tooltip.d.ts +12 -11
  576. package/esm/core/Tooltip/Tooltip.js +221 -144
  577. package/esm/core/TransferList/TransferList.d.ts +4 -4
  578. package/esm/core/TransferList/TransferList.js +152 -118
  579. package/esm/core/Tree/Tree.js +202 -178
  580. package/esm/core/Tree/TreeContext.js +5 -9
  581. package/esm/core/Tree/TreeNode.d.ts +11 -4
  582. package/esm/core/Tree/TreeNode.js +245 -121
  583. package/esm/core/Tree/TreeNodeExpander.js +23 -11
  584. package/esm/core/Typography/Anchor.js +21 -24
  585. package/esm/core/Typography/Blockquote.js +12 -16
  586. package/esm/core/Typography/Code.js +0 -9
  587. package/esm/core/Typography/Kbd.js +24 -28
  588. package/esm/core/Typography/Text.js +26 -26
  589. package/esm/core/VisuallyHidden/VisuallyHidden.js +34 -24
  590. package/esm/index.d.ts +1 -0
  591. package/esm/index.js +22 -7
  592. package/esm/react-table/react-table.js +0 -7
  593. package/esm/react-table/react-table.types-test.js +658 -0
  594. package/esm/styles.d.ts +2 -1
  595. package/esm/styles.js +8 -9
  596. package/esm/utils/color/ColorValue.js +436 -477
  597. package/esm/utils/color/index.js +0 -4
  598. package/esm/utils/components/AutoclearingHiddenLiveRegion.js +15 -19
  599. package/esm/utils/components/Box.js +0 -9
  600. package/esm/utils/components/ButtonBase.js +28 -17
  601. package/esm/utils/components/FocusTrap.js +41 -40
  602. package/esm/utils/components/InputContainer.js +51 -21
  603. package/esm/utils/components/InputFlexContainer.d.ts +2 -2
  604. package/esm/utils/components/InputFlexContainer.js +30 -23
  605. package/esm/utils/components/InputWithIcon.js +0 -5
  606. package/esm/utils/components/LineClamp.d.ts +1 -1
  607. package/esm/utils/components/LineClamp.js +21 -11
  608. package/esm/utils/components/MiddleTextTruncation.js +27 -37
  609. package/esm/utils/components/Portal.d.ts +1 -1
  610. package/esm/utils/components/Portal.js +13 -31
  611. package/esm/utils/components/Resizer.js +231 -165
  612. package/esm/utils/components/ShadowRoot.js +78 -78
  613. package/esm/utils/components/VirtualScroll.js +296 -263
  614. package/esm/utils/components/WithCSSTransition.d.ts +1 -1
  615. package/esm/utils/components/WithCSSTransition.js +44 -31
  616. package/esm/utils/components/index.js +0 -4
  617. package/esm/utils/functions/colors.d.ts +1 -1
  618. package/esm/utils/functions/colors.js +19 -28
  619. package/esm/utils/functions/date.js +8 -15
  620. package/esm/utils/functions/dev.js +15 -28
  621. package/esm/utils/functions/dom.d.ts +1 -1
  622. package/esm/utils/functions/dom.js +18 -36
  623. package/esm/utils/functions/focusable.d.ts +23 -0
  624. package/esm/utils/functions/focusable.js +68 -25
  625. package/esm/utils/functions/import.js +19 -28
  626. package/esm/utils/functions/index.js +0 -4
  627. package/esm/utils/functions/numbers.js +9 -25
  628. package/esm/utils/functions/polymorphic.d.ts +3 -180
  629. package/esm/utils/functions/polymorphic.js +42 -63
  630. package/esm/utils/functions/react.js +17 -28
  631. package/esm/utils/functions/supports.js +2 -8
  632. package/esm/utils/hooks/index.js +0 -4
  633. package/esm/utils/hooks/useContainerWidth.js +16 -32
  634. package/esm/utils/hooks/useControlledState.d.ts +1 -1
  635. package/esm/utils/hooks/useControlledState.js +19 -23
  636. package/esm/utils/hooks/useDragAndDrop.js +109 -93
  637. package/esm/utils/hooks/useEventListener.js +14 -31
  638. package/esm/utils/hooks/useGlobals.d.ts +3 -3
  639. package/esm/utils/hooks/useGlobals.js +27 -35
  640. package/esm/utils/hooks/useId.js +4 -13
  641. package/esm/utils/hooks/useIntersection.js +29 -35
  642. package/esm/utils/hooks/useIsClient.js +5 -9
  643. package/esm/utils/hooks/useIsomorphicLayoutEffect.js +2 -12
  644. package/esm/utils/hooks/useLatestRef.js +5 -16
  645. package/esm/utils/hooks/useMediaQuery.js +14 -15
  646. package/esm/utils/hooks/useMergedRefs.d.ts +2 -2
  647. package/esm/utils/hooks/useMergedRefs.js +10 -22
  648. package/esm/utils/hooks/useOverflow.d.ts +1 -1
  649. package/esm/utils/hooks/useOverflow.js +59 -78
  650. package/esm/utils/hooks/useResizeObserver.js +23 -39
  651. package/esm/utils/hooks/useSafeContext.js +5 -13
  652. package/esm/utils/hooks/useSyncExternalStore.js +31 -39
  653. package/esm/utils/icons/StatusIconMap.d.ts +4 -5
  654. package/esm/utils/icons/StatusIconMap.js +20 -8
  655. package/esm/utils/icons/Svg.js +3 -7
  656. package/esm/utils/icons/SvgCalendar.d.ts +1 -1
  657. package/esm/utils/icons/SvgCalendar.js +7 -6
  658. package/esm/utils/icons/SvgCaretDownSmall.d.ts +1 -1
  659. package/esm/utils/icons/SvgCaretDownSmall.js +7 -6
  660. package/esm/utils/icons/SvgCaretRightSmall.d.ts +1 -1
  661. package/esm/utils/icons/SvgCaretRightSmall.js +7 -6
  662. package/esm/utils/icons/SvgCaretUpSmall.d.ts +1 -1
  663. package/esm/utils/icons/SvgCaretUpSmall.js +7 -6
  664. package/esm/utils/icons/SvgCheckmark.d.ts +1 -1
  665. package/esm/utils/icons/SvgCheckmark.js +7 -6
  666. package/esm/utils/icons/SvgCheckmarkSmall.d.ts +1 -1
  667. package/esm/utils/icons/SvgCheckmarkSmall.js +7 -6
  668. package/esm/utils/icons/SvgChevronLeft.d.ts +1 -1
  669. package/esm/utils/icons/SvgChevronLeft.js +7 -6
  670. package/esm/utils/icons/SvgChevronLeftDouble.d.ts +1 -1
  671. package/esm/utils/icons/SvgChevronLeftDouble.js +7 -6
  672. package/esm/utils/icons/SvgChevronRight.d.ts +1 -1
  673. package/esm/utils/icons/SvgChevronRight.js +7 -6
  674. package/esm/utils/icons/SvgChevronRightDouble.d.ts +1 -1
  675. package/esm/utils/icons/SvgChevronRightDouble.js +7 -6
  676. package/esm/utils/icons/SvgChevronRightSmall.d.ts +1 -1
  677. package/esm/utils/icons/SvgChevronRightSmall.js +7 -6
  678. package/esm/utils/icons/SvgClose.d.ts +1 -1
  679. package/esm/utils/icons/SvgClose.js +7 -6
  680. package/esm/utils/icons/SvgCloseSmall.d.ts +1 -1
  681. package/esm/utils/icons/SvgCloseSmall.js +7 -6
  682. package/esm/utils/icons/SvgColumnManager.d.ts +1 -1
  683. package/esm/utils/icons/SvgColumnManager.js +7 -6
  684. package/esm/utils/icons/SvgDocument.d.ts +1 -1
  685. package/esm/utils/icons/SvgDocument.js +7 -6
  686. package/esm/utils/icons/SvgFilter.d.ts +1 -1
  687. package/esm/utils/icons/SvgFilter.js +7 -6
  688. package/esm/utils/icons/SvgFilterHollow.d.ts +1 -1
  689. package/esm/utils/icons/SvgFilterHollow.js +7 -6
  690. package/esm/utils/icons/SvgImportantSmall.d.ts +1 -1
  691. package/esm/utils/icons/SvgImportantSmall.js +7 -6
  692. package/esm/utils/icons/SvgInfoCircular.d.ts +1 -1
  693. package/esm/utils/icons/SvgInfoCircular.js +7 -6
  694. package/esm/utils/icons/SvgMore.d.ts +1 -1
  695. package/esm/utils/icons/SvgMore.js +7 -6
  696. package/esm/utils/icons/SvgMoreVertical.d.ts +1 -1
  697. package/esm/utils/icons/SvgMoreVertical.js +7 -6
  698. package/esm/utils/icons/SvgNew.d.ts +1 -1
  699. package/esm/utils/icons/SvgNew.js +7 -6
  700. package/esm/utils/icons/SvgSearch.d.ts +1 -1
  701. package/esm/utils/icons/SvgSearch.js +7 -6
  702. package/esm/utils/icons/SvgSmileyHappy.d.ts +1 -1
  703. package/esm/utils/icons/SvgSmileyHappy.js +7 -6
  704. package/esm/utils/icons/SvgSortDown.d.ts +1 -1
  705. package/esm/utils/icons/SvgSortDown.js +7 -6
  706. package/esm/utils/icons/SvgSortUp.d.ts +1 -1
  707. package/esm/utils/icons/SvgSortUp.js +7 -6
  708. package/esm/utils/icons/SvgStatusError.d.ts +1 -1
  709. package/esm/utils/icons/SvgStatusError.js +7 -6
  710. package/esm/utils/icons/SvgStatusSuccess.d.ts +1 -1
  711. package/esm/utils/icons/SvgStatusSuccess.js +7 -6
  712. package/esm/utils/icons/SvgStatusWarning.d.ts +1 -1
  713. package/esm/utils/icons/SvgStatusWarning.js +7 -6
  714. package/esm/utils/icons/SvgSwap.d.ts +1 -1
  715. package/esm/utils/icons/SvgSwap.js +7 -6
  716. package/esm/utils/icons/SvgUpload.d.ts +1 -1
  717. package/esm/utils/icons/SvgUpload.js +7 -6
  718. package/esm/utils/icons/index.js +0 -4
  719. package/esm/utils/index.js +0 -4
  720. package/esm/utils/meta.d.ts +7 -0
  721. package/esm/utils/meta.js +6 -0
  722. package/esm/utils/providers/HydrationProvider.js +33 -38
  723. package/esm/utils/providers/ScopeProvider.js +35 -40
  724. package/esm/utils/providers/index.js +0 -4
  725. package/package.json +22 -16
  726. package/styles.css +1 -1
  727. package/react-table.d.ts +0 -750
@@ -1,369 +1,588 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
1
  import cx from 'classnames';
6
2
  import * as React from 'react';
7
- import { SvgChevronLeft, SvgChevronRight, SvgChevronLeftDouble, SvgChevronRightDouble, isBefore, Box, useId, } from '../../utils/index.js';
3
+ import {
4
+ SvgChevronLeft,
5
+ SvgChevronRight,
6
+ SvgChevronLeftDouble,
7
+ SvgChevronRightDouble,
8
+ isBefore,
9
+ Box,
10
+ useId,
11
+ } from '../../utils/index.js';
8
12
  import { IconButton } from '../Buttons/IconButton.js';
9
13
  import { TimePicker } from '../TimePicker/TimePicker.js';
10
14
  const isSameDay = (a, b) => {
11
- return (a &&
12
- b &&
13
- a.getFullYear() === b.getFullYear() &&
14
- a.getMonth() === b.getMonth() &&
15
- a.getDate() === b.getDate());
15
+ return (
16
+ a &&
17
+ b &&
18
+ a.getFullYear() === b.getFullYear() &&
19
+ a.getMonth() === b.getMonth() &&
20
+ a.getDate() === b.getDate()
21
+ );
16
22
  };
17
23
  const isInDateRange = (date, startDate, endDate) => {
18
- if (!date || !startDate || !endDate) {
19
- return false;
20
- }
21
- const minDate = new Date(startDate);
22
- const maxDate = new Date(endDate);
23
- const testDate = new Date(date);
24
- testDate && testDate.setHours(0, 0, 0, 0);
25
- minDate && minDate.setHours(0, 0, 0, 0);
26
- maxDate && maxDate.setHours(0, 0, 0, 0);
27
- return testDate > minDate && testDate < maxDate;
24
+ if (!date || !startDate || !endDate) {
25
+ return false;
26
+ }
27
+ const minDate = new Date(startDate);
28
+ const maxDate = new Date(endDate);
29
+ const testDate = new Date(date);
30
+ testDate && testDate.setHours(0, 0, 0, 0);
31
+ minDate && minDate.setHours(0, 0, 0, 0);
32
+ maxDate && maxDate.setHours(0, 0, 0, 0);
33
+ return testDate > minDate && testDate < maxDate;
28
34
  };
29
- // Type guard for multiple did not work
30
35
  const isSingleOnChange = (onChange, enableRangeSelect) => {
31
- return !enableRangeSelect;
36
+ return !enableRangeSelect;
32
37
  };
33
38
  const defaultMonths = [
34
- 'January',
35
- 'February',
36
- 'March',
37
- 'April',
38
- 'May',
39
- 'June',
40
- 'July',
41
- 'August',
42
- 'September',
43
- 'October',
44
- 'November',
45
- 'December',
39
+ 'January',
40
+ 'February',
41
+ 'March',
42
+ 'April',
43
+ 'May',
44
+ 'June',
45
+ 'July',
46
+ 'August',
47
+ 'September',
48
+ 'October',
49
+ 'November',
50
+ 'December',
46
51
  ];
47
52
  const defaultShortDays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
48
53
  const defaultLongDays = [
49
- 'Sunday',
50
- 'Monday',
51
- 'Tuesday',
52
- 'Wednesday',
53
- 'Thursday',
54
- 'Friday',
55
- 'Saturday',
54
+ 'Sunday',
55
+ 'Monday',
56
+ 'Tuesday',
57
+ 'Wednesday',
58
+ 'Thursday',
59
+ 'Friday',
60
+ 'Saturday',
56
61
  ];
57
- /**
58
- * Generate localized months and days strings using `Intl.DateTimeFormat` for passed locale to use in DatePicker component.
59
- * If locale is not passed, browser locale will be used.
60
- */
61
62
  export const generateLocalizedStrings = (locale) => {
62
- const shortWeekDayFormatter = new Intl.DateTimeFormat(locale, {
63
- weekday: 'short',
64
- });
65
- const longWeekDayFormatter = new Intl.DateTimeFormat(locale, {
66
- weekday: 'long',
67
- });
68
- const monthFormatter = new Intl.DateTimeFormat(locale, { month: 'long' });
69
- const months = [
70
- monthFormatter.format(new Date(2020, 0, 1)),
71
- monthFormatter.format(new Date(2020, 1, 1)),
72
- monthFormatter.format(new Date(2020, 2, 1)),
73
- monthFormatter.format(new Date(2020, 3, 1)),
74
- monthFormatter.format(new Date(2020, 4, 1)),
75
- monthFormatter.format(new Date(2020, 5, 1)),
76
- monthFormatter.format(new Date(2020, 6, 1)),
77
- monthFormatter.format(new Date(2020, 7, 1)),
78
- monthFormatter.format(new Date(2020, 8, 1)),
79
- monthFormatter.format(new Date(2020, 9, 1)),
80
- monthFormatter.format(new Date(2020, 10, 1)),
81
- monthFormatter.format(new Date(2020, 11, 1)),
82
- ];
83
- const days = [
84
- longWeekDayFormatter.format(new Date(2020, 10, 1)),
85
- longWeekDayFormatter.format(new Date(2020, 10, 2)),
86
- longWeekDayFormatter.format(new Date(2020, 10, 3)),
87
- longWeekDayFormatter.format(new Date(2020, 10, 4)),
88
- longWeekDayFormatter.format(new Date(2020, 10, 5)),
89
- longWeekDayFormatter.format(new Date(2020, 10, 6)),
90
- longWeekDayFormatter.format(new Date(2020, 10, 7)),
91
- ];
92
- const shortDays = [
93
- shortWeekDayFormatter.format(new Date(2020, 10, 1)).slice(0, 2),
94
- shortWeekDayFormatter.format(new Date(2020, 10, 2)).slice(0, 2),
95
- shortWeekDayFormatter.format(new Date(2020, 10, 3)).slice(0, 2),
96
- shortWeekDayFormatter.format(new Date(2020, 10, 4)).slice(0, 2),
97
- shortWeekDayFormatter.format(new Date(2020, 10, 5)).slice(0, 2),
98
- shortWeekDayFormatter.format(new Date(2020, 10, 6)).slice(0, 2),
99
- shortWeekDayFormatter.format(new Date(2020, 10, 7)).slice(0, 2),
100
- ];
101
- return {
102
- months,
103
- shortDays,
104
- days,
105
- };
63
+ const shortWeekDayFormatter = new Intl.DateTimeFormat(locale, {
64
+ weekday: 'short',
65
+ });
66
+ const longWeekDayFormatter = new Intl.DateTimeFormat(locale, {
67
+ weekday: 'long',
68
+ });
69
+ const monthFormatter = new Intl.DateTimeFormat(locale, {
70
+ month: 'long',
71
+ });
72
+ const months = [
73
+ monthFormatter.format(new Date(2020, 0, 1)),
74
+ monthFormatter.format(new Date(2020, 1, 1)),
75
+ monthFormatter.format(new Date(2020, 2, 1)),
76
+ monthFormatter.format(new Date(2020, 3, 1)),
77
+ monthFormatter.format(new Date(2020, 4, 1)),
78
+ monthFormatter.format(new Date(2020, 5, 1)),
79
+ monthFormatter.format(new Date(2020, 6, 1)),
80
+ monthFormatter.format(new Date(2020, 7, 1)),
81
+ monthFormatter.format(new Date(2020, 8, 1)),
82
+ monthFormatter.format(new Date(2020, 9, 1)),
83
+ monthFormatter.format(new Date(2020, 10, 1)),
84
+ monthFormatter.format(new Date(2020, 11, 1)),
85
+ ];
86
+ const days = [
87
+ longWeekDayFormatter.format(new Date(2020, 10, 1)),
88
+ longWeekDayFormatter.format(new Date(2020, 10, 2)),
89
+ longWeekDayFormatter.format(new Date(2020, 10, 3)),
90
+ longWeekDayFormatter.format(new Date(2020, 10, 4)),
91
+ longWeekDayFormatter.format(new Date(2020, 10, 5)),
92
+ longWeekDayFormatter.format(new Date(2020, 10, 6)),
93
+ longWeekDayFormatter.format(new Date(2020, 10, 7)),
94
+ ];
95
+ const shortDays = [
96
+ shortWeekDayFormatter.format(new Date(2020, 10, 1)).slice(0, 2),
97
+ shortWeekDayFormatter.format(new Date(2020, 10, 2)).slice(0, 2),
98
+ shortWeekDayFormatter.format(new Date(2020, 10, 3)).slice(0, 2),
99
+ shortWeekDayFormatter.format(new Date(2020, 10, 4)).slice(0, 2),
100
+ shortWeekDayFormatter.format(new Date(2020, 10, 5)).slice(0, 2),
101
+ shortWeekDayFormatter.format(new Date(2020, 10, 6)).slice(0, 2),
102
+ shortWeekDayFormatter.format(new Date(2020, 10, 7)).slice(0, 2),
103
+ ];
104
+ return {
105
+ months,
106
+ shortDays,
107
+ days,
108
+ };
106
109
  };
107
- /**
108
- * Date picker component
109
- * @example
110
- * <DatePicker date={new Date()} onChange={(e) => console.log('New date value: ' + e)} />
111
- */
112
110
  export const DatePicker = React.forwardRef((props, forwardedRef) => {
113
- const { date, onChange, localizedNames, className, setFocus = false, showTime = false, use12Hours = false, precision, hourStep, minuteStep, secondStep, useCombinedRenderer, combinedRenderer, hourRenderer, minuteRenderer, secondRenderer, meridiemRenderer, showYearSelection = false, enableRangeSelect = false, startDate, endDate, monthYearProps, calendarProps, monthProps, weekDayProps, dayProps, weekProps, isDateDisabled, applyBackground = true, showDatesOutsideMonth = true, ...rest } = props;
114
- const monthNames = localizedNames?.months ?? defaultMonths;
115
- const shortDays = localizedNames?.shortDays ?? defaultShortDays;
116
- const longDays = localizedNames?.days ?? defaultLongDays;
117
- const [selectedDay, setSelectedDay] = React.useState(date);
118
- const [selectedStartDay, setSelectedStartDay] = React.useState(startDate);
119
- const [selectedEndDay, setSelectedEndDay] = React.useState(endDate);
120
- const [focusedDay, setFocusedDay] = React.useState(selectedStartDay ?? selectedDay ?? new Date());
121
- const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedStartDay?.getMonth() ??
122
- selectedDay?.getMonth() ??
123
- new Date().getMonth());
124
- const [displayedYear, setDisplayedYear] = React.useState(selectedStartDay?.getFullYear() ??
125
- selectedDay?.getFullYear() ??
126
- new Date().getFullYear());
127
- // boolean that toggles between the user picking the start date and end date for date range
128
- const [isSelectingStartDate, setIsSelectingStartDate] = React.useState(true);
129
- // Used to focus days only when days are changed
130
- // e.g. without this, when changing months day would be focused
131
- const needFocus = React.useRef(setFocus);
132
- React.useEffect(() => {
133
- if (needFocus.current) {
134
- needFocus.current = false;
135
- }
136
- });
137
- const setMonthAndYear = React.useCallback((newMonth, newYear) => {
138
- setDisplayedMonthIndex(newMonth);
139
- setDisplayedYear(newYear);
140
- }, []);
141
- React.useEffect(() => {
142
- const currentDate = new Date();
143
- setSelectedDay(date);
144
- setSelectedStartDay(startDate);
145
- setSelectedEndDay(endDate);
146
- if (!enableRangeSelect) {
147
- setFocusedDay(date ?? currentDate);
148
- }
149
- setMonthAndYear(startDate?.getMonth() ?? date?.getMonth() ?? currentDate.getMonth(), startDate?.getFullYear() ??
150
- date?.getFullYear() ??
151
- currentDate.getFullYear());
152
- }, [date, setMonthAndYear, startDate, endDate, enableRangeSelect]);
153
- const days = React.useMemo(() => {
154
- let offsetToFirst = new Date(displayedYear, displayedMonthIndex, 1).getDay();
155
- // If it's sunday, show one week before, but only if dates outside month are shown.
156
- // (We do not want empty space at the top if dates outside month are not shown.)
157
- if (0 === offsetToFirst && showDatesOutsideMonth) {
158
- offsetToFirst = 7;
159
- }
160
- const daysInMonth = [];
161
- // generate 6 weeks of dates
162
- for (let i = 1; i <= 42; i++) {
163
- const adjustedDay = i - offsetToFirst;
164
- daysInMonth.push(new Date(displayedYear, displayedMonthIndex, adjustedDay));
165
- }
166
- return daysInMonth;
167
- }, [displayedMonthIndex, displayedYear, showDatesOutsideMonth]);
168
- const weeks = React.useMemo(() => {
169
- const weeksInMonth = [];
170
- const weekCount = Math.ceil(days.length / 7);
171
- for (let i = 0; i < weekCount; i++) {
172
- weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));
173
- }
174
- return weeksInMonth;
175
- }, [days]);
176
- const getNewFocusedDate = (newYear, newMonth) => {
177
- const currentDate = selectedStartDay ?? selectedDay ?? new Date();
178
- const newDate = new Date(newYear, newMonth, currentDate.getDate(), currentDate.getHours(), currentDate.getMinutes(), currentDate.getSeconds());
179
- return newDate;
180
- };
181
- const handleMoveToPreviousYear = () => {
182
- const newYear = displayedYear - 1;
183
- setMonthAndYear(displayedMonthIndex, newYear);
184
- setFocusedDay(getNewFocusedDate(newYear, displayedMonthIndex));
185
- };
186
- const handleMoveToNextYear = () => {
187
- const newYear = displayedYear + 1;
188
- setMonthAndYear(displayedMonthIndex, newYear);
189
- setFocusedDay(getNewFocusedDate(newYear, displayedMonthIndex));
190
- };
191
- const handleMoveToPreviousMonth = () => {
192
- const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;
193
- const newYear = displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;
194
- setMonthAndYear(newMonth, newYear);
195
- setFocusedDay(getNewFocusedDate(newYear, newMonth));
196
- };
197
- const handleMoveToNextMonth = () => {
198
- const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;
199
- const newYear = displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;
200
- setMonthAndYear(newMonth, newYear);
201
- setFocusedDay(getNewFocusedDate(newYear, newMonth));
202
- };
203
- const onDayClick = (day) => {
204
- // single date selection
205
- if (!enableRangeSelect) {
206
- if (day.getMonth() !== selectedDay?.getMonth()) {
207
- setMonthAndYear(day.getMonth(), day.getFullYear());
208
- }
209
- const currentDate = selectedDay ?? new Date();
210
- const newDate = new Date(day.getFullYear(), day.getMonth(), day.getDate(), currentDate.getHours(), currentDate.getMinutes(), currentDate.getSeconds());
211
- setSelectedDay(newDate);
212
- setFocusedDay(newDate);
213
- isSingleOnChange(onChange, enableRangeSelect) && onChange?.(newDate);
214
- }
215
- // start date selection (date range only)
216
- else if (isSelectingStartDate) {
217
- if (day.getMonth() !== selectedStartDay?.getMonth()) {
218
- setMonthAndYear(day.getMonth(), day.getFullYear());
219
- }
220
- const currentStartDate = selectedStartDay ?? new Date();
221
- const newStartDate = new Date(day.getFullYear(), day.getMonth(), day.getDate(), currentStartDate.getHours(), currentStartDate.getMinutes(), currentStartDate.getSeconds());
222
- setSelectedStartDay(newStartDate);
223
- setFocusedDay(newStartDate);
224
- // if the start date is after the end date or the end date is undefined, reset the end date
225
- if (!isBefore(newStartDate, selectedEndDay)) {
226
- setSelectedEndDay(newStartDate);
227
- onChange?.(newStartDate, newStartDate);
228
- }
229
- else {
230
- selectedEndDay && onChange?.(newStartDate, selectedEndDay);
231
- }
232
- setIsSelectingStartDate(false);
233
- }
234
- // end date selection (date range only)
235
- else {
236
- if (day.getMonth() !== selectedEndDay?.getMonth()) {
237
- setMonthAndYear(day.getMonth(), day.getFullYear());
238
- }
239
- const currentEndDate = selectedEndDay ?? new Date();
240
- const newEndDate = new Date(day.getFullYear(), day.getMonth(), day.getDate(), currentEndDate.getHours(), currentEndDate.getMinutes(), currentEndDate.getSeconds());
241
- setFocusedDay(newEndDate);
242
- // if the end date is before the start date, move back the start date and still have user select end date
243
- if (!isBefore(newEndDate, selectedStartDay)) {
244
- setSelectedEndDay(newEndDate);
245
- selectedStartDay && onChange?.(selectedStartDay, newEndDate);
246
- setIsSelectingStartDate(true);
247
- }
248
- else {
249
- setSelectedStartDay(newEndDate);
250
- selectedEndDay && onChange?.(newEndDate, selectedEndDay);
251
- }
252
- }
253
- };
254
- const handleCalendarKeyDown = (event) => {
255
- if (event.altKey) {
256
- return;
257
- }
258
- if (!focusedDay) {
259
- return;
260
- }
261
- const adjustedFocusedDay = new Date(focusedDay);
262
- switch (event.key) {
263
- case 'ArrowDown':
264
- adjustedFocusedDay.setDate(focusedDay.getDate() + 7);
265
- if (adjustedFocusedDay.getMonth() !== displayedMonthIndex) {
266
- handleMoveToNextMonth();
267
- }
268
- setFocusedDay(adjustedFocusedDay);
269
- needFocus.current = true;
270
- event.preventDefault();
271
- break;
272
- case 'ArrowUp':
273
- adjustedFocusedDay.setDate(focusedDay.getDate() - 7);
274
- if (adjustedFocusedDay.getMonth() !== displayedMonthIndex) {
275
- handleMoveToPreviousMonth();
276
- }
277
- setFocusedDay(adjustedFocusedDay);
278
- needFocus.current = true;
279
- event.preventDefault();
280
- break;
281
- case 'ArrowLeft':
282
- adjustedFocusedDay.setDate(focusedDay.getDate() - 1);
283
- if (adjustedFocusedDay.getMonth() !== displayedMonthIndex) {
284
- handleMoveToPreviousMonth();
285
- }
286
- setFocusedDay(adjustedFocusedDay);
287
- needFocus.current = true;
288
- event.preventDefault();
289
- break;
290
- case 'ArrowRight':
291
- adjustedFocusedDay.setDate(focusedDay.getDate() + 1);
292
- if (adjustedFocusedDay.getMonth() !== displayedMonthIndex) {
293
- handleMoveToNextMonth();
294
- }
295
- setFocusedDay(adjustedFocusedDay);
296
- needFocus.current = true;
297
- event.preventDefault();
298
- break;
299
- case 'Enter':
300
- case ' ':
301
- case 'Spacebar':
302
- if (!isDateDisabled?.(focusedDay)) {
303
- onDayClick(focusedDay);
304
- }
305
- event.preventDefault();
306
- break;
307
- }
308
- };
309
- const getDayClass = (day) => {
310
- if (day.getMonth() !== displayedMonthIndex) {
311
- return 'iui-calendar-day-outside-month';
312
- }
313
- let dayClass = 'iui-calendar-day';
314
- const isSelectedDay = isSameDay(day, selectedDay) ||
315
- (isSameDay(day, selectedStartDay) && isSameDay(day, selectedEndDay));
316
- if (isSelectedDay) {
317
- dayClass += '-selected';
111
+ const {
112
+ date,
113
+ onChange,
114
+ localizedNames,
115
+ className,
116
+ setFocus = false,
117
+ showTime = false,
118
+ use12Hours = false,
119
+ precision,
120
+ hourStep,
121
+ minuteStep,
122
+ secondStep,
123
+ useCombinedRenderer,
124
+ combinedRenderer,
125
+ hourRenderer,
126
+ minuteRenderer,
127
+ secondRenderer,
128
+ meridiemRenderer,
129
+ showYearSelection = false,
130
+ enableRangeSelect = false,
131
+ startDate,
132
+ endDate,
133
+ monthYearProps,
134
+ calendarProps,
135
+ monthProps,
136
+ weekDayProps,
137
+ dayProps,
138
+ weekProps,
139
+ isDateDisabled,
140
+ applyBackground = true,
141
+ showDatesOutsideMonth = true,
142
+ ...rest
143
+ } = props;
144
+ const monthNames = localizedNames?.months ?? defaultMonths;
145
+ const shortDays = localizedNames?.shortDays ?? defaultShortDays;
146
+ const longDays = localizedNames?.days ?? defaultLongDays;
147
+ const [selectedDay, setSelectedDay] = React.useState(date);
148
+ const [selectedStartDay, setSelectedStartDay] = React.useState(startDate);
149
+ const [selectedEndDay, setSelectedEndDay] = React.useState(endDate);
150
+ const [focusedDay, setFocusedDay] = React.useState(
151
+ selectedStartDay ?? selectedDay ?? new Date(),
152
+ );
153
+ const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(
154
+ selectedStartDay?.getMonth() ??
155
+ selectedDay?.getMonth() ??
156
+ new Date().getMonth(),
157
+ );
158
+ const [displayedYear, setDisplayedYear] = React.useState(
159
+ selectedStartDay?.getFullYear() ??
160
+ selectedDay?.getFullYear() ??
161
+ new Date().getFullYear(),
162
+ );
163
+ const [isSelectingStartDate, setIsSelectingStartDate] = React.useState(true);
164
+ const needFocus = React.useRef(setFocus);
165
+ React.useEffect(() => {
166
+ if (needFocus.current) {
167
+ needFocus.current = false;
168
+ }
169
+ });
170
+ const setMonthAndYear = React.useCallback((newMonth, newYear) => {
171
+ setDisplayedMonthIndex(newMonth);
172
+ setDisplayedYear(newYear);
173
+ }, []);
174
+ React.useEffect(() => {
175
+ const currentDate = new Date();
176
+ setSelectedDay(date);
177
+ setSelectedStartDay(startDate);
178
+ setSelectedEndDay(endDate);
179
+ if (!enableRangeSelect) {
180
+ setFocusedDay(date ?? currentDate);
181
+ }
182
+ setMonthAndYear(
183
+ startDate?.getMonth() ?? date?.getMonth() ?? currentDate.getMonth(),
184
+ startDate?.getFullYear() ??
185
+ date?.getFullYear() ??
186
+ currentDate.getFullYear(),
187
+ );
188
+ }, [date, setMonthAndYear, startDate, endDate, enableRangeSelect]);
189
+ const days = React.useMemo(() => {
190
+ let offsetToFirst = new Date(
191
+ displayedYear,
192
+ displayedMonthIndex,
193
+ 1,
194
+ ).getDay();
195
+ if (0 === offsetToFirst && showDatesOutsideMonth) {
196
+ offsetToFirst = 7;
197
+ }
198
+ const daysInMonth = [];
199
+ for (let i = 1; i <= 42; i++) {
200
+ const adjustedDay = i - offsetToFirst;
201
+ daysInMonth.push(
202
+ new Date(displayedYear, displayedMonthIndex, adjustedDay),
203
+ );
204
+ }
205
+ return daysInMonth;
206
+ }, [displayedMonthIndex, displayedYear, showDatesOutsideMonth]);
207
+ const weeks = React.useMemo(() => {
208
+ const weeksInMonth = [];
209
+ const weekCount = Math.ceil(days.length / 7);
210
+ for (let i = 0; i < weekCount; i++) {
211
+ weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));
212
+ }
213
+ return weeksInMonth;
214
+ }, [days]);
215
+ const getNewFocusedDate = (newYear, newMonth) => {
216
+ const currentDate = selectedStartDay ?? selectedDay ?? new Date();
217
+ const newDate = new Date(
218
+ newYear,
219
+ newMonth,
220
+ currentDate.getDate(),
221
+ currentDate.getHours(),
222
+ currentDate.getMinutes(),
223
+ currentDate.getSeconds(),
224
+ );
225
+ return newDate;
226
+ };
227
+ const handleMoveToPreviousYear = () => {
228
+ const newYear = displayedYear - 1;
229
+ setMonthAndYear(displayedMonthIndex, newYear);
230
+ setFocusedDay(getNewFocusedDate(newYear, displayedMonthIndex));
231
+ };
232
+ const handleMoveToNextYear = () => {
233
+ const newYear = displayedYear + 1;
234
+ setMonthAndYear(displayedMonthIndex, newYear);
235
+ setFocusedDay(getNewFocusedDate(newYear, displayedMonthIndex));
236
+ };
237
+ const handleMoveToPreviousMonth = () => {
238
+ const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;
239
+ const newYear =
240
+ displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;
241
+ setMonthAndYear(newMonth, newYear);
242
+ setFocusedDay(getNewFocusedDate(newYear, newMonth));
243
+ };
244
+ const handleMoveToNextMonth = () => {
245
+ const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;
246
+ const newYear =
247
+ displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;
248
+ setMonthAndYear(newMonth, newYear);
249
+ setFocusedDay(getNewFocusedDate(newYear, newMonth));
250
+ };
251
+ const onDayClick = (day) => {
252
+ if (!enableRangeSelect) {
253
+ if (day.getMonth() !== selectedDay?.getMonth()) {
254
+ setMonthAndYear(day.getMonth(), day.getFullYear());
255
+ }
256
+ const currentDate = selectedDay ?? new Date();
257
+ const newDate = new Date(
258
+ day.getFullYear(),
259
+ day.getMonth(),
260
+ day.getDate(),
261
+ currentDate.getHours(),
262
+ currentDate.getMinutes(),
263
+ currentDate.getSeconds(),
264
+ );
265
+ setSelectedDay(newDate);
266
+ setFocusedDay(newDate);
267
+ isSingleOnChange(onChange, enableRangeSelect) && onChange?.(newDate);
268
+ } else if (isSelectingStartDate) {
269
+ if (day.getMonth() !== selectedStartDay?.getMonth()) {
270
+ setMonthAndYear(day.getMonth(), day.getFullYear());
271
+ }
272
+ const currentStartDate = selectedStartDay ?? new Date();
273
+ const newStartDate = new Date(
274
+ day.getFullYear(),
275
+ day.getMonth(),
276
+ day.getDate(),
277
+ currentStartDate.getHours(),
278
+ currentStartDate.getMinutes(),
279
+ currentStartDate.getSeconds(),
280
+ );
281
+ setSelectedStartDay(newStartDate);
282
+ setFocusedDay(newStartDate);
283
+ if (!isBefore(newStartDate, selectedEndDay)) {
284
+ setSelectedEndDay(newStartDate);
285
+ onChange?.(newStartDate, newStartDate);
286
+ } else {
287
+ selectedEndDay && onChange?.(newStartDate, selectedEndDay);
288
+ }
289
+ setIsSelectingStartDate(false);
290
+ } else {
291
+ if (day.getMonth() !== selectedEndDay?.getMonth()) {
292
+ setMonthAndYear(day.getMonth(), day.getFullYear());
293
+ }
294
+ const currentEndDate = selectedEndDay ?? new Date();
295
+ const newEndDate = new Date(
296
+ day.getFullYear(),
297
+ day.getMonth(),
298
+ day.getDate(),
299
+ currentEndDate.getHours(),
300
+ currentEndDate.getMinutes(),
301
+ currentEndDate.getSeconds(),
302
+ );
303
+ setFocusedDay(newEndDate);
304
+ if (!isBefore(newEndDate, selectedStartDay)) {
305
+ setSelectedEndDay(newEndDate);
306
+ selectedStartDay && onChange?.(selectedStartDay, newEndDate);
307
+ setIsSelectingStartDate(true);
308
+ } else {
309
+ setSelectedStartDay(newEndDate);
310
+ selectedEndDay && onChange?.(newEndDate, selectedEndDay);
311
+ }
312
+ }
313
+ };
314
+ const handleCalendarKeyDown = (event) => {
315
+ if (event.altKey) {
316
+ return;
317
+ }
318
+ if (!focusedDay) {
319
+ return;
320
+ }
321
+ const adjustedFocusedDay = new Date(focusedDay);
322
+ switch (event.key) {
323
+ case 'ArrowDown':
324
+ adjustedFocusedDay.setDate(focusedDay.getDate() + 7);
325
+ if (adjustedFocusedDay.getMonth() !== displayedMonthIndex) {
326
+ handleMoveToNextMonth();
318
327
  }
319
- else if (isSameDay(day, selectedStartDay)) {
320
- dayClass += '-range-start';
328
+ setFocusedDay(adjustedFocusedDay);
329
+ needFocus.current = true;
330
+ event.preventDefault();
331
+ break;
332
+ case 'ArrowUp':
333
+ adjustedFocusedDay.setDate(focusedDay.getDate() - 7);
334
+ if (adjustedFocusedDay.getMonth() !== displayedMonthIndex) {
335
+ handleMoveToPreviousMonth();
321
336
  }
322
- else if (isSameDay(day, selectedEndDay)) {
323
- dayClass += '-range-end';
337
+ setFocusedDay(adjustedFocusedDay);
338
+ needFocus.current = true;
339
+ event.preventDefault();
340
+ break;
341
+ case 'ArrowLeft':
342
+ adjustedFocusedDay.setDate(focusedDay.getDate() - 1);
343
+ if (adjustedFocusedDay.getMonth() !== displayedMonthIndex) {
344
+ handleMoveToPreviousMonth();
324
345
  }
325
- // adds range class to dates between start and end date
326
- if (selectedStartDay &&
327
- selectedEndDay &&
328
- isInDateRange(day, selectedStartDay, selectedEndDay)) {
329
- dayClass += '-range';
346
+ setFocusedDay(adjustedFocusedDay);
347
+ needFocus.current = true;
348
+ event.preventDefault();
349
+ break;
350
+ case 'ArrowRight':
351
+ adjustedFocusedDay.setDate(focusedDay.getDate() + 1);
352
+ if (adjustedFocusedDay.getMonth() !== displayedMonthIndex) {
353
+ handleMoveToNextMonth();
330
354
  }
331
- if (isSameDay(day, new Date())) {
332
- dayClass += '-today';
355
+ setFocusedDay(adjustedFocusedDay);
356
+ needFocus.current = true;
357
+ event.preventDefault();
358
+ break;
359
+ case 'Enter':
360
+ case ' ':
361
+ case 'Spacebar':
362
+ if (!isDateDisabled?.(focusedDay)) {
363
+ onDayClick(focusedDay);
333
364
  }
334
- return dayClass;
335
- };
336
- const dateTableId = useId();
337
- return (React.createElement(Box, { className: cx('iui-date-picker', { 'iui-popover-surface': applyBackground }, className), ref: forwardedRef, ...rest },
338
- React.createElement("div", null,
339
- React.createElement(Box, { as: 'div', ...monthYearProps, className: cx('iui-calendar-month-year', monthYearProps?.className) },
340
- showYearSelection && (React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToPreviousYear, "aria-label": 'Previous year', size: 'small' },
341
- React.createElement(SvgChevronLeftDouble, null))),
342
- React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToPreviousMonth, "aria-label": 'Previous month', size: 'small' },
343
- React.createElement(SvgChevronLeft, null)),
344
- React.createElement("span", { "aria-live": 'polite' },
345
- React.createElement(Box, { as: 'span', id: dateTableId, title: monthNames[displayedMonthIndex], ...monthProps, className: cx('iui-calendar-month', monthProps?.className) }, monthNames[displayedMonthIndex]),
346
- "\u00A0",
347
- displayedYear),
348
- React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToNextMonth, "aria-label": 'Next month', size: 'small' },
349
- React.createElement(SvgChevronRight, null)),
350
- showYearSelection && (React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToNextYear, "aria-label": 'Next year', size: 'small' },
351
- React.createElement(SvgChevronRightDouble, null)))),
352
- React.createElement(Box, { as: 'div', ...weekDayProps, className: cx('iui-calendar-weekdays', weekDayProps?.className) }, shortDays.map((day, index) => (React.createElement("div", { key: day, title: longDays[index] }, day)))),
353
- React.createElement("div", { onKeyDown: handleCalendarKeyDown, role: 'listbox', "aria-labelledby": dateTableId, ...calendarProps }, weeks.map((weekDays, weekIndex) => {
354
- return (React.createElement(Box, { as: 'div', key: `week-${displayedMonthIndex}-${weekIndex}`, ...weekProps, className: cx('iui-calendar-week', weekProps?.className) }, weekDays.map((weekDay, dayIndex) => {
355
- const dateValue = weekDay.getDate();
356
- const isDisabled = isDateDisabled?.(weekDay);
357
- const isOutsideMonth = weekDay.getMonth() !== displayedMonthIndex;
358
- if (isOutsideMonth && !showDatesOutsideMonth) {
359
- return (React.createElement(Box, { key: `day-${displayedMonthIndex}-${dayIndex}`, className: cx(getDayClass(weekDay), dayProps?.className), "aria-hidden": true }));
360
- }
361
- return (React.createElement(Box, { as: 'div', key: `day-${displayedMonthIndex}-${dayIndex}`, onClick: () => !isDisabled && onDayClick(weekDay), role: 'option', tabIndex: isSameDay(weekDay, focusedDay) ? 0 : -1, "aria-disabled": isDisabled ? 'true' : undefined, ref: (element) => isSameDay(weekDay, focusedDay) &&
362
- needFocus.current &&
363
- element?.focus(), ...dayProps, className: cx(getDayClass(weekDay), dayProps?.className) }, dateValue));
364
- })));
365
- }))),
366
- showTime && (React.createElement(TimePicker, { date: selectedStartDay ?? selectedDay, use12Hours: use12Hours, precision: precision, hourStep: hourStep, minuteStep: minuteStep, secondStep: secondStep, useCombinedRenderer: useCombinedRenderer, combinedRenderer: combinedRenderer, hourRenderer: hourRenderer, minuteRenderer: minuteRenderer, secondRenderer: secondRenderer, meridiemRenderer: meridiemRenderer, onChange: (date) => isSingleOnChange(onChange, enableRangeSelect)
367
- ? onChange?.(date)
368
- : onChange?.(new Date(selectedStartDay?.getFullYear() ?? date.getFullYear(), selectedStartDay?.getMonth() ?? date.getMonth(), selectedStartDay?.getDate() ?? date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()), new Date(selectedEndDay?.getFullYear() ?? date.getFullYear(), selectedEndDay?.getMonth() ?? date.getMonth(), selectedEndDay?.getDate() ?? date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds())) }))));
365
+ event.preventDefault();
366
+ break;
367
+ }
368
+ };
369
+ const getDayClass = (day) => {
370
+ if (day.getMonth() !== displayedMonthIndex) {
371
+ return 'iui-calendar-day-outside-month';
372
+ }
373
+ let dayClass = 'iui-calendar-day';
374
+ const isSelectedDay =
375
+ isSameDay(day, selectedDay) ||
376
+ (isSameDay(day, selectedStartDay) && isSameDay(day, selectedEndDay));
377
+ if (isSelectedDay) {
378
+ dayClass += '-selected';
379
+ } else if (isSameDay(day, selectedStartDay)) {
380
+ dayClass += '-range-start';
381
+ } else if (isSameDay(day, selectedEndDay)) {
382
+ dayClass += '-range-end';
383
+ }
384
+ if (
385
+ selectedStartDay &&
386
+ selectedEndDay &&
387
+ isInDateRange(day, selectedStartDay, selectedEndDay)
388
+ ) {
389
+ dayClass += '-range';
390
+ }
391
+ if (isSameDay(day, new Date())) {
392
+ dayClass += '-today';
393
+ }
394
+ return dayClass;
395
+ };
396
+ const dateTableId = useId();
397
+ return React.createElement(
398
+ Box,
399
+ {
400
+ className: cx(
401
+ 'iui-date-picker',
402
+ {
403
+ 'iui-popover-surface': applyBackground,
404
+ },
405
+ className,
406
+ ),
407
+ ref: forwardedRef,
408
+ ...rest,
409
+ },
410
+ React.createElement(
411
+ 'div',
412
+ null,
413
+ React.createElement(
414
+ Box,
415
+ {
416
+ as: 'div',
417
+ ...monthYearProps,
418
+ className: cx('iui-calendar-month-year', monthYearProps?.className),
419
+ },
420
+ showYearSelection &&
421
+ React.createElement(
422
+ IconButton,
423
+ {
424
+ styleType: 'borderless',
425
+ onClick: handleMoveToPreviousYear,
426
+ 'aria-label': 'Previous year',
427
+ size: 'small',
428
+ },
429
+ React.createElement(SvgChevronLeftDouble, null),
430
+ ),
431
+ React.createElement(
432
+ IconButton,
433
+ {
434
+ styleType: 'borderless',
435
+ onClick: handleMoveToPreviousMonth,
436
+ 'aria-label': 'Previous month',
437
+ size: 'small',
438
+ },
439
+ React.createElement(SvgChevronLeft, null),
440
+ ),
441
+ React.createElement(
442
+ 'span',
443
+ {
444
+ 'aria-live': 'polite',
445
+ },
446
+ React.createElement(
447
+ Box,
448
+ {
449
+ as: 'span',
450
+ id: dateTableId,
451
+ title: monthNames[displayedMonthIndex],
452
+ ...monthProps,
453
+ className: cx('iui-calendar-month', monthProps?.className),
454
+ },
455
+ monthNames[displayedMonthIndex],
456
+ ),
457
+ ' ',
458
+ displayedYear,
459
+ ),
460
+ React.createElement(
461
+ IconButton,
462
+ {
463
+ styleType: 'borderless',
464
+ onClick: handleMoveToNextMonth,
465
+ 'aria-label': 'Next month',
466
+ size: 'small',
467
+ },
468
+ React.createElement(SvgChevronRight, null),
469
+ ),
470
+ showYearSelection &&
471
+ React.createElement(
472
+ IconButton,
473
+ {
474
+ styleType: 'borderless',
475
+ onClick: handleMoveToNextYear,
476
+ 'aria-label': 'Next year',
477
+ size: 'small',
478
+ },
479
+ React.createElement(SvgChevronRightDouble, null),
480
+ ),
481
+ ),
482
+ React.createElement(
483
+ Box,
484
+ {
485
+ as: 'div',
486
+ ...weekDayProps,
487
+ className: cx('iui-calendar-weekdays', weekDayProps?.className),
488
+ },
489
+ shortDays.map((day, index) =>
490
+ React.createElement(
491
+ 'div',
492
+ {
493
+ key: day,
494
+ title: longDays[index],
495
+ },
496
+ day,
497
+ ),
498
+ ),
499
+ ),
500
+ React.createElement(
501
+ 'div',
502
+ {
503
+ onKeyDown: handleCalendarKeyDown,
504
+ role: 'listbox',
505
+ 'aria-labelledby': dateTableId,
506
+ ...calendarProps,
507
+ },
508
+ weeks.map((weekDays, weekIndex) => {
509
+ return React.createElement(
510
+ Box,
511
+ {
512
+ as: 'div',
513
+ key: `week-${displayedMonthIndex}-${weekIndex}`,
514
+ ...weekProps,
515
+ className: cx('iui-calendar-week', weekProps?.className),
516
+ },
517
+ weekDays.map((weekDay, dayIndex) => {
518
+ const dateValue = weekDay.getDate();
519
+ const isDisabled = isDateDisabled?.(weekDay);
520
+ const isOutsideMonth = weekDay.getMonth() !== displayedMonthIndex;
521
+ if (isOutsideMonth && !showDatesOutsideMonth) {
522
+ return React.createElement(Box, {
523
+ key: `day-${displayedMonthIndex}-${dayIndex}`,
524
+ className: cx(getDayClass(weekDay), dayProps?.className),
525
+ 'aria-hidden': true,
526
+ });
527
+ }
528
+ return React.createElement(
529
+ Box,
530
+ {
531
+ as: 'div',
532
+ key: `day-${displayedMonthIndex}-${dayIndex}`,
533
+ onClick: () => !isDisabled && onDayClick(weekDay),
534
+ role: 'option',
535
+ tabIndex: isSameDay(weekDay, focusedDay) ? 0 : -1,
536
+ 'aria-disabled': isDisabled ? 'true' : undefined,
537
+ ref: (element) =>
538
+ isSameDay(weekDay, focusedDay) &&
539
+ needFocus.current &&
540
+ element?.focus(),
541
+ ...dayProps,
542
+ className: cx(getDayClass(weekDay), dayProps?.className),
543
+ },
544
+ dateValue,
545
+ );
546
+ }),
547
+ );
548
+ }),
549
+ ),
550
+ ),
551
+ showTime &&
552
+ React.createElement(TimePicker, {
553
+ date: selectedStartDay ?? selectedDay,
554
+ use12Hours: use12Hours,
555
+ precision: precision,
556
+ hourStep: hourStep,
557
+ minuteStep: minuteStep,
558
+ secondStep: secondStep,
559
+ useCombinedRenderer: useCombinedRenderer,
560
+ combinedRenderer: combinedRenderer,
561
+ hourRenderer: hourRenderer,
562
+ minuteRenderer: minuteRenderer,
563
+ secondRenderer: secondRenderer,
564
+ meridiemRenderer: meridiemRenderer,
565
+ onChange: (date) =>
566
+ isSingleOnChange(onChange, enableRangeSelect)
567
+ ? onChange?.(date)
568
+ : onChange?.(
569
+ new Date(
570
+ selectedStartDay?.getFullYear() ?? date.getFullYear(),
571
+ selectedStartDay?.getMonth() ?? date.getMonth(),
572
+ selectedStartDay?.getDate() ?? date.getDate(),
573
+ date.getHours(),
574
+ date.getMinutes(),
575
+ date.getSeconds(),
576
+ ),
577
+ new Date(
578
+ selectedEndDay?.getFullYear() ?? date.getFullYear(),
579
+ selectedEndDay?.getMonth() ?? date.getMonth(),
580
+ selectedEndDay?.getDate() ?? date.getDate(),
581
+ date.getHours(),
582
+ date.getMinutes(),
583
+ date.getSeconds(),
584
+ ),
585
+ ),
586
+ }),
587
+ );
369
588
  });