@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michael K. Ocansey
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# @loomidev/password
|
|
2
|
+
|
|
3
|
+
`<loomi-password>` — a form-associated password field with reveal, prefixes, validation
|
|
4
|
+
and neutral strength hints.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @loomidev/password lit
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import "@loomidev/password"; // registers <loomi-password>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Basic Usage
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<loomi-password name="password" label="Password"></loomi-password>
|
|
20
|
+
<loomi-password name="password" label="Password" required></loomi-password>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Strength Requirements
|
|
24
|
+
|
|
25
|
+
Set `strength` with any combination of these optional tokens:
|
|
26
|
+
|
|
27
|
+
| Token | Requirement |
|
|
28
|
+
| ----- | ------------------------------- |
|
|
29
|
+
| `A` | At least one uppercase letter. |
|
|
30
|
+
| `a` | At least one lowercase letter. |
|
|
31
|
+
| `1` | At least one number. |
|
|
32
|
+
| `#` | At least one special character. |
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<loomi-password label="Password" strength="Aa1#"></loomi-password>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The matching requirements render beneath the field with gray check marks. A requirement's
|
|
39
|
+
check mark and label turn green once the current value satisfies it.
|
|
40
|
+
|
|
41
|
+
Set `strength-color` to customize that met-state label color.
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<loomi-password label="Password" strength="Aa1#" strength-color="#14532d"></loomi-password>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Prefixes
|
|
48
|
+
|
|
49
|
+
Use text, a built-in icon, a slot, or a prefix dropdown.
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<loomi-password prefix-icon="key" label="Password"></loomi-password>
|
|
53
|
+
<loomi-password prefix-options="personal,admin,service" label="Password"></loomi-password>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The selected dropdown value is available on `.prefixValue` and emits a composed
|
|
57
|
+
`loomi-prefix-change` event with `{ value }`.
|
|
58
|
+
|
|
59
|
+
## Validation
|
|
60
|
+
|
|
61
|
+
`required`, `error-message`, `show-error-inline`, `validate()`, `checkValidity()` and
|
|
62
|
+
`reportValidity()` match `<loomi-input>`. Strength requirements also participate in
|
|
63
|
+
validity when `strength` is set.
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<loomi-password
|
|
67
|
+
required
|
|
68
|
+
strength="Aa1#"
|
|
69
|
+
label="Password"
|
|
70
|
+
error-message="Choose a stronger password"
|
|
71
|
+
show-error-inline
|
|
72
|
+
></loomi-password>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Field appearance
|
|
76
|
+
|
|
77
|
+
Use `variant="minimal"` for a bottom-border-only field:
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<loomi-password label="Password" variant="minimal"></loomi-password>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Use `label-position="inside"` to keep a compact label inside the top of the field,
|
|
84
|
+
with the password displayed beneath it:
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<loomi-password label="Password" label-position="inside"></loomi-password>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Accessibility
|
|
91
|
+
|
|
92
|
+
For the library-wide baseline, see [Foundations — Accessibility](https://loomiui.com/foundations/#accessibility).
|
|
93
|
+
|
|
94
|
+
## Responsive behavior
|
|
95
|
+
|
|
96
|
+
For the shared container and viewport rules, see [Foundations — Responsive behavior](https://loomiui.com/foundations/#responsive-behavior).
|
|
97
|
+
|
|
98
|
+
## Dark mode
|
|
99
|
+
|
|
100
|
+
For theme activation, token overrides, and contrast guidance, see [Foundations — Dark mode](https://loomiui.com/foundations/#dark-mode).
|
|
101
|
+
|
|
102
|
+
## Attributes
|
|
103
|
+
|
|
104
|
+
| Attribute | Default | Description |
|
|
105
|
+
| ------------------------- | --------- | ----------------------------------------------------------------------------------------------- |
|
|
106
|
+
| `name` | _(blank)_ | Submitted with the form. |
|
|
107
|
+
| `label` | _(blank)_ | Floating label. |
|
|
108
|
+
| `label-position` | `default` | `default` keeps the floating label; `inside` keeps a compact label inside the top of the field. |
|
|
109
|
+
| `placeholder` | _(blank)_ | Placeholder text. |
|
|
110
|
+
| `value` | _(blank)_ | Current value. |
|
|
111
|
+
| `required` | `false` | Marks the field required. _(boolean)_ |
|
|
112
|
+
| `disabled` | `false` | Disable the field. _(boolean)_ |
|
|
113
|
+
| `readonly` | `false` | Read-only field. _(boolean)_ |
|
|
114
|
+
| `size` | `medium` | `tiny` \| `small` \| `regular` \| `medium` \| `big` |
|
|
115
|
+
| `variant` | `default` | `default` \| `minimal` (bottom border only, no box) |
|
|
116
|
+
| `prefix` | _(blank)_ | Text prefix. |
|
|
117
|
+
| `prefix-icon` | _(blank)_ | Icon-name prefix. |
|
|
118
|
+
| `prefix-options` | _(blank)_ | Comma, pipe, or JSON array of dropdown options. |
|
|
119
|
+
| `prefix-value` | _(blank)_ | Selected prefix dropdown value. |
|
|
120
|
+
| `transparent-prefix` | `true` | Transparent (vs solid) prefix. _(boolean)_ |
|
|
121
|
+
| `viewable` | `true` | Show a reveal eye. _(boolean)_ |
|
|
122
|
+
| `clearable` | `false` | Show a clear button when the field has a value. _(boolean)_ |
|
|
123
|
+
| `strength` | _(blank)_ | Requirement tokens: `A`, `a`, `1`, `#`. |
|
|
124
|
+
| `strength-color` | _(blank)_ | Custom color for met strength labels. Defaults to a darker success green. |
|
|
125
|
+
| `error-message` | _(blank)_ | Message shown when validation fails. |
|
|
126
|
+
| `show-error-inline` | `false` | Render `error-message` beneath the field. _(boolean)_ |
|
|
127
|
+
| `show-placeholder-always` | `false` | Keep the placeholder visible even with a label. _(boolean)_ |
|
|
128
|
+
|
|
129
|
+
### Methods
|
|
130
|
+
|
|
131
|
+
| Member | Description |
|
|
132
|
+
| --------------------- | ---------------------------------------------- |
|
|
133
|
+
| `.value` | Get/set the current value. |
|
|
134
|
+
| `focus()` / `clear()` | Focus or clear the field. |
|
|
135
|
+
| `validate()` | Run validation now; returns `true` when valid. |
|
|
136
|
+
|
|
137
|
+
## Slots
|
|
138
|
+
|
|
139
|
+
| Slot | Description |
|
|
140
|
+
| -------- | ------------------------------------------------ |
|
|
141
|
+
| `prefix` | Content rendered before the main value or label. |
|
|
142
|
+
|
|
143
|
+
## Events
|
|
144
|
+
|
|
145
|
+
| Event | Description |
|
|
146
|
+
| --------------------- | --------------------------------------------- |
|
|
147
|
+
| `change` | Fired when the value is committed or changed. |
|
|
148
|
+
| `input` | Fired while the value is edited. |
|
|
149
|
+
| `loomi-prefix-change` | Fired when the prefix changes. |
|
|
150
|
+
|
|
151
|
+
## Dependencies
|
|
152
|
+
|
|
153
|
+
- `@loomidev/core`
|
|
154
|
+
- `@loomidev/icons`
|
|
155
|
+
- `@loomidev/notification`
|
|
156
|
+
- `@loomidev/theme`
|