@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
@@ -1,15 +1,21 @@
1
1
  import React from "react";
2
- import { ComponentStory, ComponentMeta } from "@storybook/react";
2
+ import { StoryFn, Meta } from "@storybook/react";
3
3
 
4
4
  import Dropdown from "@/components/Dropdown";
5
5
 
6
6
  export default {
7
7
  title: "Components/Dropdown",
8
8
  component: Dropdown,
9
- } as ComponentMeta<typeof Dropdown>;
9
+ } as Meta<typeof Dropdown>;
10
10
 
11
- const Template: ComponentStory<typeof Dropdown> = () => <Dropdown />;
11
+ const Template: StoryFn<typeof Dropdown> = () => <Dropdown />;
12
12
 
13
- export const SingleSelect = Template.bind({});
14
- export const MultiSelect = Template.bind({});
15
- export const NoSelect = Template.bind({});
13
+ export const SingleSelect = {
14
+ render: Template,
15
+ };
16
+ export const MultiSelect = {
17
+ render: Template,
18
+ };
19
+ export const NoSelect = {
20
+ render: Template,
21
+ };
@@ -1,13 +1,15 @@
1
1
  import React from "react";
2
- import { ComponentStory, ComponentMeta } from "@storybook/react";
2
+ import { StoryFn, Meta } from "@storybook/react";
3
3
 
4
4
  import Modal from "@/components/Modal";
5
5
 
6
6
  export default {
7
7
  title: "Components/Modal",
8
8
  component: Modal,
9
- } as ComponentMeta<typeof Modal>;
9
+ } as Meta<typeof Modal>;
10
10
 
11
- const Template: ComponentStory<typeof Modal> = () => <Modal />;
11
+ const Template: StoryFn<typeof Modal> = () => <Modal />;
12
12
 
13
- export const LunitModal = Template.bind({});
13
+ export const LunitModal = {
14
+ render: Template,
15
+ };
@@ -9,7 +9,7 @@ import {
9
9
  } from "@mui/material";
10
10
  import Checkbox from "@/components/Checkbox";
11
11
  import FormLabel from "@/components/FormLabel";
12
- import { ComponentMeta, ComponentStory } from "@storybook/react";
12
+ import { Meta, StoryFn } from "@storybook/react";
13
13
 
14
14
  export default {
15
15
  title: "Components/Checkbox",
@@ -80,9 +80,9 @@ export default {
80
80
  },
81
81
  },
82
82
  },
83
- } as ComponentMeta<typeof Checkbox>;
83
+ } as Meta<typeof Checkbox>;
84
84
 
85
- const BasicCheckboxTemplate: ComponentStory<typeof Checkbox> = (args) => {
85
+ const BasicCheckboxTemplate: StoryFn<typeof Checkbox> = (args) => {
86
86
  const [checked, setChecked] = useState(false);
87
87
 
88
88
  useEffect(() => {
@@ -98,9 +98,11 @@ const BasicCheckboxTemplate: ComponentStory<typeof Checkbox> = (args) => {
98
98
  );
99
99
  };
100
100
 
101
- export const BasicCheckbox = BasicCheckboxTemplate.bind({});
101
+ export const BasicCheckbox = {
102
+ render: BasicCheckboxTemplate,
103
+ };
102
104
 
103
- const LabelTemplate: ComponentStory<typeof Checkbox> = (args) => {
105
+ const LabelTemplate: StoryFn<typeof Checkbox> = (args) => {
104
106
  const [checked, setChecked] = useState(false);
105
107
  useEffect(() => {
106
108
  setChecked(Boolean(args.checked));
@@ -120,17 +122,19 @@ const LabelTemplate: ComponentStory<typeof Checkbox> = (args) => {
120
122
  );
121
123
  };
122
124
 
123
- export const Label = LabelTemplate.bind({});
125
+ export const Label = {
126
+ render: LabelTemplate,
124
127
 
125
- Label.parameters = {
126
- docs: {
127
- description: {
128
- story: "You can use the `FormControlLabel` component to provide label.",
128
+ parameters: {
129
+ docs: {
130
+ description: {
131
+ story: "You can use the `FormControlLabel` component to provide label.",
132
+ },
129
133
  },
130
134
  },
131
135
  };
132
136
 
133
- const StatusTemplate: ComponentStory<typeof Checkbox> = (args) => (
137
+ const StatusTemplate: StoryFn<typeof Checkbox> = (args) => (
134
138
  <Table sx={{ width: 650 }}>
135
139
  <TableHead>
136
140
  <TableRow>
@@ -186,9 +190,11 @@ const StatusTemplate: ComponentStory<typeof Checkbox> = (args) => (
186
190
  </Table>
187
191
  );
188
192
 
189
- export const Status = StatusTemplate.bind({});
193
+ export const Status = {
194
+ render: StatusTemplate,
195
+ };
190
196
 
191
- const IndeterminateTemplate: ComponentStory<typeof Checkbox> = (args) => {
197
+ const IndeterminateTemplate: StoryFn<typeof Checkbox> = (args) => {
192
198
  const [checked, setChecked] = React.useState([true, false]);
193
199
 
194
200
  const handleChange1 = (event: React.ChangeEvent<HTMLInputElement>) => {
@@ -233,16 +239,18 @@ const IndeterminateTemplate: ComponentStory<typeof Checkbox> = (args) => {
233
239
  );
234
240
  };
235
241
 
236
- export const Indeterminate = IndeterminateTemplate.bind({});
242
+ export const Indeterminate = {
243
+ render: IndeterminateTemplate,
237
244
 
238
- Indeterminate.argTypes = {
239
- disabled: {
240
- control: false,
241
- },
242
- checked: {
243
- control: false,
244
- },
245
- indeterminate: {
246
- control: false,
245
+ argTypes: {
246
+ disabled: {
247
+ control: false,
248
+ },
249
+ checked: {
250
+ control: false,
251
+ },
252
+ indeterminate: {
253
+ control: false,
254
+ },
247
255
  },
248
256
  };
@@ -1,9 +1,8 @@
1
1
  import React, { useEffect } from "react";
2
- import { Box } from "@mui/material";
3
2
  import Radio from "@/components/Radio";
4
3
  import RadioGroup from "@/components/RadioGroup";
5
4
  import FormLabel from "@/components/FormLabel";
6
- import { ComponentMeta, ComponentStory } from "@storybook/react";
5
+ import { Meta, StoryFn } from "@storybook/react";
7
6
 
8
7
  export default {
9
8
  title: "Components/Radio",
@@ -35,9 +34,9 @@ export default {
35
34
  component: "This component is identical to the MUI RadioGroup component.",
36
35
  },
37
36
  },
38
- } as ComponentMeta<typeof RadioGroup>;
37
+ } as Meta<typeof RadioGroup>;
39
38
 
40
- const RadioGroupTemplate: ComponentStory<typeof RadioGroup> = (args) => {
39
+ const RadioGroupTemplate: StoryFn<typeof RadioGroup> = (args) => {
41
40
  const [value, setValue] = React.useState("On");
42
41
  const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
43
42
  setValue((event.target as HTMLInputElement).value);
@@ -64,4 +63,6 @@ const RadioGroupTemplate: ComponentStory<typeof RadioGroup> = (args) => {
64
63
  );
65
64
  };
66
65
 
67
- export const ControlledRadioGroup = RadioGroupTemplate.bind({});
66
+ export const ControlledRadioGroup = {
67
+ render: RadioGroupTemplate,
68
+ };
@@ -8,7 +8,7 @@ import {
8
8
  TableCell,
9
9
  } from "@mui/material";
10
10
  import Radio from "@/components/Radio";
11
- import { ComponentMeta, ComponentStory } from "@storybook/react";
11
+ import { Meta, StoryFn } from "@storybook/react";
12
12
 
13
13
  export default {
14
14
  title: "Components/Radio",
@@ -45,9 +45,9 @@ export default {
45
45
  component: "This component base is Material UI Radio component.",
46
46
  },
47
47
  },
48
- } as ComponentMeta<typeof Radio>;
48
+ } as Meta<typeof Radio>;
49
49
 
50
- const RadioTemplate: ComponentStory<typeof Radio> = (args) => {
50
+ const RadioTemplate: StoryFn<typeof Radio> = (args) => {
51
51
  return (
52
52
  <Table sx={{ width: 650 }}>
53
53
  <TableHead>
@@ -88,4 +88,6 @@ const RadioTemplate: ComponentStory<typeof Radio> = (args) => {
88
88
  );
89
89
  };
90
90
 
91
- export const Status = RadioTemplate.bind({});
91
+ export const Status = {
92
+ render: RadioTemplate,
93
+ };
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { ComponentStory, ComponentMeta } from "@storybook/react";
2
+ import { StoryFn, Meta } from "@storybook/react";
3
3
  import Toggle from "@/components/Toggle/Toggle";
4
4
  import {
5
5
  Box,
@@ -41,7 +41,6 @@ export default {
41
41
  type: "boolean",
42
42
  },
43
43
  description: "If `true`, the component is disabled.",
44
- defaultValue: false,
45
44
  options: [true, false],
46
45
  },
47
46
  },
@@ -62,9 +61,9 @@ export default {
62
61
  },
63
62
  },
64
63
  },
65
- } as ComponentMeta<typeof Toggle>;
64
+ } as Meta<typeof Toggle>;
66
65
 
67
- const BaseTemplate: ComponentStory<typeof Toggle> = (args) => {
66
+ const BaseTemplate: StoryFn<typeof Toggle> = (args) => {
68
67
  const [checked, setChecked] = useState(false);
69
68
  useEffect(() => {
70
69
  setChecked(Boolean(args.checked));
@@ -92,7 +91,7 @@ const BaseTemplate: ComponentStory<typeof Toggle> = (args) => {
92
91
  );
93
92
  };
94
93
 
95
- const Template: ComponentStory<typeof Toggle> = (args) => (
94
+ const Template: StoryFn<typeof Toggle> = (args) => (
96
95
  <Table>
97
96
  <TableHead>
98
97
  <TableRow>
@@ -155,7 +154,7 @@ const Template: ComponentStory<typeof Toggle> = (args) => (
155
154
  </Table>
156
155
  );
157
156
 
158
- const DisabledTemplate: ComponentStory<typeof Toggle> = (args) => (
157
+ const DisabledTemplate: StoryFn<typeof Toggle> = (args) => (
159
158
  <Table>
160
159
  <TableHead>
161
160
  <TableRow>
@@ -194,7 +193,7 @@ const DisabledTemplate: ComponentStory<typeof Toggle> = (args) => (
194
193
  </Table>
195
194
  );
196
195
 
197
- const TemplateWithLabel: ComponentStory<typeof Toggle> = (args) => (
196
+ const TemplateWithLabel: StoryFn<typeof Toggle> = (args) => (
198
197
  <Table>
199
198
  <TableHead>
200
199
  <TableRow>
@@ -296,7 +295,7 @@ const TemplateWithLabel: ComponentStory<typeof Toggle> = (args) => (
296
295
  </Table>
297
296
  );
298
297
 
299
- const IndeterminateTemplate: ComponentStory<typeof Toggle> = (args) => {
298
+ const IndeterminateTemplate: StoryFn<typeof Toggle> = (args) => {
300
299
  const [checked, setChecked] = useState([true, false, false]);
301
300
 
302
301
  const handleChange1 = () => {
@@ -411,19 +410,34 @@ const IndeterminateTemplate: ComponentStory<typeof Toggle> = (args) => {
411
410
  );
412
411
  };
413
412
 
414
- export const ToggleBase = BaseTemplate.bind({});
415
- export const ToggleEnabled = Template.bind({});
416
- export const ToggleDisabled = DisabledTemplate.bind({});
417
- ToggleDisabled.args = {
418
- disabled: true,
413
+ export const ToggleBase = {
414
+ render: BaseTemplate,
419
415
  };
420
416
 
421
- export const ToggleWithLabel = TemplateWithLabel.bind({});
422
- export const ToggleWithLabelAndIndeterminate = IndeterminateTemplate.bind({});
423
- ToggleWithLabelAndIndeterminate.parameters = {
424
- docs: {
425
- description: {
426
- story: "Usage is same with Toggle",
417
+ export const ToggleEnabled = {
418
+ render: Template,
419
+ };
420
+
421
+ export const ToggleDisabled = {
422
+ render: DisabledTemplate,
423
+
424
+ args: {
425
+ disabled: true,
426
+ },
427
+ };
428
+
429
+ export const ToggleWithLabel = {
430
+ render: TemplateWithLabel,
431
+ };
432
+
433
+ export const ToggleWithLabelAndIndeterminate = {
434
+ render: IndeterminateTemplate,
435
+
436
+ parameters: {
437
+ docs: {
438
+ description: {
439
+ story: "Usage is same with Toggle",
440
+ },
427
441
  },
428
442
  },
429
443
  };
@@ -0,0 +1,137 @@
1
+ import React from "react";
2
+ import {
3
+ Box,
4
+ Table,
5
+ TableBody,
6
+ TableCell,
7
+ TableHead,
8
+ TableRow,
9
+ } from "@mui/material";
10
+
11
+ import TextField from "@/components/TextField/TextField";
12
+
13
+ import type { StoryFn, Meta } from "@storybook/react";
14
+
15
+ export default {
16
+ title: "Components/TextField",
17
+ component: TextField,
18
+ args: {
19
+ disabled: false,
20
+ size: "small",
21
+ placeholder: "Please typing...",
22
+ helperText: "Helper Text",
23
+ multiline: true,
24
+ },
25
+ argTypes: {
26
+ disabled: {
27
+ control: {
28
+ type: "radio",
29
+ },
30
+ options: [true, false],
31
+ description: "If true, the text field will be disabled.",
32
+ table: {
33
+ defaultValue: { summary: false },
34
+ type: { summary: [true, false] },
35
+ },
36
+ },
37
+ size: {
38
+ control: {
39
+ type: "radio",
40
+ },
41
+ description: "The size of the text field.",
42
+ table: {
43
+ defaultValue: { summary: "small" },
44
+ type: { summary: ["small", "medium", "large"] },
45
+ },
46
+ },
47
+ rows: {
48
+ type: "number",
49
+ description: `The number of rows to display when multiline option is set to "true"
50
+ \n the rows default value is undefined.`,
51
+ table: {
52
+ defaultValue: { summary: "undefined" },
53
+ type: { summary: ["number", "string", "undefined"] },
54
+ },
55
+ },
56
+ placeholder: {
57
+ type: "string",
58
+ description: "The placeholder content.",
59
+ table: {
60
+ defaultValue: { summary: "undefined" },
61
+ type: { summary: "string" },
62
+ },
63
+ },
64
+ helperText: {
65
+ type: "string",
66
+ description:
67
+ 'The helper text content, use "error" or "sub text" to display helper text.',
68
+ table: {
69
+ defaultValue: { summary: "undefined" },
70
+ type: { summary: "string" },
71
+ },
72
+ },
73
+ multiline: {
74
+ type: "boolean",
75
+ description: "If true, a textarea element(multi line) will be rendered.",
76
+ table: {
77
+ defaultValue: { summary: "false" },
78
+ type: { summary: "boolean" },
79
+ },
80
+ },
81
+ },
82
+ parameters: {
83
+ controls: {
84
+ include: ["size", "rows", "disabled", "helperText", "placeholder"],
85
+ },
86
+ docs: {
87
+ description: {
88
+ component: `It is a text field that allows users to enter and edit text.
89
+ \n It is usually used in forms. It can be used as a single line or multi-line text field.
90
+ \n It can be used with an icon on the left or right side.`,
91
+ },
92
+ },
93
+ },
94
+ decorators: [(Story) => <Box className="base00">{Story()}</Box>],
95
+ } as Meta<typeof TextField>;
96
+
97
+ const MultiTemplate: StoryFn<typeof TextField> = (args) => (
98
+ <Table>
99
+ <TableHead>
100
+ <TableRow>
101
+ <TableCell sx={{ typography: "body2_14_medium", color: "inherit" }}>
102
+ Default
103
+ </TableCell>
104
+ <TableCell sx={{ typography: "body2_14_medium", color: "inherit" }}>
105
+ Error
106
+ </TableCell>
107
+ <TableCell sx={{ typography: "body2_14_medium", color: "inherit" }}>
108
+ Focused
109
+ </TableCell>
110
+ <TableCell sx={{ typography: "body2_14_medium", color: "inherit" }}>
111
+ Disabled
112
+ </TableCell>
113
+ </TableRow>
114
+ </TableHead>
115
+ <TableBody>
116
+ <TableRow>
117
+ <TableCell>
118
+ <TextField {...args} multiline />
119
+ </TableCell>
120
+ <TableCell>
121
+ <TextField {...args} multiline error />
122
+ </TableCell>
123
+ <TableCell>
124
+ <TextField {...args} multiline focused />
125
+ </TableCell>
126
+ <TableCell>
127
+ <TextField {...args} multiline disabled />
128
+ </TableCell>
129
+ </TableRow>
130
+ </TableBody>
131
+ </Table>
132
+ );
133
+
134
+ export const TextFieldWithMulti = {
135
+ render: MultiTemplate,
136
+ name: "Multi Line",
137
+ };