@oslokommune/punkt-react 12.18.1 → 12.18.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.
- package/dist/punkt-react.es.js +368 -367
- package/dist/punkt-react.umd.js +1 -1
- package/package.json +3 -3
package/dist/punkt-react.umd.js
CHANGED
|
@@ -532,7 +532,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
532
532
|
${gy(this.helptextDropdown)}
|
|
533
533
|
</div>
|
|
534
534
|
</div>`:wt}
|
|
535
|
-
</div>`:wt}`}};Zf([ae({type:String,reflect:!0})],vp.prototype,"forId",2),Zf([ae({type:String,reflect:!0})],vp.prototype,"helptext",2),Zf([ae({type:String,reflect:!0})],vp.prototype,"helptextDropdown",2),Zf([ae({type:String,reflect:!0})],vp.prototype,"helptextDropdownButton",2),Zf([Ka()],vp.prototype,"isHelpTextOpen",2),vp=Zf([yi("pkt-helptext")],vp);var b3=Object.defineProperty,In=(n,r,s,u)=>{for(var f=void 0,v=n.length-1,g;v>=0;v--)(g=n[v])&&(f=g(r,s,f)||f);return f&&b3(r,s,f),f};class xn extends zi{constructor(){super(),this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=0,this.min=null,this.minlength=0,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern="",this.placeholder="",this.id=Sy(),this.counter=!1,this.hasError=!1,this.inline=!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=po.props.helptextDropdownButton.default,this.label=null,this.optionalText=zs.forms.labels.optional,this.requiredText=zs.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(r){this.required&&!this.value?this.internals.setValidity({valueMissing:!0},zs.forms.messages.required,r):r.validity.typeMismatch||r.validity.badInput?this.internals.setValidity({typeMismatch:!0},zs.forms.messages.invalid,r):r.validity.patternMismatch?this.internals.setValidity({patternMismatch:!0},zs.forms.messages.invalidPattern,r):r.validity.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},zs.forms.messages.tooShort,r):r.validity.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},zs.forms.messages.tooLong,r):r.validity.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},zs.forms.messages.rangeUnderflow,r):r.validity.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},zs.forms.messages.rangeOverflow,r):r.validity.customError?this.internals.setValidity({customError:!0},r.validationMessage,r):this.internals.setValidity({})}setFormValue(r){if(this.internals)if(Array.isArray(r)){const s=new FormData;r.forEach(u=>{s.append(this.name,u)}),this.internals.setFormValue(s)}else this.internals.setFormValue(r)}valueChanged(r,s){(s!==this.value||s!==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=r,this._value=r):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&s&&s.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(s==null?void 0:s.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")),this.dispatchEvent(new CustomEvent("value-change",{detail:r,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}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.
|
|
535
|
+
</div>`:wt}`}};Zf([ae({type:String,reflect:!0})],vp.prototype,"forId",2),Zf([ae({type:String,reflect:!0})],vp.prototype,"helptext",2),Zf([ae({type:String,reflect:!0})],vp.prototype,"helptextDropdown",2),Zf([ae({type:String,reflect:!0})],vp.prototype,"helptextDropdownButton",2),Zf([Ka()],vp.prototype,"isHelpTextOpen",2),vp=Zf([yi("pkt-helptext")],vp);var b3=Object.defineProperty,In=(n,r,s,u)=>{for(var f=void 0,v=n.length-1,g;v>=0;v--)(g=n[v])&&(f=g(r,s,f)||f);return f&&b3(r,s,f),f};class xn extends zi{constructor(){super(),this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=0,this.min=null,this.minlength=0,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern="",this.placeholder="",this.id=Sy(),this.counter=!1,this.hasError=!1,this.inline=!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=po.props.helptextDropdownButton.default,this.label=null,this.optionalText=zs.forms.labels.optional,this.requiredText=zs.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(r){var s,u,f,v,g,D,x,_;r&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},zs.forms.messages.required,r):(s=r.validity)!=null&&s.typeMismatch||(u=r.validity)!=null&&u.badInput?this.internals.setValidity({typeMismatch:!0},zs.forms.messages.invalid,r):(f=r.validity)!=null&&f.patternMismatch?this.internals.setValidity({patternMismatch:!0},zs.forms.messages.invalidPattern,r):(v=r.validity)!=null&&v.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},zs.forms.messages.tooShort,r):(g=r.validity)!=null&&g.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},zs.forms.messages.tooLong,r):(D=r.validity)!=null&&D.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},zs.forms.messages.rangeUnderflow,r):(x=r.validity)!=null&&x.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},zs.forms.messages.rangeOverflow,r):(_=r.validity)!=null&&_.customError?this.internals.setValidity({customError:!0},r.validationMessage,r):this.internals.setValidity({}))}setFormValue(r){if(this.internals)if(Array.isArray(r)){const s=new FormData;r.forEach(u=>{s.append(this.name,u)}),this.internals.setFormValue(s)}else this.internals.setFormValue(r)}valueChanged(r,s){(s!==this.value||s!==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=r,this._value=r):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&s&&s.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(s==null?void 0:s.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")),this.dispatchEvent(new CustomEvent("value-change",{detail:r,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}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")),this.dispatchEvent(new CustomEvent("value-change",{detail:r,bubbles:!0,composed:!0})),this.internals.reportValidity())}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){super.firstUpdated(r),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),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))}}In([ae({type:Boolean,reflect:!0})],xn.prototype,"disabled"),In([ae({type:Boolean,reflect:!0})],xn.prototype,"readonly"),In([ae({type:Boolean,reflect:!0})],xn.prototype,"required"),In([ae({type:Number,reflect:!0})],xn.prototype,"max"),In([ae({type:Number,reflect:!0})],xn.prototype,"maxlength"),In([ae({type:Number,reflect:!0})],xn.prototype,"min"),In([ae({type:Number,reflect:!0})],xn.prototype,"minlength"),In([ae({type:String})],xn.prototype,"ariaDescribedBy"),In([ae({type:String})],xn.prototype,"ariaLabelledby"),In([ae({type:String,reflect:!0})],xn.prototype,"name"),In([ae({type:String,reflect:!0})],xn.prototype,"pattern"),In([ae({type:String,reflect:!0})],xn.prototype,"placeholder"),In([ae({type:String,reflect:!0})],xn.prototype,"id"),In([ae({type:Boolean})],xn.prototype,"counter"),In([ae({type:Boolean})],xn.prototype,"hasError"),In([ae({type:Boolean})],xn.prototype,"inline"),In([ae({type:Boolean})],xn.prototype,"optionalTag"),In([ae({type:Boolean})],xn.prototype,"requiredTag"),In([ae({type:Boolean})],xn.prototype,"skipForwardTestid"),In([ae({type:Boolean})],xn.prototype,"useWrapper"),In([ae({type:Boolean,reflect:!0})],xn.prototype,"fullwidth"),In([ae({type:Number})],xn.prototype,"counterMaxLength"),In([ae({type:String})],xn.prototype,"errorMessage"),In([ae({type:String})],xn.prototype,"helptext"),In([ae({type:String})],xn.prototype,"helptextDropdown"),In([ae({type:String})],xn.prototype,"helptextDropdownButton"),In([ae({type:String})],xn.prototype,"label"),In([ae({type:String})],xn.prototype,"optionalText"),In([ae({type:String})],xn.prototype,"requiredText"),In([ae({type:String,attribute:"data-testid"})],xn.prototype,"dataTestid"),In([Ka()],xn.prototype,"touched");var k3=Object.defineProperty,w3=Object.getOwnPropertyDescriptor,ea=(n,r,s,u)=>{for(var f=u>1?void 0:u?w3(r,s):r,v=n.length-1,g;v>=0;v--)(g=n[v])&&(f=(u?g(r,s,f):g(f))||f);return u&&f&&k3(r,s,f),f};let Ir=class extends zi{constructor(){super(),this.defaultSlot=Xr(),this.forId=Sy(),this.label="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=po.props.helptextDropdownButton.default,this.counter=po.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.optionalTag=po.props.optionalTag.default,this.optionalText=po.props.optionalText.default,this.requiredTag=po.props.requiredTag.default,this.requiredText=po.props.requiredText.default,this.hasError=po.props.hasError.default,this.errorMessage="",this.disabled=po.props.disabled.default,this.inline=po.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=po.props.hasFieldset.default,this.useWrapper=po.props.useWrapper.default,this.slotController=new xu(this,this.defaultSlot)}render(){const r={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},s={"pkt-tag":!0,"pkt-tag--small":!0,"pkt-tag--thin-text":!0,"pkt-tag--blue-light":this.optionalTag,"pkt-tag--beige":!this.optionalTag&&this.requiredTag},u=this.helptextDropdown!=="",f={"pkt-inputwrapper__label":!0,"pkt-inputwrapper__fieldset":this.hasFieldset,"pkt-inputwrapper__legend":this.hasFieldset},v=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:wt,g=()=>this.optionalTag||this.requiredTag?Qe`<span class=${Qn(s)}
|
|
536
536
|
>${this.optionalTag?this.optionalText:this.requiredTag?this.requiredText:wt}</span
|
|
537
537
|
>`:wt,D=()=>this.useWrapper?this.hasFieldset?Qe`<legend class="pkt-inputwrapper__legend" id="${this.forId}-label">
|
|
538
538
|
${this.label} ${g()}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "12.18.
|
|
3
|
+
"version": "12.18.2",
|
|
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.5",
|
|
41
|
-
"@oslokommune/punkt-elements": "^12.18.
|
|
41
|
+
"@oslokommune/punkt-elements": "^12.18.2",
|
|
42
42
|
"angular-html-parser": "^6.0.2",
|
|
43
43
|
"html-format": "^1.1.7",
|
|
44
44
|
"prettier": "^3.3.3",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
112
112
|
},
|
|
113
113
|
"license": "MIT",
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "f61cae2389adc17b73a7e9dcb876b7a27e6f5cf7"
|
|
115
115
|
}
|