@tapcart/mobile-components 0.6.13 → 0.6.15
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/hooks/use-sort-filter.d.ts +3 -1
- package/dist/components/hooks/use-sort-filter.d.ts.map +1 -1
- package/dist/components/hooks/use-sort-filter.js +25 -5
- package/dist/components/libs/sort-filter/algolia-search.d.ts +4 -0
- package/dist/components/libs/sort-filter/algolia-search.d.ts.map +1 -0
- package/dist/components/libs/sort-filter/algolia-search.js +3 -0
- package/dist/components/libs/sort-filter/beyond-search.d.ts.map +1 -1
- package/dist/components/libs/sort-filter/fast-simon-search.d.ts +4 -0
- package/dist/components/libs/sort-filter/fast-simon-search.d.ts.map +1 -0
- package/dist/components/libs/sort-filter/fast-simon-search.js +3 -0
- package/dist/components/libs/sort-filter/nosto-search.d.ts.map +1 -1
- package/dist/components/libs/sort-filter/search-integration.d.ts.map +1 -1
- package/dist/components/libs/sort-filter/search-integration.js +11 -6
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +4 -3
- package/dist/components/ui/favorite.d.ts.map +1 -1
- package/dist/components/ui/favorite.js +1 -1
- package/dist/components/ui/grid.js +1 -1
- 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 +15 -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
|
};
|
|
@@ -3,6 +3,7 @@ import { FilterCategory, FiltersAndRelatedCategories, Integration, IntegrationSo
|
|
|
3
3
|
interface UseSortFilterProps {
|
|
4
4
|
initialData: PageData;
|
|
5
5
|
queryVariables: Record<string, any>;
|
|
6
|
+
dynamicKey?: (queryVariables: any) => () => any;
|
|
6
7
|
}
|
|
7
8
|
interface PageData {
|
|
8
9
|
filtersURL: string;
|
|
@@ -14,6 +15,7 @@ interface UseSortFilterReturn {
|
|
|
14
15
|
data: any[];
|
|
15
16
|
mutate: () => Promise<any>;
|
|
16
17
|
isLoading: boolean;
|
|
18
|
+
isFilterLoading: boolean;
|
|
17
19
|
}
|
|
18
20
|
interface SortFilterData {
|
|
19
21
|
collection: Collection;
|
|
@@ -22,6 +24,6 @@ interface SortFilterData {
|
|
|
22
24
|
dynamicFiltersEnabled: boolean;
|
|
23
25
|
integrations: Integration[];
|
|
24
26
|
}
|
|
25
|
-
declare const useSortFilter: ({ initialData, queryVariables, }: UseSortFilterProps) => UseSortFilterReturn;
|
|
27
|
+
declare const useSortFilter: ({ initialData, queryVariables, dynamicKey, }: UseSortFilterProps) => UseSortFilterReturn;
|
|
26
28
|
export { useSortFilter };
|
|
27
29
|
//# sourceMappingURL=use-sort-filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-sort-filter.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-sort-filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACpB,MAAM,wCAAwC,CAAA;
|
|
1
|
+
{"version":3,"file":"use-sort-filter.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-sort-filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACpB,MAAM,wCAAwC,CAAA;AAI/C,UAAU,kBAAkB;IAC1B,WAAW,EAAE,QAAQ,CAAA;IACrB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,UAAU,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,KAAK,MAAM,GAAG,CAAA;CAChD;AAED,UAAU,QAAQ;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,cAAc,EAAE,CAAA;CAChC;AAED,UAAU,mBAAmB;IAC3B,cAAc,EAAE,cAAc,CAAA;IAC9B,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,MAAM,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;IAC1B,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,OAAO,CAAA;CACzB;AAED,UAAU,cAAc;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,2BAA2B,EAAE,2BAA2B,CAAA;IACxD,WAAW,EAAE,mBAAmB,EAAE,CAAA;IAClC,qBAAqB,EAAE,OAAO,CAAA;IAC9B,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B;AAeD,QAAA,MAAM,aAAa,iDAIhB,kBAAkB,KAAG,mBAgDvB,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import useSWRInfinite from "swr/infinite";
|
|
3
3
|
import useSWR from "swr";
|
|
4
|
+
import { useCallback, useMemo } from "react";
|
|
4
5
|
const constructURL = (apiURL) => {
|
|
5
6
|
const url = new URL(apiURL);
|
|
6
7
|
return url.toString();
|
|
@@ -8,17 +9,35 @@ const constructURL = (apiURL) => {
|
|
|
8
9
|
const fetcher = ({ apiURL, body }) => fetch(constructURL(apiURL), {
|
|
9
10
|
method: "POST",
|
|
10
11
|
body: JSON.stringify(body),
|
|
11
|
-
})
|
|
12
|
-
|
|
12
|
+
})
|
|
13
|
+
.then((res) => res.json())
|
|
14
|
+
.catch((error) => console.error(error));
|
|
15
|
+
const useSortFilter = ({ initialData, queryVariables, dynamicKey, }) => {
|
|
13
16
|
const shouldFetch = queryVariables && Object.keys(queryVariables).length > 0;
|
|
14
|
-
const { data: sortFilterData, isLoading } = useSWR(shouldFetch
|
|
17
|
+
const { data: sortFilterData, isLoading } = useSWR(shouldFetch
|
|
18
|
+
? { apiUrl: initialData.sortFilterURL, body: Object.assign({}, queryVariables) }
|
|
19
|
+
: null, ({ apiUrl, body }) => fetcher({ apiURL: apiUrl, body }), { revalidateOnFocus: false });
|
|
15
20
|
const getKey = () => {
|
|
16
21
|
if (!sortFilterData || !sortFilterData.dynamicFiltersEnabled)
|
|
17
22
|
return null;
|
|
18
|
-
return Object.assign(Object.assign({}, sortFilterData.queryVariables), (initialData.uiFilterState && {
|
|
23
|
+
return Object.assign(Object.assign({}, sortFilterData.queryVariables), (initialData.uiFilterState && {
|
|
24
|
+
filterCategories: initialData.uiFilterState,
|
|
25
|
+
}));
|
|
19
26
|
};
|
|
20
|
-
const
|
|
27
|
+
const memoizedDynamicKey = useCallback(() => {
|
|
28
|
+
if (dynamicKey) {
|
|
29
|
+
return dynamicKey(sortFilterData.queryVariables);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}, [dynamicKey, sortFilterData === null || sortFilterData === void 0 ? void 0 : sortFilterData.queryVariables]);
|
|
35
|
+
const memoizedFetch = useMemo(() => {
|
|
36
|
+
return (body) => fetcher({ apiURL: initialData.filtersURL, body });
|
|
37
|
+
}, [initialData.filtersURL]);
|
|
38
|
+
const { data, mutate, isLoading: isFilterLoading, } = useSWRInfinite(dynamicKey ? memoizedDynamicKey : getKey, memoizedFetch, {
|
|
21
39
|
revalidateFirstPage: true,
|
|
40
|
+
revalidateOnFocus: false,
|
|
22
41
|
initialSize: 1,
|
|
23
42
|
});
|
|
24
43
|
return {
|
|
@@ -26,6 +45,7 @@ const useSortFilter = ({ initialData, queryVariables, }) => {
|
|
|
26
45
|
data: data !== null && data !== void 0 ? data : [],
|
|
27
46
|
mutate,
|
|
28
47
|
isLoading,
|
|
48
|
+
isFilterLoading,
|
|
29
49
|
};
|
|
30
50
|
};
|
|
31
51
|
export { useSortFilter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algolia-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/algolia-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B,qBAAa,aAAc,SAAQ,GAAG;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beyond-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/beyond-search.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"beyond-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/beyond-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,qBAAa,YAAa,YAAW,iBAAiB;IACpD,qBAAqB,QAAO,MAAM,CAEjC;IAED,qCAAqC,YAC1B,cAAc,EAAE,gBACX,uBAAuB,KACpC,MAAM,CAoDR;IAED,yBAAyB,CAAC,EACxB,UAAU,EACV,cAAc,GACf,EAAE;QACD,UAAU,EAAE,mBAAmB,GAAG,SAAS,CAAA;QAC3C,cAAc,EAAE,uBAAuB,CAAA;KACxC,GAAG,eAAe;IAcnB,6BAA6B,CAAC,EAC5B,YAAY,EACZ,WAAW,GACZ,EAAE;QACD,YAAY,EAAE,uBAAuB,CAAA;QACrC,WAAW,EAAE,mBAAmB,EAAE,CAAA;KACnC,GAAG,mBAAmB,GAAG,IAAI;CAI/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fast-simon-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/fast-simon-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B,qBAAa,eAAgB,SAAQ,GAAG;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nosto-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/nosto-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"nosto-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/nosto-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,qBAAa,WAAY,SAAQ,GAAG;IAClC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;gBAE3B,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,WAAW,GAAG,SAAS,CAAA;KAAE;CAItE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-integration.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/search-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"search-integration.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/search-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AASzD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,gBAAgB,EAAE,cAAc,EAAE,GAAG,SAAS,GAAG,IAAI,CAAA;IACrD,iBAAiB,EAAE,eAAe,EAAE,GAAG,SAAS,GAAG,IAAI,CAAA;CACxD,CAAA;AAED,MAAM,WAAW,iBAAiB;IAIhC,qBAAqB,IAAI,MAAM,CAAA;IAE/B,6BAA6B,CAAC,EAC5B,YAAY,EACZ,WAAW,GACZ,EAAE;QACD,YAAY,EAAE,uBAAuB,CAAA;QACrC,WAAW,EAAE,mBAAmB,EAAE,CAAA;KACnC,GAAG,mBAAmB,GAAG,IAAI,CAAA;IAK9B,yBAAyB,CAAC,EACxB,UAAU,EACV,cAAc,GACf,EAAE;QACD,UAAU,EAAE,mBAAmB,GAAG,SAAS,CAAA;QAC3C,cAAc,EAAE,uBAAuB,CAAA;KACxC,GAAG,eAAe,CAAA;IAKnB,qCAAqC,CACnC,OAAO,EAAE,cAAc,EAAE,EACzB,YAAY,EAAE,uBAAuB,GACpC,MAAM,CAAA;CACV;AAED,eAAO,MAAM,uBAAuB,iBAAkB,WAAW,EAAE,gCAKlE,CAAA;AAED,eAAO,MAAM,gBAAgB,sBACR,OAAO,MAAM,EAAE,WAAW,CAAC,0BACtB,MAAM,EAAE,KAC/B,OAEF,CAAA;AAGD,eAAO,MAAM,yBAAyB,iBACtB,WAAW,EAAE,KAC1B,iBA6BF,CAAA;AAED,eAAO,MAAM,yBAAyB,sBACjB,iBAAiB,GAAG,IAAI,YAKC,CAAA"}
|
|
@@ -3,6 +3,8 @@ import { BeyondSearch } from "./beyond-search";
|
|
|
3
3
|
import { SearchSpring } from "./search-spring";
|
|
4
4
|
import { NostoSearch } from "./nosto-search";
|
|
5
5
|
import { ShopifySearchAndDiscovery } from "./shopify-search-and-discovery";
|
|
6
|
+
import { AlgoliaSearch } from "./algolia-search";
|
|
7
|
+
import { FastSimonSearch } from "./fast-simon-search";
|
|
6
8
|
export const createIntegrationLookup = (integrations) => {
|
|
7
9
|
return integrations.reduce((lookup, integration) => {
|
|
8
10
|
lookup[integration.name] = integration;
|
|
@@ -25,14 +27,17 @@ export const searchIntegrationProvider = (integrations) => {
|
|
|
25
27
|
return new NostoSearch({
|
|
26
28
|
integration: integrationLookup["nosto-search"],
|
|
27
29
|
});
|
|
28
|
-
case isSearchProvider(integrationLookup, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]):
|
|
30
|
+
case isSearchProvider(integrationLookup, ["algolia"]):
|
|
31
|
+
return new AlgoliaSearch();
|
|
32
|
+
case isSearchProvider(integrationLookup, ["instant-search-plus"]):
|
|
33
|
+
return new FastSimonSearch();
|
|
34
|
+
case isSearchProvider(integrationLookup, ["searchanise"]):
|
|
33
35
|
return new KMP();
|
|
34
36
|
default:
|
|
35
37
|
return new ShopifySearchAndDiscovery();
|
|
36
38
|
}
|
|
37
39
|
};
|
|
38
|
-
export const isDynamicFiltersSupported = (searchIntegration) => searchIntegration instanceof ShopifySearchAndDiscovery
|
|
40
|
+
export const isDynamicFiltersSupported = (searchIntegration) => searchIntegration instanceof ShopifySearchAndDiscovery ||
|
|
41
|
+
searchIntegration instanceof BeyondSearch ||
|
|
42
|
+
searchIntegration instanceof NostoSearch ||
|
|
43
|
+
searchIntegration instanceof FastSimonSearch;
|
|
@@ -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,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../components/ui/favorite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAA2B,OAAO,EAAmB,MAAM,iBAAiB,CAAA;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,QAAA,MAAM,gBAAgB;;;;mFA0BrB,CAAA;AAED,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,gBAAgB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EACP,sBAAsB,GACtB,WAAW,GACX,UAAU,GACV,aAAa,GACb,cAAc,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAC,MAAM,CAAA;IACvB,WAAW,CAAC,EAAC,WAAW,CAAA;IACxB,gBAAgB,CAAC,EAAC,MAAM,CAAA;IACxB,aAAa,CAAC,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;CAChC;AAED,QAAA,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../components/ui/favorite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAA2B,OAAO,EAAmB,MAAM,iBAAiB,CAAA;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,QAAA,MAAM,gBAAgB;;;;mFA0BrB,CAAA;AAED,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,gBAAgB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EACP,sBAAsB,GACtB,WAAW,GACX,UAAU,GACV,aAAa,GACb,cAAc,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAC,MAAM,CAAA;IACvB,WAAW,CAAC,EAAC,WAAW,CAAA;IACxB,gBAAgB,CAAC,EAAC,MAAM,CAAA;IACxB,aAAa,CAAC,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;CAChC;AAED,QAAA,MAAM,QAAQ,yFAuDb,CAAA;AAGD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -44,7 +44,7 @@ const Favorite = React.forwardRef((_a, ref) => {
|
|
|
44
44
|
size,
|
|
45
45
|
showBackgroundShadow,
|
|
46
46
|
layoutType,
|
|
47
|
-
}), className), style: Object.assign(Object.assign({ borderRadius: `${cornerRadius}px`, backgroundColor: backgroundColor
|
|
47
|
+
}), className), style: Object.assign({}, (showBackground && Object.assign(Object.assign({ borderRadius: `${cornerRadius}px`, backgroundColor: backgroundColor, borderColor: borderColorStyle }, getBorderSidesStyle(borderSides)), getPaddingStyle(borderPadding)))) }, props, { children: _jsx(Icon, { url: iconUrl, color: selected ? "stateColors-favorites" : "stateColors-disabled", size: size === "small" ? "xs" : "sm", fillColor: selected ? favoriteFillColor : disabledFillColor }) })));
|
|
48
48
|
});
|
|
49
49
|
Favorite.displayName = "Favorite";
|
|
50
50
|
export { Favorite, favoriteVariants };
|
|
@@ -28,6 +28,6 @@ const gridVariants = cva("grid", {
|
|
|
28
28
|
});
|
|
29
29
|
function Grid(_a) {
|
|
30
30
|
var { className, columns } = _a, props = __rest(_a, ["className", "columns"]);
|
|
31
|
-
return (_jsx(Container, { children: _jsx("div", Object.assign({ className: cn(gridVariants({ columns }), className) }, props)) }));
|
|
31
|
+
return (_jsx(Container, Object.assign({ style: { padding: '0' } }, { children: _jsx("div", Object.assign({ className: cn(gridVariants({ columns }), className) }, props)) })));
|
|
32
32
|
}
|
|
33
33
|
export { Grid, gridVariants };
|
|
@@ -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
|
@@ -982,6 +982,9 @@ video {
|
|
|
982
982
|
.h-\[2px\] {
|
|
983
983
|
height: 2px;
|
|
984
984
|
}
|
|
985
|
+
.h-\[36\] {
|
|
986
|
+
height: 36;
|
|
987
|
+
}
|
|
985
988
|
.h-\[42px\] {
|
|
986
989
|
height: 42px;
|
|
987
990
|
}
|
|
@@ -1054,9 +1057,15 @@ video {
|
|
|
1054
1057
|
.w-8 {
|
|
1055
1058
|
width: 2rem;
|
|
1056
1059
|
}
|
|
1060
|
+
.w-\[138px\] {
|
|
1061
|
+
width: 138px;
|
|
1062
|
+
}
|
|
1057
1063
|
.w-\[140px\] {
|
|
1058
1064
|
width: 140px;
|
|
1059
1065
|
}
|
|
1066
|
+
.w-\[154px\] {
|
|
1067
|
+
width: 154px;
|
|
1068
|
+
}
|
|
1060
1069
|
.w-\[1px\] {
|
|
1061
1070
|
width: 1px;
|
|
1062
1071
|
}
|
|
@@ -1086,6 +1095,9 @@ video {
|
|
|
1086
1095
|
.min-w-0 {
|
|
1087
1096
|
min-width: 0px;
|
|
1088
1097
|
}
|
|
1098
|
+
.min-w-\[138px\] {
|
|
1099
|
+
min-width: 138px;
|
|
1100
|
+
}
|
|
1089
1101
|
.min-w-\[148px\] {
|
|
1090
1102
|
min-width: 148px;
|
|
1091
1103
|
}
|
|
@@ -1544,10 +1556,6 @@ video {
|
|
|
1544
1556
|
.bg-coreColors-pageColor {
|
|
1545
1557
|
background-color: var(--coreColors-pageColor);
|
|
1546
1558
|
}
|
|
1547
|
-
.bg-gray-100 {
|
|
1548
|
-
--tw-bg-opacity: 1;
|
|
1549
|
-
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
|
1550
|
-
}
|
|
1551
1559
|
.bg-gray-300 {
|
|
1552
1560
|
--tw-bg-opacity: 1;
|
|
1553
1561
|
background-color: rgb(209 213 219 / var(--tw-bg-opacity));
|
|
@@ -1657,10 +1665,6 @@ video {
|
|
|
1657
1665
|
padding-left: 2rem;
|
|
1658
1666
|
padding-right: 2rem;
|
|
1659
1667
|
}
|
|
1660
|
-
.px-\[16px\] {
|
|
1661
|
-
padding-left: 16px;
|
|
1662
|
-
padding-right: 16px;
|
|
1663
|
-
}
|
|
1664
1668
|
.py-1 {
|
|
1665
1669
|
padding-top: 0.25rem;
|
|
1666
1670
|
padding-bottom: 0.25rem;
|
|
@@ -1707,6 +1711,9 @@ video {
|
|
|
1707
1711
|
.pl-8 {
|
|
1708
1712
|
padding-left: 2rem;
|
|
1709
1713
|
}
|
|
1714
|
+
.pr-0 {
|
|
1715
|
+
padding-right: 0px;
|
|
1716
|
+
}
|
|
1710
1717
|
.pr-1 {
|
|
1711
1718
|
padding-right: 0.25rem;
|
|
1712
1719
|
}
|
|
@@ -2025,11 +2032,6 @@ video {
|
|
|
2025
2032
|
--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
|
|
2026
2033
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2027
2034
|
}
|
|
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
2035
|
.shadow-primary {
|
|
2034
2036
|
--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
2037
|
--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.15",
|
|
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",
|