@oslokommune/punkt-react 12.39.6 → 12.39.7
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/CHANGELOG.md +18 -0
- package/dist/punkt-react.es.js +3164 -3167
- package/dist/punkt-react.umd.js +8 -8
- package/package.json +4 -4
package/dist/punkt-react.umd.js
CHANGED
|
@@ -639,7 +639,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
639
639
|
* @license
|
|
640
640
|
* Copyright 2017 Google LLC
|
|
641
641
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
642
|
-
*/const z1=(n,r,i)=>{const l=new Map;for(let c=r;c<=i;c++)l.set(n[c],c);return l},h0=Of(class extends wh{constructor(n){if(super(n),n.type!==cl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,r,i){let l;i===void 0?i=r:r!==void 0&&(l=r);const c=[],h=[];let m=0;for(const D of n)c[m]=l?l(D,m):m,h[m]=i(D,m),m++;return{values:h,keys:c}}render(n,r,i){return this.dt(n,r,i).values}update(n,[r,i,l]){const c=kP(n),{values:h,keys:m}=this.dt(r,i,l);if(!Array.isArray(c))return this.ut=m,h;const D=this.ut??(this.ut=[]),C=[];let T,$,N=0,O=c.length-1,B=0,I=h.length-1;for(;N<=O&&B<=I;)if(c[N]===null)N++;else if(c[O]===null)O--;else if(D[N]===m[B])C[B]=Rf(c[N],h[B]),N++,B++;else if(D[O]===m[I])C[I]=Rf(c[O],h[I]),O--,I--;else if(D[N]===m[I])C[I]=Rf(c[N],h[I]),xg(n,C[I+1],c[N]),N++,I--;else if(D[O]===m[B])C[B]=Rf(c[O],h[B]),xg(n,c[N],c[O]),O--,B++;else if(T===void 0&&(T=z1(m,B,I),$=z1(D,N,O)),T.has(D[N]))if(T.has(D[O])){const K=$.get(m[B]),Y=K!==void 0?c[K]:null;if(Y===null){const Ce=xg(n,c[N]);Rf(Ce,h[B]),C[B]=Ce}else C[B]=Rf(Y,h[B]),xg(n,c[N],Y),c[K]=null;B++}else r0(c[O]),O--;else r0(c[N]),N++;for(;B<=I;){const K=xg(n,C[I+1]);Rf(K,h[B]),C[B++]=K}for(;N<=O;){const K=c[N++];K!==null&&r0(K)}return this.ut=m,y1(n,C),vo}}),U1=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),If=()=>{const n=U1(),r=U1();return n.slice(0,8)+"-"+n.slice(8,12)+"-4"+n.slice(13)+"-a"+r.slice(1,4)+"-"+r.slice(4)},m3={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},Ko={props:m3};var g3=Object.defineProperty,Bn=(n,r,i,l)=>{for(var c=void 0,h=n.length-1,m;h>=0;h--)(m=n[h])&&(c=m(r,i,c)||c);return c&&g3(r,i,c),c};let fn=class extends Hr{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=If(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Ko.props.helptextDropdownButton.default,this.label=null,this.optionalText=_s.forms.labels.optional,this.requiredText=_s.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(r){var i,l,c,h,m,D,C,T;r&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},_s.forms.messages.required,r):(i=r.validity)!=null&&i.typeMismatch||(l=r.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},_s.forms.messages.invalid,r):(c=r.validity)!=null&&c.patternMismatch?this.internals.setValidity({patternMismatch:!0},_s.forms.messages.invalidPattern,r):(h=r.validity)!=null&&h.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},_s.forms.messages.tooShort,r):(m=r.validity)!=null&&m.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},_s.forms.messages.tooLong,r):(D=r.validity)!=null&&D.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},_s.forms.messages.rangeUnderflow,r):(C=r.validity)!=null&&C.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},_s.forms.messages.rangeOverflow,r):(T=r.validity)!=null&&T.customError?this.internals.setValidity({customError:!0},r.validationMessage,r):this.internals.setValidity({}))}setFormValue(r){if(this.internals)if(Array.isArray(r)){const i=new FormData;r.forEach(l=>{i.append(this.name,l)}),this.internals.setFormValue(i)}else this.internals.setFormValue(r)}valueChecked(r){if(!this.touched)return;const i=this.internals.form||this.closest("form"),l=i?new FormData(i):null;i&&i.querySelectorAll(`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`).forEach(c=>{const h=c;h.name===this.name&&h.value!==this.value&&h.checked&&(h.checked=!1)}),typeof r=="string"?(this.checked=r==="true",this.internals.ariaChecked=r==="true"):typeof r=="boolean"&&(this.checked=r,this.internals.ariaChecked=r),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),l&&l.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),l&&l.delete(this.name),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(r,i){(i!==this.value||i!==this._value)&&(typeof r=="string"?((this.multiple||this.range)&&r.includes(",")&&(r=r.split(",")),this.value=r,this._value=Array.isArray(r)?r:[r]):Array.isArray(r)?(this.value=this.multiple||this.range?r:r[0],this._value=r):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&i&&i.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(i==null?void 0:i.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const r=this.multiple||this.range?[]:"";this.value=r,this.internals.setFormValue(r),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:r,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}onChange(r){if(!this.touched){this.touched=!0,r&&this.setFormValue(r);return}typeof r!="string"&&!Array.isArray(r)||((this.range||this.multiple)&&!Array.isArray(r)&&r.includes(",")&&(r=r.split(",")),!this.multiple&&!this.range&&Array.isArray(r)&&(r=r[0]),this.setFormValue(r),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:r,bubbles:!0,composed:!0})),this.internals.reportValidity())}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(r=>{r.selected=!1}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}updated(r){super.updated(r),r.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(r){if(super.firstUpdated(r),!this.form){const i=this.internals.form||this.closest("form");this.form=i}if(this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const i=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=i,this.internals.setFormValue(i?this.value||"on":"",i?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}};Bn([z()],fn.prototype,"defaultValue"),Bn([z({type:Boolean,reflect:!0})],fn.prototype,"disabled"),Bn([z({type:Boolean,reflect:!0})],fn.prototype,"readonly"),Bn([z({type:Boolean,reflect:!0})],fn.prototype,"required"),Bn([z({type:Number,reflect:!0})],fn.prototype,"max"),Bn([z({type:Number,reflect:!0})],fn.prototype,"maxlength"),Bn([z({type:Number,reflect:!0})],fn.prototype,"min"),Bn([z({type:Number,reflect:!0})],fn.prototype,"minlength"),Bn([z({type:String})],fn.prototype,"ariaDescribedBy"),Bn([z({type:String})],fn.prototype,"ariaLabelledby"),Bn([z({type:String,reflect:!0})],fn.prototype,"name"),Bn([z({type:String,reflect:!0})],fn.prototype,"pattern"),Bn([z({type:String,reflect:!0})],fn.prototype,"placeholder"),Bn([z({type:String,reflect:!0})],fn.prototype,"id"),Bn([z({type:Boolean})],fn.prototype,"counter"),Bn([z({type:Boolean})],fn.prototype,"hasError"),Bn([z({type:Boolean})],fn.prototype,"inline"),Bn([z({type:Boolean})],fn.prototype,"hasFieldset"),Bn([z({type:Boolean})],fn.prototype,"optionalTag"),Bn([z({type:Boolean})],fn.prototype,"requiredTag"),Bn([z({type:Boolean})],fn.prototype,"skipForwardTestid"),Bn([z({type:Boolean,reflect:!1})],fn.prototype,"useWrapper"),Bn([z({type:Boolean,reflect:!0})],fn.prototype,"fullwidth"),Bn([z({type:Number})],fn.prototype,"counterMaxLength"),Bn([z({type:String})],fn.prototype,"errorMessage"),Bn([z({type:String})],fn.prototype,"helptext"),Bn([z({type:String})],fn.prototype,"helptextDropdown"),Bn([z({type:String,reflect:!1})],fn.prototype,"helptextDropdownButton"),Bn([z({type:String})],fn.prototype,"label"),Bn([z({type:String,reflect:!1})],fn.prototype,"optionalText"),Bn([z({type:String,reflect:!1})],fn.prototype,"requiredText"),Bn([z({type:String,attribute:"data-testid"})],fn.prototype,"dataTestid"),Bn([$n()],fn.prototype,"touched");let H1=class{constructor(r){this.nodes=[],this.options=[],this.host=r,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(i=>this.handleMutations(i))}hostConnected(){Array.from(this.host.childNodes).forEach(r=>{(r.nodeName==="OPTION"||r.nodeName==="DATA")&&this.addNode(r)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(r){(r.nodeName==="OPTION"||r.nodeName==="DATA")&&(r.setAttribute("class","pkt-hide"),r.setAttribute("hidden","true"),r.setAttribute("data-skip","true"),this.nodes.push(r))}createOptions(){this.options=this.nodes.map(r=>({value:r.getAttribute("value")||r.textContent||"",label:r.textContent||r.getAttribute("value")||"",selected:!!r.getAttribute("selected"),disabled:!!r.getAttribute("disabled")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(r){let i=!1;r.forEach(l=>{l.type==="childList"&&(l.addedNodes.forEach(c=>{_g(c)&&(this.addNode(c),i=!0)}),l.removedNodes.forEach(c=>{_g(c)&&(this.nodes=this.nodes.filter(h=>h!==c),i=!0)}))}),i&&this.createOptions()}};var v3=Object.defineProperty,y3=Object.getOwnPropertyDescriptor,Eh=(n,r,i,l)=>{for(var c=l>1?void 0:l?y3(r,i):r,h=n.length-1,m;h>=0;h--)(m=n[h])&&(c=(l?m(r,i,c):m(c))||c);return l&&c&&v3(r,i,c),c};let _d=class extends Hr{constructor(){super(),this.defaultSlot=dn(),this.forId=If(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Ko.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.slotController=new _a(this,this.defaultSlot)}render(){const r=()=>{const l=!this.isHelpTextOpen;this.isHelpTextOpen=l,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:l}}))},i=()=>this.helptextDropdown?be`<div class="pkt-inputwrapper__helptext-expandable">
|
|
642
|
+
*/const z1=(n,r,i)=>{const l=new Map;for(let c=r;c<=i;c++)l.set(n[c],c);return l},h0=Of(class extends wh{constructor(n){if(super(n),n.type!==cl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,r,i){let l;i===void 0?i=r:r!==void 0&&(l=r);const c=[],h=[];let m=0;for(const D of n)c[m]=l?l(D,m):m,h[m]=i(D,m),m++;return{values:h,keys:c}}render(n,r,i){return this.dt(n,r,i).values}update(n,[r,i,l]){const c=kP(n),{values:h,keys:m}=this.dt(r,i,l);if(!Array.isArray(c))return this.ut=m,h;const D=this.ut??(this.ut=[]),C=[];let T,$,N=0,O=c.length-1,B=0,I=h.length-1;for(;N<=O&&B<=I;)if(c[N]===null)N++;else if(c[O]===null)O--;else if(D[N]===m[B])C[B]=Rf(c[N],h[B]),N++,B++;else if(D[O]===m[I])C[I]=Rf(c[O],h[I]),O--,I--;else if(D[N]===m[I])C[I]=Rf(c[N],h[I]),xg(n,C[I+1],c[N]),N++,I--;else if(D[O]===m[B])C[B]=Rf(c[O],h[B]),xg(n,c[N],c[O]),O--,B++;else if(T===void 0&&(T=z1(m,B,I),$=z1(D,N,O)),T.has(D[N]))if(T.has(D[O])){const K=$.get(m[B]),Y=K!==void 0?c[K]:null;if(Y===null){const Ce=xg(n,c[N]);Rf(Ce,h[B]),C[B]=Ce}else C[B]=Rf(Y,h[B]),xg(n,c[N],Y),c[K]=null;B++}else r0(c[O]),O--;else r0(c[N]),N++;for(;B<=I;){const K=xg(n,C[I+1]);Rf(K,h[B]),C[B++]=K}for(;N<=O;){const K=c[N++];K!==null&&r0(K)}return this.ut=m,y1(n,C),vo}}),U1=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),If=()=>{const n=U1(),r=U1();return n.slice(0,8)+"-"+n.slice(8,12)+"-4"+n.slice(13)+"-a"+r.slice(1,4)+"-"+r.slice(4)},m3={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},Ko={props:m3};var g3=Object.defineProperty,Bn=(n,r,i,l)=>{for(var c=void 0,h=n.length-1,m;h>=0;h--)(m=n[h])&&(c=m(r,i,c)||c);return c&&g3(r,i,c),c};let fn=class extends Hr{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=If(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Ko.props.helptextDropdownButton.default,this.label=null,this.optionalText=_s.forms.labels.optional,this.requiredText=_s.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(r){var i,l,c,h,m,D,C,T;r&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},_s.forms.messages.required,r):(i=r.validity)!=null&&i.typeMismatch||(l=r.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},_s.forms.messages.invalid,r):(c=r.validity)!=null&&c.patternMismatch?this.internals.setValidity({patternMismatch:!0},_s.forms.messages.invalidPattern,r):(h=r.validity)!=null&&h.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},_s.forms.messages.tooShort,r):(m=r.validity)!=null&&m.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},_s.forms.messages.tooLong,r):(D=r.validity)!=null&&D.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},_s.forms.messages.rangeUnderflow,r):(C=r.validity)!=null&&C.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},_s.forms.messages.rangeOverflow,r):(T=r.validity)!=null&&T.customError?this.internals.setValidity({customError:!0},r.validationMessage,r):this.internals.setValidity({}))}setFormValue(r){if(this.internals)if(Array.isArray(r)){const i=new FormData;r.forEach(l=>{i.append(this.name,l)}),this.internals.setFormValue(i)}else this.internals.setFormValue(r)}valueChecked(r){if(!this.touched)return;const i=this.internals.form||this.closest("form"),l=i?new FormData(i):null;i&&i.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(c=>{const h=c;h.name===this.name&&h.value!==this.value&&h.checked&&(h.checked=!1)}),typeof r=="string"?(this.checked=r==="true",this.internals.ariaChecked=r==="true"):typeof r=="boolean"&&(this.checked=r,this.internals.ariaChecked=r),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),l&&l.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),l&&l.delete(this.name),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(r,i){(i!==this.value||i!==this._value)&&(typeof r=="string"?((this.multiple||this.range)&&r.includes(",")&&(r=r.split(",")),this.value=r,this._value=Array.isArray(r)?r:[r]):Array.isArray(r)?(this.value=this.multiple||this.range?r:r[0],this._value=r):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&i&&i.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(i==null?void 0:i.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const r=this.multiple||this.range?[]:"";this.value=r,this.internals.setFormValue(r),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:r,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}onChange(r){if(!this.touched){this.touched=!0,r&&this.setFormValue(r);return}typeof r!="string"&&!Array.isArray(r)||((this.range||this.multiple)&&!Array.isArray(r)&&r.includes(",")&&(r=r.split(",")),!this.multiple&&!this.range&&Array.isArray(r)&&(r=r[0]),this.setFormValue(r),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:r,bubbles:!0,composed:!0})),this.internals.reportValidity())}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(r=>{r.selected=!1}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}updated(r){super.updated(r),r.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(r){if(super.firstUpdated(r),!this.form){const i=this.internals.form||this.closest("form");this.form=i}if(this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const i=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=i,this.internals.setFormValue(i?this.value||"on":"",i?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}};Bn([z()],fn.prototype,"defaultValue"),Bn([z({type:Boolean,reflect:!0})],fn.prototype,"disabled"),Bn([z({type:Boolean,reflect:!0})],fn.prototype,"readonly"),Bn([z({type:Boolean,reflect:!0})],fn.prototype,"required"),Bn([z({type:Number,reflect:!0})],fn.prototype,"max"),Bn([z({type:Number,reflect:!0})],fn.prototype,"maxlength"),Bn([z({type:Number,reflect:!0})],fn.prototype,"min"),Bn([z({type:Number,reflect:!0})],fn.prototype,"minlength"),Bn([z({type:String})],fn.prototype,"ariaDescribedBy"),Bn([z({type:String})],fn.prototype,"ariaLabelledby"),Bn([z({type:String,reflect:!0})],fn.prototype,"name"),Bn([z({type:String,reflect:!0})],fn.prototype,"pattern"),Bn([z({type:String,reflect:!0})],fn.prototype,"placeholder"),Bn([z({type:String,reflect:!0})],fn.prototype,"id"),Bn([z({type:Boolean})],fn.prototype,"counter"),Bn([z({type:Boolean})],fn.prototype,"hasError"),Bn([z({type:Boolean})],fn.prototype,"inline"),Bn([z({type:Boolean})],fn.prototype,"hasFieldset"),Bn([z({type:Boolean})],fn.prototype,"optionalTag"),Bn([z({type:Boolean})],fn.prototype,"requiredTag"),Bn([z({type:Boolean})],fn.prototype,"skipForwardTestid"),Bn([z({type:Boolean,reflect:!1})],fn.prototype,"useWrapper"),Bn([z({type:Boolean,reflect:!0})],fn.prototype,"fullwidth"),Bn([z({type:Number})],fn.prototype,"counterMaxLength"),Bn([z({type:String})],fn.prototype,"errorMessage"),Bn([z({type:String})],fn.prototype,"helptext"),Bn([z({type:String})],fn.prototype,"helptextDropdown"),Bn([z({type:String,reflect:!1})],fn.prototype,"helptextDropdownButton"),Bn([z({type:String})],fn.prototype,"label"),Bn([z({type:String,reflect:!1})],fn.prototype,"optionalText"),Bn([z({type:String,reflect:!1})],fn.prototype,"requiredText"),Bn([z({type:String,attribute:"data-testid"})],fn.prototype,"dataTestid"),Bn([$n()],fn.prototype,"touched");let H1=class{constructor(r){this.nodes=[],this.options=[],this.host=r,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(i=>this.handleMutations(i))}hostConnected(){Array.from(this.host.childNodes).forEach(r=>{(r.nodeName==="OPTION"||r.nodeName==="DATA")&&this.addNode(r)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(r){(r.nodeName==="OPTION"||r.nodeName==="DATA")&&(r.setAttribute("class","pkt-hide"),r.setAttribute("hidden","true"),r.setAttribute("data-skip","true"),this.nodes.push(r))}createOptions(){this.options=this.nodes.map(r=>({value:r.getAttribute("value")||r.textContent||"",label:r.textContent||r.getAttribute("value")||"",selected:!!r.getAttribute("selected"),disabled:!!r.getAttribute("disabled")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(r){let i=!1;r.forEach(l=>{l.type==="childList"&&(l.addedNodes.forEach(c=>{_g(c)&&(this.addNode(c),i=!0)}),l.removedNodes.forEach(c=>{_g(c)&&(this.nodes=this.nodes.filter(h=>h!==c),i=!0)}))}),i&&this.createOptions()}};var v3=Object.defineProperty,y3=Object.getOwnPropertyDescriptor,Eh=(n,r,i,l)=>{for(var c=l>1?void 0:l?y3(r,i):r,h=n.length-1,m;h>=0;h--)(m=n[h])&&(c=(l?m(r,i,c):m(c))||c);return l&&c&&v3(r,i,c),c};let _d=class extends Hr{constructor(){super(),this.defaultSlot=dn(),this.forId=If(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Ko.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.slotController=new _a(this,this.defaultSlot)}render(){const r=()=>{const l=!this.isHelpTextOpen;this.isHelpTextOpen=l,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:l}}))},i=()=>this.helptextDropdown?be`<div class="pkt-inputwrapper__helptext-expandable">
|
|
643
643
|
<button
|
|
644
644
|
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
645
645
|
type="button"
|
|
@@ -1126,7 +1126,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1126
1126
|
|
|
1127
1127
|
<div class="pkt-linkcard__text" ${qt(this.defaultSlot)}></div>
|
|
1128
1128
|
</a>
|
|
1129
|
-
`}};Uf([z({type:String,reflect:!0})],hc.prototype,"title",2),Uf([z({type:String,reflect:!0})],hc.prototype,"href",2),Uf([z({type:String,reflect:!0})],hc.prototype,"iconName",2),Uf([z({type:Boolean,reflect:!0})],hc.prototype,"external",2),Uf([z({type:Boolean,reflect:!0})],hc.prototype,"openInNewTab",2),Uf([z({type:String,reflect:!0})],hc.prototype,"skin",2),hc=Uf([dr("pkt-linkcard")],hc);var H3=Object.defineProperty,V3=Object.getOwnPropertyDescriptor,mc=(n,r,i,l)=>{for(var c=l>1?void 0:l?V3(r,i):r,h=n.length-1,m;h>=0;h--)(m=n[h])&&(c=(l?m(r,i,c):m(c))||c);return l&&c&&H3(r,i,c),c};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/12.39/animations/";let pl=class extends Hr{constructor(){super(),this.defaultSlot=dn(),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size="medium",this.variant="shapes",this.loadingAnimationPath=window.pktAnimationPath,this._shouldDisplayLoader=!1,this.slotController=new _a(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(
|
|
1129
|
+
`}};Uf([z({type:String,reflect:!0})],hc.prototype,"title",2),Uf([z({type:String,reflect:!0})],hc.prototype,"href",2),Uf([z({type:String,reflect:!0})],hc.prototype,"iconName",2),Uf([z({type:Boolean,reflect:!0})],hc.prototype,"external",2),Uf([z({type:Boolean,reflect:!0})],hc.prototype,"openInNewTab",2),Uf([z({type:String,reflect:!0})],hc.prototype,"skin",2),hc=Uf([dr("pkt-linkcard")],hc);var H3=Object.defineProperty,V3=Object.getOwnPropertyDescriptor,mc=(n,r,i,l)=>{for(var c=l>1?void 0:l?V3(r,i):r,h=n.length-1,m;h>=0;h--)(m=n[h])&&(c=(l?m(r,i,c):m(c))||c);return l&&c&&H3(r,i,c),c};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/12.39/animations/";let pl=class extends Hr{constructor(){super(),this.defaultSlot=dn(),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size="medium",this.variant="shapes",this.loadingAnimationPath=window.pktAnimationPath,this._shouldDisplayLoader=!1,this.slotController=new _a(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(r){r.has("delay")&&this.setupLoader()}render(){const r=It({"pkt-loader":!0,[`pkt-loader--${this.inline?"inline":"box"}`]:!0,[`pkt-loader--${this.size}`]:!0}),i=It({"pkt-contents":!0,"pkt-hide":this.isLoading});return be`<div role="status" aria-live="polite" .aria-busy=${this.isLoading} class=${r}>
|
|
1130
1130
|
${this.isLoading&&this._shouldDisplayLoader?be`<div class="pkt-loader__spinner">
|
|
1131
1131
|
<pkt-icon
|
|
1132
1132
|
name=${this.getVariant(this.variant)}
|
|
@@ -1135,8 +1135,8 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1135
1135
|
></pkt-icon>
|
|
1136
1136
|
${this.message&&be`<p>${this.message}</p>`}
|
|
1137
1137
|
</div>`:qe}
|
|
1138
|
-
<div class=${
|
|
1139
|
-
</div>`}getVariant(
|
|
1138
|
+
<div class=${i} ${qt(this.defaultSlot)}></div>
|
|
1139
|
+
</div>`}getVariant(r){switch(r){case"blue":return"spinner-blue";case"rainbow":return"spinner";default:return"loader"}}setupLoader(){this.delay>0&&(this._shouldDisplayLoader=!1,setTimeout(()=>{this._shouldDisplayLoader=!0,this.requestUpdate()},this.delay))}};mc([z({type:Number})],pl.prototype,"delay",2),mc([z({type:Boolean})],pl.prototype,"inline",2),mc([z({type:Boolean})],pl.prototype,"isLoading",2),mc([z({type:String})],pl.prototype,"message",2),mc([z({type:String})],pl.prototype,"size",2),mc([z({type:String})],pl.prototype,"variant",2),mc([z({type:String})],pl.prototype,"loadingAnimationPath",2),mc([$n()],pl.prototype,"_shouldDisplayLoader",2),pl=mc([dr("pkt-loader")],pl);const q3={skin:{default:"beige"},compact:{default:!1},closable:{default:!1}},g0={props:q3};var W3=Object.defineProperty,Y3=Object.getOwnPropertyDescriptor,$h=(n,r,i,l)=>{for(var c=l>1?void 0:l?Y3(r,i):r,h=n.length-1,m;h>=0;h--)(m=n[h])&&(c=(l?m(r,i,c):m(c))||c);return l&&c&&W3(r,i,c),c};let Td=class extends Hr{constructor(){super(),this.defaultSlot=dn(),this.closable=g0.props.closable.default,this.compact=g0.props.compact.default,this.title="",this.skin=g0.props.skin.default,this._isClosed=!1,this.close=n=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:n},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:n},bubbles:!0}))},this.slotController=new _a(this,this.defaultSlot),this._isClosed=!1}updated(n){super.updated(n),n.has("_isClosed")&&k1(this,"pkt-hide",this._isClosed)}render(){const n={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return be`<div class=${It(n)}>
|
|
1140
1140
|
${this.closable?be`<div class="pkt-messagebox__close">
|
|
1141
1141
|
<button
|
|
1142
1142
|
@click=${this.close}
|
|
@@ -1202,12 +1202,12 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1202
1202
|
${this.statusType==="percentage"?`${l}%`:c}
|
|
1203
1203
|
</span>
|
|
1204
1204
|
</div>`:qe}
|
|
1205
|
-
</div>`}setComputedValues(){this.progressbarId=this.id||If(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(n,r){r==null||r===""?this.removeAttribute(n):this.setAttribute(n,String(r))}};Ea([z({type:String})],ia.prototype,"ariaLabel",2),Ea([z({type:String,reflect:!0})],ia.prototype,"ariaLabelledby",2),Ea([z({type:String,reflect:!0})],ia.prototype,"ariaValueText",2),Ea([z({type:String})],ia.prototype,"ariaLive",2),Ea([z({type:String,reflect:!0})],ia.prototype,"id",2),Ea([z({type:String})],ia.prototype,"role",2),Ea([z({type:String})],ia.prototype,"skin",2),Ea([z({type:String})],ia.prototype,"statusPlacement",2),Ea([z({type:String})],ia.prototype,"statusType",2),Ea([z({type:String,reflect:!0})],ia.prototype,"title",2),Ea([z({type:String})],ia.prototype,"titlePosition",2),Ea([z({type:Number,reflect:!0})],ia.prototype,"valueCurrent",2),Ea([z({type:Number})],ia.prototype,"valueMax",2),Ea([z({type:Number})],ia.prototype,"valueMin",2),Ea([$n()],ia.prototype,"labelWidth",2),Ea([$n()],ia.prototype,"progressbarId",2),Ea([$n()],ia.prototype,"computedAriaLabelledby",2),Ea([$n()],ia.prototype,"computedAriaValueText",2),ia=Ea([dr("pkt-progressbar")],ia);var tO=Object.defineProperty,nO=Object.getOwnPropertyDescriptor,Ad=(n,r,i,l)=>{for(var c=l>1?void 0:l?nO(r,i):r,h=n.length-1,m;h>=0;h--)(m=n[h])&&(c=(l?m(r,i,c):m(c))||c);return l&&c&&tO(r,i,c),c};let fu=class extends fn{constructor(){super(...arguments),this.inputRef=dn(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(r,i
|
|
1205
|
+
</div>`}setComputedValues(){this.progressbarId=this.id||If(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(n,r){r==null||r===""?this.removeAttribute(n):this.setAttribute(n,String(r))}};Ea([z({type:String})],ia.prototype,"ariaLabel",2),Ea([z({type:String,reflect:!0})],ia.prototype,"ariaLabelledby",2),Ea([z({type:String,reflect:!0})],ia.prototype,"ariaValueText",2),Ea([z({type:String})],ia.prototype,"ariaLive",2),Ea([z({type:String,reflect:!0})],ia.prototype,"id",2),Ea([z({type:String})],ia.prototype,"role",2),Ea([z({type:String})],ia.prototype,"skin",2),Ea([z({type:String})],ia.prototype,"statusPlacement",2),Ea([z({type:String})],ia.prototype,"statusType",2),Ea([z({type:String,reflect:!0})],ia.prototype,"title",2),Ea([z({type:String})],ia.prototype,"titlePosition",2),Ea([z({type:Number,reflect:!0})],ia.prototype,"valueCurrent",2),Ea([z({type:Number})],ia.prototype,"valueMax",2),Ea([z({type:Number})],ia.prototype,"valueMin",2),Ea([$n()],ia.prototype,"labelWidth",2),Ea([$n()],ia.prototype,"progressbarId",2),Ea([$n()],ia.prototype,"computedAriaLabelledby",2),Ea([$n()],ia.prototype,"computedAriaValueText",2),ia=Ea([dr("pkt-progressbar")],ia);var tO=Object.defineProperty,nO=Object.getOwnPropertyDescriptor,Ad=(n,r,i,l)=>{for(var c=l>1?void 0:l?nO(r,i):r,h=n.length-1,m;h>=0;h--)(m=n[h])&&(c=(l?m(r,i,c):m(c))||c);return l&&c&&tO(r,i,c),c};let fu=class extends fn{constructor(){super(...arguments),this.inputRef=dn(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(n,r,i){n==="defaultChecked"&&(this._checked=this.defaultChecked),n==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(n,r,i)}render(){const n=It({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),r=It({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError});return be`
|
|
1206
1206
|
<div class="pkt-input-check">
|
|
1207
|
-
<div class=${
|
|
1207
|
+
<div class=${n}>
|
|
1208
1208
|
<input
|
|
1209
1209
|
id=${this.id+"-internal"}
|
|
1210
|
-
class=${
|
|
1210
|
+
class=${r}
|
|
1211
1211
|
type="radio"
|
|
1212
1212
|
role="radio"
|
|
1213
1213
|
?disabled=${this.disabled}
|
|
@@ -1226,7 +1226,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1226
1226
|
</label>
|
|
1227
1227
|
</div>
|
|
1228
1228
|
</div>
|
|
1229
|
-
`}toggleChecked(
|
|
1229
|
+
`}toggleChecked(n=null){n&&n.preventDefault(),n&&n.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}};Ad([z({type:String,reflect:!0})],fu.prototype,"value",2),Ad([z({type:String})],fu.prototype,"checkHelptext",2),Ad([z({type:Boolean})],fu.prototype,"defaultChecked",2),Ad([z({type:Boolean})],fu.prototype,"hasTile",2),Ad([z({type:Boolean,reflect:!0})],fu.prototype,"checked",2),Ad([z({type:String,reflect:!0})],fu.prototype,"type",2),Ad([$n()],fu.prototype,"_checked",2),fu=Ad([dr("pkt-radiobutton")],fu);/**
|
|
1230
1230
|
* @license
|
|
1231
1231
|
* Copyright 2020 Google LLC
|
|
1232
1232
|
* SPDX-License-Identifier: BSD-3-Clause
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "12.39.
|
|
3
|
+
"version": "12.39.7",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@lit-labs/ssr-dom-shim": "^1.2.1",
|
|
40
40
|
"@lit/react": "^1.0.7",
|
|
41
|
-
"@oslokommune/punkt-elements": "^12.39.
|
|
41
|
+
"@oslokommune/punkt-elements": "^12.39.7",
|
|
42
42
|
"angular-html-parser": "^6.0.2",
|
|
43
43
|
"html-format": "^1.1.7",
|
|
44
44
|
"prettier": "^3.3.3",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
|
|
51
51
|
"@oslokommune/punkt-assets": "^12.39.2",
|
|
52
|
-
"@oslokommune/punkt-css": "^12.39.
|
|
52
|
+
"@oslokommune/punkt-css": "^12.39.7",
|
|
53
53
|
"@testing-library/jest-dom": "^6.5.0",
|
|
54
54
|
"@testing-library/react": "^16.0.1",
|
|
55
55
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
113
113
|
},
|
|
114
114
|
"license": "MIT",
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "504099164121e630280de133dfc4accf97765a8f"
|
|
116
116
|
}
|