@oslokommune/punkt-elements 12.31.2 → 12.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{alert-BDxxRqgi.cjs → alert-D5G5UJuo.cjs} +1 -1
- package/dist/{alert-D0S57u0r.js → alert-gERpVuB7.js} +6 -6
- package/dist/alert.d.ts +32 -0
- package/dist/{backlink-CzpB-ih9.js → backlink-DdNgqA56.js} +2 -2
- package/dist/{backlink-Dn4DfWVR.cjs → backlink-Q2HTG9jm.cjs} +1 -1
- package/dist/backlink.d.ts +32 -0
- package/dist/{button-Beo3c7cx.cjs → button-BPyZeW73.cjs} +1 -1
- package/dist/{button-9NwGr-OS.js → button-rArIL0-j.js} +3 -3
- package/dist/button.d.ts +32 -0
- package/dist/{calendar-BbZNxsKY.js → calendar-1ryAEdX3.js} +4 -4
- package/dist/{calendar-CxBo98iI.cjs → calendar-2DqPLXdD.cjs} +1 -1
- package/dist/calendar.d.ts +32 -0
- package/dist/{card-DQfNKnKl.js → card-BbMBpvJt.js} +7 -7
- package/dist/{card-C63x_nll.cjs → card-ZX09f_ka.cjs} +1 -1
- package/dist/card.d.ts +32 -0
- package/dist/{checkbox-9Zjy_NU7.cjs → checkbox-BnDG6wIO.cjs} +1 -1
- package/dist/{checkbox-CzDpR6_8.js → checkbox-Ceui2TLp.js} +4 -4
- package/dist/checkbox.d.ts +32 -0
- package/dist/{class-map-DWtqmIRS.js → class-map-ChuDQU5C.js} +1 -1
- package/dist/{class-map-Dj5mbCUg.cjs → class-map-D4rXyUxT.cjs} +1 -1
- package/dist/combobox-DH-YlbNh.cjs +115 -0
- package/dist/combobox-DbO6I0GT.js +694 -0
- package/dist/combobox.d.ts +47 -0
- package/dist/{datepicker-CYUvRGhE.js → datepicker-8MOgQsyL.js} +144 -196
- package/dist/datepicker-BRH-59Q9.cjs +153 -0
- package/dist/datepicker.d.ts +32 -0
- package/dist/directive-helpers-D7XIyCQ_.js +45 -0
- package/dist/directive-helpers-mGjAtADc.cjs +5 -0
- package/dist/{element-CzFXQBoS.cjs → element-BBo3JZk5.cjs} +1 -1
- package/dist/{element-C7XjZtLU.js → element-G8JoS0Lj.js} +6 -0
- package/dist/{helptext-B9kxDc2b.cjs → helptext-B4Uc-d56.cjs} +2 -2
- package/dist/{helptext-CqnoPodd.js → helptext-Y4cSgTkd.js} +10 -10
- package/dist/helptext.d.ts +32 -0
- package/dist/{icon-BEUgV9Wo.js → icon-BJnwW0eh.js} +1 -1
- package/dist/{icon-BOKusjAA.cjs → icon-BTUCDPN5.cjs} +1 -1
- package/dist/icon.d.ts +32 -0
- package/dist/{if-defined-CpIkv1A4.cjs → if-defined-C1ZDVzYn.cjs} +1 -1
- package/dist/{if-defined-eRX4e5zO.js → if-defined-rCqT8Od1.js} +1 -1
- package/dist/index.d.ts +208 -14
- package/dist/input-element-AhnBdCb8.cjs +1 -0
- package/dist/{input-element-BK8UkQli.js → input-element-DM2uSYaW.js} +22 -19
- package/dist/input-wrapper-BdZxmQyO.cjs +52 -0
- package/dist/input-wrapper-DQmYzhcy.js +185 -0
- package/dist/input-wrapper.d.ts +32 -0
- package/dist/{link-D3U0Jkz8.js → link-C3lW3z8X.js} +5 -5
- package/dist/{link-1iq0Pmuf.cjs → link-DOVlsg2S.cjs} +1 -1
- package/dist/link.d.ts +32 -0
- package/dist/{linkcard-CRpo3tiw.js → linkcard-CvqqyHVW.js} +4 -4
- package/dist/{linkcard-2WzDJPZz.cjs → linkcard-DDD92XfD.cjs} +1 -1
- package/dist/linkcard.d.ts +32 -0
- package/dist/listbox-BTVnrHWv.cjs +95 -0
- package/dist/listbox-DX-Euxdm.js +360 -0
- package/dist/listbox.d.ts +47 -0
- package/dist/{loader-B1edLWTg.js → loader-BudoV0yd.js} +6 -6
- package/dist/{loader-DI74pe25.cjs → loader-Csq0Yd1k.cjs} +1 -1
- package/dist/loader.d.ts +32 -0
- package/dist/{messagebox-DQpEMkS2.cjs → messagebox-8GwnNqb0.cjs} +1 -1
- package/dist/{messagebox-KP-8-tA9.js → messagebox-D6uexEhg.js} +6 -6
- package/dist/messagebox.d.ts +32 -0
- package/dist/{modal-ytIJwfr3.cjs → modal-CLixB4Dz.cjs} +1 -1
- package/dist/{modal-kPX8nO_L.js → modal-DnYn2Rlg.js} +6 -6
- package/dist/modal.d.ts +32 -0
- 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 -0
- package/dist/pkt-combobox.js +6 -0
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.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 +3 -3
- package/dist/pkt-index.js +45 -43
- 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 -0
- package/dist/pkt-listbox.js +6 -0
- 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-BtU1zEtG.cjs +1 -0
- package/dist/pkt-options-controller-CZplGTgu.js +38 -0
- 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-slot-controller-CqNvEpFd.cjs +1 -0
- package/dist/{pkt-slot-controller-Clbye6cM.js → pkt-slot-controller-D1DakVrU.js} +17 -7
- 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-B6A9UVXS.cjs → progressbar-BW_icNId.cjs} +1 -1
- package/dist/{progressbar-D0nxLqHu.js → progressbar-czvExwTL.js} +5 -5
- package/dist/progressbar.d.ts +32 -0
- package/dist/{radiobutton-BWyQgR_x.cjs → radiobutton-BeSuCrbp.cjs} +1 -1
- package/dist/{radiobutton-DLWjvLBO.js → radiobutton-DKo27Stm.js} +5 -5
- package/dist/radiobutton.d.ts +32 -0
- package/dist/ref-DsoUUoPU.cjs +9 -0
- package/dist/ref-cRTOoM4R.js +102 -0
- package/dist/repeat-CArTw6-s.js +61 -0
- package/dist/repeat-kruY8poV.cjs +5 -0
- package/dist/select-DxHhPEgD.js +118 -0
- package/dist/select-lvFnhEVg.cjs +49 -0
- package/dist/select.d.ts +32 -0
- package/dist/{state-HNj0_316.cjs → state-BILlRnrD.cjs} +1 -1
- package/dist/{state-CDQk0DFQ.js → state-gfUuUqVg.js} +1 -1
- package/dist/{tag-CmFcSdOV.js → tag-CWx1XsGR.js} +7 -7
- package/dist/{tag-BeLSOjNh.cjs → tag-DThwKsrg.cjs} +1 -1
- package/dist/tag.d.ts +32 -0
- package/dist/{textarea-BPqWCymU.js → textarea-BNNDbxxO.js} +18 -17
- package/dist/{textarea-VG-UTMLP.cjs → textarea-CDsLbogK.cjs} +6 -6
- package/dist/textarea.d.ts +32 -0
- package/dist/{textinput-CEP7QA3E.cjs → textinput-C3C088Ki.cjs} +5 -4
- package/dist/{textinput-VD74aGzx.js → textinput-M8I4dfoP.js} +25 -24
- package/dist/textinput.d.ts +32 -0
- package/package.json +3 -3
- package/src/components/combobox/combobox.ts +873 -0
- package/src/components/combobox/countrycodes.json +927 -0
- package/src/components/combobox/index.ts +6 -0
- package/src/components/datepicker/datepicker.ts +2 -0
- package/src/components/helptext/helptext.ts +1 -1
- package/src/components/index.ts +7 -0
- package/src/components/input-wrapper/input-wrapper.ts +42 -34
- package/src/components/listbox/index.ts +4 -0
- package/src/components/listbox/listbox.ts +474 -0
- package/src/components/select/select.ts +7 -0
- package/src/components/textinput/textinput.ts +3 -2
- package/dist/datepicker-FuAL0uNU.cjs +0 -155
- package/dist/input-element-Dtyuf6s8.cjs +0 -1
- package/dist/input-wrapper-Bo2_t6pA.cjs +0 -50
- package/dist/input-wrapper-DaZZq8c0.js +0 -172
- package/dist/pkt-slot-controller-Oc32unDk.cjs +0 -1
- package/dist/ref-2anvRHT4.cjs +0 -13
- package/dist/ref-DbOSDQbk.js +0 -143
- package/dist/select-CzuxXKll.js +0 -150
- package/dist/select-DZL6aa2s.cjs +0 -48
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export { }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
|
|
6
|
+
*
|
|
7
|
+
* The component will prioritize options passed as a prop over options passed as children if both are provided.
|
|
8
|
+
* This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
|
|
9
|
+
*
|
|
10
|
+
* @slot (default) - Options to be rendered as children
|
|
11
|
+
* @prop {TSelectOption[]} options - Options to be rendered as children
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'pkt-select': PktSelect & HTMLSelectElement;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
declare global {
|
|
23
|
+
interface HTMLElementTagNameMap {
|
|
24
|
+
'pkt-combobox': PktCombobox & HTMLSelectElement;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
declare global {
|
|
30
|
+
interface HTMLElementTagNameMap {
|
|
31
|
+
'pkt-icon': PktIcon;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
'pkt-listbox': PktListbox;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
declare global {
|
|
44
|
+
interface Window {
|
|
45
|
+
pktTz: string;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,70 +1,16 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { o as
|
|
3
|
-
import {
|
|
4
|
-
import { r as
|
|
5
|
-
import { n as
|
|
6
|
-
import { P as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "./icon-
|
|
10
|
-
import "./input-wrapper-
|
|
11
|
-
import "./tag-
|
|
12
|
-
import { P as
|
|
13
|
-
|
|
14
|
-
* @license
|
|
15
|
-
* Copyright 2017 Google LLC
|
|
16
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/
|
|
18
|
-
const E = (e, t, i) => {
|
|
19
|
-
const a = /* @__PURE__ */ new Map();
|
|
20
|
-
for (let s = t; s <= i; s++) a.set(e[s], s);
|
|
21
|
-
return a;
|
|
22
|
-
}, G = U(class extends K {
|
|
23
|
-
constructor(e) {
|
|
24
|
-
if (super(e), e.type !== W.CHILD) throw Error("repeat() can only be used in text expressions");
|
|
25
|
-
}
|
|
26
|
-
dt(e, t, i) {
|
|
27
|
-
let a;
|
|
28
|
-
i === void 0 ? i = t : t !== void 0 && (a = t);
|
|
29
|
-
const s = [], l = [];
|
|
30
|
-
let n = 0;
|
|
31
|
-
for (const f of e) s[n] = a ? a(f, n) : n, l[n] = i(f, n), n++;
|
|
32
|
-
return { values: l, keys: s };
|
|
33
|
-
}
|
|
34
|
-
render(e, t, i) {
|
|
35
|
-
return this.dt(e, t, i).values;
|
|
36
|
-
}
|
|
37
|
-
update(e, [t, i, a]) {
|
|
38
|
-
const s = H(e), { values: l, keys: n } = this.dt(t, i, a);
|
|
39
|
-
if (!Array.isArray(s)) return this.ut = n, l;
|
|
40
|
-
const f = this.ut ?? (this.ut = []), m = [];
|
|
41
|
-
let C, O, p = 0, h = s.length - 1, d = 0, c = l.length - 1;
|
|
42
|
-
for (; p <= h && d <= c; ) if (s[p] === null) p++;
|
|
43
|
-
else if (s[h] === null) h--;
|
|
44
|
-
else if (f[p] === n[d]) m[d] = $(s[p], l[d]), p++, d++;
|
|
45
|
-
else if (f[h] === n[c]) m[c] = $(s[h], l[c]), h--, c--;
|
|
46
|
-
else if (f[p] === n[c]) m[c] = $(s[p], l[c]), R(e, m[c + 1], s[p]), p++, c--;
|
|
47
|
-
else if (f[h] === n[d]) m[d] = $(s[h], l[d]), R(e, s[p], s[h]), h--, d++;
|
|
48
|
-
else if (C === void 0 && (C = E(n, d, c), O = E(f, p, h)), C.has(f[p])) if (C.has(f[h])) {
|
|
49
|
-
const g = O.get(n[d]), D = g !== void 0 ? s[g] : null;
|
|
50
|
-
if (D === null) {
|
|
51
|
-
const M = R(e, s[p]);
|
|
52
|
-
$(M, l[d]), m[d] = M;
|
|
53
|
-
} else m[d] = $(D, l[d]), R(e, s[p], D), s[g] = null;
|
|
54
|
-
d++;
|
|
55
|
-
} else I(s[h]), h--;
|
|
56
|
-
else I(s[p]), p++;
|
|
57
|
-
for (; d <= c; ) {
|
|
58
|
-
const g = R(e, m[c + 1]);
|
|
59
|
-
$(g, l[d]), m[d++] = g;
|
|
60
|
-
}
|
|
61
|
-
for (; p <= h; ) {
|
|
62
|
-
const g = s[p++];
|
|
63
|
-
g !== null && I(g);
|
|
64
|
-
}
|
|
65
|
-
return this.ut = n, N(e, m), L;
|
|
66
|
-
}
|
|
67
|
-
}), J = "pkt-datepicker", Q = !0, X = {
|
|
1
|
+
import { e as m } from "./class-map-ChuDQU5C.js";
|
|
2
|
+
import { o as d } from "./if-defined-rCqT8Od1.js";
|
|
3
|
+
import { x as p, E as g, n as l, a as w } from "./element-G8JoS0Lj.js";
|
|
4
|
+
import { r as b } from "./state-gfUuUqVg.js";
|
|
5
|
+
import { n as v, f as k, a as R, b as y, d as x } from "./calendar-1ryAEdX3.js";
|
|
6
|
+
import { P as C } from "./input-element-DM2uSYaW.js";
|
|
7
|
+
import { e as f, n as h } from "./ref-cRTOoM4R.js";
|
|
8
|
+
import { c as T } from "./repeat-CArTw6-s.js";
|
|
9
|
+
import "./icon-BJnwW0eh.js";
|
|
10
|
+
import "./input-wrapper-DQmYzhcy.js";
|
|
11
|
+
import "./tag-CWx1XsGR.js";
|
|
12
|
+
import { P as S } from "./pkt-slot-controller-D1DakVrU.js";
|
|
13
|
+
const D = "pkt-datepicker", _ = !0, I = {
|
|
68
14
|
name: {
|
|
69
15
|
type: "string",
|
|
70
16
|
name: "Navn",
|
|
@@ -233,7 +179,7 @@ const E = (e, t, i) => {
|
|
|
233
179
|
name: "ID",
|
|
234
180
|
description: "Unik identifikasjon for datovelgeren"
|
|
235
181
|
}
|
|
236
|
-
},
|
|
182
|
+
}, O = {
|
|
237
183
|
change: {
|
|
238
184
|
type: "Event",
|
|
239
185
|
description: "Returnerer valgt dato som streng i ISO-format"
|
|
@@ -246,36 +192,36 @@ const E = (e, t, i) => {
|
|
|
246
192
|
type: "CustomEvent",
|
|
247
193
|
description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
|
|
248
194
|
}
|
|
249
|
-
},
|
|
250
|
-
name:
|
|
195
|
+
}, c = {
|
|
196
|
+
name: D,
|
|
251
197
|
"css-class": "pkt-datepicker",
|
|
252
|
-
isElement:
|
|
253
|
-
props:
|
|
254
|
-
events:
|
|
198
|
+
isElement: _,
|
|
199
|
+
props: I,
|
|
200
|
+
events: O
|
|
255
201
|
};
|
|
256
|
-
var
|
|
257
|
-
for (var s =
|
|
258
|
-
(
|
|
259
|
-
return
|
|
202
|
+
var P = Object.defineProperty, B = Object.getOwnPropertyDescriptor, n = (e, t, i, r) => {
|
|
203
|
+
for (var s = r > 1 ? void 0 : r ? B(t, i) : t, o = e.length - 1, u; o >= 0; o--)
|
|
204
|
+
(u = e[o]) && (s = (r ? u(t, i, s) : u(s)) || s);
|
|
205
|
+
return r && s && P(t, i, s), s;
|
|
260
206
|
};
|
|
261
|
-
const
|
|
262
|
-
let
|
|
207
|
+
const $ = (e) => new Promise((t) => setTimeout(t, e));
|
|
208
|
+
let a = class extends C {
|
|
263
209
|
/**
|
|
264
210
|
* Housekeeping / lifecycle methods
|
|
265
211
|
*/
|
|
266
212
|
constructor() {
|
|
267
|
-
super(), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.dateformat =
|
|
213
|
+
super(), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.dateformat = c.props.dateformat.default, this.multiple = c.props.multiple.default, this.maxlength = null, this.range = c.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = c.props.weeknumbers.default, this.withcontrols = c.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.buttonClasses = {}, this.inputRef = f(), this.inputRefTo = f(), this.btnRef = f(), this.calRef = f(), this.popupRef = f(), this.helptextSlot = f(), this.addToSelected = (e) => {
|
|
268
214
|
const t = e.target;
|
|
269
215
|
if (!t.value) return;
|
|
270
|
-
const i = this.min ?
|
|
271
|
-
s && !isNaN(s.getTime()) && (!i || s >= i) && (!
|
|
272
|
-
}, this.slotController = new
|
|
216
|
+
const i = this.min ? v(this.min) : null, r = this.max ? v(this.max) : null, s = v(t.value.split(",")[0]);
|
|
217
|
+
s && !isNaN(s.getTime()) && (!i || s >= i) && (!r || s <= r) && this.calRef.value && this.calRef.value.handleDateSelect(s), t.value = "";
|
|
218
|
+
}, this.slotController = new S(this, this.helptextSlot);
|
|
273
219
|
}
|
|
274
220
|
async connectedCallback() {
|
|
275
221
|
super.connectedCallback(), this.isMobileSafari = /iP(ad|od|hone)/i.test(window.navigator.userAgent) && !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), this.inputType = this.isMobileSafari ? "text" : "date", document && document.body.addEventListener("click", (e) => {
|
|
276
222
|
var t, i;
|
|
277
223
|
(t = this.inputRef) != null && t.value && ((i = this.btnRef) != null && i.value) && !this.inputRef.value.contains(e.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(e.target)) && !this.btnRef.value.contains(e.target) && !e.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
|
|
278
|
-
}), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min ||
|
|
224
|
+
}), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || c.props.min.default, this.max = this.max || c.props.max.default, typeof this.excludedates == "string" && (this.excludedates = this.excludedates.split(",")), typeof this.excludeweekdays == "string" && (this.excludeweekdays = this.excludeweekdays.split(",")), (this.multiple || this.range) && this.name && !this.name.endsWith("[]") && (this.name = this.name + "[]"), this.calendarOpen && (await $(20), this.handleCalendarPosition());
|
|
279
225
|
}
|
|
280
226
|
disconnectedCallback() {
|
|
281
227
|
super.disconnectedCallback(), document && document.body.removeEventListener("click", (e) => {
|
|
@@ -301,14 +247,14 @@ let r = class extends q {
|
|
|
301
247
|
* Rendering
|
|
302
248
|
*/
|
|
303
249
|
renderInput() {
|
|
304
|
-
return
|
|
250
|
+
return p`
|
|
305
251
|
<input
|
|
306
|
-
class="${
|
|
252
|
+
class="${m(this.inputClasses)}"
|
|
307
253
|
.type=${this.inputType}
|
|
308
254
|
id="${this.id}-input"
|
|
309
255
|
.value=${this._value[0] ?? ""}
|
|
310
|
-
min=${
|
|
311
|
-
max=${
|
|
256
|
+
min=${d(this.min)}
|
|
257
|
+
max=${d(this.max)}
|
|
312
258
|
@click=${(e) => {
|
|
313
259
|
e.preventDefault(), this.showCalendar();
|
|
314
260
|
}}
|
|
@@ -330,7 +276,7 @@ let r = class extends q {
|
|
|
330
276
|
@change=${(e) => {
|
|
331
277
|
e.stopImmediatePropagation();
|
|
332
278
|
}}
|
|
333
|
-
${
|
|
279
|
+
${h(this.inputRef)}
|
|
334
280
|
/>
|
|
335
281
|
`;
|
|
336
282
|
}
|
|
@@ -339,15 +285,15 @@ let r = class extends q {
|
|
|
339
285
|
"pkt-input-prefix": this.showRangeLabels,
|
|
340
286
|
"pkt-hide": !this.showRangeLabels
|
|
341
287
|
};
|
|
342
|
-
return
|
|
343
|
-
${this.showRangeLabels ?
|
|
288
|
+
return p`
|
|
289
|
+
${this.showRangeLabels ? p` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : g}
|
|
344
290
|
<input
|
|
345
|
-
class=${
|
|
291
|
+
class=${m(this.inputClasses)}
|
|
346
292
|
.type=${this.inputType}
|
|
347
293
|
id="${this.id}-input"
|
|
348
294
|
.value=${this._value[0] ?? ""}
|
|
349
|
-
min=${
|
|
350
|
-
max=${
|
|
295
|
+
min=${d(this.min)}
|
|
296
|
+
max=${d(this.max)}
|
|
351
297
|
?disabled=${this.disabled}
|
|
352
298
|
@click=${(t) => {
|
|
353
299
|
t.preventDefault(), this.showCalendar();
|
|
@@ -363,30 +309,30 @@ let r = class extends q {
|
|
|
363
309
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
364
310
|
}}
|
|
365
311
|
@blur=${(t) => {
|
|
366
|
-
var i,
|
|
312
|
+
var i, r;
|
|
367
313
|
if (t.target.value) {
|
|
368
314
|
this.manageValidity(t.target);
|
|
369
|
-
const s =
|
|
370
|
-
s && this._value[0] !== t.target.value && this._value[1] && (this.clearInputValue(), (
|
|
315
|
+
const s = k(t.target.value);
|
|
316
|
+
s && this._value[0] !== t.target.value && this._value[1] && (this.clearInputValue(), (r = (i = this.calRef) == null ? void 0 : i.value) == null || r.handleDateSelect(s));
|
|
371
317
|
} else this._value[0] && this.clearInputValue();
|
|
372
318
|
}}
|
|
373
319
|
@change=${(t) => {
|
|
374
320
|
t.stopImmediatePropagation();
|
|
375
321
|
}}
|
|
376
|
-
${
|
|
322
|
+
${h(this.inputRef)}
|
|
377
323
|
/>
|
|
378
|
-
<div class="${
|
|
324
|
+
<div class="${m(e)}" id="${this.id}-to-label">
|
|
379
325
|
${this.strings.generic.to}
|
|
380
326
|
</div>
|
|
381
|
-
${this.showRangeLabels ?
|
|
327
|
+
${this.showRangeLabels ? g : p` <div class="pkt-input-separator">–</div> `}
|
|
382
328
|
<input
|
|
383
|
-
class=${
|
|
329
|
+
class=${m(this.inputClasses)}
|
|
384
330
|
.type=${this.inputType}
|
|
385
331
|
id="${this.id}-to"
|
|
386
332
|
aria-labelledby="${this.id}-to-label"
|
|
387
333
|
.value=${this._value[1] ?? ""}
|
|
388
|
-
min=${
|
|
389
|
-
max=${
|
|
334
|
+
min=${d(this.min)}
|
|
335
|
+
max=${d(this.max)}
|
|
390
336
|
?disabled=${this.disabled}
|
|
391
337
|
@click=${(t) => {
|
|
392
338
|
t.preventDefault(), this.showCalendar();
|
|
@@ -402,38 +348,38 @@ let r = class extends q {
|
|
|
402
348
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
403
349
|
}}
|
|
404
350
|
@blur=${(t) => {
|
|
405
|
-
var i,
|
|
351
|
+
var i, r, s;
|
|
406
352
|
if ((i = this.calRef.value) != null && i.contains(t.relatedTarget) || this.onBlur(), t.target.value) {
|
|
407
353
|
this.manageValidity(t.target);
|
|
408
|
-
const
|
|
409
|
-
this.min && this.min >
|
|
354
|
+
const o = t.target.value;
|
|
355
|
+
this.min && this.min > o ? this.internals.setValidity(
|
|
410
356
|
{ rangeUnderflow: !0 },
|
|
411
357
|
this.strings.forms.messages.rangeUnderflow,
|
|
412
358
|
t.target
|
|
413
|
-
) : this.max && this.max <
|
|
359
|
+
) : this.max && this.max < o && this.internals.setValidity(
|
|
414
360
|
{ rangeOverflow: !0 },
|
|
415
361
|
this.strings.forms.messages.rangeOverflow,
|
|
416
362
|
t.target
|
|
417
363
|
);
|
|
418
|
-
const
|
|
419
|
-
|
|
364
|
+
const u = k(t.target.value);
|
|
365
|
+
u && this._value[1] !== R(u) && ((s = (r = this.calRef) == null ? void 0 : r.value) == null || s.handleDateSelect(u));
|
|
420
366
|
}
|
|
421
367
|
}}
|
|
422
368
|
@change=${(t) => {
|
|
423
369
|
t.stopImmediatePropagation();
|
|
424
370
|
}}
|
|
425
|
-
${
|
|
371
|
+
${h(this.inputRefTo)}
|
|
426
372
|
/>
|
|
427
373
|
`;
|
|
428
374
|
}
|
|
429
375
|
renderMultipleInput() {
|
|
430
|
-
return
|
|
376
|
+
return p`
|
|
431
377
|
<input
|
|
432
|
-
class=${
|
|
378
|
+
class=${m(this.inputClasses)}
|
|
433
379
|
.type=${this.inputType}
|
|
434
380
|
id="${this.id}-input"
|
|
435
|
-
min=${
|
|
436
|
-
max=${
|
|
381
|
+
min=${d(this.min)}
|
|
382
|
+
max=${d(this.max)}
|
|
437
383
|
?disabled=${this.disabled || this.maxlength && this._value.length >= this.maxlength}
|
|
438
384
|
@click=${(e) => {
|
|
439
385
|
e.preventDefault(), this.showCalendar();
|
|
@@ -454,43 +400,43 @@ let r = class extends q {
|
|
|
454
400
|
@change=${(e) => {
|
|
455
401
|
e.stopImmediatePropagation();
|
|
456
402
|
}}
|
|
457
|
-
${
|
|
403
|
+
${h(this.inputRef)}
|
|
458
404
|
/>
|
|
459
405
|
`;
|
|
460
406
|
}
|
|
461
407
|
renderTags() {
|
|
462
|
-
return
|
|
408
|
+
return p`
|
|
463
409
|
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
464
|
-
${this._value[0] ?
|
|
410
|
+
${this._value[0] ? T(
|
|
465
411
|
this._value ?? [],
|
|
466
412
|
(e) => e,
|
|
467
|
-
(e) =>
|
|
413
|
+
(e) => p`
|
|
468
414
|
<pkt-tag
|
|
469
415
|
.id="${this.id + e + "-tag"}"
|
|
470
416
|
closeTag
|
|
471
|
-
ariaLabel="${this.strings.calendar.deleteDate} ${
|
|
417
|
+
ariaLabel="${this.strings.calendar.deleteDate} ${y(
|
|
472
418
|
e,
|
|
473
419
|
this.dateformat
|
|
474
420
|
)}"
|
|
475
421
|
@close=${() => {
|
|
476
422
|
var t;
|
|
477
|
-
return (t = this.calRef.value) == null ? void 0 : t.handleDateSelect(
|
|
423
|
+
return (t = this.calRef.value) == null ? void 0 : t.handleDateSelect(k(e));
|
|
478
424
|
}}
|
|
479
|
-
><time datetime="${e}">${
|
|
425
|
+
><time datetime="${e}">${y(e, this.dateformat)}</time></pkt-tag
|
|
480
426
|
>
|
|
481
427
|
`
|
|
482
|
-
) :
|
|
428
|
+
) : g}
|
|
483
429
|
</div>
|
|
484
430
|
`;
|
|
485
431
|
}
|
|
486
432
|
renderCalendar() {
|
|
487
|
-
return
|
|
433
|
+
return p`<div
|
|
488
434
|
class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
|
|
489
435
|
@focusout=${(e) => {
|
|
490
436
|
this.calendarOpen && this.handleFocusOut(e);
|
|
491
437
|
}}
|
|
492
438
|
id="${this.id}-popup"
|
|
493
|
-
${
|
|
439
|
+
${h(this.popupRef)}
|
|
494
440
|
>
|
|
495
441
|
<pkt-calendar
|
|
496
442
|
id="${this.id}-calendar"
|
|
@@ -504,14 +450,14 @@ let r = class extends q {
|
|
|
504
450
|
.latest=${this.max}
|
|
505
451
|
.excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
|
|
506
452
|
.excludeweekdays=${this.excludeweekdays}
|
|
507
|
-
.currentmonth=${this.currentmonth ?
|
|
453
|
+
.currentmonth=${this.currentmonth ? v(this.currentmonth) : null}
|
|
508
454
|
@date-selected=${(e) => {
|
|
509
455
|
this.value = !this.multiple && !this.range ? e.detail[0] : e.detail, this._value = e.detail, this.inputRef.value && (this.range && this.inputRefTo.value ? (this.inputRef.value.value = this._value[0] ?? "", this.inputRefTo.value.value = this._value[1] ?? "") : this.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : ""));
|
|
510
456
|
}}
|
|
511
457
|
@close=${() => {
|
|
512
458
|
this.onBlur(), this.hideCalendar();
|
|
513
459
|
}}
|
|
514
|
-
${
|
|
460
|
+
${h(this.calRef)}
|
|
515
461
|
></pkt-calendar>
|
|
516
462
|
</div>`;
|
|
517
463
|
}
|
|
@@ -528,7 +474,7 @@ let r = class extends q {
|
|
|
528
474
|
"pkt-btn": !0,
|
|
529
475
|
"pkt-btn--icon-only": !0,
|
|
530
476
|
"pkt-btn--tertiary": !0
|
|
531
|
-
},
|
|
477
|
+
}, p`
|
|
532
478
|
<pkt-input-wrapper
|
|
533
479
|
label="${this.label}"
|
|
534
480
|
forId="${this.id}-input"
|
|
@@ -537,6 +483,8 @@ let r = class extends q {
|
|
|
537
483
|
.counterMaxLength=${this.maxlength}
|
|
538
484
|
?disabled=${this.disabled}
|
|
539
485
|
?hasError=${this.hasError}
|
|
486
|
+
?hasFieldset=${this.hasFieldset}
|
|
487
|
+
?inline=${this.inline}
|
|
540
488
|
?required=${this.required}
|
|
541
489
|
?optionalTag=${this.optionalTag}
|
|
542
490
|
?requiredTag=${this.requiredTag}
|
|
@@ -550,19 +498,19 @@ let r = class extends q {
|
|
|
550
498
|
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
551
499
|
class="pkt-datepicker"
|
|
552
500
|
>
|
|
553
|
-
<div class="pkt-contents" ${
|
|
554
|
-
${this.multiple ? this.renderTags() :
|
|
501
|
+
<div class="pkt-contents" ${h(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
502
|
+
${this.multiple ? this.renderTags() : g}
|
|
555
503
|
<div
|
|
556
504
|
class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
|
|
557
505
|
>
|
|
558
506
|
<div class="pkt-input__container">
|
|
559
507
|
${this.range ? this.renderRangeInput() : this.multiple ? this.renderMultipleInput() : this.renderInput()}
|
|
560
508
|
<button
|
|
561
|
-
class="${
|
|
509
|
+
class="${m(this.buttonClasses)}"
|
|
562
510
|
type="button"
|
|
563
511
|
@click=${this.toggleCalendar}
|
|
564
512
|
?disabled=${this.disabled}
|
|
565
|
-
${
|
|
513
|
+
${h(this.btnRef)}
|
|
566
514
|
>
|
|
567
515
|
<pkt-icon name="calendar"></pkt-icon>
|
|
568
516
|
<span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
|
|
@@ -579,9 +527,9 @@ let r = class extends q {
|
|
|
579
527
|
handleCalendarPosition() {
|
|
580
528
|
var e;
|
|
581
529
|
if (this.popupRef.value && this.inputRef.value) {
|
|
582
|
-
const t = this.multiple && !!this.maxlength, i = ((e = this.inputRef.value.parentElement) == null ? void 0 : e.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(),
|
|
583
|
-
let
|
|
584
|
-
i && i.top + s > window.innerHeight && i.top - s > 0 && (
|
|
530
|
+
const t = this.multiple && !!this.maxlength, i = ((e = this.inputRef.value.parentElement) == null ? void 0 : e.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), r = t ? i.height + 30 : i.height, s = this.popupRef.value.getBoundingClientRect().height;
|
|
531
|
+
let o = t ? "calc(100% - 30px)" : "100%";
|
|
532
|
+
i && i.top + s > window.innerHeight && i.top - s > 0 && (o = `calc(100% - ${r}px - ${s}px)`), this.popupRef.value.style.top = o;
|
|
585
533
|
}
|
|
586
534
|
}
|
|
587
535
|
handleFocusOut(e) {
|
|
@@ -589,7 +537,7 @@ let r = class extends q {
|
|
|
589
537
|
}
|
|
590
538
|
async showCalendar() {
|
|
591
539
|
var e;
|
|
592
|
-
this.calendarOpen = !0, await
|
|
540
|
+
this.calendarOpen = !0, await $(20), this.handleCalendarPosition(), this.isMobileSafari && ((e = this.calRef.value) == null || e.focusOnCurrentDate());
|
|
593
541
|
}
|
|
594
542
|
hideCalendar() {
|
|
595
543
|
this.calendarOpen = !1;
|
|
@@ -598,66 +546,66 @@ let r = class extends q {
|
|
|
598
546
|
e.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
|
|
599
547
|
}
|
|
600
548
|
};
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
],
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
],
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
],
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
],
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
],
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
],
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
],
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
],
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
],
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
],
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
],
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
],
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
],
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
],
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
],
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
],
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
],
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
],
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
],
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
],
|
|
549
|
+
n([
|
|
550
|
+
l({ type: String, reflect: !0 })
|
|
551
|
+
], a.prototype, "value", 2);
|
|
552
|
+
n([
|
|
553
|
+
l({ type: Array })
|
|
554
|
+
], a.prototype, "_value", 2);
|
|
555
|
+
n([
|
|
556
|
+
l({ type: String, reflect: !0 })
|
|
557
|
+
], a.prototype, "label", 2);
|
|
558
|
+
n([
|
|
559
|
+
l({ type: String })
|
|
560
|
+
], a.prototype, "dateformat", 2);
|
|
561
|
+
n([
|
|
562
|
+
l({ type: Boolean, reflect: !0 })
|
|
563
|
+
], a.prototype, "multiple", 2);
|
|
564
|
+
n([
|
|
565
|
+
l({ type: Number, reflect: !0 })
|
|
566
|
+
], a.prototype, "maxlength", 2);
|
|
567
|
+
n([
|
|
568
|
+
l({ type: Boolean, reflect: !0 })
|
|
569
|
+
], a.prototype, "range", 2);
|
|
570
|
+
n([
|
|
571
|
+
l({ type: Boolean })
|
|
572
|
+
], a.prototype, "showRangeLabels", 2);
|
|
573
|
+
n([
|
|
574
|
+
l({ type: String, reflect: !0 })
|
|
575
|
+
], a.prototype, "min", 2);
|
|
576
|
+
n([
|
|
577
|
+
l({ type: String, reflect: !0 })
|
|
578
|
+
], a.prototype, "max", 2);
|
|
579
|
+
n([
|
|
580
|
+
l({ type: Boolean })
|
|
581
|
+
], a.prototype, "weeknumbers", 2);
|
|
582
|
+
n([
|
|
583
|
+
l({ type: Boolean, reflect: !0 })
|
|
584
|
+
], a.prototype, "withcontrols", 2);
|
|
585
|
+
n([
|
|
586
|
+
l({ converter: x.csvToArray })
|
|
587
|
+
], a.prototype, "excludedates", 2);
|
|
588
|
+
n([
|
|
589
|
+
l({ converter: x.csvToArray })
|
|
590
|
+
], a.prototype, "excludeweekdays", 2);
|
|
591
|
+
n([
|
|
592
|
+
l({ type: String })
|
|
593
|
+
], a.prototype, "currentmonth", 2);
|
|
594
|
+
n([
|
|
595
|
+
l({ type: Boolean, reflect: !0 })
|
|
596
|
+
], a.prototype, "calendarOpen", 2);
|
|
597
|
+
n([
|
|
598
|
+
l({ type: String })
|
|
599
|
+
], a.prototype, "timezone", 2);
|
|
600
|
+
n([
|
|
601
|
+
b()
|
|
602
|
+
], a.prototype, "inputClasses", 2);
|
|
603
|
+
n([
|
|
604
|
+
b()
|
|
605
|
+
], a.prototype, "buttonClasses", 2);
|
|
606
|
+
a = n([
|
|
607
|
+
w("pkt-datepicker")
|
|
608
|
+
], a);
|
|
661
609
|
export {
|
|
662
|
-
|
|
610
|
+
a as P
|
|
663
611
|
};
|