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.
Files changed (204) hide show
  1. package/README.md +13 -10
  2. package/dist/Cartesian-ZIKPEYWP.d.ts +26 -0
  3. package/dist/{PaymentInput-CKPIPNWH.d.ts → PaymentInput-Dn5WVQVy.d.ts} +4 -0
  4. package/dist/{Select-CVbEQ2Ep.d.ts → Select-Dt5ARIH8.d.ts} +4 -0
  5. package/dist/{TagInput-CTJYOB4J.d.ts → TagInput-BaBeve6L.d.ts} +4 -0
  6. package/dist/area-chart.d.ts +54 -0
  7. package/dist/area-chart.js +9 -0
  8. package/dist/avatar.d.ts +24 -0
  9. package/dist/avatar.js +13 -7
  10. package/dist/badge.d.ts +4 -0
  11. package/dist/badge.js +6 -5
  12. package/dist/bar-chart.d.ts +32 -0
  13. package/dist/bar-chart.js +9 -0
  14. package/dist/breadcrumb.d.ts +4 -0
  15. package/dist/breadcrumb.js +5 -3
  16. package/dist/button.d.ts +16 -1
  17. package/dist/button.js +10 -8
  18. package/dist/calendar.d.ts +5 -0
  19. package/dist/calendar.js +18 -14
  20. package/dist/callout.d.ts +6 -6
  21. package/dist/callout.js +12 -9
  22. package/dist/card-D56VxyAe.d.ts +123 -0
  23. package/dist/card.d.ts +3 -1
  24. package/dist/card.js +7 -3
  25. package/dist/checkbox.js +9 -7
  26. package/dist/chunk-22M75A3N.js +396 -0
  27. package/dist/{chunk-D5BTFSL7.js → chunk-33TOK7ES.js} +7 -5
  28. package/dist/{chunk-THC2ISYP.js → chunk-3H444OJA.js} +6 -4
  29. package/dist/{chunk-GFOAJVW5.js → chunk-3QXLIZIX.js} +4 -13
  30. package/dist/chunk-3ZEEGXYF.js +8 -0
  31. package/dist/chunk-45Y2ZGNK.js +34 -0
  32. package/dist/{chunk-FHHAPGCR.js → chunk-4RBIWI2Q.js} +3 -3
  33. package/dist/chunk-4VGEJG4M.js +1510 -0
  34. package/dist/{chunk-PWKWNDBS.js → chunk-54SIZR63.js} +16 -8
  35. package/dist/chunk-5AZKP4KZ.js +49 -0
  36. package/dist/chunk-5DP7W5HX.js +254 -0
  37. package/dist/{chunk-J2BCKBHC.js → chunk-5KSD4WKN.js} +14 -5
  38. package/dist/{chunk-ZOOX3TUB.js → chunk-5XPMY2LF.js} +6 -6
  39. package/dist/chunk-5ZEUTSCV.js +147 -0
  40. package/dist/chunk-5ZPUAGOP.js +19 -0
  41. package/dist/{chunk-JTNFJLIY.js → chunk-667ZHY3T.js} +114 -42
  42. package/dist/{chunk-JP26LPCY.js → chunk-6B6BWTXC.js} +30 -13
  43. package/dist/{chunk-W5GGOUUI.js → chunk-6H4LNWQ7.js} +3 -3
  44. package/dist/{chunk-WFY7DKQD.js → chunk-6MMBQVRO.js} +61 -51
  45. package/dist/{chunk-7HOIZ3UO.js → chunk-7GUPNTAH.js} +15 -7
  46. package/dist/chunk-7VLYQR4D.js +44 -0
  47. package/dist/{chunk-KNYKWUYX.js → chunk-7ZM7SNCZ.js} +3 -3
  48. package/dist/{chunk-E7ZSWBAK.js → chunk-A323V6AI.js} +6 -4
  49. package/dist/chunk-AFYXSZGW.js +23 -0
  50. package/dist/chunk-AIARANKE.js +33 -0
  51. package/dist/{chunk-4OLULPQG.js → chunk-AIGYMTCU.js} +10 -6
  52. package/dist/{chunk-JVJRHBTD.js → chunk-AZ7DKRBY.js} +21 -8
  53. package/dist/{chunk-JYGR44ZC.js → chunk-BBKE4W3B.js} +19 -11
  54. package/dist/{chunk-Z3ETJN5G.js → chunk-BFVJHH7S.js} +8 -12
  55. package/dist/chunk-BLIZ3CL3.js +49 -0
  56. package/dist/{chunk-F2K7VJUV.js → chunk-CFFWYXDW.js} +19 -7
  57. package/dist/{chunk-MQGD2OUF.js → chunk-CGHYXWTT.js} +11 -5
  58. package/dist/{chunk-CYPPEUX5.js → chunk-CKMWBVRR.js} +27 -12
  59. package/dist/{chunk-GTHJWR3Q.js → chunk-D7EE5GWU.js} +21 -22
  60. package/dist/{chunk-5NOBSXJN.js → chunk-E2YZ7IMT.js} +24 -8
  61. package/dist/{chunk-T7FCG7XV.js → chunk-FFMTYQXE.js} +31 -11
  62. package/dist/{chunk-J36M3KRX.js → chunk-FH7Z7SGQ.js} +67 -32
  63. package/dist/chunk-FKVPAEJ6.js +57 -0
  64. package/dist/{chunk-GRLSUQQE.js → chunk-FNQJJO63.js} +4 -4
  65. package/dist/{chunk-5RAPA22E.js → chunk-FWRHBMWT.js} +4 -4
  66. package/dist/chunk-GLKFFA7N.js +171 -0
  67. package/dist/{chunk-KDLPXXD2.js → chunk-GQRSABRN.js} +4 -4
  68. package/dist/{chunk-DRZCJCBO.js → chunk-GZMDZF2V.js} +8 -7
  69. package/dist/chunk-HHYEAFCL.js +525 -0
  70. package/dist/{chunk-LME57Z6J.js → chunk-I6WMNXC7.js} +6 -6
  71. package/dist/chunk-IQNVSQRK.js +605 -0
  72. package/dist/chunk-KHGW72BM.js +10 -0
  73. package/dist/{chunk-ZZA2LUTL.js → chunk-KZP6B6B3.js} +41 -16
  74. package/dist/chunk-LCG34A5T.js +98 -0
  75. package/dist/chunk-LLPWQDF7.js +26 -0
  76. package/dist/{chunk-J7ZQQFPT.js → chunk-LO22VQL5.js} +18 -18
  77. package/dist/{chunk-BVJWBYIG.js → chunk-LQURV7HQ.js} +9 -7
  78. package/dist/{chunk-R6RGJF4L.js → chunk-LYXPJERB.js} +15 -5
  79. package/dist/{chunk-CME4DIML.js → chunk-MCQG4H6T.js} +54 -3
  80. package/dist/{chunk-VWC72TR3.js → chunk-MVG5MABV.js} +11 -8
  81. package/dist/{chunk-5FATN5YD.js → chunk-N3RVMBPX.js} +6 -9
  82. package/dist/chunk-NKG4N6HA.js +188 -0
  83. package/dist/{chunk-W46K56XU.js → chunk-OACWA4TC.js} +15 -69
  84. package/dist/chunk-OLLD2BZN.js +33 -0
  85. package/dist/{chunk-KMSYEE23.js → chunk-P6CON2R2.js} +25 -11
  86. package/dist/chunk-PO2TYK3C.js +17 -0
  87. package/dist/{chunk-7EWQKTNQ.js → chunk-POQTE7JI.js} +66 -25
  88. package/dist/{chunk-HMUZE6EK.js → chunk-QDKETK7D.js} +4 -4
  89. package/dist/{chunk-GCVA3OIV.js → chunk-QDYE5LVT.js} +13 -3
  90. package/dist/{chunk-WEUJYDCV.js → chunk-QHH6AUR3.js} +16 -8
  91. package/dist/chunk-RJTVCA62.js +42 -0
  92. package/dist/{chunk-MUFHLP4S.js → chunk-S5TEWPWW.js} +50 -41
  93. package/dist/{chunk-D6TPWNRK.js → chunk-SB3DG572.js} +15 -8
  94. package/dist/chunk-SKRR3ZMP.js +10 -0
  95. package/dist/chunk-T4ZFZTY6.js +62 -0
  96. package/dist/{chunk-I7WU4GTY.js → chunk-T5574MXM.js} +34 -46
  97. package/dist/{chunk-MKC5HNA7.js → chunk-U4WSJAYK.js} +374 -147
  98. package/dist/{chunk-BJUZVYQC.js → chunk-UGKELBNC.js} +60 -44
  99. package/dist/chunk-ULGCGKOE.js +77 -0
  100. package/dist/{chunk-QA74ITR4.js → chunk-X2VMIBK5.js} +45 -17
  101. package/dist/chunk-X2X7Q7NW.js +17 -0
  102. package/dist/chunk-YHBI52P2.js +10 -0
  103. package/dist/chunk-YIHKQ63K.js +13 -0
  104. package/dist/{chunk-3Y5X7B5C.js → chunk-YQYVGWIC.js} +6 -11
  105. package/dist/{chunk-WZQFC7ZN.js → chunk-ZHAT2XZ4.js} +139 -66
  106. package/dist/{chunk-7IU5TMFL.js → chunk-ZMFY7WAY.js} +124 -40
  107. package/dist/{chunk-SV56BSUQ.js → chunk-ZZSNTCCL.js} +6 -5
  108. package/dist/combobox.d.ts +5 -0
  109. package/dist/combobox.js +15 -12
  110. package/dist/control-size-CaxQhkKh.d.ts +3 -0
  111. package/dist/date-input.d.ts +4 -0
  112. package/dist/date-input.js +12 -9
  113. package/dist/date-picker.d.ts +6 -0
  114. package/dist/date-picker.js +25 -20
  115. package/dist/dialog.d.ts +37 -5
  116. package/dist/dialog.js +12 -8
  117. package/dist/drawer.d.ts +20 -3
  118. package/dist/drawer.js +11 -7
  119. package/dist/dropdown-menu.d.ts +26 -2
  120. package/dist/dropdown-menu.js +9 -4
  121. package/dist/dropzone.d.ts +35 -0
  122. package/dist/dropzone.js +23 -0
  123. package/dist/form.d.ts +82 -3
  124. package/dist/form.js +205 -45
  125. package/dist/header-navigation.d.ts +19 -4
  126. package/dist/header-navigation.js +23 -16
  127. package/dist/helper.d.ts +36 -0
  128. package/dist/helper.js +3 -0
  129. package/dist/index.d.ts +32 -8
  130. package/dist/index.js +87 -62
  131. package/dist/indicator.js +4 -4
  132. package/dist/input.d.ts +4 -0
  133. package/dist/input.js +10 -8
  134. package/dist/kanban-board.d.ts +489 -0
  135. package/dist/kanban-board.js +25 -0
  136. package/dist/labels-DPrh0se9.d.ts +627 -0
  137. package/dist/line-chart.d.ts +36 -0
  138. package/dist/line-chart.js +9 -0
  139. package/dist/{nav-Bla0o_-1.d.ts → nav-CKKqjBs6.d.ts} +18 -11
  140. package/dist/number-input.d.ts +4 -0
  141. package/dist/number-input.js +10 -8
  142. package/dist/pagination.d.ts +7 -1
  143. package/dist/pagination.js +14 -10
  144. package/dist/panel-El4oI68p.d.ts +9 -0
  145. package/dist/payment-input.d.ts +3 -2
  146. package/dist/payment-input.js +10 -8
  147. package/dist/pie-chart.d.ts +64 -0
  148. package/dist/pie-chart.js +9 -0
  149. package/dist/popover.d.ts +9 -3
  150. package/dist/popover.js +11 -7
  151. package/dist/progress-steps.d.ts +275 -0
  152. package/dist/progress-steps.js +8 -0
  153. package/dist/progress.d.ts +21 -1
  154. package/dist/progress.js +3 -2
  155. package/dist/provider.d.ts +212 -0
  156. package/dist/provider.js +7 -0
  157. package/dist/radar-chart.d.ts +77 -0
  158. package/dist/radar-chart.js +9 -0
  159. package/dist/radial-chart.d.ts +73 -0
  160. package/dist/radial-chart.js +9 -0
  161. package/dist/radio.js +9 -7
  162. package/dist/rule-BqzaIwJy.d.ts +80 -0
  163. package/dist/scroll-area.d.ts +62 -0
  164. package/dist/scroll-area.js +7 -0
  165. package/dist/select.d.ts +3 -3
  166. package/dist/select.js +17 -14
  167. package/dist/separator.d.ts +114 -0
  168. package/dist/separator.js +5 -0
  169. package/dist/shared-CxAedkiy.d.ts +68 -0
  170. package/dist/sidebar-navigation.d.ts +80 -12
  171. package/dist/sidebar-navigation.js +18 -9
  172. package/dist/skeleton.d.ts +61 -0
  173. package/dist/skeleton.js +5 -0
  174. package/dist/styles.css +1 -1
  175. package/dist/switch.js +4 -4
  176. package/dist/table.d.ts +148 -42
  177. package/dist/table.js +39 -33
  178. package/dist/tabs.d.ts +22 -0
  179. package/dist/tabs.js +3 -3
  180. package/dist/tag-input.d.ts +3 -2
  181. package/dist/tag-input.js +13 -11
  182. package/dist/tag.d.ts +4 -0
  183. package/dist/tag.js +4 -3
  184. package/dist/textarea.js +7 -5
  185. package/dist/theme.css +151 -6
  186. package/dist/theme.js +11 -9
  187. package/dist/toast.d.ts +11 -2
  188. package/dist/toast.js +12 -9
  189. package/dist/tooltip-surface-C2I9o2QM.d.ts +35 -0
  190. package/dist/tooltip.d.ts +15 -1
  191. package/dist/tooltip.js +3 -2
  192. package/dist/tree.d.ts +5 -0
  193. package/dist/tree.js +8 -6
  194. package/dist/types-DR9rAEy1.d.ts +188 -0
  195. package/dist/use-uploads-KaPqDklo.d.ts +482 -0
  196. package/dist/verification-code-input.d.ts +84 -0
  197. package/dist/verification-code-input.js +14 -0
  198. package/package.json +70 -9
  199. package/dist/card-nWicloNi.d.ts +0 -80
  200. package/dist/chunk-24TO7E32.js +0 -42
  201. package/dist/chunk-FXIBGTS5.js +0 -14
  202. package/dist/chunk-MFJP5FA7.js +0 -20
  203. package/dist/chunk-ZZT2E5VT.js +0 -24
  204. package/dist/shared-BNXAdgh2.d.ts +0 -9
@@ -0,0 +1,525 @@
1
+ import { Progress } from './chunk-33TOK7ES.js';
2
+ import { Separator } from './chunk-7VLYQR4D.js';
3
+ import { FileTrigger } from './chunk-DJSXIAFH.js';
4
+ import { Button } from './chunk-OACWA4TC.js';
5
+ import { ButtonUtility } from './chunk-AZ7DKRBY.js';
6
+ import { SOLID } from './chunk-MCQG4H6T.js';
7
+ import { useFieldValidity, FieldFrame } from './chunk-5KSD4WKN.js';
8
+ import { UploadCloudIcon, FileIcon, CircleXIcon, CircleCheckIcon, Trash2Icon, XIcon } from './chunk-BLIZ3CL3.js';
9
+ import { cn } from './chunk-ZSNJ6UA3.js';
10
+ import { useLabels } from './chunk-RJTVCA62.js';
11
+ import { warnNonNegativeInt, devWarn, warnRange } from './chunk-QDYE5LVT.js';
12
+ import { mergeProps } from '@base-ui/react/merge-props';
13
+ import { useRender } from '@base-ui/react/use-render';
14
+ import * as React from 'react';
15
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
16
+
17
+ // src/components/dropzone/shared.ts
18
+ var SIZE_SUFFIX = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
19
+ function formatFileSize(bytes) {
20
+ if (!Number.isFinite(bytes) || bytes <= 0) return "0 B";
21
+ const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), SIZE_SUFFIX.length - 1);
22
+ const value = bytes / 1024 ** exponent;
23
+ const rounded = exponent >= 2 ? Math.round(value * 10) / 10 : Math.round(value);
24
+ return `${rounded} ${SIZE_SUFFIX[exponent]}`;
25
+ }
26
+ var idCounter = 0;
27
+ function toUploadFile(file) {
28
+ const uuid = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `file-${++idCounter}`;
29
+ return {
30
+ id: uuid,
31
+ name: file.name,
32
+ size: file.size,
33
+ status: "uploading",
34
+ progress: 0,
35
+ type: file.type || void 0
36
+ };
37
+ }
38
+ function isFileTypeAccepted(file, accept) {
39
+ if (!accept || !accept.trim()) return true;
40
+ const patterns = accept.split(",").map((entry) => entry.trim().toLowerCase()).filter(Boolean);
41
+ if (patterns.length === 0) return true;
42
+ const name = file.name.toLowerCase();
43
+ const mime = (file.type || "").toLowerCase();
44
+ return patterns.some((pattern) => {
45
+ if (pattern.startsWith(".")) return name.endsWith(pattern);
46
+ if (pattern.endsWith("/*")) return mime.startsWith(pattern.slice(0, -1));
47
+ return mime === pattern;
48
+ });
49
+ }
50
+ function invalidAcceptEntries(accept) {
51
+ return accept.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0 && !entry.startsWith(".") && !entry.includes("/"));
52
+ }
53
+ function bucketFiles(files, rules = {}) {
54
+ const { accept, multiple = true, maxSize, maxFiles, existingCount = 0 } = rules;
55
+ const accepted = [];
56
+ const rejections = [];
57
+ const ceiling = multiple ? maxFiles ?? Infinity : 1;
58
+ let room = Math.max(0, ceiling - (multiple ? existingCount : 0));
59
+ for (const file of files) {
60
+ if (room <= 0) {
61
+ rejections.push({ file, reason: "count" });
62
+ continue;
63
+ }
64
+ if (maxSize !== void 0 && file.size > maxSize) {
65
+ rejections.push({ file, reason: "size" });
66
+ continue;
67
+ }
68
+ if (!isFileTypeAccepted(file, accept)) {
69
+ rejections.push({ file, reason: "type" });
70
+ continue;
71
+ }
72
+ accepted.push(file);
73
+ room -= 1;
74
+ }
75
+ return { accepted, rejections };
76
+ }
77
+ function fileExtension(nameOrType) {
78
+ const raw = nameOrType.trim().toLowerCase();
79
+ if (!raw) return "";
80
+ if (raw.includes("/")) {
81
+ const subtype = raw.slice(raw.lastIndexOf("/") + 1);
82
+ const base = subtype.split("+", 1)[0] ?? "";
83
+ if (base === "octet-stream" || base === "*" || base.includes(".")) return "";
84
+ return base;
85
+ }
86
+ const dot = raw.lastIndexOf(".");
87
+ if (dot === -1) return raw;
88
+ return dot === 0 || dot === raw.length - 1 ? "" : raw.slice(dot + 1);
89
+ }
90
+ var FILE_TONE = {
91
+ // Documents
92
+ pdf: "error",
93
+ doc: "info",
94
+ docx: "info",
95
+ txt: "info",
96
+ rtf: "info",
97
+ md: "info",
98
+ pages: "info",
99
+ // Sheets
100
+ xls: "success",
101
+ xlsx: "success",
102
+ csv: "success",
103
+ numbers: "success",
104
+ // Images
105
+ png: "brand",
106
+ jpg: "brand",
107
+ jpeg: "brand",
108
+ gif: "brand",
109
+ svg: "brand",
110
+ webp: "brand",
111
+ avif: "brand",
112
+ heic: "brand",
113
+ // Archives
114
+ zip: "warning",
115
+ rar: "warning",
116
+ "7z": "warning",
117
+ tar: "warning",
118
+ gz: "warning"
119
+ };
120
+ function extensionTone(extension) {
121
+ return FILE_TONE[extension] ?? "neutral";
122
+ }
123
+ var FILE_TONE_BUCKETS = [
124
+ { tone: "error", label: "Documents", extensions: ["pdf"] },
125
+ { tone: "info", label: "Text", extensions: ["doc", "docx", "txt", "rtf", "md", "pages"] },
126
+ { tone: "success", label: "Sheets", extensions: ["xls", "xlsx", "csv", "numbers"] },
127
+ { tone: "brand", label: "Images", extensions: ["png", "jpg", "jpeg", "gif", "svg", "webp", "avif", "heic"] },
128
+ { tone: "warning", label: "Archives", extensions: ["zip", "rar", "7z", "tar", "gz"] },
129
+ { tone: "neutral", label: "Everything else", extensions: ["exe", "bin", "unknown"] }
130
+ ];
131
+ function fileTone(nameOrType) {
132
+ if (!nameOrType) return "neutral";
133
+ return extensionTone(fileExtension(nameOrType));
134
+ }
135
+ function fileGlyphSource(file) {
136
+ return file.type && fileExtension(file.type) ? file.type : file.name;
137
+ }
138
+ var GLYPH_BOX = "relative size-10 shrink-0";
139
+
140
+ // src/components/dropzone/entries.ts
141
+ var readEntryFromItem = (item) => {
142
+ const get = item.webkitGetAsEntry;
143
+ if (typeof get !== "function") return null;
144
+ try {
145
+ return get.call(item) ?? null;
146
+ } catch {
147
+ return null;
148
+ }
149
+ };
150
+ function entryFile(entry) {
151
+ return new Promise((resolve) => {
152
+ try {
153
+ entry.file(
154
+ (file) => resolve(file),
155
+ () => resolve(null)
156
+ );
157
+ } catch {
158
+ resolve(null);
159
+ }
160
+ });
161
+ }
162
+ function readBatch(reader) {
163
+ return new Promise((resolve) => {
164
+ try {
165
+ reader.readEntries(
166
+ (entries) => resolve(entries),
167
+ () => resolve([])
168
+ );
169
+ } catch {
170
+ resolve([]);
171
+ }
172
+ });
173
+ }
174
+ var MAX_DEPTH = 32;
175
+ async function walkDirectory(entry, depth) {
176
+ if (depth > MAX_DEPTH) return [];
177
+ const reader = entry.createReader();
178
+ const out = [];
179
+ for (; ; ) {
180
+ const batch = await readBatch(reader);
181
+ if (batch.length === 0) break;
182
+ for (const child of batch) {
183
+ if (child.isDirectory) {
184
+ out.push(...await walkDirectory(child, depth + 1));
185
+ } else {
186
+ const file = await entryFile(child);
187
+ if (file) out.push(file);
188
+ }
189
+ }
190
+ }
191
+ return out;
192
+ }
193
+ async function readDropContents(dt, recursive, readEntry = readEntryFromItem) {
194
+ const items = dt.items ? [...dt.items] : [];
195
+ const entries = items.filter((item) => item.kind === "file").map((item) => readEntry(item));
196
+ if (entries.every((entry) => entry === null)) {
197
+ return { files: dt.files ? [...dt.files] : [], directories: [] };
198
+ }
199
+ const files = [];
200
+ const directories = [];
201
+ for (const [index, entry] of entries.entries()) {
202
+ if (!entry) {
203
+ const fallback = items[index]?.getAsFile();
204
+ if (fallback) files.push(fallback);
205
+ continue;
206
+ }
207
+ if (entry.isDirectory) {
208
+ if (recursive) files.push(...await walkDirectory(entry, 1));
209
+ else directories.push(entry.name);
210
+ continue;
211
+ }
212
+ const file = await entryFile(entry);
213
+ if (file) files.push(file);
214
+ }
215
+ return { files, directories };
216
+ }
217
+
218
+ // src/components/dropzone/labels.ts
219
+ var DROPZONE_LABELS = {
220
+ /** The bright half of the prompt — a real `<button>`, which is why it is its own key. */
221
+ clickToUpload: "Click to upload",
222
+ /**
223
+ * The muted remainder of the same sentence.
224
+ *
225
+ * The two halves are ONE sentence split across an element boundary for styling, and the styled
226
+ * action always comes first. A language that cannot keep that order sets `clickToUpload` to the
227
+ * whole phrase and `dragAndDrop` to `""` (or the reverse) — deliberately a documented workaround
228
+ * rather than a third "whole sentence" key, because interpolating a styled NODE would mean a ctx
229
+ * carrying markup, which this layer does not do.
230
+ */
231
+ dragAndDrop: "or drag and drop",
232
+ /** Appended to the zone's accessible name when the field is required. */
233
+ required: ", required"
234
+ };
235
+ var FILE_LIST_LABELS = {
236
+ /** The three status words, visible beside each row's glyph. */
237
+ statusUploading: "Uploading\u2026",
238
+ statusComplete: "Complete",
239
+ statusFailed: "Failed",
240
+ /** The row affordance's verb, which also composes into its accessible name. */
241
+ cancel: "Cancel",
242
+ remove: "Remove",
243
+ /** The retry link under a failed row. */
244
+ retry: "Try again",
245
+ /** The fallback failure line, when the upload reported no error of its own. */
246
+ uploadFailed: "Upload failed",
247
+ /** A bare "Remove" makes a five-row list announce five identical buttons, so the file's name is
248
+ * part of the name. */
249
+ actionForFile: (ctx) => `${ctx.verb} ${ctx.name}`,
250
+ /** The progress bar's name while a row uploads. */
251
+ uploading: (ctx) => `Uploading ${ctx.name}`
252
+ };
253
+ var SURFACE = "group flex w-full cursor-pointer flex-col items-center gap-3 rounded-xl bg-primary px-6 py-4 text-center ring-1 ring-secondary ring-inset transition duration-100 ease-linear outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2";
254
+ var SURFACE_IDLE = "hover:bg-secondary";
255
+ var SURFACE_DRAGGING = "bg-brand-primary ring-2 ring-brand";
256
+ var SURFACE_INVALID = "ring-error_subtle";
257
+ var SURFACE_DISABLED = "cursor-not-allowed bg-secondary";
258
+ var HERO_TILE = "flex items-center justify-center rounded-lg bg-primary ring-1 ring-primary ring-inset";
259
+ function Dropzone(props) {
260
+ const {
261
+ accept,
262
+ multiple = true,
263
+ maxSize,
264
+ maxFiles,
265
+ fileCount = 0,
266
+ acceptDirectory = false,
267
+ onFilesChange,
268
+ onReject,
269
+ label,
270
+ tooltip,
271
+ tooltipDescription,
272
+ hint,
273
+ required = false,
274
+ hideRequiredIndicator = false,
275
+ invalid = false,
276
+ error,
277
+ disabled = false,
278
+ fullWidth = true,
279
+ labels,
280
+ className,
281
+ render,
282
+ _readEntry,
283
+ ...rest
284
+ } = props;
285
+ const t = useLabels("dropzone", DROPZONE_LABELS, labels);
286
+ const { isInvalid, showError } = useFieldValidity(invalid, error);
287
+ const [dragging, setDragging] = React.useState(false);
288
+ const labelId = React.useId();
289
+ const textId = React.useId();
290
+ const hintId = React.useId();
291
+ const errorId = React.useId();
292
+ const depth = React.useRef(0);
293
+ warnNonNegativeInt("Dropzone", "fileCount", fileCount);
294
+ React.useEffect(() => {
295
+ if (!accept) return;
296
+ const bad = invalidAcceptEntries(accept);
297
+ if (bad.length > 0) {
298
+ devWarn(
299
+ `<Dropzone> \`accept\` entr${bad.length === 1 ? "y" : "ies"} ${bad.map((e) => `\`${e}\``).join(", ")} match nothing \u2014 an extension needs a leading dot (\`.pdf\`) and a MIME type needs a slash (\`application/pdf\`).`
300
+ );
301
+ }
302
+ }, [accept]);
303
+ const commit = React.useCallback(
304
+ (files, directories = []) => {
305
+ const { accepted, rejections } = bucketFiles(files, { accept, multiple, maxSize, maxFiles, existingCount: fileCount });
306
+ const all = [...directories.map((name) => ({ file: new File([], name), reason: "directory" })), ...rejections];
307
+ if (accepted.length > 0) onFilesChange?.(accepted);
308
+ if (all.length > 0) onReject?.(all);
309
+ },
310
+ [accept, multiple, maxSize, maxFiles, fileCount, onFilesChange, onReject]
311
+ );
312
+ const endDrag = React.useCallback(() => {
313
+ depth.current = 0;
314
+ setDragging(false);
315
+ }, []);
316
+ const handleDragEnter = (event) => {
317
+ if (disabled) return;
318
+ event.preventDefault();
319
+ depth.current += 1;
320
+ setDragging(true);
321
+ };
322
+ const handleDragOver = (event) => {
323
+ if (disabled) return;
324
+ event.preventDefault();
325
+ if (event.dataTransfer) event.dataTransfer.dropEffect = "copy";
326
+ };
327
+ const handleDragLeave = (event) => {
328
+ if (disabled) return;
329
+ event.preventDefault();
330
+ depth.current = Math.max(0, depth.current - 1);
331
+ if (depth.current === 0) setDragging(false);
332
+ };
333
+ const handleDrop = (event) => {
334
+ if (disabled) return;
335
+ event.preventDefault();
336
+ endDrag();
337
+ const dt = event.dataTransfer;
338
+ if (!dt) return;
339
+ void readDropContents(dt, acceptDirectory, _readEntry).then(({ files, directories }) => commit(files, directories));
340
+ };
341
+ const surfaceClass = cn(
342
+ SURFACE,
343
+ !disabled && !dragging && SURFACE_IDLE,
344
+ dragging && SURFACE_DRAGGING,
345
+ isInvalid && !dragging && SURFACE_INVALID,
346
+ disabled && SURFACE_DISABLED
347
+ );
348
+ return /* @__PURE__ */ jsx(
349
+ FieldFrame,
350
+ {
351
+ label,
352
+ labelId,
353
+ messageId: { hint: hintId, error: errorId },
354
+ tooltip,
355
+ tooltipDescription,
356
+ hint,
357
+ required,
358
+ hideRequiredIndicator,
359
+ error,
360
+ isInvalid,
361
+ showError,
362
+ disabled,
363
+ fullWidth,
364
+ className,
365
+ children: /* @__PURE__ */ jsx(FileTrigger, { accept, multiple, acceptDirectory, onFilesChange: (files) => commit(files), children: ({ open }) => /* @__PURE__ */ jsx(
366
+ DropSurface,
367
+ {
368
+ render,
369
+ ...mergeProps(
370
+ {
371
+ type: "button",
372
+ className: surfaceClass,
373
+ disabled,
374
+ // Spread rather than written inline: an excess `data-*` key fails mergeProps'
375
+ // prop type, which is the same reason `Button` spells `data-loading` this way.
376
+ ...dragging && { "data-dragging": "" },
377
+ // The label names the surface ALONGSIDE its own text ("Attachments — Click to
378
+ // upload…"); `aria-labelledby` alone would replace the content name with the label.
379
+ "aria-labelledby": label ? `${labelId} ${textId}` : void 0,
380
+ "aria-describedby": showError ? errorId : hint ? hintId : void 0,
381
+ "aria-invalid": isInvalid || void 0,
382
+ onClick: open,
383
+ onDragEnter: handleDragEnter,
384
+ onDragOver: handleDragOver,
385
+ onDragLeave: handleDragLeave,
386
+ onDrop: handleDrop,
387
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
388
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(GLYPH_BOX, HERO_TILE, disabled && "opacity-50"), children: /* @__PURE__ */ jsx(UploadCloudIcon, { className: "size-5 text-fg-secondary" }) }),
389
+ /* @__PURE__ */ jsxs("span", { id: textId, className: cn("flex flex-col gap-1", disabled && "opacity-50"), children: [
390
+ /* @__PURE__ */ jsxs("span", { className: "text-sm text-tertiary", children: [
391
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-brand-secondary group-hover:underline", children: t.clickToUpload }),
392
+ " ",
393
+ t.dragAndDrop
394
+ ] }),
395
+ required ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: t.required }) : null
396
+ ] })
397
+ ] })
398
+ },
399
+ rest
400
+ )
401
+ }
402
+ ) })
403
+ }
404
+ );
405
+ }
406
+ function DropSurface({ render, ...props }) {
407
+ return useRender({ defaultTagName: "button", render, props });
408
+ }
409
+ var CHIP = "absolute bottom-1.5 left-0.5 rounded-sm px-0.75 text-[8px] leading-[12px] font-bold tracking-tight uppercase";
410
+ var MAX_CHIP_LENGTH = 4;
411
+ function FileTypeGlyph({ extension, className }) {
412
+ const tone = extensionTone(extension);
413
+ return /* @__PURE__ */ jsxs("div", { "aria-hidden": "true", className: cn(GLYPH_BOX, className), children: [
414
+ /* @__PURE__ */ jsx(FileIcon, { className: "absolute inset-0 size-10 fill-bg-secondary text-border-primary", strokeWidth: 0.6 }),
415
+ extension ? /* @__PURE__ */ jsx("span", { className: cn(CHIP, SOLID[tone]), children: extension.slice(0, MAX_CHIP_LENGTH) }) : null
416
+ ] });
417
+ }
418
+ var LIST = "flex flex-col gap-3";
419
+ var ROW = "relative flex gap-3 rounded-xl bg-primary p-4 ring-inset transition-shadow duration-100 ease-linear";
420
+ var ROW_RING = "ring-1 ring-secondary";
421
+ var ROW_RING_FAILED = "ring-2 ring-error_subtle";
422
+ var FILL_ROW = "relative flex gap-3 overflow-hidden rounded-xl bg-primary p-4";
423
+ var FILL_RING = "pointer-events-none absolute inset-0 size-full rounded-[inherit] ring-inset transition duration-100 ease-linear";
424
+ var FILL_WASH = "pointer-events-none absolute inset-0 size-full bg-secondary transition duration-75 ease-linear";
425
+ var NAME = "truncate text-sm font-medium text-secondary";
426
+ var META_ROW = "mt-0.5 flex items-center gap-2";
427
+ var META_TEXT = "text-sm text-tertiary";
428
+ var SIZE_TEXT = `${META_TEXT} truncate whitespace-nowrap`;
429
+ var ERROR_TEXT = `${META_TEXT} break-words`;
430
+ var STATUS = {
431
+ uploading: { key: "statusUploading", glyph: UploadCloudIcon, glyphClass: "text-fg-quaternary", wordClass: "text-quaternary", action: "cancel" },
432
+ complete: { key: "statusComplete", glyph: CircleCheckIcon, glyphClass: "text-fg-success-primary", wordClass: "text-success-primary", action: "remove" },
433
+ failed: { key: "statusFailed", glyph: CircleXIcon, glyphClass: "text-fg-error-primary", wordClass: "text-error-primary", action: "remove" }
434
+ };
435
+ var ACTION = {
436
+ cancel: { key: "cancel", glyph: XIcon },
437
+ remove: { key: "remove", glyph: Trash2Icon }
438
+ };
439
+ function Row({ file, treatment, onRemove, onCancel, onRetry, fileIcon, t }) {
440
+ const status = STATUS[file.status];
441
+ const action = ACTION[status.action];
442
+ const statusWord = t[status.key];
443
+ const actionVerb = t[action.key];
444
+ const StatusGlyph = status.glyph;
445
+ const ActionGlyph = action.glyph;
446
+ const handler = status.action === "cancel" ? onCancel : onRemove;
447
+ warnRange("FileList", "progress", file.progress, 0, 100);
448
+ const progress = file.status === "complete" ? 100 : Math.min(100, Math.max(0, file.progress ?? 0));
449
+ const failed = file.status === "failed";
450
+ const fill = treatment === "fill";
451
+ const affordance = handler ? /* @__PURE__ */ jsx(
452
+ ButtonUtility,
453
+ {
454
+ variant: "tertiary",
455
+ size: "xs",
456
+ icon: /* @__PURE__ */ jsx(ActionGlyph, {}),
457
+ tooltip: actionVerb,
458
+ "aria-label": t.actionForFile({ verb: actionVerb, name: file.name }),
459
+ className: "-mt-2 -mr-2 self-start",
460
+ onClick: () => handler(file)
461
+ }
462
+ ) : null;
463
+ const retry = failed && onRetry ? /* @__PURE__ */ jsx(Button, { variant: "link", color: "error", size: "sm", className: "mt-1.5", onClick: () => onRetry(file), children: t.retry }) : null;
464
+ const glyph = fileIcon ? fileIcon(file) : /* @__PURE__ */ jsx(FileTypeGlyph, { extension: fileExtension(fileGlyphSource(file)) });
465
+ const meta = /* @__PURE__ */ jsxs("div", { className: META_ROW, children: [
466
+ /* @__PURE__ */ jsx("p", { className: failed ? ERROR_TEXT : SIZE_TEXT, children: failed ? file.error ?? t.uploadFailed : formatFileSize(file.size) }),
467
+ fill && failed ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
468
+ /* @__PURE__ */ jsx(Separator, { orientation: "vertical", length: "sm", tone: "strong", decorative: true }),
469
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
470
+ /* @__PURE__ */ jsx(StatusGlyph, { "aria-hidden": "true", className: cn("size-4", status.glyphClass) }),
471
+ fill ? (
472
+ // No `<Progress>` in this treatment, so the readout is the wash's only number.
473
+ /* @__PURE__ */ jsx("p", { className: cn("text-sm tabular-nums", failed ? status.wordClass : "text-tertiary"), children: failed ? statusWord : `${progress}%` })
474
+ ) : /* @__PURE__ */ jsx("p", { className: cn("text-sm font-medium", status.wordClass), children: statusWord })
475
+ ] })
476
+ ] })
477
+ ] });
478
+ const body = /* @__PURE__ */ jsxs("div", { className: "relative flex min-w-0 flex-1 flex-col items-start", children: [
479
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full min-w-0 flex-1", children: [
480
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
481
+ /* @__PURE__ */ jsx("p", { className: NAME, children: file.name }),
482
+ meta
483
+ ] }),
484
+ affordance
485
+ ] }),
486
+ !fill && file.status === "uploading" ? /* @__PURE__ */ jsx("div", { className: "mt-1 w-full", children: /* @__PURE__ */ jsx(Progress, { value: progress, valuePosition: "right", "aria-label": t.uploading({ name: file.name }) }) }) : null,
487
+ retry
488
+ ] });
489
+ if (!fill) {
490
+ return /* @__PURE__ */ jsxs("li", { className: cn(ROW, failed ? ROW_RING_FAILED : ROW_RING), children: [
491
+ glyph,
492
+ body
493
+ ] });
494
+ }
495
+ return /* @__PURE__ */ jsxs("li", { className: FILL_ROW, children: [
496
+ /* @__PURE__ */ jsx(
497
+ "div",
498
+ {
499
+ role: "progressbar",
500
+ "aria-valuenow": progress,
501
+ "aria-valuemin": 0,
502
+ "aria-valuemax": 100,
503
+ "aria-label": t.uploading({ name: file.name }),
504
+ style: { transform: `translateX(-${100 - progress}%)` },
505
+ className: cn(FILL_WASH, file.status === "complete" && "opacity-0")
506
+ }
507
+ ),
508
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: cn(FILL_RING, failed ? ROW_RING_FAILED : ROW_RING) }),
509
+ /* @__PURE__ */ jsx("div", { className: "relative", children: glyph }),
510
+ body
511
+ ] });
512
+ }
513
+ function FileList(props) {
514
+ const { files, treatment = "bar", onRemove, onCancel, onRetry, fileIcon, labels, className, ...rest } = props;
515
+ const t = useLabels("fileList", FILE_LIST_LABELS, labels);
516
+ if (files.length === 0) return null;
517
+ return /* @__PURE__ */ jsx("ul", { ...rest, className: cn(LIST, className), children: files.map((file) => (
518
+ // Keyed on `id`, never the index — reordering must move a row, not remount it.
519
+ /* @__PURE__ */ jsx(Row, { file, treatment, onRemove, onCancel, onRetry, fileIcon, t }, file.id)
520
+ )) });
521
+ }
522
+
523
+ export { Dropzone, FILE_TONE, FILE_TONE_BUCKETS, FileList, FileTypeGlyph, GLYPH_BOX, bucketFiles, extensionTone, fileExtension, fileGlyphSource, fileTone, formatFileSize, invalidAcceptEntries, isFileTypeAccepted, toUploadFile };
524
+ //# sourceMappingURL=chunk-HHYEAFCL.js.map
525
+ //# sourceMappingURL=chunk-HHYEAFCL.js.map
@@ -1,7 +1,7 @@
1
- import { FieldShell } from './chunk-QA74ITR4.js';
2
- import { useSeamlessSlot, warnSeamlessFieldChrome, SEAMLESS_BOX } from './chunk-KNYKWUYX.js';
3
- import { useFieldValidity, FieldFrame } from './chunk-J2BCKBHC.js';
4
- import { ChevronDownIcon } from './chunk-24TO7E32.js';
1
+ import { FieldShell } from './chunk-X2VMIBK5.js';
2
+ import { useFieldValidity, FieldFrame } from './chunk-5KSD4WKN.js';
3
+ import { useSeamlessSlot, warnSeamlessFieldChrome, SEAMLESS_BOX } from './chunk-7ZM7SNCZ.js';
4
+ import { ChevronDownIcon } from './chunk-BLIZ3CL3.js';
5
5
  import { cn } from './chunk-ZSNJ6UA3.js';
6
6
  import { Field } from '@base-ui/react/field';
7
7
  import 'react';
@@ -134,5 +134,5 @@ function NativeSelect(props) {
134
134
  }
135
135
 
136
136
  export { NativeSelect };
137
- //# sourceMappingURL=chunk-LME57Z6J.js.map
138
- //# sourceMappingURL=chunk-LME57Z6J.js.map
137
+ //# sourceMappingURL=chunk-I6WMNXC7.js.map
138
+ //# sourceMappingURL=chunk-I6WMNXC7.js.map