@pega/cosmos-react-core 2.0.0-dev.9.4 → 2.0.0-rc.4

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 (865) hide show
  1. package/README.md +3 -3
  2. package/lib/components/Actions/Actions.js +1 -1
  3. package/lib/components/Actions/Actions.js.map +1 -1
  4. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppHeader.js +1 -6
  6. package/lib/components/AppShell/AppHeader.js.map +1 -1
  7. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  8. package/lib/components/AppShell/AppShell.js +88 -63
  9. package/lib/components/AppShell/AppShell.js.map +1 -1
  10. package/lib/components/AppShell/AppShell.styles.d.ts +19 -16
  11. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  12. package/lib/components/AppShell/AppShell.styles.js +227 -173
  13. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  14. package/lib/components/AppShell/AppShell.types.d.ts +7 -7
  15. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  17. package/lib/components/AppShell/AppShellContext.d.ts +3 -0
  18. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  19. package/lib/components/AppShell/AppShellContext.js +9 -1
  20. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  21. package/lib/components/AppShell/AppShellList.d.ts +4 -3
  22. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  23. package/lib/components/AppShell/AppShellList.js +24 -19
  24. package/lib/components/AppShell/AppShellList.js.map +1 -1
  25. package/lib/components/AppShell/Drawer.d.ts.map +1 -1
  26. package/lib/components/AppShell/Drawer.js +7 -8
  27. package/lib/components/AppShell/Drawer.js.map +1 -1
  28. package/lib/components/AppShell/Operator.js +3 -5
  29. package/lib/components/AppShell/Operator.js.map +1 -1
  30. package/lib/components/AppShell/SkipNavigation.d.ts.map +1 -1
  31. package/lib/components/AppShell/SkipNavigation.js +30 -39
  32. package/lib/components/AppShell/SkipNavigation.js.map +1 -1
  33. package/lib/components/AppShell/index.d.ts +1 -0
  34. package/lib/components/AppShell/index.d.ts.map +1 -1
  35. package/lib/components/AppShell/index.js +1 -0
  36. package/lib/components/AppShell/index.js.map +1 -1
  37. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  38. package/lib/components/Avatar/Avatar.js +5 -4
  39. package/lib/components/Avatar/Avatar.js.map +1 -1
  40. package/lib/components/Backdrop/Backdrop.d.ts +1 -1
  41. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  42. package/lib/components/Backdrop/Backdrop.js +7 -6
  43. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  44. package/lib/components/Backdrop/index.d.ts +1 -2
  45. package/lib/components/Backdrop/index.d.ts.map +1 -1
  46. package/lib/components/Backdrop/index.js +1 -2
  47. package/lib/components/Backdrop/index.js.map +1 -1
  48. package/lib/components/Badges/Alert.d.ts +2 -2
  49. package/lib/components/Badges/Alert.d.ts.map +1 -1
  50. package/lib/components/Badges/Alert.js +1 -1
  51. package/lib/components/Badges/Alert.js.map +1 -1
  52. package/lib/components/Badges/Count.js +1 -1
  53. package/lib/components/Badges/Count.js.map +1 -1
  54. package/lib/components/Badges/Selection.d.ts.map +1 -1
  55. package/lib/components/Badges/Selection.js +10 -9
  56. package/lib/components/Badges/Selection.js.map +1 -1
  57. package/lib/components/Badges/Status.d.ts +2 -2
  58. package/lib/components/Badges/Status.d.ts.map +1 -1
  59. package/lib/components/Badges/Status.js +1 -1
  60. package/lib/components/Badges/Status.js.map +1 -1
  61. package/lib/components/Badges/Tag.js +1 -1
  62. package/lib/components/Badges/Tag.js.map +1 -1
  63. package/lib/components/Banner/Banner.d.ts +2 -2
  64. package/lib/components/Banner/Banner.d.ts.map +1 -1
  65. package/lib/components/Banner/Banner.js +6 -8
  66. package/lib/components/Banner/Banner.js.map +1 -1
  67. package/lib/components/Boolean/BooleanDisplay.d.ts +2 -2
  68. package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
  69. package/lib/components/Boolean/BooleanDisplay.js +1 -2
  70. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  71. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -2
  72. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  73. package/lib/components/Breadcrumbs/Breadcrumbs.js +13 -11
  74. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  75. package/lib/components/Button/BareButton.d.ts.map +1 -1
  76. package/lib/components/Button/BareButton.js +21 -2
  77. package/lib/components/Button/BareButton.js.map +1 -1
  78. package/lib/components/Button/BareRoleButton.d.ts +12 -0
  79. package/lib/components/Button/BareRoleButton.d.ts.map +1 -0
  80. package/lib/components/Button/BareRoleButton.js +20 -0
  81. package/lib/components/Button/BareRoleButton.js.map +1 -0
  82. package/lib/components/Button/Button.d.ts +5 -0
  83. package/lib/components/Button/Button.d.ts.map +1 -1
  84. package/lib/components/Button/Button.js +34 -10
  85. package/lib/components/Button/Button.js.map +1 -1
  86. package/lib/components/Card/Card.d.ts.map +1 -1
  87. package/lib/components/Card/Card.js +3 -2
  88. package/lib/components/Card/Card.js.map +1 -1
  89. package/lib/components/Card/CardContent.d.ts.map +1 -1
  90. package/lib/components/Card/CardContent.js +5 -4
  91. package/lib/components/Card/CardContent.js.map +1 -1
  92. package/lib/components/Card/CardFooter.d.ts.map +1 -1
  93. package/lib/components/Card/CardFooter.js +5 -4
  94. package/lib/components/Card/CardFooter.js.map +1 -1
  95. package/lib/components/Card/CardHeader.d.ts +3 -1
  96. package/lib/components/Card/CardHeader.d.ts.map +1 -1
  97. package/lib/components/Card/CardHeader.js +9 -7
  98. package/lib/components/Card/CardHeader.js.map +1 -1
  99. package/lib/components/Card/CardMedia.js +1 -1
  100. package/lib/components/Card/CardMedia.js.map +1 -1
  101. package/lib/components/Card/CollapsibleCard.d.ts.map +1 -1
  102. package/lib/components/Card/CollapsibleCard.js +5 -7
  103. package/lib/components/Card/CollapsibleCard.js.map +1 -1
  104. package/lib/components/Card/SelectableCard.js +1 -1
  105. package/lib/components/Card/SelectableCard.js.map +1 -1
  106. package/lib/components/Checkbox/Checkbox.d.ts +2 -2
  107. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  108. package/lib/components/Checkbox/Checkbox.js +1 -1
  109. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  110. package/lib/components/ColorPicker/ColorPicker.d.ts +2 -2
  111. package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  112. package/lib/components/ColorPicker/ColorPicker.js +8 -11
  113. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  114. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  115. package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
  116. package/lib/components/ComboBox/ComboBox.js +43 -63
  117. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  118. package/lib/components/ComboBox/ComboBox.types.d.ts +2 -1
  119. package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
  120. package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
  121. package/lib/components/ComboBox/ComboBoxInput.js +4 -4
  122. package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
  123. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  124. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +23 -29
  125. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  126. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
  127. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +16 -12
  128. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
  129. package/lib/components/Configuration/Configuration.js +11 -13
  130. package/lib/components/Configuration/Configuration.js.map +1 -1
  131. package/lib/components/Currency/CurrencyDisplay.d.ts +6 -2
  132. package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
  133. package/lib/components/Currency/CurrencyDisplay.js +11 -7
  134. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  135. package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
  136. package/lib/components/Currency/CurrencyInput.js +16 -16
  137. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  138. package/lib/components/Currency/CurrencyInput.types.d.ts +6 -2
  139. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  140. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  141. package/lib/components/Currency/utils.d.ts +12 -1
  142. package/lib/components/Currency/utils.d.ts.map +1 -1
  143. package/lib/components/Currency/utils.js +30 -2
  144. package/lib/components/Currency/utils.js.map +1 -1
  145. package/lib/components/DateTime/DateTime.types.d.ts +2 -1
  146. package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
  147. package/lib/components/DateTime/DateTime.types.js.map +1 -1
  148. package/lib/components/DateTime/DateTimeDisplay.d.ts +1 -1
  149. package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
  150. package/lib/components/DateTime/DateTimeDisplay.js +10 -2
  151. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  152. package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
  153. package/lib/components/DateTime/DurationDisplay.js +11 -6
  154. package/lib/components/DateTime/DurationDisplay.js.map +1 -1
  155. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  156. package/lib/components/DateTime/Input/DateInput.js +26 -28
  157. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  158. package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
  159. package/lib/components/DateTime/Input/DateRangeInput.js +10 -16
  160. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  161. package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
  162. package/lib/components/DateTime/Input/DateTime.styles.js +14 -3
  163. package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
  164. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  165. package/lib/components/DateTime/Input/DateTimeInput.js +37 -44
  166. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  167. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +2 -0
  168. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
  169. package/lib/components/DateTime/Input/DayOfWeekInput.js +7 -5
  170. package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
  171. package/lib/components/DateTime/Input/Duration/DurationInput.d.ts.map +1 -1
  172. package/lib/components/DateTime/Input/Duration/DurationInput.js +3 -3
  173. package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
  174. package/lib/components/DateTime/Input/Duration/NumberUnit.js +4 -5
  175. package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
  176. package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
  177. package/lib/components/DateTime/Input/Duration/Time.js +12 -15
  178. package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
  179. package/lib/components/DateTime/Input/MonthInput.js +12 -16
  180. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  181. package/lib/components/DateTime/Input/PartInput.js +3 -4
  182. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  183. package/lib/components/DateTime/Input/QuarterInput.d.ts +9 -0
  184. package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -0
  185. package/lib/components/DateTime/Input/QuarterInput.js +102 -0
  186. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -0
  187. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  188. package/lib/components/DateTime/Input/TimeInput.js +29 -39
  189. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  190. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  191. package/lib/components/DateTime/Input/WeekInput.js +23 -24
  192. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  193. package/lib/components/DateTime/Input/useAutoFocusNextInput.d.ts.map +1 -1
  194. package/lib/components/DateTime/Input/useAutoFocusNextInput.js +8 -9
  195. package/lib/components/DateTime/Input/useAutoFocusNextInput.js.map +1 -1
  196. package/lib/components/DateTime/Input/usePickerButton.js +4 -4
  197. package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
  198. package/lib/components/DateTime/Input/utils.d.ts +7 -0
  199. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  200. package/lib/components/DateTime/Input/utils.js +52 -10
  201. package/lib/components/DateTime/Input/utils.js.map +1 -1
  202. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  203. package/lib/components/DateTime/Picker/Calendar.js +32 -34
  204. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  205. package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -2
  206. package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
  207. package/lib/components/DateTime/Picker/Calendar.styles.js +16 -7
  208. package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
  209. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  210. package/lib/components/DateTime/Picker/DatePicker.js +13 -17
  211. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  212. package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
  213. package/lib/components/DateTime/Picker/DateRangePicker.js +13 -17
  214. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  215. package/lib/components/DateTime/Picker/TimePicker.js +9 -10
  216. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  217. package/lib/components/DateTime/Picker/Weeks.js +9 -11
  218. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  219. package/lib/components/DateTime/Picker/utils.d.ts +1 -0
  220. package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
  221. package/lib/components/DateTime/Picker/utils.js +3 -0
  222. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  223. package/lib/components/DateTime/index.d.ts +3 -0
  224. package/lib/components/DateTime/index.d.ts.map +1 -1
  225. package/lib/components/DateTime/index.js +2 -0
  226. package/lib/components/DateTime/index.js.map +1 -1
  227. package/lib/components/Drawer/Drawer.d.ts.map +1 -1
  228. package/lib/components/Drawer/Drawer.js +10 -7
  229. package/lib/components/Drawer/Drawer.js.map +1 -1
  230. package/lib/components/Email/EmailDisplay.d.ts +2 -2
  231. package/lib/components/Email/EmailDisplay.d.ts.map +1 -1
  232. package/lib/components/Email/EmailDisplay.js +2 -2
  233. package/lib/components/Email/EmailDisplay.js.map +1 -1
  234. package/lib/components/EmojiPicker/EmojiDisplay.d.ts.map +1 -1
  235. package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
  236. package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
  237. package/lib/components/EmojiPicker/EmojiPicker.js +3 -4
  238. package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
  239. package/lib/components/EmptyState/EmptyState.d.ts +14 -0
  240. package/lib/components/EmptyState/EmptyState.d.ts.map +1 -0
  241. package/lib/components/{NoItems/NoItems.js → EmptyState/EmptyState.js} +11 -8
  242. package/lib/components/EmptyState/EmptyState.js.map +1 -0
  243. package/lib/components/EmptyState/index.d.ts +4 -0
  244. package/lib/components/EmptyState/index.d.ts.map +1 -0
  245. package/lib/components/EmptyState/index.js +3 -0
  246. package/lib/components/EmptyState/index.js.map +1 -0
  247. package/lib/components/ErrorState/ErrorState.d.ts +16 -0
  248. package/lib/components/ErrorState/ErrorState.d.ts.map +1 -0
  249. package/lib/components/ErrorState/ErrorState.js +31 -0
  250. package/lib/components/ErrorState/ErrorState.js.map +1 -0
  251. package/lib/components/ErrorState/index.d.ts +4 -0
  252. package/lib/components/ErrorState/index.d.ts.map +1 -0
  253. package/lib/components/ErrorState/index.js +3 -0
  254. package/lib/components/ErrorState/index.js.map +1 -0
  255. package/lib/components/ExpandCollapse/ExpandCollapse.js +6 -6
  256. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  257. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  258. package/lib/components/FieldGroup/FieldGroup.js +6 -7
  259. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  260. package/lib/components/FieldGroup/FieldGroupList.d.ts +1 -1
  261. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  262. package/lib/components/FieldGroup/FieldGroupList.js +8 -7
  263. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  264. package/lib/components/FieldGroup/index.d.ts +1 -0
  265. package/lib/components/FieldGroup/index.d.ts.map +1 -1
  266. package/lib/components/FieldGroup/index.js +1 -0
  267. package/lib/components/FieldGroup/index.js.map +1 -1
  268. package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
  269. package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
  270. package/lib/components/FieldValueList/FieldValueList.js +5 -7
  271. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  272. package/lib/components/File/FileDisplay.d.ts +6 -3
  273. package/lib/components/File/FileDisplay.d.ts.map +1 -1
  274. package/lib/components/File/FileDisplay.js +7 -7
  275. package/lib/components/File/FileDisplay.js.map +1 -1
  276. package/lib/components/File/FileInput.d.ts +3 -3
  277. package/lib/components/File/FileInput.d.ts.map +1 -1
  278. package/lib/components/File/FileInput.js +18 -19
  279. package/lib/components/File/FileInput.js.map +1 -1
  280. package/lib/components/File/FileItem.d.ts +0 -2
  281. package/lib/components/File/FileItem.d.ts.map +1 -1
  282. package/lib/components/File/FileItem.js +3 -4
  283. package/lib/components/File/FileItem.js.map +1 -1
  284. package/lib/components/File/FileUploadItem.d.ts +4 -2
  285. package/lib/components/File/FileUploadItem.d.ts.map +1 -1
  286. package/lib/components/File/FileUploadItem.js +58 -20
  287. package/lib/components/File/FileUploadItem.js.map +1 -1
  288. package/lib/components/File/FileVisual.d.ts +7 -16
  289. package/lib/components/File/FileVisual.d.ts.map +1 -1
  290. package/lib/components/File/FileVisual.js +44 -47
  291. package/lib/components/File/FileVisual.js.map +1 -1
  292. package/lib/components/File/index.d.ts +1 -0
  293. package/lib/components/File/index.d.ts.map +1 -1
  294. package/lib/components/File/index.js +1 -0
  295. package/lib/components/File/index.js.map +1 -1
  296. package/lib/components/File/utils.js +2 -3
  297. package/lib/components/File/utils.js.map +1 -1
  298. package/lib/components/Flex/Flex.d.ts +17 -7
  299. package/lib/components/Flex/Flex.d.ts.map +1 -1
  300. package/lib/components/Flex/Flex.js +25 -9
  301. package/lib/components/Flex/Flex.js.map +1 -1
  302. package/lib/components/Form/Form.d.ts +7 -1
  303. package/lib/components/Form/Form.d.ts.map +1 -1
  304. package/lib/components/Form/Form.js +5 -4
  305. package/lib/components/Form/Form.js.map +1 -1
  306. package/lib/components/FormControl/FormControl.d.ts +1 -1
  307. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  308. package/lib/components/FormControl/FormControl.js +1 -1
  309. package/lib/components/FormControl/FormControl.js.map +1 -1
  310. package/lib/components/FormField/FormField.d.ts +5 -7
  311. package/lib/components/FormField/FormField.d.ts.map +1 -1
  312. package/lib/components/FormField/FormField.js +9 -19
  313. package/lib/components/FormField/FormField.js.map +1 -1
  314. package/lib/components/Grid/Grid.d.ts +1 -1
  315. package/lib/components/Grid/Grid.d.ts.map +1 -1
  316. package/lib/components/Grid/Grid.js +17 -21
  317. package/lib/components/Grid/Grid.js.map +1 -1
  318. package/lib/components/Icon/Icon.js +3 -5
  319. package/lib/components/Icon/Icon.js.map +1 -1
  320. package/lib/components/Icon/iconNames.d.ts +1 -1
  321. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  322. package/lib/components/Icon/iconNames.js +2 -0
  323. package/lib/components/Icon/iconNames.js.map +1 -1
  324. package/lib/components/Icon/icons/compass-solid.icon.js +1 -2
  325. package/lib/components/Icon/icons/compass-solid.icon.js.map +1 -1
  326. package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js +1 -4
  327. package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js.map +1 -1
  328. package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js +1 -2
  329. package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js.map +1 -1
  330. package/lib/components/Icon/icons/dataviz-waterfall.icon.js +1 -5
  331. package/lib/components/Icon/icons/dataviz-waterfall.icon.js.map +1 -1
  332. package/lib/components/Icon/icons/dock.icon.d.ts +4 -0
  333. package/lib/components/Icon/icons/dock.icon.d.ts.map +1 -0
  334. package/lib/components/Icon/icons/dock.icon.js +6 -0
  335. package/lib/components/Icon/icons/dock.icon.js.map +1 -0
  336. package/lib/components/Icon/icons/filetype-text.icon.js +1 -4
  337. package/lib/components/Icon/icons/filetype-text.icon.js.map +1 -1
  338. package/lib/components/Icon/icons/folder-dollar.icon.js +1 -2
  339. package/lib/components/Icon/icons/folder-dollar.icon.js.map +1 -1
  340. package/lib/components/Icon/icons/freeze-column.icon.js +1 -2
  341. package/lib/components/Icon/icons/freeze-column.icon.js.map +1 -1
  342. package/lib/components/Icon/icons/galaxy.icon.js +1 -3
  343. package/lib/components/Icon/icons/galaxy.icon.js.map +1 -1
  344. package/lib/components/Icon/icons/grad-solid.icon.js +1 -2
  345. package/lib/components/Icon/icons/grad-solid.icon.js.map +1 -1
  346. package/lib/components/Icon/icons/grad.icon.js +1 -5
  347. package/lib/components/Icon/icons/grad.icon.js.map +1 -1
  348. package/lib/components/Icon/icons/list-number.icon.js +1 -6
  349. package/lib/components/Icon/icons/list-number.icon.js.map +1 -1
  350. package/lib/components/Icon/icons/list.icon.js +1 -6
  351. package/lib/components/Icon/icons/list.icon.js.map +1 -1
  352. package/lib/components/Icon/icons/pin.icon.js +1 -2
  353. package/lib/components/Icon/icons/pin.icon.js.map +1 -1
  354. package/lib/components/Icon/icons/search-solid.icon.js +1 -2
  355. package/lib/components/Icon/icons/search-solid.icon.js.map +1 -1
  356. package/lib/components/Icon/icons/tracer.icon.js +1 -2
  357. package/lib/components/Icon/icons/tracer.icon.js.map +1 -1
  358. package/lib/components/Icon/icons/tribox-solid.icon.js +1 -3
  359. package/lib/components/Icon/icons/tribox-solid.icon.js.map +1 -1
  360. package/lib/components/Icon/icons/tribox.icon.js +1 -3
  361. package/lib/components/Icon/icons/tribox.icon.js.map +1 -1
  362. package/lib/components/Icon/icons/undock.icon.d.ts +4 -0
  363. package/lib/components/Icon/icons/undock.icon.d.ts.map +1 -0
  364. package/lib/components/Icon/icons/undock.icon.js +6 -0
  365. package/lib/components/Icon/icons/undock.icon.js.map +1 -0
  366. package/lib/components/Icon/index.d.ts +1 -0
  367. package/lib/components/Icon/index.d.ts.map +1 -1
  368. package/lib/components/Icon/index.js +1 -0
  369. package/lib/components/Icon/index.js.map +1 -1
  370. package/lib/components/Image/Image.js +1 -1
  371. package/lib/components/Image/Image.js.map +1 -1
  372. package/lib/components/Image/index.d.ts +1 -1
  373. package/lib/components/Image/index.d.ts.map +1 -1
  374. package/lib/components/Image/index.js +1 -0
  375. package/lib/components/Image/index.js.map +1 -1
  376. package/lib/components/Input/Input.d.ts +2 -2
  377. package/lib/components/Input/Input.d.ts.map +1 -1
  378. package/lib/components/Input/Input.js +13 -13
  379. package/lib/components/Input/Input.js.map +1 -1
  380. package/lib/components/Input/Input.styles.js +2 -2
  381. package/lib/components/Input/Input.styles.js.map +1 -1
  382. package/lib/components/Input/index.d.ts +1 -1
  383. package/lib/components/Input/index.d.ts.map +1 -1
  384. package/lib/components/Input/index.js.map +1 -1
  385. package/lib/components/Label/Label.d.ts +2 -2
  386. package/lib/components/Label/Label.d.ts.map +1 -1
  387. package/lib/components/Label/Label.js +1 -1
  388. package/lib/components/Label/Label.js.map +1 -1
  389. package/lib/components/Lightbox/Lightbox.d.ts +6 -0
  390. package/lib/components/Lightbox/Lightbox.d.ts.map +1 -0
  391. package/lib/components/Lightbox/Lightbox.js +129 -0
  392. package/lib/components/Lightbox/Lightbox.js.map +1 -0
  393. package/lib/components/Lightbox/Lightbox.styles.d.ts +11 -0
  394. package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -0
  395. package/lib/components/Lightbox/Lightbox.styles.js +166 -0
  396. package/lib/components/Lightbox/Lightbox.styles.js.map +1 -0
  397. package/lib/components/Lightbox/Lightbox.types.d.ts +42 -0
  398. package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -0
  399. package/lib/components/Lightbox/Lightbox.types.js +2 -0
  400. package/lib/components/Lightbox/Lightbox.types.js.map +1 -0
  401. package/lib/components/Lightbox/index.d.ts +3 -0
  402. package/lib/components/Lightbox/index.d.ts.map +1 -0
  403. package/lib/components/Lightbox/index.js +2 -0
  404. package/lib/components/Lightbox/index.js.map +1 -0
  405. package/lib/components/Link/Link.d.ts.map +1 -1
  406. package/lib/components/Link/Link.js +19 -19
  407. package/lib/components/Link/Link.js.map +1 -1
  408. package/lib/components/List/CommaSeparatedList.d.ts +15 -0
  409. package/lib/components/List/CommaSeparatedList.d.ts.map +1 -0
  410. package/lib/components/List/CommaSeparatedList.js +61 -0
  411. package/lib/components/List/CommaSeparatedList.js.map +1 -0
  412. package/lib/components/List/List.d.ts +30 -0
  413. package/lib/components/List/List.d.ts.map +1 -0
  414. package/lib/components/List/List.js +56 -0
  415. package/lib/components/List/List.js.map +1 -0
  416. package/lib/components/List/OrderedList.d.ts +6 -0
  417. package/lib/components/List/OrderedList.d.ts.map +1 -0
  418. package/lib/components/List/OrderedList.js +6 -0
  419. package/lib/components/List/OrderedList.js.map +1 -0
  420. package/lib/components/List/UnorderedList.d.ts +6 -0
  421. package/lib/components/List/UnorderedList.d.ts.map +1 -0
  422. package/lib/components/List/UnorderedList.js +6 -0
  423. package/lib/components/List/UnorderedList.js.map +1 -0
  424. package/lib/components/List/index.d.ts +5 -0
  425. package/lib/components/List/index.d.ts.map +1 -0
  426. package/lib/components/List/index.js +4 -0
  427. package/lib/components/List/index.js.map +1 -0
  428. package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
  429. package/lib/components/Location/CurrentLocationButton.js +7 -7
  430. package/lib/components/Location/CurrentLocationButton.js.map +1 -1
  431. package/lib/components/Location/Location.types.d.ts +2 -1
  432. package/lib/components/Location/Location.types.d.ts.map +1 -1
  433. package/lib/components/Location/Location.types.js.map +1 -1
  434. package/lib/components/Location/LocationDisplay.js +8 -9
  435. package/lib/components/Location/LocationDisplay.js.map +1 -1
  436. package/lib/components/Location/LocationInput.js +27 -28
  437. package/lib/components/Location/LocationInput.js.map +1 -1
  438. package/lib/components/Location/LocationView.js +8 -13
  439. package/lib/components/Location/LocationView.js.map +1 -1
  440. package/lib/components/Location/index.d.ts +4 -4
  441. package/lib/components/Location/index.d.ts.map +1 -1
  442. package/lib/components/Location/index.js.map +1 -1
  443. package/lib/components/Location/utils.js +11 -15
  444. package/lib/components/Location/utils.js.map +1 -1
  445. package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
  446. package/lib/components/Menu/FlyoutMenuList.js +12 -15
  447. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  448. package/lib/components/Menu/Menu.context.d.ts.map +1 -1
  449. package/lib/components/Menu/Menu.context.js +2 -0
  450. package/lib/components/Menu/Menu.context.js.map +1 -1
  451. package/lib/components/Menu/Menu.d.ts.map +1 -1
  452. package/lib/components/Menu/Menu.js +92 -48
  453. package/lib/components/Menu/Menu.js.map +1 -1
  454. package/lib/components/Menu/Menu.styles.d.ts +11 -1
  455. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  456. package/lib/components/Menu/Menu.styles.js +208 -7
  457. package/lib/components/Menu/Menu.styles.js.map +1 -1
  458. package/lib/components/Menu/Menu.types.d.ts +30 -12
  459. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  460. package/lib/components/Menu/Menu.types.js.map +1 -1
  461. package/lib/components/Menu/MenuGroup.d.ts +6 -0
  462. package/lib/components/Menu/MenuGroup.d.ts.map +1 -0
  463. package/lib/components/Menu/MenuGroup.js +17 -0
  464. package/lib/components/Menu/MenuGroup.js.map +1 -0
  465. package/lib/components/Menu/MenuItem.d.ts +0 -3
  466. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  467. package/lib/components/Menu/MenuItem.js +57 -164
  468. package/lib/components/Menu/MenuItem.js.map +1 -1
  469. package/lib/components/Menu/MenuList.d.ts +1 -1
  470. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  471. package/lib/components/Menu/MenuList.js +28 -30
  472. package/lib/components/Menu/MenuList.js.map +1 -1
  473. package/lib/components/Menu/MenuListHeader.d.ts +0 -1
  474. package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
  475. package/lib/components/Menu/MenuListHeader.js +7 -55
  476. package/lib/components/Menu/MenuListHeader.js.map +1 -1
  477. package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
  478. package/lib/components/Menu/NavItemsList.js +2 -3
  479. package/lib/components/Menu/NavItemsList.js.map +1 -1
  480. package/lib/components/Menu/helpers.d.ts +13 -12
  481. package/lib/components/Menu/helpers.d.ts.map +1 -1
  482. package/lib/components/Menu/helpers.js +40 -36
  483. package/lib/components/Menu/helpers.js.map +1 -1
  484. package/lib/components/Menu/index.d.ts +2 -3
  485. package/lib/components/Menu/index.d.ts.map +1 -1
  486. package/lib/components/Menu/index.js +1 -2
  487. package/lib/components/Menu/index.js.map +1 -1
  488. package/lib/components/MenuButton/MenuButton.d.ts +3 -1
  489. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  490. package/lib/components/MenuButton/MenuButton.js +13 -14
  491. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  492. package/lib/components/MetaList/MetaList.d.ts +13 -4
  493. package/lib/components/MetaList/MetaList.d.ts.map +1 -1
  494. package/lib/components/MetaList/MetaList.js +34 -20
  495. package/lib/components/MetaList/MetaList.js.map +1 -1
  496. package/lib/components/Modal/Contexts.d.ts.map +1 -1
  497. package/lib/components/Modal/Contexts.js +6 -2
  498. package/lib/components/Modal/Contexts.js.map +1 -1
  499. package/lib/components/Modal/DockedModals.d.ts.map +1 -1
  500. package/lib/components/Modal/DockedModals.js +5 -4
  501. package/lib/components/Modal/DockedModals.js.map +1 -1
  502. package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
  503. package/lib/components/Modal/MinimizedModal.js +53 -38
  504. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  505. package/lib/components/Modal/Modal.d.ts +1 -6
  506. package/lib/components/Modal/Modal.d.ts.map +1 -1
  507. package/lib/components/Modal/Modal.js +89 -136
  508. package/lib/components/Modal/Modal.js.map +1 -1
  509. package/lib/components/Modal/Modal.styles.d.ts +9 -0
  510. package/lib/components/Modal/Modal.styles.d.ts.map +1 -0
  511. package/lib/components/Modal/Modal.styles.js +134 -0
  512. package/lib/components/Modal/Modal.styles.js.map +1 -0
  513. package/lib/components/Modal/Modal.types.d.ts +60 -7
  514. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  515. package/lib/components/Modal/Modal.types.js +2 -1
  516. package/lib/components/Modal/Modal.types.js.map +1 -1
  517. package/lib/components/Modal/ModalManager.d.ts.map +1 -1
  518. package/lib/components/Modal/ModalManager.js +78 -68
  519. package/lib/components/Modal/ModalManager.js.map +1 -1
  520. package/lib/components/MultiStep/MultiStep.d.ts.map +1 -1
  521. package/lib/components/MultiStep/MultiStep.js +10 -12
  522. package/lib/components/MultiStep/MultiStep.js.map +1 -1
  523. package/lib/components/MultiStep/MultiStep.styles.d.ts.map +1 -1
  524. package/lib/components/MultiStep/MultiStep.styles.js +5 -2
  525. package/lib/components/MultiStep/MultiStep.styles.js.map +1 -1
  526. package/lib/components/MultiStep/MultiStep.types.d.ts +4 -2
  527. package/lib/components/MultiStep/MultiStep.types.d.ts.map +1 -1
  528. package/lib/components/MultiStep/MultiStep.types.js.map +1 -1
  529. package/lib/components/MultiStep/index.d.ts +1 -1
  530. package/lib/components/MultiStep/index.d.ts.map +1 -1
  531. package/lib/components/MultiStep/index.js.map +1 -1
  532. package/lib/components/Number/NumberDisplay.d.ts +2 -2
  533. package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
  534. package/lib/components/Number/NumberDisplay.js +1 -1
  535. package/lib/components/Number/NumberDisplay.js.map +1 -1
  536. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  537. package/lib/components/Number/NumberInput.js +18 -25
  538. package/lib/components/Number/NumberInput.js.map +1 -1
  539. package/lib/components/Number/NumberInput.styles.d.ts +2 -2
  540. package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
  541. package/lib/components/Number/NumberInput.types.d.ts +2 -2
  542. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  543. package/lib/components/Number/NumberInput.types.js.map +1 -1
  544. package/lib/components/Number/utils.js +2 -3
  545. package/lib/components/Number/utils.js.map +1 -1
  546. package/lib/components/PageTemplates/CategorySubPage.d.ts +1 -1
  547. package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
  548. package/lib/components/PageTemplates/CategorySubPage.js +8 -18
  549. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  550. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +1 -1
  551. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  552. package/lib/components/PageTemplates/DashboardPage.d.ts +7 -1
  553. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  554. package/lib/components/PageTemplates/DashboardPage.js +48 -28
  555. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  556. package/lib/components/PageTemplates/PageTemplates.d.ts +15 -6
  557. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  558. package/lib/components/PageTemplates/PageTemplates.js +89 -79
  559. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  560. package/lib/components/PageTemplates/index.d.ts +5 -3
  561. package/lib/components/PageTemplates/index.d.ts.map +1 -1
  562. package/lib/components/PageTemplates/index.js +2 -1
  563. package/lib/components/PageTemplates/index.js.map +1 -1
  564. package/lib/components/Pagination/Pagination.d.ts +2 -2
  565. package/lib/components/Pagination/Pagination.d.ts.map +1 -1
  566. package/lib/components/Pagination/Pagination.js +7 -6
  567. package/lib/components/Pagination/Pagination.js.map +1 -1
  568. package/lib/components/Paragraph/ParagraphDisplay.d.ts +11 -0
  569. package/lib/components/Paragraph/ParagraphDisplay.d.ts.map +1 -0
  570. package/lib/components/Paragraph/ParagraphDisplay.js +11 -0
  571. package/lib/components/Paragraph/ParagraphDisplay.js.map +1 -0
  572. package/lib/components/Paragraph/index.d.ts +3 -0
  573. package/lib/components/Paragraph/index.d.ts.map +1 -0
  574. package/lib/components/Paragraph/index.js +2 -0
  575. package/lib/components/Paragraph/index.js.map +1 -0
  576. package/lib/components/Phone/PhoneDisplay.d.ts +2 -2
  577. package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
  578. package/lib/components/Phone/PhoneDisplay.js +2 -3
  579. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  580. package/lib/components/Phone/PhoneInput.d.ts +2 -2
  581. package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
  582. package/lib/components/Phone/PhoneInput.js +18 -17
  583. package/lib/components/Phone/PhoneInput.js.map +1 -1
  584. package/lib/components/Phone/utils.js +2 -3
  585. package/lib/components/Phone/utils.js.map +1 -1
  586. package/lib/components/Popover/Popover.d.ts +0 -4
  587. package/lib/components/Popover/Popover.d.ts.map +1 -1
  588. package/lib/components/Popover/Popover.js +17 -122
  589. package/lib/components/Popover/Popover.js.map +1 -1
  590. package/lib/components/Popover/Popover.styles.d.ts +5 -0
  591. package/lib/components/Popover/Popover.styles.d.ts.map +1 -0
  592. package/lib/components/Popover/Popover.styles.js +131 -0
  593. package/lib/components/Popover/Popover.styles.js.map +1 -0
  594. package/lib/components/Popover/PopoverManager.js +2 -2
  595. package/lib/components/Popover/PopoverManager.js.map +1 -1
  596. package/lib/components/Popover/index.d.ts +1 -1
  597. package/lib/components/Popover/index.d.ts.map +1 -1
  598. package/lib/components/Popover/index.js +1 -1
  599. package/lib/components/Popover/index.js.map +1 -1
  600. package/lib/components/Popover/modifiers.d.ts +3 -0
  601. package/lib/components/Popover/modifiers.d.ts.map +1 -0
  602. package/lib/components/Popover/modifiers.js +11 -0
  603. package/lib/components/Popover/modifiers.js.map +1 -0
  604. package/lib/components/Progress/Bar.js +2 -2
  605. package/lib/components/Progress/Bar.js.map +1 -1
  606. package/lib/components/Progress/Ellipsis.d.ts +1 -1
  607. package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
  608. package/lib/components/Progress/Ellipsis.js +48 -50
  609. package/lib/components/Progress/Ellipsis.js.map +1 -1
  610. package/lib/components/Progress/Progress.js +3 -4
  611. package/lib/components/Progress/Progress.js.map +1 -1
  612. package/lib/components/Progress/Progress.types.d.ts +2 -2
  613. package/lib/components/Progress/Progress.types.d.ts.map +1 -1
  614. package/lib/components/Progress/Progress.types.js.map +1 -1
  615. package/lib/components/Progress/Ring.d.ts +1 -1
  616. package/lib/components/Progress/Ring.d.ts.map +1 -1
  617. package/lib/components/Progress/Ring.js +40 -40
  618. package/lib/components/Progress/Ring.js.map +1 -1
  619. package/lib/components/RadioButton/RadioButton.d.ts +2 -2
  620. package/lib/components/RadioButton/RadioButton.d.ts.map +1 -1
  621. package/lib/components/RadioButton/RadioButton.js +1 -1
  622. package/lib/components/RadioButton/RadioButton.js.map +1 -1
  623. package/lib/components/RadioCheck/RadioCheck.d.ts +2 -2
  624. package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
  625. package/lib/components/RadioCheck/RadioCheck.js +7 -8
  626. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  627. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +4 -0
  628. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
  629. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +19 -18
  630. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  631. package/lib/components/Rating/Rating.d.ts +2 -2
  632. package/lib/components/Rating/Rating.d.ts.map +1 -1
  633. package/lib/components/Rating/Rating.js +6 -7
  634. package/lib/components/Rating/Rating.js.map +1 -1
  635. package/lib/components/SearchInput/SearchInput.d.ts +5 -5
  636. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  637. package/lib/components/SearchInput/SearchInput.js +14 -14
  638. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  639. package/lib/components/Select/Option.js +1 -1
  640. package/lib/components/Select/Option.js.map +1 -1
  641. package/lib/components/Select/Select.d.ts.map +1 -1
  642. package/lib/components/Select/Select.js +15 -16
  643. package/lib/components/Select/Select.js.map +1 -1
  644. package/lib/components/Select/index.d.ts +2 -3
  645. package/lib/components/Select/index.d.ts.map +1 -1
  646. package/lib/components/Select/index.js.map +1 -1
  647. package/lib/components/Sentiment/Sentiment.d.ts +2 -2
  648. package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
  649. package/lib/components/Sentiment/Sentiment.js +1 -2
  650. package/lib/components/Sentiment/Sentiment.js.map +1 -1
  651. package/lib/components/Skeleton/LineSkeleton.js +1 -1
  652. package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
  653. package/lib/components/Skeleton/ParagraphSkeleton.js +1 -1
  654. package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
  655. package/lib/components/Skeleton/RectangleSkeleton.js +1 -1
  656. package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
  657. package/lib/components/Slider/Slider.d.ts.map +1 -1
  658. package/lib/components/Slider/Slider.js +12 -19
  659. package/lib/components/Slider/Slider.js.map +1 -1
  660. package/lib/components/Slider/Slider.styles.d.ts +4 -1
  661. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  662. package/lib/components/Slider/Slider.styles.js +17 -5
  663. package/lib/components/Slider/Slider.styles.js.map +1 -1
  664. package/lib/components/Slider/Slider.types.d.ts +2 -2
  665. package/lib/components/Slider/Slider.types.d.ts.map +1 -1
  666. package/lib/components/Slider/Slider.types.js.map +1 -1
  667. package/lib/components/Slider/SliderTicks.d.ts +1 -0
  668. package/lib/components/Slider/SliderTicks.d.ts.map +1 -1
  669. package/lib/components/Slider/SliderTicks.js +19 -12
  670. package/lib/components/Slider/SliderTicks.js.map +1 -1
  671. package/lib/components/Slider/utils.d.ts +10 -11
  672. package/lib/components/Slider/utils.d.ts.map +1 -1
  673. package/lib/components/Slider/utils.js +24 -18
  674. package/lib/components/Slider/utils.js.map +1 -1
  675. package/lib/components/SummaryItem/SummaryItem.d.ts +5 -5
  676. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  677. package/lib/components/SummaryItem/SummaryItem.js +3 -5
  678. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  679. package/lib/components/SummaryList/SummaryList.d.ts +8 -2
  680. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  681. package/lib/components/SummaryList/SummaryList.js +10 -11
  682. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  683. package/lib/components/SummaryList/ViewAll.d.ts +1 -1
  684. package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
  685. package/lib/components/SummaryList/ViewAll.js +14 -10
  686. package/lib/components/SummaryList/ViewAll.js.map +1 -1
  687. package/lib/components/Switch/Switch.d.ts +2 -2
  688. package/lib/components/Switch/Switch.d.ts.map +1 -1
  689. package/lib/components/Switch/Switch.js +41 -30
  690. package/lib/components/Switch/Switch.js.map +1 -1
  691. package/lib/components/Table/Table.d.ts +2 -2
  692. package/lib/components/Table/Table.d.ts.map +1 -1
  693. package/lib/components/Table/Table.js +14 -13
  694. package/lib/components/Table/Table.js.map +1 -1
  695. package/lib/components/Table/index.d.ts +1 -2
  696. package/lib/components/Table/index.d.ts.map +1 -1
  697. package/lib/components/Table/index.js.map +1 -1
  698. package/lib/components/Tabs/Tab.d.ts +1 -1
  699. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  700. package/lib/components/Tabs/Tab.js +9 -7
  701. package/lib/components/Tabs/Tab.js.map +1 -1
  702. package/lib/components/Tabs/TabPanel.d.ts +10 -2
  703. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  704. package/lib/components/Tabs/TabPanel.js +24 -8
  705. package/lib/components/Tabs/TabPanel.js.map +1 -1
  706. package/lib/components/Tabs/Tabs.d.ts +1 -0
  707. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  708. package/lib/components/Tabs/Tabs.js +22 -18
  709. package/lib/components/Tabs/Tabs.js.map +1 -1
  710. package/lib/components/Tabs/Tabs.types.d.ts +2 -2
  711. package/lib/components/Tabs/Tabs.types.d.ts.map +1 -1
  712. package/lib/components/Tabs/Tabs.types.js.map +1 -1
  713. package/lib/components/Text/Text.d.ts +1 -1
  714. package/lib/components/Text/Text.d.ts.map +1 -1
  715. package/lib/components/Text/Text.js +2 -2
  716. package/lib/components/Text/Text.js.map +1 -1
  717. package/lib/components/TextArea/TextArea.d.ts +2 -2
  718. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  719. package/lib/components/TextArea/TextArea.js +31 -30
  720. package/lib/components/TextArea/TextArea.js.map +1 -1
  721. package/lib/components/TextArea/index.d.ts +1 -1
  722. package/lib/components/TextArea/index.d.ts.map +1 -1
  723. package/lib/components/TextArea/index.js.map +1 -1
  724. package/lib/components/Toaster/Toaster.d.ts +8 -36
  725. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  726. package/lib/components/Toaster/Toaster.js +97 -102
  727. package/lib/components/Toaster/Toaster.js.map +1 -1
  728. package/lib/components/Tooltip/Tooltip.d.ts +6 -1
  729. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  730. package/lib/components/Tooltip/Tooltip.js +6 -13
  731. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  732. package/lib/components/Tree/StandardTree.d.ts +6 -0
  733. package/lib/components/Tree/StandardTree.d.ts.map +1 -0
  734. package/lib/components/Tree/StandardTree.js +175 -0
  735. package/lib/components/Tree/StandardTree.js.map +1 -0
  736. package/lib/components/Tree/StandardTree.styles.d.ts +13 -0
  737. package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -0
  738. package/lib/components/Tree/StandardTree.styles.js +155 -0
  739. package/lib/components/Tree/StandardTree.styles.js.map +1 -0
  740. package/lib/components/Tree/StandardTree.types.d.ts +25 -0
  741. package/lib/components/Tree/StandardTree.types.d.ts.map +1 -0
  742. package/lib/components/Tree/StandardTree.types.js +2 -0
  743. package/lib/components/Tree/StandardTree.types.js.map +1 -0
  744. package/lib/components/Tree/Tree.d.ts +35 -49
  745. package/lib/components/Tree/Tree.d.ts.map +1 -1
  746. package/lib/components/Tree/Tree.js +18 -56
  747. package/lib/components/Tree/Tree.js.map +1 -1
  748. package/lib/components/Tree/helpers.d.ts +19 -0
  749. package/lib/components/Tree/helpers.d.ts.map +1 -0
  750. package/lib/components/Tree/helpers.js +180 -0
  751. package/lib/components/Tree/helpers.js.map +1 -0
  752. package/lib/components/Tree/index.d.ts +4 -2
  753. package/lib/components/Tree/index.d.ts.map +1 -1
  754. package/lib/components/Tree/index.js +3 -1
  755. package/lib/components/Tree/index.js.map +1 -1
  756. package/lib/components/URL/URLDisplay.d.ts +2 -2
  757. package/lib/components/URL/URLDisplay.d.ts.map +1 -1
  758. package/lib/components/URL/URLDisplay.js +2 -2
  759. package/lib/components/URL/URLDisplay.js.map +1 -1
  760. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.d.ts +10 -0
  761. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.d.ts.map +1 -0
  762. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js +10 -0
  763. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js.map +1 -0
  764. package/lib/components/VisuallyHiddenText/index.d.ts +2 -0
  765. package/lib/components/VisuallyHiddenText/index.d.ts.map +1 -0
  766. package/lib/components/VisuallyHiddenText/index.js +2 -0
  767. package/lib/components/VisuallyHiddenText/index.js.map +1 -0
  768. package/lib/hooks/index.d.ts +7 -4
  769. package/lib/hooks/index.d.ts.map +1 -1
  770. package/lib/hooks/index.js +7 -3
  771. package/lib/hooks/index.js.map +1 -1
  772. package/lib/hooks/useActiveDescendant.d.ts +17 -3
  773. package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
  774. package/lib/hooks/useActiveDescendant.js +86 -64
  775. package/lib/hooks/useActiveDescendant.js.map +1 -1
  776. package/lib/hooks/useAutoResize.d.ts.map +1 -1
  777. package/lib/hooks/useAutoResize.js +6 -7
  778. package/lib/hooks/useAutoResize.js.map +1 -1
  779. package/lib/hooks/useBreakpoint.js +2 -4
  780. package/lib/hooks/useBreakpoint.js.map +1 -1
  781. package/lib/hooks/useDraggable.d.ts +8 -0
  782. package/lib/hooks/useDraggable.d.ts.map +1 -0
  783. package/lib/hooks/useDraggable.js +64 -0
  784. package/lib/hooks/useDraggable.js.map +1 -0
  785. package/lib/hooks/useFocusWithin.d.ts +1 -1
  786. package/lib/hooks/useFocusWithin.d.ts.map +1 -1
  787. package/lib/hooks/useFocusWithin.js +29 -24
  788. package/lib/hooks/useFocusWithin.js.map +1 -1
  789. package/lib/hooks/useI18n.d.ts +511 -170
  790. package/lib/hooks/useI18n.d.ts.map +1 -1
  791. package/lib/hooks/useI18n.js +2 -2
  792. package/lib/hooks/useI18n.js.map +1 -1
  793. package/lib/hooks/useLongPress.d.ts +16 -0
  794. package/lib/hooks/useLongPress.d.ts.map +1 -0
  795. package/lib/hooks/useLongPress.js +59 -0
  796. package/lib/hooks/useLongPress.js.map +1 -0
  797. package/lib/hooks/useOuterEvent.js +1 -1
  798. package/lib/hooks/useOuterEvent.js.map +1 -1
  799. package/lib/hooks/useOverride.js +1 -1
  800. package/lib/hooks/useOverride.js.map +1 -1
  801. package/lib/hooks/useScrollStick.js +14 -3
  802. package/lib/hooks/useScrollStick.js.map +1 -1
  803. package/lib/hooks/useScrollToggle.d.ts +6 -0
  804. package/lib/hooks/useScrollToggle.d.ts.map +1 -0
  805. package/lib/hooks/useScrollToggle.js +40 -0
  806. package/lib/hooks/useScrollToggle.js.map +1 -0
  807. package/lib/hooks/useTransitionState.d.ts +39 -0
  808. package/lib/hooks/useTransitionState.d.ts.map +1 -0
  809. package/lib/hooks/useTransitionState.js +56 -0
  810. package/lib/hooks/useTransitionState.js.map +1 -0
  811. package/lib/i18n/default.d.ts +589 -0
  812. package/lib/i18n/default.d.ts.map +1 -0
  813. package/lib/i18n/default.js +636 -0
  814. package/lib/i18n/default.js.map +1 -0
  815. package/lib/i18n/i18n.d.ts +1000 -318
  816. package/lib/i18n/i18n.d.ts.map +1 -1
  817. package/lib/i18n/i18n.js +1 -1
  818. package/lib/i18n/i18n.js.map +1 -1
  819. package/lib/i18n/index.d.ts +1 -0
  820. package/lib/i18n/index.d.ts.map +1 -1
  821. package/lib/i18n/index.js.map +1 -1
  822. package/lib/i18n/translate.d.ts +29 -4
  823. package/lib/i18n/translate.d.ts.map +1 -1
  824. package/lib/i18n/translate.js +21 -8
  825. package/lib/i18n/translate.js.map +1 -1
  826. package/lib/index.d.ts +11 -2
  827. package/lib/index.d.ts.map +1 -1
  828. package/lib/index.js +11 -2
  829. package/lib/index.js.map +1 -1
  830. package/lib/styles/GlobalStyle.d.ts.map +1 -1
  831. package/lib/styles/GlobalStyle.js +2 -26
  832. package/lib/styles/GlobalStyle.js.map +1 -1
  833. package/lib/theme/ThemeMachine.js +7 -1
  834. package/lib/theme/ThemeMachine.js.map +1 -1
  835. package/lib/theme/index.d.ts +1 -0
  836. package/lib/theme/index.d.ts.map +1 -1
  837. package/lib/theme/index.js +1 -0
  838. package/lib/theme/index.js.map +1 -1
  839. package/lib/theme/theme.d.ts +83 -53
  840. package/lib/theme/theme.d.ts.map +1 -1
  841. package/lib/theme/themeDefinition.json +50 -30
  842. package/lib/theme/themeOverrides.schema.json +24 -3
  843. package/lib/theme/themes/buildTheme.json +3 -39
  844. package/lib/theme/themes/darkTheme.json +6 -0
  845. package/lib/theme/themes/legacyBuildTheme.json +50 -0
  846. package/lib/types/types.d.ts +6 -1
  847. package/lib/types/types.d.ts.map +1 -1
  848. package/lib/types/types.js.map +1 -1
  849. package/lib/utils/utils.d.ts +41 -4
  850. package/lib/utils/utils.d.ts.map +1 -1
  851. package/lib/utils/utils.js +55 -9
  852. package/lib/utils/utils.js.map +1 -1
  853. package/package.json +11 -12
  854. package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts +0 -3
  855. package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts.map +0 -1
  856. package/lib/components/DateTime/Input/useButtonAriaLabel.js +0 -33
  857. package/lib/components/DateTime/Input/useButtonAriaLabel.js.map +0 -1
  858. package/lib/components/NoItems/NoItems.d.ts +0 -14
  859. package/lib/components/NoItems/NoItems.d.ts.map +0 -1
  860. package/lib/components/NoItems/NoItems.js.map +0 -1
  861. package/lib/components/NoItems/index.d.ts +0 -4
  862. package/lib/components/NoItems/index.d.ts.map +0 -1
  863. package/lib/components/NoItems/index.js +0 -3
  864. package/lib/components/NoItems/index.js.map +0 -1
  865. package/lib/i18n/default.json +0 -246
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Currency/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,sHAAsH;AACtH,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAS/C,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,eAAwB;IACxE,MAAM,OAAO,GAAG,eAAe;QAC7B,CAAC,CAAC;YACE,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,eAAe;SAC1B;QACH,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CACnE,CAAC,WAA2B,EAAE,IAAkB,EAAE,KAAa,EAAE,EAAE;QACjE,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;YAC5B,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;YAChC,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,WAAW,CAAC,eAAe,GAAG,QAAQ,CAAC;aACxC;SACF;QACD,OAAO,WAAW,CAAC;IACrB,CAAC,EACD,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,CACzC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,MAAc,EAAE,eAAwB;IACvF,OAAO,eAAe;QACpB,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YAC5B,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,eAAe;SAC1B,CAAC,CAAC,eAAe,EAAE,CAAC,qBAAqB;QAC5C,CAAC,CAAC,yBAAyB,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,eAAwB;IAC7D,OAAO,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACzE,CAAC","sourcesContent":["import { NUMBER_MAX_DECIMAL_PLACES } from '../Number/NumberInput.types';\n\n// Currency & funds code list valid for Intl.NumberFormat(): https://www.currency-iso.org/en/home/tables/table-a1.html\nimport currencyCodeList from './currencyCodes';\n\ntype CurrencyPart = { type: string; value: string };\n\nexport type CurrencySymbol = {\n symbol: string;\n symbolPlacement: 'before' | 'after';\n};\n\nexport function getCurrencySymbol(locale: string, currencyISOCode?: string): CurrencySymbol {\n const options = currencyISOCode\n ? {\n style: 'currency',\n currency: currencyISOCode\n }\n : undefined;\n return new Intl.NumberFormat(locale, options).formatToParts(1).reduce(\n (currencyObj: CurrencySymbol, part: CurrencyPart, index: number) => {\n if (part.type === 'currency') {\n currencyObj.symbol = part.value;\n if (index === 0) {\n currencyObj.symbolPlacement = 'before';\n }\n }\n return currencyObj;\n },\n { symbol: '', symbolPlacement: 'after' }\n );\n}\n\nexport function getCurrencyMaximumFractionDigits(locale: string, currencyISOCode?: string): number {\n return currencyISOCode\n ? new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyISOCode\n }).resolvedOptions().maximumFractionDigits\n : NUMBER_MAX_DECIMAL_PLACES;\n}\n\nexport function isCurrencyISOCodeValid(currencyISOCode?: string): boolean {\n return currencyISOCode ? currencyCodeList.has(currencyISOCode) : false;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Currency/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,sHAAsH;AACtH,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAS/C,MAAM,UAAU,iBAAiB,CAC/B,MAAc,EACd,iBAA0B,EAC1B,eAAwB;IAExB,MAAM,OAAO,GAAG,eAAe;QAC7B,CAAC,CAAC;YACE,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,eAAe;SAC1B;QACH,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CACnE,CAAC,WAA2B,EAAE,IAAkB,EAAE,KAAa,EAAE,EAAE;QACjE,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;YAC5B,WAAW,CAAC,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YAC5E,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,WAAW,CAAC,eAAe,GAAG,QAAQ,CAAC;aACxC;SACF;QACD,OAAO,WAAW,CAAC;IACrB,CAAC,EACD,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,CACzC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,MAAc,EAAE,eAAwB;IACvF,OAAO,eAAe;QACpB,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YAC5B,KAAK,EAAE,UAAU;YACj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AC,GAAG,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,CAAC,EACxE,MAAM,EACN,mBAAmB,EACnB,qBAAqB,CACtB,CAAC;IACF,IAAI,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAClC,IAAI,GAAG,GAAG,CAAC;QACX,cAAc,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAC9C;IAED,IAAI,YAAY,GAAG,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,YAAY,IAAI,YAAY,KAAK,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAE5D,MAAM,WAAW,GAAG,eAAe,KAAK,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAE9E,OAAO,GAAG,IAAI,GAAG,YAAY,GAAG,cAAc,GAAG,WAAW,EAAE,CAAC;AACjE,CAAC","sourcesContent":["import { NUMBER_MAX_DECIMAL_PLACES } from '../Number/NumberInput.types';\nimport { getFormattedValue } from '../Number/utils';\n\n// Currency & funds code list valid for Intl.NumberFormat(): https://www.currency-iso.org/en/home/tables/table-a1.html\nimport currencyCodeList from './currencyCodes';\n\ntype CurrencyPart = { type: string; value: string };\n\nexport type CurrencySymbol = {\n symbol: string;\n symbolPlacement: 'before' | 'after';\n};\n\nexport function getCurrencySymbol(\n locale: string,\n alwaysShowISOCode: boolean,\n currencyISOCode?: string\n): CurrencySymbol {\n const options = currencyISOCode\n ? {\n style: 'currency',\n currency: currencyISOCode\n }\n : undefined;\n return new Intl.NumberFormat(locale, options).formatToParts(1).reduce(\n (currencyObj: CurrencySymbol, part: CurrencyPart, index: number) => {\n if (part.type === 'currency') {\n currencyObj.symbol = alwaysShowISOCode ? currencyISOCode || '' : part.value;\n if (index === 0) {\n currencyObj.symbolPlacement = 'before';\n }\n }\n return currencyObj;\n },\n { symbol: '', symbolPlacement: 'after' }\n );\n}\n\nexport function getCurrencyMaximumFractionDigits(locale: string, currencyISOCode?: string): number {\n return currencyISOCode\n ? new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyISOCode\n }).resolvedOptions().maximumFractionDigits\n : NUMBER_MAX_DECIMAL_PLACES;\n}\n\nexport function isCurrencyISOCodeValid(currencyISOCode?: string): boolean {\n return currencyISOCode ? currencyCodeList.has(currencyISOCode) : false;\n}\n\nexport function addTrailingZeros(\n valueToFormat: string,\n maximumFractionDigits: number,\n currencyISOCode?: string\n) {\n let formattedValue = valueToFormat;\n if (currencyISOCode && !Number.isNaN(parseFloat(valueToFormat))) {\n const [integer, fraction = ''] = valueToFormat.split('.');\n formattedValue = `${integer}.${fraction.padEnd(maximumFractionDigits, '0')}`;\n }\n return formattedValue;\n}\n\ntype DisplayValueParams = {\n value: string;\n locale: string;\n alwaysShowISOCode: boolean;\n showDecimal: boolean;\n showGroupSeparators: boolean;\n currencyISOCode?: string;\n};\n\nexport function getDisplayValue({\n value,\n locale,\n alwaysShowISOCode,\n showDecimal,\n showGroupSeparators,\n currencyISOCode\n}: DisplayValueParams) {\n const validCurrencyISOCode = isCurrencyISOCodeValid(currencyISOCode)\n ? currencyISOCode\n : undefined;\n const { symbol, symbolPlacement } = getCurrencySymbol(\n locale,\n alwaysShowISOCode,\n validCurrencyISOCode\n );\n const maximumFractionDigits = getCurrencyMaximumFractionDigits(locale, validCurrencyISOCode);\n\n let sign = '';\n let formattedValue = getFormattedValue(\n !showDecimal\n ? value.split('.')[0]\n : addTrailingZeros(value, maximumFractionDigits, validCurrencyISOCode),\n locale,\n showGroupSeparators,\n maximumFractionDigits\n );\n if (formattedValue.startsWith('-')) {\n sign = '-';\n formattedValue = formattedValue.substring(1);\n }\n\n let symbolBefore = symbolPlacement === 'before' ? symbol : '';\n symbolBefore += symbolBefore === currencyISOCode ? ' ' : '';\n\n const symbolAfter = symbolPlacement === 'after' && symbol ? ` ${symbol}` : '';\n\n return `${sign}${symbolBefore}${formattedValue}${symbolAfter}`;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { NoChildrenProp } from '../../types';
1
2
  import { FormControlProps } from '../FormControl';
2
3
  export interface DateTimeProperties {
3
4
  /**
@@ -51,6 +52,6 @@ export interface DateTimeCallbacks {
51
52
  /** Callback fired when the component loses focus. */
52
53
  onBlur?: (value: DateTimeCallbackParameter) => void;
53
54
  }
54
- export default interface DateTimeProps extends DateTimeProperties, DateTimeCallbacks {
55
+ export default interface DateTimeProps extends DateTimeProperties, DateTimeCallbacks, NoChildrenProp {
55
56
  }
56
57
  //# sourceMappingURL=DateTime.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTime.types.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DateTime.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACtC,4HAA4H;IAC5H,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7B,4HAA4H;IAC5H,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,EAAE,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC5B,oDAAoD;IACpD,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC,uCAAuC;IACvC,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,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+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;IACtD,sDAAsD;IACtD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;IACrD,qDAAqD;IACrD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,CAAC,OAAO,WAAW,aACvB,SAAQ,kBAAkB,EACxB,iBAAiB,EACjB,cAAc;CAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateTime.types.js","sourceRoot":"","sources":["../../../src/components/DateTime/DateTime.types.ts"],"names":[],"mappings":"","sourcesContent":["import { FormControlProps } from '../FormControl';\n\nexport interface DateTimeProperties {\n /**\n * Date as ISO8601 string, timestamp or native Date object.\n * Requires onChange prop to update value for controlled inputs.\n */\n value?: string | number | Date;\n /**\n * Date as ISO8601 string, timestamp or native Date object. Sets the value for an uncontrolled input.\n */\n defaultValue?: string | number | Date;\n /** Date as ISO8601 string, timestamp or native Date object. Defines minimum available value that can be set by the user. */\n min?: string | number | Date;\n /** Date as ISO8601 string, timestamp or native Date object. Defines maximum available value that can be set by the user. */\n max?: string | number | Date;\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: FormControlProps['readOnly'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Automatically focuses the input on render. */\n autoFocus?: boolean;\n}\n\nexport type DateTimeValueErrorState = 'incomplete' | 'invalid';\n\nexport type DateTimeCallbackParameter = {\n valueAsISOString: string;\n valueAsTimestamp: number | undefined;\n state?: DateTimeValueErrorState;\n};\n\nexport interface DateTimeCallbacks {\n /** Callback fired when input value changes. */\n onChange?: (value: DateTimeCallbackParameter) => void;\n /** Callback fired when the component gets focused. */\n onFocus?: (value: DateTimeCallbackParameter) => void;\n /** Callback fired when the component loses focus. */\n onBlur?: (value: DateTimeCallbackParameter) => void;\n}\n\nexport default interface DateTimeProps extends DateTimeProperties, DateTimeCallbacks {}\n"]}
1
+ {"version":3,"file":"DateTime.types.js","sourceRoot":"","sources":["../../../src/components/DateTime/DateTime.types.ts"],"names":[],"mappings":"","sourcesContent":["import { NoChildrenProp } from '../../types';\nimport { FormControlProps } from '../FormControl';\n\nexport interface DateTimeProperties {\n /**\n * Date as ISO8601 string, timestamp or native Date object.\n * Requires onChange prop to update value for controlled inputs.\n */\n value?: string | number | Date;\n /**\n * Date as ISO8601 string, timestamp or native Date object. Sets the value for an uncontrolled input.\n */\n defaultValue?: string | number | Date;\n /** Date as ISO8601 string, timestamp or native Date object. Defines minimum available value that can be set by the user. */\n min?: string | number | Date;\n /** Date as ISO8601 string, timestamp or native Date object. Defines maximum available value that can be set by the user. */\n max?: string | number | Date;\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: FormControlProps['readOnly'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Automatically focuses the input on render. */\n autoFocus?: boolean;\n}\n\nexport type DateTimeValueErrorState = 'incomplete' | 'invalid';\n\nexport type DateTimeCallbackParameter = {\n valueAsISOString: string;\n valueAsTimestamp: number | undefined;\n state?: DateTimeValueErrorState;\n};\n\nexport interface DateTimeCallbacks {\n /** Callback fired when input value changes. */\n onChange?: (value: DateTimeCallbackParameter) => void;\n /** Callback fired when the component gets focused. */\n onFocus?: (value: DateTimeCallbackParameter) => void;\n /** Callback fired when the component loses focus. */\n onBlur?: (value: DateTimeCallbackParameter) => void;\n}\n\nexport default interface DateTimeProps\n extends DateTimeProperties,\n DateTimeCallbacks,\n NoChildrenProp {}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { FunctionComponent, Ref } from 'react';
2
2
  import { BaseProps, ForwardProps } from '../../types';
3
3
  import { ClockFormat } from './Input/utils';
4
- declare type AbsoluteVariant = 'date' | 'datetime' | 'time' | 'week' | 'month' | 'year' | 'monthyear';
4
+ declare type AbsoluteVariant = 'date' | 'datetime' | 'time' | 'week' | 'month' | 'year' | 'monthyear' | 'quarteryear';
5
5
  export declare type DateTimeVariant = AbsoluteVariant | 'relative';
6
6
  export declare type DateTimeFormat = 'short' | 'long' | 'numeric';
7
7
  export interface DateTimeDisplayProps extends BaseProps {
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimeDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,EACL,WAAW,EAMZ,MAAM,eAAe,CAAC;AAEvB,aAAK,eAAe,GAAG,MAAM,GAAG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IAC/B;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAaD,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CA+H3E,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import { useConfiguration, useI18n } from '../../hooks';
4
- import { getEndOfWeek, getStartOfWeek, getWeek, getWeekYear, parseToDate } from './Input/utils';
4
+ import { getEndOfWeek, getQuarter, getStartOfWeek, getWeek, getWeekYear, parseToDate } from './Input/utils';
5
+ import { isValidDate } from './Picker/utils';
5
6
  const unitsInMs = {
6
7
  year: 24 * 60 * 60 * 1000 * 365,
7
8
  month: (24 * 60 * 60 * 1000 * 365) / 12,
@@ -87,17 +88,24 @@ const DateTimeDisplay = forwardRef(({ value, variant, format = 'short', clockFor
87
88
  const endDate = getFormattedDate(getEndOfWeek(date), 'week');
88
89
  return `${t('week_text')} ${getWeek(date)}, ${getWeekYear(date)} (${startDate} - ${endDate})`;
89
90
  };
91
+ const getFormattedQuarterYear = (date) => {
92
+ const formattedYear = getFormattedDate(date, 'year');
93
+ const quarterNumber = getQuarter(date);
94
+ return `${t(`date_quarter_q${quarterNumber}`, [formattedYear])}`;
95
+ };
90
96
  const displayValue = (date) => {
91
97
  switch (variant) {
92
98
  case 'relative':
93
99
  return getRelativeTime(date);
94
100
  case 'week':
95
101
  return getFormattedWeek(date);
102
+ case 'quarteryear':
103
+ return getFormattedQuarterYear(date);
96
104
  default:
97
105
  return getFormattedDate(date, variant);
98
106
  }
99
107
  };
100
- return (_jsx("span", Object.assign({ ref: ref }, restProps, { children: value || value === 0 ? (displayValue(parseToDate(value))) : (_jsx("span", Object.assign({ "aria-hidden": 'true' }, { children: "\u2013\u2013" }), void 0)) }), void 0));
108
+ return (_jsx("span", { ref: ref, ...restProps, children: (value || value === 0) && isValidDate(parseToDate(value)) ? (displayValue(parseToDate(value))) : (_jsx("span", { "aria-hidden": 'true', children: "\u2013\u2013" }, void 0)) }, void 0));
101
109
  });
102
110
  export default DateTimeDisplay;
103
111
  //# sourceMappingURL=DateTimeDisplay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeDisplay.js","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimeDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAEL,YAAY,EACZ,cAAc,EACd,OAAO,EACP,WAAW,EACX,WAAW,EACZ,MAAM,eAAe,CAAC;AA4BvB,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,GAAG;IAC/B,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,EAAE;IACvC,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACxB,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;IACpB,MAAM,EAAE,EAAE,GAAG,IAAI;IACjB,MAAM,EAAE,IAAI;CACJ,CAAC;AAIX,MAAM,eAAe,GAA2D,UAAU,CACxF,CACE,EACE,KAAK,EACL,OAAO,EACP,MAAM,GAAG,OAAO,EAChB,WAAW,EACX,GAAG,SAAS,EAC0B,EACxC,GAAgC,EAChC,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACtC,MAAM,CAAC,GAAG,OAAO,EAAE,CA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EAAE;QAClC,QAAQ,OAAO,EAAE;YACf,KAAK,UAAU;gBACb,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;YAC/B,KAAK,MAAM;gBACT,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAChC;gBACE,OAAO,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAC1C;IACH,CAAC,CAAC;IAEF,OAAO,CACL,6BAAM,GAAG,EAAE,GAAG,IAAM,SAAS,cAC1B,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CACtB,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CACjC,CAAC,CAAC,CAAC,CACF,4CAAkB,MAAM,0CAAsB,CAC/C,YACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useConfiguration, useI18n } from '../../hooks';\n\nimport {\n ClockFormat,\n getEndOfWeek,\n getStartOfWeek,\n getWeek,\n getWeekYear,\n parseToDate\n} from './Input/utils';\n\ntype AbsoluteVariant = 'date' | 'datetime' | 'time' | 'week' | 'month' | 'year' | 'monthyear';\nexport type DateTimeVariant = AbsoluteVariant | 'relative';\nexport type DateTimeFormat = 'short' | 'long' | 'numeric';\n\nexport interface DateTimeDisplayProps extends BaseProps {\n /**\n * Date as ISO8601 string, timestamp or native Date object.\n */\n value?: Date | string | number;\n /**\n * Controls date time variant.\n */\n variant: DateTimeVariant;\n /**\n * Controls display format.\n * @default \"short\"\n */\n format?: DateTimeFormat;\n /**\n * Defines clock format that overrides locale based format\n */\n clockFormat?: ClockFormat;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nconst unitsInMs = {\n year: 24 * 60 * 60 * 1000 * 365,\n month: (24 * 60 * 60 * 1000 * 365) / 12,\n day: 24 * 60 * 60 * 1000,\n hour: 60 * 60 * 1000,\n minute: 60 * 1000,\n second: 1000\n} as const;\n\ntype TimeUnit = keyof typeof unitsInMs;\n\nconst DateTimeDisplay: FunctionComponent<DateTimeDisplayProps & ForwardProps> = forwardRef(\n (\n {\n value,\n variant,\n format = 'short',\n clockFormat,\n ...restProps\n }: PropsWithoutRef<DateTimeDisplayProps>,\n ref: DateTimeDisplayProps['ref']\n ) => {\n const { locale } = useConfiguration();\n const t = useI18n();\n\n const timeShort = {\n hour: 'numeric',\n minute: 'numeric',\n hour12: clockFormat ? clockFormat === 12 : undefined\n } as const;\n const timeLong = {\n ...timeShort,\n second: 'numeric',\n hour12: clockFormat ? clockFormat === 12 : undefined\n } as const;\n\n const formatMapping = {\n date: {\n short: { year: 'numeric', month: 'short', day: 'numeric' } as const,\n long: { year: 'numeric', month: 'long', day: 'numeric' } as const,\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric' } as const\n },\n datetime: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort } as const,\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong } as const,\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort } as const\n },\n time: {\n short: timeShort,\n long: timeLong,\n numeric: timeShort\n },\n month: {\n short: { month: 'short' } as const,\n long: { month: 'long' } as const,\n numeric: { month: 'numeric' } as const\n },\n year: {\n short: { year: 'numeric' } as const,\n long: { year: 'numeric' } as const,\n numeric: { year: '2-digit' } as const\n },\n monthyear: {\n short: { year: 'numeric', month: 'short' } as const,\n long: { year: 'numeric', month: 'long' } as const,\n numeric: { year: 'numeric', month: 'numeric' } as const\n },\n week: {\n short: { month: 'short', day: 'numeric' } as const,\n long: { month: 'long', day: 'numeric' } as const,\n numeric: { month: 'numeric', day: 'numeric' } as const\n },\n relative: {\n short: { style: 'long', numeric: 'auto' } as const,\n long: { style: 'long', numeric: 'auto' } as const,\n numeric: { style: 'short', numeric: 'auto' } as const\n }\n };\n\n const getFormattedDate = (date: Date, dateVariant: AbsoluteVariant) => {\n return new Intl.DateTimeFormat(locale, {\n ...formatMapping[dateVariant][format],\n timeZone: 'UTC'\n }).format(date);\n };\n\n const relativeTimeFormatter = (relativeValue: number, unit: TimeUnit) => {\n return new Intl.RelativeTimeFormat(locale, formatMapping.relative[format]).format(\n relativeValue,\n unit\n );\n };\n\n const getRelativeTime = (date: Date) => {\n let elapsed = date.getTime() - Date.now();\n // Deliberately reduce precision to 1 minute\n if (Math.abs(elapsed) < 60000) elapsed = 0;\n const unit = (Object.keys(unitsInMs).find(\n u => Math.abs(elapsed) >= unitsInMs[u as TimeUnit]\n ) || 'second') as TimeUnit;\n return relativeTimeFormatter(Math.round(elapsed / unitsInMs[unit]), unit);\n };\n\n const getFormattedWeek = (date: Date) => {\n const startDate = getFormattedDate(getStartOfWeek(date), 'week');\n const endDate = getFormattedDate(getEndOfWeek(date), 'week');\n return `${t('week_text')} ${getWeek(date)}, ${getWeekYear(date)} (${startDate} - ${endDate})`;\n };\n\n const displayValue = (date: Date) => {\n switch (variant) {\n case 'relative':\n return getRelativeTime(date);\n case 'week':\n return getFormattedWeek(date);\n default:\n return getFormattedDate(date, variant);\n }\n };\n\n return (\n <span ref={ref} {...restProps}>\n {value || value === 0 ? (\n displayValue(parseToDate(value))\n ) : (\n <span aria-hidden='true'>&ndash;&ndash;</span>\n )}\n </span>\n );\n }\n);\n\nexport default DateTimeDisplay;\n"]}
1
+ {"version":3,"file":"DateTimeDisplay.js","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimeDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAEL,YAAY,EACZ,UAAU,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACX,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAoC7C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AAE,GAAG,KAAM,SAAS,YAC1B,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3D,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CACjC,CAAC,CAAC,CAAC,CACF,8BAAkB,MAAM,qCAAsB,CAC/C,WACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useConfiguration, useI18n } from '../../hooks';\n\nimport {\n ClockFormat,\n getEndOfWeek,\n getQuarter,\n getStartOfWeek,\n getWeek,\n getWeekYear,\n parseToDate\n} from './Input/utils';\nimport { isValidDate } from './Picker/utils';\n\ntype AbsoluteVariant =\n | 'date'\n | 'datetime'\n | 'time'\n | 'week'\n | 'month'\n | 'year'\n | 'monthyear'\n | 'quarteryear';\nexport type DateTimeVariant = AbsoluteVariant | 'relative';\nexport type DateTimeFormat = 'short' | 'long' | 'numeric';\n\nexport interface DateTimeDisplayProps extends BaseProps {\n /**\n * Date as ISO8601 string, timestamp or native Date object.\n */\n value?: Date | string | number;\n /**\n * Controls date time variant.\n */\n variant: DateTimeVariant;\n /**\n * Controls display format.\n * @default \"short\"\n */\n format?: DateTimeFormat;\n /**\n * Defines clock format that overrides locale based format\n */\n clockFormat?: ClockFormat;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nconst unitsInMs = {\n year: 24 * 60 * 60 * 1000 * 365,\n month: (24 * 60 * 60 * 1000 * 365) / 12,\n day: 24 * 60 * 60 * 1000,\n hour: 60 * 60 * 1000,\n minute: 60 * 1000,\n second: 1000\n} as const;\n\ntype TimeUnit = keyof typeof unitsInMs;\n\nconst DateTimeDisplay: FunctionComponent<DateTimeDisplayProps & ForwardProps> = forwardRef(\n (\n {\n value,\n variant,\n format = 'short',\n clockFormat,\n ...restProps\n }: PropsWithoutRef<DateTimeDisplayProps>,\n ref: DateTimeDisplayProps['ref']\n ) => {\n const { locale } = useConfiguration();\n const t = useI18n();\n\n const timeShort = {\n hour: 'numeric',\n minute: 'numeric',\n hour12: clockFormat ? clockFormat === 12 : undefined\n } as const;\n const timeLong = {\n ...timeShort,\n second: 'numeric',\n hour12: clockFormat ? clockFormat === 12 : undefined\n } as const;\n\n const formatMapping = {\n date: {\n short: { year: 'numeric', month: 'short', day: 'numeric' } as const,\n long: { year: 'numeric', month: 'long', day: 'numeric' } as const,\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric' } as const\n },\n datetime: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort } as const,\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong } as const,\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort } as const\n },\n time: {\n short: timeShort,\n long: timeLong,\n numeric: timeShort\n },\n month: {\n short: { month: 'short' } as const,\n long: { month: 'long' } as const,\n numeric: { month: 'numeric' } as const\n },\n year: {\n short: { year: 'numeric' } as const,\n long: { year: 'numeric' } as const,\n numeric: { year: '2-digit' } as const\n },\n monthyear: {\n short: { year: 'numeric', month: 'short' } as const,\n long: { year: 'numeric', month: 'long' } as const,\n numeric: { year: 'numeric', month: 'numeric' } as const\n },\n week: {\n short: { month: 'short', day: 'numeric' } as const,\n long: { month: 'long', day: 'numeric' } as const,\n numeric: { month: 'numeric', day: 'numeric' } as const\n },\n relative: {\n short: { style: 'long', numeric: 'auto' } as const,\n long: { style: 'long', numeric: 'auto' } as const,\n numeric: { style: 'short', numeric: 'auto' } as const\n }\n };\n\n const getFormattedDate = (date: Date, dateVariant: Exclude<AbsoluteVariant, 'quarteryear'>) => {\n return new Intl.DateTimeFormat(locale, {\n ...formatMapping[dateVariant][format],\n timeZone: 'UTC'\n }).format(date);\n };\n\n const relativeTimeFormatter = (relativeValue: number, unit: TimeUnit) => {\n return new Intl.RelativeTimeFormat(locale, formatMapping.relative[format]).format(\n relativeValue,\n unit\n );\n };\n\n const getRelativeTime = (date: Date) => {\n let elapsed = date.getTime() - Date.now();\n // Deliberately reduce precision to 1 minute\n if (Math.abs(elapsed) < 60000) elapsed = 0;\n const unit = (Object.keys(unitsInMs).find(\n u => Math.abs(elapsed) >= unitsInMs[u as TimeUnit]\n ) || 'second') as TimeUnit;\n return relativeTimeFormatter(Math.round(elapsed / unitsInMs[unit]), unit);\n };\n\n const getFormattedWeek = (date: Date) => {\n const startDate = getFormattedDate(getStartOfWeek(date), 'week');\n const endDate = getFormattedDate(getEndOfWeek(date), 'week');\n return `${t('week_text')} ${getWeek(date)}, ${getWeekYear(date)} (${startDate} - ${endDate})`;\n };\n\n const getFormattedQuarterYear = (date: Date) => {\n const formattedYear = getFormattedDate(date, 'year');\n const quarterNumber = getQuarter(date);\n return `${t(`date_quarter_q${quarterNumber}`, [formattedYear])}`;\n };\n\n const displayValue = (date: Date) => {\n switch (variant) {\n case 'relative':\n return getRelativeTime(date);\n case 'week':\n return getFormattedWeek(date);\n case 'quarteryear':\n return getFormattedQuarterYear(date);\n default:\n return getFormattedDate(date, variant);\n }\n };\n\n return (\n <span ref={ref} {...restProps}>\n {(value || value === 0) && isValidDate(parseToDate(value)) ? (\n displayValue(parseToDate(value))\n ) : (\n <span aria-hidden='true'>&ndash;&ndash;</span>\n )}\n </span>\n );\n }\n);\n\nexport default DateTimeDisplay;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DurationDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DurationDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAOD,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CAsC3E,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"DurationDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DurationDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAOD,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CA2C3E,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -9,11 +9,16 @@ const secondInMs = 1000;
9
9
  const DurationDisplay = forwardRef(({ value, significantUnits = 4, ...restProps }, ref) => {
10
10
  const t = useI18n();
11
11
  const displayValue = (ms) => {
12
+ const sign = ms < 0 ? '-' : '';
13
+ const absMs = Math.abs(ms);
14
+ if (absMs < secondInMs) {
15
+ return `0${t('second_text_short')}`;
16
+ }
12
17
  const durationParts = [
13
- { unit: 'day', value: Math.floor(ms / dayInMs) },
14
- { unit: 'hour', value: Math.floor((ms % dayInMs) / hourInMs) },
15
- { unit: 'minute', value: Math.floor((ms % hourInMs) / minuteInMs) },
16
- { unit: 'second', value: Math.floor((ms % minuteInMs) / secondInMs) }
18
+ { unit: 'day', value: Math.floor(absMs / dayInMs) },
19
+ { unit: 'hour', value: Math.floor((absMs % dayInMs) / hourInMs) },
20
+ { unit: 'minute', value: Math.floor((absMs % hourInMs) / minuteInMs) },
21
+ { unit: 'second', value: Math.floor((absMs % minuteInMs) / secondInMs) }
17
22
  ];
18
23
  const result = [];
19
24
  for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {
@@ -22,9 +27,9 @@ const DurationDisplay = forwardRef(({ value, significantUnits = 4, ...restProps
22
27
  t(`${durationParts[i].unit}_text_short`)}`);
23
28
  }
24
29
  }
25
- return result.join(' ');
30
+ return `${sign}${result.join(' ')}`;
26
31
  };
27
- return (_jsx(Text, Object.assign({ ref: ref }, restProps, { children: value && value >= 0 && value >= secondInMs ? (displayValue(value)) : (_jsx("span", Object.assign({ "aria-hidden": 'true' }, { children: "\u2013\u2013" }), void 0)) }), void 0));
32
+ return (_jsx(Text, { ref: ref, ...restProps, children: typeof value === 'number' ? (displayValue(value)) : (_jsx("span", { "aria-hidden": 'true', children: "\u2013\u2013" }, void 0)) }, void 0));
28
33
  });
29
34
  export default DurationDisplay;
30
35
  //# sourceMappingURL=DurationDisplay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DurationDisplay.js","sourceRoot":"","sources":["../../../src/components/DateTime/DurationDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,IAAI,MAAM,SAAS,CAAC;AAa3B,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACpC,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAChC,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7B,MAAM,UAAU,GAAG,IAAI,CAAC;A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AEF,OAAO,CACL,KAAC,IAAI,kBAAC,GAAG,EAAE,GAAG,IAAM,SAAS,cAC1B,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,CAC5C,YAAY,CAAC,KAAK,CAAC,CACpB,CAAC,CAAC,CAAC,CACF,4CAAkB,MAAM,0CAAsB,CAC/C,YACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport { TranslationPack } from '../../i18n';\nimport { useI18n } from '../../hooks';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Text from '../Text';\n\nexport interface DurationDisplayProps extends BaseProps {\n /** Number of milliseconds value for controlled input. */\n value?: number;\n /** Determines number of units to be displayed.\n * @default 4\n */\n significantUnits?: 4 | 3 | 2 | 1;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nconst dayInMs = 24 * 60 * 60 * 1000;\nconst hourInMs = 60 * 60 * 1000;\nconst minuteInMs = 60 * 1000;\nconst secondInMs = 1000;\n\nconst DurationDisplay: FunctionComponent<DurationDisplayProps & ForwardProps> = forwardRef(\n (\n { value, significantUnits = 4, ...restProps }: PropsWithoutRef<DurationDisplayProps>,\n ref: DurationDisplayProps['ref']\n ) => {\n const t = useI18n();\n\n const displayValue = (ms: number) => {\n const durationParts = [\n { unit: 'day', value: Math.floor(ms / dayInMs) },\n { unit: 'hour', value: Math.floor((ms % dayInMs) / hourInMs) },\n { unit: 'minute', value: Math.floor((ms % hourInMs) / minuteInMs) },\n { unit: 'second', value: Math.floor((ms % minuteInMs) / secondInMs) }\n ];\n const result = [];\n for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {\n if (durationParts[i].value > 0) {\n result.push(\n `${\n durationParts[i].value +\n t(`${durationParts[i].unit}_text_short` as keyof TranslationPack)\n }`\n );\n }\n }\n return result.join(' ');\n };\n\n return (\n <Text ref={ref} {...restProps}>\n {value && value >= 0 && value >= secondInMs ? (\n displayValue(value)\n ) : (\n <span aria-hidden='true'>&ndash;&ndash;</span>\n )}\n </Text>\n );\n }\n);\n\nexport default DurationDisplay;\n"]}
1
+ {"version":3,"file":"DurationDisplay.js","sourceRoot":"","sources":["../../../src/components/DateTime/DurationDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,IAAI,MAAM,SAAS,CAAC;AAa3B,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACpC,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAChC,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7B,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,MAAM,eAAe,GAA2D,UAAU,CACxF,CACE,EAAE,KAAK,EAAE,gBAAgB,GAAG,CAAC,EAAE,GAAG,SAAS,EAAyC,EACpF,GAAgC,EAChC,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,YAAY,GAAG,CAAC,EAAU,EAAE,EAAE;QAClC,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3B,IAAI,KAAK,GAAG,UAAU,EAAE;YACtB,OAAO,IAAI,CAAC,CAAC,mBAAmB,CAAC,EAAE,CAAC;SACrC;QACD,MAAM,aAAa,GAAG;YACpB,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,EAAE;YACnD,EAAE,IAAI,EAAE,M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{ useI18n } from '../../hooks';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Text from '../Text';\n\nexport interface DurationDisplayProps extends BaseProps {\n /** Number of milliseconds value for controlled input. */\n value?: number;\n /** Determines number of units to be displayed.\n * @default 4\n */\n significantUnits?: 4 | 3 | 2 | 1;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nconst dayInMs = 24 * 60 * 60 * 1000;\nconst hourInMs = 60 * 60 * 1000;\nconst minuteInMs = 60 * 1000;\nconst secondInMs = 1000;\n\nconst DurationDisplay: FunctionComponent<DurationDisplayProps & ForwardProps> = forwardRef(\n (\n { value, significantUnits = 4, ...restProps }: PropsWithoutRef<DurationDisplayProps>,\n ref: DurationDisplayProps['ref']\n ) => {\n const t = useI18n();\n\n const displayValue = (ms: number) => {\n const sign = ms < 0 ? '-' : '';\n const absMs = Math.abs(ms);\n if (absMs < secondInMs) {\n return `0${t('second_text_short')}`;\n }\n const durationParts = [\n { unit: 'day', value: Math.floor(absMs / dayInMs) },\n { unit: 'hour', value: Math.floor((absMs % dayInMs) / hourInMs) },\n { unit: 'minute', value: Math.floor((absMs % hourInMs) / minuteInMs) },\n { unit: 'second', value: Math.floor((absMs % minuteInMs) / secondInMs) }\n ];\n const result = [];\n for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {\n if (durationParts[i].value > 0) {\n result.push(\n `${\n durationParts[i].value +\n t(`${durationParts[i].unit}_text_short` as keyof TranslationPack)\n }`\n );\n }\n }\n return `${sign}${result.join(' ')}`;\n };\n\n return (\n <Text ref={ref} {...restProps}>\n {typeof value === 'number' ? (\n displayValue(value)\n ) : (\n <span aria-hidden='true'>&ndash;&ndash;</span>\n )}\n </Text>\n );\n }\n);\n\nexport default DurationDisplay;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAMjB,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CAAC;CAC9B;AAED,eAAO,MAAM,eAAe,qHAE3B,CAAC;AAsCF,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CA+Q/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -6,16 +6,18 @@ import { useConfiguration, useFocusWithin, useI18n } from '../../../hooks';
6
6
  import FormField from '../../FormField';
7
7
  import Flex from '../../Flex';
8
8
  import Button from '../../Button';
9
- import Icon from '../../Icon';
9
+ import Icon, { registerIcon } from '../../Icon';
10
+ import * as timesIcon from '../../Icon/icons/times.icon';
11
+ import * as calendarIcon from '../../Icon/icons/calendar.icon';
10
12
  import DatePicker from '../Picker/DatePicker';
11
13
  import Popover from '../../Popover';
12
14
  import { StyledFormControl } from '../../FormControl';
13
- import { getDateFormat, parsePastedTextToDate, parseToDate, validateDate } from './utils';
15
+ import { getDateFormat, parsePastedTextToDate, parseToDate, validateDate, generatePickerButtonAriaLabel } from './utils';
14
16
  import StyledDateTime, { StyledInputContainer } from './DateTime.styles';
15
17
  import useAutoFocusNextInput from './useAutoFocusNextInput';
16
18
  import PartInput from './PartInput';
17
19
  import usePickerButton from './usePickerButton';
18
- import useButtonAriaLabel from './useButtonAriaLabel';
20
+ registerIcon(timesIcon, calendarIcon);
19
21
  export const StyledDateInput = styled(StyledDateTime) `
20
22
  padding-inline-end: 0;
21
23
  `;
@@ -51,6 +53,7 @@ const convertToCallbackParameter = (date, parts) => {
51
53
  const DateInput = forwardRef((props, ref) => {
52
54
  const { locale } = useConfiguration();
53
55
  const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, info = getDateFormat(locale).join(''), status, required, readOnly, disabled, onChange, onFocus, onBlur, showWeekNumber, picker, autoFocus, ...restProps } = props;
56
+ const t = useI18n();
54
57
  const date = value !== undefined ? parseToDate(value) : undefined;
55
58
  const [yearInputRef, monthInputRef, dayInputRef] = [
56
59
  useRef(null),
@@ -58,14 +61,13 @@ const DateInput = forwardRef((props, ref) => {
58
61
  useRef(null)
59
62
  ];
60
63
  const pickParts = () => {
61
- var _a, _b, _c;
62
- const month = ((_a = monthInputRef.current) === null || _a === void 0 ? void 0 : _a.value)
64
+ const month = monthInputRef.current?.value
63
65
  ? (Number(monthInputRef.current.value) - 1).toString()
64
66
  : undefined;
65
67
  return [
66
- ((_b = yearInputRef.current) === null || _b === void 0 ? void 0 : _b.value) || undefined,
68
+ yearInputRef.current?.value || undefined,
67
69
  month,
68
- ((_c = dayInputRef.current) === null || _c === void 0 ? void 0 : _c.value) || undefined
70
+ dayInputRef.current?.value || undefined
69
71
  ];
70
72
  };
71
73
  const currentlySelectedDate = () => {
@@ -85,11 +87,13 @@ const DateInput = forwardRef((props, ref) => {
85
87
  if (!focused) {
86
88
  if (inputContainerRef.current)
87
89
  inputContainerRef.current.scrollTop = 0;
88
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(callbackParam);
90
+ onBlur?.(callbackParam);
89
91
  }
90
92
  };
93
+ const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();
91
94
  const onInputChange = () => {
92
- onChange === null || onChange === void 0 ? void 0 : onChange(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts()));
95
+ onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts()));
96
+ buttonEl?.setAttribute('aria-label', generatePickerButtonAriaLabel(currentlySelectedDate(), 'date', locale, t, open));
93
97
  };
94
98
  const setInputValue = (newValue) => {
95
99
  dayInputRef.current.value = newValue.getUTCDate().toString().padStart(2, '0');
@@ -105,13 +109,11 @@ const DateInput = forwardRef((props, ref) => {
105
109
  onInputChange();
106
110
  }
107
111
  };
108
- const t = useI18n();
109
- const DayInput = (_jsx(PartInput, { placeholder: t('day_placeholder'), "aria-label": t('day_label_a11y'), value: date === null || date === void 0 ? void 0 : date.getUTCDate(), onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, min: 1, max: 31, ref: dayInputRef }, 'day'));
110
- const MonthInput = (_jsx(PartInput, { placeholder: t('month_placeholder'), "aria-label": t('month_label_a11y'), value: date ? (date === null || date === void 0 ? void 0 : date.getUTCMonth()) + 1 : undefined, onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, min: 1, max: 12, ref: monthInputRef }, 'month'));
111
- const YearInput = (_jsx(PartInput, { placeholder: t('year_placeholder'), "aria-label": t('year_label_a11y'), value: date === null || date === void 0 ? void 0 : date.getUTCFullYear(), onChange: onInputChange, size: 4, maxLength: 4, readOnly: readOnly, min: 1, ref: yearInputRef }, 'year'));
112
- const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();
112
+ const DayInput = (_jsx(PartInput, { placeholder: t('day_placeholder'), "aria-label": t('day_label_a11y'), value: date?.getUTCDate(), onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, min: 1, max: 31, ref: dayInputRef }, 'day'));
113
+ const MonthInput = (_jsx(PartInput, { placeholder: t('month_placeholder'), "aria-label": t('month_label_a11y'), value: date ? date?.getUTCMonth() + 1 : undefined, onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, min: 1, max: 12, ref: monthInputRef }, 'month'));
114
+ const YearInput = (_jsx(PartInput, { placeholder: t('year_placeholder'), "aria-label": t('year_label_a11y'), value: date?.getUTCFullYear(), onChange: onInputChange, size: 4, maxLength: 4, readOnly: readOnly, min: 1, ref: yearInputRef }, 'year'));
113
115
  const containerRef = useRef(null);
114
- useFocusWithin([inputContainerRef], onFocusChange);
116
+ useFocusWithin([containerRef], onFocusChange);
115
117
  useImperativeHandle(ref, () => ({
116
118
  setOpen,
117
119
  buttonEl,
@@ -122,24 +124,22 @@ const DateInput = forwardRef((props, ref) => {
122
124
  const Picker = (_jsx(DatePicker, { selected: currentlySelectedDate(), onChange: selected => {
123
125
  setInputValue(selected);
124
126
  setOpen(false);
125
- setTimeout(() => buttonEl === null || buttonEl === void 0 ? void 0 : buttonEl.focus());
127
+ setTimeout(() => buttonEl?.focus());
126
128
  onInputChange();
127
129
  }, min: min, max: max, showWeekNumber: showWeekNumber }, void 0));
128
- const PickerButton = (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), "aria-label": useButtonAriaLabel(locale, currentlySelectedDate(), 'date', open), readOnly: readOnly, disabled: disabled }, { children: _jsx(Icon, { name: open ? 'times' : 'calendar' }, void 0) }), void 0),
129
- _jsx(Popover, Object.assign({ show: open, ref: setPopoverRef, target: containerRef.current, placement: 'bottom-end', strategy: 'fixed', modifiers: [
130
+ const PickerButton = (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), "aria-label": generatePickerButtonAriaLabel(currentlySelectedDate(), 'date', locale, t, open), readOnly: readOnly, disabled: disabled, children: _jsx(Icon, { name: open ? 'times' : 'calendar' }, void 0) }, void 0), _jsx(Popover, { show: open, ref: setPopoverRef, target: containerRef.current, placement: 'bottom-end', strategy: 'fixed', modifiers: [
130
131
  {
131
132
  name: 'flip',
132
133
  options: {
133
134
  fallbackPlacements: ['top-end', 'right', 'left']
134
135
  }
135
136
  }
136
- ] }, { children: picker || Picker }), void 0)] }, void 0));
137
+ ], children: picker || Picker }, void 0)] }, void 0));
137
138
  const orderedRefs = [];
138
- const Comp = (_jsxs(Flex, Object.assign({ as: StyledDateInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
139
- var _a;
139
+ const Comp = (_jsxs(Flex, { as: StyledDateInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
140
140
  if (e.target === containerRef.current)
141
- (_a = orderedRefs[0].current) === null || _a === void 0 ? void 0 : _a.focus();
142
- } }, restProps, { children: [_jsx(Flex, Object.assign({ ref: inputContainerRef, as: StyledInputContainer, container: { alignItems: 'center', wrap: 'wrap' }, onPaste: onPaste }, { children: getDateFormat(locale).map(part => {
141
+ orderedRefs[0].current?.focus();
142
+ }, ...restProps, children: [_jsx(Flex, { ref: inputContainerRef, as: StyledInputContainer, container: { alignItems: 'center', wrap: 'wrap' }, onPaste: onPaste, children: getDateFormat(locale).map(part => {
143
143
  switch (part) {
144
144
  case 'DD':
145
145
  orderedRefs.push(dayInputRef);
@@ -153,15 +153,13 @@ const DateInput = forwardRef((props, ref) => {
153
153
  default:
154
154
  return part;
155
155
  }
156
- }) }), void 0),
157
- !readOnly && PickerButton] }), void 0));
156
+ }) }, void 0), !readOnly && PickerButton] }, void 0));
158
157
  useEffect(() => {
159
- var _a;
160
158
  if (autoFocus)
161
- (_a = orderedRefs[0].current) === null || _a === void 0 ? void 0 : _a.focus();
159
+ orderedRefs[0].current?.focus();
162
160
  }, [autoFocus]);
163
161
  useAutoFocusNextInput(orderedRefs);
164
- return label ? (_jsx(FormField, Object.assign({ as: 'fieldset', labelAs: 'legend' }, { label, labelHidden, id, info, status, required, disabled }, { ref: ref }, { children: Comp }), void 0)) : (Comp);
162
+ return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled }, ref: ref, children: Comp }, void 0)) : (Comp);
165
163
  });
166
164
  export default DateInput;
167
165
  //# sourceMappingURL=DateInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAGV,MAAM,EAKN,mBAAmB,EACnB,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,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AW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;4BAC/B,OAAO,SAAS,CAAC;wBACnB;4BACE,OAAO,IAAI,CAAC;qBACf;gBACH,CAAC,CAAC,YACG;YACN,CAAC,QAAQ,IAAI,YAAY,aACrB,CACR,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;;QACb,IAAI,SAAS;YAAE,MAAA,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;IACjD,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,kBACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,IACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAChE,GAAG,EAAE,GAAG,gBAEP,IAAI,YACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n ClipboardEvent,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useRef,\n RefObject,\n ReactNode,\n Dispatch,\n SetStateAction,\n useImperativeHandle,\n useEffect\n} from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { useConfiguration, useFocusWithin, useI18n } from '../../../hooks';\nimport { ForwardProps } from '../../../types';\nimport FormField from '../../FormField';\nimport Flex from '../../Flex';\nimport Button from '../../Button';\nimport Icon from '../../Icon';\nimport DatePicker from '../Picker/DatePicker';\nimport Popover from '../../Popover';\nimport { StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport { getDateFormat, parsePastedTextToDate, parseToDate, validateDate } from './utils';\nimport StyledDateTime, { StyledInputContainer } from './DateTime.styles';\nimport useAutoFocusNextInput from './useAutoFocusNextInput';\nimport PartInput from './PartInput';\nimport usePickerButton from './usePickerButton';\nimport useButtonAriaLabel from './useButtonAriaLabel';\n\nexport interface DateInputProps extends DateTimeProps {\n /**\n * Display additional column with week number in date picker popover.\n * @default false\n */\n showWeekNumber?: boolean;\n /** Changes default date picker */\n picker?: ReactNode;\n}\n\nexport interface DateInputRefObject {\n readonly value: Date | undefined;\n setOpen: Dispatch<SetStateAction<boolean>>;\n buttonEl: HTMLElement | null;\n}\n\nexport const StyledDateInput = styled(StyledDateTime)<DateInputProps>`\n padding-inline-end: 0;\n`;\n\nStyledDateInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, monthIndex, day] = parts.map(Number);\n\n if (!validateDate(year, monthIndex + 1, day)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'invalid'\n };\n }\n\n date.setUTCFullYear(year, monthIndex, day);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\nconst DateInput: FunctionComponent<DateInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<DateInputProps>, ref: Ref<DateInputRefObject>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info = getDateFormat(locale).join(''),\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n showWeekNumber,\n picker,\n autoFocus,\n ...restProps\n } = props;\n\n const date = value !== undefined ? parseToDate(value) : undefined;\n\n const [yearInputRef, monthInputRef, dayInputRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null)\n ];\n\n const pickParts = () => {\n const month = monthInputRef.current?.value\n ? (Number(monthInputRef.current.value) - 1).toString()\n : undefined;\n return [\n yearInputRef.current?.value || undefined,\n month,\n dayInputRef.current?.value || undefined\n ];\n };\n\n const currentlySelectedDate = () => {\n const parts = pickParts();\n if (parts.every(Boolean)) {\n const [year, monthIndex, day] = parts.map(Number);\n\n return validateDate(year, monthIndex + 1, day)\n ? new Date(Date.UTC(year, monthIndex, day))\n : undefined;\n }\n };\n\n const inputContainerRef = useRef<HTMLDivElement>(null);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n pickParts()\n );\n if (onFocus && focused) onFocus(callbackParam);\n if (!focused) {\n if (inputContainerRef.current) inputContainerRef.current.scrollTop = 0;\n onBlur?.(callbackParam);\n }\n };\n\n const onInputChange = () => {\n onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts()));\n };\n\n const setInputValue = (newValue: Date) => {\n dayInputRef.current!.value = newValue.getUTCDate().toString().padStart(2, '0');\n monthInputRef.current!.value = (newValue.getUTCMonth() + 1).toString().padStart(2, '0');\n yearInputRef.current!.value = newValue.getUTCFullYear().toString();\n };\n\n const onPaste = (e: ClipboardEvent) => {\n const text = e.clipboardData.getData('text');\n const newDate = parsePastedTextToDate(text, locale, date || new Date());\n if (newDate) {\n e.preventDefault();\n setInputValue(newDate);\n onInputChange();\n }\n };\n\n const t = useI18n();\n\n const DayInput = (\n <PartInput\n key='day'\n placeholder={t('day_placeholder')}\n aria-label={t('day_label_a11y')}\n value={date?.getUTCDate()}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={1}\n max={31}\n ref={dayInputRef}\n />\n );\n\n const MonthInput = (\n <PartInput\n key='month'\n placeholder={t('month_placeholder')}\n aria-label={t('month_label_a11y')}\n value={date ? date?.getUTCMonth() + 1 : undefined}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={1}\n max={12}\n ref={monthInputRef}\n />\n );\n\n const YearInput = (\n <PartInput\n key='year'\n placeholder={t('year_placeholder')}\n aria-label={t('year_label_a11y')}\n value={date?.getUTCFullYear()}\n onChange={onInputChange}\n size={4}\n maxLength={4}\n readOnly={readOnly}\n min={1}\n ref={yearInputRef}\n />\n );\n\n const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([inputContainerRef], onFocusChange);\n\n useImperativeHandle(ref, () => ({\n setOpen,\n buttonEl,\n get value() {\n return currentlySelectedDate();\n }\n }));\n\n const Picker = (\n <DatePicker\n selected={currentlySelectedDate()}\n onChange={selected => {\n setInputValue(selected);\n setOpen(false);\n setTimeout(() => buttonEl?.focus());\n onInputChange();\n }}\n min={min}\n max={max}\n showWeekNumber={showWeekNumber}\n />\n );\n\n const PickerButton = (\n <>\n <Button\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n aria-label={useButtonAriaLabel(locale, currentlySelectedDate(), 'date', open)}\n readOnly={readOnly}\n disabled={disabled}\n >\n <Icon name={open ? 'times' : 'calendar'} />\n </Button>\n\n <Popover\n show={open}\n ref={setPopoverRef}\n target={containerRef.current}\n placement='bottom-end'\n strategy='fixed'\n modifiers={[\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['top-end', 'right', 'left']\n }\n }\n ]}\n >\n {picker || Picker}\n </Popover>\n </>\n );\n\n const orderedRefs: RefObject<HTMLInputElement>[] = [];\n\n const Comp = (\n <Flex\n as={StyledDateInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n ref={containerRef}\n onClick={(e: MouseEvent) => {\n if (e.target === containerRef.current) orderedRefs[0].current?.focus();\n }}\n {...restProps}\n >\n <Flex\n ref={inputContainerRef}\n as={StyledInputContainer}\n container={{ alignItems: 'center', wrap: 'wrap' }}\n onPaste={onPaste}\n >\n {getDateFormat(locale).map(part => {\n switch (part) {\n case 'DD':\n orderedRefs.push(dayInputRef);\n return DayInput;\n case 'MM':\n orderedRefs.push(monthInputRef);\n return MonthInput;\n case 'YYYY':\n orderedRefs.push(yearInputRef);\n return YearInput;\n default:\n return part;\n }\n })}\n </Flex>\n {!readOnly && PickerButton}\n </Flex>\n );\n\n useEffect(() => {\n if (autoFocus) orderedRefs[0].current?.focus();\n }, [autoFocus]);\n\n useAutoFocusNextInput(orderedRefs);\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n ref={ref}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default DateInput;\n"]}
1
+ {"version":3,"file":"DateInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAGV,MAAM,EAKN,mBAAmB,EACnB,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAC/D,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,E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CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,KACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAChE,GAAG,EAAE,GAAG,YAEP,IAAI,WACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n ClipboardEvent,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useRef,\n RefObject,\n ReactNode,\n Dispatch,\n SetStateAction,\n useImperativeHandle,\n useEffect\n} from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { useConfiguration, useFocusWithin, useI18n } from '../../../hooks';\nimport { ForwardProps } from '../../../types';\nimport FormField from '../../FormField';\nimport Flex from '../../Flex';\nimport Button from '../../Button';\nimport Icon, { registerIcon } from '../../Icon';\nimport * as timesIcon from '../../Icon/icons/times.icon';\nimport * as calendarIcon from '../../Icon/icons/calendar.icon';\nimport DatePicker from '../Picker/DatePicker';\nimport Popover from '../../Popover';\nimport { StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport {\n getDateFormat,\n parsePastedTextToDate,\n parseToDate,\n validateDate,\n generatePickerButtonAriaLabel\n} from './utils';\nimport StyledDateTime, { StyledInputContainer } from './DateTime.styles';\nimport useAutoFocusNextInput from './useAutoFocusNextInput';\nimport PartInput from './PartInput';\nimport usePickerButton from './usePickerButton';\n\nregisterIcon(timesIcon, calendarIcon);\n\nexport interface DateInputProps extends DateTimeProps {\n /**\n * Display additional column with week number in date picker popover.\n * @default false\n */\n showWeekNumber?: boolean;\n /** Changes default date picker */\n picker?: ReactNode;\n}\n\nexport interface DateInputRefObject {\n readonly value: Date | undefined;\n setOpen: Dispatch<SetStateAction<boolean>>;\n buttonEl: HTMLElement | null;\n}\n\nexport const StyledDateInput = styled(StyledDateTime)<DateInputProps>`\n padding-inline-end: 0;\n`;\n\nStyledDateInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, monthIndex, day] = parts.map(Number);\n\n if (!validateDate(year, monthIndex + 1, day)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'invalid'\n };\n }\n\n date.setUTCFullYear(year, monthIndex, day);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\nconst DateInput: FunctionComponent<DateInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<DateInputProps>, ref: Ref<DateInputRefObject>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info = getDateFormat(locale).join(''),\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n showWeekNumber,\n picker,\n autoFocus,\n ...restProps\n } = props;\n\n const t = useI18n();\n\n const date = value !== undefined ? parseToDate(value) : undefined;\n\n const [yearInputRef, monthInputRef, dayInputRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null)\n ];\n\n const pickParts = () => {\n const month = monthInputRef.current?.value\n ? (Number(monthInputRef.current.value) - 1).toString()\n : undefined;\n return [\n yearInputRef.current?.value || undefined,\n month,\n dayInputRef.current?.value || undefined\n ];\n };\n\n const currentlySelectedDate = () => {\n const parts = pickParts();\n if (parts.every(Boolean)) {\n const [year, monthIndex, day] = parts.map(Number);\n\n return validateDate(year, monthIndex + 1, day)\n ? new Date(Date.UTC(year, monthIndex, day))\n : undefined;\n }\n };\n\n const inputContainerRef = useRef<HTMLDivElement>(null);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n pickParts()\n );\n if (onFocus && focused) onFocus(callbackParam);\n if (!focused) {\n if (inputContainerRef.current) inputContainerRef.current.scrollTop = 0;\n onBlur?.(callbackParam);\n }\n };\n\n const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();\n\n const onInputChange = () => {\n onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts()));\n buttonEl?.setAttribute(\n 'aria-label',\n generatePickerButtonAriaLabel(currentlySelectedDate(), 'date', locale, t, open)\n );\n };\n\n const setInputValue = (newValue: Date) => {\n dayInputRef.current!.value = newValue.getUTCDate().toString().padStart(2, '0');\n monthInputRef.current!.value = (newValue.getUTCMonth() + 1).toString().padStart(2, '0');\n yearInputRef.current!.value = newValue.getUTCFullYear().toString();\n };\n\n const onPaste = (e: ClipboardEvent) => {\n const text = e.clipboardData.getData('text');\n const newDate = parsePastedTextToDate(text, locale, date || new Date());\n if (newDate) {\n e.preventDefault();\n setInputValue(newDate);\n onInputChange();\n }\n };\n\n const DayInput = (\n <PartInput\n key='day'\n placeholder={t('day_placeholder')}\n aria-label={t('day_label_a11y')}\n value={date?.getUTCDate()}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={1}\n max={31}\n ref={dayInputRef}\n />\n );\n\n const MonthInput = (\n <PartInput\n key='month'\n placeholder={t('month_placeholder')}\n aria-label={t('month_label_a11y')}\n value={date ? date?.getUTCMonth() + 1 : undefined}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={1}\n max={12}\n ref={monthInputRef}\n />\n );\n\n const YearInput = (\n <PartInput\n key='year'\n placeholder={t('year_placeholder')}\n aria-label={t('year_label_a11y')}\n value={date?.getUTCFullYear()}\n onChange={onInputChange}\n size={4}\n maxLength={4}\n readOnly={readOnly}\n min={1}\n ref={yearInputRef}\n />\n );\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n useImperativeHandle(ref, () => ({\n setOpen,\n buttonEl,\n get value() {\n return currentlySelectedDate();\n }\n }));\n\n const Picker = (\n <DatePicker\n selected={currentlySelectedDate()}\n onChange={selected => {\n setInputValue(selected);\n setOpen(false);\n setTimeout(() => buttonEl?.focus());\n onInputChange();\n }}\n min={min}\n max={max}\n showWeekNumber={showWeekNumber}\n />\n );\n\n const PickerButton = (\n <>\n <Button\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n aria-label={generatePickerButtonAriaLabel(\n currentlySelectedDate(),\n 'date',\n locale,\n t,\n open\n )}\n readOnly={readOnly}\n disabled={disabled}\n >\n <Icon name={open ? 'times' : 'calendar'} />\n </Button>\n\n <Popover\n show={open}\n ref={setPopoverRef}\n target={containerRef.current}\n placement='bottom-end'\n strategy='fixed'\n modifiers={[\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['top-end', 'right', 'left']\n }\n }\n ]}\n >\n {picker || Picker}\n </Popover>\n </>\n );\n\n const orderedRefs: RefObject<HTMLInputElement>[] = [];\n\n const Comp = (\n <Flex\n as={StyledDateInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n ref={containerRef}\n onClick={(e: MouseEvent) => {\n if (e.target === containerRef.current) orderedRefs[0].current?.focus();\n }}\n {...restProps}\n >\n <Flex\n ref={inputContainerRef}\n as={StyledInputContainer}\n container={{ alignItems: 'center', wrap: 'wrap' }}\n onPaste={onPaste}\n >\n {getDateFormat(locale).map(part => {\n switch (part) {\n case 'DD':\n orderedRefs.push(dayInputRef);\n return DayInput;\n case 'MM':\n orderedRefs.push(monthInputRef);\n return MonthInput;\n case 'YYYY':\n orderedRefs.push(yearInputRef);\n return YearInput;\n default:\n return part;\n }\n })}\n </Flex>\n {!readOnly && PickerButton}\n </Flex>\n );\n\n useEffect(() => {\n if (autoFocus) orderedRefs[0].current?.focus();\n }, [autoFocus]);\n\n useAutoFocusNextInput(orderedRefs);\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n ref={ref}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default DateInput;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateRangeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAQlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,sBAAsB,EAAyB,MAAM,UAAU,CAAC;AAGzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAM5D,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,SAAS,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEnC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACnD,sDAAsD;IACtD,OAA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M,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACjD,iDAAiD;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAgFD,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CA2KzE,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -63,32 +63,29 @@ const reducer = (prevState, action) => {
63
63
  }
64
64
  };
65
65
  const getSelected = (first, second) => {
66
- const selected = first !== null && first !== void 0 ? first : second;
66
+ const selected = first ?? second;
67
67
  return selected ? parseToDate(selected) : undefined;
68
68
  };
69
69
  const parseValueToDate = (value) => {
70
70
  return value ? parseToDate(value) : undefined;
71
71
  };
72
72
  const DateRangeInput = forwardRef((props, ref) => {
73
- var _a, _b;
74
73
  const { fromValue, toValue, min, max, fromLabel, toLabel, labelHidden, status, required, readOnly, disabled, onChange, onFocus, onBlur, showWeekNumber, autoFocus, ...restProps } = props;
75
74
  const [state, dispatch] = useReducer(reducer, [
76
- (_a = parseValueToDate(fromValue)) === null || _a === void 0 ? void 0 : _a.getTime(),
77
- (_b = parseValueToDate(toValue)) === null || _b === void 0 ? void 0 : _b.getTime()
75
+ parseValueToDate(fromValue)?.getTime(),
76
+ parseValueToDate(toValue)?.getTime()
78
77
  ]);
79
78
  const startDateInputRef = useRef(null);
80
79
  const endDateInputRef = useRef(null);
81
80
  useEffect(() => {
82
- onChange === null || onChange === void 0 ? void 0 : onChange(convertToCallbackParameter(state));
81
+ onChange?.(convertToCallbackParameter(state));
83
82
  }, [state[0], state[1]]);
84
83
  const onFocusChange = useCallback((focused) => {
85
- var _a;
86
- (_a = (focused ? onFocus : onBlur)) === null || _a === void 0 ? void 0 : _a(convertToCallbackParameter(state));
84
+ (focused ? onFocus : onBlur)?.(convertToCallbackParameter(state));
87
85
  }, [onFocus, onBlur, state]);
88
86
  const containerRef = useConsolidatedRef(ref);
89
87
  useFocusWithin([containerRef], onFocusChange);
90
88
  const onStartDateChange = (selectedDate) => {
91
- var _a, _b;
92
89
  if (state[1] && selectedDate.getTime() > state[1]) {
93
90
  dispatch({ type: 'start', value: state[1] });
94
91
  dispatch({ type: 'end', value: selectedDate.getTime() });
@@ -96,11 +93,10 @@ const DateRangeInput = forwardRef((props, ref) => {
96
93
  else {
97
94
  dispatch({ type: 'start', value: selectedDate.getTime() });
98
95
  }
99
- (_a = startDateInputRef.current) === null || _a === void 0 ? void 0 : _a.setOpen(false);
100
- (_b = endDateInputRef.current) === null || _b === void 0 ? void 0 : _b.setOpen(true);
96
+ startDateInputRef.current?.setOpen(false);
97
+ endDateInputRef.current?.setOpen(true);
101
98
  };
102
99
  const onEndDateChange = (selectedDate) => {
103
- var _a, _b, _c;
104
100
  if (state[0] && selectedDate.getTime() < state[0]) {
105
101
  dispatch({ type: 'start', value: selectedDate.getTime() });
106
102
  dispatch({ type: 'end', value: state[0] });
@@ -108,8 +104,8 @@ const DateRangeInput = forwardRef((props, ref) => {
108
104
  else {
109
105
  dispatch({ type: 'end', value: selectedDate.getTime() });
110
106
  }
111
- (_a = endDateInputRef.current) === null || _a === void 0 ? void 0 : _a.setOpen(false);
112
- (_c = (_b = endDateInputRef.current) === null || _b === void 0 ? void 0 : _b.buttonEl) === null || _c === void 0 ? void 0 : _c.focus();
107
+ endDateInputRef.current?.setOpen(false);
108
+ endDateInputRef.current?.buttonEl?.focus();
113
109
  };
114
110
  const getSelectedRange = () => {
115
111
  const startDate = parseValueToDate(state[0]);
@@ -152,9 +148,7 @@ const DateRangeInput = forwardRef((props, ref) => {
152
148
  },
153
149
  info: props.info
154
150
  };
155
- const Comp = (_jsxs(Flex, Object.assign({ as: StyledDateRangeInput, container: { wrap: 'nowrap' } }, restProps, { ref: containerRef }, { children: [_jsx(DateInput, Object.assign({}, fromProps, { ref: startDateInputRef, picker: startPicker, onChange: changedValue => dispatch({ type: 'start', value: changedValue.valueAsTimestamp }) }), void 0),
156
- _jsx(DateInput, Object.assign({}, toProps, { ref: endDateInputRef, picker: endPicker, onChange: changedValue => dispatch({ type: 'end', value: changedValue.valueAsTimestamp }) }), void 0)] }), void 0));
157
- return Comp;
151
+ return (_jsxs(Flex, { as: StyledDateRangeInput, container: { wrap: 'nowrap' }, ...restProps, ref: containerRef, children: [_jsx(DateInput, { ...fromProps, ref: startDateInputRef, picker: startPicker, onChange: changedValue => dispatch({ type: 'start', value: changedValue.valueAsTimestamp }) }, void 0), _jsx(DateInput, { ...toProps, ref: endDateInputRef, picker: endPicker, onChange: changedValue => dispatch({ type: 'end', value: changedValue.valueAsTimestamp }) }, void 0)] }, void 0));
158
152
  });
159
153
  export default DateRangeInput;
160
154
  //# sourceMappingURL=DateRangeInput.js.map