@oslokommune/punkt-react 12.37.7 → 12.37.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/punkt-react.es.js
CHANGED
|
@@ -25469,7 +25469,11 @@ let fn = class extends Gr {
|
|
|
25469
25469
|
super.updated(n), n.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")));
|
|
25470
25470
|
}
|
|
25471
25471
|
firstUpdated(n) {
|
|
25472
|
-
if (super.firstUpdated(n),
|
|
25472
|
+
if (super.firstUpdated(n), !this.form) {
|
|
25473
|
+
const i = this.internals.form || this.closest("form");
|
|
25474
|
+
this.form = i;
|
|
25475
|
+
}
|
|
25476
|
+
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) {
|
|
25473
25477
|
const i = this.checked === "" || this.checked === "true" || this.checked === !0;
|
|
25474
25478
|
this.internals.ariaChecked = i, this.internals.setFormValue(
|
|
25475
25479
|
i ? this.value || "on" : "",
|
|
@@ -28025,6 +28029,7 @@ let tc = class extends fn {
|
|
|
28025
28029
|
type="radio"
|
|
28026
28030
|
role="radio"
|
|
28027
28031
|
?disabled=${this.disabled}
|
|
28032
|
+
form=""
|
|
28028
28033
|
name=${this.name + "-internal"}
|
|
28029
28034
|
${Kt(this.inputRef)}
|
|
28030
28035
|
@change=${this.toggleChecked}
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -580,7 +580,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
580
580
|
* @license
|
|
581
581
|
* Copyright 2017 Google LLC
|
|
582
582
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
583
|
-
*/const z1=(r,n,i)=>{const l=new Map;for(let c=n;c<=i;c++)l.set(r[c],c);return l},p0=Nf(class extends wh{constructor(r){if(super(r),r.type!==sl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,n,i){let l;i===void 0?i=n:n!==void 0&&(l=n);const c=[],h=[];let m=0;for(const D of r)c[m]=l?l(D,m):m,h[m]=i(D,m),m++;return{values:h,keys:c}}render(r,n,i){return this.dt(r,n,i).values}update(r,[n,i,l]){const c=kP(r),{values:h,keys:m}=this.dt(n,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,R=0,I=h.length-1;for(;N<=O&&R<=I;)if(c[N]===null)N++;else if(c[O]===null)O--;else if(D[N]===m[R])C[R]=Of(c[N],h[R]),N++,R++;else if(D[O]===m[I])C[I]=Of(c[O],h[I]),O--,I--;else if(D[N]===m[I])C[I]=Of(c[N],h[I]),_g(r,C[I+1],c[N]),N++,I--;else if(D[O]===m[R])C[R]=Of(c[O],h[R]),_g(r,c[N],c[O]),O--,R++;else if(T===void 0&&(T=z1(m,R,I),$=z1(D,N,O)),T.has(D[N]))if(T.has(D[O])){const K=$.get(m[R]),Y=K!==void 0?c[K]:null;if(Y===null){const Ce=_g(r,c[N]);Of(Ce,h[R]),C[R]=Ce}else C[R]=Of(Y,h[R]),_g(r,c[N],Y),c[K]=null;R++}else r0(c[O]),O--;else r0(c[N]),N++;for(;R<=I;){const K=_g(r,C[I+1]);Of(K,h[R]),C[R++]=K}for(;N<=O;){const K=c[N++];K!==null&&r0(K)}return this.ut=m,v1(r,C),mo}}),U1=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),If=()=>{const r=U1(),n=U1();return r.slice(0,8)+"-"+r.slice(8,12)+"-4"+r.slice(13)+"-a"+n.slice(1,4)+"-"+n.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}},Wo={props:m3};var g3=Object.defineProperty,Bn=(r,n,i,l)=>{for(var c=void 0,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=m(n,i,c)||c);return c&&g3(n,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=Wo.props.helptextDropdownButton.default,this.label=null,this.optionalText=ws.forms.labels.optional,this.requiredText=ws.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(n){var i,l,c,h,m,D,C,T;n&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},ws.forms.messages.required,n):(i=n.validity)!=null&&i.typeMismatch||(l=n.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},ws.forms.messages.invalid,n):(c=n.validity)!=null&&c.patternMismatch?this.internals.setValidity({patternMismatch:!0},ws.forms.messages.invalidPattern,n):(h=n.validity)!=null&&h.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},ws.forms.messages.tooShort,n):(m=n.validity)!=null&&m.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},ws.forms.messages.tooLong,n):(D=n.validity)!=null&&D.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},ws.forms.messages.rangeUnderflow,n):(C=n.validity)!=null&&C.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},ws.forms.messages.rangeOverflow,n):(T=n.validity)!=null&&T.customError?this.internals.setValidity({customError:!0},n.validationMessage,n):this.internals.setValidity({}))}setFormValue(n){if(this.internals)if(Array.isArray(n)){const i=new FormData;n.forEach(l=>{i.append(this.name,l)}),this.internals.setFormValue(i)}else this.internals.setFormValue(n)}valueChecked(n){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 n=="string"?(this.checked=n==="true",this.internals.ariaChecked=n==="true"):typeof n=="boolean"&&(this.checked=n,this.internals.ariaChecked=n),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(n,i){(i!==this.value||i!==this._value)&&(typeof n=="string"?((this.multiple||this.range)&&n.includes(",")&&(n=n.split(",")),this.value=n,this._value=Array.isArray(n)?n:[n]):Array.isArray(n)?(this.value=this.multiple||this.range?n:n[0],this._value=n):(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 n=this.multiple||this.range?[]:"";this.value=n,this.internals.setFormValue(n),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:n,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(n){if(!this.touched){this.touched=!0,n&&this.setFormValue(n);return}typeof n!="string"&&!Array.isArray(n)||((this.range||this.multiple)&&!Array.isArray(n)&&n.includes(",")&&(n=n.split(",")),!this.multiple&&!this.range&&Array.isArray(n)&&(n=n[0]),this.setFormValue(n),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:n,bubbles:!0,composed:!0})),this.internals.reportValidity())}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(n=>{n.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(n){super.updated(n),n.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(n){if(super.firstUpdated(n),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(n){this.nodes=[],this.options=[],this.host=n,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(i=>this.handleMutations(i))}hostConnected(){Array.from(this.host.childNodes).forEach(n=>{(n.nodeName==="OPTION"||n.nodeName==="DATA")&&this.addNode(n)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(n){(n.nodeName==="OPTION"||n.nodeName==="DATA")&&(n.setAttribute("class","pkt-hide"),n.setAttribute("hidden","true"),n.setAttribute("data-skip","true"),this.nodes.push(n))}createOptions(){this.options=this.nodes.map(n=>({value:n.getAttribute("value")||n.textContent||"",label:n.textContent||n.getAttribute("value")||"",selected:!!n.getAttribute("selected"),disabled:!!n.getAttribute("disabled")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(n){let i=!1;n.forEach(l=>{l.type==="childList"&&(l.addedNodes.forEach(c=>{xg(c)&&(this.addNode(c),i=!0)}),l.removedNodes.forEach(c=>{xg(c)&&(this.nodes=this.nodes.filter(h=>h!==c),i=!0)}))}),i&&this.createOptions()}};var v3=Object.defineProperty,y3=Object.getOwnPropertyDescriptor,Eh=(r,n,i,l)=>{for(var c=l>1?void 0:l?y3(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&v3(n,i,c),c};let Dd=class extends Hr{constructor(){super(),this.defaultSlot=dn(),this.forId=If(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Wo.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.slotController=new xa(this,this.defaultSlot)}render(){const n=()=>{const l=!this.isHelpTextOpen;this.isHelpTextOpen=l,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:l}}))},i=()=>this.helptextDropdown?Se`<div class="pkt-inputwrapper__helptext-expandable">
|
|
583
|
+
*/const z1=(r,n,i)=>{const l=new Map;for(let c=n;c<=i;c++)l.set(r[c],c);return l},p0=Nf(class extends wh{constructor(r){if(super(r),r.type!==sl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,n,i){let l;i===void 0?i=n:n!==void 0&&(l=n);const c=[],h=[];let m=0;for(const D of r)c[m]=l?l(D,m):m,h[m]=i(D,m),m++;return{values:h,keys:c}}render(r,n,i){return this.dt(r,n,i).values}update(r,[n,i,l]){const c=kP(r),{values:h,keys:m}=this.dt(n,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,R=0,I=h.length-1;for(;N<=O&&R<=I;)if(c[N]===null)N++;else if(c[O]===null)O--;else if(D[N]===m[R])C[R]=Of(c[N],h[R]),N++,R++;else if(D[O]===m[I])C[I]=Of(c[O],h[I]),O--,I--;else if(D[N]===m[I])C[I]=Of(c[N],h[I]),_g(r,C[I+1],c[N]),N++,I--;else if(D[O]===m[R])C[R]=Of(c[O],h[R]),_g(r,c[N],c[O]),O--,R++;else if(T===void 0&&(T=z1(m,R,I),$=z1(D,N,O)),T.has(D[N]))if(T.has(D[O])){const K=$.get(m[R]),Y=K!==void 0?c[K]:null;if(Y===null){const Ce=_g(r,c[N]);Of(Ce,h[R]),C[R]=Ce}else C[R]=Of(Y,h[R]),_g(r,c[N],Y),c[K]=null;R++}else r0(c[O]),O--;else r0(c[N]),N++;for(;R<=I;){const K=_g(r,C[I+1]);Of(K,h[R]),C[R++]=K}for(;N<=O;){const K=c[N++];K!==null&&r0(K)}return this.ut=m,v1(r,C),mo}}),U1=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),If=()=>{const r=U1(),n=U1();return r.slice(0,8)+"-"+r.slice(8,12)+"-4"+r.slice(13)+"-a"+n.slice(1,4)+"-"+n.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}},Wo={props:m3};var g3=Object.defineProperty,Bn=(r,n,i,l)=>{for(var c=void 0,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=m(n,i,c)||c);return c&&g3(n,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=Wo.props.helptextDropdownButton.default,this.label=null,this.optionalText=ws.forms.labels.optional,this.requiredText=ws.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(n){var i,l,c,h,m,D,C,T;n&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},ws.forms.messages.required,n):(i=n.validity)!=null&&i.typeMismatch||(l=n.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},ws.forms.messages.invalid,n):(c=n.validity)!=null&&c.patternMismatch?this.internals.setValidity({patternMismatch:!0},ws.forms.messages.invalidPattern,n):(h=n.validity)!=null&&h.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},ws.forms.messages.tooShort,n):(m=n.validity)!=null&&m.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},ws.forms.messages.tooLong,n):(D=n.validity)!=null&&D.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},ws.forms.messages.rangeUnderflow,n):(C=n.validity)!=null&&C.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},ws.forms.messages.rangeOverflow,n):(T=n.validity)!=null&&T.customError?this.internals.setValidity({customError:!0},n.validationMessage,n):this.internals.setValidity({}))}setFormValue(n){if(this.internals)if(Array.isArray(n)){const i=new FormData;n.forEach(l=>{i.append(this.name,l)}),this.internals.setFormValue(i)}else this.internals.setFormValue(n)}valueChecked(n){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 n=="string"?(this.checked=n==="true",this.internals.ariaChecked=n==="true"):typeof n=="boolean"&&(this.checked=n,this.internals.ariaChecked=n),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(n,i){(i!==this.value||i!==this._value)&&(typeof n=="string"?((this.multiple||this.range)&&n.includes(",")&&(n=n.split(",")),this.value=n,this._value=Array.isArray(n)?n:[n]):Array.isArray(n)?(this.value=this.multiple||this.range?n:n[0],this._value=n):(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 n=this.multiple||this.range?[]:"";this.value=n,this.internals.setFormValue(n),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:n,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(n){if(!this.touched){this.touched=!0,n&&this.setFormValue(n);return}typeof n!="string"&&!Array.isArray(n)||((this.range||this.multiple)&&!Array.isArray(n)&&n.includes(",")&&(n=n.split(",")),!this.multiple&&!this.range&&Array.isArray(n)&&(n=n[0]),this.setFormValue(n),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:n,bubbles:!0,composed:!0})),this.internals.reportValidity())}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(n=>{n.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(n){super.updated(n),n.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(n){if(super.firstUpdated(n),!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(n){this.nodes=[],this.options=[],this.host=n,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(i=>this.handleMutations(i))}hostConnected(){Array.from(this.host.childNodes).forEach(n=>{(n.nodeName==="OPTION"||n.nodeName==="DATA")&&this.addNode(n)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(n){(n.nodeName==="OPTION"||n.nodeName==="DATA")&&(n.setAttribute("class","pkt-hide"),n.setAttribute("hidden","true"),n.setAttribute("data-skip","true"),this.nodes.push(n))}createOptions(){this.options=this.nodes.map(n=>({value:n.getAttribute("value")||n.textContent||"",label:n.textContent||n.getAttribute("value")||"",selected:!!n.getAttribute("selected"),disabled:!!n.getAttribute("disabled")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(n){let i=!1;n.forEach(l=>{l.type==="childList"&&(l.addedNodes.forEach(c=>{xg(c)&&(this.addNode(c),i=!0)}),l.removedNodes.forEach(c=>{xg(c)&&(this.nodes=this.nodes.filter(h=>h!==c),i=!0)}))}),i&&this.createOptions()}};var v3=Object.defineProperty,y3=Object.getOwnPropertyDescriptor,Eh=(r,n,i,l)=>{for(var c=l>1?void 0:l?y3(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&v3(n,i,c),c};let Dd=class extends Hr{constructor(){super(),this.defaultSlot=dn(),this.forId=If(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Wo.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.slotController=new xa(this,this.defaultSlot)}render(){const n=()=>{const l=!this.isHelpTextOpen;this.isHelpTextOpen=l,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:l}}))},i=()=>this.helptextDropdown?Se`<div class="pkt-inputwrapper__helptext-expandable">
|
|
584
584
|
<button
|
|
585
585
|
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
586
586
|
type="button"
|
|
@@ -1150,6 +1150,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1150
1150
|
type="radio"
|
|
1151
1151
|
role="radio"
|
|
1152
1152
|
?disabled=${this.disabled}
|
|
1153
|
+
form=""
|
|
1153
1154
|
name=${this.name+"-internal"}
|
|
1154
1155
|
${qt(this.inputRef)}
|
|
1155
1156
|
@change=${this.toggleChecked}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "12.37.
|
|
3
|
+
"version": "12.37.8",
|
|
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.37.
|
|
41
|
+
"@oslokommune/punkt-elements": "^12.37.8",
|
|
42
42
|
"angular-html-parser": "^6.0.2",
|
|
43
43
|
"html-format": "^1.1.7",
|
|
44
44
|
"prettier": "^3.3.3",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
113
113
|
},
|
|
114
114
|
"license": "MIT",
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "ff82b384dde195e97572a47eb6f9e13c5f3c9063"
|
|
116
116
|
}
|