@orangelogic/design-system 2.207.0 → 2.208.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,37 @@
1
- import { n as c, C as p } from "../chunks/lib-cortex-element.CVMmyPMC.js";
2
- import { c as b } from "../chunks/component.styles.CRO4Odto.js";
3
- import { c as g } from "../chunks/custom-element.L4WJXn1j.js";
4
- import { L as v } from "../chunks/i18n.DbXTTLXx.js";
5
- import { i as y, x as f } from "../chunks/lit-element.jLBm65_O.js";
6
- import { r as w } from "../chunks/state.CSDxrqLd.js";
7
- import { e as x } from "../chunks/query.BBf1UFkC.js";
8
- import { n as k } from "../chunks/when.Dr1es41R.js";
9
- import M from "./menu-item.js";
10
- var d = /* @__PURE__ */ ((e) => (e.Default = "default", e.Multiple = "multiple", e))(d || {});
11
- const A = y`:host{background:var(--cx-panel-background-color);border:solid var(--cx-panel-border-width) var(--cx-panel-border-color);border-radius:var(--cx-panel-border-radius,var(--cx-border-radius-large));padding:var(--cx-panel-padding,var(--cx-spacing-x-small) 0);--divider-color:var(--cx-panel-border-color);--divider-width:var(--cx-panel-border-width);--divider-spacing:var(--cx-spacing-x-small);display:block;position:relative;overflow:auto}:host([horizontal]){padding:0 var(--cx-spacing-x-small);flex-wrap:wrap;justify-content:space-between;display:flex}::slotted(cx-divider){--color:var(--divider-color);--width:var(--divider-width);--spacing:var(--divider-spacing)}::slotted([data-alternating-grouping]):before{content:" ";background-color:var(--divider-color);margin:var(--divider-spacing) 0;height:var(--divider-width);display:block}::slotted([data-alternating-grouping=horizontal]):before{height:100%;margin:0 var(--divider-spacing);width:var(--divider-width);display:inline-block}:host([horizontal]) ::slotted(cx-menu-section){flex-wrap:wrap;justify-content:space-between;display:flex}:host([horizontal]) ::slotted(cx-menu-item){display:flex}:host([variant=multiple]){position:relative;overflow:hidden}:host([variant=multiple]) ::slotted(cx-menu[name]){opacity:0;pointer-events:none;transition:opacity var(--cx-transition-fast) ease-in-out, transform var(--cx-transition-medium) ease-in-out;border:none;top:0;left:0;transform:translate(-50%);position:absolute!important}:host([variant=multiple]) ::slotted(cx-menu[active]){opacity:1;pointer-events:auto;transform:translate(0)}.back__button::part(checked-icon),.back__button::part(submenu-icon){display:none}.back__divider{--spacing:var(--cx-spacing-x-small)}`;
12
- var I = Object.defineProperty, C = Object.getOwnPropertyDescriptor, u = (e, t, r, i) => {
13
- for (var o = i > 1 ? void 0 : i ? C(t, r) : t, h = e.length - 1, n; h >= 0; h--)
14
- (n = e[h]) && (o = (i ? n(t, r, o) : n(o)) || o);
15
- return i && o && I(t, r, o), o;
1
+ import { n as u, C as g } from "../chunks/lib-cortex-element.CVMmyPMC.js";
2
+ import { c as v } from "../chunks/component.styles.CRO4Odto.js";
3
+ import { c as y } from "../chunks/custom-element.L4WJXn1j.js";
4
+ import { L as x } from "../chunks/i18n.DbXTTLXx.js";
5
+ import { i as w, x as b } from "../chunks/lit-element.jLBm65_O.js";
6
+ import { r as k } from "../chunks/state.CSDxrqLd.js";
7
+ import { e as A } from "../chunks/query.BBf1UFkC.js";
8
+ import { n as M } from "../chunks/when.Dr1es41R.js";
9
+ import S from "./menu-item.js";
10
+ var p = /* @__PURE__ */ ((e) => (e.Default = "default", e.Multiple = "multiple", e))(p || {});
11
+ const I = w`:host{background:var(--cx-panel-background-color);border:solid var(--cx-panel-border-width) var(--cx-panel-border-color);border-radius:var(--cx-panel-border-radius,var(--cx-border-radius-large));padding:var(--cx-panel-padding,var(--cx-spacing-x-small) 0);--divider-color:var(--cx-panel-border-color);--divider-width:var(--cx-panel-border-width);--divider-spacing:var(--cx-spacing-x-small);display:block;position:relative;overflow:auto}:host([horizontal]){padding:0 var(--cx-spacing-x-small);flex-wrap:wrap;justify-content:space-between;display:flex}::slotted(cx-divider){--color:var(--divider-color);--width:var(--divider-width);--spacing:var(--divider-spacing)}::slotted([data-alternating-grouping]):before{content:" ";background-color:var(--divider-color);margin:var(--divider-spacing) 0;height:var(--divider-width);display:block}::slotted([data-alternating-grouping=horizontal]):before{height:100%;margin:0 var(--divider-spacing);width:var(--divider-width);display:inline-block}:host([horizontal]) ::slotted(cx-menu-section){flex-wrap:wrap;justify-content:space-between;display:flex}:host([horizontal]) ::slotted(cx-menu-item){display:flex}:host([variant=multiple]){position:relative;overflow:hidden}:host([variant=multiple]) ::slotted(cx-menu[name]){opacity:0;pointer-events:none;transition:opacity var(--cx-transition-fast) ease-in-out, transform var(--cx-transition-medium) ease-in-out;border:none;top:0;left:0;transform:translate(-50%);position:absolute!important}:host([variant=multiple]) ::slotted(cx-menu[active]){opacity:1;pointer-events:auto;transform:translate(0)}.back__button::part(checked-icon),.back__button::part(submenu-icon){display:none}.back__divider{--spacing:var(--cx-spacing-x-small)}`;
12
+ var E = Object.defineProperty, C = Object.getOwnPropertyDescriptor, c = (e, i, t, s) => {
13
+ for (var a = s > 1 ? void 0 : s ? C(i, t) : i, o = e.length - 1, h; o >= 0; o--)
14
+ (h = e[o]) && (a = (s ? h(i, t, a) : h(a)) || a);
15
+ return s && a && E(i, t, a), a;
16
16
  };
17
17
  function m(e) {
18
18
  return e.tagName.toLowerCase() === "cx-menu" && e instanceof l && e.getAttribute("role") === "menu";
19
19
  }
20
- let l = class extends p {
20
+ let l = class extends g {
21
21
  constructor() {
22
- super(...arguments), this.localize = new v(this), this.horizontal = !1, this.variant = d.Default, this.active = !1, this.name = "", this.back = "", this.default = !1, this.bubbleKeyDown = !1, this.ignoredKeys = [], this.disabledTabLoop = !1, this.noUncheck = !1, this.resizeObserver = null, this.slotMutationObserver = null;
22
+ super(...arguments), this.localize = new x(this), this.horizontal = !1, this.variant = p.Default, this.active = !1, this.name = "", this.back = "", this.default = !1, this.bubbleKeyDown = !1, this.ignoredKeys = [], this.disabledTabLoop = !1, this.noUncheck = !1, this.resizeObserver = null, this.slotMutationObserver = null;
23
23
  }
24
24
  connectedCallback() {
25
- super.connectedCallback(), this.slotMutationObserver = new MutationObserver(() => this.handleSlotChange()), this.slotMutationObserver.observe(this, {
26
- attributeFilter: ["inert", "is-empty"],
25
+ super.connectedCallback(), this.slotMutationObserver = new MutationObserver((e) => {
26
+ if (e.every(
27
+ (t) => t.type === "attributes" && (t.attributeName === "checked" || t.attributeName === "active")
28
+ )) {
29
+ this.syncTabIndexToSelection();
30
+ return;
31
+ }
32
+ this.handleSlotChange();
33
+ }), this.slotMutationObserver.observe(this, {
34
+ attributeFilter: ["active", "checked", "inert", "is-empty"],
27
35
  attributes: !0,
28
36
  subtree: !0
29
37
  });
@@ -32,7 +40,7 @@ let l = class extends p {
32
40
  super.disconnectedCallback(), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.slotMutationObserver && (this.slotMutationObserver.disconnect(), this.slotMutationObserver = null);
33
41
  }
34
42
  runFirstUpdated() {
35
- if (this.setAttribute("role", "menu"), this.variant === d.Multiple) {
43
+ if (this.setAttribute("role", "menu"), this.variant === p.Multiple) {
36
44
  const e = this.getAllSubMenus();
37
45
  this.setActiveMenu(e[0]?.name ?? ""), this.updateComplete.then(() => {
38
46
  this.adjustMenuSize();
@@ -40,154 +48,161 @@ let l = class extends p {
40
48
  }
41
49
  }
42
50
  handleClick(e) {
43
- const t = ["menuitem", "menuitemcheckbox"], r = e.composedPath(), i = r.find(
44
- (a) => t.includes(a?.getAttribute?.("role") || "")
51
+ const i = ["menuitem", "menuitemcheckbox"], t = e.composedPath(), s = t.find(
52
+ (n) => i.includes(n?.getAttribute?.("role") || "")
45
53
  );
46
- if (!i)
54
+ if (!s)
47
55
  return;
48
- const o = i.menu;
49
- if (o) {
50
- this.setActiveMenu(o);
56
+ const a = s.menu;
57
+ if (a) {
58
+ this.setActiveMenu(a);
51
59
  return;
52
60
  }
53
- if (r.find(
54
- (a) => a?.getAttribute?.("role") === "menu"
61
+ if (t.find(
62
+ (n) => n?.getAttribute?.("role") === "menu"
55
63
  ) !== this)
56
64
  return;
57
- const s = i;
58
- s.type === "checkbox" && (s.checked && (this.noUncheck || s.noUncheck) || (s.checked = !s.checked)), this.emit("cx-select", { detail: { item: s } });
65
+ const d = s;
66
+ d.type === "checkbox" && (d.checked && (this.noUncheck || d.noUncheck) || (d.checked = !d.checked)), this.emit("cx-select", { detail: { item: d } });
59
67
  }
60
68
  handleKeyDown(e) {
61
- if (!this.ignoredKeys.includes(e.key)) {
62
- if (this.isMenuItem(e.target) && (e.key === "Enter" || e.key === " ")) {
63
- const t = this.getCurrentItem();
64
- e.preventDefault(), this.bubbleKeyDown || e.stopPropagation(), t?.click();
65
- } else if ([
66
- "Home",
67
- "End",
68
- "Tab",
69
- "ArrowDown",
70
- "ArrowUp",
71
- "ArrowLeft",
72
- "ArrowRight"
73
- ].includes(e.key)) {
74
- const t = this.getAllItems(), r = this.getCurrentItem();
75
- let i = r ? t.indexOf(r) : 0;
76
- if (["ArrowLeft", "ArrowRight"].includes(e.key) && !this.bubbleKeyDown && !(this.parentElement instanceof l) && !(this.parentElement instanceof M) && e.stopPropagation(), t.length > 0) {
77
- const o = this.horizontal ? e.key === "ArrowRight" || i === t.length - 1 && e.key === "ArrowDown" : e.key === "ArrowDown", h = this.horizontal ? e.key === "ArrowLeft" || i === 0 && e.key === "ArrowUp" : e.key === "ArrowUp";
78
- if (["ArrowRight", "ArrowDown", "ArrowLeft", "ArrowUp"].includes(
79
- e.key
80
- ) && !o && !h)
81
- return;
82
- if (this.bubbleKeyDown || e.stopPropagation(), o || e.key === "Tab" && !e.shiftKey)
83
- i++;
84
- else if (h || e.key === "Tab" && e.shiftKey)
85
- i--;
86
- else if (e.key === "Home") {
87
- e.preventDefault();
88
- let n = this.parentElement?.firstElementChild;
89
- for (; n && !m(n); )
90
- n = n.nextElementSibling;
91
- if (n) {
92
- const s = n.getAllItems();
93
- if (s.length > 0) {
94
- n.setCurrentItem(s[0]), s[0].focus();
95
- return;
96
- }
69
+ if (this.ignoredKeys.includes(e.key))
70
+ return;
71
+ const i = e.target, t = this.isMenuItem(i) ? i : void 0;
72
+ if (t && (e.key === "Enter" || e.key === " "))
73
+ e.preventDefault(), this.bubbleKeyDown || e.stopPropagation(), t.click();
74
+ else if ([
75
+ "Home",
76
+ "End",
77
+ "ArrowDown",
78
+ "ArrowUp",
79
+ "ArrowLeft",
80
+ "ArrowRight"
81
+ ].includes(e.key)) {
82
+ const s = this.getAllItems(), a = t ? s.indexOf(t) : -1;
83
+ let o = a === -1 ? s.findIndex((h) => h.getAttribute("tabindex") === "0") : a;
84
+ if (o === -1 && (o = 0), ["ArrowLeft", "ArrowRight"].includes(e.key) && !this.bubbleKeyDown && !(this.parentElement instanceof l) && !(this.parentElement instanceof S) && e.stopPropagation(), s.length > 0) {
85
+ const h = this.horizontal ? e.key === "ArrowRight" || o === s.length - 1 && e.key === "ArrowDown" : e.key === "ArrowDown", d = this.horizontal ? e.key === "ArrowLeft" || o === 0 && e.key === "ArrowUp" : e.key === "ArrowUp";
86
+ if (["ArrowRight", "ArrowDown", "ArrowLeft", "ArrowUp"].includes(
87
+ e.key
88
+ ) && !h && !d)
89
+ return;
90
+ if (this.bubbleKeyDown || e.stopPropagation(), h)
91
+ o++;
92
+ else if (d)
93
+ o--;
94
+ else if (e.key === "Home") {
95
+ e.preventDefault();
96
+ let n = this.parentElement?.firstElementChild;
97
+ for (; n && !m(n); )
98
+ n = n.nextElementSibling;
99
+ if (n) {
100
+ const r = n.getAllItems();
101
+ if (r.length > 0) {
102
+ r[0].focus();
103
+ return;
97
104
  }
98
- i = 0;
99
- } else if (e.key === "End") {
100
- e.preventDefault();
101
- let n = this.parentElement?.lastElementChild;
102
- for (; n && !m(n); )
103
- n = n.previousElementSibling;
104
- if (n) {
105
- const s = n.getAllItems();
106
- if (s.length > 0) {
107
- n.setCurrentItem(s[s.length - 1]), s[s.length - 1].focus();
108
- return;
109
- }
105
+ }
106
+ o = 0;
107
+ } else if (e.key === "End") {
108
+ e.preventDefault();
109
+ let n = this.parentElement?.lastElementChild;
110
+ for (; n && !m(n); )
111
+ n = n.previousElementSibling;
112
+ if (n) {
113
+ const r = n.getAllItems();
114
+ if (r.length > 0) {
115
+ r[r.length - 1].focus();
116
+ return;
110
117
  }
111
- i = 0;
112
118
  }
113
- if (i < 0 && !this.disabledTabLoop) {
114
- e.preventDefault();
115
- let n = this.previousElementSibling;
116
- for (; n && !m(n); )
117
- n = n.previousElementSibling;
118
- if (n) {
119
- const s = n.getAllItems();
120
- if (s.length > 0) {
121
- n.setCurrentItem(
122
- s[s.length - 1]
123
- ), s[s.length - 1].focus();
119
+ o = 0;
120
+ }
121
+ if (o < 0 && !this.disabledTabLoop) {
122
+ e.preventDefault();
123
+ let n = this.previousElementSibling;
124
+ for (; n && !m(n); )
125
+ n = n.previousElementSibling;
126
+ if (n) {
127
+ const r = n.getAllItems();
128
+ if (r.length > 0) {
129
+ r[r.length - 1].focus();
130
+ return;
131
+ }
132
+ } else {
133
+ let r = this.parentElement?.lastElementChild;
134
+ for (; r && !m(r); )
135
+ r = r.previousElementSibling;
136
+ if (r) {
137
+ const f = r.getAllItems();
138
+ if (f.length > 0) {
139
+ f[f.length - 1].focus();
124
140
  return;
125
141
  }
126
- } else {
127
- let s = this.parentElement?.lastElementChild;
128
- for (; s && !m(s); )
129
- s = s.previousElementSibling;
130
- if (s) {
131
- const a = s.getAllItems();
132
- if (a.length > 0) {
133
- s.setCurrentItem(a[a.length - 1]), a[a.length - 1].focus();
134
- return;
135
- }
136
- }
137
- i = 0;
138
142
  }
143
+ o = 0;
139
144
  }
140
- if (i > t.length - 1 && !this.disabledTabLoop) {
141
- e.preventDefault();
142
- let n = this.nextElementSibling;
143
- for (; n && !m(n); )
144
- n = n.nextElementSibling;
145
- if (n) {
146
- const s = n.getAllItems();
147
- if (s.length > 0) {
148
- n.setCurrentItem(s[0]), s[0].focus();
145
+ }
146
+ if (o > s.length - 1 && !this.disabledTabLoop) {
147
+ e.preventDefault();
148
+ let n = this.nextElementSibling;
149
+ for (; n && !m(n); )
150
+ n = n.nextElementSibling;
151
+ if (n) {
152
+ const r = n.getAllItems();
153
+ if (r.length > 0) {
154
+ r[0].focus();
155
+ return;
156
+ }
157
+ } else {
158
+ let r = this.parentElement?.firstElementChild;
159
+ for (; r && !m(r); )
160
+ r = r.nextElementSibling;
161
+ if (r) {
162
+ const f = r.getAllItems();
163
+ if (f.length > 0) {
164
+ f[0].focus();
149
165
  return;
150
166
  }
151
- } else {
152
- let s = this.parentElement?.firstElementChild;
153
- for (; s && !m(s); )
154
- s = s.nextElementSibling;
155
- if (s) {
156
- const a = s.getAllItems();
157
- if (a.length > 0) {
158
- s.setCurrentItem(a[0]), a[0].focus();
159
- return;
160
- }
161
- }
162
- i = 0;
163
167
  }
168
+ o = 0;
164
169
  }
165
- if (i < 0 || i > t.length - 1)
166
- return;
167
- e.preventDefault(), this.setCurrentItem(t[i]), t[i].focus();
168
170
  }
171
+ if (o < 0 || o > s.length - 1)
172
+ return;
173
+ e.preventDefault(), s[o].focus();
169
174
  }
170
175
  }
171
176
  }
172
- handleMouseDown(e) {
173
- const t = e.target;
174
- this.isMenuItem(t) && this.setCurrentItem(t);
175
- }
176
177
  handleSlotChange() {
177
- const e = this.getAllItems();
178
- e.length > 0 && this.setCurrentItem(e[0]);
179
- let t = null;
180
- this.defaultSlot.assignedElements().filter((r) => {
181
- const i = r;
182
- return this.isMenuItem(i) || this.isMenuSection(i);
183
- }).forEach((r) => {
184
- const i = r, o = !i.inert && !i.hasAttribute("is-empty");
185
- t && o && (this.isMenuSection(t) && this.isMenuItem(i) || this.isMenuSection(i) && i.childElementCount > 0) ? i.setAttribute(
178
+ this.syncTabIndexToSelection();
179
+ let e = null;
180
+ this.defaultSlot.assignedElements().filter((i) => {
181
+ const t = i;
182
+ return this.isMenuItem(t) || this.isMenuSection(t);
183
+ }).forEach((i) => {
184
+ const t = i, s = !t.inert && !t.hasAttribute("is-empty");
185
+ e && s && (this.isMenuSection(e) && this.isMenuItem(t) || this.isMenuSection(t) && t.childElementCount > 0) ? t.setAttribute(
186
186
  "data-alternating-grouping",
187
187
  this.horizontal ? "horizontal" : ""
188
- ) : i.removeAttribute("data-alternating-grouping"), o && (t = i);
188
+ ) : t.removeAttribute("data-alternating-grouping"), s && (e = t);
189
189
  });
190
190
  }
191
+ /** Sets `tabindex="0"` on the selected item (`checked`/`active`), or the first item if none is selected. */
192
+ syncTabIndexToSelection() {
193
+ const e = this.getAllItems();
194
+ if (e.length === 0)
195
+ return;
196
+ let i;
197
+ for (const t of e)
198
+ t.setAttribute("tabindex", "-1"), !i && (t.checked || t.active) && (i = t);
199
+ (i ?? e[0]).setAttribute("tabindex", "0");
200
+ }
201
+ /** Moves `tabindex="0"` directly to `item`; used by `setCurrentItem()` for explicit external placement. */
202
+ setRovingTabIndex(e) {
203
+ for (const i of this.getAllItems())
204
+ i.setAttribute("tabindex", i === e ? "0" : "-1");
205
+ }
191
206
  isMenuSection(e) {
192
207
  return e instanceof HTMLElement ? e.tagName.toLowerCase() === "cx-menu-section" : !1;
193
208
  }
@@ -198,39 +213,39 @@ let l = class extends p {
198
213
  }
199
214
  /** @internal Gets all slotted menu items, ignoring dividers, headers, and other elements. */
200
215
  getAllItems() {
201
- return this.defaultSlot.assignedElements({ flatten: !0 }).flatMap((t) => {
202
- if (this.isMenuSection(t)) {
203
- const r = t.shadowRoot?.querySelector("slot");
204
- return r ? [...r.assignedElements({ flatten: !0 })] : [];
216
+ return this.defaultSlot.assignedElements({ flatten: !0 }).flatMap((i) => {
217
+ if (this.isMenuSection(i)) {
218
+ const t = i.shadowRoot?.querySelector("slot");
219
+ return t ? [...t.assignedElements({ flatten: !0 })] : [];
205
220
  }
206
- return t;
207
- }).filter((t) => !(t.inert || !this.isMenuItem(t)));
221
+ return i;
222
+ }).filter((i) => !(i.inert || !this.isMenuItem(i)));
208
223
  }
209
224
  /** @internal Gets all slotted submenus, used for 'multiple' variant */
210
225
  getAllSubMenus() {
211
226
  return [...this.querySelectorAll("cx-menu")];
212
227
  }
213
228
  setActiveMenu(e) {
214
- const t = this.getAllSubMenus();
215
- let r = null;
216
- t.forEach((i) => {
217
- i.name === e ? (i.active = !0, r = i) : i.active = !1;
218
- }), this.adjustMenuSize(), r && (this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.resizeObserver = new ResizeObserver(() => {
229
+ const i = this.getAllSubMenus();
230
+ let t = null;
231
+ i.forEach((s) => {
232
+ s.name === e ? (s.active = !0, t = s) : s.active = !1;
233
+ }), this.adjustMenuSize(), t && (this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.resizeObserver = new ResizeObserver(() => {
219
234
  this.adjustMenuSize();
220
- }), this.resizeObserver.observe(r));
235
+ }), this.resizeObserver.observe(t));
221
236
  }
222
237
  async adjustMenuSize(e = 250) {
223
- const t = this.getActiveMenu();
224
- if (t) {
225
- await t.updateComplete;
226
- const r = t.offsetWidth, i = t.offsetHeight;
238
+ const i = this.getActiveMenu();
239
+ if (i) {
240
+ await i.updateComplete;
241
+ const t = i.offsetWidth, s = i.offsetHeight;
227
242
  this.animate(
228
243
  [
229
244
  {
230
- height: this.style.height ?? `${i}px`,
231
- width: this.style.width ?? `${r}px`
245
+ height: this.style.height ?? `${s}px`,
246
+ width: this.style.width ?? `${t}px`
232
247
  },
233
- { height: `${i}px`, width: `${r}px` }
248
+ { height: `${s}px`, width: `${t}px` }
234
249
  // Fade out
235
250
  ],
236
251
  {
@@ -242,64 +257,52 @@ let l = class extends p {
242
257
  this.style.width = "", this.style.height = "";
243
258
  }
244
259
  resetActiveMenu() {
245
- this.getAllSubMenus().forEach((t) => {
246
- t.default && this.setActiveMenu(t.name);
260
+ this.getAllSubMenus().forEach((i) => {
261
+ i.default && this.setActiveMenu(i.name);
247
262
  });
248
263
  }
249
264
  getActiveMenu() {
250
- return this.getAllSubMenus().find((t) => t.active) || void 0;
265
+ return this.getAllSubMenus().find((i) => i.active) || void 0;
251
266
  }
252
- /**
253
- * @internal Gets the current menu item, which is the menu item that has `tabindex="0"` within the roving tab index.
254
- * The menu item may or may not have focus, but for keyboard interaction purposes it's considered the "active" item.
255
- */
256
- getCurrentItem() {
257
- return this.getAllItems().find((e) => e.getAttribute("tabindex") === "0");
258
- }
259
- /**
260
- * @internal Sets the current menu item to the specified element. This sets `tabindex="0"` on the target element and
261
- * `tabindex="-1"` to all other items. This method must be called prior to setting focus on a menu item.
262
- */
267
+ /** @internal Sets `tabindex="0"` on `item` and `tabindex="-1"` on all others. Call before focusing a menu item. */
263
268
  setCurrentItem(e) {
264
- this.getAllItems().forEach((r) => {
265
- r.setAttribute("tabindex", r === e ? "0" : "-1");
266
- });
269
+ this.setRovingTabIndex(e);
267
270
  }
268
271
  render() {
269
- const e = k(
272
+ const e = M(
270
273
  this.back,
271
- () => f`<slot name="back-button" role="menuitem" menu=${this.back}><cx-menu-item part="back-button" class="back__button" menu=${this.back}><cx-icon slot="prefix" name="chevron_left"></cx-icon>${this.localize.term("back")}</cx-menu-item><cx-divider class="back__divider"></cx-divider></slot>`
274
+ () => b`<slot name="back-button" role="menuitem" menu=${this.back}><cx-menu-item part="back-button" class="back__button" menu=${this.back}><cx-icon slot="prefix" name="chevron_left"></cx-icon>${this.localize.term("back")}</cx-menu-item><cx-divider class="back__divider"></cx-divider></slot>`
272
275
  );
273
- return this.variant === d.Multiple ? f`${e}<slot @slotchange=${this.handleSlotChange} @click=${this.handleClick} @keydown=${this.handleKeyDown} @mousedown=${this.handleMouseDown}></slot>` : f`${e}<slot @slotchange=${this.handleSlotChange} @click=${this.handleClick} @keydown=${this.handleKeyDown} @mousedown=${this.handleMouseDown}></slot>`;
276
+ return this.variant === p.Multiple ? b`${e}<slot @slotchange=${this.handleSlotChange} @click=${this.handleClick} @keydown=${this.handleKeyDown}></slot>` : b`${e}<slot @slotchange=${this.handleSlotChange} @click=${this.handleClick} @keydown=${this.handleKeyDown}></slot>`;
274
277
  }
275
278
  };
276
- l.styles = [b, A];
277
- u([
278
- x("slot")
279
+ l.styles = [v, I];
280
+ c([
281
+ A("slot:not([name])")
279
282
  ], l.prototype, "defaultSlot", 2);
280
- u([
281
- c({ type: Boolean })
283
+ c([
284
+ u({ type: Boolean })
282
285
  ], l.prototype, "horizontal", 2);
283
- u([
284
- c({ reflect: !0 })
286
+ c([
287
+ u({ reflect: !0 })
285
288
  ], l.prototype, "variant", 2);
286
- u([
287
- c({ reflect: !0, type: Boolean })
289
+ c([
290
+ u({ reflect: !0, type: Boolean })
288
291
  ], l.prototype, "active", 2);
289
- u([
290
- c({ reflect: !0 })
292
+ c([
293
+ u({ reflect: !0 })
291
294
  ], l.prototype, "name", 2);
292
- u([
293
- c({ reflect: !0 })
295
+ c([
296
+ u({ reflect: !0 })
294
297
  ], l.prototype, "back", 2);
295
- u([
296
- c({ reflect: !0, type: Boolean })
298
+ c([
299
+ u({ reflect: !0, type: Boolean })
297
300
  ], l.prototype, "default", 2);
298
- u([
299
- c({ attribute: "bubble-keydown", reflect: !0, type: Boolean })
301
+ c([
302
+ u({ attribute: "bubble-keydown", reflect: !0, type: Boolean })
300
303
  ], l.prototype, "bubbleKeyDown", 2);
301
- u([
302
- c({
304
+ c([
305
+ u({
303
306
  attribute: "ignored-keys",
304
307
  converter: {
305
308
  fromAttribute: (e) => e?.split(" ") ?? [],
@@ -308,17 +311,17 @@ u([
308
311
  type: String
309
312
  })
310
313
  ], l.prototype, "ignoredKeys", 2);
311
- u([
312
- c({ attribute: "disabled-tab-loop", reflect: !0, type: Boolean })
314
+ c([
315
+ u({ attribute: "disabled-tab-loop", reflect: !0, type: Boolean })
313
316
  ], l.prototype, "disabledTabLoop", 2);
314
- u([
315
- c({ attribute: "no-uncheck", reflect: !0, type: Boolean })
317
+ c([
318
+ u({ attribute: "no-uncheck", reflect: !0, type: Boolean })
316
319
  ], l.prototype, "noUncheck", 2);
317
- u([
318
- w()
320
+ c([
321
+ k()
319
322
  ], l.prototype, "resizeObserver", 2);
320
- l = u([
321
- g("cx-menu")
323
+ l = c([
324
+ y("cx-menu")
322
325
  ], l);
323
326
  export {
324
327
  l as default