@tapcart/mobile-components 0.8.50 → 0.8.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/button.d.ts +6 -2
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +22 -9
- package/dist/components/ui/carousel.d.ts +9 -2
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +6 -6
- package/dist/components/ui/favorite.d.ts +5 -1
- package/dist/components/ui/favorite.d.ts.map +1 -1
- package/dist/components/ui/favorite.js +19 -10
- package/dist/components/ui/quantity-picker.d.ts.map +1 -1
- package/dist/components/ui/quantity-picker.js +17 -5
- package/dist/components/ui/radio-group.d.ts +5 -3
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group.js +5 -9
- package/dist/components/ui/selectors.d.ts +5 -11
- package/dist/components/ui/selectors.d.ts.map +1 -1
- package/dist/components/ui/selectors.js +19 -9
- package/package.json +1 -1
|
@@ -17,9 +17,13 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
17
17
|
iconStrokeColor?: string;
|
|
18
18
|
iconClassName?: string;
|
|
19
19
|
iconPosition?: "left" | "right";
|
|
20
|
-
onClick
|
|
20
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
21
|
+
disableHaptic?: boolean;
|
|
21
22
|
}
|
|
22
|
-
declare const Button:
|
|
23
|
+
declare const Button: {
|
|
24
|
+
({ className, labelClassName, labelStyle, variant, size, asChild, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl, iconClassName, onClick, disableHaptic, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
23
27
|
declare const getButtonProps: (buttonConfig: TextStyle & BackgroundAndPadding & {
|
|
24
28
|
iconColor: Color;
|
|
25
29
|
iconDetails: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"AAEA,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,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;IACvD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC9D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,QAAA,MAAM,MAAM;qMAkBT,WAAW;;CA0Fb,CAAA;AAID,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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
3
|
var t = {};
|
|
3
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -16,8 +17,8 @@ import { cva } from "class-variance-authority";
|
|
|
16
17
|
import { cn, getColor, getTextStyle, getBackgroundAndPaddingStyle, } from "../../lib/utils";
|
|
17
18
|
import { Icon } from "./icon";
|
|
18
19
|
import { Text } from "./text";
|
|
19
|
-
|
|
20
|
-
import {
|
|
20
|
+
// @ts-ignore -- webbridge-react is not typed (yet)
|
|
21
|
+
import { useActions } from "@tapcart/app-studio-sdk";
|
|
21
22
|
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
23
|
variants: {
|
|
23
24
|
size: {
|
|
@@ -80,11 +81,10 @@ const labelVariants = cva("truncate", {
|
|
|
80
81
|
variant: "default",
|
|
81
82
|
},
|
|
82
83
|
});
|
|
83
|
-
const Button =
|
|
84
|
-
var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl, iconClassName, onClick } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconStrokeColor", "iconPosition", "iconSize", "iconUrl", "iconClassName", "onClick"]);
|
|
85
|
-
const {
|
|
86
|
-
const
|
|
87
|
-
const Comp = asChild ? Slot : "button";
|
|
84
|
+
const Button = (_a) => {
|
|
85
|
+
var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl, iconClassName, onClick, disableHaptic = false } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconStrokeColor", "iconPosition", "iconSize", "iconUrl", "iconClassName", "onClick", "disableHaptic"]);
|
|
86
|
+
const { action } = useActions();
|
|
87
|
+
const Comp = asChild ? Slot : (onClick ? "button" : "div");
|
|
88
88
|
const IconButton = () => icon || iconUrl ? (_jsx(Icon, { name: icon, url: iconUrl, size: "sm", style: { color: iconColor } })) : null;
|
|
89
89
|
// TODO: need to refactor icon sizing. This isnt extensible.
|
|
90
90
|
const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: iconSize ? iconSize : "sm", className: cn(iconVariants({ variant }), {
|
|
@@ -92,15 +92,28 @@ const Button = React.forwardRef((_a, ref) => {
|
|
|
92
92
|
"ml-2": iconPosition === "right",
|
|
93
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, {}))] }));
|
|
94
94
|
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 } }) })));
|
|
95
|
+
const handleClick = onClick
|
|
96
|
+
? (e) => {
|
|
97
|
+
try {
|
|
98
|
+
onClick(e);
|
|
99
|
+
if (!disableHaptic) {
|
|
100
|
+
action("trigger/haptic");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error(error);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
: undefined;
|
|
95
108
|
return (_jsx(Comp, Object.assign({ className: cn(buttonVariants({ variant, size }), className, {
|
|
96
109
|
"pointer-events-none": loading,
|
|
97
110
|
"flex-row-reverse": (icon || iconUrl) && iconPosition === "right",
|
|
98
|
-
}),
|
|
111
|
+
}), onClick: handleClick }, props, { children: loading ? (_jsx(LoadingButton, {})) : typeof props.children === "object" &&
|
|
99
112
|
React.isValidElement(props.children) ? ( // if children are passed as a valid React element
|
|
100
113
|
props.children // render it
|
|
101
114
|
) : // otherwise use props
|
|
102
115
|
size === "icon" ? (_jsx(IconButton, {})) : (_jsx(BasicButton, {})) })));
|
|
103
|
-
}
|
|
116
|
+
};
|
|
104
117
|
Button.displayName = "Button";
|
|
105
118
|
const getButtonProps = (buttonConfig) => {
|
|
106
119
|
return {
|
|
@@ -8,6 +8,7 @@ type UseAutoplayType = {
|
|
|
8
8
|
};
|
|
9
9
|
import Autoplay from "embla-carousel-autoplay";
|
|
10
10
|
import Fade from "embla-carousel-fade";
|
|
11
|
+
import { Button } from "../../components/ui/button";
|
|
11
12
|
type CarouselApi = UseEmblaCarouselType[1];
|
|
12
13
|
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
13
14
|
type CarouselOptions = UseCarouselParameters[0];
|
|
@@ -25,8 +26,14 @@ declare const CarouselContent: React.ForwardRefExoticComponent<React.HTMLAttribu
|
|
|
25
26
|
showOverflow?: boolean | undefined;
|
|
26
27
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
27
28
|
declare const CarouselItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
-
declare const CarouselPrevious:
|
|
29
|
-
|
|
29
|
+
declare const CarouselPrevious: {
|
|
30
|
+
({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
displayName: string;
|
|
32
|
+
};
|
|
33
|
+
declare const CarouselNext: {
|
|
34
|
+
({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
30
37
|
type CarouselDotsProps = {
|
|
31
38
|
maxDots?: number;
|
|
32
39
|
dotColor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../components/ui/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAkB,MAAM,gBAAgB,CAAA;AAClE,KAAK,eAAe,GAAG;IACrB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,qBAAqB,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;CACtD,CAAA;AAED,OAAO,QAAQ,MAAM,yBAAyB,CAAA;AAC9C,OAAO,IAAI,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../components/ui/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAkB,MAAM,gBAAgB,CAAA;AAClE,KAAK,eAAe,GAAG;IACrB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,qBAAqB,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;CACtD,CAAA;AAED,OAAO,QAAQ,MAAM,yBAAyB,CAAA;AAC9C,OAAO,IAAI,MAAM,qBAAqB,CAAA;AAItC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAInD,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAA;AAC1C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAChE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAC/C,KAAK,cAAc,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAE9C,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAA;IACnC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;CAC/C,CAAA;AA0BD,QAAA,MAAM,QAAQ,6HAuIb,CAAA;AAGD,QAAA,MAAM,eAAe;;wCAsBnB,CAAA;AAGF,QAAA,MAAM,YAAY,6GAmBhB,CAAA;AAGF,QAAA,MAAM,gBAAgB;6CAKnB,MAAM,cAAc,CAAC,aAAa,CAAC;;CAsBrC,CAAA;AAGD,QAAA,MAAM,YAAY;6CAKf,MAAM,cAAc,CAAC,aAAa,CAAC;;CAsBrC,CAAA;AAGD,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;CACzB,CAAA;AAED,QAAA,MAAM,YAAY,iIA+DjB,CAAA;AA8DD,QAAA,MAAM,WAAW,aACL,iBAAiB,GAAG,SAAS,KACtC,eA2CF,CAAA;AAED,OAAO,EACL,KAAK,WAAW,EAChB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,WAAW,GACZ,CAAA"}
|
|
@@ -119,21 +119,21 @@ const CarouselItem = React.forwardRef((_a, ref) => {
|
|
|
119
119
|
return (_jsx("div", Object.assign({ ref: ref, role: "group", "aria-roledescription": "slide", className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className) }, props)));
|
|
120
120
|
});
|
|
121
121
|
CarouselItem.displayName = "CarouselItem";
|
|
122
|
-
const CarouselPrevious =
|
|
122
|
+
const CarouselPrevious = (_a) => {
|
|
123
123
|
var { className, variant = "outline", size = "icon" } = _a, props = __rest(_a, ["className", "variant", "size"]);
|
|
124
124
|
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
125
|
-
return (_jsxs(Button, Object.assign({
|
|
125
|
+
return (_jsxs(Button, Object.assign({ variant: variant, size: size, className: cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
|
|
126
126
|
? "-left-12 top-1/2 -translate-y-1/2"
|
|
127
127
|
: "-top-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollPrev }, props, { onClick: scrollPrev }, { children: [_jsx(ArrowLeft, { className: "h-4 w-4" }), _jsx("span", Object.assign({ className: "sr-only" }, { children: "Previous slide" }))] })));
|
|
128
|
-
}
|
|
128
|
+
};
|
|
129
129
|
CarouselPrevious.displayName = "CarouselPrevious";
|
|
130
|
-
const CarouselNext =
|
|
130
|
+
const CarouselNext = (_a) => {
|
|
131
131
|
var { className, variant = "outline", size = "icon" } = _a, props = __rest(_a, ["className", "variant", "size"]);
|
|
132
132
|
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
133
|
-
return (_jsxs(Button, Object.assign({
|
|
133
|
+
return (_jsxs(Button, Object.assign({ variant: variant, size: size, className: cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
|
|
134
134
|
? "-right-12 top-1/2 -translate-y-1/2"
|
|
135
135
|
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollNext }, props, { onClick: scrollNext }, { children: [_jsx(ArrowRight, { className: "h-4 w-4" }), _jsx("span", Object.assign({ className: "sr-only" }, { children: "Next slide" }))] })));
|
|
136
|
-
}
|
|
136
|
+
};
|
|
137
137
|
CarouselNext.displayName = "CarouselNext";
|
|
138
138
|
const CarouselDots = React.forwardRef((_a, ref) => {
|
|
139
139
|
var _b;
|
|
@@ -21,7 +21,11 @@ export interface FavoriteProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
21
21
|
borderSides?: BorderSides;
|
|
22
22
|
borderColorStyle?: string;
|
|
23
23
|
borderPadding?: Partial<Spacing>;
|
|
24
|
+
disableHaptic?: boolean;
|
|
24
25
|
}
|
|
25
|
-
declare const Favorite:
|
|
26
|
+
declare const Favorite: {
|
|
27
|
+
({ className, size, selected, onClick, iconUrl, showBackground, showBackgroundShadow, cornerRadius, layoutType, favoriteFillColor, disabledFillColor, backgroundColor, borderSides, borderColorStyle, borderPadding, disableHaptic, ...props }: FavoriteProps & VariantProps<typeof favoriteVariants>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
displayName: string;
|
|
29
|
+
};
|
|
26
30
|
export { Favorite, favoriteVariants };
|
|
27
31
|
//# sourceMappingURL=favorite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../components/ui/favorite.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../components/ui/favorite.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,OAAO,EAGL,OAAO,EAER,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,QAAA,MAAM,gBAAgB;;;;mFAuBpB,CAAA;AAEF,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,gBAAgB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EACP,sBAAsB,GACtB,WAAW,GACX,UAAU,GACV,aAAa,GACb,cAAc,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IAChC,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,QAAA,MAAM,QAAQ;oPAkBX,aAAa,GAAG,aAAa,uBAAuB,CAAC;;CA4CvD,CAAA;AAID,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
3
|
var t = {};
|
|
3
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -10,12 +11,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
11
|
return t;
|
|
11
12
|
};
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import * as React from "react";
|
|
14
14
|
import { cva } from "class-variance-authority";
|
|
15
|
+
// @ts-ignore -- webbridge-react is not typed (yet)
|
|
16
|
+
import { useActions } from "@tapcart/app-studio-sdk";
|
|
15
17
|
import { cn, getBorderSidesStyle, getPaddingStyle, } from "../../lib/utils";
|
|
16
18
|
import { Icon } from "./icon";
|
|
17
|
-
import { useTap } from "./tap";
|
|
18
|
-
import { useMergeRefs } from "../hooks/use-merge-refs";
|
|
19
19
|
const favoriteVariants = cva("flex p-2 gap-2 rounded-[4px]", {
|
|
20
20
|
variants: {
|
|
21
21
|
size: {
|
|
@@ -40,18 +40,27 @@ const favoriteVariants = cva("flex p-2 gap-2 rounded-[4px]", {
|
|
|
40
40
|
layoutType: "below-image-on-right",
|
|
41
41
|
},
|
|
42
42
|
});
|
|
43
|
-
const Favorite =
|
|
44
|
-
var { className, size = "small", selected = false, onClick, iconUrl = "https://storage.googleapis.com/tapcart-asset-uploads-prod/default-icon-options/Heart_1.svg", showBackground = false, showBackgroundShadow = false, cornerRadius = 4, layoutType = "below-image-on-right", favoriteFillColor = "#D91E18", disabledFillColor = "#727272", backgroundColor = "#FFFFFF", borderSides = ["all"], borderColorStyle = undefined, borderPadding = {} } = _a, props = __rest(_a, ["className", "size", "selected", "onClick", "iconUrl", "showBackground", "showBackgroundShadow", "cornerRadius", "layoutType", "favoriteFillColor", "disabledFillColor", "backgroundColor", "borderSides", "borderColorStyle", "borderPadding"]);
|
|
45
|
-
const {
|
|
46
|
-
const
|
|
47
|
-
|
|
43
|
+
const Favorite = (_a) => {
|
|
44
|
+
var { className, size = "small", selected = false, onClick, iconUrl = "https://storage.googleapis.com/tapcart-asset-uploads-prod/default-icon-options/Heart_1.svg", showBackground = false, showBackgroundShadow = false, cornerRadius = 4, layoutType = "below-image-on-right", favoriteFillColor = "#D91E18", disabledFillColor = "#727272", backgroundColor = "#FFFFFF", borderSides = ["all"], borderColorStyle = undefined, borderPadding = {}, disableHaptic = false } = _a, props = __rest(_a, ["className", "size", "selected", "onClick", "iconUrl", "showBackground", "showBackgroundShadow", "cornerRadius", "layoutType", "favoriteFillColor", "disabledFillColor", "backgroundColor", "borderSides", "borderColorStyle", "borderPadding", "disableHaptic"]);
|
|
45
|
+
const { action } = useActions();
|
|
46
|
+
const handleClick = (e) => {
|
|
47
|
+
try {
|
|
48
|
+
onClick(e);
|
|
49
|
+
if (!disableHaptic) {
|
|
50
|
+
action("trigger/haptic");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error(error);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return (_jsx("button", Object.assign({ onClick: onClick, className: cn("cursor-pointer active:opacity-70", favoriteVariants({
|
|
48
58
|
size,
|
|
49
59
|
showBackgroundShadow,
|
|
50
60
|
layoutType,
|
|
51
61
|
}), className), style: Object.assign({}, (showBackground && Object.assign(Object.assign({ borderRadius: `${cornerRadius}px`, backgroundColor: backgroundColor, borderColor: borderColorStyle }, getBorderSidesStyle(borderSides)), getPaddingStyle(borderPadding)))) }, props, { children: _jsx(Icon, { url: iconUrl, size: size === "small" ? "xs" : "sm", style: {
|
|
52
|
-
opacity: isPressed ? 0.7 : 1,
|
|
53
62
|
color: selected ? favoriteFillColor : disabledFillColor,
|
|
54
63
|
} }) })));
|
|
55
|
-
}
|
|
64
|
+
};
|
|
56
65
|
Favorite.displayName = "Favorite";
|
|
57
66
|
export { Favorite, favoriteVariants };
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,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;AA4FD,QAAA,MAAM,cAAc,4FA8HnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -14,11 +14,23 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import { cn } from "../../lib/utils";
|
|
16
16
|
import { Icon } from "./icon";
|
|
17
|
-
import { useTap } from "./tap";
|
|
18
17
|
import { LoadingDots } from "./loading-dots";
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
// @ts-ignore -- webbridge-react is not typed (yet)
|
|
19
|
+
import { useActions } from "@tapcart/app-studio-sdk";
|
|
20
|
+
const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled, disableHaptic = false, }) => {
|
|
21
21
|
const [isButtonPressed, setIsButtonPressed] = React.useState(false);
|
|
22
|
+
const { action } = useActions();
|
|
23
|
+
const handleClick = (e) => {
|
|
24
|
+
try {
|
|
25
|
+
handler(e);
|
|
26
|
+
if (!disableHaptic) {
|
|
27
|
+
action("trigger/haptic");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error(error);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
22
34
|
// Handle press state manually for the invisible button
|
|
23
35
|
const handleMouseDown = React.useCallback(() => {
|
|
24
36
|
if (!disabled)
|
|
@@ -30,8 +42,8 @@ const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled })
|
|
|
30
42
|
// Calculate the visual styles for the button
|
|
31
43
|
const visualButtonStyle = Object.assign({}, style);
|
|
32
44
|
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:
|
|
34
|
-
} }) })), _jsx("button", { onClick:
|
|
45
|
+
opacity: isButtonPressed ? 0.7 : 1,
|
|
46
|
+
} }) })), _jsx("button", { onClick: handleClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onTouchStart: handleMouseDown, onTouchEnd: handleMouseUp, onTouchCancel: handleMouseUp, className: "absolute cursor-pointer", style: {
|
|
35
47
|
top: "-8px",
|
|
36
48
|
right: "-8px",
|
|
37
49
|
bottom: "-8px",
|
|
@@ -10,12 +10,14 @@ export interface RadioGroupItemProps {
|
|
|
10
10
|
onSelect?: React.ReactEventHandler;
|
|
11
11
|
selected?: boolean;
|
|
12
12
|
value: string;
|
|
13
|
+
onClick?: React.ReactEventHandler;
|
|
13
14
|
}
|
|
14
15
|
declare const radiogroupItemVariants: (props?: ({
|
|
15
16
|
variant?: "default" | "selected" | "deactivated" | null | undefined;
|
|
16
17
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
17
|
-
declare const RadioGroupItem:
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
declare const RadioGroupItem: {
|
|
19
|
+
({ value, label, subtext, numberAmount, onSelect, onClick, selected, className, variant, ...props }: RadioGroupItemProps & VariantProps<typeof radiogroupItemVariants>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
displayName: string | undefined;
|
|
21
|
+
};
|
|
20
22
|
export { RadioGroup, RadioGroupItem, radiogroupItemVariants };
|
|
21
23
|
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../components/ui/radio-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../components/ui/radio-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,QAAA,MAAM,UAAU,+JAWd,CAAA;AAGF,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAA;CAClC;AAED,QAAA,MAAM,sBAAsB;;mFAc3B,CAAA;AAqCD,QAAA,MAAM,cAAc;yGAWjB,mBAAmB,GAAG,aAAa,6BAA6B,CAAC;;CAsEnE,CAAA;AAGD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,sBAAsB,EAAE,CAAA"}
|
|
@@ -17,8 +17,6 @@ import { cva } from "class-variance-authority";
|
|
|
17
17
|
import { cn } from "../../lib/utils";
|
|
18
18
|
import { Icon } from "./icon";
|
|
19
19
|
import { Text } from "./text";
|
|
20
|
-
import { useTap } from "./tap";
|
|
21
|
-
import { useMergeRefs } from "../hooks/use-merge-refs";
|
|
22
20
|
const RadioGroup = React.forwardRef((_a, ref) => {
|
|
23
21
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
24
22
|
return (_jsx(RadioGroupPrimitive.Root, Object.assign({ className: cn("grid gap-4", className) }, props, { ref: ref })));
|
|
@@ -36,12 +34,10 @@ const radiogroupItemVariants = cva("grid grid-cols-[auto,auto,1fr] gap-2 items-c
|
|
|
36
34
|
variant: "default",
|
|
37
35
|
},
|
|
38
36
|
});
|
|
39
|
-
const RadioGroupItemLabels = ({
|
|
40
|
-
const RadioGroupItem =
|
|
41
|
-
var { value, label = "", subtext, numberAmount = 0, onSelect = () => { }, onClick = () => { }, selected = false, className, variant = "default"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return (_jsx("div", Object.assign({ className: cn(radiogroupItemVariants({ variant }), className) }, { children: variant === "deactivated" ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "circle-off", size: "md", className: "text-stateColors-disabled" }), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] })) : (_jsx(RadioGroupPrimitive.Item, Object.assign({ ref: mergedRef, value: value, onSelect: onSelect, checked: selected, onClick: onTap(onClick), className: cn("flex items-center justify-center active:opacity-70", className) }, props, { children: selected || variant === "selected" ? (_jsxs("div", Object.assign({ className: "grid grid-cols-[auto,auto,1fr] gap-2 items-center group" }, { children: [_jsx(Icon, { name: "circle-dot-filled", size: "md", className: "text-coreColors-brandColorPrimary z-10" }), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] }))) : (_jsxs("div", Object.assign({ className: "grid grid-cols-[auto,auto,1fr] gap-2 items-center group" }, { children: [_jsxs("div", Object.assign({ className: "grid" }, { children: [_jsx(RadioGroupPrimitive.Indicator, Object.assign({ className: "flex items-center justify-center col-start-1 row-start-1" }, { children: _jsx(Icon, { name: "circle-dot-filled", size: "md", className: "text-coreColors-brandColorPrimary z-10" }) })), _jsx("div", Object.assign({ className: "flex items-center justify-center col-start-1 row-start-1" }, { children: _jsx(Icon, { name: "circle", size: "md", className: "col-start-1 row-start-1 text-coreColors-secondaryIcon items-center z-1" }) }))] })), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] }))) }))) })));
|
|
45
|
-
});
|
|
37
|
+
const RadioGroupItemLabels = ({ label, numberAmount, subtext, }) => (_jsxs("div", Object.assign({ className: "col-span-2" }, { children: [_jsxs("div", Object.assign({ className: "flex flex-row items-center" }, { children: [_jsx(Text, Object.assign({ type: "body-primary", className: "group-disabled:text-stateColors-disabled mr-2" }, { children: label })), numberAmount ? (_jsx(Text, Object.assign({ type: "body-primary", className: "text-textColors-secondaryColor group-disabled:text-stateColors-disabled" }, { children: `(${numberAmount})` }))) : null] })), subtext ? (_jsx(Text, Object.assign({ type: "body-secondary", className: "group-disabled:text-stateColors-disabled mt-1" }, { children: subtext }))) : null] })));
|
|
38
|
+
const RadioGroupItem = (_a) => {
|
|
39
|
+
var { value, label = "", subtext, numberAmount = 0, onSelect = () => { }, onClick = () => { }, selected = false, className, variant = "default" } = _a, props = __rest(_a, ["value", "label", "subtext", "numberAmount", "onSelect", "onClick", "selected", "className", "variant"]);
|
|
40
|
+
return (_jsx("div", Object.assign({ className: cn(radiogroupItemVariants({ variant }), className) }, { children: variant === "deactivated" ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "circle-off", size: "md", className: "text-stateColors-disabled" }), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext })] })) : (_jsx(RadioGroupPrimitive.Item, Object.assign({ value: value, onSelect: onSelect, checked: selected, onClick: onClick, className: cn("flex items-center justify-center active:opacity-70 cursor-pointer", className) }, props, { children: selected || variant === "selected" ? (_jsxs("div", Object.assign({ className: "grid grid-cols-[auto,auto,1fr] gap-2 items-center group" }, { children: [_jsx(Icon, { name: "circle-dot-filled", size: "md", className: "text-coreColors-brandColorPrimary z-10" }), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext })] }))) : (_jsxs("div", Object.assign({ className: "grid grid-cols-[auto,auto,1fr] gap-2 items-center group" }, { children: [_jsxs("div", Object.assign({ className: "grid" }, { children: [_jsx(RadioGroupPrimitive.Indicator, Object.assign({ className: "flex items-center justify-center col-start-1 row-start-1" }, { children: _jsx(Icon, { name: "circle-dot-filled", size: "md", className: "text-coreColors-brandColorPrimary z-10" }) })), _jsx("div", Object.assign({ className: "flex items-center justify-center col-start-1 row-start-1" }, { children: _jsx(Icon, { name: "circle", size: "md", className: "col-start-1 row-start-1 text-coreColors-secondaryIcon items-center z-1" }) }))] })), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext })] }))) }))) })));
|
|
41
|
+
};
|
|
46
42
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
47
43
|
export { RadioGroup, RadioGroupItem, radiogroupItemVariants };
|
|
@@ -11,18 +11,12 @@ type SelectorsProps = React.ComponentPropsWithoutRef<"button"> & VariantProps<ty
|
|
|
11
11
|
label?: string;
|
|
12
12
|
key?: string;
|
|
13
13
|
onSelect?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
14
|
+
disableHaptic?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare const Selectors: {
|
|
17
|
+
({ label, selected, disabled, disabledClick, className, onSelect, disableHaptic, children, ...props }: SelectorsProps & VariantProps<typeof selectorsVariants>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
displayName: string;
|
|
14
19
|
};
|
|
15
|
-
declare const Selectors: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
16
|
-
selected?: boolean | null | undefined;
|
|
17
|
-
disabled?: boolean | null | undefined;
|
|
18
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & {
|
|
19
|
-
disabled?: boolean | undefined;
|
|
20
|
-
disabledClick?: boolean | undefined;
|
|
21
|
-
selected?: boolean | undefined;
|
|
22
|
-
label?: string | undefined;
|
|
23
|
-
key?: string | undefined;
|
|
24
|
-
onSelect?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
25
|
-
} & React.RefAttributes<HTMLButtonElement>>;
|
|
26
20
|
type SelectorContainerProps = {
|
|
27
21
|
children: React.ReactElement<SelectorsProps>[] | React.ReactElement<SelectorsProps>;
|
|
28
22
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../components/ui/selectors.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,iBAAiB;;;mFAiBtB,CAAA;AACD,KAAK,cAAc,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAC5D,YAAY,CAAC,OAAO,iBAAiB,CAAC,GAAG;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../components/ui/selectors.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,iBAAiB;;;mFAiBtB,CAAA;AACD,KAAK,cAAc,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAC5D,YAAY,CAAC,OAAO,iBAAiB,CAAC,GAAG;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAA;IACjE,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAEH,QAAA,MAAM,SAAS;2GAUZ,cAAc,GAAG,aAAa,wBAAwB,CAAC;;CAqCzD,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EACJ,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,GACpC,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;IACtC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AACD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA+CvD,CAAA;AAID,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -15,8 +15,8 @@ import * as React from "react";
|
|
|
15
15
|
import { cva } from "class-variance-authority";
|
|
16
16
|
import { cn } from "../../lib/utils";
|
|
17
17
|
import { Text } from "./text";
|
|
18
|
-
|
|
19
|
-
import {
|
|
18
|
+
// @ts-ignore -- webbridge-react is not typed (yet)
|
|
19
|
+
import { useActions } from "@tapcart/app-studio-sdk";
|
|
20
20
|
const selectorsVariants = cva("flex py-2 px-4 whitespace-nowrap bg-coreColors-pageColor flex-row justify-center outline outline-1 rounded text-textColors-primaryColor outline-coreColors-dividingLines items-center", {
|
|
21
21
|
variants: {
|
|
22
22
|
selected: {
|
|
@@ -32,16 +32,26 @@ const selectorsVariants = cva("flex py-2 px-4 whitespace-nowrap bg-coreColors-pa
|
|
|
32
32
|
selected: false,
|
|
33
33
|
},
|
|
34
34
|
});
|
|
35
|
-
const Selectors =
|
|
36
|
-
var { label, selected, disabled = false, disabledClick = true, className, onSelect = () => { }, children } = _a, props = __rest(_a, ["label", "selected", "disabled", "disabledClick", "className", "onSelect", "children"]);
|
|
37
|
-
const {
|
|
38
|
-
const
|
|
39
|
-
|
|
35
|
+
const Selectors = (_a) => {
|
|
36
|
+
var { label, selected, disabled = false, disabledClick = true, className, onSelect = () => { }, disableHaptic = false, children } = _a, props = __rest(_a, ["label", "selected", "disabled", "disabledClick", "className", "onSelect", "disableHaptic", "children"]);
|
|
37
|
+
const { action } = useActions();
|
|
38
|
+
const handleClick = (e) => {
|
|
39
|
+
try {
|
|
40
|
+
onSelect(e);
|
|
41
|
+
if (!disableHaptic) {
|
|
42
|
+
action("trigger/haptic");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error(error);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return (_jsx("button", Object.assign({ disabled: disabled && disabledClick, onClick: handleClick, className: cn(selectorsVariants({
|
|
40
50
|
selected: selected,
|
|
41
51
|
className,
|
|
42
52
|
disabled,
|
|
43
|
-
}), "group", className)
|
|
44
|
-
}
|
|
53
|
+
}), "group", className) }, props, { children: children ? (children) : (_jsx(Text, Object.assign({ type: "body-primary", color: "text-textColors-primaryColor" }, { children: label }))) })));
|
|
54
|
+
};
|
|
45
55
|
const SelectorContainer = ({ children, containerRef, className, height, }) => {
|
|
46
56
|
const [showFadeLeft, setShowFadeLeft] = React.useState(false);
|
|
47
57
|
const [showFadeRight, setShowFadeRight] = React.useState(false);
|