@lunit/oui 1.0.1-alpha.13 → 1.0.1-alpha.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.
Files changed (212) hide show
  1. package/dist/index.js +0 -1
  2. package/dist/types/index.d.ts +0 -1
  3. package/package.json +7 -20
  4. package/src/assets/ic-bell-noti-outlined-20px.tsx +21 -0
  5. package/src/assets/ic-close-large-outlined-20px.tsx +17 -0
  6. package/src/assets/ic-close-small-outlined-20px.tsx +17 -0
  7. package/src/assets/ic-download-pdf-outlined-20px.tsx +18 -0
  8. package/src/assets/ic-ellipse-outlined-20px.tsx +17 -0
  9. package/src/assets/ic-filter-noti-outlined-20px.tsx +21 -0
  10. package/src/assets/ic-hide-large-outlined-20px.tsx +13 -0
  11. package/src/assets/ic-hide-small-outlined-20px.tsx +17 -0
  12. package/src/assets/ic-information-large-outlined-20px.tsx +17 -0
  13. package/src/assets/ic-information-small-outlined-20px.tsx +17 -0
  14. package/src/assets/ic-manufacturer-outlined-20px.tsx +19 -0
  15. package/src/assets/ic-rectangle-outlined-20px.tsx +17 -0
  16. package/src/assets/ic-refresh-left-outlined-20px.tsx +17 -0
  17. package/src/assets/ic-refresh-right-outlined-20px.tsx +13 -0
  18. package/src/assets/ic-show-large-outlined-20px.tsx +17 -0
  19. package/src/assets/ic-show-small-outlined-20px.tsx +17 -0
  20. package/src/assets/ic_bell_noti=outlined_20px.svg +5 -0
  21. package/src/assets/ic_close_large=outlined_20px.svg +4 -0
  22. package/src/assets/ic_close_small=outlined_20px.svg +4 -0
  23. package/src/assets/ic_download_pdf=outlined_20px.svg +7 -0
  24. package/src/assets/ic_ellipse=outlined_20px.svg +4 -0
  25. package/src/assets/ic_filter_noti=outlined_20px.svg +5 -0
  26. package/src/assets/ic_hide_large=outlined_20px.svg +4 -0
  27. package/src/assets/ic_hide_small=outlined_20px.svg +4 -0
  28. package/src/assets/ic_information_large=outlined_20px.svg +4 -0
  29. package/src/assets/ic_information_small=outlined_20px.svg +4 -0
  30. package/src/assets/ic_manufacturer=outlined_20px.svg +3 -0
  31. package/src/assets/ic_rectangle=outlined_20px.svg +4 -0
  32. package/src/assets/ic_refresh_left=outlined_20px.svg +4 -0
  33. package/src/assets/ic_refresh_right=outlined_20px.svg +4 -0
  34. package/src/assets/ic_show_large=outlined_20px.svg +4 -0
  35. package/src/assets/ic_show_small=outlined_20px.svg +4 -0
  36. package/src/assets/index.ts +16 -0
  37. package/src/components/Alert/Alert.styled.ts +44 -0
  38. package/src/components/Alert/Alert.tsx +39 -0
  39. package/src/components/Alert/Alert.types.ts +5 -0
  40. package/src/components/Alert/Alert.utils.tsx +43 -0
  41. package/src/components/Alert/index.ts +5 -0
  42. package/src/components/BaseTextField/BaseTextField.styled.ts +110 -0
  43. package/src/components/BaseTextField/BaseTextField.types.ts +25 -0
  44. package/src/components/BaseTextField/BaseTextField.utils.ts +10 -0
  45. package/src/components/Button/BaseButton.tsx +19 -0
  46. package/src/components/Button/Button.tsx +117 -0
  47. package/src/components/Button/Button.types.ts +36 -0
  48. package/src/components/Button/Button.utils.ts +13 -0
  49. package/src/components/Button/index.ts +6 -0
  50. package/src/components/Button/styleds/BaseButton.styled.ts +57 -0
  51. package/src/components/Button/styleds/ContainedButton.styled.ts +123 -0
  52. package/src/components/Button/styleds/GhostButton.styled.ts +139 -0
  53. package/src/components/Button/styleds/IconButton.styled.ts +25 -0
  54. package/src/components/Button/styleds/OutlinedButton.styled.ts +144 -0
  55. package/src/components/Card/Card.styled.tsx +18 -0
  56. package/src/components/Card/Card.tsx +18 -0
  57. package/src/components/Card/Card.types.ts +10 -0
  58. package/src/components/Card/index.ts +5 -0
  59. package/src/components/Checkbox/Checkbox.styled.tsx +27 -0
  60. package/src/components/Checkbox/Checkbox.tsx +64 -0
  61. package/src/components/Checkbox/Checkbox.types.ts +16 -0
  62. package/src/components/Checkbox/Checkbox.utils.tsx +42 -0
  63. package/src/components/Checkbox/index.ts +5 -0
  64. package/src/components/Chip/Chip.styled.ts +120 -0
  65. package/src/components/Chip/Chip.tsx +33 -0
  66. package/src/components/Chip/Chip.types.ts +18 -0
  67. package/src/components/Chip/Chip.utils.tsx +50 -0
  68. package/src/components/Chip/index.ts +4 -0
  69. package/src/components/DataTable/DataTable.styled.ts +66 -0
  70. package/src/components/DataTable/DataTable.tsx +29 -0
  71. package/src/components/DataTable/index.ts +1 -0
  72. package/src/components/DatePicker/DatePicker.styled.ts +19 -0
  73. package/src/components/DatePicker/DatePicker.tsx +194 -0
  74. package/src/components/DatePicker/DatePicker.types.ts +8 -0
  75. package/src/components/DatePicker/index.ts +4 -0
  76. package/src/components/Dialog/Dialog.styled.ts +87 -0
  77. package/src/components/Dialog/Dialog.tsx +111 -0
  78. package/src/components/Dialog/Dialog.types.ts +19 -0
  79. package/src/components/Dialog/index.ts +5 -0
  80. package/src/components/Divider/Divider.styled.ts +24 -0
  81. package/src/components/Divider/Divider.tsx +13 -0
  82. package/src/components/Divider/Divider.types.ts +7 -0
  83. package/src/components/Divider/index.ts +5 -0
  84. package/src/components/Dropdown/Dropdown.styled.tsx +127 -0
  85. package/src/components/Dropdown/Dropdown.tsx +116 -0
  86. package/src/components/Dropdown/Dropdown.types.ts +31 -0
  87. package/src/components/Dropdown/Dropdown.utils.ts +13 -0
  88. package/src/components/Dropdown/DropdownItem.styled.tsx +66 -0
  89. package/src/components/Dropdown/DropdownItem.tsx +45 -0
  90. package/src/components/Dropdown/DropdownItem.types.ts +14 -0
  91. package/src/components/Dropdown/DropdownItem.utils.ts +14 -0
  92. package/src/components/Dropdown/DropdownSubtitle.styled.ts +13 -0
  93. package/src/components/Dropdown/DropdownSubtitle.tsx +9 -0
  94. package/src/components/Dropdown/DropdownSubtitle.types.ts +6 -0
  95. package/src/components/Dropdown/IconDropdown.styled.tsx +82 -0
  96. package/src/components/Dropdown/IconDropdown.tsx +56 -0
  97. package/src/components/Dropdown/IconDropdown.types.ts +22 -0
  98. package/src/components/Dropdown/index.ts +22 -0
  99. package/src/components/FileDnDZone/FileDnDZone.styled.ts +43 -0
  100. package/src/components/FileDnDZone/FileDnDZone.tsx +81 -0
  101. package/src/components/FileDnDZone/FileDnDZone.types.ts +14 -0
  102. package/src/components/FileDnDZone/FileDnDZone.utils.ts +3 -0
  103. package/src/components/FileDnDZone/index.ts +5 -0
  104. package/src/components/List/List.styled.ts +31 -0
  105. package/src/components/List/List.tsx +71 -0
  106. package/src/components/List/List.types.ts +24 -0
  107. package/src/components/List/List.utils.ts +14 -0
  108. package/src/components/List/ListItem.styled.tsx +61 -0
  109. package/src/components/List/ListItem.tsx +66 -0
  110. package/src/components/List/ListItem.types.ts +40 -0
  111. package/src/components/List/ListItemCaption.styled.tsx +7 -0
  112. package/src/components/List/ListItemCaption.tsx +18 -0
  113. package/src/components/List/ListItemCaption.types.ts +2 -0
  114. package/src/components/List/index.ts +8 -0
  115. package/src/components/LoadingIndicator/LoadingIndicator.styled.tsx +40 -0
  116. package/src/components/LoadingIndicator/LoadingIndicator.tsx +44 -0
  117. package/src/components/LoadingIndicator/LoadingIndicator.types.ts +7 -0
  118. package/src/components/LoadingIndicator/assets/DnaLoadingAnimation.json +769 -0
  119. package/src/components/LoadingIndicator/assets/DotLoadingAnimation.json +426 -0
  120. package/src/components/LoadingIndicator/index.ts +5 -0
  121. package/src/components/Menu/Menu.styled.tsx +42 -0
  122. package/src/components/Menu/Menu.tsx +28 -0
  123. package/src/components/Menu/Menu.types.ts +18 -0
  124. package/src/components/Menu/MenuItem.styled.ts +62 -0
  125. package/src/components/Menu/MenuItem.tsx +45 -0
  126. package/src/components/Menu/MenuItem.types.ts +14 -0
  127. package/src/components/Menu/index.ts +5 -0
  128. package/src/components/MuiCssBaseline.ts +78 -0
  129. package/src/components/MuiInputBase.ts +25 -0
  130. package/src/components/MuiOutlinedInput.ts +57 -0
  131. package/src/components/MuiTextField.ts +17 -0
  132. package/src/components/Pagination/Pagination.styled.tsx +71 -0
  133. package/src/components/Pagination/Pagination.tsx +182 -0
  134. package/src/components/Pagination/Pagination.types.ts +39 -0
  135. package/src/components/Pagination/index.ts +2 -0
  136. package/src/components/ProductLabel/ProductLabel.styled.ts +61 -0
  137. package/src/components/ProductLabel/ProductLabel.tsx +57 -0
  138. package/src/components/ProductLabel/ProductLabel.types.ts +10 -0
  139. package/src/components/ProductLabel/index.ts +5 -0
  140. package/src/components/Progress/CircularProgress.styled.ts +10 -0
  141. package/src/components/Progress/CircularProgress.tsx +15 -0
  142. package/src/components/Progress/CircularProgress.types.ts +6 -0
  143. package/src/components/Progress/LinearProgress.styled.ts +15 -0
  144. package/src/components/Progress/LinearProgress.tsx +16 -0
  145. package/src/components/Progress/LinearProgress.types.ts +7 -0
  146. package/src/components/Progress/index.ts +4 -0
  147. package/src/components/Radio/Radio.styled.ts +35 -0
  148. package/src/components/Radio/Radio.tsx +60 -0
  149. package/src/components/Radio/Radio.types.ts +15 -0
  150. package/src/components/Radio/RadioGroup.styled.ts +6 -0
  151. package/src/components/Radio/RadioGroup.tsx +23 -0
  152. package/src/components/Radio/RadioGroup.types.ts +10 -0
  153. package/src/components/Radio/index.ts +7 -0
  154. package/src/components/Stepper/Stepper.styled.ts +38 -0
  155. package/src/components/Stepper/Stepper.tsx +24 -0
  156. package/src/components/Stepper/Stepper.types.ts +13 -0
  157. package/src/components/Stepper/index.ts +5 -0
  158. package/src/components/TabbedPanel/TabbedPanel.styled.ts +129 -0
  159. package/src/components/TabbedPanel/TabbedPanel.tsx +70 -0
  160. package/src/components/TabbedPanel/TabbedPanel.types.ts +36 -0
  161. package/src/components/TabbedPanel/TabbedPanel.utils.ts +21 -0
  162. package/src/components/TabbedPanel/index.ts +5 -0
  163. package/src/components/TextField/TextArea.styled.tsx +36 -0
  164. package/src/components/TextField/TextArea.tsx +35 -0
  165. package/src/components/TextField/TextArea.types.ts +28 -0
  166. package/src/components/TextField/TextInput.styled.tsx +115 -0
  167. package/src/components/TextField/TextInput.tsx +27 -0
  168. package/src/components/TextField/TextInput.types.ts +46 -0
  169. package/src/components/TextField/TextInput.utils.ts +7 -0
  170. package/src/components/TextField/components/Buttons.tsx +26 -0
  171. package/src/components/TextField/components/NormalTextInput.tsx +95 -0
  172. package/src/components/TextField/components/PasswordInput.tsx +92 -0
  173. package/src/components/TextField/index.ts +7 -0
  174. package/src/components/Tooltip/Tooltip.styled.tsx +36 -0
  175. package/src/components/Tooltip/Tooltip.tsx +58 -0
  176. package/src/components/Tooltip/Tooltip.types.ts +24 -0
  177. package/src/components/Tooltip/Tooltip.utils.ts +46 -0
  178. package/src/components/Tooltip/index.ts +5 -0
  179. package/src/components/UploadManager/UploadManager.styled.ts +49 -0
  180. package/src/components/UploadManager/UploadManager.tsx +271 -0
  181. package/src/components/UploadManager/UploadManager.types.ts +16 -0
  182. package/src/components/UploadManager/index.ts +5 -0
  183. package/src/components/index.ts +23 -0
  184. package/src/foundations/index.ts +4 -0
  185. package/src/foundations/palette.ts +418 -0
  186. package/src/foundations/spacing.ts +5 -0
  187. package/src/foundations/styles.ts +9 -0
  188. package/src/foundations/typography.ts +492 -0
  189. package/src/icons/BellNoti/index.tsx +28 -0
  190. package/src/icons/CloseLarge/index.tsx +28 -0
  191. package/src/icons/CloseSmall/index.tsx +28 -0
  192. package/src/icons/DownloadPdf/index.tsx +28 -0
  193. package/src/icons/Ellipse/index.tsx +28 -0
  194. package/src/icons/FilterNoti/index.tsx +28 -0
  195. package/src/icons/HideLarge/index.tsx +28 -0
  196. package/src/icons/HideSmall/index.tsx +28 -0
  197. package/src/icons/InformationLarge/index.tsx +28 -0
  198. package/src/icons/InformationSmall/index.tsx +28 -0
  199. package/src/icons/Manufacturer/index.tsx +28 -0
  200. package/src/icons/Rectangle/index.tsx +28 -0
  201. package/src/icons/RefreshLeft/index.tsx +28 -0
  202. package/src/icons/RefreshRight/index.tsx +28 -0
  203. package/src/icons/ShowLarge/index.tsx +28 -0
  204. package/src/icons/ShowSmall/index.tsx +28 -0
  205. package/src/icons/index.ts +180 -0
  206. package/src/index.ts +4 -0
  207. package/src/react-app-env.d.ts +71 -0
  208. package/src/reportWebVitals.ts +15 -0
  209. package/src/setupTests.ts +5 -0
  210. package/src/systems/drawer.ts +27 -0
  211. package/src/systems/index.ts +7 -0
  212. package/src/theme.ts +22 -0
@@ -0,0 +1,127 @@
1
+ import React from 'react';
2
+ import { Select, Typography, Box, styled } from '@mui/material';
3
+ import type { Theme } from '@mui/material';
4
+ import type { BaseDropdownProps, DropdownContainerProps, PlaceholderProps } from './Dropdown.types';
5
+
6
+ const baseDropdownStyle = (theme: Theme) => {
7
+ return {
8
+ fontFamily:
9
+ 'Pretendard,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"',
10
+ fontSize: '14px',
11
+ fontWeight: '400',
12
+ background: theme.palette.neutralGrey[85],
13
+ borderRadius: '8px',
14
+ border: '1px solid transparent',
15
+ height: '36px',
16
+ color: theme.palette.neutralGrey[5],
17
+ padding: '0 2px',
18
+ '.MuiSelect-select': {
19
+ paddingRight: '0px !important',
20
+ },
21
+ '& fieldset': {
22
+ border: 'none',
23
+ },
24
+ '&.Mui-focused': {
25
+ border: `1px solid ${theme.palette.lunitTeal[10]} !important`,
26
+ },
27
+ '&.Mui-disabled': { border: 'none', background: theme.palette.neutralGrey[75] },
28
+ '.MuiSvgIcon-root ': {
29
+ cursor: 'pointer',
30
+ marginRight: '16px',
31
+ color: theme.palette.neutralGrey[5],
32
+ '&.Mui-disabled': {
33
+ color: theme.palette.neutralGrey[45],
34
+ },
35
+ },
36
+ '&:hover': {
37
+ border: `1px solid ${theme.palette.neutralGrey[45]}`,
38
+ '&.Mui-disabled': {
39
+ border: '1px solid transparent',
40
+ },
41
+ },
42
+ };
43
+ };
44
+
45
+ const fixedWidthDropdownStyle = {
46
+ width: '240px',
47
+ };
48
+
49
+ const errorDropdownStyle = (theme: Theme) => ({
50
+ border: `1px solid ${theme.palette.red[5]} !important`,
51
+ });
52
+
53
+ const BaseDropdown = styled(Select, {
54
+ shouldForwardProp: (prop) => prop !== 'small',
55
+ })<BaseDropdownProps>(({ theme, error, autoWidth, fullWidth, open }) => {
56
+ let style = baseDropdownStyle(theme);
57
+ if (!autoWidth && !fullWidth) {
58
+ style = {
59
+ ...style,
60
+ ...fixedWidthDropdownStyle,
61
+ };
62
+ }
63
+ if (error) {
64
+ style = {
65
+ ...style,
66
+ ...errorDropdownStyle(theme),
67
+ };
68
+ }
69
+ // add FocusStyle when click arrow
70
+ const openFocusStyle = open
71
+ ? { border: `1px solid ${theme.palette.lunitTeal[10]} !important` }
72
+ : {};
73
+ return { ...style, ...openFocusStyle };
74
+ });
75
+
76
+ const DropdownContainer = styled(Box, {
77
+ shouldForwardProp: (prop) => prop !== 'fullWidth',
78
+ })<DropdownContainerProps>(({ fullWidth }) => {
79
+ if (fullWidth) {
80
+ return {
81
+ position: 'relative',
82
+ display: 'flex',
83
+ flexDirection: 'column',
84
+ width: '100%',
85
+ };
86
+ }
87
+
88
+ return {
89
+ position: 'relative',
90
+ display: 'flex',
91
+ flexDirection: 'column',
92
+ width: '240px',
93
+ };
94
+ });
95
+
96
+ const PlaceholderElem = styled(Typography)<PlaceholderProps>(({ theme, disabled }) => {
97
+ return {
98
+ color: theme.palette.neutralGrey[45],
99
+ position: 'absolute' as const,
100
+ left: '16px',
101
+ top: '8px',
102
+ backgroundColor: 'transparent',
103
+ height: '30px',
104
+ pointerEvents: 'none',
105
+ opacity: disabled ? '0.4' : '1',
106
+ cursor: 'pointer !important',
107
+ };
108
+ });
109
+
110
+ const DropdownPlaceholder = ({
111
+ placeholder,
112
+ disabled,
113
+ }: {
114
+ placeholder: string;
115
+ disabled?: boolean;
116
+ }) => {
117
+ return (
118
+ <PlaceholderElem
119
+ variant="body5"
120
+ disabled={disabled}
121
+ >
122
+ {placeholder}
123
+ </PlaceholderElem>
124
+ );
125
+ };
126
+
127
+ export { BaseDropdown, DropdownPlaceholder, DropdownContainer };
@@ -0,0 +1,116 @@
1
+ import React from 'react';
2
+ import { ArrowDown } from '../../icons';
3
+
4
+ import type { SelectChangeEvent } from '@mui/material';
5
+ import { useState } from 'react';
6
+ import { BaseDropdown, DropdownContainer, DropdownPlaceholder } from './Dropdown.styled';
7
+ import type { DropdownComponent, DropdownProps } from './Dropdown.types';
8
+ import { handlePlaceholder } from './Dropdown.utils';
9
+
10
+ import theme from '../../theme';
11
+ import { InputMsg } from '../BaseTextField/BaseTextField.styled';
12
+ import { BUTTON_DROPDOWN_ITEM } from './DropdownItem.utils';
13
+
14
+ const Dropdown = (({
15
+ children,
16
+ placeholder,
17
+ value,
18
+ error,
19
+ helperMsg,
20
+ onChange,
21
+ sx,
22
+ style,
23
+ MenuProps = undefined,
24
+ ContainerProps,
25
+ ...otherProps
26
+ }: DropdownProps) => {
27
+ // Prevents selecting a DropdownItem with `asButton` property.
28
+ const handleChange = (e: SelectChangeEvent<unknown>, child: React.ReactNode) => {
29
+ if (!!onChange && e.target.value !== BUTTON_DROPDOWN_ITEM) {
30
+ onChange(e, child);
31
+ }
32
+ };
33
+ const [isOpen, setOpen] = useState<boolean>(false);
34
+
35
+ return (
36
+ <DropdownContainer
37
+ {...ContainerProps}
38
+ fullWidth={otherProps.fullWidth}
39
+ >
40
+ <BaseDropdown
41
+ sx={sx}
42
+ style={style}
43
+ IconComponent={() => (
44
+ <ArrowDown
45
+ onClick={() => {
46
+ if (typeof otherProps.open === 'undefined') setOpen(false);
47
+ }}
48
+ style={
49
+ isOpen || otherProps.open
50
+ ? {
51
+ cursor: 'pointer',
52
+ transform: 'scaleY(-1)',
53
+ }
54
+ : undefined
55
+ }
56
+ />
57
+ )}
58
+ onClick={() => {
59
+ if (!otherProps.disabled) setOpen(!isOpen);
60
+ }}
61
+ // https://github.com/mui/material-ui/issues/26076#issuecomment-1014345564
62
+ onClose={() => {
63
+ setTimeout(() => {
64
+ (document.activeElement as HTMLElement).blur();
65
+ }, 0);
66
+ }}
67
+ onChange={handleChange}
68
+ error={!!error}
69
+ open={
70
+ // eslint-disable-next-line no-nested-ternary
71
+ typeof otherProps.open !== 'undefined'
72
+ ? otherProps.open
73
+ : otherProps.disabled
74
+ ? false
75
+ : isOpen
76
+ }
77
+ // MUI expects a value of '' if undefined :S
78
+ value={value ?? ''}
79
+ MenuProps={
80
+ MenuProps ?? {
81
+ disablePortal: true,
82
+ sx: {
83
+ '.MuiPaper-root': {
84
+ marginTop: '4px',
85
+ borderRadius: '8px',
86
+ background: theme.palette.neutralGrey[85],
87
+ border: 'transparent',
88
+ },
89
+ },
90
+ }
91
+ }
92
+ {...otherProps}
93
+ >
94
+ {children}
95
+ </BaseDropdown>
96
+ {handlePlaceholder(value) && placeholder && (
97
+ <DropdownPlaceholder
98
+ placeholder={placeholder}
99
+ disabled={otherProps.disabled}
100
+ />
101
+ )}
102
+ {error ? (
103
+ <InputMsg
104
+ variant="body5"
105
+ error
106
+ >
107
+ {error}
108
+ </InputMsg>
109
+ ) : (
110
+ helperMsg && <InputMsg variant="body5">{helperMsg}</InputMsg>
111
+ )}
112
+ </DropdownContainer>
113
+ );
114
+ }) as DropdownComponent;
115
+
116
+ export default Dropdown;
@@ -0,0 +1,31 @@
1
+ import type { BoxProps, SelectProps, TypographyProps } from '@mui/material';
2
+ import { IconDropdownOption } from './IconDropdown.types';
3
+
4
+ interface DropdownContainerProps extends BoxProps {
5
+ fullWidth?: boolean;
6
+ }
7
+
8
+ type BaseDropdownProps<T = unknown> = SelectProps<T>;
9
+ interface DropdownProps<T = unknown>
10
+ extends Omit<BaseDropdownProps<T>, 'IconComponent' | 'error' | 'sx' | 'style'> {
11
+ error?: string;
12
+ helperMsg?: string;
13
+ ContainerProps?: BoxProps;
14
+ sx?: SelectProps['sx'];
15
+ style?: SelectProps['style'];
16
+ options?: IconDropdownOption[];
17
+ }
18
+
19
+ interface PlaceholderProps extends TypographyProps {
20
+ disabled?: boolean;
21
+ }
22
+
23
+ type DropdownComponent = <T>(props: DropdownProps<T>) => JSX.Element;
24
+
25
+ export type {
26
+ DropdownContainerProps,
27
+ DropdownProps,
28
+ BaseDropdownProps,
29
+ PlaceholderProps,
30
+ DropdownComponent,
31
+ };
@@ -0,0 +1,13 @@
1
+ const PLACEHOLDER_VAL = 'PLACEHOLDER_VAL';
2
+
3
+ const handlePlaceholder = (value: unknown) => {
4
+ if (Array.isArray(value)) {
5
+ if (value.length) {
6
+ return false;
7
+ }
8
+ return true;
9
+ }
10
+ return !value;
11
+ };
12
+
13
+ export { PLACEHOLDER_VAL, handlePlaceholder };
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import { MenuItem, Typography, styled } from '@mui/material';
3
+ import type { Theme } from '@mui/material';
4
+ import type { BaseDropdownItemProps } from './DropdownItem.types';
5
+
6
+ const baseDropdownItemStyle = (theme: Theme) => {
7
+ return {
8
+ background: theme.palette.neutralGrey[85],
9
+ display: 'flex',
10
+ alignItems: 'center',
11
+ justifyContent: 'flex-start',
12
+ borderRadius: '8px',
13
+ position: 'relative' as const,
14
+ margin: '0 8px',
15
+ gap: '9px',
16
+ '&:hover': {
17
+ background: theme.palette.neutralGrey[75],
18
+ },
19
+ '&.Mui-disabled': {
20
+ background: theme.palette.neutralGrey[85],
21
+ opacity: '1',
22
+ color: '#C4C4C4',
23
+ cursor: 'pointer !important',
24
+ },
25
+ '&.Mui-selected': {
26
+ background: 'transparent',
27
+ '&:hover, &.Mui-selected:hover, &.Mui-focusVisible, &.Mui-selected.Mui-focusVisible': {
28
+ borderRadius: '8px',
29
+ backgroundColor: theme.palette.neutralGrey[75],
30
+ },
31
+ },
32
+ };
33
+ };
34
+
35
+ const padNoIconStyle = {
36
+ paddingLeft: '45px !important',
37
+ };
38
+
39
+ const BaseDropdownItem = styled(MenuItem, {
40
+ shouldForwardProp: (prop) => prop !== 'emptyIcon',
41
+ })<BaseDropdownItemProps>(({ theme, emptyIcon }) => {
42
+ let style = baseDropdownItemStyle(theme);
43
+
44
+ if (emptyIcon) {
45
+ style = {
46
+ ...style,
47
+ ...padNoIconStyle,
48
+ };
49
+ }
50
+
51
+ return style;
52
+ });
53
+
54
+ const BaseShortcutLabel = styled(Typography)(({ theme }) => {
55
+ return {
56
+ color: theme.palette.neutralGrey[45],
57
+ position: 'absolute' as const,
58
+ right: '20px',
59
+ };
60
+ });
61
+
62
+ const KeyboardShortcut = ({ label }: { label: string }) => {
63
+ return <BaseShortcutLabel variant="body_m1">{label}</BaseShortcutLabel>;
64
+ };
65
+
66
+ export { BaseDropdownItem, KeyboardShortcut };
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { Check } from '../../icons';
3
+ import { BaseDropdownItem, KeyboardShortcut } from './DropdownItem.styled';
4
+ import type { DropdownItemProps } from './DropdownItem.types';
5
+ import { BUTTON_DROPDOWN_ITEM, shouldPadForEmptyIcon } from './DropdownItem.utils';
6
+
7
+ const DropdownItem = ({
8
+ checkIcon,
9
+ customIcon,
10
+ children,
11
+ emptyIcon,
12
+ asButton,
13
+ value,
14
+ keyboardShortcut,
15
+ ...otherProps
16
+ }: DropdownItemProps) => {
17
+ return (
18
+ <BaseDropdownItem
19
+ {...otherProps}
20
+ value={asButton ? BUTTON_DROPDOWN_ITEM : value}
21
+ emptyIcon={shouldPadForEmptyIcon(emptyIcon, checkIcon, customIcon, otherProps.selected)}
22
+ >
23
+ {/* Custom Icon overrides check icon */}
24
+ {customIcon ?? (checkIcon && otherProps.selected && <Check />)}
25
+ {children}
26
+ {keyboardShortcut && <KeyboardShortcut label={keyboardShortcut} />}
27
+ </BaseDropdownItem>
28
+ );
29
+ };
30
+
31
+ export default DropdownItem;
32
+
33
+ /*
34
+
35
+ if checkicon, add empty padding.
36
+ if checkicon and selected, add icon
37
+
38
+ if custom icon, add icon
39
+ if checkicon and customicon, custom icon
40
+
41
+ if emptyicon, add padding
42
+ if checkicon and emptyicon, only
43
+
44
+
45
+ */
@@ -0,0 +1,14 @@
1
+ import type { MenuItemProps } from '@mui/material';
2
+
3
+ interface BaseDropdownItemProps extends MenuItemProps {
4
+ emptyIcon?: boolean;
5
+ }
6
+
7
+ interface DropdownItemProps extends BaseDropdownItemProps {
8
+ asButton?: boolean;
9
+ checkIcon?: boolean;
10
+ customIcon?: React.ReactElement;
11
+ keyboardShortcut?: string;
12
+ }
13
+
14
+ export { DropdownItemProps, BaseDropdownItemProps };
@@ -0,0 +1,14 @@
1
+ const BUTTON_DROPDOWN_ITEM = 'BUTTON_DROPDOWN_ITEM';
2
+
3
+ const shouldPadForEmptyIcon = (
4
+ emptyIcon: boolean | undefined,
5
+ checkIcon: boolean | undefined,
6
+ customIcon: React.ReactElement | undefined,
7
+ selected: boolean | undefined,
8
+ ) => {
9
+ if (checkIcon) return !selected;
10
+ if (customIcon) return false;
11
+ return !!emptyIcon;
12
+ };
13
+
14
+ export { BUTTON_DROPDOWN_ITEM, shouldPadForEmptyIcon };
@@ -0,0 +1,13 @@
1
+ import { Typography, styled } from '@mui/material';
2
+
3
+ const BaseDropdownSubtitle = styled(Typography)(({ theme }) => {
4
+ return {
5
+ color: theme.palette.neutralGrey[40],
6
+ width: '140px',
7
+ height: '20px',
8
+ padding: '8px',
9
+ paddingLeft: '16px',
10
+ };
11
+ });
12
+
13
+ export default BaseDropdownSubtitle;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import BaseDropdownSubtitle from './DropdownSubtitle.styled';
3
+ import type DropdownSubtitleProps from './DropdownSubtitle.types';
4
+
5
+ const DropdownSubtitle = ({ label }: DropdownSubtitleProps) => {
6
+ return <BaseDropdownSubtitle variant="small_body_m1">{label}</BaseDropdownSubtitle>;
7
+ };
8
+
9
+ export default DropdownSubtitle;
@@ -0,0 +1,6 @@
1
+ interface DropdownSubtitleProps {
2
+ label: string;
3
+ value?: string;
4
+ }
5
+
6
+ export default DropdownSubtitleProps;
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+ import { Select, styled } from '@mui/material';
3
+ import type { Theme } from '@mui/material';
4
+ import type { BaseIconDropdownProps, IconDropdownProps } from './IconDropdown.types';
5
+
6
+ const baseIconDropdownStyle = (theme: Theme) => {
7
+ return {
8
+ fontFamily:
9
+ 'Pretendard,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"',
10
+ fontSize: '14px',
11
+ fontWeight: '400',
12
+ background: theme.palette.neutralGrey[85],
13
+ width: '52px',
14
+ borderRadius: '8px',
15
+ border: '1px solid transparent',
16
+ padding: '0 2px 0 0',
17
+ height: '36px',
18
+ color: theme.palette.neutralGrey[5],
19
+ '& fieldset': {
20
+ border: 'none',
21
+ },
22
+ '&.Mui-focused': {
23
+ border: `1px solid transparent !important`,
24
+ },
25
+ '&.Mui-disabled': {
26
+ opacity: '0.4',
27
+ },
28
+ '.MuiSvgIcon-root ': {
29
+ cursor: 'pointer',
30
+ color: theme.palette.neutralGrey[5],
31
+ '&.Mui-disabled': {
32
+ color: theme.palette.neutralGrey[45],
33
+ },
34
+ },
35
+ '.MuiSelect-select': {
36
+ display: 'flex',
37
+ padding: '0 0 0 8px !important',
38
+ width: 'fit-content',
39
+ },
40
+ '&:hover': {
41
+ backgroundColor: theme.palette.neutralGrey[70],
42
+ opacity: 0.8,
43
+ border: `1px solid transparent`,
44
+ '&.Mui-disabled': {
45
+ border: '1px solid transparent',
46
+ },
47
+ },
48
+ };
49
+ };
50
+
51
+ const toggledIconDropdownStyle = (theme: Theme) => {
52
+ return {
53
+ backgroundColor: theme.palette.neutralGrey[70],
54
+ border: `1px solid transparent`,
55
+ };
56
+ };
57
+
58
+ const BaseIconDropdown = styled(Select, {
59
+ shouldForwardProp: (prop) => !['small', 'isToggled'].includes(prop.toString()),
60
+ })<BaseIconDropdownProps>(({ theme, isToggled }) => {
61
+ let style = baseIconDropdownStyle(theme);
62
+
63
+ if (isToggled) {
64
+ style = {
65
+ ...style,
66
+ ...toggledIconDropdownStyle(theme),
67
+ };
68
+ }
69
+
70
+ return style;
71
+ });
72
+
73
+ const DropdownContainer = styled('div')<IconDropdownProps>(() => {
74
+ return {
75
+ position: 'relative',
76
+ display: 'flex',
77
+ flexDirection: 'column',
78
+ minWidth: '32px',
79
+ };
80
+ });
81
+
82
+ export { BaseIconDropdown, DropdownContainer };
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { useState } from 'react';
3
+ import { ArrowDownXs } from '../../icons';
4
+ import { BaseIconDropdown } from './IconDropdown.styled';
5
+ import theme from '../../theme';
6
+ import type { IconDropdownProps } from './IconDropdown.types';
7
+
8
+ const IconDropdown = ({ open, disabled, children, ...otherProps }: IconDropdownProps) => {
9
+ const [isOpen, setOpen] = useState<boolean>(false);
10
+
11
+ return (
12
+ <BaseIconDropdown
13
+ IconComponent={() => (
14
+ <ArrowDownXs
15
+ onClick={() => {
16
+ if (typeof open === 'undefined') setOpen(false);
17
+ }}
18
+ style={
19
+ isOpen || open
20
+ ? {
21
+ cursor: 'pointer',
22
+ transform: 'scaleY(-1)',
23
+ }
24
+ : undefined
25
+ }
26
+ />
27
+ )}
28
+ open={
29
+ // eslint-disable-next-line no-nested-ternary
30
+ typeof open !== 'undefined' ? open : disabled ? false : isOpen
31
+ }
32
+ disabled={disabled}
33
+ multiple={false}
34
+ onClick={() => {
35
+ if (!disabled) setOpen(!isOpen);
36
+ }}
37
+ MenuProps={{
38
+ sx: {
39
+ '.MuiPaper-root': {
40
+ marginTop: '4px',
41
+ borderRadius: '8px',
42
+ background: theme.palette.neutralGrey[85],
43
+ border: 'transparent',
44
+ left: 0,
45
+ width: '260px',
46
+ },
47
+ },
48
+ }}
49
+ {...otherProps}
50
+ >
51
+ {children}
52
+ </BaseIconDropdown>
53
+ );
54
+ };
55
+
56
+ export default IconDropdown;
@@ -0,0 +1,22 @@
1
+ import type { TypographyProps } from '@mui/system';
2
+ import type { BaseDropdownProps } from '../Dropdown/Dropdown.types';
3
+
4
+ interface BaseIconDropdownProps extends BaseDropdownProps {
5
+ isToggled?: boolean;
6
+ }
7
+
8
+ interface IconDropdownProps extends BaseIconDropdownProps {}
9
+
10
+ interface PlaceholderProps extends TypographyProps {
11
+ disabled?: boolean;
12
+ }
13
+
14
+ interface IconDropdownOption {
15
+ value: string;
16
+ icon: React.ReactElement;
17
+ label: string;
18
+ shortcut?: string;
19
+ default?: boolean;
20
+ }
21
+
22
+ export { IconDropdownProps, BaseIconDropdownProps, PlaceholderProps, IconDropdownOption };
@@ -0,0 +1,22 @@
1
+ import Dropdown from './Dropdown';
2
+ import type { DropdownProps } from './Dropdown.types';
3
+
4
+ import DropdownItem from './DropdownItem';
5
+ import type { DropdownItemProps } from './DropdownItem.types';
6
+
7
+ import DropdownSubtitle from './DropdownSubtitle';
8
+ import type DropdownSubtitleProps from './DropdownSubtitle.types';
9
+
10
+ import IconDropdown from './IconDropdown';
11
+ import type { IconDropdownProps } from './IconDropdown.types';
12
+
13
+ export {
14
+ Dropdown,
15
+ DropdownProps,
16
+ DropdownItem,
17
+ DropdownItemProps,
18
+ DropdownSubtitle,
19
+ DropdownSubtitleProps,
20
+ IconDropdown,
21
+ IconDropdownProps,
22
+ };
@@ -0,0 +1,43 @@
1
+ import { Box, styled } from '@mui/material';
2
+
3
+ const commonStyle = {
4
+ display: 'flex' as const,
5
+ flexDirection: 'column' as const,
6
+ alignItems: 'center' as const,
7
+ justifyContent: 'center' as const,
8
+ };
9
+ const FileDnDZoneContainer = styled(Box)(() => {
10
+ return {
11
+ position: 'relative' as const,
12
+ height: '100%',
13
+ width: '100%',
14
+ };
15
+ });
16
+
17
+ const BaseFileDnDZone = styled(Box)(() => {
18
+ return {
19
+ ...commonStyle,
20
+ position: 'absolute',
21
+ left: 'calc(50% - 213px)',
22
+ top: '100px',
23
+ height: '196px',
24
+ width: '426px',
25
+ gap: '16px',
26
+ };
27
+ });
28
+
29
+ const DnDSection = styled(Box)(() => {
30
+ return {
31
+ ...commonStyle,
32
+ gap: '4px',
33
+ };
34
+ });
35
+
36
+ const DnDMainBox = styled(Box)(() => {
37
+ return {
38
+ ...commonStyle,
39
+ gap: '24px',
40
+ };
41
+ });
42
+
43
+ export { FileDnDZoneContainer, BaseFileDnDZone, DnDSection, DnDMainBox };