@oslokommune/punkt-elements 13.6.12 → 13.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/{accordionitem-B_h5XGCo.js → accordionitem-C_URrDjP.js} +4 -4
  3. package/dist/{accordionitem-BOmnm80g.cjs → accordionitem-DCZrHVNR.cjs} +1 -1
  4. package/dist/{alert-ZP5-fqlt.cjs → alert-Ci7WvRXi.cjs} +1 -1
  5. package/dist/{alert-CTTm6ugp.js → alert-Dh1YhaBq.js} +13 -26
  6. package/dist/{backlink-BT7DO6rV.cjs → backlink-BzEvli8m.cjs} +1 -1
  7. package/dist/{backlink-Bq8O2bt8.js → backlink-CI_jMGzZ.js} +3 -3
  8. package/dist/{button-x6Xw-5w0.js → button-CCFAUJa0.js} +5 -5
  9. package/dist/{button-BfqxLnMT.cjs → button-CXJQ_Wgl.cjs} +1 -1
  10. package/dist/calendar-BaMrdMDZ.cjs +115 -0
  11. package/dist/{calendar-CodWwTHM.js → calendar-DtJh7UYD.js} +532 -480
  12. package/dist/{card-B9RPShvV.cjs → card-Cf-UcGAP.cjs} +1 -1
  13. package/dist/{card-en2KhOPO.js → card-M1X36b6i.js} +8 -26
  14. package/dist/{checkbox-CH8xeK-0.cjs → checkbox-CTxc8wQe.cjs} +1 -1
  15. package/dist/{checkbox-DSAcMC-D.js → checkbox-_5LbXU7N.js} +4 -4
  16. package/dist/class-map-C_erArZz.cjs +5 -0
  17. package/dist/{class-map-Dw6Wrxwi.js → class-map-wy7PUk0P.js} +3 -3
  18. package/dist/{combobox-BFOjlFIj.cjs → combobox-BJ1gA0f0.cjs} +1 -1
  19. package/dist/{combobox-DaiEdUKx.js → combobox-Ct0NNY1p.js} +12 -16
  20. package/dist/{consent-CXp0bLvg.js → consent-B2hIQh4b.js} +3 -3
  21. package/dist/{consent-DFrsiYGQ.cjs → consent-BeOjxQdR.cjs} +1 -1
  22. package/dist/datepicker-B8mifBAm.js +1374 -0
  23. package/dist/datepicker-DVqmQAOe.cjs +289 -0
  24. package/dist/directive-helpers-4oOjKnGY.cjs +5 -0
  25. package/dist/directive-helpers-BzAtj9by.js +38 -0
  26. package/dist/{element-D62wHiNU.cjs → element-CJ_QKaki.cjs} +6 -6
  27. package/dist/{element-DJZPsA_J.js → element-CRDRygXu.js} +47 -132
  28. package/dist/{heading-H_FWjo2k.cjs → heading--JKFppLS.cjs} +1 -1
  29. package/dist/{heading-DQ0R34j4.js → heading-Cs5yGnJg.js} +1 -1
  30. package/dist/{helptext-D1fkGmfT.cjs → helptext-CVQP3pis.cjs} +1 -1
  31. package/dist/{helptext-8ykxyegi.js → helptext-DuvVSH7d.js} +6 -6
  32. package/dist/icon-1dy7UZcu.js +89 -0
  33. package/dist/icon-BGuizDwk.cjs +9 -0
  34. package/dist/{if-defined-D3lgJqT7.js → if-defined-BWZGb3bh.js} +1 -1
  35. package/dist/{if-defined-CkVc_RJD.cjs → if-defined-Bc9-_I01.cjs} +1 -1
  36. package/dist/index.d.ts +98 -6
  37. package/dist/input-element-BcFmygSF.js +707 -0
  38. package/dist/input-element-j9znzLWz.cjs +1 -0
  39. package/dist/{input-wrapper-DVjNwf8-.cjs → input-wrapper-BsQ7oFMd.cjs} +1 -1
  40. package/dist/input-wrapper-CDgenrYA.js +6 -0
  41. package/dist/{input-wrapper-CQzXG44g.js → input-wrapper-CKJU0QWG.js} +8 -8
  42. package/dist/{link-CyiVlb-7.cjs → link-Da3pZ_CW.cjs} +1 -1
  43. package/dist/{link-DSSJYrtn.js → link-DzZCw8j2.js} +9 -16
  44. package/dist/{linkcard-fH9uydjS.cjs → linkcard-BM23gzhS.cjs} +1 -1
  45. package/dist/{linkcard-g8JtooPU.js → linkcard-RIK5xqbd.js} +4 -4
  46. package/dist/{listbox-L-iOSF7M.cjs → listbox-CsGiqzD0.cjs} +1 -1
  47. package/dist/{listbox-n4wjlLqD.js → listbox-DlJevu8O.js} +5 -5
  48. package/dist/{loader-Bzf1sPSg.js → loader-BVvBzaPI.js} +5 -5
  49. package/dist/{loader-C-3l7kb9.cjs → loader-Bo8RCbCJ.cjs} +1 -1
  50. package/dist/{messagebox---xPIAwR.cjs → messagebox-C76IcXTl.cjs} +1 -1
  51. package/dist/{messagebox-okJLeSpj.js → messagebox-DwdMXoAe.js} +6 -16
  52. package/dist/{modal-pohCsr_x.js → modal-BGXk3f9u.js} +6 -16
  53. package/dist/{modal-IjDRQfX1.cjs → modal-Cdz9JcCX.cjs} +1 -1
  54. package/dist/pkt-accordion.cjs +1 -1
  55. package/dist/pkt-accordion.js +2 -2
  56. package/dist/pkt-alert.cjs +1 -1
  57. package/dist/pkt-alert.js +1 -1
  58. package/dist/pkt-backlink.cjs +1 -1
  59. package/dist/pkt-backlink.js +1 -1
  60. package/dist/pkt-button.cjs +1 -1
  61. package/dist/pkt-button.js +1 -1
  62. package/dist/pkt-calendar.cjs +1 -1
  63. package/dist/pkt-calendar.js +1 -1
  64. package/dist/pkt-card.cjs +1 -1
  65. package/dist/pkt-card.js +1 -1
  66. package/dist/pkt-checkbox.cjs +1 -1
  67. package/dist/pkt-checkbox.js +1 -1
  68. package/dist/pkt-combobox.cjs +1 -1
  69. package/dist/pkt-combobox.js +1 -1
  70. package/dist/pkt-consent.cjs +1 -1
  71. package/dist/pkt-consent.js +1 -1
  72. package/dist/pkt-datepicker.cjs +1 -1
  73. package/dist/pkt-datepicker.js +8 -4
  74. package/dist/pkt-heading.cjs +1 -1
  75. package/dist/pkt-heading.js +1 -1
  76. package/dist/pkt-helptext.cjs +1 -1
  77. package/dist/pkt-helptext.js +1 -1
  78. package/dist/pkt-icon.cjs +1 -1
  79. package/dist/pkt-icon.js +1 -1
  80. package/dist/pkt-index.cjs +1 -1
  81. package/dist/pkt-index.js +29 -29
  82. package/dist/pkt-input-wrapper.cjs +1 -1
  83. package/dist/pkt-input-wrapper.js +1 -1
  84. package/dist/pkt-link.cjs +1 -1
  85. package/dist/pkt-link.js +1 -1
  86. package/dist/pkt-linkcard.cjs +1 -1
  87. package/dist/pkt-linkcard.js +1 -1
  88. package/dist/pkt-listbox.cjs +1 -1
  89. package/dist/pkt-listbox.js +1 -1
  90. package/dist/pkt-loader.cjs +1 -1
  91. package/dist/pkt-loader.js +1 -1
  92. package/dist/pkt-messagebox.cjs +1 -1
  93. package/dist/pkt-messagebox.js +1 -1
  94. package/dist/pkt-modal.cjs +1 -1
  95. package/dist/pkt-modal.js +1 -1
  96. package/dist/pkt-progressbar.cjs +1 -1
  97. package/dist/pkt-progressbar.js +2 -2
  98. package/dist/pkt-radiobutton.cjs +1 -1
  99. package/dist/pkt-radiobutton.js +1 -1
  100. package/dist/pkt-select.cjs +1 -1
  101. package/dist/pkt-select.js +1 -1
  102. package/dist/pkt-tag.cjs +1 -1
  103. package/dist/pkt-tag.js +1 -1
  104. package/dist/pkt-textarea.cjs +1 -1
  105. package/dist/pkt-textarea.js +1 -1
  106. package/dist/pkt-textinput.cjs +1 -1
  107. package/dist/pkt-textinput.js +1 -1
  108. package/dist/{progressbar-DjsupQ7Y.js → progressbar-BbVei20_.js} +7 -7
  109. package/dist/{progressbar-DJzEC7cx.cjs → progressbar-CazcIzVT.cjs} +2 -2
  110. package/dist/{radiobutton-DEboKECm.cjs → radiobutton-D1fihs8R.cjs} +1 -1
  111. package/dist/{radiobutton-Bz_qApF3.js → radiobutton-DODROIBF.js} +5 -5
  112. package/dist/{ref-BfgcOXko.cjs → ref-BFa5Utho.cjs} +1 -1
  113. package/dist/{ref-BCGCor-j.js → ref-Xa5dbh--.js} +2 -2
  114. package/dist/repeat-BZb41H64.cjs +5 -0
  115. package/dist/{repeat-B6qPUgAq.js → repeat-CJ79egkN.js} +8 -8
  116. package/dist/{select-DKkoxmgj.js → select-BG2MBQbh.js} +6 -6
  117. package/dist/{select-DynzsPo0.cjs → select-D-m1PhpA.cjs} +1 -1
  118. package/dist/{state-CPQXJ4Ct.js → state-DS_kr2Fy.js} +1 -1
  119. package/dist/{state-BkE_Rxl7.cjs → state-DSjcvzDN.cjs} +1 -1
  120. package/dist/{tag-NZ5oeGfw.js → tag-CqMgt01I.js} +7 -20
  121. package/dist/{tag-BKq07hGI.cjs → tag-EFUKrc8q.cjs} +2 -2
  122. package/dist/{textarea-COG1CH_s.js → textarea-DCKKhs1B.js} +9 -9
  123. package/dist/{textarea-BS1tgktz.cjs → textarea-aUG3S7C2.cjs} +1 -1
  124. package/dist/{textinput-CTOtfcTR.js → textinput-B5Ai5R8L.js} +8 -8
  125. package/dist/{textinput-CCK8ti2y.cjs → textinput-mUERucRy.cjs} +1 -1
  126. package/package.json +15 -7
  127. package/src/components/combobox/combobox.ts +1 -1
  128. package/src/components/datepicker/datepicker-multiple.ts +202 -0
  129. package/src/components/datepicker/datepicker-range.ts +281 -0
  130. package/src/components/datepicker/datepicker-single.ts +198 -0
  131. package/src/components/datepicker/datepicker-utils.ts +9 -1
  132. package/src/components/datepicker/datepicker.ts +141 -213
  133. package/src/components/datepicker/index.ts +5 -1
  134. package/src/components/icon/icon.ts +16 -7
  135. package/src/components/select/select.ts +1 -1
  136. package/dist/calendar-DH-fCGyW.cjs +0 -115
  137. package/dist/class-map-CG3vIaNm.cjs +0 -5
  138. package/dist/datepicker-C244h82t.cjs +0 -190
  139. package/dist/datepicker-DwOkktaP.js +0 -859
  140. package/dist/directive-helpers-_qHew-gi.cjs +0 -5
  141. package/dist/directive-helpers-cAOIHg9K.js +0 -45
  142. package/dist/icon-B1-mkmwB.js +0 -88
  143. package/dist/icon-__Hjt2XZ.cjs +0 -9
  144. package/dist/input-element-DQOVrqUZ.js +0 -703
  145. package/dist/input-element-Y8sdrq9C.cjs +0 -1
  146. package/dist/input-wrapper-8iKEzDRZ.js +0 -40
  147. package/dist/repeat-DzibMwhi.cjs +0 -5
@@ -0,0 +1,1374 @@
1
+ import { P as O, E as B, x as d, n as a, a as _ } from "./element-CRDRygXu.js";
2
+ import { r as N } from "./state-DS_kr2Fy.js";
3
+ import { f as U, s as q, i as W, n as j, a as M, b as z, d as H, p as G, e as K } from "./calendar-DtJh7UYD.js";
4
+ import { P as J } from "./input-element-BcFmygSF.js";
5
+ import { e as u, n as c } from "./ref-Xa5dbh--.js";
6
+ import "./icon-1dy7UZcu.js";
7
+ import "./input-wrapper-CKJU0QWG.js";
8
+ import { e as x } from "./class-map-wy7PUk0P.js";
9
+ import { c as Q } from "./repeat-CJ79egkN.js";
10
+ import "./tag-CqMgt01I.js";
11
+ import { u as X } from "./stringutils-DJjRa8dG.js";
12
+ import { o as C } from "./if-defined-BWZGb3bh.js";
13
+ import { P as Y } from "./pkt-slot-controller-BPGj-LC5.js";
14
+ const Z = (t) => new Promise((e) => setTimeout(e, t)), R = {
15
+ /**
16
+ * Detects if the current device is iOS (iPhone, iPad, iPod)
17
+ * Handles modern iPad Safari which uses desktop user agent since iOS 13
18
+ */
19
+ isIOS() {
20
+ const t = navigator.userAgent;
21
+ return !!(/iP(hone|od|ad)/.test(t) || /Macintosh/.test(t) && "ontouchend" in document);
22
+ }
23
+ }, k = {
24
+ /**
25
+ * Parses a value (string or string array) into an array of strings
26
+ */
27
+ parseValue(t) {
28
+ return t ? Array.isArray(t) ? t.filter(Boolean) : typeof t == "string" ? t.split(",").filter(Boolean) : String(t).split(",").filter(Boolean) : [];
29
+ },
30
+ /**
31
+ * Converts array of dates to comma-separated string
32
+ */
33
+ formatValue(t) {
34
+ return t.join(",");
35
+ },
36
+ /**
37
+ * Ensures name attribute ends with [] for multiple/range inputs
38
+ */
39
+ normalizeNameForMultiple(t, e, s) {
40
+ return t ? (e || s) && !t.endsWith("[]") ? t + "[]" : t : null;
41
+ },
42
+ /**
43
+ * Converts string arrays to proper arrays if they come as strings
44
+ */
45
+ normalizeStringArray(t) {
46
+ return typeof t == "string" ? t.split(",").filter(Boolean) : Array.isArray(t) ? t : [];
47
+ },
48
+ /**
49
+ * Validates that a range has valid order (start <= end)
50
+ */
51
+ validateRangeOrder(t) {
52
+ return !t || t.length !== 2 ? !0 : W(t[0], t[1]);
53
+ },
54
+ /**
55
+ * Sorts date strings chronologically
56
+ */
57
+ sortDates(t) {
58
+ return q(t);
59
+ },
60
+ /**
61
+ * Filters dates to only include selectable ones based on constraints
62
+ */
63
+ filterSelectableDates(t, e, s, n, i) {
64
+ return U(t, e, s, n, i);
65
+ }
66
+ }, tt = {
67
+ /**
68
+ * Determines the appropriate input type based on device
69
+ * Mobile Safari does not play well with type="date" amd custom datepickers
70
+ */
71
+ getInputType() {
72
+ return R.isIOS() ? "text" : "date";
73
+ }
74
+ }, D = {
75
+ /**
76
+ * Submits the form that contains the given element
77
+ */
78
+ submitForm(t) {
79
+ var s;
80
+ const e = (s = t.internals) == null ? void 0 : s.form;
81
+ e && e.requestSubmit();
82
+ },
83
+ /**
84
+ * Submits form if available, otherwise executes fallback action
85
+ */
86
+ submitFormOrFallback(t, e) {
87
+ const s = t == null ? void 0 : t.form;
88
+ s ? s.requestSubmit() : e();
89
+ },
90
+ /**
91
+ * Validates a date input and sets validity state
92
+ */
93
+ validateDateInput(t, e, s, n, i) {
94
+ var r, h, V, L;
95
+ const l = t.value;
96
+ l && (s && s > l ? e.setValidity(
97
+ { rangeUnderflow: !0 },
98
+ ((h = (r = i == null ? void 0 : i.forms) == null ? void 0 : r.messages) == null ? void 0 : h.rangeUnderflow) || "Value is below minimum",
99
+ t
100
+ ) : n && n < l && e.setValidity(
101
+ { rangeOverflow: !0 },
102
+ ((L = (V = i == null ? void 0 : i.forms) == null ? void 0 : V.messages) == null ? void 0 : L.rangeOverflow) || "Value is above maximum",
103
+ t
104
+ ));
105
+ }
106
+ }, A = {
107
+ /**
108
+ * Adds a date to selected dates if it's valid
109
+ */
110
+ addToSelected(t, e, s, n) {
111
+ const i = t.target;
112
+ if (!i.value) return;
113
+ const l = s ? j(s) : null, r = n ? j(n) : null, h = j(i.value.split(",")[0]);
114
+ h && !isNaN(h.getTime()) && (!l || h >= l) && (!r || h <= r) && e.value && e.value.handleDateSelect(h), i.value = "";
115
+ },
116
+ /**
117
+ * Handles calendar positioning based on viewport and input position
118
+ */
119
+ handleCalendarPosition(t, e, s = !1) {
120
+ var h;
121
+ if (!t.value || !e.value) return;
122
+ const n = ((h = e.value.parentElement) == null ? void 0 : h.getBoundingClientRect()) || e.value.getBoundingClientRect(), i = s ? n.height + 30 : n.height, l = t.value.getBoundingClientRect().height;
123
+ let r = s ? "calc(100% - 30px)" : "100%";
124
+ n && n.top + l > window.innerHeight && n.top - l > 0 && (r = `calc(100% - ${i}px - ${l}px)`), t.value.style.top = r;
125
+ }
126
+ }, I = {
127
+ /**
128
+ * Generates input classes for datepicker
129
+ */
130
+ getInputClasses(t, e, s, n, i, l) {
131
+ return {
132
+ "pkt-input": !0,
133
+ "pkt-datepicker__input": !0,
134
+ "pkt-input--fullwidth": t,
135
+ "pkt-datepicker--hasrangelabels": e,
136
+ "pkt-datepicker--multiple": s,
137
+ "pkt-datepicker--range": n,
138
+ "ios-readonly-hack": i === !1 && l === "text"
139
+ };
140
+ },
141
+ /**
142
+ * Generates button classes for datepicker
143
+ */
144
+ getButtonClasses() {
145
+ return {
146
+ "pkt-input-icon": !0,
147
+ "pkt-btn": !0,
148
+ "pkt-btn--icon-only": !0,
149
+ "pkt-btn--tertiary": !0,
150
+ "pkt-datepicker__calendar-button": !0
151
+ };
152
+ },
153
+ /**
154
+ * Generates range label classes
155
+ */
156
+ getRangeLabelClasses(t) {
157
+ return {
158
+ "pkt-input-prefix": t,
159
+ "pkt-hide": !t
160
+ };
161
+ }
162
+ }, F = {
163
+ /**
164
+ * Handles date selection from calendar events
165
+ */
166
+ processDateSelection(t, e, s) {
167
+ return !e && !s ? t[0] || "" : Array.isArray(t) ? t.join(",") : t;
168
+ },
169
+ /**
170
+ * Updates input values after calendar selection
171
+ */
172
+ updateInputValues(t, e, s, n, i, l) {
173
+ t.value && (n && (e != null && e.value) ? (t.value.value = s[0] ?? "", e.value.value = s[1] ?? "", l(t.value), l(e.value)) : i || (t.value.value = s.length ? s[0] : "", l(t.value)));
174
+ },
175
+ /**
176
+ * Processes blur events for range inputs
177
+ */
178
+ processRangeBlur(t, e, s, n, i) {
179
+ var r;
180
+ const l = t.target;
181
+ if (l.value) {
182
+ i(l);
183
+ const h = M(l.value);
184
+ h && e[0] !== l.value && e[1] && (n(), (r = s == null ? void 0 : s.value) == null || r.handleDateSelect(h));
185
+ } else e[0] && n();
186
+ }
187
+ }, T = {
188
+ /**
189
+ * Handles common keyboard interactions for datepicker inputs
190
+ */
191
+ handleInputKeydown(t, e, s, n, i, l) {
192
+ const { key: r } = t;
193
+ r === "," && (t.preventDefault(), l ? l(t) : i && i()), (r === "Space" || r === " ") && (t.preventDefault(), e(t)), r === "Enter" && (t.preventDefault(), s ? s() : n ? n() : i && i());
194
+ },
195
+ /**
196
+ * Handles keyboard interactions for calendar button
197
+ */
198
+ handleButtonKeydown(t, e) {
199
+ const { key: s } = t;
200
+ (s === "Enter" || s === " " || s === "Space") && (t.preventDefault(), e(t));
201
+ }
202
+ };
203
+ var et = Object.defineProperty, st = Object.getOwnPropertyDescriptor, P = (t, e, s, n) => {
204
+ for (var i = n > 1 ? void 0 : n ? st(e, s) : e, l = t.length - 1, r; l >= 0; l--)
205
+ (r = t[l]) && (i = (n ? r(e, s, i) : r(i)) || i);
206
+ return n && i && et(e, s, i), i;
207
+ };
208
+ let E = class extends O {
209
+ constructor() {
210
+ super(...arguments), this.dates = [], this.dateformat = "dd.MM.yyyy", this.className = "pkt-datepicker__tags", this.idBase = X();
211
+ }
212
+ render() {
213
+ return this.classes = {
214
+ "pkt-date-tags": !0,
215
+ [this.className]: !0
216
+ }, d`
217
+ <div class=${x(this.classes)} aria-live="polite">
218
+ ${Array.isArray(this.dates) && this.dates[0] ? Q(
219
+ k.sortDates((this.dates ?? []).filter(Boolean)),
220
+ (t) => t,
221
+ (t) => {
222
+ var e;
223
+ return d` <pkt-tag
224
+ id=${this.idBase + t + "-tag"}
225
+ closeTag
226
+ @close=${() => {
227
+ this.dispatchEvent(new CustomEvent("date-tag-removed", { detail: t }));
228
+ }}
229
+ .ariaLabel=${`${(e = this.strings) == null ? void 0 : e.calendar.deleteDate} ${z(t, this.dateformat)}`}
230
+ >
231
+ <time datetime=${t}>${z(t, this.dateformat)}</time>
232
+ </pkt-tag>`;
233
+ }
234
+ ) : B}
235
+ </div>
236
+ `;
237
+ }
238
+ };
239
+ P([
240
+ a({ type: Array })
241
+ ], E.prototype, "dates", 2);
242
+ P([
243
+ a({ type: String })
244
+ ], E.prototype, "dateformat", 2);
245
+ P([
246
+ a({ type: String, attribute: "class" })
247
+ ], E.prototype, "className", 2);
248
+ P([
249
+ a({ type: String, attribute: "id-base" })
250
+ ], E.prototype, "idBase", 2);
251
+ E = P([
252
+ _("pkt-date-tags")
253
+ ], E);
254
+ const it = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }, withcontrols: { default: !1 }, multiple: { default: !1 }, range: { default: !1 } }, S = {
255
+ props: it
256
+ };
257
+ var at = Object.defineProperty, nt = Object.getOwnPropertyDescriptor, v = (t, e, s, n) => {
258
+ for (var i = n > 1 ? void 0 : n ? nt(e, s) : e, l = t.length - 1, r; l >= 0; l--)
259
+ (r = t[l]) && (i = (n ? r(e, s, i) : r(i)) || i);
260
+ return n && i && at(e, s, i), i;
261
+ };
262
+ let g = class extends O {
263
+ constructor() {
264
+ 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(), this.calendarRef = u(), this.handleDocumentClick = (t) => {
265
+ if (!this.open) return;
266
+ const e = t.composedPath(), s = this.parentElement, n = this.popupRef.value;
267
+ !e.includes(this) && !e.includes(n) && !(s && e.includes(s)) && (this.hide(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 })));
268
+ }, this.handleDocumentKeydown = (t) => {
269
+ this.open && t.key === "Escape" && (this.hide(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 })));
270
+ };
271
+ }
272
+ firstUpdated() {
273
+ this.calRef = this.calendarRef, document.addEventListener("keydown", this.handleDocumentKeydown), document.addEventListener("click", this.handleDocumentClick);
274
+ }
275
+ disconnectedCallback() {
276
+ super.disconnectedCallback(), document.removeEventListener("click", this.handleDocumentClick), document.removeEventListener("keydown", this.handleDocumentKeydown);
277
+ }
278
+ show() {
279
+ var t;
280
+ this.open = !0, (t = this.calendarRef.value) == null || t.focus();
281
+ }
282
+ hide() {
283
+ this.open = !1;
284
+ }
285
+ toggle() {
286
+ this.open ? this.hide() : this.show();
287
+ }
288
+ contains(t) {
289
+ var e;
290
+ return !!t && !!((e = this.popupRef.value) != null && e.contains(t));
291
+ }
292
+ focusOnCurrentDate() {
293
+ const t = this.calendarRef.value;
294
+ t && typeof t.focusOnCurrentDate == "function" && t.focusOnCurrentDate();
295
+ }
296
+ addToSelected(t, e, s) {
297
+ if (typeof A.addToSelected == "function")
298
+ return A.addToSelected(t, this.calendarRef, e, s);
299
+ }
300
+ handleDateSelect(t) {
301
+ const e = this.calendarRef.value;
302
+ if (e && typeof e.handleDateSelect == "function") return e.handleDateSelect(t);
303
+ }
304
+ render() {
305
+ const t = { "pkt-calendar-popup": !0, show: this.open, hide: !this.open };
306
+ return d`
307
+ <div
308
+ class="${x(t)}"
309
+ ${c(this.popupRef)}
310
+ id="date-popup"
311
+ ?hidden=${!this.open}
312
+ aria-hidden="${!this.open}"
313
+ >
314
+ <pkt-calendar
315
+ ${c(this.calendarRef)}
316
+ ?multiple=${this.multiple}
317
+ ?range=${this.range}
318
+ ?weeknumbers=${this.weeknumbers}
319
+ ?withcontrols=${this.withcontrols}
320
+ .maxMultiple=${this.maxMultiple}
321
+ .selected=${this.selected}
322
+ .earliest=${this.earliest}
323
+ .latest=${this.latest}
324
+ .excludedates=${this.excludedates}
325
+ .excludeweekdays=${this.excludeweekdays}
326
+ .currentmonth=${this.currentmonth}
327
+ @date-selected=${(e) => {
328
+ this.selected = e.detail, this.dispatchEvent(
329
+ new CustomEvent("date-selected", { detail: e.detail, bubbles: !0, composed: !0 })
330
+ );
331
+ }}
332
+ @close=${() => {
333
+ this.hide(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 }));
334
+ }}
335
+ ></pkt-calendar>
336
+ </div>
337
+ `;
338
+ }
339
+ };
340
+ v([
341
+ a({ type: Boolean, reflect: !0 })
342
+ ], g.prototype, "open", 2);
343
+ v([
344
+ a({ type: Boolean })
345
+ ], g.prototype, "multiple", 2);
346
+ v([
347
+ a({ type: Boolean })
348
+ ], g.prototype, "range", 2);
349
+ v([
350
+ a({ type: Boolean })
351
+ ], g.prototype, "weeknumbers", 2);
352
+ v([
353
+ a({ type: Boolean })
354
+ ], g.prototype, "withcontrols", 2);
355
+ v([
356
+ a({ type: Number })
357
+ ], g.prototype, "maxMultiple", 2);
358
+ v([
359
+ a({ type: Array })
360
+ ], g.prototype, "selected", 2);
361
+ v([
362
+ a({ type: String })
363
+ ], g.prototype, "earliest", 2);
364
+ v([
365
+ a({ type: String })
366
+ ], g.prototype, "latest", 2);
367
+ v([
368
+ a({ type: Array })
369
+ ], g.prototype, "excludedates", 2);
370
+ v([
371
+ a({ type: Array })
372
+ ], g.prototype, "excludeweekdays", 2);
373
+ v([
374
+ a({ type: String })
375
+ ], g.prototype, "currentmonth", 2);
376
+ g = v([
377
+ _("pkt-datepicker-popup")
378
+ ], g);
379
+ var lt = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, w = (t, e, s, n) => {
380
+ for (var i = n > 1 ? void 0 : n ? rt(e, s) : e, l = t.length - 1, r; l >= 0; l--)
381
+ (r = t[l]) && (i = (n ? r(e, s, i) : r(i)) || i);
382
+ return n && i && lt(e, s, i), i;
383
+ };
384
+ let y = class extends O {
385
+ constructor() {
386
+ super(...arguments), this.value = "", this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.inputClasses = {}, this.strings = { calendar: { buttonAltText: "Åpne kalender" } }, this.inputRef = u(), this.btnRef = u();
387
+ }
388
+ get inputElement() {
389
+ return this.inputRef.value;
390
+ }
391
+ get buttonElement() {
392
+ return this.btnRef.value;
393
+ }
394
+ get isInputReadonly() {
395
+ return this.readonly || this.inputType === "text";
396
+ }
397
+ dispatchToggleCalendar(t) {
398
+ this.readonly || this.dispatchEvent(
399
+ new CustomEvent("toggle-calendar", {
400
+ detail: t,
401
+ bubbles: !0,
402
+ composed: !0
403
+ })
404
+ );
405
+ }
406
+ dispatchInput(t) {
407
+ this.dispatchEvent(
408
+ new CustomEvent("input-change", {
409
+ detail: t,
410
+ bubbles: !0,
411
+ composed: !0
412
+ })
413
+ );
414
+ }
415
+ dispatchFocus() {
416
+ this.dispatchEvent(
417
+ new CustomEvent("input-focus", {
418
+ bubbles: !0,
419
+ composed: !0
420
+ })
421
+ );
422
+ }
423
+ dispatchBlur(t) {
424
+ this.dispatchEvent(
425
+ new CustomEvent("input-blur", {
426
+ detail: t,
427
+ bubbles: !0,
428
+ composed: !0
429
+ })
430
+ );
431
+ }
432
+ dispatchChange(t) {
433
+ this.dispatchEvent(
434
+ new CustomEvent("input-changed", {
435
+ detail: t,
436
+ bubbles: !0,
437
+ composed: !0
438
+ })
439
+ );
440
+ }
441
+ dispatchManageValidity(t) {
442
+ this.dispatchEvent(
443
+ new CustomEvent("manage-validity", {
444
+ detail: t,
445
+ bubbles: !0,
446
+ composed: !0
447
+ })
448
+ );
449
+ }
450
+ createRenderRoot() {
451
+ return this;
452
+ }
453
+ render() {
454
+ return d`
455
+ <div class="pkt-input__container">
456
+ <input
457
+ class="${x(this.inputClasses)}"
458
+ .type=${this.inputType}
459
+ id="${this.id}-input"
460
+ .value=${this.value}
461
+ min=${C(this.min)}
462
+ max=${C(this.max)}
463
+ placeholder=${C(this.placeholder)}
464
+ ?readonly=${this.isInputReadonly}
465
+ aria-describedby="${this.id}-helptext"
466
+ @click=${(t) => {
467
+ t.preventDefault(), this.dispatchToggleCalendar(t);
468
+ }}
469
+ @touchend=${(t) => {
470
+ t.preventDefault(), this.dispatchToggleCalendar(t);
471
+ }}
472
+ ?disabled=${this.disabled}
473
+ @keydown=${(t) => T.handleInputKeydown(
474
+ t,
475
+ (e) => this.dispatchToggleCalendar(e),
476
+ () => D.submitFormOrFallback(this.internals, () => {
477
+ var e;
478
+ return (e = this.inputRef.value) == null ? void 0 : e.blur();
479
+ }),
480
+ void 0,
481
+ () => {
482
+ var e;
483
+ return (e = this.inputRef.value) == null ? void 0 : e.blur();
484
+ }
485
+ )}
486
+ @input=${(t) => {
487
+ this.dispatchInput(t), t.stopImmediatePropagation();
488
+ }}
489
+ @focus=${() => {
490
+ this.dispatchFocus(), R.isIOS() && this.dispatchToggleCalendar(new Event("focus"));
491
+ }}
492
+ @blur=${(t) => {
493
+ this.dispatchBlur(t), this.dispatchManageValidity(t.target), this.dispatchEvent(
494
+ new CustomEvent("value-change", {
495
+ detail: t.target.value,
496
+ bubbles: !0,
497
+ composed: !0
498
+ })
499
+ );
500
+ }}
501
+ @change=${(t) => {
502
+ this.dispatchChange(t), t.stopImmediatePropagation();
503
+ }}
504
+ ${c(this.inputRef)}
505
+ />
506
+ <button
507
+ class="${x(I.getButtonClasses())}"
508
+ type="button"
509
+ @click=${(t) => this.dispatchToggleCalendar(t)}
510
+ @keydown=${(t) => T.handleButtonKeydown(t, (e) => this.dispatchToggleCalendar(e))}
511
+ ?disabled=${this.disabled}
512
+ ${c(this.btnRef)}
513
+ >
514
+ <pkt-icon name="calendar"></pkt-icon>
515
+ <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
516
+ </button>
517
+ </div>
518
+ `;
519
+ }
520
+ };
521
+ w([
522
+ a({ type: String })
523
+ ], y.prototype, "value", 2);
524
+ w([
525
+ a({ type: String })
526
+ ], y.prototype, "inputType", 2);
527
+ w([
528
+ a({ type: String })
529
+ ], y.prototype, "id", 2);
530
+ w([
531
+ a({ type: String })
532
+ ], y.prototype, "min", 2);
533
+ w([
534
+ a({ type: String })
535
+ ], y.prototype, "max", 2);
536
+ w([
537
+ a({ type: String })
538
+ ], y.prototype, "placeholder", 2);
539
+ w([
540
+ a({ type: Boolean })
541
+ ], y.prototype, "readonly", 2);
542
+ w([
543
+ a({ type: Boolean })
544
+ ], y.prototype, "disabled", 2);
545
+ w([
546
+ a({ type: Object })
547
+ ], y.prototype, "inputClasses", 2);
548
+ w([
549
+ a({ type: Object })
550
+ ], y.prototype, "internals", 2);
551
+ w([
552
+ a({ type: Object })
553
+ ], y.prototype, "strings", 2);
554
+ y = w([
555
+ _("pkt-datepicker-single")
556
+ ], y);
557
+ var pt = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, b = (t, e, s, n) => {
558
+ for (var i = n > 1 ? void 0 : n ? ot(e, s) : e, l = t.length - 1, r; l >= 0; l--)
559
+ (r = t[l]) && (i = (n ? r(e, s, i) : r(i)) || i);
560
+ return n && i && pt(e, s, i), i;
561
+ };
562
+ let m = class extends O {
563
+ constructor() {
564
+ super(...arguments), this.value = [], this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.showRangeLabels = !1, this.inputClasses = {}, this.strings = { generic: { from: "Fra", to: "Til" } }, this.inputRef = u(), this.inputRefTo = u(), this.btnRef = u();
565
+ }
566
+ get inputElement() {
567
+ return this.inputRef.value;
568
+ }
569
+ get inputElementTo() {
570
+ return this.inputRefTo.value;
571
+ }
572
+ get buttonElement() {
573
+ return this.btnRef.value;
574
+ }
575
+ get isInputReadonly() {
576
+ return this.readonly || this.inputType === "text";
577
+ }
578
+ dispatchToggleCalendar(t) {
579
+ this.readonly || this.dispatchEvent(
580
+ new CustomEvent("toggle-calendar", {
581
+ detail: t,
582
+ bubbles: !0,
583
+ composed: !0
584
+ })
585
+ );
586
+ }
587
+ dispatchInput(t) {
588
+ this.dispatchEvent(
589
+ new CustomEvent("input-change", {
590
+ detail: t,
591
+ bubbles: !0,
592
+ composed: !0
593
+ })
594
+ );
595
+ }
596
+ dispatchFocus() {
597
+ this.dispatchEvent(
598
+ new CustomEvent("input-focus", {
599
+ bubbles: !0,
600
+ composed: !0
601
+ })
602
+ );
603
+ }
604
+ dispatchBlur(t) {
605
+ this.dispatchEvent(
606
+ new CustomEvent("input-blur", {
607
+ detail: t,
608
+ bubbles: !0,
609
+ composed: !0
610
+ })
611
+ );
612
+ }
613
+ dispatchChange(t) {
614
+ this.dispatchEvent(
615
+ new CustomEvent("input-changed", {
616
+ detail: t,
617
+ bubbles: !0,
618
+ composed: !0
619
+ })
620
+ );
621
+ }
622
+ dispatchManageValidity(t) {
623
+ this.dispatchEvent(
624
+ new CustomEvent("manage-validity", {
625
+ detail: t,
626
+ bubbles: !0,
627
+ composed: !0
628
+ })
629
+ );
630
+ }
631
+ createRenderRoot() {
632
+ return this;
633
+ }
634
+ render() {
635
+ const t = I.getRangeLabelClasses(this.showRangeLabels);
636
+ return d`
637
+ <div class="pkt-input__container">
638
+ ${this.showRangeLabels ? d` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : B}
639
+ <input
640
+ class=${x(this.inputClasses)}
641
+ .type=${this.inputType}
642
+ id="${this.id}-input"
643
+ .value=${this.value[0] ?? ""}
644
+ min=${C(this.min)}
645
+ max=${C(this.max)}
646
+ placeholder=${C(this.placeholder)}
647
+ ?readonly=${this.isInputReadonly}
648
+ ?disabled=${this.disabled}
649
+ @click=${(e) => {
650
+ e.preventDefault(), this.dispatchToggleCalendar(e);
651
+ }}
652
+ @touchend=${(e) => {
653
+ e.preventDefault(), this.dispatchToggleCalendar(e);
654
+ }}
655
+ @keydown=${(e) => T.handleInputKeydown(
656
+ e,
657
+ (s) => this.dispatchToggleCalendar(s),
658
+ () => D.submitFormOrFallback(
659
+ this.internals,
660
+ () => {
661
+ var s;
662
+ return (s = this.inputRefTo.value) == null ? void 0 : s.focus();
663
+ }
664
+ ),
665
+ () => {
666
+ var s;
667
+ return (s = this.inputRefTo.value) == null ? void 0 : s.focus();
668
+ },
669
+ () => {
670
+ var s;
671
+ return (s = this.inputRef.value) == null ? void 0 : s.blur();
672
+ }
673
+ )}
674
+ @input=${(e) => {
675
+ this.dispatchInput(e), e.stopImmediatePropagation();
676
+ }}
677
+ @focus=${() => {
678
+ this.dispatchFocus(), R.isIOS() && this.dispatchToggleCalendar(new Event("focus"));
679
+ }}
680
+ @blur=${(e) => {
681
+ this.dispatchEvent(
682
+ new CustomEvent("range-blur", {
683
+ detail: {
684
+ event: e,
685
+ values: this.value,
686
+ inputType: "from"
687
+ },
688
+ bubbles: !0,
689
+ composed: !0
690
+ })
691
+ );
692
+ }}
693
+ @change=${(e) => {
694
+ e.stopImmediatePropagation();
695
+ }}
696
+ ${c(this.inputRef)}
697
+ />
698
+ <div class="${x(t)}" id="${this.id}-to-label">
699
+ ${this.strings.generic.to}
700
+ </div>
701
+ ${this.showRangeLabels ? B : d` <div class="pkt-input-separator">–</div> `}
702
+ <input
703
+ class=${x(this.inputClasses)}
704
+ .type=${this.inputType}
705
+ id="${this.id}-to"
706
+ aria-labelledby="${this.id}-to-label"
707
+ .value=${this.value[1] ?? ""}
708
+ min=${C(this.min)}
709
+ max=${C(this.max)}
710
+ placeholder=${C(this.placeholder)}
711
+ ?readonly=${this.isInputReadonly}
712
+ ?disabled=${this.disabled}
713
+ @click=${(e) => {
714
+ e.preventDefault(), this.dispatchToggleCalendar(e);
715
+ }}
716
+ @touchend=${(e) => {
717
+ e.preventDefault(), this.dispatchToggleCalendar(e);
718
+ }}
719
+ @keydown=${(e) => T.handleInputKeydown(
720
+ e,
721
+ (s) => this.dispatchToggleCalendar(s),
722
+ () => D.submitFormOrFallback(this.internals, () => {
723
+ var s;
724
+ return (s = this.inputRefTo.value) == null ? void 0 : s.blur();
725
+ }),
726
+ void 0,
727
+ () => {
728
+ var s;
729
+ return (s = this.inputRefTo.value) == null ? void 0 : s.blur();
730
+ }
731
+ )}
732
+ @input=${(e) => {
733
+ this.dispatchInput(e), e.stopImmediatePropagation();
734
+ }}
735
+ @focus=${() => {
736
+ this.dispatchFocus(), R.isIOS() && this.dispatchToggleCalendar(new Event("focus"));
737
+ }}
738
+ @blur=${(e) => {
739
+ this.dispatchBlur(e), e.target.value && (this.dispatchManageValidity(e.target), this.dispatchEvent(
740
+ new CustomEvent("validate-date-input", {
741
+ detail: e.target,
742
+ bubbles: !0,
743
+ composed: !0
744
+ })
745
+ ), this.dispatchEvent(
746
+ new CustomEvent("handle-date-select", {
747
+ detail: e.target.value,
748
+ bubbles: !0,
749
+ composed: !0
750
+ })
751
+ ));
752
+ }}
753
+ @change=${(e) => {
754
+ this.dispatchChange(e), e.stopImmediatePropagation();
755
+ }}
756
+ ${c(this.inputRefTo)}
757
+ />
758
+ <button
759
+ class="${x(I.getButtonClasses())}"
760
+ type="button"
761
+ @click=${(e) => this.dispatchToggleCalendar(e)}
762
+ @keydown=${(e) => T.handleButtonKeydown(e, (s) => this.dispatchToggleCalendar(s))}
763
+ ?disabled=${this.disabled}
764
+ ${c(this.btnRef)}
765
+ >
766
+ <pkt-icon name="calendar"></pkt-icon>
767
+ <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
768
+ </button>
769
+ </div>
770
+ `;
771
+ }
772
+ };
773
+ b([
774
+ a({ type: Array })
775
+ ], m.prototype, "value", 2);
776
+ b([
777
+ a({ type: String })
778
+ ], m.prototype, "inputType", 2);
779
+ b([
780
+ a({ type: String })
781
+ ], m.prototype, "id", 2);
782
+ b([
783
+ a({ type: String })
784
+ ], m.prototype, "min", 2);
785
+ b([
786
+ a({ type: String })
787
+ ], m.prototype, "max", 2);
788
+ b([
789
+ a({ type: String })
790
+ ], m.prototype, "placeholder", 2);
791
+ b([
792
+ a({ type: Boolean })
793
+ ], m.prototype, "readonly", 2);
794
+ b([
795
+ a({ type: Boolean })
796
+ ], m.prototype, "disabled", 2);
797
+ b([
798
+ a({ type: Boolean })
799
+ ], m.prototype, "showRangeLabels", 2);
800
+ b([
801
+ a({ type: Object })
802
+ ], m.prototype, "inputClasses", 2);
803
+ b([
804
+ a({ type: Object })
805
+ ], m.prototype, "internals", 2);
806
+ b([
807
+ a({ type: Object })
808
+ ], m.prototype, "strings", 2);
809
+ m = b([
810
+ _("pkt-datepicker-range")
811
+ ], m);
812
+ var ut = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, $ = (t, e, s, n) => {
813
+ for (var i = n > 1 ? void 0 : n ? ht(e, s) : e, l = t.length - 1, r; l >= 0; l--)
814
+ (r = t[l]) && (i = (n ? r(e, s, i) : r(i)) || i);
815
+ return n && i && ut(e, s, i), i;
816
+ };
817
+ let f = class extends O {
818
+ constructor() {
819
+ super(...arguments), this.value = [], this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.inputClasses = {}, this.strings = { calendar: { buttonAltText: "Åpne kalender" } }, this.inputRef = u(), this.btnRef = u();
820
+ }
821
+ get inputElement() {
822
+ return this.inputRef.value;
823
+ }
824
+ get buttonElement() {
825
+ return this.btnRef.value;
826
+ }
827
+ get isInputReadonly() {
828
+ return this.readonly || this.inputType === "text";
829
+ }
830
+ get isInputDisabled() {
831
+ return this.disabled || this.maxlength !== void 0 && this.maxlength !== null && this.value.length >= this.maxlength;
832
+ }
833
+ dispatchToggleCalendar(t) {
834
+ this.readonly || this.dispatchEvent(
835
+ new CustomEvent("toggle-calendar", {
836
+ detail: t,
837
+ bubbles: !0,
838
+ composed: !0
839
+ })
840
+ );
841
+ }
842
+ dispatchInput(t) {
843
+ this.dispatchEvent(
844
+ new CustomEvent("input-change", {
845
+ detail: t,
846
+ bubbles: !0,
847
+ composed: !0
848
+ })
849
+ );
850
+ }
851
+ dispatchFocus() {
852
+ this.dispatchEvent(
853
+ new CustomEvent("input-focus", {
854
+ bubbles: !0,
855
+ composed: !0
856
+ })
857
+ );
858
+ }
859
+ dispatchBlur(t) {
860
+ this.dispatchEvent(
861
+ new CustomEvent("input-blur", {
862
+ detail: t,
863
+ bubbles: !0,
864
+ composed: !0
865
+ })
866
+ );
867
+ }
868
+ dispatchChange(t) {
869
+ this.dispatchEvent(
870
+ new CustomEvent("input-changed", {
871
+ detail: t,
872
+ bubbles: !0,
873
+ composed: !0
874
+ })
875
+ );
876
+ }
877
+ dispatchAddToSelected(t) {
878
+ this.dispatchEvent(
879
+ new CustomEvent("add-to-selected", {
880
+ detail: t,
881
+ bubbles: !0,
882
+ composed: !0
883
+ })
884
+ );
885
+ }
886
+ createRenderRoot() {
887
+ return this;
888
+ }
889
+ render() {
890
+ return d`
891
+ <div class="pkt-input__container">
892
+ <input
893
+ class=${x(this.inputClasses)}
894
+ .type=${this.inputType}
895
+ id="${this.id}-input"
896
+ min=${C(this.min)}
897
+ max=${C(this.max)}
898
+ placeholder=${C(this.placeholder)}
899
+ ?readonly=${this.isInputReadonly}
900
+ ?disabled=${this.isInputDisabled}
901
+ @click=${(t) => {
902
+ t.preventDefault(), this.dispatchToggleCalendar(t);
903
+ }}
904
+ @touchend=${(t) => {
905
+ t.preventDefault(), this.dispatchToggleCalendar(t);
906
+ }}
907
+ @blur=${(t) => {
908
+ this.dispatchBlur(t), this.dispatchAddToSelected(t);
909
+ }}
910
+ @input=${(t) => {
911
+ this.dispatchInput(t), t.stopImmediatePropagation();
912
+ }}
913
+ @focus=${() => {
914
+ this.dispatchFocus(), R.isIOS() && this.dispatchToggleCalendar(new Event("focus"));
915
+ }}
916
+ @keydown=${(t) => T.handleInputKeydown(
917
+ t,
918
+ (e) => this.dispatchToggleCalendar(e),
919
+ () => D.submitFormOrFallback(this.internals, () => {
920
+ var e;
921
+ return (e = this.inputRef.value) == null ? void 0 : e.blur();
922
+ }),
923
+ void 0,
924
+ void 0,
925
+ (e) => this.dispatchAddToSelected(e)
926
+ )}
927
+ @change=${(t) => {
928
+ this.dispatchChange(t), t.stopImmediatePropagation();
929
+ }}
930
+ ${c(this.inputRef)}
931
+ />
932
+ <button
933
+ class="${x(I.getButtonClasses())}"
934
+ type="button"
935
+ @click=${(t) => this.dispatchToggleCalendar(t)}
936
+ @keydown=${(t) => T.handleButtonKeydown(t, (e) => this.dispatchToggleCalendar(e))}
937
+ ?disabled=${this.disabled}
938
+ ${c(this.btnRef)}
939
+ >
940
+ <pkt-icon name="calendar"></pkt-icon>
941
+ <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
942
+ </button>
943
+ </div>
944
+ `;
945
+ }
946
+ };
947
+ $([
948
+ a({ type: Array })
949
+ ], f.prototype, "value", 2);
950
+ $([
951
+ a({ type: String })
952
+ ], f.prototype, "inputType", 2);
953
+ $([
954
+ a({ type: String })
955
+ ], f.prototype, "id", 2);
956
+ $([
957
+ a({ type: String })
958
+ ], f.prototype, "min", 2);
959
+ $([
960
+ a({ type: String })
961
+ ], f.prototype, "max", 2);
962
+ $([
963
+ a({ type: String })
964
+ ], f.prototype, "placeholder", 2);
965
+ $([
966
+ a({ type: Boolean })
967
+ ], f.prototype, "readonly", 2);
968
+ $([
969
+ a({ type: Boolean })
970
+ ], f.prototype, "disabled", 2);
971
+ $([
972
+ a({ type: Number })
973
+ ], f.prototype, "maxlength", 2);
974
+ $([
975
+ a({ type: Object })
976
+ ], f.prototype, "inputClasses", 2);
977
+ $([
978
+ a({ type: Object })
979
+ ], f.prototype, "internals", 2);
980
+ $([
981
+ a({ type: Object })
982
+ ], f.prototype, "strings", 2);
983
+ f = $([
984
+ _("pkt-datepicker-multiple")
985
+ ], f);
986
+ var dt = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, o = (t, e, s, n) => {
987
+ for (var i = n > 1 ? void 0 : n ? ct(e, s) : e, l = t.length - 1, r; l >= 0; l--)
988
+ (r = t[l]) && (i = (n ? r(e, s, i) : r(i)) || i);
989
+ return n && i && dt(e, s, i), i;
990
+ };
991
+ let p = class extends J {
992
+ /**
993
+ * Housekeeping / lifecycle methods
994
+ */
995
+ constructor() {
996
+ super(), this._valueProperty = "", this.datepickerPopupRef = u(), this._value = [], this.label = "Datovelger", this.dateformat = S.props.dateformat.default, this.multiple = S.props.multiple.default, this.maxlength = null, this.range = S.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = S.props.weeknumbers.default, this.withcontrols = S.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.calRef = u(), this.popupRef = u(), this.helptextSlot = u(), this.singleInputRef = u(), this.rangeInputRef = u(), this.multipleInputRef = u(), this.addToSelected = (t) => {
997
+ const e = this.datepickerPopupRef.value;
998
+ return e && typeof e.addToSelected == "function" ? e.addToSelected(t, this.min, this.max) : A.addToSelected(t, this.calRef, this.min, this.max);
999
+ }, this.slotController = new Y(this, this.helptextSlot);
1000
+ }
1001
+ get value() {
1002
+ return this._valueProperty;
1003
+ }
1004
+ set value(t) {
1005
+ const e = this._valueProperty;
1006
+ this._valueProperty = Array.isArray(t) ? t.join(",") : t || "", this.valueChanged(this._valueProperty, e), this.requestUpdate("value", e);
1007
+ }
1008
+ /**
1009
+ * Computed properties
1010
+ */
1011
+ get inputType() {
1012
+ return tt.getInputType();
1013
+ }
1014
+ connectedCallback() {
1015
+ super.connectedCallback(), this.timezone && this.timezone !== window.pktTz && (window.pktTz = this.timezone), this.name = k.normalizeNameForMultiple(this.name, this.multiple, this.range) || this.name;
1016
+ }
1017
+ disconnectedCallback() {
1018
+ super.disconnectedCallback();
1019
+ }
1020
+ onInput() {
1021
+ this.dispatchEvent(new Event("input", { bubbles: !0 }));
1022
+ }
1023
+ valueChanged(t, e) {
1024
+ if (t === e) return;
1025
+ const s = k.parseValue(t), n = this.multiple && s.length > 1 ? k.filterSelectableDates(
1026
+ s,
1027
+ this.min,
1028
+ this.max,
1029
+ this.excludedates,
1030
+ this.excludeweekdays
1031
+ ) : s;
1032
+ if (this.range && !k.validateRangeOrder(n)) {
1033
+ this._value = [], this._valueProperty = "", super.valueChanged("", e);
1034
+ return;
1035
+ }
1036
+ this._value = n;
1037
+ const i = k.formatValue(n);
1038
+ this._valueProperty !== i && (this._valueProperty = i), super.valueChanged(i, e);
1039
+ }
1040
+ attributeChangedCallback(t, e, s) {
1041
+ t === "value" && this.value !== e && this.valueChanged(s, e), t === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = k.normalizeStringArray(s || "")), t === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = k.normalizeStringArray(s || "")), super.attributeChangedCallback(t, e, s);
1042
+ }
1043
+ updated(t) {
1044
+ if (t.has("value")) {
1045
+ const e = Array.isArray(this.value) ? this.value.join(",") : this.value, s = t.get("value"), n = Array.isArray(s) ? s.join(",") : s;
1046
+ this.valueChanged(e, n);
1047
+ }
1048
+ (t.has("multiple") || t.has("range")) && (this.name = k.normalizeNameForMultiple(this.name, this.multiple, this.range) || this.name), t.has("multiple") && (this.multiple && !Array.isArray(this._value) ? this._value = k.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(t);
1049
+ }
1050
+ /**
1051
+ * Element references
1052
+ */
1053
+ // Override the inputRef and inputRefTo for compatibility
1054
+ get inputRef() {
1055
+ return { value: this.currentInputElement };
1056
+ }
1057
+ get inputRefTo() {
1058
+ return { value: this.currentInputElementTo };
1059
+ }
1060
+ // Getters for backward compatibility with input refs
1061
+ get currentInputElement() {
1062
+ var t, e, s;
1063
+ return this.multiple ? (t = this.multipleInputRef.value) == null ? void 0 : t.inputElement : this.range ? (e = this.rangeInputRef.value) == null ? void 0 : e.inputElement : (s = this.singleInputRef.value) == null ? void 0 : s.inputElement;
1064
+ }
1065
+ get currentInputElementTo() {
1066
+ var t;
1067
+ if (this.range)
1068
+ return (t = this.rangeInputRef.value) == null ? void 0 : t.inputElementTo;
1069
+ }
1070
+ get currentButtonElement() {
1071
+ var t, e, s;
1072
+ return this.multiple ? (t = this.multipleInputRef.value) == null ? void 0 : t.buttonElement : this.range ? (e = this.rangeInputRef.value) == null ? void 0 : e.buttonElement : (s = this.singleInputRef.value) == null ? void 0 : s.buttonElement;
1073
+ }
1074
+ // Override btnRef for compatibility
1075
+ get btnRef() {
1076
+ return { value: this.currentButtonElement };
1077
+ }
1078
+ /**
1079
+ * Rendering
1080
+ */
1081
+ renderInput() {
1082
+ return d`
1083
+ <pkt-datepicker-single
1084
+ .value=${this._value[0] ?? ""}
1085
+ .inputType=${this.inputType}
1086
+ .id=${this.id}
1087
+ .min=${this.min}
1088
+ .max=${this.max}
1089
+ .placeholder=${this.placeholder}
1090
+ .readonly=${this.readonly}
1091
+ .disabled=${this.disabled}
1092
+ .inputClasses=${this.inputClasses}
1093
+ .internals=${this.internals}
1094
+ .strings=${this.strings}
1095
+ @toggle-calendar=${(t) => this.toggleCalendar(t.detail)}
1096
+ @input-change=${() => this.onInput()}
1097
+ @input-focus=${() => this.onFocus()}
1098
+ @input-blur=${(t) => {
1099
+ var e;
1100
+ (e = this.calRef.value) != null && e.contains(t.detail.relatedTarget) || this.onBlur();
1101
+ }}
1102
+ @manage-validity=${(t) => this.manageValidity(t.detail)}
1103
+ @value-change=${(t) => {
1104
+ this.value = t.detail;
1105
+ }}
1106
+ @input-changed=${() => {
1107
+ this.touched = !0;
1108
+ }}
1109
+ ${c(this.singleInputRef)}
1110
+ ></pkt-datepicker-single>
1111
+ `;
1112
+ }
1113
+ renderRangeInput() {
1114
+ return d`
1115
+ <pkt-datepicker-range
1116
+ .value=${this._value}
1117
+ .inputType=${this.inputType}
1118
+ .id=${this.id}
1119
+ .min=${this.min}
1120
+ .max=${this.max}
1121
+ .placeholder=${this.placeholder}
1122
+ .readonly=${this.readonly}
1123
+ .disabled=${this.disabled}
1124
+ .showRangeLabels=${this.showRangeLabels}
1125
+ .inputClasses=${this.inputClasses}
1126
+ .internals=${this.internals}
1127
+ .strings=${this.strings}
1128
+ @toggle-calendar=${(t) => this.toggleCalendar(t.detail)}
1129
+ @input-change=${() => this.onInput()}
1130
+ @input-focus=${() => this.onFocus()}
1131
+ @input-blur=${(t) => {
1132
+ var e;
1133
+ (e = this.calRef.value) != null && e.contains(t.detail.relatedTarget) || this.onBlur();
1134
+ }}
1135
+ @range-blur=${(t) => {
1136
+ F.processRangeBlur(
1137
+ t.detail.event,
1138
+ t.detail.values,
1139
+ this.calRef,
1140
+ () => this.clearInputValue(),
1141
+ (e) => this.manageValidity(e)
1142
+ );
1143
+ }}
1144
+ @manage-validity=${(t) => this.manageValidity(t.detail)}
1145
+ @validate-date-input=${(t) => {
1146
+ D.validateDateInput(t.detail, this.internals, this.min, this.max, this.strings);
1147
+ }}
1148
+ @handle-date-select=${(t) => {
1149
+ var s, n;
1150
+ const e = M(t.detail);
1151
+ e && this._value[1] !== H(e) && ((n = (s = this.calRef) == null ? void 0 : s.value) == null || n.handleDateSelect(e));
1152
+ }}
1153
+ @input-changed=${() => {
1154
+ this.touched = !0;
1155
+ }}
1156
+ ${c(this.rangeInputRef)}
1157
+ ></pkt-datepicker-range>
1158
+ `;
1159
+ }
1160
+ renderMultipleInput() {
1161
+ return d`
1162
+ <pkt-datepicker-multiple
1163
+ .value=${this._value}
1164
+ .inputType=${this.inputType}
1165
+ .id=${this.id}
1166
+ .min=${this.min}
1167
+ .max=${this.max}
1168
+ .placeholder=${this.placeholder}
1169
+ .readonly=${this.readonly}
1170
+ .disabled=${this.disabled}
1171
+ .maxlength=${this.maxlength}
1172
+ .inputClasses=${this.inputClasses}
1173
+ .internals=${this.internals}
1174
+ .strings=${this.strings}
1175
+ @toggle-calendar=${(t) => this.toggleCalendar(t.detail)}
1176
+ @input-change=${() => this.onInput()}
1177
+ @input-focus=${() => this.onFocus()}
1178
+ @input-blur=${(t) => {
1179
+ var e;
1180
+ (e = this.calRef.value) != null && e.contains(t.detail.relatedTarget) || this.onBlur();
1181
+ }}
1182
+ @add-to-selected=${(t) => this.addToSelected(t.detail)}
1183
+ @input-changed=${() => {
1184
+ this.touched = !0;
1185
+ }}
1186
+ ${c(this.multipleInputRef)}
1187
+ ></pkt-datepicker-multiple>
1188
+ `;
1189
+ }
1190
+ renderCalendar() {
1191
+ return d`
1192
+ <pkt-datepicker-popup
1193
+ class="pkt-contents"
1194
+ ?open=${this.calendarOpen}
1195
+ ?multiple=${this.multiple}
1196
+ ?range=${this.range}
1197
+ ?weeknumbers=${this.weeknumbers}
1198
+ ?withcontrols=${this.withcontrols}
1199
+ .maxMultiple=${this.maxlength}
1200
+ .selected=${this._value}
1201
+ .earliest=${this.min}
1202
+ .latest=${this.max}
1203
+ .excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
1204
+ .excludeweekdays=${this.excludeweekdays}
1205
+ .currentmonth=${this.currentmonth ? G(this.currentmonth) : null}
1206
+ @date-selected=${(t) => {
1207
+ this.value = F.processDateSelection(t.detail, this.multiple, this.range), this._value = t.detail, F.updateInputValues(
1208
+ this.inputRef,
1209
+ this.inputRefTo,
1210
+ this._value,
1211
+ this.range,
1212
+ this.multiple,
1213
+ (e) => this.manageValidity(e)
1214
+ );
1215
+ }}
1216
+ @close=${() => {
1217
+ this.onBlur(), this.hideCalendar();
1218
+ }}
1219
+ ${c(this.datepickerPopupRef)}
1220
+ ></pkt-datepicker-popup>
1221
+ `;
1222
+ }
1223
+ render() {
1224
+ return this.inputClasses = I.getInputClasses(
1225
+ this.fullwidth,
1226
+ this.showRangeLabels,
1227
+ this.multiple,
1228
+ this.range,
1229
+ this.readonly,
1230
+ this.inputType
1231
+ ), d`
1232
+ <pkt-input-wrapper
1233
+ label="${this.label}"
1234
+ forId="${this.id}-input"
1235
+ ?counter=${this.multiple && !!this.maxlength}
1236
+ .counterCurrent=${this.value ? this._value.length : 0}
1237
+ .counterMaxLength=${this.maxlength}
1238
+ ?disabled=${this.disabled}
1239
+ ?hasError=${this.hasError}
1240
+ ?hasFieldset=${this.hasFieldset}
1241
+ ?inline=${this.inline}
1242
+ ?required=${this.required}
1243
+ ?optionalTag=${this.optionalTag}
1244
+ ?requiredTag=${this.requiredTag}
1245
+ ?useWrapper=${this.useWrapper}
1246
+ .optionalText=${this.optionalText}
1247
+ .requiredText=${this.requiredText}
1248
+ .tagText=${this.tagText}
1249
+ .errorMessage=${this.errorMessage}
1250
+ .helptext=${this.helptext}
1251
+ .helptextDropdown=${this.helptextDropdown}
1252
+ .helptextDropdownButton=${this.helptextDropdownButton}
1253
+ .ariaDescribedBy=${this.ariaDescribedBy}
1254
+ class="pkt-datepicker"
1255
+ >
1256
+ <div class="pkt-contents" ${c(this.helptextSlot)} name="helptext" slot="helptext"></div>
1257
+ ${this.multiple ? d`<pkt-date-tags
1258
+ .dates=${this._value}
1259
+ dateformat=${this.dateformat}
1260
+ strings=${this.strings}
1261
+ id-base=${this.id}
1262
+ @date-tag-removed=${(t) => {
1263
+ var n;
1264
+ const e = this.datepickerPopupRef.value, s = M(t.detail);
1265
+ e && s && typeof e.handleDateSelect == "function" ? e.handleDateSelect(s) : (n = this.calRef.value) == null || n.handleDateSelect(s);
1266
+ }}
1267
+ ></pkt-date-tags>` : B}
1268
+ <div
1269
+ class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
1270
+ >
1271
+ ${this.range ? this.renderRangeInput() : this.multiple ? this.renderMultipleInput() : this.renderInput()}
1272
+ </div>
1273
+ </pkt-input-wrapper>
1274
+ ${this.renderCalendar()}
1275
+ `;
1276
+ }
1277
+ /**
1278
+ * Handlers
1279
+ */
1280
+ handleCalendarPosition() {
1281
+ const t = this.multiple && !!this.maxlength;
1282
+ A.handleCalendarPosition(this.popupRef, this.inputRef, t);
1283
+ }
1284
+ async showCalendar() {
1285
+ var e;
1286
+ const t = this.datepickerPopupRef.value;
1287
+ if (this.calendarOpen = !0, t && typeof t.show == "function") {
1288
+ t.show(), R.isIOS() && t.focusOnCurrentDate();
1289
+ return;
1290
+ }
1291
+ await Z(20), this.handleCalendarPosition(), R.isIOS() && ((e = this.calRef.value) == null || e.focusOnCurrentDate());
1292
+ }
1293
+ hideCalendar() {
1294
+ const t = this.datepickerPopupRef.value;
1295
+ if (this.calendarOpen = !1, t && typeof t.hide == "function") return t.hide();
1296
+ }
1297
+ async toggleCalendar(t) {
1298
+ t.preventDefault();
1299
+ const e = this.datepickerPopupRef.value;
1300
+ if (e && typeof e.toggle == "function") {
1301
+ const s = !!e.open;
1302
+ e.toggle(), this.calendarOpen = !s;
1303
+ return;
1304
+ }
1305
+ this.calendarOpen ? this.hideCalendar() : this.showCalendar();
1306
+ }
1307
+ clearInputValue() {
1308
+ this._value = [], this.value = "";
1309
+ }
1310
+ };
1311
+ o([
1312
+ a({ type: String, reflect: !0 })
1313
+ ], p.prototype, "value", 1);
1314
+ o([
1315
+ a({ type: Array })
1316
+ ], p.prototype, "_value", 2);
1317
+ o([
1318
+ a({ type: String, reflect: !0 })
1319
+ ], p.prototype, "label", 2);
1320
+ o([
1321
+ a({ type: String })
1322
+ ], p.prototype, "dateformat", 2);
1323
+ o([
1324
+ a({ type: Boolean, reflect: !0 })
1325
+ ], p.prototype, "multiple", 2);
1326
+ o([
1327
+ a({ type: Number, reflect: !0 })
1328
+ ], p.prototype, "maxlength", 2);
1329
+ o([
1330
+ a({ type: Boolean, reflect: !0 })
1331
+ ], p.prototype, "range", 2);
1332
+ o([
1333
+ a({ type: Boolean })
1334
+ ], p.prototype, "showRangeLabels", 2);
1335
+ o([
1336
+ a({ type: String, reflect: !0 })
1337
+ ], p.prototype, "min", 2);
1338
+ o([
1339
+ a({ type: String, reflect: !0 })
1340
+ ], p.prototype, "max", 2);
1341
+ o([
1342
+ a({ type: Boolean })
1343
+ ], p.prototype, "weeknumbers", 2);
1344
+ o([
1345
+ a({ type: Boolean, reflect: !0 })
1346
+ ], p.prototype, "withcontrols", 2);
1347
+ o([
1348
+ a({ converter: K.csvToArray })
1349
+ ], p.prototype, "excludedates", 2);
1350
+ o([
1351
+ a({ converter: K.csvToArray })
1352
+ ], p.prototype, "excludeweekdays", 2);
1353
+ o([
1354
+ a({ type: String })
1355
+ ], p.prototype, "currentmonth", 2);
1356
+ o([
1357
+ a({ type: Boolean, reflect: !0 })
1358
+ ], p.prototype, "calendarOpen", 2);
1359
+ o([
1360
+ a({ type: String })
1361
+ ], p.prototype, "timezone", 2);
1362
+ o([
1363
+ N()
1364
+ ], p.prototype, "inputClasses", 2);
1365
+ p = o([
1366
+ _("pkt-datepicker")
1367
+ ], p);
1368
+ export {
1369
+ E as P,
1370
+ p as a,
1371
+ y as b,
1372
+ m as c,
1373
+ f as d
1374
+ };