@momentum-design/components 0.95.3 → 0.95.5
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/dist/browser/index.js +5 -5
- package/dist/browser/index.js.map +3 -3
- package/dist/components/listitem/listitem.component.d.ts +2 -3
- package/dist/components/listitem/listitem.component.js +4 -5
- package/dist/components/select/select.component.d.ts +7 -0
- package/dist/components/select/select.component.js +16 -0
- package/dist/custom-elements.json +1491 -1480
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
@@ -3198,11 +3198,11 @@
|
|
3198
3198
|
display: flex;
|
3199
3199
|
flex-direction: row;
|
3200
3200
|
}
|
3201
|
-
`,Zm=[Hb,..._t()];var Jm=()=>`listitem-tooltip-popover-${je()}`,Qm=()=>`listitem-tooltip-triggerid-${je()}`;var io=class{static dispatchListItemEvent(i,e){e.dispatchEvent(new Event(i,{composed:!0,bubbles:!0}))}static onDisableListItem(i){this.dispatchListItemEvent("disabled",i)}static onEnableListItem(i){this.dispatchListItemEvent("enabled",i)}static onCreatedListItem(i){setTimeout(()=>this.dispatchListItemEvent("created",i),0)}static onDestroyedListItem(i){this.dispatchListItemEvent("destroyed",i)}};var be=class extends $t(gr(q)){constructor(){super();this.variant=Sc.VARIANT;this.tooltipPlacement=Sc.TOOLTIP_PLACEMENT;this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("focusin",this.displayTooltipForLongText),this.addEventListener("mouseenter",this.displayTooltipForLongText),this.addEventListener("focusout",this.hideTooltipOnLeave),this.addEventListener("mouseout",this.hideTooltipOnLeave),this.addEventListener("click",this.handleClick)}connectedCallback(){super.connectedCallback(),this.role=this.role||st.LISTITEM,this.id=this.id||Qm(),io.onCreatedListItem(this)}disconnectedCallback(){super.disconnectedCallback(),io.onDestroyedListItem(this)}handleKeyDown(e){(e.key===dt.ENTER||e.key===dt.SPACE)&&(this.triggerClickEvent(),e.preventDefault())}triggerClickEvent(){let e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});this.dispatchEvent(e)}handleClick(){this.hideTooltipOnLeave()}displayTooltipForLongText(){var s,n;if(!this.tooltipText)return;this.hideTooltipOnLeave();let e=document.createElement(Zs);e.id=Jm(),e.textContent=this.tooltipText,e.setAttribute("triggerid",this.id),e.setAttribute("placement",this.tooltipPlacement),e.setAttribute("visible",""),e.setAttribute("show-arrow",""),(s=this.parentElement)!=null&&s.hasAttribute("slot")&&e.setAttribute("slot",this.parentElement.getAttribute("slot")||""),(n=this.parentElement)==null||n.after(e)}hideTooltipOnLeave(){let e=document.querySelector(`${Zs}[triggerid="${this.id}"]`);e&&e.remove()}getText(e,s,n){return
|
3201
|
+
`,Zm=[Hb,..._t()];var Jm=()=>`listitem-tooltip-popover-${je()}`,Qm=()=>`listitem-tooltip-triggerid-${je()}`;var io=class{static dispatchListItemEvent(i,e){e.dispatchEvent(new Event(i,{composed:!0,bubbles:!0}))}static onDisableListItem(i){this.dispatchListItemEvent("disabled",i)}static onEnableListItem(i){this.dispatchListItemEvent("enabled",i)}static onCreatedListItem(i){setTimeout(()=>this.dispatchListItemEvent("created",i),0)}static onDestroyedListItem(i){this.dispatchListItemEvent("destroyed",i)}};var be=class extends $t(gr(q)){constructor(){super();this.variant=Sc.VARIANT;this.tooltipPlacement=Sc.TOOLTIP_PLACEMENT;this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("focusin",this.displayTooltipForLongText),this.addEventListener("mouseenter",this.displayTooltipForLongText),this.addEventListener("focusout",this.hideTooltipOnLeave),this.addEventListener("mouseout",this.hideTooltipOnLeave),this.addEventListener("click",this.handleClick)}connectedCallback(){super.connectedCallback(),this.role=this.role||st.LISTITEM,this.id=this.id||Qm(),io.onCreatedListItem(this)}disconnectedCallback(){super.disconnectedCallback(),io.onDestroyedListItem(this)}handleKeyDown(e){(e.key===dt.ENTER||e.key===dt.SPACE)&&(this.triggerClickEvent(),e.preventDefault())}triggerClickEvent(){let e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});this.dispatchEvent(e)}handleClick(){this.hideTooltipOnLeave()}displayTooltipForLongText(){var s,n;if(!this.tooltipText)return;this.hideTooltipOnLeave();let e=document.createElement(Zs);e.id=Jm(),e.textContent=this.tooltipText,e.setAttribute("triggerid",this.id),e.setAttribute("placement",this.tooltipPlacement),e.setAttribute("visible",""),e.setAttribute("show-arrow",""),(s=this.parentElement)!=null&&s.hasAttribute("slot")&&e.setAttribute("slot",this.parentElement.getAttribute("slot")||""),(n=this.parentElement)==null||n.after(e)}hideTooltipOnLeave(){let e=document.querySelector(`${Zs}[triggerid="${this.id}"]`);e&&e.remove()}getText(e,s,n){return M`
|
3202
3202
|
<slot name="${e}">
|
3203
|
-
|
3203
|
+
${n?M`<mdc-text part="${e}" type="${s}" tagname="${yt.SPAN}">${n}</mdc-text>`:Y}
|
3204
3204
|
</slot>
|
3205
|
-
|
3205
|
+
`}disableSlottedChildren(e=!1){[...this.leadingControlsSlot,...this.trailingControlsSlot].forEach(s=>{e?(s.setAttribute("disabled",""),io.onDisableListItem(this)):(s.removeAttribute("disabled"),io.onEnableListItem(this))}),this.setAttribute("aria-disabled",`${e}`)}update(e){super.update(e),e.has("disabled")&&(this.tabIndex=this.disabled?-1:0,this.disableSlottedChildren(this.disabled)),e.has("softDisabled")&&this.disableSlottedChildren(this.softDisabled)}renderTrailingControls(){return M`<slot
|
3206
3206
|
name="trailing-controls"
|
3207
3207
|
@click=${this.stopEventPropagation}
|
3208
3208
|
@keyup=${this.stopEventPropagation}
|
@@ -4361,7 +4361,7 @@
|
|
4361
4361
|
:host([readonly])::part(icon-container) {
|
4362
4362
|
color: var(--mdc-select-disabled-text-color);
|
4363
4363
|
}
|
4364
|
-
`,Gu=[wy,..._t(!0)];var De=class extends Le(jt(ve)){constructor(){super(...arguments);this.readonly=!1;this.height="auto";this.placement=Ut.BOTTOM_START;this.displayPopover=!1;this.initialSelectedOption=null}getAllValidOptions(){var e;return Array.from(((e=this.slottedListboxes[0])==null?void 0:e.querySelectorAll(ts))||[])}getFirstValidOption(){var e;return(e=this.slottedListboxes[0])==null?void 0:e.querySelector(ts)}getLastValidOption(){let e=this.getAllValidOptions();return e.length>0?e[e.length-1]:null}getFirstSelectedOption(){var e;return(e=this.slottedListboxes[0])==null?void 0:e.querySelector(`${ts}[selected]`)}async firstUpdated(){await this.updateComplete,this.modifyListBoxWrapper();let e=this.getFirstSelectedOption();if(e)this.initialSelectedOption=e,this.setSelectedOption(e);else if(this.placeholder)this.placeholder&&this.setInputValidity();else{let s=this.getFirstValidOption();this.setSelectedOption(s),this.fireEvents()}}updated(e){super.updated(e),(e.has("disabled")||e.has("softDisabled")||e.has("readonly"))&&(this.disabled||this.softDisabled||this.readonly)&&(this.displayPopover=!1),e.has("dataAriaLabel")&&this.modifyListBoxWrapper()}modifyListBoxWrapper(){let e=this.slottedListboxes[0];e&&(e.setAttribute("id",ed),e.setAttribute("aria-label",this.dataAriaLabel||""),e.setAttribute("aria-labelledby",ha))}handleOptionsClick(e){this.setSelectedOption(e.target),this.displayPopover=!1,this.fireEvents()}setSelectedOption(e){var s,n;this.updateSelectedInChildOptions(e),this.updateTabIndexForAllOptions(e),this.selectedOption=e,this.value=(n=(s=this.selectedOption)==null?void 0:s.value)!=null?n:"",this.internals.setFormValue(this.value),this.inputElement.setAttribute("value",this.value),this.setInputValidity()}updateTabIndexForAllOptions(e){let s=this.getAllValidOptions(),n=e||s[0];s.forEach(h=>{h.setAttribute("tabindex",h===n?"0":"-1")})}updateSelectedInChildOptions(e){e==null||e.setAttribute("selected","true"),this.getAllValidOptions().forEach(n=>{n!==e&&n.removeAttribute("selected")})}fireEvents(){this.dispatchInput(this.selectedOption),this.dispatchChange(this.selectedOption)}setInputValidity(){!this.selectedOption&&this.required&&this.validationMessage?this.inputElement.setCustomValidity(this.validationMessage):this.inputElement.setCustomValidity(""),this.setValidity()}formResetCallback(){var s;let e=this.initialSelectedOption||null;((s=this.selectedOption)==null?void 0:s.value)!==(e==null?void 0:e.value)&&(this.setSelectedOption(e),this.fireEvents())}formStateRestoreCallback(e){var n;let s=this.getAllValidOptions().find(h=>h.value===e||h.label===e);((n=this.selectedOption)==null?void 0:n.value)!==(s==null?void 0:s.value)&&(this.setSelectedOption(s||null),this.fireEvents())}dispatchChange(e){this.dispatchEvent(new CustomEvent("change",{detail:{value:e==null?void 0:e.value,label:e==null?void 0:e.label},composed:!0,bubbles:!0}))}dispatchInput(e){this.dispatchEvent(new CustomEvent("input",{detail:{value:e==null?void 0:e.value,label:e==null?void 0:e.label},composed:!0,bubbles:!0}))}handleClickCombobox(e){this.disabled||this.softDisabled||this.readonly||(this.displayPopover=!this.displayPopover,e.stopPropagation())}handleKeydownCombobox(e){if(!(this.disabled||this.softDisabled||this.readonly))switch(e.key){case dt.ARROW_DOWN:case dt.ARROW_UP:this.displayPopover=!0,e.preventDefault();break;case dt.ENTER:case dt.SPACE:this.displayPopover=!0,e.preventDefault(),e.stopPropagation();break;case dt.HOME:{this.displayPopover=!0;let s=this.getFirstValidOption();s&&(s==null||s.focus(),this.updateTabIndexForAllOptions(s)),e.preventDefault();break}case dt.END:{this.displayPopover=!0;let s=this.getLastValidOption();s&&(s.focus(),this.updateTabIndexForAllOptions(s)),e.preventDefault();break}default:break}}handlePopoverKeydown(e){switch(e.key){case dt.HOME:{let s=this.getFirstValidOption();this.focusAndUpdateTabIndexes(s),e.preventDefault();break}case dt.END:{let s=this.getLastValidOption();this.focusAndUpdateTabIndexes(s),e.preventDefault();break}case dt.ARROW_DOWN:{let s=this.getAllValidOptions(),n=s.findIndex(u=>u===e.target),h=Math.min(n+1,s.length-1);this.focusAndUpdateTabIndexes(s[h]),e.preventDefault();break}case dt.ARROW_UP:{let s=this.getAllValidOptions(),n=s.findIndex(u=>u===e.target),h=Math.max(n-1,0);this.focusAndUpdateTabIndexes(s[h]),e.preventDefault();break}case dt.PAGE_DOWN:{let s=this.getAllValidOptions(),n=s.findIndex(u=>u===e.target),h=Math.min(n+10,s.length-1);this.focusAndUpdateTabIndexes(s[h]),e.preventDefault();break}case dt.PAGE_UP:{let s=this.getAllValidOptions(),n=s.findIndex(u=>u===e.target),h=Math.max(n-10,0);this.focusAndUpdateTabIndexes(s[h]),e.preventDefault();break}default:break}}focusAndUpdateTabIndexes(e){e&&(e.focus(),this.updateTabIndexForAllOptions(e))}handleNativeInputFocus(){this.visualCombobox.focus()}render(){var e,s,n,h,u,T;return M`
|
4364
|
+
`,Gu=[wy,..._t(!0)];var De=class extends Le(jt(ve)){constructor(){super(...arguments);this.readonly=!1;this.height="auto";this.placement=Ut.BOTTOM_START;this.displayPopover=!1;this.initialSelectedOption=null}getAllValidOptions(){var e;return Array.from(((e=this.slottedListboxes[0])==null?void 0:e.querySelectorAll(ts))||[])}getFirstValidOption(){var e;return(e=this.slottedListboxes[0])==null?void 0:e.querySelector(ts)}getLastValidOption(){let e=this.getAllValidOptions();return e.length>0?e[e.length-1]:null}getFirstSelectedOption(){var e;return(e=this.slottedListboxes[0])==null?void 0:e.querySelector(`${ts}[selected]`)}async firstUpdated(){await this.updateComplete,this.modifyListBoxWrapper();let e=this.getFirstSelectedOption();if(e)this.initialSelectedOption=e,this.setSelectedOption(e);else if(this.placeholder)this.placeholder&&this.setInputValidity();else{let s=this.getFirstValidOption();this.setSelectedOption(s),this.fireEvents()}}updated(e){super.updated(e),(e.has("disabled")||e.has("softDisabled")||e.has("readonly"))&&(this.disabled||this.softDisabled||this.readonly)&&(this.displayPopover=!1),e.has("dataAriaLabel")&&this.modifyListBoxWrapper()}modifyListBoxWrapper(){let e=this.slottedListboxes[0];e&&(e.setAttribute("id",ed),e.setAttribute("aria-label",this.dataAriaLabel||""),e.setAttribute("aria-labelledby",ha))}handleOptionsClick(e){this.setSelectedOption(e.target),this.displayPopover=!1,this.fireEvents()}setSelectedOption(e){var s,n;this.updateSelectedInChildOptions(e),this.updateTabIndexForAllOptions(e),this.selectedOption=e,this.value=(n=(s=this.selectedOption)==null?void 0:s.value)!=null?n:"",this.internals.setFormValue(this.value),this.inputElement.setAttribute("value",this.value),this.setInputValidity()}updateTabIndexForAllOptions(e){let s=this.getAllValidOptions(),n=e||s[0];s.forEach(h=>{h.setAttribute("tabindex",h===n?"0":"-1")})}updateSelectedInChildOptions(e){e==null||e.setAttribute("selected","true"),this.getAllValidOptions().forEach(n=>{n!==e&&n.removeAttribute("selected")})}fireEvents(){this.dispatchInput(this.selectedOption),this.dispatchChange(this.selectedOption)}setInputValidity(){!this.selectedOption&&this.required&&this.validationMessage?this.inputElement.setCustomValidity(this.validationMessage):this.inputElement.setCustomValidity(""),this.setValidity()}formResetCallback(){var s;let e=this.initialSelectedOption||null;((s=this.selectedOption)==null?void 0:s.value)!==(e==null?void 0:e.value)&&(this.setSelectedOption(e),this.fireEvents())}formStateRestoreCallback(e){var n;let s=this.getAllValidOptions().find(h=>h.value===e||h.label===e);((n=this.selectedOption)==null?void 0:n.value)!==(s==null?void 0:s.value)&&(this.setSelectedOption(s||null),this.fireEvents())}dispatchChange(e){this.dispatchEvent(new CustomEvent("change",{detail:{value:e==null?void 0:e.value,label:e==null?void 0:e.label},composed:!0,bubbles:!0}))}dispatchInput(e){this.dispatchEvent(new CustomEvent("input",{detail:{value:e==null?void 0:e.value,label:e==null?void 0:e.label},composed:!0,bubbles:!0}))}handleClickCombobox(e){this.disabled||this.softDisabled||this.readonly||(this.displayPopover=!this.displayPopover,e.stopPropagation())}handleKeydownCombobox(e){if(!(this.disabled||this.softDisabled||this.readonly))switch(e.key){case dt.ARROW_DOWN:case dt.ARROW_UP:this.displayPopover=!0,e.preventDefault();break;case dt.ENTER:case dt.SPACE:this.displayPopover=!0,e.preventDefault(),e.stopPropagation();break;case dt.HOME:{this.displayPopover=!0;let s=this.getFirstValidOption();s&&(s==null||s.focus(),this.updateTabIndexForAllOptions(s)),e.preventDefault();break}case dt.END:{this.displayPopover=!0;let s=this.getLastValidOption();s&&(s.focus(),this.updateTabIndexForAllOptions(s)),e.preventDefault();break}default:break}}handlePopoverKeydown(e){switch(e.key){case dt.HOME:{let s=this.getFirstValidOption();this.focusAndUpdateTabIndexes(s),e.preventDefault();break}case dt.END:{let s=this.getLastValidOption();this.focusAndUpdateTabIndexes(s),e.preventDefault();break}case dt.ARROW_DOWN:{let s=this.getAllValidOptions(),n=s.findIndex(u=>u===e.target),h=Math.min(n+1,s.length-1);this.focusAndUpdateTabIndexes(s[h]),e.preventDefault();break}case dt.ARROW_UP:{let s=this.getAllValidOptions(),n=s.findIndex(u=>u===e.target),h=Math.max(n-1,0);this.focusAndUpdateTabIndexes(s[h]),e.preventDefault();break}case dt.PAGE_DOWN:{let s=this.getAllValidOptions(),n=s.findIndex(u=>u===e.target),h=Math.min(n+10,s.length-1);this.focusAndUpdateTabIndexes(s[h]),e.preventDefault();break}case dt.PAGE_UP:{let s=this.getAllValidOptions(),n=s.findIndex(u=>u===e.target),h=Math.max(n-10,0);this.focusAndUpdateTabIndexes(s[h]),e.preventDefault();break}default:break}}focusAndUpdateTabIndexes(e){e&&(e.focus(),this.updateTabIndexForAllOptions(e))}handleNativeInputFocus(){this.visualCombobox.focus()}updateState(){var s;let e=this.getFirstSelectedOption();e?((s=this.selectedOption)==null?void 0:s.value)!==e.value&&this.setSelectedOption(e):this.setSelectedOption(this.placeholder?null:this.getFirstValidOption())}render(){var e,s,n,h,u,T;return M`
|
4365
4365
|
${this.renderLabel()}
|
4366
4366
|
<div part="container">
|
4367
4367
|
<div
|
@@ -5147,7 +5147,7 @@
|
|
5147
5147
|
position: relative;
|
5148
5148
|
width: 100%;
|
5149
5149
|
}
|
5150
|
-
`],gf=Jy;var bf=j.constructTagName("virtualizedlist"),
|
5150
|
+
`],gf=Jy;var bf=j.constructTagName("virtualizedlist"),V3=j.constructTagName("virtualizedwrapper"),yf={VIRTUALIZER_PROPS:{count:0,estimateSize:()=>0}};var mo=class extends q{constructor(){super();this.virtualizerProps=yf.VIRTUALIZER_PROPS;this.scrollElementRef=en();this.virtualItems=[];this.virtualizerController=null,this.virtualizer=null,this.setlistdata=null,this.onscroll=null}update(e){super.update(e),e.get("virtualizerProps")&&this.setVirtualizerOptions()}firstUpdated(e){super.firstUpdated(e),this.setVirtualizerOptions()}setVirtualizerOptions(){var e;(e=this.virtualizer)==null||e.setOptions({...this.virtualizer.options,...this.virtualizerProps}),this.requestUpdate()}connectedCallback(){var e;this.virtualizerController=new il(this,{count:this.virtualizerProps.count,estimateSize:(e=this.virtualizerProps)==null?void 0:e.estimateSize,getScrollElement:()=>this.scrollElementRef.value||null,...this.virtualizerProps}),super.connectedCallback()}getVirtualizedListWrapper(e){var T,N;this.virtualizer=e.getVirtualizer();let{getTotalSize:s,getVirtualItems:n,measureElement:h}=this.virtualizer,u=n();if(u!==this.virtualItems){this.virtualItems=u;let $=n(),W={position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${(N=(T=$[0])==null?void 0:T.start)!=null?N:0}px)`};this.setlistdata&&this.setlistdata({virtualItems:$,measureElement:h,listStyle:W})}return M`<div part="container" style="height: ${s()}px;">
|
5151
5151
|
<slot></slot>
|
5152
5152
|
</div>`}render(){return M`<div ${rn(this.scrollElementRef)} part="scroll" @scroll=${this.onscroll&&this.onscroll}>
|
5153
5153
|
${this.virtualizerController?this.getVirtualizedListWrapper(this.virtualizerController):M``}
|