@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.
- package/accordion-item/definition.js +1 -1
- package/alert/definition.cjs +1 -1
- package/alert/definition.js +2 -2
- package/badge/definition.js +1 -1
- package/banner/definition.js +1 -1
- package/bundled/calendar-picker.template.cjs +7 -7
- package/bundled/calendar-picker.template.js +101 -101
- package/bundled/definition11.cjs +13 -13
- package/bundled/definition11.js +202 -50
- package/bundled/definition19.cjs +24 -25
- package/bundled/definition19.js +152 -164
- package/bundled/definition6.cjs +3 -3
- package/bundled/definition6.js +19 -19
- package/bundled/definition9.cjs +5 -5
- package/bundled/definition9.js +394 -392
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +82 -102
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +18 -14
- package/bundled/vivid-element.cjs +5 -1
- package/bundled/vivid-element.js +401 -358
- package/calendar/index.cjs +1 -1
- package/calendar/index.js +14 -14
- package/card/definition.cjs +1 -1
- package/card/definition.js +1 -1
- package/color-picker/definition.cjs +1 -1
- package/color-picker/definition.js +1 -1
- package/combobox/definition.cjs +7 -27
- package/combobox/definition.js +8 -28
- package/combobox/index.cjs +6 -6
- package/combobox/index.js +57 -71
- package/custom-elements.json +305 -2
- package/date-picker/definition.cjs +1 -1
- package/date-picker/definition.js +1 -1
- package/date-range-picker/definition.cjs +1 -1
- package/date-range-picker/definition.js +1 -1
- package/date-time-picker/definition.cjs +1 -1
- package/date-time-picker/definition.js +1 -1
- package/dialog/definition.cjs +2 -2
- package/dialog/definition.js +2 -2
- package/dialog/index.cjs +7 -7
- package/dialog/index.js +6 -6
- package/elevation/definition.cjs +1 -1
- package/elevation/definition.js +1 -1
- package/fab/definition.js +1 -1
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/index.cjs +3 -4
- package/index.js +2 -3
- package/lib/accordion/accordion.d.ts +1 -1
- package/lib/accordion/definition.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +1 -1
- package/lib/combobox/combobox.d.ts +1 -0
- package/lib/combobox/combobox.options.d.ts +1 -1
- package/lib/divider/divider.d.ts +1 -1
- package/lib/menu-item/menu-item-role.d.ts +1 -1
- package/lib/popup/popup.d.ts +1 -1
- package/lib/searchable-select/locale.d.ts +4 -0
- package/lib/searchable-select/searchable-select.d.ts +3 -0
- package/lib/select/select.d.ts +3 -1
- package/lib/slider/slider.d.ts +1 -1
- package/lib/tabs/tabs.d.ts +2 -2
- package/lib/text-area/text-area.d.ts +1 -1
- package/lib/text-field/text-field.d.ts +1 -1
- package/locales/de-DE.cjs +4 -0
- package/locales/de-DE.js +4 -0
- package/locales/en-GB.cjs +4 -0
- package/locales/en-GB.js +4 -0
- package/locales/en-US.cjs +4 -0
- package/locales/en-US.js +4 -0
- package/locales/ja-JP.cjs +4 -0
- package/locales/ja-JP.js +4 -0
- package/locales/zh-CN.cjs +4 -0
- package/locales/zh-CN.js +4 -0
- package/menu/definition.cjs +4 -4
- package/menu/definition.js +4 -4
- package/nav-disclosure/definition.js +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.js +1 -1
- package/number-field/definition.js +1 -1
- package/option/definition.cjs +6 -77
- package/option/definition.js +3 -78
- package/package.json +31 -5
- package/popup/definition.cjs +2 -2
- package/popup/definition.js +2 -2
- package/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/rich-text-editor/definition.cjs +2 -3
- package/rich-text-editor/definition.js +1 -2
- package/rich-text-editor/index.cjs +27 -27
- package/rich-text-editor/index.js +1208 -1198
- package/searchable-select/definition.cjs +103 -11
- package/searchable-select/definition.js +103 -11
- package/searchable-select/index.cjs +81 -69
- package/searchable-select/index.js +359 -273
- package/select/definition.cjs +24 -41
- package/select/definition.js +24 -41
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/aria/aria-mixin.d.ts +1 -1
- package/shared/foundation/listbox/listbox.d.ts +4 -0
- package/simple-color-picker/definition.cjs +1 -1
- package/simple-color-picker/definition.js +1 -1
- package/slider/definition.cjs +1 -1
- package/slider/definition.js +1 -1
- package/split-button/definition.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/tab/definition.js +1 -1
- package/tag/definition.js +1 -1
- package/text-field/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/toggletip/definition.cjs +1 -1
- package/toggletip/definition.js +1 -1
- package/tooltip/definition.cjs +1 -1
- package/tooltip/definition.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +1 -1
- package/unbundled/affix.js +1 -1
- package/unbundled/calendar-picker.template.cjs +1 -1
- package/unbundled/calendar-picker.template.js +1 -1
- package/unbundled/definition.js +1 -1
- package/unbundled/definition2.js +1 -1
- package/unbundled/definition3.cjs +222 -141
- package/unbundled/definition3.js +220 -139
- package/unbundled/definition4.cjs +145 -235
- package/unbundled/definition4.js +143 -233
- package/unbundled/definition5.cjs +269 -27
- package/unbundled/definition5.js +267 -26
- package/unbundled/definition6.cjs +56 -0
- package/unbundled/definition6.js +52 -0
- package/unbundled/listbox.cjs +41 -63
- package/unbundled/listbox.js +39 -61
- package/unbundled/picker-field.template.cjs +1 -1
- package/unbundled/picker-field.template.js +1 -1
- package/unbundled/slider.template.cjs +1 -1
- package/unbundled/slider.template.js +1 -1
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +56 -16
- package/video-player/definition.js +56 -16
- package/video-player/index.cjs +36 -36
- package/video-player/index.js +2461 -2445
- package/vivid.api.json +285 -38
- package/bundled/option.cjs +0 -1
- package/bundled/option.js +0 -158
- package/unbundled/option.cjs +0 -217
- package/unbundled/option.js +0 -214
package/bundled/definition19.js
CHANGED
|
@@ -1,45 +1,44 @@
|
|
|
1
1
|
import { P as C, p as A } from "./definition9.js";
|
|
2
|
-
import { i as
|
|
3
|
-
import { l as
|
|
4
|
-
import { U as
|
|
5
|
-
import { a as
|
|
6
|
-
import { L as
|
|
7
|
-
import { H as
|
|
8
|
-
import { F as
|
|
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
|
|
12
|
-
import { W as
|
|
13
|
-
import { F as
|
|
14
|
-
import { A as
|
|
15
|
-
import { u as
|
|
16
|
-
import { l as
|
|
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
|
|
21
|
-
import { w as
|
|
22
|
-
import { s as
|
|
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,
|
|
26
|
-
for (var
|
|
27
|
-
(s =
|
|
28
|
-
return o &&
|
|
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
|
|
29
|
+
class i extends W(
|
|
31
30
|
M(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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 =
|
|
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(),
|
|
204
|
-
|
|
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,
|
|
228
|
+
this.focusAndScrollOptionIntoView(), this.indexWhenOpened = this.selectedIndex, V.enqueue(() => this.focus());
|
|
230
229
|
return;
|
|
231
230
|
}
|
|
232
|
-
const o = e === !0 && t === !1,
|
|
233
|
-
o &&
|
|
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
|
-
|
|
243
|
-
|
|
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,
|
|
347
|
-
const
|
|
348
|
-
|
|
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
|
|
367
|
+
case O: {
|
|
377
368
|
this.checkNextOption(o);
|
|
378
369
|
return;
|
|
379
370
|
}
|
|
380
|
-
case
|
|
371
|
+
case I: {
|
|
381
372
|
this.checkPreviousOption(o);
|
|
382
373
|
return;
|
|
383
374
|
}
|
|
384
|
-
case
|
|
375
|
+
case k: {
|
|
385
376
|
this.checkLastOption(o);
|
|
386
377
|
return;
|
|
387
378
|
}
|
|
388
|
-
case
|
|
379
|
+
case _: {
|
|
389
380
|
this.focusAndScrollOptionIntoView();
|
|
390
381
|
return;
|
|
391
382
|
}
|
|
392
|
-
case
|
|
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
|
|
411
|
+
case w:
|
|
412
|
+
case k: {
|
|
422
413
|
e.preventDefault();
|
|
423
414
|
break;
|
|
424
415
|
}
|
|
425
|
-
case
|
|
416
|
+
case J: {
|
|
426
417
|
e.preventDefault(), this.open = !this.open;
|
|
427
418
|
break;
|
|
428
419
|
}
|
|
429
|
-
case
|
|
420
|
+
case y: {
|
|
430
421
|
this.collapsible && this.open && (e.preventDefault(), this.open = !1);
|
|
431
422
|
break;
|
|
432
423
|
}
|
|
433
|
-
case
|
|
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 ===
|
|
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
|
-
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
445
|
+
_newDefaultSelectedIndex(e, t, o) {
|
|
446
|
+
const a = super._newDefaultSelectedIndex(
|
|
447
|
+
e,
|
|
448
|
+
t,
|
|
449
|
+
o
|
|
459
450
|
);
|
|
460
|
-
if (
|
|
461
|
-
|
|
462
|
-
|
|
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((
|
|
474
|
-
u.getNotifier(
|
|
475
|
-
}), super.slottedOptionsChanged(e, t), this.options.forEach((
|
|
476
|
-
u.getNotifier(
|
|
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((
|
|
480
|
-
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(),
|
|
476
|
+
this.setProxyOptions(), this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
|
|
485
477
|
}
|
|
486
478
|
}
|
|
487
|
-
|
|
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
|
-
],
|
|
514
|
-
|
|
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
|
-
],
|
|
517
|
-
|
|
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
|
-
],
|
|
523
|
-
|
|
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
|
-
],
|
|
526
|
-
|
|
505
|
+
], i.prototype, "appearance", 2);
|
|
506
|
+
l([
|
|
527
507
|
c
|
|
528
|
-
],
|
|
529
|
-
|
|
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
|
-
],
|
|
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:
|
|
522
|
+
shape: n,
|
|
534
523
|
disabled: e,
|
|
535
524
|
appearance: t,
|
|
536
525
|
metaSlottedContent: o,
|
|
537
|
-
errorValidationMessage:
|
|
538
|
-
successText:
|
|
526
|
+
errorValidationMessage: a,
|
|
527
|
+
successText: r,
|
|
539
528
|
placeholder: s,
|
|
540
|
-
value:
|
|
541
|
-
scale:
|
|
529
|
+
value: $,
|
|
530
|
+
scale: m
|
|
542
531
|
}) => Z(
|
|
543
532
|
["disabled", e],
|
|
544
533
|
[`appearance-${t}`, !!t],
|
|
545
|
-
[`shape-${
|
|
534
|
+
[`shape-${n}`, !!n],
|
|
546
535
|
["has-meta", !!o?.length],
|
|
547
|
-
["error", !!
|
|
548
|
-
["success", !!
|
|
549
|
-
["shows-placeholder", !!s &&
|
|
550
|
-
[`size-${
|
|
536
|
+
["error", !!a],
|
|
537
|
+
["success", !!r],
|
|
538
|
+
["shows-placeholder", !!s && !$],
|
|
539
|
+
[`size-${m}`, !!m]
|
|
551
540
|
);
|
|
552
|
-
function
|
|
541
|
+
function ne() {
|
|
553
542
|
return h` <label
|
|
554
|
-
for="${(
|
|
543
|
+
for="${(n) => n.multiple ? null : "control"}"
|
|
555
544
|
class="label"
|
|
556
545
|
id="label"
|
|
557
546
|
>
|
|
558
|
-
${(
|
|
547
|
+
${(n) => n.label}
|
|
559
548
|
</label>`;
|
|
560
549
|
}
|
|
561
|
-
function re(
|
|
562
|
-
const e =
|
|
550
|
+
function re(n) {
|
|
551
|
+
const e = n.tagFor(H);
|
|
563
552
|
return h`
|
|
564
|
-
<${e} ${
|
|
565
|
-
text="${(t) => t.placeholder}" hidden disabled>
|
|
553
|
+
<${e} text="${(t) => t.placeholder}" hidden disabled>
|
|
566
554
|
</${e}>`;
|
|
567
555
|
}
|
|
568
|
-
function
|
|
569
|
-
const e =
|
|
556
|
+
function ie(n) {
|
|
557
|
+
const e = q(n), t = Q(n);
|
|
570
558
|
return h` <div
|
|
571
559
|
class="control ${ae}"
|
|
572
|
-
${
|
|
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,
|
|
565
|
+
${(o) => e(o.icon, X.Slot)}
|
|
578
566
|
<span class="text">${(o) => o.displayValue}</span>
|
|
579
|
-
<slot name="meta" ${
|
|
567
|
+
<slot name="meta" ${x("metaSlottedContent")}></slot>
|
|
580
568
|
</div>
|
|
581
569
|
${t}
|
|
582
570
|
</div>`;
|
|
583
571
|
}
|
|
584
|
-
function le(
|
|
585
|
-
return
|
|
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(
|
|
588
|
-
const e =
|
|
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
|
-
${
|
|
592
|
-
<slot name="contextual-help" ${
|
|
579
|
+
${f((t) => t.label, ne())}
|
|
580
|
+
<slot name="contextual-help" ${x("_contextualHelpSlottedContent")}></slot>
|
|
593
581
|
</div>
|
|
594
582
|
<div class="control-wrapper">
|
|
595
|
-
${
|
|
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
|
-
${
|
|
611
|
-
${
|
|
598
|
+
${b("listbox")}>
|
|
599
|
+
${f((t) => t.placeholder, re(n))}
|
|
612
600
|
<slot
|
|
613
|
-
${
|
|
614
|
-
filter:
|
|
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(
|
|
625
|
-
return (e, t) => t.event.composedPath().includes(e._feedbackWrapper) ? !0 :
|
|
612
|
+
function d(n) {
|
|
613
|
+
return (e, t) => t.event.composedPath().includes(e._feedbackWrapper) ? !0 : n(e, t.event);
|
|
626
614
|
}
|
|
627
|
-
const ce = (
|
|
615
|
+
const ce = (n) => h`
|
|
628
616
|
<template
|
|
629
617
|
class="base"
|
|
630
|
-
${
|
|
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(
|
|
652
|
-
<div class="feedback-wrapper" ${
|
|
653
|
-
${(e) => e._getFeedbackTemplate(
|
|
639
|
+
${se(n)}
|
|
640
|
+
<div class="feedback-wrapper" ${b("_feedbackWrapper")}>
|
|
641
|
+
${(e) => e._getFeedbackTemplate(n)}
|
|
654
642
|
</div>
|
|
655
643
|
</template>
|
|
656
|
-
`, pe =
|
|
644
|
+
`, pe = T(
|
|
657
645
|
"select",
|
|
658
|
-
|
|
646
|
+
i,
|
|
659
647
|
ce,
|
|
660
648
|
[
|
|
661
649
|
A,
|
|
662
|
-
H,
|
|
663
650
|
D,
|
|
664
|
-
|
|
651
|
+
E,
|
|
652
|
+
L
|
|
665
653
|
],
|
|
666
654
|
{
|
|
667
655
|
styles: ee
|
|
668
656
|
}
|
|
669
|
-
),
|
|
657
|
+
), Ve = z(pe);
|
|
670
658
|
export {
|
|
671
|
-
|
|
672
|
-
|
|
659
|
+
i as S,
|
|
660
|
+
Ve as r,
|
|
673
661
|
pe as s
|
|
674
662
|
};
|
package/bundled/definition6.cjs
CHANGED
|
@@ -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;
|
|
2
|
-
<template @
|
|
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
|
>
|