@teselia/password 0.0.0-stage → 1.0.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.
@@ -0,0 +1,607 @@
1
+ import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, defineCustomElement as o, mergeDefaults as s, normalizeClass as c, onBeforeUnmount as l, onMounted as u, openBlock as d, reactive as f, ref as p, renderList as m, toDisplayString as h, unref as g, useAttrs as _, useHost as ee, useTemplateRef as te, watch as v, watchEffect as y, withModifiers as b } from "vue";
2
+ // ../shared/src/use-announcer.ts
3
+ var x = 500, S = 100;
4
+ function C() {
5
+ let e = p(""), t;
6
+ function n() {
7
+ clearTimeout(t), e.value = "";
8
+ }
9
+ function r(r) {
10
+ n(), t = setTimeout(() => {
11
+ e.value = r;
12
+ }, S);
13
+ }
14
+ function i(r) {
15
+ n(), t = setTimeout(() => {
16
+ e.value = r();
17
+ }, x);
18
+ }
19
+ return l(() => clearTimeout(t)), {
20
+ announcement: e,
21
+ announceNow: r,
22
+ announceOnceTypingPauses: i,
23
+ clear: n
24
+ };
25
+ }
26
+ // ../shared/src/use-custom-states.ts
27
+ function ne(e, t) {
28
+ y(() => {
29
+ let n = e.states;
30
+ if (n) for (let [e, r] of Object.entries(t())) r ? n.add(e) : n.delete(e);
31
+ });
32
+ }
33
+ // src/composables/use-caps-lock.ts
34
+ function re({ props: e, announceNow: t }) {
35
+ let n = p(!1);
36
+ function r(r) {
37
+ let i = r.getModifierState("CapsLock");
38
+ i && !n.value && t(e.textCapsLock), n.value = i;
39
+ }
40
+ function i() {
41
+ n.value = !1;
42
+ }
43
+ return {
44
+ capsLockOn: n,
45
+ readCapsLock: r,
46
+ forgetCapsLock: i
47
+ };
48
+ }
49
+ // src/core/purpose.ts
50
+ var w = {
51
+ current: "current-password",
52
+ new: "new-password"
53
+ };
54
+ function T(e) {
55
+ return e === "current" || e === "new";
56
+ }
57
+ function E(e) {
58
+ return T(e) ? e : "current";
59
+ }
60
+ function D(e, t) {
61
+ return t?.trim() ? t : w[e];
62
+ }
63
+ var O = [
64
+ "lowercase",
65
+ "uppercase",
66
+ "digit",
67
+ "symbol"
68
+ ], k = {
69
+ lowercase: /\p{Ll}/u,
70
+ uppercase: /[\p{Lu}\p{Lt}]/u,
71
+ digit: /\p{Nd}/u,
72
+ symbol: /[^\p{L}\p{N}\s]/u
73
+ }, A = {
74
+ lowercase: "lower",
75
+ uppercase: "upper",
76
+ digit: "digit",
77
+ symbol: "special"
78
+ };
79
+ function j(e) {
80
+ if (e == null || e === "") return null;
81
+ let t = Number(e);
82
+ return Number.isInteger(t) && t > 0 ? t : null;
83
+ }
84
+ function M(e) {
85
+ return O.includes(e);
86
+ }
87
+ function N(e) {
88
+ let t = j(e.minlength) ?? 8, n = j(e.maxlength), r = String(e.requirements ?? "").toLowerCase().split(/[\s,]+/).filter(Boolean);
89
+ return {
90
+ minLength: t,
91
+ maxLength: n !== null && n >= t ? n : null,
92
+ classes: O.filter((e) => r.includes(e)),
93
+ unknown: [...new Set(r.filter((e) => !M(e)))]
94
+ };
95
+ }
96
+ function P(e) {
97
+ return [...e].length;
98
+ }
99
+ function F(e, t) {
100
+ return [{
101
+ requirement: "length",
102
+ met: P(e) >= t.minLength
103
+ }, ...t.classes.map((t) => ({
104
+ requirement: t,
105
+ met: k[t].test(e)
106
+ }))];
107
+ }
108
+ function I(e, t) {
109
+ return F(e, t).every((e) => e.met);
110
+ }
111
+ function L(e, t) {
112
+ return t.maxLength !== null && P(e) > t.maxLength;
113
+ }
114
+ function R(e) {
115
+ return [
116
+ `minlength: ${e.minLength};`,
117
+ e.maxLength !== null && `maxlength: ${e.maxLength};`,
118
+ ...e.classes.map((e) => `required: ${A[e]};`),
119
+ "allowed: lower, upper, digit, special;"
120
+ ].filter(Boolean).join(" ");
121
+ }
122
+ // src/composables/use-field-options.ts
123
+ function ie(e) {
124
+ let n = t(() => E(e.purpose)), r = t(() => n.value === "new" ? N({
125
+ minlength: e.minlength,
126
+ maxlength: e.maxlength,
127
+ requirements: e.requirements
128
+ }) : null);
129
+ return {
130
+ purpose: n,
131
+ ruleOptions: r,
132
+ autocomplete: t(() => D(n.value, e.autocomplete)),
133
+ rulesForPasswordManagers: t(() => r.value ? R(r.value) : void 0)
134
+ };
135
+ }
136
+ // src/composables/use-public-events.ts
137
+ function ae(e) {
138
+ function t(t) {
139
+ let n = {
140
+ value: e.value,
141
+ requirementsMet: e.requirementsMet
142
+ };
143
+ e.dispatchEvent(new CustomEvent(t, {
144
+ bubbles: !0,
145
+ composed: !0,
146
+ detail: n
147
+ }));
148
+ }
149
+ return {
150
+ dispatchInput: () => t("input"),
151
+ dispatchChange: () => t("change")
152
+ };
153
+ }
154
+ // src/core/changes.ts
155
+ function z(e, t) {
156
+ let n = new Map(e.map((e) => [e.requirement, e.met])), r = t.filter((e) => n.get(e.requirement) !== e.met);
157
+ return r.length === 0 ? null : {
158
+ met: r.filter((e) => e.met).map((e) => e.requirement),
159
+ unmet: r.filter((e) => !e.met).map((e) => e.requirement),
160
+ allMet: t.every((e) => e.met)
161
+ };
162
+ }
163
+ // src/composables/use-requirements.ts
164
+ function oe({ host: e, props: n, ruleOptions: r, announceOnceTypingPauses: i }) {
165
+ let a = t(() => r.value ? F(e.state.value, r.value) : []), o = t(() => a.value.map((e) => ({
166
+ ...e,
167
+ text: l(e.requirement)
168
+ }))), s = a.value, c = !1;
169
+ function l(e) {
170
+ return {
171
+ length: n.textRuleLength.replaceAll("{minlength}", String(r.value?.minLength ?? "")),
172
+ lowercase: n.textRuleLowercase,
173
+ uppercase: n.textRuleUppercase,
174
+ digit: n.textRuleDigit,
175
+ symbol: n.textRuleSymbol
176
+ }[e];
177
+ }
178
+ function u(e) {
179
+ return e.allMet ? n.textAllMet : a.value.filter((t) => e.met.includes(t.requirement) || e.unmet.includes(t.requirement)).map((e) => `${l(e.requirement)}, ${e.met ? n.textRuleMet : n.textRuleUnmet}`).join(". ");
180
+ }
181
+ function d() {
182
+ r.value && (c = !0, i(() => {
183
+ c = !1;
184
+ let e = z(s, a.value);
185
+ return s = a.value, e ? u(e) : "";
186
+ }));
187
+ }
188
+ return v(a, (e) => {
189
+ c || (s = e);
190
+ }), {
191
+ requirementItems: o,
192
+ reportUserChange: d
193
+ };
194
+ }
195
+ // src/composables/use-reveal.ts
196
+ function se({ host: e, props: n, input: r, announceNow: i }) {
197
+ let a = t(() => e.state.revealed), o = t(() => a.value ? "text" : "password"), s = t(() => a.value ? n.textHideLabel : n.textShowLabel);
198
+ function c() {
199
+ e.revealed = !e.revealed, i(e.revealed ? n.textShown : n.textHidden);
200
+ }
201
+ function d() {
202
+ e.revealed = !1;
203
+ }
204
+ function f(e) {
205
+ e.target === r.value?.form && d();
206
+ }
207
+ return u(() => {
208
+ window.addEventListener("submit", f, !0), window.addEventListener("reset", f, !0), window.addEventListener("pagehide", d);
209
+ }), l(() => {
210
+ window.removeEventListener("submit", f, !0), window.removeEventListener("reset", f, !0), window.removeEventListener("pagehide", d);
211
+ }), {
212
+ revealed: a,
213
+ inputType: o,
214
+ toggleLabel: s,
215
+ toggleByUser: c
216
+ };
217
+ }
218
+ // src/core/validation.ts
219
+ function B({ value: e, required: t, ruleOptions: n, customError: r }, i) {
220
+ return r ? {
221
+ flag: "customError",
222
+ message: r
223
+ } : e === "" ? t ? {
224
+ flag: "valueMissing",
225
+ message: i.required
226
+ } : null : n ? L(e, n) ? {
227
+ flag: "tooLong",
228
+ message: i.tooLong.replaceAll("{maxlength}", String(n.maxLength))
229
+ } : I(e, n) ? null : {
230
+ flag: "unmet",
231
+ message: i.unmet
232
+ } : null;
233
+ }
234
+ // src/composables/use-validation.ts
235
+ function ce({ host: e, props: n, input: r, ruleOptions: i }) {
236
+ let { state: a } = e, o = t(() => B({
237
+ value: a.value,
238
+ required: n.required,
239
+ ruleOptions: i.value,
240
+ customError: a.customError
241
+ }, {
242
+ required: n.textRequired,
243
+ unmet: n.textUnmet,
244
+ tooLong: n.textTooLong
245
+ })), s = t(() => a.errorsVisible ? o.value : null);
246
+ function c() {
247
+ a.edited = !0, a.customError = "";
248
+ }
249
+ function d() {
250
+ a.errorsVisible = !0;
251
+ }
252
+ function f() {
253
+ a.edited && d();
254
+ }
255
+ function p(e) {
256
+ e.target === r.value?.form && (a.edited = !1, a.errorsVisible = !1, a.customError = "");
257
+ }
258
+ return y(() => r.value?.setCustomValidity(o.value?.message ?? ""), { flush: "sync" }), u(() => window.addEventListener("reset", p, !0)), l(() => window.removeEventListener("reset", p, !0)), {
259
+ visibleError: s,
260
+ markEdited: c,
261
+ revealErrors: d,
262
+ revealErrorsIfEdited: f
263
+ };
264
+ }
265
+ // src/composables/use-value-sync.ts
266
+ function V({ host: e, input: t }) {
267
+ function n() {
268
+ t.value && (e.state.value = t.value.value);
269
+ }
270
+ function r(e) {
271
+ e.target === t.value?.form && setTimeout(n);
272
+ }
273
+ return u(() => {
274
+ n(), window.addEventListener("reset", r, !0);
275
+ }), l(() => window.removeEventListener("reset", r, !0)), { syncFromInput: n };
276
+ }
277
+ // src/core/ids.ts
278
+ var H = 0;
279
+ function U(e) {
280
+ return H += 1, `${e}-${H}`;
281
+ }
282
+ // src/props.ts
283
+ var W = {
284
+ required: !1,
285
+ disabled: !1,
286
+ readonly: !1,
287
+ textShow: "Show",
288
+ textHide: "Hide",
289
+ textShowLabel: "Show password",
290
+ textHideLabel: "Hide password",
291
+ textShown: "Your password is shown",
292
+ textHidden: "Your password is hidden",
293
+ textRequirements: "Your password must have:",
294
+ textRuleLength: "At least {minlength} characters",
295
+ textRuleLowercase: "A lowercase letter",
296
+ textRuleUppercase: "An uppercase letter",
297
+ textRuleDigit: "A number",
298
+ textRuleSymbol: "A symbol, like ! or #",
299
+ textRuleMet: "done",
300
+ textRuleUnmet: "not yet",
301
+ textAllMet: "All requirements met",
302
+ textCapsLock: "Caps Lock is on",
303
+ textRequired: "Enter a password",
304
+ textUnmet: "Your password does not meet all the requirements",
305
+ textTooLong: "Use {maxlength} characters or fewer"
306
+ }, le = { class: "tes-password__field" }, ue = ["for"], de = [
307
+ "id",
308
+ "type",
309
+ "name",
310
+ "^value",
311
+ "autocomplete",
312
+ "passwordrules",
313
+ "aria-describedby",
314
+ "aria-invalid",
315
+ "required",
316
+ "disabled",
317
+ "readonly"
318
+ ], fe = ["aria-label"], pe = { class: "tes-password__requirements-title" }, me = { class: "tes-password__requirements-list" }, he = {
319
+ key: 0,
320
+ class: "tes-password__icon tes-password__icon--met",
321
+ viewBox: "0 0 16 16",
322
+ "aria-hidden": "true",
323
+ focusable: "false"
324
+ }, ge = {
325
+ key: 1,
326
+ class: "tes-password__icon tes-password__icon--unmet",
327
+ viewBox: "0 0 16 16",
328
+ "aria-hidden": "true",
329
+ focusable: "false"
330
+ }, G = { class: "tes-password__visually-hidden" }, _e = {
331
+ role: "status",
332
+ class: "tes-password__visually-hidden"
333
+ }, K = o(/* @__PURE__ */ a({
334
+ inheritAttrs: !1,
335
+ __name: "TesPassword",
336
+ props: /*@__PURE__*/ s({
337
+ label: {},
338
+ name: {},
339
+ hint: {},
340
+ required: { type: Boolean },
341
+ disabled: { type: Boolean },
342
+ readonly: { type: Boolean },
343
+ purpose: {},
344
+ minlength: {},
345
+ maxlength: {},
346
+ requirements: {},
347
+ autocomplete: {},
348
+ textShow: {},
349
+ textHide: {},
350
+ textShowLabel: {},
351
+ textHideLabel: {},
352
+ textShown: {},
353
+ textHidden: {},
354
+ textRequirements: {},
355
+ textRuleLength: {},
356
+ textRuleLowercase: {},
357
+ textRuleUppercase: {},
358
+ textRuleDigit: {},
359
+ textRuleSymbol: {},
360
+ textRuleMet: {},
361
+ textRuleUnmet: {},
362
+ textAllMet: {},
363
+ textCapsLock: {},
364
+ textRequired: {},
365
+ textUnmet: {},
366
+ textTooLong: {}
367
+ }, W),
368
+ setup(a) {
369
+ let o = a, s = _(), l = ee(), u = te("input"), f = U("tes-password"), p = `${f}-requirements`, y = `${f}-caps-lock`, x = `${f}-hint`, S = `${f}-error`, w = t(() => typeof s.value == "string" ? s.value : void 0), { announcement: T, announceNow: E, announceOnceTypingPauses: D } = C(), { ruleOptions: O, autocomplete: k, rulesForPasswordManagers: A } = ie(o), { revealed: j, inputType: M, toggleLabel: N, toggleByUser: P } = se({
370
+ host: l,
371
+ props: o,
372
+ input: u,
373
+ announceNow: E
374
+ }), { syncFromInput: F } = V({
375
+ host: l,
376
+ input: u
377
+ }), { requirementItems: I, reportUserChange: L } = oe({
378
+ host: l,
379
+ props: o,
380
+ ruleOptions: O,
381
+ announceOnceTypingPauses: D
382
+ }), { capsLockOn: R, readCapsLock: z, forgetCapsLock: B } = re({
383
+ props: o,
384
+ announceNow: E
385
+ }), { visibleError: H, markEdited: W, revealErrors: K, revealErrorsIfEdited: q } = ce({
386
+ host: l,
387
+ props: o,
388
+ input: u,
389
+ ruleOptions: O
390
+ }), J = t(() => {
391
+ let e = [
392
+ o.hint && x,
393
+ I.value.length > 0 && p,
394
+ R.value && y,
395
+ H.value && S
396
+ ].filter(Boolean);
397
+ return e.length > 0 ? e.join(" ") : void 0;
398
+ }), { dispatchInput: Y, dispatchChange: X } = ae(l);
399
+ function Z() {
400
+ W(), F(), L(), Y();
401
+ }
402
+ v(() => o.disabled, (e) => {
403
+ e && (l.revealed = !1);
404
+ }), ne(l.internals, () => ({
405
+ invalid: H.value !== null,
406
+ empty: l.state.value === "",
407
+ revealed: j.value,
408
+ "requirements-met": I.value.length > 0 && I.value.every((e) => e.met),
409
+ "caps-lock": R.value
410
+ }));
411
+ function Q() {
412
+ B(), q();
413
+ }
414
+ return (t, o) => (d(), r("div", le, [
415
+ i("label", {
416
+ for: g(f),
417
+ class: "tes-password__label"
418
+ }, h(a.label), 9, ue),
419
+ i("div", { class: c(["tes-password__control", { "tes-password__control--invalid": g(H) }]) }, [i("input", {
420
+ id: g(f),
421
+ ref_key: "input",
422
+ ref: u,
423
+ class: "tes-password__input",
424
+ type: g(M),
425
+ name: a.name,
426
+ "^value": w.value,
427
+ autocomplete: g(k),
428
+ passwordrules: g(A),
429
+ "aria-describedby": J.value,
430
+ "aria-invalid": g(H) ? "true" : void 0,
431
+ required: a.required,
432
+ disabled: a.disabled,
433
+ readonly: a.readonly,
434
+ spellcheck: "false",
435
+ autocapitalize: "off",
436
+ autocorrect: "off",
437
+ onInput: b(Z, ["stop"]),
438
+ onChange: o[0] ||= b((...e) => g(X) && g(X)(...e), ["stop"]),
439
+ onKeydown: o[1] ||= (...e) => g(z) && g(z)(...e),
440
+ onKeyup: o[2] ||= (...e) => g(z) && g(z)(...e),
441
+ onPointerdown: o[3] ||= (...e) => g(z) && g(z)(...e),
442
+ onBlur: Q,
443
+ onInvalid: o[4] ||= (...e) => g(K) && g(K)(...e)
444
+ }, null, 40, de), i("button", {
445
+ type: "button",
446
+ class: "tes-password__toggle",
447
+ "aria-label": g(N),
448
+ onClick: o[5] ||= (...e) => g(P) && g(P)(...e)
449
+ }, [i("span", { class: c(["tes-password__toggle-text", { "tes-password__toggle-text--inactive": g(j) }]) }, h(a.textShow), 3), i("span", { class: c(["tes-password__toggle-text", { "tes-password__toggle-text--inactive": !g(j) }]) }, h(a.textHide), 3)], 8, fe)], 2),
450
+ a.hint ? (d(), r("p", {
451
+ key: 0,
452
+ id: x,
453
+ class: "tes-password__hint"
454
+ }, h(a.hint), 1)) : n("", !0),
455
+ g(R) ? (d(), r("p", {
456
+ key: 1,
457
+ id: y,
458
+ class: "tes-password__caps-lock"
459
+ }, h(a.textCapsLock), 1)) : n("", !0),
460
+ g(I).length ? (d(), r("div", {
461
+ key: 2,
462
+ id: p,
463
+ class: "tes-password__requirements"
464
+ }, [i("p", pe, h(a.textRequirements), 1), i("ul", me, [(d(!0), r(e, null, m(g(I), (e) => (d(), r("li", {
465
+ key: e.requirement,
466
+ class: c(["tes-password__requirement", { "tes-password__requirement--met": e.met }])
467
+ }, [
468
+ e.met ? (d(), r("svg", he, [...o[6] ||= [i("path", { d: "M3.5 8.5l3 3 6-7" }, null, -1)]])) : (d(), r("svg", ge, [...o[7] ||= [i("circle", {
469
+ cx: "8",
470
+ cy: "8",
471
+ r: "5"
472
+ }, null, -1)]])),
473
+ i("span", null, h(e.text), 1),
474
+ i("span", G, ", " + h(e.met ? a.textRuleMet : a.textRuleUnmet), 1)
475
+ ], 2))), 128))])])) : n("", !0),
476
+ i("p", {
477
+ id: S,
478
+ class: "tes-password__error",
479
+ "aria-live": "polite"
480
+ }, h(g(H)?.message), 1),
481
+ i("div", _e, h(g(T)), 1)
482
+ ]));
483
+ }
484
+ }), { shadowRoot: !1 }), q = class extends K {
485
+ state = f({
486
+ revealed: !1,
487
+ value: "",
488
+ edited: !1,
489
+ errorsVisible: !1,
490
+ customError: ""
491
+ });
492
+ internals;
493
+ pendingValue = null;
494
+ constructor(e) {
495
+ super(e), this.internals = this.attachInternals();
496
+ }
497
+ get revealed() {
498
+ return this.state.revealed;
499
+ }
500
+ set revealed(e) {
501
+ e !== this.state.revealed && (this.state.revealed = e, this.syncInputType(), this.dispatchEvent(new CustomEvent("revealchange", {
502
+ bubbles: !0,
503
+ composed: !0,
504
+ detail: { revealed: e }
505
+ })));
506
+ }
507
+ get value() {
508
+ return this.input?.value ?? this.pendingValue ?? this.defaultValue;
509
+ }
510
+ set value(e) {
511
+ let t = this.input;
512
+ t ? t.value = e : this.pendingValue = e, this.state.value = e;
513
+ }
514
+ get requirementsMet() {
515
+ if (E(this.getAttribute("purpose")) !== "new") return !0;
516
+ let e = N({
517
+ minlength: this.getAttribute("minlength"),
518
+ maxlength: this.getAttribute("maxlength"),
519
+ requirements: this.getAttribute("requirements")
520
+ });
521
+ return I(this.state.value, e);
522
+ }
523
+ get defaultValue() {
524
+ return this.getAttribute("value") ?? "";
525
+ }
526
+ set defaultValue(e) {
527
+ this.setAttribute("value", e);
528
+ }
529
+ get minLength() {
530
+ return N({ minlength: this.getAttribute("minlength") }).minLength;
531
+ }
532
+ set minLength(e) {
533
+ this.setAttribute("minlength", String(e));
534
+ }
535
+ get maxLength() {
536
+ return N({
537
+ minlength: 1,
538
+ maxlength: this.getAttribute("maxlength")
539
+ }).maxLength ?? -1;
540
+ }
541
+ set maxLength(e) {
542
+ this.setAttribute("maxlength", String(e));
543
+ }
544
+ get readOnly() {
545
+ return this.hasAttribute("readonly");
546
+ }
547
+ set readOnly(e) {
548
+ this.toggleAttribute("readonly", e);
549
+ }
550
+ get form() {
551
+ return this.input?.form ?? null;
552
+ }
553
+ get validity() {
554
+ return (this.input ?? document.createElement("input")).validity;
555
+ }
556
+ get validationMessage() {
557
+ return this.input?.validationMessage ?? "";
558
+ }
559
+ get willValidate() {
560
+ return this.input?.willValidate ?? !1;
561
+ }
562
+ setCustomValidity(e) {
563
+ this.state.customError = e, e && (this.state.errorsVisible = !0);
564
+ }
565
+ checkValidity() {
566
+ return this.input?.checkValidity() ?? !0;
567
+ }
568
+ reportValidity() {
569
+ return this.input?.reportValidity() ?? !0;
570
+ }
571
+ connectedCallback() {
572
+ super.connectedCallback(), this.applyPendingValue();
573
+ }
574
+ focus(e) {
575
+ this.input?.focus(e);
576
+ }
577
+ get input() {
578
+ return this.querySelector(".tes-password__input");
579
+ }
580
+ syncInputType() {
581
+ let e = this.input;
582
+ e && (e.type = this.state.revealed ? "text" : "password");
583
+ }
584
+ applyPendingValue() {
585
+ let e = this.input;
586
+ e && this.pendingValue !== null && (e.value = this.pendingValue, this.state.value = this.pendingValue, this.pendingValue = null);
587
+ }
588
+ }, J = ":where(tes-password){--_text:var(--tes-color-text,light-dark(#1f2328,#e8eaee));--_muted:var(--tes-color-muted,light-dark(#59636e,#a3adba));--_bg:var(--tes-color-bg,light-dark(#fff,#16181d));--_border:var(--tes-color-border,light-dark(#7d8590,#7f8a99));--_accent:var(--tes-color-accent,light-dark(#0b5fcc,#7aa7ff));--_on-accent:var(--tes-color-on-accent,light-dark(#fff,#0d1117));--_hover:var(--tes-color-hover,light-dark(#eef3fb,#232a36));--_focus:var(--tes-color-focus,light-dark(#0b5fcc,#7aa7ff));--_error:var(--tes-color-error,light-dark(#c4232b,#ff8a80));--_success:var(--tes-color-success,light-dark(#1f7a3a,#4cc26a));--_radius:var(--tes-radius,.375rem);--_space:var(--tes-space,.5rem);--_control-height:2.75rem;color:var(--_text);font-family:var(--tes-font-family);font-size:var(--tes-font-size);display:inline-block}:where(tes-password[hidden]){display:none}:where(.tes-password__field){gap:calc(var(--_space) / 2);grid-template-columns:minmax(0,1fr);display:grid}:where(.tes-password__label){font-weight:500}:where(.tes-password__control){box-sizing:border-box;block-size:var(--_control-height);border:1px solid var(--_border);border-radius:var(--_radius);background:var(--_bg);display:flex}:where(.tes-password__control--invalid){border:2px solid var(--_error)}:where(.tes-password__control:has(.tes-password__input:focus-visible)){outline:2px solid var(--_focus);outline-offset:2px}:where(.tes-password__input){box-sizing:border-box;border-radius:var(--_radius);min-inline-size:0;color:var(--_text);font:inherit;background:0 0;border:0;outline:none;flex:1;margin:0;padding-inline:.75rem;font-size:max(1em,16px)}:where(.tes-password__toggle){border-radius:var(--_radius);min-inline-size:2.75rem;color:var(--_accent);font:inherit;cursor:pointer;background:0 0;border:0;flex:none;place-items:center;margin:0;padding-inline:.75rem;font-weight:500;display:grid}:where(.tes-password__control:has(.tes-password__input:disabled)){background:color-mix(in srgb, var(--_muted) 12%, var(--_bg))}:where(.tes-password__input:disabled){color:var(--_muted);cursor:not-allowed}:where(.tes-password__input:disabled~.tes-password__toggle){display:none}:where(.tes-password__toggle-text){grid-area:1/1}:where(.tes-password__toggle-text--inactive){visibility:hidden}:where(.tes-password__toggle:hover){background:var(--_hover)}:where(.tes-password__toggle:focus-visible){outline:2px solid var(--_focus);outline-offset:-2px}:where(.tes-password__hint){color:var(--_muted);margin:0;padding-block-start:.25rem;font-size:.875em}:where(.tes-password__caps-lock){margin:0;padding-block-start:.25rem;font-size:.875em;font-weight:500}:where(.tes-password__requirements){color:var(--_muted);padding-block-start:.25rem;font-size:.875em}:where(.tes-password__requirements-title){margin:0}:where(.tes-password__requirements-list){gap:.125rem;margin:.25rem 0 0;padding:0;list-style:none;display:grid}:where(.tes-password__requirement){align-items:center;gap:.375rem;margin:0;display:flex}:where(.tes-password__requirement--met){color:var(--_text)}:where(.tes-password__icon){fill:none;stroke:currentColor;stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round;flex:none;block-size:1em;inline-size:1em}:where(.tes-password__icon--met){stroke:var(--_success);stroke-width:2px}:where(.tes-password__error){color:var(--_error);margin:0;font-size:.875em;font-weight:500}:where(.tes-password__error:empty){display:none}:where(.tes-password__visually-hidden){clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (forced-colors:active){:where(.tes-password__control:has(.tes-password__input:focus-visible)),:where(.tes-password__toggle:focus-visible){outline-color:highlight}:where(.tes-password__input:disabled){color:graytext}}", Y = ":where(tes-password";
589
+ function X(e) {
590
+ return J.replaceAll(Y, `:where(${e}`);
591
+ }
592
+ function Z(e) {
593
+ if (typeof document > "u" || typeof CSSStyleSheet > "u") return;
594
+ let t = new CSSStyleSheet();
595
+ t.replaceSync(X(e)), document.adoptedStyleSheets = [...document.adoptedStyleSheets, t];
596
+ }
597
+ // src/index.ts
598
+ var Q = "tes-password";
599
+ function $(e = Q) {
600
+ if (typeof customElements > "u" || customElements.get(e)) return;
601
+ let t = class extends q {};
602
+ customElements.define(e, e === "tes-password" ? q : t), Z(e);
603
+ }
604
+ $();
605
+ export { Q as TAG_NAME, q as TesPasswordElement, $ as define };
606
+
607
+ //# sourceMappingURL=tes-password.js.map