@lunit/design-system 1.0.0-a.2 → 1.0.0-a.4

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 (173) hide show
  1. package/.babelrc.json +16 -0
  2. package/dist/cjs/components/Alert/index.js +1 -1
  3. package/dist/cjs/components/Alert/index.js.map +1 -1
  4. package/dist/cjs/components/Button/index.js +1 -1
  5. package/dist/cjs/components/Button/index.js.map +1 -1
  6. package/dist/cjs/components/Chip/index.js +1 -1
  7. package/dist/cjs/components/Chip/index.js.map +1 -1
  8. package/dist/cjs/components/TextField/index.js +1 -1
  9. package/dist/cjs/components/TextField/index.js.map +1 -1
  10. package/dist/cjs/components/ToggleButton/index.js +1 -1
  11. package/dist/cjs/components/ToggleButton/index.js.map +1 -1
  12. package/dist/cjs/index.js +1 -1
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/components/Alert/Alert.js +20 -4
  15. package/dist/components/Alert/Alert.js.map +1 -1
  16. package/dist/components/Alert/Alert.styled.js +49 -0
  17. package/dist/components/Alert/Alert.styled.js.map +1 -0
  18. package/dist/components/Alert/Alert.types.js +2 -0
  19. package/dist/components/Alert/Alert.types.js.map +1 -0
  20. package/dist/components/Alert/Alert.utils.js +37 -0
  21. package/dist/components/Alert/Alert.utils.js.map +1 -0
  22. package/dist/components/Button/Button.js +1 -1
  23. package/dist/components/Button/Button.js.map +1 -1
  24. package/dist/components/Button/Button.styled.js +31 -21
  25. package/dist/components/Button/Button.styled.js.map +1 -1
  26. package/dist/components/Button/utils/getHoverStyle.js +7 -0
  27. package/dist/components/Button/utils/getHoverStyle.js.map +1 -0
  28. package/dist/components/Chip/Chip.js +1 -1
  29. package/dist/components/Chip/Chip.js.map +1 -1
  30. package/dist/components/Chip/Chip.styled.js +2 -3
  31. package/dist/components/Chip/Chip.styled.js.map +1 -1
  32. package/dist/components/TextField/TextField.js +15 -3
  33. package/dist/components/TextField/TextField.js.map +1 -1
  34. package/dist/components/TextField/TextField.style.js +245 -0
  35. package/dist/components/TextField/TextField.style.js.map +1 -0
  36. package/dist/components/TextField/TextField.types.js +2 -0
  37. package/dist/components/TextField/TextField.types.js.map +1 -0
  38. package/dist/components/TextField/TextFieldIcon.js +7 -0
  39. package/dist/components/TextField/TextFieldIcon.js.map +1 -0
  40. package/dist/components/Toast/Toast.js +26 -0
  41. package/dist/components/Toast/Toast.js.map +1 -0
  42. package/dist/components/Toast/Toast.styled.js +49 -0
  43. package/dist/components/Toast/Toast.styled.js.map +1 -0
  44. package/dist/components/Toast/Toast.types.js +2 -0
  45. package/dist/components/Toast/Toast.types.js.map +1 -0
  46. package/dist/components/Toast/Toast.utils.js +13 -0
  47. package/dist/components/Toast/Toast.utils.js.map +1 -0
  48. package/dist/components/Toast/index.js +2 -0
  49. package/dist/components/Toast/index.js.map +1 -0
  50. package/dist/foundation/colors/base/grey.js +16 -0
  51. package/dist/foundation/colors/base/grey.js.map +1 -1
  52. package/dist/foundation/colors/base/lunitGreen.js +2 -2
  53. package/dist/foundation/colors/base/lunitGreen.js.map +1 -1
  54. package/dist/foundation/colors/base/lunitTeal.js +5 -5
  55. package/dist/foundation/colors/base/lunitTeal.js.map +1 -1
  56. package/dist/foundation/colors/base/red.js +2 -2
  57. package/dist/foundation/colors/index.js +24 -4
  58. package/dist/foundation/colors/index.js.map +1 -1
  59. package/dist/foundation/colors/token/component.js +265 -291
  60. package/dist/foundation/colors/token/component.js.map +1 -1
  61. package/dist/foundation/colors/token/core.js +132 -125
  62. package/dist/foundation/colors/token/core.js.map +1 -1
  63. package/dist/index.js +1 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/theme.js +5 -0
  66. package/dist/theme.js.map +1 -1
  67. package/dist/types/components/Alert/Alert.d.ts +3 -1
  68. package/dist/types/components/Alert/Alert.styled.d.ts +6 -0
  69. package/dist/types/components/Alert/Alert.types.d.ts +9 -0
  70. package/dist/types/components/Alert/Alert.utils.d.ts +4 -0
  71. package/dist/types/components/Button/Button.d.ts +1 -1
  72. package/dist/types/components/Button/Button.styled.d.ts +26 -2
  73. package/dist/types/components/Button/Button.types.d.ts +4 -4
  74. package/dist/types/components/Button/utils/getHoverStyle.d.ts +6 -0
  75. package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
  76. package/dist/types/components/Chip/Chip.d.ts +1 -1
  77. package/dist/types/components/Chip/Chip.styled.d.ts +13 -13
  78. package/dist/types/components/Chip/Chip.types.d.ts +1 -1
  79. package/dist/types/components/DataTable/DataTable.d.ts +1 -1
  80. package/dist/types/components/DatePicker/DatePicker.d.ts +1 -1
  81. package/dist/types/components/Dropdown/Dropdown.d.ts +1 -1
  82. package/dist/types/components/FormLabel/FormLabel.d.ts +1 -1
  83. package/dist/types/components/Modal/Modal.d.ts +1 -1
  84. package/dist/types/components/Radio/Radio.d.ts +1 -1
  85. package/dist/types/components/TextField/TextField.d.ts +2 -1
  86. package/dist/types/components/TextField/TextField.style.d.ts +9 -0
  87. package/dist/types/components/TextField/TextField.types.d.ts +29 -0
  88. package/dist/types/components/TextField/TextFieldIcon.d.ts +8 -0
  89. package/dist/types/components/TextField/index.d.ts +1 -0
  90. package/dist/types/components/Toast/Toast.d.ts +4 -0
  91. package/dist/types/components/Toast/Toast.styled.d.ts +1 -0
  92. package/dist/types/components/Toast/Toast.types.d.ts +4 -0
  93. package/dist/types/components/Toast/Toast.utils.d.ts +2 -0
  94. package/dist/types/components/Toast/index.d.ts +1 -0
  95. package/dist/types/components/Toggle/Toggle.d.ts +1 -1
  96. package/dist/types/components/ToggleButton/ToggleButton.d.ts +1 -1
  97. package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -2
  98. package/dist/types/components/ToggleButton/ToggleButton.types.d.ts +4 -4
  99. package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +1 -1
  100. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  101. package/dist/types/foundation/colors/base/grey.d.ts +16 -0
  102. package/dist/types/foundation/colors/base/lunitGreen.d.ts +2 -2
  103. package/dist/types/foundation/colors/base/lunitTeal.d.ts +2 -2
  104. package/dist/types/foundation/colors/index.d.ts +42 -9
  105. package/dist/types/foundation/colors/types.d.ts +1 -3
  106. package/dist/types/foundation/index.d.ts +37 -5
  107. package/dist/types/index.d.ts +1 -0
  108. package/package.json +21 -16
  109. package/src/components/Alert/Alert.styled.ts +63 -0
  110. package/src/components/Alert/Alert.tsx +47 -5
  111. package/src/components/Alert/Alert.types.ts +10 -0
  112. package/src/components/Alert/Alert.utils.ts +49 -0
  113. package/src/components/Button/Button.styled.ts +33 -21
  114. package/src/components/Button/Button.tsx +1 -5
  115. package/src/components/Button/Button.types.ts +4 -4
  116. package/src/components/Button/utils/getHoverStyle.ts +7 -0
  117. package/src/components/Chip/Chip.styled.ts +6 -4
  118. package/src/components/Chip/Chip.tsx +1 -1
  119. package/src/components/Chip/Chip.types.ts +2 -2
  120. package/src/components/TextField/TextField.style.ts +316 -0
  121. package/src/components/TextField/TextField.tsx +75 -3
  122. package/src/components/TextField/TextField.types.ts +38 -0
  123. package/src/components/TextField/TextFieldIcon.tsx +24 -0
  124. package/src/components/TextField/index.ts +6 -0
  125. package/src/components/Toast/Toast.styled.ts +49 -0
  126. package/src/components/Toast/Toast.tsx +66 -0
  127. package/src/components/Toast/Toast.types.ts +14 -0
  128. package/src/components/Toast/Toast.utils.ts +17 -0
  129. package/src/components/Toast/index.tsx +1 -0
  130. package/src/components/ToggleButton/ToggleButton.types.ts +4 -7
  131. package/src/foundation/colors/base/grey.ts +17 -0
  132. package/src/foundation/colors/base/lunitGreen.ts +2 -2
  133. package/src/foundation/colors/base/lunitTeal.ts +5 -5
  134. package/src/foundation/colors/base/red.ts +2 -2
  135. package/src/foundation/colors/index.ts +29 -8
  136. package/src/foundation/colors/token/component.ts +300 -326
  137. package/src/foundation/colors/token/core.ts +152 -145
  138. package/src/foundation/colors/types.ts +1 -3
  139. package/src/index.ts +1 -0
  140. package/src/stories/components/Alert/Alert.stories.tsx +148 -4
  141. package/src/stories/components/Button/BasicButton.stories.tsx +19 -28
  142. package/src/stories/components/Button/IconButton.stories.tsx +39 -28
  143. package/src/stories/components/Button/Kind.stories.tsx +83 -57
  144. package/src/stories/components/Chip/Chip.stories.tsx +94 -82
  145. package/src/stories/components/DataTable/DataTable.stories.tsx +6 -4
  146. package/src/stories/components/DatePicker/DatePicker.stories.tsx +6 -4
  147. package/src/stories/components/Dropdown/Dropdown.stories.tsx +12 -6
  148. package/src/stories/components/Modal/Modal.stories.tsx +6 -4
  149. package/src/stories/components/SelectControl/Checkbox.stories.tsx +31 -23
  150. package/src/stories/components/SelectControl/RadioGroup.stories.tsx +6 -5
  151. package/src/stories/components/SelectControl/RadioStatus.stories.tsx +6 -4
  152. package/src/stories/components/SelectControl/Toggle.stories.tsx +33 -19
  153. package/src/stories/components/TextField/TextFieldMulti.stories.tsx +137 -0
  154. package/src/stories/components/TextField/TextFieldSingle.stories.tsx +283 -0
  155. package/src/stories/components/TextField/TextFieldSize.stories.tsx +134 -0
  156. package/src/stories/components/Toast/Toast.stories.tsx +152 -0
  157. package/src/stories/components/ToggleButton/Basic.stories.tsx +35 -31
  158. package/src/stories/components/ToggleButton/Group.stories.tsx +21 -21
  159. package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +53 -43
  160. package/src/stories/components/ToggleButton/WithIcon.stories.tsx +35 -36
  161. package/src/stories/components/Tooltip/Tooltip.stories.tsx +6 -4
  162. package/src/stories/foundation/Elevation/Elevation.stories.tsx +10 -6
  163. package/src/stories/foundation/Typography/{Typography.stories.mdx → Typography.mdx} +10 -5
  164. package/src/stories/foundation/Typography/Typography.stories.tsx +46 -36
  165. package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +44 -0
  166. package/src/stories/foundation/colors/Colors.stories.tsx +7 -5
  167. package/src/stories/foundation/colors/Mui.stories.tsx +18 -0
  168. package/src/stories/foundation/colors/Token.inComponent.stories.tsx +2 -2
  169. package/src/stories/foundation/colors/TokenPaletteTable.stories.tsx +28 -0
  170. package/src/stories/foundation/colors/TokenPaletteTable.tsx +127 -0
  171. package/src/theme.ts +5 -0
  172. package/src/stories/components/TextField/TextField.stories.tsx +0 -13
  173. package/src/stories/foundation/colors/Token.stories.tsx +0 -190
@@ -0,0 +1,316 @@
1
+ import MuiTextField from "@mui/material/TextField";
2
+ import { styled } from "@mui/material/styles";
3
+
4
+ import type { ColorToken } from "@/foundation/colors/types";
5
+ import type { Typography } from "@mui/material/styles/createTypography";
6
+ import type { TextFieldProps, TextFieldSize } from "./TextField.types";
7
+
8
+ type BaseTextFieldProps = Omit<TextFieldProps, "size"> & {
9
+ textFieldSize: TextFieldSize;
10
+ hasLeftIcon?: boolean;
11
+ hasRightIcon?: boolean;
12
+ };
13
+
14
+ interface GetTextFieldPaddingBySizeParams {
15
+ multiline?: boolean;
16
+ size: TextFieldSize;
17
+ hasLeftIcon?: boolean;
18
+ hasRightIcon?: boolean;
19
+ }
20
+
21
+ const getSinglelineTextFieldPaddingByIconAndSize = ({
22
+ size,
23
+ hasLeftIcon,
24
+ hasRightIcon,
25
+ }: Pick<
26
+ GetTextFieldPaddingBySizeParams,
27
+ "size" | "hasLeftIcon" | "hasRightIcon"
28
+ >) => {
29
+ switch (size) {
30
+ case "small":
31
+ return `4px ${hasRightIcon ? "8px" : "12px"} 4px ${
32
+ hasLeftIcon ? "8px" : "12px"
33
+ }}`;
34
+ case "medium":
35
+ return `8px ${hasRightIcon ? "12px" : "16px"} 8px ${
36
+ hasLeftIcon ? "12px" : "16px"
37
+ }}`;
38
+ case "large":
39
+ return `10px ${hasRightIcon ? "12px" : "16px"} 10px ${
40
+ hasLeftIcon ? "12px" : "16px"
41
+ }}`;
42
+ }
43
+ };
44
+
45
+ const getMultilineTextFieldPaddingByIconAndSize = ({
46
+ size,
47
+ }: Pick<GetTextFieldPaddingBySizeParams, "size">) => {
48
+ switch (size) {
49
+ case "small":
50
+ return "4px 4px 4px 12px";
51
+ case "medium":
52
+ return "8px 4px 8px 16px";
53
+ case "large":
54
+ return "10px 4px 10px 16px";
55
+ }
56
+ };
57
+
58
+ const getTextFieldPaddingBySize = ({
59
+ size,
60
+ multiline,
61
+ hasLeftIcon,
62
+ hasRightIcon,
63
+ }: GetTextFieldPaddingBySizeParams) => {
64
+ return multiline
65
+ ? getMultilineTextFieldPaddingByIconAndSize({ size })
66
+ : getSinglelineTextFieldPaddingByIconAndSize({
67
+ size,
68
+ hasLeftIcon,
69
+ hasRightIcon,
70
+ });
71
+ };
72
+
73
+ const commonStyle = ({ token }: { token: ColorToken }) => ({
74
+ "& .MuiOutlinedInput-root": {
75
+ borderRadius: "8px",
76
+ width: "100%",
77
+
78
+ "& fieldset": {
79
+ border: "none",
80
+ },
81
+ "&.Mui-error fieldset": {
82
+ border: `1px solid ${token.component.textfield_border_error}`,
83
+ },
84
+ "&.Mui-focused fieldset": {
85
+ border: `1px solid ${token.core.focused}`,
86
+ },
87
+ "&.Mui-disabled": {
88
+ opacity: 0.38,
89
+ "&:hover::before": {
90
+ backgroundColor: token.component.textfield_bg,
91
+ },
92
+ },
93
+ "& input, textarea": {
94
+ padding: 0,
95
+ textOverflow: "ellipsis",
96
+ "&::placeholder": {
97
+ color: token.core.text_medium,
98
+ opacity: 1,
99
+ WebkitTextFillColor: token.core.text_medium,
100
+ },
101
+ },
102
+ "& textarea": {
103
+ height: "100% !important",
104
+ overflowY: "scroll !important",
105
+ "&::-webkit-scrollbar": {
106
+ width: "6px",
107
+ },
108
+ "&::-webkit-scrollbar-thumb": {
109
+ borderRadius: "6px",
110
+ backgroundColor: token.component.scrollbars_bg,
111
+ },
112
+ },
113
+ background: token.component.textfield_bg,
114
+ overflow: "hidden",
115
+ color: token.core.text_normal,
116
+ "&:hover": {
117
+ position: "relative",
118
+ zIndex: 0,
119
+ backgroundColor: token.component.textfield_bg,
120
+ },
121
+ "&:hover::before": {
122
+ content: '""',
123
+ position: "absolute",
124
+ top: 0,
125
+ left: 0,
126
+ width: "100%",
127
+ height: "100%",
128
+ zIndex: -1,
129
+ backgroundColor: token.core.hover,
130
+ },
131
+ "&.Mui-focused": {
132
+ "&:hover::before": {
133
+ backgroundColor: token.component.textfield_bg,
134
+ },
135
+ },
136
+ },
137
+ "& .MuiFormHelperText-root": {
138
+ "&.Mui-disabled": {
139
+ opacity: 0.38,
140
+ },
141
+ "&.Mui-error": {
142
+ color: token.core.text_error,
143
+ },
144
+ },
145
+ });
146
+
147
+ const sizeStyle = ({
148
+ token,
149
+ textFieldSize,
150
+ hasLeftIcon,
151
+ hasRightIcon,
152
+ typography,
153
+ multiline,
154
+ }: Pick<
155
+ BaseTextFieldProps,
156
+ "textFieldSize" | "hasLeftIcon" | "hasRightIcon" | "multiline"
157
+ > & { token: ColorToken; typography: Typography }) => ({
158
+ ...(textFieldSize === "small" && {
159
+ "& .MuiInputBase-root": {
160
+ padding: getTextFieldPaddingBySize({
161
+ size: textFieldSize,
162
+ hasLeftIcon,
163
+ hasRightIcon,
164
+ multiline,
165
+ }),
166
+ "& input, textarea": {
167
+ ...typography.body2_14_regular,
168
+ },
169
+ "& input": {
170
+ height: "20px",
171
+ },
172
+ "& textarea": {
173
+ minHeight: "92px",
174
+ paddingRight: "2px",
175
+ },
176
+ },
177
+ "& .MuiFormHelperText-root": {
178
+ ...typography.body2_14_regular,
179
+ color: token.core.text_medium,
180
+ margin: 0,
181
+ marginTop: "4px",
182
+ paddingLeft: "4px",
183
+
184
+ "&.Mui-disabled": {
185
+ color: token.core.text_medium,
186
+ opacity: 0.38,
187
+ },
188
+ "&.Mui-error": {
189
+ color: token.core.text_error,
190
+ },
191
+ },
192
+ }),
193
+ ...(textFieldSize === "medium" && {
194
+ "& .MuiInputBase-root": {
195
+ padding: getTextFieldPaddingBySize({
196
+ size: textFieldSize,
197
+ hasLeftIcon,
198
+ hasRightIcon,
199
+ multiline,
200
+ }),
201
+ "& input, textarea": {
202
+ ...typography.body2_14_regular,
203
+ },
204
+ "& input": {
205
+ height: "20px",
206
+ },
207
+ "& textarea": {
208
+ minHeight: "84px",
209
+ paddingRight: "6px",
210
+ },
211
+ },
212
+ "& .MuiFormHelperText-root": {
213
+ ...typography.body2_14_regular,
214
+ color: token.core.text_medium,
215
+ margin: 0,
216
+ marginTop: "4px",
217
+ paddingLeft: "4px",
218
+
219
+ "&.Mui-disabled": {
220
+ color: token.core.text_medium,
221
+ opacity: 0.38,
222
+ },
223
+ "&.Mui-error": {
224
+ color: token.core.text_error,
225
+ },
226
+ },
227
+ }),
228
+ ...(textFieldSize === "large" && {
229
+ "& .MuiInputBase-root": {
230
+ padding: getTextFieldPaddingBySize({
231
+ size: textFieldSize,
232
+ hasLeftIcon,
233
+ hasRightIcon,
234
+ multiline,
235
+ }),
236
+ "& input, textarea": {
237
+ ...typography.body1_16_regular,
238
+ },
239
+ "& input": {
240
+ height: "24px",
241
+ },
242
+ "& textarea": {
243
+ minHeight: "80px",
244
+ paddingRight: "6px",
245
+ },
246
+ },
247
+ "& .MuiFormHelperText-root": {
248
+ ...typography.body1_16_regular,
249
+ color: token.core.text_medium,
250
+ margin: 0,
251
+ marginTop: "4px",
252
+ paddingLeft: "4px",
253
+
254
+ "&.Mui-disabled": {
255
+ color: token.core.text_medium,
256
+ opacity: 0.38,
257
+ },
258
+ "&.Mui-error": {
259
+ color: token.core.text_error,
260
+ },
261
+ },
262
+ }),
263
+ });
264
+
265
+ const BaseTextField = styled(MuiTextField, {
266
+ shouldForwardProp: (prop: string) =>
267
+ ![
268
+ "leftIconSx",
269
+ "rightIconSx",
270
+ "leftIcon",
271
+ "rightIcon",
272
+ "textFieldSize",
273
+ "hasLeftIcon",
274
+ "hasRightIcon",
275
+ "onLeftIconClick",
276
+ "onRightIconClick",
277
+ ].includes(prop),
278
+ })<BaseTextFieldProps>(
279
+ ({
280
+ theme: {
281
+ typography,
282
+ palette: { token },
283
+ },
284
+ multiline,
285
+ textFieldSize,
286
+ hasLeftIcon,
287
+ hasRightIcon,
288
+ }) => ({
289
+ ...commonStyle({ token }),
290
+ ...sizeStyle({
291
+ token,
292
+ textFieldSize,
293
+ hasLeftIcon,
294
+ hasRightIcon,
295
+ typography,
296
+ multiline,
297
+ }),
298
+ })
299
+ );
300
+
301
+ const IconWrapper = styled("div")(({ theme }) => ({
302
+ display: "flex",
303
+ alignItems: "center",
304
+ justifyContent: "center",
305
+ minWidth: "28px",
306
+ minHeight: "28px",
307
+ margin: "-4px 0",
308
+
309
+ "& svg": {
310
+ width: "20px",
311
+ height: "20px",
312
+ color: theme.palette.token.core.text_normal,
313
+ },
314
+ }));
315
+
316
+ export { BaseTextField, IconWrapper };
@@ -1,8 +1,80 @@
1
1
  import React from "react";
2
- import { Box } from "@mui/material";
3
2
 
4
- const TextField = () => {
5
- return <Box>TextField</Box>;
3
+ import TextFieldIcon from "./TextFieldIcon";
4
+ import { BaseTextField } from "./TextField.style";
5
+
6
+ import type {
7
+ TextFieldProps,
8
+ MultiTextFieldProps,
9
+ SingleTextFieldProps,
10
+ } from "./TextField.types";
11
+
12
+ const SingleTextField = (props: SingleTextFieldProps) => {
13
+ const {
14
+ size,
15
+ leftIcon,
16
+ rightIcon,
17
+ leftIconSx,
18
+ rightIconSx,
19
+ onLeftIconClick,
20
+ onRightIconClick,
21
+ ...restProps
22
+ } = props;
23
+
24
+ return (
25
+ <BaseTextField
26
+ {...restProps}
27
+ textFieldSize={size}
28
+ hasLeftIcon={Boolean(leftIcon)}
29
+ hasRightIcon={Boolean(rightIcon)}
30
+ InputProps={{
31
+ startAdornment: leftIcon && (
32
+ <TextFieldIcon
33
+ sx={{ marginRight: "4px", ...leftIconSx }}
34
+ icon={leftIcon}
35
+ onIconClick={onLeftIconClick}
36
+ />
37
+ ),
38
+ endAdornment: rightIcon && (
39
+ <TextFieldIcon
40
+ sx={{ marginLeft: "4px", ...rightIconSx }}
41
+ icon={rightIcon}
42
+ onIconClick={onRightIconClick}
43
+ />
44
+ ),
45
+ }}
46
+ />
47
+ );
48
+ };
49
+
50
+ const MultiTextField = ({
51
+ size,
52
+ onChange,
53
+ ...restProps
54
+ }: MultiTextFieldProps) => {
55
+ return <BaseTextField {...restProps} textFieldSize={size} multiline />;
56
+ };
57
+
58
+ const TextField = (props: TextFieldProps) => {
59
+ const {
60
+ rows,
61
+ size = "small",
62
+ multiline = false,
63
+ variant = "outlined",
64
+ ...restProps
65
+ } = props;
66
+
67
+ return multiline ? (
68
+ <MultiTextField
69
+ {...restProps}
70
+ maxRows={Infinity}
71
+ size={size}
72
+ variant={variant}
73
+ rows={rows}
74
+ />
75
+ ) : (
76
+ <SingleTextField {...restProps} size={size} variant={variant} />
77
+ );
6
78
  };
7
79
 
8
80
  export default TextField;
@@ -0,0 +1,38 @@
1
+ import type { SxProps } from "@mui/material";
2
+ import type { OutlinedTextFieldProps } from "@mui/material/TextField";
3
+
4
+ export type TextFieldSize = "small" | "medium" | "large";
5
+ export interface BaseTextFieldProps
6
+ extends Omit<
7
+ OutlinedTextFieldProps,
8
+ "size" | "value" | "helperText" | "variant"
9
+ > {
10
+ /**
11
+ * The design system TextField variable is outlined fixed.
12
+ */
13
+ variant: "outlined";
14
+ value?: string;
15
+ helperText?: string;
16
+
17
+ /**
18
+ * @default "small"
19
+ */
20
+ size?: TextFieldSize;
21
+ }
22
+
23
+ export interface SingleTextFieldProps extends BaseTextFieldProps {
24
+ size: TextFieldSize;
25
+ leftIcon?: JSX.Element;
26
+ rightIcon?: JSX.Element;
27
+ leftIconSx?: SxProps;
28
+ rightIconSx?: SxProps;
29
+ onLeftIconClick?: () => void;
30
+ onRightIconClick?: () => void;
31
+ }
32
+
33
+ export interface MultiTextFieldProps extends BaseTextFieldProps {
34
+ rows?: number | string;
35
+ size: TextFieldSize;
36
+ }
37
+
38
+ export type TextFieldProps = SingleTextFieldProps | MultiTextFieldProps;
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+
3
+ import { IconWrapper } from "./TextField.style";
4
+
5
+ import type { SxProps } from "@mui/material";
6
+
7
+ interface TextFieldProps {
8
+ sx?: SxProps;
9
+ icon: JSX.Element;
10
+ onIconClick?: () => void;
11
+ }
12
+
13
+ const TextFieldIcon = ({ sx, icon, onIconClick }: TextFieldProps) => {
14
+ return (
15
+ <IconWrapper
16
+ sx={{ cursor: onIconClick ? "pointer" : "auto", ...sx }}
17
+ onClick={onIconClick}
18
+ >
19
+ {icon}
20
+ </IconWrapper>
21
+ );
22
+ };
23
+
24
+ export default TextFieldIcon;
@@ -1 +1,7 @@
1
1
  export { default } from "./TextField";
2
+ export type {
3
+ TextFieldProps,
4
+ BaseTextFieldProps,
5
+ MultiTextFieldProps,
6
+ SingleTextFieldProps,
7
+ } from "./TextField.types";
@@ -0,0 +1,49 @@
1
+ import { Alert, styled } from "@mui/material";
2
+ import { getIconColor } from "./Toast.utils";
3
+
4
+ export const StyledToast = styled(Alert)(({ theme, severity }) => {
5
+ return {
6
+ 'div[class*="MuiAlert"]': {
7
+ display: "flex",
8
+ alignItems: "center",
9
+ },
10
+ "&.MuiAlert-root": {
11
+ padding: "8px 16px 8px 16px",
12
+ margin: 0,
13
+ color: theme.palette.token.core.text_normal,
14
+ backgroundColor: theme.palette.token.core.bg_03,
15
+ borderRadius: "8px",
16
+ },
17
+ "& .MuiAlert-icon": {
18
+ height: "36px",
19
+ marginRight: "16px",
20
+ fontSize: 20,
21
+ color: `${getIconColor(theme, severity)}`,
22
+ "& .MuiSvgIcon-root": {
23
+ height: "16px",
24
+ width: "16px",
25
+ },
26
+ },
27
+ "& .MuiAlert-message": {
28
+ // max length of toast message is 400px
29
+ maxWidth: "400px",
30
+ minHeight: "28px",
31
+ padding: "8px 0 8px 0",
32
+ fontWeight: 400,
33
+ fontSize: "14px",
34
+ lineHeight: "20px",
35
+ "& .Toast-message": {
36
+ display: "block",
37
+ },
38
+ },
39
+ "& .MuiAlert-action": {
40
+ alignSelf: "flex-start",
41
+ minHeight: "36px",
42
+ marginRight: "0px",
43
+ padding: 0,
44
+ "& .MuiSvgIcon-root": {
45
+ color: theme.palette.token.core.text_normal,
46
+ },
47
+ },
48
+ };
49
+ });
@@ -0,0 +1,66 @@
1
+ import Success from "@lunit/design-system-icons/Success16";
2
+ import Error from "@lunit/design-system-icons/Error16";
3
+ import Warning from "@lunit/design-system-icons/Warning16";
4
+ import Information from "@lunit/design-system-icons/Information16";
5
+ import Close from "@lunit/design-system-icons/Close";
6
+
7
+ import { Typography } from "@mui/material";
8
+ import React, { forwardRef } from "react";
9
+
10
+ import Button from "../Button";
11
+ import { StyledToast } from "./Toast.styled";
12
+ import type { ToastProps } from "./Toast.types";
13
+
14
+ const MAPPED_ICON = {
15
+ success: <Success variant="filled" />,
16
+ info: <Information variant="filled" />,
17
+ warning: <Warning variant="filled" />,
18
+ error: <Error variant="filled" />,
19
+ };
20
+
21
+ const Toast = forwardRef<HTMLDivElement, ToastProps>((props, ref) => {
22
+ const {
23
+ severity = "normal",
24
+ icon,
25
+ children,
26
+ action,
27
+ onClose,
28
+ ...rest
29
+ } = props;
30
+ const iconConfig = severity === "normal" ? { icon: false } : { severity };
31
+
32
+ return (
33
+ <StyledToast
34
+ ref={ref}
35
+ iconMapping={MAPPED_ICON}
36
+ action={
37
+ <>
38
+ {action}
39
+ {onClose && (
40
+ <Button
41
+ icon={<Close />}
42
+ kind="ghost"
43
+ size="medium"
44
+ onClick={onClose}
45
+ />
46
+ )}
47
+ </>
48
+ }
49
+ {...iconConfig}
50
+ {...rest}
51
+ >
52
+ <Typography
53
+ className="Toast-message"
54
+ variant="body2_14_regular"
55
+ sx={{
56
+ whiteSpace: "pre-line",
57
+ }}
58
+ >
59
+ {children}
60
+ </Typography>
61
+ </StyledToast>
62
+ );
63
+ });
64
+
65
+ // this forwardRef is required for using with Snackbar component
66
+ export default Toast;
@@ -0,0 +1,14 @@
1
+ import { AlertProps as BaseAlertProps } from "@mui/material";
2
+
3
+ export interface ToastProps
4
+ extends Omit<
5
+ BaseAlertProps,
6
+ | "variant"
7
+ | "slots"
8
+ | "slotProps"
9
+ | "components"
10
+ | "componentsProps"
11
+ | "severity"
12
+ > {
13
+ severity?: "success" | "info" | "warning" | "error" | "normal";
14
+ }
@@ -0,0 +1,17 @@
1
+ import type { AlertColor, Theme } from "@mui/material";
2
+
3
+ export const getIconColor = (
4
+ theme: Theme,
5
+ severity: AlertColor | undefined
6
+ ) => {
7
+ switch (severity) {
8
+ case "info":
9
+ return theme.palette.token.core.icon_info_02;
10
+ case "warning":
11
+ return theme.palette.token.core.icon_warning_02;
12
+ case "error":
13
+ return theme.palette.token.core.icon_error_02;
14
+ default:
15
+ return theme.palette.token.core.icon_success_02;
16
+ }
17
+ };
@@ -0,0 +1 @@
1
+ export { default as Toast } from './Toast'
@@ -1,23 +1,20 @@
1
1
  import type { ToggleButtonProps as MuiToggleButtonProps } from "@mui/material";
2
2
 
3
- interface ToggleButtonBaseProps extends MuiToggleButtonProps {
3
+ interface ToggleButtonBaseProps extends Omit<MuiToggleButtonProps, "variant"> {
4
4
  selectedColor?: "primary" | "secondary";
5
5
  icon?: React.ReactNode;
6
6
  }
7
- interface ContainedToggleButtonProps
8
- extends Omit<ToggleButtonBaseProps, "variant"> {
7
+ interface ContainedToggleButtonProps extends ToggleButtonBaseProps {
9
8
  kind?: "contained";
10
9
  color?: "primary" | "secondary";
11
10
  }
12
11
 
13
- interface GhostToggleButtonProps
14
- extends Omit<ToggleButtonBaseProps, "variant"> {
12
+ interface GhostToggleButtonProps extends ToggleButtonBaseProps {
15
13
  kind?: "ghost";
16
14
  color?: "primary" | "secondary";
17
15
  }
18
16
 
19
- interface OutlinedToggleButtonProps
20
- extends Omit<ToggleButtonBaseProps, "variant"> {
17
+ interface OutlinedToggleButtonProps extends ToggleButtonBaseProps {
21
18
  kind?: "outlined";
22
19
  color?: "primary";
23
20
  }
@@ -34,3 +34,20 @@ export const greyText = {
34
34
  95: grey[5],
35
35
  100: grey[5],
36
36
  };
37
+
38
+ export const greyForMUI = {
39
+ 50: grey[5],
40
+ 100: grey[10],
41
+ 200: grey[20],
42
+ 300: grey[30],
43
+ 400: grey[40],
44
+ 500: grey[50],
45
+ 600: grey[60],
46
+ 700: grey[70],
47
+ 800: grey[80],
48
+ 900: grey[90],
49
+ A100: "#F3F3F3",
50
+ A200: "#C7C7C7",
51
+ A400: "#9A9A9A",
52
+ A700: "#4F4F4F",
53
+ };
@@ -1,6 +1,6 @@
1
1
  import { grey } from "./grey";
2
2
 
3
- export const lunitGreen = {
3
+ export const lunit_green = {
4
4
  5: "#F5FBE7",
5
5
  10: "#EFF8BC",
6
6
  20: "#E5F39E",
@@ -13,7 +13,7 @@ export const lunitGreen = {
13
13
  90: "#B1C953",
14
14
  };
15
15
 
16
- export const lunitGreenText = {
16
+ export const lunit_greenText = {
17
17
  5: grey[95],
18
18
  10: grey[95],
19
19
  20: grey[95],