@a4ui/core 0.22.0 → 0.23.0
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 +17 -9
- package/dist/NumberInput-enx_0iVh.js +488 -0
- package/dist/commerce/ConditionScale.d.ts +45 -0
- package/dist/commerce/FacetSidebar.d.ts +55 -0
- package/dist/commerce/PriceBlock.d.ts +50 -0
- package/dist/commerce/index.d.ts +3 -0
- package/dist/commerce.js +465 -150
- package/dist/elements.css +132 -0
- package/dist/full.css +132 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3026 -2827
- package/dist/ui/AnnouncementBar.d.ts +36 -0
- package/dist/ui/LogoWall.d.ts +31 -0
- package/dist/ui/RatingsSummary.d.ts +44 -0
- package/dist/ui/SpecSheet.d.ts +47 -0
- package/package.json +1 -1
- package/src/commerce/ConditionScale.tsx +114 -0
- package/src/commerce/FacetSidebar.tsx +222 -0
- package/src/commerce/PriceBlock.tsx +133 -0
- package/src/commerce/index.ts +9 -0
- package/src/index.ts +5 -1
- package/src/ui/AnnouncementBar.tsx +124 -0
- package/src/ui/LogoWall.tsx +94 -0
- package/src/ui/RatingsSummary.tsx +128 -0
- package/src/ui/SpecSheet.tsx +89 -0
- package/dist/Checkbox-DIzLQltI.js +0 -431
package/dist/commerce.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { Show as
|
|
3
|
-
import { c as
|
|
4
|
-
import { B as
|
|
5
|
-
import { Minus as
|
|
6
|
-
var
|
|
7
|
-
const
|
|
1
|
+
import { insert as n, createComponent as c, memo as k, effect as b, className as C, template as v, delegateEvents as A, setAttribute as w, setStyleProperty as j } from "solid-js/web";
|
|
2
|
+
import { Show as $, For as S, createSignal as B, createMemo as R } from "solid-js";
|
|
3
|
+
import { c as _ } from "./cn-B6yFEsav.js";
|
|
4
|
+
import { B as D, C as O, R as G, a as M, b as z, N as U, c as K } from "./NumberInput-enx_0iVh.js";
|
|
5
|
+
import { Minus as Q, Plus as V, Trash2 as X, X as Z, CreditCard as H } from "lucide-solid";
|
|
6
|
+
var J = /* @__PURE__ */ v('<span class="text-muted-foreground line-through">'), W = /* @__PURE__ */ v("<div><span>");
|
|
7
|
+
const Y = {
|
|
8
8
|
sm: "text-sm",
|
|
9
9
|
md: "text-lg",
|
|
10
10
|
lg: "text-2xl"
|
|
11
11
|
};
|
|
12
|
-
function
|
|
13
|
-
const
|
|
12
|
+
function L(e) {
|
|
13
|
+
const i = (s) => new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
14
14
|
style: "currency",
|
|
15
15
|
currency: e.currency ?? "USD"
|
|
16
|
-
}).format(
|
|
16
|
+
}).format(s), o = () => (e.compareAt ?? 0) > e.amount, r = () => Math.round((1 - e.amount / e.compareAt) * 100);
|
|
17
17
|
return (() => {
|
|
18
|
-
var
|
|
19
|
-
return
|
|
18
|
+
var s = W(), d = s.firstChild;
|
|
19
|
+
return n(d, () => i(e.amount)), n(s, c($, {
|
|
20
20
|
get when() {
|
|
21
|
-
return
|
|
21
|
+
return o();
|
|
22
22
|
},
|
|
23
23
|
get children() {
|
|
24
24
|
return [(() => {
|
|
25
|
-
var
|
|
26
|
-
return
|
|
27
|
-
})(),
|
|
25
|
+
var a = J();
|
|
26
|
+
return n(a, () => i(e.compareAt)), a;
|
|
27
|
+
})(), c(D, {
|
|
28
28
|
tone: "danger",
|
|
29
29
|
get children() {
|
|
30
|
-
return ["-",
|
|
30
|
+
return ["-", k(() => r()), "%"];
|
|
31
31
|
}
|
|
32
32
|
})];
|
|
33
33
|
}
|
|
34
|
-
}), null), b((
|
|
35
|
-
var
|
|
36
|
-
return
|
|
34
|
+
}), null), b((a) => {
|
|
35
|
+
var t = _("inline-flex items-center gap-2", e.class), u = _("font-bold text-foreground", Y[e.size ?? "md"]);
|
|
36
|
+
return t !== a.e && C(s, a.e = t), u !== a.t && C(d, a.t = u), a;
|
|
37
37
|
}, {
|
|
38
38
|
e: void 0,
|
|
39
39
|
t: void 0
|
|
40
|
-
}),
|
|
40
|
+
}), s;
|
|
41
41
|
})();
|
|
42
42
|
}
|
|
43
|
-
var
|
|
44
|
-
function
|
|
45
|
-
const
|
|
43
|
+
var p = /* @__PURE__ */ v('<div><button type=button aria-label="Decrease quantity"class="grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40"></button><span class="grid min-w-[2.5rem] place-items-center tabular-nums"></span><button type=button aria-label="Increase quantity"class="grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40">');
|
|
44
|
+
function ee(e) {
|
|
45
|
+
const i = () => e.min ?? 0, o = () => e.max ?? Number.MAX_SAFE_INTEGER, r = (a) => Math.min(o(), Math.max(i(), a)), s = () => e.onChange(r(e.value - 1)), d = () => e.onChange(r(e.value + 1));
|
|
46
46
|
return (() => {
|
|
47
|
-
var
|
|
48
|
-
return
|
|
47
|
+
var a = p(), t = a.firstChild, u = t.nextSibling, f = u.nextSibling;
|
|
48
|
+
return t.$$click = s, n(t, c(Q, {
|
|
49
49
|
class: "h-4 w-4"
|
|
50
|
-
})),
|
|
50
|
+
})), n(u, () => e.value), f.$$click = d, n(f, c(V, {
|
|
51
51
|
class: "h-4 w-4"
|
|
52
|
-
})), b((
|
|
53
|
-
var
|
|
54
|
-
return
|
|
52
|
+
})), b((l) => {
|
|
53
|
+
var g = _("inline-flex items-stretch rounded-md border border-input", e.class), h = e.disabled || e.value <= i(), m = e.disabled || e.value >= o();
|
|
54
|
+
return g !== l.e && C(a, l.e = g), h !== l.t && (t.disabled = l.t = h), m !== l.a && (f.disabled = l.a = m), l;
|
|
55
55
|
}, {
|
|
56
56
|
e: void 0,
|
|
57
57
|
t: void 0,
|
|
58
58
|
a: void 0
|
|
59
|
-
}),
|
|
59
|
+
}), a;
|
|
60
60
|
})();
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
var
|
|
64
|
-
const
|
|
62
|
+
A(["click"]);
|
|
63
|
+
var te = /* @__PURE__ */ v("<span>"), ne = /* @__PURE__ */ v('<div class="relative aspect-square overflow-hidden rounded-lg bg-muted"><img loading=lazy class="h-full w-full object-cover">', !0, !1, !1), le = /* @__PURE__ */ v('<span class="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">'), re = /* @__PURE__ */ v('<span class="w-fit rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground">'), ae = /* @__PURE__ */ v('<div class="mt-3 flex flex-1 flex-col gap-1.5"><p class="line-clamp-1 font-medium text-foreground">');
|
|
64
|
+
const ie = {
|
|
65
65
|
sale: "bg-destructive text-destructive-foreground",
|
|
66
66
|
new: "bg-primary text-primary-foreground",
|
|
67
67
|
featured: "bg-accent text-accent-foreground"
|
|
68
68
|
};
|
|
69
|
-
function
|
|
70
|
-
if (
|
|
71
|
-
const
|
|
72
|
-
return /sale|off|%|deal/.test(
|
|
69
|
+
function ue(e, i) {
|
|
70
|
+
if (i) return i;
|
|
71
|
+
const o = (e ?? "").toLowerCase();
|
|
72
|
+
return /sale|off|%|deal/.test(o) ? "sale" : /new/.test(o) ? "new" : "featured";
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
74
|
+
function De(e) {
|
|
75
|
+
return c(O, {
|
|
76
76
|
glass: !0,
|
|
77
77
|
glow: !0,
|
|
78
78
|
get tilt() {
|
|
@@ -82,50 +82,50 @@ function de(e) {
|
|
|
82
82
|
return e.spotlight;
|
|
83
83
|
},
|
|
84
84
|
get class() {
|
|
85
|
-
return
|
|
85
|
+
return _("flex h-full flex-col overflow-hidden p-4", e.class);
|
|
86
86
|
},
|
|
87
87
|
get children() {
|
|
88
88
|
return [(() => {
|
|
89
|
-
var
|
|
90
|
-
return
|
|
89
|
+
var i = ne(), o = i.firstChild;
|
|
90
|
+
return n(i, c($, {
|
|
91
91
|
get when() {
|
|
92
92
|
return e.badge;
|
|
93
93
|
},
|
|
94
94
|
get children() {
|
|
95
|
-
var
|
|
96
|
-
return
|
|
95
|
+
var r = te();
|
|
96
|
+
return n(r, () => e.badge), b(() => C(r, _("absolute -right-9 top-3.5 w-32 rotate-45 py-1 text-center text-[11px] font-semibold uppercase tracking-wide shadow-md", ie[ue(e.badge, e.badgeTone)]))), r;
|
|
97
97
|
}
|
|
98
|
-
}), null), b((
|
|
99
|
-
var
|
|
100
|
-
return
|
|
98
|
+
}), null), b((r) => {
|
|
99
|
+
var s = e.image, d = e.title;
|
|
100
|
+
return s !== r.e && w(o, "src", r.e = s), d !== r.t && w(o, "alt", r.t = d), r;
|
|
101
101
|
}, {
|
|
102
102
|
e: void 0,
|
|
103
103
|
t: void 0
|
|
104
|
-
}),
|
|
104
|
+
}), i;
|
|
105
105
|
})(), (() => {
|
|
106
|
-
var
|
|
107
|
-
return
|
|
106
|
+
var i = ae(), o = i.firstChild;
|
|
107
|
+
return n(i, c($, {
|
|
108
108
|
get when() {
|
|
109
109
|
return e.brand;
|
|
110
110
|
},
|
|
111
111
|
get children() {
|
|
112
|
-
var
|
|
113
|
-
return
|
|
112
|
+
var r = le();
|
|
113
|
+
return n(r, () => e.brand), r;
|
|
114
114
|
}
|
|
115
|
-
}),
|
|
115
|
+
}), o), n(o, () => e.title), n(i, c($, {
|
|
116
116
|
get when() {
|
|
117
117
|
return e.category;
|
|
118
118
|
},
|
|
119
119
|
get children() {
|
|
120
|
-
var
|
|
121
|
-
return
|
|
120
|
+
var r = re();
|
|
121
|
+
return n(r, () => e.category), r;
|
|
122
122
|
}
|
|
123
|
-
}), null),
|
|
123
|
+
}), null), n(i, c($, {
|
|
124
124
|
get when() {
|
|
125
125
|
return e.rating !== void 0;
|
|
126
126
|
},
|
|
127
127
|
get children() {
|
|
128
|
-
return
|
|
128
|
+
return c(G, {
|
|
129
129
|
get value() {
|
|
130
130
|
return e.rating;
|
|
131
131
|
},
|
|
@@ -133,7 +133,7 @@ function de(e) {
|
|
|
133
133
|
max: 5
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
}), null),
|
|
136
|
+
}), null), n(i, c(L, {
|
|
137
137
|
get amount() {
|
|
138
138
|
return e.price;
|
|
139
139
|
},
|
|
@@ -146,55 +146,55 @@ function de(e) {
|
|
|
146
146
|
get locale() {
|
|
147
147
|
return e.locale;
|
|
148
148
|
}
|
|
149
|
-
}), null),
|
|
149
|
+
}), null), n(i, c($, {
|
|
150
150
|
get when() {
|
|
151
151
|
return e.onAddToCart;
|
|
152
152
|
},
|
|
153
153
|
get children() {
|
|
154
|
-
return
|
|
154
|
+
return c(M, {
|
|
155
155
|
class: "mt-auto w-full",
|
|
156
|
-
onClick: (
|
|
157
|
-
var
|
|
158
|
-
|
|
156
|
+
onClick: (r) => {
|
|
157
|
+
var s;
|
|
158
|
+
r.stopPropagation(), (s = e.onAddToCart) == null || s.call(e);
|
|
159
159
|
},
|
|
160
160
|
children: "Add to cart"
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
}), null),
|
|
163
|
+
}), null), i;
|
|
164
164
|
})()];
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
var
|
|
169
|
-
function
|
|
168
|
+
var ce = /* @__PURE__ */ v("<div>");
|
|
169
|
+
function Le(e) {
|
|
170
170
|
return (() => {
|
|
171
|
-
var
|
|
172
|
-
return
|
|
171
|
+
var i = ce();
|
|
172
|
+
return n(i, () => e.children), b(() => C(i, _("grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4", e.class))), i;
|
|
173
173
|
})();
|
|
174
174
|
}
|
|
175
|
-
var
|
|
176
|
-
function
|
|
177
|
-
const
|
|
175
|
+
var de = /* @__PURE__ */ v('<img class="h-16 w-16 shrink-0 rounded-md bg-muted object-cover">'), oe = /* @__PURE__ */ v('<button type=button aria-label="Remove item"class="text-muted-foreground hover:text-foreground">'), se = /* @__PURE__ */ v('<div><div class="min-w-[8rem] flex-1"><p class="line-clamp-1 font-medium text-foreground"></p></div><span class="min-w-[4rem] text-right font-medium tabular-nums text-foreground">');
|
|
176
|
+
function Oe(e) {
|
|
177
|
+
const i = () => e.price * e.quantity, o = (r) => new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
178
178
|
style: "currency",
|
|
179
179
|
currency: e.currency ?? "USD"
|
|
180
|
-
}).format(
|
|
180
|
+
}).format(r);
|
|
181
181
|
return (() => {
|
|
182
|
-
var
|
|
183
|
-
return
|
|
182
|
+
var r = se(), s = r.firstChild, d = s.firstChild, a = s.nextSibling;
|
|
183
|
+
return n(r, c($, {
|
|
184
184
|
get when() {
|
|
185
185
|
return e.image;
|
|
186
186
|
},
|
|
187
187
|
get children() {
|
|
188
|
-
var
|
|
189
|
-
return b((
|
|
190
|
-
var f = e.image,
|
|
191
|
-
return f !==
|
|
188
|
+
var t = de();
|
|
189
|
+
return b((u) => {
|
|
190
|
+
var f = e.image, l = e.title;
|
|
191
|
+
return f !== u.e && w(t, "src", u.e = f), l !== u.t && w(t, "alt", u.t = l), u;
|
|
192
192
|
}, {
|
|
193
193
|
e: void 0,
|
|
194
194
|
t: void 0
|
|
195
|
-
}),
|
|
195
|
+
}), t;
|
|
196
196
|
}
|
|
197
|
-
}),
|
|
197
|
+
}), s), n(d, () => e.title), n(s, c(L, {
|
|
198
198
|
get amount() {
|
|
199
199
|
return e.price;
|
|
200
200
|
},
|
|
@@ -205,129 +205,444 @@ function se(e) {
|
|
|
205
205
|
return e.locale;
|
|
206
206
|
},
|
|
207
207
|
size: "sm"
|
|
208
|
-
}), null),
|
|
208
|
+
}), null), n(r, c(ee, {
|
|
209
209
|
get value() {
|
|
210
210
|
return e.quantity;
|
|
211
211
|
},
|
|
212
|
-
onChange: (
|
|
213
|
-
var
|
|
214
|
-
return (
|
|
212
|
+
onChange: (t) => {
|
|
213
|
+
var u;
|
|
214
|
+
return (u = e.onQuantityChange) == null ? void 0 : u.call(e, t);
|
|
215
215
|
},
|
|
216
216
|
min: 1
|
|
217
|
-
}),
|
|
217
|
+
}), a), n(a, () => o(i())), n(r, c($, {
|
|
218
218
|
get when() {
|
|
219
219
|
return e.onRemove;
|
|
220
220
|
},
|
|
221
221
|
get children() {
|
|
222
|
-
var
|
|
223
|
-
return
|
|
224
|
-
var
|
|
225
|
-
return (
|
|
226
|
-
},
|
|
222
|
+
var t = oe();
|
|
223
|
+
return t.$$click = () => {
|
|
224
|
+
var u;
|
|
225
|
+
return (u = e.onRemove) == null ? void 0 : u.call(e);
|
|
226
|
+
}, n(t, c(X, {
|
|
227
227
|
class: "h-4 w-4"
|
|
228
|
-
})),
|
|
228
|
+
})), t;
|
|
229
229
|
}
|
|
230
|
-
}), null), b(() =>
|
|
230
|
+
}), null), b(() => C(r, _("flex flex-wrap items-center gap-4", e.class))), r;
|
|
231
231
|
})();
|
|
232
232
|
}
|
|
233
|
-
|
|
234
|
-
var
|
|
235
|
-
function
|
|
236
|
-
const
|
|
233
|
+
A(["click"]);
|
|
234
|
+
var me = /* @__PURE__ */ v('<div><div class="my-3 border-t border-border"></div><div class="flex items-center justify-between text-base font-bold text-foreground"><span>Total</span><span class=tabular-nums>'), ge = /* @__PURE__ */ v('<div class="flex items-center justify-between py-1 text-sm"><span class=text-muted-foreground></span><span class="tabular-nums text-foreground">');
|
|
235
|
+
function Ge(e) {
|
|
236
|
+
const i = (o) => new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
237
237
|
style: "currency",
|
|
238
238
|
currency: e.currency ?? "USD"
|
|
239
|
-
}).format(
|
|
239
|
+
}).format(o);
|
|
240
240
|
return (() => {
|
|
241
|
-
var
|
|
242
|
-
return
|
|
241
|
+
var o = me(), r = o.firstChild, s = r.nextSibling, d = s.firstChild, a = d.nextSibling;
|
|
242
|
+
return n(o, c(S, {
|
|
243
243
|
get each() {
|
|
244
244
|
return e.lines;
|
|
245
245
|
},
|
|
246
|
-
children: (
|
|
247
|
-
var
|
|
248
|
-
return
|
|
246
|
+
children: (t) => (() => {
|
|
247
|
+
var u = ge(), f = u.firstChild, l = f.nextSibling;
|
|
248
|
+
return n(f, () => t.label), n(l, () => i(t.amount)), u;
|
|
249
249
|
})()
|
|
250
|
-
}),
|
|
250
|
+
}), r), n(a, () => i(e.total)), n(o, c($, {
|
|
251
251
|
get when() {
|
|
252
252
|
return e.onCheckout;
|
|
253
253
|
},
|
|
254
254
|
get children() {
|
|
255
|
-
return
|
|
255
|
+
return c(M, {
|
|
256
256
|
class: "mt-4 w-full",
|
|
257
257
|
onClick: () => {
|
|
258
|
-
var
|
|
259
|
-
return (
|
|
258
|
+
var t;
|
|
259
|
+
return (t = e.onCheckout) == null ? void 0 : t.call(e);
|
|
260
260
|
},
|
|
261
261
|
get children() {
|
|
262
262
|
return e.checkoutLabel ?? "Checkout";
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
|
-
}), null), b(() =>
|
|
266
|
+
}), null), b(() => C(o, _("card glow-edge rounded-xl p-5 text-card-foreground", e.class))), o;
|
|
267
267
|
})();
|
|
268
268
|
}
|
|
269
|
-
var
|
|
270
|
-
function
|
|
271
|
-
const
|
|
272
|
-
const
|
|
273
|
-
|
|
269
|
+
var fe = /* @__PURE__ */ v('<div><p class="text-sm font-semibold text-foreground"></p><div class=space-y-1.5>'), ve = /* @__PURE__ */ v('<span class="text-xs text-muted-foreground">'), he = /* @__PURE__ */ v('<div class="flex items-center justify-between gap-2">');
|
|
270
|
+
function q(e) {
|
|
271
|
+
const i = (o, r) => {
|
|
272
|
+
const s = e.selected.slice(), d = s.indexOf(o);
|
|
273
|
+
r ? d === -1 && s.push(o) : d !== -1 && s.splice(d, 1), e.onChange(s);
|
|
274
274
|
};
|
|
275
275
|
return (() => {
|
|
276
|
-
var
|
|
277
|
-
return
|
|
276
|
+
var o = fe(), r = o.firstChild, s = r.nextSibling;
|
|
277
|
+
return n(r, () => e.title), n(s, c(S, {
|
|
278
278
|
get each() {
|
|
279
279
|
return e.options;
|
|
280
280
|
},
|
|
281
|
-
children: (
|
|
282
|
-
var
|
|
283
|
-
return
|
|
281
|
+
children: (d) => (() => {
|
|
282
|
+
var a = he();
|
|
283
|
+
return n(a, c(z, {
|
|
284
284
|
get checked() {
|
|
285
|
-
return e.selected.includes(
|
|
285
|
+
return e.selected.includes(d.value);
|
|
286
286
|
},
|
|
287
|
-
onChange: (
|
|
287
|
+
onChange: (t) => i(d.value, t),
|
|
288
288
|
get label() {
|
|
289
|
-
return
|
|
289
|
+
return d.label;
|
|
290
290
|
}
|
|
291
|
-
}), null),
|
|
291
|
+
}), null), n(a, c($, {
|
|
292
292
|
get when() {
|
|
293
|
-
return
|
|
293
|
+
return d.count != null;
|
|
294
294
|
},
|
|
295
295
|
get children() {
|
|
296
|
-
var
|
|
297
|
-
return
|
|
296
|
+
var t = ve();
|
|
297
|
+
return n(t, () => d.count), t;
|
|
298
|
+
}
|
|
299
|
+
}), null), a;
|
|
300
|
+
})()
|
|
301
|
+
})), b(() => C(o, _("space-y-2", e.class))), o;
|
|
302
|
+
})();
|
|
303
|
+
}
|
|
304
|
+
var xe = /* @__PURE__ */ v('<div class=space-y-2><p class="text-sm font-semibold text-foreground">'), $e = /* @__PURE__ */ v('<p class="text-sm text-muted-foreground"> results'), be = /* @__PURE__ */ v('<div class="flex flex-wrap gap-2">'), _e = /* @__PURE__ */ v('<div><div class="flex items-center justify-between gap-2">'), Ce = /* @__PURE__ */ v('<span class="inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs"><button type=button class="text-muted-foreground hover:text-foreground">'), we = /* @__PURE__ */ v('<div class=space-y-2><div class="flex items-center justify-between"><p class="text-sm font-semibold text-foreground">Price</p><p class="text-xs text-muted-foreground">$<!> – $</p></div><div class="flex items-center gap-2"><span class="text-sm text-muted-foreground">–');
|
|
305
|
+
function ye(e) {
|
|
306
|
+
const [i, o] = B(e.section.defaultOpen ?? !0);
|
|
307
|
+
return c($, {
|
|
308
|
+
get when() {
|
|
309
|
+
return e.section.collapsible ?? !0;
|
|
310
|
+
},
|
|
311
|
+
get fallback() {
|
|
312
|
+
return (() => {
|
|
313
|
+
var r = xe(), s = r.firstChild;
|
|
314
|
+
return n(s, () => e.section.title), n(r, c(q, {
|
|
315
|
+
title: "",
|
|
316
|
+
get options() {
|
|
317
|
+
return e.section.options;
|
|
318
|
+
},
|
|
319
|
+
get selected() {
|
|
320
|
+
return e.selected;
|
|
321
|
+
},
|
|
322
|
+
get onChange() {
|
|
323
|
+
return e.onChange;
|
|
324
|
+
}
|
|
325
|
+
}), null), r;
|
|
326
|
+
})();
|
|
327
|
+
},
|
|
328
|
+
get children() {
|
|
329
|
+
return c(K, {
|
|
330
|
+
get open() {
|
|
331
|
+
return i();
|
|
332
|
+
},
|
|
333
|
+
onOpenChange: o,
|
|
334
|
+
get title() {
|
|
335
|
+
return e.section.title;
|
|
336
|
+
},
|
|
337
|
+
get children() {
|
|
338
|
+
return c(q, {
|
|
339
|
+
title: "",
|
|
340
|
+
get options() {
|
|
341
|
+
return e.section.options;
|
|
342
|
+
},
|
|
343
|
+
get selected() {
|
|
344
|
+
return e.selected;
|
|
345
|
+
},
|
|
346
|
+
get onChange() {
|
|
347
|
+
return e.onChange;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
function ze(e) {
|
|
356
|
+
const i = () => {
|
|
357
|
+
const d = [];
|
|
358
|
+
for (const a of e.sections) {
|
|
359
|
+
const t = e.selected[a.key] ?? [];
|
|
360
|
+
for (const u of t) {
|
|
361
|
+
const f = a.options.find((l) => l.value === u);
|
|
362
|
+
d.push({
|
|
363
|
+
sectionKey: a.key,
|
|
364
|
+
value: u,
|
|
365
|
+
label: (f == null ? void 0 : f.label) ?? u
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return d;
|
|
370
|
+
}, o = (d) => {
|
|
371
|
+
const a = e.selected[d.sectionKey] ?? [];
|
|
372
|
+
e.onChange(d.sectionKey, a.filter((t) => t !== d.value));
|
|
373
|
+
}, r = (d) => {
|
|
374
|
+
if (!e.price || !e.onPriceChange) return;
|
|
375
|
+
const a = Math.min(d, e.price.value[1]);
|
|
376
|
+
e.onPriceChange([a, e.price.value[1]]);
|
|
377
|
+
}, s = (d) => {
|
|
378
|
+
if (!e.price || !e.onPriceChange) return;
|
|
379
|
+
const a = Math.max(d, e.price.value[0]);
|
|
380
|
+
e.onPriceChange([e.price.value[0], a]);
|
|
381
|
+
};
|
|
382
|
+
return (() => {
|
|
383
|
+
var d = _e(), a = d.firstChild;
|
|
384
|
+
return n(a, c($, {
|
|
385
|
+
get when() {
|
|
386
|
+
return e.resultCount != null;
|
|
387
|
+
},
|
|
388
|
+
get children() {
|
|
389
|
+
var t = $e(), u = t.firstChild;
|
|
390
|
+
return n(t, () => e.resultCount, u), t;
|
|
391
|
+
}
|
|
392
|
+
}), null), n(a, c($, {
|
|
393
|
+
get when() {
|
|
394
|
+
return e.onClearAll;
|
|
395
|
+
},
|
|
396
|
+
get children() {
|
|
397
|
+
return c(M, {
|
|
398
|
+
variant: "ghost",
|
|
399
|
+
class: "ml-auto h-auto px-2 py-1 text-xs",
|
|
400
|
+
onClick: () => {
|
|
401
|
+
var t;
|
|
402
|
+
return (t = e.onClearAll) == null ? void 0 : t.call(e);
|
|
403
|
+
},
|
|
404
|
+
children: "Clear all"
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}), null), n(d, c($, {
|
|
408
|
+
get when() {
|
|
409
|
+
return i().length > 0;
|
|
410
|
+
},
|
|
411
|
+
get children() {
|
|
412
|
+
var t = be();
|
|
413
|
+
return n(t, c(S, {
|
|
414
|
+
get each() {
|
|
415
|
+
return i();
|
|
416
|
+
},
|
|
417
|
+
children: (u) => (() => {
|
|
418
|
+
var f = Ce(), l = f.firstChild;
|
|
419
|
+
return n(f, () => u.label, l), l.$$click = () => o(u), n(l, c(Z, {
|
|
420
|
+
class: "h-3 w-3"
|
|
421
|
+
})), b(() => w(l, "aria-label", `Remove ${u.label}`)), f;
|
|
422
|
+
})()
|
|
423
|
+
})), t;
|
|
424
|
+
}
|
|
425
|
+
}), null), n(d, c($, {
|
|
426
|
+
get when() {
|
|
427
|
+
return e.price;
|
|
428
|
+
},
|
|
429
|
+
children: (t) => (() => {
|
|
430
|
+
var u = we(), f = u.firstChild, l = f.firstChild, g = l.nextSibling, h = g.firstChild, m = h.nextSibling;
|
|
431
|
+
m.nextSibling;
|
|
432
|
+
var x = f.nextSibling, y = x.firstChild;
|
|
433
|
+
return n(g, () => t().value[0], m), n(g, () => t().value[1], null), n(x, c(U, {
|
|
434
|
+
get value() {
|
|
435
|
+
return t().value[0];
|
|
436
|
+
},
|
|
437
|
+
onChange: r,
|
|
438
|
+
get min() {
|
|
439
|
+
return t().min;
|
|
440
|
+
},
|
|
441
|
+
get max() {
|
|
442
|
+
return t().value[1];
|
|
443
|
+
}
|
|
444
|
+
}), y), n(x, c(U, {
|
|
445
|
+
get value() {
|
|
446
|
+
return t().value[1];
|
|
447
|
+
},
|
|
448
|
+
onChange: s,
|
|
449
|
+
get min() {
|
|
450
|
+
return t().value[0];
|
|
451
|
+
},
|
|
452
|
+
get max() {
|
|
453
|
+
return t().max;
|
|
298
454
|
}
|
|
299
455
|
}), null), u;
|
|
300
456
|
})()
|
|
301
|
-
})
|
|
457
|
+
}), null), n(d, c(S, {
|
|
458
|
+
get each() {
|
|
459
|
+
return e.sections;
|
|
460
|
+
},
|
|
461
|
+
children: (t) => c(ye, {
|
|
462
|
+
section: t,
|
|
463
|
+
get selected() {
|
|
464
|
+
return e.selected[t.key] ?? [];
|
|
465
|
+
},
|
|
466
|
+
onChange: (u) => e.onChange(t.key, u)
|
|
467
|
+
})
|
|
468
|
+
}), null), b(() => C(d, _("space-y-5", e.class))), d;
|
|
469
|
+
})();
|
|
470
|
+
}
|
|
471
|
+
A(["click"]);
|
|
472
|
+
var Se = /* @__PURE__ */ v('<span class="text-muted-foreground line-through">'), ke = /* @__PURE__ */ v('<span class="inline-flex items-center gap-1 text-sm text-muted-foreground">As low as <!>/mo'), Ae = /* @__PURE__ */ v('<div><div class="flex flex-wrap items-center gap-2"><span>'), Me = /* @__PURE__ */ v('<span class="text-sm text-muted-foreground"> after code '), Pe = /* @__PURE__ */ v('<div class="flex flex-wrap items-center gap-2"><span class="inline-flex items-center gap-1 rounded-md border border-dashed border-primary/50 px-2 py-0.5 text-xs font-mono text-primary"> ');
|
|
473
|
+
const Te = {
|
|
474
|
+
md: "text-xl",
|
|
475
|
+
lg: "text-3xl"
|
|
476
|
+
};
|
|
477
|
+
function Ke(e) {
|
|
478
|
+
const i = (t) => new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
479
|
+
style: "currency",
|
|
480
|
+
currency: e.currency ?? "USD"
|
|
481
|
+
}).format(t), o = () => (e.compareAt ?? 0) > e.amount, r = () => e.compareAt - e.amount, s = () => Math.round((1 - e.amount / e.compareAt) * 100), d = () => {
|
|
482
|
+
var u;
|
|
483
|
+
const t = ((u = e.coupon) == null ? void 0 : u.amount) ?? 0;
|
|
484
|
+
return Math.max(0, e.amount - t);
|
|
485
|
+
}, a = () => {
|
|
486
|
+
const t = e.financing, u = t.apr ?? 0;
|
|
487
|
+
if (u > 0) {
|
|
488
|
+
const f = u / 12, l = t.months, g = e.amount * f / (1 - (1 + f) ** -l);
|
|
489
|
+
return Math.round(g * 100) / 100;
|
|
490
|
+
}
|
|
491
|
+
return Math.round(e.amount / t.months * 100) / 100;
|
|
492
|
+
};
|
|
493
|
+
return (() => {
|
|
494
|
+
var t = Ae(), u = t.firstChild, f = u.firstChild;
|
|
495
|
+
return n(f, () => i(e.amount)), n(u, c($, {
|
|
496
|
+
get when() {
|
|
497
|
+
return o();
|
|
498
|
+
},
|
|
499
|
+
get children() {
|
|
500
|
+
return [(() => {
|
|
501
|
+
var l = Se();
|
|
502
|
+
return n(l, () => i(e.compareAt)), l;
|
|
503
|
+
})(), c(D, {
|
|
504
|
+
tone: "danger",
|
|
505
|
+
get children() {
|
|
506
|
+
return ["Save ", k(() => i(r())), " (-", k(() => s()), "%)"];
|
|
507
|
+
}
|
|
508
|
+
})];
|
|
509
|
+
}
|
|
510
|
+
}), null), n(t, c($, {
|
|
511
|
+
get when() {
|
|
512
|
+
return e.coupon;
|
|
513
|
+
},
|
|
514
|
+
children: (l) => (() => {
|
|
515
|
+
var g = Pe(), h = g.firstChild, m = h.firstChild;
|
|
516
|
+
return n(h, () => l().label ?? "Coupon", m), n(h, () => l().code, null), n(g, c($, {
|
|
517
|
+
get when() {
|
|
518
|
+
return l().amount !== void 0;
|
|
519
|
+
},
|
|
520
|
+
get children() {
|
|
521
|
+
var x = Me(), y = x.firstChild;
|
|
522
|
+
return n(x, () => i(d()), y), n(x, () => l().code, null), x;
|
|
523
|
+
}
|
|
524
|
+
}), null), g;
|
|
525
|
+
})()
|
|
526
|
+
}), null), n(t, c($, {
|
|
527
|
+
get when() {
|
|
528
|
+
return e.financing;
|
|
529
|
+
},
|
|
530
|
+
get children() {
|
|
531
|
+
var l = ke(), g = l.firstChild, h = g.nextSibling;
|
|
532
|
+
return h.nextSibling, n(l, c(H, {
|
|
533
|
+
class: "h-4 w-4"
|
|
534
|
+
}), g), n(l, () => i(a()), h), l;
|
|
535
|
+
}
|
|
536
|
+
}), null), n(t, c($, {
|
|
537
|
+
get when() {
|
|
538
|
+
return e.note;
|
|
539
|
+
},
|
|
540
|
+
get children() {
|
|
541
|
+
return e.note;
|
|
542
|
+
}
|
|
543
|
+
}), null), b((l) => {
|
|
544
|
+
var g = _("flex flex-col gap-1", e.class), h = _("font-bold text-foreground", Te[e.size ?? "lg"]);
|
|
545
|
+
return g !== l.e && C(t, l.e = g), h !== l.t && C(f, l.t = h), l;
|
|
546
|
+
}, {
|
|
547
|
+
e: void 0,
|
|
548
|
+
t: void 0
|
|
549
|
+
}), t;
|
|
550
|
+
})();
|
|
551
|
+
}
|
|
552
|
+
var Ee = /* @__PURE__ */ v('<span class="text-sm text-muted-foreground"> / '), Ie = /* @__PURE__ */ v('<div><div class="flex items-end justify-between gap-2"><span class="font-semibold text-foreground"></span></div><div class="relative mt-2 h-2 w-full rounded-full bg-muted"role=meter><div class="absolute h-2 rounded-full bg-gradient-to-r from-primary/40 to-primary"></div><div class="absolute -top-1 h-4 w-4 -translate-x-1/2 rounded-full border-2 border-background bg-primary shadow"></div></div><div class="flex items-center justify-between text-xs text-muted-foreground">'), Ne = /* @__PURE__ */ v("<span>");
|
|
553
|
+
const Fe = [{
|
|
554
|
+
min: 10,
|
|
555
|
+
label: "Brand New"
|
|
556
|
+
}, {
|
|
557
|
+
min: 9,
|
|
558
|
+
label: "Excellent"
|
|
559
|
+
}, {
|
|
560
|
+
min: 7,
|
|
561
|
+
label: "Very Good"
|
|
562
|
+
}, {
|
|
563
|
+
min: 5,
|
|
564
|
+
label: "Good"
|
|
565
|
+
}, {
|
|
566
|
+
min: 1,
|
|
567
|
+
label: "Fair"
|
|
568
|
+
}];
|
|
569
|
+
function Qe(e) {
|
|
570
|
+
const i = () => e.min ?? 1, o = () => e.max ?? 10, r = () => (e.tiers ?? Fe).slice().sort((a, t) => a.min - t.min), s = () => {
|
|
571
|
+
const a = o() - i();
|
|
572
|
+
return a <= 0 ? 0 : Math.max(0, Math.min(100, (e.value - i()) / a * 100));
|
|
573
|
+
}, d = () => {
|
|
574
|
+
const a = r();
|
|
575
|
+
let t = a[0];
|
|
576
|
+
for (const u of a)
|
|
577
|
+
u.min <= e.value && (t = u);
|
|
578
|
+
return t;
|
|
579
|
+
};
|
|
580
|
+
return (() => {
|
|
581
|
+
var a = Ie(), t = a.firstChild, u = t.firstChild, f = t.nextSibling, l = f.firstChild, g = l.nextSibling, h = f.nextSibling;
|
|
582
|
+
return n(u, () => {
|
|
583
|
+
var m;
|
|
584
|
+
return (m = d()) == null ? void 0 : m.label;
|
|
585
|
+
}), n(t, c($, {
|
|
586
|
+
get when() {
|
|
587
|
+
return e.showValue ?? !0;
|
|
588
|
+
},
|
|
589
|
+
get children() {
|
|
590
|
+
var m = Ee(), x = m.firstChild;
|
|
591
|
+
return n(m, () => e.value, x), n(m, o, null), m;
|
|
592
|
+
}
|
|
593
|
+
}), null), n(h, c(S, {
|
|
594
|
+
get each() {
|
|
595
|
+
return [r()[0], r()[r().length - 1]];
|
|
596
|
+
},
|
|
597
|
+
children: (m) => (() => {
|
|
598
|
+
var x = Ne();
|
|
599
|
+
return n(x, () => m == null ? void 0 : m.label), x;
|
|
600
|
+
})()
|
|
601
|
+
})), b((m) => {
|
|
602
|
+
var F;
|
|
603
|
+
var x = _("flex flex-col gap-2", e.class), y = i(), P = o(), T = e.value, E = ((F = d()) == null ? void 0 : F.label) ?? "Condition", I = `${s()}%`, N = `${s()}%`;
|
|
604
|
+
return x !== m.e && C(a, m.e = x), y !== m.t && w(f, "aria-valuemin", m.t = y), P !== m.a && w(f, "aria-valuemax", m.a = P), T !== m.o && w(f, "aria-valuenow", m.o = T), E !== m.i && w(f, "aria-label", m.i = E), I !== m.n && j(l, "width", m.n = I), N !== m.s && j(g, "left", m.s = N), m;
|
|
605
|
+
}, {
|
|
606
|
+
e: void 0,
|
|
607
|
+
t: void 0,
|
|
608
|
+
a: void 0,
|
|
609
|
+
o: void 0,
|
|
610
|
+
i: void 0,
|
|
611
|
+
n: void 0,
|
|
612
|
+
s: void 0
|
|
613
|
+
}), a;
|
|
302
614
|
})();
|
|
303
615
|
}
|
|
304
|
-
function
|
|
305
|
-
const [
|
|
306
|
-
|
|
307
|
-
(
|
|
308
|
-
) : [...
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
},
|
|
312
|
-
if (
|
|
313
|
-
|
|
616
|
+
function Ve(e = []) {
|
|
617
|
+
const [i, o] = B(e), r = (l, g = 1) => {
|
|
618
|
+
o((h) => h.find((x) => x.product.id === l.id) ? h.map(
|
|
619
|
+
(x) => x.product.id === l.id ? { ...x, qty: x.qty + g } : x
|
|
620
|
+
) : [...h, { product: l, qty: g }]);
|
|
621
|
+
}, s = (l) => {
|
|
622
|
+
o((g) => g.filter((h) => h.product.id !== l));
|
|
623
|
+
}, d = (l, g) => {
|
|
624
|
+
if (g <= 0) {
|
|
625
|
+
s(l);
|
|
314
626
|
return;
|
|
315
627
|
}
|
|
316
|
-
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
() =>
|
|
628
|
+
o((h) => h.map((m) => m.product.id === l ? { ...m, qty: g } : m));
|
|
629
|
+
}, a = () => {
|
|
630
|
+
o([]);
|
|
631
|
+
}, t = R(() => i().reduce((l, g) => l + g.qty, 0)), u = R(
|
|
632
|
+
() => i().reduce((l, g) => l + g.product.price * g.qty, 0)
|
|
321
633
|
);
|
|
322
|
-
return { items:
|
|
634
|
+
return { items: i, add: r, remove: s, setQty: d, clear: a, count: t, subtotal: u, has: (l) => i().some((g) => g.product.id === l) };
|
|
323
635
|
}
|
|
324
636
|
export {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
637
|
+
Oe as CartLine,
|
|
638
|
+
Ge as CartSummary,
|
|
639
|
+
Qe as ConditionScale,
|
|
640
|
+
ze as FacetSidebar,
|
|
641
|
+
q as FilterGroup,
|
|
642
|
+
Ke as PriceBlock,
|
|
643
|
+
L as PriceTag,
|
|
644
|
+
De as ProductCard,
|
|
645
|
+
Le as ProductGrid,
|
|
646
|
+
ee as QuantityStepper,
|
|
647
|
+
Ve as createCart
|
|
333
648
|
};
|