@oslokommune/punkt-elements 12.30.2 → 12.31.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-CP5oN7df.cjs → alert-BDxxRqgi.cjs} +1 -1
- package/dist/{alert-CugVni4g.js → alert-D0S57u0r.js} +5 -5
- package/dist/backlink-CzpB-ih9.js +46 -0
- package/dist/backlink-Dn4DfWVR.cjs +13 -0
- package/dist/backlink.d.ts +15 -0
- package/dist/{button-BCcznC7Q.js → button-9NwGr-OS.js} +2 -2
- package/dist/{button-rngMU-vh.cjs → button-Beo3c7cx.cjs} +1 -1
- package/dist/{calendar-DevhqUoj.js → calendar-BbZNxsKY.js} +4 -4
- package/dist/{calendar-DUkAC9Hx.cjs → calendar-CxBo98iI.cjs} +1 -1
- package/dist/{card-CGMZxbH_.js → card-B0uNyDCw.js} +6 -6
- package/dist/{card-D6VEEvX3.cjs → card-BWslf2mu.cjs} +1 -1
- package/dist/{checkbox-CDMUepTW.cjs → checkbox-9Zjy_NU7.cjs} +1 -1
- package/dist/{checkbox-Dw2CX5zY.js → checkbox-CzDpR6_8.js} +11 -11
- package/dist/{class-map-BYCG9U47.js → class-map-DWtqmIRS.js} +10 -9
- package/dist/class-map-Dj5mbCUg.cjs +5 -0
- package/dist/datepicker-BczZqaup.cjs +155 -0
- package/dist/{datepicker-LKIwV9DD.js → datepicker-CQZ84VOS.js} +18 -17
- package/dist/directive-B76A7YXI.js +27 -0
- package/dist/directive-C_VV3qwo.cjs +5 -0
- package/dist/{element-D_ZgQsSr.js → element-C7XjZtLU.js} +401 -426
- package/dist/{element-r-PeQ419.cjs → element-CzFXQBoS.cjs} +23 -27
- package/dist/{helptext-C0mrdhRi.cjs → helptext-B9kxDc2b.cjs} +1 -1
- package/dist/{helptext-RPq_TKzJ.js → helptext-CqnoPodd.js} +5 -5
- package/dist/{icon-BBFK-d-X.js → icon-BEUgV9Wo.js} +18 -17
- package/dist/icon-BOKusjAA.cjs +9 -0
- package/dist/{if-defined-CWHk9Kqm.cjs → if-defined-CpIkv1A4.cjs} +1 -1
- package/dist/{if-defined-u8oGOhnv.js → if-defined-eRX4e5zO.js} +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/{input-element-B6BTwL1q.js → input-element-BK8UkQli.js} +32 -20
- package/dist/input-element-Dtyuf6s8.cjs +1 -0
- package/dist/{input-wrapper-Dqj4uers.cjs → input-wrapper-Bo2_t6pA.cjs} +1 -1
- package/dist/{input-wrapper-D-pEAZaj.js → input-wrapper-DaZZq8c0.js} +6 -6
- package/dist/{link-C_bwx1Ml.cjs → link-1iq0Pmuf.cjs} +1 -1
- package/dist/{link-CDkU7zsB.js → link-D3U0Jkz8.js} +4 -4
- package/dist/{linkcard-C6mZOE0R.cjs → linkcard-2WzDJPZz.cjs} +1 -1
- package/dist/{linkcard-Dr5iKZrV.js → linkcard-CRpo3tiw.js} +3 -3
- package/dist/{loader-ChVEsONa.js → loader-B1edLWTg.js} +5 -5
- package/dist/{loader-DQV1hMM3.cjs → loader-DI74pe25.cjs} +1 -1
- package/dist/{messagebox-BSyLVNas.cjs → messagebox-DQpEMkS2.cjs} +1 -1
- package/dist/{messagebox-Di7LUz4C.js → messagebox-KP-8-tA9.js} +5 -5
- package/dist/{modal-DZUQb_yG.js → modal-kPX8nO_L.js} +5 -5
- package/dist/{modal-CblCiNUi.cjs → modal-ytIJwfr3.cjs} +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -0
- package/dist/pkt-backlink.js +6 -0
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.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-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +3 -3
- package/dist/pkt-index.js +46 -44
- 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-loader.cjs +1 -1
- package/dist/pkt-loader.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-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- 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/progressbar-B6A9UVXS.cjs +21 -0
- package/dist/{progressbar-CuZj4FWi.js → progressbar-D0nxLqHu.js} +14 -13
- package/dist/radiobutton-BWyQgR_x.cjs +24 -0
- package/dist/radiobutton-DLWjvLBO.js +88 -0
- package/dist/ref-2anvRHT4.cjs +13 -0
- package/dist/{ref-BSGI8ogR.js → ref-DbOSDQbk.js} +27 -26
- package/dist/{select-CnizDIYN.js → select-CzuxXKll.js} +6 -6
- package/dist/{select-DJu4Wr1y.cjs → select-DZL6aa2s.cjs} +1 -1
- package/dist/{state-DuS4ffEQ.js → state-CDQk0DFQ.js} +1 -1
- package/dist/{state-B77EXPZ9.cjs → state-HNj0_316.cjs} +1 -1
- package/dist/{tag-BFqxindw.js → tag-CHtPXyP5.js} +5 -5
- package/dist/{tag-B3KEILId.cjs → tag-D6ARkq2Z.cjs} +1 -1
- package/dist/{textarea-uzzCtHtj.js → textarea-BPqWCymU.js} +17 -16
- package/dist/textarea-VG-UTMLP.cjs +49 -0
- package/dist/{textinput-BRupcl9v.cjs → textinput-CEP7QA3E.cjs} +1 -1
- package/dist/{textinput-DRkv93vp.js → textinput-VD74aGzx.js} +8 -8
- package/package.json +3 -3
- package/src/components/backlink/backlink.ts +52 -0
- package/src/components/backlink/index.ts +6 -0
- package/src/components/checkbox/checkbox.ts +1 -1
- package/src/components/index.ts +3 -0
- package/src/components/radiobutton/radiobutton.ts +13 -3
- package/dist/class-map-Dzci3Pfe.cjs +0 -5
- package/dist/datepicker-NbLoqIKZ.cjs +0 -155
- package/dist/icon-DcJIqTIY.cjs +0 -9
- package/dist/input-element-KOSm5htR.cjs +0 -1
- package/dist/progressbar-C_q48_qh.cjs +0 -21
- package/dist/radiobutton-3e105CXX.cjs +0 -24
- package/dist/radiobutton-CcZ2-z8q.js +0 -88
- package/dist/ref-BUWgvhgU.cjs +0 -13
- package/dist/textarea-BKCVcJ6E.cjs +0 -49
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";const $=require("./class-map-Dj5mbCUg.cjs"),k=require("./if-defined-CpIkv1A4.cjs"),n=require("./element-CzFXQBoS.cjs"),S=require("./state-HNj0_316.cjs"),g=require("./calendar-CxBo98iI.cjs"),P=require("./input-element-Dtyuf6s8.cjs"),r=require("./ref-2anvRHT4.cjs"),w=require("./directive-C_VV3qwo.cjs");require("./icon-BOKusjAA.cjs");require("./input-wrapper-Bo2_t6pA.cjs");require("./tag-D6ARkq2Z.cjs");const I=require("./pkt-slot-controller-Oc32unDk.cjs");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const C=(o,e,t)=>{const i=new Map;for(let s=e;s<=t;s++)i.set(o[s],s);return i},_=w.e(class extends w.i{constructor(o){if(super(o),o.type!==w.t.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=[],a=[];let l=0;for(const c of o)s[l]=i?i(c,l):l,a[l]=t(c,l),l++;return{values:a,keys:s}}render(o,e,t){return this.dt(o,e,t).values}update(o,[e,t,i]){const s=r.p(o),{values:a,keys:l}=this.dt(e,t,i);if(!Array.isArray(s))return this.ut=l,a;const c=this.ut??(this.ut=[]),m=[];let b,D,u=0,h=s.length-1,d=0,f=a.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],a[d]),u++,d++;else if(c[h]===l[f])m[f]=r.v(s[h],a[f]),h--,f--;else if(c[u]===l[f])m[f]=r.v(s[u],a[f]),r.r(o,m[f+1],s[u]),u++,f--;else if(c[h]===l[d])m[d]=r.v(s[h],a[d]),r.r(o,s[u],s[h]),h--,d++;else if(b===void 0&&(b=C(l,d,f),D=C(c,u,h)),b.has(c[u]))if(b.has(c[h])){const v=D.get(l[d]),x=v!==void 0?s[v]:null;if(x===null){const R=r.r(o,s[u]);r.v(R,a[d]),m[d]=R}else m[d]=r.v(x,a[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,a[d]),m[d++]=v}for(;u<=h;){const v=s[u++];v!==null&&r.M(v)}return this.ut=l,r.m(o,m),n.T}}),O="pkt-datepicker",E=!0,M={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"}},q={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:O,"css-class":"pkt-datepicker",isElement:E,props:M,events:q};var B=Object.defineProperty,V=Object.getOwnPropertyDescriptor,p=(o,e,t,i)=>{for(var s=i>1?void 0:i?V(e,t):e,a=o.length-1,l;a>=0;a--)(l=o[a])&&(s=(i?l(e,t,s):l(s))||s);return i&&s&&B(e,t,s),s};const T=o=>new Promise(e=>setTimeout(e,o));exports.PktDatepicker=class extends P.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,a=g.newDate(t.value.split(",")[0]);a&&!isNaN(a.getTime())&&(!i||a>=i)&&(!s||a<=s)&&this.calRef.value&&this.calRef.value.handleDateSelect(a),t.value=""},this.slotController=new I.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 T(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 n.x`
|
|
6
|
+
<input
|
|
7
|
+
class="${$.e(this.inputClasses)}"
|
|
8
|
+
.type=${this.inputType}
|
|
9
|
+
id="${this.id}-input"
|
|
10
|
+
.value=${this._value[0]??""}
|
|
11
|
+
min=${k.o(this.min)}
|
|
12
|
+
max=${k.o(this.max)}
|
|
13
|
+
@click=${e=>{e.preventDefault(),this.showCalendar()}}
|
|
14
|
+
?disabled=${this.disabled}
|
|
15
|
+
@keydown=${e=>{var t;(e.key===","||e.key==="Enter")&&((t=this.inputRef.value)==null||t.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
|
|
16
|
+
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
17
|
+
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
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
|
+
@change=${e=>{e.stopImmediatePropagation()}}
|
|
20
|
+
${r.n(this.inputRef)}
|
|
21
|
+
/>
|
|
22
|
+
`}renderRangeInput(){const e={"pkt-input-prefix":this.showRangeLabels,"pkt-hide":!this.showRangeLabels};return n.x`
|
|
23
|
+
${this.showRangeLabels?n.x` <div class="pkt-input-prefix">${this.strings.generic.from}</div> `:n.E}
|
|
24
|
+
<input
|
|
25
|
+
class=${$.e(this.inputClasses)}
|
|
26
|
+
.type=${this.inputType}
|
|
27
|
+
id="${this.id}-input"
|
|
28
|
+
.value=${this._value[0]??""}
|
|
29
|
+
min=${k.o(this.min)}
|
|
30
|
+
max=${k.o(this.max)}
|
|
31
|
+
?disabled=${this.disabled}
|
|
32
|
+
@click=${t=>{t.preventDefault(),this.showCalendar()}}
|
|
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
|
+
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
36
|
+
@blur=${t=>{var i,s;if(t.target.value){this.manageValidity(t.target);const a=g.fromISOToDate(t.target.value);a&&this._value[0]!==t.target.value&&this._value[1]&&(this.clearInputValue(),(s=(i=this.calRef)==null?void 0:i.value)==null||s.handleDateSelect(a))}else this._value[0]&&this.clearInputValue()}}
|
|
37
|
+
@change=${t=>{t.stopImmediatePropagation()}}
|
|
38
|
+
${r.n(this.inputRef)}
|
|
39
|
+
/>
|
|
40
|
+
<div class="${$.e(e)}" id="${this.id}-to-label">
|
|
41
|
+
${this.strings.generic.to}
|
|
42
|
+
</div>
|
|
43
|
+
${this.showRangeLabels?n.E:n.x` <div class="pkt-input-separator">–</div> `}
|
|
44
|
+
<input
|
|
45
|
+
class=${$.e(this.inputClasses)}
|
|
46
|
+
.type=${this.inputType}
|
|
47
|
+
id="${this.id}-to"
|
|
48
|
+
aria-labelledby="${this.id}-to-label"
|
|
49
|
+
.value=${this._value[1]??""}
|
|
50
|
+
min=${k.o(this.min)}
|
|
51
|
+
max=${k.o(this.max)}
|
|
52
|
+
?disabled=${this.disabled}
|
|
53
|
+
@click=${t=>{t.preventDefault(),this.showCalendar()}}
|
|
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()}}
|
|
56
|
+
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
57
|
+
@blur=${t=>{var i,s,a;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)&&((a=(s=this.calRef)==null?void 0:s.value)==null||a.handleDateSelect(c))}}}
|
|
58
|
+
@change=${t=>{t.stopImmediatePropagation()}}
|
|
59
|
+
${r.n(this.inputRefTo)}
|
|
60
|
+
/>
|
|
61
|
+
`}renderMultipleInput(){return n.x`
|
|
62
|
+
<input
|
|
63
|
+
class=${$.e(this.inputClasses)}
|
|
64
|
+
.type=${this.inputType}
|
|
65
|
+
id="${this.id}-input"
|
|
66
|
+
min=${k.o(this.min)}
|
|
67
|
+
max=${k.o(this.max)}
|
|
68
|
+
?disabled=${this.disabled||this.maxlength&&this._value.length>=this.maxlength}
|
|
69
|
+
@click=${e=>{e.preventDefault(),this.showCalendar()}}
|
|
70
|
+
@blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),this.addToSelected(e)}}
|
|
71
|
+
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
72
|
+
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
73
|
+
@keydown=${e=>{(e.key===","||e.key==="Enter")&&(e.preventDefault(),this.addToSelected(e)),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
|
|
74
|
+
@change=${e=>{e.stopImmediatePropagation()}}
|
|
75
|
+
${r.n(this.inputRef)}
|
|
76
|
+
/>
|
|
77
|
+
`}renderTags(){return n.x`
|
|
78
|
+
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
79
|
+
${this._value[0]?_(this._value??[],e=>e,e=>n.x`
|
|
80
|
+
<pkt-tag
|
|
81
|
+
.id="${this.id+e+"-tag"}"
|
|
82
|
+
closeTag
|
|
83
|
+
ariaLabel="${this.strings.calendar.deleteDate} ${g.fromISOtoLocal(e,this.dateformat)}"
|
|
84
|
+
@close=${()=>{var t;return(t=this.calRef.value)==null?void 0:t.handleDateSelect(g.fromISOToDate(e))}}
|
|
85
|
+
><time datetime="${e}">${g.fromISOtoLocal(e,this.dateformat)}</time></pkt-tag
|
|
86
|
+
>
|
|
87
|
+
`):n.E}
|
|
88
|
+
</div>
|
|
89
|
+
`}renderCalendar(){return n.x`<div
|
|
90
|
+
class="pkt-calendar-popup pkt-${this.calendarOpen?"show":"hide"}"
|
|
91
|
+
@focusout=${e=>{this.calendarOpen&&this.handleFocusOut(e)}}
|
|
92
|
+
id="${this.id}-popup"
|
|
93
|
+
${r.n(this.popupRef)}
|
|
94
|
+
>
|
|
95
|
+
<pkt-calendar
|
|
96
|
+
id="${this.id}-calendar"
|
|
97
|
+
?multiple=${this.multiple}
|
|
98
|
+
?range=${this.range}
|
|
99
|
+
?weeknumbers=${this.weeknumbers}
|
|
100
|
+
?withcontrols=${this.withcontrols}
|
|
101
|
+
.maxMultiple=${this.maxlength}
|
|
102
|
+
.selected=${this._value}
|
|
103
|
+
.earliest=${this.min}
|
|
104
|
+
.latest=${this.max}
|
|
105
|
+
.excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(",")}
|
|
106
|
+
.excludeweekdays=${this.excludeweekdays}
|
|
107
|
+
.currentmonth=${this.currentmonth?g.newDate(this.currentmonth):null}
|
|
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]:""))}}
|
|
109
|
+
@close=${()=>{this.onBlur(),this.hideCalendar()}}
|
|
110
|
+
${r.n(this.calRef)}
|
|
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},n.x`
|
|
113
|
+
<pkt-input-wrapper
|
|
114
|
+
label="${this.label}"
|
|
115
|
+
forId="${this.id}-input"
|
|
116
|
+
?counter=${this.multiple&&!!this.maxlength}
|
|
117
|
+
.counterCurrent=${this.value?this._value.length:0}
|
|
118
|
+
.counterMaxLength=${this.maxlength}
|
|
119
|
+
?disabled=${this.disabled}
|
|
120
|
+
?hasError=${this.hasError}
|
|
121
|
+
?required=${this.required}
|
|
122
|
+
?optionalTag=${this.optionalTag}
|
|
123
|
+
?requiredTag=${this.requiredTag}
|
|
124
|
+
?useWrapper=${this.useWrapper}
|
|
125
|
+
.optionalText=${this.optionalText}
|
|
126
|
+
.requiredText=${this.requiredText}
|
|
127
|
+
.errorMessage=${this.errorMessage}
|
|
128
|
+
.helptext=${this.helptext}
|
|
129
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
130
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
131
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
132
|
+
class="pkt-datepicker"
|
|
133
|
+
>
|
|
134
|
+
<div class="pkt-contents" ${r.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
135
|
+
${this.multiple?this.renderTags():n.E}
|
|
136
|
+
<div
|
|
137
|
+
class="pkt-datepicker__inputs ${this.range&&this.showRangeLabels?"pkt-input__range-inputs":""}"
|
|
138
|
+
>
|
|
139
|
+
<div class="pkt-input__container">
|
|
140
|
+
${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
|
|
141
|
+
<button
|
|
142
|
+
class="${$.e(this.buttonClasses)}"
|
|
143
|
+
type="button"
|
|
144
|
+
@click=${this.toggleCalendar}
|
|
145
|
+
?disabled=${this.disabled}
|
|
146
|
+
${r.n(this.btnRef)}
|
|
147
|
+
>
|
|
148
|
+
<pkt-icon name="calendar"></pkt-icon>
|
|
149
|
+
<span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
|
|
150
|
+
</button>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
</pkt-input-wrapper>
|
|
154
|
+
${this.renderCalendar()}
|
|
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,a=this.popupRef.value.getBoundingClientRect().height;let l=t?"calc(100% - 30px)":"100%";i&&i.top+a>window.innerHeight&&i.top-a>0&&(l=`calc(100% - ${s}px - ${a}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 T(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([n.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",2);p([n.n({type:Array})],exports.PktDatepicker.prototype,"_value",2);p([n.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"label",2);p([n.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);p([n.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);p([n.n({type:Number,reflect:!0})],exports.PktDatepicker.prototype,"maxlength",2);p([n.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);p([n.n({type:Boolean})],exports.PktDatepicker.prototype,"showRangeLabels",2);p([n.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"min",2);p([n.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"max",2);p([n.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);p([n.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"withcontrols",2);p([n.n({converter:g.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);p([n.n({converter:g.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);p([n.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);p([n.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"calendarOpen",2);p([n.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([n.t("pkt-datepicker")],exports.PktDatepicker);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { e as x } from "./class-map-
|
|
2
|
-
import { o as k } from "./if-defined-
|
|
3
|
-
import {
|
|
4
|
-
import { r as V } from "./state-
|
|
5
|
-
import { n as S, f as _, a as
|
|
6
|
-
import { P as
|
|
7
|
-
import { p as
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
1
|
+
import { e as x } from "./class-map-DWtqmIRS.js";
|
|
2
|
+
import { o as k } from "./if-defined-eRX4e5zO.js";
|
|
3
|
+
import { T as L, x as v, E as T, n as u, a as j } from "./element-C7XjZtLU.js";
|
|
4
|
+
import { r as V } from "./state-CDQk0DFQ.js";
|
|
5
|
+
import { n as S, f as _, a as F, b as P, d as A } from "./calendar-BbZNxsKY.js";
|
|
6
|
+
import { P as q } from "./input-element-BK8UkQli.js";
|
|
7
|
+
import { p as H, v as $, r as R, M as I, m as N, e as w, n as y } from "./ref-DbOSDQbk.js";
|
|
8
|
+
import { e as U, i as K, t as W } from "./directive-B76A7YXI.js";
|
|
9
|
+
import "./icon-BEUgV9Wo.js";
|
|
10
|
+
import "./input-wrapper-DaZZq8c0.js";
|
|
11
|
+
import "./tag-CHtPXyP5.js";
|
|
11
12
|
import { P as z } from "./pkt-slot-controller-Clbye6cM.js";
|
|
12
13
|
/**
|
|
13
14
|
* @license
|
|
@@ -18,9 +19,9 @@ const E = (e, t, i) => {
|
|
|
18
19
|
const a = /* @__PURE__ */ new Map();
|
|
19
20
|
for (let s = t; s <= i; s++) a.set(e[s], s);
|
|
20
21
|
return a;
|
|
21
|
-
}, G =
|
|
22
|
+
}, G = U(class extends K {
|
|
22
23
|
constructor(e) {
|
|
23
|
-
if (super(e), e.type !==
|
|
24
|
+
if (super(e), e.type !== W.CHILD) throw Error("repeat() can only be used in text expressions");
|
|
24
25
|
}
|
|
25
26
|
dt(e, t, i) {
|
|
26
27
|
let a;
|
|
@@ -34,7 +35,7 @@ const E = (e, t, i) => {
|
|
|
34
35
|
return this.dt(e, t, i).values;
|
|
35
36
|
}
|
|
36
37
|
update(e, [t, i, a]) {
|
|
37
|
-
const s =
|
|
38
|
+
const s = H(e), { values: l, keys: n } = this.dt(t, i, a);
|
|
38
39
|
if (!Array.isArray(s)) return this.ut = n, l;
|
|
39
40
|
const f = this.ut ?? (this.ut = []), m = [];
|
|
40
41
|
let C, O, p = 0, h = s.length - 1, d = 0, c = l.length - 1;
|
|
@@ -61,7 +62,7 @@ const E = (e, t, i) => {
|
|
|
61
62
|
const g = s[p++];
|
|
62
63
|
g !== null && I(g);
|
|
63
64
|
}
|
|
64
|
-
return this.ut = n,
|
|
65
|
+
return this.ut = n, N(e, m), L;
|
|
65
66
|
}
|
|
66
67
|
}), J = "pkt-datepicker", Q = !0, X = {
|
|
67
68
|
name: {
|
|
@@ -258,7 +259,7 @@ var Z = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, o = (e, t,
|
|
|
258
259
|
return a && s && Z(t, i, s), s;
|
|
259
260
|
};
|
|
260
261
|
const B = (e) => new Promise((t) => setTimeout(t, e));
|
|
261
|
-
let r = class extends
|
|
262
|
+
let r = class extends q {
|
|
262
263
|
/**
|
|
263
264
|
* Housekeeping / lifecycle methods
|
|
264
265
|
*/
|
|
@@ -415,7 +416,7 @@ let r = class extends U {
|
|
|
415
416
|
t.target
|
|
416
417
|
);
|
|
417
418
|
const n = _(t.target.value);
|
|
418
|
-
n && this._value[1] !==
|
|
419
|
+
n && this._value[1] !== F(n) && ((s = (a = this.calRef) == null ? void 0 : a.value) == null || s.handleDateSelect(n));
|
|
419
420
|
}
|
|
420
421
|
}}
|
|
421
422
|
@change=${(t) => {
|
|
@@ -655,7 +656,7 @@ o([
|
|
|
655
656
|
V()
|
|
656
657
|
], r.prototype, "buttonClasses", 2);
|
|
657
658
|
r = o([
|
|
658
|
-
|
|
659
|
+
j("pkt-datepicker")
|
|
659
660
|
], r);
|
|
660
661
|
export {
|
|
661
662
|
r as P
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const s = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, T = (r) => (...t) => ({ _$litDirective$: r, values: t });
|
|
7
|
+
class _ {
|
|
8
|
+
constructor(t) {
|
|
9
|
+
}
|
|
10
|
+
get _$AU() {
|
|
11
|
+
return this._$AM._$AU;
|
|
12
|
+
}
|
|
13
|
+
_$AT(t, e, i) {
|
|
14
|
+
this._$Ct = t, this._$AM = e, this._$Ci = i;
|
|
15
|
+
}
|
|
16
|
+
_$AS(t, e) {
|
|
17
|
+
return this.update(t, e);
|
|
18
|
+
}
|
|
19
|
+
update(t, e) {
|
|
20
|
+
return this.render(...e);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
T as e,
|
|
25
|
+
_ as i,
|
|
26
|
+
s as t
|
|
27
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const r={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},T=i=>(...t)=>({_$litDirective$:i,values:t});class _{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}exports.e=T;exports.i=_;exports.t=r;
|