@campxdev/react-blueprint 1.1.8 → 1.1.9
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/package.json +2 -2
- package/src/AppContent.tsx +6 -6
- package/src/assets/fonts/heebo/index.ts +2 -2
- package/src/assets/fonts/poppins/index.ts +5 -5
- package/src/assets/images/gif/index.ts +4 -0
- package/src/assets/images/gif/upload-file.gif +0 -0
- package/src/assets/images/gif/uploading-file.gif +0 -0
- package/src/components/Assets/ErrorPages/InternalServerError.tsx +7 -7
- package/src/components/Assets/ErrorPages/NoInternetConnection.tsx +7 -7
- package/src/components/Assets/ErrorPages/NoItemFound.tsx +7 -7
- package/src/components/Assets/ErrorPages/PageNotFound.tsx +5 -5
- package/src/components/Assets/ErrorPages/UnAuthorized.tsx +6 -6
- package/src/components/Assets/ErrorPages/styles.tsx +15 -15
- package/src/components/Assets/Icons/IconComponents/AcademicIcon.tsx +7 -1
- package/src/components/Assets/Icons/IconComponents/ActiveDevicesIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AdminIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AdministratorIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AlertFilledIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ArrowBackIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AttachmentIcon.tsx +32 -0
- package/src/components/Assets/Icons/IconComponents/BulbIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CampxFullLogoIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/CampxIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/CareerIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CheckedCheckBoxIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CheckedRadioIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ClogWheelIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CollapseIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CrossIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DashBoardIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DeleteIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DeviceIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DocumentIcon.tsx +52 -0
- package/src/components/Assets/Icons/IconComponents/DownloadIcon.tsx +52 -0
- package/src/components/Assets/Icons/IconComponents/EditIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ExamResultIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ExcelIcon.tsx +56 -0
- package/src/components/Assets/Icons/IconComponents/ExpandIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ExportIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/FilterIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/HelpIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/HomeIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ImageIcon.tsx +44 -0
- package/src/components/Assets/Icons/IconComponents/InfoFilledIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/InfoIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/InstitutionsIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/LeftIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/LocationIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/LogoutIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/NavigationIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/NoteIcon.tsx +7 -1
- package/src/components/Assets/Icons/IconComponents/NotificationIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/PdfIcon.tsx +52 -0
- package/src/components/Assets/Icons/IconComponents/ProductFeaturesIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ProfileIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/RedirectIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/RedoIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/RightIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/SaveIcon.tsx +39 -39
- package/src/components/Assets/Icons/IconComponents/SearchIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ShareIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/SuccessFilledIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/TicketsIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/UncheckCheckBoxIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/UncheckedRadioIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ViewIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/VisibiityOffIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/VisibilityIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/WarningFilledIcon.tsx +1 -1
- package/src/components/Assets/Icons/Icons.tsx +12 -0
- package/src/components/Assets/export.ts +6 -6
- package/src/components/Charts/BarChart/BarChart.tsx +17 -19
- package/src/components/Charts/LineChart/LineChart.tsx +12 -14
- package/src/components/Charts/PieChart/PieChart.tsx +8 -8
- package/src/components/Charts/TreeMap/TreeMap.tsx +15 -15
- package/src/components/Charts/export.ts +4 -4
- package/src/components/Charts/types/types.ts +3 -3
- package/src/components/DataDisplay/Accordion/Accordion.tsx +2 -0
- package/src/components/DataDisplay/Avatar/Avatar.tsx +14 -3
- package/src/components/DataDisplay/Card/Card.tsx +18 -18
- package/src/components/DataDisplay/Card/styles.tsx +24 -25
- package/src/components/DataDisplay/Chips/Chips.tsx +14 -14
- package/src/components/DataDisplay/DataTable/DataTable.tsx +4 -1
- package/src/components/DataDisplay/DataTable/TablePagination.tsx +10 -10
- package/src/components/DataDisplay/SidePanel/SidePanel.tsx +1 -1
- package/src/components/DataDisplay/Typography/Typography.tsx +1 -1
- package/src/components/Feedback/Alert/Alert.tsx +8 -8
- package/src/components/Feedback/Snackbar/Snackbar.tsx +27 -27
- package/src/components/Feedback/Spinner/Spinner.tsx +2 -2
- package/src/components/Feedback/Tooltip/Tooltip.tsx +6 -6
- package/src/components/Feedback/Tutorial/Tutorial.tsx +45 -45
- package/src/components/Feedback/export.ts +5 -0
- package/src/components/Image/Image.tsx +8 -8
- package/src/components/Input/Button/Button.tsx +2 -2
- package/src/components/Input/DatePicker/DatePicker.tsx +18 -4
- package/src/components/Input/FormActions/FormActions.tsx +15 -4
- package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +20 -5
- package/src/components/Input/HelpButton/HelpButton.stories.tsx +9 -9
- package/src/components/Input/HelpButton/HelpButton.tsx +4 -4
- package/src/components/Input/IconButtons/IconButtons/DeleteButton.tsx +2 -2
- package/src/components/Input/IconButtons/IconButtons/EditButton.tsx +2 -2
- package/src/components/Input/IconButtons/IconButtons/RedirectButton.tsx +2 -2
- package/src/components/Input/IconButtons/IconButtons/ViewButton.tsx +2 -2
- package/src/components/Input/LabelWrapper/LabelWrapper.tsx +5 -5
- package/src/components/Input/MultiCheckBox/MultiCheckBox.tsx +6 -6
- package/src/components/Input/OtpInput/OtpInput.tsx +17 -17
- package/src/components/Input/PasswordField/PasswordField.tsx +8 -8
- package/src/components/Input/RadioGroup/RadioGroup.tsx +5 -5
- package/src/components/Input/SearchBar/SearchBar.tsx +20 -20
- package/src/components/Input/SingleCheckBox/SIngleCheckBox.tsx +5 -5
- package/src/components/Input/SingleSelect/SingleSelect.tsx +39 -6
- package/src/components/Input/Switch/Switch.tsx +1 -1
- package/src/components/Input/TextField/TextField.tsx +3 -3
- package/src/components/Input/TimePicker/TimePicker.tsx +18 -4
- package/src/components/Input/components/FetchingOptionsLoader.tsx +3 -3
- package/src/components/Input/styles.tsx +6 -6
- package/src/components/Layout/AppHeader/AppHeader.tsx +10 -12
- package/src/components/Layout/AppHeader/AppHeaderActions/CogWheelMenu.tsx +5 -5
- package/src/components/Layout/AppHeader/AppHeaderActions/HeaderActions.tsx +6 -6
- package/src/components/Layout/AppHeader/AppHeaderActions/SwitchInstitution.tsx +37 -37
- package/src/components/Layout/AppHeader/AppHeaderActions/UserBox.tsx +28 -28
- package/src/components/Layout/AppHeader/styles/styles.tsx +24 -24
- package/src/components/Layout/PageHeader/PageHeader.tsx +8 -3
- package/src/components/Layout/TabsLayout/Tabs.tsx +16 -16
- package/src/components/Layout/TabsLayout/TabsLayout.tsx +6 -6
- package/src/components/Layout/export.ts +4 -0
- package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +35 -23
- package/src/components/Navigation/ConfirmDialog/ConfirmDialog.tsx +43 -48
- package/src/components/Navigation/Dialog/Dialog.tsx +33 -0
- package/src/components/Navigation/DialogButton/DialogButton.tsx +17 -81
- package/src/components/Navigation/DropDownMenu/DropDownButton.tsx +4 -4
- package/src/components/Navigation/DropDownMenu/DropDownIcon.tsx +4 -4
- package/src/components/Navigation/DropDownMenu/DropDownMenu.tsx +8 -8
- package/src/components/Navigation/DropDownMenu/DropdownMenuItem.tsx +3 -3
- package/src/components/Navigation/DropDownMenu/styles.tsx +13 -13
- package/src/components/Navigation/PreviewFiles/PreviewFiles.tsx +165 -0
- package/src/components/Navigation/Sidebar/Components.tsx +18 -18
- package/src/components/Navigation/Sidebar/MenuItem.tsx +1 -1
- package/src/components/Navigation/Sidebar/SubMenuItem.tsx +2 -1
- package/src/components/Navigation/Sidebar/interfaces.ts +1 -1
- package/src/components/Navigation/Sidebar/styles.tsx +64 -64
- package/src/components/Navigation/Stepper/Stepper.tsx +5 -5
- package/src/components/Navigation/Stepper/StepperComponents.tsx +15 -15
- package/src/components/Navigation/TabsContainer/TabsContainer.tsx +4 -4
- package/src/components/Navigation/UploadDialog/LoadingUploadDialogContainer.tsx +23 -0
- package/src/components/Navigation/UploadDialog/Styles.tsx +34 -0
- package/src/components/Navigation/UploadDialog/UploadDialog.tsx +143 -0
- package/src/components/Navigation/UploadDialog/UploadDialogContainer.tsx +82 -0
- package/src/components/Navigation/{exports.ts → export.ts} +4 -0
- package/src/components/export.ts +7 -7
- package/src/index.tsx +2 -2
- package/src/store/activeStore.ts +1 -1
- package/src/stories/Assets/Icons.stories.tsx +6 -6
- package/src/stories/Charts/BarChart.stories.tsx +56 -56
- package/src/stories/Charts/LineChart.stories.tsx +49 -49
- package/src/stories/Charts/PieChart.stories.tsx +53 -53
- package/src/stories/Charts/Treemap.stories.tsx +122 -122
- package/src/stories/DataDisplay/AccordionGroup.stories.tsx +11 -12
- package/src/stories/DataDisplay/Card.stories.tsx +34 -34
- package/src/stories/DataDisplay/Chips.stories.tsx +10 -10
- package/src/stories/DataDisplay/CircularAvatar.stories.tsx +6 -6
- package/src/stories/DataDisplay/DataTable.stories.tsx +32 -32
- package/src/stories/DataDisplay/SidePanel.stories.tsx +14 -14
- package/src/stories/DataDisplay/SquareAvatar.stories.tsx +15 -15
- package/src/stories/DesignSystem/colorTokens.stories.tsx +10 -10
- package/src/stories/DesignSystem/typography.stories.tsx +19 -19
- package/src/stories/Feedback/Alert.stories.tsx +9 -9
- package/src/stories/Feedback/Snackbar.stories.tsx +11 -11
- package/src/stories/Feedback/Spinner.stories.tsx +4 -4
- package/src/stories/Feedback/Tooltip.stories.tsx +5 -5
- package/src/stories/Feedback/Tutorial.stories.tsx +13 -13
- package/src/stories/Input/Button.stories.tsx +26 -26
- package/src/stories/Input/DatePicker.stories.tsx +48 -8
- package/src/stories/Input/IconButtons.stories.tsx +6 -6
- package/src/stories/Input/MultiCheckBox.stories.tsx +15 -15
- package/src/stories/Input/OtpInput.stories.tsx +5 -5
- package/src/stories/Input/Password.stories.tsx +7 -7
- package/src/stories/Input/RadioGroup.stories.tsx +14 -14
- package/src/stories/Input/SearchBar.stories.tsx +10 -10
- package/src/stories/Input/SingleCheckBox.stories.tsx +7 -7
- package/src/stories/Input/SingleSelect.stories.tsx +47 -47
- package/src/stories/Input/Switch.stories.tsx +22 -22
- package/src/stories/Input/TextField.stories.tsx +47 -47
- package/src/stories/Input/TimePicker.stories.tsx +44 -7
- package/src/stories/Layout/AppHeader.stories.tsx +13 -13
- package/src/stories/Layout/TabsLayout.stories.tsx +24 -24
- package/src/stories/Navigation/ConfirmDialog.stories.tsx +12 -2
- package/src/stories/Navigation/DialogButton.stories.tsx +38 -45
- package/src/stories/Navigation/DropDownMenu.stories.tsx +24 -24
- package/src/stories/Navigation/FloatingSidebar.stories.tsx +23 -23
- package/src/stories/Navigation/ImportDialog.stories.tsx +45 -0
- package/src/stories/Navigation/PreviewFiles.stories.tsx +80 -0
- package/src/stories/Navigation/Stepper.stories.tsx +15 -15
- package/src/stories/Navigation/TabsContainer.stories.tsx +11 -11
- package/src/themes/MuiThemeProvider.tsx +3 -3
- package/src/themes/colorTokens/colorPalette.tsx +38 -38
- package/src/themes/colorTokens/darkColorTokens.tsx +1 -1
- package/src/themes/colorTokens/lightColorTokens.ts +1 -1
- package/src/themes/commonTheme.ts +13 -3
- package/src/themes/customCssBaseline.ts +2 -2
- package/src/themes/darkTheme.ts +4 -4
- package/src/themes/export.ts +3 -3
- package/src/themes/lightTheme.ts +4 -4
- package/src/utils/constants.ts +5 -5
- package/src/utils/logout.ts +8 -8
- package/src/components/Feedback/exports.ts +0 -5
- package/src/components/Layout/exports.ts +0 -4
- package/src/stories/Navigation/Breadcrumbs.stories.tsx +0 -34
- package/src/utils/campxAxios.ts +0 -18
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
Pagination as MuiPagination,
|
|
3
3
|
PaginationProps as MuiPaginationProps,
|
|
4
4
|
Stack,
|
|
5
|
-
} from
|
|
6
|
-
import { DropdownMenuItem } from
|
|
5
|
+
} from '@mui/material';
|
|
6
|
+
import { DropdownMenuItem } from '../../Navigation/DropDownMenu/DropdownMenuItem';
|
|
7
7
|
|
|
8
|
-
import { DropDownButton } from
|
|
9
|
-
import { DropdownMenu } from
|
|
10
|
-
import { Typography } from
|
|
8
|
+
import { DropDownButton } from '../../Navigation/DropDownMenu/DropDownButton';
|
|
9
|
+
import { DropdownMenu } from '../../Navigation/DropDownMenu/DropDownMenu';
|
|
10
|
+
import { Typography } from '../Typography/Typography';
|
|
11
11
|
|
|
12
12
|
export type PaginationProps = {
|
|
13
13
|
limit: number;
|
|
@@ -42,17 +42,17 @@ export const TablePagination = (props: PaginationProps) => {
|
|
|
42
42
|
<DropDownButton
|
|
43
43
|
loading={false}
|
|
44
44
|
onClick={open}
|
|
45
|
-
sx={{ minWidth:
|
|
45
|
+
sx={{ minWidth: '130px', padding: '10px 20px', maxHeight: '32px' }}
|
|
46
46
|
>
|
|
47
47
|
{limit} / Page
|
|
48
48
|
</DropDownButton>
|
|
49
49
|
)}
|
|
50
50
|
menuListProps={{
|
|
51
51
|
sx: {
|
|
52
|
-
minWidth:
|
|
53
|
-
|
|
54
|
-
minHeight:
|
|
55
|
-
padding:
|
|
52
|
+
minWidth: '130px',
|
|
53
|
+
'& li': {
|
|
54
|
+
minHeight: '32px !important',
|
|
55
|
+
padding: '10px 20px',
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
}}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Alert as MuiAlert, AlertProps as MuiAlertProps } from
|
|
2
|
-
import { Icons } from
|
|
1
|
+
import { Alert as MuiAlert, AlertProps as MuiAlertProps } from '@mui/material';
|
|
2
|
+
import { Icons } from '../../export';
|
|
3
3
|
|
|
4
4
|
export type AlertProps = {
|
|
5
5
|
message: string;
|
|
6
|
-
severity: MuiAlertProps[
|
|
6
|
+
severity: MuiAlertProps['severity'];
|
|
7
7
|
} & MuiAlertProps;
|
|
8
8
|
|
|
9
|
-
const getIcon = (severity: MuiAlertProps[
|
|
9
|
+
const getIcon = (severity: MuiAlertProps['severity']) => {
|
|
10
10
|
switch (severity) {
|
|
11
|
-
case
|
|
11
|
+
case 'success':
|
|
12
12
|
return <Icons.SuccessFilledIcon size={20} />;
|
|
13
|
-
case
|
|
13
|
+
case 'error':
|
|
14
14
|
return <Icons.AlertFilledIcon size={20} />;
|
|
15
|
-
case
|
|
15
|
+
case 'info':
|
|
16
16
|
return <Icons.InfoFilledIcon size={20} />;
|
|
17
|
-
case
|
|
17
|
+
case 'warning':
|
|
18
18
|
return <Icons.WarningFilledIcon size={20} />;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
SnackbarProps as MuiSnackbarProps,
|
|
6
6
|
Stack,
|
|
7
7
|
useTheme,
|
|
8
|
-
} from
|
|
9
|
-
import { capitalize } from
|
|
10
|
-
import { Typography } from
|
|
11
|
-
import { Icons } from
|
|
8
|
+
} from '@mui/material';
|
|
9
|
+
import { capitalize } from 'lodash';
|
|
10
|
+
import { Typography } from '../../DataDisplay/Typography/Typography';
|
|
11
|
+
import { Icons } from '../../export';
|
|
12
12
|
|
|
13
|
-
export type Severity =
|
|
13
|
+
export type Severity = 'success' | 'info' | 'warning' | 'error';
|
|
14
14
|
|
|
15
15
|
export type SnackbarProps = {
|
|
16
16
|
severity: Severity;
|
|
@@ -21,13 +21,13 @@ export const Snackbar = ({ ...props }: SnackbarProps) => {
|
|
|
21
21
|
const theme = useTheme();
|
|
22
22
|
const getColor = (variant: Severity) => {
|
|
23
23
|
switch (variant) {
|
|
24
|
-
case
|
|
24
|
+
case 'success':
|
|
25
25
|
return theme.palette.highlight.highlightGreen;
|
|
26
|
-
case
|
|
26
|
+
case 'error':
|
|
27
27
|
return theme.palette.highlight.highlightRed;
|
|
28
|
-
case
|
|
28
|
+
case 'info':
|
|
29
29
|
return theme.palette.highlight.highlightBlue;
|
|
30
|
-
case
|
|
30
|
+
case 'warning':
|
|
31
31
|
return theme.palette.highlight.highlightOrange;
|
|
32
32
|
default:
|
|
33
33
|
return theme.palette.highlight.highlightGreen;
|
|
@@ -35,13 +35,13 @@ export const Snackbar = ({ ...props }: SnackbarProps) => {
|
|
|
35
35
|
};
|
|
36
36
|
const getBackGroundColor = (variant: Severity) => {
|
|
37
37
|
switch (variant) {
|
|
38
|
-
case
|
|
38
|
+
case 'success':
|
|
39
39
|
return theme.palette.highlight.greenBackground;
|
|
40
|
-
case
|
|
40
|
+
case 'error':
|
|
41
41
|
return theme.palette.highlight.redBackground;
|
|
42
|
-
case
|
|
42
|
+
case 'info':
|
|
43
43
|
return theme.palette.highlight.blueBackground;
|
|
44
|
-
case
|
|
44
|
+
case 'warning':
|
|
45
45
|
return theme.palette.highlight.orangeBackground;
|
|
46
46
|
default:
|
|
47
47
|
return theme.palette.highlight.greenBackground;
|
|
@@ -50,20 +50,20 @@ export const Snackbar = ({ ...props }: SnackbarProps) => {
|
|
|
50
50
|
|
|
51
51
|
const getIcon = (variant: Severity) => {
|
|
52
52
|
switch (variant) {
|
|
53
|
-
case
|
|
53
|
+
case 'success':
|
|
54
54
|
return <Icons.SuccessFilledIcon size={20} />;
|
|
55
|
-
case
|
|
55
|
+
case 'error':
|
|
56
56
|
return <Icons.AlertFilledIcon size={20} />;
|
|
57
|
-
case
|
|
57
|
+
case 'info':
|
|
58
58
|
return <Icons.InfoFilledIcon size={20} />;
|
|
59
|
-
case
|
|
59
|
+
case 'warning':
|
|
60
60
|
return <Icons.WarningFilledIcon size={20} />;
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
const handleClose = (event: React.SyntheticEvent<any> | Event) => {
|
|
65
65
|
if (props.onClose) {
|
|
66
|
-
props.onClose(event,
|
|
66
|
+
props.onClose(event, 'clickaway');
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
|
|
@@ -76,23 +76,23 @@ export const Snackbar = ({ ...props }: SnackbarProps) => {
|
|
|
76
76
|
alignItems="flex-start"
|
|
77
77
|
gap={1}
|
|
78
78
|
sx={{
|
|
79
|
-
height:
|
|
80
|
-
width:
|
|
79
|
+
height: '90px',
|
|
80
|
+
width: '480px',
|
|
81
81
|
backgroundColor: getBackGroundColor(props.severity),
|
|
82
82
|
}}
|
|
83
83
|
>
|
|
84
84
|
<Box
|
|
85
85
|
sx={{
|
|
86
|
-
width:
|
|
87
|
-
height:
|
|
86
|
+
width: '10px',
|
|
87
|
+
height: '100%',
|
|
88
88
|
backgroundColor: getColor(props.severity),
|
|
89
|
-
borderRadius:
|
|
89
|
+
borderRadius: '5px 0px 0px 5px',
|
|
90
90
|
}}
|
|
91
91
|
/>
|
|
92
|
-
<Stack width="100%" height="100%" direction={
|
|
92
|
+
<Stack width="100%" height="100%" direction={'row'} alignItems="center">
|
|
93
93
|
<Stack direction="row" gap={1} justifyContent="space-evenly">
|
|
94
|
-
<Box sx={{ marginTop:
|
|
95
|
-
<Stack direction={
|
|
94
|
+
<Box sx={{ marginTop: '2px' }}>{getIcon(props.severity)}</Box>
|
|
95
|
+
<Stack direction={'column'}>
|
|
96
96
|
<Typography variant="subtitle2">
|
|
97
97
|
{capitalize(props.severity)}
|
|
98
98
|
</Typography>
|
|
@@ -101,7 +101,7 @@ export const Snackbar = ({ ...props }: SnackbarProps) => {
|
|
|
101
101
|
</Stack>
|
|
102
102
|
</Stack>
|
|
103
103
|
|
|
104
|
-
<IconButton sx={{ margin:
|
|
104
|
+
<IconButton sx={{ margin: '25px' }} onClick={handleClose}>
|
|
105
105
|
<Icons.CrossIcon2 />
|
|
106
106
|
</IconButton>
|
|
107
107
|
</Stack>
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
Tooltip as MuiTooltip,
|
|
4
4
|
TooltipProps as MuiTooltipProps,
|
|
5
5
|
Stack,
|
|
6
|
-
} from
|
|
7
|
-
import { Children, ReactElement } from
|
|
8
|
-
import { BulbIcon } from
|
|
9
|
-
import { Typography } from
|
|
6
|
+
} from '@mui/material';
|
|
7
|
+
import { Children, ReactElement } from 'react';
|
|
8
|
+
import { BulbIcon } from '../../Assets/Icons/IconComponents/BulbIcon';
|
|
9
|
+
import { Typography } from '../../DataDisplay/Typography/Typography';
|
|
10
10
|
|
|
11
11
|
export type TooltipProps = {
|
|
12
12
|
children: ReactElement | string;
|
|
@@ -14,7 +14,7 @@ export type TooltipProps = {
|
|
|
14
14
|
export type TooltipContentProps = { message: string };
|
|
15
15
|
|
|
16
16
|
export const Tooltip = ({
|
|
17
|
-
placement =
|
|
17
|
+
placement = 'right',
|
|
18
18
|
arrow = true,
|
|
19
19
|
...props
|
|
20
20
|
}: TooltipProps) => {
|
|
@@ -32,7 +32,7 @@ export const Tooltip = ({
|
|
|
32
32
|
|
|
33
33
|
export const ToolTipContent = ({ message }: TooltipContentProps) => {
|
|
34
34
|
return (
|
|
35
|
-
<Stack gap={1} sx={{ margin:
|
|
35
|
+
<Stack gap={1} sx={{ margin: '5px' }}>
|
|
36
36
|
<Stack direction="row" gap={1}>
|
|
37
37
|
<BulbIcon />
|
|
38
38
|
<Typography variant="subtitle3">Note:</Typography>
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { axios } from
|
|
2
|
-
import { Box, useTheme } from
|
|
3
|
-
import { ReactNode, useCallback, useEffect, useState } from
|
|
4
|
-
import ReactJoyride, { ACTIONS, CallBackProps, Step } from
|
|
5
|
-
import { Typography } from
|
|
1
|
+
import { axios } from '@campxdev/campx-web-utils';
|
|
2
|
+
import { Box, useTheme } from '@mui/material';
|
|
3
|
+
import { ReactNode, useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import ReactJoyride, { ACTIONS, CallBackProps, Step } from 'react-joyride';
|
|
5
|
+
import { Typography } from '../../DataDisplay/Typography/Typography';
|
|
6
6
|
|
|
7
7
|
export interface TutorialProps {
|
|
8
8
|
steps: Step[];
|
|
9
9
|
children?: ReactNode;
|
|
10
10
|
tourName: string;
|
|
11
11
|
showProgress?: boolean;
|
|
12
|
-
iconPosition?:
|
|
12
|
+
iconPosition?: 'left' | 'right';
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const Tutorial = ({
|
|
16
16
|
steps,
|
|
17
17
|
children,
|
|
18
18
|
tourName,
|
|
19
|
-
iconPosition =
|
|
19
|
+
iconPosition = 'right',
|
|
20
20
|
showProgress = true,
|
|
21
21
|
}: TutorialProps) => {
|
|
22
22
|
const [run, setRun] = useState(false);
|
|
23
|
-
const userTours = localStorage.getItem(
|
|
23
|
+
const userTours = localStorage.getItem('userTours') || '[]';
|
|
24
24
|
const theme = useTheme();
|
|
25
25
|
|
|
26
26
|
const startTour = useCallback(() => {
|
|
@@ -45,22 +45,22 @@ export const Tutorial = ({
|
|
|
45
45
|
// Check if the tour is skipped or completed
|
|
46
46
|
if (
|
|
47
47
|
action === ACTIONS.SKIP &&
|
|
48
|
-
lifecycle ===
|
|
49
|
-
type ===
|
|
48
|
+
lifecycle === 'complete' &&
|
|
49
|
+
type === 'tour:end'
|
|
50
50
|
) {
|
|
51
|
-
console.log(
|
|
51
|
+
console.log('Tour is skipped');
|
|
52
52
|
reqData.skipped = true;
|
|
53
53
|
} else if (action === ACTIONS.CLOSE) {
|
|
54
54
|
setRun(false);
|
|
55
55
|
} else if (action === ACTIONS.RESET) {
|
|
56
|
-
console.log(
|
|
56
|
+
console.log('Tour is reset');
|
|
57
57
|
reqData.completed = true;
|
|
58
58
|
}
|
|
59
59
|
console.log(reqData);
|
|
60
60
|
if (reqData.skipped || reqData.completed) {
|
|
61
61
|
setRun(false); // Stop the tour
|
|
62
62
|
completeTour(reqData).catch((err) => {
|
|
63
|
-
console.error(
|
|
63
|
+
console.error('Failed to mark tour as complete:', err);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
};
|
|
@@ -69,30 +69,30 @@ export const Tutorial = ({
|
|
|
69
69
|
try {
|
|
70
70
|
if (!userTours.includes(tourName)) {
|
|
71
71
|
localStorage.setItem(
|
|
72
|
-
|
|
73
|
-
JSON.stringify([...JSON.parse(userTours), tourName])
|
|
72
|
+
'userTours',
|
|
73
|
+
JSON.stringify([...JSON.parse(userTours), tourName]),
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
|
-
await axios.post(
|
|
76
|
+
await axios.post('/square/tours/complete', { ...reqData });
|
|
77
77
|
} catch (error) {
|
|
78
|
-
console.error(
|
|
78
|
+
console.error('Error completing the tour:', error);
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
|
-
<div style={{ display:
|
|
83
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
|
84
84
|
<Box
|
|
85
85
|
sx={{
|
|
86
86
|
background: theme.palette.surface.grey,
|
|
87
|
-
padding:
|
|
88
|
-
borderRadius:
|
|
89
|
-
cursor:
|
|
90
|
-
width:
|
|
91
|
-
textAlign:
|
|
87
|
+
padding: '20px 8px',
|
|
88
|
+
borderRadius: '12px 0px 0px 12px',
|
|
89
|
+
cursor: 'pointer',
|
|
90
|
+
width: '40px',
|
|
91
|
+
textAlign: 'center',
|
|
92
92
|
}}
|
|
93
93
|
onClick={startTour}
|
|
94
94
|
>
|
|
95
|
-
<Box sx={{ transform:
|
|
95
|
+
<Box sx={{ transform: 'rotate(-90deg)', marginTop: '10px' }}>
|
|
96
96
|
<Typography variant="subtitle2">Tour</Typography>
|
|
97
97
|
</Box>
|
|
98
98
|
</Box>
|
|
@@ -108,38 +108,38 @@ export const Tutorial = ({
|
|
|
108
108
|
disableOverlayClose
|
|
109
109
|
spotlightPadding={5}
|
|
110
110
|
locale={{
|
|
111
|
-
last:
|
|
112
|
-
next:
|
|
113
|
-
skip:
|
|
114
|
-
back:
|
|
111
|
+
last: 'Got it',
|
|
112
|
+
next: 'Next',
|
|
113
|
+
skip: 'Skip',
|
|
114
|
+
back: 'Previous',
|
|
115
115
|
}}
|
|
116
116
|
styles={{
|
|
117
117
|
buttonNext: {
|
|
118
118
|
backgroundColor: theme.palette.primary.main,
|
|
119
119
|
color: theme.palette.secondary.light,
|
|
120
|
-
border:
|
|
121
|
-
height:
|
|
122
|
-
width:
|
|
123
|
-
padding:
|
|
124
|
-
fontFamily:
|
|
120
|
+
border: 'none',
|
|
121
|
+
height: '28px',
|
|
122
|
+
width: '100px',
|
|
123
|
+
padding: '0px',
|
|
124
|
+
fontFamily: 'Heebo, sans-serif',
|
|
125
125
|
},
|
|
126
126
|
buttonBack: {
|
|
127
|
-
backgroundColor:
|
|
128
|
-
color:
|
|
129
|
-
borderRadius:
|
|
130
|
-
height:
|
|
131
|
-
width:
|
|
132
|
-
gap:
|
|
133
|
-
marginLeft:
|
|
134
|
-
padding:
|
|
135
|
-
border:
|
|
136
|
-
fontFamily:
|
|
127
|
+
backgroundColor: 'transparent',
|
|
128
|
+
color: 'black',
|
|
129
|
+
borderRadius: '4px',
|
|
130
|
+
height: '28px',
|
|
131
|
+
width: '100px',
|
|
132
|
+
gap: '10px',
|
|
133
|
+
marginLeft: '5px',
|
|
134
|
+
padding: '0px',
|
|
135
|
+
border: '1px solid black',
|
|
136
|
+
fontFamily: 'Heebo, sans-serif',
|
|
137
137
|
},
|
|
138
138
|
tooltip: {
|
|
139
|
-
padding:
|
|
139
|
+
padding: '10px',
|
|
140
140
|
},
|
|
141
141
|
tooltipContainer: {
|
|
142
|
-
display:
|
|
142
|
+
display: 'flex',
|
|
143
143
|
backgroundColor: theme.palette.surface.paperBackground,
|
|
144
144
|
},
|
|
145
145
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box } from
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
2
|
// const brokenImage = require("./broken-image.png");
|
|
3
3
|
|
|
4
4
|
interface ImageProps {
|
|
@@ -6,7 +6,7 @@ interface ImageProps {
|
|
|
6
6
|
alt: string;
|
|
7
7
|
height: string | number;
|
|
8
8
|
width: string | number;
|
|
9
|
-
fit?:
|
|
9
|
+
fit?: 'cover' | 'contain' | 'fill';
|
|
10
10
|
radius?: string | number;
|
|
11
11
|
defaultImage?: any;
|
|
12
12
|
}
|
|
@@ -16,8 +16,8 @@ export default function Image({
|
|
|
16
16
|
alt,
|
|
17
17
|
height,
|
|
18
18
|
width,
|
|
19
|
-
fit =
|
|
20
|
-
radius =
|
|
19
|
+
fit = 'contain',
|
|
20
|
+
radius = '10px',
|
|
21
21
|
defaultImage = null,
|
|
22
22
|
}: ImageProps) {
|
|
23
23
|
return (
|
|
@@ -25,10 +25,10 @@ export default function Image({
|
|
|
25
25
|
sx={{
|
|
26
26
|
height: height,
|
|
27
27
|
width: width,
|
|
28
|
-
|
|
28
|
+
'& > img': {
|
|
29
29
|
borderRadius: radius,
|
|
30
|
-
width:
|
|
31
|
-
height:
|
|
30
|
+
width: '100%',
|
|
31
|
+
height: '100%',
|
|
32
32
|
objectFit: fit,
|
|
33
33
|
},
|
|
34
34
|
}}
|
|
@@ -37,7 +37,7 @@ export default function Image({
|
|
|
37
37
|
src={src || defaultImage}
|
|
38
38
|
alt={alt}
|
|
39
39
|
onError={(e: any) => {
|
|
40
|
-
e.target.src = defaultImage ? defaultImage :
|
|
40
|
+
e.target.src = defaultImage ? defaultImage : '';
|
|
41
41
|
}}
|
|
42
42
|
/>
|
|
43
43
|
</Box>
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { StackProps } from '@mui/material';
|
|
2
2
|
import { PickersShortcutsItem, PickerValidDate } from '@mui/x-date-pickers';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
DatePicker as MuiDatePicker,
|
|
5
|
+
DatePickerProps as MuiDatePickerProps,
|
|
6
|
+
} from '@mui/x-date-pickers/DatePicker';
|
|
4
7
|
import { format as DateFnsFormat } from 'date-fns';
|
|
5
8
|
import { Icons } from '../../Assets/Icons/Icons';
|
|
6
9
|
import { LabelWrapper } from '../LabelWrapper/LabelWrapper';
|
|
7
10
|
|
|
8
|
-
type DatePickerProps<
|
|
11
|
+
type DatePickerProps<
|
|
12
|
+
TDate extends PickerValidDate,
|
|
13
|
+
TEnableAccessibleFieldDOMStructure extends boolean = false,
|
|
14
|
+
> = {
|
|
9
15
|
format?: 'yyyy' | 'MMMM yyyy' | 'dd MMMM yyyy' | 'dd/MM/yyyy';
|
|
10
16
|
views?: ('year' | 'month' | 'day')[];
|
|
11
17
|
helperText?: string;
|
|
@@ -16,7 +22,10 @@ type DatePickerProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStr
|
|
|
16
22
|
openPickerIcon?: React.ElementType;
|
|
17
23
|
} & MuiDatePickerProps<TDate, TEnableAccessibleFieldDOMStructure>;
|
|
18
24
|
|
|
19
|
-
export const DatePicker = <
|
|
25
|
+
export const DatePicker = <
|
|
26
|
+
TDate extends PickerValidDate,
|
|
27
|
+
TEnableAccessibleFieldDOMStructure extends boolean = false,
|
|
28
|
+
>({
|
|
20
29
|
label,
|
|
21
30
|
name,
|
|
22
31
|
value,
|
|
@@ -31,7 +40,12 @@ export const DatePicker = <TDate extends PickerValidDate, TEnableAccessibleField
|
|
|
31
40
|
...rest
|
|
32
41
|
}: DatePickerProps<TDate, TEnableAccessibleFieldDOMStructure>) => {
|
|
33
42
|
return (
|
|
34
|
-
<LabelWrapper
|
|
43
|
+
<LabelWrapper
|
|
44
|
+
label={label}
|
|
45
|
+
required={required}
|
|
46
|
+
name={name}
|
|
47
|
+
containerProps={containerProps}
|
|
48
|
+
>
|
|
35
49
|
<MuiDatePicker
|
|
36
50
|
format={format}
|
|
37
51
|
views={views}
|
|
@@ -16,7 +16,12 @@ export interface FormActionsProps {
|
|
|
16
16
|
showTopBorder?: boolean;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function FormActions({
|
|
19
|
+
function FormActions({
|
|
20
|
+
submitButtonProps,
|
|
21
|
+
cancelButtonProps,
|
|
22
|
+
stackProps,
|
|
23
|
+
showTopBorder = false,
|
|
24
|
+
}: FormActionsProps) {
|
|
20
25
|
const theme = useTheme();
|
|
21
26
|
const defaultSubmitProps: ButtonConfig = {
|
|
22
27
|
title: 'Submit',
|
|
@@ -37,11 +42,17 @@ function FormActions({ submitButtonProps, cancelButtonProps, stackProps, showTop
|
|
|
37
42
|
direction="row"
|
|
38
43
|
padding={2}
|
|
39
44
|
gap={2.5}
|
|
40
|
-
borderTop={
|
|
45
|
+
borderTop={
|
|
46
|
+
showTopBorder ? `1px solid ${theme.palette.border.primary}` : 'none'
|
|
47
|
+
}
|
|
41
48
|
{...stackProps}
|
|
42
49
|
>
|
|
43
|
-
{defaultSubmitProps.show &&
|
|
44
|
-
|
|
50
|
+
{defaultSubmitProps.show && (
|
|
51
|
+
<Button {...defaultSubmitProps}>{defaultSubmitProps.title}</Button>
|
|
52
|
+
)}
|
|
53
|
+
{defaultCancelProps.show && (
|
|
54
|
+
<Button {...defaultCancelProps}>{defaultCancelProps.title}</Button>
|
|
55
|
+
)}
|
|
45
56
|
</Stack>
|
|
46
57
|
);
|
|
47
58
|
}
|
|
@@ -22,11 +22,21 @@ type ControlledElementProps = {
|
|
|
22
22
|
[key: string]: any;
|
|
23
23
|
} & TextFieldProps;
|
|
24
24
|
|
|
25
|
-
export function FormControlWrapper({
|
|
26
|
-
|
|
25
|
+
export function FormControlWrapper({
|
|
26
|
+
control,
|
|
27
|
+
children,
|
|
28
|
+
formActionProps,
|
|
29
|
+
}: FormControlWrapperProps) {
|
|
30
|
+
const wrapWithController = (
|
|
31
|
+
element: ReactElement<any>,
|
|
32
|
+
): ReactElement<any> => {
|
|
27
33
|
if (!isValidElement(element)) return element;
|
|
28
34
|
|
|
29
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
name,
|
|
37
|
+
children: childElements,
|
|
38
|
+
...restProps
|
|
39
|
+
} = element.props as ControlledElementProps;
|
|
30
40
|
|
|
31
41
|
if (name) {
|
|
32
42
|
return (
|
|
@@ -35,7 +45,9 @@ export function FormControlWrapper({ control, children, formActionProps }: FormC
|
|
|
35
45
|
control={control}
|
|
36
46
|
render={({ field, fieldState: { error } }) => {
|
|
37
47
|
const additionalProps =
|
|
38
|
-
element.type === 'input' && restProps.type === 'checkbox'
|
|
48
|
+
element.type === 'input' && restProps.type === 'checkbox'
|
|
49
|
+
? { checked: field.value }
|
|
50
|
+
: { value: field.value };
|
|
39
51
|
return React.cloneElement(element, {
|
|
40
52
|
...restProps,
|
|
41
53
|
...field,
|
|
@@ -50,7 +62,10 @@ export function FormControlWrapper({ control, children, formActionProps }: FormC
|
|
|
50
62
|
}
|
|
51
63
|
|
|
52
64
|
if (childElements) {
|
|
53
|
-
const wrappedChildren: ReactNode = React.Children.map(
|
|
65
|
+
const wrappedChildren: ReactNode = React.Children.map(
|
|
66
|
+
childElements as any,
|
|
67
|
+
wrapWithController,
|
|
68
|
+
);
|
|
54
69
|
return React.cloneElement(element, {
|
|
55
70
|
...restProps,
|
|
56
71
|
children: wrappedChildren,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Meta } from
|
|
3
|
-
import HelpButton from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
import HelpButton from './HelpButton';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
title:
|
|
6
|
+
title: 'Input/HelpButton',
|
|
7
7
|
component: HelpButton,
|
|
8
|
-
tags: [
|
|
8
|
+
tags: ['autodocs'],
|
|
9
9
|
argTypes: {
|
|
10
10
|
href: {
|
|
11
|
-
control:
|
|
12
|
-
description:
|
|
13
|
-
defaultValue:
|
|
11
|
+
control: 'text',
|
|
12
|
+
description: 'The URL the button links to',
|
|
13
|
+
defaultValue: 'https://example.com/help',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
} as Meta<typeof HelpButton>;
|
|
17
17
|
|
|
18
18
|
export const Default = (args: any) => <HelpButton {...args} />;
|
|
19
19
|
Default.args = {
|
|
20
|
-
href:
|
|
20
|
+
href: 'https://example.com/help',
|
|
21
21
|
};
|