@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.
- package/CHANGELOG.md +15 -0
- package/dist/animated-number/index.js +14 -14
- package/dist/breadcrumbs/index.js +14 -14
- package/dist/calendar/index.js +29 -29
- package/dist/calendar-heatmap/index.js +12 -12
- package/dist/canvas/index.js +19 -19
- package/dist/carousel/index.js +24 -24
- package/dist/chart/index.js +7 -7
- package/dist/code-block/index.js +5 -5
- package/dist/collapse/index.js +6 -6
- package/dist/color-picker/index.js +10 -10
- package/dist/combobox/index.js +61 -61
- package/dist/command-palette/index.js +5 -5
- package/dist/confirm-dialog/index.js +4 -4
- package/dist/date-picker/index.js +15 -15
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +45 -65
- package/dist/docs/README.md +4 -4
- package/dist/docs/locale-provider.md +1 -1
- package/dist/docs/menu.md +54 -1
- package/dist/docs/seek-bar.md +30 -1
- package/dist/docs/sortable.md +63 -1
- package/dist/docs/tooltip.md +45 -3
- package/dist/filter-bar/index.js +6 -6
- package/dist/header/index.js +6 -6
- package/dist/icon-picker/index.js +5 -5
- package/dist/keypad/index.js +5 -5
- package/dist/lib.js +7 -7
- package/dist/load-more/index.js +5 -5
- package/dist/menu/index.d.ts +7 -1
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +217 -174
- package/dist/money-input/index.js +54 -54
- package/dist/month-picker/index.js +11 -11
- package/dist/number-field/index.js +5 -5
- package/dist/pagination/index.js +12 -12
- package/dist/range-slider/index.js +11 -11
- package/dist/repeat-picker/index.js +5 -5
- package/dist/resizable/index.js +22 -22
- package/dist/seek-bar/index.d.ts +3 -1
- package/dist/seek-bar/index.d.ts.map +1 -1
- package/dist/seek-bar/index.js +41 -40
- package/dist/select/index.js +21 -21
- package/dist/sortable/index.d.ts +13 -1
- package/dist/sortable/index.d.ts.map +1 -1
- package/dist/sortable/index.js +74 -55
- package/dist/sortable/shared.js +14 -14
- package/dist/sortable/tree.js +17 -17
- package/dist/sparkline/index.js +4 -4
- package/dist/stepper/index.js +13 -13
- package/dist/table/index.js +26 -26
- package/dist/table/selection.js +9 -9
- package/dist/table-of-contents/index.js +11 -11
- package/dist/tag-input/index.js +5 -5
- package/dist/theme-toggle/index.js +4 -4
- package/dist/theme.css +103 -0
- package/dist/time-field/index.js +21 -21
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +41 -41
- package/dist/tooltip/index.d.ts +9 -3
- package/dist/tooltip/index.d.ts.map +1 -1
- package/dist/tooltip/index.js +19 -16
- package/dist/tree/index.js +34 -34
- package/dist/trend/index.js +5 -5
- package/dist/utils/messages.d.ts +1 -0
- package/dist/utils/messages.d.ts.map +1 -1
- package/dist/utils/messages.js +1 -0
- package/dist/utils/swipe.d.ts +7 -0
- package/dist/utils/swipe.d.ts.map +1 -1
- package/dist/utils/swipe.js +45 -25
- package/dist/utils/useAnchoredPopup.d.ts +2 -1
- package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
- package/dist/utils/useAnchoredPopup.js +9 -5
- package/dist/utils/useVirtualList.d.ts +6 -1
- package/dist/utils/useVirtualList.d.ts.map +1 -1
- package/dist/utils/useVirtualList.js +12 -12
- package/dist/zen.css +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import { useLocale as e, useMessages as t } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as n } from "../utils/cx.js";
|
|
4
|
+
import { useControllable as r } from "../utils/useControllable.js";
|
|
5
|
+
import i, { MenuContent as a, MenuItem as o, MenuSeparator as s, MenuTrigger as c } from "../menu/index.js";
|
|
6
6
|
import { currencySymbol as l, formatAmount as u, formatMoney as d, minorDigits as f, parseMoneyInput as p } from "../utils/money.js";
|
|
7
7
|
import m from "../spinner/index.js";
|
|
8
8
|
import { AlertIcon as h, InfoIcon as g } from "../utils/status-icons.js";
|
|
@@ -13,10 +13,10 @@ import { convertMinor as S, rateBetween as C } from "../utils/fx.js";
|
|
|
13
13
|
import { useEffect as w, useId as T, useRef as E, useState as D } from "react";
|
|
14
14
|
import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
15
15
|
//#region packages/money-input/index.tsx
|
|
16
|
-
function j({ value:
|
|
16
|
+
function j({ value: e, defaultValue: t, onValueChange: r, currency: i, locale: a, allowNegative: o, allowEmpty: s, live: c, onCancel: l, convert: u, start: d, end: f, compact: p = !1, size: m, disabled: g = !1, className: v, onFocus: S, onBlur: C, onKeyDown: w, "aria-describedby": T, name: E, ...D }) {
|
|
17
17
|
let O = P({
|
|
18
|
-
value:
|
|
19
|
-
defaultValue:
|
|
18
|
+
value: e,
|
|
19
|
+
defaultValue: t,
|
|
20
20
|
onValueChange: r,
|
|
21
21
|
currency: i,
|
|
22
22
|
locale: a,
|
|
@@ -27,13 +27,13 @@ function j({ value: t, defaultValue: n, onValueChange: r, currency: i, locale: a
|
|
|
27
27
|
convert: u
|
|
28
28
|
}), j = !!O.conversion?.foreign;
|
|
29
29
|
return /* @__PURE__ */ A("div", {
|
|
30
|
-
className:
|
|
30
|
+
className: n("zen__money-input flex flex-col gap-1", v),
|
|
31
31
|
children: [
|
|
32
32
|
/* @__PURE__ */ A(y, {
|
|
33
33
|
invalid: !!O.error,
|
|
34
34
|
size: m,
|
|
35
35
|
"data-foreign": j || void 0,
|
|
36
|
-
className:
|
|
36
|
+
className: n(p && "h-7", "data-foreign:border-primary/50"),
|
|
37
37
|
children: [
|
|
38
38
|
d ?? (O.conversion && !g ? /* @__PURE__ */ k(M, { money: O }) : /* @__PURE__ */ k(b, {
|
|
39
39
|
"aria-hidden": !0,
|
|
@@ -52,9 +52,9 @@ function j({ value: t, defaultValue: n, onValueChange: r, currency: i, locale: a
|
|
|
52
52
|
onKeyDown: (e) => {
|
|
53
53
|
O.inputProps.onKeyDown(e), w?.(e);
|
|
54
54
|
},
|
|
55
|
-
"aria-describedby":
|
|
55
|
+
"aria-describedby": n(O.inputProps["aria-describedby"], T) || void 0,
|
|
56
56
|
disabled: g,
|
|
57
|
-
className:
|
|
57
|
+
className: n("tabular-nums", p ? "text-end" : "text-start")
|
|
58
58
|
}),
|
|
59
59
|
f
|
|
60
60
|
]
|
|
@@ -73,19 +73,19 @@ function j({ value: t, defaultValue: n, onValueChange: r, currency: i, locale: a
|
|
|
73
73
|
]
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
function M({ money:
|
|
77
|
-
let u =
|
|
78
|
-
return u ? /* @__PURE__ */ A(
|
|
76
|
+
function M({ money: e, className: r }) {
|
|
77
|
+
let u = e.conversion, d = t();
|
|
78
|
+
return u ? /* @__PURE__ */ A(i, { children: [/* @__PURE__ */ A(c, {
|
|
79
79
|
"aria-label": d.changeCurrency(u.currency),
|
|
80
|
-
className:
|
|
81
|
-
children: [u.foreign ? u.currency :
|
|
82
|
-
}), /* @__PURE__ */ A(
|
|
80
|
+
className: n("group/currency hover:bg-tint/[0.07] -ms-1 flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-sm outline-hidden focus-ring", u.foreign ? "text-primary" : "text-muted-foreground", r),
|
|
81
|
+
children: [u.foreign ? u.currency : e.symbol, /* @__PURE__ */ k(v, { className: "text-inherit duration-150 group-data-popup-open/currency:rotate-180" })]
|
|
82
|
+
}), /* @__PURE__ */ A(a, {
|
|
83
83
|
align: "start",
|
|
84
84
|
offset: 8,
|
|
85
85
|
"aria-label": d.currency,
|
|
86
86
|
className: "max-h-72 w-60 overflow-y-auto",
|
|
87
87
|
children: [
|
|
88
|
-
/* @__PURE__ */ A(
|
|
88
|
+
/* @__PURE__ */ A(o, {
|
|
89
89
|
onSelect: () => u.pick(u.home),
|
|
90
90
|
className: "gap-2 py-1.5",
|
|
91
91
|
children: [/* @__PURE__ */ k("span", {
|
|
@@ -96,12 +96,12 @@ function M({ money: t, className: s }) {
|
|
|
96
96
|
children: d.yourCurrency
|
|
97
97
|
})]
|
|
98
98
|
}),
|
|
99
|
-
/* @__PURE__ */ k(
|
|
99
|
+
/* @__PURE__ */ k(s, {}),
|
|
100
100
|
/* @__PURE__ */ k("div", {
|
|
101
101
|
className: "text-muted-foreground px-3 pt-1 pb-1.5 text-xs",
|
|
102
102
|
children: d.otherCurrencies
|
|
103
103
|
}),
|
|
104
|
-
u.choices.map((e) => /* @__PURE__ */ A(
|
|
104
|
+
u.choices.map((e) => /* @__PURE__ */ A(o, {
|
|
105
105
|
onSelect: () => u.pick(e),
|
|
106
106
|
className: "gap-2 py-1.5",
|
|
107
107
|
children: [/* @__PURE__ */ k("span", {
|
|
@@ -115,63 +115,63 @@ function M({ money: t, className: s }) {
|
|
|
115
115
|
]
|
|
116
116
|
})] }) : null;
|
|
117
117
|
}
|
|
118
|
-
function N({ money:
|
|
119
|
-
let
|
|
120
|
-
if (!
|
|
121
|
-
let { home:
|
|
122
|
-
if (!
|
|
123
|
-
let
|
|
118
|
+
function N({ money: e, className: r }) {
|
|
119
|
+
let i = e.conversion, a = t();
|
|
120
|
+
if (!i || !i.foreign && !i.converted) return null;
|
|
121
|
+
let { home: o, locale: s } = i, c = n("text-muted-foreground flex items-center gap-1.5 text-xs", r);
|
|
122
|
+
if (!i.foreign) {
|
|
123
|
+
let t = i.converted;
|
|
124
124
|
return /* @__PURE__ */ A("p", {
|
|
125
|
-
id:
|
|
125
|
+
id: e.hintId,
|
|
126
126
|
role: "status",
|
|
127
|
-
className:
|
|
128
|
-
children: [/* @__PURE__ */ k(g, { className: "text-primary shrink-0" }),
|
|
127
|
+
className: c,
|
|
128
|
+
children: [/* @__PURE__ */ k(g, { className: "text-primary shrink-0" }), a.convertedFrom(d(t.amount, t.currency, s), I(t.rate))]
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
return /* @__PURE__ */ k("p", {
|
|
132
|
-
id:
|
|
132
|
+
id: e.hintId,
|
|
133
133
|
role: "status",
|
|
134
|
-
className:
|
|
135
|
-
children:
|
|
134
|
+
className: c,
|
|
135
|
+
children: i.status === "idle" || i.status === "loading" ? /* @__PURE__ */ A(O, { children: [
|
|
136
136
|
/* @__PURE__ */ k(m, { className: "size-3" }),
|
|
137
137
|
" ",
|
|
138
|
-
|
|
139
|
-
] }) :
|
|
138
|
+
a.gettingRate
|
|
139
|
+
] }) : i.rate === null ? /* @__PURE__ */ A(O, { children: [
|
|
140
140
|
/* @__PURE__ */ k(h, { className: "text-destructive shrink-0" }),
|
|
141
141
|
" ",
|
|
142
|
-
|
|
142
|
+
a.ratesUnavailable(o)
|
|
143
143
|
] }) : /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(g, { className: "text-primary shrink-0" }), /* @__PURE__ */ A("span", { children: [
|
|
144
|
-
|
|
144
|
+
i.preview !== null && /* @__PURE__ */ A("span", {
|
|
145
145
|
className: "text-foreground font-medium",
|
|
146
146
|
children: [
|
|
147
147
|
"≈ ",
|
|
148
|
-
d(
|
|
148
|
+
d(i.preview, o, s),
|
|
149
149
|
" ·",
|
|
150
150
|
" "
|
|
151
151
|
]
|
|
152
152
|
}),
|
|
153
|
-
|
|
153
|
+
a.rateOf(i.currency, d(Math.round(i.rate * 10 ** f(o)), o, s)),
|
|
154
154
|
" ",
|
|
155
155
|
"(",
|
|
156
|
-
|
|
157
|
-
L(
|
|
156
|
+
i.source ? `${i.source}, ` : "",
|
|
157
|
+
L(i.date, s),
|
|
158
158
|
")"
|
|
159
159
|
] })] })
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
function P({ value:
|
|
163
|
-
let v =
|
|
162
|
+
function P({ value: i, defaultValue: a = null, onValueChange: o, currency: s, locale: c, allowNegative: f = !1, allowEmpty: m = !1, live: h = !1, onCancel: g, convert: _ }) {
|
|
163
|
+
let v = e(c), y = t(), [b, x, E] = r(i, a, o), O = _?.initial ?? null, [k, A] = D(() => O?.currency ?? s), j = !!_ && k !== s, M = F(_?.loadRates, j), N = (e) => e === null ? "" : u(e, s, v), [P, I] = D(() => O ? u(O.amount, O.currency, v) : N(b)), [L, R] = D(null), [z, B] = D(null), [V, H] = D(!1), [U, W] = D(!1), G = T(), K = T();
|
|
164
164
|
w(() => {
|
|
165
165
|
!V && !j && !(h && U) && I(N(b));
|
|
166
166
|
}, [
|
|
167
167
|
b,
|
|
168
|
-
|
|
168
|
+
s,
|
|
169
169
|
v
|
|
170
170
|
]);
|
|
171
171
|
let q = (e) => {
|
|
172
172
|
if (!M.table) return null;
|
|
173
173
|
try {
|
|
174
|
-
return C(M.table, e,
|
|
174
|
+
return C(M.table, e, s);
|
|
175
175
|
} catch {
|
|
176
176
|
return null;
|
|
177
177
|
}
|
|
@@ -209,7 +209,7 @@ function P({ value: n, defaultValue: r = null, onValueChange: i, currency: a, lo
|
|
|
209
209
|
x(null);
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
|
-
t ===
|
|
212
|
+
t === s ? (x(i), _?.onForeign?.(null)) : n === null ? x(null) : (x(S(i, n, t, s)), _?.onForeign?.({
|
|
213
213
|
currency: t,
|
|
214
214
|
amount: i,
|
|
215
215
|
rate: n,
|
|
@@ -224,13 +224,13 @@ function P({ value: n, defaultValue: r = null, onValueChange: i, currency: a, lo
|
|
|
224
224
|
if (e === void 0) return !1;
|
|
225
225
|
if (e !== null && j) {
|
|
226
226
|
if (J === null) return R(M.status === "error" ? y.rateFailed : y.rateLoading), !1;
|
|
227
|
-
let t = S(e, J, k,
|
|
227
|
+
let t = S(e, J, k, s), n = {
|
|
228
228
|
currency: k,
|
|
229
229
|
amount: e,
|
|
230
230
|
rate: J,
|
|
231
231
|
date: M.table.date
|
|
232
232
|
};
|
|
233
|
-
return B(n), A(
|
|
233
|
+
return B(n), A(s), I(N(t)), x(t), _?.onForeign?.(n), !0;
|
|
234
234
|
}
|
|
235
235
|
return I(N(e)), x(e), e !== b && (B(null), _?.onForeign?.(null)), !0;
|
|
236
236
|
}
|
|
@@ -239,12 +239,12 @@ function P({ value: n, defaultValue: r = null, onValueChange: i, currency: a, lo
|
|
|
239
239
|
e !== void 0 && I(e === null ? "" : u(e, k, v));
|
|
240
240
|
}
|
|
241
241
|
function ee(e) {
|
|
242
|
-
A(e), R(null), h && P.trim() && (W(!0), Z(P, e, e ===
|
|
242
|
+
A(e), R(null), h && P.trim() && (W(!0), Z(P, e, e === s ? null : q(e)));
|
|
243
243
|
}
|
|
244
244
|
let te = (() => {
|
|
245
245
|
if (!j || J === null || !P.trim()) return null;
|
|
246
246
|
try {
|
|
247
|
-
return S(p(P, k), J, k,
|
|
247
|
+
return S(p(P, k), J, k, s);
|
|
248
248
|
} catch {
|
|
249
249
|
return null;
|
|
250
250
|
}
|
|
@@ -257,7 +257,7 @@ function P({ value: n, defaultValue: r = null, onValueChange: i, currency: a, lo
|
|
|
257
257
|
spellCheck: !1,
|
|
258
258
|
value: P,
|
|
259
259
|
"aria-invalid": L ? !0 : void 0,
|
|
260
|
-
"aria-describedby":
|
|
260
|
+
"aria-describedby": n(L ? G : (j || !!z) && K) || void 0,
|
|
261
261
|
onChange: (e) => {
|
|
262
262
|
I(e.target.value), B(null), h && (W(!0), Z(e.target.value, k, J));
|
|
263
263
|
},
|
|
@@ -266,7 +266,7 @@ function P({ value: n, defaultValue: r = null, onValueChange: i, currency: a, lo
|
|
|
266
266
|
H(!1), h ? $() : Q();
|
|
267
267
|
},
|
|
268
268
|
onKeyDown: (e) => {
|
|
269
|
-
e.key === "Enter" ? (e.preventDefault(), h ? $() : Q()) : e.key === "Escape" && (e.preventDefault(), A(
|
|
269
|
+
e.key === "Enter" ? (e.preventDefault(), h ? $() : Q()) : e.key === "Escape" && (e.preventDefault(), A(s), I(N(b)), R(null), g?.());
|
|
270
270
|
}
|
|
271
271
|
},
|
|
272
272
|
value: b,
|
|
@@ -278,13 +278,13 @@ function P({ value: n, defaultValue: r = null, onValueChange: i, currency: a, lo
|
|
|
278
278
|
text: P,
|
|
279
279
|
setText: I,
|
|
280
280
|
commit: Q,
|
|
281
|
-
formatted: b === null ? "" : d(b,
|
|
281
|
+
formatted: b === null ? "" : d(b, s, v),
|
|
282
282
|
conversion: _ ? {
|
|
283
|
-
home:
|
|
283
|
+
home: s,
|
|
284
284
|
locale: v,
|
|
285
285
|
currency: k,
|
|
286
286
|
foreign: j,
|
|
287
|
-
choices: _.currencies.filter((e) => e !==
|
|
287
|
+
choices: _.currencies.filter((e) => e !== s && (!M.table || e === M.table.base || e in M.table.rates)),
|
|
288
288
|
pick: ee,
|
|
289
289
|
status: M.status,
|
|
290
290
|
rate: J,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { useLocale as e, useMessages as t } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as n } from "../utils/cx.js";
|
|
4
|
+
import { useControllable as r } from "../utils/useControllable.js";
|
|
5
|
+
import { useAnchoredPopup as i } from "../utils/useAnchoredPopup.js";
|
|
6
6
|
import { useFieldProps as a } from "../field/index.js";
|
|
7
7
|
import { FIELD_SIZE as o, PICKER_MONTH as s, PICKER_NAV as c, PLACEHOLDER as l, POPUP as u, TRIGGER as d } from "../utils/styles.js";
|
|
8
8
|
import { FormValue as f } from "../utils/form-value.js";
|
|
@@ -14,7 +14,7 @@ import { useState as v } from "react";
|
|
|
14
14
|
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
15
15
|
//#region packages/month-picker/index.tsx
|
|
16
16
|
function S({ value: S, defaultValue: C = null, onValueChange: w, locale: T, min: E, max: D, id: O, className: k, disabled: A = !1, size: j = "default", placeholder: M, clearable: N = !1, clearLabel: P, name: F, style: I, ...L }) {
|
|
17
|
-
let R =
|
|
17
|
+
let R = t(), z = M ?? R.pickMonth, B = P ?? R.clear, V = e(T), [H, U, W] = r(S, C, w), [G, K] = v(() => Number((H ?? (/* @__PURE__ */ new Date()).toISOString()).slice(0, 4))), q = i({ onOpenChange: (e) => e && H && K(Number(H.slice(0, 4))) }), J = a({
|
|
18
18
|
...L,
|
|
19
19
|
id: O
|
|
20
20
|
}), Y = _(V), X = (e) => (!E || e >= E) && (!D || e <= D);
|
|
@@ -30,7 +30,7 @@ function S({ value: S, defaultValue: C = null, onValueChange: w, locale: T, min:
|
|
|
30
30
|
...q.triggerProps.style,
|
|
31
31
|
...I
|
|
32
32
|
},
|
|
33
|
-
className:
|
|
33
|
+
className: n("zen__month-picker group", d, o[j], "w-full", q.open && "border-glow/60 [--glow-border-color:transparent] shadow-glow-focus", k),
|
|
34
34
|
children: [/* @__PURE__ */ b("span", {
|
|
35
35
|
className: H ? void 0 : l,
|
|
36
36
|
children: H ? g(H, V) : z
|
|
@@ -45,7 +45,7 @@ function S({ value: S, defaultValue: C = null, onValueChange: w, locale: T, min:
|
|
|
45
45
|
...q.popupProps,
|
|
46
46
|
role: "dialog",
|
|
47
47
|
"aria-label": R.chooseMonth,
|
|
48
|
-
className:
|
|
48
|
+
className: n("zen__popover", u, "w-64 p-3"),
|
|
49
49
|
children: [
|
|
50
50
|
/* @__PURE__ */ x("div", {
|
|
51
51
|
className: "mb-2 flex items-center justify-between",
|
|
@@ -73,8 +73,8 @@ function S({ value: S, defaultValue: C = null, onValueChange: w, locale: T, min:
|
|
|
73
73
|
}),
|
|
74
74
|
/* @__PURE__ */ b("div", {
|
|
75
75
|
className: "grid grid-cols-3 gap-1",
|
|
76
|
-
children: Y.map((
|
|
77
|
-
let r = `${G}-${String(
|
|
76
|
+
children: Y.map((e, t) => {
|
|
77
|
+
let r = `${G}-${String(t + 1).padStart(2, "0")}`, i = r === H;
|
|
78
78
|
return /* @__PURE__ */ b("button", {
|
|
79
79
|
type: "button",
|
|
80
80
|
disabled: !X(r),
|
|
@@ -83,8 +83,8 @@ function S({ value: S, defaultValue: C = null, onValueChange: w, locale: T, min:
|
|
|
83
83
|
onClick: () => {
|
|
84
84
|
U(r), q.setOpen(!1);
|
|
85
85
|
},
|
|
86
|
-
className:
|
|
87
|
-
children:
|
|
86
|
+
className: n(s, i && "bg-primary text-primary-foreground hover:bg-primary"),
|
|
87
|
+
children: e
|
|
88
88
|
}, r);
|
|
89
89
|
})
|
|
90
90
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useLocale as e, useMessages as t } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as n } from "../utils/cx.js";
|
|
4
|
+
import { useControllable as r } from "../utils/useControllable.js";
|
|
5
5
|
import { FormValue as i } from "../utils/form-value.js";
|
|
6
6
|
import a, { InputGroupAddon as o, InputGroupInput as s } from "../input-group/index.js";
|
|
7
7
|
import c from "../icons/micro/minus.js";
|
|
@@ -11,7 +11,7 @@ import { useMemo as d, useRef as f, useState as p } from "react";
|
|
|
11
11
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
12
|
//#region packages/number-field/index.tsx
|
|
13
13
|
function g({ value: l, defaultValue: g = null, onValueChange: b, onValueCommit: x, min: S, max: C, step: w = 1, largeStep: T = w * 10, formatOptions: E, locale: D, name: O, size: k = "default", invalid: A, disabled: j, className: M, onFocus: N, onBlur: P, onKeyDown: F, ...I }) {
|
|
14
|
-
let L =
|
|
14
|
+
let L = t(), R = e(D), [z, B, V] = r(l, g, void 0), H = d(() => new y(R, E), [R, E]), [U, W] = p(null), G = f(!1), K = (e) => Math.min(C ?? Infinity, Math.max(S ?? -Infinity, e)), q = (e, t) => {
|
|
15
15
|
B(e), b?.(e, t);
|
|
16
16
|
}, J = (e, t) => {
|
|
17
17
|
q(e, t), x?.(e, t), G.current = !1, W(null);
|
|
@@ -29,7 +29,7 @@ function g({ value: l, defaultValue: g = null, onValueChange: b, onValueCommit:
|
|
|
29
29
|
return /* @__PURE__ */ h(a, {
|
|
30
30
|
size: k,
|
|
31
31
|
invalid: A,
|
|
32
|
-
className:
|
|
32
|
+
className: n("zen__number-field px-1", M),
|
|
33
33
|
children: [
|
|
34
34
|
/* @__PURE__ */ m(o, { children: /* @__PURE__ */ m(_, {
|
|
35
35
|
label: L.decrease,
|
package/dist/pagination/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useLocale as e, useMessages as t } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as n } from "../utils/cx.js";
|
|
4
4
|
import { buttonVariants as r } from "../button/index.js";
|
|
5
5
|
import i from "../icons/chevron-left.js";
|
|
6
6
|
import a from "../icons/chevron-right.js";
|
|
7
7
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
8
|
//#region packages/pagination/index.tsx
|
|
9
9
|
function c({ page: c, count: u, onPageChange: d, href: f, renderLink: p = (e) => /* @__PURE__ */ o("a", { ...e }), siblings: m = 1, className: h, "aria-label": g }) {
|
|
10
|
-
let _ =
|
|
10
|
+
let _ = t(), v = new Intl.NumberFormat(e()), y = g ?? _.pages;
|
|
11
11
|
if (u < 2) return null;
|
|
12
|
-
let b = (
|
|
13
|
-
let a =
|
|
12
|
+
let b = (e, t, i) => {
|
|
13
|
+
let a = e < 1 || e > u, s = n(r({
|
|
14
14
|
variant: "ghost",
|
|
15
15
|
size: "icon"
|
|
16
16
|
}), "min-w-9 w-auto px-2 tabular-nums", i.current && "bg-primary/15 text-foreground shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.3),0_0_18px_-6px_oklch(var(--glow)/calc(0.6*var(--glow-k)))] hover:bg-primary/20"), c = {
|
|
@@ -20,20 +20,20 @@ function c({ page: c, count: u, onPageChange: d, href: f, renderLink: p = (e) =>
|
|
|
20
20
|
};
|
|
21
21
|
return f && !a ? p({
|
|
22
22
|
...c,
|
|
23
|
-
href: f(
|
|
24
|
-
onClick: d && (() => d(
|
|
25
|
-
children:
|
|
26
|
-
},
|
|
23
|
+
href: f(e),
|
|
24
|
+
onClick: d && (() => d(e)),
|
|
25
|
+
children: t
|
|
26
|
+
}, e) : /* @__PURE__ */ o("button", {
|
|
27
27
|
type: "button",
|
|
28
28
|
...c,
|
|
29
29
|
disabled: a,
|
|
30
|
-
onClick: () => !i.current && d?.(
|
|
31
|
-
children:
|
|
30
|
+
onClick: () => !i.current && d?.(e),
|
|
31
|
+
children: t
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
return /* @__PURE__ */ o("nav", {
|
|
35
35
|
"aria-label": y,
|
|
36
|
-
className:
|
|
36
|
+
className: n("zen__pagination", h),
|
|
37
37
|
children: /* @__PURE__ */ s("ul", {
|
|
38
38
|
className: "flex items-center gap-1",
|
|
39
39
|
children: [
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useMessages as e } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as t } from "../utils/cx.js";
|
|
4
|
+
import { useControllable as n } from "../utils/useControllable.js";
|
|
5
5
|
import { useFormReset as r } from "../utils/form-value.js";
|
|
6
6
|
import { THUMB as i } from "../slider/index.js";
|
|
7
7
|
import { useRef as a } from "react";
|
|
8
8
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
9
9
|
//#region packages/range-slider/index.tsx
|
|
10
10
|
function c({ value: c, defaultValue: l, min: u = 0, max: d = 100, step: f = 1, onValueChange: p, onValueCommit: m, label: h, thumbLabels: g, valueText: _, name: v, disabled: y, className: b, style: x, ...S }) {
|
|
11
|
-
let C =
|
|
11
|
+
let C = e(), w = g ?? [C.minimum, C.maximum], [[T, E], D, O] = n(c, l ?? [u, d], p), k = a(null);
|
|
12
12
|
r(k, O);
|
|
13
13
|
let A = (e) => d > u ? (e - u) / (d - u) * 100 : 0, j = [{
|
|
14
14
|
value: T,
|
|
@@ -21,7 +21,7 @@ function c({ value: c, defaultValue: l, min: u = 0, max: d = 100, step: f = 1, o
|
|
|
21
21
|
role: "group",
|
|
22
22
|
"aria-label": h,
|
|
23
23
|
...S,
|
|
24
|
-
className:
|
|
24
|
+
className: t("zen__range-slider relative h-5 w-full", y && "opacity-50", b),
|
|
25
25
|
style: {
|
|
26
26
|
"--zen-thumb": "oklch(var(--primary))",
|
|
27
27
|
...x
|
|
@@ -30,25 +30,25 @@ function c({ value: c, defaultValue: l, min: u = 0, max: d = 100, step: f = 1, o
|
|
|
30
30
|
"aria-hidden": !0,
|
|
31
31
|
className: "absolute inset-x-0 top-1/2 h-2.5 -translate-y-1/2 rounded-full [--zen-end:right] rtl:[--zen-end:left]",
|
|
32
32
|
style: { background: `linear-gradient(to var(--zen-end), oklch(var(--muted)) ${A(T)}%, oklch(var(--primary)) ${A(T)}% ${A(E)}%, oklch(var(--muted)) ${A(E)}%)` }
|
|
33
|
-
}), j.map((
|
|
33
|
+
}), j.map((e, n) => /* @__PURE__ */ o("input", {
|
|
34
34
|
ref: n === 0 ? k : void 0,
|
|
35
35
|
type: "range",
|
|
36
36
|
name: v,
|
|
37
37
|
min: u,
|
|
38
38
|
max: d,
|
|
39
39
|
step: f,
|
|
40
|
-
value:
|
|
40
|
+
value: e.value,
|
|
41
41
|
disabled: y,
|
|
42
42
|
"aria-label": w[n],
|
|
43
|
-
"aria-valuetext": _?.(
|
|
44
|
-
onChange: (
|
|
45
|
-
let [n, r] =
|
|
43
|
+
"aria-valuetext": _?.(e.value),
|
|
44
|
+
onChange: (t) => {
|
|
45
|
+
let [n, r] = e.set(Number(t.target.value));
|
|
46
46
|
D([n, r]);
|
|
47
47
|
},
|
|
48
48
|
onPointerUp: () => m?.([T, E]),
|
|
49
49
|
onKeyUp: () => m?.([T, E]),
|
|
50
50
|
style: { zIndex: n === 0 && T > (u + d) / 2 ? 2 : 1 },
|
|
51
|
-
className:
|
|
51
|
+
className: t("pointer-events-none absolute inset-0 h-5 w-full cursor-pointer appearance-none bg-transparent outline-hidden disabled:cursor-not-allowed", "[&::-webkit-slider-runnable-track]:h-2.5 [&::-moz-range-track]:h-2.5 [&::-moz-range-track]:bg-transparent", "[&::-webkit-slider-thumb]:pointer-events-auto [&::-moz-range-thumb]:pointer-events-auto", i)
|
|
52
52
|
}, n))]
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useLocale as e, useMessages as t } from "../locale-provider/index.js";
|
|
3
|
+
import { cx as n } from "../utils/cx.js";
|
|
4
|
+
import { useControllable as r } from "../utils/useControllable.js";
|
|
5
5
|
import i from "../input/index.js";
|
|
6
6
|
import { FormValue as a } from "../utils/form-value.js";
|
|
7
7
|
import o from "../chip/index.js";
|
|
@@ -21,7 +21,7 @@ function b({ value: b, defaultValue: x = {
|
|
|
21
21
|
every: 1,
|
|
22
22
|
unit: "month"
|
|
23
23
|
}, onValueChange: S, locale: C, start: w, weekStartsOn: T, label: E, name: D, className: O, ...k }) {
|
|
24
|
-
let A =
|
|
24
|
+
let A = t(), j = E ?? A.repeats, M = e(C), N = T ?? l(M), [P, F, I] = r(b, x, S), [L, R] = h(String(P.every));
|
|
25
25
|
Number(L) !== P.every && L !== "" && R(String(P.every));
|
|
26
26
|
let z = u(M), B = Array.from({ length: 7 }, (e, t) => (N + t) % 7), V = P.weekdays ?? (w ? [s(w)] : []), H = P.every !== 1, U = (e) => {
|
|
27
27
|
let t = {
|
|
@@ -31,7 +31,7 @@ function b({ value: b, defaultValue: x = {
|
|
|
31
31
|
e === "week" && w && (t.weekdays = [s(w)]), e === "month" && (t.day = w ? Number(w.slice(8)) : 1), F(t);
|
|
32
32
|
};
|
|
33
33
|
return /* @__PURE__ */ v("fieldset", {
|
|
34
|
-
className:
|
|
34
|
+
className: n("zen__repeat-picker flex flex-col gap-3", O),
|
|
35
35
|
...k,
|
|
36
36
|
children: [
|
|
37
37
|
/* @__PURE__ */ _(a, {
|
package/dist/resizable/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
6
|
import { createContext as i, useContext as a, useEffect as o, useId as s, useLayoutEffect as c, useRef as l, useState as u } from "react";
|
|
7
7
|
import { jsx as d } from "react/jsx-runtime";
|
|
8
8
|
//#region packages/resizable/index.tsx
|
|
@@ -13,8 +13,8 @@ function m(e) {
|
|
|
13
13
|
return t;
|
|
14
14
|
}
|
|
15
15
|
var h = "[data-zen-panel]", g = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
16
|
-
function _({ orientation:
|
|
17
|
-
let s = l(null), c =
|
|
16
|
+
function _({ orientation: e = "horizontal", onLayout: n, ref: i, className: a, ...o }) {
|
|
17
|
+
let s = l(null), c = r(s, i), [m, _] = u({}), [v, y] = u({}), b = l(v), x = (e) => {
|
|
18
18
|
b.current = e, y(e);
|
|
19
19
|
}, [S, C] = u(!1), w = () => Array.from(s.current?.querySelectorAll(`:scope > ${h}`) ?? [], (e) => e.dataset.zenPanel);
|
|
20
20
|
f(() => {
|
|
@@ -25,7 +25,7 @@ function _({ orientation: t = "horizontal", onLayout: r, ref: i, className: a, .
|
|
|
25
25
|
x(a);
|
|
26
26
|
}, [m]);
|
|
27
27
|
let T = {
|
|
28
|
-
orientation:
|
|
28
|
+
orientation: e,
|
|
29
29
|
sizes: v,
|
|
30
30
|
specs: m,
|
|
31
31
|
register: (e, t) => (_((n) => ({
|
|
@@ -35,17 +35,17 @@ function _({ orientation: t = "horizontal", onLayout: r, ref: i, className: a, .
|
|
|
35
35
|
let { [e]: n, ...r } = t;
|
|
36
36
|
return r;
|
|
37
37
|
})),
|
|
38
|
-
resize: (e, t,
|
|
38
|
+
resize: (e, t, r) => {
|
|
39
39
|
let i = m[e], a = m[t];
|
|
40
40
|
if (!i || !a) return;
|
|
41
|
-
let o = b.current, s = o[e] + o[t], c = g(
|
|
41
|
+
let o = b.current, s = o[e] + o[t], c = g(r, Math.max(i.minSize, s - a.maxSize), Math.min(i.maxSize, s - a.minSize));
|
|
42
42
|
if (c === o[e]) return;
|
|
43
43
|
let l = {
|
|
44
44
|
...o,
|
|
45
45
|
[e]: c,
|
|
46
46
|
[t]: s - c
|
|
47
47
|
};
|
|
48
|
-
x(l),
|
|
48
|
+
x(l), n?.(w().map((e) => l[e]));
|
|
49
49
|
},
|
|
50
50
|
setDragging: C
|
|
51
51
|
};
|
|
@@ -54,25 +54,25 @@ function _({ orientation: t = "horizontal", onLayout: r, ref: i, className: a, .
|
|
|
54
54
|
children: /* @__PURE__ */ d("div", {
|
|
55
55
|
...o,
|
|
56
56
|
ref: c,
|
|
57
|
-
"data-orientation":
|
|
57
|
+
"data-orientation": e,
|
|
58
58
|
"data-dragging": S || void 0,
|
|
59
|
-
className:
|
|
59
|
+
className: t("zen__resizable flex size-full", e === "vertical" && "flex-col", S && "select-none", a)
|
|
60
60
|
})
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
function v({ defaultSize:
|
|
63
|
+
function v({ defaultSize: e, minSize: n = 0, maxSize: r = 100, id: i, className: a, style: o, ...c }) {
|
|
64
64
|
let l = m("ResizablePanel"), u = s(), p = i ?? u, { register: h } = l;
|
|
65
65
|
f(() => h(p, {
|
|
66
|
-
defaultSize:
|
|
66
|
+
defaultSize: e,
|
|
67
67
|
minSize: n,
|
|
68
68
|
maxSize: r
|
|
69
69
|
}), [
|
|
70
70
|
p,
|
|
71
|
-
|
|
71
|
+
e,
|
|
72
72
|
n,
|
|
73
73
|
r
|
|
74
74
|
]);
|
|
75
|
-
let g = l.sizes[p] ??
|
|
75
|
+
let g = l.sizes[p] ?? e ?? 1;
|
|
76
76
|
return /* @__PURE__ */ d("div", {
|
|
77
77
|
...c,
|
|
78
78
|
id: p,
|
|
@@ -81,12 +81,12 @@ function v({ defaultSize: t, minSize: n = 0, maxSize: r = 100, id: i, className:
|
|
|
81
81
|
flex: `${g} 1 0px`,
|
|
82
82
|
...o
|
|
83
83
|
},
|
|
84
|
-
className:
|
|
84
|
+
className: t("min-h-0 min-w-0 overflow-hidden", a)
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
var y = 5;
|
|
88
88
|
function b({ ref: i, className: a, onPointerDown: o, onKeyDown: s, ...c }) {
|
|
89
|
-
let p =
|
|
89
|
+
let p = e(), g = m("ResizableHandle"), _ = l(null), v = r(_, i), [b, x] = u(null), [S, C] = u(!1), w = g.orientation === "horizontal";
|
|
90
90
|
f(() => {
|
|
91
91
|
let e = _.current, t = e?.previousElementSibling?.closest(h)?.dataset.zenPanel, n = e?.nextElementSibling?.closest(h)?.dataset.zenPanel;
|
|
92
92
|
x((e) => !t || !n ? null : e?.[0] === t && e[1] === n ? e : [t, n]);
|
|
@@ -102,12 +102,12 @@ function b({ ref: i, className: a, onPointerDown: o, onKeyDown: s, ...c }) {
|
|
|
102
102
|
t.addEventListener("pointermove", c), t.addEventListener("pointerup", l), t.addEventListener("pointercancel", l);
|
|
103
103
|
}, A = (e) => {
|
|
104
104
|
if (s?.(e), e.defaultPrevented || !T || !E || D === void 0 || !O) return;
|
|
105
|
-
let
|
|
105
|
+
let t = w ? n(e.key, e.currentTarget) : e.key, r = {
|
|
106
106
|
[w ? "ArrowLeft" : "ArrowUp"]: D - y,
|
|
107
107
|
[w ? "ArrowRight" : "ArrowDown"]: D + y,
|
|
108
108
|
Home: O.minSize,
|
|
109
109
|
End: O.maxSize
|
|
110
|
-
}[
|
|
110
|
+
}[t];
|
|
111
111
|
r !== void 0 && (e.preventDefault(), g.resize(T, E, r));
|
|
112
112
|
};
|
|
113
113
|
return /* @__PURE__ */ d("div", {
|
|
@@ -124,10 +124,10 @@ function b({ ref: i, className: a, onPointerDown: o, onKeyDown: s, ...c }) {
|
|
|
124
124
|
"data-active": S || void 0,
|
|
125
125
|
onPointerDown: k,
|
|
126
126
|
onKeyDown: A,
|
|
127
|
-
className:
|
|
127
|
+
className: t("group/handle relative z-10 flex shrink-0 touch-none items-center justify-center outline-hidden", w ? "w-px cursor-col-resize before:absolute before:inset-y-0 before:-inset-x-2" : "h-px cursor-row-resize before:absolute before:inset-x-0 before:-inset-y-2", a),
|
|
128
128
|
children: /* @__PURE__ */ d("span", {
|
|
129
129
|
"aria-hidden": !0,
|
|
130
|
-
className:
|
|
130
|
+
className: t("bg-tint/[0.09] pointer-events-none absolute transition-[background-color,box-shadow,width,height] duration-200", w ? "inset-y-0 w-px" : "inset-x-0 h-px", "group-hover/handle:bg-primary/60 group-focus-visible/handle:bg-primary group-data-active/handle:bg-primary", "group-focus-visible/handle:shadow-[0_0_12px_oklch(var(--glow)/calc(0.8*var(--glow-k)))] group-data-active/handle:shadow-[0_0_12px_oklch(var(--glow)/calc(0.8*var(--glow-k)))]", w ? "group-focus-visible/handle:w-0.5 group-data-active/handle:w-0.5" : "group-focus-visible/handle:h-0.5 group-data-active/handle:h-0.5")
|
|
131
131
|
})
|
|
132
132
|
});
|
|
133
133
|
}
|
package/dist/seek-bar/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { SliderProps } from '../slider';
|
|
|
6
6
|
* the player's time updates. While dragging, the time follows the thumb and
|
|
7
7
|
* the track keeps playing; letting go seeks. The arrow keys seek 5 seconds.
|
|
8
8
|
*/
|
|
9
|
-
export default function SeekBar({ currentTime, duration, buffered, playing, playbackRate, onSeek, onKeyDown, disabled, className, ...rest }: SeekBarProps): import('react').JSX.Element;
|
|
9
|
+
export default function SeekBar({ currentTime, duration, buffered, playing, playbackRate, onSeek, times, onKeyDown, disabled, className, ...rest }: SeekBarProps): import('react').JSX.Element;
|
|
10
10
|
export interface SeekBarProps extends Omit<SliderProps, 'value' | 'defaultValue' | 'min' | 'max' | 'step' | 'onValueChange' | 'onValueCommit' | 'trackBackground'> {
|
|
11
11
|
/** Seconds played. */
|
|
12
12
|
currentTime: number;
|
|
@@ -20,5 +20,7 @@ export interface SeekBarProps extends Omit<SliderProps, 'value' | 'defaultValue'
|
|
|
20
20
|
playbackRate?: number;
|
|
21
21
|
/** When the user lets go, or steps with the keys: the time to play from. */
|
|
22
22
|
onSeek: (time: number) => void;
|
|
23
|
+
/** Where the time played and the length go: either side of the bar (default), or under its ends, as on a phone's Now Playing screen. */
|
|
24
|
+
times?: 'beside' | 'below';
|
|
23
25
|
}
|
|
24
26
|
//# sourceMappingURL=index.d.ts.map
|