@momentum-design/components 0.102.7 → 0.102.8

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.
@@ -4693,7 +4693,7 @@
4693
4693
  :host([readonly])::part(icon-container) {
4694
4694
  color: var(--mdc-select-disabled-text-color);
4695
4695
  }
4696
- `,Bf=[rT,...xt(!0)];var ze=class extends Oe(re(Ee)){constructor(){super(...arguments);this.readonly=!1;this.height="auto";this.placement=Ut.BOTTOM_START;this.displayPopover=!1;this.initialSelectedOption=null}getAllValidOptions(){var t;return Array.from(((t=this.slottedListboxes[0])==null?void 0:t.querySelectorAll(gs))||[])}getFirstValidOption(){var t;return(t=this.slottedListboxes[0])==null?void 0:t.querySelector(gs)}getLastValidOption(){let t=this.getAllValidOptions();return t.length>0?t[t.length-1]:null}getFirstSelectedOption(){var t;return(t=this.slottedListboxes[0])==null?void 0:t.querySelector(`${gs}[selected]`)}async firstUpdated(){await this.updateComplete,this.modifyListBoxWrapper();let t=this.getFirstSelectedOption();if(t)this.initialSelectedOption=t,this.setSelectedOption(t);else if(this.placeholder)this.placeholder&&this.setInputValidity();else{let o=this.getFirstValidOption();this.setSelectedOption(o),this.fireEvents()}}updated(t){super.updated(t),(t.has("disabled")||t.has("softDisabled")||t.has("readonly"))&&(this.disabled||this.softDisabled||this.readonly)&&(this.displayPopover=!1),t.has("dataAriaLabel")&&this.modifyListBoxWrapper()}modifyListBoxWrapper(){let t=this.slottedListboxes[0];t&&(t.setAttribute("id",Od),t.setAttribute("aria-label",this.dataAriaLabel||""),t.setAttribute("aria-labelledby",Oa))}handleOptionsClick(t){this.setSelectedOption(t.target),this.displayPopover=!1,this.fireEvents()}setSelectedOption(t){var o,a;this.updateSelectedInChildOptions(t),this.updateTabIndexForAllOptions(t),this.selectedOption=t,this.value=(a=(o=this.selectedOption)==null?void 0:o.value)!=null?a:"",this.internals.setFormValue(this.value),this.inputElement.setAttribute("value",this.value),this.setInputValidity()}updateTabIndexForAllOptions(t){let o=this.getAllValidOptions(),a=t||o[0];o.forEach(h=>{h.setAttribute("tabindex",h===a?"0":"-1")})}updateSelectedInChildOptions(t){t==null||t.setAttribute("selected","true"),this.getAllValidOptions().forEach(a=>{a!==t&&a.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 o;let t=this.initialSelectedOption||null;((o=this.selectedOption)==null?void 0:o.value)!==(t==null?void 0:t.value)&&(this.setSelectedOption(t),this.fireEvents())}formStateRestoreCallback(t){var a;let o=this.getAllValidOptions().find(h=>h.value===t||h.label===t);((a=this.selectedOption)==null?void 0:a.value)!==(o==null?void 0:o.value)&&(this.setSelectedOption(o||null),this.fireEvents())}dispatchChange(t){this.dispatchEvent(new CustomEvent("change",{detail:{value:t==null?void 0:t.value,label:t==null?void 0:t.label},composed:!0,bubbles:!0}))}dispatchInput(t){this.dispatchEvent(new CustomEvent("input",{detail:{value:t==null?void 0:t.value,label:t==null?void 0:t.label},composed:!0,bubbles:!0}))}handleClickCombobox(t){this.disabled||this.softDisabled||this.readonly||(this.displayPopover=!this.displayPopover,t.stopPropagation())}handleKeydownCombobox(t){if(!(this.disabled||this.softDisabled||this.readonly))switch(t.key){case J.ARROW_DOWN:case J.ARROW_UP:this.displayPopover=!0,t.preventDefault(),t.stopPropagation();break;case J.ENTER:case J.SPACE:this.displayPopover=!0,t.preventDefault(),t.stopPropagation();break;case J.HOME:{this.displayPopover=!0;let o=this.getFirstValidOption();o&&(o==null||o.focus(),this.updateTabIndexForAllOptions(o)),t.preventDefault();break}case J.END:{this.displayPopover=!0;let o=this.getLastValidOption();o&&(o.focus(),this.updateTabIndexForAllOptions(o)),t.preventDefault();break}default:break}}handlePopoverKeydown(t){switch(t.key){case J.HOME:{let o=this.getFirstValidOption();this.focusAndUpdateTabIndexes(o),t.preventDefault();break}case J.END:{let o=this.getLastValidOption();this.focusAndUpdateTabIndexes(o),t.preventDefault();break}case J.ARROW_DOWN:{let o=this.getAllValidOptions(),a=o.findIndex(m=>m===t.target),h=Math.min(a+1,o.length-1);this.focusAndUpdateTabIndexes(o[h]),t.preventDefault();break}case J.ARROW_UP:{let o=this.getAllValidOptions(),a=o.findIndex(m=>m===t.target),h=Math.max(a-1,0);this.focusAndUpdateTabIndexes(o[h]),t.preventDefault();break}case J.PAGE_DOWN:{let o=this.getAllValidOptions(),a=o.findIndex(m=>m===t.target),h=Math.min(a+10,o.length-1);this.focusAndUpdateTabIndexes(o[h]),t.preventDefault();break}case J.PAGE_UP:{let o=this.getAllValidOptions(),a=o.findIndex(m=>m===t.target),h=Math.max(a-10,0);this.focusAndUpdateTabIndexes(o[h]),t.preventDefault();break}default:break}}focusAndUpdateTabIndexes(t){t&&(t.focus(),this.updateTabIndexForAllOptions(t))}handleNativeInputFocus(){this.visualCombobox.focus()}updateState(){var o;let t=this.getFirstSelectedOption();t?((o=this.selectedOption)==null?void 0:o.value)!==t.value&&this.setSelectedOption(t):this.setSelectedOption(this.placeholder?null:this.getFirstValidOption())}render(){var t,o,a,h,m,T;return C`
4696
+ `,Bf=[rT,...xt(!0)];var ze=class extends Oe(re(Ee)){constructor(){super(...arguments);this.readonly=!1;this.height="auto";this.placement=Ut.BOTTOM_START;this.displayPopover=!1;this.initialSelectedOption=null}getAllValidOptions(){var t;return Array.from(((t=this.slottedListboxes[0])==null?void 0:t.querySelectorAll(gs))||[])}getFirstValidOption(){var t;return(t=this.slottedListboxes[0])==null?void 0:t.querySelector(gs)}getLastValidOption(){let t=this.getAllValidOptions();return t.length>0?t[t.length-1]:null}getFirstSelectedOption(){var t;return(t=this.slottedListboxes[0])==null?void 0:t.querySelector(`${gs}[selected]`)}async firstUpdated(){await this.updateComplete,this.modifyListBoxWrapper();let t=this.getFirstSelectedOption();if(t)this.initialSelectedOption=t,this.setSelectedOption(t);else if(this.placeholder)this.placeholder&&this.setInputValidity();else{let o=this.getFirstValidOption();this.setSelectedOption(o),this.fireEvents()}}updated(t){super.updated(t),(t.has("disabled")||t.has("softDisabled")||t.has("readonly"))&&(this.disabled||this.softDisabled||this.readonly)&&(this.displayPopover=!1),t.has("dataAriaLabel")&&this.modifyListBoxWrapper()}modifyListBoxWrapper(){let t=this.slottedListboxes[0];t&&(t.setAttribute("id",Od),t.setAttribute("aria-label",this.dataAriaLabel||""),t.setAttribute("aria-labelledby",Oa))}handleOptionsClick(t){this.setSelectedOption(t.target),this.displayPopover=!1,this.fireEvents()}setSelectedOption(t){var o,a;this.updateSelectedInChildOptions(t),this.updateTabIndexForAllOptions(t),this.selectedOption=t,this.value=(a=(o=this.selectedOption)==null?void 0:o.value)!=null?a:"",this.internals.setFormValue(this.value),this.inputElement.setAttribute("value",this.value),this.setInputValidity()}updateTabIndexForAllOptions(t){let o=this.getAllValidOptions(),a=t||o[0];o.forEach(h=>{h.setAttribute("tabindex",h===a?"0":"-1")})}updateSelectedInChildOptions(t){t==null||t.setAttribute("selected","true"),this.getAllValidOptions().forEach(a=>{a!==t&&a.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 o;let t=this.initialSelectedOption||null;((o=this.selectedOption)==null?void 0:o.value)!==(t==null?void 0:t.value)&&(this.setSelectedOption(t),this.fireEvents())}formStateRestoreCallback(t){var a;let o=this.getAllValidOptions().find(h=>h.value===t||h.label===t);((a=this.selectedOption)==null?void 0:a.value)!==(o==null?void 0:o.value)&&(this.setSelectedOption(o||null),this.fireEvents())}dispatchChange(t){this.dispatchEvent(new CustomEvent("change",{detail:{value:t==null?void 0:t.value,label:t==null?void 0:t.label},composed:!0,bubbles:!0}))}dispatchInput(t){this.dispatchEvent(new CustomEvent("input",{detail:{value:t==null?void 0:t.value,label:t==null?void 0:t.label},composed:!0,bubbles:!0}))}handleClickCombobox(t){this.disabled||this.softDisabled||this.readonly||(this.displayPopover=!this.displayPopover,t.stopPropagation())}handleKeydownCombobox(t){if(!(this.disabled||this.softDisabled||this.readonly))switch(t.key){case J.ARROW_DOWN:case J.ARROW_UP:this.displayPopover=!0,t.preventDefault(),t.stopPropagation();break;case J.ENTER:case J.SPACE:this.displayPopover=!0,t.preventDefault(),t.stopPropagation();break;case J.HOME:{this.displayPopover=!0;let o=this.getFirstValidOption();o&&(o==null||o.focus(),this.updateTabIndexForAllOptions(o)),t.preventDefault();break}case J.END:{this.displayPopover=!0;let o=this.getLastValidOption();o&&(o.focus(),this.updateTabIndexForAllOptions(o)),t.preventDefault();break}default:break}}handlePopoverKeydown(t){let o=null;switch(t.key){case J.HOME:{o=this.getFirstValidOption();break}case J.END:{o=this.getLastValidOption();break}case J.ARROW_DOWN:{let a=this.getAllValidOptions(),h=a.findIndex(T=>T===t.target),m=Math.min(h+1,a.length-1);o=a[m];break}case J.ARROW_UP:{let a=this.getAllValidOptions(),h=a.findIndex(T=>T===t.target),m=Math.max(h-1,0);o=a[m];break}case J.PAGE_DOWN:{let a=this.getAllValidOptions(),h=a.findIndex(T=>T===t.target),m=Math.min(h+10,a.length-1);o=a[m];break}case J.PAGE_UP:{let a=this.getAllValidOptions(),h=a.findIndex(T=>T===t.target),m=Math.max(h-10,0);o=a[m];break}default:break}o&&(this.focusAndUpdateTabIndexes(o),t.preventDefault(),t.stopPropagation())}focusAndUpdateTabIndexes(t){t&&(t.focus(),this.updateTabIndexForAllOptions(t))}handleNativeInputFocus(){this.visualCombobox.focus()}updateState(){var o;let t=this.getFirstSelectedOption();t?((o=this.selectedOption)==null?void 0:o.value)!==t.value&&this.setSelectedOption(t):this.setSelectedOption(this.placeholder?null:this.getFirstValidOption())}render(){var t,o,a,h,m,T;return C`
4697
4697
  ${this.renderLabel()}
4698
4698
  <div part="container">
4699
4699
  <div