@campxdev/react-blueprint 1.1.6 → 1.1.8
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/.prettierrc +8 -0
- package/.vscode/settings.json +5 -1
- package/craco.config.js +18 -0
- package/package.json +9 -5
- package/src/App.tsx +17 -38
- package/src/assets/images/gif/confirmation-alert.gif +0 -0
- package/src/assets/images/gif/delete-confirmation-alert.gif +0 -0
- package/src/assets/images/gif/index.ts +7 -0
- package/src/assets/images/svg/index.ts +5 -21
- package/src/components/Assets/Icons/IconComponents/AcademicIcon.tsx +41 -0
- package/src/components/Assets/Icons/IconComponents/AccordionArrow.tsx +23 -0
- package/src/components/Assets/Icons/IconComponents/NoteIcon.tsx +41 -0
- package/src/components/Assets/Icons/Icons.tsx +65 -58
- package/src/components/Charts/BarChart/BarChart.tsx +33 -9
- package/src/components/Charts/LineChart/LineChart.tsx +10 -4
- package/src/components/Charts/PieChart/PieChart.tsx +3 -2
- package/src/components/Charts/TreeMap/TreeMap.tsx +1 -0
- package/src/components/Charts/export.ts +4 -0
- package/src/components/Charts/types/types.ts +12 -2
- package/src/components/DataDisplay/Accordion/Accordion.tsx +42 -46
- package/src/components/DataDisplay/AccordionGroup/AccordionGroup.tsx +30 -0
- package/src/components/DataDisplay/Avatar/Avatar.tsx +18 -29
- package/src/components/DataDisplay/Card/Card.tsx +29 -8
- package/src/components/DataDisplay/DataTable/DataTable.tsx +14 -6
- package/src/components/DataDisplay/export.ts +6 -5
- package/src/components/DataDisplay/styles.tsx +2 -3
- package/src/components/Feedback/Snackbar/Snackbar.tsx +6 -5
- package/src/components/Input/DatePicker/DatePicker.tsx +58 -0
- package/src/components/Input/FormActions/FormActions.tsx +49 -0
- package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +70 -0
- package/src/components/Input/IconButtons/IconButtons.tsx +4 -4
- package/src/components/Input/LabelWrapper/LabelWrapper.tsx +1 -1
- package/src/components/Input/SingleSelect/SingleSelect.tsx +43 -54
- package/src/components/Input/{Chips/Chips.tsx → Tags/Tags.tsx} +14 -14
- package/src/components/Input/TimePicker/TimePicker.tsx +39 -0
- package/src/components/Input/export.ts +13 -8
- package/src/components/Layout/PageContent/PageContent.tsx +16 -0
- package/src/components/Layout/PageHeader/PageHeader.tsx +46 -0
- package/src/components/Navigation/ConfirmDialog/ConfirmDialog.tsx +79 -0
- package/src/components/Navigation/DropDownMenu/DropDownButton.tsx +5 -5
- package/src/components/Navigation/Sidebar/Components.tsx +97 -0
- package/src/components/Navigation/Sidebar/MenuItem.tsx +76 -104
- package/src/components/Navigation/Sidebar/Sidebar.tsx +150 -55
- package/src/components/Navigation/Sidebar/SubMenuItem.tsx +34 -0
- package/src/components/Navigation/Sidebar/interfaces.ts +35 -12
- package/src/components/Navigation/Sidebar/styles.tsx +2 -2
- package/src/components/Navigation/exports.ts +9 -8
- package/src/components/export.ts +1 -1
- package/src/contexts/Providers.tsx +2 -2
- package/src/stories/DataDisplay/AccordionGroup.stories.tsx +131 -0
- package/src/stories/Input/DatePicker.stories.tsx +138 -0
- package/src/stories/Input/{Chips.stories.tsx → Tags.stories.tsx} +17 -17
- package/src/stories/Input/TimePicker.stories.tsx +123 -0
- package/src/stories/Navigation/ConfirmDialog.stories.tsx +80 -0
- package/src/themes/commonTheme.ts +171 -155
- package/tsconfig.json +2 -6
- package/src/assets/images/admin.png +0 -0
- package/src/assets/images/campx_logo__full_primary.png +0 -0
- package/src/assets/images/collegex.png +0 -0
- package/src/assets/images/commutex.png +0 -0
- package/src/assets/images/enrollx.png +0 -0
- package/src/assets/images/examx.png +0 -0
- package/src/assets/images/hostelx copy.png +0 -0
- package/src/assets/images/hostelx.png +0 -0
- package/src/assets/images/index.ts +0 -25
- package/src/assets/images/payx.png +0 -0
- package/src/assets/images/pepolex.png +0 -0
- package/src/assets/images/svg/campx-logo.svg +0 -32
- package/src/assets/images/svg/commutex_small.svg +0 -11
- package/src/assets/images/svg/enroll_logo.svg +0 -9
- package/src/assets/images/svg/exams_small.svg +0 -12
- package/src/assets/images/svg/help-icon.svg +0 -8
- package/src/assets/images/svg/hostel_small.svg +0 -13
- package/src/assets/images/svg/payx_small.svg +0 -16
- package/src/assets/images/svg/people_small.svg +0 -9
- package/src/assets/images/svg/squareSmall.svg +0 -9
- package/src/assets/images/svg/square_small.svg +0 -9
- package/src/components/DataDisplay/Accordion/utils/StandardImageList.tsx +0 -70
- package/src/components/Navigation/Sidebar/DropdownItem.tsx +0 -34
- package/src/stories/DataDisplay/Accordion.stories.tsx +0 -62
- package/src/utils/applications.ts +0 -140
- package/src/utils/imageMap.ts +0 -22
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Typography } from "../../DataDisplay/Typography/Typography";
|
|
12
|
-
import { Spinner } from "../../Feedback/Spinner/Spinner";
|
|
13
|
-
import { TextField } from "../TextField/TextField";
|
|
14
|
-
import { FetchingOptionsLoader } from "../components/FetchingOptionsLoader";
|
|
15
|
-
import { OptionContainer } from "../styles";
|
|
1
|
+
import { axios as campxAxios } from '@campxdev/campx-web-utils';
|
|
2
|
+
import { BaseSelectProps, Box, Autocomplete as MuiAutocomplete, Paper, PaperProps } from '@mui/material';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import _ from 'lodash';
|
|
5
|
+
import { useEffect, useReducer } from 'react';
|
|
6
|
+
import { Typography } from '../../DataDisplay/Typography/Typography';
|
|
7
|
+
import { Spinner } from '../../Feedback/Spinner/Spinner';
|
|
8
|
+
import { TextField } from '../TextField/TextField';
|
|
9
|
+
import { FetchingOptionsLoader } from '../components/FetchingOptionsLoader';
|
|
10
|
+
import { OptionContainer } from '../styles';
|
|
16
11
|
|
|
17
12
|
function sleep(duration: number): Promise<void> {
|
|
18
13
|
return new Promise<void>((resolve) => {
|
|
@@ -28,9 +23,13 @@ export type SingleSelectProps = {
|
|
|
28
23
|
useCampxAxios: boolean;
|
|
29
24
|
required?: boolean;
|
|
30
25
|
label?: string;
|
|
26
|
+
name?: string;
|
|
31
27
|
value?: any;
|
|
32
28
|
getValue?: (option: any) => any;
|
|
33
|
-
|
|
29
|
+
onChange: (value: any) => void;
|
|
30
|
+
error?: any;
|
|
31
|
+
helperText?: string;
|
|
32
|
+
} & BaseSelectProps;
|
|
34
33
|
|
|
35
34
|
const CustomPaper = (props: PaperProps) => (
|
|
36
35
|
<Paper {...props}>
|
|
@@ -40,24 +39,18 @@ const CustomPaper = (props: PaperProps) => (
|
|
|
40
39
|
);
|
|
41
40
|
|
|
42
41
|
enum SingleSelectActionsTypes {
|
|
43
|
-
OPEN =
|
|
44
|
-
CLOSE =
|
|
45
|
-
LOAD_INTERNAL_OPTIONS_START =
|
|
46
|
-
LOAD_INTERNAL_OPTIONS_END =
|
|
47
|
-
LOAD_INITIAL_INTERNAL_OPTIONS_START =
|
|
48
|
-
LOAD_INITIAL_INTERNAL_OPTIONS_END =
|
|
49
|
-
SET_NETWORK_ERROR =
|
|
50
|
-
SET_INTERNAL_OPTIONS =
|
|
51
|
-
APPEND_INTERNAL_OPTIONS =
|
|
52
|
-
CHANGE_HAS_MORE_FLAG =
|
|
42
|
+
OPEN = 'open',
|
|
43
|
+
CLOSE = 'close',
|
|
44
|
+
LOAD_INTERNAL_OPTIONS_START = 'load_internal_options_start',
|
|
45
|
+
LOAD_INTERNAL_OPTIONS_END = 'load_internal_options_end',
|
|
46
|
+
LOAD_INITIAL_INTERNAL_OPTIONS_START = 'load_initial_internal_options_start',
|
|
47
|
+
LOAD_INITIAL_INTERNAL_OPTIONS_END = 'load_initial_internal_options_end',
|
|
48
|
+
SET_NETWORK_ERROR = 'set_network_error',
|
|
49
|
+
SET_INTERNAL_OPTIONS = 'set_internal_options',
|
|
50
|
+
APPEND_INTERNAL_OPTIONS = 'append_internal_options',
|
|
51
|
+
CHANGE_HAS_MORE_FLAG = 'change_has_more_flag',
|
|
53
52
|
}
|
|
54
|
-
const singleSelectReducer = (
|
|
55
|
-
state: any,
|
|
56
|
-
{
|
|
57
|
-
actionType,
|
|
58
|
-
stateChanges,
|
|
59
|
-
}: { actionType: SingleSelectActionsTypes; stateChanges?: any }
|
|
60
|
-
) => {
|
|
53
|
+
const singleSelectReducer = (state: any, { actionType, stateChanges }: { actionType: SingleSelectActionsTypes; stateChanges?: any }) => {
|
|
61
54
|
switch (actionType) {
|
|
62
55
|
case SingleSelectActionsTypes.OPEN: {
|
|
63
56
|
return { ...state, open: true };
|
|
@@ -118,8 +111,13 @@ export const SingleSelect = ({
|
|
|
118
111
|
useCampxAxios = true,
|
|
119
112
|
required = false,
|
|
120
113
|
label,
|
|
114
|
+
name,
|
|
121
115
|
getValue,
|
|
122
116
|
value,
|
|
117
|
+
onChange,
|
|
118
|
+
error,
|
|
119
|
+
helperText,
|
|
120
|
+
...restProps
|
|
123
121
|
}: SingleSelectProps) => {
|
|
124
122
|
const generateOptionsMap = (options: any[]) => {
|
|
125
123
|
return _.keyBy(options ?? [], getValue ? getValue : (o) => o.value);
|
|
@@ -135,15 +133,7 @@ export const SingleSelect = ({
|
|
|
135
133
|
offset: 0,
|
|
136
134
|
hasMore: true,
|
|
137
135
|
});
|
|
138
|
-
const {
|
|
139
|
-
open,
|
|
140
|
-
loadingInternalOptions,
|
|
141
|
-
loadingInitialInternalOptions,
|
|
142
|
-
internalOptions,
|
|
143
|
-
limit,
|
|
144
|
-
offset,
|
|
145
|
-
hasMore,
|
|
146
|
-
} = state;
|
|
136
|
+
const { open, loadingInternalOptions, loadingInitialInternalOptions, internalOptions, limit, offset, hasMore } = state;
|
|
147
137
|
|
|
148
138
|
const internalAxios = useCampxAxios ? campxAxios : axios;
|
|
149
139
|
|
|
@@ -188,17 +178,12 @@ export const SingleSelect = ({
|
|
|
188
178
|
|
|
189
179
|
const handleScroll = async (event: any) => {
|
|
190
180
|
const listboxNode = event.currentTarget;
|
|
191
|
-
if (
|
|
192
|
-
listboxNode.scrollTop + listboxNode.clientHeight >=
|
|
193
|
-
listboxNode.scrollHeight - 1 &&
|
|
194
|
-
hasMore &&
|
|
195
|
-
optionsApiEndPoint
|
|
196
|
-
) {
|
|
181
|
+
if (listboxNode.scrollTop + listboxNode.clientHeight >= listboxNode.scrollHeight - 1 && hasMore && optionsApiEndPoint) {
|
|
197
182
|
dispatch({
|
|
198
183
|
actionType: SingleSelectActionsTypes.LOAD_INTERNAL_OPTIONS_START,
|
|
199
184
|
});
|
|
200
185
|
const newOptions = await internalAxios
|
|
201
|
-
.get(optionsApiEndPoint ??
|
|
186
|
+
.get(optionsApiEndPoint ?? '', {
|
|
202
187
|
params: {
|
|
203
188
|
limit: limit,
|
|
204
189
|
offset: offset + 10,
|
|
@@ -226,7 +211,7 @@ export const SingleSelect = ({
|
|
|
226
211
|
actionType: SingleSelectActionsTypes.LOAD_INITIAL_INTERNAL_OPTIONS_START,
|
|
227
212
|
});
|
|
228
213
|
try {
|
|
229
|
-
const res = await internalAxios.get(optionsApiEndPoint ??
|
|
214
|
+
const res = await internalAxios.get(optionsApiEndPoint ?? '', {
|
|
230
215
|
params: { limit, offset, selectedValue: value },
|
|
231
216
|
});
|
|
232
217
|
dispatch({
|
|
@@ -249,32 +234,36 @@ export const SingleSelect = ({
|
|
|
249
234
|
if (value && optionsApiEndPoint) {
|
|
250
235
|
fetchInitialOptions().finally(() => {
|
|
251
236
|
dispatch({
|
|
252
|
-
actionType:
|
|
253
|
-
SingleSelectActionsTypes.LOAD_INITIAL_INTERNAL_OPTIONS_END,
|
|
237
|
+
actionType: SingleSelectActionsTypes.LOAD_INITIAL_INTERNAL_OPTIONS_END,
|
|
254
238
|
});
|
|
255
239
|
});
|
|
256
240
|
}
|
|
257
241
|
}, []);
|
|
258
242
|
|
|
259
243
|
if (loadingInitialInternalOptions) {
|
|
260
|
-
console.log("Rendered Loading");
|
|
261
244
|
return (
|
|
262
245
|
<TextField
|
|
263
246
|
label={label}
|
|
247
|
+
name={name}
|
|
264
248
|
required={required}
|
|
265
249
|
InputProps={{
|
|
266
250
|
endAdornment: <Spinner />,
|
|
267
251
|
}}
|
|
252
|
+
error={error}
|
|
253
|
+
helperText={helperText}
|
|
268
254
|
/>
|
|
269
255
|
);
|
|
270
256
|
}
|
|
271
257
|
return (
|
|
272
258
|
<MuiAutocomplete
|
|
259
|
+
onChange={(e, value) => {
|
|
260
|
+
onChange(getValue ? getValue(value) : value?.value);
|
|
261
|
+
}}
|
|
273
262
|
open={open}
|
|
274
263
|
autoFocus={true}
|
|
275
264
|
value={state.internalOptionsMap[value]}
|
|
276
265
|
renderInput={(params) => (
|
|
277
|
-
<TextField {...params} label={label} required={required} />
|
|
266
|
+
<TextField {...params} label={label} required={required} name={name} error={error} helperText={helperText} />
|
|
278
267
|
)}
|
|
279
268
|
PaperComponent={CustomPaper}
|
|
280
269
|
renderOption={(props, option: any) => {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { Chip, styled } from
|
|
2
|
-
import { Typography } from
|
|
3
|
-
import { Icons } from
|
|
1
|
+
import { Chip, styled } from '@mui/material';
|
|
2
|
+
import { Typography } from '../../DataDisplay/Typography/Typography';
|
|
3
|
+
import { Icons } from '../../export';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
display:
|
|
7
|
-
justifyContent:
|
|
8
|
-
flexWrap:
|
|
9
|
-
listStyle:
|
|
5
|
+
const TagList = styled('ul')(({ theme }) => ({
|
|
6
|
+
display: 'flex',
|
|
7
|
+
justifyContent: 'center',
|
|
8
|
+
flexWrap: 'wrap',
|
|
9
|
+
listStyle: 'none',
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
export type
|
|
13
|
-
|
|
12
|
+
export type TagsProps = {
|
|
13
|
+
tags: { label: string; value: any }[];
|
|
14
14
|
onClick?: (clickedChip: any) => void;
|
|
15
15
|
onDelete?: (deletedChip: any) => void;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const
|
|
18
|
+
export const Tags = ({ tags, onClick, onDelete }: TagsProps) => {
|
|
19
19
|
return (
|
|
20
|
-
<
|
|
21
|
-
{
|
|
20
|
+
<TagList>
|
|
21
|
+
{tags.map(({ label, value }) => (
|
|
22
22
|
<Chip
|
|
23
23
|
label={<Typography variant="body2">{label}</Typography>}
|
|
24
24
|
onClick={
|
|
@@ -38,6 +38,6 @@ export const Chips = ({ chips, onClick, onDelete }: ChipsProps) => {
|
|
|
38
38
|
deleteIcon={<Icons.CrossIcon />}
|
|
39
39
|
/>
|
|
40
40
|
))}
|
|
41
|
-
</
|
|
41
|
+
</TagList>
|
|
42
42
|
);
|
|
43
43
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PickerValidDate } from '@mui/x-date-pickers';
|
|
2
|
+
import { TimePicker as MuiTimePicker, TimePickerProps as MuiTimePickerProps } from '@mui/x-date-pickers/TimePicker';
|
|
3
|
+
import { LabelWrapper } from '../LabelWrapper/LabelWrapper';
|
|
4
|
+
|
|
5
|
+
type TimePickerProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false> = {
|
|
6
|
+
format?: 'hh:mm a' | 'HH:mm' | 'HH:mm:ss a' | 'HH:mm:ss';
|
|
7
|
+
views?: ('hours' | 'minutes' | 'seconds')[];
|
|
8
|
+
helperText?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
containerProps?: any;
|
|
12
|
+
} & MuiTimePickerProps<TDate, TEnableAccessibleFieldDOMStructure>;
|
|
13
|
+
|
|
14
|
+
export const TimePicker = <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>({
|
|
15
|
+
label,
|
|
16
|
+
name,
|
|
17
|
+
value,
|
|
18
|
+
format = 'hh:mm a',
|
|
19
|
+
views = ['hours', 'minutes'],
|
|
20
|
+
helperText,
|
|
21
|
+
placeholder = '',
|
|
22
|
+
required = false,
|
|
23
|
+
containerProps,
|
|
24
|
+
...rest
|
|
25
|
+
}: TimePickerProps<TDate, TEnableAccessibleFieldDOMStructure>) => {
|
|
26
|
+
return (
|
|
27
|
+
<LabelWrapper label={label} required={required} name={name} containerProps={containerProps}>
|
|
28
|
+
<MuiTimePicker
|
|
29
|
+
defaultValue={value}
|
|
30
|
+
format={format}
|
|
31
|
+
views={views}
|
|
32
|
+
slotProps={{
|
|
33
|
+
textField: { placeholder, helperText },
|
|
34
|
+
}}
|
|
35
|
+
{...rest}
|
|
36
|
+
/>
|
|
37
|
+
</LabelWrapper>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
1
|
+
export * from './Button/Button';
|
|
2
|
+
export * from './DatePicker/DatePicker';
|
|
3
|
+
export * from './FormActions/FormActions';
|
|
4
|
+
export * from './FormControlWrapper/FormControlWrapper';
|
|
5
|
+
export * from './IconButtons/IconButtons';
|
|
6
|
+
export * from './MultiCheckBox/MultiCheckBox';
|
|
7
|
+
export * from './PasswordField/PasswordField';
|
|
8
|
+
export * from './SearchBar/SearchBar';
|
|
9
|
+
export * from './SingleCheckBox/SIngleCheckBox';
|
|
10
|
+
export * from './SingleSelect/SingleSelect';
|
|
11
|
+
export * from './Switch/Switch';
|
|
12
|
+
export * from './TextField/TextField';
|
|
13
|
+
export * from './TimePicker/TimePicker';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Box, BoxProps, styled } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
const StyledPageContent = styled(Box)(({ theme }) => ({
|
|
4
|
+
padding: '1rem',
|
|
5
|
+
flex: 1,
|
|
6
|
+
display: 'flex',
|
|
7
|
+
flexDirection: 'column',
|
|
8
|
+
borderRadius: '10px',
|
|
9
|
+
overflowY: 'auto',
|
|
10
|
+
backgroundColor: theme.palette.surface.paperBackground,
|
|
11
|
+
height: '100%',
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
export function PageContent(props: BoxProps) {
|
|
15
|
+
return <StyledPageContent {...props}>{props.children}</StyledPageContent>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Box, styled, Typography } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { Breadcrumbs } from '../../Navigation/Breadcrumbs/Breadcrumbs';
|
|
4
|
+
|
|
5
|
+
interface BreadCrumbsLink {
|
|
6
|
+
name: string | ReactNode;
|
|
7
|
+
to: string;
|
|
8
|
+
}
|
|
9
|
+
interface PageHeaderProps {
|
|
10
|
+
title?: string | ReactNode;
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
links?: BreadCrumbsLink[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const StyledBox = styled(Box)(({ theme }) => ({
|
|
16
|
+
minHeight: '40px',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
margin: '0',
|
|
21
|
+
flexWrap: 'wrap',
|
|
22
|
+
'& .actions': {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
gap: '1rem',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
marginLeft: 'auto',
|
|
27
|
+
'& .MuiButton-root': {
|
|
28
|
+
height: '40px',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
export default function PageHeader({ title, actions, links }: PageHeaderProps) {
|
|
34
|
+
return (
|
|
35
|
+
<StyledBox>
|
|
36
|
+
<>
|
|
37
|
+
{links && links.length > 0 ? (
|
|
38
|
+
<Breadcrumbs links={links} />
|
|
39
|
+
) : (
|
|
40
|
+
<>{typeof title === 'string' ? <Typography variant="subtitle2">{title}</Typography> : title}</>
|
|
41
|
+
)}
|
|
42
|
+
</>
|
|
43
|
+
<Box className="actions">{actions}</Box>
|
|
44
|
+
</StyledBox>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Box, Dialog, DialogActions, styled } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
import { AnimatedGifs } from '../../../assets/images/gif';
|
|
4
|
+
import { Button, Typography } from '../../export';
|
|
5
|
+
|
|
6
|
+
export type ConfirmDialogType = 'confirm' | 'delete';
|
|
7
|
+
|
|
8
|
+
export type ConfirmDialogProps = {
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
title: string;
|
|
11
|
+
message: string;
|
|
12
|
+
onConfirm: () => void;
|
|
13
|
+
onCancel: () => void;
|
|
14
|
+
type: ConfirmDialogType;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const StyledDialogContent = styled(Box)(() => ({
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
const StyledDialog = styled(Dialog)(({ theme }) => ({
|
|
23
|
+
'& .MuiPaper-root': {
|
|
24
|
+
padding: '24px 16px',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
height: '175px',
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
|
31
|
+
isOpen,
|
|
32
|
+
title,
|
|
33
|
+
message,
|
|
34
|
+
onConfirm,
|
|
35
|
+
onCancel,
|
|
36
|
+
type,
|
|
37
|
+
}) => {
|
|
38
|
+
if (!isOpen) return null;
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<StyledDialog
|
|
42
|
+
keepMounted
|
|
43
|
+
maxWidth="sm"
|
|
44
|
+
transitionDuration={150}
|
|
45
|
+
open={isOpen}
|
|
46
|
+
onClose={onCancel}
|
|
47
|
+
>
|
|
48
|
+
<StyledDialogContent>
|
|
49
|
+
<Box>
|
|
50
|
+
<img
|
|
51
|
+
src={
|
|
52
|
+
type === 'delete'
|
|
53
|
+
? AnimatedGifs.DeleteConfirmationAlert
|
|
54
|
+
: AnimatedGifs.ConfirmationAlert
|
|
55
|
+
}
|
|
56
|
+
alt="Animated GIF"
|
|
57
|
+
style={{ width: '80px' }}
|
|
58
|
+
/>
|
|
59
|
+
</Box>
|
|
60
|
+
<Box>
|
|
61
|
+
<Typography variant="subtitle2">{title}</Typography>
|
|
62
|
+
<Typography variant="label1">{message}</Typography>
|
|
63
|
+
</Box>
|
|
64
|
+
</StyledDialogContent>
|
|
65
|
+
<DialogActions sx={{ gap: '16px' }}>
|
|
66
|
+
<Button onClick={onCancel} variant="text">
|
|
67
|
+
Cancel
|
|
68
|
+
</Button>
|
|
69
|
+
<Button
|
|
70
|
+
onClick={onConfirm}
|
|
71
|
+
variant="contained"
|
|
72
|
+
color={type === 'delete' ? 'error' : 'primary'}
|
|
73
|
+
>
|
|
74
|
+
{type === 'delete' ? 'Confirm Delete' : 'Confirm'}
|
|
75
|
+
</Button>
|
|
76
|
+
</DialogActions>
|
|
77
|
+
</StyledDialog>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { KeyboardArrowDown } from
|
|
2
|
-
import { Button, ButtonProps } from
|
|
1
|
+
import { KeyboardArrowDown } from '@mui/icons-material'
|
|
2
|
+
import { Button, ButtonProps } from '../../Input/Button/Button'
|
|
3
3
|
|
|
4
4
|
export const DropDownButton = (props: ButtonProps) => {
|
|
5
5
|
return (
|
|
6
|
-
<Button
|
|
7
|
-
)
|
|
8
|
-
}
|
|
6
|
+
<Button variant="outlined" endIcon={<KeyboardArrowDown />} {...props} />
|
|
7
|
+
)
|
|
8
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Box, Stack } from "@mui/material";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { Icons, Tooltip, Typography } from "../../export";
|
|
4
|
+
import {
|
|
5
|
+
DefaultButtonProps,
|
|
6
|
+
InternalMenuButtonProps,
|
|
7
|
+
SubMenuButtonProps,
|
|
8
|
+
TooltipIconProps,
|
|
9
|
+
} from "./interfaces";
|
|
10
|
+
import { createSidebarStyles } from "./styles";
|
|
11
|
+
|
|
12
|
+
export const TooltipIcon = ({ name, icon }: TooltipIconProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<Tooltip title={<Typography variant="label2">{name}</Typography>}>
|
|
15
|
+
{icon}
|
|
16
|
+
</Tooltip>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const DefaultButton = ({
|
|
21
|
+
name,
|
|
22
|
+
icon,
|
|
23
|
+
collapsed,
|
|
24
|
+
}: DefaultButtonProps) => {
|
|
25
|
+
const { StyledListItemButton, StyledListItemIcon } = useMemo(
|
|
26
|
+
() => createSidebarStyles(collapsed),
|
|
27
|
+
[collapsed]
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<StyledListItemButton collapsed={collapsed}>
|
|
32
|
+
<StyledListItemIcon collapsed={collapsed}>{icon}</StyledListItemIcon>
|
|
33
|
+
<Typography variant="button1">{name}</Typography>
|
|
34
|
+
</StyledListItemButton>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const InternalMenuButton = ({
|
|
39
|
+
name,
|
|
40
|
+
icon,
|
|
41
|
+
collapsed,
|
|
42
|
+
}: InternalMenuButtonProps) => {
|
|
43
|
+
const { StyledListItemButton, StyledListItemIcon, HoverIcon } = useMemo(
|
|
44
|
+
() => createSidebarStyles(collapsed),
|
|
45
|
+
[collapsed]
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<StyledListItemButton collapsed={collapsed}>
|
|
50
|
+
<Stack
|
|
51
|
+
width={"100%"}
|
|
52
|
+
direction="row"
|
|
53
|
+
alignItems={"center"}
|
|
54
|
+
justifyContent={"space-between"}
|
|
55
|
+
>
|
|
56
|
+
<Stack direction="row" alignItems={"center"}>
|
|
57
|
+
<StyledListItemIcon collapsed={collapsed}>{icon}</StyledListItemIcon>
|
|
58
|
+
<Typography variant="button1">{name}</Typography>
|
|
59
|
+
</Stack>
|
|
60
|
+
<HoverIcon display={"flex"} className="hoverIcon">
|
|
61
|
+
<Icons.RedoIcon size={18} />
|
|
62
|
+
</HoverIcon>
|
|
63
|
+
</Stack>
|
|
64
|
+
</StyledListItemButton>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const SubMenuButton = ({
|
|
69
|
+
name,
|
|
70
|
+
icon,
|
|
71
|
+
expanded,
|
|
72
|
+
collapsed,
|
|
73
|
+
}: SubMenuButtonProps) => {
|
|
74
|
+
const { StyledListItemButton, StyledListItemIcon } = useMemo(
|
|
75
|
+
() => createSidebarStyles(collapsed),
|
|
76
|
+
[collapsed]
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<StyledListItemButton collapsed={collapsed}>
|
|
81
|
+
<Stack
|
|
82
|
+
width={"100%"}
|
|
83
|
+
direction="row"
|
|
84
|
+
alignItems={"center"}
|
|
85
|
+
justifyContent={"space-between"}
|
|
86
|
+
>
|
|
87
|
+
<Stack direction="row" alignItems={"center"}>
|
|
88
|
+
<StyledListItemIcon collapsed={collapsed}>{icon}</StyledListItemIcon>
|
|
89
|
+
<Typography variant="button1">{name}</Typography>
|
|
90
|
+
</Stack>
|
|
91
|
+
<Box display={"flex"}>
|
|
92
|
+
{expanded ? <Icons.CollapseIcon /> : <Icons.ExpandIcon />}
|
|
93
|
+
</Box>
|
|
94
|
+
</Stack>
|
|
95
|
+
</StyledListItemButton>
|
|
96
|
+
);
|
|
97
|
+
};
|