@lunit/design-system 2.2.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.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 +226 -227
- 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 -7
- 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 +3 -4
- 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 -3
- 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 +9 -11
- 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 +17 -25
- 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 +5 -6
- 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 +6 -9
- 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 +6 -6
- package/src/stories/components/Alert/Alert.stories.tsx +38 -45
- 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 -135
- 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 -53
- package/src/stories/components/TextField/TextFieldDocs.mdx +8 -12
- package/src/stories/components/TextField/TextFieldMulti.stories.tsx +39 -55
- package/src/stories/components/TextField/TextFieldSingle.stories.tsx +74 -118
- package/src/stories/components/TextField/TextFieldSize.stories.tsx +35 -55
- package/src/stories/components/Toast/Toast.stories.tsx +35 -50
- package/src/stories/components/ToggleButton/Basic.stories.tsx +115 -152
- package/src/stories/components/ToggleButton/ToggleButtonDocs.mdx +10 -14
- package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +141 -200
- 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 -54
- 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
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, { useState
|
|
2
|
-
import { Box, FormControlLabel } from
|
|
3
|
-
import { action } from
|
|
4
|
-
import Checkbox from
|
|
5
|
-
import FormLabel from
|
|
6
|
-
import { Meta, StoryFn } from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Box, FormControlLabel } from '@mui/material';
|
|
3
|
+
import { action } from 'storybook/actions';
|
|
4
|
+
import Checkbox from '@/components/Checkbox';
|
|
5
|
+
import FormLabel from '@/components/FormLabel';
|
|
6
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
|
-
title:
|
|
9
|
+
title: 'Components/Checkbox',
|
|
10
10
|
component: Checkbox,
|
|
11
11
|
args: {
|
|
12
12
|
checked: false,
|
|
@@ -15,83 +15,73 @@ export default {
|
|
|
15
15
|
},
|
|
16
16
|
argTypes: {
|
|
17
17
|
disabled: {
|
|
18
|
-
control:
|
|
19
|
-
table: { type: { summary:
|
|
20
|
-
description:
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
table: { type: { summary: 'bool' }, defaultValue: { summary: 'false' } },
|
|
20
|
+
description: 'If true, the component is disabled.',
|
|
21
21
|
},
|
|
22
22
|
indeterminate: {
|
|
23
|
-
control:
|
|
24
|
-
table: { type: { summary:
|
|
25
|
-
description:
|
|
23
|
+
control: 'boolean',
|
|
24
|
+
table: { type: { summary: 'bool' }, defaultValue: { summary: 'false' } },
|
|
25
|
+
description: 'If true, the component appears indeterminate.',
|
|
26
26
|
},
|
|
27
27
|
onChange: {
|
|
28
|
-
type:
|
|
28
|
+
type: 'function',
|
|
29
29
|
control: {
|
|
30
|
-
type:
|
|
30
|
+
type: 'radio',
|
|
31
31
|
},
|
|
32
|
-
options: [
|
|
32
|
+
options: ['function', undefined],
|
|
33
33
|
mapping: {
|
|
34
|
-
function: action(
|
|
34
|
+
function: action('onChange'),
|
|
35
35
|
undefined: undefined,
|
|
36
36
|
},
|
|
37
|
-
defaultValue:
|
|
38
|
-
table: { type: { summary:
|
|
37
|
+
defaultValue: 'function',
|
|
38
|
+
table: { type: { summary: 'func' } },
|
|
39
39
|
description:
|
|
40
|
-
|
|
40
|
+
'Callback fired when the state is changed. Signature: `function(event: React.ChangeEvent<HTMLInputElement>) => void`',
|
|
41
41
|
},
|
|
42
42
|
required: {
|
|
43
|
-
control:
|
|
44
|
-
table: { type: { summary:
|
|
45
|
-
description:
|
|
43
|
+
control: 'boolean',
|
|
44
|
+
table: { type: { summary: 'bool' }, defaultValue: { summary: 'false' } },
|
|
45
|
+
description: 'If true, the input element is required.',
|
|
46
46
|
},
|
|
47
47
|
checked: {
|
|
48
48
|
table: {
|
|
49
|
-
type: { summary:
|
|
50
|
-
defaultValue: { summary:
|
|
49
|
+
type: { summary: 'bool' },
|
|
50
|
+
defaultValue: { summary: 'false' },
|
|
51
51
|
},
|
|
52
|
-
description:
|
|
52
|
+
description: 'If true, the component is checked.',
|
|
53
53
|
},
|
|
54
54
|
defaultChecked: {
|
|
55
|
-
control:
|
|
56
|
-
table: { type: { summary:
|
|
57
|
-
description:
|
|
58
|
-
"The default checked state. Use when the component is not controlled.",
|
|
55
|
+
control: 'boolean',
|
|
56
|
+
table: { type: { summary: 'bool' }, defaultValue: { summary: 'false' } },
|
|
57
|
+
description: 'The default checked state. Use when the component is not controlled.',
|
|
59
58
|
},
|
|
60
59
|
},
|
|
61
60
|
parameters: {
|
|
62
61
|
controls: {
|
|
63
62
|
expanded: true,
|
|
64
|
-
include: [
|
|
65
|
-
"disabled",
|
|
66
|
-
"indeterminate",
|
|
67
|
-
"onChange",
|
|
68
|
-
"required",
|
|
69
|
-
"checked",
|
|
70
|
-
"defaultChecked",
|
|
71
|
-
],
|
|
63
|
+
include: ['disabled', 'indeterminate', 'onChange', 'required', 'checked', 'defaultChecked'],
|
|
72
64
|
},
|
|
73
65
|
docs: {
|
|
74
66
|
description: {
|
|
75
67
|
component:
|
|
76
|
-
|
|
68
|
+
'This component base is Material UI Checkbox component. [Props of the Material UI Checkbox component](material-u) are also available.',
|
|
77
69
|
},
|
|
78
70
|
},
|
|
79
71
|
},
|
|
80
72
|
} as Meta<typeof Checkbox>;
|
|
81
73
|
|
|
82
74
|
const BasicCheckboxTemplate: StoryFn<typeof Checkbox> = (args) => {
|
|
83
|
-
const [checked, setChecked] = useState(
|
|
84
|
-
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
setChecked(Boolean(args.checked));
|
|
87
|
-
}, [args.checked]);
|
|
75
|
+
const [checked, setChecked] = useState(Boolean(args.checked));
|
|
88
76
|
|
|
89
77
|
return (
|
|
90
78
|
<Checkbox
|
|
91
79
|
{...args}
|
|
92
80
|
checked={checked}
|
|
93
81
|
onChange={(event) => {
|
|
94
|
-
|
|
82
|
+
if (args.onChange) {
|
|
83
|
+
args.onChange(event, checked);
|
|
84
|
+
}
|
|
95
85
|
setChecked((prev) => !prev);
|
|
96
86
|
}}
|
|
97
87
|
/>
|
|
@@ -103,41 +93,31 @@ export const BasicCheckbox = {
|
|
|
103
93
|
};
|
|
104
94
|
|
|
105
95
|
const LabelTemplate: StoryFn<typeof Checkbox> = (args) => {
|
|
106
|
-
const [checked1, setChecked1] = useState(
|
|
107
|
-
const [checked2, setChecked2] = useState(
|
|
108
|
-
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
setChecked1(Boolean(args.checked));
|
|
111
|
-
setChecked2(Boolean(args.checked));
|
|
112
|
-
}, [args.checked]);
|
|
96
|
+
const [checked1, setChecked1] = useState(Boolean(args.checked));
|
|
97
|
+
const [checked2, setChecked2] = useState(Boolean(args.checked));
|
|
113
98
|
|
|
114
99
|
const handleChange1 = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
115
|
-
|
|
100
|
+
if (args.onChange) {
|
|
101
|
+
args.onChange(event, checked1);
|
|
102
|
+
}
|
|
116
103
|
setChecked1((prev) => !prev);
|
|
117
104
|
};
|
|
118
105
|
|
|
119
106
|
const handleChange2 = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
120
|
-
|
|
107
|
+
if (args.onChange) {
|
|
108
|
+
args.onChange(event, checked2);
|
|
109
|
+
}
|
|
121
110
|
setChecked2((prev) => !prev);
|
|
122
111
|
};
|
|
123
112
|
|
|
124
113
|
return (
|
|
125
|
-
<Box sx={{ display:
|
|
114
|
+
<Box sx={{ display: 'flex', gap: 4 }}>
|
|
126
115
|
<FormControlLabel
|
|
127
|
-
control={
|
|
128
|
-
<Checkbox {...args} checked={checked1} onChange={handleChange1} />
|
|
129
|
-
}
|
|
116
|
+
control={<Checkbox {...args} checked={checked1} onChange={handleChange1} />}
|
|
130
117
|
label="Label"
|
|
131
118
|
/>
|
|
132
119
|
<FormControlLabel
|
|
133
|
-
control={
|
|
134
|
-
<Checkbox
|
|
135
|
-
{...args}
|
|
136
|
-
disabled
|
|
137
|
-
checked={checked2}
|
|
138
|
-
onChange={handleChange2}
|
|
139
|
-
/>
|
|
140
|
-
}
|
|
120
|
+
control={<Checkbox {...args} disabled checked={checked2} onChange={handleChange2} />}
|
|
141
121
|
label="Disabled Label"
|
|
142
122
|
/>
|
|
143
123
|
</Box>
|
|
@@ -149,7 +129,7 @@ export const Label = {
|
|
|
149
129
|
parameters: {
|
|
150
130
|
docs: {
|
|
151
131
|
description: {
|
|
152
|
-
story:
|
|
132
|
+
story: 'You can use the `FormControlLabel` component to provide label.',
|
|
153
133
|
},
|
|
154
134
|
},
|
|
155
135
|
},
|
|
@@ -159,6 +139,7 @@ const IndeterminateTemplate: StoryFn<typeof Checkbox> = (args) => {
|
|
|
159
139
|
const [checked, setChecked] = React.useState([true, false]);
|
|
160
140
|
const { disabled } = args;
|
|
161
141
|
|
|
142
|
+
// useCallback 사용하기
|
|
162
143
|
const handleChange1 = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
163
144
|
setChecked([event.target.checked, event.target.checked]);
|
|
164
145
|
};
|
|
@@ -172,7 +153,7 @@ const IndeterminateTemplate: StoryFn<typeof Checkbox> = (args) => {
|
|
|
172
153
|
};
|
|
173
154
|
|
|
174
155
|
const children = (
|
|
175
|
-
<Box sx={{ display:
|
|
156
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', ml: 3 }}>
|
|
176
157
|
<FormLabel
|
|
177
158
|
label="Child 1"
|
|
178
159
|
control={<Checkbox checked={checked[0]} onChange={handleChange2} />}
|
|
@@ -207,7 +188,7 @@ export const Indeterminate = {
|
|
|
207
188
|
parameters: {
|
|
208
189
|
docs: {
|
|
209
190
|
description: {
|
|
210
|
-
story:
|
|
191
|
+
story: 'You can use the `FormControlLabel` component to provide label.',
|
|
211
192
|
},
|
|
212
193
|
},
|
|
213
194
|
},
|
|
@@ -215,7 +196,7 @@ export const Indeterminate = {
|
|
|
215
196
|
|
|
216
197
|
const DisabledTemplate: StoryFn<typeof Checkbox> = (args) => {
|
|
217
198
|
return (
|
|
218
|
-
<Box sx={{ display:
|
|
199
|
+
<Box sx={{ display: 'flex', gap: 4 }}>
|
|
219
200
|
<Checkbox {...args} disabled checked />
|
|
220
201
|
<Checkbox {...args} indeterminate disabled />
|
|
221
202
|
<Checkbox {...args} disabled />
|
|
@@ -228,7 +209,7 @@ export const Disabled = {
|
|
|
228
209
|
parameters: {
|
|
229
210
|
docs: {
|
|
230
211
|
description: {
|
|
231
|
-
story:
|
|
212
|
+
story: 'You can use the `FormControlLabel` component to provide label.',
|
|
232
213
|
},
|
|
233
214
|
},
|
|
234
215
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
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 * as BasicCheckbox from
|
|
5
|
+
import * as BasicCheckbox from './BasicCheckbox.stories';
|
|
6
6
|
|
|
7
7
|
<Meta name="Checkbox Docs" of={BasicCheckbox} />
|
|
8
8
|
|
|
@@ -15,9 +15,9 @@ Checkboxes allow the user to select one or more items from a set.
|
|
|
15
15
|
### Basic Checkbox
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
|
-
import { Checkbox } from
|
|
18
|
+
import { Checkbox } from '@lunit/design-system';
|
|
19
19
|
// or
|
|
20
|
-
import Checkbox from
|
|
20
|
+
import Checkbox from '@lunit/design-system/Checkbox';
|
|
21
21
|
|
|
22
22
|
<Checkbox />;
|
|
23
23
|
```
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Meta } from
|
|
3
|
-
import { action } from
|
|
4
|
-
import { Box } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta } from '@storybook/react-webpack5';
|
|
3
|
+
import { action } from 'storybook/actions';
|
|
4
|
+
import { Box } from '@mui/system';
|
|
5
5
|
|
|
6
|
-
import Chip from
|
|
6
|
+
import Chip from '@/components/Chip';
|
|
7
7
|
import {
|
|
8
8
|
Logo16,
|
|
9
9
|
Avatar16,
|
|
@@ -11,72 +11,72 @@ import {
|
|
|
11
11
|
Error16,
|
|
12
12
|
Information16,
|
|
13
13
|
Warning16,
|
|
14
|
-
} from
|
|
14
|
+
} from '@lunit/design-system-icons';
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
|
-
title:
|
|
17
|
+
title: 'Components/Chips',
|
|
18
18
|
component: Chip,
|
|
19
19
|
argTypes: {
|
|
20
20
|
kind: {
|
|
21
21
|
description: `Default status of Contained or Outlined Chip is readOnly. You can pass onClick, onDelete or thumbnail to Contained Chip only.`,
|
|
22
22
|
control: {
|
|
23
|
-
type:
|
|
23
|
+
type: 'select',
|
|
24
24
|
},
|
|
25
|
-
options: [
|
|
25
|
+
options: ['contained', 'outlined'],
|
|
26
26
|
},
|
|
27
27
|
variant: {
|
|
28
28
|
description: `The variant is alias of kind. It is Filled or Outlined.`,
|
|
29
29
|
control: {
|
|
30
|
-
type:
|
|
30
|
+
type: 'select',
|
|
31
31
|
},
|
|
32
|
-
options: [undefined,
|
|
32
|
+
options: [undefined, 'filled', 'outlined'],
|
|
33
33
|
},
|
|
34
34
|
onClick: {
|
|
35
35
|
description: `Contained chip can have onClick event. When Chip is clickable, onDelete is disabled.`,
|
|
36
36
|
control: {
|
|
37
|
-
type:
|
|
37
|
+
type: 'select',
|
|
38
38
|
},
|
|
39
|
-
options: [
|
|
39
|
+
options: ['function', undefined],
|
|
40
40
|
mapping: {
|
|
41
|
-
function: action(
|
|
41
|
+
function: action('onClick'),
|
|
42
42
|
undefined: undefined,
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
onDelete: {
|
|
46
46
|
description:
|
|
47
|
-
|
|
47
|
+
'Contained chip can have onDelete event. When Chip is deletable, onClick is disabled.',
|
|
48
48
|
control: {
|
|
49
|
-
type:
|
|
49
|
+
type: 'select',
|
|
50
50
|
},
|
|
51
|
-
options: [
|
|
51
|
+
options: ['function', undefined],
|
|
52
52
|
mapping: {
|
|
53
|
-
function: action(
|
|
53
|
+
function: action('onDelete'),
|
|
54
54
|
undefined: undefined,
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
|
|
58
58
|
thumbnail: {
|
|
59
59
|
control: {
|
|
60
|
-
type:
|
|
60
|
+
type: 'select',
|
|
61
61
|
},
|
|
62
62
|
options: [
|
|
63
63
|
undefined,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
'Initial',
|
|
65
|
+
'Logo16',
|
|
66
|
+
'Avatar16',
|
|
67
|
+
'Avatar16Filled',
|
|
68
|
+
'Success16',
|
|
69
|
+
'Success16Filled',
|
|
70
|
+
'Error16',
|
|
71
|
+
'Error16Filled',
|
|
72
|
+
'Information16',
|
|
73
|
+
'Information16Filled',
|
|
74
|
+
'Warning16',
|
|
75
|
+
'Warning16Filled',
|
|
76
76
|
],
|
|
77
77
|
mapping: {
|
|
78
78
|
undefined: undefined,
|
|
79
|
-
Initial:
|
|
79
|
+
Initial: 'W as initial',
|
|
80
80
|
Logo16: <Logo16 />,
|
|
81
81
|
Avatar16: <Avatar16 />,
|
|
82
82
|
Avatar16Filled: <Avatar16 variant="filled" />,
|
|
@@ -92,9 +92,9 @@ export default {
|
|
|
92
92
|
},
|
|
93
93
|
},
|
|
94
94
|
args: {
|
|
95
|
-
kind:
|
|
96
|
-
variant:
|
|
97
|
-
label:
|
|
95
|
+
kind: 'contained',
|
|
96
|
+
variant: 'filled',
|
|
97
|
+
label: 'label@lunit.io',
|
|
98
98
|
},
|
|
99
99
|
parameters: {
|
|
100
100
|
docs: {
|
|
@@ -119,52 +119,52 @@ export const Outlined = {
|
|
|
119
119
|
},
|
|
120
120
|
controls: {
|
|
121
121
|
exclude: [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
'thumbnail',
|
|
123
|
+
'onClick',
|
|
124
|
+
'onDelete',
|
|
125
|
+
'disabled',
|
|
126
|
+
'clickable',
|
|
127
|
+
'skipFocusWhenDisabled',
|
|
128
128
|
],
|
|
129
129
|
},
|
|
130
130
|
},
|
|
131
131
|
|
|
132
132
|
args: {
|
|
133
|
-
color:
|
|
134
|
-
kind:
|
|
135
|
-
variant:
|
|
133
|
+
color: 'primary',
|
|
134
|
+
kind: 'outlined',
|
|
135
|
+
variant: 'outlined',
|
|
136
136
|
},
|
|
137
137
|
|
|
138
|
-
name:
|
|
138
|
+
name: 'Kind(Variant): Outlined',
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
export const Contained = {
|
|
142
142
|
parameters: {
|
|
143
143
|
controls: {
|
|
144
144
|
exclude: [
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
'thumbnail',
|
|
146
|
+
'onClick',
|
|
147
|
+
'onDelete',
|
|
148
|
+
'disabled',
|
|
149
|
+
'clickable',
|
|
150
|
+
'skipFocusWhenDisabled',
|
|
151
151
|
],
|
|
152
152
|
},
|
|
153
153
|
},
|
|
154
154
|
|
|
155
155
|
args: {
|
|
156
|
-
color:
|
|
157
|
-
kind:
|
|
158
|
-
variant:
|
|
156
|
+
color: 'primary',
|
|
157
|
+
kind: 'contained',
|
|
158
|
+
variant: 'filled',
|
|
159
159
|
},
|
|
160
160
|
|
|
161
|
-
name:
|
|
161
|
+
name: 'Kind(Variant): Contained / Read Only',
|
|
162
162
|
};
|
|
163
163
|
|
|
164
164
|
export const Kind = {
|
|
165
165
|
chromatic: { disableSnapshot: true },
|
|
166
166
|
render: () => (
|
|
167
|
-
<Box sx={{ display:
|
|
167
|
+
<Box sx={{ display: 'flex', flexDirection: 'row', gap: 4 }}>
|
|
168
168
|
<Chip kind="outlined" label="label@lunit.io" />
|
|
169
169
|
<Chip kind="contained" label="label@lunit.io" />
|
|
170
170
|
</Box>
|
|
@@ -174,7 +174,7 @@ export const Kind = {
|
|
|
174
174
|
export const Color = {
|
|
175
175
|
chromatic: { disableSnapshot: true },
|
|
176
176
|
render: () => (
|
|
177
|
-
<Box sx={{ display:
|
|
177
|
+
<Box sx={{ display: 'flex', flexDirection: 'row', gap: 4 }}>
|
|
178
178
|
<Chip color="primary" label="label@lunit.io" />
|
|
179
179
|
<Chip color="secondary" label="label@lunit.io" />
|
|
180
180
|
<Chip color="warning" label="label@lunit.io" />
|
|
@@ -187,7 +187,7 @@ export const Color = {
|
|
|
187
187
|
export const Thumbnail = {
|
|
188
188
|
chromatic: { disableSnapshot: true },
|
|
189
189
|
render: () => (
|
|
190
|
-
<Box sx={{ display:
|
|
190
|
+
<Box sx={{ display: 'flex', flexDirection: 'row', gap: 4 }}>
|
|
191
191
|
<Chip thumbnail={<Logo16 />} label="label@lunit.io" />
|
|
192
192
|
<Chip thumbnail={<Avatar16 />} label="label@lunit.io" />
|
|
193
193
|
<Chip thumbnail={<Success16 />} label="label@lunit.io" />
|
|
@@ -199,7 +199,7 @@ export const Thumbnail = {
|
|
|
199
199
|
export const ContainedWithClick = {
|
|
200
200
|
args: {
|
|
201
201
|
...Contained.args,
|
|
202
|
-
onClick: action(
|
|
202
|
+
onClick: action('onClick'),
|
|
203
203
|
onDelete: undefined,
|
|
204
204
|
},
|
|
205
205
|
|
|
@@ -210,18 +210,18 @@ export const ContainedWithClick = {
|
|
|
210
210
|
},
|
|
211
211
|
},
|
|
212
212
|
controls: {
|
|
213
|
-
exclude: [
|
|
213
|
+
exclude: ['onDelete', 'deletable'],
|
|
214
214
|
},
|
|
215
215
|
},
|
|
216
216
|
|
|
217
|
-
name:
|
|
217
|
+
name: 'Kind(Variant): Contained / Enable',
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
export const ContainedWithDelete = {
|
|
221
221
|
args: {
|
|
222
222
|
...Contained.args,
|
|
223
223
|
onClick: undefined,
|
|
224
|
-
onDelete: action(
|
|
224
|
+
onDelete: action('onDelete'),
|
|
225
225
|
},
|
|
226
226
|
|
|
227
227
|
parameters: {
|
|
@@ -231,17 +231,17 @@ export const ContainedWithDelete = {
|
|
|
231
231
|
},
|
|
232
232
|
},
|
|
233
233
|
controls: {
|
|
234
|
-
exclude: [
|
|
234
|
+
exclude: ['onClick', 'clickable'],
|
|
235
235
|
},
|
|
236
236
|
},
|
|
237
237
|
|
|
238
|
-
name:
|
|
238
|
+
name: 'Kind(Variant): Contained / Deletable',
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
export const ContainedWithThumbnail = {
|
|
242
242
|
args: {
|
|
243
243
|
...Contained.args,
|
|
244
|
-
thumbnail:
|
|
244
|
+
thumbnail: 'Initial',
|
|
245
245
|
onClick: undefined,
|
|
246
246
|
onDelete: undefined,
|
|
247
247
|
},
|
|
@@ -253,19 +253,19 @@ export const ContainedWithThumbnail = {
|
|
|
253
253
|
},
|
|
254
254
|
},
|
|
255
255
|
controls: {
|
|
256
|
-
exclude: [
|
|
256
|
+
exclude: ['onClick', 'onDelete'],
|
|
257
257
|
},
|
|
258
258
|
},
|
|
259
259
|
|
|
260
|
-
name:
|
|
260
|
+
name: 'Kind(Variant): Contained with Thumbnail',
|
|
261
261
|
};
|
|
262
262
|
|
|
263
263
|
export const ContainedWithDeleteAndThumbnail = {
|
|
264
264
|
args: {
|
|
265
265
|
...Contained.args,
|
|
266
|
-
thumbnail:
|
|
266
|
+
thumbnail: 'Initial',
|
|
267
267
|
onClick: undefined,
|
|
268
|
-
onDelete: action(
|
|
268
|
+
onDelete: action('onDelete'),
|
|
269
269
|
},
|
|
270
270
|
|
|
271
271
|
parameters: {
|
|
@@ -275,11 +275,11 @@ export const ContainedWithDeleteAndThumbnail = {
|
|
|
275
275
|
},
|
|
276
276
|
},
|
|
277
277
|
controls: {
|
|
278
|
-
exclude: [
|
|
278
|
+
exclude: ['onClick'],
|
|
279
279
|
},
|
|
280
280
|
},
|
|
281
281
|
|
|
282
|
-
name:
|
|
282
|
+
name: 'Kind(Variant): Contained with Thumbnail and Deletable',
|
|
283
283
|
};
|
|
284
284
|
|
|
285
285
|
export const Multiline = {
|
|
@@ -287,10 +287,10 @@ export const Multiline = {
|
|
|
287
287
|
<Box sx={{ width: 100 }}>
|
|
288
288
|
<Chip
|
|
289
289
|
sx={{
|
|
290
|
-
height:
|
|
291
|
-
|
|
292
|
-
display:
|
|
293
|
-
whiteSpace:
|
|
290
|
+
height: 'auto',
|
|
291
|
+
'& .MuiChip-label': {
|
|
292
|
+
display: 'block',
|
|
293
|
+
whiteSpace: 'normal',
|
|
294
294
|
},
|
|
295
295
|
}}
|
|
296
296
|
label="This is a chip that has multiple lines."
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Canvas, Stories, Controls, Meta, Story } from
|
|
2
|
-
import { Error } from
|
|
1
|
+
import { Canvas, Stories, Controls, Meta, Story } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { Error } from '@lunit/design-system-icons';
|
|
3
3
|
|
|
4
|
-
import Chip from
|
|
5
|
-
import * as ChipStories from
|
|
4
|
+
import Chip from '@/components/Chip';
|
|
5
|
+
import * as ChipStories from './Chip.stories';
|
|
6
6
|
|
|
7
7
|
<Meta name="Chip Docs" of={ChipStories} />
|
|
8
8
|
|
|
@@ -15,9 +15,9 @@ Chips are compact elements that represent an input, attribute, or action.
|
|
|
15
15
|
### Basic Chip
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
|
-
import { Chip } from
|
|
18
|
+
import { Chip } from '@lunit/design-system';
|
|
19
19
|
// or
|
|
20
|
-
import Chip from
|
|
20
|
+
import Chip from '@lunit/design-system/Chip';
|
|
21
21
|
|
|
22
22
|
<Chip />;
|
|
23
23
|
```
|
|
@@ -78,7 +78,7 @@ You cannot pass the `onClick` prop to the Chip when its variant is `outlined`. <
|
|
|
78
78
|
|
|
79
79
|
<Canvas of={ChipStories.ContainedWithClick} />
|
|
80
80
|
```tsx
|
|
81
|
-
<Chip label="label@lunit.io" onClick={() => console.log(
|
|
81
|
+
<Chip label="label@lunit.io" onClick={() => console.log('onClick')} />
|
|
82
82
|
|
|
83
83
|
````
|
|
84
84
|
|
|
@@ -121,16 +121,17 @@ The hover/pressed effects are only applied to the delete icon. <br />
|
|
|
121
121
|
````
|
|
122
122
|
|
|
123
123
|
### Multiline
|
|
124
|
+
|
|
124
125
|
By default, Chips displays labels only in a single line. To have them support multiline content, use the `sx` prop to add `height:auto` to the Chip component, and `whiteSpace: normal` to the `label` styles.
|
|
125
126
|
|
|
126
127
|
<Canvas of={ChipStories.Multiline} />
|
|
127
128
|
```tsx
|
|
128
129
|
<Chip
|
|
129
130
|
sx={{
|
|
130
|
-
height:
|
|
131
|
-
|
|
132
|
-
display:
|
|
133
|
-
whiteSpace:
|
|
131
|
+
height: 'auto',
|
|
132
|
+
'& .MuiChip-label': {
|
|
133
|
+
display: 'block',
|
|
134
|
+
whiteSpace: 'normal',
|
|
134
135
|
},
|
|
135
136
|
}}
|
|
136
137
|
label="This is a chip that has multiple lines."
|
|
@@ -138,8 +139,6 @@ By default, Chips displays labels only in a single line. To have them support mu
|
|
|
138
139
|
<Chip label="This is a chip that has ellipsis." />
|
|
139
140
|
````
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
|
|
143
142
|
## Reference
|
|
144
143
|
|
|
145
144
|
- [Material-UI Chip](https://mui.com/material-ui/react-chip/)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { StoryFn, Meta } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryFn, Meta } from '@storybook/react-webpack5';
|
|
3
3
|
|
|
4
|
-
import DataTable from
|
|
4
|
+
import DataTable from '@/components/DataTable';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
title:
|
|
7
|
+
title: 'Components/DataTable',
|
|
8
8
|
component: DataTable,
|
|
9
9
|
} as Meta<typeof DataTable>;
|
|
10
10
|
|