@loomidev/password 0.2.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/LICENSE +21 -0
- package/README.md +156 -0
- package/custom-elements.json +863 -0
- package/dist/generated/styles.css.d.ts +3 -0
- package/dist/generated/styles.css.d.ts.map +1 -0
- package/dist/generated/styles.css.js +5 -0
- package/dist/generated/styles.css.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/loomi-password.d.ts +86 -0
- package/dist/loomi-password.d.ts.map +1 -0
- package/dist/loomi-password.js +377 -0
- package/dist/loomi-password.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../src/generated/styles.css.ts"],"names":[],"mappings":"AAGA,+EAA+E;AAC/E,eAAO,MAAM,eAAe,yBAA69I,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Generated by @loomidev/password — do not edit by hand. Run `pnpm build` to regenerate.
|
|
2
|
+
import { unsafeCSS } from "lit";
|
|
3
|
+
/** Compiled, Shadow-DOM-scoped styles. Colors resolve via `var(--loomi-*)`. */
|
|
4
|
+
export const componentStyles = unsafeCSS("/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */\n@layer theme,base,components,utilities;:host{margin-bottom:var(--loomi-field-spacing,var(--_loomi-field-spacing-default,1rem));--loomi-control-height:2.75rem;--loomi-control-pad-x:1rem;--loomi-control-font-size:1rem;display:block}:host([no-clearing]){margin-bottom:0}:host([hidden]){display:none}.loomi-prefix,.loomi-suffix{color:var(--loomi-text-muted);white-space:nowrap;flex:none;align-items:center;gap:.35rem;display:inline-flex}.loomi-prefix{padding-left:var(--loomi-control-pad-x)}.loomi-suffix{padding-right:var(--loomi-control-pad-x)}.loomi-affix-solid{background:var(--loomi-surface-hover);padding-left:var(--loomi-control-pad-x);padding-right:var(--loomi-control-pad-x);color:var(--loomi-text-secondary);align-self:stretch}.loomi-prefix.loomi-affix-solid{border-right:1px solid var(--loomi-surface-border);border-radius:.5rem 0 0 .5rem}.loomi-affix-dropdown{display:inline-flex;position:relative}.loomi-affix-trigger{color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;outline:0;align-items:center;gap:.35rem;min-width:3.25rem;max-width:9rem;padding:0;line-height:1;display:inline-flex}.loomi-affix-trigger:disabled{cursor:not-allowed}.loomi-affix-value{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.loomi-affix-chevron{width:.85em;height:.85em;color:var(--loomi-text-faint);flex:none;transition:transform .15s}.loomi-affix-dropdown.open .loomi-affix-chevron{transform:rotate(180deg)}.loomi-affix-panel{z-index:50;background:var(--loomi-surface);border:1px solid var(--loomi-surface-border);border-radius:.5rem;width:max-content;min-width:100%;max-width:12rem;padding:.25rem;position:absolute;top:calc(100% + .5rem);left:0;overflow:hidden;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a}.loomi-affix-option{cursor:pointer;color:var(--loomi-text);white-space:nowrap;border-radius:.375rem;justify-content:space-between;align-items:center;gap:.5rem;padding:.45rem .6rem;font-size:.9rem;display:flex}.loomi-affix-option:hover{background:var(--loomi-surface-hover)}.loomi-affix-option.selected{background:var(--loomi-primary-50,var(--_loomi-primary-50-default));color:var(--loomi-primary-700,var(--_loomi-primary-700-default));font-weight:500}.loomi-affix-check{width:.95em;height:.95em;color:var(--loomi-primary-600,var(--_loomi-primary-600-default));flex:none}.loomi-inputwrap{flex:auto;align-self:stretch;align-items:center;min-width:0;display:flex;position:relative}.loomi-input{width:100%;min-width:0;font:inherit;color:var(--loomi-text);padding:0 var(--loomi-control-pad-x);background:0 0;border:0;outline:0;flex:auto}.loomi-input::placeholder{color:var(--loomi-text-faint)}.loomi-input:disabled{cursor:not-allowed}.loomi-label{left:var(--loomi-control-pad-x);transform-origin:0;color:var(--loomi-text-faint);pointer-events:none;background:var(--loomi-surface);box-shadow:0 0 0 .25rem var(--loomi-surface);max-width:calc(100% - var(--loomi-control-pad-x));white-space:nowrap;text-overflow:ellipsis;padding-block:0;padding-inline:0;line-height:1;transition:all .15s;position:absolute;top:50%;overflow:hidden;transform:translateY(-50%)}.loomi-input:focus~.loomi-label,.loomi-input:not(:placeholder-shown)~.loomi-label,.force-float .loomi-label{color:var(--loomi-primary-600,var(--_loomi-primary-600-default));top:0;transform:translateY(-50%)scale(.85)}:host([invalid]) .loomi-input:focus~.loomi-label,:host([invalid]) .loomi-input:not(:placeholder-shown)~.loomi-label{color:var(--loomi-error-500,var(--_loomi-error-500-default))}.loomi-req{color:var(--loomi-error-500,var(--_loomi-error-500-default));margin-left:.15rem}.loomi-iconbtn{color:var(--loomi-text-faint);cursor:pointer;background:0 0;border:0;border-radius:.375rem;justify-content:center;align-items:center;padding:.25rem;display:inline-flex}.loomi-iconbtn:hover{color:var(--loomi-text-secondary)}.loomi-icon{flex:none;width:1.15em;height:1.15em}.loomi-strength{color:var(--loomi-text-muted);gap:.25rem;margin:.45rem 0 0;padding:0 0 0 10px;font-size:.8rem;list-style:none;display:grid}.loomi-strength-item{align-items:center;gap:.35rem;display:flex}.loomi-strength-check{width:1rem;height:1rem;color:var(--loomi-text-faint);flex:none;justify-content:center;align-items:center;display:inline-flex}.loomi-strength-item.met,.loomi-strength-item.met .loomi-strength-check{color:var(--loomi-password-strength-color,var(--loomi-success-700,var(--_loomi-success-700-default)))}.loomi-error{color:var(--loomi-error-500,var(--_loomi-error-500-default));margin:.35rem 0 0;font-size:.8rem}");
|
|
5
|
+
//# sourceMappingURL=styles.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.css.js","sourceRoot":"","sources":["../../src/generated/styles.css.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEhC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,+8IAA+8I,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,GAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from "lit";
|
|
2
|
+
import { LoomiElement, type LoomiFieldLabelPosition } from "@loomidev/core";
|
|
3
|
+
export type LoomiPasswordSize = "tiny" | "small" | "regular" | "medium" | "big";
|
|
4
|
+
export type LoomiPasswordVariant = "default" | "minimal";
|
|
5
|
+
export type LoomiPasswordStrengthToken = "A" | "a" | "1" | "#";
|
|
6
|
+
/**
|
|
7
|
+
* `<loomi-password>` — a form-associated password input with reveal, prefixes,
|
|
8
|
+
* inline validation and neutral strength requirements.
|
|
9
|
+
*
|
|
10
|
+
* @slot prefix - Custom prefix content (overrides the `prefix`/`prefix-icon` attributes).
|
|
11
|
+
* @csspart field - The bordered field container.
|
|
12
|
+
* @csspart input - The native `<input>`.
|
|
13
|
+
* @fires input - Native input event (composed).
|
|
14
|
+
* @fires change - Native change event (composed).
|
|
15
|
+
*/
|
|
16
|
+
export declare class LoomiPassword extends LoomiElement {
|
|
17
|
+
static styles: import("lit").CSSResultGroup[];
|
|
18
|
+
static formAssociated: boolean;
|
|
19
|
+
private internals;
|
|
20
|
+
private validationVisible;
|
|
21
|
+
private readonly instanceId;
|
|
22
|
+
name: string;
|
|
23
|
+
label: string;
|
|
24
|
+
labelPosition: LoomiFieldLabelPosition;
|
|
25
|
+
locale: string;
|
|
26
|
+
placeholder: string;
|
|
27
|
+
value: string;
|
|
28
|
+
required: boolean;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
readonly: boolean;
|
|
31
|
+
size: LoomiPasswordSize;
|
|
32
|
+
variant: LoomiPasswordVariant;
|
|
33
|
+
prefix: string;
|
|
34
|
+
prefixOptions: string;
|
|
35
|
+
prefixValue: string;
|
|
36
|
+
prefixIcon: string;
|
|
37
|
+
transparentPrefix: boolean;
|
|
38
|
+
viewable: boolean;
|
|
39
|
+
clearable: boolean;
|
|
40
|
+
strength: string;
|
|
41
|
+
strengthColor: string;
|
|
42
|
+
errorMessage: string;
|
|
43
|
+
showErrorInline: boolean;
|
|
44
|
+
showPlaceholderAlways: boolean;
|
|
45
|
+
invalid: boolean;
|
|
46
|
+
private revealed;
|
|
47
|
+
private prefixOpen;
|
|
48
|
+
private inputEl;
|
|
49
|
+
private cleanupClickOutside?;
|
|
50
|
+
connectedCallback(): void;
|
|
51
|
+
disconnectedCallback(): void;
|
|
52
|
+
willUpdate(_changed: PropertyValues<this>): void;
|
|
53
|
+
focus(): void;
|
|
54
|
+
clear(): void;
|
|
55
|
+
validate(): boolean;
|
|
56
|
+
checkValidity(): boolean;
|
|
57
|
+
reportValidity(): boolean;
|
|
58
|
+
private syncValidity;
|
|
59
|
+
private showValidation;
|
|
60
|
+
private emit;
|
|
61
|
+
private onInput;
|
|
62
|
+
private onChange;
|
|
63
|
+
private renderIcon;
|
|
64
|
+
private parseOptions;
|
|
65
|
+
private selectedPrefix;
|
|
66
|
+
private togglePrefixOpen;
|
|
67
|
+
private choosePrefix;
|
|
68
|
+
private onPrefixTriggerKeydown;
|
|
69
|
+
private renderPrefixDropdown;
|
|
70
|
+
private renderPrefix;
|
|
71
|
+
private renderSuffix;
|
|
72
|
+
private strengthRequirements;
|
|
73
|
+
private renderStrength;
|
|
74
|
+
render(): TemplateResult;
|
|
75
|
+
}
|
|
76
|
+
declare global {
|
|
77
|
+
interface HTMLElementTagNameMap {
|
|
78
|
+
"loomi-password": LoomiPassword;
|
|
79
|
+
}
|
|
80
|
+
interface HTMLElementEventMap {
|
|
81
|
+
"loomi-prefix-change": CustomEvent<{
|
|
82
|
+
value: string;
|
|
83
|
+
}>;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=loomi-password.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loomi-password.d.ts","sourceRoot":"","sources":["../src/loomi-password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9E,OAAO,EACL,YAAY,EAOZ,KAAK,uBAAuB,EAC7B,MAAM,gBAAgB,CAAC;AAIxB,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;AAChF,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,SAAS,CAAC;AACzD,MAAM,MAAM,0BAA0B,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAU/D;;;;;;;;;GASG;AACH,qBACa,aAAc,SAAQ,YAAY;IAC7C,OAAgB,MAAM,iCAAkE;IACxF,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;IAEhB,IAAI,SAAM;IAC3B,KAAK,SAAM;IAEvB,aAAa,EAAE,uBAAuB,CAAa;IACvC,MAAM,SAAM;IACZ,WAAW,SAAM;IACjB,KAAK,SAAM;IACqB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,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;IAED,UAAU,mBAAmB;QAG3B,qBAAqB,EAAE,WAAW,CAAC;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACvD;CACF"}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing } from "lit";
|
|
8
|
+
import { customElement, property, query, state } from "lit/decorators.js";
|
|
9
|
+
import { LoomiElement, controlSizeStyles, fieldStyles, loomiT, onClickOutside, randomSuffix, themeStyles, } from "@loomidev/core";
|
|
10
|
+
import { getLoomiIcon } from "@loomidev/icons";
|
|
11
|
+
import { componentStyles } from "./generated/styles.css.js";
|
|
12
|
+
const STRENGTH_ORDER = ["A", "a", "1", "#"];
|
|
13
|
+
/**
|
|
14
|
+
* `<loomi-password>` — a form-associated password input with reveal, prefixes,
|
|
15
|
+
* inline validation and neutral strength requirements.
|
|
16
|
+
*
|
|
17
|
+
* @slot prefix - Custom prefix content (overrides the `prefix`/`prefix-icon` attributes).
|
|
18
|
+
* @csspart field - The bordered field container.
|
|
19
|
+
* @csspart input - The native `<input>`.
|
|
20
|
+
* @fires input - Native input event (composed).
|
|
21
|
+
* @fires change - Native change event (composed).
|
|
22
|
+
*/
|
|
23
|
+
let LoomiPassword = class LoomiPassword extends LoomiElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.internals = this.attachInternals();
|
|
27
|
+
this.validationVisible = false;
|
|
28
|
+
this.instanceId = randomSuffix();
|
|
29
|
+
this.name = "";
|
|
30
|
+
this.label = "";
|
|
31
|
+
this.labelPosition = "default";
|
|
32
|
+
this.locale = "";
|
|
33
|
+
this.placeholder = "";
|
|
34
|
+
this.value = "";
|
|
35
|
+
this.required = false;
|
|
36
|
+
this.disabled = false;
|
|
37
|
+
this.readonly = false;
|
|
38
|
+
this.size = "medium";
|
|
39
|
+
this.variant = "default";
|
|
40
|
+
this.prefix = "";
|
|
41
|
+
this.prefixOptions = "";
|
|
42
|
+
this.prefixValue = "";
|
|
43
|
+
this.prefixIcon = "";
|
|
44
|
+
this.transparentPrefix = true;
|
|
45
|
+
this.viewable = true;
|
|
46
|
+
this.clearable = false;
|
|
47
|
+
this.strength = "";
|
|
48
|
+
this.strengthColor = "";
|
|
49
|
+
this.errorMessage = "";
|
|
50
|
+
this.showErrorInline = false;
|
|
51
|
+
this.showPlaceholderAlways = false;
|
|
52
|
+
this.invalid = false;
|
|
53
|
+
this.revealed = false;
|
|
54
|
+
this.prefixOpen = false;
|
|
55
|
+
this.onInput = (e) => {
|
|
56
|
+
this.value = e.target.value;
|
|
57
|
+
if (this.invalid)
|
|
58
|
+
this.validate();
|
|
59
|
+
this.emit("input");
|
|
60
|
+
};
|
|
61
|
+
this.onChange = () => {
|
|
62
|
+
this.emit("change");
|
|
63
|
+
};
|
|
64
|
+
this.onPrefixTriggerKeydown = (e) => {
|
|
65
|
+
if (e.key === "Escape")
|
|
66
|
+
this.prefixOpen = false;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static { this.styles = [themeStyles, controlSizeStyles, fieldStyles, componentStyles]; }
|
|
70
|
+
static { this.formAssociated = true; }
|
|
71
|
+
connectedCallback() {
|
|
72
|
+
super.connectedCallback();
|
|
73
|
+
this.cleanupClickOutside = onClickOutside(this, () => {
|
|
74
|
+
if (this.prefixOpen)
|
|
75
|
+
this.prefixOpen = false;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
disconnectedCallback() {
|
|
79
|
+
super.disconnectedCallback();
|
|
80
|
+
this.cleanupClickOutside?.();
|
|
81
|
+
}
|
|
82
|
+
willUpdate(_changed) {
|
|
83
|
+
this.internals.setFormValue(this.value);
|
|
84
|
+
this.syncValidity();
|
|
85
|
+
}
|
|
86
|
+
focus() {
|
|
87
|
+
this.inputEl?.focus();
|
|
88
|
+
}
|
|
89
|
+
clear() {
|
|
90
|
+
this.value = "";
|
|
91
|
+
this.internals.setFormValue("");
|
|
92
|
+
this.emit("input");
|
|
93
|
+
this.emit("change");
|
|
94
|
+
this.focus();
|
|
95
|
+
}
|
|
96
|
+
validate() {
|
|
97
|
+
this.validationVisible = true;
|
|
98
|
+
return this.syncValidity(true);
|
|
99
|
+
}
|
|
100
|
+
checkValidity() {
|
|
101
|
+
this.syncValidity();
|
|
102
|
+
return this.internals.checkValidity();
|
|
103
|
+
}
|
|
104
|
+
reportValidity() {
|
|
105
|
+
this.validationVisible = true;
|
|
106
|
+
this.syncValidity(true);
|
|
107
|
+
return this.internals.reportValidity();
|
|
108
|
+
}
|
|
109
|
+
syncValidity(showInvalid = this.validationVisible) {
|
|
110
|
+
const empty = this.required && !this.disabled && !this.readonly && this.value.trim() === "";
|
|
111
|
+
const weak = !empty &&
|
|
112
|
+
!this.disabled &&
|
|
113
|
+
!this.readonly &&
|
|
114
|
+
this.strengthRequirements().some((requirement) => !requirement.met);
|
|
115
|
+
const wasInvalid = this.invalid;
|
|
116
|
+
this.invalid = (empty || weak) && showInvalid;
|
|
117
|
+
const validity = empty ? { valueMissing: true } : weak ? { customError: true } : {};
|
|
118
|
+
const message = empty
|
|
119
|
+
? this.errorMessage || loomiT("validation.requiredField", {}, this.locale)
|
|
120
|
+
: weak
|
|
121
|
+
? this.errorMessage || "Password does not meet the strength requirements."
|
|
122
|
+
: "";
|
|
123
|
+
if (this.inputEl)
|
|
124
|
+
this.internals.setValidity(validity, message, this.inputEl);
|
|
125
|
+
else
|
|
126
|
+
this.internals.setValidity(validity, message);
|
|
127
|
+
if (this.invalid && !wasInvalid && !this.showErrorInline && message) {
|
|
128
|
+
// Lazy import — see @loomidev/input's syncValidity for the rationale.
|
|
129
|
+
void import("@loomidev/notification").then(({ showLoomiNotification }) => showLoomiNotification(this.label, message, "error", undefined, `loomi-password-validation-${this.name || this.instanceId}`));
|
|
130
|
+
}
|
|
131
|
+
return !empty && !weak;
|
|
132
|
+
}
|
|
133
|
+
showValidation() {
|
|
134
|
+
this.validationVisible = true;
|
|
135
|
+
this.syncValidity(true);
|
|
136
|
+
}
|
|
137
|
+
emit(type) {
|
|
138
|
+
this.dispatchEvent(new Event(type, { bubbles: true, composed: true }));
|
|
139
|
+
}
|
|
140
|
+
renderIcon(name, cls = "loomi-icon") {
|
|
141
|
+
const path = getLoomiIcon(name);
|
|
142
|
+
if (!path)
|
|
143
|
+
return nothing;
|
|
144
|
+
return html `<svg class=${cls} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true">${path}</svg>`;
|
|
145
|
+
}
|
|
146
|
+
parseOptions(options) {
|
|
147
|
+
const trimmed = options.trim();
|
|
148
|
+
if (!trimmed)
|
|
149
|
+
return [];
|
|
150
|
+
if (trimmed.startsWith("[")) {
|
|
151
|
+
try {
|
|
152
|
+
const parsed = JSON.parse(trimmed);
|
|
153
|
+
if (Array.isArray(parsed))
|
|
154
|
+
return parsed.map((option) => String(option).trim()).filter(Boolean);
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
// Fall through to simple delimited parsing.
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return trimmed
|
|
161
|
+
.split(/[|,]/)
|
|
162
|
+
.map((option) => option.trim())
|
|
163
|
+
.filter(Boolean);
|
|
164
|
+
}
|
|
165
|
+
selectedPrefix(options) {
|
|
166
|
+
return this.prefixValue || this.prefix || options[0] || "";
|
|
167
|
+
}
|
|
168
|
+
togglePrefixOpen() {
|
|
169
|
+
if (this.disabled || this.readonly)
|
|
170
|
+
return;
|
|
171
|
+
this.prefixOpen = !this.prefixOpen;
|
|
172
|
+
}
|
|
173
|
+
choosePrefix(value) {
|
|
174
|
+
this.prefixValue = value;
|
|
175
|
+
this.prefix = value;
|
|
176
|
+
this.prefixOpen = false;
|
|
177
|
+
this.dispatchEvent(new CustomEvent("loomi-prefix-change", { detail: { value }, bubbles: true, composed: true }));
|
|
178
|
+
}
|
|
179
|
+
renderPrefixDropdown(options) {
|
|
180
|
+
const value = this.selectedPrefix(options);
|
|
181
|
+
return html `<span class="loomi-affix-dropdown ${this.prefixOpen ? "open" : ""}">
|
|
182
|
+
<button
|
|
183
|
+
type="button"
|
|
184
|
+
class="loomi-affix-trigger"
|
|
185
|
+
aria-haspopup="listbox"
|
|
186
|
+
aria-expanded=${this.prefixOpen ? "true" : "false"}
|
|
187
|
+
aria-label="prefix"
|
|
188
|
+
?disabled=${this.disabled || this.readonly}
|
|
189
|
+
@click=${() => this.togglePrefixOpen()}
|
|
190
|
+
@keydown=${this.onPrefixTriggerKeydown}
|
|
191
|
+
>
|
|
192
|
+
<span class="loomi-affix-value">${value}</span>
|
|
193
|
+
${this.renderIcon("chevron-down", "loomi-affix-chevron")}
|
|
194
|
+
</button>
|
|
195
|
+
${this.prefixOpen
|
|
196
|
+
? html `<div class="loomi-affix-panel" role="listbox">
|
|
197
|
+
${options.map((option) => html `<div
|
|
198
|
+
class="loomi-affix-option ${option === value ? "selected" : ""}"
|
|
199
|
+
role="option"
|
|
200
|
+
aria-selected=${option === value ? "true" : "false"}
|
|
201
|
+
@click=${() => this.choosePrefix(option)}
|
|
202
|
+
>
|
|
203
|
+
<span>${option}</span>
|
|
204
|
+
${option === value ? this.renderIcon("check", "loomi-affix-check") : nothing}
|
|
205
|
+
</div>`)}
|
|
206
|
+
</div>`
|
|
207
|
+
: nothing}
|
|
208
|
+
</span>`;
|
|
209
|
+
}
|
|
210
|
+
renderPrefix() {
|
|
211
|
+
const options = this.parseOptions(this.prefixOptions);
|
|
212
|
+
const hasPrefix = this.prefix || this.prefixIcon || options.length > 0;
|
|
213
|
+
if (!hasPrefix)
|
|
214
|
+
return nothing;
|
|
215
|
+
const cls = `loomi-prefix${this.transparentPrefix ? "" : " loomi-affix-solid"}`;
|
|
216
|
+
return html `<span class=${cls}>
|
|
217
|
+
<slot name="prefix">${options.length > 0 ? this.renderPrefixDropdown(options) : this.prefixIcon ? this.renderIcon(this.prefixIcon) : this.prefix}</slot>
|
|
218
|
+
</span>`;
|
|
219
|
+
}
|
|
220
|
+
renderSuffix() {
|
|
221
|
+
const showClear = this.clearable && this.value !== "" && !this.disabled && !this.readonly;
|
|
222
|
+
const showReveal = this.viewable;
|
|
223
|
+
if (!showClear && !showReveal)
|
|
224
|
+
return nothing;
|
|
225
|
+
return html `<span class="loomi-suffix">
|
|
226
|
+
${showClear
|
|
227
|
+
? html `<button type="button" class="loomi-iconbtn" aria-label=${loomiT("common.clear", {}, this.locale)} @click=${this.clear}>${this.renderIcon("x-circle")}</button>`
|
|
228
|
+
: nothing}
|
|
229
|
+
${showReveal
|
|
230
|
+
? html `<button type="button" class="loomi-iconbtn" aria-label=${loomiT("input.togglePassword", {}, this.locale)} @click=${() => (this.revealed = !this.revealed)}>${this.renderIcon(this.revealed ? "eye-slash" : "eye")}</button>`
|
|
231
|
+
: nothing}
|
|
232
|
+
</span>`;
|
|
233
|
+
}
|
|
234
|
+
strengthRequirements() {
|
|
235
|
+
const tokens = STRENGTH_ORDER.filter((token) => this.strength.includes(token));
|
|
236
|
+
return tokens.map((token) => {
|
|
237
|
+
if (token === "A")
|
|
238
|
+
return { token, label: "One uppercase letter", met: /[A-Z]/.test(this.value) };
|
|
239
|
+
if (token === "a")
|
|
240
|
+
return { token, label: "One lowercase letter", met: /[a-z]/.test(this.value) };
|
|
241
|
+
if (token === "1")
|
|
242
|
+
return { token, label: "One number", met: /[0-9]/.test(this.value) };
|
|
243
|
+
return { token, label: "One special character", met: /[^A-Za-z0-9]/.test(this.value) };
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
renderStrength() {
|
|
247
|
+
const requirements = this.strengthRequirements();
|
|
248
|
+
if (requirements.length === 0)
|
|
249
|
+
return nothing;
|
|
250
|
+
const style = this.strengthColor ? `--loomi-password-strength-color:${this.strengthColor}` : "";
|
|
251
|
+
return html `<ul class="loomi-strength" aria-label="Password requirements" style=${style}>
|
|
252
|
+
${requirements.map((requirement) => html `<li class="loomi-strength-item ${requirement.met ? "met" : ""}">
|
|
253
|
+
<span class="loomi-strength-check">${this.renderIcon("check-circle")}</span>
|
|
254
|
+
<span>${requirement.label}</span>
|
|
255
|
+
</li>`)}
|
|
256
|
+
</ul>`;
|
|
257
|
+
}
|
|
258
|
+
render() {
|
|
259
|
+
const hasLabel = !!this.label;
|
|
260
|
+
const forceFloat = hasLabel && this.showPlaceholderAlways;
|
|
261
|
+
const placeholderAttr = hasLabel && !this.showPlaceholderAlways ? " " : this.placeholder || " ";
|
|
262
|
+
const showError = this.invalid && this.showErrorInline && this.errorMessage;
|
|
263
|
+
return html `
|
|
264
|
+
<div class="loomi-field size-${this.size} variant-${this.variant} ${forceFloat ? "force-float" : ""}" part="field">
|
|
265
|
+
${this.renderPrefix()}
|
|
266
|
+
<span class="loomi-inputwrap">
|
|
267
|
+
<input
|
|
268
|
+
class="loomi-input"
|
|
269
|
+
part="input"
|
|
270
|
+
.value=${this.value}
|
|
271
|
+
type=${this.revealed ? "text" : "password"}
|
|
272
|
+
name=${this.name || nothing}
|
|
273
|
+
placeholder=${placeholderAttr}
|
|
274
|
+
?disabled=${this.disabled}
|
|
275
|
+
?readonly=${this.readonly}
|
|
276
|
+
?required=${this.required}
|
|
277
|
+
aria-label=${hasLabel ? this.label : nothing}
|
|
278
|
+
aria-invalid=${this.invalid ? "true" : "false"}
|
|
279
|
+
@input=${this.onInput}
|
|
280
|
+
@change=${this.onChange}
|
|
281
|
+
@blur=${this.showValidation}
|
|
282
|
+
/>
|
|
283
|
+
${hasLabel ? html `<label class="loomi-label">${this.label}${this.required ? html `<span class="loomi-req">*</span>` : nothing}</label>` : nothing}
|
|
284
|
+
</span>
|
|
285
|
+
${this.renderSuffix()}
|
|
286
|
+
</div>
|
|
287
|
+
${showError ? html `<p class="loomi-error">${this.errorMessage}</p>` : nothing}
|
|
288
|
+
${this.renderStrength()}
|
|
289
|
+
`;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
__decorate([
|
|
293
|
+
property({ reflect: true })
|
|
294
|
+
], LoomiPassword.prototype, "name", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
property()
|
|
297
|
+
], LoomiPassword.prototype, "label", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
property({ attribute: "label-position", reflect: true })
|
|
300
|
+
], LoomiPassword.prototype, "labelPosition", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
property()
|
|
303
|
+
], LoomiPassword.prototype, "locale", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
property()
|
|
306
|
+
], LoomiPassword.prototype, "placeholder", void 0);
|
|
307
|
+
__decorate([
|
|
308
|
+
property()
|
|
309
|
+
], LoomiPassword.prototype, "value", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
property({ type: Boolean, reflect: true })
|
|
312
|
+
], LoomiPassword.prototype, "required", void 0);
|
|
313
|
+
__decorate([
|
|
314
|
+
property({ type: Boolean, reflect: true })
|
|
315
|
+
], LoomiPassword.prototype, "disabled", void 0);
|
|
316
|
+
__decorate([
|
|
317
|
+
property({ type: Boolean, reflect: true })
|
|
318
|
+
], LoomiPassword.prototype, "readonly", void 0);
|
|
319
|
+
__decorate([
|
|
320
|
+
property()
|
|
321
|
+
], LoomiPassword.prototype, "size", void 0);
|
|
322
|
+
__decorate([
|
|
323
|
+
property()
|
|
324
|
+
], LoomiPassword.prototype, "variant", void 0);
|
|
325
|
+
__decorate([
|
|
326
|
+
property()
|
|
327
|
+
], LoomiPassword.prototype, "prefix", void 0);
|
|
328
|
+
__decorate([
|
|
329
|
+
property({ attribute: "prefix-options" })
|
|
330
|
+
], LoomiPassword.prototype, "prefixOptions", void 0);
|
|
331
|
+
__decorate([
|
|
332
|
+
property({ attribute: "prefix-value" })
|
|
333
|
+
], LoomiPassword.prototype, "prefixValue", void 0);
|
|
334
|
+
__decorate([
|
|
335
|
+
property({ attribute: "prefix-icon" })
|
|
336
|
+
], LoomiPassword.prototype, "prefixIcon", void 0);
|
|
337
|
+
__decorate([
|
|
338
|
+
property({ type: Boolean, attribute: "transparent-prefix" })
|
|
339
|
+
], LoomiPassword.prototype, "transparentPrefix", void 0);
|
|
340
|
+
__decorate([
|
|
341
|
+
property({ type: Boolean })
|
|
342
|
+
], LoomiPassword.prototype, "viewable", void 0);
|
|
343
|
+
__decorate([
|
|
344
|
+
property({ type: Boolean })
|
|
345
|
+
], LoomiPassword.prototype, "clearable", void 0);
|
|
346
|
+
__decorate([
|
|
347
|
+
property()
|
|
348
|
+
], LoomiPassword.prototype, "strength", void 0);
|
|
349
|
+
__decorate([
|
|
350
|
+
property({ attribute: "strength-color" })
|
|
351
|
+
], LoomiPassword.prototype, "strengthColor", void 0);
|
|
352
|
+
__decorate([
|
|
353
|
+
property({ attribute: "error-message" })
|
|
354
|
+
], LoomiPassword.prototype, "errorMessage", void 0);
|
|
355
|
+
__decorate([
|
|
356
|
+
property({ type: Boolean, attribute: "show-error-inline" })
|
|
357
|
+
], LoomiPassword.prototype, "showErrorInline", void 0);
|
|
358
|
+
__decorate([
|
|
359
|
+
property({ type: Boolean, attribute: "show-placeholder-always" })
|
|
360
|
+
], LoomiPassword.prototype, "showPlaceholderAlways", void 0);
|
|
361
|
+
__decorate([
|
|
362
|
+
property({ type: Boolean, reflect: true })
|
|
363
|
+
], LoomiPassword.prototype, "invalid", void 0);
|
|
364
|
+
__decorate([
|
|
365
|
+
state()
|
|
366
|
+
], LoomiPassword.prototype, "revealed", void 0);
|
|
367
|
+
__decorate([
|
|
368
|
+
state()
|
|
369
|
+
], LoomiPassword.prototype, "prefixOpen", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
query("input")
|
|
372
|
+
], LoomiPassword.prototype, "inputEl", void 0);
|
|
373
|
+
LoomiPassword = __decorate([
|
|
374
|
+
customElement("loomi-password")
|
|
375
|
+
], LoomiPassword);
|
|
376
|
+
export { LoomiPassword };
|
|
377
|
+
//# sourceMappingURL=loomi-password.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loomi-password.js","sourceRoot":"","sources":["../src/loomi-password.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,MAAM,EACN,cAAc,EACd,YAAY,EACZ,WAAW,GAEZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAY5D,MAAM,cAAc,GAAiC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAE1E;;;;;;;;;GASG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,YAAY;IAAxC;;QAIG,cAAS,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACnC,sBAAiB,GAAG,KAAK,CAAC;QACjB,eAAU,GAAG,YAAY,EAAE,CAAC;QAEhB,SAAI,GAAG,EAAE,CAAC;QAC3B,UAAK,GAAG,EAAE,CAAC;QAEvB,kBAAa,GAA4B,SAAS,CAAC;QACvC,WAAM,GAAG,EAAE,CAAC;QACZ,gBAAW,GAAG,EAAE,CAAC;QACjB,UAAK,GAAG,EAAE,C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EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAiB;AAChB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAmB;AACnC;IAAX,QAAQ,EAAE;+CAAe;AACiB;IAA1C,QAAQ,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;oDAAoB;AACpB;IAAzC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;mDAAmB;AACC;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;sDAAyB;AAClB;IAAlE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,yBAAyB,EAAE,CAAC;4DAA+B;AACrD;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAiB;AAE3C;IAAhB,KAAK,EAAE;+CAA0B;AACjB;IAAhB,KAAK,EAAE;iDAA4B;AAEZ;IAAvB,KAAK,CAAC,OAAO,CAAC;8CAAoC;AArCxC,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAyTzB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loomidev/password",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "<loomi-password> — a form-associated password field with reveal, prefixes, validation and strength hints.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/loomidev/loomiui.git",
|
|
8
|
+
"directory": "packages/password"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"module": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"custom-elements.json"
|
|
21
|
+
],
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./loomi-password.js": {
|
|
28
|
+
"types": "./dist/loomi-password.d.ts",
|
|
29
|
+
"import": "./dist/loomi-password.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@loomidev/core": "^0.2.0",
|
|
34
|
+
"@loomidev/icons": "^0.2.0",
|
|
35
|
+
"@loomidev/notification": "^0.2.0",
|
|
36
|
+
"@loomidev/theme": "^0.2.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"lit": "^3.0.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@tailwindcss/cli": "^4.0.0",
|
|
43
|
+
"lit": "^3.3.3",
|
|
44
|
+
"tailwindcss": "^4.0.0",
|
|
45
|
+
"typescript": "^5.6.3"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"web-components",
|
|
49
|
+
"lit",
|
|
50
|
+
"loomiui",
|
|
51
|
+
"form",
|
|
52
|
+
"password"
|
|
53
|
+
],
|
|
54
|
+
"customElements": "custom-elements.json",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "node scripts/build-styles.mjs && tsc -p tsconfig.json",
|
|
57
|
+
"dev": "node scripts/build-styles.mjs && tsc -p tsconfig.json --watch",
|
|
58
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
59
|
+
}
|
|
60
|
+
}
|