@luzmo/lucero 0.0.15 → 0.0.16
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/components/action-bar/index.cjs +1 -1
- package/components/action-bar/index.js +1 -1
- package/components/action-button/index.cjs +1 -1
- package/components/action-button/index.js +1 -1
- package/components/action-menu/index.cjs +1 -1
- package/components/action-menu/index.js +2 -2
- package/components/button/index.cjs +1 -1
- package/components/button/index.js +3 -3
- package/components/{button-base-DmjYs2s9.cjs → button-base-Cfb8QBjx.cjs} +1 -1
- package/components/{button-base-B7v4eeRh.js → button-base-DSHx7XO8.js} +27 -27
- package/components/{clear-button-KdrF2jaV.cjs → clear-button-CyzA8riE.cjs} +1 -1
- package/components/{clear-button-DgZmX5RX.js → clear-button-DB34Vybj.js} +1 -1
- package/components/{close-button-DVGUppyd.cjs → close-button-DOA-6eL0.cjs} +1 -1
- package/components/{close-button-CFHQnbsK.js → close-button-DU58NTKR.js} +1 -1
- package/components/icon/index.cjs +1 -1
- package/components/icon/index.js +24 -24
- package/components/index-4SZZSkew.cjs +83 -0
- package/components/{index-BH9W0QLt.js → index-AM-58E5r.js} +61 -52
- package/components/index.cjs +1 -1
- package/components/index.js +4 -4
- package/components/infield-button/index.cjs +1 -1
- package/components/infield-button/index.js +2 -2
- package/components/menu/index.cjs +1 -1
- package/components/menu/index.js +1 -1
- package/components/menu/menu.d.ts +1 -0
- package/components/picker/index.cjs +1 -1
- package/components/picker/index.js +2 -2
- package/components/picker/picker.d.ts +2 -1
- package/components/picker-B05XA8I1.cjs +127 -0
- package/components/picker-C9HmjRgR.js +656 -0
- package/components/tags/index.cjs +1 -1
- package/components/tags/index.js +1 -1
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +1 -1
- package/custom-elements.json +1 -1
- package/package.json +1 -1
- package/components/index-C2bkoP5q.cjs +0 -77
- package/components/picker-BBchB7nM.cjs +0 -127
- package/components/picker-C_coD2KL.js +0 -655
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
/*! * Lucero - The design system for Luzmo.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2025 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
+
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
+
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
+
*
|
|
10
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
+
* SOFTWARE.
|
|
17
|
+
* */
|
|
18
|
+
import { T as w, x as l, E as u, B as x, r as I, n as s } from "./base-CawdqE7p.js";
|
|
19
|
+
import { r as v } from "./state-CYxk12SV.js";
|
|
20
|
+
import { e as b } from "./query-D_KR_GUc.js";
|
|
21
|
+
import { e as C, i as S, t as M } from "./directive-oAbCiebi.js";
|
|
22
|
+
import { o as p } from "./if-defined-BSAr_4u4.js";
|
|
23
|
+
import { o as $ } from "./style-map-Ct2LiEds.js";
|
|
24
|
+
import { F as E } from "./focusable-cj2QhwDT.js";
|
|
25
|
+
import { D as q } from "./dependency-manger-CEXvGQUV.js";
|
|
26
|
+
import { P as L } from "./pending-state-TJj1x9xn.js";
|
|
27
|
+
import { S as F } from "./sized-mixin-BxMraZLS.js";
|
|
28
|
+
import { luzmoIcon as k, luzmoAngleDown as A, luzmoAlert as O } from "@luzmo/icons";
|
|
29
|
+
import "./index-AM-58E5r.js";
|
|
30
|
+
import "./overlay/index.js";
|
|
31
|
+
import "./progress-circle/index.js";
|
|
32
|
+
import "./tooltip/index.js";
|
|
33
|
+
import { f as g } from "./platform-BM-uMWpX.js";
|
|
34
|
+
/**
|
|
35
|
+
* @license
|
|
36
|
+
* Copyright 2018 Google LLC
|
|
37
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
|
+
*/
|
|
39
|
+
const _ = C(class extends S {
|
|
40
|
+
constructor(i) {
|
|
41
|
+
var e;
|
|
42
|
+
if (super(i), i.type !== M.ATTRIBUTE || i.name !== "class" || ((e = i.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.");
|
|
43
|
+
}
|
|
44
|
+
render(i) {
|
|
45
|
+
return " " + Object.keys(i).filter((e) => i[e]).join(" ") + " ";
|
|
46
|
+
}
|
|
47
|
+
update(i, [e]) {
|
|
48
|
+
var t, c;
|
|
49
|
+
if (this.st === void 0) {
|
|
50
|
+
this.st = /* @__PURE__ */ new Set(), i.strings !== void 0 && (this.nt = new Set(i.strings.join(" ").split(/\s/).filter((r) => r !== "")));
|
|
51
|
+
for (const r in e) e[r] && !((t = this.nt) != null && t.has(r)) && this.st.add(r);
|
|
52
|
+
return this.render(e);
|
|
53
|
+
}
|
|
54
|
+
const o = i.element.classList;
|
|
55
|
+
for (const r of this.st) r in e || (o.remove(r), this.st.delete(r));
|
|
56
|
+
for (const r in e) {
|
|
57
|
+
const d = !!e[r];
|
|
58
|
+
d === this.st.has(r) || (c = this.nt) != null && c.has(r) || (d ? (o.add(r), this.st.add(r)) : (o.remove(r), this.st.delete(r)));
|
|
59
|
+
}
|
|
60
|
+
return w;
|
|
61
|
+
}
|
|
62
|
+
}), D = "(max-width: 743px) and (hover: none) and (pointer: coarse)";
|
|
63
|
+
class B {
|
|
64
|
+
constructor(e, o) {
|
|
65
|
+
this.key = Symbol("match-media-key"), this.matches = !1, this.host = e, this.host.addController(this), this.media = window.matchMedia(o), this.matches = this.media.matches, this.onChange = this.onChange.bind(this), e.addController(this);
|
|
66
|
+
}
|
|
67
|
+
hostConnected() {
|
|
68
|
+
var e;
|
|
69
|
+
(e = this.media) == null || e.addEventListener("change", this.onChange);
|
|
70
|
+
}
|
|
71
|
+
hostDisconnected() {
|
|
72
|
+
var e;
|
|
73
|
+
(e = this.media) == null || e.removeEventListener("change", this.onChange);
|
|
74
|
+
}
|
|
75
|
+
onChange(e) {
|
|
76
|
+
this.matches !== e.matches && (this.matches = e.matches, this.host.requestUpdate(this.key, !this.matches));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const P = '#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}#icon{margin-inline-end:var(--luzmo-picker-spacing-text-to-icon, var(--picker-spacing-text-to-icon));font-size:var(--luzmo-picker-font-size, var(--picker-font-size))}@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-item-label-icon-color-default: 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)))}';
|
|
80
|
+
var m = /* @__PURE__ */ ((i) => (i[i.desktop = 0] = "desktop", i[i.mobile = 1] = "mobile", i))(m || {});
|
|
81
|
+
class y {
|
|
82
|
+
constructor(e, o) {
|
|
83
|
+
this.target = e, this.host = o, this.preventNextToggle = "no", this.pointerdownState = !1, this.enterKeydownOn = null, this._open = !1, this.target = e, this.host = o, this.host.addController(this), this.init();
|
|
84
|
+
}
|
|
85
|
+
get activelyOpening() {
|
|
86
|
+
return !1;
|
|
87
|
+
}
|
|
88
|
+
get open() {
|
|
89
|
+
return this._open;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Set `open`
|
|
93
|
+
*/
|
|
94
|
+
set open(e) {
|
|
95
|
+
if (this._open !== e) {
|
|
96
|
+
if (this._open = e, this.overlay) {
|
|
97
|
+
this.host.open = e;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
customElements.whenDefined("luzmo-overlay").then(async () => {
|
|
101
|
+
const { LuzmoOverlay: o } = await import("./overlay/index.js");
|
|
102
|
+
this.overlay = new o(), this.host.open = !0, this.host.requestUpdate();
|
|
103
|
+
}), import("./overlay/index.js");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
get overlay() {
|
|
107
|
+
return this._overlay;
|
|
108
|
+
}
|
|
109
|
+
set overlay(e) {
|
|
110
|
+
e && this.overlay !== e && (this._overlay = e, this.initOverlay());
|
|
111
|
+
}
|
|
112
|
+
releaseDescription() {
|
|
113
|
+
}
|
|
114
|
+
handleBeforetoggle(e) {
|
|
115
|
+
var o;
|
|
116
|
+
e.composedPath()[0] === e.target && (e.newState === "closed" && (this.preventNextToggle === "no" ? this.open = !1 : this.pointerdownState || (o = this.overlay) == null || o.manuallyKeepOpen()), this.open || (this.host.optionsMenu.updateSelectedItemIndex(), this.host.optionsMenu.closeDescendentOverlays()));
|
|
117
|
+
}
|
|
118
|
+
initOverlay() {
|
|
119
|
+
this.overlay && (this.overlay.addEventListener("beforetoggle", (e) => {
|
|
120
|
+
this.handleBeforetoggle(
|
|
121
|
+
e
|
|
122
|
+
);
|
|
123
|
+
}), 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(
|
|
124
|
+
"slottable-request",
|
|
125
|
+
this.host.handleSlottableRequest
|
|
126
|
+
));
|
|
127
|
+
}
|
|
128
|
+
handlePointerdown(e) {
|
|
129
|
+
}
|
|
130
|
+
handleButtonFocus(e) {
|
|
131
|
+
this.preventNextToggle === "maybe" && e.relatedTarget === this.host.optionsMenu && (this.preventNextToggle = "yes");
|
|
132
|
+
}
|
|
133
|
+
handleActivate(e) {
|
|
134
|
+
}
|
|
135
|
+
/* c8 ignore next 3 */
|
|
136
|
+
init() {
|
|
137
|
+
}
|
|
138
|
+
abort() {
|
|
139
|
+
var e;
|
|
140
|
+
this.releaseDescription(), (e = this.abortController) == null || e.abort();
|
|
141
|
+
}
|
|
142
|
+
hostConnected() {
|
|
143
|
+
this.init();
|
|
144
|
+
}
|
|
145
|
+
hostDisconnected() {
|
|
146
|
+
var e;
|
|
147
|
+
(e = this.abortController) == null || e.abort();
|
|
148
|
+
}
|
|
149
|
+
hostUpdated() {
|
|
150
|
+
this.overlay && this.host.dependencyManager.loaded && this.host.open !== this.overlay.open && (this.overlay.willPreventClose = this.preventNextToggle !== "no", this.overlay.open = this.host.open);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
class T extends y {
|
|
154
|
+
constructor() {
|
|
155
|
+
super(...arguments), this.type = m.desktop;
|
|
156
|
+
}
|
|
157
|
+
handlePointerdown(e) {
|
|
158
|
+
if (e.button !== 0 || e.pointerType === "touch")
|
|
159
|
+
return;
|
|
160
|
+
this.pointerdownState = this.open, this.preventNextToggle = "maybe";
|
|
161
|
+
let o = 0;
|
|
162
|
+
const t = () => {
|
|
163
|
+
cancelAnimationFrame(o), o = requestAnimationFrame(() => {
|
|
164
|
+
document.removeEventListener("pointerup", t), document.removeEventListener("pointercancel", t), this.target.removeEventListener("click", t), requestAnimationFrame(() => {
|
|
165
|
+
this.preventNextToggle = "no";
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
document.addEventListener("pointerup", t), document.addEventListener("pointercancel", t), this.target.addEventListener("click", t), this.handleActivate();
|
|
170
|
+
}
|
|
171
|
+
handleActivate(e) {
|
|
172
|
+
this.enterKeydownOn && this.enterKeydownOn !== this.target || this.preventNextToggle !== "yes" && ((e == null ? void 0 : e.type) === "click" && this.open !== this.pointerdownState || this.host.toggle());
|
|
173
|
+
}
|
|
174
|
+
init() {
|
|
175
|
+
var o;
|
|
176
|
+
(o = this.abortController) == null || o.abort(), this.abortController = new AbortController();
|
|
177
|
+
const { signal: e } = this.abortController;
|
|
178
|
+
this.target.addEventListener(
|
|
179
|
+
"click",
|
|
180
|
+
(t) => this.handleActivate(t),
|
|
181
|
+
{
|
|
182
|
+
signal: e
|
|
183
|
+
}
|
|
184
|
+
), this.target.addEventListener(
|
|
185
|
+
"pointerdown",
|
|
186
|
+
(t) => this.handlePointerdown(t),
|
|
187
|
+
{ signal: e }
|
|
188
|
+
), this.target.addEventListener(
|
|
189
|
+
"focus",
|
|
190
|
+
(t) => this.handleButtonFocus(t),
|
|
191
|
+
{
|
|
192
|
+
signal: e
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const h = "remove-focus-ring-safari-hack";
|
|
198
|
+
class K extends y {
|
|
199
|
+
constructor() {
|
|
200
|
+
super(...arguments), this.type = m.mobile;
|
|
201
|
+
}
|
|
202
|
+
handleClick() {
|
|
203
|
+
this.preventNextToggle === "no" && (this.open = !this.open), this.preventNextToggle = "no";
|
|
204
|
+
}
|
|
205
|
+
handlePointerdown() {
|
|
206
|
+
this.preventNextToggle = this.open ? "yes" : "no", g() && this.target.classList.add(h);
|
|
207
|
+
}
|
|
208
|
+
handleFocusOut() {
|
|
209
|
+
this.host.open || g() && this.target.classList.contains(h) && this.target.classList.remove(h);
|
|
210
|
+
}
|
|
211
|
+
init() {
|
|
212
|
+
var o;
|
|
213
|
+
(o = this.abortController) == null || o.abort(), this.abortController = new AbortController();
|
|
214
|
+
const { signal: e } = this.abortController;
|
|
215
|
+
this.target.addEventListener("click", () => this.handleClick(), {
|
|
216
|
+
signal: e
|
|
217
|
+
}), this.target.addEventListener(
|
|
218
|
+
"pointerdown",
|
|
219
|
+
() => this.handlePointerdown(),
|
|
220
|
+
{ signal: e }
|
|
221
|
+
), this.target.addEventListener("focusout", () => this.handleFocusOut(), {
|
|
222
|
+
signal: e
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const f = {
|
|
227
|
+
desktop: T,
|
|
228
|
+
mobile: K
|
|
229
|
+
};
|
|
230
|
+
var N = Object.defineProperty, R = Object.getOwnPropertyDescriptor, a = (i, e, o, t) => {
|
|
231
|
+
for (var c = t > 1 ? void 0 : t ? R(e, o) : e, r = i.length - 1, d; r >= 0; r--)
|
|
232
|
+
(d = i[r]) && (c = (t ? d(e, o, c) : d(c)) || c);
|
|
233
|
+
return t && c && N(e, o, c), c;
|
|
234
|
+
};
|
|
235
|
+
const U = () => l`
|
|
236
|
+
<div class="disclosure-icon icon">
|
|
237
|
+
${k(A, { className: "indicator" })}
|
|
238
|
+
</div>
|
|
239
|
+
`, j = () => l`
|
|
240
|
+
<div class="icon-container validation-icon icon">
|
|
241
|
+
${k(O)}
|
|
242
|
+
</div>
|
|
243
|
+
`, z = "option-picker";
|
|
244
|
+
class n extends F(E, {
|
|
245
|
+
noDefaultSize: !0
|
|
246
|
+
}) {
|
|
247
|
+
/**
|
|
248
|
+
* Initializes the `PendingStateController` for the Picker component.
|
|
249
|
+
* The `PendingStateController` manages the pending state of the Picker.
|
|
250
|
+
*/
|
|
251
|
+
constructor() {
|
|
252
|
+
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 q(this), this.isMobile = new B(this, D), 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) => {
|
|
253
|
+
}, this.applyFocusElementLabel = (e, o) => {
|
|
254
|
+
this.appliedLabel = e, this.labelAlignment = o.sideAligned ? "inline" : void 0;
|
|
255
|
+
}, this.handleKeydown = (e) => {
|
|
256
|
+
this.focused = !0, !(e.code !== "ArrowDown" && e.code !== "ArrowUp") && (e.stopPropagation(), e.preventDefault(), this.toggle(!0));
|
|
257
|
+
}, this.renderAngleIcon = () => U(), this.renderAlertIcon = () => j(), this.handleEnterKeydown = (e) => {
|
|
258
|
+
if (e.code === "Enter") {
|
|
259
|
+
if (this.enterKeydownOn) {
|
|
260
|
+
e.preventDefault();
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
this.enterKeydownOn = e.target, this.addEventListener(
|
|
264
|
+
"keyup",
|
|
265
|
+
(o) => {
|
|
266
|
+
o.code === "Enter" && (this.enterKeydownOn = null);
|
|
267
|
+
},
|
|
268
|
+
{ once: !0 }
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
}, this.pendingStateController = new L(this);
|
|
272
|
+
}
|
|
273
|
+
get selectedItem() {
|
|
274
|
+
return this._selectedItem;
|
|
275
|
+
}
|
|
276
|
+
get selectedItemContent() {
|
|
277
|
+
return this._selectedItemContent || { icon: [], content: [] };
|
|
278
|
+
}
|
|
279
|
+
get selfManageFocusElement() {
|
|
280
|
+
return this._selfManageFocusElement;
|
|
281
|
+
}
|
|
282
|
+
get menuItems() {
|
|
283
|
+
return this.optionsMenu.childItems;
|
|
284
|
+
}
|
|
285
|
+
set selectedItem(e) {
|
|
286
|
+
const o = e == null ? void 0 : e.querySelector('[slot="icon"]');
|
|
287
|
+
if (this.selectedItemContent = e ? e.itemChildren : void 0, e === this.selectedItem)
|
|
288
|
+
return;
|
|
289
|
+
const t = this.selectedItem;
|
|
290
|
+
this._selectedItem = e, this._selectedItemIcon = (o == null ? void 0 : o.icon) ?? void 0, this.requestUpdate("selectedItem", t);
|
|
291
|
+
}
|
|
292
|
+
get focusElement() {
|
|
293
|
+
return this.open ? this.optionsMenu : this.button;
|
|
294
|
+
}
|
|
295
|
+
forceFocusVisible() {
|
|
296
|
+
this.disabled || (this.focused = !0);
|
|
297
|
+
}
|
|
298
|
+
click() {
|
|
299
|
+
this.disabled || this.toggle();
|
|
300
|
+
}
|
|
301
|
+
handleButtonBlur() {
|
|
302
|
+
this.focused = !1;
|
|
303
|
+
}
|
|
304
|
+
focus(e) {
|
|
305
|
+
super.focus(e), !this.disabled && this.focusElement && (this.focused = this.hasVisibleFocusInTree());
|
|
306
|
+
}
|
|
307
|
+
handleHelperFocus() {
|
|
308
|
+
this.focused = !0, this.button.focus();
|
|
309
|
+
}
|
|
310
|
+
handleChange(e) {
|
|
311
|
+
this.strategy && (this.strategy.preventNextToggle = "no");
|
|
312
|
+
const o = e.target, [t] = o.selectedItems;
|
|
313
|
+
e.stopPropagation(), e.cancelable ? this.setValueFromItem(t, e) : (this.open = !1, this.strategy && (this.strategy.open = !1));
|
|
314
|
+
}
|
|
315
|
+
handleButtonFocus(e) {
|
|
316
|
+
var o;
|
|
317
|
+
(o = this.strategy) == null || o.handleButtonFocus(e);
|
|
318
|
+
}
|
|
319
|
+
toggle(e) {
|
|
320
|
+
this.readonly || this.pending || (this.open = e === void 0 ? !this.open : e, this.strategy && (this.strategy.open = this.open), this._selfManageFocusElement = this.open);
|
|
321
|
+
}
|
|
322
|
+
close() {
|
|
323
|
+
this.readonly || this.strategy && (this.open = !1, this.strategy.open = !1);
|
|
324
|
+
}
|
|
325
|
+
bindEvents() {
|
|
326
|
+
var e;
|
|
327
|
+
(e = this.strategy) == null || e.abort(), this.strategy = this.isMobile.matches ? new f.mobile(this.button, this) : new f.desktop(this.button, this);
|
|
328
|
+
}
|
|
329
|
+
connectedCallback() {
|
|
330
|
+
super.connectedCallback(), this.recentlyConnected = this.hasUpdated;
|
|
331
|
+
}
|
|
332
|
+
disconnectedCallback() {
|
|
333
|
+
var e;
|
|
334
|
+
this.close(), (e = this.strategy) == null || e.releaseDescription(), super.disconnectedCallback();
|
|
335
|
+
}
|
|
336
|
+
async setValueFromItem(e, o) {
|
|
337
|
+
this.open = !1, this.strategy && (this.strategy.open = !1);
|
|
338
|
+
const t = this.selectedItem, c = this.value;
|
|
339
|
+
if (this.selectedItem = e, this.value = (e == null ? void 0 : e.value) ?? "", await this.updateComplete, !this.dispatchEvent(
|
|
340
|
+
new CustomEvent("change", {
|
|
341
|
+
bubbles: !0,
|
|
342
|
+
// Allow it to be prevented.
|
|
343
|
+
cancelable: !0,
|
|
344
|
+
composed: !0,
|
|
345
|
+
detail: this.value
|
|
346
|
+
})
|
|
347
|
+
) && this.selects) {
|
|
348
|
+
o && o.preventDefault(), this.setMenuItemSelected(this.selectedItem, !1), t && this.setMenuItemSelected(t, !0), this.selectedItem = t, this.value = c, this.open = !0, this.strategy && (this.strategy.open = !0);
|
|
349
|
+
return;
|
|
350
|
+
} else if (!this.selects) {
|
|
351
|
+
this.selectedItem = t, this.value = c;
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
t && this.setMenuItemSelected(t, !1), this.setMenuItemSelected(e, !!this.selects);
|
|
355
|
+
}
|
|
356
|
+
setMenuItemSelected(e, o) {
|
|
357
|
+
this.selects != null && (e.selected = o);
|
|
358
|
+
}
|
|
359
|
+
get containerStyles() {
|
|
360
|
+
return this.isMobile.matches ? {
|
|
361
|
+
"--swc-menu-width": "100%"
|
|
362
|
+
} : {};
|
|
363
|
+
}
|
|
364
|
+
set selectedItemContent(e) {
|
|
365
|
+
if (e === this.selectedItemContent)
|
|
366
|
+
return;
|
|
367
|
+
const o = this.selectedItemContent;
|
|
368
|
+
this._selectedItemContent = e, this.requestUpdate("selectedItemContent", o);
|
|
369
|
+
}
|
|
370
|
+
handleTooltipSlotchange(e) {
|
|
371
|
+
this.tooltipEl = e.target.assignedElements()[0];
|
|
372
|
+
}
|
|
373
|
+
renderLabelContent(e) {
|
|
374
|
+
return this.value && this.selectedItem ? e : l`
|
|
375
|
+
<slot name="label" id="label">
|
|
376
|
+
<span aria-hidden=${p(this.appliedLabel ? void 0 : "true")}>
|
|
377
|
+
${this.label}
|
|
378
|
+
</span>
|
|
379
|
+
</slot>
|
|
380
|
+
`;
|
|
381
|
+
}
|
|
382
|
+
get buttonContent() {
|
|
383
|
+
const e = {
|
|
384
|
+
"visually-hidden": this.icons === "only" && !!this.value,
|
|
385
|
+
placeholder: !this.value,
|
|
386
|
+
label: !0
|
|
387
|
+
}, o = this.appliedLabel || this.label, t = l` <div id="icon" ?hidden=${this.icons === "none"}>
|
|
388
|
+
${this._selectedItemIcon ? k(this._selectedItemIcon) : u}
|
|
389
|
+
</div>`;
|
|
390
|
+
return [
|
|
391
|
+
l`
|
|
392
|
+
${this._selectedItemIcon ? t : u}
|
|
393
|
+
<div
|
|
394
|
+
id=${p(this.value && this.selectedItem ? "label" : void 0)}
|
|
395
|
+
class=${_(e)}
|
|
396
|
+
>
|
|
397
|
+
${this.renderLabelContent(this.selectedItemContent.content)}
|
|
398
|
+
</div>
|
|
399
|
+
${this.value && this.selectedItem ? l`
|
|
400
|
+
<div
|
|
401
|
+
aria-hidden="true"
|
|
402
|
+
class="visually-hidden"
|
|
403
|
+
id="applied-label"
|
|
404
|
+
>
|
|
405
|
+
${o}
|
|
406
|
+
<slot name="label"></slot>
|
|
407
|
+
</div>
|
|
408
|
+
` : l` <span hidden id="applied-label">${o}</span> `}
|
|
409
|
+
${this.invalid && !this.pending ? l` ${this.renderAlertIcon()} ` : u}
|
|
410
|
+
${this.pendingStateController.renderPendingState()}
|
|
411
|
+
${this.readonly ? u : this.renderAngleIcon()}
|
|
412
|
+
<slot
|
|
413
|
+
aria-hidden="true"
|
|
414
|
+
name="tooltip"
|
|
415
|
+
id="tooltip"
|
|
416
|
+
@slotchange=${this.handleTooltipSlotchange}
|
|
417
|
+
></slot>
|
|
418
|
+
`
|
|
419
|
+
];
|
|
420
|
+
}
|
|
421
|
+
renderOverlay(e) {
|
|
422
|
+
var t, c, r;
|
|
423
|
+
if (((t = this.strategy) == null ? void 0 : t.overlay) === void 0)
|
|
424
|
+
return e;
|
|
425
|
+
const o = this.renderContainer(e);
|
|
426
|
+
return x(o, (c = this.strategy) == null ? void 0 : c.overlay, {
|
|
427
|
+
host: this
|
|
428
|
+
}), (r = this.strategy) == null ? void 0 : r.overlay;
|
|
429
|
+
}
|
|
430
|
+
get renderDescriptionSlot() {
|
|
431
|
+
return l`
|
|
432
|
+
<div id=${z}>
|
|
433
|
+
<slot name="description"></slot>
|
|
434
|
+
</div>
|
|
435
|
+
`;
|
|
436
|
+
}
|
|
437
|
+
// a helper to throw focus to the button is needed because Safari
|
|
438
|
+
// won't include buttons in the tab order even with tabindex="0"
|
|
439
|
+
render() {
|
|
440
|
+
return this.tooltipEl && (this.tooltipEl.disabled = this.open), l`
|
|
441
|
+
<span
|
|
442
|
+
id="focus-helper"
|
|
443
|
+
tabindex=${this.focused || this.open ? "-1" : "0"}
|
|
444
|
+
@focus=${this.handleHelperFocus}
|
|
445
|
+
aria-describedby=${z}
|
|
446
|
+
></span>
|
|
447
|
+
<button
|
|
448
|
+
aria-controls=${p(this.open ? "menu" : void 0)}
|
|
449
|
+
aria-describedby="tooltip"
|
|
450
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
451
|
+
aria-haspopup="true"
|
|
452
|
+
aria-labelledby="loader icon label applied-label"
|
|
453
|
+
id="button"
|
|
454
|
+
class=${p(
|
|
455
|
+
this.labelAlignment ? `label-${this.labelAlignment}` : void 0
|
|
456
|
+
)}
|
|
457
|
+
@blur=${this.handleButtonBlur}
|
|
458
|
+
@keydown=${{
|
|
459
|
+
handleEvent: this.handleEnterKeydown,
|
|
460
|
+
capture: !0
|
|
461
|
+
}}
|
|
462
|
+
?disabled=${this.disabled}
|
|
463
|
+
tabindex="-1"
|
|
464
|
+
>
|
|
465
|
+
${this.buttonContent}
|
|
466
|
+
</button>
|
|
467
|
+
${this.renderMenu} ${this.renderDescriptionSlot}
|
|
468
|
+
`;
|
|
469
|
+
}
|
|
470
|
+
update(e) {
|
|
471
|
+
var o, t;
|
|
472
|
+
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"), (o = this.deprecatedMenu) == null || o.toggleAttribute("ignore", !0), (t = this.deprecatedMenu) == null || t.setAttribute("selects", "inherit")), super.update(e);
|
|
473
|
+
}
|
|
474
|
+
bindButtonKeydownListener() {
|
|
475
|
+
this.button.addEventListener("keydown", this.handleKeydown);
|
|
476
|
+
}
|
|
477
|
+
updated(e) {
|
|
478
|
+
super.updated(e), e.has("open") && (this.strategy.open = this.open);
|
|
479
|
+
}
|
|
480
|
+
firstUpdated(e) {
|
|
481
|
+
super.firstUpdated(e), this.bindButtonKeydownListener(), this.bindEvents();
|
|
482
|
+
}
|
|
483
|
+
get dismissHelper() {
|
|
484
|
+
return l`
|
|
485
|
+
<div class="visually-hidden">
|
|
486
|
+
<button
|
|
487
|
+
tabindex="-1"
|
|
488
|
+
aria-label="Dismiss"
|
|
489
|
+
@click=${this.close}
|
|
490
|
+
></button>
|
|
491
|
+
</div>
|
|
492
|
+
`;
|
|
493
|
+
}
|
|
494
|
+
renderContainer(e) {
|
|
495
|
+
const o = l`
|
|
496
|
+
${this.dismissHelper} ${e} ${this.dismissHelper}
|
|
497
|
+
`;
|
|
498
|
+
return this.dependencyManager.add("luzmo-popover"), import("./popover/index.js"), l`
|
|
499
|
+
<luzmo-popover
|
|
500
|
+
id="popover"
|
|
501
|
+
size=${this.size}
|
|
502
|
+
role="presentation"
|
|
503
|
+
style=${$(this.containerStyles)}
|
|
504
|
+
placement=${this.placement}
|
|
505
|
+
>
|
|
506
|
+
${o}
|
|
507
|
+
</luzmo-popover>
|
|
508
|
+
`;
|
|
509
|
+
}
|
|
510
|
+
get renderMenu() {
|
|
511
|
+
const e = l`
|
|
512
|
+
<luzmo-menu
|
|
513
|
+
aria-labelledby="applied-label"
|
|
514
|
+
@change=${this.handleChange}
|
|
515
|
+
id="menu"
|
|
516
|
+
@keydown=${{
|
|
517
|
+
handleEvent: this.handleEnterKeydown,
|
|
518
|
+
capture: !0
|
|
519
|
+
}}
|
|
520
|
+
@scroll=${this.onScroll}
|
|
521
|
+
role=${this.listRole}
|
|
522
|
+
.selects=${this.selects}
|
|
523
|
+
.selected=${this.value ? [this.value] : []}
|
|
524
|
+
size=${this.size}
|
|
525
|
+
@luzmo-menu-item-added-or-updated=${this.shouldManageSelection}
|
|
526
|
+
>
|
|
527
|
+
<slot @slotchange=${this.shouldScheduleManageSelection}></slot>
|
|
528
|
+
</luzmo-menu>
|
|
529
|
+
`;
|
|
530
|
+
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;
|
|
531
|
+
}
|
|
532
|
+
shouldScheduleManageSelection(e) {
|
|
533
|
+
!this.willManageSelection && (!e || e.target.getRootNode().host === this) && (this.willManageSelection = !0, requestAnimationFrame(() => {
|
|
534
|
+
requestAnimationFrame(() => {
|
|
535
|
+
this.manageSelection();
|
|
536
|
+
});
|
|
537
|
+
}));
|
|
538
|
+
}
|
|
539
|
+
shouldManageSelection() {
|
|
540
|
+
this.willManageSelection || (this.willManageSelection = !0, this.manageSelection());
|
|
541
|
+
}
|
|
542
|
+
async manageSelection() {
|
|
543
|
+
if (this.selects == null)
|
|
544
|
+
return;
|
|
545
|
+
this.selectionPromise = new Promise(
|
|
546
|
+
(o) => this.selectionResolver = o
|
|
547
|
+
);
|
|
548
|
+
let e;
|
|
549
|
+
await this.optionsMenu.updateComplete, this.recentlyConnected && (await new Promise((o) => requestAnimationFrame(() => o(!0))), this.recentlyConnected = !1), this.menuItems.forEach((o) => {
|
|
550
|
+
this.value === o.value && !o.disabled ? e = o : o.selected = !1;
|
|
551
|
+
}), 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;
|
|
552
|
+
}
|
|
553
|
+
async getUpdateComplete() {
|
|
554
|
+
const e = await super.getUpdateComplete();
|
|
555
|
+
return await this.selectionPromise, e;
|
|
556
|
+
}
|
|
557
|
+
onScroll() {
|
|
558
|
+
this.dispatchEvent(
|
|
559
|
+
new Event("scroll", {
|
|
560
|
+
cancelable: !0,
|
|
561
|
+
composed: !0
|
|
562
|
+
})
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
a([
|
|
567
|
+
v()
|
|
568
|
+
], n.prototype, "appliedLabel", 2);
|
|
569
|
+
a([
|
|
570
|
+
b("#button")
|
|
571
|
+
], n.prototype, "button", 2);
|
|
572
|
+
a([
|
|
573
|
+
s({ type: Boolean, reflect: !0 })
|
|
574
|
+
], n.prototype, "disabled", 2);
|
|
575
|
+
a([
|
|
576
|
+
s({ type: Boolean, reflect: !0 })
|
|
577
|
+
], n.prototype, "focused", 2);
|
|
578
|
+
a([
|
|
579
|
+
s({ type: String, reflect: !0 })
|
|
580
|
+
], n.prototype, "icons", 2);
|
|
581
|
+
a([
|
|
582
|
+
s({ type: String, reflect: !0 })
|
|
583
|
+
], n.prototype, "variant", 2);
|
|
584
|
+
a([
|
|
585
|
+
s({ type: Boolean, reflect: !0 })
|
|
586
|
+
], n.prototype, "invalid", 2);
|
|
587
|
+
a([
|
|
588
|
+
s({ type: Boolean, reflect: !0 })
|
|
589
|
+
], n.prototype, "pending", 2);
|
|
590
|
+
a([
|
|
591
|
+
s({ type: String, attribute: "pending-label" })
|
|
592
|
+
], n.prototype, "pendingLabel", 2);
|
|
593
|
+
a([
|
|
594
|
+
s()
|
|
595
|
+
], n.prototype, "label", 2);
|
|
596
|
+
a([
|
|
597
|
+
s({ type: Boolean, reflect: !0 })
|
|
598
|
+
], n.prototype, "open", 2);
|
|
599
|
+
a([
|
|
600
|
+
s({ type: Boolean, reflect: !0 })
|
|
601
|
+
], n.prototype, "readonly", 2);
|
|
602
|
+
a([
|
|
603
|
+
v()
|
|
604
|
+
], n.prototype, "labelAlignment", 2);
|
|
605
|
+
a([
|
|
606
|
+
b("luzmo-menu")
|
|
607
|
+
], n.prototype, "optionsMenu", 2);
|
|
608
|
+
a([
|
|
609
|
+
b("luzmo-overlay")
|
|
610
|
+
], n.prototype, "overlayElement", 2);
|
|
611
|
+
a([
|
|
612
|
+
s()
|
|
613
|
+
], n.prototype, "placement", 2);
|
|
614
|
+
a([
|
|
615
|
+
s({ type: Boolean, reflect: !0 })
|
|
616
|
+
], n.prototype, "quiet", 2);
|
|
617
|
+
a([
|
|
618
|
+
s({ type: String })
|
|
619
|
+
], n.prototype, "value", 2);
|
|
620
|
+
a([
|
|
621
|
+
s({ attribute: !1 })
|
|
622
|
+
], n.prototype, "selectedItem", 1);
|
|
623
|
+
a([
|
|
624
|
+
v()
|
|
625
|
+
], n.prototype, "selectedItemContent", 1);
|
|
626
|
+
class ce extends n {
|
|
627
|
+
constructor() {
|
|
628
|
+
super(...arguments), this.handleKeydown = (e) => {
|
|
629
|
+
const { code: o } = e;
|
|
630
|
+
if (this.focused = !0, !o.startsWith("Arrow") || this.readonly || this.pending)
|
|
631
|
+
return;
|
|
632
|
+
if (o === "ArrowUp" || o === "ArrowDown") {
|
|
633
|
+
this.toggle(!0), e.preventDefault();
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
e.preventDefault();
|
|
637
|
+
const t = this.selectedItem ? this.menuItems.indexOf(this.selectedItem) : -1, c = t < 0 || o === "ArrowRight" ? 1 : -1;
|
|
638
|
+
let r = t + c;
|
|
639
|
+
for (; this.menuItems[r] && this.menuItems[r].disabled; )
|
|
640
|
+
r += c;
|
|
641
|
+
!this.menuItems[r] || this.menuItems[r].disabled || (!this.value || r !== t) && this.setValueFromItem(this.menuItems[r]);
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
static get styles() {
|
|
645
|
+
return [I(P)];
|
|
646
|
+
}
|
|
647
|
+
get containerStyles() {
|
|
648
|
+
const e = super.containerStyles;
|
|
649
|
+
return this.quiet || (e["min-width"] = `${this.offsetWidth}px`), e;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
export {
|
|
653
|
+
z as D,
|
|
654
|
+
n as L,
|
|
655
|
+
ce as a
|
|
656
|
+
};
|