@vonage/vivid 5.3.0 → 5.4.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.
Files changed (157) hide show
  1. package/accordion-item/definition.js +1 -1
  2. package/alert/definition.cjs +1 -1
  3. package/alert/definition.js +2 -2
  4. package/badge/definition.js +1 -1
  5. package/banner/definition.js +1 -1
  6. package/bundled/calendar-picker.template.cjs +7 -7
  7. package/bundled/calendar-picker.template.js +101 -101
  8. package/bundled/definition11.cjs +13 -13
  9. package/bundled/definition11.js +202 -50
  10. package/bundled/definition19.cjs +24 -25
  11. package/bundled/definition19.js +152 -164
  12. package/bundled/definition6.cjs +3 -3
  13. package/bundled/definition6.js +19 -19
  14. package/bundled/definition9.cjs +5 -5
  15. package/bundled/definition9.js +394 -392
  16. package/bundled/listbox.cjs +1 -1
  17. package/bundled/listbox.js +82 -102
  18. package/bundled/localized.cjs +1 -1
  19. package/bundled/localized.js +18 -14
  20. package/bundled/vivid-element.cjs +5 -1
  21. package/bundled/vivid-element.js +401 -358
  22. package/calendar/index.cjs +1 -1
  23. package/calendar/index.js +14 -14
  24. package/card/definition.cjs +1 -1
  25. package/card/definition.js +1 -1
  26. package/color-picker/definition.cjs +1 -1
  27. package/color-picker/definition.js +1 -1
  28. package/combobox/definition.cjs +7 -27
  29. package/combobox/definition.js +8 -28
  30. package/combobox/index.cjs +6 -6
  31. package/combobox/index.js +57 -71
  32. package/custom-elements.json +305 -2
  33. package/date-picker/definition.cjs +1 -1
  34. package/date-picker/definition.js +1 -1
  35. package/date-range-picker/definition.cjs +1 -1
  36. package/date-range-picker/definition.js +1 -1
  37. package/date-time-picker/definition.cjs +1 -1
  38. package/date-time-picker/definition.js +1 -1
  39. package/dialog/definition.cjs +2 -2
  40. package/dialog/definition.js +2 -2
  41. package/dialog/index.cjs +7 -7
  42. package/dialog/index.js +6 -6
  43. package/elevation/definition.cjs +1 -1
  44. package/elevation/definition.js +1 -1
  45. package/fab/definition.js +1 -1
  46. package/header/definition.cjs +1 -1
  47. package/header/definition.js +1 -1
  48. package/index.cjs +3 -4
  49. package/index.js +2 -3
  50. package/lib/accordion/accordion.d.ts +1 -1
  51. package/lib/accordion/definition.d.ts +1 -1
  52. package/lib/audio-player/audio-player.d.ts +1 -1
  53. package/lib/combobox/combobox.d.ts +1 -0
  54. package/lib/combobox/combobox.options.d.ts +1 -1
  55. package/lib/divider/divider.d.ts +1 -1
  56. package/lib/menu-item/menu-item-role.d.ts +1 -1
  57. package/lib/popup/popup.d.ts +1 -1
  58. package/lib/searchable-select/locale.d.ts +4 -0
  59. package/lib/searchable-select/searchable-select.d.ts +3 -0
  60. package/lib/select/select.d.ts +3 -1
  61. package/lib/slider/slider.d.ts +1 -1
  62. package/lib/tabs/tabs.d.ts +2 -2
  63. package/lib/text-area/text-area.d.ts +1 -1
  64. package/lib/text-field/text-field.d.ts +1 -1
  65. package/locales/de-DE.cjs +4 -0
  66. package/locales/de-DE.js +4 -0
  67. package/locales/en-GB.cjs +4 -0
  68. package/locales/en-GB.js +4 -0
  69. package/locales/en-US.cjs +4 -0
  70. package/locales/en-US.js +4 -0
  71. package/locales/ja-JP.cjs +4 -0
  72. package/locales/ja-JP.js +4 -0
  73. package/locales/zh-CN.cjs +4 -0
  74. package/locales/zh-CN.js +4 -0
  75. package/menu/definition.cjs +4 -4
  76. package/menu/definition.js +4 -4
  77. package/nav-disclosure/definition.js +1 -1
  78. package/nav-item/definition.js +1 -1
  79. package/note/definition.js +1 -1
  80. package/number-field/definition.js +1 -1
  81. package/option/definition.cjs +6 -77
  82. package/option/definition.js +3 -78
  83. package/package.json +31 -5
  84. package/popup/definition.cjs +2 -2
  85. package/popup/definition.js +2 -2
  86. package/range-slider/definition.cjs +1 -1
  87. package/range-slider/definition.js +1 -1
  88. package/rich-text-editor/definition.cjs +2 -3
  89. package/rich-text-editor/definition.js +1 -2
  90. package/rich-text-editor/index.cjs +27 -27
  91. package/rich-text-editor/index.js +1208 -1198
  92. package/searchable-select/definition.cjs +103 -11
  93. package/searchable-select/definition.js +103 -11
  94. package/searchable-select/index.cjs +81 -69
  95. package/searchable-select/index.js +359 -273
  96. package/select/definition.cjs +24 -41
  97. package/select/definition.js +24 -41
  98. package/selectable-box/definition.cjs +1 -1
  99. package/selectable-box/definition.js +1 -1
  100. package/selectable-box/index.cjs +1 -1
  101. package/selectable-box/index.js +1 -1
  102. package/shared/aria/aria-mixin.d.ts +1 -1
  103. package/shared/foundation/listbox/listbox.d.ts +4 -0
  104. package/simple-color-picker/definition.cjs +1 -1
  105. package/simple-color-picker/definition.js +1 -1
  106. package/slider/definition.cjs +1 -1
  107. package/slider/definition.js +1 -1
  108. package/split-button/definition.js +1 -1
  109. package/styles/core/all.css +1 -1
  110. package/styles/core/theme.css +1 -1
  111. package/styles/core/typography.css +1 -1
  112. package/styles/tokens/theme-dark.css +4 -4
  113. package/styles/tokens/theme-light.css +4 -4
  114. package/styles/tokens/vivid-2-compat.css +1 -1
  115. package/tab/definition.js +1 -1
  116. package/tag/definition.js +1 -1
  117. package/text-field/definition.js +1 -1
  118. package/time-picker/definition.cjs +1 -1
  119. package/time-picker/definition.js +1 -1
  120. package/toggletip/definition.cjs +1 -1
  121. package/toggletip/definition.js +1 -1
  122. package/tooltip/definition.cjs +1 -1
  123. package/tooltip/definition.js +1 -1
  124. package/tree-item/definition.cjs +1 -1
  125. package/tree-item/definition.js +1 -1
  126. package/tree-view/definition.cjs +1 -1
  127. package/tree-view/definition.js +1 -1
  128. package/unbundled/affix.js +1 -1
  129. package/unbundled/calendar-picker.template.cjs +1 -1
  130. package/unbundled/calendar-picker.template.js +1 -1
  131. package/unbundled/definition.js +1 -1
  132. package/unbundled/definition2.js +1 -1
  133. package/unbundled/definition3.cjs +222 -141
  134. package/unbundled/definition3.js +220 -139
  135. package/unbundled/definition4.cjs +145 -235
  136. package/unbundled/definition4.js +143 -233
  137. package/unbundled/definition5.cjs +269 -27
  138. package/unbundled/definition5.js +267 -26
  139. package/unbundled/definition6.cjs +56 -0
  140. package/unbundled/definition6.js +52 -0
  141. package/unbundled/listbox.cjs +41 -63
  142. package/unbundled/listbox.js +39 -61
  143. package/unbundled/picker-field.template.cjs +1 -1
  144. package/unbundled/picker-field.template.js +1 -1
  145. package/unbundled/slider.template.cjs +1 -1
  146. package/unbundled/slider.template.js +1 -1
  147. package/unbundled/vivid-element.cjs +1 -1
  148. package/unbundled/vivid-element.js +1 -1
  149. package/video-player/definition.cjs +56 -16
  150. package/video-player/definition.js +56 -16
  151. package/video-player/index.cjs +36 -36
  152. package/video-player/index.js +2461 -2445
  153. package/vivid.api.json +285 -38
  154. package/bundled/option.cjs +0 -1
  155. package/bundled/option.js +0 -158
  156. package/unbundled/option.cjs +0 -217
  157. package/unbundled/option.js +0 -214
@@ -1,45 +1,44 @@
1
1
  import { P as C, p as A } from "./definition9.js";
2
- import { i as H } from "./definition2.js";
3
- import { l as D } from "./definition11.js";
4
- import { U as E, O as u, o as c, a as p, v as V, h, c as F, d as z } from "./vivid-element.js";
5
- import { a as T, f as W } from "./mixins.js";
6
- import { L as m } from "./listbox.js";
7
- import { H as L, a as P } from "./host-semantics.js";
8
- import { F as B } from "./form-associated.js";
2
+ import { i as D } from "./definition2.js";
3
+ import { L as H, l as E } from "./definition11.js";
4
+ import { U as V, O as u, o as p, a as c, v as F, h, c as z, d as T } from "./vivid-element.js";
5
+ import { a as W, f as L } from "./mixins.js";
6
+ import { L as S } from "./listbox.js";
7
+ import { H as P, a as B } from "./host-semantics.js";
8
+ import { F as N } from "./form-associated.js";
9
9
  import { i as v } from "./numbers.js";
10
10
  import { W as M } from "./with-contextual-help.js";
11
- import { W as N } from "./with-error-text.js";
12
- import { W as j } from "./with-success-text.js";
13
- import { F as K } from "./form-element.js";
14
- import { A as R, a as U, I as q } from "./affix.js";
15
- import { u as X } from "./strings.js";
16
- import { l as _, d as k, m as O, k as I, c as w, b as S, a as $, f as G } from "./key-codes.js";
17
- import { L as J } from "./option.js";
11
+ import { W as j } from "./with-error-text.js";
12
+ import { W as K } from "./with-success-text.js";
13
+ import { F as R } from "./form-element.js";
14
+ import { A as U, a as q, I as X } from "./affix.js";
15
+ import { u as G } from "./strings.js";
16
+ import { l as g, d as y, m as _, k, c as I, b as O, a as w, f as J } from "./key-codes.js";
18
17
  import { c as Q } from "./definition3.js";
19
18
  import { h as Y } from "./index.js";
20
- import { r as f } from "./ref.js";
21
- import { w as b } from "./when.js";
22
- import { s as g } from "./slotted.js";
19
+ import { r as b } from "./ref.js";
20
+ import { w as f } from "./when.js";
21
+ import { s as x } from "./slotted.js";
23
22
  import { c as Z } from "./class-names.js";
24
23
  const ee = ".chevron{display:flex;flex-shrink:0;font:var(--vvd-typography-base-extended);transform:rotate(0);transition:transform .2s}:host([data-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{display:inline-flex;flex-direction:column;gap:4px;--_low-ink-color: var(--vvd-color-neutral-600);--focus-stroke-gap-color: transparent}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);contain:inline-size;font:var(--vvd-typography-base)}.control{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-500)}.control.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media (hover: hover){.control:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-700)}.control:hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.control.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-700)}.control.hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.control:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.control:disabled.appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.control.disabled.appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control.readonly:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.control.readonly:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control.error:where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.control.error:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.control.success:where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.control.success:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.control{--_connotation-color-primary: var(--vvd-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-faint: var(--vvd-select-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-select-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-select-accent-fierce, var(--vvd-color-neutral-700))}.control{border-radius:var(--_select-control-border-radius);block-size:var(--_select-block-size);padding-inline:var(--_select-padding-inline)}.control{--_select-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_select-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_select-padding-inline: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;display:flex;align-items:center;justify-content:space-between;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;transition:box-shadow .2s,background-color .2s}.control.size-condensed{--_select-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_select-block-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_select-padding-inline: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) }.control.size-condensed:not(.shape-pill){--_select-control-border-radius: 4px}.control-wrapper{position:relative}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.control:not(.shape-pill){--_select-control-border-radius: 8px}.control.shape-pill{--_select-control-border-radius: 24px}:host(:focus-visible) .control{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.listbox{display:flex;max-height:var(--select-height, 408px);flex-direction:column;padding:4px;gap:2px;overflow-y:auto}:host([multiple]:focus-visible) .listbox{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));border-radius:8px}.selected-value{display:flex;overflow:hidden;flex-grow:1;align-items:center;column-gap:12px;white-space:nowrap}.selected-value .text{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis}.control.shows-placeholder .selected-value .text{color:var(--vvd-color-neutral-600)}.selected-value slot[name=icon]{flex:0 0 var(--_select-icon-size);font-size:var(--_select-icon-size);line-height:1}.control.has-meta .selected-value{padding-inline-end:8px}.feedback-wrapper{display:contents}::part(popup-base){inline-size:max-content;min-inline-size:var(--_select-fixed-width, 100%)}:host([multiple]) ::part(popup-base){position:static}.label-wrapper{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:var(--label-wrapper-gap, 8px)}.label-wrapper[hidden]{display:none}.label-wrapper .label{flex:1 1 auto}.label-wrapper slot[name=contextual-help]::slotted([data-vvd-component=contextual-help]){margin-inline-start:auto}";
25
- var te = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, n = (a, e, t, o) => {
26
- for (var i = o > 1 ? void 0 : o ? oe(e, t) : e, l = a.length - 1, s; l >= 0; l--)
27
- (s = a[l]) && (i = (o ? s(e, t, i) : s(i)) || i);
28
- return o && i && te(e, t, i), i;
24
+ var te = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, l = (n, e, t, o) => {
25
+ for (var a = o > 1 ? void 0 : o ? oe(e, t) : e, r = n.length - 1, s; r >= 0; r--)
26
+ (s = n[r]) && (a = (o ? s(e, t, a) : s(a)) || a);
27
+ return o && a && te(e, t, a), a;
29
28
  };
30
- class r extends T(
29
+ class i extends W(
31
30
  M(
32
- N(
33
- j(
34
- K(
35
- L(R(B(m)))
31
+ j(
32
+ K(
33
+ R(
34
+ P(U(N(S)))
36
35
  )
37
36
  )
38
37
  )
39
38
  )
40
39
  ) {
41
40
  constructor() {
42
- super(...arguments), this.proxy = document.createElement("select"), this.activeIndex = -1, this.rangeStartIndex = -1, this.open = !1, this.listboxId = X("listbox-"), this.maxHeight = 0, this.fixedDropdown = !1, this.placeholderOption = null, this._feedbackWrapper = null;
41
+ super(...arguments), this.proxy = document.createElement("select"), this.activeIndex = -1, this.rangeStartIndex = -1, this.open = !1, this.listboxId = G("listbox-"), this.maxHeight = 0, this.fixedDropdown = !1, this._feedbackWrapper = null;
43
42
  }
44
43
  /**
45
44
  * Returns the last checked option.
@@ -200,8 +199,8 @@ class r extends T(
200
199
  return;
201
200
  }
202
201
  if (this.$fastController.isConnected) {
203
- const o = this.getTypeaheadMatches(), i = this.options.indexOf(o[0]);
204
- i > -1 && (this.activeIndex = i, this.uncheckAllOptions(), this.checkActiveIndex()), this.typeaheadExpired = !1;
202
+ const o = this.getTypeaheadMatches(), a = this.options.indexOf(o[0]);
203
+ a > -1 && (this.activeIndex = a, this.uncheckAllOptions(), this.checkActiveIndex()), this.typeaheadExpired = !1;
205
204
  }
206
205
  }
207
206
  /**
@@ -226,11 +225,11 @@ class r extends T(
226
225
  if (!this.collapsible)
227
226
  return;
228
227
  if (this.open) {
229
- this.focusAndScrollOptionIntoView(), this.indexWhenOpened = this.selectedIndex, E.enqueue(() => this.focus());
228
+ this.focusAndScrollOptionIntoView(), this.indexWhenOpened = this.selectedIndex, V.enqueue(() => this.focus());
230
229
  return;
231
230
  }
232
- const o = e === !0 && t === !1, i = this.indexWhenOpened !== this.selectedIndex;
233
- o && i && this.updateValue(!0);
231
+ const o = e === !0 && t === !1, a = this.indexWhenOpened !== this.selectedIndex;
232
+ o && a && this.updateValue(!0);
234
233
  }
235
234
  get collapsible() {
236
235
  return !this.multiple;
@@ -239,16 +238,8 @@ class r extends T(
239
238
  * @internal
240
239
  */
241
240
  valueChanged(e, t) {
242
- let o = t;
243
- if (this.length) {
244
- const i = this._options.findIndex((x) => x.value === t), l = this._options[this.selectedIndex]?.value ?? null, s = this._options[i]?.value ?? null;
245
- (i === -1 || l !== s) && (o = "", this.selectedIndex = i), o = this.firstSelectedOption?.value ?? o;
246
- }
247
- if (t !== o) {
248
- this.value = o;
249
- return;
250
- }
251
- super.valueChanged(e, t), this.updateDisplayValue();
241
+ const o = this.options.findIndex((s) => s.value === t), a = this._validSelectedIndex(o), r = this.options[a]?.value ?? "";
242
+ this.selectedIndex !== a && (this.selectedIndex = a), t === r && (super.valueChanged(e, t), this.updateDisplayValue());
252
243
  }
253
244
  /**
254
245
  * Sets the value and display value to match the first selected option.
@@ -343,9 +334,9 @@ class r extends T(
343
334
  * @internal
344
335
  */
345
336
  selectedOptionsChanged(e, t) {
346
- super.selectedOptionsChanged(e, t), this.options.forEach((o, i) => {
347
- const l = this.proxy.options.item(i);
348
- l && (l.selected = o.selected);
337
+ super.selectedOptionsChanged(e, t), this.options.forEach((o, a) => {
338
+ const r = this.proxy.options.item(a);
339
+ r && (r.selected = o.selected);
349
340
  });
350
341
  }
351
342
  /**
@@ -369,31 +360,31 @@ class r extends T(
369
360
  return;
370
361
  const { key: t, shiftKey: o } = e;
371
362
  switch (this.shouldSkipFocus = !1, t) {
372
- case $: {
363
+ case w: {
373
364
  this.checkFirstOption(o);
374
365
  return;
375
366
  }
376
- case S: {
367
+ case O: {
377
368
  this.checkNextOption(o);
378
369
  return;
379
370
  }
380
- case w: {
371
+ case I: {
381
372
  this.checkPreviousOption(o);
382
373
  return;
383
374
  }
384
- case I: {
375
+ case k: {
385
376
  this.checkLastOption(o);
386
377
  return;
387
378
  }
388
- case O: {
379
+ case _: {
389
380
  this.focusAndScrollOptionIntoView();
390
381
  return;
391
382
  }
392
- case k: {
383
+ case y: {
393
384
  this.uncheckAllOptions(), this.checkActiveIndex();
394
385
  return;
395
386
  }
396
- case _:
387
+ case g:
397
388
  if (e.preventDefault(), this.typeaheadExpired) {
398
389
  this.toggleSelectedForAllCheckedOptions();
399
390
  return;
@@ -413,27 +404,27 @@ class r extends T(
413
404
  keydownHandler(e) {
414
405
  const t = this.selectedIndex;
415
406
  switch (this.multiple ? this.multipleKeydownHandler(e) : super.keydownHandler(e), e.key) {
416
- case _: {
407
+ case g: {
417
408
  e.preventDefault(), this.collapsible && this.typeaheadExpired && (this.open = !this.open);
418
409
  break;
419
410
  }
420
- case $:
421
- case I: {
411
+ case w:
412
+ case k: {
422
413
  e.preventDefault();
423
414
  break;
424
415
  }
425
- case G: {
416
+ case J: {
426
417
  e.preventDefault(), this.open = !this.open;
427
418
  break;
428
419
  }
429
- case k: {
420
+ case y: {
430
421
  this.collapsible && this.open && (e.preventDefault(), this.open = !1);
431
422
  break;
432
423
  }
433
- case O:
424
+ case _:
434
425
  return this.collapsible && this.open && (e.preventDefault(), this.open = !1), !0;
435
426
  }
436
- return this.collapsible && !this.open && this.selectedIndex !== t && this.updateValue(!0), !(e.key === S || e.key === w);
427
+ return this.collapsible && !this.open && this.selectedIndex !== t && this.updateValue(!0), !(e.key === O || e.key === I);
437
428
  }
438
429
  connectedCallback() {
439
430
  super.connectedCallback(), this.addEventListener("focusout", this.focusoutHandler), this.addEventListener("contentchange", this.updateDisplayValue);
@@ -451,148 +442,145 @@ class r extends T(
451
442
  get displayValue() {
452
443
  return u.track(this, "displayValue"), this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
453
444
  }
454
- setDefaultSelectedOption() {
455
- const t = Array.from(this.children).filter(
456
- m.slottedOptionFilter
457
- ).findIndex(
458
- (o) => o.hasAttribute("selected") || o.selected || o.value === this.value
445
+ _newDefaultSelectedIndex(e, t, o) {
446
+ const a = super._newDefaultSelectedIndex(
447
+ e,
448
+ t,
449
+ o
459
450
  );
460
- if (t === -1 && !this.placeholderOption) {
461
- this.selectedIndex = 0;
462
- return;
463
- }
464
- if (t !== -1 || this.placeholder !== "") {
465
- this.selectedIndex = t;
466
- return;
451
+ if (a === null && o === -1 && !this.placeholder) {
452
+ const r = this.getNextSelectableIndex(0);
453
+ if (r !== -1)
454
+ return r;
467
455
  }
456
+ return a;
457
+ }
458
+ _isDefaultSelected(e) {
459
+ return super._isDefaultSelected(e) || e.value === this.initialValue;
468
460
  }
469
461
  /*
470
462
  * @internal
471
463
  */
472
464
  slottedOptionsChanged(e, t) {
473
- this.options.forEach((i) => {
474
- u.getNotifier(i).unsubscribe(this, "value");
475
- }), super.slottedOptionsChanged(e, t), this.options.forEach((i) => {
476
- u.getNotifier(i).subscribe(this, "value");
465
+ this.options.forEach((a) => {
466
+ u.getNotifier(a).unsubscribe(this, "value");
467
+ }), super.slottedOptionsChanged(e, t), this.options.forEach((a) => {
468
+ u.getNotifier(a).subscribe(this, "value");
477
469
  }), this.setProxyOptions(), this.updateValue();
478
470
  const o = this.getAttribute("scale") || this.scale;
479
- t.forEach((i) => {
480
- o && (i.setAttribute("scale", o), i.scale = o);
471
+ t.forEach((a) => {
472
+ o && (a.setAttribute("scale", o), a.scale = o);
481
473
  }), this.proxy.value = this.value, this.validate();
482
474
  }
483
475
  formResetCallback() {
484
- this.setProxyOptions(), super.setDefaultSelectedOption(), this.selectedIndex === -1 && (this.selectedIndex = 0), this.placeholder && (this.selectedIndex = -1);
476
+ this.setProxyOptions(), this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
485
477
  }
486
478
  }
487
- n([
488
- c
489
- ], r.prototype, "activeIndex", 2);
490
- n([
491
- p({ mode: "boolean" })
492
- ], r.prototype, "multiple", 2);
493
- n([
494
- p({ attribute: "open", mode: "boolean" })
495
- ], r.prototype, "open", 2);
496
- n([
497
- V
498
- ], r.prototype, "collapsible", 1);
499
- n([
500
- c
501
- ], r.prototype, "control", 2);
502
- n([
503
- c
504
- ], r.prototype, "maxHeight", 2);
505
- n([
506
- c
507
- ], r.prototype, "_anchor", 2);
508
- n([
509
- p()
510
- ], r.prototype, "scale", 2);
511
- n([
479
+ l([
512
480
  p
513
- ], r.prototype, "appearance", 2);
514
- n([
481
+ ], i.prototype, "activeIndex", 2);
482
+ l([
483
+ c({ mode: "boolean" })
484
+ ], i.prototype, "multiple", 2);
485
+ l([
486
+ c({ attribute: "open", mode: "boolean" })
487
+ ], i.prototype, "open", 2);
488
+ l([
489
+ F
490
+ ], i.prototype, "collapsible", 1);
491
+ l([
515
492
  p
516
- ], r.prototype, "shape", 2);
517
- n([
518
- p({ mode: "boolean", attribute: "fixed-dropdown" })
519
- ], r.prototype, "fixedDropdown", 2);
520
- n([
493
+ ], i.prototype, "control", 2);
494
+ l([
521
495
  p
522
- ], r.prototype, "placeholder", 2);
523
- n([
496
+ ], i.prototype, "maxHeight", 2);
497
+ l([
498
+ p
499
+ ], i.prototype, "_anchor", 2);
500
+ l([
501
+ c()
502
+ ], i.prototype, "scale", 2);
503
+ l([
524
504
  c
525
- ], r.prototype, "placeholderOption", 2);
526
- n([
505
+ ], i.prototype, "appearance", 2);
506
+ l([
527
507
  c
528
- ], r.prototype, "_feedbackWrapper", 2);
529
- n([
508
+ ], i.prototype, "shape", 2);
509
+ l([
510
+ c({ mode: "boolean", attribute: "fixed-dropdown" })
511
+ ], i.prototype, "fixedDropdown", 2);
512
+ l([
530
513
  c
531
- ], r.prototype, "metaSlottedContent", 2);
514
+ ], i.prototype, "placeholder", 2);
515
+ l([
516
+ p
517
+ ], i.prototype, "_feedbackWrapper", 2);
518
+ l([
519
+ p
520
+ ], i.prototype, "metaSlottedContent", 2);
532
521
  const ae = ({
533
- shape: a,
522
+ shape: n,
534
523
  disabled: e,
535
524
  appearance: t,
536
525
  metaSlottedContent: o,
537
- errorValidationMessage: i,
538
- successText: l,
526
+ errorValidationMessage: a,
527
+ successText: r,
539
528
  placeholder: s,
540
- value: x,
541
- scale: y
529
+ value: $,
530
+ scale: m
542
531
  }) => Z(
543
532
  ["disabled", e],
544
533
  [`appearance-${t}`, !!t],
545
- [`shape-${a}`, !!a],
534
+ [`shape-${n}`, !!n],
546
535
  ["has-meta", !!o?.length],
547
- ["error", !!i],
548
- ["success", !!l],
549
- ["shows-placeholder", !!s && !x],
550
- [`size-${y}`, !!y]
536
+ ["error", !!a],
537
+ ["success", !!r],
538
+ ["shows-placeholder", !!s && !$],
539
+ [`size-${m}`, !!m]
551
540
  );
552
- function ie() {
541
+ function ne() {
553
542
  return h` <label
554
- for="${(a) => a.multiple ? null : "control"}"
543
+ for="${(n) => n.multiple ? null : "control"}"
555
544
  class="label"
556
545
  id="label"
557
546
  >
558
- ${(a) => a.label}
547
+ ${(n) => n.label}
559
548
  </label>`;
560
549
  }
561
- function re(a) {
562
- const e = a.tagFor(J);
550
+ function re(n) {
551
+ const e = n.tagFor(H);
563
552
  return h`
564
- <${e} ${f("placeholderOption")}
565
- text="${(t) => t.placeholder}" hidden disabled>
553
+ <${e} text="${(t) => t.placeholder}" hidden disabled>
566
554
  </${e}>`;
567
555
  }
568
- function ne(a) {
569
- const e = U(a), t = Q(a);
556
+ function ie(n) {
557
+ const e = q(n), t = Q(n);
570
558
  return h` <div
571
559
  class="control ${ae}"
572
- ${f("_anchor")}
560
+ ${b("_anchor")}
573
561
  id="control"
574
562
  ?disabled="${(o) => o.disabled}"
575
563
  >
576
564
  <div class="selected-value">
577
- ${(o) => e(o.icon, q.Slot)}
565
+ ${(o) => e(o.icon, X.Slot)}
578
566
  <span class="text">${(o) => o.displayValue}</span>
579
- <slot name="meta" ${g("metaSlottedContent")}></slot>
567
+ <slot name="meta" ${x("metaSlottedContent")}></slot>
580
568
  </div>
581
569
  ${t}
582
570
  </div>`;
583
571
  }
584
- function le(a) {
585
- return a.open && a.fixedDropdown ? `--_select-fixed-width: ${Math.round(a.getBoundingClientRect().width)}px` : null;
572
+ function le(n) {
573
+ return n.open && n.fixedDropdown ? `--_select-fixed-width: ${Math.round(n.getBoundingClientRect().width)}px` : null;
586
574
  }
587
- function se(a) {
588
- const e = a.tagFor(C);
575
+ function se(n) {
576
+ const e = n.tagFor(C);
589
577
  return h`
590
578
  <div class="label-wrapper" ?hidden=${(t) => !t.label && !t._hasContextualHelp}>
591
- ${b((t) => t.label, ie())}
592
- <slot name="contextual-help" ${g("_contextualHelpSlottedContent")}></slot>
579
+ ${f((t) => t.label, ne())}
580
+ <slot name="contextual-help" ${x("_contextualHelpSlottedContent")}></slot>
593
581
  </div>
594
582
  <div class="control-wrapper">
595
- ${b((t) => !t.multiple, ne(a))}
583
+ ${f((t) => !t.multiple, ie(n))}
596
584
  <${e} class="popup"
597
585
  style="${le}"
598
586
  ?open="${(t) => t.collapsible ? t.open : !0}"
@@ -607,11 +595,11 @@ function se(a) {
607
595
  aria-labelledby="${(t) => t.multiple && t.label ? "label" : null}"
608
596
  ?disabled="${(t) => t.disabled}"
609
597
  ?hidden="${(t) => t.collapsible ? !t.open : !1}"
610
- ${f("listbox")}>
611
- ${b((t) => t.placeholder, re(a))}
598
+ ${b("listbox")}>
599
+ ${f((t) => t.placeholder, re(n))}
612
600
  <slot
613
- ${g({
614
- filter: m.slottedOptionFilter,
601
+ ${x({
602
+ filter: S.slottedOptionFilter,
615
603
  flatten: !0,
616
604
  property: "slottedOptions"
617
605
  })}>
@@ -621,13 +609,13 @@ function se(a) {
621
609
  </div>
622
610
  `;
623
611
  }
624
- function d(a) {
625
- return (e, t) => t.event.composedPath().includes(e._feedbackWrapper) ? !0 : a(e, t.event);
612
+ function d(n) {
613
+ return (e, t) => t.event.composedPath().includes(e._feedbackWrapper) ? !0 : n(e, t.event);
626
614
  }
627
- const ce = (a) => h`
615
+ const ce = (n) => h`
628
616
  <template
629
617
  class="base"
630
- ${P({
618
+ ${B({
631
619
  role: "combobox",
632
620
  ariaLabel: (e) => e.ariaLabel ?? e.label,
633
621
  ariaHasPopup: (e) => e.collapsible ? "listbox" : "false",
@@ -648,27 +636,27 @@ const ce = (a) => h`
648
636
  (e, t) => e.mousedownHandler(t)
649
637
  )}"
650
638
  >
651
- ${se(a)}
652
- <div class="feedback-wrapper" ${f("_feedbackWrapper")}>
653
- ${(e) => e._getFeedbackTemplate(a)}
639
+ ${se(n)}
640
+ <div class="feedback-wrapper" ${b("_feedbackWrapper")}>
641
+ ${(e) => e._getFeedbackTemplate(n)}
654
642
  </div>
655
643
  </template>
656
- `, pe = z(
644
+ `, pe = T(
657
645
  "select",
658
- r,
646
+ i,
659
647
  ce,
660
648
  [
661
649
  A,
662
- H,
663
650
  D,
664
- W
651
+ E,
652
+ L
665
653
  ],
666
654
  {
667
655
  styles: ee
668
656
  }
669
- ), Fe = F(pe);
657
+ ), Ve = z(pe);
670
658
  export {
671
- r as S,
672
- Fe as r,
659
+ i as S,
660
+ Ve as r,
673
661
  pe as s
674
662
  };
@@ -1,6 +1,5 @@
1
- "use strict";const f=require("./definition9.cjs"),c=require("./definition7.cjs"),i=require("./vivid-element.cjs"),v=require("./anchored.cjs"),x=require("./delegates-aria.cjs"),b=require("./divider.cjs"),u=require("./key-codes.cjs"),I=require("./index.cjs"),y=require("./ref.cjs"),h=require("./slotted.cjs"),E=require("./class-names.cjs"),C=":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.base{display:flex;overflow:hidden auto;box-sizing:border-box;flex-direction:column;padding:4px;gap:8px;inline-size:max-content;max-block-size:var(--menu-block-size, 408px);min-inline-size:var(--menu-min-inline-size)}@media not all and (width >= 600px){.base{max-inline-size:var(--menu-max-inline-size, 300px)}}@media (width >= 600px){.base{max-inline-size:var(--menu-max-inline-size)}}::slotted(a){color:var(--vvd-color-canvas-text);text-decoration:none}::slotted(a[data-vvd-component=menuitem]:focus-visible){box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;display:block}.header{padding:4px}.hide-header .header{display:none}.body{display:flex;flex-direction:column;row-gap:1px}.hide-body .body{display:none}.action-items{display:flex;justify-content:flex-end;gap:8px;padding-block-end:4px;padding-inline:12px}.hide-actions .action-items{display:none}";var k=Object.defineProperty,d=(o,e,n,r)=>{for(var t=void 0,s=o.length-1,l;s>=0;s--)(l=o[s])&&(t=l(e,n,t)||t);return t&&k(e,n,t),t};const $=o=>o instanceof c.MenuItem&&o.controlType==="checkbox",p=o=>o instanceof c.MenuItem&&o.controlType==="radio",m=o=>o instanceof b.Divider?!0:o.role==="separator",_=o=>o instanceof c.MenuItem?!0:!!(o.role&&o.role in c.MenuItemRole);class a extends v.Anchored(x.DelegatesAria(i.VividElement)){constructor(){super(...arguments),this.offset=null,this.expandedItem=null,this.focusIndex=-1,this.handleFocusOut=e=>{!this.contains(e.relatedTarget)&&this.menuItems!==void 0&&this.menuItems.length&&(this.collapseExpandedItem(),this.menuItems[this.focusIndex].setAttribute("tabindex","-1"),this.menuItems[0].setAttribute("tabindex","0"),this.focusIndex=0)},this.handleItemFocus=e=>{const n=e.target;this.menuItems!==void 0&&n!==this.menuItems[this.focusIndex]&&(this.menuItems[this.focusIndex].setAttribute("tabindex","-1"),this.focusIndex=this.menuItems.indexOf(n),n.setAttribute("tabindex","0"))},this.handleExpandedChanged=e=>{const n=e.target;this.expandedItem!==null&&n===this.expandedItem&&n.expanded===!1&&(this.expandedItem=null),n.expanded&&(this.expandedItem=n)},this.removeItemListeners=()=>{this.menuItems!==void 0&&this.menuItems.forEach(e=>{e.removeEventListener("expanded-change",this.handleExpandedChanged),e.removeEventListener("focus",this.handleItemFocus)})},this.setItems=()=>{const e=this.domChildren();this.removeItemListeners(),this.menuItems=e.filter(_),this.menuItems.length&&(this.focusIndex=0),this.menuItems.forEach((n,r)=>{n instanceof c.MenuItem&&(n._isPresentational=!1),n.setAttribute("tabindex",r===0?"0":"-1"),n.addEventListener("expanded-change",this.handleExpandedChanged),n.addEventListener("focus",this.handleItemFocus)})},this.placement="bottom",this.autoDismiss=!1,this.positionStrategy="fixed",this.open=!1,this.#t=()=>{if(this.#e==="off"||this.#e==="legacy"&&this.open)return;const e=!this.open;i.Updates.enqueue(()=>this.open=e)},this._onFocusout=e=>{const n=e.relatedTarget,r=!this.contains(n)&&!this._anchorEl?.contains(n);this.autoDismiss&&r&&(this.open=!1)}}itemsChanged(){this.$fastController.isConnected&&this.menuItems!==void 0&&this.setItems()}connectedCallback(){super.connectedCallback(),i.Updates.enqueue(()=>{this.setItems()})}disconnectedCallback(){super.disconnectedCallback(),this.removeItemListeners(),this.menuItems=void 0}focus(){const e=this.querySelector('[autofocus]:not([slot="anchor"])');e instanceof HTMLElement?e.focus():this.setFocus(0)}collapseExpandedItem(){this.expandedItem!==null&&(this.expandedItem.expanded=!1,this.expandedItem=null)}handleMenuKeyDown(e){if(!(e.defaultPrevented||this.menuItems===void 0))switch(e.key){case u.keyArrowDown:this.setFocus(this.focusIndex+1);return;case u.keyArrowUp:this.setFocus(this.focusIndex-1);return;case u.keyEnd:this.setFocus(this.menuItems.length-1);return;case u.keyHome:this.setFocus(0);return;default:return!0}}domChildren(){return Array.from(this.children).filter(e=>!e.hasAttribute("hidden")).filter(e=>!e.hasAttribute("slot"))}setFocus(e){if(this.menuItems!==void 0&&e>=0&&e<this.menuItems.length){const n=this.menuItems[e];this.focusIndex>-1&&this.menuItems.length>=this.focusIndex-1&&this.menuItems[this.focusIndex].setAttribute("tabindex","-1"),this.focusIndex=e,n.setAttribute("tabindex","0"),n.focus()}}get#e(){return this.trigger??"auto"}openChanged(e,n){n&&this._popupEl?.show().then(()=>this.focus()),n?this.$emit("open",void 0,{bubbles:!1}):this.$emit("close",void 0,{bubbles:!1}),this._anchorEl&&this.#n(this._anchorEl)}_anchorElChanged(e,n){e&&this.#o(e),n&&this.#s(n)}#s(e){e.addEventListener("click",this.#t,!0),e.addEventListener("focusout",this._onFocusout),e.ariaHasPopup="menu",this.#n(e)}#n(e){e.ariaExpanded=this.open.toString(),e.dataset.expanded=this.open.toString()}#o(e){e.removeEventListener("click",this.#t,!0),e.removeEventListener("focusout",this._onFocusout),e.ariaHasPopup=null,e.ariaExpanded=null,delete e.dataset.expanded}#t;_onChange(e){if(this.menuItems===void 0||!(e.target instanceof Element))return;this.#e==="auto"&&!$(e.target)&&(this.open=!1);const n=this.domChildren(),r=n.indexOf(e.target);if(r!==-1){if(p(e.target)&&e.target.checked){for(let t=r-1;t>=0;--t){const s=n[t];if(p(s)&&(s.checked=!1),m(s))break}for(let t=r+1;t<=n.length-1;++t){const s=n[t];if(p(s)&&(s.checked=!1),m(s))break}}return!0}}}d([i.attr({attribute:"offset",converter:i.nullableNumberConverter})],a.prototype,"offset");d([i.observable],a.prototype,"items");d([i.attr({mode:"fromView"})],a.prototype,"placement");d([i.attr],a.prototype,"trigger");d([i.attr({mode:"boolean",attribute:"auto-dismiss"})],a.prototype,"autoDismiss");d([i.attr({mode:"fromView",attribute:"position-strategy"})],a.prototype,"positionStrategy");d([i.attr({mode:"boolean"})],a.prototype,"open");d([i.observable],a.prototype,"headerSlottedContent");d([i.observable],a.prototype,"actionItemsSlottedContent");d([i.observable],a.prototype,"_popupOffset");const A=({headerSlottedContent:o,actionItemsSlottedContent:e,items:n})=>E.classNames("base",["hide-header",!o?.length],["hide-actions",!e?.length],["hide-body",n&&!n.length]);function w(o,e){return o.open&&I.handleEscapeKeyAndStopPropogation(e)&&(o.open=!1),!0}const F=o=>{const e=o.tagFor(f.Popup),n=v.anchorSlotTemplateFactory();function r(t,s,l){s.stopPropagation(),t.open=l}return i.html`
2
- <template @change="${(t,s)=>t._onChange(s.event)}"
3
- @focusout="${(t,s)=>t._onFocusout(s.event)}">
1
+ "use strict";const f=require("./definition9.cjs"),c=require("./definition7.cjs"),i=require("./vivid-element.cjs"),v=require("./anchored.cjs"),x=require("./delegates-aria.cjs"),b=require("./divider.cjs"),u=require("./key-codes.cjs"),I=require("./index.cjs"),y=require("./ref.cjs"),h=require("./slotted.cjs"),E=require("./class-names.cjs"),C=":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.base{display:flex;overflow:hidden auto;box-sizing:border-box;flex-direction:column;padding:4px;gap:8px;inline-size:max-content;max-block-size:var(--menu-block-size, 408px);min-inline-size:var(--menu-min-inline-size)}@media not all and (width >= 600px){.base{max-inline-size:var(--menu-max-inline-size, 300px)}}@media (width >= 600px){.base{max-inline-size:var(--menu-max-inline-size)}}::slotted(a){color:var(--vvd-color-canvas-text);text-decoration:none}::slotted(a[data-vvd-component=menuitem]:focus-visible){box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;display:block}.header{padding:4px}.hide-header .header{display:none}.body{display:flex;flex-direction:column;row-gap:1px}.hide-body .body{display:none}.action-items{display:flex;justify-content:flex-end;gap:8px;padding-block-end:4px;padding-inline:12px}.hide-actions .action-items{display:none}";var k=Object.defineProperty,d=(o,e,n,r)=>{for(var t=void 0,s=o.length-1,l;s>=0;s--)(l=o[s])&&(t=l(e,n,t)||t);return t&&k(e,n,t),t};const $=o=>o instanceof c.MenuItem&&o.controlType==="checkbox",p=o=>o instanceof c.MenuItem&&o.controlType==="radio",m=o=>o instanceof b.Divider?!0:o.role==="separator",_=o=>o instanceof c.MenuItem?!0:!!(o.role&&o.role in c.MenuItemRole);class a extends v.Anchored(x.DelegatesAria(i.VividElement)){constructor(){super(...arguments),this.offset=null,this.expandedItem=null,this.focusIndex=-1,this.handleFocusOut=e=>{!this.contains(e.relatedTarget)&&this.menuItems!==void 0&&this.menuItems.length&&(this.collapseExpandedItem(),this.menuItems[this.focusIndex].setAttribute("tabindex","-1"),this.menuItems[0].setAttribute("tabindex","0"),this.focusIndex=0)},this.handleItemFocus=e=>{const n=e.target;this.menuItems!==void 0&&n!==this.menuItems[this.focusIndex]&&(this.menuItems[this.focusIndex].setAttribute("tabindex","-1"),this.focusIndex=this.menuItems.indexOf(n),n.setAttribute("tabindex","0"))},this.handleExpandedChanged=e=>{const n=e.target;this.expandedItem!==null&&n===this.expandedItem&&n.expanded===!1&&(this.expandedItem=null),n.expanded&&(this.expandedItem=n)},this.removeItemListeners=()=>{this.menuItems!==void 0&&this.menuItems.forEach(e=>{e.removeEventListener("expanded-change",this.handleExpandedChanged),e.removeEventListener("focus",this.handleItemFocus)})},this.setItems=()=>{const e=this.domChildren();this.removeItemListeners(),this.menuItems=e.filter(_),this.menuItems.length&&(this.focusIndex=0),this.menuItems.forEach((n,r)=>{n instanceof c.MenuItem&&(n._isPresentational=!1),n.setAttribute("tabindex",r===0?"0":"-1"),n.addEventListener("expanded-change",this.handleExpandedChanged),n.addEventListener("focus",this.handleItemFocus)})},this.placement="bottom",this.autoDismiss=!1,this.positionStrategy="fixed",this.open=!1,this.#t=()=>{if(this.#e==="off"||this.#e==="legacy"&&this.open)return;const e=!this.open;i.Updates.enqueue(()=>this.open=e)},this._onFocusout=e=>{const n=e.relatedTarget,r=!this.contains(n)&&!this._anchorEl?.contains(n);this.autoDismiss&&r&&(this.open=!1)}}itemsChanged(){this.$fastController.isConnected&&this.menuItems!==void 0&&this.setItems()}connectedCallback(){super.connectedCallback(),i.Updates.enqueue(()=>{this.setItems()})}disconnectedCallback(){super.disconnectedCallback(),this.removeItemListeners(),this.menuItems=void 0}focus(){const e=this.querySelector('[autofocus]:not([slot="anchor"])');e instanceof HTMLElement?e.focus():this.setFocus(0)}collapseExpandedItem(){this.expandedItem!==null&&(this.expandedItem.expanded=!1,this.expandedItem=null)}handleMenuKeyDown(e){if(!(e.defaultPrevented||this.menuItems===void 0))switch(e.key){case u.keyArrowDown:this.setFocus(this.focusIndex+1);return;case u.keyArrowUp:this.setFocus(this.focusIndex-1);return;case u.keyEnd:this.setFocus(this.menuItems.length-1);return;case u.keyHome:this.setFocus(0);return;default:return!0}}domChildren(){return Array.from(this.children).filter(e=>!e.hasAttribute("hidden")).filter(e=>!e.hasAttribute("slot"))}setFocus(e){if(this.menuItems!==void 0&&e>=0&&e<this.menuItems.length){const n=this.menuItems[e];this.focusIndex>-1&&this.menuItems.length>=this.focusIndex-1&&this.menuItems[this.focusIndex].setAttribute("tabindex","-1"),this.focusIndex=e,n.setAttribute("tabindex","0"),n.focus()}}get#e(){return this.trigger??"auto"}openChanged(e,n){n&&this._popupEl?.show().then(()=>this.focus()),n?this.$emit("open",void 0,{bubbles:!1}):this.$emit("close",void 0,{bubbles:!1}),this._anchorEl&&this.#n(this._anchorEl)}_anchorElChanged(e,n){e&&this.#o(e),n&&this.#s(n)}#s(e){e.addEventListener("click",this.#t,!0),e.addEventListener("focusout",this._onFocusout),e.ariaHasPopup="menu",this.#n(e)}#n(e){e.ariaExpanded=this.open.toString(),e.dataset.expanded=this.open.toString()}#o(e){e.removeEventListener("click",this.#t,!0),e.removeEventListener("focusout",this._onFocusout),e.ariaHasPopup=null,e.ariaExpanded=null,delete e.dataset.expanded}#t;_onBodyChange(e){if(this.menuItems===void 0||!(e.target instanceof Element))return;this.#e==="auto"&&!$(e.target)&&(this.open=!1);const n=this.domChildren(),r=n.indexOf(e.target);if(r!==-1){if(p(e.target)&&e.target.checked){for(let t=r-1;t>=0;--t){const s=n[t];if(p(s)&&(s.checked=!1),m(s))break}for(let t=r+1;t<=n.length-1;++t){const s=n[t];if(p(s)&&(s.checked=!1),m(s))break}}return!0}}}d([i.attr({attribute:"offset",converter:i.nullableNumberConverter})],a.prototype,"offset");d([i.observable],a.prototype,"items");d([i.attr({mode:"fromView"})],a.prototype,"placement");d([i.attr],a.prototype,"trigger");d([i.attr({mode:"boolean",attribute:"auto-dismiss"})],a.prototype,"autoDismiss");d([i.attr({mode:"fromView",attribute:"position-strategy"})],a.prototype,"positionStrategy");d([i.attr({mode:"boolean"})],a.prototype,"open");d([i.observable],a.prototype,"headerSlottedContent");d([i.observable],a.prototype,"actionItemsSlottedContent");d([i.observable],a.prototype,"_popupOffset");const A=({headerSlottedContent:o,actionItemsSlottedContent:e,items:n})=>E.classNames("base",["hide-header",!o?.length],["hide-actions",!e?.length],["hide-body",n&&!n.length]);function w(o,e){return o.open&&I.handleEscapeKeyAndStopPropogation(e)&&(o.open=!1),!0}const F=o=>{const e=o.tagFor(f.Popup),n=v.anchorSlotTemplateFactory();function r(t,s,l){s.stopPropagation(),t.open=l}return i.html`
2
+ <template @focusout="${(t,s)=>t._onFocusout(s.event)}">
4
3
  ${n}
5
4
  <${e}
6
5
  ${y.ref("_popupEl")}
@@ -20,6 +19,7 @@
20
19
  <div
21
20
  class="body"
22
21
  ${x.delegateAria({role:"menu"})}
22
+ @change="${(t,s)=>t._onBodyChange(s.event)}"
23
23
  @keydown="${(t,s)=>t.handleMenuKeyDown(s.event)}"
24
24
  @focusout="${(t,s)=>t.handleFocusOut(s.event)}"
25
25
  >