@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.
- package/.babelrc.json +16 -0
- package/dist/cjs/components/Alert/index.js +1 -1
- package/dist/cjs/components/Alert/index.js.map +1 -1
- package/dist/cjs/components/Button/index.js +1 -1
- package/dist/cjs/components/Button/index.js.map +1 -1
- package/dist/cjs/components/Chip/index.js +1 -1
- package/dist/cjs/components/Chip/index.js.map +1 -1
- package/dist/cjs/components/TextField/index.js +1 -1
- package/dist/cjs/components/TextField/index.js.map +1 -1
- package/dist/cjs/components/ToggleButton/index.js +1 -1
- package/dist/cjs/components/ToggleButton/index.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/components/Alert/Alert.js +20 -4
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Alert/Alert.styled.js +49 -0
- package/dist/components/Alert/Alert.styled.js.map +1 -0
- package/dist/components/Alert/Alert.types.js +2 -0
- package/dist/components/Alert/Alert.types.js.map +1 -0
- package/dist/components/Alert/Alert.utils.js +37 -0
- package/dist/components/Alert/Alert.utils.js.map +1 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.styled.js +31 -21
- package/dist/components/Button/Button.styled.js.map +1 -1
- package/dist/components/Button/utils/getHoverStyle.js +7 -0
- package/dist/components/Button/utils/getHoverStyle.js.map +1 -0
- package/dist/components/Chip/Chip.js +1 -1
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Chip/Chip.styled.js +2 -3
- package/dist/components/Chip/Chip.styled.js.map +1 -1
- package/dist/components/TextField/TextField.js +15 -3
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.style.js +245 -0
- package/dist/components/TextField/TextField.style.js.map +1 -0
- package/dist/components/TextField/TextField.types.js +2 -0
- package/dist/components/TextField/TextField.types.js.map +1 -0
- package/dist/components/TextField/TextFieldIcon.js +7 -0
- package/dist/components/TextField/TextFieldIcon.js.map +1 -0
- package/dist/components/Toast/Toast.js +26 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/Toast.styled.js +49 -0
- package/dist/components/Toast/Toast.styled.js.map +1 -0
- package/dist/components/Toast/Toast.types.js +2 -0
- package/dist/components/Toast/Toast.types.js.map +1 -0
- package/dist/components/Toast/Toast.utils.js +13 -0
- package/dist/components/Toast/Toast.utils.js.map +1 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Toast/index.js.map +1 -0
- package/dist/foundation/colors/base/grey.js +16 -0
- package/dist/foundation/colors/base/grey.js.map +1 -1
- package/dist/foundation/colors/base/lunitGreen.js +2 -2
- package/dist/foundation/colors/base/lunitGreen.js.map +1 -1
- package/dist/foundation/colors/base/lunitTeal.js +5 -5
- package/dist/foundation/colors/base/lunitTeal.js.map +1 -1
- package/dist/foundation/colors/base/red.js +2 -2
- package/dist/foundation/colors/index.js +24 -4
- package/dist/foundation/colors/index.js.map +1 -1
- package/dist/foundation/colors/token/component.js +265 -291
- package/dist/foundation/colors/token/component.js.map +1 -1
- package/dist/foundation/colors/token/core.js +132 -125
- package/dist/foundation/colors/token/core.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/theme.js +5 -0
- package/dist/theme.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +3 -1
- package/dist/types/components/Alert/Alert.styled.d.ts +6 -0
- package/dist/types/components/Alert/Alert.types.d.ts +9 -0
- package/dist/types/components/Alert/Alert.utils.d.ts +4 -0
- package/dist/types/components/Button/Button.d.ts +1 -1
- package/dist/types/components/Button/Button.styled.d.ts +26 -2
- package/dist/types/components/Button/Button.types.d.ts +4 -4
- package/dist/types/components/Button/utils/getHoverStyle.d.ts +6 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/Chip/Chip.d.ts +1 -1
- package/dist/types/components/Chip/Chip.styled.d.ts +13 -13
- package/dist/types/components/Chip/Chip.types.d.ts +1 -1
- package/dist/types/components/DataTable/DataTable.d.ts +1 -1
- package/dist/types/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/types/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/types/components/FormLabel/FormLabel.d.ts +1 -1
- package/dist/types/components/Modal/Modal.d.ts +1 -1
- package/dist/types/components/Radio/Radio.d.ts +1 -1
- package/dist/types/components/TextField/TextField.d.ts +2 -1
- package/dist/types/components/TextField/TextField.style.d.ts +9 -0
- package/dist/types/components/TextField/TextField.types.d.ts +29 -0
- package/dist/types/components/TextField/TextFieldIcon.d.ts +8 -0
- package/dist/types/components/TextField/index.d.ts +1 -0
- package/dist/types/components/Toast/Toast.d.ts +4 -0
- package/dist/types/components/Toast/Toast.styled.d.ts +1 -0
- package/dist/types/components/Toast/Toast.types.d.ts +4 -0
- package/dist/types/components/Toast/Toast.utils.d.ts +2 -0
- package/dist/types/components/Toast/index.d.ts +1 -0
- package/dist/types/components/Toggle/Toggle.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -2
- package/dist/types/components/ToggleButton/ToggleButton.types.d.ts +4 -4
- package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +1 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/foundation/colors/base/grey.d.ts +16 -0
- package/dist/types/foundation/colors/base/lunitGreen.d.ts +2 -2
- package/dist/types/foundation/colors/base/lunitTeal.d.ts +2 -2
- package/dist/types/foundation/colors/index.d.ts +42 -9
- package/dist/types/foundation/colors/types.d.ts +1 -3
- package/dist/types/foundation/index.d.ts +37 -5
- package/dist/types/index.d.ts +1 -0
- package/package.json +21 -16
- package/src/components/Alert/Alert.styled.ts +63 -0
- package/src/components/Alert/Alert.tsx +47 -5
- package/src/components/Alert/Alert.types.ts +10 -0
- package/src/components/Alert/Alert.utils.ts +49 -0
- package/src/components/Button/Button.styled.ts +33 -21
- package/src/components/Button/Button.tsx +1 -5
- package/src/components/Button/Button.types.ts +4 -4
- package/src/components/Button/utils/getHoverStyle.ts +7 -0
- package/src/components/Chip/Chip.styled.ts +6 -4
- package/src/components/Chip/Chip.tsx +1 -1
- package/src/components/Chip/Chip.types.ts +2 -2
- package/src/components/TextField/TextField.style.ts +316 -0
- package/src/components/TextField/TextField.tsx +75 -3
- package/src/components/TextField/TextField.types.ts +38 -0
- package/src/components/TextField/TextFieldIcon.tsx +24 -0
- package/src/components/TextField/index.ts +6 -0
- package/src/components/Toast/Toast.styled.ts +49 -0
- package/src/components/Toast/Toast.tsx +66 -0
- package/src/components/Toast/Toast.types.ts +14 -0
- package/src/components/Toast/Toast.utils.ts +17 -0
- package/src/components/Toast/index.tsx +1 -0
- package/src/components/ToggleButton/ToggleButton.types.ts +4 -7
- package/src/foundation/colors/base/grey.ts +17 -0
- package/src/foundation/colors/base/lunitGreen.ts +2 -2
- package/src/foundation/colors/base/lunitTeal.ts +5 -5
- package/src/foundation/colors/base/red.ts +2 -2
- package/src/foundation/colors/index.ts +29 -8
- package/src/foundation/colors/token/component.ts +300 -326
- package/src/foundation/colors/token/core.ts +152 -145
- package/src/foundation/colors/types.ts +1 -3
- package/src/index.ts +1 -0
- package/src/stories/components/Alert/Alert.stories.tsx +148 -4
- package/src/stories/components/Button/BasicButton.stories.tsx +19 -28
- package/src/stories/components/Button/IconButton.stories.tsx +39 -28
- package/src/stories/components/Button/Kind.stories.tsx +83 -57
- package/src/stories/components/Chip/Chip.stories.tsx +94 -82
- package/src/stories/components/DataTable/DataTable.stories.tsx +6 -4
- package/src/stories/components/DatePicker/DatePicker.stories.tsx +6 -4
- package/src/stories/components/Dropdown/Dropdown.stories.tsx +12 -6
- package/src/stories/components/Modal/Modal.stories.tsx +6 -4
- package/src/stories/components/SelectControl/Checkbox.stories.tsx +31 -23
- package/src/stories/components/SelectControl/RadioGroup.stories.tsx +6 -5
- package/src/stories/components/SelectControl/RadioStatus.stories.tsx +6 -4
- package/src/stories/components/SelectControl/Toggle.stories.tsx +33 -19
- package/src/stories/components/TextField/TextFieldMulti.stories.tsx +137 -0
- package/src/stories/components/TextField/TextFieldSingle.stories.tsx +283 -0
- package/src/stories/components/TextField/TextFieldSize.stories.tsx +134 -0
- package/src/stories/components/Toast/Toast.stories.tsx +152 -0
- package/src/stories/components/ToggleButton/Basic.stories.tsx +35 -31
- package/src/stories/components/ToggleButton/Group.stories.tsx +21 -21
- package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +53 -43
- package/src/stories/components/ToggleButton/WithIcon.stories.tsx +35 -36
- package/src/stories/components/Tooltip/Tooltip.stories.tsx +6 -4
- package/src/stories/foundation/Elevation/Elevation.stories.tsx +10 -6
- package/src/stories/foundation/Typography/{Typography.stories.mdx → Typography.mdx} +10 -5
- package/src/stories/foundation/Typography/Typography.stories.tsx +46 -36
- package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +44 -0
- package/src/stories/foundation/colors/Colors.stories.tsx +7 -5
- package/src/stories/foundation/colors/Mui.stories.tsx +18 -0
- package/src/stories/foundation/colors/Token.inComponent.stories.tsx +2 -2
- package/src/stories/foundation/colors/TokenPaletteTable.stories.tsx +28 -0
- package/src/stories/foundation/colors/TokenPaletteTable.tsx +127 -0
- package/src/theme.ts +5 -0
- package/src/stories/components/TextField/TextField.stories.tsx +0 -13
- package/src/stories/foundation/colors/Token.stories.tsx +0 -190
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
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
|
|
9
|
+
} as Meta<typeof Dropdown>;
|
|
10
10
|
|
|
11
|
-
const Template:
|
|
11
|
+
const Template: StoryFn<typeof Dropdown> = () => <Dropdown />;
|
|
12
12
|
|
|
13
|
-
export const SingleSelect =
|
|
14
|
-
|
|
15
|
-
|
|
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 {
|
|
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
|
|
9
|
+
} as Meta<typeof Modal>;
|
|
10
10
|
|
|
11
|
-
const Template:
|
|
11
|
+
const Template: StoryFn<typeof Modal> = () => <Modal />;
|
|
12
12
|
|
|
13
|
-
export const LunitModal =
|
|
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 {
|
|
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
|
|
83
|
+
} as Meta<typeof Checkbox>;
|
|
84
84
|
|
|
85
|
-
const BasicCheckboxTemplate:
|
|
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 =
|
|
101
|
+
export const BasicCheckbox = {
|
|
102
|
+
render: BasicCheckboxTemplate,
|
|
103
|
+
};
|
|
102
104
|
|
|
103
|
-
const LabelTemplate:
|
|
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 =
|
|
125
|
+
export const Label = {
|
|
126
|
+
render: LabelTemplate,
|
|
124
127
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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:
|
|
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 =
|
|
193
|
+
export const Status = {
|
|
194
|
+
render: StatusTemplate,
|
|
195
|
+
};
|
|
190
196
|
|
|
191
|
-
const IndeterminateTemplate:
|
|
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 =
|
|
242
|
+
export const Indeterminate = {
|
|
243
|
+
render: IndeterminateTemplate,
|
|
237
244
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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 {
|
|
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
|
|
37
|
+
} as Meta<typeof RadioGroup>;
|
|
39
38
|
|
|
40
|
-
const RadioGroupTemplate:
|
|
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 =
|
|
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 {
|
|
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
|
|
48
|
+
} as Meta<typeof Radio>;
|
|
49
49
|
|
|
50
|
-
const RadioTemplate:
|
|
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 =
|
|
91
|
+
export const Status = {
|
|
92
|
+
render: RadioTemplate,
|
|
93
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import {
|
|
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
|
|
64
|
+
} as Meta<typeof Toggle>;
|
|
66
65
|
|
|
67
|
-
const BaseTemplate:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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 =
|
|
415
|
-
|
|
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
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
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
|
+
};
|