@lunit/design-system 2.0.2 → 2.2.0
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 +107 -7
- package/dist/cjs/components/Alert/index.js +1 -1
- package/dist/cjs/components/Alert/index.js.map +1 -1
- package/dist/cjs/components/Button/index.js +1 -1
- package/dist/cjs/components/Button/index.js.map +1 -1
- package/dist/cjs/components/Checkbox/index.js +1 -1
- package/dist/cjs/components/Checkbox/index.js.map +1 -1
- package/dist/cjs/components/Chip/index.js +1 -1
- package/dist/cjs/components/Chip/index.js.map +1 -1
- package/dist/cjs/components/DataTable/index.js.map +1 -1
- package/dist/cjs/components/DatePicker/index.js.map +1 -1
- package/dist/cjs/components/Dialog/index.js +1 -1
- package/dist/cjs/components/Dialog/index.js.map +1 -1
- package/dist/cjs/components/Dropdown/index.js +1 -1
- package/dist/cjs/components/Dropdown/index.js.map +1 -1
- package/dist/cjs/components/FormLabel/index.js +1 -1
- package/dist/cjs/components/FormLabel/index.js.map +1 -1
- package/dist/cjs/components/Radio/index.js +1 -1
- package/dist/cjs/components/Radio/index.js.map +1 -1
- package/dist/cjs/components/RadioGroup/index.js.map +1 -1
- package/dist/cjs/components/TextField/index.js +1 -1
- package/dist/cjs/components/TextField/index.js.map +1 -1
- package/dist/cjs/components/Toggle/index.js +1 -1
- package/dist/cjs/components/Toggle/index.js.map +1 -1
- package/dist/cjs/components/ToggleButton/index.js +1 -1
- package/dist/cjs/components/ToggleButton/index.js.map +1 -1
- package/dist/cjs/components/Tooltip/index.js.map +1 -1
- package/dist/cjs/components/Typography/index.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/components/Chip/Chip.styled.js +9 -16
- package/dist/components/Chip/Chip.styled.js.map +1 -1
- package/dist/components/Dialog/Dialog.js +0 -6
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dropdown/Dropdown.js +37 -4
- package/dist/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/components/Dropdown/Dropdown.styled.js +161 -0
- package/dist/components/Dropdown/Dropdown.styled.js.map +1 -0
- package/dist/components/Dropdown/Dropdown.types.js +2 -0
- package/dist/components/Dropdown/Dropdown.types.js.map +1 -0
- package/dist/components/Dropdown/DropdownItem.js +36 -0
- package/dist/components/Dropdown/DropdownItem.js.map +1 -0
- package/dist/components/Dropdown/index.js +1 -0
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.style.js +27 -3
- package/dist/components/TextField/TextField.style.js.map +1 -1
- package/dist/foundation/Typography/index.js +5 -0
- package/dist/foundation/Typography/index.js.map +1 -1
- package/dist/foundation/Typography/tokens.js +44 -0
- package/dist/foundation/Typography/tokens.js.map +1 -1
- package/dist/foundation/colors/base/blue.js +12 -10
- package/dist/foundation/colors/base/blue.js.map +1 -1
- package/dist/foundation/colors/base/green.js +11 -9
- package/dist/foundation/colors/base/green.js.map +1 -1
- package/dist/foundation/colors/base/grey.js +30 -15
- package/dist/foundation/colors/base/grey.js.map +1 -1
- package/dist/foundation/colors/base/lunitTeal.js +2 -0
- package/dist/foundation/colors/base/lunitTeal.js.map +1 -1
- package/dist/foundation/colors/base/magenta.js +3 -1
- package/dist/foundation/colors/base/magenta.js.map +1 -1
- package/dist/foundation/colors/base/orange.js +11 -9
- package/dist/foundation/colors/base/orange.js.map +1 -1
- package/dist/foundation/colors/base/purple.js +3 -1
- package/dist/foundation/colors/base/purple.js.map +1 -1
- package/dist/foundation/colors/base/red.js +5 -3
- package/dist/foundation/colors/base/red.js.map +1 -1
- package/dist/foundation/colors/base/yellow.js +12 -10
- package/dist/foundation/colors/base/yellow.js.map +1 -1
- package/dist/foundation/colors/index.js +3 -0
- package/dist/foundation/colors/index.js.map +1 -1
- package/dist/foundation/colors/token/component.js +26 -22
- package/dist/foundation/colors/token/component.js.map +1 -1
- package/dist/foundation/colors/token/core.js +21 -0
- package/dist/foundation/colors/token/core.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/components/Button/Button.styled.d.ts +35 -50
- package/dist/types/components/Chip/Chip.styled.d.ts +4 -76
- package/dist/types/components/Chip/Chip.types.d.ts +1 -1
- package/dist/types/components/Dialog/Dialog.d.ts +0 -3
- package/dist/types/components/Dropdown/Dropdown.d.ts +3 -1
- package/dist/types/components/Dropdown/Dropdown.styled.d.ts +7 -0
- package/dist/types/components/Dropdown/Dropdown.types.d.ts +11 -0
- package/dist/types/components/Dropdown/DropdownItem.d.ts +13 -0
- package/dist/types/components/Dropdown/index.d.ts +2 -0
- package/dist/types/components/TextField/TextField.types.d.ts +1 -1
- package/dist/types/components/TextField/TextFieldIcon.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +1 -32
- package/dist/types/components/Typography/Typography.d.ts +1 -1
- package/dist/types/foundation/Typography/index.d.ts +21 -1
- package/dist/types/foundation/Typography/tokens.d.ts +15 -0
- package/dist/types/foundation/colors/base/blue.d.ts +2 -0
- package/dist/types/foundation/colors/base/green.d.ts +2 -0
- package/dist/types/foundation/colors/base/grey.d.ts +15 -0
- package/dist/types/foundation/colors/base/lunitTeal.d.ts +2 -0
- package/dist/types/foundation/colors/base/magenta.d.ts +2 -0
- package/dist/types/foundation/colors/base/orange.d.ts +2 -0
- package/dist/types/foundation/colors/base/purple.d.ts +2 -0
- package/dist/types/foundation/colors/base/red.d.ts +2 -0
- package/dist/types/foundation/colors/base/yellow.d.ts +2 -0
- package/dist/types/foundation/colors/index.d.ts +3 -0
- package/dist/types/foundation/colors/types.d.ts +3 -0
- package/dist/types/foundation/index.d.ts +3 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +20 -22
- package/src/components/Chip/Chip.styled.ts +9 -16
- package/src/components/Chip/Chip.types.ts +2 -0
- package/src/components/Dialog/Dialog.tsx +0 -8
- package/src/components/Dropdown/Dropdown.styled.tsx +170 -0
- package/src/components/Dropdown/Dropdown.tsx +59 -8
- package/src/components/Dropdown/Dropdown.types.ts +17 -0
- package/src/components/Dropdown/DropdownItem.tsx +107 -0
- package/src/components/Dropdown/index.ts +6 -0
- package/src/components/TextField/TextField.style.ts +28 -3
- package/src/components/TextField/TextField.tsx +1 -7
- package/src/components/TextField/TextField.types.ts +2 -0
- package/src/components/TextField/TextFieldIcon.tsx +1 -1
- package/src/foundation/Typography/index.ts +10 -0
- package/src/foundation/Typography/tokens.ts +45 -0
- package/src/foundation/colors/base/blue.ts +12 -10
- package/src/foundation/colors/base/green.ts +11 -9
- package/src/foundation/colors/base/grey.ts +30 -15
- package/src/foundation/colors/base/lunitTeal.ts +2 -0
- package/src/foundation/colors/base/magenta.ts +3 -1
- package/src/foundation/colors/base/orange.ts +11 -9
- package/src/foundation/colors/base/purple.ts +3 -1
- package/src/foundation/colors/base/red.ts +5 -3
- package/src/foundation/colors/base/yellow.ts +12 -10
- package/src/foundation/colors/index.ts +3 -0
- package/src/foundation/colors/token/component.ts +26 -22
- package/src/foundation/colors/token/core.ts +21 -0
- package/src/foundation/colors/types.ts +3 -0
- package/src/index.ts +6 -1
- package/src/stories/GettingStarted.mdx +10 -16
- package/src/stories/components/Alert/Alert.stories.tsx +3 -3
- package/src/stories/components/Button/BasicButton.stories.tsx +2 -2
- package/src/stories/components/Button/ButtonDocs.mdx +1 -1
- package/src/stories/components/Button/Color.stories.tsx +2 -2
- package/src/stories/components/Button/IconButton.stories.tsx +2 -2
- package/src/stories/components/Button/Kind.stories.tsx +2 -2
- package/src/stories/components/CheckBox/BasicCheckbox.stories.tsx +2 -2
- package/src/stories/components/CheckBox/CheckboxDocs.mdx +1 -1
- package/src/stories/components/Chip/Chip.stories.tsx +20 -2
- package/src/stories/components/Chip/ChipDocs.mdx +21 -1
- package/src/stories/components/DataTable/DataTable.stories.tsx +1 -1
- package/src/stories/components/DatePicker/DatePicker.stories.tsx +1 -1
- package/src/stories/components/Dialog/Dialog.stories.tsx +19 -8
- package/src/stories/components/Dialog/DialogDocs.mdx +3 -11
- package/src/stories/components/Dropdown/Dropdown.stories.tsx +299 -10
- package/src/stories/components/Dropdown/DropdownExamples.stories.tsx +221 -0
- package/src/stories/components/Dropdown/DropdownItem.stories.tsx +360 -0
- package/src/stories/components/SelectControl/RadioGroup.stories.tsx +1 -1
- package/src/stories/components/SelectControl/RadioStatus.stories.tsx +1 -1
- package/src/stories/components/SelectControl/Toggle.stories.tsx +2 -2
- package/src/stories/components/TextField/BasicTextField.stories.tsx +37 -16
- package/src/stories/components/TextField/TextFieldDocs.mdx +13 -1
- package/src/stories/components/TextField/TextFieldMulti.stories.tsx +8 -11
- package/src/stories/components/TextField/TextFieldSingle.stories.tsx +8 -11
- package/src/stories/components/TextField/TextFieldSize.stories.tsx +7 -8
- package/src/stories/components/Toast/Toast.stories.tsx +8 -3
- package/src/stories/components/ToggleButton/Basic.stories.tsx +152 -113
- package/src/stories/components/ToggleButton/ToggleButtonDocs.mdx +1 -1
- package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +5 -5
- package/src/stories/components/ToggleButton/WithIcon.stories.tsx +2 -2
- package/src/stories/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/stories/foundation/Elevation/Elevation.stories.tsx +1 -20
- package/src/stories/foundation/Typography/Typography.mdx +1 -1
- package/src/stories/foundation/Typography/Typography.stories.tsx +14 -1
- package/src/stories/foundation/Typography/const.ts +6 -1
- package/src/stories/foundation/colors/Colors.stories.tsx +2 -2
- package/src/stories/foundation/colors/Docs.mdx +1 -1
- package/src/stories/foundation/colors/Mui.stories.tsx +1 -1
- package/src/stories/foundation/colors/Token.inComponent.stories.tsx +1 -1
- package/src/stories/foundation/colors/TokenPaletteTable.stories.tsx +1 -1
- package/src/stories/foundation/colors/TokenPaletteTable.tsx +19 -1
- package/tsconfig.json +0 -1
- package/dist/cjs/components/Modal/index.js +0 -2
- package/dist/cjs/components/Modal/index.js.map +0 -1
- package/dist/components/Modal/Modal.js +0 -7
- package/dist/components/Modal/Modal.js.map +0 -1
- package/dist/components/Modal/index.js +0 -2
- package/dist/components/Modal/index.js.map +0 -1
- package/dist/types/components/Modal/Modal.d.ts +0 -2
- package/dist/types/components/Modal/index.d.ts +0 -1
- package/src/stories/components/ToggleButton/Group.stories.tsx +0 -221
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const lunit_teal: {
|
|
2
2
|
5: string;
|
|
3
3
|
10: string;
|
|
4
|
+
15: string;
|
|
4
5
|
20: string;
|
|
5
6
|
30: string;
|
|
6
7
|
40: string;
|
|
@@ -13,6 +14,7 @@ export declare const lunit_teal: {
|
|
|
13
14
|
export declare const lunit_tealText: {
|
|
14
15
|
5: string;
|
|
15
16
|
10: string;
|
|
17
|
+
15: string;
|
|
16
18
|
20: string;
|
|
17
19
|
30: string;
|
|
18
20
|
40: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const magenta: {
|
|
2
2
|
5: string;
|
|
3
3
|
10: string;
|
|
4
|
+
15: string;
|
|
4
5
|
20: string;
|
|
5
6
|
30: string;
|
|
6
7
|
40: string;
|
|
@@ -13,6 +14,7 @@ export declare const magenta: {
|
|
|
13
14
|
export declare const magentaText: {
|
|
14
15
|
5: string;
|
|
15
16
|
10: string;
|
|
17
|
+
15: string;
|
|
16
18
|
20: string;
|
|
17
19
|
30: string;
|
|
18
20
|
40: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const orange: {
|
|
2
2
|
5: string;
|
|
3
3
|
10: string;
|
|
4
|
+
15: string;
|
|
4
5
|
20: string;
|
|
5
6
|
30: string;
|
|
6
7
|
40: string;
|
|
@@ -13,6 +14,7 @@ export declare const orange: {
|
|
|
13
14
|
export declare const orangeText: {
|
|
14
15
|
5: string;
|
|
15
16
|
10: string;
|
|
17
|
+
15: string;
|
|
16
18
|
20: string;
|
|
17
19
|
30: string;
|
|
18
20
|
40: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const purple: {
|
|
2
2
|
5: string;
|
|
3
3
|
10: string;
|
|
4
|
+
15: string;
|
|
4
5
|
20: string;
|
|
5
6
|
30: string;
|
|
6
7
|
40: string;
|
|
@@ -13,6 +14,7 @@ export declare const purple: {
|
|
|
13
14
|
export declare const purpleText: {
|
|
14
15
|
5: string;
|
|
15
16
|
10: string;
|
|
17
|
+
15: string;
|
|
16
18
|
20: string;
|
|
17
19
|
30: string;
|
|
18
20
|
40: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const red: {
|
|
2
2
|
5: string;
|
|
3
3
|
10: string;
|
|
4
|
+
15: string;
|
|
4
5
|
20: string;
|
|
5
6
|
30: string;
|
|
6
7
|
40: string;
|
|
@@ -13,6 +14,7 @@ export declare const red: {
|
|
|
13
14
|
export declare const redText: {
|
|
14
15
|
5: string;
|
|
15
16
|
10: string;
|
|
17
|
+
15: string;
|
|
16
18
|
20: string;
|
|
17
19
|
30: string;
|
|
18
20
|
40: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const yellow: {
|
|
2
2
|
5: string;
|
|
3
3
|
10: string;
|
|
4
|
+
15: string;
|
|
4
5
|
20: string;
|
|
5
6
|
30: string;
|
|
6
7
|
40: string;
|
|
@@ -13,6 +14,7 @@ export declare const yellow: {
|
|
|
13
14
|
export declare const yellowText: {
|
|
14
15
|
5: string;
|
|
15
16
|
10: string;
|
|
17
|
+
15: string;
|
|
16
18
|
20: string;
|
|
17
19
|
30: string;
|
|
18
20
|
40: string;
|
|
@@ -125,8 +125,11 @@ declare const paletteOptions: {
|
|
|
125
125
|
icon_warning_02: string;
|
|
126
126
|
icon_info_02: string;
|
|
127
127
|
hover: string;
|
|
128
|
+
status_hover: string;
|
|
128
129
|
focused: string;
|
|
130
|
+
status_focused: string;
|
|
129
131
|
selected: string;
|
|
132
|
+
status_selected: string;
|
|
130
133
|
shadow_01: string;
|
|
131
134
|
shadow_02: string;
|
|
132
135
|
shadow_03: string;
|
|
@@ -20,8 +20,11 @@ export interface ColorToken {
|
|
|
20
20
|
icon_warning_02: string;
|
|
21
21
|
icon_info_02: string;
|
|
22
22
|
hover: string;
|
|
23
|
+
status_hover: string;
|
|
23
24
|
focused: string;
|
|
25
|
+
status_focused: string;
|
|
24
26
|
selected: string;
|
|
27
|
+
status_selected: string;
|
|
25
28
|
shadow_01: string;
|
|
26
29
|
shadow_02: string;
|
|
27
30
|
shadow_03: string;
|
|
@@ -76,8 +76,11 @@ export declare const palette: {
|
|
|
76
76
|
icon_warning_02: string;
|
|
77
77
|
icon_info_02: string;
|
|
78
78
|
hover: string;
|
|
79
|
+
status_hover: string;
|
|
79
80
|
focused: string;
|
|
81
|
+
status_focused: string;
|
|
80
82
|
selected: string;
|
|
83
|
+
status_selected: string;
|
|
81
84
|
shadow_01: string;
|
|
82
85
|
shadow_02: string;
|
|
83
86
|
shadow_03: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { default as Checkbox } from "./components/Checkbox";
|
|
|
7
7
|
export { default as Dialog } from "./components/Dialog";
|
|
8
8
|
export { default as DataTable } from "./components/DataTable";
|
|
9
9
|
export { default as DatePicker } from "./components/DatePicker";
|
|
10
|
-
export { default as Dropdown } from "./components/Dropdown";
|
|
10
|
+
export { default as Dropdown, DropdownItem, DropdownDivider, DropdownSubtitle, } from "./components/Dropdown";
|
|
11
11
|
export { default as FormLabel } from "./components/FormLabel";
|
|
12
12
|
export { default as Radio } from "./components/Radio";
|
|
13
13
|
export { default as RadioGroup } from "./components/RadioGroup";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunit/design-system",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Lunit Design System",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -56,37 +56,35 @@
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=20.0.0"
|
|
61
|
+
},
|
|
59
62
|
"devDependencies": {
|
|
60
63
|
"@babel/core": "^7.17.10",
|
|
61
64
|
"@babel/preset-env": "^7.21.4",
|
|
62
65
|
"@babel/preset-react": "^7.18.6",
|
|
63
66
|
"@babel/preset-typescript": "^7.21.4",
|
|
64
|
-
"@emotion/react": "
|
|
67
|
+
"@emotion/react": "11.14.0",
|
|
65
68
|
"@emotion/styled": "^11.8.1",
|
|
66
|
-
"@mui/icons-material": "
|
|
67
|
-
"@mui/material": "
|
|
69
|
+
"@mui/icons-material": "5.18.0",
|
|
70
|
+
"@mui/material": "5.18.0",
|
|
68
71
|
"@mui/utils": "^5.11.3",
|
|
69
|
-
"@
|
|
70
|
-
"@storybook/addon-
|
|
71
|
-
"@storybook/addon-
|
|
72
|
-
"@storybook/
|
|
73
|
-
"@storybook/addon-links": "^7.0.21",
|
|
74
|
-
"@storybook/addon-storysource": "^7.0.21",
|
|
75
|
-
"@storybook/blocks": "^7.0.21",
|
|
76
|
-
"@storybook/react": "^7.0.21",
|
|
77
|
-
"@storybook/react-webpack5": "^7.0.21",
|
|
78
|
-
"@storybook/testing-library": "^0.1.0",
|
|
79
|
-
"@storybook/theming": "^7.0.21",
|
|
72
|
+
"@storybook/addon-docs": "9.1.2",
|
|
73
|
+
"@storybook/addon-links": "9.1.2",
|
|
74
|
+
"@storybook/addon-webpack5-compiler-babel": "^3.0.6",
|
|
75
|
+
"@storybook/react-webpack5": "9.1.2",
|
|
80
76
|
"@types/lodash": "^4.14.182",
|
|
77
|
+
"@types/react": "19.0.0",
|
|
78
|
+
"@types/react-dom": "19.0.0",
|
|
81
79
|
"babel-loader": "^8.2.5",
|
|
82
80
|
"chromatic": "^6.7.0",
|
|
83
81
|
"dayjs": "^1.11.7",
|
|
84
82
|
"lodash": "^4.17.21",
|
|
85
83
|
"mustache": "^4.2.0",
|
|
86
|
-
"react": "
|
|
87
|
-
"react-dom": "
|
|
88
|
-
"storybook": "
|
|
89
|
-
"storybook-addon-pseudo-states": "^
|
|
84
|
+
"react": "19.0.0",
|
|
85
|
+
"react-dom": "19.0.0",
|
|
86
|
+
"storybook": "9.1.2",
|
|
87
|
+
"storybook-addon-pseudo-states": "^9.1.2",
|
|
90
88
|
"ts-loader": "^9.3.0",
|
|
91
89
|
"typescript": "^4.6.4",
|
|
92
90
|
"webpack": "^5.72.0",
|
|
@@ -98,8 +96,8 @@
|
|
|
98
96
|
},
|
|
99
97
|
"peerDependencies": {
|
|
100
98
|
"@mui/material": "^5.0.0",
|
|
101
|
-
"@types/react": "^17.0.0 || ^18.0.0",
|
|
102
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
103
|
-
"react-dom": "^17.0.0 || ^18.0.0"
|
|
99
|
+
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
100
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
101
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
104
102
|
}
|
|
105
103
|
}
|
|
@@ -10,19 +10,14 @@ import type {
|
|
|
10
10
|
} from "./Chip.types";
|
|
11
11
|
|
|
12
12
|
const COMMON_STYLES = {
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
boxShadow: "none",
|
|
18
|
-
},
|
|
13
|
+
height: "22px",
|
|
14
|
+
width: "auto",
|
|
15
|
+
minWidth: "22px",
|
|
16
|
+
boxShadow: "none",
|
|
19
17
|
"&.Mui-disabled": {
|
|
20
18
|
opacity: 1,
|
|
21
19
|
},
|
|
22
20
|
"& .MuiChip-label": {
|
|
23
|
-
display: "flex",
|
|
24
|
-
alignItems: "center",
|
|
25
|
-
textAlign: "center",
|
|
26
21
|
padding: 0,
|
|
27
22
|
marginInline: "8px",
|
|
28
23
|
},
|
|
@@ -117,16 +112,14 @@ export const StyledContainedChipEnable = styled(StyledContainedChipBase, {
|
|
|
117
112
|
* Setting the z-index of the chip to 0 and the z-index of the pseudo element to -1
|
|
118
113
|
* allows the pseudo element(hover layer) to be rendered between the chip and the chip's children.
|
|
119
114
|
*/
|
|
120
|
-
"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
zIndex: 0,
|
|
125
|
-
},
|
|
115
|
+
position: "relative",
|
|
116
|
+
left: 0,
|
|
117
|
+
right: 0,
|
|
118
|
+
zIndex: 0,
|
|
126
119
|
"&:hover": {
|
|
127
120
|
backgroundColor: getColorToken("bg", theme, color),
|
|
128
121
|
},
|
|
129
|
-
"
|
|
122
|
+
"&:hover::before": {
|
|
130
123
|
position: "absolute",
|
|
131
124
|
zIndex: -1,
|
|
132
125
|
content: '""',
|
|
@@ -6,6 +6,8 @@ import type {
|
|
|
6
6
|
} from "@mui/material";
|
|
7
7
|
import type { OverridableComponent } from "@mui/material/OverridableComponent";
|
|
8
8
|
|
|
9
|
+
import type { JSX } from "react";
|
|
10
|
+
|
|
9
11
|
type DesignSystemChipKind = "outlined" | "contained";
|
|
10
12
|
type DesignSystemAndMuiContainedChipKind = "filled" | "contained";
|
|
11
13
|
type ColorKeys = keyof typeof CHIP_COLORS;
|
|
@@ -26,7 +26,6 @@ export interface DialogBase {
|
|
|
26
26
|
titleVariant?: TypographyProps["variant"];
|
|
27
27
|
children: React.ReactNode;
|
|
28
28
|
actions?: React.ReactNode;
|
|
29
|
-
enableBackButtonClose?: boolean; // only for passive dialog
|
|
30
29
|
enableBackdropClose?: boolean;
|
|
31
30
|
size?: "small" | "medium"; // default "small"
|
|
32
31
|
sx?: SxProps;
|
|
@@ -37,13 +36,11 @@ export interface DialogBase {
|
|
|
37
36
|
export interface PassiveDialogType extends DialogBase {
|
|
38
37
|
type: "passive";
|
|
39
38
|
actions?: undefined;
|
|
40
|
-
enableBackButtonClose?: true;
|
|
41
39
|
enableBackdropClose?: true;
|
|
42
40
|
}
|
|
43
41
|
export interface ActionDialogType extends DialogBase {
|
|
44
42
|
type: "action";
|
|
45
43
|
actions: React.ReactNode;
|
|
46
|
-
enableBackButtonClose?: false;
|
|
47
44
|
enableBackdropClose?: boolean;
|
|
48
45
|
}
|
|
49
46
|
|
|
@@ -89,16 +86,11 @@ function Dialog(props: DialogProps) {
|
|
|
89
86
|
function handleEscClose(event: KeyboardEvent) {
|
|
90
87
|
if (event.key === "Escape") onClose();
|
|
91
88
|
}
|
|
92
|
-
function handleBackButtonClose(event: KeyboardEvent) {
|
|
93
|
-
if (event.key === "Backspace") onClose();
|
|
94
|
-
}
|
|
95
89
|
|
|
96
90
|
document.addEventListener("keydown", handleEscClose);
|
|
97
|
-
document.addEventListener("keydown", handleBackButtonClose);
|
|
98
91
|
|
|
99
92
|
return () => {
|
|
100
93
|
document.removeEventListener("keydown", handleEscClose);
|
|
101
|
-
document.removeEventListener("keydown", handleBackButtonClose);
|
|
102
94
|
};
|
|
103
95
|
}, [isOpen, isPassiveModal, onClose]);
|
|
104
96
|
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import Box from "@mui/material/Box";
|
|
3
|
+
import Select from "@mui/material/Select";
|
|
4
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
5
|
+
|
|
6
|
+
import { DropdownProps } from "./Dropdown.types";
|
|
7
|
+
type StyledDropdownProps = Omit<DropdownProps, "size"> & {
|
|
8
|
+
selectSize: "small" | "medium" | "large";
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const valuesBySize = {
|
|
12
|
+
small: {
|
|
13
|
+
height: "28px",
|
|
14
|
+
padding: "4px 12px",
|
|
15
|
+
iconTop: "4px",
|
|
16
|
+
iconRight: "12px",
|
|
17
|
+
},
|
|
18
|
+
medium: {
|
|
19
|
+
height: "36px",
|
|
20
|
+
padding: "8px 16px",
|
|
21
|
+
iconTop: "8px",
|
|
22
|
+
iconRight: "16px",
|
|
23
|
+
},
|
|
24
|
+
large: {
|
|
25
|
+
height: "44px",
|
|
26
|
+
padding: "10px 16px",
|
|
27
|
+
iconTop: "12px", // large 의 text line height 가 medium, small 보다 4px 크기 때문에 그의 반절인 2px + padding 값 10px => 12px
|
|
28
|
+
iconRight: "16px",
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const StyledSelect = styled(Select, {
|
|
33
|
+
shouldForwardProp: (prop: string) => {
|
|
34
|
+
return !["selectSize", "select"].includes(prop);
|
|
35
|
+
},
|
|
36
|
+
})<StyledDropdownProps>(({ theme, selectSize }) => ({
|
|
37
|
+
...(selectSize === "large"
|
|
38
|
+
? { ...theme.typography.body1_16_regular }
|
|
39
|
+
: { ...theme.typography.body2_14_regular }),
|
|
40
|
+
height: valuesBySize[selectSize || "medium"].height,
|
|
41
|
+
padding: valuesBySize[selectSize || "medium"].padding,
|
|
42
|
+
backgroundColor: theme.palette.lunit_token.component.textfield_bg,
|
|
43
|
+
overflow: "hidden",
|
|
44
|
+
"& .MuiSelect-select": {
|
|
45
|
+
paddingTop: 0,
|
|
46
|
+
paddingBottom: 0,
|
|
47
|
+
paddingRight: "28px !important", // icon width 20px + 아이콘과 텍스트 사이의 gap 8px
|
|
48
|
+
color: theme.palette.lunit_token.core.text_normal,
|
|
49
|
+
},
|
|
50
|
+
"&.MuiInputBase-root": {
|
|
51
|
+
borderRadius: "8px",
|
|
52
|
+
border: "none",
|
|
53
|
+
|
|
54
|
+
"&:hover:not(.Mui-disabled, .Mui-error):before": {
|
|
55
|
+
border: "none",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
"& .MuiInput-input": {
|
|
59
|
+
"&:focus": {
|
|
60
|
+
backgroundColor: "transparent",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
"&::after": {
|
|
64
|
+
border: "none",
|
|
65
|
+
},
|
|
66
|
+
"&::before": {
|
|
67
|
+
border: "none",
|
|
68
|
+
},
|
|
69
|
+
"&:hover": {
|
|
70
|
+
position: "relative",
|
|
71
|
+
zIndex: 0,
|
|
72
|
+
backgroundColor: theme.palette.lunit_token.component.textfield_bg,
|
|
73
|
+
border: "none",
|
|
74
|
+
},
|
|
75
|
+
"&:hover::before": {
|
|
76
|
+
content: '""',
|
|
77
|
+
position: "absolute",
|
|
78
|
+
top: 0,
|
|
79
|
+
left: 0,
|
|
80
|
+
width: "100%",
|
|
81
|
+
height: "100%",
|
|
82
|
+
zIndex: -1,
|
|
83
|
+
backgroundColor: theme.palette.lunit_token.core.hover,
|
|
84
|
+
border: "none",
|
|
85
|
+
},
|
|
86
|
+
// .Mui-focused 컴포넌트에 바로 border를 적용하면 컴포넌트의 width, height 값이 border 값만큼 늘어나기 때문에 따로 엘리먼트를 만들어서 border 를 적용함.
|
|
87
|
+
// 다른 :before 들도 동일한 이유로 작성
|
|
88
|
+
"&.Mui-focused::before": {
|
|
89
|
+
border: `1px solid ${theme.palette.lunit_token.core.focused}`,
|
|
90
|
+
content: '""',
|
|
91
|
+
position: "absolute",
|
|
92
|
+
top: 0,
|
|
93
|
+
bottom: 0,
|
|
94
|
+
left: 0,
|
|
95
|
+
right: 0,
|
|
96
|
+
borderRadius: "8px",
|
|
97
|
+
transition: "none",
|
|
98
|
+
},
|
|
99
|
+
"&.Mui-disabled": {
|
|
100
|
+
opacity: 0.38,
|
|
101
|
+
},
|
|
102
|
+
"&.Mui-disabled:before": {
|
|
103
|
+
borderBottomStyle: "none",
|
|
104
|
+
},
|
|
105
|
+
"&.Mui-error::before": {
|
|
106
|
+
border: `1px solid ${theme.palette.lunit_token.component.textfield_border_error}`,
|
|
107
|
+
content: '""',
|
|
108
|
+
position: "absolute",
|
|
109
|
+
top: 0,
|
|
110
|
+
bottom: 0,
|
|
111
|
+
left: 0,
|
|
112
|
+
right: 0,
|
|
113
|
+
borderRadius: "8px",
|
|
114
|
+
transition: "none",
|
|
115
|
+
},
|
|
116
|
+
"& .MuiSvgIcon-root": {
|
|
117
|
+
width: "20px",
|
|
118
|
+
height: "20px",
|
|
119
|
+
top: valuesBySize[selectSize || "medium"].iconTop, // mui 에서 이 icon position 이 position: absolute 로 되어 있어서 padding 값에 맞춰 포지션 조절
|
|
120
|
+
right: valuesBySize[selectSize || "medium"].iconRight,
|
|
121
|
+
color: theme.palette.lunit_token.core.text_normal,
|
|
122
|
+
"&.Mui-disabled": {
|
|
123
|
+
color: theme.palette.lunit_token.core.text_normal,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
}));
|
|
127
|
+
|
|
128
|
+
export const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
|
|
129
|
+
...theme.typography.body2_14_regular,
|
|
130
|
+
padding: "8px",
|
|
131
|
+
borderRadius: "8px",
|
|
132
|
+
color: theme.palette.lunit_token.core.text_normal,
|
|
133
|
+
backgroundColor: "transparent",
|
|
134
|
+
display: "flex",
|
|
135
|
+
flexDirection: "row",
|
|
136
|
+
justifyContent: "space-between",
|
|
137
|
+
gap: "8px",
|
|
138
|
+
"&:hover": {
|
|
139
|
+
backgroundColor: theme.palette.lunit_token.core.hover,
|
|
140
|
+
},
|
|
141
|
+
"&.Mui-focusVisible": {
|
|
142
|
+
backgroundColor: "transparent",
|
|
143
|
+
"&:hover": {
|
|
144
|
+
backgroundColor: theme.palette.lunit_token.core.hover,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
// TODO: 디자이너와 focus 디자인 확인 후 살리든 지우든 하기
|
|
148
|
+
// "&:focus::before": {
|
|
149
|
+
// border: "1px solid",
|
|
150
|
+
// borderColor: theme.palette.lunit_token.core.focused,
|
|
151
|
+
// content: '""',
|
|
152
|
+
// position: "absolute",
|
|
153
|
+
// top: 0,
|
|
154
|
+
// bottom: 0,
|
|
155
|
+
// left: -8,
|
|
156
|
+
// right: -8,
|
|
157
|
+
// },
|
|
158
|
+
"& .multipleChecked": {
|
|
159
|
+
display: "none",
|
|
160
|
+
},
|
|
161
|
+
"&.filledStyle": {
|
|
162
|
+
backgroundColor: theme.palette.lunit_token.core.selected,
|
|
163
|
+
},
|
|
164
|
+
}));
|
|
165
|
+
|
|
166
|
+
export const StyledIconWrapper = styled(Box)({
|
|
167
|
+
width: "20px",
|
|
168
|
+
height: "20px",
|
|
169
|
+
marginRight: "8px",
|
|
170
|
+
});
|
|
@@ -1,11 +1,62 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import ArrowDownSm from "@lunit/design-system-icons/ArrowDownSm";
|
|
3
|
+
import { DropdownProps } from "./Dropdown.types";
|
|
4
|
+
import { StyledSelect } from "./Dropdown.styled";
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
const Dropdown = forwardRef((props: DropdownProps, ref) => {
|
|
7
|
+
const {
|
|
8
|
+
select = "single",
|
|
9
|
+
size = "medium",
|
|
10
|
+
className,
|
|
11
|
+
children,
|
|
12
|
+
sx,
|
|
13
|
+
...restProps
|
|
14
|
+
} = props;
|
|
4
15
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
16
|
+
return (
|
|
17
|
+
<StyledSelect
|
|
18
|
+
className={className}
|
|
19
|
+
variant="standard" // variant standard 기준으로 스타일링 되어있음. 다른 variant 사용 시 스타일이 틀어질 수 있음
|
|
20
|
+
multiple={select === "multiple"}
|
|
21
|
+
IconComponent={(props) => <ArrowDownSm {...props} />}
|
|
22
|
+
MenuProps={{
|
|
23
|
+
anchorOrigin: {
|
|
24
|
+
vertical: "bottom",
|
|
25
|
+
horizontal: "left",
|
|
26
|
+
},
|
|
27
|
+
transformOrigin: {
|
|
28
|
+
vertical: "top",
|
|
29
|
+
horizontal: "left",
|
|
30
|
+
},
|
|
31
|
+
PaperProps: {
|
|
32
|
+
sx: {
|
|
33
|
+
marginTop: "4px",
|
|
34
|
+
padding: "0px 8px",
|
|
35
|
+
borderRadius: "8px",
|
|
36
|
+
backgroundColor: (theme) => theme.palette.lunit_token.core.bg_02,
|
|
37
|
+
},
|
|
38
|
+
className: `elevation2 ${className || "light1"}`,
|
|
39
|
+
},
|
|
40
|
+
MenuListProps: {
|
|
41
|
+
// 추후 MUI 버전 업그레이드 시 MenuListProps 변경 필요. Deprecated-use the slotProps.list prop instead. https://mui.com/material-ui/api/menu/ 의 MenuListProps 참고
|
|
42
|
+
sx: {
|
|
43
|
+
"& .singleChecked": {
|
|
44
|
+
display: select === "single" ? "inherit" : "none",
|
|
45
|
+
},
|
|
46
|
+
"& .multipleChecked": {
|
|
47
|
+
display: select === "multiple" ? "inherit !important" : "none",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
}}
|
|
52
|
+
sx={sx}
|
|
53
|
+
selectSize={size}
|
|
54
|
+
{...restProps}
|
|
55
|
+
ref={ref}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</StyledSelect>
|
|
59
|
+
);
|
|
60
|
+
});
|
|
10
61
|
|
|
11
|
-
export default Dropdown
|
|
62
|
+
export default Dropdown;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MenuItemProps, SelectProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
import type { JSX } from "react";
|
|
4
|
+
|
|
5
|
+
export interface DropdownProps
|
|
6
|
+
extends Omit<SelectProps, "size" | "variant" | "placeholder"> {
|
|
7
|
+
// mui variant 를 바꾸게 되면 스타일이 틀어질 수 있어서 variant 를 아예 사용하지 못하게 props 에서 제거
|
|
8
|
+
// mui select 에서는 placeholder 가 동작하지 않기 때문에 유저가 헷갈리지 않게 props 에서 제거
|
|
9
|
+
select?: "single" | "multiple";
|
|
10
|
+
size?: "small" | "medium" | "large";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface DropdownItemProps extends MenuItemProps {
|
|
14
|
+
leftIcon?: JSX.Element;
|
|
15
|
+
rightText?: string;
|
|
16
|
+
isFilledStyle?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Divider, ListSubheader, SxProps } from "@mui/material";
|
|
3
|
+
import Check from "@lunit/design-system-icons/Check";
|
|
4
|
+
|
|
5
|
+
import Checkbox from "../Checkbox";
|
|
6
|
+
import Typography from "../Typography";
|
|
7
|
+
|
|
8
|
+
import { DropdownItemProps } from "./Dropdown.types";
|
|
9
|
+
import { StyledIconWrapper, StyledMenuItem } from "./Dropdown.styled";
|
|
10
|
+
|
|
11
|
+
export function DropdownItem(props: DropdownItemProps) {
|
|
12
|
+
const {
|
|
13
|
+
leftIcon,
|
|
14
|
+
rightText,
|
|
15
|
+
selected,
|
|
16
|
+
isFilledStyle, // 체크 아이콘이나 체크박스 대신 bg 색깔로 선택된 상태를 표현하기 위한 prop. 일부 상황에서만 사용되고 대부분은 체크 아이콘이나 체크박스 사용
|
|
17
|
+
children,
|
|
18
|
+
sx,
|
|
19
|
+
...restProps
|
|
20
|
+
} = props;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<StyledMenuItem
|
|
24
|
+
className={isFilledStyle && selected ? "filledStyle" : undefined}
|
|
25
|
+
sx={sx}
|
|
26
|
+
{...restProps}
|
|
27
|
+
>
|
|
28
|
+
<Box
|
|
29
|
+
sx={{
|
|
30
|
+
display: "flex",
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
justifyContent: "flex-start",
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
{!isFilledStyle && (
|
|
36
|
+
<>
|
|
37
|
+
<StyledIconWrapper className="singleChecked">
|
|
38
|
+
{selected && <Check fontSize="small" />}
|
|
39
|
+
</StyledIconWrapper>
|
|
40
|
+
<Checkbox
|
|
41
|
+
className="multipleChecked"
|
|
42
|
+
sx={{ mr: 2 }}
|
|
43
|
+
checked={selected}
|
|
44
|
+
/>
|
|
45
|
+
</>
|
|
46
|
+
)}
|
|
47
|
+
{leftIcon && (
|
|
48
|
+
<StyledIconWrapper>
|
|
49
|
+
{leftIcon}
|
|
50
|
+
{/* <Demo fontSize="small" /> // TODO: icon fontSize 가 항상 small(width, height: 20px) 이어야함. 여기서 값을 고정시킬 방법은?
|
|
51
|
+
*/}
|
|
52
|
+
</StyledIconWrapper>
|
|
53
|
+
)}
|
|
54
|
+
{children}
|
|
55
|
+
</Box>
|
|
56
|
+
<Box>
|
|
57
|
+
{rightText && (
|
|
58
|
+
<Typography
|
|
59
|
+
variant="body2_14_medium"
|
|
60
|
+
sx={{
|
|
61
|
+
color: (theme) => theme.palette.lunit_token.core.text_light,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{rightText}
|
|
65
|
+
</Typography>
|
|
66
|
+
)}
|
|
67
|
+
</Box>
|
|
68
|
+
</StyledMenuItem>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function DropdownDivider({ sx }: { sx?: SxProps }) {
|
|
73
|
+
return (
|
|
74
|
+
<Divider
|
|
75
|
+
sx={{
|
|
76
|
+
margin: "8px -8px",
|
|
77
|
+
borderColor: (theme) =>
|
|
78
|
+
theme.palette.lunit_token.component.dropdown_divider_border,
|
|
79
|
+
...sx,
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function DropdownSubtitle({
|
|
86
|
+
title,
|
|
87
|
+
sx,
|
|
88
|
+
}: {
|
|
89
|
+
title: string;
|
|
90
|
+
sx?: SxProps;
|
|
91
|
+
}) {
|
|
92
|
+
return (
|
|
93
|
+
<ListSubheader
|
|
94
|
+
sx={{
|
|
95
|
+
typography: "body3_12_semibold",
|
|
96
|
+
padding: "4px 8px",
|
|
97
|
+
color: (theme) => theme.palette.lunit_token.core.text_light,
|
|
98
|
+
backgroundColor: "transparent",
|
|
99
|
+
...sx,
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
{title}
|
|
103
|
+
</ListSubheader>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
// 참조 : https://mui.com/material-ui/react-select/#grouping
|
|
107
|
+
DropdownSubtitle.muiSkipListHighlight = true;
|