commerce-toolkit 0.8.0 → 0.8.1
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/dist/category-card-link-B7MMGsnN.cjs +7 -0
- package/dist/category-card-link-B7MMGsnN.cjs.map +1 -0
- package/dist/{category-card-link-CdNA4PeK.js → category-card-link-DZ2CRf4d.js} +81 -69
- package/dist/category-card-link-DZ2CRf4d.js.map +1 -0
- package/dist/category-card.cjs +1 -1
- package/dist/category-card.js +1 -1
- package/dist/components/category-card/category-card.d.ts +3 -1
- package/dist/components/category-card/category-card.d.ts.map +1 -1
- package/dist/components/category-card/primitives/category-card-icon.d.ts.map +1 -1
- package/dist/components/category-card/primitives/category-card-root.d.ts +3 -1
- package/dist/components/category-card/primitives/category-card-root.d.ts.map +1 -1
- package/dist/components/category-card/primitives/category-card-title.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +95 -91
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/category-card-link-CdNA4PeK.js.map +0 -1
- package/dist/category-card-link-CjIZ-qsb.cjs +0 -7
- package/dist/category-card-link-CjIZ-qsb.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { B as ja } from "./button-link-KFt37w0p.js";
|
|
|
15
15
|
import { C as Fa } from "./calendar-CRD3qYHr.js";
|
|
16
16
|
import { C as Vr, a as Ur } from "./card-link-D9mHN6-Z.js";
|
|
17
17
|
import { C as Xr, a as Wr, b as Gr, c as Kr, e as Qr, d as Jr, f as Zr, g as to, h as ro, i as oo, j as io } from "./carousel-next-icon--YmTPwxE.js";
|
|
18
|
-
import { C as eo, a as ao, b as so, c as no, d as po, e as mo, f as Lt, g as lo } from "./category-card-link-
|
|
18
|
+
import { C as eo, a as ao, b as so, c as no, d as po, e as mo, f as Lt, g as lo } from "./category-card-link-DZ2CRf4d.js";
|
|
19
19
|
import { C as $a } from "./checkbox-CsMLn53r.js";
|
|
20
20
|
import { C as co, a as uo, b as ho } from "./chip-icon-y9Dl_zV2.js";
|
|
21
21
|
import { C as fo, a as go, b as bo, c as wo, d as vo, m as jt, e as yo, f as ko, g as xo, h as Co, i as qo, j as Eo, k as So, l as To } from "./compare-card-reveal-COfodCGj.js";
|
|
@@ -85,12 +85,12 @@ function ma({
|
|
|
85
85
|
date: e,
|
|
86
86
|
link: p,
|
|
87
87
|
image: n,
|
|
88
|
-
title:
|
|
88
|
+
title: c,
|
|
89
89
|
className: f
|
|
90
90
|
}) {
|
|
91
91
|
return /* @__PURE__ */ u(Rr, { aspectRatio: o, className: f, children: [
|
|
92
|
-
/* @__PURE__ */ i(Br, { children: n ? /* @__PURE__ */ i(Ir, { alt: n.alt, src: n.src }) : /* @__PURE__ */ i(_r, { children:
|
|
93
|
-
/* @__PURE__ */ i(Pr, { children:
|
|
92
|
+
/* @__PURE__ */ i(Br, { children: n ? /* @__PURE__ */ i(Ir, { alt: n.alt, src: n.src }) : /* @__PURE__ */ i(_r, { children: c }) }),
|
|
93
|
+
/* @__PURE__ */ i(Pr, { children: c }),
|
|
94
94
|
/* @__PURE__ */ i(Mr, { children: t }),
|
|
95
95
|
/* @__PURE__ */ u(Ar, { children: [
|
|
96
96
|
/* @__PURE__ */ i(Lr, { children: e }),
|
|
@@ -119,9 +119,9 @@ function da({
|
|
|
119
119
|
showNav: e = !0,
|
|
120
120
|
prevIcon: p,
|
|
121
121
|
nextIcon: n,
|
|
122
|
-
...
|
|
122
|
+
...c
|
|
123
123
|
}) {
|
|
124
|
-
return /* @__PURE__ */ u(Xr, { className: a, ...
|
|
124
|
+
return /* @__PURE__ */ u(Xr, { className: a, ...c, children: [
|
|
125
125
|
/* @__PURE__ */ i(Wr, { children: /* @__PURE__ */ i(Gr, { children: o.map((f, m) => /* @__PURE__ */ i(Kr, { children: f }, m)) }) }),
|
|
126
126
|
/* @__PURE__ */ u(Qr, { children: [
|
|
127
127
|
t && /* @__PURE__ */ i(Jr, {}),
|
|
@@ -139,24 +139,28 @@ function ua({
|
|
|
139
139
|
link: e,
|
|
140
140
|
icon: p,
|
|
141
141
|
aspectRatio: n = "5/6",
|
|
142
|
-
textPosition:
|
|
142
|
+
textPosition: c = "outside",
|
|
143
143
|
textSize: f = "small",
|
|
144
|
-
|
|
144
|
+
textColor: m = "dark",
|
|
145
|
+
iconColor: l = "dark",
|
|
146
|
+
showOverlay: g = !0
|
|
145
147
|
}) {
|
|
146
148
|
return /* @__PURE__ */ u(
|
|
147
149
|
eo,
|
|
148
150
|
{
|
|
149
151
|
aspectRatio: n,
|
|
150
152
|
className: a,
|
|
151
|
-
|
|
153
|
+
iconColor: l,
|
|
154
|
+
showOverlay: g,
|
|
155
|
+
textColor: m,
|
|
152
156
|
textSize: f,
|
|
153
157
|
children: [
|
|
154
158
|
/* @__PURE__ */ i(ao, { asChild: p?.asChild, children: p?.children }),
|
|
155
159
|
/* @__PURE__ */ u(so, { children: [
|
|
156
160
|
t ? /* @__PURE__ */ i(no, { alt: t.alt, asChild: t.asChild, src: t.src, children: t.children }) : /* @__PURE__ */ i(po, { children: o }),
|
|
157
|
-
|
|
161
|
+
c === "inside" && /* @__PURE__ */ i(mo, { children: /* @__PURE__ */ i(Lt, { children: o }) })
|
|
158
162
|
] }),
|
|
159
|
-
|
|
163
|
+
c === "outside" && /* @__PURE__ */ i(Lt, { children: o }),
|
|
160
164
|
/* @__PURE__ */ i(
|
|
161
165
|
lo,
|
|
162
166
|
{
|
|
@@ -183,7 +187,7 @@ function fa({
|
|
|
183
187
|
descriptionLabel: e = "Description",
|
|
184
188
|
emptyDescriptionLabel: p = "There is no description available.",
|
|
185
189
|
specs: n,
|
|
186
|
-
specsLabel:
|
|
190
|
+
specsLabel: c = "Other details",
|
|
187
191
|
emptySpecsLabel: f = "There are no other details."
|
|
188
192
|
}) {
|
|
189
193
|
return /* @__PURE__ */ u(fo, { className: a, children: [
|
|
@@ -193,14 +197,14 @@ function fa({
|
|
|
193
197
|
t != null ? /* @__PURE__ */ i(jt, { children: /* @__PURE__ */ i(yo, { children: t }) }) : /* @__PURE__ */ i(ko, { children: p })
|
|
194
198
|
] }),
|
|
195
199
|
/* @__PURE__ */ u(xo, { children: [
|
|
196
|
-
/* @__PURE__ */ i(Co, { children:
|
|
197
|
-
n ? /* @__PURE__ */ i(jt, { children: /* @__PURE__ */ i(qo, { children: n.map(({ name: m, value:
|
|
200
|
+
/* @__PURE__ */ i(Co, { children: c }),
|
|
201
|
+
n ? /* @__PURE__ */ i(jt, { children: /* @__PURE__ */ i(qo, { children: n.map(({ name: m, value: l }, g) => /* @__PURE__ */ u(hr, { children: [
|
|
198
202
|
/* @__PURE__ */ u(Eo, { children: [
|
|
199
203
|
m,
|
|
200
204
|
": "
|
|
201
205
|
] }),
|
|
202
|
-
/* @__PURE__ */ i(So, { children:
|
|
203
|
-
] },
|
|
206
|
+
/* @__PURE__ */ i(So, { children: l })
|
|
207
|
+
] }, g)) }) }) : /* @__PURE__ */ i(To, { children: f })
|
|
204
208
|
] })
|
|
205
209
|
] });
|
|
206
210
|
}
|
|
@@ -211,7 +215,7 @@ function ga({
|
|
|
211
215
|
submitLabel: e = "Compare",
|
|
212
216
|
submitIcon: p,
|
|
213
217
|
removeLabel: n = "Remove",
|
|
214
|
-
removeIcon:
|
|
218
|
+
removeIcon: c,
|
|
215
219
|
onRemove: f
|
|
216
220
|
}) {
|
|
217
221
|
return /* @__PURE__ */ i(zo, { container: o, children: /* @__PURE__ */ i(Do, { children: /* @__PURE__ */ u(No, { children: [
|
|
@@ -241,7 +245,7 @@ function ga({
|
|
|
241
245
|
{
|
|
242
246
|
"aria-label": `${n} ${m.title}`,
|
|
243
247
|
onClick: () => f?.(m.id),
|
|
244
|
-
children: /* @__PURE__ */ i(jo, { asChild:
|
|
248
|
+
children: /* @__PURE__ */ i(jo, { asChild: c?.asChild, children: c?.children })
|
|
245
249
|
}
|
|
246
250
|
)
|
|
247
251
|
] }, m.id)) }),
|
|
@@ -282,16 +286,16 @@ function ba({
|
|
|
282
286
|
disabled: e,
|
|
283
287
|
min: p = 0,
|
|
284
288
|
max: n = 10,
|
|
285
|
-
value:
|
|
289
|
+
value: c,
|
|
286
290
|
defaultValue: f,
|
|
287
291
|
onChange: m,
|
|
288
|
-
...
|
|
292
|
+
...l
|
|
289
293
|
}) {
|
|
290
|
-
const
|
|
291
|
-
const z =
|
|
294
|
+
const g = fr(null), r = Number(c ?? f ?? p), x = Number(p), _ = Number(n), q = () => {
|
|
295
|
+
const z = g.current;
|
|
292
296
|
z != null && (z.stepDown(), z.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
293
297
|
}, ot = () => {
|
|
294
|
-
const z =
|
|
298
|
+
const z = g.current;
|
|
295
299
|
z != null && (z.stepUp(), z.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
296
300
|
};
|
|
297
301
|
return /* @__PURE__ */ u(Oo, { className: a, children: [
|
|
@@ -312,10 +316,10 @@ function ba({
|
|
|
312
316
|
max: n,
|
|
313
317
|
min: p,
|
|
314
318
|
onChange: m,
|
|
315
|
-
ref:
|
|
319
|
+
ref: g,
|
|
316
320
|
type: "number",
|
|
317
|
-
value:
|
|
318
|
-
...
|
|
321
|
+
value: c,
|
|
322
|
+
...l
|
|
319
323
|
}
|
|
320
324
|
),
|
|
321
325
|
/* @__PURE__ */ i(
|
|
@@ -336,26 +340,26 @@ function wa({
|
|
|
336
340
|
nextIcon: e,
|
|
337
341
|
label: p = "pagination"
|
|
338
342
|
}) {
|
|
339
|
-
const n = o?.label ?? "Go to previous page",
|
|
343
|
+
const n = o?.label ?? "Go to previous page", c = e?.label ?? "Go to next page", f = a?.href, m = t?.href, l = a?.asChild === !0, g = t?.asChild === !0, r = /* @__PURE__ */ i(Uo, { asChild: o?.asChild, children: o?.children }), x = /* @__PURE__ */ i(Xo, { asChild: e?.asChild, children: e?.children });
|
|
340
344
|
return /* @__PURE__ */ i(Wo, { "aria-label": p, role: "navigation", children: /* @__PURE__ */ u(Go, { children: [
|
|
341
345
|
/* @__PURE__ */ i(Ht, { children: f != null ? /* @__PURE__ */ i(
|
|
342
346
|
bt,
|
|
343
347
|
{
|
|
344
348
|
"aria-label": n,
|
|
345
|
-
asChild:
|
|
349
|
+
asChild: l,
|
|
346
350
|
href: f,
|
|
347
|
-
children:
|
|
351
|
+
children: l ? a.children : r
|
|
348
352
|
}
|
|
349
353
|
) : /* @__PURE__ */ i(bt, { "aria-disabled": !0, "aria-label": n, children: r }) }),
|
|
350
354
|
/* @__PURE__ */ i(Ht, { children: m != null ? /* @__PURE__ */ i(
|
|
351
355
|
bt,
|
|
352
356
|
{
|
|
353
|
-
"aria-label":
|
|
354
|
-
asChild:
|
|
357
|
+
"aria-label": c,
|
|
358
|
+
asChild: g,
|
|
355
359
|
href: m,
|
|
356
|
-
children:
|
|
360
|
+
children: g ? t.children : x
|
|
357
361
|
}
|
|
358
|
-
) : /* @__PURE__ */ i(bt, { "aria-disabled": !0, "aria-label":
|
|
362
|
+
) : /* @__PURE__ */ i(bt, { "aria-disabled": !0, "aria-label": c, children: x }) })
|
|
359
363
|
] }) });
|
|
360
364
|
}
|
|
361
365
|
function va({
|
|
@@ -365,7 +369,7 @@ function va({
|
|
|
365
369
|
triggerIcon: e,
|
|
366
370
|
align: p,
|
|
367
371
|
sideOffset: n,
|
|
368
|
-
label:
|
|
372
|
+
label: c,
|
|
369
373
|
showScrollArea: f = !0,
|
|
370
374
|
maxHeight: m = 320
|
|
371
375
|
}) {
|
|
@@ -379,8 +383,8 @@ function va({
|
|
|
379
383
|
children: [
|
|
380
384
|
/* @__PURE__ */ i(Qo, { asChild: !0, children: t !== void 0 ? t : /* @__PURE__ */ i(Sr, { shape: "circle", size: "small", variant: "ghost", children: /* @__PURE__ */ i(Jo, { asChild: e?.asChild, children: e?.children }) }) }),
|
|
381
385
|
/* @__PURE__ */ i(Zo, { children: /* @__PURE__ */ i(ti, { className: Tt(a), children: /* @__PURE__ */ u(ri, { children: [
|
|
382
|
-
/* @__PURE__ */ i(oi, { children:
|
|
383
|
-
o.map((
|
|
386
|
+
/* @__PURE__ */ i(oi, { children: c }),
|
|
387
|
+
o.map((l, g) => /* @__PURE__ */ i(ii, { menuKey: g, menuNode: l }, g))
|
|
384
388
|
] }) }) })
|
|
385
389
|
]
|
|
386
390
|
}
|
|
@@ -511,7 +515,7 @@ const Yt = {
|
|
|
511
515
|
"arrow-up-left": () => import("./arrow-up-left-Dc0wH3IL.js"),
|
|
512
516
|
"arrow-up-narrow-wide": () => import("./arrow-up-narrow-wide-CsZbouk_.js"),
|
|
513
517
|
"sort-asc": () => import("./arrow-up-narrow-wide-CsZbouk_.js"),
|
|
514
|
-
"arrow-up-right": () => import("./category-card-link-
|
|
518
|
+
"arrow-up-right": () => import("./category-card-link-DZ2CRf4d.js").then((a) => a.h),
|
|
515
519
|
"arrow-up-to-line": () => import("./arrow-up-to-line-ClyTovyG.js"),
|
|
516
520
|
"arrow-up-wide-narrow": () => import("./arrow-up-wide-narrow-D0SrwjqN.js"),
|
|
517
521
|
"arrow-up-z-a": () => import("./arrow-up-z-a-C1zLgphx.js"),
|
|
@@ -2285,8 +2289,8 @@ const Gi = gr(
|
|
|
2285
2289
|
({ name: a, fallback: o, ...t }, e) => {
|
|
2286
2290
|
const [p, n] = br();
|
|
2287
2291
|
return wr(() => {
|
|
2288
|
-
Wi(a).then(n).catch((
|
|
2289
|
-
console.error(
|
|
2292
|
+
Wi(a).then(n).catch((c) => {
|
|
2293
|
+
console.error(c);
|
|
2290
2294
|
});
|
|
2291
2295
|
}, [a]), p == null ? o == null ? null : At(o) : At(gi, {
|
|
2292
2296
|
ref: e,
|
|
@@ -2318,7 +2322,7 @@ const Ca = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2318
2322
|
function qa({ className: a, children: o, isOpen: t, setOpen: e, title: p, trigger: n }) {
|
|
2319
2323
|
return /* @__PURE__ */ u(ki, { onOpenChange: e, open: t, children: [
|
|
2320
2324
|
/* @__PURE__ */ i(xi, { asChild: !0, children: n }),
|
|
2321
|
-
/* @__PURE__ */ i(Ci, { children: /* @__PURE__ */ i(qi, { children: /* @__PURE__ */ u(Ei, { className: a, onOpenAutoFocus: (
|
|
2325
|
+
/* @__PURE__ */ i(Ci, { children: /* @__PURE__ */ i(qi, { children: /* @__PURE__ */ u(Ei, { className: a, onOpenAutoFocus: (c) => c.preventDefault(), children: [
|
|
2322
2326
|
/* @__PURE__ */ i(Si, { children: p }),
|
|
2323
2327
|
o
|
|
2324
2328
|
] }) }) })
|
|
@@ -2505,8 +2509,8 @@ class ne {
|
|
|
2505
2509
|
];
|
|
2506
2510
|
}, this.create = (o) => {
|
|
2507
2511
|
var t;
|
|
2508
|
-
const { message: e, ...p } = o, n = typeof o?.id == "number" || ((t = o.id) == null ? void 0 : t.length) > 0 ? o.id : St++,
|
|
2509
|
-
return this.dismissedToasts.has(n) && this.dismissedToasts.delete(n),
|
|
2512
|
+
const { message: e, ...p } = o, n = typeof o?.id == "number" || ((t = o.id) == null ? void 0 : t.length) > 0 ? o.id : St++, c = this.toasts.find((m) => m.id === n), f = o.dismissible === void 0 ? !0 : o.dismissible;
|
|
2513
|
+
return this.dismissedToasts.has(n) && this.dismissedToasts.delete(n), c ? this.toasts = this.toasts.map((m) => m.id === n ? (this.publish({
|
|
2510
2514
|
...m,
|
|
2511
2515
|
...o,
|
|
2512
2516
|
id: n,
|
|
@@ -2566,20 +2570,20 @@ class ne {
|
|
|
2566
2570
|
description: typeof t.description != "function" ? t.description : void 0
|
|
2567
2571
|
}));
|
|
2568
2572
|
const p = Promise.resolve(o instanceof Function ? o() : o);
|
|
2569
|
-
let n = e !== void 0,
|
|
2570
|
-
const f = p.then(async (
|
|
2571
|
-
if (
|
|
2573
|
+
let n = e !== void 0, c;
|
|
2574
|
+
const f = p.then(async (l) => {
|
|
2575
|
+
if (c = [
|
|
2572
2576
|
"resolve",
|
|
2573
|
-
|
|
2574
|
-
], s.isValidElement(
|
|
2577
|
+
l
|
|
2578
|
+
], s.isValidElement(l))
|
|
2575
2579
|
n = !1, this.create({
|
|
2576
2580
|
id: e,
|
|
2577
2581
|
type: "default",
|
|
2578
|
-
message:
|
|
2582
|
+
message: l
|
|
2579
2583
|
});
|
|
2580
|
-
else if (me(
|
|
2584
|
+
else if (me(l) && !l.ok) {
|
|
2581
2585
|
n = !1;
|
|
2582
|
-
const r = typeof t.error == "function" ? await t.error(`HTTP error! status: ${
|
|
2586
|
+
const r = typeof t.error == "function" ? await t.error(`HTTP error! status: ${l.status}`) : t.error, x = typeof t.description == "function" ? await t.description(`HTTP error! status: ${l.status}`) : t.description, q = typeof r == "object" && !s.isValidElement(r) ? r : {
|
|
2583
2587
|
message: r
|
|
2584
2588
|
};
|
|
2585
2589
|
this.create({
|
|
@@ -2588,9 +2592,9 @@ class ne {
|
|
|
2588
2592
|
description: x,
|
|
2589
2593
|
...q
|
|
2590
2594
|
});
|
|
2591
|
-
} else if (
|
|
2595
|
+
} else if (l instanceof Error) {
|
|
2592
2596
|
n = !1;
|
|
2593
|
-
const r = typeof t.error == "function" ? await t.error(
|
|
2597
|
+
const r = typeof t.error == "function" ? await t.error(l) : t.error, x = typeof t.description == "function" ? await t.description(l) : t.description, q = typeof r == "object" && !s.isValidElement(r) ? r : {
|
|
2594
2598
|
message: r
|
|
2595
2599
|
};
|
|
2596
2600
|
this.create({
|
|
@@ -2601,7 +2605,7 @@ class ne {
|
|
|
2601
2605
|
});
|
|
2602
2606
|
} else if (t.success !== void 0) {
|
|
2603
2607
|
n = !1;
|
|
2604
|
-
const r = typeof t.success == "function" ? await t.success(
|
|
2608
|
+
const r = typeof t.success == "function" ? await t.success(l) : t.success, x = typeof t.description == "function" ? await t.description(l) : t.description, q = typeof r == "object" && !s.isValidElement(r) ? r : {
|
|
2605
2609
|
message: r
|
|
2606
2610
|
};
|
|
2607
2611
|
this.create({
|
|
@@ -2611,14 +2615,14 @@ class ne {
|
|
|
2611
2615
|
...q
|
|
2612
2616
|
});
|
|
2613
2617
|
}
|
|
2614
|
-
}).catch(async (
|
|
2615
|
-
if (
|
|
2618
|
+
}).catch(async (l) => {
|
|
2619
|
+
if (c = [
|
|
2616
2620
|
"reject",
|
|
2617
|
-
|
|
2621
|
+
l
|
|
2618
2622
|
], t.error !== void 0) {
|
|
2619
2623
|
n = !1;
|
|
2620
|
-
const
|
|
2621
|
-
message:
|
|
2624
|
+
const g = typeof t.error == "function" ? await t.error(l) : t.error, r = typeof t.description == "function" ? await t.description(l) : t.description, _ = typeof g == "object" && !s.isValidElement(g) ? g : {
|
|
2625
|
+
message: g
|
|
2622
2626
|
};
|
|
2623
2627
|
this.create({
|
|
2624
2628
|
id: e,
|
|
@@ -2629,7 +2633,7 @@ class ne {
|
|
|
2629
2633
|
}
|
|
2630
2634
|
}).finally(() => {
|
|
2631
2635
|
n && (this.dismiss(e), e = void 0), t.finally == null || t.finally.call(t);
|
|
2632
|
-
}), m = () => new Promise((
|
|
2636
|
+
}), m = () => new Promise((l, g) => f.then(() => c[0] === "reject" ? g(c[1]) : l(c[1])).catch(g));
|
|
2633
2637
|
return typeof e != "string" && typeof e != "number" ? {
|
|
2634
2638
|
unwrap: m
|
|
2635
2639
|
} : Object.assign(e, {
|
|
@@ -2679,8 +2683,8 @@ function ye(a) {
|
|
|
2679
2683
|
return o && e.push(o), t && e.push(t), e;
|
|
2680
2684
|
}
|
|
2681
2685
|
const ke = (a) => {
|
|
2682
|
-
var o, t, e, p, n,
|
|
2683
|
-
const { invert:
|
|
2686
|
+
var o, t, e, p, n, c, f, m, l;
|
|
2687
|
+
const { invert: g, toast: r, unstyled: x, interacting: _, setHeights: q, visibleToasts: ot, heights: z, index: b, toasts: nt, expanded: G, removeToast: pt, defaultRichColors: yt, closeButton: O, style: it, cancelButtonStyle: V, actionButtonStyle: kt, className: mt = "", descriptionClassName: xt = "", duration: et, position: L, gap: lt, expandByDefault: at, classNames: w, icons: E, closeButtonAriaLabel: H = "Close toast" } = a, [U, P] = s.useState(null), [X, ct] = s.useState(null), [h, k] = s.useState(!1), [y, B] = s.useState(!1), [K, v] = s.useState(!1), [Q, dt] = s.useState(!1), [ut, J] = s.useState(!1), [Xt, Ct] = s.useState(0), [Wt, zt] = s.useState(0), st = s.useRef(r.duration || et || Vt), Dt = s.useRef(null), F = s.useRef(null), Gt = b === 0, Kt = b + 1 <= ot, N = r.type, Z = r.dismissible !== !1, Qt = r.className || "", Jt = r.descriptionClassName || "", ht = s.useMemo(() => z.findIndex((d) => d.toastId === r.id) || 0, [
|
|
2684
2688
|
z,
|
|
2685
2689
|
r.id
|
|
2686
2690
|
]), Zt = s.useMemo(() => {
|
|
@@ -2695,7 +2699,7 @@ const ke = (a) => {
|
|
|
2695
2699
|
]), qt = s.useRef(0), tt = s.useRef(0), Rt = s.useRef(0), rt = s.useRef(null), [tr, rr] = L.split("-"), Bt = s.useMemo(() => z.reduce((d, C, T) => T >= ht ? d : d + C.height, 0), [
|
|
2696
2700
|
z,
|
|
2697
2701
|
ht
|
|
2698
|
-
]), It = se(), or = r.invert ||
|
|
2702
|
+
]), It = se(), or = r.invert || g, Et = N === "loading";
|
|
2699
2703
|
tt.current = s.useMemo(() => ht * lt + Bt, [
|
|
2700
2704
|
ht,
|
|
2701
2705
|
Bt
|
|
@@ -2814,7 +2818,7 @@ const ke = (a) => {
|
|
|
2814
2818
|
"data-visible": Kt,
|
|
2815
2819
|
"data-y-position": tr,
|
|
2816
2820
|
"data-x-position": rr,
|
|
2817
|
-
"data-index":
|
|
2821
|
+
"data-index": b,
|
|
2818
2822
|
"data-front": Gt,
|
|
2819
2823
|
"data-swiping": K,
|
|
2820
2824
|
"data-dismissible": Z,
|
|
@@ -2825,9 +2829,9 @@ const ke = (a) => {
|
|
|
2825
2829
|
"data-expanded": !!(G || at && h),
|
|
2826
2830
|
"data-testid": r.testId,
|
|
2827
2831
|
style: {
|
|
2828
|
-
"--index":
|
|
2829
|
-
"--toasts-before":
|
|
2830
|
-
"--z-index": nt.length -
|
|
2832
|
+
"--index": b,
|
|
2833
|
+
"--toasts-before": b,
|
|
2834
|
+
"--z-index": nt.length - b,
|
|
2831
2835
|
"--offset": `${y ? Xt : tt.current}px`,
|
|
2832
2836
|
"--initial-height": at ? "auto" : `${Wt}px`,
|
|
2833
2837
|
...it,
|
|
@@ -2902,7 +2906,7 @@ const ke = (a) => {
|
|
|
2902
2906
|
className: j(w?.content, r == null || (n = r.classNames) == null ? void 0 : n.content)
|
|
2903
2907
|
}, /* @__PURE__ */ s.createElement("div", {
|
|
2904
2908
|
"data-title": "",
|
|
2905
|
-
className: j(w?.title, r == null || (
|
|
2909
|
+
className: j(w?.title, r == null || (c = r.classNames) == null ? void 0 : c.title)
|
|
2906
2910
|
}, r.jsx ? r.jsx : typeof r.title == "function" ? r.title() : r.title), r.description ? /* @__PURE__ */ s.createElement("div", {
|
|
2907
2911
|
"data-description": "",
|
|
2908
2912
|
className: j(xt, Jt, w?.description, r == null || (f = r.classNames) == null ? void 0 : f.description)
|
|
@@ -2921,7 +2925,7 @@ const ke = (a) => {
|
|
|
2921
2925
|
onClick: (d) => {
|
|
2922
2926
|
vt(r.action) && (r.action.onClick == null || r.action.onClick.call(r.action, d), !d.defaultPrevented && $());
|
|
2923
2927
|
},
|
|
2924
|
-
className: j(w?.actionButton, r == null || (
|
|
2928
|
+
className: j(w?.actionButton, r == null || (l = r.classNames) == null ? void 0 : l.actionButton)
|
|
2925
2929
|
}, r.action.label) : null);
|
|
2926
2930
|
};
|
|
2927
2931
|
function Ut() {
|
|
@@ -2935,15 +2939,15 @@ function xe(a, o) {
|
|
|
2935
2939
|
a,
|
|
2936
2940
|
o
|
|
2937
2941
|
].forEach((e, p) => {
|
|
2938
|
-
const n = p === 1,
|
|
2939
|
-
function m(
|
|
2942
|
+
const n = p === 1, c = n ? "--mobile-offset" : "--offset", f = n ? fe : he;
|
|
2943
|
+
function m(l) {
|
|
2940
2944
|
[
|
|
2941
2945
|
"top",
|
|
2942
2946
|
"right",
|
|
2943
2947
|
"bottom",
|
|
2944
2948
|
"left"
|
|
2945
|
-
].forEach((
|
|
2946
|
-
t[`${
|
|
2949
|
+
].forEach((g) => {
|
|
2950
|
+
t[`${c}-${g}`] = typeof l == "number" ? `${l}px` : l;
|
|
2947
2951
|
});
|
|
2948
2952
|
}
|
|
2949
2953
|
typeof e == "number" || typeof e == "string" ? m(e) : typeof e == "object" ? [
|
|
@@ -2951,16 +2955,16 @@ function xe(a, o) {
|
|
|
2951
2955
|
"right",
|
|
2952
2956
|
"bottom",
|
|
2953
2957
|
"left"
|
|
2954
|
-
].forEach((
|
|
2955
|
-
e[
|
|
2958
|
+
].forEach((l) => {
|
|
2959
|
+
e[l] === void 0 ? t[`${c}-${l}`] = f : t[`${c}-${l}`] = typeof e[l] == "number" ? `${e[l]}px` : e[l];
|
|
2956
2960
|
}) : m(f);
|
|
2957
2961
|
}), t;
|
|
2958
2962
|
}
|
|
2959
2963
|
const Ce = /* @__PURE__ */ s.forwardRef(function(o, t) {
|
|
2960
|
-
const { id: e, invert: p, position: n = "bottom-right", hotkey:
|
|
2964
|
+
const { id: e, invert: p, position: n = "bottom-right", hotkey: c = [
|
|
2961
2965
|
"altKey",
|
|
2962
2966
|
"KeyT"
|
|
2963
|
-
], expand: f, closeButton: m, className:
|
|
2967
|
+
], expand: f, closeButton: m, className: l, offset: g, mobileOffset: r, theme: x = "light", richColors: _, duration: q, style: ot, visibleToasts: z = ue, toastOptions: b, dir: nt = Ut(), gap: G = be, icons: pt, containerAriaLabel: yt = "Notifications" } = o, [O, it] = s.useState([]), V = s.useMemo(() => e ? O.filter((h) => h.toasterId === e) : O.filter((h) => !h.toasterId), [
|
|
2964
2968
|
O,
|
|
2965
2969
|
e
|
|
2966
2970
|
]), kt = s.useMemo(() => Array.from(new Set([
|
|
@@ -2968,7 +2972,7 @@ const Ce = /* @__PURE__ */ s.forwardRef(function(o, t) {
|
|
|
2968
2972
|
].concat(V.filter((h) => h.position).map((h) => h.position)))), [
|
|
2969
2973
|
V,
|
|
2970
2974
|
n
|
|
2971
|
-
]), [mt, xt] = s.useState([]), [et, L] = s.useState(!1), [lt, at] = s.useState(!1), [w, E] = s.useState(x !== "system" ? x : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), H = s.useRef(null), U =
|
|
2975
|
+
]), [mt, xt] = s.useState([]), [et, L] = s.useState(!1), [lt, at] = s.useState(!1), [w, E] = s.useState(x !== "system" ? x : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), H = s.useRef(null), U = c.join("+").replace(/Key/g, "").replace(/Digit/g, ""), P = s.useRef(null), X = s.useRef(!1), ct = s.useCallback((h) => {
|
|
2972
2976
|
it((k) => {
|
|
2973
2977
|
var y;
|
|
2974
2978
|
return (y = k.find((B) => B.id === h.id)) != null && y.delete || D.dismiss(h.id), k.filter(({ id: B }) => B !== h.id);
|
|
@@ -3033,7 +3037,7 @@ const Ce = /* @__PURE__ */ s.forwardRef(function(o, t) {
|
|
|
3033
3037
|
]), s.useEffect(() => {
|
|
3034
3038
|
const h = (k) => {
|
|
3035
3039
|
var y;
|
|
3036
|
-
if (
|
|
3040
|
+
if (c.every((v) => k[v] || k.code === v)) {
|
|
3037
3041
|
var K;
|
|
3038
3042
|
L(!0), (K = H.current) == null || K.focus();
|
|
3039
3043
|
}
|
|
@@ -3041,7 +3045,7 @@ const Ce = /* @__PURE__ */ s.forwardRef(function(o, t) {
|
|
|
3041
3045
|
};
|
|
3042
3046
|
return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
|
|
3043
3047
|
}, [
|
|
3044
|
-
|
|
3048
|
+
c
|
|
3045
3049
|
]), s.useEffect(() => {
|
|
3046
3050
|
if (H.current)
|
|
3047
3051
|
return () => {
|
|
@@ -3068,7 +3072,7 @@ const Ce = /* @__PURE__ */ s.forwardRef(function(o, t) {
|
|
|
3068
3072
|
dir: nt === "auto" ? Ut() : nt,
|
|
3069
3073
|
tabIndex: -1,
|
|
3070
3074
|
ref: H,
|
|
3071
|
-
className:
|
|
3075
|
+
className: l,
|
|
3072
3076
|
"data-sonner-toaster": !0,
|
|
3073
3077
|
"data-sonner-theme": w,
|
|
3074
3078
|
"data-y-position": B,
|
|
@@ -3078,7 +3082,7 @@ const Ce = /* @__PURE__ */ s.forwardRef(function(o, t) {
|
|
|
3078
3082
|
"--width": `${ge}px`,
|
|
3079
3083
|
"--gap": `${G}px`,
|
|
3080
3084
|
...ot,
|
|
3081
|
-
...xe(
|
|
3085
|
+
...xe(g, r)
|
|
3082
3086
|
},
|
|
3083
3087
|
onBlur: (v) => {
|
|
3084
3088
|
X.current && !v.currentTarget.contains(v.relatedTarget) && (X.current = !1, P.current && (P.current.focus({
|
|
@@ -3106,20 +3110,20 @@ const Ce = /* @__PURE__ */ s.forwardRef(function(o, t) {
|
|
|
3106
3110
|
index: Q,
|
|
3107
3111
|
toast: v,
|
|
3108
3112
|
defaultRichColors: _,
|
|
3109
|
-
duration: (dt =
|
|
3110
|
-
className:
|
|
3111
|
-
descriptionClassName:
|
|
3113
|
+
duration: (dt = b?.duration) != null ? dt : q,
|
|
3114
|
+
className: b?.className,
|
|
3115
|
+
descriptionClassName: b?.descriptionClassName,
|
|
3112
3116
|
invert: p,
|
|
3113
3117
|
visibleToasts: z,
|
|
3114
|
-
closeButton: (ut =
|
|
3118
|
+
closeButton: (ut = b?.closeButton) != null ? ut : m,
|
|
3115
3119
|
interacting: lt,
|
|
3116
3120
|
position: h,
|
|
3117
|
-
style:
|
|
3118
|
-
unstyled:
|
|
3119
|
-
classNames:
|
|
3120
|
-
cancelButtonStyle:
|
|
3121
|
-
actionButtonStyle:
|
|
3122
|
-
closeButtonAriaLabel:
|
|
3121
|
+
style: b?.style,
|
|
3122
|
+
unstyled: b?.unstyled,
|
|
3123
|
+
classNames: b?.classNames,
|
|
3124
|
+
cancelButtonStyle: b?.cancelButtonStyle,
|
|
3125
|
+
actionButtonStyle: b?.actionButtonStyle,
|
|
3126
|
+
closeButtonAriaLabel: b?.closeButtonAriaLabel,
|
|
3123
3127
|
removeToast: ct,
|
|
3124
3128
|
toasts: V.filter((J) => J.position == v.position),
|
|
3125
3129
|
heights: mt.filter((J) => J.position == v.position),
|