@cognite/aura 0.3.4 → 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 +48 -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 +23 -0
  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 +70 -0
  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 +105 -0
  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 +404 -0
  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 +51 -0
  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 -0
  118. package/dist/components/ui/core/data-grid/index.js +5 -0
  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 +17 -11
  342. package/dist/components/ui/core/segmented-control/segmented-control.js +204 -108
  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 +50 -11
  446. package/src/components/ui/core/button/button.md +93 -0
@@ -1,44 +1,54 @@
1
- import { cn as e } from "../../../../lib/utils.js";
2
- import { Separator as t } from "../separator/separator.js";
3
- import { jsx as n } from "react/jsx-runtime";
4
- import { cva as r } from "class-variance-authority";
5
- import { mergeProps as i } from "@base-ui/react/merge-props";
6
- import { useRender as a } from "@base-ui/react/use-render";
7
- //#region libs/aura/src/components/ui/core/button-group/button-group.tsx
8
- var o = r("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2", {
9
- variants: { orientation: {
10
- horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
11
- vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
12
- } },
13
- defaultVariants: { orientation: "horizontal" }
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { mergeProps } from "@base-ui/react/merge-props";
3
+ import { useRender } from "@base-ui/react/use-render";
4
+ import { cva } from "class-variance-authority";
5
+ import { cn } from "../../../../lib/utils.js";
6
+ import { Separator } from "../separator/separator.js";
7
+ const buttonGroupVariants = cva("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2", {
8
+ variants: {
9
+ orientation: {
10
+ horizontal: '[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none',
11
+ vertical: 'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none'
12
+ }
13
+ },
14
+ defaultVariants: {
15
+ orientation: 'horizontal'
16
+ }
14
17
  });
15
- function s({ className: t, orientation: r, ...i }) {
16
- return /* @__PURE__ */ n("div", {
17
- role: "group",
18
- "data-slot": "button-group",
19
- "data-orientation": r,
20
- className: e(o({ orientation: r }), t),
21
- ...i
22
- });
18
+ function ButtonGroup({ className, orientation, ...props }) {
19
+ return /*#__PURE__*/ _jsx("div", {
20
+ role: "group",
21
+ "data-slot": "button-group",
22
+ "data-orientation": orientation,
23
+ className: cn(buttonGroupVariants({
24
+ orientation
25
+ }), className),
26
+ ...props
27
+ });
23
28
  }
24
- function c({ className: t, render: n, children: r, ...o }) {
25
- return a({
26
- defaultTagName: "div",
27
- props: i({ className: e("bg-muted-background flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", t) }, {
28
- ...o,
29
- children: r
30
- }),
31
- render: n,
32
- state: { slot: "button-group-text" }
33
- });
29
+ function ButtonGroupText({ className, render, children, ...props }) {
30
+ return useRender({
31
+ defaultTagName: 'div',
32
+ props: mergeProps({
33
+ className: cn("bg-muted-background flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className)
34
+ }, {
35
+ ...props,
36
+ children
37
+ }),
38
+ render,
39
+ state: {
40
+ slot: 'button-group-text'
41
+ }
42
+ });
34
43
  }
35
- function l({ className: r, orientation: i = "vertical", ...a }) {
36
- return /* @__PURE__ */ n(t, {
37
- "data-slot": "button-group-separator",
38
- orientation: i,
39
- className: e("bg-muted-background relative m-0 self-stretch data-[orientation=vertical]:h-auto", r),
40
- ...a
41
- });
44
+ function ButtonGroupSeparator({ className, orientation = 'vertical', ...props }) {
45
+ return /*#__PURE__*/ _jsx(Separator, {
46
+ "data-slot": "button-group-separator",
47
+ orientation: orientation,
48
+ className: cn('bg-muted-background relative m-0 self-stretch data-[orientation=vertical]:h-auto', className),
49
+ ...props
50
+ });
42
51
  }
43
- //#endregion
44
- export { s as ButtonGroup, l as ButtonGroupSeparator, c as ButtonGroupText, o as buttonGroupVariants };
52
+ export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
53
+
54
+ //# sourceMappingURL=button-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/button-group/button-group.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport type { ClassProp } from 'class-variance-authority/types';\n\nimport { cn } from '../../../../lib/utils';\nimport { Separator } from '../separator/separator';\n\nconst buttonGroupVariants: (\n props?:\n | ({\n orientation?: 'horizontal' | 'vertical' | null | undefined;\n } & ClassProp)\n | undefined\n) => string = cva(\n \"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2\",\n {\n variants: {\n orientation: {\n horizontal:\n '[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none',\n vertical:\n 'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none',\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n }\n);\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: ComponentProps<'div'> &\n VariantProps<typeof buttonGroupVariants>): ReactNode {\n return (\n <div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nfunction ButtonGroupText({\n className,\n render,\n children,\n ...props\n}: useRender.ComponentProps<'div'>): ReactNode {\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(\n {\n className: cn(\n \"bg-muted-background flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className\n ),\n },\n { ...props, children }\n ),\n render,\n state: {\n slot: 'button-group-text',\n },\n });\n}\n\nfunction ButtonGroupSeparator({\n className,\n orientation = 'vertical',\n ...props\n}: ComponentProps<typeof Separator>): ReactNode {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n 'bg-muted-background relative m-0 self-stretch data-[orientation=vertical]:h-auto',\n className\n )}\n {...props}\n />\n );\n}\n\nexport {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n};\n"],"names":["mergeProps","useRender","cva","cn","Separator","buttonGroupVariants","variants","orientation","horizontal","vertical","defaultVariants","ButtonGroup","className","props","div","role","data-slot","data-orientation","ButtonGroupText","render","children","defaultTagName","state","slot","ButtonGroupSeparator"],"mappings":";AAEA,SAASA,UAAU,QAAQ,6BAA6B;AACxD,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAA4BC,GAAG,QAAQ,2BAA2B;AAGlE,SAASC,EAAE,QAAQ,2BAAwB;AAC3C,SAASC,SAAS,QAAQ,4BAAyB;AAEnD,MAAMC,sBAMQH,IACZ,oSACA;IACEI,UAAU;QACRC,aAAa;YACXC,YACE;YACFC,UACE;QACJ;IACF;IACAC,iBAAiB;QACfH,aAAa;IACf;AACF;AAGF,SAASI,YAAY,EACnBC,SAAS,EACTL,WAAW,EACX,GAAGM,OAEqC;IACxC,qBACE,KAACC;QACCC,MAAK;QACLC,aAAU;QACVC,oBAAkBV;QAClBK,WAAWT,GAAGE,oBAAoB;YAAEE;QAAY,IAAIK;QACnD,GAAGC,KAAK;;AAGf;AAEA,SAASK,gBAAgB,EACvBN,SAAS,EACTO,MAAM,EACNC,QAAQ,EACR,GAAGP,OAC6B;IAChC,OAAOZ,UAAU;QACfoB,gBAAgB;QAChBR,OAAOb,WACL;YACEY,WAAWT,GACT,qKACAS;QAEJ,GACA;YAAE,GAAGC,KAAK;YAAEO;QAAS;QAEvBD;QACAG,OAAO;YACLC,MAAM;QACR;IACF;AACF;AAEA,SAASC,qBAAqB,EAC5BZ,SAAS,EACTL,cAAc,UAAU,EACxB,GAAGM,OAC8B;IACjC,qBACE,KAACT;QACCY,aAAU;QACVT,aAAaA;QACbK,WAAWT,GACT,oFACAS;QAED,GAAGC,KAAK;;AAGf;AAEA,SACEF,WAAW,EACXa,oBAAoB,EACpBN,eAAe,EACfb,mBAAmB,GACnB"}
@@ -1,10 +1,10 @@
1
- import { FC } from 'react';
2
- import { Dayjs } from 'dayjs';
1
+ import type { FC } from "react";
2
+ import type { Dayjs } from "dayjs";
3
3
  export interface CalendarHeaderProps {
4
- displayedMonth: Dayjs;
5
- onPrevMonth: () => void;
6
- onNextMonth: () => void;
7
- onMonthChange: (month: Dayjs) => void;
8
- className?: string;
4
+ displayedMonth: Dayjs;
5
+ onPrevMonth: () => void;
6
+ onNextMonth: () => void;
7
+ onMonthChange: (month: Dayjs) => void;
8
+ className?: string;
9
9
  }
10
10
  export declare const CalendarHeader: FC<CalendarHeaderProps>;
@@ -1,63 +1,102 @@
1
- import { cn as e } from "../../../../lib/utils.js";
2
- import { Button as t } from "../button/button.js";
3
- import { DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuTrigger as a } from "../dropdown-menu/dropdown-menu.js";
4
- import { IconChevronDown as o, IconChevronLeft as s, IconChevronRight as c } from "@tabler/icons-react";
5
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
6
- import d from "dayjs";
7
- //#region libs/aura/src/components/ui/core/calendar/calendar-header.tsx
8
- var f = Array.from({ length: 12 }, (e, t) => d().month(t).format("MMMM")), p = d().year() - 50, m = d().year() + 10, h = Array.from({ length: m - p + 1 }, (e, t) => p + t), g = ({ label: e, items: s, onSelect: c }) => /* @__PURE__ */ u(n, {
9
- modal: !1,
10
- children: [/* @__PURE__ */ l(a, { render: /* @__PURE__ */ u(t, {
11
- variant: "ghost",
12
- size: "sm",
13
- className: "h-7 px-2 gap-1 text-sm font-medium text-secondary-foreground",
14
- children: [e, /* @__PURE__ */ l(o, { className: "size-4" })]
15
- }) }), /* @__PURE__ */ l(r, {
16
- className: "max-h-60 overflow-y-auto",
17
- children: s.map(({ value: e, label: t }) => /* @__PURE__ */ l(i, {
18
- onClick: () => c(e),
19
- children: t
20
- }, e))
21
- })]
22
- }), _ = ({ displayedMonth: n, onPrevMonth: r, onNextMonth: i, onMonthChange: a, className: o }) => /* @__PURE__ */ u("div", {
23
- "data-slot": "calendar-header",
24
- className: e("flex items-center justify-between pt-1 w-full", o),
25
- children: [
26
- /* @__PURE__ */ l(t, {
27
- variant: "ghost",
28
- size: "icon-sm",
29
- className: "size-7 rounded-md text-secondary-foreground",
30
- onClick: r,
31
- "aria-label": "Previous month",
32
- children: /* @__PURE__ */ l(s, { className: "size-4" })
33
- }),
34
- /* @__PURE__ */ u("div", {
35
- className: "flex items-center gap-0.5",
36
- children: [/* @__PURE__ */ l(g, {
37
- label: n.format("MMMM"),
38
- items: f.map((e, t) => ({
39
- value: t,
40
- label: e
41
- })),
42
- onSelect: (e) => a(n.date(1).month(e))
43
- }), /* @__PURE__ */ l(g, {
44
- label: n.format("YYYY"),
45
- items: h.map((e) => ({
46
- value: e,
47
- label: String(e)
48
- })),
49
- onSelect: (e) => a(n.date(1).year(e))
50
- })]
51
- }),
52
- /* @__PURE__ */ l(t, {
53
- variant: "ghost",
54
- size: "icon-sm",
55
- className: "size-7 rounded-md text-secondary-foreground",
56
- onClick: i,
57
- "aria-label": "Next month",
58
- children: /* @__PURE__ */ l(c, { className: "size-4" })
59
- })
60
- ]
61
- });
62
- //#endregion
63
- export { _ as CalendarHeader };
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { IconChevronDown, IconChevronLeft, IconChevronRight } from "@tabler/icons-react";
3
+ import dayjs from "dayjs";
4
+ import { cn } from "../../../../lib/utils.js";
5
+ import { Button } from "../button/button.js";
6
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../dropdown-menu/dropdown-menu.js";
7
+ const MONTHS = Array.from({
8
+ length: 12
9
+ }, (_, i)=>dayjs().month(i).format('MMMM'));
10
+ const YEAR_RANGE_START = dayjs().year() - 50;
11
+ const YEAR_RANGE_END = dayjs().year() + 10;
12
+ const YEARS = Array.from({
13
+ length: YEAR_RANGE_END - YEAR_RANGE_START + 1
14
+ }, (_, i)=>YEAR_RANGE_START + i);
15
+ // DropdownMenuItem unmounts on close and remounts on open, so a ref callback on
16
+ // the active item fires exactly when the list opens — scrolling it into view
17
+ // instead of always starting at the top of the (potentially 60-year-long) list.
18
+ const scrollSelectedItemIntoView = (node)=>{
19
+ node?.scrollIntoView?.({
20
+ block: 'center',
21
+ behavior: 'instant'
22
+ });
23
+ };
24
+ const NavigationDropdown = ({ label, items, selectedValue, onSelect })=>/*#__PURE__*/ _jsxs(DropdownMenu, {
25
+ modal: false,
26
+ children: [
27
+ /*#__PURE__*/ _jsx(DropdownMenuTrigger, {
28
+ render: /*#__PURE__*/ _jsxs(Button, {
29
+ variant: "ghost",
30
+ size: "sm",
31
+ className: "h-7 px-2 gap-1 text-sm font-medium text-secondary-foreground",
32
+ children: [
33
+ label,
34
+ /*#__PURE__*/ _jsx(IconChevronDown, {
35
+ className: "size-4"
36
+ })
37
+ ]
38
+ })
39
+ }),
40
+ /*#__PURE__*/ _jsx(DropdownMenuContent, {
41
+ className: "max-h-60 overflow-y-auto",
42
+ children: items.map(({ value, label: itemLabel })=>/*#__PURE__*/ _jsx(DropdownMenuItem, {
43
+ ref: value === selectedValue ? scrollSelectedItemIntoView : undefined,
44
+ onClick: ()=>onSelect(value),
45
+ children: itemLabel
46
+ }, value))
47
+ })
48
+ ]
49
+ });
50
+ export const CalendarHeader = ({ displayedMonth, onPrevMonth, onNextMonth, onMonthChange, className })=>{
51
+ return /*#__PURE__*/ _jsxs("div", {
52
+ "data-slot": "calendar-header",
53
+ className: cn('flex items-center justify-between pt-1 w-full', className),
54
+ children: [
55
+ /*#__PURE__*/ _jsx(Button, {
56
+ variant: "ghost",
57
+ size: "icon-sm",
58
+ className: "size-7 rounded-md text-secondary-foreground",
59
+ onClick: onPrevMonth,
60
+ "aria-label": "Previous month",
61
+ children: /*#__PURE__*/ _jsx(IconChevronLeft, {
62
+ className: "size-4"
63
+ })
64
+ }),
65
+ /*#__PURE__*/ _jsxs("div", {
66
+ className: "flex items-center gap-0.5",
67
+ children: [
68
+ /*#__PURE__*/ _jsx(NavigationDropdown, {
69
+ label: displayedMonth.format('MMMM'),
70
+ items: MONTHS.map((name, i)=>({
71
+ value: i,
72
+ label: name
73
+ })),
74
+ selectedValue: displayedMonth.month(),
75
+ onSelect: (i)=>onMonthChange(displayedMonth.date(1).month(i))
76
+ }),
77
+ /*#__PURE__*/ _jsx(NavigationDropdown, {
78
+ label: displayedMonth.format('YYYY'),
79
+ items: YEARS.map((y)=>({
80
+ value: y,
81
+ label: String(y)
82
+ })),
83
+ selectedValue: displayedMonth.year(),
84
+ onSelect: (y)=>onMonthChange(displayedMonth.date(1).year(y))
85
+ })
86
+ ]
87
+ }),
88
+ /*#__PURE__*/ _jsx(Button, {
89
+ variant: "ghost",
90
+ size: "icon-sm",
91
+ className: "size-7 rounded-md text-secondary-foreground",
92
+ onClick: onNextMonth,
93
+ "aria-label": "Next month",
94
+ children: /*#__PURE__*/ _jsx(IconChevronRight, {
95
+ className: "size-4"
96
+ })
97
+ })
98
+ ]
99
+ });
100
+ };
101
+
102
+ //# sourceMappingURL=calendar-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/calendar/calendar-header.tsx"],"sourcesContent":["import type { FC } from 'react';\n\nimport {\n IconChevronDown,\n IconChevronLeft,\n IconChevronRight,\n} from '@tabler/icons-react';\nimport type { Dayjs } from 'dayjs';\nimport dayjs from 'dayjs';\n\nimport { cn } from '../../../../lib/utils';\nimport { Button } from '../button/button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../dropdown-menu/dropdown-menu';\n\nconst MONTHS = Array.from({ length: 12 }, (_: unknown, i: number) =>\n dayjs().month(i).format('MMMM')\n);\n\nconst YEAR_RANGE_START = dayjs().year() - 50;\nconst YEAR_RANGE_END = dayjs().year() + 10;\nconst YEARS = Array.from(\n { length: YEAR_RANGE_END - YEAR_RANGE_START + 1 },\n (_: unknown, i: number) => YEAR_RANGE_START + i\n);\n\ninterface NavigationDropdownItem {\n value: number;\n label: string;\n}\n\ninterface NavigationDropdownProps {\n label: string;\n items: NavigationDropdownItem[];\n selectedValue: number;\n onSelect: (value: number) => void;\n}\n\n// DropdownMenuItem unmounts on close and remounts on open, so a ref callback on\n// the active item fires exactly when the list opens — scrolling it into view\n// instead of always starting at the top of the (potentially 60-year-long) list.\nconst scrollSelectedItemIntoView = (node: HTMLElement | null) => {\n node?.scrollIntoView?.({ block: 'center', behavior: 'instant' });\n};\n\nconst NavigationDropdown: FC<NavigationDropdownProps> = ({\n label,\n items,\n selectedValue,\n onSelect,\n}) => (\n <DropdownMenu modal={false}>\n <DropdownMenuTrigger\n render={\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 gap-1 text-sm font-medium text-secondary-foreground\"\n >\n {label}\n <IconChevronDown className=\"size-4\" />\n </Button>\n }\n />\n <DropdownMenuContent className=\"max-h-60 overflow-y-auto\">\n {items.map(({ value, label: itemLabel }) => (\n <DropdownMenuItem\n key={value}\n ref={value === selectedValue ? scrollSelectedItemIntoView : undefined}\n onClick={() => onSelect(value)}\n >\n {itemLabel}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n);\n\nexport interface CalendarHeaderProps {\n displayedMonth: Dayjs;\n onPrevMonth: () => void;\n onNextMonth: () => void;\n onMonthChange: (month: Dayjs) => void;\n className?: string;\n}\n\nexport const CalendarHeader: FC<CalendarHeaderProps> = ({\n displayedMonth,\n onPrevMonth,\n onNextMonth,\n onMonthChange,\n className,\n}) => {\n return (\n <div\n data-slot=\"calendar-header\"\n className={cn('flex items-center justify-between pt-1 w-full', className)}\n >\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n className=\"size-7 rounded-md text-secondary-foreground\"\n onClick={onPrevMonth}\n aria-label=\"Previous month\"\n >\n <IconChevronLeft className=\"size-4\" />\n </Button>\n <div className=\"flex items-center gap-0.5\">\n <NavigationDropdown\n label={displayedMonth.format('MMMM')}\n items={MONTHS.map((name, i) => ({ value: i, label: name }))}\n selectedValue={displayedMonth.month()}\n onSelect={(i) => onMonthChange(displayedMonth.date(1).month(i))}\n />\n <NavigationDropdown\n label={displayedMonth.format('YYYY')}\n items={YEARS.map((y) => ({ value: y, label: String(y) }))}\n selectedValue={displayedMonth.year()}\n onSelect={(y) => onMonthChange(displayedMonth.date(1).year(y))}\n />\n </div>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n className=\"size-7 rounded-md text-secondary-foreground\"\n onClick={onNextMonth}\n aria-label=\"Next month\"\n >\n <IconChevronRight className=\"size-4\" />\n </Button>\n </div>\n );\n};\n"],"names":["IconChevronDown","IconChevronLeft","IconChevronRight","dayjs","cn","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","MONTHS","Array","from","length","_","i","month","format","YEAR_RANGE_START","year","YEAR_RANGE_END","YEARS","scrollSelectedItemIntoView","node","scrollIntoView","block","behavior","NavigationDropdown","label","items","selectedValue","onSelect","modal","render","variant","size","className","map","value","itemLabel","ref","undefined","onClick","CalendarHeader","displayedMonth","onPrevMonth","onNextMonth","onMonthChange","div","data-slot","aria-label","name","date","y","String"],"mappings":";AAEA,SACEA,eAAe,EACfC,eAAe,EACfC,gBAAgB,QACX,sBAAsB;AAE7B,OAAOC,WAAW,QAAQ;AAE1B,SAASC,EAAE,QAAQ,2BAAwB;AAC3C,SAASC,MAAM,QAAQ,sBAAmB;AAC1C,SACEC,YAAY,EACZC,mBAAmB,EACnBC,gBAAgB,EAChBC,mBAAmB,QACd,oCAAiC;AAExC,MAAMC,SAASC,MAAMC,IAAI,CAAC;IAAEC,QAAQ;AAAG,GAAG,CAACC,GAAYC,IACrDZ,QAAQa,KAAK,CAACD,GAAGE,MAAM,CAAC;AAG1B,MAAMC,mBAAmBf,QAAQgB,IAAI,KAAK;AAC1C,MAAMC,iBAAiBjB,QAAQgB,IAAI,KAAK;AACxC,MAAME,QAAQV,MAAMC,IAAI,CACtB;IAAEC,QAAQO,iBAAiBF,mBAAmB;AAAE,GAChD,CAACJ,GAAYC,IAAcG,mBAAmBH;AAehD,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAChF,MAAMO,6BAA6B,CAACC;IAClCA,MAAMC,iBAAiB;QAAEC,OAAO;QAAUC,UAAU;IAAU;AAChE;AAEA,MAAMC,qBAAkD,CAAC,EACvDC,KAAK,EACLC,KAAK,EACLC,aAAa,EACbC,QAAQ,EACT,iBACC,MAACzB;QAAa0B,OAAO;;0BACnB,KAACvB;gBACCwB,sBACE,MAAC5B;oBACC6B,SAAQ;oBACRC,MAAK;oBACLC,WAAU;;wBAETR;sCACD,KAAC5B;4BAAgBoC,WAAU;;;;;0BAIjC,KAAC7B;gBAAoB6B,WAAU;0BAC5BP,MAAMQ,GAAG,CAAC,CAAC,EAAEC,KAAK,EAAEV,OAAOW,SAAS,EAAE,iBACrC,KAAC/B;wBAECgC,KAAKF,UAAUR,gBAAgBR,6BAA6BmB;wBAC5DC,SAAS,IAAMX,SAASO;kCAEvBC;uBAJID;;;;AAmBf,OAAO,MAAMK,iBAA0C,CAAC,EACtDC,cAAc,EACdC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbX,SAAS,EACV;IACC,qBACE,MAACY;QACCC,aAAU;QACVb,WAAWhC,GAAG,iDAAiDgC;;0BAE/D,KAAC/B;gBACC6B,SAAQ;gBACRC,MAAK;gBACLC,WAAU;gBACVM,SAASG;gBACTK,cAAW;0BAEX,cAAA,KAACjD;oBAAgBmC,WAAU;;;0BAE7B,MAACY;gBAAIZ,WAAU;;kCACb,KAACT;wBACCC,OAAOgB,eAAe3B,MAAM,CAAC;wBAC7BY,OAAOnB,OAAO2B,GAAG,CAAC,CAACc,MAAMpC,IAAO,CAAA;gCAAEuB,OAAOvB;gCAAGa,OAAOuB;4BAAK,CAAA;wBACxDrB,eAAec,eAAe5B,KAAK;wBACnCe,UAAU,CAAChB,IAAMgC,cAAcH,eAAeQ,IAAI,CAAC,GAAGpC,KAAK,CAACD;;kCAE9D,KAACY;wBACCC,OAAOgB,eAAe3B,MAAM,CAAC;wBAC7BY,OAAOR,MAAMgB,GAAG,CAAC,CAACgB,IAAO,CAAA;gCAAEf,OAAOe;gCAAGzB,OAAO0B,OAAOD;4BAAG,CAAA;wBACtDvB,eAAec,eAAezB,IAAI;wBAClCY,UAAU,CAACsB,IAAMN,cAAcH,eAAeQ,IAAI,CAAC,GAAGjC,IAAI,CAACkC;;;;0BAG/D,KAAChD;gBACC6B,SAAQ;gBACRC,MAAK;gBACLC,WAAU;gBACVM,SAASI;gBACTI,cAAW;0BAEX,cAAA,KAAChD;oBAAiBkC,WAAU;;;;;AAIpC,EAAE"}
@@ -1,48 +1,48 @@
1
- import { Dayjs } from 'dayjs';
1
+ import { type Dayjs } from "dayjs";
2
2
  /**
3
- * Get all days to display in a calendar month grid (including padding days from prev/next months)
4
- * @param month - The month to display
5
- * @param locale - Optional locale for week start day (e.g., 'en', 'nb', 'de')
6
- */
3
+ * Get all days to display in a calendar month grid (including padding days from prev/next months)
4
+ * @param month - The month to display
5
+ * @param locale - Optional locale for week start day (e.g., 'en', 'nb', 'de')
6
+ */
7
7
  export declare function getCalendarDays(month: Dayjs, locale?: string): Dayjs[];
8
8
  /**
9
- * Check if a date is within a given range (inclusive)
10
- * Uses dayjs isBetween plugin with '[]' for inclusive start and end
11
- * @see https://day.js.org/docs/en/plugin/is-between
12
- */
9
+ * Check if a date is within a given range (inclusive)
10
+ * Uses dayjs isBetween plugin with '[]' for inclusive start and end
11
+ * @see https://day.js.org/docs/en/plugin/is-between
12
+ */
13
13
  export declare function isDateInRange(date: Dayjs, startDate: Dayjs | null, endDate: Dayjs | null): boolean;
14
14
  /**
15
- * Check if a date is outside the current display month
16
- */
15
+ * Check if a date is outside the current display month
16
+ */
17
17
  export declare function isOutsideMonth(date: Dayjs, displayMonth: Dayjs): boolean;
18
18
  /**
19
- * Check if a date is today
20
- * Note: Uses local timezone. Both the input date and current time are compared
21
- * using the user's local timezone, which is the expected behavior for calendar UIs.
22
- * @param date - The date to check
23
- * @param now - Optional current date for testing (defaults to dayjs())
24
- */
19
+ * Check if a date is today
20
+ * Note: Uses local timezone. Both the input date and current time are compared
21
+ * using the user's local timezone, which is the expected behavior for calendar UIs.
22
+ * @param date - The date to check
23
+ * @param now - Optional current date for testing (defaults to dayjs())
24
+ */
25
25
  export declare function isToday(date: Dayjs, now?: Dayjs): boolean;
26
26
  /**
27
- * Get an array of weekday names (short form)
28
- * @param locale - Optional locale for localized weekday names (e.g., 'en', 'nb', 'de')
29
- * @param baseDate - Optional base date for testing (defaults to dayjs())
30
- */
27
+ * Get an array of weekday names (short form)
28
+ * @param locale - Optional locale for localized weekday names (e.g., 'en', 'nb', 'de')
29
+ * @param baseDate - Optional base date for testing (defaults to dayjs())
30
+ */
31
31
  export declare function getWeekdayNames(locale?: string, baseDate?: Dayjs): string[];
32
32
  /**
33
- * Get the week number for a given date
34
- */
33
+ * Get the week number for a given date
34
+ */
35
35
  export declare function getWeekNumber(date: Dayjs): number;
36
36
  /**
37
- * Get all week numbers for days in a calendar month grid
38
- */
37
+ * Get all week numbers for days in a calendar month grid
38
+ */
39
39
  export declare function getWeekNumbers(days: Dayjs[]): number[];
40
40
  /**
41
- * Check if two dates are the same day
42
- */
41
+ * Check if two dates are the same day
42
+ */
43
43
  export declare function isSameDay(date1: Dayjs | null, date2: Dayjs | null): boolean;
44
44
  /**
45
- * Format a date range for display
46
- * When one date is missing, shows the format placeholder for the missing date
47
- */
45
+ * Format a date range for display
46
+ * When one date is missing, shows the format placeholder for the missing date
47
+ */
48
48
  export declare function formatDateRange(startDate: Dayjs | null, endDate: Dayjs | null, format: string): string;
@@ -1,39 +1,116 @@
1
- import e from "dayjs";
2
- import t from "dayjs/plugin/isBetween.js";
3
- import n from "dayjs/plugin/isSameOrBefore.js";
4
- import r from "dayjs/plugin/weekOfYear.js";
5
- e.extend(t), e.extend(n), e.extend(r);
6
- function i(e, t) {
7
- let n = t ? e.locale(t) : e, r = n.startOf("month").startOf("week"), i = n.endOf("month").endOf("week"), a = [], o = r;
8
- for (; o.isSameOrBefore(i, "day");) a.push(o), o = o.add(1, "day");
9
- return a;
10
- }
11
- function a(e, t, n) {
12
- return !t || !n || !e.isValid() || !t.isValid() || !n.isValid() || t.isAfter(n, "day") ? !1 : e.isBetween(t, n, "day", "[]");
13
- }
14
- function o(e, t) {
15
- return e.month() !== t.month();
16
- }
17
- function s(t, n) {
18
- return t.isSame(n ?? e(), "day");
19
- }
20
- function c(t, n) {
21
- let r = n || e(), i = (t ? r.locale(t) : r).startOf("week");
22
- return Array.from({ length: 7 }, (e, t) => i.add(t, "day").format("dd"));
23
- }
24
- function l(e) {
25
- return e.week();
26
- }
27
- function u(e) {
28
- let t = [];
29
- for (let n = 0; n < e.length; n += 7) {
30
- let r = e[n];
31
- r && t.push(l(r));
32
- }
33
- return t;
34
- }
35
- function d(e, t) {
36
- return !e || !t ? !1 : e.isSame(t, "day");
37
- }
38
- //#endregion
39
- export { i as getCalendarDays, l as getWeekNumber, u as getWeekNumbers, c as getWeekdayNames, a as isDateInRange, o as isOutsideMonth, d as isSameDay, s as isToday };
1
+ import dayjs from "dayjs";
2
+ import isBetween from "dayjs/plugin/isBetween.js";
3
+ import isSameOrBefore from "dayjs/plugin/isSameOrBefore.js";
4
+ import weekOfYear from "dayjs/plugin/weekOfYear.js";
5
+ import { DAYS_IN_WEEK } from "./constants.js";
6
+ dayjs.extend(isBetween);
7
+ dayjs.extend(isSameOrBefore);
8
+ dayjs.extend(weekOfYear);
9
+ const DATE_RANGE_SEPARATOR = ' – ';
10
+ /**
11
+ * Get all days to display in a calendar month grid (including padding days from prev/next months)
12
+ * @param month - The month to display
13
+ * @param locale - Optional locale for week start day (e.g., 'en', 'nb', 'de')
14
+ */ export function getCalendarDays(month, locale) {
15
+ // Create a localized instance without mutating global state
16
+ const localizedMonth = locale ? month.locale(locale) : month;
17
+ const firstDayOfMonth = localizedMonth.startOf('month');
18
+ const firstDayOfGrid = firstDayOfMonth.startOf('week');
19
+ const lastDayOfMonth = localizedMonth.endOf('month');
20
+ const lastDayOfGrid = lastDayOfMonth.endOf('week');
21
+ const days = [];
22
+ let currentDay = firstDayOfGrid;
23
+ while(currentDay.isSameOrBefore(lastDayOfGrid, 'day')){
24
+ days.push(currentDay);
25
+ currentDay = currentDay.add(1, 'day');
26
+ }
27
+ return days;
28
+ }
29
+ /**
30
+ * Check if a date is within a given range (inclusive)
31
+ * Uses dayjs isBetween plugin with '[]' for inclusive start and end
32
+ * @see https://day.js.org/docs/en/plugin/is-between
33
+ */ export function isDateInRange(date, startDate, endDate) {
34
+ if (!startDate || !endDate) {
35
+ return false;
36
+ }
37
+ // Validate all dates are valid
38
+ if (!date.isValid() || !startDate.isValid() || !endDate.isValid()) {
39
+ return false;
40
+ }
41
+ // If start is after end, the range is invalid
42
+ if (startDate.isAfter(endDate, 'day')) {
43
+ return false;
44
+ }
45
+ // 'day' granularity ignores time, '[]' includes both start and end
46
+ return date.isBetween(startDate, endDate, 'day', '[]');
47
+ }
48
+ /**
49
+ * Check if a date is outside the current display month
50
+ */ export function isOutsideMonth(date, displayMonth) {
51
+ return date.month() !== displayMonth.month();
52
+ }
53
+ /**
54
+ * Check if a date is today
55
+ * Note: Uses local timezone. Both the input date and current time are compared
56
+ * using the user's local timezone, which is the expected behavior for calendar UIs.
57
+ * @param date - The date to check
58
+ * @param now - Optional current date for testing (defaults to dayjs())
59
+ */ export function isToday(date, now) {
60
+ return date.isSame(now ?? dayjs(), 'day');
61
+ }
62
+ /**
63
+ * Get an array of weekday names (short form)
64
+ * @param locale - Optional locale for localized weekday names (e.g., 'en', 'nb', 'de')
65
+ * @param baseDate - Optional base date for testing (defaults to dayjs())
66
+ */ export function getWeekdayNames(locale, baseDate) {
67
+ const base = baseDate || dayjs();
68
+ // Create a localized instance without mutating global state
69
+ const localizedDayjs = locale ? base.locale(locale) : base;
70
+ // Calculate startOfWeek using the localized instance
71
+ const startOfWeek = localizedDayjs.startOf('week');
72
+ return Array.from({
73
+ length: DAYS_IN_WEEK
74
+ }, (_, i)=>{
75
+ return startOfWeek.add(i, 'day').format('dd');
76
+ });
77
+ }
78
+ /**
79
+ * Get the week number for a given date
80
+ */ export function getWeekNumber(date) {
81
+ return date.week();
82
+ }
83
+ /**
84
+ * Get all week numbers for days in a calendar month grid
85
+ */ export function getWeekNumbers(days) {
86
+ const weekNumbers = [];
87
+ // Process days in chunks of DAYS_IN_WEEK (one week at a time)
88
+ for(let i = 0; i < days.length; i += DAYS_IN_WEEK){
89
+ const firstDayOfWeek = days[i];
90
+ if (firstDayOfWeek) {
91
+ weekNumbers.push(getWeekNumber(firstDayOfWeek));
92
+ }
93
+ }
94
+ return weekNumbers;
95
+ }
96
+ /**
97
+ * Check if two dates are the same day
98
+ */ export function isSameDay(date1, date2) {
99
+ if (!date1 || !date2) {
100
+ return false;
101
+ }
102
+ return date1.isSame(date2, 'day');
103
+ }
104
+ /**
105
+ * Format a date range for display
106
+ * When one date is missing, shows the format placeholder for the missing date
107
+ */ export function formatDateRange(startDate, endDate, format) {
108
+ if (!startDate && !endDate) {
109
+ return '';
110
+ }
111
+ const startStr = startDate?.format(format) ?? format;
112
+ const endStr = endDate?.format(format) ?? format;
113
+ return `${startStr}${DATE_RANGE_SEPARATOR}${endStr}`;
114
+ }
115
+
116
+ //# sourceMappingURL=calendar-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/calendar/calendar-utils.ts"],"sourcesContent":["import dayjs, { type Dayjs } from 'dayjs';\nimport isBetween from 'dayjs/plugin/isBetween.js';\nimport isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js';\nimport weekOfYear from 'dayjs/plugin/weekOfYear.js';\n\nimport { DAYS_IN_WEEK } from './constants';\n\ndayjs.extend(isBetween);\ndayjs.extend(isSameOrBefore);\ndayjs.extend(weekOfYear);\n\nconst DATE_RANGE_SEPARATOR = ' – ';\n\n/**\n * Get all days to display in a calendar month grid (including padding days from prev/next months)\n * @param month - The month to display\n * @param locale - Optional locale for week start day (e.g., 'en', 'nb', 'de')\n */\nexport function getCalendarDays(month: Dayjs, locale?: string): Dayjs[] {\n // Create a localized instance without mutating global state\n const localizedMonth = locale ? month.locale(locale) : month;\n\n const firstDayOfMonth = localizedMonth.startOf('month');\n const firstDayOfGrid = firstDayOfMonth.startOf('week');\n\n const lastDayOfMonth = localizedMonth.endOf('month');\n const lastDayOfGrid = lastDayOfMonth.endOf('week');\n\n const days: Dayjs[] = [];\n\n let currentDay = firstDayOfGrid;\n\n while (currentDay.isSameOrBefore(lastDayOfGrid, 'day')) {\n days.push(currentDay);\n currentDay = currentDay.add(1, 'day');\n }\n\n return days;\n}\n\n/**\n * Check if a date is within a given range (inclusive)\n * Uses dayjs isBetween plugin with '[]' for inclusive start and end\n * @see https://day.js.org/docs/en/plugin/is-between\n */\nexport function isDateInRange(\n date: Dayjs,\n startDate: Dayjs | null,\n endDate: Dayjs | null\n): boolean {\n if (!startDate || !endDate) {\n return false;\n }\n\n // Validate all dates are valid\n if (!date.isValid() || !startDate.isValid() || !endDate.isValid()) {\n return false;\n }\n\n // If start is after end, the range is invalid\n if (startDate.isAfter(endDate, 'day')) {\n return false;\n }\n\n // 'day' granularity ignores time, '[]' includes both start and end\n return date.isBetween(startDate, endDate, 'day', '[]');\n}\n\n/**\n * Check if a date is outside the current display month\n */\nexport function isOutsideMonth(date: Dayjs, displayMonth: Dayjs): boolean {\n return date.month() !== displayMonth.month();\n}\n\n/**\n * Check if a date is today\n * Note: Uses local timezone. Both the input date and current time are compared\n * using the user's local timezone, which is the expected behavior for calendar UIs.\n * @param date - The date to check\n * @param now - Optional current date for testing (defaults to dayjs())\n */\nexport function isToday(date: Dayjs, now?: Dayjs): boolean {\n return date.isSame(now ?? dayjs(), 'day');\n}\n\n/**\n * Get an array of weekday names (short form)\n * @param locale - Optional locale for localized weekday names (e.g., 'en', 'nb', 'de')\n * @param baseDate - Optional base date for testing (defaults to dayjs())\n */\nexport function getWeekdayNames(locale?: string, baseDate?: Dayjs): string[] {\n const base = baseDate || dayjs();\n\n // Create a localized instance without mutating global state\n const localizedDayjs = locale ? base.locale(locale) : base;\n\n // Calculate startOfWeek using the localized instance\n const startOfWeek = localizedDayjs.startOf('week');\n\n return Array.from({ length: DAYS_IN_WEEK }, (_, i) => {\n return startOfWeek.add(i, 'day').format('dd');\n });\n}\n\n/**\n * Get the week number for a given date\n */\nexport function getWeekNumber(date: Dayjs): number {\n return date.week();\n}\n\n/**\n * Get all week numbers for days in a calendar month grid\n */\nexport function getWeekNumbers(days: Dayjs[]): number[] {\n const weekNumbers: number[] = [];\n\n // Process days in chunks of DAYS_IN_WEEK (one week at a time)\n for (let i = 0; i < days.length; i += DAYS_IN_WEEK) {\n const firstDayOfWeek = days[i];\n if (firstDayOfWeek) {\n weekNumbers.push(getWeekNumber(firstDayOfWeek));\n }\n }\n\n return weekNumbers;\n}\n\n/**\n * Check if two dates are the same day\n */\nexport function isSameDay(date1: Dayjs | null, date2: Dayjs | null): boolean {\n if (!date1 || !date2) {\n return false;\n }\n return date1.isSame(date2, 'day');\n}\n\n/**\n * Format a date range for display\n * When one date is missing, shows the format placeholder for the missing date\n */\nexport function formatDateRange(\n startDate: Dayjs | null,\n endDate: Dayjs | null,\n format: string\n): string {\n if (!startDate && !endDate) {\n return '';\n }\n\n const startStr = startDate?.format(format) ?? format;\n const endStr = endDate?.format(format) ?? format;\n\n return `${startStr}${DATE_RANGE_SEPARATOR}${endStr}`;\n}\n"],"names":["dayjs","isBetween","isSameOrBefore","weekOfYear","DAYS_IN_WEEK","extend","DATE_RANGE_SEPARATOR","getCalendarDays","month","locale","localizedMonth","firstDayOfMonth","startOf","firstDayOfGrid","lastDayOfMonth","endOf","lastDayOfGrid","days","currentDay","push","add","isDateInRange","date","startDate","endDate","isValid","isAfter","isOutsideMonth","displayMonth","isToday","now","isSame","getWeekdayNames","baseDate","base","localizedDayjs","startOfWeek","Array","from","length","_","i","format","getWeekNumber","week","getWeekNumbers","weekNumbers","firstDayOfWeek","isSameDay","date1","date2","formatDateRange","startStr","endStr"],"mappings":"AAAA,OAAOA,WAA2B,QAAQ;AAC1C,OAAOC,eAAe,4BAA4B;AAClD,OAAOC,oBAAoB,iCAAiC;AAC5D,OAAOC,gBAAgB,6BAA6B;AAEpD,SAASC,YAAY,QAAQ,iBAAc;AAE3CJ,MAAMK,MAAM,CAACJ;AACbD,MAAMK,MAAM,CAACH;AACbF,MAAMK,MAAM,CAACF;AAEb,MAAMG,uBAAuB;AAE7B;;;;CAIC,GACD,OAAO,SAASC,gBAAgBC,KAAY,EAAEC,MAAe;IAC3D,4DAA4D;IAC5D,MAAMC,iBAAiBD,SAASD,MAAMC,MAAM,CAACA,UAAUD;IAEvD,MAAMG,kBAAkBD,eAAeE,OAAO,CAAC;IAC/C,MAAMC,iBAAiBF,gBAAgBC,OAAO,CAAC;IAE/C,MAAME,iBAAiBJ,eAAeK,KAAK,CAAC;IAC5C,MAAMC,gBAAgBF,eAAeC,KAAK,CAAC;IAE3C,MAAME,OAAgB,EAAE;IAExB,IAAIC,aAAaL;IAEjB,MAAOK,WAAWhB,cAAc,CAACc,eAAe,OAAQ;QACtDC,KAAKE,IAAI,CAACD;QACVA,aAAaA,WAAWE,GAAG,CAAC,GAAG;IACjC;IAEA,OAAOH;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASI,cACdC,IAAW,EACXC,SAAuB,EACvBC,OAAqB;IAErB,IAAI,CAACD,aAAa,CAACC,SAAS;QAC1B,OAAO;IACT;IAEA,+BAA+B;IAC/B,IAAI,CAACF,KAAKG,OAAO,MAAM,CAACF,UAAUE,OAAO,MAAM,CAACD,QAAQC,OAAO,IAAI;QACjE,OAAO;IACT;IAEA,8CAA8C;IAC9C,IAAIF,UAAUG,OAAO,CAACF,SAAS,QAAQ;QACrC,OAAO;IACT;IAEA,mEAAmE;IACnE,OAAOF,KAAKrB,SAAS,CAACsB,WAAWC,SAAS,OAAO;AACnD;AAEA;;CAEC,GACD,OAAO,SAASG,eAAeL,IAAW,EAAEM,YAAmB;IAC7D,OAAON,KAAKd,KAAK,OAAOoB,aAAapB,KAAK;AAC5C;AAEA;;;;;;CAMC,GACD,OAAO,SAASqB,QAAQP,IAAW,EAAEQ,GAAW;IAC9C,OAAOR,KAAKS,MAAM,CAACD,OAAO9B,SAAS;AACrC;AAEA;;;;CAIC,GACD,OAAO,SAASgC,gBAAgBvB,MAAe,EAAEwB,QAAgB;IAC/D,MAAMC,OAAOD,YAAYjC;IAEzB,4DAA4D;IAC5D,MAAMmC,iBAAiB1B,SAASyB,KAAKzB,MAAM,CAACA,UAAUyB;IAEtD,qDAAqD;IACrD,MAAME,cAAcD,eAAevB,OAAO,CAAC;IAE3C,OAAOyB,MAAMC,IAAI,CAAC;QAAEC,QAAQnC;IAAa,GAAG,CAACoC,GAAGC;QAC9C,OAAOL,YAAYhB,GAAG,CAACqB,GAAG,OAAOC,MAAM,CAAC;IAC1C;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,cAAcrB,IAAW;IACvC,OAAOA,KAAKsB,IAAI;AAClB;AAEA;;CAEC,GACD,OAAO,SAASC,eAAe5B,IAAa;IAC1C,MAAM6B,cAAwB,EAAE;IAEhC,8DAA8D;IAC9D,IAAK,IAAIL,IAAI,GAAGA,IAAIxB,KAAKsB,MAAM,EAAEE,KAAKrC,aAAc;QAClD,MAAM2C,iBAAiB9B,IAAI,CAACwB,EAAE;QAC9B,IAAIM,gBAAgB;YAClBD,YAAY3B,IAAI,CAACwB,cAAcI;QACjC;IACF;IAEA,OAAOD;AACT;AAEA;;CAEC,GACD,OAAO,SAASE,UAAUC,KAAmB,EAAEC,KAAmB;IAChE,IAAI,CAACD,SAAS,CAACC,OAAO;QACpB,OAAO;IACT;IACA,OAAOD,MAAMlB,MAAM,CAACmB,OAAO;AAC7B;AAEA;;;CAGC,GACD,OAAO,SAASC,gBACd5B,SAAuB,EACvBC,OAAqB,EACrBkB,MAAc;IAEd,IAAI,CAACnB,aAAa,CAACC,SAAS;QAC1B,OAAO;IACT;IAEA,MAAM4B,WAAW7B,WAAWmB,OAAOA,WAAWA;IAC9C,MAAMW,SAAS7B,SAASkB,OAAOA,WAAWA;IAE1C,OAAO,GAAGU,WAAW9C,uBAAuB+C,QAAQ;AACtD"}
@@ -1,13 +1,13 @@
1
- import { FC } from 'react';
2
- import { Dayjs } from 'dayjs';
1
+ import { type FC } from "react";
2
+ import type { Dayjs } from "dayjs";
3
3
  export interface CalendarProps {
4
- displayedMonth: Dayjs;
5
- selectedRange: [Dayjs | null, Dayjs | null];
6
- hoverDate: Dayjs | null;
7
- displayWeekNumber?: boolean;
8
- onDateClick: (date: Dayjs) => void;
9
- onMonthChange: (month: Dayjs) => void;
10
- onDateHover?: (date: Dayjs | null) => void;
11
- className?: string;
4
+ displayedMonth: Dayjs;
5
+ selectedRange: [Dayjs | null, Dayjs | null];
6
+ hoverDate: Dayjs | null;
7
+ displayWeekNumber?: boolean;
8
+ onDateClick: (date: Dayjs) => void;
9
+ onMonthChange: (month: Dayjs) => void;
10
+ onDateHover?: (date: Dayjs | null) => void;
11
+ className?: string;
12
12
  }
13
13
  export declare const Calendar: FC<CalendarProps>;