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