@tapcart/mobile-components 0.8.60 → 0.8.61
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.
|
@@ -21,7 +21,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
21
21
|
disableHaptic?: boolean;
|
|
22
22
|
}
|
|
23
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;
|
|
24
|
+
({ className, labelClassName, labelStyle, variant, size, asChild, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl, iconClassName, onClick, type, disableHaptic, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
displayName: string;
|
|
26
26
|
};
|
|
27
27
|
declare const getButtonProps: (buttonConfig: TextStyle & BackgroundAndPadding & {
|
|
@@ -1 +1 @@
|
|
|
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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBJ,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -82,9 +82,11 @@ const labelVariants = cva("truncate", {
|
|
|
82
82
|
},
|
|
83
83
|
});
|
|
84
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"]);
|
|
85
|
+
var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl, iconClassName, onClick, type, disableHaptic = false } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconStrokeColor", "iconPosition", "iconSize", "iconUrl", "iconClassName", "onClick", "type", "disableHaptic"]);
|
|
86
86
|
const { action } = useActions();
|
|
87
|
-
const Comp = asChild
|
|
87
|
+
const Comp = asChild
|
|
88
|
+
? Slot
|
|
89
|
+
: (onClick || type ? "button" : "div");
|
|
88
90
|
const IconButton = () => icon || iconUrl ? (_jsx(Icon, { name: icon, url: iconUrl, size: "sm", style: { color: iconColor } })) : null;
|
|
89
91
|
// TODO: need to refactor icon sizing. This isnt extensible.
|
|
90
92
|
const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: iconSize ? iconSize : "sm", className: cn(iconVariants({ variant }), {
|
|
@@ -92,7 +94,7 @@ const Button = (_a) => {
|
|
|
92
94
|
"ml-2": iconPosition === "right",
|
|
93
95
|
}, 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
96
|
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
|
|
97
|
+
const handleClick = Comp === "button" && onClick
|
|
96
98
|
? (e) => {
|
|
97
99
|
try {
|
|
98
100
|
onClick(e);
|
|
@@ -108,7 +110,7 @@ const Button = (_a) => {
|
|
|
108
110
|
return (_jsx(Comp, Object.assign({ className: cn(buttonVariants({ variant, size }), className, {
|
|
109
111
|
"pointer-events-none": loading,
|
|
110
112
|
"flex-row-reverse": (icon || iconUrl) && iconPosition === "right",
|
|
111
|
-
}), onClick: handleClick }, props, { children: loading ? (_jsx(LoadingButton, {})) : typeof props.children === "object" &&
|
|
113
|
+
}), onClick: handleClick }, Object.assign({ type }, props), { children: loading ? (_jsx(LoadingButton, {})) : typeof props.children === "object" &&
|
|
112
114
|
React.isValidElement(props.children) ? ( // if children are passed as a valid React element
|
|
113
115
|
props.children // render it
|
|
114
116
|
) : // otherwise use props
|