@krak-stack/registry 0.11.6 → 0.11.9

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 (123) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +39 -0
  3. package/dist/components/app-switcher/html.d.ts +2 -2
  4. package/dist/components/asset-input/html.d.ts +70 -0
  5. package/dist/components/asset-input/html.js +1549 -0
  6. package/dist/components/asset-input/index.d.ts +280 -0
  7. package/dist/components/asset-input/react.d.ts +32 -0
  8. package/dist/components/asset-input/react.js +2269 -0
  9. package/dist/components/asset-input/schema.d.ts +93 -0
  10. package/dist/components/asset-input/upload.d.ts +15 -0
  11. package/dist/components/asset-table/html.d.ts +110 -0
  12. package/dist/components/asset-table/html.js +4934 -0
  13. package/dist/components/asset-table/index.d.ts +225 -0
  14. package/dist/components/asset-table/react.d.ts +21 -0
  15. package/dist/components/asset-table/react.js +8241 -0
  16. package/dist/components/asset-table/schema.d.ts +73 -0
  17. package/dist/components/audit-log-table/classes.d.ts +1 -0
  18. package/dist/components/audit-log-table/html.d.ts +158 -0
  19. package/dist/components/audit-log-table/html.js +3294 -0
  20. package/dist/components/audit-log-table/index.d.ts +37 -0
  21. package/dist/components/audit-log-table/react.d.ts +3 -51
  22. package/dist/components/audit-log-table/react.js +130 -89
  23. package/dist/components/audit-log-table/schema.d.ts +122 -0
  24. package/dist/components/danger-confirmation/html.d.ts +2 -2
  25. package/dist/components/danger-confirmation/index.d.ts +2 -2
  26. package/dist/components/data-table/classes.d.ts +3 -0
  27. package/dist/components/data-table/html.d.ts +70 -12
  28. package/dist/components/data-table/html.js +56 -19
  29. package/dist/components/data-table/index.d.ts +51 -1
  30. package/dist/components/data-table/react.d.ts +1 -0
  31. package/dist/components/data-table/react.js +46 -16
  32. package/dist/components/data-table/schema.d.ts +93 -3
  33. package/dist/components/docs/html.js +22 -4
  34. package/dist/components/docs/react.js +33 -2
  35. package/dist/components/editable-text/html.d.ts +2 -2
  36. package/dist/components/editable-text/index.d.ts +4 -4
  37. package/dist/components/effect-form/react.js +343 -138
  38. package/dist/components/email-editor/legacy-editor.html.d.ts +6 -6
  39. package/dist/components/file-input/classes.d.ts +1 -1
  40. package/dist/components/file-input/file-type.d.ts +1 -0
  41. package/dist/components/file-input/html.d.ts +8 -1
  42. package/dist/components/file-input/html.js +170 -12
  43. package/dist/components/file-input/index.d.ts +1 -0
  44. package/dist/components/file-input/react.d.ts +9 -1
  45. package/dist/components/file-input/react.js +277 -127
  46. package/dist/components/file-input/schema.d.ts +1 -0
  47. package/dist/components/form/react.js +343 -138
  48. package/dist/components/icon-input/html.js +19 -5
  49. package/dist/components/icon-input/react.js +70 -13
  50. package/dist/components/map-menu/html.d.ts +6 -0
  51. package/dist/components/map-menu/html.js +13 -8
  52. package/dist/components/map-menu/index.d.ts +5 -4
  53. package/dist/components/map-menu/react.d.ts +28 -17
  54. package/dist/components/map-menu/react.js +84 -178
  55. package/dist/components/map-menu/schema.d.ts +6 -0
  56. package/dist/components/map-menu/shared.d.ts +4 -0
  57. package/dist/components/permissions-input/classes.d.ts +8 -0
  58. package/dist/components/permissions-input/html.d.ts +41 -0
  59. package/dist/components/permissions-input/html.js +130 -0
  60. package/dist/components/permissions-input/index.d.ts +80 -0
  61. package/dist/components/permissions-input/react.d.ts +7 -0
  62. package/dist/components/permissions-input/react.js +201 -0
  63. package/dist/components/permissions-input/schema.d.ts +33 -0
  64. package/dist/components/phone-number-input/html.js +48 -14
  65. package/dist/components/phone-number-input/react.js +67 -10
  66. package/dist/components/search-menu/html.d.ts +2 -2
  67. package/dist/components/select-with-custom-input/html.d.ts +2 -2
  68. package/dist/components/sidebar-layout/html.d.ts +3 -2
  69. package/dist/components/sidebar-layout/html.js +20 -2
  70. package/dist/components/sidebar-layout/index.d.ts +1 -0
  71. package/dist/components/sidebar-layout/react.js +33 -2
  72. package/dist/components/switch/react.d.ts +14 -0
  73. package/dist/components/switch/react.js +55 -0
  74. package/dist/components/theme-switcher/html.d.ts +2 -2
  75. package/dist/components/time-input/html.d.ts +2 -2
  76. package/dist/components/timezone-input/html.js +48 -14
  77. package/dist/components/timezone-input/react.js +67 -10
  78. package/dist/components/tracking-notice/classes.d.ts +6 -0
  79. package/dist/components/tracking-notice/html.d.ts +85 -0
  80. package/dist/components/tracking-notice/html.js +354 -0
  81. package/dist/components/tracking-notice/index.d.ts +95 -0
  82. package/dist/components/tracking-notice/react.d.ts +5 -27
  83. package/dist/components/tracking-notice/react.js +189 -59
  84. package/dist/components/tracking-notice/schema.d.ts +45 -0
  85. package/dist/components/upload-attachment/classes.d.ts +3 -2
  86. package/dist/components/upload-attachment/html.d.ts +5 -5
  87. package/dist/components/upload-attachment/html.js +7 -5
  88. package/dist/components/upload-attachment/react.d.ts +3 -1
  89. package/dist/components/upload-attachment/react.js +25 -17
  90. package/dist/components/virtualized-combobox/classes.d.ts +12 -0
  91. package/dist/components/virtualized-combobox/html.d.ts +42 -0
  92. package/dist/components/virtualized-combobox/html.js +48 -14
  93. package/dist/components/virtualized-combobox/index.d.ts +55 -4
  94. package/dist/components/virtualized-combobox/react.d.ts +6 -2
  95. package/dist/components/virtualized-combobox/react.js +67 -10
  96. package/dist/components/virtualized-combobox/schema.d.ts +60 -4
  97. package/dist/components/webhook-delivery-table/html.js +56 -19
  98. package/dist/components/webhook-delivery-table/react.js +46 -16
  99. package/dist/lib/access/index.d.ts +61 -0
  100. package/dist/lib/access/index.js +92 -0
  101. package/dist/lib/access/table/classes.d.ts +13 -0
  102. package/dist/lib/access/table/html.d.ts +39 -0
  103. package/dist/lib/access/table/html.js +157 -0
  104. package/dist/lib/access/table/index.d.ts +32 -0
  105. package/dist/lib/access/table/react.d.ts +3 -0
  106. package/dist/lib/access/table/react.js +195 -0
  107. package/dist/lib/access/table/schema.d.ts +43 -0
  108. package/dist/lib/docs.integrations.server.js +23 -1
  109. package/dist/lib/docs.js +33 -2
  110. package/dist/lib/docs.server.js +29 -2
  111. package/dist/lib/documentation-toolkit.js +23 -1
  112. package/dist/lib/effect-ui-adapter/use-model.d.ts +1 -1
  113. package/dist/lib/effect-ui-adapter/use-model.js +19 -11
  114. package/dist/lib/lucide-effect.d.ts +19 -19
  115. package/dist/lib/lucide-effect.js +38 -38
  116. package/dist/services/assets/library.d.ts +221 -0
  117. package/dist/services/assets/schema.d.ts +3 -0
  118. package/dist/services/assets/url.d.ts +12 -0
  119. package/dist/services/assets/use-library.d.ts +20 -0
  120. package/dist/services/events/browser.js +39 -26
  121. package/dist/services/events/index.js +23 -19
  122. package/dist/services/opentelemetry/web-vitals.js +27 -23
  123. package/package.json +21 -1
@@ -5,7 +5,34 @@ import {
5
5
  useRef,
6
6
  useState
7
7
  } from "react";
8
- import { CloudUpload, FileIcon, FileUp, ImageUp, Trash2 } from "lucide-react";
8
+ import {
9
+ Binary,
10
+ BookOpen,
11
+ Box,
12
+ CalendarDays,
13
+ Captions,
14
+ CloudUpload,
15
+ FileArchive,
16
+ Contact,
17
+ Database,
18
+ Disc3,
19
+ FileCode,
20
+ FileJson,
21
+ FileTerminal,
22
+ FileType,
23
+ Globe,
24
+ Mail,
25
+ Package,
26
+ Presentation,
27
+ FileIcon,
28
+ FileAudio,
29
+ FileImage,
30
+ FileSpreadsheet,
31
+ FileText,
32
+ FileUp,
33
+ FileVideo,
34
+ X
35
+ } from "lucide-react";
9
36
  import { Schema as Schema3 } from "effect";
10
37
  import {
11
38
  Attachment,
@@ -23,13 +50,115 @@ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/reac
23
50
 
24
51
  // ../../src/components/file-input/classes.ts
25
52
  var fileInputClasses = {
26
- root: "grid min-w-0 gap-3"
53
+ root: "grid min-w-0 grid-cols-1 gap-3"
27
54
  };
28
55
  var resolveFileInputClasses = (overrides) => ({
29
56
  ...fileInputClasses,
30
57
  ...overrides
31
58
  });
32
59
 
60
+ // ../../src/components/file-input/file-type.ts
61
+ var fileType = (mimeType) => {
62
+ const type = mimeType.split(";", 1)[0]?.trim().toLowerCase() ?? "";
63
+ if (!type || type === "application/octet-stream")
64
+ return "file";
65
+ if (type.startsWith("image/"))
66
+ return "image";
67
+ if (type.startsWith("video/"))
68
+ return "video";
69
+ if (type.startsWith("audio/"))
70
+ return "audio";
71
+ if (type.startsWith("font/"))
72
+ return "font";
73
+ if (type.startsWith("model/"))
74
+ return "model";
75
+ if (type.startsWith("message/"))
76
+ return "mail";
77
+ if (type.endsWith("+json") || type === "application/json")
78
+ return "json";
79
+ if (type.includes("spreadsheet") || type.includes("ms-excel"))
80
+ return "spreadsheet";
81
+ if (type.includes("presentation") || type.includes("ms-powerpoint"))
82
+ return "presentation";
83
+ switch (type) {
84
+ case "text/vtt":
85
+ case "application/x-subrip":
86
+ case "application/ttml+xml":
87
+ return "caption";
88
+ case "application/zip":
89
+ case "application/x-zip-compressed":
90
+ case "application/x-7z-compressed":
91
+ case "application/vnd.rar":
92
+ case "application/x-rar-compressed":
93
+ case "application/x-tar":
94
+ case "application/gzip":
95
+ case "application/x-gzip":
96
+ case "application/x-bzip2":
97
+ case "application/x-xz":
98
+ case "application/zstd":
99
+ return "archive";
100
+ case "text/csv":
101
+ case "text/tab-separated-values":
102
+ return "spreadsheet";
103
+ case "text/html":
104
+ case "application/xhtml+xml":
105
+ return "web";
106
+ case "text/css":
107
+ case "text/javascript":
108
+ case "application/javascript":
109
+ case "text/typescript":
110
+ case "application/typescript":
111
+ case "application/yaml":
112
+ case "text/yaml":
113
+ case "application/toml":
114
+ return "code";
115
+ case "application/x-sh":
116
+ case "text/x-shellscript":
117
+ case "application/x-bat":
118
+ return "script";
119
+ case "application/sql":
120
+ case "application/vnd.sqlite3":
121
+ case "application/x-sqlite3":
122
+ return "database";
123
+ case "application/epub+zip":
124
+ case "application/x-mobipocket-ebook":
125
+ case "application/vnd.amazon.ebook":
126
+ return "book";
127
+ case "application/x-iso9660-image":
128
+ case "application/x-apple-diskimage":
129
+ return "disc";
130
+ case "application/vnd.android.package-archive":
131
+ case "application/x-debian-package":
132
+ case "application/x-rpm":
133
+ case "application/x-msi":
134
+ return "package";
135
+ case "application/wasm":
136
+ case "application/x-msdownload":
137
+ case "application/x-executable":
138
+ return "binary";
139
+ case "application/vnd.ms-fontobject":
140
+ case "application/font-woff":
141
+ case "application/x-font-ttf":
142
+ return "font";
143
+ case "application/vnd.ms-outlook":
144
+ return "mail";
145
+ case "text/calendar":
146
+ return "calendar";
147
+ case "text/vcard":
148
+ case "text/x-vcard":
149
+ return "contact";
150
+ case "application/xml":
151
+ case "text/xml":
152
+ return "code";
153
+ default:
154
+ if (type.endsWith("+xml") || type.startsWith("text/x-"))
155
+ return "code";
156
+ if (type.startsWith("text/") || type.includes("word") || type === "application/pdf" || type === "application/rtf")
157
+ return "document";
158
+ return "file";
159
+ }
160
+ };
161
+
33
162
  // ../../src/components/file-input/index.ts
34
163
  import { Redacted, Schema as Schema2 } from "effect";
35
164
  import { Component, UiSchema } from "effect/ui";
@@ -65,7 +194,8 @@ var FilePickerPropsSchema = Schema.Struct({
65
194
  }).annotate({ identifier: "FilePickerMessageOverrides" }))),
66
195
  multiple: Schema.optional(Schema.Boolean),
67
196
  name: Schema.String,
68
- required: Schema.optional(Schema.Boolean)
197
+ required: Schema.optional(Schema.Boolean),
198
+ showImageThumbnails: Schema.optionalKey(Schema.Boolean)
69
199
  }).annotate({ identifier: "FilePickerProps" });
70
200
 
71
201
  // ../../src/components/file-input/index.ts
@@ -172,10 +302,64 @@ var filePickerBehaviours = {
172
302
  // ../../src/components/file-input/react.tsx
173
303
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
174
304
  "use client";
305
+ var fileIcons = {
306
+ file: FileIcon,
307
+ archive: FileArchive,
308
+ binary: Binary,
309
+ book: BookOpen,
310
+ calendar: CalendarDays,
311
+ code: FileCode,
312
+ contact: Contact,
313
+ database: Database,
314
+ disc: Disc3,
315
+ font: FileType,
316
+ json: FileJson,
317
+ mail: Mail,
318
+ model: Box,
319
+ package: Package,
320
+ presentation: Presentation,
321
+ script: FileTerminal,
322
+ web: Globe,
323
+ image: FileImage,
324
+ video: FileVideo,
325
+ audio: FileAudio,
326
+ caption: Captions,
327
+ spreadsheet: FileSpreadsheet,
328
+ document: FileText
329
+ };
330
+ var FileTypeIcon = ({ mimeType }) => {
331
+ const Icon = fileIcons[fileType(mimeType)];
332
+ return /* @__PURE__ */ jsx(Icon, {
333
+ "aria-hidden": "true"
334
+ });
335
+ };
336
+ var FileThumbnail = ({ file }) => {
337
+ const image = useRef(null);
338
+ const isImage = fileType(file.type) === "image";
339
+ useEffect(() => {
340
+ const element = image.current;
341
+ if (!element || typeof URL.createObjectURL !== "function")
342
+ return;
343
+ const url = URL.createObjectURL(file);
344
+ element.src = url;
345
+ return () => {
346
+ element.removeAttribute("src");
347
+ URL.revokeObjectURL(url);
348
+ };
349
+ }, [file, isImage]);
350
+ return isImage ? /* @__PURE__ */ jsx("img", {
351
+ ref: image,
352
+ alt: "",
353
+ className: "size-9 shrink-0 rounded-md object-cover"
354
+ }) : /* @__PURE__ */ jsx(FileTypeIcon, {
355
+ mimeType: file.type
356
+ });
357
+ };
175
358
  var FileInput = ({
359
+ actions,
176
360
  classes: classOverrides,
177
361
  accept = "",
178
- canClear = false,
362
+ canClear = true,
179
363
  file,
180
364
  files = [],
181
365
  id,
@@ -190,6 +374,8 @@ var FileInput = ({
190
374
  onClear,
191
375
  onFilesChange,
192
376
  required,
377
+ showAcceptHint = true,
378
+ showImageThumbnails,
193
379
  title
194
380
  }) => {
195
381
  const fileInputClasses = resolveFileInputClasses(classOverrides);
@@ -229,80 +415,92 @@ var FileInput = ({
229
415
  const input = /* @__PURE__ */ jsx(Input, {
230
416
  ref: inputRef,
231
417
  className: "sr-only",
418
+ hidden: !multiple && selected,
232
419
  id,
233
420
  name,
234
421
  type: "file",
235
422
  accept,
236
423
  multiple,
237
- required: required && (!multiple || files.length === 0),
424
+ required: required && (multiple ? files.length === 0 : !selected),
238
425
  onBlur,
239
426
  onChange: (event) => {
240
427
  if (event.target.files)
241
428
  selectFiles(event.target.files);
242
- if (multiple)
429
+ if (multiple || !name)
243
430
  event.target.value = "";
244
431
  },
245
432
  "aria-invalid": invalid
246
433
  });
434
+ const dropzone = /* @__PURE__ */ jsxs("div", {
435
+ className: "bg-muted/30 data-[dragging=true]:bg-muted flex min-h-32 min-w-0 flex-col items-center justify-center gap-3 rounded-xl border border-dashed p-6 text-center transition-colors",
436
+ "data-dragging": dragging,
437
+ onDragEnter: (event) => {
438
+ event.preventDefault();
439
+ dragDepthRef.current += 1;
440
+ setDragging(true);
441
+ },
442
+ onDragLeave: (event) => {
443
+ event.preventDefault();
444
+ dragDepthRef.current = Math.max(0, dragDepthRef.current - 1);
445
+ if (dragDepthRef.current === 0)
446
+ setDragging(false);
447
+ },
448
+ onDragOver: (event) => event.preventDefault(),
449
+ onDrop: handleDrop,
450
+ children: [
451
+ /* @__PURE__ */ jsx(CloudUpload, {
452
+ className: "text-muted-foreground size-6"
453
+ }),
454
+ /* @__PURE__ */ jsxs("div", {
455
+ className: "max-w-full min-w-0",
456
+ children: [
457
+ /* @__PURE__ */ jsx("p", {
458
+ className: "text-sm font-medium",
459
+ children: multiple ? labels.dropFiles : labels.dropFile
460
+ }),
461
+ showAcceptHint && accept && /* @__PURE__ */ jsx("p", {
462
+ className: "text-muted-foreground text-xs [overflow-wrap:anywhere]",
463
+ children: labels.accepts(accept)
464
+ })
465
+ ]
466
+ }),
467
+ /* @__PURE__ */ jsxs("div", {
468
+ className: "flex flex-wrap items-center justify-center gap-2",
469
+ children: [
470
+ /* @__PURE__ */ jsxs(Button, {
471
+ type: "button",
472
+ variant: "outline",
473
+ onClick: () => inputRef.current?.click(),
474
+ children: [
475
+ /* @__PURE__ */ jsx(FileUp, {
476
+ "data-icon": "inline-start"
477
+ }),
478
+ multiple ? labels.chooseFiles : labels.chooseFile
479
+ ]
480
+ }),
481
+ actions
482
+ ]
483
+ })
484
+ ]
485
+ });
247
486
  if (multiple) {
248
487
  return /* @__PURE__ */ jsxs("div", {
249
488
  className: fileInputClasses.root,
250
489
  children: [
251
- /* @__PURE__ */ jsxs("div", {
252
- className: "bg-muted/30 data-[dragging=true]:bg-muted flex min-h-32 min-w-0 flex-col items-center justify-center gap-3 rounded-xl border border-dashed p-6 text-center transition-colors",
253
- "data-dragging": dragging,
254
- onDragEnter: (event) => {
255
- event.preventDefault();
256
- dragDepthRef.current += 1;
257
- setDragging(true);
258
- },
259
- onDragLeave: (event) => {
260
- event.preventDefault();
261
- dragDepthRef.current -= 1;
262
- if (dragDepthRef.current <= 0) {
263
- dragDepthRef.current = 0;
264
- setDragging(false);
265
- }
266
- },
267
- onDragOver: (event) => event.preventDefault(),
268
- onDrop: handleDrop,
269
- children: [
270
- /* @__PURE__ */ jsx(CloudUpload, {
271
- className: "text-muted-foreground size-6"
272
- }),
273
- /* @__PURE__ */ jsxs("div", {
274
- className: "max-w-full min-w-0",
275
- children: [
276
- /* @__PURE__ */ jsx("p", {
277
- className: "text-sm font-medium",
278
- children: labels.dropFiles
279
- }),
280
- /* @__PURE__ */ jsx("p", {
281
- className: "text-muted-foreground max-w-full text-xs [overflow-wrap:anywhere]",
282
- children: labels.accepts(accept)
283
- })
284
- ]
285
- }),
286
- /* @__PURE__ */ jsxs(Button, {
287
- type: "button",
288
- variant: "outline",
289
- onClick: () => inputRef.current?.click(),
290
- children: [
291
- /* @__PURE__ */ jsx(FileUp, {
292
- "data-icon": "inline-start"
293
- }),
294
- labels.chooseFiles
295
- ]
296
- }),
297
- input
298
- ]
299
- }),
490
+ dropzone,
491
+ input,
300
492
  files.length > 0 ? /* @__PURE__ */ jsx(AttachmentGroup, {
493
+ className: "w-full px-1 focus-within:mask-none",
301
494
  children: files.map((selectedFile) => /* @__PURE__ */ jsxs(Attachment, {
495
+ className: "focus-within:ring-0",
302
496
  state: invalid ? "error" : "idle",
303
497
  children: [
304
498
  /* @__PURE__ */ jsx(AttachmentMedia, {
305
- children: /* @__PURE__ */ jsx(FileIcon, {})
499
+ children: showImageThumbnails ? /* @__PURE__ */ jsx(FileThumbnail, {
500
+ file: selectedFile
501
+ }) : /* @__PURE__ */ jsx(FileTypeIcon, {
502
+ mimeType: selectedFile.type
503
+ })
306
504
  }),
307
505
  /* @__PURE__ */ jsxs(AttachmentContent, {
308
506
  children: [
@@ -319,7 +517,9 @@ var FileInput = ({
319
517
  type: "button",
320
518
  "aria-label": `${labels.deleteFile} ${selectedFile.name}`,
321
519
  onClick: () => onFilesChange?.(files.filter((candidate) => candidate !== selectedFile)),
322
- children: /* @__PURE__ */ jsx(Trash2, {})
520
+ children: /* @__PURE__ */ jsx(X, {
521
+ "aria-hidden": "true"
522
+ })
323
523
  })
324
524
  })
325
525
  ]
@@ -328,60 +528,10 @@ var FileInput = ({
328
528
  ]
329
529
  });
330
530
  }
331
- if (!selected) {
332
- return /* @__PURE__ */ jsxs("div", {
333
- className: "bg-muted/30 data-[dragging=true]:bg-muted flex min-h-32 flex-col items-center justify-center gap-3 rounded-xl border border-dashed p-6 text-center transition-colors",
334
- "data-dragging": dragging,
335
- onDragEnter: (event) => {
336
- event.preventDefault();
337
- dragDepthRef.current += 1;
338
- setDragging(true);
339
- },
340
- onDragLeave: (event) => {
341
- event.preventDefault();
342
- dragDepthRef.current -= 1;
343
- if (dragDepthRef.current <= 0) {
344
- dragDepthRef.current = 0;
345
- setDragging(false);
346
- }
347
- },
348
- onDragOver: (event) => event.preventDefault(),
349
- onDrop: handleDrop,
350
- children: [
351
- /* @__PURE__ */ jsx(CloudUpload, {
352
- className: "text-muted-foreground size-6"
353
- }),
354
- /* @__PURE__ */ jsxs("div", {
355
- children: [
356
- /* @__PURE__ */ jsx("p", {
357
- className: "text-sm font-medium",
358
- children: labels.dropFile
359
- }),
360
- /* @__PURE__ */ jsx("p", {
361
- className: "text-muted-foreground text-xs",
362
- children: labels.accepts(accept)
363
- })
364
- ]
365
- }),
366
- /* @__PURE__ */ jsxs(Button, {
367
- type: "button",
368
- variant: "outline",
369
- onClick: () => inputRef.current?.click(),
370
- children: [
371
- /* @__PURE__ */ jsx(FileUp, {
372
- "data-icon": "inline-start"
373
- }),
374
- labels.chooseFile
375
- ]
376
- }),
377
- input
378
- ]
379
- });
380
- }
381
531
  return /* @__PURE__ */ jsxs(Fragment, {
382
532
  children: [
383
- /* @__PURE__ */ jsxs(Attachment, {
384
- className: "w-full",
533
+ !selected ? dropzone : /* @__PURE__ */ jsxs(Attachment, {
534
+ className: "w-full focus-within:ring-0",
385
535
  orientation: "horizontal",
386
536
  state: invalid ? "error" : "done",
387
537
  children: [
@@ -398,7 +548,11 @@ var FileInput = ({
398
548
  width: image.width,
399
549
  height: image.height,
400
550
  className: "size-full object-contain"
401
- }) : /* @__PURE__ */ jsx(FileIcon, {})
551
+ }) : file && showImageThumbnails ? /* @__PURE__ */ jsx(FileThumbnail, {
552
+ file
553
+ }) : /* @__PURE__ */ jsx(FileTypeIcon, {
554
+ mimeType: file?.type ?? ""
555
+ })
402
556
  }),
403
557
  /* @__PURE__ */ jsxs(AttachmentContent, {
404
558
  children: [
@@ -411,22 +565,16 @@ var FileInput = ({
411
565
  }) : null
412
566
  ]
413
567
  }),
414
- /* @__PURE__ */ jsxs(AttachmentActions, {
415
- className: "ml-auto gap-1",
416
- children: [
417
- /* @__PURE__ */ jsx(AttachmentAction, {
418
- type: "button",
419
- "aria-label": labels.replaceFile,
420
- onClick: () => inputRef.current?.click(),
421
- children: image ? /* @__PURE__ */ jsx(ImageUp, {}) : /* @__PURE__ */ jsx(FileUp, {})
422
- }),
423
- canClear ? /* @__PURE__ */ jsx(AttachmentAction, {
424
- type: "button",
425
- "aria-label": `${labels.deleteFile} ${Schema3.is(Schema3.String)(title) ? title : ""}`,
426
- onClick: clear,
427
- children: /* @__PURE__ */ jsx(Trash2, {})
428
- }) : null
429
- ]
568
+ canClear && /* @__PURE__ */ jsx(AttachmentActions, {
569
+ className: "ml-auto",
570
+ children: /* @__PURE__ */ jsx(AttachmentAction, {
571
+ type: "button",
572
+ "aria-label": `${labels.deleteFile} ${Schema3.is(Schema3.String)(title) ? title : ""}`,
573
+ onClick: clear,
574
+ children: /* @__PURE__ */ jsx(X, {
575
+ "aria-hidden": "true"
576
+ })
577
+ })
430
578
  })
431
579
  ]
432
580
  }),
@@ -435,5 +583,7 @@ var FileInput = ({
435
583
  });
436
584
  };
437
585
  export {
438
- FileInput
586
+ FileInput,
587
+ FileThumbnail,
588
+ FileTypeIcon
439
589
  };
@@ -29,6 +29,7 @@ export declare const FilePickerPropsSchema: Schema.Struct<{
29
29
  readonly multiple: Schema.optional<Schema.Boolean>;
30
30
  readonly name: Schema.String;
31
31
  readonly required: Schema.optional<Schema.Boolean>;
32
+ readonly showImageThumbnails: Schema.optionalKey<Schema.Boolean>;
32
33
  }>;
33
34
  export type FilePickerSharedProps = typeof FilePickerPropsSchema.Type;
34
35
  export type FilePickerMessageTranslations = NonNullable<FilePickerSharedProps["messages"]>;