@lunit/design-system 2.0.1 → 2.1.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.
Files changed (138) hide show
  1. package/README.md +107 -7
  2. package/dist/cjs/components/Checkbox/index.js +1 -1
  3. package/dist/cjs/components/Checkbox/index.js.map +1 -1
  4. package/dist/cjs/components/Chip/index.js +1 -1
  5. package/dist/cjs/components/Chip/index.js.map +1 -1
  6. package/dist/cjs/components/Dialog/index.js +1 -1
  7. package/dist/cjs/components/Dialog/index.js.map +1 -1
  8. package/dist/cjs/components/Dropdown/index.js +1 -1
  9. package/dist/cjs/components/Dropdown/index.js.map +1 -1
  10. package/dist/cjs/components/Radio/index.js +1 -1
  11. package/dist/cjs/components/Radio/index.js.map +1 -1
  12. package/dist/cjs/components/TextField/index.js +1 -1
  13. package/dist/cjs/components/TextField/index.js.map +1 -1
  14. package/dist/cjs/index.js +1 -1
  15. package/dist/cjs/index.js.map +1 -1
  16. package/dist/components/Checkbox/Checkbox.js +2 -2
  17. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  18. package/dist/components/Chip/Chip.styled.js +9 -16
  19. package/dist/components/Chip/Chip.styled.js.map +1 -1
  20. package/dist/components/Dialog/Dialog.js +0 -6
  21. package/dist/components/Dialog/Dialog.js.map +1 -1
  22. package/dist/components/Dropdown/Dropdown.js +37 -4
  23. package/dist/components/Dropdown/Dropdown.js.map +1 -1
  24. package/dist/components/Dropdown/Dropdown.styled.js +161 -0
  25. package/dist/components/Dropdown/Dropdown.styled.js.map +1 -0
  26. package/dist/components/Dropdown/Dropdown.types.js +2 -0
  27. package/dist/components/Dropdown/Dropdown.types.js.map +1 -0
  28. package/dist/components/Dropdown/DropdownItem.js +36 -0
  29. package/dist/components/Dropdown/DropdownItem.js.map +1 -0
  30. package/dist/components/Dropdown/index.js +1 -0
  31. package/dist/components/Dropdown/index.js.map +1 -1
  32. package/dist/components/Radio/Radio.js +2 -2
  33. package/dist/components/Radio/Radio.js.map +1 -1
  34. package/dist/components/TextField/TextField.js +1 -1
  35. package/dist/components/TextField/TextField.js.map +1 -1
  36. package/dist/components/TextField/TextField.style.js +27 -3
  37. package/dist/components/TextField/TextField.style.js.map +1 -1
  38. package/dist/foundation/Typography/index.js +5 -0
  39. package/dist/foundation/Typography/index.js.map +1 -1
  40. package/dist/foundation/Typography/tokens.js +44 -0
  41. package/dist/foundation/Typography/tokens.js.map +1 -1
  42. package/dist/foundation/colors/base/blue.js +12 -10
  43. package/dist/foundation/colors/base/blue.js.map +1 -1
  44. package/dist/foundation/colors/base/green.js +11 -9
  45. package/dist/foundation/colors/base/green.js.map +1 -1
  46. package/dist/foundation/colors/base/grey.js +30 -15
  47. package/dist/foundation/colors/base/grey.js.map +1 -1
  48. package/dist/foundation/colors/base/lunitTeal.js +2 -0
  49. package/dist/foundation/colors/base/lunitTeal.js.map +1 -1
  50. package/dist/foundation/colors/base/magenta.js +3 -1
  51. package/dist/foundation/colors/base/magenta.js.map +1 -1
  52. package/dist/foundation/colors/base/orange.js +11 -9
  53. package/dist/foundation/colors/base/orange.js.map +1 -1
  54. package/dist/foundation/colors/base/purple.js +3 -1
  55. package/dist/foundation/colors/base/purple.js.map +1 -1
  56. package/dist/foundation/colors/base/red.js +5 -3
  57. package/dist/foundation/colors/base/red.js.map +1 -1
  58. package/dist/foundation/colors/base/yellow.js +12 -10
  59. package/dist/foundation/colors/base/yellow.js.map +1 -1
  60. package/dist/foundation/colors/index.js +3 -0
  61. package/dist/foundation/colors/index.js.map +1 -1
  62. package/dist/foundation/colors/token/component.js +26 -22
  63. package/dist/foundation/colors/token/component.js.map +1 -1
  64. package/dist/foundation/colors/token/core.js +21 -0
  65. package/dist/foundation/colors/token/core.js.map +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/index.js.map +1 -1
  68. package/dist/types/components/Button/Button.styled.d.ts +3 -3
  69. package/dist/types/components/Chip/Chip.styled.d.ts +8 -8
  70. package/dist/types/components/Dialog/Dialog.d.ts +0 -3
  71. package/dist/types/components/Dropdown/Dropdown.d.ts +3 -1
  72. package/dist/types/components/Dropdown/Dropdown.styled.d.ts +41 -0
  73. package/dist/types/components/Dropdown/Dropdown.types.d.ts +11 -0
  74. package/dist/types/components/Dropdown/DropdownItem.d.ts +13 -0
  75. package/dist/types/components/Dropdown/index.d.ts +2 -0
  76. package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -2
  77. package/dist/types/foundation/Typography/index.d.ts +21 -1
  78. package/dist/types/foundation/Typography/tokens.d.ts +15 -0
  79. package/dist/types/foundation/colors/base/blue.d.ts +2 -0
  80. package/dist/types/foundation/colors/base/green.d.ts +2 -0
  81. package/dist/types/foundation/colors/base/grey.d.ts +15 -0
  82. package/dist/types/foundation/colors/base/lunitTeal.d.ts +2 -0
  83. package/dist/types/foundation/colors/base/magenta.d.ts +2 -0
  84. package/dist/types/foundation/colors/base/orange.d.ts +2 -0
  85. package/dist/types/foundation/colors/base/purple.d.ts +2 -0
  86. package/dist/types/foundation/colors/base/red.d.ts +2 -0
  87. package/dist/types/foundation/colors/base/yellow.d.ts +2 -0
  88. package/dist/types/foundation/colors/index.d.ts +3 -0
  89. package/dist/types/foundation/colors/types.d.ts +3 -0
  90. package/dist/types/foundation/index.d.ts +3 -0
  91. package/dist/types/index.d.ts +1 -1
  92. package/package.json +2 -2
  93. package/src/components/Checkbox/Checkbox.tsx +4 -4
  94. package/src/components/Chip/Chip.styled.ts +9 -16
  95. package/src/components/Dialog/Dialog.tsx +0 -8
  96. package/src/components/Dropdown/Dropdown.styled.tsx +170 -0
  97. package/src/components/Dropdown/Dropdown.tsx +59 -8
  98. package/src/components/Dropdown/Dropdown.types.ts +15 -0
  99. package/src/components/Dropdown/DropdownItem.tsx +107 -0
  100. package/src/components/Dropdown/index.ts +6 -0
  101. package/src/components/Radio/Radio.tsx +4 -4
  102. package/src/components/TextField/TextField.style.ts +28 -3
  103. package/src/components/TextField/TextField.tsx +1 -7
  104. package/src/foundation/Typography/index.ts +10 -0
  105. package/src/foundation/Typography/tokens.ts +45 -0
  106. package/src/foundation/colors/base/blue.ts +12 -10
  107. package/src/foundation/colors/base/green.ts +11 -9
  108. package/src/foundation/colors/base/grey.ts +30 -15
  109. package/src/foundation/colors/base/lunitTeal.ts +2 -0
  110. package/src/foundation/colors/base/magenta.ts +3 -1
  111. package/src/foundation/colors/base/orange.ts +11 -9
  112. package/src/foundation/colors/base/purple.ts +3 -1
  113. package/src/foundation/colors/base/red.ts +5 -3
  114. package/src/foundation/colors/base/yellow.ts +12 -10
  115. package/src/foundation/colors/index.ts +3 -0
  116. package/src/foundation/colors/token/component.ts +26 -22
  117. package/src/foundation/colors/token/core.ts +21 -0
  118. package/src/foundation/colors/types.ts +3 -0
  119. package/src/index.ts +6 -1
  120. package/src/stories/components/Chip/Chip.stories.tsx +18 -0
  121. package/src/stories/components/Chip/ChipDocs.mdx +20 -0
  122. package/src/stories/components/Dialog/DialogDocs.mdx +2 -10
  123. package/src/stories/components/Dropdown/Dropdown.stories.tsx +299 -10
  124. package/src/stories/components/Dropdown/DropdownExamples.stories.tsx +221 -0
  125. package/src/stories/components/Dropdown/DropdownItem.stories.tsx +360 -0
  126. package/src/stories/components/TextField/BasicTextField.stories.tsx +28 -0
  127. package/src/stories/components/TextField/TextFieldDocs.mdx +12 -0
  128. package/src/stories/foundation/Typography/Typography.stories.tsx +13 -0
  129. package/src/stories/foundation/Typography/const.ts +6 -1
  130. package/src/stories/foundation/colors/TokenPaletteTable.tsx +19 -1
  131. package/dist/cjs/components/Modal/index.js +0 -2
  132. package/dist/cjs/components/Modal/index.js.map +0 -1
  133. package/dist/components/Modal/Modal.js +0 -7
  134. package/dist/components/Modal/Modal.js.map +0 -1
  135. package/dist/components/Modal/index.js +0 -2
  136. package/dist/components/Modal/index.js.map +0 -1
  137. package/dist/types/components/Modal/Modal.d.ts +0 -2
  138. package/dist/types/components/Modal/index.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunit/design-system",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "Lunit Design System",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/index.js",
@@ -102,4 +102,4 @@
102
102
  "react": "^17.0.0 || ^18.0.0",
103
103
  "react-dom": "^17.0.0 || ^18.0.0"
104
104
  }
105
- }
105
+ }
@@ -41,8 +41,8 @@ const CheckedIcon = () => {
41
41
  fill="none"
42
42
  >
43
43
  <path
44
- fill-rule="evenodd"
45
- clip-rule="evenodd"
44
+ fillRule="evenodd"
45
+ clipRule="evenodd"
46
46
  d="M5 1C2.79086 1 1 2.79086 1 5V15C1 17.2091 2.79086 19 5 19H15C17.2091 19 19 17.2091 19 15V5C19 2.79086 17.2091 1 15 1H5ZM15.2516 8.14413C15.6074 7.72168 15.5533 7.09083 15.1309 6.73508C14.7084 6.37933 14.0776 6.43341 13.7218 6.85586L9.31824 12.0851L6.14993 9.37556C5.7302 9.01661 5.09895 9.06588 4.74 9.48561C4.38105 9.90533 4.43032 10.5366 4.85005 10.8955L8.78416 14.26C8.98672 14.4332 9.25006 14.5184 9.51571 14.4967C9.78135 14.4749 10.0273 14.348 10.199 14.1441L15.2516 8.14413Z"
47
47
  fill="#00C9EA"
48
48
  />
@@ -60,8 +60,8 @@ const IndeterminateIcon = () => {
60
60
  fill="none"
61
61
  >
62
62
  <path
63
- fill-rule="evenodd"
64
- clip-rule="evenodd"
63
+ fillRule="evenodd"
64
+ clipRule="evenodd"
65
65
  d="M5 1C2.79086 1 1 2.79086 1 5V15C1 17.2091 2.79086 19 5 19H15C17.2091 19 19 17.2091 19 15V5C19 2.79086 17.2091 1 15 1H5ZM5 9C4.44772 9 4 9.44771 4 10C4 10.5523 4.44771 11 5 11L15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9L5 9Z"
66
66
  fill="#00C9EA"
67
67
  />
@@ -10,19 +10,14 @@ import type {
10
10
  } from "./Chip.types";
11
11
 
12
12
  const COMMON_STYLES = {
13
- "&.MuiChip-root": {
14
- height: "22px",
15
- width: "auto",
16
- minWidth: "22px",
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
- "&.MuiChip-root": {
121
- position: "relative",
122
- left: 0,
123
- right: 0,
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
- "&.MuiChip-root:hover::before": {
122
+ "&:hover::before": {
130
123
  position: "absolute",
131
124
  zIndex: -1,
132
125
  content: '""',
@@ -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 'react'
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
- import { Box } from '@mui/material'
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
- const Dropdown = () => {
6
- return (
7
- <Box>Dropdown</Box>
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,15 @@
1
+ import type { MenuItemProps, SelectProps } from "@mui/material";
2
+
3
+ export interface DropdownProps
4
+ extends Omit<SelectProps, "size" | "variant" | "placeholder"> {
5
+ // mui variant 를 바꾸게 되면 스타일이 틀어질 수 있어서 variant 를 아예 사용하지 못하게 props 에서 제거
6
+ // mui select 에서는 placeholder 가 동작하지 않기 때문에 유저가 헷갈리지 않게 props 에서 제거
7
+ select?: "single" | "multiple";
8
+ size?: "small" | "medium" | "large";
9
+ }
10
+
11
+ export interface DropdownItemProps extends MenuItemProps {
12
+ leftIcon?: JSX.Element;
13
+ rightText?: string;
14
+ isFilledStyle?: boolean;
15
+ }
@@ -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;
@@ -1 +1,7 @@
1
1
  export { default } from "./Dropdown";
2
+ export {
3
+ DropdownItem,
4
+ DropdownDivider,
5
+ DropdownSubtitle,
6
+ } from "./DropdownItem";
7
+ export type { DropdownProps, DropdownItemProps } from "./Dropdown.types";
@@ -28,8 +28,8 @@ const DefaultIcon = () => {
28
28
  fill="none"
29
29
  >
30
30
  <path
31
- fill-rule="evenodd"
32
- clip-rule="evenodd"
31
+ fillRule="evenodd"
32
+ clipRule="evenodd"
33
33
  d="M10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5ZM10 19C14.9706 19 19 14.9706 19 10C19 5.02944 14.9706 1 10 1C5.02944 1 1 5.02944 1 10C1 14.9706 5.02944 19 10 19Z"
34
34
  fill="#99999B"
35
35
  />
@@ -47,8 +47,8 @@ const CheckedIcon = () => {
47
47
  fill="none"
48
48
  >
49
49
  <path
50
- fill-rule="evenodd"
51
- clip-rule="evenodd"
50
+ fillRule="evenodd"
51
+ clipRule="evenodd"
52
52
  d="M10 15C12.7614 15 15 12.7614 15 10C15 7.23858 12.7614 5 10 5C7.23858 5 5 7.23858 5 10C5 12.7614 7.23858 15 10 15ZM10 19C14.9706 19 19 14.9706 19 10C19 5.02944 14.9706 1 10 1C5.02944 1 1 5.02944 1 10C1 14.9706 5.02944 19 10 19Z"
53
53
  fill="#00C9EA"
54
54
  />
@@ -30,15 +30,15 @@ const getSinglelineTextFieldPaddingByIconAndSize = ({
30
30
  case "small":
31
31
  return `4px ${hasRightIcon ? "8px" : "12px"} 4px ${
32
32
  hasLeftIcon ? "8px" : "12px"
33
- }}`;
33
+ }`;
34
34
  case "medium":
35
35
  return `8px ${hasRightIcon ? "12px" : "16px"} 8px ${
36
36
  hasLeftIcon ? "12px" : "16px"
37
- }}`;
37
+ }`;
38
38
  case "large":
39
39
  return `10px ${hasRightIcon ? "12px" : "16px"} 10px ${
40
40
  hasLeftIcon ? "12px" : "16px"
41
- }}`;
41
+ }`;
42
42
  }
43
43
  };
44
44
 
@@ -144,6 +144,31 @@ const commonStyle = ({ lunit_token }: { lunit_token: ColorToken }) => ({
144
144
  color: lunit_token.core.text_error,
145
145
  },
146
146
  },
147
+ "& .MuiInputBase-input": {
148
+ "&:-webkit-autofill, &:-webkit-autofill:active, &:-webkit-autofill:focus, &:-webkit-autofill:hover, &:-webkit-autofill:focus-visible, &:-webkit-autofill:focus-within, &:-webkit-autofill:target, &:-webkit-autofill:first-line":
149
+ {
150
+ border: "none",
151
+ borderRadius: "0px",
152
+ backgroundColor: "transparent",
153
+ color: lunit_token.core.text_normal,
154
+ /**
155
+ * the background color and text color are not changed color, background css tag.
156
+ * so we need to use -webkit-text-fill-color to change the text color.
157
+ * and we need to use -webkit-box-shadow, -webkit-transition to change the background color.
158
+ *
159
+ * reference: https://css-tricks.com/almanac/pseudo-selectors/a/autofill/
160
+ */
161
+ WebkitTextFillColor: lunit_token.core.text_normal,
162
+ WebkitBoxShadow: "0 0 0px 1000px transparent inset",
163
+ WebkitTransition: "background-color 5000s ease-in-out 0s",
164
+ /**
165
+ * textfield flash cursor color
166
+ *
167
+ * docs: https://developer.mozilla.org/en-US/docs/Web/CSS/caret-color
168
+ */
169
+ caretColor: lunit_token.core.text_normal,
170
+ },
171
+ },
147
172
  });
148
173
 
149
174
  const sizeStyle = ({
@@ -73,13 +73,7 @@ const TextField = forwardRef<HTMLDivElement, TextFieldProps>((props, ref) => {
73
73
  const { rows, size, multiline = false, variant, ...restProps } = props;
74
74
 
75
75
  return multiline ? (
76
- <MultiTextField
77
- {...restProps}
78
- ref={ref}
79
- maxRows={Infinity}
80
- size={size}
81
- rows={rows}
82
- />
76
+ <MultiTextField {...restProps} ref={ref} size={size} rows={rows} />
83
77
  ) : (
84
78
  <SingleTextField {...restProps} ref={ref} size={size} />
85
79
  );
@@ -14,6 +14,11 @@ type DSVariants =
14
14
  | "body2_14_regular"
15
15
  | "body3_12_semibold"
16
16
  | "body3_12_regular"
17
+ | "body_m2"
18
+ | "body_reg6"
19
+ | "body_reg8"
20
+ | "small_body_sb1"
21
+ | "small_body_m2"
17
22
  | "button1"
18
23
  | "button2";
19
24
 
@@ -74,6 +79,11 @@ export const typographyDefaultProps = {
74
79
  body2_14_regular: "p",
75
80
  body3_12_semibold: "p",
76
81
  body3_12_regular: "p",
82
+ body_m2: "p",
83
+ body_reg6: "p",
84
+ body_reg8: "p",
85
+ small_body_sb1: "p",
86
+ small_body_m2: "p",
77
87
  },
78
88
  };
79
89
 
@@ -47,6 +47,24 @@ const body = {
47
47
  "--body3-12-regular-font-weight": "var(--font-weight-regular)",
48
48
  "--body3-12-regular-font-size": "12.4px",
49
49
  "--body3-12-regular-line-height": "16px",
50
+ "--body_m2-font-weight": "var(--font-weight-medium)",
51
+ "--body_m2-font-size": "13px",
52
+ "--body_m2-line-height": "18px",
53
+ "--body_reg6-font-weight": "var(--font-weight-regular)",
54
+ "--body_reg6-font-size": "13px",
55
+ "--body_reg6-line-height": "18px",
56
+ "--body_reg8-font-weight": "var(--font-weight-regular)",
57
+ "--body_reg8-font-size": "12px",
58
+ "--body_reg8-line-height": "16px",
59
+ } as const;
60
+
61
+ const smallBody = {
62
+ "--small_body_sb1-font-weight": "var(--font-weight-semibold)",
63
+ "--small_body_sb1-font-size": "12px",
64
+ "--small_body_sb1-line-height": "16px",
65
+ "--small_body_m2-font-weight": "var(--font-weight-medium)",
66
+ "--small_body_m2-font-size": "12px",
67
+ "--small_body_m2-line-height": "20px",
50
68
  } as const;
51
69
 
52
70
  const etc = {
@@ -125,6 +143,32 @@ const fontVariants: Record<string, TypographyStyleOptions> = {
125
143
  fontSize: "var(--body3-12-regular-font-size)",
126
144
  lineHeight: "var(--body3-12-regular-line-height)",
127
145
  },
146
+ body_m2: {
147
+ fontWeight: "var(--body_m2-font-weight)",
148
+ fontSize: "var(--body_m2-font-size)",
149
+ lineHeight: "var(--body_m2-line-height)",
150
+ letterSpacing: "0.2px",
151
+ },
152
+ body_reg6: {
153
+ fontWeight: "var(--body_reg6-font-weight)",
154
+ fontSize: "var(--body_reg6-font-size)",
155
+ lineHeight: "var(--body_reg6-line-height)",
156
+ },
157
+ body_reg8: {
158
+ fontWeight: "var(--body_reg8-font-weight)",
159
+ fontSize: "var(--body_reg8-font-size)",
160
+ lineHeight: "var(--body_reg8-line-height)",
161
+ },
162
+ small_body_sb1: {
163
+ fontWeight: "var(--small_body_sb1-font-weight)",
164
+ fontSize: "var(--small_body_sb1-font-size)",
165
+ lineHeight: "var(--small_body_sb1-line-height)",
166
+ },
167
+ small_body_m2: {
168
+ fontWeight: "var(--small_body_m2-font-weight)",
169
+ fontSize: "var(--small_body_m2-font-size)",
170
+ lineHeight: "var(--small_body_m2-line-height)",
171
+ },
128
172
  overline: {
129
173
  fontWeight: "var(--overline-font-weight)",
130
174
  fontSize: "var(--overline-font-size)",
@@ -156,6 +200,7 @@ export const cssVariables = {
156
200
  ...fontWeights,
157
201
  ...headline,
158
202
  ...body,
203
+ ...smallBody,
159
204
  ...etc,
160
205
  };
161
206