@hitachivantara/uikit-react-core 6.8.2 → 6.9.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 (442) hide show
  1. package/LICENSE +201 -0
  2. package/dist/Accordion/Accordion.js +69 -80
  3. package/dist/Accordion/Accordion.styles.js +21 -16
  4. package/dist/ActionBar/ActionBar.js +18 -17
  5. package/dist/ActionBar/ActionBar.styles.js +12 -15
  6. package/dist/ActionsGeneric/ActionsGeneric.js +72 -98
  7. package/dist/ActionsGeneric/ActionsGeneric.styles.js +17 -14
  8. package/dist/AppSwitcher/Action/Action.js +96 -111
  9. package/dist/AppSwitcher/Action/Action.styles.js +44 -48
  10. package/dist/AppSwitcher/AppSwitcher.js +70 -98
  11. package/dist/AppSwitcher/AppSwitcher.styles.js +50 -53
  12. package/dist/Avatar/Avatar.js +66 -111
  13. package/dist/Avatar/Avatar.styles.js +62 -52
  14. package/dist/AvatarGroup/AvatarGroup.js +49 -78
  15. package/dist/AvatarGroup/AvatarGroup.styles.js +40 -60
  16. package/dist/AvatarGroup/AvatarGroupContext.js +13 -16
  17. package/dist/Badge/Badge.js +40 -49
  18. package/dist/Badge/Badge.styles.js +50 -50
  19. package/dist/Banner/Banner.js +50 -82
  20. package/dist/Banner/Banner.styles.js +13 -22
  21. package/dist/Banner/BannerContent/BannerContent.js +35 -56
  22. package/dist/Banner/BannerContent/BannerContent.styles.js +31 -36
  23. package/dist/BaseCheckBox/BaseCheckBox.js +71 -88
  24. package/dist/BaseCheckBox/BaseCheckBox.styles.js +24 -31
  25. package/dist/BaseCheckBox/CheckBoxIcon.js +57 -73
  26. package/dist/BaseDropdown/BaseDropdown.js +147 -189
  27. package/dist/BaseDropdown/BaseDropdown.styles.js +72 -84
  28. package/dist/BaseDropdown/BaseDropdownPanel.js +69 -86
  29. package/dist/BaseDropdown/utils.js +77 -76
  30. package/dist/BaseInput/BaseInput.js +53 -89
  31. package/dist/BaseInput/BaseInput.styles.js +85 -105
  32. package/dist/BaseInput/validations.js +72 -69
  33. package/dist/BaseRadio/BaseRadio.js +61 -85
  34. package/dist/BaseRadio/BaseRadio.styles.js +26 -31
  35. package/dist/BaseRadio/RadioIcon.js +43 -48
  36. package/dist/BaseSwitch/BaseSwitch.js +70 -108
  37. package/dist/BaseSwitch/BaseSwitch.styles.js +94 -113
  38. package/dist/BreadCrumb/BreadCrumb.js +84 -106
  39. package/dist/BreadCrumb/BreadCrumb.styles.js +20 -17
  40. package/dist/BreadCrumb/Page/Page.js +24 -34
  41. package/dist/BreadCrumb/Page/Page.styles.js +20 -25
  42. package/dist/BreadCrumb/PathElement/PathElement.js +17 -17
  43. package/dist/BreadCrumb/PathElement/PathElement.styles.js +9 -7
  44. package/dist/BreadCrumb/utils.js +19 -27
  45. package/dist/BulkActions/BulkActions.js +57 -96
  46. package/dist/BulkActions/BulkActions.styles.js +37 -45
  47. package/dist/Button/Button.js +67 -95
  48. package/dist/Button/Button.styles.js +107 -124
  49. package/dist/ButtonBase/ButtonBase.js +32 -51
  50. package/dist/ButtonBase/ButtonBase.styles.js +21 -30
  51. package/dist/Calendar/Calendar.js +73 -101
  52. package/dist/Calendar/Calendar.styles.js +14 -32
  53. package/dist/Calendar/CalendarHeader/CalendarHeader.js +91 -118
  54. package/dist/Calendar/CalendarHeader/CalendarHeader.styles.js +11 -16
  55. package/dist/Calendar/CalendarNavigation/ComposedNavigation/ComposedNavigation.js +36 -50
  56. package/dist/Calendar/CalendarNavigation/ComposedNavigation/ComposedNavigation.styles.js +12 -18
  57. package/dist/Calendar/CalendarNavigation/MonthSelector/MonthSelector.js +23 -43
  58. package/dist/Calendar/CalendarNavigation/MonthSelector/MonthSelector.styles.js +21 -24
  59. package/dist/Calendar/CalendarNavigation/Navigation/Navigation.js +43 -59
  60. package/dist/Calendar/CalendarNavigation/Navigation/Navigation.styles.js +21 -24
  61. package/dist/Calendar/SingleCalendar/CalendarCell.js +60 -84
  62. package/dist/Calendar/SingleCalendar/CalendarCell.styles.js +39 -56
  63. package/dist/Calendar/SingleCalendar/SingleCalendar.js +121 -154
  64. package/dist/Calendar/SingleCalendar/SingleCalendar.styles.js +53 -68
  65. package/dist/Calendar/model.js +45 -62
  66. package/dist/Calendar/utils.js +233 -128
  67. package/dist/Card/Card.js +35 -53
  68. package/dist/Card/Card.styles.js +37 -50
  69. package/dist/Card/Content/Content.js +15 -27
  70. package/dist/Card/Content/Content.styles.js +5 -10
  71. package/dist/Card/Header/Header.js +22 -35
  72. package/dist/Card/Header/Header.styles.js +22 -25
  73. package/dist/Card/Media/Media.js +16 -26
  74. package/dist/Card/Media/Media.styles.js +6 -7
  75. package/dist/Carousel/Carousel.js +176 -207
  76. package/dist/Carousel/Carousel.styles.js +141 -166
  77. package/dist/Carousel/CarouselControls.js +48 -62
  78. package/dist/Carousel/CarouselSlide/CarouselSlide.js +19 -25
  79. package/dist/Carousel/CarouselSlide/CarouselSlide.styles.js +10 -11
  80. package/dist/Carousel/CarouselThumbnails.js +29 -36
  81. package/dist/CheckBox/CheckBox.js +112 -182
  82. package/dist/CheckBox/CheckBox.styles.js +48 -57
  83. package/dist/CheckBoxGroup/CheckBoxGroup.js +154 -245
  84. package/dist/CheckBoxGroup/CheckBoxGroup.styles.js +29 -35
  85. package/dist/ColorPicker/ColorPicker.js +146 -222
  86. package/dist/ColorPicker/ColorPicker.styles.js +40 -45
  87. package/dist/ColorPicker/Picker/Fields.js +125 -141
  88. package/dist/ColorPicker/Picker/Picker.js +51 -50
  89. package/dist/ColorPicker/Picker/Picker.styles.js +42 -42
  90. package/dist/ColorPicker/PresetColors/PresetColors.js +25 -28
  91. package/dist/ColorPicker/PresetColors/PresetColors.styles.js +17 -17
  92. package/dist/ColorPicker/SavedColors/SavedColors.js +37 -41
  93. package/dist/ColorPicker/SavedColors/SavedColors.styles.js +27 -29
  94. package/dist/ColorPicker/Swatch.js +22 -37
  95. package/dist/Container/Container.js +37 -58
  96. package/dist/Container/Container.styles.js +12 -13
  97. package/dist/Controls/Controls.js +50 -74
  98. package/dist/Controls/Controls.styles.js +16 -13
  99. package/dist/Controls/LeftControl/LeftControl.js +25 -38
  100. package/dist/Controls/LeftControl/LeftControl.styles.js +7 -7
  101. package/dist/Controls/RightControl/RightControl.js +31 -46
  102. package/dist/Controls/RightControl/RightControl.styles.js +9 -7
  103. package/dist/Controls/context/ControlsContext.js +5 -6
  104. package/dist/DatePicker/DatePicker.js +286 -339
  105. package/dist/DatePicker/DatePicker.styles.js +25 -40
  106. package/dist/DatePicker/useVisibleDate.js +142 -126
  107. package/dist/DatePicker/utils.js +17 -26
  108. package/dist/Dialog/Actions/Actions.js +19 -29
  109. package/dist/Dialog/Actions/Actions.styles.js +20 -20
  110. package/dist/Dialog/Content/Content.js +29 -46
  111. package/dist/Dialog/Content/Content.styles.js +14 -15
  112. package/dist/Dialog/Dialog.js +49 -69
  113. package/dist/Dialog/Dialog.styles.js +33 -46
  114. package/dist/Dialog/Title/Title.js +20 -42
  115. package/dist/Dialog/Title/Title.styles.js +14 -16
  116. package/dist/Dialog/context.js +5 -6
  117. package/dist/DotPagination/DotPagination.js +44 -59
  118. package/dist/DotPagination/DotPagination.styles.js +44 -47
  119. package/dist/Drawer/Drawer.js +37 -64
  120. package/dist/Drawer/Drawer.styles.js +18 -21
  121. package/dist/DropDownMenu/DropDownMenu.js +88 -124
  122. package/dist/DropDownMenu/DropDownMenu.styles.js +12 -21
  123. package/dist/Dropdown/Dropdown.js +221 -310
  124. package/dist/Dropdown/Dropdown.styles.js +39 -48
  125. package/dist/Dropdown/List/List.js +194 -176
  126. package/dist/Dropdown/List/List.styles.js +23 -24
  127. package/dist/Dropdown/utils.js +15 -16
  128. package/dist/DropdownButton/DropdownButton.js +42 -46
  129. package/dist/DropdownButton/DropdownButton.styles.js +37 -47
  130. package/dist/EmptyState/EmptyState.js +48 -61
  131. package/dist/EmptyState/EmptyState.styles.js +31 -31
  132. package/dist/FileUploader/DropZone/DropZone.js +141 -179
  133. package/dist/FileUploader/DropZone/DropZone.styles.js +55 -68
  134. package/dist/FileUploader/File/File.js +85 -75
  135. package/dist/FileUploader/File/File.styles.js +55 -60
  136. package/dist/FileUploader/FileList/FileList.js +19 -28
  137. package/dist/FileUploader/FileList/FileList.styles.js +15 -16
  138. package/dist/FileUploader/FileUploader.js +35 -55
  139. package/dist/FileUploader/FileUploader.styles.js +4 -7
  140. package/dist/FileUploader/Preview/Preview.js +37 -52
  141. package/dist/FileUploader/Preview/Preview.styles.js +22 -28
  142. package/dist/FileUploader/utils.js +24 -11
  143. package/dist/FilterGroup/Counter/Counter.js +31 -43
  144. package/dist/FilterGroup/Counter/Counter.styles.js +12 -15
  145. package/dist/FilterGroup/FilterContent/FilterContent.js +138 -177
  146. package/dist/FilterGroup/FilterContent/FilterContent.styles.js +46 -53
  147. package/dist/FilterGroup/FilterContent/HeaderButton.js +77 -100
  148. package/dist/FilterGroup/FilterGroup.js +87 -136
  149. package/dist/FilterGroup/FilterGroup.styles.js +9 -10
  150. package/dist/FilterGroup/FilterGroupContext.js +68 -73
  151. package/dist/FilterGroup/LeftPanel/LeftPanel.js +28 -31
  152. package/dist/FilterGroup/LeftPanel/LeftPanel.styles.js +6 -11
  153. package/dist/FilterGroup/RightPanel/RightPanel.js +118 -151
  154. package/dist/FilterGroup/RightPanel/RightPanel.styles.js +17 -27
  155. package/dist/Focus/Focus.js +248 -344
  156. package/dist/Focus/Focus.styles.js +28 -39
  157. package/dist/Focus/utils.js +14 -20
  158. package/dist/Footer/Footer.js +36 -38
  159. package/dist/Footer/Footer.styles.js +40 -43
  160. package/dist/FormElement/Adornment/Adornment.js +38 -49
  161. package/dist/FormElement/Adornment/Adornment.styles.js +14 -15
  162. package/dist/FormElement/CharCounter/CharCounter.js +51 -73
  163. package/dist/FormElement/CharCounter/CharCounter.styles.js +12 -10
  164. package/dist/FormElement/FormElement.js +53 -31
  165. package/dist/FormElement/FormElement.styles.js +4 -7
  166. package/dist/FormElement/InfoMessage/InfoMessage.js +26 -41
  167. package/dist/FormElement/InfoMessage/InfoMessage.styles.js +11 -9
  168. package/dist/FormElement/Label/Label.js +33 -56
  169. package/dist/FormElement/Label/Label.styles.js +11 -9
  170. package/dist/FormElement/LabelContainer.js +46 -55
  171. package/dist/FormElement/Suggestions/Suggestions.js +46 -71
  172. package/dist/FormElement/Suggestions/Suggestions.styles.js +9 -16
  173. package/dist/FormElement/WarningText/WarningText.js +41 -62
  174. package/dist/FormElement/WarningText/WarningText.styles.js +25 -28
  175. package/dist/FormElement/context.js +6 -10
  176. package/dist/FormElement/utils.js +54 -58
  177. package/dist/GlobalActions/GlobalActions.js +53 -59
  178. package/dist/GlobalActions/GlobalActions.styles.js +67 -76
  179. package/dist/Grid/Grid.js +82 -112
  180. package/dist/Grid/Grid.styles.js +37 -38
  181. package/dist/Header/Actions/Actions.js +15 -17
  182. package/dist/Header/Actions/Actions.styles.js +12 -15
  183. package/dist/Header/Brand/Brand.js +27 -23
  184. package/dist/Header/Brand/Brand.styles.js +16 -14
  185. package/dist/Header/Header.js +22 -31
  186. package/dist/Header/Header.styles.js +32 -30
  187. package/dist/Header/Navigation/MenuBar/Bar.js +23 -36
  188. package/dist/Header/Navigation/MenuBar/Bar.styles.js +54 -61
  189. package/dist/Header/Navigation/MenuBar/MenuBar.js +20 -26
  190. package/dist/Header/Navigation/MenuItem/MenuItem.js +104 -120
  191. package/dist/Header/Navigation/MenuItem/MenuItem.styles.js +48 -63
  192. package/dist/Header/Navigation/Navigation.js +32 -37
  193. package/dist/Header/Navigation/Navigation.styles.js +11 -17
  194. package/dist/Header/Navigation/useSelectionPath.js +17 -20
  195. package/dist/Header/Navigation/utils/FocusContext.js +23 -20
  196. package/dist/Header/Navigation/utils/SelectionContext.js +4 -4
  197. package/dist/IconButton/IconButton.js +25 -32
  198. package/dist/IconContainer/IconContainer.js +55 -76
  199. package/dist/InlineEditor/InlineEditor.js +105 -131
  200. package/dist/InlineEditor/InlineEditor.styles.js +44 -53
  201. package/dist/Input/Input.js +385 -461
  202. package/dist/Input/Input.styles.js +34 -47
  203. package/dist/Input/icons.js +16 -21
  204. package/dist/Input/utils.js +8 -11
  205. package/dist/List/List.js +196 -247
  206. package/dist/List/List.styles.js +44 -49
  207. package/dist/List/useSelectableList.js +11 -8
  208. package/dist/List/utils.js +24 -33
  209. package/dist/ListContainer/ListContainer.js +52 -65
  210. package/dist/ListContainer/ListContainer.styles.js +7 -10
  211. package/dist/ListContainer/ListContext/ListContext.js +4 -4
  212. package/dist/ListContainer/ListItem/ListItem.js +79 -117
  213. package/dist/ListContainer/ListItem/ListItem.styles.js +57 -78
  214. package/dist/Loading/Loading.js +31 -46
  215. package/dist/Loading/Loading.styles.js +41 -48
  216. package/dist/LoadingContainer/LoadingContainer.js +34 -40
  217. package/dist/LoadingContainer/LoadingContainer.styles.js +17 -18
  218. package/dist/Login/Login.js +22 -29
  219. package/dist/Login/Login.styles.js +20 -21
  220. package/dist/MultiButton/MultiButton.js +41 -59
  221. package/dist/MultiButton/MultiButton.styles.js +117 -137
  222. package/dist/NumberInput/NumberInput.js +51 -50
  223. package/dist/NumberInput/NumberInput.styles.js +5 -10
  224. package/dist/OverflowTooltip/OverflowTooltip.js +55 -75
  225. package/dist/OverflowTooltip/OverflowTooltip.styles.js +19 -23
  226. package/dist/Pagination/Pagination.js +176 -164
  227. package/dist/Pagination/Pagination.styles.js +86 -90
  228. package/dist/Pagination/Select.js +51 -60
  229. package/dist/Pagination/Select.styles.js +13 -19
  230. package/dist/Panel/Panel.js +19 -20
  231. package/dist/Panel/Panel.styles.js +12 -15
  232. package/dist/ProgressBar/ProgressBar.js +40 -53
  233. package/dist/ProgressBar/ProgressBar.styles.js +28 -40
  234. package/dist/QueryBuilder/ConfirmationDialog.js +35 -28
  235. package/dist/QueryBuilder/Context.js +308 -322
  236. package/dist/QueryBuilder/QueryBuilder.js +108 -137
  237. package/dist/QueryBuilder/QueryBuilder.styles.js +117 -108
  238. package/dist/QueryBuilder/Rule/Attribute.js +56 -63
  239. package/dist/QueryBuilder/Rule/Operator.js +53 -58
  240. package/dist/QueryBuilder/Rule/Rule.js +70 -88
  241. package/dist/QueryBuilder/Rule/Rule.styles.js +49 -56
  242. package/dist/QueryBuilder/RuleGroup.js +160 -206
  243. package/dist/QueryBuilder/Value/BooleanValue.js +38 -37
  244. package/dist/QueryBuilder/Value/DateTimeValue.js +233 -299
  245. package/dist/QueryBuilder/Value/EmptyValue.js +14 -14
  246. package/dist/QueryBuilder/Value/NumericValue.js +152 -204
  247. package/dist/QueryBuilder/Value/TextValue.js +38 -54
  248. package/dist/QueryBuilder/Value/Value.js +42 -67
  249. package/dist/QueryBuilder/types.js +4 -4
  250. package/dist/QueryBuilder/utils/index.js +40 -74
  251. package/dist/QueryBuilder/utils/reducer.js +86 -92
  252. package/dist/Radio/Radio.js +96 -145
  253. package/dist/Radio/Radio.styles.js +47 -55
  254. package/dist/RadioGroup/RadioGroup.js +98 -159
  255. package/dist/RadioGroup/RadioGroup.styles.js +28 -34
  256. package/dist/ScrollToHorizontal/HorizontalScrollListItem/HorizontalScrollListItem.js +34 -51
  257. package/dist/ScrollToHorizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.js +39 -48
  258. package/dist/ScrollToHorizontal/ScrollToHorizontal.js +56 -91
  259. package/dist/ScrollToHorizontal/ScrollToHorizontal.styles.js +28 -32
  260. package/dist/ScrollToVertical/ScrollToVertical.js +45 -77
  261. package/dist/ScrollToVertical/ScrollToVertical.styles.js +31 -38
  262. package/dist/ScrollToVertical/VerticalScrollListItem/VerticalScrollListItem.js +30 -39
  263. package/dist/ScrollToVertical/VerticalScrollListItem/VerticalScrollListItem.styles.js +44 -51
  264. package/dist/SearchInput/SearchInput.js +27 -25
  265. package/dist/SearchInput/SearchInput.styles.js +6 -7
  266. package/dist/Section/Section.js +69 -104
  267. package/dist/Section/Section.styles.js +53 -57
  268. package/dist/Select/Option.js +29 -46
  269. package/dist/Select/OptionGroup.js +18 -30
  270. package/dist/Select/Select.js +163 -219
  271. package/dist/Select/Select.styles.js +26 -32
  272. package/dist/SelectionList/SelectionList.js +162 -216
  273. package/dist/SelectionList/SelectionList.styles.js +36 -36
  274. package/dist/SimpleGrid/SimpleGrid.js +16 -27
  275. package/dist/SimpleGrid/SimpleGrid.styles.js +28 -39
  276. package/dist/Skeleton/Skeleton.js +26 -44
  277. package/dist/Skeleton/Skeleton.styles.js +43 -66
  278. package/dist/Slider/Slider.js +316 -431
  279. package/dist/Slider/Slider.styles.js +183 -216
  280. package/dist/Slider/SliderInput/SliderInput.js +38 -57
  281. package/dist/Slider/SliderInput/SliderInput.styles.js +13 -14
  282. package/dist/Slider/base.js +221 -243
  283. package/dist/Slider/utils.js +247 -233
  284. package/dist/Snackbar/Snackbar.js +59 -88
  285. package/dist/Snackbar/Snackbar.styles.js +25 -42
  286. package/dist/Snackbar/SnackbarContent/SnackbarContent.js +31 -50
  287. package/dist/Snackbar/SnackbarContent/SnackbarContent.styles.js +27 -30
  288. package/dist/SnackbarProvider/SnackbarProvider.js +73 -105
  289. package/dist/SnackbarProvider/SnackbarProvider.styles.js +20 -26
  290. package/dist/Stack/Stack.js +74 -84
  291. package/dist/Stack/Stack.styles.js +14 -33
  292. package/dist/StatusIcon/StatusIcon.js +78 -102
  293. package/dist/StatusIcon/StatusIcon.styles.js +42 -52
  294. package/dist/Switch/Switch.js +91 -138
  295. package/dist/Switch/Switch.styles.js +49 -60
  296. package/dist/Table/Table.js +62 -66
  297. package/dist/Table/Table.styles.js +23 -28
  298. package/dist/Table/TableBody/TableBody.js +45 -56
  299. package/dist/Table/TableBody/TableBody.styles.js +8 -7
  300. package/dist/Table/TableCell/TableCell.js +37 -66
  301. package/dist/Table/TableCell/TableCell.styles.js +125 -162
  302. package/dist/Table/TableContainer/TableContainer.js +18 -28
  303. package/dist/Table/TableContainer/TableContainer.styles.js +8 -12
  304. package/dist/Table/TableContext.js +4 -4
  305. package/dist/Table/TableHead/TableHead.js +27 -39
  306. package/dist/Table/TableHead/TableHead.styles.js +10 -7
  307. package/dist/Table/TableHeader/TableHeader.js +73 -124
  308. package/dist/Table/TableHeader/TableHeader.styles.js +135 -150
  309. package/dist/Table/TableHeader/utils.js +11 -15
  310. package/dist/Table/TableRow/TableRow.js +32 -51
  311. package/dist/Table/TableRow/TableRow.styles.js +64 -84
  312. package/dist/Table/TableSection/TableSection.js +21 -20
  313. package/dist/Table/TableSection/TableSection.styles.js +63 -96
  314. package/dist/Table/TableSectionContext.js +4 -4
  315. package/dist/Table/hooks/useHvBulkActions.js +54 -89
  316. package/dist/Table/hooks/useHvFilters.js +4 -4
  317. package/dist/Table/hooks/useHvGlobalFilter.js +4 -4
  318. package/dist/Table/hooks/useHvHeaderGroups.js +73 -82
  319. package/dist/Table/hooks/useHvPagination.js +31 -51
  320. package/dist/Table/hooks/useHvResizeColumns.js +25 -31
  321. package/dist/Table/hooks/useHvRowExpand.js +54 -69
  322. package/dist/Table/hooks/useHvRowSelection.js +294 -420
  323. package/dist/Table/hooks/useHvRowState.js +4 -4
  324. package/dist/Table/hooks/useHvSortBy.js +23 -30
  325. package/dist/Table/hooks/useHvSticky.js +114 -154
  326. package/dist/Table/hooks/useHvTable.js +40 -64
  327. package/dist/Table/hooks/useHvTableStyles.js +51 -82
  328. package/dist/Table/renderers/DateColumnCell.js +12 -13
  329. package/dist/Table/renderers/DefaultCell.js +13 -20
  330. package/dist/Table/renderers/DropdownColumnCell.js +4 -4
  331. package/dist/Table/renderers/ProgressColumnCell.js +43 -47
  332. package/dist/Table/renderers/SwitchColumnCell.js +37 -50
  333. package/dist/Table/renderers/renderers.js +146 -183
  334. package/dist/Tabs/Tab/Tab.js +21 -31
  335. package/dist/Tabs/Tab/Tab.styles.js +44 -54
  336. package/dist/Tabs/Tabs.js +23 -28
  337. package/dist/Tabs/Tabs.styles.js +9 -14
  338. package/dist/Tag/Tag.js +86 -129
  339. package/dist/Tag/Tag.styles.js +63 -88
  340. package/dist/TagsInput/TagsInput.js +349 -417
  341. package/dist/TagsInput/TagsInput.styles.js +77 -90
  342. package/dist/TextArea/TextArea.js +207 -274
  343. package/dist/TextArea/TextArea.styles.js +25 -20
  344. package/dist/TimeAgo/TimeAgo.js +24 -30
  345. package/dist/TimeAgo/TimeAgo.styles.js +4 -7
  346. package/dist/TimeAgo/formatUtils.js +54 -65
  347. package/dist/TimeAgo/useTimeAgo.js +18 -18
  348. package/dist/TimeAgo/useTimeout.js +14 -14
  349. package/dist/TimePicker/Placeholder.js +46 -52
  350. package/dist/TimePicker/TimePicker.js +164 -214
  351. package/dist/TimePicker/TimePicker.styles.js +30 -39
  352. package/dist/TimePicker/Unit/Unit.js +63 -49
  353. package/dist/TimePicker/Unit/Unit.styles.js +41 -46
  354. package/dist/ToggleButton/ToggleButton.js +25 -34
  355. package/dist/Tooltip/Tooltip.js +41 -51
  356. package/dist/Tooltip/Tooltip.styles.js +25 -26
  357. package/dist/TreeView/TreeItem/DefaultContent.js +51 -72
  358. package/dist/TreeView/TreeItem/TreeItem.js +102 -140
  359. package/dist/TreeView/TreeItem/TreeItem.styles.js +56 -70
  360. package/dist/TreeView/TreeItem/useHvTreeItem.js +38 -53
  361. package/dist/TreeView/TreeView.js +65 -62
  362. package/dist/TreeView/TreeView.styles.js +11 -13
  363. package/dist/TreeView/internals/DescendantProvider.js +120 -120
  364. package/dist/TreeView/internals/TreeViewProvider.js +32 -26
  365. package/dist/TreeView/internals/corePlugins.js +8 -4
  366. package/dist/TreeView/internals/hooks/plugins/defaultPlugins.js +10 -10
  367. package/dist/TreeView/internals/hooks/plugins/useTreeViewContextValueBuilder.js +20 -22
  368. package/dist/TreeView/internals/hooks/plugins/useTreeViewExpansion.js +39 -61
  369. package/dist/TreeView/internals/hooks/plugins/useTreeViewFocus.js +56 -80
  370. package/dist/TreeView/internals/hooks/plugins/useTreeViewKeyboardNavigation.js +149 -211
  371. package/dist/TreeView/internals/hooks/plugins/useTreeViewNodes.js +42 -68
  372. package/dist/TreeView/internals/hooks/plugins/useTreeViewSelection.js +162 -195
  373. package/dist/TreeView/internals/hooks/useInstanceEventHandler.js +52 -74
  374. package/dist/TreeView/internals/hooks/useTreeView.js +54 -69
  375. package/dist/TreeView/internals/hooks/useTreeViewInstanceEvents.js +28 -33
  376. package/dist/TreeView/internals/hooks/useTreeViewModels.js +34 -43
  377. package/dist/TreeView/internals/hooks/utils.js +28 -42
  378. package/dist/TreeView/internals/utils/EventManager.js +49 -58
  379. package/dist/TreeView/internals/utils/FinalizationRegistryBasedCleanupTracking.js +14 -18
  380. package/dist/TreeView/internals/utils/TimerBasedCleanupTracking.js +33 -37
  381. package/dist/TreeView/internals/utils/publishTreeViewEvent.js +5 -5
  382. package/dist/Typography/Typography.js +34 -51
  383. package/dist/Typography/Typography.styles.js +20 -23
  384. package/dist/VerticalNavigation/Actions/Action.js +23 -42
  385. package/dist/VerticalNavigation/Actions/Action.styles.js +21 -28
  386. package/dist/VerticalNavigation/Actions/Actions.js +15 -31
  387. package/dist/VerticalNavigation/Actions/Actions.styles.js +13 -19
  388. package/dist/VerticalNavigation/Header/Header.js +51 -91
  389. package/dist/VerticalNavigation/Header/Header.styles.js +22 -32
  390. package/dist/VerticalNavigation/Navigation/Navigation.js +183 -267
  391. package/dist/VerticalNavigation/Navigation/Navigation.styles.js +14 -24
  392. package/dist/VerticalNavigation/NavigationPopup/NavigationPopup.styles.js +9 -17
  393. package/dist/VerticalNavigation/NavigationPopup/NavigationPopupContainer.js +30 -32
  394. package/dist/VerticalNavigation/NavigationSlider/NavigationSlider.js +45 -63
  395. package/dist/VerticalNavigation/NavigationSlider/NavigationSlider.styles.js +23 -33
  396. package/dist/VerticalNavigation/NavigationSlider/utils.js +56 -39
  397. package/dist/VerticalNavigation/TreeView/TreeView.js +515 -664
  398. package/dist/VerticalNavigation/TreeView/TreeView.styles.js +10 -16
  399. package/dist/VerticalNavigation/TreeView/TreeViewContext.js +5 -6
  400. package/dist/VerticalNavigation/TreeView/TreeViewItem.js +319 -414
  401. package/dist/VerticalNavigation/TreeView/TreeViewItem.styles.js +91 -143
  402. package/dist/VerticalNavigation/VerticalNavigation.js +70 -97
  403. package/dist/VerticalNavigation/VerticalNavigation.styles.js +31 -45
  404. package/dist/VerticalNavigation/VerticalNavigationContext.js +8 -10
  405. package/dist/hooks/useClickOutside.js +21 -23
  406. package/dist/hooks/useComputation.js +13 -13
  407. package/dist/hooks/useControlled.js +10 -17
  408. package/dist/hooks/useEnhancedEffect.js +5 -5
  409. package/dist/hooks/useExpandable.js +24 -31
  410. package/dist/hooks/useFocus.js +31 -34
  411. package/dist/hooks/useForkRef.js +19 -19
  412. package/dist/hooks/useImageLoaded.js +26 -26
  413. package/dist/hooks/useIsMounted.js +13 -13
  414. package/dist/hooks/useLabels.js +7 -7
  415. package/dist/hooks/useScrollTo.js +101 -130
  416. package/dist/hooks/useUniqueId.js +6 -6
  417. package/dist/hooks/useWidth.js +10 -13
  418. package/dist/icons.js +77 -88
  419. package/dist/index.d.ts +9 -10
  420. package/dist/index.js +226 -554
  421. package/dist/providers/Provider.js +44 -75
  422. package/dist/providers/ThemeProvider.js +79 -71
  423. package/dist/providers/utils.js +40 -47
  424. package/dist/themes/index.js +6 -5
  425. package/dist/themes/next.js +132 -271
  426. package/dist/themes/pentaho.js +832 -1173
  427. package/dist/types/generic.js +5 -4
  428. package/dist/utils/Callout.js +123 -171
  429. package/dist/utils/CounterLabel.js +14 -15
  430. package/dist/utils/deepMerge.js +13 -15
  431. package/dist/utils/document.js +8 -8
  432. package/dist/utils/focusUtils.js +6 -7
  433. package/dist/utils/focusableElementFinder.js +23 -26
  434. package/dist/utils/helpers.js +15 -23
  435. package/dist/utils/iconVariant.js +15 -12
  436. package/dist/utils/keyboardUtils.js +28 -28
  437. package/dist/utils/multiSelectionEventHandler.js +37 -52
  438. package/dist/utils/scroll.js +50 -76
  439. package/dist/utils/setId.js +4 -4
  440. package/dist/utils/theme.js +11 -8
  441. package/dist/utils/useSavedState.js +19 -16
  442. package/package.json +25 -12
@@ -1,70 +1,55 @@
1
- import { createClasses } from "@hitachivantara/uikit-react-utils";
2
1
  import { theme } from "@hitachivantara/uikit-styles";
3
- const { staticClasses, useClasses } = createClasses("HvSingleCalendar", {
4
- root: {
5
- overflow: "hidden"
6
- },
7
- calendarGrid: {
8
- display: "grid",
9
- gridTemplateColumns: "repeat(7, 1fr)",
10
- "& $cellsInRange": {
11
- backgroundColor: theme.colors.bgPageSecondary,
12
- "& $startBookend": {
13
- borderLeft: `1px solid ${theme.colors.text}`,
14
- backgroundColor: theme.colors.bgPageSecondary,
15
- "&:hover": {
16
- borderRight: `1px solid ${theme.colors.text}`
17
- }
18
- }
19
- },
20
- "&:hover $cellsInRange": {
21
- backgroundColor: theme.colors.bgPageSecondary,
22
- "& $startBookend": {
23
- borderLeft: `1px solid ${theme.colors.text}`,
24
- borderRight: "inherit"
25
- }
26
- },
27
- "& $cellsInRange:hover": {
28
- backgroundColor: theme.colors.bgPageSecondary,
29
- "& $calendarDate": {
30
- borderRight: `2px solid ${theme.colors.text}`
31
- }
32
- },
33
- "& $cellsInRange:hover ~ $cellsInRange": {
34
- backgroundColor: theme.colors.bgContainer
35
- // controls the right side of the hovered range
36
- },
37
- "& $cellsOutsideRange:hover ~ $cellsInRange": {
38
- backgroundColor: theme.colors.bgContainer
39
- // control the right side when hovering outside of the range
40
- }
41
- },
42
- calendarDay: {
43
- display: "flex",
44
- justifyContent: "center",
45
- flexDirection: "column",
46
- textAlign: "center",
47
- height: "40px",
48
- width: "40px"
49
- },
50
- navigationContainer: {},
51
- focusSelection: {},
52
- navigationMonth: {},
53
- calendarDate: {},
54
- calendarDateNotInMonth: {},
55
- calendarDateSelected: {},
56
- calendarDateInvalid: {},
57
- calendarDateInSelectionRange: {},
58
- startBookend: {},
59
- endBookend: {},
60
- cellsInRange: {
61
- backgroundColor: theme.colors.bgPageSecondary
62
- },
63
- cellsOutsideRange: {},
64
- cellContainer: {},
65
- weekdays: {}
2
+ import { createClasses } from "@hitachivantara/uikit-react-utils";
3
+ //#region src/Calendar/SingleCalendar/SingleCalendar.styles.tsx
4
+ var { staticClasses, useClasses } = createClasses("HvSingleCalendar", {
5
+ root: { overflow: "hidden" },
6
+ calendarGrid: {
7
+ display: "grid",
8
+ gridTemplateColumns: "repeat(7, 1fr)",
9
+ "& $cellsInRange": {
10
+ backgroundColor: theme.colors.bgPageSecondary,
11
+ "& $startBookend": {
12
+ borderLeft: `1px solid ${theme.colors.text}`,
13
+ backgroundColor: theme.colors.bgPageSecondary,
14
+ "&:hover": { borderRight: `1px solid ${theme.colors.text}` }
15
+ }
16
+ },
17
+ "&:hover $cellsInRange": {
18
+ backgroundColor: theme.colors.bgPageSecondary,
19
+ "& $startBookend": {
20
+ borderLeft: `1px solid ${theme.colors.text}`,
21
+ borderRight: "inherit"
22
+ }
23
+ },
24
+ "& $cellsInRange:hover": {
25
+ backgroundColor: theme.colors.bgPageSecondary,
26
+ "& $calendarDate": { borderRight: `2px solid ${theme.colors.text}` }
27
+ },
28
+ "& $cellsInRange:hover ~ $cellsInRange": { backgroundColor: theme.colors.bgContainer },
29
+ "& $cellsOutsideRange:hover ~ $cellsInRange": { backgroundColor: theme.colors.bgContainer }
30
+ },
31
+ calendarDay: {
32
+ display: "flex",
33
+ justifyContent: "center",
34
+ flexDirection: "column",
35
+ textAlign: "center",
36
+ height: "40px",
37
+ width: "40px"
38
+ },
39
+ navigationContainer: {},
40
+ focusSelection: {},
41
+ navigationMonth: {},
42
+ calendarDate: {},
43
+ calendarDateNotInMonth: {},
44
+ calendarDateSelected: {},
45
+ calendarDateInvalid: {},
46
+ calendarDateInSelectionRange: {},
47
+ startBookend: {},
48
+ endBookend: {},
49
+ cellsInRange: { backgroundColor: theme.colors.bgPageSecondary },
50
+ cellsOutsideRange: {},
51
+ cellContainer: {},
52
+ weekdays: {}
66
53
  });
67
- export {
68
- staticClasses,
69
- useClasses
70
- };
54
+ //#endregion
55
+ export { useClasses };
@@ -1,66 +1,49 @@
1
1
  import { createDatesArray, isRange } from "./utils.js";
2
- class CalendarModel {
3
- month;
4
- year;
5
- dates = [];
6
- constructor(month, year) {
7
- this.updateModel(month, year);
8
- }
9
- /**
10
- * Updates the model with the received month and year
11
- *
12
- * @param month - Number of the month (1 to 12).
13
- * @param year - Number of the year.
14
- * @memberof CalendarModel
15
- */
16
- updateModel = (month, year) => {
17
- let validMonth = month;
18
- let validYear = year;
19
- if (!Number.isInteger(validMonth)) {
20
- validMonth = (/* @__PURE__ */ new Date()).getMonth() + 1;
21
- }
22
- if (!Number.isInteger(validYear)) {
23
- validYear = (/* @__PURE__ */ new Date()).getFullYear();
24
- }
25
- this.month = validMonth;
26
- this.year = validYear;
27
- this.dates = createDatesArray(validMonth, validYear);
28
- };
29
- }
30
- const generateModelFromDate = (seedValue) => {
31
- let calendarModel;
32
- if (typeof seedValue === "string") {
33
- const today = /* @__PURE__ */ new Date();
34
- calendarModel = new CalendarModel(
35
- today.getMonth() + 1,
36
- today.getFullYear()
37
- );
38
- } else if (isRange(seedValue)) {
39
- calendarModel = new CalendarModel(
40
- seedValue.startDate.getMonth() + 1,
41
- seedValue.startDate.getFullYear()
42
- );
43
- } else {
44
- calendarModel = new CalendarModel(
45
- seedValue.getMonth() + 1,
46
- seedValue.getFullYear()
47
- );
48
- }
49
- return calendarModel;
2
+ //#region src/Calendar/model.ts
3
+ /**
4
+ * Calendar builder for a specific month and year.
5
+ * Returns an array of date objects.
6
+ */
7
+ var CalendarModel = class {
8
+ month;
9
+ year;
10
+ dates = [];
11
+ constructor(month, year) {
12
+ this.updateModel(month, year);
13
+ }
14
+ /**
15
+ * Updates the model with the received month and year
16
+ *
17
+ * @param month - Number of the month (1 to 12).
18
+ * @param year - Number of the year.
19
+ * @memberof CalendarModel
20
+ */
21
+ updateModel = (month, year) => {
22
+ let validMonth = month;
23
+ let validYear = year;
24
+ if (!Number.isInteger(validMonth)) validMonth = (/* @__PURE__ */ new Date()).getMonth() + 1;
25
+ if (!Number.isInteger(validYear)) validYear = (/* @__PURE__ */ new Date()).getFullYear();
26
+ this.month = validMonth;
27
+ this.year = validYear;
28
+ this.dates = createDatesArray(validMonth, validYear);
29
+ };
50
30
  };
51
- const generateCalendarModel = (seedValue, visibleMonth, visibleYear) => {
52
- let calendarModel;
53
- if (visibleMonth && visibleYear) {
54
- calendarModel = new CalendarModel(visibleMonth, visibleYear);
55
- } else if (visibleMonth && !visibleYear) {
56
- calendarModel = new CalendarModel(visibleMonth, seedValue.getFullYear());
57
- } else if (!visibleMonth && visibleYear) {
58
- calendarModel = new CalendarModel(1, visibleYear);
59
- } else {
60
- calendarModel = generateModelFromDate(seedValue);
61
- }
62
- return calendarModel;
31
+ var generateModelFromDate = (seedValue) => {
32
+ let calendarModel;
33
+ if (typeof seedValue === "string") {
34
+ const today = /* @__PURE__ */ new Date();
35
+ calendarModel = new CalendarModel(today.getMonth() + 1, today.getFullYear());
36
+ } else if (isRange(seedValue)) calendarModel = new CalendarModel(seedValue.startDate.getMonth() + 1, seedValue.startDate.getFullYear());
37
+ else calendarModel = new CalendarModel(seedValue.getMonth() + 1, seedValue.getFullYear());
38
+ return calendarModel;
63
39
  };
64
- export {
65
- generateCalendarModel
40
+ var generateCalendarModel = (seedValue, visibleMonth, visibleYear) => {
41
+ let calendarModel;
42
+ if (visibleMonth && visibleYear) calendarModel = new CalendarModel(visibleMonth, visibleYear);
43
+ else if (visibleMonth && !visibleYear) calendarModel = new CalendarModel(visibleMonth, seedValue.getFullYear());
44
+ else if (!visibleMonth && visibleYear) calendarModel = new CalendarModel(1, visibleYear);
45
+ else calendarModel = generateModelFromDate(seedValue);
46
+ return calendarModel;
66
47
  };
48
+ //#endregion
49
+ export { generateCalendarModel };
@@ -1,148 +1,253 @@
1
1
  import { capitalize } from "../utils/helpers.js";
2
- const CALENDAR_WEEKS = 6;
3
- const DEFAULT_LOCALE = "en";
4
- const getMonthDays = (month, year) => new Date(year, month, 0).getDate();
5
- const getMonthFirstWeekday = (month, year) => new Date(year, month - 1, 1).getDay();
6
- const makeUTCDate = (year, monthIndex, day, hour = 1) => new Date(Date.UTC(year, monthIndex, day, hour));
7
- const isDate = (date) => Object.prototype.toString.call(date) === "[object Date]" && !Number.isNaN(date.valueOf());
8
- const isDateRangeProp = (date) => "startDate" in date;
9
- const isSameMonth = (date1, date2) => {
10
- if (!(isDate(date1) && isDate(date2))) return false;
11
- return date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
2
+ /**
3
+ * Returns the number of days in the month given a month and year.
4
+ *
5
+ * @param month - Number of the month (1 to 12).
6
+ * @param year - Number of the year.
7
+ * @returns The number of days in a month for the received year.
8
+ */
9
+ var getMonthDays = (month, year) => new Date(year, month, 0).getDate();
10
+ /**
11
+ * Gets the week day of the first day of a given month and year.
12
+ * From 0 (Sunday) to 6 (Saturday).
13
+ *
14
+ * @param month - Number of the month (1 to 12).
15
+ * @param year - Number of the year.
16
+ * @returns The zero indexed week day where 0 is Sunday (0 to 6).
17
+ */
18
+ var getMonthFirstWeekday = (month, year) => new Date(year, month - 1, 1).getDay();
19
+ /**
20
+ * Creates a `Date` instance in UTC timezone.
21
+ *
22
+ * @param year - The year of the date.
23
+ * @param monthIndex - The zero indexed month of the year (0 to 11).
24
+ * @param day - The day of the month.
25
+ * @param hour - The hour of the day.
26
+ * @returns A `Date` instance in UTC timezone.
27
+ */
28
+ var makeUTCDate = (year, monthIndex, day, hour = 1) => new Date(Date.UTC(year, monthIndex, day, hour));
29
+ /**
30
+ * Checks if the received date is a valid date.
31
+ *
32
+ * @param date - The date to be validated.
33
+ * @returns A flag stating if the date is valid or not.
34
+ */
35
+ var isDate = (date) => Object.prototype.toString.call(date) === "[object Date]" && !Number.isNaN(date.valueOf());
36
+ var isDateRangeProp = (date) => "startDate" in date;
37
+ /**
38
+ * Checks if two dates are in the same month and year.
39
+ *
40
+ * @param date1 - First date.
41
+ * @param date2 - Second date.
42
+ * @returns A flag stating if the dates are in the same month and year or not.
43
+ */
44
+ var isSameMonth = (date1, date2) => {
45
+ if (!(isDate(date1) && isDate(date2))) return false;
46
+ return date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
12
47
  };
13
- const isSameDay = (date1, date2) => {
14
- if (!(isDate(date1) && isDate(date2))) return false;
15
- return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
48
+ /**
49
+ * Checks if two dates are on the same day.
50
+ *
51
+ * @param date1 - First date.
52
+ * @param date2 - Second date.
53
+ * @returns A flag stating if the dates are in the same day or not.
54
+ */
55
+ var isSameDay = (date1, date2) => {
56
+ if (!(isDate(date1) && isDate(date2))) return false;
57
+ return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
16
58
  };
17
- const getDateISO = (date) => {
18
- const d = new Date(date);
19
- const year = d.getFullYear();
20
- const month = String(d.getMonth() + 1).padStart(2, "0");
21
- const day = String(d.getDate()).padStart(2, "0");
22
- return `${year}-${month}-${day}`;
59
+ /**
60
+ * Formats the received date using the ISO format (YYYY-MM-DD).
61
+ *
62
+ * @param date - The date to be formatted.
63
+ * @returns The formatted date in ISO format.
64
+ */
65
+ var getDateISO = (date) => {
66
+ const d = new Date(date);
67
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
23
68
  };
24
- const getPreviousMonth = (month, year) => {
25
- const prevMonth = month > 1 ? month - 1 : 12;
26
- const prevMonthYear = month > 1 ? year : year - 1;
27
- return { month: prevMonth, year: prevMonthYear };
69
+ /**
70
+ * Returns an object with the previous month taking also into consideration the year.
71
+ * For example the previous month of January 2000 will be December 1999.
72
+ *
73
+ * @param month - Number of the month.
74
+ * @param year - Number of the year.
75
+ * @returns Object with new month and year defined.
76
+ */
77
+ var getPreviousMonth = (month, year) => {
78
+ return {
79
+ month: month > 1 ? month - 1 : 12,
80
+ year: month > 1 ? year : year - 1
81
+ };
28
82
  };
29
- const getNextMonth = (month, year) => {
30
- const nextMonth = month < 12 ? month + 1 : 1;
31
- const nextMonthYear = month < 12 ? year : year + 1;
32
- return { month: nextMonth, year: nextMonthYear };
83
+ /**
84
+ * Returns an object with the next month taking also into consideration the year.
85
+ * For example the next month of December 2000 will be January 2001.
86
+ *
87
+ * @param month - Number of the month.
88
+ * @param year - Number of the year.
89
+ * @returns Object with new month and year defined.
90
+ */
91
+ var getNextMonth = (month, year) => {
92
+ return {
93
+ month: month < 12 ? month + 1 : 1,
94
+ year: month < 12 ? year : year + 1
95
+ };
33
96
  };
34
- const getMonthNamesList = (locale, representationValue = "long") => {
35
- const options = { month: representationValue, timeZone: "UTC" };
36
- return [...Array(12).keys()].map((index) => {
37
- const auxDate = makeUTCDate(1970, index, 1);
38
- return capitalize(Intl.DateTimeFormat(locale, options).format(auxDate));
39
- });
97
+ /**
98
+ * Returns a list with the names of all the months localized in the received locale and representation value.
99
+ *
100
+ * @param locale - The locale to be applied to the Intl format.
101
+ * @param representationValue - The representation value for the month.
102
+ * @returns An array with all the months names.
103
+ */
104
+ var getMonthNamesList = (locale, representationValue = "long") => {
105
+ const options = {
106
+ month: representationValue,
107
+ timeZone: "UTC"
108
+ };
109
+ return [...Array(12).keys()].map((index) => {
110
+ const auxDate = makeUTCDate(1970, index, 1);
111
+ return capitalize(Intl.DateTimeFormat(locale, options).format(auxDate));
112
+ });
40
113
  };
41
- const getWeekdayNamesList = (locale) => {
42
- const formatter = new Intl.DateTimeFormat(locale, {
43
- weekday: "narrow",
44
- timeZone: "UTC"
45
- });
46
- return [...Array(7).keys()].map((index) => {
47
- return formatter.format(makeUTCDate(1970, 0, 4 + index));
48
- });
114
+ /**
115
+ * Returns a list with the names of all the weekdays localized in the received locale and representation value.
116
+ *
117
+ * @param locale - The locale to be applied.
118
+ * @returns An array with all the weekday names.
119
+ */
120
+ var getWeekdayNamesList = (locale) => {
121
+ const formatter = new Intl.DateTimeFormat(locale, {
122
+ weekday: "narrow",
123
+ timeZone: "UTC"
124
+ });
125
+ return [...Array(7).keys()].map((index) => {
126
+ return formatter.format(makeUTCDate(1970, 0, 4 + index));
127
+ });
49
128
  };
50
- const getMonthName = (date, locale, representationValue = "long") => new Intl.DateTimeFormat(locale, { month: representationValue }).format(date);
51
- const getFormattedDate = (date, locale) => {
52
- const formatter = new Intl.DateTimeFormat(locale, { dateStyle: "medium" });
53
- return formatter.format(date);
129
+ /**
130
+ * Returns the name of the month for the supplied month localized in the received locale and representation value.
131
+ *
132
+ * @param date - The date from which the month name is extracted.
133
+ * @param locale - The locale to be applied to the Intl format.
134
+ * @param representationValue - The locale to be applied to the Intl format.
135
+ * @returns The name of the month.
136
+ */
137
+ var getMonthName = (date, locale, representationValue = "long") => new Intl.DateTimeFormat(locale, { month: representationValue }).format(date);
138
+ /**
139
+ * Formats the received date according to the user's locale & Design System specifications.
140
+ *
141
+ * @param date - UTC date to be formatted.
142
+ * @param locale - The locale to be applied to the Intl format.
143
+ * @returns The formatted date as a string.
144
+ */
145
+ var getFormattedDate = (date, locale) => {
146
+ return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date);
54
147
  };
55
- const createDatesArray = (month, year) => {
56
- const monthDays = getMonthDays(month, year);
57
- const daysFromPrevMonth = getMonthFirstWeekday(month, year);
58
- const daysFromNextMonth = CALENDAR_WEEKS * 7 - (daysFromPrevMonth + monthDays);
59
- const prevMonthYear = getPreviousMonth(month, year);
60
- const nextMonthYear = getNextMonth(month, year);
61
- const prevMonthDays = getMonthDays(prevMonthYear.month, prevMonthYear.year);
62
- const prevMonthDates = [...Array(daysFromPrevMonth).keys()].map((index) => {
63
- const day = index + 1 + (prevMonthDays - daysFromPrevMonth);
64
- return new Date(prevMonthYear.year, prevMonthYear.month - 1, day);
65
- });
66
- const currentMonthDates = [...Array(monthDays).keys()].map((index) => {
67
- const day = index + 1;
68
- return new Date(year, month - 1, day);
69
- });
70
- const nextMonthDates = [...Array(daysFromNextMonth).keys()].map((index) => {
71
- const day = index + 1;
72
- return new Date(nextMonthYear.year, nextMonthYear.month - 1, day);
73
- });
74
- return [...prevMonthDates, ...currentMonthDates, ...nextMonthDates];
148
+ /**
149
+ * Creates an array of 42 days. The complete current month and enough days from the previous and next months to fill
150
+ * the 42 positions.
151
+ *
152
+ * @param month - The number of the month (1 to 12).
153
+ * @param year - The number of the year.
154
+ * @returns The array of dates.
155
+ */
156
+ var createDatesArray = (month, year) => {
157
+ const monthDays = getMonthDays(month, year);
158
+ const daysFromPrevMonth = getMonthFirstWeekday(month, year);
159
+ const daysFromNextMonth = 42 - (daysFromPrevMonth + monthDays);
160
+ const prevMonthYear = getPreviousMonth(month, year);
161
+ const nextMonthYear = getNextMonth(month, year);
162
+ const prevMonthDays = getMonthDays(prevMonthYear.month, prevMonthYear.year);
163
+ const prevMonthDates = [...Array(daysFromPrevMonth).keys()].map((index) => {
164
+ const day = index + 1 + (prevMonthDays - daysFromPrevMonth);
165
+ return new Date(prevMonthYear.year, prevMonthYear.month - 1, day);
166
+ });
167
+ const currentMonthDates = [...Array(monthDays).keys()].map((index) => {
168
+ const day = index + 1;
169
+ return new Date(year, month - 1, day);
170
+ });
171
+ const nextMonthDates = [...Array(daysFromNextMonth).keys()].map((index) => {
172
+ const day = index + 1;
173
+ return new Date(nextMonthYear.year, nextMonthYear.month - 1, day);
174
+ });
175
+ return [
176
+ ...prevMonthDates,
177
+ ...currentMonthDates,
178
+ ...nextMonthDates
179
+ ];
75
180
  };
76
- const isRange = (date) => date != null && typeof date === "object" && "startDate" in date;
77
- const dateInProvidedValueRange = (date, dateRange) => {
78
- if (!isRange(dateRange) || !dateRange?.endDate) return false;
79
- const { startDate, endDate } = dateRange;
80
- const modStartDate = getDateISO(startDate);
81
- const modEndDate = getDateISO(endDate);
82
- const convertedDate = getDateISO(date ?? /* @__PURE__ */ new Date());
83
- return convertedDate >= modStartDate && convertedDate <= modEndDate;
181
+ var isRange = (date) => date != null && typeof date === "object" && "startDate" in date;
182
+ /**
183
+ * Checks if the date falls within a specified date range.
184
+ *
185
+ * @param date - The date to be evaluated.
186
+ * @param dateRange - Provided selection range.
187
+ * @returns - True if the date falls within the range, false otherwise.
188
+ */
189
+ var dateInProvidedValueRange = (date, dateRange) => {
190
+ if (!isRange(dateRange) || !dateRange?.endDate) return false;
191
+ const { startDate, endDate } = dateRange;
192
+ const modStartDate = getDateISO(startDate);
193
+ const modEndDate = getDateISO(endDate);
194
+ const convertedDate = getDateISO(date ?? /* @__PURE__ */ new Date());
195
+ return convertedDate >= modStartDate && convertedDate <= modEndDate;
84
196
  };
85
- const checkIfDateIsDisabled = (date, minimumDate, maximumDate) => {
86
- if (!minimumDate && !maximumDate) return false;
87
- const modStartDate = minimumDate && getDateISO(minimumDate);
88
- const modEndDate = maximumDate && getDateISO(maximumDate);
89
- const convertedDate = getDateISO(date ?? /* @__PURE__ */ new Date());
90
- return modStartDate !== void 0 && convertedDate < modStartDate || modEndDate !== void 0 && convertedDate > modEndDate;
197
+ var checkIfDateIsDisabled = (date, minimumDate, maximumDate) => {
198
+ if (!minimumDate && !maximumDate) return false;
199
+ const modStartDate = minimumDate && getDateISO(minimumDate);
200
+ const modEndDate = maximumDate && getDateISO(maximumDate);
201
+ const convertedDate = getDateISO(date ?? /* @__PURE__ */ new Date());
202
+ return modStartDate !== void 0 && convertedDate < modStartDate || modEndDate !== void 0 && convertedDate > modEndDate;
91
203
  };
204
+ /**
205
+ * gets the *localized* date formatter that's editable via input
206
+ * @example getEditableDateFormatter("pt") // "DD/MM/YYYY"
207
+ */
92
208
  function getEditableDateFormatter(locale) {
93
- return new Intl.DateTimeFormat(locale, {
94
- year: "numeric",
95
- month: "2-digit",
96
- day: "2-digit"
97
- });
209
+ return new Intl.DateTimeFormat(locale, {
210
+ year: "numeric",
211
+ month: "2-digit",
212
+ day: "2-digit"
213
+ });
98
214
  }
99
215
  function getStringFromDate(date, locale) {
100
- return getEditableDateFormatter(locale).format(date);
216
+ return getEditableDateFormatter(locale).format(date);
101
217
  }
218
+ /**
219
+ * attempts to format a localized `dateString`
220
+ * @returns `Date` or `null` if parsing fails
221
+ * @example parseDateString("04/06/2020", "pt")
222
+ */
102
223
  function parseDateString(dateString, locale) {
103
- const dateParts = dateString.split(/\D+/).map(Number);
104
- if (dateParts.length !== 3) return null;
105
- if (!dateParts.every(Boolean)) return null;
106
- const formatter = getEditableDateFormatter(locale);
107
- const formatOrder = formatter.formatToParts(new Date(2020, 4, 4)).filter((part) => ["year", "month", "day"].includes(part.type)).map((part) => part.type);
108
- const dateObject = { year: 2020, month: 4, day: 4 };
109
- formatOrder.forEach((type, index) => {
110
- dateObject[type] = dateParts[index];
111
- });
112
- return new Date(dateObject.year, dateObject.month - 1, dateObject.day);
224
+ const dateParts = dateString.split(/\D+/).map(Number);
225
+ if (dateParts.length !== 3) return null;
226
+ if (!dateParts.every(Boolean)) return null;
227
+ const formatOrder = getEditableDateFormatter(locale).formatToParts(new Date(2020, 4, 4)).filter((part) => [
228
+ "year",
229
+ "month",
230
+ "day"
231
+ ].includes(part.type)).map((part) => part.type);
232
+ const dateObject = {
233
+ year: 2020,
234
+ month: 4,
235
+ day: 4
236
+ };
237
+ formatOrder.forEach((type, index) => {
238
+ dateObject[type] = dateParts[index];
239
+ });
240
+ return new Date(dateObject.year, dateObject.month - 1, dateObject.day);
113
241
  }
114
242
  function getLocaleDateFormat(locale) {
115
- const formatter = getEditableDateFormatter(locale);
116
- const getPartType = (part) => {
117
- if (part.type === "year") return "YYYY";
118
- if (part.type === "month") return "MM";
119
- if (part.type === "day") return "DD";
120
- return part.value;
121
- };
122
- return formatter.formatToParts(new Date(2020, 4, 4)).reduce((acc, part) => acc + getPartType(part), "");
243
+ const formatter = getEditableDateFormatter(locale);
244
+ const getPartType = (part) => {
245
+ if (part.type === "year") return "YYYY";
246
+ if (part.type === "month") return "MM";
247
+ if (part.type === "day") return "DD";
248
+ return part.value;
249
+ };
250
+ return formatter.formatToParts(new Date(2020, 4, 4)).reduce((acc, part) => acc + getPartType(part), "");
123
251
  }
124
- export {
125
- CALENDAR_WEEKS,
126
- DEFAULT_LOCALE,
127
- checkIfDateIsDisabled,
128
- createDatesArray,
129
- dateInProvidedValueRange,
130
- getDateISO,
131
- getFormattedDate,
132
- getLocaleDateFormat,
133
- getMonthDays,
134
- getMonthFirstWeekday,
135
- getMonthName,
136
- getMonthNamesList,
137
- getNextMonth,
138
- getPreviousMonth,
139
- getStringFromDate,
140
- getWeekdayNamesList,
141
- isDate,
142
- isDateRangeProp,
143
- isRange,
144
- isSameDay,
145
- isSameMonth,
146
- makeUTCDate,
147
- parseDateString
148
- };
252
+ //#endregion
253
+ export { checkIfDateIsDisabled, createDatesArray, dateInProvidedValueRange, getFormattedDate, getLocaleDateFormat, getMonthName, getMonthNamesList, getStringFromDate, getWeekdayNamesList, isDate, isDateRangeProp, isRange, isSameDay, isSameMonth, parseDateString };