@lunit/design-system 1.0.0-a.5 → 1.0.0-b.2
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/README.md +1 -1
- 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/Radio/index.js +1 -1
- package/dist/cjs/components/Radio/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/Typography/index.js +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.styled.js +2 -2
- package/dist/components/Alert/Alert.styled.js.map +1 -1
- package/dist/components/Alert/Alert.utils.js +12 -12
- package/dist/components/Alert/Alert.utils.js.map +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.styled.js +36 -36
- package/dist/components/Button/Button.styled.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +4 -4
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Chip/Chip.js +1 -1
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Chip/Chip.styled.js +15 -15
- package/dist/components/Chip/Chip.styled.js.map +1 -1
- package/dist/components/Radio/Radio.js +3 -3
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/TextField/TextField.js +16 -12
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.style.js +30 -32
- package/dist/components/TextField/TextField.style.js.map +1 -1
- package/dist/components/Toast/Toast.styled.js +3 -3
- package/dist/components/Toast/Toast.styled.js.map +1 -1
- package/dist/components/Toast/Toast.utils.js +4 -4
- package/dist/components/Toast/Toast.utils.js.map +1 -1
- package/dist/components/Toggle/Toggle.styled.js +20 -20
- package/dist/components/Toggle/Toggle.styled.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.styled.js +7 -7
- package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -1
- package/dist/components/Typography/Typography.js +7 -0
- package/dist/components/Typography/Typography.js.map +1 -0
- package/dist/components/Typography/index.js +1 -2
- package/dist/components/Typography/index.js.map +1 -1
- package/dist/foundation/Elevation/index.js +4 -4
- package/dist/foundation/Elevation/index.js.map +1 -1
- package/dist/foundation/colors/index.js +3 -2
- package/dist/foundation/colors/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/theme.js +3 -2
- package/dist/theme.js.map +1 -1
- package/dist/types/components/Button/Button.d.ts +2 -2
- package/dist/types/components/Button/Button.styled.d.ts +7 -7
- package/dist/types/components/Button/Button.types.d.ts +11 -1
- package/dist/types/components/Chip/Chip.d.ts +2 -2
- package/dist/types/components/Chip/Chip.styled.d.ts +4 -4
- package/dist/types/components/Chip/Chip.types.d.ts +7 -1
- package/dist/types/components/TextField/TextField.d.ts +3 -2
- package/dist/types/components/Toggle/Toggle.styled.d.ts +1 -1
- package/dist/types/components/Typography/Typography.d.ts +11 -0
- package/dist/types/components/Typography/index.d.ts +1 -7
- package/dist/types/foundation/colors/index.d.ts +9 -6
- package/dist/types/foundation/index.d.ts +3 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/theme.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/Alert/Alert.styled.ts +2 -2
- package/src/components/Alert/Alert.utils.ts +12 -12
- package/src/components/Button/Button.styled.ts +37 -37
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Button/Button.types.ts +19 -1
- package/src/components/Checkbox/Checkbox.tsx +4 -4
- package/src/components/Chip/Chip.styled.ts +15 -15
- package/src/components/Chip/Chip.tsx +10 -2
- package/src/components/Chip/Chip.types.ts +15 -1
- package/src/components/Radio/Radio.tsx +3 -3
- package/src/components/TextField/TextField.style.ts +31 -33
- package/src/components/TextField/TextField.tsx +55 -47
- package/src/components/Toast/Toast.styled.ts +3 -3
- package/src/components/Toast/Toast.utils.ts +4 -4
- package/src/components/Toggle/Toggle.styled.ts +42 -39
- package/src/components/ToggleButton/ToggleButton.styled.ts +7 -7
- package/src/components/Typography/Typography.tsx +18 -0
- package/src/components/Typography/index.ts +1 -9
- package/src/foundation/Elevation/index.ts +4 -4
- package/src/foundation/colors/index.ts +31 -26
- package/src/index.ts +1 -1
- package/src/stories/components/Alert/Alert.stories.tsx +1 -1
- package/src/stories/components/Button/BasicButton.stories.tsx +1 -3
- package/src/stories/components/TextField/TextFieldMulti.stories.tsx +6 -0
- package/src/stories/components/TextField/TextFieldSingle.stories.tsx +24 -0
- package/src/stories/foundation/Typography/TypographyGroup.tsx +1 -1
- package/src/stories/foundation/colors/Colors.stories.tsx +3 -3
- package/src/stories/foundation/colors/Token.inComponent.stories.tsx +21 -19
- package/src/stories/foundation/colors/TokenPaletteTable.tsx +6 -4
- package/src/stories/foundation/colors/styled.ts +1 -1
- package/src/theme.ts +5 -3
|
@@ -4,7 +4,7 @@ import type { ButtonProps } from "./Button.types";
|
|
|
4
4
|
import type { ToggleButtonProps } from "../ToggleButton/ToggleButton.types";
|
|
5
5
|
import type { Typography } from "@mui/material/styles/createTypography";
|
|
6
6
|
type KindStyleParams = Pick<ButtonProps, "kind" | "color"> & {
|
|
7
|
-
|
|
7
|
+
lunit_token: ColorToken;
|
|
8
8
|
};
|
|
9
9
|
type CustomButtonProps = ButtonProps & {
|
|
10
10
|
hasIconOnly: boolean;
|
|
@@ -15,7 +15,7 @@ type sizeStyleParams = Pick<CustomButtonProps, "size" | "hasIconOnly" | "kind">
|
|
|
15
15
|
export declare const sizeStyle: ({ size, kind, hasIconOnly, typography, selected, }: sizeStyleParams) => {
|
|
16
16
|
padding?: string | undefined;
|
|
17
17
|
minWidth?: string | undefined;
|
|
18
|
-
|
|
18
|
+
height?: string | undefined;
|
|
19
19
|
accentColor?: import("csstype").Property.AccentColor | undefined;
|
|
20
20
|
alignContent?: import("csstype").Property.AlignContent | undefined;
|
|
21
21
|
alignItems?: import("csstype").Property.AlignItems | undefined;
|
|
@@ -172,7 +172,6 @@ export declare const sizeStyle: ({ size, kind, hasIconOnly, typography, selected
|
|
|
172
172
|
gridTemplateColumns?: string | number | undefined;
|
|
173
173
|
gridTemplateRows?: string | number | undefined;
|
|
174
174
|
hangingPunctuation?: import("csstype").Property.HangingPunctuation | undefined;
|
|
175
|
-
height?: string | number | undefined;
|
|
176
175
|
hyphenateCharacter?: import("csstype").Property.HyphenateCharacter | undefined;
|
|
177
176
|
hyphenateLimitChars?: import("csstype").Property.HyphenateLimitChars | undefined;
|
|
178
177
|
hyphens?: import("csstype").Property.Hyphens | undefined;
|
|
@@ -232,6 +231,7 @@ export declare const sizeStyle: ({ size, kind, hasIconOnly, typography, selected
|
|
|
232
231
|
maxLines?: import("csstype").Property.MaxLines | undefined;
|
|
233
232
|
maxWidth?: string | number | undefined;
|
|
234
233
|
minBlockSize?: string | number | undefined;
|
|
234
|
+
minHeight?: string | number | undefined;
|
|
235
235
|
minInlineSize?: string | number | undefined;
|
|
236
236
|
mixBlendMode?: import("csstype").Property.MixBlendMode | undefined;
|
|
237
237
|
motionDistance?: string | number | undefined;
|
|
@@ -822,7 +822,7 @@ export declare const sizeStyle: ({ size, kind, hasIconOnly, typography, selected
|
|
|
822
822
|
textAnchor?: import("csstype").Property.TextAnchor | undefined;
|
|
823
823
|
vectorEffect?: import("csstype").Property.VectorEffect | undefined;
|
|
824
824
|
};
|
|
825
|
-
export declare const kindStyle: ({ kind, color,
|
|
825
|
+
export declare const kindStyle: ({ kind, color, lunit_token }: KindStyleParams) => {
|
|
826
826
|
color?: import("csstype").Property.Color | undefined;
|
|
827
827
|
border?: string | undefined;
|
|
828
828
|
"&:hover"?: {
|
|
@@ -852,8 +852,8 @@ export declare const kindStyle: ({ kind, color, token }: KindStyleParams) => {
|
|
|
852
852
|
} | undefined;
|
|
853
853
|
backgroundColor?: import("csstype").Property.Color | undefined;
|
|
854
854
|
};
|
|
855
|
-
export declare const commonStyle: ({
|
|
856
|
-
|
|
855
|
+
export declare const commonStyle: ({ lunit_token }: {
|
|
856
|
+
lunit_token: ColorToken;
|
|
857
857
|
}) => {
|
|
858
858
|
readonly fontWeight: "500";
|
|
859
859
|
readonly borderRadius: "8px";
|
|
@@ -911,7 +911,7 @@ export declare const CustomButton: import("@emotion/styled").StyledComponent<{
|
|
|
911
911
|
size?: "small" | "medium" | "large" | undefined;
|
|
912
912
|
startIcon?: import("react").ReactNode;
|
|
913
913
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
914
|
-
variant?: "text" | "
|
|
914
|
+
variant?: "text" | "outlined" | "contained" | undefined;
|
|
915
915
|
} & Omit<{
|
|
916
916
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
917
917
|
centerRipple?: boolean | undefined;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { ButtonProps as MuiButtonProps } from "@mui/material";
|
|
2
|
+
import type { ButtonProps as MuiButtonProps, ButtonTypeMap as MuiButtonTypeMap } from "@mui/material";
|
|
3
|
+
import type { OverridableComponent } from "@mui/material/OverridableComponent";
|
|
4
|
+
/**
|
|
5
|
+
* TODO: Omit 을 사용할 경우 component prop 타입 추론이 안되는 이슈 발생
|
|
6
|
+
* https://github.com/lunit-io/design-system/pull/133#discussion_r1354277785
|
|
7
|
+
* */
|
|
3
8
|
interface BaseButtonProps extends Omit<MuiButtonProps, "variant"> {
|
|
4
9
|
icon?: React.ReactNode;
|
|
5
10
|
}
|
|
@@ -16,4 +21,9 @@ interface OutlinedButtonProps extends BaseButtonProps {
|
|
|
16
21
|
color?: "primary" | "secondary";
|
|
17
22
|
}
|
|
18
23
|
export type ButtonProps = ContainedButtonProps | GhostButtonProps | OutlinedButtonProps;
|
|
24
|
+
export type ButtonTypeMap<P = {}, D extends React.ElementType = MuiButtonTypeMap["defaultComponent"]> = {
|
|
25
|
+
props: P & ButtonProps;
|
|
26
|
+
defaultComponent: D;
|
|
27
|
+
};
|
|
28
|
+
export type ButtonType = OverridableComponent<ButtonTypeMap>;
|
|
19
29
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const Chip:
|
|
1
|
+
import type { ChipType } from "./Chip.types";
|
|
2
|
+
declare const Chip: ChipType;
|
|
3
3
|
export default Chip;
|
|
@@ -19,7 +19,7 @@ export declare const StyledOutlinedChip: import("@emotion/styled").StyledCompone
|
|
|
19
19
|
variant?: "outlined" | "filled" | 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
|
-
},
|
|
22
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "color" | "children" | "disabled" | "sx" | "size" | "variant" | "icon" | "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;
|
|
@@ -38,7 +38,7 @@ export declare const StyledContainedChipBase: import("@emotion/styled").StyledCo
|
|
|
38
38
|
variant?: "outlined" | "filled" | 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
|
-
},
|
|
41
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "color" | "children" | "disabled" | "sx" | "size" | "variant" | "icon" | "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;
|
|
@@ -57,7 +57,7 @@ export declare const StyledContainedChipEnable: import("@emotion/styled").Styled
|
|
|
57
57
|
variant?: "outlined" | "filled" | 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
|
-
},
|
|
60
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "color" | "children" | "disabled" | "sx" | "size" | "variant" | "icon" | "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;
|
|
@@ -76,4 +76,4 @@ export declare const StyledContainedChipDeletable: import("@emotion/styled").Sty
|
|
|
76
76
|
variant?: "outlined" | "filled" | 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
|
-
},
|
|
79
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "color" | "children" | "disabled" | "sx" | "size" | "variant" | "icon" | "avatar" | "clickable" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CHIP_COLORS } from "./consts";
|
|
3
|
-
import type { ChipProps as MuiChipProps } from "@mui/material";
|
|
3
|
+
import type { ChipProps as MuiChipProps, ChipTypeMap as MuiChipTypeMap } from "@mui/material";
|
|
4
|
+
import type { OverridableComponent } from "@mui/material/OverridableComponent";
|
|
4
5
|
type ColorKeys = keyof typeof CHIP_COLORS;
|
|
5
6
|
export type ChipColor = (typeof CHIP_COLORS)[ColorKeys];
|
|
6
7
|
export type ChipThumbnail = string | JSX.Element;
|
|
@@ -35,4 +36,9 @@ export interface DeletableContainedChipProps extends BaseContainedChipProps {
|
|
|
35
36
|
}
|
|
36
37
|
export type ContainedChipProps = EnableContainedChipProps | ReadOnlyContainedChipProps | DeletableContainedChipProps;
|
|
37
38
|
export type ChipProps = OutlinedChipProps | ContainedChipProps;
|
|
39
|
+
export type ChipTypeMap<P = {}, D extends React.ElementType = MuiChipTypeMap["defaultComponent"]> = {
|
|
40
|
+
props: P & ChipProps;
|
|
41
|
+
defaultComponent: D;
|
|
42
|
+
};
|
|
43
|
+
export type ChipType = OverridableComponent<ChipTypeMap>;
|
|
38
44
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MultiTextFieldProps, SingleTextFieldProps } from "./TextField.types";
|
|
3
|
+
declare const TextField: React.ForwardRefExoticComponent<(Omit<SingleTextFieldProps, "ref"> | Omit<MultiTextFieldProps, "ref">) & React.RefAttributes<HTMLDivElement>>;
|
|
3
4
|
export default TextField;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SwitchProps } from "@mui/material";
|
|
2
2
|
interface ToggleProps extends SwitchProps {
|
|
3
|
-
toggleSize:
|
|
3
|
+
toggleSize: "medium" | "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, {}, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { TypographyProps } from "@mui/material/Typography";
|
|
3
|
+
import type { TypographyPropsVariantOverridesType } from "../../foundation/Typography";
|
|
4
|
+
declare module "@mui/material/Typography" {
|
|
5
|
+
interface TypographyPropsVariantOverrides extends TypographyPropsVariantOverridesType {
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare const Typography: <C extends React.ElementType<any>>(props: TypographyProps<C, {
|
|
9
|
+
component?: C | undefined;
|
|
10
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Typography;
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { TypographyPropsVariantOverridesType } from "../../foundation/Typography";
|
|
3
|
-
declare module "@mui/material/Typography" {
|
|
4
|
-
interface TypographyPropsVariantOverrides extends TypographyPropsVariantOverridesType {
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export default Typography;
|
|
1
|
+
export { default } from "./Typography";
|
|
@@ -5,7 +5,7 @@ export type BaseColor = Record<keyof typeof base.blue, PaletteColor>;
|
|
|
5
5
|
export type GreyColor = Record<keyof typeof base.grey, PaletteColor>;
|
|
6
6
|
declare module "@mui/material/styles/createPalette" {
|
|
7
7
|
interface PaletteOptions {
|
|
8
|
-
|
|
8
|
+
lunit_global?: {
|
|
9
9
|
grey: GreyColor;
|
|
10
10
|
blue: BaseColor;
|
|
11
11
|
green: BaseColor;
|
|
@@ -13,13 +13,14 @@ declare module "@mui/material/styles/createPalette" {
|
|
|
13
13
|
lunit_teal: BaseColor;
|
|
14
14
|
magenta: BaseColor;
|
|
15
15
|
orange: BaseColor;
|
|
16
|
+
purple: BaseColor;
|
|
16
17
|
red: BaseColor;
|
|
17
18
|
yellow: BaseColor;
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
lunit_token?: ColorToken;
|
|
20
21
|
}
|
|
21
22
|
interface Palette {
|
|
22
|
-
|
|
23
|
+
lunit_global: {
|
|
23
24
|
grey: GreyColor;
|
|
24
25
|
blue: BaseColor;
|
|
25
26
|
green: BaseColor;
|
|
@@ -27,10 +28,11 @@ declare module "@mui/material/styles/createPalette" {
|
|
|
27
28
|
lunit_teal: BaseColor;
|
|
28
29
|
magenta: BaseColor;
|
|
29
30
|
orange: BaseColor;
|
|
31
|
+
purple: BaseColor;
|
|
30
32
|
red: BaseColor;
|
|
31
33
|
yellow: BaseColor;
|
|
32
34
|
};
|
|
33
|
-
|
|
35
|
+
lunit_token: ColorToken;
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
export declare const createColorCssBaseline: () => {
|
|
@@ -91,7 +93,7 @@ declare const paletteOptions: {
|
|
|
91
93
|
A400: string;
|
|
92
94
|
A700: string;
|
|
93
95
|
};
|
|
94
|
-
|
|
96
|
+
lunit_global: {
|
|
95
97
|
grey: GreyColor;
|
|
96
98
|
blue: BaseColor;
|
|
97
99
|
green: BaseColor;
|
|
@@ -99,10 +101,11 @@ declare const paletteOptions: {
|
|
|
99
101
|
lunit_teal: BaseColor;
|
|
100
102
|
magenta: BaseColor;
|
|
101
103
|
orange: BaseColor;
|
|
104
|
+
purple: BaseColor;
|
|
102
105
|
red: BaseColor;
|
|
103
106
|
yellow: BaseColor;
|
|
104
107
|
} | undefined;
|
|
105
|
-
|
|
108
|
+
lunit_token: {
|
|
106
109
|
core: {
|
|
107
110
|
bg_01: string;
|
|
108
111
|
bg_02: string;
|
|
@@ -38,7 +38,7 @@ export declare const palette: {
|
|
|
38
38
|
A400: string;
|
|
39
39
|
A700: string;
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
lunit_global: {
|
|
42
42
|
grey: import("./colors").GreyColor;
|
|
43
43
|
blue: import("./colors").BaseColor;
|
|
44
44
|
green: import("./colors").BaseColor;
|
|
@@ -46,10 +46,11 @@ export declare const palette: {
|
|
|
46
46
|
lunit_teal: import("./colors").BaseColor;
|
|
47
47
|
magenta: import("./colors").BaseColor;
|
|
48
48
|
orange: import("./colors").BaseColor;
|
|
49
|
+
purple: import("./colors").BaseColor;
|
|
49
50
|
red: import("./colors").BaseColor;
|
|
50
51
|
yellow: import("./colors").BaseColor;
|
|
51
52
|
} | undefined;
|
|
52
|
-
|
|
53
|
+
lunit_token: {
|
|
53
54
|
core: {
|
|
54
55
|
bg_01: string;
|
|
55
56
|
bg_02: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as theme } from "./theme";
|
|
1
|
+
export { default as theme, themeOptions } from "./theme";
|
|
2
2
|
export { base as baseColors } from "./foundation/colors";
|
|
3
3
|
export { default as Alert } from "./components/Alert";
|
|
4
4
|
export { default as Button } from "./components/Button";
|
package/dist/types/theme.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -50,12 +50,12 @@ export const StyledAlertTitle = styled(MuiAlertTitle)(({ theme }) => ({
|
|
|
50
50
|
fontWeight: 700,
|
|
51
51
|
fontSize: "14px",
|
|
52
52
|
lineHeight: "20px",
|
|
53
|
-
color: theme.palette.
|
|
53
|
+
color: theme.palette.lunit_token.core.text_normal,
|
|
54
54
|
},
|
|
55
55
|
}));
|
|
56
56
|
|
|
57
57
|
export const StyledAlertChildren = styled("div")(({ theme }) => ({
|
|
58
|
-
color: theme.palette.
|
|
58
|
+
color: theme.palette.lunit_token.core.text_normal,
|
|
59
59
|
}));
|
|
60
60
|
|
|
61
61
|
export const StyledBottomAction = styled("div")({
|
|
@@ -6,13 +6,13 @@ export const getBackgroundColor = (
|
|
|
6
6
|
) => {
|
|
7
7
|
switch (severity) {
|
|
8
8
|
case "info":
|
|
9
|
-
return theme.palette.
|
|
9
|
+
return theme.palette.lunit_token.component.alert_info_bg;
|
|
10
10
|
case "warning":
|
|
11
|
-
return theme.palette.
|
|
11
|
+
return theme.palette.lunit_token.component.alert_warning_bg;
|
|
12
12
|
case "error":
|
|
13
|
-
return theme.palette.
|
|
13
|
+
return theme.palette.lunit_token.component.alert_error_bg;
|
|
14
14
|
default:
|
|
15
|
-
return theme.palette.
|
|
15
|
+
return theme.palette.lunit_token.component.alert_success_bg;
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -22,13 +22,13 @@ export const getBorderColor = (
|
|
|
22
22
|
) => {
|
|
23
23
|
switch (severity) {
|
|
24
24
|
case "info":
|
|
25
|
-
return theme.palette.
|
|
25
|
+
return theme.palette.lunit_token.component.alert_info_border;
|
|
26
26
|
case "warning":
|
|
27
|
-
return theme.palette.
|
|
27
|
+
return theme.palette.lunit_token.component.alert_warning_border;
|
|
28
28
|
case "error":
|
|
29
|
-
return theme.palette.
|
|
29
|
+
return theme.palette.lunit_token.component.alert_error_border;
|
|
30
30
|
default:
|
|
31
|
-
return theme.palette.
|
|
31
|
+
return theme.palette.lunit_token.component.alert_success_border;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -38,12 +38,12 @@ export const getIconColor = (
|
|
|
38
38
|
) => {
|
|
39
39
|
switch (severity) {
|
|
40
40
|
case "info":
|
|
41
|
-
return theme.palette.
|
|
41
|
+
return theme.palette.lunit_token.core.icon_info_02;
|
|
42
42
|
case "warning":
|
|
43
|
-
return theme.palette.
|
|
43
|
+
return theme.palette.lunit_token.core.icon_warning_02;
|
|
44
44
|
case "error":
|
|
45
|
-
return theme.palette.
|
|
45
|
+
return theme.palette.lunit_token.core.icon_error_02;
|
|
46
46
|
default:
|
|
47
|
-
return theme.palette.
|
|
47
|
+
return theme.palette.lunit_token.core.icon_success_02;
|
|
48
48
|
}
|
|
49
49
|
};
|
|
@@ -12,7 +12,7 @@ import type { ToggleButtonProps } from "../ToggleButton/ToggleButton.types";
|
|
|
12
12
|
import type { Typography } from "@mui/material/styles/createTypography";
|
|
13
13
|
|
|
14
14
|
type KindStyleParams = Pick<ButtonProps, "kind" | "color"> & {
|
|
15
|
-
|
|
15
|
+
lunit_token: ColorToken;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
type CustomButtonProps = ButtonProps & { hasIconOnly: boolean };
|
|
@@ -40,7 +40,7 @@ export const sizeStyle = ({
|
|
|
40
40
|
: getButtonPaddingBySizeAndKind({ kind, size, selected })
|
|
41
41
|
}`,
|
|
42
42
|
minWidth: "28px",
|
|
43
|
-
|
|
43
|
+
height: "28px",
|
|
44
44
|
}),
|
|
45
45
|
...(size === "medium" && {
|
|
46
46
|
...typography.button2,
|
|
@@ -50,7 +50,7 @@ export const sizeStyle = ({
|
|
|
50
50
|
: getButtonPaddingBySizeAndKind({ kind, size, selected })
|
|
51
51
|
}`,
|
|
52
52
|
minWidth: "36px",
|
|
53
|
-
|
|
53
|
+
height: "36px",
|
|
54
54
|
}),
|
|
55
55
|
...(size === "large" && {
|
|
56
56
|
...typography.button1,
|
|
@@ -60,83 +60,83 @@ export const sizeStyle = ({
|
|
|
60
60
|
: getButtonPaddingBySizeAndKind({ kind, size, selected })
|
|
61
61
|
}`,
|
|
62
62
|
minWidth: "44px",
|
|
63
|
-
|
|
63
|
+
height: "44px",
|
|
64
64
|
}),
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
export const kindStyle = ({ kind, color,
|
|
67
|
+
export const kindStyle = ({ kind, color, lunit_token }: KindStyleParams) => ({
|
|
68
68
|
// kind: container
|
|
69
69
|
...(kind === "contained" &&
|
|
70
70
|
color === "primary" && {
|
|
71
|
-
color:
|
|
72
|
-
backgroundColor:
|
|
73
|
-
"&:hover": getHoverStyle(
|
|
71
|
+
color: lunit_token.component.btn_primary_text_2,
|
|
72
|
+
backgroundColor: lunit_token.component.btn_primary_bg,
|
|
73
|
+
"&:hover": getHoverStyle(lunit_token.component.btn_primary_bg),
|
|
74
74
|
"&.Mui-disabled": {
|
|
75
75
|
opacity: 0.38,
|
|
76
76
|
border: "none",
|
|
77
|
-
color:
|
|
77
|
+
color: lunit_token.component.btn_primary_text_2,
|
|
78
78
|
},
|
|
79
79
|
}),
|
|
80
80
|
...(kind === "contained" &&
|
|
81
81
|
color === "secondary" && {
|
|
82
|
-
color:
|
|
83
|
-
backgroundColor:
|
|
84
|
-
"&:hover": getHoverStyle(
|
|
82
|
+
color: lunit_token.component.btn_secondary_text,
|
|
83
|
+
backgroundColor: lunit_token.component.btn_secondary_bg,
|
|
84
|
+
"&:hover": getHoverStyle(lunit_token.component.btn_secondary_bg),
|
|
85
85
|
"&.Mui-disabled": {
|
|
86
86
|
opacity: 0.38,
|
|
87
87
|
border: "none",
|
|
88
|
-
color:
|
|
88
|
+
color: lunit_token.component.btn_secondary_text,
|
|
89
89
|
},
|
|
90
90
|
}),
|
|
91
91
|
...(kind === "contained" &&
|
|
92
92
|
color === "error" && {
|
|
93
|
-
color:
|
|
94
|
-
backgroundColor:
|
|
95
|
-
"&:hover": getHoverStyle(
|
|
93
|
+
color: lunit_token.component.btn_primary_text_2,
|
|
94
|
+
backgroundColor: lunit_token.component.btn_error_bg,
|
|
95
|
+
"&:hover": getHoverStyle(lunit_token.component.btn_error_bg),
|
|
96
96
|
"&.Mui-disabled": {
|
|
97
97
|
opacity: 0.38,
|
|
98
98
|
border: "none",
|
|
99
|
-
color:
|
|
99
|
+
color: lunit_token.component.btn_primary_text_2,
|
|
100
100
|
},
|
|
101
101
|
}),
|
|
102
102
|
// kind: ghost
|
|
103
103
|
...(kind === "ghost" &&
|
|
104
104
|
color === "primary" && {
|
|
105
|
-
color:
|
|
105
|
+
color: lunit_token.component.btn_primary_text_1,
|
|
106
106
|
border: "none",
|
|
107
107
|
"&:hover": getHoverStyle("none"),
|
|
108
108
|
"&.Mui-disabled": {
|
|
109
109
|
opacity: 0.38,
|
|
110
110
|
border: "none",
|
|
111
|
-
color:
|
|
111
|
+
color: lunit_token.component.btn_primary_text_1,
|
|
112
112
|
},
|
|
113
113
|
}),
|
|
114
114
|
...(kind === "ghost" &&
|
|
115
115
|
color === "secondary" && {
|
|
116
|
-
color:
|
|
116
|
+
color: lunit_token.component.btn_secondary_text,
|
|
117
117
|
border: "none",
|
|
118
118
|
"&:hover": getHoverStyle("none"),
|
|
119
119
|
"&.Mui-disabled": {
|
|
120
120
|
opacity: 0.38,
|
|
121
121
|
border: "none",
|
|
122
|
-
color:
|
|
122
|
+
color: lunit_token.component.btn_secondary_text,
|
|
123
123
|
},
|
|
124
124
|
}),
|
|
125
125
|
...(kind === "ghost" &&
|
|
126
126
|
color === "error" && {
|
|
127
|
-
color:
|
|
127
|
+
color: lunit_token.component.btn_error_text,
|
|
128
128
|
"&:hover": getHoverStyle("none"),
|
|
129
129
|
"&.Mui-disabled": {
|
|
130
130
|
opacity: 0.38,
|
|
131
131
|
border: "none",
|
|
132
|
-
color:
|
|
132
|
+
color: lunit_token.component.btn_error_text,
|
|
133
133
|
},
|
|
134
134
|
}),
|
|
135
135
|
// kind: outlined
|
|
136
136
|
...(kind === "outlined" &&
|
|
137
137
|
color === "primary" && {
|
|
138
|
-
color:
|
|
139
|
-
border: `${OUTLINED_BORDER_WIDTH}px solid ${
|
|
138
|
+
color: lunit_token.component.btn_primary_text_1,
|
|
139
|
+
border: `${OUTLINED_BORDER_WIDTH}px solid ${lunit_token.component.btn_primary_border}`,
|
|
140
140
|
"&:hover": getHoverStyle("none"),
|
|
141
141
|
"&:hover:before": {
|
|
142
142
|
content: "''",
|
|
@@ -146,18 +146,18 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
146
146
|
width: "calc(100% + 2px)",
|
|
147
147
|
height: "calc(100% + 2px)",
|
|
148
148
|
zIndex: -1,
|
|
149
|
-
backgroundColor:
|
|
149
|
+
backgroundColor: lunit_token.core.hover,
|
|
150
150
|
borderRadius,
|
|
151
151
|
},
|
|
152
152
|
"&.Mui-disabled": {
|
|
153
153
|
opacity: 0.38,
|
|
154
|
-
color:
|
|
154
|
+
color: lunit_token.component.btn_primary_text_1,
|
|
155
155
|
},
|
|
156
156
|
}),
|
|
157
157
|
...(kind === "outlined" &&
|
|
158
158
|
color === "secondary" && {
|
|
159
|
-
color:
|
|
160
|
-
border: `${OUTLINED_BORDER_WIDTH}px solid ${
|
|
159
|
+
color: lunit_token.component.btn_secondary_text,
|
|
160
|
+
border: `${OUTLINED_BORDER_WIDTH}px solid ${lunit_token.component.btn_secondary_border}`,
|
|
161
161
|
"&:hover": getHoverStyle("none"),
|
|
162
162
|
"&:hover:before": {
|
|
163
163
|
content: "''",
|
|
@@ -167,17 +167,17 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
|
167
167
|
width: "calc(100% + 2px)",
|
|
168
168
|
height: "calc(100% + 2px)",
|
|
169
169
|
zIndex: -1,
|
|
170
|
-
backgroundColor:
|
|
170
|
+
backgroundColor: lunit_token.core.hover,
|
|
171
171
|
borderRadius,
|
|
172
172
|
},
|
|
173
173
|
"&.Mui-disabled": {
|
|
174
174
|
opacity: 0.38,
|
|
175
|
-
color:
|
|
175
|
+
color: lunit_token.component.btn_secondary_text,
|
|
176
176
|
},
|
|
177
177
|
}),
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
export const commonStyle = ({
|
|
180
|
+
export const commonStyle = ({ lunit_token }: { lunit_token: ColorToken }) =>
|
|
181
181
|
({
|
|
182
182
|
fontWeight: "500",
|
|
183
183
|
borderRadius,
|
|
@@ -189,7 +189,7 @@ export const commonStyle = ({ token }: { token: ColorToken }) =>
|
|
|
189
189
|
height: `calc(100% + ${PADDING_OF_FOCUS}px)`,
|
|
190
190
|
content: '""',
|
|
191
191
|
borderRadius: "11px",
|
|
192
|
-
border: `1px solid ${
|
|
192
|
+
border: `1px solid ${lunit_token.core.focused}`,
|
|
193
193
|
boxSizing: "border-box",
|
|
194
194
|
},
|
|
195
195
|
},
|
|
@@ -201,7 +201,7 @@ export const commonStyle = ({ token }: { token: ColorToken }) =>
|
|
|
201
201
|
width: "100%",
|
|
202
202
|
height: "100%",
|
|
203
203
|
zIndex: -1,
|
|
204
|
-
backgroundColor:
|
|
204
|
+
backgroundColor: lunit_token.core.hover,
|
|
205
205
|
borderRadius,
|
|
206
206
|
},
|
|
207
207
|
} as const);
|
|
@@ -237,16 +237,16 @@ export const CustomButton = styled(MuiButton, {
|
|
|
237
237
|
({
|
|
238
238
|
theme: {
|
|
239
239
|
typography,
|
|
240
|
-
palette: {
|
|
240
|
+
palette: { lunit_token },
|
|
241
241
|
},
|
|
242
242
|
kind,
|
|
243
243
|
size,
|
|
244
244
|
color,
|
|
245
245
|
hasIconOnly,
|
|
246
246
|
}) => ({
|
|
247
|
-
...commonStyle({
|
|
247
|
+
...commonStyle({ lunit_token }),
|
|
248
248
|
...iconStyle({ size, hasIconOnly }),
|
|
249
249
|
...sizeStyle({ size, kind, hasIconOnly, typography }),
|
|
250
|
-
...kindStyle({ kind, color,
|
|
250
|
+
...kindStyle({ kind, color, lunit_token }),
|
|
251
251
|
})
|
|
252
252
|
);
|
|
@@ -2,9 +2,9 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { CustomButton } from "./Button.styled";
|
|
4
4
|
|
|
5
|
-
import type { ButtonProps } from "./Button.types";
|
|
5
|
+
import type { ButtonType, ButtonProps } from "./Button.types";
|
|
6
6
|
|
|
7
|
-
const Button = (props: ButtonProps) => {
|
|
7
|
+
const Button: ButtonType = (props: ButtonProps) => {
|
|
8
8
|
const {
|
|
9
9
|
size = "small",
|
|
10
10
|
color = "primary",
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ButtonProps as MuiButtonProps,
|
|
3
|
+
ButtonTypeMap as MuiButtonTypeMap,
|
|
4
|
+
} from "@mui/material";
|
|
5
|
+
import type { OverridableComponent } from "@mui/material/OverridableComponent";
|
|
2
6
|
|
|
7
|
+
/**
|
|
8
|
+
* TODO: Omit 을 사용할 경우 component prop 타입 추론이 안되는 이슈 발생
|
|
9
|
+
* https://github.com/lunit-io/design-system/pull/133#discussion_r1354277785
|
|
10
|
+
* */
|
|
3
11
|
interface BaseButtonProps extends Omit<MuiButtonProps, "variant"> {
|
|
4
12
|
icon?: React.ReactNode;
|
|
5
13
|
}
|
|
@@ -23,3 +31,13 @@ export type ButtonProps =
|
|
|
23
31
|
| ContainedButtonProps
|
|
24
32
|
| GhostButtonProps
|
|
25
33
|
| OutlinedButtonProps;
|
|
34
|
+
|
|
35
|
+
export type ButtonTypeMap<
|
|
36
|
+
P = {},
|
|
37
|
+
D extends React.ElementType = MuiButtonTypeMap["defaultComponent"]
|
|
38
|
+
> = {
|
|
39
|
+
props: P & ButtonProps;
|
|
40
|
+
defaultComponent: D;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type ButtonType = OverridableComponent<ButtonTypeMap>;
|