@tapcart/mobile-components 0.2.10 → 0.2.12
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/components/hooks/use-infinite-scroll.d.ts +1 -0
- package/dist/components/hooks/use-infinite-scroll.d.ts.map +1 -1
- package/dist/components/hooks/use-infinite-scroll.js +10 -6
- package/dist/components/hooks/use-scroll-direction.d.ts +8 -0
- package/dist/components/hooks/use-scroll-direction.d.ts.map +1 -0
- package/dist/components/hooks/use-scroll-direction.js +30 -0
- package/dist/components/ui/accordion.js +3 -3
- package/dist/components/ui/alert-dialog.js +8 -8
- package/dist/components/ui/badge.d.ts +4 -3
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +25 -7
- package/dist/components/ui/button.d.ts +3 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +5 -5
- package/dist/components/ui/carousel.d.ts +5 -5
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +5 -5
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +5 -5
- package/dist/components/ui/chip.d.ts +2 -2
- package/dist/components/ui/chip.d.ts.map +1 -1
- package/dist/components/ui/chip.js +2 -2
- package/dist/components/ui/container.js +1 -1
- package/dist/components/ui/drawer.d.ts +3 -3
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js +15 -13
- package/dist/components/ui/dropdown.d.ts +22 -0
- package/dist/components/ui/dropdown.d.ts.map +1 -0
- package/dist/components/ui/dropdown.js +60 -0
- package/dist/components/ui/favorite.d.ts +4 -2
- package/dist/components/ui/favorite.d.ts.map +1 -1
- package/dist/components/ui/favorite.js +11 -5
- package/dist/components/ui/grid.js +5 -5
- package/dist/components/ui/icon.d.ts +2 -2
- package/dist/components/ui/icon.d.ts.map +1 -1
- package/dist/components/ui/icon.js +32 -7
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/money.js +1 -1
- package/dist/components/ui/price.d.ts +2 -1
- package/dist/components/ui/price.d.ts.map +1 -1
- package/dist/components/ui/price.js +6 -6
- package/dist/components/ui/product-card.d.ts +93 -27
- package/dist/components/ui/product-card.d.ts.map +1 -1
- package/dist/components/ui/product-card.js +140 -33
- package/dist/components/ui/product-grid.d.ts +1 -1
- package/dist/components/ui/product-grid.d.ts.map +1 -1
- package/dist/components/ui/product-grid.js +5 -5
- package/dist/components/ui/radio-group.js +4 -4
- package/dist/components/ui/scroll-area.d.ts +1 -1
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +2 -2
- package/dist/components/ui/selectors.d.ts +2 -2
- package/dist/components/ui/selectors.d.ts.map +1 -1
- package/dist/components/ui/selectors.js +3 -3
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/tabs.js +3 -3
- package/dist/components/ui/text.js +6 -6
- package/dist/components/ui/toast.d.ts +3 -3
- package/dist/components/ui/toast.d.ts.map +1 -1
- package/dist/components/ui/toast.js +7 -7
- package/dist/components/ui/toaster.js +2 -2
- package/dist/components/ui/toggle-group.d.ts +2 -2
- package/dist/components/ui/toggle-group.js +2 -2
- package/dist/components/ui/toggle.d.ts +2 -2
- package/dist/components/ui/toggle.js +1 -1
- package/dist/components/ui/use-toast.d.ts +6 -6
- package/dist/components/ui/use-toast.d.ts.map +1 -1
- package/dist/components/ui/video.js +1 -1
- package/dist/components/ui/wishlist.d.ts +2 -1
- package/dist/components/ui/wishlist.d.ts.map +1 -1
- package/dist/components/ui/wishlist.js +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/styles.css +147 -29
- package/package.json +1 -1
|
@@ -1,40 +1,147 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Badge } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Skeleton } from "
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
3
|
+
import { Badge } from "./badge";
|
|
4
|
+
import { Favorite } from "./favorite";
|
|
5
|
+
import { Button } from "./button";
|
|
6
|
+
import { Text } from "./text";
|
|
7
|
+
import { Price } from "./price";
|
|
8
|
+
import { Skeleton } from "./skeleton";
|
|
9
|
+
import { cn } from "../../lib/utils";
|
|
10
|
+
import { cva } from "class-variance-authority";
|
|
11
|
+
const aspectScalingVariants = cva("w-full", {
|
|
12
|
+
variants: {
|
|
13
|
+
aspectRatio: {
|
|
14
|
+
"1:1": "aspect-square",
|
|
15
|
+
"2:3": "aspect-[2/3]",
|
|
16
|
+
"4:5": "aspect-[4/5]",
|
|
17
|
+
},
|
|
18
|
+
scaling: {
|
|
19
|
+
"fill": "object-cover",
|
|
20
|
+
"fit": "object-contain",
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
aspectRatio: "2:3",
|
|
25
|
+
scaling: "fill"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const productCardBadgeVariants = cva("absolute truncate", {
|
|
29
|
+
variants: {
|
|
30
|
+
horizontalPosition: {
|
|
31
|
+
start: "left-0",
|
|
32
|
+
end: "right-0",
|
|
33
|
+
center: "",
|
|
34
|
+
},
|
|
35
|
+
verticalPosition: {
|
|
36
|
+
top: "top-0 mt-2",
|
|
37
|
+
bottom: "bottom-0 mb-2",
|
|
38
|
+
below: "",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const productCardFavoriteVariants = cva("absolute ", {
|
|
43
|
+
variants: {
|
|
44
|
+
iconPosition: {
|
|
45
|
+
"top-left": "top-0 left-2 mt-2",
|
|
46
|
+
"top-right": "top-0 right-2 mt-2",
|
|
47
|
+
"bottom-left": "bottom-0 left-2 mb-2",
|
|
48
|
+
"bottom-right": "bottom-0 right-2 mb-2",
|
|
49
|
+
"below-image-on-right": "",
|
|
50
|
+
},
|
|
51
|
+
badgeHorizontalPosition: {
|
|
52
|
+
start: "",
|
|
53
|
+
end: "",
|
|
54
|
+
center: "",
|
|
55
|
+
},
|
|
56
|
+
badgeVerticalPosition: {
|
|
57
|
+
top: "",
|
|
58
|
+
bottom: "",
|
|
59
|
+
below: "",
|
|
60
|
+
},
|
|
61
|
+
showSoldOutBadge: {
|
|
62
|
+
true: "",
|
|
63
|
+
false: "",
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
compoundVariants: [
|
|
67
|
+
{
|
|
68
|
+
iconPosition: "top-left",
|
|
69
|
+
badgeHorizontalPosition: ["start", "center"],
|
|
70
|
+
badgeVerticalPosition: "top",
|
|
71
|
+
class: "top-10",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
iconPosition: "top-right",
|
|
75
|
+
badgeHorizontalPosition: ["end", "center"],
|
|
76
|
+
badgeVerticalPosition: "top",
|
|
77
|
+
class: "top-10",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
iconPosition: "bottom-left",
|
|
81
|
+
badgeHorizontalPosition: ["start", "center"],
|
|
82
|
+
badgeVerticalPosition: "bottom",
|
|
83
|
+
class: "bottom-10",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
iconPosition: "bottom-right",
|
|
87
|
+
badgeHorizontalPosition: ["end", "center"],
|
|
88
|
+
badgeVerticalPosition: "bottom",
|
|
89
|
+
class: "bottom-10",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
iconPosition: "bottom-left",
|
|
93
|
+
showSoldOutBadge: true,
|
|
94
|
+
class: "bottom-10",
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
defaultVariants: {
|
|
98
|
+
iconPosition: "below-image-on-right",
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
const ProductCard = ({ config, tapcartData, product, isLoading, favorited, onFavoriteClick, onQuickAdd, openProduct, }) => {
|
|
102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
103
|
+
const ProductImage = ({ src }) => {
|
|
104
|
+
const productImageClasses = cn(aspectScalingVariants({ aspectRatio: tapcartData.theme.productImages.aspectRatio, scaling: tapcartData.theme.productImages.scaling }));
|
|
105
|
+
if (src) {
|
|
106
|
+
return (_jsx("img", { className: productImageClasses, src: src }));
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
return (_jsx("div", { className: `${productImageClasses} bg-neutral-300` }));
|
|
110
|
+
}
|
|
111
|
+
};
|
|
28
112
|
const { variants: [variant], images: [{ src }], title } = product;
|
|
29
|
-
const
|
|
30
|
-
const iconPosition = (icon === null || icon === void 0 ? void 0 : icon.position) || "bottomRight";
|
|
31
|
-
const scalingClass = scaling === "fit" ? "object-contain" : "object-cover";
|
|
113
|
+
const iconPosition = ((_a = config.favoritesIcon) === null || _a === void 0 ? void 0 : _a.layoutType) || "below-image-on-right";
|
|
32
114
|
if (isLoading) {
|
|
33
|
-
return (_jsxs("div", Object.assign({ className: "w-1/2" }, { children: [_jsx(Skeleton, { className: "w-full h-64" }
|
|
115
|
+
return (_jsxs("div", Object.assign({ className: "w-1/2 rounded" }, { children: [_jsx(Skeleton, { className: "w-full h-64 rounded" }), _jsx(Skeleton, { className: "h-6 w-1/2 mt-2 rounded" }), _jsx(Skeleton, { className: "h-4 w-full mt-2 rounded" })] })));
|
|
34
116
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
117
|
+
const productBadgesPDP = (_b = tapcartData === null || tapcartData === void 0 ? void 0 : tapcartData["product-badges"]) === null || _b === void 0 ? void 0 : _b.pdp;
|
|
118
|
+
const aboveBadgeKeys = Object.keys(productBadgesPDP).filter((key) => key !== "below");
|
|
119
|
+
const aboveBadges = aboveBadgeKeys.flatMap((key) => {
|
|
120
|
+
const badges = productBadgesPDP === null || productBadgesPDP === void 0 ? void 0 : productBadgesPDP[key];
|
|
121
|
+
return badges === null || badges === void 0 ? void 0 : badges.map((badge) => {
|
|
122
|
+
return Object.assign(Object.assign({}, badge), { verticalPosition: key });
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
// assumption is that only one badge can exist at a time, so we can just return the first one.
|
|
126
|
+
const aboveBadge = aboveBadges.length ? aboveBadges[0] : null;
|
|
127
|
+
const belowBadges = productBadgesPDP.below;
|
|
128
|
+
const belowBadge = (belowBadges === null || belowBadges === void 0 ? void 0 : belowBadges.length) ? belowBadges[0] : null;
|
|
129
|
+
const showSoldOutBadge = !product.availableForSale && !((_c = config.quickAdd) === null || _c === void 0 ? void 0 : _c.enabled);
|
|
130
|
+
return (_jsx("div", Object.assign({ className: `w-1/2` }, { children: _jsxs("div", Object.assign({ className: "w-full" }, { children: [((_d = config.productImage) === null || _d === void 0 ? void 0 : _d.enabled) && (_jsxs("div", Object.assign({ className: "relative w-full overflow-hidden", style: {
|
|
131
|
+
borderTopLeftRadius: `${config.productImage.cornerRadius}px`,
|
|
132
|
+
borderTopRightRadius: `${config.productImage.cornerRadius}px`,
|
|
133
|
+
} }, { children: [_jsx(ProductImage, { src: src }), aboveBadge && product.availableForSale && (_jsx(Badge, Object.assign({ size: "plp-layout", className: cn(productCardBadgeVariants({
|
|
134
|
+
verticalPosition: aboveBadge.verticalPosition,
|
|
135
|
+
horizontalPosition: aboveBadge.horizontalPosition,
|
|
136
|
+
})), style: {
|
|
137
|
+
color: aboveBadge.fontColor,
|
|
138
|
+
backgroundColor: aboveBadge.backgroundColor,
|
|
139
|
+
}, alignment: aboveBadge.horizontalPosition, cornerRadius: aboveBadge.cornerRadius, icon: aboveBadge.image }, { children: aboveBadge.text }))), showSoldOutBadge && (_jsx(Badge, Object.assign({ size: "plp-layout", className: "absolute left-0 bottom-0 mb-2 bg-stateColors-disabled", alignment: "start", cornerRadius: "rounded", type: "text-only" }, { children: "Sold Out" }))), ((_e = config.favoritesIcon) === null || _e === void 0 ? void 0 : _e.enabled) && iconPosition !== "below-image-on-right" && (_jsx(Favorite, { className: cn(productCardFavoriteVariants({ iconPosition, badgeHorizontalPosition: aboveBadge === null || aboveBadge === void 0 ? void 0 : aboveBadge.horizontalPosition, badgeVerticalPosition: aboveBadge === null || aboveBadge === void 0 ? void 0 : aboveBadge.verticalPosition, showSoldOutBadge })), selected: favorited, onClick: (e) => { onFavoriteClick === null || onFavoriteClick === void 0 ? void 0 : onFavoriteClick(e, product); }, icon: ((_g = (_f = config.favoritesIcon) === null || _f === void 0 ? void 0 : _f.icon) === null || _g === void 0 ? void 0 : _g.type) === "internal" ? (_j = (_h = config.favoritesIcon) === null || _h === void 0 ? void 0 : _h.icon) === null || _j === void 0 ? void 0 : _j.url : undefined }))] }))), ((_k = config.quickAdd) === null || _k === void 0 ? void 0 : _k.enabled) && (_jsx(Button, Object.assign({ className: "outline-0", style: {
|
|
140
|
+
borderBottomLeftRadius: `${config.quickAdd.cornerRadius}px`,
|
|
141
|
+
borderBottomRightRadius: `${config.quickAdd.cornerRadius}px`,
|
|
142
|
+
}, labelClassName: cn("outline-0 w-full", { "uppercase": (_l = config.quickAdd) === null || _l === void 0 ? void 0 : _l.uppercase }, { "text-left": ((_m = config.quickAdd) === null || _m === void 0 ? void 0 : _m.textAlignment) === "left" }, { "text-right": ((_o = config.quickAdd) === null || _o === void 0 ? void 0 : _o.textAlignment) === "right" }, { "text-center": ((_p = config.quickAdd) === null || _p === void 0 ? void 0 : _p.textAlignment) === "center" }), labelStyle: { fontSize: (_q = config.quickAdd) === null || _q === void 0 ? void 0 : _q.fontSize }, variant: "quickadd", size: "default", onClick: (e) => {
|
|
143
|
+
e.stopPropagation();
|
|
144
|
+
onQuickAdd === null || onQuickAdd === void 0 ? void 0 : onQuickAdd(e, product);
|
|
145
|
+
} }, { children: "+ Quick add" }))), _jsxs("div", Object.assign({ className: "w-full flex-col justify-start items-start gap-0 inline-flex" }, { children: [belowBadge && (_jsx("div", Object.assign({ className: cn("mt-2 w-full flex justify-start", { "justify-end": belowBadge.horizontalPosition === "end" }) }, { children: _jsx(Badge, Object.assign({ size: "plp-layout", alignment: belowBadge.horizontalPosition, icon: belowBadge.image, className: cn("truncate", { "rounded": belowBadge.cornerRadius === "rounded" }, { "rounded-none": belowBadge.cornerRadius === "square" }) }, { children: belowBadge.text })) }))), ((_r = config.productTitle) === null || _r === void 0 ? void 0 : _r.enabled) && (_jsx("div", Object.assign({ className: "mt-2 w-full" }, { children: _jsx(Text, Object.assign({ type: "body-secondary", className: cn({ "uppercase": (_s = config.productTitle) === null || _s === void 0 ? void 0 : _s.uppercase }, { "text-left": ((_t = config.productTitle) === null || _t === void 0 ? void 0 : _t.textAlignment) === "left" }, { "text-right": ((_u = config.productTitle) === null || _u === void 0 ? void 0 : _u.textAlignment) === "right" }, { "text-center": ((_v = config.productTitle) === null || _v === void 0 ? void 0 : _v.textAlignment) === "center" }, { "truncate": !((_w = config.productTitle) === null || _w === void 0 ? void 0 : _w.wrapText) }, { "text-wrap": (_x = config.productTitle) === null || _x === void 0 ? void 0 : _x.wrapText }, "text-textColors-productTitle"), style: { fontSize: (_y = config.productTitle) === null || _y === void 0 ? void 0 : _y.fontSize } }, { children: title })) }))), _jsxs("div", Object.assign({ className: cn("flex flex-row w-full gap-2 mt-1 justify-end", { "justify-start": ((_z = config.price) === null || _z === void 0 ? void 0 : _z.textAlignment) === "left" }, { "justify-end": ((_0 = config.price) === null || _0 === void 0 ? void 0 : _0.textAlignment) === "right" }, { "justify-center": ((_1 = config.price) === null || _1 === void 0 ? void 0 : _1.textAlignment) === "center" }) }, { children: [((_2 = config.price) === null || _2 === void 0 ? void 0 : _2.enabled) && (_jsx(Price, { price: parseFloat(variant.price.amount), isSale: !!variant.compareAtPrice && (variant.compareAtPrice && parseFloat((_3 = variant.compareAtPrice) === null || _3 === void 0 ? void 0 : _3.amount) > parseFloat(variant.price.amount)), compareAtPrice: variant.compareAtPrice && parseFloat((_4 = variant.compareAtPrice) === null || _4 === void 0 ? void 0 : _4.amount), currency: tapcartData.currency.code, locale: tapcartData.currency.locale, fontSize: (_5 = config.price) === null || _5 === void 0 ? void 0 : _5.fontSize })), ((_6 = config.favoritesIcon) === null || _6 === void 0 ? void 0 : _6.enabled) && config.favoritesIcon.layoutType === "below-image-on-right" && (_jsx("div", Object.assign({ className: "w-8 h-8 flex items-center justify-center" }, { children: _jsx(Favorite, { selected: favorited, onClick: (e) => { onFavoriteClick === null || onFavoriteClick === void 0 ? void 0 : onFavoriteClick(e, product); }, size: "small", icon: ((_8 = (_7 = config.favoritesIcon) === null || _7 === void 0 ? void 0 : _7.icon) === null || _8 === void 0 ? void 0 : _8.type) === "internal" ? (_10 = (_9 = config.favoritesIcon) === null || _9 === void 0 ? void 0 : _9.icon) === null || _10 === void 0 ? void 0 : _10.url : undefined }) })))] }))] }))] })) })));
|
|
39
146
|
};
|
|
40
147
|
export { ProductCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/product-grid.tsx"],"names":[],"mappings":"AAkBA,
|
|
1
|
+
{"version":3,"file":"product-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/product-grid.tsx"],"names":[],"mappings":"AAkBA,KAAK,OAAO,GAAG,GAAG,CAAA;AAClB,UAAU,QAAQ;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,QAAQ,EAAE,CAAA;IACvB,gBAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IACpD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5B;AAED,iBAAS,WAAW,CAAC,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,MAAM,GACP,EAAE,qBAAqB,2CAmCvB;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useInfiniteScroll } from "
|
|
3
|
+
import { useInfiniteScroll } from "../hooks/use-infinite-scroll";
|
|
4
4
|
import { ProductCard } from "./product-card";
|
|
5
5
|
const Loader = () => (_jsx("div", Object.assign({ className: "grid-cols-2 lg:grid-cols-3" }, { children: Array(4)
|
|
6
6
|
.fill(0)
|
|
7
|
-
.map((_, index) => (_jsx("div", { className: "aspect-[2/3] animate-pulse bg-neutral-100 dark:bg-neutral-900" }, index))) })
|
|
7
|
+
.map((_, index) => (_jsx("div", { className: "aspect-[2/3] animate-pulse bg-neutral-100 dark:bg-neutral-900" }, index))) })));
|
|
8
8
|
function ProductGrid({ loadMoreProducts, initialData, queryVariables, config, }) {
|
|
9
9
|
const { data, error, isLoadingInitialData, isLoadingMore, isEmpty, isReachingEnd, ref, products, } = useInfiniteScroll({
|
|
10
10
|
initialData,
|
|
@@ -12,11 +12,11 @@ function ProductGrid({ loadMoreProducts, initialData, queryVariables, config, })
|
|
|
12
12
|
queryVariables,
|
|
13
13
|
});
|
|
14
14
|
if (error)
|
|
15
|
-
return _jsx("div", { children: "Failed to load data" }
|
|
15
|
+
return _jsx("div", { children: "Failed to load data" });
|
|
16
16
|
if (isLoadingInitialData)
|
|
17
|
-
return _jsx(Loader, {}
|
|
17
|
+
return _jsx(Loader, {});
|
|
18
18
|
return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "grid-cols-2 lg:grid-cols-3" }, { children: products.map((product, i) => (_jsx(ProductCard, {
|
|
19
19
|
// @ts-expect-error
|
|
20
|
-
product: product, config: config, isLoading: false }, product.handle))) })
|
|
20
|
+
product: product, config: config, isLoading: false }, product.handle))) })), isLoadingMore ? _jsx(Loader, {}) : _jsx("div", { ref: ref })] }));
|
|
21
21
|
}
|
|
22
22
|
export { ProductGrid };
|
|
@@ -14,12 +14,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
16
16
|
import { cva } from "class-variance-authority";
|
|
17
|
-
import { cn } from "
|
|
17
|
+
import { cn } from "../../lib/utils";
|
|
18
18
|
import { Icon } from "./icon";
|
|
19
19
|
import { Text } from "./text";
|
|
20
20
|
const RadioGroup = React.forwardRef((_a, ref) => {
|
|
21
21
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
22
|
-
return (_jsx(RadioGroupPrimitive.Root, Object.assign({ className: cn("grid gap-4", className) }, props, { ref: ref })
|
|
22
|
+
return (_jsx(RadioGroupPrimitive.Root, Object.assign({ className: cn("grid gap-4", className) }, props, { ref: ref })));
|
|
23
23
|
});
|
|
24
24
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
25
25
|
const radiogroupItemVariants = cva("grid grid-cols-[auto,auto,1fr] gap-2 items-start group", {
|
|
@@ -34,10 +34,10 @@ const radiogroupItemVariants = cva("grid grid-cols-[auto,auto,1fr] gap-2 items-s
|
|
|
34
34
|
variant: "default",
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
|
-
const RadioGroupItemLabels = ({ key, label, numberAmount, subtext, }) => (_jsxs("div", Object.assign({ className: "col-span-2" }, { children: [_jsxs("div", Object.assign({ className: "flex flex-row items-start" }, { children: [_jsx(Text, Object.assign({ type: "body-primary", className: "group-disabled:text-stateColors-disabled mr-2" }, { children: label })
|
|
37
|
+
const RadioGroupItemLabels = ({ key, label, numberAmount, subtext, }) => (_jsxs("div", Object.assign({ className: "col-span-2" }, { children: [_jsxs("div", Object.assign({ className: "flex flex-row items-start" }, { children: [_jsx(Text, Object.assign({ type: "body-primary", className: "group-disabled:text-stateColors-disabled mr-2" }, { children: label })), numberAmount ? (_jsx(Text, Object.assign({ type: "body-primary", className: "text-textColors-secondaryColor group-disabled:text-stateColors-disabled" }, { children: `(${numberAmount})` }))) : null] })), subtext ? (_jsx(Text, Object.assign({ type: "body-secondary", className: "group-disabled:text-stateColors-disabled mt-2" }, { children: subtext }))) : null] })));
|
|
38
38
|
const RadioGroupItem = React.forwardRef((_a, ref) => {
|
|
39
39
|
var { value, label = "", subtext, numberAmount = 0, onSelect, onClick, selected = false, className, variant = "default", key } = _a, props = __rest(_a, ["value", "label", "subtext", "numberAmount", "onSelect", "onClick", "selected", "className", "variant", "key"]);
|
|
40
|
-
return (_jsx("div", Object.assign({ className: cn(radiogroupItemVariants({ variant }), className) }, { children: variant === "deactivated" ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "circle-off", size: "md", className: "text-stateColors-disabled" }
|
|
40
|
+
return (_jsx("div", Object.assign({ className: cn(radiogroupItemVariants({ variant }), className) }, { children: variant === "deactivated" ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "circle-off", size: "md", className: "text-stateColors-disabled" }), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] })) : (_jsx(RadioGroupPrimitive.Item, Object.assign({ ref: ref, value: value, onSelect: onSelect, checked: selected, onClick: onClick, className: cn("flex items-center justify-center", className) }, props, { children: selected || variant === "selected" ? (_jsxs("div", Object.assign({ className: "grid grid-cols-[auto,auto,1fr] gap-2 items-start group" }, { children: [_jsx(Icon, { name: "circle-dot-filled", size: "md", className: "text-coreColors-brandColorPrimary z-10" }), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] }))) : (_jsxs("div", Object.assign({ className: "grid grid-cols-[auto,auto,1fr] gap-2 items-start group" }, { children: [_jsxs("div", Object.assign({ className: "grid" }, { children: [_jsx(RadioGroupPrimitive.Indicator, Object.assign({ className: "flex items-center justify-center col-start-1 row-start-1" }, { children: _jsx(Icon, { name: "circle-dot-filled", size: "md", className: "text-coreColors-brandColorPrimary z-10" }) })), _jsx("div", Object.assign({ className: "flex items-center justify-center col-start-1 row-start-1" }, { children: _jsx(Icon, { name: "circle", size: "md", className: "col-start-1 row-start-1 text-coreColors-secondaryIcon items-center z-1" }) }))] })), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] }))) }))) })));
|
|
41
41
|
});
|
|
42
42
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
43
43
|
export { RadioGroup, RadioGroupItem, radiogroupItemVariants };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
3
|
-
|
|
3
|
+
type Orientation = "horizontal" | "vertical";
|
|
4
4
|
declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
6
6
|
orientation?: Orientation | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../../components/ui/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAA;AAIlE,
|
|
1
|
+
{"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../../components/ui/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAA;AAIlE,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAA;AAE5C,QAAA,MAAM,UAAU,+JAed,CAAA;AAGF,QAAA,MAAM,SAAS;;wCAuBb,CAAA;AAGF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -16,14 +16,14 @@ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
|
16
16
|
import { cn } from "../../lib/utils";
|
|
17
17
|
const ScrollArea = React.forwardRef((_a, ref) => {
|
|
18
18
|
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
19
|
-
return (_jsxs(ScrollAreaPrimitive.Root, Object.assign({ ref: ref, className: cn("relative overflow-hidden", className) }, props, { children: [_jsx(ScrollAreaPrimitive.Viewport, Object.assign({ className: "h-full w-full rounded-[inherit]" }, { children: _jsx("div", Object.assign({ className: "flex w-max px-[16px]" }, { children: children })
|
|
19
|
+
return (_jsxs(ScrollAreaPrimitive.Root, Object.assign({ ref: ref, className: cn("relative overflow-hidden", className) }, props, { children: [_jsx(ScrollAreaPrimitive.Viewport, Object.assign({ className: "h-full w-full rounded-[inherit]" }, { children: _jsx("div", Object.assign({ className: "flex w-max px-[16px]" }, { children: children })) })), _jsx(ScrollBar, {}), _jsx(ScrollAreaPrimitive.Corner, {})] })));
|
|
20
20
|
});
|
|
21
21
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
22
22
|
const ScrollBar = React.forwardRef((_a, ref) => {
|
|
23
23
|
var { className, orientation = "horizontal" } = _a, props = __rest(_a, ["className", "orientation"]);
|
|
24
24
|
return (_jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, Object.assign({ ref: ref, orientation: orientation, className: cn("flex touch-none select-none transition-colors", orientation === "vertical" &&
|
|
25
25
|
"h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" &&
|
|
26
|
-
"h-2.5 flex-col border-t border-t-transparent p-[1px] ", className) }, props, { children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" }
|
|
26
|
+
"h-2.5 flex-col border-t border-t-transparent p-[1px] ", className) }, props, { children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" }) })));
|
|
27
27
|
});
|
|
28
28
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
29
29
|
export { ScrollArea, ScrollBar };
|
|
@@ -4,7 +4,7 @@ declare const selectorsVariants: (props?: ({
|
|
|
4
4
|
selected?: boolean | null | undefined;
|
|
5
5
|
disabled?: boolean | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
-
|
|
7
|
+
type SelectorsProps = React.ComponentPropsWithoutRef<"button"> & VariantProps<typeof selectorsVariants> & {
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
selected?: boolean;
|
|
10
10
|
label?: string;
|
|
@@ -21,7 +21,7 @@ declare const Selectors: React.ForwardRefExoticComponent<Omit<React.DetailedHTML
|
|
|
21
21
|
key?: string | undefined;
|
|
22
22
|
onSelect?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
23
23
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
24
|
-
|
|
24
|
+
type SelectorContainerProps = {
|
|
25
25
|
children: React.ReactElement<SelectorsProps>[];
|
|
26
26
|
containerRef: React.RefObject<HTMLButtonElement>;
|
|
27
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../components/ui/selectors.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,iBAAiB;;;mFAiBtB,CAAA;AAED,
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../components/ui/selectors.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,iBAAiB;;;mFAiBtB,CAAA;AAED,KAAK,cAAc,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAC5D,YAAY,CAAC,OAAO,iBAAiB,CAAC,GAAG;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAA;CAClE,CAAA;AAEH,QAAA,MAAM,SAAS;;;;;;;;eAHA,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS;2CA6BpE,CAAA;AACD,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAA;IAC9C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAA;CACjD,CAAA;AACD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAQvD,CAAA;AAID,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -13,7 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import { cva } from "class-variance-authority";
|
|
16
|
-
import { cn } from "
|
|
16
|
+
import { cn } from "../../lib/utils";
|
|
17
17
|
import { Text } from "./text";
|
|
18
18
|
const selectorsVariants = cva("flex py-2 px-4 whitespace-nowrap bg-coreColors-pageColor flex-row justify-center outline outline-1 rounded text-textColors-primaryColor outline-coreColors-dividingLines items-center", {
|
|
19
19
|
variants: {
|
|
@@ -36,10 +36,10 @@ const Selectors = React.forwardRef((_a, ref) => {
|
|
|
36
36
|
selected: selected,
|
|
37
37
|
className,
|
|
38
38
|
disabled,
|
|
39
|
-
}), "group"), ref: ref }, props, { children: _jsx(Text, Object.assign({ type: "body-primary", color: "text-textColors-primaryColor" }, { children: label })
|
|
39
|
+
}), "group"), ref: ref }, props, { children: _jsx(Text, Object.assign({ type: "body-primary", color: "text-textColors-primaryColor" }, { children: label })) })));
|
|
40
40
|
});
|
|
41
41
|
const SelectorContainer = ({ children }) => {
|
|
42
|
-
return (_jsx("div", Object.assign({ className: "flex gap-2 px-1 h-[42px] items-center overflow-x-auto" }, { children: children.map((chip, index) => (_jsx("div", { children: chip }, index))) })
|
|
42
|
+
return (_jsx("div", Object.assign({ className: "flex gap-2 px-1 h-[42px] items-center overflow-x-auto" }, { children: children.map((chip, index) => (_jsx("div", { children: chip }, index))) })));
|
|
43
43
|
};
|
|
44
44
|
Selectors.displayName = "Selectors";
|
|
45
45
|
export { SelectorContainer, Selectors, selectorsVariants };
|
|
@@ -16,7 +16,7 @@ import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
|
16
16
|
import { cn } from "../../lib/utils";
|
|
17
17
|
const Separator = React.forwardRef((_a, ref) => {
|
|
18
18
|
var { className, orientation = "horizontal", decorative = true } = _a, props = __rest(_a, ["className", "orientation", "decorative"]);
|
|
19
|
-
return (_jsx(SeparatorPrimitive.Root, Object.assign({ ref: ref, decorative: decorative, orientation: orientation, className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className) }, props)
|
|
19
|
+
return (_jsx(SeparatorPrimitive.Root, Object.assign({ ref: ref, decorative: decorative, orientation: orientation, className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className) }, props)));
|
|
20
20
|
});
|
|
21
21
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
22
22
|
export { Separator };
|
|
@@ -16,7 +16,7 @@ import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
|
16
16
|
import { cn } from "../../lib/utils";
|
|
17
17
|
const Switch = React.forwardRef((_a, ref) => {
|
|
18
18
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
19
|
-
return (_jsx(SwitchPrimitives.Root, Object.assign({ className: cn("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className) }, props, { ref: ref }, { children: _jsx(SwitchPrimitives.Thumb, { className: cn("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0") }
|
|
19
|
+
return (_jsx(SwitchPrimitives.Root, Object.assign({ className: cn("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className) }, props, { ref: ref }, { children: _jsx(SwitchPrimitives.Thumb, { className: cn("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0") }) })));
|
|
20
20
|
});
|
|
21
21
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
22
22
|
export { Switch };
|
|
@@ -13,7 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import { cva } from "class-variance-authority";
|
|
16
|
-
import { cn } from "
|
|
16
|
+
import { cn } from "../../lib/utils";
|
|
17
17
|
import { Text } from "./text";
|
|
18
18
|
const tabVariants = cva("flex items-center justify-center px-4 py-2 w-full", {
|
|
19
19
|
variants: {
|
|
@@ -29,7 +29,7 @@ const tabVariants = cva("flex items-center justify-center px-4 py-2 w-full", {
|
|
|
29
29
|
const Tab = ({ label, isActive = false, onClick }) => {
|
|
30
30
|
return (_jsx("button", Object.assign({ className: cn(tabVariants({
|
|
31
31
|
isActive,
|
|
32
|
-
})), onClick: onClick }, { children: _jsx(Text, Object.assign({ type: "body-primary" }, { children: label })
|
|
32
|
+
})), onClick: onClick }, { children: _jsx(Text, Object.assign({ type: "body-primary" }, { children: label })) })));
|
|
33
33
|
};
|
|
34
34
|
const Tabs = React.forwardRef((_a, ref) => {
|
|
35
35
|
var { className, tabs, activeTab, onTabChange } = _a, props = __rest(_a, ["className", "tabs", "activeTab", "onTabChange"]);
|
|
@@ -90,7 +90,7 @@ const Tabs = React.forwardRef((_a, ref) => {
|
|
|
90
90
|
return (_jsxs("div", Object.assign({ className: "relative" }, props, { children: [_jsxs("div", Object.assign({ ref: containerRef, className: "relative flex overflow-x-auto", onScroll: checkShowGradients }, { children: [tabs.map((tab, index) => (_jsx(Tab, { label: tab.label, isActive: activeTab === index, onClick: () => onTabChange(index) }, index))), _jsx("div", { className: `absolute bottom-0 bg-coreColors-brandColorPrimary h-[2px] transition-all duration-300`, style: {
|
|
91
91
|
left: underlinePosition.left,
|
|
92
92
|
width: underlinePosition.width,
|
|
93
|
-
} }
|
|
93
|
+
} })] })), showRightGradient ? (_jsx("div", { className: "absolute right-0 bottom-0 w-16 h-10 bg-[linear-gradient(90deg,#ffffff00_0%,#FFF_100%)] pointer-events-none" })) : (_jsx(_Fragment, {})), showLeftGradient ? (_jsx("div", { className: "absolute left-0 bottom-0 w-16 h-10 bg-[linear-gradient(270deg,#ffffff00_0%,#FFF_100%)] pointer-events-none" })) : (_jsx(_Fragment, {}))] })));
|
|
94
94
|
});
|
|
95
95
|
Tabs.displayName = "Tabs";
|
|
96
96
|
export { Tabs };
|
|
@@ -15,11 +15,11 @@ import { cn } from "../../lib/utils";
|
|
|
15
15
|
const textVariants = cva("", {
|
|
16
16
|
variants: {
|
|
17
17
|
type: {
|
|
18
|
-
h1: "text-[23px] font-
|
|
19
|
-
h2: "text-lg font-
|
|
20
|
-
"body-primary": "text-[15px] font-
|
|
21
|
-
"body-secondary": "text-[12px] font-
|
|
22
|
-
label: "text-[10px] font-
|
|
18
|
+
h1: "text-[23px] font-fontRegular leading-[130%] font-normal text-textColors-primaryColor",
|
|
19
|
+
h2: "text-lg font-fontMedium leading-[130%] font-medium text-textColors-primaryColor",
|
|
20
|
+
"body-primary": "text-[15px] font-fontRegular leading-[160%] font-normal text-textColors-primaryColor",
|
|
21
|
+
"body-secondary": "text-[12px] font-fontRegular leading-[130%] font-normal text-textColors-secondaryColor",
|
|
22
|
+
label: "text-[10px] font-fontRegular leading-[130%] font-normal text-textColors-secondaryColor",
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
defaultVariants: {
|
|
@@ -28,6 +28,6 @@ const textVariants = cva("", {
|
|
|
28
28
|
});
|
|
29
29
|
function Text(_a) {
|
|
30
30
|
var { className, type } = _a, props = __rest(_a, ["className", "type"]);
|
|
31
|
-
return _jsx("p", Object.assign({ className: cn(textVariants({ type }), className) }, props)
|
|
31
|
+
return _jsx("p", Object.assign({ className: cn(textVariants({ type }), className) }, props));
|
|
32
32
|
}
|
|
33
33
|
export { Text, textVariants };
|
|
@@ -9,12 +9,12 @@ declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastP
|
|
|
9
9
|
declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
10
10
|
declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
11
|
declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
|
|
12
|
+
type ToastType = "default" | "warning" | "error" | "success";
|
|
13
13
|
declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
14
14
|
type?: "default" | "error" | "warning" | "success" | undefined;
|
|
15
15
|
icon?: boolean | undefined;
|
|
16
16
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
|
|
18
|
+
type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
|
19
19
|
export { type ToastProps, type ToastActionElement, ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, type ToastType, };
|
|
20
20
|
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../components/ui/toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAOjE,QAAA,MAAM,aAAa,8CAA2B,CAAA;AAE9C,QAAA,MAAM,aAAa,kKAYjB,CAAA;AAgCF,QAAA,MAAM,KAAK;;0HAYT,CAAA;AAGF,QAAA,MAAM,WAAW,kKAYf,CAAA;AAGF,QAAA,MAAM,UAAU,iKAed,CAAA;AAGF,QAAA,MAAM,UAAU,2JASd,CAAA;AAEF,
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../components/ui/toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAOjE,QAAA,MAAM,aAAa,8CAA2B,CAAA;AAE9C,QAAA,MAAM,aAAa,kKAYjB,CAAA;AAgCF,QAAA,MAAM,KAAK;;0HAYT,CAAA;AAGF,QAAA,MAAM,WAAW,kKAYf,CAAA;AAGF,QAAA,MAAM,UAAU,iKAed,CAAA;AAGF,QAAA,MAAM,UAAU,2JASd,CAAA;AAEF,KAAK,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;AAiC5D,QAAA,MAAM,gBAAgB;;;wCAiBpB,CAAA;AAGF,KAAK,UAAU,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,CAAA;AAE9D,KAAK,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAA;AAEhE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,aAAa,EACb,aAAa,EACb,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,KAAK,SAAS,GACf,CAAA"}
|
|
@@ -21,7 +21,7 @@ import { Text } from "./text";
|
|
|
21
21
|
const ToastProvider = ToastPrimitives.Provider;
|
|
22
22
|
const ToastViewport = React.forwardRef((_a, ref) => {
|
|
23
23
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
24
|
-
return (_jsx(ToastPrimitives.Viewport, Object.assign({ ref: ref, className: cn("fixed z-[100] top-0 flex max-h-screen w-full flex-col items-center right-0", className) }, props)
|
|
24
|
+
return (_jsx(ToastPrimitives.Viewport, Object.assign({ ref: ref, className: cn("fixed z-[100] top-0 flex max-h-screen w-full flex-col items-center right-0", className) }, props)));
|
|
25
25
|
});
|
|
26
26
|
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
27
27
|
const toastVariants = cva(`fixed w-full pb-4 pt-12 px-4 h-auto group pointer-events-auto flex items-center justify-between shadow-[0_0_6px_0_rgba(17,17,17,0.16)] transition-all
|
|
@@ -50,22 +50,22 @@ const toastVariants = cva(`fixed w-full pb-4 pt-12 px-4 h-auto group pointer-eve
|
|
|
50
50
|
});
|
|
51
51
|
const Toast = React.forwardRef((_a, ref) => {
|
|
52
52
|
var { className, variant } = _a, props = __rest(_a, ["className", "variant"]);
|
|
53
|
-
return (_jsx(ToastPrimitives.Root, Object.assign({ ref: ref, className: cn(toastVariants({ variant }), className) }, props)
|
|
53
|
+
return (_jsx(ToastPrimitives.Root, Object.assign({ ref: ref, className: cn(toastVariants({ variant }), className) }, props)));
|
|
54
54
|
});
|
|
55
55
|
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
56
56
|
const ToastAction = React.forwardRef((_a, ref) => {
|
|
57
57
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
58
|
-
return (_jsx(ToastPrimitives.Action, Object.assign({ ref: ref, className: cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive", className) }, props)
|
|
58
|
+
return (_jsx(ToastPrimitives.Action, Object.assign({ ref: ref, className: cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive", className) }, props)));
|
|
59
59
|
});
|
|
60
60
|
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
61
61
|
const ToastClose = React.forwardRef((_a, ref) => {
|
|
62
62
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
63
|
-
return (_jsx(ToastPrimitives.Close, Object.assign({ ref: ref, className: cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600", className), "toast-close": "" }, props, { children: _jsx(X, { className: "h-4 w-4" }
|
|
63
|
+
return (_jsx(ToastPrimitives.Close, Object.assign({ ref: ref, className: cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600", className), "toast-close": "" }, props, { children: _jsx(X, { className: "h-4 w-4" }) })));
|
|
64
64
|
});
|
|
65
65
|
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
66
66
|
const ToastTitle = React.forwardRef((_a, ref) => {
|
|
67
67
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
68
|
-
return (_jsx(ToastPrimitives.Title, Object.assign({ ref: ref, className: cn("text-sm font-semibold", className) }, props)
|
|
68
|
+
return (_jsx(ToastPrimitives.Title, Object.assign({ ref: ref, className: cn("text-sm font-semibold", className) }, props)));
|
|
69
69
|
});
|
|
70
70
|
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
71
71
|
const ToastIcon = ({ type }) => {
|
|
@@ -88,11 +88,11 @@ const ToastIcon = ({ type }) => {
|
|
|
88
88
|
},
|
|
89
89
|
};
|
|
90
90
|
const logoType = logoTypes[type];
|
|
91
|
-
return _jsx(Icon, { name: logoType.name || "", size: "sm", color: logoType.color }
|
|
91
|
+
return _jsx(Icon, { name: logoType.name || "", size: "sm", color: logoType.color });
|
|
92
92
|
};
|
|
93
93
|
const ToastDescription = React.forwardRef((_a, ref) => {
|
|
94
94
|
var { className, type = "default", icon } = _a, props = __rest(_a, ["className", "type", "icon"]);
|
|
95
|
-
return (_jsxs(ToastPrimitives.Description, Object.assign({ ref: ref, className: cn("flex gap-4 items-center", className) }, props, { children: [icon ? _jsx(ToastIcon, { type: type }
|
|
95
|
+
return (_jsxs(ToastPrimitives.Description, Object.assign({ ref: ref, className: cn("flex gap-4 items-center", className) }, props, { children: [icon ? _jsx(ToastIcon, { type: type }) : null, _jsx(Text, Object.assign({ type: "body-primary", className: "line-clamp-2" }, { children: props.children }))] })));
|
|
96
96
|
});
|
|
97
97
|
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
98
98
|
export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
|
|
@@ -17,6 +17,6 @@ export function Toaster({ type = "default", }) {
|
|
|
17
17
|
const { toasts } = useToast();
|
|
18
18
|
return (_jsxs(ToastProvider, { children: [toasts.map(function (_a) {
|
|
19
19
|
var { id, title, description, icon } = _a, props = __rest(_a, ["id", "title", "description", "icon"]);
|
|
20
|
-
return (_jsx(Toast, Object.assign({ variant: type }, props, { children: _jsxs("div", Object.assign({ className: "flex w-full justify-center" }, { children: [title && _jsx(ToastTitle, { children: title }
|
|
21
|
-
}), _jsx(ToastViewport, {}
|
|
20
|
+
return (_jsx(Toast, Object.assign({ variant: type }, props, { children: _jsxs("div", Object.assign({ className: "flex w-full justify-center" }, { children: [title && _jsx(ToastTitle, { children: title }), description && (_jsx(ToastDescription, Object.assign({ type: type, icon: icon }, { children: description })))] })) }), id));
|
|
21
|
+
}), _jsx(ToastViewport, {})] }));
|
|
22
22
|
}
|
|
@@ -2,11 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
3
3
|
import { VariantProps } from "class-variance-authority";
|
|
4
4
|
declare const ToggleGroup: React.ForwardRefExoticComponent<((Omit<ToggleGroupPrimitive.ToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<ToggleGroupPrimitive.ToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref">) & VariantProps<(props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
6
|
size?: "sm" | "lg" | "default" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string>) & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
declare const ToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "outline" | null | undefined;
|
|
10
10
|
size?: "sm" | "lg" | "default" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -21,7 +21,7 @@ const ToggleGroupContext = React.createContext({
|
|
|
21
21
|
});
|
|
22
22
|
const ToggleGroup = React.forwardRef((_a, ref) => {
|
|
23
23
|
var { className, variant, size, children } = _a, props = __rest(_a, ["className", "variant", "size", "children"]);
|
|
24
|
-
return (_jsx(ToggleGroupPrimitive.Root, Object.assign({ ref: ref, className: cn("flex items-center justify-center gap-1", className) }, props, { children: _jsx(ToggleGroupContext.Provider, Object.assign({ value: { variant, size } }, { children: children })
|
|
24
|
+
return (_jsx(ToggleGroupPrimitive.Root, Object.assign({ ref: ref, className: cn("flex items-center justify-center gap-1", className) }, props, { children: _jsx(ToggleGroupContext.Provider, Object.assign({ value: { variant, size } }, { children: children })) })));
|
|
25
25
|
});
|
|
26
26
|
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
27
27
|
const ToggleGroupItem = React.forwardRef((_a, ref) => {
|
|
@@ -30,7 +30,7 @@ const ToggleGroupItem = React.forwardRef((_a, ref) => {
|
|
|
30
30
|
return (_jsx(ToggleGroupPrimitive.Item, Object.assign({ ref: ref, className: cn(toggleVariants({
|
|
31
31
|
variant: context.variant || variant,
|
|
32
32
|
size: context.size || size,
|
|
33
|
-
}), className) }, props, { children: children })
|
|
33
|
+
}), className) }, props, { children: children })));
|
|
34
34
|
});
|
|
35
35
|
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
36
36
|
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -2,11 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
3
3
|
import { type VariantProps } from "class-variance-authority";
|
|
4
4
|
declare const toggleVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
6
|
size?: "sm" | "lg" | "default" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare const Toggle: React.ForwardRefExoticComponent<Omit<TogglePrimitive.ToggleProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "outline" | null | undefined;
|
|
10
10
|
size?: "sm" | "lg" | "default" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
export { Toggle, toggleVariants };
|
|
@@ -34,7 +34,7 @@ const toggleVariants = cva("inline-flex items-center justify-center rounded-md t
|
|
|
34
34
|
});
|
|
35
35
|
const Toggle = React.forwardRef((_a, ref) => {
|
|
36
36
|
var { className, variant, size } = _a, props = __rest(_a, ["className", "variant", "size"]);
|
|
37
|
-
return (_jsx(TogglePrimitive.Root, Object.assign({ ref: ref, className: cn(toggleVariants({ variant, size, className })) }, props)
|
|
37
|
+
return (_jsx(TogglePrimitive.Root, Object.assign({ ref: ref, className: cn(toggleVariants({ variant, size, className })) }, props)));
|
|
38
38
|
});
|
|
39
39
|
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
40
40
|
export { Toggle, toggleVariants };
|