@movalib/movalib-commons 1.0.52 → 1.0.54
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.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/src/MovaDialog.d.ts +16 -0
- package/dist/src/MovaDialog.js +59 -0
- package/dist/src/MovaLogin.js +1 -1
- package/index.ts +1 -0
- package/package.json +1 -1
- package/src/MovaDialog.tsx +106 -0
- package/src/MovaLogin.tsx +7 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,8 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.validateField = exports.VehicleTire = exports.Event = exports.Schedule = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = void 0;
|
|
7
|
+
exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.validateField = exports.VehicleTire = exports.Event = exports.Schedule = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = void 0;
|
|
8
8
|
// Export des composants
|
|
9
|
+
var MovaDialog_1 = require("./src/MovaDialog");
|
|
10
|
+
Object.defineProperty(exports, "MovaDialog", { enumerable: true, get: function () { return __importDefault(MovaDialog_1).default; } });
|
|
9
11
|
var QRCode_1 = require("./src/QRCode");
|
|
10
12
|
Object.defineProperty(exports, "QRCode", { enumerable: true, get: function () { return __importDefault(QRCode_1).default; } });
|
|
11
13
|
var VehiclePlateField_1 = require("./src/VehiclePlateField");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSProperties, FC } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface MovaDialogProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
fullScreen: boolean;
|
|
6
|
+
open: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
actions?: React.ReactNode;
|
|
9
|
+
message?: string;
|
|
10
|
+
transition?: "fade";
|
|
11
|
+
leafImageColor?: "green" | "yellow" | "pink";
|
|
12
|
+
title?: string;
|
|
13
|
+
titleStyle?: CSSProperties;
|
|
14
|
+
}
|
|
15
|
+
declare const MovaDialog: FC<MovaDialogProps>;
|
|
16
|
+
export default MovaDialog;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
var material_1 = require("@mui/material");
|
|
19
|
+
var ArrowBackIosNewRounded_1 = __importDefault(require("@mui/icons-material/ArrowBackIosNewRounded"));
|
|
20
|
+
var react_1 = __importDefault(require("react"));
|
|
21
|
+
var leaf_green_large_png_1 = __importDefault(require("../assets/images/leaf_green_large.png"));
|
|
22
|
+
var leaf_yellow_large_png_1 = __importDefault(require("../assets/images/leaf_yellow_large.png"));
|
|
23
|
+
var leaf_pink_large_png_1 = __importDefault(require("../assets/images/leaf_pink_large.png"));
|
|
24
|
+
var MovaDialog = function (_a) {
|
|
25
|
+
var fullScreen = _a.fullScreen, open = _a.open, onClose = _a.onClose, children = _a.children, title = _a.title, titleStyle = _a.titleStyle, message = _a.message, leafImageColor = _a.leafImageColor, transition = _a.transition, actions = _a.actions;
|
|
26
|
+
var getTransition = function () {
|
|
27
|
+
switch (transition) {
|
|
28
|
+
case "fade":
|
|
29
|
+
return react_1.default.forwardRef(function Transition(props, ref) {
|
|
30
|
+
return (0, jsx_runtime_1.jsx)(material_1.Fade, __assign({ ref: ref, timeout: 200 }, props));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var getLeafImage = function () {
|
|
35
|
+
switch (leafImageColor) {
|
|
36
|
+
case "green": return leaf_green_large_png_1.default;
|
|
37
|
+
case "yellow": return leaf_yellow_large_png_1.default;
|
|
38
|
+
case "pink": return leaf_pink_large_png_1.default;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var LeafImageComponent = getLeafImage();
|
|
42
|
+
var purgeLocalState = function () {
|
|
43
|
+
};
|
|
44
|
+
var handleOnClose = function () {
|
|
45
|
+
purgeLocalState();
|
|
46
|
+
onClose();
|
|
47
|
+
};
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, __assign({ fullScreen: fullScreen, fullWidth: true, TransitionComponent: getTransition(), open: open, "aria-labelledby": "garage-dialog-title", "aria-describedby": "garage-dialog-description", sx: { textAlign: 'center' } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getLeafImage(), style: {
|
|
49
|
+
position: 'fixed',
|
|
50
|
+
float: 'left',
|
|
51
|
+
width: '150px',
|
|
52
|
+
height: '350px',
|
|
53
|
+
top: '-20%',
|
|
54
|
+
zIndex: 0,
|
|
55
|
+
left: 0,
|
|
56
|
+
opacity: '0.2'
|
|
57
|
+
}, alt: 'Feuille Rose Movalib' }), (0, jsx_runtime_1.jsx)(material_1.DialogTitle, __assign({ id: "garage-dialog-title", sx: { textAlign: 'center', p: 0, pt: 1, mt: 0, mb: 0, zIndex: 10 } }, { children: (0, jsx_runtime_1.jsx)(material_1.AppBar, __assign({ sx: { position: 'relative' }, color: "transparent", elevation: 0 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Toolbar, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "start", color: "inherit", onClick: handleOnClose, "aria-label": "close" }, { children: (0, jsx_runtime_1.jsx)(ArrowBackIosNewRounded_1.default, {}) })), title && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { textAlign: 'center', fontSize: 20, flexGrow: 1, pl: '20px', pr: '40px' }, style: titleStyle }, { children: title }))] }) })) })), (0, jsx_runtime_1.jsxs)(material_1.DialogContent, __assign({ sx: { zIndex: 20 } }, { children: [children, message && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: "error", sx: { mb: 2 } }, { children: message }))] })), (0, jsx_runtime_1.jsx)(material_1.DialogActions, __assign({ sx: { justifyContent: 'center' } }, { children: actions }))] })));
|
|
58
|
+
};
|
|
59
|
+
exports.default = MovaDialog;
|
package/dist/src/MovaLogin.js
CHANGED
|
@@ -148,7 +148,7 @@ var MovaLogin = function (_a) {
|
|
|
148
148
|
*/
|
|
149
149
|
var dialogForgotPassword = function () {
|
|
150
150
|
var defaultMessage = "Êtes-vous sûr de vouloir continuer ?";
|
|
151
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, __assign({ open: openForgotPassword, onClose: function () { return setOpenForgotPassword(false); }, "aria-labelledby": "forgot-password-dialog-title", "aria-describedby": "forgot-password-dialog-description" }, { children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, __assign({ id: "forgot-password-title" }, { children: "R\u00E9cup\u00E9ration du mot de passe" })), (0, jsx_runtime_1.jsxs)(material_1.DialogContent, { children: [(0, jsx_runtime_1.jsx)(material_1.DialogContentText, __assign({ id: "forgot-password-dialog-description", sx: { mb: 2 } }, { children: "Saisissez votre email pour proc\u00E9der \u00E0 la r\u00E9initialisation de votre mot de passe." })), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email",
|
|
151
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, __assign({ open: openForgotPassword, onClose: function () { return setOpenForgotPassword(false); }, "aria-labelledby": "forgot-password-dialog-title", "aria-describedby": "forgot-password-dialog-description" }, { children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, __assign({ id: "forgot-password-title" }, { children: "R\u00E9cup\u00E9ration du mot de passe" })), (0, jsx_runtime_1.jsxs)(material_1.DialogContent, { children: [(0, jsx_runtime_1.jsx)(material_1.DialogContentText, __assign({ id: "forgot-password-dialog-description", sx: { mb: 2 } }, { children: "Saisissez votre email pour proc\u00E9der \u00E0 la r\u00E9initialisation de votre mot de passe." })), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", autoFocus: true, required: true, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", onChange: function (e) { return handleInputChange(e); }, value: form.email.value, error: !form.email.isValid, helperText: form.email.error })] }), (0, jsx_runtime_1.jsx)(material_1.DialogActions, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: function (e) { return handleSubmitForgotPassword(e); }, color: "primary", disabled: !(form.email.value && (0, Validator_1.validateEmail)(form.email.value)), sx: { ml: 1 } }, { children: "Envoyer ma demande" })) })] })));
|
|
152
152
|
};
|
|
153
153
|
return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: styles }, { children: [(0, jsx_runtime_1.jsx)("img", { src: leaf_green_large_png_1.default, style: { position: 'fixed',
|
|
154
154
|
float: 'left',
|
package/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
|
|
3
3
|
// Export des composants
|
|
4
|
+
export { default as MovaDialog } from './src/MovaDialog';
|
|
4
5
|
export { default as QRCode } from './src/QRCode';
|
|
5
6
|
export { default as VehiclePlateField } from './src/VehiclePlateField';
|
|
6
7
|
export { default as TestButton } from './src/TestButton';
|
package/package.json
CHANGED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Alert, AppBar, Dialog, DialogActions, DialogContent, DialogTitle, Fade, IconButton, Toolbar, Typography } from '@mui/material';
|
|
2
|
+
import type { CSSProperties, FC } from 'react';
|
|
3
|
+
import BackIcon from '@mui/icons-material/ArrowBackIosNewRounded';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { TransitionProps } from '@mui/material/transitions';
|
|
6
|
+
import GreenLeafImage from "../assets/images/leaf_green_large.png";
|
|
7
|
+
import YellowLeafImage from "../assets/images/leaf_yellow_large.png";
|
|
8
|
+
import PinkLeafImage from "../assets/images/leaf_pink_large.png";
|
|
9
|
+
|
|
10
|
+
interface MovaDialogProps {
|
|
11
|
+
children: React.ReactNode,
|
|
12
|
+
fullScreen: boolean,
|
|
13
|
+
open: boolean,
|
|
14
|
+
onClose: () => void,
|
|
15
|
+
actions?: React.ReactNode,
|
|
16
|
+
message?:string,
|
|
17
|
+
transition?: "fade",
|
|
18
|
+
leafImageColor?: "green" | "yellow" | "pink",
|
|
19
|
+
title?: string,
|
|
20
|
+
titleStyle?: CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const MovaDialog: FC<MovaDialogProps> = ({fullScreen, open, onClose, children, title, titleStyle, message, leafImageColor, transition, actions}) => {
|
|
24
|
+
|
|
25
|
+
const getTransition = () => {
|
|
26
|
+
switch(transition){
|
|
27
|
+
case "fade":
|
|
28
|
+
return React.forwardRef(function Transition(
|
|
29
|
+
props: TransitionProps & {
|
|
30
|
+
children: React.ReactElement;
|
|
31
|
+
},
|
|
32
|
+
ref: React.Ref<unknown>,
|
|
33
|
+
) {
|
|
34
|
+
return <Fade ref={ref} timeout={200} {...props} />;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const getLeafImage = () => {
|
|
40
|
+
switch(leafImageColor){
|
|
41
|
+
case "green" : return GreenLeafImage;
|
|
42
|
+
case "yellow" : return YellowLeafImage;
|
|
43
|
+
case "pink" : return PinkLeafImage;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const LeafImageComponent = getLeafImage();
|
|
48
|
+
|
|
49
|
+
const purgeLocalState = () => {
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const handleOnClose = () => {
|
|
54
|
+
purgeLocalState();
|
|
55
|
+
onClose();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Dialog
|
|
60
|
+
fullScreen={fullScreen}
|
|
61
|
+
fullWidth
|
|
62
|
+
TransitionComponent={getTransition()}
|
|
63
|
+
open={open}
|
|
64
|
+
aria-labelledby="garage-dialog-title"
|
|
65
|
+
aria-describedby="garage-dialog-description"
|
|
66
|
+
sx={{ textAlign:'center'}}
|
|
67
|
+
>
|
|
68
|
+
<img src={getLeafImage()} style={{
|
|
69
|
+
position: 'fixed',
|
|
70
|
+
float:'left',
|
|
71
|
+
width: '150px',
|
|
72
|
+
height: '350px',
|
|
73
|
+
top: '-20%',
|
|
74
|
+
zIndex: 0,
|
|
75
|
+
left: 0,
|
|
76
|
+
opacity: '0.2'}} alt='Feuille Rose Movalib'></img>
|
|
77
|
+
|
|
78
|
+
<DialogTitle id="garage-dialog-title" sx={{ textAlign:'center', p: 0, pt: 1, mt: 0, mb: 0, zIndex: 10 }} >
|
|
79
|
+
<AppBar sx={{ position: 'relative' }} color="transparent" elevation={0}>
|
|
80
|
+
<Toolbar>
|
|
81
|
+
<IconButton
|
|
82
|
+
edge="start"
|
|
83
|
+
color="inherit"
|
|
84
|
+
onClick={handleOnClose}
|
|
85
|
+
aria-label="close"
|
|
86
|
+
>
|
|
87
|
+
<BackIcon />
|
|
88
|
+
</IconButton>
|
|
89
|
+
{title && <Typography sx={{ textAlign:'center', fontSize: 20, flexGrow: 1, pl: '20px', pr: '40px' }} style={titleStyle}>
|
|
90
|
+
{title}
|
|
91
|
+
</Typography>}
|
|
92
|
+
</Toolbar>
|
|
93
|
+
</AppBar>
|
|
94
|
+
</DialogTitle>
|
|
95
|
+
<DialogContent sx={{ zIndex: 20}}>
|
|
96
|
+
{children}
|
|
97
|
+
{message && <Alert severity="error" sx={{ mb: 2 }}>{message}</Alert>}
|
|
98
|
+
</DialogContent>
|
|
99
|
+
<DialogActions sx={{ justifyContent:'center'}}>
|
|
100
|
+
{actions}
|
|
101
|
+
</DialogActions>
|
|
102
|
+
</Dialog>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default MovaDialog;
|
package/src/MovaLogin.tsx
CHANGED
|
@@ -147,23 +147,26 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
147
147
|
</DialogContentText>
|
|
148
148
|
<TextField
|
|
149
149
|
margin="normal"
|
|
150
|
+
autoFocus
|
|
150
151
|
required
|
|
151
152
|
fullWidth
|
|
152
153
|
id="email"
|
|
153
154
|
label="Adresse email"
|
|
154
155
|
name="email"
|
|
155
156
|
autoComplete="email"
|
|
156
|
-
autoFocus
|
|
157
157
|
onChange={e => handleInputChange(e)}
|
|
158
158
|
value={form.email.value}
|
|
159
159
|
error={!form.email.isValid}
|
|
160
160
|
helperText={form.email.error}
|
|
161
|
-
disabled={!(form.email.value && validateEmail(form.email.value))}
|
|
162
161
|
/>
|
|
163
162
|
</DialogContent>
|
|
164
163
|
<DialogActions>
|
|
165
|
-
<Button onClick={(e) => handleSubmitForgotPassword(e)}
|
|
166
|
-
|
|
164
|
+
<Button onClick={(e) => handleSubmitForgotPassword(e)}
|
|
165
|
+
color="primary"
|
|
166
|
+
disabled={!(form.email.value && validateEmail(form.email.value))}
|
|
167
|
+
sx={{ ml: 1}}>
|
|
168
|
+
|
|
169
|
+
Envoyer ma demande
|
|
167
170
|
</Button>
|
|
168
171
|
</DialogActions>
|
|
169
172
|
</Dialog>
|