@a4ui/core 0.8.0 → 0.9.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.
@@ -0,0 +1,281 @@
1
+ import { insert as n, createComponent as u, memo as T, effect as f, className as b, template as s, delegateEvents as C, setAttribute as $ } from "solid-js/web";
2
+ import { Show as v, For as w } from "solid-js";
3
+ import { B as S, c as h, C as E, R as F, a as k, b as I } from "./Checkbox-CC3EGilW.js";
4
+ import { Minus as N, Plus as R, Trash2 as U } from "lucide-solid";
5
+ var j = /* @__PURE__ */ s('<span class="text-muted-foreground line-through">'), q = /* @__PURE__ */ s("<div><span>");
6
+ const M = {
7
+ sm: "text-sm",
8
+ md: "text-lg",
9
+ lg: "text-2xl"
10
+ };
11
+ function A(e) {
12
+ const r = (c) => new Intl.NumberFormat(e.locale ?? "en-US", {
13
+ style: "currency",
14
+ currency: e.currency ?? "USD"
15
+ }).format(c), a = () => (e.compareAt ?? 0) > e.amount, t = () => Math.round((1 - e.amount / e.compareAt) * 100);
16
+ return (() => {
17
+ var c = q(), d = c.firstChild;
18
+ return n(d, () => r(e.amount)), n(c, u(v, {
19
+ get when() {
20
+ return a();
21
+ },
22
+ get children() {
23
+ return [(() => {
24
+ var i = j();
25
+ return n(i, () => r(e.compareAt)), i;
26
+ })(), u(S, {
27
+ tone: "danger",
28
+ get children() {
29
+ return ["-", T(() => t()), "%"];
30
+ }
31
+ })];
32
+ }
33
+ }), null), f((i) => {
34
+ var l = h("inline-flex items-center gap-2", e.class), m = h("font-bold text-foreground", M[e.size ?? "md"]);
35
+ return l !== i.e && b(c, i.e = l), m !== i.t && b(d, i.t = m), i;
36
+ }, {
37
+ e: void 0,
38
+ t: void 0
39
+ }), c;
40
+ })();
41
+ }
42
+ var P = /* @__PURE__ */ s('<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">');
43
+ function D(e) {
44
+ const r = () => e.min ?? 0, a = () => e.max ?? Number.MAX_SAFE_INTEGER, t = (i) => Math.min(a(), Math.max(r(), i)), c = () => e.onChange(t(e.value - 1)), d = () => e.onChange(t(e.value + 1));
45
+ return (() => {
46
+ var i = P(), l = i.firstChild, m = l.nextSibling, g = m.nextSibling;
47
+ return l.$$click = c, n(l, u(N, {
48
+ class: "h-4 w-4"
49
+ })), n(m, () => e.value), g.$$click = d, n(g, u(R, {
50
+ class: "h-4 w-4"
51
+ })), f((o) => {
52
+ var x = h("inline-flex items-stretch rounded-md border border-input", e.class), _ = e.disabled || e.value <= r(), y = e.disabled || e.value >= a();
53
+ return x !== o.e && b(i, o.e = x), _ !== o.t && (l.disabled = o.t = _), y !== o.a && (g.disabled = o.a = y), o;
54
+ }, {
55
+ e: void 0,
56
+ t: void 0,
57
+ a: void 0
58
+ }), i;
59
+ })();
60
+ }
61
+ C(["click"]);
62
+ var z = /* @__PURE__ */ s('<div class="relative aspect-square overflow-hidden rounded-lg bg-muted"><img loading=lazy class="h-full w-full object-cover">', !0, !1, !1), B = /* @__PURE__ */ s('<div class="mt-3 space-y-2"><p class="line-clamp-1 font-medium text-foreground">');
63
+ function ee(e) {
64
+ return u(E, {
65
+ get class() {
66
+ return h("overflow-hidden p-4", e.class);
67
+ },
68
+ get children() {
69
+ return [(() => {
70
+ var r = z(), a = r.firstChild;
71
+ return n(r, u(v, {
72
+ get when() {
73
+ return e.badge;
74
+ },
75
+ get children() {
76
+ return u(S, {
77
+ class: "absolute left-2 top-2",
78
+ get children() {
79
+ return e.badge;
80
+ }
81
+ });
82
+ }
83
+ }), null), f((t) => {
84
+ var c = e.image, d = e.title;
85
+ return c !== t.e && $(a, "src", t.e = c), d !== t.t && $(a, "alt", t.t = d), t;
86
+ }, {
87
+ e: void 0,
88
+ t: void 0
89
+ }), r;
90
+ })(), (() => {
91
+ var r = B(), a = r.firstChild;
92
+ return n(a, () => e.title), n(r, u(v, {
93
+ get when() {
94
+ return e.rating !== void 0;
95
+ },
96
+ get children() {
97
+ return u(F, {
98
+ get value() {
99
+ return e.rating;
100
+ },
101
+ readonly: !0,
102
+ max: 5
103
+ });
104
+ }
105
+ }), null), n(r, u(A, {
106
+ get amount() {
107
+ return e.price;
108
+ },
109
+ get compareAt() {
110
+ return e.compareAt;
111
+ },
112
+ get currency() {
113
+ return e.currency;
114
+ },
115
+ get locale() {
116
+ return e.locale;
117
+ }
118
+ }), null), n(r, u(v, {
119
+ get when() {
120
+ return e.onAddToCart;
121
+ },
122
+ get children() {
123
+ return u(k, {
124
+ class: "w-full",
125
+ onClick: () => {
126
+ var t;
127
+ return (t = e.onAddToCart) == null ? void 0 : t.call(e);
128
+ },
129
+ children: "Add to cart"
130
+ });
131
+ }
132
+ }), null), r;
133
+ })()];
134
+ }
135
+ });
136
+ }
137
+ var G = /* @__PURE__ */ s("<div>");
138
+ function te(e) {
139
+ return (() => {
140
+ var r = G();
141
+ return n(r, () => e.children), f(() => b(r, h("grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4", e.class))), r;
142
+ })();
143
+ }
144
+ var L = /* @__PURE__ */ s('<img class="h-16 w-16 shrink-0 rounded-md bg-muted object-cover">'), Q = /* @__PURE__ */ s('<button type=button aria-label="Remove item"class="text-muted-foreground hover:text-foreground">'), O = /* @__PURE__ */ s('<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">');
145
+ function ne(e) {
146
+ const r = () => e.price * e.quantity, a = (t) => new Intl.NumberFormat(e.locale ?? "en-US", {
147
+ style: "currency",
148
+ currency: e.currency ?? "USD"
149
+ }).format(t);
150
+ return (() => {
151
+ var t = O(), c = t.firstChild, d = c.firstChild, i = c.nextSibling;
152
+ return n(t, u(v, {
153
+ get when() {
154
+ return e.image;
155
+ },
156
+ get children() {
157
+ var l = L();
158
+ return f((m) => {
159
+ var g = e.image, o = e.title;
160
+ return g !== m.e && $(l, "src", m.e = g), o !== m.t && $(l, "alt", m.t = o), m;
161
+ }, {
162
+ e: void 0,
163
+ t: void 0
164
+ }), l;
165
+ }
166
+ }), c), n(d, () => e.title), n(c, u(A, {
167
+ get amount() {
168
+ return e.price;
169
+ },
170
+ get currency() {
171
+ return e.currency;
172
+ },
173
+ get locale() {
174
+ return e.locale;
175
+ },
176
+ size: "sm"
177
+ }), null), n(t, u(D, {
178
+ get value() {
179
+ return e.quantity;
180
+ },
181
+ onChange: (l) => {
182
+ var m;
183
+ return (m = e.onQuantityChange) == null ? void 0 : m.call(e, l);
184
+ },
185
+ min: 1
186
+ }), i), n(i, () => a(r())), n(t, u(v, {
187
+ get when() {
188
+ return e.onRemove;
189
+ },
190
+ get children() {
191
+ var l = Q();
192
+ return l.$$click = () => {
193
+ var m;
194
+ return (m = e.onRemove) == null ? void 0 : m.call(e);
195
+ }, n(l, u(U, {
196
+ class: "h-4 w-4"
197
+ })), l;
198
+ }
199
+ }), null), f(() => b(t, h("flex flex-wrap items-center gap-4", e.class))), t;
200
+ })();
201
+ }
202
+ C(["click"]);
203
+ var X = /* @__PURE__ */ s('<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>'), Z = /* @__PURE__ */ s('<div class="flex items-center justify-between py-1 text-sm"><span class=text-muted-foreground></span><span class="tabular-nums text-foreground">');
204
+ function le(e) {
205
+ const r = (a) => new Intl.NumberFormat(e.locale ?? "en-US", {
206
+ style: "currency",
207
+ currency: e.currency ?? "USD"
208
+ }).format(a);
209
+ return (() => {
210
+ var a = X(), t = a.firstChild, c = t.nextSibling, d = c.firstChild, i = d.nextSibling;
211
+ return n(a, u(w, {
212
+ get each() {
213
+ return e.lines;
214
+ },
215
+ children: (l) => (() => {
216
+ var m = Z(), g = m.firstChild, o = g.nextSibling;
217
+ return n(g, () => l.label), n(o, () => r(l.amount)), m;
218
+ })()
219
+ }), t), n(i, () => r(e.total)), n(a, u(v, {
220
+ get when() {
221
+ return e.onCheckout;
222
+ },
223
+ get children() {
224
+ return u(k, {
225
+ class: "mt-4 w-full",
226
+ onClick: () => {
227
+ var l;
228
+ return (l = e.onCheckout) == null ? void 0 : l.call(e);
229
+ },
230
+ get children() {
231
+ return e.checkoutLabel ?? "Checkout";
232
+ }
233
+ });
234
+ }
235
+ }), null), f(() => b(a, h("rounded-xl border border-border bg-card p-5", e.class))), a;
236
+ })();
237
+ }
238
+ var H = /* @__PURE__ */ s('<div><p class="text-sm font-semibold text-foreground"></p><div class=space-y-1.5>'), J = /* @__PURE__ */ s('<span class="text-xs text-muted-foreground">'), K = /* @__PURE__ */ s('<div class="flex items-center justify-between gap-2">');
239
+ function re(e) {
240
+ const r = (a, t) => {
241
+ const c = e.selected.slice(), d = c.indexOf(a);
242
+ t ? d === -1 && c.push(a) : d !== -1 && c.splice(d, 1), e.onChange(c);
243
+ };
244
+ return (() => {
245
+ var a = H(), t = a.firstChild, c = t.nextSibling;
246
+ return n(t, () => e.title), n(c, u(w, {
247
+ get each() {
248
+ return e.options;
249
+ },
250
+ children: (d) => (() => {
251
+ var i = K();
252
+ return n(i, u(I, {
253
+ get checked() {
254
+ return e.selected.includes(d.value);
255
+ },
256
+ onChange: (l) => r(d.value, l),
257
+ get label() {
258
+ return d.label;
259
+ }
260
+ }), null), n(i, u(v, {
261
+ get when() {
262
+ return d.count != null;
263
+ },
264
+ get children() {
265
+ var l = J();
266
+ return n(l, () => d.count), l;
267
+ }
268
+ }), null), i;
269
+ })()
270
+ })), f(() => b(a, h("space-y-2", e.class))), a;
271
+ })();
272
+ }
273
+ export {
274
+ ne as CartLine,
275
+ le as CartSummary,
276
+ re as FilterGroup,
277
+ A as PriceTag,
278
+ ee as ProductCard,
279
+ te as ProductGrid,
280
+ D as QuantityStepper
281
+ };
package/dist/elements.css CHANGED
@@ -1505,6 +1505,10 @@ html.calm .tile-glass {
1505
1505
  margin-left: auto;
1506
1506
  margin-right: auto;
1507
1507
  }
1508
+ .my-3 {
1509
+ margin-top: 0.75rem;
1510
+ margin-bottom: 0.75rem;
1511
+ }
1508
1512
  .-ml-2 {
1509
1513
  margin-left: -0.5rem;
1510
1514
  }
@@ -1538,6 +1542,12 @@ html.calm .tile-glass {
1538
1542
  .mt-6 {
1539
1543
  margin-top: 1.5rem;
1540
1544
  }
1545
+ .line-clamp-1 {
1546
+ overflow: hidden;
1547
+ display: -webkit-box;
1548
+ -webkit-box-orient: vertical;
1549
+ -webkit-line-clamp: 1;
1550
+ }
1541
1551
  .block {
1542
1552
  display: block;
1543
1553
  }
@@ -1568,6 +1578,9 @@ html.calm .tile-glass {
1568
1578
  .hidden {
1569
1579
  display: none;
1570
1580
  }
1581
+ .aspect-square {
1582
+ aspect-ratio: 1 / 1;
1583
+ }
1571
1584
  .size-3 {
1572
1585
  width: 0.75rem;
1573
1586
  height: 0.75rem;
@@ -1617,6 +1630,9 @@ html.calm .tile-glass {
1617
1630
  .h-64 {
1618
1631
  height: 16rem;
1619
1632
  }
1633
+ .h-7 {
1634
+ height: 1.75rem;
1635
+ }
1620
1636
  .h-8 {
1621
1637
  height: 2rem;
1622
1638
  }
@@ -1641,6 +1657,9 @@ html.calm .tile-glass {
1641
1657
  .max-h-48 {
1642
1658
  max-height: 12rem;
1643
1659
  }
1660
+ .max-h-56 {
1661
+ max-height: 14rem;
1662
+ }
1644
1663
  .max-h-60 {
1645
1664
  max-height: 15rem;
1646
1665
  }
@@ -1701,6 +1720,9 @@ html.calm .tile-glass {
1701
1720
  .w-4 {
1702
1721
  width: 1rem;
1703
1722
  }
1723
+ .w-44 {
1724
+ width: 11rem;
1725
+ }
1704
1726
  .w-48 {
1705
1727
  width: 12rem;
1706
1728
  }
@@ -1713,6 +1735,9 @@ html.calm .tile-glass {
1713
1735
  .w-6 {
1714
1736
  width: 1.5rem;
1715
1737
  }
1738
+ .w-7 {
1739
+ width: 1.75rem;
1740
+ }
1716
1741
  .w-72 {
1717
1742
  width: 18rem;
1718
1743
  }
@@ -1743,15 +1768,30 @@ html.calm .tile-glass {
1743
1768
  .min-w-0 {
1744
1769
  min-width: 0px;
1745
1770
  }
1771
+ .min-w-32 {
1772
+ min-width: 8rem;
1773
+ }
1746
1774
  .min-w-4 {
1747
1775
  min-width: 1rem;
1748
1776
  }
1777
+ .min-w-40 {
1778
+ min-width: 10rem;
1779
+ }
1749
1780
  .min-w-\[1\.5rem\] {
1750
1781
  min-width: 1.5rem;
1751
1782
  }
1752
1783
  .min-w-\[10rem\] {
1753
1784
  min-width: 10rem;
1754
1785
  }
1786
+ .min-w-\[2\.5rem\] {
1787
+ min-width: 2.5rem;
1788
+ }
1789
+ .min-w-\[4rem\] {
1790
+ min-width: 4rem;
1791
+ }
1792
+ .min-w-\[8rem\] {
1793
+ min-width: 8rem;
1794
+ }
1755
1795
  .max-w-\[520px\] {
1756
1796
  max-width: 520px;
1757
1797
  }
@@ -1861,6 +1901,12 @@ html.calm .tile-glass {
1861
1901
  .grid-cols-1 {
1862
1902
  grid-template-columns: repeat(1, minmax(0, 1fr));
1863
1903
  }
1904
+ .grid-cols-2 {
1905
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1906
+ }
1907
+ .grid-cols-3 {
1908
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1909
+ }
1864
1910
  .grid-cols-7 {
1865
1911
  grid-template-columns: repeat(7, minmax(0, 1fr));
1866
1912
  }
@@ -1931,11 +1977,21 @@ html.calm .tile-glass {
1931
1977
  margin-top: calc(0.375rem * calc(1 - var(--tw-space-y-reverse)));
1932
1978
  margin-bottom: calc(0.375rem * var(--tw-space-y-reverse));
1933
1979
  }
1980
+ .space-y-2 > :not([hidden]) ~ :not([hidden]) {
1981
+ --tw-space-y-reverse: 0;
1982
+ margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
1983
+ margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
1984
+ }
1934
1985
  .space-y-4 > :not([hidden]) ~ :not([hidden]) {
1935
1986
  --tw-space-y-reverse: 0;
1936
1987
  margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
1937
1988
  margin-bottom: calc(1rem * var(--tw-space-y-reverse));
1938
1989
  }
1990
+ .divide-x > :not([hidden]) ~ :not([hidden]) {
1991
+ --tw-divide-x-reverse: 0;
1992
+ border-right-width: calc(1px * var(--tw-divide-x-reverse));
1993
+ border-left-width: calc(1px * calc(1 - var(--tw-divide-x-reverse)));
1994
+ }
1939
1995
  .divide-y > :not([hidden]) ~ :not([hidden]) {
1940
1996
  --tw-divide-y-reverse: 0;
1941
1997
  border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
@@ -2137,6 +2193,9 @@ html.calm .tile-glass {
2137
2193
  .bg-primary\/15 {
2138
2194
  background-color: hsl(var(--primary) / 0.15);
2139
2195
  }
2196
+ .bg-primary\/20 {
2197
+ background-color: hsl(var(--primary) / 0.2);
2198
+ }
2140
2199
  .bg-primary\/25 {
2141
2200
  background-color: hsl(var(--primary) / 0.25);
2142
2201
  }
@@ -2297,6 +2356,9 @@ html.calm .tile-glass {
2297
2356
  .pb-4 {
2298
2357
  padding-bottom: 1rem;
2299
2358
  }
2359
+ .pl-1 {
2360
+ padding-left: 0.25rem;
2361
+ }
2300
2362
  .pl-2 {
2301
2363
  padding-left: 0.5rem;
2302
2364
  }
@@ -2490,6 +2552,9 @@ html.calm .tile-glass {
2490
2552
  --tw-text-opacity: 1;
2491
2553
  color: rgb(2 132 199 / var(--tw-text-opacity, 1));
2492
2554
  }
2555
+ .line-through {
2556
+ text-decoration-line: line-through;
2557
+ }
2493
2558
  .accent-foreground {
2494
2559
  accent-color: hsl(var(--foreground) / 1);
2495
2560
  }
@@ -2894,6 +2959,12 @@ html.calm .tile-glass {
2894
2959
  padding-right: 1.5rem;
2895
2960
  }
2896
2961
  }
2962
+ @media (min-width: 1024px) {
2963
+
2964
+ .lg\:grid-cols-4 {
2965
+ grid-template-columns: repeat(4, minmax(0, 1fr));
2966
+ }
2967
+ }
2897
2968
  .\[\&\:\:-webkit-details-marker\]\:hidden::-webkit-details-marker {
2898
2969
  display: none;
2899
2970
  }