@nvidia-elements/forms 0.0.7 → 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 +155 -14
- package/NOTICE.md +1 -39
- package/README.md +1 -7
- package/dist/custom-elements.json +1293 -254
- package/dist/examples/csv.examples.js.map +1 -1
- package/dist/examples/csv.examples.json +1 -1
- package/dist/examples/light.examples.js.map +1 -1
- package/dist/examples/light.examples.json +2 -2
- package/dist/examples/simple.examples.js.map +1 -1
- package/dist/examples/simple.examples.json +2 -2
- package/dist/examples/visualization.examples.js.map +1 -1
- package/dist/examples/visualization.examples.json +2 -2
- package/dist/index.js +1 -1
- package/dist/internal/controllers/state-active.controller.d.ts +13 -0
- package/dist/internal/controllers/state-active.controller.js +26 -0
- package/dist/internal/controllers/state-active.controller.js.map +1 -0
- package/dist/internal/controllers/state-current.controller.d.ts +15 -0
- package/dist/internal/controllers/state-current.controller.js +34 -0
- package/dist/internal/controllers/state-current.controller.js.map +1 -0
- package/dist/internal/controllers/state-disabled.controller.d.ts +18 -0
- package/dist/internal/controllers/state-disabled.controller.js +17 -0
- package/dist/internal/controllers/state-disabled.controller.js.map +1 -0
- package/dist/internal/controllers/state-expanded.controller.d.ts +12 -0
- package/dist/internal/controllers/state-expanded.controller.js +17 -0
- package/dist/internal/controllers/state-expanded.controller.js.map +1 -0
- package/dist/internal/controllers/state-pressed.controller.d.ts +12 -0
- package/dist/internal/controllers/state-pressed.controller.js +17 -0
- package/dist/internal/controllers/state-pressed.controller.js.map +1 -0
- package/dist/internal/controllers/state-readonly.controller.d.ts +12 -0
- package/dist/internal/controllers/state-readonly.controller.js +17 -0
- package/dist/internal/controllers/state-readonly.controller.js.map +1 -0
- package/dist/internal/controllers/state-selected.controller.d.ts +15 -0
- package/dist/internal/controllers/state-selected.controller.js +34 -0
- package/dist/internal/controllers/state-selected.controller.js.map +1 -0
- package/dist/internal/controllers/type-anchor.controller.d.ts +15 -0
- package/dist/internal/controllers/type-anchor.controller.js +51 -0
- package/dist/internal/controllers/type-anchor.controller.js.map +1 -0
- package/dist/internal/controllers/type-button.controller.d.ts +14 -0
- package/dist/internal/controllers/type-button.controller.js +22 -0
- package/dist/internal/controllers/type-button.controller.js.map +1 -0
- package/dist/internal/controllers/type-command.controller.d.ts +16 -0
- package/dist/internal/controllers/type-command.controller.js +36 -0
- package/dist/internal/controllers/type-command.controller.js.map +1 -0
- package/dist/internal/controllers/type-interest-invoker.controller.d.ts +12 -0
- package/dist/internal/controllers/type-interest-invoker.controller.js +38 -0
- package/dist/internal/controllers/type-interest-invoker.controller.js.map +1 -0
- package/dist/internal/controllers/type-native-button.controller.d.ts +19 -0
- package/dist/internal/controllers/type-native-button.controller.js +54 -0
- package/dist/internal/controllers/type-native-button.controller.js.map +1 -0
- package/dist/internal/controllers/type-popover-trigger.controller.d.ts +16 -0
- package/dist/internal/controllers/type-popover-trigger.controller.js +21 -0
- package/dist/internal/controllers/type-popover-trigger.controller.js.map +1 -0
- package/dist/internal/controllers/types.d.ts +8 -0
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/schema.js +13 -24
- package/dist/internal/schema.js.map +1 -1
- package/dist/internal/types.d.ts +18 -4
- package/dist/internal/utils.d.ts +17 -0
- package/dist/internal/utils.js +53 -1
- package/dist/internal/utils.js.map +1 -1
- package/dist/mixins/button.d.ts +22 -0
- package/dist/mixins/button.js +344 -0
- package/dist/mixins/button.js.map +1 -0
- package/dist/mixins/button.types.d.ts +121 -0
- package/dist/mixins/checkbox.d.ts +41 -0
- package/dist/mixins/checkbox.js +109 -0
- package/dist/mixins/checkbox.js.map +1 -0
- package/dist/mixins/control.d.ts +189 -0
- package/dist/mixins/control.js +358 -0
- package/dist/mixins/control.js.map +1 -0
- package/dist/mixins/index.d.ts +5 -0
- package/dist/mixins/index.js +6 -0
- package/dist/mixins/select.d.ts +49 -0
- package/dist/mixins/select.js +80 -0
- package/dist/mixins/select.js.map +1 -0
- package/dist/mixins/slider.d.ts +62 -0
- package/dist/mixins/slider.js +175 -0
- package/dist/mixins/slider.js.map +1 -0
- package/dist/validators/index.js.map +1 -1
- package/package.json +31 -19
- package/dist/mixin/index.d.ts +0 -460
- package/dist/mixin/index.js +0 -188
- package/dist/mixin/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../src/internal/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function isObjectLiteral(item: unknown) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) {\n return false;\n }\n const proto = Object.getPrototypeOf(item);\n return proto === null || proto === Object.prototype;\n}\n"],"mappings":";AAGA,SAAgB,EAAgB,GAAe;
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/internal/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function isObjectLiteral(item: unknown) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) {\n return false;\n }\n const proto = Object.getPrototypeOf(item);\n return proto === null || proto === Object.prototype;\n}\n\nexport function attachInternals(element: HTMLElement & { _internals?: ElementInternals }) {\n if (element._internals === undefined) {\n element._internals = element.attachInternals() as unknown as ElementInternals;\n }\n\n return element._internals;\n}\n\nexport function toggleState(internals: ElementInternals, state: string, force: boolean) {\n if (force) {\n internals.states.add(state);\n } else {\n internals.states.delete(state);\n }\n}\n\nexport type PopoverAnchorElement = HTMLElement & { anchor?: HTMLElement | string; _activeTrigger?: HTMLElement };\n\nexport function getFlattenedDOMTree(node: Node, depth = 10): HTMLElement[] {\n return (\n Array.from(getChildren(node)).reduce(\n (p: unknown[], n: Node) => [\n ...p,\n [n, [...Array.from(getChildren(n)).map(i => [i, getFlattenedDOMTree(i, depth)])]]\n ],\n []\n ) as unknown as HTMLElement[]\n ).flat(depth);\n}\n\nexport function getHostAnchor(host: PopoverAnchorElement) {\n const anchor = host.anchor ?? host._activeTrigger;\n\n if (typeof anchor === 'string' && anchor.length) {\n if (!host.parentNode) {\n return globalThis.document.body;\n }\n\n return (\n getFlattenedDOMTree(host.parentNode as Node).find(element => element.id === anchor) ?? globalThis.document.body\n );\n }\n\n if (anchor instanceof HTMLElement && anchor !== globalThis.document.body) {\n return anchor;\n }\n\n return globalThis.document.body;\n}\n\nexport function getStringValue(value: unknown) {\n if (typeof value === 'string' && value.length) {\n return value;\n }\n\n return value === '' ? '' : null;\n}\n\nexport function hasAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n return value === null ? !element.hasAttribute(attribute) : element.getAttribute(attribute) === value;\n}\n\nexport function isFormElement(value: unknown): value is HTMLFormElement {\n return typeof HTMLFormElement !== 'undefined' && value instanceof HTMLFormElement;\n}\n\nexport function onKeys(events: string[], event: KeyboardEvent, callback: () => void) {\n if (events.includes(event.code)) {\n callback();\n }\n}\n\nexport function removeEmptyTextNode(node: Node) {\n if ((node as Text)?.wholeText?.trim() === '') {\n node.parentNode?.removeChild(node);\n }\n}\n\nexport function setAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(attribute);\n } else {\n element.setAttribute(attribute, value);\n }\n}\n\nexport function stopEvent(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nfunction getChildren(node: Node): Element[] {\n if (isDocumentNode(node)) {\n return Array.from(node.documentElement.children);\n }\n\n if (isElementWithShadowRoot(node)) {\n return Array.from(node.shadowRoot.children);\n }\n\n if (isSlotElement(node)) {\n const slotted = node.assignedElements();\n return slotted.length ? slotted : Array.from(node.children);\n }\n\n return Array.from((node as HTMLElement).children ?? []);\n}\n\nfunction isDocumentNode(node: Node): node is Document {\n return typeof Document !== 'undefined' && node instanceof Document && Boolean(node.documentElement);\n}\n\nfunction isElementWithShadowRoot(node: Node): node is HTMLElement & { shadowRoot: ShadowRoot } {\n return typeof HTMLElement !== 'undefined' && node instanceof HTMLElement && Boolean(node.shadowRoot);\n}\n\nfunction isSlotElement(node: Node): node is HTMLSlotElement {\n return typeof HTMLSlotElement !== 'undefined' && node instanceof HTMLSlotElement && Boolean(node.assignedElements);\n}\n"],"mappings":";AAGA,SAAgB,EAAgB,GAAe;CAC7C,IAAI,CAAC,KAAQ,OAAO,KAAS,YAAY,MAAM,QAAQ,CAAI,GACzD,OAAO;CAET,IAAM,IAAQ,OAAO,eAAe,CAAI;CACxC,OAAO,MAAU,QAAQ,MAAU,OAAO;AAC5C;AAEA,SAAgB,EAAgB,GAA0D;CAKxF,OAJI,EAAQ,eAAe,KAAA,MACzB,EAAQ,aAAa,EAAQ,gBAAgB,IAGxC,EAAQ;AACjB;AAEA,SAAgB,EAAY,GAA6B,GAAe,GAAgB;CACtF,AAAI,IACF,EAAU,OAAO,IAAI,CAAK,IAE1B,EAAU,OAAO,OAAO,CAAK;AAEjC;AAIA,SAAgB,EAAoB,GAAY,IAAQ,IAAmB;CACzE,OACE,MAAM,KAAK,EAAY,CAAI,CAAC,EAAE,QAC3B,GAAc,MAAY,CACzB,GAAG,GACH,CAAC,GAAG,CAAC,GAAG,MAAM,KAAK,EAAY,CAAC,CAAC,EAAE,KAAI,MAAK,CAAC,GAAG,EAAoB,GAAG,CAAK,CAAC,CAAC,CAAC,CAAC,CAClF,GACA,CAAC,CACH,EACA,KAAK,CAAK;AACd;AAEA,SAAgB,EAAc,GAA4B;CACxD,IAAM,IAAS,EAAK,UAAU,EAAK;CAgBnC,OAdI,OAAO,KAAW,YAAY,EAAO,SAClC,EAAK,aAKR,EAAoB,EAAK,UAAkB,EAAE,MAAK,MAAW,EAAQ,OAAO,CAAM,KAAK,WAAW,SAAS,OAJpG,WAAW,SAAS,OAQ3B,aAAkB,eAAe,MAAW,WAAW,SAAS,OAC3D,IAGF,WAAW,SAAS;AAC7B;AAEA,SAAgB,EAAe,GAAgB;CAK7C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1D,OAAO,OAAO,kBAAoB,OAAe,aAAgB,mBAAmB,EAAQ,EAAK;AACnG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ButtonFormControlMixinInstance } from './button.types.js';
|
|
2
|
+
export type { ButtonFormControlMixinInstance, ButtonType, CurrentState, PopoverTargetAction } from './button.types.js';
|
|
3
|
+
interface ButtonFormControlHost {
|
|
4
|
+
connectedCallback?(): void;
|
|
5
|
+
disconnectedCallback?(): void;
|
|
6
|
+
attributeChangedCallback?(name: string, oldValue: string | null, newValue: string | null): void;
|
|
7
|
+
requestUpdate?(name?: string, oldValue?: unknown): void;
|
|
8
|
+
updateComplete?: Promise<unknown>;
|
|
9
|
+
}
|
|
10
|
+
type Constructor = (new (...args: any[]) => HTMLElement & ButtonFormControlHost) & {
|
|
11
|
+
observedAttributes?: string[];
|
|
12
|
+
};
|
|
13
|
+
type ButtonFormControlConstructor<TBase extends Constructor> = new (...args: ConstructorParameters<TBase>) => InstanceType<TBase> & ButtonFormControlMixinInstance;
|
|
14
|
+
export type ButtonFormControlMixinReturn<TBase extends Constructor> = ButtonFormControlConstructor<TBase> & {
|
|
15
|
+
formAssociated: boolean;
|
|
16
|
+
observedAttributes: string[];
|
|
17
|
+
} & Omit<TBase, 'prototype'>;
|
|
18
|
+
/**
|
|
19
|
+
* @description A mixin that adds native button-style form, command, popover, and interaction behavior.
|
|
20
|
+
* @aria https://www.w3.org/WAI/ARIA/apg/patterns/button/
|
|
21
|
+
*/
|
|
22
|
+
export declare function ButtonFormControlMixin<TBase extends Constructor>(SuperClass: TBase): ButtonFormControlMixinReturn<TBase>;
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { attachInternals as e, getStringValue as t, hasAttributeValue as n, isFormElement as r, setAttributeValue as i } from "../internal/utils.js";
|
|
2
|
+
import { TypeAnchorController as a } from "../internal/controllers/type-anchor.controller.js";
|
|
3
|
+
import { TypeButtonController as o } from "../internal/controllers/type-button.controller.js";
|
|
4
|
+
import { TypeCommandController as s } from "../internal/controllers/type-command.controller.js";
|
|
5
|
+
import { TypeInterestInvokerController as c } from "../internal/controllers/type-interest-invoker.controller.js";
|
|
6
|
+
import { TypeNativeButtonController as l } from "../internal/controllers/type-native-button.controller.js";
|
|
7
|
+
import { TypePopoverTriggerController as u } from "../internal/controllers/type-popover-trigger.controller.js";
|
|
8
|
+
import { StateActiveController as d } from "../internal/controllers/state-active.controller.js";
|
|
9
|
+
import { StateCurrentController as f } from "../internal/controllers/state-current.controller.js";
|
|
10
|
+
import { StateDisabledController as p } from "../internal/controllers/state-disabled.controller.js";
|
|
11
|
+
import { StateExpandedController as m } from "../internal/controllers/state-expanded.controller.js";
|
|
12
|
+
import { StatePressedController as h } from "../internal/controllers/state-pressed.controller.js";
|
|
13
|
+
import { StateReadOnlyController as g } from "../internal/controllers/state-readonly.controller.js";
|
|
14
|
+
import { StateSelectedController as _ } from "../internal/controllers/state-selected.controller.js";
|
|
15
|
+
//#region src/mixins/button.ts
|
|
16
|
+
function v(v) {
|
|
17
|
+
return class y extends v {
|
|
18
|
+
constructor(...t) {
|
|
19
|
+
super(...t), this.#t = null, this.#n = null, this.#i = !1, this.#o = null, this.#s = !1, this.#c = null, this.#l = null, this.#d = /* @__PURE__ */ new Map(), this.#p = null, this.#g = !1, this.#v = !1, this._internals = e(this), this._typeAnchorController = new a(this), this._typeButtonController = new o(this), this._typeNativeButtonController = new l(this), this._typeCommandController = new s(this), this._typeInterestInvokerController = new c(this), this._typePopoverTriggerController = new u(this), this._stateActiveController = new d(this), this._stateDisabledController = new p(this), this._stateExpandedController = new m(this), this._statePressedController = new h(this), this._stateSelectedController = new _(this), this._stateCurrentController = new f(this), this._stateReadOnlyController = new g(this);
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
this.formAssociated = !0;
|
|
23
|
+
}
|
|
24
|
+
#e;
|
|
25
|
+
#t;
|
|
26
|
+
#n;
|
|
27
|
+
#r;
|
|
28
|
+
#i;
|
|
29
|
+
#a;
|
|
30
|
+
#o;
|
|
31
|
+
#s;
|
|
32
|
+
#c;
|
|
33
|
+
#l;
|
|
34
|
+
#u;
|
|
35
|
+
#d;
|
|
36
|
+
#f;
|
|
37
|
+
#p;
|
|
38
|
+
#m;
|
|
39
|
+
#h;
|
|
40
|
+
#g;
|
|
41
|
+
#_;
|
|
42
|
+
#v;
|
|
43
|
+
#y;
|
|
44
|
+
#b;
|
|
45
|
+
static get observedAttributes() {
|
|
46
|
+
return (super.observedAttributes ?? []).concat([
|
|
47
|
+
"pressed",
|
|
48
|
+
"expanded",
|
|
49
|
+
"readonly",
|
|
50
|
+
"form",
|
|
51
|
+
"name",
|
|
52
|
+
"value",
|
|
53
|
+
"type",
|
|
54
|
+
"disabled",
|
|
55
|
+
"selected",
|
|
56
|
+
"current",
|
|
57
|
+
"popovertarget",
|
|
58
|
+
"popovertargetaction",
|
|
59
|
+
"commandfor",
|
|
60
|
+
"command",
|
|
61
|
+
"interestfor"
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
get pressed() {
|
|
65
|
+
return this.#h;
|
|
66
|
+
}
|
|
67
|
+
set pressed(e) {
|
|
68
|
+
this.#T({
|
|
69
|
+
property: "pressed",
|
|
70
|
+
value: !!e,
|
|
71
|
+
reflect: !0
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
get expanded() {
|
|
75
|
+
return this.#a;
|
|
76
|
+
}
|
|
77
|
+
set expanded(e) {
|
|
78
|
+
this.#T({
|
|
79
|
+
property: "expanded",
|
|
80
|
+
value: !!e,
|
|
81
|
+
reflect: !0
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
get readOnly() {
|
|
85
|
+
return this.#g || !!this._typeAnchorController?.readOnly;
|
|
86
|
+
}
|
|
87
|
+
set readOnly(e) {
|
|
88
|
+
this.#T({
|
|
89
|
+
property: "readOnly",
|
|
90
|
+
value: !!e,
|
|
91
|
+
reflect: !0,
|
|
92
|
+
attribute: "readonly"
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
get readonly() {
|
|
96
|
+
return this.readOnly;
|
|
97
|
+
}
|
|
98
|
+
set readonly(e) {
|
|
99
|
+
this.readOnly = e;
|
|
100
|
+
}
|
|
101
|
+
set form(e) {
|
|
102
|
+
let t = this.form;
|
|
103
|
+
this.#o = e, typeof e == "string" ? this.setAttribute("form", e) : this.removeAttribute("form"), this.#M("form", t), this.#x();
|
|
104
|
+
}
|
|
105
|
+
get form() {
|
|
106
|
+
if (this.#o && typeof this.#o != "string") return this.#o;
|
|
107
|
+
if (typeof this.#o == "string" && globalThis.document !== void 0) {
|
|
108
|
+
let e = this.getRootNode(), t = e.getElementById ? e.getElementById(this.#o) : null;
|
|
109
|
+
return r(t) ? t : null;
|
|
110
|
+
}
|
|
111
|
+
return this._internals?.form ?? null;
|
|
112
|
+
}
|
|
113
|
+
get name() {
|
|
114
|
+
return this.#u;
|
|
115
|
+
}
|
|
116
|
+
set name(e) {
|
|
117
|
+
this.#O({
|
|
118
|
+
property: "name",
|
|
119
|
+
value: e
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
get value() {
|
|
123
|
+
return this.#b;
|
|
124
|
+
}
|
|
125
|
+
set value(e) {
|
|
126
|
+
this.#O({
|
|
127
|
+
property: "value",
|
|
128
|
+
value: e
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
get type() {
|
|
132
|
+
return this.#y ?? this._typeNativeButtonController?.defaultType;
|
|
133
|
+
}
|
|
134
|
+
set type(e) {
|
|
135
|
+
this.#O({
|
|
136
|
+
property: "type",
|
|
137
|
+
value: e
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
get disabled() {
|
|
141
|
+
return this.#i;
|
|
142
|
+
}
|
|
143
|
+
set disabled(e) {
|
|
144
|
+
this.#T({
|
|
145
|
+
property: "disabled",
|
|
146
|
+
value: !!e,
|
|
147
|
+
reflect: !0
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
get selected() {
|
|
151
|
+
return this.#_;
|
|
152
|
+
}
|
|
153
|
+
set selected(e) {
|
|
154
|
+
this.#T({
|
|
155
|
+
property: "selected",
|
|
156
|
+
value: !!e,
|
|
157
|
+
reflect: !0
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
get current() {
|
|
161
|
+
return this.#r;
|
|
162
|
+
}
|
|
163
|
+
set current(e) {
|
|
164
|
+
this.#O({
|
|
165
|
+
property: "current",
|
|
166
|
+
value: e
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
get popoverTargetElement() {
|
|
170
|
+
return this.#p;
|
|
171
|
+
}
|
|
172
|
+
set popoverTargetElement(e) {
|
|
173
|
+
let t = this.#p;
|
|
174
|
+
this.#p = e, this.#M("popoverTargetElement", t), this.#x();
|
|
175
|
+
}
|
|
176
|
+
get popovertarget() {
|
|
177
|
+
return this.#m;
|
|
178
|
+
}
|
|
179
|
+
set popovertarget(e) {
|
|
180
|
+
this.#O({
|
|
181
|
+
property: "popovertarget",
|
|
182
|
+
value: e
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
get popoverTargetAction() {
|
|
186
|
+
return this.#f;
|
|
187
|
+
}
|
|
188
|
+
set popoverTargetAction(e) {
|
|
189
|
+
this.#O({
|
|
190
|
+
property: "popoverTargetAction",
|
|
191
|
+
value: e,
|
|
192
|
+
attribute: "popovertargetaction"
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
get commandForElement() {
|
|
196
|
+
return this.#t;
|
|
197
|
+
}
|
|
198
|
+
set commandForElement(e) {
|
|
199
|
+
let t = this.#t;
|
|
200
|
+
this.#t = e, this.#M("commandForElement", t), this.#x();
|
|
201
|
+
}
|
|
202
|
+
get commandfor() {
|
|
203
|
+
return this.#n;
|
|
204
|
+
}
|
|
205
|
+
set commandfor(e) {
|
|
206
|
+
this.#O({
|
|
207
|
+
property: "commandfor",
|
|
208
|
+
value: e
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
get command() {
|
|
212
|
+
return this.#e;
|
|
213
|
+
}
|
|
214
|
+
set command(e) {
|
|
215
|
+
this.#O({
|
|
216
|
+
property: "command",
|
|
217
|
+
value: e
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
get interestForElement() {
|
|
221
|
+
return this.#c;
|
|
222
|
+
}
|
|
223
|
+
set interestForElement(e) {
|
|
224
|
+
let t = this.#c;
|
|
225
|
+
this.#c = e, this.#M("interestForElement", t), this.#x();
|
|
226
|
+
}
|
|
227
|
+
get interestfor() {
|
|
228
|
+
return this.#l;
|
|
229
|
+
}
|
|
230
|
+
set interestfor(e) {
|
|
231
|
+
this.#O({
|
|
232
|
+
property: "interestfor",
|
|
233
|
+
value: e
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
addController(e) {
|
|
237
|
+
this._controllers ??= /* @__PURE__ */ new Set(), this._controllers.add(e);
|
|
238
|
+
}
|
|
239
|
+
connectedCallback() {
|
|
240
|
+
super.connectedCallback?.(), this._controllers?.forEach((e) => e.hostConnected?.()), e(this), this.#s = !0, this.#P(), this.#S(), this.#x();
|
|
241
|
+
}
|
|
242
|
+
disconnectedCallback() {
|
|
243
|
+
this._controllers?.forEach((e) => e.hostDisconnected?.()), super.disconnectedCallback?.();
|
|
244
|
+
}
|
|
245
|
+
updated(e) {
|
|
246
|
+
Object.getPrototypeOf(y.prototype).updated?.call(this, e), this.#v = !1, this.#S();
|
|
247
|
+
}
|
|
248
|
+
attributeChangedCallback(e, t, n) {
|
|
249
|
+
super.attributeChangedCallback?.(e, t, n), t !== n && (this.#C(e, n), this.#w(e, t, n));
|
|
250
|
+
}
|
|
251
|
+
#x() {
|
|
252
|
+
!this.isConnected || this.#v || (this.#v = !0, this.#N().then(() => {
|
|
253
|
+
this.#v && (this.#v = !1, this.isConnected && this.#S());
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
#S() {
|
|
257
|
+
this._controllers?.forEach((e) => e.hostUpdated?.());
|
|
258
|
+
}
|
|
259
|
+
#C(e, t) {
|
|
260
|
+
(e === "pressed" || e === "expanded" || e === "selected" || e === "disabled") && this.#T({
|
|
261
|
+
property: e,
|
|
262
|
+
value: t !== null,
|
|
263
|
+
reflect: !1
|
|
264
|
+
}), e === "readonly" && this.#T({
|
|
265
|
+
property: "readOnly",
|
|
266
|
+
value: t !== null,
|
|
267
|
+
reflect: !1
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
#w(e, t, n) {
|
|
271
|
+
e === "form" && (r(this.#o) && n === null || (this.#o = n, this.#M("form", t))), e === "popovertargetaction" && this.#O({
|
|
272
|
+
property: "popoverTargetAction",
|
|
273
|
+
value: n,
|
|
274
|
+
reflect: !1
|
|
275
|
+
}), this.#O({
|
|
276
|
+
property: e,
|
|
277
|
+
value: n,
|
|
278
|
+
reflect: !1
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
#T({ property: e, value: t, reflect: r, attribute: i = e }) {
|
|
282
|
+
let a = this.#E(e);
|
|
283
|
+
a === t && (!r || n(this, i, t ? "" : null)) || (this.#D(e, t), !(r && this.#j(i, t ? "" : null)) && (this.#M(e, a), this.#x()));
|
|
284
|
+
}
|
|
285
|
+
#E(e) {
|
|
286
|
+
return {
|
|
287
|
+
disabled: this.#i,
|
|
288
|
+
expanded: this.#a,
|
|
289
|
+
pressed: this.#h,
|
|
290
|
+
readOnly: this.#g,
|
|
291
|
+
selected: this.#_
|
|
292
|
+
}[e];
|
|
293
|
+
}
|
|
294
|
+
#D(e, t) {
|
|
295
|
+
e === "disabled" ? this.#i = t : e === "expanded" ? this.#a = t : e === "pressed" ? this.#h = t : e === "readOnly" ? this.#g = t : e === "selected" && (this.#_ = t);
|
|
296
|
+
}
|
|
297
|
+
#O({ property: e, value: r, attribute: i = e, reflect: a = !0 }) {
|
|
298
|
+
let o = this.#k(e), s = t(r);
|
|
299
|
+
o === s && (!a || n(this, i, s)) || (this.#A(e, s), !(a && this.#j(i, s)) && (this.#M(e, o), this.#x()));
|
|
300
|
+
}
|
|
301
|
+
#k(e) {
|
|
302
|
+
return {
|
|
303
|
+
command: this.#e,
|
|
304
|
+
commandfor: this.#n,
|
|
305
|
+
current: this.#r,
|
|
306
|
+
interestfor: this.#l,
|
|
307
|
+
name: this.#u,
|
|
308
|
+
popoverTargetAction: this.#f,
|
|
309
|
+
popovertarget: this.#m,
|
|
310
|
+
type: this.#y,
|
|
311
|
+
value: this.#b
|
|
312
|
+
}[e];
|
|
313
|
+
}
|
|
314
|
+
#A(e, t) {
|
|
315
|
+
({
|
|
316
|
+
command: () => this.#e = t ?? void 0,
|
|
317
|
+
commandfor: () => this.#n = t,
|
|
318
|
+
current: () => this.#r = t,
|
|
319
|
+
interestfor: () => this.#l = t,
|
|
320
|
+
name: () => this.#u = t ?? void 0,
|
|
321
|
+
popoverTargetAction: () => this.#f = t,
|
|
322
|
+
popovertarget: () => this.#m = t ?? void 0,
|
|
323
|
+
type: () => this.#y = t,
|
|
324
|
+
value: () => this.#b = t ?? void 0
|
|
325
|
+
})[e]?.();
|
|
326
|
+
}
|
|
327
|
+
#j(e, t) {
|
|
328
|
+
return !this.isConnected && !this.#s ? (this.hasAttribute(e) || this.#d.set(e, t), !0) : (i(this, e, t), !1);
|
|
329
|
+
}
|
|
330
|
+
#M(e, t) {
|
|
331
|
+
this.requestUpdate?.(e, t);
|
|
332
|
+
}
|
|
333
|
+
#N() {
|
|
334
|
+
return this.updateComplete ?? Promise.resolve();
|
|
335
|
+
}
|
|
336
|
+
#P() {
|
|
337
|
+
this.#d.forEach((e, t) => i(this, t, e)), this.#d.clear();
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
//#endregion
|
|
342
|
+
export { v as ButtonFormControlMixin };
|
|
343
|
+
|
|
344
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","names":["#pressed","#setBooleanState","#expanded","#readOnly","#form","#requestHostUpdate","#queueBehaviorSync","#name","#setStringState","#value","#type","#disabled","#selected","#current","#popoverTargetElement","#popovertarget","#popoverTargetAction","#commandForElement","#commandfor","#command","#interestForElement","#interestfor","#hasConnected","#flushPendingAttributeReflections","#syncBehavior","#syncQueued","#handleBooleanAttributeChange","#handleStringAttributeChange","#getHostUpdateComplete","#getBooleanValue","#setBooleanValue","#reflectAttribute","#getStringValue","#setStringValue","#pendingAttributeReflections"],"sources":["../../src/mixins/button.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { TypeAnchorController } from '../internal/controllers/type-anchor.controller.js';\nimport { TypeButtonController } from '../internal/controllers/type-button.controller.js';\nimport { TypeCommandController } from '../internal/controllers/type-command.controller.js';\nimport { TypeInterestInvokerController } from '../internal/controllers/type-interest-invoker.controller.js';\nimport { TypeNativeButtonController } from '../internal/controllers/type-native-button.controller.js';\nimport { TypePopoverTriggerController } from '../internal/controllers/type-popover-trigger.controller.js';\nimport { StateActiveController } from '../internal/controllers/state-active.controller.js';\nimport { StateCurrentController } from '../internal/controllers/state-current.controller.js';\nimport { StateDisabledController } from '../internal/controllers/state-disabled.controller.js';\nimport { StateExpandedController } from '../internal/controllers/state-expanded.controller.js';\nimport { StatePressedController } from '../internal/controllers/state-pressed.controller.js';\nimport { StateReadOnlyController } from '../internal/controllers/state-readonly.controller.js';\nimport { StateSelectedController } from '../internal/controllers/state-selected.controller.js';\nimport type { ReactiveController } from '../internal/controllers/types.js';\nimport {\n attachInternals,\n getStringValue,\n hasAttributeValue,\n isFormElement,\n setAttributeValue\n} from '../internal/utils.js';\nimport type { ButtonFormControlMixinInstance, ButtonType, CurrentState, PopoverTargetAction } from './button.types.js';\nexport type { ButtonFormControlMixinInstance, ButtonType, CurrentState, PopoverTargetAction } from './button.types.js';\n\ntype ChangedProperties = Map<PropertyKey, unknown>;\ninterface ButtonFormControlHost {\n connectedCallback?(): void;\n disconnectedCallback?(): void;\n attributeChangedCallback?(name: string, oldValue: string | null, newValue: string | null): void;\n requestUpdate?(name?: string, oldValue?: unknown): void;\n updateComplete?: Promise<unknown>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Constructor = (new (...args: any[]) => HTMLElement & ButtonFormControlHost) & { observedAttributes?: string[] };\n\ninterface BooleanStateOptions {\n property: string;\n value: boolean;\n reflect: boolean;\n attribute?: string;\n}\n\ninterface StringStateOptions {\n property: string;\n value: unknown;\n attribute?: string;\n reflect?: boolean;\n}\n\ntype ButtonFormControlConstructor<TBase extends Constructor> = new (\n ...args: ConstructorParameters<TBase>\n) => InstanceType<TBase> & ButtonFormControlMixinInstance;\nexport type ButtonFormControlMixinReturn<TBase extends Constructor> = ButtonFormControlConstructor<TBase> & {\n formAssociated: boolean;\n observedAttributes: string[];\n} & Omit<TBase, 'prototype'>;\n\n/**\n * @description A mixin that adds native button-style form, command, popover, and interaction behavior.\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/button/\n */\nexport function ButtonFormControlMixin<TBase extends Constructor>(\n SuperClass: TBase\n): ButtonFormControlMixinReturn<TBase> {\n return class ButtonFormControlBase extends SuperClass {\n static formAssociated = true;\n\n #command: string | undefined;\n #commandForElement: HTMLElement | null = null;\n #commandfor: string | null = null;\n #current: CurrentState | undefined;\n #disabled = false;\n #expanded: boolean | undefined;\n #form: string | HTMLFormElement | null = null;\n #hasConnected = false;\n #interestForElement: HTMLElement | null = null;\n #interestfor: string | null = null;\n #name: string | undefined;\n #pendingAttributeReflections = new Map<string, string | null>();\n #popoverTargetAction: PopoverTargetAction | undefined;\n #popoverTargetElement: HTMLElement | null = null;\n #popovertarget: string | undefined;\n #pressed: boolean | undefined;\n #readOnly = false;\n #selected: boolean | undefined;\n #syncQueued = false;\n #type: ButtonType | undefined;\n #value: string | undefined;\n\n _internals = attachInternals(this);\n\n static get observedAttributes() {\n return (super.observedAttributes ?? []).concat([\n 'pressed',\n 'expanded',\n 'readonly',\n 'form',\n 'name',\n 'value',\n 'type',\n 'disabled',\n 'selected',\n 'current',\n 'popovertarget',\n 'popovertargetaction',\n 'commandfor',\n 'command',\n 'interestfor'\n ]);\n }\n\n get pressed(): boolean {\n return this.#pressed as boolean;\n }\n\n set pressed(value: boolean | unknown) {\n this.#setBooleanState({ property: 'pressed', value: Boolean(value), reflect: true });\n }\n\n get expanded(): boolean {\n return this.#expanded as boolean;\n }\n\n set expanded(value: boolean | unknown) {\n this.#setBooleanState({ property: 'expanded', value: Boolean(value), reflect: true });\n }\n\n get readOnly(): boolean {\n return this.#readOnly || Boolean(this._typeAnchorController?.readOnly);\n }\n\n set readOnly(value: boolean | unknown) {\n this.#setBooleanState({ property: 'readOnly', value: Boolean(value), reflect: true, attribute: 'readonly' });\n }\n\n get readonly(): boolean {\n return this.readOnly;\n }\n\n set readonly(value: boolean) {\n this.readOnly = value;\n }\n\n set form(form: string | HTMLFormElement | null) {\n const oldValue = this.form;\n this.#form = form;\n if (typeof form === 'string') {\n this.setAttribute('form', form);\n } else {\n this.removeAttribute('form');\n }\n this.#requestHostUpdate('form', oldValue);\n this.#queueBehaviorSync();\n }\n\n get form(): HTMLFormElement | null | string {\n if (this.#form && typeof this.#form !== 'string') {\n return this.#form;\n }\n\n if (typeof this.#form === 'string' && typeof globalThis.document !== 'undefined') {\n const rootNode = this.getRootNode() as Document | ShadowRoot;\n const form = rootNode.getElementById ? rootNode.getElementById(this.#form) : null;\n return isFormElement(form) ? form : null;\n }\n\n return this._internals?.form ?? null;\n }\n\n get name(): string {\n return this.#name as string;\n }\n\n set name(value: string | unknown) {\n this.#setStringState({ property: 'name', value });\n }\n\n get value(): string {\n return this.#value as string;\n }\n\n set value(value: string | unknown) {\n this.#setStringState({ property: 'value', value });\n }\n\n get type(): ButtonType {\n return (this.#type ?? this._typeNativeButtonController?.defaultType) as ButtonType;\n }\n\n set type(value: ButtonType | unknown) {\n this.#setStringState({ property: 'type', value });\n }\n\n get disabled(): boolean {\n return this.#disabled;\n }\n\n set disabled(value: boolean | unknown) {\n this.#setBooleanState({ property: 'disabled', value: Boolean(value), reflect: true });\n }\n\n get selected(): boolean {\n return this.#selected as boolean;\n }\n\n set selected(value: boolean | unknown) {\n this.#setBooleanState({ property: 'selected', value: Boolean(value), reflect: true });\n }\n\n get current(): CurrentState {\n return this.#current as CurrentState;\n }\n\n set current(value: CurrentState | unknown) {\n this.#setStringState({ property: 'current', value });\n }\n\n get popoverTargetElement(): HTMLElement | null {\n return this.#popoverTargetElement;\n }\n\n set popoverTargetElement(value: HTMLElement | null) {\n const oldValue = this.#popoverTargetElement;\n this.#popoverTargetElement = value;\n this.#requestHostUpdate('popoverTargetElement', oldValue);\n this.#queueBehaviorSync();\n }\n\n get popovertarget(): string {\n return this.#popovertarget as string;\n }\n\n set popovertarget(value: string | unknown) {\n this.#setStringState({ property: 'popovertarget', value });\n }\n\n get popoverTargetAction(): PopoverTargetAction {\n return this.#popoverTargetAction as PopoverTargetAction;\n }\n\n set popoverTargetAction(value: PopoverTargetAction | unknown) {\n this.#setStringState({ property: 'popoverTargetAction', value, attribute: 'popovertargetaction' });\n }\n\n get commandForElement(): HTMLElement | null {\n return this.#commandForElement;\n }\n\n set commandForElement(value: HTMLElement | null) {\n const oldValue = this.#commandForElement;\n this.#commandForElement = value;\n this.#requestHostUpdate('commandForElement', oldValue);\n this.#queueBehaviorSync();\n }\n\n get commandfor(): string | null {\n return this.#commandfor;\n }\n\n set commandfor(value: string | null | unknown) {\n this.#setStringState({ property: 'commandfor', value });\n }\n\n get command(): string {\n return this.#command as string;\n }\n\n set command(value: string | unknown) {\n this.#setStringState({ property: 'command', value });\n }\n\n get interestForElement(): HTMLElement | null {\n return this.#interestForElement;\n }\n\n set interestForElement(value: HTMLElement | null) {\n const oldValue = this.#interestForElement;\n this.#interestForElement = value;\n this.#requestHostUpdate('interestForElement', oldValue);\n this.#queueBehaviorSync();\n }\n\n get interestfor(): string | null {\n return this.#interestfor;\n }\n\n set interestfor(value: string | null | unknown) {\n this.#setStringState({ property: 'interestfor', value });\n }\n\n protected _controllers?: Set<ReactiveController>;\n protected _typeAnchorController = new TypeAnchorController(this);\n protected _typeButtonController = new TypeButtonController(this);\n protected _typeNativeButtonController = new TypeNativeButtonController(this);\n protected _typeCommandController = new TypeCommandController(this);\n protected _typeInterestInvokerController = new TypeInterestInvokerController(this);\n protected _typePopoverTriggerController = new TypePopoverTriggerController(this);\n protected _stateActiveController = new StateActiveController(this);\n protected _stateDisabledController = new StateDisabledController(this);\n protected _stateExpandedController = new StateExpandedController(this);\n protected _statePressedController = new StatePressedController(this);\n protected _stateSelectedController = new StateSelectedController(this);\n protected _stateCurrentController = new StateCurrentController(this);\n protected _stateReadOnlyController = new StateReadOnlyController(this);\n\n addController(controller: ReactiveController) {\n this._controllers ??= new Set<ReactiveController>();\n this._controllers.add(controller);\n }\n\n connectedCallback() {\n super.connectedCallback?.();\n this._controllers?.forEach(controller => controller.hostConnected?.());\n attachInternals(this);\n this.#hasConnected = true;\n this.#flushPendingAttributeReflections();\n\n this.#syncBehavior();\n this.#queueBehaviorSync();\n }\n\n disconnectedCallback() {\n this._controllers?.forEach(controller => controller.hostDisconnected?.());\n super.disconnectedCallback?.();\n }\n\n protected updated(changedProperties: ChangedProperties) {\n const superUpdated = Object.getPrototypeOf(ButtonFormControlBase.prototype).updated as\n | ((changedProperties: ChangedProperties) => void)\n | undefined;\n superUpdated?.call(this, changedProperties);\n this.#syncQueued = false;\n this.#syncBehavior();\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n\n if (oldValue === newValue) {\n return;\n }\n\n this.#handleBooleanAttributeChange(name, newValue);\n this.#handleStringAttributeChange(name, oldValue, newValue);\n }\n\n #queueBehaviorSync() {\n if (!this.isConnected || this.#syncQueued) {\n return;\n }\n\n this.#syncQueued = true;\n void this.#getHostUpdateComplete().then(() => {\n if (!this.#syncQueued) return;\n this.#syncQueued = false;\n if (this.isConnected) this.#syncBehavior();\n });\n }\n\n #syncBehavior() {\n this._controllers?.forEach(controller => controller.hostUpdated?.());\n }\n\n #handleBooleanAttributeChange(name: string, newValue: string | null) {\n if (name === 'pressed' || name === 'expanded' || name === 'selected' || name === 'disabled') {\n this.#setBooleanState({ property: name, value: newValue !== null, reflect: false });\n }\n\n if (name === 'readonly') {\n this.#setBooleanState({ property: 'readOnly', value: newValue !== null, reflect: false });\n }\n }\n\n #handleStringAttributeChange(name: string, oldValue: string | null, newValue: string | null) {\n if (name === 'form') {\n if (!(isFormElement(this.#form) && newValue === null)) {\n this.#form = newValue;\n this.#requestHostUpdate('form', oldValue);\n }\n }\n\n if (name === 'popovertargetaction') {\n this.#setStringState({ property: 'popoverTargetAction', value: newValue, reflect: false });\n }\n\n this.#setStringState({ property: name, value: newValue, reflect: false });\n }\n\n #setBooleanState({ property, value, reflect, attribute = property }: BooleanStateOptions) {\n const oldValue = this.#getBooleanValue(property);\n if (oldValue === value && (!reflect || hasAttributeValue(this, attribute, value ? '' : null))) {\n return;\n }\n\n this.#setBooleanValue(property, value);\n if (reflect && this.#reflectAttribute(attribute, value ? '' : null)) {\n return;\n }\n this.#requestHostUpdate(property, oldValue);\n this.#queueBehaviorSync();\n }\n\n #getBooleanValue(property: string) {\n return {\n disabled: this.#disabled,\n expanded: this.#expanded,\n pressed: this.#pressed,\n readOnly: this.#readOnly,\n selected: this.#selected\n }[property];\n }\n\n #setBooleanValue(property: string, value: boolean) {\n if (property === 'disabled') {\n this.#disabled = value;\n } else if (property === 'expanded') {\n this.#expanded = value;\n } else if (property === 'pressed') {\n this.#pressed = value;\n } else if (property === 'readOnly') {\n this.#readOnly = value;\n } else if (property === 'selected') {\n this.#selected = value;\n }\n }\n\n #setStringState({ property, value, attribute = property, reflect = true }: StringStateOptions) {\n const oldValue = this.#getStringValue(property);\n const nextValue = getStringValue(value);\n if (oldValue === nextValue && (!reflect || hasAttributeValue(this, attribute, nextValue))) {\n return;\n }\n\n this.#setStringValue(property, nextValue);\n if (reflect && this.#reflectAttribute(attribute, nextValue)) {\n return;\n }\n this.#requestHostUpdate(property, oldValue);\n this.#queueBehaviorSync();\n }\n\n #getStringValue(property: string) {\n return {\n command: this.#command,\n commandfor: this.#commandfor,\n current: this.#current,\n interestfor: this.#interestfor,\n name: this.#name,\n popoverTargetAction: this.#popoverTargetAction,\n popovertarget: this.#popovertarget,\n type: this.#type,\n value: this.#value\n }[property];\n }\n\n #setStringValue(property: string, value: string | null) {\n const setters: Record<string, () => void> = {\n command: () => (this.#command = value ?? undefined),\n commandfor: () => (this.#commandfor = value),\n current: () => (this.#current = value as CurrentState),\n interestfor: () => (this.#interestfor = value),\n name: () => (this.#name = value ?? undefined),\n popoverTargetAction: () => (this.#popoverTargetAction = value as PopoverTargetAction),\n popovertarget: () => (this.#popovertarget = value ?? undefined),\n type: () => (this.#type = value as ButtonType),\n value: () => (this.#value = value ?? undefined)\n };\n setters[property]?.();\n }\n\n #reflectAttribute(attribute: string, value: string | null) {\n if (!this.isConnected && !this.#hasConnected) {\n if (!this.hasAttribute(attribute)) {\n this.#pendingAttributeReflections.set(attribute, value);\n }\n return true;\n }\n\n setAttributeValue(this, attribute, value);\n return false;\n }\n\n #requestHostUpdate(name?: string, oldValue?: unknown) {\n this.requestUpdate?.(name, oldValue);\n }\n\n #getHostUpdateComplete() {\n return this.updateComplete ?? Promise.resolve();\n }\n\n #flushPendingAttributeReflections() {\n this.#pendingAttributeReflections.forEach((value, attribute) => setAttributeValue(this, attribute, value));\n this.#pendingAttributeReflections.clear();\n }\n } as unknown as ButtonFormControlMixinReturn<TBase>;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiEA,SAAgB,EACd,GACqC;CACrC,OAAO,MAAM,UAA8B,EAAW;;0BAIX,gBACZ,gBAEjB,cAE6B,gBACzB,cAC0B,gBACZ,gCAEC,IAAI,IAA2B,aAElB,gBAGhC,cAEE,sBAID,EAAgB,IAAI,gCA0MC,IAAI,EAAqB,IAAI,gCAC7B,IAAI,EAAqB,IAAI,s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,KAAK1B,GAAmB,GAAU,CAAQ,GAC1C,KAAKC,GAAmB;EAC1B;EAEA,GAAgB,GAAkB;GAChC,OAAO;IACL,SAAS,KAAKa;IACd,YAAY,KAAKD;IACjB,SAAS,KAAKL;IACd,aAAa,KAAKQ;IAClB,MAAM,KAAKd;IACX,qBAAqB,KAAKS;IAC1B,eAAe,KAAKD;IACpB,MAAM,KAAKL;IACX,OAAO,KAAKD;GACd,EAAE;EACJ;EAEA,GAAgB,GAAkB,GAAsB;GAYtD,CAAA;IAVE,eAAgB,KAAKU,KAAW,KAAS,KAAA;IACzC,kBAAmB,KAAKD,KAAc;IACtC,eAAgB,KAAKL,KAAW;IAChC,mBAAoB,KAAKQ,KAAe;IACxC,YAAa,KAAKd,KAAQ,KAAS,KAAA;IACnC,2BAA4B,KAAKS,KAAuB;IACxD,qBAAsB,KAAKD,KAAiB,KAAS,KAAA;IACrD,YAAa,KAAKL,KAAQ;IAC1B,aAAc,KAAKD,KAAS,KAAS,KAAA;GAEvC,GAAQ,KAAY;EACtB;EAEA,GAAkB,GAAmB,GAAsB;GASzD,OARI,CAAC,KAAK,eAAe,CAAC,KAAKa,MACxB,KAAK,aAAa,CAAS,KAC9B,KAAKY,GAA6B,IAAI,GAAW,CAAK,GAEjD,OAGT,EAAkB,MAAM,GAAW,CAAK,GACjC;EACT;EAEA,GAAmB,GAAe,GAAoB;GACpD,KAAK,gBAAgB,GAAM,CAAQ;EACrC;EAEA,KAAyB;GACvB,OAAO,KAAK,kBAAkB,QAAQ,QAAQ;EAChD;EAEA,KAAoC;GAElC,AADA,KAAKA,GAA6B,SAAS,GAAO,MAAc,EAAkB,MAAM,GAAW,CAAK,CAAC,GACzG,KAAKA,GAA6B,MAAM;EAC1C;CACF;AACF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export type ButtonType = 'button' | 'submit' | 'reset';
|
|
2
|
+
export type CurrentState = 'page' | 'step';
|
|
3
|
+
export type PopoverTargetAction = 'show' | 'hide' | 'toggle';
|
|
4
|
+
export interface ButtonFormControlMixinInstance {
|
|
5
|
+
/**
|
|
6
|
+
* Use for toggle button types.
|
|
7
|
+
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed
|
|
8
|
+
* @attr pressed
|
|
9
|
+
* @reflect
|
|
10
|
+
*/
|
|
11
|
+
pressed: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Use for buttons that expand or collapse content.
|
|
14
|
+
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded
|
|
15
|
+
* @attr expanded
|
|
16
|
+
* @reflect
|
|
17
|
+
*/
|
|
18
|
+
expanded: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Like input readonly, sets a button semantically as visual treatment only.
|
|
21
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly
|
|
22
|
+
* @attr readonly
|
|
23
|
+
* @reflect
|
|
24
|
+
*/
|
|
25
|
+
readOnly: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Use `readOnly`. The `readonly` attribute remains supported.
|
|
28
|
+
* @deprecated Use `readOnly`. The `readonly` attribute remains supported.
|
|
29
|
+
*/
|
|
30
|
+
readonly: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Like input form, sets a button to submit a form outside its parent form.
|
|
33
|
+
* Returns a reference to the form element if available.
|
|
34
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/form
|
|
35
|
+
* @attr form
|
|
36
|
+
*/
|
|
37
|
+
form: HTMLFormElement | null | string;
|
|
38
|
+
/**
|
|
39
|
+
* The name of the button, submitted as a pair with the button value as part of the form data.
|
|
40
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-name
|
|
41
|
+
* @attr name
|
|
42
|
+
* @reflect
|
|
43
|
+
*/
|
|
44
|
+
name: string;
|
|
45
|
+
/**
|
|
46
|
+
* Defines the value associated with the button name when submitting form data.
|
|
47
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-value
|
|
48
|
+
* @attr value
|
|
49
|
+
* @reflect
|
|
50
|
+
*/
|
|
51
|
+
value: string;
|
|
52
|
+
/**
|
|
53
|
+
* Defines the button behavior when associated within a form element.
|
|
54
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type
|
|
55
|
+
* @attr type
|
|
56
|
+
* @reflect
|
|
57
|
+
*/
|
|
58
|
+
type: ButtonType;
|
|
59
|
+
/**
|
|
60
|
+
* Prevents the user from interacting with the button.
|
|
61
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-disabled
|
|
62
|
+
* @attr disabled
|
|
63
|
+
* @reflect
|
|
64
|
+
*/
|
|
65
|
+
disabled: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Sets selected state when the button belongs to a multi-choice selection group.
|
|
68
|
+
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected
|
|
69
|
+
* @attr selected
|
|
70
|
+
* @reflect
|
|
71
|
+
*/
|
|
72
|
+
selected: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Sets the current state used to represent the current page or navigation link.
|
|
75
|
+
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current
|
|
76
|
+
* @attr current
|
|
77
|
+
* @reflect
|
|
78
|
+
*/
|
|
79
|
+
current: CurrentState;
|
|
80
|
+
/**
|
|
81
|
+
* Establishes a relationship between a popover and its invoker button.
|
|
82
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetElement
|
|
83
|
+
*/
|
|
84
|
+
popoverTargetElement: HTMLElement | null;
|
|
85
|
+
/**
|
|
86
|
+
* The id reference of the element that receives the popover.
|
|
87
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#popovertarget
|
|
88
|
+
* @attr popovertarget
|
|
89
|
+
* @reflect
|
|
90
|
+
*/
|
|
91
|
+
popovertarget: string;
|
|
92
|
+
/**
|
|
93
|
+
* The popover target action to perform on the popover target element.
|
|
94
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetAction
|
|
95
|
+
* @attr popovertargetaction
|
|
96
|
+
* @reflect
|
|
97
|
+
*/
|
|
98
|
+
popoverTargetAction: PopoverTargetAction;
|
|
99
|
+
/**
|
|
100
|
+
* The element that receives the command.
|
|
101
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API
|
|
102
|
+
* @attr commandfor
|
|
103
|
+
* @reflect
|
|
104
|
+
*/
|
|
105
|
+
commandForElement: HTMLElement | null;
|
|
106
|
+
/**
|
|
107
|
+
* The command to execute on the element.
|
|
108
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API
|
|
109
|
+
* @attr command
|
|
110
|
+
* @reflect
|
|
111
|
+
*/
|
|
112
|
+
command: string;
|
|
113
|
+
/**
|
|
114
|
+
* The element that receives the interest.
|
|
115
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/interestForElement
|
|
116
|
+
* @attr interestfor
|
|
117
|
+
* @reflect
|
|
118
|
+
*/
|
|
119
|
+
interestForElement: HTMLElement | null;
|
|
120
|
+
_internals: ElementInternals;
|
|
121
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FormControlValue } from '../internal/types.js';
|
|
2
|
+
import { FormControlMixinInstance } from './index.js';
|
|
3
|
+
type Constructor = (new (...args: any[]) => HTMLElement & {
|
|
4
|
+
connectedCallback?(): void;
|
|
5
|
+
disconnectedCallback?(): void;
|
|
6
|
+
attributeChangedCallback?(name: string, oldValue: string | null, newValue: string | null): void;
|
|
7
|
+
requestUpdate?(name?: string, oldValue?: unknown): void;
|
|
8
|
+
}) & {
|
|
9
|
+
observedAttributes?: string[];
|
|
10
|
+
};
|
|
11
|
+
export type CheckboxFormControlValue = Extract<FormControlValue, string>;
|
|
12
|
+
export interface CheckboxFormControlMixinInstance extends FormControlMixinInstance<CheckboxFormControlValue> {
|
|
13
|
+
/**
|
|
14
|
+
* Shows whether the checkbox currently has a checked value.
|
|
15
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#checked
|
|
16
|
+
* @attr checked
|
|
17
|
+
* @reflect
|
|
18
|
+
*/
|
|
19
|
+
checked: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates whether the checkbox is visually indeterminate.
|
|
22
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/indeterminate
|
|
23
|
+
* @attr indeterminate
|
|
24
|
+
* @reflect
|
|
25
|
+
*/
|
|
26
|
+
indeterminate: boolean;
|
|
27
|
+
updateCheckedState(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Toggles the checked state.
|
|
30
|
+
*/
|
|
31
|
+
toggle(): void;
|
|
32
|
+
}
|
|
33
|
+
export type CheckboxFormControlMixinReturn<TBase extends Constructor> = (new (...args: ConstructorParameters<TBase>) => InstanceType<TBase> & CheckboxFormControlMixinInstance) & {
|
|
34
|
+
formAssociated: boolean;
|
|
35
|
+
observedAttributes: string[];
|
|
36
|
+
} & Omit<TBase, 'prototype'>;
|
|
37
|
+
/**
|
|
38
|
+
* @description A mixin that adds native checkbox-style form control behavior.
|
|
39
|
+
*/
|
|
40
|
+
export declare function CheckboxFormControlMixin<TBase extends Constructor>(SuperClass: TBase): CheckboxFormControlMixinReturn<TBase>;
|
|
41
|
+
export {};
|