@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,37 +1,37 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Box, Typography } from
|
|
3
|
-
import { StoryFn, Meta } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Typography } from '@mui/material';
|
|
3
|
+
import { StoryFn, Meta } from '@storybook/react-webpack5';
|
|
4
4
|
|
|
5
|
-
import Alert from
|
|
6
|
-
import Button from
|
|
7
|
-
import theme from
|
|
8
|
-
import { action } from
|
|
5
|
+
import Alert from '@/components/Alert';
|
|
6
|
+
import Button from '@/components/Button';
|
|
7
|
+
import theme from '@/theme';
|
|
8
|
+
import { action } from 'storybook/actions';
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
|
-
title:
|
|
11
|
+
title: 'Components/Alert',
|
|
12
12
|
component: Alert,
|
|
13
13
|
argTypes: {
|
|
14
14
|
title: {
|
|
15
|
-
control:
|
|
16
|
-
description:
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Used to represent the title of the alert.',
|
|
17
17
|
},
|
|
18
18
|
severity: {
|
|
19
|
-
control:
|
|
19
|
+
control: 'radio',
|
|
20
20
|
table: {
|
|
21
|
-
defaultValue: { summary:
|
|
21
|
+
defaultValue: { summary: 'success' },
|
|
22
22
|
},
|
|
23
|
-
options: [
|
|
23
|
+
options: ['success', 'info', 'warning', 'error', undefined],
|
|
24
24
|
description: `\`success\`, \`info\`, \`warning\`, \`error\`, \`undefined\``,
|
|
25
25
|
},
|
|
26
26
|
onClose: {
|
|
27
|
-
control:
|
|
27
|
+
control: false, // TODO: 스토리북 버전업 과정에서 control 이 'function' 타입을 지원하지 않아 false 로 변경. 현재 스토리북에서 동작은 이상없으나 필요한 사항이 있으면 수정할 것
|
|
28
28
|
description: `Callback fired when the component requests to be closed.
|
|
29
29
|
When provided, a close icon button is displayed that triggers the callback when clicked.`,
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
parameters: {
|
|
33
33
|
controls: {
|
|
34
|
-
include: [
|
|
34
|
+
include: ['title', 'severity', 'onClose'],
|
|
35
35
|
},
|
|
36
36
|
docs: {
|
|
37
37
|
description: {
|
|
@@ -45,10 +45,10 @@ export default {
|
|
|
45
45
|
(Story) => (
|
|
46
46
|
<Box
|
|
47
47
|
sx={{
|
|
48
|
-
display:
|
|
49
|
-
flexDirection:
|
|
50
|
-
padding:
|
|
51
|
-
gap:
|
|
48
|
+
display: 'flex',
|
|
49
|
+
flexDirection: 'column',
|
|
50
|
+
padding: '3em',
|
|
51
|
+
gap: '1em',
|
|
52
52
|
}}
|
|
53
53
|
>
|
|
54
54
|
{Story()}
|
|
@@ -60,13 +60,10 @@ export default {
|
|
|
60
60
|
const AlertChildrenContentLong = () => {
|
|
61
61
|
return (
|
|
62
62
|
<Typography variant="body2_14_regular">
|
|
63
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</u>{" "}
|
|
68
|
-
magna aliqua. A diam sollicitudin tempor id eu nisl nunc mi. Auctor augue
|
|
69
|
-
mauris augue neque gravida in fermentum.
|
|
63
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut{' '}
|
|
64
|
+
<u style={{ color: theme.palette.lunit_token.core.link_primary }}>labore et dolore</u> magna
|
|
65
|
+
aliqua. A diam sollicitudin tempor id eu nisl nunc mi. Auctor augue mauris augue neque gravida
|
|
66
|
+
in fermentum.
|
|
70
67
|
</Typography>
|
|
71
68
|
);
|
|
72
69
|
};
|
|
@@ -81,7 +78,7 @@ const AlertChildrenContentShort = () => {
|
|
|
81
78
|
|
|
82
79
|
const AlertBottomAction = () => {
|
|
83
80
|
return (
|
|
84
|
-
<Box sx={{ display:
|
|
81
|
+
<Box sx={{ display: 'flex', columnGap: '8px' }}>
|
|
85
82
|
<Button color="primary" kind="contained">
|
|
86
83
|
Button
|
|
87
84
|
</Button>
|
|
@@ -93,34 +90,30 @@ const AlertBottomAction = () => {
|
|
|
93
90
|
};
|
|
94
91
|
|
|
95
92
|
const Template: StoryFn<typeof Alert> = (args) => (
|
|
96
|
-
<Alert sx={{ width:
|
|
93
|
+
<Alert sx={{ width: '620px' }} {...args}>
|
|
97
94
|
<AlertChildrenContentLong />
|
|
98
95
|
</Alert>
|
|
99
96
|
);
|
|
100
97
|
|
|
101
98
|
const Template2: StoryFn<typeof Alert> = (args) => (
|
|
102
99
|
<>
|
|
103
|
-
<Alert sx={{ width:
|
|
100
|
+
<Alert sx={{ width: '504px' }} {...args}>
|
|
104
101
|
<AlertChildrenContentLong />
|
|
105
102
|
</Alert>
|
|
106
|
-
<Alert sx={{ width:
|
|
103
|
+
<Alert sx={{ width: '620px' }} severity={args.severity} onClose={() => {}}>
|
|
107
104
|
<AlertChildrenContentLong />
|
|
108
105
|
</Alert>
|
|
109
|
-
<Alert sx={{ width:
|
|
106
|
+
<Alert sx={{ width: '620px' }} severity={args.severity} onClose={() => {}}>
|
|
110
107
|
<AlertChildrenContentShort />
|
|
111
108
|
</Alert>
|
|
112
|
-
<Alert sx={{ width:
|
|
109
|
+
<Alert sx={{ width: '620px' }} severity={args.severity}>
|
|
113
110
|
<AlertChildrenContentShort />
|
|
114
111
|
</Alert>
|
|
115
112
|
</>
|
|
116
113
|
);
|
|
117
114
|
const Template3: StoryFn<typeof Alert> = (args) => (
|
|
118
115
|
<>
|
|
119
|
-
<Alert
|
|
120
|
-
sx={{ width: "504px" }}
|
|
121
|
-
bottomAction={<AlertBottomAction />}
|
|
122
|
-
{...args}
|
|
123
|
-
>
|
|
116
|
+
<Alert sx={{ width: '504px' }} bottomAction={<AlertBottomAction />} {...args}>
|
|
124
117
|
<AlertChildrenContentLong />
|
|
125
118
|
</Alert>
|
|
126
119
|
</>
|
|
@@ -130,9 +123,9 @@ export const AlertBase = {
|
|
|
130
123
|
render: Template,
|
|
131
124
|
|
|
132
125
|
args: {
|
|
133
|
-
title:
|
|
134
|
-
severity:
|
|
135
|
-
onClose: action(
|
|
126
|
+
title: 'Alert title',
|
|
127
|
+
severity: 'success',
|
|
128
|
+
onClose: action('Close Button is clicked'),
|
|
136
129
|
},
|
|
137
130
|
};
|
|
138
131
|
|
|
@@ -140,9 +133,9 @@ export const AlertVariant = {
|
|
|
140
133
|
render: Template2,
|
|
141
134
|
|
|
142
135
|
args: {
|
|
143
|
-
title:
|
|
144
|
-
severity:
|
|
145
|
-
onClose: action(
|
|
136
|
+
title: 'Alert title',
|
|
137
|
+
severity: 'success',
|
|
138
|
+
onClose: action('Close Button is clicked'),
|
|
146
139
|
},
|
|
147
140
|
};
|
|
148
141
|
|
|
@@ -150,8 +143,8 @@ export const AlertWithBottomAction = {
|
|
|
150
143
|
render: Template3,
|
|
151
144
|
|
|
152
145
|
args: {
|
|
153
|
-
title:
|
|
154
|
-
severity:
|
|
155
|
-
onClose: action(
|
|
146
|
+
title: 'Alert title',
|
|
147
|
+
severity: 'success',
|
|
148
|
+
onClose: action('Close Button is clicked'),
|
|
156
149
|
},
|
|
157
150
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { action } from
|
|
3
|
-
import { Box } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
4
|
|
|
5
|
-
import Button from
|
|
5
|
+
import Button from '@/components/Button';
|
|
6
6
|
|
|
7
|
-
import type { StoryObj, StoryFn, Meta } from
|
|
7
|
+
import type { StoryObj, StoryFn, Meta } from '@storybook/react-webpack5';
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
title:
|
|
10
|
+
title: 'Components/Button',
|
|
11
11
|
component: Button,
|
|
12
12
|
args: {
|
|
13
|
-
kind:
|
|
14
|
-
children:
|
|
15
|
-
color:
|
|
13
|
+
kind: 'contained',
|
|
14
|
+
children: 'Text',
|
|
15
|
+
color: 'primary',
|
|
16
16
|
disabled: false,
|
|
17
|
-
size:
|
|
18
|
-
onClick: action(
|
|
17
|
+
size: 'small',
|
|
18
|
+
onClick: action('onClick'),
|
|
19
19
|
},
|
|
20
20
|
argTypes: {
|
|
21
21
|
icon: {
|
|
@@ -23,90 +23,80 @@ export default {
|
|
|
23
23
|
description: `Use this prop when you want to add icon.
|
|
24
24
|
\n It is added to the left of the text criteria`,
|
|
25
25
|
table: {
|
|
26
|
-
defaultValue: { summary:
|
|
27
|
-
type: { summary:
|
|
26
|
+
defaultValue: { summary: 'undefined' },
|
|
27
|
+
type: { summary: 'React.ReactNode' },
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
children: {
|
|
31
|
-
description:
|
|
32
|
-
type:
|
|
31
|
+
description: 'The content of the component.',
|
|
32
|
+
type: 'string',
|
|
33
33
|
},
|
|
34
34
|
kind: {
|
|
35
35
|
control: {
|
|
36
|
-
type:
|
|
36
|
+
type: 'radio',
|
|
37
37
|
},
|
|
38
|
-
options: [
|
|
39
|
-
description:
|
|
38
|
+
options: ['contained', 'outlined', 'ghost'],
|
|
39
|
+
description: 'Button has three Kinds Contained, Outlined, Ghost',
|
|
40
40
|
table: {
|
|
41
|
-
defaultValue: { summary:
|
|
41
|
+
defaultValue: { summary: 'contained' },
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
variant: {
|
|
45
45
|
control: {
|
|
46
|
-
type:
|
|
46
|
+
type: 'radio',
|
|
47
47
|
},
|
|
48
|
-
options: [
|
|
49
|
-
description:
|
|
48
|
+
options: ['contained', 'outlined', 'text', 'ghost'],
|
|
49
|
+
description: 'The variant is alias of kind.',
|
|
50
50
|
table: {
|
|
51
|
-
defaultValue: { summary:
|
|
51
|
+
defaultValue: { summary: 'contained' },
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
color: {
|
|
55
55
|
control: {
|
|
56
|
-
type:
|
|
56
|
+
type: 'radio',
|
|
57
57
|
},
|
|
58
58
|
description: `The color of the component. It supports both default and custom theme colors,
|
|
59
59
|
\nwhich can be added as shown in the palette customization guide.`,
|
|
60
|
-
options: [
|
|
60
|
+
options: ['primary', 'secondary', 'error'],
|
|
61
61
|
table: {
|
|
62
|
-
defaultValue: { summary:
|
|
62
|
+
defaultValue: { summary: 'primary' },
|
|
63
63
|
},
|
|
64
64
|
},
|
|
65
65
|
disabled: {
|
|
66
66
|
control: {
|
|
67
|
-
type:
|
|
67
|
+
type: 'boolean',
|
|
68
68
|
},
|
|
69
|
-
description:
|
|
69
|
+
description: 'If true, the button will be disabled.',
|
|
70
70
|
table: {
|
|
71
|
-
defaultValue: { summary:
|
|
71
|
+
defaultValue: { summary: 'false' },
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
74
|
size: {
|
|
75
75
|
control: {
|
|
76
|
-
type:
|
|
76
|
+
type: 'radio',
|
|
77
77
|
},
|
|
78
|
-
description:
|
|
79
|
-
options: [
|
|
78
|
+
description: 'The size of the button.',
|
|
79
|
+
options: ['small', 'medium', 'large'],
|
|
80
80
|
table: {
|
|
81
|
-
defaultValue: { summary:
|
|
81
|
+
defaultValue: { summary: 'small' },
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
onClick: {
|
|
85
|
-
type:
|
|
85
|
+
type: 'function',
|
|
86
86
|
control: {
|
|
87
|
-
type:
|
|
87
|
+
type: 'radio',
|
|
88
88
|
},
|
|
89
|
-
options: [
|
|
89
|
+
options: ['function', undefined],
|
|
90
90
|
mapping: {
|
|
91
|
-
function: action(
|
|
91
|
+
function: action('onClick'),
|
|
92
92
|
undefined: undefined,
|
|
93
93
|
},
|
|
94
|
-
description:
|
|
95
|
-
"It is a callback function that is called when the button is clicked.",
|
|
94
|
+
description: 'It is a callback function that is called when the button is clicked.',
|
|
96
95
|
},
|
|
97
96
|
},
|
|
98
97
|
parameters: {
|
|
99
98
|
controls: {
|
|
100
|
-
include: [
|
|
101
|
-
"onClick",
|
|
102
|
-
"children",
|
|
103
|
-
"disabled",
|
|
104
|
-
"size",
|
|
105
|
-
"kind",
|
|
106
|
-
"variant",
|
|
107
|
-
"color",
|
|
108
|
-
"icon",
|
|
109
|
-
],
|
|
99
|
+
include: ['onClick', 'children', 'disabled', 'size', 'kind', 'variant', 'color', 'icon'],
|
|
110
100
|
},
|
|
111
101
|
docs: {
|
|
112
102
|
description: {
|
|
@@ -122,17 +112,18 @@ export const BasicButton: StoryObj<typeof Button> = {
|
|
|
122
112
|
};
|
|
123
113
|
|
|
124
114
|
const DisabledButtonTemplate: StoryFn<typeof Button> = (args) => {
|
|
125
|
-
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
116
|
+
const { children, variant, ...restArgs } = args;
|
|
126
117
|
|
|
127
118
|
return (
|
|
128
|
-
<Box sx={{ display:
|
|
119
|
+
<Box sx={{ display: 'flex', gap: 2 }}>
|
|
129
120
|
<Button {...restArgs} disabled kind="contained">
|
|
130
121
|
{children}
|
|
131
122
|
</Button>
|
|
132
123
|
<Button
|
|
133
124
|
{...restArgs}
|
|
134
125
|
disabled
|
|
135
|
-
color={args.color ===
|
|
126
|
+
color={args.color === 'error' ? 'primary' : args.color}
|
|
136
127
|
kind="outlined"
|
|
137
128
|
>
|
|
138
129
|
{children}
|
|
@@ -148,16 +139,17 @@ export const Disabled: StoryObj<typeof Button> = {
|
|
|
148
139
|
render: DisabledButtonTemplate,
|
|
149
140
|
parameters: {
|
|
150
141
|
controls: {
|
|
151
|
-
include: [
|
|
142
|
+
include: ['onClick', 'children', 'size', 'color'],
|
|
152
143
|
},
|
|
153
144
|
},
|
|
154
145
|
};
|
|
155
146
|
|
|
156
147
|
const SizeButtonTemplate: StoryFn<typeof Button> = (args) => {
|
|
157
|
-
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
149
|
+
const { kind, ...restArgs } = args;
|
|
158
150
|
|
|
159
151
|
return (
|
|
160
|
-
<Box sx={{ display:
|
|
152
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
|
|
161
153
|
<Box>
|
|
162
154
|
<Button sx={{ mr: 2 }} {...restArgs} variant="contained" size="small">
|
|
163
155
|
Small
|
|
@@ -170,13 +162,30 @@ const SizeButtonTemplate: StoryFn<typeof Button> = (args) => {
|
|
|
170
162
|
</Button>
|
|
171
163
|
</Box>
|
|
172
164
|
<Box>
|
|
173
|
-
<Button
|
|
165
|
+
<Button
|
|
166
|
+
sx={{ mr: 2 }}
|
|
167
|
+
{...restArgs}
|
|
168
|
+
variant="outlined"
|
|
169
|
+
size="small"
|
|
170
|
+
color={args.color === 'error' ? 'primary' : args.color}
|
|
171
|
+
>
|
|
174
172
|
Small
|
|
175
173
|
</Button>
|
|
176
|
-
<Button
|
|
174
|
+
<Button
|
|
175
|
+
sx={{ mr: 2 }}
|
|
176
|
+
{...restArgs}
|
|
177
|
+
variant="outlined"
|
|
178
|
+
size="medium"
|
|
179
|
+
color={args.color === 'error' ? 'primary' : args.color}
|
|
180
|
+
>
|
|
177
181
|
Medium
|
|
178
182
|
</Button>
|
|
179
|
-
<Button
|
|
183
|
+
<Button
|
|
184
|
+
{...restArgs}
|
|
185
|
+
variant="outlined"
|
|
186
|
+
size="large"
|
|
187
|
+
color={args.color === 'error' ? 'primary' : args.color}
|
|
188
|
+
>
|
|
180
189
|
Large
|
|
181
190
|
</Button>
|
|
182
191
|
</Box>
|
|
@@ -199,7 +208,7 @@ export const Size = {
|
|
|
199
208
|
render: SizeButtonTemplate,
|
|
200
209
|
parameters: {
|
|
201
210
|
controls: {
|
|
202
|
-
include: [
|
|
211
|
+
include: ['onClick', 'disabled', 'icon'],
|
|
203
212
|
},
|
|
204
213
|
},
|
|
205
214
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Canvas, Stories, Controls, Meta, Story } from
|
|
2
|
-
import Box from
|
|
3
|
-
import Bell from
|
|
1
|
+
import { Canvas, Stories, Controls, Meta, Story } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Bell from '@lunit/design-system-icons/Bell';
|
|
4
4
|
|
|
5
|
-
import Button from
|
|
6
|
-
import * as ButtonStories from
|
|
7
|
-
import * as ButtonKindStories from
|
|
8
|
-
import * as ButtonColorStories from
|
|
9
|
-
import * as ButtonIconStories from
|
|
5
|
+
import Button from '@/components/Button';
|
|
6
|
+
import * as ButtonStories from './BasicButton.stories';
|
|
7
|
+
import * as ButtonKindStories from './Kind.stories';
|
|
8
|
+
import * as ButtonColorStories from './Color.stories';
|
|
9
|
+
import * as ButtonIconStories from './IconButton.stories';
|
|
10
10
|
|
|
11
11
|
<Meta name="Button Docs" of={ButtonStories} />
|
|
12
12
|
|
|
@@ -19,9 +19,9 @@ Buttons allow users to take actions, and make choices, with a single tap.
|
|
|
19
19
|
### Basic Button
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
|
-
import { Button } from
|
|
22
|
+
import { Button } from '@lunit/design-system';
|
|
23
23
|
// or
|
|
24
|
-
import Button from
|
|
24
|
+
import Button from '@lunit/design-system/Button';
|
|
25
25
|
|
|
26
26
|
<Button>Button</Button>;
|
|
27
27
|
```
|
|
@@ -39,11 +39,7 @@ In our design system Figma, we use `variant` and `kind` together, They are the *
|
|
|
39
39
|
Using the `variant` or `kind` prop, you can change the variant of the Button.<br />
|
|
40
40
|
Default variant(kind) is `contained`.
|
|
41
41
|
|
|
42
|
-
<Canvas
|
|
43
|
-
of={ButtonKindStories.Kind}
|
|
44
|
-
meta={ButtonKindStories}
|
|
45
|
-
sourceState="none"
|
|
46
|
-
/>
|
|
42
|
+
<Canvas of={ButtonKindStories.Kind} meta={ButtonKindStories} sourceState="none" />
|
|
47
43
|
|
|
48
44
|
```tsx
|
|
49
45
|
<Button variant="contained">Text</Button>
|
|
@@ -64,11 +60,7 @@ Using the `color` prop, you can change the color of the Button.<br />
|
|
|
64
60
|
Outline vairant does not have error color state.<br />
|
|
65
61
|
Default color is `primary`.
|
|
66
62
|
|
|
67
|
-
<Canvas
|
|
68
|
-
of={ButtonColorStories.Color}
|
|
69
|
-
meta={ButtonColorStories}
|
|
70
|
-
sourceState="none"
|
|
71
|
-
/>
|
|
63
|
+
<Canvas of={ButtonColorStories.Color} meta={ButtonColorStories} sourceState="none" />
|
|
72
64
|
|
|
73
65
|
```tsx
|
|
74
66
|
// Contained
|
|
@@ -116,11 +108,7 @@ Default size is `small`.
|
|
|
116
108
|
|
|
117
109
|
If you want to use an icon and text together, you can use the `icon` prop and `children` prop.
|
|
118
110
|
|
|
119
|
-
<Canvas
|
|
120
|
-
of={ButtonIconStories.IconWithTextButton}
|
|
121
|
-
meta={ButtonIconStories}
|
|
122
|
-
sourceState="none"
|
|
123
|
-
/>
|
|
111
|
+
<Canvas of={ButtonIconStories.IconWithTextButton} meta={ButtonIconStories} sourceState="none" />
|
|
124
112
|
|
|
125
113
|
```tsx
|
|
126
114
|
<Button variant="contained" icon={<Bell />}>Contained</Button>
|
|
@@ -132,11 +120,7 @@ If you want to use an icon and text together, you can use the `icon` prop and `c
|
|
|
132
120
|
|
|
133
121
|
If you want to use only an icon, you can use the `icon` prop.
|
|
134
122
|
|
|
135
|
-
<Canvas
|
|
136
|
-
of={ButtonIconStories.IconOnlyButton}
|
|
137
|
-
meta={ButtonIconStories}
|
|
138
|
-
sourceState="none"
|
|
139
|
-
/>
|
|
123
|
+
<Canvas of={ButtonIconStories.IconOnlyButton} meta={ButtonIconStories} sourceState="none" />
|
|
140
124
|
|
|
141
125
|
```tsx
|
|
142
126
|
<Button variant="contained" icon={<Bell />} />
|
|
@@ -149,11 +133,7 @@ If you want to use only an icon, you can use the `icon` prop.
|
|
|
149
133
|
If you want to disable the button, you can use the `disabled` prop.<br />
|
|
150
134
|
Default disabled is `false`.
|
|
151
135
|
|
|
152
|
-
<Canvas
|
|
153
|
-
of={ButtonStories.Disabled}
|
|
154
|
-
meta={ButtonIconStories}
|
|
155
|
-
sourceState="none"
|
|
156
|
-
/>
|
|
136
|
+
<Canvas of={ButtonStories.Disabled} meta={ButtonIconStories} sourceState="none" />
|
|
157
137
|
|
|
158
138
|
```tsx
|
|
159
139
|
<Button variant="contained" disabled>Text</Button>
|
|
@@ -165,14 +145,10 @@ Default disabled is `false`.
|
|
|
165
145
|
|
|
166
146
|
If you want to add an event to the button, you can use the `onClick` prop.
|
|
167
147
|
|
|
168
|
-
<Canvas
|
|
169
|
-
of={ButtonKindStories.Kind}
|
|
170
|
-
meta={ButtonKindStories}
|
|
171
|
-
sourceState="none"
|
|
172
|
-
/>
|
|
148
|
+
<Canvas of={ButtonKindStories.Kind} meta={ButtonKindStories} sourceState="none" />
|
|
173
149
|
|
|
174
150
|
```tsx
|
|
175
|
-
<Button onClick={() => console.log(
|
|
151
|
+
<Button onClick={() => console.log('onClick')}>Text</Button>
|
|
176
152
|
```
|
|
177
153
|
|
|
178
154
|
## Reference
|
|
@@ -1,69 +1,60 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Box } from
|
|
3
|
-
import { action } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { action } from 'storybook/actions';
|
|
4
4
|
|
|
5
|
-
import Button from
|
|
5
|
+
import Button from '@/components/Button';
|
|
6
6
|
|
|
7
|
-
import type { StoryFn, Meta } from
|
|
7
|
+
import type { StoryFn, Meta } from '@storybook/react-webpack5';
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
title:
|
|
10
|
+
title: 'Components/Button',
|
|
11
11
|
component: Button,
|
|
12
12
|
args: {
|
|
13
|
-
children:
|
|
13
|
+
children: 'Text',
|
|
14
14
|
disabled: false,
|
|
15
|
-
size:
|
|
16
|
-
onClick: action(
|
|
15
|
+
size: 'small',
|
|
16
|
+
onClick: action('onClick'),
|
|
17
17
|
},
|
|
18
18
|
argTypes: {
|
|
19
19
|
children: {
|
|
20
|
-
type:
|
|
20
|
+
type: 'string',
|
|
21
21
|
},
|
|
22
22
|
disabled: {
|
|
23
23
|
control: {
|
|
24
|
-
type:
|
|
24
|
+
type: 'boolean',
|
|
25
25
|
},
|
|
26
26
|
table: {
|
|
27
|
-
defaultValue: { summary:
|
|
27
|
+
defaultValue: { summary: 'false' },
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
size: {
|
|
31
31
|
control: {
|
|
32
|
-
type:
|
|
32
|
+
type: 'radio',
|
|
33
33
|
},
|
|
34
|
-
options: [
|
|
34
|
+
options: ['small', 'medium', 'large'],
|
|
35
35
|
table: {
|
|
36
|
-
defaultValue: { summary:
|
|
36
|
+
defaultValue: { summary: 'small' },
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
onClick: {
|
|
40
|
-
type:
|
|
40
|
+
type: 'function',
|
|
41
41
|
control: {
|
|
42
|
-
type:
|
|
42
|
+
type: 'radio',
|
|
43
43
|
},
|
|
44
|
-
options: [
|
|
44
|
+
options: ['function', undefined],
|
|
45
45
|
mapping: {
|
|
46
|
-
function: action(
|
|
46
|
+
function: action('onClick'),
|
|
47
47
|
undefined: undefined,
|
|
48
48
|
},
|
|
49
|
-
description:
|
|
50
|
-
"It is a callback function that is called when the button is clicked.",
|
|
49
|
+
description: 'It is a callback function that is called when the button is clicked.',
|
|
51
50
|
},
|
|
52
51
|
},
|
|
53
52
|
parameters: {
|
|
54
53
|
controls: {
|
|
55
|
-
include: [
|
|
54
|
+
include: ['onClick', 'children', 'size', 'disabled', 'kind', 'variant'],
|
|
56
55
|
},
|
|
57
56
|
pseudo: {
|
|
58
|
-
hover: [
|
|
59
|
-
"#hover1",
|
|
60
|
-
"#hover2",
|
|
61
|
-
"#hover3",
|
|
62
|
-
"#hover4",
|
|
63
|
-
"#hover5",
|
|
64
|
-
"#hover6",
|
|
65
|
-
"#hover7",
|
|
66
|
-
],
|
|
57
|
+
hover: ['#hover1', '#hover2', '#hover3', '#hover4', '#hover5', '#hover6', '#hover7'],
|
|
67
58
|
},
|
|
68
59
|
docs: {
|
|
69
60
|
description: {
|
|
@@ -75,24 +66,15 @@ export default {
|
|
|
75
66
|
} as Meta<typeof Button>;
|
|
76
67
|
|
|
77
68
|
const ColorButtonTemplate: StoryFn<typeof Button> = (args) => {
|
|
78
|
-
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
70
|
+
const { children, kind, ...restArgs } = args;
|
|
79
71
|
return (
|
|
80
|
-
<Box sx={{ display:
|
|
72
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
|
|
81
73
|
<Box>
|
|
82
|
-
<Button
|
|
83
|
-
sx={{ mr: 2 }}
|
|
84
|
-
{...restArgs}
|
|
85
|
-
variant="contained"
|
|
86
|
-
color="primary"
|
|
87
|
-
>
|
|
74
|
+
<Button sx={{ mr: 2 }} {...restArgs} variant="contained" color="primary">
|
|
88
75
|
{children}
|
|
89
76
|
</Button>
|
|
90
|
-
<Button
|
|
91
|
-
sx={{ mr: 2 }}
|
|
92
|
-
{...restArgs}
|
|
93
|
-
variant="contained"
|
|
94
|
-
color="secondary"
|
|
95
|
-
>
|
|
77
|
+
<Button sx={{ mr: 2 }} {...restArgs} variant="contained" color="secondary">
|
|
96
78
|
{children}
|
|
97
79
|
</Button>
|
|
98
80
|
<Button {...restArgs} variant="contained" color="error">
|
|
@@ -103,12 +85,7 @@ const ColorButtonTemplate: StoryFn<typeof Button> = (args) => {
|
|
|
103
85
|
<Button sx={{ mr: 2 }} {...restArgs} variant="outlined" color="primary">
|
|
104
86
|
{children}
|
|
105
87
|
</Button>
|
|
106
|
-
<Button
|
|
107
|
-
sx={{ mr: 2 }}
|
|
108
|
-
{...restArgs}
|
|
109
|
-
variant="outlined"
|
|
110
|
-
color="secondary"
|
|
111
|
-
>
|
|
88
|
+
<Button sx={{ mr: 2 }} {...restArgs} variant="outlined" color="secondary">
|
|
112
89
|
{children}
|
|
113
90
|
</Button>
|
|
114
91
|
</Box>
|