@nysds/nys-select 1.1.0 → 1.1.1
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/index.d.ts +1 -0
- package/dist/nys-select.d.ts +2 -0
- package/dist/nys-select.js +59 -31
- package/dist/nys-select.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
package/dist/nys-select.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class NysSelect extends LitElement {
|
|
|
10
10
|
value: string;
|
|
11
11
|
disabled: boolean;
|
|
12
12
|
required: boolean;
|
|
13
|
+
optional: boolean;
|
|
13
14
|
form: string;
|
|
14
15
|
showError: boolean;
|
|
15
16
|
errorMessage: string;
|
|
@@ -34,6 +35,7 @@ export declare class NysSelect extends LitElement {
|
|
|
34
35
|
private _setValidityMessage;
|
|
35
36
|
private _validate;
|
|
36
37
|
/********************** Functions **********************/
|
|
38
|
+
checkValidity(): boolean;
|
|
37
39
|
private _handleInvalid;
|
|
38
40
|
/******************** Event Handlers ********************/
|
|
39
41
|
private _handleChange;
|
package/dist/nys-select.js
CHANGED
|
@@ -4,7 +4,7 @@ import { css as k, LitElement as L, html as p } from "lit";
|
|
|
4
4
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
5
5
|
* ▒█░░▀█ ░░▒█░░ ▒█▄▄▄█ ▒█▄▄▀ ▒█▄▄▄█
|
|
6
6
|
*
|
|
7
|
-
* Select Component v1.1.
|
|
7
|
+
* Select Component v1.1.1
|
|
8
8
|
* Part of the New York State Design System
|
|
9
9
|
* Repository: https://github.com/its-hcd/nysds
|
|
10
10
|
* License: MIT
|
|
@@ -328,13 +328,17 @@ const C5 = k`
|
|
|
328
328
|
--_nys-select-font-size: var(--nys-font-size-ui-md, 16px);
|
|
329
329
|
--_nys-select-font-weight: var(--nys-font-weight-regular, 400);
|
|
330
330
|
--_nys-select-line-height: var(--nys-font-lineheight-ui-md, 24px);
|
|
331
|
-
--_nys-select-gap: var(--nys-space-
|
|
331
|
+
--_nys-select-gap: var(--nys-space-50, 4px);
|
|
332
332
|
--_nys-select-radius: var(--nys-radius-md, var(--nys-space-50, 4px));
|
|
333
333
|
--_nys-select-padding: var(--nys-space-100, 8px) var(--nys-space-400, 32px)
|
|
334
334
|
var(--nys-space-100, 8px) var(--nys-space-100, 8px);
|
|
335
335
|
|
|
336
336
|
/* Global Select Colors */
|
|
337
|
-
--_nys-select-color: var(
|
|
337
|
+
--_nys-select-text-color: var(
|
|
338
|
+
--nys-color-text,
|
|
339
|
+
var(--nys-color-neutral-900, #1b1b1b)
|
|
340
|
+
);
|
|
341
|
+
--_nys-select-icon-color: var(
|
|
338
342
|
--nys-color-ink,
|
|
339
343
|
var(--nys-color-neutral-900, #1b1b1b)
|
|
340
344
|
);
|
|
@@ -344,7 +348,11 @@ const C5 = k`
|
|
|
344
348
|
);
|
|
345
349
|
--_nys-select-bg-color: var(--nys-color-ink-reverse, #fff);
|
|
346
350
|
--_nys-select-bg-disabled-color: var(--nys-color-neutral-50, #ededed);
|
|
347
|
-
--_nys-select-
|
|
351
|
+
--_nys-select-text-disabled-color: var(
|
|
352
|
+
--nys-color-text-disabled,
|
|
353
|
+
var(--nys-color-neutral-200, #bec0c1)
|
|
354
|
+
);
|
|
355
|
+
--_nys-select-icon-disabled-color: var(--nys-color-neutral-200, #bec0c1);
|
|
348
356
|
|
|
349
357
|
/* Select Outline & Border States */
|
|
350
358
|
--_nys-select-border-default: var(--nys-border-width-sm, 1px) solid
|
|
@@ -362,10 +370,10 @@ const C5 = k`
|
|
|
362
370
|
flex-direction: column;
|
|
363
371
|
gap: var(--_nys-select-gap);
|
|
364
372
|
font-family: var(--_nys-select-font-family);
|
|
365
|
-
color: var(--_nys-select-color);
|
|
366
373
|
}
|
|
367
374
|
|
|
368
375
|
.nys-select__select {
|
|
376
|
+
color: var(--_nys-select-text-color);
|
|
369
377
|
font-weight: var(--_nys-select-font-weight);
|
|
370
378
|
border-radius: var(--_nys-select-radius);
|
|
371
379
|
border: var(--_nys-select-border-default);
|
|
@@ -390,6 +398,7 @@ const C5 = k`
|
|
|
390
398
|
}
|
|
391
399
|
|
|
392
400
|
.nys-select__icon {
|
|
401
|
+
color: var(--_nys-select-icon-color);
|
|
393
402
|
position: absolute;
|
|
394
403
|
right: 10px;
|
|
395
404
|
top: 50%;
|
|
@@ -438,6 +447,7 @@ const C5 = k`
|
|
|
438
447
|
background-color: var(--_nys-select-bg-disabled-color);
|
|
439
448
|
border: var(--_nys-select-border-disabled);
|
|
440
449
|
cursor: not-allowed;
|
|
450
|
+
color: var(--_nys-select-text-disabled-color);
|
|
441
451
|
}
|
|
442
452
|
.nys-select__select:disabled ~ .nys-select__icon {
|
|
443
453
|
color: var(--_nys-select-icon-disabled-color);
|
|
@@ -501,7 +511,7 @@ customElements.define("nys-option", u);
|
|
|
501
511
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
502
512
|
* ▒█░░▀█ ░░▒█░░ ▒█▄▄▄█ ▒█▄▄▀ ▒█▄▄▄█
|
|
503
513
|
*
|
|
504
|
-
* Icon Component v1.1.
|
|
514
|
+
* Icon Component v1.1.1
|
|
505
515
|
* Part of the New York State Design System
|
|
506
516
|
* Repository: https://github.com/its-hcd/nysds
|
|
507
517
|
* License: MIT
|
|
@@ -1148,7 +1158,7 @@ const g = (x = class extends L {
|
|
|
1148
1158
|
"64"
|
|
1149
1159
|
], x);
|
|
1150
1160
|
b([
|
|
1151
|
-
M({ type: String })
|
|
1161
|
+
M({ type: String, reflect: !0 })
|
|
1152
1162
|
], g.prototype, "name", 2);
|
|
1153
1163
|
b([
|
|
1154
1164
|
M({ type: String })
|
|
@@ -1168,7 +1178,7 @@ b([
|
|
|
1168
1178
|
let _5 = g;
|
|
1169
1179
|
customElements.get("nys-icon") || customElements.define("nys-icon", _5);
|
|
1170
1180
|
/*!
|
|
1171
|
-
* Label v1.1.
|
|
1181
|
+
* Label v1.1.1
|
|
1172
1182
|
* Part of the New York State Design System
|
|
1173
1183
|
* A design system for New York State's digital products.
|
|
1174
1184
|
* Repository: https://github.com/its-hcd/nysds
|
|
@@ -1214,10 +1224,10 @@ const M5 = (o) => new L5(typeof o == "string" ? o : o + "", void 0, j1), b5 = (o
|
|
|
1214
1224
|
* Copyright 2017 Google LLC
|
|
1215
1225
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1216
1226
|
*/
|
|
1217
|
-
const { is: $5, defineProperty: Z5, getOwnPropertyDescriptor: E5, getOwnPropertyNames: S5, getOwnPropertySymbols: x5, getPrototypeOf:
|
|
1227
|
+
const { is: $5, defineProperty: Z5, getOwnPropertyDescriptor: E5, getOwnPropertyNames: S5, getOwnPropertySymbols: x5, getPrototypeOf: V5 } = Object, y = globalThis, Z1 = y.trustedTypes, H5 = Z1 ? Z1.emptyScript : "", E1 = y.reactiveElementPolyfillSupport, z = (o, t) => o, K = { toAttribute(o, t) {
|
|
1218
1228
|
switch (t) {
|
|
1219
1229
|
case Boolean:
|
|
1220
|
-
o = o ?
|
|
1230
|
+
o = o ? H5 : null;
|
|
1221
1231
|
break;
|
|
1222
1232
|
case Object:
|
|
1223
1233
|
case Array:
|
|
@@ -1244,7 +1254,7 @@ const { is: $5, defineProperty: Z5, getOwnPropertyDescriptor: E5, getOwnProperty
|
|
|
1244
1254
|
return e;
|
|
1245
1255
|
} }, l1 = (o, t) => !$5(o, t), S1 = { attribute: !0, type: String, converter: K, reflect: !1, hasChanged: l1 };
|
|
1246
1256
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), y.litPropertyMetadata ?? (y.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
1247
|
-
let
|
|
1257
|
+
let V = class extends HTMLElement {
|
|
1248
1258
|
static addInitializer(t) {
|
|
1249
1259
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
1250
1260
|
}
|
|
@@ -1275,7 +1285,7 @@ let H = class extends HTMLElement {
|
|
|
1275
1285
|
}
|
|
1276
1286
|
static _$Ei() {
|
|
1277
1287
|
if (this.hasOwnProperty(z("elementProperties"))) return;
|
|
1278
|
-
const t =
|
|
1288
|
+
const t = V5(this);
|
|
1279
1289
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
1280
1290
|
}
|
|
1281
1291
|
static finalize() {
|
|
@@ -1442,7 +1452,7 @@ let H = class extends HTMLElement {
|
|
|
1442
1452
|
firstUpdated(t) {
|
|
1443
1453
|
}
|
|
1444
1454
|
};
|
|
1445
|
-
|
|
1455
|
+
V.elementStyles = [], V.shadowRootOptions = { mode: "open" }, V[z("elementProperties")] = /* @__PURE__ */ new Map(), V[z("finalized")] = /* @__PURE__ */ new Map(), E1 == null || E1({ ReactiveElement: V }), (y.reactiveElementVersions ?? (y.reactiveElementVersions = [])).push("2.0.4");
|
|
1446
1456
|
/**
|
|
1447
1457
|
* @license
|
|
1448
1458
|
* Copyright 2017 Google LLC
|
|
@@ -1493,19 +1503,19 @@ const O5 = k`
|
|
|
1493
1503
|
--_nys-label-font-size: var(--nys-font-size-ui-md, 16px);
|
|
1494
1504
|
--_nys-label-line-height: var(--nys-font-lineheight-ui-md, 24px);
|
|
1495
1505
|
--_nys-label-letter-spacing: var(--nys-font-letterspacing-ui-md, 0.044px);
|
|
1496
|
-
--_nys-label-font-color: var(--nys-color-
|
|
1506
|
+
--_nys-label-font-color: var(--nys-color-text, #1b1b1b);
|
|
1497
1507
|
|
|
1498
1508
|
/* Description */
|
|
1499
1509
|
--nys-description-font-weight: var(--nys-font-weight-regular, 400);
|
|
1500
1510
|
--nys-description-font-style: italic;
|
|
1501
|
-
--nys-description-font-color: var(--nys-
|
|
1511
|
+
--nys-description-font-color: var(--nys-color-text, #1b1b1b);
|
|
1502
1512
|
|
|
1503
1513
|
/* Required Flag */
|
|
1504
1514
|
--nys-required-font-color: var(--nys-color-danger, #b52c2c);
|
|
1505
1515
|
|
|
1506
1516
|
/* Optional Flag */
|
|
1507
1517
|
--nys-optional-font-weight: var(--nys-font-weight-regular, 400);
|
|
1508
|
-
--nys-optional-font-color: var(--nys-color-
|
|
1518
|
+
--nys-optional-font-color: var(--nys-color-text-weak, #4a4d4f);
|
|
1509
1519
|
|
|
1510
1520
|
/* Spacing */
|
|
1511
1521
|
--_nys-label-flag-gap: var(--nys-space-2px, 2px);
|
|
@@ -1587,7 +1597,7 @@ Q([
|
|
|
1587
1597
|
], j.prototype, "flag");
|
|
1588
1598
|
customElements.get("nys-label") || customElements.define("nys-label", j);
|
|
1589
1599
|
/*!
|
|
1590
|
-
* Error Message v1.1.
|
|
1600
|
+
* Error Message v1.1.1
|
|
1591
1601
|
* Part of the New York State Design System
|
|
1592
1602
|
* A design system for New York State's digital products.
|
|
1593
1603
|
* Repository: https://github.com/its-hcd/nysds
|
|
@@ -1623,7 +1633,7 @@ const B5 = (o) => new z5(typeof o == "string" ? o : o + "", void 0, D1), R5 = (o
|
|
|
1623
1633
|
const s = document.createElement("style"), C = I.litNonce;
|
|
1624
1634
|
C !== void 0 && s.setAttribute("nonce", C), s.textContent = e.cssText, o.appendChild(s);
|
|
1625
1635
|
}
|
|
1626
|
-
},
|
|
1636
|
+
}, V1 = a1 ? (o) => o : (o) => o instanceof CSSStyleSheet ? ((t) => {
|
|
1627
1637
|
let e = "";
|
|
1628
1638
|
for (const s of t.cssRules) e += s.cssText;
|
|
1629
1639
|
return B5(e);
|
|
@@ -1633,7 +1643,7 @@ const B5 = (o) => new z5(typeof o == "string" ? o : o + "", void 0, D1), R5 = (o
|
|
|
1633
1643
|
* Copyright 2017 Google LLC
|
|
1634
1644
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1635
1645
|
*/
|
|
1636
|
-
const { is: k5, defineProperty: T5, getOwnPropertyDescriptor: j5, getOwnPropertyNames: q5, getOwnPropertySymbols: D5, getPrototypeOf: N5 } = Object, m = globalThis,
|
|
1646
|
+
const { is: k5, defineProperty: T5, getOwnPropertyDescriptor: j5, getOwnPropertyNames: q5, getOwnPropertySymbols: D5, getPrototypeOf: N5 } = Object, m = globalThis, H1 = m.trustedTypes, I5 = H1 ? H1.emptyScript : "", P1 = m.reactiveElementPolyfillSupport, B = (o, t) => o, Y = { toAttribute(o, t) {
|
|
1637
1647
|
switch (t) {
|
|
1638
1648
|
case Boolean:
|
|
1639
1649
|
o = o ? I5 : null;
|
|
@@ -1663,7 +1673,7 @@ const { is: k5, defineProperty: T5, getOwnPropertyDescriptor: j5, getOwnProperty
|
|
|
1663
1673
|
return e;
|
|
1664
1674
|
} }, c1 = (o, t) => !k5(o, t), U1 = { attribute: !0, type: String, converter: Y, reflect: !1, hasChanged: c1 };
|
|
1665
1675
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), m.litPropertyMetadata ?? (m.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
1666
|
-
class
|
|
1676
|
+
class H extends HTMLElement {
|
|
1667
1677
|
static addInitializer(t) {
|
|
1668
1678
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
1669
1679
|
}
|
|
@@ -1719,8 +1729,8 @@ class V extends HTMLElement {
|
|
|
1719
1729
|
const e = [];
|
|
1720
1730
|
if (Array.isArray(t)) {
|
|
1721
1731
|
const s = new Set(t.flat(1 / 0).reverse());
|
|
1722
|
-
for (const C of s) e.unshift(
|
|
1723
|
-
} else t !== void 0 && e.push(
|
|
1732
|
+
for (const C of s) e.unshift(V1(C));
|
|
1733
|
+
} else t !== void 0 && e.push(V1(t));
|
|
1724
1734
|
return e;
|
|
1725
1735
|
}
|
|
1726
1736
|
static _$Eu(t, e) {
|
|
@@ -1861,7 +1871,7 @@ class V extends HTMLElement {
|
|
|
1861
1871
|
firstUpdated(t) {
|
|
1862
1872
|
}
|
|
1863
1873
|
}
|
|
1864
|
-
|
|
1874
|
+
H.elementStyles = [], H.shadowRootOptions = { mode: "open" }, H[B("elementProperties")] = /* @__PURE__ */ new Map(), H[B("finalized")] = /* @__PURE__ */ new Map(), P1 == null || P1({ ReactiveElement: H }), (m.reactiveElementVersions ?? (m.reactiveElementVersions = [])).push("2.0.4");
|
|
1865
1875
|
/**
|
|
1866
1876
|
* @license
|
|
1867
1877
|
* Copyright 2017 Google LLC
|
|
@@ -1949,7 +1959,7 @@ const J5 = k`
|
|
|
1949
1959
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
1950
1960
|
* ▒█░░▀█ ░░▒█░░ ▒█▄▄▄█ ▒█▄▄▀ ▒█▄▄▄█
|
|
1951
1961
|
*
|
|
1952
|
-
* Icon Component v1.1.
|
|
1962
|
+
* Icon Component v1.1.1
|
|
1953
1963
|
* Part of the New York State Design System
|
|
1954
1964
|
* Repository: https://github.com/its-hcd/nysds
|
|
1955
1965
|
* License: MIT
|
|
@@ -2596,7 +2606,7 @@ const w = (U = class extends L {
|
|
|
2596
2606
|
"64"
|
|
2597
2607
|
], U);
|
|
2598
2608
|
Z([
|
|
2599
|
-
$({ type: String })
|
|
2609
|
+
$({ type: String, reflect: !0 })
|
|
2600
2610
|
], w.prototype, "name", 2);
|
|
2601
2611
|
Z([
|
|
2602
2612
|
$({ type: String })
|
|
@@ -2654,7 +2664,7 @@ var d;
|
|
|
2654
2664
|
const c = (d = class extends L {
|
|
2655
2665
|
// allows use of elementInternals' API
|
|
2656
2666
|
constructor() {
|
|
2657
|
-
super(), this.id = "", this.name = "", this.label = "", this.description = "", this.value = "", this.disabled = !1, this.required = !1, this.form = "", this.showError = !1, this.errorMessage = "", this._width = "md", this._hasUserInteracted = !1, this._internals = this.attachInternals();
|
|
2667
|
+
super(), this.id = "", this.name = "", this.label = "", this.description = "", this.value = "", this.disabled = !1, this.required = !1, this.optional = !1, this.form = "", this.showError = !1, this.errorMessage = "", this._width = "md", this._hasUserInteracted = !1, this._internals = this.attachInternals();
|
|
2658
2668
|
}
|
|
2659
2669
|
get width() {
|
|
2660
2670
|
return this._width;
|
|
@@ -2701,7 +2711,7 @@ const c = (d = class extends L {
|
|
|
2701
2711
|
const t = (C = this.shadowRoot) == null ? void 0 : C.querySelector("select");
|
|
2702
2712
|
if (!t) return;
|
|
2703
2713
|
const e = this.errorMessage || "Please select an option.";
|
|
2704
|
-
this.required && !this.value ? (this._internals.ariaRequired = "true", this._internals.setValidity({ valueMissing: !0 }, e, t)
|
|
2714
|
+
this.required && !this.value ? (this._internals.ariaRequired = "true", this._internals.setValidity({ valueMissing: !0 }, e, t)) : (this._internals.ariaRequired = "false", this._internals.setValidity({}), this._hasUserInteracted = !1);
|
|
2705
2715
|
}
|
|
2706
2716
|
_setValidityMessage(t = "") {
|
|
2707
2717
|
var s;
|
|
@@ -2720,8 +2730,22 @@ const c = (d = class extends L {
|
|
|
2720
2730
|
this._manageRequire(), this._setValidityMessage(e);
|
|
2721
2731
|
}
|
|
2722
2732
|
/********************** Functions **********************/
|
|
2723
|
-
|
|
2724
|
-
|
|
2733
|
+
// This helper function is called to perform the element's native validation.
|
|
2734
|
+
checkValidity() {
|
|
2735
|
+
var e;
|
|
2736
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("select");
|
|
2737
|
+
return t ? t.checkValidity() : !0;
|
|
2738
|
+
}
|
|
2739
|
+
_handleInvalid(t) {
|
|
2740
|
+
var s;
|
|
2741
|
+
t.preventDefault(), this._hasUserInteracted = !0, this._validate(), this.showError = !0;
|
|
2742
|
+
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("select");
|
|
2743
|
+
if (e) {
|
|
2744
|
+
const C = this._internals.form;
|
|
2745
|
+
C ? Array.from(C.elements).find(
|
|
2746
|
+
(n) => typeof n.checkValidity == "function" && !n.checkValidity()
|
|
2747
|
+
) === this && e.focus() : e.focus();
|
|
2748
|
+
}
|
|
2725
2749
|
}
|
|
2726
2750
|
/******************** Event Handlers ********************/
|
|
2727
2751
|
// Handle change event to bubble up selected value
|
|
@@ -2761,7 +2785,7 @@ const c = (d = class extends L {
|
|
|
2761
2785
|
<nys-label
|
|
2762
2786
|
label=${this.label}
|
|
2763
2787
|
description=${this.description}
|
|
2764
|
-
flag=${this.required ? "required" : ""}
|
|
2788
|
+
flag=${this.required ? "required" : this.optional ? "optional" : ""}
|
|
2765
2789
|
>
|
|
2766
2790
|
<slot name="description" slot="description">${this.description}</slot>
|
|
2767
2791
|
</nys-label>
|
|
@@ -2804,7 +2828,7 @@ h([
|
|
|
2804
2828
|
a({ type: String })
|
|
2805
2829
|
], c.prototype, "id", 2);
|
|
2806
2830
|
h([
|
|
2807
|
-
a({ type: String })
|
|
2831
|
+
a({ type: String, reflect: !0 })
|
|
2808
2832
|
], c.prototype, "name", 2);
|
|
2809
2833
|
h([
|
|
2810
2834
|
a({ type: String })
|
|
@@ -2821,6 +2845,9 @@ h([
|
|
|
2821
2845
|
h([
|
|
2822
2846
|
a({ type: Boolean, reflect: !0 })
|
|
2823
2847
|
], c.prototype, "required", 2);
|
|
2848
|
+
h([
|
|
2849
|
+
a({ type: Boolean, reflect: !0 })
|
|
2850
|
+
], c.prototype, "optional", 2);
|
|
2824
2851
|
h([
|
|
2825
2852
|
a({ type: String })
|
|
2826
2853
|
], c.prototype, "form", 2);
|
|
@@ -2836,6 +2863,7 @@ h([
|
|
|
2836
2863
|
let g2 = c;
|
|
2837
2864
|
customElements.get("nys-select") || customElements.define("nys-select", g2);
|
|
2838
2865
|
export {
|
|
2866
|
+
u as NysOption,
|
|
2839
2867
|
g2 as NysSelect
|
|
2840
2868
|
};
|
|
2841
2869
|
//# sourceMappingURL=nys-select.js.map
|