@momentum-design/components 0.102.6 → 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.
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +3 -3
- package/dist/components/radio/radio.component.d.ts +0 -7
- package/dist/components/radio/radio.component.js +7 -17
- package/dist/components/select/select.component.js +12 -14
- package/dist/custom-elements.json +1778 -1814
- 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
@@ -4502,7 +4502,7 @@
|
|
4502
4502
|
:host::part(required-indicator) {
|
4503
4503
|
display: none;
|
4504
4504
|
}
|
4505
|
-
`,...xt(!0)],Df=ZE;var Eo=class extends Oe(re(Ee)){constructor(){super(...arguments);this.checked=!1;this.readonly=!1;this.autofocus=!1;this.renderLabelAndHelperText=()=>this.label?C`<div class="mdc-radio__label-container">${this.renderLabel()} ${this.renderHelperText()}</div>`:W}connectedCallback(){super.connectedCallback(),this.helpTextType=void 0}firstUpdated(){this.updateTabIndex()}getAllRadiosWithinSameGroup(){return Array.from(document.querySelectorAll(`mdc-radio[name="${this.name}"]`))}
|
4505
|
+
`,...xt(!0)],Df=ZE;var Eo=class extends Oe(re(Ee)){constructor(){super(...arguments);this.checked=!1;this.readonly=!1;this.autofocus=!1;this.renderLabelAndHelperText=()=>this.label?C`<div class="mdc-radio__label-container">${this.renderLabel()} ${this.renderHelperText()}</div>`:W}connectedCallback(){super.connectedCallback(),this.helpTextType=void 0}firstUpdated(){this.updateTabIndex()}getAllRadiosWithinSameGroup(){return Array.from(document.querySelectorAll(`mdc-radio[name="${this.name}"]`))}formResetCallback(){this.getAllRadiosWithinSameGroup().forEach(o=>{o.checked=!1}),this.updateComplete.then(()=>{this.setActualFormValue()}).catch(o=>{this.onerror&&this.onerror(o)})}formStateRestoreCallback(t){this.value===t&&t!==""&&(this.checked=!0)}setComponentValidity(t){t?this.internals.setValidity({}):this.required&&!this.checked&&(this.validationMessage?this.inputElement.setCustomValidity(this.validationMessage):this.inputElement.setCustomValidity(""),this.setValidity()),this.updateTabIndex()}setGroupValidity(t,o){this.updateComplete.then(()=>{t.forEach(a=>{a.setComponentValidity(o)})}).catch(a=>{this.onerror&&this.onerror(a)})}setActualFormValue(){let t="";this.checked?t=this.value?this.value:"on":t=null;let o=this.getAllRadiosWithinSameGroup();if(this.checked)this.setGroupValidity(o,!0);else{let a=o.some(T=>T.required),h=!!o.find(T=>T.checked),m=a&&!h;this.setGroupValidity(o,!m)}this.internals.setFormValue(t)}handleChange(){var a;if(this.disabled||this.readonly)return;this.getAllRadiosWithinSameGroup().forEach(h=>{var T;let m=(T=h.shadowRoot)==null?void 0:T.querySelector("input");m&&(h.checked=!1,m.checked=!1)}),this.checked=!0;let o=(a=this.shadowRoot)==null?void 0:a.querySelector("input");o&&(o.checked=!0),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}updateRadio(t,o){var a,h;(h=(a=t[o].shadowRoot)==null?void 0:a.querySelector("input"))==null||h.focus(),t[o].handleChange()}handleKeyDown(t){var m;if(this.disabled)return;let a=this.getAllRadiosWithinSameGroup().filter(T=>!T.disabled),h=a.indexOf(this);if(["ArrowDown","ArrowRight"].includes(t.key)){let T=(h+1)%a.length;this.updateRadio(a,T)}else if(["ArrowUp","ArrowLeft"].includes(t.key)){let T=(h-1+a.length)%a.length;this.updateRadio(a,T)}else t.key===J.SPACE&&this.updateRadio(a,h);this.updateTabIndex(),t.key===J.ENTER&&((m=this.form)==null||m.requestSubmit())}updateTabIndex(){let t=this.getAllRadiosWithinSameGroup(),o=t.find(h=>h.checked),a=t.find(h=>!h.disabled);t.forEach(h=>{var T;let m=(T=h.shadowRoot)==null?void 0:T.querySelector("input");m&&(m.tabIndex=-1,(h===o||!o&&h===a)&&(m.tabIndex=0))})}update(t){super.update(t),t.has("checked")&&this.setActualFormValue()}render(){var t;return C`
|
4506
4506
|
<mdc-staticradio
|
4507
4507
|
class="mdc-focus-ring"
|
4508
4508
|
?checked="${this.checked}"
|
@@ -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:{
|
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
|