@tapcart/mobile-components 0.6.9 → 0.6.11

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 +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;
@@ -12,8 +13,61 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
12
13
  labelClassName?: string;
13
14
  labelStyle?: React.CSSProperties | undefined;
14
15
  iconColor?: string;
16
+ iconStrokeColor?: string;
15
17
  iconPosition?: "left" | "right";
16
18
  }
17
19
  declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
18
- export { Button, buttonVariants };
20
+ declare const getButtonProps: (buttonConfig: TextStyle & BackgroundAndPadding & {
21
+ iconColor: Color;
22
+ iconDetails: {
23
+ url: string;
24
+ };
25
+ backgroundShadow: boolean;
26
+ }) => {
27
+ iconColor: string | undefined;
28
+ labelStyle: {
29
+ color: string | undefined;
30
+ fontFamily: string | undefined;
31
+ fontWeight: string | number | undefined;
32
+ fontSize: string | number;
33
+ textTransform: string;
34
+ textAlign: "left" | "right" | "center" | "justify";
35
+ textWrap: string;
36
+ };
37
+ iconUrl: string;
38
+ style: {
39
+ color: string | undefined;
40
+ boxShadow: string;
41
+ width: string;
42
+ backgroundColor: string | undefined;
43
+ borderColor: string | undefined;
44
+ borderTopWidth: string | undefined;
45
+ borderBottomWidth: string | undefined;
46
+ borderLeftWidth: string | undefined;
47
+ borderRightWidth: string | undefined;
48
+ borderStyle: string | undefined;
49
+ borderRadius: string | undefined;
50
+ paddingTop?: undefined;
51
+ paddingBottom?: undefined;
52
+ paddingLeft?: undefined;
53
+ paddingRight?: undefined;
54
+ } | {
55
+ color: string | undefined;
56
+ boxShadow: string;
57
+ width: string;
58
+ backgroundColor: string | undefined;
59
+ borderColor: string | undefined;
60
+ borderTopWidth: string | undefined;
61
+ borderBottomWidth: string | undefined;
62
+ borderLeftWidth: string | undefined;
63
+ borderRightWidth: string | undefined;
64
+ borderStyle: string | undefined;
65
+ borderRadius: string | undefined;
66
+ paddingTop: string | undefined;
67
+ paddingBottom: string | undefined;
68
+ paddingLeft: string | undefined;
69
+ paddingRight: string | undefined;
70
+ };
71
+ };
72
+ export { Button, buttonVariants, getButtonProps };
19
73
  //# 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,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,uFAqFX,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,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC;AAED,QAAA,MAAM,MAAM,uFAyFX,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, iconUrl } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconPosition", "iconUrl"]);
82
+ var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconStrokeColor, iconPosition, iconUrl } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconStrokeColor", "iconPosition", "iconUrl"]);
83
83
  const Comp = asChild ? Slot : "button";
84
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 }), { "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, {}))] }));
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
+ }), strokeColor: iconStrokeColor, 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 };
@@ -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 +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,GACpB,EAAE,UAAU,2CA8DZ;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,2CA+DZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
@@ -5,8 +5,9 @@ import { cn } from "../../lib/utils";
5
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
+ const priceStyles = (!isSale || !compareAtPrice) ? standardStyles : saleStyles;
8
9
  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, styles: standardStyles }), priceRanges && priceHigh !== undefined && _jsx(Spacer, {}), priceRanges && priceHigh !== undefined && (_jsx(Money, { price: priceHigh, currency: currency, locale: locale, styles: saleStyles }))] })) })));
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
11
  };
11
12
  const StrikeThroughPrice = () => {
12
13
  if (!isSale || !compareAtPrice)
@@ -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,4 +1,4 @@
1
- export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getPaddingStyle, 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";
@@ -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,eAAe,EACf,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,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,i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AA;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,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,5 +1,5 @@
1
1
  // component exports
2
- export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getPaddingStyle, 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";
@@ -47,18 +47,26 @@ 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
- paddingTop: string | undefined;
59
- paddingBottom: string | undefined;
60
- paddingLeft: string | undefined;
61
- paddingRight: string | undefined;
62
70
  backgroundColor: string | undefined;
63
71
  borderColor: string | undefined;
64
72
  borderTopWidth: string | undefined;
@@ -67,8 +75,19 @@ export declare const getBackgroundAndPaddingStyle: (backgroundAndPadding: Backgr
67
75
  borderRightWidth: string | undefined;
68
76
  borderStyle: string | undefined;
69
77
  borderRadius: string | undefined;
70
- };
71
- export declare const getPaddingStyle: (padding: Partial<Spacing>) => {
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;
72
91
  paddingTop: string | undefined;
73
92
  paddingBottom: string | undefined;
74
93
  paddingLeft: string | undefined;
@@ -85,7 +104,7 @@ export declare const getBackgroundAndSpacingStyle: (backgroundAndSpacing: Backgr
85
104
  backgroundColor: string;
86
105
  borderRadius: string;
87
106
  };
88
- type TextStyle = {
107
+ export type TextStyle = {
89
108
  font: {
90
109
  family: string;
91
110
  weight: number | string;
@@ -107,4 +126,24 @@ export declare const getTextStyle: (textStyle: Headline | Subtext) => {
107
126
  textAlign: "left" | "right" | "center" | "justify";
108
127
  textWrap: string;
109
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;
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;
110
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,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E,MAAM,GAAG,MAAM,CAAA;KACxB,CAAA;IACD,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;IACtD,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,QAAQ,GAAG,SAAS,CAAA;AACzB,KAAK,OAAO,GAAG,SAAS,CAAA;AAExB,eAAO,MAAM,YAAY,cAAe,QAAQ,GAAG,OAAO;;;;;;;;CAWzD,CAAA;AAED,eAAO,MAAM,oBAAoB,cACpB,MAAM;;;;;;;;;;;;;;;CAYlB,CAAA;AAQD,eAAO,MAAM,kBAAkB,cAAe,MAAM,WAGnD,CAAA;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAK5D;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAI7E;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAI7E"}
package/dist/lib/utils.js CHANGED
@@ -58,9 +58,20 @@ export const getVerticalAlignmentStyle = (alignmentAndSpacing) => {
58
58
  return {};
59
59
  }
60
60
  };
61
+ export const getPaddingStyle = (padding) => {
62
+ if (!padding)
63
+ return {};
64
+ return {
65
+ paddingTop: (padding === null || padding === void 0 ? void 0 : padding.top) !== undefined ? `${padding.top}px` : undefined,
66
+ paddingBottom: (padding === null || padding === void 0 ? void 0 : padding.bottom) !== undefined ? `${padding.bottom}px` : undefined,
67
+ paddingLeft: (padding === null || padding === void 0 ? void 0 : padding.left) !== undefined ? `${padding.left}px` : undefined,
68
+ paddingRight: (padding === null || padding === void 0 ? void 0 : padding.right) !== undefined ? `${padding.right}px` : undefined,
69
+ };
70
+ };
61
71
  export const getBackgroundAndPaddingStyle = (backgroundAndPadding) => {
62
- const { backgroundColor, borderSides, borderColor, cornerRadius, padding } = backgroundAndPadding;
63
- return Object.assign({ 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"))
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"))
64
75
  ? "1px"
65
76
  : undefined, borderBottomWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("bottom")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
66
77
  ? "1px"
@@ -68,15 +79,7 @@ export const getBackgroundAndPaddingStyle = (backgroundAndPadding) => {
68
79
  ? "1px"
69
80
  : undefined, borderRightWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("right")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
70
81
  ? "1px"
71
- : undefined, borderStyle: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.length) ? "solid" : undefined, borderRadius: cornerRadius !== undefined ? `${cornerRadius}px` : undefined }, getPaddingStyle(padding || {}));
72
- };
73
- export const getPaddingStyle = (padding) => {
74
- return {
75
- paddingTop: (padding === null || padding === void 0 ? void 0 : padding.top) !== undefined ? `${padding.top}px` : undefined,
76
- paddingBottom: (padding === null || padding === void 0 ? void 0 : padding.bottom) !== undefined ? `${padding.bottom}px` : undefined,
77
- paddingLeft: (padding === null || padding === void 0 ? void 0 : padding.left) !== undefined ? `${padding.left}px` : undefined,
78
- paddingRight: (padding === null || padding === void 0 ? void 0 : padding.right) !== undefined ? `${padding.right}px` : undefined,
79
- };
82
+ : undefined, borderStyle: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.length) ? "solid" : undefined, borderRadius: radius !== undefined ? `${radius}px` : undefined });
80
83
  };
81
84
  export const getBackgroundAndSpacingStyle = (backgroundAndSpacing) => {
82
85
  const { spacing, borderColor, backgroundColor, backgroundCorners } = backgroundAndSpacing;
@@ -99,4 +102,48 @@ export const getTextStyle = (textStyle) => {
99
102
  textWrap: wrapText ? "wrap" : "nowrap",
100
103
  };
101
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
+ }
102
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
  }
@@ -1015,6 +1024,9 @@ video {
1015
1024
  .w-10 {
1016
1025
  width: 2.5rem;
1017
1026
  }
1027
+ .w-12 {
1028
+ width: 3rem;
1029
+ }
1018
1030
  .w-14 {
1019
1031
  width: 3.5rem;
1020
1032
  }
@@ -1420,6 +1432,9 @@ video {
1420
1432
  .border-2 {
1421
1433
  border-width: 2px;
1422
1434
  }
1435
+ .border-\[1px\] {
1436
+ border-width: 1px;
1437
+ }
1423
1438
  .border-b {
1424
1439
  border-bottom-width: 1px;
1425
1440
  }
@@ -1438,6 +1453,10 @@ video {
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
  }
@@ -1657,6 +1680,9 @@ video {
1657
1680
  padding-top: 1rem;
1658
1681
  padding-bottom: 1rem;
1659
1682
  }
1683
+ .pb-1 {
1684
+ padding-bottom: 0.25rem;
1685
+ }
1660
1686
  .pb-2 {
1661
1687
  padding-bottom: 0.5rem;
1662
1688
  }
@@ -1982,6 +2008,11 @@ video {
1982
2008
  .opacity-50 {
1983
2009
  opacity: 0.5;
1984
2010
  }
2011
+ .shadow {
2012
+ --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
2013
+ --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
2014
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
2015
+ }
1985
2016
  .shadow-\[0_0_6px_0_rgba\(17\2c 17\2c 17\2c 0\.16\)\] {
1986
2017
  --tw-shadow: 0 0 6px 0 rgba(17,17,17,0.16);
1987
2018
  --tw-shadow-colored: 0 0 6px 0 var(--tw-shadow-color);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",