@luzmo/analytics-components-kit 1.0.1-alpha.2 → 1.0.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -0
- package/custom-elements.json +1550 -0
- package/lib/area-chart-slots.config-BLxiYX05.cjs +20 -0
- package/lib/area-chart-slots.config-C0c2ZzBh.js +52 -0
- package/lib/async-directive-CPjMHOPu.cjs +24 -0
- package/lib/async-directive-SCUUQ3Mh.js +114 -0
- package/lib/bar-chart-slots.config-GSSL7XVA.js +47 -0
- package/lib/bar-chart-slots.config-Jx1PveTM.cjs +20 -0
- package/lib/bar-chart.config-B57geUzJ.cjs +20 -0
- package/lib/bar-chart.config-CQ6HAvs2.js +153 -0
- package/lib/bar-chart.en-BqYbiHO3.cjs +20 -0
- package/lib/bar-chart.en-FwT00qdU.js +69 -0
- package/lib/bar-chart.fr-DGx9smEh.cjs +20 -0
- package/lib/bar-chart.fr-DbxKiM0j.js +44 -0
- package/lib/bar-chart.nl-BYzVExsz.cjs +20 -0
- package/lib/bar-chart.nl-ahX1ARpH.js +44 -0
- package/lib/button-base-B4PdJFVe.cjs +27 -0
- package/lib/button-base-CtfPWS-P.js +142 -0
- package/lib/column-chart.config-B57geUzJ.cjs +20 -0
- package/lib/column-chart.config-C9hP0kX7.js +153 -0
- package/lib/cs-DVZ0Tapy.js +89 -0
- package/lib/cs-I9E81keK.cjs +20 -0
- package/lib/da-DHy05oSR.js +97 -0
- package/lib/da-QkdvupDg.cjs +20 -0
- package/lib/de-Dn5mUzha.cjs +20 -0
- package/lib/de-iM39JlAt.js +109 -0
- package/lib/decompose-numeric-format-B3rVVHpO.cjs +20 -0
- package/lib/decompose-numeric-format-BuZcjH2k.js +39 -0
- package/lib/directive-helpers-BSB0tfc9.cjs +32 -0
- package/lib/directive-helpers-eY1rHtyn.js +154 -0
- package/lib/divider.module-BW8qaMVq.js +211 -0
- package/lib/divider.module-DEy88Ieh.cjs +20 -0
- package/lib/donut-chart-slots.config-BEwhfq27.js +39 -0
- package/lib/donut-chart-slots.config-DIp-24lO.cjs +20 -0
- package/lib/donut-chart.config-3DhKiSSM.js +177 -0
- package/lib/donut-chart.config-DLWJUlHx.cjs +20 -0
- package/lib/donut-chart.en-Blb9oSdU.cjs +20 -0
- package/lib/donut-chart.en-CzjT4-XN.js +85 -0
- package/lib/donut-chart.fr-BeTVa2wh.cjs +20 -0
- package/lib/donut-chart.fr-DftPrKbG.js +39 -0
- package/lib/donut-chart.nl-D9YGbOce.cjs +20 -0
- package/lib/donut-chart.nl-NMatXfhK.js +39 -0
- package/lib/draggable-data-item/index.cjs +20 -0
- package/lib/draggable-data-item/index.js +30 -0
- package/lib/droppable-slot/index.cjs +20 -0
- package/lib/droppable-slot/index.js +30 -0
- package/lib/en-BDBzmAXX.cjs +202 -0
- package/lib/en-CIeY2T5K.js +1980 -0
- package/lib/en-GB-BqYHIX1v.cjs +20 -0
- package/lib/en-GB-CYx--4nh.js +28 -0
- package/lib/es-CwyPlN5d.cjs +20 -0
- package/lib/es-KhTq4jX8.js +305 -0
- package/lib/fi-Dh_ebgpe.js +97 -0
- package/lib/fi-rijeZE5V.cjs +20 -0
- package/lib/fr-BcgE-6S_.cjs +20 -0
- package/lib/fr-CU727YF1.js +305 -0
- package/lib/get-css-variable-BHHQ0SnL.js +1444 -0
- package/lib/get-css-variable-D439CdH9.cjs +24 -0
- package/lib/he-Au3xg6lR.js +89 -0
- package/lib/he-O6Ih8Bqh.cjs +20 -0
- package/lib/hu-BnZ8y3xQ.cjs +20 -0
- package/lib/hu-DNJ-P_MW.js +97 -0
- package/lib/if-defined-BbzmSG-O.js +757 -0
- package/lib/if-defined-V7yEJWI3.cjs +54 -0
- package/lib/imageobject.config-B7ld9bj3.cjs +20 -0
- package/lib/imageobject.config-DZLp9Elq.js +127 -0
- package/lib/index-0314DjEl.cjs +20 -0
- package/lib/index-B9h2L_hV.js +3048 -0
- package/lib/index-BDXFsKUM.cjs +146 -0
- package/lib/index-Bd4cKS9O.js +155 -0
- package/lib/index-BmAD29P2.js +106 -0
- package/lib/index-Bo1DpZ-1.cjs +58 -0
- package/lib/index-C4ePDYEC.cjs +41 -0
- package/lib/index-C9xEN5Ji.js +82 -0
- package/lib/index-CBCm4_7S.js +869 -0
- package/lib/index-CM80_HQw.js +442 -0
- package/lib/index-CcF-9wyF.cjs +71 -0
- package/lib/index-CfEm5P0J.cjs +196 -0
- package/lib/index-CrWoFMZ3.cjs +22 -0
- package/lib/index-CtEJZdT0.js +1627 -0
- package/lib/index-CvX-HLY1.cjs +322 -0
- package/lib/index-D37RwuEH.js +1584 -0
- package/lib/index-D5puKlcm.cjs +96 -0
- package/lib/index-DGz6jCKo.cjs +26 -0
- package/lib/index-DJp_9h0l.js +327 -0
- package/lib/index-DSbgZduE.js +501 -0
- package/lib/index-D_KYpfBM.js +24 -0
- package/lib/index-DdtjeKYI.js +928 -0
- package/lib/index-Dj7PF4Q9.cjs +63 -0
- package/lib/index-Dq3HAOaM.js +127 -0
- package/lib/index-DrIA0eFE.js +392 -0
- package/lib/index-jt6FL_uE.cjs +20 -0
- package/lib/index-kJR406YZ.cjs +112 -0
- package/lib/index-v8ZTprPO.cjs +51 -0
- package/lib/index.cjs +875 -0
- package/lib/index.js +6411 -0
- package/lib/it-Bh5U73z6.js +305 -0
- package/lib/it-PshtLMkq.cjs +20 -0
- package/lib/ja-CCcHUL61.js +89 -0
- package/lib/ja-KIS2HdaG.cjs +20 -0
- package/lib/ko--l4qmjLV.cjs +20 -0
- package/lib/ko-DhapsZMM.js +89 -0
- package/lib/line-chart.config-BZcvfO2c.cjs +20 -0
- package/lib/line-chart.config-CIVN6uLI.js +115 -0
- package/lib/mk-B9HPSuKa.js +97 -0
- package/lib/mk-DZlj-edb.cjs +20 -0
- package/lib/nl-BKlDqOXb.cjs +20 -0
- package/lib/nl-BwSt5Bf4.js +109 -0
- package/lib/no-D-DofYnx.js +109 -0
- package/lib/no-D_SzxhTu.cjs +20 -0
- package/lib/observe-slot-text-DOYmGOZe.js +181 -0
- package/lib/observe-slot-text-oJ0a2KY9.cjs +42 -0
- package/lib/picker/index.cjs +20 -0
- package/lib/picker/index.js +32 -0
- package/lib/pl-D_L_0Boq.js +97 -0
- package/lib/pl-PIK23rK_.cjs +20 -0
- package/lib/popover-Bwnkg-5-.js +67 -0
- package/lib/popover-CQGN8nbX.cjs +32 -0
- package/lib/progress-circle/index.cjs +35 -0
- package/lib/progress-circle/index.js +104 -0
- package/lib/pt-B0BBS5VB.js +89 -0
- package/lib/pt-Dqlu4MS5.cjs +20 -0
- package/lib/ru-Vo-m3O_2.js +108 -0
- package/lib/ru-zyNDTB04.cjs +20 -0
- package/lib/sv-1DPTltNQ.cjs +20 -0
- package/lib/sv-CiozMaev.js +89 -0
- package/lib/textobject.config-C8opcGG4.js +52 -0
- package/lib/textobject.config-DbAajFz8.cjs +20 -0
- package/lib/tr-BkmWvOG2.cjs +20 -0
- package/lib/tr-D_D4i5iv.js +109 -0
- package/lib/zh-CN-DTZ4OmdP.cjs +20 -0
- package/lib/zh-CN-wsl7eFSd.js +89 -0
- package/lib/zh-TW-DTZ4OmdP.cjs +20 -0
- package/lib/zh-TW-wsl7eFSd.js +89 -0
- package/package.json +19 -24
- package/37.js +0 -1
- package/729.js +0 -1
- package/common-31743c5a.js +0 -13
- package/common-b02547a0.js +0 -1
- package/common-b49d9a9d.js +0 -1
- package/common-b5232813.js +0 -56
- package/common-cefd4f4c.js +0 -1
- package/common-d6cb565f.js +0 -1
- package/common-fd868059.js +0 -1
- package/common-fedaf338.js +0 -32
- package/edit-option-picker/index.js +0 -314
- package/edit-option-slider/index.js +0 -102
- package/edit-option-toggle/index.js +0 -114
- package/index.js +0 -346
- package/vendors-93cc3efa.js +0 -1
- package/vendors-bb3d84b5.js +0 -1
@@ -0,0 +1,1584 @@
|
|
1
|
+
/*! * A kit of modern Luzmo Web Components for analytics in your web application.
|
2
|
+
*
|
3
|
+
* Copyright © 2024 Luzmo
|
4
|
+
* All rights reserved.
|
5
|
+
* Luzmo web components (“Luzmo Web Components”)
|
6
|
+
* must be used according to the Luzmo Terms of Service.
|
7
|
+
* This license allows users with a current active Luzmo account
|
8
|
+
* to use the Luzmo Web Components. This license terminates
|
9
|
+
* automatically if a user no longer has an active Luzmo account.
|
10
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
11
|
+
*
|
12
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
14
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
15
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
16
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
17
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
|
+
* SOFTWARE.
|
19
|
+
* */
|
20
|
+
import { s as B, F as D } from "./divider.module-BW8qaMVq.js";
|
21
|
+
import { q as R, O as I, s as j, j as N, T as H, I as K } from "./index-DdtjeKYI.js";
|
22
|
+
import { x as s, T as V, S as M, L as T, r as z, n as l, e as b, E, o as x, B as W } from "./if-defined-BbzmSG-O.js";
|
23
|
+
import "./progress-circle/index.js";
|
24
|
+
import { e as G, i as J, t as Q, r as S, a as _ } from "./directive-helpers-eY1rHtyn.js";
|
25
|
+
import { S as X, o as Y } from "./index-B9h2L_hV.js";
|
26
|
+
import { s as F, n as Z, L as ee, O as te } from "./observe-slot-text-DOYmGOZe.js";
|
27
|
+
import { c as O } from "./async-directive-SCUUQ3Mh.js";
|
28
|
+
const k = Symbol("slotContentIsPresent");
|
29
|
+
function oe(n, e) {
|
30
|
+
var t, o;
|
31
|
+
const i = Array.isArray(e) ? e : [e];
|
32
|
+
class r extends (o = n, t = k, o) {
|
33
|
+
constructor(...m) {
|
34
|
+
super(m), this[t] = /* @__PURE__ */ new Map(), this.managePresenceObservedSlot = () => {
|
35
|
+
let y = !1;
|
36
|
+
i.forEach((p) => {
|
37
|
+
const w = !!this.querySelector(`:scope > ${p}`), f = this[k].get(p) || !1;
|
38
|
+
y = y || f !== w, this[k].set(
|
39
|
+
p,
|
40
|
+
!!this.querySelector(`:scope > ${p}`)
|
41
|
+
);
|
42
|
+
}), y && this.updateComplete.then(() => {
|
43
|
+
this.requestUpdate();
|
44
|
+
});
|
45
|
+
}, new F(this, {
|
46
|
+
config: {
|
47
|
+
childList: !0,
|
48
|
+
subtree: !0
|
49
|
+
},
|
50
|
+
callback: () => {
|
51
|
+
this.managePresenceObservedSlot();
|
52
|
+
}
|
53
|
+
}), this.managePresenceObservedSlot();
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* @private
|
57
|
+
*/
|
58
|
+
get slotContentIsPresent() {
|
59
|
+
if (i.length === 1)
|
60
|
+
return this[k].get(i[0]) || !1;
|
61
|
+
throw new Error(
|
62
|
+
"Multiple selectors provided to `ObserveSlotPresence` use `getSlotContentPresence(selector: string)` instead."
|
63
|
+
);
|
64
|
+
}
|
65
|
+
getSlotContentPresence(m) {
|
66
|
+
if (this[k].has(m))
|
67
|
+
return this[k].get(m) || !1;
|
68
|
+
throw new Error(
|
69
|
+
`The provided selector \`${m}\` is not being observed.`
|
70
|
+
);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
return r;
|
74
|
+
}
|
75
|
+
const ie = "(max-width: 743px) and (hover: none) and (pointer: coarse)";
|
76
|
+
class re {
|
77
|
+
constructor(e, t) {
|
78
|
+
this.key = Symbol("match-media-key"), this.matches = !1, this.host = e, this.host.addController(this), this.media = window.matchMedia(t), this.matches = this.media.matches, this.onChange = this.onChange.bind(this), e.addController(this);
|
79
|
+
}
|
80
|
+
hostConnected() {
|
81
|
+
var e;
|
82
|
+
(e = this.media) == null || e.addEventListener("change", this.onChange);
|
83
|
+
}
|
84
|
+
hostDisconnected() {
|
85
|
+
var e;
|
86
|
+
(e = this.media) == null || e.removeEventListener("change", this.onChange);
|
87
|
+
}
|
88
|
+
onChange(e) {
|
89
|
+
this.matches !== e.matches && (this.matches = e.matches, this.host.requestUpdate(this.key, !this.matches));
|
90
|
+
}
|
91
|
+
}
|
92
|
+
class ne {
|
93
|
+
/**
|
94
|
+
* Creates an instance of PendingStateController.
|
95
|
+
* @param host - The host element that this controller is attached to.
|
96
|
+
*/
|
97
|
+
constructor(e) {
|
98
|
+
this.cachedAriaLabel = null, this.host = e, this.host.addController(this);
|
99
|
+
}
|
100
|
+
/**
|
101
|
+
* Renders the pending state UI.
|
102
|
+
* @returns A TemplateResult representing the pending state UI.
|
103
|
+
*/
|
104
|
+
renderPendingState() {
|
105
|
+
const e = this.host.pendingLabel || "Pending";
|
106
|
+
return this.host.pending ? s`
|
107
|
+
<luzmo-progress-circle
|
108
|
+
id="loader"
|
109
|
+
size="s"
|
110
|
+
indeterminate
|
111
|
+
aria-valuetext=${e}
|
112
|
+
class="progress-circle"
|
113
|
+
></luzmo-progress-circle>
|
114
|
+
` : s``;
|
115
|
+
}
|
116
|
+
/**
|
117
|
+
* Updates the ARIA label of the host element based on the pending state.
|
118
|
+
* Manages Cached Aria Label
|
119
|
+
*/
|
120
|
+
updateAriaLabel() {
|
121
|
+
const { pending: e, disabled: t, pendingLabel: o } = this.host, i = this.host.getAttribute("aria-label");
|
122
|
+
e && !t && i !== o ? (this.cachedAriaLabel = i, this.host.setAttribute("aria-label", o || "Pending")) : (!e || t) && (this.cachedAriaLabel ? this.host.setAttribute("aria-label", this.cachedAriaLabel) : e || this.host.removeAttribute("aria-label"));
|
123
|
+
}
|
124
|
+
hostConnected() {
|
125
|
+
this.cachedAriaLabel || (this.cachedAriaLabel = this.host.getAttribute("aria-label")), this.updateAriaLabel();
|
126
|
+
}
|
127
|
+
hostUpdated() {
|
128
|
+
this.updateAriaLabel();
|
129
|
+
}
|
130
|
+
}
|
131
|
+
/**
|
132
|
+
* @license
|
133
|
+
* Copyright 2018 Google LLC
|
134
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
135
|
+
*/
|
136
|
+
const ae = G(class extends J {
|
137
|
+
constructor(n) {
|
138
|
+
var e;
|
139
|
+
if (super(n), n.type !== Q.ATTRIBUTE || n.name !== "class" || ((e = n.strings) == null ? void 0 : e.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
140
|
+
}
|
141
|
+
render(n) {
|
142
|
+
return " " + Object.keys(n).filter((e) => n[e]).join(" ") + " ";
|
143
|
+
}
|
144
|
+
update(n, [e]) {
|
145
|
+
var o, i;
|
146
|
+
if (this.st === void 0) {
|
147
|
+
this.st = /* @__PURE__ */ new Set(), n.strings !== void 0 && (this.nt = new Set(n.strings.join(" ").split(/\s/).filter((r) => r !== "")));
|
148
|
+
for (const r in e) e[r] && !((o = this.nt) != null && o.has(r)) && this.st.add(r);
|
149
|
+
return this.render(e);
|
150
|
+
}
|
151
|
+
const t = n.element.classList;
|
152
|
+
for (const r of this.st) r in e || (t.remove(r), this.st.delete(r));
|
153
|
+
for (const r in e) {
|
154
|
+
const a = !!e[r];
|
155
|
+
a === this.st.has(r) || (i = this.nt) != null && i.has(r) || (a ? (t.add(r), this.st.add(r)) : (t.remove(r), this.st.delete(r)));
|
156
|
+
}
|
157
|
+
return V;
|
158
|
+
}
|
159
|
+
}), le = ":host{--menu-item-top-to-action: var(--luzmo-spacing-1);--menu-item-top-to-checkbox: var(--luzmo-spacing-1);--menu-item-label-line-height: var(--luzmo-line-height);--menu-item-label-line-height-cjk: 1.5;--menu-item-label-to-description-spacing: 1px;--menu-item-focus-indicator-width: var(--luzmo-indicator-width);--menu-item-focus-indicator-color: var(--luzmo-indicator-color);--menu-item-label-to-value-area-min-spacing: var(--luzmo-spacing-3);--menu-item-label-content-color-default: var(--luzmo-font-color);--menu-item-label-content-color-hover: var(--luzmo-font-color-hover);--menu-item-label-content-color-down: var(--luzmo-font-color-down);--menu-item-label-content-color-focus: var(--luzmo-font-color-focus);--menu-item-highlight-label-background-color: var(--luzmo-primary);--menu-item-highlight-label-content-color: var(--luzmo-font-color);--menu-item-highlight-label-content-color-hover: var( --luzmo-font-color-hover );--menu-item-highlight-label-content-color-down: var(--luzmo-font-color-down);--menu-item-highlight-label-content-color-focus: var( --luzmo-font-color-focus );--menu-item-label-icon-color-default: var(--luzmo-font-color);--menu-item-label-icon-color-hover: var(--luzmo-font-color-hover);--menu-item-label-icon-color-down: var(--luzmo-font-color-down);--menu-item-label-icon-color-focus: var(--luzmo-font-color-focus);--menu-item-label-content-color-disabled: var(--luzmo-font-color-disabled);--menu-item-label-icon-color-disabled: var(--luzmo-font-color-disabled);--menu-item-description-line-height: var(--luzmo-line-height);--menu-item-description-line-height-cjk: 1.5;--menu-item-description-color-default: var(--luzmo-font-color);--menu-item-description-color-hover: var(--luzmo-font-color-hover);--menu-item-description-color-down: var(--luzmo-font-color-down);--menu-item-description-color-focus: var(--luzmo-font-color-focus);--menu-item-description-color-disabled: var(--luzmo-color-disabled);--menu-section-header-line-height: var(--luzmo-line-height);--menu-section-header-line-height-cjk: 1.5;--menu-section-header-font-weight: bold;--menu-section-header-color: var(--luzmo-font-color-hard);--menu-collapsible-icon-color: var(--luzmo-font-color-hard);--menu-checkmark-icon-color-default: var(--luzmo-primary);--menu-checkmark-icon-color-hover: var(--luzmo-primary-hover);--menu-checkmark-icon-color-down: var(--luzmo-primary-down);--menu-checkmark-icon-color-focus: var(--luzmo-primary-focus);--menu-drillin-icon-color-default: var(--luzmo-font-color);--menu-drillin-icon-color-hover: var(--luzmo-font-color-hover);--menu-drillin-icon-color-down: var(--luzmo-font-color-down);--menu-drillin-icon-color-focus: var(--luzmo-font-color-focus);--menu-item-value-color-default: var(--luzmo-font-color);--menu-item-value-color-hover: var(--luzmo-font-color-hover);--menu-item-value-color-down: var(--luzmo-font-color-down);--menu-item-value-color-focus: var(--luzmo-font-color-focus);--menu-checkmark-display-hidden: none;--menu-checkmark-display-shown: block;--menu-checkmark-display: block;--menu-item-collapsible-no-icon-submenu-item-padding-x-start: 28px;--menu-item-background-color-selected: var(--luzmo-background-color);--menu-item-background-color-default: var(--luzmo-background-color);--menu-item-background-color-hover: var(--luzmo-background-color-hover);--menu-item-background-color-down: var(--luzmo-background-color-down);--menu-item-background-color-key-focus: var(--luzmo-background-color-focus)}:host{--menu-item-min-height: var(--luzmo-component-height);--menu-item-icon-height: var(--luzmo-font-size);--menu-item-icon-width: var(--luzmo-font-size);--menu-item-label-font-size: var(--luzmo-font-size);--menu-item-label-text-to-visual: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--menu-item-label-inline-edge-to-content: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--menu-item-top-edge-to-text: var(--luzmo-spacing-1);--menu-item-bottom-edge-to-text: var(--luzmo-spacing-1);--menu-item-text-to-control: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--menu-item-description-font-size: var(--luzmo-font-size-xs);--menu-section-header-font-size: var(--luzmo-font-size);--menu-section-header-min-width: var(--luzmo-component-height);--menu-item-selectable-edge-to-text-not-selected: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--menu-item-checkmark-size: var(--luzmo-font-size-xs);--menu-item-angle-size: var(--luzmo-font-size);--menu-item-top-to-checkmark: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--menu-back-icon-margin: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) )}:host([size=s]){--menu-item-min-height: var(--luzmo-component-height-s);--menu-item-icon-height: var(--luzmo-font-size-s);--menu-item-icon-width: var(--luzmo-font-size-s);--menu-item-label-font-size: var(--luzmo-font-size-s);--menu-item-label-text-to-visual: var(--luzmo-spacing-3);--menu-item-label-inline-edge-to-content: var(--luzmo-spacing-3);--menu-item-top-edge-to-text: var(--luzmo-spacing-1);--menu-item-bottom-edge-to-text: var(--luzmo-spacing-1);--menu-item-text-to-control: var(--luzmo-spacing-2);--menu-item-description-font-size: var(--luzmo-font-size-xs);--menu-section-header-font-size: var(--luzmo-font-size-s);--menu-section-header-min-width: var(--luzmo-component-height-s);--menu-item-selectable-edge-to-text-not-selected: var(--luzmo-spacing-3);--menu-item-checkmark-size: var(--luzmo-font-size-xs);--menu-item-angle-size: var(--luzmo-font-size-s);--menu-item-top-to-checkmark: var(--luzmo-spacing-3);--menu-back-icon-margin: var(--luzmo-spacing-3)}:host([size=l]){--menu-item-min-height: var(--luzmo-component-height-l);--menu-item-icon-height: var(--luzmo-font-size-l);--menu-item-icon-width: var(--luzmo-font-size-l);--menu-item-label-font-size: var(--luzmo-font-size-l);--menu-item-label-text-to-visual: var(--luzmo-spacing-4);--menu-item-label-inline-edge-to-content: var(--luzmo-spacing-4);--menu-item-top-edge-to-text: var(--luzmo-spacing-2);--menu-item-bottom-edge-to-text: var(--luzmo-spacing-2);--menu-item-text-to-control: var(--luzmo-spacing-3);--menu-item-description-font-size: var(--luzmo-font-size-s);--menu-section-header-font-size: var(--luzmo-font-size-l);--menu-section-header-min-width: var(--luzmo-component-height-l);--menu-item-selectable-edge-to-text-not-selected: var(--luzmo-spacing-4);--menu-item-checkmark-size: var(--luzmo-font-size-s);--menu-item-angle-size: var(--luzmo-font-size-l);--menu-item-top-to-checkmark: var(--luzmo-spacing-4);--menu-back-icon-margin: var(--luzmo-spacing-4)}:host([size=xl]){--menu-item-min-height: var(--luzmo-component-height-xl);--menu-item-icon-height: var(--font-size-xl);--menu-item-icon-width: var(--font-size-xl);--menu-item-label-font-size: var(--font-size-xl);--menu-item-label-text-to-visual: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--menu-item-label-inline-edge-to-content: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--menu-item-top-edge-to-text: var(--luzmo-spacing-2);--menu-item-bottom-edge-to-text: var(--luzmo-spacing-2);--menu-item-text-to-control: var(--luzmo-spacing-4);--menu-item-description-font-size: var(--luzmo-font-size);--menu-section-header-font-size: var(--font-size-xl);--menu-section-header-min-width: var(--luzmo-component-height-xl);--menu-item-selectable-edge-to-text-not-selected: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--menu-item-checkmark-size: var(--font-size);--menu-item-angle-size: var(--luzmo-font-size-xl);--menu-item-top-to-checkmark: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--menu-back-icon-margin: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) )}:host([variant=highlight]){--menu-item-highlight-label-content-color: var(--luzmo-primary-inverse-color);--menu-item-highlight-label-content-color-hover: var( --luzmo-primary-inverse-color );--menu-item-highlight-label-content-color-down: var( --luzmo-primary-inverse-color );--menu-item-highlight-label-content-color-focus: var( --luzmo-primary-inverse-color )}@media (forced-colors: active){:host{--highcontrast-menu-item-background-color-default: ButtonFace;--highcontrast-menu-item-color-default: ButtonText;--highcontrast-menu-item-background-color-focus: Highlight;--highcontrast-menu-item-color-focus: HighlightText;--highcontrast-menu-checkmark-icon-color-default: Highlight;--highcontrast-menu-item-color-disabled: GrayText;--highcontrast-menu-item-focus-indicator-color: Highlight;--highcontrast-menu-item-selected-background-color: Highlight;--highcontrast-menu-item-selected-color: HighlightText}@supports (color: SelectedItem){:host{--highcontrast-menu-item-selected-background-color: SelectedItem;--highcontrast-menu-item-selected-color: SelectedItemText}}}:host{inline-size:auto;inline-size:var(--luzmo-menu-inline-size, auto);box-sizing:border-box;margin:0;padding:0;list-style-type:none;display:inline-block;overflow:auto}:host:lang(ja),:host:lang(ko),:host:lang(zh){--menu-item-label-line-height: var( --luzmo-menu-item-label-line-height-cjk, var(--menu-item-label-line-height-cjk) );--menu-item-description-line-height: var( --luzmo-menu-item-description-line-height-cjk, var(--menu-item-description-line-height-cjk) );--menu-section-header-line-height: var( --luzmo-menu-section-header-line-height-cjk, var(--menu-section-header-line-height-cjk) )}:host([selects]) ::slotted(luzmo-menu-item){--menu-checkmark-display: var(--menu-checkmark-display-hidden);padding-inline-start:var(--luzmo-menu-item-selectable-edge-to-text-not-selected, var(--menu-item-selectable-edge-to-text-not-selected))}:host([selects]) ::slotted(luzmo-menu-item[selected]){--menu-checkmark-display: var(--menu-checkmark-display-shown);padding-inline-start:var(--luzmo-menu-item-label-inline-edge-to-content, var(--menu-item-label-inline-edge-to-content))}.luzmo-Menu-backIcon{margin-block:var(--luzmo-menu-back-icon-margin-block, var(--menu-back-icon-margin));margin-inline:var(--luzmo-menu-back-icon-margin-inline, var(--menu-back-icon-margin));fill:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-back-icon-color-default, var(--menu-section-header-color)));color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-back-icon-color-default, var(--menu-section-header-color)))}.luzmo-Menu-back:focus-visible{box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * 1) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)));box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * var(--menu-item-focus-indicator-direction-scalar, 1)) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)))}.luzmo-Menu-sectionHeading{color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-section-header-color, var(--menu-section-header-color)));font-size:var(--luzmo-menu-section-header-font-size, var(--menu-section-header-font-size));font-weight:var(--luzmo-menu-section-header-font-weight, var(--menu-section-header-font-weight));line-height:var(--luzmo-menu-section-header-line-height, var(--menu-section-header-line-height));min-inline-size:var(--luzmo-menu-section-header-min-width, var(--menu-section-header-min-width));padding-block-start:var(--luzmo-menu-section-header-top-edge-to-text, var(--luzmo-menu-item-top-edge-to-text, var(--menu-item-top-edge-to-text)));padding-block-end:var(--luzmo-menu-section-header-bottom-edge-to-text, var(--luzmo-menu-item-bottom-edge-to-text, var(--menu-item-bottom-edge-to-text)));padding-inline:var(--luzmo-menu-item-label-inline-edge-to-content, var(--menu-item-label-inline-edge-to-content));grid-area:sectionHeadingArea/1/sectionHeadingArea/-1;display:block}.luzmo-Menu-back{padding-inline:0 var(--luzmo-menu-back-padding-inline-end, var(--menu-item-label-inline-edge-to-content));padding-inline:var(--luzmo-menu-back-padding-inline-start, 0) var(--luzmo-menu-back-padding-inline-end, var(--menu-item-label-inline-edge-to-content));padding-block:0;padding-block:var(--luzmo-menu-back-padding-block-start, 0) var(--luzmo-menu-back-padding-block-end, 0);flex-flow:wrap;align-items:center;display:flex}.luzmo-Menu-back .luzmo-Menu-sectionHeading{padding:0}.luzmo-Menu-backButton{cursor:pointer;background:none;border:0;margin:0;padding:0;display:inline-flex}.luzmo-Menu-backButton:focus-visible{outline:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color);outline-offset:calc((var(--luzmo-indicator-width) + 1px) * -1)}.luzmo-Menu-backHeading{color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-back-heading-color, var(--menu-section-header-color)));font-size:var(--luzmo-menu-section-header-font-size, var(--menu-section-header-font-size));font-weight:var(--luzmo-menu-section-header-font-weight, var(--menu-section-header-font-weight));line-height:var(--luzmo-menu-section-header-line-height, var(--menu-section-header-line-height));display:block}:host{display:inline-flex;flex-direction:column;width:100%}:host(:focus){outline:none}::slotted(*){flex-shrink:0}";
|
160
|
+
var se = Object.defineProperty, ce = Object.getOwnPropertyDescriptor, g = (n, e, t, o) => {
|
161
|
+
for (var i = o > 1 ? void 0 : o ? ce(e, t) : e, r = n.length - 1, a; r >= 0; r--)
|
162
|
+
(a = n[r]) && (i = (o ? a(e, t, i) : a(i)) || i);
|
163
|
+
return o && i && se(e, t, i), i;
|
164
|
+
};
|
165
|
+
function ue(n, e) {
|
166
|
+
return !!e && (n === e || n.contains(e));
|
167
|
+
}
|
168
|
+
class v extends M(T, {
|
169
|
+
noDefaultSize: !0
|
170
|
+
}) {
|
171
|
+
constructor() {
|
172
|
+
super(), this.label = "", this.ignore = !1, this.value = "", this.valueSeparator = ",", this.selectedItems = [], this.focusedItemIndex = 0, this.focusInItemIndex = 0, this._selected = [], this.cacheUpdated = Promise.resolve(), this.childItemSet = /* @__PURE__ */ new Set(), this.selectedItemsMap = /* @__PURE__ */ new Map(), this._hasUpdatedSelectedItemIndex = !1, this._willUpdateItems = !1, this.pointerUpTarget = null, this.descendentOverlays = /* @__PURE__ */ new Map(), this.handleSubmenuClosed = (e) => {
|
173
|
+
e.stopPropagation(), e.composedPath()[0].dispatchEvent(
|
174
|
+
new Event("luzmo-menu-submenu-closed", {
|
175
|
+
bubbles: !0,
|
176
|
+
composed: !0
|
177
|
+
})
|
178
|
+
);
|
179
|
+
}, this.handleSubmenuOpened = (e) => {
|
180
|
+
e.stopPropagation(), e.composedPath()[0].dispatchEvent(
|
181
|
+
new Event("luzmo-menu-submenu-opened", {
|
182
|
+
bubbles: !0,
|
183
|
+
composed: !0
|
184
|
+
})
|
185
|
+
);
|
186
|
+
const o = this.childItems[this.focusedItemIndex];
|
187
|
+
o && (o.focused = !1);
|
188
|
+
const i = e.composedPath().find((a) => this.childItemSet.has(a));
|
189
|
+
if (!i)
|
190
|
+
return;
|
191
|
+
const r = this.childItems.indexOf(
|
192
|
+
i
|
193
|
+
);
|
194
|
+
this.focusedItemIndex = r, this.focusInItemIndex = r;
|
195
|
+
}, this.resolveCacheUpdated = () => {
|
196
|
+
}, this.addEventListener(
|
197
|
+
"luzmo-menu-item-added-or-updated",
|
198
|
+
this.onSelectableItemAddedOrUpdated
|
199
|
+
), this.addEventListener(
|
200
|
+
"luzmo-menu-item-added-or-updated",
|
201
|
+
this.onFocusableItemAddedOrUpdated,
|
202
|
+
{
|
203
|
+
capture: !0
|
204
|
+
}
|
205
|
+
), this.addEventListener("click", this.handleClick), this.addEventListener("pointerup", this.handlePointerup), this.addEventListener("focusin", this.handleFocusin), this.addEventListener("blur", this.handleBlur), this.addEventListener("luzmo-opened", this.handleSubmenuOpened), this.addEventListener("luzmo-closed", this.handleSubmenuClosed);
|
206
|
+
}
|
207
|
+
static get styles() {
|
208
|
+
return [z(le)];
|
209
|
+
}
|
210
|
+
get isSubmenu() {
|
211
|
+
return this.slot === "submenu";
|
212
|
+
}
|
213
|
+
get selected() {
|
214
|
+
return this._selected;
|
215
|
+
}
|
216
|
+
set selected(e) {
|
217
|
+
if (e === this.selected)
|
218
|
+
return;
|
219
|
+
const t = this.selected;
|
220
|
+
this._selected = e, this.selectedItems = [], this.selectedItemsMap.clear(), this.childItems.forEach((o) => {
|
221
|
+
this === o.menuData.selectionRoot && (o.selected = this.selected.includes(o.value), o.selected && (this.selectedItems.push(o), this.selectedItemsMap.set(o, !0)));
|
222
|
+
}), this.requestUpdate("selected", t);
|
223
|
+
}
|
224
|
+
get childItems() {
|
225
|
+
return this.cachedChildItems || (this.cachedChildItems = this.updateCachedMenuItems()), this.cachedChildItems;
|
226
|
+
}
|
227
|
+
/**
|
228
|
+
* Hide this getter from web-component-analyzer until
|
229
|
+
* https://github.com/runem/web-component-analyzer/issues/131
|
230
|
+
* has been addressed.
|
231
|
+
*
|
232
|
+
* @private
|
233
|
+
*/
|
234
|
+
get childRole() {
|
235
|
+
if (this.resolvedRole === "listbox")
|
236
|
+
return "option";
|
237
|
+
switch (this.resolvedSelects) {
|
238
|
+
case "single":
|
239
|
+
return "menuitemradio";
|
240
|
+
case "multiple":
|
241
|
+
return "menuitemcheckbox";
|
242
|
+
default:
|
243
|
+
return "menuitem";
|
244
|
+
}
|
245
|
+
}
|
246
|
+
get ownRole() {
|
247
|
+
return "menu";
|
248
|
+
}
|
249
|
+
focus({ preventScroll: e } = {}) {
|
250
|
+
if (this.childItems.every((o) => o.disabled))
|
251
|
+
return;
|
252
|
+
if (this.childItems.some((o) => o.menuData.focusRoot !== this)) {
|
253
|
+
super.focus({ preventScroll: e });
|
254
|
+
return;
|
255
|
+
}
|
256
|
+
this.focusMenuItemByOffset(0), super.focus({ preventScroll: e });
|
257
|
+
const t = this.selectedItems[0];
|
258
|
+
t && !e && t.scrollIntoView({ block: "nearest" });
|
259
|
+
}
|
260
|
+
handleFocusin(e) {
|
261
|
+
var i;
|
262
|
+
if (this.childItems.some((r) => r.menuData.focusRoot !== this))
|
263
|
+
return;
|
264
|
+
const t = this.getRootNode().activeElement, o = ((i = this.childItems[this.focusedItemIndex]) == null ? void 0 : i.menuData.selectionRoot) || this;
|
265
|
+
if ((t !== o || e.target !== this) && (o.focus({ preventScroll: !0 }), t && this.focusedItemIndex === 0)) {
|
266
|
+
const r = this.childItems.indexOf(t);
|
267
|
+
this.focusMenuItemByOffset(Math.max(r, 0));
|
268
|
+
}
|
269
|
+
this.startListeningToKeyboard();
|
270
|
+
}
|
271
|
+
startListeningToKeyboard() {
|
272
|
+
this.addEventListener("keydown", this.handleKeydown);
|
273
|
+
}
|
274
|
+
handleBlur(e) {
|
275
|
+
ue(this, e.relatedTarget) || (this.stopListeningToKeyboard(), this.childItems.forEach((t) => t.focused = !1), this.removeAttribute("aria-activedescendant"));
|
276
|
+
}
|
277
|
+
stopListeningToKeyboard() {
|
278
|
+
this.removeEventListener("keydown", this.handleKeydown);
|
279
|
+
}
|
280
|
+
selectOrToggleItem(e) {
|
281
|
+
const t = this.resolvedSelects, o = new Map(this.selectedItemsMap), i = [...this.selected], r = [...this.selectedItems], a = this.value, m = this.childItems[this.focusedItemIndex];
|
282
|
+
if (m && (m.focused = !1, m.active = !1), this.focusedItemIndex = this.childItems.indexOf(e), this.forwardFocusVisibleToItem(e), t === "multiple") {
|
283
|
+
this.selectedItemsMap.has(e) ? this.selectedItemsMap.delete(e) : this.selectedItemsMap.set(e, !0);
|
284
|
+
const p = [], w = [];
|
285
|
+
this.childItemSet.forEach((f) => {
|
286
|
+
f.menuData.selectionRoot === this && this.selectedItemsMap.has(f) && (p.push(f.value), w.push(f));
|
287
|
+
}), this._selected = p, this.selectedItems = w, this.value = this.selected.join(this.valueSeparator);
|
288
|
+
} else
|
289
|
+
this.selectedItemsMap.clear(), this.selectedItemsMap.set(e, !0), this.value = e.value, this._selected = [e.value], this.selectedItems = [e];
|
290
|
+
if (!this.dispatchEvent(
|
291
|
+
new Event("change", {
|
292
|
+
cancelable: !0,
|
293
|
+
bubbles: !0,
|
294
|
+
composed: !0
|
295
|
+
})
|
296
|
+
)) {
|
297
|
+
this._selected = i, this.selectedItems = r, this.selectedItemsMap = o, this.value = a;
|
298
|
+
return;
|
299
|
+
}
|
300
|
+
if (t === "single") {
|
301
|
+
for (const p of o.keys())
|
302
|
+
p !== e && (p.selected = !1);
|
303
|
+
e.selected = !0;
|
304
|
+
} else t === "multiple" && (e.selected = !e.selected);
|
305
|
+
}
|
306
|
+
handleKeydown(e) {
|
307
|
+
if (e.defaultPrevented)
|
308
|
+
return;
|
309
|
+
const t = this.childItems[this.focusedItemIndex];
|
310
|
+
t && (t.focused = !0);
|
311
|
+
const { key: o } = e;
|
312
|
+
if (e.shiftKey && e.target !== this && this.hasAttribute("tabindex")) {
|
313
|
+
this.removeAttribute("tabindex");
|
314
|
+
const i = (r) => {
|
315
|
+
!r.shiftKey && !this.hasAttribute("tabindex") && (this.tabIndex = 0, document.removeEventListener("keyup", i), this.removeEventListener("focusout", i));
|
316
|
+
};
|
317
|
+
document.addEventListener("keyup", i), this.addEventListener("focusout", i);
|
318
|
+
}
|
319
|
+
if (o === "Tab") {
|
320
|
+
this.prepareToCleanUp();
|
321
|
+
return;
|
322
|
+
}
|
323
|
+
if (o === " " && (t != null && t.hasSubmenu)) {
|
324
|
+
t.openOverlay();
|
325
|
+
return;
|
326
|
+
}
|
327
|
+
if (o === " " || o === "Enter") {
|
328
|
+
const i = this.childItems[this.focusedItemIndex];
|
329
|
+
i && i.menuData.selectionRoot === e.target && (e.preventDefault(), i.click());
|
330
|
+
return;
|
331
|
+
}
|
332
|
+
if (o === "ArrowDown" || o === "ArrowUp") {
|
333
|
+
const i = this.childItems[this.focusedItemIndex];
|
334
|
+
i && i.menuData.selectionRoot === e.target && this.navigateWithinMenu(e);
|
335
|
+
return;
|
336
|
+
}
|
337
|
+
this.navigateBetweenRelatedMenus(e);
|
338
|
+
}
|
339
|
+
focusMenuItemByOffset(e) {
|
340
|
+
const t = e || 1, o = this.childItems[this.focusedItemIndex];
|
341
|
+
o && (o.focused = !1, o.active = o.open), this.focusedItemIndex = (this.childItems.length + this.focusedItemIndex + e) % this.childItems.length;
|
342
|
+
let i = this.childItems[this.focusedItemIndex], r = this.childItems.length;
|
343
|
+
for (; i != null && i.disabled && r; )
|
344
|
+
r -= 1, this.focusedItemIndex = (this.childItems.length + this.focusedItemIndex + t) % this.childItems.length, i = this.childItems[this.focusedItemIndex];
|
345
|
+
return i != null && i.disabled || this.forwardFocusVisibleToItem(i), i;
|
346
|
+
}
|
347
|
+
updateSelectedItemIndex() {
|
348
|
+
let e = 0;
|
349
|
+
const t = /* @__PURE__ */ new Map(), o = [], i = [];
|
350
|
+
let r = this.childItems.length;
|
351
|
+
for (; r; ) {
|
352
|
+
r -= 1;
|
353
|
+
const a = this.childItems[r];
|
354
|
+
a.menuData.selectionRoot === this && ((a.selected || !this._hasUpdatedSelectedItemIndex && this.selected.includes(a.value)) && (e = r, t.set(a, !0), o.unshift(a.value), i.unshift(a)), r !== e && (a.focused = !1));
|
355
|
+
}
|
356
|
+
i.map((a, m) => {
|
357
|
+
m > 0 && (a.focused = !1);
|
358
|
+
}), this.selectedItemsMap = t, this._selected = o, this.selectedItems = i, this.value = this.selected.join(this.valueSeparator), this.focusedItemIndex = e, this.focusInItemIndex = e;
|
359
|
+
}
|
360
|
+
closeDescendentOverlays() {
|
361
|
+
this.descendentOverlays.forEach((e) => {
|
362
|
+
e.open = !1;
|
363
|
+
}), this.descendentOverlays = /* @__PURE__ */ new Map();
|
364
|
+
}
|
365
|
+
render() {
|
366
|
+
return this.renderMenuItemSlot();
|
367
|
+
}
|
368
|
+
connectedCallback() {
|
369
|
+
super.connectedCallback(), !this.hasAttribute("role") && !this.ignore && this.setAttribute("role", this.ownRole), this.updateComplete.then(() => this.updateItemFocus());
|
370
|
+
}
|
371
|
+
disconnectedCallback() {
|
372
|
+
this.cachedChildItems = void 0, this.selectedItems = [], this.selectedItemsMap.clear(), this.childItemSet.clear(), this.descendentOverlays = /* @__PURE__ */ new Map(), super.disconnectedCallback();
|
373
|
+
}
|
374
|
+
handleDescendentOverlayOpened(e) {
|
375
|
+
const t = e.composedPath()[0];
|
376
|
+
t.overlayElement && this.descendentOverlays.set(t.overlayElement, t.overlayElement);
|
377
|
+
}
|
378
|
+
handleDescendentOverlayClosed(e) {
|
379
|
+
const t = e.composedPath()[0];
|
380
|
+
t.overlayElement && this.descendentOverlays.delete(t.overlayElement);
|
381
|
+
}
|
382
|
+
navigateWithinMenu(e) {
|
383
|
+
const { key: t } = e, o = this.childItems[this.focusedItemIndex], i = t === "ArrowDown" ? 1 : -1, r = this.focusMenuItemByOffset(i);
|
384
|
+
r !== o && (e.preventDefault(), e.stopPropagation(), r.scrollIntoView({ block: "nearest" }));
|
385
|
+
}
|
386
|
+
navigateBetweenRelatedMenus(e) {
|
387
|
+
const { key: t } = e;
|
388
|
+
e.stopPropagation();
|
389
|
+
const o = this.isLTR && t === "ArrowRight" || !this.isLTR && t === "ArrowLeft", i = this.isLTR && t === "ArrowLeft" || !this.isLTR && t === "ArrowRight";
|
390
|
+
if (o) {
|
391
|
+
const r = this.childItems[this.focusedItemIndex];
|
392
|
+
r != null && r.hasSubmenu && r.openOverlay();
|
393
|
+
} else i && this.isSubmenu && (this.dispatchEvent(new Event("close", { bubbles: !0 })), this.updateSelectedItemIndex());
|
394
|
+
}
|
395
|
+
renderMenuItemSlot() {
|
396
|
+
return s`
|
397
|
+
<slot
|
398
|
+
@luzmo-menu-submenu-opened=${this.handleDescendentOverlayOpened}
|
399
|
+
@luzmo-menu-submenu-closed=${this.handleDescendentOverlayClosed}
|
400
|
+
@slotchange=${this.handleSlotchange}
|
401
|
+
></slot>
|
402
|
+
`;
|
403
|
+
}
|
404
|
+
firstUpdated(e) {
|
405
|
+
if (super.firstUpdated(e), !this.hasAttribute("tabindex") && !this.ignore) {
|
406
|
+
const o = this.getAttribute("role");
|
407
|
+
this.tabIndex = o === "group" ? -1 : 0;
|
408
|
+
}
|
409
|
+
const t = [
|
410
|
+
new Promise((o) => requestAnimationFrame(() => o(!0)))
|
411
|
+
];
|
412
|
+
[...this.children].forEach((o) => {
|
413
|
+
o.localName === "luzmo-menu-item" && t.push(o.updateComplete);
|
414
|
+
}), this.childItemsUpdated = Promise.all(t);
|
415
|
+
}
|
416
|
+
updated(e) {
|
417
|
+
super.updated(e), e.has("selects") && this.hasUpdated && this.selectsChanged(), e.has("label") && (this.label || e.get("label") !== void 0) && (this.label ? this.setAttribute("aria-label", this.label) : this.removeAttribute("aria-label"));
|
418
|
+
}
|
419
|
+
selectsChanged() {
|
420
|
+
const e = [
|
421
|
+
new Promise((t) => requestAnimationFrame(() => t(!0)))
|
422
|
+
];
|
423
|
+
this.childItemSet.forEach((t) => {
|
424
|
+
e.push(t.triggerUpdate());
|
425
|
+
}), this.childItemsUpdated = Promise.all(e);
|
426
|
+
}
|
427
|
+
async getUpdateComplete() {
|
428
|
+
const e = await super.getUpdateComplete();
|
429
|
+
return await this.childItemsUpdated, await this.cacheUpdated, e;
|
430
|
+
}
|
431
|
+
updateCachedMenuItems() {
|
432
|
+
if (this.cachedChildItems = [], !this.menuSlot)
|
433
|
+
return [];
|
434
|
+
const e = this.menuSlot.assignedElements({
|
435
|
+
flatten: !0
|
436
|
+
});
|
437
|
+
for (const [t, o] of e.entries()) {
|
438
|
+
if (this.childItemSet.has(o)) {
|
439
|
+
this.cachedChildItems.push(o);
|
440
|
+
continue;
|
441
|
+
}
|
442
|
+
const r = o.localName === "slot" ? o.assignedElements({
|
443
|
+
flatten: !0
|
444
|
+
}) : [...o.querySelectorAll(":scope > *")];
|
445
|
+
e.splice(
|
446
|
+
t,
|
447
|
+
1,
|
448
|
+
o,
|
449
|
+
...r
|
450
|
+
);
|
451
|
+
}
|
452
|
+
return this.cachedChildItems;
|
453
|
+
}
|
454
|
+
/**
|
455
|
+
* When a descendant `<luzmo-menu-item>` element is added or updated it will dispatch
|
456
|
+
* this event to announce its presence in the DOM. During the CAPTURE phase the first
|
457
|
+
* Menu based element that the event encounters will manage the focus state of the
|
458
|
+
* dispatching `<luzmo-menu-item>` element.
|
459
|
+
* @param event
|
460
|
+
*/
|
461
|
+
onFocusableItemAddedOrUpdated(e) {
|
462
|
+
e.menuCascade.set(this, {
|
463
|
+
hadFocusRoot: !!e.item.menuData.focusRoot,
|
464
|
+
ancestorWithSelects: e.currentAncestorWithSelects
|
465
|
+
}), this.selects && (e.currentAncestorWithSelects = this), e.item.menuData.focusRoot = e.item.menuData.focusRoot || this;
|
466
|
+
}
|
467
|
+
/**
|
468
|
+
* When a descendant `<luzmo-menu-item>` element is added or updated it will dispatch
|
469
|
+
* this event to announce its presence in the DOM. During the BUBBLE phase the first
|
470
|
+
* Menu based element that the event encounters that does not inherit selection will
|
471
|
+
* manage the selection state of the dispatching `<luzmo-menu-item>` element.
|
472
|
+
* @param event
|
473
|
+
*/
|
474
|
+
onSelectableItemAddedOrUpdated(e) {
|
475
|
+
var i, r;
|
476
|
+
const t = e.menuCascade.get(this);
|
477
|
+
if (!t)
|
478
|
+
return;
|
479
|
+
if (e.item.menuData.parentMenu = e.item.menuData.parentMenu || this, t.hadFocusRoot && !this.ignore && (this.tabIndex = -1), this.addChildItem(e.item), this.selects === "inherit") {
|
480
|
+
this.resolvedSelects = "inherit";
|
481
|
+
const a = (i = e.currentAncestorWithSelects) == null ? void 0 : i.ignore;
|
482
|
+
this.resolvedRole = a ? "none" : ((r = e.currentAncestorWithSelects) == null ? void 0 : r.getAttribute("role")) || this.getAttribute("role") || void 0;
|
483
|
+
} else this.selects ? (this.resolvedRole = this.ignore ? "none" : this.getAttribute("role") || void 0, this.resolvedSelects = this.selects) : (this.resolvedRole = this.ignore ? "none" : this.getAttribute("role") || void 0, this.resolvedSelects = this.resolvedRole === "none" ? "ignore" : "none");
|
484
|
+
const o = this.resolvedSelects === "single" || this.resolvedSelects === "multiple";
|
485
|
+
e.item.menuData.cleanupSteps.push(
|
486
|
+
(a) => this.removeChildItem(a)
|
487
|
+
), (o || !this.selects && this.resolvedSelects !== "ignore") && !e.item.menuData.selectionRoot && (e.item.setRole(this.childRole), e.item.menuData.selectionRoot = e.item.menuData.selectionRoot || this, e.item.selected && (this.selectedItemsMap.set(e.item, !0), this.selectedItems = [...this.selectedItems, e.item], this._selected = [...this.selected, e.item.value], this.value = this.selected.join(this.valueSeparator)));
|
488
|
+
}
|
489
|
+
addChildItem(e) {
|
490
|
+
this.childItemSet.add(e), this.handleItemsChanged();
|
491
|
+
}
|
492
|
+
async removeChildItem(e) {
|
493
|
+
this.childItemSet.delete(e), this.cachedChildItems = void 0, e.focused && (this.handleItemsChanged(), await this.updateComplete, this.focus());
|
494
|
+
}
|
495
|
+
handleClick(e) {
|
496
|
+
if (this.pointerUpTarget === e.target) {
|
497
|
+
this.pointerUpTarget = null;
|
498
|
+
return;
|
499
|
+
}
|
500
|
+
this.handlePointerBasedSelection(e);
|
501
|
+
}
|
502
|
+
handlePointerup(e) {
|
503
|
+
this.pointerUpTarget = e.target, this.handlePointerBasedSelection(e);
|
504
|
+
}
|
505
|
+
handlePointerBasedSelection(e) {
|
506
|
+
var i, r;
|
507
|
+
if (e instanceof MouseEvent && e.button !== 0)
|
508
|
+
return;
|
509
|
+
const o = e.composedPath().find((a) => a instanceof Element ? a.getAttribute("role") === this.childRole : !1);
|
510
|
+
if (e.defaultPrevented) {
|
511
|
+
const a = this.childItems.indexOf(o);
|
512
|
+
((i = o == null ? void 0 : o.menuData) == null ? void 0 : i.focusRoot) === this && a !== -1 && (this.focusedItemIndex = a);
|
513
|
+
return;
|
514
|
+
}
|
515
|
+
if (o != null && o.href && o.href.length > 0) {
|
516
|
+
this.dispatchEvent(
|
517
|
+
new Event("change", {
|
518
|
+
bubbles: !0,
|
519
|
+
composed: !0
|
520
|
+
})
|
521
|
+
);
|
522
|
+
return;
|
523
|
+
} else if (((r = o == null ? void 0 : o.menuData) == null ? void 0 : r.selectionRoot) === this && this.childItems.length > 0) {
|
524
|
+
if (e.preventDefault(), o.hasSubmenu || o.open)
|
525
|
+
return;
|
526
|
+
this.selectOrToggleItem(o);
|
527
|
+
} else
|
528
|
+
return;
|
529
|
+
this.prepareToCleanUp();
|
530
|
+
}
|
531
|
+
prepareToCleanUp() {
|
532
|
+
document.addEventListener(
|
533
|
+
"focusout",
|
534
|
+
() => {
|
535
|
+
requestAnimationFrame(() => {
|
536
|
+
const e = this.childItems[this.focusedItemIndex];
|
537
|
+
e && (e.focused = !1, this.updateSelectedItemIndex());
|
538
|
+
});
|
539
|
+
},
|
540
|
+
{ once: !0 }
|
541
|
+
);
|
542
|
+
}
|
543
|
+
handleItemsChanged() {
|
544
|
+
this.cachedChildItems = void 0, this._willUpdateItems || (this._willUpdateItems = !0, this.cacheUpdated = this.updateCache());
|
545
|
+
}
|
546
|
+
async updateCache() {
|
547
|
+
await (this.hasUpdated ? new Promise((e) => requestAnimationFrame(() => e(!0))) : Promise.all([
|
548
|
+
new Promise((e) => requestAnimationFrame(() => e(!0))),
|
549
|
+
this.updateComplete
|
550
|
+
])), this.cachedChildItems === void 0 && (this.updateSelectedItemIndex(), this.updateItemFocus()), this._willUpdateItems = !1;
|
551
|
+
}
|
552
|
+
updateItemFocus() {
|
553
|
+
if (this.childItems.length === 0)
|
554
|
+
return;
|
555
|
+
const e = this.childItems[this.focusInItemIndex];
|
556
|
+
this.getRootNode().activeElement === e.menuData.focusRoot && this.forwardFocusVisibleToItem(e);
|
557
|
+
}
|
558
|
+
forwardFocusVisibleToItem(e) {
|
559
|
+
if (!e || e.menuData.focusRoot !== this)
|
560
|
+
return;
|
561
|
+
this.closeDescendentOverlays();
|
562
|
+
const t = this.hasVisibleFocusInTree() || !!this.childItems.some((o) => o.hasVisibleFocusInTree());
|
563
|
+
e.focused = t, this.setAttribute("aria-activedescendant", e.id), e.menuData.selectionRoot && e.menuData.selectionRoot !== this && e.menuData.selectionRoot.focus();
|
564
|
+
}
|
565
|
+
handleSlotchange({
|
566
|
+
target: e
|
567
|
+
}) {
|
568
|
+
const t = e.assignedElements({
|
569
|
+
flatten: !0
|
570
|
+
});
|
571
|
+
this.childItems.length !== t.length && t.forEach((o) => {
|
572
|
+
o.triggerUpdate !== void 0 ? o.triggerUpdate() : o.childItems !== void 0 && o.childItems.forEach((i) => {
|
573
|
+
i.triggerUpdate();
|
574
|
+
});
|
575
|
+
});
|
576
|
+
}
|
577
|
+
}
|
578
|
+
g([
|
579
|
+
l({ type: String, reflect: !0 })
|
580
|
+
], v.prototype, "label", 2);
|
581
|
+
g([
|
582
|
+
l({ type: Boolean, reflect: !0 })
|
583
|
+
], v.prototype, "ignore", 2);
|
584
|
+
g([
|
585
|
+
l({ type: String, reflect: !0 })
|
586
|
+
], v.prototype, "selects", 2);
|
587
|
+
g([
|
588
|
+
l({ type: String })
|
589
|
+
], v.prototype, "value", 2);
|
590
|
+
g([
|
591
|
+
l({ type: String, attribute: "value-separator" })
|
592
|
+
], v.prototype, "valueSeparator", 2);
|
593
|
+
g([
|
594
|
+
l({ attribute: !1 })
|
595
|
+
], v.prototype, "selected", 1);
|
596
|
+
g([
|
597
|
+
l({ attribute: !1 })
|
598
|
+
], v.prototype, "selectedItems", 2);
|
599
|
+
g([
|
600
|
+
b("slot:not([name])")
|
601
|
+
], v.prototype, "menuSlot", 2);
|
602
|
+
const de = ":host{--menu-divider-thickness: var( --divider-thickness-medium, var(--luzmo-border-width) );inline-size:auto;margin-block:var(--luzmo-menu-section-divider-margin-block, max(0px, (var(--menu-item-section-divider-height) - var(--menu-divider-thickness)) / 2));margin-inline:var(--luzmo-menu-item-label-inline-edge-to-content, var(--menu-item-label-inline-edge-to-content));overflow:visible}.luzmo-Menu-back:focus-visible{box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * 1) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)));box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * var(--menu-item-focus-indicator-direction-scalar, 1)) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)))}.luzmo-Menu-back{padding-inline:0 var(--luzmo-menu-back-padding-inline-end, var(--menu-item-label-inline-edge-to-content));padding-inline:var(--luzmo-menu-back-padding-inline-start, 0) var(--luzmo-menu-back-padding-inline-end, var(--menu-item-label-inline-edge-to-content));padding-block:0;padding-block:var(--luzmo-menu-back-padding-block-start, 0) var(--luzmo-menu-back-padding-block-end, 0);flex-flow:wrap;align-items:center;display:flex}.luzmo-Menu-backButton{cursor:pointer;background:none;border:0;margin:0;padding:0;display:inline-flex}.luzmo-Menu-backButton:focus-visible{outline:var(--focus-indicator-thickness) solid var(--focus-indicator-color);outline-offset:calc((var(--focus-indicator-thickness) + 1px) * -1)}.luzmo-Menu-backHeading{color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-back-heading-color, var(--menu-section-header-color)));font-size:var(--luzmo-menu-section-header-font-size, var(--menu-section-header-font-size));font-weight:var(--luzmo-menu-section-header-font-weight, var(--menu-section-header-font-weight));line-height:var(--luzmo-menu-section-header-line-height, var(--menu-section-header-line-height));display:block}:host{display:block;flex-shrink:0}";
|
603
|
+
class me extends M(T, {
|
604
|
+
validSizes: ["s", "m", "l"]
|
605
|
+
}) {
|
606
|
+
static get styles() {
|
607
|
+
return [z(B), z(de)];
|
608
|
+
}
|
609
|
+
firstUpdated(e) {
|
610
|
+
super.firstUpdated(e), this.setAttribute("role", "separator");
|
611
|
+
}
|
612
|
+
}
|
613
|
+
const he = ".luzmo-Menu-back:focus-visible{box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * 1) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)));box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * var(--menu-item-focus-indicator-direction-scalar, 1)) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)))}.header{color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-section-header-color, var(--menu-section-header-color)));font-size:var(--luzmo-menu-section-header-font-size, var(--menu-section-header-font-size));font-weight:var(--luzmo-menu-section-header-font-weight, var(--menu-section-header-font-weight));line-height:var(--luzmo-menu-section-header-line-height, var(--menu-section-header-line-height));min-inline-size:var(--luzmo-menu-section-header-min-width, var(--menu-section-header-min-width));padding-block-start:var(--luzmo-menu-section-header-top-edge-to-text, var(--luzmo-menu-item-top-edge-to-text, var(--menu-item-top-edge-to-text)));padding-block-end:var(--luzmo-menu-section-header-bottom-edge-to-text, var(--luzmo-menu-item-bottom-edge-to-text, var(--menu-item-bottom-edge-to-text)));padding-inline:var(--luzmo-menu-item-label-inline-edge-to-content, var(--menu-item-label-inline-edge-to-content));grid-area:sectionHeadingArea/1/sectionHeadingArea/-1;display:block}.luzmo-Menu-back{padding-inline:0 var(--luzmo-menu-back-padding-inline-end, var(--menu-item-label-inline-edge-to-content));padding-inline:var(--luzmo-menu-back-padding-inline-start, 0) var(--luzmo-menu-back-padding-inline-end, var(--menu-item-label-inline-edge-to-content));padding-block:0;padding-block:var(--luzmo-menu-back-padding-block-start, 0) var(--luzmo-menu-back-padding-block-end, 0);flex-flow:wrap;align-items:center;display:flex}.luzmo-Menu-back .header{padding:0}.luzmo-Menu-backButton{cursor:pointer;background:none;border:0;margin:0;padding:0;display:inline-flex}.luzmo-Menu-backButton:focus-visible{outline:var(--focus-indicator-thickness) solid var(--focus-indicator-color);outline-offset:calc((var(--focus-indicator-thickness) + 1px) * -1)}.luzmo-Menu-backHeading{color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-back-heading-color, var(--menu-section-header-color)));font-size:var(--luzmo-menu-section-header-font-size, var(--menu-section-header-font-size));font-weight:var(--luzmo-menu-section-header-font-weight, var(--menu-section-header-font-weight));line-height:var(--luzmo-menu-section-header-line-height, var(--menu-section-header-line-height));display:block}:host{margin:0;display:inline-flex;overflow:visible;flex-direction:column}[hidden]{display:none!important}";
|
614
|
+
var pe = Object.defineProperty, U = (n, e, t, o) => {
|
615
|
+
for (var i = void 0, r = n.length - 1, a; r >= 0; r--)
|
616
|
+
(a = n[r]) && (i = a(e, t, i) || i);
|
617
|
+
return i && pe(e, t, i), i;
|
618
|
+
};
|
619
|
+
class A extends v {
|
620
|
+
constructor() {
|
621
|
+
super(...arguments), this.headerId = "";
|
622
|
+
}
|
623
|
+
static get styles() {
|
624
|
+
return [...super.styles, z(he)];
|
625
|
+
}
|
626
|
+
render() {
|
627
|
+
return s`
|
628
|
+
<span class="header" ?hidden=${!this.headerElement}>
|
629
|
+
<slot name="header" @slotchange=${this.updateLabel}></slot>
|
630
|
+
</span>
|
631
|
+
<luzmo-menu ignore>${this.renderMenuItemSlot()}</luzmo-menu>
|
632
|
+
`;
|
633
|
+
}
|
634
|
+
get ownRole() {
|
635
|
+
switch (this.selects) {
|
636
|
+
case "multiple":
|
637
|
+
case "single":
|
638
|
+
case "inherit":
|
639
|
+
return "group";
|
640
|
+
default:
|
641
|
+
return "menu";
|
642
|
+
}
|
643
|
+
}
|
644
|
+
updateLabel() {
|
645
|
+
const e = this.headerElements.length > 0 ? this.headerElements[0] : void 0;
|
646
|
+
if (e !== this.headerElement)
|
647
|
+
if (this.headerElement && this.headerElement.id === this.headerId && this.headerElement.removeAttribute("id"), e) {
|
648
|
+
this.headerId = this.headerId || `luzmo-menu-group-label-${_()}`;
|
649
|
+
const t = e.id || this.headerId;
|
650
|
+
e.id || (e.id = t), this.setAttribute("aria-labelledby", t);
|
651
|
+
} else
|
652
|
+
this.removeAttribute("aria-labelledby");
|
653
|
+
this.headerElement = e;
|
654
|
+
}
|
655
|
+
}
|
656
|
+
U([
|
657
|
+
Z({
|
658
|
+
slot: "header",
|
659
|
+
flatten: !0
|
660
|
+
})
|
661
|
+
], A.prototype, "headerElements");
|
662
|
+
U([
|
663
|
+
S()
|
664
|
+
], A.prototype, "headerElement");
|
665
|
+
const ve = '.checkmark{display:var(--luzmo-menu-checkmark-display, var(--menu-checkmark-display));font-size:var(--luzmo-menu-item-checkmark-size, var(--menu-item-checkmark-size));fill:var(--highcontrast-menu-checkmark-icon-color-default, var(--luzmo-menu-checkmark-icon-color-default, var(--menu-checkmark-icon-color-default)));color:var(--highcontrast-menu-checkmark-icon-color-default, var(--luzmo-menu-checkmark-icon-color-default, var(--menu-checkmark-icon-color-default)));opacity:1;grid-area:checkmarkArea;align-self:start;margin-block-start:calc(var(--luzmo-menu-item-top-to-checkmark, var(--menu-item-top-to-checkmark)) - var(--luzmo-menu-item-top-edge-to-text, var(--menu-item-top-edge-to-text)));margin-inline-end:var(--luzmo-menu-item-text-to-control, var(--menu-item-text-to-control))}.angle{font-size:var(--menu-item-angle-size);grid-area:angleArea;align-self:center;margin-inline-end:var(--luzmo-menu-item-text-to-control, var(--menu-item-text-to-control))}.luzmo-Menu-back:focus-visible{box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * 1) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)));box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * var(--menu-item-focus-indicator-direction-scalar, 1)) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)))}.luzmo-Menu-backButton:focus-visible{outline:var(--focus-indicator-thickness) solid var(--focus-indicator-color);outline-offset:calc((var(--focus-indicator-thickness) + 1px) * -1)}::slotted([slot=icon]){fill:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-item-label-icon-color-default, var(--menu-item-label-icon-color-default)));color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-item-label-icon-color-default, var(--menu-item-label-icon-color-default)));grid-area:iconArea;align-self:start}::slotted([slot=icon]){margin-inline-end:var(--luzmo-menu-item-label-text-to-visual, var(--menu-item-label-text-to-visual))}:host{cursor:pointer;box-sizing:border-box;background-color:var(--highcontrast-menu-item-background-color-default, var(--luzmo-menu-item-background-color-default, var(--menu-item-background-color-default)));line-height:var(--luzmo-menu-item-label-line-height, var(--menu-item-label-line-height));min-block-size:var(--luzmo-menu-item-min-height, var(--menu-item-min-height));padding-block-start:var(--luzmo-menu-item-top-edge-to-text, var(--menu-item-top-edge-to-text));padding-block-end:var(--luzmo-menu-item-bottom-edge-to-text, var(--menu-item-bottom-edge-to-text));padding-inline:var(--luzmo-menu-item-label-inline-edge-to-content, var(--menu-item-label-inline-edge-to-content));grid-template:". angleAreaCollapsible . headingIconArea sectionHeadingArea . . ." "selectedArea angleAreaCollapsible checkmarkArea iconArea labelArea valueArea actionsArea angleAreaDrillIn" 1fr ". . . . descriptionArea . . ." ". . . . submenuArea . . ." ". . . . . . . ."/auto auto auto auto 1fr auto auto auto;justify-content:start;margin:0;-webkit-text-decoration:none;text-decoration:none;display:grid;align-items:center;position:relative}.luzmo-Menu-itemCheckbox{--luzmo-checkbox-top-to-text: 0;--luzmo-checkbox-text-to-control: 0;min-block-size:0}.luzmo-Menu-itemCheckbox .luzmo-Checkbox-box{margin-block-start:var(--luzmo-menu-item-top-to-checkbox, var(--menu-item-top-to-checkbox));margin-block-end:0;margin-inline-end:var(--luzmo-menu-item-text-to-control, var(--menu-item-text-to-control))}.luzmo-Menu-itemSwitch{min-block-size:0}.luzmo-Menu-itemSwitch .luzmo-Switch-switch{margin-block-start:var(--luzmo-menu-item-top-to-action, var(--menu-item-top-to-action));margin-block-end:0}#label{grid-area:submenuItemLabelArea}::slotted([slot=value]){grid-area:submenuItemValueArea}:host([focused]),:host(:focus){background-color:var(--highcontrast-menu-item-background-color-focus, var(--luzmo-menu-item-background-color-key-focus, var(--menu-item-background-color-key-focus)));outline:none}:host([focused])>#label,:host(:focus)>#label{color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-content-color-focus, var(--menu-item-label-content-color-focus)))}:host([focused])>[name=description]::slotted(*),:host(:focus)>[name=description]::slotted(*){color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-description-color-focus, var(--menu-item-description-color-focus)))}:host([focused])>::slotted([slot=value]),:host(:focus)>::slotted([slot=value]){color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-value-color-focus, var(--menu-item-value-color-focus)))}:host([focused])>.icon:not(.angle,.checkmark),:host(:focus)>.icon:not(.angle,.checkmark){fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-icon-color-focus, var(--menu-item-label-icon-color-focus)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-icon-color-focus, var(--menu-item-label-icon-color-focus)))}:host([focused])>.angle,:host(:focus)>.angle{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-collapsible-icon-color, var(--menu-collapsible-icon-color)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-collapsible-icon-color, var(--menu-collapsible-icon-color)))}:host([focused])>.checkmark,:host(:focus)>.checkmark{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-checkmark-icon-color-focus, var(--menu-checkmark-icon-color-focus)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-checkmark-icon-color-focus, var(--menu-checkmark-icon-color-focus)))}:host:dir(rtl),:host([dir=rtl]){--menu-item-focus-indicator-direction-scalar: -1}:host(:is(:active,[active])){background-color:var(--highcontrast-menu-item-background-color-focus, var(--luzmo-menu-item-background-color-down, var(--menu-item-background-color-down)))}:host(:is(:active,[active]))>#label{color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-content-color-down, var(--menu-item-label-content-color-down)))}:host(:is(:active,[active]))>[name=description]::slotted(*){color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-description-color-down, var(--menu-item-description-color-down)))}:host(:is(:active,[active]))>::slotted([slot=value]){color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-value-color-down, var(--menu-item-value-color-down)))}:host(:is(:active,[active]))>.icon:not(.angle,.checkmark){fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-icon-color-down, var(--menu-item-label-icon-color-down)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-icon-color-down, var(--menu-item-label-icon-color-down)))}:host(:is(:active,[active]))>.angle{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-collapsible-icon-color, var(--menu-collapsible-icon-color)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-collapsible-icon-color, var(--menu-collapsible-icon-color)))}:host(:is(:active,[active]))>.checkmark{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-checkmark-icon-color-down, var(--menu-checkmark-icon-color-down)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-checkmark-icon-color-down, var(--menu-checkmark-icon-color-down)))}:host([disabled]),:host([aria-disabled=true]){background-color:initial}:host([disabled]) #label,:host([disabled]) ::slotted([slot=value]),:host([aria-disabled=true]) #label,:host([aria-disabled=true]) ::slotted([slot=value]){color:var(--highcontrast-menu-item-color-disabled, var(--luzmo-menu-item-label-content-color-disabled, var(--menu-item-label-content-color-disabled)))}:host([disabled]) [name=description]::slotted(*),:host([aria-disabled=true]) [name=description]::slotted(*){color:var(--highcontrast-menu-item-color-disabled, var(--luzmo-menu-item-description-color-disabled, var(--menu-item-description-color-disabled)))}:host([disabled]) ::slotted([slot=icon]),:host([aria-disabled=true]) ::slotted([slot=icon]){color:var(--highcontrast-menu-item-color-disabled, var(--luzmo-menu-item-label-icon-color-disabled, var(--menu-item-label-icon-color-disabled)));fill:var(--highcontrast-menu-item-color-disabled, var(--luzmo-menu-item-label-icon-color-disabled, var(--menu-item-label-icon-color-disabled)))}:host([focused]) .luzmo-Menu-back,:host([focused]){box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * 1) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)));box-shadow:inset calc(var(--luzmo-menu-item-focus-indicator-width, var(--menu-item-focus-indicator-width)) * var(--menu-item-focus-indicator-direction-scalar, 1)) 0 0 0 var(--highcontrast-menu-item-focus-indicator-color, var(--luzmo-menu-item-focus-indicator-color, var(--menu-item-focus-indicator-color)))}:host .is-selectableMultiple{align-items:start}.is-selectableMultiple .luzmo-Menu-itemCheckbox{grid-area:checkmarkArea}.luzmo-Menu-itemSelection{grid-area:selectedArea}#label{--luzmo-switch-control-label-spacing: 0;--luzmo-switch-spacing-top-to-label: 0;font-size:var(--luzmo-menu-item-label-font-size, var(--menu-item-label-font-size));color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-item-label-content-color-default, var(--menu-item-label-content-color-default)));-webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word;grid-area:labelArea}:host([selected]) #label{color:var(--menu-item-highlight-label-content-color)}::slotted([slot=value]){color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-item-value-color-default, var(--menu-item-value-color-default)));font-size:var(--luzmo-menu-item-label-font-size, var(--menu-item-label-font-size));grid-area:valueArea;justify-self:end}.luzmo-Menu-itemActions,::slotted([slot=value]){align-self:start;margin-inline-start:var(--luzmo-menu-item-label-to-value-area-min-spacing, var(--menu-item-label-to-value-area-min-spacing))}.luzmo-Menu-itemActions{grid-area:actionsArea}[name=description]::slotted(*){color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-item-description-color-default, var(--menu-item-description-color-default)));font-size:var(--luzmo-menu-item-description-font-size, var(--menu-item-description-font-size));-webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word;line-height:var(--luzmo-menu-item-description-line-height, var(--menu-item-description-line-height));grid-area:descriptionArea;margin-block-start:var(--luzmo-menu-item-label-to-description-spacing, var(--menu-item-label-to-description-spacing))}:host([no-wrap]) #label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.luzmo-Menu-item--collapsible.is-open{padding-block-end:0}.luzmo-Menu-item--collapsible.is-open .angle{transform:rotate(90deg)}:host([focused]) .luzmo-Menu-item--collapsible.is-open,:host(:is(:active,[active])) .luzmo-Menu-item--collapsible.is-open,.luzmo-Menu-item--collapsible.is-open:focus{background-color:var(--highcontrast-menu-item-background-color-default, var(--luzmo-menu-item-background-color-default, var(--menu-item-background-color-default)))}.luzmo-Menu-item--collapsible ::slotted([slot=icon]){grid-area:headingIconArea}.luzmo-Menu-item--collapsible>::slotted([slot=icon]){padding-block-start:var(--luzmo-menu-section-header-top-edge-to-text, var(--luzmo-menu-item-top-edge-to-text, var(--menu-item-top-edge-to-text)));padding-block-end:var(--luzmo-menu-section-header-bottom-edge-to-text, var(--luzmo-menu-item-bottom-edge-to-text, var(--menu-item-bottom-edge-to-text)))}.luzmo-Menu-item--collapsible .angle{grid-area:angleAreaCollapsible}:host([has-submenu]) .angle{fill:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-drillin-icon-color-default, var(--menu-drillin-icon-color-default)));color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-drillin-icon-color-default, var(--menu-drillin-icon-color-default)));grid-area:angleAreaDrillIn;margin-inline-start:var(--luzmo-menu-item-label-to-value-area-min-spacing, var(--menu-item-label-to-value-area-min-spacing));margin-inline-end:0}:host([has-submenu]) .is-open{--menu-item-background-color-default: var( --highcontrast-menu-item-selected-background-color, var( --luzmo-menu-item-background-color-hover, var(--menu-item-background-color-hover) ) )}:host([has-submenu]) .is-open .icon:not(.angle,.checkmark){fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-icon-color-hover, var(--menu-item-label-icon-color-hover)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-icon-color-hover, var(--menu-item-label-icon-color-hover)))}:host([has-submenu]) .is-open .angle{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-drillin-icon-color-hover, var(--menu-drillin-icon-color-hover)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-drillin-icon-color-hover, var(--menu-drillin-icon-color-hover)))}:host([has-submenu]) .is-open .checkmark{fill:var(--highcontrast-menu-checkmark-icon-color-default, var(--luzmo-menu-checkmark-icon-color-hover, var(--menu-checkmark-icon-color-hover)));color:var(--highcontrast-menu-checkmark-icon-color-default, var(--luzmo-menu-checkmark-icon-color-hover, var(--menu-checkmark-icon-color-hover)))}@media (hover: hover){:host(:hover){background-color:var(--highcontrast-menu-item-background-color-focus, var(--luzmo-menu-item-background-color-hover, var(--menu-item-background-color-hover)))}:host(:hover)>#label{color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-content-color-hover, var(--menu-item-label-content-color-hover)))}:host([selected]:hover)>#label{color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-highlight-label-content-color, var(--menu-item-highlight-label-content-color)))}:host(:hover)>[name=description]::slotted(*){color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-description-color-hover, var(--menu-item-description-color-hover)))}:host(:hover)>::slotted([slot=value]){color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-value-color-hover, var(--menu-item-value-color-hover)))}:host(:hover)>.icon:not(.angle,.checkmark){fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-icon-color-hover, var(--menu-item-label-icon-color-hover)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-item-label-icon-color-hover, var(--menu-item-label-icon-color-hover)))}:host(:hover)>.angle{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-collapsible-icon-color, var(--menu-collapsible-icon-color)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-collapsible-icon-color, var(--menu-collapsible-icon-color)))}:host(:hover)>.checkmark{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-checkmark-icon-color-hover, var(--menu-checkmark-icon-color-hover)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-checkmark-icon-color-hover, var(--menu-checkmark-icon-color-hover)))}:host([disabled]:hover),:host([aria-disabled=true]:hover){cursor:default;background-color:initial}:host([disabled]:hover) #label,:host([disabled]:hover) ::slotted([slot=value]),:host([aria-disabled=true]:hover) #label,:host([aria-disabled=true]:hover) ::slotted([slot=value]){color:var(--highcontrast-menu-item-color-disabled, var(--luzmo-menu-item-label-content-color-disabled, var(--menu-item-label-content-color-disabled)))}:host([disabled]:hover) [name=description]::slotted(*),:host([aria-disabled=true]:hover) [name=description]::slotted(*){color:var(--highcontrast-menu-item-color-disabled, var(--luzmo-menu-item-description-color-disabled, var(--menu-item-description-color-disabled)))}:host([disabled]:hover) ::slotted([slot=icon]),:host([aria-disabled=true]:hover) ::slotted([slot=icon]){color:var(--highcontrast-menu-item-color-disabled, var(--luzmo-menu-item-label-icon-color-disabled, var(--menu-item-label-icon-color-disabled)));fill:var(--highcontrast-menu-item-color-disabled, var(--luzmo-menu-item-label-icon-color-disabled, var(--menu-item-label-icon-color-disabled)))}.luzmo-Menu-item--collapsible.is-open:hover{background-color:var(--highcontrast-menu-item-background-color-default, var(--luzmo-menu-item-background-color-default, var(--menu-item-background-color-default)))}:host([has-submenu]:hover) .angle{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-drillin-icon-color-hover, var(--menu-drillin-icon-color-hover)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-drillin-icon-color-hover, var(--menu-drillin-icon-color-hover)))}}:host([has-submenu][focused]) .angle,:host([has-submenu]:focus) .angle{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-drillin-icon-color-focus, var(--menu-drillin-icon-color-focus)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-drillin-icon-color-focus, var(--menu-drillin-icon-color-focus)))}:host([has-submenu]:is(:active,[active])) .angle{fill:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-drillin-icon-color-down, var(--menu-drillin-icon-color-down)));color:var(--highcontrast-menu-item-color-focus, var(--luzmo-menu-drillin-icon-color-down, var(--menu-drillin-icon-color-down)))}.luzmo-Menu-back{padding-inline:0 var(--luzmo-menu-back-padding-inline-end, var(--menu-item-label-inline-edge-to-content));padding-inline:var(--luzmo-menu-back-padding-inline-start, 0) var(--luzmo-menu-back-padding-inline-end, var(--menu-item-label-inline-edge-to-content));padding-block:0;padding-block:var(--luzmo-menu-back-padding-block-start, 0) var(--luzmo-menu-back-padding-block-end, 0);flex-flow:wrap;align-items:center;display:flex}.luzmo-Menu-backButton{cursor:pointer;background:none;border:0;margin:0;padding:0;display:inline-flex}:host([focused]) .luzmo-Menu-backButton{outline:var(--focus-indicator-thickness) solid var(--focus-indicator-color);outline-offset:calc((var(--focus-indicator-thickness) + 1px) * -1)}.luzmo-Menu-backHeading{color:var(--highcontrast-menu-item-color-default, var(--luzmo-menu-back-heading-color, var(--menu-section-header-color)));font-size:var(--luzmo-menu-section-header-font-size, var(--menu-section-header-font-size));font-weight:var(--luzmo-menu-section-header-font-weight, var(--menu-section-header-font-weight));line-height:var(--luzmo-menu-section-header-line-height, var(--menu-section-header-line-height));display:block}:host{text-align:initial;font-family:var(--luzmo-menu-item-font-family, var(--luzmo-font-family))}:host([hidden]){display:none}:host([disabled]){pointer-events:none}:host([disabled]) [name=value]::slotted(*){color:var(--luzmo-menu-item-label-icon-color-disabled, var(--luzmo-disabled-color))}:host([has-submenu][disabled]) .angle{color:var(--luzmo-menu-item-label-icon-color-disabled, var(--luzmo-disabled-color))}#button{position:absolute;top:0;right:0;bottom:0;left:0}.icon-container>svg{vertical-align:top}:host([dir=ltr]) [icon-only]::slotted(:last-of-type){margin-right:auto}:host([dir=rtl]) [icon-only]::slotted(:last-of-type){margin-left:auto}@media (forced-colors: active){:host{forced-color-adjust:none}}::slotted([slot=submenu]){width:max-content;max-width:100%}:host([no-wrap]) #label{display:block}';
|
666
|
+
var be = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, h = (n, e, t, o) => {
|
667
|
+
for (var i = o > 1 ? void 0 : o ? ge(e, t) : e, r = n.length - 1, a; r >= 0; r--)
|
668
|
+
(a = n[r]) && (i = (o ? a(e, t, i) : a(i)) || i);
|
669
|
+
return o && i && be(e, t, i), i;
|
670
|
+
};
|
671
|
+
const fe = 100, ke = (n) => s`
|
672
|
+
<span class="icon-container icon checkmark ${n.join(" ")}">
|
673
|
+
${I(N)}
|
674
|
+
</span>
|
675
|
+
`, ze = (n) => s`
|
676
|
+
<span class="icon-container icon angle ${n.join(" ")}">
|
677
|
+
${I(j, { className: "indicator" })}
|
678
|
+
</span>
|
679
|
+
`;
|
680
|
+
class ye extends Event {
|
681
|
+
constructor(e) {
|
682
|
+
super("luzmo-menu-item-added-or-updated", {
|
683
|
+
bubbles: !0,
|
684
|
+
composed: !0
|
685
|
+
}), this.menuCascade = /* @__PURE__ */ new WeakMap(), this.clear(e);
|
686
|
+
}
|
687
|
+
get item() {
|
688
|
+
return this._item;
|
689
|
+
}
|
690
|
+
clear(e) {
|
691
|
+
this._item = e, this.currentAncestorWithSelects = void 0, e.menuData = {
|
692
|
+
cleanupSteps: [],
|
693
|
+
focusRoot: void 0,
|
694
|
+
selectionRoot: void 0,
|
695
|
+
parentMenu: void 0
|
696
|
+
}, this.menuCascade = /* @__PURE__ */ new WeakMap();
|
697
|
+
}
|
698
|
+
}
|
699
|
+
class d extends ee(
|
700
|
+
te(oe(D, '[slot="icon"]'))
|
701
|
+
) {
|
702
|
+
constructor() {
|
703
|
+
super(), this.active = !1, this.dependencyManager = new R(this), this.focused = !1, this.selected = !1, this._value = "", this.hasSubmenu = !1, this.noWrap = !1, this.renderAngleIcon = (e = []) => ze(e), this.renderCheckIcon = (e = []) => ke(e), this.open = !1, this.handleSlottableRequest = (e) => {
|
704
|
+
var t;
|
705
|
+
(t = this.submenuElement) == null || t.dispatchEvent(
|
706
|
+
new X(e.name, e.data)
|
707
|
+
);
|
708
|
+
}, this.proxyFocus = () => {
|
709
|
+
this.focus();
|
710
|
+
}, this.handleBeforetoggle = (e) => {
|
711
|
+
e.newState === "closed" && (this.open = !0, this.overlayElement.manuallyKeepOpen(), this.overlayElement.removeEventListener(
|
712
|
+
"beforetoggle",
|
713
|
+
this.handleBeforetoggle
|
714
|
+
));
|
715
|
+
}, this.recentlyLeftChild = !1, this.willDispatchUpdate = !1, this.menuData = {
|
716
|
+
focusRoot: void 0,
|
717
|
+
parentMenu: void 0,
|
718
|
+
selectionRoot: void 0,
|
719
|
+
cleanupSteps: []
|
720
|
+
}, this.addEventListener("click", this.handleClickCapture, {
|
721
|
+
capture: !0
|
722
|
+
}), new F(this, {
|
723
|
+
config: {
|
724
|
+
characterData: !0,
|
725
|
+
childList: !0,
|
726
|
+
subtree: !0
|
727
|
+
},
|
728
|
+
callback: (e) => {
|
729
|
+
e.every(
|
730
|
+
(o) => o.target.slot === "submenu"
|
731
|
+
) || this.breakItemChildrenCache();
|
732
|
+
}
|
733
|
+
});
|
734
|
+
}
|
735
|
+
static get styles() {
|
736
|
+
return [z(ve)];
|
737
|
+
}
|
738
|
+
get value() {
|
739
|
+
return this._value || this.itemText;
|
740
|
+
}
|
741
|
+
set value(e) {
|
742
|
+
e !== this._value && (this._value = e || "", this._value ? this.setAttribute("value", this._value) : this.removeAttribute("value"));
|
743
|
+
}
|
744
|
+
/**
|
745
|
+
* @private
|
746
|
+
*/
|
747
|
+
get itemText() {
|
748
|
+
return this.itemChildren.content.reduce(
|
749
|
+
(e, t) => e + (t.textContent || "").trim(),
|
750
|
+
""
|
751
|
+
);
|
752
|
+
}
|
753
|
+
get focusElement() {
|
754
|
+
return this;
|
755
|
+
}
|
756
|
+
get hasIcon() {
|
757
|
+
return this.slotContentIsPresent;
|
758
|
+
}
|
759
|
+
get itemChildren() {
|
760
|
+
if (!this.iconSlot || !this.contentSlot)
|
761
|
+
return {
|
762
|
+
icon: [],
|
763
|
+
content: []
|
764
|
+
};
|
765
|
+
if (this._itemChildren)
|
766
|
+
return this._itemChildren;
|
767
|
+
const e = this.iconSlot.assignedElements().map((o) => {
|
768
|
+
const i = o.cloneNode(!0);
|
769
|
+
return i.removeAttribute("slot"), i.classList.toggle("icon"), i;
|
770
|
+
}), t = this.contentSlot.assignedNodes().map((o) => o.cloneNode(!0));
|
771
|
+
return this._itemChildren = { icon: e, content: t }, this._itemChildren;
|
772
|
+
}
|
773
|
+
click() {
|
774
|
+
this.disabled || this.shouldProxyClick() || super.click();
|
775
|
+
}
|
776
|
+
handleClickCapture(e) {
|
777
|
+
if (this.disabled)
|
778
|
+
return e.preventDefault(), e.stopImmediatePropagation(), e.stopPropagation(), !1;
|
779
|
+
}
|
780
|
+
shouldProxyClick() {
|
781
|
+
let e = !1;
|
782
|
+
return this.anchorElement && (this.anchorElement.click(), e = !0), e;
|
783
|
+
}
|
784
|
+
breakItemChildrenCache() {
|
785
|
+
this._itemChildren = void 0, this.triggerUpdate();
|
786
|
+
}
|
787
|
+
renderSubmenu() {
|
788
|
+
const e = s`
|
789
|
+
<slot
|
790
|
+
name="submenu"
|
791
|
+
@slotchange=${this.manageSubmenu}
|
792
|
+
@luzmo-menu-item-added-or-updated=${{
|
793
|
+
handleEvent: (t) => {
|
794
|
+
t.clear(t.item);
|
795
|
+
},
|
796
|
+
capture: !0
|
797
|
+
}}
|
798
|
+
@focusin=${(t) => t.stopPropagation()}
|
799
|
+
></slot>
|
800
|
+
`;
|
801
|
+
return this.hasSubmenu ? (this.dependencyManager.add("luzmo-overlay"), this.dependencyManager.add("luzmo-popover"), import("./index-B9h2L_hV.js").then((t) => t.e), import("./popover-Bwnkg-5-.js"), s`
|
802
|
+
<luzmo-overlay
|
803
|
+
.triggerElement=${this}
|
804
|
+
?disabled=${!this.hasSubmenu}
|
805
|
+
?open=${this.hasSubmenu && this.open && this.dependencyManager.loaded}
|
806
|
+
.placement=${this.isLTR ? "right-start" : "left-start"}
|
807
|
+
.offset=${[-10, -5]}
|
808
|
+
.type=${"auto"}
|
809
|
+
@close=${(t) => t.stopPropagation()}
|
810
|
+
@slottable-request=${this.handleSlottableRequest}
|
811
|
+
>
|
812
|
+
<luzmo-popover
|
813
|
+
@change=${(t) => {
|
814
|
+
this.handleSubmenuChange(t), this.open = !1;
|
815
|
+
}}
|
816
|
+
@pointerenter=${this.handleSubmenuPointerenter}
|
817
|
+
@pointerleave=${this.handleSubmenuPointerleave}
|
818
|
+
@luzmo-menu-item-added-or-updated=${(t) => t.stopPropagation()}
|
819
|
+
>
|
820
|
+
${e}
|
821
|
+
</luzmo-popover>
|
822
|
+
</luzmo-overlay>
|
823
|
+
${this.renderAngleIcon()}
|
824
|
+
`) : e;
|
825
|
+
}
|
826
|
+
render() {
|
827
|
+
return s`
|
828
|
+
${this.selected ? s`
|
829
|
+
${this.renderCheckIcon(
|
830
|
+
this.hasIcon ? ["checkmark--withAdjacentIcon"] : []
|
831
|
+
)}
|
832
|
+
` : E}
|
833
|
+
<slot name="icon"></slot>
|
834
|
+
<div id="label">
|
835
|
+
<slot id="slot"></slot>
|
836
|
+
</div>
|
837
|
+
<slot name="description"></slot>
|
838
|
+
<slot name="value"></slot>
|
839
|
+
${this.href && this.href.length > 0 ? super.renderAnchor({
|
840
|
+
id: "button",
|
841
|
+
ariaHidden: !0,
|
842
|
+
className: "button anchor hidden"
|
843
|
+
}) : E}
|
844
|
+
${this.renderSubmenu()}
|
845
|
+
`;
|
846
|
+
}
|
847
|
+
manageSubmenu(e) {
|
848
|
+
this.submenuElement = e.target.assignedElements({
|
849
|
+
flatten: !0
|
850
|
+
})[0], this.hasSubmenu = !!this.submenuElement, this.hasSubmenu && this.setAttribute("aria-haspopup", "true");
|
851
|
+
}
|
852
|
+
handlePointerdown(e) {
|
853
|
+
e.target === this && this.hasSubmenu && this.open && (this.addEventListener("focus", this.handleSubmenuFocus, {
|
854
|
+
once: !0
|
855
|
+
}), this.overlayElement.addEventListener(
|
856
|
+
"beforetoggle",
|
857
|
+
this.handleBeforetoggle
|
858
|
+
));
|
859
|
+
}
|
860
|
+
firstUpdated(e) {
|
861
|
+
super.firstUpdated(e), this.setAttribute("tabindex", "-1"), this.addEventListener("pointerdown", this.handlePointerdown), this.addEventListener("pointerenter", this.closeOverlaysForRoot), this.hasAttribute("id") || (this.id = `luzmo-menu-item-${_()}`);
|
862
|
+
}
|
863
|
+
closeOverlaysForRoot() {
|
864
|
+
var e;
|
865
|
+
this.open || (e = this.menuData.parentMenu) == null || e.closeDescendentOverlays();
|
866
|
+
}
|
867
|
+
handleSubmenuClick(e) {
|
868
|
+
e.composedPath().includes(this.overlayElement) || this.openOverlay();
|
869
|
+
}
|
870
|
+
handleSubmenuFocus() {
|
871
|
+
requestAnimationFrame(() => {
|
872
|
+
this.overlayElement.open = this.open;
|
873
|
+
});
|
874
|
+
}
|
875
|
+
handlePointerenter() {
|
876
|
+
if (this.leaveTimeout) {
|
877
|
+
clearTimeout(this.leaveTimeout), delete this.leaveTimeout;
|
878
|
+
return;
|
879
|
+
}
|
880
|
+
this.openOverlay();
|
881
|
+
}
|
882
|
+
handlePointerleave() {
|
883
|
+
this.open && !this.recentlyLeftChild && (this.leaveTimeout = setTimeout(() => {
|
884
|
+
delete this.leaveTimeout, this.open = !1;
|
885
|
+
}, fe));
|
886
|
+
}
|
887
|
+
/**
|
888
|
+
* When there is a `change` event in the submenu for this item
|
889
|
+
* then we "click" this item to cascade the selection up the
|
890
|
+
* menu tree allowing all submenus between the initial selection
|
891
|
+
* and the root of the tree to have their selection changes and
|
892
|
+
* be closed.
|
893
|
+
*/
|
894
|
+
handleSubmenuChange(e) {
|
895
|
+
var t;
|
896
|
+
e.stopPropagation(), (t = this.menuData.selectionRoot) == null || t.selectOrToggleItem(this);
|
897
|
+
}
|
898
|
+
handleSubmenuPointerenter() {
|
899
|
+
this.recentlyLeftChild = !0;
|
900
|
+
}
|
901
|
+
handleSubmenuPointerleave() {
|
902
|
+
requestAnimationFrame(() => {
|
903
|
+
this.recentlyLeftChild = !1;
|
904
|
+
});
|
905
|
+
}
|
906
|
+
handleSubmenuOpen(e) {
|
907
|
+
this.focused = !1;
|
908
|
+
const t = e.composedPath().find(
|
909
|
+
(o) => o !== this.overlayElement && o.localName === "luzmo-overlay"
|
910
|
+
);
|
911
|
+
this.overlayElement.parentOverlayToForceClose = t;
|
912
|
+
}
|
913
|
+
cleanup() {
|
914
|
+
this.open = !1, this.active = !1;
|
915
|
+
}
|
916
|
+
openOverlay() {
|
917
|
+
!this.hasSubmenu || this.open || this.disabled || (this.open = !0, this.active = !0, this.setAttribute("aria-expanded", "true"), this.addEventListener("luzmo-closed", this.cleanup, {
|
918
|
+
once: !0
|
919
|
+
}));
|
920
|
+
}
|
921
|
+
updateAriaSelected() {
|
922
|
+
const e = this.getAttribute("role");
|
923
|
+
e === "option" ? this.setAttribute("aria-selected", this.selected ? "true" : "false") : (e === "menuitemcheckbox" || e === "menuitemradio") && this.setAttribute("aria-checked", this.selected ? "true" : "false");
|
924
|
+
}
|
925
|
+
setRole(e) {
|
926
|
+
this.setAttribute("role", e), this.updateAriaSelected();
|
927
|
+
}
|
928
|
+
updated(e) {
|
929
|
+
var t, o;
|
930
|
+
if (super.updated(e), e.has("label") && (this.label || e.get("label") !== void 0) && this.setAttribute("aria-label", this.label || ""), e.has("active") && (this.active || e.get("active") !== void 0) && this.active && ((t = this.menuData.selectionRoot) == null || t.closeDescendentOverlays()), this.anchorElement && (this.anchorElement.addEventListener("focus", this.proxyFocus), this.anchorElement.tabIndex = -1), e.has("selected") && this.updateAriaSelected(), e.has("hasSubmenu") && (this.hasSubmenu || e.get("hasSubmenu") !== void 0))
|
931
|
+
if (this.hasSubmenu) {
|
932
|
+
this.abortControllerSubmenu = new AbortController();
|
933
|
+
const i = { signal: this.abortControllerSubmenu.signal };
|
934
|
+
this.addEventListener("click", this.handleSubmenuClick, i), this.addEventListener("pointerenter", this.handlePointerenter, i), this.addEventListener("pointerleave", this.handlePointerleave, i), this.addEventListener("luzmo-opened", this.handleSubmenuOpen, i);
|
935
|
+
} else
|
936
|
+
(o = this.abortControllerSubmenu) == null || o.abort();
|
937
|
+
}
|
938
|
+
connectedCallback() {
|
939
|
+
super.connectedCallback(), this.triggerUpdate();
|
940
|
+
}
|
941
|
+
disconnectedCallback() {
|
942
|
+
this.menuData.cleanupSteps.forEach((e) => e(this)), this.menuData = {
|
943
|
+
focusRoot: void 0,
|
944
|
+
parentMenu: void 0,
|
945
|
+
selectionRoot: void 0,
|
946
|
+
cleanupSteps: []
|
947
|
+
}, super.disconnectedCallback();
|
948
|
+
}
|
949
|
+
async triggerUpdate() {
|
950
|
+
this.willDispatchUpdate || (this.willDispatchUpdate = !0, await new Promise((e) => requestAnimationFrame(e)), this.dispatchUpdate());
|
951
|
+
}
|
952
|
+
dispatchUpdate() {
|
953
|
+
this.isConnected && (this.dispatchEvent(new ye(this)), this.willDispatchUpdate = !1);
|
954
|
+
}
|
955
|
+
}
|
956
|
+
h([
|
957
|
+
l({ type: Boolean, reflect: !0 })
|
958
|
+
], d.prototype, "active", 2);
|
959
|
+
h([
|
960
|
+
l({ type: Boolean, reflect: !0 })
|
961
|
+
], d.prototype, "focused", 2);
|
962
|
+
h([
|
963
|
+
l({ type: Boolean, reflect: !0 })
|
964
|
+
], d.prototype, "selected", 2);
|
965
|
+
h([
|
966
|
+
l({ type: String })
|
967
|
+
], d.prototype, "value", 1);
|
968
|
+
h([
|
969
|
+
l({ type: Boolean, reflect: !0, attribute: "has-submenu" })
|
970
|
+
], d.prototype, "hasSubmenu", 2);
|
971
|
+
h([
|
972
|
+
b("slot:not([name])")
|
973
|
+
], d.prototype, "contentSlot", 2);
|
974
|
+
h([
|
975
|
+
b('slot[name="icon"]')
|
976
|
+
], d.prototype, "iconSlot", 2);
|
977
|
+
h([
|
978
|
+
l({
|
979
|
+
type: Boolean,
|
980
|
+
reflect: !0,
|
981
|
+
attribute: "no-wrap",
|
982
|
+
hasChanged() {
|
983
|
+
return !1;
|
984
|
+
}
|
985
|
+
})
|
986
|
+
], d.prototype, "noWrap", 2);
|
987
|
+
h([
|
988
|
+
b(".anchor")
|
989
|
+
], d.prototype, "anchorElement", 2);
|
990
|
+
h([
|
991
|
+
b("luzmo-overlay")
|
992
|
+
], d.prototype, "overlayElement", 2);
|
993
|
+
h([
|
994
|
+
l({ type: Boolean, reflect: !0 })
|
995
|
+
], d.prototype, "open", 2);
|
996
|
+
customElements.get("luzmo-menu") || customElements.define("luzmo-menu", v);
|
997
|
+
customElements.get("luzmo-menu-divider") || customElements.define("luzmo-menu-divider", me);
|
998
|
+
customElements.get("luzmo-menu-group") || customElements.define("luzmo-menu-group", A);
|
999
|
+
customElements.get("luzmo-menu-item") || customElements.define("luzmo-menu-item", d);
|
1000
|
+
const we = '#button{cursor:pointer;-webkit-user-select:none;user-select:none;font-family:var(--luzmo-button-font-family, var(--luzmo-font-family));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:var(--luzmo-button-line-height, var(--luzmo-line-height, 1.3));text-transform:none;vertical-align:top;-webkit-appearance:button;transition:background var(--luzmo-button-animation-duration, var(--luzmo-animation-duration)) ease-out,border-color var(--luzmo-button-animation-duration, var(--luzmo-animation-duration)) ease-out,color var(--luzmo-button-animation-duration, var(--luzmo-animation-duration)) ease-out,box-shadow var(--luzmo-button-animation-duration, var(--luzmo-animation-duration)) ease-out;justify-content:center;align-items:center;margin:0;-webkit-text-decoration:none;text-decoration:none;display:inline-flex;position:relative;overflow:visible}#button::-moz-focus-inner{border-style:none;padding:0}#button:focus{outline:none}@media (forced-colors: active){:host{--highcontrast-picker-focus-indicator-color: Highlight;--highcontrast-picker-border-color-default: ButtonBorder;--highcontrast-picker-border-color-hover: Highlight;--highcontrast-picker-border-color-disabled: GrayText;--highcontrast-picker-content-color-default: ButtonText;--highcontrast-picker-content-color-disabled: GrayText;--highcontrast-picker-background-color: ButtonFace}#button.is-keyboardFocused,#button:focus-visible{--highcontrast-picker-border-color-hover: ButtonText}#button .label,#button:after{forced-color-adjust:none}}#button{box-sizing:border-box;max-inline-size:100%;min-inline-size:calc(var(--picker-minimum-width-multiplier) * var(--luzmo-picker-block-size, var(--picker-block-size)));block-size:var(--luzmo-picker-block-size, var(--picker-block-size));border-width:var(--luzmo-picker-border-width, var(--picker-border-width));border-radius:var(--luzmo-picker-border-radius, var(--picker-border-radius));box-shadow:var(--luzmo-picker-box-shadow, var(--picker-box-shadow));transition:background-color var(--luzmo-picker-animation-duration, var(--picker-animation-duration)),box-shadow var(--luzmo-picker-animation-duration, var(--picker-animation-duration)),border-color var(--luzmo-picker-animation-duration, var(--picker-animation-duration)) ease-in-out;color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)));background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-default, var(--picker-background-color-default)));border-style:solid;border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-default, var(--picker-border-color-default)));margin-block-start:var(--luzmo-picker-spacing-label-to-picker, var(--picker-spacing-label-to-picker));padding-block:0;padding-inline-start:var(--luzmo-picker-spacing-edge-to-text, var(--picker-spacing-edge-to-text));padding-inline-end:var(--luzmo-picker-spacing-edge-to-disclosure-icon, var(--picker-spacing-edge-to-disclosure-icon));display:flex}#button:after{pointer-events:none;content:"";block-size:calc(100% + var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) * 2 + var(--luzmo-picker-border-width, var(--picker-border-width)) * 2);inline-size:calc(100% + var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) * 2 + var(--luzmo-picker-border-width, var(--picker-border-width)) * 2);border-style:solid;border-width:var(--luzmo-picker-focus-indicator-thickness, var(--picker-focus-indicator-thickness));border-radius:calc(var(--luzmo-picker-border-radius, var(--picker-border-radius)) + var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) + var(--luzmo-picker-border-width, var(--picker-border-width)));border-color:#0000;margin-block-start:calc((var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) + var(--luzmo-picker-focus-indicator-thickness, var(--picker-focus-indicator-thickness)) + var(--luzmo-picker-border-width, var(--picker-border-width))) * -1);margin-inline-start:calc((var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) + var(--luzmo-picker-focus-indicator-thickness, var(--picker-focus-indicator-thickness)) + var(--luzmo-picker-border-width, var(--picker-border-width))) * -1);position:absolute;inset-block:0;inset-inline:0}#button:active{background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-active, var(--picker-background-color-active)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-active, var(--picker-border-color-active)))}#button:active:after{border-color:#0000}#button.placeholder:active .label{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-active, var(--picker-font-color-active)))}#button.is-keyboardFocused,#button:focus-visible{background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-key-focus, var(--picker-background-color-key-focus)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-key-focus, var(--picker-border-color-key-focus)));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-key-focus, var(--picker-font-color-key-focus)));outline:none}#button.is-keyboardFocused:after,#button:focus-visible:after{border-color:var(--highcontrast-picker-focus-indicator-color, var(--luzmo-picker-focus-indicator-color, var(--picker-focus-indicator-color)))}#button.is-keyboardFocused.placeholder,#button.placeholder:focus-visible{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-key-focus, var(--picker-font-color-key-focus)))}#button.is-keyboardFocused .disclosure-icon,#button:focus-visible .disclosure-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-key-focus, var(--picker-icon-color-key-focus)))}:host([open]) #button:not(:disabled,.is-disabled){color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default-open, var(--picker-font-color-default-open)));background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-default-open, var(--picker-background-color-default-open)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-default-open, var(--picker-border-color-default-open)))}:host([open]) #button:not(:disabled,.is-disabled) .disclosure-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-default-open, var(--picker-icon-color-default-open)))}:host([invalid]) #button:not(:disabled,.is-disabled){border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-error-default, var(--picker-border-color-error-default)))}:host([invalid]) #button:not(:disabled,.is-disabled) .validation-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-error, var(--picker-icon-color-error)))}:host([invalid]) #button:not(:disabled,.is-disabled):active{border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-error-active, var(--picker-border-color-error-active)))}:host([invalid][open]) #button:not(:disabled,.is-disabled){border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-error-default-open, var(--picker-border-color-error-default-open)))}:host([invalid]) #button.is-keyboardFocused:not(:disabled,.is-disabled),:host([invalid]) #button:not(:disabled,.is-disabled):focus-visible{border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-error-key-focus, var(--picker-border-color-error-key-focus)))}:host([pending]) #button .disclosure-icon{color:var(--highcontrast-picker-content-color-disabled, var(--luzmo-picker-icon-color-disabled, var(--picker-icon-color-disabled)))}.icon{flex-shrink:0}.label{white-space:nowrap;font-size:var(--luzmo-picker-font-size, var(--picker-font-size));line-height:var(--luzmo-picker-line-height, var(--picker-line-height));font-weight:var(--luzmo-picker-font-weight, var(--picker-font-weight));text-overflow:ellipsis;text-align:start;flex:auto;overflow:hidden}.label.placeholder{font-weight:var(--luzmo-picker-placeholder-font-weight, var(--picker-font-weight));font-style:var(--luzmo-picker-placeholder-font-style, var(--picker-placeholder-font-style));transition:color var(--luzmo-picker-animation-duration, var(--picker-animation-duration)) ease-in-out;color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)))}.label.placeholder:active{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-active, var(--picker-font-color-active)))}.disclosure-icon{vertical-align:top;transition:color var(--luzmo-picker-animation-duration, var(--picker-animation-duration)) ease-out;margin-inline-start:var(--luzmo-picker-spacing-icon-to-disclosure-icon, var(--picker-spacing-icon-to-disclosure-icon));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-default, var(--picker-icon-color-default)));flex-shrink:0;display:inline-block;position:relative}.disclosure-icon:active{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-active, var(--picker-icon-color-active)))}luzmo-progress-circle,.validation-icon{margin-inline-start:var(--luzmo-picker-spacing-text-to-icon, var(--picker-spacing-text-to-icon))}.icon-container{display:flex;position:relative;height:100%;align-items:center;font-size:var(--luzmo-picker-disclosure-icon-size, var(--picker-disclosure-icon-size))}.icon-container.disclosure-icon{margin-inline-end:0}.label~.disclosure-icon{margin-inline-start:var(--luzmo-picker-spacing-text-to-icon, var(--picker-spacing-text-to-icon))}:host([quiet]) #button{inline-size:auto;min-inline-size:0;padding-inline:var(--luzmo-picker-spacing-edge-to-text-quiet, var(--picker-spacing-edge-to-text-quiet));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)));background-color:initial;background-color:var(--highcontrast-picker-background-color, transparent);border:none;border-radius:0;box-shadow:none;margin-block-start:calc(var(--luzmo-picker-spacing-label-to-picker-quiet, var(--picker-spacing-label-to-picker-quiet)) + 1px)}:host([quiet]) #button.label-inline{margin-block-start:0}:host([quiet]) #button .disclosure-icon{margin-inline-end:var(--luzmo-picker-spacing-edge-to-disclosure-icon-quiet, var(--picker-spacing-edge-to-disclosure-icon-quiet))}:host([quiet]) #button:after{block-size:auto;inline-size:auto;border:none}@media (hover: hover){#button:hover{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-hover, var(--picker-font-color-hover)));background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-hover, var(--picker-background-color-hover)));border-color:var(--highcontrast-picker-border-color-hover, var(--luzmo-picker-border-color-hover, var(--picker-border-color-hover)))}#button:hover .disclosure-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-hover, var(--picker-icon-color-hover)))}:host([open]):not([quiet]) #button:not(:disabled,.is-disabled):hover{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-hover-open, var(--picker-font-color-hover-open)));background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-hover-open, var(--picker-background-color-hover-open)));border-color:var(--highcontrast-picker-border-color-hover, var(--luzmo-picker-border-color-hover-open, var(--picker-border-color-hover-open)))}:host([open]) #button:not(:disabled,.is-disabled):hover .disclosure-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-hover-open, var(--picker-icon-color-hover-open)))}:host([invalid]) #button:not(:disabled,.is-disabled):hover{border-color:var(--highcontrast-picker-border-color-hover, var(--luzmo-picker-border-color-error-hover, var(--picker-border-color-error-hover)))}:host([invalid][open]) #button:not(:disabled,.is-disabled):hover{border-color:var(--highcontrast-picker-border-color-hover, var(--luzmo-picker-border-color-error-hover-open, var(--picker-border-color-error-hover-open)))}.label.placeholder:hover{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-hover, var(--picker-font-color-hover)))}:host([quiet]) #button:hover{background-color:initial;background-color:var(--highcontrast-picker-background-color, transparent)!important}}:host([quiet]) #button.is-keyboardFocused,:host([quiet]) #button:focus-visible{background-color:initial;background-color:var(--highcontrast-picker-background-color, transparent)}:host([quiet]) #button.is-keyboardFocused:after,:host([quiet]) #button:focus-visible:after{box-shadow:0 var(--luzmo-picker-focus-indicator-thickness, var(--picker-focus-indicator-thickness)) 0 0 var(--highcontrast-picker-focus-indicator-color, var(--luzmo-picker-focus-indicator-color, var(--picker-focus-indicator-color)));margin:calc((var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) + var(--luzmo-picker-border-width, var(--picker-border-width))) * -1) 0;border:none;border-radius:0}:host([quiet][open]) #button,:host([quiet][disabled]) #button#button,:host([quiet]) #button#button:disabled,:host([quiet]) #button:active{background-color:initial;background-color:var(--highcontrast-picker-background-color, transparent)}.label-inline{vertical-align:top;display:inline-flex}:host([disabled]) #button,#button:disabled{cursor:default;background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-disabled, var(--picker-background-color-disabled)));border-color:#0000;border-color:var(--highcontrast-picker-border-color-disabled, transparent);color:var(--highcontrast-picker-content-color-disabled, var(--luzmo-picker-font-color-disabled, var(--picker-font-color-disabled)))}:host([disabled]) #button .icon,:host([disabled]) #button .disclosure-icon,:host([disabled]) #button .validation-icon,#button:disabled .icon,#button:disabled .disclosure-icon,#button:disabled .validation-icon{color:var(--highcontrast-picker-content-color-disabled, var(--luzmo-picker-icon-color-disabled, var(--picker-icon-color-disabled)))}:host([disabled]) #button .label.placeholder,#button:disabled .label.placeholder{color:var(--highcontrast-picker-content-color-disabled, var(--luzmo-picker-font-color-disabled, var(--picker-font-color-disabled)))}:host{--picker-box-shadow: 0px 1px 3px 0px rgba(var(--luzmo-border-color-rgb), .06);--picker-background-color-default: var(--luzmo-background-color);--picker-background-color-default-open: var(--luzmo-background-color-hover);--picker-background-color-active: var(--luzmo-background-color-down);--picker-background-color-hover: var(--luzmo-background-color-hover);--picker-background-color-hover-open: var(--luzmo-background-color-down);--picker-background-color-key-focus: var(--luzmo-background-color-down);--picker-border-color-default: var(--luzmo-border-color);--picker-border-color-default-open: var(--luzmo-border-color-hover);--picker-border-color-hover: var(--luzmo-border-color);--picker-border-color-hover-open: var(--luzmo-border-color-hover);--picker-border-color-active: var(--luzmo-border-color);--picker-border-color-key-focus: var(--luzmo-border-color);--picker-border-width: var(--luzmo-border-width);--picker-font-size: var(--luzmo-font-size);--picker-font-weight: var(--luzmo-font-weight);--picker-placeholder-font-style: var(--luzmo-font-style);--picker-line-height: var(--luzmo-line-height);--picker-block-size: 32px;--picker-border-radius: var(--luzmo-border-radius);--picker-spacing-edge-to-text: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-text-to-icon: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-text-to-icon-inline-end: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-icon-to-disclosure-icon: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-edge-to-text-quiet: 0px;--picker-spacing-label-to-picker: 0px;--picker-spacing-label-to-picker-quiet: calc( -1 * var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-edge-to-disclosure-icon: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-edge-to-disclosure-icon-quiet: 0px;--picker-animation-duration: var(--luzmo-animation-duration);--picker-font-color-default: var(--luzmo-font-color);--picker-font-color-default-open: var(--luzmo-font-color-hover);--picker-font-color-hover: var(--luzmo-font-color-hover);--picker-font-color-hover-open: var(--luzmo-font-color-down);--picker-font-color-active: var(--luzmo-font-color-focus);--picker-font-color-key-focus: var(--luzmo-font-color-focus);--picker-icon-color-default: var(--luzmo-font-color);--picker-icon-color-default-open: var(--luzmo-font-color-hover);--picker-icon-color-hover: var(--luzmo-font-color-hover);--picker-icon-color-hover-open: var(--luzmo-font-color-hover);--picker-icon-color-active: var(--luzmo-font-color-focus);--picker-icon-color-key-focus: var(--luzmo-font-color-focus);--picker-border-color-error-default: var(--luzmo-color-negative);--picker-border-color-error-default-open: var(--luzmo-color-negative-down);--picker-border-color-error-hover: var(--luzmo-color-negative-hover);--picker-border-color-error-hover-open: var(--luzmo-color-negative-down);--picker-border-color-error-active: var(--luzmo-color-negative-down);--picker-border-color-error-key-focus: var(--luzmo-color-negative-focus);--picker-icon-color-error: var(--luzmo-color-negative);--picker-background-color-disabled: var(--luzmo-background-color-disabled);--picker-font-color-disabled: var(--luzmo-color-disabled);--picker-icon-color-disabled: var(--luzmo-color-disabled);--picker-focus-indicator-gap: var(--luzmo-indicator-gap);--picker-focus-indicator-thickness: var(--luzmo-indicator-width);--picker-focus-indicator-color: var(--luzmo-indicator-color);--picker-disclosure-icon-size: var(--luzmo-font-size-s)}:host([size=s]){--picker-block-size: 28px;--picker-font-size: var(--luzmo-font-size-s);--picker-border-radius: var(--luzmo-border-radius);--picker-spacing-edge-to-text: var(--luzmo-spacing-3);--picker-spacing-text-to-icon: var(--luzmo-spacing-3);--picker-spacing-text-to-icon-inline-end: var(--luzmo-spacing-3);--picker-spacing-icon-to-disclosure-icon: var(--luzmo-spacing-3);--picker-spacing-label-to-picker-quiet: calc(-1 * var(--luzmo-spacing-3));--picker-spacing-edge-to-disclosure-icon: var(--luzmo-spacing-3);--picker-disclosure-icon-size: var(--luzmo-font-size-s)}:host([size=l]){--picker-block-size: 40px;--picker-font-size: var(--luzmo-font-size-l);--picker-border-radius: var(--luzmo-border-radius);--picker-spacing-edge-to-text: var(--luzmo-spacing-4);--picker-spacing-text-to-icon: var(--luzmo-spacing-4);--picker-spacing-text-to-icon-inline-end: var(--luzmo-spacing-4);--picker-spacing-icon-to-disclosure-icon: var(--luzmo-spacing-4);--picker-spacing-label-to-picker-quiet: calc(-1 * var(--luzmo-spacing-4));--picker-spacing-edge-to-disclosure-icon: var(--luzmo-spacing-4);--picker-disclosure-icon-size: var(--luzmo-font-size)}:host([size=xl]){--picker-block-size: 48px;--picker-font-size: var(--luzmo-font-size-xl);--picker-border-radius: var(--luzmo-border-radius-l);--picker-spacing-edge-to-text: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-text-to-icon: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-text-to-icon-inline-end: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-icon-to-disclosure-icon: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-label-to-picker-quiet: calc( -1 * var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-edge-to-disclosure-icon: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-disclosure-icon-size: var(--luzmo-font-size-l)}:host([variant=highlight]) ::slotted(luzmo-menu-item[selected]){--menu-item-highlight-label-content-color: var(--luzmo-primary-inverse-color);--menu-checkmark-display: var(--menu-checkmark-display-hidden);padding-inline-start:var(--luzmo-menu-item-label-inline-edge-to-content, var(--menu-item-label-inline-edge-to-content));background-color:var(--luzmo-menu-item-highlight-label-background-color, var(--menu-item-highlight-label-background-color, var(--luzmo-border-color)))}:host{display:inline-flex;vertical-align:top;max-inline-size:100%;inline-size:var(--luzmo-picker-inline-size, var(--picker-inline-size));min-inline-size:calc(var(--picker-minimum-width-multiplier) * var(--luzmo-picker-block-size, var(--picker-block-size)))}:host([quiet]){width:auto;min-width:0}:host([disabled]){pointer-events:none}#button{width:100%;min-width:100%;max-width:100%}#icon:not([hidden]){display:inline-flex}:host([readonly]) #button{-webkit-user-select:inherit;user-select:inherit}.picker,.validation-icon{flex-shrink:0}luzmo-overlay{pointer-events:none}luzmo-menu{pointer-events:initial}:host>luzmo-menu{display:none}:host([focused]:not([quiet])) #button #label.placeholder{color:var(--picker-placeholder-text-color-key-focus, var(--alias-placeholder-text-color-hover))}#label.visually-hidden~.picker{margin-inline-start:auto}:host([focused]:not([quiet],[pending])) #button .picker{color:var(--picker-icon-color-key-focus, var(--alias-icon-color-focus))}.visually-hidden{border:0;clip:rect(0,0,0,0);clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}luzmo-overlay:not(:defined){display:none}#button.remove-focus-ring-safari-hack:focus-visible{background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-default, var(--picker-background-color-default)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-default, var(--picker-border-color-default)));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)))}#button.remove-focus-ring-safari-hack:after{border:none}#button.remove-focus-ring-safari-hack:focus-visible:after{box-shadow:none}#button.remove-focus-ring-safari-hack:active{background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-default, var(--picker-background-color-default)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-default, var(--picker-border-color-default)));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)))}';
|
1001
|
+
var L = /* @__PURE__ */ ((n) => (n[n.desktop = 0] = "desktop", n[n.mobile = 1] = "mobile", n))(L || {});
|
1002
|
+
class q {
|
1003
|
+
constructor(e, t) {
|
1004
|
+
this.target = e, this.host = t, this.preventNextToggle = "no", this.pointerdownState = !1, this.enterKeydownOn = null, this._open = !1, this.target = e, this.host = t, this.host.addController(this), this.init();
|
1005
|
+
}
|
1006
|
+
get activelyOpening() {
|
1007
|
+
return !1;
|
1008
|
+
}
|
1009
|
+
get open() {
|
1010
|
+
return this._open;
|
1011
|
+
}
|
1012
|
+
/**
|
1013
|
+
* Set `open`
|
1014
|
+
*/
|
1015
|
+
set open(e) {
|
1016
|
+
if (this._open !== e) {
|
1017
|
+
if (this._open = e, this.overlay) {
|
1018
|
+
this.host.open = e;
|
1019
|
+
return;
|
1020
|
+
}
|
1021
|
+
customElements.whenDefined("luzmo-overlay").then(async () => {
|
1022
|
+
const { Overlay: t } = await import("./index-B9h2L_hV.js").then((o) => o.i);
|
1023
|
+
this.overlay = new t(), this.host.open = !0, this.host.requestUpdate();
|
1024
|
+
}), import("./index-B9h2L_hV.js").then((t) => t.i);
|
1025
|
+
}
|
1026
|
+
}
|
1027
|
+
get overlay() {
|
1028
|
+
return this._overlay;
|
1029
|
+
}
|
1030
|
+
set overlay(e) {
|
1031
|
+
e && this.overlay !== e && (this._overlay = e, this.initOverlay());
|
1032
|
+
}
|
1033
|
+
releaseDescription() {
|
1034
|
+
}
|
1035
|
+
handleBeforetoggle(e) {
|
1036
|
+
var t;
|
1037
|
+
e.composedPath()[0] === e.target && (e.newState === "closed" && (this.preventNextToggle === "no" ? this.open = !1 : this.pointerdownState || (t = this.overlay) == null || t.manuallyKeepOpen()), this.open || (this.host.optionsMenu.updateSelectedItemIndex(), this.host.optionsMenu.closeDescendentOverlays()));
|
1038
|
+
}
|
1039
|
+
initOverlay() {
|
1040
|
+
this.overlay && (this.overlay.addEventListener("beforetoggle", (e) => {
|
1041
|
+
this.handleBeforetoggle(
|
1042
|
+
e
|
1043
|
+
);
|
1044
|
+
}), this.overlay.type = this.host.isMobile.matches ? "modal" : "auto", this.overlay.triggerElement = this.host, this.overlay.placement = this.host.isMobile.matches ? void 0 : this.host.placement, this.overlay.receivesFocus = "true", this.overlay.willPreventClose = this.preventNextToggle !== "no" && this.open, this.overlay.addEventListener(
|
1045
|
+
"slottable-request",
|
1046
|
+
this.host.handleSlottableRequest
|
1047
|
+
));
|
1048
|
+
}
|
1049
|
+
handlePointerdown(e) {
|
1050
|
+
}
|
1051
|
+
handleButtonFocus(e) {
|
1052
|
+
this.preventNextToggle === "maybe" && e.relatedTarget === this.host.optionsMenu && (this.preventNextToggle = "yes");
|
1053
|
+
}
|
1054
|
+
handleActivate(e) {
|
1055
|
+
}
|
1056
|
+
/* c8 ignore next 3 */
|
1057
|
+
init() {
|
1058
|
+
}
|
1059
|
+
abort() {
|
1060
|
+
var e;
|
1061
|
+
this.releaseDescription(), (e = this.abortController) == null || e.abort();
|
1062
|
+
}
|
1063
|
+
hostConnected() {
|
1064
|
+
this.init();
|
1065
|
+
}
|
1066
|
+
hostDisconnected() {
|
1067
|
+
var e;
|
1068
|
+
(e = this.abortController) == null || e.abort();
|
1069
|
+
}
|
1070
|
+
hostUpdated() {
|
1071
|
+
this.overlay && this.host.dependencyManager.loaded && this.host.open !== this.overlay.open && (this.overlay.willPreventClose = this.preventNextToggle !== "no", this.overlay.open = this.host.open);
|
1072
|
+
}
|
1073
|
+
}
|
1074
|
+
class xe extends q {
|
1075
|
+
constructor() {
|
1076
|
+
super(...arguments), this.type = L.desktop;
|
1077
|
+
}
|
1078
|
+
handlePointerdown(e) {
|
1079
|
+
if (e.button !== 0 || e.pointerType === "touch")
|
1080
|
+
return;
|
1081
|
+
this.pointerdownState = this.open, this.preventNextToggle = "maybe";
|
1082
|
+
let t = 0;
|
1083
|
+
const o = () => {
|
1084
|
+
cancelAnimationFrame(t), t = requestAnimationFrame(() => {
|
1085
|
+
document.removeEventListener("pointerup", o), document.removeEventListener("pointercancel", o), this.target.removeEventListener("click", o), requestAnimationFrame(() => {
|
1086
|
+
this.preventNextToggle = "no";
|
1087
|
+
});
|
1088
|
+
});
|
1089
|
+
};
|
1090
|
+
document.addEventListener("pointerup", o), document.addEventListener("pointercancel", o), this.target.addEventListener("click", o), this.handleActivate();
|
1091
|
+
}
|
1092
|
+
handleActivate(e) {
|
1093
|
+
this.enterKeydownOn && this.enterKeydownOn !== this.target || this.preventNextToggle !== "yes" && ((e == null ? void 0 : e.type) === "click" && this.open !== this.pointerdownState || this.host.toggle());
|
1094
|
+
}
|
1095
|
+
init() {
|
1096
|
+
var t;
|
1097
|
+
(t = this.abortController) == null || t.abort(), this.abortController = new AbortController();
|
1098
|
+
const { signal: e } = this.abortController;
|
1099
|
+
this.target.addEventListener(
|
1100
|
+
"click",
|
1101
|
+
(o) => this.handleActivate(o),
|
1102
|
+
{
|
1103
|
+
signal: e
|
1104
|
+
}
|
1105
|
+
), this.target.addEventListener(
|
1106
|
+
"pointerdown",
|
1107
|
+
(o) => this.handlePointerdown(o),
|
1108
|
+
{ signal: e }
|
1109
|
+
), this.target.addEventListener(
|
1110
|
+
"focus",
|
1111
|
+
(o) => this.handleButtonFocus(o),
|
1112
|
+
{
|
1113
|
+
signal: e
|
1114
|
+
}
|
1115
|
+
);
|
1116
|
+
}
|
1117
|
+
}
|
1118
|
+
const C = "remove-focus-ring-safari-hack";
|
1119
|
+
class Ie extends q {
|
1120
|
+
constructor() {
|
1121
|
+
super(...arguments), this.type = L.mobile;
|
1122
|
+
}
|
1123
|
+
handleClick() {
|
1124
|
+
this.preventNextToggle === "no" && (this.open = !this.open), this.preventNextToggle = "no";
|
1125
|
+
}
|
1126
|
+
handlePointerdown() {
|
1127
|
+
this.preventNextToggle = this.open ? "yes" : "no", O() && this.target.classList.add(C);
|
1128
|
+
}
|
1129
|
+
handleFocusOut() {
|
1130
|
+
this.host.open || O() && this.target.classList.contains(C) && this.target.classList.remove(C);
|
1131
|
+
}
|
1132
|
+
init() {
|
1133
|
+
var t;
|
1134
|
+
(t = this.abortController) == null || t.abort(), this.abortController = new AbortController();
|
1135
|
+
const { signal: e } = this.abortController;
|
1136
|
+
this.target.addEventListener("click", () => this.handleClick(), {
|
1137
|
+
signal: e
|
1138
|
+
}), this.target.addEventListener(
|
1139
|
+
"pointerdown",
|
1140
|
+
() => this.handlePointerdown(),
|
1141
|
+
{ signal: e }
|
1142
|
+
), this.target.addEventListener("focusout", () => this.handleFocusOut(), {
|
1143
|
+
signal: e
|
1144
|
+
});
|
1145
|
+
}
|
1146
|
+
}
|
1147
|
+
const P = {
|
1148
|
+
desktop: xe,
|
1149
|
+
mobile: Ie
|
1150
|
+
};
|
1151
|
+
var Se = Object.defineProperty, Ce = Object.getOwnPropertyDescriptor, u = (n, e, t, o) => {
|
1152
|
+
for (var i = o > 1 ? void 0 : o ? Ce(e, t) : e, r = n.length - 1, a; r >= 0; r--)
|
1153
|
+
(a = n[r]) && (i = (o ? a(e, t, i) : a(i)) || i);
|
1154
|
+
return o && i && Se(e, t, i), i;
|
1155
|
+
};
|
1156
|
+
const Ee = () => s`
|
1157
|
+
<div class="disclosure-icon icon">
|
1158
|
+
${I(H, { className: "indicator" })}
|
1159
|
+
</div>
|
1160
|
+
`, Me = () => s`
|
1161
|
+
<div class="icon-container validation-icon icon">
|
1162
|
+
${I(K)}
|
1163
|
+
</div>
|
1164
|
+
`, $ = "option-picker";
|
1165
|
+
class c extends M(D, {
|
1166
|
+
noDefaultSize: !0
|
1167
|
+
}) {
|
1168
|
+
/**
|
1169
|
+
* Initializes the `PendingStateController` for the Picker component.
|
1170
|
+
* The `PendingStateController` manages the pending state of the Picker.
|
1171
|
+
*/
|
1172
|
+
constructor() {
|
1173
|
+
super(), this.disabled = !1, this.focused = !1, this.invalid = !1, this.pending = !1, this.pendingLabel = "Pending", this.open = !1, this.readonly = !1, this.placement = "bottom-start", this.quiet = !1, this.value = "", this.selects = "single", this.dependencyManager = new R(this), this.isMobile = new re(this, ie), this.listRole = "listbox", this.itemRole = "option", this.hasRenderedOverlay = !1, this._selfManageFocusElement = !1, this.deprecatedMenu = null, this.selectionPromise = Promise.resolve(), this.willManageSelection = !1, this.recentlyConnected = !1, this.enterKeydownOn = null, this.handleSlottableRequest = (e) => {
|
1174
|
+
}, this.applyFocusElementLabel = (e, t) => {
|
1175
|
+
this.appliedLabel = e, this.labelAlignment = t.sideAligned ? "inline" : void 0;
|
1176
|
+
}, this.handleKeydown = (e) => {
|
1177
|
+
this.focused = !0, !(e.code !== "ArrowDown" && e.code !== "ArrowUp") && (e.stopPropagation(), e.preventDefault(), this.toggle(!0));
|
1178
|
+
}, this.renderAngleIcon = () => Ee(), this.renderAlertIcon = () => Me(), this.handleEnterKeydown = (e) => {
|
1179
|
+
if (e.code === "Enter") {
|
1180
|
+
if (this.enterKeydownOn) {
|
1181
|
+
e.preventDefault();
|
1182
|
+
return;
|
1183
|
+
}
|
1184
|
+
this.enterKeydownOn = e.target, this.addEventListener(
|
1185
|
+
"keyup",
|
1186
|
+
(t) => {
|
1187
|
+
t.code === "Enter" && (this.enterKeydownOn = null);
|
1188
|
+
},
|
1189
|
+
{ once: !0 }
|
1190
|
+
);
|
1191
|
+
}
|
1192
|
+
}, this.pendingStateController = new ne(this);
|
1193
|
+
}
|
1194
|
+
get selectedItem() {
|
1195
|
+
return this._selectedItem;
|
1196
|
+
}
|
1197
|
+
get selectedItemContent() {
|
1198
|
+
return this._selectedItemContent || { icon: [], content: [] };
|
1199
|
+
}
|
1200
|
+
get selfManageFocusElement() {
|
1201
|
+
return this._selfManageFocusElement;
|
1202
|
+
}
|
1203
|
+
get menuItems() {
|
1204
|
+
return this.optionsMenu.childItems;
|
1205
|
+
}
|
1206
|
+
set selectedItem(e) {
|
1207
|
+
if (this.selectedItemContent = e ? e.itemChildren : void 0, e === this.selectedItem)
|
1208
|
+
return;
|
1209
|
+
const t = this.selectedItem;
|
1210
|
+
this._selectedItem = e, this.requestUpdate("selectedItem", t);
|
1211
|
+
}
|
1212
|
+
get focusElement() {
|
1213
|
+
return this.open ? this.optionsMenu : this.button;
|
1214
|
+
}
|
1215
|
+
forceFocusVisible() {
|
1216
|
+
this.disabled || (this.focused = !0);
|
1217
|
+
}
|
1218
|
+
click() {
|
1219
|
+
this.disabled || this.toggle();
|
1220
|
+
}
|
1221
|
+
handleButtonBlur() {
|
1222
|
+
this.focused = !1;
|
1223
|
+
}
|
1224
|
+
focus(e) {
|
1225
|
+
super.focus(e), !this.disabled && this.focusElement && (this.focused = this.hasVisibleFocusInTree());
|
1226
|
+
}
|
1227
|
+
handleHelperFocus() {
|
1228
|
+
this.focused = !0, this.button.focus();
|
1229
|
+
}
|
1230
|
+
handleChange(e) {
|
1231
|
+
this.strategy && (this.strategy.preventNextToggle = "no");
|
1232
|
+
const t = e.target, [o] = t.selectedItems;
|
1233
|
+
e.stopPropagation(), e.cancelable ? this.setValueFromItem(o, e) : (this.open = !1, this.strategy && (this.strategy.open = !1));
|
1234
|
+
}
|
1235
|
+
handleButtonFocus(e) {
|
1236
|
+
var t;
|
1237
|
+
(t = this.strategy) == null || t.handleButtonFocus(e);
|
1238
|
+
}
|
1239
|
+
toggle(e) {
|
1240
|
+
this.readonly || this.pending || (this.open = e === void 0 ? !this.open : e, this.strategy && (this.strategy.open = this.open), this._selfManageFocusElement = this.open);
|
1241
|
+
}
|
1242
|
+
close() {
|
1243
|
+
this.readonly || this.strategy && (this.open = !1, this.strategy.open = !1);
|
1244
|
+
}
|
1245
|
+
bindEvents() {
|
1246
|
+
var e;
|
1247
|
+
(e = this.strategy) == null || e.abort(), this.strategy = this.isMobile.matches ? new P.mobile(this.button, this) : new P.desktop(this.button, this);
|
1248
|
+
}
|
1249
|
+
connectedCallback() {
|
1250
|
+
super.connectedCallback(), this.recentlyConnected = this.hasUpdated;
|
1251
|
+
}
|
1252
|
+
disconnectedCallback() {
|
1253
|
+
var e;
|
1254
|
+
this.close(), (e = this.strategy) == null || e.releaseDescription(), super.disconnectedCallback();
|
1255
|
+
}
|
1256
|
+
async setValueFromItem(e, t) {
|
1257
|
+
this.open = !1, this.strategy && (this.strategy.open = !1);
|
1258
|
+
const o = this.selectedItem, i = this.value;
|
1259
|
+
if (this.selectedItem = e, this.value = (e == null ? void 0 : e.value) ?? "", await this.updateComplete, !this.dispatchEvent(
|
1260
|
+
new CustomEvent("change", {
|
1261
|
+
bubbles: !0,
|
1262
|
+
// Allow it to be prevented.
|
1263
|
+
cancelable: !0,
|
1264
|
+
composed: !0,
|
1265
|
+
detail: this.value
|
1266
|
+
})
|
1267
|
+
) && this.selects) {
|
1268
|
+
t && t.preventDefault(), this.setMenuItemSelected(this.selectedItem, !1), o && this.setMenuItemSelected(o, !0), this.selectedItem = o, this.value = i, this.open = !0, this.strategy && (this.strategy.open = !0);
|
1269
|
+
return;
|
1270
|
+
} else if (!this.selects) {
|
1271
|
+
this.selectedItem = o, this.value = i;
|
1272
|
+
return;
|
1273
|
+
}
|
1274
|
+
o && this.setMenuItemSelected(o, !1), this.setMenuItemSelected(e, !!this.selects);
|
1275
|
+
}
|
1276
|
+
setMenuItemSelected(e, t) {
|
1277
|
+
this.selects != null && (e.selected = t);
|
1278
|
+
}
|
1279
|
+
get containerStyles() {
|
1280
|
+
return this.isMobile.matches ? {
|
1281
|
+
"--swc-menu-width": "100%"
|
1282
|
+
} : {};
|
1283
|
+
}
|
1284
|
+
set selectedItemContent(e) {
|
1285
|
+
if (e === this.selectedItemContent)
|
1286
|
+
return;
|
1287
|
+
const t = this.selectedItemContent;
|
1288
|
+
this._selectedItemContent = e, this.requestUpdate("selectedItemContent", t);
|
1289
|
+
}
|
1290
|
+
handleTooltipSlotchange(e) {
|
1291
|
+
this.tooltipEl = e.target.assignedElements()[0];
|
1292
|
+
}
|
1293
|
+
renderLabelContent(e) {
|
1294
|
+
return this.value && this.selectedItem ? e : s`
|
1295
|
+
<slot name="label" id="label">
|
1296
|
+
<span aria-hidden=${x(this.appliedLabel ? void 0 : "true")}>
|
1297
|
+
${this.label}
|
1298
|
+
</span>
|
1299
|
+
</slot>
|
1300
|
+
`;
|
1301
|
+
}
|
1302
|
+
get buttonContent() {
|
1303
|
+
const e = {
|
1304
|
+
"visually-hidden": this.icons === "only" && !!this.value,
|
1305
|
+
placeholder: !this.value,
|
1306
|
+
label: !0
|
1307
|
+
}, t = this.appliedLabel || this.label;
|
1308
|
+
return [
|
1309
|
+
s`
|
1310
|
+
<div id="icon" ?hidden=${this.icons === "none"}>
|
1311
|
+
${this.selectedItemContent.icon}
|
1312
|
+
</div>
|
1313
|
+
<div
|
1314
|
+
id=${x(this.value && this.selectedItem ? "label" : void 0)}
|
1315
|
+
class=${ae(e)}
|
1316
|
+
>
|
1317
|
+
${this.renderLabelContent(this.selectedItemContent.content)}
|
1318
|
+
</div>
|
1319
|
+
${this.value && this.selectedItem ? s`
|
1320
|
+
<div
|
1321
|
+
aria-hidden="true"
|
1322
|
+
class="visually-hidden"
|
1323
|
+
id="applied-label"
|
1324
|
+
>
|
1325
|
+
${t}
|
1326
|
+
<slot name="label"></slot>
|
1327
|
+
</div>
|
1328
|
+
` : s` <span hidden id="applied-label">${t}</span> `}
|
1329
|
+
${this.invalid && !this.pending ? s` ${this.renderAlertIcon()} ` : E}
|
1330
|
+
${this.pendingStateController.renderPendingState()}
|
1331
|
+
${this.renderAngleIcon()}
|
1332
|
+
<slot
|
1333
|
+
aria-hidden="true"
|
1334
|
+
name="tooltip"
|
1335
|
+
id="tooltip"
|
1336
|
+
@slotchange=${this.handleTooltipSlotchange}
|
1337
|
+
></slot>
|
1338
|
+
`
|
1339
|
+
];
|
1340
|
+
}
|
1341
|
+
renderOverlay(e) {
|
1342
|
+
var o, i, r;
|
1343
|
+
if (((o = this.strategy) == null ? void 0 : o.overlay) === void 0)
|
1344
|
+
return e;
|
1345
|
+
const t = this.renderContainer(e);
|
1346
|
+
return W(t, (i = this.strategy) == null ? void 0 : i.overlay, {
|
1347
|
+
host: this
|
1348
|
+
}), (r = this.strategy) == null ? void 0 : r.overlay;
|
1349
|
+
}
|
1350
|
+
get renderDescriptionSlot() {
|
1351
|
+
return s`
|
1352
|
+
<div id=${$}>
|
1353
|
+
<slot name="description"></slot>
|
1354
|
+
</div>
|
1355
|
+
`;
|
1356
|
+
}
|
1357
|
+
// a helper to throw focus to the button is needed because Safari
|
1358
|
+
// won't include buttons in the tab order even with tabindex="0"
|
1359
|
+
render() {
|
1360
|
+
return this.tooltipEl && (this.tooltipEl.disabled = this.open), s`
|
1361
|
+
<span
|
1362
|
+
id="focus-helper"
|
1363
|
+
tabindex=${this.focused || this.open ? "-1" : "0"}
|
1364
|
+
@focus=${this.handleHelperFocus}
|
1365
|
+
aria-describedby=${$}
|
1366
|
+
></span>
|
1367
|
+
<button
|
1368
|
+
aria-controls=${x(this.open ? "menu" : void 0)}
|
1369
|
+
aria-describedby="tooltip"
|
1370
|
+
aria-expanded=${this.open ? "true" : "false"}
|
1371
|
+
aria-haspopup="true"
|
1372
|
+
aria-labelledby="loader icon label applied-label"
|
1373
|
+
id="button"
|
1374
|
+
class=${x(
|
1375
|
+
this.labelAlignment ? `label-${this.labelAlignment}` : void 0
|
1376
|
+
)}
|
1377
|
+
@blur=${this.handleButtonBlur}
|
1378
|
+
@keydown=${{
|
1379
|
+
handleEvent: this.handleEnterKeydown,
|
1380
|
+
capture: !0
|
1381
|
+
}}
|
1382
|
+
?disabled=${this.disabled}
|
1383
|
+
tabindex="-1"
|
1384
|
+
>
|
1385
|
+
${this.buttonContent}
|
1386
|
+
</button>
|
1387
|
+
${this.renderMenu} ${this.renderDescriptionSlot}
|
1388
|
+
`;
|
1389
|
+
}
|
1390
|
+
update(e) {
|
1391
|
+
var t, o;
|
1392
|
+
this.selects && (this.selects = "single"), e.has("disabled") && this.disabled && this.strategy && (this.open = !1, this.strategy.open = !1), e.has("pending") && this.pending && this.strategy && (this.open = !1, this.strategy.open = !1), e.has("value") && this.shouldScheduleManageSelection(), this.hasUpdated || (this.deprecatedMenu = this.querySelector(":scope > luzmo-menu"), (t = this.deprecatedMenu) == null || t.toggleAttribute("ignore", !0), (o = this.deprecatedMenu) == null || o.setAttribute("selects", "inherit")), super.update(e);
|
1393
|
+
}
|
1394
|
+
bindButtonKeydownListener() {
|
1395
|
+
this.button.addEventListener("keydown", this.handleKeydown);
|
1396
|
+
}
|
1397
|
+
updated(e) {
|
1398
|
+
super.updated(e), e.has("open") && (this.strategy.open = this.open);
|
1399
|
+
}
|
1400
|
+
firstUpdated(e) {
|
1401
|
+
super.firstUpdated(e), this.bindButtonKeydownListener(), this.bindEvents();
|
1402
|
+
}
|
1403
|
+
get dismissHelper() {
|
1404
|
+
return s`
|
1405
|
+
<div class="visually-hidden">
|
1406
|
+
<button
|
1407
|
+
tabindex="-1"
|
1408
|
+
aria-label="Dismiss"
|
1409
|
+
@click=${this.close}
|
1410
|
+
></button>
|
1411
|
+
</div>
|
1412
|
+
`;
|
1413
|
+
}
|
1414
|
+
renderContainer(e) {
|
1415
|
+
const t = s`
|
1416
|
+
${this.dismissHelper} ${e} ${this.dismissHelper}
|
1417
|
+
`;
|
1418
|
+
return this.dependencyManager.add("luzmo-popover"), import("./index-D_KYpfBM.js"), s`
|
1419
|
+
<luzmo-popover
|
1420
|
+
id="popover"
|
1421
|
+
size=${this.size}
|
1422
|
+
role="presentation"
|
1423
|
+
style=${Y(this.containerStyles)}
|
1424
|
+
placement=${this.placement}
|
1425
|
+
>
|
1426
|
+
${t}
|
1427
|
+
</luzmo-popover>
|
1428
|
+
`;
|
1429
|
+
}
|
1430
|
+
get renderMenu() {
|
1431
|
+
const e = s`
|
1432
|
+
<luzmo-menu
|
1433
|
+
aria-labelledby="applied-label"
|
1434
|
+
@change=${this.handleChange}
|
1435
|
+
id="menu"
|
1436
|
+
@keydown=${{
|
1437
|
+
handleEvent: this.handleEnterKeydown,
|
1438
|
+
capture: !0
|
1439
|
+
}}
|
1440
|
+
@scroll=${this.onScroll}
|
1441
|
+
role=${this.listRole}
|
1442
|
+
.selects=${this.selects}
|
1443
|
+
.selected=${this.value ? [this.value] : []}
|
1444
|
+
size=${this.size}
|
1445
|
+
@luzmo-menu-item-added-or-updated=${this.shouldManageSelection}
|
1446
|
+
>
|
1447
|
+
<slot @slotchange=${this.shouldScheduleManageSelection}></slot>
|
1448
|
+
</luzmo-menu>
|
1449
|
+
`;
|
1450
|
+
return this.hasRenderedOverlay = this.hasRenderedOverlay || this.focused || this.open || !!this.deprecatedMenu, this.hasRenderedOverlay ? (this.dependencyManager.loaded && this.dependencyManager.add("luzmo-overlay"), this.renderOverlay(e)) : e;
|
1451
|
+
}
|
1452
|
+
shouldScheduleManageSelection(e) {
|
1453
|
+
!this.willManageSelection && (!e || e.target.getRootNode().host === this) && (this.willManageSelection = !0, requestAnimationFrame(() => {
|
1454
|
+
requestAnimationFrame(() => {
|
1455
|
+
this.manageSelection();
|
1456
|
+
});
|
1457
|
+
}));
|
1458
|
+
}
|
1459
|
+
shouldManageSelection() {
|
1460
|
+
this.willManageSelection || (this.willManageSelection = !0, this.manageSelection());
|
1461
|
+
}
|
1462
|
+
async manageSelection() {
|
1463
|
+
if (this.selects == null)
|
1464
|
+
return;
|
1465
|
+
this.selectionPromise = new Promise(
|
1466
|
+
(t) => this.selectionResolver = t
|
1467
|
+
);
|
1468
|
+
let e;
|
1469
|
+
await this.optionsMenu.updateComplete, this.recentlyConnected && (await new Promise((t) => requestAnimationFrame(() => t(!0))), this.recentlyConnected = !1), this.menuItems.forEach((t) => {
|
1470
|
+
this.value === t.value && !t.disabled ? e = t : t.selected = !1;
|
1471
|
+
}), e ? (e.selected = !!this.selects, this.selectedItem = e) : (this.value = "", this.selectedItem = void 0), this.open && (await this.optionsMenu.updateComplete, this.optionsMenu.updateSelectedItemIndex()), this.selectionResolver(), this.willManageSelection = !1;
|
1472
|
+
}
|
1473
|
+
async getUpdateComplete() {
|
1474
|
+
const e = await super.getUpdateComplete();
|
1475
|
+
return await this.selectionPromise, e;
|
1476
|
+
}
|
1477
|
+
onScroll() {
|
1478
|
+
this.dispatchEvent(
|
1479
|
+
new Event("scroll", {
|
1480
|
+
cancelable: !0,
|
1481
|
+
composed: !0
|
1482
|
+
})
|
1483
|
+
);
|
1484
|
+
}
|
1485
|
+
}
|
1486
|
+
u([
|
1487
|
+
S()
|
1488
|
+
], c.prototype, "appliedLabel", 2);
|
1489
|
+
u([
|
1490
|
+
b("#button")
|
1491
|
+
], c.prototype, "button", 2);
|
1492
|
+
u([
|
1493
|
+
l({ type: Boolean, reflect: !0 })
|
1494
|
+
], c.prototype, "disabled", 2);
|
1495
|
+
u([
|
1496
|
+
l({ type: Boolean, reflect: !0 })
|
1497
|
+
], c.prototype, "focused", 2);
|
1498
|
+
u([
|
1499
|
+
l({ type: String, reflect: !0 })
|
1500
|
+
], c.prototype, "icons", 2);
|
1501
|
+
u([
|
1502
|
+
l({ type: String, reflect: !0 })
|
1503
|
+
], c.prototype, "variant", 2);
|
1504
|
+
u([
|
1505
|
+
l({ type: Boolean, reflect: !0 })
|
1506
|
+
], c.prototype, "invalid", 2);
|
1507
|
+
u([
|
1508
|
+
l({ type: Boolean, reflect: !0 })
|
1509
|
+
], c.prototype, "pending", 2);
|
1510
|
+
u([
|
1511
|
+
l({ type: String, attribute: "pending-label" })
|
1512
|
+
], c.prototype, "pendingLabel", 2);
|
1513
|
+
u([
|
1514
|
+
l()
|
1515
|
+
], c.prototype, "label", 2);
|
1516
|
+
u([
|
1517
|
+
l({ type: Boolean, reflect: !0 })
|
1518
|
+
], c.prototype, "open", 2);
|
1519
|
+
u([
|
1520
|
+
l({ type: Boolean, reflect: !0 })
|
1521
|
+
], c.prototype, "readonly", 2);
|
1522
|
+
u([
|
1523
|
+
S()
|
1524
|
+
], c.prototype, "labelAlignment", 2);
|
1525
|
+
u([
|
1526
|
+
b("luzmo-menu")
|
1527
|
+
], c.prototype, "optionsMenu", 2);
|
1528
|
+
u([
|
1529
|
+
b("luzmo-overlay")
|
1530
|
+
], c.prototype, "overlayElement", 2);
|
1531
|
+
u([
|
1532
|
+
l()
|
1533
|
+
], c.prototype, "placement", 2);
|
1534
|
+
u([
|
1535
|
+
l({ type: Boolean, reflect: !0 })
|
1536
|
+
], c.prototype, "quiet", 2);
|
1537
|
+
u([
|
1538
|
+
l({ type: String })
|
1539
|
+
], c.prototype, "value", 2);
|
1540
|
+
u([
|
1541
|
+
l({ attribute: !1 })
|
1542
|
+
], c.prototype, "selectedItem", 1);
|
1543
|
+
u([
|
1544
|
+
S()
|
1545
|
+
], c.prototype, "selectedItemContent", 1);
|
1546
|
+
class Ae extends c {
|
1547
|
+
constructor() {
|
1548
|
+
super(...arguments), this.handleKeydown = (e) => {
|
1549
|
+
const { code: t } = e;
|
1550
|
+
if (this.focused = !0, !t.startsWith("Arrow") || this.readonly || this.pending)
|
1551
|
+
return;
|
1552
|
+
if (t === "ArrowUp" || t === "ArrowDown") {
|
1553
|
+
this.toggle(!0), e.preventDefault();
|
1554
|
+
return;
|
1555
|
+
}
|
1556
|
+
e.preventDefault();
|
1557
|
+
const o = this.selectedItem ? this.menuItems.indexOf(this.selectedItem) : -1, i = o < 0 || t === "ArrowRight" ? 1 : -1;
|
1558
|
+
let r = o + i;
|
1559
|
+
for (; this.menuItems[r] && this.menuItems[r].disabled; )
|
1560
|
+
r += i;
|
1561
|
+
!this.menuItems[r] || this.menuItems[r].disabled || (!this.value || r !== o) && this.setValueFromItem(this.menuItems[r]);
|
1562
|
+
};
|
1563
|
+
}
|
1564
|
+
static get styles() {
|
1565
|
+
return [z(we)];
|
1566
|
+
}
|
1567
|
+
get containerStyles() {
|
1568
|
+
const e = super.containerStyles;
|
1569
|
+
return this.quiet || (e["min-width"] = `${this.offsetWidth}px`), e;
|
1570
|
+
}
|
1571
|
+
}
|
1572
|
+
customElements.get("luzmo-picker") || customElements.define("luzmo-picker", Ae);
|
1573
|
+
export {
|
1574
|
+
$ as D,
|
1575
|
+
c as L,
|
1576
|
+
ye as M,
|
1577
|
+
oe as O,
|
1578
|
+
ne as P,
|
1579
|
+
v as a,
|
1580
|
+
me as b,
|
1581
|
+
A as c,
|
1582
|
+
d,
|
1583
|
+
Ae as e
|
1584
|
+
};
|