@tapcart/mobile-components 0.7.67 → 0.7.68

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.
@@ -13,7 +13,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
13
13
  labelClassName?: string;
14
14
  labelStyle?: React.CSSProperties | undefined;
15
15
  iconColor?: string;
16
- iconSize?: string;
16
+ iconSize?: "xs" | "sm" | "md" | "lg" | null | undefined;
17
17
  iconStrokeColor?: string;
18
18
  iconClassName?: string;
19
19
  iconPosition?: "left" | "right";
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAGL,KAAK,EAEL,SAAS,EAET,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AAMxB,QAAA,MAAM,cAAc;;;mFAgCnB,CAAA;AAwCD,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAA;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,OAAO,EAAE,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IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAC9D;AAED,QAAA,MAAM,MAAM,uFA0GX,CAAA;AAGD,QAAA,MAAM,cAAc,iBACJ,SAAS,GACrB,oBAAoB,GAAG;IACrB,SAAS,EAAE,KAAK,CAAA;IAChB,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5B,gBAAgB,EAAE,OAAO,CAAA;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBJ,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,CAAA"}
@@ -18,14 +18,14 @@ import { Icon } from "./icon";
18
18
  import { Text } from "./text";
19
19
  import { useTap } from "./tap";
20
20
  import { useMergeRefs } from "../hooks/use-merge-refs";
21
- 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 cursor-pointer", {
21
+ 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 disabled:opacity-70 cursor-pointer", {
22
22
  variants: {
23
23
  size: {
24
- default: "py-3 px-4",
24
+ default: "py-2 px-3",
25
25
  sm: "px-3 rounded-md",
26
26
  lg: "px-8 rounded-md",
27
27
  icon: "p-3 w-auto",
28
- content: "py-3 px-4 w-auto",
28
+ content: "py-2 px-4 w-auto",
29
29
  },
30
30
  variant: {
31
31
  default: "bg-buttonColors-primaryFill border border-buttonColors-primaryOutlineColor shadow-primary",
@@ -86,7 +86,8 @@ const Button = React.forwardRef((_a, ref) => {
86
86
  const mergedRef = useMergeRefs(ref, tapRef);
87
87
  const Comp = asChild ? Slot : "button";
88
88
  const IconButton = () => icon || iconUrl ? (_jsx(Icon, { name: icon, url: iconUrl, size: "sm", style: { color: iconColor } })) : null;
89
- const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: iconSize || variant === "quickadd" ? "xs" : "sm", className: cn(iconVariants({ variant }), {
89
+ // TODO: need to refactor icon sizing. This isnt extensible.
90
+ const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: iconSize ? iconSize : "sm", className: cn(iconVariants({ variant }), {
90
91
  "mr-2": iconPosition === "left",
91
92
  "ml-2": iconPosition === "right",
92
93
  }, iconClassName), style: { color: iconColor } })) : null, !loading ? (_jsx(Text, Object.assign({ type: "body-primary", className: cn(labelVariants({ variant }), labelClassName), style: labelStyle }, { children: props.children }))) : (_jsx(_Fragment, {}))] }));
@@ -15,6 +15,7 @@ export interface QuantityPickerProps extends React.HTMLAttributes<HTMLDivElement
15
15
  inputStyle?: React.CSSProperties;
16
16
  buttonStyle?: React.CSSProperties;
17
17
  buttonCornerRadius?: number;
18
+ max?: number;
18
19
  }
19
20
  declare const QuantityPicker: React.ForwardRefExoticComponent<QuantityPickerProps & React.RefAttributes<HTMLDivElement>>;
20
21
  export { QuantityPicker };
@@ -1 +1 @@
1
- {"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,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,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AAa,CAAA;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAmCD,QAAA,MAAM,cAAc,4FAoGnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -22,7 +22,9 @@ const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled })
22
22
  } }) })));
23
23
  };
24
24
  const QuantityPicker = React.forwardRef((_a, ref) => {
25
- var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, isDecreaseDisabled, isIncreaseDisabled, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4 } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "isDecreaseDisabled", "isIncreaseDisabled", "value", "setValue", "inputStyle", "buttonStyle", "buttonCornerRadius"]);
25
+ var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, isDecreaseDisabled, isIncreaseDisabled, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4, max = 99 } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "isDecreaseDisabled", "isIncreaseDisabled", "value", "setValue", "inputStyle", "buttonStyle", "buttonCornerRadius", "max"]);
26
+ const [isFocused, setIsFocused] = React.useState(false);
27
+ const [localValue, setLocalValue] = React.useState(value);
26
28
  const leftButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderTopLeftRadius: buttonCornerRadius
27
29
  ? `${buttonCornerRadius}px`
28
30
  : undefined, borderBottomLeftRadius: buttonCornerRadius
@@ -34,7 +36,13 @@ const QuantityPicker = React.forwardRef((_a, ref) => {
34
36
  ? `${buttonCornerRadius}px`
35
37
  : undefined });
36
38
  const singleButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderRadius: buttonCornerRadius ? `${buttonCornerRadius}px` : undefined });
37
- return (_jsx("div", Object.assign({ className: cn("flex", 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 }), _jsx("input", { type: "text", pattern: "[0-9]*", value: value, onBlur: (e) => (e.target.value = value.toString()), onFocus: (e) => (e.target.value = ""), onChange: (e) => setValue(parseInt(e.target.value) || 0), 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: inputStyle }), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, style: rightButtonStyle, disabled: isIncreaseDisabled })] })) })));
39
+ return (_jsx("div", Object.assign({ className: cn("flex", 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 }), _jsx("input", { type: "number", pattern: "[0-9]*", max: max, value: isFocused ? localValue : value, onBlur: (e) => {
40
+ setIsFocused(false);
41
+ setValue(Math.min(parseInt(e.target.value) || 0, max));
42
+ }, onFocus: (e) => {
43
+ setIsFocused(true);
44
+ setLocalValue(value);
45
+ }, onChange: (e) => setLocalValue(Math.min(parseInt(e.target.value), max)), 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: inputStyle, inputMode: "numeric" }), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, style: rightButtonStyle, disabled: isIncreaseDisabled })] })) })));
38
46
  });
39
47
  QuantityPicker.displayName = "QuantityPicker";
40
48
  export { QuantityPicker };
@@ -13,6 +13,6 @@ declare const virtualGridVariants: (props?: ({
13
13
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
14
14
  export interface VirtualGridProps extends GridType, VariantProps<typeof virtualGridVariants> {
15
15
  }
16
- declare function VirtualGrid({ className, columns, children, overscan, estimatedHeight, isLoadingMore, loaderItem, ...props }: VirtualGridProps): import("react/jsx-runtime").JSX.Element;
16
+ declare function VirtualGrid({ className, columns, children, overscan, estimatedHeight, isLoadingMore, loaderItem, }: VirtualGridProps): import("react/jsx-runtime").JSX.Element;
17
17
  export { VirtualGrid, virtualGridVariants };
18
18
  //# sourceMappingURL=virtual-grid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/virtual-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,UAAU,QAAQ;IAChB,SAAS,EAAE,GAAG,CAAA;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,QAAA,MAAM,mBAAmB;;mFAYvB,CAAA;AAEF,MAAM,WAAW,gBACf,SAAQ,QAAQ,EACd,YAAY,CAAC,OAAO,mBAAmB,CAAC;CAAG;AAE/C,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAa,EACb,eAAqB,EACrB,aAAa,EACb,UAAU,EACV,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAkElB;AAED,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
1
+ {"version":3,"file":"virtual-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/virtual-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,UAAU,QAAQ;IAChB,SAAS,EAAE,GAAG,CAAA;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,QAAA,MAAM,mBAAmB;;mFAYvB,CAAA;AAEF,MAAM,WAAW,gBACf,SAAQ,QAAQ,EACd,YAAY,CAAC,OAAO,mBAAmB,CAAC;CAAG;AAE/C,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAY,EACZ,eAAqB,EACrB,aAAa,EACb,UAAU,GACX,EAAE,gBAAgB,2CA4ElB;AAED,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
@@ -1,18 +1,6 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import { jsx as _jsx } from "react/jsx-runtime";
13
2
  import * as React from "react";
14
3
  import { cva } from "class-variance-authority";
15
- import { Container } from "./container";
16
4
  import { useVirtual } from "react-virtual";
17
5
  import { cn } from "../../lib/utils";
18
6
  const virtualGridVariants = cva("grid", {
@@ -28,38 +16,47 @@ const virtualGridVariants = cva("grid", {
28
16
  columns: 2,
29
17
  },
30
18
  });
31
- function VirtualGrid(_a) {
32
- var { className, columns, children, overscan = 50, estimatedHeight = 375, isLoadingMore, loaderItem } = _a, props = __rest(_a, ["className", "columns", "children", "overscan", "estimatedHeight", "isLoadingMore", "loaderItem"]);
33
- const NUM_LOADER_ITEMS = 8;
19
+ function VirtualGrid({ className, columns, children, overscan = 4, estimatedHeight = 375, isLoadingMore, loaderItem, }) {
20
+ const NUM_LOADER_ITEMS = columns || 2;
34
21
  const col = columns || 2;
35
- const parentRef = React.useRef(null);
22
+ const parentRef = React.useRef(document.getElementById("tc-vgsl"));
36
23
  const childrenArray = React.Children.toArray(children);
37
24
  const rowCount = Math.ceil(childrenArray.length / col);
38
- const loaderRowCount = Math.ceil(NUM_LOADER_ITEMS / col);
39
- const totalItems = isLoadingMore ? rowCount + loaderRowCount : rowCount;
25
+ const totalItems = rowCount + (isLoadingMore ? 1 : 0);
40
26
  const rowVirtualizer = useVirtual({
41
27
  size: totalItems,
42
28
  parentRef,
43
29
  estimateSize: React.useCallback(() => estimatedHeight, []),
44
30
  overscan,
31
+ initialRect: { width: 0, height: estimatedHeight },
45
32
  });
46
- React.useEffect(() => {
47
- rowVirtualizer.measure();
48
- }, [childrenArray.length]);
49
- return (_jsx(Container, Object.assign({ style: { padding: "0" } }, { children: _jsx("div", Object.assign({ ref: parentRef }, { children: _jsx("div", Object.assign({ className: cn(virtualGridVariants({ columns }), className), style: {
50
- height: rowVirtualizer.totalSize,
51
- } }, props, { children: rowVirtualizer.virtualItems.map((virtualRow) => {
52
- const rowStartIndex = virtualRow.index * col;
53
- // Render loader as a full row if we're loading and this is the last virtual row
54
- if (isLoadingMore && virtualRow.index === rowCount - 1) {
55
- return (_jsx(React.Fragment, { children: Array.from({ length: NUM_LOADER_ITEMS }).map((_, index) => (_jsx("div", Object.assign({ ref: virtualRow.measureRef }, { children: loaderItem }), index))) }, "loader"));
56
- }
57
- return (_jsx(React.Fragment, { children: Array.from({ length: col }).map((_, colIndex) => {
58
- const index = rowStartIndex + colIndex;
59
- if (index >= childrenArray.length)
60
- return null;
61
- return (_jsx("div", Object.assign({ ref: virtualRow.measureRef }, { children: childrenArray[index] }), index));
62
- }) }, virtualRow.index));
63
- }) })) })) })));
33
+ return (_jsx("div", Object.assign({ style: {
34
+ width: "100%",
35
+ position: "relative",
36
+ willChange: "transform",
37
+ }, className: cn(virtualGridVariants({ columns }), className) }, { children: rowVirtualizer.virtualItems.map((virtualRow) => {
38
+ const rowStartIndex = virtualRow.index * col;
39
+ if (isLoadingMore && virtualRow.index === rowCount) {
40
+ return (_jsx("div", Object.assign({ style: {
41
+ position: "absolute",
42
+ top: 0,
43
+ left: 0,
44
+ width: "100%",
45
+ transform: `translateY(${virtualRow.start}px)`,
46
+ }, className: cn(virtualGridVariants({ columns })), ref: virtualRow.measureRef }, { children: Array.from({ length: NUM_LOADER_ITEMS }).map((_, index) => (_jsx("div", { children: loaderItem }, index))) }), `loader-row-${virtualRow.index}`));
47
+ }
48
+ return (_jsx("div", Object.assign({ className: cn(virtualGridVariants({ columns })), style: {
49
+ position: "absolute",
50
+ top: 0,
51
+ left: 0,
52
+ width: "100%",
53
+ transform: `translateY(${virtualRow.start}px)`,
54
+ }, ref: virtualRow.measureRef }, { children: Array.from({ length: col }).map((_, colIndex) => {
55
+ const index = rowStartIndex + colIndex;
56
+ if (index >= childrenArray.length)
57
+ return null;
58
+ return _jsx("div", { children: childrenArray[index] }, index);
59
+ }) }), `row-${virtualRow.index}`));
60
+ }) })));
64
61
  }
65
62
  export { VirtualGrid, virtualGridVariants };
@@ -7,6 +7,8 @@ export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElem
7
7
  onClick?: () => void;
8
8
  className?: string;
9
9
  imgUrl?: string;
10
+ imgRightBorderRadius?: number;
11
+ imgLeftBorderRadius?: number;
10
12
  aspectRatio?: string;
11
13
  objectFit?: "none" | "fit" | "fill" | "cover" | "contain" | "scale-down";
12
14
  isTrigger?: boolean;
@@ -14,7 +16,10 @@ export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElem
14
16
  nameStyle?: React.CSSProperties;
15
17
  amountStyle?: React.CSSProperties;
16
18
  }
17
- declare const PlaceholderIcon: () => import("react/jsx-runtime").JSX.Element;
19
+ declare const PlaceholderIcon: ({ rightBorderRadius, leftBorderRadius, }: {
20
+ rightBorderRadius?: number | undefined;
21
+ leftBorderRadius?: number | undefined;
22
+ }) => import("react/jsx-runtime").JSX.Element;
18
23
  declare const Wishlist: React.ForwardRefExoticComponent<WishlistProps & React.RefAttributes<HTMLButtonElement>>;
19
24
  export interface CreateNewProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
20
25
  selected?: boolean;
@@ -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,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,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Y,CAAA;IACxE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,YAAY,CAAA;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC/B,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAClC;AAED,QAAA,MAAM,eAAe;;;6CAmBpB,CAAA;AAED,QAAA,MAAM,QAAQ,yFA0Fb,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;CAC3B;AAED,QAAA,MAAM,SAAS,0FAwBd,CAAA;AAID,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAA"}
@@ -15,14 +15,27 @@ import * as React from "react";
15
15
  import { Text } from "./text";
16
16
  import { cn } from "../../lib/utils";
17
17
  import { Icon } from "./icon";
18
- const PlaceholderIcon = () => (_jsx("div", Object.assign({ className: "flex items-center justify-center h-10 w-10 bg-stateColors-skeleton rounded-sm", style: {
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
19
  flex: "0 1 auto",
20
+ borderTopRightRadius: `${rightBorderRadius}px`,
21
+ borderBottomRightRadius: `${rightBorderRadius}px`,
22
+ borderTopLeftRadius: `${leftBorderRadius}px`,
23
+ borderBottomLeftRadius: `${leftBorderRadius}px`,
20
24
  } }, { children: _jsx(Icon, { name: "heart-filled", size: "sm", color: "coreColors-secondaryIcon" }) })));
21
25
  const Wishlist = React.forwardRef((_a, ref) => {
22
- var { selected = false, onClick, className, name, amount, imgUrl, aspectRatio, objectFit, isTrigger, translations, nameStyle, amountStyle } = _a, props = __rest(_a, ["selected", "onClick", "className", "name", "amount", "imgUrl", "aspectRatio", "objectFit", "isTrigger", "translations", "nameStyle", "amountStyle"]);
23
- 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 rounded-sm overflow-hidden", style: {
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"]);
27
+ 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: {
24
28
  flex: "0 1 auto",
25
- } }, { children: _jsx("img", { alt: "wishlist-image", src: `${imgUrl}?width=40`, width: 40, height: 40, className: cn("rounded-sm w-full h-full", objectFit === "contain" ? "object-contain" : "object-cover") }) }))) : (_jsx(PlaceholderIcon, {})), _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-primary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: nameStyle }, { children: name })), !isTrigger && (_jsx(Text, Object.assign({ type: "body-secondary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: amountStyle }, { children: `${amount} ${amount !== 1
29
+ borderTopRightRadius: `${imgRightBorderRadius}px`,
30
+ borderBottomRightRadius: `${imgRightBorderRadius}px`,
31
+ borderTopLeftRadius: `${imgLeftBorderRadius}px`,
32
+ borderBottomLeftRadius: `${imgLeftBorderRadius}px`,
33
+ } }, { 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-primary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: nameStyle }, { children: name })), !isTrigger && (_jsx(Text, Object.assign({ type: "body-secondary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: amountStyle }, { children: `${amount} ${amount !== 1
26
39
  ? translations["checkout-summary-items"]
27
40
  : translations["checkout-summary-item"]}` })))] }))] })));
28
41
  });
package/dist/styles.css CHANGED
@@ -1730,6 +1730,9 @@ video {
1730
1730
  .pb-2 {
1731
1731
  padding-bottom: 0.5rem;
1732
1732
  }
1733
+ .pb-3 {
1734
+ padding-bottom: 0.75rem;
1735
+ }
1733
1736
  .pb-4 {
1734
1737
  padding-bottom: 1rem;
1735
1738
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.7.67",
3
+ "version": "0.7.68",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",