@zazz-ui/core 0.1.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/CHANGELOG.md +19 -0
- package/LICENSE +21 -0
- package/README.md +61 -0
- package/dist/sri.json +75 -0
- package/dist/zazz.css +1 -0
- package/dist/zazz.js +1 -0
- package/examples/about.html +590 -0
- package/examples/components.html +1040 -0
- package/examples/forms.html +511 -0
- package/examples/index.html +268 -0
- package/examples/layout.html +320 -0
- package/examples/products.html +846 -0
- package/examples/responsive.html +339 -0
- package/package.json +85 -0
- package/src/base/_layers.css +12 -0
- package/src/base/_layout.css +568 -0
- package/src/base/_reset.css +515 -0
- package/src/base/_typography.css +495 -0
- package/src/base/_utilities.css +6628 -0
- package/src/base/_variables.css +682 -0
- package/src/base/_view-transitions.css +103 -0
- package/src/base/command-score.d.ts +12 -0
- package/src/base/command-score.d.ts.map +1 -0
- package/src/base/command-score.js +151 -0
- package/src/base/command-score.ts +192 -0
- package/src/base/dialog-lifecycle.d.ts +11 -0
- package/src/base/dialog-lifecycle.d.ts.map +1 -0
- package/src/base/dialog-lifecycle.js +65 -0
- package/src/base/dialog-lifecycle.ts +80 -0
- package/src/base/embla.d.ts +90 -0
- package/src/base/embla.d.ts.map +1 -0
- package/src/base/embla.js +643 -0
- package/src/base/embla.ts +791 -0
- package/src/base/hotkeys.d.ts +82 -0
- package/src/base/hotkeys.d.ts.map +1 -0
- package/src/base/hotkeys.js +141 -0
- package/src/base/hotkeys.ts +195 -0
- package/src/base/navigation.d.ts +2 -0
- package/src/base/navigation.d.ts.map +1 -0
- package/src/base/navigation.js +136 -0
- package/src/base/navigation.ts +151 -0
- package/src/base/reveal.d.ts +80 -0
- package/src/base/reveal.d.ts.map +1 -0
- package/src/base/reveal.js +305 -0
- package/src/base/reveal.ts +379 -0
- package/src/base/signals.d.ts +89 -0
- package/src/base/signals.d.ts.map +1 -0
- package/src/base/signals.js +134 -0
- package/src/base/signals.ts +164 -0
- package/src/base/typeahead.d.ts +105 -0
- package/src/base/typeahead.d.ts.map +1 -0
- package/src/base/typeahead.js +411 -0
- package/src/base/typeahead.ts +500 -0
- package/src/base/utils.d.ts +56 -0
- package/src/base/utils.d.ts.map +1 -0
- package/src/base/utils.js +88 -0
- package/src/base/utils.ts +98 -0
- package/src/base/zazz-element.d.ts +44 -0
- package/src/base/zazz-element.d.ts.map +1 -0
- package/src/base/zazz-element.js +59 -0
- package/src/base/zazz-element.ts +73 -0
- package/src/globals.d.ts +148 -0
- package/src/head.d.ts +95 -0
- package/src/head.d.ts.map +1 -0
- package/src/head.js +311 -0
- package/src/head.ts +433 -0
- package/src/index.css +71 -0
- package/src/index.d.ts +36 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +35 -0
- package/src/index.ts +36 -0
- package/src/manifest.d.ts +90 -0
- package/src/manifest.d.ts.map +1 -0
- package/src/manifest.js +614 -0
- package/src/manifest.ts +667 -0
- package/src/primitives/accordion/accordion.css +104 -0
- package/src/primitives/accordion/accordion.html +69 -0
- package/src/primitives/alert-dialog/alert-dialog.css +38 -0
- package/src/primitives/alert-dialog/alert-dialog.html +53 -0
- package/src/primitives/autocomplete/autocomplete-groups.html +77 -0
- package/src/primitives/autocomplete/autocomplete.css +114 -0
- package/src/primitives/autocomplete/autocomplete.d.ts +30 -0
- package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -0
- package/src/primitives/autocomplete/autocomplete.html +66 -0
- package/src/primitives/autocomplete/autocomplete.js +41 -0
- package/src/primitives/autocomplete/autocomplete.ts +46 -0
- package/src/primitives/avatar/avatar.html +44 -0
- package/src/primitives/badge/badge-icon.html +36 -0
- package/src/primitives/badge/badge.css +251 -0
- package/src/primitives/badge/badge.html +7 -0
- package/src/primitives/breadcrumbs/breadcrumbs.html +9 -0
- package/src/primitives/button/button-icon-only.html +84 -0
- package/src/primitives/button/button-icon.html +82 -0
- package/src/primitives/button/button.css +319 -0
- package/src/primitives/button/button.html +8 -0
- package/src/primitives/button-group/button-group-vertical.html +6 -0
- package/src/primitives/button-group/button-group.css +94 -0
- package/src/primitives/button-group/button-group.html +64 -0
- package/src/primitives/card/card-subgrid.html +118 -0
- package/src/primitives/card/card.html +53 -0
- package/src/primitives/carousel/carousel.css +61 -0
- package/src/primitives/carousel/carousel.d.ts +16 -0
- package/src/primitives/carousel/carousel.d.ts.map +1 -0
- package/src/primitives/carousel/carousel.html +315 -0
- package/src/primitives/carousel/carousel.js +73 -0
- package/src/primitives/carousel/carousel.ts +84 -0
- package/src/primitives/checkbox/checkbox-tasklist.html +71 -0
- package/src/primitives/checkbox/checkbox.css +82 -0
- package/src/primitives/checkbox/checkbox.d.ts +21 -0
- package/src/primitives/checkbox/checkbox.d.ts.map +1 -0
- package/src/primitives/checkbox/checkbox.html +17 -0
- package/src/primitives/checkbox/checkbox.js +190 -0
- package/src/primitives/checkbox/checkbox.ts +219 -0
- package/src/primitives/combobox/combobox-multiselect.html +91 -0
- package/src/primitives/combobox/combobox.css +307 -0
- package/src/primitives/combobox/combobox.d.ts +100 -0
- package/src/primitives/combobox/combobox.d.ts.map +1 -0
- package/src/primitives/combobox/combobox.html +73 -0
- package/src/primitives/combobox/combobox.js +503 -0
- package/src/primitives/combobox/combobox.ts +559 -0
- package/src/primitives/command/command-actions.d.ts +31 -0
- package/src/primitives/command/command-actions.d.ts.map +1 -0
- package/src/primitives/command/command-actions.html +89 -0
- package/src/primitives/command/command-actions.js +70 -0
- package/src/primitives/command/command-actions.ts +77 -0
- package/src/primitives/command/command-dialog.html +77 -0
- package/src/primitives/command/command.css +151 -0
- package/src/primitives/command/command.d.ts +52 -0
- package/src/primitives/command/command.d.ts.map +1 -0
- package/src/primitives/command/command.html +119 -0
- package/src/primitives/command/command.js +146 -0
- package/src/primitives/command/command.ts +157 -0
- package/src/primitives/dialog/dialog-with-form.html +200 -0
- package/src/primitives/dialog/dialog.css +229 -0
- package/src/primitives/dialog/dialog.html +90 -0
- package/src/primitives/fields/fields.css +278 -0
- package/src/primitives/input/input-icon-leading.html +19 -0
- package/src/primitives/input/input-icon-trailing.html +18 -0
- package/src/primitives/input/input.css +114 -0
- package/src/primitives/input/input.html +61 -0
- package/src/primitives/input-group/input-group-password-group.html +108 -0
- package/src/primitives/input-group/input-group.css +215 -0
- package/src/primitives/input-group/input-group.html +132 -0
- package/src/primitives/kbd/kbd-group.html +18 -0
- package/src/primitives/kbd/kbd.css +87 -0
- package/src/primitives/kbd/kbd.html +7 -0
- package/src/primitives/lightbox/lightbox.css +459 -0
- package/src/primitives/lightbox/lightbox.d.ts +7 -0
- package/src/primitives/lightbox/lightbox.d.ts.map +1 -0
- package/src/primitives/lightbox/lightbox.html +665 -0
- package/src/primitives/lightbox/lightbox.js +96 -0
- package/src/primitives/lightbox/lightbox.ts +113 -0
- package/src/primitives/menu/menu-interest.html +52 -0
- package/src/primitives/menu/menu.css +55 -0
- package/src/primitives/menu/menu.d.ts +38 -0
- package/src/primitives/menu/menu.d.ts.map +1 -0
- package/src/primitives/menu/menu.html +70 -0
- package/src/primitives/menu/menu.js +117 -0
- package/src/primitives/menu/menu.ts +131 -0
- package/src/primitives/menubar/menubar-help-search.html +103 -0
- package/src/primitives/menubar/menubar.html +166 -0
- package/src/primitives/meter/meter.css +178 -0
- package/src/primitives/meter/meter.html +38 -0
- package/src/primitives/mobile-menu/mobile-menu.css +145 -0
- package/src/primitives/mobile-menu/mobile-menu.html +614 -0
- package/src/primitives/navigation-menu/navigation-menu-featured.html +76 -0
- package/src/primitives/navigation-menu/navigation-menu-icon-grid.html +158 -0
- package/src/primitives/navigation-menu/navigation-menu-interest.html +103 -0
- package/src/primitives/navigation-menu/navigation-menu-megamenu.html +141 -0
- package/src/primitives/navigation-menu/navigation-menu-simple.html +96 -0
- package/src/primitives/navigation-menu/navigation-menu.css +295 -0
- package/src/primitives/navigation-menu/navigation-menu.html +576 -0
- package/src/primitives/otp/otp.css +126 -0
- package/src/primitives/otp/otp.d.ts +89 -0
- package/src/primitives/otp/otp.d.ts.map +1 -0
- package/src/primitives/otp/otp.html +22 -0
- package/src/primitives/otp/otp.js +226 -0
- package/src/primitives/otp/otp.ts +279 -0
- package/src/primitives/password-group/password-group.css +238 -0
- package/src/primitives/password-group/password-group.d.ts +25 -0
- package/src/primitives/password-group/password-group.d.ts.map +1 -0
- package/src/primitives/password-group/password-group.html +109 -0
- package/src/primitives/password-group/password-group.js +76 -0
- package/src/primitives/password-group/password-group.ts +95 -0
- package/src/primitives/popover/popover.css +233 -0
- package/src/primitives/progress/progress-indeterminate.html +1 -0
- package/src/primitives/progress/progress.css +105 -0
- package/src/primitives/progress/progress.html +7 -0
- package/src/primitives/prose/prose.html +65 -0
- package/src/primitives/radio/radio.css +84 -0
- package/src/primitives/radio/radio.html +17 -0
- package/src/primitives/reveal/reveal.css +167 -0
- package/src/primitives/select/multiselect.d.ts +43 -0
- package/src/primitives/select/multiselect.d.ts.map +1 -0
- package/src/primitives/select/multiselect.js +147 -0
- package/src/primitives/select/multiselect.ts +188 -0
- package/src/primitives/select/select-align.html +49 -0
- package/src/primitives/select/select-multiple.html +12 -0
- package/src/primitives/select/select-sides.html +65 -0
- package/src/primitives/select/select.css +481 -0
- package/src/primitives/select/select.html +16 -0
- package/src/primitives/separator/separator.css +49 -0
- package/src/primitives/separator/separator.html +16 -0
- package/src/primitives/slider/slider.css +122 -0
- package/src/primitives/slider/slider.html +1 -0
- package/src/primitives/switch/switch.css +126 -0
- package/src/primitives/switch/switch.html +13 -0
- package/src/primitives/table/table-alternating.html +36 -0
- package/src/primitives/table/table-grid.html +30 -0
- package/src/primitives/table/table-size-sm.html +26 -0
- package/src/primitives/table/table.css +158 -0
- package/src/primitives/table/table.html +45 -0
- package/src/primitives/tabs/tabs.css +328 -0
- package/src/primitives/tabs/tabs.d.ts +35 -0
- package/src/primitives/tabs/tabs.d.ts.map +1 -0
- package/src/primitives/tabs/tabs.html +75 -0
- package/src/primitives/tabs/tabs.js +84 -0
- package/src/primitives/tabs/tabs.ts +93 -0
- package/src/primitives/textarea/textarea.css +78 -0
- package/src/primitives/textarea/textarea.html +10 -0
- package/src/primitives/toaster/toaster.css +309 -0
- package/src/primitives/toaster/toaster.d.ts +138 -0
- package/src/primitives/toaster/toaster.d.ts.map +1 -0
- package/src/primitives/toaster/toaster.html +77 -0
- package/src/primitives/toaster/toaster.js +736 -0
- package/src/primitives/toaster/toaster.ts +823 -0
- package/src/primitives/toggle/toggle.css +295 -0
- package/src/primitives/toggle/toggle.html +68 -0
- package/src/primitives/toggle-group/toggle-group-multiple.html +14 -0
- package/src/primitives/toggle-group/toggle-group-vertical.html +14 -0
- package/src/primitives/toggle-group/toggle-group.css +73 -0
- package/src/primitives/toggle-group/toggle-group.html +53 -0
- package/src/primitives/toolbar/toolbar.html +45 -0
- package/src/primitives/tooltip/tooltip-disabled.html +19 -0
- package/src/primitives/tooltip/tooltip-sides.html +57 -0
- package/src/primitives/tooltip/tooltip-with-kbd.html +31 -0
- package/src/primitives/tooltip/tooltip.css +235 -0
- package/src/primitives/tooltip/tooltip.html +12 -0
- package/src/primitives/utilities/aspect-ratio.html +17 -0
- package/src/primitives/utilities/basis.html +27 -0
- package/src/primitives/utilities/col-span.html +23 -0
- package/src/primitives/utilities/compose.html +19 -0
- package/src/primitives/utilities/flex-align.html +26 -0
- package/src/primitives/utilities/flex-direction.html +36 -0
- package/src/primitives/utilities/flex-grow.html +17 -0
- package/src/primitives/utilities/gap.html +62 -0
- package/src/primitives/utilities/grid-cols.html +20 -0
- package/src/primitives/utilities/grid-pile.html +5 -0
- package/src/primitives/utilities/grid-responsive.html +31 -0
- package/src/primitives/utilities/margin-auto.html +13 -0
- package/src/primitives/utilities/object-fit.html +41 -0
- package/src/primitives/utilities/order.html +17 -0
- package/src/primitives/utilities/overflow.html +26 -0
- package/src/primitives/utilities/padding-compose.html +23 -0
- package/src/primitives/utilities/padding.html +30 -0
- package/src/primitives/utilities/position.html +13 -0
- package/src/primitives/utilities/responsive-flex.html +22 -0
- package/src/primitives/utilities/responsive-grid.html +31 -0
- package/src/primitives/utilities/size.html +22 -0
- package/src/primitives/utilities/width.html +22 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview `<ui-otp>`: a one-time password field with character slots.
|
|
5
|
+
* @description Light-DOM custom element that augments a single
|
|
6
|
+
* `<input class="ui-input ui-otp-input">` (the standard OTP shape with
|
|
7
|
+
* `autocomplete="one-time-code"`, `inputmode`, `pattern`, and `maxlength`)
|
|
8
|
+
* with a presentational slot rail. The input stays the source of truth:
|
|
9
|
+
* autofill, paste, IME, undo, form submission, and `:user-invalid` are all
|
|
10
|
+
* native. The script stamps an `aria-hidden` rail of character cells behind
|
|
11
|
+
* the input and stretches the input invisibly over it; each cell mirrors one
|
|
12
|
+
* character and the caret position. Without JavaScript the markup is a plain,
|
|
13
|
+
* fully functional OTP input.
|
|
14
|
+
*
|
|
15
|
+
* The code length comes from the input `maxlength`. There is no
|
|
16
|
+
* `data-otp-length`.
|
|
17
|
+
*
|
|
18
|
+
* Attributes on `<ui-otp>`:
|
|
19
|
+
* - `data-otp-groups`: separator layout, e.g. `"3-3"` or `"2-2-2"`. The
|
|
20
|
+
* groups must sum to `maxlength`; otherwise one ungrouped run renders.
|
|
21
|
+
* - `data-otp-type`: sanitization charset: `numeric` (default), `alpha`,
|
|
22
|
+
* `alphanumeric`, `none`. Keep it in agreement with the input `pattern`
|
|
23
|
+
* and `inputmode`, which carry the no-JS validation.
|
|
24
|
+
* - `data-otp-mask`: render `•` in the cells instead of characters.
|
|
25
|
+
* - `data-otp-auto-submit`: request the owning form submission once when
|
|
26
|
+
* the code is complete.
|
|
27
|
+
*
|
|
28
|
+
* Stamped state: cells are `[data-slot~="otp-slot"]` with `data-filled` /
|
|
29
|
+
* `data-active`; separators are `[data-slot~="otp-separator"]`; the root
|
|
30
|
+
* gains `data-otp-ready` when enhanced and `data-otp-complete` when full.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import { ZazzElement, defineZazzElement } from "../../base/zazz-element.ts";
|
|
34
|
+
import { effect, state } from "../../base/signals.ts";
|
|
35
|
+
|
|
36
|
+
// --- Types ---
|
|
37
|
+
|
|
38
|
+
/** Sanitization charset for typed and pasted text. */
|
|
39
|
+
type OtpType = "numeric" | "alpha" | "alphanumeric" | "none";
|
|
40
|
+
|
|
41
|
+
/** One rendered cell: its character and its state flags. */
|
|
42
|
+
interface SlotState {
|
|
43
|
+
/** The character to render ("" when empty; "•" when masked and filled). */
|
|
44
|
+
char: string;
|
|
45
|
+
/** Whether the cell holds a character. */
|
|
46
|
+
filled: boolean;
|
|
47
|
+
/** Whether the caret sits on this cell. */
|
|
48
|
+
active: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// --- Pure derivations (exported for unit tests only) ---
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @description Parses `data-otp-groups` ("3-3") into group sizes. Groups that
|
|
55
|
+
* don't sum to the code length fall back to one ungrouped run.
|
|
56
|
+
*
|
|
57
|
+
* @param raw - The attribute value, or null.
|
|
58
|
+
* @param length - The code length.
|
|
59
|
+
* @returns Group sizes summing to `length`.
|
|
60
|
+
*/
|
|
61
|
+
function parseGroups(raw: string | null, length: number): number[] {
|
|
62
|
+
if (!raw) return [length];
|
|
63
|
+
const groups = raw
|
|
64
|
+
.split("-")
|
|
65
|
+
.map((part) => Number.parseInt(part, 10))
|
|
66
|
+
.filter((size) => Number.isFinite(size) && size > 0);
|
|
67
|
+
const total = groups.reduce((sum, size) => sum + size, 0);
|
|
68
|
+
return total === length && groups.length > 0 ? groups : [length];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @description Filters raw input text to the allowed charset and clamps it to
|
|
73
|
+
* the code length. Whitespace never survives (pasted codes often carry it).
|
|
74
|
+
*
|
|
75
|
+
* @param raw - The input's current value.
|
|
76
|
+
* @param type - The allowed charset.
|
|
77
|
+
* @param length - The code length.
|
|
78
|
+
* @returns The sanitized value.
|
|
79
|
+
*/
|
|
80
|
+
function sanitizeOtp(raw: string, type: OtpType, length: number): string {
|
|
81
|
+
let allowed: RegExp;
|
|
82
|
+
switch (type) {
|
|
83
|
+
case "numeric":
|
|
84
|
+
allowed = /[^0-9]/g;
|
|
85
|
+
break;
|
|
86
|
+
case "alpha":
|
|
87
|
+
allowed = /[^a-zA-Z]/g;
|
|
88
|
+
break;
|
|
89
|
+
case "alphanumeric":
|
|
90
|
+
allowed = /[^a-zA-Z0-9]/g;
|
|
91
|
+
break;
|
|
92
|
+
case "none":
|
|
93
|
+
allowed = /\s/g;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return raw.replace(allowed, "").slice(0, length);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @description Derives every cell's character and state from the input's
|
|
101
|
+
* value and caret. The active cell tracks the caret; with the code full, the
|
|
102
|
+
* last cell stays active.
|
|
103
|
+
*
|
|
104
|
+
* @param value - The sanitized value.
|
|
105
|
+
* @param length - The code length.
|
|
106
|
+
* @param caret - The input's caret position.
|
|
107
|
+
* @param focused - Whether the input has focus.
|
|
108
|
+
* @param mask - Whether to obscure characters.
|
|
109
|
+
* @returns One state per cell.
|
|
110
|
+
*/
|
|
111
|
+
function resolveSlots(
|
|
112
|
+
value: string,
|
|
113
|
+
length: number,
|
|
114
|
+
caret: number,
|
|
115
|
+
focused: boolean,
|
|
116
|
+
mask: boolean,
|
|
117
|
+
): SlotState[] {
|
|
118
|
+
const activeIndex = focused ? Math.min(caret, length - 1) : -1;
|
|
119
|
+
return Array.from({ length }, (_, index) => {
|
|
120
|
+
const char = value.charAt(index);
|
|
121
|
+
return {
|
|
122
|
+
char: char === "" ? "" : mask ? "•" : char,
|
|
123
|
+
filled: char !== "",
|
|
124
|
+
active: index === activeIndex,
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @description Whether the code is complete.
|
|
131
|
+
*
|
|
132
|
+
* @param value - The sanitized value.
|
|
133
|
+
* @param length - The code length.
|
|
134
|
+
* @returns True when every cell is filled.
|
|
135
|
+
*/
|
|
136
|
+
function isComplete(value: string, length: number): boolean {
|
|
137
|
+
return length > 0 && value.length === length;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// --- Element ---
|
|
141
|
+
|
|
142
|
+
class UiOtp extends ZazzElement {
|
|
143
|
+
#rail: HTMLElement | null = null;
|
|
144
|
+
#lastSubmitted = "";
|
|
145
|
+
|
|
146
|
+
protected setup(signal: AbortSignal): void {
|
|
147
|
+
const input = this.querySelector("input");
|
|
148
|
+
if (!(input instanceof HTMLInputElement)) return;
|
|
149
|
+
|
|
150
|
+
const length = input.maxLength > 0 ? input.maxLength : 6;
|
|
151
|
+
const type = (this.getAttribute("data-otp-type") ?? "numeric") as OtpType;
|
|
152
|
+
const mask = this.hasAttribute("data-otp-mask");
|
|
153
|
+
const groups = parseGroups(this.getAttribute("data-otp-groups"), length);
|
|
154
|
+
|
|
155
|
+
const rail = this.#stampRail(groups);
|
|
156
|
+
this.setAttribute("data-otp-ready", "");
|
|
157
|
+
|
|
158
|
+
const value = state(sanitizeOtp(input.value, type, length));
|
|
159
|
+
const caret = state(input.selectionStart ?? 0);
|
|
160
|
+
const focused = state(document.activeElement === input);
|
|
161
|
+
|
|
162
|
+
// Input adapters: sanitize in place, then mirror value and caret
|
|
163
|
+
input.addEventListener(
|
|
164
|
+
"input",
|
|
165
|
+
() => {
|
|
166
|
+
const clean = sanitizeOtp(input.value, type, length);
|
|
167
|
+
if (input.value !== clean) input.value = clean;
|
|
168
|
+
value.set(clean);
|
|
169
|
+
caret.set(input.selectionStart ?? clean.length);
|
|
170
|
+
},
|
|
171
|
+
{ signal },
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
document.addEventListener(
|
|
175
|
+
"selectionchange",
|
|
176
|
+
() => {
|
|
177
|
+
if (document.activeElement !== input) return;
|
|
178
|
+
caret.set(input.selectionStart ?? 0);
|
|
179
|
+
},
|
|
180
|
+
{ signal },
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
input.addEventListener("focus", () => focused.set(true), { signal });
|
|
184
|
+
input.addEventListener("blur", () => focused.set(false), { signal });
|
|
185
|
+
|
|
186
|
+
// Clicking a cell moves the caret to it
|
|
187
|
+
rail.addEventListener(
|
|
188
|
+
"pointerdown",
|
|
189
|
+
(event) => {
|
|
190
|
+
const cell =
|
|
191
|
+
event.target instanceof Element ? event.target.closest("[data-otp-index]") : null;
|
|
192
|
+
event.preventDefault();
|
|
193
|
+
input.focus();
|
|
194
|
+
const index = cell ? Number(cell.getAttribute("data-otp-index")) : length;
|
|
195
|
+
const position = Math.min(index, input.value.length);
|
|
196
|
+
input.setSelectionRange(position, position);
|
|
197
|
+
caret.set(position);
|
|
198
|
+
},
|
|
199
|
+
{ signal },
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
// Output adapter: one effect writes all derived attributes together
|
|
203
|
+
effect(
|
|
204
|
+
() => {
|
|
205
|
+
const slots = resolveSlots(value.get(), length, caret.get(), focused.get(), mask);
|
|
206
|
+
const cells = rail.querySelectorAll("[data-otp-index]");
|
|
207
|
+
slots.forEach((slot, index) => {
|
|
208
|
+
const cell = cells[index];
|
|
209
|
+
if (!(cell instanceof HTMLElement)) return;
|
|
210
|
+
cell.textContent = slot.char;
|
|
211
|
+
if (slot.filled) cell.setAttribute("data-filled", "");
|
|
212
|
+
else cell.removeAttribute("data-filled");
|
|
213
|
+
if (slot.active) cell.setAttribute("data-active", "");
|
|
214
|
+
else cell.removeAttribute("data-active");
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
const complete = isComplete(value.get(), length);
|
|
218
|
+
if (complete) this.setAttribute("data-otp-complete", "");
|
|
219
|
+
else this.removeAttribute("data-otp-complete");
|
|
220
|
+
|
|
221
|
+
if (complete && this.hasAttribute("data-otp-auto-submit")) {
|
|
222
|
+
// Once per distinct complete value, so corrections can resubmit
|
|
223
|
+
if (this.#lastSubmitted !== value.get()) {
|
|
224
|
+
this.#lastSubmitted = value.get();
|
|
225
|
+
input.form?.requestSubmit();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
{ signal },
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
protected teardown(): void {
|
|
234
|
+
this.#rail?.remove();
|
|
235
|
+
this.#rail = null;
|
|
236
|
+
this.removeAttribute("data-otp-ready");
|
|
237
|
+
this.removeAttribute("data-otp-complete");
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @description Builds the aria-hidden cell rail (with separators between
|
|
242
|
+
* groups) and inserts it after the input.
|
|
243
|
+
*
|
|
244
|
+
* @param groups - Group sizes, summing to the code length.
|
|
245
|
+
* @returns The rail element.
|
|
246
|
+
* @private
|
|
247
|
+
*/
|
|
248
|
+
#stampRail(groups: number[]): HTMLElement {
|
|
249
|
+
const rail = document.createElement("div");
|
|
250
|
+
rail.setAttribute("data-slot", "otp-rail");
|
|
251
|
+
rail.setAttribute("aria-hidden", "true");
|
|
252
|
+
|
|
253
|
+
let index = 0;
|
|
254
|
+
groups.forEach((size, groupIndex) => {
|
|
255
|
+
if (groupIndex > 0) {
|
|
256
|
+
const separator = document.createElement("span");
|
|
257
|
+
separator.setAttribute("data-slot", "otp-separator");
|
|
258
|
+
separator.setAttribute("aria-role", "presentation");
|
|
259
|
+
separator.textContent = "–";
|
|
260
|
+
rail.append(separator);
|
|
261
|
+
}
|
|
262
|
+
for (let i = 0; i < size; i++) {
|
|
263
|
+
const cell = document.createElement("span");
|
|
264
|
+
cell.setAttribute("data-slot", "otp-slot");
|
|
265
|
+
cell.setAttribute("data-otp-index", String(index++));
|
|
266
|
+
rail.append(cell);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
this.append(rail);
|
|
271
|
+
this.#rail = rail;
|
|
272
|
+
return rail;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
defineZazzElement("ui-otp", UiOtp);
|
|
277
|
+
|
|
278
|
+
export { UiOtp, parseGroups, sanitizeOtp, resolveSlots, isComplete };
|
|
279
|
+
export type { OtpType, SlotState };
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* password-group.css — Password group (.ui-password-group)
|
|
3
|
+
*
|
|
4
|
+
* @layer variables, components
|
|
5
|
+
* @requires layers.css, _variables.css, fields.css, input.css,
|
|
6
|
+
* button.css
|
|
7
|
+
* @uses Same shell pattern as input-group.css (:focus-within, :has, data-align)
|
|
8
|
+
* @uses aria-pressed on toggle — show/hide icon swap via CSS (JS sets type +
|
|
9
|
+
* aria in password-group.ts)
|
|
10
|
+
* @uses Native reveal suppressed in _reset.css (::-ms-reveal, etc.)
|
|
11
|
+
* @tokens --ui-password-group-* (@layer variables)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
@layer variables {
|
|
15
|
+
:root {
|
|
16
|
+
--ui-password-group-display: flex;
|
|
17
|
+
--ui-password-group-wrap: wrap;
|
|
18
|
+
--ui-password-group-align: center;
|
|
19
|
+
--ui-password-group-gap: var(--step-1);
|
|
20
|
+
--ui-password-group-inline-size: 100%;
|
|
21
|
+
--ui-password-group-min-block-size: var(--ui-field-height);
|
|
22
|
+
--ui-password-group-padding: 0;
|
|
23
|
+
--ui-password-group-cursor: text;
|
|
24
|
+
--ui-password-group-text-color: var(--muted-foreground);
|
|
25
|
+
--ui-password-group-text-weight: var(--font-weight-strong);
|
|
26
|
+
--ui-password-group-text-size: var(--font-size-sm);
|
|
27
|
+
--ui-password-group-textarea-min-block-size: 3lh;
|
|
28
|
+
--ui-password-group-textarea-padding-inline: var(--step-2);
|
|
29
|
+
--ui-password-group-textarea-padding-block: var(--step-1_5);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@layer zazz.components {
|
|
34
|
+
/* ===========================================================================
|
|
35
|
+
PASSWORD — .ui-password-group (text field + reveal toggle)
|
|
36
|
+
- A password is a plain .ui-input[type="password"] inside an .ui-password-group, so it
|
|
37
|
+
inherits the shared --ui-field-* surface, hover, focus, and :user-invalid states
|
|
38
|
+
for free. The only password-specific concern is the show/hide toggle.
|
|
39
|
+
- The toggle is a .ui-button[data-variant="ghost"] in a trailing addon. Its
|
|
40
|
+
aria-pressed state drives which icon shows; the <ui-password> element
|
|
41
|
+
(ui/password-group/password-group.js) flips the input's type between password/text and
|
|
42
|
+
keeps aria-pressed + aria-label in sync. With JS off the field still works as
|
|
43
|
+
a normal masked password input.
|
|
44
|
+
- Native reveal/clear chrome (Edge ::-ms-reveal, Safari credential buttons) is
|
|
45
|
+
suppressed in _reset.css so it never double-stacks with our toggle.
|
|
46
|
+
=========================================================================== */
|
|
47
|
+
|
|
48
|
+
/* <ui-password> is the custom element (ui/password-group/password-group.js) that wires
|
|
49
|
+
the toggle — it wraps .ui-password-group, so give it block flow. */
|
|
50
|
+
ui-password {
|
|
51
|
+
display: block;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ui-password-group {
|
|
55
|
+
display: var(--ui-password-group-display);
|
|
56
|
+
flex-wrap: var(--ui-password-group-wrap);
|
|
57
|
+
align-items: var(--ui-password-group-align);
|
|
58
|
+
gap: var(--ui-password-group-gap);
|
|
59
|
+
inline-size: var(--ui-password-group-inline-size);
|
|
60
|
+
min-block-size: var(--ui-password-group-min-block-size);
|
|
61
|
+
padding: var(--ui-password-group-padding);
|
|
62
|
+
overflow: clip;
|
|
63
|
+
|
|
64
|
+
/* The shell is a <label>: clicking a non-interactive addon focuses the
|
|
65
|
+
nested control, so the whole field reads as one clickable target. */
|
|
66
|
+
cursor: var(--ui-password-group-cursor);
|
|
67
|
+
|
|
68
|
+
color: var(--ui-field-foreground);
|
|
69
|
+
background-color: var(--ui-field-background);
|
|
70
|
+
border: 1px solid var(--ui-field-border);
|
|
71
|
+
border-radius: var(--ui-field-radius);
|
|
72
|
+
|
|
73
|
+
/* ring renders as box-shadow; transparent outline twin keeps focus visible
|
|
74
|
+
in forced-colors / high-contrast modes */
|
|
75
|
+
--_ring-offset-width: 0px;
|
|
76
|
+
--_ring-width: 0px;
|
|
77
|
+
--_ring: color-mix(in oklch, var(--ui-field-ring-color) var(--ring-opacity), transparent);
|
|
78
|
+
box-shadow:
|
|
79
|
+
0 0 0 var(--_ring-offset-width) var(--ring-offset-color),
|
|
80
|
+
0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width)) var(--_ring, var(--ring));
|
|
81
|
+
outline: var(--outline-width) var(--outline-style) transparent;
|
|
82
|
+
outline-offset: var(--outline-offset);
|
|
83
|
+
|
|
84
|
+
transition: var(--default-transition);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ui-password-group:hover {
|
|
88
|
+
background-color: var(--ui-field-background--hover);
|
|
89
|
+
border-color: var(--ui-field-border--hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.ui-password-group:focus-within {
|
|
93
|
+
background-color: var(--ui-field-background--focus);
|
|
94
|
+
border-color: var(--ui-field-border--focus);
|
|
95
|
+
--_ring-offset-width: var(--ring-offset-width);
|
|
96
|
+
--_ring-width: var(--ring-width);
|
|
97
|
+
outline-color: transparent;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ui-password-group:focus-within .ui-input {
|
|
101
|
+
/* Suppress the control's own focus ring since the shell has one. The control
|
|
102
|
+
still gets :focus so it can style its focus-within state (e.g. show a
|
|
103
|
+
password reveal toggle). */
|
|
104
|
+
outline: none;
|
|
105
|
+
box-shadow: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Nested control sheds its own chrome and fills the row */
|
|
109
|
+
.ui-password-group .ui-input,
|
|
110
|
+
.ui-password-group .ui-textarea {
|
|
111
|
+
flex: 1;
|
|
112
|
+
min-inline-size: 0;
|
|
113
|
+
background-color: transparent;
|
|
114
|
+
border: none;
|
|
115
|
+
border-radius: 0;
|
|
116
|
+
outline: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.ui-password-group .ui-input {
|
|
120
|
+
block-size: 100%;
|
|
121
|
+
padding-inline: 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Restore the control's own inline padding on whichever edge has no addon, so
|
|
125
|
+
text never sits flush against the shell. The reveal toggle is a trailing
|
|
126
|
+
(inline-end) addon, so by default the leading edge gets the field padding.
|
|
127
|
+
block-* addons take their own row and don't count here. */
|
|
128
|
+
.ui-password-group:not(
|
|
129
|
+
:has(
|
|
130
|
+
[data-slot~="password-group-addon"]:not([data-align]),
|
|
131
|
+
[data-slot~="password-group-addon"][data-align="inline-start"]
|
|
132
|
+
)
|
|
133
|
+
)
|
|
134
|
+
.ui-input {
|
|
135
|
+
padding-inline-start: var(--ui-field-padding);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ui-password-group:not(:has([data-slot~="password-group-addon"][data-align="inline-end"]))
|
|
139
|
+
.ui-input {
|
|
140
|
+
padding-inline-end: var(--ui-field-padding);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* A textarea claims the full width; addons stack above/below via block-* */
|
|
144
|
+
.ui-password-group .ui-textarea {
|
|
145
|
+
flex-basis: 100%;
|
|
146
|
+
min-block-size: var(--ui-password-group-textarea-min-block-size);
|
|
147
|
+
padding-inline: var(--ui-password-group-textarea-padding-inline);
|
|
148
|
+
padding-block: var(--ui-password-group-textarea-padding-block);
|
|
149
|
+
resize: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Addon — groups icons, text, kbd, or buttons together */
|
|
153
|
+
[data-slot~="password-group-addon"] {
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
flex-shrink: 0;
|
|
158
|
+
gap: var(--step-1);
|
|
159
|
+
color: var(--muted-foreground);
|
|
160
|
+
white-space: nowrap;
|
|
161
|
+
block-size: var(--ui-field-height);
|
|
162
|
+
min-inline-size: var(--ui-field-height);
|
|
163
|
+
padding-inline: var(--ui-field-addon-padding);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
[data-slot~="password-group-addon"] > svg {
|
|
167
|
+
inline-size: var(--ui-field-icon-size);
|
|
168
|
+
block-size: var(--ui-field-icon-size);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Alignment — inline-start is the default (addon visually leads the control) */
|
|
172
|
+
[data-slot~="password-group-addon"]:not([data-align]),
|
|
173
|
+
[data-slot~="password-group-addon"][data-align="inline-start"] {
|
|
174
|
+
order: -1;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
[data-slot~="password-group-addon"][data-align="inline-end"] {
|
|
178
|
+
order: 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
[data-slot~="password-group-addon"][data-align="block-start"] {
|
|
182
|
+
order: -2;
|
|
183
|
+
flex-basis: 100%;
|
|
184
|
+
padding-block: var(--ui-field-addon-padding);
|
|
185
|
+
align-items: flex-start;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
[data-slot~="password-group-addon"][data-align="block-end"] {
|
|
189
|
+
order: 2;
|
|
190
|
+
flex-basis: 100%;
|
|
191
|
+
padding-block: var(--ui-field-addon-padding);
|
|
192
|
+
align-items: flex-end;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Text addon — units, protocols, @handles ("https://", "USD", "@user") */
|
|
196
|
+
[data-slot~="password-group-text"] {
|
|
197
|
+
display: inline-flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
gap: var(--gap-xs);
|
|
200
|
+
padding-inline: var(--ui-field-addon-padding);
|
|
201
|
+
font-size: var(--ui-password-group-text-size);
|
|
202
|
+
font-weight: var(--ui-password-group-text-weight);
|
|
203
|
+
color: var(--ui-password-group-text-color);
|
|
204
|
+
min-inline-size: max-content;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
[data-slot~="password-group-text"] > svg {
|
|
208
|
+
inline-size: var(--ui-field-icon-size);
|
|
209
|
+
block-size: var(--ui-field-icon-size);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* Buttons embedded in a group shrink to nest cleanly inside the shell */
|
|
213
|
+
.ui-password-group .ui-button {
|
|
214
|
+
flex-shrink: 0;
|
|
215
|
+
border-radius: var(--ui-field-button-radius);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
:where(.ui-field:has(:user-invalid)) [data-slot~="password-group-text"] {
|
|
219
|
+
--ui-password-group-text-color: var(--destructive);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* Icon swap is driven by the toggle's pressed state: show the eye when masked,
|
|
223
|
+
the eye-off when revealed. Both icons ship in the markup; CSS toggles them so
|
|
224
|
+
no icon swap round-trips through JS. */
|
|
225
|
+
[data-slot~="password-group-toggle"] [data-slot~="password-group-icon-hide"] {
|
|
226
|
+
display: none;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
[data-slot~="password-group-toggle"][aria-pressed="true"]
|
|
230
|
+
[data-slot~="password-group-icon-show"] {
|
|
231
|
+
display: none;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
[data-slot~="password-group-toggle"][aria-pressed="true"]
|
|
235
|
+
[data-slot~="password-group-icon-hide"] {
|
|
236
|
+
display: block;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ZazzElement } from "../../base/zazz-element.ts";
|
|
2
|
+
/** Derived DOM state for one toggle configuration. */
|
|
3
|
+
interface ToggleState {
|
|
4
|
+
type: "password" | "text";
|
|
5
|
+
ariaPressed: "true" | "false";
|
|
6
|
+
ariaLabel: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @description Derives the input type, `aria-pressed`, and `aria-label` for a
|
|
10
|
+
* given reveal state. Pure: the effect in `connectedCallback` is the only
|
|
11
|
+
* place that writes it to the DOM.
|
|
12
|
+
*
|
|
13
|
+
* @param revealed - Whether the password is currently shown as plain text.
|
|
14
|
+
* @param labelShow - Toggle label while hidden.
|
|
15
|
+
* @param labelHide - Toggle label while revealed.
|
|
16
|
+
* @returns The derived DOM state.
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
declare function resolveToggleState(revealed: boolean, labelShow: string, labelHide: string): ToggleState;
|
|
20
|
+
declare class UiPassword extends ZazzElement {
|
|
21
|
+
protected setup(signal: AbortSignal): void;
|
|
22
|
+
}
|
|
23
|
+
export { UiPassword, resolveToggleState };
|
|
24
|
+
export type { ToggleState };
|
|
25
|
+
//# sourceMappingURL=password-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-group.d.ts","sourceRoot":"","sources":["password-group.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AAE5E,sDAAsD;AACtD,UAAU,WAAW;IACnB,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,CAMhG;AAED,cAAM,UAAW,SAAQ,WAAW;IAClC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAoBzC;CACF;AAKD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC;AAC1C,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<form class="flex flex-col gap-sm w-full max-w-xl">
|
|
2
|
+
<div class="ui-field">
|
|
3
|
+
<label data-slot="field-label" for="pw-preview">Password</label>
|
|
4
|
+
<ui-password>
|
|
5
|
+
<label class="ui-password-group">
|
|
6
|
+
<input
|
|
7
|
+
class="ui-input"
|
|
8
|
+
id="pw-preview"
|
|
9
|
+
name="password"
|
|
10
|
+
type="password"
|
|
11
|
+
autocomplete="new-password"
|
|
12
|
+
minlength="8"
|
|
13
|
+
required
|
|
14
|
+
placeholder="••••••••"
|
|
15
|
+
aria-describedby="pw-preview-hint pw-preview-warning"
|
|
16
|
+
/>
|
|
17
|
+
<span data-slot="password-group-addon" data-align="inline-end">
|
|
18
|
+
<button
|
|
19
|
+
class="ui-button"
|
|
20
|
+
data-slot="password-group-toggle"
|
|
21
|
+
type="button"
|
|
22
|
+
data-variant="ghost"
|
|
23
|
+
data-size="icon-sm"
|
|
24
|
+
aria-pressed="false"
|
|
25
|
+
aria-label="Show password"
|
|
26
|
+
aria-describedby="pw-preview-warning"
|
|
27
|
+
>
|
|
28
|
+
<svg
|
|
29
|
+
data-slot="password-group-icon password-group-icon-show"
|
|
30
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
31
|
+
viewBox="0 0 256 256"
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
>
|
|
34
|
+
<rect width="256" height="256" fill="none" />
|
|
35
|
+
<path
|
|
36
|
+
d="M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Z"
|
|
37
|
+
fill="none"
|
|
38
|
+
stroke="currentColor"
|
|
39
|
+
stroke-linecap="round"
|
|
40
|
+
stroke-linejoin="round"
|
|
41
|
+
stroke-width="16"
|
|
42
|
+
/>
|
|
43
|
+
<circle
|
|
44
|
+
cx="128"
|
|
45
|
+
cy="128"
|
|
46
|
+
r="40"
|
|
47
|
+
fill="none"
|
|
48
|
+
stroke="currentColor"
|
|
49
|
+
stroke-linecap="round"
|
|
50
|
+
stroke-linejoin="round"
|
|
51
|
+
stroke-width="16"
|
|
52
|
+
/>
|
|
53
|
+
</svg>
|
|
54
|
+
<svg
|
|
55
|
+
data-slot="password-group-icon password-group-icon-hide"
|
|
56
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
57
|
+
viewBox="0 0 256 256"
|
|
58
|
+
aria-hidden="true"
|
|
59
|
+
>
|
|
60
|
+
<rect width="256" height="256" fill="none" />
|
|
61
|
+
<line
|
|
62
|
+
x1="48"
|
|
63
|
+
y1="40"
|
|
64
|
+
x2="208"
|
|
65
|
+
y2="216"
|
|
66
|
+
fill="none"
|
|
67
|
+
stroke="currentColor"
|
|
68
|
+
stroke-linecap="round"
|
|
69
|
+
stroke-linejoin="round"
|
|
70
|
+
stroke-width="16"
|
|
71
|
+
/>
|
|
72
|
+
<path
|
|
73
|
+
d="M154.9,157.6A40,40,0,0,1,101,98.4"
|
|
74
|
+
fill="none"
|
|
75
|
+
stroke="currentColor"
|
|
76
|
+
stroke-linecap="round"
|
|
77
|
+
stroke-linejoin="round"
|
|
78
|
+
stroke-width="16"
|
|
79
|
+
/>
|
|
80
|
+
<path
|
|
81
|
+
d="M73.8,69.7C33.6,90.6,16,128,16,128s32,72,112,72a118.1,118.1,0,0,0,54.1-12.8"
|
|
82
|
+
fill="none"
|
|
83
|
+
stroke="currentColor"
|
|
84
|
+
stroke-linecap="round"
|
|
85
|
+
stroke-linejoin="round"
|
|
86
|
+
stroke-width="16"
|
|
87
|
+
/>
|
|
88
|
+
<path
|
|
89
|
+
d="M208.6,169.1C229.8,149.1,240,128,240,128S208,56,128,56a126,126,0,0,0-20.5,1.6"
|
|
90
|
+
fill="none"
|
|
91
|
+
stroke="currentColor"
|
|
92
|
+
stroke-linecap="round"
|
|
93
|
+
stroke-linejoin="round"
|
|
94
|
+
stroke-width="16"
|
|
95
|
+
/>
|
|
96
|
+
</svg>
|
|
97
|
+
</button>
|
|
98
|
+
</span>
|
|
99
|
+
</label>
|
|
100
|
+
</ui-password>
|
|
101
|
+
<div data-slot="field-description">
|
|
102
|
+
<span data-slot="field-hint" id="pw-preview-hint">Use eight or more characters.</span>
|
|
103
|
+
<span data-slot="field-error" role="alert">Password must be at least 8 characters.</span>
|
|
104
|
+
</div>
|
|
105
|
+
<span class="sr-only" id="pw-preview-warning"
|
|
106
|
+
>Warning: showing the password makes it visible to anyone near your screen.</span
|
|
107
|
+
>
|
|
108
|
+
</div>
|
|
109
|
+
</form>
|