@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
@@ -36,7 +36,34 @@ import {
36
36
  useRef,
37
37
  useState
38
38
  } from "react";
39
- import { CloudUpload, FileIcon, FileUp, ImageUp, Trash2 } from "lucide-react";
39
+ import {
40
+ Binary,
41
+ BookOpen,
42
+ Box,
43
+ CalendarDays,
44
+ Captions,
45
+ CloudUpload,
46
+ FileArchive,
47
+ Contact,
48
+ Database,
49
+ Disc3,
50
+ FileCode,
51
+ FileJson,
52
+ FileTerminal,
53
+ FileType,
54
+ Globe,
55
+ Mail,
56
+ Package,
57
+ Presentation,
58
+ FileIcon,
59
+ FileAudio,
60
+ FileImage,
61
+ FileSpreadsheet,
62
+ FileText,
63
+ FileUp,
64
+ FileVideo,
65
+ X
66
+ } from "lucide-react";
40
67
  import { Schema as Schema3 } from "effect";
41
68
  import {
42
69
  Attachment,
@@ -54,13 +81,115 @@ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/reac
54
81
 
55
82
  // ../../src/components/file-input/classes.ts
56
83
  var fileInputClasses = {
57
- root: "grid min-w-0 gap-3"
84
+ root: "grid min-w-0 grid-cols-1 gap-3"
58
85
  };
59
86
  var resolveFileInputClasses = (overrides) => ({
60
87
  ...fileInputClasses,
61
88
  ...overrides
62
89
  });
63
90
 
91
+ // ../../src/components/file-input/file-type.ts
92
+ var fileType = (mimeType) => {
93
+ const type = mimeType.split(";", 1)[0]?.trim().toLowerCase() ?? "";
94
+ if (!type || type === "application/octet-stream")
95
+ return "file";
96
+ if (type.startsWith("image/"))
97
+ return "image";
98
+ if (type.startsWith("video/"))
99
+ return "video";
100
+ if (type.startsWith("audio/"))
101
+ return "audio";
102
+ if (type.startsWith("font/"))
103
+ return "font";
104
+ if (type.startsWith("model/"))
105
+ return "model";
106
+ if (type.startsWith("message/"))
107
+ return "mail";
108
+ if (type.endsWith("+json") || type === "application/json")
109
+ return "json";
110
+ if (type.includes("spreadsheet") || type.includes("ms-excel"))
111
+ return "spreadsheet";
112
+ if (type.includes("presentation") || type.includes("ms-powerpoint"))
113
+ return "presentation";
114
+ switch (type) {
115
+ case "text/vtt":
116
+ case "application/x-subrip":
117
+ case "application/ttml+xml":
118
+ return "caption";
119
+ case "application/zip":
120
+ case "application/x-zip-compressed":
121
+ case "application/x-7z-compressed":
122
+ case "application/vnd.rar":
123
+ case "application/x-rar-compressed":
124
+ case "application/x-tar":
125
+ case "application/gzip":
126
+ case "application/x-gzip":
127
+ case "application/x-bzip2":
128
+ case "application/x-xz":
129
+ case "application/zstd":
130
+ return "archive";
131
+ case "text/csv":
132
+ case "text/tab-separated-values":
133
+ return "spreadsheet";
134
+ case "text/html":
135
+ case "application/xhtml+xml":
136
+ return "web";
137
+ case "text/css":
138
+ case "text/javascript":
139
+ case "application/javascript":
140
+ case "text/typescript":
141
+ case "application/typescript":
142
+ case "application/yaml":
143
+ case "text/yaml":
144
+ case "application/toml":
145
+ return "code";
146
+ case "application/x-sh":
147
+ case "text/x-shellscript":
148
+ case "application/x-bat":
149
+ return "script";
150
+ case "application/sql":
151
+ case "application/vnd.sqlite3":
152
+ case "application/x-sqlite3":
153
+ return "database";
154
+ case "application/epub+zip":
155
+ case "application/x-mobipocket-ebook":
156
+ case "application/vnd.amazon.ebook":
157
+ return "book";
158
+ case "application/x-iso9660-image":
159
+ case "application/x-apple-diskimage":
160
+ return "disc";
161
+ case "application/vnd.android.package-archive":
162
+ case "application/x-debian-package":
163
+ case "application/x-rpm":
164
+ case "application/x-msi":
165
+ return "package";
166
+ case "application/wasm":
167
+ case "application/x-msdownload":
168
+ case "application/x-executable":
169
+ return "binary";
170
+ case "application/vnd.ms-fontobject":
171
+ case "application/font-woff":
172
+ case "application/x-font-ttf":
173
+ return "font";
174
+ case "application/vnd.ms-outlook":
175
+ return "mail";
176
+ case "text/calendar":
177
+ return "calendar";
178
+ case "text/vcard":
179
+ case "text/x-vcard":
180
+ return "contact";
181
+ case "application/xml":
182
+ case "text/xml":
183
+ return "code";
184
+ default:
185
+ if (type.endsWith("+xml") || type.startsWith("text/x-"))
186
+ return "code";
187
+ if (type.startsWith("text/") || type.includes("word") || type === "application/pdf" || type === "application/rtf")
188
+ return "document";
189
+ return "file";
190
+ }
191
+ };
192
+
64
193
  // ../../src/components/file-input/index.ts
65
194
  import { Redacted, Schema as Schema2 } from "effect";
66
195
  import { Component, UiSchema } from "effect/ui";
@@ -96,7 +225,8 @@ var FilePickerPropsSchema = Schema.Struct({
96
225
  }).annotate({ identifier: "FilePickerMessageOverrides" }))),
97
226
  multiple: Schema.optional(Schema.Boolean),
98
227
  name: Schema.String,
99
- required: Schema.optional(Schema.Boolean)
228
+ required: Schema.optional(Schema.Boolean),
229
+ showImageThumbnails: Schema.optionalKey(Schema.Boolean)
100
230
  }).annotate({ identifier: "FilePickerProps" });
101
231
 
102
232
  // ../../src/components/file-input/index.ts
@@ -203,10 +333,64 @@ var filePickerBehaviours = {
203
333
  // ../../src/components/file-input/react.tsx
204
334
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
205
335
  "use client";
336
+ var fileIcons = {
337
+ file: FileIcon,
338
+ archive: FileArchive,
339
+ binary: Binary,
340
+ book: BookOpen,
341
+ calendar: CalendarDays,
342
+ code: FileCode,
343
+ contact: Contact,
344
+ database: Database,
345
+ disc: Disc3,
346
+ font: FileType,
347
+ json: FileJson,
348
+ mail: Mail,
349
+ model: Box,
350
+ package: Package,
351
+ presentation: Presentation,
352
+ script: FileTerminal,
353
+ web: Globe,
354
+ image: FileImage,
355
+ video: FileVideo,
356
+ audio: FileAudio,
357
+ caption: Captions,
358
+ spreadsheet: FileSpreadsheet,
359
+ document: FileText
360
+ };
361
+ var FileTypeIcon = ({ mimeType }) => {
362
+ const Icon = fileIcons[fileType(mimeType)];
363
+ return /* @__PURE__ */ jsx(Icon, {
364
+ "aria-hidden": "true"
365
+ });
366
+ };
367
+ var FileThumbnail = ({ file }) => {
368
+ const image = useRef(null);
369
+ const isImage = fileType(file.type) === "image";
370
+ useEffect(() => {
371
+ const element = image.current;
372
+ if (!element || typeof URL.createObjectURL !== "function")
373
+ return;
374
+ const url = URL.createObjectURL(file);
375
+ element.src = url;
376
+ return () => {
377
+ element.removeAttribute("src");
378
+ URL.revokeObjectURL(url);
379
+ };
380
+ }, [file, isImage]);
381
+ return isImage ? /* @__PURE__ */ jsx("img", {
382
+ ref: image,
383
+ alt: "",
384
+ className: "size-9 shrink-0 rounded-md object-cover"
385
+ }) : /* @__PURE__ */ jsx(FileTypeIcon, {
386
+ mimeType: file.type
387
+ });
388
+ };
206
389
  var FileInput = ({
390
+ actions,
207
391
  classes: classOverrides,
208
392
  accept = "",
209
- canClear = false,
393
+ canClear = true,
210
394
  file,
211
395
  files = [],
212
396
  id,
@@ -221,6 +405,8 @@ var FileInput = ({
221
405
  onClear,
222
406
  onFilesChange,
223
407
  required,
408
+ showAcceptHint = true,
409
+ showImageThumbnails,
224
410
  title
225
411
  }) => {
226
412
  const fileInputClasses = resolveFileInputClasses(classOverrides);
@@ -260,80 +446,92 @@ var FileInput = ({
260
446
  const input = /* @__PURE__ */ jsx(Input, {
261
447
  ref: inputRef,
262
448
  className: "sr-only",
449
+ hidden: !multiple && selected,
263
450
  id,
264
451
  name,
265
452
  type: "file",
266
453
  accept,
267
454
  multiple,
268
- required: required && (!multiple || files.length === 0),
455
+ required: required && (multiple ? files.length === 0 : !selected),
269
456
  onBlur,
270
457
  onChange: (event) => {
271
458
  if (event.target.files)
272
459
  selectFiles(event.target.files);
273
- if (multiple)
460
+ if (multiple || !name)
274
461
  event.target.value = "";
275
462
  },
276
463
  "aria-invalid": invalid
277
464
  });
465
+ const dropzone = /* @__PURE__ */ jsxs("div", {
466
+ 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",
467
+ "data-dragging": dragging,
468
+ onDragEnter: (event) => {
469
+ event.preventDefault();
470
+ dragDepthRef.current += 1;
471
+ setDragging(true);
472
+ },
473
+ onDragLeave: (event) => {
474
+ event.preventDefault();
475
+ dragDepthRef.current = Math.max(0, dragDepthRef.current - 1);
476
+ if (dragDepthRef.current === 0)
477
+ setDragging(false);
478
+ },
479
+ onDragOver: (event) => event.preventDefault(),
480
+ onDrop: handleDrop,
481
+ children: [
482
+ /* @__PURE__ */ jsx(CloudUpload, {
483
+ className: "text-muted-foreground size-6"
484
+ }),
485
+ /* @__PURE__ */ jsxs("div", {
486
+ className: "max-w-full min-w-0",
487
+ children: [
488
+ /* @__PURE__ */ jsx("p", {
489
+ className: "text-sm font-medium",
490
+ children: multiple ? labels.dropFiles : labels.dropFile
491
+ }),
492
+ showAcceptHint && accept && /* @__PURE__ */ jsx("p", {
493
+ className: "text-muted-foreground text-xs [overflow-wrap:anywhere]",
494
+ children: labels.accepts(accept)
495
+ })
496
+ ]
497
+ }),
498
+ /* @__PURE__ */ jsxs("div", {
499
+ className: "flex flex-wrap items-center justify-center gap-2",
500
+ children: [
501
+ /* @__PURE__ */ jsxs(Button, {
502
+ type: "button",
503
+ variant: "outline",
504
+ onClick: () => inputRef.current?.click(),
505
+ children: [
506
+ /* @__PURE__ */ jsx(FileUp, {
507
+ "data-icon": "inline-start"
508
+ }),
509
+ multiple ? labels.chooseFiles : labels.chooseFile
510
+ ]
511
+ }),
512
+ actions
513
+ ]
514
+ })
515
+ ]
516
+ });
278
517
  if (multiple) {
279
518
  return /* @__PURE__ */ jsxs("div", {
280
519
  className: fileInputClasses.root,
281
520
  children: [
282
- /* @__PURE__ */ jsxs("div", {
283
- 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",
284
- "data-dragging": dragging,
285
- onDragEnter: (event) => {
286
- event.preventDefault();
287
- dragDepthRef.current += 1;
288
- setDragging(true);
289
- },
290
- onDragLeave: (event) => {
291
- event.preventDefault();
292
- dragDepthRef.current -= 1;
293
- if (dragDepthRef.current <= 0) {
294
- dragDepthRef.current = 0;
295
- setDragging(false);
296
- }
297
- },
298
- onDragOver: (event) => event.preventDefault(),
299
- onDrop: handleDrop,
300
- children: [
301
- /* @__PURE__ */ jsx(CloudUpload, {
302
- className: "text-muted-foreground size-6"
303
- }),
304
- /* @__PURE__ */ jsxs("div", {
305
- className: "max-w-full min-w-0",
306
- children: [
307
- /* @__PURE__ */ jsx("p", {
308
- className: "text-sm font-medium",
309
- children: labels.dropFiles
310
- }),
311
- /* @__PURE__ */ jsx("p", {
312
- className: "text-muted-foreground max-w-full text-xs [overflow-wrap:anywhere]",
313
- children: labels.accepts(accept)
314
- })
315
- ]
316
- }),
317
- /* @__PURE__ */ jsxs(Button, {
318
- type: "button",
319
- variant: "outline",
320
- onClick: () => inputRef.current?.click(),
321
- children: [
322
- /* @__PURE__ */ jsx(FileUp, {
323
- "data-icon": "inline-start"
324
- }),
325
- labels.chooseFiles
326
- ]
327
- }),
328
- input
329
- ]
330
- }),
521
+ dropzone,
522
+ input,
331
523
  files.length > 0 ? /* @__PURE__ */ jsx(AttachmentGroup, {
524
+ className: "w-full px-1 focus-within:mask-none",
332
525
  children: files.map((selectedFile) => /* @__PURE__ */ jsxs(Attachment, {
526
+ className: "focus-within:ring-0",
333
527
  state: invalid ? "error" : "idle",
334
528
  children: [
335
529
  /* @__PURE__ */ jsx(AttachmentMedia, {
336
- children: /* @__PURE__ */ jsx(FileIcon, {})
530
+ children: showImageThumbnails ? /* @__PURE__ */ jsx(FileThumbnail, {
531
+ file: selectedFile
532
+ }) : /* @__PURE__ */ jsx(FileTypeIcon, {
533
+ mimeType: selectedFile.type
534
+ })
337
535
  }),
338
536
  /* @__PURE__ */ jsxs(AttachmentContent, {
339
537
  children: [
@@ -350,7 +548,9 @@ var FileInput = ({
350
548
  type: "button",
351
549
  "aria-label": `${labels.deleteFile} ${selectedFile.name}`,
352
550
  onClick: () => onFilesChange?.(files.filter((candidate) => candidate !== selectedFile)),
353
- children: /* @__PURE__ */ jsx(Trash2, {})
551
+ children: /* @__PURE__ */ jsx(X, {
552
+ "aria-hidden": "true"
553
+ })
354
554
  })
355
555
  })
356
556
  ]
@@ -359,60 +559,10 @@ var FileInput = ({
359
559
  ]
360
560
  });
361
561
  }
362
- if (!selected) {
363
- return /* @__PURE__ */ jsxs("div", {
364
- 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",
365
- "data-dragging": dragging,
366
- onDragEnter: (event) => {
367
- event.preventDefault();
368
- dragDepthRef.current += 1;
369
- setDragging(true);
370
- },
371
- onDragLeave: (event) => {
372
- event.preventDefault();
373
- dragDepthRef.current -= 1;
374
- if (dragDepthRef.current <= 0) {
375
- dragDepthRef.current = 0;
376
- setDragging(false);
377
- }
378
- },
379
- onDragOver: (event) => event.preventDefault(),
380
- onDrop: handleDrop,
381
- children: [
382
- /* @__PURE__ */ jsx(CloudUpload, {
383
- className: "text-muted-foreground size-6"
384
- }),
385
- /* @__PURE__ */ jsxs("div", {
386
- children: [
387
- /* @__PURE__ */ jsx("p", {
388
- className: "text-sm font-medium",
389
- children: labels.dropFile
390
- }),
391
- /* @__PURE__ */ jsx("p", {
392
- className: "text-muted-foreground text-xs",
393
- children: labels.accepts(accept)
394
- })
395
- ]
396
- }),
397
- /* @__PURE__ */ jsxs(Button, {
398
- type: "button",
399
- variant: "outline",
400
- onClick: () => inputRef.current?.click(),
401
- children: [
402
- /* @__PURE__ */ jsx(FileUp, {
403
- "data-icon": "inline-start"
404
- }),
405
- labels.chooseFile
406
- ]
407
- }),
408
- input
409
- ]
410
- });
411
- }
412
562
  return /* @__PURE__ */ jsxs(Fragment, {
413
563
  children: [
414
- /* @__PURE__ */ jsxs(Attachment, {
415
- className: "w-full",
564
+ !selected ? dropzone : /* @__PURE__ */ jsxs(Attachment, {
565
+ className: "w-full focus-within:ring-0",
416
566
  orientation: "horizontal",
417
567
  state: invalid ? "error" : "done",
418
568
  children: [
@@ -429,7 +579,11 @@ var FileInput = ({
429
579
  width: image.width,
430
580
  height: image.height,
431
581
  className: "size-full object-contain"
432
- }) : /* @__PURE__ */ jsx(FileIcon, {})
582
+ }) : file && showImageThumbnails ? /* @__PURE__ */ jsx(FileThumbnail, {
583
+ file
584
+ }) : /* @__PURE__ */ jsx(FileTypeIcon, {
585
+ mimeType: file?.type ?? ""
586
+ })
433
587
  }),
434
588
  /* @__PURE__ */ jsxs(AttachmentContent, {
435
589
  children: [
@@ -442,22 +596,16 @@ var FileInput = ({
442
596
  }) : null
443
597
  ]
444
598
  }),
445
- /* @__PURE__ */ jsxs(AttachmentActions, {
446
- className: "ml-auto gap-1",
447
- children: [
448
- /* @__PURE__ */ jsx(AttachmentAction, {
449
- type: "button",
450
- "aria-label": labels.replaceFile,
451
- onClick: () => inputRef.current?.click(),
452
- children: image ? /* @__PURE__ */ jsx(ImageUp, {}) : /* @__PURE__ */ jsx(FileUp, {})
453
- }),
454
- canClear ? /* @__PURE__ */ jsx(AttachmentAction, {
455
- type: "button",
456
- "aria-label": `${labels.deleteFile} ${Schema3.is(Schema3.String)(title) ? title : ""}`,
457
- onClick: clear,
458
- children: /* @__PURE__ */ jsx(Trash2, {})
459
- }) : null
460
- ]
599
+ canClear && /* @__PURE__ */ jsx(AttachmentActions, {
600
+ className: "ml-auto",
601
+ children: /* @__PURE__ */ jsx(AttachmentAction, {
602
+ type: "button",
603
+ "aria-label": `${labels.deleteFile} ${Schema3.is(Schema3.String)(title) ? title : ""}`,
604
+ onClick: clear,
605
+ children: /* @__PURE__ */ jsx(X, {
606
+ "aria-hidden": "true"
607
+ })
608
+ })
461
609
  })
462
610
  ]
463
611
  }),
@@ -481,12 +629,13 @@ import { Badge } from "@/components/ui/badge";
481
629
  // ../../src/components/virtualized-combobox/react.tsx
482
630
  import { Combobox as ComboboxPrimitive } from "@base-ui/react";
483
631
  import { useVirtualizer } from "@tanstack/react-virtual";
484
- import { Check, ChevronsUpDown, X } from "lucide-react";
632
+ import { Check, ChevronsUpDown, X as X2 } from "lucide-react";
485
633
  import {
486
634
  useCallback,
487
635
  useEffect as useEffect2,
488
636
  useImperativeHandle,
489
- useRef as useRef2
637
+ useRef as useRef2,
638
+ useState as useState2
490
639
  } from "react";
491
640
  import { Button as Button2 } from "@/components/ui/button";
492
641
  import { InputGroup, InputGroupInput } from "@/components/ui/input-group";
@@ -499,8 +648,15 @@ import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/
499
648
 
500
649
  // ../../src/components/virtualized-combobox/classes.ts
501
650
  var virtualizedComboboxClasses = {
502
- itemLabel: "min-w-0 truncate"
651
+ itemLabel: "min-w-0 truncate",
652
+ groupLabel: "text-muted-foreground px-2 pt-3 pb-1 text-start text-xs",
653
+ itemContent: "flex min-w-0 flex-1 items-center gap-2 text-start",
654
+ itemMedia: "bg-muted grid size-8 shrink-0 place-items-center overflow-hidden rounded-md [&_svg]:size-4",
655
+ itemImage: "size-full object-cover",
656
+ itemDescription: "text-muted-foreground block truncate text-xs"
503
657
  };
658
+ var virtualizedComboboxGroupHeight = 36;
659
+ var virtualizedComboboxDetailHeight = 52;
504
660
  var resolveVirtualizedComboboxClasses = (overrides) => ({
505
661
  ...virtualizedComboboxClasses,
506
662
  ...overrides
@@ -511,10 +667,14 @@ import { Schema as Schema5 } from "effect";
511
667
  import { Component as Component2, UiSchema as UiSchema2 } from "effect/ui";
512
668
 
513
669
  // ../../src/components/virtualized-combobox/schema.ts
514
- import { Schema as Schema4, Struct as Struct2 } from "effect";
670
+ import { Predicate, Schema as Schema4, Struct as Struct2 } from "effect";
671
+ var Icon = Schema4.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "VirtualizedComboboxIcon" });
515
672
  var VirtualizedComboboxOptionSchema = Schema4.Struct({
516
673
  value: Schema4.String.pipe(Schema4.mutableKey),
517
- label: Schema4.String.pipe(Schema4.mutableKey)
674
+ label: Schema4.String.pipe(Schema4.mutableKey),
675
+ description: Schema4.optionalKey(Schema4.String),
676
+ imageSrc: Schema4.optionalKey(Schema4.String),
677
+ icon: Schema4.optionalKey(Icon)
518
678
  }).annotate({ identifier: "VirtualizedComboboxOption" });
519
679
  var VirtualizedComboboxLabelsSchema = Schema4.Struct({
520
680
  clear: Schema4.optionalKey(Schema4.String),
@@ -539,6 +699,8 @@ var htmlFields = {
539
699
  emptyLabel: Schema4.String,
540
700
  placeholder: Schema4.String,
541
701
  triggerLabel: Schema4.optionalKey(Schema4.String),
702
+ triggerIcon: Schema4.optionalKey(Icon),
703
+ itemHeight: Schema4.optionalKey(Schema4.Int.check(Schema4.isGreaterThan(0))),
542
704
  filter: Schema4.optionalKey(Schema4.Literals(["contains", "none"])),
543
705
  messages: Schema4.optionalKey(Schema4.Record(Schema4.String, Schema4.Struct({
544
706
  ...VirtualizedComboboxLabelsSchema.fields,
@@ -628,7 +790,8 @@ var VirtualizedComboboxEvents = UiSchema2.TaggedEnum(events).annotate({
628
790
  });
629
791
  var VirtualizedComboboxMessage = UiSchema2.TaggedEnum({
630
792
  ...events,
631
- Highlighted: { value: Schema5.String }
793
+ Highlighted: { value: Schema5.String },
794
+ ImageFailed: { src: Schema5.String }
632
795
  }).annotate({ identifier: "VirtualizedComboboxMessage" });
633
796
  var virtualizedComboboxOptions = {
634
797
  name: "VirtualizedCombobox",
@@ -636,6 +799,7 @@ var virtualizedComboboxOptions = {
636
799
  model: Schema5.Struct({
637
800
  open: Schema5.Boolean,
638
801
  searchValue: Schema5.String,
802
+ failedImages: Schema5.Array(Schema5.String),
639
803
  highlight: Schema5.NullOr(Schema5.Struct({ value: Schema5.String, id: Schema5.Int }))
640
804
  }).annotate({ identifier: "VirtualizedComboboxModel" }),
641
805
  message: VirtualizedComboboxMessage,
@@ -655,17 +819,24 @@ var update = Component2.define(virtualizedComboboxOptions).update({
655
819
  ValueChanged: ($, { value }) => $.set($.model).emit(VirtualizedComboboxEvents.ValueChanged({ value })),
656
820
  Highlighted: ($, { value }) => $.evolve({
657
821
  highlight: { value, id: ($.model.highlight?.id ?? 0) + 1 }
658
- })
822
+ }),
823
+ ImageFailed: ($, { src }) => $.model.failedImages.includes(src) ? $.model : $.evolve({ failedImages: [...$.model.failedImages, src] })
659
824
  });
660
825
 
661
826
  // ../../src/components/virtualized-combobox/react.tsx
662
827
  import { jsx as jsx2, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime";
663
828
  "use client";
664
829
  var optionEquals = (item, selected) => item.value === selected.value;
830
+ var hasOptionDetails = ({
831
+ description,
832
+ imageSrc,
833
+ icon
834
+ }) => Boolean(description || imageSrc || icon);
665
835
  var VirtualizedComboboxList = ({
666
836
  classes,
667
837
  emptyLabel,
668
838
  groupSelections,
839
+ itemHeight,
669
840
  itemIndexRef,
670
841
  locale = "en",
671
842
  messages: messageOverrides,
@@ -678,6 +849,8 @@ var VirtualizedComboboxList = ({
678
849
  const labels = virtualizedComboboxMessages(locale, messageOverrides);
679
850
  const entries = selectionEntries(filteredItems, selectedValues, groupSelections, labels);
680
851
  const scrollRef = useRef2(null);
852
+ const [failedImages, setFailedImages] = useState2(() => new Set);
853
+ const rowHeight = itemHeight ?? (filteredItems.some(hasOptionDetails) ? virtualizedComboboxDetailHeight : 36);
681
854
  const virtualizer = useVirtualizer({
682
855
  count: entries.length,
683
856
  getScrollElement: () => scrollRef.current,
@@ -685,7 +858,7 @@ var VirtualizedComboboxList = ({
685
858
  const entry = entries[index];
686
859
  return entry?.kind === "group" ? `group-${entry.key}` : entry?.item.value ?? index;
687
860
  },
688
- estimateSize: () => 36,
861
+ estimateSize: (index) => entries[index]?.kind === "group" ? virtualizedComboboxGroupHeight : rowHeight,
689
862
  overscan: 8
690
863
  });
691
864
  useEffect2(() => {
@@ -727,7 +900,7 @@ var VirtualizedComboboxList = ({
727
900
  return /* @__PURE__ */ jsx2(ComboboxPrimitive.Group, {
728
901
  className: "contents",
729
902
  children: /* @__PURE__ */ jsx2(ComboboxPrimitive.GroupLabel, {
730
- className: "text-muted-foreground absolute top-0 left-0 w-full px-2 pt-3 pb-1 text-xs",
903
+ className: `absolute top-0 left-0 w-full ${virtualizedComboboxClasses.groupLabel}`,
731
904
  "data-index": virtualItem.index,
732
905
  ref: virtualizer.measureElement,
733
906
  style,
@@ -735,6 +908,8 @@ var VirtualizedComboboxList = ({
735
908
  })
736
909
  }, entry.key);
737
910
  }
911
+ const details = entry.item;
912
+ const image = details.imageSrc && !failedImages.has(details.imageSrc) ? details.imageSrc : undefined;
738
913
  return /* @__PURE__ */ jsxs2(ComboboxPrimitive.Item, {
739
914
  "aria-posinset": entry.index + 1,
740
915
  "aria-setsize": filteredItems.length,
@@ -745,10 +920,38 @@ var VirtualizedComboboxList = ({
745
920
  style,
746
921
  value: entry.item,
747
922
  children: [
748
- renderItem?.(entry.item) ?? /* @__PURE__ */ jsx2("span", {
923
+ renderItem?.(entry.item) ?? (hasOptionDetails(details) ? /* @__PURE__ */ jsxs2("span", {
924
+ className: virtualizedComboboxClasses.itemContent,
925
+ children: [
926
+ (image || details.icon) && /* @__PURE__ */ jsx2("span", {
927
+ "aria-hidden": "true",
928
+ className: virtualizedComboboxClasses.itemMedia,
929
+ children: image ? /* @__PURE__ */ jsx2("img", {
930
+ src: image,
931
+ alt: "",
932
+ loading: "lazy",
933
+ onError: () => setFailedImages((failed) => new Set(failed).add(image)),
934
+ className: virtualizedComboboxClasses.itemImage
935
+ }) : details.icon
936
+ }),
937
+ /* @__PURE__ */ jsxs2("span", {
938
+ className: "min-w-0 flex-1",
939
+ children: [
940
+ /* @__PURE__ */ jsx2("span", {
941
+ className: cn("block", virtualizedComboboxClasses.itemLabel),
942
+ children: entry.item.label
943
+ }),
944
+ details.description && /* @__PURE__ */ jsx2("span", {
945
+ className: virtualizedComboboxClasses.itemDescription,
946
+ children: details.description
947
+ })
948
+ ]
949
+ })
950
+ ]
951
+ }) : /* @__PURE__ */ jsx2("span", {
749
952
  className: virtualizedComboboxClasses.itemLabel,
750
953
  children: entry.item.label
751
- }),
954
+ })),
752
955
  /* @__PURE__ */ jsx2(ComboboxPrimitive.ItemIndicator, {
753
956
  className: "absolute right-2 flex size-4 items-center justify-center",
754
957
  children: /* @__PURE__ */ jsx2(Check, {})
@@ -766,6 +969,7 @@ var VirtualizedComboboxContent = ({
766
969
  contentClassName,
767
970
  emptyLabel,
768
971
  groupSelections,
972
+ itemHeight,
769
973
  itemIndexRef,
770
974
  locale = "en",
771
975
  messages: messageOverrides,
@@ -797,6 +1001,7 @@ var VirtualizedComboboxContent = ({
797
1001
  classes,
798
1002
  emptyLabel,
799
1003
  groupSelections,
1004
+ itemHeight,
800
1005
  itemIndexRef,
801
1006
  locale,
802
1007
  messages: messageOverrides,
@@ -831,7 +1036,7 @@ var defaultClear = (label) => /* @__PURE__ */ jsx2(ComboboxPrimitive.Clear, {
831
1036
  "aria-label": label,
832
1037
  className: "text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 absolute top-1/2 right-7 z-10 flex size-6 -translate-y-1/2 items-center justify-center rounded-sm outline-none focus-visible:border focus-visible:ring-3",
833
1038
  type: "button",
834
- children: /* @__PURE__ */ jsx2(X, {
1039
+ children: /* @__PURE__ */ jsx2(X2, {
835
1040
  className: "size-3.5"
836
1041
  })
837
1042
  });