@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,172 +1,170 @@
|
|
|
1
|
-
import { styled } from
|
|
1
|
+
import { styled } from '@mui/material/styles';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import type { CSSObject } from
|
|
3
|
+
import type { DialogBaseProps } from './Dialog';
|
|
4
|
+
import type { CSSObject } from '@mui/material/styles';
|
|
5
5
|
|
|
6
6
|
export interface DialogElementStyle {
|
|
7
7
|
[key: string]: CSSObject;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export type DialogStyle = Pick<
|
|
10
|
+
export type DialogStyle = Pick<DialogBaseProps, 'size' | 'type' | 'nonModal'>;
|
|
11
11
|
|
|
12
12
|
const DIALOG_WRAPPER_STYLE: DialogElementStyle = {
|
|
13
13
|
small: {
|
|
14
|
-
width:
|
|
15
|
-
maxWidth:
|
|
14
|
+
width: '320px',
|
|
15
|
+
maxWidth: '320px',
|
|
16
16
|
},
|
|
17
17
|
medium: {
|
|
18
|
-
width:
|
|
19
|
-
maxWidth:
|
|
18
|
+
width: '500px',
|
|
19
|
+
maxWidth: '840px',
|
|
20
20
|
},
|
|
21
21
|
modal: {
|
|
22
|
-
position:
|
|
22
|
+
position: 'relative',
|
|
23
23
|
},
|
|
24
24
|
nonModal: {
|
|
25
|
-
position:
|
|
26
|
-
top:
|
|
27
|
-
right:
|
|
25
|
+
position: 'fixed',
|
|
26
|
+
top: '30px',
|
|
27
|
+
right: '30px',
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const DIALOG_TITLE_STYLE: DialogElementStyle = {
|
|
32
32
|
small: {
|
|
33
|
-
display:
|
|
34
|
-
alignItems:
|
|
35
|
-
height:
|
|
36
|
-
maxHeight:
|
|
37
|
-
padding:
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
height: '52px',
|
|
36
|
+
maxHeight: '100%',
|
|
37
|
+
padding: '20px 20px 4px 20px', // Title's X button pluses 2px to paddingTop and Bottom
|
|
38
38
|
},
|
|
39
39
|
medium: {
|
|
40
|
-
display:
|
|
41
|
-
alignItems:
|
|
42
|
-
height:
|
|
43
|
-
maxHeight:
|
|
44
|
-
padding:
|
|
40
|
+
display: 'flex',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
height: '64px',
|
|
43
|
+
maxHeight: '100%',
|
|
44
|
+
padding: '30px 32px 6px 32px', // Title's X button pluses 2px to paddingTop and Bottom
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
const DIALOG_CONTENT_STYLE: DialogElementStyle = {
|
|
49
49
|
small: {
|
|
50
|
-
paddingInline:
|
|
51
|
-
paddingTop:
|
|
52
|
-
paddingBottom:
|
|
50
|
+
paddingInline: '20px calc(20px - 10px)',
|
|
51
|
+
paddingTop: '8px',
|
|
52
|
+
paddingBottom: '28px',
|
|
53
53
|
},
|
|
54
54
|
smallAction: {
|
|
55
|
-
paddingInline:
|
|
56
|
-
paddingBlock:
|
|
55
|
+
paddingInline: '20px calc(20px - 10px)',
|
|
56
|
+
paddingBlock: '8px',
|
|
57
57
|
},
|
|
58
58
|
medium: {
|
|
59
|
-
paddingInline:
|
|
60
|
-
paddingTop:
|
|
61
|
-
paddingBottom:
|
|
59
|
+
paddingInline: '32px calc(32px - 14px)',
|
|
60
|
+
paddingTop: '16px',
|
|
61
|
+
paddingBottom: '32px',
|
|
62
62
|
},
|
|
63
63
|
mediumAction: {
|
|
64
|
-
paddingInline:
|
|
65
|
-
paddingBlock:
|
|
64
|
+
paddingInline: '32px calc(32px - 14px)',
|
|
65
|
+
paddingBlock: '16px',
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const DIALOG_ACTION_STYLE: DialogElementStyle = {
|
|
70
70
|
small: {
|
|
71
|
-
height:
|
|
72
|
-
padding:
|
|
71
|
+
height: '64px',
|
|
72
|
+
padding: '8px 20px 20px 20px',
|
|
73
73
|
},
|
|
74
74
|
medium: {
|
|
75
|
-
height:
|
|
76
|
-
padding:
|
|
75
|
+
height: '84px',
|
|
76
|
+
padding: '16px 32px 32px 32px',
|
|
77
77
|
},
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
export const StyledBackdrop = styled(
|
|
81
|
-
position:
|
|
80
|
+
export const StyledBackdrop = styled('div')({
|
|
81
|
+
position: 'fixed',
|
|
82
82
|
top: 0,
|
|
83
83
|
left: 0,
|
|
84
|
-
width:
|
|
85
|
-
height:
|
|
86
|
-
backgroundColor:
|
|
84
|
+
width: '100%',
|
|
85
|
+
height: '100%',
|
|
86
|
+
backgroundColor: 'rgba(17, 17, 19, 0.7)',
|
|
87
87
|
zIndex: 1000,
|
|
88
|
-
display:
|
|
89
|
-
placeItems:
|
|
88
|
+
display: 'grid',
|
|
89
|
+
placeItems: 'center',
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
export const StyledDialog = styled(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
},
|
|
92
|
+
export const StyledDialog = styled('div')<DialogStyle>(({ theme, size, nonModal, type }) => ({
|
|
93
|
+
zIndex: 1001,
|
|
94
|
+
maxHeight: '80vh',
|
|
95
|
+
display: 'flex',
|
|
96
|
+
flexDirection: 'column',
|
|
97
|
+
boxSizing: 'border-box',
|
|
98
|
+
borderRadius: '10px',
|
|
99
|
+
backgroundColor: theme.palette.lunit_token.core.bg_03,
|
|
100
|
+
color: theme.palette.lunit_token.core.text_normal,
|
|
101
|
+
|
|
102
|
+
...DIALOG_WRAPPER_STYLE[size === 'small' ? 'small' : 'medium'],
|
|
103
|
+
...DIALOG_WRAPPER_STYLE[nonModal ? 'nonModal' : 'modal'],
|
|
104
|
+
|
|
105
|
+
'& #dialog-title': {
|
|
106
|
+
...DIALOG_TITLE_STYLE[size === 'small' ? 'small' : 'medium'],
|
|
107
|
+
},
|
|
109
108
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
?
|
|
116
|
-
: size ===
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
"::webkit-scrollbar-track": {
|
|
126
|
-
background: "transparent",
|
|
127
|
-
},
|
|
128
|
-
"::-webkit-scrollbar-thumb": {
|
|
129
|
-
backgroundClip: "padding-box",
|
|
130
|
-
border: `2px solid transparent`,
|
|
131
|
-
/**
|
|
132
|
-
* Figma's border-radius is 6px, but actual border radius is 10px since padding 2px is added.
|
|
133
|
-
*/
|
|
134
|
-
borderRadius: "10px",
|
|
135
|
-
backgroundColor: theme.palette.lunit_token.component.scrollbars_bg,
|
|
136
|
-
},
|
|
109
|
+
'& #dialog-content': {
|
|
110
|
+
...DIALOG_CONTENT_STYLE[
|
|
111
|
+
size === 'small' && type !== 'passive'
|
|
112
|
+
? 'smallAction'
|
|
113
|
+
: size === 'small'
|
|
114
|
+
? 'small'
|
|
115
|
+
: size === 'medium' && type !== 'passive'
|
|
116
|
+
? 'mediumAction'
|
|
117
|
+
: 'medium'
|
|
118
|
+
],
|
|
119
|
+
|
|
120
|
+
scrollbarGutter: 'stable',
|
|
121
|
+
'::-webkit-scrollbar': {
|
|
122
|
+
width: size === 'small' ? '10px' : '14px',
|
|
137
123
|
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
...DIALOG_ACTION_STYLE[size === "small" ? "small" : "medium"],
|
|
124
|
+
'::webkit-scrollbar-track': {
|
|
125
|
+
background: 'transparent',
|
|
141
126
|
},
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
127
|
+
'::-webkit-scrollbar-thumb': {
|
|
128
|
+
backgroundClip: 'padding-box',
|
|
129
|
+
border: `2px solid transparent`,
|
|
130
|
+
/**
|
|
131
|
+
* Figma's border-radius is 6px, but actual border radius is 10px since padding 2px is added.
|
|
132
|
+
*/
|
|
133
|
+
borderRadius: '10px',
|
|
134
|
+
backgroundColor: theme.palette.lunit_token.component.scrollbars_bg,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
'& #dialog-action': {
|
|
139
|
+
...DIALOG_ACTION_STYLE[size === 'small' ? 'small' : 'medium'],
|
|
140
|
+
},
|
|
141
|
+
}));
|
|
142
|
+
|
|
143
|
+
export const StyledDialogTitle = styled('header')({
|
|
144
|
+
display: 'flex',
|
|
145
|
+
width: '100%',
|
|
146
|
+
flex: '0 0 auto',
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
justifyContent: 'flex-start',
|
|
149
|
+
gap: '8px',
|
|
152
150
|
});
|
|
153
151
|
|
|
154
|
-
export const StyledDialogTitleIconWrapper = styled(
|
|
155
|
-
display:
|
|
156
|
-
justifyContent:
|
|
157
|
-
width:
|
|
158
|
-
height:
|
|
159
|
-
|
|
160
|
-
display:
|
|
161
|
-
justifyContent:
|
|
162
|
-
width:
|
|
163
|
-
height:
|
|
164
|
-
fontSize:
|
|
152
|
+
export const StyledDialogTitleIconWrapper = styled('div')({
|
|
153
|
+
display: 'flex',
|
|
154
|
+
justifyContent: 'center',
|
|
155
|
+
width: '20px',
|
|
156
|
+
height: '20px',
|
|
157
|
+
'& .MuiSvgIcon-root': {
|
|
158
|
+
display: 'flex',
|
|
159
|
+
justifyContent: 'center',
|
|
160
|
+
width: '20px',
|
|
161
|
+
height: '20px',
|
|
162
|
+
fontSize: '20px',
|
|
165
163
|
},
|
|
166
164
|
});
|
|
167
165
|
|
|
168
|
-
export const StyledDialogContent = styled(
|
|
166
|
+
export const StyledDialogContent = styled('div')(({ theme }) => ({
|
|
169
167
|
...theme.typography.body2_14_regular,
|
|
170
|
-
flex:
|
|
171
|
-
overflowY:
|
|
168
|
+
flex: '1 1 auto',
|
|
169
|
+
overflowY: 'scroll',
|
|
172
170
|
}));
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import React, { useEffect } from
|
|
2
|
-
import { createPortal } from
|
|
3
|
-
import { Close } from
|
|
1
|
+
import React, { useEffect, useCallback } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { Close } from '@lunit/design-system-icons';
|
|
4
4
|
|
|
5
|
-
import { DialogAction } from
|
|
5
|
+
import { DialogAction } from './components/DialogAction';
|
|
6
6
|
import {
|
|
7
7
|
StyledBackdrop,
|
|
8
8
|
StyledDialog,
|
|
9
9
|
StyledDialogContent,
|
|
10
10
|
StyledDialogTitle,
|
|
11
11
|
StyledDialogTitleIconWrapper,
|
|
12
|
-
} from
|
|
13
|
-
import Button from
|
|
14
|
-
import Typography from
|
|
12
|
+
} from './Dialog.styled';
|
|
13
|
+
import Button from '../Button';
|
|
14
|
+
import Typography from '../Typography';
|
|
15
15
|
|
|
16
|
-
import type { SxProps } from
|
|
17
|
-
import type { TypographyProps } from
|
|
16
|
+
import type { SxProps } from '@mui/material/styles';
|
|
17
|
+
import type { TypographyProps } from '@mui/material';
|
|
18
18
|
|
|
19
|
-
export interface
|
|
19
|
+
export interface DialogBaseProps {
|
|
20
20
|
isOpen: boolean;
|
|
21
21
|
onClose(): void;
|
|
22
|
-
type?:
|
|
22
|
+
type?: 'passive' | 'action'; // default passive
|
|
23
23
|
nonModal?: boolean; // default false
|
|
24
24
|
title: string;
|
|
25
25
|
titleIcon?: React.ReactNode;
|
|
26
|
-
titleVariant?: TypographyProps[
|
|
26
|
+
titleVariant?: TypographyProps['variant'];
|
|
27
27
|
children: React.ReactNode;
|
|
28
28
|
actions?: React.ReactNode;
|
|
29
29
|
enableBackdropClose?: boolean;
|
|
30
|
-
size?:
|
|
30
|
+
size?: 'small' | 'medium'; // default "small"
|
|
31
31
|
sx?: SxProps;
|
|
32
32
|
style?: React.CSSProperties;
|
|
33
33
|
className?: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export interface PassiveDialogType extends
|
|
37
|
-
type:
|
|
36
|
+
export interface PassiveDialogType extends DialogBaseProps {
|
|
37
|
+
type: 'passive';
|
|
38
38
|
actions?: undefined;
|
|
39
39
|
enableBackdropClose?: true;
|
|
40
40
|
}
|
|
41
|
-
export interface ActionDialogType extends
|
|
42
|
-
type:
|
|
41
|
+
export interface ActionDialogType extends DialogBaseProps {
|
|
42
|
+
type: 'action';
|
|
43
43
|
actions: React.ReactNode;
|
|
44
44
|
enableBackdropClose?: boolean;
|
|
45
45
|
}
|
|
@@ -66,31 +66,33 @@ export type DialogProps = ModalProps | NonModalProps;
|
|
|
66
66
|
function Dialog(props: DialogProps) {
|
|
67
67
|
const { isOpen, type, nonModal = false, onClose } = props;
|
|
68
68
|
|
|
69
|
-
const isActionModal = type ===
|
|
70
|
-
const isPassiveModal = type ===
|
|
69
|
+
const isActionModal = type === 'action' && !nonModal;
|
|
70
|
+
const isPassiveModal = type === 'passive' && !nonModal;
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
isPassiveModal || (isActionModal && props.enableBackdropClose);
|
|
72
|
+
const handleBackdropClose = useCallback(
|
|
73
|
+
(e: React.MouseEvent<HTMLDivElement>) => {
|
|
74
|
+
const isClosable = isPassiveModal || (isActionModal && props.enableBackdropClose);
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
if (!isClosable) return;
|
|
77
|
+
if (e.target !== e.currentTarget) return;
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
onClose();
|
|
80
|
+
},
|
|
81
|
+
[isPassiveModal, isActionModal, props.enableBackdropClose, onClose],
|
|
82
|
+
);
|
|
81
83
|
|
|
82
84
|
useEffect(() => {
|
|
83
85
|
const isClosable = isOpen && isPassiveModal;
|
|
84
86
|
if (!isClosable) return;
|
|
85
87
|
|
|
86
88
|
function handleEscClose(event: KeyboardEvent) {
|
|
87
|
-
if (event.key ===
|
|
89
|
+
if (event.key === 'Escape') onClose();
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
document.addEventListener(
|
|
92
|
+
document.addEventListener('keydown', handleEscClose);
|
|
91
93
|
|
|
92
94
|
return () => {
|
|
93
|
-
document.removeEventListener(
|
|
95
|
+
document.removeEventListener('keydown', handleEscClose);
|
|
94
96
|
};
|
|
95
97
|
}, [isOpen, isPassiveModal, onClose]);
|
|
96
98
|
|
|
@@ -99,29 +101,26 @@ function Dialog(props: DialogProps) {
|
|
|
99
101
|
nonModal ? (
|
|
100
102
|
<DialogBase dialogProps={{ ...props }} />
|
|
101
103
|
) : (
|
|
102
|
-
<StyledBackdrop
|
|
103
|
-
onClick={handleBackdropClose}
|
|
104
|
-
data-testid="dialog-backdrop"
|
|
105
|
-
>
|
|
104
|
+
<StyledBackdrop onClick={handleBackdropClose} data-testid="dialog-backdrop">
|
|
106
105
|
<DialogBase dialogProps={{ ...props }} />
|
|
107
106
|
</StyledBackdrop>
|
|
108
107
|
),
|
|
109
108
|
|
|
110
|
-
document.body
|
|
109
|
+
document.body,
|
|
111
110
|
);
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
function DialogBase({ dialogProps }: { dialogProps:
|
|
113
|
+
function DialogBase({ dialogProps }: { dialogProps: DialogBaseProps }) {
|
|
115
114
|
const {
|
|
116
115
|
nonModal = false,
|
|
117
116
|
onClose,
|
|
118
117
|
title,
|
|
119
118
|
titleIcon,
|
|
120
|
-
titleVariant =
|
|
119
|
+
titleVariant = 'headline5',
|
|
121
120
|
children,
|
|
122
121
|
actions,
|
|
123
122
|
type,
|
|
124
|
-
size =
|
|
123
|
+
size = 'small',
|
|
125
124
|
sx,
|
|
126
125
|
style,
|
|
127
126
|
className,
|
|
@@ -138,7 +137,7 @@ function DialogBase({ dialogProps }: { dialogProps: DialogBase }) {
|
|
|
138
137
|
...sx,
|
|
139
138
|
}}
|
|
140
139
|
style={style}
|
|
141
|
-
className={`dialog elevation2 ${className ??
|
|
140
|
+
className={`dialog elevation2 ${className ?? ''}`}
|
|
142
141
|
>
|
|
143
142
|
<StyledDialogTitle id="dialog-title" className="dialog-title-wrapper">
|
|
144
143
|
{titleIcon && (
|
|
@@ -146,14 +145,10 @@ function DialogBase({ dialogProps }: { dialogProps: DialogBase }) {
|
|
|
146
145
|
{titleIcon}
|
|
147
146
|
</StyledDialogTitleIconWrapper>
|
|
148
147
|
)}
|
|
149
|
-
<Typography
|
|
150
|
-
component="h2"
|
|
151
|
-
id="dialog-title-text"
|
|
152
|
-
variant={titleVariant}
|
|
153
|
-
>
|
|
148
|
+
<Typography component="h2" id="dialog-title-text" variant={titleVariant}>
|
|
154
149
|
{title}
|
|
155
150
|
</Typography>
|
|
156
|
-
{type ===
|
|
151
|
+
{type === 'passive' && (
|
|
157
152
|
<Button
|
|
158
153
|
id="dialog-title-close-button"
|
|
159
154
|
data-testid="dialog-title-close-button"
|
|
@@ -163,13 +158,13 @@ function DialogBase({ dialogProps }: { dialogProps: DialogBase }) {
|
|
|
163
158
|
onClick={onClose}
|
|
164
159
|
sx={{
|
|
165
160
|
marginRight: 0,
|
|
166
|
-
marginLeft:
|
|
161
|
+
marginLeft: 'auto',
|
|
167
162
|
}}
|
|
168
163
|
/>
|
|
169
164
|
)}
|
|
170
165
|
</StyledDialogTitle>
|
|
171
166
|
<StyledDialogContent id="dialog-content">{children}</StyledDialogContent>
|
|
172
|
-
{type ===
|
|
167
|
+
{type === 'action' && actions !== null ? (
|
|
173
168
|
// `actions !== null` is used to not render DialogAction when actions is undefined
|
|
174
169
|
// There was a case when actions is undefined, but DialogAction is rendered with null children
|
|
175
170
|
<DialogAction>{actions}</DialogAction>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { styled } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
3
|
|
|
4
4
|
interface DialogActionProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
|
-
justifyContent?: React.CSSProperties[
|
|
6
|
+
justifyContent?: React.CSSProperties['justifyContent'];
|
|
7
7
|
sx?: React.CSSProperties;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const StyledDialogActions = styled(
|
|
11
|
-
display:
|
|
12
|
-
flex:
|
|
13
|
-
alignItems:
|
|
14
|
-
justifyContent:
|
|
10
|
+
const StyledDialogActions = styled('div')({
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flex: '0 0 auto',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'flex-end',
|
|
15
15
|
gap: 12,
|
|
16
16
|
});
|
|
17
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from './Dialog';
|
|
2
2
|
|
|
3
3
|
export type {
|
|
4
|
-
|
|
4
|
+
DialogBaseProps,
|
|
5
5
|
PassiveDialogType,
|
|
6
6
|
ActionDialogType,
|
|
7
7
|
PassiveModalProps,
|
|
@@ -11,4 +11,4 @@ export type {
|
|
|
11
11
|
ModalProps,
|
|
12
12
|
NonModalProps,
|
|
13
13
|
DialogProps,
|
|
14
|
-
} from
|
|
14
|
+
} from './Dialog';
|