@tapcart/mobile-components 0.5.3 → 0.5.4
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.js +2 -2
- package/dist/components/hooks/use-scroll-direction.d.ts +1 -1
- package/dist/components/hooks/use-scroll-direction.d.ts.map +1 -1
- package/dist/components/hooks/use-scroll-direction.js +25 -19
- package/dist/components/templates/product-card.d.ts +33 -0
- package/dist/components/templates/product-card.d.ts.map +1 -0
- package/dist/components/templates/product-card.js +42 -0
- package/dist/components/templates/product-grid.d.ts +14 -0
- package/dist/components/templates/product-grid.d.ts.map +1 -0
- package/dist/components/templates/product-grid.js +22 -0
- package/dist/components/ui/Input/input.d.ts +1 -1
- package/dist/components/ui/Input/types.d.ts +2 -2
- package/dist/components/ui/Input/useInput.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +4 -1
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +25 -4
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/color-swatch.d.ts +25 -0
- package/dist/components/ui/color-swatch.d.ts.map +1 -0
- package/dist/components/ui/color-swatch.js +44 -0
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js +1 -1
- package/dist/components/ui/favorite.d.ts +1 -1
- package/dist/components/ui/icon.d.ts +5 -2
- package/dist/components/ui/icon.d.ts.map +1 -1
- package/dist/components/ui/icon.js +20 -4
- package/dist/components/ui/price.d.ts.map +1 -1
- package/dist/components/ui/price.js +16 -8
- package/dist/components/ui/product-card.d.ts.map +1 -1
- package/dist/components/ui/product-card.js +3 -2
- package/dist/components/ui/selectors.d.ts +4 -2
- package/dist/components/ui/selectors.d.ts.map +1 -1
- package/dist/components/ui/selectors.js +5 -5
- package/dist/components/ui/text.d.ts +2 -1
- package/dist/components/ui/text.d.ts.map +1 -1
- package/dist/components/ui/text.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/styles.css +684 -189
- package/package.json +2 -1
- package/dist/components/ThemeProvider.d.ts +0 -3
- package/dist/components/ThemeProvider.d.ts.map +0 -1
- package/dist/components/ThemeProvider.js +0 -18
- package/dist/components/ThemeToggle.d.ts +0 -2
- package/dist/components/ThemeToggle.d.ts.map +0 -1
- package/dist/components/ThemeToggle.js +0 -8
|
@@ -78,13 +78,13 @@ const useInfiniteScroll = ({ initialData, queryVariables: queryVariableProps, })
|
|
|
78
78
|
return {
|
|
79
79
|
data,
|
|
80
80
|
error,
|
|
81
|
-
isLoadingInitialData
|
|
81
|
+
isLoadingInitialData,
|
|
82
82
|
isLoadingMore,
|
|
83
83
|
isEmpty,
|
|
84
84
|
isReachingEnd,
|
|
85
85
|
ref,
|
|
86
86
|
products: data ? data === null || data === void 0 ? void 0 : data.flatMap((page) => page === null || page === void 0 ? void 0 : page.products) : [],
|
|
87
|
-
isLoading
|
|
87
|
+
isLoading,
|
|
88
88
|
isValidating,
|
|
89
89
|
};
|
|
90
90
|
};
|
|
@@ -3,6 +3,6 @@ interface ScrollData {
|
|
|
3
3
|
direction: ScrollDirection;
|
|
4
4
|
scrollY: number;
|
|
5
5
|
}
|
|
6
|
-
declare function useScrollDirection(threshold?: number
|
|
6
|
+
declare function useScrollDirection(threshold?: number): ScrollData;
|
|
7
7
|
export { useScrollDirection };
|
|
8
8
|
//# sourceMappingURL=use-scroll-direction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scroll-direction.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-scroll-direction.ts"],"names":[],"mappings":"AAGA,KAAK,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;AAE3C,UAAU,UAAU;IAClB,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,iBAAS,kBAAkB,
|
|
1
|
+
{"version":3,"file":"use-scroll-direction.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-scroll-direction.ts"],"names":[],"mappings":"AAGA,KAAK,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;AAE3C,UAAU,UAAU;IAClB,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,iBAAS,kBAAkB,CAAC,SAAS,GAAE,MAAU,GAAG,UAAU,CAqD7D;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useState, useEffect, useRef } from "react";
|
|
3
|
-
function useScrollDirection(threshold = 5
|
|
2
|
+
import { useState, useEffect, useRef, useTransition } from "react";
|
|
3
|
+
function useScrollDirection(threshold = 5) {
|
|
4
4
|
const [scrollData, setScrollData] = useState({
|
|
5
5
|
direction: null,
|
|
6
6
|
scrollY: 0,
|
|
7
7
|
});
|
|
8
|
+
const [isPending, startTransition] = useTransition();
|
|
8
9
|
const lastScrollY = useRef(0);
|
|
9
|
-
const
|
|
10
|
-
let inThrottle;
|
|
11
|
-
return (...args) => {
|
|
12
|
-
if (!inThrottle) {
|
|
13
|
-
func(...args);
|
|
14
|
-
inThrottle = true;
|
|
15
|
-
setTimeout(() => (inThrottle = false), limit);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
};
|
|
10
|
+
const isBouncing = useRef(false);
|
|
19
11
|
useEffect(() => {
|
|
20
12
|
if (typeof window === "undefined") {
|
|
21
13
|
return;
|
|
@@ -25,18 +17,32 @@ function useScrollDirection(threshold = 5, throttleDelay = 50) {
|
|
|
25
17
|
return;
|
|
26
18
|
}
|
|
27
19
|
const scrollY = window.scrollY;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
const scrollHeight = document.documentElement.scrollHeight;
|
|
21
|
+
const clientHeight = document.documentElement.clientHeight;
|
|
22
|
+
// Detect if the user is at the top or bottom of the page
|
|
23
|
+
if (scrollY <= 0 || scrollY + clientHeight >= scrollHeight) {
|
|
24
|
+
isBouncing.current = true;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
isBouncing.current = false;
|
|
28
|
+
}
|
|
29
|
+
// Prevent updating scroll direction if the page is bouncing
|
|
30
|
+
if (!isBouncing.current &&
|
|
31
|
+
Math.abs(scrollY - lastScrollY.current) > threshold) {
|
|
32
|
+
startTransition(() => {
|
|
33
|
+
setScrollData({
|
|
34
|
+
direction: scrollY > lastScrollY.current ? "down" : "up",
|
|
35
|
+
scrollY,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
31
38
|
lastScrollY.current = scrollY > 0 ? scrollY : 0;
|
|
32
39
|
}
|
|
33
40
|
};
|
|
34
|
-
|
|
35
|
-
window.addEventListener("scroll", throttledUpdateScrollDirection);
|
|
41
|
+
window.addEventListener("scroll", updateScrollDirection);
|
|
36
42
|
return () => {
|
|
37
|
-
window.removeEventListener("scroll",
|
|
43
|
+
window.removeEventListener("scroll", updateScrollDirection);
|
|
38
44
|
};
|
|
39
|
-
}, [threshold
|
|
45
|
+
}, [threshold]);
|
|
40
46
|
return scrollData;
|
|
41
47
|
}
|
|
42
48
|
export { useScrollDirection };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare type ProductCardProps = {
|
|
3
|
+
product: {
|
|
4
|
+
variants: {
|
|
5
|
+
compare_at_price: number | undefined;
|
|
6
|
+
price: number;
|
|
7
|
+
}[];
|
|
8
|
+
images: {
|
|
9
|
+
src: string;
|
|
10
|
+
}[];
|
|
11
|
+
title: string;
|
|
12
|
+
tags: string[];
|
|
13
|
+
};
|
|
14
|
+
className: string;
|
|
15
|
+
scaling: "fit" | "fill";
|
|
16
|
+
isQuickAddProductEnabled: boolean;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
badge?: {
|
|
19
|
+
text: string;
|
|
20
|
+
variant: "secondary" | "default" | "destructive" | "outline" | null | undefined;
|
|
21
|
+
className?: string;
|
|
22
|
+
position: "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
23
|
+
};
|
|
24
|
+
icon?: {
|
|
25
|
+
name: string;
|
|
26
|
+
position: "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
27
|
+
};
|
|
28
|
+
quickAdd: (event: React.MouseEvent<HTMLButtonElement>, product: ProductCardProps["product"]) => void;
|
|
29
|
+
openProduct: (event: React.MouseEvent<HTMLDivElement>, product: ProductCardProps["product"]) => void;
|
|
30
|
+
};
|
|
31
|
+
declare const ProductCard: React.FC<ProductCardProps>;
|
|
32
|
+
export { ProductCard };
|
|
33
|
+
//# sourceMappingURL=product-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-card.d.ts","sourceRoot":"","sources":["../../../components/templates/product-card.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,aAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE;QACP,QAAQ,EAAE;YAAE,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;QACnE,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;QACzB,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,EAAE,CAAA;KACf,CAAA;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,KAAK,GAAG,MAAM,CAAA;IACvB,wBAAwB,EAAE,OAAO,CAAA;IACjC,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EACH,WAAW,GACX,SAAS,GACT,aAAa,GACb,SAAS,GACT,IAAI,GACJ,SAAS,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAA;KAChE,CAAA;IACD,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAA;KAChE,CAAA;IACD,QAAQ,EAAE,CACR,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAC1C,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,KACjC,IAAI,CAAA;IACT,WAAW,EAAE,CACX,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,EACvC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,KACjC,IAAI,CAAA;CACV,CAAA;AAsBD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAkF3C,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge } from "./badge";
|
|
4
|
+
import { Button } from "./button";
|
|
5
|
+
import { Text } from "./text";
|
|
6
|
+
import { Price } from "./price";
|
|
7
|
+
import { Icon } from "./icon";
|
|
8
|
+
import { Skeleton } from "./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";
|
|
32
|
+
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));
|
|
34
|
+
}
|
|
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
|
|
36
|
+
? "rounded-t-lg rounded-b-none"
|
|
37
|
+
: "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) => {
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
quickAdd(e, product);
|
|
40
|
+
} }, { 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));
|
|
41
|
+
};
|
|
42
|
+
export { ProductCard };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare type Product = any;
|
|
2
|
+
interface PageData {
|
|
3
|
+
products: Product[];
|
|
4
|
+
cursorBlob?: string;
|
|
5
|
+
}
|
|
6
|
+
interface ProductGridItemsProps {
|
|
7
|
+
initialData: PageData[];
|
|
8
|
+
loadMoreProducts: (params: any) => Promise<PageData>;
|
|
9
|
+
queryVariables: Record<string, any>;
|
|
10
|
+
config: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
declare function ProductGrid({ loadMoreProducts, initialData, queryVariables, config, }: ProductGridItemsProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { ProductGrid };
|
|
14
|
+
//# sourceMappingURL=product-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-grid.d.ts","sourceRoot":"","sources":["../../../components/templates/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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useInfiniteScroll } from "../hooks/use-infinite-scroll";
|
|
4
|
+
import { ProductCard } from "./product-card";
|
|
5
|
+
const Loader = () => (_jsx("div", Object.assign({ className: "grid-cols-2 lg:grid-cols-3" }, { children: Array(4)
|
|
6
|
+
.fill(0)
|
|
7
|
+
.map((_, index) => (_jsx("div", { className: "aspect-[2/3] animate-pulse bg-neutral-100 dark:bg-neutral-900" }, index))) }), void 0));
|
|
8
|
+
function ProductGrid({ loadMoreProducts, initialData, queryVariables, config, }) {
|
|
9
|
+
const { data, error, isLoadingInitialData, isLoadingMore, isEmpty, isReachingEnd, ref, products, } = useInfiniteScroll({
|
|
10
|
+
initialData,
|
|
11
|
+
loadMoreProducts,
|
|
12
|
+
queryVariables,
|
|
13
|
+
});
|
|
14
|
+
if (error)
|
|
15
|
+
return _jsx("div", { children: "Failed to load data" }, void 0);
|
|
16
|
+
if (isLoadingInitialData)
|
|
17
|
+
return _jsx(Loader, {}, void 0);
|
|
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
|
+
// @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));
|
|
21
|
+
}
|
|
22
|
+
export { ProductGrid };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { InputProps } from "
|
|
2
|
+
import { InputProps } from "@/components/ui/Input/types";
|
|
3
3
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
4
4
|
export { Input };
|
|
5
5
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { VariantProps } from "class-variance-authority";
|
|
3
|
-
import { inputVariants } from "
|
|
4
|
-
import { Color } from "
|
|
3
|
+
import { inputVariants } from "@/components/ui/Input/useInput";
|
|
4
|
+
import { Color } from "@/lib/utils";
|
|
5
5
|
export type BorderSides = ("all" | "bottom" | "left" | "right" | "top")[];
|
|
6
6
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange">, VariantProps<typeof inputVariants> {
|
|
7
7
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { InputProps } from "
|
|
2
|
+
import { InputProps } from "@/components/ui/Input/types";
|
|
3
3
|
export declare const DEFAULT_ICON_SIZE = 20;
|
|
4
4
|
export declare const DEFAULT_X_PADDING = 12;
|
|
5
5
|
export declare const DEFAULT_Y_PADDING = 8;
|
|
@@ -7,8 +7,11 @@ declare const badgeVariants: (props?: ({
|
|
|
7
7
|
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
8
8
|
size: "plp-layout" | "carousels";
|
|
9
9
|
icon?: string | null;
|
|
10
|
+
iconUrl?: string | null;
|
|
10
11
|
type?: "icon-and-text" | "icon-only" | "text-only";
|
|
12
|
+
backgroundColor?: string | null;
|
|
13
|
+
fontColor?: string | null;
|
|
11
14
|
}
|
|
12
|
-
declare function Badge({ className, icon, alignment, cornerRadius, type, size, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function Badge({ className, icon, iconUrl, alignment, cornerRadius, type, size, backgroundColor, fontColor, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
13
16
|
export { Badge, badgeVariants };
|
|
14
17
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,aAAa;;;
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,aAAa;;;mFAqDlB,CAAA;AAED,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAC1C,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,IAAI,EAAE,YAAY,GAAG,WAAW,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,CAAC,EAAE,eAAe,GAAG,WAAW,GAAG,WAAW,CAAA;IAClD,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,IAAI,EACJ,OAAO,EACP,SAAS,EACT,YAAwB,EACxB,IAAsB,EACtB,IAAmB,EACnB,eAAe,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,UAAU,2CA6BZ;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -19,7 +19,7 @@ const badgeVariants = cva("inline-flex items-center justify-center gap-1 py-1 px
|
|
|
19
19
|
alignment: {
|
|
20
20
|
start: "",
|
|
21
21
|
end: "",
|
|
22
|
-
center: "
|
|
22
|
+
center: "w-full",
|
|
23
23
|
},
|
|
24
24
|
cornerRadius: {
|
|
25
25
|
rounded: "",
|
|
@@ -42,11 +42,32 @@ const badgeVariants = cva("inline-flex items-center justify-center gap-1 py-1 px
|
|
|
42
42
|
cornerRadius: "rounded",
|
|
43
43
|
class: "rounded-tl rounded-bl",
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
alignment: "center",
|
|
47
|
+
cornerRadius: "rounded",
|
|
48
|
+
class: "rounded",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
alignment: "start",
|
|
52
|
+
cornerRadius: "circle",
|
|
53
|
+
class: "rounded-tr-2xl rounded-br-2xl",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
alignment: "end",
|
|
57
|
+
cornerRadius: "circle",
|
|
58
|
+
class: "rounded-tl-2xl rounded-bl-2xl",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
alignment: "center",
|
|
62
|
+
cornerRadius: "circle",
|
|
63
|
+
class: "rounded-2xl",
|
|
64
|
+
},
|
|
45
65
|
]
|
|
46
66
|
});
|
|
47
67
|
function Badge(_a) {
|
|
48
|
-
var { className, icon, alignment, cornerRadius = "rounded", type = "icon-and-text", size = "plp-layout" } = _a, props = __rest(_a, ["className", "icon", "alignment", "cornerRadius", "type", "size"]);
|
|
49
|
-
const
|
|
50
|
-
|
|
68
|
+
var { className, icon, iconUrl, alignment, cornerRadius = "rounded", type = "icon-and-text", size = "plp-layout", backgroundColor, fontColor } = _a, props = __rest(_a, ["className", "icon", "iconUrl", "alignment", "cornerRadius", "type", "size", "backgroundColor", "fontColor"]);
|
|
69
|
+
const backgroundColorOverride = backgroundColor ? { backgroundColor } : {};
|
|
70
|
+
const BadgeText = () => (_jsx(Text, Object.assign({ type: size === "plp-layout" ? "body-primary" : "body-secondary", className: "text-productBadging-text", fontColor: fontColor }, { children: props.children })));
|
|
71
|
+
return (_jsx("div", Object.assign({ className: cn(badgeVariants({ alignment, cornerRadius }), className), style: backgroundColorOverride }, props, { children: type === "icon-and-text" ? (_jsxs(_Fragment, { children: [(icon || iconUrl) && (_jsx(Icon, { name: icon, url: iconUrl, strokeColor: fontColor, fillColor: fontColor, size: size === "carousels" ? "xs" : "sm" })), _jsx(BadgeText, {})] })) : type === "icon-only" && icon ? (_jsx(Icon, { name: icon, url: iconUrl, strokeColor: fontColor, fillColor: fontColor, size: size === "carousels" ? "xs" : "sm" })) : (_jsx(BadgeText, {})) })));
|
|
51
72
|
}
|
|
52
73
|
export { Badge, badgeVariants };
|
|
@@ -32,7 +32,7 @@ const buttonVariants = cva("w-full flex rounded items-center justify-center tran
|
|
|
32
32
|
secondary: "bg-buttonColors-secondaryFill border border-buttonColors-secondaryOutlineColor disabled:bg-buttonColors-secondaryFill disabled:text-stateColors-disabled shadow-secondary",
|
|
33
33
|
ghost: "hover:bg-accent",
|
|
34
34
|
link: "underline-offset-4 hover:underline disabled:text-stateColors-disabled disabled:bg-transparent",
|
|
35
|
-
quickadd: "bg-buttonColors-primaryFill
|
|
35
|
+
quickadd: "bg-buttonColors-primaryFill w-full rounded-none rounded-b-lg h-8 text-xs border border-buttonColors-primaryOutlineColor py-2",
|
|
36
36
|
applePay: "bg-white border border-black",
|
|
37
37
|
shopPay: "bg-[#612EFF]",
|
|
38
38
|
},
|
|
@@ -69,7 +69,7 @@ const labelVariants = cva("truncate", {
|
|
|
69
69
|
secondary: "text-buttonColors-secondaryText",
|
|
70
70
|
ghost: "hover:text-accent-foreground",
|
|
71
71
|
link: "text-textColors-primaryColor",
|
|
72
|
-
quickadd: "text-buttonColors-primaryText",
|
|
72
|
+
quickadd: "text-buttonColors-primaryText text-xs",
|
|
73
73
|
applePay: "text-black border",
|
|
74
74
|
shopPay: "",
|
|
75
75
|
},
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const colorSwatchVariants: (props?: ({
|
|
4
|
+
overflow?: "wrap" | "horizontal-scroll" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
+
interface Color {
|
|
7
|
+
color: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface Img {
|
|
12
|
+
url: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface ColorSwatchProps extends VariantProps<typeof colorSwatchVariants> {
|
|
17
|
+
className?: string;
|
|
18
|
+
items: Color[] | Img[];
|
|
19
|
+
onSelect: (color: Color | Img) => void;
|
|
20
|
+
shape: "rectangle" | "circle";
|
|
21
|
+
type: "color" | "image";
|
|
22
|
+
}
|
|
23
|
+
declare const ColorSwatch: React.FC<ColorSwatchProps>;
|
|
24
|
+
export { ColorSwatch, type ColorSwatchProps, type Color, type Img };
|
|
25
|
+
//# sourceMappingURL=color-swatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-swatch.d.ts","sourceRoot":"","sources":["../../../components/ui/color-swatch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAI5D,QAAA,MAAM,mBAAmB;;mFAWvB,CAAA;AAEF,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,UAAU,GAAG;IACX,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,UAAU,gBAAiB,SAAQ,YAAY,CAAC,OAAO,mBAAmB,CAAC;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,KAAK,EAAE,GAAG,GAAG,EAAE,CAAA;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,KAAK,IAAI,CAAA;IACtC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAA;IAC7B,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;CACxB;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAsD3C,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
14
|
+
import { cva } from "class-variance-authority";
|
|
15
|
+
import { cn } from "../../lib/utils";
|
|
16
|
+
const colorSwatchVariants = cva("grid grid-flow-col w-full gap-x-2 gap-y-2", {
|
|
17
|
+
variants: {
|
|
18
|
+
overflow: {
|
|
19
|
+
"horizontal-scroll": "overflow-x-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
|
|
20
|
+
wrap: "flex flex-wrap",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
overflow: "horizontal-scroll",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const ColorSwatch = (_a) => {
|
|
28
|
+
var { className, onSelect, shape = "rectangle", overflow = "horizontal-scroll", items, type } = _a, props = __rest(_a, ["className", "onSelect", "shape", "overflow", "items", "type"]);
|
|
29
|
+
return (_jsx("div", Object.assign({ className: cn(colorSwatchVariants({ overflow }), className) }, props, { children: items.map((item, index) => {
|
|
30
|
+
return (_jsx("button", Object.assign({ className: cn("border border-transparent rounded-sm", {
|
|
31
|
+
"border-coreColors-brandColorPrimary": item.selected,
|
|
32
|
+
"rounded-sm": shape === "rectangle",
|
|
33
|
+
"rounded-full": shape === "circle",
|
|
34
|
+
}), onClick: () => onSelect(item) }, { children: _jsx("div", Object.assign({ className: cn("relative h-[22px] w-[22px] border border-coreColors-dividingLines bg-contain", {
|
|
35
|
+
"rounded-sm": shape === "rectangle",
|
|
36
|
+
"rounded-full": shape === "circle",
|
|
37
|
+
}), style: {
|
|
38
|
+
backgroundColor: type === "color" ? item.color : "",
|
|
39
|
+
borderColor: item.selected ? "#FFF" : "",
|
|
40
|
+
backgroundImage: type === "image" ? `url(${item.url})` : "",
|
|
41
|
+
} }, { children: item.disabled ? (_jsx("div", Object.assign({ className: "absolute flex items-center justify-center", style: { inset: shape === "rectangle" ? 0 : 2 } }, { children: _jsx("div", { className: "w-full h-[1px] bg-white transform rotate-45 rounded" }) }))) : null }), index) })));
|
|
42
|
+
}) })));
|
|
43
|
+
};
|
|
44
|
+
export { ColorSwatch };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../components/ui/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,MAAM,CAAA;AAIhD,QAAA,MAAM,aAAa,+HAA0B,CAAA;AAE7C,QAAA,MAAM,YAAY,8DAAyB,CAAA;AAE3C,QAAA,MAAM,WAAW,6HAAwB,CAAA;AAEzC,KAAK,WAAW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
@@ -20,7 +20,7 @@ const DrawerPortal = DrawerPrimitive.Portal;
|
|
|
20
20
|
const DrawerClose = DrawerPrimitive.Close;
|
|
21
21
|
const Drawer = (_a) => {
|
|
22
22
|
var { shouldScaleBackground } = _a, props = __rest(_a, ["shouldScaleBackground"]);
|
|
23
|
-
return _jsx(DrawerPrimitive.Root, Object.assign({ shouldScaleBackground: true }, props));
|
|
23
|
+
return (_jsx(DrawerPrimitive.Root, Object.assign({ shouldScaleBackground: true }, props, { noBodyStyles: true, disablePreventScroll: true })));
|
|
24
24
|
};
|
|
25
25
|
Drawer.displayName = "Drawer";
|
|
26
26
|
const DrawerOverlay = React.forwardRef((_a, ref) => {
|
|
@@ -3,7 +3,7 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
3
3
|
declare const favoriteVariants: (props?: ({
|
|
4
4
|
size?: "small" | "large" | null | undefined;
|
|
5
5
|
showBackground?: boolean | null | undefined;
|
|
6
|
-
layoutType?: "
|
|
6
|
+
layoutType?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "below-image-on-right" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
8
|
export interface FavoriteProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof favoriteVariants> {
|
|
9
9
|
selected?: boolean;
|
|
@@ -6,8 +6,11 @@ declare const iconVariants: (props?: ({
|
|
|
6
6
|
color?: string | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
8
|
export interface IconProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "color">, VariantProps<typeof iconVariants> {
|
|
9
|
-
name?: string;
|
|
9
|
+
name?: string | null;
|
|
10
|
+
url?: string | null;
|
|
11
|
+
fillColor?: string | null;
|
|
12
|
+
strokeColor?: string | null;
|
|
10
13
|
}
|
|
11
|
-
declare function Icon({ className, name, size, color, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function Icon({ className, name, size, color, fillColor, strokeColor, url, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
export { Icon, iconVariants, IconPencilMinus };
|
|
13
16
|
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../components/ui/icon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../components/ui/icon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAEL,eAAe,EAkChB,MAAM,qBAAqB,CAAA;AAI5B,QAAA,MAAM,YAAY;;;mFAgBjB,CAAA;AAsDD,MAAM,WAAW,SACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EACzD,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AA8CD,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,IAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,EACX,GAAG,EACH,GAAG,KAAK,EACT,EAAE,SAAS,2CAgBX;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
3
|
var t = {};
|
|
3
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -10,8 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
11
|
return t;
|
|
11
12
|
};
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { ReactSVG } from "react-svg";
|
|
13
15
|
import { cva } from "class-variance-authority";
|
|
14
|
-
import { IconUpload, IconPencilMinus, IconPlus, IconMinus, IconAdjustmentsAlt, IconArrowsSort, IconAlertCircle, IconCircleX, IconInfoCircle, IconCheck, IconSquareOff, IconMapPin, IconRepeat, IconSquare, IconSquareCheck, IconChevronUp, IconChevronRight, IconEyeOff, IconSquareX, IconCircle, IconChevronDown, IconHeartFilled, IconCurrencyDollar, IconX, IconCircleOff, IconCircleDotFilled, IconMoodSad, IconSquareXFilled, IconTrash, IconLoader2, IconColumns1, IconColumns2, IconColumns3, IconSearch, IconShoppingCartOff } from "@tabler/icons-react";
|
|
16
|
+
import { IconUpload, IconPencilMinus, IconPlus, IconMinus, IconAdjustmentsAlt, IconArrowsSort, IconAlertCircle, IconCircleX, IconInfoCircle, IconCheck, IconSquareOff, IconMapPin, IconRepeat, IconSquare, IconSquareCheck, IconChevronUp, IconChevronRight, IconEyeOff, IconSquareX, IconCircle, IconChevronDown, IconHeartFilled, IconCurrencyDollar, IconX, IconCircleOff, IconCircleDotFilled, IconMoodSad, IconSquareXFilled, IconTrash, IconLoader2, IconColumns1, IconColumns2, IconColumns3, IconSearch, IconShoppingCartOff, } from "@tabler/icons-react";
|
|
15
17
|
import { cn, iconColorVariantClasses } from "../../lib/utils";
|
|
16
18
|
const iconVariants = cva("inline-flex items-center justify-center text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background", {
|
|
17
19
|
variants: {
|
|
@@ -76,9 +78,23 @@ const icons = {
|
|
|
76
78
|
search: IconSearch,
|
|
77
79
|
"shopping-cart-off": IconShoppingCartOff,
|
|
78
80
|
};
|
|
79
|
-
|
|
80
|
-
var { className, name, size = "md", color } = _a, props = __rest(_a, ["className", "name", "size", "color"]);
|
|
81
|
+
const TablerIcon = ({ name, size }) => {
|
|
81
82
|
const IconComponent = icons[name];
|
|
82
|
-
return
|
|
83
|
+
return IconComponent ? (_jsx(IconComponent, { size: sizeMapping[size], strokeWidth: strokeWidthMapping[size] })) : null;
|
|
84
|
+
};
|
|
85
|
+
const CustomIcon = ({ url, size, strokeColor, fillColor }) => {
|
|
86
|
+
return (_jsx(ReactSVG, { src: url, beforeInjection: (svg) => {
|
|
87
|
+
svg.setAttribute("style", `width: ${sizeMapping[size]}px; height: ${sizeMapping[size]}px`);
|
|
88
|
+
const paths = svg.querySelectorAll("path");
|
|
89
|
+
paths.forEach((path) => {
|
|
90
|
+
path.setAttribute("stroke-width", strokeWidthMapping[size].toString());
|
|
91
|
+
fillColor && path.setAttribute("fill", fillColor);
|
|
92
|
+
strokeColor && path.setAttribute("stroke", strokeColor);
|
|
93
|
+
});
|
|
94
|
+
} }));
|
|
95
|
+
};
|
|
96
|
+
function Icon(_a) {
|
|
97
|
+
var { className, name, size = "md", color, fillColor, strokeColor, url } = _a, props = __rest(_a, ["className", "name", "size", "color", "fillColor", "strokeColor", "url"]);
|
|
98
|
+
return (_jsxs("div", Object.assign({ className: cn(iconVariants({ size, color, className })) }, props, { children: [url ? (_jsx(CustomIcon, { url: url, size: size, strokeColor: strokeColor, fillColor: fillColor })) : (_jsx(TablerIcon, { name: name, size: size })), props.children] })));
|
|
83
99
|
}
|
|
84
100
|
export { Icon, iconVariants, IconPencilMinus };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../components/ui/price.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../components/ui/price.tsx"],"names":[],"mappings":"AAIA,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,EAAE,CAAC;CAClD;AAED,iBAAS,KAAK,CAAC,EACb,KAAK,EACL,SAAS,EACT,WAAmB,EACnB,MAAc,EACd,cAAc,EACd,kBAAkB,EAClB,QAAgB,EAChB,MAAgB,EAChB,QAAa,EACb,aAAkB,GACnB,EAAE,UAAU,2CAiEZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Money } from "./money";
|
|
3
3
|
import { Text } from "./text";
|
|
4
4
|
import { cn } from "../../lib/utils";
|
|
5
|
-
function Price({ price, priceHigh
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
function Price({ price, priceHigh, priceRanges = false, isSale = false, compareAtPrice, compareAtPriceHigh, currency = "USD", locale = "en-US", fontSize = 15, textAlignment = '', }) {
|
|
6
|
+
const Spacer = () => (_jsx("span", { children: " - " }));
|
|
7
|
+
const ProductPrice = () => {
|
|
8
|
+
const colorClass = isSale ? 'text-textColors-salePriceText' : 'text-textColors-priceText';
|
|
9
|
+
return (_jsxs(Text, Object.assign({ className: `${colorClass} flex-shrink-0`, style: { fontSize: `${fontSize}px` } }, { children: [_jsx("div", { className: cn("flex flex-wrap gap-2", {
|
|
10
|
+
"ml-auto": textAlignment === 'right',
|
|
11
|
+
"mr-auto": textAlignment === 'center',
|
|
12
|
+
}) }), _jsxs("span", Object.assign({ className: "flex-grow min-w-[fit-content]" }, { children: [_jsx(Money, { price: price, currency: currency, locale: locale }), priceRanges && priceHigh !== undefined && _jsx(Spacer, {}), priceRanges && priceHigh !== undefined && (_jsx(Money, { price: priceHigh, currency: currency, locale: locale }))] }))] })));
|
|
13
|
+
};
|
|
14
|
+
const StrikeThroughPrice = () => {
|
|
15
|
+
if (!isSale || !compareAtPrice)
|
|
16
|
+
return null;
|
|
17
|
+
return (_jsxs(Text, Object.assign({ className: "line-through text-textColors-strikethroughPriceText flex-shrink-0", style: { fontSize: `${fontSize}px` } }, { children: [_jsx(Money, { price: compareAtPrice, currency: currency, locale: locale }), priceRanges && compareAtPriceHigh && _jsx(Spacer, {}), priceRanges && compareAtPriceHigh && (_jsx(Money, { price: compareAtPriceHigh, currency: currency, locale: locale }))] })));
|
|
18
|
+
};
|
|
19
|
+
return (_jsxs("div", Object.assign({ className: cn("flex flex-wrap gap-2", { "justify-start": textAlignment === "left" }, { "justify-end": textAlignment === "right" }, { "justify-center": textAlignment === "center" }) }, { children: [_jsx(ProductPrice, {}), _jsx(StrikeThroughPrice, {})] })));
|
|
12
20
|
}
|
|
13
21
|
export { Price };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.d.ts","sourceRoot":"","sources":["../../../components/ui/product-card.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAG1C,KAAK,MAAM,GAAG;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE;QACb,OAAO,EAAE,OAAO,CAAA;QAChB,YAAY,EAAE,MAAM,CAAA;QACpB,iBAAiB,EAAE,OAAO,CAAA;KAC3B,CAAA;IACD,KAAK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
|
1
|
+
{"version":3,"file":"product-card.d.ts","sourceRoot":"","sources":["../../../components/ui/product-card.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAG1C,KAAK,MAAM,GAAG;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE;QACb,OAAO,EAAE,OAAO,CAAA;QAChB,YAAY,EAAE,MAAM,CAAA;QACpB,iBAAiB,EAAE,OAAO,CAAA;KAC3B,CAAA;IACD,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,OAAO,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;QAChB,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAA;KAClD,CAAA;IACD,YAAY,CAAC,EAAE;QACb,OAAO,EAAE,OAAO,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,OAAO,CAAA;QAClB,aAAa,EAAE,MAAM,CAAA;QACrB,QAAQ,EAAE,OAAO,CAAA;KAClB,CAAA;IACD,QAAQ,CAAC,EAAE;QACT,OAAO,EAAE,OAAO,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,OAAO,CAAA;QAClB,aAAa,EAAE,MAAM,CAAA;QACrB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,aAAa,CAAC,EAAE;QACd,OAAO,EAAE,OAAO,CAAA;QAChB,UAAU,EACN,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,GACd,sBAAsB,CAAA;QAC1B,cAAc,EAAE,OAAO,CAAA;QACvB,YAAY,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE;YACJ,IAAI,EAAE,UAAU,CAAA;YAChB,GAAG,EAAE,QAAQ,CAAA;YACb,OAAO,CAAC,EAAE,MAAM,CAAA;SACjB,CAAA;KACF,CAAA;CACF,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AAI,CAAA;IACT,UAAU,CAAC,EAAE,CACX,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAC1C,OAAO,EAAE,OAAO,KACb,IAAI,CAAA;IACT,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AA8HD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2U3C,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -6,6 +6,7 @@ import { Button } from "./button";
|
|
|
6
6
|
import { Text } from "./text";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { Price } from "./price";
|
|
9
|
+
import { Icon } from "./icon";
|
|
9
10
|
import { Skeleton } from "./skeleton";
|
|
10
11
|
import { cn } from "../../lib/utils";
|
|
11
12
|
import { cva } from "class-variance-authority";
|
|
@@ -221,10 +222,10 @@ const ProductCard = ({ config, tapcartData, product, isLoading, favorited, onFav
|
|
|
221
222
|
: undefined, layoutType: (_t = config.favoritesIcon) === null || _t === void 0 ? void 0 : _t.layoutType }))] }))), ((_u = config.quickAdd) === null || _u === void 0 ? void 0 : _u.enabled) && (_jsx(Button, Object.assign({ className: "outline-0", style: {
|
|
222
223
|
borderBottomLeftRadius: `${config.quickAdd.cornerRadius}px`,
|
|
223
224
|
borderBottomRightRadius: `${config.quickAdd.cornerRadius}px`,
|
|
224
|
-
}, labelClassName: cn("outline-0 w-full", { uppercase: (_v = config.quickAdd) === null || _v === void 0 ? void 0 : _v.uppercase }, { "text-left": ((_w = config.quickAdd) === null || _w === void 0 ? void 0 : _w.textAlignment) === "left" }, { "text-right": ((_x = config.quickAdd) === null || _x === void 0 ? void 0 : _x.textAlignment) === "right" }, { "text-center": ((_y = config.quickAdd) === null || _y === void 0 ? void 0 : _y.textAlignment) === "center" }), labelStyle: { fontSize: (_z = config.quickAdd) === null || _z === void 0 ? void 0 : _z.fontSize }, variant: "quickadd", size: "default", onClick: (e) => {
|
|
225
|
+
}, labelClassName: cn("outline-0 w-full", { uppercase: (_v = config.quickAdd) === null || _v === void 0 ? void 0 : _v.uppercase }, { "text-left": ((_w = config.quickAdd) === null || _w === void 0 ? void 0 : _w.textAlignment) === "left" }, { "text-right": ((_x = config.quickAdd) === null || _x === void 0 ? void 0 : _x.textAlignment) === "right" }, { "text-center": ((_y = config.quickAdd) === null || _y === void 0 ? void 0 : _y.textAlignment) === "center" }), labelStyle: { fontSize: (_z = config.quickAdd) === null || _z === void 0 ? void 0 : _z.fontSize }, variant: "quickadd", size: "default", disabled: product.availableForSale === false, onClick: (e) => {
|
|
225
226
|
e.stopPropagation();
|
|
226
227
|
onQuickAdd === null || onQuickAdd === void 0 ? void 0 : onQuickAdd(e, product);
|
|
227
|
-
} }, { children: "
|
|
228
|
+
} }, { children: _jsxs("div", Object.assign({ className: "flex items-center justify-center gap-2" }, { children: [_jsx(Icon, { name: product.availableForSale ? "plus" : "shopping-cart-off", size: "xs" }), product.availableForSale ? "Quick Add" : "Sold Out"] })) }))), _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", {
|
|
228
229
|
"justify-end": belowBadge.horizontalPosition === "end",
|
|
229
230
|
}) }, { 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 })) }))), ((_0 = config.productTitle) === null || _0 === void 0 ? void 0 : _0.enabled) && (_jsx("div", Object.assign({ className: "mt-2 w-full" }, { children: _jsx(Text, Object.assign({ type: "body-secondary", className: cn({ uppercase: (_1 = config.productTitle) === null || _1 === void 0 ? void 0 : _1.uppercase }, {
|
|
230
231
|
"text-left": ((_2 = config.productTitle) === null || _2 === void 0 ? void 0 : _2.textAlignment) === "left",
|