@lunit/design-system 2.1.0 → 2.2.3
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 +1 -1
- package/README.md +22 -21
- 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/Checkbox/index.js +1 -1
- package/dist/cjs/components/Checkbox/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/DataTable/index.js.map +1 -1
- package/dist/cjs/components/DatePicker/index.js.map +1 -1
- package/dist/cjs/components/Dialog/index.js +1 -1
- package/dist/cjs/components/Dialog/index.js.map +1 -1
- package/dist/cjs/components/Dropdown/index.js +1 -1
- package/dist/cjs/components/Dropdown/index.js.map +1 -1
- package/dist/cjs/components/FormLabel/index.js +1 -1
- package/dist/cjs/components/FormLabel/index.js.map +1 -1
- package/dist/cjs/components/Radio/index.js +1 -1
- package/dist/cjs/components/Radio/index.js.map +1 -1
- package/dist/cjs/components/RadioGroup/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/Toggle/index.js +1 -1
- package/dist/cjs/components/Toggle/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/components/Tooltip/index.js.map +1 -1
- package/dist/cjs/components/Typography/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 +8 -8
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Alert/Alert.styled.js +26 -26
- package/dist/components/Alert/Alert.styled.js.map +1 -1
- package/dist/components/Alert/Alert.utils.js +9 -9
- package/dist/components/Alert/Alert.utils.js.map +1 -1
- package/dist/components/Alert/index.js +1 -1
- package/dist/components/Button/Button.js +23 -17
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.styled.js +88 -88
- package/dist/components/Button/Button.styled.js.map +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/utils/getButtonPaddingBySizeAndKind.js +9 -9
- package/dist/components/Button/utils/getButtonPaddingBySizeAndKind.js.map +1 -1
- package/dist/components/Button/utils/getHoverStyle.js +1 -1
- package/dist/components/Button/utils/getHoverStyle.js.map +1 -1
- package/dist/components/Button/utils/getIconButtonPaddingBySizeAndKind.js +6 -12
- package/dist/components/Button/utils/getIconButtonPaddingBySizeAndKind.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +9 -9
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Chip/Chip.js +29 -26
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Chip/Chip.styled.js +52 -52
- package/dist/components/Chip/Chip.styled.js.map +1 -1
- package/dist/components/Chip/consts.js +5 -5
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/DataTable/DataTable.js +1 -1
- package/dist/components/DataTable/index.js +1 -1
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Dialog/Dialog.js +18 -18
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dialog/Dialog.styled.js +90 -90
- package/dist/components/Dialog/Dialog.styled.js.map +1 -1
- package/dist/components/Dialog/components/DialogAction.js +6 -6
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +23 -21
- package/dist/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/components/Dropdown/Dropdown.styled.js +85 -86
- package/dist/components/Dropdown/Dropdown.styled.js.map +1 -1
- package/dist/components/Dropdown/DropdownItem.js +14 -14
- package/dist/components/Dropdown/DropdownItem.js.map +1 -1
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/FormLabel/FormLabel.js +1 -1
- package/dist/components/FormLabel/FormLabel.styled.js +2 -2
- package/dist/components/FormLabel/FormLabel.styled.js.map +1 -1
- package/dist/components/FormLabel/index.js +1 -1
- package/dist/components/Radio/Radio.js +8 -8
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Radio/index.js +1 -1
- package/dist/components/RadioGroup/index.js +1 -1
- package/dist/components/TextField/TextField.js +8 -8
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.style.js +112 -112
- package/dist/components/TextField/TextField.style.js.map +1 -1
- package/dist/components/TextField/TextFieldIcon.js +2 -2
- package/dist/components/TextField/TextFieldIcon.js.map +1 -1
- package/dist/components/TextField/index.js +1 -1
- package/dist/components/Toast/Toast.js +13 -13
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Toast/Toast.styled.js +26 -26
- package/dist/components/Toast/Toast.utils.js +3 -3
- package/dist/components/Toast/Toast.utils.js.map +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/Toggle/Toggle.js +3 -4
- package/dist/components/Toggle/Toggle.js.map +1 -1
- package/dist/components/Toggle/Toggle.styled.js +30 -30
- package/dist/components/Toggle/Toggle.styled.js.map +1 -1
- package/dist/components/Toggle/index.js +1 -1
- package/dist/components/ToggleButton/ToggleButton.js +6 -6
- package/dist/components/ToggleButton/ToggleButton.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.styled.js +20 -20
- package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -1
- package/dist/components/ToggleButton/index.js +1 -1
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.js +2 -2
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.js.map +1 -1
- package/dist/components/ToggleButtonGroup/index.js +1 -1
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Tooltip/index.js +1 -1
- package/dist/components/Typography/Typography.js +1 -1
- package/dist/components/Typography/Typography.js.map +1 -1
- package/dist/components/Typography/index.js +1 -1
- package/dist/foundation/Elevation/index.js +27 -27
- package/dist/foundation/Elevation/utils.js +1 -1
- package/dist/foundation/Elevation/utils.js.map +1 -1
- package/dist/foundation/Typography/index.js +35 -35
- package/dist/foundation/Typography/index.js.map +1 -1
- package/dist/foundation/Typography/tokens.js +136 -136
- package/dist/foundation/Typography/tokens.js.map +1 -1
- package/dist/foundation/colors/base/blue.js +12 -12
- package/dist/foundation/colors/base/green.js +12 -12
- package/dist/foundation/colors/base/grey.js +28 -28
- package/dist/foundation/colors/base/index.js +11 -11
- package/dist/foundation/colors/base/lunitGreen.js +11 -11
- package/dist/foundation/colors/base/lunitTeal.js +12 -12
- package/dist/foundation/colors/base/magenta.js +12 -12
- package/dist/foundation/colors/base/opacity.js +4 -4
- package/dist/foundation/colors/base/orange.js +12 -12
- package/dist/foundation/colors/base/purple.js +12 -12
- package/dist/foundation/colors/base/red.js +12 -12
- package/dist/foundation/colors/base/yellow.js +12 -12
- package/dist/foundation/colors/index.js +119 -121
- package/dist/foundation/colors/index.js.map +1 -1
- package/dist/foundation/colors/token/component.js +184 -212
- package/dist/foundation/colors/token/component.js.map +1 -1
- package/dist/foundation/colors/token/core.js +112 -133
- package/dist/foundation/colors/token/core.js.map +1 -1
- package/dist/foundation/colors/token/index.js +2 -2
- package/dist/foundation/index.js +5 -5
- package/dist/index.js +20 -20
- package/dist/theme.js +6 -6
- package/dist/types/components/Alert/Alert.d.ts +2 -2
- package/dist/types/components/Alert/Alert.styled.d.ts +1 -2
- package/dist/types/components/Alert/Alert.types.d.ts +2 -2
- package/dist/types/components/Alert/Alert.utils.d.ts +1 -1
- package/dist/types/components/Alert/index.d.ts +1 -1
- package/dist/types/components/Button/Button.d.ts +1 -1
- package/dist/types/components/Button/Button.styled.d.ts +249 -265
- package/dist/types/components/Button/Button.types.d.ts +16 -16
- package/dist/types/components/Button/index.d.ts +1 -1
- package/dist/types/components/Button/utils/getButtonPaddingBySizeAndKind.d.ts +4 -4
- package/dist/types/components/Button/utils/getHoverStyle.d.ts +2 -1
- package/dist/types/components/Button/utils/getIconButtonPaddingBySizeAndKind.d.ts +4 -4
- package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/Checkbox/index.d.ts +1 -1
- package/dist/types/components/Chip/Chip.d.ts +1 -1
- package/dist/types/components/Chip/Chip.styled.d.ts +6 -79
- package/dist/types/components/Chip/Chip.types.d.ts +15 -14
- package/dist/types/components/Chip/index.d.ts +1 -1
- package/dist/types/components/DataTable/index.d.ts +1 -1
- package/dist/types/components/DatePicker/index.d.ts +1 -1
- package/dist/types/components/Dialog/Dialog.d.ts +11 -11
- package/dist/types/components/Dialog/Dialog.styled.d.ts +3 -4
- package/dist/types/components/Dialog/components/DialogAction.d.ts +2 -2
- package/dist/types/components/Dialog/index.d.ts +2 -2
- package/dist/types/components/Dropdown/Dropdown.d.ts +2 -2
- package/dist/types/components/Dropdown/Dropdown.styled.d.ts +4 -39
- package/dist/types/components/Dropdown/Dropdown.types.d.ts +5 -5
- package/dist/types/components/Dropdown/DropdownItem.d.ts +3 -3
- package/dist/types/components/Dropdown/index.d.ts +3 -3
- package/dist/types/components/FormLabel/FormLabel.d.ts +1 -1
- package/dist/types/components/FormLabel/index.d.ts +1 -1
- package/dist/types/components/Radio/Radio.d.ts +1 -1
- package/dist/types/components/Radio/index.d.ts +1 -1
- package/dist/types/components/RadioGroup/index.d.ts +1 -1
- package/dist/types/components/TextField/TextField.d.ts +2 -2
- package/dist/types/components/TextField/TextField.style.d.ts +3 -4
- package/dist/types/components/TextField/TextField.types.d.ts +6 -6
- package/dist/types/components/TextField/TextFieldIcon.d.ts +2 -2
- package/dist/types/components/TextField/index.d.ts +2 -2
- package/dist/types/components/Toast/Toast.d.ts +2 -2
- package/dist/types/components/Toast/Toast.types.d.ts +3 -3
- package/dist/types/components/Toast/Toast.utils.d.ts +1 -1
- package/dist/types/components/Toast/index.d.ts +2 -2
- package/dist/types/components/Toggle/Toggle.d.ts +1 -1
- package/dist/types/components/Toggle/Toggle.styled.d.ts +2 -2
- package/dist/types/components/Toggle/Toggle.types.d.ts +3 -3
- package/dist/types/components/Toggle/index.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -34
- package/dist/types/components/ToggleButton/ToggleButton.types.d.ts +10 -10
- package/dist/types/components/ToggleButton/index.d.ts +1 -1
- package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +1 -1
- package/dist/types/components/ToggleButtonGroup/index.d.ts +1 -1
- package/dist/types/components/Tooltip/index.d.ts +1 -1
- package/dist/types/components/Typography/Typography.d.ts +6 -6
- package/dist/types/components/Typography/index.d.ts +1 -1
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/foundation/Elevation/index.d.ts +22 -22
- package/dist/types/foundation/Typography/index.d.ts +78 -78
- package/dist/types/foundation/Typography/tokens.d.ts +69 -69
- package/dist/types/foundation/colors/base/index.d.ts +11 -11
- package/dist/types/foundation/colors/index.d.ts +13 -20
- package/dist/types/foundation/colors/token/component.d.ts +1 -1
- package/dist/types/foundation/colors/token/core.d.ts +1 -1
- package/dist/types/foundation/colors/token/index.d.ts +2 -2
- package/dist/types/foundation/colors/types.d.ts +0 -7
- package/dist/types/foundation/index.d.ts +4 -11
- package/dist/types/foundation/spacing.d.ts +1 -1
- package/dist/types/index.d.ts +20 -20
- package/dist/types/theme.d.ts +1 -1
- package/package.json +22 -26
- package/src/components/Alert/Alert.styled.ts +39 -49
- package/src/components/Alert/Alert.tsx +10 -16
- package/src/components/Alert/Alert.types.ts +2 -2
- package/src/components/Alert/Alert.utils.ts +13 -22
- package/src/components/Alert/index.ts +1 -1
- package/src/components/Button/Button.styled.ts +98 -101
- package/src/components/Button/Button.tsx +71 -69
- package/src/components/Button/Button.types.ts +19 -21
- package/src/components/Button/index.ts +1 -1
- package/src/components/Button/utils/getButtonPaddingBySizeAndKind.ts +13 -13
- package/src/components/Button/utils/getHoverStyle.ts +4 -2
- package/src/components/Button/utils/getIconButtonPaddingBySizeAndKind.ts +10 -19
- package/src/components/Checkbox/Checkbox.tsx +13 -25
- package/src/components/Checkbox/index.ts +1 -1
- package/src/components/Chip/Chip.styled.ts +69 -72
- package/src/components/Chip/Chip.tsx +33 -55
- package/src/components/Chip/Chip.types.ts +18 -24
- package/src/components/Chip/consts.ts +5 -5
- package/src/components/Chip/index.ts +1 -1
- package/src/components/DataTable/DataTable.tsx +2 -2
- package/src/components/DataTable/index.ts +1 -1
- package/src/components/DatePicker/DatePicker.tsx +2 -2
- package/src/components/DatePicker/index.ts +1 -1
- package/src/components/Dialog/Dialog.styled.ts +112 -114
- package/src/components/Dialog/Dialog.tsx +41 -46
- package/src/components/Dialog/components/DialogAction.tsx +8 -8
- package/src/components/Dialog/index.ts +3 -3
- package/src/components/Dropdown/Dropdown.styled.tsx +88 -89
- package/src/components/Dropdown/Dropdown.tsx +29 -30
- package/src/components/Dropdown/Dropdown.types.ts +6 -5
- package/src/components/Dropdown/DropdownItem.tsx +18 -29
- package/src/components/Dropdown/index.ts +3 -7
- package/src/components/FormLabel/FormLabel.styled.ts +3 -3
- package/src/components/FormLabel/FormLabel.tsx +3 -3
- package/src/components/FormLabel/index.ts +1 -1
- package/src/components/Radio/Radio.tsx +12 -29
- package/src/components/Radio/index.ts +1 -1
- package/src/components/RadioGroup/index.ts +1 -1
- package/src/components/TextField/TextField.style.ts +123 -132
- package/src/components/TextField/TextField.tsx +50 -62
- package/src/components/TextField/TextField.types.ts +7 -8
- package/src/components/TextField/TextFieldIcon.tsx +4 -7
- package/src/components/TextField/index.ts +2 -2
- package/src/components/Toast/Toast.styled.ts +26 -26
- package/src/components/Toast/Toast.tsx +14 -28
- package/src/components/Toast/Toast.types.ts +3 -8
- package/src/components/Toast/Toast.utils.ts +5 -8
- package/src/components/Toast/index.tsx +2 -2
- package/src/components/Toggle/Toggle.styled.ts +31 -32
- package/src/components/Toggle/Toggle.tsx +5 -11
- package/src/components/Toggle/Toggle.types.ts +3 -3
- package/src/components/Toggle/index.ts +1 -1
- package/src/components/ToggleButton/ToggleButton.styled.ts +47 -49
- package/src/components/ToggleButton/ToggleButton.tsx +91 -97
- package/src/components/ToggleButton/ToggleButton.types.ts +10 -10
- package/src/components/ToggleButton/index.ts +1 -1
- package/src/components/ToggleButtonGroup/ToggleButtonGroup.tsx +3 -8
- package/src/components/ToggleButtonGroup/index.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +2 -2
- package/src/components/Tooltip/index.ts +1 -1
- package/src/components/Typography/Typography.tsx +7 -10
- package/src/components/Typography/index.ts +1 -1
- package/src/components/index.ts +2 -2
- package/src/foundation/Elevation/index.ts +27 -27
- package/src/foundation/Elevation/utils.ts +14 -8
- package/src/foundation/Typography/index.ts +58 -57
- package/src/foundation/Typography/tokens.ts +138 -138
- package/src/foundation/colors/base/blue.ts +12 -12
- package/src/foundation/colors/base/green.ts +12 -12
- package/src/foundation/colors/base/grey.ts +28 -28
- package/src/foundation/colors/base/index.ts +11 -11
- package/src/foundation/colors/base/lunitGreen.ts +11 -11
- package/src/foundation/colors/base/lunitTeal.ts +12 -12
- package/src/foundation/colors/base/magenta.ts +12 -12
- package/src/foundation/colors/base/opacity.ts +4 -4
- package/src/foundation/colors/base/orange.ts +12 -12
- package/src/foundation/colors/base/purple.ts +12 -12
- package/src/foundation/colors/base/red.ts +12 -12
- package/src/foundation/colors/base/yellow.ts +12 -12
- package/src/foundation/colors/index.ts +119 -120
- package/src/foundation/colors/token/component.ts +185 -213
- package/src/foundation/colors/token/core.ts +113 -134
- package/src/foundation/colors/token/index.ts +2 -2
- package/src/foundation/colors/types.ts +0 -7
- package/src/foundation/index.ts +8 -8
- package/src/foundation/spacing.ts +1 -1
- package/src/index.ts +20 -20
- package/src/stories/GettingStarted.mdx +9 -15
- package/src/stories/components/Alert/Alert.stories.tsx +39 -46
- package/src/stories/components/Button/BasicButton.stories.tsx +68 -59
- package/src/stories/components/Button/ButtonDocs.mdx +17 -41
- package/src/stories/components/Button/Color.stories.tsx +28 -51
- package/src/stories/components/Button/IconButton.stories.tsx +40 -47
- package/src/stories/components/Button/Kind.stories.tsx +100 -213
- package/src/stories/components/CheckBox/BasicCheckbox.stories.tsx +52 -71
- package/src/stories/components/CheckBox/CheckboxDocs.mdx +6 -6
- package/src/stories/components/Chip/Chip.stories.tsx +75 -75
- package/src/stories/components/Chip/ChipDocs.mdx +12 -13
- package/src/stories/components/DataTable/DataTable.stories.tsx +4 -4
- package/src/stories/components/DatePicker/DatePicker.stories.tsx +4 -4
- package/src/stories/components/Dialog/Dialog.stories.tsx +103 -124
- package/src/stories/components/Dialog/DialogDocs.mdx +7 -13
- package/src/stories/components/Dropdown/Dropdown.stories.tsx +96 -82
- package/src/stories/components/Dropdown/DropdownDocs.mdx +275 -0
- package/src/stories/components/Dropdown/DropdownExamples.stories.tsx +40 -47
- package/src/stories/components/Dropdown/DropdownItem.stories.tsx +113 -98
- package/src/stories/components/SelectControl/RadioGroup.stories.tsx +17 -30
- package/src/stories/components/SelectControl/RadioStatus.stories.tsx +16 -23
- package/src/stories/components/SelectControl/Toggle.stories.tsx +33 -78
- package/src/stories/components/TextField/BasicTextField.stories.tsx +44 -60
- package/src/stories/components/TextField/TextFieldDocs.mdx +8 -12
- package/src/stories/components/TextField/TextFieldMulti.stories.tsx +39 -58
- package/src/stories/components/TextField/TextFieldSingle.stories.tsx +74 -121
- package/src/stories/components/TextField/TextFieldSize.stories.tsx +35 -56
- package/src/stories/components/Toast/Toast.stories.tsx +39 -49
- package/src/stories/components/ToggleButton/Basic.stories.tsx +237 -235
- package/src/stories/components/ToggleButton/ToggleButtonDocs.mdx +10 -14
- package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +144 -203
- package/src/stories/components/ToggleButton/WithIcon.stories.tsx +87 -107
- package/src/stories/components/Tooltip/Tooltip.stories.tsx +4 -4
- package/src/stories/foundation/Elevation/Elevation.stories.tsx +48 -73
- package/src/stories/foundation/Elevation/styled.ts +3 -3
- package/src/stories/foundation/Typography/Typography.mdx +9 -13
- package/src/stories/foundation/Typography/Typography.stories.tsx +25 -41
- package/src/stories/foundation/Typography/TypographyGroup.tsx +14 -25
- package/src/stories/foundation/Typography/const.ts +13 -19
- package/src/stories/foundation/colors/ColorSystem.tsx +42 -40
- package/src/stories/foundation/colors/Colors.stories.tsx +40 -41
- package/src/stories/foundation/colors/Docs.mdx +73 -77
- package/src/stories/foundation/colors/Mui.stories.tsx +6 -8
- package/src/stories/foundation/colors/Token.inComponent.stories.tsx +81 -71
- package/src/stories/foundation/colors/TokenPaletteTable.stories.tsx +7 -7
- package/src/stories/foundation/colors/TokenPaletteTable.tsx +23 -49
- package/src/stories/foundation/colors/styled.ts +26 -26
- package/src/theme.ts +6 -6
- package/src/types.d.ts +1 -1
- package/tsconfig.build.json +1 -5
- package/tsconfig.json +0 -1
- package/src/stories/components/ToggleButton/Group.stories.tsx +0 -221
|
@@ -1,64 +1,51 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import Radio from
|
|
3
|
-
import RadioGroup from
|
|
4
|
-
import FormLabel from
|
|
5
|
-
import { Meta, StoryFn } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Radio from '@/components/Radio';
|
|
3
|
+
import RadioGroup from '@/components/RadioGroup';
|
|
4
|
+
import FormLabel from '@/components/FormLabel';
|
|
5
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
|
-
title:
|
|
8
|
+
title: 'Components/Radio',
|
|
9
9
|
component: RadioGroup,
|
|
10
10
|
argTypes: {
|
|
11
11
|
value: {
|
|
12
12
|
control: {
|
|
13
|
-
type:
|
|
13
|
+
type: 'select',
|
|
14
14
|
},
|
|
15
|
-
table: { type: { summary:
|
|
16
|
-
options: [
|
|
17
|
-
description:
|
|
18
|
-
"Value of the selected radio button. The DOM API casts this to a string.",
|
|
15
|
+
table: { type: { summary: 'any' } },
|
|
16
|
+
options: ['On', 'Off'],
|
|
17
|
+
description: 'Value of the selected radio button. The DOM API casts this to a string.',
|
|
19
18
|
},
|
|
20
19
|
onChange: {
|
|
21
|
-
table: { type: { summary:
|
|
20
|
+
table: { type: { summary: 'func' } },
|
|
22
21
|
description:
|
|
23
|
-
|
|
22
|
+
'Callback fired when the state is changed. Signature: `function(event: React.ChangeEvent<HTMLInputElement>) => void`',
|
|
24
23
|
},
|
|
25
24
|
},
|
|
26
25
|
parameters: {
|
|
27
26
|
controls: {
|
|
28
27
|
expanded: true,
|
|
29
|
-
include: [
|
|
28
|
+
include: ['value', 'onChange'],
|
|
30
29
|
},
|
|
31
30
|
},
|
|
32
31
|
docs: {
|
|
33
32
|
description: {
|
|
34
|
-
component:
|
|
33
|
+
component: 'This component is identical to the MUI RadioGroup component.',
|
|
35
34
|
},
|
|
36
35
|
},
|
|
37
36
|
} as Meta<typeof RadioGroup>;
|
|
38
37
|
|
|
39
38
|
const RadioGroupTemplate: StoryFn<typeof RadioGroup> = (args) => {
|
|
40
|
-
const [value, setValue] = React.useState(
|
|
39
|
+
const [value, setValue] = React.useState(args.value || 'On');
|
|
41
40
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
42
41
|
setValue((event.target as HTMLInputElement).value);
|
|
43
42
|
};
|
|
44
43
|
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
if (args.value) setValue(args.value);
|
|
47
|
-
}, [args.value]);
|
|
48
|
-
|
|
49
44
|
return (
|
|
50
|
-
<RadioGroup
|
|
51
|
-
name="controlled-radio-buttons-group"
|
|
52
|
-
value={value}
|
|
53
|
-
onChange={handleChange}
|
|
54
|
-
>
|
|
45
|
+
<RadioGroup name="controlled-radio-buttons-group" value={value} onChange={handleChange}>
|
|
55
46
|
<FormLabel value="On" control={<Radio />} label="On" />
|
|
56
47
|
<FormLabel value="Off" control={<Radio />} label="Off" />
|
|
57
|
-
<FormLabel
|
|
58
|
-
value="(Disabled option)"
|
|
59
|
-
control={<Radio disabled />}
|
|
60
|
-
label="(Disabled option)"
|
|
61
|
-
/>
|
|
48
|
+
<FormLabel value="(Disabled option)" control={<Radio disabled />} label="(Disabled option)" />
|
|
62
49
|
</RadioGroup>
|
|
63
50
|
);
|
|
64
51
|
};
|
|
@@ -1,33 +1,26 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
TableHead,
|
|
6
|
-
TableRow,
|
|
7
|
-
TableBody,
|
|
8
|
-
TableCell,
|
|
9
|
-
} from "@mui/material";
|
|
10
|
-
import Radio from "@/components/Radio";
|
|
11
|
-
import { Meta, StoryFn } from "@storybook/react";
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Table, TableHead, TableRow, TableBody, TableCell } from '@mui/material';
|
|
3
|
+
import Radio from '@/components/Radio';
|
|
4
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
12
5
|
|
|
13
6
|
export default {
|
|
14
|
-
title:
|
|
7
|
+
title: 'Components/Radio',
|
|
15
8
|
component: Radio,
|
|
16
9
|
argTypes: {
|
|
17
10
|
disabled: {
|
|
18
|
-
control:
|
|
19
|
-
table: { type: { summary:
|
|
20
|
-
description:
|
|
11
|
+
control: 'boolean',
|
|
12
|
+
table: { type: { summary: 'bool' }, defaultValue: { summary: 'false' } },
|
|
13
|
+
description: 'If true, the component is disabled.',
|
|
21
14
|
},
|
|
22
15
|
checked: {
|
|
23
|
-
control:
|
|
24
|
-
table: { type: { summary:
|
|
25
|
-
description:
|
|
16
|
+
control: 'boolean',
|
|
17
|
+
table: { type: { summary: 'bool' }, defaultValue: { summary: 'false' } },
|
|
18
|
+
description: 'If true, the component is checked.',
|
|
26
19
|
},
|
|
27
20
|
onChange: {
|
|
28
|
-
table: { type: { summary:
|
|
21
|
+
table: { type: { summary: 'func' } },
|
|
29
22
|
description:
|
|
30
|
-
|
|
23
|
+
'Callback fired when the state is changed. Signature: `function(event: React.ChangeEvent<HTMLInputElement>) => void`',
|
|
31
24
|
},
|
|
32
25
|
},
|
|
33
26
|
args: {
|
|
@@ -37,12 +30,12 @@ export default {
|
|
|
37
30
|
parameters: {
|
|
38
31
|
controls: {
|
|
39
32
|
expanded: true,
|
|
40
|
-
include: [
|
|
33
|
+
include: ['checked', 'disabled', 'onChange'],
|
|
41
34
|
},
|
|
42
35
|
},
|
|
43
36
|
docs: {
|
|
44
37
|
description: {
|
|
45
|
-
component:
|
|
38
|
+
component: 'This component base is Material UI Radio component.',
|
|
46
39
|
},
|
|
47
40
|
},
|
|
48
41
|
} as Meta<typeof Radio>;
|
|
@@ -52,7 +45,7 @@ const RadioTemplate: StoryFn<typeof Radio> = (args) => {
|
|
|
52
45
|
<Table sx={{ width: 650 }}>
|
|
53
46
|
<TableHead>
|
|
54
47
|
<TableRow>
|
|
55
|
-
<TableCell
|
|
48
|
+
<TableCell />
|
|
56
49
|
<TableCell>Enabled</TableCell>
|
|
57
50
|
<TableCell>Focuse</TableCell>
|
|
58
51
|
<TableCell>Disabled</TableCell>
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { StoryFn, Meta } from
|
|
3
|
-
import Toggle from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
TableBody,
|
|
8
|
-
TableCell,
|
|
9
|
-
TableHead,
|
|
10
|
-
TableRow,
|
|
11
|
-
TextField,
|
|
12
|
-
} from "@mui/material";
|
|
13
|
-
import FormLabel from "@/components/FormLabel";
|
|
14
|
-
import { action } from "@storybook/addon-actions";
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { StoryFn, Meta } from '@storybook/react-webpack5';
|
|
3
|
+
import Toggle from '@/components/Toggle/Toggle';
|
|
4
|
+
import { Box, Table, TableBody, TableCell, TableHead, TableRow, TextField } from '@mui/material';
|
|
5
|
+
import FormLabel from '@/components/FormLabel';
|
|
6
|
+
import { action } from 'storybook/actions';
|
|
15
7
|
|
|
16
8
|
export default {
|
|
17
|
-
title:
|
|
9
|
+
title: 'Components/Toggle',
|
|
18
10
|
component: Toggle,
|
|
19
11
|
argTypes: {
|
|
20
12
|
checked: {
|
|
21
13
|
control: {
|
|
22
|
-
type:
|
|
14
|
+
type: 'select',
|
|
23
15
|
},
|
|
24
16
|
options: [true, false, undefined],
|
|
25
17
|
description:
|
|
@@ -27,31 +19,31 @@ export default {
|
|
|
27
19
|
},
|
|
28
20
|
onChange: {
|
|
29
21
|
control: {
|
|
30
|
-
type:
|
|
22
|
+
type: 'select',
|
|
31
23
|
},
|
|
32
|
-
options: [
|
|
24
|
+
options: ['function', undefined],
|
|
33
25
|
mapping: {
|
|
34
|
-
function: action(
|
|
26
|
+
function: action('onChange'),
|
|
35
27
|
undefined: undefined,
|
|
36
28
|
},
|
|
37
|
-
description:
|
|
29
|
+
description: '(() => void)',
|
|
38
30
|
},
|
|
39
31
|
disabled: {
|
|
40
32
|
control: {
|
|
41
|
-
type:
|
|
33
|
+
type: 'boolean',
|
|
42
34
|
},
|
|
43
|
-
description:
|
|
35
|
+
description: 'If `true`, the component is disabled.',
|
|
44
36
|
options: [true, false],
|
|
45
37
|
},
|
|
46
38
|
},
|
|
47
39
|
args: {
|
|
48
|
-
size:
|
|
40
|
+
size: 'small',
|
|
49
41
|
indeterminate: false,
|
|
50
42
|
disabled: false,
|
|
51
43
|
},
|
|
52
44
|
parameters: {
|
|
53
45
|
controls: {
|
|
54
|
-
include: [
|
|
46
|
+
include: ['disabled', 'checked', 'size', 'indeterminate', 'onChange'],
|
|
55
47
|
},
|
|
56
48
|
docs: {
|
|
57
49
|
description: {
|
|
@@ -64,10 +56,7 @@ export default {
|
|
|
64
56
|
} as Meta<typeof Toggle>;
|
|
65
57
|
|
|
66
58
|
const BaseTemplate: StoryFn<typeof Toggle> = (args) => {
|
|
67
|
-
const [checked, setChecked] = useState(
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
setChecked(Boolean(args.checked));
|
|
70
|
-
}, [args.checked]);
|
|
59
|
+
const [checked, setChecked] = useState(Boolean(args.checked));
|
|
71
60
|
|
|
72
61
|
return (
|
|
73
62
|
<Table>
|
|
@@ -79,11 +68,7 @@ const BaseTemplate: StoryFn<typeof Toggle> = (args) => {
|
|
|
79
68
|
<TableBody>
|
|
80
69
|
<TableRow>
|
|
81
70
|
<TableCell>
|
|
82
|
-
<Toggle
|
|
83
|
-
{...args}
|
|
84
|
-
checked={checked}
|
|
85
|
-
onChange={() => setChecked(!checked)}
|
|
86
|
-
/>
|
|
71
|
+
<Toggle {...args} checked={checked} onChange={() => setChecked(!checked)} />
|
|
87
72
|
</TableCell>
|
|
88
73
|
</TableRow>
|
|
89
74
|
</TableBody>
|
|
@@ -95,7 +80,7 @@ const Template: StoryFn<typeof Toggle> = (args) => (
|
|
|
95
80
|
<Table>
|
|
96
81
|
<TableHead>
|
|
97
82
|
<TableRow>
|
|
98
|
-
<TableCell
|
|
83
|
+
<TableCell />
|
|
99
84
|
<TableCell>ON</TableCell>
|
|
100
85
|
<TableCell>Indeterminate</TableCell>
|
|
101
86
|
<TableCell>OFF</TableCell>
|
|
@@ -158,7 +143,7 @@ const DisabledTemplate: StoryFn<typeof Toggle> = (args) => (
|
|
|
158
143
|
<Table>
|
|
159
144
|
<TableHead>
|
|
160
145
|
<TableRow>
|
|
161
|
-
<TableCell
|
|
146
|
+
<TableCell />
|
|
162
147
|
<TableCell>ON</TableCell>
|
|
163
148
|
<TableCell>Indeterminate</TableCell>
|
|
164
149
|
<TableCell>OFF</TableCell>
|
|
@@ -197,7 +182,7 @@ const TemplateWithLabel: StoryFn<typeof Toggle> = (args) => (
|
|
|
197
182
|
<Table>
|
|
198
183
|
<TableHead>
|
|
199
184
|
<TableRow>
|
|
200
|
-
<TableCell
|
|
185
|
+
<TableCell />
|
|
201
186
|
<TableCell>ON</TableCell>
|
|
202
187
|
<TableCell>Indeterminate</TableCell>
|
|
203
188
|
<TableCell>OFF</TableCell>
|
|
@@ -216,10 +201,7 @@ const TemplateWithLabel: StoryFn<typeof Toggle> = (args) => (
|
|
|
216
201
|
/>
|
|
217
202
|
</TableCell>
|
|
218
203
|
<TableCell>
|
|
219
|
-
<FormLabel
|
|
220
|
-
label={<TextField placeholder="Label 3" />}
|
|
221
|
-
control={<Toggle {...args} />}
|
|
222
|
-
/>
|
|
204
|
+
<FormLabel label={<TextField placeholder="Label 3" />} control={<Toggle {...args} />} />
|
|
223
205
|
</TableCell>
|
|
224
206
|
</TableRow>
|
|
225
207
|
<TableRow>
|
|
@@ -249,10 +231,7 @@ const TemplateWithLabel: StoryFn<typeof Toggle> = (args) => (
|
|
|
249
231
|
<TableRow>
|
|
250
232
|
<TableCell>LARGE DEFAULT</TableCell>
|
|
251
233
|
<TableCell>
|
|
252
|
-
<FormLabel
|
|
253
|
-
label="Label 1"
|
|
254
|
-
control={<Toggle {...args} size="large" checked />}
|
|
255
|
-
/>
|
|
234
|
+
<FormLabel label="Label 1" control={<Toggle {...args} size="large" checked />} />
|
|
256
235
|
</TableCell>
|
|
257
236
|
<TableCell>
|
|
258
237
|
<FormLabel
|
|
@@ -295,7 +274,7 @@ const TemplateWithLabel: StoryFn<typeof Toggle> = (args) => (
|
|
|
295
274
|
</Table>
|
|
296
275
|
);
|
|
297
276
|
|
|
298
|
-
const IndeterminateTemplate: StoryFn<typeof Toggle> = (
|
|
277
|
+
const IndeterminateTemplate: StoryFn<typeof Toggle> = () => {
|
|
299
278
|
const [checked, setChecked] = useState([true, false, false]);
|
|
300
279
|
|
|
301
280
|
const handleChange1 = () => {
|
|
@@ -336,25 +315,19 @@ const IndeterminateTemplate: StoryFn<typeof Toggle> = (args) => {
|
|
|
336
315
|
/>
|
|
337
316
|
}
|
|
338
317
|
/>
|
|
339
|
-
<Box sx={{ display:
|
|
318
|
+
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
|
|
340
319
|
<FormLabel
|
|
341
320
|
label="Child 1"
|
|
342
|
-
control={
|
|
343
|
-
<Toggle checked={checked[0]} onChange={handleChange2} />
|
|
344
|
-
}
|
|
321
|
+
control={<Toggle checked={checked[0]} onChange={handleChange2} />}
|
|
345
322
|
/>
|
|
346
323
|
<FormLabel
|
|
347
324
|
label="Child 2"
|
|
348
|
-
control={
|
|
349
|
-
<Toggle checked={checked[1]} onChange={handleChange3} />
|
|
350
|
-
}
|
|
325
|
+
control={<Toggle checked={checked[1]} onChange={handleChange3} />}
|
|
351
326
|
/>
|
|
352
327
|
<FormLabel
|
|
353
328
|
label="Child 3"
|
|
354
329
|
disabled
|
|
355
|
-
control={
|
|
356
|
-
<Toggle checked={checked[2]} onChange={handleChange4} />
|
|
357
|
-
}
|
|
330
|
+
control={<Toggle checked={checked[2]} onChange={handleChange4} />}
|
|
358
331
|
/>
|
|
359
332
|
</Box>
|
|
360
333
|
</TableCell>
|
|
@@ -370,37 +343,19 @@ const IndeterminateTemplate: StoryFn<typeof Toggle> = (args) => {
|
|
|
370
343
|
/>
|
|
371
344
|
}
|
|
372
345
|
/>
|
|
373
|
-
<Box sx={{ display:
|
|
346
|
+
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
|
|
374
347
|
<FormLabel
|
|
375
348
|
label="Child 1"
|
|
376
|
-
control={
|
|
377
|
-
<Toggle
|
|
378
|
-
size="large"
|
|
379
|
-
checked={checked[0]}
|
|
380
|
-
onChange={handleChange2}
|
|
381
|
-
/>
|
|
382
|
-
}
|
|
349
|
+
control={<Toggle size="large" checked={checked[0]} onChange={handleChange2} />}
|
|
383
350
|
/>
|
|
384
351
|
<FormLabel
|
|
385
352
|
label="Child 2"
|
|
386
|
-
control={
|
|
387
|
-
<Toggle
|
|
388
|
-
size="large"
|
|
389
|
-
checked={checked[1]}
|
|
390
|
-
onChange={handleChange3}
|
|
391
|
-
/>
|
|
392
|
-
}
|
|
353
|
+
control={<Toggle size="large" checked={checked[1]} onChange={handleChange3} />}
|
|
393
354
|
/>
|
|
394
355
|
<FormLabel
|
|
395
356
|
label="Child 3"
|
|
396
357
|
disabled
|
|
397
|
-
control={
|
|
398
|
-
<Toggle
|
|
399
|
-
size="large"
|
|
400
|
-
checked={checked[2]}
|
|
401
|
-
onChange={handleChange4}
|
|
402
|
-
/>
|
|
403
|
-
}
|
|
358
|
+
control={<Toggle size="large" checked={checked[2]} onChange={handleChange4} />}
|
|
404
359
|
/>
|
|
405
360
|
</Box>
|
|
406
361
|
</TableCell>
|
|
@@ -436,7 +391,7 @@ export const ToggleWithLabelAndIndeterminate = {
|
|
|
436
391
|
parameters: {
|
|
437
392
|
docs: {
|
|
438
393
|
description: {
|
|
439
|
-
story:
|
|
394
|
+
story: 'Usage is same with Toggle',
|
|
440
395
|
},
|
|
441
396
|
},
|
|
442
397
|
},
|
|
@@ -1,88 +1,72 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Box } from
|
|
3
|
-
import { Bell } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { Bell } from '@lunit/design-system-icons';
|
|
4
4
|
|
|
5
|
-
import TextField from
|
|
5
|
+
import TextField from '@/components/TextField/TextField';
|
|
6
6
|
|
|
7
|
-
import type { StoryObj, Meta, StoryFn } from
|
|
7
|
+
import type { StoryObj, Meta, StoryFn } from '@storybook/react-webpack5';
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
title:
|
|
10
|
+
title: 'Components/TextField',
|
|
11
11
|
component: TextField,
|
|
12
12
|
args: {
|
|
13
13
|
multiline: false,
|
|
14
|
-
size:
|
|
14
|
+
size: 'small',
|
|
15
15
|
disabled: false,
|
|
16
16
|
error: false,
|
|
17
|
-
placeholder:
|
|
18
|
-
helperText:
|
|
17
|
+
placeholder: 'Please typing...',
|
|
18
|
+
helperText: '',
|
|
19
19
|
},
|
|
20
20
|
argTypes: {
|
|
21
21
|
multiline: {
|
|
22
|
-
control: {
|
|
23
|
-
type: "radio",
|
|
24
|
-
},
|
|
22
|
+
control: { type: 'radio' },
|
|
25
23
|
options: [true, false],
|
|
26
|
-
description:
|
|
27
|
-
"The multiline prop transforms the text field into a TextareaAutosize element.",
|
|
24
|
+
description: 'The multiline prop transforms the text field into a TextareaAutosize element.',
|
|
28
25
|
},
|
|
29
26
|
error: {
|
|
30
|
-
control: {
|
|
31
|
-
type: "radio",
|
|
32
|
-
},
|
|
27
|
+
control: { type: 'radio' },
|
|
33
28
|
options: [true, false],
|
|
34
29
|
description:
|
|
35
|
-
|
|
30
|
+
'The error prop toggles the error state. The helperText prop can then be used to provide feedback to the user about the error.',
|
|
36
31
|
},
|
|
37
32
|
disabled: {
|
|
38
|
-
control: {
|
|
39
|
-
type: "radio",
|
|
40
|
-
},
|
|
33
|
+
control: { type: 'radio' },
|
|
41
34
|
options: [true, false],
|
|
42
|
-
description:
|
|
35
|
+
description: 'If true, the text field will be disabled.',
|
|
43
36
|
table: {
|
|
44
|
-
defaultValue: { summary: false },
|
|
45
|
-
type: { summary:
|
|
37
|
+
defaultValue: { summary: 'false' },
|
|
38
|
+
type: { summary: 'boolean' },
|
|
46
39
|
},
|
|
47
40
|
},
|
|
48
41
|
size: {
|
|
49
|
-
control: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
description: "The size of the text field.",
|
|
42
|
+
control: { type: 'radio' },
|
|
43
|
+
options: ['small', 'medium', 'large'],
|
|
44
|
+
description: 'The size of the text field.',
|
|
53
45
|
table: {
|
|
54
|
-
defaultValue: { summary:
|
|
55
|
-
type: { summary:
|
|
46
|
+
defaultValue: { summary: 'small' },
|
|
47
|
+
type: { summary: 'string' },
|
|
56
48
|
},
|
|
57
49
|
},
|
|
58
50
|
placeholder: {
|
|
59
|
-
type:
|
|
60
|
-
description:
|
|
51
|
+
type: 'string',
|
|
52
|
+
description: 'The placeholder content.',
|
|
61
53
|
table: {
|
|
62
|
-
defaultValue: { summary:
|
|
63
|
-
type: { summary:
|
|
54
|
+
defaultValue: { summary: 'undefined' },
|
|
55
|
+
type: { summary: 'string' },
|
|
64
56
|
},
|
|
65
57
|
},
|
|
66
58
|
helperText: {
|
|
67
|
-
type:
|
|
68
|
-
description:
|
|
69
|
-
'The helper text content, use "error " or "sub text " to display helper text.',
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'The helper text content, use "error " or "sub text " to display helper text.',
|
|
70
61
|
table: {
|
|
71
|
-
defaultValue: { summary:
|
|
72
|
-
type: { summary:
|
|
62
|
+
defaultValue: { summary: 'undefined' },
|
|
63
|
+
type: { summary: 'string' },
|
|
73
64
|
},
|
|
74
65
|
},
|
|
75
66
|
},
|
|
76
67
|
parameters: {
|
|
77
68
|
controls: {
|
|
78
|
-
include: [
|
|
79
|
-
"size",
|
|
80
|
-
"disabled",
|
|
81
|
-
"helperText",
|
|
82
|
-
"placeholder",
|
|
83
|
-
"multiline",
|
|
84
|
-
"error",
|
|
85
|
-
],
|
|
69
|
+
include: ['size', 'disabled', 'helperText', 'placeholder', 'multiline', 'error'],
|
|
86
70
|
},
|
|
87
71
|
docs: {
|
|
88
72
|
description: {
|
|
@@ -104,7 +88,7 @@ export const BasicTextField: StoryObj<typeof TextField> = {
|
|
|
104
88
|
|
|
105
89
|
const MultiAndSingleTemplate: StoryFn<typeof TextField> = (args) => {
|
|
106
90
|
return (
|
|
107
|
-
<Box sx={{ display:
|
|
91
|
+
<Box sx={{ display: 'flex', gap: 2 }}>
|
|
108
92
|
<TextField {...args} />
|
|
109
93
|
<TextField {...args} multiline={true} />
|
|
110
94
|
</Box>
|
|
@@ -115,7 +99,7 @@ export const MultiAndSingle: StoryObj<typeof TextField> = {
|
|
|
115
99
|
render: MultiAndSingleTemplate,
|
|
116
100
|
parameters: {
|
|
117
101
|
controls: {
|
|
118
|
-
include: [
|
|
102
|
+
include: ['size', 'disabled', 'helperText', 'placeholder', 'error'],
|
|
119
103
|
},
|
|
120
104
|
chromatic: { disableSnapshot: true },
|
|
121
105
|
},
|
|
@@ -123,7 +107,7 @@ export const MultiAndSingle: StoryObj<typeof TextField> = {
|
|
|
123
107
|
|
|
124
108
|
const DisabledTemplate: StoryFn<typeof TextField> = (args) => {
|
|
125
109
|
return (
|
|
126
|
-
<Box sx={{ display:
|
|
110
|
+
<Box sx={{ display: 'flex', gap: 2 }}>
|
|
127
111
|
<TextField {...args} disabled />
|
|
128
112
|
<TextField {...args} multiline={true} disabled />
|
|
129
113
|
</Box>
|
|
@@ -134,7 +118,7 @@ export const Disabled: StoryObj<typeof TextField> = {
|
|
|
134
118
|
render: DisabledTemplate,
|
|
135
119
|
parameters: {
|
|
136
120
|
controls: {
|
|
137
|
-
include: [
|
|
121
|
+
include: ['size', 'helperText', 'placeholder', 'error', 'disabled'],
|
|
138
122
|
},
|
|
139
123
|
chromatic: { disableSnapshot: true },
|
|
140
124
|
},
|
|
@@ -142,7 +126,7 @@ export const Disabled: StoryObj<typeof TextField> = {
|
|
|
142
126
|
|
|
143
127
|
const ReadOnlyTemplate: StoryFn<typeof TextField> = (args) => {
|
|
144
128
|
return (
|
|
145
|
-
<Box sx={{ display:
|
|
129
|
+
<Box sx={{ display: 'flex', gap: 2 }}>
|
|
146
130
|
<TextField
|
|
147
131
|
{...args}
|
|
148
132
|
inputProps={{ readOnly: true }}
|
|
@@ -162,7 +146,7 @@ export const ReadOnly: StoryObj<typeof TextField> = {
|
|
|
162
146
|
render: ReadOnlyTemplate,
|
|
163
147
|
parameters: {
|
|
164
148
|
controls: {
|
|
165
|
-
include: [
|
|
149
|
+
include: ['size', 'helperText', 'error', 'disabled'],
|
|
166
150
|
},
|
|
167
151
|
chromatic: { disableSnapshot: true },
|
|
168
152
|
},
|
|
@@ -170,7 +154,7 @@ export const ReadOnly: StoryObj<typeof TextField> = {
|
|
|
170
154
|
|
|
171
155
|
const ErrorTemplate: StoryFn<typeof TextField> = (args) => {
|
|
172
156
|
return (
|
|
173
|
-
<Box sx={{ display:
|
|
157
|
+
<Box sx={{ display: 'flex', gap: 2 }}>
|
|
174
158
|
<TextField {...args} error />
|
|
175
159
|
<TextField {...args} multiline={true} error />
|
|
176
160
|
</Box>
|
|
@@ -181,7 +165,7 @@ export const Error: StoryObj<typeof TextField> = {
|
|
|
181
165
|
render: ErrorTemplate,
|
|
182
166
|
parameters: {
|
|
183
167
|
controls: {
|
|
184
|
-
include: [
|
|
168
|
+
include: ['size', 'helperText', 'placeholder', 'disabled'],
|
|
185
169
|
},
|
|
186
170
|
chromatic: { disableSnapshot: true },
|
|
187
171
|
},
|
|
@@ -189,7 +173,7 @@ export const Error: StoryObj<typeof TextField> = {
|
|
|
189
173
|
|
|
190
174
|
const PlaceholderTemplate: StoryFn<typeof TextField> = (args) => {
|
|
191
175
|
return (
|
|
192
|
-
<Box sx={{ display:
|
|
176
|
+
<Box sx={{ display: 'flex', gap: 2 }}>
|
|
193
177
|
<TextField {...args} placeholder="Please typing..." />
|
|
194
178
|
<TextField {...args} multiline={true} placeholder="Please typing..." />
|
|
195
179
|
</Box>
|
|
@@ -200,7 +184,7 @@ export const Placeholder: StoryObj<typeof TextField> = {
|
|
|
200
184
|
render: PlaceholderTemplate,
|
|
201
185
|
parameters: {
|
|
202
186
|
controls: {
|
|
203
|
-
include: [
|
|
187
|
+
include: ['size', 'helperText', 'disabled', 'error'],
|
|
204
188
|
},
|
|
205
189
|
chromatic: { disableSnapshot: true },
|
|
206
190
|
},
|
|
@@ -208,7 +192,7 @@ export const Placeholder: StoryObj<typeof TextField> = {
|
|
|
208
192
|
|
|
209
193
|
const HelperTextTemplate: StoryFn<typeof TextField> = (args) => {
|
|
210
194
|
return (
|
|
211
|
-
<Box sx={{ display:
|
|
195
|
+
<Box sx={{ display: 'flex', gap: 2 }}>
|
|
212
196
|
<TextField {...args} helperText="helper text" />
|
|
213
197
|
<TextField {...args} multiline={true} helperText="helper text" />
|
|
214
198
|
</Box>
|
|
@@ -219,7 +203,7 @@ export const HelperText: StoryObj<typeof TextField> = {
|
|
|
219
203
|
render: HelperTextTemplate,
|
|
220
204
|
parameters: {
|
|
221
205
|
controls: {
|
|
222
|
-
include: [
|
|
206
|
+
include: ['size', 'disabled', 'error', 'placeholder'],
|
|
223
207
|
},
|
|
224
208
|
chromatic: { disableSnapshot: true },
|
|
225
209
|
},
|
|
@@ -227,7 +211,7 @@ export const HelperText: StoryObj<typeof TextField> = {
|
|
|
227
211
|
|
|
228
212
|
const IconTemplate: StoryFn<typeof TextField> = (args) => {
|
|
229
213
|
return (
|
|
230
|
-
<Box sx={{ display:
|
|
214
|
+
<Box sx={{ display: 'flex', gap: 2 }}>
|
|
231
215
|
<TextField {...args} leftIcon={<Bell />} />
|
|
232
216
|
<TextField {...args} rightIcon={<Bell />} />
|
|
233
217
|
</Box>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Canvas, Stories, Controls, Meta, Story } from
|
|
2
|
-
import Box from
|
|
1
|
+
import { Canvas, Stories, Controls, Meta, Story } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
3
|
|
|
4
|
-
import TextField from
|
|
5
|
-
import * as TextFieldStories from
|
|
6
|
-
import * as TextFieldSizeStories from
|
|
4
|
+
import TextField from '@/components/TextField';
|
|
5
|
+
import * as TextFieldStories from './BasicTextField.stories';
|
|
6
|
+
import * as TextFieldSizeStories from './TextFieldSize.stories';
|
|
7
7
|
|
|
8
8
|
<Meta name="TextField Docs" of={TextFieldStories} />
|
|
9
9
|
|
|
@@ -16,9 +16,9 @@ Text Fields let users enter and edit text.
|
|
|
16
16
|
### Basic TextField
|
|
17
17
|
|
|
18
18
|
```tsx
|
|
19
|
-
import { TextField } from
|
|
19
|
+
import { TextField } from '@lunit/design-system';
|
|
20
20
|
// or
|
|
21
|
-
import TextField from
|
|
21
|
+
import TextField from '@lunit/design-system/TextField';
|
|
22
22
|
|
|
23
23
|
<TextField />;
|
|
24
24
|
```
|
|
@@ -48,11 +48,7 @@ The TextField have three sizes: `small`, `medium` and `large`.<br />
|
|
|
48
48
|
Using the `size` prop, you can change the size of the TextField.<br />
|
|
49
49
|
Default size is `small`.
|
|
50
50
|
|
|
51
|
-
<Canvas
|
|
52
|
-
of={TextFieldSizeStories.TextFieldSize}
|
|
53
|
-
meta={TextFieldSizeStories}
|
|
54
|
-
sourceState="none"
|
|
55
|
-
/>
|
|
51
|
+
<Canvas of={TextFieldSizeStories.TextFieldSize} meta={TextFieldSizeStories} sourceState="none" />
|
|
56
52
|
|
|
57
53
|
```tsx
|
|
58
54
|
// multiline is false or undefined
|