@lunit/design-system 1.0.0-a.3 → 1.0.0-a.5

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.
Files changed (103) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/components/Alert/index.js +1 -1
  3. package/dist/cjs/components/Alert/index.js.map +1 -1
  4. package/dist/cjs/components/Button/index.js +1 -1
  5. package/dist/cjs/components/Button/index.js.map +1 -1
  6. package/dist/cjs/components/TextField/index.js +1 -1
  7. package/dist/cjs/components/TextField/index.js.map +1 -1
  8. package/dist/cjs/components/ToggleButton/index.js +1 -1
  9. package/dist/cjs/components/ToggleButton/index.js.map +1 -1
  10. package/dist/cjs/components/Typography/index.js +2 -0
  11. package/dist/cjs/components/Typography/index.js.map +1 -0
  12. package/dist/cjs/index.js +1 -1
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/components/Alert/Alert.js +5 -1
  15. package/dist/components/Alert/Alert.js.map +1 -1
  16. package/dist/components/Alert/Alert.styled.js +9 -8
  17. package/dist/components/Alert/Alert.styled.js.map +1 -1
  18. package/dist/components/Alert/{Alert.utils..js → Alert.utils.js} +4 -5
  19. package/dist/components/Alert/Alert.utils.js.map +1 -0
  20. package/dist/components/Button/Button.js +2 -2
  21. package/dist/components/Button/Button.js.map +1 -1
  22. package/dist/components/Button/Button.styled.js +42 -21
  23. package/dist/components/Button/Button.styled.js.map +1 -1
  24. package/dist/components/TextField/TextField.js +3 -3
  25. package/dist/components/TextField/TextField.js.map +1 -1
  26. package/dist/components/TextField/TextField.style.js +3 -0
  27. package/dist/components/TextField/TextField.style.js.map +1 -1
  28. package/dist/components/Toast/Toast.js +1 -1
  29. package/dist/components/Toast/Toast.js.map +1 -1
  30. package/dist/components/Toast/Toast.styled.js +1 -1
  31. package/dist/components/Toast/Toast.styled.js.map +1 -1
  32. package/dist/components/Toast/Toast.utils.js +1 -2
  33. package/dist/components/Toast/Toast.utils.js.map +1 -1
  34. package/dist/components/Toast/index.js +1 -1
  35. package/dist/components/Toast/index.js.map +1 -1
  36. package/dist/components/Typography/index.js +3 -0
  37. package/dist/components/Typography/index.js.map +1 -0
  38. package/dist/foundation/Typography/index.js.map +1 -1
  39. package/dist/foundation/colors/index.js +9 -11
  40. package/dist/foundation/colors/index.js.map +1 -1
  41. package/dist/foundation/colors/token/component.js +22 -38
  42. package/dist/foundation/colors/token/component.js.map +1 -1
  43. package/dist/index.js +3 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/types/components/Alert/Alert.utils.d.ts +4 -0
  46. package/dist/types/components/Button/Button.d.ts +1 -1
  47. package/dist/types/components/Button/Button.styled.d.ts +39 -19
  48. package/dist/types/components/Button/Button.types.d.ts +1 -1
  49. package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
  50. package/dist/types/components/Chip/Chip.d.ts +1 -1
  51. package/dist/types/components/Chip/Chip.styled.d.ts +8 -8
  52. package/dist/types/components/Chip/Chip.types.d.ts +1 -0
  53. package/dist/types/components/DataTable/DataTable.d.ts +1 -1
  54. package/dist/types/components/DatePicker/DatePicker.d.ts +1 -1
  55. package/dist/types/components/Dropdown/Dropdown.d.ts +1 -1
  56. package/dist/types/components/FormLabel/FormLabel.d.ts +1 -1
  57. package/dist/types/components/Modal/Modal.d.ts +1 -1
  58. package/dist/types/components/Radio/Radio.d.ts +1 -1
  59. package/dist/types/components/TextField/TextField.d.ts +1 -1
  60. package/dist/types/components/TextField/TextField.style.d.ts +3 -1
  61. package/dist/types/components/TextField/TextField.types.d.ts +2 -3
  62. package/dist/types/components/TextField/TextFieldIcon.d.ts +2 -1
  63. package/dist/types/components/Toast/Toast.utils.d.ts +2 -2
  64. package/dist/types/components/Toast/index.d.ts +2 -1
  65. package/dist/types/components/Toggle/Toggle.d.ts +1 -1
  66. package/dist/types/components/ToggleButton/ToggleButton.d.ts +1 -1
  67. package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -2
  68. package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +1 -1
  69. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  70. package/dist/types/components/Typography/index.d.ts +7 -0
  71. package/dist/types/foundation/Typography/index.d.ts +1 -5
  72. package/dist/types/foundation/colors/index.d.ts +9 -11
  73. package/dist/types/foundation/colors/types.d.ts +9 -11
  74. package/dist/types/foundation/index.d.ts +9 -11
  75. package/dist/types/index.d.ts +3 -0
  76. package/package.json +21 -16
  77. package/src/components/Alert/Alert.styled.ts +33 -30
  78. package/src/components/Alert/Alert.tsx +5 -7
  79. package/src/components/Alert/{Alert.utils..ts → Alert.utils.ts} +13 -5
  80. package/src/components/Button/Button.styled.ts +42 -22
  81. package/src/components/Button/Button.tsx +12 -10
  82. package/src/components/Button/Button.types.ts +1 -1
  83. package/src/components/TextField/TextField.style.ts +3 -0
  84. package/src/components/TextField/TextField.tsx +3 -3
  85. package/src/components/TextField/TextField.types.ts +1 -3
  86. package/src/components/Toast/Toast.styled.ts +1 -1
  87. package/src/components/Toast/Toast.tsx +1 -1
  88. package/src/components/Toast/Toast.utils.ts +5 -3
  89. package/src/components/Toast/index.tsx +2 -1
  90. package/src/components/Typography/index.ts +9 -0
  91. package/src/foundation/Typography/index.ts +2 -6
  92. package/src/foundation/colors/index.ts +9 -11
  93. package/src/foundation/colors/token/component.ts +22 -38
  94. package/src/foundation/colors/types.ts +9 -11
  95. package/src/index.ts +3 -0
  96. package/src/stories/components/Button/Kind.stories.tsx +38 -5
  97. package/src/stories/components/Toast/Toast.stories.tsx +1 -1
  98. package/src/stories/foundation/Typography/Typography.mdx +1 -1
  99. package/src/stories/foundation/Typography/Typography.stories.tsx +3 -1
  100. package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +2 -2
  101. package/src/stories/foundation/Typography/TypographyGroup.tsx +3 -7
  102. package/dist/components/Alert/Alert.utils..js.map +0 -1
  103. package/dist/types/components/Alert/Alert.utils..d.ts +0 -4
@@ -1,8 +1,9 @@
1
+ /// <reference types="react" />
1
2
  import type { SxProps } from "@mui/material";
2
3
  interface TextFieldProps {
3
4
  sx?: SxProps;
4
5
  icon: JSX.Element;
5
6
  onIconClick?: () => void;
6
7
  }
7
- declare const TextFieldIcon: ({ sx, icon, onIconClick }: TextFieldProps) => JSX.Element;
8
+ declare const TextFieldIcon: ({ sx, icon, onIconClick }: TextFieldProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export default TextFieldIcon;
@@ -1,2 +1,2 @@
1
- import type { AlertColor } from "@mui/material";
2
- export declare const getIconColor: (severity: AlertColor | undefined) => import("csstype").Property.Color | undefined;
1
+ import type { AlertColor, Theme } from "@mui/material";
2
+ export declare const getIconColor: (theme: Theme, severity: AlertColor | undefined) => import("csstype").Property.Color | undefined;
@@ -1 +1,2 @@
1
- export { default as Toast } from './Toast';
1
+ export { default } from "./Toast";
2
+ export type { ToastProps } from "./Toast.types";
@@ -1,3 +1,3 @@
1
1
  import type { ToggleProps } from './Toggle.types';
2
- declare const Toggle: (props: ToggleProps) => JSX.Element;
2
+ declare const Toggle: (props: ToggleProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Toggle;
@@ -1,3 +1,3 @@
1
1
  import type { ToggleButtonProps } from "./ToggleButton.types";
2
- declare const ToggleButton: (props: ToggleButtonProps) => JSX.Element;
2
+ declare const ToggleButton: (props: ToggleButtonProps) => import("react/jsx-runtime").JSX.Element;
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?: "primary" | "secondary" | "error" | "warning" | "success" | "info" | "standard" | undefined;
9
+ color?: "primary" | "secondary" | "error" | "success" | "info" | "warning" | "standard" | undefined;
10
10
  disabled?: boolean | undefined;
11
11
  disableFocusRipple?: boolean | undefined;
12
12
  fullWidth?: boolean | undefined;
@@ -34,6 +34,6 @@ 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
- }, "color" | keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "tabIndex" | "onChange" | "onClick" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "value" | "size" | "selected" | "disableFocusRipple" | "fullWidth"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & CustomToggleButtonProps, {}, {}>;
37
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "onChange" | "onClick" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "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
39
  export {};
@@ -1,3 +1,3 @@
1
1
  import { ToggleButtonGroupProps } from "@mui/material/ToggleButtonGroup";
2
- declare const ToggleButtonGroup: ({ size, ...props }: ToggleButtonGroupProps) => JSX.Element;
2
+ declare const ToggleButtonGroup: ({ size, ...props }: ToggleButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default ToggleButtonGroup;
@@ -1,2 +1,2 @@
1
- declare const Tooltip: () => JSX.Element;
1
+ declare const Tooltip: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Tooltip;
@@ -0,0 +1,7 @@
1
+ import Typography from "@mui/material/Typography";
2
+ import type { TypographyPropsVariantOverridesType } from "../../foundation/Typography";
3
+ declare module "@mui/material/Typography" {
4
+ interface TypographyPropsVariantOverrides extends TypographyPropsVariantOverridesType {
5
+ }
6
+ }
7
+ export default Typography;
@@ -8,11 +8,7 @@ declare module "@mui/material/styles" {
8
8
  interface TypographyVariantsOptions extends Partial<DSVariantsType> {
9
9
  }
10
10
  }
11
- type TypographyPropsVariantOverridesType = Record<DSVariants, true>;
12
- declare module "@mui/material/Typography" {
13
- interface TypographyPropsVariantOverrides extends TypographyPropsVariantOverridesType {
14
- }
15
- }
11
+ export type TypographyPropsVariantOverridesType = Record<DSVariants, true>;
16
12
  declare const typographyOptions: TypographyOptions;
17
13
  export declare const typographyDefaultProps: {
18
14
  variantMapping: {
@@ -131,17 +131,15 @@ declare const paletteOptions: {
131
131
  shadow_04: string;
132
132
  };
133
133
  component: {
134
- btn_contained_primary_bg: string;
135
- btn_contained_primary_text: string;
136
- btn_contained_secondary_bg: string;
137
- btn_contained_secondary_text: string;
138
- btn_contained_error_bg: string;
139
- btn_contained_error_text: string;
140
- btn_outlined_primary_border: string;
141
- btn_outlined_primary_text: string;
142
- btn_ghost_primary_text: string;
143
- btn_ghost_secondary_text: string;
144
- btn_ghost_error_text: string;
134
+ btn_primary_bg: string;
135
+ btn_secondary_bg: string;
136
+ btn_error_bg: string;
137
+ btn_primary_border: string;
138
+ btn_secondary_border: string;
139
+ btn_primary_text_1: string;
140
+ btn_primary_text_2: string;
141
+ btn_secondary_text: string;
142
+ btn_error_text: string;
145
143
  btn_selected_primary_bg: string;
146
144
  btn_selected_primary_text: string;
147
145
  btn_selected_secondary_bg: string;
@@ -29,17 +29,15 @@ export interface ColorToken {
29
29
  shadow_04: CSSPropertyColor;
30
30
  };
31
31
  component: {
32
- btn_contained_primary_bg: CSSPropertyColor;
33
- btn_contained_primary_text: CSSPropertyColor;
34
- btn_contained_secondary_bg: CSSPropertyColor;
35
- btn_contained_secondary_text: CSSPropertyColor;
36
- btn_contained_error_bg: CSSPropertyColor;
37
- btn_contained_error_text: CSSPropertyColor;
38
- btn_outlined_primary_border: CSSPropertyColor;
39
- btn_outlined_primary_text: CSSPropertyColor;
40
- btn_ghost_primary_text: CSSPropertyColor;
41
- btn_ghost_secondary_text: CSSPropertyColor;
42
- btn_ghost_error_text: CSSPropertyColor;
32
+ btn_primary_bg: CSSPropertyColor;
33
+ btn_secondary_bg: CSSPropertyColor;
34
+ btn_error_bg: CSSPropertyColor;
35
+ btn_primary_border: CSSPropertyColor;
36
+ btn_secondary_border: CSSPropertyColor;
37
+ btn_primary_text_1: CSSPropertyColor;
38
+ btn_primary_text_2: CSSPropertyColor;
39
+ btn_secondary_text: CSSPropertyColor;
40
+ btn_error_text: CSSPropertyColor;
43
41
  btn_selected_primary_bg: CSSPropertyColor;
44
42
  btn_selected_primary_text: CSSPropertyColor;
45
43
  btn_selected_secondary_bg: CSSPropertyColor;
@@ -78,17 +78,15 @@ export declare const palette: {
78
78
  shadow_04: string;
79
79
  };
80
80
  component: {
81
- btn_contained_primary_bg: string;
82
- btn_contained_primary_text: string;
83
- btn_contained_secondary_bg: string;
84
- btn_contained_secondary_text: string;
85
- btn_contained_error_bg: string;
86
- btn_contained_error_text: string;
87
- btn_outlined_primary_border: string;
88
- btn_outlined_primary_text: string;
89
- btn_ghost_primary_text: string;
90
- btn_ghost_secondary_text: string;
91
- btn_ghost_error_text: string;
81
+ btn_primary_bg: string;
82
+ btn_secondary_bg: string;
83
+ btn_error_bg: string;
84
+ btn_primary_border: string;
85
+ btn_secondary_border: string;
86
+ btn_primary_text_1: string;
87
+ btn_primary_text_2: string;
88
+ btn_secondary_text: string;
89
+ btn_error_text: string;
92
90
  btn_selected_primary_bg: string;
93
91
  btn_selected_primary_text: string;
94
92
  btn_selected_secondary_bg: string;
@@ -3,6 +3,7 @@ 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";
5
5
  export { default as Chip } from "./components/Chip";
6
+ export { default as Checkbox } from "./components/Checkbox";
6
7
  export { default as DataTable } from "./components/DataTable";
7
8
  export { default as DatePicker } from "./components/DatePicker";
8
9
  export { default as Dropdown } from "./components/Dropdown";
@@ -11,7 +12,9 @@ export { default as Modal } from "./components/Modal";
11
12
  export { default as Radio } from "./components/Radio";
12
13
  export { default as RadioGroup } from "./components/RadioGroup";
13
14
  export { default as TextField } from "./components/TextField";
15
+ export { default as Toast } from "./components/Toast";
14
16
  export { default as Toggle } from "./components/Toggle";
15
17
  export { default as ToggleButton } from "./components/ToggleButton";
16
18
  export { default as ToggleButtonGroup } from "./components/ToggleButtonGroup";
17
19
  export { default as Tooltip } from "./components/Tooltip";
20
+ export { default as Typography } from "./components/Typography";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunit/design-system",
3
- "version": "1.0.0-a.3",
3
+ "version": "1.0.0-a.5",
4
4
  "description": "Lunit Design System",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/index.js",
@@ -37,7 +37,7 @@
37
37
  "scripts": {
38
38
  "build:transpile": "tsc -p tsconfig.build.json",
39
39
  "build:cjs": "webpack -c webpack/cjs.config.js",
40
- "build": "yarn build:transpile && yarn build:cjs",
40
+ "build": "npm run build:transpile && npm run build:cjs",
41
41
  "storybook": "storybook dev -p 6006",
42
42
  "build-storybook": "storybook build",
43
43
  "chromatic": "chromatic"
@@ -48,6 +48,11 @@
48
48
  "dependsOn": [
49
49
  "^build"
50
50
  ]
51
+ },
52
+ "build-storybook": {
53
+ "dependsOn": [
54
+ "^build"
55
+ ]
51
56
  }
52
57
  }
53
58
  },
@@ -61,27 +66,27 @@
61
66
  "@mui/icons-material": "^5.11.3",
62
67
  "@mui/material": "^5.11.3",
63
68
  "@mui/utils": "^5.11.3",
64
- "@mui/x-date-pickers": "^5.0.16",
65
- "@storybook/addon-actions": "^7.0.6",
66
- "@storybook/addon-essentials": "^7.0.6",
67
- "@storybook/addon-interactions": "^7.0.6",
68
- "@storybook/addon-links": "^7.0.6",
69
- "@storybook/addon-storysource": "^7.0.6",
70
- "@storybook/blocks": "^7.0.6",
71
- "@storybook/react": "^7.0.6",
72
- "@storybook/react-webpack5": "^7.0.6",
69
+ "@mui/x-date-pickers": "^5.0.20",
70
+ "@storybook/addon-actions": "^7.0.21",
71
+ "@storybook/addon-essentials": "^7.0.21",
72
+ "@storybook/addon-interactions": "^7.0.21",
73
+ "@storybook/addon-links": "^7.0.21",
74
+ "@storybook/addon-storysource": "^7.0.21",
75
+ "@storybook/blocks": "^7.0.21",
76
+ "@storybook/react": "^7.0.21",
77
+ "@storybook/react-webpack5": "^7.0.21",
73
78
  "@storybook/testing-library": "^0.1.0",
74
- "@storybook/theming": "^7.0.6",
79
+ "@storybook/theming": "^7.0.21",
75
80
  "@types/lodash": "^4.14.182",
76
81
  "babel-loader": "^8.2.5",
77
82
  "chromatic": "^6.7.0",
78
83
  "dayjs": "^1.11.7",
79
84
  "lodash": "^4.17.21",
80
85
  "mustache": "^4.2.0",
81
- "react": "^17.0.2",
82
- "react-dom": "^17.0.2",
83
- "storybook": "^7.0.6",
84
- "storybook-addon-pseudo-states": "^2.0.0",
86
+ "react": "18.2.0",
87
+ "react-dom": "18.2.0",
88
+ "storybook": "^7.0.21",
89
+ "storybook-addon-pseudo-states": "^2.0.1",
85
90
  "ts-loader": "^9.3.0",
86
91
  "typescript": "^4.6.4",
87
92
  "webpack": "^5.72.0",
@@ -8,37 +8,40 @@ import {
8
8
  getBorderColor,
9
9
  getBackgroundColor,
10
10
  getIconColor,
11
- } from "./Alert.utils.";
11
+ } from "./Alert.utils";
12
12
 
13
- export const StyledAlert = styled(MuiAlert)<AlertProps>(({ severity }) => ({
14
- "&.MuiAlert-root": {
15
- display: "flex",
16
- padding: "15px",
17
- borderRadius: "8px",
18
- border: `1px solid ${getBorderColor(severity)}`,
19
- backgroundColor: getBackgroundColor(severity),
20
- boxShadow: "none",
21
- },
22
- "& .MuiAlert-icon": {
23
- padding: "4px",
24
- fontSize: "20px",
25
- marginRight: "16px",
26
- color: `${getIconColor(severity)} !important`,
27
- },
28
- "& .MuiAlert-message": {
29
- padding: "4px 0",
30
- width: "100%",
31
- minHeight: "28px",
32
- },
33
- "& .MuiAlert-action": {
34
- margin: 0,
35
- padding: 0,
36
- },
37
- "& .MuiSvgIcon-root": {
38
- height: "20px",
39
- width: "20px",
40
- },
41
- }));
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
+ );
42
45
 
43
46
  export const StyledAlertTitle = styled(MuiAlertTitle)(({ theme }) => ({
44
47
  "&.MuiAlertTitle-root": {
@@ -1,3 +1,8 @@
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";
1
6
  import React, { forwardRef } from "react";
2
7
  import {
3
8
  StyledAlert,
@@ -6,13 +11,6 @@ import {
6
11
  StyledBottomAction,
7
12
  } from "./Alert.styled";
8
13
  import { AlertProps } from "./Alert.types";
9
- import {
10
- Close,
11
- Success,
12
- Error,
13
- Warning,
14
- Information,
15
- } from "@lunit/design-system-icons";
16
14
  import Button from "../Button";
17
15
 
18
16
  const MAPPED_ICON = {
@@ -1,7 +1,9 @@
1
- import theme from "@/theme";
2
- import { AlertColor } from "@mui/material";
1
+ import { AlertColor, Theme } from "@mui/material";
3
2
 
4
- export const getBackgroundColor = (severity: AlertColor | undefined) => {
3
+ export const getBackgroundColor = (
4
+ theme: Theme,
5
+ severity: AlertColor | undefined
6
+ ) => {
5
7
  switch (severity) {
6
8
  case "info":
7
9
  return theme.palette.token.component.alert_info_bg;
@@ -14,7 +16,10 @@ export const getBackgroundColor = (severity: AlertColor | undefined) => {
14
16
  }
15
17
  };
16
18
 
17
- export const getBorderColor = (severity: AlertColor | undefined) => {
19
+ export const getBorderColor = (
20
+ theme: Theme,
21
+ severity: AlertColor | undefined
22
+ ) => {
18
23
  switch (severity) {
19
24
  case "info":
20
25
  return theme.palette.token.component.alert_info_border;
@@ -27,7 +32,10 @@ export const getBorderColor = (severity: AlertColor | undefined) => {
27
32
  }
28
33
  };
29
34
 
30
- export const getIconColor = (severity: AlertColor | undefined) => {
35
+ export const getIconColor = (
36
+ theme: Theme,
37
+ severity: AlertColor | undefined
38
+ ) => {
31
39
  switch (severity) {
32
40
  case "info":
33
41
  return theme.palette.token.core.icon_info_02;
@@ -68,76 +68,96 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
68
68
  // kind: container
69
69
  ...(kind === "contained" &&
70
70
  color === "primary" && {
71
- color: token.component.btn_contained_primary_text,
72
- backgroundColor: token.component.btn_contained_primary_bg,
73
- "&:hover": getHoverStyle(token.component.btn_contained_primary_bg),
71
+ color: token.component.btn_primary_text_2,
72
+ backgroundColor: token.component.btn_primary_bg,
73
+ "&:hover": getHoverStyle(token.component.btn_primary_bg),
74
74
  "&.Mui-disabled": {
75
75
  opacity: 0.38,
76
76
  border: "none",
77
- color: token.component.btn_contained_primary_text,
77
+ color: token.component.btn_primary_text_2,
78
78
  },
79
79
  }),
80
80
  ...(kind === "contained" &&
81
81
  color === "secondary" && {
82
- color: token.component.btn_contained_secondary_text,
83
-
84
- backgroundColor: token.component.btn_contained_secondary_bg,
85
- "&:hover": getHoverStyle(token.component.btn_contained_secondary_bg),
82
+ color: token.component.btn_secondary_text,
83
+ backgroundColor: token.component.btn_secondary_bg,
84
+ "&:hover": getHoverStyle(token.component.btn_secondary_bg),
86
85
  "&.Mui-disabled": {
87
86
  opacity: 0.38,
88
87
  border: "none",
89
- color: token.component.btn_contained_secondary_text,
88
+ color: token.component.btn_secondary_text,
90
89
  },
91
90
  }),
92
91
  ...(kind === "contained" &&
93
92
  color === "error" && {
94
- color: token.component.btn_contained_error_text,
95
- backgroundColor: token.component.btn_contained_error_bg,
96
- "&:hover": getHoverStyle(token.component.btn_contained_error_bg),
93
+ color: token.component.btn_primary_text_2,
94
+ backgroundColor: token.component.btn_error_bg,
95
+ "&:hover": getHoverStyle(token.component.btn_error_bg),
97
96
  "&.Mui-disabled": {
98
97
  opacity: 0.38,
99
98
  border: "none",
100
- color: token.component.btn_contained_error_text,
99
+ color: token.component.btn_primary_text_2,
101
100
  },
102
101
  }),
103
102
  // kind: ghost
104
103
  ...(kind === "ghost" &&
105
104
  color === "primary" && {
106
- color: token.component.btn_ghost_primary_text,
105
+ color: token.component.btn_primary_text_1,
107
106
  border: "none",
108
107
  "&:hover": getHoverStyle("none"),
109
108
  "&.Mui-disabled": {
110
109
  opacity: 0.38,
111
110
  border: "none",
112
- color: token.component.btn_ghost_primary_text,
111
+ color: token.component.btn_primary_text_1,
113
112
  },
114
113
  }),
115
114
  ...(kind === "ghost" &&
116
115
  color === "secondary" && {
117
- color: token.component.btn_ghost_secondary_text,
116
+ color: token.component.btn_secondary_text,
118
117
  border: "none",
119
118
  "&:hover": getHoverStyle("none"),
120
119
  "&.Mui-disabled": {
121
120
  opacity: 0.38,
122
121
  border: "none",
123
- color: token.component.btn_ghost_secondary_text,
122
+ color: token.component.btn_secondary_text,
124
123
  },
125
124
  }),
126
125
  ...(kind === "ghost" &&
127
126
  color === "error" && {
128
- color: token.component.btn_ghost_error_text,
127
+ color: token.component.btn_error_text,
129
128
  "&:hover": getHoverStyle("none"),
130
129
  "&.Mui-disabled": {
131
130
  opacity: 0.38,
132
131
  border: "none",
133
- color: token.component.btn_ghost_error_text,
132
+ color: token.component.btn_error_text,
134
133
  },
135
134
  }),
136
135
  // kind: outlined
137
136
  ...(kind === "outlined" &&
138
137
  color === "primary" && {
139
- color: token.component.btn_outlined_primary_text,
140
- border: `${OUTLINED_BORDER_WIDTH}px solid ${token.component.btn_outlined_primary_border}`,
138
+ color: token.component.btn_primary_text_1,
139
+ border: `${OUTLINED_BORDER_WIDTH}px solid ${token.component.btn_primary_border}`,
140
+ "&:hover": getHoverStyle("none"),
141
+ "&:hover:before": {
142
+ content: "''",
143
+ position: "absolute",
144
+ left: "-1px",
145
+ top: "-1px",
146
+ width: "calc(100% + 2px)",
147
+ height: "calc(100% + 2px)",
148
+ zIndex: -1,
149
+ backgroundColor: token.core.hover,
150
+ borderRadius,
151
+ },
152
+ "&.Mui-disabled": {
153
+ opacity: 0.38,
154
+ color: token.component.btn_primary_text_1,
155
+ },
156
+ }),
157
+ ...(kind === "outlined" &&
158
+ color === "secondary" && {
159
+ color: token.component.btn_secondary_text,
160
+ border: `${OUTLINED_BORDER_WIDTH}px solid ${token.component.btn_secondary_border}`,
141
161
  "&:hover": getHoverStyle("none"),
142
162
  "&:hover:before": {
143
163
  content: "''",
@@ -152,7 +172,7 @@ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
152
172
  },
153
173
  "&.Mui-disabled": {
154
174
  opacity: 0.38,
155
- color: token.component.btn_outlined_primary_text,
175
+ color: token.component.btn_secondary_text,
156
176
  },
157
177
  }),
158
178
  });
@@ -6,7 +6,6 @@ import type { ButtonProps } from "./Button.types";
6
6
 
7
7
  const Button = (props: ButtonProps) => {
8
8
  const {
9
- kind = "contained",
10
9
  size = "small",
11
10
  color = "primary",
12
11
  icon,
@@ -18,27 +17,30 @@ const Button = (props: ButtonProps) => {
18
17
 
19
18
  return (
20
19
  <>
21
- {kind === "contained" || kind === "ghost" ? (
20
+ {/** props.kind 사용 이유: props.color 타입 좁히기 활용을 위해 사용 */}
21
+ {props.kind === "outlined" ? (
22
22
  <CustomButton
23
- className={`${kind} ${className ? className : ""}`}
24
- kind={kind}
25
- color={color}
23
+ {...buttonProps}
24
+ className={`outlined ${className ? className : ""}`}
25
+ kind="outlined"
26
+ color={props.color ?? "primary"}
26
27
  size={size}
27
28
  startIcon={icon}
28
29
  hasIconOnly={hasIconOnly}
29
- {...buttonProps}
30
30
  >
31
31
  {!hasIconOnly && <>{children}</>}
32
32
  </CustomButton>
33
33
  ) : (
34
34
  <CustomButton
35
- className={`outlined ${className ? className : ""}`}
36
- kind="outlined"
37
- color="primary"
35
+ {...buttonProps}
36
+ className={`${props.kind ?? "contained"} ${
37
+ className ? className : ""
38
+ }`}
39
+ kind={props.kind ?? "contained"}
40
+ color={props.color ?? "primary"}
38
41
  size={size}
39
42
  startIcon={icon}
40
43
  hasIconOnly={hasIconOnly}
41
- {...buttonProps}
42
44
  >
43
45
  {!hasIconOnly && <>{children}</>}
44
46
  </CustomButton>
@@ -16,7 +16,7 @@ interface GhostButtonProps extends BaseButtonProps {
16
16
 
17
17
  interface OutlinedButtonProps extends BaseButtonProps {
18
18
  kind?: "outlined";
19
- color?: "primary";
19
+ color?: "primary" | "secondary";
20
20
  }
21
21
 
22
22
  export type ButtonProps =
@@ -71,6 +71,9 @@ const getTextFieldPaddingBySize = ({
71
71
  };
72
72
 
73
73
  const commonStyle = ({ token }: { token: ColorToken }) => ({
74
+ "&.MuiTextField-root": {
75
+ width: "100%",
76
+ },
74
77
  "& .MuiOutlinedInput-root": {
75
78
  borderRadius: "8px",
76
79
  width: "100%",
@@ -11,7 +11,7 @@ import type {
11
11
 
12
12
  const SingleTextField = (props: SingleTextFieldProps) => {
13
13
  const {
14
- size,
14
+ size = "small",
15
15
  leftIcon,
16
16
  rightIcon,
17
17
  leftIconSx,
@@ -48,7 +48,7 @@ const SingleTextField = (props: SingleTextFieldProps) => {
48
48
  };
49
49
 
50
50
  const MultiTextField = ({
51
- size,
51
+ size = "small",
52
52
  onChange,
53
53
  ...restProps
54
54
  }: MultiTextFieldProps) => {
@@ -58,7 +58,7 @@ const MultiTextField = ({
58
58
  const TextField = (props: TextFieldProps) => {
59
59
  const {
60
60
  rows,
61
- size = "small",
61
+ size,
62
62
  multiline = false,
63
63
  variant = "outlined",
64
64
  ...restProps
@@ -10,7 +10,7 @@ export interface BaseTextFieldProps
10
10
  /**
11
11
  * The design system TextField variable is outlined fixed.
12
12
  */
13
- variant: "outlined";
13
+ variant?: "outlined";
14
14
  value?: string;
15
15
  helperText?: string;
16
16
 
@@ -21,7 +21,6 @@ export interface BaseTextFieldProps
21
21
  }
22
22
 
23
23
  export interface SingleTextFieldProps extends BaseTextFieldProps {
24
- size: TextFieldSize;
25
24
  leftIcon?: JSX.Element;
26
25
  rightIcon?: JSX.Element;
27
26
  leftIconSx?: SxProps;
@@ -32,7 +31,6 @@ export interface SingleTextFieldProps extends BaseTextFieldProps {
32
31
 
33
32
  export interface MultiTextFieldProps extends BaseTextFieldProps {
34
33
  rows?: number | string;
35
- size: TextFieldSize;
36
34
  }
37
35
 
38
36
  export type TextFieldProps = SingleTextFieldProps | MultiTextFieldProps;