@lunit/design-system 1.0.0-b.2 → 1.0.0-b.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/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/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/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/components/Button/Button.js +11 -5
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.styled.js +2 -8
- package/dist/components/Button/Button.styled.js.map +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.style.js +1 -0
- package/dist/components/TextField/TextField.style.js.map +1 -1
- package/dist/components/Toggle/Toggle.js +4 -4
- package/dist/components/Toggle/Toggle.js.map +1 -1
- package/dist/components/Toggle/Toggle.styled.js +2 -3
- package/dist/components/Toggle/Toggle.styled.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.js +6 -5
- package/dist/components/ToggleButton/ToggleButton.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.styled.js +10 -2
- package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -1
- package/dist/foundation/Typography/index.js +2 -2
- package/dist/foundation/Typography/index.js.map +1 -1
- package/dist/foundation/Typography/tokens.js +18 -2
- package/dist/foundation/Typography/tokens.js.map +1 -1
- package/dist/foundation/colors/token/core.js +0 -2
- package/dist/foundation/colors/token/core.js.map +1 -1
- package/dist/types/components/Button/Button.styled.d.ts +3 -8
- package/dist/types/components/Chip/Chip.styled.d.ts +12 -12
- package/dist/types/components/Toggle/Toggle.d.ts +1 -1
- package/dist/types/components/Toggle/Toggle.styled.d.ts +1 -1
- package/dist/types/components/Toggle/Toggle.types.d.ts +5 -5
- package/dist/types/components/ToggleButton/ToggleButton.d.ts +2 -2
- package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +6 -2
- package/dist/types/components/ToggleButton/ToggleButton.types.d.ts +4 -5
- package/dist/types/foundation/Typography/index.d.ts +3 -4
- package/dist/types/foundation/Typography/tokens.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/Button/Button.styled.ts +2 -8
- package/src/components/Button/Button.tsx +14 -6
- package/src/components/TextField/TextField.style.ts +1 -0
- package/src/components/TextField/TextField.tsx +1 -1
- package/src/components/Toggle/Toggle.styled.ts +4 -4
- package/src/components/Toggle/Toggle.tsx +28 -9
- package/src/components/Toggle/Toggle.types.ts +8 -8
- package/src/components/ToggleButton/ToggleButton.styled.ts +15 -7
- package/src/components/ToggleButton/ToggleButton.tsx +92 -79
- package/src/components/ToggleButton/ToggleButton.types.ts +5 -4
- package/src/foundation/Typography/index.ts +2 -2
- package/src/foundation/Typography/tokens.ts +18 -2
- package/src/foundation/colors/token/core.ts +0 -2
- package/src/stories/components/SelectControl/Toggle.stories.tsx +10 -10
|
@@ -6,7 +6,7 @@ export declare const StyledOutlinedChip: import("@emotion/styled").StyledCompone
|
|
|
6
6
|
children?: null | undefined;
|
|
7
7
|
classes?: Partial<import("@mui/material").ChipClasses> | undefined;
|
|
8
8
|
clickable?: boolean | undefined;
|
|
9
|
-
color?: "
|
|
9
|
+
color?: "success" | "info" | "warning" | "error" | "default" | "primary" | "secondary" | undefined;
|
|
10
10
|
deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
11
11
|
disabled?: boolean | undefined;
|
|
12
12
|
icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
@@ -16,16 +16,16 @@ export declare const StyledOutlinedChip: import("@emotion/styled").StyledCompone
|
|
|
16
16
|
skipFocusWhenDisabled?: boolean | undefined;
|
|
17
17
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
18
18
|
tabIndex?: number | undefined;
|
|
19
|
-
variant?: "
|
|
19
|
+
variant?: "filled" | "outlined" | undefined;
|
|
20
20
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
21
21
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
22
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "
|
|
22
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "label" | "tabIndex" | "color" | "icon" | "disabled" | "size" | "avatar" | "clickable" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled"> & import("@mui/system").MUIStyledCommonProps<Theme> & OutlinedChipProps, {}, {}>;
|
|
23
23
|
export declare const StyledContainedChipBase: import("@emotion/styled").StyledComponent<{
|
|
24
24
|
avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
25
25
|
children?: null | undefined;
|
|
26
26
|
classes?: Partial<import("@mui/material").ChipClasses> | undefined;
|
|
27
27
|
clickable?: boolean | undefined;
|
|
28
|
-
color?: "
|
|
28
|
+
color?: "success" | "info" | "warning" | "error" | "default" | "primary" | "secondary" | undefined;
|
|
29
29
|
deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
30
30
|
disabled?: boolean | undefined;
|
|
31
31
|
icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
@@ -35,16 +35,16 @@ export declare const StyledContainedChipBase: import("@emotion/styled").StyledCo
|
|
|
35
35
|
skipFocusWhenDisabled?: boolean | undefined;
|
|
36
36
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
37
37
|
tabIndex?: number | undefined;
|
|
38
|
-
variant?: "
|
|
38
|
+
variant?: "filled" | "outlined" | undefined;
|
|
39
39
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
40
40
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
41
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "
|
|
41
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "label" | "tabIndex" | "color" | "icon" | "disabled" | "size" | "avatar" | "clickable" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
|
|
42
42
|
export declare const StyledContainedChipEnable: import("@emotion/styled").StyledComponent<{
|
|
43
43
|
avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
44
44
|
children?: null | undefined;
|
|
45
45
|
classes?: Partial<import("@mui/material").ChipClasses> | undefined;
|
|
46
46
|
clickable?: boolean | undefined;
|
|
47
|
-
color?: "
|
|
47
|
+
color?: "success" | "info" | "warning" | "error" | "default" | "primary" | "secondary" | undefined;
|
|
48
48
|
deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
49
49
|
disabled?: boolean | undefined;
|
|
50
50
|
icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
@@ -54,16 +54,16 @@ export declare const StyledContainedChipEnable: import("@emotion/styled").Styled
|
|
|
54
54
|
skipFocusWhenDisabled?: boolean | undefined;
|
|
55
55
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
56
56
|
tabIndex?: number | undefined;
|
|
57
|
-
variant?: "
|
|
57
|
+
variant?: "filled" | "outlined" | undefined;
|
|
58
58
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
59
59
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
60
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "
|
|
60
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "label" | "tabIndex" | "color" | "icon" | "disabled" | "size" | "avatar" | "clickable" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps & EnableContainedChipProps, {}, {}>;
|
|
61
61
|
export declare const StyledContainedChipDeletable: import("@emotion/styled").StyledComponent<{
|
|
62
62
|
avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
63
63
|
children?: null | undefined;
|
|
64
64
|
classes?: Partial<import("@mui/material").ChipClasses> | undefined;
|
|
65
65
|
clickable?: boolean | undefined;
|
|
66
|
-
color?: "
|
|
66
|
+
color?: "success" | "info" | "warning" | "error" | "default" | "primary" | "secondary" | undefined;
|
|
67
67
|
deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
68
68
|
disabled?: boolean | undefined;
|
|
69
69
|
icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
@@ -73,7 +73,7 @@ export declare const StyledContainedChipDeletable: import("@emotion/styled").Sty
|
|
|
73
73
|
skipFocusWhenDisabled?: boolean | undefined;
|
|
74
74
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
75
75
|
tabIndex?: number | undefined;
|
|
76
|
-
variant?: "
|
|
76
|
+
variant?: "filled" | "outlined" | undefined;
|
|
77
77
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
78
78
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
79
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "
|
|
79
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "label" | "tabIndex" | "color" | "icon" | "disabled" | "size" | "avatar" | "clickable" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SwitchProps } from "@mui/material";
|
|
2
2
|
interface ToggleProps extends SwitchProps {
|
|
3
|
-
toggleSize: "
|
|
3
|
+
toggleSize: "small" | "large";
|
|
4
4
|
}
|
|
5
5
|
export declare const CommonToggle: import("@emotion/styled").StyledComponent<SwitchProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & ToggleProps, {}, {}>;
|
|
6
6
|
export declare const CommonIndeterminateToggle: import("@emotion/styled").StyledComponent<SwitchProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & ToggleProps, {}, {}>;
|
|
@@ -2,12 +2,12 @@ import type { SwitchProps } from "@mui/material";
|
|
|
2
2
|
export interface ToggleProps extends Omit<SwitchProps, "size"> {
|
|
3
3
|
/**
|
|
4
4
|
* The size of the component.
|
|
5
|
-
* @default
|
|
5
|
+
* @default small
|
|
6
6
|
*/
|
|
7
|
-
size?:
|
|
7
|
+
size?: "small" | "large";
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
* If `true`, the component has consistent 'checked' value and change shape.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
12
|
indeterminate?: boolean;
|
|
13
13
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const ToggleButton: (
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const ToggleButton: React.ForwardRefExoticComponent<(Omit<import("./ToggleButton.types").ContainedToggleButtonProps, "ref"> | Omit<import("./ToggleButton.types").GhostToggleButtonProps, "ref"> | Omit<import("./ToggleButton.types").OutlinedToggleButtonProps, "ref">) & React.RefAttributes<HTMLButtonElement>>;
|
|
3
3
|
export default ToggleButton;
|
|
@@ -6,7 +6,7 @@ type CustomToggleButtonProps = ToggleButtonProps & {
|
|
|
6
6
|
export declare const CustomToggleButton: import("@emotion/styled").StyledComponent<{
|
|
7
7
|
children?: import("react").ReactNode;
|
|
8
8
|
classes?: Partial<import("@mui/material").ToggleButtonClasses> | undefined;
|
|
9
|
-
color?: "
|
|
9
|
+
color?: "success" | "info" | "warning" | "error" | "standard" | "primary" | "secondary" | undefined;
|
|
10
10
|
disabled?: boolean | undefined;
|
|
11
11
|
disableFocusRipple?: boolean | undefined;
|
|
12
12
|
fullWidth?: boolean | undefined;
|
|
@@ -34,6 +34,10 @@ export declare const CustomToggleButton: import("@emotion/styled").StyledCompone
|
|
|
34
34
|
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
35
35
|
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
36
36
|
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
37
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "
|
|
37
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "tabIndex" | "color" | "onChange" | "onClick" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "fullWidth" | "size" | "value" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & CustomToggleButtonProps, {}, {}>;
|
|
38
38
|
export declare const IconAndChildrenWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
39
|
+
export declare const IconWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
40
|
+
hasIconOnly: boolean;
|
|
41
|
+
size: string;
|
|
42
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
39
43
|
export {};
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ToggleButtonProps as MuiToggleButtonProps } from "@mui/material";
|
|
3
|
-
interface ToggleButtonBaseProps extends Omit<MuiToggleButtonProps, "variant"> {
|
|
3
|
+
export interface ToggleButtonBaseProps extends Omit<MuiToggleButtonProps, "variant"> {
|
|
4
4
|
selectedColor?: "primary" | "secondary";
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
interface ContainedToggleButtonProps extends ToggleButtonBaseProps {
|
|
7
|
+
export interface ContainedToggleButtonProps extends ToggleButtonBaseProps {
|
|
8
8
|
kind?: "contained";
|
|
9
9
|
color?: "primary" | "secondary";
|
|
10
10
|
}
|
|
11
|
-
interface GhostToggleButtonProps extends ToggleButtonBaseProps {
|
|
11
|
+
export interface GhostToggleButtonProps extends ToggleButtonBaseProps {
|
|
12
12
|
kind?: "ghost";
|
|
13
13
|
color?: "primary" | "secondary";
|
|
14
14
|
}
|
|
15
|
-
interface OutlinedToggleButtonProps extends ToggleButtonBaseProps {
|
|
15
|
+
export interface OutlinedToggleButtonProps extends ToggleButtonBaseProps {
|
|
16
16
|
kind?: "outlined";
|
|
17
17
|
color?: "primary";
|
|
18
18
|
}
|
|
19
19
|
export type ToggleButtonProps = ContainedToggleButtonProps | GhostToggleButtonProps | OutlinedToggleButtonProps;
|
|
20
|
-
export {};
|
|
@@ -27,8 +27,7 @@ export declare const typographyDefaultProps: {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
export declare const createTypographyCssBaseline: () => {
|
|
30
|
-
|
|
31
|
-
fontFamily: string;
|
|
30
|
+
"*, *:before, *:after": {
|
|
32
31
|
fontFeatureSettings: string;
|
|
33
32
|
};
|
|
34
33
|
":root": {
|
|
@@ -70,10 +69,10 @@ export declare const createTypographyCssBaseline: () => {
|
|
|
70
69
|
"--headline1-line-height": "68px";
|
|
71
70
|
"--headline2-font-weight": "var(--font-weight-bold)";
|
|
72
71
|
"--headline2-font-size": "38px";
|
|
73
|
-
"--headline2-line-height": "
|
|
72
|
+
"--headline2-line-height": "65px";
|
|
74
73
|
"--headline3-font-weight": "var(--font-weight-semibold)";
|
|
75
74
|
"--headline3-font-size": "24px";
|
|
76
|
-
"--headline3-line-height": "
|
|
75
|
+
"--headline3-line-height": "57px";
|
|
77
76
|
"--headline4-font-weight": "var(--font-weight-semibold)";
|
|
78
77
|
"--headline4-font-size": "20px";
|
|
79
78
|
"--headline4-line-height": "28px";
|
|
@@ -39,10 +39,10 @@ export declare const cssVariables: {
|
|
|
39
39
|
"--headline1-line-height": "68px";
|
|
40
40
|
"--headline2-font-weight": "var(--font-weight-bold)";
|
|
41
41
|
"--headline2-font-size": "38px";
|
|
42
|
-
"--headline2-line-height": "
|
|
42
|
+
"--headline2-line-height": "65px";
|
|
43
43
|
"--headline3-font-weight": "var(--font-weight-semibold)";
|
|
44
44
|
"--headline3-font-size": "24px";
|
|
45
|
-
"--headline3-line-height": "
|
|
45
|
+
"--headline3-line-height": "57px";
|
|
46
46
|
"--headline4-font-weight": "var(--font-weight-semibold)";
|
|
47
47
|
"--headline4-font-size": "20px";
|
|
48
48
|
"--headline4-line-height": "28px";
|
package/package.json
CHANGED
|
@@ -213,20 +213,14 @@ export const iconStyle = ({
|
|
|
213
213
|
"& .MuiButton-startIcon": {
|
|
214
214
|
width: "20px",
|
|
215
215
|
height: "20px",
|
|
216
|
+
padding: "1px",
|
|
216
217
|
margin: 0,
|
|
217
218
|
marginRight: hasIconOnly ? "0px" : size === "large" ? "8px" : "4px",
|
|
218
219
|
|
|
219
|
-
// This style was added for Mui Button Svg Icon handling
|
|
220
220
|
"*:nth-of-type(1)": {
|
|
221
|
-
fontSize: "
|
|
221
|
+
fontSize: "18px",
|
|
222
222
|
},
|
|
223
223
|
},
|
|
224
|
-
svg: {
|
|
225
|
-
width: "20px",
|
|
226
|
-
height: "20px",
|
|
227
|
-
margin: 0,
|
|
228
|
-
marginRight: hasIconOnly ? "0px" : size === "large" ? "8px" : "4px",
|
|
229
|
-
},
|
|
230
224
|
});
|
|
231
225
|
|
|
232
226
|
export const CustomButton = styled(MuiButton, {
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
|
|
3
3
|
import { CustomButton } from "./Button.styled";
|
|
4
4
|
|
|
5
5
|
import type { ButtonType, ButtonProps } from "./Button.types";
|
|
6
6
|
|
|
7
|
-
const Button
|
|
7
|
+
const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
size = "small",
|
|
10
10
|
color = "primary",
|
|
11
11
|
icon,
|
|
12
12
|
className,
|
|
13
13
|
children,
|
|
14
|
+
startIcon,
|
|
14
15
|
...buttonProps
|
|
15
16
|
} = props;
|
|
16
|
-
const hasIconOnly = Boolean(icon && !children);
|
|
17
|
+
const hasIconOnly = Boolean((startIcon || icon) && !children);
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
20
|
<>
|
|
@@ -21,11 +22,12 @@ const Button: ButtonType = (props: ButtonProps) => {
|
|
|
21
22
|
{props.kind === "outlined" ? (
|
|
22
23
|
<CustomButton
|
|
23
24
|
{...buttonProps}
|
|
25
|
+
ref={ref}
|
|
24
26
|
className={`outlined ${className ? className : ""}`}
|
|
25
27
|
kind="outlined"
|
|
26
28
|
color={props.color ?? "primary"}
|
|
27
29
|
size={size}
|
|
28
|
-
startIcon={icon}
|
|
30
|
+
startIcon={startIcon || icon}
|
|
29
31
|
hasIconOnly={hasIconOnly}
|
|
30
32
|
>
|
|
31
33
|
{!hasIconOnly && <>{children}</>}
|
|
@@ -33,13 +35,14 @@ const Button: ButtonType = (props: ButtonProps) => {
|
|
|
33
35
|
) : (
|
|
34
36
|
<CustomButton
|
|
35
37
|
{...buttonProps}
|
|
38
|
+
ref={ref}
|
|
36
39
|
className={`${props.kind ?? "contained"} ${
|
|
37
40
|
className ? className : ""
|
|
38
41
|
}`}
|
|
39
42
|
kind={props.kind ?? "contained"}
|
|
40
43
|
color={props.color ?? "primary"}
|
|
41
44
|
size={size}
|
|
42
|
-
startIcon={icon}
|
|
45
|
+
startIcon={startIcon || icon}
|
|
43
46
|
hasIconOnly={hasIconOnly}
|
|
44
47
|
>
|
|
45
48
|
{!hasIconOnly && <>{children}</>}
|
|
@@ -47,6 +50,11 @@ const Button: ButtonType = (props: ButtonProps) => {
|
|
|
47
50
|
)}
|
|
48
51
|
</>
|
|
49
52
|
);
|
|
50
|
-
|
|
53
|
+
/**
|
|
54
|
+
* There is an issue between React 18, Mui's OverridableComponent type and the
|
|
55
|
+
* type coercion to temporarily fix it.
|
|
56
|
+
* https://github.com/lunit-io/design-system/pull/143#issuecomment-1831127232
|
|
57
|
+
*/
|
|
58
|
+
}) as ButtonType;
|
|
51
59
|
|
|
52
60
|
export default Button;
|
|
@@ -55,7 +55,7 @@ const SingleTextField = forwardRef<HTMLDivElement, SingleTextFieldProps>(
|
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
const MultiTextField = forwardRef<HTMLDivElement, MultiTextFieldProps>(
|
|
58
|
-
({ size = "small",
|
|
58
|
+
({ size = "small", ...restProps }, ref) => {
|
|
59
59
|
return (
|
|
60
60
|
<BaseTextField {...restProps} ref={ref} textFieldSize={size} multiline />
|
|
61
61
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { styled, Switch as MuiSwitch, SwitchProps } from "@mui/material";
|
|
2
2
|
interface ToggleProps extends SwitchProps {
|
|
3
|
-
toggleSize: "
|
|
3
|
+
toggleSize: "small" | "large";
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
const toggleStyles = {
|
|
7
|
-
|
|
7
|
+
small: {
|
|
8
8
|
root: {
|
|
9
9
|
width: 28,
|
|
10
10
|
height: 18,
|
|
@@ -65,7 +65,7 @@ const indeterminateStyles = {
|
|
|
65
65
|
borderRadius: 2,
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
|
-
|
|
68
|
+
small: {
|
|
69
69
|
switchChecked: {
|
|
70
70
|
top: 6,
|
|
71
71
|
left: -4,
|
|
@@ -94,7 +94,7 @@ export const CommonToggle = styled(MuiSwitch, {
|
|
|
94
94
|
|
|
95
95
|
return {
|
|
96
96
|
...toggleStyle.root,
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
padding: 0,
|
|
99
99
|
overflow: "visible",
|
|
100
100
|
backgroundColor: "transparent",
|
|
@@ -1,18 +1,37 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { CommonToggle, CommonIndeterminateToggle } from
|
|
3
|
-
import type { ToggleProps } from
|
|
4
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CommonToggle, CommonIndeterminateToggle } from "./Toggle.styled";
|
|
3
|
+
import type { ToggleProps } from "./Toggle.types";
|
|
5
4
|
|
|
6
5
|
const Toggle = (props: ToggleProps) => {
|
|
7
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
size = "small",
|
|
8
|
+
indeterminate = false,
|
|
9
|
+
disableRipple,
|
|
10
|
+
...switchProps
|
|
11
|
+
} = props;
|
|
8
12
|
|
|
9
13
|
if (indeterminate) {
|
|
10
14
|
const { checked: _, ...restProps } = switchProps;
|
|
11
15
|
// can't use checked props with indeterminate
|
|
12
|
-
|
|
16
|
+
return (
|
|
17
|
+
<CommonIndeterminateToggle
|
|
18
|
+
toggleSize={size}
|
|
19
|
+
checked
|
|
20
|
+
focusRipple={false}
|
|
21
|
+
disableRipple={disableRipple}
|
|
22
|
+
{...restProps}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
13
25
|
}
|
|
14
26
|
|
|
15
|
-
return
|
|
16
|
-
|
|
27
|
+
return (
|
|
28
|
+
<CommonToggle
|
|
29
|
+
toggleSize={size}
|
|
30
|
+
focusRipple={false}
|
|
31
|
+
disableRipple={disableRipple}
|
|
32
|
+
{...switchProps}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
17
36
|
|
|
18
|
-
export default Toggle
|
|
37
|
+
export default Toggle;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { SwitchProps } from "@mui/material"
|
|
1
|
+
import type { SwitchProps } from "@mui/material";
|
|
2
2
|
|
|
3
|
-
export interface ToggleProps extends Omit<SwitchProps, "size"
|
|
3
|
+
export interface ToggleProps extends Omit<SwitchProps, "size"> {
|
|
4
4
|
/**
|
|
5
5
|
* The size of the component.
|
|
6
|
-
* @default
|
|
6
|
+
* @default small
|
|
7
7
|
*/
|
|
8
|
-
size?:
|
|
8
|
+
size?: "small" | "large";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
indeterminate?: boolean
|
|
10
|
+
* If `true`, the component has consistent 'checked' value and change shape.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
indeterminate?: boolean;
|
|
14
14
|
}
|
|
@@ -2,12 +2,7 @@ import { styled } from "@mui/material/styles";
|
|
|
2
2
|
import { ToggleButton as MuiToggleButton } from "@mui/material";
|
|
3
3
|
|
|
4
4
|
import type { ToggleButtonProps } from "../ToggleButton/ToggleButton.types";
|
|
5
|
-
import {
|
|
6
|
-
commonStyle,
|
|
7
|
-
sizeStyle,
|
|
8
|
-
kindStyle,
|
|
9
|
-
iconStyle,
|
|
10
|
-
} from "../Button/Button.styled";
|
|
5
|
+
import { commonStyle, sizeStyle, kindStyle } from "../Button/Button.styled";
|
|
11
6
|
|
|
12
7
|
type CustomToggleButtonProps = ToggleButtonProps & { hasIconOnly: boolean };
|
|
13
8
|
|
|
@@ -31,7 +26,6 @@ export const CustomToggleButton = styled(MuiToggleButton, {
|
|
|
31
26
|
return {
|
|
32
27
|
border: "none",
|
|
33
28
|
...commonStyle({ lunit_token }),
|
|
34
|
-
...iconStyle({ size, hasIconOnly }),
|
|
35
29
|
...sizeStyle({ size, kind, hasIconOnly, selected, typography }),
|
|
36
30
|
...kindStyle({ kind, color, lunit_token }),
|
|
37
31
|
...(selectedColor === "primary" && {
|
|
@@ -56,3 +50,17 @@ export const IconAndChildrenWrapper = styled("div")({
|
|
|
56
50
|
display: "flex",
|
|
57
51
|
alignItems: "center",
|
|
58
52
|
});
|
|
53
|
+
|
|
54
|
+
export const IconWrapper = styled("div")<{
|
|
55
|
+
hasIconOnly: boolean;
|
|
56
|
+
size: string;
|
|
57
|
+
}>(({ hasIconOnly, size }) => ({
|
|
58
|
+
width: "20px",
|
|
59
|
+
height: "20px",
|
|
60
|
+
padding: "1px",
|
|
61
|
+
marginRight: hasIconOnly ? "0px" : size === "large" ? "8px" : "4px",
|
|
62
|
+
|
|
63
|
+
"*:nth-of-type(1)": {
|
|
64
|
+
fontSize: "18px",
|
|
65
|
+
},
|
|
66
|
+
}));
|