jenosize-ui 0.1.0 → 0.2.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/README.md +13 -10
- package/dist/Cartesian-ZIKPEYWP.d.ts +26 -0
- package/dist/{PaymentInput-CKPIPNWH.d.ts → PaymentInput-Dn5WVQVy.d.ts} +4 -0
- package/dist/{Select-CVbEQ2Ep.d.ts → Select-Dt5ARIH8.d.ts} +4 -0
- package/dist/{TagInput-CTJYOB4J.d.ts → TagInput-BaBeve6L.d.ts} +4 -0
- package/dist/area-chart.d.ts +54 -0
- package/dist/area-chart.js +9 -0
- package/dist/avatar.d.ts +24 -0
- package/dist/avatar.js +13 -7
- package/dist/badge.d.ts +4 -0
- package/dist/badge.js +6 -5
- package/dist/bar-chart.d.ts +32 -0
- package/dist/bar-chart.js +9 -0
- package/dist/breadcrumb.d.ts +4 -0
- package/dist/breadcrumb.js +5 -3
- package/dist/button.d.ts +16 -1
- package/dist/button.js +10 -8
- package/dist/calendar.d.ts +5 -0
- package/dist/calendar.js +18 -14
- package/dist/callout.d.ts +6 -6
- package/dist/callout.js +12 -9
- package/dist/card-D56VxyAe.d.ts +123 -0
- package/dist/card.d.ts +3 -1
- package/dist/card.js +7 -3
- package/dist/checkbox.js +9 -7
- package/dist/chunk-22M75A3N.js +396 -0
- package/dist/{chunk-D5BTFSL7.js → chunk-33TOK7ES.js} +7 -5
- package/dist/{chunk-THC2ISYP.js → chunk-3H444OJA.js} +6 -4
- package/dist/{chunk-GFOAJVW5.js → chunk-3QXLIZIX.js} +4 -13
- package/dist/chunk-3ZEEGXYF.js +8 -0
- package/dist/chunk-45Y2ZGNK.js +34 -0
- package/dist/{chunk-FHHAPGCR.js → chunk-4RBIWI2Q.js} +3 -3
- package/dist/chunk-4VGEJG4M.js +1510 -0
- package/dist/{chunk-PWKWNDBS.js → chunk-54SIZR63.js} +16 -8
- package/dist/chunk-5AZKP4KZ.js +49 -0
- package/dist/chunk-5DP7W5HX.js +254 -0
- package/dist/{chunk-J2BCKBHC.js → chunk-5KSD4WKN.js} +14 -5
- package/dist/{chunk-ZOOX3TUB.js → chunk-5XPMY2LF.js} +6 -6
- package/dist/chunk-5ZEUTSCV.js +147 -0
- package/dist/chunk-5ZPUAGOP.js +19 -0
- package/dist/{chunk-JTNFJLIY.js → chunk-667ZHY3T.js} +114 -42
- package/dist/{chunk-JP26LPCY.js → chunk-6B6BWTXC.js} +30 -13
- package/dist/{chunk-W5GGOUUI.js → chunk-6H4LNWQ7.js} +3 -3
- package/dist/{chunk-WFY7DKQD.js → chunk-6MMBQVRO.js} +61 -51
- package/dist/{chunk-7HOIZ3UO.js → chunk-7GUPNTAH.js} +15 -7
- package/dist/chunk-7VLYQR4D.js +44 -0
- package/dist/{chunk-KNYKWUYX.js → chunk-7ZM7SNCZ.js} +3 -3
- package/dist/{chunk-E7ZSWBAK.js → chunk-A323V6AI.js} +6 -4
- package/dist/chunk-AFYXSZGW.js +23 -0
- package/dist/chunk-AIARANKE.js +33 -0
- package/dist/{chunk-4OLULPQG.js → chunk-AIGYMTCU.js} +10 -6
- package/dist/{chunk-JVJRHBTD.js → chunk-AZ7DKRBY.js} +21 -8
- package/dist/{chunk-JYGR44ZC.js → chunk-BBKE4W3B.js} +19 -11
- package/dist/{chunk-Z3ETJN5G.js → chunk-BFVJHH7S.js} +8 -12
- package/dist/chunk-BLIZ3CL3.js +49 -0
- package/dist/{chunk-F2K7VJUV.js → chunk-CFFWYXDW.js} +19 -7
- package/dist/{chunk-MQGD2OUF.js → chunk-CGHYXWTT.js} +11 -5
- package/dist/{chunk-CYPPEUX5.js → chunk-CKMWBVRR.js} +27 -12
- package/dist/{chunk-GTHJWR3Q.js → chunk-D7EE5GWU.js} +21 -22
- package/dist/{chunk-5NOBSXJN.js → chunk-E2YZ7IMT.js} +24 -8
- package/dist/{chunk-T7FCG7XV.js → chunk-FFMTYQXE.js} +31 -11
- package/dist/{chunk-J36M3KRX.js → chunk-FH7Z7SGQ.js} +67 -32
- package/dist/chunk-FKVPAEJ6.js +57 -0
- package/dist/{chunk-GRLSUQQE.js → chunk-FNQJJO63.js} +4 -4
- package/dist/{chunk-5RAPA22E.js → chunk-FWRHBMWT.js} +4 -4
- package/dist/chunk-GLKFFA7N.js +171 -0
- package/dist/{chunk-KDLPXXD2.js → chunk-GQRSABRN.js} +4 -4
- package/dist/{chunk-DRZCJCBO.js → chunk-GZMDZF2V.js} +8 -7
- package/dist/chunk-HHYEAFCL.js +525 -0
- package/dist/{chunk-LME57Z6J.js → chunk-I6WMNXC7.js} +6 -6
- package/dist/chunk-IQNVSQRK.js +605 -0
- package/dist/chunk-KHGW72BM.js +10 -0
- package/dist/{chunk-ZZA2LUTL.js → chunk-KZP6B6B3.js} +41 -16
- package/dist/chunk-LCG34A5T.js +98 -0
- package/dist/chunk-LLPWQDF7.js +26 -0
- package/dist/{chunk-J7ZQQFPT.js → chunk-LO22VQL5.js} +18 -18
- package/dist/{chunk-BVJWBYIG.js → chunk-LQURV7HQ.js} +9 -7
- package/dist/{chunk-R6RGJF4L.js → chunk-LYXPJERB.js} +15 -5
- package/dist/{chunk-CME4DIML.js → chunk-MCQG4H6T.js} +54 -3
- package/dist/{chunk-VWC72TR3.js → chunk-MVG5MABV.js} +11 -8
- package/dist/{chunk-5FATN5YD.js → chunk-N3RVMBPX.js} +6 -9
- package/dist/chunk-NKG4N6HA.js +188 -0
- package/dist/{chunk-W46K56XU.js → chunk-OACWA4TC.js} +15 -69
- package/dist/chunk-OLLD2BZN.js +33 -0
- package/dist/{chunk-KMSYEE23.js → chunk-P6CON2R2.js} +25 -11
- package/dist/chunk-PO2TYK3C.js +17 -0
- package/dist/{chunk-7EWQKTNQ.js → chunk-POQTE7JI.js} +66 -25
- package/dist/{chunk-HMUZE6EK.js → chunk-QDKETK7D.js} +4 -4
- package/dist/{chunk-GCVA3OIV.js → chunk-QDYE5LVT.js} +13 -3
- package/dist/{chunk-WEUJYDCV.js → chunk-QHH6AUR3.js} +16 -8
- package/dist/chunk-RJTVCA62.js +42 -0
- package/dist/{chunk-MUFHLP4S.js → chunk-S5TEWPWW.js} +50 -41
- package/dist/{chunk-D6TPWNRK.js → chunk-SB3DG572.js} +15 -8
- package/dist/chunk-SKRR3ZMP.js +10 -0
- package/dist/chunk-T4ZFZTY6.js +62 -0
- package/dist/{chunk-I7WU4GTY.js → chunk-T5574MXM.js} +34 -46
- package/dist/{chunk-MKC5HNA7.js → chunk-U4WSJAYK.js} +374 -147
- package/dist/{chunk-BJUZVYQC.js → chunk-UGKELBNC.js} +60 -44
- package/dist/chunk-ULGCGKOE.js +77 -0
- package/dist/{chunk-QA74ITR4.js → chunk-X2VMIBK5.js} +45 -17
- package/dist/chunk-X2X7Q7NW.js +17 -0
- package/dist/chunk-YHBI52P2.js +10 -0
- package/dist/chunk-YIHKQ63K.js +13 -0
- package/dist/{chunk-3Y5X7B5C.js → chunk-YQYVGWIC.js} +6 -11
- package/dist/{chunk-WZQFC7ZN.js → chunk-ZHAT2XZ4.js} +139 -66
- package/dist/{chunk-7IU5TMFL.js → chunk-ZMFY7WAY.js} +124 -40
- package/dist/{chunk-SV56BSUQ.js → chunk-ZZSNTCCL.js} +6 -5
- package/dist/combobox.d.ts +5 -0
- package/dist/combobox.js +15 -12
- package/dist/control-size-CaxQhkKh.d.ts +3 -0
- package/dist/date-input.d.ts +4 -0
- package/dist/date-input.js +12 -9
- package/dist/date-picker.d.ts +6 -0
- package/dist/date-picker.js +25 -20
- package/dist/dialog.d.ts +37 -5
- package/dist/dialog.js +12 -8
- package/dist/drawer.d.ts +20 -3
- package/dist/drawer.js +11 -7
- package/dist/dropdown-menu.d.ts +26 -2
- package/dist/dropdown-menu.js +9 -4
- package/dist/dropzone.d.ts +35 -0
- package/dist/dropzone.js +23 -0
- package/dist/form.d.ts +82 -3
- package/dist/form.js +205 -45
- package/dist/header-navigation.d.ts +19 -4
- package/dist/header-navigation.js +23 -16
- package/dist/helper.d.ts +36 -0
- package/dist/helper.js +3 -0
- package/dist/index.d.ts +32 -8
- package/dist/index.js +87 -62
- package/dist/indicator.js +4 -4
- package/dist/input.d.ts +4 -0
- package/dist/input.js +10 -8
- package/dist/kanban-board.d.ts +489 -0
- package/dist/kanban-board.js +25 -0
- package/dist/labels-DPrh0se9.d.ts +627 -0
- package/dist/line-chart.d.ts +36 -0
- package/dist/line-chart.js +9 -0
- package/dist/{nav-Bla0o_-1.d.ts → nav-CKKqjBs6.d.ts} +18 -11
- package/dist/number-input.d.ts +4 -0
- package/dist/number-input.js +10 -8
- package/dist/pagination.d.ts +7 -1
- package/dist/pagination.js +14 -10
- package/dist/panel-El4oI68p.d.ts +9 -0
- package/dist/payment-input.d.ts +3 -2
- package/dist/payment-input.js +10 -8
- package/dist/pie-chart.d.ts +64 -0
- package/dist/pie-chart.js +9 -0
- package/dist/popover.d.ts +9 -3
- package/dist/popover.js +11 -7
- package/dist/progress-steps.d.ts +275 -0
- package/dist/progress-steps.js +8 -0
- package/dist/progress.d.ts +21 -1
- package/dist/progress.js +3 -2
- package/dist/provider.d.ts +212 -0
- package/dist/provider.js +7 -0
- package/dist/radar-chart.d.ts +77 -0
- package/dist/radar-chart.js +9 -0
- package/dist/radial-chart.d.ts +73 -0
- package/dist/radial-chart.js +9 -0
- package/dist/radio.js +9 -7
- package/dist/rule-BqzaIwJy.d.ts +80 -0
- package/dist/scroll-area.d.ts +62 -0
- package/dist/scroll-area.js +7 -0
- package/dist/select.d.ts +3 -3
- package/dist/select.js +17 -14
- package/dist/separator.d.ts +114 -0
- package/dist/separator.js +5 -0
- package/dist/shared-CxAedkiy.d.ts +68 -0
- package/dist/sidebar-navigation.d.ts +80 -12
- package/dist/sidebar-navigation.js +18 -9
- package/dist/skeleton.d.ts +61 -0
- package/dist/skeleton.js +5 -0
- package/dist/styles.css +1 -1
- package/dist/switch.js +4 -4
- package/dist/table.d.ts +148 -42
- package/dist/table.js +39 -33
- package/dist/tabs.d.ts +22 -0
- package/dist/tabs.js +3 -3
- package/dist/tag-input.d.ts +3 -2
- package/dist/tag-input.js +13 -11
- package/dist/tag.d.ts +4 -0
- package/dist/tag.js +4 -3
- package/dist/textarea.js +7 -5
- package/dist/theme.css +151 -6
- package/dist/theme.js +11 -9
- package/dist/toast.d.ts +11 -2
- package/dist/toast.js +12 -9
- package/dist/tooltip-surface-C2I9o2QM.d.ts +35 -0
- package/dist/tooltip.d.ts +15 -1
- package/dist/tooltip.js +3 -2
- package/dist/tree.d.ts +5 -0
- package/dist/tree.js +8 -6
- package/dist/types-DR9rAEy1.d.ts +188 -0
- package/dist/use-uploads-KaPqDklo.d.ts +482 -0
- package/dist/verification-code-input.d.ts +84 -0
- package/dist/verification-code-input.js +14 -0
- package/package.json +70 -9
- package/dist/card-nWicloNi.d.ts +0 -80
- package/dist/chunk-24TO7E32.js +0 -42
- package/dist/chunk-FXIBGTS5.js +0 -14
- package/dist/chunk-MFJP5FA7.js +0 -20
- package/dist/chunk-ZZT2E5VT.js +0 -24
- package/dist/shared-BNXAdgh2.d.ts +0 -9
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { toUploadFile } from './chunk-HHYEAFCL.js';
|
|
2
|
+
import { warnPositiveInt, devWarn } from './chunk-QDYE5LVT.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
function reduceUpload(rows, id, event) {
|
|
6
|
+
const index = rows.findIndex((row2) => row2.id === id);
|
|
7
|
+
if (index === -1) return rows;
|
|
8
|
+
const row = rows[index];
|
|
9
|
+
const next = applyEvent(row, event);
|
|
10
|
+
if (next === row) return rows;
|
|
11
|
+
const copy = [...rows];
|
|
12
|
+
copy[index] = next;
|
|
13
|
+
return copy;
|
|
14
|
+
}
|
|
15
|
+
function applyEvent(row, event) {
|
|
16
|
+
switch (event.type) {
|
|
17
|
+
case "progress": {
|
|
18
|
+
const percent = Math.max(0, Math.min(100, Math.round(event.percent)));
|
|
19
|
+
if (row.progress === percent && row.status === "uploading") return row;
|
|
20
|
+
return row.status === "uploading" ? { ...row, progress: percent } : row;
|
|
21
|
+
}
|
|
22
|
+
case "complete": {
|
|
23
|
+
return { ...row, status: "complete", progress: 100, error: void 0 };
|
|
24
|
+
}
|
|
25
|
+
case "failed": {
|
|
26
|
+
return { ...row, status: "failed", error: event.error };
|
|
27
|
+
}
|
|
28
|
+
case "retry": {
|
|
29
|
+
return { ...row, status: "uploading", progress: 0, error: void 0 };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function splitBatchProgress(sizes, loaded) {
|
|
34
|
+
let head = Math.max(0, loaded);
|
|
35
|
+
return sizes.map((size) => {
|
|
36
|
+
const bytes = Math.max(0, size);
|
|
37
|
+
if (bytes === 0) return 100;
|
|
38
|
+
const done = Math.min(head, bytes);
|
|
39
|
+
head -= done;
|
|
40
|
+
return Math.round(done / bytes * 100);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function useUploads({ transport, batchSize = 1, concurrency = 3 }) {
|
|
44
|
+
const [files, setFiles] = React.useState([]);
|
|
45
|
+
const [results, setResults] = React.useState(() => /* @__PURE__ */ new Map());
|
|
46
|
+
const blobs = React.useRef(/* @__PURE__ */ new Map());
|
|
47
|
+
const controllers = React.useRef(/* @__PURE__ */ new Map());
|
|
48
|
+
const queue = React.useRef([]);
|
|
49
|
+
const running = React.useRef(0);
|
|
50
|
+
const latest = React.useRef({ transport, batchSize, concurrency });
|
|
51
|
+
latest.current = { transport, batchSize, concurrency };
|
|
52
|
+
warnPositiveInt("useUploads", "batchSize", batchSize);
|
|
53
|
+
warnPositiveInt("useUploads", "concurrency", concurrency);
|
|
54
|
+
const emit = React.useCallback((id, event) => {
|
|
55
|
+
setFiles((rows) => reduceUpload(rows, id, event));
|
|
56
|
+
}, []);
|
|
57
|
+
const pump = React.useCallback(() => {
|
|
58
|
+
while (running.current < Math.max(1, latest.current.concurrency) && queue.current.length > 0) {
|
|
59
|
+
const job = queue.current.shift();
|
|
60
|
+
const ids = job.ids.filter((id) => blobs.current.has(id));
|
|
61
|
+
if (ids.length === 0) continue;
|
|
62
|
+
running.current += 1;
|
|
63
|
+
void run(ids);
|
|
64
|
+
}
|
|
65
|
+
async function run(ids) {
|
|
66
|
+
const batch = ids.map((id) => blobs.current.get(id));
|
|
67
|
+
const controller = new AbortController();
|
|
68
|
+
for (const id of ids) controllers.current.set(id, controller);
|
|
69
|
+
const sizes = batch.map((file) => file.size);
|
|
70
|
+
const onProgress = (percent, fileIndex) => {
|
|
71
|
+
if (fileIndex !== void 0) {
|
|
72
|
+
const id = ids[fileIndex];
|
|
73
|
+
if (id) emit(id, { type: "progress", percent });
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (ids.length === 1) {
|
|
77
|
+
emit(ids[0], { type: "progress", percent });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const total = sizes.reduce((sum, size) => sum + size, 0);
|
|
81
|
+
const split = splitBatchProgress(sizes, Math.max(0, Math.min(100, percent)) / 100 * total);
|
|
82
|
+
for (const [i, id] of ids.entries()) emit(id, { type: "progress", percent: split[i] ?? 0 });
|
|
83
|
+
};
|
|
84
|
+
try {
|
|
85
|
+
const settled = await latest.current.transport(batch, { signal: controller.signal, onProgress });
|
|
86
|
+
if (controller.signal.aborted) return;
|
|
87
|
+
setResults((prev) => {
|
|
88
|
+
const next = new Map(prev);
|
|
89
|
+
for (const [i, id] of ids.entries()) {
|
|
90
|
+
const value = settled[i];
|
|
91
|
+
if (value !== void 0) next.set(id, value);
|
|
92
|
+
}
|
|
93
|
+
return next;
|
|
94
|
+
});
|
|
95
|
+
for (const id of ids) emit(id, { type: "complete" });
|
|
96
|
+
} catch (error) {
|
|
97
|
+
if (controller.signal.aborted || error?.name === "AbortError") return;
|
|
98
|
+
const message = error instanceof Error && error.message ? error.message : "Upload failed.";
|
|
99
|
+
for (const id of ids) emit(id, { type: "failed", error: message });
|
|
100
|
+
} finally {
|
|
101
|
+
for (const id of ids) {
|
|
102
|
+
if (controllers.current.get(id) === controller) controllers.current.delete(id);
|
|
103
|
+
}
|
|
104
|
+
running.current -= 1;
|
|
105
|
+
pump();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, [emit]);
|
|
109
|
+
const enqueue = React.useCallback(
|
|
110
|
+
(ids) => {
|
|
111
|
+
const size = Math.max(1, Math.floor(latest.current.batchSize));
|
|
112
|
+
for (let i = 0; i < ids.length; i += size) queue.current.push({ ids: ids.slice(i, i + size) });
|
|
113
|
+
pump();
|
|
114
|
+
},
|
|
115
|
+
[pump]
|
|
116
|
+
);
|
|
117
|
+
const add = React.useCallback(
|
|
118
|
+
(picked) => {
|
|
119
|
+
if (picked.length === 0) return;
|
|
120
|
+
const rows = picked.map(toUploadFile);
|
|
121
|
+
for (const [i, row] of rows.entries()) blobs.current.set(row.id, picked[i]);
|
|
122
|
+
setFiles((prev) => [...prev, ...rows]);
|
|
123
|
+
enqueue(rows.map((row) => row.id));
|
|
124
|
+
},
|
|
125
|
+
[enqueue]
|
|
126
|
+
);
|
|
127
|
+
const drop = React.useCallback((id) => {
|
|
128
|
+
controllers.current.get(id)?.abort();
|
|
129
|
+
controllers.current.delete(id);
|
|
130
|
+
blobs.current.delete(id);
|
|
131
|
+
setFiles((rows) => rows.filter((row) => row.id !== id));
|
|
132
|
+
setResults((prev) => {
|
|
133
|
+
if (!prev.has(id)) return prev;
|
|
134
|
+
const next = new Map(prev);
|
|
135
|
+
next.delete(id);
|
|
136
|
+
return next;
|
|
137
|
+
});
|
|
138
|
+
}, []);
|
|
139
|
+
const retry = React.useCallback(
|
|
140
|
+
(id) => {
|
|
141
|
+
if (!blobs.current.has(id)) {
|
|
142
|
+
devWarn(`useUploads cannot retry "${id}" \u2014 its File is gone. A row restored from an API has no blob to resend.`);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
emit(id, { type: "retry" });
|
|
146
|
+
queue.current.push({ ids: [id] });
|
|
147
|
+
pump();
|
|
148
|
+
},
|
|
149
|
+
[emit, pump]
|
|
150
|
+
);
|
|
151
|
+
const clear = React.useCallback(() => {
|
|
152
|
+
queue.current = [];
|
|
153
|
+
new Set(controllers.current.values()).forEach((controller) => controller.abort());
|
|
154
|
+
controllers.current.clear();
|
|
155
|
+
blobs.current.clear();
|
|
156
|
+
setFiles([]);
|
|
157
|
+
setResults(/* @__PURE__ */ new Map());
|
|
158
|
+
}, []);
|
|
159
|
+
React.useEffect(
|
|
160
|
+
() => () => {
|
|
161
|
+
new Set(controllers.current.values()).forEach((controller) => controller.abort());
|
|
162
|
+
},
|
|
163
|
+
[]
|
|
164
|
+
);
|
|
165
|
+
const listProps = React.useMemo(
|
|
166
|
+
() => ({
|
|
167
|
+
files,
|
|
168
|
+
// Withheld above 1: one request cannot cancel one of its files, and `<FileList>` renders no
|
|
169
|
+
// affordance at all for an absent callback — never a disabled ghost.
|
|
170
|
+
onCancel: batchSize > 1 ? void 0 : (file) => drop(file.id),
|
|
171
|
+
onRemove: (file) => drop(file.id),
|
|
172
|
+
onRetry: (file) => retry(file.id)
|
|
173
|
+
}),
|
|
174
|
+
[files, batchSize, drop, retry]
|
|
175
|
+
);
|
|
176
|
+
return {
|
|
177
|
+
files,
|
|
178
|
+
listProps,
|
|
179
|
+
add,
|
|
180
|
+
clear,
|
|
181
|
+
activeCount: files.reduce((count, row) => count + (row.status === "uploading" ? 1 : 0), 0),
|
|
182
|
+
results
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export { reduceUpload, splitBatchProgress, useUploads };
|
|
187
|
+
//# sourceMappingURL=chunk-NKG4N6HA.js.map
|
|
188
|
+
//# sourceMappingURL=chunk-NKG4N6HA.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SOLID, SOLID_HOVER } from './chunk-
|
|
1
|
+
import { FG_HOVER, WASH_HOVER, BOXED_BOX, BOX_RING, SOLID, SOLID_HOVER, SOLID_BOX, SOLID_GLOSS } from './chunk-MCQG4H6T.js';
|
|
2
2
|
import { overflowClasses } from './chunk-DWKILXHE.js';
|
|
3
|
-
import { useSeamlessSlot, SEAMLESS_CONTROL, SEAMLESS_INHERIT_FG, SEAMLESS_FILL_COUPLED_FG } from './chunk-
|
|
3
|
+
import { useSeamlessSlot, SEAMLESS_CONTROL, SEAMLESS_INHERIT_FG, SEAMLESS_FILL_COUPLED_FG } from './chunk-7ZM7SNCZ.js';
|
|
4
4
|
import { Slot } from './chunk-52IFGFTL.js';
|
|
5
|
-
import { LoaderCircleIcon } from './chunk-
|
|
6
|
-
import { warnNeedsName } from './chunk-GCVA3OIV.js';
|
|
5
|
+
import { LoaderCircleIcon } from './chunk-BLIZ3CL3.js';
|
|
7
6
|
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
7
|
+
import { warnNeedsName } from './chunk-QDYE5LVT.js';
|
|
8
8
|
import { mergeProps } from '@base-ui/react/merge-props';
|
|
9
9
|
import { useRender } from '@base-ui/react/use-render';
|
|
10
10
|
import 'react';
|
|
@@ -13,49 +13,10 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
13
13
|
var BASE_CORE = "relative inline-flex items-center justify-center font-semibold cursor-pointer transition duration-100 ease-linear [&_svg]:shrink-0 [&_svg]:transition-colors [&_svg]:duration-100 [&_svg]:ease-linear";
|
|
14
14
|
var FOCUS_OUTSET = "outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2";
|
|
15
15
|
var FOCUS_INSET = "outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2";
|
|
16
|
-
var GLOSS = "before:pointer-events-none before:absolute before:inset-px before:rounded-[7px] before:border before:border-white/12 before:[mask-image:linear-gradient(to_bottom,black,transparent)]";
|
|
17
|
-
var ICON_SOLID = "[&_svg]:text-fg-white/60 hover:[&_svg]:text-fg-white/70";
|
|
18
|
-
var BOX_ICON = {
|
|
19
|
-
neutral: "[&_svg]:text-fg-quaternary hover:[&_svg]:text-fg-quaternary_hover",
|
|
20
|
-
brand: "[&_svg]:text-fg-brand-secondary hover:[&_svg]:text-fg-brand-secondary_hover",
|
|
21
|
-
success: "[&_svg]:text-utility-green-500 hover:[&_svg]:text-utility-green-700",
|
|
22
|
-
warning: "[&_svg]:text-utility-amber-500 hover:[&_svg]:text-utility-amber-700",
|
|
23
|
-
error: "[&_svg]:text-fg-error-secondary hover:[&_svg]:text-error-primary",
|
|
24
|
-
info: "[&_svg]:text-utility-blue-500 hover:[&_svg]:text-utility-blue-700"
|
|
25
|
-
};
|
|
26
|
-
var BOX_RING = {
|
|
27
|
-
neutral: "ring-primary",
|
|
28
|
-
brand: "ring-brand",
|
|
29
|
-
success: "ring-success",
|
|
30
|
-
warning: "ring-warning",
|
|
31
|
-
error: "ring-error_subtle",
|
|
32
|
-
info: "ring-utility-blue-200"
|
|
33
|
-
};
|
|
34
16
|
var FOCUS_TONE = { error: "outline-focus-ring-error" };
|
|
35
|
-
var SECONDARY_TEXT = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
success: "text-success-primary hover:text-utility-green-700",
|
|
39
|
-
warning: "text-warning-primary hover:text-utility-amber-700",
|
|
40
|
-
error: "text-error-primary hover:text-utility-red-700",
|
|
41
|
-
info: "text-utility-blue-600 hover:text-utility-blue-700"
|
|
42
|
-
};
|
|
43
|
-
var GHOST_TEXT = {
|
|
44
|
-
neutral: "text-tertiary hover:text-secondary",
|
|
45
|
-
brand: "text-brand-secondary hover:text-brand-secondary_hover",
|
|
46
|
-
success: "text-success-primary hover:text-utility-green-700",
|
|
47
|
-
warning: "text-warning-primary hover:text-utility-amber-700",
|
|
48
|
-
error: "text-error-primary hover:text-utility-red-700",
|
|
49
|
-
info: "text-utility-blue-600 hover:text-utility-blue-700"
|
|
50
|
-
};
|
|
51
|
-
var SOFT_WASH = {
|
|
52
|
-
neutral: "hover:bg-secondary data-[loading]:bg-secondary",
|
|
53
|
-
brand: "hover:bg-brand-primary data-[loading]:bg-brand-primary",
|
|
54
|
-
success: "hover:bg-success-primary data-[loading]:bg-success-primary",
|
|
55
|
-
warning: "hover:bg-warning-primary data-[loading]:bg-warning-primary",
|
|
56
|
-
error: "hover:bg-error-primary data-[loading]:bg-error-primary",
|
|
57
|
-
info: "hover:bg-utility-blue-50 data-[loading]:bg-utility-blue-50"
|
|
58
|
-
};
|
|
17
|
+
var SECONDARY_TEXT = { ...FG_HOVER, neutral: "text-secondary hover:text-secondary_hover" };
|
|
18
|
+
var GHOST_TEXT = FG_HOVER;
|
|
19
|
+
var SOFT_WASH = WASH_HOVER;
|
|
59
20
|
var LINK_BASE = "group justify-normal rounded-sm";
|
|
60
21
|
var DEFAULT_COLOR = {
|
|
61
22
|
primary: "brand",
|
|
@@ -66,35 +27,20 @@ var DEFAULT_COLOR = {
|
|
|
66
27
|
function variantClasses(variant, color) {
|
|
67
28
|
switch (variant) {
|
|
68
29
|
case "primary": {
|
|
69
|
-
return cn(SOLID[color], SOLID_HOVER[color],
|
|
30
|
+
return cn(SOLID[color], SOLID_HOVER[color], SOLID_BOX, FOCUS_TONE[color], SOLID_GLOSS);
|
|
70
31
|
}
|
|
71
32
|
case "secondary": {
|
|
72
|
-
return cn(
|
|
73
|
-
"bg-primary shadow-skeuomorphic ring-1 ring-inset",
|
|
74
|
-
BOX_RING[color],
|
|
75
|
-
SECONDARY_TEXT[color],
|
|
76
|
-
SOFT_WASH[color],
|
|
77
|
-
FOCUS_TONE[color],
|
|
78
|
-
BOX_ICON[color]
|
|
79
|
-
);
|
|
33
|
+
return cn(BOXED_BOX, BOX_RING[color], SECONDARY_TEXT[color], SOFT_WASH[color], FOCUS_TONE[color]);
|
|
80
34
|
}
|
|
81
35
|
case "tertiary": {
|
|
82
|
-
return cn(GHOST_TEXT[color], SOFT_WASH[color], FOCUS_TONE[color]
|
|
36
|
+
return cn(GHOST_TEXT[color], SOFT_WASH[color], FOCUS_TONE[color]);
|
|
83
37
|
}
|
|
84
38
|
case "link": {
|
|
85
|
-
return cn(LINK_BASE, GHOST_TEXT[color], FOCUS_TONE[color]
|
|
39
|
+
return cn(LINK_BASE, GHOST_TEXT[color], FOCUS_TONE[color]);
|
|
86
40
|
}
|
|
87
41
|
}
|
|
88
42
|
}
|
|
89
|
-
var
|
|
90
|
-
var LINK_LABEL = {
|
|
91
|
-
neutral: cn(LINK_LABEL_BASE, "group-hover:decoration-fg-quaternary"),
|
|
92
|
-
brand: cn(LINK_LABEL_BASE, "group-hover:decoration-fg-brand-secondary"),
|
|
93
|
-
success: cn(LINK_LABEL_BASE, "underline-offset-2 group-hover:decoration-current"),
|
|
94
|
-
warning: cn(LINK_LABEL_BASE, "underline-offset-2 group-hover:decoration-current"),
|
|
95
|
-
error: cn(LINK_LABEL_BASE, "underline-offset-2 group-hover:decoration-current"),
|
|
96
|
-
info: cn(LINK_LABEL_BASE, "underline-offset-2 group-hover:decoration-current")
|
|
97
|
-
};
|
|
43
|
+
var LINK_LABEL = cn("underline decoration-transparent transition-colors duration-100 ease-linear", "underline-offset-2 group-hover:decoration-current");
|
|
98
44
|
var XS_ICON = "[&>svg]:size-4 [&>svg]:[stroke-width:2.25px]";
|
|
99
45
|
var SLOT_ICON = {
|
|
100
46
|
xs: "[&>svg]:size-4 [&>svg]:[stroke-width:2.25px]",
|
|
@@ -185,7 +131,7 @@ function Button(props) {
|
|
|
185
131
|
fullWidth && "w-full",
|
|
186
132
|
className
|
|
187
133
|
);
|
|
188
|
-
const label = iconOnly ? /* @__PURE__ */ jsx("span", { className: "sr-only", children }) : isLinkType ? /* @__PURE__ */ jsx("span", { className: cn(LINK_LABEL
|
|
134
|
+
const label = iconOnly ? /* @__PURE__ */ jsx("span", { className: "sr-only", children }) : isLinkType ? /* @__PURE__ */ jsx("span", { className: cn(LINK_LABEL, ovf.label, hideContent && "invisible"), children }) : /* @__PURE__ */ jsx("span", { className: cn(!noTextPadding && "px-0.5", ovf.label, hideContent && "invisible"), children });
|
|
189
135
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
190
136
|
inlineSpinner ? /* @__PURE__ */ jsx(Glyph, { children: /* @__PURE__ */ jsx(LoaderCircleIcon, { className: cn(SPINNER_SIZE[effSize], "animate-spin") }) }) : leading ? /* @__PURE__ */ jsx(Slot, { className: cn(SLOT_ICON[effSize], hideContent && "invisible"), children: leading }) : null,
|
|
191
137
|
hideContent ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: cn(SPINNER_SIZE[effSize], "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin") }) : null,
|
|
@@ -212,5 +158,5 @@ function Button(props) {
|
|
|
212
158
|
}
|
|
213
159
|
|
|
214
160
|
export { Button };
|
|
215
|
-
//# sourceMappingURL=chunk-
|
|
216
|
-
//# sourceMappingURL=chunk-
|
|
161
|
+
//# sourceMappingURL=chunk-OACWA4TC.js.map
|
|
162
|
+
//# sourceMappingURL=chunk-OACWA4TC.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { seriesColor, useSeriesColors, paletteLength } from './chunk-22M75A3N.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
function usePolarData(component, data, palette) {
|
|
5
|
+
const resolve = React.useCallback((i) => seriesColor(data[i]?.color, i, palette), [data, palette]);
|
|
6
|
+
const colors = useSeriesColors(component, data.length, resolve, paletteLength(palette));
|
|
7
|
+
return React.useMemo(() => {
|
|
8
|
+
const rows = [];
|
|
9
|
+
const legendItems = [];
|
|
10
|
+
const colorMap = {};
|
|
11
|
+
const labelMap = {};
|
|
12
|
+
for (const [i, datum] of data.entries()) {
|
|
13
|
+
const color = colors[i] ?? "";
|
|
14
|
+
rows.push({ name: datum.label, value: datum.value, style: { color } });
|
|
15
|
+
legendItems.push({ label: datum.label, color });
|
|
16
|
+
colorMap[datum.label] = color;
|
|
17
|
+
labelMap[datum.label] = datum.label;
|
|
18
|
+
}
|
|
19
|
+
return { rows, legendItems, colorMap, labelMap };
|
|
20
|
+
}, [data, colors]);
|
|
21
|
+
}
|
|
22
|
+
function resolveMax(max, values) {
|
|
23
|
+
if (max !== "auto") return max;
|
|
24
|
+
let largest = 0;
|
|
25
|
+
for (const v of values) {
|
|
26
|
+
if (Number.isFinite(v) && v > largest) largest = v;
|
|
27
|
+
}
|
|
28
|
+
return largest > 0 ? largest : 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { resolveMax, usePolarData };
|
|
32
|
+
//# sourceMappingURL=chunk-OLLD2BZN.js.map
|
|
33
|
+
//# sourceMappingURL=chunk-OLLD2BZN.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nearestScrollport, scrollportScrolls } from './chunk-
|
|
1
|
+
import { nearestScrollport, scrollportScrolls, nearestScrollableOn } from './chunk-QDYE5LVT.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
function snapToStep(value, step) {
|
|
@@ -191,9 +191,14 @@ function useAutoScroll(ref, opts) {
|
|
|
191
191
|
const arm = React.useCallback(() => {
|
|
192
192
|
const s = state.current;
|
|
193
193
|
if (s.frame !== null) return;
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
const axis = optsRef.current?.axis ?? "y";
|
|
195
|
+
let boxY = null;
|
|
196
|
+
if (axis === "y" || axis === "both") {
|
|
197
|
+
const port = nearestScrollport(ref.current);
|
|
198
|
+
if (port !== null && scrollportScrolls(port)) boxY = port.el;
|
|
199
|
+
}
|
|
200
|
+
const boxX = axis === "x" || axis === "both" ? nearestScrollableOn(ref.current, "x") : null;
|
|
201
|
+
if (boxY === null && boxX === null) return;
|
|
197
202
|
const onPointer = (ev) => {
|
|
198
203
|
const pt = pointOf(ev);
|
|
199
204
|
if (pt) s.pointer = pt;
|
|
@@ -205,13 +210,22 @@ function useAutoScroll(ref, opts) {
|
|
|
205
210
|
s.frame = requestAnimationFrame(tick);
|
|
206
211
|
const pt = s.pointer;
|
|
207
212
|
if (!pt) return;
|
|
208
|
-
const rect = box.getBoundingClientRect();
|
|
209
213
|
const edge = optsRef.current?.edge ?? 48;
|
|
210
214
|
const maxPx = optsRef.current?.maxPx ?? 14;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
+
if (boxY !== null) {
|
|
216
|
+
const rect = boxY.getBoundingClientRect();
|
|
217
|
+
const overTop = rect.top + edge - pt.y;
|
|
218
|
+
const overBottom = pt.y - (rect.bottom - edge);
|
|
219
|
+
if (overTop > 0) boxY.scrollTop -= maxPx * Math.min(1, overTop / edge);
|
|
220
|
+
else if (overBottom > 0) boxY.scrollTop += maxPx * Math.min(1, overBottom / edge);
|
|
221
|
+
}
|
|
222
|
+
if (boxX !== null) {
|
|
223
|
+
const rect = boxX.getBoundingClientRect();
|
|
224
|
+
const overLeft = rect.left + edge - pt.x;
|
|
225
|
+
const overRight = pt.x - (rect.right - edge);
|
|
226
|
+
if (overLeft > 0) boxX.scrollLeft -= maxPx * Math.min(1, overLeft / edge);
|
|
227
|
+
else if (overRight > 0) boxX.scrollLeft += maxPx * Math.min(1, overRight / edge);
|
|
228
|
+
}
|
|
215
229
|
};
|
|
216
230
|
s.frame = requestAnimationFrame(tick);
|
|
217
231
|
}, [ref]);
|
|
@@ -220,5 +234,5 @@ function useAutoScroll(ref, opts) {
|
|
|
220
234
|
}
|
|
221
235
|
|
|
222
236
|
export { snapToStep, useAutoScroll, useDrag };
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
224
|
-
//# sourceMappingURL=chunk-
|
|
237
|
+
//# sourceMappingURL=chunk-P6CON2R2.js.map
|
|
238
|
+
//# sourceMappingURL=chunk-P6CON2R2.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ScrollView } from './chunk-FKVPAEJ6.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function PopupScrollViewport({ axis = "vertical", max, className, children }) {
|
|
6
|
+
const capKey = axis === "vertical" ? "maxHeight" : "maxWidth";
|
|
7
|
+
return (
|
|
8
|
+
// `composite` unconditionally: every caller of this wraps a `role="menu"` or `role="listbox"`
|
|
9
|
+
// row list, and those roles both own their own keyboard model and constrain what their children
|
|
10
|
+
// may be. A focusable wrapper there is a second tab stop AND an axe violation.
|
|
11
|
+
/* @__PURE__ */ jsx(ScrollView, { composite: true, axis, viewportClassName: className, viewportStyle: { [capKey]: max }, children })
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { PopupScrollViewport };
|
|
16
|
+
//# sourceMappingURL=chunk-PO2TYK3C.js.map
|
|
17
|
+
//# sourceMappingURL=chunk-PO2TYK3C.js.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DRAG_GHOST, DROP_LINE, DROP_LINE_Y, dragGhostProps, ghostPosition } from './chunk-5ZPUAGOP.js';
|
|
2
|
+
import { useAutoScroll, useDrag } from './chunk-P6CON2R2.js';
|
|
3
|
+
import { Skeleton } from './chunk-LLPWQDF7.js';
|
|
3
4
|
import { useDebounced } from './chunk-F6NLE6XJ.js';
|
|
4
|
-
import { Slot } from './chunk-52IFGFTL.js';
|
|
5
5
|
import { useIsomorphicLayoutEffect } from './chunk-EDSK6FEH.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Slot } from './chunk-52IFGFTL.js';
|
|
7
|
+
import { LoaderCircleIcon, CircleAlertIcon, ChevronRightIcon, GripVerticalIcon, CheckIcon, MinusIcon } from './chunk-BLIZ3CL3.js';
|
|
8
8
|
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
9
|
+
import { useLabels } from './chunk-RJTVCA62.js';
|
|
10
|
+
import { devWarn, warnNonNegativeInt, warnNeedsName } from './chunk-QDYE5LVT.js';
|
|
9
11
|
import * as React from 'react';
|
|
10
12
|
import { mergeProps } from '@base-ui/react/merge-props';
|
|
11
13
|
import { useRender } from '@base-ui/react/use-render';
|
|
@@ -773,6 +775,28 @@ function treeKeydown(event, ctx) {
|
|
|
773
775
|
}
|
|
774
776
|
}
|
|
775
777
|
}
|
|
778
|
+
|
|
779
|
+
// src/components/tree/labels.ts
|
|
780
|
+
var TREE_LABELS = {
|
|
781
|
+
/** The default behind the `emptyMessage` prop. */
|
|
782
|
+
emptyMessage: "Nothing here",
|
|
783
|
+
/** The OTHER empty state: "nothing matched" and "there is nothing here" are different sentences. */
|
|
784
|
+
noMatches: (ctx) => `No matches for \u201C${ctx.query}\u201D`,
|
|
785
|
+
/** A branch whose lazy children failed to load, and the button beside it. */
|
|
786
|
+
loadError: "Couldn\u2019t load",
|
|
787
|
+
retry: "Retry",
|
|
788
|
+
/** The name a moved node falls back to when its label is a node, not a string. */
|
|
789
|
+
itemFallback: "Item",
|
|
790
|
+
/**
|
|
791
|
+
* The reorder live region.
|
|
792
|
+
*
|
|
793
|
+
* The ctx carries the raw `position` union, not an English preposition — a translation should not
|
|
794
|
+
* have to parse `"into"`, so the position → verb mapping is this default's job.
|
|
795
|
+
*/
|
|
796
|
+
moved: (ctx) => `${ctx.name} moved ${ctx.position === "child" ? "into" : ctx.position} ${ctx.target}`,
|
|
797
|
+
/** The same move with no named target. */
|
|
798
|
+
movedRoot: (ctx) => `${ctx.name} moved`
|
|
799
|
+
};
|
|
776
800
|
var TREE_INDENT = 20;
|
|
777
801
|
var HALF_GLYPH = { md: 8, lg: 10 };
|
|
778
802
|
var ROW_PX = { md: 6, lg: 8 };
|
|
@@ -849,8 +873,9 @@ var EMPTY_ROW = {
|
|
|
849
873
|
lg: `relative px-2 py-1.5 text-sm text-fg-quaternary ${GAP_ROW}`
|
|
850
874
|
};
|
|
851
875
|
var DRAG_SOURCE = "opacity-50";
|
|
852
|
-
var DRAG_PREVIEW = "
|
|
853
|
-
var
|
|
876
|
+
var DRAG_PREVIEW = cn(DRAG_GHOST, "max-w-64 truncate px-2 py-1 text-sm text-primary");
|
|
877
|
+
var PREVIEW_MAX_PX = 256;
|
|
878
|
+
var DROP_RULE = cn(DROP_LINE, DROP_LINE_Y, "absolute right-0");
|
|
854
879
|
var DROP_INTO = "ring-2 ring-focus-ring ring-inset";
|
|
855
880
|
var GRIP = "shrink-0 cursor-grab text-quaternary active:cursor-grabbing";
|
|
856
881
|
var ROW_GRAB = "cursor-grab active:cursor-grabbing";
|
|
@@ -928,8 +953,8 @@ function TreeRow({
|
|
|
928
953
|
children: [
|
|
929
954
|
guide === "line" ? /* @__PURE__ */ jsx(GuideRules, { size, depth, lastChain }) : null,
|
|
930
955
|
guide === "line" && groupVisible ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", "data-tree-stub": "", className: GUIDE_STUB, style: { left: AXIS[size] + depth * TREE_INDENT, top: STUB_TOP[size] } }) : null,
|
|
931
|
-
dropPosition === "before" ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(
|
|
932
|
-
dropPosition === "after" ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(
|
|
956
|
+
dropPosition === "before" ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(DROP_RULE, GAP_LINE.before), style: { left: contentLeft(size, depth) } }) : null,
|
|
957
|
+
dropPosition === "after" ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(DROP_RULE, GAP_LINE.after), style: { left: contentLeft(size, depth) } }) : null,
|
|
933
958
|
branch ? /* @__PURE__ */ jsx(
|
|
934
959
|
"span",
|
|
935
960
|
{
|
|
@@ -974,7 +999,7 @@ function TreeItem({
|
|
|
974
999
|
reserve,
|
|
975
1000
|
lastChain
|
|
976
1001
|
}) {
|
|
977
|
-
const { tree, size, guide, emptyMessage } = ctx;
|
|
1002
|
+
const { tree, size, guide, emptyMessage, t } = ctx;
|
|
978
1003
|
const rowId = React.useId();
|
|
979
1004
|
const branch = isBranch(node);
|
|
980
1005
|
const children = node.children;
|
|
@@ -1008,8 +1033,8 @@ function TreeItem({
|
|
|
1008
1033
|
`aria-hidden` — `aria-busy` on the treeitem is what announces the state. */
|
|
1009
1034
|
/* @__PURE__ */ jsxs("li", { role: "none", className: cn("flex flex-col gap-1.5", EMPTY_ROW[size]), style: groupRowStyle, children: [
|
|
1010
1035
|
groupRules,
|
|
1011
|
-
/* @__PURE__ */ jsx(
|
|
1012
|
-
/* @__PURE__ */ jsx(
|
|
1036
|
+
/* @__PURE__ */ jsx(Skeleton, { className: cn(SKELETON_ROW[size], "w-3/5") }),
|
|
1037
|
+
/* @__PURE__ */ jsx(Skeleton, { className: cn(SKELETON_ROW[size], "w-4/5") })
|
|
1013
1038
|
] })
|
|
1014
1039
|
) : (
|
|
1015
1040
|
/* The ONE genuinely focusable control inside a tree, and it needs the care: a `<button>`
|
|
@@ -1018,8 +1043,8 @@ function TreeItem({
|
|
|
1018
1043
|
interactive content in a tree, and it is NOT in `tree.visible`, so ↑↓ skip it. */
|
|
1019
1044
|
/* @__PURE__ */ jsxs("li", { role: "none", className: cn("flex items-center gap-2", EMPTY_ROW[size]), style: groupRowStyle, children: [
|
|
1020
1045
|
groupRules,
|
|
1021
|
-
/* @__PURE__ */ jsx("span", { className: "text-error-primary", children:
|
|
1022
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => tree.retryLoad(node.id), className: RETRY_BUTTON, children:
|
|
1046
|
+
/* @__PURE__ */ jsx("span", { className: "text-error-primary", children: t.loadError }),
|
|
1047
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => tree.retryLoad(node.id), className: RETRY_BUTTON, children: t.retry })
|
|
1023
1048
|
] })
|
|
1024
1049
|
) }) }) : null,
|
|
1025
1050
|
branch && children != null ? /* @__PURE__ */ jsx(
|
|
@@ -1060,7 +1085,9 @@ function TreeRows({
|
|
|
1060
1085
|
)) });
|
|
1061
1086
|
}
|
|
1062
1087
|
function Tree(props) {
|
|
1063
|
-
const { tree, size = "md", guide = "line", emptyMessage
|
|
1088
|
+
const { tree, size = "md", guide = "line", emptyMessage, labels, render, className, ...rest } = props;
|
|
1089
|
+
const t = useLabels("tree", TREE_LABELS, labels);
|
|
1090
|
+
const resolvedEmptyMessage = emptyMessage ?? t.emptyMessage;
|
|
1064
1091
|
warnNeedsName("Tree", rest["aria-label"] != null || rest["aria-labelledby"] != null, "`aria-label` or `aria-labelledby`");
|
|
1065
1092
|
const rootRef = React.useRef(null);
|
|
1066
1093
|
const [focusedId, setFocusedId] = React.useState(null);
|
|
@@ -1112,13 +1139,13 @@ function Tree(props) {
|
|
|
1112
1139
|
(committed) => {
|
|
1113
1140
|
const moved = tree.nodeById(committed.id);
|
|
1114
1141
|
const target = tree.nodeById(committed.target);
|
|
1115
|
-
const name = typeof moved?.label === "string" ? moved.label :
|
|
1142
|
+
const name = typeof moved?.label === "string" ? moved.label : t.itemFallback;
|
|
1116
1143
|
const into = typeof target?.label === "string" ? target.label : "";
|
|
1117
|
-
const verb = committed.position === "child" ? "into" : committed.position;
|
|
1118
1144
|
clearTimeout(announceTimer.current ?? void 0);
|
|
1119
|
-
|
|
1145
|
+
const sentence = into ? t.moved({ name, position: committed.position, target: into }) : t.movedRoot({ name });
|
|
1146
|
+
announceTimer.current = setTimeout(() => setAnnouncement(sentence), ANNOUNCE_DEBOUNCE_MS);
|
|
1120
1147
|
},
|
|
1121
|
-
[tree]
|
|
1148
|
+
[tree, t]
|
|
1122
1149
|
);
|
|
1123
1150
|
const onRowClick = React.useCallback(
|
|
1124
1151
|
(id, event) => {
|
|
@@ -1299,8 +1326,22 @@ function Tree(props) {
|
|
|
1299
1326
|
[announce, moveFocus, resolvedFocus, tree]
|
|
1300
1327
|
);
|
|
1301
1328
|
const ctx = React.useMemo(
|
|
1302
|
-
() => ({
|
|
1303
|
-
|
|
1329
|
+
() => ({
|
|
1330
|
+
tree,
|
|
1331
|
+
size,
|
|
1332
|
+
guide,
|
|
1333
|
+
emptyMessage: resolvedEmptyMessage,
|
|
1334
|
+
t,
|
|
1335
|
+
focusedId: resolvedFocus,
|
|
1336
|
+
onRowFocus,
|
|
1337
|
+
showMarkers,
|
|
1338
|
+
keptIds,
|
|
1339
|
+
onRowClick,
|
|
1340
|
+
onRowDoubleClick,
|
|
1341
|
+
drag,
|
|
1342
|
+
dragHandlers
|
|
1343
|
+
}),
|
|
1344
|
+
[tree, size, guide, resolvedEmptyMessage, t, resolvedFocus, onRowFocus, showMarkers, keptIds, onRowClick, onRowDoubleClick, drag, dragHandlers]
|
|
1304
1345
|
);
|
|
1305
1346
|
const empty = tree.visible.length === 0;
|
|
1306
1347
|
const element = useRender({
|
|
@@ -1318,7 +1359,7 @@ function Tree(props) {
|
|
|
1318
1359
|
onKeyDown: handleKeyDown,
|
|
1319
1360
|
onBlur: handleBlur,
|
|
1320
1361
|
className: cn("", className),
|
|
1321
|
-
children: empty ? /* @__PURE__ */ jsx("li", { role: "none", className: EMPTY_ROW[size], children: tree.isFiltering ?
|
|
1362
|
+
children: empty ? /* @__PURE__ */ jsx("li", { role: "none", className: EMPTY_ROW[size], children: tree.isFiltering ? t.noMatches({ query: tree.query }) : resolvedEmptyMessage }) : /* @__PURE__ */ jsx(TreeRows, { nodes: tree.nodes, depth: 0, ctx, parentChain: [] })
|
|
1322
1363
|
},
|
|
1323
1364
|
rest
|
|
1324
1365
|
)
|
|
@@ -1326,11 +1367,11 @@ function Tree(props) {
|
|
|
1326
1367
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1327
1368
|
element,
|
|
1328
1369
|
/* @__PURE__ */ jsx("div", { role: "status", className: "sr-only", children: announcement }),
|
|
1329
|
-
drag !== null ? /* @__PURE__ */ jsx("div", {
|
|
1370
|
+
drag !== null ? /* @__PURE__ */ jsx("div", { ...dragGhostProps, className: DRAG_PREVIEW, style: ghostPosition(drag.point, PREVIEW_MAX_PX), children: drag.label }) : null
|
|
1330
1371
|
] });
|
|
1331
1372
|
}
|
|
1332
1373
|
Tree.displayName = "Tree";
|
|
1333
1374
|
|
|
1334
1375
|
export { Tree, ancestorIds, applyTreeMove, attachChildren, isBranch, isDescendant, useTree, walkTree };
|
|
1335
|
-
//# sourceMappingURL=chunk-
|
|
1336
|
-
//# sourceMappingURL=chunk-
|
|
1376
|
+
//# sourceMappingURL=chunk-POQTE7JI.js.map
|
|
1377
|
+
//# sourceMappingURL=chunk-POQTE7JI.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OptionRow } from './chunk-
|
|
2
|
-
import { warnNeedsName } from './chunk-GCVA3OIV.js';
|
|
1
|
+
import { OptionRow } from './chunk-D7EE5GWU.js';
|
|
3
2
|
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
3
|
+
import { warnNeedsName } from './chunk-QDYE5LVT.js';
|
|
4
4
|
import { Switch as Switch$1 } from '@base-ui/react/switch';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -63,5 +63,5 @@ function Switch(props) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export { Switch };
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-QDKETK7D.js.map
|
|
67
|
+
//# sourceMappingURL=chunk-QDKETK7D.js.map
|
|
@@ -11,6 +11,16 @@ function nearestScrollport(el) {
|
|
|
11
11
|
function scrollportScrolls(port) {
|
|
12
12
|
return port === null || SCROLLS.has(port.overflowY);
|
|
13
13
|
}
|
|
14
|
+
function nearestScrollableOn(el, axis) {
|
|
15
|
+
if (el == null || typeof getComputedStyle !== "function") return null;
|
|
16
|
+
for (let node = el.parentElement; node; node = node.parentElement) {
|
|
17
|
+
const style = getComputedStyle(node);
|
|
18
|
+
if (!SCROLLS.has(axis === "y" ? style.overflowY : style.overflowX)) continue;
|
|
19
|
+
const overflow = axis === "y" ? node.scrollHeight - node.clientHeight : node.scrollWidth - node.clientWidth;
|
|
20
|
+
if (overflow > 1) return node;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
14
24
|
|
|
15
25
|
// src/lib/dev-warn.ts
|
|
16
26
|
var isDev = () => {
|
|
@@ -67,6 +77,6 @@ function warnStickyNoScrollport(component, prop, el) {
|
|
|
67
77
|
);
|
|
68
78
|
}
|
|
69
79
|
|
|
70
|
-
export { devWarn, nearestScrollport, scrollportScrolls, warnExclusive, warnNeedsName, warnNonNegativeInt, warnPositiveInt, warnPositiveNumber, warnRange, warnStickyNoScrollport };
|
|
71
|
-
//# sourceMappingURL=chunk-
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
export { devWarn, nearestScrollableOn, nearestScrollport, scrollportScrolls, warnExclusive, warnNeedsName, warnNonNegativeInt, warnPositiveInt, warnPositiveNumber, warnRange, warnStickyNoScrollport };
|
|
81
|
+
//# sourceMappingURL=chunk-QDYE5LVT.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-QDYE5LVT.js.map
|