@devalok/shilp-sutra 0.31.0 → 0.33.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 (278) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_chunks/badge-group.js +123 -172
  3. package/dist/_chunks/date-time-picker.js +851 -0
  4. package/dist/_chunks/document-preview.js +92 -0
  5. package/dist/_chunks/file-preview.js +511 -0
  6. package/dist/_chunks/image-preview.js +90 -0
  7. package/dist/_chunks/mention-suggestion.js +362 -0
  8. package/dist/_chunks/primitives.js +109 -109
  9. package/dist/_chunks/stat-row.js +144 -124
  10. package/dist/_chunks/tiptap.js +11595 -7731
  11. package/dist/_chunks/use-calendar.js +117 -890
  12. package/dist/_chunks/vendor-client.js +1055 -894
  13. package/dist/ai/block-renderer.d.ts +2 -1
  14. package/dist/ai/block-renderer.d.ts.map +1 -1
  15. package/dist/ai/block-renderer.js +30 -29
  16. package/dist/ai/blocks/block-table.d.ts.map +1 -1
  17. package/dist/ai/blocks/confirm.d.ts.map +1 -1
  18. package/dist/ai/blocks/divider.d.ts.map +1 -1
  19. package/dist/ai/blocks/error.d.ts.map +1 -1
  20. package/dist/ai/blocks/info.d.ts.map +1 -1
  21. package/dist/ai/blocks/loading.d.ts.map +1 -1
  22. package/dist/ai/blocks/stat-row.d.ts.map +1 -1
  23. package/dist/ai/blocks/success.d.ts.map +1 -1
  24. package/dist/ai/blocks/text.d.ts.map +1 -1
  25. package/dist/ai/command-bar.d.ts +18 -0
  26. package/dist/ai/command-bar.d.ts.map +1 -1
  27. package/dist/ai/command-bar.js +126 -125
  28. package/dist/ai/conversation.d.ts +13 -1
  29. package/dist/ai/conversation.d.ts.map +1 -1
  30. package/dist/ai/conversation.js +78 -78
  31. package/dist/ai/types.d.ts +0 -1
  32. package/dist/ai/types.d.ts.map +1 -1
  33. package/dist/ai/types.js +0 -1
  34. package/dist/composed/bulk-action-bar.d.ts +6 -4
  35. package/dist/composed/bulk-action-bar.d.ts.map +1 -1
  36. package/dist/composed/bulk-action-bar.js +102 -58
  37. package/dist/composed/command-palette.d.ts +9 -0
  38. package/dist/composed/command-palette.d.ts.map +1 -1
  39. package/dist/composed/command-palette.js +68 -68
  40. package/dist/composed/confirm-dialog.d.ts +1 -1
  41. package/dist/composed/confirm-dialog.d.ts.map +1 -1
  42. package/dist/composed/confirm-dialog.js +10 -10
  43. package/dist/composed/date-picker/date-picker.d.ts +11 -1
  44. package/dist/composed/date-picker/date-picker.d.ts.map +1 -1
  45. package/dist/composed/date-picker/index.js +9 -8
  46. package/dist/composed/date-picker/month-picker.d.ts.map +1 -1
  47. package/dist/composed/date-picker/year-picker.d.ts.map +1 -1
  48. package/dist/composed/deadline-indicator.d.ts +1 -1
  49. package/dist/composed/deadline-indicator.d.ts.map +1 -1
  50. package/dist/composed/deadline-indicator.js +39 -36
  51. package/dist/composed/emoji-picker.d.ts +14 -2
  52. package/dist/composed/emoji-picker.d.ts.map +1 -1
  53. package/dist/composed/emoji-picker.js +66 -55
  54. package/dist/composed/error-boundary.d.ts +21 -1
  55. package/dist/composed/error-boundary.d.ts.map +1 -1
  56. package/dist/composed/error-boundary.js +47 -32
  57. package/dist/composed/extensions/emoji-data.d.ts +35 -0
  58. package/dist/composed/extensions/emoji-data.d.ts.map +1 -0
  59. package/dist/composed/extensions/emoji-node.d.ts +11 -0
  60. package/dist/composed/extensions/emoji-node.d.ts.map +1 -0
  61. package/dist/composed/extensions/emoji-suggestion.d.ts +4 -6
  62. package/dist/composed/extensions/emoji-suggestion.d.ts.map +1 -1
  63. package/dist/composed/extensions/slash-command.d.ts +35 -0
  64. package/dist/composed/extensions/slash-command.d.ts.map +1 -0
  65. package/dist/composed/file-preview/audio-preview.d.ts +7 -0
  66. package/dist/composed/file-preview/audio-preview.d.ts.map +1 -0
  67. package/dist/composed/file-preview/document-preview.d.ts +7 -0
  68. package/dist/composed/file-preview/document-preview.d.ts.map +1 -0
  69. package/dist/composed/file-preview/embed-preview.d.ts +7 -0
  70. package/dist/composed/file-preview/embed-preview.d.ts.map +1 -0
  71. package/dist/composed/file-preview/image-preview.d.ts +7 -0
  72. package/dist/composed/file-preview/image-preview.d.ts.map +1 -0
  73. package/dist/composed/file-preview/shared.d.ts +20 -0
  74. package/dist/composed/file-preview/shared.d.ts.map +1 -0
  75. package/dist/composed/file-preview/video-preview.d.ts +6 -0
  76. package/dist/composed/file-preview/video-preview.d.ts.map +1 -0
  77. package/dist/composed/file-preview.d.ts.map +1 -1
  78. package/dist/composed/file-preview.js +10 -662
  79. package/dist/composed/filter-bar.d.ts +10 -2
  80. package/dist/composed/filter-bar.d.ts.map +1 -1
  81. package/dist/composed/filter-bar.js +42 -43
  82. package/dist/composed/form-section.d.ts +1 -1
  83. package/dist/composed/form-section.d.ts.map +1 -1
  84. package/dist/composed/form-section.js +22 -21
  85. package/dist/composed/index.d.ts +9 -3
  86. package/dist/composed/index.d.ts.map +1 -1
  87. package/dist/composed/index.js +79 -69
  88. package/dist/composed/inline-edit.d.ts +1 -1
  89. package/dist/composed/inline-edit.d.ts.map +1 -1
  90. package/dist/composed/inline-edit.js +33 -32
  91. package/dist/composed/markdown-viewer.d.ts +1 -1
  92. package/dist/composed/markdown-viewer.d.ts.map +1 -1
  93. package/dist/composed/markdown-viewer.js +60 -59
  94. package/dist/composed/master-detail.d.ts +11 -7
  95. package/dist/composed/master-detail.d.ts.map +1 -1
  96. package/dist/composed/master-detail.js +123 -84
  97. package/dist/composed/responsive-overlay.d.ts +8 -0
  98. package/dist/composed/responsive-overlay.d.ts.map +1 -1
  99. package/dist/composed/rich-chat-input/attachment-strip.d.ts +15 -0
  100. package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -0
  101. package/dist/composed/rich-chat-input/audio-player.d.ts +11 -0
  102. package/dist/composed/rich-chat-input/audio-player.d.ts.map +1 -0
  103. package/dist/composed/rich-chat-input/audio-waveform.d.ts +24 -0
  104. package/dist/composed/rich-chat-input/audio-waveform.d.ts.map +1 -0
  105. package/dist/composed/rich-chat-input/chat-toolbar.d.ts +51 -0
  106. package/dist/composed/rich-chat-input/chat-toolbar.d.ts.map +1 -0
  107. package/dist/composed/rich-chat-input/recording-overlay.d.ts +15 -0
  108. package/dist/composed/rich-chat-input/recording-overlay.d.ts.map +1 -0
  109. package/dist/composed/rich-chat-input/reply-banner.d.ts +8 -0
  110. package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -0
  111. package/dist/composed/rich-chat-input/schedule-send.d.ts +22 -0
  112. package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -0
  113. package/dist/composed/rich-chat-input/use-voice-recorder.d.ts +18 -0
  114. package/dist/composed/rich-chat-input/use-voice-recorder.d.ts.map +1 -0
  115. package/dist/composed/rich-chat-input.d.ts +91 -0
  116. package/dist/composed/rich-chat-input.d.ts.map +1 -0
  117. package/dist/composed/rich-chat-input.js +1861 -0
  118. package/dist/composed/rich-text-editor.d.ts +14 -3
  119. package/dist/composed/rich-text-editor.d.ts.map +1 -1
  120. package/dist/composed/rich-text-editor.js +278 -447
  121. package/dist/composed/schedule-view.d.ts +9 -1
  122. package/dist/composed/schedule-view.d.ts.map +1 -1
  123. package/dist/hooks/index.d.ts +2 -0
  124. package/dist/hooks/index.d.ts.map +1 -1
  125. package/dist/hooks/index.js +8 -4
  126. package/dist/hooks/use-touch-device.d.ts +12 -0
  127. package/dist/hooks/use-touch-device.d.ts.map +1 -0
  128. package/dist/hooks/use-touch-device.js +13 -0
  129. package/dist/hooks/use-viewport-height.d.ts +11 -0
  130. package/dist/hooks/use-viewport-height.d.ts.map +1 -0
  131. package/dist/hooks/use-viewport-height.js +16 -0
  132. package/dist/shell/bottom-navbar.d.ts.map +1 -1
  133. package/dist/shell/bottom-navbar.js +72 -63
  134. package/dist/shell/command-registry.d.ts.map +1 -1
  135. package/dist/shell/notification-center.d.ts.map +1 -1
  136. package/dist/shell/notification-center.js +77 -77
  137. package/dist/shell/top-bar.d.ts +2 -2
  138. package/dist/shell/top-bar.d.ts.map +1 -1
  139. package/dist/shell/top-bar.js +61 -60
  140. package/dist/tailwind/index.cjs +51 -7
  141. package/dist/tailwind/preset.d.ts.map +1 -1
  142. package/dist/tailwind/preset.js +51 -7
  143. package/dist/tokens/primitives.css +3 -1
  144. package/dist/tokens/semantic.css +16 -13
  145. package/dist/ui/autocomplete.d.ts.map +1 -1
  146. package/dist/ui/autocomplete.js +38 -39
  147. package/dist/ui/badge.d.ts +104 -2
  148. package/dist/ui/badge.d.ts.map +1 -1
  149. package/dist/ui/banner.d.ts.map +1 -1
  150. package/dist/ui/banner.js +8 -7
  151. package/dist/ui/button-group.d.ts +27 -37
  152. package/dist/ui/button-group.d.ts.map +1 -1
  153. package/dist/ui/button-group.js +95 -29
  154. package/dist/ui/button.d.ts +2 -2
  155. package/dist/ui/button.d.ts.map +1 -1
  156. package/dist/ui/button.js +118 -134
  157. package/dist/ui/card.js +24 -24
  158. package/dist/ui/charts/area-chart.d.ts +2 -0
  159. package/dist/ui/charts/area-chart.d.ts.map +1 -1
  160. package/dist/ui/charts/bar-chart.d.ts +2 -0
  161. package/dist/ui/charts/bar-chart.d.ts.map +1 -1
  162. package/dist/ui/charts/chart-container.d.ts +2 -0
  163. package/dist/ui/charts/chart-container.d.ts.map +1 -1
  164. package/dist/ui/charts/index.js +583 -577
  165. package/dist/ui/charts/line-chart.d.ts +2 -0
  166. package/dist/ui/charts/line-chart.d.ts.map +1 -1
  167. package/dist/ui/charts/pie-chart.d.ts +2 -0
  168. package/dist/ui/charts/pie-chart.d.ts.map +1 -1
  169. package/dist/ui/charts/radar-chart.d.ts +2 -0
  170. package/dist/ui/charts/radar-chart.d.ts.map +1 -1
  171. package/dist/ui/checkbox.d.ts +2 -0
  172. package/dist/ui/checkbox.d.ts.map +1 -1
  173. package/dist/ui/checkbox.js +36 -27
  174. package/dist/ui/color-input.js +5 -5
  175. package/dist/ui/combobox.d.ts +6 -1
  176. package/dist/ui/combobox.d.ts.map +1 -1
  177. package/dist/ui/combobox.js +1 -1
  178. package/dist/ui/context-menu.js +1 -1
  179. package/dist/ui/data-table-body.d.ts +12 -0
  180. package/dist/ui/data-table-body.d.ts.map +1 -0
  181. package/dist/ui/data-table-body.js +219 -0
  182. package/dist/ui/data-table-bulk-actions.d.ts +19 -0
  183. package/dist/ui/data-table-bulk-actions.d.ts.map +1 -0
  184. package/dist/ui/data-table-bulk-actions.js +61 -0
  185. package/dist/ui/data-table-card.d.ts +9 -0
  186. package/dist/ui/data-table-card.d.ts.map +1 -0
  187. package/dist/ui/data-table-card.js +73 -0
  188. package/dist/ui/data-table-context.d.ts +62 -0
  189. package/dist/ui/data-table-context.d.ts.map +1 -0
  190. package/dist/ui/data-table-context.js +48 -0
  191. package/dist/ui/data-table-header.d.ts +10 -0
  192. package/dist/ui/data-table-header.d.ts.map +1 -0
  193. package/dist/ui/data-table-header.js +141 -0
  194. package/dist/ui/data-table-pagination.d.ts +13 -0
  195. package/dist/ui/data-table-pagination.d.ts.map +1 -0
  196. package/dist/ui/data-table-pagination.js +84 -0
  197. package/dist/ui/data-table.d.ts +11 -9
  198. package/dist/ui/data-table.d.ts.map +1 -1
  199. package/dist/ui/data-table.js +258 -573
  200. package/dist/ui/dialog.d.ts +6 -2
  201. package/dist/ui/dialog.d.ts.map +1 -1
  202. package/dist/ui/dialog.js +84 -82
  203. package/dist/ui/dropdown-menu.js +1 -1
  204. package/dist/ui/hover-card.d.ts +7 -0
  205. package/dist/ui/hover-card.d.ts.map +1 -1
  206. package/dist/ui/hover-card.js +3 -3
  207. package/dist/ui/icon-group.d.ts +2 -4
  208. package/dist/ui/icon-group.d.ts.map +1 -1
  209. package/dist/ui/icon-group.js +22 -23
  210. package/dist/ui/index.d.ts +2 -2
  211. package/dist/ui/index.d.ts.map +1 -1
  212. package/dist/ui/index.js +324 -327
  213. package/dist/ui/label.js +1 -1
  214. package/dist/ui/lib/bottom-sheet.d.ts +16 -0
  215. package/dist/ui/lib/bottom-sheet.d.ts.map +1 -0
  216. package/dist/ui/menubar.d.ts.map +1 -1
  217. package/dist/ui/menubar.js +64 -73
  218. package/dist/ui/navigation-menu.d.ts.map +1 -1
  219. package/dist/ui/navigation-menu.js +40 -44
  220. package/dist/ui/number-input.d.ts.map +1 -1
  221. package/dist/ui/number-input.js +19 -17
  222. package/dist/ui/popover.d.ts.map +1 -1
  223. package/dist/ui/popover.js +107 -32
  224. package/dist/ui/progress-ring.d.ts.map +1 -1
  225. package/dist/ui/progress-ring.js +80 -80
  226. package/dist/ui/progress.js +4 -4
  227. package/dist/ui/radio.d.ts +5 -2
  228. package/dist/ui/radio.d.ts.map +1 -1
  229. package/dist/ui/radio.js +29 -20
  230. package/dist/ui/search-input.d.ts.map +1 -1
  231. package/dist/ui/search-input.js +13 -12
  232. package/dist/ui/segmented-control.d.ts +6 -108
  233. package/dist/ui/segmented-control.d.ts.map +1 -1
  234. package/dist/ui/segmented-control.js +86 -272
  235. package/dist/ui/select.js +5 -5
  236. package/dist/ui/separator.js +5 -5
  237. package/dist/ui/sheet.d.ts +2 -0
  238. package/dist/ui/sheet.d.ts.map +1 -1
  239. package/dist/ui/sheet.js +102 -84
  240. package/dist/ui/sidebar.d.ts.map +1 -1
  241. package/dist/ui/sidebar.js +200 -175
  242. package/dist/ui/slider.js +14 -14
  243. package/dist/ui/split-button.d.ts +45 -0
  244. package/dist/ui/split-button.d.ts.map +1 -0
  245. package/dist/ui/split-button.js +282 -0
  246. package/dist/ui/status-dot.js +8 -8
  247. package/dist/ui/stepper.d.ts.map +1 -1
  248. package/dist/ui/stepper.js +33 -31
  249. package/dist/ui/switch.js +3 -3
  250. package/dist/ui/tabs.js +6 -6
  251. package/dist/ui/toast-types.d.ts +0 -1
  252. package/dist/ui/toast-types.d.ts.map +1 -1
  253. package/dist/ui/toast-types.js +0 -1
  254. package/dist/ui/toast.d.ts.map +1 -1
  255. package/dist/ui/toast.js +156 -150
  256. package/dist/ui/toggle-group.js +1 -1
  257. package/dist/ui/toggle.js +1 -1
  258. package/dist/ui/tooltip.js +3 -3
  259. package/docs/components/composed/emoji-picker.md +9 -0
  260. package/docs/components/composed/rich-chat-input.md +88 -0
  261. package/docs/components/composed/rich-text-editor.md +5 -0
  262. package/docs/components/ui/button-group.md +9 -0
  263. package/docs/components/ui/button.md +4 -0
  264. package/docs/components/ui/data-table-body.md +13 -0
  265. package/docs/components/ui/data-table-bulk-actions.md +13 -0
  266. package/docs/components/ui/data-table-card.md +13 -0
  267. package/docs/components/ui/data-table-context.md +13 -0
  268. package/docs/components/ui/data-table-header.md +13 -0
  269. package/docs/components/ui/data-table-pagination.md +13 -0
  270. package/docs/components/ui/split-button.md +41 -0
  271. package/llms-full.txt +235 -48
  272. package/llms.txt +54 -2
  273. package/package.json +30 -31
  274. package/dist/ui/chip.d.ts +0 -19
  275. package/dist/ui/chip.d.ts.map +0 -1
  276. package/dist/ui/chip.js +0 -14
  277. package/dist/ui/lib/use-ripple.d.ts +0 -14
  278. package/dist/ui/lib/use-ripple.d.ts.map +0 -1
@@ -1,190 +1,189 @@
1
1
  "use client";
2
- import { jsxs as b, jsx as t } from "react/jsx-runtime";
3
- import * as g from "react";
4
- import { useState as Pe } from "react";
5
- import { format as D, startOfMonth as q, endOfMonth as ge, startOfWeek as Ce, endOfWeek as Ye, addDays as J, subMonths as me, addMonths as se, isSameMonth as xe, isSameDay as X, lastDayOfMonth as Re, isBefore as ee, startOfDay as B, isAfter as te, isWithinInterval as ye, setMonth as re, setYear as oe, endOfDay as _, startOfYear as Te, subDays as fe, setHours as G, setMinutes as ne, setSeconds as Me } from "date-fns";
6
- import { IconChevronLeft as He, IconChevronRight as Ae, IconCalendarEvent as ve, IconClock as De, IconCalendarClock as Oe } from "@tabler/icons-react";
7
- import { Icon as K } from "../ui/icon.js";
8
- import { cn as y } from "../ui/lib/utils.js";
9
- import { Popover as ae, PopoverTrigger as ce, PopoverContent as le } from "../ui/popover.js";
10
- const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = g.forwardRef(
2
+ import { jsxs as y, jsx as i } from "react/jsx-runtime";
3
+ import * as w from "react";
4
+ import { useState as ae } from "react";
5
+ import { format as m, startOfMonth as k, endOfMonth as ie, startOfWeek as ce, endOfWeek as de, addDays as b, subMonths as z, addMonths as B, isSameMonth as Y, isSameDay as x, lastDayOfMonth as le, isBefore as N, startOfDay as G, isAfter as T, isWithinInterval as L, setYear as ue, setMonth as fe } from "date-fns";
6
+ import { IconChevronLeft as me, IconChevronRight as pe } from "@tabler/icons-react";
7
+ import { Icon as P } from "../ui/icon.js";
8
+ import { cn as C } from "../ui/lib/utils.js";
9
+ const be = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], he = w.forwardRef(
11
10
  function({
12
- currentMonth: e,
13
- selected: u,
14
- rangeStart: c,
15
- rangeEnd: i,
16
- hoverDate: p,
17
- onSelect: h,
18
- onHover: f,
19
- onMonthChange: x,
20
- onHeaderClick: k,
21
- disabledDates: S,
22
- minDate: M,
23
- maxDate: w,
24
- hidePrevNav: R,
25
- hideNextNav: v,
26
- events: T,
27
- className: C,
28
- ...Y
29
- }, m) {
30
- const A = g.useRef(null), H = g.useMemo(() => {
31
- const r = /* @__PURE__ */ new Map();
32
- if (!T) return r;
33
- for (const s of T) {
34
- const a = D(s.date, "yyyy-MM-dd"), n = r.get(a) ?? [];
35
- n.push(s), r.set(a, n);
11
+ currentMonth: c,
12
+ selected: d,
13
+ rangeStart: o,
14
+ rangeEnd: l,
15
+ hoverDate: f,
16
+ onSelect: v,
17
+ onHover: a,
18
+ onMonthChange: u,
19
+ onHeaderClick: R,
20
+ disabledDates: q,
21
+ minDate: j,
22
+ maxDate: A,
23
+ hidePrevNav: F,
24
+ hideNextNav: S,
25
+ events: g,
26
+ className: U,
27
+ ...$
28
+ }, J) {
29
+ const M = w.useRef(null), Q = w.useMemo(() => {
30
+ const e = /* @__PURE__ */ new Map();
31
+ if (!g) return e;
32
+ for (const n of g) {
33
+ const t = m(n.date, "yyyy-MM-dd"), s = e.get(t) ?? [];
34
+ s.push(n), e.set(t, s);
36
35
  }
37
- return r;
38
- }, [T]), O = q(e), P = ge(e), E = Ce(O), W = Ye(P), j = [];
39
- let $ = E;
40
- for (; $ <= W; )
41
- j.push($), $ = J($, 1);
42
- const I = (r) => !!(S?.(r) || M && ee(r, B(M)) || w && te(r, B(w))), F = (r) => {
43
- if (c && i) {
44
- const s = ee(c, i) ? c : i, a = te(i, c) ? i : c;
45
- return ye(r, { start: s, end: a });
36
+ return e;
37
+ }, [g]), V = k(c), X = ie(c), Z = ce(V), _ = de(X), E = [];
38
+ let h = Z;
39
+ for (; h <= _; )
40
+ E.push(h), h = b(h, 1);
41
+ const I = (e) => !!(q?.(e) || j && N(e, G(j)) || A && T(e, G(A))), H = (e) => {
42
+ if (o && l) {
43
+ const n = N(o, l) ? o : l, t = T(l, o) ? l : o;
44
+ return L(e, { start: n, end: t });
46
45
  }
47
- if (c && p) {
48
- const s = ee(c, p) ? c : p, a = te(p, c) ? p : c;
49
- return ye(r, { start: s, end: a });
46
+ if (o && f) {
47
+ const n = N(o, f) ? o : f, t = T(f, o) ? f : o;
48
+ return L(e, { start: n, end: t });
50
49
  }
51
50
  return !1;
52
- }, z = (r) => !!(c && X(r, c) || i && X(r, i)), L = (r) => {
53
- if (!A.current) return;
54
- const s = D(r, "yyyy-MM-dd"), a = A.current.querySelector(
55
- `[data-date="${s}"]`
51
+ }, ee = (e) => !!(o && x(e, o) || l && x(e, l)), te = (e) => {
52
+ if (!M.current) return;
53
+ const n = m(e, "yyyy-MM-dd"), t = M.current.querySelector(
54
+ `[data-date="${n}"]`
56
55
  );
57
- a ? a.focus() : x(q(r));
58
- }, V = (r) => {
59
- const a = r.target.getAttribute("data-date");
60
- if (!a) return;
61
- const n = /* @__PURE__ */ new Date(a + "T00:00:00");
62
- let o = null;
63
- switch (r.key) {
56
+ t ? t.focus() : u(k(e));
57
+ }, se = (e) => {
58
+ const t = e.target.getAttribute("data-date");
59
+ if (!t) return;
60
+ const s = /* @__PURE__ */ new Date(t + "T00:00:00");
61
+ let r = null;
62
+ switch (e.key) {
64
63
  case "ArrowLeft":
65
- o = J(n, -1);
64
+ r = b(s, -1);
66
65
  break;
67
66
  case "ArrowRight":
68
- o = J(n, 1);
67
+ r = b(s, 1);
69
68
  break;
70
69
  case "ArrowUp":
71
- o = J(n, -7);
70
+ r = b(s, -7);
72
71
  break;
73
72
  case "ArrowDown":
74
- o = J(n, 7);
73
+ r = b(s, 7);
75
74
  break;
76
75
  case "Home":
77
- o = q(n);
76
+ r = k(s);
78
77
  break;
79
78
  case "End":
80
- o = Re(n);
79
+ r = le(s);
81
80
  break;
82
81
  case "Enter":
83
82
  case " ": {
84
- r.preventDefault(), !I(n) && xe(n, e) && h(n);
83
+ e.preventDefault(), !I(s) && Y(s, c) && v(s);
85
84
  return;
86
85
  }
87
86
  default:
88
87
  return;
89
88
  }
90
- o && (r.preventDefault(), L(o));
89
+ r && (e.preventDefault(), te(r));
91
90
  };
92
- return /* @__PURE__ */ b("div", { ref: m, ...Y, className: y("w-[252px]", C), children: [
93
- /* @__PURE__ */ b("div", { className: "flex items-center justify-between px-ds-02 pb-ds-04", children: [
94
- R ? /* @__PURE__ */ t("span", { className: "h-ds-xs-plus w-ds-xs-plus" }) : /* @__PURE__ */ t(
91
+ return /* @__PURE__ */ y("div", { ref: J, ...$, className: C("w-[252px]", U), children: [
92
+ /* @__PURE__ */ y("div", { className: "flex items-center justify-between px-ds-02 pb-ds-04", children: [
93
+ F ? /* @__PURE__ */ i("span", { className: "h-ds-xs-plus w-ds-xs-plus" }) : /* @__PURE__ */ i(
95
94
  "button",
96
95
  {
97
96
  type: "button",
98
- onClick: () => x(me(e, 1)),
97
+ onClick: () => u(z(c, 1)),
99
98
  className: "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-surface-fg-subtle transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised-hover hover:text-surface-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9",
100
99
  "aria-label": "Previous month",
101
- children: /* @__PURE__ */ t(K, { icon: He, size: "sm", stroke: "light" })
100
+ children: /* @__PURE__ */ i(P, { icon: me, size: "sm", stroke: "light" })
102
101
  }
103
102
  ),
104
- /* @__PURE__ */ t(
103
+ /* @__PURE__ */ i(
105
104
  "button",
106
105
  {
107
106
  type: "button",
108
- onClick: k,
109
- className: y(
107
+ onClick: R,
108
+ className: C(
110
109
  "text-ds-md font-semibold text-surface-fg",
111
- k && "cursor-pointer rounded-ds-md px-ds-02 transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised-hover"
110
+ R && "cursor-pointer rounded-ds-md px-ds-02 transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised-hover"
112
111
  ),
113
112
  "aria-label": "Switch to month/year view",
114
- children: D(e, "MMMM yyyy")
113
+ children: m(c, "MMMM yyyy")
115
114
  }
116
115
  ),
117
- v ? /* @__PURE__ */ t("span", { className: "h-ds-xs-plus w-ds-xs-plus" }) : /* @__PURE__ */ t(
116
+ S ? /* @__PURE__ */ i("span", { className: "h-ds-xs-plus w-ds-xs-plus" }) : /* @__PURE__ */ i(
118
117
  "button",
119
118
  {
120
119
  type: "button",
121
- onClick: () => x(se(e, 1)),
120
+ onClick: () => u(B(c, 1)),
122
121
  className: "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-surface-fg-subtle transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised-hover hover:text-surface-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9",
123
122
  "aria-label": "Next month",
124
- children: /* @__PURE__ */ t(K, { icon: Ae, size: "sm", stroke: "light" })
123
+ children: /* @__PURE__ */ i(P, { icon: pe, size: "sm", stroke: "light" })
125
124
  }
126
125
  )
127
126
  ] }),
128
- /* @__PURE__ */ b(
127
+ /* @__PURE__ */ y(
129
128
  "div",
130
129
  {
131
- ref: A,
130
+ ref: M,
132
131
  className: "grid grid-cols-7 gap-0",
133
132
  role: "grid",
134
133
  tabIndex: 0,
135
134
  "aria-label": "Calendar",
136
- onKeyDown: V,
135
+ onKeyDown: se,
137
136
  children: [
138
- Ee.map((r) => /* @__PURE__ */ t(
137
+ be.map((e) => /* @__PURE__ */ i(
139
138
  "div",
140
139
  {
141
140
  role: "columnheader",
142
141
  className: "flex h-ds-sm items-center justify-center text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle",
143
- children: r
142
+ children: e
144
143
  },
145
- r
144
+ e
146
145
  )),
147
- j.map((r, s) => {
148
- const a = xe(r, e), n = I(r), o = u && X(r, u), l = F(r), N = z(r), ue = X(r, /* @__PURE__ */ new Date()), be = D(r, "yyyy-MM-dd"), pe = H.get(be) ?? [];
149
- return /* @__PURE__ */ b(
146
+ E.map((e, n) => {
147
+ const t = Y(e, c), s = I(e), r = d && x(e, d), O = H(e), p = ee(e), oe = x(e, /* @__PURE__ */ new Date()), W = m(e, "yyyy-MM-dd"), K = Q.get(W) ?? [];
148
+ return /* @__PURE__ */ y(
150
149
  "button",
151
150
  {
152
151
  type: "button",
153
152
  role: "gridcell",
154
- "data-date": be,
155
- tabIndex: a && !n ? 0 : -1,
156
- disabled: !a || n,
153
+ "data-date": W,
154
+ tabIndex: t && !s ? 0 : -1,
155
+ disabled: !t || s,
157
156
  onClick: () => {
158
- a && !n && h(r);
157
+ t && !s && v(e);
159
158
  },
160
- onMouseEnter: () => f?.(r),
161
- onMouseLeave: () => f?.(null),
162
- "aria-label": D(r, "EEEE, MMMM d, yyyy"),
163
- "aria-selected": o || N || void 0,
164
- "aria-disabled": !a || n || void 0,
165
- className: y(
159
+ onMouseEnter: () => a?.(e),
160
+ onMouseLeave: () => a?.(null),
161
+ "aria-label": m(e, "EEEE, MMMM d, yyyy"),
162
+ "aria-selected": r || p || void 0,
163
+ "aria-disabled": !t || s || void 0,
164
+ className: C(
166
165
  "relative flex h-ds-sm w-ds-sm-plus items-center justify-center rounded-ds-md text-ds-md font-body transition-colors duration-fast-01 ease-productive-standard",
167
- !a && "pointer-events-none opacity-0",
168
- a && n && "opacity-action-disabled pointer-events-none cursor-not-allowed",
169
- a && !n && !o && !N && !l && "text-surface-fg hover:bg-surface-raised-hover",
170
- l && !N && "rounded-ds-none bg-surface-raised-hover text-surface-fg",
171
- (o || N) && "bg-accent-9 text-accent-fg hover:bg-accent-10",
172
- ue && !o && !N && !n && "font-semibold text-accent-11"
166
+ !t && "pointer-events-none opacity-0",
167
+ t && s && "opacity-action-disabled pointer-events-none cursor-not-allowed",
168
+ t && !s && !r && !p && !O && "text-surface-fg hover:bg-surface-raised-hover",
169
+ O && !p && "rounded-ds-none bg-surface-raised-hover text-surface-fg",
170
+ (r || p) && "bg-accent-9 text-accent-fg hover:bg-accent-10",
171
+ oe && !r && !p && !s && "font-semibold text-accent-11"
173
172
  ),
174
173
  children: [
175
- D(r, "d"),
176
- pe.length > 0 && /* @__PURE__ */ t("span", { className: "flex gap-px justify-center absolute bottom-[2px] left-0 right-0", children: pe.slice(0, 3).map((ke, Se) => /* @__PURE__ */ t(
174
+ m(e, "d"),
175
+ K.length > 0 && /* @__PURE__ */ i("span", { className: "flex gap-px justify-center absolute bottom-[2px] left-0 right-0", children: K.slice(0, 3).map((re, ne) => /* @__PURE__ */ i(
177
176
  "span",
178
177
  {
179
178
  "data-event-dot": !0,
180
179
  className: "h-[4px] w-[4px] rounded-ds-full",
181
- style: { backgroundColor: ke.color ?? "var(--color-accent-9)" }
180
+ style: { backgroundColor: re.color ?? "var(--color-accent-9)" }
182
181
  },
183
- Se
182
+ ne
184
183
  )) })
185
184
  ]
186
185
  },
187
- s
186
+ n
188
187
  );
189
188
  })
190
189
  ]
@@ -193,791 +192,19 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = g.forwardRef(
193
192
  ] });
194
193
  }
195
194
  );
196
- Q.displayName = "CalendarGrid";
197
- const ie = g.forwardRef(
198
- function({
199
- currentYear: e,
200
- selectedYear: u,
201
- onYearSelect: c,
202
- minDate: i,
203
- maxDate: p,
204
- className: h,
205
- ...f
206
- }, x) {
207
- const k = Math.floor(e / 10) * 10, S = Array.from({ length: 12 }, (M, w) => k + w);
208
- return /* @__PURE__ */ b("div", { ref: x, ...f, className: y("w-[252px]", h), children: [
209
- /* @__PURE__ */ b("div", { className: "text-center pb-ds-04 text-ds-md font-semibold text-surface-fg", children: [
210
- k,
211
- " – ",
212
- k + 11
213
- ] }),
214
- /* @__PURE__ */ t("div", { className: "grid grid-cols-3 gap-ds-02", children: S.map((M) => {
215
- const w = M === u, R = i != null && M < i.getFullYear() || p != null && M > p.getFullYear();
216
- return /* @__PURE__ */ t(
217
- "button",
218
- {
219
- type: "button",
220
- disabled: R || !1,
221
- onClick: () => !R && c(M),
222
- className: y(
223
- "h-ds-sm-plus rounded-ds-md text-ds-md transition-colors",
224
- R && "opacity-action-disabled pointer-events-none cursor-not-allowed",
225
- w && "bg-accent-9 text-accent-fg",
226
- !w && !R && "hover:bg-surface-raised-hover text-surface-fg"
227
- ),
228
- children: M
229
- },
230
- M
231
- );
232
- }) })
233
- ] });
234
- }
235
- );
236
- ie.displayName = "YearPicker";
237
- const $e = [
238
- "Jan",
239
- "Feb",
240
- "Mar",
241
- "Apr",
242
- "May",
243
- "Jun",
244
- "Jul",
245
- "Aug",
246
- "Sep",
247
- "Oct",
248
- "Nov",
249
- "Dec"
250
- ], de = g.forwardRef(
251
- function({
252
- currentYear: e,
253
- selectedMonth: u,
254
- onMonthSelect: c,
255
- minDate: i,
256
- maxDate: p,
257
- className: h,
258
- ...f
259
- }, x) {
260
- return /* @__PURE__ */ b("div", { ref: x, ...f, className: y("w-[252px]", h), children: [
261
- /* @__PURE__ */ t("div", { className: "text-center pb-ds-04 text-ds-md font-semibold text-surface-fg", children: e }),
262
- /* @__PURE__ */ t("div", { className: "grid grid-cols-4 gap-ds-02", children: $e.map((k, S) => {
263
- const M = S === u, w = i != null && (e < i.getFullYear() || e === i.getFullYear() && S < i.getMonth()) || p != null && (e > p.getFullYear() || e === p.getFullYear() && S > p.getMonth());
264
- return /* @__PURE__ */ t(
265
- "button",
266
- {
267
- type: "button",
268
- disabled: w || !1,
269
- onClick: () => !w && c(S),
270
- className: y(
271
- "h-ds-sm-plus rounded-ds-md text-ds-md transition-colors",
272
- w && "opacity-action-disabled pointer-events-none cursor-not-allowed",
273
- M && "bg-accent-9 text-accent-fg",
274
- !M && !w && "hover:bg-surface-raised-hover text-surface-fg"
275
- ),
276
- children: k
277
- },
278
- k
279
- );
280
- }) })
281
- ] });
282
- }
283
- );
284
- de.displayName = "MonthPicker";
285
- const Ie = g.forwardRef(
286
- function({
287
- value: e,
288
- onChange: u,
289
- placeholder: c = "Pick a date",
290
- className: i,
291
- formatStr: p = "MMM d, yyyy",
292
- minDate: h,
293
- maxDate: f,
294
- disabledDates: x,
295
- ...k
296
- }, S) {
297
- const [M, w] = g.useState(!1), [R, v] = g.useState(
298
- e ?? /* @__PURE__ */ new Date()
299
- ), [T, C] = g.useState("days");
300
- g.useEffect(() => {
301
- M || C("days");
302
- }, [M]);
303
- const Y = (P) => {
304
- u?.(P), w(!1);
305
- }, m = () => {
306
- C((P) => P === "days" ? "months" : "years");
307
- }, A = (P) => {
308
- v((E) => re(E, P)), C("days");
309
- }, H = (P) => {
310
- v((E) => oe(E, P)), C("months");
311
- }, O = () => {
312
- switch (T) {
313
- case "years":
314
- return /* @__PURE__ */ t(
315
- ie,
316
- {
317
- currentYear: R.getFullYear(),
318
- selectedYear: e?.getFullYear(),
319
- onYearSelect: H,
320
- minDate: h,
321
- maxDate: f
322
- }
323
- );
324
- case "months":
325
- return /* @__PURE__ */ t(
326
- de,
327
- {
328
- currentYear: R.getFullYear(),
329
- selectedMonth: e?.getMonth(),
330
- onMonthSelect: A,
331
- minDate: h,
332
- maxDate: f
333
- }
334
- );
335
- default:
336
- return /* @__PURE__ */ t(
337
- Q,
338
- {
339
- currentMonth: R,
340
- selected: e,
341
- onSelect: Y,
342
- onMonthChange: v,
343
- onHeaderClick: m,
344
- disabledDates: x,
345
- minDate: h,
346
- maxDate: f
347
- }
348
- );
349
- }
350
- };
351
- return /* @__PURE__ */ b(ae, { open: M, onOpenChange: w, children: [
352
- /* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ b(
353
- "button",
354
- {
355
- ref: S,
356
- type: "button",
357
- "aria-label": e ? `Change date, ${D(e, p)}` : c,
358
- ...k,
359
- className: y(
360
- "inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-overlay px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
361
- "hover:border-surface-border-strong",
362
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
363
- i
364
- ),
365
- children: [
366
- /* @__PURE__ */ t(K, { icon: ve, size: "sm", stroke: "light", className: "text-surface-fg-subtle" }),
367
- /* @__PURE__ */ t(
368
- "span",
369
- {
370
- className: y(
371
- "text-ds-md",
372
- e ? "text-surface-fg" : "text-surface-fg-subtle"
373
- ),
374
- children: e ? D(e, p) : c
375
- }
376
- )
377
- ]
378
- }
379
- ) }),
380
- /* @__PURE__ */ t(
381
- le,
382
- {
383
- className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
384
- align: "start",
385
- sideOffset: 4,
386
- children: O()
387
- }
388
- )
389
- ] });
390
- }
391
- );
392
- Ie.displayName = "DatePicker";
393
- const je = {
394
- today: {
395
- label: "Today",
396
- getRange: () => {
397
- const d = /* @__PURE__ */ new Date();
398
- return { start: B(d), end: _(d) };
399
- }
400
- },
401
- yesterday: {
402
- label: "Yesterday",
403
- getRange: () => {
404
- const d = fe(/* @__PURE__ */ new Date(), 1);
405
- return { start: B(d), end: _(d) };
406
- }
407
- },
408
- last7days: {
409
- label: "Last 7 days",
410
- getRange: () => {
411
- const d = /* @__PURE__ */ new Date();
412
- return { start: B(fe(d, 6)), end: _(d) };
413
- }
414
- },
415
- last30days: {
416
- label: "Last 30 days",
417
- getRange: () => {
418
- const d = /* @__PURE__ */ new Date();
419
- return { start: B(fe(d, 29)), end: _(d) };
420
- }
421
- },
422
- thisMonth: {
423
- label: "This month",
424
- getRange: () => {
425
- const d = /* @__PURE__ */ new Date();
426
- return { start: q(d), end: ge(d) };
427
- }
428
- },
429
- lastMonth: {
430
- label: "Last month",
431
- getRange: () => {
432
- const e = me(/* @__PURE__ */ new Date(), 1);
433
- return { start: q(e), end: ge(e) };
434
- }
435
- },
436
- thisYear: {
437
- label: "This year",
438
- getRange: () => {
439
- const d = /* @__PURE__ */ new Date();
440
- return { start: Te(d), end: _(d) };
441
- }
442
- }
443
- }, Ne = g.forwardRef(
444
- function({ presets: e, onSelect: u, className: c, ...i }, p) {
445
- return /* @__PURE__ */ t("div", { ref: p, ...i, className: y("flex flex-col gap-ds-01", c), children: e.map((h) => {
446
- const f = je[h];
447
- return f ? /* @__PURE__ */ t(
448
- "button",
449
- {
450
- type: "button",
451
- onClick: () => {
452
- const { start: x, end: k } = f.getRange();
453
- u(x, k);
454
- },
455
- className: y(
456
- "h-ds-sm w-full rounded-ds-md px-ds-03 text-left text-ds-sm",
457
- "text-surface-fg transition-colors",
458
- "hover:bg-surface-raised-hover",
459
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9"
460
- ),
461
- children: f.label
462
- },
463
- h
464
- ) : null;
465
- }) });
466
- }
467
- );
468
- Ne.displayName = "Presets";
469
- const ze = g.forwardRef(
470
- function({
471
- startDate: e,
472
- endDate: u,
473
- onChange: c,
474
- placeholder: i = "Pick a date range",
475
- className: p,
476
- formatStr: h = "MMM d, yyyy",
477
- minDate: f,
478
- maxDate: x,
479
- disabledDates: k,
480
- presets: S,
481
- numberOfMonths: M = 1,
482
- ...w
483
- }, R) {
484
- const [v, T] = g.useState(!1), [C, Y] = g.useState(
485
- e ?? /* @__PURE__ */ new Date()
486
- ), [m, A] = g.useState(
487
- e ?? null
488
- ), [H, O] = g.useState(
489
- u ?? null
490
- ), [P, E] = g.useState(null), [W, j] = g.useState("days"), $ = Math.max(1, M);
491
- g.useEffect(() => {
492
- A(e ?? null), O(u ?? null);
493
- }, [e, u]), g.useEffect(() => {
494
- v || j("days");
495
- }, [v]);
496
- const I = (o) => {
497
- if (!m || m && H)
498
- A(o), O(null);
499
- else {
500
- const l = ee(o, m) ? o : m, N = te(o, m) ? o : m;
501
- A(l), O(N), c?.({ start: l, end: N }), T(!1);
502
- }
503
- }, F = (o, l) => {
504
- A(o), O(l), c?.({ start: o, end: l }), T(!1);
505
- }, z = () => {
506
- j((o) => o === "days" ? "months" : "years");
507
- }, L = (o) => {
508
- Y((l) => re(l, o)), j("days");
509
- }, V = (o) => {
510
- Y((l) => oe(l, o)), j("months");
511
- }, r = () => m && H ? `${D(m, h)} - ${D(H, h)}` : i, s = () => $ === 1 ? /* @__PURE__ */ t(
512
- Q,
513
- {
514
- currentMonth: C,
515
- rangeStart: m,
516
- rangeEnd: H,
517
- hoverDate: P,
518
- onSelect: I,
519
- onHover: E,
520
- onMonthChange: Y,
521
- onHeaderClick: z,
522
- disabledDates: k,
523
- minDate: f,
524
- maxDate: x
525
- }
526
- ) : /* @__PURE__ */ t("div", { className: "flex flex-row gap-ds-04", children: Array.from({ length: $ }, (o, l) => /* @__PURE__ */ t(
527
- Q,
528
- {
529
- currentMonth: se(C, l),
530
- rangeStart: m,
531
- rangeEnd: H,
532
- hoverDate: P,
533
- onSelect: I,
534
- onHover: E,
535
- onMonthChange: (N) => {
536
- Y(se(N, -l));
537
- },
538
- onHeaderClick: z,
539
- disabledDates: k,
540
- minDate: f,
541
- maxDate: x,
542
- hidePrevNav: l > 0,
543
- hideNextNav: l < $ - 1
544
- },
545
- l
546
- )) }), a = () => {
547
- switch (W) {
548
- case "years":
549
- return /* @__PURE__ */ t(
550
- ie,
551
- {
552
- currentYear: C.getFullYear(),
553
- selectedYear: m?.getFullYear(),
554
- onYearSelect: V,
555
- minDate: f,
556
- maxDate: x
557
- }
558
- );
559
- case "months":
560
- return /* @__PURE__ */ t(
561
- de,
562
- {
563
- currentYear: C.getFullYear(),
564
- selectedMonth: m?.getMonth(),
565
- onMonthSelect: L,
566
- minDate: f,
567
- maxDate: x
568
- }
569
- );
570
- default:
571
- return s();
572
- }
573
- }, n = S && S.length > 0;
574
- return /* @__PURE__ */ b(ae, { open: v, onOpenChange: T, children: [
575
- /* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ b(
576
- "button",
577
- {
578
- ref: R,
579
- type: "button",
580
- "aria-label": m && H ? `Change date range, ${r()}` : i,
581
- ...w,
582
- className: y(
583
- "inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-overlay px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
584
- "hover:border-surface-border-strong",
585
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
586
- p
587
- ),
588
- children: [
589
- /* @__PURE__ */ t(K, { icon: ve, size: "sm", stroke: "light", className: "text-surface-fg-subtle" }),
590
- /* @__PURE__ */ t(
591
- "span",
592
- {
593
- className: y(
594
- "text-ds-md",
595
- m && H ? "text-surface-fg" : "text-surface-fg-subtle"
596
- ),
597
- children: r()
598
- }
599
- )
600
- ]
601
- }
602
- ) }),
603
- /* @__PURE__ */ t(
604
- le,
605
- {
606
- className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
607
- align: "start",
608
- sideOffset: 4,
609
- children: n ? /* @__PURE__ */ b("div", { className: "flex flex-row gap-ds-04", children: [
610
- /* @__PURE__ */ t("div", { className: "min-w-[140px] border-r border-surface-border-strong pr-ds-04", children: /* @__PURE__ */ t(Ne, { presets: S, onSelect: F }) }),
611
- /* @__PURE__ */ t("div", { children: a() })
612
- ] }) : a()
613
- }
614
- )
615
- ] });
616
- }
617
- );
618
- ze.displayName = "DateRangePicker";
619
- function Z(d, e, u) {
620
- const c = [];
621
- for (let i = d; i <= e; i += u)
622
- c.push(i);
623
- return c;
624
- }
625
- function U(d) {
626
- return d.toString().padStart(2, "0");
627
- }
628
- const Le = g.forwardRef(
629
- function({
630
- value: e,
631
- onChange: u,
632
- format: c = "12h",
633
- minuteStep: i = 1,
634
- secondStep: p = 1,
635
- showSeconds: h = !1,
636
- placeholder: f = "Pick a time",
637
- className: x,
638
- disabled: k = !1,
639
- ...S
640
- }, M) {
641
- const [w, R] = g.useState(!1), v = e ? e.getHours() : null, T = e ? e.getMinutes() : null, C = e ? e.getSeconds() : null, Y = v !== null ? v >= 12 ? "PM" : "AM" : null, m = v !== null ? v === 0 ? 12 : v > 12 ? v - 12 : v : null, A = c === "12h" ? Z(1, 12, 1) : Z(0, 23, 1), H = Z(0, 59, i), O = Z(0, 59, p), P = (s) => {
642
- const a = e ? new Date(e) : /* @__PURE__ */ new Date();
643
- let n = s.hours ?? a.getHours();
644
- const o = s.minutes ?? a.getMinutes(), l = s.seconds ?? a.getSeconds();
645
- c === "12h" && s.hours !== void 0 && ((s.ampm ?? Y ?? "AM") === "AM" ? n = s.hours === 12 ? 0 : s.hours : n = s.hours === 12 ? 12 : s.hours + 12);
646
- let N = G(a, n);
647
- return N = ne(N, o), N = Me(N, l), N;
648
- }, E = (s) => {
649
- const a = P({ hours: s });
650
- u?.(a);
651
- }, W = (s) => {
652
- const a = P({ minutes: s });
653
- u?.(a);
654
- }, j = (s) => {
655
- const a = P({ seconds: s });
656
- u?.(a);
657
- }, $ = (s) => {
658
- if (!e) {
659
- const o = s === "AM" ? 0 : 12;
660
- let l = /* @__PURE__ */ new Date();
661
- l = G(l, o), l = ne(l, 0), l = Me(l, 0), u?.(l);
662
- return;
663
- }
664
- const a = e.getHours();
665
- let n;
666
- s === "AM" ? n = a >= 12 ? a - 12 : a : n = a < 12 ? a + 12 : a, u?.(G(new Date(e), n));
667
- }, I = g.useMemo(() => e ? c === "12h" ? D(e, h ? "h:mm:ss a" : "h:mm a") : D(e, h ? "HH:mm:ss" : "HH:mm") : null, [e, c, h]), F = c === "12h" ? m : v, z = "flex flex-col gap-ds-01 overflow-y-auto max-h-[200px] px-ds-01", L = "flex h-ds-sm w-full items-center justify-center rounded-ds-md text-ds-md transition-colors duration-fast-01 ease-productive-standard cursor-pointer", V = "bg-accent-9 text-accent-fg", r = "text-surface-fg hover:bg-surface-raised-hover";
668
- return /* @__PURE__ */ b(ae, { open: w, onOpenChange: R, children: [
669
- /* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ b(
670
- "button",
671
- {
672
- ref: M,
673
- type: "button",
674
- disabled: k,
675
- ...S,
676
- className: y(
677
- "inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-overlay px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
678
- "hover:border-surface-border-strong",
679
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
680
- k && "opacity-action-disabled pointer-events-none",
681
- x
682
- ),
683
- "aria-label": I ? `Selected time: ${I}` : f,
684
- children: [
685
- /* @__PURE__ */ t(K, { icon: De, size: "sm", stroke: "light", className: "text-surface-fg-subtle" }),
686
- /* @__PURE__ */ t(
687
- "span",
688
- {
689
- className: y(
690
- "text-ds-md",
691
- I ? "text-surface-fg" : "text-surface-fg-subtle"
692
- ),
693
- children: I ?? f
694
- }
695
- )
696
- ]
697
- }
698
- ) }),
699
- /* @__PURE__ */ t(
700
- le,
701
- {
702
- className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
703
- align: "start",
704
- sideOffset: 4,
705
- children: /* @__PURE__ */ b("div", { className: "flex gap-ds-03", role: "group", "aria-label": "Time picker", children: [
706
- /* @__PURE__ */ b("div", { className: "flex flex-col items-center gap-ds-02", children: [
707
- /* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Hr" }),
708
- /* @__PURE__ */ t("div", { className: y(z, "min-w-[48px]"), children: A.map((s) => /* @__PURE__ */ t(
709
- "button",
710
- {
711
- type: "button",
712
- onClick: () => E(s),
713
- className: y(
714
- L,
715
- F === s ? V : r
716
- ),
717
- "aria-label": `${s} hours`,
718
- "aria-selected": F === s || void 0,
719
- children: c === "24h" ? U(s) : s
720
- },
721
- s
722
- )) })
723
- ] }),
724
- /* @__PURE__ */ b("div", { className: "flex flex-col items-center gap-ds-02", children: [
725
- /* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Min" }),
726
- /* @__PURE__ */ t("div", { className: y(z, "min-w-[48px]"), children: H.map((s) => /* @__PURE__ */ t(
727
- "button",
728
- {
729
- type: "button",
730
- onClick: () => W(s),
731
- className: y(
732
- L,
733
- T === s ? V : r
734
- ),
735
- "aria-label": `${U(s)} minutes`,
736
- "aria-selected": T === s || void 0,
737
- children: U(s)
738
- },
739
- s
740
- )) })
741
- ] }),
742
- h && /* @__PURE__ */ b("div", { className: "flex flex-col items-center gap-ds-02", children: [
743
- /* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Sec" }),
744
- /* @__PURE__ */ t("div", { className: y(z, "min-w-[48px]"), children: O.map((s) => /* @__PURE__ */ t(
745
- "button",
746
- {
747
- type: "button",
748
- onClick: () => j(s),
749
- className: y(
750
- L,
751
- C === s ? V : r
752
- ),
753
- "aria-label": `${U(s)} seconds`,
754
- "aria-selected": C === s || void 0,
755
- children: U(s)
756
- },
757
- s
758
- )) })
759
- ] }),
760
- c === "12h" && /* @__PURE__ */ b("div", { className: "flex flex-col items-center gap-ds-02", children: [
761
- /* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: " " }),
762
- /* @__PURE__ */ t("div", { className: "flex flex-col gap-ds-01 px-ds-01", children: ["AM", "PM"].map((s) => /* @__PURE__ */ t(
763
- "button",
764
- {
765
- type: "button",
766
- onClick: () => $(s),
767
- className: y(
768
- L,
769
- "min-w-[44px] font-semibold",
770
- Y === s ? V : r
771
- ),
772
- "aria-label": s,
773
- "aria-selected": Y === s || void 0,
774
- children: s
775
- },
776
- s
777
- )) })
778
- ] })
779
- ] })
780
- }
781
- )
782
- ] });
783
- }
784
- );
785
- Le.displayName = "TimePicker";
786
- function we(d) {
787
- return d.toString().padStart(2, "0");
788
- }
789
- function he(d, e, u) {
790
- const c = [];
791
- for (let i = d; i <= e; i += u)
792
- c.push(i);
793
- return c;
794
- }
795
- const Ve = g.forwardRef(
796
- function({
797
- value: e,
798
- onChange: u,
799
- minDate: c,
800
- maxDate: i,
801
- disabledDates: p,
802
- timeFormat: h = "12h",
803
- minuteStep: f = 1,
804
- placeholder: x = "Pick date & time",
805
- className: k,
806
- ...S
807
- }, M) {
808
- const [w, R] = g.useState(!1), [v, T] = g.useState(e ?? /* @__PURE__ */ new Date()), [C, Y] = g.useState("days");
809
- g.useEffect(() => {
810
- w || Y("days");
811
- }, [w]);
812
- const m = e ? e.getHours() : 0, A = e ? e.getMinutes() : 0, H = m >= 12 ? "PM" : "AM", O = m === 0 ? 12 : m > 12 ? m - 12 : m, P = h === "12h" ? he(1, 12, 1) : he(0, 23, 1), E = he(0, 59, f), W = h === "12h" ? O : m, j = (n) => {
813
- let o = G(n, e ? e.getHours() : m);
814
- o = ne(o, e ? e.getMinutes() : A), u?.(o);
815
- }, $ = () => {
816
- Y((n) => n === "days" ? "months" : "years");
817
- }, I = (n) => {
818
- T((o) => re(o, n)), Y("days");
819
- }, F = (n) => {
820
- T((o) => oe(o, n)), Y("months");
821
- }, z = (n) => {
822
- const o = e ? new Date(e) : /* @__PURE__ */ new Date();
823
- let l = n;
824
- h === "12h" && ((e ? H : "AM") === "AM" ? l = n === 12 ? 0 : n : l = n === 12 ? 12 : n + 12);
825
- const N = G(o, l);
826
- u?.(N);
827
- }, L = (n) => {
828
- const o = e ? new Date(e) : /* @__PURE__ */ new Date(), l = ne(o, n);
829
- u?.(l);
830
- }, V = (n) => {
831
- const o = e ? new Date(e) : /* @__PURE__ */ new Date(), l = o.getHours();
832
- let N;
833
- n === "AM" ? N = l >= 12 ? l - 12 : l : N = l < 12 ? l + 12 : l, u?.(G(o, N));
834
- }, r = g.useMemo(() => e ? D(e, h === "12h" ? "MMM d, yyyy h:mm a" : "MMM d, yyyy HH:mm") : null, [e, h]), s = () => {
835
- switch (C) {
836
- case "years":
837
- return /* @__PURE__ */ t(
838
- ie,
839
- {
840
- currentYear: v.getFullYear(),
841
- selectedYear: e?.getFullYear(),
842
- onYearSelect: F,
843
- minDate: c,
844
- maxDate: i
845
- }
846
- );
847
- case "months":
848
- return /* @__PURE__ */ t(
849
- de,
850
- {
851
- currentYear: v.getFullYear(),
852
- selectedMonth: e?.getMonth(),
853
- onMonthSelect: I,
854
- minDate: c,
855
- maxDate: i
856
- }
857
- );
858
- default:
859
- return /* @__PURE__ */ t(
860
- Q,
861
- {
862
- currentMonth: v,
863
- selected: e,
864
- onSelect: j,
865
- onMonthChange: T,
866
- onHeaderClick: $,
867
- disabledDates: p,
868
- minDate: c,
869
- maxDate: i
870
- }
871
- );
872
- }
873
- }, a = "h-ds-sm rounded-ds-md border border-surface-border-strong bg-surface-overlay px-ds-02 text-ds-md text-surface-fg transition-colors duration-fast-01 ease-productive-standard hover:border-surface-border-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 cursor-pointer appearance-none";
874
- return /* @__PURE__ */ b(ae, { open: w, onOpenChange: R, children: [
875
- /* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ b(
876
- "button",
877
- {
878
- ref: M,
879
- type: "button",
880
- ...S,
881
- className: y(
882
- "inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-overlay px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
883
- "hover:border-surface-border-strong",
884
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
885
- k
886
- ),
887
- "aria-label": r ? `Selected: ${r}` : x,
888
- children: [
889
- /* @__PURE__ */ t(K, { icon: Oe, size: "sm", stroke: "light", className: "text-surface-fg-subtle" }),
890
- /* @__PURE__ */ t(
891
- "span",
892
- {
893
- className: y(
894
- "text-ds-md",
895
- r ? "text-surface-fg" : "text-surface-fg-subtle"
896
- ),
897
- children: r ?? x
898
- }
899
- )
900
- ]
901
- }
902
- ) }),
903
- /* @__PURE__ */ t(
904
- le,
905
- {
906
- className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
907
- align: "start",
908
- sideOffset: 4,
909
- children: /* @__PURE__ */ b("div", { className: "flex flex-col gap-ds-04", children: [
910
- s(),
911
- C === "days" && /* @__PURE__ */ b("div", { className: "flex items-center gap-ds-02 border-t border-surface-border-strong pt-ds-04", children: [
912
- /* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Time" }),
913
- /* @__PURE__ */ b(
914
- "select",
915
- {
916
- value: W ?? "",
917
- onChange: (n) => z(Number(n.target.value)),
918
- className: a,
919
- "aria-label": "Hour",
920
- children: [
921
- !e && /* @__PURE__ */ t("option", { value: "", children: "--" }),
922
- P.map((n) => /* @__PURE__ */ t("option", { value: n, children: h === "24h" ? we(n) : n }, n))
923
- ]
924
- }
925
- ),
926
- /* @__PURE__ */ t("span", { className: "text-ds-md font-semibold text-surface-fg-subtle", children: ":" }),
927
- /* @__PURE__ */ b(
928
- "select",
929
- {
930
- value: e ? A : "",
931
- onChange: (n) => L(Number(n.target.value)),
932
- className: a,
933
- "aria-label": "Minute",
934
- children: [
935
- !e && /* @__PURE__ */ t("option", { value: "", children: "--" }),
936
- E.map((n) => /* @__PURE__ */ t("option", { value: n, children: we(n) }, n))
937
- ]
938
- }
939
- ),
940
- h === "12h" && /* @__PURE__ */ b(
941
- "select",
942
- {
943
- value: e ? H : "",
944
- onChange: (n) => V(n.target.value),
945
- className: a,
946
- "aria-label": "AM or PM",
947
- children: [
948
- !e && /* @__PURE__ */ t("option", { value: "", children: "--" }),
949
- /* @__PURE__ */ t("option", { value: "AM", children: "AM" }),
950
- /* @__PURE__ */ t("option", { value: "PM", children: "PM" })
951
- ]
952
- }
953
- )
954
- ] })
955
- ] })
956
- }
957
- )
958
- ] });
959
- }
960
- );
961
- Ve.displayName = "DateTimePicker";
962
- function Ue(d) {
963
- const [e, u] = Pe(d ?? /* @__PURE__ */ new Date());
195
+ he.displayName = "CalendarGrid";
196
+ function ke(D) {
197
+ const [c, d] = ae(D ?? /* @__PURE__ */ new Date());
964
198
  return {
965
- currentMonth: e,
966
- setCurrentMonth: u,
967
- goToPreviousMonth: () => u((f) => me(f, 1)),
968
- goToNextMonth: () => u((f) => se(f, 1)),
969
- goToMonth: (f) => u((x) => re(x, f)),
970
- goToYear: (f) => u((x) => oe(x, f))
199
+ currentMonth: c,
200
+ setCurrentMonth: d,
201
+ goToPreviousMonth: () => d((a) => z(a, 1)),
202
+ goToNextMonth: () => d((a) => B(a, 1)),
203
+ goToMonth: (a) => d((u) => fe(u, a)),
204
+ goToYear: (a) => d((u) => ue(u, a))
971
205
  };
972
206
  }
973
207
  export {
974
- Q as C,
975
- Ie as D,
976
- de as M,
977
- Ne as P,
978
- Le as T,
979
- ie as Y,
980
- ze as a,
981
- Ve as b,
982
- Ue as u
208
+ he as C,
209
+ ke as u
983
210
  };