jenosize-ui 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +10 -7
  2. package/dist/Cartesian-ZIKPEYWP.d.ts +26 -0
  3. package/dist/area-chart.d.ts +53 -0
  4. package/dist/area-chart.js +8 -0
  5. package/dist/avatar.d.ts +19 -0
  6. package/dist/avatar.js +12 -7
  7. package/dist/badge.js +5 -5
  8. package/dist/bar-chart.d.ts +31 -0
  9. package/dist/bar-chart.js +8 -0
  10. package/dist/breadcrumb.js +3 -3
  11. package/dist/button.d.ts +11 -1
  12. package/dist/button.js +9 -8
  13. package/dist/calendar.js +14 -12
  14. package/dist/callout.js +10 -9
  15. package/dist/card.d.ts +52 -2
  16. package/dist/card.js +6 -2
  17. package/dist/checkbox.js +6 -5
  18. package/dist/chunk-34J5AANZ.js +605 -0
  19. package/dist/{chunk-D6TPWNRK.js → chunk-3GT43XPK.js} +5 -5
  20. package/dist/{chunk-3Y5X7B5C.js → chunk-3Z3SDKIA.js} +6 -11
  21. package/dist/{chunk-MQGD2OUF.js → chunk-42FCPC77.js} +3 -3
  22. package/dist/{chunk-Z3ETJN5G.js → chunk-4BRMM3I5.js} +6 -11
  23. package/dist/{chunk-WZQFC7ZN.js → chunk-4HKDD3PR.js} +55 -16
  24. package/dist/chunk-4K6V6NNK.js +169 -0
  25. package/dist/{chunk-ZZA2LUTL.js → chunk-4R7WDDCW.js} +41 -16
  26. package/dist/{chunk-BJUZVYQC.js → chunk-4W6AYGLR.js} +12 -12
  27. package/dist/{chunk-4OLULPQG.js → chunk-54S5CUY6.js} +8 -5
  28. package/dist/{chunk-GRLSUQQE.js → chunk-5JRM3OES.js} +4 -4
  29. package/dist/chunk-5ZPUAGOP.js +19 -0
  30. package/dist/{chunk-W5GGOUUI.js → chunk-6HJA7NPL.js} +3 -3
  31. package/dist/{chunk-CME4DIML.js → chunk-6IUTVDNI.js} +22 -3
  32. package/dist/chunk-6UBYHSBX.js +147 -0
  33. package/dist/{chunk-HMUZE6EK.js → chunk-74HPBSVY.js} +3 -3
  34. package/dist/chunk-75M43ELV.js +366 -0
  35. package/dist/chunk-763VS2FY.js +10 -0
  36. package/dist/chunk-7HV6EIGZ.js +26 -0
  37. package/dist/chunk-7VLYQR4D.js +44 -0
  38. package/dist/{chunk-D5BTFSL7.js → chunk-A46ED5JQ.js} +3 -3
  39. package/dist/{chunk-W46K56XU.js → chunk-A5WQLN4B.js} +8 -24
  40. package/dist/chunk-AC6ZWKRN.js +23 -0
  41. package/dist/{chunk-E7ZSWBAK.js → chunk-BD5YKFRA.js} +4 -4
  42. package/dist/chunk-BLIZ3CL3.js +49 -0
  43. package/dist/{chunk-DRZCJCBO.js → chunk-BNIWT6CW.js} +4 -4
  44. package/dist/{chunk-JVJRHBTD.js → chunk-C6OTOTKI.js} +21 -8
  45. package/dist/chunk-CTENRS34.js +60 -0
  46. package/dist/{chunk-7IU5TMFL.js → chunk-CWMFEF6R.js} +75 -27
  47. package/dist/{chunk-JTNFJLIY.js → chunk-DCGTB7P7.js} +13 -13
  48. package/dist/{chunk-GFOAJVW5.js → chunk-DJYWPJZ3.js} +3 -3
  49. package/dist/{chunk-MUFHLP4S.js → chunk-DTMYD63D.js} +11 -22
  50. package/dist/{chunk-KDLPXXD2.js → chunk-EDOUI2BG.js} +4 -4
  51. package/dist/{chunk-R6RGJF4L.js → chunk-EDT5J5WK.js} +4 -4
  52. package/dist/{chunk-PWKWNDBS.js → chunk-EX374YWB.js} +6 -6
  53. package/dist/{chunk-F2K7VJUV.js → chunk-FFTRB2UU.js} +4 -4
  54. package/dist/chunk-FIGBJGH2.js +1474 -0
  55. package/dist/chunk-FKVPAEJ6.js +57 -0
  56. package/dist/{chunk-J7ZQQFPT.js → chunk-FZBZGA3P.js} +17 -17
  57. package/dist/{chunk-T7FCG7XV.js → chunk-GAFGIT4Q.js} +10 -10
  58. package/dist/chunk-HSVBTIP2.js +482 -0
  59. package/dist/{chunk-FHHAPGCR.js → chunk-ILICYNK7.js} +3 -3
  60. package/dist/{chunk-WFY7DKQD.js → chunk-JAVNGTOE.js} +9 -14
  61. package/dist/{chunk-7HOIZ3UO.js → chunk-JMWYCT63.js} +6 -6
  62. package/dist/{chunk-QA74ITR4.js → chunk-JUWDRRD6.js} +45 -17
  63. package/dist/{chunk-BVJWBYIG.js → chunk-JXHZHUB3.js} +4 -4
  64. package/dist/{chunk-VWC72TR3.js → chunk-JYBGO6GY.js} +7 -7
  65. package/dist/{chunk-J36M3KRX.js → chunk-L53Y7KUV.js} +13 -11
  66. package/dist/chunk-LBYCCLVI.js +33 -0
  67. package/dist/chunk-LCG34A5T.js +98 -0
  68. package/dist/chunk-M5TVCASC.js +75 -0
  69. package/dist/chunk-MCUASLZH.js +10 -0
  70. package/dist/{chunk-5RAPA22E.js → chunk-MD4AR43X.js} +4 -4
  71. package/dist/{chunk-JP26LPCY.js → chunk-MYQ3FD4Y.js} +25 -11
  72. package/dist/chunk-NA35YZRD.js +252 -0
  73. package/dist/chunk-NKDW6C7K.js +10 -0
  74. package/dist/{chunk-5NOBSXJN.js → chunk-NMERLWT7.js} +6 -6
  75. package/dist/{chunk-KMSYEE23.js → chunk-P6CON2R2.js} +25 -11
  76. package/dist/{chunk-LME57Z6J.js → chunk-P7DH62UY.js} +6 -6
  77. package/dist/chunk-PO2TYK3C.js +17 -0
  78. package/dist/{chunk-5FATN5YD.js → chunk-PXEJ5RKO.js} +4 -4
  79. package/dist/{chunk-JYGR44ZC.js → chunk-QBHQOX23.js} +6 -6
  80. package/dist/{chunk-GCVA3OIV.js → chunk-QDYE5LVT.js} +13 -3
  81. package/dist/{chunk-J2BCKBHC.js → chunk-QKDEQFOQ.js} +4 -4
  82. package/dist/{chunk-ZOOX3TUB.js → chunk-RIXEUAPY.js} +5 -5
  83. package/dist/{chunk-THC2ISYP.js → chunk-RNXRZGXN.js} +4 -4
  84. package/dist/{chunk-7EWQKTNQ.js → chunk-T2WAD4QP.js} +15 -13
  85. package/dist/{chunk-KNYKWUYX.js → chunk-TBN644IN.js} +3 -3
  86. package/dist/{chunk-MKC5HNA7.js → chunk-USL3TDZM.js} +101 -90
  87. package/dist/{chunk-CYPPEUX5.js → chunk-VEOYCAJP.js} +4 -9
  88. package/dist/{chunk-WEUJYDCV.js → chunk-VH35QHD4.js} +6 -6
  89. package/dist/chunk-VWGAMOSE.js +188 -0
  90. package/dist/{chunk-SV56BSUQ.js → chunk-WKWAUU64.js} +4 -4
  91. package/dist/chunk-X2X7Q7NW.js +17 -0
  92. package/dist/{chunk-I7WU4GTY.js → chunk-YLEHYDXC.js} +5 -5
  93. package/dist/combobox.js +12 -10
  94. package/dist/control-size-CaxQhkKh.d.ts +3 -0
  95. package/dist/date-input.js +9 -8
  96. package/dist/date-picker.js +20 -17
  97. package/dist/dialog.d.ts +16 -4
  98. package/dist/dialog.js +8 -6
  99. package/dist/drawer.d.ts +9 -2
  100. package/dist/drawer.js +7 -5
  101. package/dist/dropdown-menu.d.ts +14 -2
  102. package/dist/dropdown-menu.js +7 -3
  103. package/dist/dropzone.d.ts +34 -0
  104. package/dist/dropzone.js +22 -0
  105. package/dist/form.d.ts +78 -0
  106. package/dist/form.js +176 -32
  107. package/dist/header-navigation.d.ts +15 -4
  108. package/dist/header-navigation.js +19 -14
  109. package/dist/index.d.ts +26 -4
  110. package/dist/index.js +76 -56
  111. package/dist/indicator.js +4 -4
  112. package/dist/input.js +8 -7
  113. package/dist/kanban-board.d.ts +549 -0
  114. package/dist/kanban-board.js +23 -0
  115. package/dist/line-chart.d.ts +35 -0
  116. package/dist/line-chart.js +8 -0
  117. package/dist/{nav-Bla0o_-1.d.ts → nav-DcCyt00p.d.ts} +8 -11
  118. package/dist/number-input.js +8 -7
  119. package/dist/pagination.js +12 -9
  120. package/dist/panel-El4oI68p.d.ts +9 -0
  121. package/dist/payment-input.js +8 -7
  122. package/dist/pie-chart.d.ts +60 -0
  123. package/dist/pie-chart.js +8 -0
  124. package/dist/popover.d.ts +9 -3
  125. package/dist/popover.js +7 -5
  126. package/dist/progress-steps.d.ts +275 -0
  127. package/dist/progress-steps.js +8 -0
  128. package/dist/progress.js +2 -2
  129. package/dist/radar-chart.d.ts +73 -0
  130. package/dist/radar-chart.js +8 -0
  131. package/dist/radial-chart.d.ts +69 -0
  132. package/dist/radial-chart.js +8 -0
  133. package/dist/radio.js +6 -5
  134. package/dist/rule-BqzaIwJy.d.ts +80 -0
  135. package/dist/scroll-area.d.ts +62 -0
  136. package/dist/scroll-area.js +7 -0
  137. package/dist/select.d.ts +1 -2
  138. package/dist/select.js +15 -13
  139. package/dist/separator.d.ts +114 -0
  140. package/dist/separator.js +5 -0
  141. package/dist/sidebar-navigation.d.ts +54 -7
  142. package/dist/sidebar-navigation.js +15 -8
  143. package/dist/skeleton.d.ts +61 -0
  144. package/dist/skeleton.js +5 -0
  145. package/dist/styles.css +1 -1
  146. package/dist/surface-DFyDnrTJ.d.ts +34 -0
  147. package/dist/switch.js +2 -2
  148. package/dist/table.d.ts +94 -38
  149. package/dist/table.js +32 -28
  150. package/dist/tabs.js +2 -2
  151. package/dist/tag-input.js +11 -10
  152. package/dist/tag.js +3 -3
  153. package/dist/textarea.js +6 -5
  154. package/dist/theme.css +82 -0
  155. package/dist/theme.js +10 -9
  156. package/dist/toast.js +10 -9
  157. package/dist/tooltip-surface-Dmvb8v5K.d.ts +35 -0
  158. package/dist/tooltip.d.ts +15 -1
  159. package/dist/tooltip.js +3 -2
  160. package/dist/tree.js +6 -5
  161. package/dist/types-6kvYwtRH.d.ts +156 -0
  162. package/dist/use-uploads-ButS4dGe.d.ts +473 -0
  163. package/dist/verification-code-input.d.ts +84 -0
  164. package/dist/verification-code-input.js +13 -0
  165. package/package.json +59 -9
  166. package/dist/card-nWicloNi.d.ts +0 -80
  167. package/dist/chunk-24TO7E32.js +0 -42
  168. package/dist/chunk-FXIBGTS5.js +0 -14
  169. package/dist/chunk-ZZT2E5VT.js +0 -24
@@ -0,0 +1,473 @@
1
+ import { useRender } from '@base-ui/react/use-render';
2
+ import * as React from 'react';
3
+ import { S as SemanticColor } from './color-CtSxc1Rh.js';
4
+
5
+ interface DropFileEntry {
6
+ isFile: true;
7
+ isDirectory?: false;
8
+ name: string;
9
+ file: (onSuccess: (file: File) => void, onError?: (error: unknown) => void) => void;
10
+ }
11
+ interface DropDirectoryEntry {
12
+ isFile?: false;
13
+ isDirectory: true;
14
+ name: string;
15
+ createReader: () => {
16
+ readEntries: (onSuccess: (entries: DropEntry[]) => void, onError?: (error: unknown) => void) => void;
17
+ };
18
+ }
19
+ type DropEntry = DropFileEntry | DropDirectoryEntry;
20
+ /** Reads the filesystem entry behind one dragged item, or `null` where the platform has no such API. */
21
+ type EntryReader = (item: DataTransferItem) => DropEntry | null;
22
+
23
+ /**
24
+ * Where a file is in its upload.
25
+ *
26
+ * There is no `"queued"`: a file the caller has not started is simply not in `files` yet, and a
27
+ * fourth member would invent a state with no visual. A closed set, so every behaviour derived from
28
+ * it lives in ONE table (`STATUS` in `FileList.tsx`) — never re-derived from `progress === 100`,
29
+ * which is the reference's own bug (a file at 100% that the server then rejects renders as both).
30
+ */
31
+ type UploadStatus = "uploading" | "complete" | "failed";
32
+ /**
33
+ * ONE row of a {@link FileList}.
34
+ *
35
+ * Scalar `name`/`size`/`type` rather than a wrapped `File`, deliberately: a row must be able to
36
+ * describe an attachment fetched from an API after a reload, where no `File` object exists —
37
+ * wrapping one would force `new File([], name)` with a lying `size` for that case.
38
+ * {@link toUploadFile} covers the fresh-pick path in one `.map()`.
39
+ */
40
+ interface UploadFile {
41
+ /** Stable identity. REQUIRED — it is the React key, and every callback hands this row back. */
42
+ id: string;
43
+ /** File name as displayed. Truncates at the row's width. */
44
+ name: string;
45
+ /** Size in bytes. Rendered through {@link formatFileSize}. */
46
+ size: number;
47
+ /** Which of the three states this row is in. Drives the affordance from one table. */
48
+ status: UploadStatus;
49
+ /** 0–100. Meaningful only while `status === "uploading"`; ignored otherwise. */
50
+ progress?: number;
51
+ /** MIME type (`"application/pdf"`) or a bare extension (`"pdf"`). Both are accepted — the
52
+ * reference's own demos pass each. Drives the glyph only. */
53
+ type?: string;
54
+ /** Shown in place of the size line while `status === "failed"`. Free text. */
55
+ error?: string;
56
+ }
57
+ /**
58
+ * Why a dropped file did not make it through.
59
+ *
60
+ * A closed set, so a future rule is a new MEMBER — never a fourth callback. (The reference ships
61
+ * three separate drop callbacks, all of which can fire from ONE drop.)
62
+ */
63
+ type FileRejectReason = "type" | "size" | "count" | "directory";
64
+ interface FileRejection {
65
+ /** The file that was refused. A directory rejection carries a zero-byte stand-in named after it. */
66
+ file: File;
67
+ /** The ONE reason it was refused. A file never appears twice. */
68
+ reason: FileRejectReason;
69
+ }
70
+ /** What {@link bucketFiles} decides against. Mirrors the `Dropzone` props of the same names. */
71
+ interface FileRules {
72
+ /** HTML `accept` grammar — `"image/*"`, `".pdf,image/*"`. Absent/empty accepts everything. */
73
+ accept?: string;
74
+ /** @default true */
75
+ multiple?: boolean;
76
+ /** Bytes. */
77
+ maxSize?: number;
78
+ /** Total files allowed, counting {@link existingCount}. */
79
+ maxFiles?: number;
80
+ /** How many are already accepted — `maxFiles` counts the whole list, not one drop. @default 0 */
81
+ existingCount?: number;
82
+ }
83
+ /**
84
+ * Bytes → a short human string.
85
+ *
86
+ * Diverges from the reference's `getReadableFileSize` in exactly two places, both of which are bugs
87
+ * there rather than house style:
88
+ * · it TRUNCATES (`Math.floor`), so 1,992,294 prints `"1 MB"` — we round to 1 decimal above KB
89
+ * and print `"1.9 MB"`;
90
+ * · zero returns `"0 KB"` — we return `"0 B"`, because zero bytes is not zero kilobytes.
91
+ *
92
+ * A negative or non-finite input also returns `"0 B"`; the reference returns `"NaN undefined"`.
93
+ *
94
+ * Public, because a caller rendering their own row must be able to match ours exactly.
95
+ */
96
+ declare function formatFileSize(bytes: number): string;
97
+ /**
98
+ * `File` → a fresh {@link UploadFile} in the `"uploading"` state at 0%.
99
+ *
100
+ * `id` uses `crypto.randomUUID()` where available and a monotonic counter otherwise, so two files
101
+ * with the SAME name still get distinct rows.
102
+ */
103
+ declare function toUploadFile(file: File): UploadFile;
104
+ /**
105
+ * Does `file` satisfy an HTML `accept` grammar?
106
+ *
107
+ * Three forms, per the platform: a leading-dot extension (`.pdf`), a `type/*` wildcard
108
+ * (`image/*`), and an exact MIME (`application/pdf`). Case-insensitive throughout. An absent or
109
+ * empty `accept` accepts everything.
110
+ */
111
+ declare function isFileTypeAccepted(file: File, accept?: string): boolean;
112
+ /** Every `accept` entry that can never match anything — a dev-warn feeds on this. `"pdf"` (no dot,
113
+ * no slash) is the one everybody writes, and it silently accepts nothing at all. */
114
+ declare function invalidAcceptEntries(accept: string): string[];
115
+ interface BucketResult {
116
+ accepted: File[];
117
+ rejections: FileRejection[];
118
+ }
119
+ /**
120
+ * Split a drop into what passes and what does not, in ONE pass.
121
+ *
122
+ * Order matters and is the reference's: **size is checked before type**, so an oversized `.exe`
123
+ * against `accept=".pdf"` rejects as `"size"`. Every file appears exactly once, with exactly one
124
+ * reason.
125
+ *
126
+ * `multiple: false` accepts the first file and rejects the rest as `"count"`; `maxFiles` bounds the
127
+ * whole LIST, so it counts `existingCount` as already spent.
128
+ */
129
+ declare function bucketFiles(files: readonly File[], rules?: FileRules): BucketResult;
130
+ /**
131
+ * The bare extension, lowercased, from a file name OR a MIME string.
132
+ *
133
+ * `"report.PDF"` → `"pdf"`, `"application/pdf"` → `"pdf"`, `"image/svg+xml"` → `"svg"`.
134
+ * A name with no dot and no slash is already an extension (`"pdf"` → `"pdf"`); a name with neither
135
+ * an extension nor a type returns `""`.
136
+ */
137
+ declare function fileExtension(nameOrType: string): string;
138
+ /**
139
+ * ONE table. A file type decides its tone here and nowhere else.
140
+ *
141
+ * Six buckets for the six {@link SemanticColor} members — no new hue vocabulary, because
142
+ * `src/lib/color.ts` already owns the AA-proven fill+white-label recipe. Anything unlisted, and any
143
+ * file with no type at all, is `neutral`.
144
+ *
145
+ * Exported so the Icons page can enumerate the real map rather than a hand-kept copy that goes stale.
146
+ *
147
+ * `as const satisfies` rather than an annotation, because the two do opposite things to the KEYS:
148
+ * `Record<string, SemanticColor>` widens them to `string`, so `keyof typeof FILE_TONE` was `string`
149
+ * and the 27 members this table owns were invisible to the type system — a caller could not tell
150
+ * `"xlsx"` from a typo, and neither could we. `satisfies` still proves every value is a real
151
+ * {@link SemanticColor}, so a bad tone is caught exactly as before.
152
+ */
153
+ declare const FILE_TONE: {
154
+ readonly pdf: "error";
155
+ readonly doc: "info";
156
+ readonly docx: "info";
157
+ readonly txt: "info";
158
+ readonly rtf: "info";
159
+ readonly md: "info";
160
+ readonly pages: "info";
161
+ readonly xls: "success";
162
+ readonly xlsx: "success";
163
+ readonly csv: "success";
164
+ readonly numbers: "success";
165
+ readonly png: "brand";
166
+ readonly jpg: "brand";
167
+ readonly jpeg: "brand";
168
+ readonly gif: "brand";
169
+ readonly svg: "brand";
170
+ readonly webp: "brand";
171
+ readonly avif: "brand";
172
+ readonly heic: "brand";
173
+ readonly zip: "warning";
174
+ readonly rar: "warning";
175
+ readonly "7z": "warning";
176
+ readonly tar: "warning";
177
+ readonly gz: "warning";
178
+ };
179
+ /**
180
+ * The extensions {@link FILE_TONE} actually names — the STRICT half of {@link FileExtension}.
181
+ *
182
+ * Annotate a literal with it (`const ext: KnownFileExtension = "xlsx"`) and a typo becomes a compile
183
+ * error instead of a silently neutral chip. `FileTypeGlyph.extension` is the half-open union rather
184
+ * than this one, because a real filesystem produces extensions no table can enumerate: anything
185
+ * outside this set still renders — as `neutral`, by design — so widening the table is never a
186
+ * breaking change for a caller who did not opt in.
187
+ */
188
+ type KnownFileExtension = keyof typeof FILE_TONE;
189
+ /**
190
+ * What `FileTypeGlyph.extension` accepts: a known member, or any other extension.
191
+ *
192
+ * The `(string & {})` half is the standard trick for a **half-open** set: `KnownFileExtension` alone
193
+ * would refuse the `.parquet` a user can genuinely drop, while a plain `string` would absorb the
194
+ * literal members and stop them autocompleting.
195
+ *
196
+ * **Be honest about what that buys.** `string & {}` is structurally IDENTICAL to `string`, so this
197
+ * type accepts exactly what `string` accepts and rejects nothing a `string` would not — a typo like
198
+ * `"xlxs"` still compiles. The intersection is an EDITOR affordance (TypeScript keeps the 27 members
199
+ * in the completion list rather than collapsing them), not a guarantee, and no type-level probe can
200
+ * assert it; `Dropzone.test-d.tsx` says so where a reader would otherwise assume the opposite. The
201
+ * enforceable half is {@link KnownFileExtension}, which a caller opts into on a literal.
202
+ */
203
+ type FileExtension = KnownFileExtension | (string & {});
204
+ /**
205
+ * The tone for an extension already parsed out — the lookup {@link fileTone} performs, exposed on
206
+ * its own because `FileTypeGlyph` takes the extension directly and must not re-parse a name.
207
+ *
208
+ * The cast widens the table's literal keys back to a string index on purpose: the keys are literals
209
+ * so that {@link KnownFileExtension} exists, but the ARGUMENT here is half-open, and a
210
+ * `KnownFileExtension`-keyed read would reject exactly the unlisted extensions this exists to answer
211
+ * `"neutral"` for. `noUncheckedIndexedAccess` keeps the `??` load-bearing.
212
+ */
213
+ declare function extensionTone(extension: FileExtension): SemanticColor;
214
+ /** The tone buckets in render order, for the Icons-page reference grid. */
215
+ declare const FILE_TONE_BUCKETS: readonly {
216
+ tone: SemanticColor;
217
+ label: string;
218
+ extensions: readonly string[];
219
+ }[];
220
+ /** The tone for a whole file name or MIME string — parse, then look up. Never `undefined`.
221
+ *
222
+ * Kept as the one-call convenience for a caller holding a name; `FileTypeGlyph` itself does NOT use
223
+ * it, because its prop is already the extension. Both routes end in {@link extensionTone}, so there
224
+ * is still exactly one table and one answer. */
225
+ declare function fileTone(nameOrType: string | undefined): SemanticColor;
226
+ /**
227
+ * Which string the glyph should read for a row: the MIME when it names a type a reader recognises,
228
+ * and the file NAME otherwise.
229
+ *
230
+ * The `type` alone is not enough, and this is not a corner case — `application/vnd.ms-excel` is what
231
+ * every browser reports for an `.xlsx`, and reading it literally printed a `VND.` chip in the neutral
232
+ * tone. The NAME still says `xlsx`. The name alone is not enough either: an API-supplied attachment
233
+ * may carry a MIME and no extension at all.
234
+ */
235
+ declare function fileGlyphSource(file: {
236
+ name: string;
237
+ type?: string;
238
+ }): string;
239
+ /** The 40px tile both the dropzone hero and the file glyph sit in — one recipe, one place. */
240
+ declare const GLYPH_BOX = "relative size-10 shrink-0";
241
+
242
+ interface DropzoneProps extends Omit<useRender.ComponentProps<"button">, "children" | "onChange" | "color"> {
243
+ /**
244
+ * HTML `accept` grammar — `"image/*"`, `".pdf,image/*"`, `"application/pdf"`.
245
+ *
246
+ * Filters the picker dialog AND is re-checked on drop, because a drop bypasses the dialog
247
+ * entirely. Dev-warns on an entry that can never match (`"pdf"` with no dot and no slash is the
248
+ * one everybody writes).
249
+ */
250
+ accept?: string;
251
+ /** Allow more than one file per drop/pick. @default true */
252
+ multiple?: boolean;
253
+ /** Largest accepted file, in bytes. Anything over rejects with reason `"size"`. */
254
+ maxSize?: number;
255
+ /** Total files allowed, counting the {@link fileCount} the caller already holds. */
256
+ maxFiles?: number;
257
+ /** How many files are already accepted, so {@link maxFiles} bounds the LIST and not one drop.
258
+ * @default 0 */
259
+ fileCount?: number;
260
+ /** Walk a dropped folder recursively. Pairs with `FileTrigger.acceptDirectory` for the picker
261
+ * path. With it off, a dropped folder rejects as `"directory"` rather than vanishing.
262
+ * @default false */
263
+ acceptDirectory?: boolean;
264
+ /** Files that passed every rule. Named after the sibling `FileTrigger.onFilesChange`. */
265
+ onFilesChange?: (files: File[]) => void;
266
+ /** Everything that did not, each with exactly ONE reason. Fires with a non-empty array or not at
267
+ * all — never with `[]`. */
268
+ onReject?: (rejections: readonly FileRejection[]) => void;
269
+ /** Visible label (`Field.Label`), auto-associated with the surface. */
270
+ label?: React.ReactNode;
271
+ /** Help-circle tooltip after the label (title line). @see tooltipDescription */
272
+ tooltip?: string;
273
+ /** Optional secondary line under {@link tooltip} in the tooltip surface. */
274
+ tooltipDescription?: string;
275
+ /** Helper text UNDER the surface (`Field.Description`) — "SVG, PNG, JPG or GIF (max 800×400px)".
276
+ * Hidden while an `error` shows. Placed under the field, not inside the box, so it sits exactly
277
+ * where every sibling Field control puts its hint. */
278
+ hint?: React.ReactNode;
279
+ /** Append a required `*` after the label. @default false */
280
+ required?: boolean;
281
+ /** Suppress the visual `*` while keeping `required` semantics. @default false */
282
+ hideRequiredIndicator?: boolean;
283
+ /** Error state: red edge and `aria-invalid`. A non-empty {@link error} implies it. @default false */
284
+ invalid?: boolean;
285
+ /** Error message (`Field.Error`). A non-empty value also implies {@link invalid}. */
286
+ error?: string;
287
+ /** Blocks click, keyboard AND drop, and reaches `Field.Root`. @default false */
288
+ disabled?: boolean;
289
+ /** Whether the field column takes `w-full`. Only OBSERVABLE where the parent would otherwise let
290
+ * the column shrink-to-fit (a flex row / grid cell). Bound it with a width in `className`.
291
+ * @default true */
292
+ fullWidth?: boolean;
293
+ /** Layout/spacing only, merged via `cn()` onto the field column. Never restyles the surface. */
294
+ className?: string;
295
+ }
296
+ /** INTERNAL escape hatch for the tests: swap the `webkitGetAsEntry` reader for a fake tree. Not a
297
+ * prop — a public seam here would be a second data channel into the same drop. */
298
+ interface InternalProps {
299
+ _readEntry?: EntryReader;
300
+ }
301
+ declare function Dropzone(props: DropzoneProps & InternalProps): React.JSX.Element;
302
+
303
+ /** Which row treatment. The same prop name `Table` already uses for the same kind of choice. */
304
+ type FileListTreatment = "bar" | "fill";
305
+ interface FileListProps extends Omit<React.ComponentPropsWithoutRef<"ul">, "children"> {
306
+ /** **Required.** The rows. The ONLY data channel — there is no self-managed mode. */
307
+ files: readonly UploadFile[];
308
+ /** `bar` puts a `<Progress>` under the meta line; `fill` washes the whole row and reads a bare
309
+ * percentage. @default "bar" */
310
+ treatment?: FileListTreatment;
311
+ /** Remove the row. Offered on every status EXCEPT `"uploading"`, where {@link onCancel} takes
312
+ * over. Omit it and the affordance is absent — never a disabled ghost. */
313
+ onRemove?: (file: UploadFile) => void;
314
+ /** Stop an upload in flight. Offered only while `status === "uploading"`. The `AbortController`
315
+ * stays the caller's — this only gives the act its own affordance. */
316
+ onCancel?: (file: UploadFile) => void;
317
+ /** Retry. Offered only while `status === "failed"`, as a "Try again" link under the row. */
318
+ onRetry?: (file: UploadFile) => void;
319
+ /** Override the 40px glyph. A function of DATA → NODE, the same category `TabItem.content` and
320
+ * `Table`'s `cell` occupy — it chooses what a glyph SAYS, never how the row is built. Its return
321
+ * is never `aria-hidden`-wrapped: that is the caller's node and the caller owns its semantics. */
322
+ fileIcon?: (file: UploadFile) => React.ReactNode;
323
+ /** Layout/spacing only, merged via `cn()` onto the `<ul>`. Never reaches a row. */
324
+ className?: string;
325
+ }
326
+ /**
327
+ * The rows an upload produces — one `<li>` per file, in whichever treatment the host picks.
328
+ *
329
+ * An EMPTY list renders **nothing at all**: no `<ul>`, no placeholder. The `<Dropzone>` above it is
330
+ * already the empty state, and `Callout` is a full-panel block by its own spec — which is why there
331
+ * is no `empty` / `emptyMessage` prop to pass.
332
+ */
333
+ declare function FileList(props: FileListProps): React.JSX.Element | null;
334
+
335
+ /**
336
+ * What happened to one row.
337
+ *
338
+ * A closed set, so a future transition is a new MEMBER rather than a second callback, and every
339
+ * behaviour derived from it lives in ONE table ({@link reduceUpload}).
340
+ *
341
+ * There is no `"remove"` member on purpose: removing a row is a LIST operation, not a transition of
342
+ * a row, and `rows.filter(…)` is already its correct and obvious spelling.
343
+ */
344
+ type UploadEvent = {
345
+ type: "progress";
346
+ percent: number;
347
+ } | {
348
+ type: "complete";
349
+ } | {
350
+ type: "failed";
351
+ error: string;
352
+ } | {
353
+ type: "retry";
354
+ };
355
+ /**
356
+ * Apply one {@link UploadEvent} to one row. The ONLY correct way to move an {@link UploadFile}
357
+ * between states.
358
+ *
359
+ * Four invariants a hand-written `.map()` keeps getting wrong:
360
+ * · `progress` NEVER touches `status` — a batch that reaches 100% has not been accepted yet, and
361
+ * deriving `"complete"` from the percentage is the reference's own bug;
362
+ * · `complete` pins `progress` to 100, so a row that finished on a `lengthComputable: false`
363
+ * stream does not render a stalled bar next to the word "Complete";
364
+ * · `failed` KEEPS the progress it reached (the bar is hidden at that status anyway) and sets the
365
+ * message the row shows in place of its size;
366
+ * · `retry` clears `error` — forget it and a retrying row shows a stale failure under a moving bar.
367
+ *
368
+ * Returns the same array identity when nothing changed (unknown `id`, or a `progress` event that
369
+ * repeats the percent already stored), so a `setFiles(reduceUpload(…))` cannot spin a render loop
370
+ * on a transport that reports the same integer twice.
371
+ *
372
+ * Exported one layer below {@link useUploads}, for the caller whose rows live somewhere the hook
373
+ * cannot own them — a `useForm` field, a store, or a list fetched from the server on page load.
374
+ */
375
+ declare function reduceUpload(rows: readonly UploadFile[], id: string, event: UploadEvent): UploadFile[];
376
+ /**
377
+ * One batch byte count → a percent per file, by multipart write order.
378
+ *
379
+ * A request carrying M files reports ONE `loaded` for the whole body, so per-file progress has to be
380
+ * attributed rather than measured. Multipart writes its parts sequentially in the order they were
381
+ * appended, so the cumulative byte count maps onto the prefix sums of the sizes: everything before
382
+ * the write head is 100, the part straddling it is partial, everything after is 0.
383
+ *
384
+ * Part headers and boundary delimiters are ignored — they are tens of bytes against a payload
385
+ * measured in megabytes, and counting them would require knowing the boundary string, which belongs
386
+ * to the caller's transport.
387
+ *
388
+ * A zero-byte file reads 100 as soon as the head reaches it: it has no bytes left to send.
389
+ */
390
+ declare function splitBatchProgress(sizes: readonly number[], loaded: number): number[];
391
+ /** What a transport is handed. `onProgress` takes 0–100 for the whole request. */
392
+ interface UploadContext {
393
+ /** Aborted by `listProps.onCancel`, by {@link UseUploadsResult.clear}, and on unmount. */
394
+ signal: AbortSignal;
395
+ /**
396
+ * Report the request's progress, 0–100.
397
+ *
398
+ * With `batchSize: 1` this IS the row's percentage. Above 1 it is split across the batch's rows by
399
+ * size, via {@link splitBatchProgress} — pass the whole request's percentage and the hook
400
+ * attributes it. Pass `fileIndex` to address one file of the batch directly instead.
401
+ */
402
+ onProgress: (percent: number, fileIndex?: number) => void;
403
+ }
404
+ /**
405
+ * The caller's wire, and the ONLY thing {@link useUploads} cannot supply.
406
+ *
407
+ * Receives exactly `batchSize` files (one by default) and resolves with **one result per file, in
408
+ * the same order** — that array is what {@link UseUploadsResult.results} is keyed from, and it is
409
+ * what a form actually submits. Reject to fail the request; reject with an `AbortError` (which
410
+ * `AbortController` and `fetch` both produce) and the hook treats it as a cancel rather than a
411
+ * failure, so no red row is left behind.
412
+ */
413
+ type UploadTransport<T = unknown> = (files: File[], ctx: UploadContext) => Promise<readonly T[]>;
414
+ interface UseUploadsOptions<T = unknown> {
415
+ /** **Required.** Your wire. @see UploadTransport */
416
+ transport: UploadTransport<T>;
417
+ /**
418
+ * Files per request.
419
+ *
420
+ * Leave it at 1 unless the payloads are tiny and numerous — a batch endpoint costs you the three
421
+ * per-row affordances `<FileList>` renders. Above 1, `listProps.onCancel` is **withheld** (one
422
+ * request cannot cancel one of its files, and a button that kills the siblings would be lying),
423
+ * a rejected request fails **every** row it carried, and a retry re-sends that ONE file alone
424
+ * rather than re-uploading its healthy siblings. @default 1
425
+ */
426
+ batchSize?: number;
427
+ /**
428
+ * Requests in flight at once; the rest queue.
429
+ *
430
+ * Unlimited is worse than it looks. HTTP/1.1 browsers cap ~6 connections per origin, so anything
431
+ * above that only queues where you cannot see it; on HTTP/2 they all multiplex over one connection
432
+ * and share the same uplink, so twenty uploads each run at a twentieth of the speed and *all
433
+ * twenty* finish late, where three lets seventeen finish early. @default 3
434
+ */
435
+ concurrency?: number;
436
+ }
437
+ interface UseUploadsResult<T = unknown> {
438
+ /** The rows, in pick order. */
439
+ files: UploadFile[];
440
+ /**
441
+ * Spread onto `<FileList>`.
442
+ *
443
+ * A nested bag rather than the top level, because spreading the whole result would push `add` and
444
+ * `clear` onto the `<ul>` as unknown DOM attributes. Override any member after the spread
445
+ * (`<FileList {...uploads.listProps} onRemove={mine} />`) to add your own side-effect.
446
+ */
447
+ listProps: Pick<FileListProps, "files" | "onCancel" | "onRemove" | "onRetry">;
448
+ /** Hand this straight to `<Dropzone onFilesChange>` — the signatures match. */
449
+ add: (files: File[]) => void;
450
+ /** Abort everything in flight and empty the list. */
451
+ clear: () => void;
452
+ /** Rows still uploading, queued ones included. `> 0` is the disable condition for a Save button. */
453
+ activeCount: number;
454
+ /** What your transport resolved with, per completed row. Keyed by `UploadFile.id`. */
455
+ results: ReadonlyMap<string, T>;
456
+ }
457
+ /**
458
+ * Own an upload list: rows, progress, cancel, retry, a concurrency queue, and the results your
459
+ * transport resolved with.
460
+ *
461
+ * ```tsx
462
+ * const uploads = useUploads({
463
+ * transport: ([file], { signal, onProgress }) =>
464
+ * xhrUpload(file, { url: "/api/attachments", signal, onProgress }).then((r) => [r]),
465
+ * });
466
+ *
467
+ * <Dropzone accept="image/*" fileCount={uploads.files.length} onFilesChange={uploads.add} />
468
+ * <FileList {...uploads.listProps} />
469
+ * ```
470
+ */
471
+ declare function useUploads<T = unknown>({ transport, batchSize, concurrency }: UseUploadsOptions<T>): UseUploadsResult<T>;
472
+
473
+ export { useUploads as A, type BucketResult as B, Dropzone as D, FILE_TONE as F, GLYPH_BOX as G, type KnownFileExtension as K, type UploadContext as U, type DropzoneProps as a, FILE_TONE_BUCKETS as b, type FileExtension as c, FileList as d, type FileListProps as e, type FileListTreatment as f, type FileRejectReason as g, type FileRejection as h, type FileRules as i, type UploadEvent as j, type UploadFile as k, type UploadStatus as l, type UploadTransport as m, type UseUploadsOptions as n, type UseUploadsResult as o, bucketFiles as p, extensionTone as q, fileExtension as r, fileGlyphSource as s, fileTone as t, formatFileSize as u, invalidAcceptEntries as v, isFileTypeAccepted as w, reduceUpload as x, splitBatchProgress as y, toUploadFile as z };
@@ -0,0 +1,84 @@
1
+ import * as React from 'react';
2
+ import { C as ControlSize } from './control-size-CaxQhkKh.js';
3
+
4
+ type VerificationCodeInputSize = ControlSize;
5
+ /** What each slot accepts. Drives `inputMode`, the hidden input's validation `pattern`, and which
6
+ * characters a paste keeps. `"none"` accepts anything. */
7
+ type VerificationCodeValidationType = "numeric" | "alpha" | "alphanumeric" | "none";
8
+ /** Which glyph a masked slot shows in place of its character. The switch and its setting are ONE
9
+ * prop (`mask?: false | VerificationCodeMask`), like `useTable({ paginate: false | {…} })` — a
10
+ * separate `maskGlyph` would be silently dead whenever masking is off (AGENTS §11). */
11
+ type VerificationCodeMask = "star" | "dot";
12
+ interface VerificationCodeInputProps extends Omit<React.ComponentPropsWithoutRef<"div">, "onChange" | "defaultValue" | "children"> {
13
+ /**
14
+ * Slot count. A NUMBER renders one flat row (`6` → ▢▢▢▢▢▢). An ARRAY renders groups separated by
15
+ * a dash (`[3, 3]` → ▢▢▢ – ▢▢▢) and the total length is the SUM, so a `length`/`groups`
16
+ * disagreement is unspellable and there is no dev-warn policing a state the type invented.
17
+ *
18
+ * REQUIRED, with no default: a code's length is dictated by whatever service issues it, never by
19
+ * a house opinion.
20
+ */
21
+ length: number | readonly number[];
22
+ /** Box size + inter-box gap + text size. @default "md" */
23
+ size?: VerificationCodeInputSize;
24
+ /** Controlled value — the whole code as one string, shorter than the total while incomplete. */
25
+ value?: string;
26
+ /** Uncontrolled initial value (same shape as {@link VerificationCodeInputProps.value}). */
27
+ defaultValue?: string;
28
+ /** Fires with the WHOLE code on every edit, never a single character. */
29
+ onValueChange?: (value: string) => void;
30
+ /**
31
+ * Fires the moment the last slot fills — including on a paste that completes the code.
32
+ *
33
+ * Prefer this over the group's `onBlur` for validation: blur bubbles, so `onBlur` also fires on
34
+ * every move between slots and would validate mid-entry.
35
+ */
36
+ onComplete?: (value: string) => void;
37
+ /** What each slot accepts. @default "numeric" */
38
+ validationType?: VerificationCodeValidationType;
39
+ /**
40
+ * Hide the entered characters, for PIN entry — `"star"` (✳) or `"dot"` (●), `false` to show them.
41
+ *
42
+ * Either mode renders the slots as `type="password"`, so the real characters stay unreadable and
43
+ * uncopyable; the browser's own bullets are then hidden and WE draw the glyph, because a browser
44
+ * offers no way to choose it (and draws a different one per platform).
45
+ *
46
+ * @default false
47
+ */
48
+ mask?: false | VerificationCodeMask;
49
+ /** Submit the owning `<form>` the instant the code completes. @default false */
50
+ autoSubmit?: boolean;
51
+ /** Show the value but refuse edits. @default false */
52
+ readOnly?: boolean;
53
+ /** Visible label (`Field.Label`), which names the slot group. */
54
+ label?: string;
55
+ /** Help-circle tooltip after the label (title line). @see tooltipDescription */
56
+ tooltip?: string;
57
+ /** Optional secondary line under {@link tooltip} in the tooltip surface. */
58
+ tooltipDescription?: string;
59
+ /** Helper text under the field (`Field.Description`). Hidden while an `error` shows. */
60
+ hint?: React.ReactNode;
61
+ /** Marks the field required for form submission. @default false */
62
+ required?: boolean;
63
+ /** Suppress the visual required `*` while keeping `required` semantics. @default false */
64
+ hideRequiredIndicator?: boolean;
65
+ /** Error state: red edge + error focus ring and `aria-invalid` on every slot. @default false */
66
+ invalid?: boolean;
67
+ /** Optional error message (`Field.Error`). A non-empty `error` also implies `invalid`. */
68
+ error?: string;
69
+ /** Disables every slot. @default false */
70
+ disabled?: boolean;
71
+ /** Whether the field column takes `w-full`. Only OBSERVABLE where the parent would otherwise let
72
+ * the column shrink-to-fit (a flex row / grid cell) — in a plain block container it fills either
73
+ * way. Bound the field with a width in `className` (`w-64`, `max-w-56`). @default true */
74
+ fullWidth?: boolean;
75
+ /** Layout/spacing only (margin, width, flex/grid placement), merged via `cn()`. */
76
+ className?: string;
77
+ /** Name of the hidden submission input `OTPField.Root` renders (form integration). */
78
+ name?: string;
79
+ /** Id of the first slot; the rest derive theirs from it (`{id}-2`, `{id}-3`, …). */
80
+ id?: string;
81
+ }
82
+ declare function VerificationCodeInput(props: VerificationCodeInputProps): React.JSX.Element;
83
+
84
+ export { VerificationCodeInput, type VerificationCodeInputProps, type VerificationCodeInputSize, type VerificationCodeMask, type VerificationCodeValidationType };
@@ -0,0 +1,13 @@
1
+ "use client";export { VerificationCodeInput } from './chunk-6UBYHSBX.js';
2
+ import './chunk-JUWDRRD6.js';
3
+ import './chunk-TBN644IN.js';
4
+ import './chunk-52IFGFTL.js';
5
+ import './chunk-QKDEQFOQ.js';
6
+ import './chunk-4R7WDDCW.js';
7
+ import './chunk-AC6ZWKRN.js';
8
+ import './chunk-O4GRKO3I.js';
9
+ import './chunk-BLIZ3CL3.js';
10
+ import './chunk-QDYE5LVT.js';
11
+ import './chunk-ZSNJ6UA3.js';
12
+ //# sourceMappingURL=verification-code-input.js.map
13
+ //# sourceMappingURL=verification-code-input.js.map