@tapcart/mobile-components 0.3.1 → 0.4.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 -2
- package/dist/components/hooks/use-infinite-scroll.d.ts.map +1 -1
- package/dist/components/hooks/use-infinite-scroll.js +59 -7
- 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 +9 -2
- package/dist/components/ui/chip.js +1 -1
- package/dist/components/ui/empty-message.d.ts +19 -0
- package/dist/components/ui/empty-message.d.ts.map +1 -0
- package/dist/components/ui/empty-message.js +30 -0
- package/dist/components/ui/price.d.ts.map +1 -1
- package/dist/components/ui/product-grid.d.ts +2 -1
- package/dist/components/ui/product-grid.d.ts.map +1 -1
- 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 +6 -0
- package/package.json +17 -16
|
@@ -4,9 +4,10 @@ interface Product {
|
|
|
4
4
|
interface PageData {
|
|
5
5
|
products: Product[];
|
|
6
6
|
cursorBlob?: string;
|
|
7
|
+
filtersData: any;
|
|
7
8
|
}
|
|
8
9
|
interface UseInfiniteScrollProps {
|
|
9
|
-
initialData: PageData
|
|
10
|
+
initialData: PageData;
|
|
10
11
|
loadMoreProducts: (params: any) => Promise<PageData>;
|
|
11
12
|
queryVariables: Record<string, any>;
|
|
12
13
|
}
|
|
@@ -22,6 +23,6 @@ interface UseInfiniteScrollReturn {
|
|
|
22
23
|
isLoading: boolean;
|
|
23
24
|
isValidating: boolean;
|
|
24
25
|
}
|
|
25
|
-
declare const useInfiniteScroll: ({ initialData, loadMoreProducts, queryVariables, }: UseInfiniteScrollProps) => UseInfiniteScrollReturn;
|
|
26
|
+
declare const useInfiniteScroll: ({ initialData, loadMoreProducts, queryVariables: queryVariableProps, }: UseInfiniteScrollProps) => UseInfiniteScrollReturn;
|
|
26
27
|
export { useInfiniteScroll };
|
|
27
28
|
//# sourceMappingURL=use-infinite-scroll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-infinite-scroll.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-infinite-scroll.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-infinite-scroll.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-infinite-scroll.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACf,MAAM,EAAE,MAAM,CAAA;CAEf;AAED,UAAU,QAAQ;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,GAAG,CAAA;CACjB;AAOD,UAAU,sBAAsB;IAC9B,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;CACpC;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAA;IAC5B,KAAK,EAAE,GAAG,CAAA;IACV,oBAAoB,EAAE,OAAO,CAAA;IAC7B,aAAa,EAAE,OAAO,GAAG,SAAS,CAAA;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;IAChD,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;CACtB;AA0CD,QAAA,MAAM,iBAAiB,2EAIpB,sBAAsB,KAAG,uBA+F3B,CAAA;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1,10 +1,60 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCallback, useEffect } from "react";
|
|
2
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
3
3
|
import useSWRInfinite from "swr/infinite";
|
|
4
4
|
import { useInView } from "react-intersection-observer";
|
|
5
|
+
import { useSearchParams } from "next/navigation";
|
|
5
6
|
const PAGE_SIZE = 8;
|
|
6
|
-
const
|
|
7
|
+
const parseSort = (json) => {
|
|
8
|
+
return json ? JSON.parse(json) : undefined;
|
|
9
|
+
};
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
const reconcileFilters = ({ selectedFilters, filtersData }) => {
|
|
12
|
+
if (!selectedFilters)
|
|
13
|
+
throw new Error("No filters provided");
|
|
14
|
+
const filtersArray = selectedFilters ? JSON.parse(selectedFilters) : undefined;
|
|
15
|
+
if (!filtersData)
|
|
16
|
+
throw new Error("No filters data found");
|
|
17
|
+
const selectedTags = new Map();
|
|
18
|
+
filtersArray === null || filtersArray === void 0 ? void 0 : filtersArray.forEach((filter) => {
|
|
19
|
+
selectedTags.set(filter, true);
|
|
20
|
+
});
|
|
21
|
+
const matchingFilters = (filtersList, selectedTags) => {
|
|
22
|
+
return filtersList.filter((filter) => {
|
|
23
|
+
const parsedFilter = filter.tag;
|
|
24
|
+
return selectedTags.has(parsedFilter);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const searchFilters = (filtersData === null || filtersData === void 0 ? void 0 : filtersData.map((category) => {
|
|
28
|
+
const filterList = category.filters;
|
|
29
|
+
const matchingFiltersList = matchingFilters(filterList, selectedTags);
|
|
30
|
+
return Object.assign(Object.assign({}, category), { filters: matchingFiltersList });
|
|
31
|
+
})) || [];
|
|
32
|
+
return {
|
|
33
|
+
searchFilters,
|
|
34
|
+
filtersData,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const useInfiniteScroll = ({ initialData, loadMoreProducts, queryVariables: queryVariableProps, }) => {
|
|
7
38
|
var _a, _b, _c, _d;
|
|
39
|
+
const searchParams = useSearchParams();
|
|
40
|
+
const sortStateFromParam = useCallback(() => {
|
|
41
|
+
return (searchParams === null || searchParams === void 0 ? void 0 : searchParams.get("sort"))
|
|
42
|
+
? parseSort(searchParams.get("sort"))
|
|
43
|
+
: // we need to default to the sort option from the query variables so that the initial sort is correct
|
|
44
|
+
queryVariableProps.sortOption;
|
|
45
|
+
}, [queryVariableProps.sortOption, searchParams]);
|
|
46
|
+
const selectedFilters = (searchParams === null || searchParams === void 0 ? void 0 : searchParams.get("filters")) || "[]";
|
|
47
|
+
const queryVariables = useMemo(() => {
|
|
48
|
+
return Object.assign(Object.assign({}, queryVariableProps), { sortOption: sortStateFromParam(), filterCategories: reconcileFilters({
|
|
49
|
+
selectedFilters,
|
|
50
|
+
filtersData: initialData.filtersData,
|
|
51
|
+
}).searchFilters });
|
|
52
|
+
}, [
|
|
53
|
+
initialData.filtersData,
|
|
54
|
+
queryVariableProps,
|
|
55
|
+
selectedFilters,
|
|
56
|
+
sortStateFromParam,
|
|
57
|
+
]);
|
|
8
58
|
const { ref, inView } = useInView({ rootMargin: "600px" }); // controls how early the next page loads
|
|
9
59
|
const getKey = (pageIndex, previousPageData) => {
|
|
10
60
|
var _a;
|
|
@@ -15,8 +65,6 @@ const useInfiniteScroll = ({ initialData, loadMoreProducts, queryVariables, }) =
|
|
|
15
65
|
return Object.assign(Object.assign({}, queryVariables), { cursorBlob: previousPageData.pageData.cursorBlob });
|
|
16
66
|
};
|
|
17
67
|
const { data, error, size, setSize, isLoading, isValidating, } = useSWRInfinite(getKey, loadMoreProducts, {
|
|
18
|
-
// @ts-expect-error
|
|
19
|
-
fallbackData: [initialData],
|
|
20
68
|
revalidateFirstPage: false,
|
|
21
69
|
initialSize: 1,
|
|
22
70
|
});
|
|
@@ -38,16 +86,20 @@ const useInfiniteScroll = ({ initialData, loadMoreProducts, queryVariables, }) =
|
|
|
38
86
|
loadMore();
|
|
39
87
|
}
|
|
40
88
|
}, [inView, loadMore]);
|
|
89
|
+
// Trigger a new page load when the query variables change
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
setSize(1);
|
|
92
|
+
}, [queryVariables, setSize]);
|
|
41
93
|
return {
|
|
42
94
|
data,
|
|
43
95
|
error,
|
|
44
|
-
isLoadingInitialData,
|
|
96
|
+
isLoadingInitialData: false,
|
|
45
97
|
isLoadingMore,
|
|
46
98
|
isEmpty,
|
|
47
99
|
isReachingEnd,
|
|
48
100
|
ref,
|
|
49
|
-
products: data ? data.flatMap((page) => page === null || page === void 0 ? void 0 : page.products) : [],
|
|
50
|
-
isLoading,
|
|
101
|
+
products: data ? data === null || data === void 0 ? void 0 : data.flatMap((page) => page === null || page === void 0 ? void 0 : page.products) : [],
|
|
102
|
+
isLoading: false,
|
|
51
103
|
isValidating,
|
|
52
104
|
};
|
|
53
105
|
};
|
|
@@ -9,6 +9,7 @@ type CarouselProps = {
|
|
|
9
9
|
plugins?: CarouselPlugin;
|
|
10
10
|
orientation?: "horizontal" | "vertical";
|
|
11
11
|
setApi?: (api: CarouselApi) => void;
|
|
12
|
+
slidesInView?: (slides: Array<number>) => void;
|
|
12
13
|
};
|
|
13
14
|
declare const Carousel: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & CarouselProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
15
|
declare const CarouselContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../components/ui/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAA;AAM7B,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAA;AAC1C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAChE,K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AAGF,QAAA,MAAM,YAAY,kLA0BhB,CAAA;AAIF,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,QAAA,MAAM,YAAY,iIA8ChB,CAAC;AAGH,OAAO,EACL,KAAK,WAAW,EAChB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,CAAA"}
|
|
@@ -25,7 +25,7 @@ function useCarousel() {
|
|
|
25
25
|
return context;
|
|
26
26
|
}
|
|
27
27
|
const Carousel = React.forwardRef((_a, ref) => {
|
|
28
|
-
var { orientation = "horizontal", opts, setApi, plugins, className, children } = _a, props = __rest(_a, ["orientation", "opts", "setApi", "plugins", "className", "children"]);
|
|
28
|
+
var { orientation = "horizontal", opts, setApi, plugins, className, children, slidesInView } = _a, props = __rest(_a, ["orientation", "opts", "setApi", "plugins", "className", "children", "slidesInView"]);
|
|
29
29
|
const [carouselRef, api] = useEmblaCarousel(Object.assign(Object.assign({}, opts), { axis: orientation === "horizontal" ? "x" : "y" }), plugins);
|
|
30
30
|
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
31
31
|
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
@@ -36,6 +36,12 @@ const Carousel = React.forwardRef((_a, ref) => {
|
|
|
36
36
|
setCanScrollPrev(api.canScrollPrev());
|
|
37
37
|
setCanScrollNext(api.canScrollNext());
|
|
38
38
|
}, []);
|
|
39
|
+
const onSlidesInView = React.useCallback((api) => {
|
|
40
|
+
if (!api) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
slidesInView === null || slidesInView === void 0 ? void 0 : slidesInView(api.slidesInView());
|
|
44
|
+
}, [slidesInView]);
|
|
39
45
|
const scrollPrev = React.useCallback(() => {
|
|
40
46
|
api === null || api === void 0 ? void 0 : api.scrollPrev();
|
|
41
47
|
}, [api]);
|
|
@@ -65,6 +71,7 @@ const Carousel = React.forwardRef((_a, ref) => {
|
|
|
65
71
|
onSelect(api);
|
|
66
72
|
api.on("reInit", onSelect);
|
|
67
73
|
api.on("select", onSelect);
|
|
74
|
+
api.on("slidesInView", onSlidesInView);
|
|
68
75
|
return () => {
|
|
69
76
|
api === null || api === void 0 ? void 0 : api.off("select", onSelect);
|
|
70
77
|
};
|
|
@@ -127,7 +134,7 @@ const CarouselDots = React.forwardRef((_a, ref) => {
|
|
|
127
134
|
const numberOfSlides = Math.min((api === null || api === void 0 ? void 0 : api.scrollSnapList().length) || 0, maxDots);
|
|
128
135
|
const currentSlide = Math.min((api === null || api === void 0 ? void 0 : api.selectedScrollSnap()) || 0, maxDots - 1);
|
|
129
136
|
if (numberOfSlides > 1) {
|
|
130
|
-
return (_jsx("div", Object.assign({ ref: ref, className: `flex justify-center ${props.className}` }, { children: Array.from({ length: numberOfSlides }, (_, i) => (_jsx(Button, { className: `mx-1 h-1.5 w-1.5 rounded-full p-0 ${i === currentSlide
|
|
137
|
+
return (_jsx("div", Object.assign({ ref: ref, className: `flex justify-center ${props.className}` }, { children: Array.from({ length: numberOfSlides }, (_, i) => (_jsx(Button, { className: `mx-1 h-1.5 w-1.5 rounded-full p-0 border-none ${i === currentSlide
|
|
131
138
|
? 'bg-coreColors-brandColorPrimary'
|
|
132
139
|
: 'bg-coreColors-brandColorPrimary opacity-50'}`, "aria-label": `Go to slide ${i + 1}`, onClick: () => api === null || api === void 0 ? void 0 : api.scrollTo(i) }, i))) })));
|
|
133
140
|
}
|
|
@@ -65,7 +65,7 @@ const MultipleChips = ({ children, containerRef, }) => {
|
|
|
65
65
|
useEffect(() => {
|
|
66
66
|
checkOverflow();
|
|
67
67
|
}, [children]);
|
|
68
|
-
return (_jsxs("div", Object.assign({ className: "relative" }, { children: [_jsx("div", Object.assign({ ref: containerRef, className: "flex overflow-x-auto overflow-y-hidden
|
|
68
|
+
return (_jsxs("div", Object.assign({ className: "relative no-scrollbar" }, { children: [_jsx("div", Object.assign({ ref: containerRef, className: "flex overflow-x-auto overflow-y-hidden", onScroll: checkOverflow }, { children: children.map((chip, index) => (_jsx("div", Object.assign({ className: cn("shrink-0", {
|
|
69
69
|
"mr-2": index < children.length - 1,
|
|
70
70
|
}) }, { children: chip }), index))) })), 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" }))] })));
|
|
71
71
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface EmptyMessageProps {
|
|
2
|
+
iconName: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
buttonLabel?: string;
|
|
7
|
+
heightOffset?: number;
|
|
8
|
+
openScreen: (params: OpenScreenParams) => void;
|
|
9
|
+
}
|
|
10
|
+
interface Destination {
|
|
11
|
+
type: "internal" | "external";
|
|
12
|
+
url: string;
|
|
13
|
+
}
|
|
14
|
+
interface OpenScreenParams {
|
|
15
|
+
destination: Destination;
|
|
16
|
+
}
|
|
17
|
+
declare function EmptyMessage({ iconName, title, description, className, buttonLabel, openScreen, }: EmptyMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { EmptyMessage };
|
|
19
|
+
//# sourceMappingURL=empty-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-message.d.ts","sourceRoot":"","sources":["../../../components/ui/empty-message.tsx"],"names":[],"mappings":"AAOA,UAAU,iBAAiB;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC/C;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAA;IAC7B,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,UAAU,gBAAgB;IACxB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,iBAAS,YAAY,CAAC,EACpB,QAAQ,EACR,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,GACX,EAAE,iBAAiB,2CA+CnB;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "./button";
|
|
4
|
+
import { Icon } from "./icon";
|
|
5
|
+
import { Text } from "./text";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
8
|
+
function EmptyMessage({ iconName, title, description, className, buttonLabel, openScreen, }) {
|
|
9
|
+
const router = useRouter();
|
|
10
|
+
const pathname = usePathname();
|
|
11
|
+
const searchParams = useSearchParams();
|
|
12
|
+
const onClick = () => {
|
|
13
|
+
const newParams = new URLSearchParams(searchParams.toString());
|
|
14
|
+
const filters = newParams.get("filters");
|
|
15
|
+
if (filters) {
|
|
16
|
+
newParams.delete("filters");
|
|
17
|
+
router.push(`${pathname}?${newParams}`);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
openScreen({
|
|
21
|
+
destination: {
|
|
22
|
+
type: "internal",
|
|
23
|
+
url: "/home",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("div", Object.assign({ className: cn("flex-grow flex flex-col justify-center items-center gap-4 h-full", className) }, { children: [_jsxs("div", Object.assign({ className: "flex flex-col justify-center items-center gap-2" }, { children: [_jsx(Icon, { name: iconName, size: "md", color: "coreColors-secondaryIcon" }), _jsx(Text, Object.assign({ type: "h2", className: "text-textColors-primaryColor text-center" }, { children: title })), _jsx(Text, Object.assign({ type: "body-primary", className: "text-textColors-secondaryColor text-center" }, { children: description }))] })), buttonLabel ? (_jsx(Button, Object.assign({ variant: "default", onClick: onClick, className: "w-auto" }, { children: buttonLabel }))) : null] })));
|
|
29
|
+
}
|
|
30
|
+
export { EmptyMessage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../components/ui/price.tsx"],"names":[],"mappings":"AAKA,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;CAClB;AAED,iBAAS,KAAK,CAAC,EACb,KAAK,EACL,SAAS,EACT,WAAmB,EACnB,MAAc,EACd,cAAc,EACd,kBAAkB,EAClB,QAAgB,EAChB,MAAgB,EAChB,QAAa,GACd,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../components/ui/price.tsx"],"names":[],"mappings":"AAKA,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;CAClB;AAED,iBAAS,KAAK,CAAC,EACb,KAAK,EACL,SAAS,EACT,WAAmB,EACnB,MAAc,EACd,cAAc,EACd,kBAAkB,EAClB,QAAgB,EAChB,MAAgB,EAChB,QAAa,GACd,EAAE,UAAU,2CAwFZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -2,9 +2,10 @@ type Product = any;
|
|
|
2
2
|
interface PageData {
|
|
3
3
|
products: Product[];
|
|
4
4
|
cursorBlob?: string;
|
|
5
|
+
filtersData: any;
|
|
5
6
|
}
|
|
6
7
|
interface ProductGridItemsProps {
|
|
7
|
-
initialData: PageData
|
|
8
|
+
initialData: PageData;
|
|
8
9
|
loadMoreProducts: (params: any) => Promise<PageData>;
|
|
9
10
|
queryVariables: Record<string, any>;
|
|
10
11
|
config: Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -40,5 +40,6 @@ export * from "./components/ui/line-item-text-icons";
|
|
|
40
40
|
export * from "./components/ui/textarea";
|
|
41
41
|
export * from "./components/hooks/use-scroll-direction";
|
|
42
42
|
export * from "./components/ui/image";
|
|
43
|
+
export * from "./components/ui/empty-message";
|
|
43
44
|
export { cn, cva } from "./lib/utils";
|
|
44
45
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA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,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wCAAwC,CAAA;AACtD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sCAAsC,CAAA;AACpD,cAAc,0BAA0B,CAAA;AACxC,cAAc,yCAAyC,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -41,4 +41,5 @@ export * from "./components/ui/line-item-text-icons";
|
|
|
41
41
|
export * from "./components/ui/textarea";
|
|
42
42
|
export * from "./components/hooks/use-scroll-direction";
|
|
43
43
|
export * from "./components/ui/image";
|
|
44
|
+
export * from "./components/ui/empty-message";
|
|
44
45
|
export { cn, cva } from "./lib/utils";
|
package/dist/styles.css
CHANGED
|
@@ -1008,6 +1008,9 @@ video {
|
|
|
1008
1008
|
.shrink-0 {
|
|
1009
1009
|
flex-shrink: 0;
|
|
1010
1010
|
}
|
|
1011
|
+
.flex-grow {
|
|
1012
|
+
flex-grow: 1;
|
|
1013
|
+
}
|
|
1011
1014
|
.grow {
|
|
1012
1015
|
flex-grow: 1;
|
|
1013
1016
|
}
|
|
@@ -1243,6 +1246,9 @@ video {
|
|
|
1243
1246
|
.border-t {
|
|
1244
1247
|
border-top-width: 1px;
|
|
1245
1248
|
}
|
|
1249
|
+
.border-none {
|
|
1250
|
+
border-style: none;
|
|
1251
|
+
}
|
|
1246
1252
|
.\!border-stateColors-error {
|
|
1247
1253
|
border-color: var(--stateColors-error) !important;
|
|
1248
1254
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
12
12
|
"author": "Tapcart Inc.",
|
|
13
13
|
"homepage": "https://tapcart.com",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"lint": "eslint \"**/*.ts*\"",
|
|
16
|
+
"ui:add": "pnpm dlx shadcn-ui@latest add",
|
|
17
|
+
"build:styles": "postcss styles/globals.css -o dist/styles.css",
|
|
18
|
+
"build:ts": "tsc -p tsconfig.json && tsc-alias",
|
|
19
|
+
"build": "pnpm run build:ts && pnpm run build:styles",
|
|
20
|
+
"dev:ts": "tsc -w -p tsconfig.json",
|
|
21
|
+
"dev:styles": "npx tailwindcss -i styles/globals.css -o dist/styles.css --watch",
|
|
22
|
+
"dev": "concurrently \"pnpm run dev:ts\" \"pnpm run dev:styles\""
|
|
23
|
+
},
|
|
14
24
|
"peerDependencies": {
|
|
15
25
|
"react": "^17.0.2 || ^18.0.0",
|
|
16
26
|
"react-dom": "^17.0.2 || ^18.0.0"
|
|
@@ -19,17 +29,17 @@
|
|
|
19
29
|
"@types/lodash": "4.17.5",
|
|
20
30
|
"@types/react": "^18.2.0",
|
|
21
31
|
"@types/react-dom": "^18.2.0",
|
|
32
|
+
"app-studio-types": "workspace:*",
|
|
22
33
|
"autoprefixer": "^10.4.14",
|
|
23
34
|
"chokidar-cli": "^3.0.0",
|
|
24
35
|
"concurrently": "^8.2.2",
|
|
25
36
|
"eslint": "^7.32.0",
|
|
37
|
+
"eslint-config-custom": "workspace:*",
|
|
26
38
|
"postcss": "^8.4.24",
|
|
27
39
|
"tailwindcss": "^3.3.2",
|
|
28
40
|
"tsc-alias": "^1.8.10",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"tsconfig": "0.0.0",
|
|
32
|
-
"app-studio-types": "0.0.0"
|
|
41
|
+
"tsconfig": "workspace:*",
|
|
42
|
+
"typescript": "^4.5.2"
|
|
33
43
|
},
|
|
34
44
|
"dependencies": {
|
|
35
45
|
"@radix-ui/react-accordion": "^1.1.2",
|
|
@@ -53,6 +63,7 @@
|
|
|
53
63
|
"clsx": "^1.2.1",
|
|
54
64
|
"embla-carousel-react": "^8.0.2",
|
|
55
65
|
"lucide-react": "^0.248.0",
|
|
66
|
+
"next": "^14.2.5",
|
|
56
67
|
"next-themes": "^0.2.1",
|
|
57
68
|
"postcss-cli": "^11.0.0",
|
|
58
69
|
"react-intersection-observer": "^9.10.2",
|
|
@@ -60,15 +71,5 @@
|
|
|
60
71
|
"tailwind-merge": "^1.13.2",
|
|
61
72
|
"tailwindcss-animate": "^1.0.6",
|
|
62
73
|
"vaul": "^0.9.1"
|
|
63
|
-
},
|
|
64
|
-
"scripts": {
|
|
65
|
-
"lint": "eslint \"**/*.ts*\"",
|
|
66
|
-
"ui:add": "pnpm dlx shadcn-ui@latest add",
|
|
67
|
-
"build:styles": "postcss styles/globals.css -o dist/styles.css",
|
|
68
|
-
"build:ts": "tsc -p tsconfig.json && tsc-alias",
|
|
69
|
-
"build": "pnpm run build:ts && pnpm run build:styles",
|
|
70
|
-
"dev:ts": "tsc -w -p tsconfig.json",
|
|
71
|
-
"dev:styles": "npx tailwindcss -i styles/globals.css -o dist/styles.css --watch",
|
|
72
|
-
"dev": "concurrently \"pnpm run dev:ts\" \"pnpm run dev:styles\""
|
|
73
74
|
}
|
|
74
|
-
}
|
|
75
|
+
}
|