@oslokommune/punkt-elements 14.0.2 → 14.0.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/calendar-BtShW7ER.cjs +90 -0
  3. package/dist/{calendar-Bz27nuTP.js → calendar-yxjSI4wd.js} +766 -682
  4. package/dist/datepicker-D0q75U1Z.js +1463 -0
  5. package/dist/datepicker-DDV382Uu.cjs +271 -0
  6. package/dist/index.d.ts +118 -83
  7. package/dist/pkt-calendar.cjs +1 -1
  8. package/dist/pkt-calendar.js +1 -1
  9. package/dist/pkt-datepicker.cjs +1 -1
  10. package/dist/pkt-datepicker.js +2 -2
  11. package/dist/pkt-index.cjs +1 -1
  12. package/dist/pkt-index.js +3 -3
  13. package/package.json +4 -4
  14. package/src/components/calendar/calendar.ts +372 -414
  15. package/src/components/calendar/helpers/calendar-grid.ts +93 -0
  16. package/src/components/calendar/helpers/date-validation.ts +86 -0
  17. package/src/components/calendar/helpers/index.ts +49 -0
  18. package/src/components/calendar/helpers/keyboard-navigation.ts +54 -0
  19. package/src/components/calendar/helpers/selection-manager.ts +184 -0
  20. package/src/components/datepicker/datepicker-base.ts +151 -0
  21. package/src/components/datepicker/datepicker-multiple.ts +7 -114
  22. package/src/components/datepicker/datepicker-range.ts +21 -141
  23. package/src/components/datepicker/datepicker-single.ts +7 -115
  24. package/src/components/datepicker/datepicker-types.ts +56 -0
  25. package/src/components/datepicker/datepicker-utils.test.ts +730 -0
  26. package/src/components/datepicker/datepicker-utils.ts +338 -9
  27. package/src/components/datepicker/datepicker.ts +25 -1
  28. package/dist/calendar-Dz1Cnzx5.cjs +0 -115
  29. package/dist/datepicker-CnCOXI2x.cjs +0 -289
  30. package/dist/datepicker-DsqM01iU.js +0 -1355
@@ -0,0 +1,271 @@
1
+ "use strict";const l=require("./element-CJ_QKaki.cjs"),B=require("./state-DSjcvzDN.cjs"),u=require("./calendar-BtShW7ER.cjs"),A=require("./input-element-BmXkhljw.cjs"),p=require("./ref-BFa5Utho.cjs");require("./icon-BGuizDwk.cjs");require("./input-wrapper-WEGSbIA6.cjs");const m=require("./class-map-C_erArZz.cjs"),M=require("./repeat-BZb41H64.cjs");require("./tag-BkuJjOy7.cjs");const I=require("./utils-byXsEz1u.cjs"),g=require("./if-defined-Bc9-_I01.cjs"),F=require("./pkt-slot-controller-BzddBp7z.cjs");var j=Object.defineProperty,q=Object.getOwnPropertyDescriptor,b=(s,e,t,a)=>{for(var i=a>1?void 0:a?q(e,t):e,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&j(e,t,i),i};exports.PktDateTags=class extends l.PktElement{constructor(){super(...arguments),this.dates=[],this.dateformat="dd.MM.yyyy",this.className="pkt-datepicker__tags",this.idBase=I.uuidish()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},l.x`
2
+ <div class=${m.e(this.classes)} aria-live="polite">
3
+ ${Array.isArray(this.dates)&&this.dates[0]?M.c(u.sortDateStrings((this.dates??[]).filter(Boolean)),e=>e,e=>{var t;return l.x` <pkt-tag
4
+ id=${this.idBase+e+"-tag"}
5
+ closeTag
6
+ @close=${()=>{this.dispatchEvent(new CustomEvent("date-tag-removed",{detail:e}))}}
7
+ .ariaLabel=${`${(t=this.strings)==null?void 0:t.calendar.deleteDate} ${u.fromISOtoLocal(e,this.dateformat)}`}
8
+ >
9
+ <time datetime=${e}>${u.fromISOtoLocal(e,this.dateformat)}</time>
10
+ </pkt-tag>`}):l.E}
11
+ </div>
12
+ `}};b([l.n({type:Array})],exports.PktDateTags.prototype,"dates",2);b([l.n({type:String})],exports.PktDateTags.prototype,"dateformat",2);b([l.n({type:String,attribute:"class"})],exports.PktDateTags.prototype,"className",2);b([l.n({type:String,attribute:"id-base"})],exports.PktDateTags.prototype,"idBase",2);exports.PktDateTags=b([l.t("pkt-date-tags")],exports.PktDateTags);const L={dateformat:{default:"dd.MM.yyyy"},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},$={props:L},y=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},D={normalizeNameForMultiple(s,e,t){return s?(e||t)&&!s.endsWith("[]")?s+"[]":s:null},validateRangeOrder(s){return!s||s.length!==2?!0:u.isValidDateRange(s[0],s[1])},sortDates(s){return u.sortDateStrings(s)},filterSelectableDates(s,e,t,a,i){return u.filterSelectableDates(s,e,t,a,i)}},V={getInputType(){return y()?"text":"date"}},k={submitForm(s){var t;const e=(t=s.internals)==null?void 0:t.form;e&&e.requestSubmit()},submitFormOrFallback(s,e){const t=s==null?void 0:s.form;t?t.requestSubmit():e()},validateDateInput(s,e,t,a,i){var r,h,E,S;const n=s.value;n&&(t&&t>n?e.setValidity({rangeUnderflow:!0},((h=(r=i==null?void 0:i.forms)==null?void 0:r.messages)==null?void 0:h.rangeUnderflow)||"Value is below minimum",s):a&&a<n&&e.setValidity({rangeOverflow:!0},((S=(E=i==null?void 0:i.forms)==null?void 0:E.messages)==null?void 0:S.rangeOverflow)||"Value is above maximum",s))}},w={addToSelected(s,e,t,a){const i=s.target;if(!i.value)return;const n=t?u.newDate(t):null,r=a?u.newDate(a):null,h=u.newDate(i.value.split(",")[0]);h&&!isNaN(h.getTime())&&(!n||h>=n)&&(!r||h<=r)&&e.value&&e.value.handleDateSelect(h),i.value=""},handleCalendarPosition(s,e,t=!1){var h;if(!s.value||!e.value)return;const a=((h=e.value.parentElement)==null?void 0:h.getBoundingClientRect())||e.value.getBoundingClientRect(),i=t?a.height+30:a.height,n=s.value.getBoundingClientRect().height;let r=t?"calc(100% - 30px)":"100%";a&&a.top+n>window.innerHeight&&a.top-n>0&&(r=`calc(100% - ${i}px - ${n}px)`),s.value.style.top=r}},_={getInputClasses(s,e,t,a,i,n){return{"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":a,"ios-readonly-hack":i===!1&&n==="text"}},getButtonClasses(){return{"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}},getRangeLabelClasses(s){return{"pkt-input-prefix":s,"pkt-hide":!s}}},T={processDateSelection(s,e,t){return!e&&!t?s[0]||"":Array.isArray(s)?s.join(","):s},updateInputValues(s,e,t,a,i,n){s.value&&(a&&(e!=null&&e.value)?(s.value.value=t[0]??"",e.value.value=t[1]??"",n(s.value),n(e.value)):i||(s.value.value=t.length?t[0]:"",n(s.value)))},processRangeBlur(s,e,t,a,i){var r;const n=s.target;if(n.value){i(n);const h=u.fromISOToDate(n.value);h&&((r=t==null?void 0:t.value)==null||r.handleDateSelect(h))}else e[0]&&a()}},C={handleInputKeydown(s,e,t,a,i,n){const{key:r}=s;r===","&&(s.preventDefault(),n?n(s):i&&i()),(r==="Space"||r===" ")&&(s.preventDefault(),e(s)),r==="Enter"&&(s.preventDefault(),t?t():a?a():i&&i())},handleButtonKeydown(s,e){const{key:t}=s;(t==="Enter"||t===" "||t==="Space")&&(s.preventDefault(),e(s))}};var N=Object.defineProperty,U=Object.getOwnPropertyDescriptor,c=(s,e,t,a)=>{for(var i=a>1?void 0:a?U(e,t):e,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&N(e,t,i),i};let d=class extends l.PktElement{constructor(){super(...arguments),this.open=!1,this.multiple=!1,this.range=!1,this.weeknumbers=!1,this.withcontrols=!1,this.maxMultiple=null,this.selected=[],this.earliest=null,this.latest=null,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.popupRef=p.e(),this.calendarRef=p.e(),this.handleDocumentClick=s=>{if(!this.open)return;const e=s.composedPath(),t=this.parentElement,a=this.popupRef.value;!e.includes(this)&&!e.includes(a)&&!(t&&e.includes(t))&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=s=>{this.open&&s.key==="Escape"&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef,document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("click",this.handleDocumentClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)}show(){var s;this.open=!0,(s=this.calendarRef.value)==null||s.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(s){var e;return!!s&&!!((e=this.popupRef.value)!=null&&e.contains(s))}focusOnCurrentDate(){const s=this.calendarRef.value;s&&typeof s.focusOnCurrentDate=="function"&&s.focusOnCurrentDate()}addToSelected(s,e,t){if(typeof w.addToSelected=="function")return w.addToSelected(s,this.calendarRef,e,t)}handleDateSelect(s){const e=this.calendarRef.value;if(e&&typeof e.handleDateSelect=="function")return e.handleDateSelect(s)}render(){const s={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return l.x`
13
+ <div
14
+ class="${m.e(s)}"
15
+ ${p.n(this.popupRef)}
16
+ id="date-popup"
17
+ ?hidden=${!this.open}
18
+ aria-hidden="${!this.open}"
19
+ >
20
+ <pkt-calendar
21
+ ${p.n(this.calendarRef)}
22
+ ?multiple=${this.multiple}
23
+ ?range=${this.range}
24
+ ?weeknumbers=${this.weeknumbers}
25
+ ?withcontrols=${this.withcontrols}
26
+ .maxMultiple=${this.maxMultiple}
27
+ .selected=${this.selected}
28
+ .earliest=${this.earliest}
29
+ .latest=${this.latest}
30
+ .excludedates=${this.excludedates}
31
+ .excludeweekdays=${this.excludeweekdays}
32
+ .currentmonth=${this.currentmonth}
33
+ @date-selected=${e=>{this.selected=e.detail,this.dispatchEvent(new CustomEvent("date-selected",{detail:e.detail,bubbles:!0,composed:!0}))}}
34
+ @close=${()=>{this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}
35
+ ></pkt-calendar>
36
+ </div>
37
+ `}};c([l.n({type:Boolean,reflect:!0})],d.prototype,"open",2);c([l.n({type:Boolean})],d.prototype,"multiple",2);c([l.n({type:Boolean})],d.prototype,"range",2);c([l.n({type:Boolean})],d.prototype,"weeknumbers",2);c([l.n({type:Boolean})],d.prototype,"withcontrols",2);c([l.n({type:Number})],d.prototype,"maxMultiple",2);c([l.n({type:Array})],d.prototype,"selected",2);c([l.n({type:String})],d.prototype,"earliest",2);c([l.n({type:String})],d.prototype,"latest",2);c([l.n({type:Array})],d.prototype,"excludedates",2);c([l.n({type:Array})],d.prototype,"excludeweekdays",2);c([l.n({type:String})],d.prototype,"currentmonth",2);d=c([l.t("pkt-datepicker-popup")],d);var z=Object.defineProperty,v=(s,e,t,a)=>{for(var i=void 0,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=r(e,t,i)||i);return i&&z(e,t,i),i};class f extends l.PktElement{constructor(){super(...arguments),this.inputType="date",this.id="",this.readonly=!1,this.disabled=!1,this.inputClasses={},this.inputRef=p.e(),this.btnRef=p.e()}get inputElement(){return this.inputRef.value}get buttonElement(){return this.btnRef.value}get isInputReadonly(){return this.readonly||this.inputType==="text"}dispatchToggleCalendar(e){this.readonly||this.dispatchEvent(new CustomEvent("toggle-calendar",{detail:e,bubbles:!0,composed:!0}))}dispatchInput(e){this.dispatchEvent(new CustomEvent("input-change",{detail:e,bubbles:!0,composed:!0}))}dispatchFocus(){this.dispatchEvent(new CustomEvent("input-focus",{bubbles:!0,composed:!0}))}dispatchBlur(e){this.dispatchEvent(new CustomEvent("input-blur",{detail:e,bubbles:!0,composed:!0}))}dispatchChange(e){this.dispatchEvent(new CustomEvent("input-changed",{detail:e,bubbles:!0,composed:!0}))}renderCalendarButton(){var e;return l.x`
38
+ <button
39
+ class="${m.e(_.getButtonClasses())}"
40
+ type="button"
41
+ @click=${t=>this.dispatchToggleCalendar(t)}
42
+ @keydown=${t=>{const{key:a}=t;(a==="Enter"||a===" "||a==="Space")&&(t.preventDefault(),this.dispatchToggleCalendar(t))}}
43
+ ?disabled=${this.disabled}
44
+ ${this.btnRef}
45
+ >
46
+ <pkt-icon name="calendar"></pkt-icon>
47
+ <span class="pkt-btn__text">${((e=this.strings.calendar)==null?void 0:e.buttonAltText)||"Åpne kalender"}</span>
48
+ </button>
49
+ `}createRenderRoot(){return this}}v([l.n({type:String})],f.prototype,"inputType");v([l.n({type:String})],f.prototype,"id");v([l.n({type:String})],f.prototype,"min");v([l.n({type:String})],f.prototype,"max");v([l.n({type:String})],f.prototype,"placeholder");v([l.n({type:Boolean})],f.prototype,"readonly");v([l.n({type:Boolean})],f.prototype,"disabled");v([l.n({type:Object})],f.prototype,"inputClasses");v([l.n({type:Object})],f.prototype,"internals");const O={calendar:{buttonAltText:"Åpne kalender"}},K={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}};var W=Object.defineProperty,H=Object.getOwnPropertyDescriptor,R=(s,e,t,a)=>{for(var i=a>1?void 0:a?H(e,t):e,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&W(e,t,i),i};exports.PktDatepickerSingle=class extends f{constructor(){super(...arguments),this.value="",this.strings=O}dispatchManageValidity(e){this.dispatchEvent(new CustomEvent("manage-validity",{detail:e,bubbles:!0,composed:!0}))}render(){return l.x`
50
+ <div class="pkt-input__container">
51
+ <input
52
+ class="${m.e(this.inputClasses)}"
53
+ .type=${this.inputType}
54
+ id="${this.id}-input"
55
+ .value=${this.value}
56
+ min=${g.o(this.min)}
57
+ max=${g.o(this.max)}
58
+ placeholder=${g.o(this.placeholder)}
59
+ ?readonly=${this.isInputReadonly}
60
+ aria-describedby="${this.id}-helptext"
61
+ @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
62
+ @touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
63
+ ?disabled=${this.disabled}
64
+ @keydown=${e=>C.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>k.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()})}
65
+ @input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
66
+ @focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
67
+ @blur=${e=>{this.dispatchBlur(e),this.dispatchManageValidity(e.target),this.dispatchEvent(new CustomEvent("value-change",{detail:e.target.value,bubbles:!0,composed:!0}))}}
68
+ @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
69
+ ${p.n(this.inputRef)}
70
+ />
71
+ ${this.renderCalendarButton()}
72
+ </div>
73
+ `}};R([l.n({type:String})],exports.PktDatepickerSingle.prototype,"value",2);R([l.n({type:Object})],exports.PktDatepickerSingle.prototype,"strings",2);exports.PktDatepickerSingle=R([l.t("pkt-datepicker-single")],exports.PktDatepickerSingle);var G=Object.defineProperty,J=Object.getOwnPropertyDescriptor,x=(s,e,t,a)=>{for(var i=a>1?void 0:a?J(e,t):e,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&G(e,t,i),i};exports.PktDatepickerRange=class extends f{constructor(){super(...arguments),this.value=[],this.showRangeLabels=!1,this.strings=K,this.inputRefTo=p.e()}get inputElementTo(){return this.inputRefTo.value}render(){var t,a;const e=_.getRangeLabelClasses(this.showRangeLabels);return l.x`
74
+ <div class="pkt-input__container">
75
+ ${this.showRangeLabels?l.x` <div class="pkt-input-prefix">${(t=this.strings.generic)==null?void 0:t.from}</div> `:l.E}
76
+ <input
77
+ class=${m.e(this.inputClasses)}
78
+ .type=${this.inputType}
79
+ id="${this.id}-input"
80
+ .value=${this.value[0]??""}
81
+ min=${g.o(this.min)}
82
+ max=${g.o(this.max)}
83
+ placeholder=${g.o(this.placeholder)}
84
+ ?readonly=${this.isInputReadonly}
85
+ ?disabled=${this.disabled}
86
+ @click=${i=>{i.preventDefault(),this.dispatchToggleCalendar(i)}}
87
+ @touchend=${i=>{i.preventDefault(),this.dispatchToggleCalendar(i)}}
88
+ @keydown=${i=>C.handleInputKeydown(i,n=>this.dispatchToggleCalendar(n),()=>k.submitFormOrFallback(this.internals,()=>{var n;return(n=this.inputRefTo.value)==null?void 0:n.focus()}),()=>{var n;return(n=this.inputRefTo.value)==null?void 0:n.focus()},()=>{var n;return(n=this.inputRef.value)==null?void 0:n.blur()})}
89
+ @input=${i=>{this.dispatchInput(i),i.stopImmediatePropagation()}}
90
+ @focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
91
+ @blur=${i=>{this.dispatchBlur(i),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:i,values:this.value,inputType:"from"},bubbles:!0,composed:!0}))}}
92
+ @change=${i=>{this.dispatchChange(i),i.stopImmediatePropagation()}}
93
+ ${p.n(this.inputRef)}
94
+ />
95
+ <div class="${m.e(e)}" id="${this.id}-to-label">
96
+ ${(a=this.strings.generic)==null?void 0:a.to}
97
+ </div>
98
+ ${this.showRangeLabels?l.E:l.x` <div class="pkt-input-separator">–</div> `}
99
+ <input
100
+ class=${m.e(this.inputClasses)}
101
+ .type=${this.inputType}
102
+ id="${this.id}-to"
103
+ aria-labelledby="${this.id}-to-label"
104
+ .value=${this.value[1]??""}
105
+ min=${g.o(this.min)}
106
+ max=${g.o(this.max)}
107
+ placeholder=${g.o(this.placeholder)}
108
+ ?readonly=${this.isInputReadonly}
109
+ ?disabled=${this.disabled}
110
+ @click=${i=>{i.preventDefault(),this.dispatchToggleCalendar(i)}}
111
+ @touchend=${i=>{i.preventDefault(),this.dispatchToggleCalendar(i)}}
112
+ @keydown=${i=>C.handleInputKeydown(i,n=>this.dispatchToggleCalendar(n),()=>k.submitFormOrFallback(this.internals,()=>{var n;return(n=this.inputRefTo.value)==null?void 0:n.blur()}),void 0,()=>{var n;return(n=this.inputRefTo.value)==null?void 0:n.blur()})}
113
+ @input=${i=>{this.dispatchInput(i),i.stopImmediatePropagation()}}
114
+ @focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
115
+ @blur=${i=>{this.dispatchBlur(i),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:i,values:this.value,inputType:"to"},bubbles:!0,composed:!0}))}}
116
+ @change=${i=>{this.dispatchChange(i),i.stopImmediatePropagation()}}
117
+ ${p.n(this.inputRefTo)}
118
+ />
119
+ ${this.renderCalendarButton()}
120
+ </div>
121
+ `}};x([l.n({type:Array})],exports.PktDatepickerRange.prototype,"value",2);x([l.n({type:Boolean})],exports.PktDatepickerRange.prototype,"showRangeLabels",2);x([l.n({type:Object})],exports.PktDatepickerRange.prototype,"strings",2);exports.PktDatepickerRange=x([l.t("pkt-datepicker-range")],exports.PktDatepickerRange);var Q=Object.defineProperty,X=Object.getOwnPropertyDescriptor,P=(s,e,t,a)=>{for(var i=a>1?void 0:a?X(e,t):e,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&Q(e,t,i),i};exports.PktDatepickerMultiple=class extends f{constructor(){super(...arguments),this.value=[],this.strings=O}get isInputDisabled(){return this.disabled||this.maxlength!==void 0&&this.maxlength!==null&&this.value.length>=this.maxlength}dispatchAddToSelected(e){this.dispatchEvent(new CustomEvent("add-to-selected",{detail:e,bubbles:!0,composed:!0}))}render(){return l.x`
122
+ <div class="pkt-input__container">
123
+ <input
124
+ class=${m.e(this.inputClasses)}
125
+ .type=${this.inputType}
126
+ id="${this.id}-input"
127
+ min=${g.o(this.min)}
128
+ max=${g.o(this.max)}
129
+ placeholder=${g.o(this.placeholder)}
130
+ ?readonly=${this.isInputReadonly}
131
+ ?disabled=${this.isInputDisabled}
132
+ @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
133
+ @touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
134
+ @blur=${e=>{this.dispatchBlur(e),this.dispatchAddToSelected(e)}}
135
+ @input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
136
+ @focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
137
+ @keydown=${e=>C.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>k.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,void 0,t=>this.dispatchAddToSelected(t))}
138
+ @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
139
+ ${p.n(this.inputRef)}
140
+ />
141
+ ${this.renderCalendarButton()}
142
+ </div>
143
+ `}};P([l.n({type:Array})],exports.PktDatepickerMultiple.prototype,"value",2);P([l.n({type:Number})],exports.PktDatepickerMultiple.prototype,"maxlength",2);P([l.n({type:Object})],exports.PktDatepickerMultiple.prototype,"strings",2);exports.PktDatepickerMultiple=P([l.t("pkt-datepicker-multiple")],exports.PktDatepickerMultiple);var Y=Object.defineProperty,Z=Object.getOwnPropertyDescriptor,o=(s,e,t,a)=>{for(var i=a>1?void 0:a?Z(e,t):e,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&Y(e,t,i),i};exports.PktDatepicker=class extends A.PktInputElement{constructor(){super(),this._valueProperty="",this.datepickerPopupRef=p.e(),this._value=[],this.label="Datovelger",this.dateformat=$.props.dateformat.default,this.multiple=$.props.multiple.default,this.maxlength=null,this.range=$.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=$.props.weeknumbers.default,this.withcontrols=$.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.calRef=p.e(),this.popupRef=p.e(),this.helptextSlot=p.e(),this.singleInputRef=p.e(),this.rangeInputRef=p.e(),this.multipleInputRef=p.e(),this.addToSelected=e=>{const t=this.datepickerPopupRef.value;return t&&typeof t.addToSelected=="function"?t.addToSelected(e,this.min,this.max):w.addToSelected(e,this.calRef,this.min,this.max)},this.slotController=new F.PktSlotController(this,this.helptextSlot)}get value(){return this._valueProperty}set value(e){const t=this._valueProperty;this._valueProperty=Array.isArray(e)?e.join(","):e||"",this.valueChanged(this._valueProperty,t),this.requestUpdate("value",t)}get inputType(){return V.getInputType()}connectedCallback(){super.connectedCallback(),this.timezone&&this.timezone!==window.pktTz&&(window.pktTz=this.timezone),this.name=D.normalizeNameForMultiple(this.name,this.multiple,this.range)||this.name}disconnectedCallback(){super.disconnectedCallback()}onInput(){this.dispatchEvent(new Event("input",{bubbles:!0}))}valueChanged(e,t){if(e===t)return;const a=u.valueToArray(e),i=this.multiple&&a.length>1?D.filterSelectableDates(a,this.min,this.max,this.excludedates,this.excludeweekdays):a;if(this.range&&!D.validateRangeOrder(i)){this._value=[],this._valueProperty="",super.valueChanged("",t);return}this._value=i;const n=u.arrayToCsv(i);this._valueProperty!==n&&(this._valueProperty=n),super.valueChanged(n,t)}attributeChangedCallback(e,t,a){e==="value"&&this.value!==t&&this.valueChanged(a,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=u.valueToArray(a||"")),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=u.valueToArray(a||"")),super.attributeChangedCallback(e,t,a)}updated(e){if(e.has("value")){const t=Array.isArray(this.value)?this.value.join(","):this.value,a=e.get("value"),i=Array.isArray(a)?a.join(","):a;this.valueChanged(t,i)}(e.has("multiple")||e.has("range"))&&(this.name=D.normalizeNameForMultiple(this.name,this.multiple,this.range)||this.name),e.has("multiple")&&(this.multiple&&!Array.isArray(this._value)?this._value=u.valueToArray(this.value):!this.multiple&&Array.isArray(this._value)&&(this._value=this._value.filter(Boolean)),!this.multiple&&!this.range&&Array.isArray(this._value)&&(this._value=[this._value[0]??""])),super.updated(e)}get inputRef(){return{value:this.currentInputElement}}get inputRefTo(){return{value:this.currentInputElementTo}}get currentInputElement(){var e,t,a;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.inputElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.inputElement:(a=this.singleInputRef.value)==null?void 0:a.inputElement}get currentInputElementTo(){var e;if(this.range)return(e=this.rangeInputRef.value)==null?void 0:e.inputElementTo}get currentButtonElement(){var e,t,a;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.buttonElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.buttonElement:(a=this.singleInputRef.value)==null?void 0:a.buttonElement}get btnRef(){return{value:this.currentButtonElement}}renderInput(){return l.x`
144
+ <pkt-datepicker-single
145
+ .value=${this._value[0]??""}
146
+ .inputType=${this.inputType}
147
+ .id=${this.id}
148
+ .min=${this.min}
149
+ .max=${this.max}
150
+ .placeholder=${this.placeholder}
151
+ .readonly=${this.readonly}
152
+ .disabled=${this.disabled}
153
+ .inputClasses=${this.inputClasses}
154
+ .internals=${this.internals}
155
+ .strings=${this.strings}
156
+ @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
157
+ @input-change=${()=>this.onInput()}
158
+ @input-focus=${()=>this.onFocus()}
159
+ @input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
160
+ @manage-validity=${e=>this.manageValidity(e.detail)}
161
+ @value-change=${e=>{this.value=e.detail}}
162
+ @input-changed=${()=>{this.touched=!0}}
163
+ ${p.n(this.singleInputRef)}
164
+ ></pkt-datepicker-single>
165
+ `}renderRangeInput(){return l.x`
166
+ <pkt-datepicker-range
167
+ .value=${this._value}
168
+ .inputType=${this.inputType}
169
+ .id=${this.id}
170
+ .min=${this.min}
171
+ .max=${this.max}
172
+ .placeholder=${this.placeholder}
173
+ .readonly=${this.readonly}
174
+ .disabled=${this.disabled}
175
+ .showRangeLabels=${this.showRangeLabels}
176
+ .inputClasses=${this.inputClasses}
177
+ .internals=${this.internals}
178
+ .strings=${this.strings}
179
+ @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
180
+ @input-change=${()=>this.onInput()}
181
+ @input-focus=${()=>this.onFocus()}
182
+ @input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
183
+ @range-blur=${e=>{const t=this.currentInputElement,a=this.currentInputElementTo;if(t&&a){const i=t.value,n=a.value;if(i&&n&&i>n)a.value="",this._value=[i],this.value=i;else{const r=[i,n].filter(Boolean);r.length>0&&(r[0]!==this._value[0]||r[1]!==this._value[1])&&(this._value=r,this.value=r.join(","))}}T.processRangeBlur(e.detail.event,e.detail.values,this.calRef,()=>this.clearInputValue(),i=>this.manageValidity(i))}}
184
+ @manage-validity=${e=>this.manageValidity(e.detail)}
185
+ @validate-date-input=${e=>{k.validateDateInput(e.detail,this.internals,this.min,this.max,this.strings)}}
186
+ @handle-date-select=${e=>{var a,i;const t=u.fromISOToDate(e.detail);if(t){const n=u.formatISODate(t);this._value[0]!==n&&this._value[1]!==n&&((i=(a=this.calRef)==null?void 0:a.value)==null||i.handleDateSelect(t))}}}
187
+ @input-changed=${()=>{this.touched=!0}}
188
+ ${p.n(this.rangeInputRef)}
189
+ ></pkt-datepicker-range>
190
+ `}renderMultipleInput(){return l.x`
191
+ <pkt-datepicker-multiple
192
+ .value=${this._value}
193
+ .inputType=${this.inputType}
194
+ .id=${this.id}
195
+ .min=${this.min}
196
+ .max=${this.max}
197
+ .placeholder=${this.placeholder}
198
+ .readonly=${this.readonly}
199
+ .disabled=${this.disabled}
200
+ .maxlength=${this.maxlength}
201
+ .inputClasses=${this.inputClasses}
202
+ .internals=${this.internals}
203
+ .strings=${this.strings}
204
+ @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
205
+ @input-change=${()=>this.onInput()}
206
+ @input-focus=${()=>this.onFocus()}
207
+ @input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
208
+ @add-to-selected=${e=>this.addToSelected(e.detail)}
209
+ @input-changed=${()=>{this.touched=!0}}
210
+ ${p.n(this.multipleInputRef)}
211
+ ></pkt-datepicker-multiple>
212
+ `}renderCalendar(){return l.x`
213
+ <pkt-datepicker-popup
214
+ class="pkt-contents"
215
+ ?open=${this.calendarOpen}
216
+ ?multiple=${this.multiple}
217
+ ?range=${this.range}
218
+ ?weeknumbers=${this.weeknumbers}
219
+ ?withcontrols=${this.withcontrols}
220
+ .maxMultiple=${this.maxlength}
221
+ .selected=${this._value}
222
+ .earliest=${this.min}
223
+ .latest=${this.max}
224
+ .excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(",")}
225
+ .excludeweekdays=${this.excludeweekdays}
226
+ .currentmonth=${this.currentmonth?u.parseISODateString(this.currentmonth):null}
227
+ @date-selected=${e=>{this.value=T.processDateSelection(e.detail,this.multiple,this.range),this._value=e.detail,T.updateInputValues(this.inputRef,this.inputRefTo,this._value,this.range,this.multiple,t=>this.manageValidity(t))}}
228
+ @close=${()=>{this.onBlur(),this.hideCalendar()}}
229
+ ${p.n(this.datepickerPopupRef)}
230
+ ></pkt-datepicker-popup>
231
+ `}render(){return this.inputClasses=_.getInputClasses(this.fullwidth,this.showRangeLabels,this.multiple,this.range,this.readonly,this.inputType),l.x`
232
+ <pkt-input-wrapper
233
+ label="${this.label}"
234
+ forId="${this.id}-input"
235
+ ?counter=${this.multiple&&!!this.maxlength}
236
+ .counterCurrent=${this.value?this._value.length:0}
237
+ .counterMaxLength=${this.maxlength}
238
+ ?disabled=${this.disabled}
239
+ ?hasError=${this.hasError}
240
+ ?hasFieldset=${this.hasFieldset}
241
+ ?inline=${this.inline}
242
+ ?required=${this.required}
243
+ ?optionalTag=${this.optionalTag}
244
+ ?requiredTag=${this.requiredTag}
245
+ useWrapper=${this.useWrapper}
246
+ .optionalText=${this.optionalText}
247
+ .requiredText=${this.requiredText}
248
+ .tagText=${this.tagText}
249
+ .errorMessage=${this.errorMessage}
250
+ .helptext=${this.helptext}
251
+ .helptextDropdown=${this.helptextDropdown}
252
+ .helptextDropdownButton=${this.helptextDropdownButton}
253
+ .ariaDescribedBy=${this.ariaDescribedBy}
254
+ class="pkt-datepicker"
255
+ >
256
+ <div class="pkt-contents" ${p.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
257
+ ${this.multiple?l.x`<pkt-date-tags
258
+ .dates=${this._value}
259
+ dateformat=${this.dateformat}
260
+ strings=${this.strings}
261
+ id-base=${this.id}
262
+ @date-tag-removed=${e=>{var i;const t=this.datepickerPopupRef.value,a=u.fromISOToDate(e.detail);t&&a&&typeof t.handleDateSelect=="function"?t.handleDateSelect(a):(i=this.calRef.value)==null||i.handleDateSelect(a)}}
263
+ ></pkt-date-tags>`:l.E}
264
+ <div
265
+ class="pkt-datepicker__inputs ${this.range&&this.showRangeLabels?"pkt-input__range-inputs":""}"
266
+ >
267
+ ${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
268
+ </div>
269
+ </pkt-input-wrapper>
270
+ ${this.renderCalendar()}
271
+ `}handleCalendarPosition(){const e=this.multiple&&!!this.maxlength;w.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){var t;const e=this.datepickerPopupRef.value;if(this.calendarOpen=!0,e&&typeof e.show=="function"){e.show(),y()&&e.focusOnCurrentDate();return}await I.sleep(20),this.handleCalendarPosition(),y()&&((t=this.calRef.value)==null||t.focusOnCurrentDate())}hideCalendar(){const e=this.datepickerPopupRef.value;if(this.calendarOpen=!1,e&&typeof e.hide=="function")return e.hide()}async toggleCalendar(e){e.preventDefault();const t=this.datepickerPopupRef.value;if(t&&typeof t.toggle=="function"){const a=!!t.open;t.toggle(),this.calendarOpen=!a;return}this.calendarOpen?this.hideCalendar():this.showCalendar()}clearInputValue(){this._value=[],this.value="",this.internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this._value,bubbles:!0,composed:!0}))}};o([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",1);o([l.n({type:Array})],exports.PktDatepicker.prototype,"_value",2);o([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"label",2);o([l.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);o([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);o([l.n({type:Number,reflect:!0})],exports.PktDatepicker.prototype,"maxlength",2);o([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);o([l.n({type:Boolean})],exports.PktDatepicker.prototype,"showRangeLabels",2);o([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"min",2);o([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"max",2);o([l.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);o([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"withcontrols",2);o([l.n({converter:u.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);o([l.n({converter:u.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);o([l.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);o([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"calendarOpen",2);o([l.n({type:String})],exports.PktDatepicker.prototype,"timezone",2);o([B.r()],exports.PktDatepicker.prototype,"inputClasses",2);exports.PktDatepicker=o([l.t("pkt-datepicker")],exports.PktDatepicker);
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import { ReactiveController } from 'lit';
6
6
  import { ReactiveControllerHost } from 'lit';
7
7
  import { Ref } from 'lit/directives/ref.js';
8
8
  import { TemplateResult } from 'lit-html';
9
+ import { TemplateResult as TemplateResult_2 } from 'lit';
9
10
 
10
11
  declare type Booleanish = boolean | 'true' | 'false';
11
12
 
@@ -75,6 +76,47 @@ declare interface IAriaAttributes {
75
76
  'aria-valuetext'?: string;
76
77
  }
77
78
 
79
+ /**
80
+ * Type definitions for the datepicker component family
81
+ */
82
+ /**
83
+ * Internationalization strings for the datepicker components
84
+ */
85
+ declare interface IDatepickerStrings {
86
+ /** Calendar-related strings */
87
+ calendar?: {
88
+ /** Alt text for calendar button */
89
+ buttonAltText?: string;
90
+ };
91
+ /** Generic UI strings (used in range datepicker) */
92
+ generic?: {
93
+ /** Label for range start input */
94
+ from?: string;
95
+ /** Label for range end input */
96
+ to?: string;
97
+ };
98
+ /** Form validation messages */
99
+ forms?: {
100
+ messages?: {
101
+ /** Error message when date is before minimum */
102
+ rangeUnderflow?: string;
103
+ /** Error message when date is after maximum */
104
+ rangeOverflow?: string;
105
+ /** Error message for invalid date format */
106
+ badInput?: string;
107
+ /** Error message when required field is empty */
108
+ valueMissing?: string;
109
+ };
110
+ };
111
+ /** Date-related strings */
112
+ dates?: {
113
+ /** Month label */
114
+ month?: string;
115
+ /** Year label */
116
+ year?: string;
117
+ };
118
+ }
119
+
78
120
  export declare interface IPktAccordion {
79
121
  compact?: boolean;
80
122
  skin?: TPktAccordionSkin;
@@ -515,76 +557,94 @@ export declare class PktButton extends PktElement<IPktButton> implements IPktBut
515
557
  }
516
558
 
517
559
  export declare class PktCalendar extends PktElement {
518
- /**
519
- * Element attributes
520
- */
560
+ selected: string | string[];
521
561
  multiple: boolean;
522
562
  maxMultiple: number;
523
563
  range: boolean;
524
- weeknumbers: boolean;
525
- withcontrols: boolean;
526
- selected: string | string[];
527
564
  earliest: string | null;
528
565
  latest: string | null;
529
566
  excludedates: Date[];
530
567
  excludeweekdays: string[];
568
+ weeknumbers: boolean;
569
+ withcontrols: boolean;
531
570
  currentmonth: Date | null;
532
- /**
533
- * Strings
534
- */
535
571
  dayStrings: string[];
536
572
  dayStringsLong: string[];
537
573
  monthStrings: string[];
538
574
  weekString: string;
539
575
  prevMonthString: string;
540
576
  nextMonthString: string;
541
- /**
542
- * Private properties
543
- */
544
577
  private _selected;
578
+ private inRange;
579
+ private rangeHovered;
545
580
  private year;
546
581
  private month;
547
582
  private week;
548
- private rangeHovered;
549
- private inRange;
583
+ private currentmonthtouched;
550
584
  private focusedDate;
551
585
  private selectableDates;
552
- private currentmonthtouched;
553
586
  private tabIndexSet;
554
587
  /**
555
- * Runs on mount, used to set up various values and whatever you need to run
588
+ * Lifecycle methods
556
589
  */
557
- connectedCallback(): void;
590
+ protected firstUpdated(_changedProperties: PropertyValues): void;
558
591
  disconnectedCallback(): void;
559
- attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
560
592
  updated(changedProperties: PropertyValues): void;
561
- protected firstUpdated(_changedProperties: PropertyValues): void;
562
- convertSelected(): void;
563
- setCurrentMonth(): void;
564
- handleKeydown(e: KeyboardEvent): void;
565
- handleArrowKey(e: KeyboardEvent, direction: number): void;
566
593
  /**
567
- * Component functionality and render
594
+ * Date and selection management
568
595
  */
569
- render(): TemplateResult<1>;
596
+ private convertSelected;
597
+ private setCurrentMonth;
598
+ /**
599
+ * Keyboard navigation
600
+ */
601
+ private handleKeydown;
602
+ private handleArrowKey;
603
+ /**
604
+ * Rendering methods
605
+ */
606
+ render(): TemplateResult_2<1>;
607
+ private renderMonthNavButton;
570
608
  private renderDayNames;
571
609
  private renderMonthNav;
610
+ private getDayViewData;
611
+ private getDateConstraints;
612
+ private isDayDisabled;
613
+ private calculateTabIndex;
614
+ private getDayCellClasses;
615
+ private getDayButtonClasses;
616
+ private handleDayFocus;
572
617
  private renderDayView;
618
+ private renderEmptyDayCell;
619
+ private renderWeekRow;
573
620
  private renderCalendarBody;
621
+ /**
622
+ * Date validation
623
+ */
574
624
  private isExcluded;
625
+ /**
626
+ * Month navigation
627
+ */
575
628
  isPrevMonthAllowed(): boolean;
576
629
  private prevMonth;
577
630
  isNextMonthAllowed(): boolean;
578
631
  private nextMonth;
579
632
  private changeMonth;
580
- private isRangeAllowed;
633
+ /**
634
+ * Date selection logic
635
+ */
581
636
  private emptySelected;
637
+ private normalizeSelected;
582
638
  addToSelected(selectedDate: Date): void;
583
639
  removeFromSelected(selectedDate: Date): void;
584
640
  toggleSelected(selectedDate: Date): void;
641
+ private isRangeAllowed;
585
642
  private handleRangeSelect;
586
643
  private handleRangeHover;
587
- handleDateSelect(selectedDate: Date | null): Promise<void> | undefined;
644
+ handleDateSelect(selectedDate: Date | null): Promise<void>;
645
+ /**
646
+ * Focus management and event handlers
647
+ */
588
648
  focusOnCurrentDate(): void;
589
649
  closeEvent(e: FocusEvent): void;
590
650
  close(): void;
@@ -852,8 +912,17 @@ export declare class PktDatepicker extends PktInputElement<Props_4> {
852
912
  clearInputValue(): void;
853
913
  }
854
914
 
855
- declare class PktDatepickerMultiple extends PktElement {
856
- value: string[];
915
+ /**
916
+ * Abstract base class for datepicker input components
917
+ *
918
+ * Consolidates shared properties, methods, and event dispatchers
919
+ * used by all three datepicker input types (single, multiple, range).
920
+ *
921
+ * Subclasses must implement:
922
+ * - `strings` property with component-specific defaults
923
+ * - `render()` method with component-specific template
924
+ */
925
+ declare abstract class PktDatepickerBase extends PktElement {
857
926
  inputType: string;
858
927
  id: string;
859
928
  min?: string;
@@ -861,23 +930,30 @@ declare class PktDatepickerMultiple extends PktElement {
861
930
  placeholder?: string;
862
931
  readonly: boolean;
863
932
  disabled: boolean;
864
- maxlength?: number;
865
933
  inputClasses: Record<string, boolean>;
866
- internals?: any;
867
- strings: any;
934
+ internals?: ElementInternals;
935
+ abstract strings: IDatepickerStrings;
868
936
  inputRef: Ref<HTMLInputElement>;
869
937
  btnRef: Ref<HTMLButtonElement>;
870
938
  get inputElement(): HTMLInputElement | undefined;
871
939
  get buttonElement(): HTMLButtonElement | undefined;
872
940
  get isInputReadonly(): boolean;
941
+ protected dispatchToggleCalendar(e: Event): void;
942
+ protected dispatchInput(e: Event): void;
943
+ protected dispatchFocus(): void;
944
+ protected dispatchBlur(e: FocusEvent): void;
945
+ protected dispatchChange(e: Event): void;
946
+ protected renderCalendarButton(): TemplateResult_2;
947
+ createRenderRoot(): this;
948
+ abstract render(): TemplateResult_2;
949
+ }
950
+
951
+ declare class PktDatepickerMultiple extends PktDatepickerBase {
952
+ value: string[];
953
+ maxlength?: number;
954
+ strings: IDatepickerStrings;
873
955
  get isInputDisabled(): boolean;
874
- private dispatchToggleCalendar;
875
- private dispatchInput;
876
- private dispatchFocus;
877
- private dispatchBlur;
878
- private dispatchChange;
879
956
  private dispatchAddToSelected;
880
- createRenderRoot(): this;
881
957
  render(): TemplateResult<1>;
882
958
  }
883
959
 
@@ -910,60 +986,19 @@ declare class PktDatepickerPopup extends PktElement {
910
986
  render(): TemplateResult<1>;
911
987
  }
912
988
 
913
- declare class PktDatepickerRange extends PktElement {
989
+ declare class PktDatepickerRange extends PktDatepickerBase {
914
990
  value: string[];
915
- inputType: string;
916
- id: string;
917
- min?: string;
918
- max?: string;
919
- placeholder?: string;
920
- readonly: boolean;
921
- disabled: boolean;
922
991
  showRangeLabels: boolean;
923
- inputClasses: Record<string, boolean>;
924
- internals?: any;
925
- strings: any;
926
- inputRef: Ref<HTMLInputElement>;
992
+ strings: IDatepickerStrings;
927
993
  inputRefTo: Ref<HTMLInputElement>;
928
- btnRef: Ref<HTMLButtonElement>;
929
- get inputElement(): HTMLInputElement | undefined;
930
994
  get inputElementTo(): HTMLInputElement | undefined;
931
- get buttonElement(): HTMLButtonElement | undefined;
932
- get isInputReadonly(): boolean;
933
- private dispatchToggleCalendar;
934
- private dispatchInput;
935
- private dispatchFocus;
936
- private dispatchBlur;
937
- private dispatchChange;
938
- private dispatchManageValidity;
939
- createRenderRoot(): this;
940
995
  render(): TemplateResult<1>;
941
996
  }
942
997
 
943
- declare class PktDatepickerSingle extends PktElement {
998
+ declare class PktDatepickerSingle extends PktDatepickerBase {
944
999
  value: string;
945
- inputType: string;
946
- id: string;
947
- min?: string;
948
- max?: string;
949
- placeholder?: string;
950
- readonly: boolean;
951
- disabled: boolean;
952
- inputClasses: Record<string, boolean>;
953
- internals?: any;
954
- strings: any;
955
- inputRef: Ref<HTMLInputElement>;
956
- btnRef: Ref<HTMLButtonElement>;
957
- get inputElement(): HTMLInputElement | undefined;
958
- get buttonElement(): HTMLButtonElement | undefined;
959
- get isInputReadonly(): boolean;
960
- private dispatchToggleCalendar;
961
- private dispatchInput;
962
- private dispatchFocus;
963
- private dispatchBlur;
964
- private dispatchChange;
1000
+ strings: IDatepickerStrings;
965
1001
  private dispatchManageValidity;
966
- createRenderRoot(): this;
967
1002
  render(): TemplateResult<1>;
968
1003
  }
969
1004
 
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calendar-Dz1Cnzx5.cjs"),t=e.PktCalendar;Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calendar-BtShW7ER.cjs"),t=e.PktCalendar;Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as a } from "./calendar-Bz27nuTP.js";
1
+ import { P as a } from "./calendar-yxjSI4wd.js";
2
2
  const r = a;
3
3
  export {
4
4
  a as PktCalendar,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-CnCOXI2x.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});Object.defineProperty(exports,"PktDatepickerMultiple",{enumerable:!0,get:()=>e.PktDatepickerMultiple});Object.defineProperty(exports,"PktDatepickerRange",{enumerable:!0,get:()=>e.PktDatepickerRange});Object.defineProperty(exports,"PktDatepickerSingle",{enumerable:!0,get:()=>e.PktDatepickerSingle});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-DDV382Uu.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});Object.defineProperty(exports,"PktDatepickerMultiple",{enumerable:!0,get:()=>e.PktDatepickerMultiple});Object.defineProperty(exports,"PktDatepickerRange",{enumerable:!0,get:()=>e.PktDatepickerRange});Object.defineProperty(exports,"PktDatepickerSingle",{enumerable:!0,get:()=>e.PktDatepickerSingle});exports.default=t;
@@ -1,5 +1,5 @@
1
- import { a as e } from "./datepicker-DsqM01iU.js";
2
- import { d as p, c as i, b as c } from "./datepicker-DsqM01iU.js";
1
+ import { a as e } from "./datepicker-D0q75U1Z.js";
2
+ import { d as p, c as i, b as c } from "./datepicker-D0q75U1Z.js";
3
3
  const a = e;
4
4
  export {
5
5
  e as PktDatepicker,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./alert-CCjoJo11.cjs"),P=require("./accordionitem-DCZrHVNR.cjs"),g=require("./backlink-BzEvli8m.cjs"),h=require("./button-abD9URn0.cjs"),k=require("./calendar-Dz1Cnzx5.cjs"),f=require("./card-BAoH1g6O.cjs"),y=require("./combobox-DYYCdlex.cjs"),O=require("./consent-B1N02CuT.cjs"),j=require("./checkbox-BP5zOlPy.cjs"),t=require("./element-CJ_QKaki.cjs"),q=require("./pkt-slot-controller-BzddBp7z.cjs"),a=require("./ref-BFa5Utho.cjs"),x=require("./class-map-C_erArZz.cjs"),d=require("./datepicker-CnCOXI2x.cjs"),l=require("./pkt-header.cjs"),C=require("./helptext-EPTR9AIl.cjs"),v=require("./heading-Dv_cH6N1.cjs"),S=require("./icon-BGuizDwk.cjs"),T=require("./input-wrapper-WEGSbIA6.cjs"),$=require("./link-Da3pZ_CW.cjs"),H=require("./linkcard-BM23gzhS.cjs"),L=require("./loader-Bo8RCbCJ.cjs"),_=require("./messagebox-C76IcXTl.cjs"),I=require("./modal-Cdz9JcCX.cjs"),A=require("./progressbar-8gzOtJyh.cjs"),p=require("./radiobutton-BuKXgQm_.cjs"),B=require("./tag-BkuJjOy7.cjs"),b=require("./tabitem-D5zyipN1.cjs"),M=require("./textarea-CcIQXCmC.cjs"),D=require("./textinput-Dn704gQw.cjs"),R=require("./select-BSnylWof.cjs");var w=Object.defineProperty,E=Object.getOwnPropertyDescriptor,o=(s,e,r,i)=>{for(var n=i>1?void 0:i?E(e,r):e,u=s.length-1,c;u>=0;u--)(c=s[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&w(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=a.e(),this.namedSlot=a.e(),this.slotController=new q.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./alert-CCjoJo11.cjs"),P=require("./accordionitem-DCZrHVNR.cjs"),g=require("./backlink-BzEvli8m.cjs"),h=require("./button-abD9URn0.cjs"),k=require("./calendar-BtShW7ER.cjs"),f=require("./card-BAoH1g6O.cjs"),y=require("./combobox-DYYCdlex.cjs"),O=require("./consent-B1N02CuT.cjs"),j=require("./checkbox-BP5zOlPy.cjs"),t=require("./element-CJ_QKaki.cjs"),q=require("./pkt-slot-controller-BzddBp7z.cjs"),a=require("./ref-BFa5Utho.cjs"),x=require("./class-map-C_erArZz.cjs"),d=require("./datepicker-DDV382Uu.cjs"),l=require("./pkt-header.cjs"),C=require("./helptext-EPTR9AIl.cjs"),v=require("./heading-Dv_cH6N1.cjs"),S=require("./icon-BGuizDwk.cjs"),T=require("./input-wrapper-WEGSbIA6.cjs"),$=require("./link-Da3pZ_CW.cjs"),H=require("./linkcard-BM23gzhS.cjs"),L=require("./loader-Bo8RCbCJ.cjs"),_=require("./messagebox-C76IcXTl.cjs"),I=require("./modal-Cdz9JcCX.cjs"),A=require("./progressbar-8gzOtJyh.cjs"),p=require("./radiobutton-BuKXgQm_.cjs"),B=require("./tag-BkuJjOy7.cjs"),b=require("./tabitem-D5zyipN1.cjs"),M=require("./textarea-CcIQXCmC.cjs"),D=require("./textinput-Dn704gQw.cjs"),R=require("./select-BSnylWof.cjs");var w=Object.defineProperty,E=Object.getOwnPropertyDescriptor,o=(s,e,r,i)=>{for(var n=i>1?void 0:i?E(e,r):e,u=s.length-1,c;u>=0;u--)(c=s[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&w(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=a.e(),this.namedSlot=a.e(),this.slotController=new q.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
2
2
  <div class="${x.e(e)}">
3
3
  <h1 class="pkt-txt-28">${this.string}</h1>
4
4