@tapcart/mobile-components 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/hooks/use-infinite-scroll.d.ts +3 -1
- package/dist/components/hooks/use-infinite-scroll.d.ts.map +1 -1
- package/dist/components/hooks/use-infinite-scroll.js +34 -11
- package/dist/components/hooks/use-nosto-recommendation.d.ts +8 -0
- package/dist/components/hooks/use-nosto-recommendation.d.ts.map +1 -0
- package/dist/components/hooks/use-nosto-recommendation.js +105 -0
- package/dist/components/hooks/use-products.d.ts +3 -1
- package/dist/components/hooks/use-products.d.ts.map +1 -1
- package/dist/components/hooks/use-products.js +21 -6
- package/dist/components/hooks/use-reviews.d.ts +27 -0
- package/dist/components/hooks/use-reviews.d.ts.map +1 -0
- package/dist/components/hooks/use-reviews.js +130 -0
- package/dist/components/templates/ProductCard/utils.d.ts +78 -0
- package/dist/components/templates/ProductCard/utils.d.ts.map +1 -0
- package/dist/components/templates/ProductCard/utils.js +128 -0
- package/dist/components/templates/ProductGrid/index.d.ts +1 -0
- package/dist/components/templates/ProductGrid/index.d.ts.map +1 -0
- package/dist/components/templates/ProductGrid/index.js +1 -0
- package/dist/components/ui/Input/input.d.ts +1 -1
- package/dist/components/ui/Input/input.d.ts.map +1 -1
- package/dist/components/ui/Input/input.js +23 -5
- package/dist/components/ui/Input/types.d.ts +3 -2
- package/dist/components/ui/Input/types.d.ts.map +1 -1
- package/dist/components/ui/Input/useInput.d.ts +2 -2
- package/dist/components/ui/Input/useInput.d.ts.map +1 -1
- package/dist/components/ui/Input/useInput.js +24 -10
- package/dist/components/ui/ProductCard/utils.d.ts +94 -0
- package/dist/components/ui/ProductCard/utils.d.ts.map +1 -0
- package/dist/components/ui/ProductCard/utils.js +148 -0
- package/dist/components/ui/ProductGrid/index.d.ts +1 -0
- package/dist/components/ui/ProductGrid/index.d.ts.map +1 -0
- package/dist/components/ui/ProductGrid/index.js +1 -0
- package/dist/components/ui/accordion.d.ts +3 -1
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion.js +2 -2
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/carousel.d.ts +1 -0
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +62 -2
- package/dist/components/ui/chip.d.ts +2 -2
- package/dist/components/ui/icon.d.ts +4 -1
- package/dist/components/ui/icon.d.ts.map +1 -1
- package/dist/components/ui/icon.js +35 -8
- package/dist/components/ui/image.d.ts.map +1 -1
- package/dist/components/ui/image.js +3 -3
- package/dist/components/ui/radio-group.d.ts +2 -2
- package/dist/components/ui/scroll-area.d.ts +1 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +2 -2
- package/dist/components/ui/toast.d.ts +2 -2
- package/dist/components/ui/toggle-group.d.ts +2 -2
- package/dist/components/ui/toggle.d.ts +2 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/lib/price.d.ts +29 -0
- package/dist/lib/price.d.ts.map +1 -0
- package/dist/lib/price.js +66 -0
- package/dist/lib/utils.d.ts +18 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +44 -1
- package/dist/styles.css +201 -727
- package/dist/tapcart-mobile-components.umd.js +44 -0
- package/package.json +4 -3
- package/dist/components/templates/product-card.d.ts +0 -33
- package/dist/components/templates/product-card.d.ts.map +0 -1
- package/dist/components/templates/product-card.js +0 -42
- package/dist/components/templates/product-grid.d.ts +0 -14
- package/dist/components/templates/product-grid.d.ts.map +0 -1
- package/dist/components/templates/product-grid.js +0 -22
- package/dist/components/ui/input.d.ts +0 -17
- package/dist/components/ui/input.d.ts.map +0 -1
- package/dist/components/ui/input.js +0 -35
- package/dist/components/ui/product-grid.d.ts +0 -15
- package/dist/components/ui/product-grid.d.ts.map +0 -1
- package/dist/components/ui/product-grid.js +0 -22
- package/dist/components/ui/select.d.ts +0 -14
- package/dist/components/ui/select.d.ts.map +0 -1
- package/dist/components/ui/select.js +0 -59
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"@tabler/icons-react": "^3.2.0",
|
|
63
63
|
"class-variance-authority": "^0.6.0",
|
|
64
64
|
"clsx": "^1.2.1",
|
|
65
|
-
"
|
|
65
|
+
"dayjs": "^1.11.13",
|
|
66
|
+
"embla-carousel-react": "^8.3.0",
|
|
66
67
|
"lucide-react": "^0.248.0",
|
|
67
68
|
"next": "^14.2.5",
|
|
68
69
|
"next-themes": "^0.2.1",
|
|
@@ -74,4 +75,4 @@
|
|
|
74
75
|
"tailwindcss-animate": "^1.0.6",
|
|
75
76
|
"vaul": "^0.9.1"
|
|
76
77
|
}
|
|
77
|
-
}
|
|
78
|
+
}
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,42 +0,0 @@
|
|
|
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 };
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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,17 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { type VariantProps } from "class-variance-authority";
|
|
3
|
-
declare const inputVariants: (props?: ({
|
|
4
|
-
error?: boolean | null | undefined;
|
|
5
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
-
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange">, VariantProps<typeof inputVariants> {
|
|
7
|
-
id: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
icon?: string;
|
|
10
|
-
asChild?: boolean;
|
|
11
|
-
value: string;
|
|
12
|
-
placeholder: string;
|
|
13
|
-
onChange: (_: string) => void;
|
|
14
|
-
}
|
|
15
|
-
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
16
|
-
export { Input };
|
|
17
|
-
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../components/ui/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,aAAa;;mFAalB,CAAA;AAED,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,EACnE,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B;AAED,QAAA,MAAM,KAAK,qFAkDV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
15
|
-
import { cva } from "class-variance-authority";
|
|
16
|
-
import { cn } from "../../lib/utils";
|
|
17
|
-
import { Icon } from "./icon";
|
|
18
|
-
const inputVariants = cva("flex h-14 w-full rounded border border-coreColors-dividingLines bg-coreColors-inputBackground px-4 pt-5 pb-2 placeholder-shown:p-4 text-textColors-primaryColor text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-textColors-secondaryColor focus-visible:outline-none focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-50 focus:border-coreColors-brandColorPrimary peer data-[icon=true]:pr-10", {
|
|
19
|
-
variants: {
|
|
20
|
-
error: {
|
|
21
|
-
true: "border-stateColors-error text-stateColors-error placeholder:text-stateColors-error focus:border-stateColors-error [&+label]:text-stateColors-error",
|
|
22
|
-
false: "",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
defaultVariants: {
|
|
26
|
-
error: false,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
const Input = React.forwardRef((_a, ref) => {
|
|
30
|
-
var { className, error = false, id, type, label, icon, asChild, value, placeholder, onChange } = _a, props = __rest(_a, ["className", "error", "id", "type", "label", "icon", "asChild", "value", "placeholder", "onChange"]);
|
|
31
|
-
const Comp = asChild ? Slot : "div";
|
|
32
|
-
return (_jsxs(Comp, Object.assign({ className: "relative group" }, { children: [_jsx("input", Object.assign({ placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value), id: id, type: type, className: cn(inputVariants({ error }), className), "data-icon": !!icon, ref: ref }, props)), label ? (_jsx("label", Object.assign({ htmlFor: id, className: "absolute text-[10px] text-textColors-secondaryColor group-active:text-coreColors-brandColorPrimary top-2 z-10 h-4 origin-[0] start-4 opacity-100 peer-placeholder-shown:opacity-0" }, { children: label }))) : null, icon ? (_jsx(Icon, { name: icon, "data-error": error, size: "sm", className: "absolute w-5 aspect-square fill-current text-textColors-secondaryColor top-[18px] z-10 origin-[0] end-4 peer-pr-8 icon data-[error=true]:text-stateColors-error" })) : null] })));
|
|
33
|
-
});
|
|
34
|
-
Input.displayName = "Input";
|
|
35
|
-
export { Input };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
type Product = any;
|
|
2
|
-
interface PageData {
|
|
3
|
-
products: Product[];
|
|
4
|
-
cursorBlob?: string;
|
|
5
|
-
filtersData: any;
|
|
6
|
-
}
|
|
7
|
-
interface ProductGridItemsProps {
|
|
8
|
-
initialData: PageData;
|
|
9
|
-
loadMoreProducts: (params: any) => Promise<PageData>;
|
|
10
|
-
queryVariables: Record<string, any>;
|
|
11
|
-
config: Record<string, any>;
|
|
12
|
-
}
|
|
13
|
-
declare function ProductGrid({ loadMoreProducts, initialData, queryVariables, config, }: ProductGridItemsProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export { ProductGrid };
|
|
15
|
-
//# sourceMappingURL=product-grid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;IACnB,WAAW,EAAE,GAAG,CAAA;CACjB;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,QAAQ,CAAA;IACrB,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,22 +0,0 @@
|
|
|
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))) })));
|
|
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" });
|
|
16
|
-
if (isLoadingInitialData)
|
|
17
|
-
return _jsx(Loader, {});
|
|
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))) })), isLoadingMore ? _jsx(Loader, {}) : _jsx("div", { ref: ref })] }));
|
|
21
|
-
}
|
|
22
|
-
export { ProductGrid };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3
|
-
declare const Select: React.FC<SelectPrimitive.SelectProps>;
|
|
4
|
-
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
-
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
-
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
-
declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
-
declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
-
declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
-
declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
-
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
|
|
14
|
-
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../components/ui/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAKzD,QAAA,MAAM,MAAM,uCAAuB,CAAA;AAEnC,QAAA,MAAM,WAAW,yGAAwB,CAAA;AAEzC,QAAA,MAAM,WAAW,0GAAwB,CAAA;AAEzC,QAAA,MAAM,aAAa,oKAkBjB,CAAA;AAGF,QAAA,MAAM,oBAAoB,qKAcxB,CAAA;AAGF,QAAA,MAAM,sBAAsB,uKAc1B,CAAA;AAIF,QAAA,MAAM,aAAa,8JA4BjB,CAAA;AAGF,QAAA,MAAM,WAAW,4JASf,CAAA;AAGF,QAAA,MAAM,UAAU,2JAed,CAAA;AAGF,QAAA,MAAM,eAAe,gKASnB,CAAA;AAGF,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAA"}
|
|
@@ -1,59 +0,0 @@
|
|
|
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 * as SelectPrimitive from "@radix-ui/react-select";
|
|
16
|
-
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
17
|
-
import { cn } from "../../lib/utils";
|
|
18
|
-
const Select = SelectPrimitive.Root;
|
|
19
|
-
const SelectGroup = SelectPrimitive.Group;
|
|
20
|
-
const SelectValue = SelectPrimitive.Value;
|
|
21
|
-
const SelectTrigger = React.forwardRef((_a, ref) => {
|
|
22
|
-
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
23
|
-
return (_jsxs(SelectPrimitive.Trigger, Object.assign({ ref: ref, className: cn("flex h-14 w-full items-center justify-between rounded-md border border-coreColors-dividingLines bg-coreColors-inputBackground text-sm placeholder:text-coreColors-brandColorPrimary disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", "[&[data-state=open]>svg]:rotate-180", className) }, props, { children: [children, _jsx(SelectPrimitive.Icon, Object.assign({ asChild: true }, { children: _jsx(ChevronDown, { className: "h-4 w-4 opacity-50 mr-4 transition-transform duration-200 ease-in-out" }) }))] })));
|
|
24
|
-
});
|
|
25
|
-
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
26
|
-
const SelectScrollUpButton = React.forwardRef((_a, ref) => {
|
|
27
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
28
|
-
return (_jsx(SelectPrimitive.ScrollUpButton, Object.assign({ ref: ref, className: cn("flex cursor-default items-center justify-center py-2", className) }, props, { children: _jsx(ChevronUp, { className: "h-4 w-4" }) })));
|
|
29
|
-
});
|
|
30
|
-
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
31
|
-
const SelectScrollDownButton = React.forwardRef((_a, ref) => {
|
|
32
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
33
|
-
return (_jsx(SelectPrimitive.ScrollDownButton, Object.assign({ ref: ref, className: cn("flex cursor-default items-center justify-center py-2", className) }, props, { children: _jsx(ChevronDown, { className: "h-4 w-4" }) })));
|
|
34
|
-
});
|
|
35
|
-
SelectScrollDownButton.displayName =
|
|
36
|
-
SelectPrimitive.ScrollDownButton.displayName;
|
|
37
|
-
const SelectContent = React.forwardRef((_a, ref) => {
|
|
38
|
-
var { className, children, position = "popper" } = _a, props = __rest(_a, ["className", "children", "position"]);
|
|
39
|
-
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, Object.assign({ ref: ref, className: cn("relative z-50 w-full max-h-[236px] min-w-[8rem] overflow-hidden rounded-md bg-coreColors-inputBackground text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", position === "popper" &&
|
|
40
|
-
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position }, props, { children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, Object.assign({ className: cn(position === "popper" &&
|
|
41
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]") }, { children: children })), _jsx(SelectScrollDownButton, {})] })) }));
|
|
42
|
-
});
|
|
43
|
-
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
44
|
-
const SelectLabel = React.forwardRef((_a, ref) => {
|
|
45
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
46
|
-
return (_jsx(SelectPrimitive.Label, Object.assign({ ref: ref, className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className) }, props)));
|
|
47
|
-
});
|
|
48
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
49
|
-
const SelectItem = React.forwardRef((_a, ref) => {
|
|
50
|
-
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
51
|
-
return (_jsx(SelectPrimitive.Item, Object.assign({ ref: ref, className: cn("border-b border-coreColors-dividingLines relative flex w-full cursor-default select-none items-center text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", "data-[state=checked]:bg-black/10", className) }, props, { children: children })));
|
|
52
|
-
});
|
|
53
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
54
|
-
const SelectSeparator = React.forwardRef((_a, ref) => {
|
|
55
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
56
|
-
return (_jsx(SelectPrimitive.Separator, Object.assign({ ref: ref, className: cn("-mx-1 my-1 h-px bg-muted", className) }, props)));
|
|
57
|
-
});
|
|
58
|
-
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
59
|
-
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
|