@lunit/design-system 1.0.0 → 2.0.1

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 (110) hide show
  1. package/dist/cjs/components/Alert/index.js +1 -1
  2. package/dist/cjs/components/Alert/index.js.map +1 -1
  3. package/dist/cjs/components/Button/index.js +1 -1
  4. package/dist/cjs/components/Button/index.js.map +1 -1
  5. package/dist/cjs/components/Checkbox/index.js +1 -1
  6. package/dist/cjs/components/Checkbox/index.js.map +1 -1
  7. package/dist/cjs/components/Dialog/index.js +2 -0
  8. package/dist/cjs/components/Dialog/index.js.map +1 -0
  9. package/dist/cjs/components/Radio/index.js +1 -1
  10. package/dist/cjs/components/Radio/index.js.map +1 -1
  11. package/dist/cjs/components/ToggleButton/index.js +1 -1
  12. package/dist/cjs/components/ToggleButton/index.js.map +1 -1
  13. package/dist/cjs/index.js +1 -1
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/components/Button/Button.styled.js +1 -1
  16. package/dist/components/Button/Button.styled.js.map +1 -1
  17. package/dist/components/Checkbox/Checkbox.js +9 -19
  18. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  19. package/dist/components/Dialog/Dialog.js +57 -0
  20. package/dist/components/Dialog/Dialog.js.map +1 -0
  21. package/dist/components/Dialog/Dialog.styled.js +146 -0
  22. package/dist/components/Dialog/Dialog.styled.js.map +1 -0
  23. package/dist/components/Dialog/components/DialogAction.js +18 -0
  24. package/dist/components/Dialog/components/DialogAction.js.map +1 -0
  25. package/dist/components/Dialog/index.js +2 -0
  26. package/dist/components/Dialog/index.js.map +1 -0
  27. package/dist/components/Radio/Radio.js +7 -21
  28. package/dist/components/Radio/Radio.js.map +1 -1
  29. package/dist/components/ToggleButton/ToggleButton.styled.js +1 -1
  30. package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -1
  31. package/dist/foundation/Elevation/index.js +1 -1
  32. package/dist/foundation/Elevation/index.js.map +1 -1
  33. package/dist/foundation/Typography/index.js +0 -6
  34. package/dist/foundation/Typography/index.js.map +1 -1
  35. package/dist/foundation/Typography/tokens.js +1 -1
  36. package/dist/foundation/colors/base/grey.js +3 -1
  37. package/dist/foundation/colors/base/grey.js.map +1 -1
  38. package/dist/foundation/colors/index.js +5 -6
  39. package/dist/foundation/colors/index.js.map +1 -1
  40. package/dist/foundation/colors/token/component.js +31 -115
  41. package/dist/foundation/colors/token/component.js.map +1 -1
  42. package/dist/foundation/colors/token/core.js +43 -75
  43. package/dist/foundation/colors/token/core.js.map +1 -1
  44. package/dist/index.js +1 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/types/components/Alert/Alert.utils.d.ts +3 -3
  47. package/dist/types/components/Button/Button.styled.d.ts +8 -8
  48. package/dist/types/components/Chip/Chip.styled.d.ts +12 -12
  49. package/dist/types/components/Dialog/Dialog.d.ts +50 -0
  50. package/dist/types/components/Dialog/Dialog.styled.d.ts +12 -0
  51. package/dist/types/components/Dialog/components/DialogAction.d.ts +8 -0
  52. package/dist/types/components/Dialog/index.d.ts +2 -0
  53. package/dist/types/components/Toast/Toast.utils.d.ts +1 -1
  54. package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -2
  55. package/dist/types/foundation/Elevation/index.d.ts +1 -1
  56. package/dist/types/foundation/Typography/index.d.ts +1 -7
  57. package/dist/types/foundation/Typography/tokens.d.ts +1 -1
  58. package/dist/types/foundation/colors/base/grey.d.ts +2 -0
  59. package/dist/types/foundation/colors/index.d.ts +5 -6
  60. package/dist/types/foundation/colors/token/types.d.ts +0 -2
  61. package/dist/types/foundation/colors/types.d.ts +78 -76
  62. package/dist/types/foundation/index.d.ts +5 -0
  63. package/dist/types/index.d.ts +1 -1
  64. package/package.json +1 -1
  65. package/src/components/Button/Button.styled.ts +1 -1
  66. package/src/components/Checkbox/Checkbox.tsx +39 -22
  67. package/src/components/Dialog/Dialog.styled.ts +172 -0
  68. package/src/components/Dialog/Dialog.tsx +189 -0
  69. package/src/components/Dialog/components/DialogAction.tsx +36 -0
  70. package/src/components/Dialog/index.ts +14 -0
  71. package/src/components/Radio/Radio.tsx +37 -25
  72. package/src/components/ToggleButton/ToggleButton.styled.ts +1 -1
  73. package/src/foundation/Elevation/index.ts +1 -1
  74. package/src/foundation/Typography/index.ts +0 -6
  75. package/src/foundation/Typography/tokens.ts +1 -1
  76. package/src/foundation/colors/base/grey.ts +3 -1
  77. package/src/foundation/colors/index.ts +5 -6
  78. package/src/foundation/colors/token/component.ts +26 -110
  79. package/src/foundation/colors/token/core.ts +39 -71
  80. package/src/foundation/colors/token/types.ts +0 -2
  81. package/src/foundation/colors/types.ts +78 -75
  82. package/src/index.ts +1 -1
  83. package/src/stories/GettingStarted.mdx +88 -0
  84. package/src/stories/components/Button/BasicButton.stories.tsx +80 -52
  85. package/src/stories/components/Button/ButtonDocs.mdx +187 -0
  86. package/src/stories/components/Button/Color.stories.tsx +132 -0
  87. package/src/stories/components/Button/IconButton.stories.tsx +41 -35
  88. package/src/stories/components/Button/Kind.stories.tsx +13 -52
  89. package/src/stories/components/{SelectControl/Checkbox.stories.tsx → CheckBox/BasicCheckbox.stories.tsx} +84 -105
  90. package/src/stories/components/CheckBox/CheckboxDocs.mdx +85 -0
  91. package/src/stories/components/Chip/Chip.stories.tsx +65 -0
  92. package/src/stories/components/Chip/ChipDocs.mdx +132 -0
  93. package/src/stories/components/Dialog/Dialog.stories.tsx +320 -0
  94. package/src/stories/components/Dialog/DialogDocs.mdx +181 -0
  95. package/src/stories/components/TextField/BasicTextField.stories.tsx +214 -0
  96. package/src/stories/components/TextField/TextFieldDocs.mdx +140 -0
  97. package/src/stories/components/TextField/TextFieldSize.stories.tsx +26 -3
  98. package/src/stories/components/ToggleButton/Basic.stories.tsx +312 -0
  99. package/src/stories/components/ToggleButton/ToggleButtonDocs.mdx +180 -0
  100. package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +65 -0
  101. package/src/stories/components/ToggleButton/WithIcon.stories.tsx +138 -0
  102. package/src/stories/foundation/Typography/Typography.mdx +31 -46
  103. package/src/stories/foundation/Typography/Typography.stories.tsx +30 -1
  104. package/src/stories/foundation/colors/ColorSystem.tsx +86 -0
  105. package/src/stories/foundation/colors/Docs.mdx +225 -0
  106. package/src/stories/foundation/colors/TokenPaletteTable.tsx +1 -5
  107. package/src/components/Modal/Modal.tsx +0 -8
  108. package/src/components/Modal/index.ts +0 -1
  109. package/src/stories/components/Modal/Modal.stories.tsx +0 -15
  110. package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +0 -44
@@ -0,0 +1,181 @@
1
+ import { Canvas, Stories, Controls, Meta, Story } from "@storybook/blocks";
2
+ import { Error } from "@lunit/design-system-icons";
3
+
4
+ import Dialog from "@/components/Dialog";
5
+ import * as DialogStories from "./Dialog.stories";
6
+
7
+ <Meta name="Dialog Docs" of={DialogStories} />
8
+
9
+ # Dialog
10
+
11
+ Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple tasks.
12
+ Dialogs are rendered in a [Portal](https://react.dev/reference/react-dom/createPortal) and are not affected by the z-index of the parent component.
13
+
14
+ ## Usage
15
+
16
+ ### Basic Dialog
17
+
18
+ ```tsx
19
+ import { Dialog } from "@lunit/design-system";
20
+ // or
21
+ import Dialog from "@lunit/design-system/Dialog";
22
+
23
+ <Dialog />;
24
+ ```
25
+
26
+ ### Demo
27
+
28
+ The Dialog demo cannot be seen in the mdx canvas since it is rendered in a [Portal](https://react.dev/reference/react-dom/createPortal).
29
+ Please go to the stories to see the demo.
30
+
31
+ <Controls />
32
+
33
+ ### IsOpen
34
+
35
+ The `isOpen` prop is used to control the render of the Dialog. <br />
36
+ If it is set to `false`, the Dialog will not be rendered in the DOM.
37
+
38
+ ```tsx
39
+ <Dialog isOpen={true} onClose={close} type="passive" title="Title area">
40
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
41
+ </Dialog>
42
+ ```
43
+
44
+ ### Dismiss(onClose, enableBackButtonClose, enableBackdropClick)
45
+
46
+ The `onClose` prop is used to close the Dialog. You can pass a function to the prop to close the Dialog. <br />
47
+ If the `enableBackButtonClick` prop is set to `true`, the Dialog will be closed when the back button(escape/backspace key) is pressed. <br />
48
+ If the `enableBackdropClose` prop is set to `true`, the Dialog will be closed when the backdrop(outside of the dialog area) is clicked. <br />
49
+
50
+ <br />
51
+ The `enableBackButtonClick` is awalys `true` in Passive Modal, but it is optional
52
+ in Action Modal. <br />
53
+ The `enableBackdropClose` is awalys `true` only in Passive Modal.
54
+
55
+ ```tsx
56
+ <Dialog isOpen={true} onClose={close} type="passive" title="Title area">
57
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
58
+ </Dialog>
59
+ <Dialog isOpen={true} onClose={close} type="action" title="Title area" actions={actionsChildren} enableBackButtonClick>
60
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
61
+ </Dialog>
62
+ ```
63
+
64
+ ### Type
65
+
66
+ The Dialog Modal has 2 types: passive and action. <br />
67
+ Passive modals are persistent until dismissed in one of the ways mentioned above. <br />
68
+ Action modals must have actions and are dismissed when the user clicks on one of the actions (backdrop close is also optional). <br />
69
+
70
+ ```tsx
71
+ <Dialog isOpen={true} onClose={close} type="passive" title="Title area">
72
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
73
+ </Dialog>
74
+ <Dialog isOpen={true} onClose={close} type="action" title="Title area" actions={actionsChildren}>
75
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
76
+ </Dialog>
77
+
78
+ ```
79
+
80
+ ### NonModal
81
+
82
+ The nonModal prop renders the Dialog as a non-modal Dialog. <br />
83
+ Non-modal Dialogs provide non-critical information and do not block the user's interaction with the rest of the application. <br />
84
+ Non-modal Dialogs have an action type only. <br />
85
+
86
+ ```tsx
87
+ <Dialog
88
+ isOpen={true}
89
+ onClose={close}
90
+ nonModal
91
+ type="action"
92
+ title="Title area"
93
+ actions={actionsChildren}
94
+ >
95
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
96
+ </Dialog>
97
+ ```
98
+
99
+ ### Title(Title, titleIcon, titleVariant)
100
+
101
+ The `title` prop sets the title of the Dialog. <br />
102
+ The `titleIcon` prop sets the icon of the title. <br />
103
+ The `titleVariant` prop sets the variant of the title icon. <br />
104
+
105
+ ```tsx
106
+ <Dialog
107
+ isOpen={true}
108
+ onClose={close}
109
+ type="passive"
110
+ title="Title area"
111
+ titleIcon={<Error color="error" variant="filled" />}
112
+ titleVariant="error"
113
+ >
114
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
115
+ </Dialog>
116
+ ```
117
+
118
+ ### Children
119
+
120
+ The `children` prop sets the content of the Dialog. <br />
121
+ You can pass any component to the children prop.
122
+
123
+ ```tsx
124
+ <Dialog isOpen={true} onClose={close} type="passive" title="Title area">
125
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
126
+ </Dialog>
127
+ ```
128
+
129
+ ### Actions
130
+
131
+ The `actions` prop sets the actions of the Dialog. <br />
132
+ You can pass any component to the actions prop only when the type of the modal is action.
133
+
134
+ ```tsx
135
+ <Dialog
136
+ isOpen={true}
137
+ onClose={close}
138
+ type="action"
139
+ title="Title area"
140
+ actions={actionsChildren}
141
+ >
142
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
143
+ </Dialog>
144
+ ```
145
+
146
+ ### Size
147
+
148
+ The Dialog has 3 sizes: `small` and `medium`.
149
+
150
+ ```tsx
151
+ <Dialog
152
+ isOpen={true}
153
+ onClose={close}
154
+ type="passive"
155
+ title="Title area"
156
+ size="small"
157
+ >
158
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
159
+ </Dialog>
160
+
161
+ <Dialog
162
+ isOpen={true}
163
+ onClose={close}
164
+ type="passive"
165
+ title="Title area"
166
+ size="medium"
167
+ >
168
+ Lorem Ipsum is simply dummy text of the a printing and typesetting industry
169
+ </Dialog>
170
+ ```
171
+
172
+ ## Reference
173
+
174
+ - [Material-UI Dialog](https://mui.com/material-ui/react-dialog/)
175
+ - [Material-UI Dialog API](https://mui.com/material-ui/api/dialog/)
176
+ - [Lunit Design System Dialog Figma](https://www.figma.com/design/9CoirIDPof6exynJosiGXi/Design-System_2.0.0_Latest?node-id=474-56088&m=dev)
177
+
178
+ ## Support
179
+
180
+ - Github: [Create a new issue](https://github.com/lunit-io/design-system/issues/new)
181
+ - Slack: #tf_design_system
@@ -0,0 +1,214 @@
1
+ import React from "react";
2
+ import { Box } from "@mui/material";
3
+ import { Bell } from "@lunit/design-system-icons";
4
+
5
+ import TextField from "@/components/TextField/TextField";
6
+
7
+ import type { StoryObj, Meta, StoryFn } from "@storybook/react";
8
+
9
+ export default {
10
+ title: "Components/TextField",
11
+ component: TextField,
12
+ args: {
13
+ multiline: false,
14
+ size: "small",
15
+ disabled: false,
16
+ error: false,
17
+ placeholder: "Please typing...",
18
+ helperText: "",
19
+ },
20
+ argTypes: {
21
+ multiline: {
22
+ control: {
23
+ type: "radio",
24
+ },
25
+ options: [true, false],
26
+ description:
27
+ "The multiline prop transforms the text field into a TextareaAutosize element.",
28
+ },
29
+ error: {
30
+ control: {
31
+ type: "radio",
32
+ },
33
+ options: [true, false],
34
+ description:
35
+ "The error prop toggles the error state. The helperText prop can then be used to provide feedback to the user about the error.",
36
+ },
37
+ disabled: {
38
+ control: {
39
+ type: "radio",
40
+ },
41
+ options: [true, false],
42
+ description: "If true, the text field will be disabled.",
43
+ table: {
44
+ defaultValue: { summary: false },
45
+ type: { summary: [true, false] },
46
+ },
47
+ },
48
+ size: {
49
+ control: {
50
+ type: "radio",
51
+ },
52
+ description: "The size of the text field.",
53
+ table: {
54
+ defaultValue: { summary: "small" },
55
+ type: { summary: ["small", "medium", "large"] },
56
+ },
57
+ },
58
+ placeholder: {
59
+ type: "string",
60
+ description: "The placeholder content.",
61
+ table: {
62
+ defaultValue: { summary: "undefined" },
63
+ type: { summary: "string" },
64
+ },
65
+ },
66
+ helperText: {
67
+ type: "string",
68
+ description:
69
+ 'The helper text content, use "error " or "sub text " to display helper text.',
70
+ table: {
71
+ defaultValue: { summary: "undefined" },
72
+ type: { summary: "string" },
73
+ },
74
+ },
75
+ },
76
+ parameters: {
77
+ controls: {
78
+ include: [
79
+ "size",
80
+ "disabled",
81
+ "helperText",
82
+ "placeholder",
83
+ "multiline",
84
+ "error",
85
+ ],
86
+ },
87
+ docs: {
88
+ description: {
89
+ component: `It is a text field that allows users to enter and edit text.
90
+ \n It is usually used in forms. It can be used as a single line or multi-line text field.
91
+ \n It can be used with an icon on the left or right side.`,
92
+ },
93
+ },
94
+ },
95
+ decorators: [(Story) => <Box>{Story()}</Box>],
96
+ } as Meta<typeof TextField>;
97
+
98
+ export const BasicTextField: StoryObj<typeof TextField> = {
99
+ render: (args) => <TextField {...args}>{args.children}</TextField>,
100
+ parameters: {
101
+ chromatic: { disableSnapshot: true },
102
+ },
103
+ };
104
+
105
+ const MultiAndSingleTemplate: StoryFn<typeof TextField> = (args) => {
106
+ return (
107
+ <Box sx={{ display: "flex", gap: 2 }}>
108
+ <TextField {...args} />
109
+ <TextField {...args} multiline={true} />
110
+ </Box>
111
+ );
112
+ };
113
+
114
+ export const MultiAndSingle: StoryObj<typeof TextField> = {
115
+ render: MultiAndSingleTemplate,
116
+ parameters: {
117
+ controls: {
118
+ include: ["size", "disabled", "helperText", "placeholder", "error"],
119
+ },
120
+ chromatic: { disableSnapshot: true },
121
+ },
122
+ };
123
+
124
+ const DisabledTemplate: StoryFn<typeof TextField> = (args) => {
125
+ return (
126
+ <Box sx={{ display: "flex", gap: 2 }}>
127
+ <TextField {...args} disabled />
128
+ <TextField {...args} multiline={true} disabled />
129
+ </Box>
130
+ );
131
+ };
132
+
133
+ export const Disabled: StoryObj<typeof TextField> = {
134
+ render: DisabledTemplate,
135
+ parameters: {
136
+ controls: {
137
+ include: ["size", "helperText", "placeholder", "error", "disabled"],
138
+ },
139
+ chromatic: { disableSnapshot: true },
140
+ },
141
+ };
142
+
143
+ const ErrorTemplate: StoryFn<typeof TextField> = (args) => {
144
+ return (
145
+ <Box sx={{ display: "flex", gap: 2 }}>
146
+ <TextField {...args} error />
147
+ <TextField {...args} multiline={true} error />
148
+ </Box>
149
+ );
150
+ };
151
+
152
+ export const Error: StoryObj<typeof TextField> = {
153
+ render: ErrorTemplate,
154
+ parameters: {
155
+ controls: {
156
+ include: ["size", "helperText", "placeholder", "disabled"],
157
+ },
158
+ chromatic: { disableSnapshot: true },
159
+ },
160
+ };
161
+
162
+ const PlaceholderTemplate: StoryFn<typeof TextField> = (args) => {
163
+ return (
164
+ <Box sx={{ display: "flex", gap: 2 }}>
165
+ <TextField {...args} placeholder="Please typing..." />
166
+ <TextField {...args} multiline={true} placeholder="Please typing..." />
167
+ </Box>
168
+ );
169
+ };
170
+
171
+ export const Placeholder: StoryObj<typeof TextField> = {
172
+ render: PlaceholderTemplate,
173
+ parameters: {
174
+ controls: {
175
+ include: ["size", "helperText", "disabled", "error"],
176
+ },
177
+ chromatic: { disableSnapshot: true },
178
+ },
179
+ };
180
+
181
+ const HelperTextTemplate: StoryFn<typeof TextField> = (args) => {
182
+ return (
183
+ <Box sx={{ display: "flex", gap: 2 }}>
184
+ <TextField {...args} helperText="helper text" />
185
+ <TextField {...args} multiline={true} helperText="helper text" />
186
+ </Box>
187
+ );
188
+ };
189
+
190
+ export const HelperText: StoryObj<typeof TextField> = {
191
+ render: HelperTextTemplate,
192
+ parameters: {
193
+ controls: {
194
+ include: ["size", "disabled", "error", "placeholder"],
195
+ },
196
+ chromatic: { disableSnapshot: true },
197
+ },
198
+ };
199
+
200
+ const IconTemplate: StoryFn<typeof TextField> = (args) => {
201
+ return (
202
+ <Box sx={{ display: "flex", gap: 2 }}>
203
+ <TextField {...args} leftIcon={<Bell />} />
204
+ <TextField {...args} rightIcon={<Bell />} />
205
+ </Box>
206
+ );
207
+ };
208
+
209
+ export const Icon: StoryObj<typeof TextField> = {
210
+ render: IconTemplate,
211
+ parameters: {
212
+ chromatic: { disableSnapshot: true },
213
+ },
214
+ };
@@ -0,0 +1,140 @@
1
+ import { Canvas, Stories, Controls, Meta, Story } from "@storybook/blocks";
2
+ import Box from "@mui/material/Box";
3
+
4
+ import TextField from "@/components/TextField";
5
+ import * as TextFieldStories from "./BasicTextField.stories";
6
+ import * as TextFieldSizeStories from "./TextFieldSize.stories";
7
+
8
+ <Meta name="TextField Docs" of={TextFieldStories} />
9
+
10
+ # TextField
11
+
12
+ Text Fields let users enter and edit text.
13
+
14
+ ## Usage
15
+
16
+ ### Basic TextField
17
+
18
+ ```tsx
19
+ import { TextField } from "@lunit/design-system";
20
+ // or
21
+ import TextField from "@lunit/design-system/TextField";
22
+
23
+ <TextField />;
24
+ ```
25
+
26
+ ### Demo
27
+
28
+ <Canvas of={TextFieldStories.BasicTextField} sourceState="none" />
29
+
30
+ <Controls />
31
+
32
+ ### MultiLine
33
+
34
+ The multiline prop transforms the text field into a [TextareaAutosize](https://mui.com/material-ui/react-textarea-autosize/) element.<br />
35
+ If multiline is undefined, it behaves the same as false.<br />
36
+ Default multiline is `false`.
37
+
38
+ <Canvas of={TextFieldStories.MultiAndSingle} sourceState="none" />
39
+
40
+ ```tsx
41
+ <TextField />
42
+ <TextField multiline />
43
+ ```
44
+
45
+ ### Size
46
+
47
+ The TextField have three sizes: `small`, `medium` and `large`.<br />
48
+ Using the `size` prop, you can change the size of the TextField.<br />
49
+ Default size is `small`.
50
+
51
+ <Canvas
52
+ of={TextFieldSizeStories.TextFieldSize}
53
+ meta={TextFieldSizeStories}
54
+ sourceState="none"
55
+ />
56
+
57
+ ```tsx
58
+ // multiline is false or undefined
59
+ <TextField size="small" />
60
+ <TextField size="medium" />
61
+ <TextField size="large" />
62
+
63
+ // multiline is true
64
+ <TextField multiline size="small" />
65
+ <TextField multiline size="medium" />
66
+ <TextField multiline size="large" />
67
+ ```
68
+
69
+ ### Disabled
70
+
71
+ If you want to disable the TextField, you can use the `disabled` prop.<br />
72
+ Default disabled is `false`.
73
+
74
+ <Canvas of={TextFieldStories.Disabled} sourceState="none" />
75
+
76
+ ```tsx
77
+ <TextField disabled />
78
+ <TextField multiline disabled />
79
+ ```
80
+
81
+ ### Error
82
+
83
+ The error prop toggles the error state.<br />
84
+ The helperText prop can then be used to provide feedback to the user about the error.<br />
85
+ Default error is `false`.
86
+
87
+ <Canvas of={TextFieldStories.Error} sourceState="none" />
88
+
89
+ ```tsx
90
+ <TextField {...args} error />
91
+ <TextField {...args} error multiline={true} />
92
+ ```
93
+
94
+ ### Placeholder
95
+
96
+ The placeholder attribute defines the text displayed in a form control when the control has no value.<br />
97
+ The placeholder text should provide a brief hint to the user as to the expected type of data<br />
98
+ that should be entered into the control.
99
+
100
+ <Canvas of={TextFieldStories.Placeholder} sourceState="none" />
101
+
102
+ ```tsx
103
+ <TextField placeholder="Please typing..." />
104
+ <TextField multiline placeholder="Please typing..." />
105
+ ```
106
+
107
+ ### helperText
108
+
109
+ The helper text content, use "error " or "sub text " to display helper text.
110
+
111
+ <Canvas of={TextFieldStories.HelperText} sourceState="none" />
112
+
113
+ ```tsx
114
+ <TextField helperText="helper text" />
115
+ <TextField multiline helperText="helper text" />
116
+ ```
117
+
118
+ ### Icon
119
+
120
+ TextField icons can be added to the left and right sides.<br />
121
+ Use the leftIcon prop for the left side and the rightIcon prop for the right side. <br />
122
+ Icon can only be used with a single TextField.
123
+
124
+ <Canvas of={TextFieldStories.Icon} sourceState="none" />
125
+
126
+ ```tsx
127
+ <TextField leftIcon={<Bell />} />
128
+ <TextField rightIcon={<Bell />} />
129
+ ```
130
+
131
+ ## Reference
132
+
133
+ - [Material-UI TextField](https://mui.com/material-ui/react-text-field/)
134
+ - [Material-UI TextField API](https://mui.com/material-ui/api/text-field/)
135
+ - [Lunit Design System TextField Figma](https://www.figma.com/file/BSdRUpEPp7XiJ9YnEqpf6F/1.0.0_Components?node-id=284%3A151&mode=dev)
136
+
137
+ ## Support
138
+
139
+ - Github: [Create a new issue](https://github.com/lunit-io/design-system/issues/new)
140
+ - Slack: #tf_design_system
@@ -2,8 +2,8 @@ import React from "react";
2
2
  import {
3
3
  Box,
4
4
  Table,
5
- TableBody,
6
5
  TableCell,
6
+ TableBody,
7
7
  TableHead,
8
8
  TableRow,
9
9
  } from "@mui/material";
@@ -73,7 +73,7 @@ export default {
73
73
  decorators: [(Story) => <Box className="base00">{Story()}</Box>],
74
74
  } as Meta<typeof TextField>;
75
75
 
76
- const TextFieldSizeTemplate: StoryFn<typeof TextField> = (args) => (
76
+ const TextFieldSizeWithTableTemplate: StoryFn<typeof TextField> = (args) => (
77
77
  <Table>
78
78
  <TableHead>
79
79
  <TableRow>
@@ -129,6 +129,29 @@ const TextFieldSizeTemplate: StoryFn<typeof TextField> = (args) => (
129
129
  );
130
130
 
131
131
  export const TextFieldSize = {
132
- render: TextFieldSizeTemplate,
132
+ render: TextFieldSizeWithTableTemplate,
133
133
  name: "Size",
134
134
  };
135
+
136
+ const TextFieldSizeTemplate: StoryFn<typeof TextField> = (args) => (
137
+ <Box sx={{ display: "flex", flexDirection: "column", gap: 4 }}>
138
+ <Box>
139
+ <TextField sx={{ mr: 4 }} {...args} />
140
+ <TextField sx={{ mr: 4 }} {...args} size="medium" />
141
+ <TextField {...args} size="large" />
142
+ </Box>
143
+ <Box>
144
+ <TextField sx={{ mr: 4 }} {...args} multiline />
145
+ <TextField sx={{ mr: 4 }} {...args} size="medium" multiline />
146
+ <TextField {...args} size="large" multiline />
147
+ </Box>
148
+ </Box>
149
+ );
150
+
151
+ export const TextFieldOnlySize = {
152
+ render: TextFieldSizeTemplate,
153
+ name: "Size Only",
154
+ parameters: {
155
+ chromatic: { disableSnapshot: true },
156
+ },
157
+ };