@oslokommune/punkt-elements 12.26.2 → 12.27.0
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/{alert-MKb7NX3r.js → alert-BvN80UkI.js} +1 -1
- package/dist/{alert-3DZNN48_.cjs → alert-uNzcOJR9.cjs} +1 -1
- package/dist/{card-CtipjQuP.cjs → card-BaxqXP-k.cjs} +1 -1
- package/dist/{card-ClWsCQfD.js → card-Br6A74Q1.js} +2 -2
- package/dist/{datepicker-B2W8ra1B.cjs → datepicker-BC0e34ws.cjs} +16 -15
- package/dist/{datepicker-BVI4szRk.js → datepicker-ONV4HuJt.js} +84 -82
- package/dist/helptext-DHfBEO42.js +78 -0
- package/dist/helptext-xUdEGuNQ.cjs +24 -0
- package/dist/index.d.ts +19 -6
- package/dist/input-wrapper-DeCY6nta.cjs +50 -0
- package/dist/input-wrapper-Df18_PvD.js +172 -0
- package/dist/{link-B3PDtnXT.js → link-0N9wG5l8.js} +1 -1
- package/dist/{link-BnL83t0x.cjs → link-I_LKEBVK.cjs} +1 -1
- package/dist/{linkcard-C4q7HCwY.js → linkcard-BJeRbpq_.js} +1 -1
- package/dist/{linkcard-RyOjvpmF.cjs → linkcard-ClXGVwdJ.cjs} +1 -1
- package/dist/{messagebox-BDfhozc3.js → messagebox-C5M56R8f.js} +1 -1
- package/dist/{messagebox-CuM1y2P_.cjs → messagebox-CC3j63Wp.cjs} +1 -1
- package/dist/{modal-gLMGJSSY.cjs → modal-BkchlKkL.cjs} +1 -1
- package/dist/{modal-CYv8Qk0Y.js → modal-PKDnp91S.js} +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +14 -14
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-slot-controller-Clbye6cM.js +85 -0
- package/dist/pkt-slot-controller-Oc32unDk.cjs +1 -0
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/select-DFlu7Eq6.cjs +48 -0
- package/dist/{select-BJr30hL7.js → select-DVyh7z8C.js} +60 -43
- package/dist/{tag-nAMwKi6B.cjs → tag-DGywzHJ5.cjs} +1 -1
- package/dist/{tag-CPLBzyiV.js → tag-W9Lf1doW.js} +1 -1
- package/dist/{textarea-Da-bIu5d.js → textarea-80zuPTTD.js} +35 -33
- package/dist/textarea-WWRAA1LV.cjs +49 -0
- package/dist/{textinput-C9pkRR6S.cjs → textinput-CE5AzOur.cjs} +4 -3
- package/dist/{textinput-Buj2CAKl.js → textinput-CZIE3v3S.js} +44 -42
- package/package.json +3 -3
- package/src/components/datepicker/datepicker.ts +8 -0
- package/src/components/helptext/helptext.ts +41 -35
- package/src/components/input-wrapper/input-wrapper.ts +28 -19
- package/src/components/select/select.ts +41 -8
- package/src/components/textarea/textarea.ts +9 -1
- package/src/components/textinput/textinput.ts +10 -1
- package/dist/helptext-CNgXo34f.js +0 -75
- package/dist/helptext-XPScYIkx.cjs +0 -23
- package/dist/input-wrapper-CWvzXs6X.js +0 -160
- package/dist/input-wrapper-nvacN4EY.cjs +0 -48
- package/dist/pkt-slot-controller-BEDVscvU.cjs +0 -1
- package/dist/pkt-slot-controller-DhwCJd_0.js +0 -67
- package/dist/select-B19JEWYw.cjs +0 -44
- package/dist/textarea-D7uvC79V.cjs +0 -48
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { e as k } from "./class-map-CQzsZCwS.js";
|
|
2
2
|
import { P as m, x as n, E as u, n as r, t as h } from "./element-BKrU5soj.js";
|
|
3
3
|
import { r as f } from "./state-C36ZmZgt.js";
|
|
4
|
-
import { P as v } from "./pkt-slot-controller-
|
|
4
|
+
import { P as v } from "./pkt-slot-controller-Clbye6cM.js";
|
|
5
5
|
import { e as b, n as y } from "./ref-D5qG7OFB.js";
|
|
6
6
|
import "./icon-Bsb0MB2h.js";
|
|
7
7
|
const _ = "pkt-alert", g = !0, C = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const d=require("./class-map-aeZWY44S.cjs"),t=require("./element-B0UgldHm.cjs"),k=require("./state-CG-binsl.cjs"),u=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const d=require("./class-map-aeZWY44S.cjs"),t=require("./element-B0UgldHm.cjs"),k=require("./state-CG-binsl.cjs"),u=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-DDYBJ4EB.cjs");require("./icon-PWn7rnfg.cjs");const h="pkt-alert",v=!0,f={onClose:{description:"React: Klikk-event for 'Lukk'-knappen"},close:{description:"Vue: Klikk-event for 'Lukk'-knappen"}},m={title:{name:"Tittel",description:"Tittelen som vises øverst i på meldingen",type:"string"},skin:{name:"Utseende",description:"Hvordan type melding er dette?",type:["info","success","warning","error"],default:"info"},date:{name:"Sist oppdatert",description:"Dato som vises nederst i på meldingen",type:"string"},ariaLive:{name:"aria-live",description:"Hvordan skal skjermleseren lese opp meldingen?",type:["off","polite","assertive"],default:"polite"},compact:{name:"Kompakt",description:"Gjør meldingen mindre",type:"boolean",default:!1},closeAlert:{name:"Vis 'Lukk'-knapp",description:"Viser 'Lukk'-knappen",type:"boolean",default:!1}},b={default:{description:"Innholdet i meldingen"}},n={name:h,"css-class":"pkt-alert","dark-mode":!0,isElement:v,events:f,props:m,slots:b};var y=Object.defineProperty,_=Object.getOwnPropertyDescriptor,i=(a,e,l,s)=>{for(var r=s>1?void 0:s?_(e,l):e,o=a.length-1,p;o>=0;o--)(p=a[o])&&(r=(s?p(e,l,r):p(r))||r);return s&&r&&y(e,l,r),r};exports.PktAlert=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.compact=n.props.compact.default,this.title="",this.skin=n.props.skin.default,this.ariaLive=n.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=n.props.closeAlert.default,this.date=null,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new u.PktSlotController(this,this.defaultSlot),this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(e,l,s){e==="ariaLive"&&(this["aria-live"]=s),super.attributeChangedCallback(e,l,s)}updated(e){super.updated(e),e.has("ariaLive")&&(this["aria-live"]=this.ariaLive)}render(){const e={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed};return t.x`
|
|
2
2
|
<div class=${d.e(e)}>
|
|
3
3
|
<pkt-icon
|
|
4
4
|
class="pkt-alert__icon"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const g=require("./class-map-aeZWY44S.cjs"),d=require("./if-defined-Br3lDE5v.cjs"),t=require("./element-B0UgldHm.cjs"),k=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const g=require("./class-map-aeZWY44S.cjs"),d=require("./if-defined-Br3lDE5v.cjs"),t=require("./element-B0UgldHm.cjs"),k=require("./pkt-slot-controller-Oc32unDk.cjs"),l=require("./ref-DDYBJ4EB.cjs");require("./icon-PWn7rnfg.cjs");require("./tag-DGywzHJ5.cjs");const u="pkt-card",h=!0,m={heading:{type:"string",name:"Heading",description:"Tittel på kortet"},subheading:{type:"string",name:"Subheading",description:"Undertittel på kortet"},skin:{type:["outlined","gray","blue","beige","green"],name:"Skin",description:"Farge på kortet",default:"outlined"},direction:{type:["landscape","portrait"],name:"Direction",description:"Retningen innholdet skal ligge i forhold til kortet",default:"portrait"},tags:{type:"array",description:"Liste av tags på kortet. Tar inn en array med objekter med følgende stringproperties: skin, iconName, ariaLabel, text",name:"Tags",items:{type:"object",properties:{skin:{type:["blue","green","red","yellow"],description:"Farge på tag"},iconName:{type:"icon",description:"Id på ikonet du ønsker å bruke til tag"},ariaLabel:{type:"string",description:"Tekst for aria-label"},text:{type:"string",description:"Tekst på tag",required:!0}}}},image:{type:"object",name:"Bilde",description:"Bilde på kortet. Tar inn et objekt av typen {src: string, alt: string}. src er stien til bildet, og alt er tekst for aria-label.",properties:{src:{type:"string",description:"Bilde på kortet",required:!0},alt:{type:"string",description:"Tekst for aria-label",required:!0}}}},y={default:{description:"Innholdet i kortet"}},c={name:u,"css-class":"pkt-card",isElement:h,props:m,slots:y};var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,i=(a,s,e,n)=>{for(var r=n>1?void 0:n?b(s,e):s,o=a.length-1,p;o>=0;o--)(p=a[o])&&(r=(n?p(s,e,r):p(r))||r);return n&&r&&f(s,e,r),r};exports.PktCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=l.e(),this.skin=c.props.skin.default,this.direction=c.props.direction.default,this.image={src:"",alt:""},this.heading="",this.subheading="",this.tags=[],this.slotController=new k.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback()}render(){const s={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.direction}`]:this.direction};return t.x`
|
|
2
2
|
<div class=${g.e(s)}>
|
|
3
3
|
${this.image.src&&t.x`
|
|
4
4
|
<div class="pkt-card__image">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { e as h } from "./class-map-CQzsZCwS.js";
|
|
2
2
|
import { o as c } from "./if-defined-f3M1y6S-.js";
|
|
3
3
|
import { P as m, x as r, E as k, n as a, t as u } from "./element-BKrU5soj.js";
|
|
4
|
-
import { P as y } from "./pkt-slot-controller-
|
|
4
|
+
import { P as y } from "./pkt-slot-controller-Clbye6cM.js";
|
|
5
5
|
import { e as f, n as b } from "./ref-D5qG7OFB.js";
|
|
6
6
|
import "./icon-Bsb0MB2h.js";
|
|
7
|
-
import "./tag-
|
|
7
|
+
import "./tag-W9Lf1doW.js";
|
|
8
8
|
const $ = "pkt-card", v = !0, _ = {
|
|
9
9
|
heading: {
|
|
10
10
|
type: "string",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";const $=require("./class-map-aeZWY44S.cjs"),k=require("./if-defined-Br3lDE5v.cjs"),
|
|
1
|
+
"use strict";const $=require("./class-map-aeZWY44S.cjs"),k=require("./if-defined-Br3lDE5v.cjs"),a=require("./element-B0UgldHm.cjs"),T=require("./state-CG-binsl.cjs"),g=require("./calendar-CPEJ1enc.cjs"),S=require("./input-element-Dnda8hac.cjs"),r=require("./ref-DDYBJ4EB.cjs");require("./icon-PWn7rnfg.cjs");require("./input-wrapper-DeCY6nta.cjs");require("./tag-DGywzHJ5.cjs");const P=require("./pkt-slot-controller-Oc32unDk.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const R=(o,e,t)=>{const i=new Map;for(let
|
|
5
|
+
*/const R=(o,e,t)=>{const i=new Map;for(let s=e;s<=t;s++)i.set(o[s],s);return i},I=a.e(class extends a.i{constructor(o){if(super(o),o.type!==a.t$1.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const s=[],n=[];let l=0;for(const c of o)s[l]=i?i(c,l):l,n[l]=t(c,l),l++;return{values:n,keys:s}}render(o,e,t){return this.dt(o,e,t).values}update(o,[e,t,i]){const s=r.p(o),{values:n,keys:l}=this.dt(e,t,i);if(!Array.isArray(s))return this.ut=l,n;const c=this.ut??(this.ut=[]),m=[];let b,w,u=0,h=s.length-1,d=0,f=n.length-1;for(;u<=h&&d<=f;)if(s[u]===null)u++;else if(s[h]===null)h--;else if(c[u]===l[d])m[d]=r.v(s[u],n[d]),u++,d++;else if(c[h]===l[f])m[f]=r.v(s[h],n[f]),h--,f--;else if(c[u]===l[f])m[f]=r.v(s[u],n[f]),r.r(o,m[f+1],s[u]),u++,f--;else if(c[h]===l[d])m[d]=r.v(s[h],n[d]),r.r(o,s[u],s[h]),h--,d++;else if(b===void 0&&(b=R(l,d,f),w=R(c,u,h)),b.has(c[u]))if(b.has(c[h])){const v=w.get(l[d]),x=v!==void 0?s[v]:null;if(x===null){const D=r.r(o,s[u]);r.v(D,n[d]),m[d]=D}else m[d]=r.v(x,n[d]),r.r(o,s[u],x),s[v]=null;d++}else r.M(s[h]),h--;else r.M(s[u]),u++;for(;d<=f;){const v=r.r(o,m[f+1]);r.v(v,n[d]),m[d++]=v}for(;u<=h;){const v=s[u++];v!==null&&r.M(v)}return this.ut=l,r.m(o,m),a.T}}),_="pkt-datepicker",O=!0,E={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"},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",default:!1,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"},useWrapper:{type:"boolean",name:"Bruk wrapper",description:"Indikerer at feltet skal ha synlig label og hjelpetekst",displayAsFalse:!0,default:!0},id:{type:"string",name:"ID",description:"Unik identifikasjon for datovelgeren"}},M={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"}},y={name:_,"css-class":"pkt-datepicker",isElement:O,props:E,events:M};var B=Object.defineProperty,q=Object.getOwnPropertyDescriptor,p=(o,e,t,i)=>{for(var s=i>1?void 0:i?q(e,t):e,n=o.length-1,l;n>=0;n--)(l=o[n])&&(s=(i?l(e,t,s):l(s))||s);return i&&s&&B(e,t,s),s};const C=o=>new Promise(e=>setTimeout(e,o));exports.PktDatepicker=class extends S.PktInputElement{constructor(){super(),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=y.props.dateformat.default,this.multiple=y.props.multiple.default,this.maxlength=null,this.range=y.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=y.props.weeknumbers.default,this.withcontrols=y.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.buttonClasses={},this.inputRef=r.e(),this.inputRefTo=r.e(),this.btnRef=r.e(),this.calRef=r.e(),this.popupRef=r.e(),this.helptextSlot=r.e(),this.addToSelected=e=>{const t=e.target;if(!t.value)return;const i=this.min?g.newDate(this.min):null,s=this.max?g.newDate(this.max):null,n=g.newDate(t.value.split(",")[0]);n&&!isNaN(n.getTime())&&(!i||n>=i)&&(!s||n<=s)&&this.calRef.value&&this.calRef.value.handleDateSelect(n),t.value=""},this.slotController=new P.PktSlotController(this,this.helptextSlot)}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,i;(t=this.inputRef)!=null&&t.value&&((i=this.btnRef)!=null&&i.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||y.props.min.default,this.max=this.max||y.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 C(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",e=>{var t,i;(t=this.inputRef)!=null&&t.value&&((i=this.btnRef)!=null&&i.value)&&!this.inputRef.value.contains(e.target)&&!this.btnRef.value.contains(e.target)&&this.hideCalendar()})}attributeChangedCallback(e,t,i){if(e==="value"){if(this.range&&(i==null?void 0:i.split(",").length)===1)return;this.value!==t&&this.valueChanged(i,t)}e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(i==null?void 0:i.split(","))??[]),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(i==null?void 0:i.split(","))??[]),super.attributeChangedCallback(e,t,i)}updated(e){if(e.has("value")){if(this.range&&this.value.length===1)return;this.valueChanged(this.value,e.get("value"))}super.updated(e)}renderInput(){return a.x`
|
|
6
6
|
<input
|
|
7
7
|
class="${$.e(this.inputClasses)}"
|
|
8
8
|
.type=${this.inputType}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
@change=${e=>{e.stopImmediatePropagation()}}
|
|
20
20
|
${r.n(this.inputRef)}
|
|
21
21
|
/>
|
|
22
|
-
`}renderRangeInput(){const e={"pkt-input-prefix":this.showRangeLabels,"pkt-hide":!this.showRangeLabels};return
|
|
23
|
-
${this.showRangeLabels?
|
|
22
|
+
`}renderRangeInput(){const e={"pkt-input-prefix":this.showRangeLabels,"pkt-hide":!this.showRangeLabels};return a.x`
|
|
23
|
+
${this.showRangeLabels?a.x` <div class="pkt-input-prefix">${this.strings.generic.from}</div> `:a.E}
|
|
24
24
|
<input
|
|
25
25
|
class=${$.e(this.inputClasses)}
|
|
26
26
|
.type=${this.inputType}
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
@keydown=${t=>{var i;(t.key===","||t.key==="Enter")&&((i=this.inputRef.value)==null||i.blur()),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
|
|
34
34
|
@input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
|
|
35
35
|
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
36
|
-
@blur=${t=>{var i,
|
|
36
|
+
@blur=${t=>{var i,s;if(t.target.value){this.manageValidity(t.target);const n=g.fromISOToDate(t.target.value);n&&this._value[0]!==t.target.value&&this._value[1]&&(this.clearInputValue(),(s=(i=this.calRef)==null?void 0:i.value)==null||s.handleDateSelect(n))}else this._value[0]&&this.clearInputValue()}}
|
|
37
37
|
@change=${t=>{t.stopImmediatePropagation()}}
|
|
38
38
|
${r.n(this.inputRef)}
|
|
39
39
|
/>
|
|
40
40
|
<div class="${$.e(e)}" id="${this.id}-to-label">
|
|
41
41
|
${this.strings.generic.to}
|
|
42
42
|
</div>
|
|
43
|
-
${this.showRangeLabels?
|
|
43
|
+
${this.showRangeLabels?a.E:a.x` <div class="pkt-input-separator">–</div> `}
|
|
44
44
|
<input
|
|
45
45
|
class=${$.e(this.inputClasses)}
|
|
46
46
|
.type=${this.inputType}
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
@keydown=${t=>{var i;(t.key===","||t.key==="Enter")&&((i=this.inputRefTo.value)==null||i.blur()),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
|
|
55
55
|
@input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
|
|
56
56
|
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
57
|
-
@blur=${t=>{var i,
|
|
57
|
+
@blur=${t=>{var i,s,n;if((i=this.calRef.value)!=null&&i.contains(t.relatedTarget)||this.onBlur(),t.target.value){this.manageValidity(t.target);const l=t.target.value;this.min&&this.min>l?this.internals.setValidity({rangeUnderflow:!0},this.strings.forms.messages.rangeUnderflow,t.target):this.max&&this.max<l&&this.internals.setValidity({rangeOverflow:!0},this.strings.forms.messages.rangeOverflow,t.target);const c=g.fromISOToDate(t.target.value);c&&this._value[1]!==g.formatISODate(c)&&((n=(s=this.calRef)==null?void 0:s.value)==null||n.handleDateSelect(c))}}}
|
|
58
58
|
@change=${t=>{t.stopImmediatePropagation()}}
|
|
59
59
|
${r.n(this.inputRefTo)}
|
|
60
60
|
/>
|
|
61
|
-
`}renderMultipleInput(){return
|
|
61
|
+
`}renderMultipleInput(){return a.x`
|
|
62
62
|
<input
|
|
63
63
|
class=${$.e(this.inputClasses)}
|
|
64
64
|
.type=${this.inputType}
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
@change=${e=>{e.stopImmediatePropagation()}}
|
|
75
75
|
${r.n(this.inputRef)}
|
|
76
76
|
/>
|
|
77
|
-
`}renderTags(){return
|
|
77
|
+
`}renderTags(){return a.x`
|
|
78
78
|
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
79
|
-
${this._value[0]?
|
|
79
|
+
${this._value[0]?I(this._value??[],e=>e,e=>a.x`
|
|
80
80
|
<pkt-tag
|
|
81
81
|
.id="${this.id+e+"-tag"}"
|
|
82
82
|
closeTag
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
@close=${()=>{var t;return(t=this.calRef.value)==null?void 0:t.handleDateSelect(g.fromISOToDate(e))}}
|
|
85
85
|
><time datetime="${e}">${g.fromISOtoLocal(e,this.dateformat)}</time></pkt-tag
|
|
86
86
|
>
|
|
87
|
-
`):
|
|
87
|
+
`):a.E}
|
|
88
88
|
</div>
|
|
89
|
-
`}renderCalendar(){return
|
|
89
|
+
`}renderCalendar(){return a.x`<div
|
|
90
90
|
class="pkt-calendar-popup pkt-${this.calendarOpen?"show":"hide"}"
|
|
91
91
|
@focusout=${e=>{this.calendarOpen&&this.handleFocusOut(e)}}
|
|
92
92
|
id="${this.id}-popup"
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
@close=${()=>{this.onBlur(),this.hideCalendar()}}
|
|
110
110
|
${r.n(this.calRef)}
|
|
111
111
|
></pkt-calendar>
|
|
112
|
-
</div>`}render(){return this.inputClasses={"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-datepicker--hasrangelabels":this.showRangeLabels,"pkt-datepicker--multiple":this.multiple,"pkt-datepicker--range":this.range},this.buttonClasses={"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0},
|
|
112
|
+
</div>`}render(){return this.inputClasses={"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-datepicker--hasrangelabels":this.showRangeLabels,"pkt-datepicker--multiple":this.multiple,"pkt-datepicker--range":this.range},this.buttonClasses={"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0},a.x`
|
|
113
113
|
<pkt-input-wrapper
|
|
114
114
|
label="${this.label}"
|
|
115
115
|
forId="${this.id}-input"
|
|
@@ -131,7 +131,8 @@
|
|
|
131
131
|
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
132
132
|
class="pkt-datepicker"
|
|
133
133
|
>
|
|
134
|
-
${
|
|
134
|
+
<div class="pkt-contents" ${r.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
135
|
+
${this.multiple?this.renderTags():a.E}
|
|
135
136
|
<div
|
|
136
137
|
class="pkt-datepicker__inputs ${this.range&&this.showRangeLabels?"pkt-input__range-inputs":""}"
|
|
137
138
|
>
|
|
@@ -151,4 +152,4 @@
|
|
|
151
152
|
</div>
|
|
152
153
|
</pkt-input-wrapper>
|
|
153
154
|
${this.renderCalendar()}
|
|
154
|
-
`}handleCalendarPosition(){var e;if(this.popupRef.value&&this.inputRef.value){const t=this.multiple&&!!this.maxlength,i=((e=this.inputRef.value.parentElement)==null?void 0:e.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),
|
|
155
|
+
`}handleCalendarPosition(){var e;if(this.popupRef.value&&this.inputRef.value){const t=this.multiple&&!!this.maxlength,i=((e=this.inputRef.value.parentElement)==null?void 0:e.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),s=t?i.height+30:i.height,n=this.popupRef.value.getBoundingClientRect().height;let l=t?"calc(100% - 30px)":"100%";i&&i.top+n>window.innerHeight&&i.top-n>0&&(l=`calc(100% - ${s}px - ${n}px)`),this.popupRef.value.style.top=l}}handleFocusOut(e){this.contains(e.target)||(this.onBlur(),this.hideCalendar())}async showCalendar(){var e;this.calendarOpen=!0,await C(20),this.handleCalendarPosition(),this.isMobileSafari&&((e=this.calRef.value)==null||e.focusOnCurrentDate())}hideCalendar(){this.calendarOpen=!1}async toggleCalendar(e){e.preventDefault(),this.calendarOpen?this.hideCalendar():this.showCalendar()}};p([a.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",2);p([a.n({type:Array})],exports.PktDatepicker.prototype,"_value",2);p([a.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"label",2);p([a.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);p([a.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);p([a.n({type:Number,reflect:!0})],exports.PktDatepicker.prototype,"maxlength",2);p([a.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);p([a.n({type:Boolean})],exports.PktDatepicker.prototype,"showRangeLabels",2);p([a.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"min",2);p([a.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"max",2);p([a.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);p([a.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"withcontrols",2);p([a.n({converter:g.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);p([a.n({converter:g.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);p([a.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);p([a.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"calendarOpen",2);p([a.n({type:String})],exports.PktDatepicker.prototype,"timezone",2);p([T.r()],exports.PktDatepicker.prototype,"inputClasses",2);p([T.r()],exports.PktDatepicker.prototype,"buttonClasses",2);exports.PktDatepicker=p([a.t("pkt-datepicker")],exports.PktDatepicker);
|
|
@@ -2,59 +2,60 @@ import { e as x } from "./class-map-CQzsZCwS.js";
|
|
|
2
2
|
import { o as k } from "./if-defined-f3M1y6S-.js";
|
|
3
3
|
import { e as L, i as j, a as F, T as q, x as v, E as T, n as u, t as H } from "./element-BKrU5soj.js";
|
|
4
4
|
import { r as V } from "./state-C36ZmZgt.js";
|
|
5
|
-
import { n as
|
|
5
|
+
import { n as S, f as _, a as N, b as P, d as A } from "./calendar-DB_8j4en.js";
|
|
6
6
|
import { P as U } from "./input-element-URKBm_vS.js";
|
|
7
|
-
import { p as K, v as
|
|
7
|
+
import { p as K, v as $, r as R, M as I, m as W, e as w, n as y } from "./ref-D5qG7OFB.js";
|
|
8
8
|
import "./icon-Bsb0MB2h.js";
|
|
9
|
-
import "./input-wrapper-
|
|
10
|
-
import "./tag-
|
|
9
|
+
import "./input-wrapper-Df18_PvD.js";
|
|
10
|
+
import "./tag-W9Lf1doW.js";
|
|
11
|
+
import { P as z } from "./pkt-slot-controller-Clbye6cM.js";
|
|
11
12
|
/**
|
|
12
13
|
* @license
|
|
13
14
|
* Copyright 2017 Google LLC
|
|
14
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
15
16
|
*/
|
|
16
|
-
const
|
|
17
|
+
const E = (e, t, i) => {
|
|
17
18
|
const a = /* @__PURE__ */ new Map();
|
|
18
19
|
for (let s = t; s <= i; s++) a.set(e[s], s);
|
|
19
20
|
return a;
|
|
20
|
-
},
|
|
21
|
+
}, G = L(class extends j {
|
|
21
22
|
constructor(e) {
|
|
22
23
|
if (super(e), e.type !== F.CHILD) throw Error("repeat() can only be used in text expressions");
|
|
23
24
|
}
|
|
24
25
|
dt(e, t, i) {
|
|
25
26
|
let a;
|
|
26
27
|
i === void 0 ? i = t : t !== void 0 && (a = t);
|
|
27
|
-
const s = [],
|
|
28
|
+
const s = [], l = [];
|
|
28
29
|
let n = 0;
|
|
29
|
-
for (const f of e) s[n] = a ? a(f, n) : n,
|
|
30
|
-
return { values:
|
|
30
|
+
for (const f of e) s[n] = a ? a(f, n) : n, l[n] = i(f, n), n++;
|
|
31
|
+
return { values: l, keys: s };
|
|
31
32
|
}
|
|
32
33
|
render(e, t, i) {
|
|
33
34
|
return this.dt(e, t, i).values;
|
|
34
35
|
}
|
|
35
36
|
update(e, [t, i, a]) {
|
|
36
|
-
const s = K(e), { values:
|
|
37
|
-
if (!Array.isArray(s)) return this.ut = n,
|
|
37
|
+
const s = K(e), { values: l, keys: n } = this.dt(t, i, a);
|
|
38
|
+
if (!Array.isArray(s)) return this.ut = n, l;
|
|
38
39
|
const f = this.ut ?? (this.ut = []), m = [];
|
|
39
|
-
let C, O, p = 0, h = s.length - 1, d = 0, c =
|
|
40
|
+
let C, O, p = 0, h = s.length - 1, d = 0, c = l.length - 1;
|
|
40
41
|
for (; p <= h && d <= c; ) if (s[p] === null) p++;
|
|
41
42
|
else if (s[h] === null) h--;
|
|
42
|
-
else if (f[p] === n[d]) m[d] =
|
|
43
|
-
else if (f[h] === n[c]) m[c] =
|
|
44
|
-
else if (f[p] === n[c]) m[c] =
|
|
45
|
-
else if (f[h] === n[d]) m[d] =
|
|
46
|
-
else if (C === void 0 && (C =
|
|
47
|
-
const g = O.get(n[d]),
|
|
48
|
-
if (
|
|
49
|
-
const M =
|
|
50
|
-
|
|
51
|
-
} else m[d] =
|
|
43
|
+
else if (f[p] === n[d]) m[d] = $(s[p], l[d]), p++, d++;
|
|
44
|
+
else if (f[h] === n[c]) m[c] = $(s[h], l[c]), h--, c--;
|
|
45
|
+
else if (f[p] === n[c]) m[c] = $(s[p], l[c]), R(e, m[c + 1], s[p]), p++, c--;
|
|
46
|
+
else if (f[h] === n[d]) m[d] = $(s[h], l[d]), R(e, s[p], s[h]), h--, d++;
|
|
47
|
+
else if (C === void 0 && (C = E(n, d, c), O = E(f, p, h)), C.has(f[p])) if (C.has(f[h])) {
|
|
48
|
+
const g = O.get(n[d]), D = g !== void 0 ? s[g] : null;
|
|
49
|
+
if (D === null) {
|
|
50
|
+
const M = R(e, s[p]);
|
|
51
|
+
$(M, l[d]), m[d] = M;
|
|
52
|
+
} else m[d] = $(D, l[d]), R(e, s[p], D), s[g] = null;
|
|
52
53
|
d++;
|
|
53
54
|
} else I(s[h]), h--;
|
|
54
55
|
else I(s[p]), p++;
|
|
55
56
|
for (; d <= c; ) {
|
|
56
|
-
const g =
|
|
57
|
-
|
|
57
|
+
const g = R(e, m[c + 1]);
|
|
58
|
+
$(g, l[d]), m[d++] = g;
|
|
58
59
|
}
|
|
59
60
|
for (; p <= h; ) {
|
|
60
61
|
const g = s[p++];
|
|
@@ -62,7 +63,7 @@ const B = (e, t, i) => {
|
|
|
62
63
|
}
|
|
63
64
|
return this.ut = n, W(e, m), q;
|
|
64
65
|
}
|
|
65
|
-
}),
|
|
66
|
+
}), J = "pkt-datepicker", Q = !0, X = {
|
|
66
67
|
name: {
|
|
67
68
|
type: "string",
|
|
68
69
|
name: "Navn",
|
|
@@ -231,7 +232,7 @@ const B = (e, t, i) => {
|
|
|
231
232
|
name: "ID",
|
|
232
233
|
description: "Unik identifikasjon for datovelgeren"
|
|
233
234
|
}
|
|
234
|
-
},
|
|
235
|
+
}, Y = {
|
|
235
236
|
change: {
|
|
236
237
|
type: "Event",
|
|
237
238
|
description: "Returnerer valgt dato som streng i ISO-format"
|
|
@@ -245,35 +246,35 @@ const B = (e, t, i) => {
|
|
|
245
246
|
description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
|
|
246
247
|
}
|
|
247
248
|
}, b = {
|
|
248
|
-
name:
|
|
249
|
+
name: J,
|
|
249
250
|
"css-class": "pkt-datepicker",
|
|
250
|
-
isElement:
|
|
251
|
-
props:
|
|
252
|
-
events:
|
|
251
|
+
isElement: Q,
|
|
252
|
+
props: X,
|
|
253
|
+
events: Y
|
|
253
254
|
};
|
|
254
|
-
var
|
|
255
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
256
|
-
(n = e[
|
|
257
|
-
return a && s &&
|
|
255
|
+
var Z = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, o = (e, t, i, a) => {
|
|
256
|
+
for (var s = a > 1 ? void 0 : a ? ee(t, i) : t, l = e.length - 1, n; l >= 0; l--)
|
|
257
|
+
(n = e[l]) && (s = (a ? n(t, i, s) : n(s)) || s);
|
|
258
|
+
return a && s && Z(t, i, s), s;
|
|
258
259
|
};
|
|
259
|
-
const
|
|
260
|
-
let
|
|
260
|
+
const B = (e) => new Promise((t) => setTimeout(t, e));
|
|
261
|
+
let r = class extends U {
|
|
262
|
+
/**
|
|
263
|
+
* Housekeeping / lifecycle methods
|
|
264
|
+
*/
|
|
261
265
|
constructor() {
|
|
262
|
-
super(
|
|
266
|
+
super(), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.dateformat = b.props.dateformat.default, this.multiple = b.props.multiple.default, this.maxlength = null, this.range = b.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = b.props.weeknumbers.default, this.withcontrols = b.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.buttonClasses = {}, this.inputRef = w(), this.inputRefTo = w(), this.btnRef = w(), this.calRef = w(), this.popupRef = w(), this.helptextSlot = w(), this.addToSelected = (e) => {
|
|
263
267
|
const t = e.target;
|
|
264
268
|
if (!t.value) return;
|
|
265
|
-
const i = this.min ?
|
|
269
|
+
const i = this.min ? S(this.min) : null, a = this.max ? S(this.max) : null, s = S(t.value.split(",")[0]);
|
|
266
270
|
s && !isNaN(s.getTime()) && (!i || s >= i) && (!a || s <= a) && this.calRef.value && this.calRef.value.handleDateSelect(s), t.value = "";
|
|
267
|
-
};
|
|
271
|
+
}, this.slotController = new z(this, this.helptextSlot);
|
|
268
272
|
}
|
|
269
|
-
/**
|
|
270
|
-
* Housekeeping / lifecycle methods
|
|
271
|
-
*/
|
|
272
273
|
async connectedCallback() {
|
|
273
274
|
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) => {
|
|
274
275
|
var t, i;
|
|
275
276
|
(t = this.inputRef) != null && t.value && ((i = this.btnRef) != null && i.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());
|
|
276
|
-
}), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || b.props.min.default, this.max = this.max || b.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
|
|
277
|
+
}), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || b.props.min.default, this.max = this.max || b.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 B(20), this.handleCalendarPosition());
|
|
277
278
|
}
|
|
278
279
|
disconnectedCallback() {
|
|
279
280
|
super.disconnectedCallback(), document && document.body.removeEventListener("click", (e) => {
|
|
@@ -328,7 +329,7 @@ let l = class extends U {
|
|
|
328
329
|
@change=${(e) => {
|
|
329
330
|
e.stopImmediatePropagation();
|
|
330
331
|
}}
|
|
331
|
-
${
|
|
332
|
+
${y(this.inputRef)}
|
|
332
333
|
/>
|
|
333
334
|
`;
|
|
334
335
|
}
|
|
@@ -371,7 +372,7 @@ let l = class extends U {
|
|
|
371
372
|
@change=${(t) => {
|
|
372
373
|
t.stopImmediatePropagation();
|
|
373
374
|
}}
|
|
374
|
-
${
|
|
375
|
+
${y(this.inputRef)}
|
|
375
376
|
/>
|
|
376
377
|
<div class="${x(e)}" id="${this.id}-to-label">
|
|
377
378
|
${this.strings.generic.to}
|
|
@@ -403,12 +404,12 @@ let l = class extends U {
|
|
|
403
404
|
var i, a, s;
|
|
404
405
|
if ((i = this.calRef.value) != null && i.contains(t.relatedTarget) || this.onBlur(), t.target.value) {
|
|
405
406
|
this.manageValidity(t.target);
|
|
406
|
-
const
|
|
407
|
-
this.min && this.min >
|
|
407
|
+
const l = t.target.value;
|
|
408
|
+
this.min && this.min > l ? this.internals.setValidity(
|
|
408
409
|
{ rangeUnderflow: !0 },
|
|
409
410
|
this.strings.forms.messages.rangeUnderflow,
|
|
410
411
|
t.target
|
|
411
|
-
) : this.max && this.max <
|
|
412
|
+
) : this.max && this.max < l && this.internals.setValidity(
|
|
412
413
|
{ rangeOverflow: !0 },
|
|
413
414
|
this.strings.forms.messages.rangeOverflow,
|
|
414
415
|
t.target
|
|
@@ -420,7 +421,7 @@ let l = class extends U {
|
|
|
420
421
|
@change=${(t) => {
|
|
421
422
|
t.stopImmediatePropagation();
|
|
422
423
|
}}
|
|
423
|
-
${
|
|
424
|
+
${y(this.inputRefTo)}
|
|
424
425
|
/>
|
|
425
426
|
`;
|
|
426
427
|
}
|
|
@@ -452,21 +453,21 @@ let l = class extends U {
|
|
|
452
453
|
@change=${(e) => {
|
|
453
454
|
e.stopImmediatePropagation();
|
|
454
455
|
}}
|
|
455
|
-
${
|
|
456
|
+
${y(this.inputRef)}
|
|
456
457
|
/>
|
|
457
458
|
`;
|
|
458
459
|
}
|
|
459
460
|
renderTags() {
|
|
460
461
|
return v`
|
|
461
462
|
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
462
|
-
${this._value[0] ?
|
|
463
|
+
${this._value[0] ? G(
|
|
463
464
|
this._value ?? [],
|
|
464
465
|
(e) => e,
|
|
465
466
|
(e) => v`
|
|
466
467
|
<pkt-tag
|
|
467
468
|
.id="${this.id + e + "-tag"}"
|
|
468
469
|
closeTag
|
|
469
|
-
ariaLabel="${this.strings.calendar.deleteDate} ${
|
|
470
|
+
ariaLabel="${this.strings.calendar.deleteDate} ${P(
|
|
470
471
|
e,
|
|
471
472
|
this.dateformat
|
|
472
473
|
)}"
|
|
@@ -474,7 +475,7 @@ let l = class extends U {
|
|
|
474
475
|
var t;
|
|
475
476
|
return (t = this.calRef.value) == null ? void 0 : t.handleDateSelect(_(e));
|
|
476
477
|
}}
|
|
477
|
-
><time datetime="${e}">${
|
|
478
|
+
><time datetime="${e}">${P(e, this.dateformat)}</time></pkt-tag
|
|
478
479
|
>
|
|
479
480
|
`
|
|
480
481
|
) : T}
|
|
@@ -488,7 +489,7 @@ let l = class extends U {
|
|
|
488
489
|
this.calendarOpen && this.handleFocusOut(e);
|
|
489
490
|
}}
|
|
490
491
|
id="${this.id}-popup"
|
|
491
|
-
${
|
|
492
|
+
${y(this.popupRef)}
|
|
492
493
|
>
|
|
493
494
|
<pkt-calendar
|
|
494
495
|
id="${this.id}-calendar"
|
|
@@ -502,14 +503,14 @@ let l = class extends U {
|
|
|
502
503
|
.latest=${this.max}
|
|
503
504
|
.excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
|
|
504
505
|
.excludeweekdays=${this.excludeweekdays}
|
|
505
|
-
.currentmonth=${this.currentmonth ?
|
|
506
|
+
.currentmonth=${this.currentmonth ? S(this.currentmonth) : null}
|
|
506
507
|
@date-selected=${(e) => {
|
|
507
508
|
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] : ""));
|
|
508
509
|
}}
|
|
509
510
|
@close=${() => {
|
|
510
511
|
this.onBlur(), this.hideCalendar();
|
|
511
512
|
}}
|
|
512
|
-
${
|
|
513
|
+
${y(this.calRef)}
|
|
513
514
|
></pkt-calendar>
|
|
514
515
|
</div>`;
|
|
515
516
|
}
|
|
@@ -548,6 +549,7 @@ let l = class extends U {
|
|
|
548
549
|
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
549
550
|
class="pkt-datepicker"
|
|
550
551
|
>
|
|
552
|
+
<div class="pkt-contents" ${y(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
551
553
|
${this.multiple ? this.renderTags() : T}
|
|
552
554
|
<div
|
|
553
555
|
class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
|
|
@@ -559,7 +561,7 @@ let l = class extends U {
|
|
|
559
561
|
type="button"
|
|
560
562
|
@click=${this.toggleCalendar}
|
|
561
563
|
?disabled=${this.disabled}
|
|
562
|
-
${
|
|
564
|
+
${y(this.btnRef)}
|
|
563
565
|
>
|
|
564
566
|
<pkt-icon name="calendar"></pkt-icon>
|
|
565
567
|
<span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
|
|
@@ -577,8 +579,8 @@ let l = class extends U {
|
|
|
577
579
|
var e;
|
|
578
580
|
if (this.popupRef.value && this.inputRef.value) {
|
|
579
581
|
const t = this.multiple && !!this.maxlength, i = ((e = this.inputRef.value.parentElement) == null ? void 0 : e.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), a = t ? i.height + 30 : i.height, s = this.popupRef.value.getBoundingClientRect().height;
|
|
580
|
-
let
|
|
581
|
-
i && i.top + s > window.innerHeight && i.top - s > 0 && (
|
|
582
|
+
let l = t ? "calc(100% - 30px)" : "100%";
|
|
583
|
+
i && i.top + s > window.innerHeight && i.top - s > 0 && (l = `calc(100% - ${a}px - ${s}px)`), this.popupRef.value.style.top = l;
|
|
582
584
|
}
|
|
583
585
|
}
|
|
584
586
|
handleFocusOut(e) {
|
|
@@ -586,7 +588,7 @@ let l = class extends U {
|
|
|
586
588
|
}
|
|
587
589
|
async showCalendar() {
|
|
588
590
|
var e;
|
|
589
|
-
this.calendarOpen = !0, await
|
|
591
|
+
this.calendarOpen = !0, await B(20), this.handleCalendarPosition(), this.isMobileSafari && ((e = this.calRef.value) == null || e.focusOnCurrentDate());
|
|
590
592
|
}
|
|
591
593
|
hideCalendar() {
|
|
592
594
|
this.calendarOpen = !1;
|
|
@@ -597,64 +599,64 @@ let l = class extends U {
|
|
|
597
599
|
};
|
|
598
600
|
o([
|
|
599
601
|
u({ type: String, reflect: !0 })
|
|
600
|
-
],
|
|
602
|
+
], r.prototype, "value", 2);
|
|
601
603
|
o([
|
|
602
604
|
u({ type: Array })
|
|
603
|
-
],
|
|
605
|
+
], r.prototype, "_value", 2);
|
|
604
606
|
o([
|
|
605
607
|
u({ type: String, reflect: !0 })
|
|
606
|
-
],
|
|
608
|
+
], r.prototype, "label", 2);
|
|
607
609
|
o([
|
|
608
610
|
u({ type: String })
|
|
609
|
-
],
|
|
611
|
+
], r.prototype, "dateformat", 2);
|
|
610
612
|
o([
|
|
611
613
|
u({ type: Boolean, reflect: !0 })
|
|
612
|
-
],
|
|
614
|
+
], r.prototype, "multiple", 2);
|
|
613
615
|
o([
|
|
614
616
|
u({ type: Number, reflect: !0 })
|
|
615
|
-
],
|
|
617
|
+
], r.prototype, "maxlength", 2);
|
|
616
618
|
o([
|
|
617
619
|
u({ type: Boolean, reflect: !0 })
|
|
618
|
-
],
|
|
620
|
+
], r.prototype, "range", 2);
|
|
619
621
|
o([
|
|
620
622
|
u({ type: Boolean })
|
|
621
|
-
],
|
|
623
|
+
], r.prototype, "showRangeLabels", 2);
|
|
622
624
|
o([
|
|
623
625
|
u({ type: String, reflect: !0 })
|
|
624
|
-
],
|
|
626
|
+
], r.prototype, "min", 2);
|
|
625
627
|
o([
|
|
626
628
|
u({ type: String, reflect: !0 })
|
|
627
|
-
],
|
|
629
|
+
], r.prototype, "max", 2);
|
|
628
630
|
o([
|
|
629
631
|
u({ type: Boolean })
|
|
630
|
-
],
|
|
632
|
+
], r.prototype, "weeknumbers", 2);
|
|
631
633
|
o([
|
|
632
634
|
u({ type: Boolean, reflect: !0 })
|
|
633
|
-
],
|
|
635
|
+
], r.prototype, "withcontrols", 2);
|
|
634
636
|
o([
|
|
635
637
|
u({ converter: A.csvToArray })
|
|
636
|
-
],
|
|
638
|
+
], r.prototype, "excludedates", 2);
|
|
637
639
|
o([
|
|
638
640
|
u({ converter: A.csvToArray })
|
|
639
|
-
],
|
|
641
|
+
], r.prototype, "excludeweekdays", 2);
|
|
640
642
|
o([
|
|
641
643
|
u({ type: String })
|
|
642
|
-
],
|
|
644
|
+
], r.prototype, "currentmonth", 2);
|
|
643
645
|
o([
|
|
644
646
|
u({ type: Boolean, reflect: !0 })
|
|
645
|
-
],
|
|
647
|
+
], r.prototype, "calendarOpen", 2);
|
|
646
648
|
o([
|
|
647
649
|
u({ type: String })
|
|
648
|
-
],
|
|
650
|
+
], r.prototype, "timezone", 2);
|
|
649
651
|
o([
|
|
650
652
|
V()
|
|
651
|
-
],
|
|
653
|
+
], r.prototype, "inputClasses", 2);
|
|
652
654
|
o([
|
|
653
655
|
V()
|
|
654
|
-
],
|
|
655
|
-
|
|
656
|
+
], r.prototype, "buttonClasses", 2);
|
|
657
|
+
r = o([
|
|
656
658
|
H("pkt-datepicker")
|
|
657
|
-
],
|
|
659
|
+
], r);
|
|
658
660
|
export {
|
|
659
|
-
|
|
661
|
+
r as P
|
|
660
662
|
};
|