@cognite/aura 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/DESIGN.md +869 -870
  2. package/README.md +143 -9
  3. package/dist/colors.css +30 -0
  4. package/dist/components/index.d.ts +7 -36
  5. package/dist/components/index.js +319 -350
  6. package/dist/components/ui/core/accordion/accordion.d.ts +7 -7
  7. package/dist/components/ui/core/accordion/accordion.js +49 -47
  8. package/dist/components/ui/core/action-toolbar/action-toolbar.d.ts +41 -0
  9. package/dist/components/ui/core/action-toolbar/action-toolbar.js +176 -0
  10. package/dist/components/ui/core/alert/alert.d.ts +23 -12
  11. package/dist/components/ui/core/alert/alert.js +123 -120
  12. package/dist/components/ui/core/avatar/avatar.d.ts +12 -8
  13. package/dist/components/ui/core/badge/badge.d.ts +11 -8
  14. package/dist/components/ui/core/banner/banner.d.ts +18 -28
  15. package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +10 -9
  16. package/dist/components/ui/core/breadcrumb/breadcrumb.js +98 -88
  17. package/dist/components/ui/core/button/button.d.ts +8 -5
  18. package/dist/components/ui/core/button/button.js +22 -19
  19. package/dist/components/ui/core/button-group/button-group.d.ts +7 -6
  20. package/dist/components/ui/core/card/card.d.ts +17 -16
  21. package/dist/components/ui/core/chart/chart.d.ts +69 -0
  22. package/dist/components/ui/core/chart/chart.js +215 -0
  23. package/dist/components/ui/core/chart/index.d.ts +2 -0
  24. package/dist/components/ui/core/chart/index.js +8 -0
  25. package/dist/components/ui/core/checkbox/checkbox.d.ts +13 -9
  26. package/dist/components/ui/core/checkbox/checkbox.js +32 -28
  27. package/dist/components/ui/core/code-block/code-block.d.ts +6 -9
  28. package/dist/components/ui/core/code-block/code-block.js +48 -44
  29. package/dist/components/ui/core/collapsible/collapsible.d.ts +5 -3
  30. package/dist/components/ui/core/combobox/combobox.d.ts +2 -2
  31. package/dist/components/ui/core/command/command.d.ts +11 -78
  32. package/dist/components/ui/core/command/command.js +53 -52
  33. package/dist/components/ui/core/count/count.d.ts +7 -6
  34. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.d.ts +15 -0
  35. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +84 -0
  36. package/dist/components/ui/core/date-time-pickers/date-picker/index.d.ts +3 -0
  37. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +18 -0
  38. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.d.ts +3 -0
  39. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +63 -0
  40. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.d.ts +15 -0
  41. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +99 -0
  42. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.d.ts +3 -0
  43. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +25 -0
  44. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts +4 -0
  45. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +82 -0
  46. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts +17 -0
  47. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +190 -0
  48. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.d.ts +3 -0
  49. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +42 -0
  50. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.d.ts +3 -0
  51. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +161 -0
  52. package/dist/components/ui/core/date-time-pickers/index.d.ts +8 -0
  53. package/dist/components/ui/core/date-time-pickers/index.js +8 -0
  54. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +7 -0
  55. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +57 -0
  56. package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.d.ts +13 -0
  57. package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +119 -0
  58. package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.d.ts +10 -0
  59. package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +93 -0
  60. package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +20 -0
  61. package/dist/components/ui/core/date-time-pickers/shared/constants.js +14 -0
  62. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +19 -0
  63. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +99 -0
  64. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.d.ts +12 -0
  65. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +68 -0
  66. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +12 -0
  67. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +40 -0
  68. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.d.ts +29 -0
  69. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +63 -0
  70. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.d.ts +8 -0
  71. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +19 -0
  72. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.d.ts +23 -0
  73. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +32 -0
  74. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +17 -0
  75. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +34 -0
  76. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.d.ts +8 -0
  77. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +7 -0
  78. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +13 -0
  79. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +31 -0
  80. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.d.ts +10 -0
  81. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +52 -0
  82. package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.d.ts +48 -0
  83. package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +52 -0
  84. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.d.ts +26 -0
  85. package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +37 -0
  86. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.d.ts +34 -0
  87. package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +43 -0
  88. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +15 -0
  89. package/dist/components/ui/core/date-time-pickers/utils/time-validation.d.ts +23 -0
  90. package/dist/components/ui/core/dialog/dialog.d.ts +10 -10
  91. package/dist/components/ui/core/dialog/dialog.js +12 -3
  92. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +24 -47
  93. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +125 -123
  94. package/dist/components/ui/core/empty-state/empty-state.context.d.ts +10 -0
  95. package/dist/components/ui/core/empty-state/empty-state.context.js +8 -0
  96. package/dist/components/ui/core/empty-state/empty-state.d.ts +18 -0
  97. package/dist/components/ui/core/empty-state/empty-state.js +139 -0
  98. package/dist/components/ui/core/helper-text/helper-text.d.ts +7 -5
  99. package/dist/components/ui/core/hover-card/hover-card.d.ts +5 -7
  100. package/dist/components/ui/core/hover-card/hover-card.js +23 -22
  101. package/dist/components/ui/core/inline-citation/inline-citation.d.ts +10 -10
  102. package/dist/components/ui/core/inline-citation/inline-citation.js +57 -49
  103. package/dist/components/ui/core/input/input.d.ts +2 -1
  104. package/dist/components/ui/core/input/input.js +1 -1
  105. package/dist/components/ui/core/input-group/input-group.d.ts +17 -13
  106. package/dist/components/ui/core/input-group/input-group.js +35 -36
  107. package/dist/components/ui/core/kbd/kbd.d.ts +3 -2
  108. package/dist/components/ui/core/label/label.d.ts +3 -2
  109. package/dist/components/ui/core/loader/loader.d.ts +2 -2
  110. package/dist/components/ui/core/message/message.d.ts +18 -17
  111. package/dist/components/ui/core/message/message.js +387 -99
  112. package/dist/components/ui/core/pagination/pagination-size-context.d.ts +5 -0
  113. package/dist/components/ui/core/pagination/pagination-size-context.js +6 -0
  114. package/dist/components/ui/core/pagination/pagination-teleport.d.ts +11 -0
  115. package/dist/components/ui/core/pagination/pagination-teleport.js +108 -0
  116. package/dist/components/ui/core/pagination/pagination-teleport.utils.d.ts +1 -0
  117. package/dist/components/ui/core/pagination/pagination-teleport.utils.js +7 -0
  118. package/dist/components/ui/core/pagination/pagination.d.ts +41 -0
  119. package/dist/components/ui/core/pagination/pagination.js +337 -0
  120. package/dist/components/ui/core/popover/popover.d.ts +12 -16
  121. package/dist/components/ui/core/popover/popover.js +52 -51
  122. package/dist/components/ui/core/progress/progress.d.ts +7 -4
  123. package/dist/components/ui/core/prompt-input/prompt-input.d.ts +36 -103
  124. package/dist/components/ui/core/prompt-input/prompt-input.js +180 -167
  125. package/dist/components/ui/core/radio-group/radio-group.d.ts +12 -8
  126. package/dist/components/ui/core/radio-group/radio-group.js +56 -53
  127. package/dist/components/ui/core/reasoning/reasoning.d.ts +5 -5
  128. package/dist/components/ui/core/scroll-area/scroll-area.d.ts +4 -2
  129. package/dist/components/ui/core/search/search.d.ts +10 -0
  130. package/dist/components/ui/core/search/search.js +99 -0
  131. package/dist/components/ui/core/segmented-control/segmented-control.d.ts +15 -11
  132. package/dist/components/ui/core/segmented-control/segmented-control.js +4 -1
  133. package/dist/components/ui/core/select/select.d.ts +15 -14
  134. package/dist/components/ui/core/select/select.js +135 -108
  135. package/dist/components/ui/core/separator/separator.d.ts +2 -4
  136. package/dist/components/ui/core/separator/separator.js +4 -5
  137. package/dist/components/ui/core/shimmer/shimmer.d.ts +5 -5
  138. package/dist/components/ui/core/shimmer/shimmer.js +91 -52
  139. package/dist/components/ui/core/skeleton/skeleton.d.ts +2 -1
  140. package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +2 -1
  141. package/dist/components/ui/core/sources/sources.d.ts +3 -3
  142. package/dist/components/ui/core/sources/sources.js +6 -1
  143. package/dist/components/ui/core/switch/switch.d.ts +11 -0
  144. package/dist/components/ui/core/{button/button.metadata.d.ts → switch/switch.metadata.d.ts} +1 -1
  145. package/dist/components/ui/core/tabs/tabs.d.ts +21 -17
  146. package/dist/components/ui/core/tabs/tabs.js +11 -9
  147. package/dist/components/ui/core/textarea/textarea.d.ts +2 -1
  148. package/dist/components/ui/core/textarea/textarea.js +20 -18
  149. package/dist/components/ui/core/toggle/toggle.d.ts +15 -0
  150. package/dist/components/ui/core/toggle/toggle.js +74 -0
  151. package/dist/components/ui/core/tool/tool.d.ts +7 -6
  152. package/dist/components/ui/core/tool/tool.js +47 -43
  153. package/dist/components/ui/core/tooltip/tooltip.d.ts +6 -5
  154. package/dist/components/ui/core/tooltip/tooltip.js +10 -8
  155. package/dist/components/ui/core/topbar/topbar.d.ts +11 -13
  156. package/dist/eslint/index.d.ts +2 -1
  157. package/dist/index.d.ts +1 -1
  158. package/dist/lib/portal-container-context.d.ts +2 -1
  159. package/dist/lib/portal-container-context.js +3 -5
  160. package/dist/lib/utils.d.ts +1 -1
  161. package/dist/lib/utils.js +7 -7
  162. package/dist/styles.css +1 -1
  163. package/dist/styles.source.css +12 -1
  164. package/package.json +217 -14
  165. package/dist/components/ui/core/accordion/accordion.metadata.d.ts +0 -2
  166. package/dist/components/ui/core/accordion/accordion.metadata.js +0 -9
  167. package/dist/components/ui/core/alert/alert.metadata.d.ts +0 -2
  168. package/dist/components/ui/core/alert/alert.metadata.js +0 -9
  169. package/dist/components/ui/core/avatar/avatar.metadata.d.ts +0 -8
  170. package/dist/components/ui/core/avatar/avatar.metadata.js +0 -9
  171. package/dist/components/ui/core/badge/badge.metadata.d.ts +0 -2
  172. package/dist/components/ui/core/badge/badge.metadata.js +0 -8
  173. package/dist/components/ui/core/banner/banner.metadata.d.ts +0 -2
  174. package/dist/components/ui/core/banner/banner.metadata.js +0 -9
  175. package/dist/components/ui/core/breadcrumb/breadcrumb.metadata.d.ts +0 -2
  176. package/dist/components/ui/core/breadcrumb/breadcrumb.metadata.js +0 -9
  177. package/dist/components/ui/core/button/button.metadata.js +0 -9
  178. package/dist/components/ui/core/button-group/button-group.metadata.d.ts +0 -2
  179. package/dist/components/ui/core/button-group/button-group.metadata.js +0 -8
  180. package/dist/components/ui/core/card/card.metadata.d.ts +0 -8
  181. package/dist/components/ui/core/card/card.metadata.js +0 -9
  182. package/dist/components/ui/core/code-block/code-block.metadata.d.ts +0 -2
  183. package/dist/components/ui/core/code-block/code-block.metadata.js +0 -8
  184. package/dist/components/ui/core/collapsible/collapsible.metadata.d.ts +0 -2
  185. package/dist/components/ui/core/collapsible/collapsible.metadata.js +0 -9
  186. package/dist/components/ui/core/combobox/combobox.metadata.d.ts +0 -2
  187. package/dist/components/ui/core/command/command.metadata.d.ts +0 -2
  188. package/dist/components/ui/core/command/command.metadata.js +0 -9
  189. package/dist/components/ui/core/dialog/dialog.metadata.d.ts +0 -2
  190. package/dist/components/ui/core/dialog/dialog.metadata.js +0 -9
  191. package/dist/components/ui/core/dropdown-menu/dropdown-menu.metadata.d.ts +0 -2
  192. package/dist/components/ui/core/dropdown-menu/dropdown-menu.metadata.js +0 -9
  193. package/dist/components/ui/core/helper-text/helper-text.metadata.d.ts +0 -2
  194. package/dist/components/ui/core/helper-text/helper-text.metadata.js +0 -9
  195. package/dist/components/ui/core/hover-card/hover-card.metadata.d.ts +0 -2
  196. package/dist/components/ui/core/hover-card/hover-card.metadata.js +0 -8
  197. package/dist/components/ui/core/inline-citation/inline-citation.metadata.d.ts +0 -2
  198. package/dist/components/ui/core/inline-citation/inline-citation.metadata.js +0 -8
  199. package/dist/components/ui/core/input/input.metadata.d.ts +0 -2
  200. package/dist/components/ui/core/input/input.metadata.js +0 -9
  201. package/dist/components/ui/core/input-group/input-group.metadata.d.ts +0 -2
  202. package/dist/components/ui/core/input-group/input-group.metadata.js +0 -9
  203. package/dist/components/ui/core/kbd/kbd.metadata.d.ts +0 -2
  204. package/dist/components/ui/core/kbd/kbd.metadata.js +0 -9
  205. package/dist/components/ui/core/label/label.metadata.d.ts +0 -2
  206. package/dist/components/ui/core/label/label.metadata.js +0 -9
  207. package/dist/components/ui/core/loader/loader.metadata.d.ts +0 -2
  208. package/dist/components/ui/core/loader/loader.metadata.js +0 -9
  209. package/dist/components/ui/core/message/message.metadata.d.ts +0 -2
  210. package/dist/components/ui/core/popover/popover.metadata.d.ts +0 -2
  211. package/dist/components/ui/core/popover/popover.metadata.js +0 -9
  212. package/dist/components/ui/core/progress/progress.metadata.d.ts +0 -2
  213. package/dist/components/ui/core/progress/progress.metadata.js +0 -9
  214. package/dist/components/ui/core/prompt-input/prompt-input.metadata.d.ts +0 -2
  215. package/dist/components/ui/core/prompt-input/prompt-input.metadata.js +0 -9
  216. package/dist/components/ui/core/radio-group/radio-group.metadata.d.ts +0 -2
  217. package/dist/components/ui/core/radio-group/radio-group.metadata.js +0 -9
  218. package/dist/components/ui/core/reasoning/reasoning.metadata.d.ts +0 -2
  219. package/dist/components/ui/core/reasoning/reasoning.metadata.js +0 -8
  220. package/dist/components/ui/core/scroll-area/scroll-area.metadata.d.ts +0 -2
  221. package/dist/components/ui/core/scroll-area/scroll-area.metadata.js +0 -9
  222. package/dist/components/ui/core/select/select.metadata.d.ts +0 -2
  223. package/dist/components/ui/core/select/select.metadata.js +0 -9
  224. package/dist/components/ui/core/separator/separator.metadata.d.ts +0 -2
  225. package/dist/components/ui/core/separator/separator.metadata.js +0 -8
  226. package/dist/components/ui/core/shimmer/shimmer.metadata.d.ts +0 -2
  227. package/dist/components/ui/core/shimmer/shimmer.metadata.js +0 -9
  228. package/dist/components/ui/core/skeleton/skeleton.metadata.d.ts +0 -2
  229. package/dist/components/ui/core/skeleton/skeleton.metadata.js +0 -9
  230. package/dist/components/ui/core/sonner-toast/sonner-toast.metadata.d.ts +0 -2
  231. package/dist/components/ui/core/sonner-toast/sonner-toast.metadata.js +0 -9
  232. package/dist/components/ui/core/sources/sources.metadata.d.ts +0 -2
  233. package/dist/components/ui/core/textarea/textarea.metadata.d.ts +0 -2
  234. package/dist/components/ui/core/textarea/textarea.metadata.js +0 -9
  235. package/dist/components/ui/core/tool/tool.metadata.d.ts +0 -2
  236. package/dist/components/ui/core/tool/tool.metadata.js +0 -8
  237. package/dist/components/ui/core/tooltip/tooltip.metadata.d.ts +0 -8
  238. package/dist/components/ui/core/tooltip/tooltip.metadata.js +0 -9
  239. package/dist/index.js +0 -342
@@ -0,0 +1,161 @@
1
+ import { useRef as U, useCallback as n, useEffect as F } from "react";
2
+ import le from "dayjs";
3
+ import { DEFAULT_MINUTE as g, START_OF_DAY_HOUR as A, END_OF_DAY_MINUTE as T, END_OF_DAY_HOUR as D } from "../shared/constants.js";
4
+ import { usePopoverState as pe } from "../shared/hooks/use-popover-state.js";
5
+ import { useRangeDateState as fe } from "../shared/hooks/use-range-date-state.js";
6
+ import { useRangeStepManager as Se } from "../shared/hooks/use-range-step-manager.js";
7
+ import { useTimeState as I } from "../shared/hooks/use-time-state.js";
8
+ function ge(t) {
9
+ return t.hour(A).minute(g);
10
+ }
11
+ function Ae(t) {
12
+ return t.hour(D).minute(T);
13
+ }
14
+ const Re = ({
15
+ value: t,
16
+ onChange: r,
17
+ timeFormat: M = "24h",
18
+ defaultDate: Y = le()
19
+ }) => {
20
+ const C = U(() => {
21
+ }), E = U(() => {
22
+ }), {
23
+ isOpen: h,
24
+ setIsOpen: o,
25
+ popoverRef: w,
26
+ inputRef: x,
27
+ handleTogglePopover: H
28
+ } = pe({
29
+ onClose: n(() => C.current(), []),
30
+ onBackspace: n(() => E.current(), [])
31
+ }), b = Se(), { step: m, handleNext: d, handleBack: a, resetStep: P } = b, j = fe({
32
+ value: t,
33
+ defaultDate: Y,
34
+ mapDate: (e, i) => i === "start" ? ge(e) : Ae(e)
35
+ }), {
36
+ tempStart: L,
37
+ tempEnd: q,
38
+ displayedMonth: z,
39
+ hoverDate: G,
40
+ stateRef: u,
41
+ handleDateClick: R,
42
+ handleDateHover: J,
43
+ handleMonthChange: K,
44
+ clearActiveSegment: k,
45
+ resetDates: c
46
+ } = j, Q = I({
47
+ initialHour: t[0]?.hour() ?? A,
48
+ initialMinute: t[0]?.minute() ?? g,
49
+ timeFormat: M
50
+ }), {
51
+ hour: W,
52
+ minute: l,
53
+ amPm: X,
54
+ hour24: O,
55
+ handleHourChange: Z,
56
+ handleMinuteChange: $,
57
+ handleAmPmChange: v,
58
+ resetTime: _
59
+ } = Q, V = I({
60
+ initialHour: t[1]?.hour() ?? D,
61
+ initialMinute: t[1]?.minute() ?? T,
62
+ timeFormat: M
63
+ }), {
64
+ hour: ee,
65
+ minute: p,
66
+ amPm: te,
67
+ hour24: y,
68
+ handleHourChange: ne,
69
+ handleMinuteChange: re,
70
+ handleAmPmChange: oe,
71
+ resetTime: B
72
+ } = V, s = n(() => {
73
+ c(t), P(), _(
74
+ t[0]?.hour() ?? A,
75
+ t[0]?.minute() ?? g
76
+ ), B(
77
+ t[1]?.hour() ?? D,
78
+ t[1]?.minute() ?? T
79
+ );
80
+ }, [t, c, P, _, B]), N = n(() => {
81
+ const e = k(m);
82
+ e === null ? a() : e[0] === null && e[1] === null && r(e);
83
+ }, [k, m, a, r]);
84
+ F(() => {
85
+ C.current = s;
86
+ }, [s]), F(() => {
87
+ E.current = N;
88
+ }, [N]);
89
+ const ae = n(() => {
90
+ h || s(), H();
91
+ }, [h, H, s]), se = n(
92
+ (e) => {
93
+ e === "start" ? a() : d();
94
+ },
95
+ [a, d]
96
+ ), ie = n(
97
+ (e) => {
98
+ R(e, m);
99
+ },
100
+ [R, m]
101
+ ), me = n(() => {
102
+ const { tempStart: e, tempEnd: i } = u.current;
103
+ if (e && i) {
104
+ const f = e.hour(O).minute(l).startOf("minute"), S = i.hour(y).minute(p).endOf("minute"), de = f.isAfter(S) ? [S, f] : [f, S];
105
+ r(de), o(!1);
106
+ }
107
+ }, [
108
+ u,
109
+ O,
110
+ l,
111
+ y,
112
+ p,
113
+ r,
114
+ o
115
+ ]), ue = n(() => {
116
+ s(), o(!1);
117
+ }, [s, o]), ce = n(() => {
118
+ a(), c([u.current.tempStart, null]);
119
+ }, [a, c, u]), he = n(
120
+ (e) => {
121
+ const i = Array.isArray(e) ? e : [e, e];
122
+ r(i), o(!1);
123
+ },
124
+ [r, o]
125
+ );
126
+ return {
127
+ isOpen: h,
128
+ step: m,
129
+ displayedMonth: z,
130
+ tempStart: L,
131
+ tempEnd: q,
132
+ hoverDate: G,
133
+ tempStartHour: W,
134
+ tempStartMinute: l,
135
+ tempEndHour: ee,
136
+ tempEndMinute: p,
137
+ startAmPm: X,
138
+ endAmPm: te,
139
+ handleTogglePopover: ae,
140
+ handleSetStep: se,
141
+ handleDateClick: ie,
142
+ handleMonthChange: K,
143
+ handleDateHover: J,
144
+ handleStartHourChange: Z,
145
+ handleStartMinuteChange: $,
146
+ handleEndHourChange: ne,
147
+ handleEndMinuteChange: re,
148
+ handleStartAmPmChange: v,
149
+ handleEndAmPmChange: oe,
150
+ handleNext: d,
151
+ handleApply: me,
152
+ handleCancel: ue,
153
+ handleBack: ce,
154
+ handleApplyShortcut: he,
155
+ popoverRef: w,
156
+ inputRef: x
157
+ };
158
+ };
159
+ export {
160
+ Re as useDateTimeRangePicker
161
+ };
@@ -0,0 +1,8 @@
1
+ export { DatePicker } from './date-picker';
2
+ export type { DatePickerProps } from './date-picker';
3
+ export { DateRangePicker } from './date-range-picker';
4
+ export type { DateRangePickerProps } from './date-range-picker';
5
+ export { DateTimeRangePicker } from './date-time-range-picker';
6
+ export type { DateTimeRangePickerProps } from './date-time-range-picker';
7
+ export type { ShortcutItem } from './date-time-range-picker';
8
+ export type { TimeFormat } from './utils/format-utils';
@@ -0,0 +1,8 @@
1
+ import { DatePicker as o } from "./date-picker/date-picker.js";
2
+ import { DateRangePicker as a } from "./date-range-picker/date-range-picker.js";
3
+ import { DateTimeRangePicker as m } from "./date-time-range-picker/date-time-range-picker.js";
4
+ export {
5
+ o as DatePicker,
6
+ a as DateRangePicker,
7
+ m as DateTimeRangePicker
8
+ };
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ export type AmPmScrollProps = {
3
+ value: 'AM' | 'PM' | null;
4
+ onChange: (value: 'AM' | 'PM') => void;
5
+ className?: string;
6
+ };
7
+ export declare const AmPmScroll: FC<AmPmScrollProps>;
@@ -0,0 +1,57 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useRef as s, useEffect as L } from "react";
3
+ import { cn as l } from "../../../../../../lib/utils.js";
4
+ import { SCROLL_ITEM_SELECTED_CLASSES as _, SCROLL_ITEM_UNSELECTED_CLASSES as C, SCROLL_ITEM_BASE_CLASSES as a, SCROLL_CONTAINER_CLASSES as d } from "../scroll-cell-classes.js";
5
+ const A = ["AM", "PM"], p = ({
6
+ value: e,
7
+ onChange: c,
8
+ className: S
9
+ }) => {
10
+ const r = s(null), n = s(null);
11
+ L(() => {
12
+ if (e !== null && n.current && r.current) {
13
+ const o = r.current, t = n.current;
14
+ o.scrollTo({
15
+ top: t.offsetTop - o.offsetHeight / 2 + t.offsetHeight / 2,
16
+ behavior: "smooth"
17
+ });
18
+ }
19
+ }, [e]);
20
+ const f = (o, t) => {
21
+ (o.key === "Enter" || o.key === " ") && (o.preventDefault(), c(t));
22
+ };
23
+ return /* @__PURE__ */ i(
24
+ "div",
25
+ {
26
+ "data-slot": "am-pm-scroll",
27
+ ref: r,
28
+ role: "listbox",
29
+ "aria-label": "AM/PM",
30
+ "aria-orientation": "vertical",
31
+ className: l(d, S),
32
+ children: A.map((o) => {
33
+ const t = e !== null && o === e;
34
+ return /* @__PURE__ */ i(
35
+ "div",
36
+ {
37
+ ref: t ? n : void 0,
38
+ tabIndex: 0,
39
+ className: l(
40
+ a,
41
+ t ? _ : C
42
+ ),
43
+ onClick: () => c(o),
44
+ onKeyDown: (E) => f(E, o),
45
+ role: "option",
46
+ "aria-selected": t,
47
+ children: o
48
+ },
49
+ o
50
+ );
51
+ })
52
+ }
53
+ );
54
+ };
55
+ export {
56
+ p as AmPmScroll
57
+ };
@@ -0,0 +1,13 @@
1
+ import { FC } from 'react';
2
+ import { Dayjs } from 'dayjs';
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;
12
+ }
13
+ export declare const Calendar: FC<CalendarProps>;
@@ -0,0 +1,119 @@
1
+ import { jsxs as x, jsx as l } from "react/jsx-runtime";
2
+ import C from "react";
3
+ import { cn as b } from "../../../../../../lib/utils.js";
4
+ import { getCalendarDays as _, getWeekdayNames as E, getWeekNumbers as O, isDateInRange as v, isSameDay as f, isToday as T, isOutsideMonth as B } from "../../utils/calendar-utils.js";
5
+ import { CalendarHeader as K } from "../calendar-header/calendar-header.js";
6
+ import { DAYS_IN_WEEK as p } from "../constants.js";
7
+ function P({
8
+ isOutsideMonth: r,
9
+ isSelected: t,
10
+ isToday: s,
11
+ isRangeStart: o,
12
+ isRangeEnd: c,
13
+ isInRange: a,
14
+ isInHoverRange: i
15
+ }) {
16
+ return b(
17
+ "w-9 h-9 flex items-center justify-center text-sm font-medium cursor-pointer select-none relative transition-colors",
18
+ "focus-visible:ring-2 focus-visible:ring-border focus-visible:outline-none",
19
+ // border-radius for range endpoints
20
+ o && c && "rounded-lg",
21
+ o && !c && "rounded-l-lg",
22
+ c && !o && "rounded-r-lg",
23
+ // selected day
24
+ t && "bg-primary-background text-foreground-on-primary hover:bg-primary-background",
25
+ // unselected text
26
+ !t && r && "text-muted-foreground/50",
27
+ !t && !r && (a || i) ? "text-foreground" : !t && !r && "text-secondary-foreground",
28
+ // range highlight
29
+ !t && (a || i) && "bg-accent-background",
30
+ !t && "hover:bg-accent-background hover:rounded-lg hover:text-foreground",
31
+ // today outline
32
+ s && !t && "border border-border rounded-lg"
33
+ );
34
+ }
35
+ const W = ({
36
+ displayedMonth: r,
37
+ selectedRange: t,
38
+ hoverDate: s,
39
+ displayWeekNumber: o = !1,
40
+ onDateClick: c,
41
+ onMonthChange: a,
42
+ onDateHover: i,
43
+ className: N
44
+ }) => {
45
+ const [n, m] = t, h = _(r), M = E(), k = o ? O(h) : [], Y = () => {
46
+ a(r.subtract(1, "month"));
47
+ }, D = () => {
48
+ a(r.add(1, "month"));
49
+ }, w = (e) => {
50
+ const d = {
51
+ isOutsideMonth: B(e, r),
52
+ isToday: T(e),
53
+ isSelected: f(e, n) || f(e, m),
54
+ isRangeStart: f(e, n),
55
+ isRangeEnd: f(e, m),
56
+ isInRange: v(e, n, m),
57
+ isInHoverRange: !1
58
+ };
59
+ if (s && n && !m) {
60
+ const u = n.isBefore(s) ? n : s, g = n.isBefore(s) ? s : n;
61
+ d.isInHoverRange = v(e, u, g);
62
+ }
63
+ return d;
64
+ };
65
+ return /* @__PURE__ */ x("div", { "data-slot": "calendar", className: b("flex flex-col gap-4", N), children: [
66
+ /* @__PURE__ */ l(
67
+ K,
68
+ {
69
+ displayedMonth: r,
70
+ onPrevMonth: Y,
71
+ onNextMonth: D,
72
+ onMonthChange: a
73
+ }
74
+ ),
75
+ /* @__PURE__ */ x(
76
+ "div",
77
+ {
78
+ className: b(
79
+ "grid gap-0",
80
+ o ? "grid-cols-calendar-weeks" : "grid-cols-calendar"
81
+ ),
82
+ children: [
83
+ o && /* @__PURE__ */ l("div", { className: "text-xs font-semibold text-muted-foreground text-center py-2 px-1", children: "#" }),
84
+ M.map((e) => /* @__PURE__ */ l(
85
+ "div",
86
+ {
87
+ className: "text-xs font-medium text-muted-foreground text-center py-2 px-1 tracking-tighter",
88
+ children: e
89
+ },
90
+ e
91
+ )),
92
+ h.map((e, d) => {
93
+ const u = w(e), g = Math.floor(d / p), I = o && d % p === 0, j = `day-${e.format("YYYY-MM-DD")}`;
94
+ return /* @__PURE__ */ x(C.Fragment, { children: [
95
+ I && /* @__PURE__ */ l("div", { className: "text-xs text-muted-foreground text-center flex items-center justify-center h-9", children: k[g] }),
96
+ /* @__PURE__ */ l(
97
+ "div",
98
+ {
99
+ className: P(u),
100
+ onClick: () => c(e),
101
+ onMouseEnter: () => i?.(e),
102
+ onMouseLeave: () => i?.(null),
103
+ role: "gridcell",
104
+ tabIndex: 0,
105
+ "aria-label": e.format("DD MMMM YYYY"),
106
+ "aria-selected": u.isSelected,
107
+ children: e.date()
108
+ }
109
+ )
110
+ ] }, j);
111
+ })
112
+ ]
113
+ }
114
+ )
115
+ ] });
116
+ };
117
+ export {
118
+ W as Calendar
119
+ };
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ import { Dayjs } from 'dayjs';
3
+ export interface CalendarHeaderProps {
4
+ displayedMonth: Dayjs;
5
+ onPrevMonth: () => void;
6
+ onNextMonth: () => void;
7
+ onMonthChange: (month: Dayjs) => void;
8
+ className?: string;
9
+ }
10
+ export declare const CalendarHeader: FC<CalendarHeaderProps>;
@@ -0,0 +1,93 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { IconChevronLeft as h, IconChevronRight as u, IconChevronDown as p } from "@tabler/icons-react";
3
+ import i from "dayjs";
4
+ import { cn as N } from "../../../../../../lib/utils.js";
5
+ import { Button as l } from "../../../button/button.js";
6
+ import { DropdownMenu as g, DropdownMenuTrigger as v, DropdownMenuContent as x, DropdownMenuItem as w } from "../../../dropdown-menu/dropdown-menu.js";
7
+ const M = Array.from(
8
+ { length: 12 },
9
+ (r, a) => i().month(a).format("MMMM")
10
+ ), c = i().year() - 50, b = i().year() + 10, z = Array.from(
11
+ { length: b - c + 1 },
12
+ (r, a) => c + a
13
+ ), d = ({
14
+ label: r,
15
+ items: a,
16
+ onSelect: s
17
+ }) => /* @__PURE__ */ t(g, { modal: !1, children: [
18
+ /* @__PURE__ */ e(
19
+ v,
20
+ {
21
+ render: /* @__PURE__ */ t(
22
+ l,
23
+ {
24
+ variant: "ghost",
25
+ size: "sm",
26
+ className: "h-7 px-2 gap-1 text-sm font-medium text-secondary-foreground",
27
+ children: [
28
+ r,
29
+ /* @__PURE__ */ e(p, { className: "size-4" })
30
+ ]
31
+ }
32
+ )
33
+ }
34
+ ),
35
+ /* @__PURE__ */ e(x, { className: "max-h-60 overflow-y-auto", children: a.map(({ value: n, label: m }) => /* @__PURE__ */ e(w, { onClick: () => s(n), children: m }, n)) })
36
+ ] }), E = ({
37
+ displayedMonth: r,
38
+ onPrevMonth: a,
39
+ onNextMonth: s,
40
+ onMonthChange: n,
41
+ className: m
42
+ }) => /* @__PURE__ */ t(
43
+ "div",
44
+ {
45
+ "data-slot": "calendar-header",
46
+ className: N("flex items-center justify-between pt-1 w-full", m),
47
+ children: [
48
+ /* @__PURE__ */ e(
49
+ l,
50
+ {
51
+ variant: "ghost",
52
+ size: "icon-sm",
53
+ className: "size-7 rounded-md text-secondary-foreground",
54
+ onClick: a,
55
+ "aria-label": "Previous month",
56
+ children: /* @__PURE__ */ e(h, { className: "size-4" })
57
+ }
58
+ ),
59
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-0.5", children: [
60
+ /* @__PURE__ */ e(
61
+ d,
62
+ {
63
+ label: r.format("MMMM"),
64
+ items: M.map((o, f) => ({ value: f, label: o })),
65
+ onSelect: (o) => n(r.date(1).month(o))
66
+ }
67
+ ),
68
+ /* @__PURE__ */ e(
69
+ d,
70
+ {
71
+ label: r.format("YYYY"),
72
+ items: z.map((o) => ({ value: o, label: String(o) })),
73
+ onSelect: (o) => n(r.date(1).year(o))
74
+ }
75
+ )
76
+ ] }),
77
+ /* @__PURE__ */ e(
78
+ l,
79
+ {
80
+ variant: "ghost",
81
+ size: "icon-sm",
82
+ className: "size-7 rounded-md text-secondary-foreground",
83
+ onClick: s,
84
+ "aria-label": "Next month",
85
+ children: /* @__PURE__ */ e(u, { className: "size-4" })
86
+ }
87
+ )
88
+ ]
89
+ }
90
+ );
91
+ export {
92
+ E as CalendarHeader
93
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Shared numeric constants for date/time picker components.
3
+ * Colors and typography are applied via Tailwind utility classes — no CSS
4
+ * variable strings are exported from here.
5
+ */
6
+ export declare const HOURS_IN_DAY = 24;
7
+ export declare const HOURS_IN_12H = 12;
8
+ export declare const MINUTES_IN_HOUR = 60;
9
+ export declare const MINUTE_INCREMENT = 1;
10
+ export declare const DAYS_IN_WEEK = 7;
11
+ export declare const DEFAULT_START_HOUR = 9;
12
+ export declare const DEFAULT_END_HOUR = 17;
13
+ export declare const DEFAULT_MINUTE = 0;
14
+ export declare const START_OF_DAY_HOUR = 0;
15
+ export declare const END_OF_DAY_HOUR = 23;
16
+ export declare const END_OF_DAY_MINUTE = 59;
17
+ export declare const DEFAULT_START_AMPM: 'AM' | 'PM';
18
+ export declare const DEFAULT_END_AMPM: 'AM' | 'PM';
19
+ export declare const NOON_HOUR = 12;
20
+ export declare const MIDNIGHT_HOUR = 0;
@@ -0,0 +1,14 @@
1
+ const _ = 24, N = 12, U = 60, o = 1, t = 7, E = 9, T = 0, c = 0, n = 23, s = 59, I = 0;
2
+ export {
3
+ t as DAYS_IN_WEEK,
4
+ T as DEFAULT_MINUTE,
5
+ E as DEFAULT_START_HOUR,
6
+ n as END_OF_DAY_HOUR,
7
+ s as END_OF_DAY_MINUTE,
8
+ N as HOURS_IN_12H,
9
+ _ as HOURS_IN_DAY,
10
+ I as MIDNIGHT_HOUR,
11
+ U as MINUTES_IN_HOUR,
12
+ o as MINUTE_INCREMENT,
13
+ c as START_OF_DAY_HOUR
14
+ };
@@ -0,0 +1,19 @@
1
+ import { FC } from 'react';
2
+ import { Dayjs } from 'dayjs';
3
+ export declare const DEFAULT_ARIA_LABEL = "Date picker";
4
+ export type DateTimeInputVariant = 'date' | 'time' | 'datetime';
5
+ export type RangePart = 'start' | 'end';
6
+ export interface DateTimeInputProps {
7
+ value: [Dayjs | null, Dayjs | null] | Dayjs | null;
8
+ format: string;
9
+ placeholder?: string;
10
+ onClick: () => void;
11
+ isOpen: boolean;
12
+ className?: string;
13
+ ariaLabel?: string;
14
+ variant?: DateTimeInputVariant;
15
+ activeRangePart?: RangePart;
16
+ onRangePartClick?: (part: RangePart) => void;
17
+ popoverId?: string;
18
+ }
19
+ export declare const DateTimeInput: FC<DateTimeInputProps>;
@@ -0,0 +1,99 @@
1
+ import { jsxs as u, jsx as r } from "react/jsx-runtime";
2
+ import { IconCalendarClock as A, IconClock as I, IconCalendar as y } from "@tabler/icons-react";
3
+ import { cn as a } from "../../../../../../lib/utils.js";
4
+ import { Input as D } from "../../../input/input.js";
5
+ import { RangeInputDisplay as R } from "./range-input-display.js";
6
+ const v = "Date picker", C = () => {
7
+ }, p = {
8
+ date: /* @__PURE__ */ r(y, { "aria-label": "date-icon", className: "size-4" }),
9
+ time: /* @__PURE__ */ r(I, { "aria-label": "time-icon", className: "size-4" }),
10
+ datetime: /* @__PURE__ */ r(A, { "aria-label": "datetime-icon", className: "size-4" })
11
+ }, g = (e, o) => a(
12
+ "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",
13
+ "flex items-center justify-center",
14
+ "transition-colors duration-150",
15
+ o || e ? "text-foreground" : "text-muted-foreground",
16
+ "group-hover:text-foreground"
17
+ ), _ = ({
18
+ value: e,
19
+ format: o,
20
+ placeholder: b,
21
+ onClick: n,
22
+ isOpen: t,
23
+ className: i,
24
+ ariaLabel: l = v,
25
+ variant: s = "date",
26
+ activeRangePart: f,
27
+ onRangePartClick: x,
28
+ popoverId: c
29
+ }) => {
30
+ if (Array.isArray(e)) {
31
+ const N = e[0] !== null || e[1] !== null;
32
+ return /* @__PURE__ */ u(
33
+ "div",
34
+ {
35
+ "data-slot": "date-time-input",
36
+ className: a(
37
+ "relative flex items-center cursor-pointer w-full group",
38
+ i
39
+ ),
40
+ onClick: n,
41
+ role: "combobox",
42
+ "aria-label": l,
43
+ "aria-expanded": t,
44
+ "aria-controls": c,
45
+ children: [
46
+ /* @__PURE__ */ r(
47
+ R,
48
+ {
49
+ startDate: e[0],
50
+ endDate: e[1],
51
+ format: o,
52
+ activeRangePart: f,
53
+ onRangePartClick: x,
54
+ isOpen: t
55
+ }
56
+ ),
57
+ /* @__PURE__ */ r("div", { className: g(t, N), children: p[s] })
58
+ ]
59
+ }
60
+ );
61
+ }
62
+ const d = e?.format(o) ?? "", m = d.length > 0, h = b ?? o;
63
+ return /* @__PURE__ */ u(
64
+ "div",
65
+ {
66
+ "data-slot": "date-time-input",
67
+ className: a(
68
+ "relative flex items-center cursor-pointer w-full group",
69
+ i
70
+ ),
71
+ onClick: n,
72
+ children: [
73
+ /* @__PURE__ */ r(
74
+ D,
75
+ {
76
+ value: d,
77
+ placeholder: h,
78
+ onChange: C,
79
+ "aria-label": l,
80
+ "aria-expanded": t,
81
+ "aria-controls": c,
82
+ role: "combobox",
83
+ className: a(
84
+ "border-transparent bg-muted-background cursor-pointer caret-transparent pr-9",
85
+ m ? "text-foreground" : "text-muted-foreground",
86
+ "hover:border-border-emphasized",
87
+ t && "!bg-background !text-foreground !border-border"
88
+ )
89
+ }
90
+ ),
91
+ /* @__PURE__ */ r("div", { className: g(t, m), children: p[s] })
92
+ ]
93
+ }
94
+ );
95
+ };
96
+ export {
97
+ v as DEFAULT_ARIA_LABEL,
98
+ _ as DateTimeInput
99
+ };
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import { Dayjs } from 'dayjs';
3
+ import { RangePart } from './date-time-input';
4
+ export interface RangeInputDisplayProps {
5
+ startDate: Dayjs | null;
6
+ endDate: Dayjs | null;
7
+ format: string;
8
+ activeRangePart?: RangePart;
9
+ onRangePartClick?: (part: RangePart) => void;
10
+ isOpen?: boolean;
11
+ }
12
+ export declare const RangeInputDisplay: FC<RangeInputDisplayProps>;