@pega/cosmos-react-core 2.0.0-dev.9.2 → 2.0.0-rc.2

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 (810) 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 +2 -1
  5. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  6. package/lib/components/AppShell/AppHeader.js +4 -9
  7. package/lib/components/AppShell/AppHeader.js.map +1 -1
  8. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppShell.js +89 -62
  10. package/lib/components/AppShell/AppShell.js.map +1 -1
  11. package/lib/components/AppShell/AppShell.styles.d.ts +19 -16
  12. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppShell.styles.js +227 -173
  14. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  15. package/lib/components/AppShell/AppShell.types.d.ts +7 -7
  16. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  17. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  18. package/lib/components/AppShell/AppShellContext.d.ts +3 -0
  19. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  20. package/lib/components/AppShell/AppShellContext.js +3 -1
  21. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  22. package/lib/components/AppShell/AppShellList.d.ts +4 -3
  23. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  24. package/lib/components/AppShell/AppShellList.js +24 -19
  25. package/lib/components/AppShell/AppShellList.js.map +1 -1
  26. package/lib/components/AppShell/Drawer.d.ts.map +1 -1
  27. package/lib/components/AppShell/Drawer.js +7 -8
  28. package/lib/components/AppShell/Drawer.js.map +1 -1
  29. package/lib/components/AppShell/Operator.js +3 -5
  30. package/lib/components/AppShell/Operator.js.map +1 -1
  31. package/lib/components/AppShell/SkipNavigation.d.ts.map +1 -1
  32. package/lib/components/AppShell/SkipNavigation.js +30 -39
  33. package/lib/components/AppShell/SkipNavigation.js.map +1 -1
  34. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  35. package/lib/components/Avatar/Avatar.js +5 -4
  36. package/lib/components/Avatar/Avatar.js.map +1 -1
  37. package/lib/components/Backdrop/Backdrop.d.ts +1 -1
  38. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  39. package/lib/components/Backdrop/Backdrop.js +7 -6
  40. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  41. package/lib/components/Badges/Alert.d.ts +2 -2
  42. package/lib/components/Badges/Alert.d.ts.map +1 -1
  43. package/lib/components/Badges/Alert.js +1 -1
  44. package/lib/components/Badges/Alert.js.map +1 -1
  45. package/lib/components/Badges/Count.js +1 -1
  46. package/lib/components/Badges/Count.js.map +1 -1
  47. package/lib/components/Badges/Selection.d.ts.map +1 -1
  48. package/lib/components/Badges/Selection.js +10 -9
  49. package/lib/components/Badges/Selection.js.map +1 -1
  50. package/lib/components/Badges/Status.d.ts +2 -2
  51. package/lib/components/Badges/Status.d.ts.map +1 -1
  52. package/lib/components/Badges/Status.js +1 -1
  53. package/lib/components/Badges/Status.js.map +1 -1
  54. package/lib/components/Badges/Tag.js +1 -1
  55. package/lib/components/Badges/Tag.js.map +1 -1
  56. package/lib/components/Banner/Banner.d.ts +2 -2
  57. package/lib/components/Banner/Banner.d.ts.map +1 -1
  58. package/lib/components/Banner/Banner.js +6 -8
  59. package/lib/components/Banner/Banner.js.map +1 -1
  60. package/lib/components/Boolean/BooleanDisplay.d.ts +2 -2
  61. package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
  62. package/lib/components/Boolean/BooleanDisplay.js +1 -2
  63. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  64. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -2
  65. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  66. package/lib/components/Breadcrumbs/Breadcrumbs.js +13 -11
  67. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  68. package/lib/components/Button/BareButton.d.ts.map +1 -1
  69. package/lib/components/Button/BareButton.js +21 -2
  70. package/lib/components/Button/BareButton.js.map +1 -1
  71. package/lib/components/Button/BareRoleButton.d.ts +12 -0
  72. package/lib/components/Button/BareRoleButton.d.ts.map +1 -0
  73. package/lib/components/Button/BareRoleButton.js +20 -0
  74. package/lib/components/Button/BareRoleButton.js.map +1 -0
  75. package/lib/components/Button/Button.d.ts +5 -0
  76. package/lib/components/Button/Button.d.ts.map +1 -1
  77. package/lib/components/Button/Button.js +34 -10
  78. package/lib/components/Button/Button.js.map +1 -1
  79. package/lib/components/Card/Card.d.ts.map +1 -1
  80. package/lib/components/Card/Card.js +3 -2
  81. package/lib/components/Card/Card.js.map +1 -1
  82. package/lib/components/Card/CardContent.d.ts.map +1 -1
  83. package/lib/components/Card/CardContent.js +5 -4
  84. package/lib/components/Card/CardContent.js.map +1 -1
  85. package/lib/components/Card/CardFooter.d.ts.map +1 -1
  86. package/lib/components/Card/CardFooter.js +5 -4
  87. package/lib/components/Card/CardFooter.js.map +1 -1
  88. package/lib/components/Card/CardHeader.d.ts +3 -1
  89. package/lib/components/Card/CardHeader.d.ts.map +1 -1
  90. package/lib/components/Card/CardHeader.js +9 -7
  91. package/lib/components/Card/CardHeader.js.map +1 -1
  92. package/lib/components/Card/CardMedia.js +1 -1
  93. package/lib/components/Card/CardMedia.js.map +1 -1
  94. package/lib/components/Card/CollapsibleCard.d.ts.map +1 -1
  95. package/lib/components/Card/CollapsibleCard.js +5 -7
  96. package/lib/components/Card/CollapsibleCard.js.map +1 -1
  97. package/lib/components/Card/SelectableCard.js +1 -1
  98. package/lib/components/Card/SelectableCard.js.map +1 -1
  99. package/lib/components/Checkbox/Checkbox.d.ts +2 -2
  100. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  101. package/lib/components/Checkbox/Checkbox.js +1 -1
  102. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  103. package/lib/components/ColorPicker/ColorPicker.d.ts +2 -2
  104. package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  105. package/lib/components/ColorPicker/ColorPicker.js +8 -11
  106. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  107. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  108. package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
  109. package/lib/components/ComboBox/ComboBox.js +30 -33
  110. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  111. package/lib/components/ComboBox/ComboBox.types.d.ts +2 -1
  112. package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
  113. package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
  114. package/lib/components/ComboBox/ComboBoxInput.js +4 -4
  115. package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
  116. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  117. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +23 -29
  118. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  119. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
  120. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +16 -12
  121. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
  122. package/lib/components/Configuration/Configuration.js +11 -13
  123. package/lib/components/Configuration/Configuration.js.map +1 -1
  124. package/lib/components/Currency/CurrencyDisplay.d.ts +6 -2
  125. package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
  126. package/lib/components/Currency/CurrencyDisplay.js +11 -7
  127. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  128. package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
  129. package/lib/components/Currency/CurrencyInput.js +16 -16
  130. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  131. package/lib/components/Currency/CurrencyInput.types.d.ts +6 -2
  132. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  133. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  134. package/lib/components/Currency/utils.d.ts +12 -1
  135. package/lib/components/Currency/utils.d.ts.map +1 -1
  136. package/lib/components/Currency/utils.js +30 -2
  137. package/lib/components/Currency/utils.js.map +1 -1
  138. package/lib/components/DateTime/DateTime.types.d.ts +2 -1
  139. package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
  140. package/lib/components/DateTime/DateTime.types.js.map +1 -1
  141. package/lib/components/DateTime/DateTimeDisplay.d.ts +1 -1
  142. package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
  143. package/lib/components/DateTime/DateTimeDisplay.js +14 -3
  144. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  145. package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
  146. package/lib/components/DateTime/DurationDisplay.js +11 -6
  147. package/lib/components/DateTime/DurationDisplay.js.map +1 -1
  148. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  149. package/lib/components/DateTime/Input/DateInput.js +25 -27
  150. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  151. package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
  152. package/lib/components/DateTime/Input/DateRangeInput.js +10 -16
  153. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  154. package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
  155. package/lib/components/DateTime/Input/DateTime.styles.js +14 -3
  156. package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
  157. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  158. package/lib/components/DateTime/Input/DateTimeInput.js +42 -42
  159. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  160. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +2 -0
  161. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
  162. package/lib/components/DateTime/Input/DayOfWeekInput.js +7 -5
  163. package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
  164. package/lib/components/DateTime/Input/Duration/DurationInput.d.ts.map +1 -1
  165. package/lib/components/DateTime/Input/Duration/DurationInput.js +3 -3
  166. package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
  167. package/lib/components/DateTime/Input/Duration/NumberUnit.js +4 -5
  168. package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
  169. package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
  170. package/lib/components/DateTime/Input/Duration/Time.js +12 -15
  171. package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
  172. package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
  173. package/lib/components/DateTime/Input/MonthInput.js +12 -17
  174. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  175. package/lib/components/DateTime/Input/PartInput.js +3 -4
  176. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  177. package/lib/components/DateTime/Input/QuarterInput.d.ts +9 -0
  178. package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -0
  179. package/lib/components/DateTime/Input/QuarterInput.js +102 -0
  180. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -0
  181. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  182. package/lib/components/DateTime/Input/TimeInput.js +26 -30
  183. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  184. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  185. package/lib/components/DateTime/Input/WeekInput.js +22 -23
  186. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  187. package/lib/components/DateTime/Input/useAutoFocusNextInput.d.ts.map +1 -1
  188. package/lib/components/DateTime/Input/useAutoFocusNextInput.js +8 -9
  189. package/lib/components/DateTime/Input/useAutoFocusNextInput.js.map +1 -1
  190. package/lib/components/DateTime/Input/usePickerButton.js +4 -4
  191. package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
  192. package/lib/components/DateTime/Input/utils.d.ts +7 -0
  193. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  194. package/lib/components/DateTime/Input/utils.js +52 -10
  195. package/lib/components/DateTime/Input/utils.js.map +1 -1
  196. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  197. package/lib/components/DateTime/Picker/Calendar.js +47 -72
  198. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  199. package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -2
  200. package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
  201. package/lib/components/DateTime/Picker/Calendar.styles.js +16 -7
  202. package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
  203. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  204. package/lib/components/DateTime/Picker/DatePicker.js +13 -17
  205. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  206. package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
  207. package/lib/components/DateTime/Picker/DateRangePicker.js +13 -17
  208. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  209. package/lib/components/DateTime/Picker/TimePicker.js +9 -10
  210. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  211. package/lib/components/DateTime/Picker/Weeks.js +9 -11
  212. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  213. package/lib/components/DateTime/Picker/utils.d.ts +1 -0
  214. package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
  215. package/lib/components/DateTime/Picker/utils.js +3 -0
  216. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  217. package/lib/components/DateTime/index.d.ts +2 -0
  218. package/lib/components/DateTime/index.d.ts.map +1 -1
  219. package/lib/components/DateTime/index.js +1 -0
  220. package/lib/components/DateTime/index.js.map +1 -1
  221. package/lib/components/Drawer/Drawer.js +6 -6
  222. package/lib/components/Drawer/Drawer.js.map +1 -1
  223. package/lib/components/Email/EmailDisplay.d.ts +2 -2
  224. package/lib/components/Email/EmailDisplay.d.ts.map +1 -1
  225. package/lib/components/Email/EmailDisplay.js +2 -2
  226. package/lib/components/Email/EmailDisplay.js.map +1 -1
  227. package/lib/components/EmojiPicker/EmojiDisplay.d.ts.map +1 -1
  228. package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
  229. package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
  230. package/lib/components/EmojiPicker/EmojiPicker.js +3 -4
  231. package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
  232. package/lib/components/EmptyState/EmptyState.d.ts +14 -0
  233. package/lib/components/EmptyState/EmptyState.d.ts.map +1 -0
  234. package/lib/components/{NoItems/NoItems.js → EmptyState/EmptyState.js} +11 -8
  235. package/lib/components/EmptyState/EmptyState.js.map +1 -0
  236. package/lib/components/EmptyState/index.d.ts +4 -0
  237. package/lib/components/EmptyState/index.d.ts.map +1 -0
  238. package/lib/components/EmptyState/index.js +3 -0
  239. package/lib/components/EmptyState/index.js.map +1 -0
  240. package/lib/components/ErrorState/ErrorState.d.ts +16 -0
  241. package/lib/components/ErrorState/ErrorState.d.ts.map +1 -0
  242. package/lib/components/ErrorState/ErrorState.js +31 -0
  243. package/lib/components/ErrorState/ErrorState.js.map +1 -0
  244. package/lib/components/ErrorState/index.d.ts +4 -0
  245. package/lib/components/ErrorState/index.d.ts.map +1 -0
  246. package/lib/components/ErrorState/index.js +3 -0
  247. package/lib/components/ErrorState/index.js.map +1 -0
  248. package/lib/components/ExpandCollapse/ExpandCollapse.js +5 -5
  249. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  250. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  251. package/lib/components/FieldGroup/FieldGroup.js +6 -7
  252. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  253. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  254. package/lib/components/FieldGroup/FieldGroupList.js +7 -6
  255. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  256. package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
  257. package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
  258. package/lib/components/FieldValueList/FieldValueList.js +5 -7
  259. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  260. package/lib/components/File/FileDisplay.d.ts +6 -3
  261. package/lib/components/File/FileDisplay.d.ts.map +1 -1
  262. package/lib/components/File/FileDisplay.js +7 -7
  263. package/lib/components/File/FileDisplay.js.map +1 -1
  264. package/lib/components/File/FileInput.d.ts +3 -3
  265. package/lib/components/File/FileInput.d.ts.map +1 -1
  266. package/lib/components/File/FileInput.js +18 -19
  267. package/lib/components/File/FileInput.js.map +1 -1
  268. package/lib/components/File/FileItem.d.ts +0 -2
  269. package/lib/components/File/FileItem.d.ts.map +1 -1
  270. package/lib/components/File/FileItem.js +3 -4
  271. package/lib/components/File/FileItem.js.map +1 -1
  272. package/lib/components/File/FileUploadItem.d.ts +4 -2
  273. package/lib/components/File/FileUploadItem.d.ts.map +1 -1
  274. package/lib/components/File/FileUploadItem.js +58 -20
  275. package/lib/components/File/FileUploadItem.js.map +1 -1
  276. package/lib/components/File/FileVisual.d.ts +7 -16
  277. package/lib/components/File/FileVisual.d.ts.map +1 -1
  278. package/lib/components/File/FileVisual.js +44 -47
  279. package/lib/components/File/FileVisual.js.map +1 -1
  280. package/lib/components/File/utils.js +2 -3
  281. package/lib/components/File/utils.js.map +1 -1
  282. package/lib/components/Flex/Flex.d.ts +17 -7
  283. package/lib/components/Flex/Flex.d.ts.map +1 -1
  284. package/lib/components/Flex/Flex.js +25 -9
  285. package/lib/components/Flex/Flex.js.map +1 -1
  286. package/lib/components/Form/Form.d.ts +7 -1
  287. package/lib/components/Form/Form.d.ts.map +1 -1
  288. package/lib/components/Form/Form.js +5 -4
  289. package/lib/components/Form/Form.js.map +1 -1
  290. package/lib/components/FormControl/FormControl.d.ts +1 -1
  291. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  292. package/lib/components/FormControl/FormControl.js +1 -1
  293. package/lib/components/FormControl/FormControl.js.map +1 -1
  294. package/lib/components/FormField/FormField.d.ts +5 -7
  295. package/lib/components/FormField/FormField.d.ts.map +1 -1
  296. package/lib/components/FormField/FormField.js +9 -19
  297. package/lib/components/FormField/FormField.js.map +1 -1
  298. package/lib/components/Grid/Grid.d.ts +1 -1
  299. package/lib/components/Grid/Grid.d.ts.map +1 -1
  300. package/lib/components/Grid/Grid.js +17 -21
  301. package/lib/components/Grid/Grid.js.map +1 -1
  302. package/lib/components/Icon/Icon.js +3 -5
  303. package/lib/components/Icon/Icon.js.map +1 -1
  304. package/lib/components/Icon/iconNames.d.ts +1 -1
  305. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  306. package/lib/components/Icon/iconNames.js +2 -0
  307. package/lib/components/Icon/iconNames.js.map +1 -1
  308. package/lib/components/Icon/icons/compass-solid.icon.js +1 -2
  309. package/lib/components/Icon/icons/compass-solid.icon.js.map +1 -1
  310. package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js +1 -4
  311. package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js.map +1 -1
  312. package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js +1 -2
  313. package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js.map +1 -1
  314. package/lib/components/Icon/icons/dataviz-waterfall.icon.js +1 -5
  315. package/lib/components/Icon/icons/dataviz-waterfall.icon.js.map +1 -1
  316. package/lib/components/Icon/icons/dock.icon.d.ts +4 -0
  317. package/lib/components/Icon/icons/dock.icon.d.ts.map +1 -0
  318. package/lib/components/Icon/icons/dock.icon.js +6 -0
  319. package/lib/components/Icon/icons/dock.icon.js.map +1 -0
  320. package/lib/components/Icon/icons/filetype-text.icon.js +1 -4
  321. package/lib/components/Icon/icons/filetype-text.icon.js.map +1 -1
  322. package/lib/components/Icon/icons/folder-dollar.icon.js +1 -2
  323. package/lib/components/Icon/icons/folder-dollar.icon.js.map +1 -1
  324. package/lib/components/Icon/icons/freeze-column.icon.js +1 -2
  325. package/lib/components/Icon/icons/freeze-column.icon.js.map +1 -1
  326. package/lib/components/Icon/icons/galaxy.icon.js +1 -3
  327. package/lib/components/Icon/icons/galaxy.icon.js.map +1 -1
  328. package/lib/components/Icon/icons/grad-solid.icon.js +1 -2
  329. package/lib/components/Icon/icons/grad-solid.icon.js.map +1 -1
  330. package/lib/components/Icon/icons/grad.icon.js +1 -5
  331. package/lib/components/Icon/icons/grad.icon.js.map +1 -1
  332. package/lib/components/Icon/icons/list-number.icon.js +1 -6
  333. package/lib/components/Icon/icons/list-number.icon.js.map +1 -1
  334. package/lib/components/Icon/icons/list.icon.js +1 -6
  335. package/lib/components/Icon/icons/list.icon.js.map +1 -1
  336. package/lib/components/Icon/icons/pin.icon.js +1 -2
  337. package/lib/components/Icon/icons/pin.icon.js.map +1 -1
  338. package/lib/components/Icon/icons/search-solid.icon.js +1 -2
  339. package/lib/components/Icon/icons/search-solid.icon.js.map +1 -1
  340. package/lib/components/Icon/icons/tracer.icon.js +1 -2
  341. package/lib/components/Icon/icons/tracer.icon.js.map +1 -1
  342. package/lib/components/Icon/icons/tribox-solid.icon.js +1 -3
  343. package/lib/components/Icon/icons/tribox-solid.icon.js.map +1 -1
  344. package/lib/components/Icon/icons/tribox.icon.js +1 -3
  345. package/lib/components/Icon/icons/tribox.icon.js.map +1 -1
  346. package/lib/components/Icon/icons/undock.icon.d.ts +4 -0
  347. package/lib/components/Icon/icons/undock.icon.d.ts.map +1 -0
  348. package/lib/components/Icon/icons/undock.icon.js +6 -0
  349. package/lib/components/Icon/icons/undock.icon.js.map +1 -0
  350. package/lib/components/Image/Image.js +1 -1
  351. package/lib/components/Image/Image.js.map +1 -1
  352. package/lib/components/Image/index.d.ts +1 -1
  353. package/lib/components/Image/index.d.ts.map +1 -1
  354. package/lib/components/Image/index.js +1 -0
  355. package/lib/components/Image/index.js.map +1 -1
  356. package/lib/components/Input/Input.d.ts +2 -2
  357. package/lib/components/Input/Input.d.ts.map +1 -1
  358. package/lib/components/Input/Input.js +13 -13
  359. package/lib/components/Input/Input.js.map +1 -1
  360. package/lib/components/Input/Input.styles.js +2 -2
  361. package/lib/components/Input/Input.styles.js.map +1 -1
  362. package/lib/components/Label/Label.js +1 -1
  363. package/lib/components/Label/Label.js.map +1 -1
  364. package/lib/components/Lightbox/Lightbox.d.ts +6 -0
  365. package/lib/components/Lightbox/Lightbox.d.ts.map +1 -0
  366. package/lib/components/Lightbox/Lightbox.js +129 -0
  367. package/lib/components/Lightbox/Lightbox.js.map +1 -0
  368. package/lib/components/Lightbox/Lightbox.styles.d.ts +11 -0
  369. package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -0
  370. package/lib/components/Lightbox/Lightbox.styles.js +166 -0
  371. package/lib/components/Lightbox/Lightbox.styles.js.map +1 -0
  372. package/lib/components/Lightbox/Lightbox.types.d.ts +42 -0
  373. package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -0
  374. package/lib/components/Lightbox/Lightbox.types.js +2 -0
  375. package/lib/components/Lightbox/Lightbox.types.js.map +1 -0
  376. package/lib/components/Lightbox/index.d.ts +3 -0
  377. package/lib/components/Lightbox/index.d.ts.map +1 -0
  378. package/lib/components/Lightbox/index.js +2 -0
  379. package/lib/components/Lightbox/index.js.map +1 -0
  380. package/lib/components/Link/Link.js +5 -8
  381. package/lib/components/Link/Link.js.map +1 -1
  382. package/lib/components/List/CommaSeparatedList.d.ts +15 -0
  383. package/lib/components/List/CommaSeparatedList.d.ts.map +1 -0
  384. package/lib/components/List/CommaSeparatedList.js +61 -0
  385. package/lib/components/List/CommaSeparatedList.js.map +1 -0
  386. package/lib/components/List/List.d.ts +30 -0
  387. package/lib/components/List/List.d.ts.map +1 -0
  388. package/lib/components/List/List.js +56 -0
  389. package/lib/components/List/List.js.map +1 -0
  390. package/lib/components/List/OrderedList.d.ts +6 -0
  391. package/lib/components/List/OrderedList.d.ts.map +1 -0
  392. package/lib/components/List/OrderedList.js +6 -0
  393. package/lib/components/List/OrderedList.js.map +1 -0
  394. package/lib/components/List/UnorderedList.d.ts +6 -0
  395. package/lib/components/List/UnorderedList.d.ts.map +1 -0
  396. package/lib/components/List/UnorderedList.js +6 -0
  397. package/lib/components/List/UnorderedList.js.map +1 -0
  398. package/lib/components/List/index.d.ts +5 -0
  399. package/lib/components/List/index.d.ts.map +1 -0
  400. package/lib/components/List/index.js +4 -0
  401. package/lib/components/List/index.js.map +1 -0
  402. package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
  403. package/lib/components/Location/CurrentLocationButton.js +7 -7
  404. package/lib/components/Location/CurrentLocationButton.js.map +1 -1
  405. package/lib/components/Location/Location.types.d.ts +2 -1
  406. package/lib/components/Location/Location.types.d.ts.map +1 -1
  407. package/lib/components/Location/Location.types.js.map +1 -1
  408. package/lib/components/Location/LocationDisplay.js +8 -9
  409. package/lib/components/Location/LocationDisplay.js.map +1 -1
  410. package/lib/components/Location/LocationInput.js +27 -28
  411. package/lib/components/Location/LocationInput.js.map +1 -1
  412. package/lib/components/Location/LocationView.js +8 -13
  413. package/lib/components/Location/LocationView.js.map +1 -1
  414. package/lib/components/Location/utils.js +11 -15
  415. package/lib/components/Location/utils.js.map +1 -1
  416. package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
  417. package/lib/components/Menu/FlyoutMenuList.js +12 -15
  418. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  419. package/lib/components/Menu/Menu.context.d.ts.map +1 -1
  420. package/lib/components/Menu/Menu.context.js +2 -0
  421. package/lib/components/Menu/Menu.context.js.map +1 -1
  422. package/lib/components/Menu/Menu.d.ts.map +1 -1
  423. package/lib/components/Menu/Menu.js +89 -46
  424. package/lib/components/Menu/Menu.js.map +1 -1
  425. package/lib/components/Menu/Menu.styles.d.ts +11 -0
  426. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  427. package/lib/components/Menu/Menu.styles.js +202 -3
  428. package/lib/components/Menu/Menu.styles.js.map +1 -1
  429. package/lib/components/Menu/Menu.types.d.ts +30 -12
  430. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  431. package/lib/components/Menu/Menu.types.js.map +1 -1
  432. package/lib/components/Menu/MenuGroup.d.ts +6 -0
  433. package/lib/components/Menu/MenuGroup.d.ts.map +1 -0
  434. package/lib/components/Menu/MenuGroup.js +17 -0
  435. package/lib/components/Menu/MenuGroup.js.map +1 -0
  436. package/lib/components/Menu/MenuItem.d.ts +0 -3
  437. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  438. package/lib/components/Menu/MenuItem.js +57 -164
  439. package/lib/components/Menu/MenuItem.js.map +1 -1
  440. package/lib/components/Menu/MenuList.d.ts +1 -1
  441. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  442. package/lib/components/Menu/MenuList.js +28 -30
  443. package/lib/components/Menu/MenuList.js.map +1 -1
  444. package/lib/components/Menu/MenuListHeader.d.ts +0 -1
  445. package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
  446. package/lib/components/Menu/MenuListHeader.js +7 -55
  447. package/lib/components/Menu/MenuListHeader.js.map +1 -1
  448. package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
  449. package/lib/components/Menu/NavItemsList.js +2 -3
  450. package/lib/components/Menu/NavItemsList.js.map +1 -1
  451. package/lib/components/Menu/helpers.d.ts +13 -12
  452. package/lib/components/Menu/helpers.d.ts.map +1 -1
  453. package/lib/components/Menu/helpers.js +40 -36
  454. package/lib/components/Menu/helpers.js.map +1 -1
  455. package/lib/components/Menu/index.d.ts +2 -3
  456. package/lib/components/Menu/index.d.ts.map +1 -1
  457. package/lib/components/Menu/index.js +1 -2
  458. package/lib/components/Menu/index.js.map +1 -1
  459. package/lib/components/MenuButton/MenuButton.d.ts +3 -1
  460. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  461. package/lib/components/MenuButton/MenuButton.js +13 -14
  462. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  463. package/lib/components/MetaList/MetaList.d.ts +13 -4
  464. package/lib/components/MetaList/MetaList.d.ts.map +1 -1
  465. package/lib/components/MetaList/MetaList.js +34 -20
  466. package/lib/components/MetaList/MetaList.js.map +1 -1
  467. package/lib/components/Modal/Contexts.d.ts.map +1 -1
  468. package/lib/components/Modal/Contexts.js +3 -0
  469. package/lib/components/Modal/Contexts.js.map +1 -1
  470. package/lib/components/Modal/DockedModals.d.ts.map +1 -1
  471. package/lib/components/Modal/DockedModals.js +5 -4
  472. package/lib/components/Modal/DockedModals.js.map +1 -1
  473. package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
  474. package/lib/components/Modal/MinimizedModal.js +53 -38
  475. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  476. package/lib/components/Modal/Modal.d.ts +1 -6
  477. package/lib/components/Modal/Modal.d.ts.map +1 -1
  478. package/lib/components/Modal/Modal.js +82 -134
  479. package/lib/components/Modal/Modal.js.map +1 -1
  480. package/lib/components/Modal/Modal.styles.d.ts +9 -0
  481. package/lib/components/Modal/Modal.styles.d.ts.map +1 -0
  482. package/lib/components/Modal/Modal.styles.js +135 -0
  483. package/lib/components/Modal/Modal.styles.js.map +1 -0
  484. package/lib/components/Modal/Modal.types.d.ts +56 -5
  485. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  486. package/lib/components/Modal/Modal.types.js.map +1 -1
  487. package/lib/components/Modal/ModalManager.d.ts.map +1 -1
  488. package/lib/components/Modal/ModalManager.js +74 -65
  489. package/lib/components/Modal/ModalManager.js.map +1 -1
  490. package/lib/components/MultiStep/MultiStep.d.ts.map +1 -1
  491. package/lib/components/MultiStep/MultiStep.js +10 -12
  492. package/lib/components/MultiStep/MultiStep.js.map +1 -1
  493. package/lib/components/MultiStep/MultiStep.styles.js +1 -1
  494. package/lib/components/MultiStep/MultiStep.styles.js.map +1 -1
  495. package/lib/components/MultiStep/MultiStep.types.d.ts +4 -2
  496. package/lib/components/MultiStep/MultiStep.types.d.ts.map +1 -1
  497. package/lib/components/MultiStep/MultiStep.types.js.map +1 -1
  498. package/lib/components/Number/NumberDisplay.d.ts +2 -2
  499. package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
  500. package/lib/components/Number/NumberDisplay.js +1 -1
  501. package/lib/components/Number/NumberDisplay.js.map +1 -1
  502. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  503. package/lib/components/Number/NumberInput.js +18 -25
  504. package/lib/components/Number/NumberInput.js.map +1 -1
  505. package/lib/components/Number/NumberInput.styles.d.ts +2 -2
  506. package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
  507. package/lib/components/Number/NumberInput.types.d.ts +2 -2
  508. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  509. package/lib/components/Number/NumberInput.types.js.map +1 -1
  510. package/lib/components/Number/utils.js +2 -3
  511. package/lib/components/Number/utils.js.map +1 -1
  512. package/lib/components/PageTemplates/CategorySubPage.d.ts +1 -1
  513. package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
  514. package/lib/components/PageTemplates/CategorySubPage.js +8 -18
  515. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  516. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +1 -1
  517. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  518. package/lib/components/PageTemplates/DashboardPage.d.ts +7 -1
  519. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  520. package/lib/components/PageTemplates/DashboardPage.js +48 -28
  521. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  522. package/lib/components/PageTemplates/PageTemplates.d.ts +15 -6
  523. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  524. package/lib/components/PageTemplates/PageTemplates.js +89 -79
  525. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  526. package/lib/components/PageTemplates/index.d.ts +3 -0
  527. package/lib/components/PageTemplates/index.d.ts.map +1 -1
  528. package/lib/components/PageTemplates/index.js +1 -0
  529. package/lib/components/PageTemplates/index.js.map +1 -1
  530. package/lib/components/Pagination/Pagination.d.ts +2 -2
  531. package/lib/components/Pagination/Pagination.d.ts.map +1 -1
  532. package/lib/components/Pagination/Pagination.js +7 -6
  533. package/lib/components/Pagination/Pagination.js.map +1 -1
  534. package/lib/components/Paragraph/ParagraphDisplay.d.ts +11 -0
  535. package/lib/components/Paragraph/ParagraphDisplay.d.ts.map +1 -0
  536. package/lib/components/Paragraph/ParagraphDisplay.js +11 -0
  537. package/lib/components/Paragraph/ParagraphDisplay.js.map +1 -0
  538. package/lib/components/Paragraph/index.d.ts +3 -0
  539. package/lib/components/Paragraph/index.d.ts.map +1 -0
  540. package/lib/components/Paragraph/index.js +2 -0
  541. package/lib/components/Paragraph/index.js.map +1 -0
  542. package/lib/components/Phone/PhoneDisplay.d.ts +2 -2
  543. package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
  544. package/lib/components/Phone/PhoneDisplay.js +2 -3
  545. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  546. package/lib/components/Phone/PhoneInput.d.ts +2 -2
  547. package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
  548. package/lib/components/Phone/PhoneInput.js +18 -17
  549. package/lib/components/Phone/PhoneInput.js.map +1 -1
  550. package/lib/components/Phone/utils.js +2 -3
  551. package/lib/components/Phone/utils.js.map +1 -1
  552. package/lib/components/Popover/Popover.d.ts +0 -4
  553. package/lib/components/Popover/Popover.d.ts.map +1 -1
  554. package/lib/components/Popover/Popover.js +11 -122
  555. package/lib/components/Popover/Popover.js.map +1 -1
  556. package/lib/components/Popover/Popover.styles.d.ts +5 -0
  557. package/lib/components/Popover/Popover.styles.d.ts.map +1 -0
  558. package/lib/components/Popover/Popover.styles.js +116 -0
  559. package/lib/components/Popover/Popover.styles.js.map +1 -0
  560. package/lib/components/Popover/PopoverManager.js +2 -2
  561. package/lib/components/Popover/PopoverManager.js.map +1 -1
  562. package/lib/components/Popover/index.d.ts +1 -1
  563. package/lib/components/Popover/index.d.ts.map +1 -1
  564. package/lib/components/Popover/index.js +1 -1
  565. package/lib/components/Popover/index.js.map +1 -1
  566. package/lib/components/Progress/Bar.js +2 -2
  567. package/lib/components/Progress/Bar.js.map +1 -1
  568. package/lib/components/Progress/Ellipsis.d.ts +1 -1
  569. package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
  570. package/lib/components/Progress/Ellipsis.js +48 -50
  571. package/lib/components/Progress/Ellipsis.js.map +1 -1
  572. package/lib/components/Progress/Progress.js +3 -4
  573. package/lib/components/Progress/Progress.js.map +1 -1
  574. package/lib/components/Progress/Progress.types.d.ts +2 -2
  575. package/lib/components/Progress/Progress.types.d.ts.map +1 -1
  576. package/lib/components/Progress/Progress.types.js.map +1 -1
  577. package/lib/components/Progress/Ring.d.ts +1 -1
  578. package/lib/components/Progress/Ring.d.ts.map +1 -1
  579. package/lib/components/Progress/Ring.js +40 -40
  580. package/lib/components/Progress/Ring.js.map +1 -1
  581. package/lib/components/RadioButton/RadioButton.d.ts +2 -2
  582. package/lib/components/RadioButton/RadioButton.d.ts.map +1 -1
  583. package/lib/components/RadioButton/RadioButton.js +1 -1
  584. package/lib/components/RadioButton/RadioButton.js.map +1 -1
  585. package/lib/components/RadioCheck/RadioCheck.d.ts +2 -2
  586. package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
  587. package/lib/components/RadioCheck/RadioCheck.js +7 -8
  588. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  589. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +4 -0
  590. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
  591. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +19 -18
  592. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  593. package/lib/components/Rating/Rating.d.ts +2 -2
  594. package/lib/components/Rating/Rating.d.ts.map +1 -1
  595. package/lib/components/Rating/Rating.js +6 -7
  596. package/lib/components/Rating/Rating.js.map +1 -1
  597. package/lib/components/SearchInput/SearchInput.d.ts +4 -4
  598. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  599. package/lib/components/SearchInput/SearchInput.js +14 -14
  600. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  601. package/lib/components/Select/Option.js +1 -1
  602. package/lib/components/Select/Option.js.map +1 -1
  603. package/lib/components/Select/Select.d.ts.map +1 -1
  604. package/lib/components/Select/Select.js +15 -16
  605. package/lib/components/Select/Select.js.map +1 -1
  606. package/lib/components/Sentiment/Sentiment.d.ts +2 -2
  607. package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
  608. package/lib/components/Sentiment/Sentiment.js +1 -2
  609. package/lib/components/Sentiment/Sentiment.js.map +1 -1
  610. package/lib/components/Skeleton/LineSkeleton.js +1 -1
  611. package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
  612. package/lib/components/Skeleton/ParagraphSkeleton.js +1 -1
  613. package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
  614. package/lib/components/Skeleton/RectangleSkeleton.js +1 -1
  615. package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
  616. package/lib/components/Slider/Slider.d.ts.map +1 -1
  617. package/lib/components/Slider/Slider.js +12 -19
  618. package/lib/components/Slider/Slider.js.map +1 -1
  619. package/lib/components/Slider/Slider.styles.d.ts +4 -1
  620. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  621. package/lib/components/Slider/Slider.styles.js +17 -5
  622. package/lib/components/Slider/Slider.styles.js.map +1 -1
  623. package/lib/components/Slider/Slider.types.d.ts +2 -2
  624. package/lib/components/Slider/Slider.types.d.ts.map +1 -1
  625. package/lib/components/Slider/Slider.types.js.map +1 -1
  626. package/lib/components/Slider/SliderTicks.d.ts +1 -0
  627. package/lib/components/Slider/SliderTicks.d.ts.map +1 -1
  628. package/lib/components/Slider/SliderTicks.js +19 -12
  629. package/lib/components/Slider/SliderTicks.js.map +1 -1
  630. package/lib/components/Slider/utils.d.ts +10 -11
  631. package/lib/components/Slider/utils.d.ts.map +1 -1
  632. package/lib/components/Slider/utils.js +24 -18
  633. package/lib/components/Slider/utils.js.map +1 -1
  634. package/lib/components/SummaryItem/SummaryItem.d.ts +5 -5
  635. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  636. package/lib/components/SummaryItem/SummaryItem.js +3 -5
  637. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  638. package/lib/components/SummaryList/SummaryList.d.ts +8 -2
  639. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  640. package/lib/components/SummaryList/SummaryList.js +10 -11
  641. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  642. package/lib/components/SummaryList/ViewAll.d.ts +1 -1
  643. package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
  644. package/lib/components/SummaryList/ViewAll.js +14 -10
  645. package/lib/components/SummaryList/ViewAll.js.map +1 -1
  646. package/lib/components/Switch/Switch.d.ts +2 -2
  647. package/lib/components/Switch/Switch.d.ts.map +1 -1
  648. package/lib/components/Switch/Switch.js +41 -30
  649. package/lib/components/Switch/Switch.js.map +1 -1
  650. package/lib/components/Table/Table.d.ts +2 -2
  651. package/lib/components/Table/Table.d.ts.map +1 -1
  652. package/lib/components/Table/Table.js +14 -13
  653. package/lib/components/Table/Table.js.map +1 -1
  654. package/lib/components/Tabs/Tab.d.ts +1 -1
  655. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  656. package/lib/components/Tabs/Tab.js +9 -7
  657. package/lib/components/Tabs/Tab.js.map +1 -1
  658. package/lib/components/Tabs/TabPanel.d.ts +10 -2
  659. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  660. package/lib/components/Tabs/TabPanel.js +24 -8
  661. package/lib/components/Tabs/TabPanel.js.map +1 -1
  662. package/lib/components/Tabs/Tabs.d.ts +1 -0
  663. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  664. package/lib/components/Tabs/Tabs.js +22 -18
  665. package/lib/components/Tabs/Tabs.js.map +1 -1
  666. package/lib/components/Tabs/Tabs.types.d.ts +2 -2
  667. package/lib/components/Tabs/Tabs.types.d.ts.map +1 -1
  668. package/lib/components/Tabs/Tabs.types.js.map +1 -1
  669. package/lib/components/Text/Text.d.ts +1 -1
  670. package/lib/components/Text/Text.d.ts.map +1 -1
  671. package/lib/components/Text/Text.js +2 -2
  672. package/lib/components/Text/Text.js.map +1 -1
  673. package/lib/components/TextArea/TextArea.d.ts +2 -2
  674. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  675. package/lib/components/TextArea/TextArea.js +31 -30
  676. package/lib/components/TextArea/TextArea.js.map +1 -1
  677. package/lib/components/Toaster/Toaster.d.ts +8 -36
  678. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  679. package/lib/components/Toaster/Toaster.js +97 -102
  680. package/lib/components/Toaster/Toaster.js.map +1 -1
  681. package/lib/components/Tooltip/Tooltip.d.ts +6 -1
  682. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  683. package/lib/components/Tooltip/Tooltip.js +6 -13
  684. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  685. package/lib/components/Tree/StandardTree.d.ts +6 -0
  686. package/lib/components/Tree/StandardTree.d.ts.map +1 -0
  687. package/lib/components/Tree/StandardTree.js +175 -0
  688. package/lib/components/Tree/StandardTree.js.map +1 -0
  689. package/lib/components/Tree/StandardTree.styles.d.ts +13 -0
  690. package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -0
  691. package/lib/components/Tree/StandardTree.styles.js +155 -0
  692. package/lib/components/Tree/StandardTree.styles.js.map +1 -0
  693. package/lib/components/Tree/StandardTree.types.d.ts +25 -0
  694. package/lib/components/Tree/StandardTree.types.d.ts.map +1 -0
  695. package/lib/components/Tree/StandardTree.types.js +2 -0
  696. package/lib/components/Tree/StandardTree.types.js.map +1 -0
  697. package/lib/components/Tree/Tree.d.ts +35 -49
  698. package/lib/components/Tree/Tree.d.ts.map +1 -1
  699. package/lib/components/Tree/Tree.js +18 -56
  700. package/lib/components/Tree/Tree.js.map +1 -1
  701. package/lib/components/Tree/helpers.d.ts +19 -0
  702. package/lib/components/Tree/helpers.d.ts.map +1 -0
  703. package/lib/components/Tree/helpers.js +180 -0
  704. package/lib/components/Tree/helpers.js.map +1 -0
  705. package/lib/components/Tree/index.d.ts +4 -2
  706. package/lib/components/Tree/index.d.ts.map +1 -1
  707. package/lib/components/Tree/index.js +3 -1
  708. package/lib/components/Tree/index.js.map +1 -1
  709. package/lib/components/URL/URLDisplay.d.ts +2 -2
  710. package/lib/components/URL/URLDisplay.d.ts.map +1 -1
  711. package/lib/components/URL/URLDisplay.js +2 -2
  712. package/lib/components/URL/URLDisplay.js.map +1 -1
  713. package/lib/hooks/index.d.ts +7 -4
  714. package/lib/hooks/index.d.ts.map +1 -1
  715. package/lib/hooks/index.js +7 -3
  716. package/lib/hooks/index.js.map +1 -1
  717. package/lib/hooks/useActiveDescendant.d.ts +17 -3
  718. package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
  719. package/lib/hooks/useActiveDescendant.js +86 -64
  720. package/lib/hooks/useActiveDescendant.js.map +1 -1
  721. package/lib/hooks/useAutoResize.d.ts.map +1 -1
  722. package/lib/hooks/useAutoResize.js +6 -7
  723. package/lib/hooks/useAutoResize.js.map +1 -1
  724. package/lib/hooks/useBreakpoint.js +2 -4
  725. package/lib/hooks/useBreakpoint.js.map +1 -1
  726. package/lib/hooks/useDraggable.d.ts +8 -0
  727. package/lib/hooks/useDraggable.d.ts.map +1 -0
  728. package/lib/hooks/useDraggable.js +64 -0
  729. package/lib/hooks/useDraggable.js.map +1 -0
  730. package/lib/hooks/useFocusWithin.d.ts +1 -1
  731. package/lib/hooks/useFocusWithin.d.ts.map +1 -1
  732. package/lib/hooks/useFocusWithin.js +29 -24
  733. package/lib/hooks/useFocusWithin.js.map +1 -1
  734. package/lib/hooks/useI18n.d.ts +505 -170
  735. package/lib/hooks/useI18n.d.ts.map +1 -1
  736. package/lib/hooks/useI18n.js +2 -2
  737. package/lib/hooks/useI18n.js.map +1 -1
  738. package/lib/hooks/useLongPress.d.ts +16 -0
  739. package/lib/hooks/useLongPress.d.ts.map +1 -0
  740. package/lib/hooks/useLongPress.js +59 -0
  741. package/lib/hooks/useLongPress.js.map +1 -0
  742. package/lib/hooks/useOuterEvent.js +1 -1
  743. package/lib/hooks/useOuterEvent.js.map +1 -1
  744. package/lib/hooks/useOverride.js +1 -1
  745. package/lib/hooks/useOverride.js.map +1 -1
  746. package/lib/hooks/useScrollStick.js +14 -3
  747. package/lib/hooks/useScrollStick.js.map +1 -1
  748. package/lib/hooks/useScrollToggle.d.ts +6 -0
  749. package/lib/hooks/useScrollToggle.d.ts.map +1 -0
  750. package/lib/hooks/useScrollToggle.js +40 -0
  751. package/lib/hooks/useScrollToggle.js.map +1 -0
  752. package/lib/hooks/useTransitionState.d.ts +39 -0
  753. package/lib/hooks/useTransitionState.d.ts.map +1 -0
  754. package/lib/hooks/useTransitionState.js +56 -0
  755. package/lib/hooks/useTransitionState.js.map +1 -0
  756. package/lib/i18n/default.d.ts +583 -0
  757. package/lib/i18n/default.d.ts.map +1 -0
  758. package/lib/i18n/default.js +627 -0
  759. package/lib/i18n/default.js.map +1 -0
  760. package/lib/i18n/i18n.d.ts +988 -318
  761. package/lib/i18n/i18n.d.ts.map +1 -1
  762. package/lib/i18n/i18n.js +1 -1
  763. package/lib/i18n/i18n.js.map +1 -1
  764. package/lib/i18n/index.d.ts +1 -0
  765. package/lib/i18n/index.d.ts.map +1 -1
  766. package/lib/i18n/index.js.map +1 -1
  767. package/lib/i18n/translate.d.ts +29 -4
  768. package/lib/i18n/translate.d.ts.map +1 -1
  769. package/lib/i18n/translate.js +21 -8
  770. package/lib/i18n/translate.js.map +1 -1
  771. package/lib/index.d.ts +8 -2
  772. package/lib/index.d.ts.map +1 -1
  773. package/lib/index.js +8 -2
  774. package/lib/index.js.map +1 -1
  775. package/lib/styles/GlobalStyle.d.ts.map +1 -1
  776. package/lib/styles/GlobalStyle.js +2 -26
  777. package/lib/styles/GlobalStyle.js.map +1 -1
  778. package/lib/theme/ThemeMachine.js +7 -1
  779. package/lib/theme/ThemeMachine.js.map +1 -1
  780. package/lib/theme/index.d.ts +1 -0
  781. package/lib/theme/index.d.ts.map +1 -1
  782. package/lib/theme/index.js +1 -0
  783. package/lib/theme/index.js.map +1 -1
  784. package/lib/theme/theme.d.ts +83 -53
  785. package/lib/theme/theme.d.ts.map +1 -1
  786. package/lib/theme/themeDefinition.json +50 -30
  787. package/lib/theme/themeOverrides.schema.json +24 -3
  788. package/lib/theme/themes/buildTheme.json +3 -39
  789. package/lib/theme/themes/darkTheme.json +6 -0
  790. package/lib/theme/themes/legacyBuildTheme.json +50 -0
  791. package/lib/types/types.d.ts +6 -1
  792. package/lib/types/types.d.ts.map +1 -1
  793. package/lib/types/types.js.map +1 -1
  794. package/lib/utils/utils.d.ts +41 -4
  795. package/lib/utils/utils.d.ts.map +1 -1
  796. package/lib/utils/utils.js +55 -9
  797. package/lib/utils/utils.js.map +1 -1
  798. package/package.json +10 -11
  799. package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts +0 -3
  800. package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts.map +0 -1
  801. package/lib/components/DateTime/Input/useButtonAriaLabel.js +0 -33
  802. package/lib/components/DateTime/Input/useButtonAriaLabel.js.map +0 -1
  803. package/lib/components/NoItems/NoItems.d.ts +0 -14
  804. package/lib/components/NoItems/NoItems.d.ts.map +0 -1
  805. package/lib/components/NoItems/NoItems.js.map +0 -1
  806. package/lib/components/NoItems/index.d.ts +0 -4
  807. package/lib/components/NoItems/index.d.ts.map +0 -1
  808. package/lib/components/NoItems/index.js +0 -3
  809. package/lib/components/NoItems/index.js.map +0 -1
  810. package/lib/i18n/default.json +0 -246
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRef } from 'react';
2
+ import { useCallback, useRef } from 'react';
3
3
  import { useI18n, useFocusWithin } from '../../../../hooks';
4
4
  import { msToTimeFormat, timeFormatToMs } from '../utils';
5
5
  import StyledDateTime from '../DateTime.styles';
@@ -19,34 +19,31 @@ const Time = (props) => {
19
19
  ];
20
20
  useAutoFocusNextInput([hourInputRef, minuteInputRef, secondInputRef]);
21
21
  const pickParts = () => {
22
- var _a, _b, _c;
23
22
  return [
24
- ((_a = hourInputRef.current) === null || _a === void 0 ? void 0 : _a.value) || undefined,
25
- ((_b = minuteInputRef.current) === null || _b === void 0 ? void 0 : _b.value) || undefined,
26
- ((_c = secondInputRef.current) === null || _c === void 0 ? void 0 : _c.value) || undefined
23
+ hourInputRef.current?.value || undefined,
24
+ minuteInputRef.current?.value || undefined,
25
+ secondInputRef.current?.value || undefined
27
26
  ];
28
27
  };
29
- const onFocusChange = (focused) => {
30
- var _a, _b, _c;
28
+ const onFocusChange = useCallback((focused) => {
31
29
  if (!focused && !disabled && !readOnly && onChange) {
32
30
  const parts = pickParts();
33
31
  onChange(parts.some(v => v !== undefined)
34
32
  ? timeFormatToMs({
35
- hour: Number((_a = parts[0]) !== null && _a !== void 0 ? _a : 0),
36
- minute: Number((_b = parts[1]) !== null && _b !== void 0 ? _b : 0),
37
- second: Number((_c = parts[2]) !== null && _c !== void 0 ? _c : 0)
33
+ hour: Number(parts[0] ?? 0),
34
+ minute: Number(parts[1] ?? 0),
35
+ second: Number(parts[2] ?? 0)
38
36
  })
39
37
  : undefined);
40
38
  }
41
- };
39
+ }, [disabled, readOnly, onChange]);
42
40
  const t = useI18n();
43
41
  const containerRef = useRef(null);
44
42
  useFocusWithin([containerRef], onFocusChange);
45
- return (_jsxs(Flex, Object.assign({ as: StyledDateTime, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
46
- var _a;
43
+ return (_jsxs(Flex, { as: StyledDateTime, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
47
44
  if (e.target === containerRef.current)
48
- (_a = hourInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
49
- } }, restProps, { children: [_jsx(PartInput, { placeholder: t('hour_placeholder'), "aria-label": t('hour_label_a11y'), value: time.hour, readOnly: readOnly, ref: hourInputRef, autoFocus: autoFocus }, 'hour'), ":", _jsx(PartInput, { placeholder: t('minute_placeholder'), "aria-label": t('minute_label_a11y'), value: time.minute, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: minuteInputRef }, 'minute'), ":", _jsx(PartInput, { placeholder: t('second_placeholder'), "aria-label": t('second_label_a11y'), value: time.second, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: secondInputRef }, 'second')] }), void 0));
45
+ hourInputRef.current?.focus();
46
+ }, ...restProps, children: [_jsx(PartInput, { placeholder: t('hour_placeholder'), "aria-label": t('hour_label_a11y'), value: time.hour, readOnly: readOnly, ref: hourInputRef, autoFocus: autoFocus }, 'hour'), ":", _jsx(PartInput, { placeholder: t('minute_placeholder'), "aria-label": t('minute_label_a11y'), value: time.minute, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: minuteInputRef }, 'minute'), ":", _jsx(PartInput, { placeholder: t('second_placeholder'), "aria-label": t('second_label_a11y'), value: time.second, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: secondInputRef }, 'second')] }, void 0));
50
47
  };
51
48
  export default Time;
52
49
  //# sourceMappingURL=Time.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../../../src/components/DateTime/Input/Duration/Time.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,MAAM,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,M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C,SAAS,IAER,WAAW,EAAE,CAAC,CAAC,oBAAoB,CAAC,gBACxB,CAAC,CAAC,mBAAmB,CAAC,EAClC,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,EAAE,EACP,GAAG,EAAE,cAAc,IARf,QAAQ,CASZ,OAEF,KAAC,SAAS,IAER,WAAW,EAAE,CAAC,CAAC,oBAAoB,CAAC,gBACxB,CAAC,CAAC,mBAAmB,CAAC,EAClC,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,EAAE,EACP,GAAG,EAAE,cAAc,IARf,QAAQ,CASZ,aACG,CACR,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,IAAI,CAAC","sourcesContent":["import { FC, useRef } from 'react';\n\nimport { ForwardProps } from '../../../../types';\nimport { useI18n, useFocusWithin } from '../../../../hooks';\nimport { msToTimeFormat, timeFormatToMs } from '../utils';\nimport StyledDateTime from '../DateTime.styles';\nimport { StyledFormControl } from '../../../FormControl';\nimport Flex from '../../../Flex';\nimport PartInput from '../PartInput';\nimport useAutoFocusNextInput from '../useAutoFocusNextInput';\n\nimport DurationInputProps from './DurationInput.types';\n\ntype TimeProps = DurationInputProps & ForwardProps;\n\nconst Time: FC<TimeProps> = (props: DurationInputProps) => {\n const { value, onChange, disabled, readOnly, required, status, autoFocus, ...restProps } = props;\n\n const time =\n value !== undefined\n ? msToTimeFormat(value)\n : { hour: undefined, minute: undefined, second: undefined };\n\n const [hourInputRef, minuteInputRef, secondInputRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null)\n ];\n\n useAutoFocusNextInput([hourInputRef, minuteInputRef, secondInputRef]);\n\n const pickParts = () => {\n return [\n hourInputRef.current?.value || undefined,\n minuteInputRef.current?.value || undefined,\n secondInputRef.current?.value || undefined\n ];\n };\n\n const onFocusChange = (focused: boolean) => {\n if (!focused && !disabled && !readOnly && onChange) {\n const parts = pickParts();\n onChange(\n parts.some(v => v !== undefined)\n ? timeFormatToMs({\n hour: Number(parts[0] ?? 0),\n minute: Number(parts[1] ?? 0),\n second: Number(parts[2] ?? 0)\n })\n : undefined\n );\n }\n };\n\n const t = useI18n();\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n return (\n <Flex\n as={StyledDateTime}\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) hourInputRef.current?.focus();\n }}\n {...restProps}\n >\n <PartInput\n key='hour'\n placeholder={t('hour_placeholder')}\n aria-label={t('hour_label_a11y')}\n value={time.hour}\n readOnly={readOnly}\n ref={hourInputRef}\n autoFocus={autoFocus}\n />\n :\n <PartInput\n key='minute'\n placeholder={t('minute_placeholder')}\n aria-label={t('minute_label_a11y')}\n value={time.minute}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={minuteInputRef}\n />\n :\n <PartInput\n key='second'\n placeholder={t('second_placeholder')}\n aria-label={t('second_label_a11y')}\n value={time.second}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={secondInputRef}\n />\n </Flex>\n );\n};\nexport default Time;\n"]}
1
+ {"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../../../src/components/DateTime/Input/Duration/Time.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1D,OAA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E,YAAY,EACjB,SAAS,EAAE,SAAS,IANhB,MAAM,CAOV,OAEF,KAAC,SAAS,IAER,WAAW,EAAE,CAAC,CAAC,oBAAoB,CAAC,gBACxB,CAAC,CAAC,mBAAmB,CAAC,EAClC,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,EAAE,EACP,GAAG,EAAE,cAAc,IARf,QAAQ,CASZ,OAEF,KAAC,SAAS,IAER,WAAW,EAAE,CAAC,CAAC,oBAAoB,CAAC,gBACxB,CAAC,CAAC,mBAAmB,CAAC,EAClC,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,EAAE,EACP,GAAG,EAAE,cAAc,IARf,QAAQ,CASZ,YACG,CACR,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,IAAI,CAAC","sourcesContent":["import { FC, useCallback, useRef } from 'react';\n\nimport { ForwardProps } from '../../../../types';\nimport { useI18n, useFocusWithin } from '../../../../hooks';\nimport { msToTimeFormat, timeFormatToMs } from '../utils';\nimport StyledDateTime from '../DateTime.styles';\nimport { StyledFormControl } from '../../../FormControl';\nimport Flex from '../../../Flex';\nimport PartInput from '../PartInput';\nimport useAutoFocusNextInput from '../useAutoFocusNextInput';\n\nimport DurationInputProps from './DurationInput.types';\n\ntype TimeProps = DurationInputProps & ForwardProps;\n\nconst Time: FC<TimeProps> = (props: DurationInputProps) => {\n const { value, onChange, disabled, readOnly, required, status, autoFocus, ...restProps } = props;\n\n const time =\n value !== undefined\n ? msToTimeFormat(value)\n : { hour: undefined, minute: undefined, second: undefined };\n\n const [hourInputRef, minuteInputRef, secondInputRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null)\n ];\n\n useAutoFocusNextInput([hourInputRef, minuteInputRef, secondInputRef]);\n\n const pickParts = () => {\n return [\n hourInputRef.current?.value || undefined,\n minuteInputRef.current?.value || undefined,\n secondInputRef.current?.value || undefined\n ];\n };\n\n const onFocusChange = useCallback(\n (focused: boolean) => {\n if (!focused && !disabled && !readOnly && onChange) {\n const parts = pickParts();\n onChange(\n parts.some(v => v !== undefined)\n ? timeFormatToMs({\n hour: Number(parts[0] ?? 0),\n minute: Number(parts[1] ?? 0),\n second: Number(parts[2] ?? 0)\n })\n : undefined\n );\n }\n },\n [disabled, readOnly, onChange]\n );\n\n const t = useI18n();\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n return (\n <Flex\n as={StyledDateTime}\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) hourInputRef.current?.focus();\n }}\n {...restProps}\n >\n <PartInput\n key='hour'\n placeholder={t('hour_placeholder')}\n aria-label={t('hour_label_a11y')}\n value={time.hour}\n readOnly={readOnly}\n ref={hourInputRef}\n autoFocus={autoFocus}\n />\n :\n <PartInput\n key='minute'\n placeholder={t('minute_placeholder')}\n aria-label={t('minute_label_a11y')}\n value={time.minute}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={minuteInputRef}\n />\n :\n <PartInput\n key='second'\n placeholder={t('second_placeholder')}\n aria-label={t('second_label_a11y')}\n value={time.second}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={secondInputRef}\n />\n </Flex>\n );\n};\nexport default Time;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MonthInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/MonthInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAc9C,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAK7E,MAAM,WAAW,eAAgB,SAAQ,aAAa;CAAG;AAEzD,eAAO,MAAM,gBAAgB,sHAoB3B,CAAC;AA2CH,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAqIjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"MonthInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/MonthInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAc9C,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAK7E,MAAM,WAAW,eAAgB,SAAQ,aAAa;CAAG;AAEzD,eAAO,MAAM,gBAAgB,sHAmB3B,CAAC;AA2CH,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAqIjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -16,7 +16,6 @@ export const StyledMonthInput = styled(StyledDateTime)(() => {
16
16
  return css `
17
17
  padding: 0;
18
18
  border: 0;
19
- width: fit-content;
20
19
  ${StyledSelect} {
21
20
  min-width: 0;
22
21
  &:first-child {
@@ -65,7 +64,6 @@ const reducer = (state, action) => {
65
64
  }
66
65
  };
67
66
  const MonthInput = forwardRef((props, ref) => {
68
- var _a, _b, _c, _d;
69
67
  const { locale } = useConfiguration();
70
68
  const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, info, status, required, readOnly, disabled, onChange, onFocus, onBlur, autoFocus, ...restProps } = props;
71
69
  const date = value ? parseToDate(value) : undefined;
@@ -75,13 +73,13 @@ const MonthInput = forwardRef((props, ref) => {
75
73
  const years = range(minYear, maxYear);
76
74
  const months = useMemo(() => getLocalizedMonths(locale), [locale]);
77
75
  const [state, dispatch] = useReducer(reducer, [
78
- date === null || date === void 0 ? void 0 : date.getUTCFullYear().toString(),
79
- date === null || date === void 0 ? void 0 : date.getUTCMonth().toString()
76
+ date?.getUTCFullYear().toString(),
77
+ date?.getUTCMonth().toString()
80
78
  ]);
81
79
  useEffect(() => {
82
- dispatch({ field: 'month', value: date === null || date === void 0 ? void 0 : date.getUTCMonth().toString() });
83
- dispatch({ field: 'year', value: date === null || date === void 0 ? void 0 : date.getUTCFullYear().toString() });
84
- }, [date === null || date === void 0 ? void 0 : date.toLocaleDateString()]);
80
+ dispatch({ field: 'month', value: date?.getUTCMonth().toString() });
81
+ dispatch({ field: 'year', value: date?.getUTCFullYear().toString() });
82
+ }, [date?.toLocaleDateString()]);
85
83
  const onFocusChange = (focused) => {
86
84
  const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), state);
87
85
  if (onFocus && focused)
@@ -92,20 +90,17 @@ const MonthInput = forwardRef((props, ref) => {
92
90
  const onSelectChange = (field) => (ev) => {
93
91
  const action = { field, value: ev.target.value };
94
92
  dispatch(action);
95
- onChange === null || onChange === void 0 ? void 0 : onChange(convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action)));
93
+ onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action)));
96
94
  };
97
95
  const containerRef = useConsolidatedRef(ref);
98
96
  useFocusWithin([containerRef], onFocusChange);
99
97
  const t = useI18n();
100
- const monthOptions = months.map((month, index) => (_jsx(Option, Object.assign({ value: index.toString() }, { children: months[index] }), month)));
101
- const yearOptions = years.map(year => (_jsx(Option, Object.assign({ value: year.toString() }, { children: year.toString() }), year.toString())));
102
- const Month = (_jsxs(Select, Object.assign({ "aria-label": t('month_label_a11y'), readOnly: readOnly, required: required, value: (_b = (_a = state[1]) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '', onChange: onSelectChange('month'), status: status, disabled: disabled, autoFocus: autoFocus }, { children: [!required && _jsx(Option, { children: " " }, 'null'),
103
- monthOptions] }), 'month'));
104
- const Year = (_jsxs(Select, Object.assign({ "aria-label": t('year_label_a11y'), readOnly: readOnly, required: required, value: (_d = (_c = state[0]) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : '', onChange: onSelectChange('year'), status: status, disabled: disabled }, { children: [!required && _jsx(Option, { children: " " }, 'null'),
105
- yearOptions] }), 'year'));
106
- const Comp = (_jsxs(Flex, Object.assign({ as: StyledMonthInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, ref: containerRef, status: status, disabled: disabled, readOnly: readOnly }, restProps, { children: [Month,
107
- Year] }), void 0));
108
- return label ? (_jsx(FormField, Object.assign({ as: 'fieldset', labelAs: 'legend' }, { label, labelHidden, id, info, status, required, disabled }, { children: Comp }), void 0)) : (Comp);
98
+ const monthOptions = months.map((month, index) => (_jsx(Option, { value: index.toString(), children: months[index] }, month)));
99
+ const yearOptions = years.map(year => (_jsx(Option, { value: year.toString(), children: year.toString() }, year.toString())));
100
+ const Month = (_jsxs(Select, { "aria-label": t('month_label_a11y'), readOnly: readOnly, required: required, value: state[1]?.toString() ?? '', onChange: onSelectChange('month'), status: status, disabled: disabled, autoFocus: autoFocus, children: [!required && _jsx(Option, { children: " " }, 'null'), monthOptions] }, 'month'));
101
+ const Year = (_jsxs(Select, { "aria-label": t('year_label_a11y'), readOnly: readOnly, required: required, value: state[0]?.toString() ?? '', onChange: onSelectChange('year'), status: status, disabled: disabled, children: [!required && _jsx(Option, { children: " " }, 'null'), yearOptions] }, 'year'));
102
+ const Comp = (_jsxs(Flex, { as: StyledMonthInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, ref: containerRef, status: status, disabled: disabled, readOnly: readOnly, ...restProps, children: [Month, Year] }, void 0));
103
+ return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled }, children: Comp }, void 0)) : (Comp);
109
104
  });
110
105
  export default MonthInput;
111
106
  //# sourceMappingURL=MonthInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MonthInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/MonthInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EAGV,UAAU,EAEV,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,OAAO,EACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAI/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAkB,GAAG,EAAE;IAC3E,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IACtC,OAAO,GAAG,CAAA;;;;MAIN,YAAY;;;qBAGG,GAAG;wBACA,GAAG;;;;;qBAKN,KAAK;wBACF,KAAK;;;GAG1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,0BAA0B,GAAG,CACjC,IAAU,EACV,KAA6B,EACF,EAAE;IAC7B,IAAI,KAAK,CAAC,KA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AAI,GAAG,CACX,MAAC,IAAI,kBACH,EAAE,EAAE,gBAAgB,EACpB,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EACnD,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,IACd,SAAS,eAEZ,KAAK;YACL,IAAI,aACA,CACR,CAAC;IAEF,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,cAE/D,IAAI,YACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n useMemo,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useReducer,\n ChangeEvent,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { ForwardProps } from '../../../types';\nimport { range } from '../../../utils';\nimport {\n useConfiguration,\n useConsolidatedRef,\n useDirection,\n useFocusWithin,\n useI18n\n} from '../../../hooks';\nimport FormField from '../../FormField';\nimport Select, { Option } from '../../Select';\nimport { StyledSelect } from '../../Select/Select';\nimport Flex from '../../Flex';\nimport { StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport { parseToDate, getLocalizedMonths } from './utils';\nimport StyledDateTime from './DateTime.styles';\n\nexport interface MonthInputProps extends DateTimeProps {}\n\nexport const StyledMonthInput = styled(StyledDateTime)<MonthInputProps>(() => {\n const { start, end } = useDirection();\n return css`\n padding: 0;\n border: 0;\n width: fit-content;\n ${StyledSelect} {\n min-width: 0;\n &:first-child {\n border-top-${end}-radius: 0;\n border-bottom-${end}-radius: 0;\n }\n &:last-child {\n max-width: max-content;\n margin-inline-start: -0.0625rem;\n border-top-${start}-radius: 0;\n border-bottom-${start}-radius: 0;\n }\n }\n `;\n});\n\nStyledMonthInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, month] = parts.map(Number);\n date.setUTCFullYear(year, month);\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\ntype Field = 'month' | 'year';\ntype State = [year: string | undefined, month: string | undefined];\n\nconst reducer = (state: State, action: { field: Field; value: string | undefined }): State => {\n switch (action.field) {\n case 'year':\n return [action.value, state[1]];\n case 'month':\n return [state[0], action.value];\n default:\n return state.slice(0) as State;\n }\n};\n\nconst MonthInput: FunctionComponent<MonthInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<MonthInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n } = props;\n\n const date = value ? parseToDate(value) : undefined;\n const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();\n\n const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;\n const maxYear = max ? parseToDate(max).getUTCFullYear() : currentYear + 10;\n\n const years = range(minYear, maxYear);\n const months = useMemo(() => getLocalizedMonths(locale), [locale]);\n\n const [state, dispatch] = useReducer(reducer, [\n date?.getUTCFullYear().toString(),\n date?.getUTCMonth().toString()\n ]);\n\n useEffect(() => {\n dispatch({ field: 'month', value: date?.getUTCMonth().toString() });\n dispatch({ field: 'year', value: date?.getUTCFullYear().toString() });\n }, [date?.toLocaleDateString()]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), state);\n if (onFocus && focused) onFocus(callbackParam);\n else if (onBlur && !focused) onBlur(callbackParam);\n };\n\n const onSelectChange = (field: Field) => (ev: ChangeEvent<HTMLSelectElement>) => {\n const action = { field, value: ev.target.value };\n dispatch(action);\n onChange?.(\n convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action))\n );\n };\n\n const containerRef = useConsolidatedRef<HTMLElement>(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const t = useI18n();\n\n const monthOptions = months.map((month, index) => (\n <Option key={month} value={index.toString()}>\n {months[index]}\n </Option>\n ));\n const yearOptions = years.map(year => (\n <Option key={year.toString()} value={year.toString()}>\n {year.toString()}\n </Option>\n ));\n\n const Month = (\n <Select\n key='month'\n aria-label={t('month_label_a11y')}\n readOnly={readOnly}\n required={required}\n value={state[1]?.toString() ?? ''}\n onChange={onSelectChange('month')}\n status={status}\n disabled={disabled}\n autoFocus={autoFocus}\n >\n {!required && <Option key='null'> </Option>}\n {monthOptions}\n </Select>\n );\n\n const Year = (\n <Select\n aria-label={t('year_label_a11y')}\n key='year'\n readOnly={readOnly}\n required={required}\n value={state[0]?.toString() ?? ''}\n onChange={onSelectChange('year')}\n status={status}\n disabled={disabled}\n >\n {!required && <Option key='null'> </Option>}\n {yearOptions}\n </Select>\n );\n\n const Comp = (\n <Flex\n as={StyledMonthInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n disabled={disabled}\n readOnly={readOnly}\n {...restProps}\n >\n {Month}\n {Year}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default MonthInput;\n"]}
1
+ {"version":3,"file":"MonthInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/MonthInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EAGV,UAAU,EAEV,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,OAAO,EACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAI/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAkB,GAAG,EAAE;IAC3E,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IACtC,OAAO,GAAG,CAAA;;;MAGN,YAAY;;;qBAGG,GAAG;wBACA,GAAG;;;;;qBAKN,KAAK;wBACF,KAAK;;;GAG1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,0BAA0B,GAAG,CACjC,IAAU,EACV,KAA6B,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,EAAE,QAAQ,EAAE,EACnD,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,SAAS,aAEZ,KAAK,EACL,IAAI,YACA,CACR,CAAC;IAEF,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,YAE/D,IAAI,WACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n useMemo,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useReducer,\n ChangeEvent,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { ForwardProps } from '../../../types';\nimport { range } from '../../../utils';\nimport {\n useConfiguration,\n useConsolidatedRef,\n useDirection,\n useFocusWithin,\n useI18n\n} from '../../../hooks';\nimport FormField from '../../FormField';\nimport Select, { Option } from '../../Select';\nimport { StyledSelect } from '../../Select/Select';\nimport Flex from '../../Flex';\nimport { StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport { parseToDate, getLocalizedMonths } from './utils';\nimport StyledDateTime from './DateTime.styles';\n\nexport interface MonthInputProps extends DateTimeProps {}\n\nexport const StyledMonthInput = styled(StyledDateTime)<MonthInputProps>(() => {\n const { start, end } = useDirection();\n return css`\n padding: 0;\n border: 0;\n ${StyledSelect} {\n min-width: 0;\n &:first-child {\n border-top-${end}-radius: 0;\n border-bottom-${end}-radius: 0;\n }\n &:last-child {\n max-width: max-content;\n margin-inline-start: -0.0625rem;\n border-top-${start}-radius: 0;\n border-bottom-${start}-radius: 0;\n }\n }\n `;\n});\n\nStyledMonthInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, month] = parts.map(Number);\n date.setUTCFullYear(year, month);\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\ntype Field = 'month' | 'year';\ntype State = [year: string | undefined, month: string | undefined];\n\nconst reducer = (state: State, action: { field: Field; value: string | undefined }): State => {\n switch (action.field) {\n case 'year':\n return [action.value, state[1]];\n case 'month':\n return [state[0], action.value];\n default:\n return state.slice(0) as State;\n }\n};\n\nconst MonthInput: FunctionComponent<MonthInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<MonthInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n } = props;\n\n const date = value ? parseToDate(value) : undefined;\n const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();\n\n const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;\n const maxYear = max ? parseToDate(max).getUTCFullYear() : currentYear + 10;\n\n const years = range(minYear, maxYear);\n const months = useMemo(() => getLocalizedMonths(locale), [locale]);\n\n const [state, dispatch] = useReducer(reducer, [\n date?.getUTCFullYear().toString(),\n date?.getUTCMonth().toString()\n ]);\n\n useEffect(() => {\n dispatch({ field: 'month', value: date?.getUTCMonth().toString() });\n dispatch({ field: 'year', value: date?.getUTCFullYear().toString() });\n }, [date?.toLocaleDateString()]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), state);\n if (onFocus && focused) onFocus(callbackParam);\n else if (onBlur && !focused) onBlur(callbackParam);\n };\n\n const onSelectChange = (field: Field) => (ev: ChangeEvent<HTMLSelectElement>) => {\n const action = { field, value: ev.target.value };\n dispatch(action);\n onChange?.(\n convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action))\n );\n };\n\n const containerRef = useConsolidatedRef<HTMLElement>(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const t = useI18n();\n\n const monthOptions = months.map((month, index) => (\n <Option key={month} value={index.toString()}>\n {months[index]}\n </Option>\n ));\n const yearOptions = years.map(year => (\n <Option key={year.toString()} value={year.toString()}>\n {year.toString()}\n </Option>\n ));\n\n const Month = (\n <Select\n key='month'\n aria-label={t('month_label_a11y')}\n readOnly={readOnly}\n required={required}\n value={state[1]?.toString() ?? ''}\n onChange={onSelectChange('month')}\n status={status}\n disabled={disabled}\n autoFocus={autoFocus}\n >\n {!required && <Option key='null'> </Option>}\n {monthOptions}\n </Select>\n );\n\n const Year = (\n <Select\n aria-label={t('year_label_a11y')}\n key='year'\n readOnly={readOnly}\n required={required}\n value={state[0]?.toString() ?? ''}\n onChange={onSelectChange('year')}\n status={status}\n disabled={disabled}\n >\n {!required && <Option key='null'> </Option>}\n {yearOptions}\n </Select>\n );\n\n const Comp = (\n <Flex\n as={StyledMonthInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n disabled={disabled}\n readOnly={readOnly}\n {...restProps}\n >\n {Month}\n {Year}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default MonthInput;\n"]}
@@ -9,9 +9,8 @@ const PartInput = forwardRef(({ value, onChange, readOnly, min = 0, max = Infini
9
9
  }, []);
10
10
  const inputRef = useConsolidatedRef(ref);
11
11
  useEffect(() => {
12
- var _a;
13
12
  if (inputRef.current && !Number.isNaN(value)) {
14
- inputRef.current.value = (_a = value === null || value === void 0 ? void 0 : value.toString().padStart(2, '0')) !== null && _a !== void 0 ? _a : '';
13
+ inputRef.current.value = value?.toString().padStart(2, '0') ?? '';
15
14
  }
16
15
  }, [value, inputRef.current]);
17
16
  const onInputChange = useCallback((ev) => {
@@ -25,10 +24,10 @@ const PartInput = forwardRef(({ value, onChange, readOnly, min = 0, max = Infini
25
24
  const targetEl = ev.target;
26
25
  if (targetEl.value !== '')
27
26
  targetEl.value = targetEl.value.padStart(2, '0');
28
- onChange === null || onChange === void 0 ? void 0 : onChange(targetEl.value);
27
+ onChange?.(targetEl.value);
29
28
  }, [onChange]);
30
29
  const defaultValue = value ? value.toString().padStart(2, '0') : '';
31
- return (_jsx(BareInput, Object.assign({ type: 'number', defaultValue: defaultValue, onBlur: onBlur, onKeyDown: onKeyDown, onChange: onInputChange, step: 1, min: min, max: max, maxLength: maxLength, readOnly: readOnly, ref: inputRef, size: size }, restProps), void 0));
30
+ return (_jsx(BareInput, { type: 'number', defaultValue: defaultValue, onBlur: onBlur, onKeyDown: onKeyDown, onChange: onInputChange, step: 1, min: min, max: max, maxLength: maxLength, readOnly: readOnly, ref: inputRef, size: size, ...restProps }, void 0));
32
31
  });
33
32
  export default PartInput;
34
33
  //# sourceMappingURL=PartInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PartInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/PartInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EAGV,WAAW,EACX,SAAS,EAEV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIpD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAW9C,MAAM,SAAS,GAAqD,UAAU,CAC5E,CACE,EACE,KAAK,EACL,QAAQ,EAC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,EAAE,IAAI,CAAC,IAAI,CAAC;IACxE,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,MAAM,MAAM,GAAG,WAAW,CACxB,CAAC,EAAgC,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,EAAE,CAAC,MAAM,CAAC;QAC3B,IAAI,QAAQ,CAAC,KAAK,KAAK,EAAE;YAAE,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5E,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEpE,OAAO,CACL,KAAC,SAAS,kBACR,IAAI,EAAC,QAAQ,EACb,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,IACN,SAAS,UACb,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FocusEvent,\n KeyboardEvent,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useCallback,\n useEffect,\n ChangeEvent\n} from 'react';\n\nimport { useConsolidatedRef } from '../../../hooks';\nimport { ForwardProps, OmitStrict } from '../../../types';\nimport { InputProps } from '../../Input/Input';\n\nimport { BareInput } from './DateTime.styles';\n\nexport interface PartInputProps extends OmitStrict<InputProps, 'defaultValue' | 'value'> {\n value?: number;\n min?: number;\n max?: number;\n maxLength?: number;\n size?: number;\n onChange?: (value?: string) => void;\n}\n\nconst PartInput: FunctionComponent<PartInputProps & ForwardProps> = forwardRef(\n (\n {\n value,\n onChange,\n readOnly,\n min = 0,\n max = Infinity,\n size = 2,\n maxLength = Infinity,\n ...restProps\n }: PropsWithoutRef<PartInputProps>,\n ref: Ref<HTMLInputElement>\n ) => {\n const onKeyDown = useCallback((ev: KeyboardEvent<HTMLInputElement>) => {\n if (['+', '-', 'e', 'E', '.', ','].includes(ev.key)) ev.preventDefault();\n }, []);\n\n const inputRef = useConsolidatedRef(ref);\n useEffect(() => {\n if (inputRef.current && !Number.isNaN(value)) {\n inputRef.current.value = value?.toString().padStart(2, '0') ?? '';\n }\n }, [value, inputRef.current]);\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const targetEl = ev.target;\n if (targetEl.value.length > maxLength) targetEl.value = targetEl.value.slice(0, maxLength);\n else if (size !== maxLength)\n targetEl.style.width = `${Math.max(targetEl.value.length, size)}ch`;\n },\n [maxLength]\n );\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n const targetEl = ev.target;\n if (targetEl.value !== '') targetEl.value = targetEl.value.padStart(2, '0');\n onChange?.(targetEl.value);\n },\n [onChange]\n );\n\n const defaultValue = value ? value.toString().padStart(2, '0') : '';\n\n return (\n <BareInput\n type='number'\n defaultValue={defaultValue}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n onChange={onInputChange}\n step={1}\n min={min}\n max={max}\n maxLength={maxLength}\n readOnly={readOnly}\n ref={inputRef}\n size={size}\n {...restProps}\n />\n );\n }\n);\n\nexport default PartInput;\n"]}
1
+ {"version":3,"file":"PartInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/PartInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EAGV,WAAW,EACX,S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\n useCallback,\n useEffect,\n ChangeEvent\n} from 'react';\n\nimport { useConsolidatedRef } from '../../../hooks';\nimport { ForwardProps, OmitStrict } from '../../../types';\nimport { InputProps } from '../../Input/Input';\n\nimport { BareInput } from './DateTime.styles';\n\nexport interface PartInputProps extends OmitStrict<InputProps, 'defaultValue' | 'value'> {\n value?: number;\n min?: number;\n max?: number;\n maxLength?: number;\n size?: number;\n onChange?: (value?: string) => void;\n}\n\nconst PartInput: FunctionComponent<PartInputProps & ForwardProps> = forwardRef(\n (\n {\n value,\n onChange,\n readOnly,\n min = 0,\n max = Infinity,\n size = 2,\n maxLength = Infinity,\n ...restProps\n }: PropsWithoutRef<PartInputProps>,\n ref: Ref<HTMLInputElement>\n ) => {\n const onKeyDown = useCallback((ev: KeyboardEvent<HTMLInputElement>) => {\n if (['+', '-', 'e', 'E', '.', ','].includes(ev.key)) ev.preventDefault();\n }, []);\n\n const inputRef = useConsolidatedRef(ref);\n useEffect(() => {\n if (inputRef.current && !Number.isNaN(value)) {\n inputRef.current.value = value?.toString().padStart(2, '0') ?? '';\n }\n }, [value, inputRef.current]);\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const targetEl = ev.target;\n if (targetEl.value.length > maxLength) targetEl.value = targetEl.value.slice(0, maxLength);\n else if (size !== maxLength)\n targetEl.style.width = `${Math.max(targetEl.value.length, size)}ch`;\n },\n [maxLength]\n );\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n const targetEl = ev.target;\n if (targetEl.value !== '') targetEl.value = targetEl.value.padStart(2, '0');\n onChange?.(targetEl.value);\n },\n [onChange]\n );\n\n const defaultValue = value ? value.toString().padStart(2, '0') : '';\n\n return (\n <BareInput\n type='number'\n defaultValue={defaultValue}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n onChange={onInputChange}\n step={1}\n min={min}\n max={max}\n maxLength={maxLength}\n readOnly={readOnly}\n ref={inputRef}\n size={size}\n {...restProps}\n />\n );\n }\n);\n\nexport default PartInput;\n"]}
@@ -0,0 +1,9 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { ForwardProps } from '../../../types';
3
+ import DateTimeProps from '../DateTime.types';
4
+ export interface QuarterInputProps extends DateTimeProps {
5
+ }
6
+ export declare const StyledQuarterInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, QuarterInputProps, never>;
7
+ declare const QuarterInput: FunctionComponent<QuarterInputProps & ForwardProps>;
8
+ export default QuarterInput;
9
+ //# sourceMappingURL=QuarterInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuarterInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/QuarterInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAW7E,MAAM,WAAW,iBAAkB,SAAQ,aAAa;CAAG;AAE3D,eAAO,MAAM,kBAAkB,wHAmB7B,CAAC;AA4CH,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAiIrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useReducer } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import FormField from '../../FormField';
5
+ import Select, { Option } from '../../Select';
6
+ import Flex from '../../Flex';
7
+ import { range } from '../../../utils';
8
+ import { useConsolidatedRef, useDirection, useFocusWithin, useI18n } from '../../../hooks';
9
+ import { StyledSelect } from '../../Select/Select';
10
+ import { defaultThemeProp } from '../../../theme';
11
+ import { StyledFormControl } from '../../FormControl';
12
+ import { getQuarter, parseToDate } from './utils';
13
+ import StyledDateTime from './DateTime.styles';
14
+ export const StyledQuarterInput = styled(StyledDateTime)(() => {
15
+ const { start, end } = useDirection();
16
+ return css `
17
+ padding: 0;
18
+ border: 0;
19
+ ${StyledSelect} {
20
+ min-width: 0;
21
+ &:first-child {
22
+ ${`border-top-${end}-radius`}: 0;
23
+ ${`border-bottom-${end}-radius`}: 0;
24
+ }
25
+ &:last-child {
26
+ max-width: max-content;
27
+ margin-inline-start: -0.0625rem;
28
+ ${`border-top-${start}-radius`}: 0;
29
+ ${`border-bottom-${start}-radius`}: 0;
30
+ }
31
+ }
32
+ `;
33
+ });
34
+ StyledQuarterInput.defaultProps = defaultThemeProp;
35
+ const convertToCallbackParameter = (date, parts) => {
36
+ if (parts.every(Boolean)) {
37
+ const [year, quarter] = parts.map(Number);
38
+ const quarterStartMonth = [0, 3, 6, 9][quarter - 1];
39
+ date.setUTCFullYear(year, quarterStartMonth, 1);
40
+ return {
41
+ valueAsISOString: date.toISOString(),
42
+ valueAsTimestamp: date.getTime()
43
+ };
44
+ }
45
+ if (parts.every(p => !p)) {
46
+ return {
47
+ valueAsISOString: '',
48
+ valueAsTimestamp: undefined
49
+ };
50
+ }
51
+ return {
52
+ valueAsISOString: '',
53
+ valueAsTimestamp: NaN,
54
+ state: 'incomplete'
55
+ };
56
+ };
57
+ const reducer = (state, action) => {
58
+ switch (action.field) {
59
+ case 'year':
60
+ return [action.value, state[1]];
61
+ case 'quarter':
62
+ return [state[0], action.value];
63
+ default:
64
+ return state.slice(0);
65
+ }
66
+ };
67
+ const QuarterInput = forwardRef((props, ref) => {
68
+ const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, info, status, required, readOnly, disabled, onChange, onFocus, onBlur, autoFocus, ...restProps } = props;
69
+ const date = value ? parseToDate(value) : undefined;
70
+ const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();
71
+ const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;
72
+ const maxYear = max ? parseToDate(max).getUTCFullYear() : currentYear + 10;
73
+ const years = range(minYear, maxYear);
74
+ const [state, dispatch] = useReducer(reducer, [
75
+ date?.getUTCFullYear().toString(),
76
+ date && getQuarter(date).toString()
77
+ ]);
78
+ const onFocusChange = (focused) => {
79
+ const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), state);
80
+ if (onFocus && focused)
81
+ onFocus(callbackParam);
82
+ else if (onBlur && !focused)
83
+ onBlur(callbackParam);
84
+ };
85
+ const onSelectChange = (field) => (ev) => {
86
+ const action = { field, value: ev.target.value };
87
+ dispatch(action);
88
+ onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action)));
89
+ };
90
+ const containerRef = useConsolidatedRef(ref);
91
+ useFocusWithin([containerRef], onFocusChange);
92
+ const t = useI18n();
93
+ const quarters = [1, 2, 3, 4];
94
+ const quarterOptions = quarters.map(quarterNumber => (_jsx(Option, { value: quarterNumber.toString(), children: t(`date_quarter_q${quarterNumber}`).trim() }, t(`date_quarter_q${quarterNumber}`).trim())));
95
+ const yearOptions = years.map(year => (_jsx(Option, { value: year.toString(), children: year.toString() }, year.toString())));
96
+ const Quarter = (_jsxs(Select, { "aria-label": t('quarter_label_a11y'), readOnly: readOnly, required: required, value: state[1]?.toString() ?? '', onChange: onSelectChange('quarter'), status: status, disabled: disabled, autoFocus: autoFocus, children: [!required && _jsx(Option, { children: " " }, 'null'), quarterOptions] }, 'quarter'));
97
+ const Year = (_jsxs(Select, { "aria-label": t('year_label_a11y'), readOnly: readOnly, required: required, value: state[0]?.toString() ?? '', onChange: onSelectChange('year'), status: status, disabled: disabled, children: [!required && _jsx(Option, { children: " " }, 'null'), yearOptions] }, 'year'));
98
+ const Comp = (_jsxs(Flex, { ...restProps, as: StyledQuarterInput, forwardedAs: StyledFormControl, container: { alignItems: 'center' }, ref: containerRef, status: status, disabled: disabled, readOnly: readOnly, children: [Quarter, Year] }, void 0));
99
+ return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled }, children: Comp }, void 0)) : (Comp);
100
+ });
101
+ export default QuarterInput;
102
+ //# sourceMappingURL=QuarterInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuarterInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/QuarterInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAiB,MAAM,SAAS,CAAC;AACjE,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAI/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAoB,GAAG,EAAE;IAC/E,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IACtC,OAAO,GAAG,CAAA;;;MAGN,YAAY;;;UAGR,cAAc,GAAG,SAAS;UAC1B,iBAAiB,GAAG,SAAS;;;;;UAK7B,cAAc,KAAK,SAAS;UAC5B,iBAAiB,KAAK,SAAS;;;GAGtC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,0BAA0B,GAAG,CACjC,IAAU,EACV,KAA6B,EACF,EAAE;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OAAO,EAAC,QAAQ,KACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAE/D,IAAI,WACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n ChangeEvent,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useReducer\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../../types';\nimport FormField from '../../FormField';\nimport Select, { Option } from '../../Select';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\nimport Flex from '../../Flex';\nimport { range } from '../../../utils';\nimport { useConsolidatedRef, useDirection, useFocusWithin, useI18n } from '../../../hooks';\nimport { StyledSelect } from '../../Select/Select';\nimport { defaultThemeProp } from '../../../theme';\nimport { StyledFormControl } from '../../FormControl';\n\nimport { getQuarter, parseToDate, QuarterNumber } from './utils';\nimport StyledDateTime from './DateTime.styles';\n\nexport interface QuarterInputProps extends DateTimeProps {}\n\nexport const StyledQuarterInput = styled(StyledDateTime)<QuarterInputProps>(() => {\n const { start, end } = useDirection();\n return css`\n padding: 0;\n border: 0;\n ${StyledSelect} {\n min-width: 0;\n &:first-child {\n ${`border-top-${end}-radius`}: 0;\n ${`border-bottom-${end}-radius`}: 0;\n }\n &:last-child {\n max-width: max-content;\n margin-inline-start: -0.0625rem;\n ${`border-top-${start}-radius`}: 0;\n ${`border-bottom-${start}-radius`}: 0;\n }\n }\n `;\n});\n\nStyledQuarterInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, quarter] = parts.map(Number);\n const quarterStartMonth = [0, 3, 6, 9][quarter - 1];\n date.setUTCFullYear(year, quarterStartMonth, 1);\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\ntype Field = 'quarter' | 'year';\ntype State = [year: string | undefined, quarter: string | undefined];\n\nconst reducer = (state: State, action: { field: Field; value: string | undefined }): State => {\n switch (action.field) {\n case 'year':\n return [action.value, state[1]];\n case 'quarter':\n return [state[0], action.value];\n default:\n return state.slice(0) as State;\n }\n};\n\nconst QuarterInput: FunctionComponent<QuarterInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<QuarterInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n } = props;\n\n const date = value ? parseToDate(value) : undefined;\n const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();\n\n const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;\n const maxYear = max ? parseToDate(max).getUTCFullYear() : currentYear + 10;\n\n const years = range(minYear, maxYear);\n\n const [state, dispatch] = useReducer(reducer, [\n date?.getUTCFullYear().toString(),\n date && getQuarter(date).toString()\n ]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), state);\n if (onFocus && focused) onFocus(callbackParam);\n else if (onBlur && !focused) onBlur(callbackParam);\n };\n\n const onSelectChange = (field: Field) => (ev: ChangeEvent<HTMLSelectElement>) => {\n const action = { field, value: ev.target.value };\n dispatch(action);\n onChange?.(\n convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action))\n );\n };\n\n const containerRef = useConsolidatedRef<HTMLElement>(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const t = useI18n();\n\n const quarters: QuarterNumber[] = [1, 2, 3, 4];\n\n const quarterOptions = quarters.map(quarterNumber => (\n <Option key={t(`date_quarter_q${quarterNumber}`).trim()} value={quarterNumber.toString()}>\n {t(`date_quarter_q${quarterNumber}`).trim()}\n </Option>\n ));\n\n const yearOptions = years.map(year => (\n <Option key={year.toString()} value={year.toString()}>\n {year.toString()}\n </Option>\n ));\n\n const Quarter = (\n <Select\n aria-label={t('quarter_label_a11y')}\n key='quarter'\n readOnly={readOnly}\n required={required}\n value={state[1]?.toString() ?? ''}\n onChange={onSelectChange('quarter')}\n status={status}\n disabled={disabled}\n autoFocus={autoFocus}\n >\n {!required && <Option key='null'> </Option>}\n {quarterOptions}\n </Select>\n );\n\n const Year = (\n <Select\n aria-label={t('year_label_a11y')}\n key='year'\n readOnly={readOnly}\n required={required}\n value={state[0]?.toString() ?? ''}\n onChange={onSelectChange('year')}\n status={status}\n disabled={disabled}\n >\n {!required && <Option key='null'> </Option>}\n {yearOptions}\n </Select>\n );\n\n const Comp = (\n <Flex\n {...restProps}\n as={StyledQuarterInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center' }}\n ref={containerRef}\n status={status}\n disabled={disabled}\n readOnly={readOnly}\n >\n {Quarter}\n {Year}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default QuarterInput;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TimeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/TimeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO9C,OAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGlE,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAKL,WAAW,EAEZ,MAAM,SAAS,CAAC;AAMjB,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,qHAE3B,CAAC;AAyDF,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAwR/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"TimeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/TimeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C,OAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGlE,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAKL,WAAW,EAEZ,MAAM,SAAS,CAAC;AAQjB,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,qHAE3B,CAAC;AAyDF,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAwR/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -5,7 +5,9 @@ import FormField from '../../FormField';
5
5
  import Flex from '../../Flex';
6
6
  import Select, { Option } from '../../Select';
7
7
  import Button from '../../Button';
8
- import Icon from '../../Icon';
8
+ import Icon, { registerIcon } from '../../Icon';
9
+ import * as timesIcon from '../../Icon/icons/times.icon';
10
+ import * as clockIcon from '../../Icon/icons/clock.icon';
9
11
  import Popover from '../../Popover';
10
12
  import TimePicker from '../Picker/TimePicker';
11
13
  import { useConfiguration, useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';
@@ -15,6 +17,7 @@ import StyledDateTime, { StyledInputContainer } from './DateTime.styles';
15
17
  import PartInput from './PartInput';
16
18
  import usePickerButton from './usePickerButton';
17
19
  import useAutoFocusNextInput from './useAutoFocusNextInput';
20
+ registerIcon(timesIcon, clockIcon);
18
21
  export const StyledTimeInput = styled(StyledDateTime) `
19
22
  padding-inline-end: 0;
20
23
  `;
@@ -80,17 +83,16 @@ const TimeInput = forwardRef((props, ref) => {
80
83
  ];
81
84
  useAutoFocusNextInput([hourInputRef, minuteInputRef, secondInputRef]);
82
85
  const pickParts = () => {
83
- var _a, _b, _c;
84
86
  return [
85
- ((_a = hourInputRef.current) === null || _a === void 0 ? void 0 : _a.value) || undefined,
86
- ((_b = minuteInputRef.current) === null || _b === void 0 ? void 0 : _b.value) || undefined
87
- ].concat(withSeconds ? [(_c = secondInputRef.current) === null || _c === void 0 ? void 0 : _c.value] : []);
87
+ hourInputRef.current?.value || undefined,
88
+ minuteInputRef.current?.value || undefined
89
+ ].concat(withSeconds ? [secondInputRef.current?.value] : []);
88
90
  };
89
91
  const currentlySelectedTime = () => {
90
92
  const parts = pickParts();
91
93
  if (parts.every(Boolean)) {
92
94
  const [hour, minute, second = 0] = parts.map(Number);
93
- const current = date !== null && date !== void 0 ? date : new Date();
95
+ const current = date ?? new Date();
94
96
  return validateTime(hour, minute, second, is12h)
95
97
  ? new Date(current.setUTCHours(is12h ? convertTo24h(hour, meridiem) : hour, minute, second))
96
98
  : undefined;
@@ -98,37 +100,33 @@ const TimeInput = forwardRef((props, ref) => {
98
100
  };
99
101
  const inputContainerRef = useRef(null);
100
102
  const onFocusChange = (focused) => {
101
- var _a;
102
- const currentMeridiem = ((_a = meridiemSelectRef.current) === null || _a === void 0 ? void 0 : _a.value) || undefined;
103
+ const currentMeridiem = meridiemSelectRef.current?.value || undefined;
103
104
  const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts(), is12h ? currentMeridiem : undefined);
104
105
  if (onFocus && focused)
105
106
  onFocus(callbackParam);
106
107
  if (!focused) {
107
108
  if (inputContainerRef.current)
108
109
  inputContainerRef.current.scrollTop = 0;
109
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(callbackParam);
110
+ onBlur?.(callbackParam);
110
111
  }
111
112
  };
112
113
  const onInputChange = () => {
113
- var _a;
114
- const currentMeridiem = ((_a = meridiemSelectRef.current) === null || _a === void 0 ? void 0 : _a.value) || undefined;
115
- onChange === null || onChange === void 0 ? void 0 : onChange(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts(), is12h ? currentMeridiem : undefined));
114
+ const currentMeridiem = meridiemSelectRef.current?.value || undefined;
115
+ onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts(), is12h ? currentMeridiem : undefined));
116
116
  };
117
117
  const t = useI18n();
118
- const hour = date && is12h ? convertTo12h(date.getUTCHours()) : date === null || date === void 0 ? void 0 : date.getUTCHours();
118
+ const hour = date && is12h ? convertTo12h(date.getUTCHours()) : date?.getUTCHours();
119
119
  const HourInput = (_jsx(PartInput, { placeholder: t('hour_placeholder'), "aria-label": t('hour_label_a11y'), value: hour, onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, min: is12h ? 1 : 0, max: is12h ? 12 : 23, ref: hourInputRef, autoFocus: autoFocus }, 'hour'));
120
- const MinuteInput = (_jsx(PartInput, { placeholder: t('minute_placeholder'), "aria-label": t('minute_label_a11y'), value: date === null || date === void 0 ? void 0 : date.getUTCMinutes(), onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: minuteInputRef }, 'minute'));
121
- const SecondInput = (_jsx(PartInput, { placeholder: t('second_placeholder'), "aria-label": t('second_label_a11y'), value: date === null || date === void 0 ? void 0 : date.getUTCSeconds(), onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: secondInputRef }, 'second'));
122
- const Period = (_jsxs(Select, Object.assign({ ref: meridiemSelectRef, "aria-label": t('meridiem_label_a11y'), value: meridiem, required: required, disabled: disabled, onChange: (ev) => {
120
+ const MinuteInput = (_jsx(PartInput, { placeholder: t('minute_placeholder'), "aria-label": t('minute_label_a11y'), value: date?.getUTCMinutes(), onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: minuteInputRef }, 'minute'));
121
+ const SecondInput = (_jsx(PartInput, { placeholder: t('second_placeholder'), "aria-label": t('second_label_a11y'), value: date?.getUTCSeconds(), onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: secondInputRef }, 'second'));
122
+ const Period = (_jsxs(Select, { ref: meridiemSelectRef, "aria-label": t('meridiem_label_a11y'), value: meridiem, required: required, disabled: disabled, onChange: (ev) => {
123
123
  setMeridiem(ev.target.value);
124
124
  onInputChange();
125
- }, readOnly: readOnly }, { children: [_jsx(Option, Object.assign({ value: 'AM' }, { children: t('meridiem_value_am') }), void 0),
126
- _jsx(Option, Object.assign({ value: 'PM' }, { children: t('meridiem_value_pm') }), void 0)] }), 'period'));
125
+ }, readOnly: readOnly, children: [_jsx(Option, { value: 'AM', children: t('meridiem_value_am') }, void 0), _jsx(Option, { value: 'PM', children: t('meridiem_value_pm') }, void 0)] }, 'period'));
127
126
  const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();
128
127
  const containerRef = useConsolidatedRef(ref);
129
128
  useFocusWithin([containerRef], onFocusChange);
130
- const Picker = (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), "aria-label": t(open ? 'close_time_button_a11y' : 'open_time_button_a11y'), readOnly: readOnly, disabled: disabled }, { children: _jsx(Icon, { name: open ? 'times' : 'clock' }, void 0) }), void 0),
131
- _jsx(Popover, Object.assign({ show: open, ref: setPopoverRef, target: containerRef.current, placement: 'bottom-end', strategy: 'fixed', modifiers: [
129
+ const Picker = (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), "aria-label": t(open ? 'close_time_button_a11y' : 'open_time_button_a11y'), readOnly: readOnly, disabled: disabled, children: _jsx(Icon, { name: open ? 'times' : 'clock' }, void 0) }, void 0), _jsx(Popover, { show: open, ref: setPopoverRef, target: containerRef.current, placement: 'bottom-end', strategy: 'fixed', modifiers: [
132
130
  {
133
131
  name: 'sameWidth',
134
132
  enabled: true,
@@ -143,7 +141,7 @@ const TimeInput = forwardRef((props, ref) => {
143
141
  fallbackPlacements: ['top-end']
144
142
  }
145
143
  }
146
- ] }, { children: _jsx(TimePicker, { selected: currentlySelectedTime(), interval: pickerInterval, onSelect: selected => {
144
+ ], children: _jsx(TimePicker, { selected: currentlySelectedTime(), interval: pickerInterval, onSelect: selected => {
147
145
  hourInputRef.current.value = (is12h ? convertTo12h(selected.getUTCHours()) : selected.getUTCHours())
148
146
  .toString()
149
147
  .padStart(2, '0');
@@ -158,14 +156,13 @@ const TimeInput = forwardRef((props, ref) => {
158
156
  }
159
157
  setMeridiem(getMeridiem(selected.getUTCHours()));
160
158
  setOpen(false);
161
- buttonEl === null || buttonEl === void 0 ? void 0 : buttonEl.focus();
159
+ buttonEl?.focus();
162
160
  onInputChange();
163
- }, clockFormat: clockFormat }, void 0) }), void 0)] }, void 0));
164
- const Comp = (_jsxs(Flex, Object.assign({ as: StyledTimeInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
165
- var _a;
161
+ }, clockFormat: clockFormat }, void 0) }, void 0)] }, void 0));
162
+ const Comp = (_jsxs(Flex, { as: StyledTimeInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
166
163
  if (e.target === containerRef.current)
167
- (_a = hourInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
168
- } }, restProps, { children: [_jsx(Flex, Object.assign({ ref: inputContainerRef, as: StyledInputContainer, container: { alignItems: 'center', wrap: 'wrap' } }, { children: getDateFormat(locale, getTimeOptions(withSeconds, is12h)).map(part => {
164
+ hourInputRef.current?.focus();
165
+ }, ...restProps, children: [_jsx(Flex, { ref: inputContainerRef, as: StyledInputContainer, container: { alignItems: 'center', wrap: 'wrap' }, children: getDateFormat(locale, getTimeOptions(withSeconds, is12h)).map(part => {
169
166
  switch (part) {
170
167
  case 'hh':
171
168
  return HourInput;
@@ -179,9 +176,8 @@ const TimeInput = forwardRef((props, ref) => {
179
176
  default:
180
177
  return part;
181
178
  }
182
- }) }), void 0),
183
- !readOnly && Picker] }), void 0));
184
- return label ? (_jsx(FormField, Object.assign({ as: 'fieldset', labelAs: 'legend' }, { label, labelHidden, id, info, status, required, disabled }, { ref: ref }, { children: Comp }), void 0)) : (Comp);
179
+ }) }, void 0), !readOnly && Picker] }, void 0));
180
+ return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled }, ref: ref, children: Comp }, void 0)) : (Comp);
185
181
  });
186
182
  export default TimeInput;
187
183
  //# sourceMappingURL=TimeInput.js.map