@lerianstudio/sindarian-ui 2.0.0-beta.2 → 2.0.0-beta.21

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 (227) hide show
  1. package/LICENSE +93 -0
  2. package/README.md +52 -1
  3. package/dist/components/breadcrumb/index.d.ts.map +1 -1
  4. package/dist/components/breadcrumb/index.js +25 -1
  5. package/dist/components/card/account-card/index.js +5 -5
  6. package/dist/components/card/basic-card/index.d.ts.map +1 -1
  7. package/dist/components/card/basic-card/index.js +2 -2
  8. package/dist/components/card/entity-card/index.js +1 -1
  9. package/dist/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
  10. package/dist/components/dialog/confirmation-dialog/index.js +4 -1
  11. package/dist/components/entity-box/index.d.ts +18 -2
  12. package/dist/components/entity-box/index.d.ts.map +1 -1
  13. package/dist/components/entity-box/index.js +32 -4
  14. package/dist/components/form/date-picker-field/index.js +1 -1
  15. package/dist/components/form/date-range-field/index.js +1 -1
  16. package/dist/components/form/date-time-picker-field/index.js +1 -1
  17. package/dist/components/form/password-field/index.d.ts +5 -1
  18. package/dist/components/form/password-field/index.d.ts.map +1 -1
  19. package/dist/components/form/password-field/index.js +2 -2
  20. package/dist/components/form/select-field/index.d.ts +15 -1
  21. package/dist/components/form/select-field/index.d.ts.map +1 -1
  22. package/dist/components/form/select-field/index.js +28 -3
  23. package/dist/components/form/switch-field/index.d.ts.map +1 -1
  24. package/dist/components/form/switch-field/index.js +6 -1
  25. package/dist/components/page/index.d.ts +35 -1
  26. package/dist/components/page/index.d.ts.map +1 -1
  27. package/dist/components/page/index.js +6 -2
  28. package/dist/components/page-header/index.js +1 -1
  29. package/dist/components/table/id-table-cell.d.ts +13 -1
  30. package/dist/components/table/id-table-cell.d.ts.map +1 -1
  31. package/dist/components/table/id-table-cell.js +99 -9
  32. package/dist/components/table/index.d.ts +1 -0
  33. package/dist/components/table/index.d.ts.map +1 -1
  34. package/dist/components/table/index.js +1 -0
  35. package/dist/components/table/locked-table-actions.d.ts +24 -0
  36. package/dist/components/table/locked-table-actions.d.ts.map +1 -1
  37. package/dist/components/table/locked-table-actions.js +31 -1
  38. package/dist/components/table/name-table-cell.d.ts +57 -4
  39. package/dist/components/table/name-table-cell.d.ts.map +1 -1
  40. package/dist/components/table/name-table-cell.js +50 -2
  41. package/dist/components/ui/autocomplete/index.d.ts +24 -0
  42. package/dist/components/ui/autocomplete/index.d.ts.map +1 -1
  43. package/dist/components/ui/autocomplete/index.js +24 -0
  44. package/dist/components/ui/badge/index.d.ts +11 -7
  45. package/dist/components/ui/badge/index.d.ts.map +1 -1
  46. package/dist/components/ui/badge/index.js +20 -8
  47. package/dist/components/ui/button/index.d.ts +3 -3
  48. package/dist/components/ui/copy-field/index.d.ts +25 -1
  49. package/dist/components/ui/copy-field/index.d.ts.map +1 -1
  50. package/dist/components/ui/copy-field/index.js +16 -8
  51. package/dist/components/ui/dialog/index.d.ts +1 -1
  52. package/dist/components/ui/dialog/index.d.ts.map +1 -1
  53. package/dist/components/ui/dialog/index.js +2 -2
  54. package/dist/components/ui/file-upload/index.d.ts +159 -0
  55. package/dist/components/ui/file-upload/index.d.ts.map +1 -1
  56. package/dist/components/ui/file-upload/index.js +308 -6
  57. package/dist/components/ui/icon-button/index.d.ts +1 -1
  58. package/dist/components/ui/icon-button/styles.css +42 -0
  59. package/dist/components/ui/input/styles.css +79 -4
  60. package/dist/components/ui/lerian-wordmark/index.d.ts +6 -0
  61. package/dist/components/ui/lerian-wordmark/index.d.ts.map +1 -0
  62. package/dist/components/ui/lerian-wordmark/index.js +7 -0
  63. package/dist/components/ui/otp-input/index.js +1 -1
  64. package/dist/components/ui/radio-group/index.js +1 -1
  65. package/dist/components/ui/select/index.d.ts.map +1 -1
  66. package/dist/components/ui/select/index.js +8 -4
  67. package/dist/components/ui/select/styles.css +1 -1
  68. package/dist/components/ui/sheet/index.d.ts +42 -0
  69. package/dist/components/ui/sheet/index.d.ts.map +1 -1
  70. package/dist/components/ui/sheet/index.js +47 -14
  71. package/dist/components/ui/sidebar/index.d.ts +1 -0
  72. package/dist/components/ui/sidebar/index.d.ts.map +1 -1
  73. package/dist/components/ui/sidebar/index.js +1 -0
  74. package/dist/components/ui/sidebar/sidebar-expand-button.d.ts +1 -1
  75. package/dist/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
  76. package/dist/components/ui/sidebar/sidebar-expand-button.js +15 -1
  77. package/dist/components/ui/sidebar/sidebar-item.d.ts +1 -1
  78. package/dist/components/ui/sidebar/sidebar-item.d.ts.map +1 -1
  79. package/dist/components/ui/sidebar/sidebar-item.js +28 -4
  80. package/dist/components/ui/sidebar/sidebar-provider.d.ts +58 -0
  81. package/dist/components/ui/sidebar/sidebar-provider.d.ts.map +1 -1
  82. package/dist/components/ui/sidebar/sidebar-provider.js +146 -4
  83. package/dist/components/ui/sidebar/sidebar-root.d.ts +38 -1
  84. package/dist/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
  85. package/dist/components/ui/sidebar/sidebar-root.js +111 -5
  86. package/dist/components/ui/sidebar/sidebar-trigger.d.ts +45 -0
  87. package/dist/components/ui/sidebar/sidebar-trigger.d.ts.map +1 -0
  88. package/dist/components/ui/sidebar/sidebar-trigger.js +57 -0
  89. package/dist/components/ui/textarea/index.js +1 -1
  90. package/dist/components/ui/toast/toaster.d.ts +5 -1
  91. package/dist/components/ui/toast/toaster.d.ts.map +1 -1
  92. package/dist/components/ui/toast/toaster.js +3 -2
  93. package/dist/enterprise/data-table/index.d.ts +77 -7
  94. package/dist/enterprise/data-table/index.d.ts.map +1 -1
  95. package/dist/enterprise/data-table/index.js +56 -11
  96. package/dist/enterprise/date-range-picker/index.js +4 -4
  97. package/dist/enterprise/number-input/index.d.ts.map +1 -1
  98. package/dist/enterprise/number-input/index.js +1 -1
  99. package/dist/esm/components/breadcrumb/index.d.ts.map +1 -1
  100. package/dist/esm/components/breadcrumb/index.js +25 -1
  101. package/dist/esm/components/card/account-card/index.js +5 -5
  102. package/dist/esm/components/card/basic-card/index.d.ts.map +1 -1
  103. package/dist/esm/components/card/basic-card/index.js +2 -2
  104. package/dist/esm/components/card/entity-card/index.js +1 -1
  105. package/dist/esm/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
  106. package/dist/esm/components/dialog/confirmation-dialog/index.js +4 -1
  107. package/dist/esm/components/entity-box/index.d.ts +18 -2
  108. package/dist/esm/components/entity-box/index.d.ts.map +1 -1
  109. package/dist/esm/components/entity-box/index.js +29 -4
  110. package/dist/esm/components/form/date-picker-field/index.js +1 -1
  111. package/dist/esm/components/form/date-range-field/index.js +1 -1
  112. package/dist/esm/components/form/date-time-picker-field/index.js +1 -1
  113. package/dist/esm/components/form/password-field/index.d.ts +5 -1
  114. package/dist/esm/components/form/password-field/index.d.ts.map +1 -1
  115. package/dist/esm/components/form/password-field/index.js +2 -2
  116. package/dist/esm/components/form/select-field/index.d.ts +15 -1
  117. package/dist/esm/components/form/select-field/index.d.ts.map +1 -1
  118. package/dist/esm/components/form/select-field/index.js +29 -4
  119. package/dist/esm/components/form/switch-field/index.d.ts.map +1 -1
  120. package/dist/esm/components/form/switch-field/index.js +7 -2
  121. package/dist/esm/components/page/index.d.ts +35 -1
  122. package/dist/esm/components/page/index.d.ts.map +1 -1
  123. package/dist/esm/components/page/index.js +6 -2
  124. package/dist/esm/components/page-header/index.js +1 -1
  125. package/dist/esm/components/table/id-table-cell.d.ts +13 -1
  126. package/dist/esm/components/table/id-table-cell.d.ts.map +1 -1
  127. package/dist/esm/components/table/id-table-cell.js +100 -7
  128. package/dist/esm/components/table/index.d.ts +1 -0
  129. package/dist/esm/components/table/index.d.ts.map +1 -1
  130. package/dist/esm/components/table/index.js +1 -0
  131. package/dist/esm/components/table/locked-table-actions.d.ts +24 -0
  132. package/dist/esm/components/table/locked-table-actions.d.ts.map +1 -1
  133. package/dist/esm/components/table/locked-table-actions.js +31 -1
  134. package/dist/esm/components/table/name-table-cell.d.ts +57 -4
  135. package/dist/esm/components/table/name-table-cell.d.ts.map +1 -1
  136. package/dist/esm/components/table/name-table-cell.js +50 -2
  137. package/dist/esm/components/ui/autocomplete/index.d.ts +24 -0
  138. package/dist/esm/components/ui/autocomplete/index.d.ts.map +1 -1
  139. package/dist/esm/components/ui/autocomplete/index.js +24 -0
  140. package/dist/esm/components/ui/badge/index.d.ts +11 -7
  141. package/dist/esm/components/ui/badge/index.d.ts.map +1 -1
  142. package/dist/esm/components/ui/badge/index.js +20 -8
  143. package/dist/esm/components/ui/button/index.d.ts +3 -3
  144. package/dist/esm/components/ui/copy-field/index.d.ts +25 -1
  145. package/dist/esm/components/ui/copy-field/index.d.ts.map +1 -1
  146. package/dist/esm/components/ui/copy-field/index.js +16 -8
  147. package/dist/esm/components/ui/dialog/index.d.ts +1 -1
  148. package/dist/esm/components/ui/dialog/index.d.ts.map +1 -1
  149. package/dist/esm/components/ui/dialog/index.js +3 -3
  150. package/dist/esm/components/ui/file-upload/index.d.ts +159 -0
  151. package/dist/esm/components/ui/file-upload/index.d.ts.map +1 -1
  152. package/dist/esm/components/ui/file-upload/index.js +307 -5
  153. package/dist/esm/components/ui/icon-button/index.d.ts +1 -1
  154. package/dist/esm/components/ui/lerian-wordmark/index.d.ts +6 -0
  155. package/dist/esm/components/ui/lerian-wordmark/index.d.ts.map +1 -0
  156. package/dist/esm/components/ui/lerian-wordmark/index.js +4 -0
  157. package/dist/esm/components/ui/otp-input/index.js +1 -1
  158. package/dist/esm/components/ui/radio-group/index.js +1 -1
  159. package/dist/esm/components/ui/select/index.d.ts.map +1 -1
  160. package/dist/esm/components/ui/select/index.js +8 -4
  161. package/dist/esm/components/ui/sheet/index.d.ts +42 -0
  162. package/dist/esm/components/ui/sheet/index.d.ts.map +1 -1
  163. package/dist/esm/components/ui/sheet/index.js +48 -15
  164. package/dist/esm/components/ui/sidebar/index.d.ts +1 -0
  165. package/dist/esm/components/ui/sidebar/index.d.ts.map +1 -1
  166. package/dist/esm/components/ui/sidebar/index.js +1 -0
  167. package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts +1 -1
  168. package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
  169. package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +15 -1
  170. package/dist/esm/components/ui/sidebar/sidebar-item.d.ts +1 -1
  171. package/dist/esm/components/ui/sidebar/sidebar-item.d.ts.map +1 -1
  172. package/dist/esm/components/ui/sidebar/sidebar-item.js +28 -4
  173. package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts +58 -0
  174. package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts.map +1 -1
  175. package/dist/esm/components/ui/sidebar/sidebar-provider.js +143 -1
  176. package/dist/esm/components/ui/sidebar/sidebar-root.d.ts +38 -1
  177. package/dist/esm/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
  178. package/dist/esm/components/ui/sidebar/sidebar-root.js +113 -7
  179. package/dist/esm/components/ui/sidebar/sidebar-trigger.d.ts +45 -0
  180. package/dist/esm/components/ui/sidebar/sidebar-trigger.d.ts.map +1 -0
  181. package/dist/esm/components/ui/sidebar/sidebar-trigger.js +53 -0
  182. package/dist/esm/components/ui/textarea/index.js +1 -1
  183. package/dist/esm/components/ui/toast/toaster.d.ts +5 -1
  184. package/dist/esm/components/ui/toast/toaster.d.ts.map +1 -1
  185. package/dist/esm/components/ui/toast/toaster.js +3 -2
  186. package/dist/esm/enterprise/data-table/index.d.ts +77 -7
  187. package/dist/esm/enterprise/data-table/index.d.ts.map +1 -1
  188. package/dist/esm/enterprise/data-table/index.js +57 -12
  189. package/dist/esm/enterprise/date-range-picker/index.js +4 -4
  190. package/dist/esm/enterprise/number-input/index.d.ts.map +1 -1
  191. package/dist/esm/enterprise/number-input/index.js +1 -1
  192. package/dist/esm/hooks/use-toast.d.ts +18 -2
  193. package/dist/esm/hooks/use-toast.d.ts.map +1 -1
  194. package/dist/esm/hooks/use-toast.js +60 -16
  195. package/dist/esm/index.d.ts +3 -0
  196. package/dist/esm/index.d.ts.map +1 -1
  197. package/dist/esm/index.js +3 -0
  198. package/dist/esm/lib/utils.d.ts +2 -0
  199. package/dist/esm/lib/utils.d.ts.map +1 -1
  200. package/dist/esm/lib/utils.js +10 -0
  201. package/dist/esm/toast/helpers.d.ts +13 -0
  202. package/dist/esm/toast/helpers.d.ts.map +1 -1
  203. package/dist/esm/toast/helpers.js +8 -1
  204. package/dist/fonts/OFL.txt +96 -0
  205. package/dist/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
  206. package/dist/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
  207. package/dist/fonts/ibm-plex-serif-latin-400.woff2 +0 -0
  208. package/dist/fonts/ibm-plex-serif-latin-500.woff2 +0 -0
  209. package/dist/fonts/inter-latin.woff2 +0 -0
  210. package/dist/fonts.css +46 -0
  211. package/dist/globals.css +62 -362
  212. package/dist/hooks/use-toast.d.ts +18 -2
  213. package/dist/hooks/use-toast.d.ts.map +1 -1
  214. package/dist/hooks/use-toast.js +61 -16
  215. package/dist/index.d.ts +3 -0
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/index.js +3 -0
  218. package/dist/lib/utils.d.ts +2 -0
  219. package/dist/lib/utils.d.ts.map +1 -1
  220. package/dist/lib/utils.js +11 -0
  221. package/dist/public/wordmark.svg +1 -0
  222. package/dist/standalone.css +10 -0
  223. package/dist/toast/helpers.d.ts +13 -0
  224. package/dist/toast/helpers.d.ts.map +1 -1
  225. package/dist/toast/helpers.js +8 -1
  226. package/dist/tokens.css +367 -0
  227. package/package.json +9 -6
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.FileUpload = void 0;
37
+ exports.MultipleFileUpload = exports.FileUpload = void 0;
38
38
  exports.validateFile = validateFile;
39
39
  exports.humanizeSize = humanizeSize;
40
40
  const jsx_runtime_1 = require("react/jsx-runtime");
@@ -226,10 +226,18 @@ exports.FileUpload = React.forwardRef(function FileUpload({ accept, maxSizeBytes
226
226
  event.target.value = '';
227
227
  handleFile(file);
228
228
  };
229
+ // `preventDefault` FIRST, and unconditionally. Returning before it does
230
+ // not merely refuse the drop: nothing cancels the browser's OWN action for
231
+ // a dropped file, so the window navigates to the file and whatever the
232
+ // page held unsaved is gone. A zone the host turned off has to swallow the
233
+ // drop, never hand it back to the browser. `dropEffect` says so to the
234
+ // cursor while the file is still in the air.
229
235
  const onDragOver = (event) => {
230
- if (disabled)
231
- return;
232
236
  event.preventDefault();
237
+ if (disabled) {
238
+ event.dataTransfer.dropEffect = 'none';
239
+ return;
240
+ }
233
241
  setDragActive(true);
234
242
  };
235
243
  const onDragLeave = (event) => {
@@ -237,10 +245,13 @@ exports.FileUpload = React.forwardRef(function FileUpload({ accept, maxSizeBytes
237
245
  setDragActive(false);
238
246
  };
239
247
  const onDrop = (event) => {
240
- if (disabled)
241
- return;
242
248
  event.preventDefault();
249
+ // Cleared before the gate, not after, so a host that disables the zone
250
+ // mid-drag does not leave it highlighted for a drag that can no longer
251
+ // land.
243
252
  setDragActive(false);
253
+ if (disabled)
254
+ return;
244
255
  handleFile(event.dataTransfer.files?.[0]);
245
256
  };
246
257
  // Mouse convenience only: clicking the styled zone opens the picker. A
@@ -260,7 +271,7 @@ exports.FileUpload = React.forwardRef(function FileUpload({ accept, maxSizeBytes
260
271
  if (internalRef.current)
261
272
  internalRef.current.value = '';
262
273
  };
263
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)('space-y-2', className), children: [(0, jsx_runtime_1.jsxs)("div", { onClick: openPicker, onDragOver: onDragOver, onDragLeave: onDragLeave, onDrop: onDrop, className: (0, utils_1.cn)('border-input bg-card focus-within:ring-ring focus-within:ring-offset-background aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-within:ring-destructive flex w-full items-center gap-3 rounded-md border px-3 py-4 text-sm shadow-xs transition-colors focus-within:ring-2 focus-within:ring-offset-1 focus-within:outline-none', dragActive &&
274
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)('space-y-2', className), children: [(0, jsx_runtime_1.jsxs)("div", { onClick: openPicker, onDragOver: onDragOver, onDragLeave: onDragLeave, onDrop: onDrop, className: (0, utils_1.cn)('border-input-border bg-card focus-within:ring-ring focus-within:ring-offset-background aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-within:ring-destructive flex w-full items-center gap-3 rounded-md border px-3 py-4 text-sm shadow-xs transition-colors focus-within:ring-2 focus-within:ring-offset-1 focus-within:outline-none', dragActive &&
264
275
  'border-ring ring-ring ring-offset-background ring-2 ring-offset-1', disabled
265
276
  ? 'border-muted bg-muted/30 cursor-not-allowed shadow-none'
266
277
  : 'cursor-pointer'), "aria-invalid": invalid || undefined, children: [(0, jsx_runtime_1.jsx)("input", { ref: internalRef, id: inputId, type: "file", accept: accept, disabled: disabled, className: "sr-only", "aria-invalid": invalid || undefined, "aria-required": ariaRequired || undefined, "aria-describedby": describedBy, "aria-label": ariaLabel, onChange: onInputChange, ...rest }), (0, jsx_runtime_1.jsx)(lucide_react_1.Upload, { className: "text-muted-foreground size-4 shrink-0", "aria-hidden": "true" }), value ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-foreground font-medium", children: value.file.name }), ' ', (0, jsx_runtime_1.jsx)("span", { className: "text-muted-foreground tabular-nums", children: humanizeSize(value.file.size) })] }), (0, jsx_runtime_1.jsx)(icon_button_1.IconButton, { type: "button", variant: "plain", size: "small", disabled: disabled, "aria-label": labels?.remove?.trim() ? labels.remove : 'Remove file', onClick: (event) => {
@@ -270,3 +281,294 @@ exports.FileUpload = React.forwardRef(function FileUpload({ accept, maxSizeBytes
270
281
  }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "size-4", "aria-hidden": "true" }) })] })) : ((0, jsx_runtime_1.jsxs)("span", { className: "text-muted-foreground", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-foreground font-medium", children: labels?.action ?? 'Choose a file' }), ' ', labels?.hint ?? 'or drag and drop'] }))] }), errorText ? ((0, jsx_runtime_1.jsx)("p", { id: errorId, role: "alert", className: "text-system-error-h1a text-xs font-medium", children: errorText })) : null] }));
271
282
  });
272
283
  exports.FileUpload.displayName = 'FileUpload';
284
+ /** The default English announcement for each rejection kind. */
285
+ function defaultMultipleErrorMessage(error) {
286
+ if (error.kind === 'too-many') {
287
+ return `Too many files (max ${error.maxFiles}). ${error.file.name} was not added.`;
288
+ }
289
+ return defaultErrorMessage(error);
290
+ }
291
+ /** The default zone copy once the cap is reached, in grammatical English. */
292
+ function defaultFullMessage(maxFiles) {
293
+ return maxFiles === 1
294
+ ? 'Maximum of 1 file reached.'
295
+ : `Maximum of ${maxFiles} files reached.`;
296
+ }
297
+ /**
298
+ * MultipleFileUpload: the plural sibling of FileUpload. Pick SEVERAL files,
299
+ * accumulate them across repeated picks, validate each one, cap the total, and
300
+ * hand back `FileUploadResult[]`.
301
+ *
302
+ * A SIBLING COMPONENT, not a `multiple` flag. This library already answers
303
+ * "this one takes many" that way (`Select` / `MultipleSelect`), and FileUpload
304
+ * strips `'multiple'` from its props on purpose: single-file is its contract,
305
+ * not a default it happens to have. A boolean would have forced every prop
306
+ * here into a union that means one thing when the flag is set and another when
307
+ * it is not: `value` as `Result | Result[] | null`, a `maxFiles` that is
308
+ * meaningless in half the configurations, and a remove control whose
309
+ * accessible name is fixed copy in one mode and per-file in the other. The
310
+ * plural props follow the house shape for plural components: `value?: T[]`
311
+ * with `onValueChange?: (values: T[]) => void`.
312
+ *
313
+ * WHERE THE LINE SITS: this component owns SELECTION and nothing after it.
314
+ * Choosing, validating, capping, listing and removing are its job; uploading
315
+ * is not. That split is not squeamishness about scope, it is where the
316
+ * knowledge actually lives. An upload needs an endpoint, an auth scheme, a
317
+ * concurrency policy, a retry policy and, very often, a parent id that does
318
+ * not exist yet when the files are chosen: the motivating host stages evidence
319
+ * files while a form is being filled and can only upload them against the id
320
+ * that its create call returns afterwards. None of that is knowable from
321
+ * inside a library primitive, and a component that guessed would have to be
322
+ * fought rather than used. So the host keeps its own per-file record with
323
+ * status and retry, and this component keeps the part a form can hold and
324
+ * validate: the chosen files. `FileUploadResult[]` is a value; an upload state
325
+ * machine is not.
326
+ *
327
+ * ACCUMULATION is the defining behaviour. A second pick ADDS to the selection
328
+ * rather than replacing it, because a user assembling five documents does it
329
+ * in two or three trips to the file dialog, not one. Everything else follows
330
+ * from that: room is measured against what is already selected, and the batch
331
+ * that overflows the cap still contributes the files that fit.
332
+ *
333
+ * A BATCH SURVIVES ITS OWN CASUALTIES. One file rejected for type, size or a
334
+ * failed read does not discard the rest of the batch, and it does not consume
335
+ * a slot either: validation runs over the WHOLE batch before the cap is
336
+ * applied, so a file that was never eligible cannot cost an eligible one its
337
+ * place, and `'too-many'` always names a file a slot would genuinely have
338
+ * taken. The alternative punishes
339
+ * a user for a mistake in one file by throwing away four good ones, and hands
340
+ * back no way to tell which was which. Every rejection is reported through
341
+ * `onError` and announced together in one `role="alert"`.
342
+ *
343
+ * Accessibility follows the sibling BELOW THE CAP: the real `<input
344
+ * type="file">` is `sr-only` but focusable and labelable, and never
345
+ * `aria-hidden`, so FormControl-injected ARIA and react-hook-form's focus on
346
+ * error both work while the picker is enabled. At the cap that changes, and
347
+ * the paragraph below says how.
348
+ * The file list sits OUTSIDE the click zone, so activating a remove control
349
+ * cannot also reopen the picker, and each remove control is named after its
350
+ * own file: a column of identical "Remove file" buttons tells a screen-reader
351
+ * user nothing about which row they are on.
352
+ *
353
+ * AT THE CAP the picker takes the native `disabled` attribute, and that DOES
354
+ * take it out of the tab order. This is the one state in which the input is
355
+ * not a focus target, and the one state in which focus-on-error cannot land on
356
+ * it, so it is a real cost rather than a free win. The cap has no counterpart
357
+ * in the single-file sibling, so the precedent followed here is
358
+ * `DateRangePicker`'s trigger: a control whose only job is to open a dialog has
359
+ * no state worth keeping focusable, and native `disabled` is what both removes
360
+ * it from the tab order and keeps the dialog shut. The alternative, an enabled
361
+ * picker that opens the file dialog and then refuses every file with
362
+ * `too-many`, is a control that lies about being available. What keeps the cap
363
+ * from being a dead end is the escape hatch: the remove controls answer to
364
+ * `disabled` alone and NEVER to the cap, so they stay focusable and removing
365
+ * one file reopens the picker.
366
+ */
367
+ exports.MultipleFileUpload = React.forwardRef(function MultipleFileUpload({ accept, maxSizeBytes, maxFiles, value = [], readAs = 'text', labels, onValueChange, onError, disabled = false, id, className, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, 'aria-describedby': ariaDescribedby, 'aria-label': ariaLabel, ...rest }, ref) {
368
+ const internalRef = React.useRef(null);
369
+ React.useImperativeHandle(ref, () => internalRef.current);
370
+ const reactId = React.useId();
371
+ const inputId = id ?? reactId;
372
+ const errorId = `${inputId}-file-upload-error`;
373
+ const [dragActive, setDragActive] = React.useState(false);
374
+ const [errors, setErrors] = React.useState([]);
375
+ // The authoritative base for the next append. Props win on every render, so
376
+ // the host stays in control; the commit below also writes through, so a
377
+ // second batch that settles before the host has re-rendered still appends to
378
+ // the first batch's result instead of overwriting it.
379
+ const valueRef = React.useRef(value);
380
+ React.useEffect(() => {
381
+ valueRef.current = value;
382
+ });
383
+ // Superseding is NOT the contract here the way it is in the single-file
384
+ // sibling — batches accumulate, so an in-flight read is never stale. The
385
+ // readers are tracked for the one case that does have to stop them: an
386
+ // unmount. A read that lands afterwards would settle its batch and commit,
387
+ // calling the host's `onValueChange` for a component that no longer exists.
388
+ const readersRef = React.useRef(new Set());
389
+ React.useEffect(() => () => {
390
+ for (const reader of readersRef.current)
391
+ reader.abort();
392
+ readersRef.current.clear();
393
+ }, []);
394
+ const invalid = ariaInvalid || errors.length > 0;
395
+ // Resolve the announcements BEFORE deciding whether the alert exists: a
396
+ // consumer that returns nothing for every rejection is opting out of this
397
+ // surface, and an association pointing at an unrendered node is worse than
398
+ // none.
399
+ const messages = errors
400
+ .map((failure) => labels?.error
401
+ ? labels.error(failure)
402
+ : defaultMultipleErrorMessage(failure))
403
+ .filter((message) => Boolean(message));
404
+ // A plain join, never `cn`: tailwind-merge treats these as class names and
405
+ // would drop an id that happens to look like a conflicting utility.
406
+ const describedBy = [ariaDescribedby, messages.length > 0 ? errorId : undefined]
407
+ .filter(Boolean)
408
+ .join(' ') || undefined;
409
+ const full = maxFiles !== undefined && value.length >= maxFiles;
410
+ // Removing must stay possible at the cap, so only the PICKER closes.
411
+ const pickerDisabled = disabled || full;
412
+ const roomFor = (selected) => maxFiles === undefined
413
+ ? Number.POSITIVE_INFINITY
414
+ : Math.max(maxFiles - selected, 0);
415
+ // The cap is enforced HERE, at the only place that appends, because only the
416
+ // commit knows the base it lands on. `ingest` measures room too, but for an
417
+ // asynchronous batch it measures it BEFORE any read settles: two overlapping
418
+ // batches both see the pre-commit selection and would each believe they fit.
419
+ const commit = (accepted, rejections) => {
420
+ const room = roomFor(valueRef.current.length);
421
+ const fitting = accepted.slice(0, room);
422
+ const overflow = accepted[room];
423
+ const failures = overflow !== undefined && maxFiles !== undefined
424
+ ? [
425
+ ...rejections,
426
+ { kind: 'too-many', file: overflow.file, maxFiles }
427
+ ]
428
+ : rejections;
429
+ setErrors(failures);
430
+ for (const rejection of failures)
431
+ onError?.(rejection);
432
+ if (fitting.length === 0)
433
+ return;
434
+ const next = [...valueRef.current, ...fitting];
435
+ valueRef.current = next;
436
+ onValueChange(next);
437
+ };
438
+ const ingest = (incoming) => {
439
+ if (incoming.length === 0)
440
+ return;
441
+ const room = roomFor(valueRef.current.length);
442
+ const rejections = [];
443
+ // Validate EVERY file BEFORE the cap is applied. Slicing to the remaining
444
+ // room first would let a file that was never eligible consume a slot a
445
+ // good file could have used — one bad pick costing a good one, which is
446
+ // the opposite of a batch surviving its own casualties — and it would
447
+ // leave every file past the slice window neither validated nor reported.
448
+ // Validation is pure metadata (size and accept), so running it over files
449
+ // that may not fit costs nothing.
450
+ const eligible = [];
451
+ for (const file of incoming) {
452
+ const rejection = validateFile(file, { accept, maxSizeBytes });
453
+ // Continue rather than abort: one bad file must not cost the good ones.
454
+ if (rejection) {
455
+ rejections.push(rejection);
456
+ continue;
457
+ }
458
+ eligible.push(file);
459
+ }
460
+ // The cap then applies to the SURVIVORS. One rejection for the batch,
461
+ // naming the FIRST eligible file that did not fit: naming one already
462
+ // refused for its size or type would blame the cap for the wrong thing,
463
+ // and repeating it per overflowing file buries the actionable part.
464
+ if (eligible.length > room && maxFiles !== undefined) {
465
+ rejections.push({ kind: 'too-many', file: eligible[room], maxFiles });
466
+ }
467
+ const candidates = eligible.slice(0, room);
468
+ // Binary path: no decode, no reader, no retained garbage string.
469
+ if (readAs === 'none') {
470
+ commit(candidates.map((file) => ({ file, text: '' })), rejections);
471
+ return;
472
+ }
473
+ if (candidates.length === 0) {
474
+ commit([], rejections);
475
+ return;
476
+ }
477
+ // Slot-per-candidate so the emitted batch keeps PICK order regardless of
478
+ // the order the reads settle in. A null slot is a read that failed; the
479
+ // batch commits once every read has settled, one way or the other.
480
+ const slots = new Array(candidates.length).fill(null);
481
+ let remaining = candidates.length;
482
+ const settle = () => {
483
+ remaining -= 1;
484
+ if (remaining > 0)
485
+ return;
486
+ const accepted = [];
487
+ const readFailures = [];
488
+ slots.forEach((slot, index) => {
489
+ if (slot)
490
+ accepted.push(slot);
491
+ else
492
+ readFailures.push({ kind: 'read-failed', file: candidates[index] });
493
+ });
494
+ commit(accepted, [...rejections, ...readFailures]);
495
+ };
496
+ candidates.forEach((file, index) => {
497
+ const reader = new FileReader();
498
+ readersRef.current.add(reader);
499
+ // Deliberately no `onabort` handler: an aborted read must NOT settle,
500
+ // or the batch would commit at exactly the moment we are stopping it.
501
+ reader.onload = () => {
502
+ readersRef.current.delete(reader);
503
+ slots[index] = { file, text: String(reader.result ?? '') };
504
+ settle();
505
+ };
506
+ reader.onerror = () => {
507
+ readersRef.current.delete(reader);
508
+ settle();
509
+ };
510
+ reader.readAsText(file);
511
+ });
512
+ };
513
+ const onInputChange = (event) => {
514
+ const files = Array.from(event.target.files ?? []);
515
+ // Release the FileList the moment it has been read, or re-picking the same
516
+ // file is silently a no-op: the browser fires `change` only when the
517
+ // selection DIFFERS from what the input already holds.
518
+ event.target.value = '';
519
+ ingest(files);
520
+ };
521
+ // `preventDefault` FIRST, and unconditionally. Returning before it does
522
+ // not merely refuse the drop: nothing cancels the browser's OWN action for
523
+ // a dropped file, so the window navigates to the file and whatever the
524
+ // page held unsaved is gone. A zone the host turned off has to swallow the
525
+ // drop, never hand it back to the browser. `dropEffect` says so to the
526
+ // cursor while the file is still in the air.
527
+ const onDragOver = (event) => {
528
+ event.preventDefault();
529
+ if (disabled) {
530
+ event.dataTransfer.dropEffect = 'none';
531
+ return;
532
+ }
533
+ setDragActive(true);
534
+ };
535
+ const onDragLeave = (event) => {
536
+ event.preventDefault();
537
+ setDragActive(false);
538
+ };
539
+ const onDrop = (event) => {
540
+ event.preventDefault();
541
+ // Cleared before the gate, not after, so a host that disables the zone
542
+ // mid-drag does not leave it highlighted for a drag that can no longer
543
+ // land.
544
+ setDragActive(false);
545
+ if (disabled)
546
+ return;
547
+ // Deliberately NOT gated on `full`: a drop onto a full zone is answered
548
+ // with the too-many rejection, which says why, instead of nothing at all.
549
+ ingest(Array.from(event.dataTransfer.files ?? []));
550
+ };
551
+ // Mouse convenience only. A click that ORIGINATED on the input already opens
552
+ // the picker natively and bubbles up here, so ignore it or it opens twice.
553
+ const openPicker = (event) => {
554
+ if (pickerDisabled || event.target === internalRef.current)
555
+ return;
556
+ internalRef.current?.click();
557
+ };
558
+ const removeAt = (index) => {
559
+ // By index, not by name: two files can share a filename and identity is
560
+ // what the row actually stands for.
561
+ const next = valueRef.current.filter((_, position) => position !== index);
562
+ valueRef.current = next;
563
+ onValueChange(next);
564
+ };
565
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)('space-y-2', className), children: [(0, jsx_runtime_1.jsxs)("div", { onClick: openPicker, onDragOver: onDragOver, onDragLeave: onDragLeave, onDrop: onDrop, className: (0, utils_1.cn)('border-input-border bg-card focus-within:ring-ring focus-within:ring-offset-background aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-within:ring-destructive flex w-full items-center gap-3 rounded-md border px-3 py-4 text-sm shadow-xs transition-colors focus-within:ring-2 focus-within:ring-offset-1 focus-within:outline-none', dragActive &&
566
+ 'border-ring ring-ring ring-offset-background ring-2 ring-offset-1', pickerDisabled
567
+ ? 'border-muted bg-muted/30 cursor-not-allowed shadow-none'
568
+ : 'cursor-pointer'), "aria-invalid": invalid || undefined, children: [(0, jsx_runtime_1.jsx)("input", { ref: internalRef, id: inputId, type: "file", multiple: true, accept: accept, disabled: pickerDisabled, className: "sr-only", "aria-invalid": invalid || undefined, "aria-required": ariaRequired || undefined, "aria-describedby": describedBy, "aria-label": ariaLabel, onChange: onInputChange, ...rest }), (0, jsx_runtime_1.jsx)(lucide_react_1.Upload, { className: "text-muted-foreground size-4 shrink-0", "aria-hidden": "true" }), full && maxFiles !== undefined ? ((0, jsx_runtime_1.jsx)("span", { className: "text-muted-foreground", children: labels?.full
569
+ ? labels.full(maxFiles)
570
+ : defaultFullMessage(maxFiles) })) : ((0, jsx_runtime_1.jsxs)("span", { className: "text-muted-foreground", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-foreground font-medium", children: labels?.action ?? 'Choose files' }), ' ', labels?.hint ?? 'or drag and drop'] }))] }), value.length > 0 ? ((0, jsx_runtime_1.jsx)("ul", { className: "space-y-1", children: value.map((entry, index) => ((0, jsx_runtime_1.jsxs)("li", { className: "flex items-center gap-3 text-sm", children: [(0, jsx_runtime_1.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-foreground font-medium", children: entry.file.name }), ' ', (0, jsx_runtime_1.jsx)("span", { className: "text-muted-foreground tabular-nums", children: humanizeSize(entry.file.size) })] }), (0, jsx_runtime_1.jsx)(icon_button_1.IconButton, { type: "button", variant: "plain", size: "small", disabled: disabled, "aria-label": labels?.remove
571
+ ? labels.remove(entry.file)
572
+ : `Remove ${entry.file.name}`, onClick: () => removeAt(index), children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "size-4", "aria-hidden": "true" }) })] }, `${entry.file.name}-${index}`))) })) : null, messages.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { id: errorId, role: "alert", className: "space-y-1", children: messages.map((message, index) => ((0, jsx_runtime_1.jsx)("p", { className: "text-system-error-h1a text-xs font-medium", children: message }, index))) })) : null] }));
573
+ });
574
+ exports.MultipleFileUpload.displayName = 'MultipleFileUpload';
@@ -2,7 +2,7 @@ import { type VariantProps } from 'class-variance-authority';
2
2
  import { buttonVariants } from '../button';
3
3
  export declare const iconButtonVariants: (props?: ({
4
4
  rounded?: boolean | null | undefined;
5
- size?: "default" | "small" | null | undefined;
5
+ size?: "small" | "default" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  export type IconButtonProps = React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
8
8
  rounded?: boolean;
@@ -1,5 +1,9 @@
1
1
  @theme inline {
2
2
  --spacing-icon-button-p: calc(var(--spacing) * 2);
3
+ /* The tap target every icon control in this package answers to, which is
4
+ also `.icon-button-base`'s own box. Named once so the small variant's
5
+ target and the default variant's size cannot drift apart. */
6
+ --spacing-icon-button-target: calc(var(--spacing) * 10);
3
7
  }
4
8
 
5
9
  @layer components {
@@ -19,6 +23,44 @@
19
23
  @apply size-8 [&>*]:size-4;
20
24
  }
21
25
 
26
+ /* ⛔ THE GLYPH IS 2rem, THE TARGET IS 2.5rem, AND THEY ARE NOT THE SAME BOX.
27
+ A table's row-actions kebab is the one control in its row, and at
28
+ `size-8` it was a 32x32 tap target where every icon control in the shell
29
+ is 40x40 — measured at 32x32 on the ledgers, transactions and
30
+ bank-transfer listings at a 390px viewport.
31
+
32
+ Growing the button instead would have grown the row: `TableCell` is
33
+ `py-4`, so a `size-10` trigger takes the row from 64.5px to 72.5px and a
34
+ phone shows fewer rows for the trouble. An absolutely positioned
35
+ pseudo-element takes part in hit testing and in nothing else, so the row,
36
+ the cell, the alignment and every other layout this class appears in are
37
+ byte-identical; `.button-base` is already `relative`, which is what this
38
+ anchors to.
39
+
40
+ ⚠️ CENTRED AND SIZED, NOT INSET BY A CONSTANT. A negative `inset` is
41
+ measured from the PADDING box, so `-inset-1` on this button came out
42
+ 38x38 rather than 40x40 — `.button-outline` carries a 1px transparent
43
+ border, and three of the eight perimeter points fell outside it. Half of
44
+ 50% resolves against whatever the box actually is, so this states the
45
+ target as a size and lets the border be whatever it is.
46
+
47
+ The target is `--spacing-icon-button-target`, which is `.icon-button-base`
48
+ itself, so it is 2.5rem at any browser font rather than 40px at one of
49
+ them. That leaves a quarter of a rem on each side, which is also the
50
+ `gap-1` between the two buttons in `CopyField` — the only place in this
51
+ package where two of these sit side by side — so each target stops at its
52
+ neighbour's visible edge and neither can be tapped by aiming at the other.
53
+ They do share the empty gap, which the later one paints over and takes.
54
+
55
+ `scripts/measure-phone-shapes.mjs` walks eight points around the 2.5rem
56
+ perimeter and asks the document what is there; run it when touching this
57
+ rule. */
58
+ .icon-button-small::after {
59
+ position: absolute;
60
+ inset: calc(50% - var(--spacing-icon-button-target) / 2);
61
+ content: '';
62
+ }
63
+
22
64
  .icon-button-rounded {
23
65
  @apply rounded-full;
24
66
  }
@@ -4,7 +4,7 @@
4
4
  --spacing-input-px: calc(var(--spacing) * 4);
5
5
  --color-input-foreground: var(--color-foreground);
6
6
  --color-input-placeholder: hsl(var(--input-placeholder));
7
- --color-input-border: var(--color-shadcn-400);
7
+ --color-input-border: hsl(var(--input-border));
8
8
 
9
9
  --color-input-adornment: var(--color-container-text);
10
10
  --spacing-input-adornment-size: calc(var(--spacing) * 10);
@@ -13,7 +13,7 @@
13
13
 
14
14
  @layer components {
15
15
  .input-wrapper {
16
- @apply h-input-wrapper-h border-input-border p-input-wrapper-p relative flex w-full cursor-text items-center rounded-md border transition-[color,box-shadow];
16
+ @apply h-input-wrapper-h border-input-border p-input-wrapper-p relative flex w-full min-w-0 cursor-text items-center rounded-md border transition-[color,box-shadow];
17
17
  }
18
18
 
19
19
  .input-wrapper-focus {
@@ -27,9 +27,84 @@
27
27
  /* Don't give the placeholder its own size or weight. At a smaller size it
28
28
  still shares the input's baseline, so it rode ~0.75px below the value and
29
29
  the text jumped the moment you typed; font-medium gave the hint the same
30
- presence as the label naming the field. */
30
+ presence as the label naming the field.
31
+
32
+ THE CONTRACT, and all three halves of it are measured. A field keeps its
33
+ natural width: nothing here declares one, so the control contributes its
34
+ own intrinsic size and a box sized BY ITS CONTENT — a search box in a
35
+ `flex gap-4` filter bar — comes out as a field. A field fills its box
36
+ instead of overrunning it: `min-w-0` on both boxes drops the automatic
37
+ minimum that used to hold the control at 239px inside a narrower wrapper,
38
+ down to the one width it cannot go under. That floor is arithmetic rather
39
+ than policy — `px-input-px` is 16px a side and the box sizing is
40
+ border-box, so the control is 32px wide carrying nothing at all — and a
41
+ box narrower than that gets the difference painted outside it. Measured at
42
+ 23px on the console's template-builder header, whose `w-48` wrapper is
43
+ squeezed to 18px and which the console repairs with `shrink-0` on that
44
+ wrapper. This package's own `SheetContent side="right"` used to run the
45
+ same arithmetic one step earlier: `w-2/5 p-12` at a 390px viewport left a
46
+ 59px panel, and the field came out 41px wide with 9px of text — unusable,
47
+ but inside its box, where 2.0.0-beta.9 painted 189px of it across the
48
+ panel edge. That panel grew a phone step in 2.0.0-beta.12 and now fills
49
+ the screen, so the field reads 307px there; the arithmetic still stands
50
+ wherever a box is genuinely narrower than the control's own padding. A row
51
+ that must compress says so on its own flex item, with `min-w-0`, and that
52
+ one token now works.
53
+
54
+ Why no declared width, measured rather than assumed. A declared width
55
+ replaces the control's max-content contribution as well as its min-content
56
+ one, because an `<input>` does not wrap and has only the one intrinsic
57
+ size. `w-0` shipped in 2.0.0-beta.10 and bought a narrow row's compression
58
+ by giving that up: five product-console screens rendered an empty 32px
59
+ chip at every viewport, and a sixth — the template builder's name field —
60
+ did at 390px while keeping 142px of text at 1440px, all of them wrappers
61
+ that had been handed 0px to be as wide as.
62
+ `w-full` buys the same compression without the chip — a percentage
63
+ contributes max-content but zero min-content — and it was the runner-up
64
+ here. It loses on the same filter bar at 390px, where the control is not
65
+ merely sized by its content but squeezed, and it disappears rather than
66
+ letting the bar scroll. Seventeen rule sets were measured against
67
+ seventeen fixtures; none closes all of them.
68
+
69
+ What this one leaves open is `two-up-200`: two fields in a caller's
70
+ `flex-1` columns inside a 200px row, which now overflows by 138px instead
71
+ of compressing. The caller's one token closes it — `min-w-0` on its own
72
+ column, measured at 78px and fitting — and the fixture beside it,
73
+ `two-up-200-caller-min-w-0`, is the guard that keeps that hatch working.
74
+ On 2.0.0-beta.9 the hatch did NOT work: the same row overflowed by 48px
75
+ and the control painted 152px across its neighbour, because the control
76
+ floored at its intrinsic size inside the column that had just agreed to
77
+ compress. That is the difference this rule set makes.
78
+
79
+ `min-width` reaches exactly one box: the one it is declared on. It does
80
+ not lower an ancestor's automatic minimum and it does not lower a
81
+ descendant's — the sentence this comment carried before the fix said so
82
+ and was right. Nothing above contradicts it: the rule works because BOTH
83
+ boxes declare their own, the control's on `.input-base` and the wrapper's
84
+ on `.input-wrapper`, and neither half works alone. Measured: the wrapper's
85
+ alone fails eleven fixtures (`--candidate=wrapper-only-auto`), the
86
+ control's alone fails four (`--candidate=auto-min-w-0`). It is also why
87
+ `two-up-200` stays open above. The caller's `flex-1` column is a third
88
+ box, no declaration in this package reaches it, and only the caller's own
89
+ `min-w-0` lowers it — which is why that row still overflows by 138px.
90
+
91
+ There is deliberately NO positive min-width floor, and that was measured
92
+ too. A floor here cannot reach the sites that want one: a consumer
93
+ writing `.input-base` by hand tends to add its own `min-w-0`, which is a
94
+ `utilities`-layer class and outranks anything this `components`-layer rule
95
+ set declares. With `min-w-16` added here, the same fixture read 64px wide
96
+ without that hand-written `min-w-0` and 32px with it. The floor also cost
97
+ ground elsewhere: two inputs sharing a 120px row went from fitting to
98
+ overflowing by 52px, and a floor small enough to survive that row still
99
+ left a squeezed filter bar at 32px of content. A caller whose field must
100
+ hold its width says so on its own wrapper, with `shrink-0`.
101
+
102
+ `scripts/measure-input-shrink.mjs` carries the fixtures and the numbers;
103
+ run it when touching this rule set, and `--candidate=ID` re-measures any
104
+ of the seventeen, or `shipped` for this one, before re-opening the
105
+ trade. */
31
106
  .input-base {
32
- @apply px-input-px text-input-foreground placeholder:text-input-placeholder h-full min-h-0 flex-1 border-none bg-transparent outline-none focus:ring-0 focus:ring-offset-0;
107
+ @apply px-input-px text-input-foreground placeholder:text-input-placeholder h-full min-h-0 min-w-0 flex-1 border-none bg-transparent outline-none focus:ring-0 focus:ring-offset-0;
33
108
  }
34
109
 
35
110
  .input-disabled {
@@ -0,0 +1,6 @@
1
+ export type LerianWordmarkProps = {
2
+ className?: string;
3
+ title?: string;
4
+ };
5
+ export declare function LerianWordmark({ className, title }: LerianWordmarkProps): import("react").JSX.Element;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/lerian-wordmark/index.tsx"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,KAAgB,EACjB,EAAE,mBAAmB,+BAiBrB"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LerianWordmark = LerianWordmark;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ function LerianWordmark({ className, title = 'Lerian' }) {
6
+ return ((0, jsx_runtime_1.jsx)("svg", { "data-slot": "lerian-wordmark", viewBox: "0 0 1090.88 280", role: "img", "aria-label": title, fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", className: className, children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M619.42,29.69c0,15.43-10.87,27.93-27.93,27.93s-27.93-12.51-27.93-27.93,10.86-27.93,27.92-27.93,27.93,12.51,27.93,27.93h0ZM158.64,242.4v33.54H12.13v-33.55h48.36c3.16,0,5.73-2.57,5.73-5.73V87.77c0-3.16-2.57-5.73-5.73-5.73H7.85v-34.31h98.33v188.94c0,3.16,2.57,5.73,5.73,5.73h46.74ZM168.85,179.86c0,58.52,37.29,98.33,99.47,98.33,49.15,0,79.7-30.6,86.27-67.08h-40.69c-6.29,24.54-26.97,33.91-48.61,33.91-48.85,0-53.41-45.18-53.83-55-.04-1.02.77-1.87,1.79-1.87h143.61c.76-5.26,1.13-10.42,1.13-15.44,0-32.71-20.25-91.92-95.33-91.92-57.04,0-93.8,41.26-93.81,99.07ZM314.47,158.39l-99.49.02c-1.08,0-1.94-.96-1.78-2.02,4.49-31.28,30.98-42.82,50.98-42.82,33.88,0,48.71,21.59,52.08,42.79.17,1.08-.69,2.04-1.78,2.04h0ZM867.2,83.16h0s0,0,0,0h0ZM826.87,83.16h40.33v192.83h-40.32v-24.53c0-3.09-3.92-4.41-5.79-1.95-.18.23-.35.47-.53.71h0s0,.02,0,.02h0c-.11.16-.23.32-.35.47-7.92,10.56-20.68,27.53-56.24,27.53-60.83,0-91.19-46.33-91.19-98.7,0-61.42,40.37-98.72,91.17-98.72,36.73,0,48.44,15.73,56.64,26.75l.49.66c1.86,2.49,5.81,1.18,5.81-1.93v-23.14ZM770.75,115.48c34.78,0,56.14,27.81,56.14,64.8h0c0,42-26.32,63.68-56.14,63.68-34.83,0-56.14-27.43-56.14-64.43,0-42.07,26.11-64.05,56.14-64.05ZM1063.39,101.7c14.42,14.06,21.64,36.67,21.64,67.8v106.25h-41.06v-103.99c0-43.98-22.35-56.14-45.96-56.14-31.99,0-51.6,23.22-51.6,62.92v97.21h-40.68V83.15h39.93v25.07c0,3.11,3.95,4.4,5.82,1.92,8.55-11.4,26.72-29.52,55.98-29.52,37.55,0,55.75,20.88,55.93,21.08ZM657.42,275.94v-33.54h0s-37.37,0-37.37,0c-3.16,0-5.73-2.57-5.73-5.73V83.14h-81.34v34.31h37.54c3.16,0,5.73,2.57,5.73,5.73v113.48c0,3.16-2.57,5.73-5.73,5.73h-38.14v33.55h125.03ZM499.27,119.27c0,.13-.1.23-.23.23h0s-36.31,0-36.31,0c-28.68,0-28.65,24.99-28.64,43.62,0,.46,0,.92,0,1.37v111.24c0,.13-.1.23-.23.23h-41.01c-.13,0-.23-.1-.23-.23V83.27c0-.13.1-.23.23-.23h36.49c.13,0,.23.1.23.23v24.03c0,4.05,5.24,5.65,7.49,2.28.22-.32.43-.64.65-.97,8.18-12.25,18.71-28.02,52.51-28.02h9.05v38.68Z" }) }));
7
+ }
@@ -52,7 +52,7 @@ function InputOTPGroup({ className, ...props }) {
52
52
  function InputOTPSlot({ index, className, ...props }) {
53
53
  const inputOTPContext = React.useContext(input_otp_1.OTPInputContext);
54
54
  const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
55
- return ((0, jsx_runtime_1.jsxs)("div", { "data-slot": "input-otp-slot", "data-active": isActive, className: (0, utils_1.cn)('border-input-border bg-background text-foreground', 'relative flex h-14 w-12 items-center justify-center border-y border-r text-2xl font-semibold shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md', 'data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:z-10 data-[active=true]:ring-2', className), ...props, children: [char, hasFakeCaret && ((0, jsx_runtime_1.jsx)("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("div", { className: "motion-safe:animate-caret-blink bg-foreground h-6 w-px duration-1000" }) }))] }));
55
+ return ((0, jsx_runtime_1.jsxs)("div", { "data-slot": "input-otp-slot", "data-active": isActive, className: (0, utils_1.cn)('border-input-border bg-background text-foreground', 'relative flex h-14 w-12 items-center justify-center border-y border-r text-2xl font-semibold shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md', 'data-[active=true]:ring-ring data-[active=true]:z-10 data-[active=true]:ring-2', className), ...props, children: [char, hasFakeCaret && ((0, jsx_runtime_1.jsx)("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("div", { className: "motion-safe:animate-caret-blink bg-foreground h-6 w-px duration-1000" }) }))] }));
56
56
  }
57
57
  function InputOTPSeparator({ ...props }) {
58
58
  return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: (0, jsx_runtime_1.jsx)(lucide_react_1.MinusIcon, {}) }));
@@ -44,5 +44,5 @@ function RadioGroup({ className, ...props }) {
44
44
  return ((0, jsx_runtime_1.jsx)(RadioGroupPrimitive.Root, { "data-slot": "radio-group", className: (0, utils_1.cn)('grid gap-3', className), ...props }));
45
45
  }
46
46
  function RadioGroupItem({ className, ...props }) {
47
- return ((0, jsx_runtime_1.jsx)(RadioGroupPrimitive.Item, { "data-slot": "radio-group-item", className: (0, utils_1.cn)('border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: (0, jsx_runtime_1.jsx)(RadioGroupPrimitive.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Circle, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" }) }) }));
47
+ return ((0, jsx_runtime_1.jsx)(RadioGroupPrimitive.Item, { "data-slot": "radio-group-item", className: (0, utils_1.cn)('border-input-border text-primary focus-visible:ring-ring aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: (0, jsx_runtime_1.jsx)(RadioGroupPrimitive.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Circle, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" }) }) }));
48
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAKzD,iBAAS,MAAM,CAAC,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAEnD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;AAED;;;;GAIG;AACH,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;AAED,KAAK,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAC5C,OAAO,eAAe,CAAC,OAAO,CAC/B,GAAG;IACF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAsBD,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,kBAAkB,qBAsBpB;AAED,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,cAAc,CAAC,qBAU7D;AACD,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,gBAAgB,CAAC,qBAU/D;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBA0CtD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,qBAQvC;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAQpD;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAgBnD;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,qBAQxD;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAKzD,iBAAS,MAAM,CAAC,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAEnD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;AAED;;;;GAIG;AACH,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;AAED,KAAK,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAC5C,OAAO,eAAe,CAAC,OAAO,CAC/B,GAAG;IACF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AA0BD,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,kBAAkB,qBAsBpB;AAED,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,cAAc,CAAC,qBAU7D;AACD,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,gBAAgB,CAAC,qBAU/D;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBA0CtD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,qBAQvC;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAQpD;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAgBnD;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,qBAQxD;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,CAAA"}
@@ -73,15 +73,19 @@ function SelectValue({ ...props }) {
73
73
  * slot shrink, `truncate` ellipsises what no longer fits — the chevron keeps its
74
74
  * place because the value absorbs all the shrinkage.
75
75
  *
76
- * Written as a child-scoped variant on the TRIGGER because Radix strips
77
- * `className` off `Select.Value` itself; the `>` combinator holds because Radix
78
- * renders that span as the trigger's direct child.
76
+ * Written as a descendant-scoped variant on the TRIGGER because Radix strips
77
+ * `className` off `Select.Value` itself. DESCENDANT, not `>`: a trigger that
78
+ * carries a leading glyph groups the glyph and the value into one flex child
79
+ * (see `SelectField`'s `leadingIcon`), so the value span is no longer the
80
+ * trigger's direct child and a `>` combinator stopped truncating exactly where
81
+ * the trigger has the least room. The wrapper carries `min-w-0` itself, which
82
+ * is what lets the shrinkage reach the value.
79
83
  *
80
84
  * Truncation hides text, so a trigger showing a long value should also carry
81
85
  * `title` — on the trigger, never on the value slot, which Radix renders
82
86
  * `pointer-events: none`.
83
87
  */
84
- const VALUE_OVERFLOW_CLASS = '[&>[data-slot=select-value]]:min-w-0 [&>[data-slot=select-value]]:truncate';
88
+ const VALUE_OVERFLOW_CLASS = '[&_[data-slot=select-value]]:min-w-0 [&_[data-slot=select-value]]:truncate';
85
89
  function SelectTrigger({ className, readOnly, children, ...props }) {
86
90
  return ((0, jsx_runtime_1.jsxs)(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": "default", className: (0, utils_1.cn)('select-trigger select-read-only select-disabled', VALUE_OVERFLOW_CLASS, className), "aria-readonly": readOnly, "data-read-only": readOnly ? '' : undefined, ...props, children: [children, !readOnly && ((0, jsx_runtime_1.jsx)(SelectPrimitive.Icon, { asChild: true, children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "select-chevron" }) }))] }));
87
91
  }
@@ -5,7 +5,7 @@
5
5
 
6
6
  --color-select-foreground: var(--color-foreground);
7
7
  --color-select-placeholder: var(--color-muted-foreground);
8
- --color-select-border: var(--color-shadcn-400);
8
+ --color-select-border: hsl(var(--input-border));
9
9
  --color-select-chevron: var(--color-container-text);
10
10
  }
11
11