@jfrader/ui 0.3.0 → 0.4.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/dist/combobox-DiMC2g_u.js +327 -0
- package/dist/combobox.js +1 -1
- package/dist/{date-picker-ClUYBIBh.js → date-picker-C29Uo4Tx.js} +42 -42
- package/dist/date-picker.js +1 -1
- package/dist/index.js +8 -8
- package/dist/{menu-DU60SMdt.js → menu-CGPTNRnF.js} +49 -49
- package/dist/menu.js +1 -1
- package/dist/{popover-BtN_0ejj.js → popover-CdRXjQqI.js} +30 -30
- package/dist/popover.js +1 -1
- package/dist/{select-BCS0-LVW.js → select-BgG7WgSh.js} +57 -57
- package/dist/select.js +1 -1
- package/dist/theme-root-BbTBuLMQ.js +46 -0
- package/dist/theme-root.js +1 -1
- package/dist/theme-scope-t7nAKc2c.js +27 -0
- package/dist/toast-CjmELMZZ.js +283 -0
- package/dist/toast.js +1 -1
- package/dist/{tooltip-CB-HC1js.js → tooltip-CaL3rKbV.js} +35 -35
- package/dist/tooltip.js +1 -1
- package/dist/types/components/theme-root/theme-root.d.ts +9 -3
- package/dist/types/overlay/overlay-portal.d.ts +7 -0
- package/dist/types/styling/theme-scope.d.ts +19 -0
- package/dist/use-overlay-floating-Bit-f0FU.js +31 -0
- package/package.json +2 -2
- package/dist/combobox-DrmjBbo7.js +0 -327
- package/dist/theme-root-BiXXvQvr.js +0 -42
- package/dist/toast-iqelR-r0.js +0 -282
- package/dist/use-overlay-floating-efeqppiw.js +0 -19
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n, t as r } from "./use-controlled-state-CVXDa-qM.js";
|
|
4
|
+
import { t as i } from "./renderable-DzcIj1Lo.js";
|
|
5
|
+
import { a, c as o, d as s, f as c, l, o as u, r as d, s as f, t as p, u as m } from "./collection-registry-BTYi6zGh.js";
|
|
6
|
+
import { n as h, t as g } from "./use-overlay-floating-Bit-f0FU.js";
|
|
7
|
+
import { t as _ } from "./text-field-D60ok14S.js";
|
|
8
|
+
import { createContext as v, useCallback as y, useContext as b, useId as x, useLayoutEffect as S, useMemo as C, useRef as w, useState as T } from "react";
|
|
9
|
+
import { vars as E } from "@jfrader/tokens/vars";
|
|
10
|
+
import { jsx as D, jsxs as O } from "@emotion/react/jsx-runtime";
|
|
11
|
+
import { FloatingList as k, useDismiss as ee, useInteractions as A, useListNavigation as j, useMergeRefs as M } from "@floating-ui/react";
|
|
12
|
+
//#region src/components/combobox/combobox.tsx
|
|
13
|
+
var N = "bottom-start", P = "✓", F = "No results", te = (e, t) => e.toLocaleLowerCase().includes(t.toLocaleLowerCase()), I = v(null), L = v(!1);
|
|
14
|
+
function R(e) {
|
|
15
|
+
let t = b(I);
|
|
16
|
+
if (!t) throw Error(`Combobox.${e} must be rendered inside <Combobox>.`);
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
function z(e) {
|
|
20
|
+
let t = R(e);
|
|
21
|
+
if (!b(L)) throw Error(`Combobox.${e} must be rendered inside <Combobox.List>.`);
|
|
22
|
+
return t;
|
|
23
|
+
}
|
|
24
|
+
var B = e({ "&[hidden]": { display: "none" } }), ne = e({
|
|
25
|
+
paddingBlock: E.space[1],
|
|
26
|
+
paddingInline: E.space[2],
|
|
27
|
+
fontSize: E.textSize.sm,
|
|
28
|
+
color: E.color.textMuted
|
|
29
|
+
});
|
|
30
|
+
function V({ value: e, defaultValue: t, onValueChange: i, open: o, defaultOpen: s = !1, onOpenChange: c, name: l, filter: u = te, onInputChange: d, children: f }) {
|
|
31
|
+
let p = x(), [m, h] = T(`${p}-listbox`), [_, v] = T(!1), [b = null, S] = r(e, t ?? null, i), [E = !1, k] = r(o, s, c), [M, P] = T(null), [F, L] = T(""), [R, z] = a(), [B, ne] = T(null), V = w([]), H = w(null), U = n(d), W = y((e, t) => t === "" || u(e, t), [u]), { valuesByIndex: G, skippedIndices: K, matchCount: re } = C(() => {
|
|
32
|
+
let e = [], t = /* @__PURE__ */ new Set(), n = 0;
|
|
33
|
+
return R.forEach((r, i) => {
|
|
34
|
+
if (r.index === -1) return;
|
|
35
|
+
e[r.index] = i;
|
|
36
|
+
let a = W(r.label, F);
|
|
37
|
+
a && (n += 1), (r.disabled || !a) && t.add(r.index);
|
|
38
|
+
}), {
|
|
39
|
+
valuesByIndex: e,
|
|
40
|
+
skippedIndices: t,
|
|
41
|
+
matchCount: n
|
|
42
|
+
};
|
|
43
|
+
}, [
|
|
44
|
+
R,
|
|
45
|
+
F,
|
|
46
|
+
W
|
|
47
|
+
]), { refs: q, floatingStyles: J, context: Y } = g({
|
|
48
|
+
open: E,
|
|
49
|
+
placement: N,
|
|
50
|
+
onOpenChange: (e) => k(e)
|
|
51
|
+
}), X = ee(Y, {
|
|
52
|
+
escapeKey: !0,
|
|
53
|
+
outsidePress: !0
|
|
54
|
+
}), ie = j(Y, {
|
|
55
|
+
listRef: V,
|
|
56
|
+
activeIndex: M,
|
|
57
|
+
onNavigate: P,
|
|
58
|
+
virtual: !0,
|
|
59
|
+
loop: !0,
|
|
60
|
+
disabledIndices: (e) => K.has(e)
|
|
61
|
+
}), { getReferenceProps: Z, getFloatingProps: Q, getItemProps: $ } = A([X, ie]), ae = C(() => {
|
|
62
|
+
let e = (e) => {
|
|
63
|
+
S(e), k(!1), H.current?.commitLabel(R.get(e)?.label ?? "");
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
baseId: p,
|
|
67
|
+
listId: m,
|
|
68
|
+
setListId: h,
|
|
69
|
+
setInputDisabled: v,
|
|
70
|
+
open: E,
|
|
71
|
+
selectedValue: b,
|
|
72
|
+
activeIndex: M,
|
|
73
|
+
options: R,
|
|
74
|
+
matchCount: re,
|
|
75
|
+
inputLabelling: B,
|
|
76
|
+
inputHandleRef: H,
|
|
77
|
+
refs: q,
|
|
78
|
+
floatingStyles: J,
|
|
79
|
+
elementsRef: V,
|
|
80
|
+
getReferenceProps: Z,
|
|
81
|
+
getFloatingProps: Q,
|
|
82
|
+
getItemProps: $,
|
|
83
|
+
onInputChange: U,
|
|
84
|
+
isVisible: (e) => W(e, F),
|
|
85
|
+
findMatches: (e) => {
|
|
86
|
+
let t = 0, n = null, r = null;
|
|
87
|
+
return R.forEach((i) => {
|
|
88
|
+
i.index !== -1 && W(i.label, e) && (t += 1, !i.disabled && ((n === null || i.index < n) && (n = i.index), (r === null || i.index > r) && (r = i.index)));
|
|
89
|
+
}), {
|
|
90
|
+
count: t,
|
|
91
|
+
first: n,
|
|
92
|
+
last: r
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
setQuery: L,
|
|
96
|
+
setActiveIndex: P,
|
|
97
|
+
selectValue: e,
|
|
98
|
+
selectIndex: (t) => {
|
|
99
|
+
let n = G[t];
|
|
100
|
+
n === void 0 || K.has(t) || e(n);
|
|
101
|
+
},
|
|
102
|
+
clearValue: () => S(null),
|
|
103
|
+
requestOpenChange: k,
|
|
104
|
+
registration: z,
|
|
105
|
+
setInputLabelling: ne
|
|
106
|
+
};
|
|
107
|
+
}, [
|
|
108
|
+
p,
|
|
109
|
+
m,
|
|
110
|
+
E,
|
|
111
|
+
b,
|
|
112
|
+
M,
|
|
113
|
+
R,
|
|
114
|
+
F,
|
|
115
|
+
re,
|
|
116
|
+
B,
|
|
117
|
+
q,
|
|
118
|
+
J,
|
|
119
|
+
Z,
|
|
120
|
+
Q,
|
|
121
|
+
$,
|
|
122
|
+
U,
|
|
123
|
+
W,
|
|
124
|
+
G,
|
|
125
|
+
K,
|
|
126
|
+
S,
|
|
127
|
+
k,
|
|
128
|
+
z
|
|
129
|
+
]);
|
|
130
|
+
return /* @__PURE__ */ O(I.Provider, {
|
|
131
|
+
value: ae,
|
|
132
|
+
children: [f, l !== void 0 && /* @__PURE__ */ D("input", {
|
|
133
|
+
type: "hidden",
|
|
134
|
+
name: l,
|
|
135
|
+
value: b ?? "",
|
|
136
|
+
disabled: _
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
V.displayName = "Combobox";
|
|
141
|
+
function H({ ref: e, inputValue: t, defaultInputValue: n, label: a, description: o, error: s, size: c, slotProps: l, className: u, sx: d, id: f, onChange: p, onKeyDown: m, onBlur: h, disabled: g = !1, ...v }) {
|
|
142
|
+
let { listId: y, open: b, selectedValue: C, activeIndex: w, options: E, inputHandleRef: O, refs: k, getReferenceProps: ee, onInputChange: A, findMatches: j, setQuery: N, setActiveIndex: P, selectIndex: F, clearValue: te, requestOpenChange: I, setInputLabelling: L, setInputDisabled: z } = R("Input"), B = M([k.setReference, e]), ne = x(), V = f ?? ne, H = `${V}-label`, U = i(a), W = v["aria-labelledby"], G = v["aria-label"], [K, re] = T(n), [q, J] = T(() => (t ?? n) !== void 0), Y = C === null ? void 0 : E.get(C)?.label, X = t ?? (q ? K ?? "" : Y ?? K ?? ""), [, ie] = r(X, void 0, A), Z = (e) => {
|
|
143
|
+
ie(e), t === void 0 && re(e);
|
|
144
|
+
}, Q = t !== void 0 || q ? X : "", $ = (e) => {
|
|
145
|
+
J(!1), Z(e);
|
|
146
|
+
};
|
|
147
|
+
S(() => {
|
|
148
|
+
N(Q);
|
|
149
|
+
}, [Q, N]), S(() => (z(g), () => z(!1)), [g, z]), S(() => (O.current = { commitLabel: $ }, () => {
|
|
150
|
+
O.current = null;
|
|
151
|
+
})), S(() => (L(W !== void 0 || !U ? {
|
|
152
|
+
labelledBy: W,
|
|
153
|
+
label: G
|
|
154
|
+
} : { labelledBy: H }), () => L(null)), [
|
|
155
|
+
W,
|
|
156
|
+
G,
|
|
157
|
+
U,
|
|
158
|
+
H,
|
|
159
|
+
L
|
|
160
|
+
]);
|
|
161
|
+
let ae = (e) => {
|
|
162
|
+
p?.(e);
|
|
163
|
+
let n = e.currentTarget.value;
|
|
164
|
+
J(!0), Z(n), n === "" && te();
|
|
165
|
+
let r = t ?? n;
|
|
166
|
+
if (r === "") {
|
|
167
|
+
P(null), I(!1);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
let i = j(r);
|
|
171
|
+
P(i.first), i.count > 0 && I(!0);
|
|
172
|
+
}, oe = (e) => {
|
|
173
|
+
if (m?.(e), !e.defaultPrevented) {
|
|
174
|
+
if (e.key === "Escape") q && Y !== void 0 && $(Y);
|
|
175
|
+
else if (b) {
|
|
176
|
+
if (e.key === "Enter" && w !== null) e.preventDefault(), F(w);
|
|
177
|
+
else if (e.key === "Home" || e.key === "End") {
|
|
178
|
+
let t = j(Q), n = e.key === "Home" ? t.first : t.last;
|
|
179
|
+
if (n === null) return;
|
|
180
|
+
e.preventDefault(), P(n);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}, se = (e) => {
|
|
185
|
+
h?.(e), b && I(!1);
|
|
186
|
+
};
|
|
187
|
+
return /* @__PURE__ */ D(_, {
|
|
188
|
+
...ee({
|
|
189
|
+
...v,
|
|
190
|
+
onKeyDown: oe,
|
|
191
|
+
onBlur: se
|
|
192
|
+
}),
|
|
193
|
+
ref: B,
|
|
194
|
+
id: V,
|
|
195
|
+
label: U ? /* @__PURE__ */ D("span", {
|
|
196
|
+
id: H,
|
|
197
|
+
children: a
|
|
198
|
+
}) : a,
|
|
199
|
+
description: o,
|
|
200
|
+
error: s,
|
|
201
|
+
size: c,
|
|
202
|
+
slotProps: l,
|
|
203
|
+
className: u,
|
|
204
|
+
sx: d,
|
|
205
|
+
value: X,
|
|
206
|
+
disabled: g,
|
|
207
|
+
onChange: ae,
|
|
208
|
+
role: "combobox",
|
|
209
|
+
autoComplete: "off",
|
|
210
|
+
"aria-autocomplete": "list",
|
|
211
|
+
"aria-expanded": b,
|
|
212
|
+
"aria-controls": b ? y : void 0,
|
|
213
|
+
"data-state": b ? "open" : "closed",
|
|
214
|
+
"data-ui": "combobox-input"
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
H.displayName = "Combobox.Input";
|
|
218
|
+
function U({ ref: e, id: n, style: r, onMouseDown: i, children: a, className: o, sx: l, ...u }) {
|
|
219
|
+
let { baseId: d, setListId: f, open: p, inputLabelling: m, refs: g, floatingStyles: _, elementsRef: v, getFloatingProps: y } = R("List"), b = n ?? `${d}-listbox`;
|
|
220
|
+
S(() => (f(b), () => f(`${d}-listbox`)), [
|
|
221
|
+
d,
|
|
222
|
+
b,
|
|
223
|
+
f
|
|
224
|
+
]);
|
|
225
|
+
let x = M([p ? g.setFloating : null, e]), C = u["aria-labelledby"] !== void 0 || u["aria-label"] !== void 0 ? {} : m?.labelledBy === void 0 ? { "aria-label": m?.label } : { "aria-labelledby": m.labelledBy }, w = (e) => {
|
|
226
|
+
i?.(e), e.preventDefault();
|
|
227
|
+
};
|
|
228
|
+
return /* @__PURE__ */ D(h, { children: /* @__PURE__ */ D(t, {
|
|
229
|
+
className: o,
|
|
230
|
+
styles: [c, s],
|
|
231
|
+
sx: l,
|
|
232
|
+
children: (e) => /* @__PURE__ */ D("div", {
|
|
233
|
+
...y({
|
|
234
|
+
id: b,
|
|
235
|
+
...C,
|
|
236
|
+
...u,
|
|
237
|
+
onMouseDown: w
|
|
238
|
+
}),
|
|
239
|
+
ref: x,
|
|
240
|
+
role: "listbox",
|
|
241
|
+
hidden: !p,
|
|
242
|
+
"data-state": p ? "open" : "closed",
|
|
243
|
+
"data-ui": "combobox-list",
|
|
244
|
+
style: {
|
|
245
|
+
...r,
|
|
246
|
+
..._
|
|
247
|
+
},
|
|
248
|
+
className: e,
|
|
249
|
+
children: /* @__PURE__ */ D(k, {
|
|
250
|
+
elementsRef: v,
|
|
251
|
+
children: /* @__PURE__ */ D(L.Provider, {
|
|
252
|
+
value: !0,
|
|
253
|
+
children: a
|
|
254
|
+
})
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
}) });
|
|
258
|
+
}
|
|
259
|
+
U.displayName = "Combobox.List";
|
|
260
|
+
function W({ ref: e, value: n, disabled: r = !1, onClick: i, children: a, className: s, sx: c, ...h }) {
|
|
261
|
+
let { baseId: g, selectedValue: _, activeIndex: v, options: y, isVisible: b, getItemProps: x, selectValue: S, registration: C } = z("Item"), T = w(null), { ref: E, index: k } = d(n, C, T, (e, t) => ({
|
|
262
|
+
index: e,
|
|
263
|
+
label: t,
|
|
264
|
+
disabled: r
|
|
265
|
+
})), ee = M([E, e]), A = y.get(n)?.label, j = A !== void 0 && !b(A), N = k !== -1 && v === k, F = _ === n, te = (e) => {
|
|
266
|
+
i?.(e), !(r || e.defaultPrevented) && S(n);
|
|
267
|
+
};
|
|
268
|
+
return /* @__PURE__ */ D(t, {
|
|
269
|
+
className: s,
|
|
270
|
+
styles: [
|
|
271
|
+
f,
|
|
272
|
+
u,
|
|
273
|
+
l,
|
|
274
|
+
B
|
|
275
|
+
],
|
|
276
|
+
sx: c,
|
|
277
|
+
children: (e) => /* @__PURE__ */ O("div", {
|
|
278
|
+
...x({
|
|
279
|
+
id: p(g, n),
|
|
280
|
+
...h,
|
|
281
|
+
onClick: te
|
|
282
|
+
}),
|
|
283
|
+
ref: ee,
|
|
284
|
+
role: "option",
|
|
285
|
+
hidden: j,
|
|
286
|
+
"aria-selected": F,
|
|
287
|
+
"aria-disabled": r || void 0,
|
|
288
|
+
"data-active": N || void 0,
|
|
289
|
+
"data-ui": "combobox-item",
|
|
290
|
+
className: e,
|
|
291
|
+
children: [/* @__PURE__ */ D("span", {
|
|
292
|
+
ref: T,
|
|
293
|
+
css: m,
|
|
294
|
+
children: a
|
|
295
|
+
}), F && /* @__PURE__ */ D("span", {
|
|
296
|
+
"aria-hidden": "true",
|
|
297
|
+
css: o,
|
|
298
|
+
children: P
|
|
299
|
+
})]
|
|
300
|
+
})
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
W.displayName = "Combobox.Item";
|
|
304
|
+
function G({ ref: e, children: n, className: r, sx: a, ...o }) {
|
|
305
|
+
let { matchCount: s } = z("Empty");
|
|
306
|
+
return s > 0 ? null : /* @__PURE__ */ D(t, {
|
|
307
|
+
className: r,
|
|
308
|
+
styles: ne,
|
|
309
|
+
sx: a,
|
|
310
|
+
children: (t) => /* @__PURE__ */ D("div", {
|
|
311
|
+
...o,
|
|
312
|
+
ref: e,
|
|
313
|
+
"data-ui": "combobox-empty",
|
|
314
|
+
className: t,
|
|
315
|
+
children: i(n) ? n : F
|
|
316
|
+
})
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
G.displayName = "Combobox.Empty";
|
|
320
|
+
var K = Object.assign(V, {
|
|
321
|
+
Input: H,
|
|
322
|
+
List: U,
|
|
323
|
+
Item: W,
|
|
324
|
+
Empty: G
|
|
325
|
+
});
|
|
326
|
+
//#endregion
|
|
327
|
+
export { K as t };
|
package/dist/combobox.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Combobox } from "./combobox-
|
|
2
|
+
export { t as Combobox } from "./combobox-DiMC2g_u.js";
|
|
@@ -4,20 +4,20 @@ import { t as n } from "./use-controlled-state-CVXDa-qM.js";
|
|
|
4
4
|
import { t as r } from "./renderable-DzcIj1Lo.js";
|
|
5
5
|
import { t as i } from "./calendar-C9Yad_-w.js";
|
|
6
6
|
import { n as a } from "./surface-DZ4d-2aL.js";
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { createContext as
|
|
10
|
-
import { vars as
|
|
11
|
-
import { jsx as
|
|
12
|
-
import { FloatingFocusManager as
|
|
7
|
+
import { n as o, t as s } from "./use-overlay-floating-Bit-f0FU.js";
|
|
8
|
+
import { t as c } from "./text-field-D60ok14S.js";
|
|
9
|
+
import { createContext as l, useContext as u, useEffect as d, useId as f, useLayoutEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
10
|
+
import { vars as _ } from "@jfrader/tokens/vars";
|
|
11
|
+
import { jsx as v, jsxs as y } from "@emotion/react/jsx-runtime";
|
|
12
|
+
import { FloatingFocusManager as b, useClick as x, useDismiss as S, useInteractions as C, useMergeRefs as w, useRole as T } from "@floating-ui/react";
|
|
13
13
|
//#region src/components/date-picker/date-picker.tsx
|
|
14
14
|
var E = "bottom-start", D = /* @__PURE__ */ new Set(["Enter", "ArrowDown"]), O = " ", k = "[data-ui=\"calendar-day\"][tabindex=\"0\"]", A = "[data-ui=\"calendar-day\"]", j = /^\d{4}-\d{2}-\d{2}$/, M = {
|
|
15
15
|
calendar: "gregory",
|
|
16
16
|
timeZone: "UTC",
|
|
17
17
|
dateStyle: "medium"
|
|
18
|
-
}, N =
|
|
18
|
+
}, N = l(null);
|
|
19
19
|
function P(e) {
|
|
20
|
-
let t =
|
|
20
|
+
let t = u(N);
|
|
21
21
|
if (!t) throw Error(`DatePicker.${e} must be rendered inside <DatePicker>.`);
|
|
22
22
|
return t;
|
|
23
23
|
}
|
|
@@ -49,25 +49,25 @@ var B = e({
|
|
|
49
49
|
"&:disabled": { cursor: "not-allowed" }
|
|
50
50
|
}), V = e({
|
|
51
51
|
...a,
|
|
52
|
-
borderRadius:
|
|
53
|
-
boxShadow:
|
|
54
|
-
padding:
|
|
52
|
+
borderRadius: _.radius.md,
|
|
53
|
+
boxShadow: _.shadow.overlay,
|
|
54
|
+
padding: _.space[3]
|
|
55
55
|
});
|
|
56
|
-
function H({ value: e, defaultValue: t, onValueChange: r, open: i, defaultOpen: a = !1, onOpenChange:
|
|
57
|
-
let [D, O] = n(e, t, r), [k = !1, A] = n(i, a,
|
|
56
|
+
function H({ value: e, defaultValue: t, onValueChange: r, open: i, defaultOpen: a = !1, onOpenChange: o, min: c, max: l, locale: u, firstDayOfWeek: f, disabled: p = !1, name: _, placeholder: b, children: w }) {
|
|
57
|
+
let [D, O] = n(e, t, r), [k = !1, A] = n(i, a, o), [j, P] = g(!1), F = p || j, I = k && !F, [z, B] = g(null), V = h(null), H = h(!1), U = m(() => new Intl.DateTimeFormat(u ?? ne()).resolvedOptions().locale, [u]), W = m(() => new Intl.DateTimeFormat(U, M), [U]), G = m(() => re(W, U), [W, U]), K = L(D), q = K ? W.format(K) : "", J = R(c), Y = R(l), X = ee(R(D) ?? te(), J, Y).slice(0, 7), { refs: Z, floatingStyles: Q, context: $ } = s({
|
|
58
58
|
open: I,
|
|
59
59
|
placement: E,
|
|
60
60
|
onOpenChange: (e, t, n) => {
|
|
61
61
|
F && e || (e || (H.current = n === "escape-key"), A(e));
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
d(() => {
|
|
65
65
|
F && (H.current = !1, k && A(!1));
|
|
66
66
|
}, [
|
|
67
67
|
F,
|
|
68
68
|
k,
|
|
69
69
|
A
|
|
70
|
-
]),
|
|
70
|
+
]), d(() => {
|
|
71
71
|
!F && !I && H.current && (H.current = !1, Z.domReference.current?.focus());
|
|
72
72
|
}, [
|
|
73
73
|
F,
|
|
@@ -84,7 +84,7 @@ function H({ value: e, defaultValue: t, onValueChange: r, open: i, defaultOpen:
|
|
|
84
84
|
ie,
|
|
85
85
|
ae,
|
|
86
86
|
oe
|
|
87
|
-
]), le =
|
|
87
|
+
]), le = m(() => ({
|
|
88
88
|
open: I,
|
|
89
89
|
disabled: F,
|
|
90
90
|
value: D,
|
|
@@ -131,20 +131,20 @@ function H({ value: e, defaultValue: t, onValueChange: r, open: i, defaultOpen:
|
|
|
131
131
|
A,
|
|
132
132
|
O
|
|
133
133
|
]);
|
|
134
|
-
return /* @__PURE__ */
|
|
134
|
+
return /* @__PURE__ */ y(N.Provider, {
|
|
135
135
|
value: le,
|
|
136
|
-
children: [w,
|
|
136
|
+
children: [w, _ !== void 0 && /* @__PURE__ */ v("input", {
|
|
137
137
|
type: "hidden",
|
|
138
|
-
name:
|
|
138
|
+
name: _,
|
|
139
139
|
value: D ?? "",
|
|
140
140
|
disabled: F
|
|
141
141
|
})]
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
H.displayName = "DatePicker";
|
|
145
|
-
function U({ ref: e, label: t, id: n, disabled: i, slotProps: a, onKeyDown: o, onKeyUp:
|
|
146
|
-
let { open: u, disabled:
|
|
147
|
-
|
|
145
|
+
function U({ ref: e, label: t, id: n, disabled: i, slotProps: a, onKeyDown: o, onKeyUp: s, ...l }) {
|
|
146
|
+
let { open: u, disabled: d, displayValue: m, placeholder: h, gridRef: g, refs: _, getReferenceProps: y, requestOpenChange: b, setInputLabelling: x, setInputDisabled: S } = P("Input"), C = w([_.setReference, e]), T = f(), E = n ?? T, k = `${E}-label`, A = r(t), j = l["aria-labelledby"], M = l["aria-label"], N = M ?? (typeof t == "string" ? t : void 0), F = d || i === !0;
|
|
147
|
+
p(() => (S(i === !0), () => S(!1)), [i, S]), p(() => (x(j === void 0 ? M === void 0 ? typeof t == "string" ? { label: t } : { labelledBy: A ? k : void 0 } : { label: M } : { labelledBy: j }), () => x(null)), [
|
|
148
148
|
j,
|
|
149
149
|
M,
|
|
150
150
|
t,
|
|
@@ -157,9 +157,9 @@ function U({ ref: e, label: t, id: n, disabled: i, slotProps: a, onKeyDown: o, o
|
|
|
157
157
|
}, L = (e) => {
|
|
158
158
|
o?.(e), !(e.defaultPrevented || F) && (e.key === O ? e.preventDefault() : D.has(e.key) && (e.preventDefault(), I()));
|
|
159
159
|
}, R = (e) => {
|
|
160
|
-
|
|
160
|
+
s?.(e), !(e.defaultPrevented || F || e.key !== O) && I();
|
|
161
161
|
};
|
|
162
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ v(c, {
|
|
163
163
|
...y({
|
|
164
164
|
...l,
|
|
165
165
|
onKeyDown: L,
|
|
@@ -167,7 +167,7 @@ function U({ ref: e, label: t, id: n, disabled: i, slotProps: a, onKeyDown: o, o
|
|
|
167
167
|
}),
|
|
168
168
|
ref: C,
|
|
169
169
|
id: E,
|
|
170
|
-
label: A ? /* @__PURE__ */
|
|
170
|
+
label: A ? /* @__PURE__ */ v("span", {
|
|
171
171
|
id: k,
|
|
172
172
|
children: t
|
|
173
173
|
}) : t,
|
|
@@ -190,12 +190,12 @@ function U({ ref: e, label: t, id: n, disabled: i, slotProps: a, onKeyDown: o, o
|
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
U.displayName = "DatePicker.Input";
|
|
193
|
-
function W({ ref: e, style: n, className: r, sx: a, ...
|
|
194
|
-
let { open:
|
|
195
|
-
|
|
193
|
+
function W({ ref: e, style: n, className: r, sx: a, ...s }) {
|
|
194
|
+
let { open: c, value: l, initialMonth: u, min: d, max: f, locale: p, firstDayOfWeek: m, inputLabelling: g, gridRef: _, refs: x, floatingContext: S, floatingStyles: C, getFloatingProps: T, selectDate: E } = P("Popup"), D = w([x.setFloating, e]), O = h(null), k = w([(e) => {
|
|
195
|
+
_.current = e, O.current = z(e);
|
|
196
196
|
}]);
|
|
197
|
-
if (!
|
|
198
|
-
let j =
|
|
197
|
+
if (!c) return null;
|
|
198
|
+
let j = s["aria-labelledby"] !== void 0 || s["aria-label"] !== void 0 ? {} : g?.labelledBy === void 0 ? { "aria-label": g?.label } : { "aria-labelledby": g.labelledBy }, M = (e) => {
|
|
199
199
|
let t = e.target.closest(A);
|
|
200
200
|
if (t?.disabled) return;
|
|
201
201
|
let n = t?.dataset.date;
|
|
@@ -203,19 +203,19 @@ function W({ ref: e, style: n, className: r, sx: a, ...o }) {
|
|
|
203
203
|
}, N = (e) => {
|
|
204
204
|
e.target.closest(A)?.disabled && e.preventDefault();
|
|
205
205
|
};
|
|
206
|
-
return /* @__PURE__ */
|
|
206
|
+
return /* @__PURE__ */ v(o, { children: /* @__PURE__ */ v(b, {
|
|
207
207
|
context: S,
|
|
208
208
|
modal: !1,
|
|
209
209
|
initialFocus: O,
|
|
210
210
|
returnFocus: !1,
|
|
211
|
-
children: /* @__PURE__ */
|
|
211
|
+
children: /* @__PURE__ */ v(t, {
|
|
212
212
|
className: r,
|
|
213
213
|
styles: V,
|
|
214
214
|
sx: a,
|
|
215
|
-
children: (e) => /* @__PURE__ */
|
|
215
|
+
children: (e) => /* @__PURE__ */ v("div", {
|
|
216
216
|
...T({
|
|
217
217
|
...j,
|
|
218
|
-
...
|
|
218
|
+
...s
|
|
219
219
|
}),
|
|
220
220
|
ref: D,
|
|
221
221
|
"data-ui": "date-picker-popup",
|
|
@@ -224,14 +224,14 @@ function W({ ref: e, style: n, className: r, sx: a, ...o }) {
|
|
|
224
224
|
...C
|
|
225
225
|
},
|
|
226
226
|
className: e,
|
|
227
|
-
children: /* @__PURE__ */
|
|
228
|
-
value:
|
|
229
|
-
defaultVisibleMonth:
|
|
230
|
-
min:
|
|
231
|
-
max:
|
|
232
|
-
locale:
|
|
233
|
-
firstDayOfWeek:
|
|
234
|
-
children: [/* @__PURE__ */
|
|
227
|
+
children: /* @__PURE__ */ y(i, {
|
|
228
|
+
value: l ?? "",
|
|
229
|
+
defaultVisibleMonth: u,
|
|
230
|
+
min: d,
|
|
231
|
+
max: f,
|
|
232
|
+
locale: p,
|
|
233
|
+
firstDayOfWeek: m,
|
|
234
|
+
children: [/* @__PURE__ */ v(i.Header, {}), /* @__PURE__ */ v(i.Grid, {
|
|
235
235
|
ref: k,
|
|
236
236
|
onClick: M,
|
|
237
237
|
onPointerDownCapture: N
|
package/dist/date-picker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as DatePicker } from "./date-picker-
|
|
2
|
+
export { t as DatePicker } from "./date-picker-C29Uo4Tx.js";
|
package/dist/index.js
CHANGED
|
@@ -10,30 +10,30 @@ import { t as s } from "./card-D-aI2QHx.js";
|
|
|
10
10
|
import { t as c } from "./checkbox-COYG6L7d.js";
|
|
11
11
|
import { t as l } from "./command-palette-V_2pEay7.js";
|
|
12
12
|
import { t as u } from "./text-field-D60ok14S.js";
|
|
13
|
-
import { t as d } from "./combobox-
|
|
13
|
+
import { t as d } from "./combobox-DiMC2g_u.js";
|
|
14
14
|
import { t as f } from "./container-BOaSptJa.js";
|
|
15
|
-
import { t as p } from "./date-picker-
|
|
15
|
+
import { t as p } from "./date-picker-C29Uo4Tx.js";
|
|
16
16
|
import { t as m } from "./dialog-xaydbXl2.js";
|
|
17
17
|
import { t as h } from "./divider-DYoJf0I_.js";
|
|
18
18
|
import { t as g } from "./flex-Dh-_J5-U.js";
|
|
19
19
|
import { t as _ } from "./kbd-C3ACoMoE.js";
|
|
20
|
-
import { t as v } from "./menu-
|
|
20
|
+
import { t as v } from "./menu-CGPTNRnF.js";
|
|
21
21
|
import { t as y } from "./navigation-DhnKriOp.js";
|
|
22
22
|
import { t as b } from "./pagination-DYdwsxwe.js";
|
|
23
23
|
import { t as x } from "./pill-DO2gHzMb.js";
|
|
24
|
-
import { t as S } from "./popover-
|
|
24
|
+
import { t as S } from "./popover-CdRXjQqI.js";
|
|
25
25
|
import { t as C } from "./progress-BpJswTG4.js";
|
|
26
26
|
import { t as w } from "./radio-group-Ce0_IWQr.js";
|
|
27
|
-
import { t as T } from "./select-
|
|
27
|
+
import { t as T } from "./select-BgG7WgSh.js";
|
|
28
28
|
import { t as E } from "./skeleton-OoFlOEXO.js";
|
|
29
29
|
import { t as D } from "./spinner-C2YDoiMn.js";
|
|
30
30
|
import { t as O } from "./stack-DC3IbtWk.js";
|
|
31
31
|
import { t as k } from "./switch-Dr-qjmT4.js";
|
|
32
32
|
import { t as A } from "./tabs-CK_g1RKa.js";
|
|
33
33
|
import { t as j } from "./textarea-DyfjtP0A.js";
|
|
34
|
-
import { i as M, n as N, r as P, t as F } from "./theme-root-
|
|
35
|
-
import { n as I, t as L } from "./toast-
|
|
34
|
+
import { i as M, n as N, r as P, t as F } from "./theme-root-BbTBuLMQ.js";
|
|
35
|
+
import { n as I, t as L } from "./toast-CjmELMZZ.js";
|
|
36
36
|
import { t as R } from "./toggle-group-CI0e7hFm.js";
|
|
37
|
-
import { t as z } from "./tooltip-
|
|
37
|
+
import { t as z } from "./tooltip-CaL3rKbV.js";
|
|
38
38
|
import B from "@emotion/styled";
|
|
39
39
|
export { e as Accordion, t as Alert, n as Avatar, r as Badge, i as Breadcrumbs, a as Button, o as Calendar, s as Card, c as Checkbox, d as Combobox, l as CommandPalette, f as Container, p as DatePicker, m as Dialog, h as Divider, g as Flex, _ as Kbd, v as Menu, y as Navigation, b as Pagination, x as Pill, S as Popover, C as Progress, w as RadioGroup, T as Select, E as Skeleton, D as Spinner, O as Stack, k as Switch, A as Tabs, u as TextField, j as Textarea, N as ThemeProvider, F as ThemeRoot, L as Toast, R as ToggleGroup, z as Tooltip, B as styled, M as theme, P as useTheme, I as useToast };
|