@luzmo/lucero 0.0.26 → 0.0.29
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/accordion/index.cjs +4 -4
- package/components/accordion/index.js +4 -4
- package/components/action-bar/index.cjs +1 -1
- package/components/action-bar/index.js +6 -6
- package/components/action-button/index.cjs +2 -2
- package/components/action-button/index.js +5 -5
- package/components/action-group/index.cjs +1 -1
- package/components/action-group/index.js +1 -1
- package/components/{action-group-DngGfcr_.js → action-group-DBImibFn.js} +2 -2
- package/components/{action-group-hy1HZxOi.cjs → action-group-DJGMcRHb.cjs} +1 -1
- package/components/action-menu/index.cjs +2 -2
- package/components/action-menu/index.js +6 -6
- package/components/{async-directive-B0s_zDWg.cjs → async-directive-BX1T1e1_.cjs} +1 -1
- package/components/{async-directive-C0KryStG.js → async-directive-BfcqVjDp.js} +1 -1
- package/components/avatar/index.cjs +3 -3
- package/components/avatar/index.js +10 -10
- package/components/base-CBCg3yyw.cjs +40 -0
- package/components/{base-DroC2Znx.js → base-WsynuqaS.js} +54 -51
- package/components/button/index.cjs +1 -1
- package/components/button/index.js +6 -6
- package/components/{button-base-BRZtaOk8.js → button-base-DbkDzb71.js} +4 -4
- package/components/{button-base-CJc7kjJK.cjs → button-base-XgPLmwP-.cjs} +1 -1
- package/components/button-group/index.cjs +1 -1
- package/components/button-group/index.js +2 -2
- package/components/calendar/index.cjs +1 -1
- package/components/calendar/index.js +1 -1
- package/components/checkbox/index.cjs +1 -1
- package/components/checkbox/index.js +4 -4
- package/components/{checkbox-mixin-CcPwhZst.cjs → checkbox-mixin-BDN0dBtS.cjs} +1 -1
- package/components/{checkbox-mixin-DbcpHFBw.js → checkbox-mixin-Do7EgtpQ.js} +2 -2
- package/components/{class-map-DuvNig0r.cjs → class-map-Di1D_rCm.cjs} +1 -1
- package/components/{class-map-CjcRhurN.js → class-map-NbVXqBU0.js} +1 -1
- package/components/{clear-button-Nwq4REOv.js → clear-button-DoeRUWQ3.js} +16 -16
- package/components/clear-button-Qi1pMA5S.cjs +18 -0
- package/components/close-button-BFMBEw3q.cjs +18 -0
- package/components/{close-button-9l1TxW7Y.cjs → close-button-BWXdHSx3.js} +34 -1
- package/components/color-area/index.cjs +1 -1
- package/components/color-area/index.js +3 -3
- package/components/color-field/index.cjs +1 -1
- package/components/color-field/index.js +2 -2
- package/components/color-handle/index.cjs +1 -1
- package/components/color-handle/index.js +2 -2
- package/components/color-loupe/index.cjs +1 -1
- package/components/color-loupe/index.js +1 -1
- package/components/{color-loupe-Ck2IRn4K.cjs → color-loupe-CaA_Lfkk.cjs} +1 -1
- package/components/{color-loupe-B0mH9Jyx.js → color-loupe-CmMsXbjT.js} +1 -1
- package/components/color-menu/index.cjs +4 -4
- package/components/color-menu/index.js +4 -4
- package/components/color-picker/index.cjs +1 -1
- package/components/color-picker/index.js +3 -3
- package/components/color-slider/index.cjs +1 -1
- package/components/color-slider/index.js +5 -5
- package/components/date-time-picker/index.cjs +3 -3
- package/components/date-time-picker/index.js +10 -10
- package/components/directive-helpers-Cm6gitnu.js +62 -0
- package/components/{directive-helpers-OG6wWKJt.js → directive-helpers-DyIRTWwA.cjs} +2 -8
- package/components/divider/index.cjs +1 -1
- package/components/divider/index.js +5 -5
- package/components/{divider.module-CXMNveQc.cjs → divider.module-DDvBo9zo.cjs} +1 -1
- package/components/{divider.module-DwOuLGU3.js → divider.module-DoQWQEIJ.js} +1 -1
- package/components/field-group/index.cjs +1 -1
- package/components/field-group/index.js +1 -1
- package/components/{field-group-ClxYbp6Z.js → field-group-DXfBWrkO.js} +2 -2
- package/components/{field-group-CIach2C_.cjs → field-group-DkGst3r5.cjs} +1 -1
- package/components/field-label/index.cjs +1 -1
- package/components/field-label/index.js +1 -1
- package/components/{field-label-BaOJ2i-l.js → field-label-CZ2zzChK.js} +2 -2
- package/components/{field-label-CkZCXvyb.cjs → field-label-mO1AkUgR.cjs} +1 -1
- package/components/flow-D-0MTYCm.js +527 -0
- package/components/flow-DM3dNAKs.cjs +30 -0
- package/components/{focusable-Dy9nRVST.js → focusable-BxtpnzWp.js} +1 -1
- package/components/{focusable-BW4I5ppi.cjs → focusable-EbipgXRh.cjs} +1 -1
- package/components/icon/index.cjs +1 -1
- package/components/icon/index.js +3 -3
- package/components/{if-defined-D7nbLM5n.cjs → if-defined-C9YGdo33.cjs} +1 -1
- package/components/{if-defined-CUCu7LSf.js → if-defined-DOaE2coe.js} +1 -1
- package/components/{index-C6wHQ74z.js → index-A-yOTB_d.js} +20 -20
- package/components/index-BLWuwZXx.cjs +113 -0
- package/components/index.cjs +1 -1
- package/components/index.js +132 -127
- package/components/infield-button/index.cjs +1 -1
- package/components/infield-button/index.js +3 -3
- package/components/label/index.cjs +1 -1
- package/components/label/index.js +1 -1
- package/components/{like-anchor-CkIPVvtI.js → like-anchor-Bvn_vLQ8.js} +2 -2
- package/components/{like-anchor-s-5FEzRQ.cjs → like-anchor-sod1C1fR.cjs} +1 -1
- package/components/luzmo-icons-DbwDQtuO.js +229 -0
- package/components/luzmo-icons-DletXGWU.cjs +29 -0
- package/components/{manage-help-text-DGwDhPtP.cjs → manage-help-text-DhgARkZX.cjs} +1 -1
- package/components/{manage-help-text-BzyCpgqN.js → manage-help-text-syYnjKGL.js} +2 -2
- package/components/menu/index.cjs +8 -8
- package/components/menu/index.js +19 -19
- package/components/multi-language-field/index.cjs +1 -1
- package/components/multi-language-field/index.js +3 -3
- package/components/number-field/index.cjs +3 -3
- package/components/number-field/index.js +10 -10
- package/components/{observe-slot-text-BMloiRX5.js → observe-slot-text-BPfIQQtz.js} +1 -1
- package/components/{observe-slot-text-BzdHQBH3.cjs → observe-slot-text-Ceb7SvYT.cjs} +1 -1
- package/components/options/index.cjs +104 -0
- package/components/options/index.d.ts +13 -0
- package/components/options/index.js +1172 -0
- package/components/options/option.d.ts +70 -0
- package/components/options/options-divider.d.ts +14 -0
- package/components/options/options.d.ts +85 -0
- package/components/overlay/index.cjs +4 -4
- package/components/overlay/index.js +8 -8
- package/components/{overlay-D4oZnKKd.js → overlay-BBNyvs8F.js} +4 -4
- package/components/{overlay-DAVu8dy8.cjs → overlay-o0tLxsk-.cjs} +1 -1
- package/components/{pending-state-xRhujC3J.js → pending-state-C5OtdXCm.js} +2 -2
- package/components/{pending-state-CkibRs0D.cjs → pending-state-gs6IxYtB.cjs} +1 -1
- package/components/picker/index.cjs +1 -1
- package/components/picker/index.js +2 -2
- package/components/picker/picker.d.ts +2 -2
- package/components/picker-CM3kN655.js +461 -0
- package/components/picker-C__p3kzA.cjs +123 -0
- package/components/picker-button/index.cjs +2 -2
- package/components/picker-button/index.js +6 -6
- package/components/popover/index.cjs +1 -1
- package/components/popover/index.js +1 -1
- package/components/{popover-Cx4MhaoE.js → popover-DjX0aAnY.js} +2 -2
- package/components/{popover-DBQ1YYW6.cjs → popover-KFfO0IYL.cjs} +1 -1
- package/components/progress-circle/index.cjs +1 -1
- package/components/progress-circle/index.js +1 -1
- package/components/{progress-circle-BGubjTvj.cjs → progress-circle-B12-2Gww.cjs} +1 -1
- package/components/{progress-circle-B25wyiBi.js → progress-circle-CWGsfHnp.js} +3 -3
- package/components/radio/index.cjs +1 -1
- package/components/radio/index.js +3 -3
- package/components/search/index.cjs +4 -4
- package/components/search/index.js +5 -5
- package/components/select/index.cjs +156 -0
- package/components/select/index.d.ts +7 -0
- package/components/select/index.js +580 -0
- package/components/{multi-picker/multi-picker.d.ts → select/select.d.ts} +83 -59
- package/components/{sized-mixin-CDhX3fJn.cjs → sized-mixin-CPxE5C96.cjs} +1 -1
- package/components/{sized-mixin-Y_QuYtjJ.js → sized-mixin-D4ACoVUr.js} +1 -1
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +2 -2
- package/components/{state-Bq6oXknJ.cjs → state-D8JEtYqe.cjs} +1 -1
- package/components/{state-BF7jO1DT.js → state-Deh-vKYE.js} +1 -1
- package/components/strategies-Bc3hG-HA.js +195 -0
- package/components/strategies-DGwsR7Xf.cjs +18 -0
- package/components/{streaming-listener-Cm6s-WvF.cjs → streaming-listener-B00MvALi.cjs} +1 -1
- package/components/{streaming-listener-Dxbr_Jiv.js → streaming-listener-CP-JE6Fa.js} +2 -2
- package/components/{style-map-Cp3I-AN3.cjs → style-map-CeilmSgs.cjs} +1 -1
- package/components/{style-map-DqptyE0A.js → style-map-IgqIKvlE.js} +1 -1
- package/components/swatch/index.cjs +2 -2
- package/components/swatch/index.js +11 -11
- package/components/switch/index.cjs +1 -1
- package/components/switch/index.js +4 -4
- package/components/tabs/index.cjs +5 -5
- package/components/tabs/index.js +10 -10
- package/components/tags/index.cjs +1 -1
- package/components/tags/index.js +3 -3
- package/components/text-field/index.cjs +2 -2
- package/components/text-field/index.js +8 -8
- package/components/{text-field-DWC0tpq4.js → text-field-BIADXoLC.js} +11 -11
- package/components/{text-field-CThL0T_y.cjs → text-field-D5d_Gt0t.cjs} +5 -5
- package/components/toast/index.cjs +4 -4
- package/components/toast/index.js +5 -5
- package/components/tooltip/index.cjs +1 -1
- package/components/tooltip/index.js +3 -3
- package/components/unit-input/index.cjs +3 -3
- package/components/unit-input/index.js +4 -4
- package/components/utils.cjs +1 -1
- package/components/utils.js +4 -4
- package/custom-elements.json +1 -1
- package/index.d.ts +2 -1
- package/package.json +11 -6
- package/{components/picker → utils/button-interaction-controllers}/interaction-controller.d.ts +6 -5
- package/{components/picker → utils/button-interaction-controllers}/mobile-controller.d.ts +2 -2
- package/components/base-CTSOJw6c.cjs +0 -40
- package/components/clear-button-BkQsOIoW.cjs +0 -18
- package/components/close-button-7ut4xT4f.js +0 -51
- package/components/directive-helpers-BQRjDUVe.cjs +0 -22
- package/components/index-CbaDCtQl.cjs +0 -113
- package/components/multi-picker/index.cjs +0 -127
- package/components/multi-picker/index.d.ts +0 -7
- package/components/multi-picker/index.js +0 -502
- package/components/picker-D0wr8mRN.js +0 -460
- package/components/picker-PMfW3n8Z.cjs +0 -123
- package/components/strategies-CzfvQU_H.js +0 -192
- package/components/strategies-D_cIzAJE.cjs +0 -18
- /package/{components/picker → utils/button-interaction-controllers}/desktop-controller.d.ts +0 -0
- /package/{components/picker → utils/button-interaction-controllers}/strategies.d.ts +0 -0
|
@@ -1,460 +0,0 @@
|
|
|
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 { x as r, E as h, B as b, r as v, n as a } from "./base-DroC2Znx.js";
|
|
19
|
-
import { r as p } from "./state-BF7jO1DT.js";
|
|
20
|
-
import { e as m } from "./query-D_KR_GUc.js";
|
|
21
|
-
import { e as I } from "./class-map-CjcRhurN.js";
|
|
22
|
-
import { o as c } from "./if-defined-CUCu7LSf.js";
|
|
23
|
-
import { o as $ } from "./style-map-DqptyE0A.js";
|
|
24
|
-
import { F as w } from "./focusable-Dy9nRVST.js";
|
|
25
|
-
import { D as S } from "./dependency-manger-CEXvGQUV.js";
|
|
26
|
-
import { M, I as C, s as y, p as E } from "./strategies-CzfvQU_H.js";
|
|
27
|
-
import { P as A } from "./pending-state-xRhujC3J.js";
|
|
28
|
-
import { S as D } from "./sized-mixin-Y_QuYtjJ.js";
|
|
29
|
-
import { luzmoIcon as f, luzmoAngleDown as z, luzmoAlert as _ } from "@luzmo/icons";
|
|
30
|
-
import "./menu/index.js";
|
|
31
|
-
import "./overlay/index.js";
|
|
32
|
-
import "./progress-circle/index.js";
|
|
33
|
-
import "./tooltip/index.js";
|
|
34
|
-
var F = Object.defineProperty, P = Object.getOwnPropertyDescriptor, n = (d, e, t, s) => {
|
|
35
|
-
for (var l = s > 1 ? void 0 : s ? P(e, t) : e, o = d.length - 1, u; o >= 0; o--)
|
|
36
|
-
(u = d[o]) && (l = (s ? u(e, t, l) : u(l)) || l);
|
|
37
|
-
return s && l && F(e, t, l), l;
|
|
38
|
-
};
|
|
39
|
-
const x = () => r`
|
|
40
|
-
<div class="disclosure-icon icon">
|
|
41
|
-
${f(z, { className: "indicator" })}
|
|
42
|
-
</div>
|
|
43
|
-
`, B = () => r`
|
|
44
|
-
<div class="icon-container validation-icon icon">
|
|
45
|
-
${f(_)}
|
|
46
|
-
</div>
|
|
47
|
-
`, g = "option-picker";
|
|
48
|
-
class i extends D(w, {
|
|
49
|
-
noDefaultSize: !0
|
|
50
|
-
}) {
|
|
51
|
-
/**
|
|
52
|
-
* Initializes the `PendingStateController` for the Picker component.
|
|
53
|
-
* The `PendingStateController` manages the pending state of the Picker.
|
|
54
|
-
*/
|
|
55
|
-
constructor() {
|
|
56
|
-
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 S(this), this.isMobile = new M(this, C), 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) => {
|
|
57
|
-
}, this.applyFocusElementLabel = (e, t) => {
|
|
58
|
-
this.appliedLabel = e, this.labelAlignment = t.sideAligned ? "inline" : void 0;
|
|
59
|
-
}, this.handleKeydown = (e) => {
|
|
60
|
-
this.focused = !0, !(e.code !== "ArrowDown" && e.code !== "ArrowUp") && (e.stopPropagation(), e.preventDefault(), this.toggle(!0));
|
|
61
|
-
}, this.renderAngleIcon = () => x(), this.renderAlertIcon = () => B(), this.handleEnterKeydown = (e) => {
|
|
62
|
-
if (e.code === "Enter") {
|
|
63
|
-
if (this.enterKeydownOn) {
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
this.enterKeydownOn = e.target, this.addEventListener(
|
|
68
|
-
"keyup",
|
|
69
|
-
(t) => {
|
|
70
|
-
t.code === "Enter" && (this.enterKeydownOn = null);
|
|
71
|
-
},
|
|
72
|
-
{ once: !0 }
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}, this.pendingStateController = new A(this);
|
|
76
|
-
}
|
|
77
|
-
get selectedItem() {
|
|
78
|
-
return this._selectedItem;
|
|
79
|
-
}
|
|
80
|
-
get selectedItemContent() {
|
|
81
|
-
return this._selectedItemContent || { icon: [], content: [] };
|
|
82
|
-
}
|
|
83
|
-
get selfManageFocusElement() {
|
|
84
|
-
return this._selfManageFocusElement;
|
|
85
|
-
}
|
|
86
|
-
get menuItems() {
|
|
87
|
-
return this.optionsMenu.childItems;
|
|
88
|
-
}
|
|
89
|
-
set selectedItem(e) {
|
|
90
|
-
const t = e == null ? void 0 : e.querySelector('[slot="icon"]');
|
|
91
|
-
if (this.selectedItemContent = e ? e.itemChildren : void 0, e === this.selectedItem)
|
|
92
|
-
return;
|
|
93
|
-
const s = this.selectedItem;
|
|
94
|
-
this._selectedItem = e, this._selectedItemIcon = (t == null ? void 0 : t.icon) ?? void 0, this.requestUpdate("selectedItem", s);
|
|
95
|
-
}
|
|
96
|
-
get focusElement() {
|
|
97
|
-
return this.open ? this.optionsMenu : this.button;
|
|
98
|
-
}
|
|
99
|
-
forceFocusVisible() {
|
|
100
|
-
this.disabled || (this.focused = !0);
|
|
101
|
-
}
|
|
102
|
-
click() {
|
|
103
|
-
this.disabled || this.toggle();
|
|
104
|
-
}
|
|
105
|
-
handleButtonBlur() {
|
|
106
|
-
this.focused = !1;
|
|
107
|
-
}
|
|
108
|
-
focus(e) {
|
|
109
|
-
super.focus(e), !this.disabled && this.focusElement && (this.focused = this.hasVisibleFocusInTree());
|
|
110
|
-
}
|
|
111
|
-
handleHelperFocus() {
|
|
112
|
-
this.focused = !0, this.button.focus();
|
|
113
|
-
}
|
|
114
|
-
handleChange(e) {
|
|
115
|
-
this.strategy && (this.strategy.preventNextToggle = "no");
|
|
116
|
-
const t = e.target, [s] = t.selectedItems;
|
|
117
|
-
e.stopPropagation(), e.cancelable ? this.setValueFromItem(s, e) : (this.open = !1, this.strategy && (this.strategy.open = !1));
|
|
118
|
-
}
|
|
119
|
-
handleButtonFocus(e) {
|
|
120
|
-
var t;
|
|
121
|
-
(t = this.strategy) == null || t.handleButtonFocus(e);
|
|
122
|
-
}
|
|
123
|
-
toggle(e) {
|
|
124
|
-
this.readonly || this.pending || (this.open = e === void 0 ? !this.open : e, this.strategy && (this.strategy.open = this.open), this._selfManageFocusElement = this.open);
|
|
125
|
-
}
|
|
126
|
-
close() {
|
|
127
|
-
this.readonly || this.strategy && (this.open = !1, this.strategy.open = !1);
|
|
128
|
-
}
|
|
129
|
-
bindEvents() {
|
|
130
|
-
var e;
|
|
131
|
-
(e = this.strategy) == null || e.abort(), this.strategy = this.isMobile.matches ? new y.mobile(this.button, this) : new y.desktop(this.button, this);
|
|
132
|
-
}
|
|
133
|
-
connectedCallback() {
|
|
134
|
-
super.connectedCallback(), this.recentlyConnected = this.hasUpdated;
|
|
135
|
-
}
|
|
136
|
-
disconnectedCallback() {
|
|
137
|
-
var e;
|
|
138
|
-
this.close(), (e = this.strategy) == null || e.releaseDescription(), super.disconnectedCallback();
|
|
139
|
-
}
|
|
140
|
-
async setValueFromItem(e, t) {
|
|
141
|
-
this.open = !1, this.strategy && (this.strategy.open = !1);
|
|
142
|
-
const s = this.selectedItem, l = this.value;
|
|
143
|
-
if (this.selectedItem = e, this.value = (e == null ? void 0 : e.value) ?? "", await this.updateComplete, !this.dispatchEvent(
|
|
144
|
-
new CustomEvent("change", {
|
|
145
|
-
bubbles: !0,
|
|
146
|
-
// Allow it to be prevented.
|
|
147
|
-
cancelable: !0,
|
|
148
|
-
composed: !0,
|
|
149
|
-
detail: this.value
|
|
150
|
-
})
|
|
151
|
-
) && this.selects) {
|
|
152
|
-
t && t.preventDefault(), this.setMenuItemSelected(this.selectedItem, !1), s && this.setMenuItemSelected(s, !0), this.selectedItem = s, this.value = l, this.open = !0, this.strategy && (this.strategy.open = !0);
|
|
153
|
-
return;
|
|
154
|
-
} else if (!this.selects) {
|
|
155
|
-
this.selectedItem = s, this.value = l;
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
s && this.setMenuItemSelected(s, !1), this.setMenuItemSelected(e, !!this.selects);
|
|
159
|
-
}
|
|
160
|
-
setMenuItemSelected(e, t) {
|
|
161
|
-
this.selects != null && (e.selected = t);
|
|
162
|
-
}
|
|
163
|
-
get containerStyles() {
|
|
164
|
-
return this.isMobile.matches ? {
|
|
165
|
-
"--swc-menu-width": "100%"
|
|
166
|
-
} : {};
|
|
167
|
-
}
|
|
168
|
-
set selectedItemContent(e) {
|
|
169
|
-
if (e === this.selectedItemContent)
|
|
170
|
-
return;
|
|
171
|
-
const t = this.selectedItemContent;
|
|
172
|
-
this._selectedItemContent = e, this.requestUpdate("selectedItemContent", t);
|
|
173
|
-
}
|
|
174
|
-
handleTooltipSlotchange(e) {
|
|
175
|
-
this.tooltipEl = e.target.assignedElements()[0];
|
|
176
|
-
}
|
|
177
|
-
renderLabelContent(e) {
|
|
178
|
-
return this.value && this.selectedItem ? e : r`
|
|
179
|
-
<slot name="label" id="label">
|
|
180
|
-
<span aria-hidden=${c(this.appliedLabel ? void 0 : "true")}>
|
|
181
|
-
${this.label}
|
|
182
|
-
</span>
|
|
183
|
-
</slot>
|
|
184
|
-
`;
|
|
185
|
-
}
|
|
186
|
-
get buttonContent() {
|
|
187
|
-
const e = {
|
|
188
|
-
"visually-hidden": this.icons === "only" && !!this.value,
|
|
189
|
-
placeholder: !this.value,
|
|
190
|
-
label: !0
|
|
191
|
-
}, t = this.appliedLabel || this.label, s = r` <div id="icon" ?hidden=${this.icons === "none"}>
|
|
192
|
-
${this._selectedItemIcon ? f(this._selectedItemIcon) : h}
|
|
193
|
-
</div>`;
|
|
194
|
-
return [
|
|
195
|
-
r`
|
|
196
|
-
${this._selectedItemIcon ? s : h}
|
|
197
|
-
<div
|
|
198
|
-
id=${c(this.value && this.selectedItem ? "label" : void 0)}
|
|
199
|
-
class=${I(e)}
|
|
200
|
-
>
|
|
201
|
-
${this.renderLabelContent(this.selectedItemContent.content)}
|
|
202
|
-
</div>
|
|
203
|
-
${this.value && this.selectedItem ? r`
|
|
204
|
-
<div
|
|
205
|
-
aria-hidden="true"
|
|
206
|
-
class="visually-hidden"
|
|
207
|
-
id="applied-label"
|
|
208
|
-
>
|
|
209
|
-
${t}
|
|
210
|
-
<slot name="label"></slot>
|
|
211
|
-
</div>
|
|
212
|
-
` : r` <span hidden id="applied-label">${t}</span> `}
|
|
213
|
-
${this.invalid && !this.pending ? r` ${this.renderAlertIcon()} ` : h}
|
|
214
|
-
${this.pendingStateController.renderPendingState()}
|
|
215
|
-
${this.readonly ? h : this.renderAngleIcon()}
|
|
216
|
-
<slot
|
|
217
|
-
aria-hidden="true"
|
|
218
|
-
name="tooltip"
|
|
219
|
-
id="tooltip"
|
|
220
|
-
@slotchange=${this.handleTooltipSlotchange}
|
|
221
|
-
></slot>
|
|
222
|
-
`
|
|
223
|
-
];
|
|
224
|
-
}
|
|
225
|
-
renderOverlay(e) {
|
|
226
|
-
var s, l, o;
|
|
227
|
-
if (((s = this.strategy) == null ? void 0 : s.overlay) === void 0)
|
|
228
|
-
return e;
|
|
229
|
-
const t = this.renderContainer(e);
|
|
230
|
-
return b(t, (l = this.strategy) == null ? void 0 : l.overlay, {
|
|
231
|
-
host: this
|
|
232
|
-
}), (o = this.strategy) == null ? void 0 : o.overlay;
|
|
233
|
-
}
|
|
234
|
-
get renderDescriptionSlot() {
|
|
235
|
-
return r`
|
|
236
|
-
<div id=${g}>
|
|
237
|
-
<slot name="description"></slot>
|
|
238
|
-
</div>
|
|
239
|
-
`;
|
|
240
|
-
}
|
|
241
|
-
// a helper to throw focus to the button is needed because Safari
|
|
242
|
-
// won't include buttons in the tab order even with tabindex="0"
|
|
243
|
-
render() {
|
|
244
|
-
return this.tooltipEl && (this.tooltipEl.disabled = this.open), r`
|
|
245
|
-
<span
|
|
246
|
-
id="focus-helper"
|
|
247
|
-
tabindex=${this.focused || this.open ? "-1" : "0"}
|
|
248
|
-
@focus=${this.handleHelperFocus}
|
|
249
|
-
aria-describedby=${g}
|
|
250
|
-
></span>
|
|
251
|
-
<button
|
|
252
|
-
aria-controls=${c(this.open ? "menu" : void 0)}
|
|
253
|
-
aria-describedby="tooltip"
|
|
254
|
-
aria-expanded=${this.open ? "true" : "false"}
|
|
255
|
-
aria-haspopup="true"
|
|
256
|
-
aria-labelledby="loader icon label applied-label"
|
|
257
|
-
id="button"
|
|
258
|
-
class=${c(
|
|
259
|
-
this.labelAlignment ? `label-${this.labelAlignment}` : void 0
|
|
260
|
-
)}
|
|
261
|
-
@blur=${this.handleButtonBlur}
|
|
262
|
-
@keydown=${{
|
|
263
|
-
handleEvent: this.handleEnterKeydown,
|
|
264
|
-
capture: !0
|
|
265
|
-
}}
|
|
266
|
-
?disabled=${this.disabled}
|
|
267
|
-
tabindex="-1"
|
|
268
|
-
>
|
|
269
|
-
${this.buttonContent}
|
|
270
|
-
</button>
|
|
271
|
-
${this.renderMenu} ${this.renderDescriptionSlot}
|
|
272
|
-
`;
|
|
273
|
-
}
|
|
274
|
-
update(e) {
|
|
275
|
-
var t, s;
|
|
276
|
-
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), (s = this.deprecatedMenu) == null || s.setAttribute("selects", "inherit")), super.update(e);
|
|
277
|
-
}
|
|
278
|
-
bindButtonKeydownListener() {
|
|
279
|
-
this.button.addEventListener("keydown", this.handleKeydown);
|
|
280
|
-
}
|
|
281
|
-
updated(e) {
|
|
282
|
-
super.updated(e), e.has("open") && (this.strategy.open = this.open);
|
|
283
|
-
}
|
|
284
|
-
firstUpdated(e) {
|
|
285
|
-
super.firstUpdated(e), this.bindButtonKeydownListener(), this.bindEvents();
|
|
286
|
-
}
|
|
287
|
-
get dismissHelper() {
|
|
288
|
-
return r`
|
|
289
|
-
<div class="visually-hidden">
|
|
290
|
-
<button
|
|
291
|
-
tabindex="-1"
|
|
292
|
-
aria-label="Dismiss"
|
|
293
|
-
@click=${this.close}
|
|
294
|
-
></button>
|
|
295
|
-
</div>
|
|
296
|
-
`;
|
|
297
|
-
}
|
|
298
|
-
renderContainer(e) {
|
|
299
|
-
const t = r`
|
|
300
|
-
${this.dismissHelper} ${e} ${this.dismissHelper}
|
|
301
|
-
`;
|
|
302
|
-
return this.dependencyManager.add("luzmo-popover"), import("./popover/index.js"), r`
|
|
303
|
-
<luzmo-popover
|
|
304
|
-
id="popover"
|
|
305
|
-
size=${this.size}
|
|
306
|
-
role="presentation"
|
|
307
|
-
style=${$(this.containerStyles)}
|
|
308
|
-
placement=${this.placement}
|
|
309
|
-
>
|
|
310
|
-
${t}
|
|
311
|
-
</luzmo-popover>
|
|
312
|
-
`;
|
|
313
|
-
}
|
|
314
|
-
get renderMenu() {
|
|
315
|
-
const e = r`
|
|
316
|
-
<luzmo-menu
|
|
317
|
-
aria-labelledby="applied-label"
|
|
318
|
-
@change=${this.handleChange}
|
|
319
|
-
id="menu"
|
|
320
|
-
@keydown=${{
|
|
321
|
-
handleEvent: this.handleEnterKeydown,
|
|
322
|
-
capture: !0
|
|
323
|
-
}}
|
|
324
|
-
@scroll=${this.onScroll}
|
|
325
|
-
role=${this.listRole}
|
|
326
|
-
.selects=${this.selects}
|
|
327
|
-
.selected=${this.value ? [this.value] : []}
|
|
328
|
-
size=${this.size}
|
|
329
|
-
@luzmo-menu-item-added-or-updated=${this.shouldManageSelection}
|
|
330
|
-
>
|
|
331
|
-
<slot @slotchange=${this.shouldScheduleManageSelection}></slot>
|
|
332
|
-
</luzmo-menu>
|
|
333
|
-
`;
|
|
334
|
-
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;
|
|
335
|
-
}
|
|
336
|
-
shouldScheduleManageSelection(e) {
|
|
337
|
-
!this.willManageSelection && (!e || e.target.getRootNode().host === this) && (this.willManageSelection = !0, requestAnimationFrame(() => {
|
|
338
|
-
requestAnimationFrame(() => {
|
|
339
|
-
this.manageSelection();
|
|
340
|
-
});
|
|
341
|
-
}));
|
|
342
|
-
}
|
|
343
|
-
shouldManageSelection() {
|
|
344
|
-
this.willManageSelection || (this.willManageSelection = !0, this.manageSelection());
|
|
345
|
-
}
|
|
346
|
-
async manageSelection() {
|
|
347
|
-
if (this.selects == null)
|
|
348
|
-
return;
|
|
349
|
-
this.selectionPromise = new Promise(
|
|
350
|
-
(t) => this.selectionResolver = t
|
|
351
|
-
);
|
|
352
|
-
let e;
|
|
353
|
-
await this.optionsMenu.updateComplete, this.recentlyConnected && (await new Promise((t) => requestAnimationFrame(() => t(!0))), this.recentlyConnected = !1), this.menuItems.forEach((t) => {
|
|
354
|
-
this.value === t.value && !t.disabled ? e = t : t.selected = !1;
|
|
355
|
-
}), 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;
|
|
356
|
-
}
|
|
357
|
-
async getUpdateComplete() {
|
|
358
|
-
const e = await super.getUpdateComplete();
|
|
359
|
-
return await this.selectionPromise, e;
|
|
360
|
-
}
|
|
361
|
-
onScroll() {
|
|
362
|
-
this.dispatchEvent(
|
|
363
|
-
new Event("scroll", {
|
|
364
|
-
cancelable: !0,
|
|
365
|
-
composed: !0
|
|
366
|
-
})
|
|
367
|
-
);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
n([
|
|
371
|
-
p()
|
|
372
|
-
], i.prototype, "appliedLabel", 2);
|
|
373
|
-
n([
|
|
374
|
-
m("#button")
|
|
375
|
-
], i.prototype, "button", 2);
|
|
376
|
-
n([
|
|
377
|
-
a({ type: Boolean, reflect: !0 })
|
|
378
|
-
], i.prototype, "disabled", 2);
|
|
379
|
-
n([
|
|
380
|
-
a({ type: Boolean, reflect: !0 })
|
|
381
|
-
], i.prototype, "focused", 2);
|
|
382
|
-
n([
|
|
383
|
-
a({ type: String, reflect: !0 })
|
|
384
|
-
], i.prototype, "icons", 2);
|
|
385
|
-
n([
|
|
386
|
-
a({ type: String, reflect: !0 })
|
|
387
|
-
], i.prototype, "variant", 2);
|
|
388
|
-
n([
|
|
389
|
-
a({ type: Boolean, reflect: !0 })
|
|
390
|
-
], i.prototype, "invalid", 2);
|
|
391
|
-
n([
|
|
392
|
-
a({ type: Boolean, reflect: !0 })
|
|
393
|
-
], i.prototype, "pending", 2);
|
|
394
|
-
n([
|
|
395
|
-
a({ type: String, attribute: "pending-label" })
|
|
396
|
-
], i.prototype, "pendingLabel", 2);
|
|
397
|
-
n([
|
|
398
|
-
a()
|
|
399
|
-
], i.prototype, "label", 2);
|
|
400
|
-
n([
|
|
401
|
-
a({ type: Boolean, reflect: !0 })
|
|
402
|
-
], i.prototype, "open", 2);
|
|
403
|
-
n([
|
|
404
|
-
a({ type: Boolean, reflect: !0 })
|
|
405
|
-
], i.prototype, "readonly", 2);
|
|
406
|
-
n([
|
|
407
|
-
p()
|
|
408
|
-
], i.prototype, "labelAlignment", 2);
|
|
409
|
-
n([
|
|
410
|
-
m("luzmo-menu")
|
|
411
|
-
], i.prototype, "optionsMenu", 2);
|
|
412
|
-
n([
|
|
413
|
-
m("luzmo-overlay")
|
|
414
|
-
], i.prototype, "overlayElement", 2);
|
|
415
|
-
n([
|
|
416
|
-
a()
|
|
417
|
-
], i.prototype, "placement", 2);
|
|
418
|
-
n([
|
|
419
|
-
a({ type: Boolean, reflect: !0 })
|
|
420
|
-
], i.prototype, "quiet", 2);
|
|
421
|
-
n([
|
|
422
|
-
a({ type: String })
|
|
423
|
-
], i.prototype, "value", 2);
|
|
424
|
-
n([
|
|
425
|
-
a({ attribute: !1 })
|
|
426
|
-
], i.prototype, "selectedItem", 1);
|
|
427
|
-
n([
|
|
428
|
-
p()
|
|
429
|
-
], i.prototype, "selectedItemContent", 1);
|
|
430
|
-
class X extends i {
|
|
431
|
-
constructor() {
|
|
432
|
-
super(...arguments), this.handleKeydown = (e) => {
|
|
433
|
-
const { code: t } = e;
|
|
434
|
-
if (this.focused = !0, !t.startsWith("Arrow") || this.readonly || this.pending)
|
|
435
|
-
return;
|
|
436
|
-
if (t === "ArrowUp" || t === "ArrowDown") {
|
|
437
|
-
this.toggle(!0), e.preventDefault();
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
e.preventDefault();
|
|
441
|
-
const s = this.selectedItem ? this.menuItems.indexOf(this.selectedItem) : -1, l = s < 0 || t === "ArrowRight" ? 1 : -1;
|
|
442
|
-
let o = s + l;
|
|
443
|
-
for (; this.menuItems[o] && this.menuItems[o].disabled; )
|
|
444
|
-
o += l;
|
|
445
|
-
!this.menuItems[o] || this.menuItems[o].disabled || (!this.value || o !== s) && this.setValueFromItem(this.menuItems[o]);
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
static get styles() {
|
|
449
|
-
return [v(E)];
|
|
450
|
-
}
|
|
451
|
-
get containerStyles() {
|
|
452
|
-
const e = super.containerStyles;
|
|
453
|
-
return this.quiet || (e["min-width"] = `${this.offsetWidth}px`), e;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
export {
|
|
457
|
-
g as D,
|
|
458
|
-
i as L,
|
|
459
|
-
X as a
|
|
460
|
-
};
|
|
@@ -1,123 +0,0 @@
|
|
|
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
|
-
"use strict";const s=require("./base-CTSOJw6c.cjs"),m=require("./state-Bq6oXknJ.cjs"),f=require("./query-BL-TJj7K.cjs"),y=require("./class-map-DuvNig0r.cjs"),c=require("./if-defined-D7nbLM5n.cjs"),g=require("./style-map-Cp3I-AN3.cjs"),b=require("./focusable-BW4I5ppi.cjs"),v=require("./dependency-manger-C5HCkMMB.cjs"),a=require("./strategies-D_cIzAJE.cjs"),I=require("./pending-state-CkibRs0D.cjs"),S=require("./sized-mixin-CDhX3fJn.cjs"),d=require("@luzmo/icons");require("./menu/index.cjs");require("./overlay/index.cjs");require("./progress-circle/index.cjs");require("./tooltip/index.cjs");var w=Object.defineProperty,M=Object.getOwnPropertyDescriptor,l=(h,e,t,i)=>{for(var o=i>1?void 0:i?M(e,t):e,r=h.length-1,u;r>=0;r--)(u=h[r])&&(o=(i?u(e,t,o):u(o))||o);return i&&o&&w(e,t,o),o};const $=()=>s.x`
|
|
19
|
-
<div class="disclosure-icon icon">
|
|
20
|
-
${d.luzmoIcon(d.luzmoAngleDown,{className:"indicator"})}
|
|
21
|
-
</div>
|
|
22
|
-
`,C=()=>s.x`
|
|
23
|
-
<div class="icon-container validation-icon icon">
|
|
24
|
-
${d.luzmoIcon(d.luzmoAlert)}
|
|
25
|
-
</div>
|
|
26
|
-
`,p="option-picker";class n extends S.SizedMixin(b.Focusable,{noDefaultSize:!0}){constructor(){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 v.DependencyManagerController(this),this.isMobile=new a.MatchMediaController(this,a.IS_MOBILE),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=>{},this.applyFocusElementLabel=(e,t)=>{this.appliedLabel=e,this.labelAlignment=t.sideAligned?"inline":void 0},this.handleKeydown=e=>{this.focused=!0,!(e.code!=="ArrowDown"&&e.code!=="ArrowUp")&&(e.stopPropagation(),e.preventDefault(),this.toggle(!0))},this.renderAngleIcon=()=>$(),this.renderAlertIcon=()=>C(),this.handleEnterKeydown=e=>{if(e.code==="Enter"){if(this.enterKeydownOn){e.preventDefault();return}this.enterKeydownOn=e.target,this.addEventListener("keyup",t=>{t.code==="Enter"&&(this.enterKeydownOn=null)},{once:!0})}},this.pendingStateController=new I.PendingStateController(this)}get selectedItem(){return this._selectedItem}get selectedItemContent(){return this._selectedItemContent||{icon:[],content:[]}}get selfManageFocusElement(){return this._selfManageFocusElement}get menuItems(){return this.optionsMenu.childItems}set selectedItem(e){const t=e==null?void 0:e.querySelector('[slot="icon"]');if(this.selectedItemContent=e?e.itemChildren:void 0,e===this.selectedItem)return;const i=this.selectedItem;this._selectedItem=e,this._selectedItemIcon=(t==null?void 0:t.icon)??void 0,this.requestUpdate("selectedItem",i)}get focusElement(){return this.open?this.optionsMenu:this.button}forceFocusVisible(){this.disabled||(this.focused=!0)}click(){this.disabled||this.toggle()}handleButtonBlur(){this.focused=!1}focus(e){super.focus(e),!this.disabled&&this.focusElement&&(this.focused=this.hasVisibleFocusInTree())}handleHelperFocus(){this.focused=!0,this.button.focus()}handleChange(e){this.strategy&&(this.strategy.preventNextToggle="no");const t=e.target,[i]=t.selectedItems;e.stopPropagation(),e.cancelable?this.setValueFromItem(i,e):(this.open=!1,this.strategy&&(this.strategy.open=!1))}handleButtonFocus(e){var t;(t=this.strategy)==null||t.handleButtonFocus(e)}toggle(e){this.readonly||this.pending||(this.open=e===void 0?!this.open:e,this.strategy&&(this.strategy.open=this.open),this._selfManageFocusElement=this.open)}close(){this.readonly||this.strategy&&(this.open=!1,this.strategy.open=!1)}bindEvents(){var e;(e=this.strategy)==null||e.abort(),this.strategy=this.isMobile.matches?new a.strategies.mobile(this.button,this):new a.strategies.desktop(this.button,this)}connectedCallback(){super.connectedCallback(),this.recentlyConnected=this.hasUpdated}disconnectedCallback(){var e;this.close(),(e=this.strategy)==null||e.releaseDescription(),super.disconnectedCallback()}async setValueFromItem(e,t){this.open=!1,this.strategy&&(this.strategy.open=!1);const i=this.selectedItem,o=this.value;if(this.selectedItem=e,this.value=(e==null?void 0:e.value)??"",await this.updateComplete,!this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,composed:!0,detail:this.value}))&&this.selects){t&&t.preventDefault(),this.setMenuItemSelected(this.selectedItem,!1),i&&this.setMenuItemSelected(i,!0),this.selectedItem=i,this.value=o,this.open=!0,this.strategy&&(this.strategy.open=!0);return}else if(!this.selects){this.selectedItem=i,this.value=o;return}i&&this.setMenuItemSelected(i,!1),this.setMenuItemSelected(e,!!this.selects)}setMenuItemSelected(e,t){this.selects!=null&&(e.selected=t)}get containerStyles(){return this.isMobile.matches?{"--swc-menu-width":"100%"}:{}}set selectedItemContent(e){if(e===this.selectedItemContent)return;const t=this.selectedItemContent;this._selectedItemContent=e,this.requestUpdate("selectedItemContent",t)}handleTooltipSlotchange(e){this.tooltipEl=e.target.assignedElements()[0]}renderLabelContent(e){return this.value&&this.selectedItem?e:s.x`
|
|
27
|
-
<slot name="label" id="label">
|
|
28
|
-
<span aria-hidden=${c.o(this.appliedLabel?void 0:"true")}>
|
|
29
|
-
${this.label}
|
|
30
|
-
</span>
|
|
31
|
-
</slot>
|
|
32
|
-
`}get buttonContent(){const e={"visually-hidden":this.icons==="only"&&!!this.value,placeholder:!this.value,label:!0},t=this.appliedLabel||this.label,i=s.x` <div id="icon" ?hidden=${this.icons==="none"}>
|
|
33
|
-
${this._selectedItemIcon?d.luzmoIcon(this._selectedItemIcon):s.E}
|
|
34
|
-
</div>`;return[s.x`
|
|
35
|
-
${this._selectedItemIcon?i:s.E}
|
|
36
|
-
<div
|
|
37
|
-
id=${c.o(this.value&&this.selectedItem?"label":void 0)}
|
|
38
|
-
class=${y.e(e)}
|
|
39
|
-
>
|
|
40
|
-
${this.renderLabelContent(this.selectedItemContent.content)}
|
|
41
|
-
</div>
|
|
42
|
-
${this.value&&this.selectedItem?s.x`
|
|
43
|
-
<div
|
|
44
|
-
aria-hidden="true"
|
|
45
|
-
class="visually-hidden"
|
|
46
|
-
id="applied-label"
|
|
47
|
-
>
|
|
48
|
-
${t}
|
|
49
|
-
<slot name="label"></slot>
|
|
50
|
-
</div>
|
|
51
|
-
`:s.x` <span hidden id="applied-label">${t}</span> `}
|
|
52
|
-
${this.invalid&&!this.pending?s.x` ${this.renderAlertIcon()} `:s.E}
|
|
53
|
-
${this.pendingStateController.renderPendingState()}
|
|
54
|
-
${this.readonly?s.E:this.renderAngleIcon()}
|
|
55
|
-
<slot
|
|
56
|
-
aria-hidden="true"
|
|
57
|
-
name="tooltip"
|
|
58
|
-
id="tooltip"
|
|
59
|
-
@slotchange=${this.handleTooltipSlotchange}
|
|
60
|
-
></slot>
|
|
61
|
-
`]}renderOverlay(e){var i,o,r;if(((i=this.strategy)==null?void 0:i.overlay)===void 0)return e;const t=this.renderContainer(e);return s.B(t,(o=this.strategy)==null?void 0:o.overlay,{host:this}),(r=this.strategy)==null?void 0:r.overlay}get renderDescriptionSlot(){return s.x`
|
|
62
|
-
<div id=${p}>
|
|
63
|
-
<slot name="description"></slot>
|
|
64
|
-
</div>
|
|
65
|
-
`}render(){return this.tooltipEl&&(this.tooltipEl.disabled=this.open),s.x`
|
|
66
|
-
<span
|
|
67
|
-
id="focus-helper"
|
|
68
|
-
tabindex=${this.focused||this.open?"-1":"0"}
|
|
69
|
-
@focus=${this.handleHelperFocus}
|
|
70
|
-
aria-describedby=${p}
|
|
71
|
-
></span>
|
|
72
|
-
<button
|
|
73
|
-
aria-controls=${c.o(this.open?"menu":void 0)}
|
|
74
|
-
aria-describedby="tooltip"
|
|
75
|
-
aria-expanded=${this.open?"true":"false"}
|
|
76
|
-
aria-haspopup="true"
|
|
77
|
-
aria-labelledby="loader icon label applied-label"
|
|
78
|
-
id="button"
|
|
79
|
-
class=${c.o(this.labelAlignment?`label-${this.labelAlignment}`:void 0)}
|
|
80
|
-
@blur=${this.handleButtonBlur}
|
|
81
|
-
@keydown=${{handleEvent:this.handleEnterKeydown,capture:!0}}
|
|
82
|
-
?disabled=${this.disabled}
|
|
83
|
-
tabindex="-1"
|
|
84
|
-
>
|
|
85
|
-
${this.buttonContent}
|
|
86
|
-
</button>
|
|
87
|
-
${this.renderMenu} ${this.renderDescriptionSlot}
|
|
88
|
-
`}update(e){var t,i;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),(i=this.deprecatedMenu)==null||i.setAttribute("selects","inherit")),super.update(e)}bindButtonKeydownListener(){this.button.addEventListener("keydown",this.handleKeydown)}updated(e){super.updated(e),e.has("open")&&(this.strategy.open=this.open)}firstUpdated(e){super.firstUpdated(e),this.bindButtonKeydownListener(),this.bindEvents()}get dismissHelper(){return s.x`
|
|
89
|
-
<div class="visually-hidden">
|
|
90
|
-
<button
|
|
91
|
-
tabindex="-1"
|
|
92
|
-
aria-label="Dismiss"
|
|
93
|
-
@click=${this.close}
|
|
94
|
-
></button>
|
|
95
|
-
</div>
|
|
96
|
-
`}renderContainer(e){const t=s.x`
|
|
97
|
-
${this.dismissHelper} ${e} ${this.dismissHelper}
|
|
98
|
-
`;return this.dependencyManager.add("luzmo-popover"),Promise.resolve().then(()=>require("./popover/index.cjs")),s.x`
|
|
99
|
-
<luzmo-popover
|
|
100
|
-
id="popover"
|
|
101
|
-
size=${this.size}
|
|
102
|
-
role="presentation"
|
|
103
|
-
style=${g.o(this.containerStyles)}
|
|
104
|
-
placement=${this.placement}
|
|
105
|
-
>
|
|
106
|
-
${t}
|
|
107
|
-
</luzmo-popover>
|
|
108
|
-
`}get renderMenu(){const e=s.x`
|
|
109
|
-
<luzmo-menu
|
|
110
|
-
aria-labelledby="applied-label"
|
|
111
|
-
@change=${this.handleChange}
|
|
112
|
-
id="menu"
|
|
113
|
-
@keydown=${{handleEvent:this.handleEnterKeydown,capture:!0}}
|
|
114
|
-
@scroll=${this.onScroll}
|
|
115
|
-
role=${this.listRole}
|
|
116
|
-
.selects=${this.selects}
|
|
117
|
-
.selected=${this.value?[this.value]:[]}
|
|
118
|
-
size=${this.size}
|
|
119
|
-
@luzmo-menu-item-added-or-updated=${this.shouldManageSelection}
|
|
120
|
-
>
|
|
121
|
-
<slot @slotchange=${this.shouldScheduleManageSelection}></slot>
|
|
122
|
-
</luzmo-menu>
|
|
123
|
-
`;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}shouldScheduleManageSelection(e){!this.willManageSelection&&(!e||e.target.getRootNode().host===this)&&(this.willManageSelection=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.manageSelection()})}))}shouldManageSelection(){this.willManageSelection||(this.willManageSelection=!0,this.manageSelection())}async manageSelection(){if(this.selects==null)return;this.selectionPromise=new Promise(t=>this.selectionResolver=t);let e;await this.optionsMenu.updateComplete,this.recentlyConnected&&(await new Promise(t=>requestAnimationFrame(()=>t(!0))),this.recentlyConnected=!1),this.menuItems.forEach(t=>{this.value===t.value&&!t.disabled?e=t:t.selected=!1}),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}async getUpdateComplete(){const e=await super.getUpdateComplete();return await this.selectionPromise,e}onScroll(){this.dispatchEvent(new Event("scroll",{cancelable:!0,composed:!0}))}}l([m.r()],n.prototype,"appliedLabel",2);l([f.e("#button")],n.prototype,"button",2);l([s.n({type:Boolean,reflect:!0})],n.prototype,"disabled",2);l([s.n({type:Boolean,reflect:!0})],n.prototype,"focused",2);l([s.n({type:String,reflect:!0})],n.prototype,"icons",2);l([s.n({type:String,reflect:!0})],n.prototype,"variant",2);l([s.n({type:Boolean,reflect:!0})],n.prototype,"invalid",2);l([s.n({type:Boolean,reflect:!0})],n.prototype,"pending",2);l([s.n({type:String,attribute:"pending-label"})],n.prototype,"pendingLabel",2);l([s.n()],n.prototype,"label",2);l([s.n({type:Boolean,reflect:!0})],n.prototype,"open",2);l([s.n({type:Boolean,reflect:!0})],n.prototype,"readonly",2);l([m.r()],n.prototype,"labelAlignment",2);l([f.e("luzmo-menu")],n.prototype,"optionsMenu",2);l([f.e("luzmo-overlay")],n.prototype,"overlayElement",2);l([s.n()],n.prototype,"placement",2);l([s.n({type:Boolean,reflect:!0})],n.prototype,"quiet",2);l([s.n({type:String})],n.prototype,"value",2);l([s.n({attribute:!1})],n.prototype,"selectedItem",1);l([m.r()],n.prototype,"selectedItemContent",1);class E extends n{constructor(){super(...arguments),this.handleKeydown=e=>{const{code:t}=e;if(this.focused=!0,!t.startsWith("Arrow")||this.readonly||this.pending)return;if(t==="ArrowUp"||t==="ArrowDown"){this.toggle(!0),e.preventDefault();return}e.preventDefault();const i=this.selectedItem?this.menuItems.indexOf(this.selectedItem):-1,o=i<0||t==="ArrowRight"?1:-1;let r=i+o;for(;this.menuItems[r]&&this.menuItems[r].disabled;)r+=o;!this.menuItems[r]||this.menuItems[r].disabled||(!this.value||r!==i)&&this.setValueFromItem(this.menuItems[r])}}static get styles(){return[s.r(a.pickerStyles)]}get containerStyles(){const e=super.containerStyles;return this.quiet||(e["min-width"]=`${this.offsetWidth}px`),e}}exports.DESCRIPTION_ID=p;exports.LuzmoPicker=E;exports.LuzmoPickerBase=n;
|