asterui 0.12.63 → 0.12.64
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/components/Collapse.js +58 -56
- package/dist/components/Collapse.js.map +1 -1
- package/dist/components/DatePicker.d.ts +19 -1
- package/dist/components/DatePicker.js +266 -87
- package/dist/components/DatePicker.js.map +1 -1
- package/dist/components/Menu.d.ts +1 -1
- package/dist/components/Menu.js +99 -93
- package/dist/components/Menu.js.map +1 -1
- package/dist/components/Modal.js +26 -17
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/Notification.js +53 -45
- package/dist/components/Notification.js.map +1 -1
- package/dist/components/Tabs.js +69 -57
- package/dist/components/Tabs.js.map +1 -1
- package/dist/components/Tooltip.js +38 -35
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/Transfer.js +130 -121
- package/dist/components/Transfer.js.map +1 -1
- package/dist/components/TreeSelect.js +49 -48
- package/dist/components/TreeSelect.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import un, { forwardRef as fn, useId as hn, useState as T, useRef as
|
|
1
|
+
import { jsx as v, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import un, { forwardRef as fn, useId as hn, useState as T, useRef as ve, useMemo as ce, useCallback as z, useEffect as ge } from "react";
|
|
3
3
|
import { useConfig as pn } from "../providers/ConfigProvider.js";
|
|
4
|
-
const bn = "checkbox",
|
|
4
|
+
const bn = "checkbox", vn = "checkbox-sm", gn = "checkbox-primary", yn = "loading", xn = "loading-spinner", wn = "loading-xs", Me = "input", kn = "input-sm", mn = "input-disabled", Ln = "SHOW_ALL", $n = "SHOW_PARENT", Sn = "SHOW_CHILD";
|
|
5
5
|
function d(r, u, p) {
|
|
6
6
|
if (u === "title") {
|
|
7
7
|
const l = p?.label || "title";
|
|
@@ -19,15 +19,15 @@ function d(r, u, p) {
|
|
|
19
19
|
function Be(r, u = [], p) {
|
|
20
20
|
const l = [];
|
|
21
21
|
return r.forEach((f) => {
|
|
22
|
-
const b = d(f, "title", p),
|
|
23
|
-
l.push({ node: f, path: k }),
|
|
22
|
+
const b = d(f, "title", p), g = d(f, "children", p), k = [...u, b];
|
|
23
|
+
l.push({ node: f, path: k }), g && l.push(...Be(g, k, p));
|
|
24
24
|
}), l;
|
|
25
25
|
}
|
|
26
26
|
function Kn(r, u) {
|
|
27
27
|
const p = [], l = (f) => {
|
|
28
28
|
f.forEach((b) => {
|
|
29
|
-
const
|
|
30
|
-
p.push(
|
|
29
|
+
const g = d(b, "key", u), k = d(b, "children", u);
|
|
30
|
+
p.push(g), k && l(k);
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
return l(r), p;
|
|
@@ -37,8 +37,8 @@ function $(r, u, p) {
|
|
|
37
37
|
const f = d(l, "key", p), b = d(l, "children", p);
|
|
38
38
|
if (f === u) return l;
|
|
39
39
|
if (b) {
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
40
|
+
const g = $(b, u, p);
|
|
41
|
+
if (g) return g;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
return null;
|
|
@@ -46,19 +46,19 @@ function $(r, u, p) {
|
|
|
46
46
|
function Pe(r, u) {
|
|
47
47
|
const p = [], l = (f) => {
|
|
48
48
|
const b = d(f, "children", u);
|
|
49
|
-
b && b.forEach((
|
|
50
|
-
const k = d(
|
|
51
|
-
p.push(k), l(
|
|
49
|
+
b && b.forEach((g) => {
|
|
50
|
+
const k = d(g, "key", u);
|
|
51
|
+
p.push(k), l(g);
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
return l(r), p;
|
|
55
55
|
}
|
|
56
56
|
function ye(r, u, p, l = []) {
|
|
57
57
|
for (const f of r) {
|
|
58
|
-
const b = d(f, "key", p),
|
|
58
|
+
const b = d(f, "key", p), g = d(f, "children", p);
|
|
59
59
|
if (b === u) return l;
|
|
60
|
-
if (
|
|
61
|
-
const k = ye(
|
|
60
|
+
if (g) {
|
|
61
|
+
const k = ye(g, u, p, [...l, b]);
|
|
62
62
|
if (k) return k;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -71,7 +71,7 @@ function En({
|
|
|
71
71
|
selected: l,
|
|
72
72
|
checked: f,
|
|
73
73
|
indeterminate: b,
|
|
74
|
-
treeCheckable:
|
|
74
|
+
treeCheckable: g,
|
|
75
75
|
treeLine: k,
|
|
76
76
|
treeIcon: V,
|
|
77
77
|
focused: A,
|
|
@@ -88,12 +88,12 @@ function En({
|
|
|
88
88
|
const q = d(r, "children", X), B = d(r, "title", X), W = d(r, "key", X), N = r.icon, G = q && q.length > 0, K = r.isLeaf ?? !G, R = (L) => {
|
|
89
89
|
L.stopPropagation(), K || Y(W);
|
|
90
90
|
}, m = () => {
|
|
91
|
-
r.disabled || (
|
|
91
|
+
r.disabled || (g ? P(W, r) : Z(W, r));
|
|
92
92
|
}, _ = (L) => {
|
|
93
93
|
L.stopPropagation(), r.disabled || P(W, r);
|
|
94
94
|
}, J = (L) => {
|
|
95
95
|
(L.key === "Enter" || L.key === " ") && (L.preventDefault(), m());
|
|
96
|
-
}, ee = () => le ? /* @__PURE__ */
|
|
96
|
+
}, ee = () => le ? /* @__PURE__ */ v("span", { className: `${yn} ${xn} ${wn}` }) : M ? typeof M == "function" ? M({ expanded: p }) : M : /* @__PURE__ */ v(
|
|
97
97
|
"svg",
|
|
98
98
|
{
|
|
99
99
|
className: `w-3 h-3 transition-transform ${p ? "rotate-90" : ""}`,
|
|
@@ -101,7 +101,7 @@ function En({
|
|
|
101
101
|
viewBox: "0 0 24 24",
|
|
102
102
|
stroke: "currentColor",
|
|
103
103
|
"aria-hidden": "true",
|
|
104
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ v("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
|
|
105
105
|
}
|
|
106
106
|
);
|
|
107
107
|
return /* @__PURE__ */ C(
|
|
@@ -111,6 +111,7 @@ function En({
|
|
|
111
111
|
role: "treeitem",
|
|
112
112
|
id: ae,
|
|
113
113
|
"aria-selected": l || f,
|
|
114
|
+
"aria-checked": g ? b ? "mixed" : f : void 0,
|
|
114
115
|
"aria-expanded": G ? p : void 0,
|
|
115
116
|
"data-testid": `${U}-option-${W}`,
|
|
116
117
|
"data-state": l || f ? "selected" : "unselected",
|
|
@@ -131,7 +132,7 @@ function En({
|
|
|
131
132
|
onKeyDown: J,
|
|
132
133
|
tabIndex: -1,
|
|
133
134
|
children: [
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ v(
|
|
135
136
|
"span",
|
|
136
137
|
{
|
|
137
138
|
className: [
|
|
@@ -143,11 +144,11 @@ function En({
|
|
|
143
144
|
children: !K && ee()
|
|
144
145
|
}
|
|
145
146
|
),
|
|
146
|
-
|
|
147
|
+
g && /* @__PURE__ */ v("span", { className: "mr-2 flex-shrink-0", onClick: _, children: /* @__PURE__ */ v(
|
|
147
148
|
"input",
|
|
148
149
|
{
|
|
149
150
|
type: "checkbox",
|
|
150
|
-
className: `${bn} ${
|
|
151
|
+
className: `${bn} ${vn} ${gn}`,
|
|
151
152
|
checked: f,
|
|
152
153
|
ref: (L) => {
|
|
153
154
|
L && (L.indeterminate = b);
|
|
@@ -158,12 +159,12 @@ function En({
|
|
|
158
159
|
tabIndex: -1
|
|
159
160
|
}
|
|
160
161
|
) }),
|
|
161
|
-
V && N && /* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
162
|
+
V && N && /* @__PURE__ */ v("span", { className: "mr-1.5 flex-shrink-0 flex items-center", children: N }),
|
|
163
|
+
/* @__PURE__ */ v("span", { className: "flex-1 truncate select-none text-sm", children: B })
|
|
163
164
|
]
|
|
164
165
|
}
|
|
165
166
|
),
|
|
166
|
-
G && p && /* @__PURE__ */
|
|
167
|
+
G && p && /* @__PURE__ */ v("div", { role: "group", children: D(q, u + 1) })
|
|
167
168
|
]
|
|
168
169
|
}
|
|
169
170
|
);
|
|
@@ -198,7 +199,7 @@ const In = {
|
|
|
198
199
|
onChange: l,
|
|
199
200
|
multiple: f = !1,
|
|
200
201
|
treeCheckable: b = !1,
|
|
201
|
-
treeCheckStrictly:
|
|
202
|
+
treeCheckStrictly: g = !1,
|
|
202
203
|
showCheckedStrategy: k = "SHOW_ALL",
|
|
203
204
|
showSearch: V = !1,
|
|
204
205
|
searchValue: A,
|
|
@@ -236,7 +237,7 @@ const In = {
|
|
|
236
237
|
"data-testid": Ve,
|
|
237
238
|
...Ue
|
|
238
239
|
}, ne) => {
|
|
239
|
-
const { componentSize: Xe, componentDisabled: qe, renderEmpty: Ge } = pn(), Je = q ?? Xe ?? "md", H = M ?? qe ?? !1, Qe = Te ?? Ge?.("TreeSelect") ?? "No results found", E = Ve ?? "treeselect", te = hn(), me = `${te}-listbox`, [Ye, Ze] = T(!1), [De, re] = T(""), [x, j] = T(null), [Le, $e] = T(/* @__PURE__ */ new Set()), fe =
|
|
240
|
+
const { componentSize: Xe, componentDisabled: qe, renderEmpty: Ge } = pn(), Je = q ?? Xe ?? "md", H = M ?? qe ?? !1, Qe = Te ?? Ge?.("TreeSelect") ?? "No results found", E = Ve ?? "treeselect", te = hn(), me = `${te}-listbox`, [Ye, Ze] = T(!1), [De, re] = T(""), [x, j] = T(null), [Le, $e] = T(/* @__PURE__ */ new Set()), fe = ve(null), he = ve(null), se = ve(null), Q = A ?? De, y = ue ?? Ye, Se = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map((n) => typeof n == "object" && n !== null ? n.value : n) : typeof e == "object" && e !== null ? [e.value] : [e], Ne = Se(p), [en, ie] = T(Ne), h = u !== void 0 ? Se(u) : en, nn = ce(() => Y ? Kn(r, i) : Z, [r, Y, Z, i]), [tn, rn] = T(nn), I = P ?? tn, S = ce(() => {
|
|
240
241
|
const e = [], n = (c) => {
|
|
241
242
|
c.forEach((t) => {
|
|
242
243
|
const o = d(t, "key", i), s = d(t, "children", i);
|
|
@@ -250,14 +251,14 @@ const In = {
|
|
|
250
251
|
},
|
|
251
252
|
[ue, xe]
|
|
252
253
|
);
|
|
253
|
-
|
|
254
|
+
ge(() => {
|
|
254
255
|
const e = (n) => {
|
|
255
256
|
fe.current && !fe.current.contains(n.target) && (O(!1), A === void 0 && re(""));
|
|
256
257
|
};
|
|
257
258
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
258
|
-
}, [O, A]),
|
|
259
|
+
}, [O, A]), ge(() => {
|
|
259
260
|
y && V && he.current ? he.current.focus() : y && se.current && se.current.focus();
|
|
260
|
-
}, [y, V]),
|
|
261
|
+
}, [y, V]), ge(() => {
|
|
261
262
|
y && S.length > 0 ? h.length > 0 ? j(h[0]) : j(S[0].key) : y || j(null);
|
|
262
263
|
}, [y, S, h]);
|
|
263
264
|
const Ke = ce(() => {
|
|
@@ -347,7 +348,7 @@ const In = {
|
|
|
347
348
|
(e, n) => {
|
|
348
349
|
const c = h.includes(e);
|
|
349
350
|
let t = [...h];
|
|
350
|
-
if (
|
|
351
|
+
if (g)
|
|
351
352
|
if (c)
|
|
352
353
|
t = t.filter((s) => s !== e);
|
|
353
354
|
else {
|
|
@@ -388,7 +389,7 @@ const In = {
|
|
|
388
389
|
} else
|
|
389
390
|
l?.(t, o, { triggerValue: e, triggerNode: n });
|
|
390
391
|
},
|
|
391
|
-
[h, u, l, r,
|
|
392
|
+
[h, u, l, r, g, i, m, _]
|
|
392
393
|
), sn = (e) => {
|
|
393
394
|
e.stopPropagation();
|
|
394
395
|
const n = [];
|
|
@@ -474,18 +475,18 @@ const In = {
|
|
|
474
475
|
}, Ie = z(
|
|
475
476
|
(e) => {
|
|
476
477
|
const n = d(e, "key", i), c = d(e, "children", i);
|
|
477
|
-
if (
|
|
478
|
+
if (g)
|
|
478
479
|
return { checked: h.includes(n), indeterminate: !1 };
|
|
479
480
|
if (!c || c.length === 0)
|
|
480
481
|
return { checked: h.includes(n), indeterminate: !1 };
|
|
481
482
|
const t = Pe(e, i), o = t.filter((s) => h.includes(s));
|
|
482
483
|
return o.length === 0 ? { checked: h.includes(n), indeterminate: !1 } : o.length === t.length ? { checked: !0, indeterminate: !1 } : { checked: !1, indeterminate: !0 };
|
|
483
484
|
},
|
|
484
|
-
[h,
|
|
485
|
+
[h, g, i]
|
|
485
486
|
), Ae = z(
|
|
486
487
|
(e, n) => e.map((c) => {
|
|
487
488
|
const t = d(c, "key", i), { checked: o, indeterminate: s } = Ie(c);
|
|
488
|
-
return /* @__PURE__ */
|
|
489
|
+
return /* @__PURE__ */ v(
|
|
489
490
|
En,
|
|
490
491
|
{
|
|
491
492
|
node: c,
|
|
@@ -547,21 +548,21 @@ const In = {
|
|
|
547
548
|
Ee(a, { stopPropagation: () => {
|
|
548
549
|
} });
|
|
549
550
|
};
|
|
550
|
-
return J ? /* @__PURE__ */
|
|
551
|
+
return J ? /* @__PURE__ */ v(un.Fragment, { children: J({ label: _e, value: a, closable: je, onClose: dn }) }, a) : /* @__PURE__ */ C(
|
|
551
552
|
"span",
|
|
552
553
|
{
|
|
553
554
|
className: "inline-flex items-center gap-1 px-2 py-0.5 bg-base-200 rounded text-sm mr-1 mb-1",
|
|
554
555
|
"data-testid": `${E}-tag-${a}`,
|
|
555
556
|
children: [
|
|
556
557
|
_e,
|
|
557
|
-
je && /* @__PURE__ */
|
|
558
|
+
je && /* @__PURE__ */ v(
|
|
558
559
|
"button",
|
|
559
560
|
{
|
|
560
561
|
type: "button",
|
|
561
562
|
className: "hover:text-error",
|
|
562
563
|
onClick: (Oe) => Ee(a, Oe),
|
|
563
564
|
"aria-label": `Remove ${typeof F == "string" ? F : a}`,
|
|
564
|
-
children: /* @__PURE__ */
|
|
565
|
+
children: /* @__PURE__ */ v(
|
|
565
566
|
"svg",
|
|
566
567
|
{
|
|
567
568
|
className: "w-3 h-3",
|
|
@@ -569,7 +570,7 @@ const In = {
|
|
|
569
570
|
viewBox: "0 0 24 24",
|
|
570
571
|
stroke: "currentColor",
|
|
571
572
|
"aria-hidden": "true",
|
|
572
|
-
children: /* @__PURE__ */
|
|
573
|
+
children: /* @__PURE__ */ v(
|
|
573
574
|
"path",
|
|
574
575
|
{
|
|
575
576
|
strokeLinecap: "round",
|
|
@@ -590,7 +591,7 @@ const In = {
|
|
|
590
591
|
if (o > 0) {
|
|
591
592
|
const a = e.slice(K), w = typeof R == "function" ? R(a) : R || `+${o} more`;
|
|
592
593
|
s.push(
|
|
593
|
-
/* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ v(
|
|
594
595
|
"span",
|
|
595
596
|
{
|
|
596
597
|
className: "inline-flex items-center px-2 py-0.5 bg-base-200 rounded text-sm mr-1 mb-1",
|
|
@@ -616,7 +617,7 @@ const In = {
|
|
|
616
617
|
i,
|
|
617
618
|
H,
|
|
618
619
|
J
|
|
619
|
-
]), He = W ? Hn[W] : B ? An[B] : "", an = G ? "bg-transparent border-transparent" : Wn[N], We = /* @__PURE__ */
|
|
620
|
+
]), He = W ? Hn[W] : B ? An[B] : "", an = G ? "bg-transparent border-transparent" : Wn[N], We = /* @__PURE__ */ v("div", { className: "py-1", role: "tree", "aria-label": "Tree options", children: Ke.length > 0 ? Ae(Ke, 0) : /* @__PURE__ */ v(
|
|
620
621
|
"div",
|
|
621
622
|
{
|
|
622
623
|
className: "px-4 py-2 text-base-content/50 text-sm text-center",
|
|
@@ -660,8 +661,8 @@ const In = {
|
|
|
660
661
|
onClick: () => !H && O(!y),
|
|
661
662
|
"data-testid": `${E}-trigger`,
|
|
662
663
|
children: [
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
X && h.length > 0 && !H && /* @__PURE__ */
|
|
664
|
+
/* @__PURE__ */ v("div", { className: "flex-1 flex flex-wrap items-center gap-1 min-w-0", children: ln || /* @__PURE__ */ v("span", { className: "text-base-content/50", children: ae }) }),
|
|
665
|
+
X && h.length > 0 && !H && /* @__PURE__ */ v(
|
|
665
666
|
"button",
|
|
666
667
|
{
|
|
667
668
|
type: "button",
|
|
@@ -669,7 +670,7 @@ const In = {
|
|
|
669
670
|
onClick: sn,
|
|
670
671
|
"aria-label": "Clear selection",
|
|
671
672
|
"data-testid": `${E}-clear`,
|
|
672
|
-
children: /* @__PURE__ */
|
|
673
|
+
children: /* @__PURE__ */ v(
|
|
673
674
|
"svg",
|
|
674
675
|
{
|
|
675
676
|
className: "w-4 h-4",
|
|
@@ -677,7 +678,7 @@ const In = {
|
|
|
677
678
|
viewBox: "0 0 24 24",
|
|
678
679
|
stroke: "currentColor",
|
|
679
680
|
"aria-hidden": "true",
|
|
680
|
-
children: /* @__PURE__ */
|
|
681
|
+
children: /* @__PURE__ */ v(
|
|
681
682
|
"path",
|
|
682
683
|
{
|
|
683
684
|
strokeLinecap: "round",
|
|
@@ -690,7 +691,7 @@ const In = {
|
|
|
690
691
|
)
|
|
691
692
|
}
|
|
692
693
|
),
|
|
693
|
-
Fe || /* @__PURE__ */
|
|
694
|
+
Fe || /* @__PURE__ */ v(
|
|
694
695
|
"svg",
|
|
695
696
|
{
|
|
696
697
|
className: `w-4 h-4 flex-shrink-0 transition-transform ${y ? "rotate-180" : ""}`,
|
|
@@ -698,7 +699,7 @@ const In = {
|
|
|
698
699
|
viewBox: "0 0 24 24",
|
|
699
700
|
stroke: "currentColor",
|
|
700
701
|
"aria-hidden": "true",
|
|
701
|
-
children: /* @__PURE__ */
|
|
702
|
+
children: /* @__PURE__ */ v(
|
|
702
703
|
"path",
|
|
703
704
|
{
|
|
704
705
|
strokeLinecap: "round",
|
|
@@ -719,7 +720,7 @@ const In = {
|
|
|
719
720
|
className: `absolute z-50 mt-1 w-full bg-base-100 border border-base-300 rounded-lg shadow-lg max-h-64 overflow-auto ${ze}`,
|
|
720
721
|
"data-testid": `${E}-dropdown`,
|
|
721
722
|
children: [
|
|
722
|
-
V && /* @__PURE__ */
|
|
723
|
+
V && /* @__PURE__ */ v("div", { className: "p-2 border-b border-base-300", children: /* @__PURE__ */ v(
|
|
723
724
|
"input",
|
|
724
725
|
{
|
|
725
726
|
ref: he,
|