@krak-stack/registry 0.11.7 → 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.
- package/CHANGELOG.md +54 -0
- package/README.md +39 -0
- package/dist/components/app-switcher/html.d.ts +2 -2
- package/dist/components/asset-input/html.d.ts +70 -0
- package/dist/components/asset-input/html.js +1549 -0
- package/dist/components/asset-input/index.d.ts +280 -0
- package/dist/components/asset-input/react.d.ts +32 -0
- package/dist/components/asset-input/react.js +2269 -0
- package/dist/components/asset-input/schema.d.ts +93 -0
- package/dist/components/asset-input/upload.d.ts +15 -0
- package/dist/components/asset-table/html.d.ts +110 -0
- package/dist/components/asset-table/html.js +4934 -0
- package/dist/components/asset-table/index.d.ts +225 -0
- package/dist/components/asset-table/react.d.ts +21 -0
- package/dist/components/asset-table/react.js +8241 -0
- package/dist/components/asset-table/schema.d.ts +73 -0
- package/dist/components/audit-log-table/html.js +47 -13
- package/dist/components/audit-log-table/react.js +36 -12
- package/dist/components/copy-button/html.d.ts +2 -2
- package/dist/components/danger-confirmation/html.d.ts +2 -2
- package/dist/components/data-table/classes.d.ts +2 -0
- package/dist/components/data-table/html.d.ts +58 -0
- package/dist/components/data-table/html.js +47 -13
- package/dist/components/data-table/index.d.ts +51 -1
- package/dist/components/data-table/react.d.ts +1 -0
- package/dist/components/data-table/react.js +36 -12
- package/dist/components/data-table/schema.d.ts +93 -3
- package/dist/components/date-input/html.d.ts +2 -2
- package/dist/components/docs/html.js +22 -4
- package/dist/components/docs/react.js +33 -2
- package/dist/components/editable-text/html.d.ts +2 -2
- package/dist/components/editing-locale-switcher/html.d.ts +2 -2
- package/dist/components/effect-form/react.js +343 -138
- package/dist/components/file-input/classes.d.ts +1 -1
- package/dist/components/file-input/file-type.d.ts +1 -0
- package/dist/components/file-input/html.d.ts +8 -1
- package/dist/components/file-input/html.js +170 -12
- package/dist/components/file-input/index.d.ts +1 -0
- package/dist/components/file-input/react.d.ts +9 -1
- package/dist/components/file-input/react.js +277 -127
- package/dist/components/file-input/schema.d.ts +1 -0
- package/dist/components/form/react.d.ts +5 -5
- package/dist/components/form/react.js +343 -138
- package/dist/components/icon-input/html.js +19 -5
- package/dist/components/icon-input/react.js +70 -13
- package/dist/components/locale-switcher/html.d.ts +2 -2
- package/dist/components/map-menu/html.d.ts +10 -4
- package/dist/components/map-menu/html.js +13 -8
- package/dist/components/map-menu/index.d.ts +5 -4
- package/dist/components/map-menu/react.d.ts +28 -17
- package/dist/components/map-menu/react.js +84 -178
- package/dist/components/map-menu/schema.d.ts +6 -0
- package/dist/components/map-menu/shared.d.ts +4 -0
- package/dist/components/permissions-input/classes.d.ts +8 -0
- package/dist/components/permissions-input/html.d.ts +41 -0
- package/dist/components/permissions-input/html.js +130 -0
- package/dist/components/permissions-input/index.d.ts +80 -0
- package/dist/components/permissions-input/react.d.ts +7 -0
- package/dist/components/permissions-input/react.js +201 -0
- package/dist/components/permissions-input/schema.d.ts +33 -0
- package/dist/components/phone-number-input/html.js +48 -14
- package/dist/components/phone-number-input/react.js +67 -10
- package/dist/components/presence-transition/index.d.ts +2 -2
- package/dist/components/search-menu/html.d.ts +2 -2
- package/dist/components/sidebar-layout/html.d.ts +3 -2
- package/dist/components/sidebar-layout/html.js +20 -2
- package/dist/components/sidebar-layout/index.d.ts +1 -0
- package/dist/components/sidebar-layout/react.js +33 -2
- package/dist/components/time-input/html.d.ts +2 -2
- package/dist/components/timezone-input/html.js +48 -14
- package/dist/components/timezone-input/react.js +67 -10
- package/dist/components/tracking-notice/html.d.ts +4 -4
- package/dist/components/tracking-notice/index.d.ts +2 -2
- package/dist/components/upload-attachment/classes.d.ts +3 -2
- package/dist/components/upload-attachment/html.d.ts +1 -1
- package/dist/components/upload-attachment/html.js +7 -5
- package/dist/components/upload-attachment/react.d.ts +3 -1
- package/dist/components/upload-attachment/react.js +25 -17
- package/dist/components/virtualized-combobox/classes.d.ts +12 -0
- package/dist/components/virtualized-combobox/html.d.ts +45 -3
- package/dist/components/virtualized-combobox/html.js +48 -14
- package/dist/components/virtualized-combobox/index.d.ts +55 -4
- package/dist/components/virtualized-combobox/react.d.ts +6 -2
- package/dist/components/virtualized-combobox/react.js +67 -10
- package/dist/components/virtualized-combobox/schema.d.ts +60 -4
- package/dist/components/webhook-delivery-table/html.js +47 -13
- package/dist/components/webhook-delivery-table/react.js +36 -12
- package/dist/lib/access/index.d.ts +61 -0
- package/dist/lib/access/index.js +92 -0
- package/dist/lib/access/table/classes.d.ts +13 -0
- package/dist/lib/access/table/html.d.ts +39 -0
- package/dist/lib/access/table/html.js +157 -0
- package/dist/lib/access/table/index.d.ts +32 -0
- package/dist/lib/access/table/react.d.ts +3 -0
- package/dist/lib/access/table/react.js +195 -0
- package/dist/lib/access/table/schema.d.ts +43 -0
- package/dist/lib/docs.integrations.server.js +23 -1
- package/dist/lib/docs.js +33 -2
- package/dist/lib/docs.server.js +29 -2
- package/dist/lib/documentation-toolkit.js +23 -1
- package/dist/lib/effect-ui-adapter/use-model.d.ts +1 -1
- package/dist/lib/effect-ui-adapter/use-model.js +19 -11
- package/dist/lib/lucide-effect.d.ts +19 -19
- package/dist/lib/lucide-effect.js +38 -38
- package/dist/services/assets/library.d.ts +221 -0
- package/dist/services/assets/schema.d.ts +3 -0
- package/dist/services/assets/url.d.ts +12 -0
- package/dist/services/assets/use-library.d.ts +20 -0
- package/package.json +13 -1
|
@@ -5,7 +5,34 @@ import {
|
|
|
5
5
|
useRef,
|
|
6
6
|
useState
|
|
7
7
|
} from "react";
|
|
8
|
-
import {
|
|
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 =
|
|
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 && (
|
|
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
|
-
|
|
252
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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__ */
|
|
415
|
-
className: "ml-auto
|
|
416
|
-
children:
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
})
|
|
423
|
-
|
|
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"]>;
|
|
@@ -145,7 +145,7 @@ declare const RevertButton: ({ locale, messages, original, }: {
|
|
|
145
145
|
messages?: FormMessageTranslations;
|
|
146
146
|
original: string;
|
|
147
147
|
}) => JSX.Element | null;
|
|
148
|
-
declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tanstack/
|
|
148
|
+
declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TSubmitMeta>(props: import("@tanstack/form-core").FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
149
149
|
readonly TextField: typeof TextField;
|
|
150
150
|
readonly TextAreaField: typeof TextAreaField;
|
|
151
151
|
readonly SelectField: typeof SelectField;
|
|
@@ -161,7 +161,7 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
161
161
|
readonly FormError: typeof FormError;
|
|
162
162
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
163
163
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
164
|
-
}>, withForm: <TFormData, TOnMount extends undefined | import("@tanstack/
|
|
164
|
+
}>, withForm: <TFormData, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TRenderProps extends object = {}>({ render, props, }: import("@tanstack/react-form").WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
165
165
|
readonly TextField: typeof TextField;
|
|
166
166
|
readonly TextAreaField: typeof TextAreaField;
|
|
167
167
|
readonly SelectField: typeof SelectField;
|
|
@@ -178,7 +178,7 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
178
178
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
179
179
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
180
180
|
}, TRenderProps>) => import("react").FunctionComponent<import("react").PropsWithChildren<NoInfer<[unknown] extends [TRenderProps] ? any : TRenderProps> & {
|
|
181
|
-
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/
|
|
181
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnMount] ? [TOnMount] extends [TOnMount & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnMount : TOnMount, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnChange] ? [TOnChange] extends [TOnChange & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChange : TOnChange, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnChangeAsync] ? [TOnChangeAsync] extends [TOnChangeAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChangeAsync : TOnChangeAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnBlur] ? [TOnBlur] extends [TOnBlur & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlur : TOnBlur, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnBlurAsync] ? [TOnBlurAsync] extends [TOnBlurAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlurAsync : TOnBlurAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmit] ? [TOnSubmit] extends [TOnSubmit & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmit : TOnSubmit, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmitAsync] ? [TOnSubmitAsync] extends [TOnSubmitAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmitAsync : TOnSubmitAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamic] ? [TOnDynamic] extends [TOnDynamic & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamic : TOnDynamic, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamicAsync] ? [TOnDynamicAsync] extends [TOnDynamicAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamicAsync : TOnDynamicAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnServer] ? [TOnServer] extends [TOnServer & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnServer : TOnServer, [unknown] extends [TSubmitMeta] ? any : TSubmitMeta, {
|
|
182
182
|
readonly TextField: typeof TextField;
|
|
183
183
|
readonly TextAreaField: typeof TextAreaField;
|
|
184
184
|
readonly SelectField: typeof SelectField;
|
|
@@ -211,8 +211,8 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
211
211
|
readonly FormError: typeof FormError;
|
|
212
212
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
213
213
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
214
|
-
}, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends import("@tanstack/
|
|
215
|
-
form: import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/
|
|
214
|
+
}, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends import("@tanstack/form-core").DeepKeysOfType<TFormData, TFieldGroupData | null | undefined> | import("@tanstack/form-core").FieldsMap<TFormData, TFieldGroupData>, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TFormSubmitMeta>(params: import("react").PropsWithChildren<NoInfer<TRenderProps> & {
|
|
215
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/form-core").FieldsMap<unknown, TFormData>, any, any, any, any, any, any, any, any, any, any, unknown extends TSubmitMeta ? TFormSubmitMeta : TSubmitMeta, {
|
|
216
216
|
readonly TextField: typeof TextField;
|
|
217
217
|
readonly TextAreaField: typeof TextAreaField;
|
|
218
218
|
readonly SelectField: typeof SelectField;
|