@itilite/lumina-ui 0.0.1 → 0.0.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/babel.config.js +7 -0
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.js +75 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/setupTests.d.ts +1 -0
- package/dist/cjs/types/src/components/Checkbox/Checkbox.d.ts +4 -0
- package/dist/cjs/types/src/components/Checkbox/index.d.ts +1 -0
- package/dist/cjs/types/src/components/Checkbox/types.d.ts +11 -0
- package/dist/cjs/types/src/components/Modal/Modal.d.ts +3 -0
- package/dist/cjs/types/src/components/Modal/index.d.ts +1 -0
- package/dist/cjs/types/src/components/Modal/types.d.ts +21 -0
- package/dist/cjs/types/src/components/Radio/Radio.d.ts +4 -0
- package/dist/cjs/types/src/components/Radio/index.d.ts +1 -0
- package/dist/cjs/types/src/components/Radio/types.d.ts +11 -0
- package/dist/cjs/types/src/components/Switch/Switch.d.ts +4 -0
- package/dist/cjs/types/src/components/Switch/index.d.ts +1 -0
- package/dist/cjs/types/src/components/Switch/types.d.ts +7 -0
- package/dist/cjs/types/src/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/cjs/types/src/components/Tooltip/index.d.ts +1 -0
- package/dist/cjs/types/src/components/Tooltip/types.d.ts +8 -0
- package/dist/cjs/types/src/components/index.d.ts +6 -0
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.js +73 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/setupTests.d.ts +1 -0
- package/dist/esm/types/src/components/Checkbox/Checkbox.d.ts +4 -0
- package/dist/esm/types/src/components/Checkbox/index.d.ts +1 -0
- package/dist/esm/types/src/components/Checkbox/types.d.ts +11 -0
- package/dist/esm/types/src/components/Modal/Modal.d.ts +3 -0
- package/dist/esm/types/src/components/Modal/index.d.ts +1 -0
- package/dist/esm/types/src/components/Modal/types.d.ts +21 -0
- package/dist/esm/types/src/components/Radio/Radio.d.ts +4 -0
- package/dist/esm/types/src/components/Radio/index.d.ts +1 -0
- package/dist/esm/types/src/components/Radio/types.d.ts +11 -0
- package/dist/esm/types/src/components/Switch/Switch.d.ts +4 -0
- package/dist/esm/types/src/components/Switch/index.d.ts +1 -0
- package/dist/esm/types/src/components/Switch/types.d.ts +7 -0
- package/dist/esm/types/src/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/esm/types/src/components/Tooltip/index.d.ts +1 -0
- package/dist/esm/types/src/components/Tooltip/types.d.ts +8 -0
- package/dist/esm/types/src/components/index.d.ts +6 -0
- package/jest.config.js +11 -0
- package/package.json +79 -53
- package/setupTests.ts +1 -0
- package/src/components/Button/Button.test.tsx +90 -0
- package/src/components/Button/Button.tsx +2 -1
- package/src/components/Checkbox/Checkbox.module.scss +141 -0
- package/src/components/Checkbox/Checkbox.tsx +56 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Checkbox/types.ts +12 -0
- package/src/components/Modal/Modal.module.scss +61 -0
- package/src/components/Modal/Modal.tsx +103 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Modal/types.ts +21 -0
- package/src/components/Radio/Radio.module.scss +103 -0
- package/src/components/Radio/Radio.tsx +54 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Radio/types.ts +12 -0
- package/src/components/Switch/Switch.module.scss +17 -0
- package/src/components/Switch/Switch.tsx +37 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Switch/types.ts +12 -0
- package/src/components/Tooltip/Tooltip.module.scss +12 -0
- package/src/components/Tooltip/Tooltip.tsx +29 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Tooltip/types.ts +21 -0
- package/src/components/index.ts +7 -1
- package/tsconfig.json +37 -36
- package/dist/cjs/types/components/index.d.ts +0 -1
- package/dist/esm/types/components/index.d.ts +0 -1
- package/dist/index.d.ts +0 -22
- /package/dist/cjs/types/{components → src/components}/Button/Button.d.ts +0 -0
- /package/dist/cjs/types/{components → src/components}/Button/index.d.ts +0 -0
- /package/dist/cjs/types/{components → src/components}/Button/types.d.ts +0 -0
- /package/dist/cjs/types/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/esm/types/{components → src/components}/Button/Button.d.ts +0 -0
- /package/dist/esm/types/{components → src/components}/Button/index.d.ts +0 -0
- /package/dist/esm/types/{components → src/components}/Button/types.d.ts +0 -0
- /package/dist/esm/types/{index.d.ts → src/index.d.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RadioChangeEvent } from "antd/lib/radio";
|
|
2
|
+
export interface RadioProps {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
className?: string;
|
|
5
|
+
onChange?: (event: RadioChangeEvent) => void;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
size?: "large" | "small" | "medium";
|
|
8
|
+
variant?: "normal" | "emphasized";
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
extra?: React.ReactNode;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Switch } from "./Switch";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tooltip } from "./Tooltip";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface TooltipProps {
|
|
2
|
+
children?: React.ReactNode;
|
|
3
|
+
title?: string | undefined;
|
|
4
|
+
placement?: "top" | "left" | "right" | "bottom" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | undefined;
|
|
5
|
+
color?: string | undefined;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
mode?: "light" | "dark";
|
|
8
|
+
}
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,54 +1,80 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
2
|
+
"name": "@itilite/lumina-ui",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Design system",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "rollup -c",
|
|
10
|
+
"dev": "rollup -c -w",
|
|
11
|
+
"lint": "eslint ",
|
|
12
|
+
"lint:fix": "eslint ./src --ext .ts,.tsx --fix",
|
|
13
|
+
"test": "jest"
|
|
14
|
+
},
|
|
15
|
+
"author": "Itilite",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@babel/core": "^7.25.9",
|
|
19
|
+
"@babel/preset-env": "^7.25.9",
|
|
20
|
+
"@babel/preset-react": "^7.25.9",
|
|
21
|
+
"@babel/preset-typescript": "^7.25.9",
|
|
22
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
23
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
24
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
25
|
+
"@testing-library/jest-dom": "^6.6.2",
|
|
26
|
+
"@testing-library/react": "^16.0.1",
|
|
27
|
+
"@types/jest": "^29.5.12",
|
|
28
|
+
"@types/prop-types": "^15.7.12",
|
|
29
|
+
"@types/react": "^18.3.12",
|
|
30
|
+
"@types/react-dom": "^18.3.0",
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^8.2.0",
|
|
32
|
+
"@typescript-eslint/parser": "^8.2.0",
|
|
33
|
+
"antd": "^5.20.1",
|
|
34
|
+
"autoprefixer": "^10.4.20",
|
|
35
|
+
"babel-jest": "^29.7.0",
|
|
36
|
+
"clsx": "^2.1.1",
|
|
37
|
+
"eslint": "^9.9.0",
|
|
38
|
+
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
39
|
+
"eslint-define-config": "^2.1.0",
|
|
40
|
+
"eslint-plugin-import": "^2.29.1",
|
|
41
|
+
"eslint-plugin-react": "^7.35.0",
|
|
42
|
+
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
|
43
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
44
|
+
"eslint-plugin-unused-imports": "^4.1.3",
|
|
45
|
+
"identity-obj-proxy": "^3.0.0",
|
|
46
|
+
"jest": "^29.7.0",
|
|
47
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
48
|
+
"postcss": "^8.4.41",
|
|
49
|
+
"postcss-scss": "^4.0.9",
|
|
50
|
+
"prop-types": "^15.8.1",
|
|
51
|
+
"react": "^18.3.1",
|
|
52
|
+
"react-dom": "^18.3.1",
|
|
53
|
+
"rollup": "^4.21.0",
|
|
54
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
55
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
56
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
57
|
+
"rollup-plugin-scss": "^4.0.0",
|
|
58
|
+
"sass": "^1.77.8",
|
|
59
|
+
"tailwindcss": "^3.4.10",
|
|
60
|
+
"tslib": "^2.6.3",
|
|
61
|
+
"typescript": "^5.5.3"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"react": ">=18"
|
|
65
|
+
},
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "git+https://github.com/Itilite/design-system.git"
|
|
69
|
+
},
|
|
70
|
+
"keywords": [
|
|
71
|
+
"Design",
|
|
72
|
+
"system",
|
|
73
|
+
"LuminaUI",
|
|
74
|
+
"Frontend"
|
|
75
|
+
],
|
|
76
|
+
"bugs": {
|
|
77
|
+
"url": "https://github.com/Itilite/design-system/issues"
|
|
78
|
+
},
|
|
79
|
+
"homepage": "https://github.com/Itilite/design-system#readme"
|
|
80
|
+
}
|
package/setupTests.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
});
|
|
@@ -65,6 +65,7 @@ const Button: React.FC<ButtonProps> = (props) => {
|
|
|
65
65
|
disabled={disabled}
|
|
66
66
|
loading={loading}
|
|
67
67
|
href={href || undefined}
|
|
68
|
+
data-testid='lumina-button'
|
|
68
69
|
>
|
|
69
70
|
{children}
|
|
70
71
|
</AntButton>
|
|
@@ -77,7 +78,7 @@ Button.propTypes = {
|
|
|
77
78
|
variant: PropTypes.oneOf(["subtle", "text", "link"]),
|
|
78
79
|
size: PropTypes.oneOf(["large", "small"]),
|
|
79
80
|
shape: PropTypes.oneOf(["circle", "default", "round"]),
|
|
80
|
-
icon: PropTypes.
|
|
81
|
+
icon: PropTypes.element,
|
|
81
82
|
iconPosition: PropTypes.oneOf(["start", "end"]),
|
|
82
83
|
className: PropTypes.string,
|
|
83
84
|
onClick: PropTypes.func,
|
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from "./Checkbox";
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
}
|