@lunit/design-system 1.0.0-a.5 → 1.0.0-b.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +1 -1
  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/Checkbox/index.js +1 -1
  7. package/dist/cjs/components/Checkbox/index.js.map +1 -1
  8. package/dist/cjs/components/Chip/index.js +1 -1
  9. package/dist/cjs/components/Chip/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/components/Toggle/index.js +1 -1
  15. package/dist/cjs/components/Toggle/index.js.map +1 -1
  16. package/dist/cjs/components/ToggleButton/index.js +1 -1
  17. package/dist/cjs/components/ToggleButton/index.js.map +1 -1
  18. package/dist/cjs/components/Typography/index.js +1 -1
  19. package/dist/cjs/components/Typography/index.js.map +1 -1
  20. package/dist/cjs/index.js +1 -1
  21. package/dist/cjs/index.js.map +1 -1
  22. package/dist/components/Alert/Alert.styled.js +2 -2
  23. package/dist/components/Alert/Alert.styled.js.map +1 -1
  24. package/dist/components/Alert/Alert.utils.js +12 -12
  25. package/dist/components/Alert/Alert.utils.js.map +1 -1
  26. package/dist/components/Button/Button.js.map +1 -1
  27. package/dist/components/Button/Button.styled.js +36 -36
  28. package/dist/components/Button/Button.styled.js.map +1 -1
  29. package/dist/components/Checkbox/Checkbox.js +4 -4
  30. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  31. package/dist/components/Chip/Chip.js +1 -1
  32. package/dist/components/Chip/Chip.js.map +1 -1
  33. package/dist/components/Chip/Chip.styled.js +15 -15
  34. package/dist/components/Chip/Chip.styled.js.map +1 -1
  35. package/dist/components/Radio/Radio.js +3 -3
  36. package/dist/components/Radio/Radio.js.map +1 -1
  37. package/dist/components/TextField/TextField.js +16 -12
  38. package/dist/components/TextField/TextField.js.map +1 -1
  39. package/dist/components/TextField/TextField.style.js +30 -32
  40. package/dist/components/TextField/TextField.style.js.map +1 -1
  41. package/dist/components/Toast/Toast.styled.js +3 -3
  42. package/dist/components/Toast/Toast.styled.js.map +1 -1
  43. package/dist/components/Toast/Toast.utils.js +4 -4
  44. package/dist/components/Toast/Toast.utils.js.map +1 -1
  45. package/dist/components/Toggle/Toggle.styled.js +20 -20
  46. package/dist/components/Toggle/Toggle.styled.js.map +1 -1
  47. package/dist/components/ToggleButton/ToggleButton.styled.js +7 -7
  48. package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -1
  49. package/dist/components/Typography/Typography.js +7 -0
  50. package/dist/components/Typography/Typography.js.map +1 -0
  51. package/dist/components/Typography/index.js +1 -2
  52. package/dist/components/Typography/index.js.map +1 -1
  53. package/dist/foundation/Elevation/index.js +4 -4
  54. package/dist/foundation/Elevation/index.js.map +1 -1
  55. package/dist/foundation/colors/index.js +3 -2
  56. package/dist/foundation/colors/index.js.map +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/index.js.map +1 -1
  59. package/dist/theme.js +3 -2
  60. package/dist/theme.js.map +1 -1
  61. package/dist/types/components/Button/Button.d.ts +2 -2
  62. package/dist/types/components/Button/Button.styled.d.ts +7 -7
  63. package/dist/types/components/Button/Button.types.d.ts +11 -1
  64. package/dist/types/components/Chip/Chip.d.ts +2 -2
  65. package/dist/types/components/Chip/Chip.styled.d.ts +4 -4
  66. package/dist/types/components/Chip/Chip.types.d.ts +7 -1
  67. package/dist/types/components/TextField/TextField.d.ts +3 -2
  68. package/dist/types/components/Toggle/Toggle.styled.d.ts +1 -1
  69. package/dist/types/components/Typography/Typography.d.ts +11 -0
  70. package/dist/types/components/Typography/index.d.ts +1 -7
  71. package/dist/types/foundation/colors/index.d.ts +9 -6
  72. package/dist/types/foundation/index.d.ts +3 -2
  73. package/dist/types/index.d.ts +1 -1
  74. package/dist/types/theme.d.ts +2 -0
  75. package/package.json +1 -1
  76. package/src/components/Alert/Alert.styled.ts +2 -2
  77. package/src/components/Alert/Alert.utils.ts +12 -12
  78. package/src/components/Button/Button.styled.ts +37 -37
  79. package/src/components/Button/Button.tsx +2 -2
  80. package/src/components/Button/Button.types.ts +19 -1
  81. package/src/components/Checkbox/Checkbox.tsx +4 -4
  82. package/src/components/Chip/Chip.styled.ts +15 -15
  83. package/src/components/Chip/Chip.tsx +10 -2
  84. package/src/components/Chip/Chip.types.ts +15 -1
  85. package/src/components/Radio/Radio.tsx +3 -3
  86. package/src/components/TextField/TextField.style.ts +31 -33
  87. package/src/components/TextField/TextField.tsx +55 -47
  88. package/src/components/Toast/Toast.styled.ts +3 -3
  89. package/src/components/Toast/Toast.utils.ts +4 -4
  90. package/src/components/Toggle/Toggle.styled.ts +42 -39
  91. package/src/components/ToggleButton/ToggleButton.styled.ts +7 -7
  92. package/src/components/Typography/Typography.tsx +18 -0
  93. package/src/components/Typography/index.ts +1 -9
  94. package/src/foundation/Elevation/index.ts +4 -4
  95. package/src/foundation/colors/index.ts +31 -26
  96. package/src/index.ts +1 -1
  97. package/src/stories/components/Alert/Alert.stories.tsx +1 -1
  98. package/src/stories/components/Button/BasicButton.stories.tsx +1 -3
  99. package/src/stories/components/TextField/TextFieldMulti.stories.tsx +6 -0
  100. package/src/stories/components/TextField/TextFieldSingle.stories.tsx +24 -0
  101. package/src/stories/foundation/Typography/TypographyGroup.tsx +1 -1
  102. package/src/stories/foundation/colors/Colors.stories.tsx +3 -3
  103. package/src/stories/foundation/colors/Token.inComponent.stories.tsx +21 -19
  104. package/src/stories/foundation/colors/TokenPaletteTable.tsx +6 -4
  105. package/src/stories/foundation/colors/styled.ts +1 -1
  106. package/src/theme.ts +5 -3
@@ -15,7 +15,7 @@ const CustomCheckbox = styled(MuiCheckbox)(({ theme }) => ({
15
15
  position: "absolute",
16
16
  width: 24,
17
17
  height: 24,
18
- border: `1px solid ${theme.palette.token.core.focused}`,
18
+ border: `1px solid ${theme.palette.lunit_token.core.focused}`,
19
19
  borderRadius: "7px",
20
20
  },
21
21
  }));
@@ -27,7 +27,7 @@ const iconSize = {
27
27
 
28
28
  const DefaultIcon = styled("span")(({ theme }) => ({
29
29
  ...iconSize,
30
- backgroundColor: theme.palette.token.component.selectcontrol_off,
30
+ backgroundColor: theme.palette.lunit_token.component.selectcontrol_off,
31
31
  maskImage:
32
32
  "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath" +
33
33
  " fill-rule='evenodd' clip-rule='evenodd' d='M14 1.5H4C2.61929 1.5 1.5 2.61929 1.5 4V14C1.5 15.3807 2.61929 16.5 4 16.5H14C15.3807 " +
@@ -36,7 +36,7 @@ const DefaultIcon = styled("span")(({ theme }) => ({
36
36
 
37
37
  const CheckedIcon = styled("span")(({ theme }) => ({
38
38
  ...iconSize,
39
- backgroundColor: theme.palette.token.component.selectcontrol_on,
39
+ backgroundColor: theme.palette.lunit_token.component.selectcontrol_on,
40
40
  maskImage:
41
41
  "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath" +
42
42
  " fill-rule='evenodd' clip-rule='evenodd' d='M4 0C1.79086 0 0 1.79086 0 4V14C0 16.2091 1.79086 18 4 18H14C16.2091 18 18 16.2091 18 14V4C18 1.79086 16.2091 0 14 0H4ZM14.2516 " +
@@ -45,7 +45,7 @@ const CheckedIcon = styled("span")(({ theme }) => ({
45
45
 
46
46
  const IndeterminateIcon = styled("span")(({ theme }) => ({
47
47
  ...iconSize,
48
- backgroundColor: theme.palette.token.component.selectcontrol_on,
48
+ backgroundColor: theme.palette.lunit_token.component.selectcontrol_on,
49
49
  maskImage:
50
50
  "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath" +
51
51
  " fill-rule='evenodd' clip-rule='evenodd' d='M4 0C1.79086 0 0 1.79086 0 4V14C0 16.2091 1.79086 18 4 18H14C16.2091 18 18 16.2091 18 14V4C18 1.79086 16.2091 0 " +
@@ -36,32 +36,32 @@ const getColorToken = (
36
36
  if (token === "text") {
37
37
  switch (color) {
38
38
  case CHIP_COLORS.PRIMARY:
39
- return theme.palette.token.component.chip_primary_text;
39
+ return theme.palette.lunit_token.component.chip_primary_text;
40
40
  case CHIP_COLORS.SECONDARY:
41
- return theme.palette.token.component.chip_secondary_text;
41
+ return theme.palette.lunit_token.component.chip_secondary_text;
42
42
  case CHIP_COLORS.ERROR:
43
- return theme.palette.token.component.chip_error_text;
43
+ return theme.palette.lunit_token.component.chip_error_text;
44
44
  case CHIP_COLORS.WARNING:
45
- return theme.palette.token.component.chip_warning_text;
45
+ return theme.palette.lunit_token.component.chip_warning_text;
46
46
  case CHIP_COLORS.SUCCESS:
47
- return theme.palette.token.component.chip_success_text;
47
+ return theme.palette.lunit_token.component.chip_success_text;
48
48
  default:
49
- return theme.palette.token.component.chip_primary_text;
49
+ return theme.palette.lunit_token.component.chip_primary_text;
50
50
  }
51
51
  } else {
52
52
  switch (color) {
53
53
  case CHIP_COLORS.PRIMARY:
54
- return theme.palette.token.component.chip_primary_bg;
54
+ return theme.palette.lunit_token.component.chip_primary_bg;
55
55
  case CHIP_COLORS.SECONDARY:
56
- return theme.palette.token.component.chip_secondary_bg;
56
+ return theme.palette.lunit_token.component.chip_secondary_bg;
57
57
  case CHIP_COLORS.ERROR:
58
- return theme.palette.token.component.chip_error_bg;
58
+ return theme.palette.lunit_token.component.chip_error_bg;
59
59
  case CHIP_COLORS.WARNING:
60
- return theme.palette.token.component.chip_warning_bg;
60
+ return theme.palette.lunit_token.component.chip_warning_bg;
61
61
  case CHIP_COLORS.SUCCESS:
62
- return theme.palette.token.component.chip_success_bg;
62
+ return theme.palette.lunit_token.component.chip_success_bg;
63
63
  default:
64
- return theme.palette.token.component.chip_primary_bg;
64
+ return theme.palette.lunit_token.component.chip_primary_bg;
65
65
  }
66
66
  }
67
67
  };
@@ -82,7 +82,7 @@ export const StyledContainedChipBase = styled(MuiChip, {
82
82
  ...COMMON_STYLES,
83
83
  ...theme.typography.caption,
84
84
 
85
- color: theme.palette.token.core.text_normal,
85
+ color: theme.palette.lunit_token.core.text_normal,
86
86
  backgroundColor: getColorToken("bg", theme, color),
87
87
 
88
88
  "& .MuiSvgIcon-root": {
@@ -134,7 +134,7 @@ export const StyledContainedChipEnable = styled(StyledContainedChipBase, {
134
134
  left: 0,
135
135
  right: 0,
136
136
  bottom: 0,
137
- backgroundColor: theme.palette.token.core.hover,
137
+ backgroundColor: theme.palette.lunit_token.core.hover,
138
138
  borderRadius: "11px",
139
139
  },
140
140
  }));
@@ -155,7 +155,7 @@ export const StyledContainedChipDeletable = styled(
155
155
  right: 0,
156
156
  bottom: 0,
157
157
  opacity: 0,
158
- color: theme.palette.token.core.hover,
158
+ color: theme.palette.lunit_token.core.hover,
159
159
  ":hover": {
160
160
  cursor: "pointer",
161
161
  opacity: 1,
@@ -14,10 +14,11 @@ import type {
14
14
  EnableContainedChipProps,
15
15
  DeletableContainedChipProps,
16
16
  ChipProps,
17
+ ChipType,
17
18
  ChipThumbnail,
18
19
  } from "./Chip.types";
19
20
 
20
- const Chip = (props: ChipProps) => {
21
+ const Chip: ChipType = (props: ChipProps) => {
21
22
  const { kind, onDelete, onClick, ...restProps } = props;
22
23
  if (kind === "outlined") return <OutlinedChip {...props} />;
23
24
  else if (onClick) return <EnableContainedChip {...props} />;
@@ -82,7 +83,14 @@ const ReadOnlyContainedChip = (props: ReadOnlyContainedChipProps) => {
82
83
  };
83
84
 
84
85
  const EnableContainedChip = (props: EnableContainedChipProps) => {
85
- const { color = "primary", thumbnail, onClick, sx, ...restProps } = props;
86
+ const {
87
+ color = "primary",
88
+ thumbnail,
89
+ onDelete,
90
+ onClick,
91
+ sx,
92
+ ...restProps
93
+ } = props;
86
94
 
87
95
  return (
88
96
  <StyledContainedChipEnable
@@ -1,6 +1,10 @@
1
1
  import { CHIP_COLORS } from "./consts";
2
2
 
3
- import type { ChipProps as MuiChipProps } from "@mui/material";
3
+ import type {
4
+ ChipProps as MuiChipProps,
5
+ ChipTypeMap as MuiChipTypeMap,
6
+ } from "@mui/material";
7
+ import type { OverridableComponent } from "@mui/material/OverridableComponent";
4
8
 
5
9
  type ColorKeys = keyof typeof CHIP_COLORS;
6
10
  export type ChipColor = (typeof CHIP_COLORS)[ColorKeys];
@@ -54,3 +58,13 @@ export type ContainedChipProps =
54
58
  | DeletableContainedChipProps;
55
59
 
56
60
  export type ChipProps = OutlinedChipProps | ContainedChipProps;
61
+
62
+ export type ChipTypeMap<
63
+ P = {},
64
+ D extends React.ElementType = MuiChipTypeMap["defaultComponent"]
65
+ > = {
66
+ props: P & ChipProps;
67
+ defaultComponent: D;
68
+ };
69
+
70
+ export type ChipType = OverridableComponent<ChipTypeMap>;
@@ -13,7 +13,7 @@ const CustomRadio = styled(MuiRadio)(({ theme }) => ({
13
13
  display: "block",
14
14
  width: 24,
15
15
  height: 24,
16
- backgroundColor: theme.palette.token.core.focused,
16
+ backgroundColor: theme.palette.lunit_token.core.focused,
17
17
  maskImage:
18
18
  "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath" +
19
19
  " fill-rule='evenodd' clip-rule='evenodd' d='M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 " +
@@ -28,7 +28,7 @@ const iconSize = {
28
28
 
29
29
  const DefaultIcon = styled("span")(({ theme }) => ({
30
30
  ...iconSize,
31
- backgroundColor: theme.palette.token.component.selectcontrol_off,
31
+ backgroundColor: theme.palette.lunit_token.component.selectcontrol_off,
32
32
  maskImage:
33
33
  "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath" +
34
34
  " fill-rule='evenodd' clip-rule='evenodd' 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 " +
@@ -37,7 +37,7 @@ const DefaultIcon = styled("span")(({ theme }) => ({
37
37
 
38
38
  const CheckedIcon = styled("span")(({ theme }) => ({
39
39
  ...iconSize,
40
- backgroundColor: theme.palette.token.component.selectcontrol_on,
40
+ backgroundColor: theme.palette.lunit_token.component.selectcontrol_on,
41
41
  maskImage:
42
42
  "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath" +
43
43
  " fill-rule='evenodd' clip-rule='evenodd' d='M10 15C12.7614 15 15 12.7614 15 10C15 7.23858 12.7614 5 10 5C7.23858 5 5" +
@@ -70,36 +70,35 @@ const getTextFieldPaddingBySize = ({
70
70
  });
71
71
  };
72
72
 
73
- const commonStyle = ({ token }: { token: ColorToken }) => ({
74
- "&.MuiTextField-root": {
75
- width: "100%",
76
- },
73
+ const commonStyle = ({ lunit_token }: { lunit_token: ColorToken }) => ({
77
74
  "& .MuiOutlinedInput-root": {
78
75
  borderRadius: "8px",
79
- width: "100%",
80
76
 
81
77
  "& fieldset": {
82
78
  border: "none",
83
79
  },
84
80
  "&.Mui-error fieldset": {
85
- border: `1px solid ${token.component.textfield_border_error}`,
81
+ border: `1px solid ${lunit_token.component.textfield_border_error}`,
86
82
  },
87
83
  "&.Mui-focused fieldset": {
88
- border: `1px solid ${token.core.focused}`,
84
+ border: `1px solid ${lunit_token.core.focused}`,
85
+ },
86
+ "&.Mui-error.Mui-focused fieldset": {
87
+ border: `2px solid ${lunit_token.component.textfield_border_error}`,
89
88
  },
90
89
  "&.Mui-disabled": {
91
90
  opacity: 0.38,
92
91
  "&:hover::before": {
93
- backgroundColor: token.component.textfield_bg,
92
+ backgroundColor: lunit_token.component.textfield_bg,
94
93
  },
95
94
  },
96
95
  "& input, textarea": {
97
96
  padding: 0,
98
97
  textOverflow: "ellipsis",
99
98
  "&::placeholder": {
100
- color: token.core.text_medium,
99
+ color: lunit_token.core.text_light,
101
100
  opacity: 1,
102
- WebkitTextFillColor: token.core.text_medium,
101
+ WebkitTextFillColor: lunit_token.core.text_light,
103
102
  },
104
103
  },
105
104
  "& textarea": {
@@ -110,16 +109,15 @@ const commonStyle = ({ token }: { token: ColorToken }) => ({
110
109
  },
111
110
  "&::-webkit-scrollbar-thumb": {
112
111
  borderRadius: "6px",
113
- backgroundColor: token.component.scrollbars_bg,
112
+ backgroundColor: lunit_token.component.scrollbars_bg,
114
113
  },
115
114
  },
116
- background: token.component.textfield_bg,
117
- overflow: "hidden",
118
- color: token.core.text_normal,
115
+ background: lunit_token.component.textfield_bg,
116
+ color: lunit_token.core.text_normal,
119
117
  "&:hover": {
120
118
  position: "relative",
121
119
  zIndex: 0,
122
- backgroundColor: token.component.textfield_bg,
120
+ backgroundColor: lunit_token.component.textfield_bg,
123
121
  },
124
122
  "&:hover::before": {
125
123
  content: '""',
@@ -129,11 +127,11 @@ const commonStyle = ({ token }: { token: ColorToken }) => ({
129
127
  width: "100%",
130
128
  height: "100%",
131
129
  zIndex: -1,
132
- backgroundColor: token.core.hover,
130
+ backgroundColor: lunit_token.core.hover,
133
131
  },
134
132
  "&.Mui-focused": {
135
133
  "&:hover::before": {
136
- backgroundColor: token.component.textfield_bg,
134
+ backgroundColor: lunit_token.component.textfield_bg,
137
135
  },
138
136
  },
139
137
  },
@@ -142,13 +140,13 @@ const commonStyle = ({ token }: { token: ColorToken }) => ({
142
140
  opacity: 0.38,
143
141
  },
144
142
  "&.Mui-error": {
145
- color: token.core.text_error,
143
+ color: lunit_token.core.text_error,
146
144
  },
147
145
  },
148
146
  });
149
147
 
150
148
  const sizeStyle = ({
151
- token,
149
+ lunit_token,
152
150
  textFieldSize,
153
151
  hasLeftIcon,
154
152
  hasRightIcon,
@@ -157,7 +155,7 @@ const sizeStyle = ({
157
155
  }: Pick<
158
156
  BaseTextFieldProps,
159
157
  "textFieldSize" | "hasLeftIcon" | "hasRightIcon" | "multiline"
160
- > & { token: ColorToken; typography: Typography }) => ({
158
+ > & { lunit_token: ColorToken; typography: Typography }) => ({
161
159
  ...(textFieldSize === "small" && {
162
160
  "& .MuiInputBase-root": {
163
161
  padding: getTextFieldPaddingBySize({
@@ -179,17 +177,17 @@ const sizeStyle = ({
179
177
  },
180
178
  "& .MuiFormHelperText-root": {
181
179
  ...typography.body2_14_regular,
182
- color: token.core.text_medium,
180
+ color: lunit_token.core.text_medium,
183
181
  margin: 0,
184
182
  marginTop: "4px",
185
183
  paddingLeft: "4px",
186
184
 
187
185
  "&.Mui-disabled": {
188
- color: token.core.text_medium,
186
+ color: lunit_token.core.text_medium,
189
187
  opacity: 0.38,
190
188
  },
191
189
  "&.Mui-error": {
192
- color: token.core.text_error,
190
+ color: lunit_token.core.text_error,
193
191
  },
194
192
  },
195
193
  }),
@@ -214,17 +212,17 @@ const sizeStyle = ({
214
212
  },
215
213
  "& .MuiFormHelperText-root": {
216
214
  ...typography.body2_14_regular,
217
- color: token.core.text_medium,
215
+ color: lunit_token.core.text_medium,
218
216
  margin: 0,
219
217
  marginTop: "4px",
220
218
  paddingLeft: "4px",
221
219
 
222
220
  "&.Mui-disabled": {
223
- color: token.core.text_medium,
221
+ color: lunit_token.core.text_medium,
224
222
  opacity: 0.38,
225
223
  },
226
224
  "&.Mui-error": {
227
- color: token.core.text_error,
225
+ color: lunit_token.core.text_error,
228
226
  },
229
227
  },
230
228
  }),
@@ -249,17 +247,17 @@ const sizeStyle = ({
249
247
  },
250
248
  "& .MuiFormHelperText-root": {
251
249
  ...typography.body1_16_regular,
252
- color: token.core.text_medium,
250
+ color: lunit_token.core.text_medium,
253
251
  margin: 0,
254
252
  marginTop: "4px",
255
253
  paddingLeft: "4px",
256
254
 
257
255
  "&.Mui-disabled": {
258
- color: token.core.text_medium,
256
+ color: lunit_token.core.text_medium,
259
257
  opacity: 0.38,
260
258
  },
261
259
  "&.Mui-error": {
262
- color: token.core.text_error,
260
+ color: lunit_token.core.text_error,
263
261
  },
264
262
  },
265
263
  }),
@@ -282,16 +280,16 @@ const BaseTextField = styled(MuiTextField, {
282
280
  ({
283
281
  theme: {
284
282
  typography,
285
- palette: { token },
283
+ palette: { lunit_token },
286
284
  },
287
285
  multiline,
288
286
  textFieldSize,
289
287
  hasLeftIcon,
290
288
  hasRightIcon,
291
289
  }) => ({
292
- ...commonStyle({ token }),
290
+ ...commonStyle({ lunit_token }),
293
291
  ...sizeStyle({
294
- token,
292
+ lunit_token,
295
293
  textFieldSize,
296
294
  hasLeftIcon,
297
295
  hasRightIcon,
@@ -312,7 +310,7 @@ const IconWrapper = styled("div")(({ theme }) => ({
312
310
  "& svg": {
313
311
  width: "20px",
314
312
  height: "20px",
315
- color: theme.palette.token.core.text_normal,
313
+ color: theme.palette.lunit_token.core.text_normal,
316
314
  },
317
315
  }));
318
316
 
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { forwardRef } from "react";
2
2
 
3
3
  import TextFieldIcon from "./TextFieldIcon";
4
4
  import { BaseTextField } from "./TextField.style";
@@ -9,53 +9,60 @@ import type {
9
9
  SingleTextFieldProps,
10
10
  } from "./TextField.types";
11
11
 
12
- const SingleTextField = (props: SingleTextFieldProps) => {
13
- const {
14
- size = "small",
15
- leftIcon,
16
- rightIcon,
17
- leftIconSx,
18
- rightIconSx,
19
- onLeftIconClick,
20
- onRightIconClick,
21
- ...restProps
22
- } = props;
12
+ const SingleTextField = forwardRef<HTMLDivElement, SingleTextFieldProps>(
13
+ (props, ref) => {
14
+ const {
15
+ size = "small",
16
+ leftIcon,
17
+ rightIcon,
18
+ leftIconSx,
19
+ rightIconSx,
20
+ onLeftIconClick,
21
+ onRightIconClick,
22
+ InputProps,
23
+ ...restProps
24
+ } = props;
23
25
 
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
- };
26
+ return (
27
+ <BaseTextField
28
+ {...restProps}
29
+ ref={ref}
30
+ textFieldSize={size}
31
+ hasLeftIcon={Boolean(leftIcon)}
32
+ hasRightIcon={Boolean(rightIcon)}
33
+ InputProps={{
34
+ ...{
35
+ startAdornment: leftIcon && (
36
+ <TextFieldIcon
37
+ sx={{ marginRight: "4px", ...leftIconSx }}
38
+ icon={leftIcon}
39
+ onIconClick={onLeftIconClick}
40
+ />
41
+ ),
42
+ endAdornment: rightIcon && (
43
+ <TextFieldIcon
44
+ sx={{ marginLeft: "4px", ...rightIconSx }}
45
+ icon={rightIcon}
46
+ onIconClick={onRightIconClick}
47
+ />
48
+ ),
49
+ },
50
+ ...InputProps,
51
+ }}
52
+ />
53
+ );
54
+ }
55
+ );
49
56
 
50
- const MultiTextField = ({
51
- size = "small",
52
- onChange,
53
- ...restProps
54
- }: MultiTextFieldProps) => {
55
- return <BaseTextField {...restProps} textFieldSize={size} multiline />;
56
- };
57
+ const MultiTextField = forwardRef<HTMLDivElement, MultiTextFieldProps>(
58
+ ({ size = "small", onChange, ...restProps }, ref) => {
59
+ return (
60
+ <BaseTextField {...restProps} ref={ref} textFieldSize={size} multiline />
61
+ );
62
+ }
63
+ );
57
64
 
58
- const TextField = (props: TextFieldProps) => {
65
+ const TextField = forwardRef<HTMLDivElement, TextFieldProps>((props, ref) => {
59
66
  const {
60
67
  rows,
61
68
  size,
@@ -67,14 +74,15 @@ const TextField = (props: TextFieldProps) => {
67
74
  return multiline ? (
68
75
  <MultiTextField
69
76
  {...restProps}
77
+ ref={ref}
70
78
  maxRows={Infinity}
71
79
  size={size}
72
80
  variant={variant}
73
81
  rows={rows}
74
82
  />
75
83
  ) : (
76
- <SingleTextField {...restProps} size={size} variant={variant} />
84
+ <SingleTextField {...restProps} ref={ref} size={size} variant={variant} />
77
85
  );
78
- };
86
+ });
79
87
 
80
88
  export default TextField;
@@ -10,8 +10,8 @@ export const StyledToast = styled(Alert)(({ theme, severity }) => {
10
10
  "&.MuiAlert-root": {
11
11
  padding: "8px 16px 8px 16px",
12
12
  margin: 0,
13
- color: theme.palette.token.core.text_normal,
14
- backgroundColor: theme.palette.token.core.bg_03,
13
+ color: theme.palette.lunit_token.core.text_normal,
14
+ backgroundColor: theme.palette.lunit_token.core.bg_03,
15
15
  borderRadius: "8px",
16
16
  },
17
17
  "& .MuiAlert-icon": {
@@ -42,7 +42,7 @@ export const StyledToast = styled(Alert)(({ theme, severity }) => {
42
42
  marginRight: "0px",
43
43
  padding: 0,
44
44
  "& .MuiSvgIcon-root": {
45
- color: theme.palette.token.core.text_normal,
45
+ color: theme.palette.lunit_token.core.text_normal,
46
46
  },
47
47
  },
48
48
  };
@@ -6,12 +6,12 @@ export const getIconColor = (
6
6
  ) => {
7
7
  switch (severity) {
8
8
  case "info":
9
- return theme.palette.token.core.icon_info_02;
9
+ return theme.palette.lunit_token.core.icon_info_02;
10
10
  case "warning":
11
- return theme.palette.token.core.icon_warning_02;
11
+ return theme.palette.lunit_token.core.icon_warning_02;
12
12
  case "error":
13
- return theme.palette.token.core.icon_error_02;
13
+ return theme.palette.lunit_token.core.icon_error_02;
14
14
  default:
15
- return theme.palette.token.core.icon_success_02;
15
+ return theme.palette.lunit_token.core.icon_success_02;
16
16
  }
17
17
  };