@bouko/react 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import type { Component } from "../../core/types";
|
|
3
3
|
export type ButtonProps = Component & {
|
|
4
|
-
variant?: "primary" | "outline" | "ghost" | "secondary" | "error" | "future";
|
|
4
|
+
variant?: "accent" | "primary" | "outline" | "ghost" | "secondary" | "error" | "future";
|
|
5
5
|
size?: "xs" | "sm" | "md" | "lg";
|
|
6
6
|
icon?: ReactNode;
|
|
7
7
|
action?: () => void;
|
|
@@ -13,29 +13,29 @@ export function Button({ size, variant, style, icon, action, disabled, children
|
|
|
13
13
|
catch { }
|
|
14
14
|
setLoading(false);
|
|
15
15
|
};
|
|
16
|
-
if (variant === "future")
|
|
17
|
-
return (_jsxs("button", { className: "test-button", onClick: action, disabled: disabled || isLoading, children: [children, _jsx("div", { className: "test-button-border" })] }));
|
|
18
16
|
return (_jsxs("button", { className: cn(styles({ variant, size }), style), onClick: submit, disabled: disabled || isLoading, children: [icon && isLoading
|
|
19
17
|
? _jsx(Spinner, { className: "animate-spin" })
|
|
20
|
-
: icon, children] }));
|
|
18
|
+
: icon, children, variant === "future" && _jsx("div", { className: "test-button-border" })] }));
|
|
21
19
|
}
|
|
22
20
|
const styles = tv({
|
|
23
|
-
base: "flex justify-center items-center gap-2
|
|
24
|
-
defaultVariants: { size: "md" },
|
|
21
|
+
base: "relative flex justify-center items-center gap-2 border rounded font-medium duration-200 cursor-pointer disabled:cursor-not-allowed hover:brightness-110",
|
|
22
|
+
defaultVariants: { variant: "accent", size: "md" },
|
|
25
23
|
variants: {
|
|
26
24
|
variant: {
|
|
25
|
+
accent: "bg-accent border-accent-darker text-background-light",
|
|
27
26
|
primary: "bg-primary border-primary-dark",
|
|
28
27
|
outline: "bg-transparent border-accent hover:border-accent-dark text-primary",
|
|
29
28
|
ghost: "bg-transparent border-transparent text-primary hover:brightness-110",
|
|
30
29
|
secondary: "bg-background-dark dark:bg-background-light border-border-dark dark:border-border-light text-background-darker dark:text-primary",
|
|
31
|
-
error: "bg-error border-error-dark"
|
|
30
|
+
error: "bg-error border-error-dark",
|
|
31
|
+
future: "rounded-lg text-primary border-transparent backdrop-blur-sm test-button"
|
|
32
32
|
},
|
|
33
33
|
size: {
|
|
34
|
-
xs: "gap-1 px-2 py-1 text-xs
|
|
34
|
+
xs: "gap-1 px-2 py-1 text-xs",
|
|
35
35
|
circle: "px-2 py-2 text-xs rounded-full",
|
|
36
36
|
sm: "px-3 py-2 text-xs sm:text-sm",
|
|
37
|
-
md: "px-4 py-
|
|
38
|
-
lg: "px-5 py-
|
|
37
|
+
md: "px-4 py-2 text-sm",
|
|
38
|
+
lg: "px-5 py-2 text-base"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
});
|
package/dist/styles.css
CHANGED