vlite3 1.4.4 → 1.4.5
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/components/AppShell/AppShellLayoutStorefront.vue.js +2 -2
- package/components/Cart/Cart.vue.js +242 -0
- package/components/Cart/Cart.vue2.js +4 -0
- package/components/Cart/CartCouponInput.vue.js +176 -0
- package/components/Cart/CartCouponInput.vue2.js +4 -0
- package/components/Cart/CartEmptyState.vue.js +48 -0
- package/components/Cart/CartEmptyState.vue2.js +4 -0
- package/components/Cart/CartLineItem.vue.js +341 -0
- package/components/Cart/CartLineItem.vue2.js +4 -0
- package/components/Cart/CartSummary.vue.js +157 -0
- package/components/Cart/CartSummary.vue2.js +4 -0
- package/components/Cart/CartVariant1.vue.js +156 -0
- package/components/Cart/CartVariant1.vue2.js +4 -0
- package/components/Cart/CartVariant2.vue.js +154 -0
- package/components/Cart/CartVariant2.vue2.js +4 -0
- package/components/Cart/CartVariant3.vue.js +192 -0
- package/components/Cart/CartVariant3.vue2.js +4 -0
- package/components/Cart/CartVariant4.vue.js +145 -0
- package/components/Cart/CartVariant4.vue2.js +4 -0
- package/components/Cart/composables/useCart.d.ts +46 -0
- package/components/Cart/composables/useCart.js +110 -0
- package/components/Cart/composables/useCartCalculation.js +145 -0
- package/components/Cart/index.d.ts +2 -0
- package/components/CategoryManager/CategoryManager.vue.js +3 -3
- package/components/CategoryManager/CategoryManager.vue2.js +224 -248
- package/components/CategoryManager/utils.d.ts +3 -0
- package/components/CategoryManager/utils.js +31 -0
- package/components/CategoryMenu/CategoryMenu.vue.d.ts +2 -0
- package/components/CategoryMenu/CategoryMenu.vue.js +46 -40
- package/components/CategoryMenu/CategoryMenuVariant1.vue.d.ts +5 -1
- package/components/CategoryMenu/CategoryMenuVariant1.vue.js +5 -144
- package/components/CategoryMenu/CategoryMenuVariant1.vue2.js +220 -2
- package/components/CategoryMenu/CategoryMenuVariant2.vue.d.ts +5 -1
- package/components/CategoryMenu/CategoryMenuVariant2.vue.js +5 -160
- package/components/CategoryMenu/CategoryMenuVariant2.vue2.js +235 -2
- package/components/CategoryMenu/types.d.ts +5 -2
- package/components/Dropdown/Dropdown.vue.d.ts +1 -0
- package/components/Dropdown/Dropdown.vue.js +31 -29
- package/components/FilePicker/FilePicker.vue.js +278 -202
- package/components/Form/CustomFields.vue.d.ts +4 -0
- package/components/Form/CustomFields.vue.js +2 -2
- package/components/Form/CustomFields.vue2.js +349 -145
- package/components/Form/FormField.vue.js +1 -1
- package/components/Form/types.d.ts +3 -0
- package/components/Modal.vue.d.ts +2 -0
- package/components/Modal.vue.js +1 -1
- package/components/Modal.vue2.js +30 -28
- package/components/Screen/ScreenFilter.vue.js +3 -2
- package/components/SidePanel.vue.d.ts +2 -0
- package/components/SidePanel.vue.js +1 -1
- package/components/SidePanel.vue2.js +25 -23
- package/components/SidebarMenu/SidebarMenu.vue.js +145 -128
- package/components/index.d.ts +1 -0
- package/core/config.d.ts +6 -6
- package/index.d.ts +1 -0
- package/index.js +327 -306
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { $t as
|
|
5
|
-
const
|
|
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 = {
|
|
6
15
|
key: 0,
|
|
7
16
|
class: "text-xs text-muted-foreground"
|
|
8
|
-
},
|
|
17
|
+
}, Me = {
|
|
9
18
|
key: 1,
|
|
10
19
|
class: "space-y-2"
|
|
11
|
-
},
|
|
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 = {
|
|
12
21
|
key: 0,
|
|
13
22
|
class: "inline-flex items-center group/rename w-fit max-w-full mb-0.5"
|
|
14
|
-
},
|
|
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 = {
|
|
15
24
|
key: 1,
|
|
16
25
|
class: "text-sm font-medium text-foreground truncate w-full"
|
|
17
|
-
},
|
|
26
|
+
}, Je = { class: "text-xs text-muted-foreground -mt-1" }, Qe = { class: "shrink-0 ml-3 flex gap-2 items-center" }, Xe = {
|
|
18
27
|
key: 0,
|
|
19
28
|
class: "flex gap-2"
|
|
20
|
-
},
|
|
29
|
+
}, tt = /* @__PURE__ */ pe({
|
|
21
30
|
name: "FilePicker",
|
|
22
31
|
__name: "FilePicker",
|
|
23
32
|
props: {
|
|
@@ -38,141 +47,176 @@ const se = { class: "w-full" }, de = ["multiple", "accept", "data-testid"], ue =
|
|
|
38
47
|
allowRename: { type: Boolean, default: !1 }
|
|
39
48
|
},
|
|
40
49
|
emits: ["update:modelValue", "change", "error"],
|
|
41
|
-
setup(a, { emit:
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
return
|
|
45
|
-
}, j =
|
|
46
|
-
() =>
|
|
47
|
-
),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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;
|
|
54
67
|
return {
|
|
55
68
|
fileName: decodeURIComponent(i),
|
|
56
69
|
fileType: "unknown",
|
|
57
70
|
fileSize: 0,
|
|
58
71
|
file: null,
|
|
59
|
-
base64:
|
|
72
|
+
base64: l,
|
|
60
73
|
isUrl: !0
|
|
61
74
|
};
|
|
62
75
|
}
|
|
63
|
-
return
|
|
76
|
+
return l;
|
|
64
77
|
});
|
|
65
78
|
}), x = () => {
|
|
66
|
-
if (!(
|
|
67
|
-
if (
|
|
68
|
-
|
|
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`);
|
|
69
82
|
return;
|
|
70
83
|
}
|
|
71
|
-
|
|
84
|
+
B.value?.click();
|
|
72
85
|
}
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
return parseFloat((
|
|
86
|
-
},
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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;
|
|
100
133
|
return;
|
|
101
134
|
}
|
|
102
|
-
|
|
135
|
+
m.length > h && (i.push(`Only ${h} more file(s) allowed. Maximum ${t.maxFiles} files.`), m = m.slice(0, h));
|
|
103
136
|
}
|
|
104
137
|
try {
|
|
105
|
-
for (const
|
|
106
|
-
if (
|
|
107
|
-
if (
|
|
108
|
-
return
|
|
109
|
-
if (
|
|
110
|
-
const
|
|
111
|
-
return
|
|
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);
|
|
112
145
|
}
|
|
113
|
-
return
|
|
146
|
+
return n.type === $;
|
|
114
147
|
})) {
|
|
115
|
-
i.push(`File type not allowed: ${
|
|
148
|
+
i.push(`File type not allowed: ${n.name}`);
|
|
116
149
|
continue;
|
|
117
150
|
}
|
|
118
|
-
let
|
|
119
|
-
|
|
120
|
-
let
|
|
121
|
-
if (
|
|
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)
|
|
122
155
|
try {
|
|
123
|
-
|
|
124
|
-
} catch (
|
|
125
|
-
console.error("Base64 read failed",
|
|
156
|
+
K = await re(n);
|
|
157
|
+
} catch (O) {
|
|
158
|
+
console.error("Base64 read failed", O);
|
|
126
159
|
}
|
|
127
|
-
|
|
128
|
-
fileName:
|
|
129
|
-
fileType:
|
|
130
|
-
fileSize:
|
|
131
|
-
file:
|
|
132
|
-
base64:
|
|
160
|
+
l.push({
|
|
161
|
+
fileName: n.name,
|
|
162
|
+
fileType: n.type,
|
|
163
|
+
fileSize: n.size,
|
|
164
|
+
file: n,
|
|
165
|
+
base64: K
|
|
133
166
|
});
|
|
134
167
|
}
|
|
135
|
-
if (i.length > 0 &&
|
|
136
|
-
let
|
|
137
|
-
|
|
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);
|
|
138
171
|
}
|
|
139
|
-
} catch (
|
|
140
|
-
console.error("Error processing files:",
|
|
172
|
+
} catch (n) {
|
|
173
|
+
console.error("Error processing files:", n), f("error", "Failed to process files");
|
|
141
174
|
} finally {
|
|
142
|
-
|
|
175
|
+
u.value = !1;
|
|
143
176
|
}
|
|
144
|
-
},
|
|
145
|
-
if (!(
|
|
146
|
-
if (
|
|
147
|
-
const
|
|
148
|
-
|
|
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);
|
|
149
182
|
} else
|
|
150
|
-
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
if (
|
|
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;
|
|
155
188
|
let i;
|
|
156
|
-
|
|
157
|
-
fileName:
|
|
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,
|
|
158
191
|
fileType: "unknown",
|
|
159
192
|
fileSize: 0,
|
|
160
193
|
file: null,
|
|
161
|
-
base64: i[
|
|
194
|
+
base64: i[e],
|
|
162
195
|
isUrl: !0
|
|
163
|
-
})) :
|
|
164
|
-
fileName:
|
|
196
|
+
})) : t.modelValue && typeof t.modelValue == "object" && !Array.isArray(t.modelValue) ? i = { ...t.modelValue, fileName: l } : typeof t.modelValue == "string" && (i = {
|
|
197
|
+
fileName: l,
|
|
165
198
|
fileType: "unknown",
|
|
166
199
|
fileSize: 0,
|
|
167
200
|
file: null,
|
|
168
|
-
base64:
|
|
201
|
+
base64: t.modelValue,
|
|
169
202
|
isUrl: !0
|
|
170
|
-
}), i !== void 0 && (
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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"
|
|
176
220
|
}, i = {
|
|
177
221
|
none: "rounded-none",
|
|
178
222
|
sm: "rounded-sm",
|
|
@@ -183,179 +227,211 @@ const se = { class: "w-full" }, de = ["multiple", "accept", "data-testid"], ue =
|
|
|
183
227
|
full: "rounded-full"
|
|
184
228
|
};
|
|
185
229
|
return [
|
|
186
|
-
|
|
230
|
+
e,
|
|
187
231
|
"border border-input focus-visible:border-primary",
|
|
188
232
|
// Default outline style
|
|
189
|
-
t
|
|
190
|
-
i[
|
|
191
|
-
"pr-10",
|
|
192
|
-
// Space for icon
|
|
193
|
-
|
|
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" : ""
|
|
194
238
|
].join(" ");
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
|
|
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", {
|
|
198
248
|
ref_key: "fileInput",
|
|
199
|
-
ref:
|
|
249
|
+
ref: B,
|
|
200
250
|
type: "file",
|
|
201
251
|
multiple: a.multiSelect,
|
|
202
|
-
accept:
|
|
252
|
+
accept: Z.value,
|
|
203
253
|
class: "hidden",
|
|
204
|
-
"data-testid":
|
|
205
|
-
onChange:
|
|
206
|
-
}, null, 40,
|
|
207
|
-
|
|
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", {
|
|
208
258
|
trigger: x,
|
|
209
|
-
isDragging:
|
|
210
|
-
isLoading: a.loading ||
|
|
211
|
-
files:
|
|
259
|
+
isDragging: V.value,
|
|
260
|
+
isLoading: a.loading || u.value,
|
|
261
|
+
files: y.value
|
|
212
262
|
}, () => [
|
|
213
|
-
a.variant === "input" ? (
|
|
263
|
+
a.variant === "input" ? (r(), c("div", {
|
|
214
264
|
key: 0,
|
|
215
265
|
class: "relative",
|
|
216
|
-
|
|
217
|
-
"data-testid": l.$attrs["data-testid"] || (l.$attrs.name ? `filepicker-${l.$attrs.name}` : "filepicker")
|
|
266
|
+
"data-testid": e.$attrs["data-testid"] || (e.$attrs.name ? `filepicker-${e.$attrs.name}` : "filepicker")
|
|
218
267
|
}, [
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
class:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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, {
|
|
229
309
|
key: 0,
|
|
230
310
|
icon: "lucide:loader-2",
|
|
231
311
|
class: "h-4 w-4 animate-spin text-muted-foreground"
|
|
232
|
-
})) :
|
|
312
|
+
})) : b.value && !a.disabled ? (r(), c("button", {
|
|
233
313
|
key: 1,
|
|
234
314
|
type: "button",
|
|
235
315
|
class: "text-muted-foreground hover:text-foreground focus:outline-none",
|
|
236
|
-
onClick:
|
|
316
|
+
onClick: w(se, ["stop"])
|
|
237
317
|
}, [
|
|
238
|
-
F(
|
|
318
|
+
F(v, {
|
|
239
319
|
icon: "lucide:x-circle",
|
|
240
320
|
class: "h-4 w-4"
|
|
241
321
|
})
|
|
242
|
-
])) : (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
class: "h-4 w-4 text-muted-foreground"
|
|
246
|
-
}))
|
|
247
|
-
])
|
|
248
|
-
], 8, ue)) : (n(), m("div", {
|
|
322
|
+
])) : z("", !0)
|
|
323
|
+
])) : z("", !0)
|
|
324
|
+
], 8, we)) : (r(), c("div", {
|
|
249
325
|
key: 1,
|
|
250
326
|
class: "relative",
|
|
251
|
-
onDragover:
|
|
252
|
-
onDragleave:
|
|
253
|
-
onDrop:
|
|
254
|
-
"data-testid":
|
|
327
|
+
onDragover: _,
|
|
328
|
+
onDragleave: ee,
|
|
329
|
+
onDrop: te,
|
|
330
|
+
"data-testid": e.$attrs["data-testid"] || (e.$attrs.name ? `filepicker-${e.$attrs.name}` : "filepicker")
|
|
255
331
|
}, [
|
|
256
|
-
|
|
257
|
-
(
|
|
258
|
-
key:
|
|
259
|
-
class:
|
|
260
|
-
!a.multiSelect && !a.disabled && !a.loading && !
|
|
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" : ""
|
|
261
337
|
]]),
|
|
262
|
-
onClick:
|
|
338
|
+
onClick: l[2] || (l[2] = (m) => !a.multiSelect && !a.disabled && !a.loading && !u.value ? x() : null)
|
|
263
339
|
}, [
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
F(
|
|
340
|
+
o("div", Le, [
|
|
341
|
+
o("div", Re, [
|
|
342
|
+
F(v, {
|
|
267
343
|
icon: "lucide:file-text",
|
|
268
344
|
class: "w-5 h-5"
|
|
269
345
|
})
|
|
270
346
|
])
|
|
271
347
|
]),
|
|
272
|
-
|
|
273
|
-
a.allowRename && !a.disabled && !a.loading && !
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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", {
|
|
277
353
|
value: i.fileName,
|
|
278
|
-
onClick:
|
|
354
|
+
onClick: l[0] || (l[0] = w(() => {
|
|
279
355
|
}, ["stop"])),
|
|
280
|
-
onInput: (
|
|
356
|
+
onInput: (m) => oe(d, m.target.value),
|
|
281
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",
|
|
282
|
-
placeholder:
|
|
283
|
-
}, null, 40,
|
|
358
|
+
placeholder: P.value
|
|
359
|
+
}, null, 40, qe)
|
|
284
360
|
]),
|
|
285
|
-
|
|
361
|
+
o("div", {
|
|
286
362
|
class: "shrink-0 ml-1 text-muted-foreground/50 group-hover/rename:text-foreground transition-colors cursor-text",
|
|
287
|
-
onClick:
|
|
288
|
-
(
|
|
363
|
+
onClick: l[1] || (l[1] = w(
|
|
364
|
+
(m) => m.currentTarget.previousElementSibling?.querySelector("input")?.focus(),
|
|
289
365
|
["stop"]
|
|
290
366
|
)),
|
|
291
|
-
title:
|
|
367
|
+
title: Y.value
|
|
292
368
|
}, [
|
|
293
|
-
F(
|
|
369
|
+
F(v, {
|
|
294
370
|
icon: "lucide:pencil",
|
|
295
371
|
class: "w-3 h-3"
|
|
296
372
|
})
|
|
297
|
-
], 8,
|
|
298
|
-
])) : (
|
|
299
|
-
|
|
373
|
+
], 8, Ge)
|
|
374
|
+
])) : (r(), c("p", He, g(i.fileName), 1)),
|
|
375
|
+
o("p", Je, g(I(i.fileSize)), 1)
|
|
300
376
|
]),
|
|
301
|
-
|
|
302
|
-
a.loading ||
|
|
377
|
+
o("div", Qe, [
|
|
378
|
+
a.loading || u.value ? (r(), A(v, {
|
|
303
379
|
key: 0,
|
|
304
380
|
icon: "lucide:loader-2",
|
|
305
381
|
class: "w-4 h-4 animate-spin text-primary"
|
|
306
|
-
})) : a.disabled ?
|
|
382
|
+
})) : a.disabled ? z("", !0) : (r(), A(G, {
|
|
307
383
|
key: 1,
|
|
308
384
|
size: "xs",
|
|
309
385
|
variant: "ghost",
|
|
310
386
|
icon: "lucide:x",
|
|
311
387
|
rounded: "full",
|
|
312
388
|
class: "text-muted-foreground hover:text-destructive hover:bg-destructive/10",
|
|
313
|
-
onClick:
|
|
389
|
+
onClick: w((m) => ne(d), ["stop"])
|
|
314
390
|
}, null, 8, ["onClick"]))
|
|
315
391
|
])
|
|
316
392
|
], 2))), 128)),
|
|
317
|
-
a.multiSelect && (!a.maxFiles ||
|
|
318
|
-
F(
|
|
393
|
+
a.multiSelect && (!a.maxFiles || y.value.length < a.maxFiles) ? (r(), c("div", Xe, [
|
|
394
|
+
F(G, {
|
|
319
395
|
size: "sm",
|
|
320
396
|
variant: "outline",
|
|
321
397
|
icon: "lucide:plus",
|
|
322
|
-
text:
|
|
323
|
-
disabled: a.disabled || a.loading ||
|
|
398
|
+
text: X.value,
|
|
399
|
+
disabled: a.disabled || a.loading || u.value,
|
|
324
400
|
onClick: x
|
|
325
401
|
}, null, 8, ["text", "disabled"])
|
|
326
|
-
])) :
|
|
327
|
-
])) : (
|
|
402
|
+
])) : z("", !0)
|
|
403
|
+
])) : (r(), c("div", {
|
|
328
404
|
key: 0,
|
|
329
|
-
class:
|
|
330
|
-
|
|
331
|
-
a.disabled || a.loading ||
|
|
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" : ""
|
|
332
408
|
]]),
|
|
333
409
|
onClick: x
|
|
334
410
|
}, [
|
|
335
|
-
|
|
336
|
-
a.loading ||
|
|
411
|
+
o("div", je, [
|
|
412
|
+
a.loading || u.value ? (r(), A(v, {
|
|
337
413
|
key: 0,
|
|
338
414
|
icon: "lucide:loader-2",
|
|
339
415
|
class: "w-6 h-6 animate-spin"
|
|
340
|
-
})) : (
|
|
416
|
+
})) : (r(), A(v, {
|
|
341
417
|
key: 1,
|
|
342
418
|
icon: "lucide:upload-cloud",
|
|
343
419
|
class: "w-6 h-6"
|
|
344
420
|
}))
|
|
345
421
|
]),
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
422
|
+
o("div", Pe, [
|
|
423
|
+
o("p", Be, [
|
|
424
|
+
o("span", Ue, g(J.value), 1),
|
|
425
|
+
ye(" " + g(Q.value), 1)
|
|
350
426
|
]),
|
|
351
|
-
a.fileTypes.length ? (
|
|
427
|
+
a.fileTypes.length ? (r(), c("p", Ie, g(a.fileTypes.join(", ")), 1)) : z("", !0)
|
|
352
428
|
])
|
|
353
429
|
], 2))
|
|
354
|
-
], 40,
|
|
430
|
+
], 40, Ne))
|
|
355
431
|
])
|
|
356
|
-
]));
|
|
432
|
+
], 2));
|
|
357
433
|
}
|
|
358
434
|
});
|
|
359
435
|
export {
|
|
360
|
-
|
|
436
|
+
tt as default
|
|
361
437
|
};
|