@cognite/aura 0.1.7 → 0.3.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 (232) hide show
  1. package/DESIGN.md +34 -92
  2. package/README.md +33 -0
  3. package/dist/colors.css +471 -214
  4. package/dist/components/index.d.ts +17 -33
  5. package/dist/components/index.js +315 -281
  6. package/dist/components/ui/core/accordion/accordion.d.ts +7 -7
  7. package/dist/components/ui/core/accordion/accordion.js +64 -62
  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/avatar/avatar.js +10 -10
  14. package/dist/components/ui/core/badge/badge.d.ts +11 -8
  15. package/dist/components/ui/core/badge/badge.js +13 -13
  16. package/dist/components/ui/core/banner/banner.d.ts +18 -28
  17. package/dist/components/ui/core/banner/banner.js +6 -6
  18. package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +12 -0
  19. package/dist/components/ui/core/breadcrumb/breadcrumb.js +200 -0
  20. package/dist/components/ui/core/button/button.d.ts +8 -5
  21. package/dist/components/ui/core/button/button.js +22 -19
  22. package/dist/components/ui/core/button-group/button-group.d.ts +7 -6
  23. package/dist/components/ui/core/card/card.d.ts +18 -14
  24. package/dist/components/ui/core/card/card.js +131 -87
  25. package/dist/components/ui/core/chart/chart.d.ts +69 -0
  26. package/dist/components/ui/core/chart/chart.js +215 -0
  27. package/dist/components/ui/core/chart/index.d.ts +2 -0
  28. package/dist/components/ui/core/chart/index.js +8 -0
  29. package/dist/components/ui/core/checkbox/checkbox.d.ts +17 -0
  30. package/dist/components/ui/core/checkbox/checkbox.js +133 -0
  31. package/dist/components/ui/core/{badge/badge.metadata.d.ts → checkbox/checkbox.metadata.d.ts} +1 -1
  32. package/dist/components/ui/core/checkbox/checkbox.metadata.js +8 -0
  33. package/dist/components/ui/core/code-block/code-block.d.ts +6 -9
  34. package/dist/components/ui/core/code-block/code-block.js +52 -48
  35. package/dist/components/ui/core/collapsible/collapsible.d.ts +5 -3
  36. package/dist/components/ui/core/combobox/combobox.d.ts +2 -2
  37. package/dist/components/ui/core/command/command.d.ts +11 -78
  38. package/dist/components/ui/core/command/command.js +53 -52
  39. package/dist/components/ui/core/count/count.d.ts +9 -0
  40. package/dist/components/ui/core/count/count.js +32 -0
  41. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.d.ts +15 -0
  42. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +99 -0
  43. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.d.ts +3 -0
  44. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +25 -0
  45. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts +4 -0
  46. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +82 -0
  47. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts +17 -0
  48. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +190 -0
  49. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.d.ts +3 -0
  50. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +42 -0
  51. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.d.ts +3 -0
  52. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +161 -0
  53. package/dist/components/ui/core/date-time-pickers/index.d.ts +6 -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-time-state.d.ts +17 -0
  73. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +34 -0
  74. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.d.ts +8 -0
  75. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +7 -0
  76. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +13 -0
  77. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +31 -0
  78. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.d.ts +10 -0
  79. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +52 -0
  80. package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.d.ts +48 -0
  81. package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +52 -0
  82. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.d.ts +26 -0
  83. package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +37 -0
  84. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.d.ts +34 -0
  85. package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +43 -0
  86. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +15 -0
  87. package/dist/components/ui/core/date-time-pickers/utils/time-validation.d.ts +23 -0
  88. package/dist/components/ui/core/dialog/dialog.d.ts +10 -10
  89. package/dist/components/ui/core/dialog/dialog.js +12 -3
  90. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +24 -47
  91. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +125 -123
  92. package/dist/components/ui/core/empty-state/empty-state.context.d.ts +10 -0
  93. package/dist/components/ui/core/empty-state/empty-state.context.js +8 -0
  94. package/dist/components/ui/core/empty-state/empty-state.d.ts +18 -0
  95. package/dist/components/ui/core/empty-state/empty-state.js +139 -0
  96. package/dist/components/ui/core/helper-text/helper-text.d.ts +7 -5
  97. package/dist/components/ui/core/hover-card/hover-card.d.ts +5 -7
  98. package/dist/components/ui/core/hover-card/hover-card.js +26 -25
  99. package/dist/components/ui/core/inline-citation/inline-citation.d.ts +10 -10
  100. package/dist/components/ui/core/inline-citation/inline-citation.js +65 -57
  101. package/dist/components/ui/core/input/input.d.ts +2 -1
  102. package/dist/components/ui/core/input-group/input-group.d.ts +17 -13
  103. package/dist/components/ui/core/input-group/input-group.js +35 -36
  104. package/dist/components/ui/core/kbd/kbd.d.ts +4 -0
  105. package/dist/components/ui/core/kbd/kbd.js +36 -0
  106. package/dist/components/ui/core/label/label.d.ts +3 -2
  107. package/dist/components/ui/core/loader/loader.d.ts +11 -3
  108. package/dist/components/ui/core/loader/loader.js +106 -107
  109. package/dist/components/ui/core/message/message.d.ts +18 -17
  110. package/dist/components/ui/core/message/message.js +15 -13
  111. package/dist/components/ui/core/pagination/pagination-size-context.d.ts +5 -0
  112. package/dist/components/ui/core/pagination/pagination-size-context.js +6 -0
  113. package/dist/components/ui/core/pagination/pagination-teleport.d.ts +11 -0
  114. package/dist/components/ui/core/pagination/pagination-teleport.js +108 -0
  115. package/dist/components/ui/core/pagination/pagination-teleport.utils.d.ts +1 -0
  116. package/dist/components/ui/core/pagination/pagination-teleport.utils.js +7 -0
  117. package/dist/components/ui/core/pagination/pagination.d.ts +41 -0
  118. package/dist/components/ui/core/pagination/pagination.js +335 -0
  119. package/dist/components/ui/core/popover/popover.d.ts +12 -16
  120. package/dist/components/ui/core/popover/popover.js +52 -51
  121. package/dist/components/ui/core/progress/progress.d.ts +7 -4
  122. package/dist/components/ui/core/prompt-input/prompt-input.d.ts +36 -103
  123. package/dist/components/ui/core/prompt-input/prompt-input.js +193 -180
  124. package/dist/components/ui/core/radio-group/radio-group.d.ts +20 -0
  125. package/dist/components/ui/core/radio-group/radio-group.js +113 -0
  126. package/dist/components/ui/core/reasoning/reasoning.d.ts +5 -5
  127. package/dist/components/ui/core/reasoning/reasoning.js +1 -1
  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 +20 -0
  132. package/dist/components/ui/core/segmented-control/segmented-control.js +172 -0
  133. package/dist/components/ui/core/select/select.d.ts +13 -13
  134. package/dist/components/ui/core/select/select.js +13 -10
  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 +3 -5
  138. package/dist/components/ui/core/shimmer/shimmer.js +25 -26
  139. package/dist/components/ui/core/skeleton/skeleton.d.ts +2 -1
  140. package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +4 -0
  141. package/dist/components/ui/core/sonner-toast/sonner-toast.js +48 -0
  142. package/dist/components/ui/core/sources/sources.d.ts +3 -3
  143. package/dist/components/ui/core/sources/sources.js +6 -1
  144. package/dist/components/ui/core/switch/switch.d.ts +11 -0
  145. package/dist/components/ui/core/{button/button.metadata.d.ts → switch/switch.metadata.d.ts} +1 -1
  146. package/dist/components/ui/core/tabs/tabs.d.ts +27 -0
  147. package/dist/components/ui/core/tabs/tabs.js +224 -0
  148. package/dist/components/ui/core/tabs/tabs.utils.d.ts +2 -0
  149. package/dist/components/ui/core/tabs/tabs.utils.js +9 -0
  150. package/dist/components/ui/core/textarea/textarea.d.ts +2 -1
  151. package/dist/components/ui/core/textarea/textarea.js +20 -18
  152. package/dist/components/ui/core/tool/tool.d.ts +7 -6
  153. package/dist/components/ui/core/tool/tool.js +48 -44
  154. package/dist/components/ui/core/tooltip/tooltip.d.ts +6 -5
  155. package/dist/components/ui/core/tooltip/tooltip.js +10 -8
  156. package/dist/components/ui/core/topbar/topbar.d.ts +28 -0
  157. package/dist/components/ui/core/topbar/topbar.js +190 -0
  158. package/dist/eslint/index.d.ts +2 -1
  159. package/dist/index.d.ts +1 -1
  160. package/dist/index.js +298 -273
  161. package/dist/lib/portal-container-context.d.ts +2 -1
  162. package/dist/lib/portal-container-context.js +1 -3
  163. package/dist/lib/utils.d.ts +11 -0
  164. package/dist/lib/utils.js +40 -29
  165. package/dist/styles.css +1 -1
  166. package/dist/styles.source.css +75 -8
  167. package/package.json +26 -5
  168. package/dist/components/ui/core/accordion/accordion.metadata.d.ts +0 -2
  169. package/dist/components/ui/core/accordion/accordion.metadata.js +0 -9
  170. package/dist/components/ui/core/alert/alert.metadata.d.ts +0 -2
  171. package/dist/components/ui/core/alert/alert.metadata.js +0 -9
  172. package/dist/components/ui/core/avatar/avatar.metadata.d.ts +0 -8
  173. package/dist/components/ui/core/avatar/avatar.metadata.js +0 -9
  174. package/dist/components/ui/core/badge/badge.metadata.js +0 -8
  175. package/dist/components/ui/core/banner/banner.metadata.d.ts +0 -2
  176. package/dist/components/ui/core/banner/banner.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/label/label.metadata.d.ts +0 -2
  204. package/dist/components/ui/core/label/label.metadata.js +0 -9
  205. package/dist/components/ui/core/loader/loader.metadata.d.ts +0 -2
  206. package/dist/components/ui/core/loader/loader.metadata.js +0 -9
  207. package/dist/components/ui/core/message/message.metadata.d.ts +0 -2
  208. package/dist/components/ui/core/popover/popover.metadata.d.ts +0 -2
  209. package/dist/components/ui/core/popover/popover.metadata.js +0 -9
  210. package/dist/components/ui/core/progress/progress.metadata.d.ts +0 -2
  211. package/dist/components/ui/core/progress/progress.metadata.js +0 -9
  212. package/dist/components/ui/core/prompt-input/prompt-input.metadata.d.ts +0 -2
  213. package/dist/components/ui/core/prompt-input/prompt-input.metadata.js +0 -9
  214. package/dist/components/ui/core/reasoning/reasoning.metadata.d.ts +0 -2
  215. package/dist/components/ui/core/reasoning/reasoning.metadata.js +0 -8
  216. package/dist/components/ui/core/scroll-area/scroll-area.metadata.d.ts +0 -2
  217. package/dist/components/ui/core/scroll-area/scroll-area.metadata.js +0 -9
  218. package/dist/components/ui/core/select/select.metadata.d.ts +0 -2
  219. package/dist/components/ui/core/select/select.metadata.js +0 -9
  220. package/dist/components/ui/core/separator/separator.metadata.d.ts +0 -2
  221. package/dist/components/ui/core/separator/separator.metadata.js +0 -8
  222. package/dist/components/ui/core/shimmer/shimmer.metadata.d.ts +0 -2
  223. package/dist/components/ui/core/shimmer/shimmer.metadata.js +0 -9
  224. package/dist/components/ui/core/skeleton/skeleton.metadata.d.ts +0 -2
  225. package/dist/components/ui/core/skeleton/skeleton.metadata.js +0 -9
  226. package/dist/components/ui/core/sources/sources.metadata.d.ts +0 -2
  227. package/dist/components/ui/core/textarea/textarea.metadata.d.ts +0 -2
  228. package/dist/components/ui/core/textarea/textarea.metadata.js +0 -9
  229. package/dist/components/ui/core/tool/tool.metadata.d.ts +0 -2
  230. package/dist/components/ui/core/tool/tool.metadata.js +0 -8
  231. package/dist/components/ui/core/tooltip/tooltip.metadata.d.ts +0 -8
  232. package/dist/components/ui/core/tooltip/tooltip.metadata.js +0 -9
@@ -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>;
@@ -0,0 +1,68 @@
1
+ import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
+ import { cn as n } from "../../../../../../lib/utils.js";
3
+ const a = "px-1 py-0.5 rounded-sm transition-colors duration-150", i = "text-muted-foreground group-hover:text-foreground transition-colors duration-150", x = ({
4
+ startDate: d,
5
+ endDate: t,
6
+ format: e,
7
+ activeRangePart: s,
8
+ onRangePartClick: r,
9
+ isOpen: l
10
+ }) => {
11
+ const u = d !== null || t !== null, c = (b) => (g) => {
12
+ r && (g.stopPropagation(), r(b));
13
+ };
14
+ return /* @__PURE__ */ p(
15
+ "div",
16
+ {
17
+ className: n(
18
+ "flex items-center w-full py-1 px-3 pr-9 border rounded-lg",
19
+ "text-sm leading-5 h-9 box-border whitespace-nowrap overflow-hidden",
20
+ "transition-[background,border-color,color,box-shadow] duration-150",
21
+ l ? "bg-background text-foreground border-border shadow-focus-ring" : [
22
+ "bg-muted-background border-transparent",
23
+ "hover:bg-accent-background hover:text-foreground hover:border-border-emphasized",
24
+ u ? "text-foreground" : "text-muted-foreground"
25
+ ]
26
+ ),
27
+ children: [
28
+ /* @__PURE__ */ o(
29
+ "span",
30
+ {
31
+ className: n(
32
+ a,
33
+ r ? "cursor-pointer" : "cursor-default",
34
+ s === "start" ? "bg-active-muted-background" : r && "hover:bg-active-muted-background-hover"
35
+ ),
36
+ onClick: c("start"),
37
+ children: d ? d.format(e) : /* @__PURE__ */ o("span", { className: i, children: e })
38
+ }
39
+ ),
40
+ /* @__PURE__ */ o(
41
+ "span",
42
+ {
43
+ className: n(
44
+ "select-none transition-colors duration-150",
45
+ u ? "text-foreground" : "text-muted-foreground group-hover:text-foreground"
46
+ ),
47
+ children: " – "
48
+ }
49
+ ),
50
+ /* @__PURE__ */ o(
51
+ "span",
52
+ {
53
+ className: n(
54
+ a,
55
+ r ? "cursor-pointer" : "cursor-default",
56
+ s === "end" ? "bg-active-muted-background" : r && "hover:bg-active-muted-background-hover"
57
+ ),
58
+ onClick: c("end"),
59
+ children: t ? t.format(e) : /* @__PURE__ */ o("span", { className: i, children: e })
60
+ }
61
+ )
62
+ ]
63
+ }
64
+ );
65
+ };
66
+ export {
67
+ x as RangeInputDisplay
68
+ };
@@ -0,0 +1,12 @@
1
+ export interface UsePopoverStateOptions {
2
+ onClose?: () => void;
3
+ onBackspace?: () => void;
4
+ }
5
+ export interface UsePopoverStateReturn {
6
+ isOpen: boolean;
7
+ setIsOpen: (isOpen: boolean) => void;
8
+ popoverRef: React.RefObject<HTMLDivElement>;
9
+ inputRef: React.RefObject<HTMLDivElement>;
10
+ handleTogglePopover: () => void;
11
+ }
12
+ export declare const usePopoverState: (options?: UsePopoverStateOptions) => UsePopoverStateReturn;
@@ -0,0 +1,40 @@
1
+ import { useState as I, useRef as f, useCallback as L, useEffect as T } from "react";
2
+ const g = (p = {}) => {
3
+ const { onClose: s, onBackspace: c } = p, [a, n] = I(!1), i = f(null), r = f(null), m = L(() => {
4
+ n((o) => !o);
5
+ }, []);
6
+ return T(() => {
7
+ if (!a) return;
8
+ const o = (t) => {
9
+ const e = t.target;
10
+ if (!(e instanceof Node)) return;
11
+ const l = i.current?.contains(e) ?? !1, k = r.current?.contains(e) ?? !1, v = t.composedPath().some(
12
+ (d) => d instanceof HTMLElement && d.hasAttribute("data-picker-overlay")
13
+ );
14
+ !l && !k && !v && (n(!1), s?.());
15
+ }, u = (t) => {
16
+ if (t.key === "Escape") {
17
+ n(!1), s?.();
18
+ return;
19
+ }
20
+ if (t.key === "Backspace" && c) {
21
+ const { target: e } = t;
22
+ e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable || (t.preventDefault(), c());
23
+ }
24
+ }, E = setTimeout(() => {
25
+ document.addEventListener("mousedown", o);
26
+ }, 0);
27
+ return document.addEventListener("keydown", u), () => {
28
+ clearTimeout(E), document.removeEventListener("mousedown", o), document.removeEventListener("keydown", u);
29
+ };
30
+ }, [a, s, c]), {
31
+ isOpen: a,
32
+ setIsOpen: n,
33
+ popoverRef: i,
34
+ inputRef: r,
35
+ handleTogglePopover: m
36
+ };
37
+ };
38
+ export {
39
+ g as usePopoverState
40
+ };
@@ -0,0 +1,29 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { RangeSelectionStep } from './use-range-step-manager';
3
+ export interface DateStateSnapshot {
4
+ tempStart: Dayjs | null;
5
+ tempEnd: Dayjs | null;
6
+ }
7
+ export interface UseRangeDateStateOptions {
8
+ value: [Dayjs | null, Dayjs | null];
9
+ defaultDate: Dayjs;
10
+ /** Transforms a clicked date before storing; pass time-of-day defaults for datetime variants. */
11
+ mapDate?: (date: Dayjs, role: 'start' | 'end') => Dayjs;
12
+ /** Called when the end date is selected; used for auto-apply in date-only variants. */
13
+ onEndDateSelected?: (start: Dayjs | null, end: Dayjs) => void;
14
+ }
15
+ export interface UseRangeDateStateReturn {
16
+ tempStart: Dayjs | null;
17
+ tempEnd: Dayjs | null;
18
+ displayedMonth: Dayjs;
19
+ hoverDate: Dayjs | null;
20
+ /** Synchronous ref — use inside callbacks to avoid stale closures. */
21
+ stateRef: React.MutableRefObject<DateStateSnapshot>;
22
+ handleDateClick: (date: Dayjs, step: RangeSelectionStep) => void;
23
+ handleDateHover: (date: Dayjs | null) => void;
24
+ handleMonthChange: (month: Dayjs) => void;
25
+ /** Returns the new [start, end] tuple, or null if the segment was already empty (signals caller to move focus to start). */
26
+ clearActiveSegment: (step: RangeSelectionStep) => [Dayjs | null, Dayjs | null] | null;
27
+ resetDates: (value: [Dayjs | null, Dayjs | null]) => void;
28
+ }
29
+ export declare const useRangeDateState: ({ value, defaultDate, mapDate, onEndDateSelected, }: UseRangeDateStateOptions) => UseRangeDateStateReturn;
@@ -0,0 +1,63 @@
1
+ import { useCallback as e, useState as u, useRef as b } from "react";
2
+ const A = ({
3
+ value: c,
4
+ defaultDate: p,
5
+ mapDate: a,
6
+ onEndDateSelected: S
7
+ }) => {
8
+ const o = e(
9
+ (t, m) => a ? a(t, m) : t,
10
+ [a]
11
+ ), [E, f] = u(c[0]), [y, M] = u(c[1]), [g, i] = u(
12
+ () => c[0] ?? p
13
+ ), [C, l] = u(null), n = b({
14
+ tempStart: c[0],
15
+ tempEnd: c[1]
16
+ }), s = e((t) => {
17
+ n.current.tempStart = t, f(t);
18
+ }, []), r = e((t) => {
19
+ n.current.tempEnd = t, M(t);
20
+ }, []), R = e(
21
+ (t, m) => {
22
+ if (m === "start") {
23
+ s(o(t, "start")), r(null), l(null);
24
+ return;
25
+ }
26
+ const d = n.current.tempStart;
27
+ if (d && t.isBefore(d, "day")) {
28
+ s(o(t, "start")), r(null), l(null);
29
+ return;
30
+ }
31
+ const h = o(t, "end");
32
+ r(h), l(null), S?.(n.current.tempStart, h);
33
+ },
34
+ [o, s, r, S]
35
+ ), k = e((t) => {
36
+ l(t);
37
+ }, []), D = e((t) => {
38
+ i(t);
39
+ }, []), H = e(
40
+ (t) => t === "start" ? (s(null), [null, n.current.tempEnd]) : n.current.tempEnd === null ? null : (r(null), [n.current.tempStart, null]),
41
+ [s, r]
42
+ ), T = e(
43
+ (t) => {
44
+ s(t[0]), r(t[1]), l(null), i(t[0] ?? p);
45
+ },
46
+ [s, r, p]
47
+ );
48
+ return {
49
+ tempStart: E,
50
+ tempEnd: y,
51
+ displayedMonth: g,
52
+ hoverDate: C,
53
+ stateRef: n,
54
+ handleDateClick: R,
55
+ handleDateHover: k,
56
+ handleMonthChange: D,
57
+ clearActiveSegment: H,
58
+ resetDates: T
59
+ };
60
+ };
61
+ export {
62
+ A as useRangeDateState
63
+ };
@@ -0,0 +1,8 @@
1
+ export type RangeSelectionStep = 'start' | 'end';
2
+ export interface UseRangeStepManagerReturn {
3
+ step: RangeSelectionStep;
4
+ handleNext: () => void;
5
+ handleBack: () => void;
6
+ resetStep: () => void;
7
+ }
8
+ export declare const useRangeStepManager: () => UseRangeStepManagerReturn;
@@ -0,0 +1,19 @@
1
+ import { useState as o, useCallback as e } from "react";
2
+ const p = () => {
3
+ const [s, t] = o("start"), a = e(() => {
4
+ t("end");
5
+ }, []), n = e(() => {
6
+ t("start");
7
+ }, []), r = e(() => {
8
+ t("start");
9
+ }, []);
10
+ return {
11
+ step: s,
12
+ handleNext: a,
13
+ handleBack: n,
14
+ resetStep: r
15
+ };
16
+ };
17
+ export {
18
+ p as useRangeStepManager
19
+ };
@@ -0,0 +1,17 @@
1
+ import { TimeFormat } from '../../utils/format-utils';
2
+ export interface UseTimeStateOptions {
3
+ initialHour?: number;
4
+ initialMinute?: number;
5
+ timeFormat?: TimeFormat;
6
+ }
7
+ export interface UseTimeStateReturn {
8
+ hour: number;
9
+ minute: number;
10
+ amPm: 'AM' | 'PM';
11
+ hour24: number;
12
+ handleHourChange: (hour: number) => void;
13
+ handleMinuteChange: (minute: number) => void;
14
+ handleAmPmChange: (amPm: 'AM' | 'PM') => void;
15
+ resetTime: (hour: number, minute: number) => void;
16
+ }
17
+ export declare const useTimeState: ({ initialHour, initialMinute, timeFormat, }?: UseTimeStateOptions) => UseTimeStateReturn;
@@ -0,0 +1,34 @@
1
+ import { useState as r, useMemo as C, useCallback as M } from "react";
2
+ import { getAmPmFromHour as m, convert12HourTo24Hour as P, convert24HourTo12Hour as T } from "../../utils/time-utils.js";
3
+ import { DEFAULT_START_HOUR as U, DEFAULT_MINUTE as f } from "../constants.js";
4
+ const S = ({
5
+ initialHour: s = U,
6
+ initialMinute: a = f,
7
+ timeFormat: o = "24h"
8
+ } = {}) => {
9
+ const l = o === "12h" ? T(s) : s, [e, u] = r(l), [p, h] = r(a), [t, c] = r(
10
+ () => m(s)
11
+ ), A = C(
12
+ () => o === "12h" ? P(e, t) : e,
13
+ [e, t, o]
14
+ ), H = M(
15
+ (n, d) => {
16
+ const g = o === "12h" ? T(n) : n;
17
+ u(g), h(d), c(m(n));
18
+ },
19
+ [o]
20
+ );
21
+ return {
22
+ hour: e,
23
+ minute: p,
24
+ amPm: t,
25
+ hour24: A,
26
+ handleHourChange: u,
27
+ handleMinuteChange: h,
28
+ handleAmPmChange: c,
29
+ resetTime: H
30
+ };
31
+ };
32
+ export {
33
+ S as useTimeState
34
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shared Tailwind class strings for TimePickerScroll and AmPmScroll.
3
+ * Both components render the same scroll container and cell styles.
4
+ */
5
+ export declare const SCROLL_CONTAINER_CLASSES = "overflow-y-auto flex flex-col items-center py-2 w-9 h-72 shrink-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden";
6
+ export declare const SCROLL_ITEM_BASE_CLASSES = "w-9 h-9 flex items-center justify-center rounded-lg cursor-pointer text-sm font-medium leading-[18px] tracking-normal select-none transition-colors duration-150 shrink-0";
7
+ export declare const SCROLL_ITEM_SELECTED_CLASSES = "bg-primary-background text-foreground-on-primary hover:bg-primary-background";
8
+ export declare const SCROLL_ITEM_UNSELECTED_CLASSES = "text-secondary-foreground hover:bg-accent-background";
@@ -0,0 +1,7 @@
1
+ const r = "overflow-y-auto flex flex-col items-center py-2 w-9 h-72 shrink-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", o = "w-9 h-9 flex items-center justify-center rounded-lg cursor-pointer text-sm font-medium leading-[18px] tracking-normal select-none transition-colors duration-150 shrink-0", e = "bg-primary-background text-foreground-on-primary hover:bg-primary-background", n = "text-secondary-foreground hover:bg-accent-background";
2
+ export {
3
+ r as SCROLL_CONTAINER_CLASSES,
4
+ o as SCROLL_ITEM_BASE_CLASSES,
5
+ e as SCROLL_ITEM_SELECTED_CLASSES,
6
+ n as SCROLL_ITEM_UNSELECTED_CLASSES
7
+ };
@@ -0,0 +1,13 @@
1
+ import { FC } from 'react';
2
+ import { Dayjs } from 'dayjs';
3
+ export interface ShortcutItem {
4
+ id?: string;
5
+ label: string;
6
+ getValue: () => [Dayjs, Dayjs] | Dayjs | [Dayjs | null, Dayjs | null];
7
+ }
8
+ export interface ShortcutsPanelProps {
9
+ shortcuts?: ShortcutItem[];
10
+ onShortcutClick: (value: [Dayjs, Dayjs] | Dayjs | [Dayjs | null, Dayjs | null]) => void;
11
+ className?: string;
12
+ }
13
+ export declare const ShortcutsPanel: FC<ShortcutsPanelProps>;
@@ -0,0 +1,31 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { cn as t } from "../../../../../../lib/utils.js";
3
+ import { Button as n } from "../../../button/button.js";
4
+ const i = [], m = ({
5
+ shortcuts: r = i,
6
+ onShortcutClick: a,
7
+ className: o
8
+ }) => r.length === 0 ? null : /* @__PURE__ */ l(
9
+ "div",
10
+ {
11
+ "data-slot": "shortcuts-panel",
12
+ className: t(
13
+ "flex flex-col gap-1 p-3 border-r border-border min-w-[150px]",
14
+ o
15
+ ),
16
+ children: r.map((e) => /* @__PURE__ */ l(
17
+ n,
18
+ {
19
+ variant: "ghost",
20
+ size: "default",
21
+ className: "w-full justify-start text-secondary-foreground",
22
+ onClick: () => a(e.getValue()),
23
+ children: e.label
24
+ },
25
+ e.id ?? e.label
26
+ ))
27
+ }
28
+ );
29
+ export {
30
+ m as ShortcutsPanel
31
+ };
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ import { TimeFormat } from '../../utils/format-utils';
3
+ export type TimePickerScrollProps = {
4
+ value: number | null;
5
+ onChange: (value: number) => void;
6
+ type: 'hour' | 'minute';
7
+ timeFormat?: TimeFormat;
8
+ className?: string;
9
+ };
10
+ export declare const TimePickerScroll: FC<TimePickerScrollProps>;