@rootui/button 0.0.1 → 0.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.
@@ -0,0 +1,98 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as tailwind_variants from 'tailwind-variants';
3
+ import { VariantProps } from 'tailwind-variants';
4
+ import { ButtonProps as ButtonProps$1 } from '@base-ui/react/button';
5
+
6
+ interface ButtonProps extends VariantProps<typeof button>, React.ComponentProps<'button'> {
7
+ }
8
+ declare const button: tailwind_variants.TVReturnType<{
9
+ isPending: {
10
+ false: string[];
11
+ true: string;
12
+ };
13
+ isDisabled: {
14
+ true: string;
15
+ };
16
+ size: {
17
+ sm: string;
18
+ md: string;
19
+ lg: string;
20
+ };
21
+ variant: {
22
+ filled: string;
23
+ outlined: string;
24
+ subtle: string;
25
+ transparent: string;
26
+ };
27
+ severity: {
28
+ neutral: string;
29
+ primary: string;
30
+ secondary: string;
31
+ info: string;
32
+ success: string;
33
+ warning: string;
34
+ danger: string;
35
+ magic: string;
36
+ };
37
+ }, undefined, "button-base w-fit relative whitespace-nowrap inline-flex items-center justify-center text-center motion-safe:transition-button shrink-0", {
38
+ isPending: {
39
+ false: string[];
40
+ true: string;
41
+ };
42
+ isDisabled: {
43
+ true: string;
44
+ };
45
+ size: {
46
+ sm: string;
47
+ md: string;
48
+ lg: string;
49
+ };
50
+ variant: {
51
+ filled: string;
52
+ outlined: string;
53
+ subtle: string;
54
+ transparent: string;
55
+ };
56
+ severity: {
57
+ neutral: string;
58
+ primary: string;
59
+ secondary: string;
60
+ info: string;
61
+ success: string;
62
+ warning: string;
63
+ danger: string;
64
+ magic: string;
65
+ };
66
+ }, undefined, tailwind_variants.TVReturnType<{
67
+ isPending: {
68
+ false: string[];
69
+ true: string;
70
+ };
71
+ isDisabled: {
72
+ true: string;
73
+ };
74
+ size: {
75
+ sm: string;
76
+ md: string;
77
+ lg: string;
78
+ };
79
+ variant: {
80
+ filled: string;
81
+ outlined: string;
82
+ subtle: string;
83
+ transparent: string;
84
+ };
85
+ severity: {
86
+ neutral: string;
87
+ primary: string;
88
+ secondary: string;
89
+ info: string;
90
+ success: string;
91
+ warning: string;
92
+ danger: string;
93
+ magic: string;
94
+ };
95
+ }, undefined, "button-base w-fit relative whitespace-nowrap inline-flex items-center justify-center text-center motion-safe:transition-button shrink-0", unknown, unknown, undefined>>;
96
+ declare function Button({ children, className, isPending, isDisabled, size, variant, severity, ...props }: ButtonProps & ButtonProps$1): react_jsx_runtime.JSX.Element;
97
+
98
+ export { Button };
@@ -0,0 +1 @@
1
+ export { Button } from '../chunk-R76X4JK7.js';
@@ -0,0 +1,4 @@
1
+ export { Button } from './Button.js';
2
+ import 'react/jsx-runtime';
3
+ import 'tailwind-variants';
4
+ import '@base-ui/react/button';
@@ -0,0 +1,2 @@
1
+ import '../chunk-ZXORUS7M.js';
2
+ export { Button } from '../chunk-R76X4JK7.js';
@@ -0,0 +1,166 @@
1
+ import { LoaderCircle } from 'lucide-react';
2
+ import { defaultConfig, tv } from 'tailwind-variants';
3
+ import { Button as Button$1 } from '@base-ui/react/button';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+
7
+ // src/base-ui/Button.tsx
8
+ defaultConfig.twMerge = false;
9
+ var button = tv({
10
+ base: "button-base w-fit relative whitespace-nowrap inline-flex items-center justify-center text-center motion-safe:transition-button shrink-0",
11
+ variants: {
12
+ isPending: {
13
+ false: [
14
+ "cursor-pointer",
15
+ "will-change-transform",
16
+ "motion-safe:hover:animate-button-hover",
17
+ "motion-safe:active:animate-button-active"
18
+ ],
19
+ true: "pointer-events-none opacity-80"
20
+ },
21
+ isDisabled: {
22
+ true: "pointer-events-none opacity-40"
23
+ },
24
+ size: {
25
+ sm: "button-size-sm",
26
+ md: "button-size-md",
27
+ lg: "button-size-lg"
28
+ },
29
+ variant: {
30
+ filled: "",
31
+ outlined: "",
32
+ subtle: "",
33
+ transparent: ""
34
+ },
35
+ severity: {
36
+ neutral: "",
37
+ primary: "",
38
+ secondary: "",
39
+ info: "",
40
+ success: "",
41
+ warning: "",
42
+ danger: "",
43
+ magic: ""
44
+ }
45
+ },
46
+ compoundVariants: [
47
+ {
48
+ variant: "filled",
49
+ severity: "primary",
50
+ className: "text-on-primary bg-primary hover:bg-primary-hover active:bg-primary-active"
51
+ },
52
+ {
53
+ variant: "subtle",
54
+ severity: "primary",
55
+ className: "text-on-primary-subtle bg-primary-subtle hover:bg-primary-subtle-hover active:bg-primary-subtle-active"
56
+ },
57
+ {
58
+ variant: "outlined",
59
+ severity: "primary",
60
+ className: "text-primary bg-transparent outline outline-primary hover:bg-primary/5 active:bg-primary/10"
61
+ },
62
+ {
63
+ variant: "transparent",
64
+ severity: "primary",
65
+ className: "text-primary bg-transparent hover:bg-primary/10 active:bg-primary/15"
66
+ },
67
+ {
68
+ variant: "filled",
69
+ severity: "neutral",
70
+ className: "text-on-neutral bg-neutral hover:bg-neutral-hover active:bg-neutral-active"
71
+ },
72
+ {
73
+ variant: "subtle",
74
+ severity: "neutral",
75
+ className: "text-on-neutral-subtle bg-neutral-subtle hover:bg-neutral-subtle-hover active:bg-neutral-subtle-active"
76
+ },
77
+ {
78
+ variant: "outlined",
79
+ severity: "neutral",
80
+ className: "text-neutral bg-transparent outline outline-default hover:bg-neutral/15 active:bg-neutral/20"
81
+ },
82
+ {
83
+ variant: "transparent",
84
+ severity: "neutral",
85
+ className: "text-neutral bg-transparent hover:bg-neutral/20 active:bg-neutral/30"
86
+ },
87
+ {
88
+ variant: "filled",
89
+ severity: "info",
90
+ className: "text-on-info bg-info hover:bg-info-hover active:bg-info-active"
91
+ },
92
+ {
93
+ variant: "subtle",
94
+ severity: "info",
95
+ className: "text-on-info-subtle bg-info-subtle hover:bg-info-subtle-hover active:bg-info-subtle-active"
96
+ },
97
+ {
98
+ variant: "outlined",
99
+ severity: "info",
100
+ className: "text-info bg-transparent outline outline-info hover:bg-info/5 active:bg-info/10"
101
+ },
102
+ {
103
+ variant: "transparent",
104
+ severity: "info",
105
+ className: "text-info bg-transparent hover:bg-info/10 active:bg-info/15"
106
+ },
107
+ {
108
+ variant: "filled",
109
+ severity: "success",
110
+ className: "text-on-success bg-success hover:bg-success-hover active:bg-success-active"
111
+ },
112
+ {
113
+ variant: "subtle",
114
+ severity: "success",
115
+ className: "text-on-success-subtle bg-success-subtle hover:bg-success-subtle-hover active:bg-success-subtle-active"
116
+ },
117
+ {
118
+ variant: "outlined",
119
+ severity: "success",
120
+ className: "text-success bg-transparent outline outline-success hover:bg-success/5 active:bg-success/10"
121
+ },
122
+ {
123
+ variant: "transparent",
124
+ severity: "success",
125
+ className: "text-success bg-transparent hover:bg-success/10 active:bg-success/15"
126
+ }
127
+ ],
128
+ defaultVariants: {
129
+ size: "md",
130
+ variant: "filled",
131
+ severity: "primary",
132
+ isDisabled: false,
133
+ isPending: false
134
+ }
135
+ });
136
+ function Button({
137
+ children,
138
+ className,
139
+ isPending = false,
140
+ isDisabled = false,
141
+ size,
142
+ variant,
143
+ severity,
144
+ ...props
145
+ }) {
146
+ return /* @__PURE__ */ jsx(
147
+ Button$1,
148
+ {
149
+ disabled: isDisabled,
150
+ ...props,
151
+ className: twMerge(button({
152
+ size,
153
+ variant,
154
+ severity,
155
+ isDisabled,
156
+ isPending
157
+ }), className),
158
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
159
+ /* @__PURE__ */ jsx("span", { className: isPending ? "text-transparent select-none" : "", children }),
160
+ isPending && /* @__PURE__ */ jsx("span", { className: "flex absolute inset-0 justify-center items-center", children: /* @__PURE__ */ jsx(LoaderCircle, { className: "animate-spin", size: 16 }) })
161
+ ] })
162
+ }
163
+ );
164
+ }
165
+
166
+ export { Button };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,4 @@
1
+ export { Button } from './base-ui/Button.js';
2
+ import 'react/jsx-runtime';
3
+ import 'tailwind-variants';
4
+ import '@base-ui/react/button';