@bouko/react 2.9.9 → 3.0.0
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";
|
|
4
|
+
variant?: "primary" | "outline" | "ghost" | "secondary" | "error" | "future";
|
|
5
5
|
size?: "xs" | "sm" | "md" | "lg";
|
|
6
6
|
icon?: ReactNode;
|
|
7
7
|
action?: () => void;
|
|
@@ -13,18 +13,20 @@ export function Button({ size, variant, style, icon, action, disabled, children
|
|
|
13
13
|
catch { }
|
|
14
14
|
setLoading(false);
|
|
15
15
|
};
|
|
16
|
-
|
|
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
|
+
return (_jsxs("button", { className: cn(styles({ variant, size }), style), onClick: submit, disabled: disabled || isLoading, children: [icon && isLoading
|
|
17
19
|
? _jsx(Spinner, { className: "animate-spin" })
|
|
18
20
|
: icon, children] }));
|
|
19
21
|
}
|
|
20
22
|
const styles = tv({
|
|
21
|
-
base: "flex justify-center items-center gap-2 bg-accent border border-accent-darker rounded font-
|
|
23
|
+
base: "flex justify-center items-center gap-2 bg-accent border border-accent-darker rounded font-medium text-background-light duration-200 cursor-pointer disabled:cursor-not-allowed hover:brightness-110",
|
|
22
24
|
defaultVariants: { size: "md" },
|
|
23
25
|
variants: {
|
|
24
26
|
variant: {
|
|
25
27
|
primary: "bg-primary border-primary-dark",
|
|
26
28
|
outline: "bg-transparent border-accent hover:border-accent-dark text-primary",
|
|
27
|
-
ghost: "bg-transparent border-transparent text-
|
|
29
|
+
ghost: "bg-transparent border-transparent text-primary hover:brightness-110",
|
|
28
30
|
secondary: "bg-background-dark dark:bg-background-light border-border-dark dark:border-border-light text-background-darker dark:text-primary",
|
|
29
31
|
error: "bg-error border-error-dark"
|
|
30
32
|
},
|
|
@@ -32,7 +34,7 @@ const styles = tv({
|
|
|
32
34
|
xs: "gap-1 px-2 py-1 text-xs font-medium",
|
|
33
35
|
circle: "px-2 py-2 text-xs rounded-full",
|
|
34
36
|
sm: "px-3 py-2 text-xs sm:text-sm",
|
|
35
|
-
md: "px-4 py-
|
|
37
|
+
md: "px-4 py-1 text-sm",
|
|
36
38
|
lg: "px-5 py-3 text-lg"
|
|
37
39
|
}
|
|
38
40
|
}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.test-button {
|
|
2
|
+
position: relative;
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
display: flex;
|
|
5
|
+
width: max-content;
|
|
6
|
+
padding: 8px 16px;
|
|
7
|
+
border-radius: 8px;
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
font-weight: 500;
|
|
10
|
+
line-height: 20px;
|
|
11
|
+
color: var(--color-primary);
|
|
12
|
+
backdrop-filter: blur(8px);
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.test-button::before {
|
|
17
|
+
content: "";
|
|
18
|
+
display: block;
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
background:
|
|
25
|
+
linear-gradient(
|
|
26
|
+
180deg,
|
|
27
|
+
rgba(20, 60, 140, 0) 0%,
|
|
28
|
+
rgba(20, 60, 140, .32) 100%
|
|
29
|
+
),
|
|
30
|
+
rgba(60, 120, 255, .12);
|
|
31
|
+
border-radius: inherit;
|
|
32
|
+
box-shadow: inset 0 0 12px #7fb0ff3d;
|
|
33
|
+
transition: .2s opacity cubic-bezier(.6, .6, 0, 1);
|
|
34
|
+
z-index: -1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.test-button::after {
|
|
38
|
+
content: "";
|
|
39
|
+
display: block;
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 100%;
|
|
45
|
+
background:
|
|
46
|
+
linear-gradient(
|
|
47
|
+
180deg,
|
|
48
|
+
rgba(20, 60, 140, 0) 0%,
|
|
49
|
+
rgba(20, 60, 140, .42) 100%
|
|
50
|
+
),
|
|
51
|
+
rgba(60, 120, 255, .24);
|
|
52
|
+
border-radius: inherit;
|
|
53
|
+
box-shadow: inset 0 0 12px #7fb0ff70;
|
|
54
|
+
transition: .2s opacity cubic-bezier(.6, .6, 0, 1);
|
|
55
|
+
opacity: 0;
|
|
56
|
+
z-index: -1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.test-button-border {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 0;
|
|
62
|
+
left: 0;
|
|
63
|
+
width: 100%;
|
|
64
|
+
height: 100%;
|
|
65
|
+
border-radius: inherit;
|
|
66
|
+
z-index: -1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.test-button-border::before {
|
|
70
|
+
content: "";
|
|
71
|
+
position: absolute;
|
|
72
|
+
inset: 0;
|
|
73
|
+
padding: 1px;
|
|
74
|
+
background:
|
|
75
|
+
linear-gradient(
|
|
76
|
+
180deg,
|
|
77
|
+
rgba(180, 210, 255, .24) 0%,
|
|
78
|
+
rgba(180, 210, 255, 0) 100%
|
|
79
|
+
),
|
|
80
|
+
linear-gradient(
|
|
81
|
+
0deg,
|
|
82
|
+
rgba(180, 210, 255, .32),
|
|
83
|
+
rgba(180, 210, 255, .32)
|
|
84
|
+
);
|
|
85
|
+
border-radius: inherit;
|
|
86
|
+
mask:
|
|
87
|
+
linear-gradient(#fff 0 0) content-box,
|
|
88
|
+
linear-gradient(#fff 0 0);
|
|
89
|
+
mask-composite: exclude;
|
|
90
|
+
pointer-events: none;
|
|
91
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
|
|
3
3
|
"name": "@bouko/react",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
@@ -16,10 +16,14 @@
|
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react-router-dom": "^7.12.0"
|
|
18
18
|
},
|
|
19
|
+
"exports": {
|
|
20
|
+
"./styles.css": "./dist/styles.css"
|
|
21
|
+
},
|
|
19
22
|
"engines": {},
|
|
20
23
|
|
|
21
24
|
"scripts": {
|
|
22
|
-
"build": "tsc"
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"postbuild": "node ./scripts/copy-styles.mjs"
|
|
23
27
|
},
|
|
24
28
|
|
|
25
29
|
"dependencies": {
|