dap-design-system 0.61.2 → 0.61.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.
@@ -1,28 +1,28 @@
1
1
  var x = Object.getPrototypeOf;
2
2
  var C = Reflect.get;
3
- var I = (f, t, e) => C(x(f), e, t);
4
- var v = (f, t, e) => new Promise((s, o) => {
5
- var i = (p) => {
3
+ var w = (f, t, i) => C(x(f), i, t);
4
+ var v = (f, t, i) => new Promise((e, s) => {
5
+ var n = (d) => {
6
6
  try {
7
- l(e.next(p));
8
- } catch (d) {
9
- o(d);
7
+ h(i.next(d));
8
+ } catch (p) {
9
+ s(p);
10
10
  }
11
- }, a = (p) => {
11
+ }, o = (d) => {
12
12
  try {
13
- l(e.throw(p));
14
- } catch (d) {
15
- o(d);
13
+ h(i.throw(d));
14
+ } catch (p) {
15
+ s(p);
16
16
  }
17
- }, l = (p) => p.done ? s(p.value) : Promise.resolve(p.value).then(i, a);
18
- l((e = e.apply(f, t)).next());
17
+ }, h = (d) => d.done ? e(d.value) : Promise.resolve(d.value).then(n, o);
18
+ h((i = i.apply(f, t)).next());
19
19
  });
20
- import { autoUpdate as A, computePosition as k, offset as S, flip as E, shift as P, size as T } from "../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
21
- import { clsx as w } from "../../node_modules/clsx/dist/clsx.js";
20
+ import { autoUpdate as A, computePosition as k, offset as E, flip as S, shift as T, size as P } from "../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
21
+ import { clsx as I } from "../../node_modules/clsx/dist/clsx.js";
22
22
  import "../../node_modules/@lit/reactive-element/reactive-element.js";
23
23
  import { nothing as D } from "../../node_modules/lit-html/lit-html.js";
24
24
  import "../../node_modules/lit-element/lit-element.js";
25
- import { property as h } from "../../node_modules/@lit/reactive-element/decorators/property.js";
25
+ import { property as l } from "../../node_modules/@lit/reactive-element/decorators/property.js";
26
26
  import { state as u } from "../../node_modules/@lit/reactive-element/decorators/state.js";
27
27
  import { query as N } from "../../node_modules/@lit/reactive-element/decorators/query.js";
28
28
  import { queryAssignedElements as L } from "../../node_modules/@lit/reactive-element/decorators/query-assigned-elements.js";
@@ -38,143 +38,144 @@ import q from "../stack/stack.component.js";
38
38
  import F from "./navigation-menu-item.scss.js";
39
39
  import { SubmenuController as U } from "./submenu-controller.js";
40
40
  import { unsafeCSS as W } from "../../node_modules/@lit/reactive-element/css-tag.js";
41
- var M = Object.defineProperty, K = Object.getOwnPropertyDescriptor, r = (f, t, e, s) => {
42
- for (var o = s > 1 ? void 0 : s ? K(t, e) : t, i = f.length - 1, a; i >= 0; i--)
43
- (a = f[i]) && (o = (s ? a(t, e, o) : a(o)) || o);
44
- return s && o && M(t, e, o), o;
41
+ var M = Object.defineProperty, K = Object.getOwnPropertyDescriptor, a = (f, t, i, e) => {
42
+ for (var s = e > 1 ? void 0 : e ? K(t, i) : t, n = f.length - 1, o; n >= 0; n--)
43
+ (o = f[n]) && (s = (e ? o(t, i, s) : o(s)) || s);
44
+ return e && s && M(t, i, s), s;
45
45
  };
46
46
  const y = class y extends $(H) {
47
47
  constructor() {
48
48
  super(), this.triggerElement = null, this.disabled = !1, this.opened = !1, this.placement = "bottom-start", this.floatingStrategy = "fixed", this.offset = 0, this.sync = !1, this.maxHeight = 250, this.maxWidth = "auto", this.hasArrow = !1, this.overflow = !0, this.fullWidth = !1, this.exactHref = !1, this.level = 0, this.orientation = "horizontal", this.tabMode = "group", this.triggerButtonTestId = "navigation-menu-item-trigger-button", this.hasContent = !1, this.hasLink = !1, this.hasTitleSlot = !1, this._titleText = "", this.active = !1, this.openedByHover = !1, this._isRovingActive = !1, this._handleLinkSlotChange = (t) => {
49
- const e = t.target;
50
- if (e) {
51
- const s = e.assignedElements();
52
- this.hasLink = s.length > 0, s.forEach((o) => o.setAttribute("tabindex", "-1"));
49
+ const i = t.target;
50
+ if (i) {
51
+ const e = i.assignedElements();
52
+ this.hasLink = e.length > 0, e.forEach((s) => s.setAttribute("tabindex", "-1"));
53
53
  }
54
54
  this._updateActiveState();
55
55
  }, this._handleTitleSlotChange = (t) => {
56
- const e = t.target;
57
- if (e) {
58
- const s = e.assignedNodes({ flatten: !0 });
59
- this.hasTitleSlot = s.some(
60
- (o) => {
61
- var i;
62
- return (o.nodeType === Node.ELEMENT_NODE || o.nodeType === Node.TEXT_NODE && ((i = o.textContent) == null ? void 0 : i.trim().length)) && o !== e;
56
+ const i = t.target;
57
+ if (i) {
58
+ const e = i.assignedNodes({ flatten: !0 });
59
+ this.hasTitleSlot = e.some(
60
+ (s) => {
61
+ var n;
62
+ return (s.nodeType === Node.ELEMENT_NODE || s.nodeType === Node.TEXT_NODE && ((n = s.textContent) == null ? void 0 : n.trim().length)) && s !== i;
63
63
  }
64
- ), this._titleText = s.map((o) => {
65
- var i, a;
66
- return (a = (i = o.textContent) == null ? void 0 : i.trim()) != null ? a : "";
64
+ ), this._titleText = e.map((s) => {
65
+ var n, o;
66
+ return (o = (n = s.textContent) == null ? void 0 : n.trim()) != null ? o : "";
67
67
  }).join(" ").trim();
68
68
  }
69
69
  }, this._handleClick = (t) => {
70
- var s, o, i;
70
+ var e, s, n;
71
71
  if (this.disabled) {
72
72
  t.preventDefault(), t.stopImmediatePropagation();
73
73
  return;
74
74
  }
75
75
  if (this.hasContent || this.hasNestedItems) {
76
- const a = this._trigger, l = t.composedPath();
77
- a.some(
78
- (d) => l.includes(d)
79
- ) ? (t.preventDefault(), t.stopPropagation(), this.opened && this.openedByHover ? this.openedByHover = !1 : this.opened ? this.hideDropDown() : this.showDropDown(!1)) : this.opened && l.some((c) => {
76
+ const o = this._trigger, h = t.composedPath();
77
+ o.some(
78
+ (p) => h.includes(p)
79
+ ) ? (t.preventDefault(), t.stopPropagation(), this.opened && this.openedByHover ? this.openedByHover = !1 : this.opened ? this.hideDropDown() : this.showDropDown(!1)) : this.opened && h.some((c) => {
80
80
  if (!(c instanceof Element)) return !1;
81
81
  const b = c.tagName.toUpperCase();
82
82
  return b === "A" || b === "DAP-DS-LINK";
83
83
  }) && this.hideDropDown();
84
84
  } else if (this.hasLink) {
85
- const a = this._trigger, l = t.composedPath();
86
- if (a.some(
87
- (d) => l.includes(d)
85
+ const o = this._trigger, h = t.composedPath();
86
+ if (o.some(
87
+ (p) => h.includes(p)
88
88
  )) {
89
89
  t.preventDefault();
90
- const d = this._getLinkElement();
91
- if (d) {
92
- const b = d.getAttribute("href");
93
- d.click(), b && this.emit("dds-navigation-item-click", { href: b, event: t });
90
+ const p = this._getLinkElement();
91
+ if (p) {
92
+ const b = p.getAttribute("href");
93
+ p.click(), b && this.emit("dds-navigation-item-click", { href: b, event: t });
94
94
  }
95
- let c = (s = this.parentElement) == null ? void 0 : s.closest(
95
+ let c = (e = this.parentElement) == null ? void 0 : e.closest(
96
96
  "dap-ds-navigation-menu-item"
97
97
  );
98
98
  for (; c; )
99
- c.opened && c.hideDropDown(), c = (o = c.parentElement) == null ? void 0 : o.closest(
99
+ c.opened && c.hideDropDown(), c = (s = c.parentElement) == null ? void 0 : s.closest(
100
100
  "dap-ds-navigation-menu-item"
101
101
  );
102
102
  }
103
103
  } else {
104
- const l = (i = this._trigger[0]) == null ? void 0 : i.getAttribute("href");
105
- l && this.emit("dds-navigation-item-click", {
106
- href: l,
104
+ const h = (n = this._trigger[0]) == null ? void 0 : n.getAttribute("href");
105
+ h && this.emit("dds-navigation-item-click", {
106
+ href: h,
107
107
  event: t
108
108
  });
109
109
  }
110
110
  }, this._handleMouseOver = (t) => {
111
- const e = this.parentElement;
112
- e && (e.querySelectorAll(":scope > dap-ds-navigation-menu-item") || []).forEach((o) => {
113
- if (o !== this) {
114
- const i = o;
115
- i.submenuController.cancelPendingOpen(), i.opened && i.hideDropDown();
111
+ const i = this.parentElement;
112
+ i && (i.querySelectorAll(":scope > dap-ds-navigation-menu-item") || []).forEach((s) => {
113
+ if (s !== this) {
114
+ const n = s;
115
+ n.submenuController.cancelPendingOpen(), n.opened && n.hideDropDown();
116
116
  }
117
117
  }), t.stopPropagation();
118
118
  }, this._handleMouseLeave = (t) => {
119
119
  this.opened || this.submenuController.cancelPendingOpen();
120
120
  }, this._handleKeyDown = (t) => {
121
+ var i;
121
122
  if (this.opened && (this.hasNestedItems || this.hasContent)) {
122
123
  const e = Array.from(
123
124
  this.querySelectorAll(":scope > dap-ds-navigation-menu-item")
124
125
  );
125
126
  if (e.length > 0) {
126
- const s = t.target, o = e.findIndex(
127
- (i) => i.contains(s) || i === s
127
+ const s = t.target, n = e.findIndex(
128
+ (o) => o.contains(s) || o === s
128
129
  );
129
130
  if (t.key === "ArrowDown") {
130
131
  t.preventDefault(), t.stopPropagation();
131
- const i = o < e.length - 1 ? o + 1 : 0;
132
- e[i].focus();
132
+ const o = n < e.length - 1 ? n + 1 : 0;
133
+ e[o].focus();
133
134
  return;
134
135
  } else if (t.key === "ArrowUp") {
135
136
  t.preventDefault(), t.stopPropagation();
136
- const i = o > 0 ? o - 1 : e.length - 1;
137
- e[i].focus();
137
+ const o = n > 0 ? n - 1 : e.length - 1;
138
+ e[o].focus();
138
139
  return;
139
- } else if (t.key === "ArrowRight" && o >= 0) {
140
- const i = e[o];
141
- if (i.hasNestedItems || i.hasContent) {
142
- t.preventDefault(), t.stopPropagation(), i.opened || (i.showDropDown(), i.updateComplete.then(() => {
143
- const a = i.querySelector(
140
+ } else if (t.key === "ArrowRight" && n >= 0) {
141
+ const o = e[n];
142
+ if (o.hasNestedItems || o.hasContent) {
143
+ t.preventDefault(), t.stopPropagation(), o.opened || (o.showDropDown(), o.updateComplete.then(() => {
144
+ const h = o.querySelector(
144
145
  "dap-ds-navigation-menu-item"
145
146
  );
146
- a && a.focus();
147
+ h && h.focus();
147
148
  }));
148
149
  return;
149
150
  }
150
- } else if ((t.key === "Enter" || t.key === " ") && o >= 0) {
151
- const i = e[o], a = i.querySelector(
152
- '[slot="trigger"]'
153
- ), l = [
151
+ } else if ((t.key === "Enter" || t.key === " ") && n >= 0) {
152
+ const o = e[n], h = o.activationTrigger, p = [
154
153
  "A",
155
154
  "DAP-DS-LINK",
156
155
  "DAP-DS-BUTTON",
157
156
  "BUTTON",
158
157
  "LINK"
159
- ], p = l.includes(a == null ? void 0 : a.tagName.toLowerCase()) || l.includes(a == null ? void 0 : a.tagName);
160
- (!p || t.key === " ") && (t.preventDefault(), t.stopPropagation()), i.hasNestedItems || i.hasContent ? (t.preventDefault(), t.stopPropagation(), i.opened || i.showDropDown()) : (!p || t.key === " ") && (a == null || a.click());
158
+ ].includes(
159
+ ((i = h == null ? void 0 : h.tagName) != null ? i : "").toUpperCase()
160
+ );
161
+ (!p || t.key === " ") && (t.preventDefault(), t.stopPropagation()), o.hasNestedItems || o.hasContent ? (t.preventDefault(), t.stopPropagation(), o.opened || o.showDropDown()) : (!p || t.key === " ") && o.activateTrigger();
161
162
  return;
162
163
  }
163
164
  } else if (this.hasContent) {
164
165
  const s = this._getFocusablePopupItems();
165
166
  if (s.length > 0) {
166
- const o = t.target, i = s.findIndex(
167
- (a) => a === o || a.contains(o)
167
+ const n = t.target, o = s.findIndex(
168
+ (h) => h === n || h.contains(n)
168
169
  );
169
170
  if (t.key === "ArrowDown") {
170
171
  t.preventDefault(), t.stopPropagation();
171
- const a = i < 0 ? 0 : i < s.length - 1 ? i + 1 : 0;
172
- this._focusPopupItem(s[a]);
172
+ const h = o < 0 ? 0 : o < s.length - 1 ? o + 1 : 0;
173
+ this._focusPopupItem(s[h]);
173
174
  return;
174
175
  } else if (t.key === "ArrowUp") {
175
176
  t.preventDefault(), t.stopPropagation();
176
- const a = i < 0 ? s.length - 1 : i > 0 ? i - 1 : s.length - 1;
177
- this._focusPopupItem(s[a]);
177
+ const h = o < 0 ? s.length - 1 : o > 0 ? o - 1 : s.length - 1;
178
+ this._focusPopupItem(s[h]);
178
179
  return;
179
180
  } else if (t.key === "Home") {
180
181
  t.preventDefault(), t.stopPropagation(), this._focusPopupItem(s[0]);
@@ -182,8 +183,8 @@ const y = class y extends $(H) {
182
183
  } else if (t.key === "End") {
183
184
  t.preventDefault(), t.stopPropagation(), this._focusPopupItem(s[s.length - 1]);
184
185
  return;
185
- } else if ((t.key === "Enter" || t.key === " ") && i >= 0) {
186
- t.preventDefault(), t.stopPropagation(), this._activateFocusableItem(s[i]);
186
+ } else if ((t.key === "Enter" || t.key === " ") && o >= 0) {
187
+ t.preventDefault(), t.stopPropagation(), this._activateFocusableItem(s[o]);
187
188
  return;
188
189
  }
189
190
  }
@@ -196,48 +197,48 @@ const y = class y extends $(H) {
196
197
  e.querySelectorAll(":scope > dap-ds-navigation-menu-item")
197
198
  );
198
199
  if (s.length === 0) return;
199
- const o = s.indexOf(this);
200
+ const n = s.indexOf(this);
200
201
  if (t.key === "ArrowDown") {
201
202
  t.preventDefault(), t.stopPropagation();
202
- const i = o < s.length - 1 ? o + 1 : 0;
203
- s[i].focus();
203
+ const o = n < s.length - 1 ? n + 1 : 0;
204
+ s[o].focus();
204
205
  } else if (t.key === "ArrowUp") {
205
206
  t.preventDefault(), t.stopPropagation();
206
- const i = o > 0 ? o - 1 : s.length - 1;
207
- s[i].focus();
207
+ const o = n > 0 ? n - 1 : s.length - 1;
208
+ s[o].focus();
208
209
  } else if (t.key === "ArrowRight")
209
210
  (this.hasNestedItems || this.hasContent) && (t.preventDefault(), t.stopPropagation(), this.opened ? this.focusFirstDropdownChild() : (this.showDropDown(), this.updateComplete.then(() => {
210
211
  this.focusFirstDropdownChild();
211
212
  })));
212
213
  else if (t.key === "ArrowLeft") {
213
214
  t.preventDefault(), t.stopPropagation();
214
- const i = e.closest(
215
+ const o = e.closest(
215
216
  "dap-ds-navigation-menu-item"
216
217
  );
217
- i && (i.hideDropDown(), i.focus());
218
+ o && (o.hideDropDown(), o.focus());
218
219
  } else if (t.key === "Escape") {
219
220
  t.preventDefault(), t.stopPropagation();
220
- const i = e.closest(
221
+ const o = e.closest(
221
222
  "dap-ds-navigation-menu-item"
222
223
  );
223
- i && (i.hideDropDown(), i.focus());
224
+ o && (o.hideDropDown(), o.focus());
224
225
  } else if (t.key === "Enter" || t.key === " ") {
225
- const i = this.querySelector('[slot="trigger"]'), a = ["A", "DAP-DS-LINK", "LINK"], l = i && (a.includes(i.tagName.toLowerCase()) || a.includes(i.tagName));
226
- if ((!l || t.key === " ") && (t.preventDefault(), t.stopPropagation()), this.hasNestedItems || this.hasContent)
226
+ const o = this.activationTrigger, h = ["A", "DAP-DS-LINK", "LINK"], d = o && (h.includes(o.tagName.toLowerCase()) || h.includes(o.tagName));
227
+ if ((!d || t.key === " ") && (t.preventDefault(), t.stopPropagation()), this.hasNestedItems || this.hasContent)
227
228
  t.preventDefault(), t.stopPropagation(), this.opened || this.showDropDown(!1);
228
229
  else if (this.hasLink) {
229
230
  t.preventDefault(), t.stopPropagation();
230
231
  const p = this._getLinkElement();
231
232
  if (p) {
232
- const d = p.getAttribute("href");
233
- p.click(), d && this.emit("dds-navigation-item-click", { href: d, event: t });
233
+ const c = p.getAttribute("href");
234
+ p.click(), c && this.emit("dds-navigation-item-click", { href: c, event: t });
234
235
  }
235
- } else (!l || t.key === " ") && (i == null || i.click());
236
+ } else (!d || t.key === " ") && this.activateTrigger();
236
237
  }
237
238
  }
238
239
  }, this.handleDocumentMouseDown = (t) => {
239
- const e = t.target, o = t.composedPath().includes(this), i = this._isWithinNestedItems(e);
240
- !o && !i && this.hideDropDown();
240
+ const i = t.target, s = t.composedPath().includes(this), n = this._isWithinNestedItems(i);
241
+ !s && !n && this.hideDropDown();
241
242
  }, this.submenuController = new U(this);
242
243
  }
243
244
  /** Computed property to detect if this item contains nested navigation menu items. */
@@ -245,26 +246,44 @@ const y = class y extends $(H) {
245
246
  return this.querySelectorAll("dap-ds-navigation-menu-item").length > 0;
246
247
  }
247
248
  get _trigger() {
248
- var e;
249
+ var i;
249
250
  if (this._assignedTrigger && this._assignedTrigger.length > 0) {
250
- const s = this._assignedTrigger.filter(
251
- (o) => o.parentElement === this
251
+ const e = this._assignedTrigger.filter(
252
+ (s) => s.parentElement === this
252
253
  );
253
- if (s.length > 0)
254
- return s;
254
+ if (e.length > 0)
255
+ return e;
255
256
  }
256
- const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("dap-ds-button");
257
+ const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector("dap-ds-button");
257
258
  return t ? [t] : [];
258
259
  }
260
+ /**
261
+ * The element keyboard activation should act on: the element slotted into
262
+ * `trigger` when one is provided, otherwise the default trigger button
263
+ * rendered in the shadow root.
264
+ */
265
+ get activationTrigger() {
266
+ var t;
267
+ return (t = this._trigger[0]) != null ? t : null;
268
+ }
269
+ /**
270
+ * Activate the trigger the way a mouse click would. Custom element triggers
271
+ * -- including the default `dap-ds-button` -- keep the real interactive
272
+ * element inside their shadow root, so clicking the host alone does nothing.
273
+ */
274
+ activateTrigger() {
275
+ const t = this.activationTrigger;
276
+ t && this._activateFocusableItem(t);
277
+ }
259
278
  /** Get the element slotted into the `link` slot, if any. */
260
279
  _getLinkElement() {
261
- var s;
262
- const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector(
280
+ var e;
281
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(
263
282
  'slot[name="link"]'
264
283
  );
265
284
  if (!t) return null;
266
- const e = t.assignedElements();
267
- return e.length > 0 ? e[0] : null;
285
+ const i = t.assignedElements();
286
+ return i.length > 0 ? i[0] : null;
268
287
  }
269
288
  connectedCallback() {
270
289
  super.connectedCallback(), this.addEventListener("click", this._handleClick), this.addEventListener("mouseover", this._handleMouseOver), this.addEventListener("mouseleave", this._handleMouseLeave), this.addEventListener("keydown", this._handleKeyDown), this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this), this._updatePlacementForLevel(), this.startPositionUpdate();
@@ -274,7 +293,7 @@ const y = class y extends $(H) {
274
293
  }
275
294
  firstUpdated(t) {
276
295
  return v(this, null, function* () {
277
- I(y.prototype, this, "firstUpdated").call(this, t), this._updateNestedItems(), this._handleTriggerSlotChangeCallback();
296
+ w(y.prototype, this, "firstUpdated").call(this, t), this._updateNestedItems(), this._handleTriggerSlotChangeCallback();
278
297
  });
279
298
  }
280
299
  handleOpenedChange() {
@@ -296,13 +315,13 @@ const y = class y extends $(H) {
296
315
  const t = this.querySelectorAll(
297
316
  "dap-ds-navigation-menu-item"
298
317
  );
299
- Array.from(t).filter((s) => {
300
- var i;
301
- return ((i = s.parentElement) == null ? void 0 : i.closest(
318
+ Array.from(t).filter((e) => {
319
+ var n;
320
+ return ((n = e.parentElement) == null ? void 0 : n.closest(
302
321
  "dap-ds-navigation-menu-item"
303
322
  )) === this;
304
- }).forEach((s) => {
305
- s.level = this.level + 1, s.orientation = this.orientation, this.activeHref && (s.activeHref = this.activeHref);
323
+ }).forEach((e) => {
324
+ e.level = this.level + 1, e.orientation = this.orientation, this.activeHref && (e.activeHref = this.activeHref);
306
325
  });
307
326
  }
308
327
  /** Update placement based on nesting level and orientation. */
@@ -334,28 +353,28 @@ const y = class y extends $(H) {
334
353
  updatePosition() {
335
354
  return v(this, null, function* () {
336
355
  if (!this.triggerElement || !this.popup) return;
337
- const t = this.floatingStrategy === "fixed" ? void 0 : this.closest("dap-ds-navigation-menu") || void 0, { x: e, y: s } = yield k(this.triggerElement, this.popup, {
356
+ const t = this.floatingStrategy === "fixed" ? void 0 : this.closest("dap-ds-navigation-menu") || void 0, { x: i, y: e } = yield k(this.triggerElement, this.popup, {
338
357
  placement: this.placement,
339
358
  strategy: this.floatingStrategy,
340
359
  middleware: [
341
- S(this.offset),
342
- E({
360
+ E(this.offset),
361
+ S({
343
362
  boundary: t
344
363
  }),
345
- P({
364
+ T({
346
365
  padding: this.fullWidth ? 0 : 8,
347
366
  boundary: t
348
367
  }),
349
- T({
350
- apply: ({ availableHeight: o, rects: i }) => {
351
- this.sync && (this.popup.style.width = `${i.reference.width}px`), this.maxHeight !== "auto" && (this.popup.style.maxHeight = `${Math.min(this.maxHeight, o)}px`), this.maxWidth !== "auto" && (this.popup.style.maxWidth = `${this.maxWidth}px`), this.fullWidth && (this.popup.style.width = "100vw");
368
+ P({
369
+ apply: ({ availableHeight: s, rects: n }) => {
370
+ this.sync && (this.popup.style.width = `${n.reference.width}px`), this.maxHeight !== "auto" && (this.popup.style.maxHeight = `${Math.min(this.maxHeight, s)}px`), this.maxWidth !== "auto" && (this.popup.style.maxWidth = `${this.maxWidth}px`), this.fullWidth && (this.popup.style.width = "100vw");
352
371
  }
353
372
  })
354
373
  ]
355
374
  });
356
375
  Object.assign(this.popup.style, {
357
- left: this.fullWidth ? "0px" : `${e}px`,
358
- top: `${s}px`
376
+ left: this.fullWidth ? "0px" : `${i}px`,
377
+ top: `${e}px`
359
378
  });
360
379
  });
361
380
  }
@@ -363,16 +382,16 @@ const y = class y extends $(H) {
363
382
  _isWithinNestedItems(t) {
364
383
  return Array.from(
365
384
  this.querySelectorAll("dap-ds-navigation-menu-item")
366
- ).some((s) => s.contains(t) || s.shadowRoot && s.shadowRoot.contains(t));
385
+ ).some((e) => e.contains(t) || e.shadowRoot && e.shadowRoot.contains(t));
367
386
  }
368
387
  focus() {
369
- var e;
370
- const t = (e = this._trigger) == null ? void 0 : e[0];
388
+ var i;
389
+ const t = (i = this._trigger) == null ? void 0 : i[0];
371
390
  if (t) {
372
391
  if (!t.shadowRoot) {
373
- const s = this._getInnerLightDomFocusable(t);
374
- if (s) {
375
- s.focus();
392
+ const e = this._getInnerLightDomFocusable(t);
393
+ if (e) {
394
+ e.focus();
376
395
  return;
377
396
  }
378
397
  }
@@ -385,33 +404,33 @@ const y = class y extends $(H) {
385
404
  * All others are removed (tabindex="-1") so Tab exits the whole nav in one step.
386
405
  */
387
406
  setRovingTabIndex(t) {
388
- var s;
407
+ var e;
389
408
  t ? this.setAttribute("data-nav-current", "") : this.removeAttribute("data-nav-current"), this._isRovingActive = t;
390
- const e = (s = this._trigger) == null ? void 0 : s[0];
391
- e ? this._applyTriggerTabIndex(e, t) : this.updateComplete.then(() => {
392
- var i;
393
- const o = (i = this._trigger) == null ? void 0 : i[0];
394
- o && this._applyTriggerTabIndex(o, t);
409
+ const i = (e = this._trigger) == null ? void 0 : e[0];
410
+ i ? this._applyTriggerTabIndex(i, t) : this.updateComplete.then(() => {
411
+ var n;
412
+ const s = (n = this._trigger) == null ? void 0 : n[0];
413
+ s && this._applyTriggerTabIndex(s, t);
395
414
  });
396
415
  }
397
416
  /** Apply tabindex to a trigger element and its inner focusable element. */
398
- _applyTriggerTabIndex(t, e) {
417
+ _applyTriggerTabIndex(t, i) {
399
418
  if (t.shadowRoot) {
400
- const s = t.shadowRoot.querySelector(
419
+ const e = t.shadowRoot.querySelector(
401
420
  "a[href], button:not([disabled])"
402
421
  );
403
- if (s) {
404
- t.removeAttribute("tabindex"), s.setAttribute("tabindex", e ? "0" : "-1");
422
+ if (e) {
423
+ t.removeAttribute("tabindex"), e.setAttribute("tabindex", i ? "0" : "-1");
405
424
  return;
406
425
  }
407
426
  } else {
408
- const s = this._getInnerLightDomFocusable(t);
409
- if (s) {
410
- t.removeAttribute("tabindex"), s.setAttribute("tabindex", e ? "0" : "-1");
427
+ const e = this._getInnerLightDomFocusable(t);
428
+ if (e) {
429
+ t.removeAttribute("tabindex"), e.setAttribute("tabindex", i ? "0" : "-1");
411
430
  return;
412
431
  }
413
432
  }
414
- t.setAttribute("tabindex", e ? "0" : "-1");
433
+ t.setAttribute("tabindex", i ? "0" : "-1");
415
434
  }
416
435
  /**
417
436
  * Returns the inner light-DOM focusable element of a non-focusable wrapper
@@ -429,8 +448,8 @@ const y = class y extends $(H) {
429
448
  t.focus();
430
449
  return;
431
450
  }
432
- const e = this._getFocusablePopupItems();
433
- e.length > 0 && this._focusPopupItem(e[0]);
451
+ const i = this._getFocusablePopupItems();
452
+ i.length > 0 && this._focusPopupItem(i[0]);
434
453
  }
435
454
  /** Focus the last focusable element in the dropdown (supports both nested nav items and mega menu content). */
436
455
  focusLastDropdownChild() {
@@ -441,41 +460,41 @@ const y = class y extends $(H) {
441
460
  t[t.length - 1].focus();
442
461
  return;
443
462
  }
444
- const e = this._getFocusablePopupItems();
445
- e.length > 0 && this._focusPopupItem(e[e.length - 1]);
463
+ const i = this._getFocusablePopupItems();
464
+ i.length > 0 && this._focusPopupItem(i[i.length - 1]);
446
465
  }
447
466
  /** Get all top-level focusable items inside the popup slot content (for mega menu arrow navigation). */
448
467
  _getFocusablePopupItems() {
449
- var o;
468
+ var s;
450
469
  if (!this.popup) return [];
451
470
  const t = this.popup.querySelector(
452
471
  "slot:not([name])"
453
- ), e = (o = t == null ? void 0 : t.assignedElements({ flatten: !0 })) != null ? o : [], s = [];
454
- for (const i of e)
455
- this._collectFocusableItems(i, s);
456
- return s;
472
+ ), i = (s = t == null ? void 0 : t.assignedElements({ flatten: !0 })) != null ? s : [], e = [];
473
+ for (const n of i)
474
+ this._collectFocusableItems(n, e);
475
+ return e;
457
476
  }
458
- _collectFocusableItems(t, e) {
477
+ _collectFocusableItems(t, i) {
459
478
  if (t.shadowRoot && t.shadowRoot.querySelector(
460
479
  'a[href]:not([tabindex="-1"]), button:not([disabled]):not([tabindex="-1"])'
461
480
  )) {
462
- e.push(t);
481
+ i.push(t);
463
482
  return;
464
483
  }
465
484
  if (["A", "BUTTON", "INPUT", "SELECT", "TEXTAREA"].includes(t.tagName) && !t.hasAttribute("disabled") && t.getAttribute("tabindex") !== "-1") {
466
- e.push(t);
485
+ i.push(t);
467
486
  return;
468
487
  }
469
- for (const s of t.children)
470
- this._collectFocusableItems(s, e);
488
+ for (const e of t.children)
489
+ this._collectFocusableItems(e, i);
471
490
  }
472
491
  _activateFocusableItem(t) {
473
492
  if (t.shadowRoot) {
474
- const e = t.shadowRoot.querySelector(
493
+ const i = t.shadowRoot.querySelector(
475
494
  "a[href], button:not([disabled])"
476
495
  );
477
- if (e) {
478
- e.click();
496
+ if (i) {
497
+ i.click();
479
498
  return;
480
499
  }
481
500
  }
@@ -483,11 +502,11 @@ const y = class y extends $(H) {
483
502
  }
484
503
  _focusPopupItem(t) {
485
504
  if (t.shadowRoot) {
486
- const e = t.shadowRoot.querySelector(
505
+ const i = t.shadowRoot.querySelector(
487
506
  "a[href], button:not([disabled])"
488
507
  );
489
- if (e) {
490
- e.focus();
508
+ if (i) {
509
+ i.focus();
491
510
  return;
492
511
  }
493
512
  }
@@ -495,21 +514,21 @@ const y = class y extends $(H) {
495
514
  }
496
515
  showDropDown(t = !1) {
497
516
  return v(this, null, function* () {
498
- var o;
499
- const e = this.hasContent || this.hasNestedItems;
500
- if (this.opened || !e)
517
+ var s;
518
+ const i = this.hasContent || this.hasNestedItems;
519
+ if (this.opened || !i)
501
520
  return;
502
- this._updatePlacementForLevel(), this.emit("dds-navigation-dropdown-open", { item: this }), this.opened = !0, this.openedByHover = t, (o = this._trigger[0]) == null || o.setAttribute("aria-expanded", "true"), document.addEventListener("mousedown", this.handleDocumentMouseDown), yield this.updateComplete, this._applyZIndex();
521
+ this._updatePlacementForLevel(), this.emit("dds-navigation-dropdown-open", { item: this }), this.opened = !0, this.openedByHover = t, (s = this._trigger[0]) == null || s.setAttribute("aria-expanded", "true"), document.addEventListener("mousedown", this.handleDocumentMouseDown), yield this.updateComplete, this._applyZIndex();
503
522
  });
504
523
  }
505
524
  hideDropDown() {
506
525
  return v(this, null, function* () {
507
- var s;
526
+ var e;
508
527
  if (!this.opened)
509
528
  return;
510
- this.querySelectorAll("dap-ds-navigation-menu-item").forEach((o) => {
511
- o.opened && o.hideDropDown();
512
- }), this.opened = !1, this.openedByHover = !1, (s = this._trigger[0]) == null || s.setAttribute("aria-expanded", "false"), document.removeEventListener("mousedown", this.handleDocumentMouseDown), yield this.updateComplete;
529
+ this.querySelectorAll("dap-ds-navigation-menu-item").forEach((s) => {
530
+ s.opened && s.hideDropDown();
531
+ }), this.opened = !1, this.openedByHover = !1, (e = this._trigger[0]) == null || e.setAttribute("aria-expanded", "false"), document.removeEventListener("mousedown", this.handleDocumentMouseDown), yield this.updateComplete;
513
532
  });
514
533
  }
515
534
  /** Handle trigger slot change events. */
@@ -529,27 +548,27 @@ const y = class y extends $(H) {
529
548
  });
530
549
  }
531
550
  _updateActiveState() {
532
- var e, s;
551
+ var i, e;
533
552
  const t = this._trigger;
534
553
  if ((!t || t.length === 0 || !this.activeHref) && !this.baseHref)
535
554
  this.active = !1;
536
555
  else if (this.baseHref)
537
- this.exactHref ? this.active = this.baseHref === this.activeHref : this.active = ((e = this.activeHref) == null ? void 0 : e.startsWith(this.baseHref)) || !1;
556
+ this.exactHref ? this.active = this.baseHref === this.activeHref : this.active = ((i = this.activeHref) == null ? void 0 : i.startsWith(this.baseHref)) || !1;
538
557
  else {
539
- const o = ((s = t[0]) == null ? void 0 : s.getAttribute("href")) || this.href;
540
- this.active = o === this.activeHref, t[0].active = this.active;
558
+ const s = ((e = t[0]) == null ? void 0 : e.getAttribute("href")) || this.href;
559
+ this.active = s === this.activeHref, t[0].active = this.active;
541
560
  }
542
561
  if (!this.active && this.hasLink && this.activeHref) {
543
- const o = this._getLinkElement(), i = o == null ? void 0 : o.getAttribute("href");
544
- i && (this.active = this.exactHref ? i === this.activeHref : this.activeHref.startsWith(i));
562
+ const s = this._getLinkElement(), n = s == null ? void 0 : s.getAttribute("href");
563
+ n && (this.active = this.exactHref ? n === this.activeHref : this.activeHref.startsWith(n));
545
564
  }
546
565
  t && t.length > 0 && (this.active ? t[0].setAttribute("aria-current", "page") : t[0].removeAttribute("aria-current"));
547
566
  }
548
567
  _handleContentSlotChange(t) {
549
- const e = t.target;
550
- if (e) {
551
- const s = e.assignedElements();
552
- this.hasContent = s.length > 0;
568
+ const i = t.target;
569
+ if (i) {
570
+ const e = i.assignedElements();
571
+ this.hasContent = e.length > 0;
553
572
  }
554
573
  this._updateNestedItems();
555
574
  }
@@ -572,14 +591,14 @@ const y = class y extends $(H) {
572
591
  return this.orientation === "vertical" ? "arrow-right-s-line" : this.level === 0 ? "arrow-down-s-line" : "arrow-right-s-line";
573
592
  }
574
593
  renderTrigger() {
575
- const t = this.hasContent || this.hasNestedItems, e = t ? this.opened ? "true" : "false" : void 0, s = this._titleText || this.label || void 0;
594
+ const t = this.hasContent || this.hasNestedItems, i = t ? this.opened ? "true" : "false" : void 0, e = this._titleText || this.label || void 0;
576
595
  return m`
577
596
  <dap-ds-button
578
597
  variant="subtle-menu"
579
598
  tabindex=${this._isRovingActive ? "0" : "-1"}
580
599
  ?active=${this.active}
581
- aria-expanded=${g(e)}
582
- aria-label=${g(s)}
600
+ aria-expanded=${g(i)}
601
+ aria-label=${g(e)}
583
602
  href=${g(this.href)}
584
603
  target=${g(this.target)}
585
604
  rel=${g(this.rel)}
@@ -611,7 +630,7 @@ const y = class y extends $(H) {
611
630
  part="popup"
612
631
  id="popup"
613
632
  ?inert=${!this.opened}
614
- class=${w("popup", `popup--${this.effectiveSize}`, {
633
+ class=${I("popup", `popup--${this.effectiveSize}`, {
615
634
  "popup--opened": this.opened,
616
635
  "popup--fixed": this.floatingStrategy === "fixed",
617
636
  "popup--has-arrow": this.hasArrow,
@@ -623,7 +642,7 @@ const y = class y extends $(H) {
623
642
  </div>
624
643
  ${this.hasArrow ? m`<div
625
644
  part="arrow"
626
- class=${w("popup__arrow")}
645
+ class=${I("popup__arrow")}
627
646
  role="presentation"></div>` : ""}
628
647
  </div>
629
648
  `;
@@ -633,7 +652,7 @@ const y = class y extends $(H) {
633
652
  return m`
634
653
  <div
635
654
  part="base"
636
- class=${w("navigation-item", {
655
+ class=${I("navigation-item", {
637
656
  "navigation-item--has-content": t,
638
657
  "navigation-item--opened": this.opened,
639
658
  [`navigation-item--level-${this.level}`]: !0
@@ -648,119 +667,119 @@ y.tagName = "dap-ds-navigation-menu-item", y.dependencies = {
648
667
  "dap-ds-button": R,
649
668
  "dap-ds-stack": q
650
669
  }, y.styles = W(`${F}${O}`);
651
- let n = y;
652
- r([
670
+ let r = y;
671
+ a([
653
672
  N(".popup")
654
- ], n.prototype, "popup", 2);
655
- r([
673
+ ], r.prototype, "popup", 2);
674
+ a([
656
675
  L({ slot: "trigger" })
657
- ], n.prototype, "_assignedTrigger", 2);
658
- r([
659
- h({ reflect: !0, type: Boolean })
660
- ], n.prototype, "disabled", 2);
661
- r([
662
- h({ reflect: !0, type: Boolean })
663
- ], n.prototype, "opened", 2);
664
- r([
665
- h({ reflect: !0 })
666
- ], n.prototype, "placement", 2);
667
- r([
668
- h({ reflect: !0 })
669
- ], n.prototype, "floatingStrategy", 2);
670
- r([
671
- h({ type: Number })
672
- ], n.prototype, "offset", 2);
673
- r([
674
- h({ type: Boolean })
675
- ], n.prototype, "sync", 2);
676
- r([
677
- h({ type: Number })
678
- ], n.prototype, "maxHeight", 2);
679
- r([
680
- h({ type: Number })
681
- ], n.prototype, "maxWidth", 2);
682
- r([
683
- h({ type: Boolean })
684
- ], n.prototype, "hasArrow", 2);
685
- r([
686
- h({ type: Boolean })
687
- ], n.prototype, "overflow", 2);
688
- r([
689
- h({ type: Boolean })
690
- ], n.prototype, "fullWidth", 2);
691
- r([
692
- h({ type: String, reflect: !0 })
693
- ], n.prototype, "icon", 2);
694
- r([
695
- h({ type: String, attribute: "aria-labelledby" })
696
- ], n.prototype, "ariaLabelledBy", 2);
697
- r([
698
- h({ type: String, reflect: !0 })
699
- ], n.prototype, "activeHref", 2);
700
- r([
701
- h({ type: String, reflect: !0 })
702
- ], n.prototype, "baseHref", 2);
703
- r([
704
- h({ type: Boolean, reflect: !0 })
705
- ], n.prototype, "exactHref", 2);
706
- r([
707
- h({ type: String, reflect: !0 })
708
- ], n.prototype, "href", 2);
709
- r([
710
- h({ type: String, reflect: !0 })
711
- ], n.prototype, "target", 2);
712
- r([
713
- h({ type: String, reflect: !0 })
714
- ], n.prototype, "rel", 2);
715
- r([
716
- h({ type: String })
717
- ], n.prototype, "label", 2);
718
- r([
719
- h({ type: Number, reflect: !0 })
720
- ], n.prototype, "level", 2);
721
- r([
722
- h({ reflect: !0 })
723
- ], n.prototype, "orientation", 2);
724
- r([
725
- h({ type: String })
726
- ], n.prototype, "tabMode", 2);
727
- r([
728
- h()
729
- ], n.prototype, "triggerButtonTestId", 2);
730
- r([
676
+ ], r.prototype, "_assignedTrigger", 2);
677
+ a([
678
+ l({ reflect: !0, type: Boolean })
679
+ ], r.prototype, "disabled", 2);
680
+ a([
681
+ l({ reflect: !0, type: Boolean })
682
+ ], r.prototype, "opened", 2);
683
+ a([
684
+ l({ reflect: !0 })
685
+ ], r.prototype, "placement", 2);
686
+ a([
687
+ l({ reflect: !0 })
688
+ ], r.prototype, "floatingStrategy", 2);
689
+ a([
690
+ l({ type: Number })
691
+ ], r.prototype, "offset", 2);
692
+ a([
693
+ l({ type: Boolean })
694
+ ], r.prototype, "sync", 2);
695
+ a([
696
+ l({ type: Number })
697
+ ], r.prototype, "maxHeight", 2);
698
+ a([
699
+ l({ type: Number })
700
+ ], r.prototype, "maxWidth", 2);
701
+ a([
702
+ l({ type: Boolean })
703
+ ], r.prototype, "hasArrow", 2);
704
+ a([
705
+ l({ type: Boolean })
706
+ ], r.prototype, "overflow", 2);
707
+ a([
708
+ l({ type: Boolean })
709
+ ], r.prototype, "fullWidth", 2);
710
+ a([
711
+ l({ type: String, reflect: !0 })
712
+ ], r.prototype, "icon", 2);
713
+ a([
714
+ l({ type: String, attribute: "aria-labelledby" })
715
+ ], r.prototype, "ariaLabelledBy", 2);
716
+ a([
717
+ l({ type: String, reflect: !0 })
718
+ ], r.prototype, "activeHref", 2);
719
+ a([
720
+ l({ type: String, reflect: !0 })
721
+ ], r.prototype, "baseHref", 2);
722
+ a([
723
+ l({ type: Boolean, reflect: !0 })
724
+ ], r.prototype, "exactHref", 2);
725
+ a([
726
+ l({ type: String, reflect: !0 })
727
+ ], r.prototype, "href", 2);
728
+ a([
729
+ l({ type: String, reflect: !0 })
730
+ ], r.prototype, "target", 2);
731
+ a([
732
+ l({ type: String, reflect: !0 })
733
+ ], r.prototype, "rel", 2);
734
+ a([
735
+ l({ type: String })
736
+ ], r.prototype, "label", 2);
737
+ a([
738
+ l({ type: Number, reflect: !0 })
739
+ ], r.prototype, "level", 2);
740
+ a([
741
+ l({ reflect: !0 })
742
+ ], r.prototype, "orientation", 2);
743
+ a([
744
+ l({ type: String })
745
+ ], r.prototype, "tabMode", 2);
746
+ a([
747
+ l()
748
+ ], r.prototype, "triggerButtonTestId", 2);
749
+ a([
731
750
  u()
732
- ], n.prototype, "hasContent", 2);
733
- r([
751
+ ], r.prototype, "hasContent", 2);
752
+ a([
734
753
  u()
735
- ], n.prototype, "hasLink", 2);
736
- r([
754
+ ], r.prototype, "hasLink", 2);
755
+ a([
737
756
  u()
738
- ], n.prototype, "hasTitleSlot", 2);
739
- r([
757
+ ], r.prototype, "hasTitleSlot", 2);
758
+ a([
740
759
  u()
741
- ], n.prototype, "_titleText", 2);
742
- r([
760
+ ], r.prototype, "_titleText", 2);
761
+ a([
743
762
  u()
744
- ], n.prototype, "active", 2);
745
- r([
763
+ ], r.prototype, "active", 2);
764
+ a([
746
765
  u()
747
- ], n.prototype, "openedByHover", 2);
748
- r([
766
+ ], r.prototype, "openedByHover", 2);
767
+ a([
749
768
  u()
750
- ], n.prototype, "_isRovingActive", 2);
751
- r([
769
+ ], r.prototype, "_isRovingActive", 2);
770
+ a([
752
771
  _("opened")
753
- ], n.prototype, "handleOpenedChange", 1);
754
- r([
772
+ ], r.prototype, "handleOpenedChange", 1);
773
+ a([
755
774
  _("activeHref")
756
- ], n.prototype, "handleActiveHrefChange", 1);
757
- r([
775
+ ], r.prototype, "handleActiveHrefChange", 1);
776
+ a([
758
777
  _("href")
759
- ], n.prototype, "handleHrefChange", 1);
760
- r([
778
+ ], r.prototype, "handleHrefChange", 1);
779
+ a([
761
780
  _(["level", "orientation"])
762
- ], n.prototype, "handleLayoutChange", 1);
781
+ ], r.prototype, "handleLayoutChange", 1);
763
782
  export {
764
- n as default
783
+ r as default
765
784
  };
766
785
  //# sourceMappingURL=navigation-menu-item.component.js.map