@nysds/nys-button 1.0.0 → 1.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/dist/nys-button.d.ts +6 -0
- package/dist/nys-button.figma.d.ts +1 -0
- package/dist/nys-button.js +63 -39
- package/dist/nys-button.js.map +1 -1
- package/package.json +2 -2
package/dist/nys-button.d.ts
CHANGED
|
@@ -26,12 +26,18 @@ export declare class NysButton extends LitElement {
|
|
|
26
26
|
onClick: (event: Event) => void;
|
|
27
27
|
href: string;
|
|
28
28
|
static styles: import("lit").CSSResult;
|
|
29
|
+
private _internals;
|
|
29
30
|
/**************** Lifecycle Methods ****************/
|
|
31
|
+
static formAssociated: boolean;
|
|
32
|
+
constructor();
|
|
30
33
|
connectedCallback(): void;
|
|
31
34
|
/******************** Functions ********************/
|
|
32
35
|
private _generateUniqueId;
|
|
36
|
+
private _manageFormAction;
|
|
37
|
+
/******************** Event Handlers ********************/
|
|
33
38
|
private _handleFocus;
|
|
34
39
|
private _handleBlur;
|
|
35
40
|
private _handleClick;
|
|
41
|
+
private _handleKeydown;
|
|
36
42
|
render(): import("lit-html").TemplateResult<1>;
|
|
37
43
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/nys-button.js
CHANGED
|
@@ -5,7 +5,7 @@ import { css as b1, LitElement as _1, html as y } from "lit";
|
|
|
5
5
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
6
6
|
* ▒█░░▀█ ░░▒█░░ ▒█▄▄▄█ ▒█▄▄▀ ▒█▄▄▄█
|
|
7
7
|
*
|
|
8
|
-
* Button Component v1.
|
|
8
|
+
* Button Component v1.1.0
|
|
9
9
|
* Part of the New York State Design System
|
|
10
10
|
* Repository: https://github.com/its-hcd/nysds
|
|
11
11
|
* License: MIT
|
|
@@ -50,7 +50,7 @@ const H1 = (s) => new Z1(typeof s == "string" ? s : s + "", void 0, w1), A1 = (s
|
|
|
50
50
|
* Copyright 2017 Google LLC
|
|
51
51
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
52
52
|
*/
|
|
53
|
-
const { is: V1, defineProperty: S1, getOwnPropertyDescriptor: E1, getOwnPropertyNames: P1, getOwnPropertySymbols: k1, getPrototypeOf: U1 } = Object, m = globalThis, i1 = m.trustedTypes, z1 = i1 ? i1.emptyScript : "",
|
|
53
|
+
const { is: V1, defineProperty: S1, getOwnPropertyDescriptor: E1, getOwnPropertyNames: P1, getOwnPropertySymbols: k1, getPrototypeOf: U1 } = Object, m = globalThis, i1 = m.trustedTypes, z1 = i1 ? i1.emptyScript : "", G = m.reactiveElementPolyfillSupport, U = (s, t) => s, j = { toAttribute(s, t) {
|
|
54
54
|
switch (t) {
|
|
55
55
|
case Boolean:
|
|
56
56
|
s = s ? z1 : null;
|
|
@@ -78,7 +78,7 @@ const { is: V1, defineProperty: S1, getOwnPropertyDescriptor: E1, getOwnProperty
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
return e;
|
|
81
|
-
} }, t1 = (s, t) => !V1(s, t), C1 = { attribute: !0, type: String, converter:
|
|
81
|
+
} }, t1 = (s, t) => !V1(s, t), C1 = { attribute: !0, type: String, converter: j, reflect: !1, hasChanged: t1 };
|
|
82
82
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), m.litPropertyMetadata ?? (m.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
83
83
|
class S extends HTMLElement {
|
|
84
84
|
static addInitializer(t) {
|
|
@@ -191,7 +191,7 @@ class S extends HTMLElement {
|
|
|
191
191
|
var i;
|
|
192
192
|
const o = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, o);
|
|
193
193
|
if (r !== void 0 && o.reflect === !0) {
|
|
194
|
-
const n = (((i = o.converter) == null ? void 0 : i.toAttribute) !== void 0 ? o.converter :
|
|
194
|
+
const n = (((i = o.converter) == null ? void 0 : i.toAttribute) !== void 0 ? o.converter : j).toAttribute(e, o.type);
|
|
195
195
|
this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
@@ -199,7 +199,7 @@ class S extends HTMLElement {
|
|
|
199
199
|
var i;
|
|
200
200
|
const o = this.constructor, r = o._$Eh.get(t);
|
|
201
201
|
if (r !== void 0 && this._$Em !== r) {
|
|
202
|
-
const n = o.getPropertyOptions(r), l = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((i = n.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? n.converter :
|
|
202
|
+
const n = o.getPropertyOptions(r), l = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((i = n.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? n.converter : j;
|
|
203
203
|
this._$Em = r, this[r] = l.fromAttribute(e, n.type), this._$Em = null;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -278,13 +278,13 @@ class S extends HTMLElement {
|
|
|
278
278
|
firstUpdated(t) {
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[U("elementProperties")] = /* @__PURE__ */ new Map(), S[U("finalized")] = /* @__PURE__ */ new Map(),
|
|
281
|
+
S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[U("elementProperties")] = /* @__PURE__ */ new Map(), S[U("finalized")] = /* @__PURE__ */ new Map(), G == null || G({ ReactiveElement: S }), (m.reactiveElementVersions ?? (m.reactiveElementVersions = [])).push("2.0.4");
|
|
282
282
|
/**
|
|
283
283
|
* @license
|
|
284
284
|
* Copyright 2017 Google LLC
|
|
285
285
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
286
286
|
*/
|
|
287
|
-
const B1 = { attribute: !0, type: String, converter:
|
|
287
|
+
const B1 = { attribute: !0, type: String, converter: j, reflect: !1, hasChanged: t1 }, O1 = (s = B1, t, e) => {
|
|
288
288
|
const { kind: o, metadata: r } = e;
|
|
289
289
|
let i = globalThis.litPropertyMetadata.get(r);
|
|
290
290
|
if (i === void 0 && globalThis.litPropertyMetadata.set(r, i = /* @__PURE__ */ new Map()), i.set(e.name, s), o === "accessor") {
|
|
@@ -641,7 +641,7 @@ const T1 = b1`
|
|
|
641
641
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
642
642
|
* ▒█░░▀█ ░░▒█░░ ▒█▄▄▄█ ▒█▄▄▀ ▒█▄▄▄█
|
|
643
643
|
*
|
|
644
|
-
* Icon Component v1.
|
|
644
|
+
* Icon Component v1.1.0
|
|
645
645
|
* Part of the New York State Design System
|
|
646
646
|
* Repository: https://github.com/its-hcd/nysds
|
|
647
647
|
* License: MIT
|
|
@@ -651,7 +651,7 @@ const T1 = b1`
|
|
|
651
651
|
* Copyright 2019 Google LLC
|
|
652
652
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
653
653
|
*/
|
|
654
|
-
const
|
|
654
|
+
const D = globalThis, e1 = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, m1 = Symbol(), l1 = /* @__PURE__ */ new WeakMap();
|
|
655
655
|
let R1 = class {
|
|
656
656
|
constructor(t, e, o) {
|
|
657
657
|
if (this._$cssResult$ = !0, o !== m1) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
@@ -673,7 +673,7 @@ let R1 = class {
|
|
|
673
673
|
const I1 = (s) => new R1(typeof s == "string" ? s : s + "", void 0, m1), N1 = (s, t) => {
|
|
674
674
|
if (e1) s.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
675
675
|
else for (const e of t) {
|
|
676
|
-
const o = document.createElement("style"), r =
|
|
676
|
+
const o = document.createElement("style"), r = D.litNonce;
|
|
677
677
|
r !== void 0 && o.setAttribute("nonce", r), o.textContent = e.cssText, s.appendChild(o);
|
|
678
678
|
}
|
|
679
679
|
}, a1 = e1 ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => {
|
|
@@ -686,10 +686,10 @@ const I1 = (s) => new R1(typeof s == "string" ? s : s + "", void 0, m1), N1 = (s
|
|
|
686
686
|
* Copyright 2017 Google LLC
|
|
687
687
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
688
688
|
*/
|
|
689
|
-
const { is:
|
|
689
|
+
const { is: D1, defineProperty: j1, getOwnPropertyDescriptor: q1, getOwnPropertyNames: W1, getOwnPropertySymbols: F1, getPrototypeOf: K1 } = Object, Z = globalThis, c1 = Z.trustedTypes, Y1 = c1 ? c1.emptyScript : "", h1 = Z.reactiveElementPolyfillSupport, z = (s, t) => s, q = { toAttribute(s, t) {
|
|
690
690
|
switch (t) {
|
|
691
691
|
case Boolean:
|
|
692
|
-
s = s ?
|
|
692
|
+
s = s ? Y1 : null;
|
|
693
693
|
break;
|
|
694
694
|
case Object:
|
|
695
695
|
case Array:
|
|
@@ -714,7 +714,7 @@ const { is: j1, defineProperty: D1, getOwnPropertyDescriptor: q1, getOwnProperty
|
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
return e;
|
|
717
|
-
} }, o1 = (s, t) => !
|
|
717
|
+
} }, o1 = (s, t) => !D1(s, t), d1 = { attribute: !0, type: String, converter: q, reflect: !1, hasChanged: o1 };
|
|
718
718
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), Z.litPropertyMetadata ?? (Z.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
719
719
|
let E = class extends HTMLElement {
|
|
720
720
|
static addInitializer(t) {
|
|
@@ -726,7 +726,7 @@ let E = class extends HTMLElement {
|
|
|
726
726
|
static createProperty(t, e = d1) {
|
|
727
727
|
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
728
728
|
const o = Symbol(), r = this.getPropertyDescriptor(t, o, e);
|
|
729
|
-
r !== void 0 &&
|
|
729
|
+
r !== void 0 && j1(this.prototype, t, r);
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
static getPropertyDescriptor(t, e, o) {
|
|
@@ -747,7 +747,7 @@ let E = class extends HTMLElement {
|
|
|
747
747
|
}
|
|
748
748
|
static _$Ei() {
|
|
749
749
|
if (this.hasOwnProperty(z("elementProperties"))) return;
|
|
750
|
-
const t =
|
|
750
|
+
const t = K1(this);
|
|
751
751
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
752
752
|
}
|
|
753
753
|
static finalize() {
|
|
@@ -920,7 +920,7 @@ E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[z("elementProper
|
|
|
920
920
|
* Copyright 2017 Google LLC
|
|
921
921
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
922
922
|
*/
|
|
923
|
-
const
|
|
923
|
+
const G1 = { attribute: !0, type: String, converter: q, reflect: !1, hasChanged: o1 }, J1 = (s = G1, t, e) => {
|
|
924
924
|
const { kind: o, metadata: r } = e;
|
|
925
925
|
let i = globalThis.litPropertyMetadata.get(r);
|
|
926
926
|
if (i === void 0 && globalThis.litPropertyMetadata.set(r, i = /* @__PURE__ */ new Map()), i.set(e.name, s), o === "accessor") {
|
|
@@ -942,7 +942,7 @@ const J1 = { attribute: !0, type: String, converter: q, reflect: !1, hasChanged:
|
|
|
942
942
|
throw Error("Unsupported decorator location: " + o);
|
|
943
943
|
};
|
|
944
944
|
function A(s) {
|
|
945
|
-
return (t, e) => typeof e == "object" ?
|
|
945
|
+
return (t, e) => typeof e == "object" ? J1(s, t, e) : ((o, r, i) => {
|
|
946
946
|
const n = r.hasOwnProperty(i);
|
|
947
947
|
return r.constructor.createProperty(i, n ? { ...o, wrapped: !0 } : o), n ? Object.getOwnPropertyDescriptor(r, i) : void 0;
|
|
948
948
|
})(s, t, e);
|
|
@@ -1312,8 +1312,8 @@ customElements.get("nys-icon") || customElements.define("nys-icon", o5);
|
|
|
1312
1312
|
* Copyright 2017 Google LLC
|
|
1313
1313
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1314
1314
|
*/
|
|
1315
|
-
const B = globalThis, W = B.trustedTypes, f1 = W ? W.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, $1 = "$lit$", w = `lit$${Math.random().toFixed(9).slice(2)}$`, x1 = "?" + w, r5 = `<${x1}>`, L = document, F = () => L.createComment(""), O = (s) => s === null || typeof s != "object" && typeof s != "function", r1 = Array.isArray, s5 = (s) => r1(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function",
|
|
1316
|
-
\f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v1 = /-->/g, u1 = />/g, $ = RegExp(`>|${
|
|
1315
|
+
const B = globalThis, W = B.trustedTypes, f1 = W ? W.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, $1 = "$lit$", w = `lit$${Math.random().toFixed(9).slice(2)}$`, x1 = "?" + w, r5 = `<${x1}>`, L = document, F = () => L.createComment(""), O = (s) => s === null || typeof s != "object" && typeof s != "function", r1 = Array.isArray, s5 = (s) => r1(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", J = `[
|
|
1316
|
+
\f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v1 = /-->/g, u1 = />/g, $ = RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
|
|
1317
1317
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), p1 = /'/g, y1 = /"/g, L1 = /^(?:script|style|textarea|title)$/i, T = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), g1 = /* @__PURE__ */ new WeakMap(), x = L.createTreeWalker(L, 129);
|
|
1318
1318
|
function M1(s, t) {
|
|
1319
1319
|
if (!r1(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
@@ -1345,7 +1345,7 @@ class R {
|
|
|
1345
1345
|
if (r.nodeType === 1) {
|
|
1346
1346
|
if (r.hasAttributes()) for (const a of r.getAttributeNames()) if (a.endsWith($1)) {
|
|
1347
1347
|
const g = d[n++], b = r.getAttribute(a).split(w), I = /([.?@])?(.*)/.exec(g);
|
|
1348
|
-
C.push({ type: 1, index: i, name: I[2], strings: b, ctor: I[1] === "." ? C5 : I[1] === "?" ? l5 : I[1] === "@" ? a5 :
|
|
1348
|
+
C.push({ type: 1, index: i, name: I[2], strings: b, ctor: I[1] === "." ? C5 : I[1] === "?" ? l5 : I[1] === "@" ? a5 : Y }), r.removeAttribute(a);
|
|
1349
1349
|
} else a.startsWith(w) && (C.push({ type: 6, index: i }), r.removeAttribute(a));
|
|
1350
1350
|
if (L1.test(r.tagName)) {
|
|
1351
1351
|
const a = r.textContent.split(w), g = a.length - 1;
|
|
@@ -1392,7 +1392,7 @@ class i5 {
|
|
|
1392
1392
|
for (; C !== void 0; ) {
|
|
1393
1393
|
if (n === C.index) {
|
|
1394
1394
|
let h;
|
|
1395
|
-
C.type === 2 ? h = new
|
|
1395
|
+
C.type === 2 ? h = new K(i, i.nextSibling, this, t) : C.type === 1 ? h = new C.ctor(i, C.name, C.strings, this, t) : C.type === 6 && (h = new c5(i, this, t)), this._$AV.push(h), C = o[++l];
|
|
1396
1396
|
}
|
|
1397
1397
|
n !== (C == null ? void 0 : C.index) && (i = x.nextNode(), n++);
|
|
1398
1398
|
}
|
|
@@ -1403,7 +1403,7 @@ class i5 {
|
|
|
1403
1403
|
for (const o of this._$AV) o !== void 0 && (o.strings !== void 0 ? (o._$AI(t, o, e), e += o.strings.length - 2) : o._$AI(t[e])), e++;
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
|
-
class
|
|
1406
|
+
class K {
|
|
1407
1407
|
get _$AU() {
|
|
1408
1408
|
var t;
|
|
1409
1409
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
@@ -1451,7 +1451,7 @@ class Y {
|
|
|
1451
1451
|
r1(this._$AH) || (this._$AH = [], this._$AR());
|
|
1452
1452
|
const e = this._$AH;
|
|
1453
1453
|
let o, r = 0;
|
|
1454
|
-
for (const i of t) r === e.length ? e.push(o = new
|
|
1454
|
+
for (const i of t) r === e.length ? e.push(o = new K(this.O(F()), this.O(F()), this, this.options)) : o = e[r], o._$AI(i), r++;
|
|
1455
1455
|
r < e.length && (this._$AR(o && o._$AB.nextSibling, r), e.length = r);
|
|
1456
1456
|
}
|
|
1457
1457
|
_$AR(t = this._$AA.nextSibling, e) {
|
|
@@ -1466,7 +1466,7 @@ class Y {
|
|
|
1466
1466
|
this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
|
|
1467
1467
|
}
|
|
1468
1468
|
}
|
|
1469
|
-
class
|
|
1469
|
+
class Y {
|
|
1470
1470
|
get tagName() {
|
|
1471
1471
|
return this.element.tagName;
|
|
1472
1472
|
}
|
|
@@ -1491,7 +1491,7 @@ class G {
|
|
|
1491
1491
|
t === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
1494
|
-
class C5 extends
|
|
1494
|
+
class C5 extends Y {
|
|
1495
1495
|
constructor() {
|
|
1496
1496
|
super(...arguments), this.type = 3;
|
|
1497
1497
|
}
|
|
@@ -1499,7 +1499,7 @@ class C5 extends G {
|
|
|
1499
1499
|
this.element[this.name] = t === c ? void 0 : t;
|
|
1500
1500
|
}
|
|
1501
1501
|
}
|
|
1502
|
-
class l5 extends
|
|
1502
|
+
class l5 extends Y {
|
|
1503
1503
|
constructor() {
|
|
1504
1504
|
super(...arguments), this.type = 4;
|
|
1505
1505
|
}
|
|
@@ -1507,7 +1507,7 @@ class l5 extends G {
|
|
|
1507
1507
|
this.element.toggleAttribute(this.name, !!t && t !== c);
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
|
-
class a5 extends
|
|
1510
|
+
class a5 extends Y {
|
|
1511
1511
|
constructor(t, e, o, r, i) {
|
|
1512
1512
|
super(t, e, o, r, i), this.type = 5;
|
|
1513
1513
|
}
|
|
@@ -1533,7 +1533,7 @@ class c5 {
|
|
|
1533
1533
|
}
|
|
1534
1534
|
}
|
|
1535
1535
|
const X = B.litHtmlPolyfillSupport;
|
|
1536
|
-
X == null || X(R,
|
|
1536
|
+
X == null || X(R, K), (B.litHtmlVersions ?? (B.litHtmlVersions = [])).push("3.2.1");
|
|
1537
1537
|
/**
|
|
1538
1538
|
* @license
|
|
1539
1539
|
* Copyright 2018 Google LLC
|
|
@@ -1548,9 +1548,10 @@ var h5 = Object.defineProperty, d5 = Object.getOwnPropertyDescriptor, u = (s, t,
|
|
|
1548
1548
|
let f5 = 0;
|
|
1549
1549
|
var p;
|
|
1550
1550
|
const f = (p = class extends _1 {
|
|
1551
|
+
// allows use of elementInternals' API
|
|
1551
1552
|
constructor() {
|
|
1552
|
-
super(
|
|
1553
|
-
}, this.href = "";
|
|
1553
|
+
super(), this.id = "", this.name = "", this._size = "md", this.fullWidth = !1, this._variant = "filled", this.inverted = !1, this.label = "", this.prefixIcon = "", this.suffixIcon = "", this.disabled = !1, this.form = "", this.value = "", this._type = "button", this.onClick = () => {
|
|
1554
|
+
}, this.href = "", this._internals = this.attachInternals();
|
|
1554
1555
|
}
|
|
1555
1556
|
get size() {
|
|
1556
1557
|
return this._size;
|
|
@@ -1576,7 +1577,6 @@ const f = (p = class extends _1 {
|
|
|
1576
1577
|
t
|
|
1577
1578
|
) ? t : "button";
|
|
1578
1579
|
}
|
|
1579
|
-
/**************** Lifecycle Methods ****************/
|
|
1580
1580
|
connectedCallback() {
|
|
1581
1581
|
super.connectedCallback(), this.id || (this.id = this._generateUniqueId());
|
|
1582
1582
|
}
|
|
@@ -1584,6 +1584,20 @@ const f = (p = class extends _1 {
|
|
|
1584
1584
|
_generateUniqueId() {
|
|
1585
1585
|
return `nys-button-${Date.now()}-${f5++}`;
|
|
1586
1586
|
}
|
|
1587
|
+
_manageFormAction(t) {
|
|
1588
|
+
typeof this.onClick == "function" && this.onClick(t);
|
|
1589
|
+
const e = this._internals.form;
|
|
1590
|
+
if (e)
|
|
1591
|
+
switch (this.type) {
|
|
1592
|
+
case "submit":
|
|
1593
|
+
e.requestSubmit();
|
|
1594
|
+
break;
|
|
1595
|
+
case "reset":
|
|
1596
|
+
e.reset();
|
|
1597
|
+
break;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
/******************** Event Handlers ********************/
|
|
1587
1601
|
// Handle focus event
|
|
1588
1602
|
_handleFocus() {
|
|
1589
1603
|
this.dispatchEvent(new Event("focus"));
|
|
@@ -1593,7 +1607,15 @@ const f = (p = class extends _1 {
|
|
|
1593
1607
|
this.dispatchEvent(new Event("blur"));
|
|
1594
1608
|
}
|
|
1595
1609
|
_handleClick(t) {
|
|
1596
|
-
|
|
1610
|
+
if (this.disabled) {
|
|
1611
|
+
t.preventDefault();
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
this._manageFormAction(t);
|
|
1615
|
+
}
|
|
1616
|
+
// Handle keydown for keyboard accessibility
|
|
1617
|
+
_handleKeydown(t) {
|
|
1618
|
+
(t.code === "Space" || t.code === "Enter") && (t.preventDefault(), this.disabled || this._manageFormAction(t));
|
|
1597
1619
|
}
|
|
1598
1620
|
render() {
|
|
1599
1621
|
return y`
|
|
@@ -1602,10 +1624,11 @@ const f = (p = class extends _1 {
|
|
|
1602
1624
|
<a
|
|
1603
1625
|
class="nys-button"
|
|
1604
1626
|
id=${_(this.id)}
|
|
1605
|
-
name=${_(this.name)}
|
|
1627
|
+
name=${_(this.name ? this.name : void 0)}
|
|
1606
1628
|
?disabled=${this.disabled}
|
|
1607
|
-
|
|
1608
|
-
|
|
1629
|
+
aria-disabled="${this.disabled ? "true" : "false"}"
|
|
1630
|
+
form=${_(this.form ? this.form : void 0)}
|
|
1631
|
+
value=${_(this.value ? this.value : void 0)}
|
|
1609
1632
|
href=${this.href}
|
|
1610
1633
|
target="_blank"
|
|
1611
1634
|
@click=${this._handleClick}
|
|
@@ -1625,14 +1648,15 @@ const f = (p = class extends _1 {
|
|
|
1625
1648
|
<button
|
|
1626
1649
|
class="nys-button"
|
|
1627
1650
|
id=${_(this.id)}
|
|
1628
|
-
name=${_(this.name)}
|
|
1651
|
+
name=${_(this.name ? this.name : void 0)}
|
|
1629
1652
|
?disabled=${this.disabled}
|
|
1630
|
-
form=${_(this.form)}
|
|
1631
|
-
value=${_(this.value)}
|
|
1653
|
+
form=${_(this.form ? this.form : void 0)}
|
|
1654
|
+
value=${_(this.value ? this.value : void 0)}
|
|
1632
1655
|
type=${this.type}
|
|
1633
1656
|
@click=${this._handleClick}
|
|
1634
1657
|
@focus="${this._handleFocus}"
|
|
1635
1658
|
@blur="${this._handleBlur}"
|
|
1659
|
+
@keydown="${this._handleKeydown}"
|
|
1636
1660
|
>
|
|
1637
1661
|
${this.prefixIcon && this.variant !== "text" ? y`<slot name="prefix-icon">
|
|
1638
1662
|
<nys-icon size="16" name=${this.prefixIcon}></nys-icon>
|
|
@@ -1650,7 +1674,7 @@ const f = (p = class extends _1 {
|
|
|
1650
1674
|
"outline",
|
|
1651
1675
|
"ghost",
|
|
1652
1676
|
"text"
|
|
1653
|
-
], p.VALID_TYPES = ["submit", "reset", "button"], p.styles = T1, p);
|
|
1677
|
+
], p.VALID_TYPES = ["submit", "reset", "button"], p.styles = T1, p.formAssociated = !0, p);
|
|
1654
1678
|
u([
|
|
1655
1679
|
v({ type: String })
|
|
1656
1680
|
], f.prototype, "id", 2);
|