@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,33 +1,25 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { action } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
TableRow,
|
|
7
|
-
TableBody,
|
|
8
|
-
TableCell,
|
|
9
|
-
Box,
|
|
10
|
-
} from "@mui/material";
|
|
11
|
-
import Bell from "@lunit/design-system-icons/Bell";
|
|
12
|
-
import ToggleButton from "@/components/ToggleButton";
|
|
13
|
-
import ToggleButtonGroup from "@/components/ToggleButtonGroup";
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
3
|
+
import { Table, TableHead, TableRow, TableBody, TableCell, Box } from '@mui/material';
|
|
4
|
+
import Bell from '@lunit/design-system-icons/Bell';
|
|
5
|
+
import ToggleButton from '@/components/ToggleButton';
|
|
14
6
|
|
|
15
|
-
import type { StoryFn, Meta } from
|
|
16
|
-
import type { ButtonProps } from
|
|
7
|
+
import type { StoryFn, Meta } from '@storybook/react-webpack5';
|
|
8
|
+
import type { ButtonProps } from '@/components/Button/Button.types';
|
|
17
9
|
|
|
18
|
-
type
|
|
19
|
-
type SizeValues =
|
|
20
|
-
const sizeList: SizeValues[] = [
|
|
10
|
+
type ButtonSizeType = Pick<ButtonProps, 'size'>;
|
|
11
|
+
type SizeValues = ButtonSizeType[keyof ButtonSizeType];
|
|
12
|
+
const sizeList: SizeValues[] = ['small', 'medium', 'large'];
|
|
21
13
|
|
|
22
14
|
export default {
|
|
23
|
-
title:
|
|
15
|
+
title: 'Components/ToggleButton',
|
|
24
16
|
component: ToggleButton,
|
|
25
17
|
args: {
|
|
26
|
-
children:
|
|
27
|
-
kind:
|
|
28
|
-
color:
|
|
29
|
-
selectedColor:
|
|
30
|
-
size:
|
|
18
|
+
children: 'Text',
|
|
19
|
+
kind: 'contained',
|
|
20
|
+
color: 'primary',
|
|
21
|
+
selectedColor: 'primary',
|
|
22
|
+
size: 'small',
|
|
31
23
|
disabled: false,
|
|
32
24
|
},
|
|
33
25
|
argTypes: {
|
|
@@ -36,102 +28,101 @@ export default {
|
|
|
36
28
|
description: `Use this prop when you want to add icon.
|
|
37
29
|
\n It is added to the left of the text criteria`,
|
|
38
30
|
table: {
|
|
39
|
-
defaultValue: { summary:
|
|
40
|
-
type: { summary:
|
|
31
|
+
defaultValue: { summary: 'undefined' },
|
|
32
|
+
type: { summary: 'React.ReactNode' },
|
|
41
33
|
},
|
|
42
34
|
},
|
|
43
35
|
value: {
|
|
44
36
|
control: false,
|
|
45
|
-
table: { type: { summary:
|
|
37
|
+
table: { type: { summary: 'any' } },
|
|
46
38
|
},
|
|
47
39
|
children: {
|
|
48
|
-
type:
|
|
40
|
+
type: 'string',
|
|
49
41
|
},
|
|
50
42
|
selected: {
|
|
51
43
|
control: false,
|
|
52
44
|
table: {
|
|
53
|
-
defaultValue: { summary:
|
|
45
|
+
defaultValue: { summary: 'false' },
|
|
54
46
|
},
|
|
55
47
|
},
|
|
56
48
|
selectedColor: {
|
|
57
49
|
control: {
|
|
58
|
-
type:
|
|
50
|
+
type: 'radio',
|
|
59
51
|
},
|
|
60
|
-
options: [
|
|
52
|
+
options: ['primary', 'secondary'],
|
|
61
53
|
description:
|
|
62
|
-
|
|
54
|
+
'The color of the button when it is in an select state. It has nothing to do with active button',
|
|
63
55
|
table: {
|
|
64
|
-
defaultValue: { summary:
|
|
56
|
+
defaultValue: { summary: 'primary' },
|
|
65
57
|
},
|
|
66
58
|
},
|
|
67
59
|
kind: {
|
|
68
60
|
control: {
|
|
69
|
-
type:
|
|
61
|
+
type: 'radio',
|
|
70
62
|
},
|
|
71
|
-
options: [
|
|
72
|
-
description:
|
|
63
|
+
options: ['contained', 'outlined', 'ghost'],
|
|
64
|
+
description: 'Button has three Kinds Contained, Outlined, Ghost',
|
|
73
65
|
table: {
|
|
74
|
-
defaultValue: { summary:
|
|
66
|
+
defaultValue: { summary: 'contained' },
|
|
75
67
|
},
|
|
76
68
|
},
|
|
77
69
|
color: {
|
|
78
70
|
control: {
|
|
79
|
-
type:
|
|
71
|
+
type: 'radio',
|
|
80
72
|
},
|
|
81
|
-
options: [
|
|
73
|
+
options: ['primary', 'secondary'],
|
|
82
74
|
table: {
|
|
83
|
-
defaultValue: { summary:
|
|
75
|
+
defaultValue: { summary: 'primary' },
|
|
84
76
|
},
|
|
85
77
|
},
|
|
86
78
|
disabled: {
|
|
87
79
|
control: {
|
|
88
|
-
type:
|
|
80
|
+
type: 'boolean',
|
|
89
81
|
},
|
|
90
82
|
table: {
|
|
91
|
-
defaultValue: { summary:
|
|
83
|
+
defaultValue: { summary: 'false' },
|
|
92
84
|
},
|
|
93
85
|
},
|
|
94
86
|
size: {
|
|
95
|
-
options: [
|
|
87
|
+
options: ['small', 'medium', 'large'],
|
|
96
88
|
table: {
|
|
97
|
-
defaultValue: { summary:
|
|
89
|
+
defaultValue: { summary: 'small' },
|
|
98
90
|
},
|
|
99
91
|
},
|
|
100
92
|
onChange: {
|
|
101
|
-
type:
|
|
93
|
+
type: 'function',
|
|
102
94
|
control: false,
|
|
103
|
-
options: [
|
|
95
|
+
options: ['function', undefined],
|
|
104
96
|
mapping: {
|
|
105
|
-
function: action(
|
|
97
|
+
function: action('onChange'),
|
|
106
98
|
undefined: undefined,
|
|
107
99
|
},
|
|
108
100
|
},
|
|
109
101
|
onClick: {
|
|
110
|
-
type:
|
|
102
|
+
type: 'function',
|
|
111
103
|
control: false,
|
|
112
|
-
options: [
|
|
104
|
+
options: ['function', undefined],
|
|
113
105
|
mapping: {
|
|
114
|
-
function: action(
|
|
106
|
+
function: action('onClick'),
|
|
115
107
|
undefined: undefined,
|
|
116
108
|
},
|
|
117
|
-
description:
|
|
118
|
-
"It is a callback function that is called when the button is clicked.",
|
|
109
|
+
description: 'It is a callback function that is called when the button is clicked.',
|
|
119
110
|
},
|
|
120
111
|
},
|
|
121
112
|
parameters: {
|
|
122
113
|
controls: {
|
|
123
114
|
include: [
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
115
|
+
'onChange',
|
|
116
|
+
'onClick',
|
|
117
|
+
'children',
|
|
118
|
+
'disabled',
|
|
119
|
+
'size',
|
|
120
|
+
'kind',
|
|
121
|
+
'color',
|
|
122
|
+
'selectedColor',
|
|
123
|
+
'selected',
|
|
124
|
+
'value',
|
|
125
|
+
'icon',
|
|
135
126
|
],
|
|
136
127
|
},
|
|
137
128
|
docs: {
|
|
@@ -144,18 +135,10 @@ export default {
|
|
|
144
135
|
} as Meta<typeof ToggleButton>;
|
|
145
136
|
|
|
146
137
|
const BasicToggleButtonTemplate: StoryFn<typeof ToggleButton> = (arg) => {
|
|
147
|
-
const [selected, setSelected] = useState(
|
|
148
|
-
useEffect(() => {
|
|
149
|
-
setSelected(Boolean(arg.selected));
|
|
150
|
-
}, [arg.selected]);
|
|
138
|
+
const [selected, setSelected] = useState(Boolean(arg.selected));
|
|
151
139
|
|
|
152
140
|
return (
|
|
153
|
-
<ToggleButton
|
|
154
|
-
{...arg}
|
|
155
|
-
value="test"
|
|
156
|
-
selected={selected}
|
|
157
|
-
onChange={() => setSelected(!selected)}
|
|
158
|
-
>
|
|
141
|
+
<ToggleButton {...arg} value="test" selected={selected} onChange={() => setSelected(!selected)}>
|
|
159
142
|
{arg.children}
|
|
160
143
|
</ToggleButton>
|
|
161
144
|
);
|
|
@@ -163,38 +146,24 @@ const BasicToggleButtonTemplate: StoryFn<typeof ToggleButton> = (arg) => {
|
|
|
163
146
|
|
|
164
147
|
export const BasicToggleButton = {
|
|
165
148
|
render: BasicToggleButtonTemplate,
|
|
166
|
-
name:
|
|
149
|
+
name: 'Basic ToggleButton',
|
|
167
150
|
parameters: {
|
|
168
151
|
chromatic: { disableSnapshot: true },
|
|
169
152
|
},
|
|
170
153
|
};
|
|
171
154
|
|
|
172
155
|
const SizeTemplate: StoryFn<typeof ToggleButton> = (args) => {
|
|
173
|
-
const [
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
large: "",
|
|
177
|
-
});
|
|
156
|
+
const [selectedButtons, setSelectedButtons] = React.useState<{
|
|
157
|
+
[key: string]: boolean;
|
|
158
|
+
}>({});
|
|
178
159
|
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
});
|
|
185
|
-
}
|
|
160
|
+
const handleToggle = (buttonId: string) => {
|
|
161
|
+
setSelectedButtons((prev) => ({
|
|
162
|
+
...prev,
|
|
163
|
+
[buttonId]: !prev[buttonId],
|
|
164
|
+
}));
|
|
186
165
|
};
|
|
187
166
|
|
|
188
|
-
const group = sizeList.map((size) => {
|
|
189
|
-
if (size) {
|
|
190
|
-
return {
|
|
191
|
-
size: size,
|
|
192
|
-
handler: (_: React.MouseEvent<HTMLElement>, value: string | null) =>
|
|
193
|
-
handleChange(value, size),
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
167
|
return (
|
|
199
168
|
<Table sx={{ width: 900 }}>
|
|
200
169
|
<TableHead>
|
|
@@ -202,68 +171,52 @@ const SizeTemplate: StoryFn<typeof ToggleButton> = (args) => {
|
|
|
202
171
|
<TableCell
|
|
203
172
|
colSpan={3}
|
|
204
173
|
sx={{
|
|
205
|
-
typography:
|
|
206
|
-
color:
|
|
174
|
+
typography: 'body1_16_semibold',
|
|
175
|
+
color: 'inherit',
|
|
207
176
|
}}
|
|
208
177
|
>
|
|
209
178
|
Size
|
|
210
179
|
</TableCell>
|
|
211
180
|
</TableRow>
|
|
212
181
|
<TableRow>
|
|
213
|
-
<TableCell sx={{ typography:
|
|
214
|
-
|
|
215
|
-
</TableCell>
|
|
216
|
-
<TableCell sx={{ typography: "body2_14_medium", color: "inherit" }}>
|
|
217
|
-
Medium
|
|
218
|
-
</TableCell>
|
|
219
|
-
<TableCell sx={{ typography: "body2_14_medium", color: "inherit" }}>
|
|
220
|
-
Large
|
|
221
|
-
</TableCell>
|
|
182
|
+
<TableCell sx={{ typography: 'body2_14_medium', color: 'inherit' }}>Small</TableCell>
|
|
183
|
+
<TableCell sx={{ typography: 'body2_14_medium', color: 'inherit' }}>Medium</TableCell>
|
|
184
|
+
<TableCell sx={{ typography: 'body2_14_medium', color: 'inherit' }}>Large</TableCell>
|
|
222
185
|
</TableRow>
|
|
223
186
|
</TableHead>
|
|
224
187
|
<TableBody>
|
|
225
188
|
<TableRow>
|
|
226
|
-
{
|
|
227
|
-
if (
|
|
228
|
-
const { size, handler } = item;
|
|
189
|
+
{sizeList.map((size) => {
|
|
190
|
+
if (size) {
|
|
229
191
|
return (
|
|
230
|
-
<TableCell
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
value={
|
|
236
|
-
|
|
237
|
-
onChange={
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}}
|
|
192
|
+
<TableCell key={size} sx={{ '& button': { marginRight: '10px' } }}>
|
|
193
|
+
<ToggleButton
|
|
194
|
+
{...args}
|
|
195
|
+
icon={<Bell />}
|
|
196
|
+
size={size}
|
|
197
|
+
value={`${size}-1`}
|
|
198
|
+
selected={selectedButtons[`${size}-1`]}
|
|
199
|
+
onChange={() => handleToggle(`${size}-1`)}
|
|
200
|
+
/>
|
|
201
|
+
<ToggleButton
|
|
202
|
+
{...args}
|
|
203
|
+
size={size}
|
|
204
|
+
value={`${size}-2`}
|
|
205
|
+
selected={selectedButtons[`${size}-2`]}
|
|
206
|
+
onChange={() => handleToggle(`${size}-2`)}
|
|
207
|
+
>
|
|
208
|
+
{args.children}
|
|
209
|
+
</ToggleButton>
|
|
210
|
+
<ToggleButton
|
|
211
|
+
{...args}
|
|
212
|
+
icon={<Bell />}
|
|
213
|
+
size={size}
|
|
214
|
+
value={`${size}-3`}
|
|
215
|
+
selected={selectedButtons[`${size}-3`]}
|
|
216
|
+
onChange={() => handleToggle(`${size}-3`)}
|
|
244
217
|
>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
icon={<Bell />}
|
|
248
|
-
size={size}
|
|
249
|
-
value={String(size) + 1}
|
|
250
|
-
/>
|
|
251
|
-
<ToggleButton
|
|
252
|
-
{...args}
|
|
253
|
-
size={size}
|
|
254
|
-
value={String(size) + 2}
|
|
255
|
-
>
|
|
256
|
-
{args.children}
|
|
257
|
-
</ToggleButton>
|
|
258
|
-
<ToggleButton
|
|
259
|
-
{...args}
|
|
260
|
-
icon={<Bell />}
|
|
261
|
-
size={size}
|
|
262
|
-
value={String(size) + 3}
|
|
263
|
-
>
|
|
264
|
-
{args.children}
|
|
265
|
-
</ToggleButton>
|
|
266
|
-
</ToggleButtonGroup>
|
|
218
|
+
{args.children}
|
|
219
|
+
</ToggleButton>
|
|
267
220
|
</TableCell>
|
|
268
221
|
);
|
|
269
222
|
}
|
|
@@ -285,104 +238,139 @@ export const Size = {
|
|
|
285
238
|
};
|
|
286
239
|
|
|
287
240
|
const SizeDocsTemplate: StoryFn<typeof ToggleButton> = (args) => {
|
|
288
|
-
const [
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
large: "",
|
|
292
|
-
});
|
|
241
|
+
const [selectedButtons, setSelectedButtons] = React.useState<{
|
|
242
|
+
[key: string]: boolean;
|
|
243
|
+
}>({});
|
|
293
244
|
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
[size]: value,
|
|
300
|
-
});
|
|
245
|
+
const handleToggle = (buttonId: string) => {
|
|
246
|
+
setSelectedButtons((prev) => ({
|
|
247
|
+
...prev,
|
|
248
|
+
[buttonId]: !prev[buttonId],
|
|
249
|
+
}));
|
|
301
250
|
};
|
|
302
251
|
|
|
303
252
|
return (
|
|
304
253
|
<Box
|
|
305
254
|
sx={{
|
|
306
|
-
display:
|
|
307
|
-
flexDirection:
|
|
255
|
+
display: 'flex',
|
|
256
|
+
flexDirection: 'column',
|
|
308
257
|
gap: 4,
|
|
309
|
-
|
|
258
|
+
'& button': {
|
|
310
259
|
marginRight: 2,
|
|
311
260
|
},
|
|
312
261
|
}}
|
|
313
262
|
>
|
|
314
|
-
<
|
|
263
|
+
<Box
|
|
315
264
|
sx={{
|
|
316
|
-
display:
|
|
317
|
-
alignItems:
|
|
265
|
+
display: 'flex',
|
|
266
|
+
alignItems: 'center',
|
|
318
267
|
}}
|
|
319
|
-
value={values.small}
|
|
320
|
-
onChange={(_, value) => handleChange(value, "small")}
|
|
321
268
|
>
|
|
322
|
-
<ToggleButton
|
|
269
|
+
<ToggleButton
|
|
270
|
+
{...args}
|
|
271
|
+
value="contained-small"
|
|
272
|
+
size="small"
|
|
273
|
+
selected={selectedButtons['contained-small']}
|
|
274
|
+
onChange={() => handleToggle('contained-small')}
|
|
275
|
+
>
|
|
323
276
|
Small
|
|
324
277
|
</ToggleButton>
|
|
325
|
-
<ToggleButton
|
|
278
|
+
<ToggleButton
|
|
279
|
+
{...args}
|
|
280
|
+
value="contained-medium"
|
|
281
|
+
size="medium"
|
|
282
|
+
selected={selectedButtons['contained-medium']}
|
|
283
|
+
onChange={() => handleToggle('contained-medium')}
|
|
284
|
+
>
|
|
326
285
|
Medium
|
|
327
286
|
</ToggleButton>
|
|
328
|
-
<ToggleButton
|
|
287
|
+
<ToggleButton
|
|
288
|
+
{...args}
|
|
289
|
+
value="contained-large"
|
|
290
|
+
size="large"
|
|
291
|
+
selected={selectedButtons['contained-large']}
|
|
292
|
+
onChange={() => handleToggle('contained-large')}
|
|
293
|
+
>
|
|
329
294
|
Large
|
|
330
295
|
</ToggleButton>
|
|
331
|
-
</
|
|
332
|
-
<
|
|
296
|
+
</Box>
|
|
297
|
+
<Box
|
|
333
298
|
sx={{
|
|
334
|
-
display:
|
|
335
|
-
alignItems:
|
|
299
|
+
display: 'flex',
|
|
300
|
+
alignItems: 'center',
|
|
336
301
|
}}
|
|
337
|
-
value={values.medium}
|
|
338
|
-
onChange={(_, value) => handleChange(value, "medium")}
|
|
339
302
|
>
|
|
340
303
|
<ToggleButton
|
|
341
304
|
{...args}
|
|
342
|
-
value="small"
|
|
305
|
+
value="outlined-small"
|
|
343
306
|
kind="outlined"
|
|
344
307
|
color="primary"
|
|
345
308
|
size="small"
|
|
309
|
+
selected={selectedButtons['outlined-small']}
|
|
310
|
+
onChange={() => handleToggle('outlined-small')}
|
|
346
311
|
>
|
|
347
312
|
Small
|
|
348
313
|
</ToggleButton>
|
|
349
314
|
<ToggleButton
|
|
350
315
|
{...args}
|
|
351
|
-
value="medium"
|
|
316
|
+
value="outlined-medium"
|
|
352
317
|
kind="outlined"
|
|
353
318
|
color="primary"
|
|
354
319
|
size="medium"
|
|
320
|
+
selected={selectedButtons['outlined-medium']}
|
|
321
|
+
onChange={() => handleToggle('outlined-medium')}
|
|
355
322
|
>
|
|
356
323
|
Medium
|
|
357
324
|
</ToggleButton>
|
|
358
325
|
<ToggleButton
|
|
359
326
|
{...args}
|
|
360
|
-
value="large"
|
|
327
|
+
value="outlined-large"
|
|
361
328
|
kind="outlined"
|
|
362
329
|
color="primary"
|
|
363
330
|
size="large"
|
|
331
|
+
selected={selectedButtons['outlined-large']}
|
|
332
|
+
onChange={() => handleToggle('outlined-large')}
|
|
364
333
|
>
|
|
365
334
|
Large
|
|
366
335
|
</ToggleButton>
|
|
367
|
-
</
|
|
368
|
-
<
|
|
336
|
+
</Box>
|
|
337
|
+
<Box
|
|
369
338
|
sx={{
|
|
370
|
-
display:
|
|
371
|
-
alignItems:
|
|
339
|
+
display: 'flex',
|
|
340
|
+
alignItems: 'center',
|
|
372
341
|
}}
|
|
373
|
-
value={values.large}
|
|
374
|
-
onChange={(_, value) => handleChange(value, "large")}
|
|
375
342
|
>
|
|
376
|
-
<ToggleButton
|
|
343
|
+
<ToggleButton
|
|
344
|
+
{...args}
|
|
345
|
+
value="ghost-small"
|
|
346
|
+
kind="ghost"
|
|
347
|
+
size="small"
|
|
348
|
+
selected={selectedButtons['ghost-small']}
|
|
349
|
+
onChange={() => handleToggle('ghost-small')}
|
|
350
|
+
>
|
|
377
351
|
Small
|
|
378
352
|
</ToggleButton>
|
|
379
|
-
<ToggleButton
|
|
353
|
+
<ToggleButton
|
|
354
|
+
{...args}
|
|
355
|
+
value="ghost-medium"
|
|
356
|
+
kind="ghost"
|
|
357
|
+
size="medium"
|
|
358
|
+
selected={selectedButtons['ghost-medium']}
|
|
359
|
+
onChange={() => handleToggle('ghost-medium')}
|
|
360
|
+
>
|
|
380
361
|
Medium
|
|
381
362
|
</ToggleButton>
|
|
382
|
-
<ToggleButton
|
|
363
|
+
<ToggleButton
|
|
364
|
+
{...args}
|
|
365
|
+
value="ghost-large"
|
|
366
|
+
kind="ghost"
|
|
367
|
+
size="large"
|
|
368
|
+
selected={selectedButtons['ghost-large']}
|
|
369
|
+
onChange={() => handleToggle('ghost-large')}
|
|
370
|
+
>
|
|
383
371
|
Large
|
|
384
372
|
</ToggleButton>
|
|
385
|
-
</
|
|
373
|
+
</Box>
|
|
386
374
|
</Box>
|
|
387
375
|
);
|
|
388
376
|
};
|
|
@@ -400,71 +388,97 @@ export const SizeDocs = {
|
|
|
400
388
|
};
|
|
401
389
|
|
|
402
390
|
const ColorTemplate: StoryFn<typeof ToggleButton> = (args) => {
|
|
403
|
-
const [
|
|
404
|
-
|
|
405
|
-
|
|
391
|
+
const [selectedButtons, setSelectedButtons] = React.useState<{
|
|
392
|
+
[key: string]: boolean;
|
|
393
|
+
}>({});
|
|
394
|
+
|
|
395
|
+
const handleToggle = (buttonId: string) => {
|
|
396
|
+
setSelectedButtons((prev) => ({
|
|
397
|
+
...prev,
|
|
398
|
+
[buttonId]: !prev[buttonId],
|
|
399
|
+
}));
|
|
400
|
+
};
|
|
406
401
|
|
|
407
402
|
return (
|
|
408
|
-
<Box sx={{ display:
|
|
409
|
-
<
|
|
403
|
+
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
|
|
404
|
+
<Box
|
|
410
405
|
sx={{
|
|
411
|
-
|
|
406
|
+
'& button': {
|
|
412
407
|
marginRight: 2,
|
|
413
408
|
},
|
|
414
409
|
}}
|
|
415
|
-
value={contained}
|
|
416
|
-
onChange={(_, value) => setContained(value)}
|
|
417
410
|
>
|
|
418
|
-
<ToggleButton
|
|
411
|
+
<ToggleButton
|
|
412
|
+
{...args}
|
|
413
|
+
value="contained-primary"
|
|
414
|
+
kind="contained"
|
|
415
|
+
color="primary"
|
|
416
|
+
selected={selectedButtons['contained-primary']}
|
|
417
|
+
onChange={() => handleToggle('contained-primary')}
|
|
418
|
+
>
|
|
419
419
|
Primary
|
|
420
420
|
</ToggleButton>
|
|
421
421
|
<ToggleButton
|
|
422
422
|
{...args}
|
|
423
|
-
value="
|
|
423
|
+
value="contained-secondary"
|
|
424
424
|
kind="contained"
|
|
425
425
|
color="secondary"
|
|
426
426
|
selectedColor="secondary"
|
|
427
|
+
selected={selectedButtons['contained-secondary']}
|
|
428
|
+
onChange={() => handleToggle('contained-secondary')}
|
|
427
429
|
>
|
|
428
430
|
Secondary
|
|
429
431
|
</ToggleButton>
|
|
430
|
-
</
|
|
431
|
-
<
|
|
432
|
+
</Box>
|
|
433
|
+
<Box
|
|
432
434
|
sx={{
|
|
433
435
|
marginTop: 4,
|
|
434
|
-
|
|
436
|
+
'& button': {
|
|
435
437
|
marginRight: 2,
|
|
436
438
|
},
|
|
437
439
|
}}
|
|
438
|
-
value={outlined}
|
|
439
|
-
onChange={(_, value) => setOutlined(value)}
|
|
440
440
|
>
|
|
441
|
-
<ToggleButton
|
|
441
|
+
<ToggleButton
|
|
442
|
+
{...args}
|
|
443
|
+
value="outlined-primary"
|
|
444
|
+
kind="outlined"
|
|
445
|
+
color="primary"
|
|
446
|
+
selected={selectedButtons['outlined-primary']}
|
|
447
|
+
onChange={() => handleToggle('outlined-primary')}
|
|
448
|
+
>
|
|
442
449
|
Primary
|
|
443
450
|
</ToggleButton>
|
|
444
|
-
</
|
|
445
|
-
<
|
|
451
|
+
</Box>
|
|
452
|
+
<Box
|
|
446
453
|
sx={{
|
|
447
454
|
marginTop: 4,
|
|
448
|
-
|
|
455
|
+
'& button': {
|
|
449
456
|
marginRight: 2,
|
|
450
457
|
},
|
|
451
458
|
}}
|
|
452
|
-
value={ghost}
|
|
453
|
-
onChange={(_, value) => setGhost(value)}
|
|
454
459
|
>
|
|
455
|
-
<ToggleButton
|
|
460
|
+
<ToggleButton
|
|
461
|
+
{...args}
|
|
462
|
+
value="ghost-primary"
|
|
463
|
+
kind="ghost"
|
|
464
|
+
color="primary"
|
|
465
|
+
selected={selectedButtons['ghost-primary']}
|
|
466
|
+
onChange={() => handleToggle('ghost-primary')}
|
|
467
|
+
>
|
|
456
468
|
Primary
|
|
457
469
|
</ToggleButton>
|
|
458
470
|
<ToggleButton
|
|
459
471
|
{...args}
|
|
460
|
-
value="
|
|
472
|
+
value="ghost-secondary"
|
|
461
473
|
kind="ghost"
|
|
462
474
|
color="secondary"
|
|
463
475
|
selectedColor="secondary"
|
|
476
|
+
selected={selectedButtons['ghost-secondary']}
|
|
477
|
+
onChange={() => handleToggle('ghost-secondary')}
|
|
464
478
|
>
|
|
465
479
|
Secondary
|
|
466
480
|
</ToggleButton>
|
|
467
|
-
</
|
|
481
|
+
</Box>
|
|
468
482
|
</Box>
|
|
469
483
|
);
|
|
470
484
|
};
|
|
@@ -489,22 +503,16 @@ const SelectedColorTemplate: StoryFn<typeof ToggleButton> = (arg) => {
|
|
|
489
503
|
<Table sx={{ width: 330 }}>
|
|
490
504
|
<TableHead>
|
|
491
505
|
<TableRow>
|
|
492
|
-
<TableCell sx={{ typography:
|
|
506
|
+
<TableCell sx={{ typography: 'body2_14_medium', color: 'inherit' }}>
|
|
493
507
|
Selected color
|
|
494
508
|
</TableCell>
|
|
495
|
-
<TableCell sx={{ typography:
|
|
496
|
-
|
|
497
|
-
</TableCell>
|
|
498
|
-
<TableCell sx={{ typography: "body2_14_medium", color: "inherit" }}>
|
|
499
|
-
Secondary
|
|
500
|
-
</TableCell>
|
|
509
|
+
<TableCell sx={{ typography: 'body2_14_medium', color: 'inherit' }}>Primary</TableCell>
|
|
510
|
+
<TableCell sx={{ typography: 'body2_14_medium', color: 'inherit' }}>Secondary</TableCell>
|
|
501
511
|
</TableRow>
|
|
502
512
|
</TableHead>
|
|
503
513
|
<TableBody>
|
|
504
514
|
<TableRow>
|
|
505
|
-
<TableCell sx={{ typography:
|
|
506
|
-
Selected
|
|
507
|
-
</TableCell>
|
|
515
|
+
<TableCell sx={{ typography: 'body2_14_medium', color: 'inherit' }}>Selected</TableCell>
|
|
508
516
|
<TableCell>
|
|
509
517
|
<ToggleButton
|
|
510
518
|
{...arg}
|
|
@@ -547,11 +555,11 @@ export const SelectedColor = {
|
|
|
547
555
|
};
|
|
548
556
|
|
|
549
557
|
const SelectedColorDocsTemplate: StoryFn<typeof ToggleButton> = (args) => {
|
|
550
|
-
const {
|
|
558
|
+
const { ...restProps } = args;
|
|
551
559
|
return (
|
|
552
560
|
<Box
|
|
553
561
|
sx={{
|
|
554
|
-
|
|
562
|
+
'& button': {
|
|
555
563
|
marginRight: 2,
|
|
556
564
|
},
|
|
557
565
|
}}
|
|
@@ -582,11 +590,11 @@ export const SelectedColorDocs = {
|
|
|
582
590
|
};
|
|
583
591
|
|
|
584
592
|
const SelectedDocsTemplate: StoryFn<typeof ToggleButton> = (args) => {
|
|
585
|
-
const {
|
|
593
|
+
const { ...restProps } = args;
|
|
586
594
|
return (
|
|
587
595
|
<Box
|
|
588
596
|
sx={{
|
|
589
|
-
|
|
597
|
+
'& button': {
|
|
590
598
|
marginRight: 2,
|
|
591
599
|
},
|
|
592
600
|
}}
|
|
@@ -610,7 +618,7 @@ export const SelectedDocs = {
|
|
|
610
618
|
},
|
|
611
619
|
parameters: {
|
|
612
620
|
chromatic: { disableSnapshot: true },
|
|
613
|
-
include: [
|
|
621
|
+
include: ['color', 'size', 'disabled', 'selected', 'kind'],
|
|
614
622
|
},
|
|
615
623
|
};
|
|
616
624
|
|
|
@@ -618,7 +626,7 @@ const DisabledTemplate: StoryFn<typeof ToggleButton> = (args) => {
|
|
|
618
626
|
return (
|
|
619
627
|
<Box
|
|
620
628
|
sx={{
|
|
621
|
-
|
|
629
|
+
'& button': {
|
|
622
630
|
marginRight: 2,
|
|
623
631
|
},
|
|
624
632
|
}}
|
|
@@ -626,13 +634,7 @@ const DisabledTemplate: StoryFn<typeof ToggleButton> = (args) => {
|
|
|
626
634
|
<ToggleButton {...args} value="first" disabled>
|
|
627
635
|
Text
|
|
628
636
|
</ToggleButton>
|
|
629
|
-
<ToggleButton
|
|
630
|
-
{...args}
|
|
631
|
-
kind="outlined"
|
|
632
|
-
color="primary"
|
|
633
|
-
value="second"
|
|
634
|
-
disabled
|
|
635
|
-
>
|
|
637
|
+
<ToggleButton {...args} kind="outlined" color="primary" value="second" disabled>
|
|
636
638
|
Text
|
|
637
639
|
</ToggleButton>
|
|
638
640
|
<ToggleButton {...args} kind="ghost" value="second" disabled>
|