@oslokommune/punkt-react 12.3.11 → 12.3.12
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 +22 -16
- package/dist/punkt-react.umd.js +8 -8
- package/package.json +3 -3
package/dist/punkt-react.es.js
CHANGED
|
@@ -1710,15 +1710,15 @@ class Ke extends Ht {
|
|
|
1710
1710
|
}
|
|
1711
1711
|
// When user enters the input, we need to push that event out to the form
|
|
1712
1712
|
onFocus() {
|
|
1713
|
-
this.dispatchEvent(new
|
|
1713
|
+
this.dispatchEvent(new FocusEvent("focus"));
|
|
1714
1714
|
}
|
|
1715
1715
|
// And also when the user leaves the input...
|
|
1716
1716
|
onBlur() {
|
|
1717
|
-
this.dispatchEvent(new
|
|
1717
|
+
this.dispatchEvent(new FocusEvent("blur"));
|
|
1718
1718
|
}
|
|
1719
1719
|
// Trigger this when user types in the input
|
|
1720
1720
|
onInput() {
|
|
1721
|
-
this.dispatchEvent(new
|
|
1721
|
+
this.dispatchEvent(new InputEvent("input"));
|
|
1722
1722
|
}
|
|
1723
1723
|
// Trigger this when you want to set the value of the input out to the form
|
|
1724
1724
|
onChange(t) {
|
|
@@ -4799,7 +4799,7 @@ let qe = class extends Ke {
|
|
|
4799
4799
|
async connectedCallback() {
|
|
4800
4800
|
super.connectedCallback(), this.isMobileSafari = /iP(ad|od|hone)/i.test(window.navigator.userAgent) && !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), this.inputType = this.isMobileSafari ? "text" : "date", document && document.body.addEventListener("click", (e) => {
|
|
4801
4801
|
var t, n;
|
|
4802
|
-
(t = this.inputRef) != null && t.value && (n = this.btnRef) != null && n.value && !this.inputRef.value.contains(e.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(e.target)) && !this.btnRef.value.contains(e.target) && !e.target.closest(".pkt-calendar-popup") && this.hideCalendar();
|
|
4802
|
+
(t = this.inputRef) != null && t.value && (n = this.btnRef) != null && n.value && !this.inputRef.value.contains(e.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(e.target)) && !this.btnRef.value.contains(e.target) && !e.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
|
|
4803
4803
|
}), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || Yt.props.min.default, this.max = this.max || Yt.props.max.default, typeof this.excludedates == "string" && (this.excludedates = this.excludedates.split(",")), typeof this.excludeweekdays == "string" && (this.excludeweekdays = this.excludeweekdays.split(",")), (this.multiple || this.range) && this.name && !this.name.endsWith("[]") && (this.name = this.name + "[]"), this.calendarOpen && (await Ns(20), this.handleCalendarPosition());
|
|
4804
4804
|
}
|
|
4805
4805
|
disconnectedCallback() {
|
|
@@ -4850,7 +4850,8 @@ let qe = class extends Ke {
|
|
|
4850
4850
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
4851
4851
|
}}
|
|
4852
4852
|
@blur=${(e) => {
|
|
4853
|
-
|
|
4853
|
+
var t;
|
|
4854
|
+
(t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), this.manageValidity(e.target), this.value = e.target.value;
|
|
4854
4855
|
}}
|
|
4855
4856
|
@change=${(e) => {
|
|
4856
4857
|
e.stopImmediatePropagation();
|
|
@@ -4919,21 +4920,21 @@ let qe = class extends Ke {
|
|
|
4919
4920
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
4920
4921
|
}}
|
|
4921
4922
|
@blur=${(e) => {
|
|
4922
|
-
var t, n;
|
|
4923
|
-
if (this.onBlur(), e.target.value) {
|
|
4923
|
+
var t, n, r;
|
|
4924
|
+
if ((t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), e.target.value) {
|
|
4924
4925
|
this.manageValidity(e.target);
|
|
4925
|
-
const
|
|
4926
|
-
this.min && this.min >
|
|
4926
|
+
const i = e.target.value;
|
|
4927
|
+
this.min && this.min > i ? this.internals.setValidity(
|
|
4927
4928
|
{ rangeUnderflow: !0 },
|
|
4928
4929
|
this.strings.forms.messages.rangeUnderflow,
|
|
4929
4930
|
e.target
|
|
4930
|
-
) : this.max && this.max <
|
|
4931
|
+
) : this.max && this.max < i && this.internals.setValidity(
|
|
4931
4932
|
{ rangeOverflow: !0 },
|
|
4932
4933
|
this.strings.forms.messages.rangeOverflow,
|
|
4933
4934
|
e.target
|
|
4934
4935
|
);
|
|
4935
|
-
const
|
|
4936
|
-
|
|
4936
|
+
const o = this.fromISOToDate(e.target.value);
|
|
4937
|
+
o && this._value[1] !== this.formatISODate(o) && ((r = (n = this.calRef) == null ? void 0 : n.value) == null || r.handleDateSelect(o));
|
|
4937
4938
|
}
|
|
4938
4939
|
}}
|
|
4939
4940
|
@change=${(e) => {
|
|
@@ -4955,7 +4956,8 @@ let qe = class extends Ke {
|
|
|
4955
4956
|
e.preventDefault(), this.showCalendar();
|
|
4956
4957
|
}}
|
|
4957
4958
|
@blur=${(e) => {
|
|
4958
|
-
|
|
4959
|
+
var t;
|
|
4960
|
+
(t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), this.addToSelected(e);
|
|
4959
4961
|
}}
|
|
4960
4962
|
@input=${(e) => {
|
|
4961
4963
|
this.onInput(), e.stopImmediatePropagation();
|
|
@@ -4998,7 +5000,9 @@ let qe = class extends Ke {
|
|
|
4998
5000
|
renderCalendar() {
|
|
4999
5001
|
return J`<div
|
|
5000
5002
|
class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
|
|
5001
|
-
@focusout=${
|
|
5003
|
+
@focusout=${(e) => {
|
|
5004
|
+
this.calendarOpen && this.handleFocusOut(e);
|
|
5005
|
+
}}
|
|
5002
5006
|
id="${this.id}-popup"
|
|
5003
5007
|
${ct(this.popupRef)}
|
|
5004
5008
|
>
|
|
@@ -5017,7 +5021,9 @@ let qe = class extends Ke {
|
|
|
5017
5021
|
@date-selected=${(e) => {
|
|
5018
5022
|
this.value = !this.multiple && !this.range ? e.detail[0] : e.detail, this._value = e.detail, this.inputRef.value && (this.range && this.inputRefTo.value ? (this.inputRef.value.value = this._value[0] ?? "", this.inputRefTo.value.value = this._value[1] ?? "") : this.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : ""));
|
|
5019
5023
|
}}
|
|
5020
|
-
@close=${
|
|
5024
|
+
@close=${() => {
|
|
5025
|
+
this.onBlur(), this.hideCalendar();
|
|
5026
|
+
}}
|
|
5021
5027
|
${ct(this.calRef)}
|
|
5022
5028
|
></pkt-calendar>
|
|
5023
5029
|
</div>`;
|
|
@@ -5075,7 +5081,7 @@ let qe = class extends Ke {
|
|
|
5075
5081
|
}
|
|
5076
5082
|
}
|
|
5077
5083
|
handleFocusOut(e) {
|
|
5078
|
-
this.contains(e.target) || this.hideCalendar();
|
|
5084
|
+
this.contains(e.target) || (this.onBlur(), this.hideCalendar());
|
|
5079
5085
|
}
|
|
5080
5086
|
async showCalendar() {
|
|
5081
5087
|
var e;
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -96,7 +96,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
96
96
|
* @license
|
|
97
97
|
* Copyright 2017 Google LLC
|
|
98
98
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
99
|
-
*/function Pr(e){return O({...e,state:!0,attribute:!1})}for(var Xe=[],es=0;es<256;++es)Xe.push((es+256).toString(16).slice(1));function Sh(e,t=0){return(Xe[e[t+0]]+Xe[e[t+1]]+Xe[e[t+2]]+Xe[e[t+3]]+"-"+Xe[e[t+4]]+Xe[e[t+5]]+"-"+Xe[e[t+6]]+Xe[e[t+7]]+"-"+Xe[e[t+8]]+Xe[e[t+9]]+"-"+Xe[e[t+10]]+Xe[e[t+11]]+Xe[e[t+12]]+Xe[e[t+13]]+Xe[e[t+14]]+Xe[e[t+15]]).toLowerCase()}var $a,Eh=new Uint8Array(16);function Fh(){if(!$a&&($a=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!$a))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $a(Eh)}var Ah=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Bl={randomUUID:Ah};function Nl(e,t,n){if(Bl.randomUUID&&!t&&!e)return Bl.randomUUID();e=e||{};var r=e.random||(e.rng||Fh)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Sh(r)}const $h={hi:"Hei!"},Th={buttonAltText:"Åpne kalender"},Bh={days:["Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag","Søndag"],daysShort:["Man","Tir","Ons","Tor","Fre","Lør","Søn"],months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],monthsShort:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],week:"Uke",prevMonth:"Forrige måned",nextMonth:"Neste måned"},Nh={labels:{optional:"Valgfritt",required:"Må fylles ut"},messages:{required:"Dette feltet er påkrevd",invalid:"Ugyldig verdi",invalidPattern:"Ugyldig format",tooShort:"For kort",tooLong:"For lang",rangeUnderflow:"For lav verdi",rangeOverflow:"For høy verdi",dateUnderflow:"For tidlig dato",dateOverflow:"For sen dato"},date:{multiple:"Her kan du velge flere datoer. Trykk komma eller enter når du har skrevet inn en dato."}},$t={example:$h,calendar:Th,dates:Bh,forms:Nh};var jh=Object.defineProperty,ze=(e,t,n,r)=>{for(var i=void 0,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=u(t,n,i)||i);return i&&jh(t,n,i),i};let jt=class extends jr{constructor(){super(),this.strings=$t}connectedCallback(){super.connectedCallback()}createRenderRoot(){return this}hotReplacedCallback(){this.requestUpdate()}};ze([O({type:Object})],jt.prototype,"strings");class Ve extends jt{constructor(){super(),this.id=Nl(),this.name=this.id,this.required=!1,this.disabled=!1,this.placeholder="",this.min=null,this.max=null,this.minlength=0,this.maxlength=0,this.pattern="",this.optionalTag=!1,this.optionalText=$t.forms.labels.optional,this.requiredTag=!1,this.requiredText=$t.forms.labels.required,this.hasError=!1,this.errorMessage="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){this.required&&!this.value?this.internals.setValidity({valueMissing:!0},$t.forms.messages.required,t):t.validity.typeMismatch||t.validity.badInput?this.internals.setValidity({typeMismatch:!0},$t.forms.messages.invalid,t):t.validity.patternMismatch?this.internals.setValidity({patternMismatch:!0},$t.forms.messages.invalidPattern,t):t.validity.tooShort||this.minLength>0&&this.value.length<this.minLength?this.internals.setValidity({tooShort:!0},$t.forms.messages.tooShort,t):t.validity.tooLong||this.maxLength>0&&this.value.length>this.maxLength?this.internals.setValidity({tooLong:!0},$t.forms.messages.tooLong,t):t.validity.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},$t.forms.messages.rangeUnderflow,t):t.validity.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},$t.forms.messages.rangeOverflow,t):t.validity.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({})}setFormValue(t){if(this.internals)if(Array.isArray(t)){const n=new FormData;t.forEach(r=>{n.append(this.name,r)}),this.internals.setFormValue(n)}else this.internals.setFormValue(t)}valueChanged(t,n){typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=t,this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&n&&n.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(n==null?void 0:n.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate())}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new
|
|
99
|
+
*/function Pr(e){return O({...e,state:!0,attribute:!1})}for(var Xe=[],es=0;es<256;++es)Xe.push((es+256).toString(16).slice(1));function Sh(e,t=0){return(Xe[e[t+0]]+Xe[e[t+1]]+Xe[e[t+2]]+Xe[e[t+3]]+"-"+Xe[e[t+4]]+Xe[e[t+5]]+"-"+Xe[e[t+6]]+Xe[e[t+7]]+"-"+Xe[e[t+8]]+Xe[e[t+9]]+"-"+Xe[e[t+10]]+Xe[e[t+11]]+Xe[e[t+12]]+Xe[e[t+13]]+Xe[e[t+14]]+Xe[e[t+15]]).toLowerCase()}var $a,Eh=new Uint8Array(16);function Fh(){if(!$a&&($a=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!$a))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $a(Eh)}var Ah=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Bl={randomUUID:Ah};function Nl(e,t,n){if(Bl.randomUUID&&!t&&!e)return Bl.randomUUID();e=e||{};var r=e.random||(e.rng||Fh)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Sh(r)}const $h={hi:"Hei!"},Th={buttonAltText:"Åpne kalender"},Bh={days:["Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag","Søndag"],daysShort:["Man","Tir","Ons","Tor","Fre","Lør","Søn"],months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],monthsShort:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],week:"Uke",prevMonth:"Forrige måned",nextMonth:"Neste måned"},Nh={labels:{optional:"Valgfritt",required:"Må fylles ut"},messages:{required:"Dette feltet er påkrevd",invalid:"Ugyldig verdi",invalidPattern:"Ugyldig format",tooShort:"For kort",tooLong:"For lang",rangeUnderflow:"For lav verdi",rangeOverflow:"For høy verdi",dateUnderflow:"For tidlig dato",dateOverflow:"For sen dato"},date:{multiple:"Her kan du velge flere datoer. Trykk komma eller enter når du har skrevet inn en dato."}},$t={example:$h,calendar:Th,dates:Bh,forms:Nh};var jh=Object.defineProperty,ze=(e,t,n,r)=>{for(var i=void 0,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=u(t,n,i)||i);return i&&jh(t,n,i),i};let jt=class extends jr{constructor(){super(),this.strings=$t}connectedCallback(){super.connectedCallback()}createRenderRoot(){return this}hotReplacedCallback(){this.requestUpdate()}};ze([O({type:Object})],jt.prototype,"strings");class Ve extends jt{constructor(){super(),this.id=Nl(),this.name=this.id,this.required=!1,this.disabled=!1,this.placeholder="",this.min=null,this.max=null,this.minlength=0,this.maxlength=0,this.pattern="",this.optionalTag=!1,this.optionalText=$t.forms.labels.optional,this.requiredTag=!1,this.requiredText=$t.forms.labels.required,this.hasError=!1,this.errorMessage="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){this.required&&!this.value?this.internals.setValidity({valueMissing:!0},$t.forms.messages.required,t):t.validity.typeMismatch||t.validity.badInput?this.internals.setValidity({typeMismatch:!0},$t.forms.messages.invalid,t):t.validity.patternMismatch?this.internals.setValidity({patternMismatch:!0},$t.forms.messages.invalidPattern,t):t.validity.tooShort||this.minLength>0&&this.value.length<this.minLength?this.internals.setValidity({tooShort:!0},$t.forms.messages.tooShort,t):t.validity.tooLong||this.maxLength>0&&this.value.length>this.maxLength?this.internals.setValidity({tooLong:!0},$t.forms.messages.tooLong,t):t.validity.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},$t.forms.messages.rangeUnderflow,t):t.validity.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},$t.forms.messages.rangeOverflow,t):t.validity.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({})}setFormValue(t){if(this.internals)if(Array.isArray(t)){const n=new FormData;t.forEach(r=>{n.append(this.name,r)}),this.internals.setFormValue(n)}else this.internals.setFormValue(t)}valueChanged(t,n){typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=t,this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&n&&n.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(n==null?void 0:n.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate())}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}onChange(t){if(!this.touched){this.touched=!0,t&&this.setFormValue(t);return}typeof t!="string"&&!Array.isArray(t)||((this.range||this.multiple)&&!Array.isArray(t)&&t.includes(",")&&(t=t.split(",")),!this.multiple&&!this.range&&Array.isArray(t)&&(t=t[0]),this.setFormValue(t),this.manageValidity(this.inputRef.value),this.inputRef2&&this.manageValidity(this.inputRef2.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})),this.internals.reportValidity())}firstUpdated(t){super.firstUpdated(t),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.disabled=!0,this.internals.ariaDisabled=!0),this.internals.setFormValue(this.value),this.manageValidity(this.inputRef.value)}}ze([O({type:String,reflect:!0})],Ve.prototype,"id"),ze([O({type:String,reflect:!0})],Ve.prototype,"name"),ze([O({type:Boolean,reflect:!0})],Ve.prototype,"required"),ze([O({type:Boolean,reflect:!0})],Ve.prototype,"disabled"),ze([O({type:String,reflect:!0})],Ve.prototype,"placeholder"),ze([O({type:Number,reflect:!0})],Ve.prototype,"min"),ze([O({type:Number,reflect:!0})],Ve.prototype,"max"),ze([O({type:Number,reflect:!0})],Ve.prototype,"minlength"),ze([O({type:Number,reflect:!0})],Ve.prototype,"maxlength"),ze([O({type:String,reflect:!0})],Ve.prototype,"pattern"),ze([O({type:Boolean,reflect:!0})],Ve.prototype,"optionalTag"),ze([O({type:String,reflect:!0})],Ve.prototype,"optionalText"),ze([O({type:Boolean,reflect:!0})],Ve.prototype,"requiredTag"),ze([O({type:String,reflect:!0})],Ve.prototype,"requiredText"),ze([O({type:Boolean,reflect:!0})],Ve.prototype,"hasError"),ze([O({type:String,reflect:!0})],Ve.prototype,"errorMessage"),ze([Pr()],Ve.prototype,"touched");const jl=e=>{if(Array.isArray(e))return e;if(typeof e=="string")return e.split(",")},Ph=e=>e?new Date(e):null,Lh=e=>{if(typeof e=="string")return e.split(",").map(t=>new Date(t));if(Array.isArray(e))return e.map(t=>new Date(t))},Qn={csvToArray:jl,stringToDate:Ph,stringsToDate:Lh};/**
|
|
100
100
|
* @license
|
|
101
101
|
* Copyright 2017 Google LLC
|
|
102
102
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -345,7 +345,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
345
345
|
* @license
|
|
346
346
|
* Copyright 2017 Google LLC
|
|
347
347
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
348
|
-
*/const Kl=(e,t,n)=>{const r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},Fm=Lr(class extends Ba{constructor(e){if(super(e),e.type!==Ta.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);const i=[],o=[];let u=0;for(const c of e)i[u]=r?r(c,u):u,o[u]=n(c,u),u++;return{values:o,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,r]){const i=ef(e),{values:o,keys:u}=this.dt(t,n,r);if(!Array.isArray(i))return this.ut=u,o;const c=this.ut??(this.ut=[]),d=[];let h,g,v=0,D=i.length-1,b=0,k=o.length-1;for(;v<=D&&b<=k;)if(i[v]===null)v++;else if(i[D]===null)D--;else if(c[v]===u[b])d[b]=$n(i[v],o[b]),v++,b++;else if(c[D]===u[k])d[k]=$n(i[D],o[k]),D--,k--;else if(c[v]===u[k])d[k]=$n(i[v],o[k]),Mr(e,d[k+1],i[v]),v++,k--;else if(c[D]===u[b])d[b]=$n(i[D],o[b]),Mr(e,i[v],i[D]),D--,b++;else if(h===void 0&&(h=Kl(u,b,k),g=Kl(c,v,D)),h.has(c[v]))if(h.has(c[D])){const x=g.get(u[b]),C=x!==void 0?i[x]:null;if(C===null){const T=Mr(e,i[v]);$n(T,o[b]),d[b]=T}else d[b]=$n(C,o[b]),Mr(e,i[v],C),i[x]=null;b++}else as(i[D]),D--;else as(i[v]),v++;for(;b<=k;){const x=Mr(e,d[k+1]);$n(x,o[b]),d[b++]=x}for(;v<=D;){const x=i[v++];x!==null&&as(x)}return this.ut=u,Zh(e,d),Vt}}),Am="pkt-datepicker",$m=!0,Tm={name:{type:"string",name:"Navn",description:"Navn som sendes brukes i skjema ved innsending"},label:{type:"string",name:"Etikett",description:"Tekst som vises over datovelgeren"},helptext:{type:"string",name:"Hjelpetekst",description:"Hjelpetekst som vises over datovelgeren"},helptextDropdown:{type:"string",name:"Utvidet hjelpetekst",description:"Hjelpetekst som vises i en lukket boks man kan åpne"},helptextDropdownButton:{type:"string",name:"Knappetekst for hjelpetekst",description:"Tekst som vises på knappen for å åpne/lukke utvidet hjelpetekst",default:"Les mer"},dateformat:{name:"Datoformat",description:"Datoformat for valgte datoer i flervalgsmodus",type:"string",default:"dd.MM.yyyy"},currentmonth:{name:"Nåværende måned",type:"ISOdatestring",description:"Måneden som skal vises i datovelgeren"},value:{name:"Verdi",type:"ISOdatestring",variant:"multiple",reflect:!0,description:"Kommaseparert liste av valgte datoer"},excludeweekdays:{name:"Utelat ukedager",type:"string",description:"Kommaseparert liste over ukedager (1-7) som skal ekskluderes"},excludedates:{name:"Utelat datoer",type:"ISOdatestring",variant:"multiple",description:"Kommaseparert liste over datoer som skal ekskluderes"},min:{name:"Tidligst tillatt",type:"ISOdatestring",default:null,description:"Første tillate dato i datovelgeren"},max:{name:"Senest tillatt",type:"ISOdatestring",default:null,description:"Siste tillate dato i datovelgeren"},weeknumbers:{name:"Vis ukenummer",type:"boolean",reflect:!0,default:!1,description:"Vis ukedager i datovelgerens kalender"},withcontrols:{name:"Med kontroller",type:"boolean",reflect:!0,default:!1,description:"Vis avanserte velgere for måned og år"},multiple:{name:"Flervalg",type:"boolean",reflect:!0,default:!1,description:"Tillat valg av flere enn én dato i samme velger"},maxlength:{name:"Maks antall",description:"Maks valgte datoer i flervalgsmodus",type:"number",default:4},range:{name:"Datotidsrom",type:"boolean",reflect:!0,default:!1,description:"Tillat å velge et tidsrom mellom to datoer i samme velger"},hasError:{type:"boolean",name:"Feil",description:"Viser feiltilstand for datovelgeren"},errorMessage:{type:"string",name:"Feilmelding",description:"Tekst som vises under datovelgeren ved feiltilstand"},disabled:{type:"boolean",name:"Deaktivert",default:!1,reflect:!0,description:"Er datovelgeren deaktivert?"},fullwidth:{type:"boolean",name:"Full bredde",default:!1,reflect:!0,description:"Skal datovelgeren ta opp hele bredden?"},required:{type:"boolean",name:"Påkrevd",default:!1,reflect:!0,description:"Er datovelgeren påkrevd?"},requiredTag:{type:"boolean",name:"Vise påkrevd-merking",default:!1,description:"Viser en merking som indikerer at datovelgeren er påkrevd"},requiredText:{type:"string",name:"Påkrevd-tekst",default:"Må fylles ut",description:"Tekst som vises i påkrevd-merkingen"},optionalTag:{type:"boolean",name:"Vise valgfritt-merking",default:!1,description:"Viser en merking som indikerer at datovelgeren er valgfri"},optionalText:{type:"string",name:"Valgfritt-tekst",default:"Valgfritt",description:"Tekst som vises i valgfritt-merkingen"},id:{type:"string",name:"ID",description:"Unik identifikasjon for datovelgeren"}},Bm={change:{type:"Event",description:"Returnerer valgt dato som streng i ISO-format"},"value-change":{type:"CustomEvent",description:"Returnerer en <code>array</code> med valgte datoer i ISO-format"},toggleHelpText:{type:"CustomEvent",description:"Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"}},Jt={name:Am,"css-class":"pkt-datepicker",isElement:$m,props:Tm,events:Bm};var Nm=Object.defineProperty,jm=Object.getOwnPropertyDescriptor,Ye=(e,t,n,r)=>{for(var i=r>1?void 0:r?jm(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&Nm(t,n,i),i};const ls=e=>new Promise(t=>setTimeout(t,e));let Ie=class extends Ve{constructor(){super(...arguments),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Jt.props.helptextDropdownButton.default,this.dateformat=Jt.props.dateformat.default,this.multiple=Jt.props.multiple.default,this.maxlength=Jt.props.maxlength.default,this.range=Jt.props.range.default,this.weeknumbers=Jt.props.weeknumbers.default,this.withcontrols=Jt.props.withcontrols.default,this.fullwidth=!1,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=this.formatISODate(new Date),this.calendarOpen=!1,this.inputRef=_t(),this.inputRefTo=_t(),this.btnRef=_t(),this.calRef=_t(),this.popupRef=_t(),this.inputClasses={"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":this.fullwidth},this.buttonClasses={"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0},this.fromISOToDate=e=>{if(!e)return null;const t=new Date(e);return t.setHours(12,0,0,0),isNaN(t.getTime())?null:t},this.fromISOtoLocal=e=>{const t=new Date(e);return isNaN(t.getTime())?"":Sm(t,this.dateformat)},this.massageDates=e=>{const t=e.map(n=>n??void 0);return this.multiple?t:this.range?t.slice(0,2):[t[0]]},this.addToSelected=e=>{const t=e.target,n=this.min?new Date(this.min):null,r=this.max?new Date(this.max):null,i=new Date(t.value.split(",")[0]);i.setHours(12,0,0,0),i&&!isNaN(i.getTime())&&(!n||i>=n)&&(!r||i<=r)&&this.calRef.value&&this.calRef.value.handleDateSelect(i),t.value=""}}async connectedCallback(){super.connectedCallback(),this.isMobileSafari=/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&!!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/),this.inputType=this.isMobileSafari?"text":"date",document&&document.body.addEventListener("click",e=>{var t,n;(t=this.inputRef)!=null&&t.value&&(n=this.btnRef)!=null&&n.value&&!this.inputRef.value.contains(e.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(e.target))&&!this.btnRef.value.contains(e.target)&&!e.target.closest(".pkt-calendar-popup")&&this.hideCalendar()}),this.value.length&&this._value.length===0&&(this._value=Array.isArray(this.value)?this.value:this.value.split(",")),this.min=this.min||Jt.props.min.default,this.max=this.max||Jt.props.max.default,typeof this.excludedates=="string"&&(this.excludedates=this.excludedates.split(",")),typeof this.excludeweekdays=="string"&&(this.excludeweekdays=this.excludeweekdays.split(",")),(this.multiple||this.range)&&this.name&&!this.name.endsWith("[]")&&(this.name=this.name+"[]"),this.calendarOpen&&(await ls(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",e=>{var t,n;(t=this.inputRef)!=null&&t.value&&(n=this.btnRef)!=null&&n.value&&!this.inputRef.value.contains(e.target)&&!this.btnRef.value.contains(e.target)&&this.hideCalendar()})}attributeChangedCallback(e,t,n){e==="value"&&this.valueChanged(this.value,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(n==null?void 0:n.split(","))??[]),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(n==null?void 0:n.split(","))??[]),super.attributeChangedCallback(e,t,n)}firstUpdated(e){super.firstUpdated(e)}updated(e){if(super.updated(e),e.has("value")){if(this.range&&this._value.length===1)return;this.valueChanged(this.value,e.get("value"))}}formatISODate(e){return e.toISOString().split("T")[0]}renderInput(){return J`
|
|
348
|
+
*/const Kl=(e,t,n)=>{const r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},Fm=Lr(class extends Ba{constructor(e){if(super(e),e.type!==Ta.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);const i=[],o=[];let u=0;for(const c of e)i[u]=r?r(c,u):u,o[u]=n(c,u),u++;return{values:o,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,r]){const i=ef(e),{values:o,keys:u}=this.dt(t,n,r);if(!Array.isArray(i))return this.ut=u,o;const c=this.ut??(this.ut=[]),d=[];let h,g,v=0,D=i.length-1,b=0,k=o.length-1;for(;v<=D&&b<=k;)if(i[v]===null)v++;else if(i[D]===null)D--;else if(c[v]===u[b])d[b]=$n(i[v],o[b]),v++,b++;else if(c[D]===u[k])d[k]=$n(i[D],o[k]),D--,k--;else if(c[v]===u[k])d[k]=$n(i[v],o[k]),Mr(e,d[k+1],i[v]),v++,k--;else if(c[D]===u[b])d[b]=$n(i[D],o[b]),Mr(e,i[v],i[D]),D--,b++;else if(h===void 0&&(h=Kl(u,b,k),g=Kl(c,v,D)),h.has(c[v]))if(h.has(c[D])){const x=g.get(u[b]),C=x!==void 0?i[x]:null;if(C===null){const T=Mr(e,i[v]);$n(T,o[b]),d[b]=T}else d[b]=$n(C,o[b]),Mr(e,i[v],C),i[x]=null;b++}else as(i[D]),D--;else as(i[v]),v++;for(;b<=k;){const x=Mr(e,d[k+1]);$n(x,o[b]),d[b++]=x}for(;v<=D;){const x=i[v++];x!==null&&as(x)}return this.ut=u,Zh(e,d),Vt}}),Am="pkt-datepicker",$m=!0,Tm={name:{type:"string",name:"Navn",description:"Navn som sendes brukes i skjema ved innsending"},label:{type:"string",name:"Etikett",description:"Tekst som vises over datovelgeren"},helptext:{type:"string",name:"Hjelpetekst",description:"Hjelpetekst som vises over datovelgeren"},helptextDropdown:{type:"string",name:"Utvidet hjelpetekst",description:"Hjelpetekst som vises i en lukket boks man kan åpne"},helptextDropdownButton:{type:"string",name:"Knappetekst for hjelpetekst",description:"Tekst som vises på knappen for å åpne/lukke utvidet hjelpetekst",default:"Les mer"},dateformat:{name:"Datoformat",description:"Datoformat for valgte datoer i flervalgsmodus",type:"string",default:"dd.MM.yyyy"},currentmonth:{name:"Nåværende måned",type:"ISOdatestring",description:"Måneden som skal vises i datovelgeren"},value:{name:"Verdi",type:"ISOdatestring",variant:"multiple",reflect:!0,description:"Kommaseparert liste av valgte datoer"},excludeweekdays:{name:"Utelat ukedager",type:"string",description:"Kommaseparert liste over ukedager (1-7) som skal ekskluderes"},excludedates:{name:"Utelat datoer",type:"ISOdatestring",variant:"multiple",description:"Kommaseparert liste over datoer som skal ekskluderes"},min:{name:"Tidligst tillatt",type:"ISOdatestring",default:null,description:"Første tillate dato i datovelgeren"},max:{name:"Senest tillatt",type:"ISOdatestring",default:null,description:"Siste tillate dato i datovelgeren"},weeknumbers:{name:"Vis ukenummer",type:"boolean",reflect:!0,default:!1,description:"Vis ukedager i datovelgerens kalender"},withcontrols:{name:"Med kontroller",type:"boolean",reflect:!0,default:!1,description:"Vis avanserte velgere for måned og år"},multiple:{name:"Flervalg",type:"boolean",reflect:!0,default:!1,description:"Tillat valg av flere enn én dato i samme velger"},maxlength:{name:"Maks antall",description:"Maks valgte datoer i flervalgsmodus",type:"number",default:4},range:{name:"Datotidsrom",type:"boolean",reflect:!0,default:!1,description:"Tillat å velge et tidsrom mellom to datoer i samme velger"},hasError:{type:"boolean",name:"Feil",description:"Viser feiltilstand for datovelgeren"},errorMessage:{type:"string",name:"Feilmelding",description:"Tekst som vises under datovelgeren ved feiltilstand"},disabled:{type:"boolean",name:"Deaktivert",default:!1,reflect:!0,description:"Er datovelgeren deaktivert?"},fullwidth:{type:"boolean",name:"Full bredde",default:!1,reflect:!0,description:"Skal datovelgeren ta opp hele bredden?"},required:{type:"boolean",name:"Påkrevd",default:!1,reflect:!0,description:"Er datovelgeren påkrevd?"},requiredTag:{type:"boolean",name:"Vise påkrevd-merking",default:!1,description:"Viser en merking som indikerer at datovelgeren er påkrevd"},requiredText:{type:"string",name:"Påkrevd-tekst",default:"Må fylles ut",description:"Tekst som vises i påkrevd-merkingen"},optionalTag:{type:"boolean",name:"Vise valgfritt-merking",default:!1,description:"Viser en merking som indikerer at datovelgeren er valgfri"},optionalText:{type:"string",name:"Valgfritt-tekst",default:"Valgfritt",description:"Tekst som vises i valgfritt-merkingen"},id:{type:"string",name:"ID",description:"Unik identifikasjon for datovelgeren"}},Bm={change:{type:"Event",description:"Returnerer valgt dato som streng i ISO-format"},"value-change":{type:"CustomEvent",description:"Returnerer en <code>array</code> med valgte datoer i ISO-format"},toggleHelpText:{type:"CustomEvent",description:"Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"}},Jt={name:Am,"css-class":"pkt-datepicker",isElement:$m,props:Tm,events:Bm};var Nm=Object.defineProperty,jm=Object.getOwnPropertyDescriptor,Ye=(e,t,n,r)=>{for(var i=r>1?void 0:r?jm(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&Nm(t,n,i),i};const ls=e=>new Promise(t=>setTimeout(t,e));let Ie=class extends Ve{constructor(){super(...arguments),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Jt.props.helptextDropdownButton.default,this.dateformat=Jt.props.dateformat.default,this.multiple=Jt.props.multiple.default,this.maxlength=Jt.props.maxlength.default,this.range=Jt.props.range.default,this.weeknumbers=Jt.props.weeknumbers.default,this.withcontrols=Jt.props.withcontrols.default,this.fullwidth=!1,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=this.formatISODate(new Date),this.calendarOpen=!1,this.inputRef=_t(),this.inputRefTo=_t(),this.btnRef=_t(),this.calRef=_t(),this.popupRef=_t(),this.inputClasses={"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":this.fullwidth},this.buttonClasses={"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0},this.fromISOToDate=e=>{if(!e)return null;const t=new Date(e);return t.setHours(12,0,0,0),isNaN(t.getTime())?null:t},this.fromISOtoLocal=e=>{const t=new Date(e);return isNaN(t.getTime())?"":Sm(t,this.dateformat)},this.massageDates=e=>{const t=e.map(n=>n??void 0);return this.multiple?t:this.range?t.slice(0,2):[t[0]]},this.addToSelected=e=>{const t=e.target,n=this.min?new Date(this.min):null,r=this.max?new Date(this.max):null,i=new Date(t.value.split(",")[0]);i.setHours(12,0,0,0),i&&!isNaN(i.getTime())&&(!n||i>=n)&&(!r||i<=r)&&this.calRef.value&&this.calRef.value.handleDateSelect(i),t.value=""}}async connectedCallback(){super.connectedCallback(),this.isMobileSafari=/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&!!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/),this.inputType=this.isMobileSafari?"text":"date",document&&document.body.addEventListener("click",e=>{var t,n;(t=this.inputRef)!=null&&t.value&&(n=this.btnRef)!=null&&n.value&&!this.inputRef.value.contains(e.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(e.target))&&!this.btnRef.value.contains(e.target)&&!e.target.closest(".pkt-calendar-popup")&&this.calendarOpen&&(this.onBlur(),this.hideCalendar())}),this.value.length&&this._value.length===0&&(this._value=Array.isArray(this.value)?this.value:this.value.split(",")),this.min=this.min||Jt.props.min.default,this.max=this.max||Jt.props.max.default,typeof this.excludedates=="string"&&(this.excludedates=this.excludedates.split(",")),typeof this.excludeweekdays=="string"&&(this.excludeweekdays=this.excludeweekdays.split(",")),(this.multiple||this.range)&&this.name&&!this.name.endsWith("[]")&&(this.name=this.name+"[]"),this.calendarOpen&&(await ls(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",e=>{var t,n;(t=this.inputRef)!=null&&t.value&&(n=this.btnRef)!=null&&n.value&&!this.inputRef.value.contains(e.target)&&!this.btnRef.value.contains(e.target)&&this.hideCalendar()})}attributeChangedCallback(e,t,n){e==="value"&&this.valueChanged(this.value,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(n==null?void 0:n.split(","))??[]),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(n==null?void 0:n.split(","))??[]),super.attributeChangedCallback(e,t,n)}firstUpdated(e){super.firstUpdated(e)}updated(e){if(super.updated(e),e.has("value")){if(this.range&&this._value.length===1)return;this.valueChanged(this.value,e.get("value"))}}formatISODate(e){return e.toISOString().split("T")[0]}renderInput(){return J`
|
|
349
349
|
<input
|
|
350
350
|
class="${Ge(this.inputClasses)}"
|
|
351
351
|
.type=${this.inputType}
|
|
@@ -358,7 +358,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
358
358
|
@keydown=${e=>{var t;(e.key===","||e.key==="Enter")&&((t=this.inputRef.value)==null||t.blur())}}
|
|
359
359
|
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
360
360
|
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
361
|
-
@blur=${e=>{this.onBlur(),this.manageValidity(e.target),this.value=e.target.value}}
|
|
361
|
+
@blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),this.manageValidity(e.target),this.value=e.target.value}}
|
|
362
362
|
@change=${e=>{e.stopImmediatePropagation()}}
|
|
363
363
|
${ot(this.inputRef)}
|
|
364
364
|
/>
|
|
@@ -393,7 +393,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
393
393
|
@keydown=${e=>{var t;(e.key===","||e.key==="Enter")&&((t=this.inputRefTo.value)==null||t.blur())}}
|
|
394
394
|
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
395
395
|
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
396
|
-
@blur=${e=>{var t,n;if(this.onBlur(),e.target.value){this.manageValidity(e.target);const
|
|
396
|
+
@blur=${e=>{var t,n,r;if((t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),e.target.value){this.manageValidity(e.target);const i=e.target.value;this.min&&this.min>i?this.internals.setValidity({rangeUnderflow:!0},this.strings.forms.messages.rangeUnderflow,e.target):this.max&&this.max<i&&this.internals.setValidity({rangeOverflow:!0},this.strings.forms.messages.rangeOverflow,e.target);const o=this.fromISOToDate(e.target.value);o&&this._value[1]!==this.formatISODate(o)&&((r=(n=this.calRef)==null?void 0:n.value)==null||r.handleDateSelect(o))}}}
|
|
397
397
|
@change=${e=>{e.stopImmediatePropagation()}}
|
|
398
398
|
${ot(this.inputRefTo)}
|
|
399
399
|
/>
|
|
@@ -405,7 +405,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
405
405
|
min=${this.min}
|
|
406
406
|
max=${this.max}
|
|
407
407
|
@click=${e=>{e.preventDefault(),this.showCalendar()}}
|
|
408
|
-
@blur=${e=>{this.onBlur(),this.addToSelected(e)}}
|
|
408
|
+
@blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),this.addToSelected(e)}}
|
|
409
409
|
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
410
410
|
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
411
411
|
@keydown=${e=>{(e.key===","||e.key==="Enter")&&(e.preventDefault(),this.addToSelected(e))}}
|
|
@@ -426,7 +426,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
426
426
|
</div>
|
|
427
427
|
`}renderCalendar(){return J`<div
|
|
428
428
|
class="pkt-calendar-popup pkt-${this.calendarOpen?"show":"hide"}"
|
|
429
|
-
@focusout=${this.handleFocusOut}
|
|
429
|
+
@focusout=${e=>{this.calendarOpen&&this.handleFocusOut(e)}}
|
|
430
430
|
id="${this.id}-popup"
|
|
431
431
|
${ot(this.popupRef)}
|
|
432
432
|
>
|
|
@@ -443,7 +443,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
443
443
|
.excludeweekdays=${this.excludeweekdays}
|
|
444
444
|
.currentmonth=${new Date(this.currentmonth)}
|
|
445
445
|
@date-selected=${e=>{this.value=!this.multiple&&!this.range?e.detail[0]:e.detail,this._value=e.detail,this.inputRef.value&&(this.range&&this.inputRefTo.value?(this.inputRef.value.value=this._value[0]??"",this.inputRefTo.value.value=this._value[1]??""):this.multiple||(this.inputRef.value.value=this._value.length?this._value[0]:""))}}
|
|
446
|
-
@close=${this.hideCalendar}
|
|
446
|
+
@close=${()=>{this.onBlur(),this.hideCalendar()}}
|
|
447
447
|
${ot(this.calRef)}
|
|
448
448
|
></pkt-calendar>
|
|
449
449
|
</div>`}render(){return J`
|
|
@@ -484,7 +484,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
484
484
|
</div>
|
|
485
485
|
</pkt-input-wrapper>
|
|
486
486
|
${this.renderCalendar()}
|
|
487
|
-
`}handleCalendarPosition(){var e;if(this.popupRef.value&&this.inputRef.value){const t=this.multiple&&!!this.maxlength,n=((e=this.inputRef.value.parentElement)==null?void 0:e.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),r=t?n.height+30:n.height,i=this.popupRef.value.getBoundingClientRect().height;let o=t?"calc(100% - 30px)":"100%";n&&n.top+i>window.innerHeight&&n.top-i>0&&(o=`calc(100% - ${r}px - ${i}px)`),this.popupRef.value.style.top=o}}handleFocusOut(e){this.contains(e.target)||this.hideCalendar()}async showCalendar(){var e;this.calendarOpen=!0,await ls(20),this.handleCalendarPosition(),this.isMobileSafari&&((e=this.calRef.value)==null||e.focusOnCurrentDate())}hideCalendar(){this.calendarOpen=!1}async toggleCalendar(e){var t;e.preventDefault(),this.calendarOpen?this.hideCalendar():this.showCalendar(),await ls(20),this.isMobileSafari&&((t=this.calRef.value)==null||t.focusOnCurrentDate())}};Ye([O({type:String,reflect:!0})],Ie.prototype,"value",2),Ye([O({type:Array,reflect:!1})],Ie.prototype,"_value",2),Ye([O({type:String})],Ie.prototype,"label",2),Ye([O({type:String})],Ie.prototype,"helptext",2),Ye([O({type:String})],Ie.prototype,"helptextDropdown",2),Ye([O({type:String})],Ie.prototype,"helptextDropdownButton",2),Ye([O({type:String})],Ie.prototype,"dateformat",2),Ye([O({type:Boolean,reflect:!0})],Ie.prototype,"multiple",2),Ye([O({type:Number})],Ie.prototype,"maxlength",2),Ye([O({type:Boolean,reflect:!0})],Ie.prototype,"range",2),Ye([O({type:Boolean})],Ie.prototype,"weeknumbers",2),Ye([O({type:Boolean})],Ie.prototype,"withcontrols",2),Ye([O({type:Boolean})],Ie.prototype,"fullwidth",2),Ye([O({converter:Qn.csvToArray})],Ie.prototype,"excludedates",2),Ye([O({converter:Qn.csvToArray})],Ie.prototype,"excludeweekdays",2),Ye([O({type:String})],Ie.prototype,"currentmonth",2),Ye([O({type:Boolean,reflect:!0})],Ie.prototype,"calendarOpen",2),Ie=Ye([Gt("pkt-datepicker")],Ie);const Pm="pkt-link",Lm=!0,Om={href:{name:"URL",description:"URL til lenken",type:"string",default:"#"},target:{name:"Mål",description:"Mål for lenken",type:["_blank","_self","_parent","_top"],default:"_self"},iconName:{name:"Ikon",description:"Ikon som skal vises ved siden av lenketeksten",type:"icon"},iconPosition:{name:"Ikonposisjon",description:"Posisjonen til ikonet i forhold til lenketeksten",type:["left","right"]},external:{name:"Ekstern lenke",description:"Vis ikon for ekstern lenke",type:"boolean",default:!1}},Im={default:{description:"Innholdet i lenken"}},us={name:Pm,"css-class":"pkt-link","dark-mode":!0,isElement:Lm,props:Om,slots:Im};var Mm=Object.defineProperty,Rm=Object.getOwnPropertyDescriptor,ar=(e,t,n,r)=>{for(var i=r>1?void 0:r?Rm(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&Mm(t,n,i),i};let pn=class extends jt{constructor(){super(),this.defaultSlot=_t(),this.href=us.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=us.props.external.default,this.target=us.props.target.default,this.slotController=new er(this,this.defaultSlot)}render(){const e={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return J`<a
|
|
487
|
+
`}handleCalendarPosition(){var e;if(this.popupRef.value&&this.inputRef.value){const t=this.multiple&&!!this.maxlength,n=((e=this.inputRef.value.parentElement)==null?void 0:e.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),r=t?n.height+30:n.height,i=this.popupRef.value.getBoundingClientRect().height;let o=t?"calc(100% - 30px)":"100%";n&&n.top+i>window.innerHeight&&n.top-i>0&&(o=`calc(100% - ${r}px - ${i}px)`),this.popupRef.value.style.top=o}}handleFocusOut(e){this.contains(e.target)||(this.onBlur(),this.hideCalendar())}async showCalendar(){var e;this.calendarOpen=!0,await ls(20),this.handleCalendarPosition(),this.isMobileSafari&&((e=this.calRef.value)==null||e.focusOnCurrentDate())}hideCalendar(){this.calendarOpen=!1}async toggleCalendar(e){var t;e.preventDefault(),this.calendarOpen?this.hideCalendar():this.showCalendar(),await ls(20),this.isMobileSafari&&((t=this.calRef.value)==null||t.focusOnCurrentDate())}};Ye([O({type:String,reflect:!0})],Ie.prototype,"value",2),Ye([O({type:Array,reflect:!1})],Ie.prototype,"_value",2),Ye([O({type:String})],Ie.prototype,"label",2),Ye([O({type:String})],Ie.prototype,"helptext",2),Ye([O({type:String})],Ie.prototype,"helptextDropdown",2),Ye([O({type:String})],Ie.prototype,"helptextDropdownButton",2),Ye([O({type:String})],Ie.prototype,"dateformat",2),Ye([O({type:Boolean,reflect:!0})],Ie.prototype,"multiple",2),Ye([O({type:Number})],Ie.prototype,"maxlength",2),Ye([O({type:Boolean,reflect:!0})],Ie.prototype,"range",2),Ye([O({type:Boolean})],Ie.prototype,"weeknumbers",2),Ye([O({type:Boolean})],Ie.prototype,"withcontrols",2),Ye([O({type:Boolean})],Ie.prototype,"fullwidth",2),Ye([O({converter:Qn.csvToArray})],Ie.prototype,"excludedates",2),Ye([O({converter:Qn.csvToArray})],Ie.prototype,"excludeweekdays",2),Ye([O({type:String})],Ie.prototype,"currentmonth",2),Ye([O({type:Boolean,reflect:!0})],Ie.prototype,"calendarOpen",2),Ie=Ye([Gt("pkt-datepicker")],Ie);const Pm="pkt-link",Lm=!0,Om={href:{name:"URL",description:"URL til lenken",type:"string",default:"#"},target:{name:"Mål",description:"Mål for lenken",type:["_blank","_self","_parent","_top"],default:"_self"},iconName:{name:"Ikon",description:"Ikon som skal vises ved siden av lenketeksten",type:"icon"},iconPosition:{name:"Ikonposisjon",description:"Posisjonen til ikonet i forhold til lenketeksten",type:["left","right"]},external:{name:"Ekstern lenke",description:"Vis ikon for ekstern lenke",type:"boolean",default:!1}},Im={default:{description:"Innholdet i lenken"}},us={name:Pm,"css-class":"pkt-link","dark-mode":!0,isElement:Lm,props:Om,slots:Im};var Mm=Object.defineProperty,Rm=Object.getOwnPropertyDescriptor,ar=(e,t,n,r)=>{for(var i=r>1?void 0:r?Rm(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&Mm(t,n,i),i};let pn=class extends jt{constructor(){super(),this.defaultSlot=_t(),this.href=us.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=us.props.external.default,this.target=us.props.target.default,this.slotController=new er(this,this.defaultSlot)}render(){const e={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return J`<a
|
|
488
488
|
class=${Ge(e)}
|
|
489
489
|
href=${this.href}
|
|
490
490
|
@click=${this.handleClick}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.12",
|
|
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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@oslokommune/punkt-assets": "^12.1.0",
|
|
46
46
|
"@oslokommune/punkt-css": "^12.3.10",
|
|
47
|
-
"@oslokommune/punkt-elements": "^12.3.
|
|
47
|
+
"@oslokommune/punkt-elements": "^12.3.12",
|
|
48
48
|
"@testing-library/jest-dom": "^6.5.0",
|
|
49
49
|
"@testing-library/react": "^16.0.1",
|
|
50
50
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
103
103
|
},
|
|
104
104
|
"license": "MIT",
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "f255f1c88986bdb44f7c65523c96273e82b3171b"
|
|
106
106
|
}
|