@tapcart/mobile-components 0.6.16 → 0.6.18
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-products.d.ts.map +1 -1
- package/dist/components/hooks/use-products.js +1 -0
- package/dist/components/ui/button.d.ts +1 -0
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +2 -2
- package/package.json +16 -16
- package/dist/components/hooks/use-reviews.d.ts +0 -21
- package/dist/components/hooks/use-reviews.d.ts.map +0 -1
- package/dist/components/hooks/use-reviews.js +0 -45
- package/dist/components/hooks/use-tap.d.ts +0 -13
- package/dist/components/hooks/use-tap.d.ts.map +0 -1
- package/dist/components/hooks/use-tap.js +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-products.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-products.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-products.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-products.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,KAAK,GAAG,GAAG,MAAM,CAAA;AACjB,KAAK,cAAc,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AACxD,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,OAAO,EAAE,GAAG,CAAA;IACZ,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACvC,UAAU,CAAC,EAAE,cAAc,EAAE,CAAA;CAC9B,CAAA;AACD,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,CA8B7E"}
|
|
@@ -15,6 +15,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
15
15
|
iconColor?: string;
|
|
16
16
|
iconSize?: string;
|
|
17
17
|
iconStrokeColor?: string;
|
|
18
|
+
iconClassName?: string;
|
|
18
19
|
iconPosition?: "left" | "right";
|
|
19
20
|
}
|
|
20
21
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAGL,KAAK,EAEL,SAAS,EAET,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AAIxB,QAAA,MAAM,cAAc;;;mFAgCnB,CAAA;AAwCD,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAA;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC;AAED,QAAA,MAAM,MAA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elVariants = cva("truncate", {
|
|
|
79
79
|
},
|
|
80
80
|
});
|
|
81
81
|
const Button = React.forwardRef((_a, ref) => {
|
|
82
|
-
var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconStrokeColor", "iconPosition", "iconSize", "iconUrl"]);
|
|
82
|
+
var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl, iconClassName } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconStrokeColor", "iconPosition", "iconSize", "iconUrl", "iconClassName"]);
|
|
83
83
|
const Comp = asChild ? Slot : "button";
|
|
84
84
|
const IconButton = () => icon || iconUrl ? (_jsx(Icon, { name: icon, size: "sm", style: { color: iconColor } })) : null;
|
|
85
85
|
const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: iconSize || variant === "quickadd" ? "xs" : "sm", className: cn(iconVariants({ variant }), {
|
|
86
86
|
"mr-2": iconPosition === "left",
|
|
87
87
|
"ml-2": iconPosition === "right",
|
|
88
|
-
}), strokeColor: iconStrokeColor, style: { color: iconColor, stroke: iconColor, fill: iconColor } })) : null, !loading ? (_jsx(Text, Object.assign({ type: "body-primary", className: cn(labelVariants({ variant }), labelClassName), style: labelStyle }, { children: props.children }))) : (_jsx(_Fragment, {}))] }));
|
|
88
|
+
}, iconClassName), strokeColor: iconStrokeColor, style: { color: iconColor, stroke: iconColor, fill: iconColor } })) : null, !loading ? (_jsx(Text, Object.assign({ type: "body-primary", className: cn(labelVariants({ variant }), labelClassName), style: labelStyle }, { children: props.children }))) : (_jsx(_Fragment, {}))] }));
|
|
89
89
|
const LoadingButton = () => (_jsx("div", Object.assign({ className: cn("flex items-center justify-center", size === "icon" ? "h-5" : "h-6") }, { children: _jsx(Icon, { className: cn(iconVariants({ variant }), "h-5 w-5 animate-spin"), name: "loader", style: { color: iconColor } }) })));
|
|
90
90
|
return (_jsx(Comp, Object.assign({ className: cn(buttonVariants({ variant, size }), className, {
|
|
91
91
|
"pointer-events-none": loading,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -11,16 +11,6 @@
|
|
|
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
|
-
},
|
|
24
14
|
"peerDependencies": {
|
|
25
15
|
"react": "^17.0.2 || ^18.0.0",
|
|
26
16
|
"react-dom": "^17.0.2 || ^18.0.0"
|
|
@@ -29,17 +19,17 @@
|
|
|
29
19
|
"@types/lodash": "4.17.5",
|
|
30
20
|
"@types/react": "^18.2.0",
|
|
31
21
|
"@types/react-dom": "^18.2.0",
|
|
32
|
-
"app-studio-types": "workspace:*",
|
|
33
22
|
"autoprefixer": "^10.4.14",
|
|
34
23
|
"chokidar-cli": "^3.0.0",
|
|
35
24
|
"concurrently": "^8.2.2",
|
|
36
25
|
"eslint": "^7.32.0",
|
|
37
|
-
"eslint-config-custom": "workspace:*",
|
|
38
26
|
"postcss": "^8.4.24",
|
|
39
27
|
"tailwindcss": "^3.3.2",
|
|
40
28
|
"tsc-alias": "^1.8.10",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
29
|
+
"typescript": "^4.5.2",
|
|
30
|
+
"app-studio-types": "0.0.3",
|
|
31
|
+
"tsconfig": "0.0.0",
|
|
32
|
+
"eslint-config-custom": "0.0.0"
|
|
43
33
|
},
|
|
44
34
|
"dependencies": {
|
|
45
35
|
"@radix-ui/react-accordion": "^1.1.2",
|
|
@@ -73,5 +63,15 @@
|
|
|
73
63
|
"tailwind-merge": "^1.13.2",
|
|
74
64
|
"tailwindcss-animate": "^1.0.6",
|
|
75
65
|
"vaul": "^0.9.1"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"lint": "eslint \"**/*.ts*\"",
|
|
69
|
+
"ui:add": "pnpm dlx shadcn-ui@latest add",
|
|
70
|
+
"build:styles": "postcss styles/globals.css -o dist/styles.css",
|
|
71
|
+
"build:ts": "tsc -p tsconfig.json && tsc-alias",
|
|
72
|
+
"build": "pnpm run build:ts && pnpm run build:styles",
|
|
73
|
+
"dev:ts": "tsc -w -p tsconfig.json",
|
|
74
|
+
"dev:styles": "npx tailwindcss -i styles/globals.css -o dist/styles.css --watch",
|
|
75
|
+
"dev": "concurrently \"pnpm run dev:ts\" \"pnpm run dev:styles\""
|
|
76
76
|
}
|
|
77
|
-
}
|
|
77
|
+
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ReviewData } from "app-studio-types";
|
|
2
|
-
type UseReviewsProps = {
|
|
3
|
-
baseURL: string;
|
|
4
|
-
productId: string;
|
|
5
|
-
provider: string;
|
|
6
|
-
fetcher?: (url: string) => Promise<any>;
|
|
7
|
-
dataType: "summary" | "metadata" | "search";
|
|
8
|
-
searchText: string;
|
|
9
|
-
ratings: [number];
|
|
10
|
-
topics: [string];
|
|
11
|
-
sortBy: "date" | "votes_up" | "votes_down" | "time" | "rating" | "reviewer_type";
|
|
12
|
-
ascending: boolean;
|
|
13
|
-
};
|
|
14
|
-
type UseReviewsReturn = {
|
|
15
|
-
reviews: ReviewData;
|
|
16
|
-
error: any;
|
|
17
|
-
isLoading: boolean;
|
|
18
|
-
};
|
|
19
|
-
export declare function useReviews(props: UseReviewsProps | null): UseReviewsReturn;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=use-reviews.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-reviews.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-reviews.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC;IACjF,SAAS,EAAE,OAAO,CAAC;CACpB,CAAA;AAQD,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,UAAU,CAAA;IACnB,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,gBAAgB,CAqD1E"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import useSWR from "swr";
|
|
2
|
-
export function useReviews(props) {
|
|
3
|
-
let url = null;
|
|
4
|
-
if (props) {
|
|
5
|
-
const { baseURL, productId, provider, dataType, searchText, ratings, topics, sortBy, ascending } = props; // Destructure all relevant props
|
|
6
|
-
let queryParams = new URLSearchParams();
|
|
7
|
-
if (productId.length > 0) {
|
|
8
|
-
queryParams.set("id", productId);
|
|
9
|
-
}
|
|
10
|
-
if (provider.length > 0) {
|
|
11
|
-
queryParams.set("provider", provider);
|
|
12
|
-
}
|
|
13
|
-
// Include dataType in the query parameters
|
|
14
|
-
queryParams.set("dataType", dataType);
|
|
15
|
-
// Add additional properties to query parameters
|
|
16
|
-
if (searchText) {
|
|
17
|
-
queryParams.set("searchText", searchText);
|
|
18
|
-
}
|
|
19
|
-
if (ratings && ratings.length > 0) {
|
|
20
|
-
queryParams.set("ratings", ratings.join(",")); // Convert array to a comma-separated string
|
|
21
|
-
}
|
|
22
|
-
if (topics && topics.length > 0) {
|
|
23
|
-
queryParams.set("topics", topics.join(",")); // Convert array to a comma-separated string
|
|
24
|
-
}
|
|
25
|
-
if (sortBy) {
|
|
26
|
-
queryParams.set("sortBy", sortBy);
|
|
27
|
-
}
|
|
28
|
-
if (ascending !== undefined) { // Check for undefined to allow false values
|
|
29
|
-
queryParams.set("ascending", ascending.toString());
|
|
30
|
-
}
|
|
31
|
-
if (dataType === null || productId === null || productId.length === 0) {
|
|
32
|
-
url = null;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
url = `${baseURL}/reviews/by-id?${queryParams.toString()}`;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const fetcher = (props === null || props === void 0 ? void 0 : props.fetcher) || ((url) => fetch(url).then((res) => res.json()));
|
|
39
|
-
const { data, error } = useSWR(url, fetcher);
|
|
40
|
-
return {
|
|
41
|
-
reviews: data || {},
|
|
42
|
-
error,
|
|
43
|
-
isLoading: !data && !error,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useDrag } from "@use-gesture/react";
|
|
2
|
-
interface UseTapOptions {
|
|
3
|
-
onTap?: () => void;
|
|
4
|
-
threshold?: number;
|
|
5
|
-
}
|
|
6
|
-
interface UseTapResult {
|
|
7
|
-
isDragging: boolean;
|
|
8
|
-
bind: ReturnType<typeof useDrag>;
|
|
9
|
-
active: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare function useTap({ onTap, threshold, }?: UseTapOptions): UseTapResult;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=use-tap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-tap.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-tap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C,UAAU,aAAa;IACrB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA;IAChC,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,SAAa,GACd,GAAE,aAAkB,GAAG,YAAY,CAsBnC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { useDrag } from "@use-gesture/react";
|
|
4
|
-
export function useTap({ onTap, threshold = 5, } = {}) {
|
|
5
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
6
|
-
const [active, setActive] = useState(false);
|
|
7
|
-
const bind = useDrag(({ tap, dragging, last, active }) => {
|
|
8
|
-
console.log({ tap, dragging, last, active });
|
|
9
|
-
if (tap) {
|
|
10
|
-
onTap === null || onTap === void 0 ? void 0 : onTap();
|
|
11
|
-
}
|
|
12
|
-
setIsDragging(dragging !== null && dragging !== void 0 ? dragging : false);
|
|
13
|
-
setActive(active !== null && active !== void 0 ? active : false);
|
|
14
|
-
}, {
|
|
15
|
-
delay: 0,
|
|
16
|
-
filterTaps: true,
|
|
17
|
-
threshold,
|
|
18
|
-
tapsThreshold: 1,
|
|
19
|
-
});
|
|
20
|
-
return { isDragging, bind, active };
|
|
21
|
-
}
|