@itilite/lumina-ui 0.0.31 → 0.0.322
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/README.md +106 -0
- package/dist/{cjs/types/components/Button/types.d.ts → Button.d.mts} +10 -1
- package/dist/{esm/types/components/Button/types.d.ts → Button.d.ts} +10 -1
- package/dist/Button.js +111 -0
- package/dist/Button.mjs +9 -0
- package/dist/{esm/types/components/Checkbox/types.d.ts → Checkbox.d.mts} +10 -1
- package/dist/{types/components/Checkbox/types.d.ts → Checkbox.d.ts} +10 -1
- package/dist/Checkbox.js +121 -0
- package/dist/Checkbox.mjs +9 -0
- package/dist/chunk-FUJQIYOF.mjs +37 -0
- package/dist/chunk-ME35H7QC.mjs +77 -0
- package/dist/chunk-OMYHSSPQ.mjs +64 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +197 -0
- package/dist/index.mjs +11 -0
- package/dist/styles.css +1162 -0
- package/package.json +72 -80
- package/babel.config.js +0 -7
- package/dist/cjs/index.css +0 -1
- package/dist/cjs/index.js +0 -23219
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/types/components/Button/Button.d.ts +0 -4
- package/dist/cjs/types/components/Button/index.d.ts +0 -1
- package/dist/cjs/types/components/Checkbox/Checkbox.d.ts +0 -4
- package/dist/cjs/types/components/Checkbox/index.d.ts +0 -1
- package/dist/cjs/types/components/Checkbox/types.d.ts +0 -11
- package/dist/cjs/types/components/Modal/Modal.d.ts +0 -3
- package/dist/cjs/types/components/Modal/index.d.ts +0 -1
- package/dist/cjs/types/components/Modal/types.d.ts +0 -21
- package/dist/cjs/types/components/Radio/Radio.d.ts +0 -4
- package/dist/cjs/types/components/Radio/index.d.ts +0 -1
- package/dist/cjs/types/components/Radio/types.d.ts +0 -11
- package/dist/cjs/types/components/Switch/Switch.d.ts +0 -4
- package/dist/cjs/types/components/Switch/index.d.ts +0 -1
- package/dist/cjs/types/components/Switch/types.d.ts +0 -7
- package/dist/cjs/types/components/Tag/Tag.d.ts +0 -4
- package/dist/cjs/types/components/Tag/index.d.ts +0 -1
- package/dist/cjs/types/components/Tag/type.d.ts +0 -7
- package/dist/cjs/types/components/Tooltip/Tooltip.d.ts +0 -3
- package/dist/cjs/types/components/Tooltip/index.d.ts +0 -1
- package/dist/cjs/types/components/Tooltip/types.d.ts +0 -8
- package/dist/cjs/types/components/index.d.ts +0 -7
- package/dist/cjs/types/index.d.ts +0 -1
- package/dist/esm/index.css +0 -1
- package/dist/esm/index.js +0 -23193
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types/components/Button/Button.d.ts +0 -4
- package/dist/esm/types/components/Button/index.d.ts +0 -1
- package/dist/esm/types/components/Checkbox/Checkbox.d.ts +0 -4
- package/dist/esm/types/components/Checkbox/index.d.ts +0 -1
- package/dist/esm/types/components/Modal/Modal.d.ts +0 -3
- package/dist/esm/types/components/Modal/index.d.ts +0 -1
- package/dist/esm/types/components/Modal/types.d.ts +0 -21
- package/dist/esm/types/components/Radio/Radio.d.ts +0 -4
- package/dist/esm/types/components/Radio/index.d.ts +0 -1
- package/dist/esm/types/components/Radio/types.d.ts +0 -11
- package/dist/esm/types/components/Switch/Switch.d.ts +0 -4
- package/dist/esm/types/components/Switch/index.d.ts +0 -1
- package/dist/esm/types/components/Switch/types.d.ts +0 -7
- package/dist/esm/types/components/Tag/Tag.d.ts +0 -4
- package/dist/esm/types/components/Tag/index.d.ts +0 -1
- package/dist/esm/types/components/Tag/type.d.ts +0 -7
- package/dist/esm/types/components/Tooltip/Tooltip.d.ts +0 -3
- package/dist/esm/types/components/Tooltip/index.d.ts +0 -1
- package/dist/esm/types/components/Tooltip/types.d.ts +0 -8
- package/dist/esm/types/components/index.d.ts +0 -7
- package/dist/esm/types/index.d.ts +0 -1
- package/dist/types/components/Button/Button.d.ts +0 -4
- package/dist/types/components/Button/Button.test.d.ts +0 -1
- package/dist/types/components/Button/index.d.ts +0 -1
- package/dist/types/components/Button/types.d.ts +0 -16
- package/dist/types/components/Checkbox/Checkbox.d.ts +0 -4
- package/dist/types/components/Checkbox/index.d.ts +0 -1
- package/dist/types/components/Modal/Modal.d.ts +0 -3
- package/dist/types/components/Modal/index.d.ts +0 -1
- package/dist/types/components/Modal/types.d.ts +0 -21
- package/dist/types/components/Radio/Radio.d.ts +0 -4
- package/dist/types/components/Radio/index.d.ts +0 -1
- package/dist/types/components/Radio/types.d.ts +0 -11
- package/dist/types/components/Switch/Switch.d.ts +0 -4
- package/dist/types/components/Switch/index.d.ts +0 -1
- package/dist/types/components/Switch/types.d.ts +0 -7
- package/dist/types/components/Tag/Tag.d.ts +0 -4
- package/dist/types/components/Tag/index.d.ts +0 -1
- package/dist/types/components/Tag/type.d.ts +0 -7
- package/dist/types/components/Tooltip/Tooltip.d.ts +0 -3
- package/dist/types/components/Tooltip/index.d.ts +0 -1
- package/dist/types/components/Tooltip/types.d.ts +0 -8
- package/dist/types/components/index.d.ts +0 -7
- package/dist/types/index.d.ts +0 -1
- package/eslint.config.mjs +0 -55
- package/jest.config.js +0 -12
- package/rollup.config.mjs +0 -58
- package/setupTests.ts +0 -1
- package/src/components/Button/Button.module.scss +0 -199
- package/src/components/Button/Button.test.tsx +0 -90
- package/src/components/Button/Button.tsx +0 -91
- package/src/components/Button/index.ts +0 -1
- package/src/components/Button/types.ts +0 -16
- package/src/components/Checkbox/Checkbox.module.scss +0 -141
- package/src/components/Checkbox/Checkbox.tsx +0 -56
- package/src/components/Checkbox/index.ts +0 -1
- package/src/components/Checkbox/types.ts +0 -12
- package/src/components/Modal/Modal.module.scss +0 -61
- package/src/components/Modal/Modal.tsx +0 -103
- package/src/components/Modal/index.ts +0 -1
- package/src/components/Modal/types.ts +0 -21
- package/src/components/Radio/Radio.module.scss +0 -103
- package/src/components/Radio/Radio.tsx +0 -54
- package/src/components/Radio/index.ts +0 -1
- package/src/components/Radio/types.ts +0 -12
- package/src/components/Switch/Switch.module.scss +0 -17
- package/src/components/Switch/Switch.tsx +0 -37
- package/src/components/Switch/index.ts +0 -1
- package/src/components/Switch/types.ts +0 -12
- package/src/components/Tag/Tag.module.scss +0 -61
- package/src/components/Tag/Tag.tsx +0 -34
- package/src/components/Tag/index.ts +0 -1
- package/src/components/Tag/type.ts +0 -7
- package/src/components/Tooltip/Tooltip.module.scss +0 -12
- package/src/components/Tooltip/Tooltip.tsx +0 -29
- package/src/components/Tooltip/index.ts +0 -1
- package/src/components/Tooltip/types.ts +0 -21
- package/src/components/index.ts +0 -8
- package/src/global.d.ts +0 -6
- package/src/index.ts +0 -1
- package/src/types/jest.d.ts +0 -10
- package/src/types/scss.d.ts +0 -1
- package/tsconfig.json +0 -41
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { render, screen, fireEvent } from "@testing-library/react";
|
|
2
|
-
import Button from "./Button";
|
|
3
|
-
|
|
4
|
-
describe("Button component", () => {
|
|
5
|
-
it("should render the button with the provided label", () => {
|
|
6
|
-
render(<Button>{"Click me"}</Button>);
|
|
7
|
-
|
|
8
|
-
const buttonElement = screen.getByText(/click me/i);
|
|
9
|
-
expect(buttonElement).toBeInTheDocument();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it("should call onClick handler when clicked", () => {
|
|
13
|
-
const handleClick = jest.fn();
|
|
14
|
-
render(<Button onClick={handleClick}>{"Click me"}</Button>);
|
|
15
|
-
|
|
16
|
-
const buttonElement = screen.getByTestId("lumina-button");
|
|
17
|
-
fireEvent.click(buttonElement);
|
|
18
|
-
|
|
19
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("should apply the correct size class", () => {
|
|
23
|
-
render(
|
|
24
|
-
<Button onClick={() => {}} size='large'>
|
|
25
|
-
{"Large button"}
|
|
26
|
-
</Button>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const buttonElement = screen.getByTestId("lumina-button");
|
|
30
|
-
expect(buttonElement).toHaveClass("size_large");
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("should apply the correct type class", () => {
|
|
34
|
-
render(
|
|
35
|
-
<Button onClick={() => {}} type='critical'>
|
|
36
|
-
{"Critical Button"}
|
|
37
|
-
</Button>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const buttonElement = screen.getByTestId("lumina-button");
|
|
41
|
-
expect(buttonElement).toHaveClass("type_critical");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("should be disabled when the disabled prop is passed", () => {
|
|
45
|
-
render(
|
|
46
|
-
<Button onClick={() => {}} disabled={true}>
|
|
47
|
-
{"Disabled Button"}
|
|
48
|
-
</Button>
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const buttonElement = screen.getByTestId("lumina-button");
|
|
52
|
-
expect(buttonElement).toBeDisabled();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("should not call onClick when disabled", () => {
|
|
56
|
-
const handleClick = jest.fn();
|
|
57
|
-
render(
|
|
58
|
-
<Button onClick={handleClick} disabled={true}>
|
|
59
|
-
{"Disabled Button"}
|
|
60
|
-
</Button>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const buttonElement = screen.getByTestId("lumina-button");
|
|
64
|
-
fireEvent.click(buttonElement);
|
|
65
|
-
|
|
66
|
-
expect(handleClick).not.toHaveBeenCalled();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("should render with the correct shape class", () => {
|
|
70
|
-
render(
|
|
71
|
-
<Button onClick={() => {}} size='large' shape='circle'>
|
|
72
|
-
{"Circle Button"}
|
|
73
|
-
</Button>
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const buttonElement = screen.getByTestId("lumina-button");
|
|
77
|
-
expect(buttonElement).toHaveClass("shape_circle");
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it("should render with the correct variant class", () => {
|
|
81
|
-
render(
|
|
82
|
-
<Button onClick={() => {}} variant='link'>
|
|
83
|
-
{"Link Button"}
|
|
84
|
-
</Button>
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const buttonElement = screen.getByTestId("lumina-button");
|
|
88
|
-
expect(buttonElement).toHaveClass("variant_link");
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Button as AntButton } from "antd";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
|
-
|
|
6
|
-
import classes from "./Button.module.scss";
|
|
7
|
-
import { ButtonProps } from "./types";
|
|
8
|
-
|
|
9
|
-
const Button: React.FC<ButtonProps> = (props) => {
|
|
10
|
-
const {
|
|
11
|
-
type = "primary",
|
|
12
|
-
variant = "default",
|
|
13
|
-
size = "normal",
|
|
14
|
-
shape = "default",
|
|
15
|
-
className = "",
|
|
16
|
-
icon = null,
|
|
17
|
-
iconPosition = "start",
|
|
18
|
-
children,
|
|
19
|
-
onClick = () => {},
|
|
20
|
-
href = "",
|
|
21
|
-
disabled = false,
|
|
22
|
-
loading = false,
|
|
23
|
-
onHoverUnderline = false,
|
|
24
|
-
} = props;
|
|
25
|
-
|
|
26
|
-
const buttonMap: Record<string, "primary" | "default" | "text" | "link"> = {
|
|
27
|
-
default: "primary",
|
|
28
|
-
subtle: "default",
|
|
29
|
-
text: "text",
|
|
30
|
-
link: "link",
|
|
31
|
-
};
|
|
32
|
-
// Map your sizes to Ant Design's sizes
|
|
33
|
-
const sizeMap: Record<string, "small" | "middle" | "large"> = {
|
|
34
|
-
small: "small",
|
|
35
|
-
normal: "middle", // Map "default" to "middle"
|
|
36
|
-
large: "large",
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<AntButton
|
|
41
|
-
className={clsx(
|
|
42
|
-
classes.button,
|
|
43
|
-
classes[`size_${size}`],
|
|
44
|
-
classes[`variant_${variant}`],
|
|
45
|
-
classes[`shape_${shape}`],
|
|
46
|
-
classes[`type_${type}`],
|
|
47
|
-
`size_${size}`,
|
|
48
|
-
`variant_${variant}`,
|
|
49
|
-
`shape_${shape}`,
|
|
50
|
-
`type_${type}`,
|
|
51
|
-
className,
|
|
52
|
-
{
|
|
53
|
-
"tw-cursor-not-allowed": disabled,
|
|
54
|
-
"tw-opacity-40": disabled,
|
|
55
|
-
},
|
|
56
|
-
disabled && classes.disabled,
|
|
57
|
-
onHoverUnderline && classes.onHoverUnderline
|
|
58
|
-
)}
|
|
59
|
-
icon={icon}
|
|
60
|
-
iconPosition={iconPosition}
|
|
61
|
-
onClick={onClick}
|
|
62
|
-
size={sizeMap[size]}
|
|
63
|
-
shape={shape}
|
|
64
|
-
type={buttonMap[variant]}
|
|
65
|
-
disabled={disabled}
|
|
66
|
-
loading={loading}
|
|
67
|
-
href={href || undefined}
|
|
68
|
-
data-testid='lumina-button'
|
|
69
|
-
>
|
|
70
|
-
{children}
|
|
71
|
-
</AntButton>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
export default Button;
|
|
75
|
-
|
|
76
|
-
Button.propTypes = {
|
|
77
|
-
type: PropTypes.oneOf(["primary", "secondary", "critical"]),
|
|
78
|
-
variant: PropTypes.oneOf(["subtle", "text", "link"]),
|
|
79
|
-
size: PropTypes.oneOf(["large", "small"]),
|
|
80
|
-
shape: PropTypes.oneOf(["circle", "default", "round"]),
|
|
81
|
-
icon: PropTypes.element,
|
|
82
|
-
iconPosition: PropTypes.oneOf(["start", "end"]),
|
|
83
|
-
className: PropTypes.string,
|
|
84
|
-
onClick: PropTypes.func,
|
|
85
|
-
disabled: PropTypes.bool,
|
|
86
|
-
loading: PropTypes.bool,
|
|
87
|
-
href: PropTypes.string,
|
|
88
|
-
onHoverUnderline: PropTypes.bool,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
Button.displayName = "Button";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Button } from "./Button";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface ButtonProps {
|
|
2
|
-
type?: "primary" | "secondary" | "critical" | undefined;
|
|
3
|
-
variant?: "subtle" | "text" | "link";
|
|
4
|
-
size?: "large" | "small";
|
|
5
|
-
shape?: "circle" | "default" | "round";
|
|
6
|
-
icon?: React.ReactNode;
|
|
7
|
-
iconPosition?: "start" | "end";
|
|
8
|
-
className?: string;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
11
|
-
href?: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
loading?: boolean;
|
|
14
|
-
onHoverUnderline?: boolean;
|
|
15
|
-
analytics?: Record<string, unknown>;
|
|
16
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
.checkbox {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
&.size_small {
|
|
5
|
-
:global(.ant-checkbox) {
|
|
6
|
-
:global(.ant-checkbox-inner) {
|
|
7
|
-
height: 16px;
|
|
8
|
-
width: 16px;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
&.size_medium {
|
|
13
|
-
:global(.ant-checkbox) {
|
|
14
|
-
:global(.ant-checkbox-inner) {
|
|
15
|
-
height: 20px;
|
|
16
|
-
width: 20px;
|
|
17
|
-
&::after {
|
|
18
|
-
inset-inline-start: 27%;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
&.size_large {
|
|
24
|
-
:global(.ant-checkbox) {
|
|
25
|
-
:global(.ant-checkbox-inner) {
|
|
26
|
-
height: 24px;
|
|
27
|
-
width: 24px;
|
|
28
|
-
&::after {
|
|
29
|
-
inset-inline-start: 33%;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&.type_checked {
|
|
36
|
-
:global(.ant-checkbox-checked) {
|
|
37
|
-
:global(.ant-checkbox-inner) {
|
|
38
|
-
border-color: #ec5d25;
|
|
39
|
-
background-color: #ec5d25;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
&:global(
|
|
43
|
-
.ant-checkbox-wrapper:hover
|
|
44
|
-
.ant-checkbox-checked:not(.ant-checkbox-disabled)
|
|
45
|
-
.ant-checkbox-inner
|
|
46
|
-
) {
|
|
47
|
-
@apply tw-bg-color-text-primary-hover;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
:global(.ant-checkbox-checked):focus-visible {
|
|
51
|
-
outline: 2px solid #0a65e7;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&.disabled {
|
|
55
|
-
@apply tw-cursor-not-allowed;
|
|
56
|
-
|
|
57
|
-
:global(.ant-checkbox-checked) {
|
|
58
|
-
:global(.ant-checkbox-inner) {
|
|
59
|
-
opacity: 0.5;
|
|
60
|
-
border-color: #ec5d25;
|
|
61
|
-
background-color: #ec5d25;
|
|
62
|
-
}
|
|
63
|
-
:global(.ant-checkbox-inner)::after {
|
|
64
|
-
border-color: #ffffff;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&.type_unchecked {
|
|
71
|
-
:global(.ant-checkbox) {
|
|
72
|
-
:global(.ant-checkbox-inner) {
|
|
73
|
-
border-color: #b6bac3;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
:global(.ant-checkbox):hover {
|
|
78
|
-
:global(.ant-checkbox-inner) {
|
|
79
|
-
border-color: #6b7280;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
:global(.ant-checkbox):focus-visible {
|
|
83
|
-
outline: 2px solid #0a65e7;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
&.disabled {
|
|
87
|
-
@apply tw-cursor-not-allowed;
|
|
88
|
-
|
|
89
|
-
:global(.ant-checkbox) {
|
|
90
|
-
:global(.ant-checkbox-inner) {
|
|
91
|
-
border-color: #b6bac3;
|
|
92
|
-
background-color: #f9fafb;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
:global(.ant-checkbox-disabled + span) {
|
|
99
|
-
color: #363e4f;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
&.variant_normal {
|
|
103
|
-
color: #363e4f;
|
|
104
|
-
font-weight: 400;
|
|
105
|
-
font-size: 0.875rem /* 14px */;
|
|
106
|
-
line-height: 20px;
|
|
107
|
-
}
|
|
108
|
-
&.variant_emphasized {
|
|
109
|
-
color: #363e4f;
|
|
110
|
-
font-weight: 500;
|
|
111
|
-
font-size: 0.875rem /* 14px */;
|
|
112
|
-
line-height: 20px;
|
|
113
|
-
}
|
|
114
|
-
&.variant_indeterminate {
|
|
115
|
-
&.disabled {
|
|
116
|
-
:global(.ant-checkbox-indeterminate) {
|
|
117
|
-
:global(.ant-checkbox-inner) {
|
|
118
|
-
opacity: 0.5;
|
|
119
|
-
border-color: #ec5d25;
|
|
120
|
-
background-color: #ec5d25;
|
|
121
|
-
}
|
|
122
|
-
:global(.ant-checkbox-inner)::after {
|
|
123
|
-
border-color: #ffffff;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
:global(.ant-checkbox-indeterminate) {
|
|
128
|
-
:global(.ant-checkbox-inner) {
|
|
129
|
-
border-color: #ec5d25 !important;
|
|
130
|
-
background-color: #ec5d25 !important;
|
|
131
|
-
}
|
|
132
|
-
:global(.ant-checkbox-inner)::after {
|
|
133
|
-
inset-inline-start: 50%;
|
|
134
|
-
width: 60%;
|
|
135
|
-
height: 3px;
|
|
136
|
-
border-radius: 4px;
|
|
137
|
-
background: white;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Checkbox as AntCheckbox } from "antd";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
|
-
|
|
6
|
-
import classes from "./Checkbox.module.scss";
|
|
7
|
-
import { CheckboxProps } from "./types";
|
|
8
|
-
|
|
9
|
-
const Checkbox: React.FC<CheckboxProps> = (props) => {
|
|
10
|
-
const {
|
|
11
|
-
className = "",
|
|
12
|
-
children = null,
|
|
13
|
-
onChange = () => {},
|
|
14
|
-
checked = false,
|
|
15
|
-
disabled = false,
|
|
16
|
-
size = "small",
|
|
17
|
-
variant = "normal",
|
|
18
|
-
indeterminate = false,
|
|
19
|
-
...rest
|
|
20
|
-
} = props;
|
|
21
|
-
return (
|
|
22
|
-
<AntCheckbox
|
|
23
|
-
className={clsx(
|
|
24
|
-
classes.checkbox,
|
|
25
|
-
classes[`size_${size}`],
|
|
26
|
-
classes[`variant_${variant}`],
|
|
27
|
-
checked ? classes.type_checked : classes.type_unchecked,
|
|
28
|
-
disabled && classes.disabled,
|
|
29
|
-
indeterminate && classes[`variant_indeterminate`],
|
|
30
|
-
className
|
|
31
|
-
)}
|
|
32
|
-
onChange={onChange}
|
|
33
|
-
checked={checked}
|
|
34
|
-
disabled={disabled}
|
|
35
|
-
indeterminate={indeterminate}
|
|
36
|
-
{...rest}
|
|
37
|
-
>
|
|
38
|
-
{children}
|
|
39
|
-
</AntCheckbox>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
``;
|
|
43
|
-
Checkbox.propTypes = {
|
|
44
|
-
checked: PropTypes.bool,
|
|
45
|
-
className: PropTypes.string,
|
|
46
|
-
size: PropTypes.oneOf(["large", "small", "medium"]),
|
|
47
|
-
variant: PropTypes.oneOf(["normal", "emphasized"]),
|
|
48
|
-
onChange: PropTypes.func,
|
|
49
|
-
children: PropTypes.element,
|
|
50
|
-
disabled: PropTypes.bool,
|
|
51
|
-
indeterminate: PropTypes.bool,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
Checkbox.displayName = "Checkbox";
|
|
55
|
-
|
|
56
|
-
export default Checkbox;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Checkbox } from "./Checkbox";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CheckboxChangeEvent } from 'antd/es/checkbox';
|
|
2
|
-
|
|
3
|
-
export interface CheckboxProps {
|
|
4
|
-
checked?: boolean;
|
|
5
|
-
className?: string;
|
|
6
|
-
onChange?: (e: CheckboxChangeEvent) => void;
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
size?: "large" | "small" | "medium",
|
|
9
|
-
variant?: "normal" | "emphasized",
|
|
10
|
-
disabled?: boolean,
|
|
11
|
-
indeterminate?: boolean,
|
|
12
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
.modal {
|
|
2
|
-
&.footerMargintopDisable {
|
|
3
|
-
.ant-modal-footer {
|
|
4
|
-
margin-top: 0;
|
|
5
|
-
@apply tw-mt-0;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
:global(.ant-modal-footer) {
|
|
9
|
-
:global(.primaryFooter) {
|
|
10
|
-
padding: 24px;
|
|
11
|
-
@apply tw-p-6;
|
|
12
|
-
@apply tw-flex tw-justify-end;
|
|
13
|
-
.okBtn,
|
|
14
|
-
.cancelBtn {
|
|
15
|
-
min-width: 92px;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
:global(.secondaryFooter) {
|
|
19
|
-
padding: 24px;
|
|
20
|
-
@apply tw-p-6;
|
|
21
|
-
@apply tw-pt-0;
|
|
22
|
-
@apply tw-flex tw-justify-end;
|
|
23
|
-
.okBtn,
|
|
24
|
-
.cancelBtn {
|
|
25
|
-
width: 50%;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
:global(.ant-modal-content) {
|
|
30
|
-
padding: 0;
|
|
31
|
-
@apply tw-rounded-xl;
|
|
32
|
-
@apply tw-p-0;
|
|
33
|
-
:global(.ant-modal-header) {
|
|
34
|
-
@apply tw-p-4 sm:tw-p-6 tw-mb-0;
|
|
35
|
-
:global(.ant-modal-title) {
|
|
36
|
-
justify-content: flex-start;
|
|
37
|
-
@apply tw-font-medium tw-text-font-size-50 tw-leading-7 tw-text-color-surface-dark tw-pr-5;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
:global(.ant-modal-close) {
|
|
41
|
-
display: flex;
|
|
42
|
-
@apply tw-flex tw-items-end tw-justify-center;
|
|
43
|
-
:global(.ant-modal-close-x) {
|
|
44
|
-
display: flex;
|
|
45
|
-
@apply tw-flex tw-items-center tw-justify-center;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
:global(.ant-modal-body) {
|
|
49
|
-
padding: 0 1.5rem 1.5rem;
|
|
50
|
-
max-height: 80vh;
|
|
51
|
-
overflow: auto;
|
|
52
|
-
}
|
|
53
|
-
:global(.ant-modal-close) {
|
|
54
|
-
@apply tw-top-6 tw-right-6 tw-pb-1;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
:global(.ant-btn-primary) {
|
|
58
|
-
margin-inline-start: 0.5rem;
|
|
59
|
-
@apply tw-ms-2;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Modal as AntModal } from "antd";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import classes from "./Modal.module.scss";
|
|
4
|
-
import { Button } from "../Button";
|
|
5
|
-
import { ModalProps } from "./types";
|
|
6
|
-
|
|
7
|
-
const Close = ({ size = 14, color = "#B6BAC3", ...rest }) => {
|
|
8
|
-
return (
|
|
9
|
-
<svg
|
|
10
|
-
width={size}
|
|
11
|
-
height={size}
|
|
12
|
-
viewBox="0 0 14 14"
|
|
13
|
-
fill="none"
|
|
14
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
-
{...rest}
|
|
16
|
-
>
|
|
17
|
-
<path
|
|
18
|
-
d="M0.292893 0.292893C0.683417 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L7 5.58579L12.2929 0.292893C12.6834 -0.0976311 13.3166 -0.0976311 13.7071 0.292893C14.0976 0.683417 14.0976 1.31658 13.7071 1.70711L8.41421 7L13.7071 12.2929C14.0976 12.6834 14.0976 13.3166 13.7071 13.7071C13.3166 14.0976 12.6834 14.0976 12.2929 13.7071L7 8.41421L1.70711 13.7071C1.31658 14.0976 0.683417 14.0976 0.292893 13.7071C-0.0976311 13.3166 -0.0976311 12.6834 0.292893 12.2929L5.58579 7L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"
|
|
19
|
-
fill={color}
|
|
20
|
-
/>
|
|
21
|
-
</svg>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const Modal: React.FC<ModalProps> = ({
|
|
26
|
-
className = "",
|
|
27
|
-
title = "",
|
|
28
|
-
children,
|
|
29
|
-
open = false,
|
|
30
|
-
handleOk,
|
|
31
|
-
handleCancel,
|
|
32
|
-
okText = "",
|
|
33
|
-
cancelText = "",
|
|
34
|
-
closeIcon = <Close color="#6B7280" />,
|
|
35
|
-
bodyClassName = "modalBody",
|
|
36
|
-
outsideClickDisable = false,
|
|
37
|
-
hideCross = false,
|
|
38
|
-
okButtonLoading = false,
|
|
39
|
-
okButtonDisabled = false,
|
|
40
|
-
variant = "primary",
|
|
41
|
-
okBtnClasses = "",
|
|
42
|
-
cancelButtonAnalytics = {},
|
|
43
|
-
okButtonAnalytics = {},
|
|
44
|
-
footerMargintopDisable = true,
|
|
45
|
-
...rest
|
|
46
|
-
}) => {
|
|
47
|
-
return (
|
|
48
|
-
<div onClick={(e) => e.stopPropagation()}>
|
|
49
|
-
<AntModal
|
|
50
|
-
title={title}
|
|
51
|
-
open={open}
|
|
52
|
-
onOk={handleOk}
|
|
53
|
-
onCancel={handleCancel}
|
|
54
|
-
className={clsx(classes.modal, className, {
|
|
55
|
-
footerMargintopDisable: footerMargintopDisable,
|
|
56
|
-
})}
|
|
57
|
-
okText={okText}
|
|
58
|
-
cancelText={cancelText}
|
|
59
|
-
closeIcon={closeIcon}
|
|
60
|
-
closable={!hideCross}
|
|
61
|
-
maskClosable={!outsideClickDisable}
|
|
62
|
-
footer={
|
|
63
|
-
okText || cancelText ? (
|
|
64
|
-
<div
|
|
65
|
-
className={clsx({
|
|
66
|
-
primaryFooter: variant === "primary",
|
|
67
|
-
secondaryFooter: variant === "secondary",
|
|
68
|
-
})}
|
|
69
|
-
>
|
|
70
|
-
{cancelText && (
|
|
71
|
-
<Button
|
|
72
|
-
onClick={handleCancel as React.MouseEventHandler<HTMLElement>}
|
|
73
|
-
type="secondary"
|
|
74
|
-
className="cancelBtn"
|
|
75
|
-
variant='subtle'
|
|
76
|
-
{...cancelButtonAnalytics}
|
|
77
|
-
>
|
|
78
|
-
{cancelText}
|
|
79
|
-
</Button>
|
|
80
|
-
)}
|
|
81
|
-
{okText && (
|
|
82
|
-
<Button
|
|
83
|
-
onClick={handleOk as React.MouseEventHandler<HTMLElement>}
|
|
84
|
-
className={clsx(okBtnClasses, "okBtn")}
|
|
85
|
-
loading={okButtonLoading}
|
|
86
|
-
disabled={okButtonDisabled}
|
|
87
|
-
{...okButtonAnalytics}
|
|
88
|
-
>
|
|
89
|
-
{okText}
|
|
90
|
-
</Button>
|
|
91
|
-
)}
|
|
92
|
-
</div>
|
|
93
|
-
) : null
|
|
94
|
-
}
|
|
95
|
-
{...rest}
|
|
96
|
-
>
|
|
97
|
-
<div className={bodyClassName}>{children}</div>
|
|
98
|
-
</AntModal>
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export default Modal;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Modal } from "./Modal";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface ModalProps {
|
|
2
|
-
className?: string | undefined;
|
|
3
|
-
title?: string | undefined;
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
open?: boolean;
|
|
6
|
-
handleOk?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
7
|
-
handleCancel?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
8
|
-
okText?: string | undefined;
|
|
9
|
-
cancelText?: string | undefined;
|
|
10
|
-
closeIcon?: React.ReactNode;
|
|
11
|
-
bodyClassName?: string | undefined;
|
|
12
|
-
outsideClickDisable?: boolean;
|
|
13
|
-
hideCross?: boolean;
|
|
14
|
-
okButtonLoading?: boolean;
|
|
15
|
-
okButtonDisabled?: boolean;
|
|
16
|
-
variant?: "primary" | "secondary";
|
|
17
|
-
okBtnClasses?: string | undefined;
|
|
18
|
-
cancelButtonAnalytics?: object | undefined;
|
|
19
|
-
okButtonAnalytics?: object | undefined;
|
|
20
|
-
footerMargintopDisable?: boolean;
|
|
21
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
.radio {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
&.size_small {
|
|
5
|
-
:global(.ant-radio) {
|
|
6
|
-
:global(.ant-radio-inner) {
|
|
7
|
-
height: 16px;;
|
|
8
|
-
width: 16px;;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
&.size_medium {
|
|
13
|
-
:global(.ant-radio) {
|
|
14
|
-
:global(.ant-radio-inner) {
|
|
15
|
-
height: 20px;;
|
|
16
|
-
width: 20px;;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
&.size_large {
|
|
21
|
-
:global(.ant-radio) {
|
|
22
|
-
:global(.ant-radio-inner) {
|
|
23
|
-
height: 24px;;
|
|
24
|
-
width: 24px;;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&.type_checked {
|
|
30
|
-
:global(.ant-radio-checked) {
|
|
31
|
-
:global(.ant-radio-inner) {
|
|
32
|
-
border-color: #EC5D25 ;
|
|
33
|
-
background-color: #EC5D25;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
:global(.ant-radio-checked):hover {
|
|
38
|
-
:global(.ant-radio-inner){
|
|
39
|
-
border-color: #B94710 ;
|
|
40
|
-
background-color: #B94710 ;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
:global(.ant-radio-checked):focus-visible {
|
|
44
|
-
outline: 2px solid #0A65E7;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&.disabled {
|
|
48
|
-
@apply tw-cursor-not-allowed;
|
|
49
|
-
|
|
50
|
-
:global(.ant-radio-checked) {
|
|
51
|
-
:global(.ant-radio-inner){
|
|
52
|
-
border-color: #B6BAC3 ;
|
|
53
|
-
background-color: #B6BAC3 ;
|
|
54
|
-
}
|
|
55
|
-
:global(.ant-radio-inner)::after {
|
|
56
|
-
transform: scale(0.375);
|
|
57
|
-
background-color: #FFFFFF;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.type_unchecked {
|
|
64
|
-
:global(.ant-radio) {
|
|
65
|
-
:global(.ant-radio-inner) {
|
|
66
|
-
border-color: #B6BAC3 ;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
:global(.ant-radio):hover {
|
|
71
|
-
:global(.ant-radio-inner){
|
|
72
|
-
border-color: #6B7280 ;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
:global(.ant-radio):focus-visible {
|
|
76
|
-
outline: 2px solid #0A65E7;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
&.disabled {
|
|
80
|
-
@apply tw-cursor-not-allowed;
|
|
81
|
-
|
|
82
|
-
:global(.ant-radio) {
|
|
83
|
-
:global(.ant-radio-inner){
|
|
84
|
-
border-color: #B6BAC3 ;
|
|
85
|
-
background-color: #F9FAFB;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
&.variant_normal {
|
|
92
|
-
color: #363E4F;
|
|
93
|
-
font-weight: 400;
|
|
94
|
-
font-size: 0.875rem /* 14px */;
|
|
95
|
-
line-height: 20px;
|
|
96
|
-
}
|
|
97
|
-
&.variant_emphasized {
|
|
98
|
-
color: #363E4F;
|
|
99
|
-
font-weight: 500;
|
|
100
|
-
font-size: 0.875rem /* 14px */;
|
|
101
|
-
line-height: 20px;
|
|
102
|
-
}
|
|
103
|
-
}
|