@alfadocs/ui-kit 0.17.1 → 0.17.2

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 (100) hide show
  1. package/dist/_chunks/{accordion-DOmxGEWU.js → accordion-CNcodXuO.js} +6 -6
  2. package/dist/_chunks/{ai-prompt-input-DEiQwIMn.js → ai-prompt-input-B-w5Rx3V.js} +184 -181
  3. package/dist/_chunks/{alert-pgdXrEO5.js → alert-DBnawbmf.js} +64 -59
  4. package/dist/_chunks/{audio-recorder-CRh4uyFL.js → audio-recorder-DNkQLW1G.js} +3 -3
  5. package/dist/_chunks/{autocomplete-mOg7WLOh.js → autocomplete-BxfabhZ8.js} +167 -164
  6. package/dist/_chunks/{balance-cell-renderer-DWWtX-VM.js → balance-cell-renderer-DJB6WDPe.js} +2 -2
  7. package/dist/_chunks/{chat-input-UK-bXU7u.js → chat-input-B3XmFGDw.js} +123 -122
  8. package/dist/_chunks/checkbox-group-Bwmt1ovQ.js +213 -0
  9. package/dist/_chunks/{checkbox-D5EHnB14.js → checkbox-mwbrPZDY.js} +75 -70
  10. package/dist/_chunks/{collapsible-CuxUBoHJ.js → collapsible-hHiyZp0b.js} +61 -63
  11. package/dist/_chunks/{color-picker-BPfcByHH.js → color-picker-Bm-gzpsh.js} +2 -2
  12. package/dist/_chunks/{combobox-D5tWe0t_.js → combobox-Da9eq00i.js} +214 -211
  13. package/dist/_chunks/{copy-field-BCHAZ8QV.js → copy-field-BAF4mt9h.js} +95 -132
  14. package/dist/_chunks/{date-picker-BlhtBhPo.js → date-picker-BIoSLRly.js} +222 -219
  15. package/dist/_chunks/{date-range-picker-C2hRu_Ke.js → date-range-picker-9gANFNG9.js} +81 -78
  16. package/dist/_chunks/{date-time-picker-B67mPZmP.js → date-time-picker-DG7BiGdb.js} +98 -95
  17. package/dist/_chunks/{dialog-DRp6Dejy.js → dialog-DUomPCRS.js} +69 -71
  18. package/dist/_chunks/{dropdown-menu-dyV7gHh_.js → dropdown-menu-DZxwF23X.js} +108 -110
  19. package/dist/_chunks/{freemium-paywall-BTEiVkes.js → freemium-paywall-DXc7XlGE.js} +98 -97
  20. package/dist/_chunks/{leo-sidebar-D3TuyH5_.js → leo-sidebar-DIsiTju3.js} +2 -2
  21. package/dist/_chunks/{list-DcjV0m5B.js → list-BdvDctBz.js} +184 -180
  22. package/dist/_chunks/{message-tray-Fsend-du.js → message-tray-BNAS8al4.js} +111 -111
  23. package/dist/_chunks/{multi-select-DooDzQIp.js → multi-select-CyspR5ZF.js} +157 -154
  24. package/dist/_chunks/{navigation-menu-DdufF-_4.js → navigation-menu-CyS1fBJ7.js} +85 -87
  25. package/dist/_chunks/{notification-tray-C3dYdLAF.js → notification-tray-D_69dXFY.js} +114 -114
  26. package/dist/_chunks/{number-input-DH00o0DN.js → number-input-BZXu6bPY.js} +92 -89
  27. package/dist/_chunks/{otp-input-BBXYvLx5.js → otp-input-BDF_iNpa.js} +92 -93
  28. package/dist/_chunks/{pagination-F1ei4khE.js → pagination-BWaXF7W0.js} +194 -211
  29. package/dist/_chunks/{patient-shell-BE0CdPOJ.js → patient-shell-BOOaWZA9.js} +3 -3
  30. package/dist/_chunks/{payment-form-CI77oIx1.js → payment-form-BjkuQeqR.js} +2 -2
  31. package/dist/_chunks/{pdf-viewer-CnEJvmXC.js → pdf-viewer-BG_nsFT5.js} +2 -2
  32. package/dist/_chunks/{radio-group-Cz1a4QCA.js → radio-group-BHZOxrIK.js} +4 -4
  33. package/dist/_chunks/{select-Ca6ibiDL.js → select-C92AT_OZ.js} +7 -7
  34. package/dist/_chunks/{sidebar-D8Lq065m.js → sidebar-BqzlRBvC.js} +271 -291
  35. package/dist/_chunks/{slider-CkR6CLun.js → slider-CfEzeseL.js} +4 -4
  36. package/dist/_chunks/{tabs-CRCyPpJo.js → tabs-aEQfQV3x.js} +8 -8
  37. package/dist/_chunks/{theme-toggle-B3meAb3y.js → theme-toggle-BswYl0Yp.js} +2 -2
  38. package/dist/_chunks/use-controllable-state-BiY4xTzM.js +23 -0
  39. package/dist/_chunks/use-copy-to-clipboard-Cyfc_dlv.js +43 -0
  40. package/dist/_chunks/use-persistent-state-i23OWy6G.js +24 -0
  41. package/dist/_chunks/{warning-stack-CeRihME9.js → warning-stack-CDH9TudY.js} +2 -2
  42. package/dist/_chunks/{workflow-map-D3MvrsZV.js → workflow-map-BeKe23uw.js} +3 -3
  43. package/dist/agent-catalog.json +1 -1
  44. package/dist/components/_shared/use-debounced-callback.d.ts +1 -5
  45. package/dist/components/_shared/use-direction.d.ts +1 -18
  46. package/dist/components/_shared/use-focus-trap.d.ts +1 -31
  47. package/dist/components/accordion/index.js +1 -1
  48. package/dist/components/ai-prompt-input/index.js +1 -1
  49. package/dist/components/alert/index.js +1 -1
  50. package/dist/components/audio-recorder/index.js +1 -1
  51. package/dist/components/autocomplete/index.js +1 -1
  52. package/dist/components/chat-input/index.js +1 -1
  53. package/dist/components/checkbox/index.js +1 -1
  54. package/dist/components/checkbox-group/index.js +1 -1
  55. package/dist/components/collapsible/index.js +1 -1
  56. package/dist/components/color-picker/index.js +1 -1
  57. package/dist/components/combobox/index.js +1 -1
  58. package/dist/components/command-palette/command-palette.d.ts +1 -1
  59. package/dist/components/copy-field/index.js +1 -1
  60. package/dist/components/data-table/index.js +1 -1
  61. package/dist/components/date-picker/index.js +1 -1
  62. package/dist/components/date-range-picker/index.js +1 -1
  63. package/dist/components/date-time-picker/index.js +1 -1
  64. package/dist/components/dialog/index.js +1 -1
  65. package/dist/components/dropdown-menu/index.js +1 -1
  66. package/dist/components/freemium-paywall/index.js +1 -1
  67. package/dist/components/icon-button-group/icon-button-group.d.ts +14 -14
  68. package/dist/components/list/index.js +1 -1
  69. package/dist/components/message-tray/index.js +1 -1
  70. package/dist/components/multi-select/index.js +1 -1
  71. package/dist/components/navigation-menu/index.js +1 -1
  72. package/dist/components/notification-tray/index.js +1 -1
  73. package/dist/components/number-input/index.js +1 -1
  74. package/dist/components/otp-input/index.js +1 -1
  75. package/dist/components/pagination/index.js +1 -1
  76. package/dist/components/payment-form/index.js +1 -1
  77. package/dist/components/pdf-viewer/index.js +1 -1
  78. package/dist/components/radio-group/index.js +1 -1
  79. package/dist/components/select/index.js +1 -1
  80. package/dist/components/sidebar/index.js +8 -7
  81. package/dist/components/sidebar/sidebar.d.ts +1 -1
  82. package/dist/components/slider/index.js +1 -1
  83. package/dist/components/tabs/index.js +1 -1
  84. package/dist/components/theme-toggle/index.js +1 -1
  85. package/dist/components/warning-stack/index.js +1 -1
  86. package/dist/components/workflow/index.js +1 -1
  87. package/dist/hooks/index.d.ts +8 -0
  88. package/dist/hooks/index.js +98 -15
  89. package/dist/hooks/use-debounced-callback.d.ts +19 -0
  90. package/dist/hooks/use-debounced-value.d.ts +16 -0
  91. package/dist/hooks/use-direction.d.ts +19 -0
  92. package/dist/hooks/use-focus-trap.d.ts +32 -0
  93. package/dist/hooks/use-isomorphic-layout-effect.d.ts +13 -0
  94. package/dist/hooks/use-persistent-state.d.ts +16 -0
  95. package/dist/index.js +493 -492
  96. package/dist/patterns/leo-assistant/index.js +1 -1
  97. package/dist/patterns/patient-shell/index.js +1 -1
  98. package/dist/tokens.css +1 -1
  99. package/package.json +4 -2
  100. package/dist/_chunks/checkbox-group-Qkm3Rg1S.js +0 -208
@@ -1,16 +1,17 @@
1
- import { jsx as r, jsxs as u } from "react/jsx-runtime";
2
- import { forwardRef as Q, useState as v, useRef as U, useCallback as X, useMemo as Z, useImperativeHandle as z } from "react";
3
- import { useTranslation as ee } from "react-i18next";
1
+ import { jsx as n, jsxs as f } from "react/jsx-runtime";
2
+ import { forwardRef as J, useState as S, useRef as Q, useCallback as U, useMemo as X, useImperativeHandle as Z } from "react";
3
+ import { useTranslation as z } from "react-i18next";
4
4
  import * as m from "@radix-ui/react-popover";
5
+ import { u as ee } from "./use-controllable-state-BiY4xTzM.js";
5
6
  import { u as te } from "./form-field-context-B3APVHKx.js";
6
- import { a as ae, g as ne, b as re, e as I, c as se, C as oe, d as ie, t as de, p as ce, D as le, f as pe, h as fe } from "./react-day-picker-C5F3-TTX.js";
7
- import { c as ge, b as N, s as ue, f as R, d as me } from "./isSameMonth-5wNF2f4I.js";
7
+ import { a as ae, g as ne, b as re, e as N, c as se, C as oe, d as ie, t as de, p as ce, D as le, f as pe, h as ge } from "./react-day-picker-C5F3-TTX.js";
8
+ import { c as ue, b as I, s as fe, f as b, d as me } from "./isSameMonth-5wNF2f4I.js";
8
9
  import { u as ye } from "./registry-C9nwlNyL.js";
9
- function D(t, s, n) {
10
- return ge(t, -s, n);
10
+ function v(t, r, o) {
11
+ return ue(t, -r, o);
11
12
  }
12
- function he(t, s, n) {
13
- return ae(t, -1, n);
13
+ function he(t, r, o) {
14
+ return ae(t, -1, o);
14
15
  }
15
16
  const ke = {
16
17
  id: "date-range-picker",
@@ -21,11 +22,11 @@ const ke = {
21
22
  descriptionKey: "ui.agent.dateRangePicker.state.range",
22
23
  description: "Currently-selected ISO date range endpoints, each possibly null.",
23
24
  read: (t) => {
24
- var n, l;
25
- const s = t.getRange();
25
+ var o, l;
26
+ const r = t.getRange();
26
27
  return {
27
- from: ((n = s.from) == null ? void 0 : n.toISOString()) ?? null,
28
- to: ((l = s.to) == null ? void 0 : l.toISOString()) ?? null
28
+ from: ((o = r.from) == null ? void 0 : o.toISOString()) ?? null,
29
+ to: ((l = r.to) == null ? void 0 : l.toISOString()) ?? null
29
30
  };
30
31
  }
31
32
  },
@@ -42,8 +43,8 @@ const ke = {
42
43
  argsType: "{ from: string, to: string }",
43
44
  descriptionKey: "ui.agent.dateRangePicker.actions.setRange",
44
45
  description: "Replace the selected range with the given ISO endpoints.",
45
- invoke: (t, s) => {
46
- t.setRange({ from: new Date(s.from), to: new Date(s.to) });
46
+ invoke: (t, r) => {
47
+ t.setRange({ from: new Date(r.from), to: new Date(r.to) });
47
48
  }
48
49
  },
49
50
  clear: {
@@ -83,177 +84,179 @@ const ke = {
83
84
  description: "Sourced from the id prop."
84
85
  }
85
86
  }
86
- }, be = Q(
87
+ }, be = J(
87
88
  ({
88
89
  value: t,
89
- defaultValue: s,
90
- onChange: n,
90
+ defaultValue: r,
91
+ onChange: o,
91
92
  minDate: l,
92
93
  maxDate: T,
93
94
  presets: y,
94
95
  mergePresets: W = !1,
95
- size: P = "md",
96
+ size: R = "md",
96
97
  disabled: V,
97
98
  placeholder: K,
98
99
  className: L,
99
100
  id: F
100
101
  }, j) => {
101
- const { t: o, i18n: A } = ee(), c = te(), h = F ?? c.id, w = c.disabled || V, B = c.invalid ? "error" : "default", i = ne(A.language), H = K ?? o("inputs.dateRangePicker.placeholder", "Select date range"), k = t !== void 0, [_, $] = v(
102
- t ?? s ?? {}
103
- ), a = k ? t : _, [p, f] = v(!1), [Y, M] = v(a.from ?? /* @__PURE__ */ new Date()), q = U(null), d = X(
102
+ const { t: s, i18n: A } = z(), c = te(), h = F ?? c.id, D = c.disabled || V, B = c.invalid ? "error" : "default", i = ne(A.language), H = K ?? s("inputs.dateRangePicker.placeholder", "Select date range"), [_, P] = ee({
103
+ value: t,
104
+ defaultValue: r ?? {},
105
+ onChange: o
106
+ }), a = _ ?? {}, [p, g] = S(!1), [$, w] = S(a.from ?? /* @__PURE__ */ new Date()), Y = Q(null), d = U(
104
107
  (e) => {
105
- k || $(e), n == null || n(e);
108
+ P(e);
106
109
  },
107
- [k, n]
108
- ), E = re(l, T), O = [
110
+ [P]
111
+ ), q = re(l, T), M = [
109
112
  {
110
- label: o("inputs.dateRangePicker.presets.today", "Today"),
113
+ label: s("inputs.dateRangePicker.presets.today", "Today"),
111
114
  range: () => {
112
115
  const e = /* @__PURE__ */ new Date();
113
116
  return { from: e, to: e };
114
117
  }
115
118
  },
116
119
  {
117
- label: o("inputs.dateRangePicker.presets.yesterday", "Yesterday"),
120
+ label: s("inputs.dateRangePicker.presets.yesterday", "Yesterday"),
118
121
  range: () => {
119
- const e = D(/* @__PURE__ */ new Date(), 1);
122
+ const e = v(/* @__PURE__ */ new Date(), 1);
120
123
  return { from: e, to: e };
121
124
  }
122
125
  },
123
126
  {
124
- label: o("inputs.dateRangePicker.presets.last7", "Last 7 days"),
127
+ label: s("inputs.dateRangePicker.presets.last7", "Last 7 days"),
125
128
  range: () => ({
126
- from: D(/* @__PURE__ */ new Date(), 6),
129
+ from: v(/* @__PURE__ */ new Date(), 6),
127
130
  to: /* @__PURE__ */ new Date()
128
131
  })
129
132
  },
130
133
  {
131
- label: o("inputs.dateRangePicker.presets.thisWeek", "This week"),
134
+ label: s("inputs.dateRangePicker.presets.thisWeek", "This week"),
132
135
  range: () => ({
133
- from: N(/* @__PURE__ */ new Date(), { locale: i }),
134
- to: I(/* @__PURE__ */ new Date(), { locale: i })
136
+ from: I(/* @__PURE__ */ new Date(), { locale: i }),
137
+ to: N(/* @__PURE__ */ new Date(), { locale: i })
135
138
  })
136
139
  },
137
140
  {
138
- label: o("inputs.dateRangePicker.presets.lastWeek", "Last week"),
141
+ label: s("inputs.dateRangePicker.presets.lastWeek", "Last week"),
139
142
  range: () => {
140
143
  const e = he(/* @__PURE__ */ new Date());
141
144
  return {
142
- from: N(e, { locale: i }),
143
- to: I(e, { locale: i })
145
+ from: I(e, { locale: i }),
146
+ to: N(e, { locale: i })
144
147
  };
145
148
  }
146
149
  },
147
150
  {
148
- label: o("inputs.dateRangePicker.presets.thisMonth", "This month"),
151
+ label: s("inputs.dateRangePicker.presets.thisMonth", "This month"),
149
152
  range: () => ({
150
- from: ue(/* @__PURE__ */ new Date()),
153
+ from: fe(/* @__PURE__ */ new Date()),
151
154
  to: se(/* @__PURE__ */ new Date())
152
155
  })
153
156
  },
154
157
  {
155
- label: o("inputs.dateRangePicker.presets.last30", "Last 30 days"),
158
+ label: s("inputs.dateRangePicker.presets.last30", "Last 30 days"),
156
159
  range: () => ({
157
- from: D(/* @__PURE__ */ new Date(), 29),
160
+ from: v(/* @__PURE__ */ new Date(), 29),
158
161
  to: /* @__PURE__ */ new Date()
159
162
  })
160
163
  }
161
- ], x = y ? W ? [...O, ...y] : y : O, G = (e) => {
164
+ ], C = y ? W ? [...M, ...y] : y : M, E = (e) => {
162
165
  d(e ? { from: e.from, to: e.to } : {});
163
- }, J = (e) => {
164
- const g = e.range();
165
- d(g), M(g.from), f(!1);
166
- }, S = (() => {
166
+ }, G = (e) => {
167
+ const u = e.range();
168
+ d(u), w(u.from), g(!1);
169
+ }, O = (() => {
167
170
  if (a.from && a.to) {
168
- const e = R(a.from, "MMM d, yyyy", { locale: i }), g = R(a.to, "MMM d, yyyy", { locale: i });
169
- return `${e} – ${g}`;
171
+ const e = b(a.from, "MMM d, yyyy", { locale: i }), u = b(a.to, "MMM d, yyyy", { locale: i });
172
+ return `${e} – ${u}`;
170
173
  }
171
- return a.from ? R(a.from, "MMM d, yyyy", { locale: i }) : "";
172
- })(), C = (() => {
174
+ return a.from ? b(a.from, "MMM d, yyyy", { locale: i }) : "";
175
+ })(), x = (() => {
173
176
  if (a.from && a.to) {
174
177
  const e = me(a.to, a.from) + 1;
175
- return o("inputs.dateRangePicker.days", "{{count}} days", {
178
+ return s("inputs.dateRangePicker.days", "{{count}} days", {
176
179
  count: e
177
180
  });
178
181
  }
179
182
  return "";
180
- })(), b = Z(
183
+ })(), k = X(
181
184
  () => ({
182
185
  getRange: () => a,
183
186
  setRange: (e) => d(e),
184
187
  clear: () => d({}),
185
188
  isOpen: () => p,
186
- open: () => f(!0),
187
- close: () => f(!1)
189
+ open: () => g(!0),
190
+ close: () => g(!1)
188
191
  }),
189
192
  [a, d, p]
190
193
  );
191
- return z(j, () => b, [b]), ye(ke, b, h), /* @__PURE__ */ r(m.Root, { open: p, onOpenChange: f, children: /* @__PURE__ */ u(
194
+ return Z(j, () => k, [k]), ye(ke, k, h), /* @__PURE__ */ n(m.Root, { open: p, onOpenChange: g, children: /* @__PURE__ */ f(
192
195
  "div",
193
196
  {
194
197
  className: L,
195
198
  "data-component": "date-range-picker",
196
199
  "data-component-id": h,
197
200
  children: [
198
- /* @__PURE__ */ r(m.Trigger, { asChild: !0, disabled: w, children: /* @__PURE__ */ u(
201
+ /* @__PURE__ */ n(m.Trigger, { asChild: !0, disabled: D, children: /* @__PURE__ */ f(
199
202
  "button",
200
203
  {
201
- ref: q,
204
+ ref: Y,
202
205
  id: h,
203
206
  type: "button",
204
- disabled: w,
207
+ disabled: D,
205
208
  "aria-describedby": c.describedBy || void 0,
206
209
  "aria-invalid": c.invalid || void 0,
207
210
  "aria-haspopup": "dialog",
208
211
  "aria-expanded": p,
209
- className: de({ size: P, tone: B }),
212
+ className: de({ size: R, tone: B }),
210
213
  children: [
211
- /* @__PURE__ */ r(
214
+ /* @__PURE__ */ n(
212
215
  "span",
213
216
  {
214
- className: S ? "ds:text-foreground" : "ds:text-muted-foreground",
215
- children: S || H
217
+ className: O ? "ds:text-foreground" : "ds:text-muted-foreground",
218
+ children: O || H
216
219
  }
217
220
  ),
218
- /* @__PURE__ */ r(
221
+ /* @__PURE__ */ n(
219
222
  "span",
220
223
  {
221
224
  "aria-hidden": "true",
222
- className: ie({ size: P }),
223
- children: /* @__PURE__ */ r(oe, {})
225
+ className: ie({ size: R }),
226
+ children: /* @__PURE__ */ n(oe, {})
224
227
  }
225
228
  )
226
229
  ]
227
230
  }
228
231
  ) }),
229
- /* @__PURE__ */ r(m.Portal, { children: /* @__PURE__ */ r(
232
+ /* @__PURE__ */ n(m.Portal, { children: /* @__PURE__ */ n(
230
233
  m.Content,
231
234
  {
232
235
  sideOffset: 4,
233
236
  align: "start",
234
- className: fe(),
235
- children: /* @__PURE__ */ u("div", { className: "ds:flex ds:gap-[var(--spacing-md)]", children: [
236
- x.length > 0 ? /* @__PURE__ */ r("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:min-w-[8rem] ds:border-e ds:border-border ds:pe-[var(--spacing-md)]", children: x.map((e) => /* @__PURE__ */ r(
237
+ className: ge(),
238
+ children: /* @__PURE__ */ f("div", { className: "ds:flex ds:gap-[var(--spacing-md)]", children: [
239
+ C.length > 0 ? /* @__PURE__ */ n("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:min-w-[8rem] ds:border-e ds:border-border ds:pe-[var(--spacing-md)]", children: C.map((e) => /* @__PURE__ */ n(
237
240
  "button",
238
241
  {
239
242
  type: "button",
240
- onClick: () => J(e),
243
+ onClick: () => G(e),
241
244
  className: ce(),
242
245
  children: e.label
243
246
  },
244
247
  e.label
245
248
  )) }) : null,
246
- /* @__PURE__ */ u("div", { children: [
247
- /* @__PURE__ */ r(
249
+ /* @__PURE__ */ f("div", { children: [
250
+ /* @__PURE__ */ n(
248
251
  le,
249
252
  {
250
253
  mode: "range",
251
254
  selected: a.from ? { from: a.from, to: a.to } : void 0,
252
- onSelect: G,
253
- month: Y,
254
- onMonthChange: M,
255
+ onSelect: E,
256
+ month: $,
257
+ onMonthChange: w,
255
258
  numberOfMonths: 2,
256
- disabled: E,
259
+ disabled: q,
257
260
  locale: i,
258
261
  showOutsideDays: !0,
259
262
  fixedWeeks: !0,
@@ -261,13 +264,13 @@ const ke = {
261
264
  components: { Chevron: pe }
262
265
  }
263
266
  ),
264
- C ? /* @__PURE__ */ r(
267
+ x ? /* @__PURE__ */ n(
265
268
  "div",
266
269
  {
267
270
  role: "status",
268
271
  "aria-live": "polite",
269
272
  className: "type-body-sm ds:text-muted-foreground ds:mt-[var(--spacing-sm)] ds:text-center",
270
- children: C
273
+ children: x
271
274
  }
272
275
  ) : null
273
276
  ] })
@@ -284,4 +287,4 @@ export {
284
287
  be as D,
285
288
  ke as d
286
289
  };
287
- //# sourceMappingURL=date-range-picker-C2hRu_Ke.js.map
290
+ //# sourceMappingURL=date-range-picker-9gANFNG9.js.map
@@ -1,21 +1,22 @@
1
- import { jsx as r, jsxs as T } from "react/jsx-runtime";
2
- import { forwardRef as oe, useState as p, useRef as de, useCallback as F, useMemo as ce, useImperativeHandle as le } from "react";
3
- import { c as ue } from "./index-D2ZczOXr.js";
4
- import { useTranslation as me } from "react-i18next";
1
+ import { jsx as s, jsxs as y } from "react/jsx-runtime";
2
+ import { forwardRef as ne, useState as T, useRef as oe, useCallback as F, useMemo as de, useImperativeHandle as le } from "react";
3
+ import { c as ce } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as ue } from "react-i18next";
5
5
  import * as k from "@radix-ui/react-popover";
6
+ import { u as me } from "./use-controllable-state-BiY4xTzM.js";
6
7
  import { u as pe } from "./form-field-context-B3APVHKx.js";
7
8
  import { T as fe } from "./time-picker-DeVZkIY2.js";
8
- import { g as ge, b as he, i as ve, j as be, C as ye, d as Te, t as ke, D as we, f as De, h as Pe } from "./react-day-picker-C5F3-TTX.js";
9
- import { f as xe } from "./isSameMonth-5wNF2f4I.js";
10
- import { u as Ce } from "./registry-C9nwlNyL.js";
9
+ import { g as ge, b as he, i as ve, j as be, C as ye, d as Te, t as ke, D as we, f as De, h as Ce } from "./react-day-picker-C5F3-TTX.js";
10
+ import { f as Pe } from "./isSameMonth-5wNF2f4I.js";
11
+ import { u as xe } from "./registry-C9nwlNyL.js";
11
12
  import { t as j } from "./isSameDay-ecuM8PBB.js";
12
- function K(e, s, a) {
13
- const i = j(e, a == null ? void 0 : a.in);
14
- return i.setHours(s), i;
13
+ function K(e, t, r) {
14
+ const i = j(e, r == null ? void 0 : r.in);
15
+ return i.setHours(t), i;
15
16
  }
16
- function A(e, s, a) {
17
- const i = j(e, a == null ? void 0 : a.in);
18
- return i.setMinutes(s), i;
17
+ function A(e, t, r) {
18
+ const i = j(e, r == null ? void 0 : r.in);
19
+ return i.setMinutes(t), i;
19
20
  }
20
21
  const Oe = {
21
22
  id: "date-time-picker",
@@ -26,8 +27,8 @@ const Oe = {
26
27
  descriptionKey: "ui.agent.dateTimePicker.state.value",
27
28
  description: "Currently-selected ISO datetime, or null.",
28
29
  read: (e) => {
29
- var s;
30
- return ((s = e.getValue()) == null ? void 0 : s.toISOString()) ?? null;
30
+ var t;
31
+ return ((t = e.getValue()) == null ? void 0 : t.toISOString()) ?? null;
31
32
  }
32
33
  },
33
34
  isOpen: {
@@ -43,8 +44,8 @@ const Oe = {
43
44
  argsType: "{ datetime: string }",
44
45
  descriptionKey: "ui.agent.dateTimePicker.actions.setDatetime",
45
46
  description: "Select a specific datetime (ISO string).",
46
- invoke: (e, s) => {
47
- e.setValue(new Date(s.datetime));
47
+ invoke: (e, t) => {
48
+ e.setValue(new Date(t.datetime));
48
49
  }
49
50
  },
50
51
  clear: {
@@ -85,13 +86,13 @@ const Oe = {
85
86
  }
86
87
  }
87
88
  };
88
- function Me(e, s) {
89
- var a;
89
+ function Me(e, t) {
90
+ var r;
90
91
  try {
91
92
  const i = { timeZoneName: "short" };
92
- return s && s !== "local" && (i.timeZone = s === "utc" ? "UTC" : s), ((a = new Intl.DateTimeFormat(e, i).formatToParts(
93
+ return t && t !== "local" && (i.timeZone = t === "utc" ? "UTC" : t), ((r = new Intl.DateTimeFormat(e, i).formatToParts(
93
94
  /* @__PURE__ */ new Date()
94
- ).find((d) => d.type === "timeZoneName")) == null ? void 0 : a.value) ?? "";
95
+ ).find((d) => d.type === "timeZoneName")) == null ? void 0 : r.value) ?? "";
95
96
  } catch {
96
97
  return "";
97
98
  }
@@ -99,13 +100,13 @@ function Me(e, s) {
99
100
  function Ne(e) {
100
101
  if (!e || e === "local") return !1;
101
102
  try {
102
- const s = Intl.DateTimeFormat().resolvedOptions().timeZone;
103
- return e === "utc" ? s !== "UTC" : s !== e;
103
+ const t = Intl.DateTimeFormat().resolvedOptions().timeZone;
104
+ return e === "utc" ? t !== "UTC" : t !== e;
104
105
  } catch {
105
106
  return !1;
106
107
  }
107
108
  }
108
- const Ve = ue(
109
+ const Ve = ce(
109
110
  [
110
111
  "ds:w-full ds:rounded-[var(--radius-sm)]",
111
112
  "ds:bg-primary ds:text-primary-foreground",
@@ -125,139 +126,141 @@ const Ve = ue(
125
126
  },
126
127
  defaultVariants: { size: "md" }
127
128
  }
128
- ), Ie = oe(
129
+ ), Se = ne(
129
130
  ({
130
131
  value: e,
131
- defaultValue: s,
132
- onChange: a,
132
+ defaultValue: t,
133
+ onChange: r,
133
134
  timezone: i,
134
135
  showTimezone: w,
135
136
  minDate: d,
136
- maxDate: f,
137
+ maxDate: p,
137
138
  hour12: B,
138
139
  minuteStep: Z = 1,
139
- size: g = "md",
140
+ size: f = "md",
140
141
  disabled: _,
141
142
  placeholder: z,
142
143
  className: E,
143
144
  id: U
144
145
  }, W) => {
145
- const { t: c, i18n: N } = me(), l = pe(), D = U ?? l.id, V = l.disabled || _, q = l.invalid ? "error" : "default", I = ge(N.language), G = z ?? c("inputs.dateTimePicker.placeholder", "Select date and time"), J = c("inputs.dateTimePicker.apply", "Apply"), Q = c(
146
+ const { t: l, i18n: M } = ue(), c = pe(), D = U ?? c.id, N = c.disabled || _, q = c.invalid ? "error" : "default", V = ge(M.language), G = z ?? l("inputs.dateTimePicker.placeholder", "Select date and time"), J = l("inputs.dateTimePicker.apply", "Apply"), Q = l(
146
147
  "inputs.dateTimePicker.outOfRange",
147
148
  "Date/time is out of allowed range"
148
- ), S = (w !== void 0 ? w : Ne(i)) ? Me(N.language, i) : "", P = e !== void 0, [X, Y] = p(
149
- e ?? s
150
- ), n = P ? e : X, [o, h] = p(n), [v, b] = p(!1), [$, x] = p(n ?? /* @__PURE__ */ new Date()), [L, u] = p(!1), R = de(null), y = F(
151
- (t) => {
152
- P || Y(t), a == null || a(t);
149
+ ), S = (w !== void 0 ? w : Ne(i)) ? Me(M.language, i) : "", [X, I] = me({
150
+ value: e,
151
+ defaultValue: t,
152
+ onChange: r
153
+ }), n = X, [o, g] = T(n), [h, v] = T(!1), [Y, C] = T(n ?? /* @__PURE__ */ new Date()), [R, u] = T(!1), L = oe(null), b = F(
154
+ (a) => {
155
+ I(a);
153
156
  },
154
- [P, a]
155
- ), ee = he(d, f), C = F(
156
- (t) => !(d && ve(t, d) || f && be(t, f)),
157
- [d, f]
158
- ), te = (t) => {
159
- t && (h(n ?? /* @__PURE__ */ new Date()), x(n ?? /* @__PURE__ */ new Date()), u(!1)), b(t);
160
- }, se = (t) => {
161
- if (!t) return;
162
- const M = o ?? /* @__PURE__ */ new Date(), m = A(
163
- K(t, M.getHours()),
164
- M.getMinutes()
157
+ [I]
158
+ ), $ = he(d, p), P = F(
159
+ (a) => !(d && ve(a, d) || p && be(a, p)),
160
+ [d, p]
161
+ ), ee = (a) => {
162
+ a && (g(n ?? /* @__PURE__ */ new Date()), C(n ?? /* @__PURE__ */ new Date()), u(!1)), v(a);
163
+ }, te = (a) => {
164
+ if (!a) return;
165
+ const O = o ?? /* @__PURE__ */ new Date(), m = A(
166
+ K(a, O.getHours()),
167
+ O.getMinutes()
165
168
  );
166
- h(m), u(!C(m));
167
- }, ae = (t) => {
168
- const m = A(K(o ?? /* @__PURE__ */ new Date(), t.hours), t.minutes);
169
- h(m), u(!C(m));
170
- }, re = () => {
171
- var t;
169
+ g(m), u(!P(m));
170
+ }, ae = (a) => {
171
+ const m = A(K(o ?? /* @__PURE__ */ new Date(), a.hours), a.minutes);
172
+ g(m), u(!P(m));
173
+ }, se = () => {
174
+ var a;
172
175
  if (o) {
173
- if (!C(o)) {
176
+ if (!P(o)) {
174
177
  u(!0);
175
178
  return;
176
179
  }
177
- y(o), b(!1), (t = R.current) == null || t.focus();
180
+ b(o), v(!1), (a = L.current) == null || a.focus();
178
181
  }
179
- }, H = n ? xe(n, "MMM d, yyyy HH:mm", { locale: I }) : "", ie = c("inputs.datePicker.gridLabel", "Calendar"), ne = c("inputs.timePicker.groupLabel", "Time"), O = ce(
182
+ }, H = n ? Pe(n, "MMM d, yyyy HH:mm", { locale: V }) : "", re = l("inputs.datePicker.gridLabel", "Calendar"), ie = l("inputs.timePicker.groupLabel", "Time"), x = de(
180
183
  () => ({
181
184
  getValue: () => n,
182
- setValue: (t) => y(t),
183
- clear: () => y(void 0),
184
- isOpen: () => v,
185
+ setValue: (a) => b(a),
186
+ clear: () => b(void 0),
187
+ isOpen: () => h,
185
188
  // Mirror the trigger's open behaviour so draft state seeds correctly.
186
189
  open: () => {
187
- h(n ?? /* @__PURE__ */ new Date()), x(n ?? /* @__PURE__ */ new Date()), u(!1), b(!0);
190
+ g(n ?? /* @__PURE__ */ new Date()), C(n ?? /* @__PURE__ */ new Date()), u(!1), v(!0);
188
191
  },
189
- close: () => b(!1)
192
+ close: () => v(!1)
190
193
  }),
191
- [n, y, v]
194
+ [n, b, h]
192
195
  );
193
- return le(W, () => O, [O]), Ce(Oe, O, D), /* @__PURE__ */ r(k.Root, { open: v, onOpenChange: te, children: /* @__PURE__ */ T(
196
+ return le(W, () => x, [x]), xe(Oe, x, D), /* @__PURE__ */ s(k.Root, { open: h, onOpenChange: ee, children: /* @__PURE__ */ y(
194
197
  "div",
195
198
  {
196
199
  className: E,
197
200
  "data-component": "date-time-picker",
198
201
  "data-component-id": D,
199
202
  children: [
200
- /* @__PURE__ */ r(k.Trigger, { asChild: !0, disabled: V, children: /* @__PURE__ */ T(
203
+ /* @__PURE__ */ s(k.Trigger, { asChild: !0, disabled: N, children: /* @__PURE__ */ y(
201
204
  "button",
202
205
  {
203
- ref: R,
206
+ ref: L,
204
207
  id: D,
205
208
  type: "button",
206
- disabled: V,
207
- "aria-describedby": l.describedBy || void 0,
208
- "aria-invalid": l.invalid || void 0,
209
+ disabled: N,
210
+ "aria-describedby": c.describedBy || void 0,
211
+ "aria-invalid": c.invalid || void 0,
209
212
  "aria-haspopup": "dialog",
210
- "aria-expanded": v,
211
- className: ke({ size: g, tone: q }),
213
+ "aria-expanded": h,
214
+ className: ke({ size: f, tone: q }),
212
215
  children: [
213
- /* @__PURE__ */ r(
216
+ /* @__PURE__ */ s(
214
217
  "span",
215
218
  {
216
219
  className: H ? "ds:text-foreground" : "ds:text-muted-foreground",
217
220
  children: H || G
218
221
  }
219
222
  ),
220
- /* @__PURE__ */ r(
223
+ /* @__PURE__ */ s(
221
224
  "span",
222
225
  {
223
226
  "aria-hidden": "true",
224
- className: Te({ size: g }),
225
- children: /* @__PURE__ */ r(ye, {})
227
+ className: Te({ size: f }),
228
+ children: /* @__PURE__ */ s(ye, {})
226
229
  }
227
230
  )
228
231
  ]
229
232
  }
230
233
  ) }),
231
- /* @__PURE__ */ r(k.Portal, { children: /* @__PURE__ */ r(
234
+ /* @__PURE__ */ s(k.Portal, { children: /* @__PURE__ */ s(
232
235
  k.Content,
233
236
  {
234
237
  sideOffset: 4,
235
238
  align: "start",
236
- className: Pe(),
237
- children: /* @__PURE__ */ T("div", { className: "ds:flex ds:flex-col ds:sm:flex-row ds:gap-[var(--spacing-md)]", children: [
238
- /* @__PURE__ */ r("div", { role: "region", "aria-label": ie, children: /* @__PURE__ */ r(
239
+ className: Ce(),
240
+ children: /* @__PURE__ */ y("div", { className: "ds:flex ds:flex-col ds:sm:flex-row ds:gap-[var(--spacing-md)]", children: [
241
+ /* @__PURE__ */ s("div", { role: "region", "aria-label": re, children: /* @__PURE__ */ s(
239
242
  we,
240
243
  {
241
244
  mode: "single",
242
245
  selected: o,
243
- onSelect: se,
244
- month: $,
245
- onMonthChange: x,
246
- disabled: ee,
247
- locale: I,
246
+ onSelect: te,
247
+ month: Y,
248
+ onMonthChange: C,
249
+ disabled: $,
250
+ locale: V,
248
251
  showOutsideDays: !0,
249
252
  fixedWeeks: !0,
250
253
  components: { Chevron: De }
251
254
  }
252
255
  ) }),
253
- /* @__PURE__ */ T(
256
+ /* @__PURE__ */ y(
254
257
  "div",
255
258
  {
256
259
  role: "region",
257
- "aria-label": ne,
260
+ "aria-label": ie,
258
261
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:sm:border-s ds:sm:border-border ds:sm:ps-[var(--spacing-md)] ds:min-w-[10rem]",
259
262
  children: [
260
- /* @__PURE__ */ r(
263
+ /* @__PURE__ */ s(
261
264
  fe,
262
265
  {
263
266
  value: o ? {
@@ -267,11 +270,11 @@ const Ve = ue(
267
270
  onChange: ae,
268
271
  hour12: B,
269
272
  minuteStep: Z,
270
- size: g
273
+ size: f
271
274
  }
272
275
  ),
273
- S ? /* @__PURE__ */ r("span", { className: "type-meta ds:text-muted-foreground", children: S }) : null,
274
- L ? /* @__PURE__ */ r(
276
+ S ? /* @__PURE__ */ s("span", { className: "type-meta ds:text-muted-foreground", children: S }) : null,
277
+ R ? /* @__PURE__ */ s(
275
278
  "span",
276
279
  {
277
280
  role: "alert",
@@ -279,13 +282,13 @@ const Ve = ue(
279
282
  children: Q
280
283
  }
281
284
  ) : null,
282
- /* @__PURE__ */ r(
285
+ /* @__PURE__ */ s(
283
286
  "button",
284
287
  {
285
288
  type: "button",
286
- onClick: re,
287
- disabled: !o || L,
288
- className: Ve({ size: g }),
289
+ onClick: se,
290
+ disabled: !o || R,
291
+ className: Ve({ size: f }),
289
292
  children: J
290
293
  }
291
294
  )
@@ -300,9 +303,9 @@ const Ve = ue(
300
303
  ) });
301
304
  }
302
305
  );
303
- Ie.displayName = "DateTimePicker";
306
+ Se.displayName = "DateTimePicker";
304
307
  export {
305
- Ie as D,
308
+ Se as D,
306
309
  Oe as d
307
310
  };
308
- //# sourceMappingURL=date-time-picker-B67mPZmP.js.map
311
+ //# sourceMappingURL=date-time-picker-DG7BiGdb.js.map