@tapcart/mobile-components 0.6.8 → 0.6.10

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.
@@ -1,6 +1,6 @@
1
1
  import { ProductVariant } from "app-studio-types";
2
2
  type SelectedOptions = Record<string, string>;
3
- export declare function useProductOptions(variants: ProductVariant[] | undefined | null): {
3
+ export declare function useProductOptions(variants: ProductVariant[] | undefined | null, selectedVariantId?: string | null): {
4
4
  selectedOptions: SelectedOptions;
5
5
  handleSelect: (optionName: string, optionValue: string) => void;
6
6
  selectedVariant: ProductVariant | undefined;
@@ -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;;+BAyCX,MAAM,eAAe,MAAM,KAAG,IAAI;;EAwBrE"}
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;;+BA0DC,MAAM,eAAe,MAAM,KAAG,IAAI;;EAwBrE"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { useState, useEffect, useMemo } from "react";
3
- export function useProductOptions(variants) {
2
+ import { useState, useEffect, useMemo, useCallback } from "react";
3
+ export function useProductOptions(variants, selectedVariantId) {
4
4
  const safeVariants = useMemo(() => variants || [], [variants]);
5
5
  const getCheapestProductFromVariants = useMemo(() => {
6
6
  return () => {
@@ -15,26 +15,40 @@ export function useProductOptions(variants) {
15
15
  });
16
16
  };
17
17
  }, [safeVariants]);
18
- const initializeSelectedOptions = useMemo(() => {
19
- return () => {
20
- const lowestPriceVariant = getCheapestProductFromVariants();
21
- if (lowestPriceVariant) {
22
- const selectedOptions = {};
23
- lowestPriceVariant.selectedOptions.forEach((option) => {
24
- selectedOptions[option.name] = option.value;
25
- });
26
- return selectedOptions;
27
- }
28
- return {};
18
+ const getSelectedOptions = useMemo(() => {
19
+ return (variant) => {
20
+ const selectedOptions = {};
21
+ variant.selectedOptions.forEach((option) => {
22
+ selectedOptions[option.name] = option.value;
23
+ });
24
+ return selectedOptions;
29
25
  };
30
- }, [getCheapestProductFromVariants]);
31
- const [selectedOptions, setSelectedOptions] = useState(initializeSelectedOptions());
26
+ }, []);
27
+ const getVariantById = useMemo(() => {
28
+ return (variantId) => {
29
+ return safeVariants.find((variant) => variant.id === variantId);
30
+ };
31
+ }, [safeVariants]);
32
+ const initializeSelectedOptions = useCallback((selectedVariantId) => {
33
+ if (selectedVariantId) {
34
+ const variant = getVariantById(selectedVariantId);
35
+ if (variant) {
36
+ return getSelectedOptions(variant);
37
+ }
38
+ }
39
+ const lowestPriceVariant = getCheapestProductFromVariants();
40
+ if (lowestPriceVariant) {
41
+ return getSelectedOptions(lowestPriceVariant);
42
+ }
43
+ return {};
44
+ }, [getCheapestProductFromVariants, getSelectedOptions, getVariantById]);
45
+ const [selectedOptions, setSelectedOptions] = useState(initializeSelectedOptions(selectedVariantId));
32
46
  const handleSelect = (optionName, optionValue) => {
33
47
  setSelectedOptions((prevOptions) => (Object.assign(Object.assign({}, prevOptions), { [optionName]: optionValue })));
34
48
  };
35
49
  useEffect(() => {
36
- setSelectedOptions(initializeSelectedOptions());
37
- }, [safeVariants, initializeSelectedOptions]);
50
+ setSelectedOptions(initializeSelectedOptions(selectedVariantId));
51
+ }, [safeVariants, initializeSelectedOptions, selectedVariantId]);
38
52
  const selectedVariant = useMemo(() => safeVariants.find((v) => v.selectedOptions.every((o) => selectedOptions[o.name] === o.value)), [safeVariants, selectedOptions]);
39
53
  return {
40
54
  selectedOptions,
@@ -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;AAGxD,QAAA,MAAM,KAAK,qFAiIV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,CAAA"}
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;AAGxD,QAAA,MAAM,KAAK,qFAwIV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,CAAA"}
@@ -40,7 +40,10 @@ const Input = React.forwardRef((_a, ref) => {
40
40
  top: iconTopPadding,
41
41
  bottom: iconBottomPadding,
42
42
  color: iconColorStyle,
43
- } })), _jsx("input", Object.assign({ placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value), id: id, type: type, className: cn(inputVariants({ error, hasLabel: !!label }), className), "data-icon": !!icon, ref: ref }, props, { style: Object.assign(Object.assign({ paddingLeft: inputPaddingLeft, paddingRight: inputPaddingRight, fontFamily: placeholderFont, fontWeight: placeholderFontWeight, fontSize: `${placeholderFontSize}px`, textAlign: placeholderTextAlign, color: placeholderTextColorStyle, textTransform: placeholderUpperCase ? "uppercase" : undefined, borderColor: inputBorderColorStyle, 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, 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 && iconPosition === "right" && (_jsx(Icon, { name: icon, "data-error": error, size: "sm", className: "absolute w-5 aspect-square fill-current text-textColors-secondaryColor top-[18px] z-10 origin-[0] end-4 peer-pr-8 icon data-[error=true]:text-stateColors-error" }))] })));
43
+ } })), _jsx("style", { children: `
44
+ .custom-placeholder-value::placeholder {
45
+ color: ${placeholderTextColorStyle};
46
+ }` }), _jsx("input", Object.assign({ placeholder: 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: inputPaddingLeft, paddingRight: inputPaddingRight, fontFamily: placeholderFont, fontWeight: placeholderFontWeight, fontSize: `${placeholderFontSize}px`, textAlign: placeholderTextAlign, color: placeholderTextColorStyle, textTransform: placeholderUpperCase ? "uppercase" : undefined, borderColor: inputBorderColorStyle, 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, 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 && iconPosition === "right" && (_jsx(Icon, { name: icon, "data-error": error, size: "sm", className: "absolute w-5 aspect-square fill-current text-textColors-secondaryColor top-[18px] z-10 origin-[0] end-4 peer-pr-8 icon data-[error=true]:text-stateColors-error" }))] })));
44
47
  });
45
48
  Input.displayName = "Input";
46
49
  export { Input };
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
+ import { Color, TextStyle, BackgroundAndPadding } from "../../lib/utils";
3
4
  declare const buttonVariants: (props?: ({
4
5
  size?: "sm" | "lg" | "content" | "default" | "icon" | null | undefined;
5
6
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "quickadd" | "applePay" | "shopPay" | null | undefined;
@@ -8,11 +9,64 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
8
9
  asChild?: boolean;
9
10
  loading?: boolean;
10
11
  icon?: string;
12
+ iconUrl?: string;
11
13
  labelClassName?: string;
12
14
  labelStyle?: React.CSSProperties | undefined;
13
15
  iconColor?: string;
14
16
  iconPosition?: "left" | "right";
15
17
  }
16
18
  declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
17
- export { Button, buttonVariants };
19
+ declare const getButtonProps: (buttonConfig: TextStyle & BackgroundAndPadding & {
20
+ iconColor: Color;
21
+ iconDetails: {
22
+ url: string;
23
+ };
24
+ backgroundShadow: boolean;
25
+ }) => {
26
+ iconColor: string | undefined;
27
+ labelStyle: {
28
+ color: string | undefined;
29
+ fontFamily: string | undefined;
30
+ fontWeight: string | number | undefined;
31
+ fontSize: string | number;
32
+ textTransform: string;
33
+ textAlign: "left" | "right" | "center" | "justify";
34
+ textWrap: string;
35
+ };
36
+ iconUrl: string;
37
+ style: {
38
+ color: string | undefined;
39
+ boxShadow: string;
40
+ width: string;
41
+ backgroundColor: string | undefined;
42
+ borderColor: string | undefined;
43
+ borderTopWidth: string | undefined;
44
+ borderBottomWidth: string | undefined;
45
+ borderLeftWidth: string | undefined;
46
+ borderRightWidth: string | undefined;
47
+ borderStyle: string | undefined;
48
+ borderRadius: string | undefined;
49
+ paddingTop?: undefined;
50
+ paddingBottom?: undefined;
51
+ paddingLeft?: undefined;
52
+ paddingRight?: undefined;
53
+ } | {
54
+ color: string | undefined;
55
+ boxShadow: string;
56
+ width: string;
57
+ backgroundColor: string | undefined;
58
+ borderColor: string | undefined;
59
+ borderTopWidth: string | undefined;
60
+ borderBottomWidth: string | undefined;
61
+ borderLeftWidth: string | undefined;
62
+ borderRightWidth: string | undefined;
63
+ borderStyle: string | undefined;
64
+ borderRadius: string | undefined;
65
+ paddingTop: string | undefined;
66
+ paddingBottom: string | undefined;
67
+ paddingLeft: string | undefined;
68
+ paddingRight: string | undefined;
69
+ };
70
+ };
71
+ export { Button, buttonVariants, getButtonProps };
18
72
  //# sourceMappingURL=button.d.ts.map
@@ -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;AAKjE,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,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAA;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC;AAED,QAAA,MAAM,MAAM,uFAoFX,CAAA;AAGD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
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,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC;AAED,QAAA,MAAM,MAAM,uFAuFX,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"}
@@ -13,7 +13,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
13
13
  import * as React from "react";
14
14
  import { Slot } from "@radix-ui/react-slot";
15
15
  import { cva } from "class-variance-authority";
16
- import { cn } from "../../lib/utils";
16
+ import { cn, getColor, getTextStyle, getBackgroundAndPaddingStyle, } from "../../lib/utils";
17
17
  import { Icon } from "./icon";
18
18
  import { Text } from "./text";
19
19
  const buttonVariants = cva("w-full flex rounded items-center justify-center transition-colors disabled:bg-stateColors-disabled disabled:border-stateColors-disabled disabled:pointer-events-none ring-offset-background overflow-elipse whitespace-nowrap truncate active:opacity-70 disabled:opacity-70", {
@@ -79,14 +79,16 @@ const labelVariants = cva("truncate", {
79
79
  },
80
80
  });
81
81
  const Button = React.forwardRef((_a, ref) => {
82
- var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconPosition } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconPosition"]);
82
+ var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconPosition, iconUrl } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconPosition", "iconUrl"]);
83
83
  const Comp = asChild ? Slot : "button";
84
- const IconButton = () => icon ? _jsx(Icon, { name: icon, size: "sm", style: { color: iconColor } }) : null;
85
- const BasicButton = () => (_jsxs(_Fragment, { children: [icon ? (_jsx(Icon, { name: icon, size: variant === "quickadd" ? "xs" : "sm", className: cn(iconVariants({ variant }), { "mr-2": iconPosition !== "right" }), style: { color: iconColor } })) : null, !loading ? (_jsx(Text, Object.assign({ type: "body-primary", className: cn(labelVariants({ variant }), labelClassName), style: labelStyle }, { children: props.children }))) : (_jsx(_Fragment, {}))] }));
84
+ const IconButton = () => icon || iconUrl ? _jsx(Icon, { name: icon, size: "sm", style: { color: iconColor } }) : null;
85
+ const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: variant === "quickadd" ? "xs" : "sm", className: cn(iconVariants({ variant }), {
86
+ "mr-2": iconPosition !== "right",
87
+ }), style: { color: iconColor } })) : null, !loading ? (_jsx(Text, Object.assign({ type: "body-primary", className: cn(labelVariants({ variant }), labelClassName), style: labelStyle }, { children: props.children }))) : (_jsx(_Fragment, {}))] }));
86
88
  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 } }) })));
87
89
  return (_jsx(Comp, Object.assign({ className: cn(buttonVariants({ variant, size }), className, {
88
90
  "pointer-events-none": loading,
89
- "flex-row-reverse": icon && iconPosition === "right"
91
+ "flex-row-reverse": icon && iconPosition === "right",
90
92
  }), ref: ref }, props, { children: loading ? (_jsx(LoadingButton, {})) : typeof props.children === "object" &&
91
93
  React.isValidElement(props.children) ? ( // if children are passed as a valid React element
92
94
  props.children // render it
@@ -94,4 +96,14 @@ const Button = React.forwardRef((_a, ref) => {
94
96
  size === "icon" ? (_jsx(IconButton, {})) : (_jsx(BasicButton, {})) })));
95
97
  });
96
98
  Button.displayName = "Button";
97
- export { Button, buttonVariants };
99
+ const getButtonProps = (buttonConfig) => {
100
+ return {
101
+ iconColor: getColor(buttonConfig.iconColor),
102
+ labelStyle: Object.assign(Object.assign({}, getTextStyle(buttonConfig)), { color: getColor(buttonConfig.color) }),
103
+ iconUrl: buttonConfig.iconDetails.url,
104
+ style: Object.assign(Object.assign({}, getBackgroundAndPaddingStyle(buttonConfig)), { color: getColor(buttonConfig.color), boxShadow: buttonConfig.backgroundShadow
105
+ ? "0px 4px 6px rgba(0,0,0,0.1)"
106
+ : "none", width: "fit-content" }),
107
+ };
108
+ };
109
+ export { Button, buttonVariants, getButtonProps };
@@ -18,6 +18,7 @@ declare const CarouselPrevious: React.ForwardRefExoticComponent<Omit<import("../
18
18
  declare const CarouselNext: React.ForwardRefExoticComponent<Omit<import("../../components/ui/button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
19
19
  type CarouselDotsProps = {
20
20
  maxDots?: number;
21
+ dotColor?: string;
21
22
  };
22
23
  declare const CarouselDots: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & CarouselDotsProps & React.RefAttributes<HTMLDivElement>>;
23
24
  export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, CarouselDots, };
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../components/ui/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAA;AAM7B,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAA;AAC1C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAChE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAC/C,KAAK,cAAc,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAE9C,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAA;IACnC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;CAC9C,CAAA;AAuBD,QAAA,MAAM,QAAQ,6HAkHb,CAAA;AAGD,QAAA,MAAM,eAAe,6GAmBnB,CAAA;AAGF,QAAA,MAAM,YAAY,6GAmBhB,CAAA;AAGF,QAAA,MAAM,gBAAgB,kLA0BpB,CAAA;AAGF,QAAA,MAAM,YAAY,kLA0BhB,CAAA;AAIF,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,QAAA,MA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AC;AAGH,OAAO,EACL,KAAK,WAAW,EAChB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,CAAA"}
@@ -117,7 +117,7 @@ const CarouselNext = React.forwardRef((_a, ref) => {
117
117
  });
118
118
  CarouselNext.displayName = "CarouselNext";
119
119
  const CarouselDots = React.forwardRef((_a, ref) => {
120
- var { maxDots = 5 } = _a, props = __rest(_a, ["maxDots"]);
120
+ var { maxDots = 5, dotColor = "var(--coreColors-brandColorPrimary)" } = _a, props = __rest(_a, ["maxDots", "dotColor"]);
121
121
  const { api } = useCarousel();
122
122
  const [_, setUpdateState] = React.useState(false);
123
123
  const toggleUpdateState = React.useCallback(() => setUpdateState((prevState) => !prevState), []);
@@ -134,9 +134,10 @@ const CarouselDots = React.forwardRef((_a, ref) => {
134
134
  const numberOfSlides = Math.min((api === null || api === void 0 ? void 0 : api.scrollSnapList().length) || 0, maxDots);
135
135
  const currentSlide = Math.min((api === null || api === void 0 ? void 0 : api.selectedScrollSnap()) || 0, maxDots - 1);
136
136
  if (numberOfSlides > 1) {
137
- return (_jsx("div", Object.assign({ ref: ref, className: `flex justify-center ${props.className}` }, { children: Array.from({ length: numberOfSlides }, (_, i) => (_jsx(Button, { className: `mx-1 h-1.5 w-1.5 rounded-full p-0 border-none ${i === currentSlide
138
- ? 'bg-coreColors-brandColorPrimary'
139
- : 'bg-coreColors-brandColorPrimary opacity-50'}`, "aria-label": `Go to slide ${i + 1}`, onClick: () => api === null || api === void 0 ? void 0 : api.scrollTo(i) }, i))) })));
137
+ return (_jsx("div", Object.assign({ ref: ref, className: `flex justify-center ${props.className}` }, { children: Array.from({ length: numberOfSlides }, (_, i) => (_jsx(Button, { className: 'mx-1 h-1.5 w-1.5 rounded-full p-0 border-none', style: {
138
+ backgroundColor: dotColor,
139
+ opacity: i === currentSlide ? 1 : 0.5
140
+ }, "aria-label": `Go to slide ${i + 1}`, onClick: () => api === null || api === void 0 ? void 0 : api.scrollTo(i) }, i))) })));
140
141
  }
141
142
  else {
142
143
  return _jsx(_Fragment, {});
@@ -1,8 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
+ import { Spacing } from "../../lib/utils";
4
+ import { BorderSides } from "./Input/types";
3
5
  declare const favoriteVariants: (props?: ({
4
6
  size?: "small" | "large" | null | undefined;
5
- showBackground?: boolean | null | undefined;
7
+ showBackgroundShadow?: boolean | null | undefined;
6
8
  layoutType?: "below-image-on-right" | "top-right" | "top-left" | "bottom-left" | "bottom-right" | null | undefined;
7
9
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
10
  export interface FavoriteProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof favoriteVariants> {
@@ -10,9 +12,15 @@ export interface FavoriteProps extends React.ButtonHTMLAttributes<HTMLButtonElem
10
12
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
11
13
  iconUrl?: string;
12
14
  showBackground?: boolean;
15
+ showBackgroundShadow?: boolean;
13
16
  cornerRadius?: number;
14
17
  layoutType?: "below-image-on-right" | "top-right" | "top-left" | "bottom-left" | "bottom-right";
15
18
  favoriteFillColor?: string;
19
+ disabledFillColor?: string;
20
+ backgroundColor?: string;
21
+ borderSides?: BorderSides;
22
+ borderColorStyle?: string;
23
+ borderPadding?: Partial<Spacing>;
16
24
  }
17
25
  declare const Favorite: React.ForwardRefExoticComponent<FavoriteProps & React.RefAttributes<HTMLButtonElement>>;
18
26
  export { Favorite, favoriteVariants };
@@ -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;AAKjE,QAAA,MAAM,gBAAgB;;;;mFA0BrB,CAAA;AAED,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,o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AC,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,yFAsDb,CAAA;AAGD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
@@ -12,16 +12,16 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from "react";
14
14
  import { cva } from "class-variance-authority";
15
- import { cn } from "../../lib/utils";
15
+ import { cn, getBorderSidesStyle, getPaddingStyle } from "../../lib/utils";
16
16
  import { Icon } from "./icon";
17
- const favoriteVariants = cva("flex p-2 gap-2 rounded-[4px] shadow-buttonColors-primaryShadow", {
17
+ const favoriteVariants = cva("flex p-2 gap-2 rounded-[4px]", {
18
18
  variants: {
19
19
  size: {
20
20
  small: "p-2",
21
21
  large: "p-3",
22
22
  },
23
- showBackground: {
24
- true: "bg-coreColors-inputBackground",
23
+ showBackgroundShadow: {
24
+ true: "shadow-primary",
25
25
  false: "",
26
26
  },
27
27
  layoutType: {
@@ -34,19 +34,17 @@ const favoriteVariants = cva("flex p-2 gap-2 rounded-[4px] shadow-buttonColors-p
34
34
  },
35
35
  defaultVariants: {
36
36
  size: "small",
37
- showBackground: true,
37
+ showBackgroundShadow: false,
38
38
  layoutType: "below-image-on-right",
39
39
  },
40
40
  });
41
41
  const Favorite = React.forwardRef((_a, ref) => {
42
- var { className, size = "small", selected = false, onClick, iconUrl = "https://storage.googleapis.com/tapcart-asset-uploads-prod/default-icon-options/Heart_1.svg", showBackground = false, cornerRadius = 4, layoutType = "below-image-on-right", favoriteFillColor = "#D91E18FF" } = _a, props = __rest(_a, ["className", "size", "selected", "onClick", "iconUrl", "showBackground", "cornerRadius", "layoutType", "favoriteFillColor"]);
42
+ var { className, size = "small", selected = false, onClick, iconUrl = "https://storage.googleapis.com/tapcart-asset-uploads-prod/default-icon-options/Heart_1.svg", showBackground = false, showBackgroundShadow = false, cornerRadius = 4, layoutType = "below-image-on-right", favoriteFillColor = "#D91E18", disabledFillColor = "#727272", backgroundColor = "#FFFFFF", borderSides = ["all"], borderColorStyle = undefined, borderPadding = {} } = _a, props = __rest(_a, ["className", "size", "selected", "onClick", "iconUrl", "showBackground", "showBackgroundShadow", "cornerRadius", "layoutType", "favoriteFillColor", "disabledFillColor", "backgroundColor", "borderSides", "borderColorStyle", "borderPadding"]);
43
43
  return (_jsx("button", Object.assign({ onClick: onClick, ref: ref, className: cn(favoriteVariants({
44
44
  size,
45
- showBackground,
45
+ showBackgroundShadow,
46
46
  layoutType,
47
- }), className), style: {
48
- borderRadius: `${cornerRadius}px`,
49
- } }, props, { children: _jsx(Icon, { url: iconUrl, color: selected ? "stateColors-favorites" : "stateColors-disabled", size: size === "small" ? "xs" : "sm", fillColor: selected ? favoriteFillColor : "" }) })));
47
+ }), className), style: Object.assign(Object.assign({ borderRadius: `${cornerRadius}px`, backgroundColor: backgroundColor || "var(--coreColors-inputBackground)", 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 }) })));
50
48
  });
51
49
  Favorite.displayName = "Favorite";
52
50
  export { Favorite, favoriteVariants };
@@ -5,7 +5,7 @@ interface GridType {
5
5
  children: React.ReactNode;
6
6
  }
7
7
  declare const gridVariants: (props?: ({
8
- columns?: 2 | 1 | 3 | 4 | null | undefined;
8
+ columns?: 1 | 2 | 3 | 4 | null | undefined;
9
9
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
10
10
  export interface GridProps extends GridType, VariantProps<typeof gridVariants> {
11
11
  }
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  import { type VariantProps } from "class-variance-authority";
2
3
  interface MoneyType {
3
4
  currency: string;
@@ -6,7 +7,8 @@ interface MoneyType {
6
7
  }
7
8
  declare const moneyVariants: (props?: ({} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
9
  export interface MoneyProps extends MoneyType, VariantProps<typeof moneyVariants> {
10
+ styles?: React.CSSProperties;
9
11
  }
10
- declare function Money({ price, locale, currency, ...props }: MoneyProps): import("react/jsx-runtime").JSX.Element;
12
+ declare function Money({ price, locale, currency, styles, ...props }: MoneyProps): import("react/jsx-runtime").JSX.Element;
11
13
  export { Money, moneyVariants };
12
14
  //# sourceMappingURL=money.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../../components/ui/money.tsx"],"names":[],"mappings":"AACA,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;CAAG;AAEzC,iBAAS,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAS/D;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
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,2CASvE;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
@@ -19,13 +19,13 @@ const moneyVariants = cva("", {
19
19
  },
20
20
  });
21
21
  function Money(_a) {
22
- var { price, locale, currency } = _a, props = __rest(_a, ["price", "locale", "currency"]);
22
+ var { price, locale, currency, styles } = _a, props = __rest(_a, ["price", "locale", "currency", "styles"]);
23
23
  const formatter = new Intl.NumberFormat(locale, {
24
24
  style: "currency",
25
25
  currency: currency,
26
26
  currencyDisplay: "narrowSymbol",
27
27
  });
28
28
  let formattedPrice = formatter.format(Number(price));
29
- return _jsx("span", Object.assign({}, props, { children: formattedPrice }));
29
+ return _jsx("span", Object.assign({}, props, { style: styles }, { children: formattedPrice }));
30
30
  }
31
31
  export { Money, moneyVariants };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface PriceProps {
2
3
  price: number;
3
4
  priceHigh?: number;
@@ -9,7 +10,10 @@ interface PriceProps {
9
10
  locale?: string;
10
11
  fontSize?: number;
11
12
  textAlignment?: 'left' | 'center' | 'right' | '';
13
+ standardStyles?: React.CSSProperties;
14
+ saleStyles?: React.CSSProperties;
15
+ strikeThroughStyles?: React.CSSProperties;
12
16
  }
13
- declare function Price({ price, priceHigh, priceRanges, isSale, compareAtPrice, compareAtPriceHigh, currency, locale, fontSize, textAlignment, }: PriceProps): import("react/jsx-runtime").JSX.Element;
17
+ declare function Price({ price, priceHigh, priceRanges, isSale, compareAtPrice, compareAtPriceHigh, currency, locale, fontSize, textAlignment, standardStyles, saleStyles, strikeThroughStyles, }: PriceProps): import("react/jsx-runtime").JSX.Element;
14
18
  export { Price };
15
19
  //# 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;CAClD;AAED,iBAAS,KAAK,CAAC,EACb,KAAK,EACL,SAAS,EACT,WAAmB,EACnB,MAAc,EACd,cAAc,EACd,kBAAkB,EAClB,QAAgB,EAChB,MAAgB,EAChB,QAAa,EACb,aAAkB,GACnB,EAAE,UAAU,2CA6DZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
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,GACpB,EAAE,UAAU,2CA8DZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
@@ -2,16 +2,16 @@ 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 = '', }) {
5
+ function Price({ price, priceHigh, priceRanges = false, isSale = false, compareAtPrice, compareAtPriceHigh, currency = "USD", locale = "en-US", fontSize = 15, textAlignment = '', standardStyles, saleStyles, strikeThroughStyles, }) {
6
6
  const Spacer = () => (_jsx("span", { children: " - " }));
7
7
  const ProductPrice = () => {
8
8
  const colorClass = isSale ? 'text-textColors-salePriceText' : 'text-textColors-priceText';
9
- 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 }), priceRanges && priceHigh !== undefined && _jsx(Spacer, {}), priceRanges && priceHigh !== undefined && (_jsx(Money, { price: priceHigh, currency: currency, locale: locale }))] })) })));
9
+ 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: standardStyles }), priceRanges && priceHigh !== undefined && _jsx(Spacer, {}), priceRanges && priceHigh !== undefined && (_jsx(Money, { price: priceHigh, currency: currency, locale: locale, styles: saleStyles }))] })) })));
10
10
  };
11
11
  const StrikeThroughPrice = () => {
12
12
  if (!isSale || !compareAtPrice)
13
13
  return null;
14
- return (_jsxs(Text, Object.assign({ className: "line-through text-textColors-strikethroughPriceText flex-shrink-0", style: { fontSize: `${fontSize}px` } }, { children: [_jsx(Money, { price: compareAtPrice, currency: currency, locale: locale }), priceRanges && compareAtPriceHigh && _jsx(Spacer, {}), priceRanges && compareAtPriceHigh && (_jsx(Money, { price: compareAtPriceHigh, currency: currency, locale: locale }))] })));
14
+ return (_jsxs(Text, Object.assign({ className: "line-through text-textColors-strikethroughPriceText flex-shrink-0", style: Object.assign({ fontSize: `${fontSize}px` }, strikeThroughStyles) }, { children: [_jsx(Money, { price: compareAtPrice, currency: currency, locale: locale }), priceRanges && compareAtPriceHigh && _jsx(Spacer, {}), priceRanges && compareAtPriceHigh && (_jsx(Money, { price: compareAtPriceHigh, currency: currency, locale: locale }))] })));
15
15
  };
16
16
  return (_jsxs("div", Object.assign({ className: cn("flex flex-wrap gap-2", { "justify-start": textAlignment === "left" }, { "justify-end": textAlignment === "right" }, { "justify-center": textAlignment === "center" }) }, { children: [_jsx(ProductPrice, {}), _jsx(StrikeThroughPrice, {})] })));
17
17
  }
@@ -1,8 +1,42 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const videoVariants: (props?: ({} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
+ type VideoAttributes = {
5
+ enabled: boolean;
6
+ aspectRatio: string;
7
+ videoFit: string;
8
+ overlayOpacity: number;
9
+ autoplay: boolean;
10
+ videoSound: boolean;
11
+ };
4
12
  export interface VideoProps extends React.HTMLAttributes<HTMLVideoElement>, VariantProps<typeof videoVariants> {
13
+ autoPlay: boolean | undefined;
14
+ muted: boolean | undefined;
15
+ loop: boolean | undefined;
5
16
  }
6
17
  declare function Video({ className, ...props }: VideoProps): import("react/jsx-runtime").JSX.Element;
7
- export { Video, videoVariants };
18
+ declare const getVideoStyle: (videoAttributes: VideoAttributes, videoSrc: {
19
+ url: string;
20
+ naturalAspectRatio: string;
21
+ }) => {
22
+ aspectRatio: string;
23
+ opacity?: undefined;
24
+ objectFit?: undefined;
25
+ } | {
26
+ opacity: number;
27
+ aspectRatio: string;
28
+ objectFit: string;
29
+ };
30
+ declare const getVideoAttributeProps: (videoAttributes: VideoAttributes) => {
31
+ autoPlay?: undefined;
32
+ controls?: undefined;
33
+ muted?: undefined;
34
+ loop?: undefined;
35
+ } | {
36
+ autoPlay: boolean;
37
+ controls: boolean;
38
+ muted: boolean;
39
+ loop: boolean;
40
+ };
41
+ export { Video, videoVariants, getVideoStyle, getVideoAttributeProps };
8
42
  //# sourceMappingURL=video.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../components/ui/video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,aAAa,gGAEjB,CAAA;AAEF,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAC5C,YAAY,CAAC,OAAO,aAAa,CAAC;CAAG;AAEzC,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAWjD;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../components/ui/video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,aAAa,gGAEjB,CAAA;AAEF,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAC5C,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,KAAK,EAAE,OAAO,GAAG,SAAS,CAAA;IAC1B,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;CAC1B;AAED,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAQjD;AAED,QAAA,MAAM,aAAa,oBACA,eAAe,YACtB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE;;;;;;;;CActD,CAAA;AAED,QAAA,MAAM,sBAAsB,oBAAqB,eAAe;;;;;;;;;;CAW/D,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,sBAAsB,EAAE,CAAA"}
@@ -17,6 +17,29 @@ const videoVariants = cva("w-full", {
17
17
  });
18
18
  function Video(_a) {
19
19
  var { className } = _a, props = __rest(_a, ["className"]);
20
- return (_jsx("video", Object.assign({ className: cn(videoVariants({}), className) }, props, { autoPlay: true, playsInline: true, muted: true, loop: true })));
20
+ return (_jsx("video", Object.assign({ className: cn(videoVariants({}), className), preload: "metadata" }, props)));
21
21
  }
22
- export { Video, videoVariants };
22
+ const getVideoStyle = (videoAttributes, videoSrc) => {
23
+ if (!videoAttributes.enabled) {
24
+ return { aspectRatio: videoSrc.naturalAspectRatio.replace(":", "/") };
25
+ }
26
+ return {
27
+ opacity: videoAttributes.overlayOpacity / 100,
28
+ aspectRatio: videoAttributes.aspectRatio === "auto"
29
+ ? videoSrc.naturalAspectRatio.replace(":", "/")
30
+ : videoAttributes.aspectRatio.replace(":", "/"),
31
+ objectFit: videoAttributes.videoFit === "fill" ? "cover" : "contain",
32
+ };
33
+ };
34
+ const getVideoAttributeProps = (videoAttributes) => {
35
+ if (!videoAttributes.enabled) {
36
+ return {};
37
+ }
38
+ return {
39
+ autoPlay: videoAttributes.autoplay,
40
+ controls: !videoAttributes.autoplay,
41
+ muted: !videoAttributes.videoSound,
42
+ loop: true,
43
+ };
44
+ };
45
+ export { Video, videoVariants, getVideoStyle, getVideoAttributeProps };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, } from "./lib/utils";
1
+ export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, } from "./lib/utils";
2
2
  export * from "./components/hooks/use-collection";
3
3
  export * from "./components/hooks/use-infinite-scroll";
4
4
  export * from "./components/hooks/use-recommendations";
5
5
  export * from "./components/hooks/use-products";
6
- export * from "./components/hooks/use-products";
7
6
  export * from "./components/hooks/use-scroll-direction";
8
7
  export * from "./components/hooks/use-sort-filter";
9
8
  export * from "./components/ui/accordion";
@@ -49,5 +48,6 @@ export * from "./components/ui/video";
49
48
  export * from "./components/ui/wishlist";
50
49
  export * from "./components/hooks/use-product-options";
51
50
  export * from "./components/ui/wishlist-select";
51
+ export * from "./components/hooks/use-shop";
52
52
  export * from "./components/libs/sort-filter/search-integration";
53
53
  //# sourceMappingURL=index.d.ts.map
@@ -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,GAC7B,MAAM,aAAa,CAAA;AACpB,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,wCAAwC,CAAA;AACtD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AACvD,cAAc,oCAAoC,CAAA;AAClD,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,cA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,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,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,0BAA0B,CAAA;AACxC,cAAc,wCAAwC,CAAA;AACtD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kDAAkD,CAAA"}
package/dist/index.js CHANGED
@@ -1,10 +1,9 @@
1
1
  // component exports
2
- export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, } from "./lib/utils";
2
+ export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, } from "./lib/utils";
3
3
  export * from "./components/hooks/use-collection";
4
4
  export * from "./components/hooks/use-infinite-scroll";
5
5
  export * from "./components/hooks/use-recommendations";
6
6
  export * from "./components/hooks/use-products";
7
- export * from "./components/hooks/use-products";
8
7
  export * from "./components/hooks/use-scroll-direction";
9
8
  export * from "./components/hooks/use-sort-filter";
10
9
  export * from "./components/ui/accordion";
@@ -50,4 +49,5 @@ export * from "./components/ui/video";
50
49
  export * from "./components/ui/wishlist";
51
50
  export * from "./components/hooks/use-product-options";
52
51
  export * from "./components/ui/wishlist-select";
52
+ export * from "./components/hooks/use-shop";
53
53
  export * from "./components/libs/sort-filter/search-integration";
@@ -24,7 +24,7 @@ export declare const getBorderSidesStyle: (borderSides: BorderSides) => {
24
24
  borderWidth?: undefined;
25
25
  };
26
26
  type VerticalAlignment = "top" | "middle" | "bottom";
27
- type Spacing = {
27
+ export type Spacing = {
28
28
  top: number;
29
29
  bottom: number;
30
30
  left: number;
@@ -47,12 +47,24 @@ export declare const getVerticalAlignmentStyle: (alignmentAndSpacing: AlignmentA
47
47
  top?: undefined;
48
48
  transform?: undefined;
49
49
  };
50
- type BackgroundAndPadding = {
50
+ export declare const getPaddingStyle: (padding: Partial<Spacing> | undefined) => {
51
+ paddingTop?: undefined;
52
+ paddingBottom?: undefined;
53
+ paddingLeft?: undefined;
54
+ paddingRight?: undefined;
55
+ } | {
56
+ paddingTop: string | undefined;
57
+ paddingBottom: string | undefined;
58
+ paddingLeft: string | undefined;
59
+ paddingRight: string | undefined;
60
+ };
61
+ export type BackgroundAndPadding = {
51
62
  backgroundColor?: Color;
52
63
  borderSides?: BorderSides;
53
64
  borderColor?: Color;
54
65
  cornerRadius?: number;
55
66
  padding?: Partial<Spacing>;
67
+ borderRadius?: number;
56
68
  };
57
69
  export declare const getBackgroundAndPaddingStyle: (backgroundAndPadding: BackgroundAndPadding) => {
58
70
  backgroundColor: string | undefined;
@@ -61,12 +73,25 @@ export declare const getBackgroundAndPaddingStyle: (backgroundAndPadding: Backgr
61
73
  borderBottomWidth: string | undefined;
62
74
  borderLeftWidth: string | undefined;
63
75
  borderRightWidth: string | undefined;
76
+ borderStyle: string | undefined;
77
+ borderRadius: string | undefined;
78
+ paddingTop?: undefined;
79
+ paddingBottom?: undefined;
80
+ paddingLeft?: undefined;
81
+ paddingRight?: undefined;
82
+ } | {
83
+ backgroundColor: string | undefined;
84
+ borderColor: string | undefined;
85
+ borderTopWidth: string | undefined;
86
+ borderBottomWidth: string | undefined;
87
+ borderLeftWidth: string | undefined;
88
+ borderRightWidth: string | undefined;
89
+ borderStyle: string | undefined;
90
+ borderRadius: string | undefined;
64
91
  paddingTop: string | undefined;
65
92
  paddingBottom: string | undefined;
66
93
  paddingLeft: string | undefined;
67
94
  paddingRight: string | undefined;
68
- borderStyle: string | undefined;
69
- borderRadius: string | undefined;
70
95
  };
71
96
  type BackgroundAndSpacing = AlignmentAndSpacing & {
72
97
  backgroundColor?: Color;
@@ -79,7 +104,7 @@ export declare const getBackgroundAndSpacingStyle: (backgroundAndSpacing: Backgr
79
104
  backgroundColor: string;
80
105
  borderRadius: string;
81
106
  };
82
- type TextStyle = {
107
+ export type TextStyle = {
83
108
  font: {
84
109
  family: string;
85
110
  weight: number | string;
@@ -88,6 +113,7 @@ type TextStyle = {
88
113
  color: Color;
89
114
  uppercase: boolean;
90
115
  textAlignment: "left" | "center" | "right" | "justify";
116
+ wrapText: boolean;
91
117
  };
92
118
  type Headline = TextStyle;
93
119
  type Subtext = TextStyle;
@@ -98,5 +124,26 @@ export declare const getTextStyle: (textStyle: Headline | Subtext) => {
98
124
  color: string | undefined;
99
125
  textTransform: string;
100
126
  textAlign: "left" | "right" | "center" | "justify";
127
+ textWrap: string;
128
+ };
129
+ export declare const getVerticalAlignment: (alignment: string, padding?: {
130
+ top: number;
131
+ bottom: number;
132
+ }) => {
133
+ bottom: string;
134
+ top: string;
135
+ transform?: undefined;
136
+ } | {
137
+ top: string;
138
+ transform: string;
139
+ bottom?: undefined;
140
+ } | {
141
+ bottom?: undefined;
142
+ top?: undefined;
143
+ transform?: undefined;
101
144
  };
145
+ export declare const mapFlexToAlignment: (flexClass: string) => string;
146
+ export declare function getIdFromGid(gid: string | undefined): string;
147
+ export declare function productGidFromId(id: string | null | undefined): string | null;
148
+ export declare function variantGidFromId(id: string | null | undefined): string | null;
102
149
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;AAGvC,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnE,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,eAAe,UAc3B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,CAAA;AAMjE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAI9C,eAAO,MAAM,QAAQ,gBAAiB,KAAK,GAAG,SAAS,uBAMtD,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7D,KAAK,WAAW,GAAG,UAAU,EAAE,CAAA;AAE/B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAU/B,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEpD,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,C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AgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAI7E"}
package/dist/lib/utils.js CHANGED
@@ -25,6 +25,9 @@ for (let iconColorLevel of iconColorLevels) {
25
25
  export { cva } from "class-variance-authority";
26
26
  // #region =-=-=-= Block Utils =-=-=-=
27
27
  export const getColor = (colorOption) => {
28
+ if ((colorOption === null || colorOption === void 0 ? void 0 : colorOption.value) === null) {
29
+ return undefined;
30
+ }
28
31
  return colorOption
29
32
  ? (colorOption === null || colorOption === void 0 ? void 0 : colorOption.type) === "brand-kit"
30
33
  ? `var(--${colorOption.value})`
@@ -55,31 +58,29 @@ export const getVerticalAlignmentStyle = (alignmentAndSpacing) => {
55
58
  return {};
56
59
  }
57
60
  };
58
- export const getBackgroundAndPaddingStyle = (backgroundAndPadding) => {
59
- const { backgroundColor, borderSides, borderColor, cornerRadius, padding } = backgroundAndPadding;
61
+ export const getPaddingStyle = (padding) => {
62
+ if (!padding)
63
+ return {};
60
64
  return {
61
- backgroundColor: getColor(backgroundColor),
62
- borderColor: getColor(borderColor),
63
- borderTopWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("top")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
64
- ? "1px"
65
- : undefined,
66
- borderBottomWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("bottom")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
67
- ? "1px"
68
- : undefined,
69
- borderLeftWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("left")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
70
- ? "1px"
71
- : undefined,
72
- borderRightWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("right")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
73
- ? "1px"
74
- : undefined,
75
65
  paddingTop: (padding === null || padding === void 0 ? void 0 : padding.top) !== undefined ? `${padding.top}px` : undefined,
76
66
  paddingBottom: (padding === null || padding === void 0 ? void 0 : padding.bottom) !== undefined ? `${padding.bottom}px` : undefined,
77
67
  paddingLeft: (padding === null || padding === void 0 ? void 0 : padding.left) !== undefined ? `${padding.left}px` : undefined,
78
68
  paddingRight: (padding === null || padding === void 0 ? void 0 : padding.right) !== undefined ? `${padding.right}px` : undefined,
79
- borderStyle: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.length) ? "solid" : undefined,
80
- borderRadius: cornerRadius !== undefined ? `${cornerRadius}px` : undefined,
81
69
  };
82
70
  };
71
+ export const getBackgroundAndPaddingStyle = (backgroundAndPadding) => {
72
+ const { backgroundColor, borderSides, borderColor, cornerRadius, padding, borderRadius, } = backgroundAndPadding;
73
+ const radius = cornerRadius || borderRadius;
74
+ return Object.assign(Object.assign({}, getPaddingStyle(padding)), { backgroundColor: getColor(backgroundColor), borderColor: getColor(borderColor), borderTopWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("top")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
75
+ ? "1px"
76
+ : undefined, borderBottomWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("bottom")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
77
+ ? "1px"
78
+ : undefined, borderLeftWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("left")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
79
+ ? "1px"
80
+ : undefined, borderRightWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("right")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
81
+ ? "1px"
82
+ : undefined, borderStyle: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.length) ? "solid" : undefined, borderRadius: radius !== undefined ? `${radius}px` : undefined });
83
+ };
83
84
  export const getBackgroundAndSpacingStyle = (backgroundAndSpacing) => {
84
85
  const { spacing, borderColor, backgroundColor, backgroundCorners } = backgroundAndSpacing;
85
86
  return {
@@ -90,7 +91,7 @@ export const getBackgroundAndSpacingStyle = (backgroundAndSpacing) => {
90
91
  };
91
92
  };
92
93
  export const getTextStyle = (textStyle) => {
93
- const { font, size, color, uppercase, textAlignment } = textStyle;
94
+ const { font, size, color, uppercase, textAlignment, wrapText } = textStyle;
94
95
  return {
95
96
  fontFamily: font.family === "initial" ? undefined : font.family,
96
97
  fontWeight: font.weight === "initial" ? undefined : font.weight,
@@ -98,6 +99,51 @@ export const getTextStyle = (textStyle) => {
98
99
  color: getColor(color),
99
100
  textTransform: uppercase ? "uppercase" : "none",
100
101
  textAlign: textAlignment,
102
+ textWrap: wrapText ? "wrap" : "nowrap",
101
103
  };
102
104
  };
105
+ export const getVerticalAlignment = (alignment, padding = { top: 0, bottom: 0 }) => {
106
+ if (alignment === "bottom") {
107
+ return { bottom: `${padding.bottom}px`, top: "auto" };
108
+ }
109
+ else if (alignment === "middle") {
110
+ return { top: "50%", transform: `translateY(-50%)` };
111
+ }
112
+ else if (alignment === "top") {
113
+ return { top: `${padding.top}px`, bottom: "auto" };
114
+ }
115
+ else {
116
+ return {};
117
+ }
118
+ };
119
+ const alignmentClasses = {
120
+ left: "justify-start",
121
+ middle: "justify-center",
122
+ right: "justify-end",
123
+ };
124
+ export const mapFlexToAlignment = (flexClass) => {
125
+ if (flexClass in alignmentClasses)
126
+ return alignmentClasses[flexClass];
127
+ return "";
128
+ };
129
+ export function getIdFromGid(gid) {
130
+ if (!gid)
131
+ return "";
132
+ const arr = gid.split("/");
133
+ return arr[arr.length - 1] || "";
134
+ }
135
+ export function productGidFromId(id) {
136
+ if (!id)
137
+ return null;
138
+ if (id.startsWith("gid://shopify/Product/"))
139
+ return id;
140
+ return `gid://shopify/Product/${id}`;
141
+ }
142
+ export function variantGidFromId(id) {
143
+ if (!id)
144
+ return null;
145
+ if (id.startsWith("gid://shopify/ProductVariant/"))
146
+ return id;
147
+ return `gid://shopify/ProductVariant/${id}`;
148
+ }
103
149
  // #endregion =-=-=-= END BLOCK UTILS =-=-=-=
package/dist/styles.css CHANGED
@@ -907,6 +907,9 @@ video {
907
907
  .grid {
908
908
  display: grid;
909
909
  }
910
+ .hidden {
911
+ display: none;
912
+ }
910
913
  .aspect-productImages {
911
914
  aspect-ratio: var(--productImage-aspectRatio);
912
915
  }
@@ -931,6 +934,9 @@ video {
931
934
  .h-11 {
932
935
  height: 2.75rem;
933
936
  }
937
+ .h-12 {
938
+ height: 3rem;
939
+ }
934
940
  .h-14 {
935
941
  height: 3.5rem;
936
942
  }
@@ -979,6 +985,9 @@ video {
979
985
  .h-\[42px\] {
980
986
  height: 42px;
981
987
  }
988
+ .h-\[48px\] {
989
+ height: 48px;
990
+ }
982
991
  .h-\[4px\] {
983
992
  height: 4px;
984
993
  }
@@ -994,6 +1003,9 @@ video {
994
1003
  .max-h-\[240px\] {
995
1004
  max-height: 240px;
996
1005
  }
1006
+ .max-h-\[300px\] {
1007
+ max-height: 300px;
1008
+ }
997
1009
  .max-h-screen {
998
1010
  max-height: 100vh;
999
1011
  }
@@ -1012,6 +1024,9 @@ video {
1012
1024
  .w-10 {
1013
1025
  width: 2.5rem;
1014
1026
  }
1027
+ .w-12 {
1028
+ width: 3rem;
1029
+ }
1015
1030
  .w-14 {
1016
1031
  width: 3.5rem;
1017
1032
  }
@@ -1054,9 +1069,6 @@ video {
1054
1069
  .w-\[40px\] {
1055
1070
  width: 40px;
1056
1071
  }
1057
- .w-\[69px\] {
1058
- width: 69px;
1059
- }
1060
1072
  .w-auto {
1061
1073
  width: auto;
1062
1074
  }
@@ -1084,6 +1096,9 @@ video {
1084
1096
  min-width: -moz-fit-content;
1085
1097
  min-width: fit-content;
1086
1098
  }
1099
+ .max-w-\[200px\] {
1100
+ max-width: 200px;
1101
+ }
1087
1102
  .max-w-full {
1088
1103
  max-width: 100%;
1089
1104
  }
@@ -1224,6 +1239,9 @@ video {
1224
1239
  .grid-cols-\[auto\2c auto\2c 1fr\] {
1225
1240
  grid-template-columns: auto auto 1fr;
1226
1241
  }
1242
+ .grid-cols-\[auto_1fr_auto\] {
1243
+ grid-template-columns: auto 1fr auto;
1244
+ }
1227
1245
  .flex-row {
1228
1246
  flex-direction: row;
1229
1247
  }
@@ -1242,9 +1260,6 @@ video {
1242
1260
  .items-start {
1243
1261
  align-items: flex-start;
1244
1262
  }
1245
- .items-end {
1246
- align-items: flex-end;
1247
- }
1248
1263
  .items-center {
1249
1264
  align-items: center;
1250
1265
  }
@@ -1417,6 +1432,9 @@ video {
1417
1432
  .border-2 {
1418
1433
  border-width: 2px;
1419
1434
  }
1435
+ .border-\[1px\] {
1436
+ border-width: 1px;
1437
+ }
1420
1438
  .border-b {
1421
1439
  border-bottom-width: 1px;
1422
1440
  }
@@ -1429,15 +1447,16 @@ video {
1429
1447
  .border-t-\[0px\] {
1430
1448
  border-top-width: 0px;
1431
1449
  }
1432
- .border-t-\[1px\] {
1433
- border-top-width: 1px;
1434
- }
1435
1450
  .border-none {
1436
1451
  border-style: none;
1437
1452
  }
1438
1453
  .\!border-stateColors-error {
1439
1454
  border-color: var(--stateColors-error) !important;
1440
1455
  }
1456
+ .border-\[\#000\] {
1457
+ --tw-border-opacity: 1;
1458
+ border-color: rgb(0 0 0 / var(--tw-border-opacity));
1459
+ }
1441
1460
  .border-\[\#E3E3E3\] {
1442
1461
  --tw-border-opacity: 1;
1443
1462
  border-color: rgb(227 227 227 / var(--tw-border-opacity));
@@ -1481,6 +1500,10 @@ video {
1481
1500
  --tw-bg-opacity: 1;
1482
1501
  background-color: rgb(97 46 255 / var(--tw-bg-opacity));
1483
1502
  }
1503
+ .bg-\[\#FFFFFF\] {
1504
+ --tw-bg-opacity: 1;
1505
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
1506
+ }
1484
1507
  .bg-\[rgba\(255\2c 255\2c 255\2c 0\.5\)\] {
1485
1508
  background-color: rgba(255,255,255,0.5);
1486
1509
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.6.8",
3
+ "version": "0.6.10",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",