react-french-ssn 1.4.0 → 1.4.1
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/README.md +53 -0
- package/dist/components/SocialSecurityInput/index.d.ts +1 -0
- package/dist/components/SocialSecurityInput/useSocialSecurityInput.d.ts +2 -17
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -0
- package/dist/types/index.d.ts +51 -0
- package/package.json +3 -1
package/README.md
CHANGED
@@ -298,9 +298,62 @@ const props: SocialSecurityInputProps = {
|
|
298
298
|
|
299
299
|
MIT © JatoCool Company
|
300
300
|
|
301
|
+
## 🎮 Testez le composant interactivement
|
302
|
+
|
303
|
+
### 🚀 Démo en ligne
|
304
|
+
|
305
|
+
**🎮 [Testez le composant directement dans votre navigateur](https://johanna1506.github.io/ui/demo.html)**
|
306
|
+
|
307
|
+
Cette démo interactive vous permet de :
|
308
|
+
- ✅ Tester le formatage automatique en temps réel
|
309
|
+
- ✅ Voir la validation et les messages d'erreur
|
310
|
+
- ✅ Comprendre la structure du numéro de sécurité sociale
|
311
|
+
- ✅ Essayer différents exemples de numéros
|
312
|
+
|
313
|
+
### 📦 Démo CodeSandbox
|
314
|
+
|
315
|
+
[](https://codesandbox.io/s/react-french-ssn-demo-4xq8k?fontsize=14&hidenavigation=1&theme=dark)
|
316
|
+
|
317
|
+
**Cliquez sur le bouton ci-dessus pour tester le composant dans CodeSandbox !**
|
318
|
+
|
319
|
+
### 🎯 Fonctionnalités à tester
|
320
|
+
|
321
|
+
- ✅ **Formatage automatique** - Tapez `269054958815780` pour voir le découpage
|
322
|
+
- ✅ **Validation en temps réel** - Essayez des numéros invalides
|
323
|
+
- ✅ **Bouton de copie** - Copiez le numéro formaté
|
324
|
+
- ✅ **Accessibilité** - Testez avec le clavier et lecteurs d'écran
|
325
|
+
- ✅ **Mode sombre** - Détection automatique du thème
|
326
|
+
|
327
|
+
### 🏠 Démo locale avec Storybook
|
328
|
+
|
329
|
+
```bash
|
330
|
+
# Cloner le repository
|
331
|
+
git clone https://github.com/Johanna1506/ui.git
|
332
|
+
cd ui
|
333
|
+
|
334
|
+
# Installer les dépendances
|
335
|
+
npm install
|
336
|
+
|
337
|
+
# Lancer Storybook
|
338
|
+
npm run storybook
|
339
|
+
```
|
340
|
+
|
341
|
+
Puis ouvrez [http://localhost:6006](http://localhost:6006) dans votre navigateur.
|
342
|
+
|
343
|
+
### 📚 Stories disponibles
|
344
|
+
|
345
|
+
- **Interactive** - Composant entièrement interactif pour tester toutes les fonctionnalités
|
346
|
+
- **Default** - Version basique du composant
|
347
|
+
- **WithLabel** - Avec label personnalisé
|
348
|
+
- **WithError** - Avec gestion d'erreur
|
349
|
+
- **Disabled** - État désactivé
|
350
|
+
- **WithCopyButton** - Avec bouton de copie
|
351
|
+
- **WithCustomTexts** - Textes personnalisés
|
352
|
+
|
301
353
|
## 🔗 Links
|
302
354
|
|
303
355
|
- [NPM Package](https://www.npmjs.com/package/react-french-ssn)
|
356
|
+
- [GitHub Repository](https://github.com/Johanna1506/ui)
|
304
357
|
|
305
358
|
---
|
306
359
|
|
@@ -1,19 +1,4 @@
|
|
1
|
-
|
2
|
-
onChange?: (value: string) => void;
|
3
|
-
placeholder?: string;
|
4
|
-
value?: string;
|
5
|
-
fieldsetId?: string;
|
6
|
-
}
|
7
|
-
interface SocialSecurityState {
|
8
|
-
sex: string;
|
9
|
-
year: string;
|
10
|
-
month: string;
|
11
|
-
department: string;
|
12
|
-
insee: string;
|
13
|
-
order: string;
|
14
|
-
controlKey: string;
|
15
|
-
error: string;
|
16
|
-
}
|
1
|
+
import type { UseSocialSecurityInputProps, SocialSecurityState } from '../../types';
|
17
2
|
export declare const useSocialSecurityInput: ({ onChange, placeholder, value, fieldsetId }: UseSocialSecurityInputProps) => {
|
18
3
|
values: SocialSecurityState;
|
19
4
|
handlers: {
|
@@ -53,4 +38,4 @@ export declare const useSocialSecurityInput: ({ onChange, placeholder, value, fi
|
|
53
38
|
controlKey: string;
|
54
39
|
};
|
55
40
|
};
|
56
|
-
export
|
41
|
+
export default useSocialSecurityInput;
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
export { default as SocialSecurityInput } from './components/SocialSecurityInput';
|
2
|
+
export { useSocialSecurityInput } from './components/SocialSecurityInput';
|
2
3
|
export { ThemeProvider } from './components/ThemeProvider';
|
3
4
|
export { getCSSVariable, createCSSVariables } from './utils/cssVariables';
|
4
5
|
export { setGlobalConfig, getGlobalConfig, resetGlobalConfig, defaultConfig } from './config';
|
5
|
-
export type { SocialSecurityInputProps } from './types';
|
6
|
+
export type { SocialSecurityInputProps, UseSocialSecurityInputProps, SocialSecurityState, SocialSecurityHandlers, SocialSecurityPlaceholders } from './types';
|
6
7
|
export type { GlobalConfig, ThemeConfig, ComponentConfig } from './config';
|
package/dist/index.esm.js
CHANGED
@@ -523,4 +523,4 @@ const ThemeProvider = ({ children, theme }) => {
|
|
523
523
|
return jsx(Fragment, { children: children });
|
524
524
|
};
|
525
525
|
|
526
|
-
export { SocialSecurityInput, ThemeProvider, createCSSVariables, defaultConfig, getCSSVariable, getGlobalConfig, resetGlobalConfig, setGlobalConfig };
|
526
|
+
export { SocialSecurityInput, ThemeProvider, createCSSVariables, defaultConfig, getCSSVariable, getGlobalConfig, resetGlobalConfig, setGlobalConfig, useSocialSecurityInput };
|
package/dist/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
@@ -63,3 +63,54 @@ export interface SocialSecurityInputProps {
|
|
63
63
|
};
|
64
64
|
};
|
65
65
|
}
|
66
|
+
export interface UseSocialSecurityInputProps {
|
67
|
+
onChange?: (value: string) => void;
|
68
|
+
placeholder?: string;
|
69
|
+
value?: string;
|
70
|
+
fieldsetId?: string;
|
71
|
+
}
|
72
|
+
export interface SocialSecurityState {
|
73
|
+
sex: string;
|
74
|
+
year: string;
|
75
|
+
month: string;
|
76
|
+
department: string;
|
77
|
+
insee: string;
|
78
|
+
order: string;
|
79
|
+
controlKey: string;
|
80
|
+
error: string;
|
81
|
+
}
|
82
|
+
export interface SocialSecurityHandlers {
|
83
|
+
sex: {
|
84
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
85
|
+
onPaste: (e: React.ClipboardEvent<HTMLInputElement>) => void;
|
86
|
+
};
|
87
|
+
year: {
|
88
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
89
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
90
|
+
};
|
91
|
+
month: {
|
92
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
93
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
94
|
+
};
|
95
|
+
department: {
|
96
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
97
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
98
|
+
};
|
99
|
+
insee: {
|
100
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
101
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
102
|
+
};
|
103
|
+
order: {
|
104
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
105
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
106
|
+
};
|
107
|
+
}
|
108
|
+
export interface SocialSecurityPlaceholders {
|
109
|
+
sex: string;
|
110
|
+
year: string;
|
111
|
+
month: string;
|
112
|
+
department: string;
|
113
|
+
insee: string;
|
114
|
+
order: string;
|
115
|
+
controlKey: string;
|
116
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-french-ssn",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.1",
|
4
4
|
"description": "React component for French Social Security Numbers (NIR) with automatic formatting and validation",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/index.js",
|
@@ -24,6 +24,7 @@
|
|
24
24
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx}\"",
|
25
25
|
"storybook": "storybook dev -p 6006",
|
26
26
|
"build-storybook": "storybook build",
|
27
|
+
"deploy-storybook": "storybook build && gh-pages -d storybook-static",
|
27
28
|
"prepublishOnly": "npm run build",
|
28
29
|
"release": "semantic-release"
|
29
30
|
},
|
@@ -76,6 +77,7 @@
|
|
76
77
|
"eslint": "^8.53.0",
|
77
78
|
"eslint-plugin-react": "^7.33.2",
|
78
79
|
"eslint-plugin-react-hooks": "^4.6.0",
|
80
|
+
"gh-pages": "^6.3.0",
|
79
81
|
"identity-obj-proxy": "^3.0.0",
|
80
82
|
"jest": "^29.7.0",
|
81
83
|
"jest-environment-jsdom": "^29.7.0",
|