@rinzai/zen 0.9.0 → 0.10.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 (112) hide show
  1. package/dist/animated-number/index.d.ts +6 -2
  2. package/dist/animated-number/index.d.ts.map +1 -1
  3. package/dist/animated-number/index.js +68 -17
  4. package/dist/calendar-heatmap/index.d.ts +25 -0
  5. package/dist/calendar-heatmap/index.d.ts.map +1 -0
  6. package/dist/calendar-heatmap/index.js +48 -0
  7. package/dist/chart/allocation.d.ts +30 -0
  8. package/dist/chart/allocation.d.ts.map +1 -0
  9. package/dist/chart/allocation.js +69 -0
  10. package/dist/chart/index.d.ts +1 -0
  11. package/dist/chart/index.d.ts.map +1 -1
  12. package/dist/chart/index.js +85 -83
  13. package/dist/code-block/index.d.ts +1 -1
  14. package/dist/code-block/index.d.ts.map +1 -1
  15. package/dist/code-block/index.js +31 -22
  16. package/dist/collapse/index.d.ts +3 -2
  17. package/dist/collapse/index.d.ts.map +1 -1
  18. package/dist/collapse/index.js +1 -1
  19. package/dist/date-picker/index.d.ts +10 -2
  20. package/dist/date-picker/index.d.ts.map +1 -1
  21. package/dist/date-picker/index.js +43 -21
  22. package/dist/dialog/index.d.ts +4 -2
  23. package/dist/dialog/index.d.ts.map +1 -1
  24. package/dist/dialog/index.js +69 -113
  25. package/dist/editable-cell/index.d.ts +2 -1
  26. package/dist/editable-cell/index.d.ts.map +1 -1
  27. package/dist/editable-cell/index.js +24 -17
  28. package/dist/filter-bar/index.d.ts +21 -0
  29. package/dist/filter-bar/index.d.ts.map +1 -0
  30. package/dist/filter-bar/index.js +90 -0
  31. package/dist/icon-picker/index.d.ts +38 -0
  32. package/dist/icon-picker/index.d.ts.map +1 -0
  33. package/dist/icon-picker/index.js +112 -0
  34. package/dist/icons/arrow-left.js +23 -0
  35. package/dist/icons/micro/arrow-trending-down.d.ts +3 -0
  36. package/dist/icons/micro/arrow-trending-down.d.ts.map +1 -0
  37. package/dist/icons/micro/arrow-trending-down.js +21 -0
  38. package/dist/icons/micro/arrow-trending-up.d.ts +3 -0
  39. package/dist/icons/micro/arrow-trending-up.d.ts.map +1 -0
  40. package/dist/icons/micro/arrow-trending-up.js +21 -0
  41. package/dist/index.d.ts +17 -5
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/kbd/index.d.ts +4 -0
  44. package/dist/kbd/index.d.ts.map +1 -0
  45. package/dist/kbd/index.js +12 -0
  46. package/dist/keypad/index.d.ts +20 -0
  47. package/dist/keypad/index.d.ts.map +1 -0
  48. package/dist/keypad/index.js +42 -0
  49. package/dist/lib.js +92 -77
  50. package/dist/load-more/index.d.ts +19 -0
  51. package/dist/load-more/index.d.ts.map +1 -0
  52. package/dist/load-more/index.js +37 -0
  53. package/dist/menu/index.d.ts +22 -3
  54. package/dist/menu/index.d.ts.map +1 -1
  55. package/dist/menu/index.js +132 -45
  56. package/dist/meter/index.d.ts +3 -1
  57. package/dist/meter/index.d.ts.map +1 -1
  58. package/dist/meter/index.js +19 -14
  59. package/dist/money-input/index.d.ts +3 -3
  60. package/dist/page-transition/index.d.ts +10 -0
  61. package/dist/page-transition/index.d.ts.map +1 -0
  62. package/dist/page-transition/index.js +16 -0
  63. package/dist/progress-ring/index.d.ts +4 -1
  64. package/dist/progress-ring/index.d.ts.map +1 -1
  65. package/dist/progress-ring/index.js +47 -38
  66. package/dist/range-slider/index.d.ts +26 -0
  67. package/dist/range-slider/index.d.ts.map +1 -0
  68. package/dist/range-slider/index.js +44 -0
  69. package/dist/repeat-picker/index.d.ts +22 -0
  70. package/dist/repeat-picker/index.d.ts.map +1 -0
  71. package/dist/repeat-picker/index.js +115 -0
  72. package/dist/slider/index.d.ts +2 -0
  73. package/dist/slider/index.d.ts.map +1 -1
  74. package/dist/slider/index.js +19 -18
  75. package/dist/sortable/index.d.ts +33 -0
  76. package/dist/sortable/index.d.ts.map +1 -0
  77. package/dist/sortable/index.js +147 -0
  78. package/dist/table/index.d.ts +5 -1
  79. package/dist/table/index.d.ts.map +1 -1
  80. package/dist/table/index.js +90 -58
  81. package/dist/table/selection.d.ts +55 -0
  82. package/dist/table/selection.d.ts.map +1 -0
  83. package/dist/table/selection.js +83 -0
  84. package/dist/table/swipe.d.ts +18 -0
  85. package/dist/table/swipe.d.ts.map +1 -0
  86. package/dist/table/swipe.js +53 -0
  87. package/dist/tabs/index.d.ts.map +1 -1
  88. package/dist/tabs/index.js +101 -51
  89. package/dist/theme-toggle/index.js +6 -6
  90. package/dist/theme.css +184 -11
  91. package/dist/toast/index.js +25 -25
  92. package/dist/toggle/index.d.ts.map +1 -1
  93. package/dist/toggle/index.js +1 -1
  94. package/dist/trend/index.d.ts +19 -0
  95. package/dist/trend/index.d.ts.map +1 -0
  96. package/dist/trend/index.js +27 -0
  97. package/dist/utils/date.d.ts +34 -0
  98. package/dist/utils/date.d.ts.map +1 -1
  99. package/dist/utils/date.js +45 -12
  100. package/dist/utils/money.d.ts +3 -1
  101. package/dist/utils/money.d.ts.map +1 -1
  102. package/dist/utils/money.js +24 -1
  103. package/dist/utils/repeat.d.ts +17 -0
  104. package/dist/utils/repeat.d.ts.map +1 -0
  105. package/dist/utils/repeat.js +38 -0
  106. package/dist/utils/swipe.d.ts +29 -0
  107. package/dist/utils/swipe.d.ts.map +1 -0
  108. package/dist/utils/swipe.js +85 -0
  109. package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
  110. package/dist/utils/useAnchoredPopup.js +3 -9
  111. package/dist/zen.css +1 -1
  112. package/package.json +3 -1
@@ -3,47 +3,48 @@ import { cx as e } from "../utils/cx.js";
3
3
  import { useSeen as t } from "../utils/useSeen.js";
4
4
  import { paletteColor as n } from "./palette.js";
5
5
  import { ChartTooltipCard as r, Key as i } from "./tooltip.js";
6
- import a from "./donut.js";
7
- import { Children as o, isValidElement as s, useEffect as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
6
+ import a from "./allocation.js";
7
+ import o from "./donut.js";
8
+ import { Children as s, isValidElement as ee, useEffect as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
8
9
  import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
9
10
  //#region packages/chart/index.tsx
10
- var g = () => null, _ = () => null, v = () => null, ee = () => null, te = /* @__PURE__ */ new Map([
11
+ var g = () => null, _ = () => null, v = () => null, te = () => null, y = /* @__PURE__ */ new Map([
11
12
  [g, "area"],
12
13
  [_, "line"],
13
14
  [v, "bar"]
14
- ]), y = {
15
+ ]), b = {
15
16
  top: 12,
16
17
  right: 8,
17
18
  bottom: 26
18
- }, b = 11;
19
- function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v = String, formatY: x = O, formatTooltipX: D, renderTooltip: j, legend: M, palette: ie = "chart", className: N, children: ae }) {
20
- let P = l().replace(/[^\w-]/g, ""), F = d(null), I = T(F), L = t(F), [R, z] = f(null), [B, V] = f(null), H = u(() => {
21
- let e = o.toArray(ae).filter(s), t = e.filter((e) => te.has(e.type)).length, r = [], c = [];
19
+ }, x = 11;
20
+ function S({ data: i, x: a, label: o, summary: c, height: g = 240, formatX: _ = String, formatY: v = O, formatTooltipX: S, renderTooltip: D, legend: j, palette: ae = "chart", className: M, children: N }) {
21
+ let P = l().replace(/[^\w-]/g, ""), F = d(null), I = E(F), L = t(F), [R, z] = f(null), [B, V] = f(null), H = u(() => {
22
+ let e = s.toArray(N).filter(ee), t = e.filter((e) => y.has(e.type)).length, r = [], o = [];
22
23
  for (let i of e) {
23
- i.type === ee && c.push(i.props);
24
- let e = te.get(i.type);
24
+ i.type === te && o.push(i.props);
25
+ let e = y.get(i.type);
25
26
  if (!e) continue;
26
27
  let a = i.props;
27
28
  r.push({
28
29
  ...a,
29
30
  kind: e,
30
- color: a.color ?? n(ie, r.length, t)
31
+ color: a.color ?? n(ae, r.length, t)
31
32
  });
32
33
  }
33
- let l = i, u = r.flatMap((e) => l.map((t) => S(t, e.dataKey))).filter((e) => e !== null);
34
- for (let e of c) e.y !== void 0 && u.push(e.y);
35
- r.some((e) => e.kind !== "line") && u.push(0);
36
- let d = E(u.length ? Math.min(...u) : 0, u.length ? Math.max(...u) : 1), [f, g] = [d[0], d[d.length - 1]], C = d.map((e) => x(e)), w = Math.ceil(Math.max(...C.map((e) => e.length)) * b * .62) + 10, T = Math.max(0, I - w - y.right), D = Math.max(0, _ - y.top - y.bottom), O = l.length, A = r.filter((e) => e.kind === "bar"), j = A.length > 0 || O === 1, M = O ? j ? T / O : T / (O - 1) : 0, N = (e) => w + (j ? (e + .5) * M : e * M), F = (e) => y.top + (g === f ? D / 2 : (g - e) / (g - f) * D), L = F(Math.min(Math.max(0, f), g)), R = A.length ? Math.max(2, Math.min(24, M * .72 / A.length - 2)) : 0, z = (e, t) => N(e) - (A.length * (R + 2) - 2) / 2 + t * (R + 2), B = l.map((e) => v(e[a])), V = Math.max(1, ...B.map((e) => e.length)) * b * .6 + 12, H = M ? Math.max(1, Math.ceil(V / M)) : 1;
34
+ let c = i, l = r.flatMap((e) => c.map((t) => C(t, e.dataKey))).filter((e) => e !== null);
35
+ for (let e of o) e.y !== void 0 && l.push(e.y);
36
+ r.some((e) => e.kind !== "line") && l.push(0);
37
+ let u = ne(l.length ? Math.min(...l) : 0, l.length ? Math.max(...l) : 1), [d, f] = [u[0], u[u.length - 1]], S = u.map((e) => v(e)), w = Math.ceil(Math.max(...S.map((e) => e.length)) * x * .62) + 10, T = Math.max(0, I - w - b.right), E = Math.max(0, g - b.top - b.bottom), D = c.length, O = r.filter((e) => e.kind === "bar"), A = O.length > 0 || D === 1, j = D ? A ? T / D : T / (D - 1) : 0, M = (e) => w + (A ? (e + .5) * j : e * j), F = (e) => b.top + (f === d ? E / 2 : (f - e) / (f - d) * E), L = F(Math.min(Math.max(0, d), f)), R = O.length ? Math.max(2, Math.min(24, j * .72 / O.length - 2)) : 0, z = (e, t) => M(e) - (O.length * (R + 2) - 2) / 2 + t * (R + 2), B = c.map((e) => _(e[a])), V = Math.max(1, ...B.map((e) => e.length)) * x * .6 + 12, H = j ? Math.max(1, Math.ceil(V / j)) : 1;
37
38
  return {
38
39
  series: r,
39
- rows: l,
40
- n: O,
41
- bars: A,
42
- banded: j,
43
- step: M,
40
+ rows: c,
41
+ n: D,
42
+ bars: O,
43
+ banded: A,
44
+ step: j,
44
45
  left: w,
45
- plotH: D,
46
- cx0: N,
46
+ plotH: E,
47
+ cx0: M,
47
48
  cy: F,
48
49
  base: L,
49
50
  barW: R,
@@ -65,7 +66,7 @@ function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v =
65
66
  stopOpacity: 0
66
67
  })]
67
68
  }, t) : null) }),
68
- d.map((e, t) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
69
+ u.map((e, t) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
69
70
  x1: w,
70
71
  x2: w + T,
71
72
  y1: F(e),
@@ -78,23 +79,23 @@ function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v =
78
79
  dy: "0.32em",
79
80
  textAnchor: "end",
80
81
  className: "fill-muted-foreground tabular-nums",
81
- style: { fontSize: b },
82
- children: C[t]
82
+ style: { fontSize: x },
83
+ children: S[t]
83
84
  })] }, e)),
84
85
  B.map((e, t) => t % H === 0 ? /* @__PURE__ */ m("text", {
85
- x: N(t),
86
- y: _ - 8,
87
- textAnchor: !A.length && O > 1 && t === 0 ? "start" : !A.length && t === O - 1 ? "end" : "middle",
86
+ x: M(t),
87
+ y: g - 8,
88
+ textAnchor: !O.length && D > 1 && t === 0 ? "start" : !O.length && t === D - 1 ? "end" : "middle",
88
89
  className: "fill-muted-foreground",
89
- style: { fontSize: b },
90
+ style: { fontSize: x },
90
91
  children: e
91
92
  }, t) : null)
92
93
  ] }),
93
- front: /* @__PURE__ */ h(p, { children: [r.map((e, t) => e.kind === "bar" ? null : ne(l.map((t, n) => {
94
- let r = S(t, e.dataKey);
95
- return r === null ? null : [N(n), F(r)];
94
+ front: /* @__PURE__ */ h(p, { children: [r.map((e, t) => e.kind === "bar" ? null : re(c.map((t, n) => {
95
+ let r = C(t, e.dataKey);
96
+ return r === null ? null : [M(n), F(r)];
96
97
  })).map((n, r) => {
97
- let i = (e.curve === "linear" ? k : re)(n);
98
+ let i = (e.curve === "linear" ? k : ie)(n);
98
99
  return /* @__PURE__ */ h("g", { children: [e.kind === "area" && /* @__PURE__ */ m("path", {
99
100
  d: `${i}L${n[n.length - 1][0]},${L}L${n[0][0]},${L}Z`,
100
101
  fill: `url(#${P}-fill-${t})`,
@@ -110,7 +111,7 @@ function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v =
110
111
  className: e.dashed ? "zen__chart-fade" : "zen__chart-draw",
111
112
  style: { stroke: e.color }
112
113
  })] }, `${t}-${r}`);
113
- })), c.map((e, t) => {
114
+ })), o.map((e, t) => {
114
115
  let n = e.tone === "destructive" ? "stroke-destructive/45" : "stroke-muted-foreground/60";
115
116
  if (e.y !== void 0) return /* @__PURE__ */ m("line", {
116
117
  x1: w,
@@ -121,39 +122,39 @@ function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v =
121
122
  strokeDasharray: e.dashed ? "3 4" : void 0,
122
123
  shapeRendering: "crispEdges"
123
124
  }, t);
124
- let r = l.findIndex((t) => t[a] === e.x);
125
+ let r = c.findIndex((t) => t[a] === e.x);
125
126
  if (r < 0) return null;
126
- let i = !!e.label && N(r) - 6 - e.label.length * b * .6 < w;
127
+ let i = !!e.label && M(r) - 6 - e.label.length * x * .6 < w;
127
128
  return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
128
- x1: N(r),
129
- x2: N(r),
130
- y1: y.top,
131
- y2: y.top + D,
129
+ x1: M(r),
130
+ x2: M(r),
131
+ y1: b.top,
132
+ y2: b.top + E,
132
133
  className: n,
133
134
  strokeDasharray: e.dashed === !1 ? void 0 : "3 4"
134
135
  }), e.label && /* @__PURE__ */ m("text", {
135
- x: N(r) + (i ? 6 : -6),
136
- y: y.top + 4,
136
+ x: M(r) + (i ? 6 : -6),
137
+ y: b.top + 4,
137
138
  dy: "0.7em",
138
139
  textAnchor: i ? "start" : "end",
139
140
  className: "fill-muted-foreground",
140
- style: { fontSize: b },
141
+ style: { fontSize: x },
141
142
  children: e.label
142
143
  })] }, t);
143
144
  })] })
144
145
  };
145
146
  }, [
146
- ae,
147
+ N,
147
148
  i,
148
149
  a,
149
150
  I,
151
+ g,
150
152
  _,
151
153
  v,
152
- x,
153
154
  P,
154
- ie
155
+ ae
155
156
  ]), { series: U, rows: W, n: G, bars: K, banded: oe, step: q, left: J, plotH: Y, cx0: se, cy: X, base: Z, barW: ce, barX: le } = H, ue = u(() => K.map((e, t) => W.map((n, r) => {
156
- let i = S(n, e.dataKey);
157
+ let i = C(n, e.dataKey);
157
158
  if (i === null) return null;
158
159
  let a = X(i), o = Math.abs(Z - a), s = i < 0;
159
160
  return /* @__PURE__ */ m("path", {
@@ -177,7 +178,7 @@ function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v =
177
178
  ]), de = u(() => /* @__PURE__ */ m("div", {
178
179
  className: "sr-only",
179
180
  children: /* @__PURE__ */ h("table", { children: [
180
- /* @__PURE__ */ m("caption", { children: c }),
181
+ /* @__PURE__ */ m("caption", { children: o }),
181
182
  /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", {
182
183
  scope: "col",
183
184
  children: String(a)
@@ -187,20 +188,20 @@ function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v =
187
188
  }, e.dataKey))] }) }),
188
189
  /* @__PURE__ */ m("tbody", { children: W.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", {
189
190
  scope: "row",
190
- children: (D ?? v)(e[a])
191
+ children: (S ?? _)(e[a])
191
192
  }), U.map((t) => {
192
- let n = S(e, t.dataKey);
193
- return /* @__PURE__ */ m("td", { children: n === null ? "" : x(n) }, t.dataKey);
193
+ let n = C(e, t.dataKey);
194
+ return /* @__PURE__ */ m("td", { children: n === null ? "" : v(n) }, t.dataKey);
194
195
  })] }, t)) })
195
196
  ] })
196
197
  }), [
197
- c,
198
+ o,
198
199
  a,
199
200
  U,
200
201
  W,
201
- D,
202
- v,
203
- x
202
+ S,
203
+ _,
204
+ v
204
205
  ]), fe = (e) => {
205
206
  if (!G || !q) return null;
206
207
  let t = oe ? Math.floor((e - J) / q) : Math.round((e - J) / q);
@@ -217,17 +218,18 @@ function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v =
217
218
  if (e.key === "Escape") return z(null);
218
219
  if (e.key === "Home" || e.key === "End") return e.preventDefault(), V(null), z(e.key === "Home" ? 0 : G - 1);
219
220
  t && (e.preventDefault(), V(null), z((e) => e === null ? t > 0 ? 0 : G - 1 : Math.min(G - 1, Math.max(0, e + t))));
220
- }, he = M ?? (U.length > 1 || U.some((e) => e.dimLabel)), Q = R === null ? null : W[R], $ = R === null ? 0 : se(R), ge = B?.y ?? y.top;
221
+ }, he = j ?? (U.length > 1 || U.some((e) => e.dimLabel)), Q = R === null ? null : W[R], $ = R === null ? 0 : se(R), ge = B?.y ?? b.top;
221
222
  return /* @__PURE__ */ h("figure", {
222
- "aria-label": c,
223
- className: e("zen__chart m-0 flex flex-col gap-3", N),
223
+ "aria-label": o,
224
+ className: e("zen__chart m-0 flex flex-col gap-3", M),
224
225
  children: [
225
- he && /* @__PURE__ */ m(C, { series: U }),
226
+ he && /* @__PURE__ */ m(w, { series: U }),
226
227
  /* @__PURE__ */ h("div", {
227
228
  ref: F,
228
229
  "data-zen-unseen": L ? void 0 : "",
229
230
  tabIndex: 0,
230
- "aria-label": `${c}: use the arrow keys to read values`,
231
+ role: "group",
232
+ "aria-label": `${o}: use the arrow keys to read values`,
231
233
  onPointerMove: pe,
232
234
  onPointerLeave: () => {
233
235
  z(null), V(null);
@@ -235,32 +237,32 @@ function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v =
235
237
  onKeyDown: me,
236
238
  onBlur: () => z(null),
237
239
  className: "focus-visible:ring-ring/50 relative rounded-lg outline-hidden focus-visible:ring-2",
238
- style: { height: _ },
240
+ style: { height: g },
239
241
  children: [I > 0 && /* @__PURE__ */ h("svg", {
240
242
  width: I,
241
- height: _,
243
+ height: g,
242
244
  "aria-hidden": !0,
243
245
  className: "block overflow-visible",
244
246
  children: [
245
247
  H.back,
246
248
  R !== null && (K.length ? /* @__PURE__ */ m("rect", {
247
249
  x: se(R) - q / 2,
248
- y: y.top,
250
+ y: b.top,
249
251
  width: q,
250
252
  height: Y,
251
253
  className: "fill-tint/[0.04]"
252
254
  }) : /* @__PURE__ */ m("line", {
253
255
  x1: $,
254
256
  x2: $,
255
- y1: y.top,
256
- y2: y.top + Y,
257
+ y1: b.top,
258
+ y2: b.top + Y,
257
259
  className: "stroke-glow/40"
258
260
  })),
259
261
  ue,
260
262
  H.front,
261
263
  R !== null && U.map((e, t) => {
262
264
  if (e.kind === "bar") return null;
263
- let n = S(W[R], e.dataKey);
265
+ let n = C(W[R], e.dataKey);
264
266
  return n === null ? null : /* @__PURE__ */ m("circle", {
265
267
  cx: $,
266
268
  cy: X(n),
@@ -273,34 +275,34 @@ function x({ data: i, x: a, label: c, summary: g, height: _ = 240, formatX: v =
273
275
  ]
274
276
  }), Q && R !== null && /* @__PURE__ */ m("div", {
275
277
  className: "zen__chart-tooltip pointer-events-none absolute top-0 z-10 transition-[translate] duration-75",
276
- style: w($, ge, I, _),
277
- children: j ? j(Q, R) : /* @__PURE__ */ m(r, {
278
- title: (D ?? v)(Q[a]),
278
+ style: T($, ge, I, g),
279
+ children: D ? D(Q, R) : /* @__PURE__ */ m(r, {
280
+ title: (S ?? _)(Q[a]),
279
281
  rows: U.map((e) => ({
280
282
  s: e,
281
- v: S(Q, e.dataKey)
283
+ v: C(Q, e.dataKey)
282
284
  })).filter(({ v: e }) => e !== null).map(({ s: e, v: t }) => ({
283
285
  label: e.label,
284
- value: x(t),
286
+ value: v(t),
285
287
  color: e.color,
286
288
  dashed: e.dashed
287
289
  }))
288
290
  })
289
291
  })]
290
292
  }),
291
- g && /* @__PURE__ */ m("figcaption", {
293
+ c && /* @__PURE__ */ m("figcaption", {
292
294
  className: "sr-only",
293
- children: g
295
+ children: c
294
296
  }),
295
297
  de
296
298
  ]
297
299
  });
298
300
  }
299
- function S(e, t) {
301
+ function C(e, t) {
300
302
  let n = e[t];
301
303
  return typeof n == "number" && Number.isFinite(n) ? n : null;
302
304
  }
303
- function C({ series: e }) {
305
+ function w({ series: e }) {
304
306
  let t = e.filter((t, n) => t.dimLabel && e.findIndex((e) => e.dimLabel === t.dimLabel) === n);
305
307
  return /* @__PURE__ */ h("ul", {
306
308
  className: "text-muted-foreground flex flex-wrap gap-x-4 gap-y-1 text-xs",
@@ -322,7 +324,7 @@ function C({ series: e }) {
322
324
  }, `faded-${e.dimLabel}`))]
323
325
  });
324
326
  }
325
- function w(e, t, n, r) {
327
+ function T(e, t, n, r) {
326
328
  let i = e > n / 2, a = Math.round(Math.min(Math.max(0, t - 20), r - 80));
327
329
  return i ? {
328
330
  right: 0,
@@ -332,7 +334,7 @@ function w(e, t, n, r) {
332
334
  translate: `${Math.round(e + 12)}px ${a}px`
333
335
  };
334
336
  }
335
- function T(e) {
337
+ function E(e) {
336
338
  let [t, n] = f(0);
337
339
  return c(() => {
338
340
  let t = e.current;
@@ -341,16 +343,16 @@ function T(e) {
341
343
  return r.observe(t), () => r.disconnect();
342
344
  }, [e]), t;
343
345
  }
344
- function E(e, t, n = 5) {
346
+ function ne(e, t, n = 5) {
345
347
  e === t && ([e, t] = e === 0 ? [0, 1] : [Math.min(0, e), Math.max(0, t)]);
346
- let r = (t - e) / n, i = 10 ** Math.floor(Math.log10(r)), a = r / i, o = i * (a >= 7.5 ? 10 : a >= 3.5 ? 5 : a >= 1.5 ? 2 : 1), s = Math.floor(e / o), c = Math.ceil(t / o);
347
- return Array.from({ length: c - s + 1 }, (e, t) => Number(((s + t) * o).toPrecision(12)));
348
+ let r = (t - e) / n, i = 10 ** Math.floor(Math.log10(r)), a = r / i, o = i * (a >= 7.5 ? 10 : a >= 3.5 ? 5 : a >= 1.5 ? 2 : 1), s = Math.floor(e / o), ee = Math.ceil(t / o);
349
+ return Array.from({ length: ee - s + 1 }, (e, t) => Number(((s + t) * o).toPrecision(12)));
348
350
  }
349
351
  var D = new Intl.NumberFormat("en", {
350
352
  notation: "compact",
351
353
  maximumFractionDigits: 1
352
354
  }), O = (e) => D.format(e);
353
- function ne(e) {
355
+ function re(e) {
354
356
  let t = [], n = [];
355
357
  for (let r of e) r ? n.push(r) : n.length && (t.push(n), n = []);
356
358
  return n.length && t.push(n), t;
@@ -358,7 +360,7 @@ function ne(e) {
358
360
  function k(e) {
359
361
  return e.map(([e, t], n) => `${n ? "L" : "M"}${e},${t}`).join("");
360
362
  }
361
- function re(e) {
363
+ function ie(e) {
362
364
  let t = e.length;
363
365
  if (t < 3) return k(e);
364
366
  let n = e.slice(1).map((t, n) => t[0] - e[n][0]), r = e.slice(1).map((t, r) => (t[1] - e[r][1]) / n[r]), i = e.map((e, i) => i === 0 ? r[0] : i === t - 1 ? r[t - 2] : r[i - 1] * r[i] <= 0 ? 0 : 3 * (n[i - 1] + n[i]) / ((2 * n[i] + n[i - 1]) / r[i - 1] + (n[i] + 2 * n[i - 1]) / r[i])), a = `M${e[0][0]},${e[0][1]}`;
@@ -373,4 +375,4 @@ function A(e, t, n, r, i) {
373
375
  return i ? `M${e},${t}V${t + r - a}Q${e},${t + r} ${e + a},${t + r}H${e + n - a}Q${e + n},${t + r} ${e + n},${t + r - a}V${t}Z` : `M${e},${t + r}V${t + a}Q${e},${t} ${e + a},${t}H${e + n - a}Q${e + n},${t} ${e + n},${t + a}V${t + r}Z`;
374
376
  }
375
377
  //#endregion
376
- export { g as ChartArea, v as ChartBar, _ as ChartLine, ee as ChartReference, r as ChartTooltipCard, a as DonutChart, x as default, E as niceTicks, n as paletteColor };
378
+ export { a as AllocationBar, g as ChartArea, v as ChartBar, _ as ChartLine, te as ChartReference, r as ChartTooltipCard, o as DonutChart, S as default, ne as niceTicks, n as paletteColor };
@@ -1,7 +1,7 @@
1
1
  import { ComponentProps } from 'react';
2
2
  /**
3
3
  * Code on a glass panel whose edge catches the pointer light, with a copy
4
- * button. Zen ships no highlighter: pass `highlight` (code → HTML string, e.g.
4
+ * button. Give it a max height (className) and the code scrolls inside. Zen ships no highlighter: pass `highlight` (code → HTML string, e.g.
5
5
  * sugar-high's `highlight`) for colours.
6
6
  */
7
7
  export default function CodeBlock({ code, language, highlight, copyable, variant, className, ...rest }: CodeBlockProps): import('react').JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/code-block/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAC;AAE5D;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAC9B,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,QAAe,EACf,OAAiB,EACjB,SAAS,EACT,GAAG,IAAI,EACV,EAAE,cAAc,+BA+ChB;AAED,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACxD,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wGAAwG;IACxG,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAC/B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/code-block/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAA+B,MAAM,OAAO,CAAC;AAEpE;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAC9B,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,QAAe,EACf,OAAiB,EACjB,SAAS,EACT,GAAG,IAAI,EACV,EAAE,cAAc,+BA8DhB;AAED,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACxD,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wGAAwG;IACxG,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAC/B"}
@@ -1,36 +1,45 @@
1
1
  "use client";
2
2
  import { cx as e } from "../utils/cx.js";
3
- import { useEffect as t, useState as n } from "react";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
3
+ import { useEffect as t, useRef as n, useState as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  //#region packages/code-block/index.tsx
6
- function a({ code: a, language: o, highlight: s, copyable: c = !0, variant: l = "glass", className: u, ...d }) {
7
- let f = a.trim(), [p, m] = n(!1);
8
- return t(() => {
9
- if (!p) return;
10
- let e = setTimeout(() => m(!1), 1500);
6
+ function o({ code: o, language: s, highlight: c, copyable: l = !0, variant: u = "glass", className: d, ...f }) {
7
+ let p = o.trim(), [m, h] = r(!1);
8
+ t(() => {
9
+ if (!m) return;
10
+ let e = setTimeout(() => h(!1), 1500);
11
11
  return () => clearTimeout(e);
12
- }, [p]), /* @__PURE__ */ i("div", {
13
- className: e("zen__code-block group relative", l === "glass" && "glass glow-edge overflow-hidden rounded-xl", u),
14
- "data-language": o,
15
- ...d,
16
- children: [/* @__PURE__ */ r("pre", {
17
- className: "text-foreground m-0! overflow-x-auto rounded-none! bg-transparent! p-5! font-mono text-[13px]! leading-6 font-normal!",
18
- children: s ? /* @__PURE__ */ r("code", {
12
+ }, [m]);
13
+ let g = n(null), [_, v] = r(!1);
14
+ return t(() => {
15
+ let e = g.current;
16
+ if (!e || typeof ResizeObserver > "u") return;
17
+ let t = new ResizeObserver(() => v(e.scrollWidth > e.clientWidth || e.scrollHeight > e.clientHeight));
18
+ return t.observe(e), () => t.disconnect();
19
+ }, []), /* @__PURE__ */ a("div", {
20
+ className: e("zen__code-block group relative flex flex-col", u === "glass" && "glass glow-edge overflow-hidden rounded-xl", d),
21
+ "data-language": s,
22
+ ...f,
23
+ children: [/* @__PURE__ */ i("pre", {
24
+ ref: g,
25
+ tabIndex: _ ? 0 : void 0,
26
+ className: "text-foreground focus-visible:ring-ring/50 m-0! min-h-0 overflow-auto rounded-none! bg-transparent! p-5! font-mono text-[13px]! leading-6 font-normal! outline-hidden focus-visible:ring-2 focus-visible:ring-inset",
27
+ children: c ? /* @__PURE__ */ i("code", {
19
28
  className: "bg-transparent! p-0! text-inherit!",
20
- dangerouslySetInnerHTML: { __html: s(f, o) }
21
- }) : /* @__PURE__ */ r("code", {
29
+ dangerouslySetInnerHTML: { __html: c(p, s) }
30
+ }) : /* @__PURE__ */ i("code", {
22
31
  className: "bg-transparent! p-0! text-inherit!",
23
- children: f
32
+ children: p
24
33
  })
25
- }), c && /* @__PURE__ */ r("button", {
34
+ }), l && /* @__PURE__ */ i("button", {
26
35
  type: "button",
27
36
  onClick: async () => {
28
- await navigator.clipboard?.writeText(f), m(!0);
37
+ await navigator.clipboard?.writeText(p), h(!0);
29
38
  },
30
- className: e("zen__code-copy inline-flex items-center justify-center text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 absolute top-2.5 right-2.5 cursor-pointer rounded-lg px-2.5 py-1 text-xs font-medium outline-hidden transition-[opacity,background-color,color] focus-visible:ring-2", "opacity-0 group-hover:opacity-100 focus-visible:opacity-100 pointer-coarse:min-h-11 pointer-coarse:min-w-11 [@media(hover:none)]:bg-card/90 [@media(hover:none)]:opacity-100", p && "text-primary opacity-100"),
31
- children: p ? "Copied" : "Copy"
39
+ className: e("zen__code-copy inline-flex items-center justify-center text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 absolute top-2.5 right-2.5 cursor-pointer rounded-lg px-2.5 py-1 text-xs font-medium outline-hidden transition-[opacity,background-color,color] focus-visible:ring-2", "opacity-0 group-hover:opacity-100 focus-visible:opacity-100 pointer-coarse:min-h-11 pointer-coarse:min-w-11 [@media(hover:none)]:bg-card/90 [@media(hover:none)]:opacity-100", m && "text-primary opacity-100"),
40
+ children: m ? "Copied" : "Copy"
32
41
  })]
33
42
  });
34
43
  }
35
44
  //#endregion
36
- export { a as default };
45
+ export { o as default };
@@ -3,8 +3,9 @@ import { ReactNode } from 'react';
3
3
  /**
4
4
  * A row showing as many items as fit on one line, and the rest behind a "+N"
5
5
  * button that opens them in a popover. It measures the items as rendered (any
6
- * content, font or style), and fits again whenever the row resizes. Size the
7
- * row with className (e.g. w-full, max-w-md, gap-1).
6
+ * content, font or style), and fits again whenever the row resizes. Its width
7
+ * is the room it's given, not its items': size the row with className (e.g.
8
+ * w-full, max-w-md, gap-1).
8
9
  */
9
10
  export default function Collapse<TData>({ items, data, children, moreLabel, badgeVariant, badgeClassName, className, }: CollapseProps<TData>): import('react').JSX.Element;
10
11
  export interface CollapseProps<TData> {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/collapse/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAgD,MAAM,OAAO,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,EACpC,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAc,EACd,YAA0B,EAC1B,cAAc,EACd,SAA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AAU,CAAC,SAAS,CAAC,CAAC;IACrC,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -42,7 +42,7 @@ function d({ items: d, data: f, children: p, moreLabel: m = "", badgeVariant: h
42
42
  let C = y ?? d.length, w = d.slice(C), T = (e) => `+${e}${m ? ` ${m}` : ""}`;
43
43
  return /* @__PURE__ */ u("div", {
44
44
  ref: v,
45
- className: e("zen__collapse flex min-w-0 items-center overflow-hidden", _),
45
+ className: e("zen__collapse flex min-w-0 items-center overflow-hidden [contain:inline-size]", _),
46
46
  children: [d.slice(0, C).map((e, t) => /* @__PURE__ */ l("span", {
47
47
  "data-collapse-item": !0,
48
48
  className: "flex shrink-0",
@@ -10,9 +10,11 @@ export default function DatePicker({ value, onChange, locale, min, max, isDisabl
10
10
  /**
11
11
  * Date range field: pick a start and then an end in a Calendar (the days
12
12
  * between are previewed while pointing); it closes once the range is complete.
13
- * Shows the range the locale's way, e.g. "Sep 3 – 10, 2026".
13
+ * Shows the range the locale's way, e.g. "Sep 3 – 10, 2026". With `presets`,
14
+ * common ranges ("Last 30 days") sit beside the calendar, one tap each (see
15
+ * commonRanges).
14
16
  */
15
- export declare function DateRangePicker({ value, onChange, locale, min, max, isDisabled, weekStartsOn, months, placeholder, onClear, clearLabel, ...rest }: DateRangePickerProps): import('react').JSX.Element;
17
+ export declare function DateRangePicker({ value, onChange, locale, min, max, isDisabled, weekStartsOn, months, placeholder, onClear, clearLabel, presets, ...rest }: DateRangePickerProps): import('react').JSX.Element;
16
18
  interface PickerProps extends Omit<ComponentProps<'button'>, 'value' | 'onChange' | 'defaultValue'> {
17
19
  /** Decides the date format, month and weekday names, and the first day of the week, e.g. "en-IN". */
18
20
  locale: string;
@@ -43,6 +45,12 @@ export interface DateRangePickerProps extends PickerProps {
43
45
  onChange: (range: DateRange) => void;
44
46
  /** Months shown side by side (2 suits wide screens). */
45
47
  months?: number;
48
+ /** Ranges picked in one tap, beside the calendar. */
49
+ presets?: DateRangePreset[];
50
+ }
51
+ export interface DateRangePreset {
52
+ label: string;
53
+ range: DateRange;
46
54
  }
47
55
  export {};
48
56
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/date-picker/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAA+B,MAAM,iBAAiB,CAAC;AAG/F,OAAO,EAAE,cAAc,EAAa,MAAM,OAAO,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,EACH,GAAG,EACH,UAAU,EACV,YAAY,EACZ,WAA2B,EAC3B,OAAO,EACP,UAAoB,EACpB,GAAG,IAAI,EACV,EAAE,eAAe,+BAsBjB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,EACH,GAAG,EACH,UAAU,EACV,YAAY,EACZ,MAAU,EACV,WAA0B,EAC1B,OAAO,EACP,UAAoB,EACpB,GAAG,IAAI,EACV,EAAE,oBAAoB,+BA4BtB;AAmED,UAAU,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;IAC/F,qGAAqG;IACrG,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,sCAAsC;IACtC,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,gEAAgE;IAChE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;IAC3C,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,SAAS,CAAC,EAAE,M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AC,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;IAC/F,qGAAqG;IACrG,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,sCAAsC;IACtC,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,gEAAgE;IAChE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;IAC3C,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,gGAAgG;AAChG,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAChD,sCAAsC;IACtC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACrD,+DAA+D;IAC/D,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;CACpB"}
@@ -30,29 +30,51 @@ function f({ value: e, onChange: t, locale: n, min: r, max: i, isDisabled: o, we
30
30
  })
31
31
  });
32
32
  }
33
- function p({ value: e, onChange: t, locale: n, min: r, max: i, isDisabled: c, weekStartsOn: l, months: d = 1, placeholder: f = "Pick dates", onClear: p, clearLabel: h = "Clear", ...g }) {
34
- let _ = e ? e.end ? o(e.start, e.end, n) : `${a(e.start, n)} – …` : null;
33
+ function p({ value: e, onChange: t, locale: n, min: r, max: i, isDisabled: c, weekStartsOn: l, months: f = 1, placeholder: p = "Pick dates", onClear: h, clearLabel: g = "Clear", presets: _, ...v }) {
34
+ let y = e ? e.end ? o(e.start, e.end, n) : `${a(e.start, n)} – …` : null;
35
35
  return /* @__PURE__ */ u(m, {
36
- ...g,
37
- shown: _,
38
- placeholder: f,
36
+ ...v,
37
+ shown: y,
38
+ placeholder: p,
39
39
  label: "Choose dates",
40
- onClear: e ? p : void 0,
41
- clearLabel: h,
42
- calendar: (a) => /* @__PURE__ */ u(s, {
43
- autoFocus: !0,
44
- mode: "range",
45
- value: e,
46
- onChange: (e) => {
47
- t(e), e.end && a();
48
- },
49
- locale: n,
50
- min: r,
51
- max: i,
52
- isDisabled: c,
53
- weekStartsOn: l,
54
- months: d
55
- })
40
+ onClear: e ? h : void 0,
41
+ clearLabel: g,
42
+ calendar: (a) => {
43
+ let o = /* @__PURE__ */ u(s, {
44
+ autoFocus: !0,
45
+ mode: "range",
46
+ value: e,
47
+ onChange: (e) => {
48
+ t(e), e.end && a();
49
+ },
50
+ locale: n,
51
+ min: r,
52
+ max: i,
53
+ isDisabled: c,
54
+ weekStartsOn: l,
55
+ months: f
56
+ });
57
+ return _?.length ? /* @__PURE__ */ d("div", {
58
+ className: "flex flex-col gap-3 sm:flex-row",
59
+ children: [/* @__PURE__ */ u("div", {
60
+ role: "group",
61
+ "aria-label": "Presets",
62
+ className: "border-tint/[0.06] flex flex-wrap gap-1 sm:flex-col sm:flex-nowrap sm:border-e sm:pe-3",
63
+ children: _.map((n) => {
64
+ let r = e?.start === n.range.start && e?.end === n.range.end;
65
+ return /* @__PURE__ */ u("button", {
66
+ type: "button",
67
+ "aria-pressed": r,
68
+ onClick: () => {
69
+ t(n.range), a();
70
+ },
71
+ className: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground aria-pressed:bg-primary/12 aria-pressed:text-foreground focus-visible:ring-ring/40 cursor-pointer rounded-lg px-2.5 py-1.5 text-start text-sm whitespace-nowrap outline-hidden focus-visible:ring-2",
72
+ children: n.label
73
+ }, n.label);
74
+ })
75
+ }), o]
76
+ }) : o;
77
+ }
56
78
  });
57
79
  }
58
80
  function m({ shown: a, placeholder: o, label: s, calendar: c, onClear: f, clearLabel: p, id: m, className: g, disabled: _ = !1, style: v, ...y }) {
@@ -3,11 +3,11 @@ import { ComponentProps, ReactNode, RefObject } from 'react';
3
3
  /**
4
4
  * Modal dialog on the native <dialog> element: focus is trapped and restored,
5
5
  * the page behind is inert, and Escape closes it. `dismissible={false}` is for
6
- * flows the user must finish (no Escape or outside-click close). With `side`,
6
+ * flows the user must finish (no Escape, outside-click or close button). With `side`,
7
7
  * it's a sheet that slides in from that edge: a bottom sheet on phones, a side
8
8
  * panel for filters or details. On touch, a sheet swipes back to its edge to close.
9
9
  */
10
- export default function Dialog({ open, onOpenChange, title, description, children, dismissible, initialFocus, size, side, className, role, }: DialogProps): import('react').JSX.Element;
10
+ export default function Dialog({ open, onOpenChange, title, description, children, dismissible, initialFocus, size, side, className, role, closeLabel, }: DialogProps): import('react').JSX.Element;
11
11
  /**
12
12
  * Opens and closes a <dialog> as a modal with `open`: focus moves in (to
13
13
  * `initialFocus` if given) and back after, the page behind is inert and
@@ -38,5 +38,7 @@ export interface DialogProps {
38
38
  side?: 'bottom' | 'left' | 'right';
39
39
  className?: string;
40
40
  role?: ComponentProps<'dialog'>['role'];
41
+ /** The close button's accessible name. */
42
+ closeLabel?: string;
41
43
  }
42
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/dialog/index.tsx"],"names":[],"mappings":"AACA,OAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EACH,cAAc,EAGd,SAAS,EACT,SAAS,EAKZ,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