vlite3 1.4.4 → 1.4.6
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.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/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 +225 -249
- 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/Chat/ChatInterface.vue.js +1 -1
- package/components/Comment/CommentEditor.vue.js +1 -1
- package/components/Dropdown/Dropdown.vue.d.ts +1 -0
- package/components/Dropdown/Dropdown.vue.js +31 -29
- 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 +3 -3
- 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} +8 -5
- 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/Form/types.d.ts +3 -0
- package/components/IconPicker.vue.d.ts +2 -2
- 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 +4 -3
- 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/ThumbnailSelector/ThumbnailSelector.vue.js +1 -1
- package/components/ThumbnailSelector/ThumbnailSelector.vue2.js +1 -1
- package/components/index.d.ts +2 -1
- package/core/config.d.ts +6 -6
- package/index.d.ts +1 -0
- package/index.js +328 -307
- package/package.json +1 -1
- package/style.css +1 -1
- package/components/FilePicker/FilePicker.vue.js +0 -361
- package/components/FilePicker/FilePicker.vue2.js +0 -4
- package/components/Form/CustomFields.vue.js +0 -7
- package/components/Form/CustomFields.vue2.js +0 -261
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { defineComponent as B, computed as v, openBlock as a, createElementBlock as i, normalizeClass as o, createElementVNode as n, toDisplayString as d, createCommentVNode as s, createBlock as g, withCtx as y, createTextVNode as k, Fragment as $, renderList as V, createVNode as h } from "vue";
|
|
2
|
+
import N from "../Icon.vue.js";
|
|
3
|
+
import C from "../Button.vue.js";
|
|
4
|
+
import D from "./CartLineItem.vue.js";
|
|
5
|
+
import E from "./CartSummary.vue.js";
|
|
6
|
+
import L from "./CartCouponInput.vue.js";
|
|
7
|
+
import I from "./CartEmptyState.vue.js";
|
|
8
|
+
const P = {
|
|
9
|
+
key: 1,
|
|
10
|
+
class: "rounded-lg border border-border overflow-hidden"
|
|
11
|
+
}, R = { class: "divide-y divide-border" }, T = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "space-y-2 mt-4"
|
|
14
|
+
}, j = { class: "font-medium text-foreground" }, J = /* @__PURE__ */ B({
|
|
15
|
+
__name: "CartVariant3",
|
|
16
|
+
props: {
|
|
17
|
+
data: {},
|
|
18
|
+
actions: {},
|
|
19
|
+
features: {},
|
|
20
|
+
labels: {},
|
|
21
|
+
compact: { type: Boolean, default: !1 },
|
|
22
|
+
variant: { default: "Variant3" },
|
|
23
|
+
containerClass: {}
|
|
24
|
+
},
|
|
25
|
+
emits: ["update:quantity", "remove", "clear", "apply-coupon", "remove-coupon", "coupon-change", "continue", "continue-shopping"],
|
|
26
|
+
setup(e, { emit: z }) {
|
|
27
|
+
const b = e, u = z, r = v(() => b.data), x = v(() => b.labels || {}), c = v(() => b.actions || {}), p = v(() => b.features || {}), m = v(() => r.value.empty || !r.value.items || r.value.items.length === 0), w = v(
|
|
28
|
+
() => r.value.totals.itemCount ?? r.value.items?.reduce((S, t) => S + (t.quantity || 0), 0) ?? 0
|
|
29
|
+
);
|
|
30
|
+
return (S, t) => (a(), i("div", {
|
|
31
|
+
class: o(["v-cart v-cart-v3 w-full bg-background text-foreground", e.containerClass])
|
|
32
|
+
}, [
|
|
33
|
+
n("div", {
|
|
34
|
+
class: o(["flex flex-col sm:flex-row sm:items-end sm:justify-between gap-3 border-b border-border", e.compact ? "pb-3 mb-4" : "pb-4 mb-6"])
|
|
35
|
+
}, [
|
|
36
|
+
n("div", null, [
|
|
37
|
+
n("h1", {
|
|
38
|
+
class: o(["font-extrabold tracking-tight text-foreground", e.compact ? "text-xl" : "text-3xl"])
|
|
39
|
+
}, d(r.value.title || x.value.cart || "Shopping Cart"), 3),
|
|
40
|
+
m.value ? s("", !0) : (a(), i("p", {
|
|
41
|
+
key: 0,
|
|
42
|
+
class: o(["text-muted-foreground mt-0.5", e.compact ? "text-xs" : "text-sm"])
|
|
43
|
+
}, d(w.value) + " " + d(w.value === 1 ? "item" : "items") + " in your cart ", 3))
|
|
44
|
+
]),
|
|
45
|
+
e.features.clearable && !m.value && !e.data.readonly ? (a(), g(C, {
|
|
46
|
+
key: 0,
|
|
47
|
+
variant: "ghost",
|
|
48
|
+
size: "sm",
|
|
49
|
+
icon: "lucide:trash-2",
|
|
50
|
+
class: "self-start",
|
|
51
|
+
onClick: t[0] || (t[0] = (l) => u("clear"))
|
|
52
|
+
}, {
|
|
53
|
+
default: y(() => [
|
|
54
|
+
k(d(x.value.clearCart || "Clear cart"), 1)
|
|
55
|
+
]),
|
|
56
|
+
_: 1
|
|
57
|
+
})) : s("", !0)
|
|
58
|
+
], 2),
|
|
59
|
+
n("div", {
|
|
60
|
+
class: o(["grid gap-6", [
|
|
61
|
+
m.value ? "grid-cols-1" : "grid-cols-1 lg:grid-cols-[1fr_360px] xl:grid-cols-[1fr_400px]",
|
|
62
|
+
e.compact ? "gap-4" : "gap-6"
|
|
63
|
+
]])
|
|
64
|
+
}, [
|
|
65
|
+
n("div", null, [
|
|
66
|
+
m.value ? (a(), g(I, {
|
|
67
|
+
key: 0,
|
|
68
|
+
labels: e.labels,
|
|
69
|
+
compact: e.compact,
|
|
70
|
+
onContinueShopping: t[1] || (t[1] = (l) => u("continue-shopping"))
|
|
71
|
+
}, null, 8, ["labels", "compact"])) : (a(), i("div", P, [
|
|
72
|
+
n("div", {
|
|
73
|
+
class: o(["bg-muted/40 border-b border-border text-muted-foreground uppercase tracking-wider font-bold flex items-center", [e.compact ? "px-3 py-2 text-[10px]" : "px-4 py-2.5 text-xs"]])
|
|
74
|
+
}, [
|
|
75
|
+
t[9] || (t[9] = n("span", { class: "flex-1" }, "Product", -1)),
|
|
76
|
+
n("span", {
|
|
77
|
+
class: o(e.compact ? "w-14 text-right" : "w-20 text-right")
|
|
78
|
+
}, "Qty", 2),
|
|
79
|
+
n("span", {
|
|
80
|
+
class: o(e.compact ? "w-20 text-right" : "w-28 text-right")
|
|
81
|
+
}, "Total", 2)
|
|
82
|
+
], 2),
|
|
83
|
+
n("ul", R, [
|
|
84
|
+
(a(!0), i($, null, V(e.data.items, (l) => (a(), i("li", {
|
|
85
|
+
key: l.id
|
|
86
|
+
}, [
|
|
87
|
+
h(D, {
|
|
88
|
+
item: l,
|
|
89
|
+
features: e.features,
|
|
90
|
+
labels: e.labels,
|
|
91
|
+
compact: e.compact,
|
|
92
|
+
readonly: e.data.readonly,
|
|
93
|
+
layout: "card",
|
|
94
|
+
"onUpdate:quantity": t[2] || (t[2] = (f, q) => u("update:quantity", f, q)),
|
|
95
|
+
onRemove: t[3] || (t[3] = (f) => u("remove", f))
|
|
96
|
+
}, null, 8, ["item", "features", "labels", "compact", "readonly"])
|
|
97
|
+
]))), 128))
|
|
98
|
+
])
|
|
99
|
+
]))
|
|
100
|
+
]),
|
|
101
|
+
m.value ? s("", !0) : (a(), i("aside", {
|
|
102
|
+
key: 0,
|
|
103
|
+
class: o(["lg:sticky lg:top-4 self-start", e.compact ? "space-y-3" : "space-y-4"])
|
|
104
|
+
}, [
|
|
105
|
+
n("div", {
|
|
106
|
+
class: o(["rounded-lg border border-border overflow-hidden", e.compact ? "p-4" : "p-5"])
|
|
107
|
+
}, [
|
|
108
|
+
n("h3", {
|
|
109
|
+
class: o(["font-bold text-foreground uppercase tracking-widest text-muted-foreground", e.compact ? "text-[10px] mb-2" : "text-xs mb-3"])
|
|
110
|
+
}, " Order Summary ", 2),
|
|
111
|
+
n("div", {
|
|
112
|
+
class: o(e.compact ? "space-y-3" : "space-y-4")
|
|
113
|
+
}, [
|
|
114
|
+
e.features.coupon ? (a(), g(L, {
|
|
115
|
+
key: 0,
|
|
116
|
+
coupon: e.data.coupon,
|
|
117
|
+
labels: e.labels,
|
|
118
|
+
compact: e.compact,
|
|
119
|
+
readonly: e.data.readonly,
|
|
120
|
+
onApply: t[4] || (t[4] = (l) => u("apply-coupon", l)),
|
|
121
|
+
onRemove: t[5] || (t[5] = (l) => u("remove-coupon")),
|
|
122
|
+
onChange: t[6] || (t[6] = (l) => u("coupon-change", l))
|
|
123
|
+
}, null, 8, ["coupon", "labels", "compact", "readonly"])) : s("", !0),
|
|
124
|
+
n("div", {
|
|
125
|
+
class: o(["border-t border-border", e.compact ? "pt-2" : "pt-3"])
|
|
126
|
+
}, [
|
|
127
|
+
h(E, {
|
|
128
|
+
totals: e.data.totals,
|
|
129
|
+
features: e.features,
|
|
130
|
+
labels: e.labels,
|
|
131
|
+
compact: e.compact,
|
|
132
|
+
coupon: e.data.coupon,
|
|
133
|
+
variant: "Variant3"
|
|
134
|
+
}, null, 8, ["totals", "features", "labels", "compact", "coupon"])
|
|
135
|
+
], 2)
|
|
136
|
+
], 2),
|
|
137
|
+
c.value.showContinue && p.value.continue || c.value.showContinueShopping && p.value.continueShopping ? (a(), i("div", T, [
|
|
138
|
+
c.value.showContinue && p.value.continue ? (a(), g(C, {
|
|
139
|
+
key: 0,
|
|
140
|
+
variant: "primary",
|
|
141
|
+
size: e.compact ? "md" : "lg",
|
|
142
|
+
block: !0,
|
|
143
|
+
icon: c.value.continueIcon || "lucide:lock",
|
|
144
|
+
disabled: c.value.continueDisabled || m.value,
|
|
145
|
+
class: "w-full",
|
|
146
|
+
onClick: t[7] || (t[7] = (l) => u("continue"))
|
|
147
|
+
}, {
|
|
148
|
+
default: y(() => [
|
|
149
|
+
k(d(c.value.continueLabel || x.value.continue || "Proceed to checkout"), 1)
|
|
150
|
+
]),
|
|
151
|
+
_: 1
|
|
152
|
+
}, 8, ["size", "icon", "disabled"])) : s("", !0),
|
|
153
|
+
c.value.showContinueShopping && p.value.continueShopping ? (a(), g(C, {
|
|
154
|
+
key: 1,
|
|
155
|
+
variant: "ghost",
|
|
156
|
+
size: e.compact ? "sm" : "md",
|
|
157
|
+
block: !0,
|
|
158
|
+
icon: c.value.continueShoppingIcon || "lucide:arrow-left",
|
|
159
|
+
disabled: c.value.continueShoppingDisabled,
|
|
160
|
+
class: "w-full",
|
|
161
|
+
onClick: t[8] || (t[8] = (l) => u("continue-shopping"))
|
|
162
|
+
}, {
|
|
163
|
+
default: y(() => [
|
|
164
|
+
k(d(c.value.continueShoppingLabel || x.value.continueShopping || "Continue shopping"), 1)
|
|
165
|
+
]),
|
|
166
|
+
_: 1
|
|
167
|
+
}, 8, ["size", "icon", "disabled"])) : s("", !0)
|
|
168
|
+
])) : s("", !0)
|
|
169
|
+
], 2),
|
|
170
|
+
p.value.trustSignals && r.value.trustSignals?.length ? (a(), i("div", {
|
|
171
|
+
key: 0,
|
|
172
|
+
class: o(["rounded-lg border border-border bg-muted/30", e.compact ? "p-3 space-y-2" : "p-4 space-y-2.5"])
|
|
173
|
+
}, [
|
|
174
|
+
(a(!0), i($, null, V(r.value.trustSignals, (l, f) => (a(), i("div", {
|
|
175
|
+
key: f,
|
|
176
|
+
class: o(["flex items-center gap-2", e.compact ? "text-xs" : "text-sm"])
|
|
177
|
+
}, [
|
|
178
|
+
h(N, {
|
|
179
|
+
icon: l.icon,
|
|
180
|
+
class: "w-4 h-4 text-muted-foreground"
|
|
181
|
+
}, null, 8, ["icon"]),
|
|
182
|
+
n("span", j, d(l.text), 1)
|
|
183
|
+
], 2))), 128))
|
|
184
|
+
], 2)) : s("", !0)
|
|
185
|
+
], 2))
|
|
186
|
+
], 2)
|
|
187
|
+
], 2));
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
export {
|
|
191
|
+
J as default
|
|
192
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { defineComponent as q, computed as c, openBlock as a, createElementBlock as i, normalizeClass as r, createElementVNode as m, createVNode as v, toDisplayString as b, createCommentVNode as u, unref as z, createBlock as y, Fragment as B, renderList as N, withCtx as k, createTextVNode as C } from "vue";
|
|
2
|
+
import D from "../Icon.vue.js";
|
|
3
|
+
import E from "../Price/Price.vue.js";
|
|
4
|
+
import w from "../Button.vue.js";
|
|
5
|
+
import L from "./CartLineItem.vue.js";
|
|
6
|
+
import j from "./CartSummary.vue.js";
|
|
7
|
+
import I from "./CartCouponInput.vue.js";
|
|
8
|
+
import R from "./CartEmptyState.vue.js";
|
|
9
|
+
const T = { class: "flex items-center gap-2 min-w-0" }, A = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "inline-flex items-center justify-center px-1.5 h-5 rounded-full bg-primary/10 text-primary text-[10px] font-bold tabular-nums"
|
|
12
|
+
}, F = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "text-xs text-muted-foreground"
|
|
15
|
+
}, U = { class: "font-semibold text-foreground" }, G = { class: "flex-1 min-h-0 overflow-y-auto" }, H = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "space-y-1.5 pt-0.5"
|
|
18
|
+
}, Y = /* @__PURE__ */ q({
|
|
19
|
+
__name: "CartVariant4",
|
|
20
|
+
props: {
|
|
21
|
+
data: {},
|
|
22
|
+
actions: {},
|
|
23
|
+
features: {},
|
|
24
|
+
labels: {},
|
|
25
|
+
compact: { type: Boolean, default: !1 },
|
|
26
|
+
variant: { default: "Variant4" },
|
|
27
|
+
containerClass: {}
|
|
28
|
+
},
|
|
29
|
+
emits: ["update:quantity", "remove", "clear", "apply-coupon", "remove-coupon", "coupon-change", "continue", "continue-shopping"],
|
|
30
|
+
setup(e, { emit: $ }) {
|
|
31
|
+
const p = e, l = $, s = c(() => p.data), g = c(() => p.labels || {}), o = c(() => p.actions || {}), f = c(() => p.features || {}), d = c(() => s.value.empty || !s.value.items || s.value.items.length === 0), S = c(
|
|
32
|
+
() => s.value.totals.itemCount ?? s.value.items?.reduce((h, t) => h + (t.quantity || 0), 0) ?? 0
|
|
33
|
+
);
|
|
34
|
+
return (h, t) => (a(), i("div", {
|
|
35
|
+
class: r(["v-cart v-cart-v4 flex flex-col bg-background text-foreground border border-border rounded-lg overflow-hidden w-full h-full", [e.containerClass, e.compact ? "max-w-xs" : "max-w-sm"]])
|
|
36
|
+
}, [
|
|
37
|
+
m("div", {
|
|
38
|
+
class: r(["flex items-center justify-between gap-2 border-b border-border shrink-0", e.compact ? "px-3 py-2" : "px-4 py-2.5"])
|
|
39
|
+
}, [
|
|
40
|
+
m("div", T, [
|
|
41
|
+
v(D, {
|
|
42
|
+
icon: "lucide:shopping-bag",
|
|
43
|
+
class: r(e.compact ? "w-4 h-4" : "w-4.5 h-4.5")
|
|
44
|
+
}, null, 8, ["class"]),
|
|
45
|
+
m("p", {
|
|
46
|
+
class: r(["font-bold text-foreground truncate", (e.compact, "text-sm")])
|
|
47
|
+
}, b(s.value.title || g.value.cart || "Cart"), 3),
|
|
48
|
+
d.value ? u("", !0) : (a(), i("span", A, b(S.value), 1))
|
|
49
|
+
]),
|
|
50
|
+
!d.value && !e.compact ? (a(), i("p", F, [
|
|
51
|
+
m("span", U, [
|
|
52
|
+
v(z(E), {
|
|
53
|
+
value: e.data.totals.grandTotal,
|
|
54
|
+
class: "text-foreground font-semibold"
|
|
55
|
+
}, null, 8, ["value"])
|
|
56
|
+
])
|
|
57
|
+
])) : u("", !0)
|
|
58
|
+
], 2),
|
|
59
|
+
m("div", G, [
|
|
60
|
+
d.value ? (a(), y(R, {
|
|
61
|
+
key: 0,
|
|
62
|
+
labels: e.labels,
|
|
63
|
+
compact: !0,
|
|
64
|
+
onContinueShopping: t[0] || (t[0] = (n) => l("continue-shopping"))
|
|
65
|
+
}, null, 8, ["labels"])) : (a(), i("ul", {
|
|
66
|
+
key: 1,
|
|
67
|
+
class: r(["divide-y divide-border", e.compact ? "px-3" : "px-4"])
|
|
68
|
+
}, [
|
|
69
|
+
(a(!0), i(B, null, N(e.data.items, (n) => (a(), i("li", {
|
|
70
|
+
key: n.id
|
|
71
|
+
}, [
|
|
72
|
+
v(L, {
|
|
73
|
+
item: n,
|
|
74
|
+
features: e.features,
|
|
75
|
+
labels: e.labels,
|
|
76
|
+
compact: e.compact,
|
|
77
|
+
readonly: e.data.readonly,
|
|
78
|
+
layout: "mini",
|
|
79
|
+
"onUpdate:quantity": t[1] || (t[1] = (x, V) => l("update:quantity", x, V)),
|
|
80
|
+
onRemove: t[2] || (t[2] = (x) => l("remove", x))
|
|
81
|
+
}, null, 8, ["item", "features", "labels", "compact", "readonly"])
|
|
82
|
+
]))), 128))
|
|
83
|
+
], 2))
|
|
84
|
+
]),
|
|
85
|
+
d.value ? u("", !0) : (a(), i("div", {
|
|
86
|
+
key: 0,
|
|
87
|
+
class: r(["border-t border-border bg-muted/30 shrink-0", e.compact ? "p-3 space-y-2" : "p-4 space-y-3"])
|
|
88
|
+
}, [
|
|
89
|
+
v(j, {
|
|
90
|
+
totals: e.data.totals,
|
|
91
|
+
features: e.features,
|
|
92
|
+
labels: e.labels,
|
|
93
|
+
compact: e.compact,
|
|
94
|
+
coupon: e.data.coupon,
|
|
95
|
+
variant: "Variant4"
|
|
96
|
+
}, null, 8, ["totals", "features", "labels", "compact", "coupon"]),
|
|
97
|
+
e.features.coupon ? (a(), y(I, {
|
|
98
|
+
key: 0,
|
|
99
|
+
coupon: e.data.coupon,
|
|
100
|
+
labels: e.labels,
|
|
101
|
+
compact: e.compact,
|
|
102
|
+
readonly: e.data.readonly,
|
|
103
|
+
onApply: t[3] || (t[3] = (n) => l("apply-coupon", n)),
|
|
104
|
+
onRemove: t[4] || (t[4] = (n) => l("remove-coupon")),
|
|
105
|
+
onChange: t[5] || (t[5] = (n) => l("coupon-change", n))
|
|
106
|
+
}, null, 8, ["coupon", "labels", "compact", "readonly"])) : u("", !0),
|
|
107
|
+
o.value.showContinue && f.value.continue || o.value.showContinueShopping && f.value.continueShopping ? (a(), i("div", H, [
|
|
108
|
+
o.value.showContinue && f.value.continue ? (a(), y(w, {
|
|
109
|
+
key: 0,
|
|
110
|
+
variant: "primary",
|
|
111
|
+
size: e.compact ? "sm" : "md",
|
|
112
|
+
block: !0,
|
|
113
|
+
icon: o.value.continueIcon || "lucide:arrow-right",
|
|
114
|
+
disabled: o.value.continueDisabled || d.value,
|
|
115
|
+
class: "w-full",
|
|
116
|
+
onClick: t[6] || (t[6] = (n) => l("continue"))
|
|
117
|
+
}, {
|
|
118
|
+
default: k(() => [
|
|
119
|
+
C(b(o.value.continueLabel || g.value.continue || "Checkout"), 1)
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["size", "icon", "disabled"])) : u("", !0),
|
|
123
|
+
o.value.showContinueShopping && f.value.continueShopping ? (a(), y(w, {
|
|
124
|
+
key: 1,
|
|
125
|
+
variant: "ghost",
|
|
126
|
+
size: "sm",
|
|
127
|
+
block: !0,
|
|
128
|
+
icon: o.value.continueShoppingIcon || "lucide:arrow-left",
|
|
129
|
+
disabled: o.value.continueShoppingDisabled,
|
|
130
|
+
class: "w-full",
|
|
131
|
+
onClick: t[7] || (t[7] = (n) => l("continue-shopping"))
|
|
132
|
+
}, {
|
|
133
|
+
default: k(() => [
|
|
134
|
+
C(b(o.value.continueShoppingLabel || g.value.continueShopping || "Continue shopping"), 1)
|
|
135
|
+
]),
|
|
136
|
+
_: 1
|
|
137
|
+
}, 8, ["icon", "disabled"])) : u("", !0)
|
|
138
|
+
])) : u("", !0)
|
|
139
|
+
], 2))
|
|
140
|
+
], 2));
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
export {
|
|
144
|
+
Y as default
|
|
145
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { CartCoupon, CartData, CartItem, CartTotals } from '../types';
|
|
3
|
+
export type CartItemId = CartItem['id'];
|
|
4
|
+
export interface UseCartOptions extends Partial<Omit<CartData, 'items' | 'coupon' | 'totals'>> {
|
|
5
|
+
/** Initial line items */
|
|
6
|
+
items?: CartItem[];
|
|
7
|
+
/** Initial applied coupon */
|
|
8
|
+
coupon?: CartCoupon | null;
|
|
9
|
+
/** Server-provided totals. When omitted, useCart calculates totals locally. */
|
|
10
|
+
totals?: CartTotals;
|
|
11
|
+
}
|
|
12
|
+
export interface UseCartReturn {
|
|
13
|
+
/** Reactive line items */
|
|
14
|
+
items: Ref<CartItem[]>;
|
|
15
|
+
/** Reactive applied coupon */
|
|
16
|
+
coupon: Ref<CartCoupon | null>;
|
|
17
|
+
/** Totals produced by the same calculator used by the Cart component */
|
|
18
|
+
totals: ComputedRef<CartTotals>;
|
|
19
|
+
/** Ready-to-pass CartData object for `<Cart :data="cart.data" />` */
|
|
20
|
+
data: ComputedRef<CartData>;
|
|
21
|
+
/** Total quantity across all line items */
|
|
22
|
+
itemCount: ComputedRef<number>;
|
|
23
|
+
/** Whether the cart currently has no line items */
|
|
24
|
+
isEmpty: ComputedRef<boolean>;
|
|
25
|
+
/** Add a line item, merging quantity with an existing item that has the same id. */
|
|
26
|
+
addToCart: (item: CartItem, quantity?: number) => void;
|
|
27
|
+
/** Remove a line item entirely, or subtract a quantity when provided. */
|
|
28
|
+
removeFromCart: (itemId: CartItemId, quantity?: number) => void;
|
|
29
|
+
/** Set a line item's quantity. Quantities <= 0 remove the item. */
|
|
30
|
+
updateQuantity: (itemId: CartItemId, quantity: number) => void;
|
|
31
|
+
/** Increase a line item's quantity. */
|
|
32
|
+
incrementQuantity: (itemId: CartItemId, amount?: number) => void;
|
|
33
|
+
/** Decrease a line item's quantity, removing it at zero. */
|
|
34
|
+
decrementQuantity: (itemId: CartItemId, amount?: number) => void;
|
|
35
|
+
/** Replace all cart items. */
|
|
36
|
+
setItems: (nextItems: CartItem[]) => void;
|
|
37
|
+
/** Clear all line items. */
|
|
38
|
+
clearCart: () => void;
|
|
39
|
+
/** Set or clear the applied coupon. */
|
|
40
|
+
setCoupon: (nextCoupon: CartCoupon | null) => void;
|
|
41
|
+
/** Get the current quantity for a line item id. */
|
|
42
|
+
getQuantity: (itemId: CartItemId) => number;
|
|
43
|
+
/** Get a shallow-copied snapshot of the current cart items. */
|
|
44
|
+
getCartItems: () => CartItem[];
|
|
45
|
+
}
|
|
46
|
+
export declare function useCart(options?: UseCartOptions): UseCartReturn;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ref as Q, computed as v } from "vue";
|
|
2
|
+
import { calculateCartTotals as w } from "./useCartCalculation.js";
|
|
3
|
+
function s(u, o) {
|
|
4
|
+
if (!Number.isFinite(u)) return 0;
|
|
5
|
+
const d = Math.max(0, Math.floor(u));
|
|
6
|
+
return typeof o == "number" && Number.isFinite(o) ? Math.min(d, Math.max(0, Math.floor(o))) : d;
|
|
7
|
+
}
|
|
8
|
+
function f(u, o = u.quantity) {
|
|
9
|
+
return {
|
|
10
|
+
...u,
|
|
11
|
+
quantity: s(o, u.maxQuantity)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function D(u = {}) {
|
|
15
|
+
const {
|
|
16
|
+
items: o = [],
|
|
17
|
+
coupon: d = null,
|
|
18
|
+
totals: h,
|
|
19
|
+
...m
|
|
20
|
+
} = u, n = Q(o.map((t) => f(t))), p = Q(d), l = Q(h), g = v(() => w({
|
|
21
|
+
items: n.value,
|
|
22
|
+
tax: m.tax,
|
|
23
|
+
shipping: m.shipping,
|
|
24
|
+
coupon: p.value,
|
|
25
|
+
currency: m.currency
|
|
26
|
+
}).totals), C = v(() => l.value ?? g.value), M = v(() => n.value.reduce((t, e) => t + s(e.quantity), 0)), q = v(() => n.value.length === 0), T = v(() => ({
|
|
27
|
+
...m,
|
|
28
|
+
items: n.value,
|
|
29
|
+
coupon: p.value ?? void 0,
|
|
30
|
+
totals: C.value
|
|
31
|
+
}));
|
|
32
|
+
function y(t) {
|
|
33
|
+
return s(n.value.find((e) => e.id === t)?.quantity ?? 0);
|
|
34
|
+
}
|
|
35
|
+
function b(t) {
|
|
36
|
+
n.value = t.map((e) => f(e)), l.value = void 0;
|
|
37
|
+
}
|
|
38
|
+
function F(t, e = t.quantity || 1) {
|
|
39
|
+
const a = s(e, t.maxQuantity);
|
|
40
|
+
if (a <= 0) return;
|
|
41
|
+
const r = n.value.findIndex((i) => i.id === t.id);
|
|
42
|
+
if (r === -1)
|
|
43
|
+
n.value = [...n.value, f(t, a)];
|
|
44
|
+
else {
|
|
45
|
+
const i = n.value[r], c = t.maxQuantity ?? i.maxQuantity, k = f(
|
|
46
|
+
{
|
|
47
|
+
...i,
|
|
48
|
+
...t,
|
|
49
|
+
maxQuantity: c
|
|
50
|
+
},
|
|
51
|
+
s(i.quantity + a, c)
|
|
52
|
+
);
|
|
53
|
+
n.value = [...n.value.slice(0, r), k, ...n.value.slice(r + 1)];
|
|
54
|
+
}
|
|
55
|
+
l.value = void 0;
|
|
56
|
+
}
|
|
57
|
+
function x(t, e) {
|
|
58
|
+
const a = n.value.findIndex((c) => c.id === t);
|
|
59
|
+
if (a === -1) return;
|
|
60
|
+
const r = n.value[a], i = s(e, r.maxQuantity);
|
|
61
|
+
i <= 0 ? n.value = n.value.filter((c) => c.id !== t) : n.value = [
|
|
62
|
+
...n.value.slice(0, a),
|
|
63
|
+
f(r, i),
|
|
64
|
+
...n.value.slice(a + 1)
|
|
65
|
+
], l.value = void 0;
|
|
66
|
+
}
|
|
67
|
+
function z(t, e) {
|
|
68
|
+
if (e === void 0) {
|
|
69
|
+
n.value = n.value.filter((a) => a.id !== t), l.value = void 0;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
x(t, y(t) - e);
|
|
73
|
+
}
|
|
74
|
+
function N(t, e = 1) {
|
|
75
|
+
x(t, y(t) + e);
|
|
76
|
+
}
|
|
77
|
+
function O(t, e = 1) {
|
|
78
|
+
x(t, y(t) - e);
|
|
79
|
+
}
|
|
80
|
+
function E() {
|
|
81
|
+
n.value = [], l.value = void 0;
|
|
82
|
+
}
|
|
83
|
+
function I(t) {
|
|
84
|
+
p.value = t, l.value = void 0;
|
|
85
|
+
}
|
|
86
|
+
function j() {
|
|
87
|
+
return n.value.map((t) => ({ ...t }));
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
items: n,
|
|
91
|
+
coupon: p,
|
|
92
|
+
totals: C,
|
|
93
|
+
data: T,
|
|
94
|
+
itemCount: M,
|
|
95
|
+
isEmpty: q,
|
|
96
|
+
addToCart: F,
|
|
97
|
+
removeFromCart: z,
|
|
98
|
+
updateQuantity: x,
|
|
99
|
+
incrementQuantity: N,
|
|
100
|
+
decrementQuantity: O,
|
|
101
|
+
setItems: b,
|
|
102
|
+
clearCart: E,
|
|
103
|
+
setCoupon: I,
|
|
104
|
+
getQuantity: y,
|
|
105
|
+
getCartItems: j
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
D as useCart
|
|
110
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
const n = (o, e = 0) => {
|
|
2
|
+
const r = Number(o);
|
|
3
|
+
return Number.isFinite(r) ? r : e;
|
|
4
|
+
}, u = (o, e = 2) => {
|
|
5
|
+
const r = Math.pow(10, e);
|
|
6
|
+
return Math.round((o + Number.EPSILON) * r) / r;
|
|
7
|
+
};
|
|
8
|
+
function h(o, e = !1) {
|
|
9
|
+
return o.reduce((r, t) => {
|
|
10
|
+
const a = n(t.price), i = Math.max(0, Math.floor(n(t.quantity))), c = a * i;
|
|
11
|
+
return e && t.taxable === !1 ? r : r + c;
|
|
12
|
+
}, 0);
|
|
13
|
+
}
|
|
14
|
+
function M(o) {
|
|
15
|
+
return o.reduce((e, r) => {
|
|
16
|
+
const t = n(r.originalPrice), a = n(r.price), i = Math.max(0, Math.floor(n(r.quantity)));
|
|
17
|
+
return t > a ? e + (t - a) * i : e;
|
|
18
|
+
}, 0);
|
|
19
|
+
}
|
|
20
|
+
function S(o) {
|
|
21
|
+
return o.reduce((e, r) => e + Math.max(0, Math.floor(n(r.quantity))), 0);
|
|
22
|
+
}
|
|
23
|
+
function y(o, e, r) {
|
|
24
|
+
if (!o) return 0;
|
|
25
|
+
const t = o.definition;
|
|
26
|
+
if (!t)
|
|
27
|
+
return Math.max(0, n(o.discountAmount));
|
|
28
|
+
if (t.currency && r && t.currency !== r) return 0;
|
|
29
|
+
if (t.expiresAt) {
|
|
30
|
+
const i = t.expiresAt instanceof Date ? t.expiresAt : new Date(t.expiresAt);
|
|
31
|
+
if (!Number.isNaN(i.getTime()) && i.getTime() < Date.now()) return 0;
|
|
32
|
+
}
|
|
33
|
+
if (t.minSubtotal !== void 0 && e < n(t.minSubtotal)) return 0;
|
|
34
|
+
let a = 0;
|
|
35
|
+
if (t.type === "percentage")
|
|
36
|
+
a = e * n(t.value) / 100;
|
|
37
|
+
else if (t.type === "fixed")
|
|
38
|
+
a = n(t.value);
|
|
39
|
+
else
|
|
40
|
+
return 0;
|
|
41
|
+
return t.maxDiscount !== void 0 && a > n(t.maxDiscount) && (a = n(t.maxDiscount)), a > e && (a = e), Math.max(0, a);
|
|
42
|
+
}
|
|
43
|
+
function k(o, e, r = 2) {
|
|
44
|
+
if (!e || e.mode === "exempt")
|
|
45
|
+
return { total: 0, breakdown: [] };
|
|
46
|
+
if (e.mode === "flat") {
|
|
47
|
+
const t = Math.max(0, n(e.amount));
|
|
48
|
+
return {
|
|
49
|
+
total: u(t, r),
|
|
50
|
+
breakdown: [{ label: e.label || "Tax", amount: u(t, r) }]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (e.mode === "rate" || e.mode === "inclusive") {
|
|
54
|
+
const t = n(e.rate);
|
|
55
|
+
if (t <= 0) return { total: 0, breakdown: [] };
|
|
56
|
+
const a = u(o * t / 100, r), i = e.label || (e.mode === "inclusive" ? `VAT (${t}%)` : `Tax (${t}%)`);
|
|
57
|
+
return { total: a, breakdown: [{ label: i, amount: a, rate: t }] };
|
|
58
|
+
}
|
|
59
|
+
return { total: 0, breakdown: [] };
|
|
60
|
+
}
|
|
61
|
+
function g(o, e, r) {
|
|
62
|
+
if (!e || e.mode === "free" || e.mode === "pickup")
|
|
63
|
+
return {
|
|
64
|
+
cost: 0,
|
|
65
|
+
isFree: !0,
|
|
66
|
+
label: e?.label || (e?.mode === "pickup" ? "In-store pickup" : "Free shipping"),
|
|
67
|
+
freeShippingProgress: null
|
|
68
|
+
};
|
|
69
|
+
let t = 0, a = !1, i = e.label || "Shipping", c = 0, s = 0;
|
|
70
|
+
switch (e.mode) {
|
|
71
|
+
case "flat": {
|
|
72
|
+
t = Math.max(0, n(e.cost)), i = e.label || "Shipping";
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case "freeOver": {
|
|
76
|
+
c = n(e.freeOver), o >= c && c > 0 ? (t = 0, a = !0, i = e.label || `Free (orders over ${c})`) : (t = Math.max(0, n(e.cost)), i = e.label || "Shipping", s = c > 0 ? Math.max(0, c - o) : 0);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
case "tiered": {
|
|
80
|
+
const l = (e.tiers || []).slice().sort((m, d) => m.minSubtotal - d.minSubtotal);
|
|
81
|
+
let f;
|
|
82
|
+
for (const m of l)
|
|
83
|
+
if (o >= n(m.minSubtotal)) f = m;
|
|
84
|
+
else break;
|
|
85
|
+
!f && l.length && (f = l[0]), f && (t = Math.max(0, n(f.cost)), f.cost === 0 && (a = !0), i = f.label || e.label || "Shipping");
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case "function": {
|
|
89
|
+
if (typeof e.calculate == "function") {
|
|
90
|
+
const l = e.calculate(o, r);
|
|
91
|
+
t = Math.max(0, n(l?.cost)), l?.isFree && (a = !0), l?.label && (i = l.label);
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
cost: u(t, 2),
|
|
98
|
+
isFree: a,
|
|
99
|
+
label: i,
|
|
100
|
+
freeShippingProgress: e.mode === "freeOver" && c > 0 && !a ? { remaining: u(s, 2), threshold: c } : null
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function T(o) {
|
|
104
|
+
const { items: e, tax: r, shipping: t, coupon: a, currency: i } = o, c = o.roundToCents ?? 2, s = u(h(e, !1), c);
|
|
105
|
+
u(h(e, !0), c);
|
|
106
|
+
const l = u(M(e), c), f = S(e), m = u(y(a, s, i), c), d = u(Math.max(0, s - m), c);
|
|
107
|
+
let x = d;
|
|
108
|
+
r?.applyTo === "subtotal" && (x = s), r?.applyTo === "original" && (x = s);
|
|
109
|
+
const b = k(x, r, c), p = g(
|
|
110
|
+
r?.applyTo === "original" ? s : d,
|
|
111
|
+
t,
|
|
112
|
+
e
|
|
113
|
+
), v = u(
|
|
114
|
+
Math.max(0, d + b.total + p.cost),
|
|
115
|
+
c
|
|
116
|
+
);
|
|
117
|
+
return {
|
|
118
|
+
totals: {
|
|
119
|
+
subtotal: s,
|
|
120
|
+
discount: m > 0 ? m : void 0,
|
|
121
|
+
estimatedTax: b.total > 0 ? b.total : void 0,
|
|
122
|
+
taxRate: r?.mode === "rate" || r?.mode === "inclusive" ? r.rate : void 0,
|
|
123
|
+
shipping: p.cost,
|
|
124
|
+
grandTotal: v,
|
|
125
|
+
itemCount: f,
|
|
126
|
+
totalSavings: l > 0 ? l : void 0,
|
|
127
|
+
currency: i || r?.currency || t?.currency
|
|
128
|
+
},
|
|
129
|
+
taxBreakdown: b.breakdown,
|
|
130
|
+
freeShippingProgress: p.freeShippingProgress
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function w(o) {
|
|
134
|
+
return T(o());
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
T as calculateCartTotals,
|
|
138
|
+
y as computeCouponDiscount,
|
|
139
|
+
g as computeShipping,
|
|
140
|
+
k as computeTax,
|
|
141
|
+
S as sumItemCount,
|
|
142
|
+
h as sumLineTotals,
|
|
143
|
+
M as sumSavings,
|
|
144
|
+
w as useCartCalculation
|
|
145
|
+
};
|
|
@@ -3,5 +3,7 @@ export { default as CartLineItem } from './CartLineItem.vue';
|
|
|
3
3
|
export { default as CartSummary } from './CartSummary.vue';
|
|
4
4
|
export { default as CartCouponInput } from './CartCouponInput.vue';
|
|
5
5
|
export { default as CartEmptyState } from './CartEmptyState.vue';
|
|
6
|
+
export { useCart } from './composables/useCart';
|
|
7
|
+
export type { CartItemId, UseCartOptions, UseCartReturn } from './composables/useCart';
|
|
6
8
|
export * from './composables/useCartCalculation';
|
|
7
9
|
export * from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./CategoryManager.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-0e426dc4"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|