@movalib/movalib-commons 1.2.17 → 1.2.19

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.
@@ -5,6 +5,7 @@ declare const DialogForgotPassword: React.FC<{
5
5
  setOpenForgotPassword: React.Dispatch<React.SetStateAction<boolean>>;
6
6
  movaAppType: MovaAppType;
7
7
  form: any;
8
+ onClose?: () => void;
8
9
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
9
10
  handleSubmitForgotPassword: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
10
11
  }>;
@@ -17,9 +17,14 @@ var material_1 = require("@mui/material");
17
17
  var Enums_1 = require("./helpers/Enums");
18
18
  var Validator_1 = require("./helpers/Validator");
19
19
  var DialogForgotPassword = function (_a) {
20
- var openForgotPassword = _a.openForgotPassword, setOpenForgotPassword = _a.setOpenForgotPassword, movaAppType = _a.movaAppType, form = _a.form, handleInputChange = _a.handleInputChange, handleSubmitForgotPassword = _a.handleSubmitForgotPassword;
20
+ var openForgotPassword = _a.openForgotPassword, setOpenForgotPassword = _a.setOpenForgotPassword, movaAppType = _a.movaAppType, form = _a.form, handleInputChange = _a.handleInputChange, handleSubmitForgotPassword = _a.handleSubmitForgotPassword, onClose = _a.onClose;
21
21
  var defaultMessage = (0, react_1.useState)("Êtes-vous sûr de vouloir continuer ?")[0];
22
- 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: movaAppType === Enums_1.MovaAppType.GARAGE ?
22
+ var handleOnClose = function () {
23
+ setOpenForgotPassword(false);
24
+ if (onClose)
25
+ onClose();
26
+ };
27
+ return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, __assign({ open: openForgotPassword, onClose: handleOnClose, "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: movaAppType === Enums_1.MovaAppType.GARAGE ?
23
28
  "Saisissez votre email pour procéder à la réinitialisation de votre mot de passe."
24
29
  :
25
30
  "Saisissez votre n° de téléphone ou votre email pour procéder à la réinitialisation de votre mot de passe." })), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", autoFocus: true, required: true, fullWidth: true, id: movaAppType === Enums_1.MovaAppType.GARAGE ? "email" : "phoneNumberEmail", label: movaAppType === Enums_1.MovaAppType.GARAGE ? "Adresse email" : "N° de téléphone ou adresse email", name: movaAppType === Enums_1.MovaAppType.GARAGE ? "email" : "phoneNumberEmail", autoComplete: "email", onChange: function (e) { return handleInputChange(e); }, value: movaAppType === Enums_1.MovaAppType.GARAGE ? form.email.value : form.phoneNumberEmail.value, error: movaAppType === Enums_1.MovaAppType.GARAGE ? !form.email.isValid : !form.phoneNumberEmail.isValid, helperText: movaAppType === Enums_1.MovaAppType.GARAGE ? form.email.error : form.phoneNumberEmail.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: movaAppType === Enums_1.MovaAppType.GARAGE ? !(form.email.value && (0, Validator_1.validateEmail)(form.email.value))
@@ -60,6 +60,6 @@ var MovaDialog = function (_a) {
60
60
  zIndex: 0,
61
61
  left: 0,
62
62
  opacity: '0.2'
63
- }, alt: 'Feuille Movalib' }), title && (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: [closable && (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "start", color: "inherit", onClick: handleOnBack, "aria-label": "close" }, { children: (0, jsx_runtime_1.jsx)(ArrowBackIosNewRounded_1.default, {}) })), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { textAlign: 'center', fontSize: 20, flexGrow: 1, pl: closable ? '20px' : 'Opx', pr: closable ? '40px' : '0px' }, 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 }))] })));
63
+ }, alt: 'Feuille Movalib' }), title && (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: [closable && (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "start", color: "inherit", onClick: handleOnBack, "aria-label": "close" }, { children: (0, jsx_runtime_1.jsx)(ArrowBackIosNewRounded_1.default, {}) })), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { textAlign: 'center', fontSize: 20, flexGrow: 1, pl: closable ? '20px' : 'Opx', pr: closable ? '40px' : '0px' }, 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 }))] })), actions && (0, jsx_runtime_1.jsx)(material_1.DialogActions, __assign({ sx: { justifyContent: 'center' } }, { children: actions }))] })));
64
64
  };
65
65
  exports.default = MovaDialog;
@@ -29,5 +29,5 @@ interface MovaSignUpProps {
29
29
  * Formulaire de création d'un compte Movalib (Garage / Utilisateur)
30
30
  * ATTENTION : le lien de consultation des CGU doit pointer vers "/terms-and-conditions"
31
31
  */
32
- declare const MovaLogin: FunctionComponent<MovaSignUpProps>;
33
- export default MovaLogin;
32
+ declare const MovaSignUp: FunctionComponent<MovaSignUpProps>;
33
+ export default MovaSignUp;
@@ -91,7 +91,7 @@ var initialUserFormState = {
91
91
  * Formulaire de création d'un compte Movalib (Garage / Utilisateur)
92
92
  * ATTENTION : le lien de consultation des CGU doit pointer vers "/terms-and-conditions"
93
93
  */
94
- var MovaLogin = function (_a) {
94
+ var MovaSignUp = function (_a) {
95
95
  var loading = _a.loading, movaAppType = _a.movaAppType, onSubmit = _a.onSubmit, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b, alertMessage = _a.alertMessage, alertSeverity = _a.alertSeverity, headerText = _a.headerText, _c = _a.showHeaderLogo, showHeaderLogo = _c === void 0 ? true : _c, _d = _a.showLeafs, showLeafs = _d === void 0 ? true : _d, _e = _a.showCopyright, showCopyright = _e === void 0 ? true : _e, _f = _a.showLoginButton, showLoginButton = _f === void 0 ? true : _f, _g = _a.disableGutters, disableGutters = _g === void 0 ? false : _g, _h = _a.usePhoneNumber, usePhoneNumber = _h === void 0 ? true : _h;
96
96
  var _j = (0, react_1.useState)(initialUserFormState), userForm = _j[0], setUserForm = _j[1];
97
97
  var history = (0, react_router_dom_1.useHistory)();
@@ -252,4 +252,4 @@ var MovaLogin = function (_a) {
252
252
  opacity: '0.3',
253
253
  zIndex: '-10' }, alt: 'Feuille Rose Movalib' })] })));
254
254
  };
255
- exports.default = MovaLogin;
255
+ exports.default = MovaSignUp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,16 +8,23 @@ const DialogForgotPassword: React.FC<{
8
8
  setOpenForgotPassword: React.Dispatch<React.SetStateAction<boolean>>; // Ajout de setOpenForgotPassword
9
9
  movaAppType: MovaAppType;
10
10
  form: any;
11
+ onClose?: () => void;
11
12
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
12
13
  handleSubmitForgotPassword: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
13
- }> = ({ openForgotPassword, setOpenForgotPassword, movaAppType, form, handleInputChange, handleSubmitForgotPassword }) => {
14
+ }> = ({ openForgotPassword, setOpenForgotPassword, movaAppType, form, handleInputChange, handleSubmitForgotPassword, onClose }) => {
14
15
 
15
16
  const [defaultMessage] = useState("Êtes-vous sûr de vouloir continuer ?");
16
17
 
18
+ const handleOnClose = () => {
19
+ setOpenForgotPassword(false)
20
+ if(onClose)
21
+ onClose();
22
+ }
23
+
17
24
  return (
18
25
  <Dialog
19
26
  open={openForgotPassword}
20
- onClose={() => setOpenForgotPassword(false)}
27
+ onClose={handleOnClose}
21
28
  aria-labelledby="forgot-password-dialog-title"
22
29
  aria-describedby="forgot-password-dialog-description"
23
30
  >
@@ -110,9 +110,9 @@ const MovaDialog: FC<MovaDialogProps> = ({fullScreen, open, onClose, closable =
110
110
  {children}
111
111
  {message && <Alert severity="error" sx={{ mb: 2 }}>{message}</Alert>}
112
112
  </DialogContent>
113
- <DialogActions sx={{ justifyContent:'center'}}>
113
+ {actions && <DialogActions sx={{ justifyContent:'center'}}>
114
114
  {actions}
115
- </DialogActions>
115
+ </DialogActions>}
116
116
  </Dialog>
117
117
  );
118
118
  }
@@ -72,7 +72,7 @@ interface MovaSignUpProps {
72
72
  * Formulaire de création d'un compte Movalib (Garage / Utilisateur)
73
73
  * ATTENTION : le lien de consultation des CGU doit pointer vers "/terms-and-conditions"
74
74
  */
75
- const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, onSubmit, darkMode = false, alertMessage, alertSeverity, headerText,
75
+ const MovaSignUp: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, onSubmit, darkMode = false, alertMessage, alertSeverity, headerText,
76
76
  showHeaderLogo = true, showLeafs= true, showCopyright = true, showLoginButton = true, disableGutters = false, usePhoneNumber = true}) => {
77
77
 
78
78
  const [userForm, setUserForm] = useState<MovaUserSignUpForm>(initialUserFormState);
@@ -458,4 +458,4 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
458
458
  );
459
459
  };
460
460
 
461
- export default MovaLogin;
461
+ export default MovaSignUp;