@shafnas/react-password-validator 1.0.5 → 1.0.7

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 CHANGED
@@ -24,13 +24,13 @@ A reusable **React password validator component** with **Tailwind CSS** and **Lu
24
24
  ## Installation
25
25
 
26
26
  ```bash
27
- npm install react-password-validator lucide-react
27
+ npm install @shafnas/react-password-validator lucide-react
28
28
  ```
29
29
 
30
30
  or
31
31
 
32
32
  ```bash
33
- yarn add react-password-validator lucide-react
33
+ yarn add @shafnas/react-password-validator lucide-react
34
34
  ```
35
35
 
36
36
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shafnas/react-password-validator",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "A reusable React password validator component with Tailwind and Lucide icons",
5
5
  "author": "Your Name",
6
6
  "license": "MIT",
@@ -28,13 +28,15 @@
28
28
  "devDependencies": {
29
29
  "@eslint/js": "^9.39.1",
30
30
  "@types/node": "^24.10.1",
31
- "@types/react": "^19.2.7",
32
- "@types/react-dom": "^19.2.3",
31
+ "@types/react": "^18.3.28",
32
+ "@types/react-dom": "^18.3.7",
33
33
  "@vitejs/plugin-react": "^5.1.1",
34
34
  "eslint": "^9.39.1",
35
35
  "eslint-plugin-react-hooks": "^7.0.1",
36
36
  "eslint-plugin-react-refresh": "^0.4.24",
37
37
  "globals": "^16.5.0",
38
+ "react": "^18.3.1",
39
+ "react-dom": "^18.3.1",
38
40
  "typescript": "~5.9.3",
39
41
  "vite": "^7.3.1"
40
42
  },
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- interface Props {
3
- password: string;
4
- confirmPassword?: string;
5
- className?: string;
6
- itemClassName?: string;
7
- strengthBarClassName?: string;
8
- }
9
- export declare const PasswordValidator: React.FC<Props>;
10
- export {};
@@ -1,2 +0,0 @@
1
- import { type PasswordValidationResult } from "../utils/passwordRules";
2
- export declare const usePasswordValidation: (password: string) => PasswordValidationResult;
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { PasswordValidator } from "./components/PasswordValidator";
2
- export { usePasswordValidation } from "./hooks/usePasswordValidation";
3
- export { validatePassword } from "./utils/passwordRules";
@@ -1,334 +0,0 @@
1
- import re, { useMemo as te } from "react";
2
- import { Check as ne, X as ae } from "lucide-react";
3
- var x = { exports: {} }, _ = {};
4
- var F;
5
- function oe() {
6
- if (F) return _;
7
- F = 1;
8
- var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), n = /* @__PURE__ */ Symbol.for("react.fragment");
9
- function o(f, s, u) {
10
- var m = null;
11
- if (u !== void 0 && (m = "" + u), s.key !== void 0 && (m = "" + s.key), "key" in s) {
12
- u = {};
13
- for (var b in s)
14
- b !== "key" && (u[b] = s[b]);
15
- } else u = s;
16
- return s = u.ref, {
17
- $$typeof: t,
18
- type: f,
19
- key: m,
20
- ref: s !== void 0 ? s : null,
21
- props: u
22
- };
23
- }
24
- return _.Fragment = n, _.jsx = o, _.jsxs = o, _;
25
- }
26
- var E = {};
27
- var D;
28
- function se() {
29
- return D || (D = 1, process.env.NODE_ENV !== "production" && (function() {
30
- function t(e) {
31
- if (e == null) return null;
32
- if (typeof e == "function")
33
- return e.$$typeof === Q ? null : e.displayName || e.name || null;
34
- if (typeof e == "string") return e;
35
- switch (e) {
36
- case T:
37
- return "Fragment";
38
- case V:
39
- return "Profiler";
40
- case W:
41
- return "StrictMode";
42
- case X:
43
- return "Suspense";
44
- case Z:
45
- return "SuspenseList";
46
- case H:
47
- return "Activity";
48
- }
49
- if (typeof e == "object")
50
- switch (typeof e.tag == "number" && console.error(
51
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
52
- ), e.$$typeof) {
53
- case U:
54
- return "Portal";
55
- case J:
56
- return e.displayName || "Context";
57
- case q:
58
- return (e._context.displayName || "Context") + ".Consumer";
59
- case G:
60
- var r = e.render;
61
- return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
62
- case B:
63
- return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
64
- case g:
65
- r = e._payload, e = e._init;
66
- try {
67
- return t(e(r));
68
- } catch {
69
- }
70
- }
71
- return null;
72
- }
73
- function n(e) {
74
- return "" + e;
75
- }
76
- function o(e) {
77
- try {
78
- n(e);
79
- var r = !1;
80
- } catch {
81
- r = !0;
82
- }
83
- if (r) {
84
- r = console;
85
- var a = r.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
86
- return a.call(
87
- r,
88
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
89
- l
90
- ), n(e);
91
- }
92
- }
93
- function f(e) {
94
- if (e === T) return "<>";
95
- if (typeof e == "object" && e !== null && e.$$typeof === g)
96
- return "<...>";
97
- try {
98
- var r = t(e);
99
- return r ? "<" + r + ">" : "<...>";
100
- } catch {
101
- return "<...>";
102
- }
103
- }
104
- function s() {
105
- var e = h.A;
106
- return e === null ? null : e.getOwner();
107
- }
108
- function u() {
109
- return Error("react-stack-top-frame");
110
- }
111
- function m(e) {
112
- if (P.call(e, "key")) {
113
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
114
- if (r && r.isReactWarning) return !1;
115
- }
116
- return e.key !== void 0;
117
- }
118
- function b(e, r) {
119
- function a() {
120
- w || (w = !0, console.error(
121
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
122
- r
123
- ));
124
- }
125
- a.isReactWarning = !0, Object.defineProperty(e, "key", {
126
- get: a,
127
- configurable: !0
128
- });
129
- }
130
- function L() {
131
- var e = t(this.type);
132
- return $[e] || ($[e] = !0, console.error(
133
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
134
- )), e = this.props.ref, e !== void 0 ? e : null;
135
- }
136
- function M(e, r, a, l, p, j) {
137
- var c = a.ref;
138
- return e = {
139
- $$typeof: N,
140
- type: e,
141
- key: r,
142
- props: a,
143
- _owner: l
144
- }, (c !== void 0 ? c : null) !== null ? Object.defineProperty(e, "ref", {
145
- enumerable: !1,
146
- get: L
147
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
148
- configurable: !1,
149
- enumerable: !1,
150
- writable: !0,
151
- value: 0
152
- }), Object.defineProperty(e, "_debugInfo", {
153
- configurable: !1,
154
- enumerable: !1,
155
- writable: !0,
156
- value: null
157
- }), Object.defineProperty(e, "_debugStack", {
158
- configurable: !1,
159
- enumerable: !1,
160
- writable: !0,
161
- value: p
162
- }), Object.defineProperty(e, "_debugTask", {
163
- configurable: !1,
164
- enumerable: !1,
165
- writable: !0,
166
- value: j
167
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
168
- }
169
- function A(e, r, a, l, p, j) {
170
- var c = r.children;
171
- if (c !== void 0)
172
- if (l)
173
- if (K(c)) {
174
- for (l = 0; l < c.length; l++)
175
- S(c[l]);
176
- Object.freeze && Object.freeze(c);
177
- } else
178
- console.error(
179
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
180
- );
181
- else S(c);
182
- if (P.call(r, "key")) {
183
- c = t(e);
184
- var d = Object.keys(r).filter(function(ee) {
185
- return ee !== "key";
186
- });
187
- l = 0 < d.length ? "{key: someKey, " + d.join(": ..., ") + ": ...}" : "{key: someKey}", I[c + l] || (d = 0 < d.length ? "{" + d.join(": ..., ") + ": ...}" : "{}", console.error(
188
- `A props object containing a "key" prop is being spread into JSX:
189
- let props = %s;
190
- <%s {...props} />
191
- React keys must be passed directly to JSX without using spread:
192
- let props = %s;
193
- <%s key={someKey} {...props} />`,
194
- l,
195
- c,
196
- d,
197
- c
198
- ), I[c + l] = !0);
199
- }
200
- if (c = null, a !== void 0 && (o(a), c = "" + a), m(r) && (o(r.key), c = "" + r.key), "key" in r) {
201
- a = {};
202
- for (var y in r)
203
- y !== "key" && (a[y] = r[y]);
204
- } else a = r;
205
- return c && b(
206
- a,
207
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
208
- ), M(
209
- e,
210
- c,
211
- a,
212
- s(),
213
- p,
214
- j
215
- );
216
- }
217
- function S(e) {
218
- O(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === g && (e._payload.status === "fulfilled" ? O(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
219
- }
220
- function O(e) {
221
- return typeof e == "object" && e !== null && e.$$typeof === N;
222
- }
223
- var R = re, N = /* @__PURE__ */ Symbol.for("react.transitional.element"), U = /* @__PURE__ */ Symbol.for("react.portal"), T = /* @__PURE__ */ Symbol.for("react.fragment"), W = /* @__PURE__ */ Symbol.for("react.strict_mode"), V = /* @__PURE__ */ Symbol.for("react.profiler"), q = /* @__PURE__ */ Symbol.for("react.consumer"), J = /* @__PURE__ */ Symbol.for("react.context"), G = /* @__PURE__ */ Symbol.for("react.forward_ref"), X = /* @__PURE__ */ Symbol.for("react.suspense"), Z = /* @__PURE__ */ Symbol.for("react.suspense_list"), B = /* @__PURE__ */ Symbol.for("react.memo"), g = /* @__PURE__ */ Symbol.for("react.lazy"), H = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), h = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, P = Object.prototype.hasOwnProperty, K = Array.isArray, k = console.createTask ? console.createTask : function() {
224
- return null;
225
- };
226
- R = {
227
- react_stack_bottom_frame: function(e) {
228
- return e();
229
- }
230
- };
231
- var w, $ = {}, C = R.react_stack_bottom_frame.bind(
232
- R,
233
- u
234
- )(), Y = k(f(u)), I = {};
235
- E.Fragment = T, E.jsx = function(e, r, a) {
236
- var l = 1e4 > h.recentlyCreatedOwnerStacks++;
237
- return A(
238
- e,
239
- r,
240
- a,
241
- !1,
242
- l ? Error("react-stack-top-frame") : C,
243
- l ? k(f(e)) : Y
244
- );
245
- }, E.jsxs = function(e, r, a) {
246
- var l = 1e4 > h.recentlyCreatedOwnerStacks++;
247
- return A(
248
- e,
249
- r,
250
- a,
251
- !0,
252
- l ? Error("react-stack-top-frame") : C,
253
- l ? k(f(e)) : Y
254
- );
255
- };
256
- })()), E;
257
- }
258
- var z;
259
- function le() {
260
- return z || (z = 1, process.env.NODE_ENV === "production" ? x.exports = oe() : x.exports = se()), x.exports;
261
- }
262
- var i = le();
263
- const ce = (t) => {
264
- const n = t.length >= 8 && t.length <= 14, o = /[a-z]/.test(t), f = /[A-Z]/.test(t), s = /[0-9]/.test(t), u = /[^A-Za-z0-9]/.test(t);
265
- return { length: n, lowercase: o, uppercase: f, number: s, symbol: u, valid: n && o && f && s && u };
266
- }, ue = (t) => te(() => ce(t), [t]), ie = (t) => {
267
- let n = 0;
268
- return t.length >= 2 && (n += 1), /[a-z]/.test(t) && (n += 1), /[A-Z]/.test(t) && (n += 1), /[0-9]/.test(t) && (n += 1), /[^A-Za-z0-9]/.test(t) && (n += 1), n <= 2 ? "weak" : n === 3 || n === 4 ? "medium" : "strong";
269
- }, v = ({
270
- ok: t,
271
- label: n,
272
- className: o = ""
273
- }) => /* @__PURE__ */ i.jsxs("div", { className: `flex items-center gap-2 text-sm ${o}`, children: [
274
- t ? /* @__PURE__ */ i.jsx(ne, { className: "w-4 h-4 text-green-600" }) : /* @__PURE__ */ i.jsx(ae, { className: "w-4 h-4 text-red-500" }),
275
- /* @__PURE__ */ i.jsx("span", { className: t ? "text-green-600" : "text-gray-500", children: n })
276
- ] }), fe = ({
277
- strength: t,
278
- className: n = ""
279
- }) => {
280
- let o = "bg-red-500", f = "w-1/4";
281
- return t === "medium" ? (o = "bg-yellow-400", f = "w-2/3") : t === "strong" && (o = "bg-green-600", f = "w-full"), /* @__PURE__ */ i.jsx("div", { className: `h-2 bg-gray-200 rounded-full mt-2 ${n}`, children: /* @__PURE__ */ i.jsx(
282
- "div",
283
- {
284
- className: `${f} ${o} h-2 rounded-full transition-all`
285
- }
286
- ) });
287
- }, be = ({
288
- password: t,
289
- className: n = "",
290
- itemClassName: o = "",
291
- strengthBarClassName: f = ""
292
- }) => {
293
- const s = ue(t), u = ie(t);
294
- return /* @__PURE__ */ i.jsxs("div", { className: `rounded-lg border p-4 shadow space-y-3 ${n}`, children: [
295
- /* @__PURE__ */ i.jsxs("div", { className: "space-y-1", children: [
296
- /* @__PURE__ */ i.jsx(
297
- v,
298
- {
299
- ok: s.length,
300
- label: "8–14 characters",
301
- className: o
302
- }
303
- ),
304
- /* @__PURE__ */ i.jsx(
305
- v,
306
- {
307
- ok: s.lowercase,
308
- label: "Lowercase letter",
309
- className: o
310
- }
311
- ),
312
- /* @__PURE__ */ i.jsx(
313
- v,
314
- {
315
- ok: s.uppercase,
316
- label: "Uppercase letter",
317
- className: o
318
- }
319
- ),
320
- /* @__PURE__ */ i.jsx(v, { ok: s.number, label: "Number", className: o }),
321
- /* @__PURE__ */ i.jsx(v, { ok: s.symbol, label: "Symbol", className: o })
322
- ] }),
323
- /* @__PURE__ */ i.jsx(fe, { strength: u, className: f }),
324
- /* @__PURE__ */ i.jsxs("div", { className: "text-sm font-medium capitalize text-gray-700", children: [
325
- "Strength: ",
326
- u
327
- ] })
328
- ] });
329
- };
330
- export {
331
- be as PasswordValidator,
332
- ue as usePasswordValidation,
333
- ce as validatePassword
334
- };
@@ -1,6 +0,0 @@
1
- (function(d,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react","lucide-react"],m):(d=typeof globalThis<"u"?globalThis:d||self,m(d.ReactPasswordValidator={},d.React,d.LucideReact))})(this,(function(d,m,w){"use strict";var T={exports:{}},E={};var A;function q(){if(A)return E;A=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function o(f,s,u){var b=null;if(u!==void 0&&(b=""+u),s.key!==void 0&&(b=""+s.key),"key"in s){u={};for(var p in s)p!=="key"&&(u[p]=s[p])}else u=s;return s=u.ref,{$$typeof:t,type:f,key:b,ref:s!==void 0?s:null,props:u}}return E.Fragment=n,E.jsx=o,E.jsxs=o,E}var v={};var O;function J(){return O||(O=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ue?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case re:return"Profiler";case ee:return"StrictMode";case oe:return"Suspense";case se:return"SuspenseList";case ce:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case K:return"Portal";case ne:return e.displayName||"Context";case te:return(e._context.displayName||"Context")+".Consumer";case ae:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case le:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case k:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function n(e){return""+e}function o(e){try{n(e);var r=!1}catch{r=!0}if(r){r=console;var a=r.error,l=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",l),n(e)}}function f(e){if(e===g)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===k)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function s(){var e=j.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function b(e){if(L.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function p(e,r){function a(){M||(M=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}function H(){var e=t(this.type);return V[e]||(V[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Q(e,r,a,l,x,P){var c=a.ref;return e={$$typeof:D,type:e,key:r,props:a,_owner:l},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:H}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:P}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function $(e,r,a,l,x,P){var c=r.children;if(c!==void 0)if(l)if(ie(c)){for(l=0;l<c.length;l++)I(c[l]);Object.freeze&&Object.freeze(c)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else I(c);if(L.call(r,"key")){c=t(e);var _=Object.keys(r).filter(function(fe){return fe!=="key"});l=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",W[c+l]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
- let props = %s;
3
- <%s {...props} />
4
- React keys must be passed directly to JSX without using spread:
5
- let props = %s;
6
- <%s key={someKey} {...props} />`,l,c,_,c),W[c+l]=!0)}if(c=null,a!==void 0&&(o(a),c=""+a),b(r)&&(o(r.key),c=""+r.key),"key"in r){a={};for(var S in r)S!=="key"&&(a[S]=r[S])}else a=r;return c&&p(a,typeof e=="function"?e.displayName||e.name||"Unknown":e),Q(e,c,a,s(),x,P)}function I(e){F(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===k&&(e._payload.status==="fulfilled"?F(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function F(e){return typeof e=="object"&&e!==null&&e.$$typeof===D}var h=m,D=Symbol.for("react.transitional.element"),K=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),ee=Symbol.for("react.strict_mode"),re=Symbol.for("react.profiler"),te=Symbol.for("react.consumer"),ne=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),oe=Symbol.for("react.suspense"),se=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),ue=Symbol.for("react.client.reference"),j=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,ie=Array.isArray,y=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(e){return e()}};var M,V={},z=h.react_stack_bottom_frame.bind(h,u)(),U=y(f(u)),W={};v.Fragment=g,v.jsx=function(e,r,a){var l=1e4>j.recentlyCreatedOwnerStacks++;return $(e,r,a,!1,l?Error("react-stack-top-frame"):z,l?y(f(e)):U)},v.jsxs=function(e,r,a){var l=1e4>j.recentlyCreatedOwnerStacks++;return $(e,r,a,!0,l?Error("react-stack-top-frame"):z,l?y(f(e)):U)}})()),v}var N;function G(){return N||(N=1,process.env.NODE_ENV==="production"?T.exports=q():T.exports=J()),T.exports}var i=G();const C=t=>{const n=t.length>=8&&t.length<=14,o=/[a-z]/.test(t),f=/[A-Z]/.test(t),s=/[0-9]/.test(t),u=/[^A-Za-z0-9]/.test(t);return{length:n,lowercase:o,uppercase:f,number:s,symbol:u,valid:n&&o&&f&&s&&u}},Y=t=>m.useMemo(()=>C(t),[t]),X=t=>{let n=0;return t.length>=2&&(n+=1),/[a-z]/.test(t)&&(n+=1),/[A-Z]/.test(t)&&(n+=1),/[0-9]/.test(t)&&(n+=1),/[^A-Za-z0-9]/.test(t)&&(n+=1),n<=2?"weak":n===3||n===4?"medium":"strong"},R=({ok:t,label:n,className:o=""})=>i.jsxs("div",{className:`flex items-center gap-2 text-sm ${o}`,children:[t?i.jsx(w.Check,{className:"w-4 h-4 text-green-600"}):i.jsx(w.X,{className:"w-4 h-4 text-red-500"}),i.jsx("span",{className:t?"text-green-600":"text-gray-500",children:n})]}),Z=({strength:t,className:n=""})=>{let o="bg-red-500",f="w-1/4";return t==="medium"?(o="bg-yellow-400",f="w-2/3"):t==="strong"&&(o="bg-green-600",f="w-full"),i.jsx("div",{className:`h-2 bg-gray-200 rounded-full mt-2 ${n}`,children:i.jsx("div",{className:`${f} ${o} h-2 rounded-full transition-all`})})},B=({password:t,className:n="",itemClassName:o="",strengthBarClassName:f=""})=>{const s=Y(t),u=X(t);return i.jsxs("div",{className:`rounded-lg border p-4 shadow space-y-3 ${n}`,children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(R,{ok:s.length,label:"8–14 characters",className:o}),i.jsx(R,{ok:s.lowercase,label:"Lowercase letter",className:o}),i.jsx(R,{ok:s.uppercase,label:"Uppercase letter",className:o}),i.jsx(R,{ok:s.number,label:"Number",className:o}),i.jsx(R,{ok:s.symbol,label:"Symbol",className:o})]}),i.jsx(Z,{strength:u,className:f}),i.jsxs("div",{className:"text-sm font-medium capitalize text-gray-700",children:["Strength: ",u]})]})};d.PasswordValidator=B,d.usePasswordValidation=Y,d.validatePassword=C,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
@@ -1,9 +0,0 @@
1
- export interface PasswordValidationResult {
2
- length: boolean;
3
- lowercase: boolean;
4
- uppercase: boolean;
5
- number: boolean;
6
- symbol: boolean;
7
- valid: boolean;
8
- }
9
- export declare const validatePassword: (password: string) => PasswordValidationResult;
@@ -1,2 +0,0 @@
1
- export type PasswordStrength = "weak" | "medium" | "strong";
2
- export declare const calculateStrength: (password: string) => PasswordStrength;
package/dist/vite.svg DELETED
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>