@rsuci/shared-form-components 1.0.91 → 1.0.92

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.
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Formats acceptés :
6
6
  * - Nouveau format : CI00xxxxxxx (CI00 + 7 chiffres) = 11 caractères
7
- * - Ancien format : C 00XX XXXXXX (C + espace + 00 + 2 alphanum + espace + 6 alphanum) = 14 caractères
7
+ * - Ancien format : C 00XX XXXXXX (C + espace + 00 + 2 chiffres + espace + 6 chiffres) = 13 caractères
8
8
  */
9
9
  import React from 'react';
10
10
  import { VariableFormulaire, VariableValue } from '../../types/enquete';
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Formats acceptés :
6
6
  * - Nouveau format : CI00xxxxxxx (CI00 + 7 chiffres) = 11 caractères
7
- * - Ancien format : C 00XX XXXXXX (C + espace + 00 + 2 alphanum + espace + 6 alphanum) = 14 caractères
7
+ * - Ancien format : C 00XX XXXXXX (C + espace + 00 + 2 chiffres + espace + 6 chiffres) = 13 caractères
8
8
  */
9
9
  'use client';
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -12,7 +12,7 @@ import { useState, useCallback } from 'react';
12
12
  import { applyComponentStyle } from '../../utils/styleUtils';
13
13
  import { isComponentReadonly, readonlyClasses } from '../../utils/componentStateUtils';
14
14
  const CNI_NEW_REGEX = /^CI00\d{7}$/;
15
- const CNI_OLD_REGEX = /^C 00[A-Z0-9]{2} [A-Z0-9]{6}$/;
15
+ const CNI_OLD_REGEX = /^C 00\d{2} \d{6}$/;
16
16
  const applyNewFormatMask = (value) => {
17
17
  let result = value.toUpperCase();
18
18
  result = result.replace(/[^CI0-9]/g, '');
@@ -53,18 +53,18 @@ const applyOldFormatMask = (value) => {
53
53
  chars.push(char);
54
54
  }
55
55
  else if (pos === 4 || pos === 5) {
56
- if (/[A-Z0-9]/.test(char))
56
+ if (/[0-9]/.test(char))
57
57
  chars.push(char);
58
58
  }
59
59
  else if (pos === 6) {
60
60
  chars.push(' ');
61
- if (/[A-Z0-9]/.test(char))
61
+ if (/[0-9]/.test(char))
62
62
  chars.push(char);
63
63
  else
64
64
  i--;
65
65
  }
66
66
  else if (pos >= 7 && pos <= 13) {
67
- if (/[A-Z0-9]/.test(char))
67
+ if (/[0-9]/.test(char))
68
68
  chars.push(char);
69
69
  }
70
70
  }
@@ -130,7 +130,7 @@ const CNIInput = ({ variable, value, onChange, onBlur, error, disabled, isConsul
130
130
  setLocalError('Format attendu : CI00 suivi de 7 chiffres (ex: CI001234567)');
131
131
  }
132
132
  else if (format === 'old') {
133
- setLocalError('Format attendu : C 00XX XXXXXX (ex: C 00AB 123456)');
133
+ setLocalError('Format attendu : C 00XX XXXXXX (ex: C 0012 345678)');
134
134
  }
135
135
  else {
136
136
  setLocalError('Format CNI invalide');
@@ -152,7 +152,7 @@ const CNIInput = ({ variable, value, onChange, onBlur, error, disabled, isConsul
152
152
  return `${baseClasses} ${errorClasses} bg-white`;
153
153
  };
154
154
  const displayError = error || localError;
155
- const placeholder = 'CI001234567 ou C 00AB 123456';
155
+ const placeholder = 'CI001234567 ou C 0012 345678';
156
156
  return (_jsxs("div", { style: containerStyle, children: [_jsx("input", { type: "text", value: stringValue, onChange: handleChange, onBlur: handleBlur, placeholder: disabled ? '' : placeholder, disabled: disabled, readOnly: isReadonly, style: textStyle, className: getInputClasses(), maxLength: 14, autoComplete: "off", spellCheck: false }), displayError && (_jsx("p", { className: "mt-1 text-sm text-red-500", children: displayError }))] }));
157
157
  };
158
158
  export default CNIInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsuci/shared-form-components",
3
- "version": "1.0.91",
3
+ "version": "1.0.92",
4
4
  "description": "Composants partagés de rendu de formulaires RSU v2 - Package local pour frontend Admin et Public",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",