@tapcart/mobile-components 0.6.13 → 0.6.14
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-collection.d.ts +3 -1
- package/dist/components/hooks/use-collection.d.ts.map +1 -1
- package/dist/components/hooks/use-collection.js +56 -43
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +4 -3
- package/dist/components/ui/scroll-area.js +1 -1
- package/dist/components/ui/subcollection-tabs.d.ts.map +1 -1
- package/dist/components/ui/subcollection-tabs.js +1 -1
- package/dist/components/ui/tabs.d.ts +1 -0
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js +10 -5
- package/dist/styles.css +9 -13
- package/package.json +3 -3
|
@@ -9,13 +9,15 @@ interface UseCollectionProps {
|
|
|
9
9
|
appId: string;
|
|
10
10
|
collectionId?: string;
|
|
11
11
|
collectionHandle?: string;
|
|
12
|
+
collectionIdList?: string[];
|
|
12
13
|
language: string;
|
|
13
14
|
getCollections?: boolean;
|
|
15
|
+
limit?: number;
|
|
14
16
|
}
|
|
15
17
|
interface Product {
|
|
16
18
|
handle: string;
|
|
17
19
|
}
|
|
18
|
-
export declare const useCollection: ({ apiUrl, appId, collectionId, collectionHandle, language, getCollections, }: UseCollectionProps) => {
|
|
20
|
+
export declare const useCollection: ({ apiUrl, appId, collectionId, collectionHandle, collectionIdList, language, limit, getCollections, }: UseCollectionProps) => {
|
|
19
21
|
collections: Collection[] | null;
|
|
20
22
|
specificCollection: Collection | null;
|
|
21
23
|
loading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-collection.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-collection.ts"],"names":[],"mappings":"AAGA,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"use-collection.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-collection.ts"],"names":[],"mappings":"AAGA,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,EAAE,CAAA;CACpB;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,UAAU,OAAO;IACf,MAAM,EAAE,MAAM,CAAA;CAEf;AA6ED,eAAO,MAAM,aAAa,0GASvB,kBAAkB;;;;;CA0DpB,CAAA"}
|
|
@@ -9,56 +9,60 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { useState, useEffect } from "react";
|
|
12
|
-
|
|
12
|
+
const notEmpty = (value) => {
|
|
13
|
+
return value !== null && value !== undefined;
|
|
14
|
+
};
|
|
15
|
+
const fetchWrapper = (url, errorCallback) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
const res = yield fetch(url, {
|
|
18
|
+
method: "GET",
|
|
19
|
+
headers: {
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return yield res.json();
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
console.error("Error fetching collection:", error);
|
|
27
|
+
errorCallback(error instanceof Error ? error.message : "An unknown error occurred.");
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const fetchCollection = (apiUrl, language, setError, collectionId = "", collectionHandle = "") => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
const collectionBy = collectionHandle ? "by-handle" : "by-id";
|
|
32
|
+
const params = new URLSearchParams({
|
|
33
|
+
collectionHandle: collectionHandle,
|
|
34
|
+
collectionId: collectionId,
|
|
35
|
+
language,
|
|
36
|
+
}).toString();
|
|
37
|
+
return yield fetchWrapper(`${apiUrl}/collections/${collectionBy}?${params}`, setError);
|
|
38
|
+
});
|
|
39
|
+
const fetchAllCollections = (apiUrl, setError, limit = 100) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const limitParam = new URLSearchParams({
|
|
41
|
+
limit: `${limit}`,
|
|
42
|
+
}).toString();
|
|
43
|
+
return yield fetchWrapper(`${apiUrl}/collections/by-app-id?${limitParam}`, setError);
|
|
44
|
+
});
|
|
45
|
+
export const useCollection = ({ apiUrl, appId, collectionId, collectionHandle, collectionIdList, language, limit = 100, getCollections = false, }) => {
|
|
13
46
|
const [collections, setCollections] = useState(null);
|
|
14
47
|
const [specificCollection, setSpecificCollection] = useState(null);
|
|
15
48
|
const [loading, setLoading] = useState(true);
|
|
16
49
|
const [error, setError] = useState(null);
|
|
17
50
|
useEffect(() => {
|
|
18
|
-
const
|
|
51
|
+
const fetchAllOrSumCollections = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
52
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// Fetch specific collection by ID or handle
|
|
24
|
-
const params = new URLSearchParams({
|
|
25
|
-
collectionHandle: collectionHandle || "",
|
|
26
|
-
collectionId: collectionId || "",
|
|
27
|
-
language,
|
|
28
|
-
}).toString();
|
|
29
|
-
const collectionBy = collectionHandle ? "by-handle" : "by-id";
|
|
30
|
-
specificCollectionUrl = `${apiUrl}/collections/${collectionBy}?${params}`;
|
|
53
|
+
if (getCollections) {
|
|
54
|
+
const collections = yield fetchAllCollections(apiUrl, setError, limit);
|
|
55
|
+
return setCollections(collections);
|
|
31
56
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"Content-Type": "application/json",
|
|
37
|
-
},
|
|
38
|
-
})
|
|
39
|
-
: null;
|
|
40
|
-
const fetchSpecificCollection = specificCollectionUrl
|
|
41
|
-
? fetch(specificCollectionUrl, {
|
|
42
|
-
method: "GET",
|
|
43
|
-
headers: {
|
|
44
|
-
"Content-Type": "application/json",
|
|
45
|
-
},
|
|
46
|
-
})
|
|
47
|
-
: null;
|
|
48
|
-
const [allCollectionsResponse, specificCollectionResponse] = yield Promise.all([
|
|
49
|
-
fetchAllCollections,
|
|
50
|
-
fetchSpecificCollection,
|
|
51
|
-
]);
|
|
52
|
-
if (fetchAllCollections && allCollectionsResponse && !allCollectionsResponse.ok) {
|
|
53
|
-
throw new Error(`Failed to fetch all collections: ${allCollectionsResponse.statusText}`);
|
|
57
|
+
if (collectionIdList === null || collectionIdList === void 0 ? void 0 : collectionIdList.length) {
|
|
58
|
+
const collections = yield Promise.all(collectionIdList.map((id) => fetchCollection(apiUrl, language, setError, id)));
|
|
59
|
+
const filteredCollections = collections.filter(notEmpty);
|
|
60
|
+
return setCollections(filteredCollections);
|
|
54
61
|
}
|
|
55
|
-
if (
|
|
56
|
-
|
|
62
|
+
if (collectionId || collectionHandle) {
|
|
63
|
+
const collection = yield fetchCollection(apiUrl, language, setError, collectionId, collectionHandle);
|
|
64
|
+
return setSpecificCollection(collection);
|
|
57
65
|
}
|
|
58
|
-
const allCollectionsData = fetchAllCollections && allCollectionsResponse ? yield allCollectionsResponse.json() : null;
|
|
59
|
-
const specificCollectionData = fetchSpecificCollection && specificCollectionResponse ? yield specificCollectionResponse.json() : null;
|
|
60
|
-
setCollections(allCollectionsData);
|
|
61
|
-
setSpecificCollection(specificCollectionData);
|
|
62
66
|
}
|
|
63
67
|
catch (error) {
|
|
64
68
|
console.error("Error fetching collection:", error);
|
|
@@ -68,7 +72,16 @@ export const useCollection = ({ apiUrl, appId, collectionId, collectionHandle, l
|
|
|
68
72
|
setLoading(false);
|
|
69
73
|
}
|
|
70
74
|
});
|
|
71
|
-
|
|
72
|
-
}, [
|
|
75
|
+
fetchAllOrSumCollections();
|
|
76
|
+
}, [
|
|
77
|
+
apiUrl,
|
|
78
|
+
appId,
|
|
79
|
+
collectionId,
|
|
80
|
+
collectionHandle,
|
|
81
|
+
language,
|
|
82
|
+
getCollections,
|
|
83
|
+
limit,
|
|
84
|
+
collectionIdList,
|
|
85
|
+
]);
|
|
73
86
|
return { collections, specificCollection, loading, error };
|
|
74
87
|
};
|
|
@@ -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,MAAM,
|
|
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,MAAM,uFA6FX,CAAA;AAGD,QAAA,MAAM,cAAc,iBACJ,SAAS,GACrB,oBAAoB,GAAG;IACrB,SAAS,EAAE,KAAK,CAAA;IAChB,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5B,gBAAgB,EAAE,OAAO,CAAA;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBJ,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -81,10 +81,11 @@ const labelVariants = cva("truncate", {
|
|
|
81
81
|
const Button = React.forwardRef((_a, ref) => {
|
|
82
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"]);
|
|
83
83
|
const Comp = asChild ? Slot : "button";
|
|
84
|
-
const IconButton = () => icon || iconUrl ? _jsx(Icon, { name: icon, size: "sm", style: { color: iconColor } }) : null;
|
|
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
|
-
"mr-2": iconPosition
|
|
87
|
-
|
|
86
|
+
"mr-2": iconPosition === "left",
|
|
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
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 } }) })));
|
|
89
90
|
return (_jsx(Comp, Object.assign({ className: cn(buttonVariants({ variant, size }), className, {
|
|
90
91
|
"pointer-events-none": loading,
|
|
@@ -16,7 +16,7 @@ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
|
16
16
|
import { cn } from "../../lib/utils";
|
|
17
17
|
const ScrollArea = React.forwardRef((_a, ref) => {
|
|
18
18
|
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
19
|
-
return (_jsxs(ScrollAreaPrimitive.Root, Object.assign({ ref: ref, className: cn("relative overflow-hidden", className) }, props, { children: [_jsx(ScrollAreaPrimitive.Viewport, Object.assign({ className: "h-full w-full rounded-[inherit]" }, { children: _jsx("div", Object.assign({ className: "flex w-max
|
|
19
|
+
return (_jsxs(ScrollAreaPrimitive.Root, Object.assign({ ref: ref, className: cn("relative overflow-hidden", className) }, props, { children: [_jsx(ScrollAreaPrimitive.Viewport, Object.assign({ className: "h-full w-full rounded-[inherit]" }, { children: _jsx("div", Object.assign({ className: "flex w-max" }, { children: children })) })), _jsx(ScrollBar, {}), _jsx(ScrollAreaPrimitive.Corner, {})] })));
|
|
20
20
|
});
|
|
21
21
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
22
22
|
const ScrollBar = React.forwardRef((_a, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subcollection-tabs.d.ts","sourceRoot":"","sources":["../../../components/ui/subcollection-tabs.tsx"],"names":[],"mappings":"AAOA,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,iBAAS,iBAAiB,CAAC,EACzB,cAAc,EACd,UAAU,GACX,EAAE;IACD,cAAc,EAAE,eAAe,EAAE,CAAA;IAEjC,UAAU,EAAE,GAAG,CAAA;CAChB,
|
|
1
|
+
{"version":3,"file":"subcollection-tabs.d.ts","sourceRoot":"","sources":["../../../components/ui/subcollection-tabs.tsx"],"names":[],"mappings":"AAOA,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,iBAAS,iBAAiB,CAAC,EACzB,cAAc,EACd,UAAU,GACX,EAAE;IACD,cAAc,EAAE,eAAe,EAAE,CAAA;IAEjC,UAAU,EAAE,GAAG,CAAA;CAChB,kDA6DA;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -44,6 +44,6 @@ function SubCollectionTabs({ subCollections, useActions, }) {
|
|
|
44
44
|
}, [subCollections, openCollection]);
|
|
45
45
|
if (!tabs)
|
|
46
46
|
return null;
|
|
47
|
-
return (_jsx(Tabs, { tabs: tabs, activeTab: activeTab, onTabChange: handleTabChange }));
|
|
47
|
+
return (_jsx(Tabs, { tabs: tabs, activeTab: activeTab, onTabChange: handleTabChange, links: true }));
|
|
48
48
|
}
|
|
49
49
|
export { SubCollectionTabs };
|
|
@@ -7,6 +7,7 @@ export interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
activeTab: number | null;
|
|
8
8
|
onTabChange: (_: number | null) => void;
|
|
9
9
|
active?: number;
|
|
10
|
+
links?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
13
|
export { Tabs };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../components/ui/tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACrE,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,EAAE,CAAA;IACpD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../components/ui/tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACrE,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,EAAE,CAAA;IACpD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AA4CD,QAAA,MAAM,IAAI,kFAmHT,CAAA;AAGD,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -21,19 +21,24 @@ const tabVariants = cva("flex items-center justify-center px-4 py-2 active:opaci
|
|
|
21
21
|
true: "[&>p]:text-textColors-primaryColor",
|
|
22
22
|
false: "[&>p]:text-textColors-secondaryColor",
|
|
23
23
|
},
|
|
24
|
+
isLink: {
|
|
25
|
+
true: "[&>p]:text-textColors-primaryColor",
|
|
26
|
+
false: "",
|
|
27
|
+
},
|
|
24
28
|
},
|
|
25
29
|
defaultVariants: {
|
|
26
30
|
isActive: false,
|
|
31
|
+
isLink: false,
|
|
27
32
|
},
|
|
28
33
|
});
|
|
29
|
-
const Tab = ({ label, isActive = false, onClick }) => {
|
|
34
|
+
const Tab = ({ label, isActive = false, onClick, isLink }) => {
|
|
30
35
|
return (_jsx("button", Object.assign({ className: cn(tabVariants({
|
|
31
36
|
isActive,
|
|
32
|
-
|
|
33
|
-
), onClick: onClick }, { children: _jsx(Text, Object.assign({ type: "body-primary" }, { children: label })) })));
|
|
37
|
+
isLink,
|
|
38
|
+
}), "whitespace-nowrap"), onClick: onClick }, { children: _jsx(Text, Object.assign({ type: "body-primary" }, { children: label })) })));
|
|
34
39
|
};
|
|
35
40
|
const Tabs = React.forwardRef((_a, ref) => {
|
|
36
|
-
var { className, tabs, activeTab, onTabChange } = _a, props = __rest(_a, ["className", "tabs", "activeTab", "onTabChange"]);
|
|
41
|
+
var { className, tabs, activeTab, onTabChange, links = false } = _a, props = __rest(_a, ["className", "tabs", "activeTab", "onTabChange", "links"]);
|
|
37
42
|
const [underlinePosition, setUnderlinePosition] = React.useState({
|
|
38
43
|
left: 0,
|
|
39
44
|
width: 0,
|
|
@@ -92,7 +97,7 @@ const Tabs = React.forwardRef((_a, ref) => {
|
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
}, [ref]);
|
|
95
|
-
return (_jsxs("div", Object.assign({ className: "relative no-scrollbar" }, props, { children: [_jsxs("div", Object.assign({ ref: containerRef, className: "relative flex overflow-x-auto no-scrollbar", onScroll: checkShowGradients }, { children: [tabs.map((tab, index) => (_jsx(Tab, { label: tab.label, isActive: activeTab === index, onClick: () => onTabChange(index) }, index))), activeTab !== null && (_jsx("div", { className: `absolute bottom-0 bg-coreColors-brandColorPrimary h-[2px] transition-all duration-300`, style: {
|
|
100
|
+
return (_jsxs("div", Object.assign({ className: "relative no-scrollbar" }, props, { children: [_jsxs("div", Object.assign({ ref: containerRef, className: "relative flex overflow-x-auto no-scrollbar", onScroll: checkShowGradients }, { children: [tabs.map((tab, index) => (_jsx(Tab, { label: tab.label, isActive: activeTab === index, onClick: () => onTabChange(index), isLink: links }, index))), activeTab !== null && !links && (_jsx("div", { className: `absolute bottom-0 bg-coreColors-brandColorPrimary h-[2px] transition-all duration-300`, style: {
|
|
96
101
|
left: underlinePosition.left,
|
|
97
102
|
width: underlinePosition.width,
|
|
98
103
|
} }))] })), showRightGradient && (_jsx("div", Object.assign({ className: "absolute right-0 bottom-0 w-16 h-10 pointer-events-none overflow-hidden" }, { children: _jsx("div", { className: "w-full h-full gradient-right" }) }))), showLeftGradient && (_jsx("div", Object.assign({ className: "absolute left-0 bottom-0 w-16 h-10 pointer-events-none overflow-hidden" }, { children: _jsx("div", { className: "w-full h-full gradient-left" }) })))] })));
|
package/dist/styles.css
CHANGED
|
@@ -1054,6 +1054,9 @@ video {
|
|
|
1054
1054
|
.w-8 {
|
|
1055
1055
|
width: 2rem;
|
|
1056
1056
|
}
|
|
1057
|
+
.w-\[138px\] {
|
|
1058
|
+
width: 138px;
|
|
1059
|
+
}
|
|
1057
1060
|
.w-\[140px\] {
|
|
1058
1061
|
width: 140px;
|
|
1059
1062
|
}
|
|
@@ -1086,6 +1089,9 @@ video {
|
|
|
1086
1089
|
.min-w-0 {
|
|
1087
1090
|
min-width: 0px;
|
|
1088
1091
|
}
|
|
1092
|
+
.min-w-\[138px\] {
|
|
1093
|
+
min-width: 138px;
|
|
1094
|
+
}
|
|
1089
1095
|
.min-w-\[148px\] {
|
|
1090
1096
|
min-width: 148px;
|
|
1091
1097
|
}
|
|
@@ -1544,10 +1550,6 @@ video {
|
|
|
1544
1550
|
.bg-coreColors-pageColor {
|
|
1545
1551
|
background-color: var(--coreColors-pageColor);
|
|
1546
1552
|
}
|
|
1547
|
-
.bg-gray-100 {
|
|
1548
|
-
--tw-bg-opacity: 1;
|
|
1549
|
-
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
|
1550
|
-
}
|
|
1551
1553
|
.bg-gray-300 {
|
|
1552
1554
|
--tw-bg-opacity: 1;
|
|
1553
1555
|
background-color: rgb(209 213 219 / var(--tw-bg-opacity));
|
|
@@ -1657,10 +1659,6 @@ video {
|
|
|
1657
1659
|
padding-left: 2rem;
|
|
1658
1660
|
padding-right: 2rem;
|
|
1659
1661
|
}
|
|
1660
|
-
.px-\[16px\] {
|
|
1661
|
-
padding-left: 16px;
|
|
1662
|
-
padding-right: 16px;
|
|
1663
|
-
}
|
|
1664
1662
|
.py-1 {
|
|
1665
1663
|
padding-top: 0.25rem;
|
|
1666
1664
|
padding-bottom: 0.25rem;
|
|
@@ -1707,6 +1705,9 @@ video {
|
|
|
1707
1705
|
.pl-8 {
|
|
1708
1706
|
padding-left: 2rem;
|
|
1709
1707
|
}
|
|
1708
|
+
.pr-0 {
|
|
1709
|
+
padding-right: 0px;
|
|
1710
|
+
}
|
|
1710
1711
|
.pr-1 {
|
|
1711
1712
|
padding-right: 0.25rem;
|
|
1712
1713
|
}
|
|
@@ -2025,11 +2026,6 @@ video {
|
|
|
2025
2026
|
--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
|
|
2026
2027
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2027
2028
|
}
|
|
2028
|
-
.shadow-none {
|
|
2029
|
-
--tw-shadow: 0 0 #0000;
|
|
2030
|
-
--tw-shadow-colored: 0 0 #0000;
|
|
2031
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2032
|
-
}
|
|
2033
2029
|
.shadow-primary {
|
|
2034
2030
|
--tw-shadow: calc(var(--buttonColors-primaryShadowEnabled) * 0px) calc(var(--buttonColors-primaryShadowEnabled) * 5px) calc(var(--buttonColors-primaryShadowEnabled) * 25px) calc(var(--buttonColors-primaryShadowEnabled)* 0px) rgb(0, 0, 0, 0.10);;
|
|
2035
2031
|
--tw-shadow-colored: calc(var(--buttonColors-primaryShadowEnabled) * 0px) calc(var(--buttonColors-primaryShadowEnabled) * 5px) calc(var(--buttonColors-primaryShadowEnabled) * 25px) calc(var(--buttonColors-primaryShadowEnabled)* 0px) rgb(0, 0, 0, 0.10);;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"tsc-alias": "^1.8.10",
|
|
29
29
|
"typescript": "^4.5.2",
|
|
30
30
|
"app-studio-types": "0.0.3",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"eslint-config-custom": "0.0.0",
|
|
32
|
+
"tsconfig": "0.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@radix-ui/react-accordion": "^1.1.2",
|