@cognite/aura 0.3.5 → 1.46104.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/CHANGELOG.md +264 -0
  2. package/DESIGN.md +638 -281
  3. package/LICENSE +21 -0
  4. package/README.md +21 -13
  5. package/dist/colors-deprecated.css +587 -0
  6. package/dist/colors.css +803 -830
  7. package/dist/components/index.d.ts +63 -57
  8. package/dist/components/index.js +62 -59
  9. package/dist/components/index.js.map +1 -0
  10. package/dist/components/ui/core/accordion/accordion.d.ts +19 -18
  11. package/dist/components/ui/core/accordion/accordion.js +99 -78
  12. package/dist/components/ui/core/accordion/accordion.js.map +1 -0
  13. package/dist/components/ui/core/action-toolbar/action-toolbar-motion.d.ts +8 -0
  14. package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js +125 -0
  15. package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js.map +1 -0
  16. package/dist/components/ui/core/action-toolbar/action-toolbar.d.ts +31 -31
  17. package/dist/components/ui/core/action-toolbar/action-toolbar.js +156 -106
  18. package/dist/components/ui/core/action-toolbar/action-toolbar.js.map +1 -0
  19. package/dist/components/ui/core/alert/alert.d.ts +25 -25
  20. package/dist/components/ui/core/alert/alert.js +181 -152
  21. package/dist/components/ui/core/alert/alert.js.map +1 -0
  22. package/dist/components/ui/core/avatar/avatar.d.ts +10 -9
  23. package/dist/components/ui/core/avatar/avatar.js +75 -65
  24. package/dist/components/ui/core/avatar/avatar.js.map +1 -0
  25. package/dist/components/ui/core/badge/badge.d.ts +13 -12
  26. package/dist/components/ui/core/badge/badge.js +88 -72
  27. package/dist/components/ui/core/badge/badge.js.map +1 -0
  28. package/dist/components/ui/core/banner/banner.d.ts +18 -18
  29. package/dist/components/ui/core/banner/banner.js +179 -142
  30. package/dist/components/ui/core/banner/banner.js.map +1 -0
  31. package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +12 -12
  32. package/dist/components/ui/core/breadcrumb/breadcrumb.js +139 -104
  33. package/dist/components/ui/core/breadcrumb/breadcrumb.js.map +1 -0
  34. package/dist/components/ui/core/button/button.d.ts +7 -7
  35. package/dist/components/ui/core/button/button.gallery.d.ts +2 -0
  36. package/dist/components/ui/core/button/button.gallery.js +76 -0
  37. package/dist/components/ui/core/button/button.gallery.js.map +1 -0
  38. package/dist/components/ui/core/button/button.js +57 -47
  39. package/dist/components/ui/core/button/button.js.map +1 -0
  40. package/dist/components/ui/core/button-group/button-group.d.ts +9 -9
  41. package/dist/components/ui/core/button-group/button-group.js +50 -40
  42. package/dist/components/ui/core/button-group/button-group.js.map +1 -0
  43. package/dist/components/ui/core/calendar/calendar-header.d.ts +7 -7
  44. package/dist/components/ui/core/calendar/calendar-header.js +102 -63
  45. package/dist/components/ui/core/calendar/calendar-header.js.map +1 -0
  46. package/dist/components/ui/core/calendar/calendar-utils.d.ts +30 -30
  47. package/dist/components/ui/core/calendar/calendar-utils.js +116 -39
  48. package/dist/components/ui/core/calendar/calendar-utils.js.map +1 -0
  49. package/dist/components/ui/core/calendar/calendar.d.ts +10 -10
  50. package/dist/components/ui/core/calendar/calendar.js +95 -66
  51. package/dist/components/ui/core/calendar/calendar.js.map +1 -0
  52. package/dist/components/ui/core/calendar/constants.js +3 -0
  53. package/dist/components/ui/core/calendar/constants.js.map +1 -0
  54. package/dist/components/ui/core/card/card.d.ts +20 -20
  55. package/dist/components/ui/core/card/card.js +133 -104
  56. package/dist/components/ui/core/card/card.js.map +1 -0
  57. package/dist/components/ui/core/chart/chart.d.ts +55 -53
  58. package/dist/components/ui/core/chart/chart.js +196 -116
  59. package/dist/components/ui/core/chart/chart.js.map +1 -0
  60. package/dist/components/ui/core/chart/index.d.ts +2 -2
  61. package/dist/components/ui/core/chart/index.js +3 -2
  62. package/dist/components/ui/core/chart/index.js.map +1 -0
  63. package/dist/components/ui/core/checkbox/checkbox.d.ts +9 -9
  64. package/dist/components/ui/core/checkbox/checkbox.js +88 -68
  65. package/dist/components/ui/core/checkbox/checkbox.js.map +1 -0
  66. package/dist/components/ui/core/checkbox/checkbox.metadata.d.ts +1 -1
  67. package/dist/components/ui/core/checkbox/checkbox.metadata.js +6 -7
  68. package/dist/components/ui/core/checkbox/checkbox.metadata.js.map +1 -0
  69. package/dist/components/ui/core/code-block/code-block.d.ts +19 -19
  70. package/dist/components/ui/core/code-block/code-block.js +259 -175
  71. package/dist/components/ui/core/code-block/code-block.js.map +1 -0
  72. package/dist/components/ui/core/collapsible/collapsible.d.ts +5 -5
  73. package/dist/components/ui/core/collapsible/collapsible.js +36 -30
  74. package/dist/components/ui/core/collapsible/collapsible.js.map +1 -0
  75. package/dist/components/ui/core/combobox/combobox.d.ts +13 -13
  76. package/dist/components/ui/core/combobox/combobox.js +89 -40
  77. package/dist/components/ui/core/combobox/combobox.js.map +1 -0
  78. package/dist/components/ui/core/command/command.d.ts +20 -18
  79. package/dist/components/ui/core/command/command.js +137 -85
  80. package/dist/components/ui/core/command/command.js.map +1 -0
  81. package/dist/components/ui/core/conversation/conversation.d.ts +14 -0
  82. package/dist/components/ui/core/conversation/conversation.js +51 -0
  83. package/dist/components/ui/core/conversation/conversation.js.map +1 -0
  84. package/dist/components/ui/core/count/count.d.ts +8 -6
  85. package/dist/components/ui/core/count/count.js +51 -21
  86. package/dist/components/ui/core/count/count.js.map +1 -0
  87. package/dist/components/ui/core/data-grid/data-grid-cell.d.ts +7 -7
  88. package/dist/components/ui/core/data-grid/data-grid-cell.js +22 -22
  89. package/dist/components/ui/core/data-grid/data-grid-cell.js.map +1 -0
  90. package/dist/components/ui/core/data-grid/data-grid-filter-clauses.d.ts +14 -0
  91. package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js +36 -0
  92. package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js.map +1 -0
  93. package/dist/components/ui/core/data-grid/data-grid-filter-panel.d.ts +41 -0
  94. package/dist/components/ui/core/data-grid/data-grid-filter-panel.js +273 -0
  95. package/dist/components/ui/core/data-grid/data-grid-filter-panel.js.map +1 -0
  96. package/dist/components/ui/core/data-grid/data-grid-footer.d.ts +6 -0
  97. package/dist/components/ui/core/data-grid/data-grid-footer.js +34 -0
  98. package/dist/components/ui/core/data-grid/data-grid-footer.js.map +1 -0
  99. package/dist/components/ui/core/data-grid/data-grid-header-row.d.ts +10 -10
  100. package/dist/components/ui/core/data-grid/data-grid-header-row.js +69 -55
  101. package/dist/components/ui/core/data-grid/data-grid-header-row.js.map +1 -0
  102. package/dist/components/ui/core/data-grid/data-grid-header.d.ts +11 -0
  103. package/dist/components/ui/core/data-grid/data-grid-header.js +67 -0
  104. package/dist/components/ui/core/data-grid/data-grid-header.js.map +1 -0
  105. package/dist/components/ui/core/data-grid/data-grid-row.d.ts +15 -15
  106. package/dist/components/ui/core/data-grid/data-grid-row.js +104 -76
  107. package/dist/components/ui/core/data-grid/data-grid-row.js.map +1 -0
  108. package/dist/components/ui/core/data-grid/data-grid.d.ts +85 -35
  109. package/dist/components/ui/core/data-grid/data-grid.fixtures.d.ts +7 -7
  110. package/dist/components/ui/core/data-grid/data-grid.fixtures.js +139 -0
  111. package/dist/components/ui/core/data-grid/data-grid.fixtures.js.map +1 -0
  112. package/dist/components/ui/core/data-grid/data-grid.js +402 -132
  113. package/dist/components/ui/core/data-grid/data-grid.js.map +1 -0
  114. package/dist/components/ui/core/data-grid/data-grid.utils.d.ts +3 -3
  115. package/dist/components/ui/core/data-grid/data-grid.utils.js +44 -33
  116. package/dist/components/ui/core/data-grid/data-grid.utils.js.map +1 -0
  117. package/dist/components/ui/core/data-grid/index.d.ts +4 -1
  118. package/dist/components/ui/core/data-grid/index.js +5 -2
  119. package/dist/components/ui/core/data-grid/index.js.map +1 -0
  120. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.d.ts +11 -13
  121. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +85 -61
  122. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js.map +1 -0
  123. package/dist/components/ui/core/date-time-pickers/date-picker/index.d.ts +3 -3
  124. package/dist/components/ui/core/date-time-pickers/date-picker/index.js +3 -0
  125. package/dist/components/ui/core/date-time-pickers/date-picker/index.js.map +1 -0
  126. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +14 -14
  127. package/dist/components/ui/core/date-time-pickers/date-picker/types.js +3 -0
  128. package/dist/components/ui/core/date-time-pickers/date-picker/types.js.map +1 -0
  129. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.d.ts +2 -2
  130. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +51 -36
  131. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js.map +1 -0
  132. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.d.ts +11 -13
  133. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +89 -64
  134. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js.map +1 -0
  135. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.d.ts +3 -3
  136. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js +3 -0
  137. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js.map +1 -0
  138. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +20 -20
  139. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js +3 -0
  140. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js.map +1 -0
  141. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts +4 -4
  142. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +95 -60
  143. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js.map +1 -0
  144. package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.d.ts +15 -0
  145. package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js +120 -0
  146. package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js.map +1 -0
  147. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.d.ts +3 -1
  148. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js +3 -0
  149. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js.map +1 -0
  150. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.d.ts +25 -32
  151. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js +3 -0
  152. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js.map +1 -0
  153. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.d.ts +2 -2
  154. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js +78 -0
  155. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js.map +1 -0
  156. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts +13 -15
  157. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +165 -119
  158. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js.map +1 -0
  159. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.d.ts +3 -3
  160. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js +3 -0
  161. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js.map +1 -0
  162. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +37 -37
  163. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js +3 -0
  164. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js.map +1 -0
  165. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.d.ts +3 -3
  166. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +163 -104
  167. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js.map +1 -0
  168. package/dist/components/ui/core/date-time-pickers/index.d.ts +17 -12
  169. package/dist/components/ui/core/date-time-pickers/index.js +10 -6
  170. package/dist/components/ui/core/date-time-pickers/index.js.map +1 -0
  171. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +5 -5
  172. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +52 -42
  173. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js.map +1 -0
  174. package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +6 -1
  175. package/dist/components/ui/core/date-time-pickers/shared/constants.js +23 -0
  176. package/dist/components/ui/core/date-time-pickers/shared/constants.js.map +1 -0
  177. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +16 -15
  178. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +87 -64
  179. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js.map +1 -0
  180. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.d.ts +10 -9
  181. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +89 -38
  182. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js.map +1 -0
  183. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +5 -5
  184. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +34 -23
  185. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js.map +1 -0
  186. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.d.ts +23 -23
  187. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +95 -52
  188. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js.map +1 -0
  189. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.d.ts +5 -5
  190. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +22 -18
  191. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js.map +1 -0
  192. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.d.ts +19 -19
  193. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +41 -24
  194. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js.map +1 -0
  195. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +13 -13
  196. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +33 -24
  197. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js.map +1 -0
  198. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.d.ts +5 -5
  199. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +9 -4
  200. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js.map +1 -0
  201. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +13 -9
  202. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +22 -17
  203. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js.map +1 -0
  204. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -2
  205. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js +3 -0
  206. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js.map +1 -0
  207. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +13 -13
  208. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +49 -40
  209. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js.map +1 -0
  210. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.d.ts +7 -7
  211. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +41 -34
  212. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js.map +1 -0
  213. package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -3
  214. package/dist/components/ui/core/date-time-pickers/time-picker/index.js +3 -0
  215. package/dist/components/ui/core/date-time-pickers/time-picker/index.js.map +1 -0
  216. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +12 -14
  217. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +99 -79
  218. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js.map +1 -0
  219. package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +20 -20
  220. package/dist/components/ui/core/date-time-pickers/time-picker/types.js +3 -0
  221. package/dist/components/ui/core/date-time-pickers/time-picker/types.js.map +1 -0
  222. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +2 -2
  223. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +63 -41
  224. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js.map +1 -0
  225. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.d.ts +3 -1
  226. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js +3 -0
  227. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js.map +1 -0
  228. package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.d.ts +14 -0
  229. package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js +115 -0
  230. package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js.map +1 -0
  231. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.d.ts +30 -36
  232. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js +3 -0
  233. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js.map +1 -0
  234. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.d.ts +2 -2
  235. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js +145 -0
  236. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js.map +1 -0
  237. package/dist/components/ui/core/date-time-pickers/utils/date-input.d.ts +56 -0
  238. package/dist/components/ui/core/date-time-pickers/utils/date-input.js +67 -0
  239. package/dist/components/ui/core/date-time-pickers/utils/date-input.js.map +1 -0
  240. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.d.ts +18 -18
  241. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js +42 -0
  242. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js.map +1 -0
  243. package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +31 -29
  244. package/dist/components/ui/core/date-time-pickers/utils/format-utils.js +56 -0
  245. package/dist/components/ui/core/date-time-pickers/utils/format-utils.js.map +1 -0
  246. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.d.ts +21 -21
  247. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js +170 -0
  248. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js.map +1 -0
  249. package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +28 -28
  250. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +88 -7
  251. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js.map +1 -0
  252. package/dist/components/ui/core/date-time-pickers/utils/time-validation.d.ts +17 -17
  253. package/dist/components/ui/core/date-time-pickers/utils/time-validation.js +43 -0
  254. package/dist/components/ui/core/date-time-pickers/utils/time-validation.js.map +1 -0
  255. package/dist/components/ui/core/dialog/dialog.d.ts +12 -9
  256. package/dist/components/ui/core/dialog/dialog.js +90 -82
  257. package/dist/components/ui/core/dialog/dialog.js.map +1 -0
  258. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +22 -19
  259. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +204 -149
  260. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js.map +1 -0
  261. package/dist/components/ui/core/empty-state/empty-state.context.d.ts +4 -4
  262. package/dist/components/ui/core/empty-state/empty-state.context.js +8 -5
  263. package/dist/components/ui/core/empty-state/empty-state.context.js.map +1 -0
  264. package/dist/components/ui/core/empty-state/empty-state.d.ts +14 -14
  265. package/dist/components/ui/core/empty-state/empty-state.js +96 -82
  266. package/dist/components/ui/core/empty-state/empty-state.js.map +1 -0
  267. package/dist/components/ui/core/helper-text/helper-text.d.ts +7 -7
  268. package/dist/components/ui/core/helper-text/helper-text.js +55 -36
  269. package/dist/components/ui/core/helper-text/helper-text.js.map +1 -0
  270. package/dist/components/ui/core/hover-card/hover-card.d.ts +7 -6
  271. package/dist/components/ui/core/hover-card/hover-card.js +56 -52
  272. package/dist/components/ui/core/hover-card/hover-card.js.map +1 -0
  273. package/dist/components/ui/core/inline-citation/inline-citation.d.ts +26 -25
  274. package/dist/components/ui/core/inline-citation/inline-citation.js +121 -97
  275. package/dist/components/ui/core/inline-citation/inline-citation.js.map +1 -0
  276. package/dist/components/ui/core/input/input.d.ts +2 -2
  277. package/dist/components/ui/core/input/input.js +15 -13
  278. package/dist/components/ui/core/input/input.js.map +1 -0
  279. package/dist/components/ui/core/input-group/input-group.d.ts +25 -14
  280. package/dist/components/ui/core/input-group/input-group.js +149 -76
  281. package/dist/components/ui/core/input-group/input-group.js.map +1 -0
  282. package/dist/components/ui/core/item/item.d.ts +20 -0
  283. package/dist/components/ui/core/item/item.js +93 -0
  284. package/dist/components/ui/core/item/item.js.map +1 -0
  285. package/dist/components/ui/core/kbd/kbd.d.ts +3 -3
  286. package/dist/components/ui/core/kbd/kbd.js +24 -20
  287. package/dist/components/ui/core/kbd/kbd.js.map +1 -0
  288. package/dist/components/ui/core/label/label.d.ts +3 -3
  289. package/dist/components/ui/core/label/label.js +33 -26
  290. package/dist/components/ui/core/label/label.js.map +1 -0
  291. package/dist/components/ui/core/loader/loader.d.ts +6 -6
  292. package/dist/components/ui/core/loader/loader.js +97 -80
  293. package/dist/components/ui/core/loader/loader.js.map +1 -0
  294. package/dist/components/ui/core/message/message-response-default-streamdown-controls.d.ts +9 -9
  295. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +19 -12
  296. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js.map +1 -0
  297. package/dist/components/ui/core/message/message-response-math-plugin.d.ts +3 -0
  298. package/dist/components/ui/core/message/message-response-math-plugin.js +6 -0
  299. package/dist/components/ui/core/message/message-response-math-plugin.js.map +1 -0
  300. package/dist/components/ui/core/message/message.d.ts +27 -23
  301. package/dist/components/ui/core/message/message.js +453 -316
  302. package/dist/components/ui/core/message/message.js.map +1 -0
  303. package/dist/components/ui/core/overflow-list/overflow-list.d.ts +21 -0
  304. package/dist/components/ui/core/overflow-list/overflow-list.js +197 -0
  305. package/dist/components/ui/core/overflow-list/overflow-list.js.map +1 -0
  306. package/dist/components/ui/core/overflow-list/overflow-list.utils.d.ts +37 -35
  307. package/dist/components/ui/core/overflow-list/overflow-list.utils.js +206 -0
  308. package/dist/components/ui/core/overflow-list/overflow-list.utils.js.map +1 -0
  309. package/dist/components/ui/core/pagination/pagination-size-context.d.ts +2 -2
  310. package/dist/components/ui/core/pagination/pagination-size-context.js +6 -5
  311. package/dist/components/ui/core/pagination/pagination-size-context.js.map +1 -0
  312. package/dist/components/ui/core/pagination/pagination-teleport.d.ts +9 -9
  313. package/dist/components/ui/core/pagination/pagination-teleport.js +127 -84
  314. package/dist/components/ui/core/pagination/pagination-teleport.js.map +1 -0
  315. package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
  316. package/dist/components/ui/core/pagination/pagination-teleport.utils.js.map +1 -0
  317. package/dist/components/ui/core/pagination/pagination.d.ts +39 -39
  318. package/dist/components/ui/core/pagination/pagination.js +294 -234
  319. package/dist/components/ui/core/pagination/pagination.js.map +1 -0
  320. package/dist/components/ui/core/popover/popover.d.ts +12 -11
  321. package/dist/components/ui/core/popover/popover.js +104 -89
  322. package/dist/components/ui/core/popover/popover.js.map +1 -0
  323. package/dist/components/ui/core/progress/progress.d.ts +9 -8
  324. package/dist/components/ui/core/progress/progress.js +50 -35
  325. package/dist/components/ui/core/progress/progress.js.map +1 -0
  326. package/dist/components/ui/core/prompt-input/prompt-input.d.ts +27 -27
  327. package/dist/components/ui/core/prompt-input/prompt-input.js +342 -271
  328. package/dist/components/ui/core/prompt-input/prompt-input.js.map +1 -0
  329. package/dist/components/ui/core/radio-group/radio-group.d.ts +12 -12
  330. package/dist/components/ui/core/radio-group/radio-group.js +88 -58
  331. package/dist/components/ui/core/radio-group/radio-group.js.map +1 -0
  332. package/dist/components/ui/core/reasoning/reasoning.d.ts +7 -7
  333. package/dist/components/ui/core/reasoning/reasoning.js +68 -56
  334. package/dist/components/ui/core/reasoning/reasoning.js.map +1 -0
  335. package/dist/components/ui/core/scroll-area/scroll-area.d.ts +4 -4
  336. package/dist/components/ui/core/scroll-area/scroll-area.js +50 -40
  337. package/dist/components/ui/core/scroll-area/scroll-area.js.map +1 -0
  338. package/dist/components/ui/core/search/search.d.ts +8 -8
  339. package/dist/components/ui/core/search/search.js +122 -76
  340. package/dist/components/ui/core/search/search.js.map +1 -0
  341. package/dist/components/ui/core/segmented-control/segmented-control.d.ts +10 -10
  342. package/dist/components/ui/core/segmented-control/segmented-control.js +203 -149
  343. package/dist/components/ui/core/segmented-control/segmented-control.js.map +1 -0
  344. package/dist/components/ui/core/select/select.d.ts +27 -26
  345. package/dist/components/ui/core/select/select.js +213 -168
  346. package/dist/components/ui/core/select/select.js.map +1 -0
  347. package/dist/components/ui/core/separator/separator.d.ts +2 -2
  348. package/dist/components/ui/core/separator/separator.js +13 -13
  349. package/dist/components/ui/core/separator/separator.js.map +1 -0
  350. package/dist/components/ui/core/shimmer/shimmer.d.ts +8 -8
  351. package/dist/components/ui/core/shimmer/shimmer.js +64 -40
  352. package/dist/components/ui/core/shimmer/shimmer.js.map +1 -0
  353. package/dist/components/ui/core/skeleton/skeleton.d.ts +2 -2
  354. package/dist/components/ui/core/skeleton/skeleton.js +13 -13
  355. package/dist/components/ui/core/skeleton/skeleton.js.map +1 -0
  356. package/dist/components/ui/core/slider/slider.d.ts +7 -7
  357. package/dist/components/ui/core/slider/slider.js +51 -39
  358. package/dist/components/ui/core/slider/slider.js.map +1 -0
  359. package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +2 -2
  360. package/dist/components/ui/core/sonner-toast/sonner-toast.js +67 -54
  361. package/dist/components/ui/core/sonner-toast/sonner-toast.js.map +1 -0
  362. package/dist/components/ui/core/sources/sources.d.ts +12 -12
  363. package/dist/components/ui/core/sources/sources.js +87 -58
  364. package/dist/components/ui/core/sources/sources.js.map +1 -0
  365. package/dist/components/ui/core/switch/switch.d.ts +9 -9
  366. package/dist/components/ui/core/switch/switch.js +83 -61
  367. package/dist/components/ui/core/switch/switch.js.map +1 -0
  368. package/dist/components/ui/core/switch/switch.metadata.d.ts +1 -1
  369. package/dist/components/ui/core/switch/switch.metadata.js +8 -0
  370. package/dist/components/ui/core/switch/switch.metadata.js.map +1 -0
  371. package/dist/components/ui/core/tabs/tabs.d.ts +20 -18
  372. package/dist/components/ui/core/tabs/tabs.js +176 -147
  373. package/dist/components/ui/core/tabs/tabs.js.map +1 -0
  374. package/dist/components/ui/core/tabs/tabs.utils.d.ts +1 -1
  375. package/dist/components/ui/core/tabs/tabs.utils.js +10 -6
  376. package/dist/components/ui/core/tabs/tabs.utils.js.map +1 -0
  377. package/dist/components/ui/core/textarea/textarea.d.ts +2 -2
  378. package/dist/components/ui/core/textarea/textarea.js +13 -13
  379. package/dist/components/ui/core/textarea/textarea.js.map +1 -0
  380. package/dist/components/ui/core/toggle/toggle.d.ts +9 -9
  381. package/dist/components/ui/core/toggle/toggle.js +60 -54
  382. package/dist/components/ui/core/toggle/toggle.js.map +1 -0
  383. package/dist/components/ui/core/tool/tool.d.ts +18 -18
  384. package/dist/components/ui/core/tool/tool.js +167 -126
  385. package/dist/components/ui/core/tool/tool.js.map +1 -0
  386. package/dist/components/ui/core/toolbar/toolbar.d.ts +37 -0
  387. package/dist/components/ui/core/toolbar/toolbar.js +171 -0
  388. package/dist/components/ui/core/toolbar/toolbar.js.map +1 -0
  389. package/dist/components/ui/core/tooltip/tooltip.d.ts +8 -7
  390. package/dist/components/ui/core/tooltip/tooltip.js +53 -46
  391. package/dist/components/ui/core/tooltip/tooltip.js.map +1 -0
  392. package/dist/components/ui/core/topbar/topbar.d.ts +26 -26
  393. package/dist/components/ui/core/topbar/topbar.js +160 -105
  394. package/dist/components/ui/core/topbar/topbar.js.map +1 -0
  395. package/dist/components/ui/core/tree/tree.d.ts +20 -0
  396. package/dist/components/ui/core/tree/tree.js +100 -0
  397. package/dist/components/ui/core/tree/tree.js.map +1 -0
  398. package/dist/eslint/index.d.ts +5 -5
  399. package/dist/eslint/index.js +9 -5
  400. package/dist/eslint/index.js.map +1 -0
  401. package/dist/eslint/no-overriding-styles.d.ts +1 -1
  402. package/dist/eslint/no-overriding-styles.js +341 -201
  403. package/dist/eslint/no-overriding-styles.js.map +1 -0
  404. package/dist/icons/index.d.ts +1 -1
  405. package/dist/icons/index.js +2 -0
  406. package/dist/icons/index.js.map +1 -0
  407. package/dist/index.d.ts +1 -1
  408. package/dist/index.js +3 -0
  409. package/dist/index.js.map +1 -0
  410. package/dist/lib/ai/types.d.ts +43 -43
  411. package/dist/lib/ai/types.js +3 -0
  412. package/dist/lib/ai/types.js.map +1 -0
  413. package/dist/lib/decorative-variant-classes.d.ts +53 -0
  414. package/dist/lib/decorative-variant-classes.js +58 -0
  415. package/dist/lib/decorative-variant-classes.js.map +1 -0
  416. package/dist/lib/highlight-code.d.ts +11 -8
  417. package/dist/lib/highlight-code.js +58 -40
  418. package/dist/lib/highlight-code.js.map +1 -0
  419. package/dist/lib/portal-container-context.d.ts +1 -1
  420. package/dist/lib/portal-container-context.js +8 -8
  421. package/dist/lib/portal-container-context.js.map +1 -0
  422. package/dist/lib/shared-theme-from-url.d.ts +13 -0
  423. package/dist/lib/shared-theme-from-url.js +61 -0
  424. package/dist/lib/shared-theme-from-url.js.map +1 -0
  425. package/dist/lib/style-scope.d.ts +2 -2
  426. package/dist/lib/style-scope.js +6 -6
  427. package/dist/lib/style-scope.js.map +1 -0
  428. package/dist/lib/theme-share-url.d.ts +31 -0
  429. package/dist/lib/theme-share-url.js +116 -0
  430. package/dist/lib/theme-share-url.js.map +1 -0
  431. package/dist/lib/types.d.ts +39 -39
  432. package/dist/lib/types.js +3 -0
  433. package/dist/lib/types.js.map +1 -0
  434. package/dist/lib/use-controllable-state.d.ts +4 -7
  435. package/dist/lib/use-controllable-state.js +34 -21
  436. package/dist/lib/use-controllable-state.js.map +1 -0
  437. package/dist/lib/utils.d.ts +63 -34
  438. package/dist/lib/utils.js +134 -32
  439. package/dist/lib/utils.js.map +1 -0
  440. package/dist/styles.css +2 -1
  441. package/dist/styles.source.css +24 -12
  442. package/dist/utils/assign-ref.d.ts +3 -0
  443. package/dist/utils/assign-ref.js +13 -0
  444. package/dist/utils/assign-ref.js.map +1 -0
  445. package/package.json +46 -11
  446. package/src/components/ui/core/button/button.md +93 -0
@@ -0,0 +1,67 @@
1
+ import dayjs from "dayjs";
2
+ /**
3
+ * Converts a consumer date value to an internal Dayjs instance.
4
+ */ export const normalizeIn = (input)=>{
5
+ if (input == null) {
6
+ return null;
7
+ }
8
+ if (dayjs.isDayjs(input)) {
9
+ return input;
10
+ }
11
+ if (!(input instanceof Date)) {
12
+ return null;
13
+ }
14
+ const parsed = dayjs(input);
15
+ return parsed.isValid() ? parsed : null;
16
+ };
17
+ /**
18
+ * Infers the consumer value type from the current value or default date.
19
+ *
20
+ * When both `value` and `defaultDate` are null on first render, falls back to
21
+ * `explicit` or `'dayjs'` for backwards compatibility.
22
+ */ export const resolveValueType = (value, defaultDate, explicit)=>{
23
+ if (explicit) {
24
+ return explicit;
25
+ }
26
+ const candidate = value ?? defaultDate;
27
+ if (candidate == null) {
28
+ return 'dayjs';
29
+ }
30
+ if (dayjs.isDayjs(candidate)) {
31
+ return 'dayjs';
32
+ }
33
+ return 'date';
34
+ };
35
+ /**
36
+ * Converts an internal Dayjs value back to Date or Dayjs, preserving the instant.
37
+ */ export const normalizeOut = (d, type)=>{
38
+ if (d == null) {
39
+ return null;
40
+ }
41
+ return toConsumerValue(type === 'date' ? d.toDate() : d);
42
+ };
43
+ /** Converts a Dayjs range back to the consumer's value type. */ export const normalizeOutRange = (range, type)=>[
44
+ normalizeOut(range[0], type),
45
+ normalizeOut(range[1], type)
46
+ ];
47
+ /** Normalizes shortcut values to internal Dayjs before passing to picker hooks. */ export const normalizeShortcutValue = (value)=>{
48
+ if (Array.isArray(value)) {
49
+ return [
50
+ normalizeIn(value[0]),
51
+ normalizeIn(value[1])
52
+ ];
53
+ }
54
+ if (value == null) {
55
+ return null;
56
+ }
57
+ const normalized = normalizeIn(value);
58
+ if (normalized == null) {
59
+ throw new Error('Shortcut value must resolve to a valid date');
60
+ }
61
+ return normalized;
62
+ };
63
+ const toConsumerValue = (value)=>{
64
+ return value;
65
+ };
66
+
67
+ //# sourceMappingURL=date-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/components/ui/core/date-time-pickers/utils/date-input.ts"],"sourcesContent":["import type { Dayjs } from 'dayjs';\nimport dayjs from 'dayjs';\n\n/** A date value accepted by picker public APIs. */\nexport type DateInput = Date | Dayjs;\n\n/** Resolved output type for picker value binding. */\nexport type DateValueType = 'date' | 'dayjs';\n\nexport type ShortcutValueInput =\n | DateInput\n | null\n | [DateInput, DateInput]\n | [DateInput | null, DateInput | null];\n\nexport type ShortcutValueDayjs =\n Dayjs | null | [Dayjs, Dayjs] | [Dayjs | null, Dayjs | null];\n\n/**\n * Converts a consumer date value to an internal Dayjs instance.\n */\nexport const normalizeIn = (\n input: DateInput | null | undefined\n): Dayjs | null => {\n if (input == null) {\n return null;\n }\n\n if (dayjs.isDayjs(input)) {\n return input;\n }\n\n if (!(input instanceof Date)) {\n return null;\n }\n\n const parsed = dayjs(input);\n return parsed.isValid() ? parsed : null;\n};\n\n/**\n * Infers the consumer value type from the current value or default date.\n *\n * When both `value` and `defaultDate` are null on first render, falls back to\n * `explicit` or `'dayjs'` for backwards compatibility.\n */\nexport const resolveValueType = (\n value: DateInput | null | undefined,\n defaultDate?: DateInput | null,\n explicit?: DateValueType\n): DateValueType => {\n if (explicit) {\n return explicit;\n }\n\n const candidate = value ?? defaultDate;\n if (candidate == null) {\n return 'dayjs';\n }\n\n if (dayjs.isDayjs(candidate)) {\n return 'dayjs';\n }\n\n return 'date';\n};\n\n/**\n * Converts an internal Dayjs value back to Date or Dayjs, preserving the instant.\n */\nexport const normalizeOut = <T extends DateInput>(\n d: Dayjs | null,\n type: DateValueType\n): T | null => {\n if (d == null) {\n return null;\n }\n\n return toConsumerValue<T>(type === 'date' ? d.toDate() : d);\n};\n\n/** Converts a Dayjs range back to the consumer's value type. */\nexport const normalizeOutRange = <T extends DateInput>(\n range: [Dayjs | null, Dayjs | null],\n type: DateValueType\n): [T | null, T | null] => [\n normalizeOut<T>(range[0], type),\n normalizeOut<T>(range[1], type),\n];\n\n/** Normalizes shortcut values to internal Dayjs before passing to picker hooks. */\nexport const normalizeShortcutValue = (\n value: ShortcutValueInput\n): ShortcutValueDayjs => {\n if (Array.isArray(value)) {\n return [normalizeIn(value[0]), normalizeIn(value[1])];\n }\n\n if (value == null) {\n return null;\n }\n\n const normalized = normalizeIn(value);\n if (normalized == null) {\n throw new Error('Shortcut value must resolve to a valid date');\n }\n\n return normalized;\n};\n\n/** Shared value-binding props for single-value pickers. */\nexport interface DateValueProps<T extends DateInput = Dayjs> {\n /** Current value. Accepts Dayjs or native Date. */\n value: T | null;\n /** Called when the value changes. Returns the same type as `value`. */\n onChange: (date: T | null) => void;\n /** Fallback date when value is empty. Same type as `value`. */\n defaultDate?: T;\n /**\n * Output type when `value` and `defaultDate` are both null on first render.\n * @default 'dayjs'\n */\n valueType?: DateValueType;\n}\n\n/** Shared value-binding props for range pickers. */\nexport interface DateRangeValueProps<T extends DateInput = Dayjs> {\n /** Current range. Each bound accepts Dayjs or native Date. */\n value: [T | null, T | null];\n /**\n * Called when the range changes. Returns the same element type as `value`.\n */\n onChange: (range: [T | null, T | null]) => void;\n /** Fallback date when a bound is empty. Same type as range elements. */\n defaultDate?: T;\n /**\n * Output type when range values and `defaultDate` are all null on first render.\n * @default 'dayjs'\n */\n valueType?: DateValueType;\n}\n\nconst toConsumerValue = <T extends DateInput>(value: DateInput): T => {\n return value as T;\n};\n"],"names":["dayjs","normalizeIn","input","isDayjs","Date","parsed","isValid","resolveValueType","value","defaultDate","explicit","candidate","normalizeOut","d","type","toConsumerValue","toDate","normalizeOutRange","range","normalizeShortcutValue","Array","isArray","normalized","Error"],"mappings":"AACA,OAAOA,WAAW,QAAQ;AAiB1B;;CAEC,GACD,OAAO,MAAMC,cAAc,CACzBC;IAEA,IAAIA,SAAS,MAAM;QACjB,OAAO;IACT;IAEA,IAAIF,MAAMG,OAAO,CAACD,QAAQ;QACxB,OAAOA;IACT;IAEA,IAAI,CAAEA,CAAAA,iBAAiBE,IAAG,GAAI;QAC5B,OAAO;IACT;IAEA,MAAMC,SAASL,MAAME;IACrB,OAAOG,OAAOC,OAAO,KAAKD,SAAS;AACrC,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAME,mBAAmB,CAC9BC,OACAC,aACAC;IAEA,IAAIA,UAAU;QACZ,OAAOA;IACT;IAEA,MAAMC,YAAYH,SAASC;IAC3B,IAAIE,aAAa,MAAM;QACrB,OAAO;IACT;IAEA,IAAIX,MAAMG,OAAO,CAACQ,YAAY;QAC5B,OAAO;IACT;IAEA,OAAO;AACT,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMC,eAAe,CAC1BC,GACAC;IAEA,IAAID,KAAK,MAAM;QACb,OAAO;IACT;IAEA,OAAOE,gBAAmBD,SAAS,SAASD,EAAEG,MAAM,KAAKH;AAC3D,EAAE;AAEF,8DAA8D,GAC9D,OAAO,MAAMI,oBAAoB,CAC/BC,OACAJ,OACyB;QACzBF,aAAgBM,KAAK,CAAC,EAAE,EAAEJ;QAC1BF,aAAgBM,KAAK,CAAC,EAAE,EAAEJ;KAC3B,CAAC;AAEF,iFAAiF,GACjF,OAAO,MAAMK,yBAAyB,CACpCX;IAEA,IAAIY,MAAMC,OAAO,CAACb,QAAQ;QACxB,OAAO;YAACP,YAAYO,KAAK,CAAC,EAAE;YAAGP,YAAYO,KAAK,CAAC,EAAE;SAAE;IACvD;IAEA,IAAIA,SAAS,MAAM;QACjB,OAAO;IACT;IAEA,MAAMc,aAAarB,YAAYO;IAC/B,IAAIc,cAAc,MAAM;QACtB,MAAM,IAAIC,MAAM;IAClB;IAEA,OAAOD;AACT,EAAE;AAkCF,MAAMP,kBAAkB,CAAsBP;IAC5C,OAAOA;AACT"}
@@ -1,26 +1,26 @@
1
- import { Dayjs } from 'dayjs';
1
+ import type { Dayjs } from "dayjs";
2
2
  /**
3
- * Applies start of day (00:00:00.000) to a given date
4
- * @param date - Dayjs object
5
- * @returns Dayjs object with time set to 00:00:00.000
6
- */
3
+ * Applies start of day (00:00:00.000) to a given date
4
+ * @param date - Dayjs object
5
+ * @returns Dayjs object with time set to 00:00:00.000
6
+ */
7
7
  export declare const applyStartOfDay: (date: Dayjs) => Dayjs;
8
8
  /**
9
- * Applies end of day (23:59:59.999) to a given date
10
- * @param date - Dayjs object
11
- * @returns Dayjs object with time set to 23:59:59.999
12
- */
9
+ * Applies end of day (23:59:59.999) to a given date
10
+ * @param date - Dayjs object
11
+ * @returns Dayjs object with time set to 23:59:59.999
12
+ */
13
13
  export declare const applyEndOfDay: (date: Dayjs) => Dayjs;
14
14
  /**
15
- * Validates that a date range is valid (start is before or equal to end)
16
- * @param start - Start date (Dayjs or null)
17
- * @param end - End date (Dayjs or null)
18
- * @returns True if the range is valid, false otherwise
19
- */
15
+ * Validates that a date range is valid (start is before or equal to end)
16
+ * @param start - Start date (Dayjs or null)
17
+ * @param end - End date (Dayjs or null)
18
+ * @returns True if the range is valid, false otherwise
19
+ */
20
20
  export declare const validateDateRange: (start: Dayjs | null, end: Dayjs | null) => boolean;
21
21
  /**
22
- * Converts a timestamp (milliseconds) to a Dayjs object
23
- * @param timestamp - Timestamp in milliseconds
24
- * @returns Dayjs object or null if timestamp is null or undefined
25
- */
22
+ * Converts a timestamp (milliseconds) to a Dayjs object
23
+ * @param timestamp - Timestamp in milliseconds
24
+ * @returns Dayjs object or null if timestamp is null or undefined
25
+ */
26
26
  export declare const timestampToDayjs: (timestamp: number | undefined | null) => Dayjs | null;
@@ -0,0 +1,42 @@
1
+ import dayjs from "dayjs";
2
+ /**
3
+ * Applies start of day (00:00:00.000) to a given date
4
+ * @param date - Dayjs object
5
+ * @returns Dayjs object with time set to 00:00:00.000
6
+ */ export const applyStartOfDay = (date)=>{
7
+ return date.startOf('day');
8
+ };
9
+ /**
10
+ * Applies end of day (23:59:59.999) to a given date
11
+ * @param date - Dayjs object
12
+ * @returns Dayjs object with time set to 23:59:59.999
13
+ */ export const applyEndOfDay = (date)=>{
14
+ return date.endOf('day');
15
+ };
16
+ /**
17
+ * Validates that a date range is valid (start is before or equal to end)
18
+ * @param start - Start date (Dayjs or null)
19
+ * @param end - End date (Dayjs or null)
20
+ * @returns True if the range is valid, false otherwise
21
+ */ export const validateDateRange = (start, end)=>{
22
+ if (!start || !end) {
23
+ return false;
24
+ }
25
+ if (!start.isValid() || !end.isValid()) {
26
+ return false;
27
+ }
28
+ return start.isBefore(end) || start.isSame(end);
29
+ };
30
+ /**
31
+ * Converts a timestamp (milliseconds) to a Dayjs object
32
+ * @param timestamp - Timestamp in milliseconds
33
+ * @returns Dayjs object or null if timestamp is null or undefined
34
+ */ export const timestampToDayjs = (timestamp)=>{
35
+ if (timestamp == null) {
36
+ return null;
37
+ }
38
+ const date = dayjs(timestamp);
39
+ return date.isValid() ? date : null;
40
+ };
41
+
42
+ //# sourceMappingURL=date-range-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/components/ui/core/date-time-pickers/utils/date-range-utils.ts"],"sourcesContent":["import type { Dayjs } from 'dayjs';\nimport dayjs from 'dayjs';\n\n/**\n * Applies start of day (00:00:00.000) to a given date\n * @param date - Dayjs object\n * @returns Dayjs object with time set to 00:00:00.000\n */\nexport const applyStartOfDay = (date: Dayjs): Dayjs => {\n return date.startOf('day');\n};\n\n/**\n * Applies end of day (23:59:59.999) to a given date\n * @param date - Dayjs object\n * @returns Dayjs object with time set to 23:59:59.999\n */\nexport const applyEndOfDay = (date: Dayjs): Dayjs => {\n return date.endOf('day');\n};\n\n/**\n * Validates that a date range is valid (start is before or equal to end)\n * @param start - Start date (Dayjs or null)\n * @param end - End date (Dayjs or null)\n * @returns True if the range is valid, false otherwise\n */\nexport const validateDateRange = (\n start: Dayjs | null,\n end: Dayjs | null\n): boolean => {\n if (!start || !end) {\n return false;\n }\n\n if (!start.isValid() || !end.isValid()) {\n return false;\n }\n\n return start.isBefore(end) || start.isSame(end);\n};\n\n/**\n * Converts a timestamp (milliseconds) to a Dayjs object\n * @param timestamp - Timestamp in milliseconds\n * @returns Dayjs object or null if timestamp is null or undefined\n */\nexport const timestampToDayjs = (\n timestamp: number | undefined | null\n): Dayjs | null => {\n if (timestamp == null) {\n return null;\n }\n\n const date = dayjs(timestamp);\n return date.isValid() ? date : null;\n};\n"],"names":["dayjs","applyStartOfDay","date","startOf","applyEndOfDay","endOf","validateDateRange","start","end","isValid","isBefore","isSame","timestampToDayjs","timestamp"],"mappings":"AACA,OAAOA,WAAW,QAAQ;AAE1B;;;;CAIC,GACD,OAAO,MAAMC,kBAAkB,CAACC;IAC9B,OAAOA,KAAKC,OAAO,CAAC;AACtB,EAAE;AAEF;;;;CAIC,GACD,OAAO,MAAMC,gBAAgB,CAACF;IAC5B,OAAOA,KAAKG,KAAK,CAAC;AACpB,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAMC,oBAAoB,CAC/BC,OACAC;IAEA,IAAI,CAACD,SAAS,CAACC,KAAK;QAClB,OAAO;IACT;IAEA,IAAI,CAACD,MAAME,OAAO,MAAM,CAACD,IAAIC,OAAO,IAAI;QACtC,OAAO;IACT;IAEA,OAAOF,MAAMG,QAAQ,CAACF,QAAQD,MAAMI,MAAM,CAACH;AAC7C,EAAE;AAEF;;;;CAIC,GACD,OAAO,MAAMI,mBAAmB,CAC9BC;IAEA,IAAIA,aAAa,MAAM;QACrB,OAAO;IACT;IAEA,MAAMX,OAAOF,MAAMa;IACnB,OAAOX,KAAKO,OAAO,KAAKP,OAAO;AACjC,EAAE"}
@@ -1,38 +1,40 @@
1
- import { Dayjs } from 'dayjs';
2
- export type TimeFormat = '12h' | '24h';
3
- export type AmPm = 'AM' | 'PM';
1
+ import { type Dayjs } from "dayjs";
2
+ export type TimeFormat = "12h" | "24h";
3
+ export type AmPm = "AM" | "PM";
4
+ /** dayjs format token for a date-time picker display value. */
5
+ export declare const getDateTimeDisplayFormat: (timeFormat?: TimeFormat, format?: string) => string;
4
6
  /**
5
- * Formats a date for display
6
- * @param date - Dayjs date object
7
- * @param format - Date format string (e.g., 'DD/MM/YYYY')
8
- * @returns Formatted date string
9
- */
7
+ * Formats a date for display
8
+ * @param date - Dayjs date object
9
+ * @param format - Date format string (e.g., 'DD/MM/YYYY')
10
+ * @returns Formatted date string
11
+ */
10
12
  export declare const formatDateDisplay: (date: Dayjs, format: string) => string;
11
13
  /**
12
- * Formats time for display using dayjs formatting
13
- * @param time - Time object with hour and minute
14
- * @param timeFormat - '12h' or '24h' format
15
- * @returns Formatted time string (e.g., "9:05 AM" or "09:05")
16
- */
14
+ * Formats time for display using dayjs formatting
15
+ * @param time - Time object with hour and minute
16
+ * @param timeFormat - '12h' or '24h' format
17
+ * @returns Formatted time string (e.g., "9:05 AM" or "09:05")
18
+ */
17
19
  export declare const formatTimeDisplay: (time: {
18
- hour: number;
19
- minute: number;
20
+ hour: number;
21
+ minute: number;
20
22
  }, timeFormat?: TimeFormat) => string;
21
23
  /**
22
- * Formats a date range for display
23
- * @param start - Start date
24
- * @param end - End date
25
- * @param format - Date format string
26
- * @returns Formatted date range string (e.g., "10/05/2024 – 20/05/2024")
27
- */
24
+ * Formats a date range for display
25
+ * @param start - Start date
26
+ * @param end - End date
27
+ * @param format - Date format string
28
+ * @returns Formatted date range string (e.g., "10/05/2024 – 20/05/2024")
29
+ */
28
30
  export declare const formatRangeDisplay: (start: Dayjs | null, end: Dayjs | null, format: string) => string;
29
31
  /**
30
- * Formats a date-time range for display
31
- * @param start - Start date
32
- * @param end - End date
33
- * @param dateFormat - Date format string
34
- * @param includeTime - Whether to include time in the format
35
- * @param timeFormat - '12h' or '24h' format
36
- * @returns Formatted date-time range string
37
- */
32
+ * Formats a date-time range for display
33
+ * @param start - Start date
34
+ * @param end - End date
35
+ * @param dateFormat - Date format string
36
+ * @param includeTime - Whether to include time in the format
37
+ * @param timeFormat - '12h' or '24h' format
38
+ * @returns Formatted date-time range string
39
+ */
38
40
  export declare const formatDateTimeRangeDisplay: (start: Dayjs | null, end: Dayjs | null, dateFormat: string, includeTime?: boolean, timeFormat?: TimeFormat) => string;
@@ -0,0 +1,56 @@
1
+ import dayjs from "dayjs";
2
+ const DATE_TIME_DISPLAY_FORMAT_12H = 'DD/MM/YYYY h:mm A';
3
+ const DATE_TIME_DISPLAY_FORMAT_24H = 'DD/MM/YYYY HH:mm';
4
+ /** dayjs format token for a date-time picker display value. */ export const getDateTimeDisplayFormat = (timeFormat = '24h', format)=>format ?? (timeFormat === '12h' ? DATE_TIME_DISPLAY_FORMAT_12H : DATE_TIME_DISPLAY_FORMAT_24H);
5
+ /**
6
+ * Formats a date for display
7
+ * @param date - Dayjs date object
8
+ * @param format - Date format string (e.g., 'DD/MM/YYYY')
9
+ * @returns Formatted date string
10
+ */ export const formatDateDisplay = (date, format)=>{
11
+ return date.format(format);
12
+ };
13
+ /**
14
+ * Formats time for display using dayjs formatting
15
+ * @param time - Time object with hour and minute
16
+ * @param timeFormat - '12h' or '24h' format
17
+ * @returns Formatted time string (e.g., "9:05 AM" or "09:05")
18
+ */ export const formatTimeDisplay = (time, timeFormat = '24h')=>{
19
+ const { hour, minute } = time;
20
+ const timeObj = dayjs().hour(hour).minute(minute);
21
+ return timeFormat === '12h' ? timeObj.format('h:mm A') : timeObj.format('HH:mm');
22
+ };
23
+ /**
24
+ * Formats a date range for display
25
+ * @param start - Start date
26
+ * @param end - End date
27
+ * @param format - Date format string
28
+ * @returns Formatted date range string (e.g., "10/05/2024 – 20/05/2024")
29
+ */ export const formatRangeDisplay = (start, end, format)=>{
30
+ const startStr = start ? formatDateDisplay(start, format) : null;
31
+ const endStr = end ? formatDateDisplay(end, format) : null;
32
+ if (startStr && endStr) {
33
+ return `${startStr} – ${endStr}`;
34
+ }
35
+ return startStr || endStr || '';
36
+ };
37
+ /**
38
+ * Formats a date-time range for display
39
+ * @param start - Start date
40
+ * @param end - End date
41
+ * @param dateFormat - Date format string
42
+ * @param includeTime - Whether to include time in the format
43
+ * @param timeFormat - '12h' or '24h' format
44
+ * @returns Formatted date-time range string
45
+ */ export const formatDateTimeRangeDisplay = (start, end, dateFormat, includeTime = false, timeFormat = '24h')=>{
46
+ const timePattern = timeFormat === '12h' ? 'h:mm A' : 'HH:mm';
47
+ const fullFormat = includeTime ? `${dateFormat} ${timePattern}` : dateFormat;
48
+ const startStr = start?.format(fullFormat) ?? null;
49
+ const endStr = end?.format(fullFormat) ?? null;
50
+ if (startStr && endStr) {
51
+ return `${startStr} – ${endStr}`;
52
+ }
53
+ return startStr || endStr || '';
54
+ };
55
+
56
+ //# sourceMappingURL=format-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/components/ui/core/date-time-pickers/utils/format-utils.ts"],"sourcesContent":["import dayjs, { type Dayjs } from 'dayjs';\n\nexport type TimeFormat = '12h' | '24h';\nexport type AmPm = 'AM' | 'PM';\n\nconst DATE_TIME_DISPLAY_FORMAT_12H = 'DD/MM/YYYY h:mm A';\nconst DATE_TIME_DISPLAY_FORMAT_24H = 'DD/MM/YYYY HH:mm';\n\n/** dayjs format token for a date-time picker display value. */\nexport const getDateTimeDisplayFormat = (\n timeFormat: TimeFormat = '24h',\n format?: string\n): string =>\n format ??\n (timeFormat === '12h'\n ? DATE_TIME_DISPLAY_FORMAT_12H\n : DATE_TIME_DISPLAY_FORMAT_24H);\n\n/**\n * Formats a date for display\n * @param date - Dayjs date object\n * @param format - Date format string (e.g., 'DD/MM/YYYY')\n * @returns Formatted date string\n */\nexport const formatDateDisplay = (date: Dayjs, format: string): string => {\n return date.format(format);\n};\n\n/**\n * Formats time for display using dayjs formatting\n * @param time - Time object with hour and minute\n * @param timeFormat - '12h' or '24h' format\n * @returns Formatted time string (e.g., \"9:05 AM\" or \"09:05\")\n */\nexport const formatTimeDisplay = (\n time: { hour: number; minute: number },\n timeFormat: TimeFormat = '24h'\n): string => {\n const { hour, minute } = time;\n const timeObj = dayjs().hour(hour).minute(minute);\n\n return timeFormat === '12h'\n ? timeObj.format('h:mm A')\n : timeObj.format('HH:mm');\n};\n\n/**\n * Formats a date range for display\n * @param start - Start date\n * @param end - End date\n * @param format - Date format string\n * @returns Formatted date range string (e.g., \"10/05/2024 – 20/05/2024\")\n */\nexport const formatRangeDisplay = (\n start: Dayjs | null,\n end: Dayjs | null,\n format: string\n): string => {\n const startStr = start ? formatDateDisplay(start, format) : null;\n const endStr = end ? formatDateDisplay(end, format) : null;\n\n if (startStr && endStr) {\n return `${startStr} – ${endStr}`;\n }\n\n return startStr || endStr || '';\n};\n\n/**\n * Formats a date-time range for display\n * @param start - Start date\n * @param end - End date\n * @param dateFormat - Date format string\n * @param includeTime - Whether to include time in the format\n * @param timeFormat - '12h' or '24h' format\n * @returns Formatted date-time range string\n */\nexport const formatDateTimeRangeDisplay = (\n start: Dayjs | null,\n end: Dayjs | null,\n dateFormat: string,\n includeTime: boolean = false,\n timeFormat: TimeFormat = '24h'\n): string => {\n const timePattern = timeFormat === '12h' ? 'h:mm A' : 'HH:mm';\n const fullFormat = includeTime ? `${dateFormat} ${timePattern}` : dateFormat;\n\n const startStr = start?.format(fullFormat) ?? null;\n const endStr = end?.format(fullFormat) ?? null;\n\n if (startStr && endStr) {\n return `${startStr} – ${endStr}`;\n }\n\n return startStr || endStr || '';\n};\n"],"names":["dayjs","DATE_TIME_DISPLAY_FORMAT_12H","DATE_TIME_DISPLAY_FORMAT_24H","getDateTimeDisplayFormat","timeFormat","format","formatDateDisplay","date","formatTimeDisplay","time","hour","minute","timeObj","formatRangeDisplay","start","end","startStr","endStr","formatDateTimeRangeDisplay","dateFormat","includeTime","timePattern","fullFormat"],"mappings":"AAAA,OAAOA,WAA2B,QAAQ;AAK1C,MAAMC,+BAA+B;AACrC,MAAMC,+BAA+B;AAErC,6DAA6D,GAC7D,OAAO,MAAMC,2BAA2B,CACtCC,aAAyB,KAAK,EAC9BC,SAEAA,UACCD,CAAAA,eAAe,QACZH,+BACAC,4BAA2B,EAAG;AAEpC;;;;;CAKC,GACD,OAAO,MAAMI,oBAAoB,CAACC,MAAaF;IAC7C,OAAOE,KAAKF,MAAM,CAACA;AACrB,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAMG,oBAAoB,CAC/BC,MACAL,aAAyB,KAAK;IAE9B,MAAM,EAAEM,IAAI,EAAEC,MAAM,EAAE,GAAGF;IACzB,MAAMG,UAAUZ,QAAQU,IAAI,CAACA,MAAMC,MAAM,CAACA;IAE1C,OAAOP,eAAe,QAClBQ,QAAQP,MAAM,CAAC,YACfO,QAAQP,MAAM,CAAC;AACrB,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMQ,qBAAqB,CAChCC,OACAC,KACAV;IAEA,MAAMW,WAAWF,QAAQR,kBAAkBQ,OAAOT,UAAU;IAC5D,MAAMY,SAASF,MAAMT,kBAAkBS,KAAKV,UAAU;IAEtD,IAAIW,YAAYC,QAAQ;QACtB,OAAO,GAAGD,SAAS,GAAG,EAAEC,QAAQ;IAClC;IAEA,OAAOD,YAAYC,UAAU;AAC/B,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCJ,OACAC,KACAI,YACAC,cAAuB,KAAK,EAC5BhB,aAAyB,KAAK;IAE9B,MAAMiB,cAAcjB,eAAe,QAAQ,WAAW;IACtD,MAAMkB,aAAaF,cAAc,GAAGD,WAAW,CAAC,EAAEE,aAAa,GAAGF;IAElE,MAAMH,WAAWF,OAAOT,OAAOiB,eAAe;IAC9C,MAAML,SAASF,KAAKV,OAAOiB,eAAe;IAE1C,IAAIN,YAAYC,QAAQ;QACtB,OAAO,GAAGD,SAAS,GAAG,EAAEC,QAAQ;IAClC;IAEA,OAAOD,YAAYC,UAAU;AAC/B,EAAE"}
@@ -1,27 +1,27 @@
1
- export type SegmentType = 'day' | 'month' | 'year' | 'hour' | 'minute' | 'second' | 'ampm' | 'separator';
2
- export type DateSegmentType = 'day' | 'month' | 'year';
3
- export type TimeSegmentType = 'hour' | 'minute' | 'second' | 'ampm';
1
+ export type SegmentType = "day" | "month" | "year" | "hour" | "minute" | "second" | "ampm" | "separator";
2
+ export type DateSegmentType = "day" | "month" | "year";
3
+ export type TimeSegmentType = "hour" | "minute" | "second" | "ampm";
4
4
  export interface Segment {
5
- type: SegmentType;
6
- token: string;
7
- startIndex: number;
8
- endIndex: number;
9
- length: number;
10
- editable: boolean;
5
+ type: SegmentType;
6
+ token: string;
7
+ startIndex: number;
8
+ endIndex: number;
9
+ length: number;
10
+ editable: boolean;
11
11
  }
12
12
  /**
13
- * Parse a date format string into an array of segments.
14
- *
15
- * @example
16
- * parseFormatToSegments('DD/MM/YYYY')
17
- * // Returns:
18
- * // [
19
- * // { type: 'day', token: 'DD', startIndex: 0, endIndex: 2, length: 2, editable: true },
20
- * // { type: 'separator', token: '/', ... },
21
- * // { type: 'month', token: 'MM', ... },
22
- * // ...
23
- * // ]
24
- */
13
+ * Parse a date format string into an array of segments.
14
+ *
15
+ * @example
16
+ * parseFormatToSegments('DD/MM/YYYY')
17
+ * // Returns:
18
+ * // [
19
+ * // { type: 'day', token: 'DD', startIndex: 0, endIndex: 2, length: 2, editable: true },
20
+ * // { type: 'separator', token: '/', ... },
21
+ * // { type: 'month', token: 'MM', ... },
22
+ * // ...
23
+ * // ]
24
+ */
25
25
  export declare const parseFormatToSegments: (format: string) => Segment[];
26
26
  export declare const getEditableSegments: (format: string) => Segment[];
27
27
  export declare const getSegmentAtPosition: (segments: Segment[], position: number) => Segment | undefined;
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Maps format tokens to their segment type and display length.
3
+ * Note: `length` is the rendered output width (e.g., 'D' renders as '01', so length is 2).
4
+ */ const FORMAT_TOKEN_MAP = {
5
+ D: {
6
+ type: 'day',
7
+ length: 2
8
+ },
9
+ DD: {
10
+ type: 'day',
11
+ length: 2
12
+ },
13
+ M: {
14
+ type: 'month',
15
+ length: 2
16
+ },
17
+ MM: {
18
+ type: 'month',
19
+ length: 2
20
+ },
21
+ YY: {
22
+ type: 'year',
23
+ length: 2
24
+ },
25
+ YYYY: {
26
+ type: 'year',
27
+ length: 4
28
+ },
29
+ H: {
30
+ type: 'hour',
31
+ length: 2
32
+ },
33
+ HH: {
34
+ type: 'hour',
35
+ length: 2
36
+ },
37
+ h: {
38
+ type: 'hour',
39
+ length: 2
40
+ },
41
+ hh: {
42
+ type: 'hour',
43
+ length: 2
44
+ },
45
+ m: {
46
+ type: 'minute',
47
+ length: 2
48
+ },
49
+ mm: {
50
+ type: 'minute',
51
+ length: 2
52
+ },
53
+ s: {
54
+ type: 'second',
55
+ length: 2
56
+ },
57
+ ss: {
58
+ type: 'second',
59
+ length: 2
60
+ },
61
+ A: {
62
+ type: 'ampm',
63
+ length: 2
64
+ },
65
+ a: {
66
+ type: 'ampm',
67
+ length: 2
68
+ }
69
+ };
70
+ const SORTED_TOKENS = Object.keys(FORMAT_TOKEN_MAP).sort((a, b)=>b.length - a.length);
71
+ /**
72
+ * Parse a date format string into an array of segments.
73
+ *
74
+ * @example
75
+ * parseFormatToSegments('DD/MM/YYYY')
76
+ * // Returns:
77
+ * // [
78
+ * // { type: 'day', token: 'DD', startIndex: 0, endIndex: 2, length: 2, editable: true },
79
+ * // { type: 'separator', token: '/', ... },
80
+ * // { type: 'month', token: 'MM', ... },
81
+ * // ...
82
+ * // ]
83
+ */ export const parseFormatToSegments = (format)=>{
84
+ const segments = [];
85
+ let position = 0;
86
+ while(position < format.length){
87
+ let matched = false;
88
+ for (const token of SORTED_TOKENS){
89
+ if (format.slice(position, position + token.length) === token) {
90
+ const tokenInfo = FORMAT_TOKEN_MAP[token];
91
+ segments.push({
92
+ type: tokenInfo.type,
93
+ token,
94
+ startIndex: position,
95
+ endIndex: position + token.length,
96
+ length: tokenInfo.length,
97
+ editable: true
98
+ });
99
+ position += token.length;
100
+ matched = true;
101
+ break;
102
+ }
103
+ }
104
+ if (!matched) {
105
+ const char = format[position];
106
+ const lastSegment = segments[segments.length - 1];
107
+ if (lastSegment?.type === 'separator') {
108
+ lastSegment.token += char;
109
+ lastSegment.endIndex = position + 1;
110
+ lastSegment.length += 1;
111
+ } else {
112
+ segments.push({
113
+ type: 'separator',
114
+ token: char,
115
+ startIndex: position,
116
+ endIndex: position + 1,
117
+ length: 1,
118
+ editable: false
119
+ });
120
+ }
121
+ position += 1;
122
+ }
123
+ }
124
+ return segments;
125
+ };
126
+ export const getEditableSegments = (format)=>{
127
+ return parseFormatToSegments(format).filter((segment)=>segment.editable);
128
+ };
129
+ export const getSegmentAtPosition = (segments, position)=>{
130
+ return segments.find((segment)=>position >= segment.startIndex && position < segment.endIndex);
131
+ };
132
+ export const getEditableSegmentIndex = (segments, segment)=>{
133
+ const editableSegments = segments.filter((s)=>s.editable);
134
+ return editableSegments.findIndex((s)=>s.startIndex === segment.startIndex && s.type === segment.type);
135
+ };
136
+ export const getNextEditableSegment = (segments, currentSegment)=>{
137
+ const editableSegments = segments.filter((s)=>s.editable);
138
+ const currentIndex = editableSegments.findIndex((s)=>s.startIndex === currentSegment.startIndex && s.type === currentSegment.type);
139
+ if (currentIndex === -1 || currentIndex >= editableSegments.length - 1) {
140
+ return undefined;
141
+ }
142
+ return editableSegments[currentIndex + 1];
143
+ };
144
+ export const getPreviousEditableSegment = (segments, currentSegment)=>{
145
+ const editableSegments = segments.filter((s)=>s.editable);
146
+ const currentIndex = editableSegments.findIndex((s)=>s.startIndex === currentSegment.startIndex && s.type === currentSegment.type);
147
+ if (currentIndex <= 0) {
148
+ return undefined;
149
+ }
150
+ return editableSegments[currentIndex - 1];
151
+ };
152
+ export const getFirstEditableSegment = (segments)=>{
153
+ return segments.find((s)=>s.editable);
154
+ };
155
+ export const getLastEditableSegment = (segments)=>{
156
+ for(let i = segments.length - 1; i >= 0; i--){
157
+ if (segments[i].editable) {
158
+ return segments[i];
159
+ }
160
+ }
161
+ return undefined;
162
+ };
163
+ export const isDateSegment = (type)=>{
164
+ return type === 'day' || type === 'month' || type === 'year';
165
+ };
166
+ export const isTimeSegment = (type)=>{
167
+ return type === 'hour' || type === 'minute' || type === 'second' || type === 'ampm';
168
+ };
169
+
170
+ //# sourceMappingURL=segment-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/components/ui/core/date-time-pickers/utils/segment-utils.ts"],"sourcesContent":["export type SegmentType =\n | 'day'\n | 'month'\n | 'year'\n | 'hour'\n | 'minute'\n | 'second'\n | 'ampm'\n | 'separator';\n\nexport type DateSegmentType = 'day' | 'month' | 'year';\nexport type TimeSegmentType = 'hour' | 'minute' | 'second' | 'ampm';\n\nexport interface Segment {\n type: SegmentType;\n token: string;\n startIndex: number;\n endIndex: number;\n length: number;\n editable: boolean;\n}\n\n/**\n * Maps format tokens to their segment type and display length.\n * Note: `length` is the rendered output width (e.g., 'D' renders as '01', so length is 2).\n */\nconst FORMAT_TOKEN_MAP: Record<string, { type: SegmentType; length: number }> =\n {\n D: { type: 'day', length: 2 },\n DD: { type: 'day', length: 2 },\n M: { type: 'month', length: 2 },\n MM: { type: 'month', length: 2 },\n YY: { type: 'year', length: 2 },\n YYYY: { type: 'year', length: 4 },\n H: { type: 'hour', length: 2 },\n HH: { type: 'hour', length: 2 },\n h: { type: 'hour', length: 2 },\n hh: { type: 'hour', length: 2 },\n m: { type: 'minute', length: 2 },\n mm: { type: 'minute', length: 2 },\n s: { type: 'second', length: 2 },\n ss: { type: 'second', length: 2 },\n A: { type: 'ampm', length: 2 },\n a: { type: 'ampm', length: 2 },\n };\n\nconst SORTED_TOKENS = Object.keys(FORMAT_TOKEN_MAP).sort(\n (a, b) => b.length - a.length\n);\n\n/**\n * Parse a date format string into an array of segments.\n *\n * @example\n * parseFormatToSegments('DD/MM/YYYY')\n * // Returns:\n * // [\n * // { type: 'day', token: 'DD', startIndex: 0, endIndex: 2, length: 2, editable: true },\n * // { type: 'separator', token: '/', ... },\n * // { type: 'month', token: 'MM', ... },\n * // ...\n * // ]\n */\nexport const parseFormatToSegments = (format: string): Segment[] => {\n const segments: Segment[] = [];\n let position = 0;\n\n while (position < format.length) {\n let matched = false;\n\n for (const token of SORTED_TOKENS) {\n if (format.slice(position, position + token.length) === token) {\n const tokenInfo = FORMAT_TOKEN_MAP[token];\n segments.push({\n type: tokenInfo.type,\n token,\n startIndex: position,\n endIndex: position + token.length,\n length: tokenInfo.length,\n editable: true,\n });\n position += token.length;\n matched = true;\n break;\n }\n }\n\n if (!matched) {\n const char = format[position];\n const lastSegment = segments[segments.length - 1];\n if (lastSegment?.type === 'separator') {\n lastSegment.token += char;\n lastSegment.endIndex = position + 1;\n lastSegment.length += 1;\n } else {\n segments.push({\n type: 'separator',\n token: char,\n startIndex: position,\n endIndex: position + 1,\n length: 1,\n editable: false,\n });\n }\n position += 1;\n }\n }\n\n return segments;\n};\n\nexport const getEditableSegments = (format: string): Segment[] => {\n return parseFormatToSegments(format).filter((segment) => segment.editable);\n};\n\nexport const getSegmentAtPosition = (\n segments: Segment[],\n position: number\n): Segment | undefined => {\n return segments.find(\n (segment) => position >= segment.startIndex && position < segment.endIndex\n );\n};\n\nexport const getEditableSegmentIndex = (\n segments: Segment[],\n segment: Segment\n): number => {\n const editableSegments = segments.filter((s) => s.editable);\n return editableSegments.findIndex(\n (s) => s.startIndex === segment.startIndex && s.type === segment.type\n );\n};\n\nexport const getNextEditableSegment = (\n segments: Segment[],\n currentSegment: Segment\n): Segment | undefined => {\n const editableSegments = segments.filter((s) => s.editable);\n const currentIndex = editableSegments.findIndex(\n (s) =>\n s.startIndex === currentSegment.startIndex &&\n s.type === currentSegment.type\n );\n if (currentIndex === -1 || currentIndex >= editableSegments.length - 1) {\n return undefined;\n }\n return editableSegments[currentIndex + 1];\n};\n\nexport const getPreviousEditableSegment = (\n segments: Segment[],\n currentSegment: Segment\n): Segment | undefined => {\n const editableSegments = segments.filter((s) => s.editable);\n const currentIndex = editableSegments.findIndex(\n (s) =>\n s.startIndex === currentSegment.startIndex &&\n s.type === currentSegment.type\n );\n if (currentIndex <= 0) {\n return undefined;\n }\n return editableSegments[currentIndex - 1];\n};\n\nexport const getFirstEditableSegment = (\n segments: Segment[]\n): Segment | undefined => {\n return segments.find((s) => s.editable);\n};\n\nexport const getLastEditableSegment = (\n segments: Segment[]\n): Segment | undefined => {\n for (let i = segments.length - 1; i >= 0; i--) {\n if (segments[i].editable) {\n return segments[i];\n }\n }\n return undefined;\n};\n\nexport const isDateSegment = (type: SegmentType): type is DateSegmentType => {\n return type === 'day' || type === 'month' || type === 'year';\n};\n\nexport const isTimeSegment = (type: SegmentType): type is TimeSegmentType => {\n return (\n type === 'hour' || type === 'minute' || type === 'second' || type === 'ampm'\n );\n};\n"],"names":["FORMAT_TOKEN_MAP","D","type","length","DD","M","MM","YY","YYYY","H","HH","h","hh","m","mm","s","ss","A","a","SORTED_TOKENS","Object","keys","sort","b","parseFormatToSegments","format","segments","position","matched","token","slice","tokenInfo","push","startIndex","endIndex","editable","char","lastSegment","getEditableSegments","filter","segment","getSegmentAtPosition","find","getEditableSegmentIndex","editableSegments","findIndex","getNextEditableSegment","currentSegment","currentIndex","undefined","getPreviousEditableSegment","getFirstEditableSegment","getLastEditableSegment","i","isDateSegment","isTimeSegment"],"mappings":"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"}
@@ -1,43 +1,43 @@
1
- import { AmPm, TimeFormat } from './format-utils';
1
+ import type { AmPm, TimeFormat } from "./format-utils";
2
2
  /**
3
- * Generates an array of hours.
4
- * If timeFormat is '12h', generates hours from 1 to 12.
5
- * Otherwise, generates hours from 0 to 23.
6
- * @returns Array of hours
7
- */
3
+ * Generates an array of hours.
4
+ * If timeFormat is '12h', generates hours from 1 to 12.
5
+ * Otherwise, generates hours from 0 to 23.
6
+ * @returns Array of hours
7
+ */
8
8
  export declare const generateHours: (timeFormat?: TimeFormat) => number[];
9
9
  /**
10
- * Generates an array of minutes in 5-minute increments
11
- * @returns Array of minutes [0, 5, 10, ..., 55]
12
- */
10
+ * Generates an array of minutes in 5-minute increments
11
+ * @returns Array of minutes [0, 5, 10, ..., 55]
12
+ */
13
13
  export declare const generateMinutes: () => number[];
14
14
  /**
15
- * Formats time components into HH:MM string format
16
- * @param hour - Hour value (0-23)
17
- * @param minute - Minute value (0-59)
18
- * @returns Formatted time string (e.g., "09:05")
19
- */
15
+ * Formats time components into HH:MM string format
16
+ * @param hour - Hour value (0-23)
17
+ * @param minute - Minute value (0-59)
18
+ * @returns Formatted time string (e.g., "09:05")
19
+ */
20
20
  export declare const formatTime: (hour: number, minute: number) => string;
21
21
  /**
22
- * Parses a time string in HH:MM or H:MM format
23
- * @param timeString - Time string in HH:MM format (e.g., "09:30", "9:30")
24
- * @returns Object with hour and minute properties, or null if invalid
25
- */
22
+ * Parses a time string in HH:MM or H:MM format
23
+ * @param timeString - Time string in HH:MM format (e.g., "09:30", "9:30")
24
+ * @returns Object with hour and minute properties, or null if invalid
25
+ */
26
26
  export declare const parseTime: (timeString: string) => {
27
- hour: number;
28
- minute: number;
27
+ hour: number;
28
+ minute: number;
29
29
  } | null;
30
30
  /**
31
- * Gets AM/PM period from a 24-hour format hour.
32
- */
31
+ * Gets AM/PM period from a 24-hour format hour.
32
+ */
33
33
  export declare const getAmPmFromHour: (hour: number) => AmPm;
34
34
  /**
35
- * Converts a 12-hour format hour and AM/PM period to a 24-hour format hour.
36
- */
35
+ * Converts a 12-hour format hour and AM/PM period to a 24-hour format hour.
36
+ */
37
37
  export declare const convert12HourTo24Hour: (hour: number, ampm: AmPm) => number;
38
38
  /**
39
- * Converts a 24-hour format hour to a 12-hour display value (1-12).
40
- * Used when displaying time in 12-hour format.
41
- * @param hour24 - Hour value (0-23)
42
- */
39
+ * Converts a 24-hour format hour to a 12-hour display value (1-12).
40
+ * Used when displaying time in 12-hour format.
41
+ * @param hour24 - Hour value (0-23)
42
+ */
43
43
  export declare const convert24HourTo12Hour: (hour24: number) => number;