@alfadocs/ui-kit-debug 0.93.0 → 0.95.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 (36) hide show
  1. package/dist/_chunks/apexcharts-theme-B_AxGC_h.js +72 -0
  2. package/dist/_chunks/apexcharts-theme-B_AxGC_h.js.map +1 -0
  3. package/dist/_chunks/chart-DR68TJD5.js +705 -0
  4. package/dist/_chunks/chart-DR68TJD5.js.map +1 -0
  5. package/dist/_chunks/{date-range-picker-Cc4DLAL2.js → date-range-picker-pEG3Ln3i.js} +315 -290
  6. package/dist/_chunks/date-range-picker-pEG3Ln3i.js.map +1 -0
  7. package/dist/_chunks/{link-cell-renderer-DQjZeoAr.js → link-cell-renderer-flfZh2qY.js} +2 -2
  8. package/dist/_chunks/{link-cell-renderer-DQjZeoAr.js.map → link-cell-renderer-flfZh2qY.js.map} +1 -1
  9. package/dist/_chunks/{patient-table-DU_zFZoq.js → patient-table-CvZTIM2R.js} +2 -2
  10. package/dist/_chunks/{patient-table-DU_zFZoq.js.map → patient-table-CvZTIM2R.js.map} +1 -1
  11. package/dist/_chunks/{radiograph-panel.agent-rnrQZtK3.js → radiograph-panel.agent-AsXJBr1p.js} +2 -2
  12. package/dist/_chunks/{radiograph-panel.agent-rnrQZtK3.js.map → radiograph-panel.agent-AsXJBr1p.js.map} +1 -1
  13. package/dist/_chunks/{sparkline-iOXYgvJe.js → sparkline-DcXqRZoq.js} +2 -2
  14. package/dist/_chunks/{sparkline-iOXYgvJe.js.map → sparkline-DcXqRZoq.js.map} +1 -1
  15. package/dist/agent-catalog.json +9 -1
  16. package/dist/components/chart/chart.agent.d.ts.map +1 -1
  17. package/dist/components/chart/chart.d.ts +27 -0
  18. package/dist/components/chart/chart.d.ts.map +1 -1
  19. package/dist/components/chart/index.js +1 -1
  20. package/dist/components/data-table/index.js +1 -1
  21. package/dist/components/date-range-picker/date-range-picker.d.ts +22 -1
  22. package/dist/components/date-range-picker/date-range-picker.d.ts.map +1 -1
  23. package/dist/components/date-range-picker/index.js +1 -1
  24. package/dist/components/patient-table/index.js +1 -1
  25. package/dist/components/radiograph-panel/index.js +1 -1
  26. package/dist/components/sparkline/index.js +1 -1
  27. package/dist/index.js +6 -6
  28. package/dist/tokens/apexcharts-theme.d.ts +22 -1
  29. package/dist/tokens/apexcharts-theme.d.ts.map +1 -1
  30. package/dist/tokens.css +1 -1
  31. package/package.json +1 -1
  32. package/dist/_chunks/apexcharts-theme-BJigns_V.js +0 -53
  33. package/dist/_chunks/apexcharts-theme-BJigns_V.js.map +0 -1
  34. package/dist/_chunks/chart-CNaLgvx4.js +0 -633
  35. package/dist/_chunks/chart-CNaLgvx4.js.map +0 -1
  36. package/dist/_chunks/date-range-picker-Cc4DLAL2.js.map +0 -1
@@ -1,25 +1,25 @@
1
- import { jsx as r, jsxs as c, Fragment as xt } from "react/jsx-runtime";
2
- import { forwardRef as Pt, useState as y, useRef as ie, useId as E, useCallback as Ge, useEffect as Me, useMemo as Nt, useImperativeHandle as Dt, Fragment as Ct } from "react";
3
- import { useTranslation as wt } from "react-i18next";
4
- import * as j from "@radix-ui/react-popover";
5
- import * as q from "@radix-ui/react-radio-group";
6
- import { u as Ve } from "./use-controllable-state-BiY4xTzM.js";
7
- import { u as St } from "./form-field-context-B3APVHKx.js";
8
- import { S as It } from "./switch-OILsBLWo.js";
9
- import { u as Ot } from "./registry-DvAUVLHh.js";
10
- import { l as Tt, m as Et, u as Gt, g as Mt, b as Vt, f as h, n as Fe, s as Ke, o as Ft, q as Kt, k as de, a as Lt, d as $t, t as At, r as Le, v as $e, w as Ae, p as Wt, x as jt, D as qt, C as _t, y as zt, e as Bt, z as _, h as Yt, j as Ut, i as le, c as Ht } from "./date-picker-variants-eL6HjWvw.js";
11
- import { s as G } from "./subDays-BcNi04uf.js";
12
- import { C as Qt } from "./calendar-days-BGWklvE-.js";
13
- import { C as Jt } from "./check-DrFSN__t.js";
14
- import { i as We } from "./isSameDay-DUEiAT0G.js";
15
- import { p as Xt } from "./parse-DvA97ro9.js";
16
- function Zt(s, l, f) {
17
- return Tt(s, -1, f);
1
+ import { jsx as r, jsxs as c, Fragment as Ct } from "react/jsx-runtime";
2
+ import { forwardRef as Et, useState as b, useRef as fe, useId as M, useCallback as We, useEffect as je, useMemo as Mt, useImperativeHandle as Ft, Fragment as Kt } from "react";
3
+ import { useTranslation as At } from "react-i18next";
4
+ import * as H from "@radix-ui/react-popover";
5
+ import * as Q from "@radix-ui/react-radio-group";
6
+ import { u as me } from "./use-controllable-state-BiY4xTzM.js";
7
+ import { u as Lt } from "./form-field-context-B3APVHKx.js";
8
+ import { S as $t } from "./switch-OILsBLWo.js";
9
+ import { u as Wt } from "./registry-DvAUVLHh.js";
10
+ import { l as jt, m as qt, u as _t, g as zt, b as Bt, f as k, n as qe, s as _e, o as Yt, q as Ut, k as ge, a as Ht, d as Qt, t as Jt, r as ze, v as Be, w as Ye, p as Xt, x as Zt, D as ea, C as ta, y as aa, e as ra, z as J, h as sa, j as na, i as ve, c as ia } from "./date-picker-variants-eL6HjWvw.js";
11
+ import { s as F } from "./subDays-BcNi04uf.js";
12
+ import { C as oa } from "./calendar-days-BGWklvE-.js";
13
+ import { C as da } from "./check-DrFSN__t.js";
14
+ import { i as Ue } from "./isSameDay-DUEiAT0G.js";
15
+ import { p as la } from "./parse-DvA97ro9.js";
16
+ function ca(s, l, g) {
17
+ return jt(s, -1, g);
18
18
  }
19
- function je(s, l, f) {
20
- return Et(s, -1, f);
19
+ function He(s, l, g) {
20
+ return qt(s, -1, g);
21
21
  }
22
- const ea = {
22
+ const ua = {
23
23
  id: "date-range-picker",
24
24
  capabilities: [
25
25
  "range_pick",
@@ -38,11 +38,11 @@ const ea = {
38
38
  descriptionKey: "ui.agent.dateRangePicker.state.range",
39
39
  description: "Currently-selected ISO date range endpoints, each possibly null.",
40
40
  read: (s) => {
41
- var f, m;
41
+ var g, p;
42
42
  const l = s.getRange();
43
43
  return {
44
- from: ((f = l.from) == null ? void 0 : f.toISOString()) ?? null,
45
- to: ((m = l.to) == null ? void 0 : m.toISOString()) ?? null
44
+ from: ((g = l.from) == null ? void 0 : g.toISOString()) ?? null,
45
+ to: ((p = l.to) == null ? void 0 : p.toISOString()) ?? null
46
46
  };
47
47
  }
48
48
  },
@@ -63,11 +63,11 @@ const ea = {
63
63
  descriptionKey: "ui.agent.dateRangePicker.state.compareRange",
64
64
  description: "Resolved comparison period when compare-to-previous-period is on, else null.",
65
65
  read: (s) => {
66
- var f, m;
66
+ var g, p;
67
67
  const l = s.getCompareRange();
68
68
  return l ? {
69
- from: ((f = l.from) == null ? void 0 : f.toISOString()) ?? null,
70
- to: ((m = l.to) == null ? void 0 : m.toISOString()) ?? null
69
+ from: ((g = l.from) == null ? void 0 : g.toISOString()) ?? null,
70
+ to: ((p = l.to) == null ? void 0 : p.toISOString()) ?? null
71
71
  } : null;
72
72
  }
73
73
  }
@@ -211,64 +211,78 @@ const ea = {
211
211
  description: "Sourced from the id prop."
212
212
  }
213
213
  }
214
- }, ta = [
214
+ }, Qe = [
215
215
  { value: "day", fallback: "Day" },
216
216
  { value: "week", fallback: "Week" },
217
217
  { value: "month", fallback: "Month" },
218
218
  { value: "quarter", fallback: "Quarter" }
219
- ], aa = [
219
+ ], pa = [
220
220
  { value: "previous", fallback: "Previous period" },
221
221
  { value: "lastYear", fallback: "Same period last year" }
222
- ], ra = Pt(
222
+ ], fa = Et(
223
223
  ({
224
224
  value: s,
225
225
  defaultValue: l,
226
- onChange: f,
227
- commitMode: m = "auto",
228
- onApply: P,
229
- onCancel: N,
230
- showClear: qe = !0,
231
- numberOfMonths: _e = 2,
232
- granularity: ce,
233
- defaultGranularity: ue,
234
- onGranularityChange: ze,
235
- compare: pe = !1,
236
- defaultCompare: Be = !1,
237
- defaultCompareMode: Ye = "previous",
238
- onCompareChange: D,
239
- weekStartsOn: M,
240
- minDate: z,
241
- maxDate: B,
242
- presets: Y,
243
- mergePresets: Ue = !1,
244
- size: me = "md",
245
- chrome: He = "input",
246
- disabled: Qe,
247
- placeholder: Je,
248
- className: Xe,
249
- id: Ze
250
- }, et) => {
251
- const { t: n, i18n: fe } = wt(), V = St(), U = Ze ?? V.id, ge = V.disabled || Qe, tt = V.invalid ? "error" : "default", u = Gt(fe.language), p = Mt(fe.language), at = Je ?? n("inputs.dateRangePicker.placeholder", "Select date range"), [rt, ve] = Ve({
226
+ onChange: g,
227
+ commitMode: p = "auto",
228
+ onApply: w,
229
+ onCancel: I,
230
+ showClear: Je = !0,
231
+ numberOfMonths: Xe = 2,
232
+ granularity: ye,
233
+ defaultGranularity: he,
234
+ onGranularityChange: Ze,
235
+ allowedGranularities: X,
236
+ compare: j = !1,
237
+ compareEnabled: et,
238
+ defaultCompare: tt = !1,
239
+ defaultCompareMode: at = "previous",
240
+ onCompareChange: f,
241
+ weekStartsOn: K,
242
+ minDate: Z,
243
+ maxDate: ee,
244
+ presets: te,
245
+ mergePresets: rt = !1,
246
+ size: be = "md",
247
+ chrome: st = "input",
248
+ disabled: nt,
249
+ placeholder: it,
250
+ className: ot,
251
+ id: dt
252
+ }, lt) => {
253
+ const { t: n, i18n: ke } = At(), A = Lt(), ae = dt ?? A.id, Re = A.disabled || nt, ct = A.invalid ? "error" : "default", u = _t(ke.language), m = zt(ke.language), ut = it ?? n("inputs.dateRangePicker.placeholder", "Select date range"), [pt, xe] = me({
252
254
  value: s,
253
255
  defaultValue: l ?? {},
254
- onChange: f
255
- }), i = rt ?? {}, [C, b] = y(!1), [a, w] = y(i), [st, H] = y(i.from ?? /* @__PURE__ */ new Date()), [ye, he] = y(""), [be, ke] = y(""), [S, F] = y(!1), [I, K] = y(!1), L = ce !== void 0 || ue !== void 0, [$, Q] = Ve({
256
- value: ce,
257
- defaultValue: ue ?? "day",
258
- onChange: ze
259
- }), [J, nt] = y(Be), [Re, ot] = y(Ye), it = ie(null), x = ie(!1), xe = E(), Pe = E(), Ne = E(), De = E(), X = E(), dt = E(), k = Ge(
256
+ onChange: g
257
+ }), o = pt ?? {}, [O, R] = b(!1), [a, T] = b(o), [ft, re] = b(o.from ?? /* @__PURE__ */ new Date()), [Pe, Ne] = b(""), [De, Se] = b(""), [G, L] = b(!1), [V, $] = b(!1), q = ye !== void 0 || he !== void 0, _ = X && X.length > 0 ? X : void 0, we = _ ? Qe.filter(
258
+ (e) => _.includes(e.value)
259
+ ) : Qe, W = (e) => {
260
+ var t;
261
+ return !_ || _.includes(e) ? e : ((t = we[0]) == null ? void 0 : t.value) ?? e;
262
+ }, [mt, se] = me({
263
+ value: ye,
264
+ defaultValue: W(he ?? "day"),
265
+ onChange: Ze
266
+ }), z = W(mt ?? "day"), [C, B] = me({
267
+ value: et,
268
+ defaultValue: tt
269
+ // onCompareChange needs the resolved range as its 2nd arg, so it is
270
+ // called manually at the commit points rather than wired here.
271
+ }), [N, E] = b(
272
+ C ?? !1
273
+ ), [Ie, gt] = b(at), vt = fe(null), D = fe(!1), Oe = M(), Te = M(), Ge = M(), Ve = M(), ne = M(), yt = M(), x = We(
260
274
  (e) => {
261
- ve(e);
275
+ xe(e);
262
276
  },
263
- [ve]
264
- ), lt = Vt(z, B), ct = (e) => (z ? Ht(e, z) : !1) || (B ? le(e, B) : !1);
265
- Me(() => {
266
- C && (w(i), F(!1), K(!1), x.current = !1);
267
- }, [C]), Me(() => {
268
- S || he(
269
- a.from ? h(a.from, p, { locale: u }) : ""
270
- ), I || ke(a.to ? h(a.to, p, { locale: u }) : "");
271
- }, [a.from, a.to, p, u]);
277
+ [xe]
278
+ ), ht = Bt(Z, ee), bt = (e) => (Z ? ia(e, Z) : !1) || (ee ? ve(e, ee) : !1);
279
+ je(() => {
280
+ O && (T(o), E(C ?? !1), L(!1), $(!1), D.current = !1);
281
+ }, [O]), je(() => {
282
+ G || Ne(
283
+ a.from ? k(a.from, m, { locale: u }) : ""
284
+ ), V || Se(a.to ? k(a.to, m, { locale: u }) : "");
285
+ }, [a.from, a.to, m, u]);
272
286
  const Ce = [
273
287
  {
274
288
  label: n("inputs.dateRangePicker.presets.today", "Today"),
@@ -280,14 +294,14 @@ const ea = {
280
294
  {
281
295
  label: n("inputs.dateRangePicker.presets.yesterday", "Yesterday"),
282
296
  range: () => {
283
- const e = G(/* @__PURE__ */ new Date(), 1);
297
+ const e = F(/* @__PURE__ */ new Date(), 1);
284
298
  return { from: e, to: e };
285
299
  }
286
300
  },
287
301
  {
288
302
  label: n("inputs.dateRangePicker.presets.last7", "Last 7 days"),
289
303
  range: () => ({
290
- from: G(/* @__PURE__ */ new Date(), 6),
304
+ from: F(/* @__PURE__ */ new Date(), 6),
291
305
  to: /* @__PURE__ */ new Date()
292
306
  })
293
307
  },
@@ -296,191 +310,200 @@ const ea = {
296
310
  range: () => ({
297
311
  // `weekStartsOn` (when set) overrides the locale's first day; when
298
312
  // undefined date-fns falls back to the locale.
299
- from: Ke(/* @__PURE__ */ new Date(), { locale: u, weekStartsOn: M }),
300
- to: Fe(/* @__PURE__ */ new Date(), { locale: u, weekStartsOn: M })
313
+ from: _e(/* @__PURE__ */ new Date(), { locale: u, weekStartsOn: K }),
314
+ to: qe(/* @__PURE__ */ new Date(), { locale: u, weekStartsOn: K })
301
315
  })
302
316
  },
303
317
  {
304
318
  label: n("inputs.dateRangePicker.presets.lastWeek", "Last week"),
305
319
  range: () => {
306
- const e = Zt(/* @__PURE__ */ new Date());
320
+ const e = ca(/* @__PURE__ */ new Date());
307
321
  return {
308
- from: Ke(e, { locale: u, weekStartsOn: M }),
309
- to: Fe(e, { locale: u, weekStartsOn: M })
322
+ from: _e(e, { locale: u, weekStartsOn: K }),
323
+ to: qe(e, { locale: u, weekStartsOn: K })
310
324
  };
311
325
  }
312
326
  },
313
327
  {
314
328
  label: n("inputs.dateRangePicker.presets.thisMonth", "This month"),
315
329
  range: () => ({
316
- from: Kt(/* @__PURE__ */ new Date()),
317
- to: Ft(/* @__PURE__ */ new Date())
330
+ from: Ut(/* @__PURE__ */ new Date()),
331
+ to: Yt(/* @__PURE__ */ new Date())
318
332
  })
319
333
  },
320
334
  {
321
335
  label: n("inputs.dateRangePicker.presets.last30", "Last 30 days"),
322
336
  range: () => ({
323
- from: G(/* @__PURE__ */ new Date(), 29),
337
+ from: F(/* @__PURE__ */ new Date(), 29),
324
338
  to: /* @__PURE__ */ new Date()
325
339
  })
326
340
  }
327
- ], A = Y ? Ue ? [...Ce, ...Y] : Y : Ce, we = (() => {
341
+ ], ie = te ? rt ? [...Ce, ...te] : te : Ce, Ee = (() => {
328
342
  const e = [], t = /* @__PURE__ */ new Map();
329
- for (const d of A) {
330
- const o = d.group ?? "";
331
- t.has(o) || (t.set(o, []), e.push(o)), t.get(o).push(d);
343
+ for (const d of ie) {
344
+ const i = d.group ?? "";
345
+ t.has(i) || (t.set(i, []), e.push(i)), t.get(i).push(d);
332
346
  }
333
347
  return e.map((d) => ({ group: d, presets: t.get(d) }));
334
- })(), ut = we.some((e) => e.group !== ""), O = (e, t = Re) => {
348
+ })(), kt = Ee.some((e) => e.group !== ""), y = (e, t = Ie) => {
335
349
  if (!e.from || !e.to) return;
336
350
  if (t === "lastYear")
337
- return { from: je(e.from), to: je(e.to) };
338
- const d = de(e.to, e.from), o = G(e.from, 1);
339
- return { from: G(o, d), to: o };
340
- }, T = pe && J, v = T ? O(a) : void 0, pt = (() => {
341
- if (!(v != null && v.from) || !v.to) return;
342
- const e = v.from, t = v.to, d = {
351
+ return { from: He(e.from), to: He(e.to) };
352
+ const d = ge(e.to, e.from), i = F(e.from, 1);
353
+ return { from: F(i, d), to: i };
354
+ }, Y = j && N, Me = j && (C ?? !1), h = Y ? y(a) : void 0, Rt = (() => {
355
+ if (!(h != null && h.from) || !h.to) return;
356
+ const e = h.from, t = h.to, d = {
343
357
  compareStart: e,
344
358
  compareEnd: t
345
359
  };
346
- return de(t, e) >= 2 && (d.compareMiddle = { from: Lt(e, 1), to: G(t, 1) }), d;
347
- })(), Se = (e) => {
360
+ return ge(t, e) >= 2 && (d.compareMiddle = { from: Ht(e, 1), to: F(t, 1) }), d;
361
+ })(), Fe = (e) => {
348
362
  const t = {};
349
- return L && (t.granularity = $ ?? void 0), T && (t.compareRange = O(e)), t.granularity || t.compareRange ? t : void 0;
350
- }, mt = (e) => {
363
+ return q && (t.granularity = z), Y && (t.compareRange = y(e)), t.granularity || t.compareRange ? t : void 0;
364
+ }, xt = (e) => {
351
365
  const t = e;
352
- ot(t), T && (D == null || D(!0, O(a, t)));
353
- }, Z = (e) => {
354
- nt(e), D == null || D(e, e ? O(a) : void 0);
355
- }, ee = Ge(
366
+ gt(t), Y && p === "auto" && (f == null || f(!0, y(a, t)));
367
+ }, Pt = (e) => {
368
+ E(e), p === "auto" && (B(e), f == null || f(e, e ? y(a) : void 0));
369
+ }, oe = We(
356
370
  (e) => {
357
- w(e), m === "auto" && e.from && e.to && k(e);
371
+ T(e), p === "auto" && e.from && e.to && x(e);
358
372
  },
359
- [m, k]
360
- ), ft = (e) => {
361
- F(!1), K(!1), ee({ from: e == null ? void 0 : e.from, to: e == null ? void 0 : e.to });
362
- }, gt = (e) => {
373
+ [p, x]
374
+ ), Nt = (e) => {
375
+ L(!1), $(!1), oe({ from: e == null ? void 0 : e.from, to: e == null ? void 0 : e.to });
376
+ }, Dt = (e) => {
363
377
  const t = e.range();
364
- F(!1), K(!1), w(t), H(t.from), m === "auto" && (k(t), P == null || P(t, Se(t)), x.current = !0, b(!1));
365
- }, te = (e, t) => {
366
- const d = e === "from" ? F : K;
378
+ L(!1), $(!1), T(t), re(t.from), p === "auto" && (x(t), w == null || w(t, Fe(t)), D.current = !0, R(!1));
379
+ }, de = (e, t) => {
380
+ const d = e === "from" ? L : $;
367
381
  if (t.trim() === "") {
368
- d(!1), ee(
382
+ d(!1), oe(
369
383
  e === "from" ? { from: void 0, to: a.to } : { from: a.from, to: void 0 }
370
384
  );
371
385
  return;
372
386
  }
373
- const o = Xt(t, p, /* @__PURE__ */ new Date(), { locale: u });
374
- if (!Ut(o) || ct(o)) {
387
+ const i = la(t, m, /* @__PURE__ */ new Date(), { locale: u });
388
+ if (!na(i) || bt(i)) {
375
389
  d(!0);
376
390
  return;
377
391
  }
378
392
  d(!1);
379
- let R;
380
- e === "from" ? R = a.to && le(o, a.to) ? { from: o, to: void 0 } : { from: o, to: a.to } : R = a.from && le(a.from, o) ? { from: o, to: void 0 } : { from: a.from, to: o }, H(o), ee(R);
381
- }, Ie = (e) => (t) => {
382
- t.key === "Enter" && (t.preventDefault(), te(e, e === "from" ? ye : be));
383
- }, vt = () => {
384
- w({}), F(!1), K(!1), m === "auto" && k({});
385
- }, yt = !!(a.from && a.to), ht = !a.from && !a.to, Oe = (yt || ht) && !S && !I, ae = () => {
386
- Oe && (k(a), P == null || P(a, Se(a))), x.current = !0, b(!1);
387
- }, bt = () => {
388
- x.current = !0, b(!1);
389
- }, re = () => {
390
- m === "apply" && (N == null || N()), w(i), b(!1);
391
- }, kt = (e) => {
393
+ let P;
394
+ e === "from" ? P = a.to && ve(i, a.to) ? { from: i, to: void 0 } : { from: i, to: a.to } : P = a.from && ve(a.from, i) ? { from: i, to: void 0 } : { from: a.from, to: i }, re(i), oe(P);
395
+ }, Ke = (e) => (t) => {
396
+ t.key === "Enter" && (t.preventDefault(), de(e, e === "from" ? Pe : De));
397
+ }, St = () => {
398
+ T({}), L(!1), $(!1), p === "auto" && x({});
399
+ }, wt = !!(a.from && a.to), It = !a.from && !a.to, Ae = (wt || It) && !G && !V, le = () => {
400
+ Ae && (x(a), j && N !== (C ?? !1) && (B(N), f == null || f(
401
+ N,
402
+ N ? y(a) : void 0
403
+ )), w == null || w(a, Fe(a))), D.current = !0, R(!1);
404
+ }, Ot = () => {
405
+ D.current = !0, R(!1);
406
+ }, ce = () => {
407
+ p === "apply" && (I == null || I()), T(o), E(C ?? !1), R(!1);
408
+ }, Tt = (e) => {
392
409
  if (e) {
393
- x.current = !1, b(!0);
410
+ D.current = !1, R(!0);
394
411
  return;
395
412
  }
396
- m === "apply" && !x.current && (N == null || N()), w(i), x.current = !1, b(!1);
397
- }, se = (e) => {
398
- if (!i.from || !i.to) return !1;
413
+ p === "apply" && !D.current && (I == null || I()), T(o), E(C ?? !1), D.current = !1, R(!1);
414
+ }, Gt = (e) => {
415
+ if (!o.from || !o.to) return !1;
399
416
  const t = e.range();
400
- return We(t.from, i.from) && We(t.to, i.to);
401
- }, Te = (() => {
402
- if (i.from && i.to) {
403
- const e = h(i.from, p, { locale: u }), t = h(i.to, p, { locale: u });
417
+ return Ue(t.from, o.from) && Ue(t.to, o.to);
418
+ }, S = ie.find(Gt), Le = (() => {
419
+ if (o.from && o.to) {
420
+ const e = k(o.from, m, { locale: u }), t = k(o.to, m, { locale: u });
404
421
  return `${e} – ${t}`;
405
422
  }
406
- return i.from ? h(i.from, p, { locale: u }) : "";
407
- })(), W = a.from ? a.to ? null : "end" : "start", Rt = (() => {
423
+ return o.from ? k(o.from, m, { locale: u }) : "";
424
+ })(), U = a.from ? a.to ? null : "end" : "start", Vt = (() => {
408
425
  if (!a.from)
409
426
  return n("inputs.dateRangePicker.selectStart", "Select start date");
410
427
  if (!a.to)
411
428
  return n("inputs.dateRangePicker.selectEnd", "Select end date");
412
- const e = de(a.to, a.from) + 1, t = h(a.from, p, { locale: u }), d = h(a.to, p, { locale: u }), o = n("inputs.dateRangePicker.days", { count: e });
413
- return `${t} – ${d} · ${o}`;
414
- })(), g = ie({
415
- currentValue: i,
416
- open: C,
417
- getGranularity: () => L ? $ ?? void 0 : void 0,
418
- setGranularity: (e) => Q(e),
419
- getCompareRange: () => T ? O(i) : void 0,
420
- setCompare: (e) => Z(e),
421
- getActivePreset: () => {
422
- var e;
423
- return (e = A.find(se)) == null ? void 0 : e.label;
429
+ const e = ge(a.to, a.from) + 1, t = k(a.from, m, { locale: u }), d = k(a.to, m, { locale: u }), i = n("inputs.dateRangePicker.days", { count: e });
430
+ return `${t} – ${d} · ${i}`;
431
+ })(), v = fe({
432
+ currentValue: o,
433
+ open: O,
434
+ getGranularity: () => q ? z : void 0,
435
+ setGranularity: (e) => se(W(e)),
436
+ getCompareRange: () => Me ? y(o) : void 0,
437
+ // Imperative/agent path commits directly (like setRange/clear), so
438
+ // toggle_compare reflects in getCompareRange immediately — not a draft.
439
+ setCompare: (e) => {
440
+ E(e), B(e), f == null || f(
441
+ e,
442
+ e ? y(o) : void 0
443
+ );
424
444
  },
425
- getActiveEnd: () => W,
426
- apply: () => ae(),
427
- cancel: () => re()
445
+ getActivePreset: () => S == null ? void 0 : S.label,
446
+ getActiveEnd: () => U,
447
+ apply: () => le(),
448
+ cancel: () => ce()
428
449
  });
429
- g.current = {
430
- currentValue: i,
431
- open: C,
432
- getGranularity: () => L ? $ ?? void 0 : void 0,
433
- setGranularity: (e) => Q(e),
434
- getCompareRange: () => T ? O(i) : void 0,
435
- setCompare: (e) => Z(e),
436
- getActivePreset: () => {
437
- var e;
438
- return (e = A.find(se)) == null ? void 0 : e.label;
450
+ v.current = {
451
+ currentValue: o,
452
+ open: O,
453
+ getGranularity: () => q ? z : void 0,
454
+ setGranularity: (e) => se(W(e)),
455
+ getCompareRange: () => Me ? y(o) : void 0,
456
+ setCompare: (e) => {
457
+ E(e), B(e), f == null || f(
458
+ e,
459
+ e ? y(o) : void 0
460
+ );
439
461
  },
440
- getActiveEnd: () => W,
441
- apply: () => ae(),
442
- cancel: () => re()
462
+ getActivePreset: () => S == null ? void 0 : S.label,
463
+ getActiveEnd: () => U,
464
+ apply: () => le(),
465
+ cancel: () => ce()
443
466
  };
444
- const ne = Nt(
467
+ const ue = Mt(
445
468
  () => ({
446
- getRange: () => g.current.currentValue,
447
- setRange: (e) => k(e),
448
- clear: () => k({}),
449
- isOpen: () => g.current.open,
450
- open: () => b(!0),
451
- close: () => b(!1),
452
- getGranularity: () => g.current.getGranularity(),
453
- setGranularity: (e) => g.current.setGranularity(e),
454
- getCompareRange: () => g.current.getCompareRange(),
455
- setCompare: (e) => g.current.setCompare(e),
456
- getActivePreset: () => g.current.getActivePreset(),
457
- getActiveEnd: () => g.current.getActiveEnd(),
458
- apply: () => g.current.apply(),
459
- cancel: () => g.current.cancel()
469
+ getRange: () => v.current.currentValue,
470
+ setRange: (e) => x(e),
471
+ clear: () => x({}),
472
+ isOpen: () => v.current.open,
473
+ open: () => R(!0),
474
+ close: () => R(!1),
475
+ getGranularity: () => v.current.getGranularity(),
476
+ setGranularity: (e) => v.current.setGranularity(e),
477
+ getCompareRange: () => v.current.getCompareRange(),
478
+ setCompare: (e) => v.current.setCompare(e),
479
+ getActivePreset: () => v.current.getActivePreset(),
480
+ getActiveEnd: () => v.current.getActiveEnd(),
481
+ apply: () => v.current.apply(),
482
+ cancel: () => v.current.cancel()
460
483
  }),
461
- [k]
484
+ [x]
462
485
  );
463
- Dt(et, () => ne, [ne]), Ot(ea, ne, U);
464
- const Ee = (e) => e === "from" ? S ? "error" : W === "start" ? "active" : "default" : I ? "error" : W === "end" ? "active" : "default";
465
- return /* @__PURE__ */ r(j.Root, { open: C, onOpenChange: kt, children: /* @__PURE__ */ c(
486
+ Ft(lt, () => ue, [ue]), Wt(ua, ue, ae);
487
+ const $e = (e) => e === "from" ? G ? "error" : U === "start" ? "active" : "default" : V ? "error" : U === "end" ? "active" : "default";
488
+ return /* @__PURE__ */ r(H.Root, { open: O, onOpenChange: Tt, children: /* @__PURE__ */ c(
466
489
  "div",
467
490
  {
468
- className: Xe,
491
+ className: ot,
469
492
  "data-component": "date-range-picker",
470
- "data-component-id": U,
493
+ "data-component-id": ae,
471
494
  children: [
472
- /* @__PURE__ */ r(j.Trigger, { asChild: !0, disabled: ge, children: /* @__PURE__ */ c(
495
+ /* @__PURE__ */ r(H.Trigger, { asChild: !0, disabled: Re, children: /* @__PURE__ */ c(
473
496
  "button",
474
497
  {
475
- ref: it,
476
- id: U,
498
+ ref: vt,
499
+ id: ae,
477
500
  type: "button",
478
- disabled: ge,
479
- "aria-describedby": V.describedBy || void 0,
480
- "aria-invalid": V.invalid || void 0,
501
+ disabled: Re,
502
+ "aria-describedby": A.describedBy || void 0,
503
+ "aria-invalid": A.invalid || void 0,
481
504
  "aria-haspopup": "dialog",
482
- "aria-expanded": C,
483
- className: At({ size: me, tone: tt, chrome: He }),
505
+ "aria-expanded": O,
506
+ className: Jt({ size: be, tone: ct, chrome: st }),
484
507
  children: [
485
508
  /* @__PURE__ */ r(
486
509
  "span",
@@ -492,24 +515,24 @@ const ea = {
492
515
  // lets the flex child shrink below its content width so
493
516
  // `truncate` engages.
494
517
  "ds:min-w-0 ds:flex-1 ds:truncate ds:text-start",
495
- Te ? "ds:text-foreground" : "ds:text-muted-foreground"
518
+ Le ? "ds:text-foreground" : "ds:text-muted-foreground"
496
519
  ].join(" "),
497
- children: Te || at
520
+ children: Le || ut
498
521
  }
499
522
  ),
500
523
  /* @__PURE__ */ r(
501
524
  "span",
502
525
  {
503
526
  "aria-hidden": "true",
504
- className: $t({ size: me }),
505
- children: /* @__PURE__ */ r(Qt, {})
527
+ className: Qt({ size: be }),
528
+ children: /* @__PURE__ */ r(oa, {})
506
529
  }
507
530
  )
508
531
  ]
509
532
  }
510
533
  ) }),
511
- /* @__PURE__ */ r(j.Portal, { children: /* @__PURE__ */ r(
512
- j.Content,
534
+ /* @__PURE__ */ r(H.Portal, { children: /* @__PURE__ */ r(
535
+ H.Content,
513
536
  {
514
537
  sideOffset: 4,
515
538
  align: "start",
@@ -518,33 +541,35 @@ const ea = {
518
541
  "inputs.dateRangePicker.title",
519
542
  "Select date range"
520
543
  ),
521
- className: Yt(),
544
+ className: sa(),
522
545
  children: /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
523
546
  /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
524
547
  /* @__PURE__ */ c("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
525
548
  /* @__PURE__ */ r(
526
549
  "h2",
527
550
  {
528
- id: xe,
551
+ id: Oe,
529
552
  className: "type-body-sm ds:font-semibold ds:text-foreground",
530
553
  children: n("inputs.dateRangePicker.title", "Select date range")
531
554
  }
532
555
  ),
533
- L ? /* @__PURE__ */ r(
534
- q.Root,
556
+ q ? /* @__PURE__ */ r(
557
+ Q.Root,
535
558
  {
536
- value: $ ?? "day",
537
- onValueChange: (e) => Q(e),
559
+ value: z,
560
+ onValueChange: (e) => se(
561
+ W(e)
562
+ ),
538
563
  "aria-label": n(
539
564
  "inputs.dateRangePicker.granularityLabel",
540
565
  "Granularity"
541
566
  ),
542
- className: $e(),
543
- children: ta.map((e) => /* @__PURE__ */ r(
544
- q.Item,
567
+ className: Be(),
568
+ children: we.map((e) => /* @__PURE__ */ r(
569
+ Q.Item,
545
570
  {
546
571
  value: e.value,
547
- className: Le(),
572
+ className: ze(),
548
573
  children: n(
549
574
  `inputs.dateRangePicker.granularity.${e.value}`,
550
575
  e.fallback
@@ -560,7 +585,7 @@ const ea = {
560
585
  /* @__PURE__ */ r(
561
586
  "label",
562
587
  {
563
- htmlFor: Pe,
588
+ htmlFor: Te,
564
589
  className: "ds:text-[length:var(--font-size-xs)] ds:text-muted-foreground",
565
590
  children: n("inputs.dateRangePicker.startLabel", "Start date")
566
591
  }
@@ -568,18 +593,18 @@ const ea = {
568
593
  /* @__PURE__ */ r(
569
594
  "input",
570
595
  {
571
- id: Pe,
596
+ id: Te,
572
597
  type: "text",
573
598
  inputMode: "numeric",
574
- value: ye,
575
- placeholder: p.toUpperCase(),
576
- "aria-invalid": S || void 0,
577
- "aria-describedby": S ? X : void 0,
578
- onChange: (e) => he(e.target.value),
579
- onBlur: (e) => te("from", e.target.value),
580
- onKeyDown: Ie("from"),
581
- className: Ae({
582
- state: Ee("from")
599
+ value: Pe,
600
+ placeholder: m.toUpperCase(),
601
+ "aria-invalid": G || void 0,
602
+ "aria-describedby": G ? ne : void 0,
603
+ onChange: (e) => Ne(e.target.value),
604
+ onBlur: (e) => de("from", e.target.value),
605
+ onKeyDown: Ke("from"),
606
+ className: Ye({
607
+ state: $e("from")
583
608
  })
584
609
  }
585
610
  )
@@ -596,7 +621,7 @@ const ea = {
596
621
  /* @__PURE__ */ r(
597
622
  "label",
598
623
  {
599
- htmlFor: Ne,
624
+ htmlFor: Ge,
600
625
  className: "ds:text-[length:var(--font-size-xs)] ds:text-muted-foreground",
601
626
  children: n("inputs.dateRangePicker.endLabel", "End date")
602
627
  }
@@ -604,54 +629,54 @@ const ea = {
604
629
  /* @__PURE__ */ r(
605
630
  "input",
606
631
  {
607
- id: Ne,
632
+ id: Ge,
608
633
  type: "text",
609
634
  inputMode: "numeric",
610
- value: be,
611
- placeholder: p.toUpperCase(),
612
- "aria-invalid": I || void 0,
613
- "aria-describedby": I ? X : void 0,
614
- onChange: (e) => ke(e.target.value),
615
- onBlur: (e) => te("to", e.target.value),
616
- onKeyDown: Ie("to"),
617
- className: Ae({
618
- state: Ee("to")
635
+ value: De,
636
+ placeholder: m.toUpperCase(),
637
+ "aria-invalid": V || void 0,
638
+ "aria-describedby": V ? ne : void 0,
639
+ onChange: (e) => Se(e.target.value),
640
+ onBlur: (e) => de("to", e.target.value),
641
+ onKeyDown: Ke("to"),
642
+ className: Ye({
643
+ state: $e("to")
619
644
  })
620
645
  }
621
646
  )
622
647
  ] })
623
648
  ] }),
624
- S || I ? /* @__PURE__ */ r(
649
+ G || V ? /* @__PURE__ */ r(
625
650
  "p",
626
651
  {
627
- id: X,
652
+ id: ne,
628
653
  role: "alert",
629
654
  className: "ds:text-[length:var(--font-size-xs)] ds:text-destructive",
630
655
  children: n(
631
656
  "inputs.dateRangePicker.invalidDate",
632
657
  "Enter a date as {{format}}",
633
658
  {
634
- format: p.toUpperCase()
659
+ format: m.toUpperCase()
635
660
  }
636
661
  )
637
662
  }
638
663
  ) : null
639
664
  ] }),
640
665
  /* @__PURE__ */ c("div", { className: "ds:flex ds:gap-[var(--spacing-md)]", children: [
641
- A.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: we.map((e, t) => {
642
- const d = `${xe}-pg${t}`, o = e.presets.map((R) => {
643
- const oe = se(R);
666
+ ie.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: Ee.map((e, t) => {
667
+ const d = `${Oe}-pg${t}`, i = e.presets.map((P) => {
668
+ const pe = P === S;
644
669
  return /* @__PURE__ */ c(
645
670
  "button",
646
671
  {
647
672
  type: "button",
648
- "aria-pressed": oe,
649
- onClick: () => gt(R),
650
- className: Wt({ active: oe }),
673
+ "aria-pressed": pe,
674
+ onClick: () => Dt(P),
675
+ className: Xt({ active: pe }),
651
676
  children: [
652
- /* @__PURE__ */ r("span", { className: "ds:min-w-0 ds:truncate", children: R.label }),
653
- oe ? /* @__PURE__ */ r(
654
- Jt,
677
+ /* @__PURE__ */ r("span", { className: "ds:min-w-0 ds:truncate", children: P.label }),
678
+ pe ? /* @__PURE__ */ r(
679
+ da,
655
680
  {
656
681
  "aria-hidden": "true",
657
682
  className: "ds:size-4 ds:shrink-0 ds:text-primary"
@@ -659,10 +684,10 @@ const ea = {
659
684
  ) : null
660
685
  ]
661
686
  },
662
- R.label
687
+ P.label
663
688
  );
664
689
  });
665
- return ut && e.group ? /* @__PURE__ */ c(
690
+ return kt && e.group ? /* @__PURE__ */ c(
666
691
  "div",
667
692
  {
668
693
  role: "group",
@@ -673,56 +698,56 @@ const ea = {
673
698
  "div",
674
699
  {
675
700
  id: d,
676
- className: jt(),
701
+ className: Zt(),
677
702
  children: e.group
678
703
  }
679
704
  ),
680
- o
705
+ i
681
706
  ]
682
707
  },
683
708
  e.group
684
- ) : /* @__PURE__ */ r(Ct, { children: o }, e.group || "_ungrouped");
709
+ ) : /* @__PURE__ */ r(Kt, { children: i }, e.group || "_ungrouped");
685
710
  }) }) : null,
686
- /* @__PURE__ */ c("div", { role: "region", "aria-labelledby": De, children: [
687
- /* @__PURE__ */ r("span", { id: De, className: "ds:sr-only", children: n("inputs.dateRangePicker.gridLabel", "Calendar") }),
711
+ /* @__PURE__ */ c("div", { role: "region", "aria-labelledby": Ve, children: [
712
+ /* @__PURE__ */ r("span", { id: Ve, className: "ds:sr-only", children: n("inputs.dateRangePicker.gridLabel", "Calendar") }),
688
713
  /* @__PURE__ */ r(
689
- qt,
714
+ ea,
690
715
  {
691
716
  mode: "range",
692
717
  selected: a.from ? { from: a.from, to: a.to } : void 0,
693
- onSelect: ft,
694
- month: st,
695
- onMonthChange: H,
696
- numberOfMonths: _e,
697
- weekStartsOn: M,
698
- disabled: lt,
718
+ onSelect: Nt,
719
+ month: ft,
720
+ onMonthChange: re,
721
+ numberOfMonths: Xe,
722
+ weekStartsOn: K,
723
+ disabled: ht,
699
724
  locale: u,
700
725
  showOutsideDays: !0,
701
726
  fixedWeeks: !0,
702
727
  pagedNavigation: !0,
703
- classNames: Bt,
704
- modifiers: pt,
705
- modifiersClassNames: zt,
706
- components: { Chevron: _t }
728
+ classNames: ra,
729
+ modifiers: Rt,
730
+ modifiersClassNames: aa,
731
+ components: { Chevron: ta }
707
732
  }
708
733
  )
709
734
  ] })
710
735
  ] }),
711
- pe ? /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)] ds:border-t ds:border-border ds:pt-[var(--spacing-sm)]", children: [
736
+ j ? /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)] ds:border-t ds:border-border ds:pt-[var(--spacing-sm)]", children: [
712
737
  /* @__PURE__ */ r(
713
- It,
738
+ $t,
714
739
  {
715
- id: dt,
740
+ id: yt,
716
741
  label: n(
717
742
  "inputs.dateRangePicker.compareLabel",
718
743
  "Compare to previous period"
719
744
  ),
720
745
  size: "sm",
721
- checked: J,
722
- onCheckedChange: Z
746
+ checked: N,
747
+ onCheckedChange: Pt
723
748
  }
724
749
  ),
725
- T && v ? /* @__PURE__ */ c("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[length:var(--font-size-xs)] ds:text-muted-foreground", children: [
750
+ Y && h ? /* @__PURE__ */ c("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[length:var(--font-size-xs)] ds:text-muted-foreground", children: [
726
751
  /* @__PURE__ */ r(
727
752
  "span",
728
753
  {
@@ -730,23 +755,23 @@ const ea = {
730
755
  className: "ds:inline-block ds:size-3 ds:rounded-[calc(var(--radius-sm)-2px)] ds:bg-[var(--calendar-compare-fill)] ds:border-b-2 ds:border-dashed ds:border-b-[var(--calendar-compare-edge)]"
731
756
  }
732
757
  ),
733
- `${h(v.from, p, { locale: u })} – ${h(v.to, p, { locale: u })}`
758
+ `${k(h.from, m, { locale: u })} – ${k(h.to, m, { locale: u })}`
734
759
  ] }) : null,
735
- J ? /* @__PURE__ */ r(
736
- q.Root,
760
+ N ? /* @__PURE__ */ r(
761
+ Q.Root,
737
762
  {
738
- value: Re,
739
- onValueChange: mt,
763
+ value: Ie,
764
+ onValueChange: xt,
740
765
  "aria-label": n(
741
766
  "inputs.dateRangePicker.compareModeLabel",
742
767
  "Comparison period"
743
768
  ),
744
- className: `${$e()} ds:ms-auto`,
745
- children: aa.map((e) => /* @__PURE__ */ r(
746
- q.Item,
769
+ className: `${Be()} ds:ms-auto`,
770
+ children: pa.map((e) => /* @__PURE__ */ r(
771
+ Q.Item,
747
772
  {
748
773
  value: e.value,
749
- className: Le(),
774
+ className: ze(),
750
775
  children: n(
751
776
  `inputs.dateRangePicker.compareMode.${e.value}`,
752
777
  e.fallback
@@ -764,26 +789,26 @@ const ea = {
764
789
  role: "status",
765
790
  "aria-live": "polite",
766
791
  className: "type-body-sm ds:min-w-0 ds:truncate ds:text-muted-foreground",
767
- children: Rt
792
+ children: Vt
768
793
  }
769
794
  ),
770
795
  /* @__PURE__ */ c("div", { className: "ds:flex ds:shrink-0 ds:gap-[var(--spacing-xs)]", children: [
771
- qe ? /* @__PURE__ */ r(
796
+ Je ? /* @__PURE__ */ r(
772
797
  "button",
773
798
  {
774
799
  type: "button",
775
- onClick: vt,
776
- className: _({ intent: "ghost" }),
800
+ onClick: St,
801
+ className: J({ intent: "ghost" }),
777
802
  children: n("inputs.dateRangePicker.clear", "Clear")
778
803
  }
779
804
  ) : null,
780
- m === "apply" ? /* @__PURE__ */ c(xt, { children: [
805
+ p === "apply" ? /* @__PURE__ */ c(Ct, { children: [
781
806
  /* @__PURE__ */ r(
782
807
  "button",
783
808
  {
784
809
  type: "button",
785
- onClick: re,
786
- className: _({ intent: "ghost" }),
810
+ onClick: ce,
811
+ className: J({ intent: "ghost" }),
787
812
  children: n("inputs.dateRangePicker.cancel", "Cancel")
788
813
  }
789
814
  ),
@@ -791,9 +816,9 @@ const ea = {
791
816
  "button",
792
817
  {
793
818
  type: "button",
794
- disabled: !Oe,
795
- onClick: ae,
796
- className: _({ intent: "primary" }),
819
+ disabled: !Ae,
820
+ onClick: le,
821
+ className: J({ intent: "primary" }),
797
822
  children: n("inputs.dateRangePicker.apply", "Apply")
798
823
  }
799
824
  )
@@ -801,8 +826,8 @@ const ea = {
801
826
  "button",
802
827
  {
803
828
  type: "button",
804
- onClick: bt,
805
- className: _({ intent: "primary" }),
829
+ onClick: Ot,
830
+ className: J({ intent: "primary" }),
806
831
  children: n("inputs.dateRangePicker.done", "Done")
807
832
  }
808
833
  )
@@ -816,9 +841,9 @@ const ea = {
816
841
  ) });
817
842
  }
818
843
  );
819
- ra.displayName = "DateRangePicker";
844
+ fa.displayName = "DateRangePicker";
820
845
  export {
821
- ra as D,
822
- ea as d
846
+ fa as D,
847
+ ua as d
823
848
  };
824
- //# sourceMappingURL=date-range-picker-Cc4DLAL2.js.map
849
+ //# sourceMappingURL=date-range-picker-pEG3Ln3i.js.map