@tapcart/mobile-components 0.7.40 → 0.7.42
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-debug-dependencies.d.ts +10 -0
- package/dist/components/hooks/use-debug-dependencies.d.ts.map +1 -0
- package/dist/components/hooks/use-debug-dependencies.js +18 -0
- package/dist/components/hooks/use-layout.d.ts +13 -0
- package/dist/components/hooks/use-layout.d.ts.map +1 -0
- package/dist/components/hooks/use-layout.js +23 -0
- package/dist/components/hooks/use-nosto-recommendation.queries.d.ts.map +1 -1
- package/dist/components/hooks/use-product-options.d.ts.map +1 -1
- package/dist/components/hooks/use-recommendations.d.ts +1 -1
- package/dist/components/hooks/use-recommendations.d.ts.map +1 -1
- package/dist/components/hooks/use-recommendations.js +4 -4
- package/dist/components/hooks/use-reviews.d.ts.map +1 -1
- package/dist/components/hooks/use-reviews.js +45 -42
- package/dist/components/libs/sort-filter/custom-search.d.ts.map +1 -1
- package/dist/components/libs/sort-filter/custom-search.js +1 -1
- package/dist/components/libs/sort-filter/kmp.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 +2 -1
- package/dist/components/libs/sort-filter/shopify-search-and-discovery.d.ts.map +1 -1
- package/dist/components/ui/Input/index.d.ts +1 -1
- package/dist/components/ui/Input/index.d.ts.map +1 -1
- package/dist/components/ui/Input/index.js +1 -1
- package/dist/components/ui/Input/input.d.ts.map +1 -1
- package/dist/components/ui/Input/input.js +15 -5
- package/dist/components/ui/Input/types.d.ts +3 -1
- package/dist/components/ui/Input/types.d.ts.map +1 -1
- package/dist/components/ui/Input/useInput.d.ts +11 -1
- package/dist/components/ui/Input/useInput.d.ts.map +1 -1
- package/dist/components/ui/Input/useInput.js +6 -2
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +3 -1
- package/dist/components/ui/button.d.ts +0 -12
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/chip.d.ts +1 -0
- package/dist/components/ui/chip.d.ts.map +1 -1
- package/dist/components/ui/chip.js +2 -2
- package/dist/components/ui/drawer.js +2 -1
- package/dist/components/ui/grid.js +1 -1
- package/dist/components/ui/image.d.ts.map +1 -1
- package/dist/components/ui/image.js +3 -1
- package/dist/components/ui/line-item-text-icons.d.ts.map +1 -1
- package/dist/components/ui/money.d.ts.map +1 -1
- package/dist/components/ui/money.js +2 -2
- package/dist/components/ui/price.d.ts +2 -2
- package/dist/components/ui/price.d.ts.map +1 -1
- package/dist/components/ui/price.js +6 -4
- package/dist/components/ui/product-card.d.ts.map +1 -1
- package/dist/components/ui/product-card.js +9 -5
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/star-rating.d.ts.map +1 -1
- package/dist/components/ui/star-rating.js +1 -1
- package/dist/components/ui/switch.d.ts +3 -1
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/switch.js +2 -2
- package/dist/components/ui/tabs.d.ts +3 -0
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js +4 -7
- package/dist/components/ui/toaster.d.ts.map +1 -1
- package/dist/components/ui/toaster.js +1 -1
- package/dist/components/ui/use-toast.d.ts +1 -0
- package/dist/components/ui/use-toast.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/utils.d.ts +23 -15
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +51 -14
- package/dist/styles.css +25 -3
- package/package.json +3 -2
- package/dist/components/hooks/use-customer.d.ts +0 -10
- package/dist/components/hooks/use-customer.d.ts.map +0 -1
- package/dist/components/hooks/use-customer.js +0 -24
- package/dist/components/hooks/use-tap.d.ts +0 -8
- package/dist/components/hooks/use-tap.d.ts.map +0 -1
- package/dist/components/hooks/use-tap.js +0 -100
- package/dist/components/ui/apple-pay-button.d.ts +0 -24
- package/dist/components/ui/apple-pay-button.d.ts.map +0 -1
- package/dist/components/ui/apple-pay-button.js +0 -122
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to debug dependency changes.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* useDebugDependencies([dependencyA, dependencyB]);
|
|
6
|
+
*
|
|
7
|
+
* @param {Array} deps - Array of dependencies to monitor for changes.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useDebugDependencies(deps: any[]): void;
|
|
10
|
+
//# sourceMappingURL=use-debug-dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-debug-dependencies.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-debug-dependencies.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,EAAE,QAU/C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useEffect } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook to debug dependency changes.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* useDebugDependencies([dependencyA, dependencyB]);
|
|
8
|
+
*
|
|
9
|
+
* @param {Array} deps - Array of dependencies to monitor for changes.
|
|
10
|
+
*/
|
|
11
|
+
export function useDebugDependencies(deps) {
|
|
12
|
+
const prevDeps = useRef(deps);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const changedDeps = deps.map((dep, i) => dep !== prevDeps.current[i] ? dep : null);
|
|
15
|
+
console.log("Changed dependencies:", changedDeps);
|
|
16
|
+
prevDeps.current = deps;
|
|
17
|
+
}, [deps]);
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PhoenixLayout } from "lib/tapcart/types";
|
|
2
|
+
type UseLayoutProps = {
|
|
3
|
+
appId: string;
|
|
4
|
+
layoutId: string;
|
|
5
|
+
};
|
|
6
|
+
type UseLayoutReturn = {
|
|
7
|
+
layout: PhoenixLayout | null;
|
|
8
|
+
error: any;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function useLayout({ appId, layoutId, }: UseLayoutProps): UseLayoutReturn;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=use-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-layout.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-layout.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGjD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,aAAa,GAAG,IAAI,CAAA;IAC5B,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,GACT,EAAE,cAAc,GAAG,eAAe,CAYlC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import useSWR from "swr";
|
|
12
|
+
import { fetchLayoutById } from "apps/tapcart-ssr-app/lib/tapcart/index";
|
|
13
|
+
export function useLayout({ appId, layoutId, }) {
|
|
14
|
+
const fetcher = (appId, layoutId) => __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
return fetchLayoutById(appId, layoutId);
|
|
16
|
+
});
|
|
17
|
+
const { data, error } = useSWR([appId, layoutId], fetcher);
|
|
18
|
+
return {
|
|
19
|
+
layout: data || null,
|
|
20
|
+
error,
|
|
21
|
+
isLoading: !data && !error,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nosto-recommendation.queries.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-nosto-recommendation.queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAErE,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,IAAI;IACzC,IAAI,CAAC,EAAE;QACL,aAAa,CAAC,EAAE;YACd,KAAK,CAAC,EAAE;iBACL,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;oBACd,OAAO,EAAE,KAAK,CAAC;wBAAE,SAAS,EAAE,MAAM,CAAA;qBAAE,CAAC,CAAA;iBACtC,CAAC;aACH,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAA;AACtE,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;AAC1E,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAE5E,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE;YACN,OAAO,CAAC,EAAE;gBACR,OAAO,EAAE,KAAK,CAAC;oBAAE,IAAI,EAAE,MAAM,CAAC;oBAAC,SAAS,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAA;aACpD,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA;AACD,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE;YACN,OAAO,CAAC,EAAE;gBACR,OAAO,EAAE,KAAK,CAAC;oBAAE,SAAS,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAA;aACtC,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA;
|
|
1
|
+
{"version":3,"file":"use-nosto-recommendation.queries.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-nosto-recommendation.queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAErE,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,IAAI;IACzC,IAAI,CAAC,EAAE;QACL,aAAa,CAAC,EAAE;YACd,KAAK,CAAC,EAAE;iBACL,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;oBACd,OAAO,EAAE,KAAK,CAAC;wBAAE,SAAS,EAAE,MAAM,CAAA;qBAAE,CAAC,CAAA;iBACtC,CAAC;aACH,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAA;AACtE,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;AAC1E,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAE5E,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE;YACN,OAAO,CAAC,EAAE;gBACR,OAAO,EAAE,KAAK,CAAC;oBAAE,IAAI,EAAE,MAAM,CAAC;oBAAC,SAAS,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAA;aACpD,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA;AACD,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE;YACN,OAAO,CAAC,EAAE;gBACR,OAAO,EAAE,KAAK,CAAC;oBAAE,SAAS,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAA;aACtC,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA;AAED,eAAO,MAAM,gCAAgC,cAChC,MAAM,WACR,MAAM,WAkCb,CAAA;AAEJ,eAAO,MAAM,kCAAkC,cAClC,MAAM,aACN,MAAM,WACR,MAAM,WAsCb,CAAA;AAEJ,eAAO,MAAM,gCAAgC,cAChC,MAAM,yBACM,MAAM,WAsC3B,CAAA;AAEJ,eAAO,MAAM,+BAA+B,QAe1C,CAAA;AAEF,eAAO,MAAM,sCAAsC,wBAC5B,wBAAwB,cACjC,MAAM,EAAE,WAsBlB,CAAA;AAEJ,eAAO,MAAM,eAAe,QAE1B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-product-options.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-product-options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE7C,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,cAAc,EAAE,GAAG,SAAS,GAAG,IAAI,EAC7C,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI;;+
|
|
1
|
+
{"version":3,"file":"use-product-options.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-product-options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE7C,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,cAAc,EAAE,GAAG,SAAS,GAAG,IAAI,EAC7C,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI;;+BA6DC,MAAM,eAAe,MAAM,KAAG,IAAI;;EAwBrE"}
|
|
@@ -10,6 +10,6 @@ interface UseRecommendationReturn {
|
|
|
10
10
|
isLoading: boolean;
|
|
11
11
|
error: any;
|
|
12
12
|
}
|
|
13
|
-
declare const useRecommendations: ({ queryVariables, apiURL }: UseRecommendationProps) => UseRecommendationReturn;
|
|
13
|
+
declare const useRecommendations: ({ queryVariables, apiURL, }: UseRecommendationProps) => UseRecommendationReturn;
|
|
14
14
|
export { useRecommendations };
|
|
15
15
|
//# sourceMappingURL=use-recommendations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-recommendations.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-recommendations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAKtD,UAAU,sBAAsB;IAC9B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,GAAG,CAAA;CACX;AAOD,QAAA,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"use-recommendations.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-recommendations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAKtD,UAAU,sBAAsB;IAC9B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,GAAG,CAAA;CACX;AAOD,QAAA,MAAM,kBAAkB,gCAGrB,sBAAsB,KAAG,uBAmC3B,CAAA;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -5,10 +5,10 @@ const constructURL = (apiURL) => {
|
|
|
5
5
|
const url = new URL(apiURL);
|
|
6
6
|
return url.toString();
|
|
7
7
|
};
|
|
8
|
-
const useRecommendations = ({ queryVariables, apiURL }) => {
|
|
8
|
+
const useRecommendations = ({ queryVariables, apiURL, }) => {
|
|
9
9
|
var _a;
|
|
10
10
|
const searchParams = useSearchParams();
|
|
11
|
-
const recommendation = (searchParams === null || searchParams === void 0 ? void 0 : searchParams.get(
|
|
11
|
+
const recommendation = (searchParams === null || searchParams === void 0 ? void 0 : searchParams.get("recommendation")) || "";
|
|
12
12
|
const fetcher = (body) => fetch(constructURL(apiURL), {
|
|
13
13
|
method: "POST",
|
|
14
14
|
body: JSON.stringify(body),
|
|
@@ -21,13 +21,13 @@ const useRecommendations = ({ queryVariables, apiURL }) => {
|
|
|
21
21
|
revalidateOnFocus: false,
|
|
22
22
|
revalidateOnReconnect: false,
|
|
23
23
|
});
|
|
24
|
-
const collections = (_a = data === null || data === void 0 ? void 0 : data.collections) === null || _a === void 0 ? void 0 : _a.filter((obj) => obj.handle !==
|
|
24
|
+
const collections = (_a = data === null || data === void 0 ? void 0 : data.collections) === null || _a === void 0 ? void 0 : _a.filter((obj) => obj.handle !== "empty-collection");
|
|
25
25
|
return {
|
|
26
26
|
products: data === null || data === void 0 ? void 0 : data.products,
|
|
27
27
|
collections: recommendation === "*" ? [] : collections,
|
|
28
28
|
searches: data === null || data === void 0 ? void 0 : data.searches,
|
|
29
29
|
isLoading: isLoading,
|
|
30
|
-
error: error
|
|
30
|
+
error: error,
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
export { useRecommendations };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-reviews.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-reviews.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-reviews.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-reviews.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AAGzB,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACvC,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAA;IAC3C,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,CAAC,MAAM,CAAC,CAAA;IACjB,MAAM,EAAE,CAAC,MAAM,CAAC,CAAA;IAChB,MAAM,EACF,MAAM,GACN,UAAU,GACV,YAAY,GACZ,MAAM,GACN,QAAQ,GACR,eAAe,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,iBAAiB,GAAG,cAAc,GAAG,gBAAgB,GAAG,IAAI,CAAA;IAClE,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,CAAC,EAAE,GAAG,CAAA;IACrB,oBAAoB,CAAC,EAAE,GAAG,CAAA;CAC3B,CAAA;AAmDD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,gBAAgB,CAwE1E;AAED,KAAK,wBAAwB,GAAG,gBAAgB,GAAG;IACjD,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAA;CACrC,CAAA;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,eAAe,GAAG,IAAI,GAC5B,wBAAwB,CAmK1B"}
|
|
@@ -2,44 +2,44 @@
|
|
|
2
2
|
import { useCallback, useEffect, useRef } from "react";
|
|
3
3
|
import useSWR from "swr";
|
|
4
4
|
import useSWRInfinite from "swr/infinite";
|
|
5
|
-
import { useInView } from
|
|
5
|
+
import { useInView } from "react-intersection-observer";
|
|
6
6
|
const reviewsMockData = [
|
|
7
7
|
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
8
|
+
id: "dabbba8a-1188-4423-8aa2-1789dca7d67c",
|
|
9
|
+
score: 4,
|
|
10
|
+
title: "Headline",
|
|
11
|
+
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...",
|
|
12
|
+
date: "2024-10-10T00:00:00.000Z",
|
|
13
|
+
verified: false,
|
|
14
|
+
user: {
|
|
15
|
+
userId: null,
|
|
16
|
+
displayName: "Name",
|
|
17
|
+
},
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
20
|
+
id: "aab7ea91-1b88-43e8-93a9-111f833c756c",
|
|
21
|
+
score: 3,
|
|
22
|
+
title: "Headline",
|
|
23
|
+
content: "",
|
|
24
|
+
date: "2024-08-10T00:00:00.000Z",
|
|
25
|
+
verified: false,
|
|
26
|
+
user: {
|
|
27
|
+
userId: null,
|
|
28
|
+
displayName: "Name",
|
|
29
|
+
},
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
32
|
+
id: "4c3ab875-5598-498f-ae3b-72bf00f4fe04",
|
|
33
|
+
score: 4,
|
|
34
|
+
title: "Headline",
|
|
35
|
+
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...",
|
|
36
|
+
date: "2024-08-08T00:00:00.000Z",
|
|
37
|
+
verified: false,
|
|
38
|
+
user: {
|
|
39
|
+
userId: null,
|
|
40
|
+
displayName: "Name",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
43
|
];
|
|
44
44
|
const mockStarDistribution = {
|
|
45
45
|
1: 0,
|
|
@@ -51,7 +51,7 @@ const mockStarDistribution = {
|
|
|
51
51
|
export function useReviews(props) {
|
|
52
52
|
let url = null;
|
|
53
53
|
if (props) {
|
|
54
|
-
const { baseURL, productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage, page, limit } = props;
|
|
54
|
+
const { baseURL, productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage, page, limit, } = props;
|
|
55
55
|
let queryParams = new URLSearchParams();
|
|
56
56
|
if (productId.length > 0) {
|
|
57
57
|
queryParams.set("id", productId);
|
|
@@ -108,7 +108,7 @@ export function useReviewsInfinite(props) {
|
|
|
108
108
|
let baseURL = "";
|
|
109
109
|
let queryParams = new URLSearchParams();
|
|
110
110
|
if (props) {
|
|
111
|
-
const { productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage, limit } = props;
|
|
111
|
+
const { productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage, limit, } = props;
|
|
112
112
|
baseURL = props.baseURL;
|
|
113
113
|
if (productId.length > 0) {
|
|
114
114
|
queryParams.set("id", productId);
|
|
@@ -148,14 +148,16 @@ export function useReviewsInfinite(props) {
|
|
|
148
148
|
const isEndReached = useRef(false);
|
|
149
149
|
const getKey = (pageIndex, previousPageData) => {
|
|
150
150
|
var _a, _b, _c;
|
|
151
|
-
const dataType = queryParams.get("dataType") === "null"
|
|
151
|
+
const dataType = queryParams.get("dataType") === "null"
|
|
152
|
+
? null
|
|
153
|
+
: queryParams.get("dataType");
|
|
152
154
|
if (dataType == null) {
|
|
153
155
|
return null;
|
|
154
156
|
}
|
|
155
157
|
if ((props === null || props === void 0 ? void 0 : props.provider) === "yotpo") {
|
|
156
158
|
if (previousPageData && previousPageData.pagination) {
|
|
157
159
|
const { perPage, total } = previousPageData.pagination;
|
|
158
|
-
isEndReached.current = (
|
|
160
|
+
isEndReached.current = (pageIndex + 1) * perPage >= total;
|
|
159
161
|
}
|
|
160
162
|
return `${baseURL}/reviews/by-id?${queryParams.toString()}&page=${pageIndex + 1}`;
|
|
161
163
|
}
|
|
@@ -172,7 +174,7 @@ export function useReviewsInfinite(props) {
|
|
|
172
174
|
if (pageIndex === 0)
|
|
173
175
|
return `${baseURL}/reviews/by-id?${queryParams.toString()}`;
|
|
174
176
|
const totalPages = (_c = previousPageData === null || previousPageData === void 0 ? void 0 : previousPageData.pagination) === null || _c === void 0 ? void 0 : _c.totalPages;
|
|
175
|
-
if (totalPages &&
|
|
177
|
+
if (totalPages && pageIndex + 1 >= totalPages) {
|
|
176
178
|
isEndReached.current = true;
|
|
177
179
|
return null;
|
|
178
180
|
}
|
|
@@ -183,15 +185,16 @@ export function useReviewsInfinite(props) {
|
|
|
183
185
|
const { data: dataInfinite, error: errorInfinite, size, setSize, isLoading, isValidating, } = useSWRInfinite(getKey, fetcher);
|
|
184
186
|
let mergedReviews = dataInfinite
|
|
185
187
|
? dataInfinite
|
|
186
|
-
.filter(page => page && page.reviews)
|
|
187
|
-
.flatMap(page =>
|
|
188
|
+
.filter((page) => page && page.reviews)
|
|
189
|
+
.flatMap((page) => page.reviews)
|
|
188
190
|
: [];
|
|
189
191
|
let searchResponse = {
|
|
190
192
|
pagination: (dataInfinite === null || dataInfinite === void 0 ? void 0 : dataInfinite.length) ? dataInfinite[0].pagination : null,
|
|
191
|
-
reviews: mergedReviews
|
|
193
|
+
reviews: mergedReviews,
|
|
192
194
|
};
|
|
193
195
|
if ((props === null || props === void 0 ? void 0 : props.provider) === "yotpo") {
|
|
194
|
-
isEndReached.current =
|
|
196
|
+
isEndReached.current =
|
|
197
|
+
(mergedReviews === null || mergedReviews === void 0 ? void 0 : mergedReviews.length) === ((_a = searchResponse.pagination) === null || _a === void 0 ? void 0 : _a.total);
|
|
195
198
|
}
|
|
196
199
|
const loadMore = useCallback(() => {
|
|
197
200
|
if (!isLoading && !isValidating && !isEndReached.current) {
|
|
@@ -210,6 +213,6 @@ export function useReviewsInfinite(props) {
|
|
|
210
213
|
data: searchResponse || {},
|
|
211
214
|
error: errorInfinite,
|
|
212
215
|
isLoading: isValidating,
|
|
213
|
-
ref
|
|
216
|
+
ref,
|
|
214
217
|
};
|
|
215
218
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/custom-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAEL,cAAc,EACf,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,qBAAa,YAAa,SAAQ,GAAG;IACnC,OAAO,CAAC,WAAW,CAAa;gBAEpB,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"custom-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/custom-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAEL,cAAc,EACf,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,qBAAa,YAAa,SAAQ,GAAG;IACnC,OAAO,CAAC,WAAW,CAAa;gBAEpB,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;IAKzD,qCAAqC,YAC1B,cAAc,EAAE,gBACX,uBAAuB,KACpC,MAAM,CA2BR;IAED,wBAAwB,YAEvB;CACF"}
|
|
@@ -27,7 +27,7 @@ export class CustomSearch extends KMP {
|
|
|
27
27
|
return newParams.toString();
|
|
28
28
|
};
|
|
29
29
|
this.isDynamicFilterSupported = () => {
|
|
30
|
-
return this.integration[
|
|
30
|
+
return this.integration["isDynamicFilterSupported"] || false;
|
|
31
31
|
};
|
|
32
32
|
this.integration = integration;
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kmp.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/kmp.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"kmp.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/kmp.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,qBAAa,GAAI,YAAW,iBAAiB;IAC3C,qBAAqB,QAAO,MAAM,CAEjC;IAED,qCAAqC,YAC1B,cAAc,EAAE,gBACX,uBAAuB,KACpC,MAAM,CA4BR;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;CAS/B"}
|
|
@@ -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;AAUzD,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;IACvD,QAAQ,CAAC,EAAE,GAAG,CAAA;CACf,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;AAED,eAAO,MAAM,yBAAyB,iBACtB,WAAW,EAAE,KAC1B,iBAiCF,CAAA;AAED,eAAO,MAAM,yBAAyB,sBACjB,iBAAiB,GAAG,IAAI,
|
|
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;AAUzD,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;IACvD,QAAQ,CAAC,EAAE,GAAG,CAAA;CACf,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;AAED,eAAO,MAAM,yBAAyB,iBACtB,WAAW,EAAE,KAC1B,iBAiCF,CAAA;AAED,eAAO,MAAM,yBAAyB,sBACjB,iBAAiB,GAAG,IAAI,QAOsB,CAAA"}
|
|
@@ -45,4 +45,5 @@ export const isDynamicFiltersSupported = (searchIntegration) => searchIntegratio
|
|
|
45
45
|
searchIntegration instanceof BeyondSearch ||
|
|
46
46
|
searchIntegration instanceof NostoSearch ||
|
|
47
47
|
searchIntegration instanceof FastSimonSearch ||
|
|
48
|
-
(searchIntegration instanceof CustomSearch &&
|
|
48
|
+
(searchIntegration instanceof CustomSearch &&
|
|
49
|
+
searchIntegration.isDynamicFilterSupported());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify-search-and-discovery.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/shopify-search-and-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,qBAAa,yBAA0B,YAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"shopify-search-and-discovery.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/shopify-search-and-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,qBAAa,yBAA0B,YAAW,iBAAiB;IACjE,OAAO,CAAC,qBAAqB,CA+BH;IAE1B,qBAAqB,QAAO,MAAM,CAEjC;IACD,qCAAqC,YAC1B,cAAc,EAAE,gBACX,uBAAuB,KACpC,MAAM,CAmDR;IAED,yBAAyB,CAAC,EACxB,UAAU,EACV,cAAc,GACf,EAAE;QACD,UAAU,EAAE,mBAAmB,GAAG,SAAS,CAAA;QAC3C,cAAc,EAAE,uBAAuB,CAAA;KACxC,GAAG,eAAe;IAiBnB,6BAA6B,CAAC,EAC5B,YAAY,EACZ,WAAW,GACZ,EAAE;QACD,YAAY,EAAE,uBAAuB,CAAA;QACrC,WAAW,EAAE,mBAAmB,EAAE,CAAA;KACnC,GAAG,mBAAmB,GAAG,IAAI;CAO/B;AAED,oBAAY,cAAc;IACxB;;OAEG;IACH,KAAK,UAAU;IAIf,SAAS,cAAc;CACxB;AAED,oBAAY,6BAA6B;IAIvC,IAAI,SAAS;IAKb,IAAI,SAAS;CACd;AAED,oBAAY,yBAAyB;IACnC;;OAEG;IACH,KAAK,UAAU;IAEf;;OAEG;IACH,KAAK,UAAU;IAEf;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,kBAAkB,uBAAuB;IAEzC;;;;;OAKG;IACH,SAAS,cAAc;CACxB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./input";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./input";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAMxD,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAMxD,QAAA,MAAM,KAAK,qFAqLV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -16,14 +16,15 @@ import { cn } from "../../../lib/utils";
|
|
|
16
16
|
import { Icon } from "../icon";
|
|
17
17
|
import { getTextTranslation, useTranslation, } from "../../contexts/translation-context";
|
|
18
18
|
const Input = React.forwardRef((_a, ref) => {
|
|
19
|
-
var { className, error = false, id, type, label, asChild, value, onChange, icon, iconUrl, iconPosition = "right", // Default to "right" for backward compatibility
|
|
20
|
-
iconColor, placeholder, placeholderFont, placeholderFontWeight, placeholderFontSize, placeholderTextAlign, placeholderTextColor, placeholderUpperCase, inputPadding, backgroundColor, borderRadius, inputBorderColor, borderSides, inputSpacing } = _a,
|
|
19
|
+
var { className, error = false, id, type, label, labelStyle, asChild, value, onChange, icon, iconUrl, iconPosition = "right", // Default to "right" for backward compatibility
|
|
20
|
+
iconColor, placeholder, placeholderFont, placeholderFontWeight, placeholderFontSize, placeholderTextAlign, placeholderTextColor, placeholderUpperCase, inputPadding, backgroundColor, borderRadius, inputBorderColor, borderSides, inputSpacing, inputActiveBorderColor } = _a, // New prop for active border color
|
|
21
|
+
props = __rest(_a, ["className", "error", "id", "type", "label", "labelStyle", "asChild", "value", "onChange", "icon", "iconUrl", "iconPosition", "iconColor", "placeholder", "placeholderFont", "placeholderFontWeight", "placeholderFontSize", "placeholderTextAlign", "placeholderTextColor", "placeholderUpperCase", "inputPadding", "backgroundColor", "borderRadius", "inputBorderColor", "borderSides", "inputSpacing", "inputActiveBorderColor"]);
|
|
21
22
|
const translations = useTranslation();
|
|
22
23
|
const translatedPlaceholder = getTextTranslation({
|
|
23
24
|
text: placeholder,
|
|
24
25
|
translations,
|
|
25
26
|
});
|
|
26
|
-
const { Comp, inputPaddingRight, inputPaddingLeft, borderStyle, borderRadiusStyle, iconLeftPadding, iconRightPadding, iconTopPadding, iconBottomPadding, placeholderTextColorStyle, iconColorStyle, inputBgColor, inputBorderColorStyle, } = useInput({
|
|
27
|
+
const { Comp, inputPaddingRight, inputPaddingLeft, borderStyle, borderRadiusStyle, iconLeftPadding, iconRightPadding, iconTopPadding, iconBottomPadding, placeholderTextColorStyle, iconColorStyle, inputBgColor, inputBorderColorStyle, inputActiveBorderColorStyle, labelTextStyle, } = useInput({
|
|
27
28
|
asChild,
|
|
28
29
|
icon,
|
|
29
30
|
iconUrl,
|
|
@@ -37,6 +38,8 @@ const Input = React.forwardRef((_a, ref) => {
|
|
|
37
38
|
inputSpacing,
|
|
38
39
|
inputPadding,
|
|
39
40
|
placeholderTextColor,
|
|
41
|
+
inputActiveBorderColor,
|
|
42
|
+
labelStyle,
|
|
40
43
|
});
|
|
41
44
|
return (_jsxs(Comp, Object.assign({ className: "relative flex items-center group" }, { children: [(icon || iconUrl) && iconPosition === "left" && (_jsx(Icon, { name: icon, url: iconUrl, "data-error": error, size: "sm", className: cn("flex items-center absolute aspect-square fill-current z-10 icon ", {
|
|
42
45
|
"w-5": true,
|
|
@@ -50,11 +53,18 @@ const Input = React.forwardRef((_a, ref) => {
|
|
|
50
53
|
} })), _jsx("style", { children: `
|
|
51
54
|
.custom-placeholder-value::placeholder {
|
|
52
55
|
color: ${placeholderTextColorStyle};
|
|
53
|
-
}
|
|
56
|
+
}
|
|
57
|
+
.custom-placeholder-value {
|
|
58
|
+
border-color: ${inputBorderColorStyle};
|
|
59
|
+
}
|
|
60
|
+
.custom-placeholder-value:focus {
|
|
61
|
+
border-color: ${inputActiveBorderColorStyle};
|
|
62
|
+
}
|
|
63
|
+
` }), _jsx("input", Object.assign({ placeholder: translatedPlaceholder || placeholder, value: value, onChange: (e) => onChange(e.target.value), id: id, type: type, className: cn(inputVariants({ error, hasLabel: !!label }), className, "custom-placeholder-value"), "data-icon": !!icon, ref: ref }, props, { style: Object.assign(Object.assign({ paddingLeft: iconUrl &&
|
|
54
64
|
iconPosition === "left" &&
|
|
55
65
|
placeholderTextAlign === "center"
|
|
56
66
|
? undefined
|
|
57
|
-
: inputPaddingLeft, paddingRight: inputPaddingRight, fontFamily: placeholderFont, fontWeight: placeholderFontWeight, fontSize: `${placeholderFontSize}px`, textAlign: placeholderTextAlign, color: placeholderTextColorStyle, textTransform: placeholderUpperCase ? "uppercase" : undefined,
|
|
67
|
+
: inputPaddingLeft, paddingRight: inputPaddingRight, fontFamily: placeholderFont, fontWeight: placeholderFontWeight, fontSize: `${placeholderFontSize}px`, textAlign: placeholderTextAlign, color: placeholderTextColorStyle, textTransform: placeholderUpperCase ? "uppercase" : undefined, paddingTop: inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.top, paddingBottom: inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.bottom, backgroundColor: inputBgColor }, borderStyle), (label ? { borderRadius: "8px" } : borderRadiusStyle)) })), label ? (_jsx("label", Object.assign({ htmlFor: id, style: labelTextStyle, className: cn("absolute text-[10px] text-textColors-secondaryColor group-active:text-coreColors-brandColorPrimary top-2 z-10 h-4 origin-[0] opacity-100 peer-placeholder-shown:opacity-0", iconPosition === "left" ? "start-10" : "start-4") }, { children: label }))) : null, (icon || iconUrl) && iconPosition === "right" && (_jsx(Icon, { name: icon, url: iconUrl, "data-error": error, size: "sm", className: cn("flex items-center absolute aspect-square fill-current z-10 icon ", {
|
|
58
68
|
"w-5": true,
|
|
59
69
|
"text-stateColors-error": error,
|
|
60
70
|
}), style: {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { VariantProps } from "class-variance-authority";
|
|
3
3
|
import { inputVariants } from "../../../components/ui/Input/useInput";
|
|
4
|
-
import { Color } from "../../../lib/utils";
|
|
4
|
+
import { Color, TextStyle } from "../../../lib/utils";
|
|
5
5
|
export type BorderSides = ("all" | "bottom" | "left" | "right" | "top")[];
|
|
6
6
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange">, VariantProps<typeof inputVariants> {
|
|
7
7
|
id: string;
|
|
8
8
|
label?: string;
|
|
9
|
+
labelStyle?: TextStyle;
|
|
9
10
|
asChild?: boolean;
|
|
10
11
|
value: string;
|
|
11
12
|
onChange: (value: string) => void;
|
|
@@ -23,6 +24,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
23
24
|
backgroundColor?: Color;
|
|
24
25
|
borderRadius?: number;
|
|
25
26
|
inputBorderColor?: Color;
|
|
27
|
+
inputActiveBorderColor?: Color;
|
|
26
28
|
borderSides?: BorderSides;
|
|
27
29
|
inputPadding?: {
|
|
28
30
|
top: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,EAAE,CAAA;AAEzE,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,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,oBAAoB,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;IAClD,oBAAoB,CAAC,EAAE,KAAK,CAAA;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAA;IACxB,sBAAsB,CAAC,EAAE,KAAK,CAAA;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,YAAY,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB"}
|
|
@@ -7,7 +7,7 @@ export declare const inputVariants: (props?: ({
|
|
|
7
7
|
hasLabel?: boolean | null | undefined;
|
|
8
8
|
error?: boolean | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
|
-
export declare const useInput: (props: Pick<InputProps, "asChild" | "icon" | "iconUrl" | "iconPosition" | "iconColor" | "className" | "backgroundColor" | "borderRadius" | "inputBorderColor" | "borderSides" | "inputSpacing" | "inputPadding" | "placeholderTextColor">) => {
|
|
10
|
+
export declare const useInput: (props: Pick<InputProps, "asChild" | "icon" | "iconUrl" | "iconPosition" | "iconColor" | "className" | "backgroundColor" | "borderRadius" | "inputBorderColor" | "inputActiveBorderColor" | "borderSides" | "inputSpacing" | "inputPadding" | "placeholderTextColor" | "labelStyle">) => {
|
|
11
11
|
Comp: string | import("react").ForwardRefExoticComponent<import("@radix-ui/react-slot").SlotProps & import("react").RefAttributes<HTMLElement>>;
|
|
12
12
|
inputPaddingRight: string | undefined;
|
|
13
13
|
inputPaddingLeft: string | undefined;
|
|
@@ -37,5 +37,15 @@ export declare const useInput: (props: Pick<InputProps, "asChild" | "icon" | "ic
|
|
|
37
37
|
iconColorStyle: string | undefined;
|
|
38
38
|
inputBgColor: string | undefined;
|
|
39
39
|
inputBorderColorStyle: string | undefined;
|
|
40
|
+
inputActiveBorderColorStyle: string | undefined;
|
|
41
|
+
labelTextStyle: {
|
|
42
|
+
fontFamily: string | undefined;
|
|
43
|
+
fontWeight: string | number | undefined;
|
|
44
|
+
fontSize: string | number;
|
|
45
|
+
color: string | undefined;
|
|
46
|
+
textTransform: string;
|
|
47
|
+
textAlign: "left" | "right" | "center" | "justify";
|
|
48
|
+
textWrap: string;
|
|
49
|
+
} | undefined;
|
|
40
50
|
};
|
|
41
51
|
//# sourceMappingURL=useInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInput.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/useInput.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAGxD,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC,eAAO,MAAM,aAAa;;;mFAkBzB,CAAA;AAED,eAAO,MAAM,QAAQ,UACZ,KACL,UAAU,EACR,SAAS,GACT,MAAM,GACN,SAAS,GACT,cAAc,GACd,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,kBAAkB,GAClB,aAAa,GACb,cAAc,GACd,cAAc,GACd,sBAAsB,
|
|
1
|
+
{"version":3,"file":"useInput.d.ts","sourceRoot":"","sources":["../../../../components/ui/Input/useInput.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAGxD,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC,eAAO,MAAM,aAAa;;;mFAkBzB,CAAA;AAED,eAAO,MAAM,QAAQ,UACZ,KACL,UAAU,EACR,SAAS,GACT,MAAM,GACN,SAAS,GACT,cAAc,GACd,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,kBAAkB,GAClB,wBAAwB,GACxB,aAAa,GACb,cAAc,GACd,cAAc,GACd,sBAAsB,GACtB,YAAY,CACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6FF,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getColor } from "../../../lib/utils";
|
|
1
|
+
import { getColor, getTextStyle } from "../../../lib/utils";
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
export const DEFAULT_ICON_SIZE = 20;
|
|
@@ -22,7 +22,7 @@ export const inputVariants = cva("flex w-full border border-coreColors-dividingL
|
|
|
22
22
|
});
|
|
23
23
|
export const useInput = (props) => {
|
|
24
24
|
const { asChild, icon, iconUrl, iconPosition = "right", // Default to "right" for backward compatibility
|
|
25
|
-
iconColor, placeholderTextColor, backgroundColor, borderRadius, inputBorderColor, borderSides = ["all"], inputPadding, inputSpacing, } = props;
|
|
25
|
+
iconColor, placeholderTextColor, backgroundColor, borderRadius, inputBorderColor, inputActiveBorderColor, borderSides = ["all"], inputPadding, inputSpacing, labelStyle, } = props;
|
|
26
26
|
const Comp = asChild ? Slot : "div";
|
|
27
27
|
const inputPaddingRight = (icon || iconUrl) && iconPosition === "right"
|
|
28
28
|
? (inputPadding === null || inputPadding === void 0 ? void 0 : inputPadding.right)
|
|
@@ -64,7 +64,9 @@ export const useInput = (props) => {
|
|
|
64
64
|
const iconColorStyle = getColor(iconColor);
|
|
65
65
|
const inputBgColor = getColor(backgroundColor);
|
|
66
66
|
const inputBorderColorStyle = getColor(inputBorderColor);
|
|
67
|
+
const inputActiveBorderColorStyle = getColor(inputActiveBorderColor);
|
|
67
68
|
const placeholderTextColorStyle = getColor(placeholderTextColor);
|
|
69
|
+
const labelTextStyle = labelStyle ? getTextStyle(labelStyle) : undefined;
|
|
68
70
|
return {
|
|
69
71
|
Comp,
|
|
70
72
|
inputPaddingRight,
|
|
@@ -79,5 +81,7 @@ export const useInput = (props) => {
|
|
|
79
81
|
iconColorStyle,
|
|
80
82
|
inputBgColor,
|
|
81
83
|
inputBorderColorStyle,
|
|
84
|
+
inputActiveBorderColorStyle,
|
|
85
|
+
labelTextStyle,
|
|
82
86
|
};
|
|
83
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../components/ui/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAA;AAK/D,QAAA,MAAM,SAAS,8JAA0B,CAAA;AAEzC,QAAA,MAAM,aAAa,iKASjB,CAAA;AAGF,QAAA,MAAM,gBAAgB;;2CA4BpB,CAAA;AAGF,QAAA,MAAM,gBAAgB;sBAGA,MAAM;
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../components/ui/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAA;AAK/D,QAAA,MAAM,SAAS,8JAA0B,CAAA;AAEzC,QAAA,MAAM,aAAa,iKASjB,CAAA;AAGF,QAAA,MAAM,gBAAgB;;2CA4BpB,CAAA;AAGF,QAAA,MAAM,gBAAgB;sBAGA,MAAM;wCAa1B,CAAA;AAIF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,aAAa;;;mFAoDlB,CAAA;AAED,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAC1C,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,IAAI,EAAE,YAAY,GAAG,WAAW,GAAG,kBAAkB,CAAA;IACrD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,CAAC,EAAE,eAAe,GAAG,WAAW,GAAG,WAAW,CAAA;IAClD,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,IAAI,EACJ,OAAO,EACP,SAAS,EACT,YAAwB,EACxB,IAAsB,EACtB,IAAmB,EACnB,eAAe,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,aAAa;;;mFAoDlB,CAAA;AAED,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAC1C,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,IAAI,EAAE,YAAY,GAAG,WAAW,GAAG,kBAAkB,CAAA;IACrD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,CAAC,EAAE,eAAe,GAAG,WAAW,GAAG,WAAW,CAAA;IAClD,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,IAAI,EACJ,OAAO,EACP,SAAS,EACT,YAAwB,EACxB,IAAsB,EACtB,IAAmB,EACnB,eAAe,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,UAAU,2CAiDZ;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -68,6 +68,8 @@ function Badge(_a) {
|
|
|
68
68
|
var { className, icon, iconUrl, alignment, cornerRadius = "rounded", type = "icon-and-text", size = "plp-layout", backgroundColor, fontColor } = _a, props = __rest(_a, ["className", "icon", "iconUrl", "alignment", "cornerRadius", "type", "size", "backgroundColor", "fontColor"]);
|
|
69
69
|
const backgroundColorOverride = backgroundColor ? { backgroundColor } : {};
|
|
70
70
|
const BadgeText = () => (_jsx(Text, Object.assign({ type: size === "plp-layout" ? "body-primary" : "body-secondary", className: "text-productBadging-text", fontColor: fontColor }, { children: props.children })));
|
|
71
|
-
return (_jsx("div", Object.assign({ className: cn(badgeVariants({ alignment, cornerRadius }), className) }, props, { style: Object.assign(Object.assign({}, props.style), backgroundColorOverride) }, { children: type === "icon-and-text" ? (_jsxs(_Fragment, { children: [(icon || iconUrl) && (_jsx(Icon, { name: icon, url: iconUrl, style: fontColor ? { color: fontColor } : {}, size: size === "carousels" || size === "plp-layout-small"
|
|
71
|
+
return (_jsx("div", Object.assign({ className: cn(badgeVariants({ alignment, cornerRadius }), className) }, props, { style: Object.assign(Object.assign({}, props.style), backgroundColorOverride) }, { children: type === "icon-and-text" ? (_jsxs(_Fragment, { children: [(icon || iconUrl) && (_jsx(Icon, { name: icon, url: iconUrl, style: fontColor ? { color: fontColor } : {}, size: size === "carousels" || size === "plp-layout-small"
|
|
72
|
+
? "xs"
|
|
73
|
+
: "sm" })), _jsx(BadgeText, {})] })) : type === "icon-only" && icon ? (_jsx(Icon, { name: icon, url: iconUrl, style: fontColor ? { color: fontColor } : {}, size: size === "carousels" || size === "plp-layout-small" ? "xs" : "sm" })) : (_jsx(BadgeText, {})) })));
|
|
72
74
|
}
|
|
73
75
|
export { Badge, badgeVariants };
|
|
@@ -43,12 +43,6 @@ declare const getButtonProps: (buttonConfig: TextStyle & BackgroundAndPadding &
|
|
|
43
43
|
boxShadow: string;
|
|
44
44
|
width: string;
|
|
45
45
|
backgroundColor: string | undefined;
|
|
46
|
-
borderColor: string | undefined;
|
|
47
|
-
borderTopWidth: string | undefined;
|
|
48
|
-
borderBottomWidth: string | undefined;
|
|
49
|
-
borderLeftWidth: string | undefined;
|
|
50
|
-
borderRightWidth: string | undefined;
|
|
51
|
-
borderStyle: string | undefined;
|
|
52
46
|
borderRadius: string | undefined;
|
|
53
47
|
paddingTop?: undefined;
|
|
54
48
|
paddingBottom?: undefined;
|
|
@@ -59,12 +53,6 @@ declare const getButtonProps: (buttonConfig: TextStyle & BackgroundAndPadding &
|
|
|
59
53
|
boxShadow: string;
|
|
60
54
|
width: string;
|
|
61
55
|
backgroundColor: string | undefined;
|
|
62
|
-
borderColor: string | undefined;
|
|
63
|
-
borderTopWidth: string | undefined;
|
|
64
|
-
borderBottomWidth: string | undefined;
|
|
65
|
-
borderLeftWidth: string | undefined;
|
|
66
|
-
borderRightWidth: string | undefined;
|
|
67
|
-
borderStyle: string | undefined;
|
|
68
56
|
borderRadius: string | undefined;
|
|
69
57
|
paddingTop: string | undefined;
|
|
70
58
|
paddingBottom: string | undefined;
|
|
@@ -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;AAMxB,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,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAC9D;AAED,QAAA,MAAM,MAAM,uFA0GX,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
|
|
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;AAMxB,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,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAC9D;AAED,QAAA,MAAM,MAAM,uFA0GX,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"}
|
|
@@ -27,6 +27,7 @@ declare const Chip: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps
|
|
|
27
27
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
28
28
|
type MultipleChipsProps = {
|
|
29
29
|
children: React.ReactElement<ChipProps>[];
|
|
30
|
+
style?: React.CSSProperties;
|
|
30
31
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
31
32
|
};
|
|
32
33
|
declare const MultipleChips: React.FC<MultipleChipsProps>;
|