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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/.babelrc.json +16 -0
  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/Chip/index.js +1 -1
  7. package/dist/cjs/components/Chip/index.js.map +1 -1
  8. package/dist/cjs/components/TextField/index.js +1 -1
  9. package/dist/cjs/components/TextField/index.js.map +1 -1
  10. package/dist/cjs/components/ToggleButton/index.js +1 -1
  11. package/dist/cjs/components/ToggleButton/index.js.map +1 -1
  12. package/dist/cjs/index.js +1 -1
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/components/Alert/Alert.js +16 -4
  15. package/dist/components/Alert/Alert.js.map +1 -1
  16. package/dist/components/Alert/Alert.styled.js +48 -0
  17. package/dist/components/Alert/Alert.styled.js.map +1 -0
  18. package/dist/components/Alert/Alert.types.js +2 -0
  19. package/dist/components/Alert/Alert.types.js.map +1 -0
  20. package/dist/components/Alert/Alert.utils..js +38 -0
  21. package/dist/components/Alert/Alert.utils..js.map +1 -0
  22. package/dist/components/Button/Button.js +1 -1
  23. package/dist/components/Button/Button.js.map +1 -1
  24. package/dist/components/Button/Button.styled.js +31 -21
  25. package/dist/components/Button/Button.styled.js.map +1 -1
  26. package/dist/components/Button/utils/getHoverStyle.js +7 -0
  27. package/dist/components/Button/utils/getHoverStyle.js.map +1 -0
  28. package/dist/components/Chip/Chip.js +1 -1
  29. package/dist/components/Chip/Chip.js.map +1 -1
  30. package/dist/components/Chip/Chip.styled.js +2 -3
  31. package/dist/components/Chip/Chip.styled.js.map +1 -1
  32. package/dist/components/TextField/TextField.js +15 -3
  33. package/dist/components/TextField/TextField.js.map +1 -1
  34. package/dist/components/TextField/TextField.style.js +245 -0
  35. package/dist/components/TextField/TextField.style.js.map +1 -0
  36. package/dist/components/TextField/TextField.types.js +2 -0
  37. package/dist/components/TextField/TextField.types.js.map +1 -0
  38. package/dist/components/TextField/TextFieldIcon.js +7 -0
  39. package/dist/components/TextField/TextFieldIcon.js.map +1 -0
  40. package/dist/components/Toast/Toast.js +26 -0
  41. package/dist/components/Toast/Toast.js.map +1 -0
  42. package/dist/components/Toast/Toast.styled.js +49 -0
  43. package/dist/components/Toast/Toast.styled.js.map +1 -0
  44. package/dist/components/Toast/Toast.types.js +2 -0
  45. package/dist/components/Toast/Toast.types.js.map +1 -0
  46. package/dist/components/Toast/Toast.utils.js +14 -0
  47. package/dist/components/Toast/Toast.utils.js.map +1 -0
  48. package/dist/components/Toast/index.js +2 -0
  49. package/dist/components/Toast/index.js.map +1 -0
  50. package/dist/foundation/colors/base/grey.js +16 -0
  51. package/dist/foundation/colors/base/grey.js.map +1 -1
  52. package/dist/foundation/colors/base/lunitGreen.js +2 -2
  53. package/dist/foundation/colors/base/lunitGreen.js.map +1 -1
  54. package/dist/foundation/colors/base/lunitTeal.js +5 -5
  55. package/dist/foundation/colors/base/lunitTeal.js.map +1 -1
  56. package/dist/foundation/colors/base/red.js +2 -2
  57. package/dist/foundation/colors/index.js +24 -4
  58. package/dist/foundation/colors/index.js.map +1 -1
  59. package/dist/foundation/colors/token/component.js +265 -291
  60. package/dist/foundation/colors/token/component.js.map +1 -1
  61. package/dist/foundation/colors/token/core.js +132 -125
  62. package/dist/foundation/colors/token/core.js.map +1 -1
  63. package/dist/index.js +1 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/theme.js +5 -0
  66. package/dist/theme.js.map +1 -1
  67. package/dist/types/components/Alert/Alert.d.ts +3 -1
  68. package/dist/types/components/Alert/Alert.styled.d.ts +6 -0
  69. package/dist/types/components/Alert/Alert.types.d.ts +9 -0
  70. package/dist/types/components/Alert/Alert.utils..d.ts +4 -0
  71. package/dist/types/components/Button/Button.d.ts +1 -1
  72. package/dist/types/components/Button/Button.styled.d.ts +26 -2
  73. package/dist/types/components/Button/Button.types.d.ts +4 -4
  74. package/dist/types/components/Button/utils/getHoverStyle.d.ts +6 -0
  75. package/dist/types/components/Chip/Chip.styled.d.ts +9 -9
  76. package/dist/types/components/Chip/Chip.types.d.ts +1 -1
  77. package/dist/types/components/TextField/TextField.d.ts +2 -1
  78. package/dist/types/components/TextField/TextField.style.d.ts +9 -0
  79. package/dist/types/components/TextField/TextField.types.d.ts +29 -0
  80. package/dist/types/components/TextField/TextFieldIcon.d.ts +8 -0
  81. package/dist/types/components/TextField/index.d.ts +1 -0
  82. package/dist/types/components/Toast/Toast.d.ts +4 -0
  83. package/dist/types/components/Toast/Toast.styled.d.ts +1 -0
  84. package/dist/types/components/Toast/Toast.types.d.ts +4 -0
  85. package/dist/types/components/Toast/Toast.utils.d.ts +2 -0
  86. package/dist/types/components/Toast/index.d.ts +1 -0
  87. package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +1 -1
  88. package/dist/types/components/ToggleButton/ToggleButton.types.d.ts +4 -4
  89. package/dist/types/foundation/colors/base/grey.d.ts +16 -0
  90. package/dist/types/foundation/colors/base/lunitGreen.d.ts +2 -2
  91. package/dist/types/foundation/colors/base/lunitTeal.d.ts +2 -2
  92. package/dist/types/foundation/colors/index.d.ts +42 -9
  93. package/dist/types/foundation/colors/types.d.ts +1 -3
  94. package/dist/types/foundation/index.d.ts +37 -5
  95. package/dist/types/index.d.ts +1 -0
  96. package/package.json +21 -16
  97. package/src/components/Alert/Alert.styled.ts +60 -0
  98. package/src/components/Alert/Alert.tsx +49 -5
  99. package/src/components/Alert/Alert.types.ts +10 -0
  100. package/src/components/Alert/Alert.utils..ts +41 -0
  101. package/src/components/Button/Button.styled.ts +33 -21
  102. package/src/components/Button/Button.tsx +1 -5
  103. package/src/components/Button/Button.types.ts +4 -4
  104. package/src/components/Button/utils/getHoverStyle.ts +7 -0
  105. package/src/components/Chip/Chip.styled.ts +6 -4
  106. package/src/components/Chip/Chip.tsx +1 -1
  107. package/src/components/Chip/Chip.types.ts +2 -2
  108. package/src/components/TextField/TextField.style.ts +316 -0
  109. package/src/components/TextField/TextField.tsx +75 -3
  110. package/src/components/TextField/TextField.types.ts +38 -0
  111. package/src/components/TextField/TextFieldIcon.tsx +24 -0
  112. package/src/components/TextField/index.ts +6 -0
  113. package/src/components/Toast/Toast.styled.ts +49 -0
  114. package/src/components/Toast/Toast.tsx +66 -0
  115. package/src/components/Toast/Toast.types.ts +14 -0
  116. package/src/components/Toast/Toast.utils.ts +15 -0
  117. package/src/components/Toast/index.tsx +1 -0
  118. package/src/components/ToggleButton/ToggleButton.types.ts +4 -7
  119. package/src/foundation/colors/base/grey.ts +17 -0
  120. package/src/foundation/colors/base/lunitGreen.ts +2 -2
  121. package/src/foundation/colors/base/lunitTeal.ts +5 -5
  122. package/src/foundation/colors/base/red.ts +2 -2
  123. package/src/foundation/colors/index.ts +29 -8
  124. package/src/foundation/colors/token/component.ts +300 -326
  125. package/src/foundation/colors/token/core.ts +152 -145
  126. package/src/foundation/colors/types.ts +1 -3
  127. package/src/index.ts +1 -0
  128. package/src/stories/components/Alert/Alert.stories.tsx +148 -4
  129. package/src/stories/components/Button/BasicButton.stories.tsx +19 -28
  130. package/src/stories/components/Button/IconButton.stories.tsx +39 -28
  131. package/src/stories/components/Button/Kind.stories.tsx +83 -57
  132. package/src/stories/components/Chip/Chip.stories.tsx +94 -82
  133. package/src/stories/components/DataTable/DataTable.stories.tsx +6 -4
  134. package/src/stories/components/DatePicker/DatePicker.stories.tsx +6 -4
  135. package/src/stories/components/Dropdown/Dropdown.stories.tsx +12 -6
  136. package/src/stories/components/Modal/Modal.stories.tsx +6 -4
  137. package/src/stories/components/SelectControl/Checkbox.stories.tsx +31 -23
  138. package/src/stories/components/SelectControl/RadioGroup.stories.tsx +6 -5
  139. package/src/stories/components/SelectControl/RadioStatus.stories.tsx +6 -4
  140. package/src/stories/components/SelectControl/Toggle.stories.tsx +33 -19
  141. package/src/stories/components/TextField/TextFieldMulti.stories.tsx +137 -0
  142. package/src/stories/components/TextField/TextFieldSingle.stories.tsx +283 -0
  143. package/src/stories/components/TextField/TextFieldSize.stories.tsx +134 -0
  144. package/src/stories/components/Toast/Toast.stories.tsx +152 -0
  145. package/src/stories/components/ToggleButton/Basic.stories.tsx +35 -31
  146. package/src/stories/components/ToggleButton/Group.stories.tsx +21 -21
  147. package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +53 -43
  148. package/src/stories/components/ToggleButton/WithIcon.stories.tsx +35 -36
  149. package/src/stories/components/Tooltip/Tooltip.stories.tsx +6 -4
  150. package/src/stories/foundation/Elevation/Elevation.stories.tsx +10 -6
  151. package/src/stories/foundation/Typography/{Typography.stories.mdx → Typography.mdx} +10 -5
  152. package/src/stories/foundation/Typography/Typography.stories.tsx +46 -36
  153. package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +44 -0
  154. package/src/stories/foundation/colors/Colors.stories.tsx +7 -5
  155. package/src/stories/foundation/colors/Mui.stories.tsx +18 -0
  156. package/src/stories/foundation/colors/Token.inComponent.stories.tsx +2 -2
  157. package/src/stories/foundation/colors/TokenPaletteTable.stories.tsx +28 -0
  158. package/src/stories/foundation/colors/TokenPaletteTable.tsx +127 -0
  159. package/src/theme.ts +5 -0
  160. package/src/stories/components/TextField/TextField.stories.tsx +0 -13
  161. package/src/stories/foundation/colors/Token.stories.tsx +0 -190
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import type { Theme } from "@mui/material/styles";
3
- import type { OutlinedChipProps, BaseContainedChipProps } from "./Chip.types";
3
+ import type { OutlinedChipProps, BaseContainedChipProps, EnableContainedChipProps } from "./Chip.types";
4
4
  export declare const StyledOutlinedChip: import("@emotion/styled").StyledComponent<{
5
5
  avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
6
6
  children?: null | undefined;
7
7
  classes?: Partial<import("@mui/material").ChipClasses> | undefined;
8
8
  clickable?: boolean | undefined;
9
- color?: "default" | "primary" | "secondary" | "error" | "warning" | "success" | "info" | undefined;
9
+ color?: "primary" | "secondary" | "error" | "warning" | "success" | "default" | "info" | 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;
@@ -19,13 +19,13 @@ 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
- }, "color" | "label" | "children" | "sx" | "tabIndex" | "disabled" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled" | "variant"> & import("@mui/system").MUIStyledCommonProps<Theme> & OutlinedChipProps, {}, {}>;
22
+ }, "color" | keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "label" | "tabIndex" | "disabled" | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "size" | "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?: "default" | "primary" | "secondary" | "error" | "warning" | "success" | "info" | undefined;
28
+ color?: "primary" | "secondary" | "error" | "warning" | "success" | "default" | "info" | 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;
@@ -38,13 +38,13 @@ 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
- }, "color" | "label" | "children" | "sx" | "tabIndex" | "disabled" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled" | "variant"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
41
+ }, "color" | keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "label" | "tabIndex" | "disabled" | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "size" | "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?: "default" | "primary" | "secondary" | "error" | "warning" | "success" | "info" | undefined;
47
+ color?: "primary" | "secondary" | "error" | "warning" | "success" | "default" | "info" | 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;
@@ -57,13 +57,13 @@ 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
- }, "color" | "label" | "children" | "sx" | "tabIndex" | "disabled" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled" | "variant"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
60
+ }, "color" | keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "label" | "tabIndex" | "disabled" | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "size" | "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?: "default" | "primary" | "secondary" | "error" | "warning" | "success" | "info" | undefined;
66
+ color?: "primary" | "secondary" | "error" | "warning" | "success" | "default" | "info" | 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;
@@ -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
- }, "color" | "label" | "children" | "sx" | "tabIndex" | "disabled" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled" | "variant"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
79
+ }, "color" | keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "label" | "tabIndex" | "disabled" | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "size" | "skipFocusWhenDisabled"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
@@ -1,7 +1,7 @@
1
1
  import { CHIP_COLORS } from "./consts";
2
2
  import type { ChipProps as MuiChipProps } from "@mui/material";
3
3
  type ColorKeys = keyof typeof CHIP_COLORS;
4
- export type ChipColor = typeof CHIP_COLORS[ColorKeys];
4
+ export type ChipColor = (typeof CHIP_COLORS)[ColorKeys];
5
5
  export type ChipThumbnail = string | JSX.Element;
6
6
  /**
7
7
  * Mui Chip's variant is 'kind' in our design system
@@ -1,2 +1,3 @@
1
- declare const TextField: () => JSX.Element;
1
+ import type { TextFieldProps } from "./TextField.types";
2
+ declare const TextField: (props: TextFieldProps) => JSX.Element;
2
3
  export default TextField;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { TextFieldProps, TextFieldSize } from "./TextField.types";
3
+ declare const BaseTextField: import("@emotion/styled").StyledComponent<import("@mui/material/TextField").OutlinedTextFieldProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & Omit<TextFieldProps, "size"> & {
4
+ textFieldSize: TextFieldSize;
5
+ hasLeftIcon?: boolean | undefined;
6
+ hasRightIcon?: boolean | undefined;
7
+ }, {}, {}>;
8
+ declare const IconWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
+ export { BaseTextField, IconWrapper };
@@ -0,0 +1,29 @@
1
+ import type { SxProps } from "@mui/material";
2
+ import type { OutlinedTextFieldProps } from "@mui/material/TextField";
3
+ export type TextFieldSize = "small" | "medium" | "large";
4
+ export interface BaseTextFieldProps extends Omit<OutlinedTextFieldProps, "size" | "value" | "helperText" | "variant"> {
5
+ /**
6
+ * The design system TextField variable is outlined fixed.
7
+ */
8
+ variant: "outlined";
9
+ value?: string;
10
+ helperText?: string;
11
+ /**
12
+ * @default "small"
13
+ */
14
+ size?: TextFieldSize;
15
+ }
16
+ export interface SingleTextFieldProps extends BaseTextFieldProps {
17
+ size: TextFieldSize;
18
+ leftIcon?: JSX.Element;
19
+ rightIcon?: JSX.Element;
20
+ leftIconSx?: SxProps;
21
+ rightIconSx?: SxProps;
22
+ onLeftIconClick?: () => void;
23
+ onRightIconClick?: () => void;
24
+ }
25
+ export interface MultiTextFieldProps extends BaseTextFieldProps {
26
+ rows?: number | string;
27
+ size: TextFieldSize;
28
+ }
29
+ export type TextFieldProps = SingleTextFieldProps | MultiTextFieldProps;
@@ -0,0 +1,8 @@
1
+ import type { SxProps } from "@mui/material";
2
+ interface TextFieldProps {
3
+ sx?: SxProps;
4
+ icon: JSX.Element;
5
+ onIconClick?: () => void;
6
+ }
7
+ declare const TextFieldIcon: ({ sx, icon, onIconClick }: TextFieldProps) => JSX.Element;
8
+ export default TextFieldIcon;
@@ -1 +1,2 @@
1
1
  export { default } from "./TextField";
2
+ export type { TextFieldProps, BaseTextFieldProps, MultiTextFieldProps, SingleTextFieldProps, } from "./TextField.types";
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { ToastProps } from "./Toast.types";
3
+ declare const Toast: React.ForwardRefExoticComponent<Omit<ToastProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ export default Toast;
@@ -0,0 +1 @@
1
+ export declare const StyledToast: import("@emotion/styled").StyledComponent<import("@mui/material").AlertProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,4 @@
1
+ import { AlertProps as BaseAlertProps } from "@mui/material";
2
+ export interface ToastProps extends Omit<BaseAlertProps, "variant" | "slots" | "slotProps" | "components" | "componentsProps" | "severity"> {
3
+ severity?: "success" | "info" | "warning" | "error" | "normal";
4
+ }
@@ -0,0 +1,2 @@
1
+ import type { AlertColor } from "@mui/material";
2
+ export declare const getIconColor: (severity: AlertColor | undefined) => import("csstype").Property.Color | undefined;
@@ -0,0 +1 @@
1
+ export { default as Toast } from './Toast';
@@ -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" | "children" | "sx" | "tabIndex" | "onChange" | "onClick" | "disabled" | "value" | "action" | "size" | "selected" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "fullWidth"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & CustomToggleButtonProps, {}, {}>;
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, {}, {}>;
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,18 +1,18 @@
1
1
  /// <reference types="react" />
2
2
  import type { ToggleButtonProps as MuiToggleButtonProps } from "@mui/material";
3
- interface ToggleButtonBaseProps extends MuiToggleButtonProps {
3
+ interface ToggleButtonBaseProps extends Omit<MuiToggleButtonProps, "variant"> {
4
4
  selectedColor?: "primary" | "secondary";
5
5
  icon?: React.ReactNode;
6
6
  }
7
- interface ContainedToggleButtonProps extends Omit<ToggleButtonBaseProps, "variant"> {
7
+ interface ContainedToggleButtonProps extends ToggleButtonBaseProps {
8
8
  kind?: "contained";
9
9
  color?: "primary" | "secondary";
10
10
  }
11
- interface GhostToggleButtonProps extends Omit<ToggleButtonBaseProps, "variant"> {
11
+ interface GhostToggleButtonProps extends ToggleButtonBaseProps {
12
12
  kind?: "ghost";
13
13
  color?: "primary" | "secondary";
14
14
  }
15
- interface OutlinedToggleButtonProps extends Omit<ToggleButtonBaseProps, "variant"> {
15
+ interface OutlinedToggleButtonProps extends ToggleButtonBaseProps {
16
16
  kind?: "outlined";
17
17
  color?: "primary";
18
18
  }
@@ -33,3 +33,19 @@ export declare const greyText: {
33
33
  95: string;
34
34
  100: string;
35
35
  };
36
+ export declare const greyForMUI: {
37
+ 50: string;
38
+ 100: string;
39
+ 200: string;
40
+ 300: string;
41
+ 400: string;
42
+ 500: string;
43
+ 600: string;
44
+ 700: string;
45
+ 800: string;
46
+ 900: string;
47
+ A100: string;
48
+ A200: string;
49
+ A400: string;
50
+ A700: string;
51
+ };
@@ -1,4 +1,4 @@
1
- export declare const lunitGreen: {
1
+ export declare const lunit_green: {
2
2
  5: string;
3
3
  10: string;
4
4
  20: string;
@@ -10,7 +10,7 @@ export declare const lunitGreen: {
10
10
  80: string;
11
11
  90: string;
12
12
  };
13
- export declare const lunitGreenText: {
13
+ export declare const lunit_greenText: {
14
14
  5: string;
15
15
  10: string;
16
16
  20: string;
@@ -1,4 +1,4 @@
1
- export declare const lunitTeal: {
1
+ export declare const lunit_teal: {
2
2
  5: string;
3
3
  10: string;
4
4
  20: string;
@@ -10,7 +10,7 @@ export declare const lunitTeal: {
10
10
  80: string;
11
11
  90: string;
12
12
  };
13
- export declare const lunitTealText: {
13
+ export declare const lunit_tealText: {
14
14
  5: string;
15
15
  10: string;
16
16
  20: string;
@@ -9,8 +9,8 @@ declare module "@mui/material/styles/createPalette" {
9
9
  grey: GreyColor;
10
10
  blue: BaseColor;
11
11
  green: BaseColor;
12
- lunitGreen: BaseColor;
13
- lunitTeal: BaseColor;
12
+ lunit_green: BaseColor;
13
+ lunit_teal: BaseColor;
14
14
  magenta: BaseColor;
15
15
  orange: BaseColor;
16
16
  red: BaseColor;
@@ -23,8 +23,8 @@ declare module "@mui/material/styles/createPalette" {
23
23
  grey: GreyColor;
24
24
  blue: BaseColor;
25
25
  green: BaseColor;
26
- lunitGreen: BaseColor;
27
- lunitTeal: BaseColor;
26
+ lunit_green: BaseColor;
27
+ lunit_teal: BaseColor;
28
28
  magenta: BaseColor;
29
29
  orange: BaseColor;
30
30
  red: BaseColor;
@@ -57,12 +57,46 @@ export declare const createColorCssBaseline: () => {
57
57
  };
58
58
  };
59
59
  declare const paletteOptions: {
60
+ primary: {
61
+ main: string;
62
+ };
63
+ secondary: {
64
+ main: string;
65
+ };
66
+ error: {
67
+ main: string;
68
+ };
69
+ warning: {
70
+ main: string;
71
+ };
72
+ info: {
73
+ main: string;
74
+ };
75
+ success: {
76
+ main: string;
77
+ };
78
+ grey: {
79
+ 50: string;
80
+ 100: string;
81
+ 200: string;
82
+ 300: string;
83
+ 400: string;
84
+ 500: string;
85
+ 600: string;
86
+ 700: string;
87
+ 800: string;
88
+ 900: string;
89
+ A100: string;
90
+ A200: string;
91
+ A400: string;
92
+ A700: string;
93
+ };
60
94
  lunit: {
61
95
  grey: GreyColor;
62
96
  blue: BaseColor;
63
97
  green: BaseColor;
64
- lunitGreen: BaseColor;
65
- lunitTeal: BaseColor;
98
+ lunit_green: BaseColor;
99
+ lunit_teal: BaseColor;
66
100
  magenta: BaseColor;
67
101
  orange: BaseColor;
68
102
  red: BaseColor;
@@ -90,6 +124,7 @@ declare const paletteOptions: {
90
124
  icon_info_02: string;
91
125
  hover: string;
92
126
  focused: string;
127
+ selected: string;
93
128
  shadow_01: string;
94
129
  shadow_02: string;
95
130
  shadow_03: string;
@@ -117,10 +152,7 @@ declare const paletteOptions: {
117
152
  selectcontrol_handler_shadow: string;
118
153
  textfield_bg: string;
119
154
  textfield_border_error: string;
120
- dropdown_option_selected: string;
121
155
  dropdown_divider_border: string;
122
- dropdown_option_activatied: string;
123
- datatable_cell_selected: string;
124
156
  datatable_border_01: string;
125
157
  datatable_border_02: string;
126
158
  datatable_zebra: string;
@@ -152,4 +184,5 @@ declare const paletteOptions: {
152
184
  };
153
185
  };
154
186
  };
187
+ export { base };
155
188
  export default paletteOptions;
@@ -22,6 +22,7 @@ export interface ColorToken {
22
22
  icon_info_02: CSSPropertyColor;
23
23
  hover: CSSPropertyColor;
24
24
  focused: CSSPropertyColor;
25
+ selected: CSSPropertyColor;
25
26
  shadow_01: CSSPropertyColor;
26
27
  shadow_02: CSSPropertyColor;
27
28
  shadow_03: CSSPropertyColor;
@@ -49,10 +50,7 @@ export interface ColorToken {
49
50
  selectcontrol_handler_shadow: CSSPropertyColor;
50
51
  textfield_bg: CSSPropertyColor;
51
52
  textfield_border_error: CSSPropertyColor;
52
- dropdown_option_selected: CSSPropertyColor;
53
53
  dropdown_divider_border: CSSPropertyColor;
54
- dropdown_option_activatied: CSSPropertyColor;
55
- datatable_cell_selected: CSSPropertyColor;
56
54
  datatable_border_01: CSSPropertyColor;
57
55
  datatable_border_02: CSSPropertyColor;
58
56
  datatable_zebra: CSSPropertyColor;
@@ -4,12 +4,46 @@ export declare const foundationCssBaseline: Components<Theme>["MuiCssBaseline"];
4
4
  export declare const typography: import("@mui/material").TypographyVariantsOptions;
5
5
  export { typographyDefaultProps };
6
6
  export declare const palette: {
7
+ primary: {
8
+ main: string;
9
+ };
10
+ secondary: {
11
+ main: string;
12
+ };
13
+ error: {
14
+ main: string;
15
+ };
16
+ warning: {
17
+ main: string;
18
+ };
19
+ info: {
20
+ main: string;
21
+ };
22
+ success: {
23
+ main: string;
24
+ };
25
+ grey: {
26
+ 50: string;
27
+ 100: string;
28
+ 200: string;
29
+ 300: string;
30
+ 400: string;
31
+ 500: string;
32
+ 600: string;
33
+ 700: string;
34
+ 800: string;
35
+ 900: string;
36
+ A100: string;
37
+ A200: string;
38
+ A400: string;
39
+ A700: string;
40
+ };
7
41
  lunit: {
8
42
  grey: import("./colors").GreyColor;
9
43
  blue: import("./colors").BaseColor;
10
44
  green: import("./colors").BaseColor;
11
- lunitGreen: import("./colors").BaseColor;
12
- lunitTeal: import("./colors").BaseColor;
45
+ lunit_green: import("./colors").BaseColor;
46
+ lunit_teal: import("./colors").BaseColor;
13
47
  magenta: import("./colors").BaseColor;
14
48
  orange: import("./colors").BaseColor;
15
49
  red: import("./colors").BaseColor;
@@ -37,6 +71,7 @@ export declare const palette: {
37
71
  icon_info_02: string;
38
72
  hover: string;
39
73
  focused: string;
74
+ selected: string;
40
75
  shadow_01: string;
41
76
  shadow_02: string;
42
77
  shadow_03: string;
@@ -64,10 +99,7 @@ export declare const palette: {
64
99
  selectcontrol_handler_shadow: string;
65
100
  textfield_bg: string;
66
101
  textfield_border_error: string;
67
- dropdown_option_selected: string;
68
102
  dropdown_divider_border: string;
69
- dropdown_option_activatied: string;
70
- datatable_cell_selected: string;
71
103
  datatable_border_01: string;
72
104
  datatable_border_02: string;
73
105
  datatable_zebra: string;
@@ -1,4 +1,5 @@
1
1
  export { default as theme } from "./theme";
2
+ export { base as baseColors } from "./foundation/colors";
2
3
  export { default as Alert } from "./components/Alert";
3
4
  export { default as Button } from "./components/Button";
4
5
  export { default as Chip } from "./components/Chip";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunit/design-system",
3
- "version": "1.0.0-a.2",
3
+ "version": "1.0.0-a.3",
4
4
  "description": "Lunit Design System",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/index.js",
@@ -35,11 +35,11 @@
35
35
  "directory": "packages/design-system"
36
36
  },
37
37
  "scripts": {
38
- "build:prepare": "tsc -p tsconfig.build.json",
38
+ "build:transpile": "tsc -p tsconfig.build.json",
39
39
  "build:cjs": "webpack -c webpack/cjs.config.js",
40
- "build": "yarn build:prepare && yarn build:cjs",
41
- "storybook": "start-storybook -p 6006",
42
- "build-storybook": "build-storybook",
40
+ "build": "yarn build:transpile && yarn build:cjs",
41
+ "storybook": "storybook dev -p 6006",
42
+ "build-storybook": "storybook build",
43
43
  "chromatic": "chromatic"
44
44
  },
45
45
  "nx": {
@@ -53,21 +53,25 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@babel/core": "^7.17.10",
56
+ "@babel/preset-env": "^7.21.4",
57
+ "@babel/preset-react": "^7.18.6",
58
+ "@babel/preset-typescript": "^7.21.4",
56
59
  "@emotion/react": "^11.9.0",
57
60
  "@emotion/styled": "^11.8.1",
61
+ "@mui/icons-material": "^5.11.3",
58
62
  "@mui/material": "^5.11.3",
59
63
  "@mui/utils": "^5.11.3",
60
64
  "@mui/x-date-pickers": "^5.0.16",
61
- "@storybook/addon-actions": "^6.4.22",
62
- "@storybook/addon-essentials": "^6.4.22",
63
- "@storybook/addon-interactions": "^6.4.22",
64
- "@storybook/addon-links": "^6.4.22",
65
- "@storybook/addon-storysource": "^6.4.22",
66
- "@storybook/builder-webpack5": "^6.4.22",
67
- "@storybook/manager-webpack5": "^6.4.22",
68
- "@storybook/react": "^6.4.22",
69
- "@storybook/testing-library": "^0.0.11",
70
- "@storybook/theming": "^6.4.22",
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",
73
+ "@storybook/testing-library": "^0.1.0",
74
+ "@storybook/theming": "^7.0.6",
71
75
  "@types/lodash": "^4.14.182",
72
76
  "babel-loader": "^8.2.5",
73
77
  "chromatic": "^6.7.0",
@@ -76,7 +80,8 @@
76
80
  "mustache": "^4.2.0",
77
81
  "react": "^17.0.2",
78
82
  "react-dom": "^17.0.2",
79
- "storybook-addon-pseudo-states": "^1.15.1",
83
+ "storybook": "^7.0.6",
84
+ "storybook-addon-pseudo-states": "^2.0.0",
80
85
  "ts-loader": "^9.3.0",
81
86
  "typescript": "^4.6.4",
82
87
  "webpack": "^5.72.0",
@@ -0,0 +1,60 @@
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>(({ 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
+ }));
42
+
43
+ export const StyledAlertTitle = styled(MuiAlertTitle)(({ theme }) => ({
44
+ "&.MuiAlertTitle-root": {
45
+ marginTop: 0,
46
+ marginBottom: 8,
47
+ fontWeight: 700,
48
+ fontSize: "14px",
49
+ lineHeight: "20px",
50
+ color: theme.palette.token.core.text_normal,
51
+ },
52
+ }));
53
+
54
+ export const StyledAlertChildren = styled("div")(({ theme }) => ({
55
+ color: theme.palette.token.core.text_normal,
56
+ }));
57
+
58
+ export const StyledBottomAction = styled("div")({
59
+ marginTop: "12px",
60
+ });
@@ -1,9 +1,53 @@
1
- import React from "react";
1
+ import React, { forwardRef } from "react";
2
+ import {
3
+ StyledAlert,
4
+ StyledAlertTitle,
5
+ StyledAlertChildren,
6
+ StyledBottomAction,
7
+ } from "./Alert.styled";
8
+ import { AlertProps } from "./Alert.types";
9
+ import {
10
+ Close,
11
+ Success,
12
+ Error,
13
+ Warning,
14
+ Information,
15
+ } from "@lunit/design-system-icons";
16
+ import Button from "../Button";
2
17
 
3
- import { Box } from "@mui/material";
4
-
5
- const Alert = () => {
6
- return <Box>Alert</Box>;
18
+ const MAPPED_ICON = {
19
+ success: <Success variant="filled" />,
20
+ info: <Information variant="filled" />,
21
+ warning: <Warning variant="filled" />,
22
+ error: <Error variant="filled" />,
7
23
  };
8
24
 
25
+ const Alert = forwardRef<HTMLDivElement, AlertProps>((props, ref) => {
26
+ const { title, severity, children, bottomAction, onClose, ...rest } = props;
27
+ return (
28
+ <StyledAlert
29
+ ref={ref}
30
+ severity={severity}
31
+ iconMapping={MAPPED_ICON}
32
+ slots={{
33
+ closeButton: () => (
34
+ <Button
35
+ kind="ghost"
36
+ size="small"
37
+ color="secondary"
38
+ icon={<Close />}
39
+ onClick={onClose}
40
+ />
41
+ ),
42
+ }}
43
+ onClose={onClose}
44
+ {...rest}
45
+ >
46
+ {title && <StyledAlertTitle>{title}</StyledAlertTitle>}
47
+ <StyledAlertChildren>{children}</StyledAlertChildren>
48
+ {bottomAction && <StyledBottomAction>{bottomAction}</StyledBottomAction>}
49
+ </StyledAlert>
50
+ );
51
+ });
52
+
9
53
  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
+ }