@movalib/movalib-commons 1.0.3 → 1.0.5
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/MovaCopyright.d.ts +2 -0
- package/dist/MovaCopyright.js +19 -0
- package/dist/MovaLogin.d.ts +9 -0
- package/dist/MovaLogin.js +157 -0
- package/dist/MovaSnackbar.d.ts +15 -0
- package/dist/MovaSnackbar.js +39 -0
- package/dist/TestButton.d.ts +6 -0
- package/dist/TestButton.js +8 -0
- package/dist/helpers/Enums.d.ts +14 -0
- package/dist/helpers/Enums.js +18 -0
- package/dist/helpers/Tools.d.ts +1 -0
- package/dist/helpers/Tools.js +2 -0
- package/dist/helpers/Types.d.ts +9 -0
- package/dist/helpers/Types.js +2 -0
- package/dist/helpers/Validator.d.ts +3 -0
- package/dist/helpers/Validator.js +53 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +15 -0
- package/package.json +1 -1
- package/tsconfig.json +2 -2
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
var material_1 = require("@mui/material");
|
|
16
|
+
function MovaCopyright(props) {
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "body2", color: "text.secondary", align: "center" }, props, { children: ['Copyright © ', (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ color: "inherit", href: "https://www.movalib.com" }, { children: "Movalib.com" })), ' ', new Date().getFullYear(), '.'] })));
|
|
18
|
+
}
|
|
19
|
+
exports.default = MovaCopyright;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FunctionComponent } from "react";
|
|
2
|
+
import { MovaLoginForm } from "./helpers/Types";
|
|
3
|
+
import { MovaAppType } from "./helpers/Enums";
|
|
4
|
+
interface MovaLoginProps {
|
|
5
|
+
movaAppType: MovaAppType;
|
|
6
|
+
onSubmit: (form: MovaLoginForm) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const MovaLogin: FunctionComponent<MovaLoginProps>;
|
|
9
|
+
export default MovaLogin;
|
|
@@ -0,0 +1,157 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
|
+
var react_1 = require("react");
|
|
55
|
+
var lab_1 = require("@mui/lab");
|
|
56
|
+
var logo_large_png_1 = __importDefault(require("./assets/images/logo/logo_large.png"));
|
|
57
|
+
var logo_pro_large_png_1 = __importDefault(require("./assets/images/logo/logo_pro_large.png"));
|
|
58
|
+
var leaf_green_large_png_1 = __importDefault(require("./assets/images/logo/leaf_green_large.png"));
|
|
59
|
+
var leaf_pink_large_png_1 = __importDefault(require("./assets/images/logo/leaf_pink_large.png"));
|
|
60
|
+
var material_1 = require("@mui/material");
|
|
61
|
+
var MovaCopyright_1 = __importDefault(require("./MovaCopyright"));
|
|
62
|
+
var Enums_1 = require("./helpers/Enums");
|
|
63
|
+
var Validator_1 = require("./helpers/Validator");
|
|
64
|
+
// Permet de centrer le contenu de l'application
|
|
65
|
+
var styles = {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
justifyContent: 'center',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
height: '100vh', // Ajustez la hauteur en fonction de vos besoins
|
|
70
|
+
};
|
|
71
|
+
var initialFormState = {
|
|
72
|
+
email: { value: '', isValid: true },
|
|
73
|
+
password: { value: '', isValid: true },
|
|
74
|
+
};
|
|
75
|
+
var MovaLogin = function (_a) {
|
|
76
|
+
var movaAppType = _a.movaAppType, onSubmit = _a.onSubmit;
|
|
77
|
+
var _b = (0, react_1.useState)(initialFormState), form = _b[0], setForm = _b[1];
|
|
78
|
+
var _c = (0, react_1.useState)(""), message = _c[0], setMessage = _c[1];
|
|
79
|
+
var _d = (0, react_1.useState)(false), loading = _d[0], setLoading = _d[1];
|
|
80
|
+
var handleInputChange = function (e) {
|
|
81
|
+
var _a;
|
|
82
|
+
var fieldName = e.target.name;
|
|
83
|
+
var fieldValue = e.target.value;
|
|
84
|
+
var newField = (_a = {}, _a[fieldName] = { value: fieldValue, isValid: true }, _a);
|
|
85
|
+
setForm(__assign(__assign({}, form), newField));
|
|
86
|
+
};
|
|
87
|
+
var handleSubmit = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
setLoading(true);
|
|
91
|
+
try {
|
|
92
|
+
if (validateForm() && onSubmit) {
|
|
93
|
+
// Si le formulaire est valide, on appel la function callback transmise en props
|
|
94
|
+
onSubmit(form);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error('Error occurred during submission:', error);
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
setLoading(false);
|
|
102
|
+
}
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
});
|
|
105
|
+
}); };
|
|
106
|
+
var validateForm = function () {
|
|
107
|
+
var newForm = form;
|
|
108
|
+
// Validator email
|
|
109
|
+
if (!(0, Validator_1.validateEmail)(form.email.value.length)) {
|
|
110
|
+
var errorMsg = 'Adresse email invalide';
|
|
111
|
+
var newField = { value: form.email.value, error: errorMsg, isValid: false };
|
|
112
|
+
newForm = __assign(__assign({}, newForm), { email: newField });
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
var newField = { value: form.email.value, error: '', isValid: true };
|
|
116
|
+
newForm = __assign(__assign({}, newForm), { email: newField });
|
|
117
|
+
}
|
|
118
|
+
// Validator password
|
|
119
|
+
if (form.password.value.length < 8) {
|
|
120
|
+
var errorMsg = 'Votre mot de passe doit faire au moins 8 caractères de long.';
|
|
121
|
+
var newField = { value: form.password.value, error: errorMsg, isValid: false };
|
|
122
|
+
newForm = __assign(__assign({}, newForm), { password: newField });
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
var newField = { value: form.password.value, error: '', isValid: true };
|
|
126
|
+
newForm = __assign(__assign({}, newForm), { password: newField });
|
|
127
|
+
}
|
|
128
|
+
setForm(newForm);
|
|
129
|
+
return newForm.email.isValid && newForm.password.isValid;
|
|
130
|
+
};
|
|
131
|
+
var getMovaLogo = function () {
|
|
132
|
+
return movaAppType === Enums_1.MovaAppType.GARAGE ? logo_pro_large_png_1.default :
|
|
133
|
+
movaAppType === Enums_1.MovaAppType.USER ? logo_large_png_1.default :
|
|
134
|
+
movaAppType === Enums_1.MovaAppType.ADMIN ? logo_large_png_1.default : logo_large_png_1.default;
|
|
135
|
+
};
|
|
136
|
+
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',
|
|
137
|
+
float: 'left',
|
|
138
|
+
width: '250px',
|
|
139
|
+
height: '400px',
|
|
140
|
+
top: '-20%',
|
|
141
|
+
left: '3%',
|
|
142
|
+
opacity: '0.3',
|
|
143
|
+
zIndex: -8 }, alt: 'Feuille Verte Movalib' }), (0, jsx_runtime_1.jsxs)(material_1.Container, __assign({ component: "main", maxWidth: "xs" }, { children: [(0, jsx_runtime_1.jsx)(material_1.CssBaseline, {}), (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: {
|
|
144
|
+
marginTop: 6,
|
|
145
|
+
display: 'flex',
|
|
146
|
+
flexDirection: 'column',
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
} }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getMovaLogo(), style: { width: '80%' } }), (0, jsx_runtime_1.jsx)("br", {})] })), (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ component: "form", onSubmit: handleSubmit, noValidate: true, sx: { mt: 1 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", autoFocus: true, 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.TextField, { margin: "normal", required: true, fullWidth: true, name: "password", label: "Mot de passe", type: "password", id: "password", autoComplete: "current-password", onChange: function (e) { return handleInputChange(e); }, value: form.password.value, error: !form.password.isValid, helperText: form.password.error }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { value: "remember", color: "primary" }), label: "Se souvenir de moi" }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, __assign({ loading: loading, type: "submit", fullWidth: true, variant: "contained", sx: { mt: 3, mb: 2 } }, { children: (0, jsx_runtime_1.jsx)("span", { children: "Se connecter" }) })), message && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: "error", sx: { mb: 2 } }, { children: message })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ href: "#", variant: "body2", color: "text.secondary" }, { children: "Mot de passe oubli\u00E9 ?" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ href: "#", variant: "body2", color: "text.secondary" }, { children: "Créer un compte" })) }))] }))] })), (0, jsx_runtime_1.jsx)(MovaCopyright_1.default, { sx: { mt: 8, mb: 4 } })] })), (0, jsx_runtime_1.jsx)("img", { src: leaf_pink_large_png_1.default, style: { position: 'fixed',
|
|
149
|
+
float: 'right',
|
|
150
|
+
width: '250px',
|
|
151
|
+
height: '400px',
|
|
152
|
+
bottom: '-20%',
|
|
153
|
+
right: '3%',
|
|
154
|
+
opacity: '0.3',
|
|
155
|
+
zIndex: '-10' }, alt: 'Feuille Rose Movalib' })] })));
|
|
156
|
+
};
|
|
157
|
+
exports.default = MovaLogin;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
interface MovaSnackbarProps {
|
|
3
|
+
snackbar: {
|
|
4
|
+
open: boolean;
|
|
5
|
+
message: string;
|
|
6
|
+
severity: 'success' | 'info' | 'warning' | 'error' | undefined;
|
|
7
|
+
};
|
|
8
|
+
setSnackbar: (snackbar: {
|
|
9
|
+
open: boolean;
|
|
10
|
+
message: string;
|
|
11
|
+
severity: 'success' | 'info' | 'warning' | 'error' | undefined;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const MovaSnackbar: FunctionComponent<MovaSnackbarProps>;
|
|
15
|
+
export default MovaSnackbar;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
|
|
20
|
+
var MovaSnackbar = function (_a) {
|
|
21
|
+
var snackbar = _a.snackbar, setSnackbar = _a.setSnackbar;
|
|
22
|
+
/**
|
|
23
|
+
* Gestion de la fermeture de la snackbar. Si la raison de cette fermeture est
|
|
24
|
+
* un clic en dehors de la zone de contenu on intercepte et annule la fermeture 'clickaway'.
|
|
25
|
+
* @param event Evénnement de fermeture
|
|
26
|
+
* @param reason Origine de l'événnement de fermeture
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
var handleClose = function (event, reason) {
|
|
30
|
+
if (reason === 'clickaway')
|
|
31
|
+
return;
|
|
32
|
+
setSnackbar({ open: false, message: '', severity: undefined });
|
|
33
|
+
};
|
|
34
|
+
var handleCloseAlert = function (event) {
|
|
35
|
+
setSnackbar({ open: false, message: '', severity: undefined });
|
|
36
|
+
};
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Snackbar, __assign({ open: snackbar.open, autoHideDuration: 5000, onClose: handleClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: snackbar.severity, variant: "filled", sx: { width: '100%' }, action: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ size: "small", "aria-label": "close", color: "inherit", onClick: handleCloseAlert }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_1.default, { fontSize: "small" }) })) }) }, { children: snackbar.message })) })));
|
|
38
|
+
};
|
|
39
|
+
exports.default = MovaSnackbar;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
var TestButton = function (_a) {
|
|
5
|
+
var label = _a.label;
|
|
6
|
+
return (0, jsx_runtime_1.jsx)("button", { children: label });
|
|
7
|
+
};
|
|
8
|
+
exports.default = TestButton;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MovaAppType = void 0;
|
|
4
|
+
var MovaAppType;
|
|
5
|
+
(function (MovaAppType) {
|
|
6
|
+
/**
|
|
7
|
+
* Application Garagiste
|
|
8
|
+
*/
|
|
9
|
+
MovaAppType["GARAGE"] = "GARAGE";
|
|
10
|
+
/**
|
|
11
|
+
* Application Utilisateur (automobiliste)
|
|
12
|
+
*/
|
|
13
|
+
MovaAppType["USER"] = "USER";
|
|
14
|
+
/**
|
|
15
|
+
* Application Administrateur (MovaTeam)
|
|
16
|
+
*/
|
|
17
|
+
MovaAppType["ADMIN"] = "ADMIN";
|
|
18
|
+
})(MovaAppType = exports.MovaAppType || (exports.MovaAppType = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateEmail = exports.validateText = exports.validatePhoneNumber = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Un email valide
|
|
6
|
+
*/
|
|
7
|
+
var emailRegex = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
|
|
8
|
+
/**
|
|
9
|
+
* Un mot de passe qui contient au moins une majuscule, une minuscule, un chiffre
|
|
10
|
+
* et un caractère spécial. La longueur du mot de passe doit être d'au moins 8 caractères.
|
|
11
|
+
*/
|
|
12
|
+
var passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
|
|
13
|
+
/**
|
|
14
|
+
* Un numéro de téléphone (10 chiffres)
|
|
15
|
+
*/
|
|
16
|
+
var phoneNumberRegex = /^\d{0,10}$/;
|
|
17
|
+
/**
|
|
18
|
+
* Un code postal (5 chiffres)
|
|
19
|
+
*/
|
|
20
|
+
var postalCodeRegex = /^\d{5}$/;
|
|
21
|
+
/**
|
|
22
|
+
* Une URL valide
|
|
23
|
+
*/
|
|
24
|
+
var urlRegex = /^(ftp|http|https):\/\/[^ "]+$/;
|
|
25
|
+
/**
|
|
26
|
+
* Un nom pouvant contenir des lettres, chiffres d'une taille comprise entre 3 et 20 caractères
|
|
27
|
+
*/
|
|
28
|
+
var userNameRegex = /^[a-z0-9_-]{3,20}$/;
|
|
29
|
+
/**
|
|
30
|
+
* Un texte pouvant contenir des lettres, chiffres et quelques caractères spéciaux
|
|
31
|
+
*/
|
|
32
|
+
var textRegex = /^[a-zA-Z0-9\s.,!?'"()+=-_-éèçà]+$/;
|
|
33
|
+
function validatePhoneNumber(phoneNumber) {
|
|
34
|
+
if (phoneNumber === null || phoneNumber === undefined) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return phoneNumberRegex.test(phoneNumber);
|
|
38
|
+
}
|
|
39
|
+
exports.validatePhoneNumber = validatePhoneNumber;
|
|
40
|
+
function validateText(text) {
|
|
41
|
+
if (text === null || text === undefined) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return textRegex.test(text);
|
|
45
|
+
}
|
|
46
|
+
exports.validateText = validateText;
|
|
47
|
+
function validateEmail(email) {
|
|
48
|
+
if (email === null || email === undefined) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return emailRegex.test(email);
|
|
52
|
+
}
|
|
53
|
+
exports.validateEmail = validateEmail;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as TestButton } from './TestButton';
|
|
2
|
+
export { default as MovaSnackbar } from './MovaSnackbar';
|
|
3
|
+
export { default as MovaLogin } from './MovaLogin';
|
|
4
|
+
export { default as MovaCopyright } from './MovaCopyright';
|
|
5
|
+
export type { MovaFormField } from './helpers/Types';
|
|
6
|
+
export type { MovaLoginForm } from './helpers/Types';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/index.ts
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MovaCopyright = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = void 0;
|
|
8
|
+
var TestButton_1 = require("./TestButton");
|
|
9
|
+
Object.defineProperty(exports, "TestButton", { enumerable: true, get: function () { return __importDefault(TestButton_1).default; } });
|
|
10
|
+
var MovaSnackbar_1 = require("./MovaSnackbar");
|
|
11
|
+
Object.defineProperty(exports, "MovaSnackbar", { enumerable: true, get: function () { return __importDefault(MovaSnackbar_1).default; } });
|
|
12
|
+
var MovaLogin_1 = require("./MovaLogin");
|
|
13
|
+
Object.defineProperty(exports, "MovaLogin", { enumerable: true, get: function () { return __importDefault(MovaLogin_1).default; } });
|
|
14
|
+
var MovaCopyright_1 = require("./MovaCopyright");
|
|
15
|
+
Object.defineProperty(exports, "MovaCopyright", { enumerable: true, get: function () { return __importDefault(MovaCopyright_1).default; } });
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
30
30
|
|
|
31
31
|
/* Modules */
|
|
32
|
-
"module": "
|
|
32
|
+
"module": "CommonJS", /* Specify what module code is generated. */
|
|
33
33
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
34
34
|
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
35
35
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
62
62
|
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
|
63
63
|
// "removeComments": true, /* Disable emitting comments. */
|
|
64
|
-
"noEmit": true, /* Disable emitting files from a compilation. */
|
|
64
|
+
//"noEmit": true, /* Disable emitting files from a compilation. */
|
|
65
65
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
66
66
|
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
67
67
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|