@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
@@ -7,11 +7,11 @@ import {
7
7
  TableBody,
8
8
  TableCell,
9
9
  } from "@mui/material";
10
- import { Bell } from "@lunit/design-system-icons";
10
+ import Bell from "@lunit/design-system-icons/Bell";
11
11
  import ToggleButton from "@/components/ToggleButton";
12
12
  import ToggleButtonGroup from "@/components/ToggleButtonGroup";
13
13
 
14
- import type { ComponentStory, ComponentMeta } from "@storybook/react";
14
+ import type { StoryFn, Meta } from "@storybook/react";
15
15
  import type { ButtonProps } from "@/components/Button/Button.types";
16
16
 
17
17
  type Size = Pick<ButtonProps, "size">;
@@ -21,12 +21,19 @@ const sizeList: SizeValues[] = ["small", "medium", "large"];
21
21
  export default {
22
22
  title: "Components/ToggleButton",
23
23
  component: ToggleButton,
24
+ args: {
25
+ children: "Text",
26
+ kind: "contained",
27
+ color: "primary",
28
+ selectedColor: "primary",
29
+ size: "small",
30
+ disabled: false,
31
+ },
24
32
  argTypes: {
25
33
  icon: {
26
34
  control: false,
27
35
  description: `Use this prop when you want to add icon.
28
- \n It is added to the left of the text criteria,
29
- \n and only Icon can be checked when used with hasIconOnly.`,
36
+ \n It is added to the left of the text criteria`,
30
37
  table: {
31
38
  defaultValue: { summary: "undefined" },
32
39
  type: { summary: "React.ReactNode" },
@@ -38,7 +45,6 @@ export default {
38
45
  },
39
46
  children: {
40
47
  type: "string",
41
- defaultValue: "Text",
42
48
  },
43
49
  selected: {
44
50
  control: false,
@@ -51,7 +57,6 @@ export default {
51
57
  type: "radio",
52
58
  },
53
59
  options: ["primary", "secondary"],
54
- defaultValue: "primary",
55
60
  description:
56
61
  "The color of the button when it is in an select state. It has nothing to do with active button",
57
62
  table: {
@@ -64,7 +69,6 @@ export default {
64
69
  },
65
70
  options: ["contained", "outlined", "ghost"],
66
71
  description: "Button has three Kinds Contained, Outlined, Ghost",
67
- defaultValue: "contained",
68
72
  table: {
69
73
  defaultValue: { summary: "contained" },
70
74
  },
@@ -74,7 +78,6 @@ export default {
74
78
  type: "radio",
75
79
  },
76
80
  options: ["primary", "secondary"],
77
- defaultValue: "primary",
78
81
  table: {
79
82
  defaultValue: { summary: "primary" },
80
83
  },
@@ -83,14 +86,12 @@ export default {
83
86
  control: {
84
87
  type: "boolean",
85
88
  },
86
- defaultValue: false,
87
89
  table: {
88
90
  defaultValue: { summary: "false" },
89
91
  },
90
92
  },
91
93
  size: {
92
94
  options: ["small", "medium", "large"],
93
- defaultValue: "small",
94
95
  table: {
95
96
  defaultValue: { summary: "small" },
96
97
  },
@@ -103,7 +104,6 @@ export default {
103
104
  function: action("onChange"),
104
105
  undefined: undefined,
105
106
  },
106
- defaultValue: "function",
107
107
  },
108
108
  onClick: {
109
109
  type: "function",
@@ -113,7 +113,6 @@ export default {
113
113
  function: action("onClick"),
114
114
  undefined: undefined,
115
115
  },
116
- defaultValue: "function",
117
116
  description:
118
117
  "It is a callback function that is called when the button is clicked.",
119
118
  },
@@ -141,11 +140,9 @@ export default {
141
140
  },
142
141
  },
143
142
  },
144
- } as ComponentMeta<typeof ToggleButton>;
143
+ } as Meta<typeof ToggleButton>;
145
144
 
146
- const BasicToggleButtonTemplate: ComponentStory<typeof ToggleButton> = (
147
- arg
148
- ) => {
145
+ const BasicToggleButtonTemplate: StoryFn<typeof ToggleButton> = (arg) => {
149
146
  const [selected, setSelected] = useState(false);
150
147
  useEffect(() => {
151
148
  setSelected(Boolean(arg.selected));
@@ -163,10 +160,12 @@ const BasicToggleButtonTemplate: ComponentStory<typeof ToggleButton> = (
163
160
  );
164
161
  };
165
162
 
166
- export const BasicToggleButton = BasicToggleButtonTemplate.bind({});
167
- BasicToggleButton.storyName = "Basic ToggleButton";
163
+ export const BasicToggleButton = {
164
+ render: BasicToggleButtonTemplate,
165
+ name: "Basic ToggleButton",
166
+ };
168
167
 
169
- const SizeTemplate: ComponentStory<typeof ToggleButton> = (args) => {
168
+ const SizeTemplate: StoryFn<typeof ToggleButton> = (args) => {
170
169
  const [values, setValues] = React.useState({
171
170
  small: "",
172
171
  medium: "",
@@ -271,14 +270,17 @@ const SizeTemplate: ComponentStory<typeof ToggleButton> = (args) => {
271
270
  );
272
271
  };
273
272
 
274
- export const Size = SizeTemplate.bind({});
275
- Size.argTypes = {
276
- size: {
277
- control: false,
273
+ export const Size = {
274
+ render: SizeTemplate,
275
+
276
+ argTypes: {
277
+ size: {
278
+ control: false,
279
+ },
278
280
  },
279
281
  };
280
282
 
281
- const SelectedColorTemplate: ComponentStory<typeof ToggleButton> = (arg) => {
283
+ const SelectedColorTemplate: StoryFn<typeof ToggleButton> = (arg) => {
282
284
  const [selected1, setSelected1] = useState(true);
283
285
  const [selected2, setSelected2] = useState(true);
284
286
 
@@ -329,14 +331,16 @@ const SelectedColorTemplate: ComponentStory<typeof ToggleButton> = (arg) => {
329
331
  );
330
332
  };
331
333
 
332
- export const SelectedColor = SelectedColorTemplate.bind({});
334
+ export const SelectedColor = {
335
+ render: SelectedColorTemplate,
333
336
 
334
- SelectedColor.argTypes = {
335
- selectedColor: {
336
- control: false,
337
+ argTypes: {
338
+ selectedColor: {
339
+ control: false,
340
+ },
337
341
  },
338
- };
339
342
 
340
- SelectedColor.args = {
341
- selected: true,
343
+ args: {
344
+ selected: true,
345
+ },
342
346
  };
@@ -4,17 +4,24 @@ import { action } from "@storybook/addon-actions";
4
4
  import ToggleButton from "@/components/ToggleButton";
5
5
  import ToggleButtonGroup from "@/components/ToggleButtonGroup";
6
6
 
7
- import type { ComponentStory, ComponentMeta } from "@storybook/react";
7
+ import type { StoryFn, Meta } from "@storybook/react";
8
8
 
9
9
  export default {
10
10
  title: "Components/ToggleButton",
11
11
  component: ToggleButton,
12
+ args: {
13
+ children: "Text",
14
+ kind: "contained",
15
+ color: "primary",
16
+ selectedColor: "primary",
17
+ size: "small",
18
+ disabled: false,
19
+ },
12
20
  argTypes: {
13
21
  icon: {
14
22
  control: false,
15
23
  description: `Use this prop when you want to add icon.
16
- \n It is added to the left of the text criteria,
17
- \n and only Icon can be checked when used with hasIconOnly.`,
24
+ \n It is added to the left of the text criteria`,
18
25
  table: {
19
26
  defaultValue: { summary: "undefined" },
20
27
  type: { summary: "React.ReactNode" },
@@ -46,7 +53,6 @@ export default {
46
53
  type: "radio",
47
54
  },
48
55
  options: ["primary", "secondary"],
49
- defaultValue: "primary",
50
56
  description: "Button has three Kinds Contained, Ghost",
51
57
  table: {
52
58
  defaultValue: { summary: "primary" },
@@ -57,20 +63,17 @@ export default {
57
63
  type: "radio",
58
64
  },
59
65
  options: ["contained", "outlined", "ghost"],
60
- defaultValue: "contained",
61
66
  table: {
62
67
  defaultValue: { summary: "contained" },
63
68
  },
64
69
  },
65
70
  children: {
66
71
  type: "string",
67
- defaultValue: "Text",
68
72
  },
69
73
  disabled: {
70
74
  control: {
71
75
  type: "boolean",
72
76
  },
73
- defaultValue: false,
74
77
  table: {
75
78
  defaultValue: { summary: "false" },
76
79
  },
@@ -80,7 +83,6 @@ export default {
80
83
  type: "radio",
81
84
  },
82
85
  options: ["small", "medium", "large"],
83
- defaultValue: "small",
84
86
  table: {
85
87
  defaultValue: { summary: "small" },
86
88
  },
@@ -93,7 +95,6 @@ export default {
93
95
  function: action("onChange"),
94
96
  undefined: undefined,
95
97
  },
96
- defaultValue: "function",
97
98
  },
98
99
  onClick: {
99
100
  type: "function",
@@ -105,15 +106,10 @@ export default {
105
106
  function: action("onClick"),
106
107
  undefined: undefined,
107
108
  },
108
- defaultValue: "function",
109
109
  description:
110
110
  "It is a callback function that is called when the button is clicked.",
111
111
  },
112
112
  },
113
- args: {
114
- kind: "contained",
115
- selectedColor: "primary",
116
- },
117
113
  parameters: {
118
114
  controls: {
119
115
  include: [
@@ -137,9 +133,9 @@ export default {
137
133
  },
138
134
  },
139
135
  },
140
- } as ComponentMeta<typeof ToggleButton>;
136
+ } as Meta<typeof ToggleButton>;
141
137
 
142
- const GroupTemplate: ComponentStory<typeof ToggleButton> = (arg) => {
138
+ const GroupTemplate: StoryFn<typeof ToggleButton> = (arg) => {
143
139
  const [alignment, setAlignment] = React.useState<string | null>("left");
144
140
 
145
141
  const handleAlignment = (
@@ -177,10 +173,12 @@ const GroupTemplate: ComponentStory<typeof ToggleButton> = (arg) => {
177
173
  );
178
174
  };
179
175
 
180
- export const Group = GroupTemplate.bind({});
181
- Group.storyName = "Group";
176
+ export const Group = {
177
+ render: GroupTemplate,
178
+ name: "Group",
179
+ };
182
180
 
183
- const GroupMultipleTemplate: ComponentStory<typeof ToggleButton> = (arg) => {
181
+ const GroupMultipleTemplate: StoryFn<typeof ToggleButton> = (arg) => {
184
182
  const [alignments, setAlignments] = React.useState(() => ["left", "center"]);
185
183
 
186
184
  const handleAlignments = (
@@ -217,5 +215,7 @@ const GroupMultipleTemplate: ComponentStory<typeof ToggleButton> = (arg) => {
217
215
  );
218
216
  };
219
217
 
220
- export const GroupMultiple = GroupMultipleTemplate.bind({});
221
- GroupMultiple.storyName = "Group: Multiple selection";
218
+ export const GroupMultiple = {
219
+ render: GroupMultipleTemplate,
220
+ name: "Group: Multiple selection",
221
+ };
@@ -5,17 +5,24 @@ import {
5
5
  TableRow,
6
6
  TableBody,
7
7
  TableCell,
8
- Typography,
9
8
  } from "@mui/material";
10
9
  import { action } from "@storybook/addon-actions";
11
10
 
12
11
  import ToggleButton from "@/components/ToggleButton";
13
12
 
14
- import type { ComponentStory, ComponentMeta } from "@storybook/react";
13
+ import type { StoryFn, Meta } from "@storybook/react";
15
14
 
16
15
  export default {
17
16
  title: "Components/ToggleButton",
18
17
  component: ToggleButton,
18
+ args: {
19
+ children: "Text",
20
+ kind: "contained",
21
+ color: "primary",
22
+ selectedColor: "primary",
23
+ size: "small",
24
+ disabled: false,
25
+ },
19
26
  argTypes: {
20
27
  value: {
21
28
  control: false,
@@ -29,13 +36,11 @@ export default {
29
36
  },
30
37
  children: {
31
38
  type: "string",
32
- defaultValue: "Text",
33
39
  },
34
40
  disabled: {
35
41
  control: {
36
42
  type: "boolean",
37
43
  },
38
- defaultValue: false,
39
44
  table: {
40
45
  defaultValue: { summary: "false" },
41
46
  },
@@ -45,7 +50,6 @@ export default {
45
50
  type: "radio",
46
51
  },
47
52
  options: ["small", "medium", "large"],
48
- defaultValue: "small",
49
53
  table: {
50
54
  defaultValue: { summary: "small" },
51
55
  },
@@ -54,7 +58,6 @@ export default {
54
58
  control: {
55
59
  type: "radio",
56
60
  },
57
- defaultValue: "primary",
58
61
  options: ["primary", "secondary"],
59
62
  description:
60
63
  "The color of the button when it is in an select state. It has nothing to do with active button",
@@ -70,7 +73,6 @@ export default {
70
73
  function: action("onChange"),
71
74
  undefined: undefined,
72
75
  },
73
- defaultValue: "function",
74
76
  },
75
77
  onClick: {
76
78
  type: "function",
@@ -82,13 +84,11 @@ export default {
82
84
  function: action("onClick"),
83
85
  undefined: undefined,
84
86
  },
85
- defaultValue: "function",
86
87
  description:
87
88
  "It is a callback function that is called when the button is clicked.",
88
89
  },
89
90
  color: {
90
91
  options: ["primary", "secondary"],
91
- defaultValue: "primary",
92
92
  table: {
93
93
  defaultValue: { summary: "primary" },
94
94
  },
@@ -97,7 +97,6 @@ export default {
97
97
  control: false,
98
98
  options: ["contained", "outlined", "ghost"],
99
99
  description: "Button has three Kinds Contained, Outlined, Ghost",
100
- defaultValue: "contained",
101
100
  table: {
102
101
  defaultValue: { summary: "contained" },
103
102
  },
@@ -124,10 +123,13 @@ export default {
124
123
  see [Material-UI Toggle Button](https://mui.com/material-ui/react-toggle-button/).`,
125
124
  },
126
125
  },
126
+ pseudo: {
127
+ hover: ["#hover1", "#hover2", "#hover3"],
128
+ },
127
129
  },
128
- } as ComponentMeta<typeof ToggleButton>;
130
+ } as Meta<typeof ToggleButton>;
129
131
 
130
- const ButtonTemplate: ComponentStory<typeof ToggleButton> = ({
132
+ const ButtonTemplate: StoryFn<typeof ToggleButton> = ({
131
133
  kind,
132
134
  color,
133
135
  children,
@@ -222,17 +224,19 @@ const ButtonTemplate: ComponentStory<typeof ToggleButton> = ({
222
224
  );
223
225
  };
224
226
 
225
- export const Kind = ButtonTemplate.bind({});
227
+ export const Kind = {
228
+ render: ButtonTemplate,
226
229
 
227
- Kind.argTypes = {
228
- color: {
229
- control: {
230
- type: "radio",
230
+ argTypes: {
231
+ color: {
232
+ control: {
233
+ type: "radio",
234
+ },
231
235
  },
232
236
  },
233
237
  };
234
238
 
235
- const ContainedTemplate: ComponentStory<typeof ToggleButton> = (args) => {
239
+ const ContainedTemplate: StoryFn<typeof ToggleButton> = (args) => {
236
240
  const [values, setValues] = useState({
237
241
  primary: {
238
242
  enable: false,
@@ -248,7 +252,7 @@ const ContainedTemplate: ComponentStory<typeof ToggleButton> = (args) => {
248
252
 
249
253
  const handleChange = (
250
254
  color: keyof typeof values,
251
- value: keyof typeof values[keyof typeof values]
255
+ value: keyof (typeof values)[keyof typeof values]
252
256
  ) => {
253
257
  setValues({
254
258
  ...values,
@@ -308,7 +312,7 @@ const ContainedTemplate: ComponentStory<typeof ToggleButton> = (args) => {
308
312
  <TableCell>
309
313
  <ToggleButton
310
314
  {...args}
311
- id="hover"
315
+ id="hover1"
312
316
  kind="contained"
313
317
  value="hover"
314
318
  onChange={() => handleChange("primary", "hover")}
@@ -320,7 +324,7 @@ const ContainedTemplate: ComponentStory<typeof ToggleButton> = (args) => {
320
324
  <TableCell>
321
325
  <ToggleButton
322
326
  {...args}
323
- id="hover"
327
+ id="hover2"
324
328
  kind="contained"
325
329
  color="secondary"
326
330
  value="hover"
@@ -387,16 +391,18 @@ const ContainedTemplate: ComponentStory<typeof ToggleButton> = (args) => {
387
391
  );
388
392
  };
389
393
 
390
- export const KindContained = ContainedTemplate.bind({});
391
- KindContained.storyName = "Kind: Contained";
394
+ export const KindContained = {
395
+ render: ContainedTemplate,
396
+ name: "Kind: Contained",
392
397
 
393
- KindContained.argTypes = {
394
- color: {
395
- control: false,
398
+ argTypes: {
399
+ color: {
400
+ control: false,
401
+ },
396
402
  },
397
403
  };
398
404
 
399
- const GhostTemplate: ComponentStory<typeof ToggleButton> = (args) => {
405
+ const GhostTemplate: StoryFn<typeof ToggleButton> = (args) => {
400
406
  const [values, setValues] = useState({
401
407
  primary: {
402
408
  enable: false,
@@ -412,7 +418,7 @@ const GhostTemplate: ComponentStory<typeof ToggleButton> = (args) => {
412
418
 
413
419
  const handleChange = (
414
420
  color: keyof typeof values,
415
- value: keyof typeof values[keyof typeof values]
421
+ value: keyof (typeof values)[keyof typeof values]
416
422
  ) => {
417
423
  setValues({
418
424
  ...values,
@@ -477,7 +483,7 @@ const GhostTemplate: ComponentStory<typeof ToggleButton> = (args) => {
477
483
  <TableCell>
478
484
  <ToggleButton
479
485
  {...args}
480
- id="hover"
486
+ id="hover1"
481
487
  kind="ghost"
482
488
  value="hover"
483
489
  onChange={() => handleChange("primary", "hover")}
@@ -489,7 +495,7 @@ const GhostTemplate: ComponentStory<typeof ToggleButton> = (args) => {
489
495
  <TableCell>
490
496
  <ToggleButton
491
497
  {...args}
492
- id="hover"
498
+ id="hover2"
493
499
  kind="ghost"
494
500
  color="secondary"
495
501
  value="hover"
@@ -563,16 +569,18 @@ const GhostTemplate: ComponentStory<typeof ToggleButton> = (args) => {
563
569
  );
564
570
  };
565
571
 
566
- export const KindGhost = GhostTemplate.bind({});
567
- KindGhost.storyName = "Kind: Ghost";
572
+ export const KindGhost = {
573
+ render: GhostTemplate,
574
+ name: "Kind: Ghost",
568
575
 
569
- KindGhost.argTypes = {
570
- color: {
571
- control: false,
576
+ argTypes: {
577
+ color: {
578
+ control: false,
579
+ },
572
580
  },
573
581
  };
574
582
 
575
- const OutlinedTemplate: ComponentStory<typeof ToggleButton> = ({
583
+ const OutlinedTemplate: StoryFn<typeof ToggleButton> = ({
576
584
  color,
577
585
  ...restProps
578
586
  }) => {
@@ -586,7 +594,7 @@ const OutlinedTemplate: ComponentStory<typeof ToggleButton> = ({
586
594
 
587
595
  const handleChange = (
588
596
  color: keyof typeof values,
589
- value: keyof typeof values[keyof typeof values]
597
+ value: keyof (typeof values)[keyof typeof values]
590
598
  ) => {
591
599
  setValues({
592
600
  ...values,
@@ -636,7 +644,7 @@ const OutlinedTemplate: ComponentStory<typeof ToggleButton> = ({
636
644
  <TableCell>
637
645
  <ToggleButton
638
646
  {...restProps}
639
- id="hover"
647
+ id="hover1"
640
648
  kind="outlined"
641
649
  value="hover"
642
650
  onChange={() => handleChange("primary", "hover")}
@@ -688,11 +696,13 @@ const OutlinedTemplate: ComponentStory<typeof ToggleButton> = ({
688
696
  );
689
697
  };
690
698
 
691
- export const KindOutlined = OutlinedTemplate.bind({});
692
- KindOutlined.storyName = "Kind: Outlined";
699
+ export const KindOutlined = {
700
+ render: OutlinedTemplate,
701
+ name: "Kind: Outlined",
693
702
 
694
- KindOutlined.argTypes = {
695
- color: {
696
- control: false,
703
+ argTypes: {
704
+ color: {
705
+ control: false,
706
+ },
697
707
  },
698
708
  };