@oslokommune/punkt-elements 12.31.2 → 12.32.7

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 (181) hide show
  1. package/dist/alert-C2WKLFow.cjs +27 -0
  2. package/dist/alert-XGjypFHe.js +115 -0
  3. package/dist/alert.d.ts +32 -0
  4. package/dist/{backlink-CzpB-ih9.js → backlink-BX8HBhw5.js} +2 -2
  5. package/dist/{backlink-Dn4DfWVR.cjs → backlink-NJdC0FAO.cjs} +1 -1
  6. package/dist/backlink.d.ts +32 -0
  7. package/dist/{button-9NwGr-OS.js → button-Bn8jVB0f.js} +33 -33
  8. package/dist/{button-Beo3c7cx.cjs → button-Bpbh8A_a.cjs} +2 -2
  9. package/dist/button.d.ts +32 -0
  10. package/dist/{calendar-BbZNxsKY.js → calendar-BNHDEEwT.js} +20 -84
  11. package/dist/{calendar-CxBo98iI.cjs → calendar-Ds13AKr5.cjs} +4 -4
  12. package/dist/calendar.d.ts +32 -0
  13. package/dist/card-CEv3DL-o.js +94 -0
  14. package/dist/card-c5EEPaNh.cjs +28 -0
  15. package/dist/card.d.ts +32 -0
  16. package/dist/{checkbox-9Zjy_NU7.cjs → checkbox-DDBBDM85.cjs} +1 -1
  17. package/dist/{checkbox-CzDpR6_8.js → checkbox-DoMYxp83.js} +9 -9
  18. package/dist/checkbox.d.ts +32 -0
  19. package/dist/{class-map-DWtqmIRS.js → class-map-D4tSZX70.js} +2 -2
  20. package/dist/{class-map-Dj5mbCUg.cjs → class-map-DvBKxTiW.cjs} +1 -1
  21. package/dist/combobox-BflWORVa.cjs +115 -0
  22. package/dist/combobox-l7LmWQYu.js +491 -0
  23. package/dist/combobox.d.ts +47 -0
  24. package/dist/datepicker-Bkiyh5P5.cjs +153 -0
  25. package/dist/datepicker-nWd89NwP.js +449 -0
  26. package/dist/datepicker.d.ts +32 -0
  27. package/dist/directive-C7oCP5Bh.cjs +5 -0
  28. package/dist/directive-helpers-BmXIK-1b.js +45 -0
  29. package/dist/directive-helpers-donnvcEO.cjs +5 -0
  30. package/dist/{directive-B76A7YXI.js → directive-oAbCiebi.js} +4 -4
  31. package/dist/element-DJpGVXjq.cjs +238 -0
  32. package/dist/{element-C7XjZtLU.js → element-DiqKrDty.js} +8851 -8847
  33. package/dist/{helptext-CqnoPodd.js → helptext-DfRusn5R.js} +13 -13
  34. package/dist/{helptext-B9kxDc2b.cjs → helptext-aHD9icur.cjs} +2 -2
  35. package/dist/helptext.d.ts +32 -0
  36. package/dist/{icon-BEUgV9Wo.js → icon-BdY52BIt.js} +2 -2
  37. package/dist/{icon-BOKusjAA.cjs → icon-UtDKPH3R.cjs} +1 -1
  38. package/dist/icon.d.ts +32 -0
  39. package/dist/{if-defined-CpIkv1A4.cjs → if-defined-CoBDkDGb.cjs} +1 -1
  40. package/dist/{if-defined-eRX4e5zO.js → if-defined-DeANa4n5.js} +1 -1
  41. package/dist/index.d.ts +210 -15
  42. package/dist/{input-element-BK8UkQli.js → input-element-C4mmTk6h.js} +23 -20
  43. package/dist/input-element-VNai8bsq.cjs +1 -0
  44. package/dist/input-wrapper-8iKEzDRZ.js +40 -0
  45. package/dist/input-wrapper-DWOw7Yn-.cjs +52 -0
  46. package/dist/input-wrapper-EoSAbU-U.cjs +1 -0
  47. package/dist/input-wrapper-P_oEi6dk.js +185 -0
  48. package/dist/input-wrapper.d.ts +32 -0
  49. package/dist/link-D9dJ6F-R.js +73 -0
  50. package/dist/link-DBxXqsnP.cjs +8 -0
  51. package/dist/link.d.ts +32 -0
  52. package/dist/{linkcard-2WzDJPZz.cjs → linkcard-D5O1hR7N.cjs} +1 -1
  53. package/dist/{linkcard-CRpo3tiw.js → linkcard-DcEE9IVw.js} +4 -4
  54. package/dist/linkcard.d.ts +32 -0
  55. package/dist/listbox-CK1GmwCE.cjs +95 -0
  56. package/dist/listbox-CfJWJDrc.js +360 -0
  57. package/dist/listbox.d.ts +47 -0
  58. package/dist/{loader-B1edLWTg.js → loader-DZvOlXzI.js} +6 -6
  59. package/dist/{loader-DI74pe25.cjs → loader-SDXJp58K.cjs} +1 -1
  60. package/dist/loader.d.ts +32 -0
  61. package/dist/messagebox-Ce5e1gga.js +79 -0
  62. package/dist/messagebox-D2_-WZQG.cjs +12 -0
  63. package/dist/messagebox.d.ts +32 -0
  64. package/dist/modal-CCtUsYKk.cjs +33 -0
  65. package/dist/{modal-kPX8nO_L.js → modal-CdgIOp8Q.js} +51 -94
  66. package/dist/modal.d.ts +32 -0
  67. package/dist/pkt-alert.cjs +1 -1
  68. package/dist/pkt-alert.js +1 -1
  69. package/dist/pkt-backlink.cjs +1 -1
  70. package/dist/pkt-backlink.js +1 -1
  71. package/dist/pkt-button.cjs +1 -1
  72. package/dist/pkt-button.js +1 -1
  73. package/dist/pkt-calendar.cjs +1 -1
  74. package/dist/pkt-calendar.js +1 -1
  75. package/dist/pkt-card.cjs +1 -1
  76. package/dist/pkt-card.js +1 -1
  77. package/dist/pkt-checkbox.cjs +1 -1
  78. package/dist/pkt-checkbox.js +1 -1
  79. package/dist/pkt-combobox.cjs +1 -0
  80. package/dist/pkt-combobox.js +6 -0
  81. package/dist/pkt-datepicker.cjs +1 -1
  82. package/dist/pkt-datepicker.js +1 -1
  83. package/dist/pkt-helptext.cjs +1 -1
  84. package/dist/pkt-helptext.js +1 -1
  85. package/dist/pkt-icon.cjs +1 -1
  86. package/dist/pkt-icon.js +1 -1
  87. package/dist/pkt-index.cjs +3 -3
  88. package/dist/pkt-index.js +45 -43
  89. package/dist/pkt-input-wrapper.cjs +1 -1
  90. package/dist/pkt-input-wrapper.js +1 -1
  91. package/dist/pkt-link.cjs +1 -1
  92. package/dist/pkt-link.js +1 -1
  93. package/dist/pkt-linkcard.cjs +1 -1
  94. package/dist/pkt-linkcard.js +1 -1
  95. package/dist/pkt-listbox.cjs +1 -0
  96. package/dist/pkt-listbox.js +6 -0
  97. package/dist/pkt-loader.cjs +1 -1
  98. package/dist/pkt-loader.js +1 -1
  99. package/dist/pkt-messagebox.cjs +1 -1
  100. package/dist/pkt-messagebox.js +1 -1
  101. package/dist/pkt-modal.cjs +1 -1
  102. package/dist/pkt-modal.js +1 -1
  103. package/dist/pkt-options-controller-BkWE4pZe.js +38 -0
  104. package/dist/pkt-options-controller-TJ1apYGF.cjs +1 -0
  105. package/dist/pkt-progressbar.cjs +1 -1
  106. package/dist/pkt-progressbar.js +2 -2
  107. package/dist/pkt-radiobutton.cjs +1 -1
  108. package/dist/pkt-radiobutton.js +1 -1
  109. package/dist/pkt-select.cjs +1 -1
  110. package/dist/pkt-select.js +1 -1
  111. package/dist/pkt-slot-controller-BtVLTZb7.js +79 -0
  112. package/dist/pkt-slot-controller-plQxXRvV.cjs +1 -0
  113. package/dist/pkt-tag.cjs +1 -1
  114. package/dist/pkt-tag.js +1 -1
  115. package/dist/pkt-textarea.cjs +1 -1
  116. package/dist/pkt-textarea.js +1 -1
  117. package/dist/pkt-textinput.cjs +1 -1
  118. package/dist/pkt-textinput.js +1 -1
  119. package/dist/{progressbar-D0nxLqHu.js → progressbar-DvFz9KBo.js} +6 -6
  120. package/dist/{progressbar-B6A9UVXS.cjs → progressbar-jASTnhti.cjs} +1 -1
  121. package/dist/progressbar.d.ts +32 -0
  122. package/dist/{radiobutton-BWyQgR_x.cjs → radiobutton-C-Xd5sSq.cjs} +1 -1
  123. package/dist/{radiobutton-DLWjvLBO.js → radiobutton-D03aN4yn.js} +5 -5
  124. package/dist/radiobutton.d.ts +32 -0
  125. package/dist/ref-B70YZNXm.js +102 -0
  126. package/dist/ref-CLqTsViF.cjs +9 -0
  127. package/dist/repeat-CNLpCTun.js +61 -0
  128. package/dist/repeat-t2oms1o6.cjs +5 -0
  129. package/dist/select-BLDaK5Rd.js +118 -0
  130. package/dist/select-Dvds7MzS.cjs +49 -0
  131. package/dist/select.d.ts +32 -0
  132. package/dist/{state-HNj0_316.cjs → state-C4LdlTYO.cjs} +1 -1
  133. package/dist/{state-CDQk0DFQ.js → state-CDwPbiQj.js} +1 -1
  134. package/dist/tag-C52KeBmR.cjs +18 -0
  135. package/dist/{tag-CmFcSdOV.js → tag-DoS5S2Bq.js} +28 -77
  136. package/dist/tag.d.ts +32 -0
  137. package/dist/{textarea-BPqWCymU.js → textarea-C9EvdPGi.js} +18 -17
  138. package/dist/{textarea-VG-UTMLP.cjs → textarea-DJvNBmEL.cjs} +6 -6
  139. package/dist/textarea.d.ts +32 -0
  140. package/dist/{textinput-CEP7QA3E.cjs → textinput-Cg3ObBuw.cjs} +5 -4
  141. package/dist/{textinput-VD74aGzx.js → textinput-CxRSSYaN.js} +34 -33
  142. package/dist/textinput.d.ts +32 -0
  143. package/package.json +4 -4
  144. package/src/components/button/button.ts +3 -2
  145. package/src/components/combobox/combobox.ts +873 -0
  146. package/src/components/combobox/countrycodes.json +927 -0
  147. package/src/components/combobox/index.ts +6 -0
  148. package/src/components/datepicker/datepicker.ts +6 -4
  149. package/src/components/helptext/helptext.ts +1 -1
  150. package/src/components/index.ts +7 -0
  151. package/src/components/input-wrapper/input-wrapper.ts +42 -34
  152. package/src/components/listbox/index.ts +4 -0
  153. package/src/components/listbox/listbox.ts +474 -0
  154. package/src/components/select/select.ts +7 -0
  155. package/src/components/tag/tag.ts +1 -1
  156. package/src/components/textinput/textinput.ts +3 -2
  157. package/dist/alert-BDxxRqgi.cjs +0 -27
  158. package/dist/alert-D0S57u0r.js +0 -163
  159. package/dist/card-C63x_nll.cjs +0 -28
  160. package/dist/card-DQfNKnKl.js +0 -176
  161. package/dist/datepicker-CYUvRGhE.js +0 -663
  162. package/dist/datepicker-FuAL0uNU.cjs +0 -155
  163. package/dist/directive-C_VV3qwo.cjs +0 -5
  164. package/dist/element-CzFXQBoS.cjs +0 -238
  165. package/dist/input-element-Dtyuf6s8.cjs +0 -1
  166. package/dist/input-wrapper-Bo2_t6pA.cjs +0 -50
  167. package/dist/input-wrapper-Bw9tARAD.js +0 -125
  168. package/dist/input-wrapper-DaZZq8c0.js +0 -172
  169. package/dist/input-wrapper-jPnKsfEC.cjs +0 -1
  170. package/dist/link-1iq0Pmuf.cjs +0 -8
  171. package/dist/link-D3U0Jkz8.js +0 -109
  172. package/dist/messagebox-DQpEMkS2.cjs +0 -12
  173. package/dist/messagebox-KP-8-tA9.js +0 -114
  174. package/dist/modal-ytIJwfr3.cjs +0 -33
  175. package/dist/pkt-slot-controller-Clbye6cM.js +0 -85
  176. package/dist/pkt-slot-controller-Oc32unDk.cjs +0 -1
  177. package/dist/ref-2anvRHT4.cjs +0 -13
  178. package/dist/ref-DbOSDQbk.js +0 -143
  179. package/dist/select-CzuxXKll.js +0 -150
  180. package/dist/select-DZL6aa2s.cjs +0 -48
  181. package/dist/tag-BeLSOjNh.cjs +0 -18
@@ -0,0 +1,47 @@
1
+ export { }
2
+
3
+
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'pkt-combobox': PktCombobox & HTMLSelectElement;
7
+ }
8
+ }
9
+
10
+
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ 'pkt-icon': PktIcon;
14
+ }
15
+ }
16
+
17
+
18
+ declare global {
19
+ interface HTMLElementTagNameMap {
20
+ 'pkt-listbox': PktListbox;
21
+ }
22
+ }
23
+
24
+
25
+ /**
26
+ * Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
27
+ *
28
+ * The component will prioritize options passed as a prop over options passed as children if both are provided.
29
+ * This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
30
+ *
31
+ * @slot (default) - Options to be rendered as children
32
+ * @prop {TSelectOption[]} options - Options to be rendered as children
33
+ *
34
+ *
35
+ */
36
+ declare global {
37
+ interface HTMLElementTagNameMap {
38
+ 'pkt-select': PktSelect & HTMLSelectElement;
39
+ }
40
+ }
41
+
42
+
43
+ declare global {
44
+ interface Window {
45
+ pktTz: string;
46
+ }
47
+ }
@@ -0,0 +1,153 @@
1
+ "use strict";const d=require("./class-map-DvBKxTiW.cjs"),u=require("./if-defined-CoBDkDGb.cjs"),s=require("./element-DJpGVXjq.cjs"),k=require("./state-C4LdlTYO.cjs"),h=require("./calendar-Ds13AKr5.cjs"),m=require("./input-element-VNai8bsq.cjs"),r=require("./ref-CLqTsViF.cjs"),v=require("./repeat-t2oms1o6.cjs");require("./icon-UtDKPH3R.cjs");require("./input-wrapper-DWOw7Yn-.cjs");require("./tag-C52KeBmR.cjs");const $=require("./pkt-slot-controller-plQxXRvV.cjs"),y={dateformat:{default:"dd.MM.yyyy"},min:{default:null},max:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},o={props:y};var x=Object.defineProperty,b=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var n=i>1?void 0:i?b(t,e):t,a=c.length-1,p;a>=0;a--)(p=c[a])&&(n=(i?p(t,e,n):p(n))||n);return i&&n&&x(t,e,n),n};const g=c=>new Promise(t=>setTimeout(t,c));exports.PktDatepicker=class extends m.PktInputElement{constructor(){super(),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=o.props.dateformat.default,this.multiple=o.props.multiple.default,this.maxlength=null,this.range=o.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=o.props.weeknumbers.default,this.withcontrols=o.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=t=>{const e=t.target;if(!e.value)return;const i=this.min?h.newDate(this.min):null,n=this.max?h.newDate(this.max):null,a=h.newDate(e.value.split(",")[0]);a&&!isNaN(a.getTime())&&(!i||a>=i)&&(!n||a<=n)&&this.calRef.value&&this.calRef.value.handleDateSelect(a),e.value=""},this.slotController=new $.PktSlotController(this,this.helptextSlot)}async connectedCallback(){super.connectedCallback();const t=navigator.userAgent,e=/iP(hone|od|ad)/.test(t);this.inputType=e?"text":"date",document&&document.body.addEventListener("click",i=>{var n,a;(n=this.inputRef)!=null&&n.value&&((a=this.btnRef)!=null&&a.value)&&!this.inputRef.value.contains(i.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(i.target))&&!this.btnRef.value.contains(i.target)&&!i.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||o.props.min.default,this.max=this.max||o.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 g(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",t=>{var e,i;(e=this.inputRef)!=null&&e.value&&((i=this.btnRef)!=null&&i.value)&&!this.inputRef.value.contains(t.target)&&!this.btnRef.value.contains(t.target)&&this.hideCalendar()})}attributeChangedCallback(t,e,i){if(t==="value"){if(this.range&&(i==null?void 0:i.split(",").length)===1)return;this.value!==e&&this.valueChanged(i,e)}t==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(i==null?void 0:i.split(","))??[]),t==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(i==null?void 0:i.split(","))??[]),super.attributeChangedCallback(t,e,i)}updated(t){if(t.has("value")){if(this.range&&this.value.length===1)return;this.valueChanged(this.value,t.get("value"))}super.updated(t)}renderInput(){return s.x`
2
+ <input
3
+ class="${d.e(this.inputClasses)}"
4
+ .type=${this.inputType}
5
+ id="${this.id}-input"
6
+ .value=${this._value[0]??""}
7
+ min=${u.o(this.min)}
8
+ max=${u.o(this.max)}
9
+ @click=${t=>{t.preventDefault(),this.showCalendar()}}
10
+ ?disabled=${this.disabled}
11
+ @keydown=${t=>{var e;(t.key===","||t.key==="Enter")&&((e=this.inputRef.value)==null||e.blur()),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
12
+ @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
13
+ @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
14
+ @blur=${t=>{var e;(e=this.calRef.value)!=null&&e.contains(t.relatedTarget)||this.onBlur(),this.manageValidity(t.target),this.value=t.target.value}}
15
+ @change=${t=>{t.stopImmediatePropagation()}}
16
+ ${r.n(this.inputRef)}
17
+ />
18
+ `}renderRangeInput(){const t={"pkt-input-prefix":this.showRangeLabels,"pkt-hide":!this.showRangeLabels};return s.x`
19
+ ${this.showRangeLabels?s.x` <div class="pkt-input-prefix">${this.strings.generic.from}</div> `:s.E}
20
+ <input
21
+ class=${d.e(this.inputClasses)}
22
+ .type=${this.inputType}
23
+ id="${this.id}-input"
24
+ .value=${this._value[0]??""}
25
+ min=${u.o(this.min)}
26
+ max=${u.o(this.max)}
27
+ ?disabled=${this.disabled}
28
+ @click=${e=>{e.preventDefault(),this.showCalendar()}}
29
+ @keydown=${e=>{var i;(e.key===","||e.key==="Enter")&&((i=this.inputRef.value)==null||i.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
30
+ @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
31
+ @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
32
+ @blur=${e=>{var i,n;if(e.target.value){this.manageValidity(e.target);const a=h.fromISOToDate(e.target.value);a&&this._value[0]!==e.target.value&&this._value[1]&&(this.clearInputValue(),(n=(i=this.calRef)==null?void 0:i.value)==null||n.handleDateSelect(a))}else this._value[0]&&this.clearInputValue()}}
33
+ @change=${e=>{e.stopImmediatePropagation()}}
34
+ ${r.n(this.inputRef)}
35
+ />
36
+ <div class="${d.e(t)}" id="${this.id}-to-label">
37
+ ${this.strings.generic.to}
38
+ </div>
39
+ ${this.showRangeLabels?s.E:s.x` <div class="pkt-input-separator">–</div> `}
40
+ <input
41
+ class=${d.e(this.inputClasses)}
42
+ .type=${this.inputType}
43
+ id="${this.id}-to"
44
+ aria-labelledby="${this.id}-to-label"
45
+ .value=${this._value[1]??""}
46
+ min=${u.o(this.min)}
47
+ max=${u.o(this.max)}
48
+ ?disabled=${this.disabled}
49
+ @click=${e=>{e.preventDefault(),this.showCalendar()}}
50
+ @keydown=${e=>{var i;(e.key===","||e.key==="Enter")&&((i=this.inputRefTo.value)==null||i.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
51
+ @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
52
+ @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
53
+ @blur=${e=>{var i,n,a;if((i=this.calRef.value)!=null&&i.contains(e.relatedTarget)||this.onBlur(),e.target.value){this.manageValidity(e.target);const p=e.target.value;this.min&&this.min>p?this.internals.setValidity({rangeUnderflow:!0},this.strings.forms.messages.rangeUnderflow,e.target):this.max&&this.max<p&&this.internals.setValidity({rangeOverflow:!0},this.strings.forms.messages.rangeOverflow,e.target);const f=h.fromISOToDate(e.target.value);f&&this._value[1]!==h.formatISODate(f)&&((a=(n=this.calRef)==null?void 0:n.value)==null||a.handleDateSelect(f))}}}
54
+ @change=${e=>{e.stopImmediatePropagation()}}
55
+ ${r.n(this.inputRefTo)}
56
+ />
57
+ `}renderMultipleInput(){return s.x`
58
+ <input
59
+ class=${d.e(this.inputClasses)}
60
+ .type=${this.inputType}
61
+ id="${this.id}-input"
62
+ min=${u.o(this.min)}
63
+ max=${u.o(this.max)}
64
+ ?disabled=${this.disabled||this.maxlength&&this._value.length>=this.maxlength}
65
+ @click=${t=>{t.preventDefault(),this.showCalendar()}}
66
+ @blur=${t=>{var e;(e=this.calRef.value)!=null&&e.contains(t.relatedTarget)||this.onBlur(),this.addToSelected(t)}}
67
+ @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
68
+ @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
69
+ @keydown=${t=>{(t.key===","||t.key==="Enter")&&(t.preventDefault(),this.addToSelected(t)),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
70
+ @change=${t=>{t.stopImmediatePropagation()}}
71
+ ${r.n(this.inputRef)}
72
+ />
73
+ `}renderTags(){return s.x`
74
+ <div class="pkt-datepicker__tags" aria-live="polite">
75
+ ${this._value[0]?v.c(this._value??[],t=>t,t=>s.x`
76
+ <pkt-tag
77
+ .id="${this.id+t+"-tag"}"
78
+ closeTag
79
+ ariaLabel="${this.strings.calendar.deleteDate} ${h.fromISOtoLocal(t,this.dateformat)}"
80
+ @close=${()=>{var e;return(e=this.calRef.value)==null?void 0:e.handleDateSelect(h.fromISOToDate(t))}}
81
+ ><time datetime="${t}">${h.fromISOtoLocal(t,this.dateformat)}</time></pkt-tag
82
+ >
83
+ `):s.E}
84
+ </div>
85
+ `}renderCalendar(){return s.x`<div
86
+ class="pkt-calendar-popup pkt-${this.calendarOpen?"show":"hide"}"
87
+ @focusout=${t=>{this.calendarOpen&&this.handleFocusOut(t)}}
88
+ id="${this.id}-popup"
89
+ ${r.n(this.popupRef)}
90
+ >
91
+ <pkt-calendar
92
+ id="${this.id}-calendar"
93
+ ?multiple=${this.multiple}
94
+ ?range=${this.range}
95
+ ?weeknumbers=${this.weeknumbers}
96
+ ?withcontrols=${this.withcontrols}
97
+ .maxMultiple=${this.maxlength}
98
+ .selected=${this._value}
99
+ .earliest=${this.min}
100
+ .latest=${this.max}
101
+ .excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(",")}
102
+ .excludeweekdays=${this.excludeweekdays}
103
+ .currentmonth=${this.currentmonth?h.newDate(this.currentmonth):null}
104
+ @date-selected=${t=>{this.value=!this.multiple&&!this.range?t.detail[0]:t.detail,this._value=t.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]:""))}}
105
+ @close=${()=>{this.onBlur(),this.hideCalendar()}}
106
+ ${r.n(this.calRef)}
107
+ ></pkt-calendar>
108
+ </div>`}render(){return this.inputClasses={"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-datepicker--hasrangelabels":this.showRangeLabels,"pkt-datepicker--multiple":this.multiple,"pkt-datepicker--range":this.range},this.buttonClasses={"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0},s.x`
109
+ <pkt-input-wrapper
110
+ label="${this.label}"
111
+ forId="${this.id}-input"
112
+ ?counter=${this.multiple&&!!this.maxlength}
113
+ .counterCurrent=${this.value?this._value.length:0}
114
+ .counterMaxLength=${this.maxlength}
115
+ ?disabled=${this.disabled}
116
+ ?hasError=${this.hasError}
117
+ ?hasFieldset=${this.hasFieldset}
118
+ ?inline=${this.inline}
119
+ ?required=${this.required}
120
+ ?optionalTag=${this.optionalTag}
121
+ ?requiredTag=${this.requiredTag}
122
+ ?useWrapper=${this.useWrapper}
123
+ .optionalText=${this.optionalText}
124
+ .requiredText=${this.requiredText}
125
+ .errorMessage=${this.errorMessage}
126
+ .helptext=${this.helptext}
127
+ .helptextDropdown=${this.helptextDropdown}
128
+ .helptextDropdownButton=${this.helptextDropdownButton}
129
+ .ariaDescribedBy=${this.ariaDescribedBy}
130
+ class="pkt-datepicker"
131
+ >
132
+ <div class="pkt-contents" ${r.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
133
+ ${this.multiple?this.renderTags():s.E}
134
+ <div
135
+ class="pkt-datepicker__inputs ${this.range&&this.showRangeLabels?"pkt-input__range-inputs":""}"
136
+ >
137
+ <div class="pkt-input__container">
138
+ ${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
139
+ <button
140
+ class="${d.e(this.buttonClasses)}"
141
+ type="button"
142
+ @click=${this.toggleCalendar}
143
+ ?disabled=${this.disabled}
144
+ ${r.n(this.btnRef)}
145
+ >
146
+ <pkt-icon name="calendar"></pkt-icon>
147
+ <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
148
+ </button>
149
+ </div>
150
+ </div>
151
+ </pkt-input-wrapper>
152
+ ${this.renderCalendar()}
153
+ `}handleCalendarPosition(){var t;if(this.popupRef.value&&this.inputRef.value){const e=this.multiple&&!!this.maxlength,i=((t=this.inputRef.value.parentElement)==null?void 0:t.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),n=e?i.height+30:i.height,a=this.popupRef.value.getBoundingClientRect().height;let p=e?"calc(100% - 30px)":"100%";i&&i.top+a>window.innerHeight&&i.top-a>0&&(p=`calc(100% - ${n}px - ${a}px)`),this.popupRef.value.style.top=p}}handleFocusOut(t){this.contains(t.target)||(this.onBlur(),this.hideCalendar())}async showCalendar(){var t;this.calendarOpen=!0,await g(20),this.handleCalendarPosition(),this.isMobileSafari&&((t=this.calRef.value)==null||t.focusOnCurrentDate())}hideCalendar(){this.calendarOpen=!1}async toggleCalendar(t){t.preventDefault(),this.calendarOpen?this.hideCalendar():this.showCalendar()}};l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",2);l([s.n({type:Array})],exports.PktDatepicker.prototype,"_value",2);l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"label",2);l([s.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);l([s.n({type:Number,reflect:!0})],exports.PktDatepicker.prototype,"maxlength",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);l([s.n({type:Boolean})],exports.PktDatepicker.prototype,"showRangeLabels",2);l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"min",2);l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"max",2);l([s.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"withcontrols",2);l([s.n({converter:h.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);l([s.n({converter:h.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);l([s.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"calendarOpen",2);l([s.n({type:String})],exports.PktDatepicker.prototype,"timezone",2);l([k.r()],exports.PktDatepicker.prototype,"inputClasses",2);l([k.r()],exports.PktDatepicker.prototype,"buttonClasses",2);exports.PktDatepicker=l([s.t("pkt-datepicker")],exports.PktDatepicker);
@@ -0,0 +1,449 @@
1
+ import { e as f } from "./class-map-D4tSZX70.js";
2
+ import { o } from "./if-defined-DeANa4n5.js";
3
+ import { x as p, E as m, n as r, a as w } from "./element-DiqKrDty.js";
4
+ import { r as b } from "./state-CDwPbiQj.js";
5
+ import { n as $, f as v, a as R, b as y, d as x } from "./calendar-BNHDEEwT.js";
6
+ import { P as C } from "./input-element-C4mmTk6h.js";
7
+ import { e as g, n as u } from "./ref-B70YZNXm.js";
8
+ import { c as _ } from "./repeat-CNLpCTun.js";
9
+ import "./icon-BdY52BIt.js";
10
+ import "./input-wrapper-P_oEi6dk.js";
11
+ import "./tag-DoS5S2Bq.js";
12
+ import { P as T } from "./pkt-slot-controller-BtVLTZb7.js";
13
+ const D = {
14
+ dateformat: {
15
+ default: "dd.MM.yyyy"
16
+ },
17
+ min: {
18
+ default: null
19
+ },
20
+ max: {
21
+ default: null
22
+ },
23
+ weeknumbers: {
24
+ default: !1
25
+ },
26
+ withcontrols: {
27
+ default: !1
28
+ },
29
+ multiple: {
30
+ default: !1
31
+ },
32
+ range: {
33
+ default: !1
34
+ }
35
+ }, c = {
36
+ props: D
37
+ };
38
+ var S = Object.defineProperty, I = Object.getOwnPropertyDescriptor, l = (t, e, i, n) => {
39
+ for (var s = n > 1 ? void 0 : n ? I(e, i) : e, h = t.length - 1, d; h >= 0; h--)
40
+ (d = t[h]) && (s = (n ? d(e, i, s) : d(s)) || s);
41
+ return n && s && S(e, i, s), s;
42
+ };
43
+ const k = (t) => new Promise((e) => setTimeout(e, t));
44
+ let a = class extends C {
45
+ /**
46
+ * Housekeeping / lifecycle methods
47
+ */
48
+ constructor() {
49
+ super(), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.dateformat = c.props.dateformat.default, this.multiple = c.props.multiple.default, this.maxlength = null, this.range = c.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = c.props.weeknumbers.default, this.withcontrols = c.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.buttonClasses = {}, this.inputRef = g(), this.inputRefTo = g(), this.btnRef = g(), this.calRef = g(), this.popupRef = g(), this.helptextSlot = g(), this.addToSelected = (t) => {
50
+ const e = t.target;
51
+ if (!e.value) return;
52
+ const i = this.min ? $(this.min) : null, n = this.max ? $(this.max) : null, s = $(e.value.split(",")[0]);
53
+ s && !isNaN(s.getTime()) && (!i || s >= i) && (!n || s <= n) && this.calRef.value && this.calRef.value.handleDateSelect(s), e.value = "";
54
+ }, this.slotController = new T(this, this.helptextSlot);
55
+ }
56
+ async connectedCallback() {
57
+ super.connectedCallback();
58
+ const t = navigator.userAgent, e = /iP(hone|od|ad)/.test(t);
59
+ this.inputType = e ? "text" : "date", document && document.body.addEventListener("click", (i) => {
60
+ var n, s;
61
+ (n = this.inputRef) != null && n.value && ((s = this.btnRef) != null && s.value) && !this.inputRef.value.contains(i.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(i.target)) && !this.btnRef.value.contains(i.target) && !i.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
62
+ }), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || c.props.min.default, this.max = this.max || c.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 k(20), this.handleCalendarPosition());
63
+ }
64
+ disconnectedCallback() {
65
+ super.disconnectedCallback(), document && document.body.removeEventListener("click", (t) => {
66
+ var e, i;
67
+ (e = this.inputRef) != null && e.value && ((i = this.btnRef) != null && i.value) && !this.inputRef.value.contains(t.target) && !this.btnRef.value.contains(t.target) && this.hideCalendar();
68
+ });
69
+ }
70
+ attributeChangedCallback(t, e, i) {
71
+ if (t === "value") {
72
+ if (this.range && (i == null ? void 0 : i.split(",").length) === 1) return;
73
+ this.value !== e && this.valueChanged(i, e);
74
+ }
75
+ t === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = (i == null ? void 0 : i.split(",")) ?? []), t === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = (i == null ? void 0 : i.split(",")) ?? []), super.attributeChangedCallback(t, e, i);
76
+ }
77
+ updated(t) {
78
+ if (t.has("value")) {
79
+ if (this.range && this.value.length === 1) return;
80
+ this.valueChanged(this.value, t.get("value"));
81
+ }
82
+ super.updated(t);
83
+ }
84
+ /**
85
+ * Rendering
86
+ */
87
+ renderInput() {
88
+ return p`
89
+ <input
90
+ class="${f(this.inputClasses)}"
91
+ .type=${this.inputType}
92
+ id="${this.id}-input"
93
+ .value=${this._value[0] ?? ""}
94
+ min=${o(this.min)}
95
+ max=${o(this.max)}
96
+ @click=${(t) => {
97
+ t.preventDefault(), this.showCalendar();
98
+ }}
99
+ ?disabled=${this.disabled}
100
+ @keydown=${(t) => {
101
+ var e;
102
+ (t.key === "," || t.key === "Enter") && ((e = this.inputRef.value) == null || e.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
103
+ }}
104
+ @input=${(t) => {
105
+ this.onInput(), t.stopImmediatePropagation();
106
+ }}
107
+ @focus=${() => {
108
+ this.onFocus(), this.isMobileSafari && this.showCalendar();
109
+ }}
110
+ @blur=${(t) => {
111
+ var e;
112
+ (e = this.calRef.value) != null && e.contains(t.relatedTarget) || this.onBlur(), this.manageValidity(t.target), this.value = t.target.value;
113
+ }}
114
+ @change=${(t) => {
115
+ t.stopImmediatePropagation();
116
+ }}
117
+ ${u(this.inputRef)}
118
+ />
119
+ `;
120
+ }
121
+ renderRangeInput() {
122
+ const t = {
123
+ "pkt-input-prefix": this.showRangeLabels,
124
+ "pkt-hide": !this.showRangeLabels
125
+ };
126
+ return p`
127
+ ${this.showRangeLabels ? p` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : m}
128
+ <input
129
+ class=${f(this.inputClasses)}
130
+ .type=${this.inputType}
131
+ id="${this.id}-input"
132
+ .value=${this._value[0] ?? ""}
133
+ min=${o(this.min)}
134
+ max=${o(this.max)}
135
+ ?disabled=${this.disabled}
136
+ @click=${(e) => {
137
+ e.preventDefault(), this.showCalendar();
138
+ }}
139
+ @keydown=${(e) => {
140
+ var i;
141
+ (e.key === "," || e.key === "Enter") && ((i = this.inputRef.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
142
+ }}
143
+ @input=${(e) => {
144
+ this.onInput(), e.stopImmediatePropagation();
145
+ }}
146
+ @focus=${() => {
147
+ this.onFocus(), this.isMobileSafari && this.showCalendar();
148
+ }}
149
+ @blur=${(e) => {
150
+ var i, n;
151
+ if (e.target.value) {
152
+ this.manageValidity(e.target);
153
+ const s = v(e.target.value);
154
+ s && this._value[0] !== e.target.value && this._value[1] && (this.clearInputValue(), (n = (i = this.calRef) == null ? void 0 : i.value) == null || n.handleDateSelect(s));
155
+ } else this._value[0] && this.clearInputValue();
156
+ }}
157
+ @change=${(e) => {
158
+ e.stopImmediatePropagation();
159
+ }}
160
+ ${u(this.inputRef)}
161
+ />
162
+ <div class="${f(t)}" id="${this.id}-to-label">
163
+ ${this.strings.generic.to}
164
+ </div>
165
+ ${this.showRangeLabels ? m : p` <div class="pkt-input-separator">–</div> `}
166
+ <input
167
+ class=${f(this.inputClasses)}
168
+ .type=${this.inputType}
169
+ id="${this.id}-to"
170
+ aria-labelledby="${this.id}-to-label"
171
+ .value=${this._value[1] ?? ""}
172
+ min=${o(this.min)}
173
+ max=${o(this.max)}
174
+ ?disabled=${this.disabled}
175
+ @click=${(e) => {
176
+ e.preventDefault(), this.showCalendar();
177
+ }}
178
+ @keydown=${(e) => {
179
+ var i;
180
+ (e.key === "," || e.key === "Enter") && ((i = this.inputRefTo.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
181
+ }}
182
+ @input=${(e) => {
183
+ this.onInput(), e.stopImmediatePropagation();
184
+ }}
185
+ @focus=${() => {
186
+ this.onFocus(), this.isMobileSafari && this.showCalendar();
187
+ }}
188
+ @blur=${(e) => {
189
+ var i, n, s;
190
+ if ((i = this.calRef.value) != null && i.contains(e.relatedTarget) || this.onBlur(), e.target.value) {
191
+ this.manageValidity(e.target);
192
+ const h = e.target.value;
193
+ this.min && this.min > h ? this.internals.setValidity(
194
+ { rangeUnderflow: !0 },
195
+ this.strings.forms.messages.rangeUnderflow,
196
+ e.target
197
+ ) : this.max && this.max < h && this.internals.setValidity(
198
+ { rangeOverflow: !0 },
199
+ this.strings.forms.messages.rangeOverflow,
200
+ e.target
201
+ );
202
+ const d = v(e.target.value);
203
+ d && this._value[1] !== R(d) && ((s = (n = this.calRef) == null ? void 0 : n.value) == null || s.handleDateSelect(d));
204
+ }
205
+ }}
206
+ @change=${(e) => {
207
+ e.stopImmediatePropagation();
208
+ }}
209
+ ${u(this.inputRefTo)}
210
+ />
211
+ `;
212
+ }
213
+ renderMultipleInput() {
214
+ return p`
215
+ <input
216
+ class=${f(this.inputClasses)}
217
+ .type=${this.inputType}
218
+ id="${this.id}-input"
219
+ min=${o(this.min)}
220
+ max=${o(this.max)}
221
+ ?disabled=${this.disabled || this.maxlength && this._value.length >= this.maxlength}
222
+ @click=${(t) => {
223
+ t.preventDefault(), this.showCalendar();
224
+ }}
225
+ @blur=${(t) => {
226
+ var e;
227
+ (e = this.calRef.value) != null && e.contains(t.relatedTarget) || this.onBlur(), this.addToSelected(t);
228
+ }}
229
+ @input=${(t) => {
230
+ this.onInput(), t.stopImmediatePropagation();
231
+ }}
232
+ @focus=${() => {
233
+ this.onFocus(), this.isMobileSafari && this.showCalendar();
234
+ }}
235
+ @keydown=${(t) => {
236
+ (t.key === "," || t.key === "Enter") && (t.preventDefault(), this.addToSelected(t)), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
237
+ }}
238
+ @change=${(t) => {
239
+ t.stopImmediatePropagation();
240
+ }}
241
+ ${u(this.inputRef)}
242
+ />
243
+ `;
244
+ }
245
+ renderTags() {
246
+ return p`
247
+ <div class="pkt-datepicker__tags" aria-live="polite">
248
+ ${this._value[0] ? _(
249
+ this._value ?? [],
250
+ (t) => t,
251
+ (t) => p`
252
+ <pkt-tag
253
+ .id="${this.id + t + "-tag"}"
254
+ closeTag
255
+ ariaLabel="${this.strings.calendar.deleteDate} ${y(
256
+ t,
257
+ this.dateformat
258
+ )}"
259
+ @close=${() => {
260
+ var e;
261
+ return (e = this.calRef.value) == null ? void 0 : e.handleDateSelect(v(t));
262
+ }}
263
+ ><time datetime="${t}">${y(t, this.dateformat)}</time></pkt-tag
264
+ >
265
+ `
266
+ ) : m}
267
+ </div>
268
+ `;
269
+ }
270
+ renderCalendar() {
271
+ return p`<div
272
+ class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
273
+ @focusout=${(t) => {
274
+ this.calendarOpen && this.handleFocusOut(t);
275
+ }}
276
+ id="${this.id}-popup"
277
+ ${u(this.popupRef)}
278
+ >
279
+ <pkt-calendar
280
+ id="${this.id}-calendar"
281
+ ?multiple=${this.multiple}
282
+ ?range=${this.range}
283
+ ?weeknumbers=${this.weeknumbers}
284
+ ?withcontrols=${this.withcontrols}
285
+ .maxMultiple=${this.maxlength}
286
+ .selected=${this._value}
287
+ .earliest=${this.min}
288
+ .latest=${this.max}
289
+ .excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
290
+ .excludeweekdays=${this.excludeweekdays}
291
+ .currentmonth=${this.currentmonth ? $(this.currentmonth) : null}
292
+ @date-selected=${(t) => {
293
+ this.value = !this.multiple && !this.range ? t.detail[0] : t.detail, this._value = t.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] : ""));
294
+ }}
295
+ @close=${() => {
296
+ this.onBlur(), this.hideCalendar();
297
+ }}
298
+ ${u(this.calRef)}
299
+ ></pkt-calendar>
300
+ </div>`;
301
+ }
302
+ render() {
303
+ return this.inputClasses = {
304
+ "pkt-input": !0,
305
+ "pkt-datepicker__input": !0,
306
+ "pkt-input--fullwidth": this.fullwidth,
307
+ "pkt-datepicker--hasrangelabels": this.showRangeLabels,
308
+ "pkt-datepicker--multiple": this.multiple,
309
+ "pkt-datepicker--range": this.range
310
+ }, this.buttonClasses = {
311
+ "pkt-input-icon": !0,
312
+ "pkt-btn": !0,
313
+ "pkt-btn--icon-only": !0,
314
+ "pkt-btn--tertiary": !0
315
+ }, p`
316
+ <pkt-input-wrapper
317
+ label="${this.label}"
318
+ forId="${this.id}-input"
319
+ ?counter=${this.multiple && !!this.maxlength}
320
+ .counterCurrent=${this.value ? this._value.length : 0}
321
+ .counterMaxLength=${this.maxlength}
322
+ ?disabled=${this.disabled}
323
+ ?hasError=${this.hasError}
324
+ ?hasFieldset=${this.hasFieldset}
325
+ ?inline=${this.inline}
326
+ ?required=${this.required}
327
+ ?optionalTag=${this.optionalTag}
328
+ ?requiredTag=${this.requiredTag}
329
+ ?useWrapper=${this.useWrapper}
330
+ .optionalText=${this.optionalText}
331
+ .requiredText=${this.requiredText}
332
+ .errorMessage=${this.errorMessage}
333
+ .helptext=${this.helptext}
334
+ .helptextDropdown=${this.helptextDropdown}
335
+ .helptextDropdownButton=${this.helptextDropdownButton}
336
+ .ariaDescribedBy=${this.ariaDescribedBy}
337
+ class="pkt-datepicker"
338
+ >
339
+ <div class="pkt-contents" ${u(this.helptextSlot)} name="helptext" slot="helptext"></div>
340
+ ${this.multiple ? this.renderTags() : m}
341
+ <div
342
+ class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
343
+ >
344
+ <div class="pkt-input__container">
345
+ ${this.range ? this.renderRangeInput() : this.multiple ? this.renderMultipleInput() : this.renderInput()}
346
+ <button
347
+ class="${f(this.buttonClasses)}"
348
+ type="button"
349
+ @click=${this.toggleCalendar}
350
+ ?disabled=${this.disabled}
351
+ ${u(this.btnRef)}
352
+ >
353
+ <pkt-icon name="calendar"></pkt-icon>
354
+ <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
355
+ </button>
356
+ </div>
357
+ </div>
358
+ </pkt-input-wrapper>
359
+ ${this.renderCalendar()}
360
+ `;
361
+ }
362
+ /**
363
+ * Handlers
364
+ */
365
+ handleCalendarPosition() {
366
+ var t;
367
+ if (this.popupRef.value && this.inputRef.value) {
368
+ const e = this.multiple && !!this.maxlength, i = ((t = this.inputRef.value.parentElement) == null ? void 0 : t.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), n = e ? i.height + 30 : i.height, s = this.popupRef.value.getBoundingClientRect().height;
369
+ let h = e ? "calc(100% - 30px)" : "100%";
370
+ i && i.top + s > window.innerHeight && i.top - s > 0 && (h = `calc(100% - ${n}px - ${s}px)`), this.popupRef.value.style.top = h;
371
+ }
372
+ }
373
+ handleFocusOut(t) {
374
+ this.contains(t.target) || (this.onBlur(), this.hideCalendar());
375
+ }
376
+ async showCalendar() {
377
+ var t;
378
+ this.calendarOpen = !0, await k(20), this.handleCalendarPosition(), this.isMobileSafari && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
379
+ }
380
+ hideCalendar() {
381
+ this.calendarOpen = !1;
382
+ }
383
+ async toggleCalendar(t) {
384
+ t.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
385
+ }
386
+ };
387
+ l([
388
+ r({ type: String, reflect: !0 })
389
+ ], a.prototype, "value", 2);
390
+ l([
391
+ r({ type: Array })
392
+ ], a.prototype, "_value", 2);
393
+ l([
394
+ r({ type: String, reflect: !0 })
395
+ ], a.prototype, "label", 2);
396
+ l([
397
+ r({ type: String })
398
+ ], a.prototype, "dateformat", 2);
399
+ l([
400
+ r({ type: Boolean, reflect: !0 })
401
+ ], a.prototype, "multiple", 2);
402
+ l([
403
+ r({ type: Number, reflect: !0 })
404
+ ], a.prototype, "maxlength", 2);
405
+ l([
406
+ r({ type: Boolean, reflect: !0 })
407
+ ], a.prototype, "range", 2);
408
+ l([
409
+ r({ type: Boolean })
410
+ ], a.prototype, "showRangeLabels", 2);
411
+ l([
412
+ r({ type: String, reflect: !0 })
413
+ ], a.prototype, "min", 2);
414
+ l([
415
+ r({ type: String, reflect: !0 })
416
+ ], a.prototype, "max", 2);
417
+ l([
418
+ r({ type: Boolean })
419
+ ], a.prototype, "weeknumbers", 2);
420
+ l([
421
+ r({ type: Boolean, reflect: !0 })
422
+ ], a.prototype, "withcontrols", 2);
423
+ l([
424
+ r({ converter: x.csvToArray })
425
+ ], a.prototype, "excludedates", 2);
426
+ l([
427
+ r({ converter: x.csvToArray })
428
+ ], a.prototype, "excludeweekdays", 2);
429
+ l([
430
+ r({ type: String })
431
+ ], a.prototype, "currentmonth", 2);
432
+ l([
433
+ r({ type: Boolean, reflect: !0 })
434
+ ], a.prototype, "calendarOpen", 2);
435
+ l([
436
+ r({ type: String })
437
+ ], a.prototype, "timezone", 2);
438
+ l([
439
+ b()
440
+ ], a.prototype, "inputClasses", 2);
441
+ l([
442
+ b()
443
+ ], a.prototype, "buttonClasses", 2);
444
+ a = l([
445
+ w("pkt-datepicker")
446
+ ], a);
447
+ export {
448
+ a as P
449
+ };