vlite3 1.4.5 → 1.4.7
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/README.md +1 -0
- package/components/AppShell/AppShellLayoutStorefront.vue.d.ts +4 -17
- package/components/AppShell/AppShellLayoutStorefront.vue.js +116 -152
- package/components/AvatarUploader/AvatarUploader.vue.d.ts +1 -1
- package/components/AvatarUploader/AvatarUploader.vue.js +1 -1
- package/components/CategoryManager/CategoryManager.vue2.js +2 -2
- package/components/Chat/ChatInterface.vue.js +1 -1
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue.js → CommandPaletteItem.vue2.js} +1 -1
- package/components/Comment/CommentEditor.vue.js +1 -1
- package/components/FilePicker/FilePickerDropzone.vue.d.ts +27 -0
- package/components/FilePicker/FilePickerDropzone.vue.js +117 -0
- package/components/FilePicker/FilePickerDropzone.vue2.js +4 -0
- package/components/FilePicker/FilePickerInput.vue.d.ts +22 -0
- package/components/FilePicker/FilePickerInput.vue.js +147 -0
- package/components/FilePicker/FilePickerInput.vue2.js +4 -0
- package/components/FilePicker/FilePreview.vue.d.ts +21 -0
- package/components/FilePicker/FilePreview.vue.js +95 -0
- package/components/FilePicker/FilePreview.vue2.js +4 -0
- package/components/FilePicker/composables/useFileProcessing.d.ts +65 -0
- package/components/FilePicker/composables/useFileProcessing.js +141 -0
- package/components/FilePicker/index.d.ts +2 -2
- package/components/FilePicker/{FilePicker.vue.d.ts → index.vue.d.ts} +11 -18
- package/components/FilePicker/index.vue.js +131 -0
- package/components/FilePicker/index.vue2.js +4 -0
- package/components/FilePicker/types.d.ts +17 -0
- package/components/FilePicker/utils.d.ts +23 -0
- package/components/FilePicker/utils.js +37 -0
- package/components/Form/AccordionView.vue.d.ts +26 -0
- package/components/Form/AccordionView.vue.js +219 -0
- package/components/Form/AccordionView.vue2.js +4 -0
- package/components/Form/FormField.vue.js +2 -2
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/TableRow.vue.d.ts +18 -0
- package/components/Form/TableRow.vue.js +88 -0
- package/components/Form/TableRow.vue2.js +4 -0
- package/components/Form/TableView.vue.d.ts +23 -0
- package/components/Form/TableView.vue.js +88 -0
- package/components/Form/TableView.vue2.js +4 -0
- package/components/Form/composables/useCustomFieldRows.d.ts +52 -0
- package/components/Form/composables/useCustomFieldRows.js +77 -0
- package/components/Form/index.d.ts +1 -1
- package/components/Form/{CustomFields.vue.d.ts → index.vue.d.ts} +5 -6
- package/components/Form/index.vue.js +7 -0
- package/components/Form/index.vue2.js +141 -0
- package/components/Form/rowHelpers.d.ts +45 -0
- package/components/Form/rowHelpers.js +40 -0
- package/components/IconPicker.vue.d.ts +2 -2
- package/components/ImageMagnifier.vue.d.ts +18 -0
- package/components/ImageMagnifier.vue.js +73 -0
- package/components/ImageMagnifier.vue2.js +4 -0
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/Screen/ScreenFilter.vue.js +2 -2
- package/components/ThumbnailSelector/ThumbnailSelector.vue.js +1 -1
- package/components/ThumbnailSelector/ThumbnailSelector.vue2.js +1 -1
- package/components/index.d.ts +2 -1
- package/index.d.ts +1 -0
- package/index.js +107 -105
- package/package.json +1 -1
- package/style.css +1 -1
- package/components/FilePicker/FilePicker.vue.js +0 -437
- package/components/FilePicker/FilePicker.vue2.js +0 -4
- package/components/Form/CustomFields.vue.js +0 -7
- package/components/Form/CustomFields.vue2.js +0 -465
- /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
|
@@ -1,437 +0,0 @@
|
|
|
1
|
-
import { defineComponent as pe, computed as s, ref as N, useSlots as ge, onBeforeUnmount as ve, openBlock as r, createElementBlock as c, normalizeClass as k, createElementVNode as o, renderSlot as he, withKeys as q, withModifiers as w, createVNode as F, toDisplayString as g, createBlock as A, createCommentVNode as z, createTextVNode as ye, Fragment as xe, renderList as be } from "vue";
|
|
2
|
-
import v from "../Icon.vue.js";
|
|
3
|
-
import G from "../Button.vue.js";
|
|
4
|
-
import { $t as C } from "../../utils/i18n.js";
|
|
5
|
-
const ke = ["multiple", "accept", "data-testid"], we = ["data-testid"], Fe = ["aria-disabled", "aria-label", "onKeydown"], Ve = {
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "flex min-w-0 flex-1 items-center gap-2.5"
|
|
8
|
-
}, Se = ["src", "alt"], $e = { class: "min-w-0 flex-1" }, Ae = { class: "truncate font-medium leading-tight text-foreground" }, ze = { class: "truncate text-[11px] leading-tight text-muted-foreground" }, Ce = {
|
|
9
|
-
key: 1,
|
|
10
|
-
class: "flex min-w-0 flex-1 items-center gap-2 text-muted-foreground"
|
|
11
|
-
}, Te = { class: "truncate" }, De = {
|
|
12
|
-
key: 0,
|
|
13
|
-
class: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center gap-2 bg-background"
|
|
14
|
-
}, Ne = ["data-testid"], je = { class: "p-3 bg-muted rounded-full text-muted-foreground" }, Pe = { class: "space-y-1" }, Be = { class: "text-sm font-medium text-foreground" }, Ue = { class: "text-primary hover:underline" }, Ie = {
|
|
15
|
-
key: 0,
|
|
16
|
-
class: "text-xs text-muted-foreground"
|
|
17
|
-
}, Me = {
|
|
18
|
-
key: 1,
|
|
19
|
-
class: "space-y-2"
|
|
20
|
-
}, Le = { class: "shrink-0 mr-3" }, Re = { class: "p-2 bg-primary-light rounded text-primary-fg-light" }, We = { class: "flex-1 min-w-0 flex flex-col items-start overflow-hidden" }, Ee = {
|
|
21
|
-
key: 0,
|
|
22
|
-
class: "inline-flex items-center group/rename w-fit max-w-full mb-0.5"
|
|
23
|
-
}, Ke = { class: "grid relative w-fit max-w-full items-center -ml-1" }, Oe = { class: "invisible whitespace-pre col-start-1 row-start-1 text-sm font-medium px-1 py-0.5 max-w-full overflow-hidden text-ellipsis" }, qe = ["value", "onInput", "placeholder"], Ge = ["title"], He = {
|
|
24
|
-
key: 1,
|
|
25
|
-
class: "text-sm font-medium text-foreground truncate w-full"
|
|
26
|
-
}, Je = { class: "text-xs text-muted-foreground -mt-1" }, Qe = { class: "shrink-0 ml-3 flex gap-2 items-center" }, Xe = {
|
|
27
|
-
key: 0,
|
|
28
|
-
class: "flex gap-2"
|
|
29
|
-
}, tt = /* @__PURE__ */ pe({
|
|
30
|
-
name: "FilePicker",
|
|
31
|
-
__name: "FilePicker",
|
|
32
|
-
props: {
|
|
33
|
-
modelValue: { default: null },
|
|
34
|
-
multiSelect: { type: Boolean, default: !1 },
|
|
35
|
-
fileTypes: { default: () => [] },
|
|
36
|
-
returnFormat: { default: "file" },
|
|
37
|
-
loading: { type: Boolean, default: !1 },
|
|
38
|
-
disabled: { type: Boolean, default: !1 },
|
|
39
|
-
maxSize: {},
|
|
40
|
-
maxFiles: {},
|
|
41
|
-
variant: { default: "dropzone" },
|
|
42
|
-
placeholder: {},
|
|
43
|
-
placeholderI18n: {},
|
|
44
|
-
textI18n: {},
|
|
45
|
-
size: { default: "md" },
|
|
46
|
-
rounded: { default: "md" },
|
|
47
|
-
allowRename: { type: Boolean, default: !1 }
|
|
48
|
-
},
|
|
49
|
-
emits: ["update:modelValue", "change", "error"],
|
|
50
|
-
setup(a, { emit: H }) {
|
|
51
|
-
const t = a, f = H, p = (e, l, i) => {
|
|
52
|
-
const d = i ? C(e, i) : C(e);
|
|
53
|
-
return d !== e ? d : l;
|
|
54
|
-
}, j = s(
|
|
55
|
-
() => t.placeholderI18n ? C(t.placeholderI18n) : t.placeholder !== void 0 ? t.placeholder : p("vlite.filePicker.selectFile", "Select file...")
|
|
56
|
-
), J = s(() => t.textI18n ? C(t.textI18n) : p("vlite.filePicker.clickToUpload", "Click to upload")), Q = s(() => p("vlite.filePicker.dragAndDrop", "or drag and drop")), X = s(() => p("vlite.filePicker.addMore", "Add more")), T = s(() => p("vlite.filePicker.unknownFile", "Unknown File")), P = s(() => p("vlite.filePicker.enterFileName", "Enter file name")), Y = s(() => p("vlite.filePicker.renameFile", "Rename file"));
|
|
57
|
-
s(() => p("vlite.filePicker.emptyTitle", "No file selected")), s(
|
|
58
|
-
() => p("vlite.filePicker.emptyDescription", "Drop a file here or browse from your device")
|
|
59
|
-
);
|
|
60
|
-
const B = N(null), V = N(!1), u = N(!1), U = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new Set();
|
|
61
|
-
ge();
|
|
62
|
-
const Z = s(() => t.fileTypes.join(",")), b = s(() => Array.isArray(t.modelValue) ? t.modelValue.length > 0 : t.modelValue !== null), y = s(() => {
|
|
63
|
-
let e = [];
|
|
64
|
-
return Array.isArray(t.modelValue) ? e = t.modelValue : t.modelValue && (e = [t.modelValue]), e.map((l) => {
|
|
65
|
-
if (typeof l == "string") {
|
|
66
|
-
const i = l.split("/").pop() || T.value;
|
|
67
|
-
return {
|
|
68
|
-
fileName: decodeURIComponent(i),
|
|
69
|
-
fileType: "unknown",
|
|
70
|
-
fileSize: 0,
|
|
71
|
-
file: null,
|
|
72
|
-
base64: l,
|
|
73
|
-
isUrl: !0
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
return l;
|
|
77
|
-
});
|
|
78
|
-
}), x = () => {
|
|
79
|
-
if (!(t.disabled || t.loading || u.value)) {
|
|
80
|
-
if (t.multiSelect && t.maxFiles && (Array.isArray(t.modelValue) ? t.modelValue.length : t.modelValue ? 1 : 0) >= t.maxFiles) {
|
|
81
|
-
f("error", `Maximum ${t.maxFiles} files allowed`);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
B.value?.click();
|
|
85
|
-
}
|
|
86
|
-
}, _ = (e) => {
|
|
87
|
-
e.preventDefault(), !(t.disabled || t.loading) && (V.value = !0);
|
|
88
|
-
}, ee = (e) => {
|
|
89
|
-
e.preventDefault(), V.value = !1;
|
|
90
|
-
}, te = (e) => {
|
|
91
|
-
e.preventDefault(), V.value = !1, !(t.disabled || t.loading || u.value) && e.dataTransfer?.files && W(e.dataTransfer.files);
|
|
92
|
-
}, le = (e) => {
|
|
93
|
-
const l = e.target;
|
|
94
|
-
l.files && W(l.files), l.value = "";
|
|
95
|
-
}, I = (e) => {
|
|
96
|
-
if (e === 0 || !e) return "";
|
|
97
|
-
const l = 1024, i = ["Bytes", "KB", "MB", "GB", "TB"], d = Math.floor(Math.log(e) / Math.log(l));
|
|
98
|
-
return parseFloat((e / Math.pow(l, d)).toFixed(2)) + " " + i[d];
|
|
99
|
-
}, M = (e = "") => e.split("?")[0].split("#")[0].split(".").pop()?.toLowerCase() || "", L = (e) => {
|
|
100
|
-
const l = e.fileType || "", i = M(e.fileName || e.base64 || "");
|
|
101
|
-
return l.startsWith("image/") || e.base64?.startsWith("data:image/") || ["apng", "avif", "gif", "jpg", "jpeg", "png", "svg", "webp"].includes(i);
|
|
102
|
-
}, R = (e) => {
|
|
103
|
-
if (!L(e)) return "";
|
|
104
|
-
if (e.base64?.startsWith("data:image/") || e.isUrl) return e.base64;
|
|
105
|
-
if (typeof File < "u" && e.file instanceof File) {
|
|
106
|
-
const l = U.get(e.file);
|
|
107
|
-
if (l) return l;
|
|
108
|
-
const i = URL.createObjectURL(e.file);
|
|
109
|
-
return U.set(e.file, i), D.add(i), i;
|
|
110
|
-
}
|
|
111
|
-
return "";
|
|
112
|
-
}, ie = (e) => {
|
|
113
|
-
const l = e.fileType || "", i = M(e.fileName || e.base64 || "");
|
|
114
|
-
return L(e) ? "lucide:image" : l.includes("pdf") || i === "pdf" || l.includes("word") || l.includes("document") || ["doc", "docx", "odt", "rtf"].includes(i) ? "lucide:file-text" : l.includes("spreadsheet") || l.includes("excel") || ["csv", "xls", "xlsx", "ods"].includes(i) ? "lucide:table" : l.includes("presentation") || ["ppt", "pptx", "odp", "key"].includes(i) ? "lucide:presentation" : l.startsWith("video/") || ["mp4", "mov", "webm", "avi", "mkv"].includes(i) ? "lucide:file-video" : l.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a"].includes(i) ? "lucide:file-audio" : ["zip", "rar", "7z", "tar", "gz"].includes(i) ? "lucide:file-archive" : ["js", "ts", "vue", "html", "css", "json", "xml"].includes(i) ? "lucide:file-code" : "lucide:file";
|
|
115
|
-
}, ae = s(() => t.fileTypes.join(", ")), re = (e) => new Promise((l, i) => {
|
|
116
|
-
const d = new FileReader();
|
|
117
|
-
d.readAsDataURL(e), d.onload = () => {
|
|
118
|
-
typeof d.result == "string" ? l(d.result) : i(new Error("Failed to read file as base64"));
|
|
119
|
-
}, d.onerror = (m) => i(m);
|
|
120
|
-
});
|
|
121
|
-
ve(() => {
|
|
122
|
-
D.forEach((e) => URL.revokeObjectURL(e)), D.clear();
|
|
123
|
-
});
|
|
124
|
-
const W = async (e) => {
|
|
125
|
-
if (e.length === 0) return;
|
|
126
|
-
u.value = !0;
|
|
127
|
-
const l = [], i = [], d = Array.from(e);
|
|
128
|
-
let m = t.multiSelect ? d : [d[0]];
|
|
129
|
-
if (t.multiSelect && t.maxFiles) {
|
|
130
|
-
const n = Array.isArray(t.modelValue) ? t.modelValue.length : t.modelValue ? 1 : 0, h = t.maxFiles - n;
|
|
131
|
-
if (h <= 0) {
|
|
132
|
-
f("error", `Maximum ${t.maxFiles} files allowed`), u.value = !1;
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
m.length > h && (i.push(`Only ${h} more file(s) allowed. Maximum ${t.maxFiles} files.`), m = m.slice(0, h));
|
|
136
|
-
}
|
|
137
|
-
try {
|
|
138
|
-
for (const n of m) {
|
|
139
|
-
if (t.fileTypes.length > 0 && !t.fileTypes.some(($) => {
|
|
140
|
-
if ($.startsWith("."))
|
|
141
|
-
return n.name.toLowerCase().endsWith($.toLowerCase());
|
|
142
|
-
if ($.endsWith("/*")) {
|
|
143
|
-
const me = $.split("/")[0];
|
|
144
|
-
return n.type.startsWith(me);
|
|
145
|
-
}
|
|
146
|
-
return n.type === $;
|
|
147
|
-
})) {
|
|
148
|
-
i.push(`File type not allowed: ${n.name}`);
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
let h = !1;
|
|
152
|
-
t.maxSize && n.size > t.maxSize && (i.push(`File too large: ${n.name}`), h = !0);
|
|
153
|
-
let K = "";
|
|
154
|
-
if (t.returnFormat === "base64" && !h)
|
|
155
|
-
try {
|
|
156
|
-
K = await re(n);
|
|
157
|
-
} catch (O) {
|
|
158
|
-
console.error("Base64 read failed", O);
|
|
159
|
-
}
|
|
160
|
-
l.push({
|
|
161
|
-
fileName: n.name,
|
|
162
|
-
fileType: n.type,
|
|
163
|
-
fileSize: n.size,
|
|
164
|
-
file: n,
|
|
165
|
-
base64: K
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
if (i.length > 0 && f("error", i.join("; ")), l.length > 0) {
|
|
169
|
-
let n;
|
|
170
|
-
t.multiSelect ? n = [...Array.isArray(t.modelValue) ? t.modelValue : t.modelValue ? [t.modelValue] : [], ...l] : n = l[0], f("update:modelValue", n), f("change", n);
|
|
171
|
-
}
|
|
172
|
-
} catch (n) {
|
|
173
|
-
console.error("Error processing files:", n), f("error", "Failed to process files");
|
|
174
|
-
} finally {
|
|
175
|
-
u.value = !1;
|
|
176
|
-
}
|
|
177
|
-
}, ne = (e) => {
|
|
178
|
-
if (!(t.disabled || t.loading))
|
|
179
|
-
if (t.multiSelect && Array.isArray(t.modelValue)) {
|
|
180
|
-
const l = [...t.modelValue];
|
|
181
|
-
l.splice(e, 1), f("update:modelValue", l), f("change", l);
|
|
182
|
-
} else
|
|
183
|
-
f("update:modelValue", null), f("change", null);
|
|
184
|
-
}, se = () => {
|
|
185
|
-
t.disabled || t.loading || (f("update:modelValue", null), f("change", null));
|
|
186
|
-
}, oe = (e, l) => {
|
|
187
|
-
if (t.disabled || t.loading || u.value) return;
|
|
188
|
-
let i;
|
|
189
|
-
t.multiSelect && Array.isArray(t.modelValue) ? (i = [...t.modelValue], typeof i[e] == "object" && i[e] !== null ? i[e] = { ...i[e], fileName: l } : typeof i[e] == "string" && (i[e] = {
|
|
190
|
-
fileName: l,
|
|
191
|
-
fileType: "unknown",
|
|
192
|
-
fileSize: 0,
|
|
193
|
-
file: null,
|
|
194
|
-
base64: i[e],
|
|
195
|
-
isUrl: !0
|
|
196
|
-
})) : t.modelValue && typeof t.modelValue == "object" && !Array.isArray(t.modelValue) ? i = { ...t.modelValue, fileName: l } : typeof t.modelValue == "string" && (i = {
|
|
197
|
-
fileName: l,
|
|
198
|
-
fileType: "unknown",
|
|
199
|
-
fileSize: 0,
|
|
200
|
-
file: null,
|
|
201
|
-
base64: t.modelValue,
|
|
202
|
-
isUrl: !0
|
|
203
|
-
}), i !== void 0 && (f("update:modelValue", i), f("change", i));
|
|
204
|
-
}, de = s(() => b.value ? y.value.map((l) => l.fileName).join(", ") : ""), S = s(() => y.value[0]), ue = s(() => {
|
|
205
|
-
if (!b.value) return "";
|
|
206
|
-
const e = y.value, l = e[0]?.fileName || T.value;
|
|
207
|
-
return !t.multiSelect || e.length <= 1 ? l : `${l} +${e.length - 1}`;
|
|
208
|
-
}), ce = s(() => {
|
|
209
|
-
const e = y.value;
|
|
210
|
-
if (!e.length) return ae.value;
|
|
211
|
-
if (t.multiSelect && e.length > 1)
|
|
212
|
-
return `${e.length} files selected`;
|
|
213
|
-
const l = e[0];
|
|
214
|
-
return I(l.fileSize) || l.fileType || T.value;
|
|
215
|
-
}), fe = s(() => {
|
|
216
|
-
const e = "group flex w-full items-center bg-background text-sm ring-offset-background transition-all focus-visible:outline-none cursor-pointer", l = {
|
|
217
|
-
sm: "min-h-8 px-2 py-1 text-xs gap-2",
|
|
218
|
-
md: "min-h-10 px-3 py-1.5 text-sm gap-2.5",
|
|
219
|
-
lg: "min-h-12 px-3 py-2 text-base gap-3"
|
|
220
|
-
}, i = {
|
|
221
|
-
none: "rounded-none",
|
|
222
|
-
sm: "rounded-sm",
|
|
223
|
-
md: "rounded-md",
|
|
224
|
-
lg: "rounded-lg",
|
|
225
|
-
xl: "rounded-xl",
|
|
226
|
-
"2xl": "rounded-2xl",
|
|
227
|
-
full: "rounded-full"
|
|
228
|
-
};
|
|
229
|
-
return [
|
|
230
|
-
e,
|
|
231
|
-
"border border-input focus-visible:border-primary",
|
|
232
|
-
// Default outline style
|
|
233
|
-
l[t.size],
|
|
234
|
-
i[t.rounded],
|
|
235
|
-
"pr-10 text-left",
|
|
236
|
-
// Space for action icon
|
|
237
|
-
t.disabled ? "cursor-not-allowed opacity-50" : ""
|
|
238
|
-
].join(" ");
|
|
239
|
-
}), E = s(() => ({
|
|
240
|
-
sm: "h-6 w-6 rounded",
|
|
241
|
-
md: "h-7 w-7 rounded-md",
|
|
242
|
-
lg: "h-8 w-8 rounded-md"
|
|
243
|
-
})[t.size]);
|
|
244
|
-
return (e, l) => (r(), c("div", {
|
|
245
|
-
class: k(["vl-file-picker w-full", { "vl-file-picker--input": a.variant === "input" }])
|
|
246
|
-
}, [
|
|
247
|
-
o("input", {
|
|
248
|
-
ref_key: "fileInput",
|
|
249
|
-
ref: B,
|
|
250
|
-
type: "file",
|
|
251
|
-
multiple: a.multiSelect,
|
|
252
|
-
accept: Z.value,
|
|
253
|
-
class: "hidden",
|
|
254
|
-
"data-testid": e.$attrs["data-testid"] ? `${e.$attrs["data-testid"]}-input` : e.$attrs.name ? `filepicker-input-${e.$attrs.name}` : "filepicker-input",
|
|
255
|
-
onChange: le
|
|
256
|
-
}, null, 40, ke),
|
|
257
|
-
he(e.$slots, "trigger", {
|
|
258
|
-
trigger: x,
|
|
259
|
-
isDragging: V.value,
|
|
260
|
-
isLoading: a.loading || u.value,
|
|
261
|
-
files: y.value
|
|
262
|
-
}, () => [
|
|
263
|
-
a.variant === "input" ? (r(), c("div", {
|
|
264
|
-
key: 0,
|
|
265
|
-
class: "relative",
|
|
266
|
-
"data-testid": e.$attrs["data-testid"] || (e.$attrs.name ? `filepicker-${e.$attrs.name}` : "filepicker")
|
|
267
|
-
}, [
|
|
268
|
-
o("div", {
|
|
269
|
-
role: "button",
|
|
270
|
-
tabindex: "0",
|
|
271
|
-
"aria-disabled": a.disabled || a.loading || u.value,
|
|
272
|
-
"aria-label": de.value || j.value,
|
|
273
|
-
class: k(fe.value),
|
|
274
|
-
onClick: x,
|
|
275
|
-
onKeydown: [
|
|
276
|
-
q(w(x, ["prevent"]), ["enter"]),
|
|
277
|
-
q(w(x, ["prevent"]), ["space"])
|
|
278
|
-
]
|
|
279
|
-
}, [
|
|
280
|
-
b.value && S.value ? (r(), c("div", Ve, [
|
|
281
|
-
R(S.value) ? (r(), c("img", {
|
|
282
|
-
key: 0,
|
|
283
|
-
src: R(S.value),
|
|
284
|
-
alt: S.value.fileName,
|
|
285
|
-
class: k(["shrink-0 border border-border bg-muted object-cover", E.value])
|
|
286
|
-
}, null, 10, Se)) : (r(), c("div", {
|
|
287
|
-
key: 1,
|
|
288
|
-
class: k(["shrink-0 border border-primary/15 bg-primary/10 text-primary flex items-center justify-center", E.value])
|
|
289
|
-
}, [
|
|
290
|
-
F(v, {
|
|
291
|
-
icon: ie(S.value),
|
|
292
|
-
class: "h-4 w-4"
|
|
293
|
-
}, null, 8, ["icon"])
|
|
294
|
-
], 2)),
|
|
295
|
-
o("div", $e, [
|
|
296
|
-
o("p", Ae, g(ue.value), 1),
|
|
297
|
-
o("p", ze, g(ce.value), 1)
|
|
298
|
-
])
|
|
299
|
-
])) : (r(), c("div", Ce, [
|
|
300
|
-
F(v, {
|
|
301
|
-
icon: "lucide:upload",
|
|
302
|
-
class: "h-4 w-4 shrink-0"
|
|
303
|
-
}),
|
|
304
|
-
o("span", Te, g(j.value), 1)
|
|
305
|
-
]))
|
|
306
|
-
], 42, Fe),
|
|
307
|
-
a.loading || u.value || b.value && !a.disabled ? (r(), c("div", De, [
|
|
308
|
-
a.loading || u.value ? (r(), A(v, {
|
|
309
|
-
key: 0,
|
|
310
|
-
icon: "lucide:loader-2",
|
|
311
|
-
class: "h-4 w-4 animate-spin text-muted-foreground"
|
|
312
|
-
})) : b.value && !a.disabled ? (r(), c("button", {
|
|
313
|
-
key: 1,
|
|
314
|
-
type: "button",
|
|
315
|
-
class: "text-muted-foreground hover:text-foreground focus:outline-none",
|
|
316
|
-
onClick: w(se, ["stop"])
|
|
317
|
-
}, [
|
|
318
|
-
F(v, {
|
|
319
|
-
icon: "lucide:x-circle",
|
|
320
|
-
class: "h-4 w-4"
|
|
321
|
-
})
|
|
322
|
-
])) : z("", !0)
|
|
323
|
-
])) : z("", !0)
|
|
324
|
-
], 8, we)) : (r(), c("div", {
|
|
325
|
-
key: 1,
|
|
326
|
-
class: "relative",
|
|
327
|
-
onDragover: _,
|
|
328
|
-
onDragleave: ee,
|
|
329
|
-
onDrop: te,
|
|
330
|
-
"data-testid": e.$attrs["data-testid"] || (e.$attrs.name ? `filepicker-${e.$attrs.name}` : "filepicker")
|
|
331
|
-
}, [
|
|
332
|
-
b.value ? (r(), c("div", Me, [
|
|
333
|
-
(r(!0), c(xe, null, be(y.value, (i, d) => (r(), c("div", {
|
|
334
|
-
key: d,
|
|
335
|
-
class: k(["relative flex items-center p-3 border border-border rounded-lg bg-body transition-colors group", [
|
|
336
|
-
!a.multiSelect && !a.disabled && !a.loading && !u.value ? "cursor-pointer hover:border-primary/50" : ""
|
|
337
|
-
]]),
|
|
338
|
-
onClick: l[2] || (l[2] = (m) => !a.multiSelect && !a.disabled && !a.loading && !u.value ? x() : null)
|
|
339
|
-
}, [
|
|
340
|
-
o("div", Le, [
|
|
341
|
-
o("div", Re, [
|
|
342
|
-
F(v, {
|
|
343
|
-
icon: "lucide:file-text",
|
|
344
|
-
class: "w-5 h-5"
|
|
345
|
-
})
|
|
346
|
-
])
|
|
347
|
-
]),
|
|
348
|
-
o("div", We, [
|
|
349
|
-
a.allowRename && !a.disabled && !a.loading && !u.value ? (r(), c("div", Ee, [
|
|
350
|
-
o("div", Ke, [
|
|
351
|
-
o("span", Oe, g(i.fileName || P.value), 1),
|
|
352
|
-
o("input", {
|
|
353
|
-
value: i.fileName,
|
|
354
|
-
onClick: l[0] || (l[0] = w(() => {
|
|
355
|
-
}, ["stop"])),
|
|
356
|
-
onInput: (m) => oe(d, m.target.value),
|
|
357
|
-
class: "col-start-1 row-start-1 w-auto min-w-[2ch] text-sm font-medium text-foreground bg-transparent border-b border-transparent hover:border-border focus:border-primary outline-none transition-colors py-0.5 px-1",
|
|
358
|
-
placeholder: P.value
|
|
359
|
-
}, null, 40, qe)
|
|
360
|
-
]),
|
|
361
|
-
o("div", {
|
|
362
|
-
class: "shrink-0 ml-1 text-muted-foreground/50 group-hover/rename:text-foreground transition-colors cursor-text",
|
|
363
|
-
onClick: l[1] || (l[1] = w(
|
|
364
|
-
(m) => m.currentTarget.previousElementSibling?.querySelector("input")?.focus(),
|
|
365
|
-
["stop"]
|
|
366
|
-
)),
|
|
367
|
-
title: Y.value
|
|
368
|
-
}, [
|
|
369
|
-
F(v, {
|
|
370
|
-
icon: "lucide:pencil",
|
|
371
|
-
class: "w-3 h-3"
|
|
372
|
-
})
|
|
373
|
-
], 8, Ge)
|
|
374
|
-
])) : (r(), c("p", He, g(i.fileName), 1)),
|
|
375
|
-
o("p", Je, g(I(i.fileSize)), 1)
|
|
376
|
-
]),
|
|
377
|
-
o("div", Qe, [
|
|
378
|
-
a.loading || u.value ? (r(), A(v, {
|
|
379
|
-
key: 0,
|
|
380
|
-
icon: "lucide:loader-2",
|
|
381
|
-
class: "w-4 h-4 animate-spin text-primary"
|
|
382
|
-
})) : a.disabled ? z("", !0) : (r(), A(G, {
|
|
383
|
-
key: 1,
|
|
384
|
-
size: "xs",
|
|
385
|
-
variant: "ghost",
|
|
386
|
-
icon: "lucide:x",
|
|
387
|
-
rounded: "full",
|
|
388
|
-
class: "text-muted-foreground hover:text-destructive hover:bg-destructive/10",
|
|
389
|
-
onClick: w((m) => ne(d), ["stop"])
|
|
390
|
-
}, null, 8, ["onClick"]))
|
|
391
|
-
])
|
|
392
|
-
], 2))), 128)),
|
|
393
|
-
a.multiSelect && (!a.maxFiles || y.value.length < a.maxFiles) ? (r(), c("div", Xe, [
|
|
394
|
-
F(G, {
|
|
395
|
-
size: "sm",
|
|
396
|
-
variant: "outline",
|
|
397
|
-
icon: "lucide:plus",
|
|
398
|
-
text: X.value,
|
|
399
|
-
disabled: a.disabled || a.loading || u.value,
|
|
400
|
-
onClick: x
|
|
401
|
-
}, null, 8, ["text", "disabled"])
|
|
402
|
-
])) : z("", !0)
|
|
403
|
-
])) : (r(), c("div", {
|
|
404
|
-
key: 0,
|
|
405
|
-
class: k(["border-2 bg-body border-dashed border-border rounded-lg p-6 transition-all duration-200 ease-in-out cursor-pointer flex flex-col items-center justify-center text-center gap-2", [
|
|
406
|
-
V.value ? "border-primary bg-primary/5" : "hover:border-primary/50 ",
|
|
407
|
-
a.disabled || a.loading || u.value ? "opacity-50 cursor-not-allowed" : ""
|
|
408
|
-
]]),
|
|
409
|
-
onClick: x
|
|
410
|
-
}, [
|
|
411
|
-
o("div", je, [
|
|
412
|
-
a.loading || u.value ? (r(), A(v, {
|
|
413
|
-
key: 0,
|
|
414
|
-
icon: "lucide:loader-2",
|
|
415
|
-
class: "w-6 h-6 animate-spin"
|
|
416
|
-
})) : (r(), A(v, {
|
|
417
|
-
key: 1,
|
|
418
|
-
icon: "lucide:upload-cloud",
|
|
419
|
-
class: "w-6 h-6"
|
|
420
|
-
}))
|
|
421
|
-
]),
|
|
422
|
-
o("div", Pe, [
|
|
423
|
-
o("p", Be, [
|
|
424
|
-
o("span", Ue, g(J.value), 1),
|
|
425
|
-
ye(" " + g(Q.value), 1)
|
|
426
|
-
]),
|
|
427
|
-
a.fileTypes.length ? (r(), c("p", Ie, g(a.fileTypes.join(", ")), 1)) : z("", !0)
|
|
428
|
-
])
|
|
429
|
-
], 2))
|
|
430
|
-
], 40, Ne))
|
|
431
|
-
])
|
|
432
|
-
], 2));
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
export {
|
|
436
|
-
tt as default
|
|
437
|
-
};
|