@oslokommune/punkt-elements 16.6.2 → 16.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/{accordionitem-D7sWqDM_.cjs → accordionitem-D1Agl1bB.cjs} +1 -1
- package/dist/{accordionitem-Cj74XruR.js → accordionitem-ZlaXvjt5.js} +5 -5
- package/dist/{alert-ca_hFi-u.js → alert-BuAXrnKl.js} +6 -6
- package/dist/{alert-C95U_RZ0.cjs → alert-DFkFNTxh.cjs} +1 -1
- package/dist/{async-directive-CKx6pubI.js → async-directive-CMzWMlZ5.js} +1 -1
- package/dist/{async-directive-B158h3ba.cjs → async-directive-DoMuclel.cjs} +1 -1
- package/dist/{backlink-CQoNgoa-.cjs → backlink-EiAXUUZP.cjs} +1 -1
- package/dist/{backlink-C68H4Z3b.js → backlink-V4DAt17e.js} +3 -3
- package/dist/{button-BRovt5nm.js → button-DEyvt1LI.js} +5 -5
- package/dist/{button-BXN_JPaH.cjs → button-DYv5Dg4M.cjs} +1 -1
- package/dist/{calendar-43Y_6FD8.cjs → calendar-HIE9nxcc.cjs} +1 -1
- package/dist/{calendar-B5Xwl8mV.js → calendar-S63oreVW.js} +4 -4
- package/dist/{card-DfHo45CG.cjs → card-CyeH6l1c.cjs} +1 -1
- package/dist/{card-DvgCTN4B.js → card-DDiLfuO4.js} +7 -7
- package/dist/{checkbox-mmn3v9ry.cjs → checkbox-BLlwTABj.cjs} +1 -1
- package/dist/{checkbox-CbIUMIYt.js → checkbox-ejBUa5qQ.js} +4 -4
- package/dist/{class-map-3ADKve8g.js → class-map-CEnykyO_.js} +1 -1
- package/dist/{class-map-Bokp1SoS.cjs → class-map-CsENJXf1.cjs} +1 -1
- package/dist/{combobox-CwW0md6G.js → combobox-BmxSecfE.js} +13 -13
- package/dist/{combobox-TKL44xnV.cjs → combobox-Hb2V-fPX.cjs} +1 -1
- package/dist/{consent-CgS1L1xF.js → consent-iXyx5v6J.js} +3 -3
- package/dist/{consent-CIhFwuFO.cjs → consent-ruWAEVXW.cjs} +1 -1
- package/dist/{datepicker-qRWWzmbo.js → datepicker-CZl7b8Na.js} +12 -12
- package/dist/{datepicker-oN9L0Wnm.cjs → datepicker-D2H7U6MS.cjs} +1 -1
- package/dist/{directive-helpers-B3Vpl3xV.cjs → directive-helpers-BP2WOx60.cjs} +1 -1
- package/dist/{directive-helpers-CyPtA1_i.js → directive-helpers-rm-28gIj.js} +1 -1
- package/dist/{element-CV9utnHJ.js → element-CPpT3rFQ.js} +68 -67
- package/dist/{element-CMTfByxQ.cjs → element-gR_VtSiD.cjs} +6 -6
- package/dist/{element-with-slot-1djk8KXi.js → element-with-slot-Dqk6-TRR.js} +2 -2
- package/dist/{element-with-slot-yT8k1Z37.cjs → element-with-slot-ZX-up7jO.cjs} +1 -1
- package/dist/{heading-D9R5UBcv.js → heading-CKt7cVn7.js} +1 -1
- package/dist/{heading-B0XRE0lq.cjs → heading-Cvz8m1xL.cjs} +1 -1
- package/dist/{helptext-B366oeR9.cjs → helptext-5Mzp65-F.cjs} +1 -1
- package/dist/{helptext-DepcDYFV.js → helptext-jIoWRcCF.js} +5 -5
- package/dist/{icon-D0IQAVwS.js → icon-BlKA8YuW.js} +1 -1
- package/dist/{icon-Dj0oZZSa.cjs → icon-Bqj9oBbl.cjs} +1 -1
- package/dist/{if-defined-rXcLNTzN.js → if-defined-B0krMLad.js} +1 -1
- package/dist/{if-defined-hKKmbsI8.cjs → if-defined-BOW3ODSj.cjs} +1 -1
- package/dist/index.d.ts +92 -0
- package/dist/{input-element-n5U38pZ1.js → input-element-8nLwuQS4.js} +3 -3
- package/dist/{input-element-Xe9FTi2a.cjs → input-element-DdVhUvva.cjs} +1 -1
- package/dist/{input-wrapper-BdFdJU-k.cjs → input-wrapper-B0MkQ0IZ.cjs} +1 -1
- package/dist/{input-wrapper-B__6jW4U.js → input-wrapper-B2JpK016.js} +7 -7
- package/dist/{link-DLjXMpvi.cjs → link-R_lNhViF.cjs} +1 -1
- package/dist/{link-oGYvBLYL.js → link-Z_GizclR.js} +4 -4
- package/dist/{linkcard-BhVIc18n.js → linkcard-BlQvdB1a.js} +4 -4
- package/dist/{linkcard-C20WC6Nw.cjs → linkcard-C7HbSLlX.cjs} +1 -1
- package/dist/{listbox-CS4WQOuf.js → listbox-BQKDZvZn.js} +5 -5
- package/dist/{listbox-OAVh_U7u.cjs → listbox-CGgV9MAe.cjs} +1 -1
- package/dist/{loader-BHt9i5Xp.js → loader-Ci3CHU8k.js} +5 -5
- package/dist/{loader-DxAGCcNF.cjs → loader-e2gs_1xz.cjs} +1 -1
- package/dist/{messagebox-DkspcMQg.js → messagebox-Bf-XMlvW.js} +5 -5
- package/dist/{messagebox-B8LW0PSQ.cjs → messagebox-D67w71VX.cjs} +1 -1
- package/dist/{modal-mWn5pjs8.cjs → modal-CyvEkbfQ.cjs} +1 -1
- package/dist/{modal-D3u6ueP5.js → modal-DzGe1g8Z.js} +6 -6
- 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-breadcrumbs.cjs +1 -1
- package/dist/pkt-breadcrumbs.js +2 -2
- 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 +10 -10
- 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 -1
- package/dist/pkt-index.js +33 -31
- 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-DIeKSpWv.cjs → pkt-options-controller-5LXbEzuk.cjs} +1 -1
- package/dist/{pkt-options-controller-W4ITGQy9.js → pkt-options-controller-B5YalfCb.js} +1 -1
- 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/pkt-timepicker.cjs +188 -0
- package/dist/pkt-timepicker.js +552 -0
- package/dist/{progressbar-CcX-xiPI.js → progressbar-By7e0lEI.js} +5 -5
- package/dist/{progressbar-CC9Qr82_.cjs → progressbar-DsJ2B9Vm.cjs} +1 -1
- package/dist/{radiobutton-RW3h0tJj.js → radiobutton-6frNG9J_.js} +5 -5
- package/dist/{radiobutton-BUDQYAH-.cjs → radiobutton-Bv-BZ1Hw.cjs} +1 -1
- package/dist/{ref-DBGHvw2G.js → ref-Bg_Swj5w.js} +2 -2
- package/dist/{ref-DahIePMT.cjs → ref-CL-Xk9Xm.cjs} +1 -1
- package/dist/{repeat-DnlRNf63.js → repeat-BD8TKgJb.js} +2 -2
- package/dist/{repeat-C-FJ2vfy.cjs → repeat-Cfq8CDlf.cjs} +1 -1
- package/dist/{select-iXKeM3yz.js → select-CXZt1nHS.js} +8 -8
- package/dist/{select-PuEeK4jQ.cjs → select-WFhS4Vfp.cjs} +1 -1
- package/dist/{state-l4hGZdFJ.js → state-C_1EOo3D.js} +1 -1
- package/dist/{state-BNgpvY-A.cjs → state-Dg-53wQ8.cjs} +1 -1
- package/dist/{tabitem-DZSzwag2.js → tabitem-CB8wkKmv.js} +5 -5
- package/dist/{tabitem-Jenus4Qd.cjs → tabitem-DZpspU4Q.cjs} +1 -1
- package/dist/{tag-CIWBLpjv.js → tag-BuCpqaks.js} +6 -6
- package/dist/{tag-DeE1OpmF.cjs → tag-X6xdjR0N.cjs} +1 -1
- package/dist/{textarea-DR9lVDN-.js → textarea-Bzuymclz.js} +10 -10
- package/dist/{textarea-DtiYQWjy.cjs → textarea-DoeHJ7HR.cjs} +1 -1
- package/dist/{textinput-0Bttvt9V.js → textinput-9lHjs4ce.js} +9 -9
- package/dist/{textinput-cKrjvbJW.cjs → textinput-BNsLd26i.cjs} +1 -1
- package/dist/timepicker.d.ts +1 -0
- package/package.json +2 -3
- package/src/components/index.ts +3 -0
- package/src/components/timepicker/index.ts +2 -0
- package/src/components/timepicker/timepicker.test.ts +453 -0
- package/src/components/timepicker/timepicker.ts +787 -0
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
import { s as c, b as u, A as o, n as b, t as w } from "./element-CPpT3rFQ.js";
|
|
2
|
+
import { r as v } from "./state-C_1EOo3D.js";
|
|
3
|
+
import { e as m, n as _ } from "./ref-Bg_Swj5w.js";
|
|
4
|
+
import { o as k } from "./if-defined-B0krMLad.js";
|
|
5
|
+
import { e as x } from "./class-map-CEnykyO_.js";
|
|
6
|
+
import { P as I } from "./input-element-8nLwuQS4.js";
|
|
7
|
+
import { s as F } from "./element-with-slot-Dqk6-TRR.js";
|
|
8
|
+
import "./icon-BlKA8YuW.js";
|
|
9
|
+
import "./input-wrapper-B2JpK016.js";
|
|
10
|
+
const A = (t) => /^\d{2}:\d{2}$/.test(t) && parseInt(t.slice(0, 2), 10) <= 23 && parseInt(t.slice(3), 10) <= 59, f = (t) => {
|
|
11
|
+
const [e, s] = t.split(":").map(Number);
|
|
12
|
+
return e * 60 + s;
|
|
13
|
+
}, g = (t) => t ? Math.max(1, Math.round(t / 60)) : 1, C = (t, e) => {
|
|
14
|
+
const s = t ? parseInt(String(t).split(":")[0], 10) : 0, i = e ? parseInt(String(e).split(":")[0], 10) : 23;
|
|
15
|
+
return Array.from({ length: i - s + 1 }, (n, r) => r + s);
|
|
16
|
+
}, O = (t) => {
|
|
17
|
+
const e = g(t);
|
|
18
|
+
return Array.from({ length: Math.floor(60 / e) }, (s, i) => i * e);
|
|
19
|
+
}, T = (t, e, s, i) => {
|
|
20
|
+
let a = t !== "" ? parseInt(t, 10) : s === 1 ? 0 : 23, p = e !== "" ? parseInt(e, 10) : s === 1 ? 0 : Math.floor(59 / i) * i;
|
|
21
|
+
return p += s * i, p > 59 ? (p = 0, a = (a + 1) % 24) : p < 0 && (p = Math.floor(59 / i) * i, a = (a - 1 + 24) % 24), {
|
|
22
|
+
hours: String(a).padStart(2, "0"),
|
|
23
|
+
minutes: String(p).padStart(2, "0")
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
var M = Object.defineProperty, V = Object.getOwnPropertyDescriptor, l = (t, e, s, i) => {
|
|
27
|
+
for (var n = i > 1 ? void 0 : i ? V(e, s) : e, r = t.length - 1, a; r >= 0; r--)
|
|
28
|
+
(a = t[r]) && (n = (i ? a(e, s, n) : a(n)) || n);
|
|
29
|
+
return i && n && M(e, s, n), n;
|
|
30
|
+
};
|
|
31
|
+
let h = class extends I {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments), this.hiddenInputRef = m(), this.hoursInputRef = m(), this.minutesInputRef = m(), this.buttonRef = m(), this.value = "", this.hidePicker = !1, this.stepArrows = !1, this._hours = "", this._minutes = "", this._isOpen = !1, this._hoursDigitCount = 0, this._hoursFirstDigit = -1, this._minutesDigitCount = 0, this._minutesFirstDigit = -1, this._hasFocus = !1, this._outsideClickHandler = (t) => {
|
|
34
|
+
this.contains(t.target) || this._closePopup();
|
|
35
|
+
}, this._handleComponentFocusIn = () => {
|
|
36
|
+
this._hasFocus || (this._hasFocus = !0, this.onFocus());
|
|
37
|
+
}, this._handleComponentFocusOut = (t) => {
|
|
38
|
+
this.contains(t.relatedTarget) || (this._hasFocus = !1, this.onBlur());
|
|
39
|
+
}, this._handleHoursKeydown = (t) => {
|
|
40
|
+
var s, i, n;
|
|
41
|
+
const e = t.target;
|
|
42
|
+
switch (t.key) {
|
|
43
|
+
case "ArrowUp": {
|
|
44
|
+
t.preventDefault();
|
|
45
|
+
const r = this._hours !== "" ? parseInt(this._hours, 10) : 0;
|
|
46
|
+
this._hours = String((r + 1) % 24).padStart(2, "0"), this._syncValueFromDisplay(), this.onInput();
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case "ArrowDown": {
|
|
50
|
+
t.preventDefault();
|
|
51
|
+
const r = this._hours !== "" ? parseInt(this._hours, 10) : 0;
|
|
52
|
+
this._hours = String((r - 1 + 24) % 24).padStart(2, "0"), this._syncValueFromDisplay(), this.onInput();
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case "ArrowRight":
|
|
56
|
+
t.preventDefault(), (s = this.minutesInputRef.value) == null || s.focus();
|
|
57
|
+
break;
|
|
58
|
+
case "Backspace":
|
|
59
|
+
case "Delete":
|
|
60
|
+
this._hoursDigitCount = 0, this._hoursFirstDigit = -1;
|
|
61
|
+
break;
|
|
62
|
+
case "Tab":
|
|
63
|
+
break;
|
|
64
|
+
case "Enter": {
|
|
65
|
+
t.preventDefault();
|
|
66
|
+
const r = this.internals.form;
|
|
67
|
+
r ? r.requestSubmit() : e.blur();
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
default:
|
|
71
|
+
if (/^\d$/.test(t.key)) {
|
|
72
|
+
t.preventDefault();
|
|
73
|
+
const r = parseInt(t.key, 10);
|
|
74
|
+
if (this._hoursDigitCount === 0)
|
|
75
|
+
this._hoursFirstDigit = r, this._hours = String(r).padStart(2, "0"), this._hoursDigitCount = 1, this.onInput(), r >= 3 && (this._hoursFirstDigit = -1, this._hoursDigitCount = 0, this._syncValueFromDisplay(), (i = this.minutesInputRef.value) == null || i.focus());
|
|
76
|
+
else {
|
|
77
|
+
const a = this._hoursFirstDigit * 10 + r;
|
|
78
|
+
this._hours = a <= 23 ? String(a).padStart(2, "0") : String(r).padStart(2, "0"), this._hoursFirstDigit = -1, this._hoursDigitCount = 0, this._syncValueFromDisplay(), this.onInput(), (n = this.minutesInputRef.value) == null || n.focus();
|
|
79
|
+
}
|
|
80
|
+
} else
|
|
81
|
+
t.preventDefault();
|
|
82
|
+
}
|
|
83
|
+
}, this._handleHoursBlur = () => {
|
|
84
|
+
this._hours !== "" && (this._hours = String(parseInt(this._hours, 10)).padStart(2, "0")), this._hoursDigitCount = 0, this._hoursFirstDigit = -1, this._syncValueFromDisplay();
|
|
85
|
+
}, this._handleMinutesKeydown = (t) => {
|
|
86
|
+
var s;
|
|
87
|
+
const e = t.target;
|
|
88
|
+
switch (t.key) {
|
|
89
|
+
case "ArrowUp": {
|
|
90
|
+
t.preventDefault();
|
|
91
|
+
const i = this._minutes !== "" ? parseInt(this._minutes, 10) : 0;
|
|
92
|
+
this._minutes = String((i + this._minuteStep) % 60).padStart(2, "0"), this._syncValueFromDisplay(), this.onInput();
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
case "ArrowDown": {
|
|
96
|
+
t.preventDefault();
|
|
97
|
+
const i = this._minutes !== "" ? parseInt(this._minutes, 10) : 0;
|
|
98
|
+
this._minutes = String((i - this._minuteStep + 60) % 60).padStart(2, "0"), this._syncValueFromDisplay(), this.onInput();
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case "ArrowLeft":
|
|
102
|
+
t.preventDefault(), (s = this.hoursInputRef.value) == null || s.focus();
|
|
103
|
+
break;
|
|
104
|
+
case "Backspace":
|
|
105
|
+
case "Delete":
|
|
106
|
+
this._minutesDigitCount = 0, this._minutesFirstDigit = -1;
|
|
107
|
+
break;
|
|
108
|
+
case "Tab":
|
|
109
|
+
break;
|
|
110
|
+
case "Enter": {
|
|
111
|
+
t.preventDefault();
|
|
112
|
+
const i = this.internals.form;
|
|
113
|
+
i ? i.requestSubmit() : e.blur();
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
default:
|
|
117
|
+
if (/^\d$/.test(t.key)) {
|
|
118
|
+
t.preventDefault();
|
|
119
|
+
const i = parseInt(t.key, 10);
|
|
120
|
+
if (this._minutesDigitCount === 0)
|
|
121
|
+
this._minutesFirstDigit = i, this._minutes = String(i).padStart(2, "0"), this._minutesDigitCount = 1, this.onInput(), i >= 6 && (this._minutesFirstDigit = -1, this._minutesDigitCount = 0, this._syncValueFromDisplay());
|
|
122
|
+
else {
|
|
123
|
+
const n = this._minutesFirstDigit * 10 + i;
|
|
124
|
+
this._minutes = n <= 59 ? String(n).padStart(2, "0") : String(i).padStart(2, "0"), this._minutesFirstDigit = -1, this._minutesDigitCount = 0, this._syncValueFromDisplay(), this.onInput();
|
|
125
|
+
}
|
|
126
|
+
} else
|
|
127
|
+
t.preventDefault();
|
|
128
|
+
}
|
|
129
|
+
}, this._handleMinutesBlur = () => {
|
|
130
|
+
this._minutes !== "" && (this._minutes = String(parseInt(this._minutes, 10)).padStart(2, "0")), this._minutesDigitCount = 0, this._minutesFirstDigit = -1, this._syncValueFromDisplay();
|
|
131
|
+
}, this._handlePopupKeydown = (t) => {
|
|
132
|
+
var a;
|
|
133
|
+
const e = document.activeElement, s = e.closest(".pkt-timepicker-popup__col");
|
|
134
|
+
if (!s) return;
|
|
135
|
+
const i = Array.from(s.querySelectorAll(".pkt-timepicker-popup__option")), n = i.indexOf(e), r = e.dataset.type ?? "";
|
|
136
|
+
switch (t.key) {
|
|
137
|
+
case "ArrowDown":
|
|
138
|
+
t.preventDefault(), this._focusOptionAndSync(i[Math.min(n + 1, i.length - 1)], r);
|
|
139
|
+
break;
|
|
140
|
+
case "ArrowUp":
|
|
141
|
+
t.preventDefault(), this._focusOptionAndSync(i[Math.max(n - 1, 0)], r);
|
|
142
|
+
break;
|
|
143
|
+
case "Home":
|
|
144
|
+
t.preventDefault(), this._focusOptionAndSync(i[0], r);
|
|
145
|
+
break;
|
|
146
|
+
case "End":
|
|
147
|
+
t.preventDefault(), this._focusOptionAndSync(i[i.length - 1], r);
|
|
148
|
+
break;
|
|
149
|
+
case "ArrowRight":
|
|
150
|
+
t.preventDefault(), r === "hour" && (this._focusOptionAndSync(e, r), this.updateComplete.then(() => {
|
|
151
|
+
this._scrollToSelected(), this._focusSelectedOrFirst("minute");
|
|
152
|
+
}));
|
|
153
|
+
break;
|
|
154
|
+
case "ArrowLeft":
|
|
155
|
+
t.preventDefault(), r === "minute" && (this._focusOptionAndSync(e, r), this.updateComplete.then(() => {
|
|
156
|
+
this._scrollToSelected(), this._focusSelectedOrFirst("hour");
|
|
157
|
+
}));
|
|
158
|
+
break;
|
|
159
|
+
case "Enter":
|
|
160
|
+
case " ":
|
|
161
|
+
t.preventDefault(), e.click();
|
|
162
|
+
break;
|
|
163
|
+
case "Escape":
|
|
164
|
+
t.preventDefault(), this._closePopup(), (a = this.buttonRef.value) == null || a.focus();
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Exposes hiddenInputRef as inputRef so the base class validate() method
|
|
171
|
+
* triggers our manageValidity override automatically after every onChange call.
|
|
172
|
+
* The hidden input itself is never used for reporting — see manageValidity below.
|
|
173
|
+
*/
|
|
174
|
+
get inputRef() {
|
|
175
|
+
return this.hiddenInputRef;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Overrides the base class manageValidity to solve a focusability problem:
|
|
179
|
+
* the browser requires the third argument to setValidity (the "anchor") to be
|
|
180
|
+
* a visible, focusable element — it focuses that element when navigating to an
|
|
181
|
+
* invalid field. Our hidden input[type=time] cannot receive focus, so passing it
|
|
182
|
+
* as the anchor would silently fail with "form control is not focusable".
|
|
183
|
+
*/
|
|
184
|
+
manageValidity(t) {
|
|
185
|
+
const e = this.hoursInputRef.value;
|
|
186
|
+
if (!e) return;
|
|
187
|
+
if (this.required && !this.value) {
|
|
188
|
+
this.internals.setValidity({ valueMissing: !0 }, c.forms.messages.required, e), this._setAriaInvalid(!0);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (!this.value) {
|
|
192
|
+
this.internals.setValidity({}), this._setAriaInvalid(!1);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const s = f(this.value), i = g(this.step);
|
|
196
|
+
if (this.min && s < f(String(this.min))) {
|
|
197
|
+
this.internals.setValidity(
|
|
198
|
+
{ rangeUnderflow: !0 },
|
|
199
|
+
c.forms.messages.rangeUnderflowMin.replace("{min}", String(this.min)),
|
|
200
|
+
e
|
|
201
|
+
), this._setAriaInvalid(!0);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (this.max && s > f(String(this.max))) {
|
|
205
|
+
this.internals.setValidity(
|
|
206
|
+
{ rangeOverflow: !0 },
|
|
207
|
+
c.forms.messages.rangeOverflowMax.replace("{max}", String(this.max)),
|
|
208
|
+
e
|
|
209
|
+
), this._setAriaInvalid(!0);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (this.step && s % i !== 0) {
|
|
213
|
+
const n = i === 60 ? c.forms.messages.timeStepMismatchHour : i === 30 ? c.forms.messages.timeStepMismatchHalfHour : c.forms.messages.timeStepMismatch.replace(
|
|
214
|
+
"{step}",
|
|
215
|
+
`${i}, ${i * 2}, ${i * 3}`
|
|
216
|
+
);
|
|
217
|
+
this.internals.setValidity({ stepMismatch: !0 }, n, e), this._setAriaInvalid(!0);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
this.internals.setValidity({}), this._setAriaInvalid(!1);
|
|
221
|
+
}
|
|
222
|
+
_setAriaInvalid(t) {
|
|
223
|
+
if (!this.touched && t) return;
|
|
224
|
+
const e = this.hoursInputRef.value, s = this.minutesInputRef.value;
|
|
225
|
+
t ? (e == null || e.setAttribute("aria-invalid", "true"), s == null || s.setAttribute("aria-invalid", "true")) : (e == null || e.removeAttribute("aria-invalid"), s == null || s.removeAttribute("aria-invalid"));
|
|
226
|
+
}
|
|
227
|
+
connectedCallback() {
|
|
228
|
+
super.connectedCallback(), this.addEventListener("focusin", this._handleComponentFocusIn), this.addEventListener("focusout", this._handleComponentFocusOut), document.addEventListener("click", this._outsideClickHandler);
|
|
229
|
+
}
|
|
230
|
+
disconnectedCallback() {
|
|
231
|
+
super.disconnectedCallback(), this.removeEventListener("focusin", this._handleComponentFocusIn), this.removeEventListener("focusout", this._handleComponentFocusOut), document.removeEventListener("click", this._outsideClickHandler);
|
|
232
|
+
}
|
|
233
|
+
willUpdate(t) {
|
|
234
|
+
super.willUpdate(t), t.has("value") && this._syncDisplayFromValue();
|
|
235
|
+
}
|
|
236
|
+
updated(t) {
|
|
237
|
+
super.updated(t), this.classList.toggle("pkt-timepicker--stepper", this.stepArrows), this.classList.toggle("pkt-timepicker--fullwidth", this.fullwidth), t.has("step") && this.step !== null && !this._isValidStep(this.step) && console.warn(
|
|
238
|
+
`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
formResetCallback() {
|
|
242
|
+
super.formResetCallback(), this._hours = "", this._minutes = "", this._isOpen = !1;
|
|
243
|
+
}
|
|
244
|
+
_isValidStep(t) {
|
|
245
|
+
return t === 3600 || t < 3600 && 3600 % t === 0 && t % 60 === 0;
|
|
246
|
+
}
|
|
247
|
+
_syncDisplayFromValue() {
|
|
248
|
+
const t = A(this.value) ? this.value.split(":") : null;
|
|
249
|
+
t ? (this._hours = t[0], this._minutes = t[1]) : (this._hours = "", this._minutes = "");
|
|
250
|
+
}
|
|
251
|
+
_syncValueFromDisplay() {
|
|
252
|
+
if (this._hours !== "" && this._minutes !== "") {
|
|
253
|
+
const t = `${this._hours}:${this._minutes}`;
|
|
254
|
+
t !== this.value && (this.value = t, this.onChange(t));
|
|
255
|
+
} else this.value !== "" && (this.value = "", this.onChange(""));
|
|
256
|
+
}
|
|
257
|
+
get _minuteStep() {
|
|
258
|
+
return g(this.step);
|
|
259
|
+
}
|
|
260
|
+
get _hourOptions() {
|
|
261
|
+
return C(this.min, this.max);
|
|
262
|
+
}
|
|
263
|
+
get _minuteOptions() {
|
|
264
|
+
return O(this.step);
|
|
265
|
+
}
|
|
266
|
+
_openPopup() {
|
|
267
|
+
this._isOpen = !0, this.updateComplete.then(() => {
|
|
268
|
+
this._scrollToSelected(), this._focusSelectedOrFirst("hour");
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
_closePopup() {
|
|
272
|
+
this._isOpen = !1, this._syncValueFromDisplay();
|
|
273
|
+
}
|
|
274
|
+
_togglePopup() {
|
|
275
|
+
this._isOpen ? this._closePopup() : this._openPopup();
|
|
276
|
+
}
|
|
277
|
+
_scrollToSelected() {
|
|
278
|
+
const t = this.querySelector(".pkt-timepicker-popup");
|
|
279
|
+
t && t.querySelectorAll(".pkt-timepicker-popup__col").forEach((e) => {
|
|
280
|
+
const s = e.querySelector(".pkt-timepicker-popup__option--selected");
|
|
281
|
+
s && s.scrollIntoView({ block: "center" });
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
_focusSelectedOrFirst(t) {
|
|
285
|
+
var a;
|
|
286
|
+
const e = this.querySelector(".pkt-timepicker-popup");
|
|
287
|
+
if (!e) return;
|
|
288
|
+
const s = e.querySelectorAll(".pkt-timepicker-popup__col"), i = t === "hour" ? s[0] : s[1];
|
|
289
|
+
if (!i) return;
|
|
290
|
+
const n = i.querySelector(
|
|
291
|
+
".pkt-timepicker-popup__option--selected"
|
|
292
|
+
), r = i.querySelector(".pkt-timepicker-popup__option");
|
|
293
|
+
(a = n || r) == null || a.focus();
|
|
294
|
+
}
|
|
295
|
+
_handleOptionClick(t, e) {
|
|
296
|
+
var i;
|
|
297
|
+
const s = String(t).padStart(2, "0");
|
|
298
|
+
e === "hour" ? (this._hours = s, this.updateComplete.then(() => this._focusSelectedOrFirst("minute"))) : (this._minutes = s, this._closePopup(), (i = this.buttonRef.value) == null || i.focus());
|
|
299
|
+
}
|
|
300
|
+
_focusOptionAndSync(t, e) {
|
|
301
|
+
if (!t) return;
|
|
302
|
+
const s = parseInt(t.dataset.value ?? "0", 10);
|
|
303
|
+
e === "hour" ? this._hours = String(s).padStart(2, "0") : this._minutes = String(s).padStart(2, "0"), t.focus();
|
|
304
|
+
}
|
|
305
|
+
_stepTime(t) {
|
|
306
|
+
const e = T(this._hours, this._minutes, t, this._minuteStep);
|
|
307
|
+
this._hours = e.hours, this._minutes = e.minutes, this._syncValueFromDisplay();
|
|
308
|
+
}
|
|
309
|
+
_renderOption(t, e) {
|
|
310
|
+
const s = String(t).padStart(2, "0"), i = e === "hour" ? this._hours !== "" ? parseInt(this._hours, 10) : NaN : this._minutes !== "" ? parseInt(this._minutes, 10) : NaN, n = t === i;
|
|
311
|
+
return u`
|
|
312
|
+
<button
|
|
313
|
+
class=${x({
|
|
314
|
+
"pkt-btn": !0,
|
|
315
|
+
"pkt-btn--tertiary": !0,
|
|
316
|
+
"pkt-btn--small": !0,
|
|
317
|
+
"pkt-btn--label-only": !0,
|
|
318
|
+
"pkt-timepicker-popup__option": !0,
|
|
319
|
+
"pkt-timepicker-popup__option--selected": n
|
|
320
|
+
})}
|
|
321
|
+
type="button"
|
|
322
|
+
role="option"
|
|
323
|
+
aria-selected=${n ? "true" : "false"}
|
|
324
|
+
tabindex=${n ? "0" : "-1"}
|
|
325
|
+
data-type=${e}
|
|
326
|
+
data-value=${t}
|
|
327
|
+
@click=${(r) => {
|
|
328
|
+
r.stopImmediatePropagation(), this._handleOptionClick(t, e);
|
|
329
|
+
}}
|
|
330
|
+
>
|
|
331
|
+
<span class="pkt-btn__text pkt-txt-14-light">${s}</span>
|
|
332
|
+
</button>
|
|
333
|
+
`;
|
|
334
|
+
}
|
|
335
|
+
_renderPopup() {
|
|
336
|
+
var t, e, s;
|
|
337
|
+
return u`
|
|
338
|
+
<div
|
|
339
|
+
class="pkt-timepicker-popup"
|
|
340
|
+
id=${this.id + "-popup"}
|
|
341
|
+
?hidden=${!this._isOpen}
|
|
342
|
+
role="group"
|
|
343
|
+
aria-label=${((t = this.strings.timepicker) == null ? void 0 : t.selectTime) ?? "Velg tidspunkt"}
|
|
344
|
+
@keydown=${this._handlePopupKeydown}
|
|
345
|
+
@focusout=${(i) => {
|
|
346
|
+
var n;
|
|
347
|
+
(n = this.querySelector(".pkt-timepicker-popup")) != null && n.contains(i.relatedTarget) || this._closePopup();
|
|
348
|
+
}}
|
|
349
|
+
>
|
|
350
|
+
<div
|
|
351
|
+
class="pkt-timepicker-popup__col"
|
|
352
|
+
role="listbox"
|
|
353
|
+
aria-label=${((e = this.strings.timepicker) == null ? void 0 : e.hours) ?? "Timer"}
|
|
354
|
+
aria-orientation="vertical"
|
|
355
|
+
>
|
|
356
|
+
${this._hourOptions.map((i) => this._renderOption(i, "hour"))}
|
|
357
|
+
</div>
|
|
358
|
+
<div
|
|
359
|
+
class="pkt-timepicker-popup__col"
|
|
360
|
+
role="listbox"
|
|
361
|
+
aria-label=${((s = this.strings.timepicker) == null ? void 0 : s.minutes) ?? "Minutter"}
|
|
362
|
+
aria-orientation="vertical"
|
|
363
|
+
>
|
|
364
|
+
${this._minuteOptions.map((i) => this._renderOption(i, "minute"))}
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
`;
|
|
368
|
+
}
|
|
369
|
+
_renderContainer() {
|
|
370
|
+
var n, r, a, p, $, y, S, D;
|
|
371
|
+
const t = ((n = this.strings.timepicker) == null ? void 0 : n.hours) ?? "Timer", e = ((r = this.strings.timepicker) == null ? void 0 : r.minutes) ?? "Minutter", s = this.label ? `${t}, ${this.label}` : t, i = this.label ? `${e}, ${this.label}` : e;
|
|
372
|
+
return u`
|
|
373
|
+
<div class="pkt-input__container">
|
|
374
|
+
${this.stepArrows ? u`
|
|
375
|
+
<button
|
|
376
|
+
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--prev"
|
|
377
|
+
type="button"
|
|
378
|
+
aria-label=${((a = this.strings.timepicker) == null ? void 0 : a.prevTime) ?? "Forrige tidspunkt"}
|
|
379
|
+
?disabled=${this.disabled}
|
|
380
|
+
@click=${() => this._stepTime(-1)}
|
|
381
|
+
>
|
|
382
|
+
<pkt-icon name="chevron-thin-left"></pkt-icon>
|
|
383
|
+
<span class="pkt-btn__text"
|
|
384
|
+
>${((p = this.strings.timepicker) == null ? void 0 : p.prevTime) ?? "Forrige tidspunkt"}</span
|
|
385
|
+
>
|
|
386
|
+
</button>
|
|
387
|
+
` : o}
|
|
388
|
+
<input
|
|
389
|
+
${_(this.hoursInputRef)}
|
|
390
|
+
type="text"
|
|
391
|
+
inputmode="numeric"
|
|
392
|
+
maxlength="2"
|
|
393
|
+
size="2"
|
|
394
|
+
class="pkt-input pkt-timepicker__input"
|
|
395
|
+
id=${this.id + "-hours"}
|
|
396
|
+
data-min="0"
|
|
397
|
+
data-max="23"
|
|
398
|
+
.value=${this._hours}
|
|
399
|
+
placeholder="––"
|
|
400
|
+
aria-label=${s}
|
|
401
|
+
role="spinbutton"
|
|
402
|
+
aria-invalid=${this.hasError ? "true" : o}
|
|
403
|
+
aria-valuemin="0"
|
|
404
|
+
aria-valuemax="23"
|
|
405
|
+
aria-valuenow=${this._hours !== "" ? this._hours : o}
|
|
406
|
+
aria-valuetext=${this._hours !== "" ? `${this._hours} ${t.toLowerCase()}` : o}
|
|
407
|
+
autocomplete="off"
|
|
408
|
+
?disabled=${this.disabled}
|
|
409
|
+
@keydown=${this._handleHoursKeydown}
|
|
410
|
+
@blur=${this._handleHoursBlur}
|
|
411
|
+
@focus=${(d) => {
|
|
412
|
+
d.target.select(), d.stopImmediatePropagation();
|
|
413
|
+
}}
|
|
414
|
+
/>
|
|
415
|
+
<span class="pkt-timepicker__separator">:</span>
|
|
416
|
+
<input
|
|
417
|
+
${_(this.minutesInputRef)}
|
|
418
|
+
type="text"
|
|
419
|
+
inputmode="numeric"
|
|
420
|
+
maxlength="2"
|
|
421
|
+
size="2"
|
|
422
|
+
class="pkt-input pkt-timepicker__input"
|
|
423
|
+
id=${this.id + "-minutes"}
|
|
424
|
+
data-min="0"
|
|
425
|
+
data-max="59"
|
|
426
|
+
.value=${this._minutes}
|
|
427
|
+
placeholder="––"
|
|
428
|
+
aria-label=${i}
|
|
429
|
+
role="spinbutton"
|
|
430
|
+
aria-invalid=${this.hasError ? "true" : o}
|
|
431
|
+
aria-valuemin="0"
|
|
432
|
+
aria-valuemax="59"
|
|
433
|
+
aria-valuenow=${this._minutes !== "" ? this._minutes : o}
|
|
434
|
+
aria-valuetext=${this._minutes !== "" ? `${this._minutes} ${e.toLowerCase()}` : o}
|
|
435
|
+
autocomplete="off"
|
|
436
|
+
?disabled=${this.disabled}
|
|
437
|
+
@keydown=${this._handleMinutesKeydown}
|
|
438
|
+
@blur=${this._handleMinutesBlur}
|
|
439
|
+
@focus=${(d) => {
|
|
440
|
+
d.target.select(), d.stopImmediatePropagation();
|
|
441
|
+
}}
|
|
442
|
+
/>
|
|
443
|
+
${this.hidePicker && !this.stepArrows ? u`<pkt-icon
|
|
444
|
+
class="pkt-input-icon pkt-timepicker__icon"
|
|
445
|
+
name="clock"
|
|
446
|
+
aria-hidden="true"
|
|
447
|
+
></pkt-icon>` : o}
|
|
448
|
+
${!this.hidePicker && !this.stepArrows ? u`
|
|
449
|
+
<button
|
|
450
|
+
${_(this.buttonRef)}
|
|
451
|
+
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button"
|
|
452
|
+
type="button"
|
|
453
|
+
aria-label=${(($ = this.strings.timepicker) == null ? void 0 : $.openPicker) ?? "Åpne tidspunkt-velger"}
|
|
454
|
+
aria-haspopup="listbox"
|
|
455
|
+
aria-expanded=${this._isOpen ? "true" : "false"}
|
|
456
|
+
aria-controls=${this.id + "-popup"}
|
|
457
|
+
?disabled=${this.disabled}
|
|
458
|
+
@click=${this._togglePopup}
|
|
459
|
+
>
|
|
460
|
+
<pkt-icon name="clock"></pkt-icon>
|
|
461
|
+
<span class="pkt-btn__text"
|
|
462
|
+
>${((y = this.strings.timepicker) == null ? void 0 : y.openPicker) ?? "Åpne tidspunkt-velger"}</span
|
|
463
|
+
>
|
|
464
|
+
</button>
|
|
465
|
+
` : o}
|
|
466
|
+
${this.stepArrows ? u`
|
|
467
|
+
<button
|
|
468
|
+
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--next"
|
|
469
|
+
type="button"
|
|
470
|
+
aria-label=${((S = this.strings.timepicker) == null ? void 0 : S.nextTime) ?? "Neste tidspunkt"}
|
|
471
|
+
?disabled=${this.disabled}
|
|
472
|
+
@click=${() => this._stepTime(1)}
|
|
473
|
+
>
|
|
474
|
+
<pkt-icon name="chevron-thin-right"></pkt-icon>
|
|
475
|
+
<span class="pkt-btn__text"
|
|
476
|
+
>${((D = this.strings.timepicker) == null ? void 0 : D.nextTime) ?? "Neste tidspunkt"}</span
|
|
477
|
+
>
|
|
478
|
+
</button>
|
|
479
|
+
` : o}
|
|
480
|
+
<input
|
|
481
|
+
${_(this.hiddenInputRef)}
|
|
482
|
+
type="time"
|
|
483
|
+
hidden
|
|
484
|
+
name=${this.name || this.id}
|
|
485
|
+
id=${this.id + "-input"}
|
|
486
|
+
.value=${this.value}
|
|
487
|
+
min=${k(this.min ?? void 0)}
|
|
488
|
+
max=${k(this.max ?? void 0)}
|
|
489
|
+
step=${k(this.step ?? void 0)}
|
|
490
|
+
?required=${this.required}
|
|
491
|
+
?disabled=${this.disabled}
|
|
492
|
+
tabindex="-1"
|
|
493
|
+
/>
|
|
494
|
+
</div>
|
|
495
|
+
`;
|
|
496
|
+
}
|
|
497
|
+
render() {
|
|
498
|
+
return u`
|
|
499
|
+
<pkt-input-wrapper
|
|
500
|
+
label="${this.label}"
|
|
501
|
+
?disabled=${this.disabled}
|
|
502
|
+
?fullwidth=${this.fullwidth}
|
|
503
|
+
?hasError=${this.hasError}
|
|
504
|
+
?inline=${this.inline}
|
|
505
|
+
?optionalTag=${this.optionalTag}
|
|
506
|
+
?required=${this.required}
|
|
507
|
+
?requiredTag=${this.requiredTag}
|
|
508
|
+
useWrapper=${this.useWrapper}
|
|
509
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
510
|
+
.errorMessage=${this.errorMessage}
|
|
511
|
+
.forId="${this.id + "-hours"}"
|
|
512
|
+
.helptext=${this.helptext}
|
|
513
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
514
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
515
|
+
.optionalText=${this.optionalText}
|
|
516
|
+
.requiredText=${this.requiredText}
|
|
517
|
+
.tagText=${this.tagText}
|
|
518
|
+
>
|
|
519
|
+
<div class="pkt-contents" slot="helptext">${F(this, "helptext")}</div>
|
|
520
|
+
${!this.hidePicker && !this.stepArrows ? u`
|
|
521
|
+
<div class="pkt-timepicker__anchor">
|
|
522
|
+
${this._renderContainer()} ${this._renderPopup()}
|
|
523
|
+
</div>
|
|
524
|
+
` : this._renderContainer()}
|
|
525
|
+
</pkt-input-wrapper>
|
|
526
|
+
`;
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
l([
|
|
530
|
+
b({ type: String, reflect: !0 })
|
|
531
|
+
], h.prototype, "value", 2);
|
|
532
|
+
l([
|
|
533
|
+
b({ type: Boolean, reflect: !0, attribute: "hide-picker" })
|
|
534
|
+
], h.prototype, "hidePicker", 2);
|
|
535
|
+
l([
|
|
536
|
+
b({ type: Boolean, reflect: !0, attribute: "step-arrows" })
|
|
537
|
+
], h.prototype, "stepArrows", 2);
|
|
538
|
+
l([
|
|
539
|
+
v()
|
|
540
|
+
], h.prototype, "_hours", 2);
|
|
541
|
+
l([
|
|
542
|
+
v()
|
|
543
|
+
], h.prototype, "_minutes", 2);
|
|
544
|
+
l([
|
|
545
|
+
v()
|
|
546
|
+
], h.prototype, "_isOpen", 2);
|
|
547
|
+
h = l([
|
|
548
|
+
w("pkt-timepicker")
|
|
549
|
+
], h);
|
|
550
|
+
export {
|
|
551
|
+
h as PktTimepicker
|
|
552
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { e as n } from "./class-map-
|
|
2
|
-
import { E as g, P as _, A as c, b, n as u, t as $ } from "./element-
|
|
3
|
-
import { r as h } from "./state-
|
|
4
|
-
import { e as y, n as A } from "./ref-
|
|
1
|
+
import { e as n } from "./class-map-CEnykyO_.js";
|
|
2
|
+
import { E as g, P as _, A as c, b, n as u, t as $ } from "./element-CPpT3rFQ.js";
|
|
3
|
+
import { r as h } from "./state-C_1EOo3D.js";
|
|
4
|
+
import { e as y, n as A } from "./ref-Bg_Swj5w.js";
|
|
5
5
|
import { e as x, i as T, t as k } from "./directive-oAbCiebi.js";
|
|
6
6
|
import { u as d } from "./utils-DznhwRXm.js";
|
|
7
|
-
import "./icon-
|
|
7
|
+
import "./icon-BlKA8YuW.js";
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2018 Google LLC
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const n=require("./class-map-
|
|
1
|
+
"use strict";const n=require("./class-map-CsENJXf1.cjs"),e=require("./element-gR_VtSiD.cjs"),p=require("./state-Dg-53wQ8.cjs"),h=require("./ref-CL-Xk9Xm.cjs"),b=require("./directive-C7oCP5Bh.cjs"),d=require("./utils-byXsEz1u.cjs");require("./icon-Bqj9oBbl.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { b as h, A as n, n as s, t as d } from "./element-
|
|
2
|
-
import { r as k } from "./state-
|
|
3
|
-
import { P as f } from "./input-element-
|
|
4
|
-
import { e as g, n as b } from "./ref-
|
|
5
|
-
import { e as u } from "./class-map-
|
|
1
|
+
import { b as h, A as n, n as s, t as d } from "./element-CPpT3rFQ.js";
|
|
2
|
+
import { r as k } from "./state-C_1EOo3D.js";
|
|
3
|
+
import { P as f } from "./input-element-8nLwuQS4.js";
|
|
4
|
+
import { e as g, n as b } from "./ref-Bg_Swj5w.js";
|
|
5
|
+
import { e as u } from "./class-map-CEnykyO_.js";
|
|
6
6
|
var y = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, i = (e, a, c, l) => {
|
|
7
7
|
for (var p = l > 1 ? void 0 : l ? $(a, c) : a, r = e.length - 1, o; r >= 0; r--)
|
|
8
8
|
(o = e[r]) && (p = (l ? o(a, c, p) : o(p)) || p);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-
|
|
1
|
+
"use strict";const t=require("./element-gR_VtSiD.cjs"),r=require("./state-Dg-53wQ8.cjs"),u=require("./input-element-DdVhUvva.cjs"),h=require("./ref-CL-Xk9Xm.cjs"),c=require("./class-map-CsENJXf1.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,i=(p,e,n,a)=>{for(var s=a>1?void 0:a?k(e,n):e,o=p.length-1,l;o>=0;o--)(l=p[o])&&(s=(a?l(e,n,s):l(s))||s);return a&&s&&d(e,n,s),s};exports.PktRadioButton=class extends u.PktInputElement{constructor(){super(...arguments),this.inputRef=h.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,n,a){e==="defaultChecked"&&(this._checked=this.defaultChecked),e==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,n,a)}render(){const e=c.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=c.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),a=c.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),s="pkt-tag pkt-tag--small pkt-tag--thin-text",o=()=>t.b`
|
|
2
2
|
${this.tagText?t.b`<span class=${s+" pkt-tag--gray"}>${this.tagText}</span>`:t.A}
|
|
3
3
|
${this.optionalTag?t.b`<span class=${s+" pkt-tag--blue-light"}>${this.optionalText}</span>`:t.A}
|
|
4
4
|
${this.requiredTag?t.b`<span class=${s+" pkt-tag--beige"}>${this.requiredText}</span>`:t.A}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as o } from "./element-
|
|
2
|
-
import { f as n } from "./async-directive-
|
|
1
|
+
import { A as o } from "./element-CPpT3rFQ.js";
|
|
2
|
+
import { f as n } from "./async-directive-CMzWMlZ5.js";
|
|
3
3
|
import { e as r } from "./directive-oAbCiebi.js";
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const n=require("./element-
|
|
1
|
+
"use strict";const n=require("./element-gR_VtSiD.cjs"),o=require("./async-directive-DoMuclel.cjs"),c=require("./directive-C7oCP5Bh.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as w } from "./element-
|
|
1
|
+
import { E as w } from "./element-CPpT3rFQ.js";
|
|
2
2
|
import { e as A, i as E, t as M } from "./directive-oAbCiebi.js";
|
|
3
|
-
import { M as b, u as p, v, h as x, p as j } from "./directive-helpers-
|
|
3
|
+
import { M as b, u as p, v, h as x, p as j } from "./directive-helpers-rm-28gIj.js";
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2017 Google LLC
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const w=require("./element-
|
|
1
|
+
"use strict";const w=require("./element-gR_VtSiD.cjs"),x=require("./directive-C7oCP5Bh.cjs"),s=require("./directive-helpers-BP2WOx60.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as u, b as a, t as v } from "./element-
|
|
2
|
-
import { e as f, n as _ } from "./ref-
|
|
3
|
-
import { o as l } from "./if-defined-
|
|
4
|
-
import { r as $ } from "./state-
|
|
5
|
-
import { P as x } from "./input-element-
|
|
6
|
-
import { P as m } from "./pkt-options-controller-
|
|
7
|
-
import { s as b } from "./element-with-slot-
|
|
8
|
-
import "./input-wrapper-
|
|
1
|
+
import { n as u, b as a, t as v } from "./element-CPpT3rFQ.js";
|
|
2
|
+
import { e as f, n as _ } from "./ref-Bg_Swj5w.js";
|
|
3
|
+
import { o as l } from "./if-defined-B0krMLad.js";
|
|
4
|
+
import { r as $ } from "./state-C_1EOo3D.js";
|
|
5
|
+
import { P as x } from "./input-element-8nLwuQS4.js";
|
|
6
|
+
import { P as m } from "./pkt-options-controller-B5YalfCb.js";
|
|
7
|
+
import { s as b } from "./element-with-slot-Dqk6-TRR.js";
|
|
8
|
+
import "./input-wrapper-B2JpK016.js";
|
|
9
9
|
var g = Object.defineProperty, d = (e, t, s, o) => {
|
|
10
10
|
for (var i = void 0, n = e.length - 1, p; n >= 0; n--)
|
|
11
11
|
(p = e[n]) && (i = p(t, s, i) || i);
|