@warp-ds/elements 2.9.1-next.1 → 2.9.1-next.2

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.
@@ -1,7 +1,8 @@
1
1
  import { html } from 'lit';
2
- import { expect, test } from 'vitest';
2
+ import { expect, test, vi } from 'vitest';
3
3
  import { render } from 'vitest-browser-lit';
4
4
  import './radio.js';
5
+ import { userEvent } from '@vitest/browser/context';
5
6
  test('checks on click and remains checked on subsequent clicks', async () => {
6
7
  render(html `<w-radio value="alpha">Alpha</w-radio>`);
7
8
  const radio = document.querySelector('w-radio');
@@ -190,3 +191,22 @@ test('required radio reports validity based on checked state', async () => {
190
191
  await expect.poll(() => radio.reportValidity()).toBe(true);
191
192
  expect(radio.invalid).toBe(false);
192
193
  });
194
+ test('submits the associated form when radio has focus and user presses Enter', async () => {
195
+ const screen = render(html `
196
+ <form>
197
+ <w-radio name="group" value="one">One</w-radio>
198
+ <w-radio name="group" value="two">Two</w-radio>
199
+ <button type="submit">Submit</button>
200
+ </form>
201
+ `);
202
+ const onSubmit = vi.fn();
203
+ const form = document.querySelector('form');
204
+ form.addEventListener('submit', (event) => {
205
+ event.preventDefault();
206
+ onSubmit();
207
+ });
208
+ await userEvent.click(screen.getByText('One'));
209
+ await userEvent.keyboard('{Space}');
210
+ await userEvent.keyboard('{Enter}');
211
+ expect(onSubmit).toHaveBeenCalled();
212
+ });
@@ -1,4 +1,4 @@
1
- var Be=Object.create;var se=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Ze=Object.getPrototypeOf,Ge=Object.prototype.hasOwnProperty;var ve=o=>{throw TypeError(o)};var fe=(o,r)=>()=>(r||o((r={exports:{}}).exports,r),r.exports);var Ke=(o,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of We(r))!Ge.call(o,a)&&a!==e&&se(o,a,{get:()=>r[a],enumerable:!(t=ge(r,a))||t.enumerable});return o};var Je=(o,r,e)=>(e=o!=null?Be(Ze(o)):{},Ke(r||!o||!o.__esModule?se(e,"default",{value:o,enumerable:!0}):e,o));var f=(o,r,e,t)=>{for(var a=t>1?void 0:t?ge(r,e):r,i=o.length-1,n;i>=0;i--)(n=o[i])&&(a=(t?n(r,e,a):n(a))||a);return t&&a&&se(r,e,a),a};var me=(o,r,e)=>r.has(o)||ve("Cannot "+e);var H=(o,r,e)=>(me(o,r,"read from private field"),e?e.call(o):r.get(o)),Z=(o,r,e)=>r.has(o)?ve("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(o):r.set(o,e),I=(o,r,e,t)=>(me(o,r,"write to private field"),t?t.call(o,e):r.set(o,e),e);var we=fe(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.errorMessages=O.ErrorType=void 0;var j;(function(o){o.MalformedUnicode="MALFORMED_UNICODE",o.MalformedHexadecimal="MALFORMED_HEXADECIMAL",o.CodePointLimit="CODE_POINT_LIMIT",o.OctalDeprecation="OCTAL_DEPRECATION",o.EndOfString="END_OF_STRING"})(j=O.ErrorType||(O.ErrorType={}));O.errorMessages=new Map([[j.MalformedUnicode,"malformed Unicode character escape sequence"],[j.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[j.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[j.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[j.EndOfString,"malformed escape sequence at end of string"]])});var ye=fe(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.unraw=V.errorMessages=V.ErrorType=void 0;var w=we();Object.defineProperty(V,"ErrorType",{enumerable:!0,get:function(){return w.ErrorType}});Object.defineProperty(V,"errorMessages",{enumerable:!0,get:function(){return w.errorMessages}});function Qe(o){return!o.match(/[^a-f0-9]/i)?parseInt(o,16):NaN}function G(o,r,e){let t=Qe(o);if(Number.isNaN(t)||e!==void 0&&e!==o.length)throw new SyntaxError(w.errorMessages.get(r));return t}function er(o){let r=G(o,w.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(r)}function xe(o,r){let e=G(o,w.ErrorType.MalformedUnicode,4);if(r!==void 0){let t=G(r,w.ErrorType.MalformedUnicode,4);return String.fromCharCode(e,t)}return String.fromCharCode(e)}function rr(o){return o.charAt(0)==="{"&&o.charAt(o.length-1)==="}"}function tr(o){if(!rr(o))throw new SyntaxError(w.errorMessages.get(w.ErrorType.MalformedUnicode));let r=o.slice(1,-1),e=G(r,w.ErrorType.MalformedUnicode);try{return String.fromCodePoint(e)}catch(t){throw t instanceof RangeError?new SyntaxError(w.errorMessages.get(w.ErrorType.CodePointLimit)):t}}function or(o,r=!1){if(r)throw new SyntaxError(w.errorMessages.get(w.ErrorType.OctalDeprecation));let e=parseInt(o,8);return String.fromCharCode(e)}var ar=new Map([["b","\b"],["f","\f"],["n",`
1
+ var Be=Object.create;var se=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Ze=Object.getPrototypeOf,Ge=Object.prototype.hasOwnProperty;var ve=o=>{throw TypeError(o)};var fe=(o,r)=>()=>(r||o((r={exports:{}}).exports,r),r.exports);var Ke=(o,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of We(r))!Ge.call(o,a)&&a!==e&&se(o,a,{get:()=>r[a],enumerable:!(t=ge(r,a))||t.enumerable});return o};var Je=(o,r,e)=>(e=o!=null?Be(Ze(o)):{},Ke(r||!o||!o.__esModule?se(e,"default",{value:o,enumerable:!0}):e,o));var f=(o,r,e,t)=>{for(var a=t>1?void 0:t?ge(r,e):r,i=o.length-1,n;i>=0;i--)(n=o[i])&&(a=(t?n(r,e,a):n(a))||a);return t&&a&&se(r,e,a),a};var me=(o,r,e)=>r.has(o)||ve("Cannot "+e);var P=(o,r,e)=>(me(o,r,"read from private field"),e?e.call(o):r.get(o)),Z=(o,r,e)=>r.has(o)?ve("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(o):r.set(o,e),I=(o,r,e,t)=>(me(o,r,"write to private field"),t?t.call(o,e):r.set(o,e),e);var we=fe(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.errorMessages=O.ErrorType=void 0;var j;(function(o){o.MalformedUnicode="MALFORMED_UNICODE",o.MalformedHexadecimal="MALFORMED_HEXADECIMAL",o.CodePointLimit="CODE_POINT_LIMIT",o.OctalDeprecation="OCTAL_DEPRECATION",o.EndOfString="END_OF_STRING"})(j=O.ErrorType||(O.ErrorType={}));O.errorMessages=new Map([[j.MalformedUnicode,"malformed Unicode character escape sequence"],[j.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[j.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[j.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[j.EndOfString,"malformed escape sequence at end of string"]])});var ye=fe(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.unraw=V.errorMessages=V.ErrorType=void 0;var w=we();Object.defineProperty(V,"ErrorType",{enumerable:!0,get:function(){return w.ErrorType}});Object.defineProperty(V,"errorMessages",{enumerable:!0,get:function(){return w.errorMessages}});function Qe(o){return!o.match(/[^a-f0-9]/i)?parseInt(o,16):NaN}function G(o,r,e){let t=Qe(o);if(Number.isNaN(t)||e!==void 0&&e!==o.length)throw new SyntaxError(w.errorMessages.get(r));return t}function er(o){let r=G(o,w.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(r)}function xe(o,r){let e=G(o,w.ErrorType.MalformedUnicode,4);if(r!==void 0){let t=G(r,w.ErrorType.MalformedUnicode,4);return String.fromCharCode(e,t)}return String.fromCharCode(e)}function rr(o){return o.charAt(0)==="{"&&o.charAt(o.length-1)==="}"}function tr(o){if(!rr(o))throw new SyntaxError(w.errorMessages.get(w.ErrorType.MalformedUnicode));let r=o.slice(1,-1),e=G(r,w.ErrorType.MalformedUnicode);try{return String.fromCodePoint(e)}catch(t){throw t instanceof RangeError?new SyntaxError(w.errorMessages.get(w.ErrorType.CodePointLimit)):t}}function or(o,r=!1){if(r)throw new SyntaxError(w.errorMessages.get(w.ErrorType.OctalDeprecation));let e=parseInt(o,8);return String.fromCharCode(e)}var ar=new Map([["b","\b"],["f","\f"],["n",`
2
2
  `],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function ir(o){return ar.get(o)||o}var sr=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function ke(o,r=!1){return o.replace(sr,function(e,t,a,i,n,s,l,u,b){if(t!==void 0)return"\\";if(a!==void 0)return er(a);if(i!==void 0)return tr(i);if(n!==void 0)return xe(n,s);if(l!==void 0)return xe(l);if(u==="0")return"\0";if(u!==void 0)return or(u,!r);if(b!==void 0)return ir(b);throw new SyntaxError(w.errorMessages.get(w.ErrorType.EndOfString))})}V.unraw=ke;V.default=ke});import{html as te,LitElement as Ye}from"lit";var Ee=Je(ye(),1);var F=o=>typeof o=="string",nr=o=>typeof o=="function",_e=new Map,Me="en";function ce(o){return[...Array.isArray(o)?o:[o],Me]}function he(o,r,e){let t=ce(o);e||(e="default");let a;if(typeof e=="string")switch(a={day:"numeric",month:"short",year:"numeric"},e){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=e;return K(()=>J("date",t,e),()=>new Intl.DateTimeFormat(t,a)).format(F(r)?new Date(r):r)}function lr(o,r,e){let t;if(e||(e="default"),typeof e=="string")switch(t={second:"numeric",minute:"numeric",hour:"numeric"},e){case"full":case"long":t.timeZoneName="short";break;case"short":delete t.second}else t=e;return he(o,r,t)}function ne(o,r,e){let t=ce(o);return K(()=>J("number",t,e),()=>new Intl.NumberFormat(t,e)).format(r)}function Ce(o,r,e,{offset:t=0,...a}){var s,l;let i=ce(o),n=r?K(()=>J("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):K(()=>J("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return(l=(s=a[e])!=null?s:a[n.select(e-t)])!=null?l:a.other}function K(o,r){let e=o(),t=_e.get(e);return t||(t=r(),_e.set(e,t)),t}function J(o,r,e){let t=r.join("-");return`${o}-${t}-${JSON.stringify(e)}`}var ze=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,Ve="%__lingui_octothorpe__%",dr=(o,r,e={})=>{let t=r||o,a=n=>typeof n=="object"?n:e[n],i=(n,s)=>{let l=Object.keys(e).length?a("number"):void 0,u=ne(t,n,l);return s.replace(new RegExp(Ve,"g"),u)};return{plural:(n,s)=>{let{offset:l=0}=s,u=Ce(t,!1,n,s);return i(n-l,u)},selectordinal:(n,s)=>{let{offset:l=0}=s,u=Ce(t,!0,n,s);return i(n-l,u)},select:cr,number:(n,s)=>ne(t,n,a(s)||{style:s}),date:(n,s)=>he(t,n,a(s)||s),time:(n,s)=>lr(t,n,a(s)||s)}},cr=(o,r)=>{var e;return(e=r[o])!=null?e:r.other};function hr(o,r,e){return(t={},a)=>{let i=dr(r,e,a),n=(l,u=!1)=>Array.isArray(l)?l.reduce((b,p)=>{if(p==="#"&&u)return b+Ve;if(F(p))return b+p;let[T,x,M]=p,S={};x==="plural"||x==="selectordinal"||x==="select"?Object.entries(M).forEach(([L,$])=>{S[L]=n($,x==="plural"||x==="selectordinal")}):S=M;let k;if(x){let L=i[x];k=L(t[T],S)}else k=t[T];return k==null?b:b+k},""):l,s=n(o);return F(s)&&ze.test(s)?(0,Ee.unraw)(s):F(s)?s:s?String(s):""}}var ur=Object.defineProperty,br=(o,r,e)=>r in o?ur(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,pr=(o,r,e)=>(br(o,typeof r!="symbol"?r+"":r,e),e),le=class{constructor(){pr(this,"_events",{})}on(r,e){var a;var t;return(a=(t=this._events)[r])!=null||(t[r]=[]),this._events[r].push(e),()=>this.removeListener(r,e)}removeListener(r,e){let t=this._getListeners(r);if(!t)return;let a=t.indexOf(e);~a&&t.splice(a,1)}emit(r,...e){let t=this._getListeners(r);t&&t.map(a=>a.apply(this,e))}_getListeners(r){let e=this._events[r];return Array.isArray(e)?e:!1}},gr=Object.defineProperty,vr=(o,r,e)=>r in o?gr(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,N=(o,r,e)=>(vr(o,typeof r!="symbol"?r+"":r,e),e),de=class extends le{constructor(r){var e;super(),N(this,"_locale",""),N(this,"_locales"),N(this,"_localeData",{}),N(this,"_messages",{}),N(this,"_missing"),N(this,"_messageCompiler"),N(this,"t",this._.bind(this)),r.missing!=null&&(this._missing=r.missing),r.messages!=null&&this.load(r.messages),r.localeData!=null&&this.loadLocaleData(r.localeData),(typeof r.locale=="string"||r.locales)&&this.activate((e=r.locale)!=null?e:Me,r.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){var r;return(r=this._messages[this._locale])!=null?r:{}}get localeData(){var r;return(r=this._localeData[this._locale])!=null?r:{}}_loadLocaleData(r,e){let t=this._localeData[r];t?Object.assign(t,e):this._localeData[r]=e}setMessagesCompiler(r){return this._messageCompiler=r,this}loadLocaleData(r,e){typeof r=="string"?this._loadLocaleData(r,e):Object.keys(r).forEach(t=>this._loadLocaleData(t,r[t])),this.emit("change")}_load(r,e){let t=this._messages[r];t?Object.assign(t,e):this._messages[r]=e}load(r,e){typeof r=="string"&&typeof e=="object"?this._load(r,e):Object.entries(r).forEach(([t,a])=>this._load(t,a)),this.emit("change")}loadAndActivate({locale:r,locales:e,messages:t}){this._locale=r,this._locales=e||void 0,this._messages[this._locale]=t,this.emit("change")}activate(r,e){this._locale=r,this._locales=e,this.emit("change")}_(r,e,t){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let a=t==null?void 0:t.message;r||(r=""),F(r)||(e=r.values||e,a=r.message,r=r.id);let i=this.messages[r],n=i===void 0,s=this._missing;if(s&&n)return nr(s)?s(this._locale,r):s;n&&this.emit("missing",{id:r,locale:this._locale});let l=i||a||r;return F(l)&&(this._messageCompiler?l=this._messageCompiler(l):console.warn(`Uncompiled message detected! Message:
3
3
 
4
4
  > ${l}
@@ -7,7 +7,7 @@ That means you use raw catalog or your catalog doesn't have a translation for th
7
7
  ICU features such as interpolation and plurals will not work properly for that message.
8
8
 
9
9
  Please compile your catalog first.
10
- `)),F(l)&&ze.test(l)?JSON.parse(`"${l}"`):F(l)?l:hr(l,this._locale,this._locales)(e,t==null?void 0:t.formats)}date(r,e){return he(this._locales||this._locale,r,e)}number(r,e){return ne(this._locales||this._locale,r,e)}};function fr(o={}){return new de(o)}var y=fr();var h=function(o,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?o!==r||!t:!r.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(o):t?t.value:r.get(o)},v=function(o,r,e,t,a){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!a:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?a.call(o,e):a?a.value=e:r.set(o,e),e};function Q(o){var r,e,t,a,i,n,s,l,u,b,p,T,x,M,S,k,L,$,oe;class Xe extends o{constructor(...d){var c,g,m;super(...d),r.add(this),this.internals=this.attachInternals(),e.set(this,!1),t.set(this,!1),a.set(this,!1),i.set(this,void 0),n.set(this,void 0),s.set(this,!0),u.set(this,""),b.set(this,()=>{v(this,a,!0,"f"),v(this,e,!0,"f"),h(this,r,"m",k).call(this)}),p.set(this,()=>{v(this,e,!1,"f"),h(this,r,"m",L).call(this,this.shouldFormValueUpdate()?h(this,u,"f"):""),!this.validity.valid&&h(this,a,"f")&&v(this,t,!0,"f");let z=h(this,r,"m",k).call(this);this.validationMessageCallback&&this.validationMessageCallback(z?this.internals.validationMessage:"")}),T.set(this,()=>{var z;h(this,s,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),v(this,s,!1,"f")),v(this,a,!0,"f"),v(this,t,!0,"f"),h(this,r,"m",k).call(this),(z=this===null||this===void 0?void 0:this.validationMessageCallback)===null||z===void 0||z.call(this,this.showError?this.internals.validationMessage:"")}),x.set(this,void 0),M.set(this,!1),S.set(this,Promise.resolve()),(c=this.addEventListener)===null||c===void 0||c.call(this,"focus",h(this,b,"f")),(g=this.addEventListener)===null||g===void 0||g.call(this,"blur",h(this,p,"f")),(m=this.addEventListener)===null||m===void 0||m.call(this,"invalid",h(this,T,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let d=this.validators.map(m=>m.attribute).flat(),c=super.observedAttributes||[];return[...new Set([...c,...d])]}static getValidator(d){return this.validators.find(c=>c.attribute===d)||null}static getValidators(d){return this.validators.filter(c=>{var g;if(c.attribute===d||!((g=c.attribute)===null||g===void 0)&&g.includes(d))return!0})}get form(){return this.internals.form}get showError(){return h(this,r,"m",k).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(d,c,g){var m;(m=super.attributeChangedCallback)===null||m===void 0||m.call(this,d,c,g);let X=this.constructor.getValidators(d);X!=null&&X.length&&this.validationTarget&&this.setValue(h(this,u,"f"))}setValue(d){var c;v(this,t,!1,"f"),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,""),v(this,u,d,"f");let m=this.shouldFormValueUpdate()?d:null;this.internals.setFormValue(m),h(this,r,"m",L).call(this,m),this.valueChangedCallback&&this.valueChangedCallback(m),h(this,r,"m",k).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(d=>d(h(this,S,"f")))}formResetCallback(){var d,c;v(this,a,!1,"f"),v(this,t,!1,"f"),h(this,r,"m",k).call(this),(d=this.resetFormControl)===null||d===void 0||d.call(this),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,h(this,r,"m",k).call(this)?this.validationMessage:"")}}return e=new WeakMap,t=new WeakMap,a=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,u=new WeakMap,b=new WeakMap,p=new WeakMap,T=new WeakMap,x=new WeakMap,M=new WeakMap,S=new WeakMap,r=new WeakSet,l=function(){let d=this.getRootNode(),c=`${this.localName}[name="${this.getAttribute("name")}"]`;return d.querySelectorAll(c)},k=function(){if(this.hasAttribute("disabled"))return!1;let d=h(this,t,"f")||h(this,a,"f")&&!this.validity.valid&&!h(this,e,"f");return d&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),d},L=function(d){let c=this.constructor,g={},m=c.validators,z=[],X=m.some(E=>E.isValid instanceof Promise);h(this,M,"f")||(v(this,S,new Promise(E=>{v(this,x,E,"f")}),"f"),v(this,M,!0,"f")),h(this,i,"f")&&(h(this,i,"f").abort(),v(this,n,h(this,i,"f"),"f"));let B=new AbortController;v(this,i,B,"f");let W,pe=!1;m.length&&(m.forEach(E=>{let ae=E.key||"customError",P=E.isValid(this,d,B.signal);P instanceof Promise?(z.push(P),P.then(ie=>{ie!=null&&(g[ae]=!ie,W=h(this,r,"m",oe).call(this,E,d),h(this,r,"m",$).call(this,g,W))})):(g[ae]=!P,this.validity[ae]!==!P&&(pe=!0),!P&&!W&&(W=h(this,r,"m",oe).call(this,E,d)))}),Promise.allSettled(z).then(()=>{var E;B!=null&&B.signal.aborted||(v(this,M,!1,"f"),(E=h(this,x,"f"))===null||E===void 0||E.call(this))}),(pe||!X)&&h(this,r,"m",$).call(this,g,W))},$=function(d,c){if(this.validationTarget)this.internals.setValidity(d,c,this.validationTarget),v(this,s,!1,"f");else{if(this.internals.setValidity(d,c),this.internals.validity.valid)return;v(this,s,!0,"f")}},oe=function(d,c){if(this.validityCallback){let g=this.validityCallback(d.key||"customError");if(g)return g}return d.message instanceof Function?d.message(this,c):d.message},Xe}import{property as q,state as zr}from"lit/decorators.js";import{ifDefined as be}from"lit/directives/if-defined.js";import{html as xr,LitElement as Fe}from"lit";import{property as A}from"lit/decorators.js";import{css as Te}from"lit";var Se=Te`
10
+ `)),F(l)&&ze.test(l)?JSON.parse(`"${l}"`):F(l)?l:hr(l,this._locale,this._locales)(e,t==null?void 0:t.formats)}date(r,e){return he(this._locales||this._locale,r,e)}number(r,e){return ne(this._locales||this._locale,r,e)}};function fr(o={}){return new de(o)}var y=fr();var h=function(o,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?o!==r||!t:!r.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(o):t?t.value:r.get(o)},v=function(o,r,e,t,a){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!a:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?a.call(o,e):a?a.value=e:r.set(o,e),e};function Q(o){var r,e,t,a,i,n,s,l,u,b,p,T,x,M,S,k,L,$,oe;class Xe extends o{constructor(...d){var c,g,m;super(...d),r.add(this),this.internals=this.attachInternals(),e.set(this,!1),t.set(this,!1),a.set(this,!1),i.set(this,void 0),n.set(this,void 0),s.set(this,!0),u.set(this,""),b.set(this,()=>{v(this,a,!0,"f"),v(this,e,!0,"f"),h(this,r,"m",k).call(this)}),p.set(this,()=>{v(this,e,!1,"f"),h(this,r,"m",L).call(this,this.shouldFormValueUpdate()?h(this,u,"f"):""),!this.validity.valid&&h(this,a,"f")&&v(this,t,!0,"f");let z=h(this,r,"m",k).call(this);this.validationMessageCallback&&this.validationMessageCallback(z?this.internals.validationMessage:"")}),T.set(this,()=>{var z;h(this,s,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),v(this,s,!1,"f")),v(this,a,!0,"f"),v(this,t,!0,"f"),h(this,r,"m",k).call(this),(z=this===null||this===void 0?void 0:this.validationMessageCallback)===null||z===void 0||z.call(this,this.showError?this.internals.validationMessage:"")}),x.set(this,void 0),M.set(this,!1),S.set(this,Promise.resolve()),(c=this.addEventListener)===null||c===void 0||c.call(this,"focus",h(this,b,"f")),(g=this.addEventListener)===null||g===void 0||g.call(this,"blur",h(this,p,"f")),(m=this.addEventListener)===null||m===void 0||m.call(this,"invalid",h(this,T,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let d=this.validators.map(m=>m.attribute).flat(),c=super.observedAttributes||[];return[...new Set([...c,...d])]}static getValidator(d){return this.validators.find(c=>c.attribute===d)||null}static getValidators(d){return this.validators.filter(c=>{var g;if(c.attribute===d||!((g=c.attribute)===null||g===void 0)&&g.includes(d))return!0})}get form(){return this.internals.form}get showError(){return h(this,r,"m",k).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(d,c,g){var m;(m=super.attributeChangedCallback)===null||m===void 0||m.call(this,d,c,g);let X=this.constructor.getValidators(d);X!=null&&X.length&&this.validationTarget&&this.setValue(h(this,u,"f"))}setValue(d){var c;v(this,t,!1,"f"),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,""),v(this,u,d,"f");let m=this.shouldFormValueUpdate()?d:null;this.internals.setFormValue(m),h(this,r,"m",L).call(this,m),this.valueChangedCallback&&this.valueChangedCallback(m),h(this,r,"m",k).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(d=>d(h(this,S,"f")))}formResetCallback(){var d,c;v(this,a,!1,"f"),v(this,t,!1,"f"),h(this,r,"m",k).call(this),(d=this.resetFormControl)===null||d===void 0||d.call(this),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,h(this,r,"m",k).call(this)?this.validationMessage:"")}}return e=new WeakMap,t=new WeakMap,a=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,u=new WeakMap,b=new WeakMap,p=new WeakMap,T=new WeakMap,x=new WeakMap,M=new WeakMap,S=new WeakMap,r=new WeakSet,l=function(){let d=this.getRootNode(),c=`${this.localName}[name="${this.getAttribute("name")}"]`;return d.querySelectorAll(c)},k=function(){if(this.hasAttribute("disabled"))return!1;let d=h(this,t,"f")||h(this,a,"f")&&!this.validity.valid&&!h(this,e,"f");return d&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),d},L=function(d){let c=this.constructor,g={},m=c.validators,z=[],X=m.some(E=>E.isValid instanceof Promise);h(this,M,"f")||(v(this,S,new Promise(E=>{v(this,x,E,"f")}),"f"),v(this,M,!0,"f")),h(this,i,"f")&&(h(this,i,"f").abort(),v(this,n,h(this,i,"f"),"f"));let B=new AbortController;v(this,i,B,"f");let W,pe=!1;m.length&&(m.forEach(E=>{let ae=E.key||"customError",H=E.isValid(this,d,B.signal);H instanceof Promise?(z.push(H),H.then(ie=>{ie!=null&&(g[ae]=!ie,W=h(this,r,"m",oe).call(this,E,d),h(this,r,"m",$).call(this,g,W))})):(g[ae]=!H,this.validity[ae]!==!H&&(pe=!0),!H&&!W&&(W=h(this,r,"m",oe).call(this,E,d)))}),Promise.allSettled(z).then(()=>{var E;B!=null&&B.signal.aborted||(v(this,M,!1,"f"),(E=h(this,x,"f"))===null||E===void 0||E.call(this))}),(pe||!X)&&h(this,r,"m",$).call(this,g,W))},$=function(d,c){if(this.validationTarget)this.internals.setValidity(d,c,this.validationTarget),v(this,s,!1,"f");else{if(this.internals.setValidity(d,c),this.internals.validity.valid)return;v(this,s,!0,"f")}},oe=function(d,c){if(this.validityCallback){let g=this.validityCallback(d.key||"customError");if(g)return g}return d.message instanceof Function?d.message(this,c):d.message},Xe}import{property as q,state as zr}from"lit/decorators.js";import{ifDefined as be}from"lit/directives/if-defined.js";import{html as xr,LitElement as Fe}from"lit";import{property as A}from"lit/decorators.js";import{css as Te}from"lit";var Se=Te`
11
11
  *,
12
12
  :before,
13
13
  :after {
@@ -2616,12 +2616,12 @@ Please compile your catalog first.
2616
2616
  border-color: var(--_border-color-disabled);
2617
2617
  }
2618
2618
  }
2619
- `;var U,D,R,_=class extends Q(Fe){constructor(){super();this.value=null;this.checked=!1;this.disabled=!1;this.required=!1;this.invalid=!1;Z(this,U,!1);Z(this,D,!1);Z(this,R,!1);this.handleClick=()=>{this.isInGroup()||this.disabled||(I(this,R,!0),!this.checked&&(this.checked=!0,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})))};this.handleInvalid=()=>{I(this,R,!0),this.updateValidity()};this.handleKeyDown=e=>{var t,a;if(!this.isInGroup()&&!this.disabled&&!e.defaultPrevented){if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key)){let i=this.getStandaloneNamedRadios().filter(p=>!p.disabled);if(i.length<=1)return;e.preventDefault();let n=(a=(t=i.find(p=>p.checked))!=null?t:i.find(p=>p===this))!=null?a:i[0],s=e.key==="ArrowUp"||e.key==="ArrowLeft"?-1:1,u=(i.indexOf(n)+s+i.length)%i.length,b=i[u];I(b,R,!0),b.checked||(b.checked=!0,b.updateComplete.then(()=>{b.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})),b.focus();return}e.key!==" "&&e.key!=="Spacebar"&&e.key!=="Enter"||(e.preventDefault(),this.click())}};this.addEventListener("click",this.handleClick),this.addEventListener("invalid",this.handleInvalid),this.addEventListener("keydown",this.handleKeyDown)}get tabIndex(){return this._internalTabIndex}set tabIndex(e){this._groupTabIndex=e}connectedCallback(){var e;super.connectedCallback(),this.value=(e=this.getAttribute("value"))!=null?e:"on",I(this,U,this.hasAttribute("checked")),this.checked=H(this,U),this.internals.role="radio",this.syncAriaDisabled(),this.syncFormValue(),this.updateValidity()}syncAriaDisabled(){this.internals.ariaDisabled=this.disabled?"true":"false"}syncAriaChecked(){this.internals.ariaChecked=this.checked?"true":"false"}willUpdate(e){this.shouldSyncFormState(e)&&(this.syncFormValue(),this.updateValidity())}updated(e){super.updated(e),e.has("checked")&&(this.syncAriaChecked(),this.checked&&!this.isInGroup()&&(this.uncheckOtherRadios(),this.syncStandaloneTabOrder())),e.has("disabled")&&(this.syncAriaDisabled(),this.isInGroup()||this.syncStandaloneTabOrder()),e.has("invalid")&&(this.internals.ariaInvalid=this.invalid?"true":null),e.has("name")&&this.checked&&!this.isInGroup()&&this.uncheckOtherRadios()}resetFormControl(){this.checked=H(this,U),this.syncFormValue(),this.updateValidity()}get validationMessage(){return this.internals.validationMessage}get validity(){return this.internals.validity}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return I(this,R,!0),this.updateValidity(),this.internals.checkValidity()}isInGroup(){return!!this.closest("w-radio-group")}getRadioScope(){var e,t;return(t=(e=this.internals.form)!=null?e:this.closest("form"))!=null?t:document}getStandaloneNamedRadios(){if(!this.name)return[this];let e=this.getRadioScope();return Array.from(e.querySelectorAll(`w-radio[name="${this.name}"]`)).filter(t=>!t.closest("w-radio-group"))}syncStandaloneTabOrder(){var n;let e=this.getStandaloneNamedRadios(),t=e.filter(s=>!s.disabled),a=t.find(s=>s.checked),i=(n=a!=null?a:t[0])!=null?n:null;e.forEach(s=>{s._standaloneTabIndex=s===i?0:-1})}get _internalTabIndex(){return this.disabled?-1:this._groupTabIndex!==void 0?this._groupTabIndex:this._standaloneTabIndex!==void 0?this._standaloneTabIndex:0}firstUpdated(){this.isInGroup()||this.syncStandaloneTabOrder()}uncheckOtherRadios(){if(!this.name)return;let e=this.getRadioScope();Array.from(e.querySelectorAll(`w-radio[name="${this.name}"]`)).forEach(a=>{a!==this&&(a.closest("w-radio-group")||a.checked&&(a.checked=!1))})}updateValidity(){if(this.disabled||this.isInGroup()){this.internals.setValidity({});return}let e=this.required&&!this.checked,t=this.invalid&&!H(this,D);if(e){I(this,D,!0),this.invalid=H(this,R),this.internals.setValidity({valueMissing:!0},this.internals.validationMessage||" ");return}if(H(this,D)&&(this.invalid=!1,I(this,D,!1)),t){this.internals.setValidity({customError:!0},this.internals.validationMessage||" ");return}this.internals.setValidity({})}syncFormValue(){if(this.disabled){this.setValue(null);return}this.setValue(this.checked?this.value:null)}shouldSyncFormState(e){return e.has("checked")||e.has("value")||e.has("disabled")||e.has("required")||e.has("invalid")}render(){return xr`
2619
+ `;var U,D,R,_=class extends Q(Fe){constructor(){super();this.value=null;this.checked=!1;this.disabled=!1;this.required=!1;this.invalid=!1;Z(this,U,!1);Z(this,D,!1);Z(this,R,!1);this.handleClick=()=>{this.isInGroup()||this.disabled||(I(this,R,!0),!this.checked&&(this.checked=!0,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})))};this.handleInvalid=()=>{I(this,R,!0),this.updateValidity()};this.handleKeyDown=e=>{var t,a;if(!this.isInGroup()&&!this.disabled&&!e.defaultPrevented){if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key)){let i=this.getStandaloneNamedRadios().filter(p=>!p.disabled);if(i.length<=1)return;e.preventDefault();let n=(a=(t=i.find(p=>p.checked))!=null?t:i.find(p=>p===this))!=null?a:i[0],s=e.key==="ArrowUp"||e.key==="ArrowLeft"?-1:1,u=(i.indexOf(n)+s+i.length)%i.length,b=i[u];I(b,R,!0),b.checked||(b.checked=!0,b.updateComplete.then(()=>{b.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})),b.focus();return}if(!(e.key!==" "&&e.key!=="Spacebar"&&e.key!=="Enter")){if(e.key==="Enter"&&this.internals.form){this.internals.form.requestSubmit();return}e.preventDefault(),this.click()}}};this.addEventListener("click",this.handleClick),this.addEventListener("invalid",this.handleInvalid),this.addEventListener("keydown",this.handleKeyDown)}get tabIndex(){return this._internalTabIndex}set tabIndex(e){this._groupTabIndex=e}connectedCallback(){var e;super.connectedCallback(),this.value=(e=this.getAttribute("value"))!=null?e:"on",I(this,U,this.hasAttribute("checked")),this.checked=P(this,U),this.internals.role="radio",this.syncAriaDisabled(),this.syncFormValue(),this.updateValidity()}syncAriaDisabled(){this.internals.ariaDisabled=this.disabled?"true":"false"}syncAriaChecked(){this.internals.ariaChecked=this.checked?"true":"false"}willUpdate(e){this.shouldSyncFormState(e)&&(this.syncFormValue(),this.updateValidity())}updated(e){super.updated(e),e.has("checked")&&(this.syncAriaChecked(),this.checked&&!this.isInGroup()&&(this.uncheckOtherRadios(),this.syncStandaloneTabOrder())),e.has("disabled")&&(this.syncAriaDisabled(),this.isInGroup()||this.syncStandaloneTabOrder()),e.has("invalid")&&(this.internals.ariaInvalid=this.invalid?"true":null),e.has("name")&&this.checked&&!this.isInGroup()&&this.uncheckOtherRadios()}resetFormControl(){this.checked=P(this,U),this.syncFormValue(),this.updateValidity()}get validationMessage(){return this.internals.validationMessage}get validity(){return this.internals.validity}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return I(this,R,!0),this.updateValidity(),this.internals.checkValidity()}isInGroup(){return!!this.closest("w-radio-group")}getRadioScope(){var e,t;return(t=(e=this.internals.form)!=null?e:this.closest("form"))!=null?t:document}getStandaloneNamedRadios(){if(!this.name)return[this];let e=this.getRadioScope();return Array.from(e.querySelectorAll(`w-radio[name="${this.name}"]`)).filter(t=>!t.closest("w-radio-group"))}syncStandaloneTabOrder(){var n;let e=this.getStandaloneNamedRadios(),t=e.filter(s=>!s.disabled),a=t.find(s=>s.checked),i=(n=a!=null?a:t[0])!=null?n:null;e.forEach(s=>{s._standaloneTabIndex=s===i?0:-1})}get _internalTabIndex(){return this.disabled?-1:this._groupTabIndex!==void 0?this._groupTabIndex:this._standaloneTabIndex!==void 0?this._standaloneTabIndex:0}firstUpdated(){this.isInGroup()||this.syncStandaloneTabOrder()}uncheckOtherRadios(){if(!this.name)return;let e=this.getRadioScope();Array.from(e.querySelectorAll(`w-radio[name="${this.name}"]`)).forEach(a=>{a!==this&&(a.closest("w-radio-group")||a.checked&&(a.checked=!1))})}updateValidity(){if(this.disabled||this.isInGroup()){this.internals.setValidity({});return}let e=this.required&&!this.checked,t=this.invalid&&!P(this,D);if(e){I(this,D,!0),this.invalid=P(this,R),this.internals.setValidity({valueMissing:!0},this.internals.validationMessage||" ");return}if(P(this,D)&&(this.invalid=!1,I(this,D,!1)),t){this.internals.setValidity({customError:!0},this.internals.validationMessage||" ");return}this.internals.setValidity({})}syncFormValue(){if(this.disabled){this.setValue(null);return}this.setValue(this.checked?this.value:null)}shouldSyncFormState(e){return e.has("checked")||e.has("value")||e.has("disabled")||e.has("required")||e.has("invalid")}render(){return xr`
2620
2620
  <div class="wrapper" tabindex="${this._internalTabIndex}">
2621
2621
  <div part="control" class="control"></div>
2622
2622
  <slot part="label" class="label"></slot>
2623
2623
  </div>
2624
- `}};U=new WeakMap,D=new WeakMap,R=new WeakMap,_.styles=[ee,Se,Ie],_.shadowRootOptions={...Fe.shadowRootOptions,delegatesFocus:!0},f([A({reflect:!0})],_.prototype,"name",2),f([A({reflect:!0})],_.prototype,"value",2),f([A({type:Boolean,reflect:!0})],_.prototype,"checked",2),f([A({type:Boolean,reflect:!0})],_.prototype,"disabled",2),f([A({type:Boolean,reflect:!0})],_.prototype,"required",2),f([A({type:Boolean,reflect:!0})],_.prototype,"invalid",2),f([A({attribute:!1})],_.prototype,"_groupTabIndex",2),f([A({attribute:!1})],_.prototype,"_standaloneTabIndex",2);customElements.get("w-radio")||customElements.define("w-radio",_);var kr=["en","nb","fi","da","sv"],ue="en",re=o=>kr.find(r=>o===r||o.toLowerCase().includes(r))||ue;function Le(){if(typeof window=="undefined"){let o=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return re(o)}try{let o=Re(document);if(o)return re(o);let r=Er();if(r)return re(r);let e=Re(De());return e?re(e):ue}catch(o){return console.warn("could not detect locale, falling back to source locale",o),ue}}var Oe=(o,r,e,t,a)=>{y.load("en",o),y.load("nb",r),y.load("fi",e),y.load("da",t),y.load("sv",a);let i=Le();y.activate(i),Ne(),_r()},yr="warp-i18n-change";function Ne(){typeof window!="undefined"&&window.dispatchEvent(new Event(yr))}var Ae=!1;function _r(){if(Ae||typeof window=="undefined"||!(document!=null&&document.documentElement))return;Ae=!0;let o=()=>{let a=Le();y.locale!==a&&(y.activate(a),Ne())},r=new MutationObserver(a=>{for(let i of a)if(i.type==="attributes"&&i.attributeName==="lang"){o();break}});r.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]});let e=De();e&&e.documentElement&&e!==document&&r.observe(e.documentElement,{attributes:!0,attributeFilter:["lang"]});let t=Cr();t&&r.observe(t,{attributes:!0,attributeFilter:["lang"]})}function De(){var o,r;try{return(r=(o=window.parent)==null?void 0:o.document)!=null?r:null}catch(e){return null}}function Re(o){var r,e;try{return(e=(r=o==null?void 0:o.documentElement)==null?void 0:r.lang)!=null?e:""}catch(t){return""}}function Cr(){var o;try{return(o=window.frameElement)!=null?o:null}catch(r){return null}}function Er(){var o,r,e;try{return(e=(r=(o=window.frameElement)==null?void 0:o.getAttribute)==null?void 0:r.call(o,"lang"))!=null?e:""}catch(t){return""}}var qe=JSON.parse('{"radio-group.label.optional":["Valgfri"],"radio-group.validation.required":["V\xE6lg en mulighed."]}');var Pe=JSON.parse('{"radio-group.label.optional":["Optional"],"radio-group.validation.required":["Please select an option."]}');var He=JSON.parse('{"radio-group.label.optional":["Valinnainen"],"radio-group.validation.required":["Valitse vaihtoehto."]}');var je=JSON.parse('{"radio-group.label.optional":["Valgfri"],"radio-group.validation.required":["Velg et alternativ."]}');var Ue=JSON.parse('{"radio-group.label.optional":["Valfritt"],"radio-group.validation.required":["V\xE4lj ett alternativ."]}');import{css as Mr}from"lit";var $e=Mr`
2624
+ `}};U=new WeakMap,D=new WeakMap,R=new WeakMap,_.styles=[ee,Se,Ie],_.shadowRootOptions={...Fe.shadowRootOptions,delegatesFocus:!0},f([A({reflect:!0})],_.prototype,"name",2),f([A({reflect:!0})],_.prototype,"value",2),f([A({type:Boolean,reflect:!0})],_.prototype,"checked",2),f([A({type:Boolean,reflect:!0})],_.prototype,"disabled",2),f([A({type:Boolean,reflect:!0})],_.prototype,"required",2),f([A({type:Boolean,reflect:!0})],_.prototype,"invalid",2),f([A({attribute:!1})],_.prototype,"_groupTabIndex",2),f([A({attribute:!1})],_.prototype,"_standaloneTabIndex",2);customElements.get("w-radio")||customElements.define("w-radio",_);var kr=["en","nb","fi","da","sv"],ue="en",re=o=>kr.find(r=>o===r||o.toLowerCase().includes(r))||ue;function Le(){if(typeof window=="undefined"){let o=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return re(o)}try{let o=Re(document);if(o)return re(o);let r=Er();if(r)return re(r);let e=Re(De());return e?re(e):ue}catch(o){return console.warn("could not detect locale, falling back to source locale",o),ue}}var Oe=(o,r,e,t,a)=>{y.load("en",o),y.load("nb",r),y.load("fi",e),y.load("da",t),y.load("sv",a);let i=Le();y.activate(i),Ne(),_r()},yr="warp-i18n-change";function Ne(){typeof window!="undefined"&&window.dispatchEvent(new Event(yr))}var Ae=!1;function _r(){if(Ae||typeof window=="undefined"||!(document!=null&&document.documentElement))return;Ae=!0;let o=()=>{let a=Le();y.locale!==a&&(y.activate(a),Ne())},r=new MutationObserver(a=>{for(let i of a)if(i.type==="attributes"&&i.attributeName==="lang"){o();break}});r.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]});let e=De();e&&e.documentElement&&e!==document&&r.observe(e.documentElement,{attributes:!0,attributeFilter:["lang"]});let t=Cr();t&&r.observe(t,{attributes:!0,attributeFilter:["lang"]})}function De(){var o,r;try{return(r=(o=window.parent)==null?void 0:o.document)!=null?r:null}catch(e){return null}}function Re(o){var r,e;try{return(e=(r=o==null?void 0:o.documentElement)==null?void 0:r.lang)!=null?e:""}catch(t){return""}}function Cr(){var o;try{return(o=window.frameElement)!=null?o:null}catch(r){return null}}function Er(){var o,r,e;try{return(e=(r=(o=window.frameElement)==null?void 0:o.getAttribute)==null?void 0:r.call(o,"lang"))!=null?e:""}catch(t){return""}}var qe=JSON.parse('{"radio-group.label.optional":["Valgfri"],"radio-group.validation.required":["V\xE6lg en mulighed."]}');var He=JSON.parse('{"radio-group.label.optional":["Optional"],"radio-group.validation.required":["Please select an option."]}');var Pe=JSON.parse('{"radio-group.label.optional":["Valinnainen"],"radio-group.validation.required":["Valitse vaihtoehto."]}');var je=JSON.parse('{"radio-group.label.optional":["Valgfri"],"radio-group.validation.required":["Velg et alternativ."]}');var Ue=JSON.parse('{"radio-group.label.optional":["Valfritt"],"radio-group.validation.required":["V\xE4lj ett alternativ."]}');import{css as Mr}from"lit";var $e=Mr`
2625
2625
  :host {
2626
2626
  display: block;
2627
2627
 
@@ -2709,7 +2709,7 @@ Please compile your catalog first.
2709
2709
  :host([data-show-error]) [part~='help-text'] {
2710
2710
  color: var(--_help-text-color-error);
2711
2711
  }
2712
- `;Oe(Pe,je,He,qe,Ue);var Vr=()=>y._({id:"radio-group.validation.required",message:"Please select an option.",comment:"Shown when required radio group has no selections"}),C=class extends Q(Ye){constructor(){super();this.hasInteracted=!1;this.hasWarnedMissingName=!1;this.autoTabIndex=!1;this.label="";this.helpText="";this.optional=!1;this.invalid=!1;this.name=null;this.disabled=!1;this.required=!1;this.defaultCheckedValue=void 0;this.slottedHelpText=null;this.nameManagedRadios=new WeakSet;this.disabledManagedRadios=new WeakSet;this.handleRadioClick=e=>{let t=e.target.closest("w-radio");if(!t||t.disabled||this.disabled)return;let a=this.getCheckedValue(),i=this.getAllRadios();this.selectSingleRadio(t,i),this.getCheckedValue()!==a&&this.updateComplete.then(this.emitSelectionChange)};this.handleInvalid=e=>{e.preventDefault(),this.hasInteracted=!0,this.updateValidity()};this.handleHelpTextSlotChange=()=>{this.syncSlottedHelpText(),this.requestUpdate()};this.handleI18nChange=()=>{this.requestUpdate()};this.emitSelectionChange=()=>{this.hasInteracted=!0,this.syncFormValue(),this.updateValidity(),this.requestUpdate(),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};this.captureDefaultSelection=()=>{this.defaultCheckedValue===void 0&&(this.defaultCheckedValue=this.getCheckedValue())};this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("click",this.handleRadioClick),this.addEventListener("invalid",this.handleInvalid)}get validationTarget(){let e=this.querySelector(":is(w-radio):not([disabled])");return e!=null?e:void 0}connectedCallback(){super.connectedCallback(),this.syncSlottedHelpText(),this.syncFormValue(),this.updateValidity(),this.unsubscribeI18n=y.on("change",this.handleI18nChange),this.warnIfMissingName(),this.updateComplete.then(this.captureDefaultSelection)}disconnectedCallback(){var e;(e=this.unsubscribeI18n)==null||e.call(this),this.unsubscribeI18n=void 0,super.disconnectedCallback()}async updated(e){(e.has("disabled")||e.has("name")||e.has("required")||e.has("invalid")||e.has("helpText"))&&(this.syncFormValue(),this.updateValidity(),this.syncRadioElements(),this.syncFormValue(),this.updateValidity())}resetFormControl(){var t;let e=(t=this.defaultCheckedValue)!=null?t:null;this.getAllRadios().forEach(a=>{a.checked=e?a.value===e:!1}),this.syncRadioElements(),this.syncFormValue(),this.updateValidity()}getAllRadios(){return[...this.querySelectorAll("w-radio")]}getCheckedValue(){var t;let e=this.getAllRadios().find(a=>a.checked);return(t=e==null?void 0:e.value)!=null?t:null}getEnabledRadios(e=this.getAllRadios()){return e.filter(t=>!t.disabled)}selectSingleRadio(e,t=this.getAllRadios()){t.forEach(a=>{let i=a===e;a.checked=i,a._groupTabIndex=i?0:-1})}handleLabelClick(){this.focus()}async syncRadioElements(){let e=this.getAllRadios();e.forEach((t,a)=>{t.toggleAttribute("data-w-radio-first",a===0),t.toggleAttribute("data-w-radio-inner",a!==0&&a!==e.length-1),t.toggleAttribute("data-w-radio-last",a===e.length-1),this.syncRadioDisabledState(t),this.name?(!t.getAttribute("name")||this.nameManagedRadios.has(t))&&(t.setAttribute("name",this.name),this.nameManagedRadios.add(t)):this.nameManagedRadios.has(t)&&(t.removeAttribute("name"),this.nameManagedRadios.delete(t))}),await Promise.all(e.map(async t=>t.updateComplete)),this.normalizeCheckedRadios(e),this.syncTabOrder(e)}syncRadioDisabledState(e){if(this.disabled){e.disabled||(e.disabled=!0,this.disabledManagedRadios.add(e));return}this.disabledManagedRadios.has(e)&&(e.disabled=!1,this.disabledManagedRadios.delete(e))}syncTabOrder(e){if(this.disabled){e.forEach(i=>i._groupTabIndex=-1);return}let t=this.getEnabledRadios(e),a=t.find(i=>i.checked);t.length>0&&(a?t.forEach(i=>i._groupTabIndex=i.checked?0:-1):t.forEach((i,n)=>i._groupTabIndex=n===0?0:-1)),e.filter(i=>i.disabled).forEach(i=>i._groupTabIndex=-1)}handleKeyDown(e){var b;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(e.key)||this.disabled)return;let t=this.getAllRadios(),a=this.getEnabledRadios(t);if(a.length<=0)return;e.preventDefault();let i=this.getCheckedValue(),n=(b=a.find(p=>p.checked))!=null?b:a[0],s=e.key===" "?0:["ArrowUp","ArrowLeft"].includes(e.key)?-1:1,l=a.indexOf(n)+s;l<0&&(l=a.length-1),l>=a.length&&(l=0),this.selectSingleRadio(a[l],t),a[l].focus(),this.getCheckedValue()!==i&&this.updateComplete.then(this.emitSelectionChange)}focus(e){if(this.disabled)return;let t=this.getAllRadios(),a=t.find(s=>s.checked),i=t.find(s=>!s.disabled),n=a||i;n&&n.focus(e)}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.hasInteracted=!0,this.updateValidity(),this.internals.checkValidity()}hasSlottedContent(e){var a;if(this.querySelector(`[slot="${e}"]`))return!0;let t=(a=this.shadowRoot)==null?void 0:a.querySelector(`slot[name="${e}"]`);return t?t.assignedNodes({flatten:!0}).some(i=>{var n;return i.nodeType===Node.ELEMENT_NODE?!0:i.nodeType===Node.TEXT_NODE?!!((n=i.textContent)!=null&&n.trim()):!1}):!1}syncFormValue(){this.setValue(null)}syncSlottedHelpText(){var t;let e=this.querySelector('[slot="help-text"]');this.slottedHelpText=((t=e==null?void 0:e.textContent)==null?void 0:t.trim())||null}updateValidity(){this.warnIfMissingName();let e=this.required&&!this.getCheckedValue(),t=e&&this.hasInteracted,a=this.invalid||this.hasAttribute("invalid"),i=a||t;if(this.toggleAttribute("data-show-error",i),this.disabled){this.internals.setValidity({}),this.syncChildInvalid(!1),this.syncHostTabIndex(!1);return}if(this.syncHostTabIndex(i),e){this.setValidityState({valueMissing:!0}),this.syncChildInvalid(i);return}if(a){this.setValidityState({customError:!0}),this.syncChildInvalid(!0);return}this.internals.setValidity({}),this.syncChildInvalid(!1)}normalizeCheckedRadios(e){let t=e.find(a=>a.checked);t&&e.forEach(a=>{a!==t&&(a.checked=!1)})}syncChildInvalid(e){this.getAllRadios().forEach(t=>{t.invalid=e})}setValidityState(e){let t=this.validationTarget;this.internals.setValidity(e," ",t!=null?t:void 0)}syncHostTabIndex(e){if(!(this.hasAttribute("tabindex")&&!this.autoTabIndex)){if(e){this.setAttribute("tabindex","0"),this.autoTabIndex=!0;return}this.autoTabIndex&&(this.removeAttribute("tabindex"),this.autoTabIndex=!1)}}warnIfMissingName(){this.hasWarnedMissingName||this.internals.form&&(this.name&&this.name.trim().length>0||(console.warn('w-radio-group: "name" is required for form submission.'),this.hasWarnedMissingName=!0))}render(){let e=this.hasSlottedContent("label"),t=this.hasSlottedContent("help-text"),a=this.label?!0:!!e,i=this.helpText?!0:!!t,s=this.required&&!this.getCheckedValue()&&this.hasInteracted,u=this.invalid||this.hasAttribute("invalid")||s,b=u?Vr():this.helpText,p=u||i,T=a?"label":void 0,x=p?"help-text":void 0,M=this.slottedHelpText||void 0;return te`
2712
+ `;Oe(He,je,Pe,qe,Ue);var Vr=()=>y._({id:"radio-group.validation.required",message:"Please select an option.",comment:"Shown when required radio group has no selections"}),C=class extends Q(Ye){constructor(){super();this.hasInteracted=!1;this.hasWarnedMissingName=!1;this.autoTabIndex=!1;this.label="";this.helpText="";this.optional=!1;this.invalid=!1;this.name=null;this.disabled=!1;this.required=!1;this.defaultCheckedValue=void 0;this.slottedHelpText=null;this.nameManagedRadios=new WeakSet;this.disabledManagedRadios=new WeakSet;this.handleRadioClick=e=>{let t=e.target.closest("w-radio");if(!t||t.disabled||this.disabled)return;let a=this.getCheckedValue(),i=this.getAllRadios();this.selectSingleRadio(t,i),this.getCheckedValue()!==a&&this.updateComplete.then(this.emitSelectionChange)};this.handleInvalid=e=>{e.preventDefault(),this.hasInteracted=!0,this.updateValidity()};this.handleHelpTextSlotChange=()=>{this.syncSlottedHelpText(),this.requestUpdate()};this.handleI18nChange=()=>{this.requestUpdate()};this.emitSelectionChange=()=>{this.hasInteracted=!0,this.syncFormValue(),this.updateValidity(),this.requestUpdate(),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};this.captureDefaultSelection=()=>{this.defaultCheckedValue===void 0&&(this.defaultCheckedValue=this.getCheckedValue())};this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("click",this.handleRadioClick),this.addEventListener("invalid",this.handleInvalid)}get validationTarget(){let e=this.querySelector(":is(w-radio):not([disabled])");return e!=null?e:void 0}connectedCallback(){super.connectedCallback(),this.syncSlottedHelpText(),this.syncFormValue(),this.updateValidity(),this.unsubscribeI18n=y.on("change",this.handleI18nChange),this.warnIfMissingName(),this.updateComplete.then(this.captureDefaultSelection)}disconnectedCallback(){var e;(e=this.unsubscribeI18n)==null||e.call(this),this.unsubscribeI18n=void 0,super.disconnectedCallback()}async updated(e){(e.has("disabled")||e.has("name")||e.has("required")||e.has("invalid")||e.has("helpText"))&&(this.syncFormValue(),this.updateValidity(),this.syncRadioElements(),this.syncFormValue(),this.updateValidity())}resetFormControl(){var t;let e=(t=this.defaultCheckedValue)!=null?t:null;this.getAllRadios().forEach(a=>{a.checked=e?a.value===e:!1}),this.syncRadioElements(),this.syncFormValue(),this.updateValidity()}getAllRadios(){return[...this.querySelectorAll("w-radio")]}getCheckedValue(){var t;let e=this.getAllRadios().find(a=>a.checked);return(t=e==null?void 0:e.value)!=null?t:null}getEnabledRadios(e=this.getAllRadios()){return e.filter(t=>!t.disabled)}selectSingleRadio(e,t=this.getAllRadios()){t.forEach(a=>{let i=a===e;a.checked=i,a._groupTabIndex=i?0:-1})}handleLabelClick(){this.focus()}async syncRadioElements(){let e=this.getAllRadios();e.forEach((t,a)=>{t.toggleAttribute("data-w-radio-first",a===0),t.toggleAttribute("data-w-radio-inner",a!==0&&a!==e.length-1),t.toggleAttribute("data-w-radio-last",a===e.length-1),this.syncRadioDisabledState(t),this.name?(!t.getAttribute("name")||this.nameManagedRadios.has(t))&&(t.setAttribute("name",this.name),this.nameManagedRadios.add(t)):this.nameManagedRadios.has(t)&&(t.removeAttribute("name"),this.nameManagedRadios.delete(t))}),await Promise.all(e.map(async t=>t.updateComplete)),this.normalizeCheckedRadios(e),this.syncTabOrder(e)}syncRadioDisabledState(e){if(this.disabled){e.disabled||(e.disabled=!0,this.disabledManagedRadios.add(e));return}this.disabledManagedRadios.has(e)&&(e.disabled=!1,this.disabledManagedRadios.delete(e))}syncTabOrder(e){if(this.disabled){e.forEach(i=>i._groupTabIndex=-1);return}let t=this.getEnabledRadios(e),a=t.find(i=>i.checked);t.length>0&&(a?t.forEach(i=>i._groupTabIndex=i.checked?0:-1):t.forEach((i,n)=>i._groupTabIndex=n===0?0:-1)),e.filter(i=>i.disabled).forEach(i=>i._groupTabIndex=-1)}handleKeyDown(e){var b;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(e.key)||this.disabled)return;let t=this.getAllRadios(),a=this.getEnabledRadios(t);if(a.length<=0)return;e.preventDefault();let i=this.getCheckedValue(),n=(b=a.find(p=>p.checked))!=null?b:a[0],s=e.key===" "?0:["ArrowUp","ArrowLeft"].includes(e.key)?-1:1,l=a.indexOf(n)+s;l<0&&(l=a.length-1),l>=a.length&&(l=0),this.selectSingleRadio(a[l],t),a[l].focus(),this.getCheckedValue()!==i&&this.updateComplete.then(this.emitSelectionChange)}focus(e){if(this.disabled)return;let t=this.getAllRadios(),a=t.find(s=>s.checked),i=t.find(s=>!s.disabled),n=a||i;n&&n.focus(e)}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.hasInteracted=!0,this.updateValidity(),this.internals.checkValidity()}hasSlottedContent(e){var a;if(this.querySelector(`[slot="${e}"]`))return!0;let t=(a=this.shadowRoot)==null?void 0:a.querySelector(`slot[name="${e}"]`);return t?t.assignedNodes({flatten:!0}).some(i=>{var n;return i.nodeType===Node.ELEMENT_NODE?!0:i.nodeType===Node.TEXT_NODE?!!((n=i.textContent)!=null&&n.trim()):!1}):!1}syncFormValue(){this.setValue(null)}syncSlottedHelpText(){var t;let e=this.querySelector('[slot="help-text"]');this.slottedHelpText=((t=e==null?void 0:e.textContent)==null?void 0:t.trim())||null}updateValidity(){this.warnIfMissingName();let e=this.required&&!this.getCheckedValue(),t=e&&this.hasInteracted,a=this.invalid||this.hasAttribute("invalid"),i=a||t;if(this.toggleAttribute("data-show-error",i),this.disabled){this.internals.setValidity({}),this.syncChildInvalid(!1),this.syncHostTabIndex(!1);return}if(this.syncHostTabIndex(i),e){this.setValidityState({valueMissing:!0}),this.syncChildInvalid(i);return}if(a){this.setValidityState({customError:!0}),this.syncChildInvalid(!0);return}this.internals.setValidity({}),this.syncChildInvalid(!1)}normalizeCheckedRadios(e){let t=e.find(a=>a.checked);t&&e.forEach(a=>{a!==t&&(a.checked=!1)})}syncChildInvalid(e){this.getAllRadios().forEach(t=>{t.invalid=e})}setValidityState(e){let t=this.validationTarget;this.internals.setValidity(e," ",t!=null?t:void 0)}syncHostTabIndex(e){if(!(this.hasAttribute("tabindex")&&!this.autoTabIndex)){if(e){this.setAttribute("tabindex","0"),this.autoTabIndex=!0;return}this.autoTabIndex&&(this.removeAttribute("tabindex"),this.autoTabIndex=!1)}}warnIfMissingName(){this.hasWarnedMissingName||this.internals.form&&(this.name&&this.name.trim().length>0||(console.warn('w-radio-group: "name" is required for form submission.'),this.hasWarnedMissingName=!0))}render(){let e=this.hasSlottedContent("label"),t=this.hasSlottedContent("help-text"),a=this.label?!0:!!e,i=this.helpText?!0:!!t,s=this.required&&!this.getCheckedValue()&&this.hasInteracted,u=this.invalid||this.hasAttribute("invalid")||s,b=u?Vr():this.helpText,p=u||i,T=a?"label":void 0,x=p?"help-text":void 0,M=this.slottedHelpText||void 0;return te`
2713
2713
  <fieldset
2714
2714
  part="form-control"
2715
2715
  role="radiogroup"