@momentum-design/components 0.95.2 → 0.95.4
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 +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/components/select/select.component.d.ts +7 -0
- package/dist/components/select/select.component.js +16 -0
- package/dist/components/select/select.types.d.ts +9 -7
- package/dist/custom-elements.json +468 -457
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/react/select/index.d.ts +2 -6
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
@@ -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
|