@tapcart/mobile-components 0.9.0 → 0.9.2

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.
Files changed (35) hide show
  1. package/dist/components/hooks/use-scroll-direction-safe.d.ts +8 -0
  2. package/dist/components/hooks/use-scroll-direction-safe.d.ts.map +1 -0
  3. package/dist/components/hooks/use-scroll-direction-safe.js +75 -0
  4. package/dist/components/hooks/use-transition-compat.d.ts +12 -0
  5. package/dist/components/hooks/use-transition-compat.d.ts.map +1 -0
  6. package/dist/components/hooks/use-transition-compat.js +42 -0
  7. package/dist/components/hooks/use-transition-compat.test.d.ts +2 -0
  8. package/dist/components/hooks/use-transition-compat.test.d.ts.map +1 -0
  9. package/dist/components/hooks/use-transition-compat.test.js +179 -0
  10. package/dist/components/hooks/use-transition-shim.d.ts +7 -0
  11. package/dist/components/hooks/use-transition-shim.d.ts.map +1 -0
  12. package/dist/components/hooks/use-transition-shim.js +25 -0
  13. package/dist/components/ui/quantity-picker copy.d.ts +25 -0
  14. package/dist/components/ui/quantity-picker copy.d.ts.map +1 -0
  15. package/dist/components/ui/quantity-picker copy.js +125 -0
  16. package/dist/components/ui/quantity-pickerDEP.d.ts +23 -0
  17. package/dist/components/ui/quantity-pickerDEP.d.ts.map +1 -0
  18. package/dist/components/ui/quantity-pickerDEP.js +88 -0
  19. package/dist/components/ui/quantity-pickerDEPRECATED.d.ts +23 -0
  20. package/dist/components/ui/quantity-pickerDEPRECATED.d.ts.map +1 -0
  21. package/dist/components/ui/quantity-pickerDEPRECATED.js +88 -0
  22. package/dist/components/ui/wishlist-select.d.ts +54 -0
  23. package/dist/components/ui/wishlist-select.d.ts.map +1 -1
  24. package/dist/components/ui/wishlist-select.js +88 -12
  25. package/dist/components/ui/wishlist.d.ts +29 -1
  26. package/dist/components/ui/wishlist.d.ts.map +1 -1
  27. package/dist/components/ui/wishlist.js +57 -20
  28. package/dist/lib/state.d.ts +3 -0
  29. package/dist/lib/state.d.ts.map +1 -0
  30. package/dist/lib/state.js +9 -0
  31. package/dist/lib/variablesCart.util.d.ts.map +1 -1
  32. package/dist/lib/variablesCart.util.js +6 -6
  33. package/dist/lib/variablesCart.util.test.js +12 -3
  34. package/dist/styles.css +3 -11
  35. package/package.json +1 -1
@@ -0,0 +1,23 @@
1
+ import * as React from "react";
2
+ export interface QuantityPickerProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ decreaseIconUrl: string;
4
+ increaseIconUrl: string;
5
+ deleteIconUrl: string;
6
+ isDeleteOnly: boolean;
7
+ iconColor: string;
8
+ onDecreaseClick: React.ReactEventHandler;
9
+ onIncreaseClick: React.ReactEventHandler;
10
+ isDecreaseDisabled?: boolean;
11
+ isIncreaseDisabled?: boolean;
12
+ loading?: boolean;
13
+ value: number;
14
+ setValue: (_: number) => void;
15
+ className?: string;
16
+ inputStyle?: React.CSSProperties;
17
+ buttonStyle?: React.CSSProperties;
18
+ buttonCornerRadius?: number;
19
+ max?: number;
20
+ }
21
+ declare const QuantityPicker: React.ForwardRefExoticComponent<QuantityPickerProps & React.RefAttributes<HTMLDivElement>>;
22
+ export { QuantityPicker };
23
+ //# sourceMappingURL=quantity-pickerDEPRECATED.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quantity-pickerDEPRECATED.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-pickerDEPRECATED.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AA0ED,QAAA,MAAM,cAAc,4FA8HnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import * as React from "react";
15
+ import { cn } from "../../lib/utils";
16
+ import { Icon } from "./icon";
17
+ import { useTap } from "./tap";
18
+ import { LoadingDots } from "./loading-dots";
19
+ const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled }) => {
20
+ const { onTap, isPressed, ref: tapRef } = useTap();
21
+ const [isButtonPressed, setIsButtonPressed] = React.useState(false);
22
+ // Handle press state manually for the invisible button
23
+ const handleMouseDown = React.useCallback(() => {
24
+ if (!disabled)
25
+ setIsButtonPressed(true);
26
+ }, [disabled]);
27
+ const handleMouseUp = React.useCallback(() => {
28
+ setIsButtonPressed(false);
29
+ }, []);
30
+ // Calculate the visual styles for the button
31
+ const visualButtonStyle = Object.assign({}, style);
32
+ return (_jsxs("div", Object.assign({ className: "relative h-7 w-7", style: { touchAction: "manipulation" } }, { children: [_jsx("div", Object.assign({ className: cn("absolute inset-0 flex items-center justify-center bg-stateColors-skeleton border border-coreColors-dividingLines", className, disabled ? "opacity-50" : ""), style: visualButtonStyle, "aria-hidden": "true" }, { children: _jsx(Icon, { url: iconUrl, size: "sm", strokeColor: iconColor, strokeWidth: 4, style: {
33
+ opacity: isPressed || isButtonPressed ? 0.7 : 1,
34
+ } }) })), _jsx("button", { onClick: onTap(handler), onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onTouchStart: handleMouseDown, onTouchEnd: handleMouseUp, onTouchCancel: handleMouseUp, ref: tapRef, className: "absolute cursor-pointer", style: {
35
+ top: "-8px",
36
+ right: "-8px",
37
+ bottom: "-8px",
38
+ left: "-8px",
39
+ opacity: 0,
40
+ zIndex: 10,
41
+ }, disabled: disabled, "aria-label": "Quantity button" })] })));
42
+ };
43
+ const QuantityPicker = React.forwardRef((_a, ref) => {
44
+ var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, isDecreaseDisabled, isIncreaseDisabled, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4, max = 99, loading = false } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "isDecreaseDisabled", "isIncreaseDisabled", "value", "setValue", "inputStyle", "buttonStyle", "buttonCornerRadius", "max", "loading"]);
45
+ const [isFocused, setIsFocused] = React.useState(false);
46
+ const [localValue, setLocalValue] = React.useState(value.toString());
47
+ React.useEffect(() => {
48
+ if (!isFocused) {
49
+ setLocalValue(value.toString());
50
+ }
51
+ }, [value, isFocused]);
52
+ const leftButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderTopLeftRadius: buttonCornerRadius
53
+ ? `${buttonCornerRadius}px`
54
+ : undefined, borderBottomLeftRadius: buttonCornerRadius
55
+ ? `${buttonCornerRadius}px`
56
+ : undefined });
57
+ const rightButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderTopRightRadius: buttonCornerRadius
58
+ ? `${buttonCornerRadius}px`
59
+ : undefined, borderBottomRightRadius: buttonCornerRadius
60
+ ? `${buttonCornerRadius}px`
61
+ : undefined });
62
+ const singleButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderRadius: buttonCornerRadius ? `${buttonCornerRadius}px` : undefined });
63
+ return (_jsxs("div", Object.assign({ className: cn("flex relative", className), ref: ref }, props, { children: [isDeleteOnly ? (_jsx(IconButton, { handler: onDecreaseClick, iconUrl: deleteIconUrl, iconColor: iconColor, style: singleButtonStyle })) : (_jsxs(_Fragment, { children: [_jsx(IconButton, { handler: onDecreaseClick, iconUrl: value === 1 ? deleteIconUrl : decreaseIconUrl, iconColor: iconColor, style: leftButtonStyle, disabled: isDecreaseDisabled || loading }), _jsx("input", { type: "number", pattern: "[0-9]*", disabled: loading, max: max, value: localValue, onBlur: (e) => {
64
+ setIsFocused(false);
65
+ const parsedValue = parseInt(e.target.value) || 0;
66
+ const clampedValue = Math.min(parsedValue, max);
67
+ setValue(clampedValue);
68
+ setLocalValue(clampedValue.toString());
69
+ }, onFocus: () => {
70
+ setIsFocused(true);
71
+ }, onChange: (e) => {
72
+ const inputValue = e.target.value;
73
+ if (inputValue === "") {
74
+ setLocalValue("");
75
+ }
76
+ else {
77
+ const parsedValue = parseInt(inputValue);
78
+ if (!isNaN(parsedValue)) {
79
+ const clampedValue = Math.min(parsedValue, max);
80
+ setLocalValue(clampedValue.toString());
81
+ }
82
+ }
83
+ }, className: "w-8 h-7 focus-visible:outline-none text-center bg-coreColors-inputBackground text-textColors-primaryColor border-t border-b border-coreColors-dividingLines", style: Object.assign(Object.assign({}, inputStyle), { borderRadius: (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.borderRadius)
84
+ ? `${inputStyle.borderRadius}px`
85
+ : 0 }), inputMode: "numeric" }), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, style: rightButtonStyle, disabled: isIncreaseDisabled || loading })] })), _jsx(LoadingDots, { show: loading, size: 1, iconColor: iconColor })] })));
86
+ });
87
+ QuantityPicker.displayName = "QuantityPicker";
88
+ export { QuantityPicker };
@@ -1,5 +1,53 @@
1
1
  import * as React from "react";
2
+ import { Color } from "../../lib/utils";
2
3
  import { Translations } from "app-studio-types";
4
+ interface WishlistSelectStyleConfig {
5
+ triggerBackgroundColor?: Color;
6
+ triggerBorderColor?: Color;
7
+ triggerCornerRadius?: number;
8
+ triggerPadding?: {
9
+ top: number;
10
+ bottom: number;
11
+ left: number;
12
+ right: number;
13
+ };
14
+ dropdownIcon?: {
15
+ url: string;
16
+ assetID?: string | null;
17
+ };
18
+ dropdownIconColor?: Color;
19
+ dropdownIconSize?: "xxs" | "xs" | "sm" | "md" | "lg" | null | undefined;
20
+ contentBackgroundColor?: Color;
21
+ contentBorderColor?: Color;
22
+ contentCornerRadius?: number;
23
+ contentMaxHeight?: number;
24
+ defaultImageIcon?: {
25
+ url: string;
26
+ assetID?: string | null;
27
+ };
28
+ defaultImageBackground?: Color;
29
+ defaultImageIconColor?: Color;
30
+ imageLeftBorderRadius?: number;
31
+ imageRightBorderRadius?: number;
32
+ itemHoverColor?: Color;
33
+ itemSelectedColor?: Color;
34
+ itemDividerColor?: Color;
35
+ nameTextColor?: Color;
36
+ nameFont?: {
37
+ family: string;
38
+ weight: string;
39
+ };
40
+ nameSize?: number;
41
+ countTextColor?: Color;
42
+ countFont?: {
43
+ family: string;
44
+ weight: string;
45
+ };
46
+ countSize?: number;
47
+ createNewTextColor?: Color;
48
+ createNewBackgroundColor?: Color;
49
+ createNewBorderColor?: Color;
50
+ }
3
51
  interface SelectProps<T> {
4
52
  children: React.ReactElement<{
5
53
  value: T;
@@ -7,6 +55,7 @@ interface SelectProps<T> {
7
55
  isTrigger?: boolean;
8
56
  isSelected?: boolean;
9
57
  translations: Translations;
58
+ styleConfig?: WishlistSelectStyleConfig;
10
59
  children: ({ isTrigger, translations, }: {
11
60
  isTrigger: boolean;
12
61
  translations: Translations;
@@ -17,27 +66,32 @@ interface SelectProps<T> {
17
66
  onOpenChange?: (isOpen: boolean) => void;
18
67
  onCreateNew?: () => void;
19
68
  translations: Translations;
69
+ styleConfig?: WishlistSelectStyleConfig;
20
70
  }
21
71
  declare const WishlistSelect: React.ForwardRefExoticComponent<SelectProps<unknown> & React.RefAttributes<HTMLDivElement>>;
22
72
  interface SelectTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
23
73
  isTrigger?: boolean;
24
74
  children: React.ReactNode;
75
+ styleConfig?: WishlistSelectStyleConfig;
25
76
  }
26
77
  declare const WishlistSelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<HTMLButtonElement>>;
27
78
  interface SelectContentProps {
28
79
  children: React.ReactNode;
29
80
  isOpen: boolean;
30
81
  className?: string;
82
+ styleConfig?: WishlistSelectStyleConfig;
31
83
  }
32
84
  declare const WishlistSelectContent: React.ForwardRefExoticComponent<SelectContentProps & React.RefAttributes<HTMLDivElement>>;
33
85
  interface SelectItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
34
86
  onSelect?: () => void;
35
87
  isSelected?: boolean;
36
88
  isTrigger?: boolean;
89
+ styleConfig?: WishlistSelectStyleConfig;
37
90
  children: React.ReactNode | (({ isTrigger }: {
38
91
  isTrigger: boolean;
39
92
  }) => React.ReactNode);
40
93
  }
41
94
  declare const WishlistSelectItem: React.ForwardRefExoticComponent<SelectItemProps & React.RefAttributes<HTMLDivElement>>;
42
95
  export { WishlistSelect, WishlistSelectTrigger, WishlistSelectContent, WishlistSelectItem, };
96
+ export type { WishlistSelectStyleConfig };
43
97
  //# sourceMappingURL=wishlist-select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wishlist-select.d.ts","sourceRoot":"","sources":["../../../components/ui/wishlist-select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,UAAU,WAAW,CAAC,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;QAC3B,KAAK,EAAE,CAAC,CAAA;QACR,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;QACrB,SAAS,CAAC,EAAE,OAAO,CAAA;QACnB,UAAU,CAAC,EAAE,OAAO,CAAA;QACpB,YAAY,EAAE,YAAY,CAAA;QAC1B,QAAQ,EAAE,CAAC,EACT,SAAS,EACT,YAAY,GACb,EAAE;YACD,SAAS,EAAE,OAAO,CAAA;YAClB,YAAY,EAAE,YAAY,CAAA;SAC3B,KAAK,KAAK,CAAC,SAAS,CAAA;KACtB,CAAC,EAAE,CAAA;IACJ,YAAY,CAAC,EAAE,CAAC,CAAA;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;IAC7B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACxC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED,QAAA,MAAM,cAAc,6FA0HnB,CAAA;AAID,UAAU,kBACR,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,QAAA,MAAM,qBAAqB,8FAkBzB,CAAA;AAGF,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,EAAE,O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U,CAAC;IAC9D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,yBAAyB,CAAA;IACvC,QAAQ,EACJ,KAAK,CAAC,SAAS,GACf,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;CACjE;AAED,QAAA,MAAM,kBAAkB,wFA8CvB,CAAA;AAGD,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,GACnB,CAAA;AAED,YAAY,EAAE,yBAAyB,EAAE,CAAA"}
@@ -13,9 +13,11 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import * as React from "react";
15
15
  import { ChevronDown } from "lucide-react";
16
- import { cn } from "../../lib/utils";
16
+ import { cn, getColor } from "../../lib/utils";
17
17
  import { CreateNew, Wishlist } from "./wishlist";
18
- const WishlistSelect = React.forwardRef(({ children, defaultValue, onChange, onOpenChange, onCreateNew, translations, }, ref) => {
18
+ import { Icon } from "./icon";
19
+ const WishlistSelect = React.forwardRef(({ children, defaultValue, onChange, onOpenChange, onCreateNew, translations, styleConfig, }, ref) => {
20
+ var _a, _b, _c, _d, _e;
19
21
  const [isOpen, setIsOpen] = React.useState(false);
20
22
  const [selectedValue, setSelectedValue] = React.useState(defaultValue);
21
23
  const triggerRef = React.useRef(null);
@@ -55,33 +57,107 @@ const WishlistSelect = React.forwardRef(({ children, defaultValue, onChange, onO
55
57
  };
56
58
  const selectedChild = React.Children.toArray(children).find((child) => React.isValidElement(child) &&
57
59
  child.props.value === selectedValue);
58
- return (_jsxs("div", Object.assign({ className: "relative", ref: ref }, { children: [_jsxs(WishlistSelectTrigger, Object.assign({ ref: triggerRef, onClick: handleToggle }, { children: [_jsx(WishlistSelectItem, Object.assign({ isTrigger: true }, { children: selectedChild ? (selectedChild.props.children({ isTrigger: true, translations })) : (_jsx(Wishlist, { name: translations["wishlist-multiple-create-text-field-placeholder"], isTrigger: true, translations: translations })) })), _jsx(ChevronDown, { className: cn("h-4 w-4 opacity-50 mr-4 transition-transform duration-200 ease-in-out", isOpen && "transform rotate-180") })] })), _jsxs(WishlistSelectContent, Object.assign({ isOpen: isOpen, ref: contentRef }, { children: [React.Children.map(children, (child) => React.isValidElement(child)
60
+ return (_jsxs("div", Object.assign({ className: "relative", ref: ref }, { children: [_jsxs(WishlistSelectTrigger, Object.assign({ ref: triggerRef, onClick: handleToggle, styleConfig: styleConfig }, { children: [_jsx(WishlistSelectItem, Object.assign({ isTrigger: true, styleConfig: styleConfig }, { children: selectedChild ? (selectedChild.props.children({ isTrigger: true, translations })) : (_jsx(Wishlist, { name: translations["wishlist-multiple-create-text-field-placeholder"], isTrigger: true, translations: translations, nameStyle: (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.nameTextColor)
61
+ ? {
62
+ color: getColor(styleConfig.nameTextColor),
63
+ fontFamily: ((_a = styleConfig.nameFont) === null || _a === void 0 ? void 0 : _a.family) !== "unset"
64
+ ? (_b = styleConfig.nameFont) === null || _b === void 0 ? void 0 : _b.family
65
+ : undefined,
66
+ fontWeight: ((_c = styleConfig.nameFont) === null || _c === void 0 ? void 0 : _c.weight) !== "unset"
67
+ ? (_d = styleConfig.nameFont) === null || _d === void 0 ? void 0 : _d.weight
68
+ : undefined,
69
+ fontSize: styleConfig.nameSize
70
+ ? `${styleConfig.nameSize}px`
71
+ : undefined,
72
+ }
73
+ : undefined })) })), ((_e = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.dropdownIcon) === null || _e === void 0 ? void 0 : _e.url) ? (_jsx(Icon, { url: styleConfig.dropdownIcon.url, size: styleConfig.dropdownIconSize || "md", color: getColor(styleConfig.dropdownIconColor) ||
74
+ "var(--coreColors-secondaryIcon)", className: cn("mr-4 transition-transform duration-200 ease-in-out opacity-50", isOpen && "transform rotate-180") })) : (_jsx(ChevronDown, { className: cn("h-4 w-4 opacity-50 mr-4 transition-transform duration-200 ease-in-out", isOpen && "transform rotate-180"), style: {
75
+ color: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.dropdownIconColor) || undefined,
76
+ width: (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.dropdownIconSize)
77
+ ? `${styleConfig.dropdownIconSize}px`
78
+ : undefined,
79
+ height: (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.dropdownIconSize)
80
+ ? `${styleConfig.dropdownIconSize}px`
81
+ : undefined,
82
+ } }))] })), _jsxs(WishlistSelectContent, Object.assign({ isOpen: isOpen, ref: contentRef, styleConfig: styleConfig }, { children: [React.Children.map(children, (child) => React.isValidElement(child)
59
83
  ? React.cloneElement(child, {
60
84
  onSelect: () => handleSelect(child.props.value),
61
85
  isSelected: child.props.value === selectedValue,
62
86
  translations,
87
+ styleConfig,
63
88
  }, child.props.children({ isTrigger: false, translations }))
64
- : child), _jsx("div", Object.assign({ className: "sticky bottom-0 bg-coreColors-inputBackground border-t border-coreColors-dividingLines" }, { children: _jsx(CreateNew, { onClick: handleCreateNew, translations: translations }) }))] }))] })));
89
+ : child), _jsx("div", Object.assign({ className: "sticky bottom-0 border-t", style: {
90
+ backgroundColor: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.createNewBackgroundColor) ||
91
+ "var(--coreColors-inputBackground)",
92
+ borderColor: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.createNewBorderColor) ||
93
+ "var(--coreColors-dividingLines)",
94
+ } }, { children: _jsx(CreateNew, { onClick: handleCreateNew, translations: translations, styleConfig: styleConfig }) }))] }))] })));
65
95
  });
66
96
  WishlistSelect.displayName = "WishlistSelect";
67
97
  const WishlistSelectTrigger = React.forwardRef((_a, ref) => {
68
- var { className, children, isTrigger = false } = _a, props = __rest(_a, ["className", "children", "isTrigger"]);
69
- return (_jsx("button", Object.assign({ ref: ref, className: cn("flex w-full items-center justify-between rounded-md border border-coreColors-brandColorPrimary bg-coreColors-inputBackground text-sm placeholder:text-coreColors-brandColorPrimary disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className), style: {
98
+ var _b, _c, _d, _e;
99
+ var { className, children, isTrigger = false, styleConfig } = _a, props = __rest(_a, ["className", "children", "isTrigger", "styleConfig"]);
100
+ return (_jsx("button", Object.assign({ ref: ref, className: cn("flex w-full items-center justify-between text-sm disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className), style: {
70
101
  WebkitTapHighlightColor: "transparent",
102
+ backgroundColor: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.triggerBackgroundColor) ||
103
+ "var(--coreColors-inputBackground)",
104
+ borderColor: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.triggerBorderColor) ||
105
+ "var(--coreColors-brandColorPrimary)",
106
+ borderWidth: "1px",
107
+ borderStyle: "solid",
108
+ borderRadius: (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.triggerCornerRadius)
109
+ ? `${styleConfig.triggerCornerRadius}px`
110
+ : "6px",
111
+ paddingTop: ((_b = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.triggerPadding) === null || _b === void 0 ? void 0 : _b.top)
112
+ ? `${styleConfig.triggerPadding.top}px`
113
+ : "8px",
114
+ paddingBottom: ((_c = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.triggerPadding) === null || _c === void 0 ? void 0 : _c.bottom)
115
+ ? `${styleConfig.triggerPadding.bottom}px`
116
+ : "8px",
117
+ paddingLeft: ((_d = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.triggerPadding) === null || _d === void 0 ? void 0 : _d.left)
118
+ ? `${styleConfig.triggerPadding.left}px`
119
+ : "12px",
120
+ paddingRight: ((_e = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.triggerPadding) === null || _e === void 0 ? void 0 : _e.right)
121
+ ? `${styleConfig.triggerPadding.right}px`
122
+ : "12px",
71
123
  } }, props, { children: children })));
72
124
  });
73
125
  WishlistSelectTrigger.displayName = "WishlistSelectTrigger";
74
126
  const WishlistSelectContent = React.forwardRef((_a, ref) => {
75
- var { className, children, isOpen } = _a, props = __rest(_a, ["className", "children", "isOpen"]);
76
- return (_jsx("div", Object.assign({ ref: ref, className: cn("mt-1 absolute z-50 w-full max-h-[200px] overflow-y-auto rounded-md bg-coreColors-inputBackground shadow-md border border-coreColors-brandColorPrimary", "transition-all duration-300 ease-in-out", isOpen
127
+ var { className, children, isOpen, styleConfig } = _a, props = __rest(_a, ["className", "children", "isOpen", "styleConfig"]);
128
+ return (_jsx("div", Object.assign({ ref: ref, className: cn("mt-1 absolute z-50 w-full overflow-y-auto shadow-md border", "transition-all duration-300 ease-in-out", isOpen
77
129
  ? "opacity-100 translate-y-0"
78
- : "opacity-0 translate-y-[-10px] pointer-events-none", className) }, props, { children: children })));
130
+ : "opacity-0 translate-y-[-10px] pointer-events-none", className), style: {
131
+ backgroundColor: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.contentBackgroundColor) ||
132
+ "var(--coreColors-inputBackground)",
133
+ borderColor: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.contentBorderColor) ||
134
+ "var(--coreColors-brandColorPrimary)",
135
+ borderRadius: (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.contentCornerRadius)
136
+ ? `${styleConfig.contentCornerRadius}px`
137
+ : "6px",
138
+ maxHeight: (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.contentMaxHeight)
139
+ ? `${styleConfig.contentMaxHeight}px`
140
+ : "200px",
141
+ } }, props, { children: children })));
79
142
  });
80
143
  WishlistSelectContent.displayName = "WishlistSelectContent";
81
144
  const WishlistSelectItem = React.forwardRef((_a, ref) => {
82
- var { className, children, onSelect, isSelected, isTrigger } = _a, props = __rest(_a, ["className", "children", "onSelect", "isSelected", "isTrigger"]);
83
- return (_jsx("div", Object.assign({ ref: ref, className: cn("relative flex w-full cursor-pointer select-none items-center text-sm outline-none", !isTrigger &&
84
- "border-b border-coreColors-dividingLines last:border-b-0", isSelected && "bg-stateColors-skeleton", className), onClick: onSelect }, props, { children: typeof children === "function"
145
+ var { className, children, onSelect, isSelected, isTrigger, styleConfig } = _a, props = __rest(_a, ["className", "children", "onSelect", "isSelected", "isTrigger", "styleConfig"]);
146
+ return (_jsx("div", Object.assign({ ref: ref, className: cn("relative flex w-full cursor-pointer select-none items-center text-sm outline-none", !isTrigger && "border-b last:border-b-0", className), style: {
147
+ backgroundColor: isSelected
148
+ ? getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.itemSelectedColor) ||
149
+ "var(--stateColors-skeleton)"
150
+ : undefined,
151
+ borderBottomColor: !isTrigger
152
+ ? getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.itemDividerColor) ||
153
+ "var(--coreColors-dividingLines)"
154
+ : undefined,
155
+ }, onClick: onSelect, role: "button", tabIndex: 0, onKeyDown: (e) => {
156
+ if (e.key === "Enter" || e.key === " ") {
157
+ e.preventDefault();
158
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect();
159
+ }
160
+ } }, props, { children: typeof children === "function"
85
161
  ? children({ isTrigger: isTrigger || false })
86
162
  : children })));
87
163
  });
@@ -1,5 +1,29 @@
1
1
  import * as React from "react";
2
+ import { Color } from "../../lib/utils";
2
3
  import { Translations } from "app-studio-types";
4
+ interface WishlistStyleConfig {
5
+ nameTextColor?: Color;
6
+ nameFont?: {
7
+ family: string;
8
+ weight: string;
9
+ };
10
+ nameSize?: number;
11
+ countTextColor?: Color;
12
+ countFont?: {
13
+ family: string;
14
+ weight: string;
15
+ };
16
+ countSize?: number;
17
+ createNewTextColor?: Color;
18
+ defaultImageIcon?: {
19
+ url: string;
20
+ assetID?: string | null;
21
+ };
22
+ defaultImageBackground?: Color;
23
+ defaultImageIconColor?: Color;
24
+ imageLeftBorderRadius?: number;
25
+ imageRightBorderRadius?: number;
26
+ }
3
27
  export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
28
  name?: string;
5
29
  amount?: number;
@@ -15,17 +39,21 @@ export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElem
15
39
  translations: Translations;
16
40
  nameStyle?: React.CSSProperties;
17
41
  amountStyle?: React.CSSProperties;
42
+ styleConfig?: WishlistStyleConfig;
18
43
  }
19
- declare const PlaceholderIcon: ({ rightBorderRadius, leftBorderRadius, }: {
44
+ declare const PlaceholderIcon: ({ rightBorderRadius, leftBorderRadius, styleConfig, }: {
20
45
  rightBorderRadius?: number | undefined;
21
46
  leftBorderRadius?: number | undefined;
47
+ styleConfig?: WishlistStyleConfig | undefined;
22
48
  }) => import("react/jsx-runtime").JSX.Element;
23
49
  declare const Wishlist: React.ForwardRefExoticComponent<WishlistProps & React.RefAttributes<HTMLButtonElement>>;
24
50
  export interface CreateNewProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
25
51
  selected?: boolean;
26
52
  className?: string;
27
53
  translations: Translations;
54
+ styleConfig?: WishlistStyleConfig;
28
55
  }
29
56
  declare const CreateNew: React.ForwardRefExoticComponent<CreateNewProps & React.RefAttributes<HTMLButtonElement>>;
30
57
  export { CreateNew, Wishlist, PlaceholderIcon };
58
+ export type { WishlistStyleConfig };
31
59
  //# sourceMappingURL=wishlist.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wishlist.d.ts","sourceRoot":"","sources":["../../../components/ui/wishlist.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,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aAAa,CAAA;IACjC,WAAW,CAAC,EAAE,mBAAmB,CAAA;CAClC;AAED,QAAA,MAAM,eAAe;;;;6CAsDpB,CAAA;AAED,QAAA,MAAM,QAAQ,yFAmIb,CAAA;AAID,MAAM,WAAW,cACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,YAAY,CAAA;IAC1B,WAAW,CAAC,EAAE,mBAAmB,CAAA;CAClC;AAED,QAAA,MAAM,SAAS,0FAuCd,CAAA;AAID,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAA;AAC/C,YAAY,EAAE,mBAAmB,EAAE,CAAA"}
@@ -13,36 +13,73 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  /* eslint-disable @next/next/no-img-element */
14
14
  import * as React from "react";
15
15
  import { Text } from "./text";
16
- import { cn } from "../../lib/utils";
16
+ import { cn, getColor } from "../../lib/utils";
17
17
  import { Icon } from "./icon";
18
- const PlaceholderIcon = ({ rightBorderRadius, leftBorderRadius, }) => (_jsx("div", Object.assign({ className: "flex items-center justify-center h-10 w-10 bg-stateColors-skeleton rounded-sm", style: {
19
- flex: "0 1 auto",
20
- borderTopRightRadius: `${rightBorderRadius}px`,
21
- borderBottomRightRadius: `${rightBorderRadius}px`,
22
- borderTopLeftRadius: `${leftBorderRadius}px`,
23
- borderBottomLeftRadius: `${leftBorderRadius}px`,
24
- } }, { children: _jsx(Icon, { name: "heart-filled", size: "sm", color: "coreColors-secondaryIcon" }) })));
18
+ const PlaceholderIcon = ({ rightBorderRadius, leftBorderRadius, styleConfig, }) => {
19
+ var _a;
20
+ // Use styleConfig border radius if available, otherwise fall back to the passed border radius props
21
+ const effectiveRightBorderRadius = (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.imageRightBorderRadius) !== undefined
22
+ ? styleConfig.imageRightBorderRadius
23
+ : rightBorderRadius !== null && rightBorderRadius !== void 0 ? rightBorderRadius : 4;
24
+ const effectiveLeftBorderRadius = (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.imageLeftBorderRadius) !== undefined
25
+ ? styleConfig.imageLeftBorderRadius
26
+ : leftBorderRadius !== null && leftBorderRadius !== void 0 ? leftBorderRadius : 0;
27
+ return (_jsx("div", Object.assign({ className: "flex items-center justify-center h-10 w-10", style: {
28
+ flex: "0 1 auto",
29
+ backgroundColor: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.defaultImageBackground) ||
30
+ "var(--stateColors-skeleton)",
31
+ borderTopRightRadius: `${effectiveRightBorderRadius}px`,
32
+ borderBottomRightRadius: `${effectiveRightBorderRadius}px`,
33
+ borderTopLeftRadius: `${effectiveLeftBorderRadius}px`,
34
+ borderBottomLeftRadius: `${effectiveLeftBorderRadius}px`,
35
+ } }, { children: ((_a = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.defaultImageIcon) === null || _a === void 0 ? void 0 : _a.url) ? (_jsx(Icon, { url: styleConfig.defaultImageIcon.url, size: "sm", color: getColor(styleConfig.defaultImageIconColor) ||
36
+ "var(--coreColors-secondaryIcon)" })) : (_jsx(Icon, { name: "heart-filled", size: "sm", color: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.defaultImageIconColor) ||
37
+ "coreColors-secondaryIcon" })) })));
38
+ };
25
39
  const Wishlist = React.forwardRef((_a, ref) => {
26
- var { selected = false, onClick, className, name, amount, imgUrl, imgRightBorderRadius = 4, imgLeftBorderRadius = 0, aspectRatio, objectFit, isTrigger, translations, nameStyle, amountStyle } = _a, props = __rest(_a, ["selected", "onClick", "className", "name", "amount", "imgUrl", "imgRightBorderRadius", "imgLeftBorderRadius", "aspectRatio", "objectFit", "isTrigger", "translations", "nameStyle", "amountStyle"]);
40
+ var _b, _c, _d, _e, _f, _g, _h, _j;
41
+ var { selected = false, onClick, className, name, amount, imgUrl, imgRightBorderRadius = 4, imgLeftBorderRadius = 0, aspectRatio, objectFit, isTrigger, translations, nameStyle, amountStyle, styleConfig } = _a, props = __rest(_a, ["selected", "onClick", "className", "name", "amount", "imgUrl", "imgRightBorderRadius", "imgLeftBorderRadius", "aspectRatio", "objectFit", "isTrigger", "translations", "nameStyle", "amountStyle", "styleConfig"]);
42
+ // Calculate effective border radius values (manifest takes priority)
43
+ const effectiveRightBorderRadius = (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.imageRightBorderRadius) !== undefined
44
+ ? styleConfig.imageRightBorderRadius
45
+ : imgRightBorderRadius !== null && imgRightBorderRadius !== void 0 ? imgRightBorderRadius : 4;
46
+ const effectiveLeftBorderRadius = (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.imageLeftBorderRadius) !== undefined
47
+ ? styleConfig.imageLeftBorderRadius
48
+ : imgLeftBorderRadius !== null && imgLeftBorderRadius !== void 0 ? imgLeftBorderRadius : 0;
27
49
  return (_jsxs("button", Object.assign({ className: cn("flex flex-row items-center px-4 py-2 w-full ", selected ? "bg-stateColors-skeleton" : "", className), ref: ref, onClick: onClick }, props, { children: [imgUrl ? (_jsx("div", Object.assign({ className: "h-10 w-10 border border-coreColors-dividingLines overflow-hidden", style: {
28
50
  flex: "0 1 auto",
29
- borderTopRightRadius: `${imgRightBorderRadius}px`,
30
- borderBottomRightRadius: `${imgRightBorderRadius}px`,
31
- borderTopLeftRadius: `${imgLeftBorderRadius}px`,
32
- borderBottomLeftRadius: `${imgLeftBorderRadius}px`,
51
+ borderTopRightRadius: `${effectiveRightBorderRadius}px`,
52
+ borderBottomRightRadius: `${effectiveRightBorderRadius}px`,
53
+ borderTopLeftRadius: `${effectiveLeftBorderRadius}px`,
54
+ borderBottomLeftRadius: `${effectiveLeftBorderRadius}px`,
33
55
  } }, { children: _jsx("img", { alt: "wishlist-image", src: `${imgUrl}?width=40`, width: 40, height: 40, className: cn("w-full h-full", objectFit === "contain" ? "object-contain" : "object-cover"), style: {
34
- borderTopRightRadius: `${imgRightBorderRadius}px`,
35
- borderBottomRightRadius: `${imgRightBorderRadius}px`,
36
- borderTopLeftRadius: `${imgLeftBorderRadius}px`,
37
- borderBottomLeftRadius: `${imgLeftBorderRadius}px`,
38
- } }) }))) : (_jsx(PlaceholderIcon, { rightBorderRadius: imgRightBorderRadius, leftBorderRadius: imgLeftBorderRadius })), _jsxs("div", Object.assign({ className: "flex flex-col flex-1 items-start mx-2 overflow-hidden" }, { children: [isTrigger && _jsx(Text, Object.assign({ type: "body-secondary" }, { children: "Wishlists" })), _jsx(Text, Object.assign({ type: "body-secondary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: nameStyle }, { children: name })), !isTrigger && (_jsx(Text, Object.assign({ type: "label", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: amountStyle }, { children: `${amount} ${amount !== 1
56
+ borderTopRightRadius: `${effectiveRightBorderRadius}px`,
57
+ borderBottomRightRadius: `${effectiveRightBorderRadius}px`,
58
+ borderTopLeftRadius: `${effectiveLeftBorderRadius}px`,
59
+ borderBottomLeftRadius: `${effectiveLeftBorderRadius}px`,
60
+ } }) }))) : (_jsx(PlaceholderIcon, { rightBorderRadius: imgRightBorderRadius, leftBorderRadius: imgLeftBorderRadius, styleConfig: styleConfig })), _jsxs("div", Object.assign({ className: "flex flex-col flex-1 items-start mx-2 overflow-hidden" }, { children: [isTrigger && _jsx(Text, Object.assign({ type: "body-secondary" }, { children: "Wishlists" })), _jsx(Text, Object.assign({ type: "body-secondary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: Object.assign(Object.assign({}, nameStyle), { color: (nameStyle === null || nameStyle === void 0 ? void 0 : nameStyle.color) || getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.nameTextColor), fontFamily: ((_b = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.nameFont) === null || _b === void 0 ? void 0 : _b.family) !== "unset"
61
+ ? (_c = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.nameFont) === null || _c === void 0 ? void 0 : _c.family
62
+ : nameStyle === null || nameStyle === void 0 ? void 0 : nameStyle.fontFamily, fontWeight: ((_d = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.nameFont) === null || _d === void 0 ? void 0 : _d.weight) !== "unset"
63
+ ? (_e = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.nameFont) === null || _e === void 0 ? void 0 : _e.weight
64
+ : nameStyle === null || nameStyle === void 0 ? void 0 : nameStyle.fontWeight, fontSize: (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.nameSize)
65
+ ? `${styleConfig.nameSize}px`
66
+ : nameStyle === null || nameStyle === void 0 ? void 0 : nameStyle.fontSize }) }, { children: name })), !isTrigger && (_jsx(Text, Object.assign({ type: "label", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: Object.assign(Object.assign({}, amountStyle), { color: (amountStyle === null || amountStyle === void 0 ? void 0 : amountStyle.color) || getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.countTextColor), fontFamily: ((_f = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.countFont) === null || _f === void 0 ? void 0 : _f.family) !== "unset"
67
+ ? (_g = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.countFont) === null || _g === void 0 ? void 0 : _g.family
68
+ : amountStyle === null || amountStyle === void 0 ? void 0 : amountStyle.fontFamily, fontWeight: ((_h = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.countFont) === null || _h === void 0 ? void 0 : _h.weight) !== "unset"
69
+ ? (_j = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.countFont) === null || _j === void 0 ? void 0 : _j.weight
70
+ : amountStyle === null || amountStyle === void 0 ? void 0 : amountStyle.fontWeight, fontSize: (styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.countSize)
71
+ ? `${styleConfig.countSize}px`
72
+ : amountStyle === null || amountStyle === void 0 ? void 0 : amountStyle.fontSize }) }, { children: `${amount} ${amount !== 1
39
73
  ? translations["checkout-summary-items"]
40
74
  : translations["checkout-summary-item"]}` })))] }))] })));
41
75
  });
42
76
  Wishlist.displayName = "Wishlist";
43
77
  const CreateNew = React.forwardRef((_a, ref) => {
44
- var { selected = false, onClick, className, translations } = _a, props = __rest(_a, ["selected", "onClick", "className", "translations"]);
45
- return (_jsx("button", Object.assign({ className: cn("flex flex-row items-center w-full relative py-2", "active:bg-black/10 transition-colors duration-150", className), ref: ref, onClick: onClick }, props, { children: _jsx("div", Object.assign({ className: "flex flex-col items-center justify-center m-auto space-y-1 overflow-hidden h-10" }, { children: _jsxs(Text, Object.assign({ type: "body-primary", className: "w-full text-center text-coreColors-brandColorPrimary" }, { children: ["+ ", translations["wishlist-dropdown-create-list-button"]] })) })) })));
78
+ var { selected = false, onClick, className, translations, styleConfig } = _a, props = __rest(_a, ["selected", "onClick", "className", "translations", "styleConfig"]);
79
+ return (_jsx("button", Object.assign({ className: cn("flex flex-row items-center w-full relative py-2", "active:bg-black/10 transition-colors duration-150", className), ref: ref, onClick: onClick }, props, { children: _jsx("div", Object.assign({ className: "flex flex-col items-center justify-center m-auto space-y-1 overflow-hidden h-10" }, { children: _jsxs(Text, Object.assign({ type: "body-primary", className: "w-full text-center", style: {
80
+ color: getColor(styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.createNewTextColor) ||
81
+ "var(--coreColors-brandColorPrimary)",
82
+ } }, { children: ["+ ", translations["wishlist-dropdown-create-list-button"]] })) })) })));
46
83
  });
47
84
  CreateNew.displayName = "CreateNew";
48
85
  export { CreateNew, Wishlist, PlaceholderIcon };
@@ -0,0 +1,3 @@
1
+ declare const useBearStore: any;
2
+ export { useBearStore };
3
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../lib/state.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,YAAY,KAYjB,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { create } from "zustand";
2
+ import { devtools, persist } from "zustand/middleware";
3
+ const useBearStore = create()(devtools(persist((set) => ({
4
+ bears: 0,
5
+ increase: (by) => set((state) => ({ bears: state.bears + by })),
6
+ }), {
7
+ name: "bear-storage",
8
+ })));
9
+ export { useBearStore };
@@ -1 +1 @@
1
- {"version":3,"file":"variablesCart.util.d.ts","sourceRoot":"","sources":["../../lib/variablesCart.util.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,6BAA6B,EAO9B,MAAM,kBAAkB,CAAA;AAEzB,eAAO,MAAM,2BAA2B;;cAM5B,MAAM;;0BAEI;YAChB,gBAAgB,CAAC,EAAE,MAAM,CAAA;YACzB,KAAK,EAAE,MAAM,CAAA;YACb,cAAc,CAAC,EAAE,MAAM,CAAA;SACxB,EAAE;;;;;;CAyBN,CAAA;AA4FD,eAAO,MAAM,6BAA6B,SAClC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAED,eAAO,MAAM,2BAA2B,SAChC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAoLD,MAAM,MAAM,uBAAuB,GAAG;IACpC,yBAAyB,EAAE,sBAAsB,EAAE,CAAA;IACnD,gBAAgB,EAAE,6BAA6B,EAAE,CAAA;IACjD,cAAc,EAAE,OAAO,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,iCAAiC,EAAE,uBAU/C,CAAA;AAED,eAAO,MAAM,8BAA8B,SACnC,SAAS,GAAG,IAAI,KACrB,uBAmCF,CAAA"}
1
+ {"version":3,"file":"variablesCart.util.d.ts","sourceRoot":"","sources":["../../lib/variablesCart.util.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,6BAA6B,EAO9B,MAAM,kBAAkB,CAAA;AAEzB,eAAO,MAAM,2BAA2B;;cAM5B,MAAM;;0BAEI;YAChB,gBAAgB,CAAC,EAAE,MAAM,CAAA;YACzB,KAAK,EAAE,MAAM,CAAA;YACb,cAAc,CAAC,EAAE,MAAM,CAAA;SACxB,EAAE;;;;;;CAyBN,CAAA;AA4FD,eAAO,MAAM,6BAA6B,SAClC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAED,eAAO,MAAM,2BAA2B,SAChC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAqLD,MAAM,MAAM,uBAAuB,GAAG;IACpC,yBAAyB,EAAE,sBAAsB,EAAE,CAAA;IACnD,gBAAgB,EAAE,6BAA6B,EAAE,CAAA;IACjD,cAAc,EAAE,OAAO,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,iCAAiC,EAAE,uBAU/C,CAAA;AAED,eAAO,MAAM,8BAA8B,SACnC,SAAS,GAAG,IAAI,KACrB,uBAmCF,CAAA"}
@@ -5,9 +5,9 @@ export const getSubscriptionPriceDetails = ({ totalAmount, quantity, sellingPlan
5
5
  const isSubscription = ((_a = sellingPlanAllocation === null || sellingPlanAllocation === void 0 ? void 0 : sellingPlanAllocation.priceAdjustments) === null || _a === void 0 ? void 0 : _a.length) > 0;
6
6
  if (isSubscription) {
7
7
  const { perDeliveryPrice, price, compareAtPrice } = sellingPlanAllocation.priceAdjustments[0];
8
- const effectivePrice = perDeliveryPrice || price;
9
- const subscriptionUnitPrice = perDeliveryPrice || 0;
10
- const effectiveCompareAtPrice = compareAtPrice * quantity || totalAmount || 0;
8
+ const effectivePrice = (perDeliveryPrice === null || perDeliveryPrice === void 0 ? void 0 : perDeliveryPrice.amount) || price.amount;
9
+ const subscriptionUnitPrice = (perDeliveryPrice === null || perDeliveryPrice === void 0 ? void 0 : perDeliveryPrice.amount) || 0;
10
+ const effectiveCompareAtPrice = (compareAtPrice === null || compareAtPrice === void 0 ? void 0 : compareAtPrice.amount) * quantity || totalAmount || 0;
11
11
  return {
12
12
  price: totalAmount,
13
13
  compareAtPrice: effectiveCompareAtPrice,
@@ -133,7 +133,7 @@ const getCompareAtPriceDifference = (cart) => {
133
133
  if (!cart)
134
134
  return 0;
135
135
  return (_a = cart === null || cart === void 0 ? void 0 : cart.items) === null || _a === void 0 ? void 0 : _a.reduce((acc, item) => {
136
- var _a, _b, _c, _d, _e, _f;
136
+ var _a, _b, _c, _d, _e, _f, _g, _h;
137
137
  /**
138
138
  * Regular price details
139
139
  */
@@ -144,8 +144,8 @@ const getCompareAtPriceDifference = (cart) => {
144
144
  */
145
145
  if (((_b = (_a = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _a === void 0 ? void 0 : _a.priceAdjustments) === null || _b === void 0 ? void 0 : _b.length) > 0) {
146
146
  itemPrice =
147
- ((_d = (_c = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _c === void 0 ? void 0 : _c.priceAdjustments[0]) === null || _d === void 0 ? void 0 : _d.perDeliveryPrice) ||
148
- ((_f = (_e = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _e === void 0 ? void 0 : _e.priceAdjustments[0]) === null || _f === void 0 ? void 0 : _f.price) ||
147
+ ((_e = (_d = (_c = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _c === void 0 ? void 0 : _c.priceAdjustments[0]) === null || _d === void 0 ? void 0 : _d.perDeliveryPrice) === null || _e === void 0 ? void 0 : _e.amount) ||
148
+ ((_h = (_g = (_f = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _f === void 0 ? void 0 : _f.priceAdjustments[0]) === null || _g === void 0 ? void 0 : _g.price) === null || _h === void 0 ? void 0 : _h.amount) ||
149
149
  0;
150
150
  const { compareAtPrice } = getSubscriptionPriceDetails({
151
151
  quantity: (item === null || item === void 0 ? void 0 : item.quantity) || 1,
@@ -574,9 +574,18 @@ describe("cart-provider.util", () => {
574
574
  name: "Ski wax subscription, billed and delivered weekly",
575
575
  priceAdjustments: [
576
576
  {
577
- compareAtPrice: 10,
578
- perDeliveryPrice: 8.5,
579
- price: 8.5,
577
+ compareAtPrice: {
578
+ amount: 10,
579
+ currencyCode: "USD",
580
+ },
581
+ perDeliveryPrice: {
582
+ amount: 8.5,
583
+ currencyCode: "USD",
584
+ },
585
+ price: {
586
+ amount: 8.5,
587
+ currencyCode: "USD",
588
+ },
580
589
  },
581
590
  ],
582
591
  },