elements-kit 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/await.d.mts +1 -1
- package/dist/{custom-elements-DK5VUcWA.d.mts → custom-elements-BGcU6ldL.d.mts} +2 -0
- package/dist/custom-elements.d.mts +1 -1
- package/dist/for.d.mts +1 -1
- package/dist/integrations/react.d.mts +1 -1
- package/dist/jsx-runtime/index.d.mts +1 -1
- package/dist/signals/index.d.mts +1 -1
- package/dist/{types-ncUK9rki.d.mts → types-CUvFIgPa.d.mts} +7 -7
- package/dist/ui/badge/badge.css +5 -5
- package/dist/ui/button/button.css +15 -15
- package/dist/ui/card/card.css +2 -2
- package/dist/ui/group/group.css +61 -0
- package/dist/ui/otp-input/index.d.mts +132 -0
- package/dist/ui/otp-input/index.mjs +328 -0
- package/dist/ui/otp-input/otp-input.css +157 -0
- package/dist/ui/overlay/index.css +52 -4
- package/dist/ui/overlay/index.d.mts +237 -63
- package/dist/ui/overlay/index.mjs +658 -66
- package/dist/ui/overlay/overlay.css +58 -2
- package/dist/ui/styles/index.css +662 -0
- package/dist/ui/styles/radius.css +7 -7
- package/dist/utilities/active-element.d.mts +1 -1
- package/dist/utilities/async.d.mts +1 -1
- package/dist/utilities/debounced.d.mts +1 -1
- package/dist/utilities/dom-lifecycle.bench.mjs +2 -2
- package/dist/utilities/element-rect.d.mts +1 -1
- package/dist/utilities/element-scroll.d.mts +1 -1
- package/dist/utilities/event-driven.d.mts +1 -1
- package/dist/utilities/event-listener.d.mts +1 -1
- package/dist/utilities/focus-within.d.mts +1 -1
- package/dist/utilities/hover.d.mts +1 -1
- package/dist/utilities/interval.d.mts +1 -1
- package/dist/utilities/location.d.mts +1 -1
- package/dist/utilities/media-devices.d.mts +1 -1
- package/dist/utilities/media-player.d.mts +1 -1
- package/dist/utilities/media-query.d.mts +1 -1
- package/dist/utilities/network.d.mts +1 -1
- package/dist/utilities/orientation.d.mts +1 -1
- package/dist/utilities/previous.d.mts +1 -1
- package/dist/utilities/promise.d.mts +1 -1
- package/dist/utilities/routing.d.mts +1 -1
- package/dist/utilities/search-params.d.mts +1 -1
- package/dist/utilities/storage.d.mts +1 -1
- package/dist/utilities/throttled.d.mts +1 -1
- package/dist/utilities/timeout.d.mts +1 -1
- package/dist/utilities/window-focus.d.mts +1 -1
- package/dist/utilities/window-size.d.mts +1 -1
- package/package.json +8 -1
package/dist/await.d.mts
CHANGED
|
@@ -19,10 +19,12 @@
|
|
|
19
19
|
* }
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
+
type RegisteredElementInstances = { [K in keyof ElementsKit.CustomElementRegistry]: ElementsKit.CustomElementRegistry[K] extends (abstract new (...args: any[]) => infer I) ? I : never };
|
|
22
23
|
declare global {
|
|
23
24
|
namespace ElementsKit {
|
|
24
25
|
interface CustomElementRegistry {}
|
|
25
26
|
}
|
|
27
|
+
interface HTMLElementTagNameMap extends RegisteredElementInstances {}
|
|
26
28
|
}
|
|
27
29
|
type CustomElementRegistry = ElementsKit.CustomElementRegistry;
|
|
28
30
|
type AnyCtor = CustomElementConstructor;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as defineElement, t as CustomElementRegistry } from "./custom-elements-
|
|
1
|
+
import { n as defineElement, t as CustomElementRegistry } from "./custom-elements-BGcU6ldL.mjs";
|
|
2
2
|
export { CustomElementRegistry, defineElement };
|
package/dist/for.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { G as createElement, _ as Require, a as ComponentInstance, b as MaybeReactive, c as JSX, d as ComponentProps, f as ElementProps, g as ReactiveProps, h as RawProps, i as ComponentFn, l as SlotProps, m as Props, n as Component, o as PropsTarget, p as MaybeReactiveProps, r as ComponentClass, s as Attrs, t as Child, u as Fragment, v as ResolveProps } from "../types-
|
|
1
|
+
import { G as createElement, _ as Require, a as ComponentInstance, b as MaybeReactive, c as JSX, d as ComponentProps, f as ElementProps, g as ReactiveProps, h as RawProps, i as ComponentFn, l as SlotProps, m as Props, n as Component, o as PropsTarget, p as MaybeReactiveProps, r as ComponentClass, s as Attrs, t as Child, u as Fragment, v as ResolveProps } from "../types-CUvFIgPa.mjs";
|
|
2
2
|
export { Attrs, type Child, type Component, type ComponentClass, type ComponentFn, type ComponentInstance, type ComponentProps, type ElementProps, Fragment, JSX, type MaybeReactive, type MaybeReactiveProps, type Props, type PropsTarget, type RawProps, type ReactiveProps, type Require, type ResolveProps, SlotProps, createElement as h, createElement as jsx, createElement as jsxDEV, createElement as jsxs };
|
package/dist/signals/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as EFFECT_SCOPE, B as isSignal, C as isReactive, D as CLAIM, E as resolveProps, F as effect, H as signal, I as effectScope, L as isComputed, M as SIGNAL, N as batch, O as COMPUTED, P as computed, R as isEffect, S as Updater, T as resolve, U as trigger, V as onCleanup, W as untracked, b as MaybeReactive, j as SEED, k as EFFECT, w as reactive, x as Signal, y as Computed, z as isEffectScope } from "../types-
|
|
1
|
+
import { A as EFFECT_SCOPE, B as isSignal, C as isReactive, D as CLAIM, E as resolveProps, F as effect, H as signal, I as effectScope, L as isComputed, M as SIGNAL, N as batch, O as COMPUTED, P as computed, R as isEffect, S as Updater, T as resolve, U as trigger, V as onCleanup, W as untracked, b as MaybeReactive, j as SEED, k as EFFECT, w as reactive, x as Signal, y as Computed, z as isEffectScope } from "../types-CUvFIgPa.mjs";
|
|
2
2
|
export { CLAIM, COMPUTED, Computed, EFFECT, EFFECT_SCOPE, MaybeReactive, SEED, SIGNAL, Signal, Updater, batch, computed, effect, effectScope, isComputed, isEffect, isEffectScope, isReactive, isSignal, onCleanup, reactive, resolve, resolveProps, signal, trigger, untracked };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as AttrChangeHandler, t as ATTRIBUTES } from "./attributes-3r7Diua4.mjs";
|
|
2
2
|
import { n as Slot, r as PrimitiveNodeType, t as SLOTS } from "./slot-BFWXeFRl.mjs";
|
|
3
|
-
import { t as CustomElementRegistry } from "./custom-elements-
|
|
3
|
+
import { t as CustomElementRegistry } from "./custom-elements-BGcU6ldL.mjs";
|
|
4
4
|
import { JSX } from "dom-expressions/src/jsx-h";
|
|
5
5
|
|
|
6
6
|
//#region src/jsx-runtime/element.d.ts
|
|
7
|
-
declare function createElement(type: string | Component, allProps?: JSX$1.IntrinsicAttributes & Record<string, unknown>): JSX$1.Element;
|
|
7
|
+
declare function createElement(type: string | Component, allProps?: JSX$1.IntrinsicAttributes & Record<string, unknown>): JSX$1.Element | null;
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/signals/lib.d.ts
|
|
10
10
|
declare const SIGNAL: unique symbol;
|
|
@@ -650,7 +650,7 @@ type IntrinsicElementOf<T> = T extends {
|
|
|
650
650
|
ref?: infer R | undefined;
|
|
651
651
|
} ? Extract<R, (el: any) => any> extends ((el: infer E) => any) ? E : Element : Element;
|
|
652
652
|
declare namespace JSX$1 {
|
|
653
|
-
export type Element = globalThis.Element | globalThis.DocumentFragment
|
|
653
|
+
export type Element = globalThis.Element | globalThis.DocumentFragment;
|
|
654
654
|
export type ElementType = Child | Component;
|
|
655
655
|
export interface ElementChildrenAttribute {
|
|
656
656
|
children: {};
|
|
@@ -667,15 +667,15 @@ declare namespace JSX$1 {
|
|
|
667
667
|
//#region src/jsx-runtime/types.d.ts
|
|
668
668
|
/** An instance created by a component class — must expose `render()`. */
|
|
669
669
|
interface ComponentInstance {
|
|
670
|
-
render(): JSX$1.Element;
|
|
670
|
+
render(): JSX$1.Element | null;
|
|
671
671
|
}
|
|
672
672
|
/** A class whose constructor returns a ComponentInstance. */
|
|
673
673
|
type ComponentClass<P extends Record<PropertyKey, unknown> = any> = new (props: P) => ComponentInstance;
|
|
674
|
-
type ComponentFn<P extends Record<PropertyKey, unknown> = any> = (props: ReactiveProps<P>) => JSX$1.Element;
|
|
674
|
+
type ComponentFn<P extends Record<PropertyKey, unknown> = any> = (props: ReactiveProps<P>) => JSX$1.Element | null;
|
|
675
675
|
/** Anything valid as the first arg to `createElement` / a JSX tag target. */
|
|
676
|
-
type Component =
|
|
676
|
+
type Component = JSX$1.Element | ComponentClass | ComponentFn;
|
|
677
677
|
/** A resolved runtime node — what `applyProps` / `applyChildren` operate on. */
|
|
678
|
-
type PropsTarget =
|
|
678
|
+
type PropsTarget = JSX$1.Element | ComponentInstance;
|
|
679
679
|
/** Anything that can appear as a JSX child. */
|
|
680
680
|
type Child = PrimitiveNodeType | JSX$1.Element | AnyFn | Child[];
|
|
681
681
|
type AnyFn = (...args: any[]) => Child;
|
package/dist/ui/badge/badge.css
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
border-radius: max(var(--radius-1), var(--radius-pill));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.x-badge:where([data-size="2"]) {
|
|
22
|
+
.x-badge:where([data-size="2"], :not([data-size])) {
|
|
23
23
|
font-size: var(--font-size-1);
|
|
24
24
|
line-height: var(--line-height-1);
|
|
25
25
|
letter-spacing: var(--letter-spacing-1);
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
border-radius: max(var(--radius-2), var(--radius-pill));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
.x-badge:where([data-variant="solid"]) {
|
|
40
|
+
.x-badge:where(:not([data-variant]), [data-variant="solid"]) {
|
|
41
41
|
background-color: var(--accent-9);
|
|
42
42
|
color: var(--accent-contrast);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.x-badge:where([data-variant="solid"])::selection {
|
|
45
|
+
.x-badge:where(:not([data-variant]), [data-variant="solid"])::selection {
|
|
46
46
|
background-color: var(--accent-7);
|
|
47
47
|
color: var(--accent-12);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.x-badge:where([data-variant="solid"]):where([data-high-contrast]) {
|
|
50
|
+
.x-badge:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]) {
|
|
51
51
|
background-color: var(--accent-12);
|
|
52
52
|
color: var(--accent-1);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.x-badge:where([data-variant="solid"]):where([data-high-contrast])::selection {
|
|
55
|
+
.x-badge:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast])::selection {
|
|
56
56
|
background-color: var(--accent-a11);
|
|
57
57
|
color: var(--accent-1);
|
|
58
58
|
}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
border-radius: max(var(--radius-1), var(--radius-pill));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.x-button:where([data-size="2"]) {
|
|
36
|
+
.x-button:where([data-size="2"], :not([data-size])) {
|
|
37
37
|
--base-button-height: var(--space-6);
|
|
38
38
|
border-radius: max(var(--radius-2), var(--radius-pill));
|
|
39
39
|
}
|
|
@@ -64,61 +64,61 @@
|
|
|
64
64
|
saturate(1.2);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.x-button:where([data-variant="solid"]) {
|
|
67
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]) {
|
|
68
68
|
background-color: var(--accent-9);
|
|
69
69
|
color: var(--accent-contrast);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
@media (hover: hover) {
|
|
73
|
-
.x-button:where([data-variant="solid"]):where(:hover) {
|
|
73
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where(:hover) {
|
|
74
74
|
background-color: var(--accent-10);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
.x-button:where([data-variant="solid"]):where([data-state="open"]) {
|
|
78
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-state="open"]) {
|
|
79
79
|
background-color: var(--accent-10);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.x-button:where([data-variant="solid"]):where(:active:not([data-state="open"])) {
|
|
82
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where(:active:not([data-state="open"])) {
|
|
83
83
|
background-color: var(--accent-10);
|
|
84
84
|
filter: var(--base-button-solid-active-filter);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
@media (pointer: coarse) {
|
|
88
|
-
.x-button:where([data-variant="solid"]):where(:active:not([data-state="open"])) {
|
|
88
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where(:active:not([data-state="open"])) {
|
|
89
89
|
outline: .5em solid var(--accent-a4);
|
|
90
90
|
outline-offset: 0;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
.x-button:where([data-variant="solid"]):where(:focus-visible) {
|
|
94
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where(:focus-visible) {
|
|
95
95
|
outline: 2px solid var(--focus-8);
|
|
96
96
|
outline-offset: 2px;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
.x-button:where([data-variant="solid"]):where([data-high-contrast]) {
|
|
99
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]) {
|
|
100
100
|
background-color: var(--accent-12);
|
|
101
101
|
color: var(--neutral-1);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
@media (hover: hover) {
|
|
105
|
-
.x-button:where([data-variant="solid"]):where([data-high-contrast]):where(:hover) {
|
|
105
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]):where(:hover) {
|
|
106
106
|
background-color: var(--accent-12);
|
|
107
107
|
filter: var(--base-button-solid-high-contrast-hover-filter);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
.x-button:where([data-variant="solid"]):where([data-high-contrast]):where([data-state="open"]) {
|
|
111
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]):where([data-state="open"]) {
|
|
112
112
|
background-color: var(--accent-12);
|
|
113
113
|
filter: var(--base-button-solid-high-contrast-hover-filter);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.x-button:where([data-variant="solid"]):where([data-high-contrast]):where(:active:not([data-state="open"])) {
|
|
116
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]):where(:active:not([data-state="open"])) {
|
|
117
117
|
background-color: var(--accent-12);
|
|
118
118
|
filter: var(--base-button-solid-high-contrast-active-filter);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
.x-button:where([data-variant="solid"]):where([data-disabled], :disabled) {
|
|
121
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-disabled], :disabled) {
|
|
122
122
|
color: var(--neutral-a8);
|
|
123
123
|
background-color: var(--neutral-a3);
|
|
124
124
|
filter: none;
|
|
@@ -308,19 +308,19 @@
|
|
|
308
308
|
--button-text-padding-y: var(--space-1);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
.x-button:where([data-size="2"]) {
|
|
311
|
+
.x-button:where([data-size="2"], :not([data-size])) {
|
|
312
312
|
gap: var(--space-2);
|
|
313
313
|
font-size: var(--font-size-2);
|
|
314
314
|
line-height: var(--line-height-2);
|
|
315
315
|
letter-spacing: var(--letter-spacing-2);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
.x-button:where([data-size="2"]):where(:not([data-variant="text"])) {
|
|
318
|
+
.x-button:where([data-size="2"], :not([data-size])):where(:not([data-variant="text"])) {
|
|
319
319
|
padding-left: var(--space-3);
|
|
320
320
|
padding-right: var(--space-3);
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
.x-button:where([data-size="2"]):where([data-variant="text"]) {
|
|
323
|
+
.x-button:where([data-size="2"], :not([data-size])):where([data-variant="text"]) {
|
|
324
324
|
gap: var(--space-1);
|
|
325
325
|
--button-text-padding-x: var(--space-2);
|
|
326
326
|
--button-text-padding-y: var(--space-1);
|
package/dist/ui/card/card.css
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
--card-border-radius: var(--radius-6);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
:where([data-neutral]) {
|
|
59
|
+
:where(:root), :where([data-neutral]) {
|
|
60
60
|
--card-surface-box-shadow: 0 0 0 1px var(--neutral-a5);
|
|
61
61
|
--card-surface-hover-box-shadow: 0 0 0 1px var(--neutral-a7);
|
|
62
62
|
--card-surface-active-box-shadow: 0 0 0 1px var(--neutral-a6);
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
@supports (color: color-mix(in oklab, white, black)) {
|
|
84
|
-
:where([data-neutral]) {
|
|
84
|
+
:where(:root), :where([data-neutral]) {
|
|
85
85
|
--card-surface-box-shadow: 0 0 0 1px
|
|
86
86
|
color-mix(in oklab, var(--neutral-a5), var(--neutral-5) 25%);
|
|
87
87
|
--card-surface-hover-box-shadow: 0 0 0 1px
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.x-group {
|
|
2
|
+
vertical-align: top;
|
|
3
|
+
isolation: isolate;
|
|
4
|
+
align-items: stretch;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.x-group > :is(.x-text-input, .x-select) {
|
|
9
|
+
flex: auto;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle) {
|
|
14
|
+
z-index: 0;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):where(:hover, :focus-within) {
|
|
19
|
+
z-index: 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):not(:first-child) {
|
|
23
|
+
margin-inline-start: -1px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):not(:last-child) {
|
|
27
|
+
border-start-end-radius: 0;
|
|
28
|
+
border-end-end-radius: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):not(:first-child) {
|
|
32
|
+
border-start-start-radius: 0;
|
|
33
|
+
border-end-start-radius: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.x-group > .x-text-input:not(:last-child) > input {
|
|
37
|
+
border-start-end-radius: 0;
|
|
38
|
+
border-end-end-radius: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.x-group > .x-text-input:not(:first-child) > input {
|
|
42
|
+
border-start-start-radius: 0;
|
|
43
|
+
border-end-start-radius: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.x-group > .x-button[data-variant="solid"] + .x-button[data-variant="solid"] {
|
|
47
|
+
box-shadow: inset 1px 0 0 0
|
|
48
|
+
color-mix(in srgb, var(--accent-contrast) 20%, transparent);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[dir="rtl"] .x-group > .x-button[data-variant="solid"] + .x-button[data-variant="solid"] {
|
|
52
|
+
box-shadow: inset -1px 0 0 0
|
|
53
|
+
color-mix(in srgb, var(--accent-contrast) 20%, transparent);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (forced-colors: active) {
|
|
57
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):not(:first-child) {
|
|
58
|
+
border-inline-start: 1px solid buttontext;
|
|
59
|
+
margin-inline-start: 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { n as AttrChangeHandler, t as ATTRIBUTES } from "../../attributes-3r7Diua4.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/ui/otp-input/otp-input.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `<x-otp-input>` — segmented one-time-passcode / pin input.
|
|
6
|
+
*
|
|
7
|
+
* A single transparent `<input>` (rendered into the shadow root) overlays the
|
|
8
|
+
* author-composed cells and owns all keyboard / pointer / paste / mobile
|
|
9
|
+
* autofill behavior. The cells (`<x-otp-slot>`, projected through a `<slot>`)
|
|
10
|
+
* are a purely visual layer whose active cell + fake caret are mirrored from
|
|
11
|
+
* the input's selection. Because it is one field there is no roving tabindex
|
|
12
|
+
* and a screen reader perceives a single textbox.
|
|
13
|
+
*
|
|
14
|
+
* Form-associated: submits under the host `name`, participates in
|
|
15
|
+
* reset / restore / disabled, and reports `valueMissing` / `tooShort`.
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <x-otp-input name="code" maxlength="6" pattern="[0-9]" aria-label="Code">
|
|
19
|
+
* <x-otp-group>
|
|
20
|
+
* <x-otp-slot index="0"></x-otp-slot>
|
|
21
|
+
* <x-otp-slot index="1"></x-otp-slot>
|
|
22
|
+
* <x-otp-slot index="2"></x-otp-slot>
|
|
23
|
+
* </x-otp-group>
|
|
24
|
+
* <x-otp-separator></x-otp-separator>
|
|
25
|
+
* <x-otp-group>
|
|
26
|
+
* <x-otp-slot index="3"></x-otp-slot>
|
|
27
|
+
* <x-otp-slot index="4"></x-otp-slot>
|
|
28
|
+
* <x-otp-slot index="5"></x-otp-slot>
|
|
29
|
+
* </x-otp-group>
|
|
30
|
+
* </x-otp-input>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare class XOtpInput extends HTMLElement {
|
|
34
|
+
#private;
|
|
35
|
+
static formAssociated: boolean;
|
|
36
|
+
static [ATTRIBUTES]: {
|
|
37
|
+
value(this: XOtpInput, value: string | null): void;
|
|
38
|
+
maxlength(this: XOtpInput, value: string | null): void;
|
|
39
|
+
disabled(this: XOtpInput, value: string | null): void;
|
|
40
|
+
required(this: XOtpInput, value: string | null): void;
|
|
41
|
+
pattern(this: XOtpInput, value: string | null): void;
|
|
42
|
+
inputmode(this: XOtpInput, value: string | null): void;
|
|
43
|
+
};
|
|
44
|
+
static observedAttributes: string[];
|
|
45
|
+
static events: {
|
|
46
|
+
complete: CustomEvent<string>;
|
|
47
|
+
};
|
|
48
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
49
|
+
get value(): string;
|
|
50
|
+
set value(v: string);
|
|
51
|
+
get maxLength(): number;
|
|
52
|
+
set maxLength(v: number);
|
|
53
|
+
get disabled(): boolean;
|
|
54
|
+
set disabled(v: boolean);
|
|
55
|
+
get required(): boolean;
|
|
56
|
+
set required(v: boolean);
|
|
57
|
+
get pattern(): string | null;
|
|
58
|
+
set pattern(v: string | null);
|
|
59
|
+
get name(): string;
|
|
60
|
+
set name(v: string);
|
|
61
|
+
/** Optional transform applied to pasted text before validation. */
|
|
62
|
+
pasteTransformer: ((text: string) => string) | null;
|
|
63
|
+
connectedCallback(): void;
|
|
64
|
+
disconnectedCallback(): void;
|
|
65
|
+
formResetCallback(): void;
|
|
66
|
+
formStateRestoreCallback(state: unknown): void;
|
|
67
|
+
formDisabledCallback(disabled: boolean): void;
|
|
68
|
+
get validity(): ValidityState | null;
|
|
69
|
+
}
|
|
70
|
+
declare global {
|
|
71
|
+
namespace ElementsKit {
|
|
72
|
+
interface CustomElementRegistry {
|
|
73
|
+
"x-otp-input": typeof XOtpInput;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/ui/otp-input/otp-slot.d.ts
|
|
79
|
+
/**
|
|
80
|
+
* `<x-otp-slot index="N">` — one visual cell of an `<x-otp-input>`. Purely
|
|
81
|
+
* presentational: `aria-hidden`, no focus, no value of its own. The parent
|
|
82
|
+
* `<x-otp-input>` paints its character and active / caret / disabled state by
|
|
83
|
+
* index; all styling lives in the companion CSS.
|
|
84
|
+
*/
|
|
85
|
+
declare class XOtpSlot extends HTMLElement {
|
|
86
|
+
static [ATTRIBUTES]: {
|
|
87
|
+
index: AttrChangeHandler<XOtpSlot>;
|
|
88
|
+
};
|
|
89
|
+
connectedCallback(): void;
|
|
90
|
+
}
|
|
91
|
+
declare global {
|
|
92
|
+
namespace ElementsKit {
|
|
93
|
+
interface CustomElementRegistry {
|
|
94
|
+
"x-otp-slot": typeof XOtpSlot;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/ui/otp-input/otp-group.d.ts
|
|
100
|
+
/**
|
|
101
|
+
* `<x-otp-group>` — presentational container that joins a run of
|
|
102
|
+
* `<x-otp-slot>`s into one attached group. All layout lives in CSS; this only
|
|
103
|
+
* applies a `group` role so the visual grouping is exposed to assistive tech.
|
|
104
|
+
*/
|
|
105
|
+
declare class XOtpGroup extends HTMLElement {
|
|
106
|
+
connectedCallback(): void;
|
|
107
|
+
}
|
|
108
|
+
declare global {
|
|
109
|
+
namespace ElementsKit {
|
|
110
|
+
interface CustomElementRegistry {
|
|
111
|
+
"x-otp-group": typeof XOtpGroup;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/ui/otp-input/otp-separator.d.ts
|
|
117
|
+
/**
|
|
118
|
+
* `<x-otp-separator>` — decorative divider authored between OTP groups (e.g. a
|
|
119
|
+
* dash between a 3-3 split). Purely visual: `aria-hidden`, glyph drawn in CSS.
|
|
120
|
+
*/
|
|
121
|
+
declare class XOtpSeparator extends HTMLElement {
|
|
122
|
+
connectedCallback(): void;
|
|
123
|
+
}
|
|
124
|
+
declare global {
|
|
125
|
+
namespace ElementsKit {
|
|
126
|
+
interface CustomElementRegistry {
|
|
127
|
+
"x-otp-separator": typeof XOtpSeparator;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { XOtpGroup, XOtpInput, XOtpSeparator, XOtpSlot };
|