@tapcart/mobile-components 0.7.13 → 0.7.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/contexts/translation-context.d.ts +13 -0
- package/dist/components/contexts/translation-context.d.ts.map +1 -0
- package/dist/components/contexts/translation-context.js +12 -0
- package/dist/components/hooks/use-customer.d.ts +10 -0
- package/dist/components/hooks/use-customer.d.ts.map +1 -0
- package/dist/components/hooks/use-customer.js +24 -0
- package/dist/components/ui/money.d.ts +2 -1
- package/dist/components/ui/money.d.ts.map +1 -1
- package/dist/components/ui/money.js +8 -4
- package/dist/components/ui/price.d.ts +2 -1
- package/dist/components/ui/price.d.ts.map +1 -1
- package/dist/components/ui/price.js +3 -3
- package/dist/components/ui/text.d.ts +2 -1
- package/dist/components/ui/text.d.ts.map +1 -1
- package/dist/components/ui/text.js +10 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type TranslationMap = Record<string, string>;
|
|
3
|
+
export declare const TranslationProvider: ({ translations, children, }: {
|
|
4
|
+
translations: TranslationMap;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const useTranslation: () => TranslationMap;
|
|
8
|
+
export declare const getTextTranslation: ({ text, translations, }: {
|
|
9
|
+
text: string;
|
|
10
|
+
translations: Record<string, string>;
|
|
11
|
+
}) => string | undefined;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=translation-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation-context.d.ts","sourceRoot":"","sources":["../../../components/contexts/translation-context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAA;AAExD,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAI5C,eAAO,MAAM,mBAAmB;kBAIhB,cAAc;cAClB,MAAM,SAAS;6CAK1B,CAAA;AAED,eAAO,MAAM,cAAc,sBAAuC,CAAA;AAElE,eAAO,MAAM,kBAAkB;UAIvB,MAAM;kBACE,OAAO,MAAM,EAAE,MAAM,CAAC;wBAMrC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
const TranslationContext = createContext({});
|
|
5
|
+
export const TranslationProvider = ({ translations, children, }) => (_jsx(TranslationContext.Provider, Object.assign({ value: translations }, { children: children })));
|
|
6
|
+
export const useTranslation = () => useContext(TranslationContext);
|
|
7
|
+
export const getTextTranslation = ({ text, translations, }) => {
|
|
8
|
+
const key = text.trim().toLowerCase();
|
|
9
|
+
if (!(key in translations))
|
|
10
|
+
return undefined;
|
|
11
|
+
return translations[key];
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Customer = {
|
|
2
|
+
isAuthenticated: boolean;
|
|
3
|
+
};
|
|
4
|
+
type UseCustomerProps = {};
|
|
5
|
+
type UseCustomerReturn = {
|
|
6
|
+
customer: Customer;
|
|
7
|
+
};
|
|
8
|
+
export declare const useCustomer: (props: UseCustomerProps | null) => UseCustomerReturn;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=use-customer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-customer.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-customer.ts"],"names":[],"mappings":"AAWA,KAAK,QAAQ,GAAG;IACd,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAGD,KAAK,gBAAgB,GAAG,EAAE,CAAA;AAE1B,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,UACf,gBAAgB,GAAG,IAAI,KAC7B,iBAuBF,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
// @ts-ignore -- webbridge-react is not typed (yet)
|
|
4
|
+
import { useActions } from "@tapcart/webbridge-react";
|
|
5
|
+
export const useCustomer = (props) => {
|
|
6
|
+
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
|
7
|
+
const [customer, setCustomer] = useState({});
|
|
8
|
+
const actions = useActions();
|
|
9
|
+
// verify customer
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
try {
|
|
12
|
+
// webbridge method to get customerIdentity
|
|
13
|
+
actions.getCustomerIdentity(null, {
|
|
14
|
+
onSuccess: (user) => setIsAuthenticated(!!(user === null || user === void 0 ? void 0 : user.email)),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
console.log("unable to get customer identity ", e);
|
|
19
|
+
}
|
|
20
|
+
}, [actions]);
|
|
21
|
+
return {
|
|
22
|
+
customer: Object.assign({ isAuthenticated }, customer),
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -7,8 +7,9 @@ interface MoneyType {
|
|
|
7
7
|
}
|
|
8
8
|
declare const moneyVariants: (props?: ({} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
9
9
|
export interface MoneyProps extends MoneyType, VariantProps<typeof moneyVariants> {
|
|
10
|
+
hideZeroCents?: boolean;
|
|
10
11
|
styles?: React.CSSProperties;
|
|
11
12
|
}
|
|
12
|
-
declare function Money({ price, locale, currency, styles, ...props }: MoneyProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function Money({ price, locale, currency, hideZeroCents, styles, ...props }: MoneyProps): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export { Money, moneyVariants };
|
|
14
15
|
//# sourceMappingURL=money.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../../components/ui/money.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AAED,QAAA,MAAM,aAAa,gGAMjB,CAAA;AAEF,MAAM,WAAW,UACf,SAAQ,SAAS,EACf,YAAY,CAAC,OAAO,aAAa,CAAC;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC7B;AAEL,iBAAS,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../../components/ui/money.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AAED,QAAA,MAAM,aAAa,gGAMjB,CAAA;AAEF,MAAM,WAAW,UACf,SAAQ,SAAS,EACf,YAAY,CAAC,OAAO,aAAa,CAAC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC7B;AAEL,iBAAS,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAqB,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAc9F;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -10,6 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from "react";
|
|
13
14
|
import { cva } from "class-variance-authority";
|
|
14
15
|
const moneyVariants = cva("", {
|
|
15
16
|
variants: {},
|
|
@@ -19,13 +20,16 @@ const moneyVariants = cva("", {
|
|
|
19
20
|
},
|
|
20
21
|
});
|
|
21
22
|
function Money(_a) {
|
|
22
|
-
var { price, locale, currency, styles } = _a, props = __rest(_a, ["price", "locale", "currency", "styles"]);
|
|
23
|
-
const formatter = new Intl.NumberFormat(locale, {
|
|
23
|
+
var { price, locale, currency, hideZeroCents = false, styles } = _a, props = __rest(_a, ["price", "locale", "currency", "hideZeroCents", "styles"]);
|
|
24
|
+
const formatter = React.useMemo(() => new Intl.NumberFormat(locale, {
|
|
24
25
|
style: "currency",
|
|
25
26
|
currency: currency,
|
|
26
27
|
currencyDisplay: "narrowSymbol",
|
|
27
|
-
});
|
|
28
|
-
|
|
28
|
+
}), [locale, currency]);
|
|
29
|
+
const formattedPrice = React.useMemo(() => {
|
|
30
|
+
const formatted = formatter.format(Number(price));
|
|
31
|
+
return hideZeroCents ? formatted.replace(/(\.|,)00$/, '') : formatted;
|
|
32
|
+
}, [formatter, price, hideZeroCents]);
|
|
29
33
|
return _jsx("span", Object.assign({}, props, { style: styles }, { children: formattedPrice }));
|
|
30
34
|
}
|
|
31
35
|
export { Money, moneyVariants };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface PriceProps {
|
|
3
|
+
hideZeroCents?: boolean;
|
|
3
4
|
price: number;
|
|
4
5
|
priceHigh?: number;
|
|
5
6
|
priceRanges?: boolean;
|
|
@@ -14,6 +15,6 @@ interface PriceProps {
|
|
|
14
15
|
saleStyles?: React.CSSProperties;
|
|
15
16
|
strikeThroughStyles?: React.CSSProperties;
|
|
16
17
|
}
|
|
17
|
-
declare function Price({ price, priceHigh, priceRanges, isSale, compareAtPrice, compareAtPriceHigh, currency, locale, fontSize, textAlignment, standardStyles, saleStyles, strikeThroughStyles, }: PriceProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function Price({ price, priceHigh, priceRanges, isSale, compareAtPrice, compareAtPriceHigh, currency, locale, fontSize, textAlignment, standardStyles, saleStyles, strikeThroughStyles, hideZeroCents }: PriceProps): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export { Price };
|
|
19
20
|
//# sourceMappingURL=price.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../components/ui/price.tsx"],"names":[],"mappings":";AAIA,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,EAAE,CAAC;IACjD,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC,mBAAmB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC3C;AAED,iBAAS,KAAK,CAAC,EACb,KAAK,EACL,SAAS,EACT,WAAmB,EACnB,MAAc,EACd,cAAc,EACd,kBAAkB,EAClB,QAAgB,EAChB,MAAgB,EAChB,QAAa,EACb,aAAkB,EAClB,cAAc,EACd,UAAU,EACV,mBAAmB,
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../components/ui/price.tsx"],"names":[],"mappings":";AAIA,UAAU,UAAU;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,EAAE,CAAC;IACjD,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC,mBAAmB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC3C;AAED,iBAAS,KAAK,CAAC,EACb,KAAK,EACL,SAAS,EACT,WAAmB,EACnB,MAAc,EACd,cAAc,EACd,kBAAkB,EAClB,QAAgB,EAChB,MAAgB,EAChB,QAAa,EACb,aAAkB,EAClB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,aAAa,EACd,EAAE,UAAU,2CAoEZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -2,17 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Money } from "./money";
|
|
3
3
|
import { Text } from "./text";
|
|
4
4
|
import { cn } from "../../lib/utils";
|
|
5
|
-
function Price({ price, priceHigh, priceRanges = false, isSale = false, compareAtPrice, compareAtPriceHigh, currency = "USD", locale = "en-US", fontSize = 15, textAlignment = '', standardStyles, saleStyles, strikeThroughStyles, }) {
|
|
5
|
+
function Price({ price, priceHigh, priceRanges = false, isSale = false, compareAtPrice, compareAtPriceHigh, currency = "USD", locale = "en-US", fontSize = 15, textAlignment = '', standardStyles, saleStyles, strikeThroughStyles, hideZeroCents }) {
|
|
6
6
|
const Spacer = () => (_jsx("span", { children: " - " }));
|
|
7
7
|
const ProductPrice = () => {
|
|
8
8
|
const priceStyles = (!isSale || !compareAtPrice) ? standardStyles : saleStyles;
|
|
9
9
|
const colorClass = isSale ? 'text-textColors-salePriceText' : 'text-textColors-priceText';
|
|
10
|
-
return (_jsx(Text, Object.assign({ className: `${colorClass} flex-shrink-0`, style: { fontSize: `${fontSize}px` } }, { children: _jsxs("span", Object.assign({ className: "flex-grow min-w-[fit-content]" }, { children: [_jsx(Money, { price: price, currency: currency, locale: locale, styles: priceStyles }), priceRanges && priceHigh !== undefined && _jsx(Spacer, {}), priceRanges && priceHigh !== undefined && (_jsx(Money, { price: priceHigh, currency: currency, locale: locale, styles: priceStyles }))] })) })));
|
|
10
|
+
return (_jsx(Text, Object.assign({ className: `${colorClass} flex-shrink-0`, style: { fontSize: `${fontSize}px` } }, { children: _jsxs("span", Object.assign({ className: "flex-grow min-w-[fit-content]" }, { children: [_jsx(Money, { price: price, currency: currency, locale: locale, styles: priceStyles, hideZeroCents: hideZeroCents }), priceRanges && priceHigh !== undefined && _jsx(Spacer, {}), priceRanges && priceHigh !== undefined && (_jsx(Money, { price: priceHigh, currency: currency, locale: locale, styles: priceStyles, hideZeroCents: hideZeroCents }))] })) })));
|
|
11
11
|
};
|
|
12
12
|
const StrikeThroughPrice = () => {
|
|
13
13
|
if (!isSale || !compareAtPrice)
|
|
14
14
|
return null;
|
|
15
|
-
return (_jsxs(Text, Object.assign({ className: "line-through text-textColors-strikethroughPriceText flex-shrink-0 flex items-center", style: { fontSize: `${fontSize}px` } }, { children: [_jsx(Money, { price: compareAtPrice, currency: currency, locale: locale, styles: strikeThroughStyles }), priceRanges && compareAtPriceHigh && _jsx(Spacer, {}), priceRanges && compareAtPriceHigh && (_jsx(Money, { price: compareAtPriceHigh, currency: currency, locale: locale, styles: strikeThroughStyles }))] })));
|
|
15
|
+
return (_jsxs(Text, Object.assign({ className: "line-through text-textColors-strikethroughPriceText flex-shrink-0 flex items-center", style: { fontSize: `${fontSize}px` } }, { children: [_jsx(Money, { price: compareAtPrice, currency: currency, locale: locale, styles: strikeThroughStyles, hideZeroCents: hideZeroCents }), priceRanges && compareAtPriceHigh && _jsx(Spacer, {}), priceRanges && compareAtPriceHigh && (_jsx(Money, { price: compareAtPriceHigh, currency: currency, locale: locale, styles: strikeThroughStyles, hideZeroCents: hideZeroCents }))] })));
|
|
16
16
|
};
|
|
17
17
|
return (_jsxs("div", Object.assign({ className: cn("flex flex-wrap gap-x-2", { "justify-start": textAlignment === "left" }, { "justify-end": textAlignment === "right" }, { "justify-center": textAlignment === "center" }) }, { children: [_jsx(ProductPrice, {}), _jsx(StrikeThroughPrice, {})] })));
|
|
18
18
|
}
|
|
@@ -5,7 +5,8 @@ declare const textVariants: (props?: ({
|
|
|
5
5
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
6
|
export interface TextProps extends React.HTMLAttributes<HTMLParagraphElement>, VariantProps<typeof textVariants> {
|
|
7
7
|
fontColor?: string | null;
|
|
8
|
+
children?: React.ReactNode;
|
|
8
9
|
}
|
|
9
|
-
declare function Text({ className, type, fontColor, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function Text({ className, type, fontColor, children, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export { Text, textVariants };
|
|
11
12
|
//# sourceMappingURL=text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../components/ui/text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../components/ui/text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAOjE,QAAA,MAAM,YAAY;;mFAgBhB,CAAA;AAEF,MAAM,WAAW,SACf,SAAQ,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC,EAChD,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,iBAAS,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,2CAiB1E;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -10,8 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from "react";
|
|
13
14
|
import { cva } from "class-variance-authority";
|
|
14
15
|
import { cn } from "../../lib/utils";
|
|
16
|
+
import { useTranslation, getTextTranslation, } from "../contexts/translation-context";
|
|
15
17
|
const textVariants = cva("", {
|
|
16
18
|
variants: {
|
|
17
19
|
type: {
|
|
@@ -27,8 +29,14 @@ const textVariants = cva("", {
|
|
|
27
29
|
},
|
|
28
30
|
});
|
|
29
31
|
function Text(_a) {
|
|
30
|
-
var { className, type, fontColor } = _a, props = __rest(_a, ["className", "type", "fontColor"]);
|
|
32
|
+
var { className, type, fontColor, children } = _a, props = __rest(_a, ["className", "type", "fontColor", "children"]);
|
|
31
33
|
const fontColorOverride = fontColor ? { color: fontColor } : {};
|
|
32
|
-
|
|
34
|
+
const translations = useTranslation();
|
|
35
|
+
const stringContents = React.Children.toArray(children).join("");
|
|
36
|
+
const textContents = getTextTranslation({
|
|
37
|
+
text: stringContents,
|
|
38
|
+
translations,
|
|
39
|
+
});
|
|
40
|
+
return (_jsx("p", Object.assign({ className: cn(textVariants({ type }), className), style: fontColorOverride }, props, { children: textContents ? textContents : children })));
|
|
33
41
|
}
|
|
34
42
|
export { Text, textVariants };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, isFavoriteIntegrationEnabled } from "./lib/utils";
|
|
1
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, isFavoriteIntegrationEnabled, } from "./lib/utils";
|
|
2
|
+
export * from "./components/contexts/translation-context";
|
|
2
3
|
export * from "./components/hooks/use-collection";
|
|
3
4
|
export * from "./components/hooks/use-infinite-scroll";
|
|
4
5
|
export * from "./components/hooks/use-recommendations";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EACR,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EACR,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,aAAa,CAAA;AACpB,cAAc,2CAA2C,CAAA;AACzD,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,wCAAwC,CAAA;AACtD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AACvD,cAAc,oCAAoC,CAAA;AAClD,cAAc,wCAAwC,CAAA;AACtD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sCAAsC,CAAA;AACpD,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kDAAkD,CAAA;AAChE,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,6CAA6C,CAAA;AAC3D,cAAc,kDAAkD,CAAA;AAChE,cAAc,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// component exports
|
|
2
|
-
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, isFavoriteIntegrationEnabled } from "./lib/utils";
|
|
2
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, isFavoriteIntegrationEnabled, } from "./lib/utils";
|
|
3
|
+
export * from "./components/contexts/translation-context";
|
|
3
4
|
export * from "./components/hooks/use-collection";
|
|
4
5
|
export * from "./components/hooks/use-infinite-scroll";
|
|
5
6
|
export * from "./components/hooks/use-recommendations";
|