@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.
- package/dist/index.js +0 -1
- package/dist/types/index.d.ts +0 -1
- package/package.json +7 -20
- package/src/assets/ic-bell-noti-outlined-20px.tsx +21 -0
- package/src/assets/ic-close-large-outlined-20px.tsx +17 -0
- package/src/assets/ic-close-small-outlined-20px.tsx +17 -0
- package/src/assets/ic-download-pdf-outlined-20px.tsx +18 -0
- package/src/assets/ic-ellipse-outlined-20px.tsx +17 -0
- package/src/assets/ic-filter-noti-outlined-20px.tsx +21 -0
- package/src/assets/ic-hide-large-outlined-20px.tsx +13 -0
- package/src/assets/ic-hide-small-outlined-20px.tsx +17 -0
- package/src/assets/ic-information-large-outlined-20px.tsx +17 -0
- package/src/assets/ic-information-small-outlined-20px.tsx +17 -0
- package/src/assets/ic-manufacturer-outlined-20px.tsx +19 -0
- package/src/assets/ic-rectangle-outlined-20px.tsx +17 -0
- package/src/assets/ic-refresh-left-outlined-20px.tsx +17 -0
- package/src/assets/ic-refresh-right-outlined-20px.tsx +13 -0
- package/src/assets/ic-show-large-outlined-20px.tsx +17 -0
- package/src/assets/ic-show-small-outlined-20px.tsx +17 -0
- package/src/assets/ic_bell_noti=outlined_20px.svg +5 -0
- package/src/assets/ic_close_large=outlined_20px.svg +4 -0
- package/src/assets/ic_close_small=outlined_20px.svg +4 -0
- package/src/assets/ic_download_pdf=outlined_20px.svg +7 -0
- package/src/assets/ic_ellipse=outlined_20px.svg +4 -0
- package/src/assets/ic_filter_noti=outlined_20px.svg +5 -0
- package/src/assets/ic_hide_large=outlined_20px.svg +4 -0
- package/src/assets/ic_hide_small=outlined_20px.svg +4 -0
- package/src/assets/ic_information_large=outlined_20px.svg +4 -0
- package/src/assets/ic_information_small=outlined_20px.svg +4 -0
- package/src/assets/ic_manufacturer=outlined_20px.svg +3 -0
- package/src/assets/ic_rectangle=outlined_20px.svg +4 -0
- package/src/assets/ic_refresh_left=outlined_20px.svg +4 -0
- package/src/assets/ic_refresh_right=outlined_20px.svg +4 -0
- package/src/assets/ic_show_large=outlined_20px.svg +4 -0
- package/src/assets/ic_show_small=outlined_20px.svg +4 -0
- package/src/assets/index.ts +16 -0
- package/src/components/Alert/Alert.styled.ts +44 -0
- package/src/components/Alert/Alert.tsx +39 -0
- package/src/components/Alert/Alert.types.ts +5 -0
- package/src/components/Alert/Alert.utils.tsx +43 -0
- package/src/components/Alert/index.ts +5 -0
- package/src/components/BaseTextField/BaseTextField.styled.ts +110 -0
- package/src/components/BaseTextField/BaseTextField.types.ts +25 -0
- package/src/components/BaseTextField/BaseTextField.utils.ts +10 -0
- package/src/components/Button/BaseButton.tsx +19 -0
- package/src/components/Button/Button.tsx +117 -0
- package/src/components/Button/Button.types.ts +36 -0
- package/src/components/Button/Button.utils.ts +13 -0
- package/src/components/Button/index.ts +6 -0
- package/src/components/Button/styleds/BaseButton.styled.ts +57 -0
- package/src/components/Button/styleds/ContainedButton.styled.ts +123 -0
- package/src/components/Button/styleds/GhostButton.styled.ts +139 -0
- package/src/components/Button/styleds/IconButton.styled.ts +25 -0
- package/src/components/Button/styleds/OutlinedButton.styled.ts +144 -0
- package/src/components/Card/Card.styled.tsx +18 -0
- package/src/components/Card/Card.tsx +18 -0
- package/src/components/Card/Card.types.ts +10 -0
- package/src/components/Card/index.ts +5 -0
- package/src/components/Checkbox/Checkbox.styled.tsx +27 -0
- package/src/components/Checkbox/Checkbox.tsx +64 -0
- package/src/components/Checkbox/Checkbox.types.ts +16 -0
- package/src/components/Checkbox/Checkbox.utils.tsx +42 -0
- package/src/components/Checkbox/index.ts +5 -0
- package/src/components/Chip/Chip.styled.ts +120 -0
- package/src/components/Chip/Chip.tsx +33 -0
- package/src/components/Chip/Chip.types.ts +18 -0
- package/src/components/Chip/Chip.utils.tsx +50 -0
- package/src/components/Chip/index.ts +4 -0
- package/src/components/DataTable/DataTable.styled.ts +66 -0
- package/src/components/DataTable/DataTable.tsx +29 -0
- package/src/components/DataTable/index.ts +1 -0
- package/src/components/DatePicker/DatePicker.styled.ts +19 -0
- package/src/components/DatePicker/DatePicker.tsx +194 -0
- package/src/components/DatePicker/DatePicker.types.ts +8 -0
- package/src/components/DatePicker/index.ts +4 -0
- package/src/components/Dialog/Dialog.styled.ts +87 -0
- package/src/components/Dialog/Dialog.tsx +111 -0
- package/src/components/Dialog/Dialog.types.ts +19 -0
- package/src/components/Dialog/index.ts +5 -0
- package/src/components/Divider/Divider.styled.ts +24 -0
- package/src/components/Divider/Divider.tsx +13 -0
- package/src/components/Divider/Divider.types.ts +7 -0
- package/src/components/Divider/index.ts +5 -0
- package/src/components/Dropdown/Dropdown.styled.tsx +127 -0
- package/src/components/Dropdown/Dropdown.tsx +116 -0
- package/src/components/Dropdown/Dropdown.types.ts +31 -0
- package/src/components/Dropdown/Dropdown.utils.ts +13 -0
- package/src/components/Dropdown/DropdownItem.styled.tsx +66 -0
- package/src/components/Dropdown/DropdownItem.tsx +45 -0
- package/src/components/Dropdown/DropdownItem.types.ts +14 -0
- package/src/components/Dropdown/DropdownItem.utils.ts +14 -0
- package/src/components/Dropdown/DropdownSubtitle.styled.ts +13 -0
- package/src/components/Dropdown/DropdownSubtitle.tsx +9 -0
- package/src/components/Dropdown/DropdownSubtitle.types.ts +6 -0
- package/src/components/Dropdown/IconDropdown.styled.tsx +82 -0
- package/src/components/Dropdown/IconDropdown.tsx +56 -0
- package/src/components/Dropdown/IconDropdown.types.ts +22 -0
- package/src/components/Dropdown/index.ts +22 -0
- package/src/components/FileDnDZone/FileDnDZone.styled.ts +43 -0
- package/src/components/FileDnDZone/FileDnDZone.tsx +81 -0
- package/src/components/FileDnDZone/FileDnDZone.types.ts +14 -0
- package/src/components/FileDnDZone/FileDnDZone.utils.ts +3 -0
- package/src/components/FileDnDZone/index.ts +5 -0
- package/src/components/List/List.styled.ts +31 -0
- package/src/components/List/List.tsx +71 -0
- package/src/components/List/List.types.ts +24 -0
- package/src/components/List/List.utils.ts +14 -0
- package/src/components/List/ListItem.styled.tsx +61 -0
- package/src/components/List/ListItem.tsx +66 -0
- package/src/components/List/ListItem.types.ts +40 -0
- package/src/components/List/ListItemCaption.styled.tsx +7 -0
- package/src/components/List/ListItemCaption.tsx +18 -0
- package/src/components/List/ListItemCaption.types.ts +2 -0
- package/src/components/List/index.ts +8 -0
- package/src/components/LoadingIndicator/LoadingIndicator.styled.tsx +40 -0
- package/src/components/LoadingIndicator/LoadingIndicator.tsx +44 -0
- package/src/components/LoadingIndicator/LoadingIndicator.types.ts +7 -0
- package/src/components/LoadingIndicator/assets/DnaLoadingAnimation.json +769 -0
- package/src/components/LoadingIndicator/assets/DotLoadingAnimation.json +426 -0
- package/src/components/LoadingIndicator/index.ts +5 -0
- package/src/components/Menu/Menu.styled.tsx +42 -0
- package/src/components/Menu/Menu.tsx +28 -0
- package/src/components/Menu/Menu.types.ts +18 -0
- package/src/components/Menu/MenuItem.styled.ts +62 -0
- package/src/components/Menu/MenuItem.tsx +45 -0
- package/src/components/Menu/MenuItem.types.ts +14 -0
- package/src/components/Menu/index.ts +5 -0
- package/src/components/MuiCssBaseline.ts +78 -0
- package/src/components/MuiInputBase.ts +25 -0
- package/src/components/MuiOutlinedInput.ts +57 -0
- package/src/components/MuiTextField.ts +17 -0
- package/src/components/Pagination/Pagination.styled.tsx +71 -0
- package/src/components/Pagination/Pagination.tsx +182 -0
- package/src/components/Pagination/Pagination.types.ts +39 -0
- package/src/components/Pagination/index.ts +2 -0
- package/src/components/ProductLabel/ProductLabel.styled.ts +61 -0
- package/src/components/ProductLabel/ProductLabel.tsx +57 -0
- package/src/components/ProductLabel/ProductLabel.types.ts +10 -0
- package/src/components/ProductLabel/index.ts +5 -0
- package/src/components/Progress/CircularProgress.styled.ts +10 -0
- package/src/components/Progress/CircularProgress.tsx +15 -0
- package/src/components/Progress/CircularProgress.types.ts +6 -0
- package/src/components/Progress/LinearProgress.styled.ts +15 -0
- package/src/components/Progress/LinearProgress.tsx +16 -0
- package/src/components/Progress/LinearProgress.types.ts +7 -0
- package/src/components/Progress/index.ts +4 -0
- package/src/components/Radio/Radio.styled.ts +35 -0
- package/src/components/Radio/Radio.tsx +60 -0
- package/src/components/Radio/Radio.types.ts +15 -0
- package/src/components/Radio/RadioGroup.styled.ts +6 -0
- package/src/components/Radio/RadioGroup.tsx +23 -0
- package/src/components/Radio/RadioGroup.types.ts +10 -0
- package/src/components/Radio/index.ts +7 -0
- package/src/components/Stepper/Stepper.styled.ts +38 -0
- package/src/components/Stepper/Stepper.tsx +24 -0
- package/src/components/Stepper/Stepper.types.ts +13 -0
- package/src/components/Stepper/index.ts +5 -0
- package/src/components/TabbedPanel/TabbedPanel.styled.ts +129 -0
- package/src/components/TabbedPanel/TabbedPanel.tsx +70 -0
- package/src/components/TabbedPanel/TabbedPanel.types.ts +36 -0
- package/src/components/TabbedPanel/TabbedPanel.utils.ts +21 -0
- package/src/components/TabbedPanel/index.ts +5 -0
- package/src/components/TextField/TextArea.styled.tsx +36 -0
- package/src/components/TextField/TextArea.tsx +35 -0
- package/src/components/TextField/TextArea.types.ts +28 -0
- package/src/components/TextField/TextInput.styled.tsx +115 -0
- package/src/components/TextField/TextInput.tsx +27 -0
- package/src/components/TextField/TextInput.types.ts +46 -0
- package/src/components/TextField/TextInput.utils.ts +7 -0
- package/src/components/TextField/components/Buttons.tsx +26 -0
- package/src/components/TextField/components/NormalTextInput.tsx +95 -0
- package/src/components/TextField/components/PasswordInput.tsx +92 -0
- package/src/components/TextField/index.ts +7 -0
- package/src/components/Tooltip/Tooltip.styled.tsx +36 -0
- package/src/components/Tooltip/Tooltip.tsx +58 -0
- package/src/components/Tooltip/Tooltip.types.ts +24 -0
- package/src/components/Tooltip/Tooltip.utils.ts +46 -0
- package/src/components/Tooltip/index.ts +5 -0
- package/src/components/UploadManager/UploadManager.styled.ts +49 -0
- package/src/components/UploadManager/UploadManager.tsx +271 -0
- package/src/components/UploadManager/UploadManager.types.ts +16 -0
- package/src/components/UploadManager/index.ts +5 -0
- package/src/components/index.ts +23 -0
- package/src/foundations/index.ts +4 -0
- package/src/foundations/palette.ts +418 -0
- package/src/foundations/spacing.ts +5 -0
- package/src/foundations/styles.ts +9 -0
- package/src/foundations/typography.ts +492 -0
- package/src/icons/BellNoti/index.tsx +28 -0
- package/src/icons/CloseLarge/index.tsx +28 -0
- package/src/icons/CloseSmall/index.tsx +28 -0
- package/src/icons/DownloadPdf/index.tsx +28 -0
- package/src/icons/Ellipse/index.tsx +28 -0
- package/src/icons/FilterNoti/index.tsx +28 -0
- package/src/icons/HideLarge/index.tsx +28 -0
- package/src/icons/HideSmall/index.tsx +28 -0
- package/src/icons/InformationLarge/index.tsx +28 -0
- package/src/icons/InformationSmall/index.tsx +28 -0
- package/src/icons/Manufacturer/index.tsx +28 -0
- package/src/icons/Rectangle/index.tsx +28 -0
- package/src/icons/RefreshLeft/index.tsx +28 -0
- package/src/icons/RefreshRight/index.tsx +28 -0
- package/src/icons/ShowLarge/index.tsx +28 -0
- package/src/icons/ShowSmall/index.tsx +28 -0
- package/src/icons/index.ts +180 -0
- package/src/index.ts +4 -0
- package/src/react-app-env.d.ts +71 -0
- package/src/reportWebVitals.ts +15 -0
- package/src/setupTests.ts +5 -0
- package/src/systems/drawer.ts +27 -0
- package/src/systems/index.ts +7 -0
- package/src/theme.ts +22 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ChipProps as MuiChipProps } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
export type ChipsPreset =
|
|
4
|
+
| 'default'
|
|
5
|
+
| 'uploaded'
|
|
6
|
+
| 'analyzing'
|
|
7
|
+
| 'analyzed'
|
|
8
|
+
| 'analysis_failed'
|
|
9
|
+
| 'qc_failed'
|
|
10
|
+
| 'ready'
|
|
11
|
+
| 'inferred'
|
|
12
|
+
| 'inferencing'
|
|
13
|
+
| 'invalid';
|
|
14
|
+
|
|
15
|
+
export interface ChipProps extends MuiChipProps {
|
|
16
|
+
preset?: ChipsPreset;
|
|
17
|
+
label?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Error16, StartT2 } from '../../icons';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
const presetMap: any = {
|
|
6
|
+
default: {
|
|
7
|
+
className: 'presetDefault',
|
|
8
|
+
label: 'label',
|
|
9
|
+
color: 'default',
|
|
10
|
+
},
|
|
11
|
+
uploaded: {
|
|
12
|
+
className: 'presetUploaded',
|
|
13
|
+
label: 'Uploaded',
|
|
14
|
+
},
|
|
15
|
+
analyzing: {
|
|
16
|
+
className: 'presetAnalyzing',
|
|
17
|
+
label: 'Analyzing',
|
|
18
|
+
},
|
|
19
|
+
analyzed: {
|
|
20
|
+
className: 'presetAnalyzed',
|
|
21
|
+
label: 'Analyzed',
|
|
22
|
+
},
|
|
23
|
+
failed: {
|
|
24
|
+
className: 'presetFailed',
|
|
25
|
+
label: 'Failed',
|
|
26
|
+
icon: <Error16 />,
|
|
27
|
+
},
|
|
28
|
+
ready: {
|
|
29
|
+
className: 'presetReady',
|
|
30
|
+
label: 'Ready',
|
|
31
|
+
icon: <StartT2 />,
|
|
32
|
+
},
|
|
33
|
+
inferred: {
|
|
34
|
+
className: 'presetInferred',
|
|
35
|
+
label: 'Inferred',
|
|
36
|
+
icon: <StartT2 />,
|
|
37
|
+
},
|
|
38
|
+
inferencing: {
|
|
39
|
+
className: 'presetAnalyzing',
|
|
40
|
+
label: 'Analyzing',
|
|
41
|
+
},
|
|
42
|
+
invalid: {
|
|
43
|
+
className: 'presetInvalid',
|
|
44
|
+
label: 'Invalid',
|
|
45
|
+
icon: <Error16 />,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
50
|
+
export { presetMap };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { styled } from '@mui/material/styles';
|
|
2
|
+
|
|
3
|
+
const DataGridContainer = styled('div')(({ theme }) => ({
|
|
4
|
+
height: '100%',
|
|
5
|
+
width: '100%',
|
|
6
|
+
'.MuiDataGrid-root': {
|
|
7
|
+
border: 'none',
|
|
8
|
+
overflowY: 'hidden',
|
|
9
|
+
borderRadius: 0,
|
|
10
|
+
'.MuiDataGrid-withBorderColor': {
|
|
11
|
+
borderColor: theme.palette.neutralGrey[80],
|
|
12
|
+
},
|
|
13
|
+
'.MuiDataGrid-withBorder': {
|
|
14
|
+
borderRight: `1px solid ${theme.palette.neutralGrey[80]}`,
|
|
15
|
+
padding: theme.spacing(0, 2),
|
|
16
|
+
height: '40px',
|
|
17
|
+
'&:last-child': { borderRight: 'none' },
|
|
18
|
+
},
|
|
19
|
+
'.MuiDataGrid-row': {
|
|
20
|
+
'&:last-child .MuiDataGrid-cell': {
|
|
21
|
+
borderBottom: `1px solid ${theme.palette.neutralGrey[80]}`,
|
|
22
|
+
},
|
|
23
|
+
'.MuiDataGrid-cellCheckbox': {
|
|
24
|
+
borderRight: 0,
|
|
25
|
+
},
|
|
26
|
+
'&:hover': { backgroundColor: theme.palette.others.RowHover },
|
|
27
|
+
'&.Mui-selected': {
|
|
28
|
+
backgroundColor: theme.palette.others.RowHover,
|
|
29
|
+
border: 'transparent',
|
|
30
|
+
'&:hover': { backgroundColor: theme.palette.others.RowHover },
|
|
31
|
+
},
|
|
32
|
+
'& .hover-shown': { opacity: 0 },
|
|
33
|
+
'&:hover .hover-shown, & .hover-shown.menu-active': { opacity: 1 },
|
|
34
|
+
},
|
|
35
|
+
'.MuiDataGrid-cell': {
|
|
36
|
+
...theme.typography.body5,
|
|
37
|
+
borderBottom: `1px solid ${theme.palette.neutralGrey[80]}`,
|
|
38
|
+
padding: theme.spacing(0, 2),
|
|
39
|
+
'&:focus, &:focus-within, &:focus-visible': { outline: 'none' },
|
|
40
|
+
},
|
|
41
|
+
'.MuiDataGrid-columnSeparator': { position: 'relative' },
|
|
42
|
+
'.MuiDataGrid-iconSeparator': { display: 'none' },
|
|
43
|
+
'.MuiDataGrid-columnHeader': {
|
|
44
|
+
'&:focus': { outline: 'none' },
|
|
45
|
+
},
|
|
46
|
+
'.MuiDataGrid-columnHeaderTitleContainer': {
|
|
47
|
+
padding: 0,
|
|
48
|
+
'&:focus': { outline: 'none' },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
'.MuiDataGrid-columnHeaders': {
|
|
52
|
+
borderTop: `1px solid ${theme.palette.neutralGrey[80]}`,
|
|
53
|
+
borderBottom: `1px solid ${theme.palette.neutralGrey[80]}`,
|
|
54
|
+
borderRadius: 0,
|
|
55
|
+
'&:focus': { outline: 'none' },
|
|
56
|
+
'.MuiDataGrid-columnHeaderCheckbox': {
|
|
57
|
+
borderRight: 0,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
'.MuiDataGrid-columnHeaderTitle': {
|
|
61
|
+
...theme.typography.body_b1,
|
|
62
|
+
color: theme.palette.neutralGrey[40],
|
|
63
|
+
},
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
export default DataGridContainer;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DataGrid } from '@mui/x-data-grid';
|
|
3
|
+
import { DataGridProps } from '@mui/x-data-grid';
|
|
4
|
+
import DataGridContainer from './DataTable.styled';
|
|
5
|
+
import { Checkbox } from '../Checkbox';
|
|
6
|
+
|
|
7
|
+
function DataTable({ rows, columns, ...otherProps }: DataGridProps) {
|
|
8
|
+
return (
|
|
9
|
+
<DataGridContainer>
|
|
10
|
+
<DataGrid
|
|
11
|
+
rows={rows}
|
|
12
|
+
columns={columns}
|
|
13
|
+
columnHeaderHeight={40}
|
|
14
|
+
rowHeight={40}
|
|
15
|
+
showColumnVerticalBorder
|
|
16
|
+
showCellVerticalBorder
|
|
17
|
+
disableColumnMenu
|
|
18
|
+
hideFooter
|
|
19
|
+
slots={{
|
|
20
|
+
noRowsOverlay: () => <div />,
|
|
21
|
+
baseCheckbox: Checkbox,
|
|
22
|
+
}}
|
|
23
|
+
{...otherProps}
|
|
24
|
+
/>
|
|
25
|
+
</DataGridContainer>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default DataTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DataTable } from './DataTable';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DesktopDatePicker } from '@mui/x-date-pickers/DesktopDatePicker';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
|
|
4
|
+
const StyledDatePicker = styled(DesktopDatePicker)(({ theme }) => ({
|
|
5
|
+
'.MuiInputBase-root': {
|
|
6
|
+
height: '36px',
|
|
7
|
+
backgroundColor: theme.palette.neutralGrey[75],
|
|
8
|
+
|
|
9
|
+
'&:hover fieldset': {
|
|
10
|
+
borderColor: theme.palette.neutralGrey[45],
|
|
11
|
+
},
|
|
12
|
+
'&.Mui-focused fieldset': {
|
|
13
|
+
borderColor: theme.palette.lunitTeal[10],
|
|
14
|
+
borderWidth: '1px',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
export { StyledDatePicker };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
3
|
+
import { CloseSmall, ArrowLeft, ArrowRight } from '../../icons';
|
|
4
|
+
|
|
5
|
+
import { StyledDatePicker } from './DatePicker.styled';
|
|
6
|
+
import type { DatePickerProps } from './DatePicker.types';
|
|
7
|
+
import { Button } from '../Button';
|
|
8
|
+
|
|
9
|
+
import theme from '../../theme';
|
|
10
|
+
|
|
11
|
+
function DatePicker({ alignment, placeholder, onChange, value, ...props }: DatePickerProps) {
|
|
12
|
+
const [open, setOpen] = useState<boolean>(false);
|
|
13
|
+
const [selectedDate, setSelectedDate] = useState<Date | null>(null);
|
|
14
|
+
|
|
15
|
+
const { slots, slotProps, ...otherProps } = props;
|
|
16
|
+
|
|
17
|
+
const handleFieldClick = () => {
|
|
18
|
+
setOpen(true);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
const handleChange = (date: Date | null, context: any) => {
|
|
23
|
+
setSelectedDate(date);
|
|
24
|
+
if (onChange) onChange(date, context);
|
|
25
|
+
setOpen(false);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const handleFieldClearClick = (e: React.MouseEvent<HTMLElement>) => {
|
|
29
|
+
e.stopPropagation();
|
|
30
|
+
handleChange(null, null);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const popperPlacement = useMemo(() => {
|
|
34
|
+
switch (alignment) {
|
|
35
|
+
case 'left':
|
|
36
|
+
return 'bottom-start';
|
|
37
|
+
case 'right':
|
|
38
|
+
return 'bottom-end';
|
|
39
|
+
default:
|
|
40
|
+
return 'bottom';
|
|
41
|
+
}
|
|
42
|
+
}, [alignment]);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (value === null && selectedDate !== null) {
|
|
46
|
+
setSelectedDate(null);
|
|
47
|
+
}
|
|
48
|
+
if (value !== null && selectedDate === null) {
|
|
49
|
+
setSelectedDate(value!);
|
|
50
|
+
}
|
|
51
|
+
}, [value, selectedDate, setSelectedDate]);
|
|
52
|
+
|
|
53
|
+
const canUseToday = useMemo(() => {
|
|
54
|
+
const today = new Date();
|
|
55
|
+
if (props.minDate && today < props.minDate) return false;
|
|
56
|
+
if (props.maxDate && today > props.maxDate) return false;
|
|
57
|
+
return true;
|
|
58
|
+
}, [props.minDate, props.maxDate]);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<StyledDatePicker
|
|
62
|
+
open={open}
|
|
63
|
+
value={selectedDate}
|
|
64
|
+
onChange={handleChange}
|
|
65
|
+
// onOpen={() => setOpen(true)}
|
|
66
|
+
onClose={() => setOpen(false)}
|
|
67
|
+
views={['year', 'month', 'day']}
|
|
68
|
+
slots={{
|
|
69
|
+
inputAdornment: () => {
|
|
70
|
+
if (selectedDate) {
|
|
71
|
+
return (
|
|
72
|
+
<Button
|
|
73
|
+
variant="ghost"
|
|
74
|
+
color="secondary"
|
|
75
|
+
size="small"
|
|
76
|
+
icon={<CloseSmall />}
|
|
77
|
+
sx={{
|
|
78
|
+
color: theme.palette.neutralGrey[0],
|
|
79
|
+
borderColor: 'transparent !important',
|
|
80
|
+
}}
|
|
81
|
+
onClick={handleFieldClearClick}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
},
|
|
87
|
+
leftArrowIcon: ArrowLeft,
|
|
88
|
+
rightArrowIcon: ArrowRight,
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
|
+
...(slots as any),
|
|
91
|
+
}}
|
|
92
|
+
slotProps={{
|
|
93
|
+
switchViewButton: {
|
|
94
|
+
sx: {
|
|
95
|
+
display: 'none',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
textField: {
|
|
99
|
+
variant: 'outlined',
|
|
100
|
+
onClick: handleFieldClick,
|
|
101
|
+
InputProps: {
|
|
102
|
+
placeholder: placeholder || 'mm/dd/yyyy',
|
|
103
|
+
sx: {
|
|
104
|
+
borderRadius: '8px',
|
|
105
|
+
// According to designer, the width of the date picker should be enforced at 320px
|
|
106
|
+
// when the placement is bottom. that is why we have !important here.
|
|
107
|
+
width: popperPlacement === 'bottom' ? '320px !important' : 'auto',
|
|
108
|
+
borderColor: 'red',
|
|
109
|
+
...theme.typography.body5,
|
|
110
|
+
|
|
111
|
+
'& input': {
|
|
112
|
+
textTransform: 'lowercase',
|
|
113
|
+
},
|
|
114
|
+
'& ::placeholder': {
|
|
115
|
+
textTransform: 'none',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
onMouseDown: (e: React.MouseEvent<HTMLInputElement>) => {
|
|
119
|
+
const element = e.target as HTMLElement;
|
|
120
|
+
if (element.tagName === 'INPUT') {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
popper: {
|
|
127
|
+
placement: popperPlacement,
|
|
128
|
+
modifiers: [
|
|
129
|
+
{
|
|
130
|
+
name: 'offset',
|
|
131
|
+
enabled: true,
|
|
132
|
+
options: {
|
|
133
|
+
offset: [0, 8],
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
sx: {
|
|
138
|
+
'& .MuiPickersDay-today': {
|
|
139
|
+
border: `1px solid ${theme.palette.neutralGrey[0]} !important`,
|
|
140
|
+
borderRadius: '50%',
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
'& .MuiPickersDay-root:hover': {
|
|
144
|
+
border: `1px solid ${theme.palette.neutralGrey[0]}`,
|
|
145
|
+
borderRadius: '50%',
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
'& .MuiPickersDay-root.Mui-selected': {
|
|
149
|
+
backgroundColor: `${theme.palette.lunitTeal[40]} !important`,
|
|
150
|
+
color: `${theme.palette.neutralGrey[97]} !important`,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
desktopPaper: {
|
|
155
|
+
sx: {
|
|
156
|
+
background: theme.palette.neutralGrey[70],
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
previousIconButton: {
|
|
160
|
+
sx: {
|
|
161
|
+
color: theme.palette.neutralGrey[0],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
nextIconButton: {
|
|
165
|
+
sx: {
|
|
166
|
+
color: theme.palette.neutralGrey[0],
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
actionBar: {
|
|
170
|
+
actions: ['today'],
|
|
171
|
+
sx: {
|
|
172
|
+
'& button': {
|
|
173
|
+
color: `${theme.palette.lunitTeal[40]} !important`,
|
|
174
|
+
textTransform: 'capitalize',
|
|
175
|
+
pointerEvents: canUseToday ? 'auto' : 'none',
|
|
176
|
+
opacity: canUseToday ? 1 : 0.4,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
day: {
|
|
181
|
+
sx: {
|
|
182
|
+
backgroundColor: 'transparent !important',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
186
|
+
...(slotProps as any),
|
|
187
|
+
}}
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
189
|
+
{...(otherProps as any)}
|
|
190
|
+
/>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export default DatePicker;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DatePickerProps as MuiDatePickerProps } from '@mui/x-date-pickers/DatePicker';
|
|
2
|
+
|
|
3
|
+
export type DatePickerAlignment = 'left' | 'center' | 'right';
|
|
4
|
+
|
|
5
|
+
export interface DatePickerProps extends MuiDatePickerProps<Date> {
|
|
6
|
+
alignment?: DatePickerAlignment;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import Dialog from '@mui/material/Dialog';
|
|
2
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
3
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
4
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { Box } from '@mui/material';
|
|
7
|
+
import type { DialogProps } from './Dialog.types';
|
|
8
|
+
|
|
9
|
+
interface StyledDialogProps extends DialogProps {
|
|
10
|
+
displayChildren: boolean;
|
|
11
|
+
isPrompt?: boolean;
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
sx?: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface StyledDialogTitleProps {
|
|
17
|
+
displayChildren: boolean;
|
|
18
|
+
isPrompt?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const StyledDialog = styled(Dialog, {
|
|
22
|
+
shouldForwardProp: (prop) => prop !== 'displayChildren' && prop !== 'isPrompt',
|
|
23
|
+
})<StyledDialogProps>(({ theme, displayChildren, isPrompt, sx }) => {
|
|
24
|
+
return {
|
|
25
|
+
'& .MuiDialog-paper': {
|
|
26
|
+
backgroundColor: theme.palette.neutralGrey[90],
|
|
27
|
+
width: displayChildren && !isPrompt ? 'auto' : '320px',
|
|
28
|
+
maxWidth: displayChildren && !isPrompt ? 'none' : '320px',
|
|
29
|
+
borderRadius: '8px',
|
|
30
|
+
padding: '28px 20px 24px 20px',
|
|
31
|
+
},
|
|
32
|
+
...sx,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const StyledHeaderBox = styled(Box, {
|
|
37
|
+
shouldForwardProp: (prop) => prop !== 'displayChildren' && prop !== 'isPrompt',
|
|
38
|
+
})<StyledDialogTitleProps>(({ displayChildren, isPrompt }) => ({
|
|
39
|
+
display: 'flex',
|
|
40
|
+
justifyContent: 'space-between',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
height: '24px',
|
|
43
|
+
marginBottom: displayChildren && !isPrompt ? '32px' : '16px',
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
const StyledTitle = styled(Box)({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const StyledDialogTitle = styled(DialogTitle)(({ theme }) => ({
|
|
52
|
+
...theme.typography.body_sb1,
|
|
53
|
+
padding: 0,
|
|
54
|
+
display: 'flex',
|
|
55
|
+
'& .dialogIcon': {
|
|
56
|
+
display: 'flex',
|
|
57
|
+
marginRight: '8px',
|
|
58
|
+
},
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
const StyledDialogContent = styled(DialogContent)(({ theme }) => ({
|
|
62
|
+
...theme.typography.body5,
|
|
63
|
+
marginBottom: '16px',
|
|
64
|
+
padding: 0,
|
|
65
|
+
whiteSpace: 'pre-line',
|
|
66
|
+
|
|
67
|
+
'&.childrenDialog': {
|
|
68
|
+
display: 'flex',
|
|
69
|
+
borderTop: 0,
|
|
70
|
+
borderBottom: 0,
|
|
71
|
+
maxHeight: 'fit-content',
|
|
72
|
+
},
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
const StyledDialogActions = styled(DialogActions)(() => ({
|
|
76
|
+
padding: 0,
|
|
77
|
+
margin: '0 12px',
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
export {
|
|
81
|
+
StyledDialog,
|
|
82
|
+
StyledHeaderBox,
|
|
83
|
+
StyledTitle,
|
|
84
|
+
StyledDialogTitle,
|
|
85
|
+
StyledDialogContent,
|
|
86
|
+
StyledDialogActions,
|
|
87
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CloseSmall } from '../../icons';
|
|
3
|
+
|
|
4
|
+
import { Box } from '@mui/material';
|
|
5
|
+
import theme from '../../theme';
|
|
6
|
+
import { Button } from '../Button';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
StyledDialog,
|
|
10
|
+
StyledHeaderBox,
|
|
11
|
+
StyledDialogTitle,
|
|
12
|
+
StyledDialogContent,
|
|
13
|
+
StyledDialogActions,
|
|
14
|
+
} from './Dialog.styled';
|
|
15
|
+
import type { DialogProps } from './Dialog.types';
|
|
16
|
+
|
|
17
|
+
function Dialog({
|
|
18
|
+
open,
|
|
19
|
+
title,
|
|
20
|
+
icon,
|
|
21
|
+
closable,
|
|
22
|
+
isPrompt,
|
|
23
|
+
cancelText,
|
|
24
|
+
submitText,
|
|
25
|
+
onClose,
|
|
26
|
+
text,
|
|
27
|
+
children,
|
|
28
|
+
dialogAction,
|
|
29
|
+
buttonSize = 'small',
|
|
30
|
+
loading = false,
|
|
31
|
+
disableSubmit = false,
|
|
32
|
+
sx,
|
|
33
|
+
}: DialogProps) {
|
|
34
|
+
const handleClose = (event: object | null, reason: string) => {
|
|
35
|
+
if (onClose) {
|
|
36
|
+
onClose(event, reason);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const displayChildren = !text && !!children;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<StyledDialog
|
|
43
|
+
open={open}
|
|
44
|
+
onClose={handleClose}
|
|
45
|
+
displayChildren={displayChildren}
|
|
46
|
+
isPrompt={isPrompt}
|
|
47
|
+
sx={sx}
|
|
48
|
+
className="customDialog"
|
|
49
|
+
PaperProps={{
|
|
50
|
+
className: 'dialogPaper',
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<StyledHeaderBox
|
|
54
|
+
isPrompt={isPrompt}
|
|
55
|
+
displayChildren={displayChildren}
|
|
56
|
+
className="dialogTitle"
|
|
57
|
+
>
|
|
58
|
+
<Box>
|
|
59
|
+
<StyledDialogTitle>
|
|
60
|
+
{icon && <div className="dialogIcon">{icon}</div>}
|
|
61
|
+
{title}
|
|
62
|
+
</StyledDialogTitle>
|
|
63
|
+
</Box>
|
|
64
|
+
{closable && (
|
|
65
|
+
<Button
|
|
66
|
+
size="small"
|
|
67
|
+
variant="ghost"
|
|
68
|
+
label=""
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
onClick={(event: any) => handleClose(event, 'cancel')}
|
|
71
|
+
icon={<CloseSmall />}
|
|
72
|
+
sx={{ color: theme.palette.neutralGrey[0] }}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
</StyledHeaderBox>
|
|
76
|
+
|
|
77
|
+
{!displayChildren && <StyledDialogContent>{text}</StyledDialogContent>}
|
|
78
|
+
{displayChildren && (
|
|
79
|
+
<StyledDialogContent className="childrenDialog">{children}</StyledDialogContent>
|
|
80
|
+
)}
|
|
81
|
+
|
|
82
|
+
{dialogAction && <StyledDialogActions>{dialogAction}</StyledDialogActions>}
|
|
83
|
+
|
|
84
|
+
{!dialogAction && (cancelText || submitText) && (
|
|
85
|
+
<StyledDialogActions>
|
|
86
|
+
{cancelText && (
|
|
87
|
+
<Button
|
|
88
|
+
label={cancelText}
|
|
89
|
+
size={buttonSize}
|
|
90
|
+
variant="ghost"
|
|
91
|
+
onClick={() => handleClose(null, 'cancel')}
|
|
92
|
+
/>
|
|
93
|
+
)}
|
|
94
|
+
|
|
95
|
+
{submitText && (
|
|
96
|
+
<Button
|
|
97
|
+
disabled={disableSubmit}
|
|
98
|
+
loading={loading}
|
|
99
|
+
label={submitText}
|
|
100
|
+
size={buttonSize}
|
|
101
|
+
sx={loading ? { width: '75px' } : null}
|
|
102
|
+
onClick={() => handleClose(null, 'submit')}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
</StyledDialogActions>
|
|
106
|
+
)}
|
|
107
|
+
</StyledDialog>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default Dialog;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SxProps } from '@mui/system';
|
|
2
|
+
|
|
3
|
+
export interface DialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
title?: string;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
closable?: boolean;
|
|
8
|
+
isPrompt?: boolean;
|
|
9
|
+
cancelText?: string;
|
|
10
|
+
submitText?: string;
|
|
11
|
+
onClose?: (event: object | null, reason: string) => void;
|
|
12
|
+
text?: string;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
dialogAction?: React.ReactNode;
|
|
15
|
+
buttonSize?: 'small' | 'medium' | 'large';
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
disableSubmit?: boolean;
|
|
18
|
+
sx?: SxProps;
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Divider } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import type { DividerProps } from './Divider.types';
|
|
4
|
+
|
|
5
|
+
const BaseDivider = styled(Divider)<DividerProps>(({ theme, orientation }) => {
|
|
6
|
+
if (orientation === 'vertical') {
|
|
7
|
+
return {
|
|
8
|
+
background: theme.palette.neutralGrey[65],
|
|
9
|
+
border: 'none',
|
|
10
|
+
height: '100%',
|
|
11
|
+
outline: 'none',
|
|
12
|
+
width: '1px',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
background: theme.palette.neutralGrey[65],
|
|
17
|
+
border: 'none',
|
|
18
|
+
height: '1px',
|
|
19
|
+
outline: 'none',
|
|
20
|
+
width: '100%',
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default BaseDivider;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import BaseDivider from './Divider.styled';
|
|
3
|
+
import type { DividerProps } from './Divider.types';
|
|
4
|
+
|
|
5
|
+
function Divider({ orientation = 'vertical', ...props }: DividerProps) {
|
|
6
|
+
return (
|
|
7
|
+
<BaseDivider
|
|
8
|
+
orientation={orientation}
|
|
9
|
+
{...props}
|
|
10
|
+
/>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
export default Divider;
|