@oslokommune/punkt-elements 16.7.1 → 16.7.3
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 +17 -0
- package/dist/accordionitem-_9AiCIvd.cjs +34 -0
- package/dist/{accordionitem-ZlaXvjt5.js → accordionitem-dCfSrxh5.js} +57 -55
- package/dist/alert-BtOk8yRH.cjs +33 -0
- package/dist/{alert-BuAXrnKl.js → alert-DlY2_grU.js} +48 -46
- package/dist/backlink-Ce5Vldop.js +49 -0
- package/dist/backlink-y3dwjKPC.cjs +13 -0
- package/dist/button-B_TXwNzt.cjs +27 -0
- package/dist/{button-DEyvt1LI.js → button-BiY-wlKF.js} +79 -77
- package/dist/calendar-B2pji2zn.cjs +90 -0
- package/dist/{calendar-S63oreVW.js → calendar-DhjQDC4C.js} +689 -687
- package/dist/card-BwMNB5Bb.cjs +87 -0
- package/dist/{card-DDiLfuO4.js → card-CGlmcMSR.js} +99 -97
- package/dist/checkbox-BsJZYA26.js +147 -0
- package/dist/checkbox-CTY8f_qn.cjs +31 -0
- package/dist/{combobox-BmxSecfE.js → combobox-DSB5WOxg.js} +223 -226
- package/dist/{combobox-Hb2V-fPX.cjs → combobox-DbICIgKG.cjs} +4 -4
- package/dist/consent-DkOQpbsg.cjs +11 -0
- package/dist/{consent-iXyx5v6J.js → consent-SNWV_mMU.js} +48 -46
- package/dist/datepicker-BEWl9iz3.cjs +273 -0
- package/dist/{datepicker-CZl7b8Na.js → datepicker-euHyzXnb.js} +341 -329
- package/dist/{heading-CKt7cVn7.js → heading-D2tVS6lS.js} +30 -28
- package/dist/heading-DrzbgDb6.cjs +1 -0
- package/dist/helptext-BKtU4mas.js +82 -0
- package/dist/helptext-DcRC7wW2.cjs +24 -0
- package/dist/icon-CxQcIa5F.js +105 -0
- package/dist/icon-q81vqPK_.cjs +9 -0
- package/dist/input-wrapper-Bs4CRNst.js +181 -0
- package/dist/input-wrapper-Bv9aqqVq.cjs +54 -0
- package/dist/link-C0rl-86s.cjs +7 -0
- package/dist/link-Cdqgl60z.js +55 -0
- package/dist/linkcard-Dimu7Rlx.cjs +13 -0
- package/dist/linkcard-Lbq_UhjZ.js +56 -0
- package/dist/{listbox-BQKDZvZn.js → listbox-Bia4_tvN.js} +131 -129
- package/dist/listbox-La2GZQei.cjs +106 -0
- package/dist/loader-D1ugDXGV.cjs +16 -0
- package/dist/{loader-Ci3CHU8k.js → loader-DyN6RGC5.js} +51 -49
- package/dist/messagebox-BGMVm2t9.js +71 -0
- package/dist/messagebox-M0yIgCz9.cjs +13 -0
- package/dist/modal-CMO1RtIi.cjs +36 -0
- package/dist/{modal-DzGe1g8Z.js → modal-DjPQDE-Z.js} +53 -51
- 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 +3 -4
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -3
- package/dist/pkt-breadcrumbs.cjs +11 -11
- package/dist/pkt-breadcrumbs.js +30 -28
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +3 -4
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -3
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -3
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +3 -4
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +3 -4
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -3
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +7 -8
- package/dist/pkt-header.cjs +35 -35
- package/dist/pkt-header.js +224 -218
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +3 -4
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +3 -4
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +3 -4
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +26 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -3
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -3
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +3 -4
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +3 -4
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +3 -4
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +3 -4
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +3 -4
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -3
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +3 -4
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +3 -4
- 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 +3 -4
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +3 -4
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +3 -4
- package/dist/pkt-timepicker.cjs +16 -16
- package/dist/pkt-timepicker.js +91 -89
- package/dist/progressbar-BqlMzkM_.cjs +21 -0
- package/dist/{progressbar-By7e0lEI.js → progressbar-sbHDFC12.js} +88 -88
- package/dist/radiobutton-5ZqVVtTT.cjs +31 -0
- package/dist/{radiobutton-6frNG9J_.js → radiobutton-D8Ai8ETa.js} +44 -42
- package/dist/select-De-n8on9.js +230 -0
- package/dist/select-dTWibR6_.cjs +49 -0
- package/dist/tabitem-B9-jeV97.js +334 -0
- package/dist/tabitem-BnhzqfW3.cjs +65 -0
- package/dist/tag-CbwO8yvD.cjs +27 -0
- package/dist/{tag-BuCpqaks.js → tag-D4FI5t3y.js} +42 -40
- package/dist/textarea-BmLaKzsc.cjs +50 -0
- package/dist/{textarea-Bzuymclz.js → textarea-CMiSJaYL.js} +62 -60
- package/dist/textinput-em9y4yrL.cjs +70 -0
- package/dist/{textinput-9lHjs4ce.js → textinput-r8udK0IX.js} +57 -55
- package/package.json +2 -2
- package/src/components/accordion/accordion.ts +6 -1
- package/src/components/accordion/accordionitem.ts +6 -1
- package/src/components/alert/alert.ts +6 -1
- package/src/components/backlink/backlink.ts +6 -1
- package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
- package/src/components/button/button.ts +6 -1
- package/src/components/calendar/calendar.ts +6 -1
- package/src/components/card/card.ts +6 -1
- package/src/components/checkbox/checkbox.ts +6 -1
- package/src/components/combobox/combobox.ts +6 -1
- package/src/components/consent/consent.ts +6 -1
- package/src/components/datepicker/date-tags.ts +6 -1
- package/src/components/datepicker/datepicker-multiple.ts +6 -1
- package/src/components/datepicker/datepicker-popup.ts +6 -1
- package/src/components/datepicker/datepicker-range.ts +6 -1
- package/src/components/datepicker/datepicker-single.ts +6 -1
- package/src/components/datepicker/datepicker.ts +6 -1
- package/src/components/header/header-service.ts +6 -1
- package/src/components/header/header-user-menu.ts +6 -1
- package/src/components/header/header.ts +6 -1
- package/src/components/heading/heading.ts +6 -1
- package/src/components/helptext/helptext.ts +6 -1
- package/src/components/icon/icon.ts +6 -1
- package/src/components/input-wrapper/input-wrapper.ts +6 -1
- package/src/components/link/link.ts +6 -1
- package/src/components/linkcard/linkcard.ts +6 -1
- package/src/components/listbox/listbox.ts +6 -1
- package/src/components/loader/loader.ts +6 -1
- package/src/components/messagebox/messagebox.ts +6 -1
- package/src/components/modal/modal.ts +6 -1
- package/src/components/progressbar/progressbar.ts +6 -1
- package/src/components/radiobutton/radiobutton.ts +6 -1
- package/src/components/select/select.ts +6 -1
- package/src/components/tabs/tabitem.ts +6 -1
- package/src/components/tabs/tabs.ts +6 -1
- package/src/components/tag/tag.ts +6 -1
- package/src/components/textarea/textarea.ts +6 -1
- package/src/components/textinput/textinput.ts +6 -1
- package/src/components/timepicker/timepicker.ts +6 -1
- package/dist/accordionitem-D1Agl1bB.cjs +0 -34
- package/dist/alert-DFkFNTxh.cjs +0 -33
- package/dist/backlink-EiAXUUZP.cjs +0 -13
- package/dist/backlink-V4DAt17e.js +0 -47
- package/dist/button-DYv5Dg4M.cjs +0 -27
- package/dist/calendar-HIE9nxcc.cjs +0 -90
- package/dist/card-CyeH6l1c.cjs +0 -87
- package/dist/checkbox-BLlwTABj.cjs +0 -31
- package/dist/checkbox-ejBUa5qQ.js +0 -145
- package/dist/consent-ruWAEVXW.cjs +0 -11
- package/dist/datepicker-D2H7U6MS.cjs +0 -273
- package/dist/heading-Cvz8m1xL.cjs +0 -1
- package/dist/helptext-5Mzp65-F.cjs +0 -24
- package/dist/helptext-jIoWRcCF.js +0 -80
- package/dist/icon-BlKA8YuW.js +0 -103
- package/dist/icon-Bqj9oBbl.cjs +0 -9
- package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
- package/dist/input-wrapper-B2JpK016.js +0 -179
- package/dist/link-R_lNhViF.cjs +0 -7
- package/dist/link-Z_GizclR.js +0 -53
- package/dist/linkcard-BlQvdB1a.js +0 -54
- package/dist/linkcard-C7HbSLlX.cjs +0 -13
- package/dist/listbox-CGgV9MAe.cjs +0 -106
- package/dist/loader-e2gs_1xz.cjs +0 -16
- package/dist/messagebox-Bf-XMlvW.js +0 -69
- package/dist/messagebox-D67w71VX.cjs +0 -13
- package/dist/modal-CyvEkbfQ.cjs +0 -36
- package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
- package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
- package/dist/select-CXZt1nHS.js +0 -228
- package/dist/select-WFhS4Vfp.cjs +0 -49
- package/dist/tabitem-CB8wkKmv.js +0 -332
- package/dist/tabitem-DZpspU4Q.cjs +0 -65
- package/dist/tag-X6xdjR0N.cjs +0 -27
- package/dist/textarea-DoeHJ7HR.cjs +0 -50
- package/dist/textinput-BNsLd26i.cjs +0 -70
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { P as L, A as
|
|
2
|
-
import { r as
|
|
3
|
-
import { s as
|
|
1
|
+
import { t as w, P as L, A as T, b as h, n as r } from "./element-CPpT3rFQ.js";
|
|
2
|
+
import { r as q } from "./state-C_1EOo3D.js";
|
|
3
|
+
import { s as z, f as U, a as Q, i as X, n as C, b as F, c as H, v as E, d as Y, p as Z, e as W } from "./calendar-DhjQDC4C.js";
|
|
4
4
|
import { P as ee } from "./input-element-8nLwuQS4.js";
|
|
5
5
|
import { e as m, n as v } from "./ref-Bg_Swj5w.js";
|
|
6
|
-
import "./icon-
|
|
7
|
-
import "./input-wrapper-
|
|
8
|
-
import { e as
|
|
6
|
+
import "./icon-CxQcIa5F.js";
|
|
7
|
+
import "./input-wrapper-Bs4CRNst.js";
|
|
8
|
+
import { e as b } from "./class-map-CEnykyO_.js";
|
|
9
9
|
import { c as te } from "./repeat-BD8TKgJb.js";
|
|
10
|
-
import "./tag-
|
|
10
|
+
import "./tag-D4FI5t3y.js";
|
|
11
11
|
import { u as se, s as ie } from "./utils-DznhwRXm.js";
|
|
12
12
|
import { o as f } from "./if-defined-B0krMLad.js";
|
|
13
13
|
import { s as ae } from "./element-with-slot-Dqk6-TRR.js";
|
|
14
|
-
const
|
|
14
|
+
const G = {
|
|
15
15
|
calendar: { buttonAltText: "Åpne kalender" }
|
|
16
16
|
}, ne = {
|
|
17
17
|
calendar: { buttonAltText: "Åpne kalender" },
|
|
18
18
|
generic: { from: "Fra", to: "Til" }
|
|
19
19
|
};
|
|
20
|
-
var le = Object.defineProperty,
|
|
21
|
-
for (var
|
|
22
|
-
(
|
|
23
|
-
return
|
|
20
|
+
var le = Object.defineProperty, P = (i, e, t, a) => {
|
|
21
|
+
for (var s = void 0, l = i.length - 1, n; l >= 0; l--)
|
|
22
|
+
(n = i[l]) && (s = n(e, t, s) || s);
|
|
23
|
+
return s && le(e, t, s), s;
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
class R extends L {
|
|
26
26
|
constructor() {
|
|
27
27
|
super(...arguments), this.dates = [], this.dateformat = "dd.MM.yyyy", this.className = "pkt-datepicker__tags", this.idBase = se();
|
|
28
28
|
}
|
|
@@ -31,9 +31,9 @@ let w = class extends L {
|
|
|
31
31
|
"pkt-date-tags": !0,
|
|
32
32
|
[this.className]: !0
|
|
33
33
|
}, h`
|
|
34
|
-
<div class=${
|
|
34
|
+
<div class=${b(this.classes)} aria-live="polite">
|
|
35
35
|
${Array.isArray(this.dates) && this.dates[0] ? te(
|
|
36
|
-
|
|
36
|
+
z((this.dates ?? []).filter(Boolean)),
|
|
37
37
|
(e) => e,
|
|
38
38
|
(e) => {
|
|
39
39
|
var t;
|
|
@@ -43,137 +43,139 @@ let w = class extends L {
|
|
|
43
43
|
@close=${() => {
|
|
44
44
|
this.dispatchEvent(new CustomEvent("date-tag-removed", { detail: e }));
|
|
45
45
|
}}
|
|
46
|
-
.ariaLabel=${`${(t = this.strings) == null ? void 0 : t.calendar.deleteDate} ${
|
|
46
|
+
.ariaLabel=${`${(t = this.strings) == null ? void 0 : t.calendar.deleteDate} ${U(e, this.dateformat)}`}
|
|
47
47
|
>
|
|
48
|
-
<time datetime=${e}>${
|
|
48
|
+
<time datetime=${e}>${U(e, this.dateformat)}</time>
|
|
49
49
|
</pkt-tag>`;
|
|
50
50
|
}
|
|
51
|
-
) :
|
|
51
|
+
) : T}
|
|
52
52
|
</div>
|
|
53
53
|
`;
|
|
54
54
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
55
|
+
}
|
|
56
|
+
P([
|
|
57
57
|
r({ type: Array })
|
|
58
|
-
],
|
|
59
|
-
|
|
58
|
+
], R.prototype, "dates");
|
|
59
|
+
P([
|
|
60
60
|
r({ type: String })
|
|
61
|
-
],
|
|
62
|
-
|
|
61
|
+
], R.prototype, "dateformat");
|
|
62
|
+
P([
|
|
63
63
|
r({ type: String, attribute: "class" })
|
|
64
|
-
],
|
|
65
|
-
|
|
64
|
+
], R.prototype, "className");
|
|
65
|
+
P([
|
|
66
66
|
r({ type: String, attribute: "id-base" })
|
|
67
|
-
],
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
], R.prototype, "idBase");
|
|
68
|
+
try {
|
|
69
|
+
w("pkt-date-tags")(R);
|
|
70
|
+
} catch {
|
|
71
|
+
console.warn("Forsøker å definere <pkt-date-tags>, men den er allerede definert");
|
|
72
|
+
}
|
|
73
|
+
const re = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }, withcontrols: { default: !1 }, multiple: { default: !1 }, range: { default: !1 } }, x = {
|
|
74
|
+
props: re
|
|
75
|
+
}, k = () => {
|
|
76
|
+
const i = navigator.userAgent;
|
|
77
|
+
return !!(/iP(hone|od|ad)/.test(i) || /Macintosh/.test(i) && "ontouchend" in document);
|
|
78
|
+
}, oe = () => k() ? "text" : "date", ue = (i) => !i || i.length !== 2 ? !0 : X(i[0], i[1]), pe = (i) => z(i), he = (i, e, t, a, s) => Q(i, e, t, a, s), de = (i, e, t, a, s, l) => ({
|
|
77
79
|
"pkt-input": !0,
|
|
78
80
|
"pkt-datepicker__input": !0,
|
|
79
|
-
"pkt-input--fullwidth":
|
|
80
|
-
"pkt-datepicker--hasrangelabels":
|
|
81
|
-
"pkt-datepicker--multiple":
|
|
82
|
-
"pkt-datepicker--range":
|
|
83
|
-
"ios-readonly-hack":
|
|
84
|
-
}),
|
|
81
|
+
"pkt-input--fullwidth": i,
|
|
82
|
+
"pkt-datepicker--hasrangelabels": e,
|
|
83
|
+
"pkt-datepicker--multiple": t,
|
|
84
|
+
"pkt-datepicker--range": a,
|
|
85
|
+
"ios-readonly-hack": s === !1 && l === "text"
|
|
86
|
+
}), ce = () => ({
|
|
85
87
|
"pkt-input-icon": !0,
|
|
86
88
|
"pkt-btn": !0,
|
|
87
89
|
"pkt-btn--icon-only": !0,
|
|
88
90
|
"pkt-btn--tertiary": !0,
|
|
89
91
|
"pkt-datepicker__calendar-button": !0
|
|
90
|
-
}),
|
|
91
|
-
"pkt-input-prefix":
|
|
92
|
-
"pkt-hide": !
|
|
93
|
-
}),
|
|
92
|
+
}), fe = (i) => ({
|
|
93
|
+
"pkt-input-prefix": i,
|
|
94
|
+
"pkt-hide": !i
|
|
95
|
+
}), ge = (i, e, t) => !e && !t ? Array.isArray(i) ? i[0] || "" : i : Array.isArray(i) ? i.join(",") : i, me = (i, e, t = !1) => {
|
|
94
96
|
var o;
|
|
95
|
-
if (!
|
|
96
|
-
const
|
|
97
|
-
let
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
const { key:
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
const { key:
|
|
104
|
-
(
|
|
105
|
-
},
|
|
106
|
-
validateRangeOrder:
|
|
107
|
-
sortDates:
|
|
108
|
-
filterSelectableDates:
|
|
109
|
-
},
|
|
110
|
-
getInputType:
|
|
111
|
-
},
|
|
112
|
-
submitForm(
|
|
113
|
-
var
|
|
114
|
-
const
|
|
115
|
-
|
|
97
|
+
if (!i || !e) return;
|
|
98
|
+
const a = ((o = e.parentElement) == null ? void 0 : o.getBoundingClientRect()) || e.getBoundingClientRect(), s = t ? a.height + 30 : a.height, l = i.getBoundingClientRect().height;
|
|
99
|
+
let n = t ? "calc(100% - 30px)" : "100%";
|
|
100
|
+
a && a.top + l > window.innerHeight && a.top - l > 0 && (n = `calc(100% - ${s}px - ${l}px)`), i.style.top = n;
|
|
101
|
+
}, ve = (i, e, t, a, s, l) => {
|
|
102
|
+
const { key: n } = i;
|
|
103
|
+
n === "," && (i.preventDefault(), l ? l(i) : s && s()), (n === "Space" || n === " ") && (i.preventDefault(), e(i)), n === "Enter" && (i.preventDefault(), t ? t() : a ? a() : s && s());
|
|
104
|
+
}, ye = (i, e) => {
|
|
105
|
+
const { key: t } = i;
|
|
106
|
+
(t === "Enter" || t === " " || t === "Space") && (i.preventDefault(), e(i));
|
|
107
|
+
}, N = {
|
|
108
|
+
validateRangeOrder: ue,
|
|
109
|
+
sortDates: pe,
|
|
110
|
+
filterSelectableDates: he
|
|
111
|
+
}, $e = {
|
|
112
|
+
getInputType: oe
|
|
113
|
+
}, _ = {
|
|
114
|
+
submitForm(i) {
|
|
115
|
+
var t;
|
|
116
|
+
const e = (t = i.internals) == null ? void 0 : t.form;
|
|
117
|
+
e && e.requestSubmit();
|
|
116
118
|
},
|
|
117
|
-
submitFormOrFallback(
|
|
118
|
-
const
|
|
119
|
-
|
|
119
|
+
submitFormOrFallback(i, e) {
|
|
120
|
+
const t = i == null ? void 0 : i.form;
|
|
121
|
+
t ? t.requestSubmit() : e();
|
|
120
122
|
},
|
|
121
|
-
validateDateInput(e, t,
|
|
122
|
-
var
|
|
123
|
-
const
|
|
124
|
-
|
|
123
|
+
validateDateInput(i, e, t, a, s) {
|
|
124
|
+
var n, o, $, K;
|
|
125
|
+
const l = i.value;
|
|
126
|
+
l && (t && t > l ? e.setValidity(
|
|
125
127
|
{ rangeUnderflow: !0 },
|
|
126
|
-
((o = (
|
|
127
|
-
|
|
128
|
-
) :
|
|
128
|
+
((o = (n = s == null ? void 0 : s.forms) == null ? void 0 : n.messages) == null ? void 0 : o.rangeUnderflow) || "Value is below minimum",
|
|
129
|
+
i
|
|
130
|
+
) : a && a < l && e.setValidity(
|
|
129
131
|
{ rangeOverflow: !0 },
|
|
130
|
-
((
|
|
131
|
-
|
|
132
|
+
((K = ($ = s == null ? void 0 : s.forms) == null ? void 0 : $.messages) == null ? void 0 : K.rangeOverflow) || "Value is above maximum",
|
|
133
|
+
i
|
|
132
134
|
));
|
|
133
135
|
}
|
|
134
|
-
},
|
|
135
|
-
addToSelected(e, t,
|
|
136
|
-
const
|
|
137
|
-
if (!
|
|
138
|
-
const
|
|
139
|
-
o && !isNaN(o.getTime()) && (!
|
|
136
|
+
}, S = {
|
|
137
|
+
addToSelected(i, e, t, a) {
|
|
138
|
+
const s = i.target;
|
|
139
|
+
if (!s.value) return;
|
|
140
|
+
const l = t ? C(t) : null, n = a ? C(a) : null, o = C(s.value.split(",")[0]);
|
|
141
|
+
o && !isNaN(o.getTime()) && (!l || o >= l) && (!n || o <= n) && e.value && e.value.handleDateSelect(o), s.value = "";
|
|
140
142
|
},
|
|
141
|
-
handleCalendarPosition(e, t
|
|
142
|
-
|
|
143
|
+
handleCalendarPosition(i, e, t = !1) {
|
|
144
|
+
me(i.value ?? null, e.value ?? null, t);
|
|
143
145
|
}
|
|
144
146
|
}, V = {
|
|
145
|
-
getInputClasses:
|
|
146
|
-
getButtonClasses:
|
|
147
|
-
getRangeLabelClasses:
|
|
148
|
-
},
|
|
149
|
-
processDateSelection:
|
|
150
|
-
updateInputValues(e, t,
|
|
151
|
-
|
|
147
|
+
getInputClasses: de,
|
|
148
|
+
getButtonClasses: ce,
|
|
149
|
+
getRangeLabelClasses: fe
|
|
150
|
+
}, A = {
|
|
151
|
+
processDateSelection: ge,
|
|
152
|
+
updateInputValues(i, e, t, a, s, l) {
|
|
153
|
+
i.value && (a && (e != null && e.value) ? (i.value.value = t[0] ?? "", e.value.value = t[1] ?? "", l(i.value), l(e.value)) : s || (i.value.value = t.length ? t[0] : "", l(i.value)));
|
|
152
154
|
},
|
|
153
|
-
processRangeBlur(e, t,
|
|
154
|
-
var
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
const o =
|
|
159
|
-
o && ((
|
|
160
|
-
} else
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
handleInputKeydown:
|
|
164
|
-
handleButtonKeydown:
|
|
155
|
+
processRangeBlur(i, e, t, a, s) {
|
|
156
|
+
var n;
|
|
157
|
+
const l = i.target;
|
|
158
|
+
if (l.value) {
|
|
159
|
+
s(l);
|
|
160
|
+
const o = F(l.value);
|
|
161
|
+
o && ((n = t == null ? void 0 : t.value) == null || n.handleDateSelect(o));
|
|
162
|
+
} else e[0] && a();
|
|
163
|
+
}
|
|
164
|
+
}, I = {
|
|
165
|
+
handleInputKeydown: ve,
|
|
166
|
+
handleButtonKeydown: ye
|
|
165
167
|
};
|
|
166
|
-
var
|
|
167
|
-
for (var
|
|
168
|
-
(
|
|
169
|
-
return
|
|
168
|
+
var be = Object.defineProperty, c = (i, e, t, a) => {
|
|
169
|
+
for (var s = void 0, l = i.length - 1, n; l >= 0; l--)
|
|
170
|
+
(n = i[l]) && (s = n(e, t, s) || s);
|
|
171
|
+
return s && be(e, t, s), s;
|
|
170
172
|
};
|
|
171
|
-
|
|
173
|
+
class d extends L {
|
|
172
174
|
constructor() {
|
|
173
175
|
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.today = null, this._hasBeenOpened = !1, this.popupRef = m(), this.calendarRef = m(), this.handleDocumentClick = (e) => {
|
|
174
176
|
if (!this.open) return;
|
|
175
|
-
const t = e.composedPath(),
|
|
176
|
-
!t.includes(this) && !t.includes(
|
|
177
|
+
const t = e.composedPath(), a = this.parentElement, s = this.popupRef.value;
|
|
178
|
+
!t.includes(this) && !t.includes(s) && !(a && t.includes(a)) && (this.hide(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 })));
|
|
177
179
|
}, this.handleDocumentKeydown = (e) => {
|
|
178
180
|
this.open && e.key === "Escape" && (this.hide(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 })));
|
|
179
181
|
};
|
|
@@ -205,27 +207,27 @@ let d = class extends L {
|
|
|
205
207
|
const e = this.calendarRef.value;
|
|
206
208
|
e && typeof e.focusOnCurrentDate == "function" && e.focusOnCurrentDate();
|
|
207
209
|
}
|
|
208
|
-
addToSelected(e, t,
|
|
209
|
-
if (this.calendarRef.value && typeof
|
|
210
|
-
return
|
|
211
|
-
const
|
|
212
|
-
if (!
|
|
213
|
-
const
|
|
214
|
-
|
|
210
|
+
addToSelected(e, t, a) {
|
|
211
|
+
if (this.calendarRef.value && typeof S.addToSelected == "function")
|
|
212
|
+
return S.addToSelected(e, this.calendarRef, t, a);
|
|
213
|
+
const l = e.target;
|
|
214
|
+
if (!l.value) return;
|
|
215
|
+
const n = t ? C(t) : null, o = a ? C(a) : null, $ = C(l.value.split(",")[0]);
|
|
216
|
+
$ && !isNaN($.getTime()) && (!n || $ >= n) && (!o || $ <= o) && this.handleDateSelect($), l.value = "";
|
|
215
217
|
}
|
|
216
218
|
handleDateSelect(e) {
|
|
217
219
|
const t = this.calendarRef.value;
|
|
218
220
|
if (t && typeof t.handleDateSelect == "function") return t.handleDateSelect(e);
|
|
219
|
-
const
|
|
220
|
-
this.selected =
|
|
221
|
-
new CustomEvent("date-selected", { detail:
|
|
221
|
+
const a = H(e), l = this.selected.indexOf(a) >= 0 ? this.selected.filter((n) => n !== a) : [...this.selected, a];
|
|
222
|
+
this.selected = l, this.dispatchEvent(
|
|
223
|
+
new CustomEvent("date-selected", { detail: l, bubbles: !0, composed: !0 })
|
|
222
224
|
);
|
|
223
225
|
}
|
|
224
226
|
render() {
|
|
225
227
|
const e = { "pkt-calendar-popup": !0, show: this.open, hide: !this.open };
|
|
226
228
|
return h`
|
|
227
229
|
<div
|
|
228
|
-
class="${
|
|
230
|
+
class="${b(e)}"
|
|
229
231
|
${v(this.popupRef)}
|
|
230
232
|
id="date-popup"
|
|
231
233
|
?hidden=${!this.open}
|
|
@@ -253,60 +255,62 @@ let d = class extends L {
|
|
|
253
255
|
@close=${() => {
|
|
254
256
|
this.hide(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 }));
|
|
255
257
|
}}
|
|
256
|
-
></pkt-calendar>` :
|
|
258
|
+
></pkt-calendar>` : T}
|
|
257
259
|
</div>
|
|
258
260
|
`;
|
|
259
261
|
}
|
|
260
|
-
}
|
|
262
|
+
}
|
|
261
263
|
c([
|
|
262
264
|
r({ type: Boolean, reflect: !0 })
|
|
263
|
-
], d.prototype, "open"
|
|
265
|
+
], d.prototype, "open");
|
|
264
266
|
c([
|
|
265
267
|
r({ type: Boolean })
|
|
266
|
-
], d.prototype, "multiple"
|
|
268
|
+
], d.prototype, "multiple");
|
|
267
269
|
c([
|
|
268
270
|
r({ type: Boolean })
|
|
269
|
-
], d.prototype, "range"
|
|
271
|
+
], d.prototype, "range");
|
|
270
272
|
c([
|
|
271
273
|
r({ type: Boolean })
|
|
272
|
-
], d.prototype, "weeknumbers"
|
|
274
|
+
], d.prototype, "weeknumbers");
|
|
273
275
|
c([
|
|
274
276
|
r({ type: Boolean })
|
|
275
|
-
], d.prototype, "withcontrols"
|
|
277
|
+
], d.prototype, "withcontrols");
|
|
276
278
|
c([
|
|
277
279
|
r({ type: Number })
|
|
278
|
-
], d.prototype, "maxMultiple"
|
|
280
|
+
], d.prototype, "maxMultiple");
|
|
279
281
|
c([
|
|
280
282
|
r({ type: Array })
|
|
281
|
-
], d.prototype, "selected"
|
|
283
|
+
], d.prototype, "selected");
|
|
282
284
|
c([
|
|
283
285
|
r({ type: String })
|
|
284
|
-
], d.prototype, "earliest"
|
|
286
|
+
], d.prototype, "earliest");
|
|
285
287
|
c([
|
|
286
288
|
r({ type: String })
|
|
287
|
-
], d.prototype, "latest"
|
|
289
|
+
], d.prototype, "latest");
|
|
288
290
|
c([
|
|
289
291
|
r({ type: Array })
|
|
290
|
-
], d.prototype, "excludedates"
|
|
292
|
+
], d.prototype, "excludedates");
|
|
291
293
|
c([
|
|
292
294
|
r({ type: Array })
|
|
293
|
-
], d.prototype, "excludeweekdays"
|
|
295
|
+
], d.prototype, "excludeweekdays");
|
|
294
296
|
c([
|
|
295
297
|
r({ type: String })
|
|
296
|
-
], d.prototype, "currentmonth"
|
|
298
|
+
], d.prototype, "currentmonth");
|
|
297
299
|
c([
|
|
298
300
|
r({ type: String })
|
|
299
|
-
], d.prototype, "today"
|
|
301
|
+
], d.prototype, "today");
|
|
300
302
|
c([
|
|
301
|
-
|
|
302
|
-
], d.prototype, "_hasBeenOpened"
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
303
|
+
q()
|
|
304
|
+
], d.prototype, "_hasBeenOpened");
|
|
305
|
+
try {
|
|
306
|
+
w("pkt-datepicker-popup")(d);
|
|
307
|
+
} catch {
|
|
308
|
+
console.warn("Forsøker å definere <pkt-datepicker-popup>, men den er allerede definert");
|
|
309
|
+
}
|
|
310
|
+
var ke = Object.defineProperty, y = (i, e, t, a) => {
|
|
311
|
+
for (var s = void 0, l = i.length - 1, n; l >= 0; l--)
|
|
312
|
+
(n = i[l]) && (s = n(e, t, s) || s);
|
|
313
|
+
return s && ke(e, t, s), s;
|
|
310
314
|
};
|
|
311
315
|
class g extends L {
|
|
312
316
|
constructor() {
|
|
@@ -323,19 +327,19 @@ class g extends L {
|
|
|
323
327
|
return this.readonly || this.inputType === "text";
|
|
324
328
|
}
|
|
325
329
|
// Shared event dispatchers (protected so subclasses can use them)
|
|
326
|
-
dispatchToggleCalendar(
|
|
330
|
+
dispatchToggleCalendar(e) {
|
|
327
331
|
this.readonly || this.dispatchEvent(
|
|
328
332
|
new CustomEvent("toggle-calendar", {
|
|
329
|
-
detail:
|
|
333
|
+
detail: e,
|
|
330
334
|
bubbles: !0,
|
|
331
335
|
composed: !0
|
|
332
336
|
})
|
|
333
337
|
);
|
|
334
338
|
}
|
|
335
|
-
dispatchInput(
|
|
339
|
+
dispatchInput(e) {
|
|
336
340
|
this.dispatchEvent(
|
|
337
341
|
new CustomEvent("input-change", {
|
|
338
|
-
detail:
|
|
342
|
+
detail: e,
|
|
339
343
|
bubbles: !0,
|
|
340
344
|
composed: !0
|
|
341
345
|
})
|
|
@@ -349,19 +353,19 @@ class g extends L {
|
|
|
349
353
|
})
|
|
350
354
|
);
|
|
351
355
|
}
|
|
352
|
-
dispatchBlur(
|
|
356
|
+
dispatchBlur(e) {
|
|
353
357
|
this.dispatchEvent(
|
|
354
358
|
new CustomEvent("input-blur", {
|
|
355
|
-
detail:
|
|
359
|
+
detail: e,
|
|
356
360
|
bubbles: !0,
|
|
357
361
|
composed: !0
|
|
358
362
|
})
|
|
359
363
|
);
|
|
360
364
|
}
|
|
361
|
-
dispatchChange(
|
|
365
|
+
dispatchChange(e) {
|
|
362
366
|
this.dispatchEvent(
|
|
363
367
|
new CustomEvent("input-changed", {
|
|
364
|
-
detail:
|
|
368
|
+
detail: e,
|
|
365
369
|
bubbles: !0,
|
|
366
370
|
composed: !0
|
|
367
371
|
})
|
|
@@ -369,21 +373,21 @@ class g extends L {
|
|
|
369
373
|
}
|
|
370
374
|
// Shared render helper for calendar button
|
|
371
375
|
renderCalendarButton() {
|
|
372
|
-
var
|
|
376
|
+
var e;
|
|
373
377
|
return h`
|
|
374
378
|
<button
|
|
375
|
-
class="${
|
|
379
|
+
class="${b(V.getButtonClasses())}"
|
|
376
380
|
type="button"
|
|
377
|
-
@click=${(
|
|
378
|
-
@keydown=${(
|
|
379
|
-
const { key:
|
|
380
|
-
(
|
|
381
|
+
@click=${(t) => this.dispatchToggleCalendar(t)}
|
|
382
|
+
@keydown=${(t) => {
|
|
383
|
+
const { key: a } = t;
|
|
384
|
+
(a === "Enter" || a === " " || a === "Space") && (t.preventDefault(), this.dispatchToggleCalendar(t));
|
|
381
385
|
}}
|
|
382
386
|
?disabled=${this.disabled}
|
|
383
387
|
${this.btnRef}
|
|
384
388
|
>
|
|
385
389
|
<pkt-icon name="calendar"></pkt-icon>
|
|
386
|
-
<span class="pkt-btn__text">${((
|
|
390
|
+
<span class="pkt-btn__text">${((e = this.strings.calendar) == null ? void 0 : e.buttonAltText) || "Åpne kalender"}</span>
|
|
387
391
|
</button>
|
|
388
392
|
`;
|
|
389
393
|
}
|
|
@@ -419,14 +423,14 @@ y([
|
|
|
419
423
|
y([
|
|
420
424
|
r({ type: Object })
|
|
421
425
|
], g.prototype, "internals");
|
|
422
|
-
var
|
|
423
|
-
for (var
|
|
424
|
-
(
|
|
425
|
-
return
|
|
426
|
+
var Ce = Object.defineProperty, J = (i, e, t, a) => {
|
|
427
|
+
for (var s = void 0, l = i.length - 1, n; l >= 0; l--)
|
|
428
|
+
(n = i[l]) && (s = n(e, t, s) || s);
|
|
429
|
+
return s && Ce(e, t, s), s;
|
|
426
430
|
};
|
|
427
|
-
|
|
431
|
+
class j extends g {
|
|
428
432
|
constructor() {
|
|
429
|
-
super(...arguments), this.value = "", this.strings =
|
|
433
|
+
super(...arguments), this.value = "", this.strings = G;
|
|
430
434
|
}
|
|
431
435
|
dispatchManageValidity(e) {
|
|
432
436
|
this.dispatchEvent(
|
|
@@ -441,7 +445,7 @@ let B = class extends g {
|
|
|
441
445
|
return h`
|
|
442
446
|
<div class="pkt-input__container">
|
|
443
447
|
<input
|
|
444
|
-
class="${
|
|
448
|
+
class="${b(this.inputClasses)}"
|
|
445
449
|
.type=${this.inputType}
|
|
446
450
|
id="${this.id}-input"
|
|
447
451
|
.value=${this.value}
|
|
@@ -457,10 +461,10 @@ let B = class extends g {
|
|
|
457
461
|
e.preventDefault(), this.dispatchToggleCalendar(e);
|
|
458
462
|
}}
|
|
459
463
|
?disabled=${this.disabled}
|
|
460
|
-
@keydown=${(e) =>
|
|
464
|
+
@keydown=${(e) => I.handleInputKeydown(
|
|
461
465
|
e,
|
|
462
466
|
(t) => this.dispatchToggleCalendar(t),
|
|
463
|
-
() =>
|
|
467
|
+
() => _.submitFormOrFallback(this.internals, () => {
|
|
464
468
|
var t;
|
|
465
469
|
return (t = this.inputRef.value) == null ? void 0 : t.blur();
|
|
466
470
|
}),
|
|
@@ -474,7 +478,7 @@ let B = class extends g {
|
|
|
474
478
|
this.dispatchInput(e), e.stopImmediatePropagation();
|
|
475
479
|
}}
|
|
476
480
|
@focus=${() => {
|
|
477
|
-
this.dispatchFocus(),
|
|
481
|
+
this.dispatchFocus(), k() && this.dispatchToggleCalendar(new Event("focus"));
|
|
478
482
|
}}
|
|
479
483
|
@blur=${(e) => {
|
|
480
484
|
this.dispatchBlur(e), this.dispatchManageValidity(e.target), this.dispatchEvent(
|
|
@@ -494,22 +498,24 @@ let B = class extends g {
|
|
|
494
498
|
</div>
|
|
495
499
|
`;
|
|
496
500
|
}
|
|
497
|
-
}
|
|
498
|
-
|
|
501
|
+
}
|
|
502
|
+
J([
|
|
499
503
|
r({ type: String })
|
|
500
|
-
],
|
|
501
|
-
|
|
504
|
+
], j.prototype, "value");
|
|
505
|
+
J([
|
|
502
506
|
r({ type: Object })
|
|
503
|
-
],
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
507
|
+
], j.prototype, "strings");
|
|
508
|
+
try {
|
|
509
|
+
w("pkt-datepicker-single")(j);
|
|
510
|
+
} catch {
|
|
511
|
+
console.warn("Forsøker å definere <pkt-datepicker-single>, men den er allerede definert");
|
|
512
|
+
}
|
|
513
|
+
var we = Object.defineProperty, B = (i, e, t, a) => {
|
|
514
|
+
for (var s = void 0, l = i.length - 1, n; l >= 0; l--)
|
|
515
|
+
(n = i[l]) && (s = n(e, t, s) || s);
|
|
516
|
+
return s && we(e, t, s), s;
|
|
511
517
|
};
|
|
512
|
-
|
|
518
|
+
class D extends g {
|
|
513
519
|
constructor() {
|
|
514
520
|
super(...arguments), this.value = [], this.label = "", this.showRangeLabels = !1, this.strings = ne, this.inputRefTo = m();
|
|
515
521
|
}
|
|
@@ -517,58 +523,58 @@ let C = class extends g {
|
|
|
517
523
|
return this.inputRefTo.value;
|
|
518
524
|
}
|
|
519
525
|
render() {
|
|
520
|
-
var t,
|
|
526
|
+
var t, a, s, l;
|
|
521
527
|
const e = V.getRangeLabelClasses(this.showRangeLabels);
|
|
522
528
|
return h`
|
|
523
529
|
<div class="pkt-input__container">
|
|
524
|
-
${this.showRangeLabels ? h` <div class="pkt-input-prefix">${(t = this.strings.generic) == null ? void 0 : t.from}</div> ` :
|
|
530
|
+
${this.showRangeLabels ? h` <div class="pkt-input-prefix">${(t = this.strings.generic) == null ? void 0 : t.from}</div> ` : T}
|
|
525
531
|
<input
|
|
526
|
-
class=${
|
|
532
|
+
class=${b(this.inputClasses)}
|
|
527
533
|
.type=${this.inputType}
|
|
528
534
|
id="${this.id}-input"
|
|
529
|
-
aria-label="${this.label} ${((
|
|
535
|
+
aria-label="${this.label} ${((a = this.strings.generic) == null ? void 0 : a.from) ?? "Fra"}"
|
|
530
536
|
.value=${this.value[0] ?? ""}
|
|
531
537
|
min=${f(this.min)}
|
|
532
538
|
max=${f(this.max)}
|
|
533
539
|
placeholder=${f(this.placeholder)}
|
|
534
540
|
?readonly=${this.isInputReadonly}
|
|
535
541
|
?disabled=${this.disabled}
|
|
536
|
-
@click=${(
|
|
537
|
-
|
|
542
|
+
@click=${(n) => {
|
|
543
|
+
n.preventDefault(), this.dispatchToggleCalendar(n);
|
|
538
544
|
}}
|
|
539
|
-
@touchend=${(
|
|
540
|
-
|
|
545
|
+
@touchend=${(n) => {
|
|
546
|
+
n.preventDefault(), this.dispatchToggleCalendar(n);
|
|
541
547
|
}}
|
|
542
|
-
@keydown=${(
|
|
543
|
-
|
|
544
|
-
(
|
|
545
|
-
() =>
|
|
548
|
+
@keydown=${(n) => I.handleInputKeydown(
|
|
549
|
+
n,
|
|
550
|
+
(o) => this.dispatchToggleCalendar(o),
|
|
551
|
+
() => _.submitFormOrFallback(
|
|
546
552
|
this.internals,
|
|
547
553
|
() => {
|
|
548
|
-
var
|
|
549
|
-
return (
|
|
554
|
+
var o;
|
|
555
|
+
return (o = this.inputRefTo.value) == null ? void 0 : o.focus();
|
|
550
556
|
}
|
|
551
557
|
),
|
|
552
558
|
() => {
|
|
553
|
-
var
|
|
554
|
-
return (
|
|
559
|
+
var o;
|
|
560
|
+
return (o = this.inputRefTo.value) == null ? void 0 : o.focus();
|
|
555
561
|
},
|
|
556
562
|
() => {
|
|
557
|
-
var
|
|
558
|
-
return (
|
|
563
|
+
var o;
|
|
564
|
+
return (o = this.inputRef.value) == null ? void 0 : o.blur();
|
|
559
565
|
}
|
|
560
566
|
)}
|
|
561
|
-
@input=${(
|
|
562
|
-
this.dispatchInput(
|
|
567
|
+
@input=${(n) => {
|
|
568
|
+
this.dispatchInput(n), n.stopImmediatePropagation();
|
|
563
569
|
}}
|
|
564
570
|
@focus=${() => {
|
|
565
|
-
this.dispatchFocus(),
|
|
571
|
+
this.dispatchFocus(), k() && this.dispatchToggleCalendar(new Event("focus"));
|
|
566
572
|
}}
|
|
567
|
-
@blur=${(
|
|
568
|
-
this.dispatchBlur(
|
|
573
|
+
@blur=${(n) => {
|
|
574
|
+
this.dispatchBlur(n), this.dispatchEvent(
|
|
569
575
|
new CustomEvent("range-blur", {
|
|
570
576
|
detail: {
|
|
571
|
-
event:
|
|
577
|
+
event: n,
|
|
572
578
|
values: this.value,
|
|
573
579
|
inputType: "from"
|
|
574
580
|
},
|
|
@@ -577,56 +583,56 @@ let C = class extends g {
|
|
|
577
583
|
})
|
|
578
584
|
);
|
|
579
585
|
}}
|
|
580
|
-
@change=${(
|
|
581
|
-
this.dispatchChange(
|
|
586
|
+
@change=${(n) => {
|
|
587
|
+
this.dispatchChange(n), n.stopImmediatePropagation();
|
|
582
588
|
}}
|
|
583
589
|
${v(this.inputRef)}
|
|
584
590
|
/>
|
|
585
|
-
<div class="${
|
|
586
|
-
${(
|
|
591
|
+
<div class="${b(e)}" id="${this.id}-to-label">
|
|
592
|
+
${(s = this.strings.generic) == null ? void 0 : s.to}
|
|
587
593
|
</div>
|
|
588
|
-
${this.showRangeLabels ?
|
|
594
|
+
${this.showRangeLabels ? T : h` <div class="pkt-input-separator">–</div> `}
|
|
589
595
|
<input
|
|
590
|
-
class=${
|
|
596
|
+
class=${b(this.inputClasses)}
|
|
591
597
|
.type=${this.inputType}
|
|
592
598
|
id="${this.id}-to"
|
|
593
|
-
aria-label="${this.label} ${((
|
|
599
|
+
aria-label="${this.label} ${((l = this.strings.generic) == null ? void 0 : l.to) ?? "Til"}"
|
|
594
600
|
.value=${this.value[1] ?? ""}
|
|
595
601
|
min=${f(this.min)}
|
|
596
602
|
max=${f(this.max)}
|
|
597
603
|
placeholder=${f(this.placeholder)}
|
|
598
604
|
?readonly=${this.isInputReadonly}
|
|
599
605
|
?disabled=${this.disabled}
|
|
600
|
-
@click=${(
|
|
601
|
-
|
|
606
|
+
@click=${(n) => {
|
|
607
|
+
n.preventDefault(), this.dispatchToggleCalendar(n);
|
|
602
608
|
}}
|
|
603
|
-
@touchend=${(
|
|
604
|
-
|
|
609
|
+
@touchend=${(n) => {
|
|
610
|
+
n.preventDefault(), this.dispatchToggleCalendar(n);
|
|
605
611
|
}}
|
|
606
|
-
@keydown=${(
|
|
607
|
-
|
|
608
|
-
(
|
|
609
|
-
() =>
|
|
610
|
-
var
|
|
611
|
-
return (
|
|
612
|
+
@keydown=${(n) => I.handleInputKeydown(
|
|
613
|
+
n,
|
|
614
|
+
(o) => this.dispatchToggleCalendar(o),
|
|
615
|
+
() => _.submitFormOrFallback(this.internals, () => {
|
|
616
|
+
var o;
|
|
617
|
+
return (o = this.inputRefTo.value) == null ? void 0 : o.blur();
|
|
612
618
|
}),
|
|
613
619
|
void 0,
|
|
614
620
|
() => {
|
|
615
|
-
var
|
|
616
|
-
return (
|
|
621
|
+
var o;
|
|
622
|
+
return (o = this.inputRefTo.value) == null ? void 0 : o.blur();
|
|
617
623
|
}
|
|
618
624
|
)}
|
|
619
|
-
@input=${(
|
|
620
|
-
this.dispatchInput(
|
|
625
|
+
@input=${(n) => {
|
|
626
|
+
this.dispatchInput(n), n.stopImmediatePropagation();
|
|
621
627
|
}}
|
|
622
628
|
@focus=${() => {
|
|
623
|
-
this.dispatchFocus(),
|
|
629
|
+
this.dispatchFocus(), k() && this.dispatchToggleCalendar(new Event("focus"));
|
|
624
630
|
}}
|
|
625
|
-
@blur=${(
|
|
626
|
-
this.dispatchBlur(
|
|
631
|
+
@blur=${(n) => {
|
|
632
|
+
this.dispatchBlur(n), this.dispatchEvent(
|
|
627
633
|
new CustomEvent("range-blur", {
|
|
628
634
|
detail: {
|
|
629
|
-
event:
|
|
635
|
+
event: n,
|
|
630
636
|
values: this.value,
|
|
631
637
|
inputType: "to"
|
|
632
638
|
},
|
|
@@ -635,8 +641,8 @@ let C = class extends g {
|
|
|
635
641
|
})
|
|
636
642
|
);
|
|
637
643
|
}}
|
|
638
|
-
@change=${(
|
|
639
|
-
this.dispatchChange(
|
|
644
|
+
@change=${(n) => {
|
|
645
|
+
this.dispatchChange(n), n.stopImmediatePropagation();
|
|
640
646
|
}}
|
|
641
647
|
${v(this.inputRefTo)}
|
|
642
648
|
/>
|
|
@@ -644,30 +650,32 @@ let C = class extends g {
|
|
|
644
650
|
</div>
|
|
645
651
|
`;
|
|
646
652
|
}
|
|
647
|
-
}
|
|
648
|
-
|
|
653
|
+
}
|
|
654
|
+
B([
|
|
649
655
|
r({ type: Array })
|
|
650
|
-
],
|
|
651
|
-
|
|
656
|
+
], D.prototype, "value");
|
|
657
|
+
B([
|
|
652
658
|
r({ type: String })
|
|
653
|
-
],
|
|
654
|
-
|
|
659
|
+
], D.prototype, "label");
|
|
660
|
+
B([
|
|
655
661
|
r({ type: Boolean })
|
|
656
|
-
],
|
|
657
|
-
|
|
662
|
+
], D.prototype, "showRangeLabels");
|
|
663
|
+
B([
|
|
658
664
|
r({ type: Object })
|
|
659
|
-
],
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
665
|
+
], D.prototype, "strings");
|
|
666
|
+
try {
|
|
667
|
+
w("pkt-datepicker-range")(D);
|
|
668
|
+
} catch {
|
|
669
|
+
console.warn("Forsøker å definere <pkt-datepicker-range>, men den er allerede definert");
|
|
670
|
+
}
|
|
671
|
+
var xe = Object.defineProperty, M = (i, e, t, a) => {
|
|
672
|
+
for (var s = void 0, l = i.length - 1, n; l >= 0; l--)
|
|
673
|
+
(n = i[l]) && (s = n(e, t, s) || s);
|
|
674
|
+
return s && xe(e, t, s), s;
|
|
667
675
|
};
|
|
668
|
-
|
|
676
|
+
class O extends g {
|
|
669
677
|
constructor() {
|
|
670
|
-
super(...arguments), this.value = [], this.strings =
|
|
678
|
+
super(...arguments), this.value = [], this.strings = G;
|
|
671
679
|
}
|
|
672
680
|
get isInputDisabled() {
|
|
673
681
|
return this.disabled || this.maxlength !== void 0 && this.maxlength !== null && this.value.length >= this.maxlength;
|
|
@@ -685,7 +693,7 @@ let R = class extends g {
|
|
|
685
693
|
return h`
|
|
686
694
|
<div class="pkt-input__container">
|
|
687
695
|
<input
|
|
688
|
-
class=${
|
|
696
|
+
class=${b(this.inputClasses)}
|
|
689
697
|
.type=${this.inputType}
|
|
690
698
|
id="${this.id}-input"
|
|
691
699
|
min=${f(this.min)}
|
|
@@ -706,12 +714,12 @@ let R = class extends g {
|
|
|
706
714
|
this.dispatchInput(e), e.stopImmediatePropagation();
|
|
707
715
|
}}
|
|
708
716
|
@focus=${() => {
|
|
709
|
-
this.dispatchFocus(),
|
|
717
|
+
this.dispatchFocus(), k() && this.dispatchToggleCalendar(new Event("focus"));
|
|
710
718
|
}}
|
|
711
|
-
@keydown=${(e) =>
|
|
719
|
+
@keydown=${(e) => I.handleInputKeydown(
|
|
712
720
|
e,
|
|
713
721
|
(t) => this.dispatchToggleCalendar(t),
|
|
714
|
-
() =>
|
|
722
|
+
() => _.submitFormOrFallback(this.internals, () => {
|
|
715
723
|
var t;
|
|
716
724
|
return (t = this.inputRef.value) == null ? void 0 : t.blur();
|
|
717
725
|
}),
|
|
@@ -728,29 +736,31 @@ let R = class extends g {
|
|
|
728
736
|
</div>
|
|
729
737
|
`;
|
|
730
738
|
}
|
|
731
|
-
}
|
|
732
|
-
|
|
739
|
+
}
|
|
740
|
+
M([
|
|
733
741
|
r({ type: Array })
|
|
734
|
-
],
|
|
735
|
-
|
|
742
|
+
], O.prototype, "value");
|
|
743
|
+
M([
|
|
736
744
|
r({ type: Number })
|
|
737
|
-
],
|
|
738
|
-
|
|
745
|
+
], O.prototype, "maxlength");
|
|
746
|
+
M([
|
|
739
747
|
r({ type: Object })
|
|
740
|
-
],
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
+
], O.prototype, "strings");
|
|
749
|
+
try {
|
|
750
|
+
w("pkt-datepicker-multiple")(O);
|
|
751
|
+
} catch {
|
|
752
|
+
console.warn("Forsøker å definere <pkt-datepicker-multiple>, men den er allerede definert");
|
|
753
|
+
}
|
|
754
|
+
var Te = Object.defineProperty, _e = Object.getOwnPropertyDescriptor, p = (i, e, t, a) => {
|
|
755
|
+
for (var s = a > 1 ? void 0 : a ? _e(e, t) : e, l = i.length - 1, n; l >= 0; l--)
|
|
756
|
+
(n = i[l]) && (s = (a ? n(e, t, s) : n(s)) || s);
|
|
757
|
+
return a && s && Te(e, t, s), s;
|
|
748
758
|
};
|
|
749
|
-
|
|
759
|
+
class u extends ee {
|
|
750
760
|
constructor() {
|
|
751
|
-
super(...arguments), this._valueProperty = "", this._valueProcessing = !1, this.datepickerPopupRef = m(), this._value = [], this.label = "Datovelger", this.dateformat =
|
|
761
|
+
super(...arguments), this._valueProperty = "", this._valueProcessing = !1, this.datepickerPopupRef = m(), this._value = [], this.label = "Datovelger", this.dateformat = x.props.dateformat.default, this.multiple = x.props.multiple.default, this.maxlength = null, this.range = x.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = x.props.weeknumbers.default, this.withcontrols = x.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.today = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.calRef = m(), this.popupRef = m(), this.singleInputRef = m(), this.rangeInputRef = m(), this.multipleInputRef = m(), this.addToSelected = (e) => {
|
|
752
762
|
const t = this.datepickerPopupRef.value;
|
|
753
|
-
return t && typeof t.addToSelected == "function" ? t.addToSelected(e, this.min, this.max) :
|
|
763
|
+
return t && typeof t.addToSelected == "function" ? t.addToSelected(e, this.min, this.max) : S.addToSelected(e, this.calRef, this.min, this.max);
|
|
754
764
|
};
|
|
755
765
|
}
|
|
756
766
|
get value() {
|
|
@@ -764,7 +774,7 @@ let u = class extends ee {
|
|
|
764
774
|
* Computed properties
|
|
765
775
|
*/
|
|
766
776
|
get inputType() {
|
|
767
|
-
return
|
|
777
|
+
return $e.getInputType();
|
|
768
778
|
}
|
|
769
779
|
/**
|
|
770
780
|
* Housekeeping / lifecycle methods
|
|
@@ -782,35 +792,35 @@ let u = class extends ee {
|
|
|
782
792
|
if (!(this._valueProcessing || e === t)) {
|
|
783
793
|
this._valueProcessing = !0;
|
|
784
794
|
try {
|
|
785
|
-
const
|
|
786
|
-
|
|
795
|
+
const a = E(e), s = this.multiple && a.length > 1 ? N.filterSelectableDates(
|
|
796
|
+
a,
|
|
787
797
|
this.min,
|
|
788
798
|
this.max,
|
|
789
799
|
this.excludedates,
|
|
790
800
|
this.excludeweekdays
|
|
791
|
-
) :
|
|
792
|
-
if (this.range && !
|
|
801
|
+
) : a;
|
|
802
|
+
if (this.range && !N.validateRangeOrder(s)) {
|
|
793
803
|
this._value = [], this._valueProperty = "", super.valueChanged("", t);
|
|
794
804
|
return;
|
|
795
805
|
}
|
|
796
|
-
this._value =
|
|
797
|
-
const
|
|
798
|
-
if (this._valueProperty !==
|
|
799
|
-
super.valueChanged(
|
|
806
|
+
this._value = s;
|
|
807
|
+
const l = Y(s);
|
|
808
|
+
if (this._valueProperty !== l && (this._valueProperty = l), this.range && s.length < 2) return;
|
|
809
|
+
super.valueChanged(l, t);
|
|
800
810
|
} finally {
|
|
801
811
|
this._valueProcessing = !1;
|
|
802
812
|
}
|
|
803
813
|
}
|
|
804
814
|
}
|
|
805
|
-
attributeChangedCallback(e, t,
|
|
806
|
-
e === "value" && this.value !== t && this.valueChanged(
|
|
815
|
+
attributeChangedCallback(e, t, a) {
|
|
816
|
+
e === "value" && this.value !== t && this.valueChanged(a, t), e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = E(a || "")), e === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = E(a || "")), super.attributeChangedCallback(e, t, a);
|
|
807
817
|
}
|
|
808
818
|
updated(e) {
|
|
809
819
|
if (e.has("value") && (e.has("multiple") || e.has("range"))) {
|
|
810
|
-
const t = Array.isArray(this.value) ? this.value.join(",") : this.value,
|
|
811
|
-
this.valueChanged(t,
|
|
820
|
+
const t = Array.isArray(this.value) ? this.value.join(",") : this.value, a = e.get("value"), s = Array.isArray(a) ? a.join(",") : a;
|
|
821
|
+
this.valueChanged(t, s);
|
|
812
822
|
}
|
|
813
|
-
e.has("multiple") && (this.multiple && !Array.isArray(this._value) ? this._value =
|
|
823
|
+
e.has("multiple") && (this.multiple && !Array.isArray(this._value) ? this._value = E(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);
|
|
814
824
|
}
|
|
815
825
|
/**
|
|
816
826
|
* Element references
|
|
@@ -824,8 +834,8 @@ let u = class extends ee {
|
|
|
824
834
|
}
|
|
825
835
|
// Getters for backward compatibility with input refs
|
|
826
836
|
get currentInputElement() {
|
|
827
|
-
var e, t,
|
|
828
|
-
return this.multiple ? (e = this.multipleInputRef.value) == null ? void 0 : e.inputElement : this.range ? (t = this.rangeInputRef.value) == null ? void 0 : t.inputElement : (
|
|
837
|
+
var e, t, a;
|
|
838
|
+
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;
|
|
829
839
|
}
|
|
830
840
|
get currentInputElementTo() {
|
|
831
841
|
var e;
|
|
@@ -833,8 +843,8 @@ let u = class extends ee {
|
|
|
833
843
|
return (e = this.rangeInputRef.value) == null ? void 0 : e.inputElementTo;
|
|
834
844
|
}
|
|
835
845
|
get currentButtonElement() {
|
|
836
|
-
var e, t,
|
|
837
|
-
return this.multiple ? (e = this.multipleInputRef.value) == null ? void 0 : e.buttonElement : this.range ? (t = this.rangeInputRef.value) == null ? void 0 : t.buttonElement : (
|
|
846
|
+
var e, t, a;
|
|
847
|
+
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;
|
|
838
848
|
}
|
|
839
849
|
// Override btnRef for compatibility
|
|
840
850
|
get btnRef() {
|
|
@@ -899,34 +909,34 @@ let u = class extends ee {
|
|
|
899
909
|
(t = this.calRef.value) != null && t.contains(e.detail.relatedTarget) || this.onBlur();
|
|
900
910
|
}}
|
|
901
911
|
@range-blur=${(e) => {
|
|
902
|
-
const t = this.currentInputElement,
|
|
903
|
-
if (t &&
|
|
904
|
-
const
|
|
905
|
-
if (
|
|
906
|
-
|
|
912
|
+
const t = this.currentInputElement, a = this.currentInputElementTo;
|
|
913
|
+
if (t && a) {
|
|
914
|
+
const s = t.value, l = a.value;
|
|
915
|
+
if (s && l && s > l)
|
|
916
|
+
a.value = "", this._value = [s], this.value = s;
|
|
907
917
|
else {
|
|
908
|
-
const
|
|
909
|
-
|
|
918
|
+
const n = [s, l].filter(Boolean);
|
|
919
|
+
n.length > 0 && (n[0] !== this._value[0] || n[1] !== this._value[1]) && (this._value = n, this.value = n.join(","));
|
|
910
920
|
}
|
|
911
921
|
}
|
|
912
|
-
|
|
922
|
+
A.processRangeBlur(
|
|
913
923
|
e.detail.event,
|
|
914
924
|
e.detail.values,
|
|
915
925
|
this.calRef,
|
|
916
926
|
() => this.clearInputValue(),
|
|
917
|
-
(
|
|
927
|
+
(s) => this.manageValidity(s)
|
|
918
928
|
);
|
|
919
929
|
}}
|
|
920
930
|
@manage-validity=${(e) => this.manageValidity(e.detail)}
|
|
921
931
|
@validate-date-input=${(e) => {
|
|
922
|
-
|
|
932
|
+
_.validateDateInput(e.detail, this.internals, this.min, this.max, this.strings);
|
|
923
933
|
}}
|
|
924
934
|
@handle-date-select=${(e) => {
|
|
925
|
-
var
|
|
926
|
-
const t =
|
|
935
|
+
var a, s;
|
|
936
|
+
const t = F(e.detail);
|
|
927
937
|
if (t) {
|
|
928
|
-
const
|
|
929
|
-
this._value[0] !==
|
|
938
|
+
const l = H(t);
|
|
939
|
+
this._value[0] !== l && this._value[1] !== l && ((s = (a = this.calRef) == null ? void 0 : a.value) == null || s.handleDateSelect(t));
|
|
930
940
|
}
|
|
931
941
|
}}
|
|
932
942
|
@input-changed=${() => {
|
|
@@ -984,7 +994,7 @@ let u = class extends ee {
|
|
|
984
994
|
.currentmonth=${this.currentmonth ? Z(this.currentmonth) : null}
|
|
985
995
|
.today=${this.today}
|
|
986
996
|
@date-selected=${(e) => {
|
|
987
|
-
this.value =
|
|
997
|
+
this.value = A.processDateSelection(e.detail, this.multiple, this.range), this._value = e.detail, A.updateInputValues(
|
|
988
998
|
this.inputRef,
|
|
989
999
|
this.inputRefTo,
|
|
990
1000
|
this._value,
|
|
@@ -1040,11 +1050,11 @@ let u = class extends ee {
|
|
|
1040
1050
|
strings=${this.strings}
|
|
1041
1051
|
id-base=${this.id}
|
|
1042
1052
|
@date-tag-removed=${(e) => {
|
|
1043
|
-
var
|
|
1044
|
-
const t = this.datepickerPopupRef.value,
|
|
1045
|
-
t &&
|
|
1053
|
+
var s;
|
|
1054
|
+
const t = this.datepickerPopupRef.value, a = F(e.detail);
|
|
1055
|
+
t && a && typeof t.handleDateSelect == "function" ? t.handleDateSelect(a) : (s = this.calRef.value) == null || s.handleDateSelect(a);
|
|
1046
1056
|
}}
|
|
1047
|
-
></pkt-date-tags>` :
|
|
1057
|
+
></pkt-date-tags>` : T}
|
|
1048
1058
|
<div class="pkt-datepicker__inputs ${this.range ? "pkt-input__range-inputs" : ""}">
|
|
1049
1059
|
${this.range ? this.renderRangeInput() : this.multiple ? this.renderMultipleInput() : this.renderInput()}
|
|
1050
1060
|
</div>
|
|
@@ -1057,16 +1067,16 @@ let u = class extends ee {
|
|
|
1057
1067
|
*/
|
|
1058
1068
|
handleCalendarPosition() {
|
|
1059
1069
|
const e = this.multiple && !!this.maxlength;
|
|
1060
|
-
|
|
1070
|
+
S.handleCalendarPosition(this.popupRef, this.inputRef, e);
|
|
1061
1071
|
}
|
|
1062
1072
|
async showCalendar() {
|
|
1063
1073
|
var t;
|
|
1064
1074
|
const e = this.datepickerPopupRef.value;
|
|
1065
1075
|
if (this.calendarOpen = !0, e && typeof e.show == "function") {
|
|
1066
|
-
e.show(),
|
|
1076
|
+
e.show(), k() && e.focusOnCurrentDate();
|
|
1067
1077
|
return;
|
|
1068
1078
|
}
|
|
1069
|
-
await ie(20), this.handleCalendarPosition(),
|
|
1079
|
+
await ie(20), this.handleCalendarPosition(), k() && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
|
|
1070
1080
|
}
|
|
1071
1081
|
hideCalendar() {
|
|
1072
1082
|
const e = this.datepickerPopupRef.value;
|
|
@@ -1076,8 +1086,8 @@ let u = class extends ee {
|
|
|
1076
1086
|
e.preventDefault();
|
|
1077
1087
|
const t = this.datepickerPopupRef.value;
|
|
1078
1088
|
if (t && typeof t.toggle == "function") {
|
|
1079
|
-
const
|
|
1080
|
-
t.toggle(), this.calendarOpen = !
|
|
1089
|
+
const a = !!t.open;
|
|
1090
|
+
t.toggle(), this.calendarOpen = !a;
|
|
1081
1091
|
return;
|
|
1082
1092
|
}
|
|
1083
1093
|
this.calendarOpen ? this.hideCalendar() : this.showCalendar();
|
|
@@ -1091,7 +1101,7 @@ let u = class extends ee {
|
|
|
1091
1101
|
})
|
|
1092
1102
|
);
|
|
1093
1103
|
}
|
|
1094
|
-
}
|
|
1104
|
+
}
|
|
1095
1105
|
p([
|
|
1096
1106
|
r({ type: String, reflect: !0 })
|
|
1097
1107
|
], u.prototype, "value", 1);
|
|
@@ -1126,10 +1136,10 @@ p([
|
|
|
1126
1136
|
r({ type: Boolean, reflect: !0 })
|
|
1127
1137
|
], u.prototype, "withcontrols", 2);
|
|
1128
1138
|
p([
|
|
1129
|
-
r({ converter:
|
|
1139
|
+
r({ converter: W.csvToArray })
|
|
1130
1140
|
], u.prototype, "excludedates", 2);
|
|
1131
1141
|
p([
|
|
1132
|
-
r({ converter:
|
|
1142
|
+
r({ converter: W.csvToArray })
|
|
1133
1143
|
], u.prototype, "excludeweekdays", 2);
|
|
1134
1144
|
p([
|
|
1135
1145
|
r({ type: String })
|
|
@@ -1144,15 +1154,17 @@ p([
|
|
|
1144
1154
|
r({ type: String })
|
|
1145
1155
|
], u.prototype, "timezone", 2);
|
|
1146
1156
|
p([
|
|
1147
|
-
|
|
1157
|
+
q()
|
|
1148
1158
|
], u.prototype, "inputClasses", 2);
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1159
|
+
try {
|
|
1160
|
+
w("pkt-datepicker")(u);
|
|
1161
|
+
} catch {
|
|
1162
|
+
console.warn("Forsøker å definere <pkt-datepicker>, men den er allerede definert");
|
|
1163
|
+
}
|
|
1152
1164
|
export {
|
|
1153
|
-
|
|
1165
|
+
R as P,
|
|
1154
1166
|
u as a,
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1167
|
+
O as b,
|
|
1168
|
+
D as c,
|
|
1169
|
+
j as d
|
|
1158
1170
|
};
|