@ucalgary-design-system/dropdown 1.0.2 → 1.0.3

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/index.js +254 -525
  3. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @ucalgary-design-system/dropdown
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - c3fdd31: Updated dependencies and modified build
8
+ - Updated dependencies [386b04a]
9
+ - Updated dependencies [c3fdd31]
10
+ - @ucalgary-design-system/icon@1.0.3
11
+ - @ucalgary-design-system/core@1.0.3
12
+
3
13
  ## 1.0.2
4
14
 
5
15
  ### Patch Changes
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import { unsafeCSS as oe, nothing as L, html as H } from "lit";
2
- import { BaseElement as N } from "@ucalgary-design-system/core";
1
+ import { unsafeCSS as A, nothing as v, html as y } from "lit";
2
+ import { classMap as M } from "lit/directives/class-map.js";
3
+ import { BaseElement as _ } from "@ucalgary-design-system/core";
3
4
  import "@ucalgary-design-system/helper-components";
4
5
  import "@ucalgary-design-system/icon";
5
6
  /**
@@ -7,28 +8,28 @@ import "@ucalgary-design-system/icon";
7
8
  * Copyright 2017 Google LLC
8
9
  * SPDX-License-Identifier: BSD-3-Clause
9
10
  */
10
- const ne = (r) => (e, t) => {
11
+ const I = (s) => (e, t) => {
11
12
  t !== void 0 ? t.addInitializer(() => {
12
- customElements.define(r, e);
13
- }) : customElements.define(r, e);
13
+ customElements.define(s, e);
14
+ }) : customElements.define(s, e);
14
15
  };
15
16
  /**
16
17
  * @license
17
18
  * Copyright 2019 Google LLC
18
19
  * SPDX-License-Identifier: BSD-3-Clause
19
20
  */
20
- const M = globalThis, K = M.ShadowRoot && (M.ShadyCSS === void 0 || M.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, le = Symbol(), F = /* @__PURE__ */ new WeakMap();
21
- let pe = class {
22
- constructor(e, t, s) {
23
- if (this._$cssResult$ = !0, s !== le) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
21
+ const w = globalThis, x = w.ShadowRoot && (w.ShadyCSS === void 0 || w.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, L = Symbol(), C = /* @__PURE__ */ new WeakMap();
22
+ let D = class {
23
+ constructor(e, t, i) {
24
+ if (this._$cssResult$ = !0, i !== L) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
24
25
  this.cssText = e, this.t = t;
25
26
  }
26
27
  get styleSheet() {
27
28
  let e = this.o;
28
29
  const t = this.t;
29
- if (K && e === void 0) {
30
- const s = t !== void 0 && t.length === 1;
31
- s && (e = F.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), s && F.set(t, e));
30
+ if (x && e === void 0) {
31
+ const i = t !== void 0 && t.length === 1;
32
+ i && (e = C.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && C.set(t, e));
32
33
  }
33
34
  return e;
34
35
  }
@@ -36,115 +37,113 @@ let pe = class {
36
37
  return this.cssText;
37
38
  }
38
39
  };
39
- const fe = (r) => new pe(typeof r == "string" ? r : r + "", void 0, le), me = (r, e) => {
40
- if (K) r.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
40
+ const R = (s) => new D(typeof s == "string" ? s : s + "", void 0, L), z = (s, e) => {
41
+ if (x) s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
41
42
  else for (const t of e) {
42
- const s = document.createElement("style"), i = M.litNonce;
43
- i !== void 0 && s.setAttribute("nonce", i), s.textContent = t.cssText, r.appendChild(s);
43
+ const i = document.createElement("style"), o = w.litNonce;
44
+ o !== void 0 && i.setAttribute("nonce", o), i.textContent = t.cssText, s.appendChild(i);
44
45
  }
45
- }, X = K ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((e) => {
46
+ }, O = x ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => {
46
47
  let t = "";
47
- for (const s of e.cssRules) t += s.cssText;
48
- return fe(t);
49
- })(r) : r;
48
+ for (const i of e.cssRules) t += i.cssText;
49
+ return R(t);
50
+ })(s) : s;
50
51
  /**
51
52
  * @license
52
53
  * Copyright 2017 Google LLC
53
54
  * SPDX-License-Identifier: BSD-3-Clause
54
55
  */
55
- const { is: $e, defineProperty: _e, getOwnPropertyDescriptor: ve, getOwnPropertyNames: ge, getOwnPropertySymbols: be, getPrototypeOf: ye } = Object, g = globalThis, G = g.trustedTypes, we = G ? G.emptyScript : "", B = g.reactiveElementPolyfillSupport, C = (r, e) => r, T = { toAttribute(r, e) {
56
+ const { is: j, defineProperty: q, getOwnPropertyDescriptor: T, getOwnPropertyNames: B, getOwnPropertySymbols: H, getPrototypeOf: V } = Object, u = globalThis, k = u.trustedTypes, K = k ? k.emptyScript : "", $ = u.reactiveElementPolyfillSupport, f = (s, e) => s, g = { toAttribute(s, e) {
56
57
  switch (e) {
57
58
  case Boolean:
58
- r = r ? we : null;
59
+ s = s ? K : null;
59
60
  break;
60
61
  case Object:
61
62
  case Array:
62
- r = r == null ? r : JSON.stringify(r);
63
+ s = s == null ? s : JSON.stringify(s);
63
64
  }
64
- return r;
65
- }, fromAttribute(r, e) {
66
- let t = r;
65
+ return s;
66
+ }, fromAttribute(s, e) {
67
+ let t = s;
67
68
  switch (e) {
68
69
  case Boolean:
69
- t = r !== null;
70
+ t = s !== null;
70
71
  break;
71
72
  case Number:
72
- t = r === null ? null : Number(r);
73
+ t = s === null ? null : Number(s);
73
74
  break;
74
75
  case Object:
75
76
  case Array:
76
77
  try {
77
- t = JSON.parse(r);
78
+ t = JSON.parse(s);
78
79
  } catch {
79
80
  t = null;
80
81
  }
81
82
  }
82
83
  return t;
83
- } }, W = (r, e) => !$e(r, e), Q = { attribute: !0, type: String, converter: T, reflect: !1, hasChanged: W };
84
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), g.litPropertyMetadata ?? (g.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
85
- class S extends HTMLElement {
84
+ } }, E = (s, e) => !j(s, e), P = { attribute: !0, type: String, converter: g, reflect: !1, useDefault: !1, hasChanged: E };
85
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), u.litPropertyMetadata ?? (u.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
86
+ class p extends HTMLElement {
86
87
  static addInitializer(e) {
87
88
  this._$Ei(), (this.l ?? (this.l = [])).push(e);
88
89
  }
89
90
  static get observedAttributes() {
90
91
  return this.finalize(), this._$Eh && [...this._$Eh.keys()];
91
92
  }
92
- static createProperty(e, t = Q) {
93
- if (t.state && (t.attribute = !1), this._$Ei(), this.elementProperties.set(e, t), !t.noAccessor) {
94
- const s = Symbol(), i = this.getPropertyDescriptor(e, s, t);
95
- i !== void 0 && _e(this.prototype, e, i);
93
+ static createProperty(e, t = P) {
94
+ 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) {
95
+ const i = Symbol(), o = this.getPropertyDescriptor(e, i, t);
96
+ o !== void 0 && q(this.prototype, e, o);
96
97
  }
97
98
  }
98
- static getPropertyDescriptor(e, t, s) {
99
- const { get: i, set: o } = ve(this.prototype, e) ?? { get() {
99
+ static getPropertyDescriptor(e, t, i) {
100
+ const { get: o, set: r } = T(this.prototype, e) ?? { get() {
100
101
  return this[t];
101
102
  }, set(n) {
102
103
  this[t] = n;
103
104
  } };
104
- return { get() {
105
- return i == null ? void 0 : i.call(this);
106
- }, set(n) {
107
- const a = i == null ? void 0 : i.call(this);
108
- o.call(this, n), this.requestUpdate(e, a, s);
105
+ return { get: o, set(n) {
106
+ const a = o == null ? void 0 : o.call(this);
107
+ r == null || r.call(this, n), this.requestUpdate(e, a, i);
109
108
  }, configurable: !0, enumerable: !0 };
110
109
  }
111
110
  static getPropertyOptions(e) {
112
- return this.elementProperties.get(e) ?? Q;
111
+ return this.elementProperties.get(e) ?? P;
113
112
  }
114
113
  static _$Ei() {
115
- if (this.hasOwnProperty(C("elementProperties"))) return;
116
- const e = ye(this);
114
+ if (this.hasOwnProperty(f("elementProperties"))) return;
115
+ const e = V(this);
117
116
  e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
118
117
  }
119
118
  static finalize() {
120
- if (this.hasOwnProperty(C("finalized"))) return;
121
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
122
- const t = this.properties, s = [...ge(t), ...be(t)];
123
- for (const i of s) this.createProperty(i, t[i]);
119
+ if (this.hasOwnProperty(f("finalized"))) return;
120
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(f("properties"))) {
121
+ const t = this.properties, i = [...B(t), ...H(t)];
122
+ for (const o of i) this.createProperty(o, t[o]);
124
123
  }
125
124
  const e = this[Symbol.metadata];
126
125
  if (e !== null) {
127
126
  const t = litPropertyMetadata.get(e);
128
- if (t !== void 0) for (const [s, i] of t) this.elementProperties.set(s, i);
127
+ if (t !== void 0) for (const [i, o] of t) this.elementProperties.set(i, o);
129
128
  }
130
129
  this._$Eh = /* @__PURE__ */ new Map();
131
- for (const [t, s] of this.elementProperties) {
132
- const i = this._$Eu(t, s);
133
- i !== void 0 && this._$Eh.set(i, t);
130
+ for (const [t, i] of this.elementProperties) {
131
+ const o = this._$Eu(t, i);
132
+ o !== void 0 && this._$Eh.set(o, t);
134
133
  }
135
134
  this.elementStyles = this.finalizeStyles(this.styles);
136
135
  }
137
136
  static finalizeStyles(e) {
138
137
  const t = [];
139
138
  if (Array.isArray(e)) {
140
- const s = new Set(e.flat(1 / 0).reverse());
141
- for (const i of s) t.unshift(X(i));
142
- } else e !== void 0 && t.push(X(e));
139
+ const i = new Set(e.flat(1 / 0).reverse());
140
+ for (const o of i) t.unshift(O(o));
141
+ } else e !== void 0 && t.push(O(e));
143
142
  return t;
144
143
  }
145
144
  static _$Eu(e, t) {
146
- const s = t.attribute;
147
- return s === !1 ? void 0 : typeof s == "string" ? s : typeof e == "string" ? e.toLowerCase() : void 0;
145
+ const i = t.attribute;
146
+ return i === !1 ? void 0 : typeof i == "string" ? i : typeof e == "string" ? e.toLowerCase() : void 0;
148
147
  }
149
148
  constructor() {
150
149
  super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
@@ -163,18 +162,18 @@ class S extends HTMLElement {
163
162
  }
164
163
  _$E_() {
165
164
  const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
166
- for (const s of t.keys()) this.hasOwnProperty(s) && (e.set(s, this[s]), delete this[s]);
165
+ for (const i of t.keys()) this.hasOwnProperty(i) && (e.set(i, this[i]), delete this[i]);
167
166
  e.size > 0 && (this._$Ep = e);
168
167
  }
169
168
  createRenderRoot() {
170
169
  const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
171
- return me(e, this.constructor.elementStyles), e;
170
+ return z(e, this.constructor.elementStyles), e;
172
171
  }
173
172
  connectedCallback() {
174
173
  var e;
175
174
  this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((t) => {
176
- var s;
177
- return (s = t.hostConnected) == null ? void 0 : s.call(t);
175
+ var i;
176
+ return (i = t.hostConnected) == null ? void 0 : i.call(t);
178
177
  });
179
178
  }
180
179
  enableUpdating(e) {
@@ -182,40 +181,44 @@ class S extends HTMLElement {
182
181
  disconnectedCallback() {
183
182
  var e;
184
183
  (e = this._$EO) == null || e.forEach((t) => {
185
- var s;
186
- return (s = t.hostDisconnected) == null ? void 0 : s.call(t);
184
+ var i;
185
+ return (i = t.hostDisconnected) == null ? void 0 : i.call(t);
187
186
  });
188
187
  }
189
- attributeChangedCallback(e, t, s) {
190
- this._$AK(e, s);
188
+ attributeChangedCallback(e, t, i) {
189
+ this._$AK(e, i);
191
190
  }
192
- _$EC(e, t) {
193
- var o;
194
- const s = this.constructor.elementProperties.get(e), i = this.constructor._$Eu(e, s);
195
- if (i !== void 0 && s.reflect === !0) {
196
- const n = (((o = s.converter) == null ? void 0 : o.toAttribute) !== void 0 ? s.converter : T).toAttribute(t, s.type);
197
- this._$Em = e, n == null ? this.removeAttribute(i) : this.setAttribute(i, n), this._$Em = null;
191
+ _$ET(e, t) {
192
+ var r;
193
+ const i = this.constructor.elementProperties.get(e), o = this.constructor._$Eu(e, i);
194
+ if (o !== void 0 && i.reflect === !0) {
195
+ const n = (((r = i.converter) == null ? void 0 : r.toAttribute) !== void 0 ? i.converter : g).toAttribute(t, i.type);
196
+ this._$Em = e, n == null ? this.removeAttribute(o) : this.setAttribute(o, n), this._$Em = null;
198
197
  }
199
198
  }
200
199
  _$AK(e, t) {
201
- var o;
202
- const s = this.constructor, i = s._$Eh.get(e);
203
- if (i !== void 0 && this._$Em !== i) {
204
- const n = s.getPropertyOptions(i), a = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((o = n.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? n.converter : T;
205
- this._$Em = i, this[i] = a.fromAttribute(t, n.type), this._$Em = null;
200
+ var r, n;
201
+ const i = this.constructor, o = i._$Eh.get(e);
202
+ if (o !== void 0 && this._$Em !== o) {
203
+ const a = i.getPropertyOptions(o), d = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((r = a.converter) == null ? void 0 : r.fromAttribute) !== void 0 ? a.converter : g;
204
+ this._$Em = o;
205
+ const b = d.fromAttribute(t, a.type);
206
+ this[o] = b ?? ((n = this._$Ej) == null ? void 0 : n.get(o)) ?? b, this._$Em = null;
206
207
  }
207
208
  }
208
- requestUpdate(e, t, s) {
209
+ requestUpdate(e, t, i) {
210
+ var o;
209
211
  if (e !== void 0) {
210
- if (s ?? (s = this.constructor.getPropertyOptions(e)), !(s.hasChanged ?? W)(this[e], t)) return;
211
- this.P(e, t, s);
212
+ const r = this.constructor, n = this[e];
213
+ if (i ?? (i = r.getPropertyOptions(e)), !((i.hasChanged ?? E)(n, t) || i.useDefault && i.reflect && n === ((o = this._$Ej) == null ? void 0 : o.get(e)) && !this.hasAttribute(r._$Eu(e, i)))) return;
214
+ this.C(e, t, i);
212
215
  }
213
- this.isUpdatePending === !1 && (this._$ES = this._$ET());
216
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
214
217
  }
215
- P(e, t, s) {
216
- this._$AL.has(e) || this._$AL.set(e, t), s.reflect === !0 && this._$Em !== e && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(e);
218
+ C(e, t, { useDefault: i, reflect: o, wrapped: r }, n) {
219
+ i && !(this._$Ej ?? (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 || i || (t = void 0), this._$AL.set(e, t)), o === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
217
220
  }
218
- async _$ET() {
221
+ async _$EP() {
219
222
  this.isUpdatePending = !0;
220
223
  try {
221
224
  await this._$ES;
@@ -229,25 +232,28 @@ class S extends HTMLElement {
229
232
  return this.performUpdate();
230
233
  }
231
234
  performUpdate() {
232
- var s;
235
+ var i;
233
236
  if (!this.isUpdatePending) return;
234
237
  if (!this.hasUpdated) {
235
238
  if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
236
- for (const [o, n] of this._$Ep) this[o] = n;
239
+ for (const [r, n] of this._$Ep) this[r] = n;
237
240
  this._$Ep = void 0;
238
241
  }
239
- const i = this.constructor.elementProperties;
240
- if (i.size > 0) for (const [o, n] of i) n.wrapped !== !0 || this._$AL.has(o) || this[o] === void 0 || this.P(o, this[o], n);
242
+ const o = this.constructor.elementProperties;
243
+ if (o.size > 0) for (const [r, n] of o) {
244
+ const { wrapped: a } = n, d = this[r];
245
+ a !== !0 || this._$AL.has(r) || d === void 0 || this.C(r, void 0, n, d);
246
+ }
241
247
  }
242
248
  let e = !1;
243
249
  const t = this._$AL;
244
250
  try {
245
- e = this.shouldUpdate(t), e ? (this.willUpdate(t), (s = this._$EO) == null || s.forEach((i) => {
246
- var o;
247
- return (o = i.hostUpdate) == null ? void 0 : o.call(i);
248
- }), this.update(t)) : this._$EU();
249
- } catch (i) {
250
- throw e = !1, this._$EU(), i;
251
+ e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((o) => {
252
+ var r;
253
+ return (r = o.hostUpdate) == null ? void 0 : r.call(o);
254
+ }), this.update(t)) : this._$EM();
255
+ } catch (o) {
256
+ throw e = !1, this._$EM(), o;
251
257
  }
252
258
  e && this._$AE(t);
253
259
  }
@@ -255,12 +261,12 @@ class S extends HTMLElement {
255
261
  }
256
262
  _$AE(e) {
257
263
  var t;
258
- (t = this._$EO) == null || t.forEach((s) => {
259
- var i;
260
- return (i = s.hostUpdated) == null ? void 0 : i.call(s);
264
+ (t = this._$EO) == null || t.forEach((i) => {
265
+ var o;
266
+ return (o = i.hostUpdated) == null ? void 0 : o.call(i);
261
267
  }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
262
268
  }
263
- _$EU() {
269
+ _$EM() {
264
270
  this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
265
271
  }
266
272
  get updateComplete() {
@@ -273,359 +279,82 @@ class S extends HTMLElement {
273
279
  return !0;
274
280
  }
275
281
  update(e) {
276
- this._$Ej && (this._$Ej = this._$Ej.forEach((t) => this._$EC(t, this[t]))), this._$EU();
282
+ this._$Eq && (this._$Eq = this._$Eq.forEach((t) => this._$ET(t, this[t]))), this._$EM();
277
283
  }
278
284
  updated(e) {
279
285
  }
280
286
  firstUpdated(e) {
281
287
  }
282
288
  }
283
- S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[C("elementProperties")] = /* @__PURE__ */ new Map(), S[C("finalized")] = /* @__PURE__ */ new Map(), B == null || B({ ReactiveElement: S }), (g.reactiveElementVersions ?? (g.reactiveElementVersions = [])).push("2.0.4");
289
+ p.elementStyles = [], p.shadowRootOptions = { mode: "open" }, p[f("elementProperties")] = /* @__PURE__ */ new Map(), p[f("finalized")] = /* @__PURE__ */ new Map(), $ == null || $({ ReactiveElement: p }), (u.reactiveElementVersions ?? (u.reactiveElementVersions = [])).push("2.1.1");
284
290
  /**
285
291
  * @license
286
292
  * Copyright 2017 Google LLC
287
293
  * SPDX-License-Identifier: BSD-3-Clause
288
294
  */
289
- const Ae = { attribute: !0, type: String, converter: T, reflect: !1, hasChanged: W }, xe = (r = Ae, e, t) => {
290
- const { kind: s, metadata: i } = t;
291
- let o = globalThis.litPropertyMetadata.get(i);
292
- if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), o.set(t.name, r), s === "accessor") {
295
+ const N = { attribute: !0, type: String, converter: g, reflect: !1, hasChanged: E }, J = (s = N, e, t) => {
296
+ const { kind: i, metadata: o } = t;
297
+ let r = globalThis.litPropertyMetadata.get(o);
298
+ if (r === void 0 && globalThis.litPropertyMetadata.set(o, r = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), r.set(t.name, s), i === "accessor") {
293
299
  const { name: n } = t;
294
300
  return { set(a) {
295
- const l = e.get.call(this);
296
- e.set.call(this, a), this.requestUpdate(n, l, r);
301
+ const d = e.get.call(this);
302
+ e.set.call(this, a), this.requestUpdate(n, d, s);
297
303
  }, init(a) {
298
- return a !== void 0 && this.P(n, void 0, r), a;
304
+ return a !== void 0 && this.C(n, void 0, s, a), a;
299
305
  } };
300
306
  }
301
- if (s === "setter") {
307
+ if (i === "setter") {
302
308
  const { name: n } = t;
303
309
  return function(a) {
304
- const l = this[n];
305
- e.call(this, a), this.requestUpdate(n, l, r);
310
+ const d = this[n];
311
+ e.call(this, a), this.requestUpdate(n, d, s);
306
312
  };
307
313
  }
308
- throw Error("Unsupported decorator location: " + s);
314
+ throw Error("Unsupported decorator location: " + i);
309
315
  };
310
- function m(r) {
311
- return (e, t) => typeof t == "object" ? xe(r, e, t) : ((s, i, o) => {
312
- const n = i.hasOwnProperty(o);
313
- return i.constructor.createProperty(o, n ? { ...s, wrapped: !0 } : s), n ? Object.getOwnPropertyDescriptor(i, o) : void 0;
314
- })(r, e, t);
316
+ function h(s) {
317
+ return (e, t) => typeof t == "object" ? J(s, e, t) : ((i, o, r) => {
318
+ const n = o.hasOwnProperty(r);
319
+ return o.constructor.createProperty(r, i), n ? Object.getOwnPropertyDescriptor(o, r) : void 0;
320
+ })(s, e, t);
315
321
  }
316
322
  /**
317
323
  * @license
318
324
  * Copyright 2017 Google LLC
319
325
  * SPDX-License-Identifier: BSD-3-Clause
320
326
  */
321
- function ae(r) {
322
- return m({ ...r, state: !0, attribute: !1 });
327
+ function U(s) {
328
+ return h({ ...s, state: !0, attribute: !1 });
323
329
  }
324
330
  /**
325
331
  * @license
326
332
  * Copyright 2017 Google LLC
327
333
  * SPDX-License-Identifier: BSD-3-Clause
328
334
  */
329
- const Se = (r, e, t) => (t.configurable = !0, t.enumerable = !0, Reflect.decorate && typeof e != "object" && Object.defineProperty(r, e, t), t);
335
+ const W = (s, e, t) => (t.configurable = !0, t.enumerable = !0, Reflect.decorate && typeof e != "object" && Object.defineProperty(s, e, t), t);
330
336
  /**
331
337
  * @license
332
338
  * Copyright 2021 Google LLC
333
339
  * SPDX-License-Identifier: BSD-3-Clause
334
340
  */
335
- function Ee(r) {
341
+ function X(s) {
336
342
  return (e, t) => {
337
- const { slot: s, selector: i } = r ?? {}, o = "slot" + (s ? `[name=${s}]` : ":not([name])");
338
- return Se(e, t, { get() {
339
- var l;
340
- const n = (l = this.renderRoot) == null ? void 0 : l.querySelector(o), a = (n == null ? void 0 : n.assignedElements(r)) ?? [];
341
- return i === void 0 ? a : a.filter((h) => h.matches(i));
343
+ const { slot: i, selector: o } = s ?? {}, r = "slot" + (i ? `[name=${i}]` : ":not([name])");
344
+ return W(e, t, { get() {
345
+ var d;
346
+ const n = (d = this.renderRoot) == null ? void 0 : d.querySelector(r), a = (n == null ? void 0 : n.assignedElements(s)) ?? [];
347
+ return o === void 0 ? a : a.filter((b) => b.matches(o));
342
348
  } });
343
349
  };
344
350
  }
345
- /**
346
- * @license
347
- * Copyright 2017 Google LLC
348
- * SPDX-License-Identifier: BSD-3-Clause
349
- */
350
- const O = globalThis, R = O.trustedTypes, Y = R ? R.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, de = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, he = "?" + v, Ce = `<${he}>`, w = document, D = () => w.createComment(""), P = (r) => r === null || typeof r != "object" && typeof r != "function", J = Array.isArray, Oe = (r) => J(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", q = `[
351
- \f\r]`, E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ee = /-->/g, te = />/g, b = RegExp(`>|${q}(?:([^\\s"'>=/]+)(${q}*=${q}*(?:[^
352
- \f\r"'\`<>=]|("|')|))|$)`, "g"), se = /'/g, ie = /"/g, ce = /^(?:script|style|textarea|title)$/i, A = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), re = /* @__PURE__ */ new WeakMap(), y = w.createTreeWalker(w, 129);
353
- function ue(r, e) {
354
- if (!J(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
355
- return Y !== void 0 ? Y.createHTML(e) : e;
356
- }
357
- const Pe = (r, e) => {
358
- const t = r.length - 1, s = [];
359
- let i, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = E;
360
- for (let a = 0; a < t; a++) {
361
- const l = r[a];
362
- let h, u, d = -1, $ = 0;
363
- for (; $ < l.length && (n.lastIndex = $, u = n.exec(l), u !== null); ) $ = n.lastIndex, n === E ? u[1] === "!--" ? n = ee : u[1] !== void 0 ? n = te : u[2] !== void 0 ? (ce.test(u[2]) && (i = RegExp("</" + u[2], "g")), n = b) : u[3] !== void 0 && (n = b) : n === b ? u[0] === ">" ? (n = i ?? E, d = -1) : u[1] === void 0 ? d = -2 : (d = n.lastIndex - u[2].length, h = u[1], n = u[3] === void 0 ? b : u[3] === '"' ? ie : se) : n === ie || n === se ? n = b : n === ee || n === te ? n = E : (n = b, i = void 0);
364
- const _ = n === b && r[a + 1].startsWith("/>") ? " " : "";
365
- o += n === E ? l + Ce : d >= 0 ? (s.push(h), l.slice(0, d) + de + l.slice(d) + v + _) : l + v + (d === -2 ? a : _);
366
- }
367
- return [ue(r, o + (r[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
368
- };
369
- class k {
370
- constructor({ strings: e, _$litType$: t }, s) {
371
- let i;
372
- this.parts = [];
373
- let o = 0, n = 0;
374
- const a = e.length - 1, l = this.parts, [h, u] = Pe(e, t);
375
- if (this.el = k.createElement(h, s), y.currentNode = this.el.content, t === 2 || t === 3) {
376
- const d = this.el.content.firstChild;
377
- d.replaceWith(...d.childNodes);
378
- }
379
- for (; (i = y.nextNode()) !== null && l.length < a; ) {
380
- if (i.nodeType === 1) {
381
- if (i.hasAttributes()) for (const d of i.getAttributeNames()) if (d.endsWith(de)) {
382
- const $ = u[n++], _ = i.getAttribute(d).split(v), U = /([.?@])?(.*)/.exec($);
383
- l.push({ type: 1, index: o, name: U[2], strings: _, ctor: U[1] === "." ? Ie : U[1] === "?" ? Ue : U[1] === "@" ? Le : z }), i.removeAttribute(d);
384
- } else d.startsWith(v) && (l.push({ type: 6, index: o }), i.removeAttribute(d));
385
- if (ce.test(i.tagName)) {
386
- const d = i.textContent.split(v), $ = d.length - 1;
387
- if ($ > 0) {
388
- i.textContent = R ? R.emptyScript : "";
389
- for (let _ = 0; _ < $; _++) i.append(d[_], D()), y.nextNode(), l.push({ type: 2, index: ++o });
390
- i.append(d[$], D());
391
- }
392
- }
393
- } else if (i.nodeType === 8) if (i.data === he) l.push({ type: 2, index: o });
394
- else {
395
- let d = -1;
396
- for (; (d = i.data.indexOf(v, d + 1)) !== -1; ) l.push({ type: 7, index: o }), d += v.length - 1;
397
- }
398
- o++;
399
- }
400
- }
401
- static createElement(e, t) {
402
- const s = w.createElement("template");
403
- return s.innerHTML = e, s;
404
- }
405
- }
406
- function x(r, e, t = r, s) {
407
- var n, a;
408
- if (e === A) return e;
409
- let i = s !== void 0 ? (n = t._$Co) == null ? void 0 : n[s] : t._$Cl;
410
- const o = P(e) ? void 0 : e._$litDirective$;
411
- return (i == null ? void 0 : i.constructor) !== o && ((a = i == null ? void 0 : i._$AO) == null || a.call(i, !1), o === void 0 ? i = void 0 : (i = new o(r), i._$AT(r, t, s)), s !== void 0 ? (t._$Co ?? (t._$Co = []))[s] = i : t._$Cl = i), i !== void 0 && (e = x(r, i._$AS(r, e.values), i, s)), e;
412
- }
413
- class ke {
414
- constructor(e, t) {
415
- this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
416
- }
417
- get parentNode() {
418
- return this._$AM.parentNode;
419
- }
420
- get _$AU() {
421
- return this._$AM._$AU;
422
- }
423
- u(e) {
424
- const { el: { content: t }, parts: s } = this._$AD, i = ((e == null ? void 0 : e.creationScope) ?? w).importNode(t, !0);
425
- y.currentNode = i;
426
- let o = y.nextNode(), n = 0, a = 0, l = s[0];
427
- for (; l !== void 0; ) {
428
- if (n === l.index) {
429
- let h;
430
- l.type === 2 ? h = new j(o, o.nextSibling, this, e) : l.type === 1 ? h = new l.ctor(o, l.name, l.strings, this, e) : l.type === 6 && (h = new He(o, this, e)), this._$AV.push(h), l = s[++a];
431
- }
432
- n !== (l == null ? void 0 : l.index) && (o = y.nextNode(), n++);
433
- }
434
- return y.currentNode = w, i;
435
- }
436
- p(e) {
437
- let t = 0;
438
- 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++;
439
- }
440
- }
441
- class j {
442
- get _$AU() {
443
- var e;
444
- return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
445
- }
446
- constructor(e, t, s, i) {
447
- 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 == null ? void 0 : i.isConnected) ?? !0;
448
- }
449
- get parentNode() {
450
- let e = this._$AA.parentNode;
451
- const t = this._$AM;
452
- return t !== void 0 && (e == null ? void 0 : e.nodeType) === 11 && (e = t.parentNode), e;
453
- }
454
- get startNode() {
455
- return this._$AA;
456
- }
457
- get endNode() {
458
- return this._$AB;
459
- }
460
- _$AI(e, t = this) {
461
- e = x(this, e, t), P(e) ? e === c || e == null || e === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : e !== this._$AH && e !== A && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Oe(e) ? this.k(e) : this._(e);
462
- }
463
- O(e) {
464
- return this._$AA.parentNode.insertBefore(e, this._$AB);
465
- }
466
- T(e) {
467
- this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
468
- }
469
- _(e) {
470
- this._$AH !== c && P(this._$AH) ? this._$AA.nextSibling.data = e : this.T(w.createTextNode(e)), this._$AH = e;
471
- }
472
- $(e) {
473
- var o;
474
- const { values: t, _$litType$: s } = e, i = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = k.createElement(ue(s.h, s.h[0]), this.options)), s);
475
- if (((o = this._$AH) == null ? void 0 : o._$AD) === i) this._$AH.p(t);
476
- else {
477
- const n = new ke(i, this), a = n.u(this.options);
478
- n.p(t), this.T(a), this._$AH = n;
479
- }
480
- }
481
- _$AC(e) {
482
- let t = re.get(e.strings);
483
- return t === void 0 && re.set(e.strings, t = new k(e)), t;
484
- }
485
- k(e) {
486
- J(this._$AH) || (this._$AH = [], this._$AR());
487
- const t = this._$AH;
488
- let s, i = 0;
489
- for (const o of e) i === t.length ? t.push(s = new j(this.O(D()), this.O(D()), this, this.options)) : s = t[i], s._$AI(o), i++;
490
- i < t.length && (this._$AR(s && s._$AB.nextSibling, i), t.length = i);
491
- }
492
- _$AR(e = this._$AA.nextSibling, t) {
493
- var s;
494
- for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, t); e && e !== this._$AB; ) {
495
- const i = e.nextSibling;
496
- e.remove(), e = i;
497
- }
498
- }
499
- setConnected(e) {
500
- var t;
501
- this._$AM === void 0 && (this._$Cv = e, (t = this._$AP) == null || t.call(this, e));
502
- }
503
- }
504
- class z {
505
- get tagName() {
506
- return this.element.tagName;
507
- }
508
- get _$AU() {
509
- return this._$AM._$AU;
510
- }
511
- constructor(e, t, s, i, o) {
512
- this.type = 1, this._$AH = c, this._$AN = void 0, this.element = e, this.name = t, this._$AM = i, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = c;
513
- }
514
- _$AI(e, t = this, s, i) {
515
- const o = this.strings;
516
- let n = !1;
517
- if (o === void 0) e = x(this, e, t, 0), n = !P(e) || e !== this._$AH && e !== A, n && (this._$AH = e);
518
- else {
519
- const a = e;
520
- let l, h;
521
- for (e = o[0], l = 0; l < o.length - 1; l++) h = x(this, a[s + l], t, l), h === A && (h = this._$AH[l]), n || (n = !P(h) || h !== this._$AH[l]), h === c ? e = c : e !== c && (e += (h ?? "") + o[l + 1]), this._$AH[l] = h;
522
- }
523
- n && !i && this.j(e);
524
- }
525
- j(e) {
526
- e === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
527
- }
528
- }
529
- class Ie extends z {
530
- constructor() {
531
- super(...arguments), this.type = 3;
532
- }
533
- j(e) {
534
- this.element[this.name] = e === c ? void 0 : e;
535
- }
536
- }
537
- class Ue extends z {
538
- constructor() {
539
- super(...arguments), this.type = 4;
540
- }
541
- j(e) {
542
- this.element.toggleAttribute(this.name, !!e && e !== c);
543
- }
544
- }
545
- class Le extends z {
546
- constructor(e, t, s, i, o) {
547
- super(e, t, s, i, o), this.type = 5;
548
- }
549
- _$AI(e, t = this) {
550
- if ((e = x(this, e, t, 0) ?? c) === A) return;
551
- const s = this._$AH, i = e === c && s !== c || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, o = e !== c && (s === c || i);
552
- i && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
553
- }
554
- handleEvent(e) {
555
- var t;
556
- typeof this._$AH == "function" ? this._$AH.call(((t = this.options) == null ? void 0 : t.host) ?? this.element, e) : this._$AH.handleEvent(e);
557
- }
558
- }
559
- class He {
560
- constructor(e, t, s) {
561
- this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
562
- }
563
- get _$AU() {
564
- return this._$AM._$AU;
565
- }
566
- _$AI(e) {
567
- x(this, e);
568
- }
569
- }
570
- const V = O.litHtmlPolyfillSupport;
571
- V == null || V(k, j), (O.litHtmlVersions ?? (O.litHtmlVersions = [])).push("3.2.1");
572
- /**
573
- * @license
574
- * Copyright 2017 Google LLC
575
- * SPDX-License-Identifier: BSD-3-Clause
576
- */
577
- const Me = { ATTRIBUTE: 1 }, Te = (r) => (...e) => ({ _$litDirective$: r, values: e });
578
- class Re {
579
- constructor(e) {
580
- }
581
- get _$AU() {
582
- return this._$AM._$AU;
583
- }
584
- _$AT(e, t, s) {
585
- this._$Ct = e, this._$AM = t, this._$Ci = s;
586
- }
587
- _$AS(e, t) {
588
- return this.update(e, t);
589
- }
590
- update(e, t) {
591
- return this.render(...t);
592
- }
593
- }
594
- /**
595
- * @license
596
- * Copyright 2018 Google LLC
597
- * SPDX-License-Identifier: BSD-3-Clause
598
- */
599
- const De = Te(class extends Re {
600
- constructor(r) {
601
- var e;
602
- if (super(r), r.type !== Me.ATTRIBUTE || r.name !== "class" || ((e = r.strings) == null ? void 0 : e.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
603
- }
604
- render(r) {
605
- return " " + Object.keys(r).filter((e) => r[e]).join(" ") + " ";
606
- }
607
- update(r, [e]) {
608
- var s, i;
609
- if (this.st === void 0) {
610
- this.st = /* @__PURE__ */ new Set(), r.strings !== void 0 && (this.nt = new Set(r.strings.join(" ").split(/\s/).filter((o) => o !== "")));
611
- for (const o in e) e[o] && !((s = this.nt) != null && s.has(o)) && this.st.add(o);
612
- return this.render(e);
613
- }
614
- const t = r.element.classList;
615
- for (const o of this.st) o in e || (t.remove(o), this.st.delete(o));
616
- for (const o in e) {
617
- const n = !!e[o];
618
- n === this.st.has(o) || (i = this.nt) != null && i.has(o) || (n ? (t.add(o), this.st.add(o)) : (t.remove(o), this.st.delete(o)));
619
- }
620
- return A;
621
- }
622
- }), Ne = ':host{position:relative;display:block}.dropdown-wrapper{display:flex;flex-direction:column;gap:8px;align-items:start}.dropdown,.menu,.toggle,.dropdown-wrapper{min-width:115px;max-width:var(--ucds-form-element-maxwidth);width:var(--ucds-form-element-width)}.dropdown{position:relative}.toggle{display:flex;align-items:center;justify-content:space-between;gap:16px;height:48px;padding:0 var(--ucds-form-element-horizontal-padding);font-family:var(--ucds-font-family-sans-serif);font-size:var(--ucds-font-base-size);border:var(--ucds-color-forms-input-border-rest) solid var(--ucds-form-element-border-width);border-radius:var(--ucds-form-element-border-radius);background-color:var(--ucds-color-forms-input-background-rest)}.toggle:focus{outline:var(--ucds-color-action-focus) 2px solid;outline-offset:2px}.toggle .selected-label-wrapper{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.toggle ucds-icon{color:var(--ucds-color-action-rest);transition:transform .5s ease}.toggle.error{background-color:var(--ucds-color-feedback-error-background-light);border-color:var(--ucds-color-feedback-error-light)}.toggle:hover{border-color:var(--ucds-color-forms-input-border-hover);cursor:pointer}.toggle.disabled{border-color:var(--ucds-color-forms-input-border-disabled);color:var(--ucds-color-text-disabled);cursor:not-allowed;pointer-events:none}.toggle.disabled ucds-icon{color:var(--ucds-color-forms-input-element-disabled)}.menu{position:absolute;background:var(--ucds-color-forms-input-background-rest);border:var(--ucds-color-forms-input-border-rest) solid var(--ucds-form-element-border-width);border-radius:var(--ucds-form-element-border-radius);display:none;cursor:pointer;list-style:none;margin:0;padding:12px;flex-direction:column;gap:8px;overflow-y:auto;z-index:100;-webkit-overflow-scrolling:touch;scroll-behavior:smooth}:host([open]) .menu{display:flex}:host([open]) ucds-icon{transform:rotateX(180deg)}:host([data-open-direction="up"]) .menu{bottom:calc(100% + 8px)}:host([data-open-direction="down"]) .menu{top:calc(100% + 8px)}';
623
- var je = Object.defineProperty, ze = Object.getOwnPropertyDescriptor, f = (r, e, t, s) => {
624
- for (var i = s > 1 ? void 0 : s ? ze(e, t) : e, o = r.length - 1, n; o >= 0; o--)
625
- (n = r[o]) && (i = (s ? n(e, t, i) : n(i)) || i);
626
- return s && i && je(e, t, i), i;
351
+ const F = ':host{position:relative;display:block}.dropdown-wrapper{display:flex;flex-direction:column;gap:8px;align-items:start}.dropdown,.menu,.toggle,.dropdown-wrapper{min-width:115px;max-width:var(--ucds-form-element-maxwidth);width:var(--ucds-form-element-width)}.dropdown{position:relative}.toggle{display:flex;align-items:center;justify-content:space-between;gap:16px;height:48px;padding:0 var(--ucds-form-element-horizontal-padding);font-family:var(--ucds-font-family-sans-serif);font-size:var(--ucds-font-base-size);border:var(--ucds-color-forms-input-border-rest) solid var(--ucds-form-element-border-width);border-radius:var(--ucds-form-element-border-radius);background-color:var(--ucds-color-forms-input-background-rest)}.toggle:focus{outline:var(--ucds-color-action-focus) 2px solid;outline-offset:2px}.toggle .selected-label-wrapper{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.toggle ucds-icon{color:var(--ucds-color-action-rest);transition:transform .5s ease}.toggle.error{background-color:var(--ucds-color-feedback-error-background-light);border-color:var(--ucds-color-feedback-error-light)}.toggle:hover{border-color:var(--ucds-color-forms-input-border-hover);cursor:pointer}.toggle.disabled{border-color:var(--ucds-color-forms-input-border-disabled);color:var(--ucds-color-text-disabled);cursor:not-allowed;pointer-events:none}.toggle.disabled ucds-icon{color:var(--ucds-color-forms-input-element-disabled)}.menu{position:absolute;background:var(--ucds-color-forms-input-background-rest);border:var(--ucds-color-forms-input-border-rest) solid var(--ucds-form-element-border-width);border-radius:var(--ucds-form-element-border-radius);display:none;cursor:pointer;list-style:none;margin:0;padding:12px;flex-direction:column;gap:8px;overflow-y:auto;z-index:100;-webkit-overflow-scrolling:touch;scroll-behavior:smooth}:host([open]) .menu{display:flex}:host([open]) ucds-icon{transform:rotateX(180deg)}:host([data-open-direction="up"]) .menu{bottom:calc(100% + 8px)}:host([data-open-direction="down"]) .menu{top:calc(100% + 8px)}';
352
+ var G = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, c = (s, e, t, i) => {
353
+ for (var o = i > 1 ? void 0 : i ? Q(e, t) : e, r = s.length - 1, n; r >= 0; r--)
354
+ (n = s[r]) && (o = (i ? n(e, t, o) : n(o)) || o);
355
+ return i && o && G(e, t, o), o;
627
356
  };
628
- let p = class extends N {
357
+ let l = class extends _ {
629
358
  // == Constructor ==
630
359
  constructor() {
631
360
  super(), this.initialValue = "", this.initialLabel = "", this._isOutsideClickListenerAttached = !1, this.scrollHandler = () => this._adjustDropdownDirection(), this.resizeObserver = new ResizeObserver(() => this._adjustDropdownDirection()), this.errorText = "", this.inputId = "", this.label = "", this.name = "", this.selectedLabel = "- Select -", this.disabled = !1, this.error = !1, this.open = !1, this.required = !1, this.activeIndex = -1, this._value = "", this.internals = this.attachInternals();
@@ -636,9 +365,9 @@ let p = class extends N {
636
365
  return this._value;
637
366
  }
638
367
  /** Updates the value, triggers reactivity and form value update. */
639
- set value(r) {
368
+ set value(s) {
640
369
  const e = this._value;
641
- this._value = r, this.internals.setFormValue(this._value), this.requestUpdate("value", e);
370
+ this._value = s, this.internals.setFormValue(this._value), this.requestUpdate("value", e);
642
371
  }
643
372
  // == Lifecycle methods ==
644
373
  connectedCallback() {
@@ -648,27 +377,27 @@ let p = class extends N {
648
377
  super.disconnectedCallback && super.disconnectedCallback(), this.removeEventListener("keydown", this._handleKeydown), this._removeOutsideClickListener();
649
378
  }
650
379
  firstUpdated() {
651
- const r = this.items.find((e) => e.hasAttribute("selected"));
380
+ const s = this.items.find((e) => e.hasAttribute("selected"));
652
381
  queueMicrotask(() => {
653
382
  var e;
654
- !this.value && r ? (this.initialValue = r.value, this.initialLabel = (e = r.textContent) == null ? void 0 : e.trim(), this.value = this.initialValue, this.selectedLabel = this.initialLabel, this.activeIndex = this.items.indexOf(r)) : (this.initialValue = "", this.initialLabel = this.selectedLabel), this._syncSelectedItem();
383
+ !this.value && s ? (this.initialValue = s.value, this.initialLabel = (e = s.textContent) == null ? void 0 : e.trim(), this.value = this.initialValue, this.selectedLabel = this.initialLabel, this.activeIndex = this.items.indexOf(s)) : (this.initialValue = "", this.initialLabel = this.selectedLabel), this._syncSelectedItem();
655
384
  });
656
385
  }
657
386
  // == Event handlers ==
658
387
  /** Handles keyboard navigation and interaction. */
659
- _handleKeydown(r) {
660
- var t, s;
388
+ _handleKeydown(s) {
389
+ var t, i;
661
390
  const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".toggle");
662
391
  if (!this.open) {
663
- if (["ArrowDown", "ArrowUp", " "].includes(r.key)) {
392
+ if (["ArrowDown", "ArrowUp", " "].includes(s.key)) {
664
393
  this._toggleMenu();
665
- const i = this.items.findIndex((o) => o.hasAttribute("selected"));
666
- this.activeIndex = i >= 0 ? i : 0, this.updateComplete.then(() => this._focusActiveItem()), r.preventDefault(), r.stopImmediatePropagation();
667
- } else if (["ArrowLeft", "ArrowRight"].includes(r.key)) {
668
- r.preventDefault(), r.stopImmediatePropagation();
669
- const i = this.items.find((a) => a.hasAttribute("selected")), o = i ? this.items.indexOf(i) : -1;
670
- let n = o;
671
- r.key === "ArrowLeft" ? n = Math.max(o - 1, 0) : r.key === "ArrowRight" && (n = Math.min(o + 1, this.items.length - 1)), n !== this.activeIndex && (this.activeIndex = n, this.value = this.items[this.activeIndex].value, this.selectedLabel = (s = this.items[this.activeIndex].textContent) == null ? void 0 : s.trim(), this._syncSelectedItem(), this.dispatchEvent(new CustomEvent("change", {
394
+ const o = this.items.findIndex((r) => r.hasAttribute("selected"));
395
+ this.activeIndex = o >= 0 ? o : 0, this.updateComplete.then(() => this._focusActiveItem()), s.preventDefault(), s.stopImmediatePropagation();
396
+ } else if (["ArrowLeft", "ArrowRight"].includes(s.key)) {
397
+ s.preventDefault(), s.stopImmediatePropagation();
398
+ const o = this.items.find((a) => a.hasAttribute("selected")), r = o ? this.items.indexOf(o) : -1;
399
+ let n = r;
400
+ s.key === "ArrowLeft" ? n = Math.max(r - 1, 0) : s.key === "ArrowRight" && (n = Math.min(r + 1, this.items.length - 1)), n !== this.activeIndex && (this.activeIndex = n, this.value = this.items[this.activeIndex].value, this.selectedLabel = (i = this.items[this.activeIndex].textContent) == null ? void 0 : i.trim(), this._syncSelectedItem(), this.dispatchEvent(new CustomEvent("change", {
672
401
  detail: { value: this.value, selectedLabel: this.selectedLabel },
673
402
  bubbles: !0,
674
403
  composed: !0
@@ -676,12 +405,12 @@ let p = class extends N {
676
405
  }
677
406
  return;
678
407
  }
679
- switch (r.key) {
408
+ switch (s.key) {
680
409
  case "ArrowDown":
681
- r.preventDefault(), this.activeIndex = Math.min(this.activeIndex + 1, this.items.length - 1), this._focusActiveItem();
410
+ s.preventDefault(), this.activeIndex = Math.min(this.activeIndex + 1, this.items.length - 1), this._focusActiveItem();
682
411
  break;
683
412
  case "ArrowUp":
684
- r.preventDefault(), this.activeIndex = Math.max(this.activeIndex - 1, 0), this._focusActiveItem();
413
+ s.preventDefault(), this.activeIndex = Math.max(this.activeIndex - 1, 0), this._focusActiveItem();
685
414
  break;
686
415
  case "Escape":
687
416
  this._toggleMenu(), e == null || e.focus();
@@ -689,21 +418,21 @@ let p = class extends N {
689
418
  }
690
419
  }
691
420
  /** Handles selection of an item via custom `dropdown-select` event. */
692
- _handleSelection(r) {
693
- this.value = r.detail.value, this.selectedLabel = r.detail.selectedLabel, this._syncSelectedItem(), queueMicrotask(() => {
694
- var s;
695
- const e = this.items.find((i) => i.hasAttribute("selected"));
421
+ _handleSelection(s) {
422
+ this.value = s.detail.value, this.selectedLabel = s.detail.selectedLabel, this._syncSelectedItem(), queueMicrotask(() => {
423
+ var i;
424
+ const e = this.items.find((o) => o.hasAttribute("selected"));
696
425
  this.activeIndex = this.items.indexOf(e), this._toggleMenu();
697
- const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector(".toggle");
426
+ const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".toggle");
698
427
  t == null || t.focus();
699
428
  });
700
429
  }
701
430
  /** Closes the dropdown when clicking outside. */
702
- _handleOutsideClick(r) {
431
+ _handleOutsideClick(s) {
703
432
  var e;
704
433
  if (this.open) {
705
- const t = r.composedPath(), s = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".menu");
706
- (!s || !t.includes(s)) && (this.open = !1, this._removeOutsideClickListener());
434
+ const t = s.composedPath(), i = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".menu");
435
+ (!i || !t.includes(i)) && (this.open = !1, this._removeOutsideClickListener());
707
436
  }
708
437
  }
709
438
  // == Form-associated methods ==
@@ -711,14 +440,14 @@ let p = class extends N {
711
440
  formResetCallback() {
712
441
  var e;
713
442
  this.value = this.initialValue;
714
- const r = this.items.find((t) => t.value === this.initialValue);
715
- r ? (this.selectedLabel = (e = r.textContent) == null ? void 0 : e.trim(), this.activeIndex = this.items.indexOf(r)) : (this.selectedLabel = this.initialLabel, this.activeIndex = -1), this._syncSelectedItem();
443
+ const s = this.items.find((t) => t.value === this.initialValue);
444
+ s ? (this.selectedLabel = (e = s.textContent) == null ? void 0 : e.trim(), this.activeIndex = this.items.indexOf(s)) : (this.selectedLabel = this.initialLabel, this.activeIndex = -1), this._syncSelectedItem();
716
445
  }
717
446
  /** Called when form state is restored. */
718
- formStateRestoreCallback(r) {
447
+ formStateRestoreCallback(s) {
719
448
  var t;
720
- const e = this.items.find((s) => s.value === r);
721
- e ? (this.selectedLabel = (t = e.textContent) == null ? void 0 : t.trim(), this.activeIndex = this.items.indexOf(e), this._syncSelectedItem(), this.value = r) : console.warn("No matching item found during restore");
449
+ const e = this.items.find((i) => i.value === s);
450
+ e ? (this.selectedLabel = (t = e.textContent) == null ? void 0 : t.trim(), this.activeIndex = this.items.indexOf(e), this._syncSelectedItem(), this.value = s) : console.warn("No matching item found during restore");
722
451
  }
723
452
  // == Private methods ==
724
453
  /** Opens or closes the dropdown. */
@@ -729,27 +458,27 @@ let p = class extends N {
729
458
  }
730
459
  /** Marks selected item visually based on value. */
731
460
  _syncSelectedItem() {
732
- this.items.forEach((r) => {
733
- const e = r;
461
+ this.items.forEach((s) => {
462
+ const e = s;
734
463
  e.selected = e.value === this.value;
735
464
  });
736
465
  }
737
466
  /** Determines if dropdown should open upward or downward based on viewport space. */
738
467
  _adjustDropdownDirection() {
739
468
  var n, a;
740
- const e = ((n = this.shadowRoot) == null ? void 0 : n.querySelector(".dropdown")).getBoundingClientRect(), t = e.top, s = window.innerHeight - e.bottom, i = s >= t ? "down" : "up";
741
- this.setAttribute("data-open-direction", i);
742
- const o = (a = this.shadowRoot) == null ? void 0 : a.querySelector(".menu");
743
- if (o) {
744
- const l = i === "down" ? s - 16 : t - 16;
745
- o.style.maxHeight = `${l}px`;
469
+ const e = ((n = this.shadowRoot) == null ? void 0 : n.querySelector(".dropdown")).getBoundingClientRect(), t = e.top, i = window.innerHeight - e.bottom, o = i >= t ? "down" : "up";
470
+ this.setAttribute("data-open-direction", o);
471
+ const r = (a = this.shadowRoot) == null ? void 0 : a.querySelector(".menu");
472
+ if (r) {
473
+ const d = o === "down" ? i - 16 : t - 16;
474
+ r.style.maxHeight = `${d}px`;
746
475
  }
747
476
  }
748
477
  /** Focuses the currently active item (for keyboard nav). */
749
478
  _focusActiveItem() {
750
- var r, e;
479
+ var s, e;
751
480
  if (this.items.length > 0 && this.activeIndex > -1) {
752
- const t = (e = (r = this.items[this.activeIndex]) == null ? void 0 : r.shadowRoot) == null ? void 0 : e.querySelector(".dropdown-item");
481
+ const t = (e = (s = this.items[this.activeIndex]) == null ? void 0 : s.shadowRoot) == null ? void 0 : e.querySelector(".dropdown-item");
753
482
  t == null || t.focus();
754
483
  }
755
484
  }
@@ -759,17 +488,17 @@ let p = class extends N {
759
488
  }
760
489
  // == Render ==
761
490
  render() {
762
- const r = {
491
+ const s = {
763
492
  disabled: this.disabled,
764
493
  error: this.error
765
494
  };
766
- return H`
495
+ return y`
767
496
  <div class="dropdown-wrapper">
768
- ${this.label ? H`
769
- <form-label id="${this.inputId}-label" for="${this.inputId}" text="${this.label}" ?required="${this.required}" ?disabled="${this.disabled}"></form-label>` : L}
497
+ ${this.label ? y`
498
+ <form-label id="${this.inputId}-label" for="${this.inputId}" text="${this.label}" ?required="${this.required}" ?disabled="${this.disabled}"></form-label>` : v}
770
499
  <div class="dropdown">
771
- <div class="toggle ${De(r)}"
772
- aria-disabled="${this.disabled ? !0 : L}"
500
+ <div class="toggle ${M(s)}"
501
+ aria-disabled="${this.disabled ? !0 : v}"
773
502
  role="button"
774
503
  tabindex="${this.disabled ? "-1" : "0"}"
775
504
  @click="${this._toggleMenu}"
@@ -784,62 +513,62 @@ let p = class extends N {
784
513
  <slot></slot>
785
514
  </div>
786
515
  </div>
787
- ${this.error ? H`<form-error-message text="${this.errorText}"></form-error-message>` : L}
516
+ ${this.error ? y`<form-error-message text="${this.errorText}"></form-error-message>` : v}
788
517
  </div>
789
518
  `;
790
519
  }
791
520
  };
792
- p.styles = [
793
- N.styles,
794
- oe(Ne)
521
+ l.styles = [
522
+ _.styles,
523
+ A(F)
795
524
  ];
796
- p.formAssociated = !0;
797
- f([
798
- m({ type: String, attribute: "error-text" })
799
- ], p.prototype, "errorText", 2);
800
- f([
801
- m({ type: String, attribute: "input-id" })
802
- ], p.prototype, "inputId", 2);
803
- f([
804
- m({ type: String })
805
- ], p.prototype, "label", 2);
806
- f([
807
- m({ type: String, reflect: !0 })
808
- ], p.prototype, "name", 2);
809
- f([
810
- m({ type: String, attribute: "selected-label" })
811
- ], p.prototype, "selectedLabel", 2);
812
- f([
813
- m({ type: Boolean, reflect: !0 })
814
- ], p.prototype, "disabled", 2);
815
- f([
816
- m({ type: Boolean, reflect: !0 })
817
- ], p.prototype, "error", 2);
818
- f([
819
- m({ type: Boolean, reflect: !0 })
820
- ], p.prototype, "open", 2);
821
- f([
822
- m({ type: Boolean, reflect: !0 })
823
- ], p.prototype, "required", 2);
824
- f([
825
- ae()
826
- ], p.prototype, "activeIndex", 2);
827
- f([
828
- ae()
829
- ], p.prototype, "_value", 2);
830
- f([
831
- Ee({ selector: "ucds-dropdown-item" })
832
- ], p.prototype, "items", 2);
833
- p = f([
834
- ne("ucds-dropdown")
835
- ], p);
836
- const Be = ".dropdown-item{display:flex;gap:4px;align-items:center;padding:10px 6px 10px 26px;border-radius:8px}.dropdown-item ucds-icon{display:none}.dropdown-item .dropdown-item-text{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dropdown-item:hover,.dropdown-item:active,.dropdown-item:focus{background-color:var(--ucds-color-palette-berry-900);outline:none}.dropdown-item.selected{padding-left:6px}.dropdown-item.selected ucds-icon{display:inline-flex}";
837
- var qe = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, Z = (r, e, t, s) => {
838
- for (var i = s > 1 ? void 0 : s ? Ve(e, t) : e, o = r.length - 1, n; o >= 0; o--)
839
- (n = r[o]) && (i = (s ? n(e, t, i) : n(i)) || i);
840
- return s && i && qe(e, t, i), i;
525
+ l.formAssociated = !0;
526
+ c([
527
+ h({ type: String, attribute: "error-text" })
528
+ ], l.prototype, "errorText", 2);
529
+ c([
530
+ h({ type: String, attribute: "input-id" })
531
+ ], l.prototype, "inputId", 2);
532
+ c([
533
+ h({ type: String })
534
+ ], l.prototype, "label", 2);
535
+ c([
536
+ h({ type: String, reflect: !0 })
537
+ ], l.prototype, "name", 2);
538
+ c([
539
+ h({ type: String, attribute: "selected-label" })
540
+ ], l.prototype, "selectedLabel", 2);
541
+ c([
542
+ h({ type: Boolean, reflect: !0 })
543
+ ], l.prototype, "disabled", 2);
544
+ c([
545
+ h({ type: Boolean, reflect: !0 })
546
+ ], l.prototype, "error", 2);
547
+ c([
548
+ h({ type: Boolean, reflect: !0 })
549
+ ], l.prototype, "open", 2);
550
+ c([
551
+ h({ type: Boolean, reflect: !0 })
552
+ ], l.prototype, "required", 2);
553
+ c([
554
+ U()
555
+ ], l.prototype, "activeIndex", 2);
556
+ c([
557
+ U()
558
+ ], l.prototype, "_value", 2);
559
+ c([
560
+ X({ selector: "ucds-dropdown-item" })
561
+ ], l.prototype, "items", 2);
562
+ l = c([
563
+ I("ucds-dropdown")
564
+ ], l);
565
+ const Y = ".dropdown-item{display:flex;gap:4px;align-items:center;padding:10px 6px 10px 26px;border-radius:8px}.dropdown-item ucds-icon{display:none}.dropdown-item .dropdown-item-text{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dropdown-item:hover,.dropdown-item:active,.dropdown-item:focus{background-color:var(--ucds-color-palette-berry-900);outline:none}.dropdown-item.selected{padding-left:6px}.dropdown-item.selected ucds-icon{display:inline-flex}";
566
+ var Z = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, S = (s, e, t, i) => {
567
+ for (var o = i > 1 ? void 0 : i ? ee(e, t) : e, r = s.length - 1, n; r >= 0; r--)
568
+ (n = s[r]) && (o = (i ? n(e, t, o) : n(o)) || o);
569
+ return i && o && Z(e, t, o), o;
841
570
  };
842
- let I = class extends N {
571
+ let m = class extends _ {
843
572
  constructor() {
844
573
  super(...arguments), this.value = "", this.selected = !1;
845
574
  }
@@ -847,22 +576,22 @@ let I = class extends N {
847
576
  /** Called when the item is clicked or activated via keyboard. */
848
577
  _select() {
849
578
  var e;
850
- const r = (e = this.textContent) == null ? void 0 : e.trim();
579
+ const s = (e = this.textContent) == null ? void 0 : e.trim();
851
580
  this.selected = !0, this.dispatchEvent(new CustomEvent("dropdown-select", {
852
- detail: { value: this.value, selectedLabel: r },
581
+ detail: { value: this.value, selectedLabel: s },
853
582
  bubbles: !0,
854
583
  composed: !0
855
584
  }));
856
585
  }
857
586
  /** Handle Enter, Tab, or Esc key to activate the item. */
858
- _handleKeydown(r) {
859
- (r.key === "Enter" || r.key === "Tab" || r.key === "Esc") && (r.preventDefault(), this._select());
587
+ _handleKeydown(s) {
588
+ (s.key === "Enter" || s.key === "Tab" || s.key === "Esc") && (s.preventDefault(), this._select());
860
589
  }
861
590
  // == Render ==
862
591
  render() {
863
- return H`
592
+ return y`
864
593
  <div class="dropdown-item ${this.selected ? "selected" : ""}"
865
- aria-selected="${this.selected ? !0 : L}"
594
+ aria-selected="${this.selected ? !0 : v}"
866
595
  role="option"
867
596
  tabindex="-1"
868
597
  @click=${this._select}
@@ -874,20 +603,20 @@ let I = class extends N {
874
603
  `;
875
604
  }
876
605
  };
877
- I.styles = [
878
- N.styles,
879
- oe(Be)
606
+ m.styles = [
607
+ _.styles,
608
+ A(Y)
880
609
  ];
881
- Z([
882
- m({ type: String })
883
- ], I.prototype, "value", 2);
884
- Z([
885
- m({ type: Boolean, reflect: !0 })
886
- ], I.prototype, "selected", 2);
887
- I = Z([
888
- ne("ucds-dropdown-item")
889
- ], I);
610
+ S([
611
+ h({ type: String })
612
+ ], m.prototype, "value", 2);
613
+ S([
614
+ h({ type: Boolean, reflect: !0 })
615
+ ], m.prototype, "selected", 2);
616
+ m = S([
617
+ I("ucds-dropdown-item")
618
+ ], m);
890
619
  export {
891
- p as Dropdown,
892
- I as DropdownItem
620
+ l as Dropdown,
621
+ m as DropdownItem
893
622
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucalgary-design-system/dropdown",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -10,10 +10,10 @@
10
10
  "require": "./index.js"
11
11
  }
12
12
  },
13
- "dependencies": {
14
- "@ucalgary-design-system/core": "^1.0.2",
13
+ "peerDependencies": {
14
+ "@ucalgary-design-system/core": "^1.0.3",
15
15
  "@ucalgary-design-system/helper-components": "^1.0.2",
16
- "@ucalgary-design-system/icon": "^1.0.2",
16
+ "@ucalgary-design-system/icon": "^1.0.3",
17
17
  "@ucalgary-design-system/tokens": "^1.0.3",
18
18
  "lit": "^3.2.1"
19
19
  },