@tapcart/mobile-components 0.2.11 → 0.3.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.
Files changed (101) hide show
  1. package/dist/components/hooks/use-infinite-scroll.d.ts +2 -0
  2. package/dist/components/hooks/use-infinite-scroll.d.ts.map +1 -1
  3. package/dist/components/hooks/use-infinite-scroll.js +11 -6
  4. package/dist/components/hooks/use-scroll-direction.d.ts +8 -0
  5. package/dist/components/hooks/use-scroll-direction.d.ts.map +1 -0
  6. package/dist/components/hooks/use-scroll-direction.js +42 -0
  7. package/dist/components/ui/accordion.js +3 -3
  8. package/dist/components/ui/alert-dialog.js +8 -8
  9. package/dist/components/ui/badge.d.ts +4 -3
  10. package/dist/components/ui/badge.d.ts.map +1 -1
  11. package/dist/components/ui/badge.js +25 -7
  12. package/dist/components/ui/button.d.ts +3 -1
  13. package/dist/components/ui/button.d.ts.map +1 -1
  14. package/dist/components/ui/button.js +50 -15
  15. package/dist/components/ui/carousel.d.ts +5 -5
  16. package/dist/components/ui/carousel.d.ts.map +1 -1
  17. package/dist/components/ui/carousel.js +5 -5
  18. package/dist/components/ui/checkbox.d.ts.map +1 -1
  19. package/dist/components/ui/checkbox.js +6 -6
  20. package/dist/components/ui/chip.d.ts +2 -2
  21. package/dist/components/ui/chip.d.ts.map +1 -1
  22. package/dist/components/ui/chip.js +4 -4
  23. package/dist/components/ui/container.js +1 -1
  24. package/dist/components/ui/drawer.d.ts +3 -3
  25. package/dist/components/ui/drawer.d.ts.map +1 -1
  26. package/dist/components/ui/drawer.js +15 -13
  27. package/dist/components/ui/dropdown.d.ts +22 -0
  28. package/dist/components/ui/dropdown.d.ts.map +1 -0
  29. package/dist/components/ui/dropdown.js +60 -0
  30. package/dist/components/ui/favorite.d.ts +4 -2
  31. package/dist/components/ui/favorite.d.ts.map +1 -1
  32. package/dist/components/ui/favorite.js +11 -5
  33. package/dist/components/ui/grid.js +5 -5
  34. package/dist/components/ui/icon.d.ts +2 -2
  35. package/dist/components/ui/icon.d.ts.map +1 -1
  36. package/dist/components/ui/icon.js +36 -7
  37. package/dist/components/ui/image.d.ts +157 -0
  38. package/dist/components/ui/image.d.ts.map +1 -0
  39. package/dist/components/ui/image.js +318 -0
  40. package/dist/components/ui/input.js +1 -1
  41. package/dist/components/ui/label.js +1 -1
  42. package/dist/components/ui/line-item-text-icons.d.ts +14 -0
  43. package/dist/components/ui/line-item-text-icons.d.ts.map +1 -0
  44. package/dist/components/ui/line-item-text-icons.js +22 -0
  45. package/dist/components/ui/money.js +1 -1
  46. package/dist/components/ui/price.d.ts +2 -1
  47. package/dist/components/ui/price.d.ts.map +1 -1
  48. package/dist/components/ui/price.js +6 -6
  49. package/dist/components/ui/product-card.d.ts +79 -27
  50. package/dist/components/ui/product-card.d.ts.map +1 -1
  51. package/dist/components/ui/product-card.js +194 -34
  52. package/dist/components/ui/product-grid.d.ts +1 -1
  53. package/dist/components/ui/product-grid.d.ts.map +1 -1
  54. package/dist/components/ui/product-grid.js +5 -5
  55. package/dist/components/ui/quantity-picker.d.ts +14 -0
  56. package/dist/components/ui/quantity-picker.d.ts.map +1 -0
  57. package/dist/components/ui/quantity-picker.js +23 -0
  58. package/dist/components/ui/radio-group.js +4 -4
  59. package/dist/components/ui/scroll-area.d.ts +1 -1
  60. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  61. package/dist/components/ui/scroll-area.js +2 -2
  62. package/dist/components/ui/selectors.d.ts +3 -3
  63. package/dist/components/ui/selectors.d.ts.map +1 -1
  64. package/dist/components/ui/selectors.js +22 -6
  65. package/dist/components/ui/separator.js +1 -1
  66. package/dist/components/ui/skeleton.js +2 -2
  67. package/dist/components/ui/slider.d.ts +14 -0
  68. package/dist/components/ui/slider.d.ts.map +1 -0
  69. package/dist/components/ui/slider.js +50 -0
  70. package/dist/components/ui/subscription.d.ts +15 -0
  71. package/dist/components/ui/subscription.d.ts.map +1 -0
  72. package/dist/components/ui/subscription.js +24 -0
  73. package/dist/components/ui/switch.d.ts.map +1 -1
  74. package/dist/components/ui/switch.js +2 -2
  75. package/dist/components/ui/tabs.js +4 -4
  76. package/dist/components/ui/text.js +6 -6
  77. package/dist/components/ui/toast.d.ts +3 -3
  78. package/dist/components/ui/toast.d.ts.map +1 -1
  79. package/dist/components/ui/toast.js +7 -7
  80. package/dist/components/ui/toaster.js +2 -2
  81. package/dist/components/ui/toggle-group.d.ts +2 -2
  82. package/dist/components/ui/toggle-group.js +2 -2
  83. package/dist/components/ui/toggle.d.ts +2 -2
  84. package/dist/components/ui/toggle.js +2 -2
  85. package/dist/components/ui/use-toast.d.ts +6 -6
  86. package/dist/components/ui/use-toast.d.ts.map +1 -1
  87. package/dist/components/ui/video.js +1 -1
  88. package/dist/components/ui/wishlist.d.ts +2 -1
  89. package/dist/components/ui/wishlist.d.ts.map +1 -1
  90. package/dist/components/ui/wishlist.js +3 -3
  91. package/dist/index.d.ts +7 -0
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +7 -0
  94. package/dist/styles.css +210 -72
  95. package/package.json +9 -3
  96. package/dist/components/ThemeProvider.d.ts +0 -3
  97. package/dist/components/ThemeProvider.d.ts.map +0 -1
  98. package/dist/components/ThemeProvider.js +0 -18
  99. package/dist/components/ThemeToggle.d.ts +0 -2
  100. package/dist/components/ThemeToggle.d.ts.map +0 -1
  101. package/dist/components/ThemeToggle.js +0 -8
@@ -1,40 +1,200 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Badge } from "@/components/ui/badge";
4
- import { Button } from "@/components/ui/button";
5
- import { Text } from "@/components/ui/text";
6
- import { Price } from "@/components/ui/price";
7
- import { Icon } from "@/components/ui/icon";
8
- import { Skeleton } from "@/components/ui/skeleton";
9
- const positionClasses = {
10
- topLeft: "absolute top-0 left-0 mt-2",
11
- topRight: "absolute top-0 right-0 mt-2",
12
- bottomLeft: "absolute bottom-0 left-0 mb-2",
13
- bottomRight: "absolute bottom-0 right-0 mb-2",
14
- };
15
- var BadgeAlignment;
16
- (function (BadgeAlignment) {
17
- BadgeAlignment["Left"] = "left";
18
- BadgeAlignment["Right"] = "right";
19
- BadgeAlignment["FullWidth"] = "full-width";
20
- })(BadgeAlignment || (BadgeAlignment = {}));
21
- const badgeAlignmentClasses = {
22
- topLeft: BadgeAlignment.Left,
23
- topRight: BadgeAlignment.Right,
24
- bottomLeft: BadgeAlignment.Left,
25
- bottomRight: BadgeAlignment.Right,
26
- };
27
- const ProductCard = ({ product, scaling, className, badge, icon, quickAdd, openProduct, isQuickAddProductEnabled, isLoading, }) => {
28
- const { variants: [variant], images: [{ src }], title } = product;
29
- const badgePosition = (badge === null || badge === void 0 ? void 0 : badge.position) || "topRight";
30
- const iconPosition = (icon === null || icon === void 0 ? void 0 : icon.position) || "bottomRight";
31
- const scalingClass = scaling === "fit" ? "object-contain" : "object-cover";
3
+ import { Badge } from "./badge";
4
+ import { Favorite } from "./favorite";
5
+ import { Button } from "./button";
6
+ import { Text } from "./text";
7
+ import * as React from "react";
8
+ import { Price } from "./price";
9
+ import { Skeleton } from "./skeleton";
10
+ import { cn } from "../../lib/utils";
11
+ import { cva } from "class-variance-authority";
12
+ import { Image } from "./image";
13
+ const aspectScalingVariants = cva("w-full", {
14
+ variants: {
15
+ aspectRatio: {
16
+ "1:1": "aspect-square",
17
+ "2:3": "aspect-[2/3]",
18
+ "4:5": "aspect-[4/5]",
19
+ },
20
+ scaling: {
21
+ fill: "object-cover",
22
+ fit: "object-contain",
23
+ },
24
+ },
25
+ defaultVariants: {
26
+ aspectRatio: "2:3",
27
+ scaling: "fill",
28
+ },
29
+ });
30
+ const productCardBadgeVariants = cva("absolute truncate", {
31
+ variants: {
32
+ horizontalPosition: {
33
+ start: "left-0",
34
+ end: "right-0",
35
+ center: "",
36
+ },
37
+ verticalPosition: {
38
+ top: "top-0 mt-2",
39
+ bottom: "bottom-0 mb-2",
40
+ below: "",
41
+ },
42
+ },
43
+ });
44
+ const productCardFavoriteVariants = cva("absolute ", {
45
+ variants: {
46
+ iconPosition: {
47
+ "top-left": "top-0 left-2 mt-2",
48
+ "top-right": "top-0 right-2 mt-2",
49
+ "bottom-left": "bottom-0 left-2 mb-2",
50
+ "bottom-right": "bottom-0 right-2 mb-2",
51
+ "below-image-on-right": "",
52
+ },
53
+ badgeHorizontalPosition: {
54
+ start: "",
55
+ end: "",
56
+ center: "",
57
+ },
58
+ badgeVerticalPosition: {
59
+ top: "",
60
+ bottom: "",
61
+ below: "",
62
+ },
63
+ showSoldOutBadge: {
64
+ true: "",
65
+ false: "",
66
+ },
67
+ },
68
+ compoundVariants: [
69
+ {
70
+ iconPosition: "top-left",
71
+ badgeHorizontalPosition: ["start", "center"],
72
+ badgeVerticalPosition: "top",
73
+ class: "top-10",
74
+ },
75
+ {
76
+ iconPosition: "top-right",
77
+ badgeHorizontalPosition: ["end", "center"],
78
+ badgeVerticalPosition: "top",
79
+ class: "top-10",
80
+ },
81
+ {
82
+ iconPosition: "bottom-left",
83
+ badgeHorizontalPosition: ["start", "center"],
84
+ badgeVerticalPosition: "bottom",
85
+ class: "bottom-10",
86
+ },
87
+ {
88
+ iconPosition: "bottom-right",
89
+ badgeHorizontalPosition: ["end", "center"],
90
+ badgeVerticalPosition: "bottom",
91
+ class: "bottom-10",
92
+ },
93
+ {
94
+ iconPosition: "bottom-left",
95
+ showSoldOutBadge: true,
96
+ class: "bottom-10",
97
+ },
98
+ ],
99
+ defaultVariants: {
100
+ iconPosition: "below-image-on-right",
101
+ },
102
+ });
103
+ const ProductCard = ({ config, tapcartData, product, isLoading, favorited, onFavoriteClick, onQuickAdd, openProduct, }) => {
104
+ 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, _11, _12, _13, _14, _15;
105
+ const { variants, images, title, tags } = product;
106
+ // Select the variant that has the lowest price that is available or just the lowest price if none are available
107
+ let searchVariants = variants.filter((variant) => variant.available);
108
+ if (searchVariants.length === 0) {
109
+ searchVariants = variants;
110
+ }
111
+ const variant = searchVariants.reduce((lowest, current) => {
112
+ return current.price.amount < lowest.price.amount ? current : lowest;
113
+ });
114
+ const src = ((_a = images[0]) === null || _a === void 0 ? void 0 : _a.url) || "";
115
+ const [isSelected, setIsSelected] = React.useState(false);
116
+ const handleFavoriteClick = () => {
117
+ setIsSelected((prevState) => !prevState);
118
+ };
119
+ const iconPosition = ((_b = config.favoritesIcon) === null || _b === void 0 ? void 0 : _b.layoutType) || "below-image-on-right";
32
120
  if (isLoading) {
33
- return (_jsxs("div", Object.assign({ className: "w-1/2" }, { children: [_jsx(Skeleton, { className: "w-full h-64" }, void 0), _jsx(Skeleton, { className: "h-6 w-1/2 mt-2" }, void 0), _jsx(Skeleton, { className: "h-6 w-3/4 mt-2" }, void 0)] }), void 0));
121
+ 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
122
  }
35
- return (_jsxs("div", Object.assign({ className: "w-1/2" }, { children: [_jsxs("div", Object.assign({ className: "relative" }, { children: [_jsx("img", { className: `w-full h-full ${scalingClass} ${isQuickAddProductEnabled ? "rounded-t-lg rounded-b-none" : "rounded-lg"}`, src: src }, void 0), badge && (_jsx(Badge, Object.assign({ size: "plp-layout", icon: "currency-dollar", className: positionClasses[badgePosition], alignment: badgeAlignmentClasses[badgePosition] }, { children: badge.text }), void 0)), icon && (_jsx(Icon, { name: "HeartFilled", className: positionClasses[iconPosition], color: "stateColors-favorites" }, void 0))] }), void 0), isQuickAddProductEnabled && (_jsx(Button, Object.assign({ variant: "quickadd", size: "sm", onClick: (e) => {
36
- e.stopPropagation();
37
- quickAdd(e, product);
38
- } }, { children: "+ Quick add" }), void 0)), _jsx(Price, { price: variant.price, isSale: !!variant.compare_at_price, compareAtPrice: variant.compare_at_price, currency: "USD", locale: "en-US" }, void 0), _jsx(Text, Object.assign({ className: "text-textColors-productTitle" }, { children: title }), void 0)] }), void 0));
123
+ const productBadgesPDP = (_c = tapcartData === null || tapcartData === void 0 ? void 0 : tapcartData["product-badges"]) === null || _c === void 0 ? void 0 : _c.pdp;
124
+ const aboveBadgeKeys = Object.keys(productBadgesPDP).filter((key) => key !== "below");
125
+ const aboveBadges = aboveBadgeKeys.flatMap((key) => {
126
+ const badges = productBadgesPDP === null || productBadgesPDP === void 0 ? void 0 : productBadgesPDP[key];
127
+ return badges === null || badges === void 0 ? void 0 : badges.map((badge) => {
128
+ return Object.assign(Object.assign({}, badge), { verticalPosition: key });
129
+ });
130
+ });
131
+ // assumption is that only one badge can exist at a time, so we can just return the first one.
132
+ const aboveBadge = aboveBadges.length ? aboveBadges[0] : null;
133
+ const belowBadges = productBadgesPDP.below;
134
+ const belowBadge = (belowBadges === null || belowBadges === void 0 ? void 0 : belowBadges.length) ? belowBadges[0] : null;
135
+ const showSoldOutBadge = !product.availableForSale && !((_d = config.quickAdd) === null || _d === void 0 ? void 0 : _d.enabled);
136
+ // Remove Shopify GID info from product id
137
+ const productId = product.id;
138
+ const variantId = variant.id;
139
+ // Prepare Product Open
140
+ const _openProduct = () => openProduct === null || openProduct === void 0 ? void 0 : openProduct({ productId, variantId });
141
+ const getImageSizes = (config) => {
142
+ switch (config.gridLayout) {
143
+ case "1x1":
144
+ return "100vw";
145
+ case "2x2":
146
+ return "50vw";
147
+ case "3x3":
148
+ return "33vw";
149
+ default:
150
+ return "100vw";
151
+ }
152
+ };
153
+ const sizes = getImageSizes(config);
154
+ return (_jsx("div", Object.assign({ className: `w-1/2` }, { children: _jsxs("div", Object.assign({ className: "w-full active:opacity-70", onClick: () => {
155
+ _openProduct();
156
+ } }, { children: [((_e = config.productImage) === null || _e === void 0 ? void 0 : _e.enabled) && (_jsxs("div", Object.assign({ className: "relative w-full overflow-hidden", style: {
157
+ borderTopLeftRadius: `${config.productImage.cornerRadius}px`,
158
+ borderTopRightRadius: `${config.productImage.cornerRadius}px`,
159
+ } }, { children: [_jsx(Image, { alt: product.title, aspectRatio: (_g = (_f = tapcartData.theme) === null || _f === void 0 ? void 0 : _f.productImages) === null || _g === void 0 ? void 0 : _g.aspectRatio, data: product.featuredImage || product.images[0], sizes: sizes, objectFit: (_j = (_h = tapcartData.theme) === null || _h === void 0 ? void 0 : _h.productImages) === null || _j === void 0 ? void 0 : _j.scaling }), aboveBadge && product.availableForSale && (_jsx(Badge, Object.assign({ size: "plp-layout", className: cn(productCardBadgeVariants({
160
+ verticalPosition: aboveBadge.verticalPosition,
161
+ horizontalPosition: aboveBadge.horizontalPosition,
162
+ })), style: {
163
+ color: aboveBadge.fontColor,
164
+ backgroundColor: aboveBadge.backgroundColor,
165
+ }, 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" }))), ((_k = config.favoritesIcon) === null || _k === void 0 ? void 0 : _k.enabled) &&
166
+ iconPosition !== "below-image-on-right" && (_jsx(Favorite, { className: cn(productCardFavoriteVariants({
167
+ iconPosition,
168
+ badgeHorizontalPosition: aboveBadge === null || aboveBadge === void 0 ? void 0 : aboveBadge.horizontalPosition,
169
+ badgeVerticalPosition: aboveBadge === null || aboveBadge === void 0 ? void 0 : aboveBadge.verticalPosition,
170
+ showSoldOutBadge,
171
+ })), selected: favorited, onClick: (e) => {
172
+ onFavoriteClick === null || onFavoriteClick === void 0 ? void 0 : onFavoriteClick(e, product);
173
+ }, icon: ((_m = (_l = config.favoritesIcon) === null || _l === void 0 ? void 0 : _l.icon) === null || _m === void 0 ? void 0 : _m.type) === "internal"
174
+ ? (_p = (_o = config.favoritesIcon) === null || _o === void 0 ? void 0 : _o.icon) === null || _p === void 0 ? void 0 : _p.url
175
+ : undefined }))] }))), ((_q = config.quickAdd) === null || _q === void 0 ? void 0 : _q.enabled) && (_jsx(Button, Object.assign({ className: "outline-0", style: {
176
+ borderBottomLeftRadius: `${config.quickAdd.cornerRadius}px`,
177
+ borderBottomRightRadius: `${config.quickAdd.cornerRadius}px`,
178
+ }, labelClassName: cn("outline-0 w-full", { uppercase: (_r = config.quickAdd) === null || _r === void 0 ? void 0 : _r.uppercase }, { "text-left": ((_s = config.quickAdd) === null || _s === void 0 ? void 0 : _s.textAlignment) === "left" }, { "text-right": ((_t = config.quickAdd) === null || _t === void 0 ? void 0 : _t.textAlignment) === "right" }, { "text-center": ((_u = config.quickAdd) === null || _u === void 0 ? void 0 : _u.textAlignment) === "center" }), labelStyle: { fontSize: (_v = config.quickAdd) === null || _v === void 0 ? void 0 : _v.fontSize }, variant: "quickadd", size: "default", onClick: (e) => {
179
+ e.stopPropagation();
180
+ onQuickAdd === null || onQuickAdd === void 0 ? void 0 : onQuickAdd(e, product);
181
+ } }, { 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", {
182
+ "justify-end": belowBadge.horizontalPosition === "end",
183
+ }) }, { 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 })) }))), ((_w = config.productTitle) === null || _w === void 0 ? void 0 : _w.enabled) && (_jsx("div", Object.assign({ className: "mt-2 w-full" }, { children: _jsx(Text, Object.assign({ type: "body-secondary", className: cn({ uppercase: (_x = config.productTitle) === null || _x === void 0 ? void 0 : _x.uppercase }, {
184
+ "text-left": ((_y = config.productTitle) === null || _y === void 0 ? void 0 : _y.textAlignment) === "left",
185
+ }, {
186
+ "text-right": ((_z = config.productTitle) === null || _z === void 0 ? void 0 : _z.textAlignment) === "right",
187
+ }, {
188
+ "text-center": ((_0 = config.productTitle) === null || _0 === void 0 ? void 0 : _0.textAlignment) === "center",
189
+ }, { truncate: !((_1 = config.productTitle) === null || _1 === void 0 ? void 0 : _1.wrapText) }, { "text-wrap": (_2 = config.productTitle) === null || _2 === void 0 ? void 0 : _2.wrapText }, "text-textColors-productTitle"), style: { fontSize: (_3 = config.productTitle) === null || _3 === void 0 ? void 0 : _3.fontSize } }, { children: title })) }))), _jsxs("div", Object.assign({ className: cn("flex flex-row w-full gap-2 mt-1 justify-end", { "justify-start": ((_4 = config.price) === null || _4 === void 0 ? void 0 : _4.textAlignment) === "left" }, { "justify-end": ((_5 = config.price) === null || _5 === void 0 ? void 0 : _5.textAlignment) === "right" }, { "justify-center": ((_6 = config.price) === null || _6 === void 0 ? void 0 : _6.textAlignment) === "center" }) }, { children: [((_7 = config.price) === null || _7 === void 0 ? void 0 : _7.enabled) && (_jsx(Price, { price: parseFloat(variant.price.amount), isSale: !!variant.compareAtPrice &&
190
+ variant.compareAtPrice &&
191
+ parseFloat((_8 = variant.compareAtPrice) === null || _8 === void 0 ? void 0 : _8.amount) >
192
+ parseFloat(variant.price.amount), compareAtPrice: variant.compareAtPrice &&
193
+ parseFloat((_9 = variant.compareAtPrice) === null || _9 === void 0 ? void 0 : _9.amount), currency: tapcartData.currency.code, locale: tapcartData.currency.locale, fontSize: (_10 = config.price) === null || _10 === void 0 ? void 0 : _10.fontSize })), ((_11 = config.favoritesIcon) === null || _11 === void 0 ? void 0 : _11.enabled) &&
194
+ 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) => {
195
+ onFavoriteClick === null || onFavoriteClick === void 0 ? void 0 : onFavoriteClick(e, product);
196
+ }, size: "small", icon: ((_13 = (_12 = config.favoritesIcon) === null || _12 === void 0 ? void 0 : _12.icon) === null || _13 === void 0 ? void 0 : _13.type) === "internal"
197
+ ? (_15 = (_14 = config.favoritesIcon) === null || _14 === void 0 ? void 0 : _14.icon) === null || _15 === void 0 ? void 0 : _15.url
198
+ : undefined }) })))] }))] }))] })) })));
39
199
  };
40
200
  export { ProductCard };
@@ -1,4 +1,4 @@
1
- declare type Product = any;
1
+ type Product = any;
2
2
  interface PageData {
3
3
  products: Product[];
4
4
  cursorBlob?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"product-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/product-grid.tsx"],"names":[],"mappings":"AAkBA,aAAK,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
+ {"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 "@/components/hooks/use-infinite-scroll";
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))) }), void 0));
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" }, void 0);
15
+ return _jsx("div", { children: "Failed to load data" });
16
16
  if (isLoadingInitialData)
17
- return _jsx(Loader, {}, void 0);
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))) }), void 0), isLoadingMore ? _jsx(Loader, {}, void 0) : _jsx("div", { ref: ref }, void 0)] }, void 0));
20
+ product: product, config: config, isLoading: false }, product.handle))) })), isLoadingMore ? _jsx(Loader, {}) : _jsx("div", { ref: ref })] }));
21
21
  }
22
22
  export { ProductGrid };
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ export interface QuantityPickerProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ decreaseIcon: string;
4
+ increaseIcon: string;
5
+ deleteIcon: string;
6
+ onDecreaseClick: React.ReactEventHandler;
7
+ onIncreaseClick: React.ReactEventHandler;
8
+ value: number;
9
+ setValue: (_: number) => void;
10
+ className?: string;
11
+ }
12
+ declare const QuantityPicker: React.ForwardRefExoticComponent<QuantityPickerProps & React.RefAttributes<HTMLDivElement>>;
13
+ export { QuantityPicker };
14
+ //# sourceMappingURL=quantity-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAgBD,QAAA,MAAM,cAAc,4FAyCnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import * as React from "react";
15
+ import { cn } from "../../lib/utils";
16
+ import { Icon } from "./icon";
17
+ const IconButton = ({ icon, handler, className }) => (_jsx("button", Object.assign({ onClick: handler, className: cn("flex items-center justify-center h-8 w-8 bg-stateColors-skeleton outline outline-1 outline-stateColors-skeleton", className) }, { children: _jsx(Icon, { name: icon, size: "sm", color: "coreColors-secondaryIcon" }) })));
18
+ const QuantityPicker = React.forwardRef((_a, ref) => {
19
+ var { className, decreaseIcon, increaseIcon, deleteIcon, onDecreaseClick, onIncreaseClick, value, setValue } = _a, props = __rest(_a, ["className", "decreaseIcon", "increaseIcon", "deleteIcon", "onDecreaseClick", "onIncreaseClick", "value", "setValue"]);
20
+ return (_jsxs("div", Object.assign({ className: cn("flex", className), ref: ref }, props, { children: [_jsx(IconButton, { handler: onDecreaseClick, icon: value === 1 ? deleteIcon : decreaseIcon, className: "rounded-tl rounded-bl" }), _jsx("div", Object.assign({ className: "w-12 py-1 flex justify-center bg-coreColors-inputBackground outline outline-1 outline-coreColors-dividingLines text-[15px] font-sfpro-roboto leading-[160%] font-normal text-textColors-primaryColor" }, { children: _jsx("input", { type: "tel", pattern: "[0-9]*", value: value, onBlur: (e) => (e.target.value = value.toString()), onFocus: (e) => (e.target.value = ""), onChange: (e) => setValue(parseInt(e.target.value) || 0), className: "w-8 focus-visible:outline-none text-center" }) })), _jsx(IconButton, { handler: onIncreaseClick, icon: increaseIcon, className: "rounded-tr rounded-br" })] })));
21
+ });
22
+ QuantityPicker.displayName = "QuantityPicker";
23
+ export { QuantityPicker };
@@ -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 "@/lib/utils";
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 }), void 0));
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 }), void 0), numberAmount ? (_jsx(Text, Object.assign({ type: "body-primary", className: "text-textColors-secondaryColor group-disabled:text-stateColors-disabled" }, { children: `(${numberAmount})` }), void 0)) : null] }), void 0), subtext ? (_jsx(Text, Object.assign({ type: "body-secondary", className: "group-disabled:text-stateColors-disabled mt-2" }, { children: subtext }), void 0)) : null] }), void 0));
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" }, void 0), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] }, void 0)) : (_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" }, void 0), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] }), void 0)) : (_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" }, void 0) }), void 0), _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" }, void 0) }), void 0)] }), void 0), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] }), void 0)) }), void 0)) }), void 0));
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 active:opacity-70", 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
- declare type Orientation = "horizontal" | "vertical";
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,aAAK,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"}
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 }), void 0) }), void 0), _jsx(ScrollBar, {}, void 0), _jsx(ScrollAreaPrimitive.Corner, {}, void 0)] }), void 0));
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" }, void 0) }), void 0));
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
- declare type SelectorsProps = React.ComponentPropsWithoutRef<"button"> & VariantProps<typeof selectorsVariants> & {
7
+ type SelectorsProps = React.ComponentPropsWithoutRef<"button"> & VariantProps<typeof selectorsVariants> & {
8
8
  disabled?: boolean;
9
9
  selected?: boolean;
10
10
  label?: string;
@@ -21,9 +21,9 @@ 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
- declare type SelectorContainerProps = {
24
+ type SelectorContainerProps = {
25
25
  children: React.ReactElement<SelectorsProps>[];
26
- containerRef: React.RefObject<HTMLButtonElement>;
26
+ containerRef: React.RefObject<HTMLDivElement>;
27
27
  };
28
28
  declare const SelectorContainer: React.FC<SelectorContainerProps>;
29
29
  export { SelectorContainer, Selectors, selectorsVariants };
@@ -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,aAAK,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,aAAK,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"}
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;AACD,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,cAAc,CAAC,CAAA;CAC9C,CAAA;AACD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAyCvD,CAAA;AAID,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAA"}
@@ -10,10 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  }
11
11
  return t;
12
12
  };
13
- import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import * as React from "react";
15
15
  import { cva } from "class-variance-authority";
16
- import { cn } from "@/lib/utils";
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: {
@@ -23,7 +23,7 @@ const selectorsVariants = cva("flex py-2 px-4 whitespace-nowrap bg-coreColors-pa
23
23
  },
24
24
  disabled: {
25
25
  true: "[&>p]:!line-through [&>p]:text-stateColors-disabled",
26
- false: "cursor-pointer active:outline-coreColors-brandColorPrimary",
26
+ false: "cursor-pointer active:outline-coreColors-brandColorPrimary active:opacity-70",
27
27
  },
28
28
  },
29
29
  defaultVariants: {
@@ -36,10 +36,26 @@ 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 }), void 0) }), void 0));
39
+ }), "group"), ref: ref }, props, { children: _jsx(Text, Object.assign({ type: "body-primary", color: "text-textColors-primaryColor" }, { children: label })) })));
40
40
  });
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))) }), void 0));
41
+ const SelectorContainer = ({ children, containerRef, }) => {
42
+ const [showFadeLeft, setShowFadeLeft] = React.useState(false);
43
+ const [showFadeRight, setShowFadeRight] = React.useState(false);
44
+ const checkOverflow = () => {
45
+ const { scrollLeft, scrollWidth, clientWidth } = containerRef.current;
46
+ setShowFadeLeft(scrollLeft > 0);
47
+ setShowFadeRight(scrollLeft + clientWidth < scrollWidth);
48
+ };
49
+ React.useEffect(() => {
50
+ const handleResize = () => checkOverflow();
51
+ window.addEventListener("resize", handleResize);
52
+ checkOverflow();
53
+ return () => window.removeEventListener("resize", handleResize);
54
+ }, []);
55
+ React.useEffect(() => {
56
+ checkOverflow();
57
+ }, [children]);
58
+ return (_jsx("div", Object.assign({ className: "relative" }, { children: _jsxs("div", Object.assign({ className: "flex gap-2 px-1 h-[42px] items-center overflow-x-auto overflow-y-hidden no-scrollbar", onScroll: checkOverflow, ref: containerRef }, { children: [children, showFadeLeft && (_jsx("div", { className: "absolute top-0 left-0 w-8 h-full pointer-events-none bg-fade-left" })), showFadeRight && (_jsx("div", { className: "absolute top-0 right-0 w-8 h-full pointer-events-none bg-fade-right" }))] })) })));
43
59
  };
44
60
  Selectors.displayName = "Selectors";
45
61
  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), void 0));
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 };
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { cva } from "class-variance-authority";
14
14
  import { cn } from "../../lib/utils";
15
- const skeletonVariants = cva("animate-pulse flex bg-stateColors-skeleton h-10 w-10 rounded-[4px]", {
15
+ const skeletonVariants = cva("animate-pulse flex bg-stateColors-skeleton rounded-[4px]", {
16
16
  variants: {
17
17
  variant: {
18
18
  line: "",
@@ -28,6 +28,6 @@ function Skeleton(_a) {
28
28
  width: width,
29
29
  height: height,
30
30
  borderRadius: variant === "rectangular" ? borderRadius : "",
31
- } }, props), void 0));
31
+ } }, props)));
32
32
  }
33
33
  export { Skeleton };
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import * as SliderPrimitive from "@radix-ui/react-slider";
3
+ export interface SliderProps extends Omit<React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>, "onChange"> {
4
+ className?: string;
5
+ defaultValue: number[];
6
+ value: number[];
7
+ step: number;
8
+ max: number;
9
+ min?: number;
10
+ onChange: (value: number[]) => void;
11
+ }
12
+ declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLSpanElement>>;
13
+ export { Slider };
14
+ //# sourceMappingURL=slider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../components/ui/slider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAKzD,MAAM,WAAW,WACf,SAAQ,IAAI,CACV,KAAK,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,EAC3D,UAAU,CACX;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,KAAK,EAAE,MAAM,EAAE,CAAA;IAEf,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CACpC;AAED,QAAA,MAAM,MAAM,qFAmHX,CAAA;AAID,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import * as React from "react";
15
+ import * as SliderPrimitive from "@radix-ui/react-slider";
16
+ import { cn } from "../../lib/utils";
17
+ import { Input } from "./input";
18
+ const Slider = React.forwardRef((_a, ref) => {
19
+ var { className, max, min = 0, step = 1, defaultValue, value, onChange } = _a,
20
+ // doubleValue = false,
21
+ props = __rest(_a, ["className", "max", "min", "step", "defaultValue", "value", "onChange"]);
22
+ const doubleValue = false;
23
+ const handleCommit = (value) => {
24
+ onChange(value);
25
+ if (props.onValueChange) {
26
+ props.onValueChange(value);
27
+ }
28
+ };
29
+ const useDebounce = (value, delay) => {
30
+ const [debouncedValue, setDebouncedValue] = React.useState(value);
31
+ React.useEffect(() => {
32
+ const handler = setTimeout(() => {
33
+ setDebouncedValue(value);
34
+ }, delay);
35
+ return () => {
36
+ clearTimeout(handler);
37
+ };
38
+ }, [value, delay]);
39
+ return debouncedValue;
40
+ };
41
+ const debouncedSliderVal = useDebounce(value, 200);
42
+ return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "mt-3 mb-6" }, { children: _jsxs(SliderPrimitive.Root, Object.assign({ ref: ref, className: cn("flex relative h-0.5 w-auto items-center select-none", className), onValueChange: (value) => onChange(value), onValueCommit: (value) => {
43
+ handleCommit(value);
44
+ }, defaultValue: defaultValue, value: value, max: max, min: min, step: step }, props, { children: [_jsx(SliderPrimitive.Track, Object.assign({ className: "relative h-1 rounded w-full grow overflow-hidden bg-coreColors-dividingLines" }, { children: _jsx(SliderPrimitive.Range, { className: "absolute h-full bg-coreColors-brandColorPrimary" }) })), _jsx(SliderPrimitive.Thumb, { className: "block hover:slider-thumb h-4 w-4 rounded-full border-2 border-coreColors-brandColorPrimary bg-coreColors-modalBackground focus-visible:outline-none hover:h-[18px] hover:w-[18px] disabled:pointer-events-none" })] })) })), _jsxs("div", Object.assign({ className: "flex w-auto gap-4 " }, { children: [doubleValue && doubleValue == true ? (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "w-full px-4 py-2 border bg-coreColors-inputBackground" }, { children: _jsxs("div", Object.assign({ className: "flex flex-col" }, { children: [_jsx("div", Object.assign({ className: "h-4 text-textColors-secondaryColor text-[10px] leading-[13px]" }, { children: "Minimum" })), _jsxs("div", Object.assign({ className: "flex text-textColors-primaryColor text-[15px]" }, { children: ["$", min] }))] })) })), _jsx("div", { className: "w-4 h-0 self-center border-2 bg-coreColors-dividingLines" })] })) : (""), _jsx("div", Object.assign({ className: "w-full px-4 py-2 outline outline-1 outline-coreColors-dividingLines rounded bg-coreColors-inputBackground" }, { children: _jsxs("div", Object.assign({ className: "flex flex-col" }, { children: [_jsx("div", Object.assign({ className: "flex items-center h-4 text-textColors-secondaryColor text-[10px] leading-[13px]" }, { children: "Maximum" })), _jsxs("div", Object.assign({ className: "flex h-6 text-textColors-primaryColor text-[15px] w-full [&>div]:w-full" }, { children: ["$", _jsx(Input, { className: "border-0 p-0 h-full w-full text-[15px]", id: "slider-maximum", value: debouncedSliderVal[0].toString(), placeholder: defaultValue[0].toString(), onChange: (value) => {
45
+ const inputValue = Number(value);
46
+ inputValue > max ? onChange([max]) : onChange([inputValue]);
47
+ } })] }))] })) }))] }))] }));
48
+ });
49
+ Slider.displayName = SliderPrimitive.Root.displayName;
50
+ export { Slider };
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ export interface SubscriptionProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type"> {
3
+ imgUrl?: string;
4
+ name: string;
5
+ oldPrice: number;
6
+ type: "subscription" | "one-time";
7
+ newPrice: number;
8
+ selected?: boolean;
9
+ onClick?: () => void;
10
+ className?: string;
11
+ savePercentage?: boolean;
12
+ }
13
+ declare const Subscription: React.ForwardRefExoticComponent<SubscriptionProps & React.RefAttributes<HTMLButtonElement>>;
14
+ export { Subscription };
15
+ //# sourceMappingURL=subscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../components/ui/subscription.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACnE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,cAAc,GAAG,UAAU,CAAA;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,QAAA,MAAM,YAAY,6FAsEjB,CAAA;AAID,OAAO,EAAE,YAAY,EAAE,CAAA"}