@luzmo/lucero 0.0.18 → 0.0.20
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-menu/index.cjs +1 -1
- package/components/action-menu/index.js +1 -1
- package/components/date-time-picker/index.cjs +1 -1
- package/components/date-time-picker/index.js +1 -1
- package/components/index.cjs +1 -1
- package/components/index.js +107 -105
- package/components/multi-picker/index.cjs +127 -0
- package/components/multi-picker/index.d.ts +7 -0
- package/components/multi-picker/index.js +502 -0
- package/components/multi-picker/multi-picker.d.ts +158 -0
- package/components/picker/index.cjs +1 -1
- package/components/picker/index.js +2 -2
- package/components/picker-dwg8oHVQ.cjs +123 -0
- package/components/picker-h9eY75xS.js +460 -0
- package/components/{picker-BxEG2NdV.js → strategies-CzfvQU_H.js} +75 -511
- package/components/strategies-D_cIzAJE.cjs +18 -0
- package/custom-elements.json +1 -1
- package/index.d.ts +1 -0
- package/package.json +6 -1
- package/components/picker-DROquiIZ.cjs +0 -123
|
@@ -0,0 +1,127 @@
|
|
|
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../base-B7Pfl2if.cjs"),f=require("../state-C5I1gP3G.cjs"),g=require("../query-BL-TJj7K.cjs"),S=require("../class-map-Buyb1CLm.cjs"),p=require("../if-defined-B56xGmAg.cjs"),$=require("../style-map-uMq-yDJ3.cjs"),w=require("../focusable-DGWL1v1p.cjs"),I=require("../dependency-manger-C5HCkMMB.cjs"),d=require("../strategies-D_cIzAJE.cjs"),C=require("../pending-state-Do522lTd.cjs"),E=require("../sized-mixin-D9LkrMjb.cjs"),u=require("@luzmo/icons");require("../menu/index.cjs");require("../overlay/index.cjs");require("../progress-circle/index.cjs");require("../tooltip/index.cjs");var x=Object.defineProperty,L=Object.getOwnPropertyDescriptor,l=(c,e,t,i)=>{for(var o=i>1?void 0:i?L(e,t):e,a=c.length-1,r;a>=0;a--)(r=c[a])&&(o=(i?r(e,t,o):r(o))||o);return i&&o&&x(e,t,o),o};const q=()=>s.x`
|
|
19
|
+
<div class="disclosure-icon icon">
|
|
20
|
+
${u.luzmoIcon(u.luzmoAngleDown,{className:"indicator"})}
|
|
21
|
+
</div>
|
|
22
|
+
`,z=()=>s.x`
|
|
23
|
+
<div class="icon-container validation-icon icon">
|
|
24
|
+
${u.luzmoIcon(u.luzmoAlert)}
|
|
25
|
+
</div>
|
|
26
|
+
`,v="multi-option-picker";class n extends E.SizedMixin(w.Focusable,{noDefaultSize:!0}){constructor(){super(),this.disabled=!1,this.focused=!1,this.variant="checkmarks",this.invalid=!1,this.pending=!1,this.pendingLabel="Pending",this.multiItemLabel="items selected",this.open=!1,this.readonly=!1,this.placement="bottom-start",this.quiet=!1,this.value="",this.values=[],this.selects="multiple",this.dependencyManager=new I.DependencyManagerController(this),this.isMobile=new d.MatchMediaController(this,d.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=()=>q(),this.renderAlertIcon=()=>z(),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 C.PendingStateController(this)}get selectedItems(){return this._selectedItems}get buttonLabelContent(){return this._buttonLabelContent||{icon:[],content:[]}}get selfManageFocusElement(){return this._selfManageFocusElement}get menuItems(){return this.optionsMenu.childItems}set selectedItems(e){var o,a,r;const t=(o=e==null?void 0:e[0])==null?void 0:o.querySelector('[slot="icon"]');this.buttonLabelContent=((a=e??[])==null?void 0:a.length)>1?{icon:null,content:[s.x`<span class="count">${e==null?void 0:e.length}</span>
|
|
27
|
+
<span class="label">${this.multiItemLabel}</span>`]}:(r=e==null?void 0:e[0])==null?void 0:r.itemChildren;const i=this.selectedItems;this._selectedItems=e,this._selectedItemIcon=(t==null?void 0:t.icon)??void 0,this.requestUpdate("selectedItems",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;e.stopPropagation(),e.cancelable?this.setValuesFromItems(t.selectedItems,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 d.strategies.mobile(this.button,this):new d.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 setValuesFromItems(e,t){this.selects==="single"&&(this.open=!1,this.strategy&&(this.strategy.open=!1));const i=this.selectedItems,o=this.values;if(this.selectedItems=e,this.values=e.map(r=>r.value),await this.updateComplete,!this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,composed:!0,detail:this.values}))&&this.selects){t&&t.preventDefault(),this.selectedItems.forEach(r=>{this.setMenuItemSelected(r,!1)}),i&&i.forEach(r=>{this.setMenuItemSelected(r,!0)}),this.selectedItems=i,this.values=o,this.open=!0,this.strategy&&(this.strategy.open=!0);return}else if(!this.selects){this.selectedItems=i,this.values=o;return}i==null||i.forEach(r=>{this.setMenuItemSelected(r,!1)}),e.forEach(r=>{this.setMenuItemSelected(r,!!this.selects)})}setMenuItemSelected(e,t){this.selects!=null&&(e.selected=t)}get containerStyles(){return this.isMobile.matches?{"--swc-menu-width":"100%"}:{}}set buttonLabelContent(e){if(e===this.buttonLabelContent)return;const t=this.buttonLabelContent;this._buttonLabelContent=e,this.requestUpdate("buttonLabelContent",t)}handleTooltipSlotchange(e){this.tooltipEl=e.target.assignedElements()[0]}renderLabelContent(e){var t,i;return(t=this.values)!=null&&t.length&&((i=this.selectedItems)!=null&&i.length)?e:s.x`
|
|
28
|
+
<slot name="label" id="label">
|
|
29
|
+
<span aria-hidden=${p.o(this.appliedLabel?void 0:"true")}>
|
|
30
|
+
${this.label}
|
|
31
|
+
</span>
|
|
32
|
+
</slot>
|
|
33
|
+
`}get buttonContent(){var o,a,r,h,m,y,b;const e={"visually-hidden":this.icons==="only"&&((o=this.values)==null?void 0:o.length)>0,placeholder:!((a=this.values)!=null&&a.length),label:!0},t=this.appliedLabel||this.label,i=s.x` <div
|
|
34
|
+
id="icon"
|
|
35
|
+
?hidden=${this.icons==="none"||((r=this.values)==null?void 0:r.length)>1}
|
|
36
|
+
>
|
|
37
|
+
${this._selectedItemIcon?u.luzmoIcon(this._selectedItemIcon):s.E}
|
|
38
|
+
</div>`;return[s.x`
|
|
39
|
+
${this._selectedItemIcon?i:s.E}
|
|
40
|
+
<div
|
|
41
|
+
id=${p.o((h=this.values)!=null&&h.length&&((m=this.selectedItems)!=null&&m.length)?"label":void 0)}
|
|
42
|
+
class=${S.e(e)}
|
|
43
|
+
>
|
|
44
|
+
${this.renderLabelContent(this.buttonLabelContent.content)}
|
|
45
|
+
</div>
|
|
46
|
+
${(y=this.values)!=null&&y.length&&((b=this.selectedItems)!=null&&b.length)?s.x`
|
|
47
|
+
<div
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
class="visually-hidden"
|
|
50
|
+
id="applied-label"
|
|
51
|
+
>
|
|
52
|
+
${t}
|
|
53
|
+
<slot name="label"></slot>
|
|
54
|
+
</div>
|
|
55
|
+
`:s.x` <span hidden id="applied-label">${t}</span> `}
|
|
56
|
+
${this.invalid&&!this.pending?s.x` ${this.renderAlertIcon()} `:s.E}
|
|
57
|
+
${this.pendingStateController.renderPendingState()}
|
|
58
|
+
${this.readonly?s.E:this.renderAngleIcon()}
|
|
59
|
+
<slot
|
|
60
|
+
aria-hidden="true"
|
|
61
|
+
name="tooltip"
|
|
62
|
+
id="tooltip"
|
|
63
|
+
@slotchange=${this.handleTooltipSlotchange}
|
|
64
|
+
></slot>
|
|
65
|
+
`]}renderOverlay(e){var i,o,a;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}),(a=this.strategy)==null?void 0:a.overlay}get renderDescriptionSlot(){return s.x`
|
|
66
|
+
<div id=${v}>
|
|
67
|
+
<slot name="description"></slot>
|
|
68
|
+
</div>
|
|
69
|
+
`}render(){return this.tooltipEl&&(this.tooltipEl.disabled=this.open),s.x`
|
|
70
|
+
<span
|
|
71
|
+
id="focus-helper"
|
|
72
|
+
tabindex=${this.focused||this.open?"-1":"0"}
|
|
73
|
+
@focus=${this.handleHelperFocus}
|
|
74
|
+
aria-describedby=${v}
|
|
75
|
+
></span>
|
|
76
|
+
<button
|
|
77
|
+
aria-controls=${p.o(this.open?"menu":void 0)}
|
|
78
|
+
aria-describedby="tooltip"
|
|
79
|
+
aria-expanded=${this.open?"true":"false"}
|
|
80
|
+
aria-haspopup="true"
|
|
81
|
+
aria-labelledby="loader icon label applied-label"
|
|
82
|
+
id="button"
|
|
83
|
+
class=${p.o(this.labelAlignment?`label-${this.labelAlignment}`:void 0)}
|
|
84
|
+
@blur=${this.handleButtonBlur}
|
|
85
|
+
@keydown=${{handleEvent:this.handleEnterKeydown,capture:!0}}
|
|
86
|
+
?disabled=${this.disabled}
|
|
87
|
+
tabindex="-1"
|
|
88
|
+
>
|
|
89
|
+
${this.buttonContent}
|
|
90
|
+
</button>
|
|
91
|
+
${this.renderMenu} ${this.renderDescriptionSlot}
|
|
92
|
+
`}update(e){var t,i;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("values")&&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`
|
|
93
|
+
<div class="visually-hidden">
|
|
94
|
+
<button
|
|
95
|
+
tabindex="-1"
|
|
96
|
+
aria-label="Dismiss"
|
|
97
|
+
@click=${this.close}
|
|
98
|
+
></button>
|
|
99
|
+
</div>
|
|
100
|
+
`}renderContainer(e){const t=s.x`
|
|
101
|
+
${this.dismissHelper} ${e} ${this.dismissHelper}
|
|
102
|
+
`;return this.dependencyManager.add("luzmo-popover"),Promise.resolve().then(()=>require("../popover/index.cjs")),s.x`
|
|
103
|
+
<luzmo-popover
|
|
104
|
+
id="popover"
|
|
105
|
+
size=${this.size}
|
|
106
|
+
role="presentation"
|
|
107
|
+
style=${$.o(this.containerStyles)}
|
|
108
|
+
placement=${this.placement}
|
|
109
|
+
>
|
|
110
|
+
${t}
|
|
111
|
+
</luzmo-popover>
|
|
112
|
+
`}get renderMenu(){const e=s.x`
|
|
113
|
+
<luzmo-menu
|
|
114
|
+
aria-labelledby="applied-label"
|
|
115
|
+
@change=${this.handleChange}
|
|
116
|
+
id="menu"
|
|
117
|
+
@keydown=${{handleEvent:this.handleEnterKeydown,capture:!0}}
|
|
118
|
+
@scroll=${this.onScroll}
|
|
119
|
+
role=${this.listRole}
|
|
120
|
+
.selects=${this.selects}
|
|
121
|
+
.selected=${this.values??[]}
|
|
122
|
+
size=${this.size}
|
|
123
|
+
@luzmo-menu-item-added-or-updated=${this.shouldManageSelection}
|
|
124
|
+
>
|
|
125
|
+
<slot @slotchange=${this.shouldScheduleManageSelection}></slot>
|
|
126
|
+
</luzmo-menu>
|
|
127
|
+
`;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);const e=[];await this.optionsMenu.updateComplete,this.recentlyConnected&&(await new Promise(t=>requestAnimationFrame(()=>t(!0))),this.recentlyConnected=!1),this.menuItems.forEach(t=>{this.values.includes(t.value)&&!t.disabled?e==null||e.push(t):t.selected=!1}),e&&(e.forEach(t=>{t.selected=!!this.selects}),this.selectedItems=e),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([f.r()],n.prototype,"appliedLabel",2);l([g.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({type:String,attribute:"multi-item-label",reflect:!0})],n.prototype,"multiItemLabel",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([f.r()],n.prototype,"labelAlignment",2);l([g.e("luzmo-menu")],n.prototype,"optionsMenu",2);l([g.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({type:Array})],n.prototype,"values",2);l([s.n({attribute:!1})],n.prototype,"selectedItems",1);l([f.r()],n.prototype,"buttonLabelContent",1);l([s.n({type:String,reflect:!0})],n.prototype,"selects",2);class M extends n{constructor(){super(...arguments),this.handleKeydown=e=>{var i,o;const{code:t}=e;if(this.focused=!0,!(!t.startsWith("Arrow")||this.readonly||this.pending)){if(t==="ArrowUp"||t==="ArrowDown"){this.toggle(!0),e.preventDefault();return}if(e.preventDefault(),this.selects==="single"){const a=(i=this.selectedItems)!=null&&i.length?this.menuItems.indexOf(this.selectedItems[0]):-1,r=a<0||t==="ArrowRight"?1:-1;let h=a+r;for(;this.menuItems[h]&&this.menuItems[h].disabled;)h+=r;if(!this.menuItems[h]||this.menuItems[h].disabled)return;(!((o=this.values)!=null&&o.length)||h!==a)&&this.setValuesFromItems([this.menuItems[h]])}}}}static get styles(){return[s.r(d.pickerStyles)]}get containerStyles(){const e=super.containerStyles;return this.quiet||(e["min-width"]=`${this.offsetWidth}px`),e}}customElements.get("luzmo-multi-picker")||customElements.define("luzmo-multi-picker",M);exports.LuzmoMultiPicker=M;
|
|
@@ -0,0 +1,502 @@
|
|
|
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 u, E as c, B as S, r as $, n as a } from "../base-CawdqE7p.js";
|
|
19
|
+
import { r as m } from "../state-CYxk12SV.js";
|
|
20
|
+
import { e as f } from "../query-D_KR_GUc.js";
|
|
21
|
+
import { e as M } from "../class-map-CJko4aXp.js";
|
|
22
|
+
import { o as p } from "../if-defined-BSAr_4u4.js";
|
|
23
|
+
import { o as I } from "../style-map-Ct2LiEds.js";
|
|
24
|
+
import { F as C } from "../focusable-cj2QhwDT.js";
|
|
25
|
+
import { D as E } from "../dependency-manger-CEXvGQUV.js";
|
|
26
|
+
import { M as L, I as k, s as v, p as A } from "../strategies-CzfvQU_H.js";
|
|
27
|
+
import { P as D } from "../pending-state-TJj1x9xn.js";
|
|
28
|
+
import { S as F } from "../sized-mixin-BxMraZLS.js";
|
|
29
|
+
import { luzmoIcon as g, luzmoAngleDown as _, luzmoAlert as B } 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
|
+
const w = () => {
|
|
35
|
+
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
36
|
+
const h = document.createElement("style");
|
|
37
|
+
h.setAttribute("data-luzmo-vars", ""), h.textContent = 'html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-hard: #000;--luzmo-font-color-disabled: var(--luzmo-disabled-color);--luzmo-font-color-extra-dimmed: #888;--luzmo-font-color-hover: #333;--luzmo-font-color-down: #111;--luzmo-font-color-focus: #333;--luzmo-primary: #4434ff;--luzmo-primary-hover: #4234e4;--luzmo-primary-down: #392cc7;--luzmo-primary-focus: #4234e4;--luzmo-primary-inverse-color: #ffffff;--luzmo-primary-rgb: 68, 52, 255;--luzmo-secondary: #ff00ff;--luzmo-secondary-hover: #e309e3;--luzmo-secondary-down: #c711c7;--luzmo-secondary-focus: #e309e3;--luzmo-secondary-inverse-color: #ffffff;--luzmo-secondary-rgb: 255, 0, 255;--luzmo-negative-color: #ca221c;--luzmo-negative-color-hover: #b3241f;--luzmo-negative-color-down: #9f231f;--luzmo-negative-color-focus: #b3241f;--luzmo-negative-color-rgb: 202, 34, 28;--luzmo-positive-color: rgb(20, 150, 101);--luzmo-positive-color-hover: rgb(17, 128, 86);--luzmo-positive-color-down: rgb(16, 105, 71);--luzmo-positive-color-focus: rgb(17, 128, 86);--luzmo-positive-color-rgb: 20, 150, 101;--luzmo-selected-color: rgb(110, 110, 110);--luzmo-selected-color-hover: rgb(70, 70, 70);--luzmo-selected-color-down: rgb(40, 40, 40);--luzmo-selected-color-focus: rgb(70, 70, 70);--luzmo-selected-color-hard: #1e1e1e;--luzmo-selected-color-hard-hover: rgb(0, 0, 0);--luzmo-selected-color-hard-down: rgb(0, 0, 0);--luzmo-selected-color-hard-focus: rgb(0, 0, 0);--luzmo-informative-color: #1a77e9;--luzmo-informative-color-rgb: 26, 119, 233;--luzmo-disabled-color: #aaaaaa;--luzmo-spacing-1: 2px;--luzmo-spacing-2: 4px;--luzmo-spacing-3: 8px;--luzmo-spacing-4: 12px;--luzmo-spacing-5: 16px;--luzmo-indicator-gap: 2px;--luzmo-indicator-width: 1px;--luzmo-indicator-color: var(--luzmo-primary);--luzmo-component-height-xxs: 20px;--luzmo-component-height-xs: 24px;--luzmo-component-height-s: 28px;--luzmo-component-height: 32px;--luzmo-component-height-l: 40px;--luzmo-component-height-xl: 48px;--luzmo-component-height-xxl: 64px;--luzmo-icon-size-xxs: 12px;--luzmo-icon-size-xs: 14px;--luzmo-icon-size-s: 16px;--luzmo-icon-size-m: 18px;--luzmo-icon-size-l: 20px;--luzmo-icon-size-xl: 22px;--luzmo-icon-size-xxl: 32px}', document.head.appendChild(h);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
w();
|
|
41
|
+
var O = Object.defineProperty, P = Object.getOwnPropertyDescriptor, l = (h, e, t, o) => {
|
|
42
|
+
for (var i = o > 1 ? void 0 : o ? P(e, t) : e, r = h.length - 1, n; r >= 0; r--)
|
|
43
|
+
(n = h[r]) && (i = (o ? n(e, t, i) : n(i)) || i);
|
|
44
|
+
return o && i && O(e, t, i), i;
|
|
45
|
+
};
|
|
46
|
+
const R = () => u`
|
|
47
|
+
<div class="disclosure-icon icon">
|
|
48
|
+
${g(_, { className: "indicator" })}
|
|
49
|
+
</div>
|
|
50
|
+
`, q = () => u`
|
|
51
|
+
<div class="icon-container validation-icon icon">
|
|
52
|
+
${g(B)}
|
|
53
|
+
</div>
|
|
54
|
+
`, x = "multi-option-picker";
|
|
55
|
+
class s extends F(C, {
|
|
56
|
+
noDefaultSize: !0
|
|
57
|
+
}) {
|
|
58
|
+
/**
|
|
59
|
+
* Initializes the `PendingStateController` for the Picker component.
|
|
60
|
+
* The `PendingStateController` manages the pending state of the Picker.
|
|
61
|
+
*/
|
|
62
|
+
constructor() {
|
|
63
|
+
super(), this.disabled = !1, this.focused = !1, this.variant = "checkmarks", this.invalid = !1, this.pending = !1, this.pendingLabel = "Pending", this.multiItemLabel = "items selected", this.open = !1, this.readonly = !1, this.placement = "bottom-start", this.quiet = !1, this.value = "", this.values = [], this.selects = "multiple", this.dependencyManager = new E(this), this.isMobile = new L(this, k), 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) => {
|
|
64
|
+
}, this.applyFocusElementLabel = (e, t) => {
|
|
65
|
+
this.appliedLabel = e, this.labelAlignment = t.sideAligned ? "inline" : void 0;
|
|
66
|
+
}, this.handleKeydown = (e) => {
|
|
67
|
+
this.focused = !0, !(e.code !== "ArrowDown" && e.code !== "ArrowUp") && (e.stopPropagation(), e.preventDefault(), this.toggle(!0));
|
|
68
|
+
}, this.renderAngleIcon = () => R(), this.renderAlertIcon = () => q(), this.handleEnterKeydown = (e) => {
|
|
69
|
+
if (e.code === "Enter") {
|
|
70
|
+
if (this.enterKeydownOn) {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.enterKeydownOn = e.target, this.addEventListener(
|
|
75
|
+
"keyup",
|
|
76
|
+
(t) => {
|
|
77
|
+
t.code === "Enter" && (this.enterKeydownOn = null);
|
|
78
|
+
},
|
|
79
|
+
{ once: !0 }
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}, this.pendingStateController = new D(this);
|
|
83
|
+
}
|
|
84
|
+
get selectedItems() {
|
|
85
|
+
return this._selectedItems;
|
|
86
|
+
}
|
|
87
|
+
get buttonLabelContent() {
|
|
88
|
+
return this._buttonLabelContent || { icon: [], content: [] };
|
|
89
|
+
}
|
|
90
|
+
get selfManageFocusElement() {
|
|
91
|
+
return this._selfManageFocusElement;
|
|
92
|
+
}
|
|
93
|
+
get menuItems() {
|
|
94
|
+
return this.optionsMenu.childItems;
|
|
95
|
+
}
|
|
96
|
+
set selectedItems(e) {
|
|
97
|
+
var i, r, n;
|
|
98
|
+
const t = (i = e == null ? void 0 : e[0]) == null ? void 0 : i.querySelector('[slot="icon"]');
|
|
99
|
+
this.buttonLabelContent = ((r = e ?? []) == null ? void 0 : r.length) > 1 ? {
|
|
100
|
+
icon: null,
|
|
101
|
+
content: [
|
|
102
|
+
u`<span class="count">${e == null ? void 0 : e.length}</span>
|
|
103
|
+
<span class="label">${this.multiItemLabel}</span>`
|
|
104
|
+
]
|
|
105
|
+
} : (n = e == null ? void 0 : e[0]) == null ? void 0 : n.itemChildren;
|
|
106
|
+
const o = this.selectedItems;
|
|
107
|
+
this._selectedItems = e, this._selectedItemIcon = (t == null ? void 0 : t.icon) ?? void 0, this.requestUpdate("selectedItems", o);
|
|
108
|
+
}
|
|
109
|
+
get focusElement() {
|
|
110
|
+
return this.open ? this.optionsMenu : this.button;
|
|
111
|
+
}
|
|
112
|
+
forceFocusVisible() {
|
|
113
|
+
this.disabled || (this.focused = !0);
|
|
114
|
+
}
|
|
115
|
+
click() {
|
|
116
|
+
this.disabled || this.toggle();
|
|
117
|
+
}
|
|
118
|
+
handleButtonBlur() {
|
|
119
|
+
this.focused = !1;
|
|
120
|
+
}
|
|
121
|
+
focus(e) {
|
|
122
|
+
super.focus(e), !this.disabled && this.focusElement && (this.focused = this.hasVisibleFocusInTree());
|
|
123
|
+
}
|
|
124
|
+
handleHelperFocus() {
|
|
125
|
+
this.focused = !0, this.button.focus();
|
|
126
|
+
}
|
|
127
|
+
handleChange(e) {
|
|
128
|
+
this.strategy && (this.strategy.preventNextToggle = "no");
|
|
129
|
+
const t = e.target;
|
|
130
|
+
e.stopPropagation(), e.cancelable ? this.setValuesFromItems(t.selectedItems, e) : (this.open = !1, this.strategy && (this.strategy.open = !1));
|
|
131
|
+
}
|
|
132
|
+
handleButtonFocus(e) {
|
|
133
|
+
var t;
|
|
134
|
+
(t = this.strategy) == null || t.handleButtonFocus(e);
|
|
135
|
+
}
|
|
136
|
+
toggle(e) {
|
|
137
|
+
this.readonly || this.pending || (this.open = e === void 0 ? !this.open : e, this.strategy && (this.strategy.open = this.open), this._selfManageFocusElement = this.open);
|
|
138
|
+
}
|
|
139
|
+
close() {
|
|
140
|
+
this.readonly || this.strategy && (this.open = !1, this.strategy.open = !1);
|
|
141
|
+
}
|
|
142
|
+
bindEvents() {
|
|
143
|
+
var e;
|
|
144
|
+
(e = this.strategy) == null || e.abort(), this.strategy = this.isMobile.matches ? new v.mobile(this.button, this) : new v.desktop(this.button, this);
|
|
145
|
+
}
|
|
146
|
+
connectedCallback() {
|
|
147
|
+
super.connectedCallback(), this.recentlyConnected = this.hasUpdated;
|
|
148
|
+
}
|
|
149
|
+
disconnectedCallback() {
|
|
150
|
+
var e;
|
|
151
|
+
this.close(), (e = this.strategy) == null || e.releaseDescription(), super.disconnectedCallback();
|
|
152
|
+
}
|
|
153
|
+
async setValuesFromItems(e, t) {
|
|
154
|
+
this.selects === "single" && (this.open = !1, this.strategy && (this.strategy.open = !1));
|
|
155
|
+
const o = this.selectedItems, i = this.values;
|
|
156
|
+
if (this.selectedItems = e, this.values = e.map((n) => n.value), await this.updateComplete, !this.dispatchEvent(
|
|
157
|
+
new CustomEvent("change", {
|
|
158
|
+
bubbles: !0,
|
|
159
|
+
// Allow it to be prevented.
|
|
160
|
+
cancelable: !0,
|
|
161
|
+
composed: !0,
|
|
162
|
+
detail: this.values
|
|
163
|
+
})
|
|
164
|
+
) && this.selects) {
|
|
165
|
+
t && t.preventDefault(), this.selectedItems.forEach((n) => {
|
|
166
|
+
this.setMenuItemSelected(n, !1);
|
|
167
|
+
}), o && o.forEach((n) => {
|
|
168
|
+
this.setMenuItemSelected(n, !0);
|
|
169
|
+
}), this.selectedItems = o, this.values = i, this.open = !0, this.strategy && (this.strategy.open = !0);
|
|
170
|
+
return;
|
|
171
|
+
} else if (!this.selects) {
|
|
172
|
+
this.selectedItems = o, this.values = i;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
o == null || o.forEach((n) => {
|
|
176
|
+
this.setMenuItemSelected(n, !1);
|
|
177
|
+
}), e.forEach((n) => {
|
|
178
|
+
this.setMenuItemSelected(n, !!this.selects);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
setMenuItemSelected(e, t) {
|
|
182
|
+
this.selects != null && (e.selected = t);
|
|
183
|
+
}
|
|
184
|
+
get containerStyles() {
|
|
185
|
+
return this.isMobile.matches ? {
|
|
186
|
+
"--swc-menu-width": "100%"
|
|
187
|
+
} : {};
|
|
188
|
+
}
|
|
189
|
+
set buttonLabelContent(e) {
|
|
190
|
+
if (e === this.buttonLabelContent)
|
|
191
|
+
return;
|
|
192
|
+
const t = this.buttonLabelContent;
|
|
193
|
+
this._buttonLabelContent = e, this.requestUpdate("buttonLabelContent", t);
|
|
194
|
+
}
|
|
195
|
+
handleTooltipSlotchange(e) {
|
|
196
|
+
this.tooltipEl = e.target.assignedElements()[0];
|
|
197
|
+
}
|
|
198
|
+
renderLabelContent(e) {
|
|
199
|
+
var t, o;
|
|
200
|
+
return (t = this.values) != null && t.length && ((o = this.selectedItems) != null && o.length) ? e : u`
|
|
201
|
+
<slot name="label" id="label">
|
|
202
|
+
<span aria-hidden=${p(this.appliedLabel ? void 0 : "true")}>
|
|
203
|
+
${this.label}
|
|
204
|
+
</span>
|
|
205
|
+
</slot>
|
|
206
|
+
`;
|
|
207
|
+
}
|
|
208
|
+
get buttonContent() {
|
|
209
|
+
var i, r, n, d, b, y, z;
|
|
210
|
+
const e = {
|
|
211
|
+
"visually-hidden": this.icons === "only" && ((i = this.values) == null ? void 0 : i.length) > 0,
|
|
212
|
+
placeholder: !((r = this.values) != null && r.length),
|
|
213
|
+
label: !0
|
|
214
|
+
}, t = this.appliedLabel || this.label, o = u` <div
|
|
215
|
+
id="icon"
|
|
216
|
+
?hidden=${this.icons === "none" || ((n = this.values) == null ? void 0 : n.length) > 1}
|
|
217
|
+
>
|
|
218
|
+
${this._selectedItemIcon ? g(this._selectedItemIcon) : c}
|
|
219
|
+
</div>`;
|
|
220
|
+
return [
|
|
221
|
+
u`
|
|
222
|
+
${this._selectedItemIcon ? o : c}
|
|
223
|
+
<div
|
|
224
|
+
id=${p(
|
|
225
|
+
(d = this.values) != null && d.length && ((b = this.selectedItems) != null && b.length) ? "label" : void 0
|
|
226
|
+
)}
|
|
227
|
+
class=${M(e)}
|
|
228
|
+
>
|
|
229
|
+
${this.renderLabelContent(this.buttonLabelContent.content)}
|
|
230
|
+
</div>
|
|
231
|
+
${(y = this.values) != null && y.length && ((z = this.selectedItems) != null && z.length) ? u`
|
|
232
|
+
<div
|
|
233
|
+
aria-hidden="true"
|
|
234
|
+
class="visually-hidden"
|
|
235
|
+
id="applied-label"
|
|
236
|
+
>
|
|
237
|
+
${t}
|
|
238
|
+
<slot name="label"></slot>
|
|
239
|
+
</div>
|
|
240
|
+
` : u` <span hidden id="applied-label">${t}</span> `}
|
|
241
|
+
${this.invalid && !this.pending ? u` ${this.renderAlertIcon()} ` : c}
|
|
242
|
+
${this.pendingStateController.renderPendingState()}
|
|
243
|
+
${this.readonly ? c : this.renderAngleIcon()}
|
|
244
|
+
<slot
|
|
245
|
+
aria-hidden="true"
|
|
246
|
+
name="tooltip"
|
|
247
|
+
id="tooltip"
|
|
248
|
+
@slotchange=${this.handleTooltipSlotchange}
|
|
249
|
+
></slot>
|
|
250
|
+
`
|
|
251
|
+
];
|
|
252
|
+
}
|
|
253
|
+
renderOverlay(e) {
|
|
254
|
+
var o, i, r;
|
|
255
|
+
if (((o = this.strategy) == null ? void 0 : o.overlay) === void 0)
|
|
256
|
+
return e;
|
|
257
|
+
const t = this.renderContainer(e);
|
|
258
|
+
return S(t, (i = this.strategy) == null ? void 0 : i.overlay, {
|
|
259
|
+
host: this
|
|
260
|
+
}), (r = this.strategy) == null ? void 0 : r.overlay;
|
|
261
|
+
}
|
|
262
|
+
get renderDescriptionSlot() {
|
|
263
|
+
return u`
|
|
264
|
+
<div id=${x}>
|
|
265
|
+
<slot name="description"></slot>
|
|
266
|
+
</div>
|
|
267
|
+
`;
|
|
268
|
+
}
|
|
269
|
+
// a helper to throw focus to the button is needed because Safari
|
|
270
|
+
// won't include buttons in the tab order even with tabindex="0"
|
|
271
|
+
render() {
|
|
272
|
+
return this.tooltipEl && (this.tooltipEl.disabled = this.open), u`
|
|
273
|
+
<span
|
|
274
|
+
id="focus-helper"
|
|
275
|
+
tabindex=${this.focused || this.open ? "-1" : "0"}
|
|
276
|
+
@focus=${this.handleHelperFocus}
|
|
277
|
+
aria-describedby=${x}
|
|
278
|
+
></span>
|
|
279
|
+
<button
|
|
280
|
+
aria-controls=${p(this.open ? "menu" : void 0)}
|
|
281
|
+
aria-describedby="tooltip"
|
|
282
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
283
|
+
aria-haspopup="true"
|
|
284
|
+
aria-labelledby="loader icon label applied-label"
|
|
285
|
+
id="button"
|
|
286
|
+
class=${p(
|
|
287
|
+
this.labelAlignment ? `label-${this.labelAlignment}` : void 0
|
|
288
|
+
)}
|
|
289
|
+
@blur=${this.handleButtonBlur}
|
|
290
|
+
@keydown=${{
|
|
291
|
+
handleEvent: this.handleEnterKeydown,
|
|
292
|
+
capture: !0
|
|
293
|
+
}}
|
|
294
|
+
?disabled=${this.disabled}
|
|
295
|
+
tabindex="-1"
|
|
296
|
+
>
|
|
297
|
+
${this.buttonContent}
|
|
298
|
+
</button>
|
|
299
|
+
${this.renderMenu} ${this.renderDescriptionSlot}
|
|
300
|
+
`;
|
|
301
|
+
}
|
|
302
|
+
update(e) {
|
|
303
|
+
var t, o;
|
|
304
|
+
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("values") && this.shouldScheduleManageSelection(), this.hasUpdated || (this.deprecatedMenu = this.querySelector(":scope > luzmo-menu"), (t = this.deprecatedMenu) == null || t.toggleAttribute("ignore", !0), (o = this.deprecatedMenu) == null || o.setAttribute("selects", "inherit")), super.update(e);
|
|
305
|
+
}
|
|
306
|
+
bindButtonKeydownListener() {
|
|
307
|
+
this.button.addEventListener("keydown", this.handleKeydown);
|
|
308
|
+
}
|
|
309
|
+
updated(e) {
|
|
310
|
+
super.updated(e), e.has("open") && (this.strategy.open = this.open);
|
|
311
|
+
}
|
|
312
|
+
firstUpdated(e) {
|
|
313
|
+
super.firstUpdated(e), this.bindButtonKeydownListener(), this.bindEvents();
|
|
314
|
+
}
|
|
315
|
+
get dismissHelper() {
|
|
316
|
+
return u`
|
|
317
|
+
<div class="visually-hidden">
|
|
318
|
+
<button
|
|
319
|
+
tabindex="-1"
|
|
320
|
+
aria-label="Dismiss"
|
|
321
|
+
@click=${this.close}
|
|
322
|
+
></button>
|
|
323
|
+
</div>
|
|
324
|
+
`;
|
|
325
|
+
}
|
|
326
|
+
renderContainer(e) {
|
|
327
|
+
const t = u`
|
|
328
|
+
${this.dismissHelper} ${e} ${this.dismissHelper}
|
|
329
|
+
`;
|
|
330
|
+
return this.dependencyManager.add("luzmo-popover"), import("../popover/index.js"), u`
|
|
331
|
+
<luzmo-popover
|
|
332
|
+
id="popover"
|
|
333
|
+
size=${this.size}
|
|
334
|
+
role="presentation"
|
|
335
|
+
style=${I(this.containerStyles)}
|
|
336
|
+
placement=${this.placement}
|
|
337
|
+
>
|
|
338
|
+
${t}
|
|
339
|
+
</luzmo-popover>
|
|
340
|
+
`;
|
|
341
|
+
}
|
|
342
|
+
get renderMenu() {
|
|
343
|
+
const e = u`
|
|
344
|
+
<luzmo-menu
|
|
345
|
+
aria-labelledby="applied-label"
|
|
346
|
+
@change=${this.handleChange}
|
|
347
|
+
id="menu"
|
|
348
|
+
@keydown=${{
|
|
349
|
+
handleEvent: this.handleEnterKeydown,
|
|
350
|
+
capture: !0
|
|
351
|
+
}}
|
|
352
|
+
@scroll=${this.onScroll}
|
|
353
|
+
role=${this.listRole}
|
|
354
|
+
.selects=${this.selects}
|
|
355
|
+
.selected=${this.values ?? []}
|
|
356
|
+
size=${this.size}
|
|
357
|
+
@luzmo-menu-item-added-or-updated=${this.shouldManageSelection}
|
|
358
|
+
>
|
|
359
|
+
<slot @slotchange=${this.shouldScheduleManageSelection}></slot>
|
|
360
|
+
</luzmo-menu>
|
|
361
|
+
`;
|
|
362
|
+
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;
|
|
363
|
+
}
|
|
364
|
+
shouldScheduleManageSelection(e) {
|
|
365
|
+
!this.willManageSelection && (!e || e.target.getRootNode().host === this) && (this.willManageSelection = !0, requestAnimationFrame(() => {
|
|
366
|
+
requestAnimationFrame(() => {
|
|
367
|
+
this.manageSelection();
|
|
368
|
+
});
|
|
369
|
+
}));
|
|
370
|
+
}
|
|
371
|
+
shouldManageSelection() {
|
|
372
|
+
this.willManageSelection || (this.willManageSelection = !0, this.manageSelection());
|
|
373
|
+
}
|
|
374
|
+
async manageSelection() {
|
|
375
|
+
if (this.selects == null)
|
|
376
|
+
return;
|
|
377
|
+
this.selectionPromise = new Promise(
|
|
378
|
+
(t) => this.selectionResolver = t
|
|
379
|
+
);
|
|
380
|
+
const e = [];
|
|
381
|
+
await this.optionsMenu.updateComplete, this.recentlyConnected && (await new Promise((t) => requestAnimationFrame(() => t(!0))), this.recentlyConnected = !1), this.menuItems.forEach((t) => {
|
|
382
|
+
this.values.includes(t.value) && !t.disabled ? e == null || e.push(t) : t.selected = !1;
|
|
383
|
+
}), e && (e.forEach((t) => {
|
|
384
|
+
t.selected = !!this.selects;
|
|
385
|
+
}), this.selectedItems = e), this.open && (await this.optionsMenu.updateComplete, this.optionsMenu.updateSelectedItemIndex()), this.selectionResolver(), this.willManageSelection = !1;
|
|
386
|
+
}
|
|
387
|
+
async getUpdateComplete() {
|
|
388
|
+
const e = await super.getUpdateComplete();
|
|
389
|
+
return await this.selectionPromise, e;
|
|
390
|
+
}
|
|
391
|
+
onScroll() {
|
|
392
|
+
this.dispatchEvent(
|
|
393
|
+
new Event("scroll", {
|
|
394
|
+
cancelable: !0,
|
|
395
|
+
composed: !0
|
|
396
|
+
})
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
l([
|
|
401
|
+
m()
|
|
402
|
+
], s.prototype, "appliedLabel", 2);
|
|
403
|
+
l([
|
|
404
|
+
f("#button")
|
|
405
|
+
], s.prototype, "button", 2);
|
|
406
|
+
l([
|
|
407
|
+
a({ type: Boolean, reflect: !0 })
|
|
408
|
+
], s.prototype, "disabled", 2);
|
|
409
|
+
l([
|
|
410
|
+
a({ type: Boolean, reflect: !0 })
|
|
411
|
+
], s.prototype, "focused", 2);
|
|
412
|
+
l([
|
|
413
|
+
a({ type: String, reflect: !0 })
|
|
414
|
+
], s.prototype, "icons", 2);
|
|
415
|
+
l([
|
|
416
|
+
a({ type: String, reflect: !0 })
|
|
417
|
+
], s.prototype, "variant", 2);
|
|
418
|
+
l([
|
|
419
|
+
a({ type: Boolean, reflect: !0 })
|
|
420
|
+
], s.prototype, "invalid", 2);
|
|
421
|
+
l([
|
|
422
|
+
a({ type: Boolean, reflect: !0 })
|
|
423
|
+
], s.prototype, "pending", 2);
|
|
424
|
+
l([
|
|
425
|
+
a({ type: String, attribute: "pending-label" })
|
|
426
|
+
], s.prototype, "pendingLabel", 2);
|
|
427
|
+
l([
|
|
428
|
+
a({ type: String, attribute: "multi-item-label", reflect: !0 })
|
|
429
|
+
], s.prototype, "multiItemLabel", 2);
|
|
430
|
+
l([
|
|
431
|
+
a()
|
|
432
|
+
], s.prototype, "label", 2);
|
|
433
|
+
l([
|
|
434
|
+
a({ type: Boolean, reflect: !0 })
|
|
435
|
+
], s.prototype, "open", 2);
|
|
436
|
+
l([
|
|
437
|
+
a({ type: Boolean, reflect: !0 })
|
|
438
|
+
], s.prototype, "readonly", 2);
|
|
439
|
+
l([
|
|
440
|
+
m()
|
|
441
|
+
], s.prototype, "labelAlignment", 2);
|
|
442
|
+
l([
|
|
443
|
+
f("luzmo-menu")
|
|
444
|
+
], s.prototype, "optionsMenu", 2);
|
|
445
|
+
l([
|
|
446
|
+
f("luzmo-overlay")
|
|
447
|
+
], s.prototype, "overlayElement", 2);
|
|
448
|
+
l([
|
|
449
|
+
a()
|
|
450
|
+
], s.prototype, "placement", 2);
|
|
451
|
+
l([
|
|
452
|
+
a({ type: Boolean, reflect: !0 })
|
|
453
|
+
], s.prototype, "quiet", 2);
|
|
454
|
+
l([
|
|
455
|
+
a({ type: String })
|
|
456
|
+
], s.prototype, "value", 2);
|
|
457
|
+
l([
|
|
458
|
+
a({ type: Array })
|
|
459
|
+
], s.prototype, "values", 2);
|
|
460
|
+
l([
|
|
461
|
+
a({ attribute: !1 })
|
|
462
|
+
], s.prototype, "selectedItems", 1);
|
|
463
|
+
l([
|
|
464
|
+
m()
|
|
465
|
+
], s.prototype, "buttonLabelContent", 1);
|
|
466
|
+
l([
|
|
467
|
+
a({ type: String, reflect: !0 })
|
|
468
|
+
], s.prototype, "selects", 2);
|
|
469
|
+
class K extends s {
|
|
470
|
+
constructor() {
|
|
471
|
+
super(...arguments), this.handleKeydown = (e) => {
|
|
472
|
+
var o, i;
|
|
473
|
+
const { code: t } = e;
|
|
474
|
+
if (this.focused = !0, !(!t.startsWith("Arrow") || this.readonly || this.pending)) {
|
|
475
|
+
if (t === "ArrowUp" || t === "ArrowDown") {
|
|
476
|
+
this.toggle(!0), e.preventDefault();
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
if (e.preventDefault(), this.selects === "single") {
|
|
480
|
+
const r = (o = this.selectedItems) != null && o.length ? this.menuItems.indexOf(this.selectedItems[0]) : -1, n = r < 0 || t === "ArrowRight" ? 1 : -1;
|
|
481
|
+
let d = r + n;
|
|
482
|
+
for (; this.menuItems[d] && this.menuItems[d].disabled; )
|
|
483
|
+
d += n;
|
|
484
|
+
if (!this.menuItems[d] || this.menuItems[d].disabled)
|
|
485
|
+
return;
|
|
486
|
+
(!((i = this.values) != null && i.length) || d !== r) && this.setValuesFromItems([this.menuItems[d]]);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
static get styles() {
|
|
492
|
+
return [$(A)];
|
|
493
|
+
}
|
|
494
|
+
get containerStyles() {
|
|
495
|
+
const e = super.containerStyles;
|
|
496
|
+
return this.quiet || (e["min-width"] = `${this.offsetWidth}px`), e;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
customElements.get("luzmo-multi-picker") || customElements.define("luzmo-multi-picker", K);
|
|
500
|
+
export {
|
|
501
|
+
K as LuzmoMultiPicker
|
|
502
|
+
};
|