@rinzai/zen 0.9.0 → 0.10.1
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.
- package/dist/animated-number/index.d.ts +6 -2
- package/dist/animated-number/index.d.ts.map +1 -1
- package/dist/animated-number/index.js +68 -17
- package/dist/calendar-heatmap/index.d.ts +25 -0
- package/dist/calendar-heatmap/index.d.ts.map +1 -0
- package/dist/calendar-heatmap/index.js +48 -0
- package/dist/chart/allocation.d.ts +30 -0
- package/dist/chart/allocation.d.ts.map +1 -0
- package/dist/chart/allocation.js +69 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.js +85 -83
- package/dist/code-block/index.d.ts +1 -1
- package/dist/code-block/index.d.ts.map +1 -1
- package/dist/code-block/index.js +31 -22
- package/dist/collapse/index.d.ts +3 -2
- package/dist/collapse/index.d.ts.map +1 -1
- package/dist/collapse/index.js +1 -1
- package/dist/date-picker/index.d.ts +10 -2
- package/dist/date-picker/index.d.ts.map +1 -1
- package/dist/date-picker/index.js +43 -21
- package/dist/dialog/index.d.ts +4 -2
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +69 -113
- package/dist/editable-cell/index.d.ts +2 -1
- package/dist/editable-cell/index.d.ts.map +1 -1
- package/dist/editable-cell/index.js +24 -17
- package/dist/filter-bar/index.d.ts +21 -0
- package/dist/filter-bar/index.d.ts.map +1 -0
- package/dist/filter-bar/index.js +90 -0
- package/dist/icon-picker/index.d.ts +38 -0
- package/dist/icon-picker/index.d.ts.map +1 -0
- package/dist/icon-picker/index.js +112 -0
- package/dist/icons/arrow-left.js +23 -0
- package/dist/icons/micro/arrow-trending-down.d.ts +3 -0
- package/dist/icons/micro/arrow-trending-down.d.ts.map +1 -0
- package/dist/icons/micro/arrow-trending-down.js +21 -0
- package/dist/icons/micro/arrow-trending-up.d.ts +3 -0
- package/dist/icons/micro/arrow-trending-up.d.ts.map +1 -0
- package/dist/icons/micro/arrow-trending-up.js +21 -0
- package/dist/index.d.ts +17 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/kbd/index.d.ts +4 -0
- package/dist/kbd/index.d.ts.map +1 -0
- package/dist/kbd/index.js +12 -0
- package/dist/keypad/index.d.ts +20 -0
- package/dist/keypad/index.d.ts.map +1 -0
- package/dist/keypad/index.js +42 -0
- package/dist/lib.js +92 -77
- package/dist/load-more/index.d.ts +19 -0
- package/dist/load-more/index.d.ts.map +1 -0
- package/dist/load-more/index.js +37 -0
- package/dist/menu/index.d.ts +22 -3
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +139 -48
- package/dist/meter/index.d.ts +3 -1
- package/dist/meter/index.d.ts.map +1 -1
- package/dist/meter/index.js +19 -14
- package/dist/money-input/index.d.ts +3 -3
- package/dist/page-transition/index.d.ts +10 -0
- package/dist/page-transition/index.d.ts.map +1 -0
- package/dist/page-transition/index.js +16 -0
- package/dist/progress-ring/index.d.ts +4 -1
- package/dist/progress-ring/index.d.ts.map +1 -1
- package/dist/progress-ring/index.js +47 -38
- package/dist/range-slider/index.d.ts +26 -0
- package/dist/range-slider/index.d.ts.map +1 -0
- package/dist/range-slider/index.js +44 -0
- package/dist/repeat-picker/index.d.ts +22 -0
- package/dist/repeat-picker/index.d.ts.map +1 -0
- package/dist/repeat-picker/index.js +115 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +19 -18
- package/dist/sortable/index.d.ts +33 -0
- package/dist/sortable/index.d.ts.map +1 -0
- package/dist/sortable/index.js +147 -0
- package/dist/table/index.d.ts +5 -1
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +90 -58
- package/dist/table/selection.d.ts +55 -0
- package/dist/table/selection.d.ts.map +1 -0
- package/dist/table/selection.js +83 -0
- package/dist/table/swipe.d.ts +18 -0
- package/dist/table/swipe.d.ts.map +1 -0
- package/dist/table/swipe.js +53 -0
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +101 -51
- package/dist/theme-toggle/index.js +6 -6
- package/dist/theme.css +184 -11
- package/dist/toast/index.js +25 -25
- package/dist/toggle/index.d.ts.map +1 -1
- package/dist/toggle/index.js +1 -1
- package/dist/trend/index.d.ts +19 -0
- package/dist/trend/index.d.ts.map +1 -0
- package/dist/trend/index.js +27 -0
- package/dist/utils/date.d.ts +34 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +45 -12
- package/dist/utils/money.d.ts +3 -1
- package/dist/utils/money.d.ts.map +1 -1
- package/dist/utils/money.js +24 -1
- package/dist/utils/repeat.d.ts +17 -0
- package/dist/utils/repeat.d.ts.map +1 -0
- package/dist/utils/repeat.js +38 -0
- package/dist/utils/swipe.d.ts +29 -0
- package/dist/utils/swipe.d.ts.map +1 -0
- package/dist/utils/swipe.js +85 -0
- package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
- package/dist/utils/useAnchoredPopup.js +3 -9
- package/dist/zen.css +1 -1
- package/package.json +3 -1
package/dist/chart/index.js
CHANGED
|
@@ -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 "./
|
|
7
|
-
import
|
|
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,
|
|
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
|
-
]),
|
|
15
|
+
]), b = {
|
|
15
16
|
top: 12,
|
|
16
17
|
right: 8,
|
|
17
18
|
bottom: 26
|
|
18
|
-
},
|
|
19
|
-
function
|
|
20
|
-
let P = l().replace(/[^\w-]/g, ""), F = d(null), I =
|
|
21
|
-
let e =
|
|
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 ===
|
|
24
|
-
let e =
|
|
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(
|
|
31
|
+
color: a.color ?? n(ae, r.length, t)
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
|
-
let
|
|
34
|
-
for (let e of
|
|
35
|
-
r.some((e) => e.kind !== "line") &&
|
|
36
|
-
let
|
|
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:
|
|
40
|
-
n:
|
|
41
|
-
bars:
|
|
42
|
-
banded:
|
|
43
|
-
step:
|
|
40
|
+
rows: c,
|
|
41
|
+
n: D,
|
|
42
|
+
bars: O,
|
|
43
|
+
banded: A,
|
|
44
|
+
step: j,
|
|
44
45
|
left: w,
|
|
45
|
-
plotH:
|
|
46
|
-
cx0:
|
|
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
|
-
|
|
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:
|
|
82
|
-
children:
|
|
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:
|
|
86
|
-
y:
|
|
87
|
-
textAnchor: !
|
|
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:
|
|
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 :
|
|
94
|
-
let r =
|
|
95
|
-
return r === null ? null : [
|
|
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 :
|
|
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
|
-
})),
|
|
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 =
|
|
125
|
+
let r = c.findIndex((t) => t[a] === e.x);
|
|
125
126
|
if (r < 0) return null;
|
|
126
|
-
let i = !!e.label &&
|
|
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:
|
|
129
|
-
x2:
|
|
130
|
-
y1:
|
|
131
|
-
y2:
|
|
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:
|
|
136
|
-
y:
|
|
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:
|
|
141
|
+
style: { fontSize: x },
|
|
141
142
|
children: e.label
|
|
142
143
|
})] }, t);
|
|
143
144
|
})] })
|
|
144
145
|
};
|
|
145
146
|
}, [
|
|
146
|
-
|
|
147
|
+
N,
|
|
147
148
|
i,
|
|
148
149
|
a,
|
|
149
150
|
I,
|
|
151
|
+
g,
|
|
150
152
|
_,
|
|
151
153
|
v,
|
|
152
|
-
x,
|
|
153
154
|
P,
|
|
154
|
-
|
|
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 =
|
|
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:
|
|
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: (
|
|
191
|
+
children: (S ?? _)(e[a])
|
|
191
192
|
}), U.map((t) => {
|
|
192
|
-
let n =
|
|
193
|
-
return /* @__PURE__ */ m("td", { children: n === null ? "" :
|
|
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
|
-
|
|
198
|
+
o,
|
|
198
199
|
a,
|
|
199
200
|
U,
|
|
200
201
|
W,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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 =
|
|
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":
|
|
223
|
-
className: e("zen__chart m-0 flex flex-col gap-3",
|
|
223
|
+
"aria-label": o,
|
|
224
|
+
className: e("zen__chart m-0 flex flex-col gap-3", M),
|
|
224
225
|
children: [
|
|
225
|
-
he && /* @__PURE__ */ m(
|
|
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
|
-
"
|
|
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:
|
|
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:
|
|
256
|
-
y2:
|
|
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 =
|
|
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:
|
|
277
|
-
children:
|
|
278
|
-
title: (
|
|
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:
|
|
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:
|
|
286
|
+
value: v(t),
|
|
285
287
|
color: e.color,
|
|
286
288
|
dashed: e.dashed
|
|
287
289
|
}))
|
|
288
290
|
})
|
|
289
291
|
})]
|
|
290
292
|
}),
|
|
291
|
-
|
|
293
|
+
c && /* @__PURE__ */ m("figcaption", {
|
|
292
294
|
className: "sr-only",
|
|
293
|
-
children:
|
|
295
|
+
children: c
|
|
294
296
|
}),
|
|
295
297
|
de
|
|
296
298
|
]
|
|
297
299
|
});
|
|
298
300
|
}
|
|
299
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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),
|
|
347
|
-
return Array.from({ length:
|
|
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
|
|
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
|
|
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,
|
|
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,
|
|
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"}
|
package/dist/code-block/index.js
CHANGED
|
@@ -1,36 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import { useEffect as t,
|
|
4
|
-
import { jsx as
|
|
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
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
if (!
|
|
10
|
-
let e = setTimeout(() =>
|
|
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
|
-
}, [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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:
|
|
21
|
-
}) : /* @__PURE__ */
|
|
29
|
+
dangerouslySetInnerHTML: { __html: c(p, s) }
|
|
30
|
+
}) : /* @__PURE__ */ i("code", {
|
|
22
31
|
className: "bg-transparent! p-0! text-inherit!",
|
|
23
|
-
children:
|
|
32
|
+
children: p
|
|
24
33
|
})
|
|
25
|
-
}),
|
|
34
|
+
}), l && /* @__PURE__ */ i("button", {
|
|
26
35
|
type: "button",
|
|
27
36
|
onClick: async () => {
|
|
28
|
-
await navigator.clipboard?.writeText(
|
|
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",
|
|
31
|
-
children:
|
|
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 {
|
|
45
|
+
export { o as default };
|
package/dist/collapse/index.d.ts
CHANGED
|
@@ -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.
|
|
7
|
-
* row with className (e.g.
|
|
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
|
|
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;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,EACpC,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAc,EACd,YAA0B,EAC1B,cAAc,EACd,SAAS,GACZ,EAAE,aAAa,CAAC,KAAK,CAAC,+BAqGtB;AAED,MAAM,WAAW,aAAa,CAAC,KAAK;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,yDAAyD;IACzD,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACf,4EAA4E;IAC5E,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAK,KAAK,SAAS,CAAC;IACvE,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACrC,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/collapse/index.js
CHANGED
|
@@ -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
|
|
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;;;;;;GAMG;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,OAAO,EACP,GAAG,IAAI,EACV,EAAE,oBAAoB,+BA2DtB;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,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:
|
|
34
|
-
let
|
|
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
|
-
...
|
|
37
|
-
shown:
|
|
38
|
-
placeholder:
|
|
36
|
+
...v,
|
|
37
|
+
shown: y,
|
|
38
|
+
placeholder: p,
|
|
39
39
|
label: "Choose dates",
|
|
40
|
-
onClear: e ?
|
|
41
|
-
clearLabel:
|
|
42
|
-
calendar: (a) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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 }) {
|
package/dist/dialog/index.d.ts
CHANGED
|
@@ -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
|
|
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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/dialog/index.tsx"],"names":[],"mappings":"AAEA,OAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EACH,cAAc,EAGd,SAAS,EACT,SAAS,EAKZ,MAAM,OAAO,CAAC;AAKf;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,WAAkB,EAClB,YAAY,EACZ,IAAW,EACX,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,UAAoB,GACvB,EAAE,WAAW,+BAuEb;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACpB,GAAG,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,EACxC,IAAI,EAAE,OAAO,EACb,YAAY,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAC7C,IAAI,CA4BN;AAiCD,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAEzE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAW5D;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iFAAiF;IACjF,YAAY,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC7C,sEAAsE;IACtE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IACxC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB"}
|