@tapcart/mobile-components 0.7.81 → 0.7.82

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.
@@ -1,8 +1,8 @@
1
- import React from "react"
1
+ import React from "react";
2
2
  declare const useTap: (tapThreshold?: number) => {
3
- onTap: (handler: (event: any) => void) => (event: any) => void
4
- isPressed: boolean
5
- ref: React.MutableRefObject<null>
6
- }
7
- export { useTap }
8
- //# sourceMappingURL=use-tap.d.ts.map
3
+ onTap: (handler: (event: any) => void) => (event: any) => void;
4
+ isPressed: boolean;
5
+ ref: React.MutableRefObject<null>;
6
+ };
7
+ export { useTap };
8
+ //# sourceMappingURL=use-tap.d.ts.map
@@ -1,100 +1,100 @@
1
- "use client"
2
- import { useState, useEffect, useCallback, useRef } from "react"
1
+ "use client";
2
+ import { useState, useEffect, useCallback, useRef } from "react";
3
3
  // Shared manager for all instances of the hook
4
4
  const tapManager = (() => {
5
- const elements = new Map()
6
- let isListening = false
7
- const startListening = () => {
8
- if (isListening) return
9
- const handleTouchStart = (e) => {
10
- const touch = e.touches[0]
11
- elements.forEach((data, el) => {
12
- if (el.contains(touch.target)) {
13
- data.touchStarted = true
14
- data.touchMoved = false
15
- data.startPosition = { x: touch.clientX, y: touch.clientY }
16
- // Don't set isPressed here, wait to determine if it's a tap or drag
17
- }
18
- })
19
- }
20
- const handleTouchMove = (e) => {
21
- const touch = e.touches[0]
22
- elements.forEach((data, el) => {
23
- if (data.touchStarted) {
24
- const deltaX = Math.abs(touch.clientX - data.startPosition.x)
25
- const deltaY = Math.abs(touch.clientY - data.startPosition.y)
26
- if (deltaX > data.tapThreshold || deltaY > data.tapThreshold) {
27
- data.touchMoved = true
28
- data.setIsPressed(false)
29
- }
30
- }
31
- })
32
- }
33
- const handleTouchEnd = () => {
34
- elements.forEach((data) => {
35
- if (data.touchStarted) {
36
- data.touchStarted = false
37
- if (!data.touchMoved) {
38
- // It's a tap, set isPressed briefly
39
- data.setIsPressed(true)
40
- setTimeout(() => data.setIsPressed(false), 100)
41
- }
42
- }
43
- })
44
- }
45
- document.addEventListener("touchstart", (e) => handleTouchStart(e), {
46
- passive: true,
47
- })
48
- document.addEventListener("touchmove", (e) => handleTouchMove(e), {
49
- passive: true,
50
- })
51
- document.addEventListener("touchend", () => handleTouchEnd(), {
52
- passive: true,
53
- })
54
- isListening = true
55
- }
56
- return {
57
- register: (el, data) => {
58
- elements.set(el, data)
59
- startListening()
60
- },
61
- unregister: (el) => {
62
- elements.delete(el)
63
- },
64
- elements,
65
- }
66
- })()
5
+ const elements = new Map();
6
+ let isListening = false;
7
+ const startListening = () => {
8
+ if (isListening)
9
+ return;
10
+ const handleTouchStart = (e) => {
11
+ const touch = e.touches[0];
12
+ elements.forEach((data, el) => {
13
+ if (el.contains(touch.target)) {
14
+ data.touchStarted = true;
15
+ data.touchMoved = false;
16
+ data.startPosition = { x: touch.clientX, y: touch.clientY };
17
+ // Don't set isPressed here, wait to determine if it's a tap or drag
18
+ }
19
+ });
20
+ };
21
+ const handleTouchMove = (e) => {
22
+ const touch = e.touches[0];
23
+ elements.forEach((data, el) => {
24
+ if (data.touchStarted) {
25
+ const deltaX = Math.abs(touch.clientX - data.startPosition.x);
26
+ const deltaY = Math.abs(touch.clientY - data.startPosition.y);
27
+ if (deltaX > data.tapThreshold || deltaY > data.tapThreshold) {
28
+ data.touchMoved = true;
29
+ data.setIsPressed(false);
30
+ }
31
+ }
32
+ });
33
+ };
34
+ const handleTouchEnd = () => {
35
+ elements.forEach((data) => {
36
+ if (data.touchStarted) {
37
+ data.touchStarted = false;
38
+ if (!data.touchMoved) {
39
+ // It's a tap, set isPressed briefly
40
+ data.setIsPressed(true);
41
+ setTimeout(() => data.setIsPressed(false), 100);
42
+ }
43
+ }
44
+ });
45
+ };
46
+ document.addEventListener("touchstart", (e) => handleTouchStart(e), { passive: true });
47
+ document.addEventListener("touchmove", (e) => handleTouchMove(e), { passive: true });
48
+ document.addEventListener("touchend", () => handleTouchEnd(), {
49
+ passive: true,
50
+ });
51
+ isListening = true;
52
+ };
53
+ return {
54
+ register: (el, data) => {
55
+ elements.set(el, data);
56
+ startListening();
57
+ },
58
+ unregister: (el) => {
59
+ elements.delete(el);
60
+ },
61
+ elements,
62
+ };
63
+ })();
67
64
  const useTap = (tapThreshold = 10) => {
68
- const [isPressed, setIsPressed] = useState(false)
69
- const elementRef = useRef(null)
70
- useEffect(() => {
71
- const element = elementRef.current
72
- if (!element) return
73
- const data = {
74
- touchStarted: false,
75
- touchMoved: false,
76
- startPosition: { x: 0, y: 0 },
77
- setIsPressed,
78
- tapThreshold,
79
- }
80
- tapManager.register(element, data)
81
- return () => {
82
- tapManager.unregister(element)
83
- }
84
- }, [tapThreshold])
85
- const onTap = useCallback((handler) => {
86
- return (event) => {
87
- const data = tapManager.elements.get(elementRef.current)
88
- if (!data) return
89
- if (event.type === "touchend" && !data.touchMoved) {
90
- handler(event)
91
- } else if (event.type === "click" && !data.touchStarted) {
92
- handler(event)
93
- setIsPressed(true)
94
- setTimeout(() => setIsPressed(false), 100)
95
- }
96
- }
97
- }, [])
98
- return { onTap, isPressed, ref: elementRef }
99
- }
100
- export { useTap }
65
+ const [isPressed, setIsPressed] = useState(false);
66
+ const elementRef = useRef(null);
67
+ useEffect(() => {
68
+ const element = elementRef.current;
69
+ if (!element)
70
+ return;
71
+ const data = {
72
+ touchStarted: false,
73
+ touchMoved: false,
74
+ startPosition: { x: 0, y: 0 },
75
+ setIsPressed,
76
+ tapThreshold,
77
+ };
78
+ tapManager.register(element, data);
79
+ return () => {
80
+ tapManager.unregister(element);
81
+ };
82
+ }, [tapThreshold]);
83
+ const onTap = useCallback((handler) => {
84
+ return (event) => {
85
+ const data = tapManager.elements.get(elementRef.current);
86
+ if (!data)
87
+ return;
88
+ if (event.type === "touchend" && !data.touchMoved) {
89
+ handler(event);
90
+ }
91
+ else if (event.type === "click" && !data.touchStarted) {
92
+ handler(event);
93
+ setIsPressed(true);
94
+ setTimeout(() => setIsPressed(false), 100);
95
+ }
96
+ };
97
+ }, []);
98
+ return { onTap, isPressed, ref: elementRef };
99
+ };
100
+ export { useTap };
@@ -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 };
@@ -0,0 +1,17 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,35 @@
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 };
@@ -0,0 +1,15 @@
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
@@ -0,0 +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;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"}
@@ -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))) })));
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 };
@@ -0,0 +1,14 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,59 @@
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, };
@@ -8,12 +8,17 @@ interface GridType {
8
8
  LoaderItem: React.FunctionComponent;
9
9
  overscan?: number;
10
10
  estimatedHeight?: number;
11
+ spacing?: {
12
+ horizontalGap: number;
13
+ verticalGap: number;
14
+ };
15
+ style?: React.CSSProperties;
11
16
  }
12
17
  declare const virtualGridVariants: (props?: ({
13
18
  columns?: 1 | 2 | 3 | 4 | null | undefined;
14
19
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
15
20
  export interface VirtualGridProps extends GridType, VariantProps<typeof virtualGridVariants> {
16
21
  }
17
- declare function VirtualGrid({ className, columns, children, overscan, estimatedHeight, isLoadingMore, isReachingEnd, LoaderItem, }: VirtualGridProps): import("react/jsx-runtime").JSX.Element;
22
+ declare function VirtualGrid({ className, columns, children, overscan, estimatedHeight, isLoadingMore, isReachingEnd, LoaderItem, spacing, style, }: VirtualGridProps): import("react/jsx-runtime").JSX.Element;
18
23
  export { VirtualGrid, virtualGridVariants };
19
24
  //# sourceMappingURL=virtual-grid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/virtual-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,UAAU,QAAQ;IAChB,SAAS,EAAE,GAAG,CAAA;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,QAAA,MAAM,mBAAmB;;mFAYvB,CAAA;AAEF,MAAM,WAAW,gBACf,SAAQ,QAAQ,EACd,YAAY,CAAC,OAAO,mBAAmB,CAAC;CAAG;AAE/C,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAY,EACZ,eAAqB,EACrB,aAAa,EACb,aAAa,EACb,UAAU,GACX,EAAE,gBAAgB,2CA6DlB;AAED,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
1
+ {"version":3,"file":"virtual-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/virtual-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,UAAU,QAAQ;IAChB,SAAS,EAAE,GAAG,CAAA;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE;QACR,aAAa,EAAE,MAAM,CAAA;QACrB,WAAW,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B;AAED,QAAA,MAAM,mBAAmB;;mFAYvB,CAAA;AAEF,MAAM,WAAW,gBACf,SAAQ,QAAQ,EACd,YAAY,CAAC,OAAO,mBAAmB,CAAC;CAAG;AAE/C,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAY,EACZ,eAAqB,EACrB,aAAa,EACb,aAAa,EACb,UAAU,EACV,OAGC,EACD,KAAK,GACN,EAAE,gBAAgB,2CAwElB;AAED,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
@@ -2,21 +2,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { cva } from "class-variance-authority";
4
4
  import { useVirtual } from "react-virtual";
5
+ import { Container } from "./container";
5
6
  import { cn } from "../../lib/utils";
6
7
  const virtualGridVariants = cva("grid", {
7
8
  variants: {
8
9
  columns: {
9
- 1: "grid-cols-1 gap-y-4",
10
- 2: "grid-cols-2 gap-x-[7px] gap-y-4",
11
- 3: "grid-cols-3 gap-x-[7px] gap-y-4",
12
- 4: "grid-cols-4 gap-x-[7px] gap-y-4",
10
+ 1: "grid-cols-1",
11
+ 2: "grid-cols-2",
12
+ 3: "grid-cols-3",
13
+ 4: "grid-cols-4",
13
14
  },
14
15
  },
15
16
  defaultVariants: {
16
17
  columns: 2,
17
18
  },
18
19
  });
19
- function VirtualGrid({ className, columns, children, overscan = 4, estimatedHeight = 375, isLoadingMore, isReachingEnd, LoaderItem, }) {
20
+ function VirtualGrid({ className, columns, children, overscan = 4, estimatedHeight = 375, isLoadingMore, isReachingEnd, LoaderItem, spacing = {
21
+ horizontalGap: 0,
22
+ verticalGap: 0,
23
+ }, style, }) {
20
24
  const NUM_LOADER_ITEMS = columns || 2;
21
25
  const col = columns || 2;
22
26
  const parentRef = React.useRef(document.getElementById("tc-vgsl"));
@@ -30,25 +34,28 @@ function VirtualGrid({ className, columns, children, overscan = 4, estimatedHeig
30
34
  overscan,
31
35
  initialRect: { width: 0, height: estimatedHeight },
32
36
  });
33
- return (_jsx("div", Object.assign({ style: {
34
- width: "100%",
35
- position: "relative",
36
- }, className: cn(virtualGridVariants({ columns }), className) }, { children: rowVirtualizer.virtualItems.map((virtualRow) => {
37
- const rowStartIndex = virtualRow.index * col;
38
- return (_jsx("div", Object.assign({ className: cn(virtualGridVariants({ columns })), style: {
39
- position: "absolute",
40
- top: 0,
41
- left: 0,
42
- width: "100%",
43
- transform: `translateY(${virtualRow.start}px)`,
44
- }, ref: virtualRow.measureRef }, { children: Array.from({ length: col }).map((_, colIndex) => {
45
- const index = rowStartIndex + colIndex;
46
- if (index >= childrenArray.length && !isReachingEnd)
47
- return (_jsx("div", { children: _jsx(LoaderItem, {}) }, index));
48
- if (!childrenArray[index])
49
- return null;
50
- return _jsx("div", { children: childrenArray[index] }, index);
51
- }) }), `row-${virtualRow.index}`));
52
- }) })));
37
+ return (_jsx(Container, Object.assign({ style: style }, { children: _jsx("div", Object.assign({ style: {
38
+ width: "100%",
39
+ height: (Math.ceil(childrenArray.length / col) - 1) * spacing.verticalGap +
40
+ rowVirtualizer.totalSize,
41
+ position: "relative",
42
+ } }, { children: rowVirtualizer.virtualItems.map((virtualRow) => {
43
+ const rowStartIndex = virtualRow.index * col;
44
+ return (_jsx("div", Object.assign({ className: cn(virtualGridVariants({ columns })), style: {
45
+ position: "absolute",
46
+ top: 0,
47
+ left: 0,
48
+ width: "100%",
49
+ transform: `translateY(${virtualRow.start + virtualRow.index * spacing.verticalGap}px)`,
50
+ columnGap: `${spacing === null || spacing === void 0 ? void 0 : spacing.horizontalGap}px`,
51
+ }, ref: virtualRow.measureRef }, { children: Array.from({ length: col }).map((_, colIndex) => {
52
+ const index = rowStartIndex + colIndex;
53
+ if (index >= childrenArray.length && !isReachingEnd)
54
+ return (_jsx("div", { children: _jsx(LoaderItem, {}) }, index));
55
+ if (!childrenArray[index])
56
+ return null;
57
+ return (_jsx("div", Object.assign({ style: { height: "100%" } }, { children: childrenArray[index] }), index));
58
+ }) }), `row-${virtualRow.index}`));
59
+ }) })) })));
53
60
  }
54
61
  export { VirtualGrid, virtualGridVariants };
package/dist/styles.css CHANGED
@@ -1458,18 +1458,10 @@ video {
1458
1458
  .rounded-sm {
1459
1459
  border-radius: calc(var(--radius) - 4px);
1460
1460
  }
1461
- .rounded-b {
1462
- border-bottom-right-radius: 0.25rem;
1463
- border-bottom-left-radius: 0.25rem;
1464
- }
1465
1461
  .rounded-b-lg {
1466
1462
  border-bottom-right-radius: var(--radius);
1467
1463
  border-bottom-left-radius: var(--radius);
1468
1464
  }
1469
- .rounded-t {
1470
- border-top-left-radius: 0.25rem;
1471
- border-top-right-radius: 0.25rem;
1472
- }
1473
1465
  .rounded-t-2xl {
1474
1466
  border-top-left-radius: 1rem;
1475
1467
  border-top-right-radius: 1rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.7.81",
3
+ "version": "0.7.82",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",
@@ -11,6 +11,20 @@
11
11
  "license": "SEE LICENSE IN LICENSE.md",
12
12
  "author": "Tapcart Inc.",
13
13
  "homepage": "https://tapcart.com",
14
+ "scripts": {
15
+ "clean": "rm -rf dist node_modules",
16
+ "lint": "eslint \"**/*.ts*\"",
17
+ "ui:add": "pnpm dlx shadcn-ui@latest add",
18
+ "build:styles": "postcss styles/globals.css -o dist/styles.css",
19
+ "build:ts": "tsc -p tsconfig.json && tsc-alias",
20
+ "build": "pnpm run build:ts && pnpm run build:styles",
21
+ "dev:ts": "tsc -w -p tsconfig.json",
22
+ "dev:styles": "npx tailwindcss -i styles/globals.css -o dist/styles.css --watch",
23
+ "dev": "concurrently \"pnpm run dev:ts\" \"pnpm run dev:styles\"",
24
+ "test": "jest",
25
+ "test:silent": "jest --silent",
26
+ "test:watch": "jest --watch"
27
+ },
14
28
  "peerDependencies": {
15
29
  "react": "^17.0.2 || ^18.0.0",
16
30
  "react-dom": "^17.0.2 || ^18.0.0"
@@ -23,20 +37,20 @@
23
37
  "@types/pluralize": "^0.0.33",
24
38
  "@types/react": "^18.2.0",
25
39
  "@types/react-dom": "^18.2.0",
40
+ "app-studio-types": "workspace:*",
26
41
  "autoprefixer": "^10.4.14",
27
42
  "chokidar-cli": "^3.0.0",
28
43
  "concurrently": "^8.2.2",
29
44
  "eslint": "^7.32.0",
45
+ "eslint-config-custom": "workspace:*",
30
46
  "jest": "^29.7.0",
31
47
  "jest-environment-jsdom": "^29.7.0",
32
48
  "postcss": "^8.4.24",
33
49
  "tailwindcss": "^3.3.2",
34
50
  "ts-jest": "^29.2.5",
35
51
  "tsc-alias": "^1.8.10",
36
- "typescript": "^4.5.2",
37
- "app-studio-types": "0.0.9",
38
- "eslint-config-custom": "0.0.0",
39
- "tsconfig": "0.0.0"
52
+ "tsconfig": "workspace:*",
53
+ "typescript": "^4.5.2"
40
54
  },
41
55
  "dependencies": {
42
56
  "@radix-ui/react-accordion": "^1.1.2",
@@ -77,18 +91,8 @@
77
91
  "tailwindcss-animate": "^1.0.6",
78
92
  "vaul": "0.9.1"
79
93
  },
80
- "scripts": {
81
- "clean": "rm -rf dist node_modules",
82
- "lint": "eslint \"**/*.ts*\"",
83
- "ui:add": "pnpm dlx shadcn-ui@latest add",
84
- "build:styles": "postcss styles/globals.css -o dist/styles.css",
85
- "build:ts": "tsc -p tsconfig.json && tsc-alias",
86
- "build": "pnpm run build:ts && pnpm run build:styles",
87
- "dev:ts": "tsc -w -p tsconfig.json",
88
- "dev:styles": "npx tailwindcss -i styles/globals.css -o dist/styles.css --watch",
89
- "dev": "concurrently \"pnpm run dev:ts\" \"pnpm run dev:styles\"",
90
- "test": "jest",
91
- "test:silent": "jest --silent",
92
- "test:watch": "jest --watch"
94
+ "publishConfig": {
95
+ "access": "public",
96
+ "registry": "https://registry.npmjs.org/"
93
97
  }
94
- }
98
+ }
@@ -1,6 +0,0 @@
1
- import React from "react"
2
- export declare function useClickOutside(
3
- ref: React.RefObject<HTMLElement>,
4
- callback: () => void
5
- ): void
6
- //# sourceMappingURL=use-click-outside.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-click-outside.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-click-outside.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAE,IAAI,CAa5F"}
@@ -1,15 +0,0 @@
1
- "use client"
2
- import React from "react"
3
- export function useClickOutside(ref, callback) {
4
- React.useEffect(() => {
5
- const handleClickOutside = (event) => {
6
- if (ref.current && !ref.current.contains(event.target)) {
7
- callback()
8
- }
9
- }
10
- document.addEventListener("mousedown", handleClickOutside)
11
- return () => {
12
- document.removeEventListener("mousedown", handleClickOutside)
13
- }
14
- }, [ref, callback])
15
- }
@@ -1,7 +0,0 @@
1
- import React from "react"
2
- declare const useClickOutside: (
3
- ref: React.RefObject<HTMLElement>,
4
- callback: () => void
5
- ) => void
6
- export default useClickOutside
7
- //# sourceMappingURL=use-outside-click.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-outside-click.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-outside-click.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAA,MAAM,eAAe,QAAS,MAAM,SAAS,CAAC,WAAW,CAAC,YAAY,MAAM,IAAI,SAa/E,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,16 +0,0 @@
1
- "use client"
2
- import React from "react"
3
- const useClickOutside = (ref, callback) => {
4
- React.useEffect(() => {
5
- const handleClickOutside = (event) => {
6
- if (ref.current && !ref.current.contains(event.target)) {
7
- callback()
8
- }
9
- }
10
- document.addEventListener("mousedown", handleClickOutside)
11
- return () => {
12
- document.removeEventListener("mousedown", handleClickOutside)
13
- }
14
- }, [ref, callback])
15
- }
16
- export default useClickOutside