use-password-policy 2.0.0 → 3.0.0
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/CHANGELOG.md +37 -0
- package/LICENSE +21 -0
- package/README.md +232 -135
- package/dist/core.d.mts +255 -0
- package/dist/core.d.ts +255 -0
- package/dist/core.js +468 -0
- package/dist/core.mjs +431 -0
- package/dist/index.d.mts +292 -9
- package/dist/index.d.ts +292 -9
- package/dist/index.js +635 -190
- package/dist/index.mjs +621 -188
- package/dist/styles.css +80 -0
- package/package.json +93 -27
package/dist/styles.css
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
:where(.rpp-root) {
|
|
2
|
+
--rpp-accent: #646cff;
|
|
3
|
+
--rpp-success: #1e8449;
|
|
4
|
+
--rpp-danger: #c0392b;
|
|
5
|
+
--rpp-weak: #d35400;
|
|
6
|
+
--rpp-medium: #b8860b;
|
|
7
|
+
--rpp-bg: #ffffff;
|
|
8
|
+
--rpp-border: #d0d0d0;
|
|
9
|
+
--rpp-text: #222222;
|
|
10
|
+
--rpp-muted: #6b6b6b;
|
|
11
|
+
--rpp-radius: 6px;
|
|
12
|
+
font-family: inherit;
|
|
13
|
+
color: var(--rpp-text);
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 0.75rem;
|
|
17
|
+
}
|
|
18
|
+
:where(.rpp-root) .rpp-field { position: relative; }
|
|
19
|
+
:where(.rpp-root) .rpp-input {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding: 0.75rem 2.75rem 0.75rem 0.75rem;
|
|
23
|
+
border: 1px solid var(--rpp-border);
|
|
24
|
+
border-radius: var(--rpp-radius);
|
|
25
|
+
background: var(--rpp-bg);
|
|
26
|
+
color: var(--rpp-text);
|
|
27
|
+
font: inherit;
|
|
28
|
+
font-size: 1rem;
|
|
29
|
+
}
|
|
30
|
+
:where(.rpp-root) .rpp-input:focus-visible {
|
|
31
|
+
outline: 2px solid var(--rpp-accent);
|
|
32
|
+
outline-offset: 1px;
|
|
33
|
+
border-color: var(--rpp-accent);
|
|
34
|
+
}
|
|
35
|
+
:where(.rpp-root) .rpp-toggle {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 50%;
|
|
38
|
+
right: 0.375rem;
|
|
39
|
+
transform: translateY(-50%);
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
padding: 0.375rem;
|
|
43
|
+
border: 0;
|
|
44
|
+
border-radius: var(--rpp-radius);
|
|
45
|
+
background: none;
|
|
46
|
+
color: var(--rpp-muted);
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
:where(.rpp-root) .rpp-toggle:focus-visible { outline: 2px solid var(--rpp-accent); }
|
|
50
|
+
:where(.rpp-root) .rpp-toggle:focus:not(:focus-visible) { outline: none; }
|
|
51
|
+
:where(.rpp-root) .rpp-meter { display: flex; gap: 0.25rem; height: 6px; }
|
|
52
|
+
:where(.rpp-root) .rpp-segment {
|
|
53
|
+
flex: 1;
|
|
54
|
+
border-radius: 3px;
|
|
55
|
+
background: var(--rpp-border);
|
|
56
|
+
transition: background-color 0.25s;
|
|
57
|
+
}
|
|
58
|
+
:where(.rpp-root[data-strength="very-weak"]) .rpp-segment[data-filled] { background: var(--rpp-danger); }
|
|
59
|
+
:where(.rpp-root[data-strength="weak"]) .rpp-segment[data-filled] { background: var(--rpp-weak); }
|
|
60
|
+
:where(.rpp-root[data-strength="medium"]) .rpp-segment[data-filled] { background: var(--rpp-medium); }
|
|
61
|
+
:where(.rpp-root[data-strength="strong"]) .rpp-segment[data-filled],
|
|
62
|
+
:where(.rpp-root[data-strength="very-strong"]) .rpp-segment[data-filled] { background: var(--rpp-success); }
|
|
63
|
+
:where(.rpp-root) .rpp-strength-label,
|
|
64
|
+
:where(.rpp-root) .rpp-feedback { margin: 0; font-size: 0.8125rem; color: var(--rpp-muted); }
|
|
65
|
+
:where(.rpp-root) .rpp-requirements {
|
|
66
|
+
list-style: none;
|
|
67
|
+
margin: 0;
|
|
68
|
+
padding: 0;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
gap: 0.375rem;
|
|
72
|
+
font-size: 0.875rem;
|
|
73
|
+
}
|
|
74
|
+
:where(.rpp-root) .rpp-requirement { display: flex; align-items: center; gap: 0.5rem; color: var(--rpp-danger); }
|
|
75
|
+
:where(.rpp-root) .rpp-requirement[data-passed] { color: var(--rpp-success); }
|
|
76
|
+
:where(.rpp-root) .rpp-icon { width: 1em; text-align: center; font-weight: 700; }
|
|
77
|
+
:where(.rpp-root) .rpp-sr-only {
|
|
78
|
+
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
|
|
79
|
+
overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
|
|
80
|
+
}
|
package/package.json
CHANGED
|
@@ -1,46 +1,112 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-password-policy",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "A simple, lightweight, and customizable React hook for real-time password strength validation.",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Password validation for React and Node: one policy for client and server, NIST presets, breached-password checks, zxcvbn support, Zod & react-hook-form helpers, and an accessible drop-in input.",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"author": "Rahul Patwa <rahul.y2j@gmail.com>",
|
|
8
7
|
"repository": {
|
|
9
8
|
"type": "git",
|
|
10
9
|
"url": "git+https://github.com/rahulpatwa1303/use-password-policy.git"
|
|
11
10
|
},
|
|
11
|
+
"homepage": "https://rahulpatwa1303.github.io/use-password-policy/",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/rahulpatwa1303/use-password-policy/issues"
|
|
14
|
+
},
|
|
12
15
|
"keywords": [
|
|
13
|
-
"react",
|
|
14
|
-
"
|
|
16
|
+
"react",
|
|
17
|
+
"react-hook",
|
|
18
|
+
"hook",
|
|
19
|
+
"password",
|
|
20
|
+
"password-policy",
|
|
21
|
+
"password-validation",
|
|
22
|
+
"password-strength",
|
|
23
|
+
"password-checker",
|
|
24
|
+
"nist",
|
|
25
|
+
"zxcvbn",
|
|
26
|
+
"haveibeenpwned",
|
|
27
|
+
"zod",
|
|
28
|
+
"react-hook-form",
|
|
29
|
+
"validation",
|
|
30
|
+
"form",
|
|
31
|
+
"typescript"
|
|
32
|
+
],
|
|
33
|
+
"type": "commonjs",
|
|
34
|
+
"main": "./dist/index.js",
|
|
35
|
+
"module": "./dist/index.mjs",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"import": {
|
|
40
|
+
"types": "./dist/index.d.mts",
|
|
41
|
+
"default": "./dist/index.mjs"
|
|
42
|
+
},
|
|
43
|
+
"require": {
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"default": "./dist/index.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"./core": {
|
|
49
|
+
"import": {
|
|
50
|
+
"types": "./dist/core.d.mts",
|
|
51
|
+
"default": "./dist/core.mjs"
|
|
52
|
+
},
|
|
53
|
+
"require": {
|
|
54
|
+
"types": "./dist/core.d.ts",
|
|
55
|
+
"default": "./dist/core.js"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"./styles.css": "./dist/styles.css",
|
|
59
|
+
"./package.json": "./package.json"
|
|
60
|
+
},
|
|
61
|
+
"typesVersions": {
|
|
62
|
+
"*": {
|
|
63
|
+
"core": [
|
|
64
|
+
"./dist/core.d.ts"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"sideEffects": [
|
|
69
|
+
"*.css"
|
|
70
|
+
],
|
|
71
|
+
"files": [
|
|
72
|
+
"dist",
|
|
73
|
+
"CHANGELOG.md"
|
|
15
74
|
],
|
|
16
|
-
"homepage": "https://rahulpatwa1303.github.io/use-password-policy/",
|
|
17
|
-
"bugs": { "url": "https://github.com/rahulpatwa1303/use-password-policy/issues" },
|
|
18
|
-
|
|
19
75
|
"workspaces": [
|
|
20
76
|
"demo"
|
|
21
77
|
],
|
|
22
|
-
|
|
23
|
-
"main": "dist/index.js",
|
|
24
|
-
"module": "dist/index.mjs",
|
|
25
|
-
"types": "dist/index.d.ts",
|
|
26
|
-
"files": [ "dist" ],
|
|
27
78
|
"scripts": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
79
|
+
"build": "rm -rf dist && tsup",
|
|
80
|
+
"dev": "tsup --watch",
|
|
81
|
+
"test": "vitest run",
|
|
82
|
+
"test:watch": "vitest",
|
|
83
|
+
"typecheck": "tsc -p tsconfig.test.json",
|
|
84
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
33
85
|
},
|
|
34
86
|
"peerDependencies": {
|
|
35
|
-
"react": ">=16.8.0"
|
|
36
|
-
|
|
87
|
+
"react": ">=16.8.0"
|
|
88
|
+
},
|
|
89
|
+
"peerDependenciesMeta": {
|
|
90
|
+
"react": {
|
|
91
|
+
"optional": true
|
|
92
|
+
}
|
|
37
93
|
},
|
|
38
94
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"react": "^
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
95
|
+
"@testing-library/dom": "^10.4.2",
|
|
96
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
97
|
+
"@testing-library/react": "^16.3.3",
|
|
98
|
+
"@testing-library/user-event": "^14.6.7",
|
|
99
|
+
"@types/react": "^18.3.31",
|
|
100
|
+
"@types/react-dom": "^18.3.7",
|
|
101
|
+
"@zxcvbn-ts/core": "^4.2.0",
|
|
102
|
+
"@zxcvbn-ts/language-common": "^4.1.3",
|
|
103
|
+
"@zxcvbn-ts/language-en": "^4.1.1",
|
|
104
|
+
"jsdom": "^30.1.1",
|
|
105
|
+
"react": "^18.3.1",
|
|
106
|
+
"react-dom": "^18.3.1",
|
|
107
|
+
"tsup": "^8.5.1",
|
|
108
|
+
"typescript": "~5.9",
|
|
109
|
+
"vitest": "^5.0.1",
|
|
110
|
+
"zod": "^4.6.5"
|
|
45
111
|
}
|
|
46
|
-
}
|
|
112
|
+
}
|