@lunit/design-system 1.0.0-a.2 → 1.0.0-a.4
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 +16 -0
- 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/Chip/index.js +1 -1
- package/dist/cjs/components/Chip/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/ToggleButton/index.js +1 -1
- package/dist/cjs/components/ToggleButton/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 +20 -4
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Alert/Alert.styled.js +49 -0
- package/dist/components/Alert/Alert.styled.js.map +1 -0
- package/dist/components/Alert/Alert.types.js +2 -0
- package/dist/components/Alert/Alert.types.js.map +1 -0
- package/dist/components/Alert/Alert.utils.js +37 -0
- package/dist/components/Alert/Alert.utils.js.map +1 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.styled.js +31 -21
- package/dist/components/Button/Button.styled.js.map +1 -1
- package/dist/components/Button/utils/getHoverStyle.js +7 -0
- package/dist/components/Button/utils/getHoverStyle.js.map +1 -0
- package/dist/components/Chip/Chip.js +1 -1
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Chip/Chip.styled.js +2 -3
- package/dist/components/Chip/Chip.styled.js.map +1 -1
- package/dist/components/TextField/TextField.js +15 -3
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.style.js +245 -0
- package/dist/components/TextField/TextField.style.js.map +1 -0
- package/dist/components/TextField/TextField.types.js +2 -0
- package/dist/components/TextField/TextField.types.js.map +1 -0
- package/dist/components/TextField/TextFieldIcon.js +7 -0
- package/dist/components/TextField/TextFieldIcon.js.map +1 -0
- package/dist/components/Toast/Toast.js +26 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/Toast.styled.js +49 -0
- package/dist/components/Toast/Toast.styled.js.map +1 -0
- package/dist/components/Toast/Toast.types.js +2 -0
- package/dist/components/Toast/Toast.types.js.map +1 -0
- package/dist/components/Toast/Toast.utils.js +13 -0
- package/dist/components/Toast/Toast.utils.js.map +1 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Toast/index.js.map +1 -0
- package/dist/foundation/colors/base/grey.js +16 -0
- package/dist/foundation/colors/base/grey.js.map +1 -1
- package/dist/foundation/colors/base/lunitGreen.js +2 -2
- package/dist/foundation/colors/base/lunitGreen.js.map +1 -1
- package/dist/foundation/colors/base/lunitTeal.js +5 -5
- package/dist/foundation/colors/base/lunitTeal.js.map +1 -1
- package/dist/foundation/colors/base/red.js +2 -2
- package/dist/foundation/colors/index.js +24 -4
- package/dist/foundation/colors/index.js.map +1 -1
- package/dist/foundation/colors/token/component.js +265 -291
- package/dist/foundation/colors/token/component.js.map +1 -1
- package/dist/foundation/colors/token/core.js +132 -125
- package/dist/foundation/colors/token/core.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/theme.js +5 -0
- package/dist/theme.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +3 -1
- package/dist/types/components/Alert/Alert.styled.d.ts +6 -0
- package/dist/types/components/Alert/Alert.types.d.ts +9 -0
- package/dist/types/components/Alert/Alert.utils.d.ts +4 -0
- package/dist/types/components/Button/Button.d.ts +1 -1
- package/dist/types/components/Button/Button.styled.d.ts +26 -2
- package/dist/types/components/Button/Button.types.d.ts +4 -4
- package/dist/types/components/Button/utils/getHoverStyle.d.ts +6 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/Chip/Chip.d.ts +1 -1
- package/dist/types/components/Chip/Chip.styled.d.ts +13 -13
- package/dist/types/components/Chip/Chip.types.d.ts +1 -1
- package/dist/types/components/DataTable/DataTable.d.ts +1 -1
- package/dist/types/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/types/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/types/components/FormLabel/FormLabel.d.ts +1 -1
- package/dist/types/components/Modal/Modal.d.ts +1 -1
- package/dist/types/components/Radio/Radio.d.ts +1 -1
- package/dist/types/components/TextField/TextField.d.ts +2 -1
- package/dist/types/components/TextField/TextField.style.d.ts +9 -0
- package/dist/types/components/TextField/TextField.types.d.ts +29 -0
- package/dist/types/components/TextField/TextFieldIcon.d.ts +8 -0
- package/dist/types/components/TextField/index.d.ts +1 -0
- package/dist/types/components/Toast/Toast.d.ts +4 -0
- package/dist/types/components/Toast/Toast.styled.d.ts +1 -0
- package/dist/types/components/Toast/Toast.types.d.ts +4 -0
- package/dist/types/components/Toast/Toast.utils.d.ts +2 -0
- package/dist/types/components/Toast/index.d.ts +1 -0
- package/dist/types/components/Toggle/Toggle.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -2
- package/dist/types/components/ToggleButton/ToggleButton.types.d.ts +4 -4
- package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +1 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/foundation/colors/base/grey.d.ts +16 -0
- package/dist/types/foundation/colors/base/lunitGreen.d.ts +2 -2
- package/dist/types/foundation/colors/base/lunitTeal.d.ts +2 -2
- package/dist/types/foundation/colors/index.d.ts +42 -9
- package/dist/types/foundation/colors/types.d.ts +1 -3
- package/dist/types/foundation/index.d.ts +37 -5
- package/dist/types/index.d.ts +1 -0
- package/package.json +21 -16
- package/src/components/Alert/Alert.styled.ts +63 -0
- package/src/components/Alert/Alert.tsx +47 -5
- package/src/components/Alert/Alert.types.ts +10 -0
- package/src/components/Alert/Alert.utils.ts +49 -0
- package/src/components/Button/Button.styled.ts +33 -21
- package/src/components/Button/Button.tsx +1 -5
- package/src/components/Button/Button.types.ts +4 -4
- package/src/components/Button/utils/getHoverStyle.ts +7 -0
- package/src/components/Chip/Chip.styled.ts +6 -4
- package/src/components/Chip/Chip.tsx +1 -1
- package/src/components/Chip/Chip.types.ts +2 -2
- package/src/components/TextField/TextField.style.ts +316 -0
- package/src/components/TextField/TextField.tsx +75 -3
- package/src/components/TextField/TextField.types.ts +38 -0
- package/src/components/TextField/TextFieldIcon.tsx +24 -0
- package/src/components/TextField/index.ts +6 -0
- package/src/components/Toast/Toast.styled.ts +49 -0
- package/src/components/Toast/Toast.tsx +66 -0
- package/src/components/Toast/Toast.types.ts +14 -0
- package/src/components/Toast/Toast.utils.ts +17 -0
- package/src/components/Toast/index.tsx +1 -0
- package/src/components/ToggleButton/ToggleButton.types.ts +4 -7
- package/src/foundation/colors/base/grey.ts +17 -0
- package/src/foundation/colors/base/lunitGreen.ts +2 -2
- package/src/foundation/colors/base/lunitTeal.ts +5 -5
- package/src/foundation/colors/base/red.ts +2 -2
- package/src/foundation/colors/index.ts +29 -8
- package/src/foundation/colors/token/component.ts +300 -326
- package/src/foundation/colors/token/core.ts +152 -145
- package/src/foundation/colors/types.ts +1 -3
- package/src/index.ts +1 -0
- package/src/stories/components/Alert/Alert.stories.tsx +148 -4
- package/src/stories/components/Button/BasicButton.stories.tsx +19 -28
- package/src/stories/components/Button/IconButton.stories.tsx +39 -28
- package/src/stories/components/Button/Kind.stories.tsx +83 -57
- package/src/stories/components/Chip/Chip.stories.tsx +94 -82
- package/src/stories/components/DataTable/DataTable.stories.tsx +6 -4
- package/src/stories/components/DatePicker/DatePicker.stories.tsx +6 -4
- package/src/stories/components/Dropdown/Dropdown.stories.tsx +12 -6
- package/src/stories/components/Modal/Modal.stories.tsx +6 -4
- package/src/stories/components/SelectControl/Checkbox.stories.tsx +31 -23
- package/src/stories/components/SelectControl/RadioGroup.stories.tsx +6 -5
- package/src/stories/components/SelectControl/RadioStatus.stories.tsx +6 -4
- package/src/stories/components/SelectControl/Toggle.stories.tsx +33 -19
- package/src/stories/components/TextField/TextFieldMulti.stories.tsx +137 -0
- package/src/stories/components/TextField/TextFieldSingle.stories.tsx +283 -0
- package/src/stories/components/TextField/TextFieldSize.stories.tsx +134 -0
- package/src/stories/components/Toast/Toast.stories.tsx +152 -0
- package/src/stories/components/ToggleButton/Basic.stories.tsx +35 -31
- package/src/stories/components/ToggleButton/Group.stories.tsx +21 -21
- package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +53 -43
- package/src/stories/components/ToggleButton/WithIcon.stories.tsx +35 -36
- package/src/stories/components/Tooltip/Tooltip.stories.tsx +6 -4
- package/src/stories/foundation/Elevation/Elevation.stories.tsx +10 -6
- package/src/stories/foundation/Typography/{Typography.stories.mdx → Typography.mdx} +10 -5
- package/src/stories/foundation/Typography/Typography.stories.tsx +46 -36
- package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +44 -0
- package/src/stories/foundation/colors/Colors.stories.tsx +7 -5
- package/src/stories/foundation/colors/Mui.stories.tsx +18 -0
- package/src/stories/foundation/colors/Token.inComponent.stories.tsx +2 -2
- package/src/stories/foundation/colors/TokenPaletteTable.stories.tsx +28 -0
- package/src/stories/foundation/colors/TokenPaletteTable.tsx +127 -0
- package/src/theme.ts +5 -0
- package/src/stories/components/TextField/TextField.stories.tsx +0 -13
- package/src/stories/foundation/colors/Token.stories.tsx +0 -190
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Alert as MuiAlert,
|
|
3
|
+
AlertTitle as MuiAlertTitle,
|
|
4
|
+
styled,
|
|
5
|
+
} from "@mui/material";
|
|
6
|
+
import type { AlertProps } from "./Alert.types";
|
|
7
|
+
import {
|
|
8
|
+
getBorderColor,
|
|
9
|
+
getBackgroundColor,
|
|
10
|
+
getIconColor,
|
|
11
|
+
} from "./Alert.utils";
|
|
12
|
+
|
|
13
|
+
export const StyledAlert = styled(MuiAlert)<AlertProps>(
|
|
14
|
+
({ severity, theme }) => ({
|
|
15
|
+
"&.MuiAlert-root": {
|
|
16
|
+
display: "flex",
|
|
17
|
+
padding: "12px",
|
|
18
|
+
borderRadius: "8px",
|
|
19
|
+
border: `1px solid ${getBorderColor(theme, severity)}`,
|
|
20
|
+
backgroundColor: getBackgroundColor(theme, severity),
|
|
21
|
+
boxShadow: "none",
|
|
22
|
+
},
|
|
23
|
+
"& .MuiAlert-icon": {
|
|
24
|
+
padding: "4px",
|
|
25
|
+
marginRight: "0",
|
|
26
|
+
fontSize: "20px",
|
|
27
|
+
color: `${getIconColor(theme, severity)} !important`,
|
|
28
|
+
},
|
|
29
|
+
"& .MuiAlert-message": {
|
|
30
|
+
width: "100%",
|
|
31
|
+
minHeight: "28px",
|
|
32
|
+
padding: "4px 0 0",
|
|
33
|
+
margin: "0 8px 0 8px",
|
|
34
|
+
},
|
|
35
|
+
"& .MuiAlert-action": {
|
|
36
|
+
margin: 0,
|
|
37
|
+
padding: 0,
|
|
38
|
+
},
|
|
39
|
+
"& .MuiSvgIcon-root": {
|
|
40
|
+
height: "20px",
|
|
41
|
+
width: "20px",
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export const StyledAlertTitle = styled(MuiAlertTitle)(({ theme }) => ({
|
|
47
|
+
"&.MuiAlertTitle-root": {
|
|
48
|
+
marginTop: 0,
|
|
49
|
+
marginBottom: 8,
|
|
50
|
+
fontWeight: 700,
|
|
51
|
+
fontSize: "14px",
|
|
52
|
+
lineHeight: "20px",
|
|
53
|
+
color: theme.palette.token.core.text_normal,
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
export const StyledAlertChildren = styled("div")(({ theme }) => ({
|
|
58
|
+
color: theme.palette.token.core.text_normal,
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
export const StyledBottomAction = styled("div")({
|
|
62
|
+
marginTop: "12px",
|
|
63
|
+
});
|
|
@@ -1,9 +1,51 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Success from "@lunit/design-system-icons/Success16";
|
|
2
|
+
import Error from "@lunit/design-system-icons/Error16";
|
|
3
|
+
import Warning from "@lunit/design-system-icons/Warning16";
|
|
4
|
+
import Information from "@lunit/design-system-icons/Information16";
|
|
5
|
+
import Close from "@lunit/design-system-icons/Close";
|
|
6
|
+
import React, { forwardRef } from "react";
|
|
7
|
+
import {
|
|
8
|
+
StyledAlert,
|
|
9
|
+
StyledAlertTitle,
|
|
10
|
+
StyledAlertChildren,
|
|
11
|
+
StyledBottomAction,
|
|
12
|
+
} from "./Alert.styled";
|
|
13
|
+
import { AlertProps } from "./Alert.types";
|
|
14
|
+
import Button from "../Button";
|
|
2
15
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
16
|
+
const MAPPED_ICON = {
|
|
17
|
+
success: <Success variant="filled" />,
|
|
18
|
+
info: <Information variant="filled" />,
|
|
19
|
+
warning: <Warning variant="filled" />,
|
|
20
|
+
error: <Error variant="filled" />,
|
|
7
21
|
};
|
|
8
22
|
|
|
23
|
+
const Alert = forwardRef<HTMLDivElement, AlertProps>((props, ref) => {
|
|
24
|
+
const { title, severity, children, bottomAction, onClose, ...rest } = props;
|
|
25
|
+
return (
|
|
26
|
+
<StyledAlert
|
|
27
|
+
ref={ref}
|
|
28
|
+
severity={severity}
|
|
29
|
+
iconMapping={MAPPED_ICON}
|
|
30
|
+
slots={{
|
|
31
|
+
closeButton: () => (
|
|
32
|
+
<Button
|
|
33
|
+
kind="ghost"
|
|
34
|
+
size="small"
|
|
35
|
+
color="secondary"
|
|
36
|
+
icon={<Close />}
|
|
37
|
+
onClick={onClose}
|
|
38
|
+
/>
|
|
39
|
+
),
|
|
40
|
+
}}
|
|
41
|
+
onClose={onClose}
|
|
42
|
+
{...rest}
|
|
43
|
+
>
|
|
44
|
+
{title && <StyledAlertTitle>{title}</StyledAlertTitle>}
|
|
45
|
+
<StyledAlertChildren>{children}</StyledAlertChildren>
|
|
46
|
+
{bottomAction && <StyledBottomAction>{bottomAction}</StyledBottomAction>}
|
|
47
|
+
</StyledAlert>
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
9
51
|
export default Alert;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AlertProps as MuiAlertProps } from "@mui/material";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export interface AlertProps extends MuiAlertProps {
|
|
5
|
+
title?: string;
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
bottomAction?: ReactNode;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { AlertColor, Theme } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const getBackgroundColor = (
|
|
4
|
+
theme: Theme,
|
|
5
|
+
severity: AlertColor | undefined
|
|
6
|
+
) => {
|
|
7
|
+
switch (severity) {
|
|
8
|
+
case "info":
|
|
9
|
+
return theme.palette.token.component.alert_info_bg;
|
|
10
|
+
case "warning":
|
|
11
|
+
return theme.palette.token.component.alert_warning_bg;
|
|
12
|
+
case "error":
|
|
13
|
+
return theme.palette.token.component.alert_error_bg;
|
|
14
|
+
default:
|
|
15
|
+
return theme.palette.token.component.alert_success_bg;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const getBorderColor = (
|
|
20
|
+
theme: Theme,
|
|
21
|
+
severity: AlertColor | undefined
|
|
22
|
+
) => {
|
|
23
|
+
switch (severity) {
|
|
24
|
+
case "info":
|
|
25
|
+
return theme.palette.token.component.alert_info_border;
|
|
26
|
+
case "warning":
|
|
27
|
+
return theme.palette.token.component.alert_warning_border;
|
|
28
|
+
case "error":
|
|
29
|
+
return theme.palette.token.component.alert_error_border;
|
|
30
|
+
default:
|
|
31
|
+
return theme.palette.token.component.alert_success_border;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const getIconColor = (
|
|
36
|
+
theme: Theme,
|
|
37
|
+
severity: AlertColor | undefined
|
|
38
|
+
) => {
|
|
39
|
+
switch (severity) {
|
|
40
|
+
case "info":
|
|
41
|
+
return theme.palette.token.core.icon_info_02;
|
|
42
|
+
case "warning":
|
|
43
|
+
return theme.palette.token.core.icon_warning_02;
|
|
44
|
+
case "error":
|
|
45
|
+
return theme.palette.token.core.icon_error_02;
|
|
46
|
+
default:
|
|
47
|
+
return theme.palette.token.core.icon_success_02;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
@@ -5,6 +5,7 @@ import { ColorToken } from "@/foundation/colors/types";
|
|
|
5
5
|
import { PADDING_OF_FOCUS, OUTLINED_BORDER_WIDTH } from "./const";
|
|
6
6
|
import { getButtonPaddingBySizeAndKind } from "./utils/getButtonPaddingBySizeAndKind";
|
|
7
7
|
import { getIconButtonPaddingBySizeAndKind } from "./utils/getIconButtonPaddingBySizeAndKind";
|
|
8
|
+
import getHoverStyle from "./utils/getHoverStyle";
|
|
8
9
|
|
|
9
10
|
import type { ButtonProps } from "./Button.types";
|
|
10
11
|
import type { ToggleButtonProps } from "../ToggleButton/ToggleButton.types";
|
|
@@ -22,6 +23,8 @@ type sizeStyleParams = Pick<
|
|
|
22
23
|
> &
|
|
23
24
|
Pick<ToggleButtonProps, "selected"> & { typography: Typography };
|
|
24
25
|
|
|
26
|
+
const borderRadius = "8px";
|
|
27
|
+
|
|
25
28
|
export const sizeStyle = ({
|
|
26
29
|
size,
|
|
27
30
|
kind,
|
|
@@ -67,9 +70,7 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
67
70
|
color === "primary" && {
|
|
68
71
|
color: token.component.btn_contained_primary_text,
|
|
69
72
|
backgroundColor: token.component.btn_contained_primary_bg,
|
|
70
|
-
"&:hover":
|
|
71
|
-
backgroundColor: token.component.btn_contained_primary_bg,
|
|
72
|
-
},
|
|
73
|
+
"&:hover": getHoverStyle(token.component.btn_contained_primary_bg),
|
|
73
74
|
"&.Mui-disabled": {
|
|
74
75
|
opacity: 0.38,
|
|
75
76
|
border: "none",
|
|
@@ -79,10 +80,9 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
79
80
|
...(kind === "contained" &&
|
|
80
81
|
color === "secondary" && {
|
|
81
82
|
color: token.component.btn_contained_secondary_text,
|
|
83
|
+
|
|
82
84
|
backgroundColor: token.component.btn_contained_secondary_bg,
|
|
83
|
-
"&:hover":
|
|
84
|
-
backgroundColor: token.component.btn_contained_secondary_bg,
|
|
85
|
-
},
|
|
85
|
+
"&:hover": getHoverStyle(token.component.btn_contained_secondary_bg),
|
|
86
86
|
"&.Mui-disabled": {
|
|
87
87
|
opacity: 0.38,
|
|
88
88
|
border: "none",
|
|
@@ -93,9 +93,7 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
93
93
|
color === "error" && {
|
|
94
94
|
color: token.component.btn_contained_error_text,
|
|
95
95
|
backgroundColor: token.component.btn_contained_error_bg,
|
|
96
|
-
"&:hover":
|
|
97
|
-
backgroundColor: token.component.btn_contained_error_bg,
|
|
98
|
-
},
|
|
96
|
+
"&:hover": getHoverStyle(token.component.btn_contained_error_bg),
|
|
99
97
|
"&.Mui-disabled": {
|
|
100
98
|
opacity: 0.38,
|
|
101
99
|
border: "none",
|
|
@@ -107,9 +105,7 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
107
105
|
color === "primary" && {
|
|
108
106
|
color: token.component.btn_ghost_primary_text,
|
|
109
107
|
border: "none",
|
|
110
|
-
"&:hover":
|
|
111
|
-
backgroundColor: "rgba(0, 0, 0, 0.06)",
|
|
112
|
-
},
|
|
108
|
+
"&:hover": getHoverStyle("none"),
|
|
113
109
|
"&.Mui-disabled": {
|
|
114
110
|
opacity: 0.38,
|
|
115
111
|
border: "none",
|
|
@@ -120,9 +116,7 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
120
116
|
color === "secondary" && {
|
|
121
117
|
color: token.component.btn_ghost_secondary_text,
|
|
122
118
|
border: "none",
|
|
123
|
-
"&:hover":
|
|
124
|
-
backgroundColor: "rgba(0, 0, 0, 0.06)",
|
|
125
|
-
},
|
|
119
|
+
"&:hover": getHoverStyle("none"),
|
|
126
120
|
"&.Mui-disabled": {
|
|
127
121
|
opacity: 0.38,
|
|
128
122
|
border: "none",
|
|
@@ -132,9 +126,7 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
132
126
|
...(kind === "ghost" &&
|
|
133
127
|
color === "error" && {
|
|
134
128
|
color: token.component.btn_ghost_error_text,
|
|
135
|
-
"&:hover":
|
|
136
|
-
backgroundColor: "rgba(0, 0, 0, 0.06)",
|
|
137
|
-
},
|
|
129
|
+
"&:hover": getHoverStyle("none"),
|
|
138
130
|
"&.Mui-disabled": {
|
|
139
131
|
opacity: 0.38,
|
|
140
132
|
border: "none",
|
|
@@ -146,8 +138,17 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
146
138
|
color === "primary" && {
|
|
147
139
|
color: token.component.btn_outlined_primary_text,
|
|
148
140
|
border: `${OUTLINED_BORDER_WIDTH}px solid ${token.component.btn_outlined_primary_border}`,
|
|
149
|
-
"&:hover":
|
|
150
|
-
|
|
141
|
+
"&:hover": getHoverStyle("none"),
|
|
142
|
+
"&:hover:before": {
|
|
143
|
+
content: "''",
|
|
144
|
+
position: "absolute",
|
|
145
|
+
left: "-1px",
|
|
146
|
+
top: "-1px",
|
|
147
|
+
width: "calc(100% + 2px)",
|
|
148
|
+
height: "calc(100% + 2px)",
|
|
149
|
+
zIndex: -1,
|
|
150
|
+
backgroundColor: token.core.hover,
|
|
151
|
+
borderRadius,
|
|
151
152
|
},
|
|
152
153
|
"&.Mui-disabled": {
|
|
153
154
|
opacity: 0.38,
|
|
@@ -159,7 +160,7 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
159
160
|
export const commonStyle = ({ token }: { token: ColorToken }) =>
|
|
160
161
|
({
|
|
161
162
|
fontWeight: "500",
|
|
162
|
-
borderRadius
|
|
163
|
+
borderRadius,
|
|
163
164
|
textTransform: "initial",
|
|
164
165
|
"&.Mui-focusVisible": {
|
|
165
166
|
"&::after": {
|
|
@@ -172,6 +173,17 @@ export const commonStyle = ({ token }: { token: ColorToken }) =>
|
|
|
172
173
|
boxSizing: "border-box",
|
|
173
174
|
},
|
|
174
175
|
},
|
|
176
|
+
"&:hover:before": {
|
|
177
|
+
content: "''",
|
|
178
|
+
position: "absolute",
|
|
179
|
+
left: 0,
|
|
180
|
+
top: 0,
|
|
181
|
+
width: "100%",
|
|
182
|
+
height: "100%",
|
|
183
|
+
zIndex: -1,
|
|
184
|
+
backgroundColor: token.core.hover,
|
|
185
|
+
borderRadius,
|
|
186
|
+
},
|
|
175
187
|
} as const);
|
|
176
188
|
|
|
177
189
|
export const iconStyle = ({
|
|
@@ -4,7 +4,7 @@ import { CustomButton } from "./Button.styled";
|
|
|
4
4
|
|
|
5
5
|
import type { ButtonProps } from "./Button.types";
|
|
6
6
|
|
|
7
|
-
const Button = (props:
|
|
7
|
+
const Button = (props: ButtonProps) => {
|
|
8
8
|
const {
|
|
9
9
|
kind = "contained",
|
|
10
10
|
size = "small",
|
|
@@ -26,8 +26,6 @@ const Button = (props: Omit<ButtonProps, "hasIconOnly">) => {
|
|
|
26
26
|
size={size}
|
|
27
27
|
startIcon={icon}
|
|
28
28
|
hasIconOnly={hasIconOnly}
|
|
29
|
-
disableRipple
|
|
30
|
-
disableFocusRipple
|
|
31
29
|
{...buttonProps}
|
|
32
30
|
>
|
|
33
31
|
{!hasIconOnly && <>{children}</>}
|
|
@@ -40,8 +38,6 @@ const Button = (props: Omit<ButtonProps, "hasIconOnly">) => {
|
|
|
40
38
|
size={size}
|
|
41
39
|
startIcon={icon}
|
|
42
40
|
hasIconOnly={hasIconOnly}
|
|
43
|
-
disableRipple
|
|
44
|
-
disableFocusRipple
|
|
45
41
|
{...buttonProps}
|
|
46
42
|
>
|
|
47
43
|
{!hasIconOnly && <>{children}</>}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { ButtonProps as MuiButtonProps } from "@mui/material";
|
|
2
2
|
|
|
3
|
-
interface BaseButtonProps extends MuiButtonProps {
|
|
3
|
+
interface BaseButtonProps extends Omit<MuiButtonProps, "variant"> {
|
|
4
4
|
icon?: React.ReactNode;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
interface ContainedButtonProps extends
|
|
7
|
+
interface ContainedButtonProps extends BaseButtonProps {
|
|
8
8
|
kind?: "contained";
|
|
9
9
|
color?: "primary" | "secondary" | "error";
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
interface GhostButtonProps extends
|
|
12
|
+
interface GhostButtonProps extends BaseButtonProps {
|
|
13
13
|
kind?: "ghost";
|
|
14
14
|
color?: "primary" | "secondary" | "error";
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
interface OutlinedButtonProps extends
|
|
17
|
+
interface OutlinedButtonProps extends BaseButtonProps {
|
|
18
18
|
kind?: "outlined";
|
|
19
19
|
color?: "primary";
|
|
20
20
|
}
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
ChipColor,
|
|
7
7
|
OutlinedChipProps,
|
|
8
8
|
BaseContainedChipProps,
|
|
9
|
+
EnableContainedChipProps,
|
|
9
10
|
} from "./Chip.types";
|
|
10
11
|
|
|
11
12
|
const COMMON_STYLES = {
|
|
@@ -13,6 +14,7 @@ const COMMON_STYLES = {
|
|
|
13
14
|
height: "22px",
|
|
14
15
|
width: "auto",
|
|
15
16
|
minWidth: "22px",
|
|
17
|
+
boxShadow: "none",
|
|
16
18
|
},
|
|
17
19
|
"&.Mui-disabled": {
|
|
18
20
|
opacity: 1,
|
|
@@ -110,7 +112,7 @@ export const StyledContainedChipBase = styled(MuiChip, {
|
|
|
110
112
|
|
|
111
113
|
export const StyledContainedChipEnable = styled(StyledContainedChipBase, {
|
|
112
114
|
shouldForwardProp: (prop) => !["color"].includes(prop.toString()),
|
|
113
|
-
})<
|
|
115
|
+
})<EnableContainedChipProps>(() => ({ theme, color }) => ({
|
|
114
116
|
/**
|
|
115
117
|
* Setting the z-index of the chip to 0 and the z-index of the pseudo element to -1
|
|
116
118
|
* allows the pseudo element(hover layer) to be rendered between the chip and the chip's children.
|
|
@@ -137,9 +139,9 @@ export const StyledContainedChipEnable = styled(StyledContainedChipBase, {
|
|
|
137
139
|
},
|
|
138
140
|
}));
|
|
139
141
|
|
|
140
|
-
export const StyledContainedChipDeletable = styled(
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
export const StyledContainedChipDeletable = styled(
|
|
143
|
+
StyledContainedChipBase
|
|
144
|
+
)<BaseContainedChipProps>(() => ({ theme }) => ({
|
|
143
145
|
"& .MuiChip-deleteIcon": {
|
|
144
146
|
marginLeft: "4px",
|
|
145
147
|
marginRight: "3px",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CHIP_COLORS } from "./consts";
|
|
2
2
|
|
|
3
|
-
import type { ChipProps as MuiChipProps
|
|
3
|
+
import type { ChipProps as MuiChipProps } from "@mui/material";
|
|
4
4
|
|
|
5
5
|
type ColorKeys = keyof typeof CHIP_COLORS;
|
|
6
|
-
export type ChipColor = typeof CHIP_COLORS[ColorKeys];
|
|
6
|
+
export type ChipColor = (typeof CHIP_COLORS)[ColorKeys];
|
|
7
7
|
export type ChipThumbnail = string | JSX.Element;
|
|
8
8
|
|
|
9
9
|
/**
|