@oslokommune/punkt-elements 14.3.0 → 14.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/{accordionitem-C_URrDjP.js → accordionitem-DB3tAjIZ.js} +4 -4
- package/dist/{accordionitem-DCZrHVNR.cjs → accordionitem-DHYmPA-o.cjs} +1 -1
- package/dist/{alert-UFQFbbzZ.js → alert-DqXar67l.js} +6 -6
- package/dist/{alert-SvqEDHuW.cjs → alert-GrKyqxuR.cjs} +1 -1
- package/dist/{backlink-C7qUmUzs.js → backlink-CqUcmiPQ.js} +11 -11
- package/dist/{backlink-BrIIpgJ7.cjs → backlink-QDcQd6vK.cjs} +1 -1
- package/dist/{button-DaM4jvhJ.cjs → button-R4l10Nqd.cjs} +1 -1
- package/dist/{button-CjXih_Nx.js → button-f36menSU.js} +5 -5
- package/dist/{calendar-CvfMj3fA.js → calendar-DiNuZ8Ai.js} +7 -8
- package/dist/{calendar-ZzLAjDpv.cjs → calendar-wuD6ZH0t.cjs} +3 -3
- package/dist/{card-C1gRTfXb.cjs → card-C2hWaMev.cjs} +1 -1
- package/dist/{card-CO3D8wQE.js → card-CnINxZma.js} +7 -7
- package/dist/{checkbox-C0TPnShf.cjs → checkbox-B-0FOdwi.cjs} +1 -1
- package/dist/{checkbox-CnhA52o_.js → checkbox-CkAwPK_E.js} +4 -4
- package/dist/{class-map-C_erArZz.cjs → class-map-CApIYSRo.cjs} +1 -1
- package/dist/{class-map-wy7PUk0P.js → class-map-Dt2jXOlF.js} +1 -1
- package/dist/{combobox-Dcp_fHcL.js → combobox-Dxa7XjLz.js} +55 -55
- package/dist/{combobox-C1xwAju5.cjs → combobox-yy6hIGmB.cjs} +13 -13
- package/dist/{consent-Daj-Xa7w.cjs → consent-FbFS1pmz.cjs} +1 -1
- package/dist/{consent-BO3Ga8N4.js → consent-c9PhWxnP.js} +3 -3
- package/dist/{datepicker-Bjb9GK1E.js → datepicker-C7GWMtXH.js} +222 -241
- package/dist/{datepicker-COIRRau0.cjs → datepicker-D_3vYgMt.cjs} +25 -25
- package/dist/{directive-helpers-BzAtj9by.js → directive-helpers-CQef4qUQ.js} +1 -1
- package/dist/{directive-helpers-4oOjKnGY.cjs → directive-helpers-CYIEJ8pI.cjs} +1 -1
- package/dist/{element-CRDRygXu.js → element-BXsf_NlG.js} +3 -3
- package/dist/{element-CJ_QKaki.cjs → element-aUzIoa1s.cjs} +3 -3
- package/dist/{heading-Dv_cH6N1.cjs → heading-CBepYb7H.cjs} +1 -1
- package/dist/{heading-BUdy170t.js → heading-J7dN9nRi.js} +13 -13
- package/dist/{helptext-hlcc584n.cjs → helptext-DebHGRsD.cjs} +1 -1
- package/dist/{helptext-Bn17Picx.js → helptext-DuyRRfCn.js} +5 -5
- package/dist/{icon-BB7e5iQN.js → icon-BgG6oO4Q.js} +1 -1
- package/dist/{icon-MRx-m0Or.cjs → icon-Dl9ZPqe6.cjs} +1 -1
- package/dist/{if-defined-Bc9-_I01.cjs → if-defined-BElHLTlB.cjs} +1 -1
- package/dist/{if-defined-BWZGb3bh.js → if-defined-CxHgig4I.js} +1 -1
- package/dist/index.d.ts +213 -55
- package/dist/input-element-DVZhYDJ_.js +840 -0
- package/dist/input-element-RBQVA8i0.cjs +1 -0
- package/dist/{input-wrapper-1PCXqtiu.js → input-wrapper-3qfjLkrP.js} +7 -7
- package/dist/{input-wrapper-CtBiAb04.cjs → input-wrapper-rgXsRNkk.cjs} +1 -1
- package/dist/{link-BboUBUcg.js → link-CZvcdRek.js} +4 -4
- package/dist/{link-Dw39h-YN.cjs → link-D85g20GS.cjs} +1 -1
- package/dist/{linkcard-DUA3kGGd.cjs → linkcard-B-9K02q8.cjs} +1 -1
- package/dist/{linkcard-BqJmHFu8.js → linkcard-C3RTcMqc.js} +4 -4
- package/dist/{listbox-mvKKzH-v.js → listbox-CLtowV6W.js} +36 -36
- package/dist/{listbox-DnoqOo5u.cjs → listbox-C_0RhGhk.cjs} +2 -2
- package/dist/{loader-DjGxT7C3.cjs → loader-1EXLdxfq.cjs} +1 -1
- package/dist/{loader-DIum_s_D.js → loader-Dci0SrOz.js} +5 -5
- package/dist/{messagebox-aPlConlJ.js → messagebox-CnZlttZp.js} +5 -5
- package/dist/{messagebox-ChIKVTO_.cjs → messagebox-dscnWgCd.cjs} +1 -1
- package/dist/{modal-B4qq0VFB.cjs → modal-ncKVjcyZ.cjs} +1 -1
- package/dist/{modal-jAUtM-NP.js → modal-wSGthXAC.js} +5 -5
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +2 -2
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +9 -9
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +1 -29
- package/dist/pkt-index.js +60 -157
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-options-controller-DjBCEHU4.cjs +1 -0
- package/dist/{pkt-options-controller-CZO1nxZ8.js → pkt-options-controller-zn5cmMvL.js} +3 -3
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -2
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/{progressbar-CmAQ-DVW.cjs → progressbar-ClY1WgnM.cjs} +1 -1
- package/dist/{progressbar-CVt73-JQ.js → progressbar-D5WBW1Dm.js} +5 -5
- package/dist/{radiobutton-BkqaqO5E.cjs → radiobutton-iHuLnuAn.cjs} +1 -1
- package/dist/{radiobutton-Caq8-GhM.js → radiobutton-oA20HijB.js} +15 -15
- package/dist/{ref-Xa5dbh--.js → ref-BxiKhrfa.js} +2 -2
- package/dist/{ref-BFa5Utho.cjs → ref-C5iJMIE1.cjs} +1 -1
- package/dist/{repeat-CJ79egkN.js → repeat-B55jMEsG.js} +2 -2
- package/dist/{repeat-BZb41H64.cjs → repeat-DcYSFU2y.cjs} +1 -1
- package/dist/select-Bug9sfr5.js +228 -0
- package/dist/select-jbIbD7hW.cjs +49 -0
- package/dist/{state-DS_kr2Fy.js → state-DgnkjP0q.js} +1 -1
- package/dist/{state-DSjcvzDN.cjs → state-GDzxl12x.cjs} +1 -1
- package/dist/{tabitem-D5zyipN1.cjs → tabitem-CtltSqDK.cjs} +1 -1
- package/dist/{tabitem-NV2fzs_-.js → tabitem-CypTmORF.js} +30 -30
- package/dist/{tag-B02fKJ66.cjs → tag-BfjOlIyS.cjs} +1 -1
- package/dist/{tag-CES41g0D.js → tag-DgoTYNVA.js} +6 -6
- package/dist/{textarea-a6T4aJJU.js → textarea-Da9E3RM7.js} +9 -9
- package/dist/{textarea-DyUy8u7X.cjs → textarea-Dfa4_ZBy.cjs} +1 -1
- package/dist/{textinput-IN3b0nSH.cjs → textinput-CLM9fRjm.cjs} +1 -1
- package/dist/{textinput-DIuM70dd.js → textinput-DaMYc5gd.js} +8 -8
- package/package.json +2 -2
- package/src/components/checkbox/checkbox.ts +1 -1
- package/src/components/combobox/combobox.ts +2 -2
- package/src/components/datepicker/datepicker-utils.test.ts +0 -25
- package/src/components/datepicker/datepicker-utils.ts +0 -28
- package/src/components/datepicker/datepicker.ts +0 -6
- package/src/components/header/header.ts +2 -0
- package/src/components/index.ts +0 -1
- package/src/components/radiobutton/radiobutton.ts +1 -1
- package/src/components/select/select.ts +14 -47
- package/src/components/textarea/textarea.ts +1 -1
- package/src/components/textinput/textinput.ts +1 -1
- package/dist/input-element-B8M8Nppd.js +0 -708
- package/dist/input-element-D697OAJo.cjs +0 -1
- package/dist/pkt-options-controller-CiuBG6Lt.cjs +0 -1
- package/dist/select-3dwlk22G.cjs +0 -49
- package/dist/select-_C-yztI0.js +0 -173
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { P as L, E
|
|
2
|
-
import { r as G } from "./state-
|
|
3
|
-
import { s as
|
|
4
|
-
import { P as ee } from "./input-element-
|
|
5
|
-
import { e as
|
|
6
|
-
import "./icon-
|
|
7
|
-
import "./input-wrapper-
|
|
8
|
-
import { e as $ } from "./class-map-
|
|
9
|
-
import { c as te } from "./repeat-
|
|
10
|
-
import "./tag-
|
|
1
|
+
import { P as L, E, x as o, n as l, t as w } from "./element-BXsf_NlG.js";
|
|
2
|
+
import { r as G } from "./state-DgnkjP0q.js";
|
|
3
|
+
import { s as z, f as K, n as A, a as J, i as Q, b as F, v as D, c as X, d as Y, p as Z, e as H } from "./calendar-DiNuZ8Ai.js";
|
|
4
|
+
import { P as ee } from "./input-element-DVZhYDJ_.js";
|
|
5
|
+
import { e as g, n as v } from "./ref-BxiKhrfa.js";
|
|
6
|
+
import "./icon-BgG6oO4Q.js";
|
|
7
|
+
import "./input-wrapper-3qfjLkrP.js";
|
|
8
|
+
import { e as $ } from "./class-map-Dt2jXOlF.js";
|
|
9
|
+
import { c as te } from "./repeat-B55jMEsG.js";
|
|
10
|
+
import "./tag-DgoTYNVA.js";
|
|
11
11
|
import { u as se, s as ie } from "./utils-DznhwRXm.js";
|
|
12
|
-
import { o as f } from "./if-defined-
|
|
12
|
+
import { o as f } from "./if-defined-CxHgig4I.js";
|
|
13
13
|
import { P as ae } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
14
|
-
var ne = Object.defineProperty, le = Object.getOwnPropertyDescriptor, R = (e, t,
|
|
15
|
-
for (var
|
|
16
|
-
(r = e[n]) && (
|
|
17
|
-
return s &&
|
|
14
|
+
var ne = Object.defineProperty, le = Object.getOwnPropertyDescriptor, R = (e, t, a, s) => {
|
|
15
|
+
for (var i = s > 1 ? void 0 : s ? le(t, a) : t, n = e.length - 1, r; n >= 0; n--)
|
|
16
|
+
(r = e[n]) && (i = (s ? r(t, a, i) : r(i)) || i);
|
|
17
|
+
return s && i && ne(t, a, i), i;
|
|
18
18
|
};
|
|
19
19
|
let k = class extends L {
|
|
20
20
|
constructor() {
|
|
@@ -27,7 +27,7 @@ let k = class extends L {
|
|
|
27
27
|
}, o`
|
|
28
28
|
<div class=${$(this.classes)} aria-live="polite">
|
|
29
29
|
${Array.isArray(this.dates) && this.dates[0] ? te(
|
|
30
|
-
|
|
30
|
+
z((this.dates ?? []).filter(Boolean)),
|
|
31
31
|
(e) => e,
|
|
32
32
|
(e) => {
|
|
33
33
|
var t;
|
|
@@ -37,12 +37,12 @@ let k = class extends L {
|
|
|
37
37
|
@close=${() => {
|
|
38
38
|
this.dispatchEvent(new CustomEvent("date-tag-removed", { detail: e }));
|
|
39
39
|
}}
|
|
40
|
-
.ariaLabel=${`${(t = this.strings) == null ? void 0 : t.calendar.deleteDate} ${
|
|
40
|
+
.ariaLabel=${`${(t = this.strings) == null ? void 0 : t.calendar.deleteDate} ${K(e, this.dateformat)}`}
|
|
41
41
|
>
|
|
42
|
-
<time datetime=${e}>${
|
|
42
|
+
<time datetime=${e}>${K(e, this.dateformat)}</time>
|
|
43
43
|
</pkt-tag>`;
|
|
44
44
|
}
|
|
45
|
-
) :
|
|
45
|
+
) : E}
|
|
46
46
|
</div>
|
|
47
47
|
`;
|
|
48
48
|
}
|
|
@@ -67,26 +67,7 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
67
67
|
}, b = () => {
|
|
68
68
|
const e = navigator.userAgent;
|
|
69
69
|
return !!(/iP(hone|od|ad)/.test(e) || /Macintosh/.test(e) && "ontouchend" in document);
|
|
70
|
-
},
|
|
71
|
-
/**
|
|
72
|
-
* Ensures name attribute ends with [] for multiple/range inputs
|
|
73
|
-
*
|
|
74
|
-
* For form submission to work correctly with multiple values,
|
|
75
|
-
* the input name must end with [] to indicate it's an array.
|
|
76
|
-
*
|
|
77
|
-
* @param name - The original name attribute value
|
|
78
|
-
* @param isMultiple - Whether this is a multiple-date picker
|
|
79
|
-
* @param isRange - Whether this is a range date picker
|
|
80
|
-
* @returns The normalized name with [] suffix if needed, or null if name is null
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* normalizeNameForMultiple('dates', true, false) // Returns 'dates[]'
|
|
84
|
-
* normalizeNameForMultiple('dates[]', true, false) // Returns 'dates[]' (no change)
|
|
85
|
-
* normalizeNameForMultiple('date', false, false) // Returns 'date' (no change)
|
|
86
|
-
*/
|
|
87
|
-
normalizeNameForMultiple(e, t, i) {
|
|
88
|
-
return e ? (t || i) && !e.endsWith("[]") ? e + "[]" : e : null;
|
|
89
|
-
},
|
|
70
|
+
}, N = {
|
|
90
71
|
/**
|
|
91
72
|
* Validates that a range has valid order (start <= end)
|
|
92
73
|
*
|
|
@@ -112,7 +93,7 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
112
93
|
* // Returns ['2024-01-10', '2024-02-20', '2024-03-15']
|
|
113
94
|
*/
|
|
114
95
|
sortDates(e) {
|
|
115
|
-
return
|
|
96
|
+
return z(e);
|
|
116
97
|
},
|
|
117
98
|
/**
|
|
118
99
|
* Filters dates to only include selectable ones based on constraints
|
|
@@ -139,10 +120,10 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
139
120
|
* )
|
|
140
121
|
* // Returns ['2024-01-06'] (after min, not excluded, not a weekend)
|
|
141
122
|
*/
|
|
142
|
-
filterSelectableDates(e, t,
|
|
143
|
-
return J(e, t,
|
|
123
|
+
filterSelectableDates(e, t, a, s, i) {
|
|
124
|
+
return J(e, t, a, s, i);
|
|
144
125
|
}
|
|
145
|
-
},
|
|
126
|
+
}, pe = {
|
|
146
127
|
/**
|
|
147
128
|
* Determines the appropriate input type based on device
|
|
148
129
|
*
|
|
@@ -172,8 +153,8 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
172
153
|
* submitForm(this) // From within a custom element
|
|
173
154
|
*/
|
|
174
155
|
submitForm(e) {
|
|
175
|
-
var
|
|
176
|
-
const t = (
|
|
156
|
+
var a;
|
|
157
|
+
const t = (a = e.internals) == null ? void 0 : a.form;
|
|
177
158
|
t && t.requestSubmit();
|
|
178
159
|
},
|
|
179
160
|
/**
|
|
@@ -192,8 +173,8 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
192
173
|
* )
|
|
193
174
|
*/
|
|
194
175
|
submitFormOrFallback(e, t) {
|
|
195
|
-
const
|
|
196
|
-
|
|
176
|
+
const a = e == null ? void 0 : e.form;
|
|
177
|
+
a ? a.requestSubmit() : t();
|
|
197
178
|
},
|
|
198
179
|
/**
|
|
199
180
|
* Validates a date input and sets validity state
|
|
@@ -216,20 +197,20 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
216
197
|
* { forms: { messages: { rangeUnderflow: 'Date too early' } } }
|
|
217
198
|
* )
|
|
218
199
|
*/
|
|
219
|
-
validateDateInput(e, t,
|
|
220
|
-
var r, h, U,
|
|
200
|
+
validateDateInput(e, t, a, s, i) {
|
|
201
|
+
var r, h, U, q;
|
|
221
202
|
const n = e.value;
|
|
222
|
-
n && (
|
|
203
|
+
n && (a && a > n ? t.setValidity(
|
|
223
204
|
{ rangeUnderflow: !0 },
|
|
224
|
-
((h = (r =
|
|
205
|
+
((h = (r = i == null ? void 0 : i.forms) == null ? void 0 : r.messages) == null ? void 0 : h.rangeUnderflow) || "Value is below minimum",
|
|
225
206
|
e
|
|
226
207
|
) : s && s < n && t.setValidity(
|
|
227
208
|
{ rangeOverflow: !0 },
|
|
228
|
-
((
|
|
209
|
+
((q = (U = i == null ? void 0 : i.forms) == null ? void 0 : U.messages) == null ? void 0 : q.rangeOverflow) || "Value is above maximum",
|
|
229
210
|
e
|
|
230
211
|
));
|
|
231
212
|
}
|
|
232
|
-
},
|
|
213
|
+
}, P = {
|
|
233
214
|
/**
|
|
234
215
|
* Adds a date to selected dates if it's valid
|
|
235
216
|
*
|
|
@@ -250,11 +231,11 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
250
231
|
* '2024-12-31'
|
|
251
232
|
* )
|
|
252
233
|
*/
|
|
253
|
-
addToSelected(e, t,
|
|
254
|
-
const
|
|
255
|
-
if (!
|
|
256
|
-
const n =
|
|
257
|
-
h && !isNaN(h.getTime()) && (!n || h >= n) && (!r || h <= r) && t.value && t.value.handleDateSelect(h),
|
|
234
|
+
addToSelected(e, t, a, s) {
|
|
235
|
+
const i = e.target;
|
|
236
|
+
if (!i.value) return;
|
|
237
|
+
const n = a ? A(a) : null, r = s ? A(s) : null, h = A(i.value.split(",")[0]);
|
|
238
|
+
h && !isNaN(h.getTime()) && (!n || h >= n) && (!r || h <= r) && t.value && t.value.handleDateSelect(h), i.value = "";
|
|
258
239
|
},
|
|
259
240
|
/**
|
|
260
241
|
* Handles calendar positioning based on viewport and input position
|
|
@@ -278,12 +259,12 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
278
259
|
* this.multiple && this.maxlength !== null
|
|
279
260
|
* )
|
|
280
261
|
*/
|
|
281
|
-
handleCalendarPosition(e, t,
|
|
262
|
+
handleCalendarPosition(e, t, a = !1) {
|
|
282
263
|
var h;
|
|
283
264
|
if (!e.value || !t.value) return;
|
|
284
|
-
const s = ((h = t.value.parentElement) == null ? void 0 : h.getBoundingClientRect()) || t.value.getBoundingClientRect(),
|
|
285
|
-
let r =
|
|
286
|
-
s && s.top + n > window.innerHeight && s.top - n > 0 && (r = `calc(100% - ${
|
|
265
|
+
const s = ((h = t.value.parentElement) == null ? void 0 : h.getBoundingClientRect()) || t.value.getBoundingClientRect(), i = a ? s.height + 30 : s.height, n = e.value.getBoundingClientRect().height;
|
|
266
|
+
let r = a ? "calc(100% - 30px)" : "100%";
|
|
267
|
+
s && s.top + n > window.innerHeight && s.top - n > 0 && (r = `calc(100% - ${i}px - ${n}px)`), e.value.style.top = r;
|
|
287
268
|
}
|
|
288
269
|
}, V = {
|
|
289
270
|
/**
|
|
@@ -301,15 +282,15 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
301
282
|
* const classes = getInputClasses(true, false, false, false, false, 'date')
|
|
302
283
|
* // Returns { 'pkt-input': true, 'pkt-input--fullwidth': true, ... }
|
|
303
284
|
*/
|
|
304
|
-
getInputClasses(e, t,
|
|
285
|
+
getInputClasses(e, t, a, s, i, n) {
|
|
305
286
|
return {
|
|
306
287
|
"pkt-input": !0,
|
|
307
288
|
"pkt-datepicker__input": !0,
|
|
308
289
|
"pkt-input--fullwidth": e,
|
|
309
290
|
"pkt-datepicker--hasrangelabels": t,
|
|
310
|
-
"pkt-datepicker--multiple":
|
|
291
|
+
"pkt-datepicker--multiple": a,
|
|
311
292
|
"pkt-datepicker--range": s,
|
|
312
|
-
"ios-readonly-hack":
|
|
293
|
+
"ios-readonly-hack": i === !1 && n === "text"
|
|
313
294
|
};
|
|
314
295
|
},
|
|
315
296
|
/**
|
|
@@ -362,8 +343,8 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
362
343
|
* processDateSelection(['2024-01-15'], false, false) // Returns '2024-01-15'
|
|
363
344
|
* processDateSelection(['2024-01-15', '2024-01-20'], true, false) // Returns '2024-01-15,2024-01-20'
|
|
364
345
|
*/
|
|
365
|
-
processDateSelection(e, t,
|
|
366
|
-
return !t && !
|
|
346
|
+
processDateSelection(e, t, a) {
|
|
347
|
+
return !t && !a ? e[0] || "" : Array.isArray(e) ? e.join(",") : e;
|
|
367
348
|
},
|
|
368
349
|
/**
|
|
369
350
|
* Updates input values after calendar selection
|
|
@@ -392,8 +373,8 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
392
373
|
* (input) => this.dispatchManageValidity(input)
|
|
393
374
|
* )
|
|
394
375
|
*/
|
|
395
|
-
updateInputValues(e, t,
|
|
396
|
-
e.value && (s && (t != null && t.value) ? (e.value.value =
|
|
376
|
+
updateInputValues(e, t, a, s, i, n) {
|
|
377
|
+
e.value && (s && (t != null && t.value) ? (e.value.value = a[0] ?? "", t.value.value = a[1] ?? "", n(e.value), n(t.value)) : i || (e.value.value = a.length ? a[0] : "", n(e.value)));
|
|
397
378
|
},
|
|
398
379
|
/**
|
|
399
380
|
* Processes blur events for range inputs
|
|
@@ -419,16 +400,16 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
419
400
|
* (input) => this.dispatchManageValidity(input)
|
|
420
401
|
* )
|
|
421
402
|
*/
|
|
422
|
-
processRangeBlur(e, t,
|
|
403
|
+
processRangeBlur(e, t, a, s, i) {
|
|
423
404
|
var r;
|
|
424
405
|
const n = e.target;
|
|
425
406
|
if (n.value) {
|
|
426
|
-
|
|
427
|
-
const h =
|
|
428
|
-
h && ((r =
|
|
407
|
+
i(n);
|
|
408
|
+
const h = F(n.value);
|
|
409
|
+
h && ((r = a == null ? void 0 : a.value) == null || r.handleDateSelect(h));
|
|
429
410
|
} else t[0] && s();
|
|
430
411
|
}
|
|
431
|
-
},
|
|
412
|
+
}, I = {
|
|
432
413
|
/**
|
|
433
414
|
* Handles common keyboard interactions for datepicker inputs
|
|
434
415
|
*
|
|
@@ -467,9 +448,9 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
467
448
|
* () => this.inputRef.value?.blur()
|
|
468
449
|
* )
|
|
469
450
|
*/
|
|
470
|
-
handleInputKeydown(e, t,
|
|
451
|
+
handleInputKeydown(e, t, a, s, i, n) {
|
|
471
452
|
const { key: r } = e;
|
|
472
|
-
r === "," && (e.preventDefault(), n ? n(e) :
|
|
453
|
+
r === "," && (e.preventDefault(), n ? n(e) : i && i()), (r === "Space" || r === " ") && (e.preventDefault(), t(e)), r === "Enter" && (e.preventDefault(), a ? a() : s ? s() : i && i());
|
|
473
454
|
},
|
|
474
455
|
/**
|
|
475
456
|
* Handles keyboard interactions for calendar button
|
|
@@ -487,21 +468,21 @@ const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
487
468
|
* )
|
|
488
469
|
*/
|
|
489
470
|
handleButtonKeydown(e, t) {
|
|
490
|
-
const { key:
|
|
491
|
-
(
|
|
471
|
+
const { key: a } = e;
|
|
472
|
+
(a === "Enter" || a === " " || a === "Space") && (e.preventDefault(), t(e));
|
|
492
473
|
}
|
|
493
474
|
};
|
|
494
|
-
var
|
|
495
|
-
for (var
|
|
496
|
-
(r = e[n]) && (
|
|
497
|
-
return s &&
|
|
475
|
+
var ue = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, c = (e, t, a, s) => {
|
|
476
|
+
for (var i = s > 1 ? void 0 : s ? oe(t, a) : t, n = e.length - 1, r; n >= 0; n--)
|
|
477
|
+
(r = e[n]) && (i = (s ? r(t, a, i) : r(i)) || i);
|
|
478
|
+
return s && i && ue(t, a, i), i;
|
|
498
479
|
};
|
|
499
480
|
let d = class extends L {
|
|
500
481
|
constructor() {
|
|
501
|
-
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 =
|
|
482
|
+
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 = g(), this.calendarRef = g(), this.handleDocumentClick = (e) => {
|
|
502
483
|
if (!this.open) return;
|
|
503
|
-
const t = e.composedPath(),
|
|
504
|
-
!t.includes(this) && !t.includes(s) && !(
|
|
484
|
+
const t = e.composedPath(), a = this.parentElement, s = this.popupRef.value;
|
|
485
|
+
!t.includes(this) && !t.includes(s) && !(a && t.includes(a)) && (this.hide(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 })));
|
|
505
486
|
}, this.handleDocumentKeydown = (e) => {
|
|
506
487
|
this.open && e.key === "Escape" && (this.hide(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 })));
|
|
507
488
|
};
|
|
@@ -530,9 +511,9 @@ let d = class extends L {
|
|
|
530
511
|
const e = this.calendarRef.value;
|
|
531
512
|
e && typeof e.focusOnCurrentDate == "function" && e.focusOnCurrentDate();
|
|
532
513
|
}
|
|
533
|
-
addToSelected(e, t,
|
|
534
|
-
if (typeof
|
|
535
|
-
return
|
|
514
|
+
addToSelected(e, t, a) {
|
|
515
|
+
if (typeof P.addToSelected == "function")
|
|
516
|
+
return P.addToSelected(e, this.calendarRef, t, a);
|
|
536
517
|
}
|
|
537
518
|
handleDateSelect(e) {
|
|
538
519
|
const t = this.calendarRef.value;
|
|
@@ -613,14 +594,14 @@ c([
|
|
|
613
594
|
d = c([
|
|
614
595
|
w("pkt-datepicker-popup")
|
|
615
596
|
], d);
|
|
616
|
-
var he = Object.defineProperty, y = (e, t,
|
|
617
|
-
for (var
|
|
618
|
-
(r = e[n]) && (
|
|
619
|
-
return
|
|
597
|
+
var he = Object.defineProperty, y = (e, t, a, s) => {
|
|
598
|
+
for (var i = void 0, n = e.length - 1, r; n >= 0; n--)
|
|
599
|
+
(r = e[n]) && (i = r(t, a, i) || i);
|
|
600
|
+
return i && he(t, a, i), i;
|
|
620
601
|
};
|
|
621
|
-
class
|
|
602
|
+
class m extends L {
|
|
622
603
|
constructor() {
|
|
623
|
-
super(...arguments), this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.inputClasses = {}, this.inputRef =
|
|
604
|
+
super(...arguments), this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.inputClasses = {}, this.inputRef = g(), this.btnRef = g();
|
|
624
605
|
}
|
|
625
606
|
// Shared getters
|
|
626
607
|
get inputElement() {
|
|
@@ -684,10 +665,10 @@ class g extends L {
|
|
|
684
665
|
<button
|
|
685
666
|
class="${$(V.getButtonClasses())}"
|
|
686
667
|
type="button"
|
|
687
|
-
@click=${(
|
|
688
|
-
@keydown=${(
|
|
689
|
-
const { key: s } =
|
|
690
|
-
(s === "Enter" || s === " " || s === "Space") && (
|
|
668
|
+
@click=${(a) => this.dispatchToggleCalendar(a)}
|
|
669
|
+
@keydown=${(a) => {
|
|
670
|
+
const { key: s } = a;
|
|
671
|
+
(s === "Enter" || s === " " || s === "Space") && (a.preventDefault(), this.dispatchToggleCalendar(a));
|
|
691
672
|
}}
|
|
692
673
|
?disabled=${this.disabled}
|
|
693
674
|
${this.btnRef}
|
|
@@ -704,45 +685,45 @@ class g extends L {
|
|
|
704
685
|
}
|
|
705
686
|
y([
|
|
706
687
|
l({ type: String })
|
|
707
|
-
],
|
|
688
|
+
], m.prototype, "inputType");
|
|
708
689
|
y([
|
|
709
690
|
l({ type: String })
|
|
710
|
-
],
|
|
691
|
+
], m.prototype, "id");
|
|
711
692
|
y([
|
|
712
693
|
l({ type: String })
|
|
713
|
-
],
|
|
694
|
+
], m.prototype, "min");
|
|
714
695
|
y([
|
|
715
696
|
l({ type: String })
|
|
716
|
-
],
|
|
697
|
+
], m.prototype, "max");
|
|
717
698
|
y([
|
|
718
699
|
l({ type: String })
|
|
719
|
-
],
|
|
700
|
+
], m.prototype, "placeholder");
|
|
720
701
|
y([
|
|
721
702
|
l({ type: Boolean })
|
|
722
|
-
],
|
|
703
|
+
], m.prototype, "readonly");
|
|
723
704
|
y([
|
|
724
705
|
l({ type: Boolean })
|
|
725
|
-
],
|
|
706
|
+
], m.prototype, "disabled");
|
|
726
707
|
y([
|
|
727
708
|
l({ type: Object })
|
|
728
|
-
],
|
|
709
|
+
], m.prototype, "inputClasses");
|
|
729
710
|
y([
|
|
730
711
|
l({ type: Object })
|
|
731
|
-
],
|
|
732
|
-
const
|
|
712
|
+
], m.prototype, "internals");
|
|
713
|
+
const W = {
|
|
733
714
|
calendar: { buttonAltText: "Åpne kalender" }
|
|
734
715
|
}, de = {
|
|
735
716
|
calendar: { buttonAltText: "Åpne kalender" },
|
|
736
717
|
generic: { from: "Fra", to: "Til" }
|
|
737
718
|
};
|
|
738
|
-
var ce = Object.defineProperty,
|
|
739
|
-
for (var
|
|
740
|
-
(r = e[n]) && (
|
|
741
|
-
return s &&
|
|
719
|
+
var ce = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, M = (e, t, a, s) => {
|
|
720
|
+
for (var i = s > 1 ? void 0 : s ? ge(t, a) : t, n = e.length - 1, r; n >= 0; n--)
|
|
721
|
+
(r = e[n]) && (i = (s ? r(t, a, i) : r(i)) || i);
|
|
722
|
+
return s && i && ce(t, a, i), i;
|
|
742
723
|
};
|
|
743
|
-
let
|
|
724
|
+
let S = class extends m {
|
|
744
725
|
constructor() {
|
|
745
|
-
super(...arguments), this.value = "", this.strings =
|
|
726
|
+
super(...arguments), this.value = "", this.strings = W;
|
|
746
727
|
}
|
|
747
728
|
dispatchManageValidity(e) {
|
|
748
729
|
this.dispatchEvent(
|
|
@@ -773,7 +754,7 @@ let O = class extends g {
|
|
|
773
754
|
e.preventDefault(), this.dispatchToggleCalendar(e);
|
|
774
755
|
}}
|
|
775
756
|
?disabled=${this.disabled}
|
|
776
|
-
@keydown=${(e) =>
|
|
757
|
+
@keydown=${(e) => I.handleInputKeydown(
|
|
777
758
|
e,
|
|
778
759
|
(t) => this.dispatchToggleCalendar(t),
|
|
779
760
|
() => x.submitFormOrFallback(this.internals, () => {
|
|
@@ -811,33 +792,33 @@ let O = class extends g {
|
|
|
811
792
|
`;
|
|
812
793
|
}
|
|
813
794
|
};
|
|
814
|
-
|
|
795
|
+
M([
|
|
815
796
|
l({ type: String })
|
|
816
|
-
],
|
|
817
|
-
|
|
797
|
+
], S.prototype, "value", 2);
|
|
798
|
+
M([
|
|
818
799
|
l({ type: Object })
|
|
819
|
-
],
|
|
820
|
-
|
|
800
|
+
], S.prototype, "strings", 2);
|
|
801
|
+
S = M([
|
|
821
802
|
w("pkt-datepicker-single")
|
|
822
|
-
],
|
|
823
|
-
var fe = Object.defineProperty,
|
|
824
|
-
for (var
|
|
825
|
-
(r = e[n]) && (
|
|
826
|
-
return s &&
|
|
803
|
+
], S);
|
|
804
|
+
var fe = Object.defineProperty, me = Object.getOwnPropertyDescriptor, O = (e, t, a, s) => {
|
|
805
|
+
for (var i = s > 1 ? void 0 : s ? me(t, a) : t, n = e.length - 1, r; n >= 0; n--)
|
|
806
|
+
(r = e[n]) && (i = (s ? r(t, a, i) : r(i)) || i);
|
|
807
|
+
return s && i && fe(t, a, i), i;
|
|
827
808
|
};
|
|
828
|
-
let _ = class extends
|
|
809
|
+
let _ = class extends m {
|
|
829
810
|
constructor() {
|
|
830
|
-
super(...arguments), this.value = [], this.showRangeLabels = !1, this.strings = de, this.inputRefTo =
|
|
811
|
+
super(...arguments), this.value = [], this.showRangeLabels = !1, this.strings = de, this.inputRefTo = g();
|
|
831
812
|
}
|
|
832
813
|
get inputElementTo() {
|
|
833
814
|
return this.inputRefTo.value;
|
|
834
815
|
}
|
|
835
816
|
render() {
|
|
836
|
-
var t,
|
|
817
|
+
var t, a;
|
|
837
818
|
const e = V.getRangeLabelClasses(this.showRangeLabels);
|
|
838
819
|
return o`
|
|
839
820
|
<div class="pkt-input__container">
|
|
840
|
-
${this.showRangeLabels ? o` <div class="pkt-input-prefix">${(t = this.strings.generic) == null ? void 0 : t.from}</div> ` :
|
|
821
|
+
${this.showRangeLabels ? o` <div class="pkt-input-prefix">${(t = this.strings.generic) == null ? void 0 : t.from}</div> ` : E}
|
|
841
822
|
<input
|
|
842
823
|
class=${$(this.inputClasses)}
|
|
843
824
|
.type=${this.inputType}
|
|
@@ -854,23 +835,23 @@ let _ = class extends g {
|
|
|
854
835
|
@touchend=${(s) => {
|
|
855
836
|
s.preventDefault(), this.dispatchToggleCalendar(s);
|
|
856
837
|
}}
|
|
857
|
-
@keydown=${(s) =>
|
|
838
|
+
@keydown=${(s) => I.handleInputKeydown(
|
|
858
839
|
s,
|
|
859
|
-
(
|
|
840
|
+
(i) => this.dispatchToggleCalendar(i),
|
|
860
841
|
() => x.submitFormOrFallback(
|
|
861
842
|
this.internals,
|
|
862
843
|
() => {
|
|
863
|
-
var
|
|
864
|
-
return (
|
|
844
|
+
var i;
|
|
845
|
+
return (i = this.inputRefTo.value) == null ? void 0 : i.focus();
|
|
865
846
|
}
|
|
866
847
|
),
|
|
867
848
|
() => {
|
|
868
|
-
var
|
|
869
|
-
return (
|
|
849
|
+
var i;
|
|
850
|
+
return (i = this.inputRefTo.value) == null ? void 0 : i.focus();
|
|
870
851
|
},
|
|
871
852
|
() => {
|
|
872
|
-
var
|
|
873
|
-
return (
|
|
853
|
+
var i;
|
|
854
|
+
return (i = this.inputRef.value) == null ? void 0 : i.blur();
|
|
874
855
|
}
|
|
875
856
|
)}
|
|
876
857
|
@input=${(s) => {
|
|
@@ -898,9 +879,9 @@ let _ = class extends g {
|
|
|
898
879
|
${v(this.inputRef)}
|
|
899
880
|
/>
|
|
900
881
|
<div class="${$(e)}" id="${this.id}-to-label">
|
|
901
|
-
${(
|
|
882
|
+
${(a = this.strings.generic) == null ? void 0 : a.to}
|
|
902
883
|
</div>
|
|
903
|
-
${this.showRangeLabels ?
|
|
884
|
+
${this.showRangeLabels ? E : o` <div class="pkt-input-separator">–</div> `}
|
|
904
885
|
<input
|
|
905
886
|
class=${$(this.inputClasses)}
|
|
906
887
|
.type=${this.inputType}
|
|
@@ -918,17 +899,17 @@ let _ = class extends g {
|
|
|
918
899
|
@touchend=${(s) => {
|
|
919
900
|
s.preventDefault(), this.dispatchToggleCalendar(s);
|
|
920
901
|
}}
|
|
921
|
-
@keydown=${(s) =>
|
|
902
|
+
@keydown=${(s) => I.handleInputKeydown(
|
|
922
903
|
s,
|
|
923
|
-
(
|
|
904
|
+
(i) => this.dispatchToggleCalendar(i),
|
|
924
905
|
() => x.submitFormOrFallback(this.internals, () => {
|
|
925
|
-
var
|
|
926
|
-
return (
|
|
906
|
+
var i;
|
|
907
|
+
return (i = this.inputRefTo.value) == null ? void 0 : i.blur();
|
|
927
908
|
}),
|
|
928
909
|
void 0,
|
|
929
910
|
() => {
|
|
930
|
-
var
|
|
931
|
-
return (
|
|
911
|
+
var i;
|
|
912
|
+
return (i = this.inputRefTo.value) == null ? void 0 : i.blur();
|
|
932
913
|
}
|
|
933
914
|
)}
|
|
934
915
|
@input=${(s) => {
|
|
@@ -960,26 +941,26 @@ let _ = class extends g {
|
|
|
960
941
|
`;
|
|
961
942
|
}
|
|
962
943
|
};
|
|
963
|
-
|
|
944
|
+
O([
|
|
964
945
|
l({ type: Array })
|
|
965
946
|
], _.prototype, "value", 2);
|
|
966
|
-
|
|
947
|
+
O([
|
|
967
948
|
l({ type: Boolean })
|
|
968
949
|
], _.prototype, "showRangeLabels", 2);
|
|
969
|
-
|
|
950
|
+
O([
|
|
970
951
|
l({ type: Object })
|
|
971
952
|
], _.prototype, "strings", 2);
|
|
972
|
-
_ =
|
|
953
|
+
_ = O([
|
|
973
954
|
w("pkt-datepicker-range")
|
|
974
955
|
], _);
|
|
975
|
-
var ve = Object.defineProperty, ye = Object.getOwnPropertyDescriptor,
|
|
976
|
-
for (var
|
|
977
|
-
(r = e[n]) && (
|
|
978
|
-
return s &&
|
|
956
|
+
var ve = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, B = (e, t, a, s) => {
|
|
957
|
+
for (var i = s > 1 ? void 0 : s ? ye(t, a) : t, n = e.length - 1, r; n >= 0; n--)
|
|
958
|
+
(r = e[n]) && (i = (s ? r(t, a, i) : r(i)) || i);
|
|
959
|
+
return s && i && ve(t, a, i), i;
|
|
979
960
|
};
|
|
980
|
-
let T = class extends
|
|
961
|
+
let T = class extends m {
|
|
981
962
|
constructor() {
|
|
982
|
-
super(...arguments), this.value = [], this.strings =
|
|
963
|
+
super(...arguments), this.value = [], this.strings = W;
|
|
983
964
|
}
|
|
984
965
|
get isInputDisabled() {
|
|
985
966
|
return this.disabled || this.maxlength !== void 0 && this.maxlength !== null && this.value.length >= this.maxlength;
|
|
@@ -1020,7 +1001,7 @@ let T = class extends g {
|
|
|
1020
1001
|
@focus=${() => {
|
|
1021
1002
|
this.dispatchFocus(), b() && this.dispatchToggleCalendar(new Event("focus"));
|
|
1022
1003
|
}}
|
|
1023
|
-
@keydown=${(e) =>
|
|
1004
|
+
@keydown=${(e) => I.handleInputKeydown(
|
|
1024
1005
|
e,
|
|
1025
1006
|
(t) => this.dispatchToggleCalendar(t),
|
|
1026
1007
|
() => x.submitFormOrFallback(this.internals, () => {
|
|
@@ -1041,31 +1022,31 @@ let T = class extends g {
|
|
|
1041
1022
|
`;
|
|
1042
1023
|
}
|
|
1043
1024
|
};
|
|
1044
|
-
|
|
1025
|
+
B([
|
|
1045
1026
|
l({ type: Array })
|
|
1046
1027
|
], T.prototype, "value", 2);
|
|
1047
|
-
|
|
1028
|
+
B([
|
|
1048
1029
|
l({ type: Number })
|
|
1049
1030
|
], T.prototype, "maxlength", 2);
|
|
1050
|
-
|
|
1031
|
+
B([
|
|
1051
1032
|
l({ type: Object })
|
|
1052
1033
|
], T.prototype, "strings", 2);
|
|
1053
|
-
T =
|
|
1034
|
+
T = B([
|
|
1054
1035
|
w("pkt-datepicker-multiple")
|
|
1055
1036
|
], T);
|
|
1056
|
-
var $e = Object.defineProperty, be = Object.getOwnPropertyDescriptor,
|
|
1057
|
-
for (var
|
|
1058
|
-
(r = e[n]) && (
|
|
1059
|
-
return s &&
|
|
1037
|
+
var $e = Object.defineProperty, be = Object.getOwnPropertyDescriptor, u = (e, t, a, s) => {
|
|
1038
|
+
for (var i = s > 1 ? void 0 : s ? be(t, a) : t, n = e.length - 1, r; n >= 0; n--)
|
|
1039
|
+
(r = e[n]) && (i = (s ? r(t, a, i) : r(i)) || i);
|
|
1040
|
+
return s && i && $e(t, a, i), i;
|
|
1060
1041
|
};
|
|
1061
|
-
let
|
|
1042
|
+
let p = class extends ee {
|
|
1062
1043
|
/**
|
|
1063
1044
|
* Housekeeping / lifecycle methods
|
|
1064
1045
|
*/
|
|
1065
1046
|
constructor() {
|
|
1066
|
-
super(), this._valueProperty = "", this.datepickerPopupRef =
|
|
1047
|
+
super(), this._valueProperty = "", this.datepickerPopupRef = g(), this._value = [], 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.calRef = g(), this.popupRef = g(), this.helptextSlot = g(), this.singleInputRef = g(), this.rangeInputRef = g(), this.multipleInputRef = g(), this.addToSelected = (e) => {
|
|
1067
1048
|
const t = this.datepickerPopupRef.value;
|
|
1068
|
-
return t && typeof t.addToSelected == "function" ? t.addToSelected(e, this.min, this.max) :
|
|
1049
|
+
return t && typeof t.addToSelected == "function" ? t.addToSelected(e, this.min, this.max) : P.addToSelected(e, this.calRef, this.min, this.max);
|
|
1069
1050
|
}, this.slotController = new ae(this, this.helptextSlot);
|
|
1070
1051
|
}
|
|
1071
1052
|
get value() {
|
|
@@ -1079,10 +1060,10 @@ let u = class extends ee {
|
|
|
1079
1060
|
* Computed properties
|
|
1080
1061
|
*/
|
|
1081
1062
|
get inputType() {
|
|
1082
|
-
return
|
|
1063
|
+
return pe.getInputType();
|
|
1083
1064
|
}
|
|
1084
1065
|
connectedCallback() {
|
|
1085
|
-
super.connectedCallback(), this.timezone && this.timezone !== window.pktTz && (window.pktTz = this.timezone)
|
|
1066
|
+
super.connectedCallback(), this.timezone && this.timezone !== window.pktTz && (window.pktTz = this.timezone);
|
|
1086
1067
|
}
|
|
1087
1068
|
disconnectedCallback() {
|
|
1088
1069
|
super.disconnectedCallback();
|
|
@@ -1092,30 +1073,30 @@ let u = class extends ee {
|
|
|
1092
1073
|
}
|
|
1093
1074
|
valueChanged(e, t) {
|
|
1094
1075
|
if (e === t) return;
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1076
|
+
const a = D(e), s = this.multiple && a.length > 1 ? N.filterSelectableDates(
|
|
1077
|
+
a,
|
|
1097
1078
|
this.min,
|
|
1098
1079
|
this.max,
|
|
1099
1080
|
this.excludedates,
|
|
1100
1081
|
this.excludeweekdays
|
|
1101
|
-
) :
|
|
1102
|
-
if (this.range && !
|
|
1082
|
+
) : a;
|
|
1083
|
+
if (this.range && !N.validateRangeOrder(s)) {
|
|
1103
1084
|
this._value = [], this._valueProperty = "", super.valueChanged("", t);
|
|
1104
1085
|
return;
|
|
1105
1086
|
}
|
|
1106
1087
|
this._value = s;
|
|
1107
|
-
const
|
|
1108
|
-
this._valueProperty !==
|
|
1088
|
+
const i = X(s);
|
|
1089
|
+
this._valueProperty !== i && (this._valueProperty = i), super.valueChanged(i, t);
|
|
1109
1090
|
}
|
|
1110
|
-
attributeChangedCallback(e, t,
|
|
1111
|
-
e === "value" && this.value !== t && this.valueChanged(
|
|
1091
|
+
attributeChangedCallback(e, t, a) {
|
|
1092
|
+
e === "value" && this.value !== t && this.valueChanged(a, t), e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = D(a || "")), e === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = D(a || "")), super.attributeChangedCallback(e, t, a);
|
|
1112
1093
|
}
|
|
1113
1094
|
updated(e) {
|
|
1114
1095
|
if (e.has("value")) {
|
|
1115
|
-
const t = Array.isArray(this.value) ? this.value.join(",") : this.value,
|
|
1096
|
+
const t = Array.isArray(this.value) ? this.value.join(",") : this.value, a = e.get("value"), s = Array.isArray(a) ? a.join(",") : a;
|
|
1116
1097
|
this.valueChanged(t, s);
|
|
1117
1098
|
}
|
|
1118
|
-
|
|
1099
|
+
e.has("multiple") && (this.multiple && !Array.isArray(this._value) ? this._value = D(this.value) : !this.multiple && Array.isArray(this._value) && (this._value = this._value.filter(Boolean)), !this.multiple && !this.range && Array.isArray(this._value) && (this._value = [this._value[0] ?? ""])), super.updated(e);
|
|
1119
1100
|
}
|
|
1120
1101
|
/**
|
|
1121
1102
|
* Element references
|
|
@@ -1129,8 +1110,8 @@ let u = class extends ee {
|
|
|
1129
1110
|
}
|
|
1130
1111
|
// Getters for backward compatibility with input refs
|
|
1131
1112
|
get currentInputElement() {
|
|
1132
|
-
var e, t,
|
|
1133
|
-
return this.multiple ? (e = this.multipleInputRef.value) == null ? void 0 : e.inputElement : this.range ? (t = this.rangeInputRef.value) == null ? void 0 : t.inputElement : (
|
|
1113
|
+
var e, t, a;
|
|
1114
|
+
return this.multiple ? (e = this.multipleInputRef.value) == null ? void 0 : e.inputElement : this.range ? (t = this.rangeInputRef.value) == null ? void 0 : t.inputElement : (a = this.singleInputRef.value) == null ? void 0 : a.inputElement;
|
|
1134
1115
|
}
|
|
1135
1116
|
get currentInputElementTo() {
|
|
1136
1117
|
var e;
|
|
@@ -1138,8 +1119,8 @@ let u = class extends ee {
|
|
|
1138
1119
|
return (e = this.rangeInputRef.value) == null ? void 0 : e.inputElementTo;
|
|
1139
1120
|
}
|
|
1140
1121
|
get currentButtonElement() {
|
|
1141
|
-
var e, t,
|
|
1142
|
-
return this.multiple ? (e = this.multipleInputRef.value) == null ? void 0 : e.buttonElement : this.range ? (t = this.rangeInputRef.value) == null ? void 0 : t.buttonElement : (
|
|
1122
|
+
var e, t, a;
|
|
1123
|
+
return this.multiple ? (e = this.multipleInputRef.value) == null ? void 0 : e.buttonElement : this.range ? (t = this.rangeInputRef.value) == null ? void 0 : t.buttonElement : (a = this.singleInputRef.value) == null ? void 0 : a.buttonElement;
|
|
1143
1124
|
}
|
|
1144
1125
|
// Override btnRef for compatibility
|
|
1145
1126
|
get btnRef() {
|
|
@@ -1203,13 +1184,13 @@ let u = class extends ee {
|
|
|
1203
1184
|
(t = this.calRef.value) != null && t.contains(e.detail.relatedTarget) || this.onBlur();
|
|
1204
1185
|
}}
|
|
1205
1186
|
@range-blur=${(e) => {
|
|
1206
|
-
const t = this.currentInputElement,
|
|
1207
|
-
if (t &&
|
|
1208
|
-
const s = t.value,
|
|
1209
|
-
if (s &&
|
|
1210
|
-
|
|
1187
|
+
const t = this.currentInputElement, a = this.currentInputElementTo;
|
|
1188
|
+
if (t && a) {
|
|
1189
|
+
const s = t.value, i = a.value;
|
|
1190
|
+
if (s && i && s > i)
|
|
1191
|
+
a.value = "", this._value = [s], this.value = s;
|
|
1211
1192
|
else {
|
|
1212
|
-
const n = [s,
|
|
1193
|
+
const n = [s, i].filter(Boolean);
|
|
1213
1194
|
n.length > 0 && (n[0] !== this._value[0] || n[1] !== this._value[1]) && (this._value = n, this.value = n.join(","));
|
|
1214
1195
|
}
|
|
1215
1196
|
}
|
|
@@ -1226,11 +1207,11 @@ let u = class extends ee {
|
|
|
1226
1207
|
x.validateDateInput(e.detail, this.internals, this.min, this.max, this.strings);
|
|
1227
1208
|
}}
|
|
1228
1209
|
@handle-date-select=${(e) => {
|
|
1229
|
-
var
|
|
1230
|
-
const t =
|
|
1210
|
+
var a, s;
|
|
1211
|
+
const t = F(e.detail);
|
|
1231
1212
|
if (t) {
|
|
1232
|
-
const
|
|
1233
|
-
this._value[0] !==
|
|
1213
|
+
const i = Y(t);
|
|
1214
|
+
this._value[0] !== i && this._value[1] !== i && ((s = (a = this.calRef) == null ? void 0 : a.value) == null || s.handleDateSelect(t));
|
|
1234
1215
|
}
|
|
1235
1216
|
}}
|
|
1236
1217
|
@input-changed=${() => {
|
|
@@ -1344,10 +1325,10 @@ let u = class extends ee {
|
|
|
1344
1325
|
id-base=${this.id}
|
|
1345
1326
|
@date-tag-removed=${(e) => {
|
|
1346
1327
|
var s;
|
|
1347
|
-
const t = this.datepickerPopupRef.value,
|
|
1348
|
-
t &&
|
|
1328
|
+
const t = this.datepickerPopupRef.value, a = F(e.detail);
|
|
1329
|
+
t && a && typeof t.handleDateSelect == "function" ? t.handleDateSelect(a) : (s = this.calRef.value) == null || s.handleDateSelect(a);
|
|
1349
1330
|
}}
|
|
1350
|
-
></pkt-date-tags>` :
|
|
1331
|
+
></pkt-date-tags>` : E}
|
|
1351
1332
|
<div
|
|
1352
1333
|
class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
|
|
1353
1334
|
>
|
|
@@ -1362,7 +1343,7 @@ let u = class extends ee {
|
|
|
1362
1343
|
*/
|
|
1363
1344
|
handleCalendarPosition() {
|
|
1364
1345
|
const e = this.multiple && !!this.maxlength;
|
|
1365
|
-
|
|
1346
|
+
P.handleCalendarPosition(this.popupRef, this.inputRef, e);
|
|
1366
1347
|
}
|
|
1367
1348
|
async showCalendar() {
|
|
1368
1349
|
var t;
|
|
@@ -1381,8 +1362,8 @@ let u = class extends ee {
|
|
|
1381
1362
|
e.preventDefault();
|
|
1382
1363
|
const t = this.datepickerPopupRef.value;
|
|
1383
1364
|
if (t && typeof t.toggle == "function") {
|
|
1384
|
-
const
|
|
1385
|
-
t.toggle(), this.calendarOpen = !
|
|
1365
|
+
const a = !!t.open;
|
|
1366
|
+
t.toggle(), this.calendarOpen = !a;
|
|
1386
1367
|
return;
|
|
1387
1368
|
}
|
|
1388
1369
|
this.calendarOpen ? this.hideCalendar() : this.showCalendar();
|
|
@@ -1397,67 +1378,67 @@ let u = class extends ee {
|
|
|
1397
1378
|
);
|
|
1398
1379
|
}
|
|
1399
1380
|
};
|
|
1400
|
-
|
|
1381
|
+
u([
|
|
1401
1382
|
l({ type: String, reflect: !0 })
|
|
1402
|
-
],
|
|
1403
|
-
|
|
1383
|
+
], p.prototype, "value", 1);
|
|
1384
|
+
u([
|
|
1404
1385
|
l({ type: Array })
|
|
1405
|
-
],
|
|
1406
|
-
|
|
1386
|
+
], p.prototype, "_value", 2);
|
|
1387
|
+
u([
|
|
1407
1388
|
l({ type: String, reflect: !0 })
|
|
1408
|
-
],
|
|
1409
|
-
|
|
1389
|
+
], p.prototype, "label", 2);
|
|
1390
|
+
u([
|
|
1410
1391
|
l({ type: String })
|
|
1411
|
-
],
|
|
1412
|
-
|
|
1392
|
+
], p.prototype, "dateformat", 2);
|
|
1393
|
+
u([
|
|
1413
1394
|
l({ type: Boolean, reflect: !0 })
|
|
1414
|
-
],
|
|
1415
|
-
|
|
1395
|
+
], p.prototype, "multiple", 2);
|
|
1396
|
+
u([
|
|
1416
1397
|
l({ type: Number, reflect: !0 })
|
|
1417
|
-
],
|
|
1418
|
-
|
|
1398
|
+
], p.prototype, "maxlength", 2);
|
|
1399
|
+
u([
|
|
1419
1400
|
l({ type: Boolean, reflect: !0 })
|
|
1420
|
-
],
|
|
1421
|
-
|
|
1401
|
+
], p.prototype, "range", 2);
|
|
1402
|
+
u([
|
|
1422
1403
|
l({ type: Boolean })
|
|
1423
|
-
],
|
|
1424
|
-
|
|
1404
|
+
], p.prototype, "showRangeLabels", 2);
|
|
1405
|
+
u([
|
|
1425
1406
|
l({ type: String, reflect: !0 })
|
|
1426
|
-
],
|
|
1427
|
-
|
|
1407
|
+
], p.prototype, "min", 2);
|
|
1408
|
+
u([
|
|
1428
1409
|
l({ type: String, reflect: !0 })
|
|
1429
|
-
],
|
|
1430
|
-
|
|
1410
|
+
], p.prototype, "max", 2);
|
|
1411
|
+
u([
|
|
1431
1412
|
l({ type: Boolean })
|
|
1432
|
-
],
|
|
1433
|
-
|
|
1413
|
+
], p.prototype, "weeknumbers", 2);
|
|
1414
|
+
u([
|
|
1434
1415
|
l({ type: Boolean, reflect: !0 })
|
|
1435
|
-
],
|
|
1436
|
-
|
|
1437
|
-
l({ converter:
|
|
1438
|
-
],
|
|
1439
|
-
|
|
1440
|
-
l({ converter:
|
|
1441
|
-
],
|
|
1442
|
-
|
|
1416
|
+
], p.prototype, "withcontrols", 2);
|
|
1417
|
+
u([
|
|
1418
|
+
l({ converter: H.csvToArray })
|
|
1419
|
+
], p.prototype, "excludedates", 2);
|
|
1420
|
+
u([
|
|
1421
|
+
l({ converter: H.csvToArray })
|
|
1422
|
+
], p.prototype, "excludeweekdays", 2);
|
|
1423
|
+
u([
|
|
1443
1424
|
l({ type: String })
|
|
1444
|
-
],
|
|
1445
|
-
|
|
1425
|
+
], p.prototype, "currentmonth", 2);
|
|
1426
|
+
u([
|
|
1446
1427
|
l({ type: Boolean, reflect: !0 })
|
|
1447
|
-
],
|
|
1448
|
-
|
|
1428
|
+
], p.prototype, "calendarOpen", 2);
|
|
1429
|
+
u([
|
|
1449
1430
|
l({ type: String })
|
|
1450
|
-
],
|
|
1451
|
-
|
|
1431
|
+
], p.prototype, "timezone", 2);
|
|
1432
|
+
u([
|
|
1452
1433
|
G()
|
|
1453
|
-
],
|
|
1454
|
-
|
|
1434
|
+
], p.prototype, "inputClasses", 2);
|
|
1435
|
+
p = u([
|
|
1455
1436
|
w("pkt-datepicker")
|
|
1456
|
-
],
|
|
1437
|
+
], p);
|
|
1457
1438
|
export {
|
|
1458
1439
|
k as P,
|
|
1459
|
-
|
|
1460
|
-
|
|
1440
|
+
p as a,
|
|
1441
|
+
S as b,
|
|
1461
1442
|
_ as c,
|
|
1462
1443
|
T as d
|
|
1463
1444
|
};
|