@movalib/movalib-commons 1.1.44 → 1.1.45

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/devIndex.tsx CHANGED
@@ -179,7 +179,9 @@ const App = () => {
179
179
  throw new Error('Function not implemented.');
180
180
  } } />
181
181
  <br /> <br />
182
- <IbanInput />
182
+ <IbanInput onIbanChange={function (iban: string): void {
183
+ throw new Error('Function not implemented.');
184
+ } } />
183
185
  </Box>
184
186
 
185
187
 
package/dist/devIndex.js CHANGED
@@ -153,7 +153,9 @@ var App = function () {
153
153
  }
154
154
  }, size: 'small', handleChange: function (fieldName, newValue, save) {
155
155
  throw new Error('Function not implemented.');
156
- } }), (0, jsx_runtime_1.jsx)("br", {}), " ", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(IbanInput_1.default, {})] }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: function () { return setOpenAccountValidation(!openAccountValidation); } }, { children: "Validation de compte" })) })), openAccountValidation && (0, jsx_runtime_1.jsx)(AccountValidation_1.default, { movaAppType: Enums_1.MovaAppType.GARAGE, onSubmit: function (success, message) {
156
+ } }), (0, jsx_runtime_1.jsx)("br", {}), " ", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(IbanInput_1.default, { onIbanChange: function (iban) {
157
+ throw new Error('Function not implemented.');
158
+ } })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: function () { return setOpenAccountValidation(!openAccountValidation); } }, { children: "Validation de compte" })) })), openAccountValidation && (0, jsx_runtime_1.jsx)(AccountValidation_1.default, { movaAppType: Enums_1.MovaAppType.GARAGE, onSubmit: function (success, message) {
157
159
  throw new Error('Function not implemented.');
158
160
  } })] })) })) }));
159
161
  };
@@ -1,3 +1,6 @@
1
1
  import React from 'react';
2
- declare const IbanInput: React.FC;
2
+ interface IbanInputProps {
3
+ onIbanChange: (iban: string) => void;
4
+ }
5
+ declare const IbanInput: React.FC<IbanInputProps>;
3
6
  export default IbanInput;
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var jsx_runtime_1 = require("react/jsx-runtime");
7
7
  var react_1 = require("react");
8
8
  var TextField_1 = __importDefault(require("@mui/material/TextField"));
9
- var IbanInput = function () {
10
- var _a = (0, react_1.useState)(''), iban = _a[0], setIban = _a[1];
11
- var _b = (0, react_1.useState)(null), error = _b[0], setError = _b[1];
9
+ var IbanInput = function (_a) {
10
+ var onIbanChange = _a.onIbanChange;
11
+ var _b = (0, react_1.useState)(''), iban = _b[0], setIban = _b[1];
12
+ var _c = (0, react_1.useState)(null), error = _c[0], setError = _c[1];
12
13
  var formatIban = function (value) {
13
14
  // Supprime les espaces et convertit en majuscules avant d'ajouter des espaces tous les 4 caractères
14
15
  return value.replace(/\s/g, '').toUpperCase().replace(/(.{4})/g, '$1 ').trim();
@@ -25,6 +26,7 @@ var IbanInput = function () {
25
26
  // Validation de l'IBAN après le formatage
26
27
  if (validateIban(formattedIban) || formattedIban.length === 0) {
27
28
  setError(null); // Aucune erreur si l'IBAN est valide
29
+ onIbanChange(formattedIban.replace(/\s+/g, '')); // Utilisez le callback ici
28
30
  }
29
31
  else {
30
32
  setError("Format de l'IBAN invalide"); // Message d'erreur pour un IBAN invalide
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.1.44",
3
+ "version": "1.1.45",
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",
package/src/IbanInput.tsx CHANGED
@@ -1,7 +1,11 @@
1
1
  import React, { useState } from 'react';
2
2
  import TextField from '@mui/material/TextField';
3
3
 
4
- const IbanInput: React.FC = () => {
4
+ interface IbanInputProps {
5
+ onIbanChange: (iban: string) => void; // Ajout d'une prop pour le callback
6
+ }
7
+
8
+ const IbanInput: React.FC<IbanInputProps> = ({ onIbanChange }) => {
5
9
  const [iban, setIban] = useState('');
6
10
  const [error, setError] = useState<string | null>(null);
7
11
 
@@ -24,6 +28,7 @@ const IbanInput: React.FC = () => {
24
28
  // Validation de l'IBAN après le formatage
25
29
  if (validateIban(formattedIban) || formattedIban.length === 0) {
26
30
  setError(null); // Aucune erreur si l'IBAN est valide
31
+ onIbanChange(formattedIban.replace(/\s+/g, '')); // Utilisez le callback ici
27
32
  } else {
28
33
  setError("Format de l'IBAN invalide"); // Message d'erreur pour un IBAN invalide
29
34
  }