@rinzai/zen 0.15.0 → 0.16.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 (78) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/animated-number/index.js +14 -14
  3. package/dist/breadcrumbs/index.js +14 -14
  4. package/dist/calendar/index.js +29 -29
  5. package/dist/calendar-heatmap/index.js +12 -12
  6. package/dist/canvas/index.js +19 -19
  7. package/dist/carousel/index.js +24 -24
  8. package/dist/chart/index.js +7 -7
  9. package/dist/code-block/index.js +5 -5
  10. package/dist/collapse/index.js +6 -6
  11. package/dist/color-picker/index.js +10 -10
  12. package/dist/combobox/index.js +61 -61
  13. package/dist/command-palette/index.js +5 -5
  14. package/dist/confirm-dialog/index.js +4 -4
  15. package/dist/date-picker/index.js +15 -15
  16. package/dist/dialog/index.d.ts.map +1 -1
  17. package/dist/dialog/index.js +45 -65
  18. package/dist/docs/README.md +4 -4
  19. package/dist/docs/locale-provider.md +1 -1
  20. package/dist/docs/menu.md +54 -1
  21. package/dist/docs/seek-bar.md +30 -1
  22. package/dist/docs/sortable.md +63 -1
  23. package/dist/docs/tooltip.md +45 -3
  24. package/dist/filter-bar/index.js +6 -6
  25. package/dist/header/index.js +6 -6
  26. package/dist/icon-picker/index.js +5 -5
  27. package/dist/keypad/index.js +5 -5
  28. package/dist/lib.js +7 -7
  29. package/dist/load-more/index.js +5 -5
  30. package/dist/menu/index.d.ts +7 -1
  31. package/dist/menu/index.d.ts.map +1 -1
  32. package/dist/menu/index.js +217 -174
  33. package/dist/money-input/index.js +54 -54
  34. package/dist/month-picker/index.js +11 -11
  35. package/dist/number-field/index.js +5 -5
  36. package/dist/pagination/index.js +12 -12
  37. package/dist/range-slider/index.js +11 -11
  38. package/dist/repeat-picker/index.js +5 -5
  39. package/dist/resizable/index.js +22 -22
  40. package/dist/seek-bar/index.d.ts +3 -1
  41. package/dist/seek-bar/index.d.ts.map +1 -1
  42. package/dist/seek-bar/index.js +41 -40
  43. package/dist/select/index.js +21 -21
  44. package/dist/sortable/index.d.ts +13 -1
  45. package/dist/sortable/index.d.ts.map +1 -1
  46. package/dist/sortable/index.js +74 -55
  47. package/dist/sortable/shared.js +14 -14
  48. package/dist/sortable/tree.js +17 -17
  49. package/dist/sparkline/index.js +4 -4
  50. package/dist/stepper/index.js +13 -13
  51. package/dist/table/index.js +26 -26
  52. package/dist/table/selection.js +9 -9
  53. package/dist/table-of-contents/index.js +11 -11
  54. package/dist/tag-input/index.js +5 -5
  55. package/dist/theme-toggle/index.js +4 -4
  56. package/dist/theme.css +103 -0
  57. package/dist/time-field/index.js +21 -21
  58. package/dist/toast/index.d.ts.map +1 -1
  59. package/dist/toast/index.js +41 -41
  60. package/dist/tooltip/index.d.ts +9 -3
  61. package/dist/tooltip/index.d.ts.map +1 -1
  62. package/dist/tooltip/index.js +19 -16
  63. package/dist/tree/index.js +34 -34
  64. package/dist/trend/index.js +5 -5
  65. package/dist/utils/messages.d.ts +1 -0
  66. package/dist/utils/messages.d.ts.map +1 -1
  67. package/dist/utils/messages.js +1 -0
  68. package/dist/utils/swipe.d.ts +7 -0
  69. package/dist/utils/swipe.d.ts.map +1 -1
  70. package/dist/utils/swipe.js +45 -25
  71. package/dist/utils/useAnchoredPopup.d.ts +2 -1
  72. package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
  73. package/dist/utils/useAnchoredPopup.js +9 -5
  74. package/dist/utils/useVirtualList.d.ts +6 -1
  75. package/dist/utils/useVirtualList.d.ts.map +1 -1
  76. package/dist/utils/useVirtualList.js +12 -12
  77. package/dist/zen.css +1 -1
  78. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/seek-bar/index.tsx"],"names":[],"mappings":"AACA,OAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQlD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC5B,WAAW,EACX,QAAQ,EACR,QAAY,EACZ,OAAe,EACf,YAAgB,EAChB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACV,EAAE,YAAY,+BA6Gd;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CACtC,WAAW,EACX,OAAO,GAAG,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,eAAe,GAAG,eAAe,GAAG,iBAAiB,CAC5G;IACG,sBAAsB;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yGAAyG;IACzG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/seek-bar/index.tsx"],"names":[],"mappings":"AACA,OAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQlD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC5B,WAAW,EACX,QAAQ,EACR,QAAY,EACZ,OAAe,EACf,YAAgB,EAChB,MAAM,EACN,KAAgB,EAChB,SAAS,EACT,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACV,EAAE,YAAY,+BA8Hd;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CACtC,WAAW,EACX,OAAO,GAAG,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,eAAe,GAAG,eAAe,GAAG,iBAAiB,CAC5G;IACG,sBAAsB;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yGAAyG;IACzG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,wIAAwI;IACxI,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC9B"}
@@ -1,45 +1,45 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useMessages as t } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
4
  import n from "../slider/index.js";
5
5
  import { formatDuration as r } from "../utils/duration.js";
6
6
  import { useLayoutEffect as i, useRef as a, useState as o } from "react";
7
7
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
8
  //#region packages/seek-bar/index.tsx
9
9
  var l = 5;
10
- function u({ currentTime: u, duration: d, buffered: f = 0, playing: p = !1, playbackRate: m = 1, onSeek: h, onKeyDown: g, disabled: _, className: v, ...y }) {
11
- let b = t(), [x, S] = o(null), [C, w] = o(null), T = C && C.from === u ? C.at : null, E = Math.max(0, Math.min(x ?? T ?? u, d)), D = a(null), O = a(null), k = p && x === null && T === null && d > 0 && E < d, A = a(null);
10
+ function u({ currentTime: u, duration: d, buffered: f = 0, playing: p = !1, playbackRate: m = 1, onSeek: h, times: g = "beside", onKeyDown: _, disabled: v, className: y, ...b }) {
11
+ let x = e(), [S, C] = o(null), [w, T] = o(null), E = w && w.from === u ? w.at : null, D = Math.max(0, Math.min(S ?? E ?? u, d)), O = a(null), k = a(null), A = p && S === null && E === null && d > 0 && D < d, j = a(null);
12
12
  i(() => {
13
- let e = [D.current, O.current].filter((e) => e !== null);
13
+ let e = [O.current, k.current].filter((e) => e !== null);
14
14
  if (!e.length) return;
15
- let t = A.current;
16
- if (k && t && t.rate === m && t.duration === d) {
15
+ let t = j.current;
16
+ if (A && t && t.rate === m && t.duration === d) {
17
17
  let e = Number(t.animations[0].currentTime ?? 0) / 1e3;
18
- if (Math.abs(t.from + e * m - E) < .15) return;
18
+ if (Math.abs(t.from + e * m - D) < .15) return;
19
19
  }
20
- t?.animations.forEach((e) => e.cancel()), A.current = null;
20
+ t?.animations.forEach((e) => e.cancel()), j.current = null;
21
21
  let n = getComputedStyle(e[0]).direction === "rtl" ? -1 : 1, r = (e) => `${d > 0 ? n * e * 100 / d : 0}cqw`;
22
- for (let t of e) t.style.translate = r(E);
23
- if (!k) return;
24
- let i = e.map((e) => e.animate([{ translate: r(E) }, { translate: r(d) }], {
25
- duration: (d - E) / m * 1e3,
22
+ for (let t of e) t.style.translate = r(D);
23
+ if (!A) return;
24
+ let i = e.map((e) => e.animate([{ translate: r(D) }, { translate: r(d) }], {
25
+ duration: (d - D) / m * 1e3,
26
26
  easing: "linear",
27
27
  fill: "forwards"
28
28
  }));
29
- A.current = {
29
+ j.current = {
30
30
  animations: i,
31
- from: E,
31
+ from: D,
32
32
  rate: m,
33
33
  duration: d
34
34
  };
35
35
  }, [
36
- E,
36
+ D,
37
37
  d,
38
- k,
38
+ A,
39
39
  m
40
- ]), i(() => () => A.current?.animations.forEach((e) => e.cancel()), []);
41
- let j = (e) => {
42
- if (g?.(e), e.defaultPrevented) return;
40
+ ]), i(() => () => j.current?.animations.forEach((e) => e.cancel()), []);
41
+ let M = (e) => {
42
+ if (_?.(e), e.defaultPrevented) return;
43
43
  let t = getComputedStyle(e.currentTarget).direction === "rtl", n = {
44
44
  ArrowUp: 1,
45
45
  ArrowDown: -1,
@@ -48,52 +48,53 @@ function u({ currentTime: u, duration: d, buffered: f = 0, playing: p = !1, play
48
48
  }[e.key];
49
49
  if (!n) return;
50
50
  e.preventDefault();
51
- let r = Math.max(0, Math.min(E + n * l, d));
52
- w({
51
+ let r = Math.max(0, Math.min(D + n * l, d));
52
+ T({
53
53
  at: r,
54
54
  from: u
55
55
  }), h(r);
56
- }, M = _ || d <= 0, N = d > 0 ? Math.min(f, d) / d * 100 : 0, P = { width: `${r(d).length}ch` };
56
+ }, N = v || d <= 0, P = d > 0 ? Math.min(f, d) / d * 100 : 0, F = g === "below", I = F ? void 0 : { width: `${r(d).length}ch` };
57
57
  return /* @__PURE__ */ c("div", {
58
- className: e("zen__seek-bar flex items-center gap-3", v),
58
+ "data-times": g,
59
+ className: t("zen__seek-bar flex items-center", F ? "flex-wrap justify-between gap-y-1" : "gap-3", y),
59
60
  children: [
60
61
  /* @__PURE__ */ s("span", {
61
- className: "text-muted-foreground shrink-0 text-end text-xs tabular-nums",
62
- style: P,
63
- children: r(E)
62
+ className: t("text-muted-foreground shrink-0 text-xs tabular-nums", !F && "text-end"),
63
+ style: I,
64
+ children: r(D)
64
65
  }),
65
66
  /* @__PURE__ */ c("div", {
66
- className: e("group relative h-5 min-w-0 flex-1", M && "opacity-50"),
67
+ className: t("group relative h-5 min-w-0 flex-1", F && "order-first basis-full", N && "opacity-50"),
67
68
  children: [
68
69
  /* @__PURE__ */ s(n, {
69
- "aria-label": b.seek,
70
+ "aria-label": x.seek,
70
71
  min: 0,
71
72
  max: d || 1,
72
73
  step: "any",
73
- value: E,
74
- disabled: M,
75
- valueText: () => b.timeOf(r(E), r(d)),
74
+ value: D,
75
+ disabled: N,
76
+ valueText: () => x.timeOf(r(D), r(d)),
76
77
  className: "absolute inset-0 z-10 h-full opacity-0",
77
- onKeyDown: j,
78
- onValueChange: S,
78
+ onKeyDown: M,
79
+ onValueChange: C,
79
80
  onValueCommit: (e) => {
80
- S(null), w({
81
+ C(null), T({
81
82
  at: e,
82
83
  from: u
83
84
  }), h(e);
84
85
  },
85
- ...y
86
+ ...b
86
87
  }),
87
88
  /* @__PURE__ */ c("div", {
88
89
  "aria-hidden": !0,
89
90
  className: "absolute inset-x-0 top-1/2 h-2.5 -translate-y-1/2 overflow-hidden rounded-full bg-[oklch(var(--muted))]",
90
91
  children: [/* @__PURE__ */ s("div", {
91
92
  className: "absolute inset-y-0 start-0 bg-[oklch(var(--tint)/0.22)] transition-[width] duration-300",
92
- style: { width: `${N}%` }
93
+ style: { width: `${P}%` }
93
94
  }), /* @__PURE__ */ s("div", {
94
95
  className: "[container-type:inline-size] absolute inset-x-2.5 inset-y-0",
95
96
  children: /* @__PURE__ */ s("div", {
96
- ref: D,
97
+ ref: O,
97
98
  className: "bg-primary absolute inset-y-0 end-full w-[calc(100%+0.625rem)]"
98
99
  })
99
100
  })]
@@ -102,7 +103,7 @@ function u({ currentTime: u, duration: d, buffered: f = 0, playing: p = !1, play
102
103
  "aria-hidden": !0,
103
104
  className: "[container-type:inline-size] pointer-events-none absolute inset-x-2.5 inset-y-0",
104
105
  children: /* @__PURE__ */ s("div", {
105
- ref: O,
106
+ ref: k,
106
107
  className: "bg-primary group-has-[input:focus-visible]:ring-ring/40 absolute start-0 top-1/2 -ms-2.5 -mt-2.5 size-5 rounded-full border-2 border-white shadow-[0_0_0_1px_oklch(0_0_0/0.3),0_0_16px_oklch(var(--glow)/calc(0.8*var(--glow-k)))] group-has-[input:focus-visible]:ring-4"
107
108
  })
108
109
  })
@@ -110,7 +111,7 @@ function u({ currentTime: u, duration: d, buffered: f = 0, playing: p = !1, play
110
111
  }),
111
112
  /* @__PURE__ */ s("span", {
112
113
  className: "text-muted-foreground shrink-0 text-xs tabular-nums",
113
- style: P,
114
+ style: I,
114
115
  children: r(d)
115
116
  })
116
117
  ]
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useTypeahead as t } from "../utils/typeahead.js";
4
- import { useControllable as n } from "../utils/useControllable.js";
5
- import { useAnchoredPopup as r } from "../utils/useAnchoredPopup.js";
6
- import { useMessages as i } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
+ import { useTypeahead as n } from "../utils/typeahead.js";
5
+ import { useControllable as r } from "../utils/useControllable.js";
6
+ import { useAnchoredPopup as i } from "../utils/useAnchoredPopup.js";
7
7
  import { CheckIcon as a } from "../utils/status-icons.js";
8
8
  import { useFieldProps as o } from "../field/index.js";
9
9
  import { FIELD_SIZE as s, POPUP as c, TRIGGER as l } from "../utils/styles.js";
@@ -14,14 +14,14 @@ import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
14
14
  //#region packages/select/index.tsx
15
15
  var w = m(null);
16
16
  function T({ value: a, defaultValue: f = null, onValueChange: p, placeholder: m, disabled: h = !1, size: g = "default", name: v, id: T, className: D, listClassName: O, children: k, style: A, onKeyDown: j, ...M }) {
17
- let N = i(), P = m ?? N.selectPlaceholder, [F, I, L] = n(a, f, p), R = y(null), z = te(), B = T ?? z, ne = o({
17
+ let N = e(), P = m ?? N.selectPlaceholder, [F, I, L] = r(a, f, p), R = y(null), z = te(), B = T ?? z, ne = o({
18
18
  ...M,
19
19
  id: T
20
- }), [V, H] = b(null), U = t(), [W, G] = b(/* @__PURE__ */ new Map()), K = () => Array.from(R.current?.querySelectorAll("[role=\"option\"]") ?? []).map((e) => ({
20
+ }), [V, H] = b(null), U = n(), [W, G] = b(/* @__PURE__ */ new Map()), K = () => Array.from(R.current?.querySelectorAll("[role=\"option\"]") ?? []).map((e) => ({
21
21
  value: e.dataset.value,
22
22
  label: e.dataset.label ?? "",
23
23
  disabled: e.getAttribute("aria-disabled") === "true"
24
- })), q = r({
24
+ })), q = i({
25
25
  matchWidth: !0,
26
26
  onOpenChange: (e) => {
27
27
  if (!e) return;
@@ -82,9 +82,9 @@ function T({ value: a, defaultValue: f = null, onValueChange: p, placeholder: m,
82
82
  onKeyDown: (e) => {
83
83
  j?.(e), ["ArrowDown", "ArrowUp"].includes(e.key) && !q.open && (e.preventDefault(), q.setOpen(!0));
84
84
  },
85
- className: e("zen__select group", l, s[g], "w-full", q.open && "border-glow/60 [--glow-border-color:transparent] shadow-glow-focus", D),
85
+ className: t("zen__select group", l, s[g], "w-full", q.open && "border-glow/60 [--glow-border-color:transparent] shadow-glow-focus", D),
86
86
  children: [/* @__PURE__ */ S("span", {
87
- className: e("truncate", Z === void 0 && "text-[color:oklch(var(--muted-foreground)/var(--zen-placeholder))]"),
87
+ className: t("truncate", Z === void 0 && "text-[color:oklch(var(--muted-foreground)/var(--zen-placeholder))]"),
88
88
  children: Z ?? P
89
89
  }), /* @__PURE__ */ S(d, { open: q.open })]
90
90
  }),
@@ -95,7 +95,7 @@ function T({ value: a, defaultValue: f = null, onValueChange: p, placeholder: m,
95
95
  }),
96
96
  /* @__PURE__ */ S("div", {
97
97
  ...q.popupProps,
98
- className: e("zen__popover", c, "overflow-visible py-1", O),
98
+ className: t("zen__popover", c, "overflow-visible py-1", O),
99
99
  children: /* @__PURE__ */ S("div", {
100
100
  ref: R,
101
101
  role: "listbox",
@@ -131,28 +131,28 @@ function E(e, t) {
131
131
  });
132
132
  }
133
133
  var D = (e) => typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(D).join("") : "";
134
- function O({ value: t, label: n, disabled: r, className: i, children: o }) {
134
+ function O({ value: e, label: n, disabled: r, className: i, children: o }) {
135
135
  let s = g(w);
136
136
  if (!s) throw Error("SelectItem must be inside a Select");
137
137
  let c = y(null), l = n ?? D(o), u = s.register;
138
- v(() => u(t, l || c.current?.textContent?.trim() || ""), [
138
+ v(() => u(e, l || c.current?.textContent?.trim() || ""), [
139
139
  u,
140
- t,
140
+ e,
141
141
  l
142
142
  ]);
143
- let d = s.value === t;
143
+ let d = s.value === e;
144
144
  return /* @__PURE__ */ C("div", {
145
145
  ref: c,
146
- id: s.optionId(t),
146
+ id: s.optionId(e),
147
147
  role: "option",
148
- "data-value": t,
148
+ "data-value": e,
149
149
  "data-label": l || void 0,
150
150
  "aria-selected": d,
151
151
  "aria-disabled": r || void 0,
152
- "data-highlighted": s.active === t || void 0,
153
- onMouseMove: () => !r && s.setActive(t),
154
- onClick: () => s.choose(t),
155
- className: e("grid cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none", "data-highlighted:bg-muted aria-disabled:cursor-not-allowed aria-disabled:opacity-50", i),
152
+ "data-highlighted": s.active === e || void 0,
153
+ onMouseMove: () => !r && s.setActive(e),
154
+ onClick: () => s.choose(e),
155
+ className: t("grid cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none", "data-highlighted:bg-muted aria-disabled:cursor-not-allowed aria-disabled:opacity-50", i),
156
156
  children: [/* @__PURE__ */ S("span", {
157
157
  className: "text-primary col-start-1",
158
158
  "aria-hidden": !0,
@@ -12,11 +12,23 @@ export { flattenTree, type SortableNode, type SortableRow } from './tree-model';
12
12
  * With `asChild` (and `asChild` on the items), your own elements instead: a
13
13
  * TableBody of TableRows, say, one per group, each sorted on its own.
14
14
  */
15
- export declare function SortableList({ value, onValueChange, asChild, className, children, ref, ...rest }: SortableListProps): import('react').JSX.Element;
15
+ export declare function SortableList({ value, onValueChange, itemHeight, onLiftedChange, asChild, className, children, ref, ...rest }: SortableListProps): import('react').JSX.Element;
16
16
  export interface SortableListProps extends ComponentProps<'ul'> {
17
17
  /** The items' ids, in order. */
18
18
  value: readonly string[];
19
19
  onValueChange: (value: string[]) => void;
20
+ /**
21
+ * For a virtualized list (useVirtualList), its rows' height, gap included:
22
+ * render just the items in view, each placed at its place in `value` times
23
+ * this, and the drag works from `value` instead of the rows on screen.
24
+ */
25
+ itemHeight?: number;
26
+ /**
27
+ * When an item is picked up (by its handle, or from the keyboard), and when it's
28
+ * put down (null). A virtualized list keeps that row rendered meanwhile
29
+ * (useVirtualList's `keep`), so it stays under the pointer as the list scrolls.
30
+ */
31
+ onLiftedChange?: (id: string | null) => void;
20
32
  /** Put the list's props on your own element (the single child, e.g. a TableBody) instead of a ul. */
21
33
  asChild?: boolean;
22
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/sortable/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAA6E,MAAM,OAAO,CAAC;AAIlH,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1G,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAUhF;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,+BAkInH;AAED,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAC3D,gCAAgC;IAChC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,qGAAqG;IACrG,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/sortable/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAA6E,MAAM,OAAO,CAAC;AAIlH,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1G,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAUhF;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EACzB,KAAK,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,OAAO,EACP,SAAS,EACT,QAAQ,EACR,GAAG,EACH,GAAG,IAAI,EACV,EAAE,iBAAiB,+BAmKnB;AAED,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAC3D,gCAAgC;IAChC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,qGAAqG;IACrG,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useMergedRefs as t } from "../utils/refs.js";
4
- import { Slot as n } from "../utils/slot.js";
5
- import { useMessages as r } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
+ import { useMergedRefs as n } from "../utils/refs.js";
5
+ import { Slot as r } from "../utils/slot.js";
6
6
  import { SortableContext as i, SortableHandle as a, SortableItem as o, edgeScroll as s, scrollerOf as c, settle as l, shift as u, topsOf as d, useAnnouncer as f } from "./shared.js";
7
7
  import { flattenTree as p } from "./tree-model.js";
8
8
  import m from "./tree.js";
@@ -13,72 +13,91 @@ var x = typeof window > "u" ? h : g, S = (e, t, n) => {
13
13
  let r = [...e];
14
14
  return r.splice(n, 0, ...r.splice(t, 1)), r;
15
15
  };
16
- function C({ value: a, onValueChange: o, asChild: p, className: m, children: h, ref: g, ...C }) {
17
- let w = _(null), T = t(w, g), [E, D] = v(null), O = r(), { say: k, region: A } = f(w), j = _(null), M = _(null), N = () => [...w.current?.querySelectorAll(":scope > [data-sortable-id]") ?? []], P = (e) => {
18
- j.current = d(N()), o(e);
16
+ function C({ value: a, onValueChange: o, itemHeight: p, onLiftedChange: m, asChild: h, className: g, children: C, ref: w, ...T }) {
17
+ let E = _(null), D = n(E, w), [O, k] = v(null), A = e(), { say: j, region: M } = f(E), N = _(null), P = _(null), F = _(null), I = () => [...E.current?.querySelectorAll(":scope > [data-sortable-id]") ?? []], L = (e) => {
18
+ N.current = d(I()), o(e);
19
19
  };
20
20
  x(() => {
21
- let e = j.current;
22
- j.current = null, e && l(N(), e);
23
- }, [a]);
24
- let F = (e, t) => {
25
- if (e.button !== 0 || E) return;
26
- let n = N(), r = n.findIndex((e) => e.dataset.sortableId === t), i = n[r];
27
- if (!i) return;
28
- e.preventDefault();
29
- let o = e.currentTarget;
30
- o.setPointerCapture?.(e.pointerId);
31
- let f = c(w.current), p = f.scrollTop, m = e.clientY, h = n.map((e) => e.getBoundingClientRect()), g = h.length > 1 ? h[1].top - h[0].bottom : 0, _ = h[r].height + g, v = h.map((e) => e.top + e.height / 2), y = r, b = e.clientY;
32
- i.dataset.dragging = "", w.current.dataset.sorting = "";
21
+ let e = N.current;
22
+ N.current = null, e && l(I(), e), O && I().find((e) => e.dataset.sortableId === O)?.scrollIntoView?.({ block: "nearest" });
23
+ }, [a]), x(() => F.current?.());
24
+ let R = (e, t) => {
25
+ if (e.button !== 0 || O) return;
26
+ let n = I(), r = a.indexOf(t), i = n.find((e) => e.dataset.sortableId === t);
27
+ if (r < 0 || !i) return;
28
+ e.preventDefault(), e.currentTarget.setPointerCapture?.(e.pointerId);
29
+ let o = c(E.current), f = o.scrollTop, h = e.clientY, g = new Map(a.map((e, t) => [e, t])), _, v;
30
+ if (p) _ = p, v = (e) => Math.max(0, Math.min(r + Math.trunc(e / _), a.length - 1));
31
+ else {
32
+ let e = n.map((e) => e.getBoundingClientRect()), t = e.length > 1 ? e[1].top - e[0].bottom : 0;
33
+ _ = e[r].height + t;
34
+ let i = e.map((e) => e.top + e.height / 2);
35
+ v = (e) => {
36
+ let t = i[r] + e, a = r;
37
+ for (; a < n.length - 1 && t > i[a + 1];) a++;
38
+ for (; a > 0 && t < i[a - 1];) a--;
39
+ return a;
40
+ };
41
+ }
42
+ let y = r, b = e.clientY;
43
+ E.current.dataset.sorting = "", m?.(t);
33
44
  let x = () => {
34
- let e = b - m + f.scrollTop - p;
35
- u(i, e);
36
- let t = v[r] + e, a = y;
37
- for (y = r; y < n.length - 1 && t > v[y + 1];) y++;
38
- for (; y > 0 && t < v[y - 1];) y--;
39
- y !== a && navigator.vibrate?.(5), n.forEach((e, t) => {
40
- if (t === r) return;
41
- let n = r < t && t <= y ? -_ : y <= t && t < r ? _ : 0;
42
- u(e, n);
43
- });
44
- }, C = s(f, x), T = (t) => {
45
+ let e = b - h + o.scrollTop - f, t = y;
46
+ y = v(e), y !== t && navigator.vibrate?.(5);
47
+ for (let t of I()) {
48
+ let n = g.get(t.dataset.sortableId);
49
+ if (n !== void 0) {
50
+ if (n === r) {
51
+ t.dataset.dragging = "", u(t, e);
52
+ continue;
53
+ }
54
+ u(t, r < n && n <= y ? -_ : y <= n && n < r ? _ : 0);
55
+ }
56
+ }
57
+ };
58
+ F.current = x;
59
+ let C = s(o, x), w = (t) => {
45
60
  t.pointerId === e.pointerId && (b = t.clientY, x(), C.at(b));
46
- }, D = (t) => {
47
- t.pointerId === e.pointerId && (o.removeEventListener("pointermove", T), o.removeEventListener("pointerup", D), o.removeEventListener("pointercancel", D), C.stop(), delete i.dataset.dragging, delete w.current?.dataset.sorting, t.type === "pointerup" && y !== r ? P(S(a, r, y)) : l(n, d(n)));
61
+ }, T = (t) => {
62
+ if (t.pointerId !== e.pointerId) return;
63
+ removeEventListener("pointermove", w), removeEventListener("pointerup", T), removeEventListener("pointercancel", T), C.stop(), F.current = null;
64
+ let n = I();
65
+ for (let e of n) delete e.dataset.dragging;
66
+ delete E.current?.dataset.sorting, m?.(null), t.type === "pointerup" && y !== r ? L(S(a, r, y)) : l(n, d(n));
48
67
  };
49
- o.addEventListener("pointermove", T), o.addEventListener("pointerup", D), o.addEventListener("pointercancel", D);
50
- }, I = (e, t, n) => {
51
- let r = a.indexOf(t), i = O.place(r + 1, a.length);
52
- if (e.key === " " || e.key === "Enter") e.preventDefault(), E === t ? (D(null), M.current = null, k(O.dropped(n, i))) : E || (D(t), M.current = a, k(O.pickedUp(n, i)));
53
- else if (E === t && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
68
+ addEventListener("pointermove", w), addEventListener("pointerup", T), addEventListener("pointercancel", T);
69
+ }, z = (e, t, n) => {
70
+ let r = a.indexOf(t), i = A.place(r + 1, a.length);
71
+ if (e.key === " " || e.key === "Enter") e.preventDefault(), O === t ? (k(null), P.current = null, m?.(null), j(A.dropped(n, i))) : O || (k(t), P.current = a, m?.(t), j(A.pickedUp(n, i)));
72
+ else if (O === t && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
54
73
  e.preventDefault();
55
74
  let t = r + (e.key === "ArrowUp" ? -1 : 1);
56
75
  if (t < 0 || t >= a.length) return;
57
- P(S(a, r, t)), k(O.movedTo(n, O.place(t + 1, a.length)));
58
- } else if (E === t && e.key === "Escape") {
76
+ L(S(a, r, t)), j(A.movedTo(n, A.place(t + 1, a.length)));
77
+ } else if (O === t && e.key === "Escape") {
59
78
  e.preventDefault();
60
- let r = M.current ?? a;
61
- D(null), M.current = null, r !== a && P([...r]), k(O.putBack(n, O.place(r.indexOf(t) + 1, r.length)));
79
+ let r = P.current ?? a;
80
+ k(null), P.current = null, m?.(null), r !== a && L([...r]), j(A.putBack(n, A.place(r.indexOf(t) + 1, r.length)));
62
81
  }
63
- }, L = {
64
- ...C,
65
- ref: T
82
+ }, B = {
83
+ ...T,
84
+ ref: D
66
85
  };
67
86
  return /* @__PURE__ */ b(i.Provider, {
68
87
  value: {
69
- grab: F,
70
- key: I,
71
- lifted: E
88
+ grab: R,
89
+ key: z,
90
+ lifted: O
72
91
  },
73
- children: [p ? /* @__PURE__ */ y(n, {
74
- ...L,
75
- className: e("zen__sortable", m),
76
- children: h
92
+ children: [h ? /* @__PURE__ */ y(r, {
93
+ ...B,
94
+ className: t("zen__sortable", g),
95
+ children: C
77
96
  }) : /* @__PURE__ */ y("ul", {
78
- ...L,
79
- className: e("zen__sortable relative flex flex-col", m),
80
- children: h
81
- }), A]
97
+ ...B,
98
+ className: t("zen__sortable relative flex flex-col", g),
99
+ children: C
100
+ }), M]
82
101
  });
83
102
  }
84
103
  //#endregion
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { Slot as t } from "../utils/slot.js";
4
- import { useMessages as n } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
+ import { Slot as n } from "../utils/slot.js";
5
5
  import { reducedMotion as r } from "../utils/motion.js";
6
6
  import { createContext as i, useContext as a, useEffect as o, useState as s } from "react";
7
7
  import { jsx as c } from "react/jsx-runtime";
@@ -58,26 +58,26 @@ function b(e) {
58
58
  host: r
59
59
  };
60
60
  }
61
- function x({ id: n, label: r, asChild: i, className: a, ...o }) {
61
+ function x({ id: e, label: r, asChild: i, className: a, ...o }) {
62
62
  let { lifted: s } = p("SortableItem");
63
- return /* @__PURE__ */ c(i ? t : "li", {
64
- "data-sortable-id": n,
63
+ return /* @__PURE__ */ c(i ? n : "li", {
64
+ "data-sortable-id": e,
65
65
  "data-sortable-label": r,
66
- "data-lifted": s === n || void 0,
67
- className: e("zen__sortable-item transition-[box-shadow,scale,background-color] duration-200 [&:not(tr)]:relative", "[&:not(tr)]:data-dragging:bg-card [&:not(tr)]:data-dragging:z-10 [&:not(tr)]:data-dragging:rounded-xl [&:not(tr)]:data-dragging:scale-[1.02] [&:not(tr)]:data-dragging:shadow-[0_0_0_1px_oklch(var(--tint)/0.08),0_12px_32px_-12px_oklch(0_0_0/0.6)]", "[&:not(tr)]:data-lifted:bg-card [&:not(tr)]:data-lifted:z-10 [&:not(tr)]:data-lifted:rounded-xl [&:not(tr)]:data-lifted:shadow-[0_0_0_2px_oklch(var(--primary)/0.6)]", "[&:not(tr)]:data-carried:z-10 [&:not(tr)]:data-carried:bg-card data-drop-target:bg-primary/[0.07] [&[data-drop-target]>td]:[background-image:linear-gradient(oklch(var(--primary)/0.09),oklch(var(--primary)/0.09))]", "[&:is([data-dragging],[data-carried])>td]:z-20 [&:is([data-dragging],[data-carried])>td]:bg-card/80 [&:is([data-dragging],[data-carried])>td]:glass-blur [&:is([data-dragging],[data-carried])>td:not(.sticky)]:relative", "[&[data-lifted]>td]:[background-image:linear-gradient(oklch(var(--primary)/0.09),oklch(var(--primary)/0.09))] [&[data-lifted]>td]:shadow-[inset_0_2px_0_oklch(var(--primary)/0.6),inset_0_-2px_0_oklch(var(--primary)/0.6)]", a),
66
+ "data-lifted": s === e || void 0,
67
+ className: t("zen__sortable-item transition-[box-shadow,scale,background-color] duration-200 [&:not(tr)]:relative", "[&:not(tr)]:data-dragging:bg-card [&:not(tr)]:data-dragging:z-10 [&:not(tr)]:data-dragging:rounded-xl [&:not(tr)]:data-dragging:scale-[1.02] [&:not(tr)]:data-dragging:shadow-[0_0_0_1px_oklch(var(--tint)/0.08),0_12px_32px_-12px_oklch(0_0_0/0.6)]", "[&:not(tr)]:data-lifted:bg-card [&:not(tr)]:data-lifted:z-10 [&:not(tr)]:data-lifted:rounded-xl [&:not(tr)]:data-lifted:shadow-[0_0_0_2px_oklch(var(--primary)/0.6)]", "[&:not(tr)]:data-carried:z-10 [&:not(tr)]:data-carried:bg-card data-drop-target:bg-primary/[0.07] [&[data-drop-target]>td]:[background-image:linear-gradient(oklch(var(--primary)/0.09),oklch(var(--primary)/0.09))]", "[&:is([data-dragging],[data-carried])>td]:z-20 [&:is([data-dragging],[data-carried])>td]:bg-card/80 [&:is([data-dragging],[data-carried])>td]:glass-blur [&:is([data-dragging],[data-carried])>td:not(.sticky)]:relative", "[&[data-lifted]>td]:[background-image:linear-gradient(oklch(var(--primary)/0.09),oklch(var(--primary)/0.09))] [&[data-lifted]>td]:shadow-[inset_0_2px_0_oklch(var(--primary)/0.6),inset_0_-2px_0_oklch(var(--primary)/0.6)]", a),
68
68
  ...o
69
69
  });
70
70
  }
71
- function S({ id: t, label: r, className: i, children: a, ...o }) {
72
- let { grab: s, key: l, lifted: u } = p("SortableHandle"), d = n();
71
+ function S({ id: n, label: r, className: i, children: a, ...o }) {
72
+ let { grab: s, key: l, lifted: u } = p("SortableHandle"), d = e();
73
73
  return /* @__PURE__ */ c("button", {
74
74
  type: "button",
75
75
  "aria-label": d.reorder(r),
76
76
  "data-sortable-label": r,
77
- "aria-pressed": u === t,
78
- onPointerDown: (e) => s(e, t),
79
- onKeyDown: (e) => l(e, t, r),
80
- className: e("text-muted-foreground hover:text-foreground grid size-8 shrink-0 cursor-grab touch-none place-items-center rounded-md outline-hidden select-none focus-ring active:cursor-grabbing", i),
77
+ "aria-pressed": u === n,
78
+ onPointerDown: (e) => s(e, n),
79
+ onKeyDown: (e) => l(e, n, r),
80
+ className: t("text-muted-foreground hover:text-foreground grid size-8 shrink-0 cursor-grab touch-none place-items-center rounded-md outline-hidden select-none focus-ring active:cursor-grabbing", i),
81
81
  ...o,
82
82
  children: a ?? /* @__PURE__ */ c("svg", {
83
83
  "aria-hidden": !0,
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { readingKey as t } from "../utils/direction.js";
4
- import { useMergedRefs as n } from "../utils/refs.js";
5
- import { Slot as r } from "../utils/slot.js";
6
- import { useMessages as i } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
+ import { readingKey as n } from "../utils/direction.js";
5
+ import { useMergedRefs as r } from "../utils/refs.js";
6
+ import { Slot as i } from "../utils/slot.js";
7
7
  import { SortableContext as a, edgeScroll as o, scrollerOf as s, settle as c, shift as l, topsOf as u, useAnnouncer as d } from "./shared.js";
8
8
  import { indexTree as f, insertNode as p, nearestSlot as m, removeNode as h, treeSlots as g } from "./tree-model.js";
9
9
  import { useEffect as _, useLayoutEffect as v, useRef as y, useState as b } from "react";
@@ -11,7 +11,7 @@ import { jsx as x, jsxs as S } from "react/jsx-runtime";
11
11
  //#region packages/sortable/tree.tsx
12
12
  var C = typeof window > "u" ? _ : v, w = "pointer-events-none fixed z-50 h-0.5 rounded-full bg-primary shadow-[0_0_10px_oklch(var(--glow)/calc(0.9*var(--glow-k)))] transition-[top,left,width] duration-100 before:absolute before:-top-[3px] before:-start-1 before:size-2 before:rounded-full before:border-2 before:border-primary before:bg-background", T = (e, t) => e.parentId === t.parentId && e.index === t.index;
13
13
  function E({ value: _, onValueChange: v, accepts: E, indent: k = 24, asChild: A, className: j, children: M, ref: N, ...P }) {
14
- let F = y(null), I = n(F, N), [L, R] = b(null), z = i(), { say: B, region: V, host: H } = d(F), U = y(null), W = y(null), G = () => [...F.current?.querySelectorAll("[data-sortable-id]") ?? []].filter((e) => e.parentElement?.closest(".zen__sortable") === F.current), K = (e) => G().find((t) => t.dataset.sortableId === e), q = (e) => {
14
+ let F = y(null), I = r(F, N), [L, R] = b(null), z = e(), { say: B, region: V, host: H } = d(F), U = y(null), W = y(null), G = () => [...F.current?.querySelectorAll("[data-sortable-id]") ?? []].filter((e) => e.parentElement?.closest(".zen__sortable") === F.current), K = (e) => G().find((t) => t.dataset.sortableId === e), q = (e) => {
15
15
  U.current = u(G()), v(e);
16
16
  };
17
17
  C(() => {
@@ -73,19 +73,19 @@ function E({ value: _, onValueChange: v, accepts: E, indent: k = 24, asChild: A,
73
73
  }
74
74
  };
75
75
  r.addEventListener("pointermove", A), r.addEventListener("pointerup", j), r.addEventListener("pointercancel", j);
76
- }, Q = (e, n, r) => {
76
+ }, Q = (e, t, r) => {
77
77
  if (e.key === " " || e.key === "Enter") {
78
- e.preventDefault(), L === n ? (R(null), W.current = null, B(z.dropped(r, Y(_, n)))) : L || (R(n), W.current = _, B(z.pickedUp(r, Y(_, n))));
78
+ e.preventDefault(), L === t ? (R(null), W.current = null, B(z.dropped(r, Y(_, t)))) : L || (R(t), W.current = _, B(z.pickedUp(r, Y(_, t))));
79
79
  return;
80
80
  }
81
- if (L !== n) return;
81
+ if (L !== t) return;
82
82
  if (e.key === "Escape") {
83
83
  e.preventDefault();
84
- let t = W.current ?? _;
85
- R(null), W.current = null, t !== _ && q(t), B(z.putBack(r, Y(t, n)));
84
+ let n = W.current ?? _;
85
+ R(null), W.current = null, n !== _ && q(n), B(z.putBack(r, Y(n, t)));
86
86
  return;
87
87
  }
88
- let i = t(e.key, e.currentTarget);
88
+ let i = n(e.key, e.currentTarget);
89
89
  if (![
90
90
  "ArrowUp",
91
91
  "ArrowDown",
@@ -93,7 +93,7 @@ function E({ value: _, onValueChange: v, accepts: E, indent: k = 24, asChild: A,
93
93
  "ArrowRight"
94
94
  ].includes(i)) return;
95
95
  e.preventDefault();
96
- let a = X(n), o = a.slots.find((e) => T(e, a.place));
96
+ let a = X(t), o = a.slots.find((e) => T(e, a.place));
97
97
  if (!o) return;
98
98
  let s;
99
99
  if (i === "ArrowLeft" || i === "ArrowRight") {
@@ -105,7 +105,7 @@ function E({ value: _, onValueChange: v, accepts: E, indent: k = 24, asChild: A,
105
105
  }
106
106
  if (!s) return;
107
107
  let c = p(a.tree, s, a.node);
108
- q(c), B(z.movedTo(r, Y(c, n)));
108
+ q(c), B(z.movedTo(r, Y(c, t)));
109
109
  }, $ = {
110
110
  ...P,
111
111
  ref: I
@@ -116,13 +116,13 @@ function E({ value: _, onValueChange: v, accepts: E, indent: k = 24, asChild: A,
116
116
  key: Q,
117
117
  lifted: L
118
118
  },
119
- children: [A ? /* @__PURE__ */ x(r, {
119
+ children: [A ? /* @__PURE__ */ x(i, {
120
120
  ...$,
121
- className: e("zen__sortable", j),
121
+ className: t("zen__sortable", j),
122
122
  children: M
123
123
  }) : /* @__PURE__ */ x("ul", {
124
124
  ...$,
125
- className: e("zen__sortable relative flex flex-col", j),
125
+ className: t("zen__sortable relative flex flex-col", j),
126
126
  children: M
127
127
  }), V]
128
128
  });
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useMessages as t } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
4
  import { useSeen as n } from "../utils/useSeen.js";
5
5
  import { useId as r, useRef as i } from "react";
6
6
  import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
7
7
  //#region packages/sparkline/index.tsx
8
8
  function c({ values: c, area: l = !0, tone: u = "default", className: d, ref: f, ...p }) {
9
- let m = t(), h = r(), g = i(null), _ = n(g);
9
+ let m = e(), h = r(), g = i(null), _ = n(g);
10
10
  if (c.length < 2) return null;
11
11
  let v = Math.min(...c), y = Math.max(...c) - v || 1, b = c.map((e, t) => [t / (c.length - 1) * 100, 38 - (e - v) / y * 36]).map(([e, t], n) => `${n ? "L" : "M"}${e.toFixed(2)},${t.toFixed(2)}`).join(""), x = u === "default" ? "var(--color-primary)" : u === "negative" ? "var(--color-destructive)" : "var(--color-muted-foreground)", S = c[0], C = c[c.length - 1];
12
12
  return /* @__PURE__ */ s("svg", {
@@ -19,7 +19,7 @@ function c({ values: c, area: l = !0, tone: u = "default", className: d, ref: f,
19
19
  "aria-label": m.fromTo(String(S), String(C)),
20
20
  viewBox: "0 0 100 40",
21
21
  preserveAspectRatio: "none",
22
- className: e("zen__sparkline h-8 w-24 overflow-visible", d),
22
+ className: t("zen__sparkline h-8 w-24 overflow-visible", d),
23
23
  style: { color: x },
24
24
  ...p,
25
25
  children: [l && /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("defs", { children: /* @__PURE__ */ s("linearGradient", {