@oslokommune/punkt-elements 13.6.12 → 13.6.15

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.
@@ -1,190 +0,0 @@
1
- "use strict";const y=require("./class-map-CG3vIaNm.cjs"),f=require("./if-defined-CkVc_RJD.cjs"),r=require("./element-D62wHiNU.cjs"),S=require("./state-BkE_Rxl7.cjs"),p=require("./calendar-DH-fCGyW.cjs"),_=require("./input-element-Y8sdrq9C.cjs"),u=require("./ref-BfgcOXko.cjs");require("./icon-__Hjt2XZ.cjs");require("./input-wrapper-DVjNwf8-.cjs");const T=require("./repeat-DzibMwhi.cjs");require("./tag-BKq07hGI.cjs");const O=require("./stringutils-CkVRq4jP.cjs"),R=require("./pkt-slot-controller-BzddBp7z.cjs"),I=i=>new Promise(e=>setTimeout(e,i)),g={isIOS(){const i=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(i)||/Macintosh/.test(i)&&"ontouchend"in document)}},m={parseValue(i){return i?Array.isArray(i)?i.filter(Boolean):typeof i=="string"?i.split(",").filter(Boolean):String(i).split(",").filter(Boolean):[]},formatValue(i){return i.join(",")},normalizeNameForMultiple(i,e,t){return i?(e||t)&&!i.endsWith("[]")?i+"[]":i:null},normalizeStringArray(i){return typeof i=="string"?i.split(",").filter(Boolean):Array.isArray(i)?i:[]},validateRangeOrder(i){return!i||i.length!==2?!0:p.isValidDateRange(i[0],i[1])},sortDates(i){return p.sortDateStrings(i)},filterSelectableDates(i,e,t,s,a){return p.filterSelectableDates(i,e,t,s,a)}},B={getInputType(){return g.isIOS()?"text":"date"}},v={submitForm(i){var t;const e=(t=i.internals)==null?void 0:t.form;e&&e.requestSubmit()},submitFormOrFallback(i,e){const t=i==null?void 0:i.form;t?t.requestSubmit():e()},validateDateInput(i,e,t,s,a){var l,h,C,P;const n=i.value;n&&(t&&t>n?e.setValidity({rangeUnderflow:!0},((h=(l=a==null?void 0:a.forms)==null?void 0:l.messages)==null?void 0:h.rangeUnderflow)||"Value is below minimum",i):s&&s<n&&e.setValidity({rangeOverflow:!0},((P=(C=a==null?void 0:a.forms)==null?void 0:C.messages)==null?void 0:P.rangeOverflow)||"Value is above maximum",i))}},w={addToSelected(i,e,t,s){const a=i.target;if(!a.value)return;const n=t?p.newDate(t):null,l=s?p.newDate(s):null,h=p.newDate(a.value.split(",")[0]);h&&!isNaN(h.getTime())&&(!n||h>=n)&&(!l||h<=l)&&e.value&&e.value.handleDateSelect(h),a.value=""},handleCalendarPosition(i,e,t=!1){var h;if(!i.value||!e.value)return;const s=((h=e.value.parentElement)==null?void 0:h.getBoundingClientRect())||e.value.getBoundingClientRect(),a=t?s.height+30:s.height,n=i.value.getBoundingClientRect().height;let l=t?"calc(100% - 30px)":"100%";s&&s.top+n>window.innerHeight&&s.top-n>0&&(l=`calc(100% - ${a}px - ${n}px)`),i.value.style.top=l}},D={getInputClasses(i,e,t,s){return{"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":i,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":s}},getButtonClasses(){return{"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}},getRangeLabelClasses(i){return{"pkt-input-prefix":i,"pkt-hide":!i}}},x={processDateSelection(i,e,t){return!e&&!t?i[0]||"":Array.isArray(i)?i.join(","):i},updateInputValues(i,e,t,s,a,n){i.value&&(s&&(e!=null&&e.value)?(i.value.value=t[0]??"",e.value.value=t[1]??"",n(i.value),n(e.value)):a||(i.value.value=t.length?t[0]:"",n(i.value)))},processRangeBlur(i,e,t,s,a){var l;const n=i.target;if(n.value){a(n);const h=p.fromISOToDate(n.value);h&&e[0]!==n.value&&e[1]&&(s(),(l=t==null?void 0:t.value)==null||l.handleDateSelect(h))}else e[0]&&s()}},k={handleInputKeydown(i,e,t,s,a,n){const{key:l}=i;l===","&&(i.preventDefault(),n?n(i):a&&a()),(l==="Space"||l===" ")&&(i.preventDefault(),e(i)),l==="Enter"&&(i.preventDefault(),t?t():s?s():a&&a())},handleButtonKeydown(i,e){const{key:t}=i;(t==="Enter"||t===" "||t==="Space")&&(i.preventDefault(),e(i))}};var A=Object.defineProperty,E=Object.getOwnPropertyDescriptor,b=(i,e,t,s)=>{for(var a=s>1?void 0:s?E(e,t):e,n=i.length-1,l;n>=0;n--)(l=i[n])&&(a=(s?l(e,t,a):l(a))||a);return s&&a&&A(e,t,a),a};exports.PktDateTags=class extends r.PktElement{constructor(){super(...arguments),this.dates=[],this.dateformat="dd.MM.yyyy",this.className="pkt-datepicker__tags",this.idBase=O.uuidish()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},r.x`
2
- <div class=${y.e(this.classes)} aria-live="polite">
3
- ${Array.isArray(this.dates)&&this.dates[0]?T.c(m.sortDates((this.dates??[]).filter(Boolean)),e=>e,e=>{var t;return r.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} ${p.fromISOtoLocal(e,this.dateformat)}`}
8
- >
9
- <time datetime=${e}>${p.fromISOtoLocal(e,this.dateformat)}</time>
10
- </pkt-tag>`}):r.E}
11
- </div>
12
- `}};b([r.n({type:Array})],exports.PktDateTags.prototype,"dates",2);b([r.n({type:String})],exports.PktDateTags.prototype,"dateformat",2);b([r.n({type:String,attribute:"class"})],exports.PktDateTags.prototype,"className",2);b([r.n({type:String,attribute:"id-base"})],exports.PktDateTags.prototype,"idBase",2);exports.PktDateTags=b([r.t("pkt-date-tags")],exports.PktDateTags);const q={dateformat:{default:"dd.MM.yyyy"},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},$={props:q};var F=Object.defineProperty,M=Object.getOwnPropertyDescriptor,c=(i,e,t,s)=>{for(var a=s>1?void 0:s?M(e,t):e,n=i.length-1,l;n>=0;n--)(l=i[n])&&(a=(s?l(e,t,a):l(a))||a);return s&&a&&F(e,t,a),a};let d=class extends r.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=u.e(),this.calendarRef=u.e(),this.handleDocumentClick=i=>{if(!this.open)return;const e=i.composedPath(),t=this.parentElement,s=this.popupRef.value;!e.includes(this)&&!e.includes(s)&&!(t&&e.includes(t))&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=i=>{this.open&&i.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 i;this.open=!0,(i=this.calendarRef.value)==null||i.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(i){var e;return!!i&&!!((e=this.popupRef.value)!=null&&e.contains(i))}focusOnCurrentDate(){const i=this.calendarRef.value;i&&typeof i.focusOnCurrentDate=="function"&&i.focusOnCurrentDate()}addToSelected(i,e,t){if(typeof w.addToSelected=="function")return w.addToSelected(i,this.calendarRef,e,t)}handleDateSelect(i){const e=this.calendarRef.value;if(e&&typeof e.handleDateSelect=="function")return e.handleDateSelect(i)}render(){const i={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return r.x`
13
- <div
14
- class="${y.e(i)}"
15
- ${u.n(this.popupRef)}
16
- id="date-popup"
17
- ?hidden=${!this.open}
18
- aria-hidden="${!this.open}"
19
- >
20
- <pkt-calendar
21
- ${u.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([r.n({type:Boolean,reflect:!0})],d.prototype,"open",2);c([r.n({type:Boolean})],d.prototype,"multiple",2);c([r.n({type:Boolean})],d.prototype,"range",2);c([r.n({type:Boolean})],d.prototype,"weeknumbers",2);c([r.n({type:Boolean})],d.prototype,"withcontrols",2);c([r.n({type:Number})],d.prototype,"maxMultiple",2);c([r.n({type:Array})],d.prototype,"selected",2);c([r.n({type:String})],d.prototype,"earliest",2);c([r.n({type:String})],d.prototype,"latest",2);c([r.n({type:Array})],d.prototype,"excludedates",2);c([r.n({type:Array})],d.prototype,"excludeweekdays",2);c([r.n({type:String})],d.prototype,"currentmonth",2);d=c([r.t("pkt-datepicker-popup")],d);var L=Object.defineProperty,V=Object.getOwnPropertyDescriptor,o=(i,e,t,s)=>{for(var a=s>1?void 0:s?V(e,t):e,n=i.length-1,l;n>=0;n--)(l=i[n])&&(a=(s?l(e,t,a):l(a))||a);return s&&a&&L(e,t,a),a};exports.PktDatepicker=class extends _.PktInputElement{constructor(){super(),this._valueProperty="",this.datepickerPopupRef=u.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.buttonClasses={},this.inputRef=u.e(),this.inputRefTo=u.e(),this.btnRef=u.e(),this.calRef=u.e(),this.popupRef=u.e(),this.helptextSlot=u.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 R.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 B.getInputType()}connectedCallback(){super.connectedCallback(),this.timezone&&this.timezone!==window.pktTz&&(window.pktTz=this.timezone),this.name=m.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 s=m.parseValue(e),a=this.multiple&&s.length>1?m.filterSelectableDates(s,this.min,this.max,this.excludedates,this.excludeweekdays):s;if(this.range&&!m.validateRangeOrder(a)){this._value=[],this._valueProperty="",super.valueChanged("",t);return}this._value=a;const n=m.formatValue(a);this._valueProperty!==n&&(this._valueProperty=n),super.valueChanged(n,t)}attributeChangedCallback(e,t,s){e==="value"&&this.value!==t&&this.valueChanged(s,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=m.normalizeStringArray(s||"")),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=m.normalizeStringArray(s||"")),super.attributeChangedCallback(e,t,s)}updated(e){if(e.has("value")){const t=Array.isArray(this.value)?this.value.join(","):this.value,s=e.get("value"),a=Array.isArray(s)?s.join(","):s;this.valueChanged(t,a)}(e.has("multiple")||e.has("range"))&&(this.name=m.normalizeNameForMultiple(this.name,this.multiple,this.range)||this.name),e.has("multiple")&&(this.multiple&&!Array.isArray(this._value)?this._value=m.parseValue(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)}renderInput(){return r.x`
38
- <input
39
- class="${y.e(this.inputClasses)}"
40
- .type=${this.inputType}
41
- id="${this.id}-input"
42
- .value=${this._value[0]??""}
43
- min=${f.o(this.min)}
44
- max=${f.o(this.max)}
45
- placeholder=${f.o(this.placeholder)}
46
- ?readonly=${this.readonly}
47
- aria-describedby="${this.id}-helptext"
48
- @click=${e=>{e.preventDefault(),this.showCalendar()}}
49
- ?disabled=${this.disabled}
50
- @keydown=${e=>k.handleInputKeydown(e,t=>this.toggleCalendar(t),()=>v.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()})}
51
- @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
52
- @focus=${()=>{this.onFocus(),g.isIOS()&&this.showCalendar()}}
53
- @blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),this.manageValidity(e.target),this.value=e.target.value}}
54
- @change=${e=>{this.touched=!0,e.stopImmediatePropagation()}}
55
- ${u.n(this.inputRef)}
56
- />
57
- `}renderRangeInput(){const e=D.getRangeLabelClasses(this.showRangeLabels);return r.x`
58
- ${this.showRangeLabels?r.x` <div class="pkt-input-prefix">${this.strings.generic.from}</div> `:r.E}
59
- <input
60
- class=${y.e(this.inputClasses)}
61
- .type=${this.inputType}
62
- id="${this.id}-input"
63
- .value=${this._value[0]??""}
64
- min=${f.o(this.min)}
65
- max=${f.o(this.max)}
66
- placeholder=${f.o(this.placeholder)}
67
- ?readonly=${this.readonly}
68
- ?disabled=${this.disabled}
69
- @click=${t=>{t.preventDefault(),this.showCalendar()}}
70
- @keydown=${t=>k.handleInputKeydown(t,s=>this.toggleCalendar(s),()=>v.submitFormOrFallback(this.internals,()=>{var s;return(s=this.inputRefTo.value)==null?void 0:s.focus()}),()=>{var s;return(s=this.inputRefTo.value)==null?void 0:s.focus()},()=>{var s;return(s=this.inputRef.value)==null?void 0:s.blur()})}
71
- @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
72
- @focus=${()=>{this.onFocus(),g.isIOS()&&this.showCalendar()}}
73
- @blur=${t=>{x.processRangeBlur(t,this._value,this.calRef,()=>this.clearInputValue(),s=>this.manageValidity(s))}}
74
- @change=${t=>{t.stopImmediatePropagation()}}
75
- ${u.n(this.inputRef)}
76
- />
77
- <div class="${y.e(e)}" id="${this.id}-to-label">
78
- ${this.strings.generic.to}
79
- </div>
80
- ${this.showRangeLabels?r.E:r.x` <div class="pkt-input-separator">–</div> `}
81
- <input
82
- class=${y.e(this.inputClasses)}
83
- .type=${this.inputType}
84
- id="${this.id}-to"
85
- aria-labelledby="${this.id}-to-label"
86
- .value=${this._value[1]??""}
87
- min=${f.o(this.min)}
88
- max=${f.o(this.max)}
89
- placeholder=${f.o(this.placeholder)}
90
- ?readonly=${this.readonly}
91
- ?disabled=${this.disabled}
92
- @click=${t=>{t.preventDefault(),this.showCalendar()}}
93
- @keydown=${t=>k.handleInputKeydown(t,s=>this.toggleCalendar(s),()=>v.submitFormOrFallback(this.internals,()=>{var s;return(s=this.inputRefTo.value)==null?void 0:s.blur()}),void 0,()=>{var s;return(s=this.inputRefTo.value)==null?void 0:s.blur()})}
94
- @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
95
- @focus=${()=>{this.onFocus(),g.isIOS()&&this.showCalendar()}}
96
- @blur=${t=>{var s,a,n;if((s=this.calRef.value)!=null&&s.contains(t.relatedTarget)||this.onBlur(),t.target.value){this.manageValidity(t.target),v.validateDateInput(t.target,this.internals,this.min,this.max,this.strings);const l=p.fromISOToDate(t.target.value);l&&this._value[1]!==p.formatISODate(l)&&((n=(a=this.calRef)==null?void 0:a.value)==null||n.handleDateSelect(l))}}}
97
- @change=${t=>{this.touched=!0,t.stopImmediatePropagation()}}
98
- ${u.n(this.inputRefTo)}
99
- />
100
- `}renderMultipleInput(){return r.x`
101
- <input
102
- class=${y.e(this.inputClasses)}
103
- .type=${this.inputType}
104
- id="${this.id}-input"
105
- min=${f.o(this.min)}
106
- max=${f.o(this.max)}
107
- placeholder=${f.o(this.placeholder)}
108
- ?readonly=${this.readonly}
109
- ?disabled=${this.disabled||this.maxlength&&this._value.length>=this.maxlength}
110
- @click=${e=>{e.preventDefault(),this.showCalendar()}}
111
- @blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),this.addToSelected(e)}}
112
- @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
113
- @focus=${()=>{this.onFocus(),g.isIOS()&&this.showCalendar()}}
114
- @keydown=${e=>k.handleInputKeydown(e,t=>this.toggleCalendar(t),()=>v.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,void 0,t=>this.addToSelected(t))}
115
- @change=${e=>{this.touched=!0,e.stopImmediatePropagation()}}
116
- ${u.n(this.inputRef)}
117
- />
118
- `}renderCalendar(){return r.x`
119
- <pkt-datepicker-popup
120
- class="pkt-contents"
121
- ?open=${this.calendarOpen}
122
- ?multiple=${this.multiple}
123
- ?range=${this.range}
124
- ?weeknumbers=${this.weeknumbers}
125
- ?withcontrols=${this.withcontrols}
126
- .maxMultiple=${this.maxlength}
127
- .selected=${this._value}
128
- .earliest=${this.min}
129
- .latest=${this.max}
130
- .excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(",")}
131
- .excludeweekdays=${this.excludeweekdays}
132
- .currentmonth=${this.currentmonth?p.parseISODateString(this.currentmonth):null}
133
- @date-selected=${e=>{this.value=x.processDateSelection(e.detail,this.multiple,this.range),this._value=e.detail,x.updateInputValues(this.inputRef,this.inputRefTo,this._value,this.range,this.multiple,t=>this.manageValidity(t))}}
134
- @close=${()=>{this.onBlur(),this.hideCalendar()}}
135
- ${u.n(this.datepickerPopupRef)}
136
- ></pkt-datepicker-popup>
137
- `}render(){return this.inputClasses=D.getInputClasses(this.fullwidth,this.showRangeLabels,this.multiple,this.range),this.buttonClasses=D.getButtonClasses(),r.x`
138
- <pkt-input-wrapper
139
- label="${this.label}"
140
- forId="${this.id}-input"
141
- ?counter=${this.multiple&&!!this.maxlength}
142
- .counterCurrent=${this.value?this._value.length:0}
143
- .counterMaxLength=${this.maxlength}
144
- ?disabled=${this.disabled}
145
- ?hasError=${this.hasError}
146
- ?hasFieldset=${this.hasFieldset}
147
- ?inline=${this.inline}
148
- ?required=${this.required}
149
- ?optionalTag=${this.optionalTag}
150
- ?requiredTag=${this.requiredTag}
151
- ?useWrapper=${this.useWrapper}
152
- .optionalText=${this.optionalText}
153
- .requiredText=${this.requiredText}
154
- .tagText=${this.tagText}
155
- .errorMessage=${this.errorMessage}
156
- .helptext=${this.helptext}
157
- .helptextDropdown=${this.helptextDropdown}
158
- .helptextDropdownButton=${this.helptextDropdownButton}
159
- .ariaDescribedBy=${this.ariaDescribedBy}
160
- class="pkt-datepicker"
161
- >
162
- <div class="pkt-contents" ${u.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
163
- ${this.multiple?r.x`<pkt-date-tags
164
- .dates=${this._value}
165
- dateformat=${this.dateformat}
166
- strings=${this.strings}
167
- id-base=${this.id}
168
- @date-tag-removed=${e=>{var a;const t=this.datepickerPopupRef.value,s=p.fromISOToDate(e.detail);t&&s&&typeof t.handleDateSelect=="function"?t.handleDateSelect(s):(a=this.calRef.value)==null||a.handleDateSelect(s)}}
169
- ></pkt-date-tags>`:r.E}
170
- <div
171
- class="pkt-datepicker__inputs ${this.range&&this.showRangeLabels?"pkt-input__range-inputs":""}"
172
- >
173
- <div class="pkt-input__container">
174
- ${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
175
- <button
176
- class="${y.e(this.buttonClasses)}"
177
- type="button"
178
- @click=${this.toggleCalendar}
179
- @keydown=${e=>k.handleButtonKeydown(e,t=>this.toggleCalendar(t))}
180
- ?disabled=${this.disabled}
181
- ${u.n(this.btnRef)}
182
- >
183
- <pkt-icon name="calendar"></pkt-icon>
184
- <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
185
- </button>
186
- </div>
187
- </div>
188
- </pkt-input-wrapper>
189
- ${this.renderCalendar()}
190
- `}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(),g.isIOS()&&e.focusOnCurrentDate();return}await I(20),this.handleCalendarPosition(),g.isIOS()&&((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 s=!!t.open;t.toggle(),this.calendarOpen=!s;return}this.calendarOpen?this.hideCalendar():this.showCalendar()}clearInputValue(){this._value=[],this.value=""}};o([r.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",1);o([r.n({type:Array})],exports.PktDatepicker.prototype,"_value",2);o([r.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"label",2);o([r.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);o([r.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);o([r.n({type:Number,reflect:!0})],exports.PktDatepicker.prototype,"maxlength",2);o([r.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);o([r.n({type:Boolean})],exports.PktDatepicker.prototype,"showRangeLabels",2);o([r.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"min",2);o([r.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"max",2);o([r.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);o([r.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"withcontrols",2);o([r.n({converter:p.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);o([r.n({converter:p.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);o([r.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);o([r.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"calendarOpen",2);o([r.n({type:String})],exports.PktDatepicker.prototype,"timezone",2);o([S.r()],exports.PktDatepicker.prototype,"inputClasses",2);o([S.r()],exports.PktDatepicker.prototype,"buttonClasses",2);exports.PktDatepicker=o([r.t("pkt-datepicker")],exports.PktDatepicker);