nve-designsystem 0.1.30 → 0.1.32
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/nve-designsystem.js +1 -1
- package/nve-designsystem.umd.cjs +1 -1
- package/package.json +1 -1
package/nve-designsystem.js
CHANGED
|
@@ -19074,7 +19074,7 @@ let Wt = class extends ei {
|
|
|
19074
19074
|
}
|
|
19075
19075
|
resetValidation() {
|
|
19076
19076
|
const t = this.getAllRadios();
|
|
19077
|
-
ko(t, !1, "data-invalid"), this.setCustomValidity(""), this.style.removeProperty("--radio-group-error-message");
|
|
19077
|
+
this.errorMessageCopy = "", ko(t, !1, "data-invalid"), this.setCustomValidity(""), this.style.removeProperty("--radio-group-error-message");
|
|
19078
19078
|
}
|
|
19079
19079
|
};
|
|
19080
19080
|
Wt.styles = [ei.styles, Ph];
|
package/nve-designsystem.umd.cjs
CHANGED
|
@@ -7926,7 +7926,7 @@
|
|
|
7926
7926
|
:host([vertical])::part(form-control-input) {
|
|
7927
7927
|
flex-direction: column;
|
|
7928
7928
|
}
|
|
7929
|
-
`;function ph(t,e){const r={waitUntilFirstUpdate:!1,...e};return(o,s)=>{const{update:i}=o,n=Array.isArray(t)?t:[t];o.update=function(d){n.forEach(c=>{const h=c;if(d.has(h)){const b=d.get(h),u=this[h];b!==u&&(!r.waitUntilFirstUpdate||this.hasUpdated)&&this[s](b,u)}}),i.call(this,d)}}}var fh=Object.defineProperty,bh=Object.getOwnPropertyDescriptor,he=(t,e,r,o)=>{for(var s=o>1?void 0:o?bh(e,r):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(s=(o?n(e,r,s):n(s))||s);return o&&s&&fh(e,r,s),s};g.NveRadioGroup=class extends As{constructor(){super(),this.orientation="vertical",this.disabled=!1,this.requiredLabel="*Obligatorisk",this.alreadyInvalid=!1,this.errorMessageCopy="",this.getAllRadios=function(){return[...this.querySelectorAll("sl-radio, sl-radio-button, nve-radio, nve-radio-button")]},this.handleRadioClick=function(e){const r=e.target.closest("sl-radio, sl-radio-button, nve-radio, nve-radio-button"),o=this.getAllRadios(),s=this.value;if(!r||r.disabled)return;const i=r.shadowRoot.querySelectorAll("span[part='base']");i.length>0&&i[0].focus(),this.value=r.value,o.forEach(n=>n.checked=n===r),this.value!==s&&(this.emit("sl-change"),this.emit("sl-input"))},this.syncRadioElements=async function(){var r,o,s;const e=this.getAllRadios();if(await Promise.all(e.map(async i=>{await i.updateComplete,i.checked=i.value===this.value,i.size=this.size})),this.hasButtonGroup=e.some(i=>i.tagName.toLowerCase()==="sl-radio-button"||i.tagName.toLowerCase()==="nve-radio-button"),!e.some(i=>i.checked))if(this.hasButtonGroup){const i=(r=e[0].shadowRoot)==null?void 0:r.querySelector("button");i&&(i.tabIndex=0)}else e[0].tabIndex=0;if(this.hasButtonGroup){const i=((o=this.shadowRoot)==null?void 0:o.querySelector("sl-button-group"))||((s=this.shadowRoot)==null?void 0:s.querySelector("nve-button-group"));i&&(i.disableRole=!0)}},this.syncRadios=function(){if(customElements.get("sl-radio")&&customElements.get("sl-radio-button")||customElements.get("nve-radio")&&customElements.get("nve-radio-button")){this.syncRadioElements();return}customElements.get("sl-radio")||customElements.get("nve-radio")?this.syncRadioElements():customElements.whenDefined("sl-radio").then(()=>this.syncRadios()),customElements.get("sl-radio-button")||customElements.get("nve-radio-button")?this.syncRadioElements():(customElements.whenDefined("sl-radio-button").then(()=>this.syncRadios()),customElements.whenDefined("nve-radio-button").then(()=>this.syncRadios()))}}connectedCallback(){super.connectedCallback(),this.errorMessageCopy=this.errorMessage||"",this.addEventListener("sl-invalid",e=>{e.preventDefault(),this.alreadyInvalid||this.makeInvalid()}),this.addEventListener("sl-change",this.resetValidation.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("sl-invalid",this.makeInvalid),this.removeEventListener("sl-change",this.resetValidation)}updated(e){super.updated(e),e.has("requiredLabel")&&this.style.setProperty("--sl-input-required-content",`"${this.requiredLabel}"`);const r=this.hasAttribute("data-user-invalid");r&&!this.alreadyInvalid&&this.makeInvalid(),r||this.resetValidation()}handlePropChange(e,r){const o=this.getAllRadios();return r!==e?(o.forEach(i=>{i.was_disabled===void 0?i.was_disabled=i.disabled:e===!0?i.disabled=i.was_disabled:(i.was_disabled=i.disabled,i.disabled=!0)}),!0):!1}makeInvalid(){const e=this.getAllRadios();$o(e,!0,"data-invalid"),this.errorMessageCopy||(this.errorMessageCopy=this.validationMessage),this.setCustomValidity(this.errorMessageCopy),this.style.setProperty("--radio-group-error-message",`"${this.errorMessageCopy}"`)}resetValidation(){const e=this.getAllRadios()
|
|
7929
|
+
`;function ph(t,e){const r={waitUntilFirstUpdate:!1,...e};return(o,s)=>{const{update:i}=o,n=Array.isArray(t)?t:[t];o.update=function(d){n.forEach(c=>{const h=c;if(d.has(h)){const b=d.get(h),u=this[h];b!==u&&(!r.waitUntilFirstUpdate||this.hasUpdated)&&this[s](b,u)}}),i.call(this,d)}}}var fh=Object.defineProperty,bh=Object.getOwnPropertyDescriptor,he=(t,e,r,o)=>{for(var s=o>1?void 0:o?bh(e,r):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(s=(o?n(e,r,s):n(s))||s);return o&&s&&fh(e,r,s),s};g.NveRadioGroup=class extends As{constructor(){super(),this.orientation="vertical",this.disabled=!1,this.requiredLabel="*Obligatorisk",this.alreadyInvalid=!1,this.errorMessageCopy="",this.getAllRadios=function(){return[...this.querySelectorAll("sl-radio, sl-radio-button, nve-radio, nve-radio-button")]},this.handleRadioClick=function(e){const r=e.target.closest("sl-radio, sl-radio-button, nve-radio, nve-radio-button"),o=this.getAllRadios(),s=this.value;if(!r||r.disabled)return;const i=r.shadowRoot.querySelectorAll("span[part='base']");i.length>0&&i[0].focus(),this.value=r.value,o.forEach(n=>n.checked=n===r),this.value!==s&&(this.emit("sl-change"),this.emit("sl-input"))},this.syncRadioElements=async function(){var r,o,s;const e=this.getAllRadios();if(await Promise.all(e.map(async i=>{await i.updateComplete,i.checked=i.value===this.value,i.size=this.size})),this.hasButtonGroup=e.some(i=>i.tagName.toLowerCase()==="sl-radio-button"||i.tagName.toLowerCase()==="nve-radio-button"),!e.some(i=>i.checked))if(this.hasButtonGroup){const i=(r=e[0].shadowRoot)==null?void 0:r.querySelector("button");i&&(i.tabIndex=0)}else e[0].tabIndex=0;if(this.hasButtonGroup){const i=((o=this.shadowRoot)==null?void 0:o.querySelector("sl-button-group"))||((s=this.shadowRoot)==null?void 0:s.querySelector("nve-button-group"));i&&(i.disableRole=!0)}},this.syncRadios=function(){if(customElements.get("sl-radio")&&customElements.get("sl-radio-button")||customElements.get("nve-radio")&&customElements.get("nve-radio-button")){this.syncRadioElements();return}customElements.get("sl-radio")||customElements.get("nve-radio")?this.syncRadioElements():customElements.whenDefined("sl-radio").then(()=>this.syncRadios()),customElements.get("sl-radio-button")||customElements.get("nve-radio-button")?this.syncRadioElements():(customElements.whenDefined("sl-radio-button").then(()=>this.syncRadios()),customElements.whenDefined("nve-radio-button").then(()=>this.syncRadios()))}}connectedCallback(){super.connectedCallback(),this.errorMessageCopy=this.errorMessage||"",this.addEventListener("sl-invalid",e=>{e.preventDefault(),this.alreadyInvalid||this.makeInvalid()}),this.addEventListener("sl-change",this.resetValidation.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("sl-invalid",this.makeInvalid),this.removeEventListener("sl-change",this.resetValidation)}updated(e){super.updated(e),e.has("requiredLabel")&&this.style.setProperty("--sl-input-required-content",`"${this.requiredLabel}"`);const r=this.hasAttribute("data-user-invalid");r&&!this.alreadyInvalid&&this.makeInvalid(),r||this.resetValidation()}handlePropChange(e,r){const o=this.getAllRadios();return r!==e?(o.forEach(i=>{i.was_disabled===void 0?i.was_disabled=i.disabled:e===!0?i.disabled=i.was_disabled:(i.was_disabled=i.disabled,i.disabled=!0)}),!0):!1}makeInvalid(){const e=this.getAllRadios();$o(e,!0,"data-invalid"),this.errorMessageCopy||(this.errorMessageCopy=this.validationMessage),this.setCustomValidity(this.errorMessageCopy),this.style.setProperty("--radio-group-error-message",`"${this.errorMessageCopy}"`)}resetValidation(){const e=this.getAllRadios();this.errorMessageCopy="",$o(e,!1,"data-invalid"),this.setCustomValidity(""),this.style.removeProperty("--radio-group-error-message")}},g.NveRadioGroup.styles=[As.styles,uh],he([l({reflect:!0})],g.NveRadioGroup.prototype,"orientation",2),he([l({type:Boolean,reflect:!0})],g.NveRadioGroup.prototype,"disabled",2),he([l({reflect:!0})],g.NveRadioGroup.prototype,"errorMessage",2),he([l()],g.NveRadioGroup.prototype,"requiredLabel",2),he([I()],g.NveRadioGroup.prototype,"alreadyInvalid",2),he([I()],g.NveRadioGroup.prototype,"errorMessageCopy",2),he([ph("disabled")],g.NveRadioGroup.prototype,"connectedCallback",1),g.NveRadioGroup=he([et("nve-radio-group")],g.NveRadioGroup);var mh=Object.defineProperty,gh=Object.getOwnPropertyDescriptor,vh=(t,e,r,o)=>{for(var s=o>1?void 0:o?gh(e,r):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(s=(o?n(e,r,s):n(s))||s);return o&&s&&mh(e,r,s),s};g.NveSpinner=class extends xs{constructor(){super()}},g.NveSpinner.styles=[xs.styles,$`
|
|
7930
7930
|
.spinner__track {
|
|
7931
7931
|
stroke: transparent;
|
|
7932
7932
|
}
|