@modul/mbui 0.0.18 → 0.0.19-beta-pv-53151-ff0ae8c2
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/dist/Alert/Alert.d.ts +2 -2
- package/dist/AlertDialog/AlertDialog.js +2 -2
- package/dist/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/Button/Button.d.ts +9 -7
- package/dist/Button/Button.js +80 -25
- package/dist/Button/Button.js.map +1 -1
- package/dist/Chip/Chip.d.ts +1 -1
- package/package.json +1 -1
- package/src/@/config/button.ts +34 -46
- package/src/Alert/Alert.tsx +2 -2
- package/src/AlertDialog/AlertDialog.tsx +2 -2
- package/src/Button/Button.tsx +107 -45
- package/src/assets/css/global.css +20 -21
package/dist/Alert/Alert.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
declare const Title: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
4
4
|
declare const Description: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
5
|
-
interface
|
|
5
|
+
interface IAlertComponents {
|
|
6
6
|
displayName: string;
|
|
7
7
|
Title: typeof Title;
|
|
8
8
|
Description: typeof Description;
|
|
@@ -14,5 +14,5 @@ interface IAlertProps {
|
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
}
|
|
16
16
|
declare type TAlertProps = IAlertProps & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
17
|
-
declare const Alert: React.FC<TAlertProps> &
|
|
17
|
+
declare const Alert: React.FC<TAlertProps> & IAlertComponents;
|
|
18
18
|
export { Alert };
|
|
@@ -33,10 +33,10 @@ const AlertDialogDescription = React.forwardRef(({ className, ...props }, ref) =
|
|
|
33
33
|
exports.AlertDialogDescription = AlertDialogDescription;
|
|
34
34
|
AlertDialogDescription.displayName =
|
|
35
35
|
AlertDialogPrimitive.Description.displayName;
|
|
36
|
-
const AlertDialogAction = React.forwardRef(({ className, ...props }, ref) => (React.createElement(AlertDialogPrimitive.Action, { ref: ref, className: (0, utils_1.cn)((0, Button_1.buttonVariants)({ variant: 'primary'
|
|
36
|
+
const AlertDialogAction = React.forwardRef(({ className, ...props }, ref) => (React.createElement(AlertDialogPrimitive.Action, { ref: ref, className: (0, utils_1.cn)((0, Button_1.buttonVariants)({ variant: 'primary' }), className), ...props })));
|
|
37
37
|
exports.AlertDialogAction = AlertDialogAction;
|
|
38
38
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
39
|
-
const AlertDialogCancel = React.forwardRef(({ className, ...props }, ref) => (React.createElement(AlertDialogPrimitive.Cancel, { ref: ref, className: (0, utils_1.cn)((0, Button_1.buttonVariants)({ variant: "outline"
|
|
39
|
+
const AlertDialogCancel = React.forwardRef(({ className, ...props }, ref) => (React.createElement(AlertDialogPrimitive.Cancel, { ref: ref, className: (0, utils_1.cn)((0, Button_1.buttonVariants)({ variant: "outline" }), className), ...props })));
|
|
40
40
|
exports.AlertDialogCancel = AlertDialogCancel;
|
|
41
41
|
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
42
42
|
//# sourceMappingURL=AlertDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialog.js","sourceRoot":"","sources":["../../src/AlertDialog/AlertDialog.tsx"],"names":[],"mappings":";;;;AAAA,0DAA8B;AAC9B,gGAAoE;AACpE,0CAAmC;AACnC,6CAAiD;AAEjD,MAAM,WAAW,GAAG,oBAAoB,CAAC,IAAI,CAAA;AAwH3C,kCAAW;AAtHb,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,OAAO,CAAA;AAyHrD,gDAAkB;AAvHpB,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,MAAM,CAAA;AAqHnD,8CAAiB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E,SAAS,EAAC,CAAC,EAAE,SAAS,CAAC,KAC1D,KAAK,GACT,CACH,CAAC,CAAA;AA4BA,8CAAiB;AA3BnB,iBAAiB,CAAC,WAAW,GAAG,oBAAoB,CAAC,MAAM,CAAC,WAAW,CAAA;AAEvE,MAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAGxC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,oBAAC,oBAAoB,CAAC,MAAM,IAC1B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,UAAE,EACX,IAAA,uBAAc,EAAC,EAAE,OAAO,EAAE,SAAS,EAAC,CAAC,EACrC,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAA;AAcA,8CAAiB;AAbnB,iBAAiB,CAAC,WAAW,GAAG,oBAAoB,CAAC,MAAM,CAAC,WAAW,CAAA"}
|
package/dist/Button/Button.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
2
|
+
interface IButtonProps {
|
|
3
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
4
|
+
className?: string;
|
|
5
|
+
icon?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const buttonVariants: ({ variant, className, icon }: IButtonProps) => string;
|
|
8
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
9
|
asChild?: boolean;
|
|
9
|
-
|
|
10
|
+
icon?: boolean;
|
|
11
|
+
variant?: string;
|
|
10
12
|
}
|
|
11
13
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
12
14
|
export { Button, buttonVariants };
|
package/dist/Button/Button.js
CHANGED
|
@@ -6,44 +6,99 @@ const React = (0, tslib_1.__importStar)(require("react"));
|
|
|
6
6
|
const react_slot_1 = require("@radix-ui/react-slot");
|
|
7
7
|
const class_variance_authority_1 = require("class-variance-authority");
|
|
8
8
|
const utils_1 = require("../@/lib/utils");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const buttonClasses = {
|
|
10
|
+
base: `
|
|
11
|
+
inline-flex
|
|
12
|
+
justify-center
|
|
13
|
+
items-center
|
|
14
|
+
border-[2px]
|
|
15
|
+
rounded-md
|
|
16
|
+
font-medium
|
|
17
|
+
leading-[1]
|
|
18
|
+
focus-visible:ring
|
|
19
|
+
focus-visible:outline-none
|
|
20
|
+
ring-offset-1
|
|
21
|
+
disabled:pointer-events-none
|
|
22
|
+
transition-colors
|
|
23
|
+
whitespace-nowrap
|
|
24
|
+
`,
|
|
25
|
+
primary: `
|
|
26
|
+
text-btn-primary
|
|
27
|
+
bg-btn-primary
|
|
28
|
+
border-btn-primary
|
|
29
|
+
hover:bg-btn-primary-hover
|
|
30
|
+
hover:border-btn-primary-hover
|
|
31
|
+
focus-visible:bg-btn-primary-focus
|
|
32
|
+
focus-visible:border-btn-primary-focus
|
|
33
|
+
active:bg-btn-primary-active
|
|
34
|
+
active:border-btn-primary-active
|
|
35
|
+
disabled:bg-btn-primary-disabled
|
|
36
|
+
disabled:border-btn-primary-disabled
|
|
37
|
+
`,
|
|
38
|
+
secondary: `
|
|
39
|
+
text-btn-secondary
|
|
40
|
+
bg-btn-secondary
|
|
41
|
+
border-btn-secondary
|
|
42
|
+
hover:bg-btn-secondary-hover
|
|
43
|
+
hover:border-btn-secondary-hover
|
|
44
|
+
focus-visible:bg-btn-secondary-focus
|
|
45
|
+
focus-visibleborder-btn-secondary-focus
|
|
46
|
+
active:bg-btn-secondary-active
|
|
47
|
+
active:border-btn-secondary-active
|
|
48
|
+
disabled:text-btn-secondary-disabled
|
|
49
|
+
`,
|
|
50
|
+
outline: `
|
|
51
|
+
text-btn-outline
|
|
52
|
+
border-[1px]
|
|
53
|
+
border-btn-outline
|
|
54
|
+
hover:border-btn-outline-hover
|
|
55
|
+
focus:border-btn-outline-focus
|
|
56
|
+
active:border-btn-outline-active
|
|
57
|
+
disabled:border-btn-outline-disabled
|
|
58
|
+
disabled:text-btn-outline-disabled
|
|
59
|
+
`,
|
|
60
|
+
ghost: `
|
|
61
|
+
text-btn-ghost
|
|
62
|
+
border-transparent
|
|
63
|
+
hover:text-btn-ghost-hover
|
|
64
|
+
focus-visible:text-btn-ghost-focus
|
|
65
|
+
active:text-btn-ghost-active
|
|
66
|
+
disabled:text-btn-ghost-disabled
|
|
67
|
+
`
|
|
68
|
+
};
|
|
69
|
+
const getPadings = (icon, variant) => {
|
|
70
|
+
return (0, utils_1.cn)(icon && 'p-[12px] aspect-square', icon && variant === 'outline' && 'p-[13px] aspect-square', !icon && 'px-[24px] py-[12px]', !icon && variant === 'outline' && 'px-[25px] py-[13px]');
|
|
71
|
+
};
|
|
72
|
+
const buttonVariants = ({ variant, className, icon }) => {
|
|
73
|
+
return (0, class_variance_authority_1.cva)(`${buttonClasses.base} ${getPadings(icon, variant)}`, {
|
|
74
|
+
variants: {
|
|
75
|
+
variant: {
|
|
76
|
+
primary: buttonClasses.primary,
|
|
77
|
+
secondary: buttonClasses.secondary,
|
|
78
|
+
outline: buttonClasses.outline,
|
|
79
|
+
ghost: buttonClasses.ghost,
|
|
80
|
+
},
|
|
18
81
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
md: 'h-[44px] px-[24px] text-[14px] leading-[1.08] rounded-md',
|
|
22
|
-
sm: 'h-[36px] px-[20px] text-[12px] leading-none rounded-[3px]',
|
|
23
|
-
xs: 'h-[28px] px-[12px] text-[11px] leading-none rounded-[2px]',
|
|
24
|
-
xxs: 'h-[20px] px-[8px] text-[9px] leading-none rounded-[2px]',
|
|
82
|
+
defaultVariants: {
|
|
83
|
+
variant: 'outline',
|
|
25
84
|
},
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
variant: 'primary',
|
|
29
|
-
size: 'md',
|
|
30
|
-
},
|
|
31
|
-
});
|
|
85
|
+
})({ variant, className });
|
|
86
|
+
};
|
|
32
87
|
exports.buttonVariants = buttonVariants;
|
|
33
88
|
const textVariants = (0, class_variance_authority_1.cva)('inline-flex whitespace-nowrap transition-colors focus-visible:outline-current disabled:opacity-[.24] rounded-[.25em] disabled:pointer-events-none', {
|
|
34
89
|
variants: {
|
|
35
90
|
variant: {
|
|
36
|
-
primary: 'text-primary hover:text-primary-hover focus
|
|
91
|
+
primary: 'text-primary hover:text-primary-hover focus-visibletext-primary-focus active:text-primary-active disabled:pointer-events-none',
|
|
37
92
|
},
|
|
38
93
|
},
|
|
39
94
|
defaultVariants: {
|
|
40
95
|
variant: 'primary',
|
|
41
96
|
},
|
|
42
97
|
});
|
|
43
|
-
const Button = React.forwardRef(({ className, variant,
|
|
44
|
-
const Comp = asChild ? react_slot_1.Slot :
|
|
98
|
+
const Button = React.forwardRef(({ className, variant, asChild = false, icon, ...props }, ref) => {
|
|
99
|
+
const Comp = asChild ? react_slot_1.Slot : 'button';
|
|
45
100
|
// @ts-ignore
|
|
46
|
-
const classes =
|
|
101
|
+
const classes = buttonVariants({ variant, className, icon });
|
|
47
102
|
return (React.createElement(Comp, { className: (0, utils_1.cn)(classes), ref: ref, ...props }));
|
|
48
103
|
});
|
|
49
104
|
exports.Button = Button;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":";;;;AAAA,0DAA8B;AAC9B,qDAA2C;AAC3C,uEAAiE;AACjE,0CAAmC;AAEnC,MAAM,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":";;;;AAAA,0DAA8B;AAC9B,qDAA2C;AAC3C,uEAAiE;AACjE,0CAAmC;AAEnC,MA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CAAC,UAAU,CAC9B,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAChE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAI,CAAC,CAAC,CAAC,QAAQ,CAAA;IACtC,aAAa;IACb,MAAM,OAAO,GAAG,cAAc,CAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACjE,OAAO,CACN,oBAAC,IAAI,IACJ,SAAS,EAAE,IAAA,UAAE,EAAC,OAAO,CAAC,EACtB,GAAG,EAAE,GAAG,KACJ,KAAK,GACR,CACF,CAAA;AACF,CAAC,CACD,CAAA;AAIQ,wBAAM;AAFf,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA"}
|
package/dist/Chip/Chip.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const chipVariants: (props?: {
|
|
4
|
-
variant?: "primary" | "secondary" | "
|
|
4
|
+
variant?: "primary" | "secondary" | "outline" | "ghost" | "success" | "primary-outline";
|
|
5
5
|
size?: "lg" | "md" | "sm" | "xs" | "xxs";
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) => string;
|
|
7
7
|
export interface IChipProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof chipVariants> {
|
package/package.json
CHANGED
package/src/@/config/button.ts
CHANGED
|
@@ -3,87 +3,75 @@ export default {
|
|
|
3
3
|
btn: {
|
|
4
4
|
primary: {
|
|
5
5
|
DEFAULT: 'var(--btn-primary)',
|
|
6
|
-
outline: {
|
|
7
|
-
DEFAULT: 'var(--btn-primary-bg)',
|
|
8
|
-
hover: 'var(--btn-primary-hover-bg)',
|
|
9
|
-
focus: 'var(var(--btn-primary-focus-bg)',
|
|
10
|
-
active: 'var(--btn-primary-active-bg)',
|
|
11
|
-
}
|
|
12
6
|
},
|
|
13
|
-
secondary:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
secondary: {
|
|
8
|
+
DEFAULT: 'var(--btn-secondary)',
|
|
9
|
+
disabled: 'var(--btn-secondary-disabled)',
|
|
10
|
+
},
|
|
11
|
+
ghost: {
|
|
17
12
|
DEFAULT: 'var(--btn-ghost)',
|
|
18
|
-
hover: 'var(--btn-ghost-hover
|
|
19
|
-
focus: 'var(
|
|
20
|
-
active: 'var(--btn-ghost-active
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
hover: 'var(--btn-ghost-hover)',
|
|
14
|
+
focus: 'var(--btn-ghost-focus)',
|
|
15
|
+
active: 'var(--btn-ghost-active)',
|
|
16
|
+
disabled: 'var(--btn-ghost-disabled)',
|
|
17
|
+
},
|
|
18
|
+
outline: {
|
|
19
|
+
DEFAULT: 'var(--btn-outline)',
|
|
20
|
+
disabled: 'var(--btn-outline-disabled)',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
23
|
},
|
|
24
24
|
backgroundColor: {
|
|
25
25
|
btn: {
|
|
26
26
|
primary: {
|
|
27
27
|
DEFAULT: 'var(--btn-primary-bg)',
|
|
28
28
|
hover: 'var(--btn-primary-hover-bg)',
|
|
29
|
-
focus: 'var(
|
|
29
|
+
focus: 'var(--btn-primary-focus-bg)',
|
|
30
30
|
active: 'var(--btn-primary-active-bg)',
|
|
31
|
+
disabled: 'var(--btn-primary-disabled-bg)',
|
|
31
32
|
},
|
|
32
33
|
secondary: {
|
|
33
34
|
DEFAULT: 'var(--btn-secondary-bg)',
|
|
34
35
|
hover: 'var(--btn-secondary-hover-bg)',
|
|
35
|
-
focus: 'var(
|
|
36
|
+
focus: 'var(--btn-secondary-focus-bg)',
|
|
36
37
|
active: 'var(--btn-secondary-active-bg)',
|
|
37
38
|
},
|
|
38
|
-
success: {
|
|
39
|
-
DEFAULT: 'var(--btn-success-bg)',
|
|
40
|
-
hover: 'var(--btn-success-hover-bg)',
|
|
41
|
-
focus: 'var(var(--btn-success-focus-bg)',
|
|
42
|
-
active: 'var(--btn-success-active-bg)',
|
|
43
|
-
},
|
|
44
39
|
ghost: {
|
|
45
40
|
DEFAULT: 'var(--btn-ghost-bg)',
|
|
46
41
|
hover: 'var(--btn-ghost-hover-bg)',
|
|
47
|
-
focus: 'var(
|
|
42
|
+
focus: 'var(--btn-ghost-focus-bg)',
|
|
48
43
|
active: 'var(--btn-ghost-active-bg)',
|
|
49
|
-
}
|
|
50
|
-
}
|
|
44
|
+
},
|
|
45
|
+
},
|
|
51
46
|
},
|
|
52
47
|
borderColor: {
|
|
53
48
|
btn: {
|
|
54
49
|
primary: {
|
|
55
50
|
DEFAULT: 'var(--btn-primary-bg)',
|
|
56
51
|
hover: 'var(--btn-primary-hover-bg)',
|
|
57
|
-
focus: 'var(
|
|
52
|
+
focus: 'var(--btn-primary-focus-bg)',
|
|
58
53
|
active: 'var(--btn-primary-active-bg)',
|
|
59
|
-
|
|
60
|
-
DEFAULT: 'var(--btn-primary-bg)',
|
|
61
|
-
hover: 'var(--btn-primary-hover-bg)',
|
|
62
|
-
focus: 'var(var(--btn-primary-focus-bg)',
|
|
63
|
-
active: 'var(--btn-primary-active-bg)',
|
|
64
|
-
}
|
|
54
|
+
disabled: 'var(--btn-primary-disabled-bg)',
|
|
65
55
|
},
|
|
66
56
|
secondary: {
|
|
67
57
|
DEFAULT: 'var(--btn-secondary-bg)',
|
|
68
58
|
hover: 'var(--btn-secondary-hover-bg)',
|
|
69
|
-
focus: 'var(
|
|
59
|
+
focus: 'var(--btn-secondary-focus-bg)',
|
|
70
60
|
active: 'var(--btn-secondary-active-bg)',
|
|
71
61
|
},
|
|
72
|
-
success: {
|
|
73
|
-
DEFAULT: 'var(--btn-success-bg)',
|
|
74
|
-
hover: 'var(--btn-success-hover-bg)',
|
|
75
|
-
focus: 'var(var(--btn-success-focus-bg)',
|
|
76
|
-
active: 'var(--btn-success-active-bg)',
|
|
77
|
-
},
|
|
78
62
|
ghost: {
|
|
79
63
|
DEFAULT: 'var(--btn-ghost-bg)',
|
|
80
64
|
hover: 'var(--btn-ghost-hover-bg)',
|
|
81
|
-
focus: 'var(
|
|
65
|
+
focus: 'var(--btn-ghost-focus-bg)',
|
|
82
66
|
active: 'var(--btn-ghost-active-bg)',
|
|
83
67
|
},
|
|
84
68
|
outline: {
|
|
85
|
-
DEFAULT: 'var(--btn-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
69
|
+
DEFAULT: 'var(--btn-outline-border)',
|
|
70
|
+
hover: 'var(--btn-outline-hover-border)',
|
|
71
|
+
focus: 'var(--btn-outline-focus-border)',
|
|
72
|
+
active: 'var(--btn-outline-active-border)',
|
|
73
|
+
disabled: 'var(--btn-outline-disabled-border)',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
}
|
package/src/Alert/Alert.tsx
CHANGED
|
@@ -40,7 +40,7 @@ const getClass = (variant, type): string => {
|
|
|
40
40
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
interface
|
|
43
|
+
interface IAlertComponents {
|
|
44
44
|
displayName: string;
|
|
45
45
|
Title: typeof Title;
|
|
46
46
|
Description: typeof Description;
|
|
@@ -55,7 +55,7 @@ interface IAlertProps {
|
|
|
55
55
|
|
|
56
56
|
type TAlertProps = IAlertProps & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
|
|
57
57
|
|
|
58
|
-
const Alert: React.FC<TAlertProps> &
|
|
58
|
+
const Alert: React.FC<TAlertProps> & IAlertComponents = ({ className, variant = 'info', type, children, ...props }) => {
|
|
59
59
|
return (
|
|
60
60
|
<div
|
|
61
61
|
className={cn('flex', getClass(variant, type))}
|
|
@@ -101,7 +101,7 @@ const AlertDialogAction = React.forwardRef<
|
|
|
101
101
|
>(({ className, ...props }, ref) => (
|
|
102
102
|
<AlertDialogPrimitive.Action
|
|
103
103
|
ref={ref}
|
|
104
|
-
className={cn(buttonVariants({variant: 'primary'
|
|
104
|
+
className={cn(buttonVariants({variant: 'primary'}), className)}
|
|
105
105
|
{...props}
|
|
106
106
|
/>
|
|
107
107
|
))
|
|
@@ -114,7 +114,7 @@ const AlertDialogCancel = React.forwardRef<
|
|
|
114
114
|
<AlertDialogPrimitive.Cancel
|
|
115
115
|
ref={ref}
|
|
116
116
|
className={cn(
|
|
117
|
-
buttonVariants({ variant: "outline"
|
|
117
|
+
buttonVariants({ variant: "outline"}),
|
|
118
118
|
className
|
|
119
119
|
)}
|
|
120
120
|
{...props}
|
package/src/Button/Button.tsx
CHANGED
|
@@ -3,43 +3,105 @@ import { Slot } from '@radix-ui/react-slot'
|
|
|
3
3
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
4
|
import { cn } from '../@/lib/utils'
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
const buttonClasses = {
|
|
7
|
+
base: `
|
|
8
|
+
inline-flex
|
|
9
|
+
justify-center
|
|
10
|
+
items-center
|
|
11
|
+
border-[2px]
|
|
12
|
+
rounded-md
|
|
13
|
+
font-medium
|
|
14
|
+
leading-[1]
|
|
15
|
+
focus-visible:ring
|
|
16
|
+
focus-visible:outline-none
|
|
17
|
+
ring-offset-1
|
|
18
|
+
disabled:pointer-events-none
|
|
19
|
+
transition-colors
|
|
20
|
+
whitespace-nowrap
|
|
21
|
+
`,
|
|
22
|
+
primary: `
|
|
23
|
+
text-btn-primary
|
|
24
|
+
bg-btn-primary
|
|
25
|
+
border-btn-primary
|
|
26
|
+
hover:bg-btn-primary-hover
|
|
27
|
+
hover:border-btn-primary-hover
|
|
28
|
+
focus-visible:bg-btn-primary-focus
|
|
29
|
+
focus-visible:border-btn-primary-focus
|
|
30
|
+
active:bg-btn-primary-active
|
|
31
|
+
active:border-btn-primary-active
|
|
32
|
+
disabled:bg-btn-primary-disabled
|
|
33
|
+
disabled:border-btn-primary-disabled
|
|
34
|
+
`,
|
|
35
|
+
secondary: `
|
|
36
|
+
text-btn-secondary
|
|
37
|
+
bg-btn-secondary
|
|
38
|
+
border-btn-secondary
|
|
39
|
+
hover:bg-btn-secondary-hover
|
|
40
|
+
hover:border-btn-secondary-hover
|
|
41
|
+
focus-visible:bg-btn-secondary-focus
|
|
42
|
+
focus-visibleborder-btn-secondary-focus
|
|
43
|
+
active:bg-btn-secondary-active
|
|
44
|
+
active:border-btn-secondary-active
|
|
45
|
+
disabled:text-btn-secondary-disabled
|
|
46
|
+
`,
|
|
47
|
+
outline: `
|
|
48
|
+
text-btn-outline
|
|
49
|
+
border-[1px]
|
|
50
|
+
border-btn-outline
|
|
51
|
+
hover:border-btn-outline-hover
|
|
52
|
+
focus:border-btn-outline-focus
|
|
53
|
+
active:border-btn-outline-active
|
|
54
|
+
disabled:border-btn-outline-disabled
|
|
55
|
+
disabled:text-btn-outline-disabled
|
|
56
|
+
`,
|
|
57
|
+
ghost: `
|
|
58
|
+
text-btn-ghost
|
|
59
|
+
border-transparent
|
|
60
|
+
hover:text-btn-ghost-hover
|
|
61
|
+
focus-visible:text-btn-ghost-focus
|
|
62
|
+
active:text-btn-ghost-active
|
|
63
|
+
disabled:text-btn-ghost-disabled
|
|
64
|
+
`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const getPadings = (icon, variant) => {
|
|
68
|
+
return cn(
|
|
69
|
+
icon && 'p-[12px] aspect-square',
|
|
70
|
+
icon && variant === 'outline' && 'p-[13px] aspect-square',
|
|
71
|
+
!icon && 'px-[24px] py-[12px]',
|
|
72
|
+
!icon && variant === 'outline' && 'px-[25px] py-[13px]'
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
interface IButtonProps {
|
|
76
|
+
variant?: 'primary'| 'secondary' | 'outline' | 'ghost',
|
|
77
|
+
className?: string,
|
|
78
|
+
icon?: boolean
|
|
79
|
+
}
|
|
80
|
+
const buttonVariants = ({ variant, className, icon }: IButtonProps) => {
|
|
81
|
+
return cva(`${buttonClasses.base} ${getPadings(icon, variant)}`,
|
|
82
|
+
{
|
|
83
|
+
variants: {
|
|
84
|
+
variant: {
|
|
85
|
+
primary: buttonClasses.primary,
|
|
86
|
+
secondary: buttonClasses.secondary,
|
|
87
|
+
outline: buttonClasses.outline,
|
|
88
|
+
ghost: buttonClasses.ghost,
|
|
89
|
+
},
|
|
21
90
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
md: 'h-[44px] px-[24px] text-[14px] leading-[1.08] rounded-md',
|
|
25
|
-
sm: 'h-[36px] px-[20px] text-[12px] leading-none rounded-[3px]',
|
|
26
|
-
xs: 'h-[28px] px-[12px] text-[11px] leading-none rounded-[2px]',
|
|
27
|
-
xxs: 'h-[20px] px-[8px] text-[9px] leading-none rounded-[2px]',
|
|
91
|
+
defaultVariants: {
|
|
92
|
+
variant: 'outline',
|
|
28
93
|
},
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
)
|
|
94
|
+
}
|
|
95
|
+
)({ variant, className })
|
|
96
|
+
}
|
|
97
|
+
|
|
36
98
|
const textVariants = cva(
|
|
37
99
|
'inline-flex whitespace-nowrap transition-colors focus-visible:outline-current disabled:opacity-[.24] rounded-[.25em] disabled:pointer-events-none',
|
|
38
100
|
{
|
|
39
101
|
variants: {
|
|
40
102
|
variant: {
|
|
41
103
|
primary:
|
|
42
|
-
'text-primary hover:text-primary-hover focus
|
|
104
|
+
'text-primary hover:text-primary-hover focus-visibletext-primary-focus active:text-primary-active disabled:pointer-events-none',
|
|
43
105
|
},
|
|
44
106
|
},
|
|
45
107
|
defaultVariants: {
|
|
@@ -48,26 +110,26 @@ const textVariants = cva(
|
|
|
48
110
|
}
|
|
49
111
|
)
|
|
50
112
|
|
|
51
|
-
export interface ButtonProps
|
|
52
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
53
|
-
VariantProps<typeof buttonVariants> {
|
|
113
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
54
114
|
asChild?: boolean
|
|
55
|
-
asText?: boolean
|
|
115
|
+
// asText?: boolean
|
|
116
|
+
icon?: boolean
|
|
117
|
+
variant?: string
|
|
56
118
|
}
|
|
57
119
|
|
|
58
120
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
121
|
+
({ className, variant, asChild = false, icon, ...props }, ref) => {
|
|
122
|
+
const Comp = asChild ? Slot : 'button'
|
|
123
|
+
// @ts-ignore
|
|
124
|
+
const classes = buttonVariants<any>({ variant, className, icon })
|
|
125
|
+
return (
|
|
126
|
+
<Comp
|
|
127
|
+
className={cn(classes)}
|
|
128
|
+
ref={ref}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
71
133
|
)
|
|
72
134
|
|
|
73
135
|
Button.displayName = 'Button'
|
|
@@ -128,29 +128,28 @@
|
|
|
128
128
|
--btn-primary-hover-bg: var(--cl-blue-3);
|
|
129
129
|
--btn-primary-focus-bg: var(--cl-blue-1);
|
|
130
130
|
--btn-primary-active-bg: var(--cl-blue-1);
|
|
131
|
+
--btn-primary-disabled-bg: var(--cl-blue-5);
|
|
131
132
|
|
|
132
|
-
--btn-
|
|
133
|
-
--btn-
|
|
134
|
-
--btn-
|
|
135
|
-
--btn-
|
|
136
|
-
--btn-success-active-bg: var(--cl-green-1);
|
|
137
|
-
|
|
138
|
-
--btn-secondary: var(--cl-graphite-2);
|
|
139
|
-
--btn-secondary-bg: #EDEEEF;
|
|
140
|
-
--btn-secondary-hover-bg: #E4E5E7;
|
|
133
|
+
--btn-secondary: var(--cl-blue-2);
|
|
134
|
+
--btn-secondary-disabled: var(--cl-blue-5);
|
|
135
|
+
--btn-secondary-bg: var(--cl-graphite-7);
|
|
136
|
+
--btn-secondary-hover-bg: transparent;
|
|
141
137
|
--btn-secondary-focus-bg: #E4E5E7;
|
|
142
|
-
--btn-secondary-active-bg:
|
|
143
|
-
|
|
144
|
-
--btn-ghost: var(--cl-
|
|
145
|
-
--btn-ghost-
|
|
146
|
-
--btn-ghost-
|
|
147
|
-
--btn-ghost-
|
|
148
|
-
--btn-ghost-
|
|
149
|
-
|
|
150
|
-
--btn-
|
|
151
|
-
--btn-
|
|
152
|
-
--btn-
|
|
153
|
-
--btn-
|
|
138
|
+
--btn-secondary-active-bg: var(--cl-graphite-6);
|
|
139
|
+
|
|
140
|
+
--btn-ghost: var(--cl-blue-2);
|
|
141
|
+
--btn-ghost-hover:var(--cl-blue-3);
|
|
142
|
+
--btn-ghost-focus: var(--cl-blue-3);
|
|
143
|
+
--btn-ghost-active: var(--cl-blue-1);
|
|
144
|
+
--btn-ghost-disabled: var(--cl-blue-5);
|
|
145
|
+
|
|
146
|
+
--btn-outline: var(--cl-graphite-2);
|
|
147
|
+
--btn-outline-disabled: var(--cl-graphite-4);
|
|
148
|
+
--btn-outline-border: var(--cl-graphite-5);
|
|
149
|
+
--btn-outline-hover-border:var(--cl-graphite-6);
|
|
150
|
+
--btn-outline-focus-border: var(--cl-graphite-4);
|
|
151
|
+
--btn-outline-active-border: var(--cl-graphite-4);
|
|
152
|
+
--btn-outline-disabled-border: var(--cl-graphite-5);
|
|
154
153
|
|
|
155
154
|
--btn-txt-primary: var(--cl-blue-2);
|
|
156
155
|
--btn-txt-primary-hover: var(--cl-blue-3);
|