vlite3 1.4.22 → 1.4.23
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/Cart/Cart.vue.js +53 -49
- package/components/Cart/CartCouponInput.vue.d.ts +1 -0
- package/components/Cart/CartCouponInput.vue.js +36 -33
- package/components/Cart/CartLineItem.vue.d.ts +1 -0
- package/components/Cart/CartLineItem.vue.js +121 -113
- package/components/Cart/CartSummary.vue.d.ts +1 -0
- package/components/Cart/CartSummary.vue.js +59 -51
- package/components/Cart/CartVariant1.vue.js +66 -63
- package/components/Cart/CartVariant2.vue.js +50 -47
- package/components/Cart/CartVariant3.vue.js +61 -58
- package/components/Cart/CartVariant4.vue.js +72 -68
- package/components/CategoryManager/CategoryManager.vue2.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/NavbarCommandPalette.vue.js +1 -1
- package/components/Price/Price.vue.js +2 -2
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/package.json +1 -1
- /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { getComponentConfig as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { defineComponent as R, computed as s, ref as Q, watch as f, openBlock as U, createBlock as F, resolveDynamicComponent as P } from "vue";
|
|
2
|
+
import { getComponentConfig as z } from "../../utils/configUtils.js";
|
|
3
|
+
import { formatCurrency as H } from "../../utils/functions.js";
|
|
4
|
+
import { calculateCartTotals as L } from "./composables/useCartCalculation.js";
|
|
5
|
+
import j from "./CartVariant1.vue.js";
|
|
6
|
+
import E from "./CartVariant2.vue.js";
|
|
7
|
+
import G from "./CartVariant3.vue.js";
|
|
8
|
+
import J from "./CartVariant4.vue.js";
|
|
9
|
+
const te = /* @__PURE__ */ R({
|
|
9
10
|
__name: "Cart",
|
|
10
11
|
props: {
|
|
11
12
|
data: {},
|
|
@@ -18,18 +19,18 @@ const Y = /* @__PURE__ */ N({
|
|
|
18
19
|
},
|
|
19
20
|
emits: ["update:quantity", "remove", "clear", "apply-coupon", "remove-coupon", "coupon-change", "continue", "continue-shopping", "update:coupon", "update:totals"],
|
|
20
21
|
setup(v, { emit: C }) {
|
|
21
|
-
const t = v, o = C, c =
|
|
22
|
+
const t = v, o = C, c = z("cart") || {}, g = s(() => {
|
|
22
23
|
switch (t.variant ?? c.variant ?? "Variant1") {
|
|
23
24
|
case "Variant2":
|
|
24
|
-
return
|
|
25
|
+
return E;
|
|
25
26
|
case "Variant3":
|
|
26
|
-
return
|
|
27
|
+
return G;
|
|
27
28
|
case "Variant4":
|
|
28
|
-
return
|
|
29
|
+
return J;
|
|
29
30
|
default:
|
|
30
|
-
return
|
|
31
|
+
return j;
|
|
31
32
|
}
|
|
32
|
-
}),
|
|
33
|
+
}), y = s(() => {
|
|
33
34
|
const e = {
|
|
34
35
|
editableQuantity: !0,
|
|
35
36
|
removable: !0,
|
|
@@ -50,28 +51,31 @@ const Y = /* @__PURE__ */ N({
|
|
|
50
51
|
trustSignals: !0
|
|
51
52
|
}, n = c.features ?? {}, u = t.features ?? {}, i = t.data?.readonly ? { editableQuantity: !1, removable: !1, clearable: !1, coupon: !1 } : {};
|
|
52
53
|
return { ...e, ...n, ...u, ...i };
|
|
53
|
-
}),
|
|
54
|
+
}), h = s(() => ({
|
|
54
55
|
showContinue: !0,
|
|
55
56
|
showContinueShopping: !0,
|
|
56
57
|
continueDisabled: !1,
|
|
57
58
|
continueShoppingDisabled: !1,
|
|
58
59
|
...c.actions ?? {},
|
|
59
60
|
...t.actions ?? {}
|
|
60
|
-
})), r =
|
|
61
|
+
})), r = Q(null), m = s(() => r.value ?? t.data.coupon), d = s(() => L({
|
|
61
62
|
items: t.data.items || [],
|
|
62
63
|
tax: t.data.tax,
|
|
63
64
|
shipping: t.data.shipping,
|
|
64
|
-
coupon:
|
|
65
|
+
coupon: m.value,
|
|
65
66
|
currency: t.data.currency
|
|
66
67
|
}).totals);
|
|
67
68
|
s(() => t.data.totals === void 0);
|
|
68
|
-
const
|
|
69
|
+
const p = s(() => t.data.totals ? t.data.totals : d.value), b = (e) => H(e, {
|
|
70
|
+
currency: t.data.currency || p.value.currency,
|
|
71
|
+
numberFormat: "standard"
|
|
72
|
+
});
|
|
69
73
|
f(
|
|
70
|
-
|
|
74
|
+
p,
|
|
71
75
|
(e) => o("update:totals", e),
|
|
72
76
|
{ deep: !0 }
|
|
73
77
|
);
|
|
74
|
-
const
|
|
78
|
+
const k = s(
|
|
75
79
|
() => !!t.validateCoupon || !!t.data.coupons?.length
|
|
76
80
|
);
|
|
77
81
|
f(
|
|
@@ -81,7 +85,7 @@ const Y = /* @__PURE__ */ N({
|
|
|
81
85
|
},
|
|
82
86
|
{ deep: !0 }
|
|
83
87
|
);
|
|
84
|
-
async function
|
|
88
|
+
async function $(e) {
|
|
85
89
|
const n = e.trim().toUpperCase(), u = d.value.subtotal, i = t.data.currency;
|
|
86
90
|
if (t.data.coupons?.length) {
|
|
87
91
|
const a = t.data.coupons.find(
|
|
@@ -113,10 +117,10 @@ const Y = /* @__PURE__ */ N({
|
|
|
113
117
|
coupon: {
|
|
114
118
|
code: e,
|
|
115
119
|
state: "error",
|
|
116
|
-
message: `Add ${(a.minSubtotal - u)
|
|
120
|
+
message: `Add ${b(a.minSubtotal - u)} more to use "${e}".`
|
|
117
121
|
}
|
|
118
122
|
} : a.minItems !== void 0 && (t.data.items || []).reduce(
|
|
119
|
-
(
|
|
123
|
+
(I, N) => I + (N.quantity || 0),
|
|
120
124
|
0
|
|
121
125
|
) < a.minItems ? {
|
|
122
126
|
ok: !1,
|
|
@@ -180,63 +184,63 @@ const Y = /* @__PURE__ */ N({
|
|
|
180
184
|
expiresAt: n.expiresAt
|
|
181
185
|
};
|
|
182
186
|
}
|
|
183
|
-
function
|
|
187
|
+
function _(e, n) {
|
|
184
188
|
o("update:quantity", e, n);
|
|
185
189
|
}
|
|
186
|
-
function
|
|
190
|
+
function S(e) {
|
|
187
191
|
o("remove", e);
|
|
188
192
|
}
|
|
189
|
-
function
|
|
193
|
+
function A() {
|
|
190
194
|
o("clear");
|
|
191
195
|
}
|
|
192
|
-
async function
|
|
193
|
-
if (o("apply-coupon", e), !
|
|
196
|
+
async function w(e) {
|
|
197
|
+
if (o("apply-coupon", e), !k.value)
|
|
194
198
|
return;
|
|
195
199
|
const n = e.trim();
|
|
196
200
|
r.value = { code: n, state: "applying" }, t.validateCoupon || await new Promise((i) => setTimeout(i, 120));
|
|
197
|
-
const u = await
|
|
201
|
+
const u = await $(n);
|
|
198
202
|
if (u.ok === !0) {
|
|
199
203
|
const i = x(n, u.definition);
|
|
200
204
|
r.value = null, o("update:coupon", i);
|
|
201
205
|
} else
|
|
202
206
|
r.value = null, o("update:coupon", u.coupon);
|
|
203
207
|
}
|
|
204
|
-
function
|
|
208
|
+
function V() {
|
|
205
209
|
r.value = null, o("update:coupon", null), o("remove-coupon");
|
|
206
210
|
}
|
|
207
|
-
function
|
|
211
|
+
function D(e) {
|
|
208
212
|
o("coupon-change", e);
|
|
209
213
|
}
|
|
210
|
-
function
|
|
214
|
+
function T() {
|
|
211
215
|
o("continue");
|
|
212
216
|
}
|
|
213
|
-
function
|
|
217
|
+
function q() {
|
|
214
218
|
o("continue-shopping");
|
|
215
219
|
}
|
|
216
|
-
const
|
|
220
|
+
const B = s(() => ({
|
|
217
221
|
...t.data,
|
|
218
222
|
items: t.data.items || [],
|
|
219
|
-
totals:
|
|
220
|
-
coupon:
|
|
223
|
+
totals: p.value,
|
|
224
|
+
coupon: m.value
|
|
221
225
|
}));
|
|
222
|
-
return (e, n) => (
|
|
223
|
-
data:
|
|
226
|
+
return (e, n) => (U(), F(P(g.value), {
|
|
227
|
+
data: B.value,
|
|
224
228
|
variant: t.variant,
|
|
225
|
-
actions:
|
|
226
|
-
features:
|
|
229
|
+
actions: h.value,
|
|
230
|
+
features: y.value,
|
|
227
231
|
labels: t.labels,
|
|
228
232
|
"container-class": t.containerClass,
|
|
229
|
-
"onUpdate:quantity":
|
|
230
|
-
onRemove:
|
|
231
|
-
onClear:
|
|
232
|
-
onApplyCoupon:
|
|
233
|
-
onRemoveCoupon:
|
|
234
|
-
onCouponChange:
|
|
235
|
-
onContinue:
|
|
236
|
-
onContinueShopping:
|
|
233
|
+
"onUpdate:quantity": _,
|
|
234
|
+
onRemove: S,
|
|
235
|
+
onClear: A,
|
|
236
|
+
onApplyCoupon: w,
|
|
237
|
+
onRemoveCoupon: V,
|
|
238
|
+
onCouponChange: D,
|
|
239
|
+
onContinue: T,
|
|
240
|
+
onContinueShopping: q
|
|
237
241
|
}, null, 40, ["data", "variant", "actions", "features", "labels", "container-class"]));
|
|
238
242
|
}
|
|
239
243
|
});
|
|
240
244
|
export {
|
|
241
|
-
|
|
245
|
+
te as default
|
|
242
246
|
};
|
|
@@ -16,6 +16,7 @@ type __VLS_Props = {
|
|
|
16
16
|
labels: CartLabels;
|
|
17
17
|
compact?: boolean;
|
|
18
18
|
readonly?: boolean;
|
|
19
|
+
currency?: string;
|
|
19
20
|
};
|
|
20
21
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
21
22
|
remove: () => any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as S, computed as t, ref as K, watch as D, openBlock as a, createElementBlock as
|
|
1
|
+
import { defineComponent as S, computed as t, ref as K, watch as D, openBlock as a, createElementBlock as u, normalizeClass as n, createElementVNode as p, createVNode as i, withKeys as L, createSlots as M, withCtx as T, createTextVNode as x, toDisplayString as f, createCommentVNode as r, unref as z, createBlock as R } from "vue";
|
|
2
2
|
import C from "../Icon.vue.js";
|
|
3
3
|
import U from "../Input.vue.js";
|
|
4
4
|
/* empty css */
|
|
@@ -10,23 +10,24 @@ const W = { class: "flex-1 min-w-0" }, q = { class: "flex items-center gap-2 min
|
|
|
10
10
|
coupon: {},
|
|
11
11
|
labels: {},
|
|
12
12
|
compact: { type: Boolean, default: !1 },
|
|
13
|
-
readonly: { type: Boolean, default: !1 }
|
|
13
|
+
readonly: { type: Boolean, default: !1 },
|
|
14
|
+
currency: {}
|
|
14
15
|
},
|
|
15
16
|
emits: ["apply", "remove", "change"],
|
|
16
17
|
setup(e, { emit: N }) {
|
|
17
|
-
const c = e, g = N, m = t(() => c.labels || {}),
|
|
18
|
+
const c = e, g = N, m = t(() => c.labels || {}), l = K(c.coupon?.code ?? "");
|
|
18
19
|
D(
|
|
19
20
|
() => c.coupon?.code,
|
|
20
|
-
(
|
|
21
|
-
|
|
21
|
+
(o) => {
|
|
22
|
+
o !== void 0 && o !== l.value && (l.value = o);
|
|
22
23
|
}
|
|
23
24
|
);
|
|
24
|
-
const v = t(() => c.coupon?.state ?? "idle"),
|
|
25
|
+
const v = t(() => c.coupon?.state ?? "idle"), y = t(() => v.value === "applied"), A = t(() => v.value === "applying"), h = t(() => v.value === "invalid"), b = t(() => v.value === "expired"), k = t(() => v.value === "error"), I = t(() => A.value || y.value || c.readonly), w = t(() => h.value ? c.coupon?.message || "Invalid coupon code. Please try again." : b.value ? c.coupon?.message || "This coupon has expired and can no longer be applied." : k.value ? c.coupon?.message || "We could not apply this coupon. Please try again." : ""), s = t(() => h.value ? {
|
|
25
26
|
rightIcon: "lucide:circle-x",
|
|
26
27
|
borderClass: "border-danger focus-within:border-danger",
|
|
27
28
|
helperClass: "text-danger",
|
|
28
29
|
helperText: w.value
|
|
29
|
-
} :
|
|
30
|
+
} : b.value ? {
|
|
30
31
|
rightIcon: "lucide:clock-alert",
|
|
31
32
|
borderClass: "border-warning focus-within:border-warning",
|
|
32
33
|
helperClass: "text-warning",
|
|
@@ -37,28 +38,28 @@ const W = { class: "flex-1 min-w-0" }, q = { class: "flex items-center gap-2 min
|
|
|
37
38
|
helperClass: "text-danger",
|
|
38
39
|
helperText: w.value
|
|
39
40
|
} : null);
|
|
40
|
-
function $(
|
|
41
|
-
|
|
41
|
+
function $(o) {
|
|
42
|
+
l.value = String(o), g("change", l.value);
|
|
42
43
|
}
|
|
43
44
|
function V() {
|
|
44
|
-
const
|
|
45
|
-
|
|
45
|
+
const o = l.value.trim();
|
|
46
|
+
o && g("apply", o);
|
|
46
47
|
}
|
|
47
48
|
function j() {
|
|
48
|
-
|
|
49
|
+
l.value = "", g("remove");
|
|
49
50
|
}
|
|
50
|
-
return (
|
|
51
|
+
return (o, d) => (a(), u("div", {
|
|
51
52
|
class: n(["v-cart-coupon w-full", e.compact ? "space-y-1.5" : "space-y-2"])
|
|
52
53
|
}, [
|
|
53
|
-
|
|
54
|
+
y.value ? r("", !0) : (a(), u("div", {
|
|
54
55
|
key: 0,
|
|
55
56
|
class: n(["flex items-center gap-2", e.compact ? "flex-col items-stretch gap-1.5" : "flex-col sm:flex-row sm:items-stretch"])
|
|
56
57
|
}, [
|
|
57
58
|
p("div", W, [
|
|
58
|
-
|
|
59
|
-
modelValue:
|
|
59
|
+
i(U, {
|
|
60
|
+
modelValue: l.value,
|
|
60
61
|
"onUpdate:modelValue": [
|
|
61
|
-
d[0] || (d[0] = (P) =>
|
|
62
|
+
d[0] || (d[0] = (P) => l.value = P),
|
|
62
63
|
$
|
|
63
64
|
],
|
|
64
65
|
placeholder: m.value.couponPlaceholder || "Enter coupon code",
|
|
@@ -75,11 +76,11 @@ const W = { class: "flex-1 min-w-0" }, q = { class: "flex items-center gap-2 min
|
|
|
75
76
|
s.value ? {
|
|
76
77
|
name: "addon-right",
|
|
77
78
|
fn: T(() => [
|
|
78
|
-
|
|
79
|
+
i(C, {
|
|
79
80
|
icon: s.value.rightIcon,
|
|
80
81
|
class: n([
|
|
81
82
|
"h-4 w-4",
|
|
82
|
-
|
|
83
|
+
h.value || k.value ? "text-danger" : b.value ? "text-warning" : ""
|
|
83
84
|
])
|
|
84
85
|
}, null, 8, ["icon", "class"])
|
|
85
86
|
]),
|
|
@@ -87,11 +88,11 @@ const W = { class: "flex-1 min-w-0" }, q = { class: "flex items-center gap-2 min
|
|
|
87
88
|
} : void 0
|
|
88
89
|
]), 1032, ["modelValue", "placeholder", "input-class", "disabled", "readonly", "aria-label"])
|
|
89
90
|
]),
|
|
90
|
-
|
|
91
|
+
i(B, {
|
|
91
92
|
variant: "primary",
|
|
92
93
|
size: "md",
|
|
93
94
|
loading: A.value,
|
|
94
|
-
disabled: !
|
|
95
|
+
disabled: !l.value.trim() || I.value,
|
|
95
96
|
"aria-label": m.value.applyCoupon || "Apply coupon",
|
|
96
97
|
class: "shrink-0",
|
|
97
98
|
onClick: V
|
|
@@ -102,23 +103,23 @@ const W = { class: "flex-1 min-w-0" }, q = { class: "flex items-center gap-2 min
|
|
|
102
103
|
_: 1
|
|
103
104
|
}, 8, ["loading", "disabled", "aria-label"])
|
|
104
105
|
], 2)),
|
|
105
|
-
s.value && !e.compact ? (a(),
|
|
106
|
+
s.value && !e.compact ? (a(), u("p", {
|
|
106
107
|
key: 1,
|
|
107
108
|
class: n(["text-xs font-medium flex items-center gap-1.5", s.value.helperClass])
|
|
108
109
|
}, [
|
|
109
|
-
|
|
110
|
+
i(C, {
|
|
110
111
|
icon: s.value.rightIcon,
|
|
111
112
|
class: "w-3.5 h-3.5 shrink-0"
|
|
112
113
|
}, null, 8, ["icon"]),
|
|
113
114
|
x(" " + f(s.value.helperText), 1)
|
|
114
115
|
], 2)) : r("", !0),
|
|
115
|
-
|
|
116
|
+
y.value && e.coupon ? (a(), u("div", {
|
|
116
117
|
key: 2,
|
|
117
118
|
class: n(["flex items-center justify-between gap-2 rounded-md border border-success/40 bg-success-light/40 p-2.5", e.compact ? "p-2" : "p-2.5"])
|
|
118
119
|
}, [
|
|
119
120
|
p("div", q, [
|
|
120
121
|
p("div", F, [
|
|
121
|
-
|
|
122
|
+
i(C, {
|
|
122
123
|
icon: "lucide:check",
|
|
123
124
|
class: "w-4 h-4"
|
|
124
125
|
})
|
|
@@ -128,31 +129,33 @@ const W = { class: "flex-1 min-w-0" }, q = { class: "flex items-center gap-2 min
|
|
|
128
129
|
p("p", {
|
|
129
130
|
class: n(["font-bold text-foreground uppercase tracking-wider", e.compact ? "text-[10px]" : "text-xs"])
|
|
130
131
|
}, f(e.coupon.code), 3),
|
|
131
|
-
e.coupon.definition?.type === "percentage" ? (a(),
|
|
132
|
+
e.coupon.definition?.type === "percentage" ? (a(), u("span", {
|
|
132
133
|
key: 0,
|
|
133
134
|
class: n(["inline-flex items-center px-1.5 py-0.5 rounded bg-success/30 text-success font-bold tabular-nums", e.compact ? "text-[9px]" : "text-[10px]"])
|
|
134
|
-
}, " −" + f(e.coupon.definition.value) + "% ", 3)) : e.coupon.discountAmount && e.coupon.discountAmount > 0 ? (a(),
|
|
135
|
+
}, " −" + f(e.coupon.definition.value) + "% ", 3)) : e.coupon.discountAmount && e.coupon.discountAmount > 0 ? (a(), u("span", {
|
|
135
136
|
key: 1,
|
|
136
137
|
class: n(["inline-flex items-center px-1.5 py-0.5 rounded bg-success/10 text-success font-bold", e.compact ? "text-[9px]" : "text-[10px]"])
|
|
137
138
|
}, [
|
|
138
139
|
d[1] || (d[1] = x(" −", -1)),
|
|
139
|
-
|
|
140
|
+
i(z(E), {
|
|
140
141
|
value: e.coupon.discountAmount,
|
|
142
|
+
currency: e.currency,
|
|
141
143
|
class: "text-success"
|
|
142
|
-
}, null, 8, ["value"])
|
|
144
|
+
}, null, 8, ["value", "currency"])
|
|
143
145
|
], 2)) : r("", !0),
|
|
144
|
-
e.coupon.definition?.type === "percentage" && e.coupon.discountAmount && e.coupon.discountAmount > 0 ? (a(),
|
|
146
|
+
e.coupon.definition?.type === "percentage" && e.coupon.discountAmount && e.coupon.discountAmount > 0 ? (a(), u("span", {
|
|
145
147
|
key: 2,
|
|
146
148
|
class: n(["inline-flex items-center px-1.5 py-0.5 rounded bg-success/5 text-success font-semibold", e.compact ? "text-[9px]" : "text-[10px]"])
|
|
147
149
|
}, [
|
|
148
|
-
|
|
150
|
+
i(z(E), {
|
|
149
151
|
value: e.coupon.discountAmount,
|
|
152
|
+
currency: e.currency,
|
|
150
153
|
class: "text-success"
|
|
151
|
-
}, null, 8, ["value"]),
|
|
154
|
+
}, null, 8, ["value", "currency"]),
|
|
152
155
|
d[2] || (d[2] = x(" off ", -1))
|
|
153
156
|
], 2)) : r("", !0)
|
|
154
157
|
]),
|
|
155
|
-
e.coupon.description ? (a(),
|
|
158
|
+
e.coupon.description ? (a(), u("p", {
|
|
156
159
|
key: 0,
|
|
157
160
|
class: n(["text-muted-foreground leading-snug truncate", e.compact ? "text-[10px] mt-0.5" : "text-xs mt-0.5"])
|
|
158
161
|
}, f(e.coupon.description), 3)) : r("", !0)
|
|
@@ -14,6 +14,7 @@ type __VLS_Props = {
|
|
|
14
14
|
compact?: boolean;
|
|
15
15
|
readonly?: boolean;
|
|
16
16
|
layout?: Layout;
|
|
17
|
+
currency?: string;
|
|
17
18
|
};
|
|
18
19
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
19
20
|
remove: (itemId: string | number) => any;
|