@nysds/nys-select 1.11.2 → 1.11.4
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-select.js +122 -785
- package/dist/nys-select.js.map +1 -1
- package/package.json +7 -7
- package/dist/index.d.ts +0 -2
- package/dist/nys-option.d.ts +0 -10
- package/dist/nys-select.d.ts +0 -45
- package/dist/nys-select.figma.d.ts +0 -1
- package/dist/nys-select.styles.d.ts +0 -2
package/dist/nys-select.js
CHANGED
|
@@ -1,676 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* Part of the New York State Design System
|
|
9
|
-
* Repository: https://github.com/its-hcd/nysds
|
|
10
|
-
* License: MIT
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @license
|
|
14
|
-
* Copyright 2019 Google LLC
|
|
15
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*/
|
|
17
|
-
const H = globalThis, V = H.ShadowRoot && (H.ShadyCSS === void 0 || H.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ie = Symbol(), W = /* @__PURE__ */ new WeakMap();
|
|
18
|
-
let he = class {
|
|
19
|
-
constructor(e, t, s) {
|
|
20
|
-
if (this._$cssResult$ = !0, s !== ie) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
21
|
-
this.cssText = e, this.t = t;
|
|
22
|
-
}
|
|
23
|
-
get styleSheet() {
|
|
24
|
-
let e = this.o;
|
|
25
|
-
const t = this.t;
|
|
26
|
-
if (V && e === void 0) {
|
|
27
|
-
const s = t !== void 0 && t.length === 1;
|
|
28
|
-
s && (e = W.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), s && W.set(t, e));
|
|
29
|
-
}
|
|
30
|
-
return e;
|
|
31
|
-
}
|
|
32
|
-
toString() {
|
|
33
|
-
return this.cssText;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const ce = (o) => new he(typeof o == "string" ? o : o + "", void 0, ie), de = (o, e) => {
|
|
37
|
-
if (V) o.adoptedStyleSheets = e.map(((t) => t instanceof CSSStyleSheet ? t : t.styleSheet));
|
|
38
|
-
else for (const t of e) {
|
|
39
|
-
const s = document.createElement("style"), i = H.litNonce;
|
|
40
|
-
i !== void 0 && s.setAttribute("nonce", i), s.textContent = t.cssText, o.appendChild(s);
|
|
41
|
-
}
|
|
42
|
-
}, F = V ? (o) => o : (o) => o instanceof CSSStyleSheet ? ((e) => {
|
|
43
|
-
let t = "";
|
|
44
|
-
for (const s of e.cssRules) t += s.cssText;
|
|
45
|
-
return ce(t);
|
|
46
|
-
})(o) : o;
|
|
47
|
-
/**
|
|
48
|
-
* @license
|
|
49
|
-
* Copyright 2017 Google LLC
|
|
50
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
|
-
*/
|
|
52
|
-
const { is: pe, defineProperty: ue, getOwnPropertyDescriptor: ye, getOwnPropertyNames: _e, getOwnPropertySymbols: fe, getPrototypeOf: ve } = Object, k = globalThis, G = k.trustedTypes, $e = G ? G.emptyScript : "", me = k.reactiveElementPolyfillSupport, C = (o, e) => o, R = { toAttribute(o, e) {
|
|
53
|
-
switch (e) {
|
|
54
|
-
case Boolean:
|
|
55
|
-
o = o ? $e : null;
|
|
56
|
-
break;
|
|
57
|
-
case Object:
|
|
58
|
-
case Array:
|
|
59
|
-
o = o == null ? o : JSON.stringify(o);
|
|
60
|
-
}
|
|
61
|
-
return o;
|
|
62
|
-
}, fromAttribute(o, e) {
|
|
63
|
-
let t = o;
|
|
64
|
-
switch (e) {
|
|
65
|
-
case Boolean:
|
|
66
|
-
t = o !== null;
|
|
67
|
-
break;
|
|
68
|
-
case Number:
|
|
69
|
-
t = o === null ? null : Number(o);
|
|
70
|
-
break;
|
|
71
|
-
case Object:
|
|
72
|
-
case Array:
|
|
73
|
-
try {
|
|
74
|
-
t = JSON.parse(o);
|
|
75
|
-
} catch {
|
|
76
|
-
t = null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return t;
|
|
80
|
-
} }, z = (o, e) => !pe(o, e), J = { attribute: !0, type: String, converter: R, reflect: !1, useDefault: !1, hasChanged: z };
|
|
81
|
-
Symbol.metadata ??= Symbol("metadata"), k.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
82
|
-
class S extends HTMLElement {
|
|
83
|
-
static addInitializer(e) {
|
|
84
|
-
this._$Ei(), (this.l ??= []).push(e);
|
|
85
|
-
}
|
|
86
|
-
static get observedAttributes() {
|
|
87
|
-
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
88
|
-
}
|
|
89
|
-
static createProperty(e, t = J) {
|
|
90
|
-
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
91
|
-
const s = Symbol(), i = this.getPropertyDescriptor(e, s, t);
|
|
92
|
-
i !== void 0 && ue(this.prototype, e, i);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
static getPropertyDescriptor(e, t, s) {
|
|
96
|
-
const { get: i, set: r } = ye(this.prototype, e) ?? { get() {
|
|
97
|
-
return this[t];
|
|
98
|
-
}, set(n) {
|
|
99
|
-
this[t] = n;
|
|
100
|
-
} };
|
|
101
|
-
return { get: i, set(n) {
|
|
102
|
-
const a = i?.call(this);
|
|
103
|
-
r?.call(this, n), this.requestUpdate(e, a, s);
|
|
104
|
-
}, configurable: !0, enumerable: !0 };
|
|
105
|
-
}
|
|
106
|
-
static getPropertyOptions(e) {
|
|
107
|
-
return this.elementProperties.get(e) ?? J;
|
|
108
|
-
}
|
|
109
|
-
static _$Ei() {
|
|
110
|
-
if (this.hasOwnProperty(C("elementProperties"))) return;
|
|
111
|
-
const e = ve(this);
|
|
112
|
-
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
113
|
-
}
|
|
114
|
-
static finalize() {
|
|
115
|
-
if (this.hasOwnProperty(C("finalized"))) return;
|
|
116
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
|
|
117
|
-
const t = this.properties, s = [..._e(t), ...fe(t)];
|
|
118
|
-
for (const i of s) this.createProperty(i, t[i]);
|
|
119
|
-
}
|
|
120
|
-
const e = this[Symbol.metadata];
|
|
121
|
-
if (e !== null) {
|
|
122
|
-
const t = litPropertyMetadata.get(e);
|
|
123
|
-
if (t !== void 0) for (const [s, i] of t) this.elementProperties.set(s, i);
|
|
124
|
-
}
|
|
125
|
-
this._$Eh = /* @__PURE__ */ new Map();
|
|
126
|
-
for (const [t, s] of this.elementProperties) {
|
|
127
|
-
const i = this._$Eu(t, s);
|
|
128
|
-
i !== void 0 && this._$Eh.set(i, t);
|
|
129
|
-
}
|
|
130
|
-
this.elementStyles = this.finalizeStyles(this.styles);
|
|
131
|
-
}
|
|
132
|
-
static finalizeStyles(e) {
|
|
133
|
-
const t = [];
|
|
134
|
-
if (Array.isArray(e)) {
|
|
135
|
-
const s = new Set(e.flat(1 / 0).reverse());
|
|
136
|
-
for (const i of s) t.unshift(F(i));
|
|
137
|
-
} else e !== void 0 && t.push(F(e));
|
|
138
|
-
return t;
|
|
139
|
-
}
|
|
140
|
-
static _$Eu(e, t) {
|
|
141
|
-
const s = t.attribute;
|
|
142
|
-
return s === !1 ? void 0 : typeof s == "string" ? s : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
143
|
-
}
|
|
144
|
-
constructor() {
|
|
145
|
-
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
146
|
-
}
|
|
147
|
-
_$Ev() {
|
|
148
|
-
this._$ES = new Promise(((e) => this.enableUpdating = e)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((e) => e(this)));
|
|
149
|
-
}
|
|
150
|
-
addController(e) {
|
|
151
|
-
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
|
|
152
|
-
}
|
|
153
|
-
removeController(e) {
|
|
154
|
-
this._$EO?.delete(e);
|
|
155
|
-
}
|
|
156
|
-
_$E_() {
|
|
157
|
-
const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
158
|
-
for (const s of t.keys()) this.hasOwnProperty(s) && (e.set(s, this[s]), delete this[s]);
|
|
159
|
-
e.size > 0 && (this._$Ep = e);
|
|
160
|
-
}
|
|
161
|
-
createRenderRoot() {
|
|
162
|
-
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
163
|
-
return de(e, this.constructor.elementStyles), e;
|
|
164
|
-
}
|
|
165
|
-
connectedCallback() {
|
|
166
|
-
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((e) => e.hostConnected?.()));
|
|
167
|
-
}
|
|
168
|
-
enableUpdating(e) {
|
|
169
|
-
}
|
|
170
|
-
disconnectedCallback() {
|
|
171
|
-
this._$EO?.forEach(((e) => e.hostDisconnected?.()));
|
|
172
|
-
}
|
|
173
|
-
attributeChangedCallback(e, t, s) {
|
|
174
|
-
this._$AK(e, s);
|
|
175
|
-
}
|
|
176
|
-
_$ET(e, t) {
|
|
177
|
-
const s = this.constructor.elementProperties.get(e), i = this.constructor._$Eu(e, s);
|
|
178
|
-
if (i !== void 0 && s.reflect === !0) {
|
|
179
|
-
const r = (s.converter?.toAttribute !== void 0 ? s.converter : R).toAttribute(t, s.type);
|
|
180
|
-
this._$Em = e, r == null ? this.removeAttribute(i) : this.setAttribute(i, r), this._$Em = null;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
_$AK(e, t) {
|
|
184
|
-
const s = this.constructor, i = s._$Eh.get(e);
|
|
185
|
-
if (i !== void 0 && this._$Em !== i) {
|
|
186
|
-
const r = s.getPropertyOptions(i), n = typeof r.converter == "function" ? { fromAttribute: r.converter } : r.converter?.fromAttribute !== void 0 ? r.converter : R;
|
|
187
|
-
this._$Em = i;
|
|
188
|
-
const a = n.fromAttribute(t, r.type);
|
|
189
|
-
this[i] = a ?? this._$Ej?.get(i) ?? a, this._$Em = null;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
requestUpdate(e, t, s) {
|
|
193
|
-
if (e !== void 0) {
|
|
194
|
-
const i = this.constructor, r = this[e];
|
|
195
|
-
if (s ??= i.getPropertyOptions(e), !((s.hasChanged ?? z)(r, t) || s.useDefault && s.reflect && r === this._$Ej?.get(e) && !this.hasAttribute(i._$Eu(e, s)))) return;
|
|
196
|
-
this.C(e, t, s);
|
|
197
|
-
}
|
|
198
|
-
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
199
|
-
}
|
|
200
|
-
C(e, t, { useDefault: s, reflect: i, wrapped: r }, n) {
|
|
201
|
-
s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, n ?? t ?? this[e]), r !== !0 || n !== void 0) || (this._$AL.has(e) || (this.hasUpdated || s || (t = void 0), this._$AL.set(e, t)), i === !0 && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
202
|
-
}
|
|
203
|
-
async _$EP() {
|
|
204
|
-
this.isUpdatePending = !0;
|
|
205
|
-
try {
|
|
206
|
-
await this._$ES;
|
|
207
|
-
} catch (t) {
|
|
208
|
-
Promise.reject(t);
|
|
209
|
-
}
|
|
210
|
-
const e = this.scheduleUpdate();
|
|
211
|
-
return e != null && await e, !this.isUpdatePending;
|
|
212
|
-
}
|
|
213
|
-
scheduleUpdate() {
|
|
214
|
-
return this.performUpdate();
|
|
215
|
-
}
|
|
216
|
-
performUpdate() {
|
|
217
|
-
if (!this.isUpdatePending) return;
|
|
218
|
-
if (!this.hasUpdated) {
|
|
219
|
-
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
220
|
-
for (const [i, r] of this._$Ep) this[i] = r;
|
|
221
|
-
this._$Ep = void 0;
|
|
222
|
-
}
|
|
223
|
-
const s = this.constructor.elementProperties;
|
|
224
|
-
if (s.size > 0) for (const [i, r] of s) {
|
|
225
|
-
const { wrapped: n } = r, a = this[i];
|
|
226
|
-
n !== !0 || this._$AL.has(i) || a === void 0 || this.C(i, void 0, r, a);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
let e = !1;
|
|
230
|
-
const t = this._$AL;
|
|
231
|
-
try {
|
|
232
|
-
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach(((s) => s.hostUpdate?.())), this.update(t)) : this._$EM();
|
|
233
|
-
} catch (s) {
|
|
234
|
-
throw e = !1, this._$EM(), s;
|
|
235
|
-
}
|
|
236
|
-
e && this._$AE(t);
|
|
237
|
-
}
|
|
238
|
-
willUpdate(e) {
|
|
239
|
-
}
|
|
240
|
-
_$AE(e) {
|
|
241
|
-
this._$EO?.forEach(((t) => t.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
242
|
-
}
|
|
243
|
-
_$EM() {
|
|
244
|
-
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
245
|
-
}
|
|
246
|
-
get updateComplete() {
|
|
247
|
-
return this.getUpdateComplete();
|
|
248
|
-
}
|
|
249
|
-
getUpdateComplete() {
|
|
250
|
-
return this._$ES;
|
|
251
|
-
}
|
|
252
|
-
shouldUpdate(e) {
|
|
253
|
-
return !0;
|
|
254
|
-
}
|
|
255
|
-
update(e) {
|
|
256
|
-
this._$Eq &&= this._$Eq.forEach(((t) => this._$ET(t, this[t]))), this._$EM();
|
|
257
|
-
}
|
|
258
|
-
updated(e) {
|
|
259
|
-
}
|
|
260
|
-
firstUpdated(e) {
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[C("elementProperties")] = /* @__PURE__ */ new Map(), S[C("finalized")] = /* @__PURE__ */ new Map(), me?.({ ReactiveElement: S }), (k.reactiveElementVersions ??= []).push("2.1.1");
|
|
264
|
-
/**
|
|
265
|
-
* @license
|
|
266
|
-
* Copyright 2017 Google LLC
|
|
267
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
268
|
-
*/
|
|
269
|
-
const be = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged: z }, ge = (o = be, e, t) => {
|
|
270
|
-
const { kind: s, metadata: i } = t;
|
|
271
|
-
let r = globalThis.litPropertyMetadata.get(i);
|
|
272
|
-
if (r === void 0 && globalThis.litPropertyMetadata.set(i, r = /* @__PURE__ */ new Map()), s === "setter" && ((o = Object.create(o)).wrapped = !0), r.set(t.name, o), s === "accessor") {
|
|
273
|
-
const { name: n } = t;
|
|
274
|
-
return { set(a) {
|
|
275
|
-
const l = e.get.call(this);
|
|
276
|
-
e.set.call(this, a), this.requestUpdate(n, l, o);
|
|
277
|
-
}, init(a) {
|
|
278
|
-
return a !== void 0 && this.C(n, void 0, o, a), a;
|
|
279
|
-
} };
|
|
280
|
-
}
|
|
281
|
-
if (s === "setter") {
|
|
282
|
-
const { name: n } = t;
|
|
283
|
-
return function(a) {
|
|
284
|
-
const l = this[n];
|
|
285
|
-
e.call(this, a), this.requestUpdate(n, l, o);
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
throw Error("Unsupported decorator location: " + s);
|
|
289
|
-
};
|
|
290
|
-
function d(o) {
|
|
291
|
-
return (e, t) => typeof t == "object" ? ge(o, e, t) : ((s, i, r) => {
|
|
292
|
-
const n = i.hasOwnProperty(r);
|
|
293
|
-
return i.constructor.createProperty(r, s), n ? Object.getOwnPropertyDescriptor(i, r) : void 0;
|
|
294
|
-
})(o, e, t);
|
|
295
|
-
}
|
|
296
|
-
const Ae = ae`
|
|
297
|
-
:host {
|
|
298
|
-
/* Global Select Styles */
|
|
299
|
-
--_nys-select-width: 100%;
|
|
300
|
-
--_nys-select-font-family: var(
|
|
301
|
-
--nys-font-family-ui,
|
|
302
|
-
var(
|
|
303
|
-
--nys-font-family-sans,
|
|
304
|
-
"Proxima Nova",
|
|
305
|
-
"Helvetica Neue",
|
|
306
|
-
"Helvetica",
|
|
307
|
-
"Arial",
|
|
308
|
-
sans-serif
|
|
309
|
-
)
|
|
310
|
-
);
|
|
311
|
-
--_nys-select-font-size: var(--nys-font-size-ui-md, 16px);
|
|
312
|
-
--_nys-select-font-weight: var(--nys-font-weight-regular, 400);
|
|
313
|
-
--_nys-select-line-height: var(--nys-font-lineheight-ui-md, 24px);
|
|
314
|
-
--_nys-select-gap: var(--nys-space-50, 4px);
|
|
315
|
-
--_nys-select-border-radius: var(--nys-radius-md, 4px);
|
|
316
|
-
--_nys-select-padding: var(--nys-space-100, 8px) var(--nys-space-400, 32px)
|
|
317
|
-
var(--nys-space-100, 8px) var(--nys-space-100, 8px);
|
|
318
|
-
|
|
319
|
-
/* Global Select Colors */
|
|
320
|
-
--_nys-select-color: var(--nys-color-text, #1b1b1b);
|
|
321
|
-
--_nys-select-color--error: var(
|
|
322
|
-
--nys-color-danger,
|
|
323
|
-
var(--nys-color-red-600, #b52c2c)
|
|
324
|
-
);
|
|
325
|
-
--_nys-select-background-color: var(--nys-color-ink-reverse, #fff);
|
|
326
|
-
--_nys-select-background-color--disabled: var(
|
|
327
|
-
--nys-color-neutral-50,
|
|
328
|
-
#ededed
|
|
329
|
-
);
|
|
330
|
-
--_nys-select-color--disabled: var(--nys-color-text-disabled, #bec0c1);
|
|
331
|
-
|
|
332
|
-
/* Select Outline & Border States */
|
|
333
|
-
--_nys-select-border-width: var(--nys-border-width-sm, 1px);
|
|
334
|
-
|
|
335
|
-
--_nys-select-border-color: var(--nys-color-neutral-400, #909395);
|
|
336
|
-
--_nys-select-border-color--hover: var(--nys-color-neutral-900, #1b1b1b);
|
|
337
|
-
--_nys-select-border-color--focus: var(--nys-color-focus, #004dd1);
|
|
338
|
-
--_nys-select-border-color--disabled: var(--nys-color-neutral-200, #bec0c1);
|
|
339
|
-
|
|
340
|
-
--_nys-select-border-default: var(--nys-border-width-sm, 1px) solid
|
|
341
|
-
var(--nys-color-neutral-400, #909395);
|
|
342
|
-
--_nys-select-border-focus: var(--nys-border-width-sm, 1px) solid
|
|
343
|
-
var(--nys-color-focus, var(--nys-color-blue-600, #004dd1));
|
|
344
|
-
--_nys-select-border-disabled: var(--nys-border-width-sm, 1px) solid
|
|
345
|
-
var(--nys-color-neutral-200, #bec0c1);
|
|
346
|
-
--_nys-select-border-hover: var(--nys-border-width-sm, 1px) solid
|
|
347
|
-
var(--nys-color-neutral-900, #1b1b1b);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.nys-select {
|
|
351
|
-
display: flex;
|
|
352
|
-
flex-direction: column;
|
|
353
|
-
gap: var(--_nys-select-gap);
|
|
354
|
-
font-family: var(--_nys-select-font-family);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.nys-select__select {
|
|
358
|
-
color: var(--_nys-select-color);
|
|
359
|
-
font-weight: var(--_nys-select-font-weight);
|
|
360
|
-
font-family: var(--_nys-select-font-family);
|
|
361
|
-
border-radius: var(--_nys-select-border-radius);
|
|
362
|
-
border: solid var(--_nys-select-border-width)
|
|
363
|
-
var(--_nys-select-border-color);
|
|
364
|
-
font-size: var(--_nys-select-font-size);
|
|
365
|
-
padding: var(--_nys-select-padding);
|
|
366
|
-
width: var(--_nys-select-width);
|
|
367
|
-
max-width: 100%;
|
|
368
|
-
text-indent: 1px;
|
|
369
|
-
text-overflow: "";
|
|
370
|
-
background: var(--_nys-select-background-color);
|
|
371
|
-
-webkit-appearance: none;
|
|
372
|
-
-moz-appearance: none;
|
|
373
|
-
appearance: none;
|
|
374
|
-
text-overflow: ellipsis;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
.nys-select__selectwrapper {
|
|
378
|
-
position: relative;
|
|
379
|
-
display: inline-block;
|
|
380
|
-
width: var(--_nys-select-width);
|
|
381
|
-
max-width: 100%;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.nys-select__icon {
|
|
385
|
-
color: var(--_nys-select-color);
|
|
386
|
-
position: absolute;
|
|
387
|
-
right: 10px;
|
|
388
|
-
top: 50%;
|
|
389
|
-
transform: translateY(-50%);
|
|
390
|
-
pointer-events: none;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
:host([width="sm"]) {
|
|
394
|
-
--_nys-select-width: var(--nys-select-form-width-sm, 88px);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
:host([width="md"]) {
|
|
398
|
-
--_nys-select-width: var(--nys-select-form-width-md, 200px);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
:host([width="lg"]) {
|
|
402
|
-
--_nys-select-width: var(--nys-select-form-width-lg, 384px);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
:host([width="full"]) {
|
|
406
|
-
--_nys-select-width: 100%;
|
|
407
|
-
flex: 1; /* stretches width for flex container */
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/* Hover */
|
|
411
|
-
.nys-select__select:hover:not(:disabled) {
|
|
412
|
-
cursor: pointer;
|
|
413
|
-
border-color: var(--_nys-select-border-color--hover);
|
|
414
|
-
outline: solid var(--_nys-select-border-width)
|
|
415
|
-
var(--_nys-select-border-color--hover);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/* Focused */
|
|
419
|
-
.nys-select__select:focus {
|
|
420
|
-
border-color: var(--_nys-select-border-color--focus);
|
|
421
|
-
outline: solid var(--_nys-select-border-width)
|
|
422
|
-
var(--_nys-select-border-color--focus);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
/* Disabled */
|
|
426
|
-
.nys-select__select:disabled {
|
|
427
|
-
background-color: var(--_nys-select-background-color--disabled);
|
|
428
|
-
border-color: var(--_nys-select-border-color--disabled);
|
|
429
|
-
cursor: not-allowed;
|
|
430
|
-
color: var(--_nys-select-color--disabled);
|
|
431
|
-
}
|
|
432
|
-
.nys-select__select:disabled ~ .nys-select__icon {
|
|
433
|
-
color: var(--_nys-select-color--disabled);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
:host([showError]) {
|
|
437
|
-
--_nys-select-border-default: var(--nys-border-width-sm, 1px) solid
|
|
438
|
-
var(--_nys-select-color--error);
|
|
439
|
-
}
|
|
440
|
-
`;
|
|
441
|
-
/**
|
|
442
|
-
* @license
|
|
443
|
-
* Copyright 2017 Google LLC
|
|
444
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
445
|
-
*/
|
|
446
|
-
const B = globalThis, T = B.trustedTypes, K = T ? T.createPolicy("lit-html", { createHTML: (o) => o }) : void 0, re = "$lit$", m = `lit$${Math.random().toFixed(9).slice(2)}$`, oe = "?" + m, we = `<${oe}>`, w = document, I = () => w.createComment(""), P = (o) => o === null || typeof o != "object" && typeof o != "function", L = Array.isArray, Ee = (o) => L(o) || typeof o?.[Symbol.iterator] == "function", D = `[
|
|
447
|
-
\f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Z = /-->/g, Y = />/g, g = RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^
|
|
448
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), Q = /'/g, X = /"/g, ne = /^(?:script|style|textarea|title)$/i, U = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), ee = /* @__PURE__ */ new WeakMap(), A = w.createTreeWalker(w, 129);
|
|
449
|
-
function le(o, e) {
|
|
450
|
-
if (!L(o) || !o.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
451
|
-
return K !== void 0 ? K.createHTML(e) : e;
|
|
452
|
-
}
|
|
453
|
-
const Se = (o, e) => {
|
|
454
|
-
const t = o.length - 1, s = [];
|
|
455
|
-
let i, r = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = x;
|
|
456
|
-
for (let a = 0; a < t; a++) {
|
|
457
|
-
const l = o[a];
|
|
458
|
-
let p, u, h = -1, f = 0;
|
|
459
|
-
for (; f < l.length && (n.lastIndex = f, u = n.exec(l), u !== null); ) f = n.lastIndex, n === x ? u[1] === "!--" ? n = Z : u[1] !== void 0 ? n = Y : u[2] !== void 0 ? (ne.test(u[2]) && (i = RegExp("</" + u[2], "g")), n = g) : u[3] !== void 0 && (n = g) : n === g ? u[0] === ">" ? (n = i ?? x, h = -1) : u[1] === void 0 ? h = -2 : (h = n.lastIndex - u[2].length, p = u[1], n = u[3] === void 0 ? g : u[3] === '"' ? X : Q) : n === X || n === Q ? n = g : n === Z || n === Y ? n = x : (n = g, i = void 0);
|
|
460
|
-
const $ = n === g && o[a + 1].startsWith("/>") ? " " : "";
|
|
461
|
-
r += n === x ? l + we : h >= 0 ? (s.push(p), l.slice(0, h) + re + l.slice(h) + m + $) : l + m + (h === -2 ? a : $);
|
|
462
|
-
}
|
|
463
|
-
return [le(o, r + (o[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
1
|
+
import { LitElement as f, html as v, unsafeCSS as _ } from "lit";
|
|
2
|
+
import { property as o } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined as b } from "lit/directives/if-defined.js";
|
|
4
|
+
var m = Object.defineProperty, p = (u, e, t, d) => {
|
|
5
|
+
for (var l = void 0, s = u.length - 1, r; s >= 0; s--)
|
|
6
|
+
(r = u[s]) && (l = r(e, t, l) || l);
|
|
7
|
+
return l && m(e, t, l), l;
|
|
464
8
|
};
|
|
465
|
-
class
|
|
466
|
-
constructor({ strings: e, _$litType$: t }, s) {
|
|
467
|
-
let i;
|
|
468
|
-
this.parts = [];
|
|
469
|
-
let r = 0, n = 0;
|
|
470
|
-
const a = e.length - 1, l = this.parts, [p, u] = Se(e, t);
|
|
471
|
-
if (this.el = O.createElement(p, s), A.currentNode = this.el.content, t === 2 || t === 3) {
|
|
472
|
-
const h = this.el.content.firstChild;
|
|
473
|
-
h.replaceWith(...h.childNodes);
|
|
474
|
-
}
|
|
475
|
-
for (; (i = A.nextNode()) !== null && l.length < a; ) {
|
|
476
|
-
if (i.nodeType === 1) {
|
|
477
|
-
if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(re)) {
|
|
478
|
-
const f = u[n++], $ = i.getAttribute(h).split(m), N = /([.?@])?(.*)/.exec(f);
|
|
479
|
-
l.push({ type: 1, index: r, name: N[2], strings: $, ctor: N[1] === "." ? Ce : N[1] === "?" ? Pe : N[1] === "@" ? Ue : j }), i.removeAttribute(h);
|
|
480
|
-
} else h.startsWith(m) && (l.push({ type: 6, index: r }), i.removeAttribute(h));
|
|
481
|
-
if (ne.test(i.tagName)) {
|
|
482
|
-
const h = i.textContent.split(m), f = h.length - 1;
|
|
483
|
-
if (f > 0) {
|
|
484
|
-
i.textContent = T ? T.emptyScript : "";
|
|
485
|
-
for (let $ = 0; $ < f; $++) i.append(h[$], I()), A.nextNode(), l.push({ type: 2, index: ++r });
|
|
486
|
-
i.append(h[f], I());
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
} else if (i.nodeType === 8) if (i.data === oe) l.push({ type: 2, index: r });
|
|
490
|
-
else {
|
|
491
|
-
let h = -1;
|
|
492
|
-
for (; (h = i.data.indexOf(m, h + 1)) !== -1; ) l.push({ type: 7, index: r }), h += m.length - 1;
|
|
493
|
-
}
|
|
494
|
-
r++;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
static createElement(e, t) {
|
|
498
|
-
const s = w.createElement("template");
|
|
499
|
-
return s.innerHTML = e, s;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
function E(o, e, t = o, s) {
|
|
503
|
-
if (e === U) return e;
|
|
504
|
-
let i = s !== void 0 ? t._$Co?.[s] : t._$Cl;
|
|
505
|
-
const r = P(e) ? void 0 : e._$litDirective$;
|
|
506
|
-
return i?.constructor !== r && (i?._$AO?.(!1), r === void 0 ? i = void 0 : (i = new r(o), i._$AT(o, t, s)), s !== void 0 ? (t._$Co ??= [])[s] = i : t._$Cl = i), i !== void 0 && (e = E(o, i._$AS(o, e.values), i, s)), e;
|
|
507
|
-
}
|
|
508
|
-
class xe {
|
|
509
|
-
constructor(e, t) {
|
|
510
|
-
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
511
|
-
}
|
|
512
|
-
get parentNode() {
|
|
513
|
-
return this._$AM.parentNode;
|
|
514
|
-
}
|
|
515
|
-
get _$AU() {
|
|
516
|
-
return this._$AM._$AU;
|
|
517
|
-
}
|
|
518
|
-
u(e) {
|
|
519
|
-
const { el: { content: t }, parts: s } = this._$AD, i = (e?.creationScope ?? w).importNode(t, !0);
|
|
520
|
-
A.currentNode = i;
|
|
521
|
-
let r = A.nextNode(), n = 0, a = 0, l = s[0];
|
|
522
|
-
for (; l !== void 0; ) {
|
|
523
|
-
if (n === l.index) {
|
|
524
|
-
let p;
|
|
525
|
-
l.type === 2 ? p = new q(r, r.nextSibling, this, e) : l.type === 1 ? p = new l.ctor(r, l.name, l.strings, this, e) : l.type === 6 && (p = new Oe(r, this, e)), this._$AV.push(p), l = s[++a];
|
|
526
|
-
}
|
|
527
|
-
n !== l?.index && (r = A.nextNode(), n++);
|
|
528
|
-
}
|
|
529
|
-
return A.currentNode = w, i;
|
|
530
|
-
}
|
|
531
|
-
p(e) {
|
|
532
|
-
let t = 0;
|
|
533
|
-
for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(e, s, t), t += s.strings.length - 2) : s._$AI(e[t])), t++;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
class q {
|
|
537
|
-
get _$AU() {
|
|
538
|
-
return this._$AM?._$AU ?? this._$Cv;
|
|
539
|
-
}
|
|
540
|
-
constructor(e, t, s, i) {
|
|
541
|
-
this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = s, this.options = i, this._$Cv = i?.isConnected ?? !0;
|
|
542
|
-
}
|
|
543
|
-
get parentNode() {
|
|
544
|
-
let e = this._$AA.parentNode;
|
|
545
|
-
const t = this._$AM;
|
|
546
|
-
return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
|
|
547
|
-
}
|
|
548
|
-
get startNode() {
|
|
549
|
-
return this._$AA;
|
|
550
|
-
}
|
|
551
|
-
get endNode() {
|
|
552
|
-
return this._$AB;
|
|
553
|
-
}
|
|
554
|
-
_$AI(e, t = this) {
|
|
555
|
-
e = E(this, e, t), P(e) ? e === c || e == null || e === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : e !== this._$AH && e !== U && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Ee(e) ? this.k(e) : this._(e);
|
|
556
|
-
}
|
|
557
|
-
O(e) {
|
|
558
|
-
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
559
|
-
}
|
|
560
|
-
T(e) {
|
|
561
|
-
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
562
|
-
}
|
|
563
|
-
_(e) {
|
|
564
|
-
this._$AH !== c && P(this._$AH) ? this._$AA.nextSibling.data = e : this.T(w.createTextNode(e)), this._$AH = e;
|
|
565
|
-
}
|
|
566
|
-
$(e) {
|
|
567
|
-
const { values: t, _$litType$: s } = e, i = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = O.createElement(le(s.h, s.h[0]), this.options)), s);
|
|
568
|
-
if (this._$AH?._$AD === i) this._$AH.p(t);
|
|
569
|
-
else {
|
|
570
|
-
const r = new xe(i, this), n = r.u(this.options);
|
|
571
|
-
r.p(t), this.T(n), this._$AH = r;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
_$AC(e) {
|
|
575
|
-
let t = ee.get(e.strings);
|
|
576
|
-
return t === void 0 && ee.set(e.strings, t = new O(e)), t;
|
|
577
|
-
}
|
|
578
|
-
k(e) {
|
|
579
|
-
L(this._$AH) || (this._$AH = [], this._$AR());
|
|
580
|
-
const t = this._$AH;
|
|
581
|
-
let s, i = 0;
|
|
582
|
-
for (const r of e) i === t.length ? t.push(s = new q(this.O(I()), this.O(I()), this, this.options)) : s = t[i], s._$AI(r), i++;
|
|
583
|
-
i < t.length && (this._$AR(s && s._$AB.nextSibling, i), t.length = i);
|
|
584
|
-
}
|
|
585
|
-
_$AR(e = this._$AA.nextSibling, t) {
|
|
586
|
-
for (this._$AP?.(!1, !0, t); e !== this._$AB; ) {
|
|
587
|
-
const s = e.nextSibling;
|
|
588
|
-
e.remove(), e = s;
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
setConnected(e) {
|
|
592
|
-
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
class j {
|
|
596
|
-
get tagName() {
|
|
597
|
-
return this.element.tagName;
|
|
598
|
-
}
|
|
599
|
-
get _$AU() {
|
|
600
|
-
return this._$AM._$AU;
|
|
601
|
-
}
|
|
602
|
-
constructor(e, t, s, i, r) {
|
|
603
|
-
this.type = 1, this._$AH = c, this._$AN = void 0, this.element = e, this.name = t, this._$AM = i, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = c;
|
|
604
|
-
}
|
|
605
|
-
_$AI(e, t = this, s, i) {
|
|
606
|
-
const r = this.strings;
|
|
607
|
-
let n = !1;
|
|
608
|
-
if (r === void 0) e = E(this, e, t, 0), n = !P(e) || e !== this._$AH && e !== U, n && (this._$AH = e);
|
|
609
|
-
else {
|
|
610
|
-
const a = e;
|
|
611
|
-
let l, p;
|
|
612
|
-
for (e = r[0], l = 0; l < r.length - 1; l++) p = E(this, a[s + l], t, l), p === U && (p = this._$AH[l]), n ||= !P(p) || p !== this._$AH[l], p === c ? e = c : e !== c && (e += (p ?? "") + r[l + 1]), this._$AH[l] = p;
|
|
613
|
-
}
|
|
614
|
-
n && !i && this.j(e);
|
|
615
|
-
}
|
|
616
|
-
j(e) {
|
|
617
|
-
e === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
class Ce extends j {
|
|
621
|
-
constructor() {
|
|
622
|
-
super(...arguments), this.type = 3;
|
|
623
|
-
}
|
|
624
|
-
j(e) {
|
|
625
|
-
this.element[this.name] = e === c ? void 0 : e;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
class Pe extends j {
|
|
629
|
-
constructor() {
|
|
630
|
-
super(...arguments), this.type = 4;
|
|
631
|
-
}
|
|
632
|
-
j(e) {
|
|
633
|
-
this.element.toggleAttribute(this.name, !!e && e !== c);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
class Ue extends j {
|
|
637
|
-
constructor(e, t, s, i, r) {
|
|
638
|
-
super(e, t, s, i, r), this.type = 5;
|
|
639
|
-
}
|
|
640
|
-
_$AI(e, t = this) {
|
|
641
|
-
if ((e = E(this, e, t, 0) ?? c) === U) return;
|
|
642
|
-
const s = this._$AH, i = e === c && s !== c || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, r = e !== c && (s === c || i);
|
|
643
|
-
i && this.element.removeEventListener(this.name, this, s), r && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
644
|
-
}
|
|
645
|
-
handleEvent(e) {
|
|
646
|
-
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
class Oe {
|
|
650
|
-
constructor(e, t, s) {
|
|
651
|
-
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
|
|
652
|
-
}
|
|
653
|
-
get _$AU() {
|
|
654
|
-
return this._$AM._$AU;
|
|
655
|
-
}
|
|
656
|
-
_$AI(e) {
|
|
657
|
-
E(this, e);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
const Me = B.litHtmlPolyfillSupport;
|
|
661
|
-
Me?.(O, q), (B.litHtmlVersions ??= []).push("3.3.1");
|
|
662
|
-
/**
|
|
663
|
-
* @license
|
|
664
|
-
* Copyright 2018 Google LLC
|
|
665
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
666
|
-
*/
|
|
667
|
-
const Ne = (o) => o ?? c;
|
|
668
|
-
var He = Object.defineProperty, M = (o, e, t, s) => {
|
|
669
|
-
for (var i = void 0, r = o.length - 1, n; r >= 0; r--)
|
|
670
|
-
(n = o[r]) && (i = n(e, t, i) || i);
|
|
671
|
-
return i && He(e, t, i), i;
|
|
672
|
-
};
|
|
673
|
-
class b extends te {
|
|
9
|
+
class h extends f {
|
|
674
10
|
constructor() {
|
|
675
11
|
super(...arguments), this.disabled = !1, this.selected = !1, this.value = "", this.label = "", this.hidden = !1;
|
|
676
12
|
}
|
|
@@ -682,7 +18,7 @@ class b extends te {
|
|
|
682
18
|
});
|
|
683
19
|
}
|
|
684
20
|
render() {
|
|
685
|
-
return
|
|
21
|
+
return v`
|
|
686
22
|
<option
|
|
687
23
|
?disabled=${this.disabled}
|
|
688
24
|
?selected=${this.selected}
|
|
@@ -695,51 +31,54 @@ class b extends te {
|
|
|
695
31
|
`;
|
|
696
32
|
}
|
|
697
33
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
],
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
],
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
],
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
],
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
],
|
|
713
|
-
customElements.define("nys-option",
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
34
|
+
p([
|
|
35
|
+
o({ type: Boolean, reflect: !0 })
|
|
36
|
+
], h.prototype, "disabled");
|
|
37
|
+
p([
|
|
38
|
+
o({ type: Boolean, reflect: !0 })
|
|
39
|
+
], h.prototype, "selected");
|
|
40
|
+
p([
|
|
41
|
+
o({ type: String })
|
|
42
|
+
], h.prototype, "value");
|
|
43
|
+
p([
|
|
44
|
+
o({ type: String })
|
|
45
|
+
], h.prototype, "label");
|
|
46
|
+
p([
|
|
47
|
+
o({ type: Boolean, reflect: !0 })
|
|
48
|
+
], h.prototype, "hidden");
|
|
49
|
+
customElements.define("nys-option", h);
|
|
50
|
+
const g = ':host{--_nys-select-width: 100%;--_nys-select-font-family: var( --nys-font-family-ui, var( --nys-font-family-sans, "Proxima Nova", "Helvetica Neue", "Helvetica", "Arial", sans-serif ) );--_nys-select-font-size: var(--nys-font-size-ui-md, 16px);--_nys-select-font-weight: var(--nys-font-weight-regular, 400);--_nys-select-line-height: var(--nys-font-lineheight-ui-md, 24px);--_nys-select-gap: var(--nys-space-50, 4px);--_nys-select-border-radius: var(--nys-radius-md, 4px);--_nys-select-padding: var(--nys-space-100, 8px) var(--nys-space-400, 32px) var(--nys-space-100, 8px) var(--nys-space-100, 8px);--_nys-select-color: var(--nys-color-text, #1b1b1b);--_nys-select-color--error: var( --nys-color-danger, var(--nys-color-red-600, #b52c2c) );--_nys-select-background-color: var(--nys-color-ink-reverse, #fff);--_nys-select-background-color--disabled: var( --nys-color-neutral-50, #ededed );--_nys-select-color--disabled: var(--nys-color-text-disabled, #bec0c1);--_nys-select-border-width: var(--nys-border-width-sm, 1px);--_nys-select-border-color: var(--nys-color-neutral-400, #909395);--_nys-select-border-color--hover: var(--nys-color-neutral-900, #1b1b1b);--_nys-select-border-color--focus: var(--nys-color-focus, #004dd1);--_nys-select-border-color--disabled: var(--nys-color-neutral-200, #bec0c1);--_nys-select-border-default: var(--nys-border-width-sm, 1px) solid var(--nys-color-neutral-400, #909395);--_nys-select-border-focus: var(--nys-border-width-sm, 1px) solid var(--nys-color-focus, var(--nys-color-blue-600, #004dd1));--_nys-select-border-disabled: var(--nys-border-width-sm, 1px) solid var(--nys-color-neutral-200, #bec0c1);--_nys-select-border-hover: var(--nys-border-width-sm, 1px) solid var(--nys-color-neutral-900, #1b1b1b)}.nys-select{display:flex;flex-direction:column;gap:var(--_nys-select-gap);font-family:var(--_nys-select-font-family)}.nys-select__select{color:var(--_nys-select-color);font-weight:var(--_nys-select-font-weight);font-family:var(--_nys-select-font-family);border-radius:var(--_nys-select-border-radius);border:solid var(--_nys-select-border-width) var(--_nys-select-border-color);font-size:var(--_nys-select-font-size);padding:var(--_nys-select-padding);width:var(--_nys-select-width);max-width:100%;text-indent:1px;text-overflow:"";background:var(--_nys-select-background-color);-webkit-appearance:none;-moz-appearance:none;appearance:none;text-overflow:ellipsis}.nys-select__selectwrapper{position:relative;display:inline-block;width:var(--_nys-select-width);max-width:100%}.nys-select__icon{color:var(--_nys-select-color);position:absolute;right:10px;top:50%;transform:translateY(-50%);pointer-events:none}:host([width=sm]){--_nys-select-width: var(--nys-select-form-width-sm, 88px)}:host([width=md]){--_nys-select-width: var(--nys-select-form-width-md, 200px)}:host([width=lg]){--_nys-select-width: var(--nys-select-form-width-lg, 384px)}:host([width=full]){--_nys-select-width: 100%;flex:1}.nys-select__select:hover:not(:disabled){cursor:pointer;border-color:var(--_nys-select-border-color--hover);outline:solid var(--_nys-select-border-width) var(--_nys-select-border-color--hover)}.nys-select__select:focus{border-color:var(--_nys-select-border-color--focus);outline:solid var(--_nys-select-border-width) var(--_nys-select-border-color--focus)}.nys-select__select:disabled{background-color:var(--_nys-select-background-color--disabled);border-color:var(--_nys-select-border-color--disabled);cursor:not-allowed;color:var(--_nys-select-color--disabled)}.nys-select__select:disabled~.nys-select__icon{color:var(--_nys-select-color--disabled)}:host([showError]){--_nys-select-border-default: var(--nys-border-width-sm, 1px) solid var(--_nys-select-color--error)}';
|
|
51
|
+
var w = Object.defineProperty, x = Object.getOwnPropertyDescriptor, n = (u, e, t, d) => {
|
|
52
|
+
for (var l = d > 1 ? void 0 : d ? x(e, t) : e, s = u.length - 1, r; s >= 0; s--)
|
|
53
|
+
(r = u[s]) && (l = (d ? r(e, t, l) : r(l)) || l);
|
|
54
|
+
return d && l && w(e, t, l), l;
|
|
718
55
|
};
|
|
719
|
-
let
|
|
720
|
-
var
|
|
721
|
-
const
|
|
56
|
+
let E = 0;
|
|
57
|
+
var c;
|
|
58
|
+
const i = (c = class extends f {
|
|
722
59
|
// allows use of elementInternals' API
|
|
723
60
|
constructor() {
|
|
724
|
-
super(), this.id = "", this.name = "", this.label = "", this.description = "", this.value = "", this.disabled = !1, this.required = !1, this.optional = !1, this._tooltip = "", this.form = null, this.inverted = !1, this.showError = !1, this.errorMessage = "", this._width = "full", this._hasUserInteracted = !1, this._internals = this.attachInternals();
|
|
61
|
+
super(), this.id = "", this.name = "", this.label = "", this.description = "", this.value = "", this.disabled = !1, this.required = !1, this.optional = !1, this._tooltip = "", this.form = null, this.inverted = !1, this.showError = !1, this.errorMessage = "", this._width = "full", this._originalErrorMessage = "", this._hasUserInteracted = !1, this._internals = this.attachInternals();
|
|
725
62
|
}
|
|
726
63
|
get width() {
|
|
727
64
|
return this._width;
|
|
728
65
|
}
|
|
729
66
|
set width(e) {
|
|
730
|
-
this._width =
|
|
67
|
+
this._width = c.VALID_WIDTHS.includes(
|
|
731
68
|
e
|
|
732
69
|
) ? e : "full";
|
|
733
70
|
}
|
|
734
71
|
// Generate a unique ID if one is not provided
|
|
735
72
|
connectedCallback() {
|
|
736
|
-
super.connectedCallback(), this.id || (this.id = `nys-select-${Date.now()}-${
|
|
73
|
+
super.connectedCallback(), this.id || (this.id = `nys-select-${Date.now()}-${E++}`), this._originalErrorMessage = this.errorMessage ?? "", this.addEventListener("invalid", this._handleInvalid);
|
|
737
74
|
}
|
|
738
75
|
disconnectedCallback() {
|
|
739
76
|
super.disconnectedCallback(), this.removeEventListener("invalid", this._handleInvalid);
|
|
740
77
|
}
|
|
741
78
|
firstUpdated() {
|
|
742
|
-
this.
|
|
79
|
+
this.shadowRoot?.querySelector(
|
|
80
|
+
'slot:not([name="description"])'
|
|
81
|
+
) && this._handleSlotChange(), this._setValue();
|
|
743
82
|
}
|
|
744
83
|
// This callback is automatically called when the parent form is reset.
|
|
745
84
|
formResetCallback() {
|
|
@@ -750,33 +89,35 @@ const y = (v = class extends te {
|
|
|
750
89
|
'slot:not([name="description"])'
|
|
751
90
|
), t = this.shadowRoot?.querySelector("select");
|
|
752
91
|
if (!e || !t) return;
|
|
753
|
-
Array.from(t.children).forEach((
|
|
754
|
-
|
|
755
|
-
}), e.assignedElements({ flatten: !0 }).forEach((
|
|
756
|
-
if (
|
|
92
|
+
Array.from(t.children).forEach((s) => {
|
|
93
|
+
s.hasAttribute("data-native") || s.remove();
|
|
94
|
+
}), e.assignedElements({ flatten: !0 }).forEach((s) => {
|
|
95
|
+
if (s instanceof h) {
|
|
757
96
|
const r = document.createElement("option");
|
|
758
|
-
r.value =
|
|
97
|
+
r.value = s.value, r.textContent = s.label || s.textContent?.trim() || "", r.disabled = s.disabled, r.selected = s.selected, t.appendChild(r);
|
|
759
98
|
return;
|
|
760
99
|
}
|
|
761
|
-
if (
|
|
762
|
-
const r =
|
|
763
|
-
|
|
100
|
+
if (s.tagName === "OPTION") {
|
|
101
|
+
const r = s, a = r.cloneNode(!0);
|
|
102
|
+
a.setAttribute("data-native", "true"), a.disabled = r.disabled, a.selected = r.selected, t.appendChild(a);
|
|
764
103
|
return;
|
|
765
104
|
}
|
|
766
|
-
if (
|
|
105
|
+
if (s.tagName === "OPTGROUP") {
|
|
767
106
|
const r = document.createElement("optgroup");
|
|
768
|
-
r.label =
|
|
769
|
-
if (
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
} else if (
|
|
773
|
-
const
|
|
774
|
-
r.appendChild(
|
|
107
|
+
r.label = s.label, s.disabled && (r.disabled = !0), Array.from(s.children).forEach((a) => {
|
|
108
|
+
if (a instanceof h) {
|
|
109
|
+
const y = document.createElement("option");
|
|
110
|
+
y.value = a.value, y.textContent = a.label || a.textContent?.trim() || "", y.disabled = a.disabled, y.selected = a.selected, r.appendChild(y);
|
|
111
|
+
} else if (a.tagName === "OPTION") {
|
|
112
|
+
const y = a.cloneNode(!0);
|
|
113
|
+
r.appendChild(y);
|
|
775
114
|
}
|
|
776
115
|
}), t.appendChild(r);
|
|
777
116
|
return;
|
|
778
117
|
}
|
|
779
118
|
});
|
|
119
|
+
const l = Array.from(t.options).find((s) => s.selected);
|
|
120
|
+
l && (this.value = l.value, this._internals.setFormValue(this.value));
|
|
780
121
|
}
|
|
781
122
|
/********************** Form Integration **********************/
|
|
782
123
|
_setValue() {
|
|
@@ -785,16 +126,15 @@ const y = (v = class extends te {
|
|
|
785
126
|
_manageRequire() {
|
|
786
127
|
const e = this.shadowRoot?.querySelector("select");
|
|
787
128
|
if (!e) return;
|
|
788
|
-
const t = this.errorMessage || "
|
|
129
|
+
const t = this.errorMessage || "This field is required.";
|
|
789
130
|
this.required && !this.value ? (this._internals.ariaRequired = "true", this._internals.setValidity({ valueMissing: !0 }, t, e)) : (this._internals.ariaRequired = "false", this._internals.setValidity({}), this._hasUserInteracted = !1);
|
|
790
131
|
}
|
|
791
132
|
_setValidityMessage(e = "") {
|
|
792
133
|
const t = this.shadowRoot?.querySelector("select");
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
));
|
|
134
|
+
if (!t) return;
|
|
135
|
+
this.showError = !!e, this._originalErrorMessage?.trim() && e !== "" ? this.errorMessage = this._originalErrorMessage : this.errorMessage = e;
|
|
136
|
+
const d = e ? { customError: !0 } : {};
|
|
137
|
+
this._internals.setValidity(d, this.errorMessage, t);
|
|
798
138
|
}
|
|
799
139
|
_validate() {
|
|
800
140
|
const e = this.shadowRoot?.querySelector("select");
|
|
@@ -812,9 +152,9 @@ const y = (v = class extends te {
|
|
|
812
152
|
e.preventDefault(), this._hasUserInteracted = !0, this._validate(), this.showError = !0;
|
|
813
153
|
const t = this.shadowRoot?.querySelector("select");
|
|
814
154
|
if (t) {
|
|
815
|
-
const
|
|
816
|
-
|
|
817
|
-
(
|
|
155
|
+
const d = this._internals.form;
|
|
156
|
+
d ? Array.from(d.elements).find(
|
|
157
|
+
(r) => typeof r.checkValidity == "function" && !r.checkValidity()
|
|
818
158
|
) === this && t.focus() : t.focus();
|
|
819
159
|
}
|
|
820
160
|
}
|
|
@@ -822,7 +162,7 @@ const y = (v = class extends te {
|
|
|
822
162
|
// Handle change event to bubble up selected value
|
|
823
163
|
_handleChange(e) {
|
|
824
164
|
const t = e.target;
|
|
825
|
-
this.value = t.value, this._internals.setFormValue(this.value), this._hasUserInteracted && this._validate(), this.dispatchEvent(
|
|
165
|
+
this.value = t.value, this._internals.setFormValue(this.value), this.required && this.value && (this.showError = !1, this.errorMessage = "", this._internals.setValidity({})), this._hasUserInteracted && this._validate(), this.dispatchEvent(
|
|
826
166
|
new CustomEvent("nys-change", {
|
|
827
167
|
detail: { id: this.id, value: this.value },
|
|
828
168
|
bubbles: !0,
|
|
@@ -846,10 +186,10 @@ const y = (v = class extends te {
|
|
|
846
186
|
}
|
|
847
187
|
}
|
|
848
188
|
render() {
|
|
849
|
-
return
|
|
189
|
+
return v`
|
|
850
190
|
<div class="nys-select">
|
|
851
191
|
<nys-label
|
|
852
|
-
for=${this.id}
|
|
192
|
+
for=${this.id + "--native"}
|
|
853
193
|
label=${this.label}
|
|
854
194
|
description=${this.description}
|
|
855
195
|
flag=${this.required ? "required" : this.optional ? "optional" : ""}
|
|
@@ -862,8 +202,8 @@ const y = (v = class extends te {
|
|
|
862
202
|
<select
|
|
863
203
|
class="nys-select__select"
|
|
864
204
|
name=${this.name}
|
|
865
|
-
id=${this.id}
|
|
866
|
-
form=${
|
|
205
|
+
id=${this.id + "--native"}
|
|
206
|
+
form=${b(this.form || void 0)}
|
|
867
207
|
?disabled=${this.disabled}
|
|
868
208
|
?required=${this.required}
|
|
869
209
|
aria-disabled="${this.disabled}"
|
|
@@ -873,72 +213,69 @@ const y = (v = class extends te {
|
|
|
873
213
|
@blur="${this._handleBlur}"
|
|
874
214
|
@change="${this._handleChange}"
|
|
875
215
|
>
|
|
876
|
-
<option data-native hidden disabled
|
|
216
|
+
<option data-native hidden disabled value=""></option>
|
|
877
217
|
</select>
|
|
878
|
-
<slot
|
|
879
|
-
@slotchange="${this._handleSlotChange}"
|
|
880
|
-
style="display: none;"
|
|
881
|
-
></slot>
|
|
218
|
+
<slot style="display: none;"></slot>
|
|
882
219
|
<nys-icon
|
|
883
|
-
name="
|
|
884
|
-
size="
|
|
220
|
+
name="expand_all"
|
|
221
|
+
size="2xl"
|
|
885
222
|
class="nys-select__icon"
|
|
886
223
|
></nys-icon>
|
|
887
224
|
</div>
|
|
888
225
|
<nys-errormessage
|
|
889
226
|
?showError=${this.showError}
|
|
890
|
-
errorMessage=${this.
|
|
227
|
+
errorMessage=${this.errorMessage}
|
|
891
228
|
></nys-errormessage>
|
|
892
229
|
</div>
|
|
893
230
|
`;
|
|
894
231
|
}
|
|
895
|
-
},
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
],
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
],
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
],
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
],
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
],
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
],
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
],
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
],
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
],
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
],
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
],
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
],
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
],
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
],
|
|
938
|
-
let
|
|
939
|
-
customElements.get("nys-select") || customElements.define("nys-select",
|
|
232
|
+
}, c.styles = _(g), c.VALID_WIDTHS = ["sm", "md", "lg", "full"], c.formAssociated = !0, c);
|
|
233
|
+
n([
|
|
234
|
+
o({ type: String, reflect: !0 })
|
|
235
|
+
], i.prototype, "id", 2);
|
|
236
|
+
n([
|
|
237
|
+
o({ type: String, reflect: !0 })
|
|
238
|
+
], i.prototype, "name", 2);
|
|
239
|
+
n([
|
|
240
|
+
o({ type: String })
|
|
241
|
+
], i.prototype, "label", 2);
|
|
242
|
+
n([
|
|
243
|
+
o({ type: String })
|
|
244
|
+
], i.prototype, "description", 2);
|
|
245
|
+
n([
|
|
246
|
+
o({ type: String })
|
|
247
|
+
], i.prototype, "value", 2);
|
|
248
|
+
n([
|
|
249
|
+
o({ type: Boolean, reflect: !0 })
|
|
250
|
+
], i.prototype, "disabled", 2);
|
|
251
|
+
n([
|
|
252
|
+
o({ type: Boolean, reflect: !0 })
|
|
253
|
+
], i.prototype, "required", 2);
|
|
254
|
+
n([
|
|
255
|
+
o({ type: Boolean, reflect: !0 })
|
|
256
|
+
], i.prototype, "optional", 2);
|
|
257
|
+
n([
|
|
258
|
+
o({ type: String })
|
|
259
|
+
], i.prototype, "_tooltip", 2);
|
|
260
|
+
n([
|
|
261
|
+
o({ type: String, reflect: !0 })
|
|
262
|
+
], i.prototype, "form", 2);
|
|
263
|
+
n([
|
|
264
|
+
o({ type: Boolean, reflect: !0 })
|
|
265
|
+
], i.prototype, "inverted", 2);
|
|
266
|
+
n([
|
|
267
|
+
o({ type: Boolean, reflect: !0 })
|
|
268
|
+
], i.prototype, "showError", 2);
|
|
269
|
+
n([
|
|
270
|
+
o({ type: String })
|
|
271
|
+
], i.prototype, "errorMessage", 2);
|
|
272
|
+
n([
|
|
273
|
+
o({ reflect: !0 })
|
|
274
|
+
], i.prototype, "width", 1);
|
|
275
|
+
let $ = i;
|
|
276
|
+
customElements.get("nys-select") || customElements.define("nys-select", $);
|
|
940
277
|
export {
|
|
941
|
-
|
|
942
|
-
|
|
278
|
+
h as NysOption,
|
|
279
|
+
$ as NysSelect
|
|
943
280
|
};
|
|
944
281
|
//# sourceMappingURL=nys-select.js.map
|