vue3-password-strength-meter 1.7.8 → 1.8.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/dist/style.css +1 -0
- package/dist/vue3-password-strength-meter.cjs.js +1 -0
- package/dist/vue3-password-strength-meter.es.js +299 -0
- package/dist/vue3-password-strength-meter.umd.js +1 -0
- package/package.json +84 -130
- package/CHANGELOG.md +0 -13
- package/dist/dist/vue-password-strength-meter.js +0 -1
- package/dist/dist/vue-password-strength-meter.min.js +0 -1
- package/dist/dist/vue3-password-strength-meter.js +0 -1
- package/dist/dist/vue3-password-strength-meter.min.js +0 -1
- package/dist/vue-password-strength-meter.js +0 -412
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[v-cloak]{display:none}.Password{max-width:400px;margin:0 auto}.Password__group{position:relative}.Password__strength-meter{position:relative;height:3px;background:#ddd;margin:10px auto 20px;border-radius:3px}.Password__strength-meter:before,.Password__strength-meter:after{content:"";height:inherit;background:transparent;display:block;border-color:#fff;border-style:solid;border-width:0 5px 0 5px;position:absolute;width:20%;z-index:10}.Password__strength-meter:before{left:20%}.Password__strength-meter:after{right:20%}.Password__strength-meter--fill{background:transparent;height:inherit;position:absolute;width:0;border-radius:inherit;transition:width .5s ease-in-out,background .25s}.Password__strength-meter--fill[data-score="0"]{background:#8b0000;width:20%}.Password__strength-meter--fill[data-score="1"]{background:#ff4500;width:40%}.Password__strength-meter--fill[data-score="2"]{background:orange;width:60%}.Password__strength-meter--fill[data-score="3"]{background:#9acd32;width:80%}.Password__strength-meter--fill[data-score="4"]{background:green;width:100%}.Password__field{background-color:#f1f1f1;border:1px solid #f1f1f1;border-radius:2px;box-sizing:border-box;font-size:14px;padding:13px;width:100%}.Password__field--disabled{background-color:#f6f6f6;border:1px solid #f6f6f6}.Password__icons{position:absolute;top:0;right:0;height:100%;display:flex;flex-direction:row;justify-content:flex-end;align-items:center}.Password__toggle{line-height:1.1;margin-right:13px}.Password__badge{position:relative;color:#fff;border-radius:6px;padding:3px;width:30px;height:15px;font-size:14px;line-height:1.1;margin-right:13px;display:flex;justify-content:center;align-items:center}.Password__badge--error{background:red}.Password__badge--success{background:#1bbf1b}.btn-clean{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;cursor:pointer;outline:none;color:#777;padding:0}.btn-clean svg{fill:currentColor}.btn-clean:hover,.btn-clean:focus{color:#404b69}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("zxcvbn"),e=require("vue"),u=(s,t)=>{const a=s.__vccOpts||s;for(const[o,d]of t)a[o]=d;return a},h={name:"VuePasswordStrengthMeter",inheritAttrs:!1,emits:["input","blur","focus","score","hide","show","update:modelValue","feedback"],props:{value:{type:String},modelValue:{type:String},secureLength:{type:Number,default:7},badge:{type:Boolean,default:!0},toggle:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},showStrengthMeter:{type:Boolean,default:!0},strengthMeterOnly:{type:Boolean,default:!1},defaultClass:{type:String,default:"Password__field"},disabledClass:{type:String,default:"Password__field--disabled"},errorClass:{type:String,default:"Password__badge--error"},successClass:{type:String,default:"Password__badge--success"},strengthMeterClass:{type:String,default:"Password__strength-meter"},strengthMeterFillClass:{type:String,default:"Password__strength-meter--fill"},labelShow:{type:String,default:"Show Password"},labelHide:{type:String,default:"Hide Password"},userInputs:{type:Array,default:()=>[]}},data(){return{password:null,_showPassword:!1}},methods:{togglePassword(){this.$data._showPassword?(this.$emit("hide"),this.$data._showPassword=!1):(this.$emit("show"),this.$data._showPassword=!0)},emitValue(s,t){s==="input"?this.$emit("update:modelValue",t):this.$emit(s,t),this.password=t}},computed:{passwordStrength(){return this.password?n(this.password,this.userInputs.length>=1?this.userInputs:null).score:null},isSecure(){return this.password?this.password.length>=this.secureLength:null},isActive(){return this.password&&this.password.length>0},passwordCount(){return this.password&&(this.password.length>this.secureLength?`${this.secureLength}+`:this.password.length)},inputType(){return this.$data._showPassword||this.showPassword?"text":"password"},showPasswordLabel(){return this.$data._showPassword||this.showPassword?this.labelHide:this.labelShow}},watch:{modelValue(s){this.strengthMeterOnly&&this.emitValue("input",s),this.$emit("feedback",n(s).feedback)},passwordStrength(s){this.$emit("score",s)}}},w={class:"Password"},c={key:0,class:"Password__group"},g=["type","value"],m={class:"Password__icons"},p={key:1,class:"Password__toggle"},f=["aria-label"],_={key:0,version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},y={key:1,version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},P=["data-score"];function b(s,t,a,o,d,r){return e.openBlock(),e.createElementBlock("div",w,[a.strengthMeterOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",c,[e.createElementVNode("input",e.mergeProps(s.$attrs,{type:r.inputType,class:[a.defaultClass,s.$attrs.disabled?a.disabledClass:""],value:a.modelValue,onInput:t[0]||(t[0]=l=>r.emitValue("input",l.target.value)),onBlur:t[1]||(t[1]=l=>r.emitValue("blur",l.target.value)),onFocus:t[2]||(t[2]=l=>r.emitValue("focus",l.target.value))}),null,16,g),e.createElementVNode("div",m,[a.badge?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([[r.isSecure?a.successClass:"",!r.isSecure&&r.isActive?a.errorClass:""],"Password__badge"])},e.toDisplayString(r.passwordCount),3)):e.createCommentVNode("",!0),a.toggle?(e.openBlock(),e.createElementBlock("div",p,[e.createElementVNode("button",{type:"button",class:"btn-clean","aria-label":r.showPasswordLabel,tabindex:"-1",onClick:t[3]||(t[3]=e.withModifiers(l=>r.togglePassword(),["prevent"]))},[this.$data._showPassword?(e.openBlock(),e.createElementBlock("svg",_,[e.createElementVNode("title",null,e.toDisplayString(r.showPasswordLabel),1),t[4]||(t[4]=e.createElementVNode("path",{d:"M12 9c1.641 0 3 1.359 3 3s-1.359 3-3 3-3-1.359-3-3 1.359-3 3-3zM12 17.016c2.766 0 5.016-2.25 5.016-5.016s-2.25-5.016-5.016-5.016-5.016 2.25-5.016 5.016 2.25 5.016 5.016 5.016zM12 4.5c5.016 0 9.281 3.094 11.016 7.5-1.734 4.406-6 7.5-11.016 7.5s-9.281-3.094-11.016-7.5c1.734-4.406 6-7.5 11.016-7.5z"},null,-1))])):(e.openBlock(),e.createElementBlock("svg",y,[e.createElementVNode("title",null,e.toDisplayString(r.showPasswordLabel),1),t[5]||(t[5]=e.createElementVNode("path",{d:"M11.859 9h0.141c1.641 0 3 1.359 3 3v0.188zM7.547 9.797c-0.328 0.656-0.563 1.406-0.563 2.203 0 2.766 2.25 5.016 5.016 5.016 0.797 0 1.547-0.234 2.203-0.563l-1.547-1.547c-0.188 0.047-0.422 0.094-0.656 0.094-1.641 0-3-1.359-3-3 0-0.234 0.047-0.469 0.094-0.656zM2.016 4.266l1.266-1.266 17.719 17.719-1.266 1.266c-1.124-1.11-2.256-2.213-3.375-3.328-1.359 0.563-2.813 0.844-4.359 0.844-5.016 0-9.281-3.094-11.016-7.5 0.797-1.969 2.109-3.656 3.75-4.969-0.914-0.914-1.812-1.844-2.719-2.766zM12 6.984c-0.656 0-1.266 0.141-1.828 0.375l-2.156-2.156c1.219-0.469 2.578-0.703 3.984-0.703 5.016 0 9.234 3.094 10.969 7.5-0.75 1.875-1.922 3.469-3.422 4.734l-2.906-2.906c0.234-0.563 0.375-1.172 0.375-1.828 0-2.766-2.25-5.016-5.016-5.016z"},null,-1))]))],8,f)])):e.createCommentVNode("",!0)])])),a.showStrengthMeter?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass([a.strengthMeterClass])},[e.createElementVNode("div",{class:e.normalizeClass([a.strengthMeterFillClass]),"data-score":r.passwordStrength},null,10,P)],2)):e.createCommentVNode("",!0)])}const v=u(h,[["render",b]]),i={install(s){s.component("Password",v)}};typeof window<"u"&&window.Vue&&(window.VuePasswordStrengthMeter=i);exports.default=i;
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import g from "zxcvbn";
|
|
2
|
+
import { createElementBlock as l, openBlock as d, createCommentVNode as i, createElementVNode as r, mergeProps as c, normalizeClass as n, toDisplayString as u, withModifiers as f } from "vue";
|
|
3
|
+
const _ = (s, e) => {
|
|
4
|
+
const t = s.__vccOpts || s;
|
|
5
|
+
for (const [h, w] of e)
|
|
6
|
+
t[h] = w;
|
|
7
|
+
return t;
|
|
8
|
+
}, p = {
|
|
9
|
+
name: "VuePasswordStrengthMeter",
|
|
10
|
+
inheritAttrs: !1,
|
|
11
|
+
emits: ["input", "blur", "focus", "score", "hide", "show", "update:modelValue", "feedback"],
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* Binded value
|
|
15
|
+
* @type {Object}
|
|
16
|
+
*/
|
|
17
|
+
value: {
|
|
18
|
+
type: String
|
|
19
|
+
},
|
|
20
|
+
modelValue: {
|
|
21
|
+
type: String
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Password min length.
|
|
25
|
+
* Right now only visual for the badge
|
|
26
|
+
* @type {Number}
|
|
27
|
+
*/
|
|
28
|
+
secureLength: {
|
|
29
|
+
type: Number,
|
|
30
|
+
default: 7
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Display badge:
|
|
34
|
+
* The badge shows your
|
|
35
|
+
* password character count
|
|
36
|
+
* up to the defined secureLength
|
|
37
|
+
* @type {Boolean}
|
|
38
|
+
*/
|
|
39
|
+
badge: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: !0
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Show password toggle:
|
|
45
|
+
* Show icon to toggle
|
|
46
|
+
* the password visibility
|
|
47
|
+
*/
|
|
48
|
+
toggle: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Prop to toggle the
|
|
54
|
+
* cleartext password if
|
|
55
|
+
* toggle is disabled
|
|
56
|
+
*/
|
|
57
|
+
showPassword: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: !1
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Prop to toggle the
|
|
63
|
+
* strength Meter if
|
|
64
|
+
* User wants to implement
|
|
65
|
+
* their own
|
|
66
|
+
*/
|
|
67
|
+
showStrengthMeter: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: !0
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Prop to toggle the
|
|
73
|
+
* input element if
|
|
74
|
+
* User wants to implement
|
|
75
|
+
* their own input element
|
|
76
|
+
*/
|
|
77
|
+
strengthMeterOnly: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: !1
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* CSS Class for the Input field
|
|
83
|
+
* @type {String}
|
|
84
|
+
*/
|
|
85
|
+
defaultClass: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: "Password__field"
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* CSS Class for the disabled Input field
|
|
91
|
+
* @type {String}
|
|
92
|
+
*/
|
|
93
|
+
disabledClass: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: "Password__field--disabled"
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* CSS Class for the badge
|
|
99
|
+
* if a password does not match
|
|
100
|
+
* the secureLength. Later for errors
|
|
101
|
+
* @type {String}
|
|
102
|
+
*/
|
|
103
|
+
errorClass: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: "Password__badge--error"
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* CSS Class for the badge
|
|
109
|
+
* if a password does match
|
|
110
|
+
* the secureLength. Later for
|
|
111
|
+
* success messages possible.
|
|
112
|
+
* @type {String}
|
|
113
|
+
*/
|
|
114
|
+
successClass: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: "Password__badge--success"
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* CSS class for styling the
|
|
120
|
+
* strength meter bars.
|
|
121
|
+
* @type {String}
|
|
122
|
+
*/
|
|
123
|
+
strengthMeterClass: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: "Password__strength-meter"
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* strengthMeterFillClass sets the
|
|
129
|
+
* individual strength width and fill
|
|
130
|
+
* color of the strength meter bars.
|
|
131
|
+
* @type {String}
|
|
132
|
+
*/
|
|
133
|
+
strengthMeterFillClass: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: "Password__strength-meter--fill"
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* Label for the show password icon
|
|
139
|
+
*/
|
|
140
|
+
labelShow: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: "Show Password"
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* Label for the hide password icon
|
|
146
|
+
*/
|
|
147
|
+
labelHide: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: "Hide Password"
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* @type String
|
|
153
|
+
*/
|
|
154
|
+
userInputs: {
|
|
155
|
+
type: Array,
|
|
156
|
+
default: () => []
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
data() {
|
|
160
|
+
return {
|
|
161
|
+
password: null,
|
|
162
|
+
_showPassword: !1
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
methods: {
|
|
166
|
+
togglePassword() {
|
|
167
|
+
this.$data._showPassword ? (this.$emit("hide"), this.$data._showPassword = !1) : (this.$emit("show"), this.$data._showPassword = !0);
|
|
168
|
+
},
|
|
169
|
+
emitValue(s, e) {
|
|
170
|
+
s === "input" ? this.$emit("update:modelValue", e) : this.$emit(s, e), this.password = e;
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
computed: {
|
|
174
|
+
/**
|
|
175
|
+
* passwordStrength is the score calculated by zxcvbn
|
|
176
|
+
* @return {Number} Password Strength Score
|
|
177
|
+
*/
|
|
178
|
+
passwordStrength() {
|
|
179
|
+
return this.password ? g(this.password, this.userInputs.length >= 1 ? this.userInputs : null).score : null;
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* isSecure checks if the length of the password is longer then
|
|
183
|
+
* the defined `secureLength`
|
|
184
|
+
* @return {Boolean} Password length longer then minLength
|
|
185
|
+
*/
|
|
186
|
+
isSecure() {
|
|
187
|
+
return this.password ? this.password.length >= this.secureLength : null;
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
* isActive checks if a password is entered.
|
|
191
|
+
* It's required for the password count badge.
|
|
192
|
+
* @return {Boolean} Password entered
|
|
193
|
+
*/
|
|
194
|
+
isActive() {
|
|
195
|
+
return this.password && this.password.length > 0;
|
|
196
|
+
},
|
|
197
|
+
/**
|
|
198
|
+
* passwordCount holds the character count of the
|
|
199
|
+
* current password. It shows the count up to the `secureLength`.
|
|
200
|
+
* @return {Number} Password Character Count
|
|
201
|
+
*/
|
|
202
|
+
passwordCount() {
|
|
203
|
+
return this.password && (this.password.length > this.secureLength ? `${this.secureLength}+` : this.password.length);
|
|
204
|
+
},
|
|
205
|
+
/**
|
|
206
|
+
* Changing the input type from password to text
|
|
207
|
+
* based on the local _showPassword data or the showPassword prop
|
|
208
|
+
*/
|
|
209
|
+
inputType() {
|
|
210
|
+
return this.$data._showPassword || this.showPassword ? "text" : "password";
|
|
211
|
+
},
|
|
212
|
+
showPasswordLabel() {
|
|
213
|
+
return this.$data._showPassword || this.showPassword ? this.labelHide : this.labelShow;
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
watch: {
|
|
217
|
+
modelValue(s) {
|
|
218
|
+
this.strengthMeterOnly && this.emitValue("input", s), this.$emit("feedback", g(s).feedback);
|
|
219
|
+
},
|
|
220
|
+
passwordStrength(s) {
|
|
221
|
+
this.$emit("score", s);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}, m = { class: "Password" }, y = {
|
|
225
|
+
key: 0,
|
|
226
|
+
class: "Password__group"
|
|
227
|
+
}, P = ["type", "value"], b = { class: "Password__icons" }, v = {
|
|
228
|
+
key: 1,
|
|
229
|
+
class: "Password__toggle"
|
|
230
|
+
}, S = ["aria-label"], M = {
|
|
231
|
+
key: 0,
|
|
232
|
+
version: "1.1",
|
|
233
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
234
|
+
width: "24",
|
|
235
|
+
height: "24",
|
|
236
|
+
viewBox: "0 0 24 24"
|
|
237
|
+
}, C = {
|
|
238
|
+
key: 1,
|
|
239
|
+
version: "1.1",
|
|
240
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
241
|
+
width: "24",
|
|
242
|
+
height: "24",
|
|
243
|
+
viewBox: "0 0 24 24"
|
|
244
|
+
}, V = ["data-score"];
|
|
245
|
+
function k(s, e, t, h, w, a) {
|
|
246
|
+
return d(), l("div", m, [
|
|
247
|
+
t.strengthMeterOnly ? i("", !0) : (d(), l("div", y, [
|
|
248
|
+
r("input", c(s.$attrs, {
|
|
249
|
+
type: a.inputType,
|
|
250
|
+
class: [t.defaultClass, s.$attrs.disabled ? t.disabledClass : ""],
|
|
251
|
+
value: t.modelValue,
|
|
252
|
+
onInput: e[0] || (e[0] = (o) => a.emitValue("input", o.target.value)),
|
|
253
|
+
onBlur: e[1] || (e[1] = (o) => a.emitValue("blur", o.target.value)),
|
|
254
|
+
onFocus: e[2] || (e[2] = (o) => a.emitValue("focus", o.target.value))
|
|
255
|
+
}), null, 16, P),
|
|
256
|
+
r("div", b, [
|
|
257
|
+
t.badge ? (d(), l("div", {
|
|
258
|
+
key: 0,
|
|
259
|
+
class: n([[a.isSecure ? t.successClass : "", !a.isSecure && a.isActive ? t.errorClass : ""], "Password__badge"])
|
|
260
|
+
}, u(a.passwordCount), 3)) : i("", !0),
|
|
261
|
+
t.toggle ? (d(), l("div", v, [
|
|
262
|
+
r("button", {
|
|
263
|
+
type: "button",
|
|
264
|
+
class: "btn-clean",
|
|
265
|
+
"aria-label": a.showPasswordLabel,
|
|
266
|
+
tabindex: "-1",
|
|
267
|
+
onClick: e[3] || (e[3] = f((o) => a.togglePassword(), ["prevent"]))
|
|
268
|
+
}, [
|
|
269
|
+
this.$data._showPassword ? (d(), l("svg", M, [
|
|
270
|
+
r("title", null, u(a.showPasswordLabel), 1),
|
|
271
|
+
e[4] || (e[4] = r("path", { d: "M12 9c1.641 0 3 1.359 3 3s-1.359 3-3 3-3-1.359-3-3 1.359-3 3-3zM12 17.016c2.766 0 5.016-2.25 5.016-5.016s-2.25-5.016-5.016-5.016-5.016 2.25-5.016 5.016 2.25 5.016 5.016 5.016zM12 4.5c5.016 0 9.281 3.094 11.016 7.5-1.734 4.406-6 7.5-11.016 7.5s-9.281-3.094-11.016-7.5c1.734-4.406 6-7.5 11.016-7.5z" }, null, -1))
|
|
272
|
+
])) : (d(), l("svg", C, [
|
|
273
|
+
r("title", null, u(a.showPasswordLabel), 1),
|
|
274
|
+
e[5] || (e[5] = r("path", { d: "M11.859 9h0.141c1.641 0 3 1.359 3 3v0.188zM7.547 9.797c-0.328 0.656-0.563 1.406-0.563 2.203 0 2.766 2.25 5.016 5.016 5.016 0.797 0 1.547-0.234 2.203-0.563l-1.547-1.547c-0.188 0.047-0.422 0.094-0.656 0.094-1.641 0-3-1.359-3-3 0-0.234 0.047-0.469 0.094-0.656zM2.016 4.266l1.266-1.266 17.719 17.719-1.266 1.266c-1.124-1.11-2.256-2.213-3.375-3.328-1.359 0.563-2.813 0.844-4.359 0.844-5.016 0-9.281-3.094-11.016-7.5 0.797-1.969 2.109-3.656 3.75-4.969-0.914-0.914-1.812-1.844-2.719-2.766zM12 6.984c-0.656 0-1.266 0.141-1.828 0.375l-2.156-2.156c1.219-0.469 2.578-0.703 3.984-0.703 5.016 0 9.234 3.094 10.969 7.5-0.75 1.875-1.922 3.469-3.422 4.734l-2.906-2.906c0.234-0.563 0.375-1.172 0.375-1.828 0-2.766-2.25-5.016-5.016-5.016z" }, null, -1))
|
|
275
|
+
]))
|
|
276
|
+
], 8, S)
|
|
277
|
+
])) : i("", !0)
|
|
278
|
+
])
|
|
279
|
+
])),
|
|
280
|
+
t.showStrengthMeter ? (d(), l("div", {
|
|
281
|
+
key: 1,
|
|
282
|
+
class: n([t.strengthMeterClass])
|
|
283
|
+
}, [
|
|
284
|
+
r("div", {
|
|
285
|
+
class: n([t.strengthMeterFillClass]),
|
|
286
|
+
"data-score": a.passwordStrength
|
|
287
|
+
}, null, 10, V)
|
|
288
|
+
], 2)) : i("", !0)
|
|
289
|
+
]);
|
|
290
|
+
}
|
|
291
|
+
const B = /* @__PURE__ */ _(p, [["render", k]]), z = {
|
|
292
|
+
install(s) {
|
|
293
|
+
s.component("Password", B);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
typeof window < "u" && window.Vue && (window.VuePasswordStrengthMeter = z);
|
|
297
|
+
export {
|
|
298
|
+
z as default
|
|
299
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(l,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("zxcvbn"),require("vue")):typeof define=="function"&&define.amd?define(["exports","zxcvbn","vue"],o):(l=typeof globalThis<"u"?globalThis:l||self,o(l.VuePasswordStrengthMeter={},l.zxcvbn,l.Vue))})(this,function(l,o,e){"use strict";const w=(s,t)=>{const r=s.__vccOpts||s;for(const[i,h]of t)r[i]=h;return r},c={name:"VuePasswordStrengthMeter",inheritAttrs:!1,emits:["input","blur","focus","score","hide","show","update:modelValue","feedback"],props:{value:{type:String},modelValue:{type:String},secureLength:{type:Number,default:7},badge:{type:Boolean,default:!0},toggle:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},showStrengthMeter:{type:Boolean,default:!0},strengthMeterOnly:{type:Boolean,default:!1},defaultClass:{type:String,default:"Password__field"},disabledClass:{type:String,default:"Password__field--disabled"},errorClass:{type:String,default:"Password__badge--error"},successClass:{type:String,default:"Password__badge--success"},strengthMeterClass:{type:String,default:"Password__strength-meter"},strengthMeterFillClass:{type:String,default:"Password__strength-meter--fill"},labelShow:{type:String,default:"Show Password"},labelHide:{type:String,default:"Hide Password"},userInputs:{type:Array,default:()=>[]}},data(){return{password:null,_showPassword:!1}},methods:{togglePassword(){this.$data._showPassword?(this.$emit("hide"),this.$data._showPassword=!1):(this.$emit("show"),this.$data._showPassword=!0)},emitValue(s,t){s==="input"?this.$emit("update:modelValue",t):this.$emit(s,t),this.password=t}},computed:{passwordStrength(){return this.password?o(this.password,this.userInputs.length>=1?this.userInputs:null).score:null},isSecure(){return this.password?this.password.length>=this.secureLength:null},isActive(){return this.password&&this.password.length>0},passwordCount(){return this.password&&(this.password.length>this.secureLength?`${this.secureLength}+`:this.password.length)},inputType(){return this.$data._showPassword||this.showPassword?"text":"password"},showPasswordLabel(){return this.$data._showPassword||this.showPassword?this.labelHide:this.labelShow}},watch:{modelValue(s){this.strengthMeterOnly&&this.emitValue("input",s),this.$emit("feedback",o(s).feedback)},passwordStrength(s){this.$emit("score",s)}}},u={class:"Password"},g={key:0,class:"Password__group"},m=["type","value"],f={class:"Password__icons"},p={key:1,class:"Password__toggle"},_=["aria-label"],y={key:0,version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},P={key:1,version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},b=["data-score"];function S(s,t,r,i,h,a){return e.openBlock(),e.createElementBlock("div",u,[r.strengthMeterOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",g,[e.createElementVNode("input",e.mergeProps(s.$attrs,{type:a.inputType,class:[r.defaultClass,s.$attrs.disabled?r.disabledClass:""],value:r.modelValue,onInput:t[0]||(t[0]=d=>a.emitValue("input",d.target.value)),onBlur:t[1]||(t[1]=d=>a.emitValue("blur",d.target.value)),onFocus:t[2]||(t[2]=d=>a.emitValue("focus",d.target.value))}),null,16,m),e.createElementVNode("div",f,[r.badge?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([[a.isSecure?r.successClass:"",!a.isSecure&&a.isActive?r.errorClass:""],"Password__badge"])},e.toDisplayString(a.passwordCount),3)):e.createCommentVNode("",!0),r.toggle?(e.openBlock(),e.createElementBlock("div",p,[e.createElementVNode("button",{type:"button",class:"btn-clean","aria-label":a.showPasswordLabel,tabindex:"-1",onClick:t[3]||(t[3]=e.withModifiers(d=>a.togglePassword(),["prevent"]))},[this.$data._showPassword?(e.openBlock(),e.createElementBlock("svg",y,[e.createElementVNode("title",null,e.toDisplayString(a.showPasswordLabel),1),t[4]||(t[4]=e.createElementVNode("path",{d:"M12 9c1.641 0 3 1.359 3 3s-1.359 3-3 3-3-1.359-3-3 1.359-3 3-3zM12 17.016c2.766 0 5.016-2.25 5.016-5.016s-2.25-5.016-5.016-5.016-5.016 2.25-5.016 5.016 2.25 5.016 5.016 5.016zM12 4.5c5.016 0 9.281 3.094 11.016 7.5-1.734 4.406-6 7.5-11.016 7.5s-9.281-3.094-11.016-7.5c1.734-4.406 6-7.5 11.016-7.5z"},null,-1))])):(e.openBlock(),e.createElementBlock("svg",P,[e.createElementVNode("title",null,e.toDisplayString(a.showPasswordLabel),1),t[5]||(t[5]=e.createElementVNode("path",{d:"M11.859 9h0.141c1.641 0 3 1.359 3 3v0.188zM7.547 9.797c-0.328 0.656-0.563 1.406-0.563 2.203 0 2.766 2.25 5.016 5.016 5.016 0.797 0 1.547-0.234 2.203-0.563l-1.547-1.547c-0.188 0.047-0.422 0.094-0.656 0.094-1.641 0-3-1.359-3-3 0-0.234 0.047-0.469 0.094-0.656zM2.016 4.266l1.266-1.266 17.719 17.719-1.266 1.266c-1.124-1.11-2.256-2.213-3.375-3.328-1.359 0.563-2.813 0.844-4.359 0.844-5.016 0-9.281-3.094-11.016-7.5 0.797-1.969 2.109-3.656 3.75-4.969-0.914-0.914-1.812-1.844-2.719-2.766zM12 6.984c-0.656 0-1.266 0.141-1.828 0.375l-2.156-2.156c1.219-0.469 2.578-0.703 3.984-0.703 5.016 0 9.234 3.094 10.969 7.5-0.75 1.875-1.922 3.469-3.422 4.734l-2.906-2.906c0.234-0.563 0.375-1.172 0.375-1.828 0-2.766-2.25-5.016-5.016-5.016z"},null,-1))]))],8,_)])):e.createCommentVNode("",!0)])])),r.showStrengthMeter?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass([r.strengthMeterClass])},[e.createElementVNode("div",{class:e.normalizeClass([r.strengthMeterFillClass]),"data-score":a.passwordStrength},null,10,b)],2)):e.createCommentVNode("",!0)])}const V=w(c,[["render",S]]),n={install(s){s.component("Password",V)}};typeof window<"u"&&window.Vue&&(window.VuePasswordStrengthMeter=n),l.default=n,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,130 +1,84 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vue3-password-strength-meter",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"private": false,
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"@vue/
|
|
8
|
-
"@
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"vue": "^3.2.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
},
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"Vue",
|
|
86
|
-
"Vue3",
|
|
87
|
-
"password",
|
|
88
|
-
"password strength",
|
|
89
|
-
"security"
|
|
90
|
-
],
|
|
91
|
-
"main": "dist/vue3-password-strength-meter.js",
|
|
92
|
-
"browser": "dist/vue3-password-strength-meter.min.js",
|
|
93
|
-
"scripts": {
|
|
94
|
-
"play": "vue-play start",
|
|
95
|
-
"play:build": "vue-play build",
|
|
96
|
-
"dev": "node build/dev-server.js",
|
|
97
|
-
"build": "npm run release",
|
|
98
|
-
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
|
|
99
|
-
"lint": "eslint --ext .js,.vue src test/unit/specs",
|
|
100
|
-
"prepublish": "npm run lint && npm run build",
|
|
101
|
-
"release": "cross-env NODE_ENV=production webpack --progress --config ./build/webpack.release.js && cross-env NODE_ENV=production webpack --progress --config ./build/webpack.release.min.js"
|
|
102
|
-
},
|
|
103
|
-
"files": [
|
|
104
|
-
"dist"
|
|
105
|
-
],
|
|
106
|
-
"peerDependencies": {
|
|
107
|
-
"zxcvbn": "^4.4.2"
|
|
108
|
-
},
|
|
109
|
-
"engines": {
|
|
110
|
-
"node": ">= 4.0.0",
|
|
111
|
-
"npm": ">= 3.0.0"
|
|
112
|
-
},
|
|
113
|
-
"greenkeeper": {
|
|
114
|
-
"ignore": [
|
|
115
|
-
"extract-text-webpack-plugin",
|
|
116
|
-
"karma-webpack",
|
|
117
|
-
"webpack",
|
|
118
|
-
"webpack-merge"
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
|
-
"homepage": "https://github.com/Asharif88/vue3-password-strength-meter#readme",
|
|
122
|
-
"dependencies": {
|
|
123
|
-
"babel-preset-env": "^1.7.0",
|
|
124
|
-
"webpack-cli": "^4.0.0"
|
|
125
|
-
},
|
|
126
|
-
"directories": {
|
|
127
|
-
"doc": "docs",
|
|
128
|
-
"test": "test"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "vue3-password-strength-meter",
|
|
3
|
+
"version": "1.8.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"@vue/compiler-sfc": "^3.2.36",
|
|
8
|
+
"@babel/eslint-parser": "^7.28.6",
|
|
9
|
+
"autoprefixer": "^6.7.7",
|
|
10
|
+
"chalk": "^1.1.3",
|
|
11
|
+
"cross-env": "^3.2.4",
|
|
12
|
+
"eslint": "^9.0.0",
|
|
13
|
+
"eslint-config-standard": "^7.1.0",
|
|
14
|
+
"eslint-friendly-formatter": "^2.0.5",
|
|
15
|
+
"eslint-plugin-html": "^8.0.1",
|
|
16
|
+
"eslint-plugin-promise": "^3.5.0",
|
|
17
|
+
"eslint-plugin-standard": "^2.1.1",
|
|
18
|
+
"sass": "^1.70.0",
|
|
19
|
+
"vite": "^5.0.0",
|
|
20
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
21
|
+
"@babel/preset-env": "^7.22.0",
|
|
22
|
+
"@babel/plugin-transform-runtime": "^7.22.5",
|
|
23
|
+
"eslint-plugin-vue": "^9.10.0",
|
|
24
|
+
"vue-eslint-parser": "^9.1.0"
|
|
25
|
+
},
|
|
26
|
+
"description": "Interactive password strength meter based on zxcvbn",
|
|
27
|
+
"author": "Ahmad Sharif <ahmad.sharif@live.com>",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+ssh://git@github.com/Asharif88/vue3-password-strength-meter.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/asharif88/vue3-password-strength-meter/issues"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"vue.js",
|
|
38
|
+
"Vue",
|
|
39
|
+
"Vue3",
|
|
40
|
+
"password",
|
|
41
|
+
"password strength",
|
|
42
|
+
"security"
|
|
43
|
+
],
|
|
44
|
+
"main": "dist/vue3-password-strength-meter.cjs.js",
|
|
45
|
+
"module": "dist/vue3-password-strength-meter.es.js",
|
|
46
|
+
"browser": "dist/vue3-password-strength-meter.umd.js",
|
|
47
|
+
"scripts": {
|
|
48
|
+
"play": "vue-play start",
|
|
49
|
+
"play:build": "vue-play build",
|
|
50
|
+
"dev": "vite",
|
|
51
|
+
"build": "vite build",
|
|
52
|
+
"unit": "echo \"No unit test runner configured. To add tests, install and configure a runner like Vitest or Jest.\"",
|
|
53
|
+
"lint": "eslint --ext .js --ext .vue src test/unit",
|
|
54
|
+
"prepublishOnly": "npm run lint && npm run build",
|
|
55
|
+
"publish": "npm publish --access public"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist"
|
|
59
|
+
],
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"zxcvbn": "^4.4.2",
|
|
62
|
+
"vue": "^3.2.0"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">= 4.0.0",
|
|
66
|
+
"npm": ">= 3.0.0"
|
|
67
|
+
},
|
|
68
|
+
"greenkeeper": {
|
|
69
|
+
"ignore": [
|
|
70
|
+
"extract-text-webpack-plugin",
|
|
71
|
+
"karma-webpack",
|
|
72
|
+
"webpack",
|
|
73
|
+
"webpack-merge"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"homepage": "https://github.com/Asharif88/vue3-password-strength-meter#readme",
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@babel/runtime": "^7.22.6"
|
|
79
|
+
},
|
|
80
|
+
"directories": {
|
|
81
|
+
"doc": "docs",
|
|
82
|
+
"test": "test"
|
|
83
|
+
}
|
|
84
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
### [1.7.8]
|
|
6
|
-
|
|
7
|
-
* Removed option referenceValue that was causing a reference error in production
|
|
8
|
-
|
|
9
|
-
### [1.7.7]
|
|
10
|
-
|
|
11
|
-
Forked from aperturless/vue-password-strength-meter
|
|
12
|
-
* Updated to be compatible with vue 3.2.36
|
|
13
|
-
* Updated webpack to v4
|