@xipkg/button 3.0.9 → 3.1.2
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/package.json +4 -1
- package/Button.tsx +0 -77
- package/index.ts +0 -2
- package/tsconfig.json +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xipkg/button",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"main": "./dist/index.mjs",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"default": "./dist/index.mjs"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
13
16
|
"license": "MIT",
|
|
14
17
|
"scripts": {
|
|
15
18
|
"build": "tsup index.ts --format esm --dts",
|
package/Button.tsx
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
|
|
5
|
-
import { cn } from '@xipkg/utils';
|
|
6
|
-
|
|
7
|
-
const spinner =
|
|
8
|
-
'before:content-[""] before:animate-spin before:rounded-full before:border-gray-60 before:border-2 before:border-t-transparent disabled:opacity-100';
|
|
9
|
-
|
|
10
|
-
export const buttonVariants = cva(
|
|
11
|
-
'inline-flex border-box justify-center items-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
12
|
-
{
|
|
13
|
-
variants: {
|
|
14
|
-
variant: {
|
|
15
|
-
default:
|
|
16
|
-
'text-gray-0 dark:text-gray-100 bg-brand-80 hover:bg-brand-100 active:bg-brand-100 focus:bg-brand-100',
|
|
17
|
-
secondary:
|
|
18
|
-
'bg-gray-0 text-gray-100 border-gray-30 border-2 hover:bg-gray-5 active:bg-gray-5 focus:bg-gray-5',
|
|
19
|
-
ghost: 'text-gray-100 bg-gray-0 border-0 hover:bg-gray-5 active:bg-gray-5 focus:bg-gray-5',
|
|
20
|
-
error: 'bg-red-80 text-gray-0 hover:bg-red-100 active:bg-red-100 focus:bg-red-100',
|
|
21
|
-
success:
|
|
22
|
-
'bg-green-80 text-gray-0 hover:bg-green-100 active:bg-green-100 focus:bg-green-100',
|
|
23
|
-
'secondary-error':
|
|
24
|
-
'bg-red-0 text-red-100 border-2 border-red-100 disabled:text-red-20 disabled:border-red-20 hover:bg-red-20 active:bg-red-20 focus:bg-red-20',
|
|
25
|
-
'default-spinner': `bg-gray-10 ${spinner}`,
|
|
26
|
-
'secondary-spinner': `bg-gray-0 border-gray-30 border-2 ${spinner}`,
|
|
27
|
-
'ghost-spinner': `bg-gray-0 border-0 ${spinner}`,
|
|
28
|
-
},
|
|
29
|
-
size: {
|
|
30
|
-
l: 'h-14 rounded-xl px-8 text-[20px] pb-[3px]',
|
|
31
|
-
m: 'h-12 rounded-lg px-4 text-[16px] pb-[2px]',
|
|
32
|
-
s: 'h-8 rounded-md px-3 text-[14px] pb-[2px]',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
compoundVariants: [
|
|
36
|
-
{
|
|
37
|
-
variant: ['default-spinner', 'secondary-spinner', 'ghost-spinner'],
|
|
38
|
-
size: 'l',
|
|
39
|
-
class: 'before:w-8 before:h-8 p-0',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
variant: ['default-spinner', 'secondary-spinner', 'ghost-spinner'],
|
|
43
|
-
size: 'm',
|
|
44
|
-
class: 'before:w-6 before:h-6 p-0',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
variant: ['default-spinner', 'secondary-spinner', 'ghost-spinner'],
|
|
48
|
-
size: 's',
|
|
49
|
-
class: 'before:w-4 before:h-4 p-0',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
defaultVariants: {
|
|
53
|
-
variant: 'default',
|
|
54
|
-
size: 'm',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
export interface ButtonProps
|
|
60
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
61
|
-
VariantProps<typeof buttonVariants> {
|
|
62
|
-
asChild?: boolean;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
66
|
-
({ className, variant, size, asChild = false, children, ...props }, ref) => {
|
|
67
|
-
const Comp = asChild ? Slot : 'button';
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props}>
|
|
71
|
-
{children}
|
|
72
|
-
</Comp>
|
|
73
|
-
);
|
|
74
|
-
},
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
Button.displayName = 'Button';
|
package/index.ts
DELETED