@oslokommune/punkt-elements 12.11.2 → 12.11.4
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/{class-map-DpN1m5lh.js → class-map-BQ3-MseA.js} +1 -1
- package/dist/{class-map-B9m-NycN.cjs → class-map-DLFPHEre.cjs} +1 -1
- package/dist/{helptext-B0Frb38k.js → helptext-D-5_-HAW.js} +3 -3
- package/dist/{helptext-0fI9cWEe.cjs → helptext-WCq0-Dq8.cjs} +1 -1
- package/dist/{index-Dw-V4--g.js → index-BQ9BMXel.js} +31 -27
- package/dist/{index-DmedytuY.js → index-BR7EVgX9.js} +3 -3
- package/dist/{index-CBFF6OHE.cjs → index-BVbNUNAa.cjs} +5 -5
- package/dist/{index-DkLa0YLm.js → index-BfUPq43a.js} +1 -1
- package/dist/{index-CqWQt14b.cjs → index-DYiD-o1w.cjs} +1 -1
- package/dist/{index-aLVFdclF.cjs → index-DyL6sqFY.cjs} +1 -1
- package/dist/index.d.ts +3 -14
- package/dist/{modal-FnkYHLoK.cjs → modal-BXKX0dxk.cjs} +1 -1
- package/dist/{modal-D6J8TqCp.js → modal-CYx_wrz1.js} +4 -4
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +4 -4
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +4 -4
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +4 -4
- package/dist/pkt-component-template.cjs +1 -1
- package/dist/pkt-component-template.js +3 -3
- package/dist/pkt-datepicker.cjs +42 -37
- package/dist/pkt-datepicker.js +194 -173
- package/dist/pkt-element.cjs +1 -1
- package/dist/pkt-element.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +2 -2
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +4 -4
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +5 -5
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +4 -4
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +4 -4
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +4 -4
- package/dist/{ref-D5FOI49b.js → ref-BjO0bKwt.js} +1 -1
- package/dist/{ref-3QXuhm6y.cjs → ref-CIjJrMxp.cjs} +1 -1
- package/package.json +3 -3
- package/src/components/datepicker/index.ts +42 -23
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { e as u } from "./class-map-
|
|
1
|
+
import { e as u } from "./class-map-BQ3-MseA.js";
|
|
2
2
|
import { t as f } from "./custom-element-CWfU4dcr.js";
|
|
3
|
-
import { r as g, P as b, x as c, E as m, n as a } from "./index-
|
|
4
|
-
import { e as k, P as v, n as h } from "./ref-
|
|
5
|
-
import "./index-
|
|
3
|
+
import { r as g, P as b, x as c, E as m, n as a } from "./index-BQ9BMXel.js";
|
|
4
|
+
import { e as k, P as v, n as h } from "./ref-BjO0bKwt.js";
|
|
5
|
+
import "./index-BfUPq43a.js";
|
|
6
6
|
const y = "pkt-modal", _ = !0, C = {
|
|
7
7
|
"background-click": {
|
|
8
8
|
description: "Event som trigges når bakgrunnen trykkes på"
|
package/dist/pkt-alert.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./class-map-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./class-map-DLFPHEre.cjs"),k=require("./custom-element-B-TlBwRu.cjs"),t=require("./index-BVbNUNAa.cjs"),c=require("./ref-CIjJrMxp.cjs");require("./index-DYiD-o1w.cjs");const u="pkt-alert",m=!0,f={onClose:{description:"React: Klikk-event for 'Lukk'-knappen"},close:{description:"Vue: Klikk-event for 'Lukk'-knappen"}},v={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}},h={default:{description:"Innholdet i meldingen"}},l={name:u,"css-class":"pkt-alert","dark-mode":!0,isElement:m,events:f,props:v,slots:h};var y=Object.defineProperty,_=Object.getOwnPropertyDescriptor,s=(n,e,o,r)=>{for(var i=r>1?void 0:r?_(e,o):e,a=n.length-1,p;a>=0;a--)(p=n[a])&&(i=(r?p(e,o,i):p(i))||i);return r&&i&&y(e,o,i),i};exports.PktAlert=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.compact=l.props.compact.default,this.title="",this.skin=l.props.skin.default,this.ariaLive=l.props.ariaLive.default,this.closeAlert=l.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 c.PktSlotController(this,this.defaultSlot),this._isClosed=!1}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)} aria-live=${this.ariaLive}>
|
|
3
3
|
<pkt-icon
|
|
4
4
|
class="pkt-alert__icon"
|
package/dist/pkt-alert.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { e as m } from "./class-map-
|
|
1
|
+
import { e as m } from "./class-map-BQ3-MseA.js";
|
|
2
2
|
import { t as u } from "./custom-element-CWfU4dcr.js";
|
|
3
|
-
import { r as f, P as h, x as n, E as k, n as o } from "./index-
|
|
4
|
-
import { e as v, P as y, n as _ } from "./ref-
|
|
5
|
-
import "./index-
|
|
3
|
+
import { r as f, P as h, x as n, E as k, n as o } from "./index-BQ9BMXel.js";
|
|
4
|
+
import { e as v, P as y, n as _ } from "./ref-BjO0bKwt.js";
|
|
5
|
+
import "./index-BfUPq43a.js";
|
|
6
6
|
const b = "pkt-alert", g = !0, $ = {
|
|
7
7
|
onClose: {
|
|
8
8
|
description: "React: Klikk-event for 'Lukk'-knappen"
|
package/dist/pkt-calendar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-BVbNUNAa.cjs");require("./converters-DhM11VlY.cjs");require("./custom-element-B-TlBwRu.cjs");require("./class-map-DLFPHEre.cjs");const e=require("./index-DyL6sqFY.cjs");require("./index-DYiD-o1w.cjs");Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});
|
package/dist/pkt-calendar.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./index-
|
|
1
|
+
import "./index-BQ9BMXel.js";
|
|
2
2
|
import "./converters-DNCwIFwr.js";
|
|
3
3
|
import "./custom-element-CWfU4dcr.js";
|
|
4
|
-
import "./class-map-
|
|
5
|
-
import { P as e } from "./index-
|
|
6
|
-
import "./index-
|
|
4
|
+
import "./class-map-BQ3-MseA.js";
|
|
5
|
+
import { P as e } from "./index-BR7EVgX9.js";
|
|
6
|
+
import "./index-BfUPq43a.js";
|
|
7
7
|
export {
|
|
8
8
|
e as PktCalendar
|
|
9
9
|
};
|
package/dist/pkt-card.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./class-map-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./class-map-DLFPHEre.cjs"),g=require("./custom-element-B-TlBwRu.cjs"),t=require("./index-BVbNUNAa.cjs"),d=require("./ref-CIjJrMxp.cjs");require("./index-DYiD-o1w.cjs");require("./pkt-tag.cjs");const k="pkt-card",u=!0,h={heading:{type:"string",name:"Heading",description:"Tittel på kortet"},subheading:{type:"string",name:"Subheading",description:"Undertittel på kortet"},tags:{type:"IPktTag[]",description:"Liste av tags på kortet. Tar inn en array med IPktTag-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:"string",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:["text"]}},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"},image:{type:"object",image:"Image",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.",items:{type:"object",properties:{src:{type:"string",description:"Bilde på kortet"},alt:{type:"string",description:"Tekst for aria-label"}},required:["src","alt"]}}},m={default:{description:"Innholdet i kortet"}},l={name:k,"css-class":"pkt-card",isElement:u,props:h,slots:m};var y=Object.defineProperty,b=Object.getOwnPropertyDescriptor,r=(n,i,s,a)=>{for(var e=a>1?void 0:a?b(i,s):i,o=n.length-1,p;o>=0;o--)(p=n[o])&&(e=(a?p(i,s,e):p(e))||e);return a&&e&&y(i,s,e),e};exports.PktCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=d.e(),this.skin=l.props.skin.default,this.direction=l.props.direction.default,this.image={src:"",alt:""},this.heading="",this.subheading="",this.tags=[],this.slotController=new d.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback()}render(){const i={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.direction}`]:this.direction};return t.x`
|
|
2
2
|
<div class=${c.e(i)}>
|
|
3
3
|
${this.image.src&&t.x`
|
|
4
4
|
<div class="pkt-card__image">
|
package/dist/pkt-card.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { e as g } from "./class-map-
|
|
1
|
+
import { e as g } from "./class-map-BQ3-MseA.js";
|
|
2
2
|
import { t as k } from "./custom-element-CWfU4dcr.js";
|
|
3
|
-
import { P as h, x as r, E as m, n as a } from "./index-
|
|
4
|
-
import { e as u, P as y, n as f } from "./ref-
|
|
5
|
-
import "./index-
|
|
3
|
+
import { P as h, x as r, E as m, n as a } from "./index-BQ9BMXel.js";
|
|
4
|
+
import { e as u, P as y, n as f } from "./ref-BjO0bKwt.js";
|
|
5
|
+
import "./index-BfUPq43a.js";
|
|
6
6
|
import "./pkt-tag.js";
|
|
7
7
|
const b = "pkt-card", v = !0, $ = {
|
|
8
8
|
heading: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BVbNUNAa.cjs"),h=require("./custom-element-B-TlBwRu.cjs"),r=require("./ref-CIjJrMxp.cjs"),c=require("./class-map-DLFPHEre.cjs"),d=require("./converters-DhM11VlY.cjs");var u=Object.defineProperty,m=Object.getOwnPropertyDescriptor,o=(l,t,s,i)=>{for(var n=i>1?void 0:i?m(t,s):t,a=l.length-1,p;a>=0;a--)(p=l[a])&&(n=(i?p(t,s,n):p(n))||n);return i&&n&&u(t,s,n),n};exports.PktComponent=class extends e.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=r.e(),this.namedSlot=r.e(),this.slotController=new r.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(t=>{this._list.push(t.toUpperCase())}),super.connectedCallback()}render(){const t={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return e.x`
|
|
2
2
|
<div class="${c.e(t)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as m, x as h, t as u, n as i } from "./index-
|
|
1
|
+
import { P as m, x as h, t as u, n as i } from "./index-BQ9BMXel.js";
|
|
2
2
|
import { t as f } from "./custom-element-CWfU4dcr.js";
|
|
3
|
-
import { e as d, P as v, n as c } from "./ref-
|
|
4
|
-
import { e as g } from "./class-map-
|
|
3
|
+
import { e as d, P as v, n as c } from "./ref-BjO0bKwt.js";
|
|
4
|
+
import { e as g } from "./class-map-BQ3-MseA.js";
|
|
5
5
|
import { c as k } from "./converters-DNCwIFwr.js";
|
|
6
6
|
var S = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, n = (t, e, l, o) => {
|
|
7
7
|
for (var s = o > 1 ? void 0 : o ? $(e, l) : e, a = t.length - 1, p; a >= 0; a--)
|
package/dist/pkt-datepicker.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-BVbNUNAa.cjs"),b=require("./custom-element-B-TlBwRu.cjs"),r=require("./ref-CIjJrMxp.cjs"),y=require("./class-map-DLFPHEre.cjs"),T=require("./converters-DhM11VlY.cjs"),m=require("./index-DyL6sqFY.cjs");require("./pkt-input-wrapper.cjs");require("./index-DYiD-o1w.cjs");require("./pkt-tag.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
|
|
5
|
+
*/const R=(o,e,t)=>{const i=new Map;for(let a=e;a<=t;a++)i.set(o[a],a);return i},P=b.e(class extends b.i{constructor(o){if(super(o),o.type!==b.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 a=[],n=[];let l=0;for(const c of o)a[l]=i?i(c,l):l,n[l]=t(c,l),l++;return{values:n,keys:a}}render(o,e,t){return this.dt(o,e,t).values}update(o,[e,t,i]){const a=r.p(o),{values:n,keys:l}=this.dt(e,t,i);if(!Array.isArray(a))return this.ut=l,n;const c=this.ut??(this.ut=[]),g=[];let $,w,u=0,h=a.length-1,d=0,f=n.length-1;for(;u<=h&&d<=f;)if(a[u]===null)u++;else if(a[h]===null)h--;else if(c[u]===l[d])g[d]=r.v(a[u],n[d]),u++,d++;else if(c[h]===l[f])g[f]=r.v(a[h],n[f]),h--,f--;else if(c[u]===l[f])g[f]=r.v(a[u],n[f]),r.r(o,g[f+1],a[u]),u++,f--;else if(c[h]===l[d])g[d]=r.v(a[h],n[d]),r.r(o,a[u],a[h]),h--,d++;else if($===void 0&&($=R(l,d,f),w=R(c,u,h)),$.has(c[u]))if($.has(c[h])){const v=w.get(l[d]),x=v!==void 0?a[v]:null;if(x===null){const D=r.r(o,a[u]);r.v(D,n[d]),g[d]=D}else g[d]=r.v(x,n[d]),r.r(o,a[u],x),a[v]=null;d++}else r.M(a[h]),h--;else r.M(a[u]),u++;for(;d<=f;){const v=r.r(o,g[f+1]);r.v(v,n[d]),g[d++]=v}for(;u<=h;){const v=a[u++];v!==null&&r.M(v)}return this.ut=l,r.m(o,g),s.T}}),S="pkt-datepicker",I=!0,_={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"},useWrapper:{type:"boolean",name:"Bruk wrapper",description:"Indikerer at feltet skal ha synlig label og hjelpetekst",default:!0},id:{type:"string",name:"ID",description:"Unik identifikasjon for datovelgeren"}},O={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"}},k={name:S,"css-class":"pkt-datepicker",isElement:I,props:_,events:O};var E=Object.defineProperty,M=Object.getOwnPropertyDescriptor,p=(o,e,t,i)=>{for(var a=i>1?void 0:i?M(e,t):e,n=o.length-1,l;n>=0;n--)(l=o[n])&&(a=(i?l(e,t,a):l(a))||a);return i&&a&&E(e,t,a),a};const C=o=>new Promise(e=>setTimeout(e,o));exports.PktDatepicker=class extends s.PktInputElement{constructor(){super(...arguments),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=k.props.dateformat.default,this.multiple=k.props.multiple.default,this.maxlength=k.props.maxlength.default,this.range=k.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=k.props.weeknumbers.default,this.withcontrols=k.props.withcontrols.default,this.fullwidth=!1,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.useWrapper=!0,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.addToSelected=e=>{const t=e.target;if(!t.value)return;const i=this.min?m.newDate(this.min):null,a=this.max?m.newDate(this.max):null,n=m.newDate(t.value.split(",")[0]);n&&!isNaN(n.getTime())&&(!i||n>=i)&&(!a||n<=a)&&this.calRef.value&&this.calRef.value.handleDateSelect(n),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,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||k.props.min.default,this.max=this.max||k.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){e==="value"&&this.valueChanged(this.value,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)}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"))}}renderInput(){return s.x`
|
|
6
6
|
<input
|
|
7
7
|
class="${y.e(this.inputClasses)}"
|
|
8
8
|
.type=${this.inputType}
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
18
18
|
@blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),this.manageValidity(e.target),this.value=e.target.value}}
|
|
19
19
|
@change=${e=>{e.stopImmediatePropagation()}}
|
|
20
|
-
${
|
|
20
|
+
${r.n(this.inputRef)}
|
|
21
21
|
/>
|
|
22
|
-
`}renderRangeInput(){return
|
|
23
|
-
<div class="pkt-input-prefix"
|
|
22
|
+
`}renderRangeInput(){const e={"pkt-input-prefix":this.showRangeLabels,"pkt-hide":!this.showRangeLabels};return s.x`
|
|
23
|
+
${this.showRangeLabels?s.x` <div class="pkt-input-prefix">${this.strings.generic.from}</div> `:s.E}
|
|
24
24
|
<input
|
|
25
25
|
class=${y.e(this.inputClasses)}
|
|
26
26
|
.type=${this.inputType}
|
|
@@ -28,16 +28,19 @@
|
|
|
28
28
|
.value=${this._value[0]??""}
|
|
29
29
|
min=${this.min}
|
|
30
30
|
max=${this.max}
|
|
31
|
-
@click=${
|
|
31
|
+
@click=${t=>{t.preventDefault(),this.showCalendar()}}
|
|
32
32
|
?disabled=${this.disabled}
|
|
33
|
-
@keydown=${
|
|
34
|
-
@input=${
|
|
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
|
+
@input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
|
|
35
35
|
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
36
|
-
@blur=${
|
|
37
|
-
@change=${
|
|
38
|
-
${
|
|
36
|
+
@blur=${t=>{var i,a;if(t.target.value){this.manageValidity(t.target);const n=m.fromISOToDate(t.target.value);n&&this._value[0]!==t.target.value&&this._value[1]&&(this.clearInputValue(),(a=(i=this.calRef)==null?void 0:i.value)==null||a.handleDateSelect(n))}else this._value[0]&&this.clearInputValue()}}
|
|
37
|
+
@change=${t=>{t.stopImmediatePropagation()}}
|
|
38
|
+
${r.n(this.inputRef)}
|
|
39
39
|
/>
|
|
40
|
-
<div class="
|
|
40
|
+
<div class="${y.e(e)}" id="${this.id}-to-label">
|
|
41
|
+
${this.strings.generic.to}
|
|
42
|
+
</div>
|
|
43
|
+
${this.showRangeLabels?s.E:s.x` <div class="pkt-input-separator">–</div> `}
|
|
41
44
|
<input
|
|
42
45
|
class=${y.e(this.inputClasses)}
|
|
43
46
|
.type=${this.inputType}
|
|
@@ -46,22 +49,22 @@
|
|
|
46
49
|
.value=${this._value[1]??""}
|
|
47
50
|
min=${this.min}
|
|
48
51
|
max=${this.max}
|
|
49
|
-
@click=${
|
|
52
|
+
@click=${t=>{t.preventDefault(),this.showCalendar()}}
|
|
50
53
|
?disabled=${this.disabled}
|
|
51
|
-
@keydown=${
|
|
52
|
-
@input=${
|
|
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
|
+
@input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
|
|
53
56
|
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
54
|
-
@blur=${
|
|
55
|
-
@change=${
|
|
56
|
-
${
|
|
57
|
+
@blur=${t=>{var i,a,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=m.fromISOToDate(t.target.value);c&&this._value[1]!==m.formatISODate(c)&&((n=(a=this.calRef)==null?void 0:a.value)==null||n.handleDateSelect(c))}}}
|
|
58
|
+
@change=${t=>{t.stopImmediatePropagation()}}
|
|
59
|
+
${r.n(this.inputRefTo)}
|
|
57
60
|
/>
|
|
58
|
-
`}renderMultipleInput(){return
|
|
61
|
+
`}renderMultipleInput(){return console.log("renderMultipleInput",this.inputClasses,this.multiple),s.x`
|
|
59
62
|
<input
|
|
60
63
|
class=${y.e(this.inputClasses)}
|
|
61
64
|
.type=${this.inputType}
|
|
62
65
|
id="${this.id}-input"
|
|
63
|
-
min=${this.min}
|
|
64
|
-
max=${this.max}
|
|
66
|
+
.min=${this.min||s.E}
|
|
67
|
+
.max=${this.max||s.E}
|
|
65
68
|
@click=${e=>{e.preventDefault(),this.showCalendar()}}
|
|
66
69
|
@blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),this.addToSelected(e)}}
|
|
67
70
|
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
@@ -69,25 +72,25 @@
|
|
|
69
72
|
@keydown=${e=>{(e.key===","||e.key==="Enter")&&(e.preventDefault(),this.addToSelected(e)),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
|
|
70
73
|
?disabled=${this.disabled||this.maxlength&&this._value.length>=this.maxlength}
|
|
71
74
|
@change=${e=>{e.stopImmediatePropagation()}}
|
|
72
|
-
${
|
|
75
|
+
${r.n(this.inputRef)}
|
|
73
76
|
/>
|
|
74
|
-
`}renderTags(){return
|
|
77
|
+
`}renderTags(){return s.x`
|
|
75
78
|
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
76
|
-
${this._value[0]?
|
|
79
|
+
${this._value[0]?P(this._value??[],e=>e,e=>s.x`
|
|
77
80
|
<pkt-tag
|
|
78
81
|
.id="${this.id+e+"-tag"}"
|
|
79
82
|
closeTag
|
|
80
|
-
ariaLabel="${this.strings.calendar.deleteDate} ${
|
|
81
|
-
@close=${()=>{var t;return(t=this.calRef.value)==null?void 0:t.handleDateSelect(
|
|
82
|
-
>${
|
|
83
|
+
ariaLabel="${this.strings.calendar.deleteDate} ${m.fromISOtoLocal(e,this.dateformat)}"
|
|
84
|
+
@close=${()=>{var t;return(t=this.calRef.value)==null?void 0:t.handleDateSelect(m.fromISOToDate(e))}}
|
|
85
|
+
>${m.fromISOtoLocal(e,this.dateformat)}</pkt-tag
|
|
83
86
|
>
|
|
84
|
-
`):
|
|
87
|
+
`):s.E}
|
|
85
88
|
</div>
|
|
86
|
-
`}renderCalendar(){return
|
|
89
|
+
`}renderCalendar(){return s.x`<div
|
|
87
90
|
class="pkt-calendar-popup pkt-${this.calendarOpen?"show":"hide"}"
|
|
88
91
|
@focusout=${e=>{this.calendarOpen&&this.handleFocusOut(e)}}
|
|
89
92
|
id="${this.id}-popup"
|
|
90
|
-
${
|
|
93
|
+
${r.n(this.popupRef)}
|
|
91
94
|
>
|
|
92
95
|
<pkt-calendar
|
|
93
96
|
id="${this.id}-calendar"
|
|
@@ -101,12 +104,12 @@
|
|
|
101
104
|
.latest=${this.max}
|
|
102
105
|
.excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(",")}
|
|
103
106
|
.excludeweekdays=${this.excludeweekdays}
|
|
104
|
-
.currentmonth=${this.currentmonth?
|
|
107
|
+
.currentmonth=${this.currentmonth?m.newDate(this.currentmonth):null}
|
|
105
108
|
@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]:""))}}
|
|
106
109
|
@close=${()=>{this.onBlur(),this.hideCalendar()}}
|
|
107
|
-
${
|
|
110
|
+
${r.n(this.calRef)}
|
|
108
111
|
></pkt-calendar>
|
|
109
|
-
</div>`}render(){return
|
|
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},s.x`
|
|
110
113
|
<pkt-input-wrapper
|
|
111
114
|
label="${this.label}"
|
|
112
115
|
forId="${this.id}-input"
|
|
@@ -127,8 +130,10 @@
|
|
|
127
130
|
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
128
131
|
class="pkt-datepicker"
|
|
129
132
|
>
|
|
130
|
-
${this.multiple?this.renderTags():
|
|
131
|
-
<div
|
|
133
|
+
${this.multiple?this.renderTags():s.E}
|
|
134
|
+
<div
|
|
135
|
+
class="pkt-datepicker__inputs ${this.range&&this.showRangeLabels?"pkt-input__range-inputs":""}"
|
|
136
|
+
>
|
|
132
137
|
<div class="pkt-input__container">
|
|
133
138
|
${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
|
|
134
139
|
<button
|
|
@@ -136,7 +141,7 @@
|
|
|
136
141
|
type="button"
|
|
137
142
|
@click=${this.toggleCalendar}
|
|
138
143
|
?disabled=${this.disabled}
|
|
139
|
-
${
|
|
144
|
+
${r.n(this.btnRef)}
|
|
140
145
|
>
|
|
141
146
|
<pkt-icon name="calendar"></pkt-icon>
|
|
142
147
|
<span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
|
|
@@ -145,4 +150,4 @@
|
|
|
145
150
|
</div>
|
|
146
151
|
</pkt-input-wrapper>
|
|
147
152
|
${this.renderCalendar()}
|
|
148
|
-
`}handleCalendarPosition(){var e;if(this.popupRef.value&&this.inputRef.value){const t=this.multiple&&!!this.maxlength,
|
|
153
|
+
`}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(),a=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% - ${a}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([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",2);p([s.n({type:Array})],exports.PktDatepicker.prototype,"_value",2);p([s.n({type:String})],exports.PktDatepicker.prototype,"label",2);p([s.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);p([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);p([s.n({type:Number})],exports.PktDatepicker.prototype,"maxlength",2);p([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);p([s.n({type:Boolean})],exports.PktDatepicker.prototype,"showRangeLabels",2);p([s.n({type:String})],exports.PktDatepicker.prototype,"min",2);p([s.n({type:String})],exports.PktDatepicker.prototype,"max",2);p([s.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);p([s.n({type:Boolean})],exports.PktDatepicker.prototype,"withcontrols",2);p([s.n({type:Boolean})],exports.PktDatepicker.prototype,"fullwidth",2);p([s.n({converter:T.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);p([s.n({converter:T.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);p([s.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);p([s.n({type:Boolean})],exports.PktDatepicker.prototype,"useWrapper",2);p([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"calendarOpen",2);p([s.n({type:String})],exports.PktDatepicker.prototype,"timezone",2);p([s.r()],exports.PktDatepicker.prototype,"inputClasses",2);p([s.r()],exports.PktDatepicker.prototype,"buttonClasses",2);exports.PktDatepicker=p([b.t("pkt-datepicker")],exports.PktDatepicker);
|