@oslokommune/punkt-elements 16.7.0 → 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 +34 -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 +22 -19
- package/dist/pkt-timepicker.js +84 -76
- 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 +14 -2
- 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
package/dist/pkt-timepicker.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { s as c, b as u, A as
|
|
1
|
+
import { t as I, s as c, b as u, A as p, n as b } from "./element-CPpT3rFQ.js";
|
|
2
2
|
import { r as v } from "./state-C_1EOo3D.js";
|
|
3
3
|
import { e as m, n as _ } from "./ref-Bg_Swj5w.js";
|
|
4
4
|
import { o as k } from "./if-defined-B0krMLad.js";
|
|
5
|
-
import { e as
|
|
6
|
-
import { P as
|
|
7
|
-
import { s as
|
|
8
|
-
import "./icon-
|
|
9
|
-
import "./input-wrapper-
|
|
10
|
-
const
|
|
11
|
-
const [
|
|
12
|
-
return
|
|
13
|
-
}, g = (
|
|
14
|
-
const
|
|
15
|
-
return Array.from({ length:
|
|
16
|
-
},
|
|
17
|
-
const
|
|
18
|
-
return Array.from({ length: Math.floor(60 /
|
|
19
|
-
},
|
|
20
|
-
let
|
|
21
|
-
return
|
|
22
|
-
hours: String(
|
|
23
|
-
minutes: String(
|
|
5
|
+
import { e as F } from "./class-map-CEnykyO_.js";
|
|
6
|
+
import { P as A } from "./input-element-8nLwuQS4.js";
|
|
7
|
+
import { s as C } from "./element-with-slot-Dqk6-TRR.js";
|
|
8
|
+
import "./icon-CxQcIa5F.js";
|
|
9
|
+
import "./input-wrapper-Bs4CRNst.js";
|
|
10
|
+
const O = (a) => /^\d{2}:\d{2}$/.test(a) && parseInt(a.slice(0, 2), 10) <= 23 && parseInt(a.slice(3), 10) <= 59, f = (a) => {
|
|
11
|
+
const [t, e] = a.split(":").map(Number);
|
|
12
|
+
return t * 60 + e;
|
|
13
|
+
}, g = (a) => a ? Math.max(1, Math.round(a / 60)) : 1, T = (a, t) => {
|
|
14
|
+
const e = a ? parseInt(String(a).split(":")[0], 10) : 0, s = t ? parseInt(String(t).split(":")[0], 10) : 23;
|
|
15
|
+
return Array.from({ length: s - e + 1 }, (i, n) => n + e);
|
|
16
|
+
}, M = (a) => {
|
|
17
|
+
const t = g(a);
|
|
18
|
+
return Array.from({ length: Math.floor(60 / t) }, (e, s) => s * t);
|
|
19
|
+
}, V = (a, t, e, s) => {
|
|
20
|
+
let r = a !== "" ? parseInt(a, 10) : e === 1 ? 0 : 23, o = t !== "" ? parseInt(t, 10) : e === 1 ? 0 : Math.floor(59 / s) * s;
|
|
21
|
+
return o += e * s, o > 59 ? (o = 0, r = (r + 1) % 24) : o < 0 && (o = Math.floor(59 / s) * s, r = (r - 1 + 24) % 24), {
|
|
22
|
+
hours: String(r).padStart(2, "0"),
|
|
23
|
+
minutes: String(o).padStart(2, "0")
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
var
|
|
27
|
-
for (var
|
|
28
|
-
(
|
|
29
|
-
return i &&
|
|
26
|
+
var P = Object.defineProperty, d = (a, t, e, s) => {
|
|
27
|
+
for (var i = void 0, n = a.length - 1, r; n >= 0; n--)
|
|
28
|
+
(r = a[n]) && (i = r(t, e, i) || i);
|
|
29
|
+
return i && P(t, e, i), i;
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
class l extends A {
|
|
32
32
|
constructor() {
|
|
33
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
34
|
this.contains(t.target) || this._closePopup();
|
|
@@ -74,8 +74,8 @@ let h = class extends I {
|
|
|
74
74
|
if (this._hoursDigitCount === 0)
|
|
75
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
76
|
else {
|
|
77
|
-
const
|
|
78
|
-
this._hours =
|
|
77
|
+
const o = this._hoursFirstDigit * 10 + r;
|
|
78
|
+
this._hours = o <= 23 ? String(o).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
79
|
}
|
|
80
80
|
} else
|
|
81
81
|
t.preventDefault();
|
|
@@ -129,7 +129,7 @@ let h = class extends I {
|
|
|
129
129
|
}, this._handleMinutesBlur = () => {
|
|
130
130
|
this._minutes !== "" && (this._minutes = String(parseInt(this._minutes, 10)).padStart(2, "0")), this._minutesDigitCount = 0, this._minutesFirstDigit = -1, this._syncValueFromDisplay();
|
|
131
131
|
}, this._handlePopupKeydown = (t) => {
|
|
132
|
-
var
|
|
132
|
+
var o;
|
|
133
133
|
const e = document.activeElement, s = e.closest(".pkt-timepicker-popup__col");
|
|
134
134
|
if (!s) return;
|
|
135
135
|
const i = Array.from(s.querySelectorAll(".pkt-timepicker-popup__option")), n = i.indexOf(e), r = e.dataset.type ?? "";
|
|
@@ -161,7 +161,7 @@ let h = class extends I {
|
|
|
161
161
|
t.preventDefault(), e.click();
|
|
162
162
|
break;
|
|
163
163
|
case "Escape":
|
|
164
|
-
t.preventDefault(), this._closePopup(), (
|
|
164
|
+
t.preventDefault(), this._closePopup(), (o = this.buttonRef.value) == null || o.focus();
|
|
165
165
|
break;
|
|
166
166
|
}
|
|
167
167
|
};
|
|
@@ -245,7 +245,7 @@ let h = class extends I {
|
|
|
245
245
|
return t === 3600 || t < 3600 && 3600 % t === 0 && t % 60 === 0;
|
|
246
246
|
}
|
|
247
247
|
_syncDisplayFromValue() {
|
|
248
|
-
const t =
|
|
248
|
+
const t = O(this.value) ? this.value.split(":") : null;
|
|
249
249
|
t ? (this._hours = t[0], this._minutes = t[1]) : (this._hours = "", this._minutes = "");
|
|
250
250
|
}
|
|
251
251
|
_syncValueFromDisplay() {
|
|
@@ -258,10 +258,10 @@ let h = class extends I {
|
|
|
258
258
|
return g(this.step);
|
|
259
259
|
}
|
|
260
260
|
get _hourOptions() {
|
|
261
|
-
return
|
|
261
|
+
return T(this.min, this.max);
|
|
262
262
|
}
|
|
263
263
|
get _minuteOptions() {
|
|
264
|
-
return
|
|
264
|
+
return M(this.step);
|
|
265
265
|
}
|
|
266
266
|
_openPopup() {
|
|
267
267
|
this._isOpen = !0, this.updateComplete.then(() => {
|
|
@@ -282,7 +282,7 @@ let h = class extends I {
|
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
284
|
_focusSelectedOrFirst(t) {
|
|
285
|
-
var
|
|
285
|
+
var o;
|
|
286
286
|
const e = this.querySelector(".pkt-timepicker-popup");
|
|
287
287
|
if (!e) return;
|
|
288
288
|
const s = e.querySelectorAll(".pkt-timepicker-popup__col"), i = t === "hour" ? s[0] : s[1];
|
|
@@ -290,7 +290,7 @@ let h = class extends I {
|
|
|
290
290
|
const n = i.querySelector(
|
|
291
291
|
".pkt-timepicker-popup__option--selected"
|
|
292
292
|
), r = i.querySelector(".pkt-timepicker-popup__option");
|
|
293
|
-
(
|
|
293
|
+
(o = n || r) == null || o.focus();
|
|
294
294
|
}
|
|
295
295
|
_handleOptionClick(t, e) {
|
|
296
296
|
var i;
|
|
@@ -303,14 +303,14 @@ let h = class extends I {
|
|
|
303
303
|
e === "hour" ? this._hours = String(s).padStart(2, "0") : this._minutes = String(s).padStart(2, "0"), t.focus();
|
|
304
304
|
}
|
|
305
305
|
_stepTime(t) {
|
|
306
|
-
const e =
|
|
306
|
+
const e = V(this._hours, this._minutes, t, this._minuteStep);
|
|
307
307
|
this._hours = e.hours, this._minutes = e.minutes, this._syncValueFromDisplay();
|
|
308
308
|
}
|
|
309
309
|
_renderOption(t, e) {
|
|
310
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
311
|
return u`
|
|
312
312
|
<button
|
|
313
|
-
class=${
|
|
313
|
+
class=${F({
|
|
314
314
|
"pkt-btn": !0,
|
|
315
315
|
"pkt-btn--tertiary": !0,
|
|
316
316
|
"pkt-btn--small": !0,
|
|
@@ -367,24 +367,30 @@ let h = class extends I {
|
|
|
367
367
|
`;
|
|
368
368
|
}
|
|
369
369
|
_renderContainer() {
|
|
370
|
-
var n, r,
|
|
370
|
+
var n, r, o, $, y, S, D, w;
|
|
371
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
372
|
return u`
|
|
373
|
-
<div
|
|
373
|
+
<div
|
|
374
|
+
class="pkt-input__container"
|
|
375
|
+
@click=${(h) => {
|
|
376
|
+
var x;
|
|
377
|
+
h.target.closest("button, input") || (x = this.hoursInputRef.value) == null || x.focus();
|
|
378
|
+
}}
|
|
379
|
+
>
|
|
374
380
|
${this.stepArrows ? u`
|
|
375
381
|
<button
|
|
376
382
|
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--prev"
|
|
377
383
|
type="button"
|
|
378
|
-
aria-label=${((
|
|
384
|
+
aria-label=${((o = this.strings.timepicker) == null ? void 0 : o.prevTime) ?? "Forrige tidspunkt"}
|
|
379
385
|
?disabled=${this.disabled}
|
|
380
386
|
@click=${() => this._stepTime(-1)}
|
|
381
387
|
>
|
|
382
388
|
<pkt-icon name="chevron-thin-left"></pkt-icon>
|
|
383
389
|
<span class="pkt-btn__text"
|
|
384
|
-
>${((
|
|
390
|
+
>${(($ = this.strings.timepicker) == null ? void 0 : $.prevTime) ?? "Forrige tidspunkt"}</span
|
|
385
391
|
>
|
|
386
392
|
</button>
|
|
387
|
-
` :
|
|
393
|
+
` : p}
|
|
388
394
|
<input
|
|
389
395
|
${_(this.hoursInputRef)}
|
|
390
396
|
type="text"
|
|
@@ -399,17 +405,17 @@ let h = class extends I {
|
|
|
399
405
|
placeholder="––"
|
|
400
406
|
aria-label=${s}
|
|
401
407
|
role="spinbutton"
|
|
402
|
-
aria-invalid=${this.hasError ? "true" :
|
|
408
|
+
aria-invalid=${this.hasError ? "true" : p}
|
|
403
409
|
aria-valuemin="0"
|
|
404
410
|
aria-valuemax="23"
|
|
405
|
-
aria-valuenow=${this._hours !== "" ? this._hours :
|
|
406
|
-
aria-valuetext=${this._hours !== "" ? `${this._hours} ${t.toLowerCase()}` :
|
|
411
|
+
aria-valuenow=${this._hours !== "" ? this._hours : p}
|
|
412
|
+
aria-valuetext=${this._hours !== "" ? `${this._hours} ${t.toLowerCase()}` : p}
|
|
407
413
|
autocomplete="off"
|
|
408
414
|
?disabled=${this.disabled}
|
|
409
415
|
@keydown=${this._handleHoursKeydown}
|
|
410
416
|
@blur=${this._handleHoursBlur}
|
|
411
|
-
@focus=${(
|
|
412
|
-
|
|
417
|
+
@focus=${(h) => {
|
|
418
|
+
h.target.select(), h.stopImmediatePropagation();
|
|
413
419
|
}}
|
|
414
420
|
/>
|
|
415
421
|
<span class="pkt-timepicker__separator">:</span>
|
|
@@ -427,30 +433,30 @@ let h = class extends I {
|
|
|
427
433
|
placeholder="––"
|
|
428
434
|
aria-label=${i}
|
|
429
435
|
role="spinbutton"
|
|
430
|
-
aria-invalid=${this.hasError ? "true" :
|
|
436
|
+
aria-invalid=${this.hasError ? "true" : p}
|
|
431
437
|
aria-valuemin="0"
|
|
432
438
|
aria-valuemax="59"
|
|
433
|
-
aria-valuenow=${this._minutes !== "" ? this._minutes :
|
|
434
|
-
aria-valuetext=${this._minutes !== "" ? `${this._minutes} ${e.toLowerCase()}` :
|
|
439
|
+
aria-valuenow=${this._minutes !== "" ? this._minutes : p}
|
|
440
|
+
aria-valuetext=${this._minutes !== "" ? `${this._minutes} ${e.toLowerCase()}` : p}
|
|
435
441
|
autocomplete="off"
|
|
436
442
|
?disabled=${this.disabled}
|
|
437
443
|
@keydown=${this._handleMinutesKeydown}
|
|
438
444
|
@blur=${this._handleMinutesBlur}
|
|
439
|
-
@focus=${(
|
|
440
|
-
|
|
445
|
+
@focus=${(h) => {
|
|
446
|
+
h.target.select(), h.stopImmediatePropagation();
|
|
441
447
|
}}
|
|
442
448
|
/>
|
|
443
449
|
${this.hidePicker && !this.stepArrows ? u`<pkt-icon
|
|
444
450
|
class="pkt-input-icon pkt-timepicker__icon"
|
|
445
451
|
name="clock"
|
|
446
452
|
aria-hidden="true"
|
|
447
|
-
></pkt-icon>` :
|
|
453
|
+
></pkt-icon>` : p}
|
|
448
454
|
${!this.hidePicker && !this.stepArrows ? u`
|
|
449
455
|
<button
|
|
450
456
|
${_(this.buttonRef)}
|
|
451
457
|
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button"
|
|
452
458
|
type="button"
|
|
453
|
-
aria-label=${((
|
|
459
|
+
aria-label=${((y = this.strings.timepicker) == null ? void 0 : y.openPicker) ?? "Åpne tidspunkt-velger"}
|
|
454
460
|
aria-haspopup="listbox"
|
|
455
461
|
aria-expanded=${this._isOpen ? "true" : "false"}
|
|
456
462
|
aria-controls=${this.id + "-popup"}
|
|
@@ -459,24 +465,24 @@ let h = class extends I {
|
|
|
459
465
|
>
|
|
460
466
|
<pkt-icon name="clock"></pkt-icon>
|
|
461
467
|
<span class="pkt-btn__text"
|
|
462
|
-
>${((
|
|
468
|
+
>${((S = this.strings.timepicker) == null ? void 0 : S.openPicker) ?? "Åpne tidspunkt-velger"}</span
|
|
463
469
|
>
|
|
464
470
|
</button>
|
|
465
|
-
` :
|
|
471
|
+
` : p}
|
|
466
472
|
${this.stepArrows ? u`
|
|
467
473
|
<button
|
|
468
474
|
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--next"
|
|
469
475
|
type="button"
|
|
470
|
-
aria-label=${((
|
|
476
|
+
aria-label=${((D = this.strings.timepicker) == null ? void 0 : D.nextTime) ?? "Neste tidspunkt"}
|
|
471
477
|
?disabled=${this.disabled}
|
|
472
478
|
@click=${() => this._stepTime(1)}
|
|
473
479
|
>
|
|
474
480
|
<pkt-icon name="chevron-thin-right"></pkt-icon>
|
|
475
481
|
<span class="pkt-btn__text"
|
|
476
|
-
>${((
|
|
482
|
+
>${((w = this.strings.timepicker) == null ? void 0 : w.nextTime) ?? "Neste tidspunkt"}</span
|
|
477
483
|
>
|
|
478
484
|
</button>
|
|
479
|
-
` :
|
|
485
|
+
` : p}
|
|
480
486
|
<input
|
|
481
487
|
${_(this.hiddenInputRef)}
|
|
482
488
|
type="time"
|
|
@@ -516,7 +522,7 @@ let h = class extends I {
|
|
|
516
522
|
.requiredText=${this.requiredText}
|
|
517
523
|
.tagText=${this.tagText}
|
|
518
524
|
>
|
|
519
|
-
<div class="pkt-contents" slot="helptext">${
|
|
525
|
+
<div class="pkt-contents" slot="helptext">${C(this, "helptext")}</div>
|
|
520
526
|
${!this.hidePicker && !this.stepArrows ? u`
|
|
521
527
|
<div class="pkt-timepicker__anchor">
|
|
522
528
|
${this._renderContainer()} ${this._renderPopup()}
|
|
@@ -525,28 +531,30 @@ let h = class extends I {
|
|
|
525
531
|
</pkt-input-wrapper>
|
|
526
532
|
`;
|
|
527
533
|
}
|
|
528
|
-
}
|
|
529
|
-
|
|
534
|
+
}
|
|
535
|
+
d([
|
|
530
536
|
b({ type: String, reflect: !0 })
|
|
531
|
-
],
|
|
532
|
-
|
|
537
|
+
], l.prototype, "value");
|
|
538
|
+
d([
|
|
533
539
|
b({ type: Boolean, reflect: !0, attribute: "hide-picker" })
|
|
534
|
-
],
|
|
535
|
-
|
|
540
|
+
], l.prototype, "hidePicker");
|
|
541
|
+
d([
|
|
536
542
|
b({ type: Boolean, reflect: !0, attribute: "step-arrows" })
|
|
537
|
-
],
|
|
538
|
-
|
|
543
|
+
], l.prototype, "stepArrows");
|
|
544
|
+
d([
|
|
539
545
|
v()
|
|
540
|
-
],
|
|
541
|
-
|
|
546
|
+
], l.prototype, "_hours");
|
|
547
|
+
d([
|
|
542
548
|
v()
|
|
543
|
-
],
|
|
544
|
-
|
|
549
|
+
], l.prototype, "_minutes");
|
|
550
|
+
d([
|
|
545
551
|
v()
|
|
546
|
-
],
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
552
|
+
], l.prototype, "_isOpen");
|
|
553
|
+
try {
|
|
554
|
+
I("pkt-timepicker")(l);
|
|
555
|
+
} catch {
|
|
556
|
+
console.warn("Forsøker å definere <pkt-timepicker>, men den er allerede definert");
|
|
557
|
+
}
|
|
550
558
|
export {
|
|
551
|
-
|
|
559
|
+
l as PktTimepicker
|
|
552
560
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";const p=require("./class-map-CsENJXf1.cjs"),e=require("./element-gR_VtSiD.cjs"),h=require("./state-Dg-53wQ8.cjs"),d=require("./ref-CL-Xk9Xm.cjs"),b=require("./directive-C7oCP5Bh.cjs"),c=require("./utils-byXsEz1u.cjs");require("./icon-q81vqPK_.cjs");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2018 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const y="important",m=" !"+y,_=b.e(class extends b.i{constructor(n){var t;if(super(n),n.type!==b.t.ATTRIBUTE||n.name!=="style"||((t=n.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((t,s)=>{const a=n[s];return a==null?t:t+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`},"")}update(n,[t]){const{style:s}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(const a of this.ft)t[a]==null&&(this.ft.delete(a),a.includes("-")?s.removeProperty(a):s[a]=null);for(const a in t){const l=t[a];if(l!=null){this.ft.add(a);const u=typeof l=="string"&&l.endsWith(m);a.includes("-")||u?s.setProperty(a,u?l.slice(0,-11):l,u?y:""):s[a]=l}}return e.E}});var A=Object.defineProperty,i=(n,t,s,a)=>{for(var l=void 0,u=n.length-1,o;u>=0;u--)(o=n[u])&&(l=o(t,s,l)||l);return l&&A(t,s,l),l};class r extends e.PktElement{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive="polite",this.id=c.uuidish(),this.role="progressbar",this.skin="dark-blue",this.statusPlacement="following",this.statusType="none",this.title="",this.titlePosition="left",this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.computedAriaLabelledby=null,this.computedAriaValueText="",this.labelRef=d.e(),this.progressBarRef=d.e()}firstUpdated(t){super.firstUpdated(t),this.setComputedValues(),this.syncAttributes()}updated(t){super.updated(t),t.has("valueCurrent")&&this.labelRef.value&&(this.labelWidth=this.labelRef.value.getBoundingClientRect().width||0),t.has("id")&&this.id&&(this.progressBarId=this.id),(t.has("statusType")||t.has("id")||t.has("ariaLabelledby"))&&(this.progressbarId=this.id||c.uuidish(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`),(t.has("ariaValueText")||t.has("valueCurrent")||t.has("valueMax"))&&(this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""),this.syncAttributes()}render(){const t=this.statusType!=="none",s=this.valueMax-this.valueMin,a=this.valueCurrent/s*100,l=this.statusType==="fraction"?Math.round(a):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),u=`${this.valueCurrent} av ${s}`,o=p.e({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),v=p.e({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition==="center"}),f=p.e({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement==="center"}),g=p.e({"pkt-progressbar__status-placement--following":this.statusPlacement==="following","pkt-progressbar__status-placement--center":this.statusPlacement==="center","pkt-progressbar__status-placement--left":this.statusPlacement==="left"});return e.b` <div
|
|
6
|
+
class="pkt-progressbar__container"
|
|
7
|
+
.ref=${this.progressBarRef}
|
|
8
|
+
style=${_({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${l}%`})}
|
|
9
|
+
>
|
|
10
|
+
${this.title?e.b`<p id=${`${this.progressBarId}-title`} class=${v}>${this.title}</p>`:e.A}
|
|
11
|
+
|
|
12
|
+
<div class="pkt-progressbar__bar-wrapper">
|
|
13
|
+
<div class=${o}></div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
${t?e.b`<div class=${f}>
|
|
17
|
+
<span class=${g} ${d.n(this.labelRef)}>
|
|
18
|
+
${this.statusType==="percentage"?`${l}%`:u}
|
|
19
|
+
</span>
|
|
20
|
+
</div>`:e.A}
|
|
21
|
+
</div>`}setComputedValues(){this.progressbarId=this.id||c.uuidish(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(t,s){s==null||s===""?this.removeAttribute(t):this.setAttribute(t,String(s))}}i([e.n({type:String})],r.prototype,"ariaLabel");i([e.n({type:String,reflect:!0})],r.prototype,"ariaLabelledby");i([e.n({type:String,reflect:!0})],r.prototype,"ariaValueText");i([e.n({type:String})],r.prototype,"ariaLive");i([e.n({type:String,reflect:!0})],r.prototype,"id");i([e.n({type:String})],r.prototype,"role");i([e.n({type:String})],r.prototype,"skin");i([e.n({type:String})],r.prototype,"statusPlacement");i([e.n({type:String})],r.prototype,"statusType");i([e.n({type:String,reflect:!0})],r.prototype,"title");i([e.n({type:String})],r.prototype,"titlePosition");i([e.n({type:Number,reflect:!0})],r.prototype,"valueCurrent");i([e.n({type:Number})],r.prototype,"valueMax");i([e.n({type:Number})],r.prototype,"valueMin");i([h.r()],r.prototype,"labelWidth");i([h.r()],r.prototype,"progressbarId");i([h.r()],r.prototype,"computedAriaLabelledby");i([h.r()],r.prototype,"computedAriaValueText");try{e.t("pkt-progressbar")(r)}catch{console.warn("Forsøker å definere <pkt-progressbar>, men den er allerede definert")}exports.PktProgressbar=r;
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { E as
|
|
1
|
+
import { e as p } from "./class-map-CEnykyO_.js";
|
|
2
|
+
import { E as _, t as $, P as A, A as c, b as d, n as u } from "./element-CPpT3rFQ.js";
|
|
3
3
|
import { r as h } from "./state-C_1EOo3D.js";
|
|
4
|
-
import { e as y, n as
|
|
5
|
-
import { e as x, i as T, t as
|
|
6
|
-
import { u as
|
|
7
|
-
import "./icon-
|
|
4
|
+
import { e as y, n as k } from "./ref-Bg_Swj5w.js";
|
|
5
|
+
import { e as x, i as T, t as C } from "./directive-oAbCiebi.js";
|
|
6
|
+
import { u as b } from "./utils-DznhwRXm.js";
|
|
7
|
+
import "./icon-CxQcIa5F.js";
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2018 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
14
|
-
constructor(
|
|
15
|
-
var
|
|
16
|
-
if (super(
|
|
13
|
+
const f = "important", M = " !" + f, L = x(class extends T {
|
|
14
|
+
constructor(l) {
|
|
15
|
+
var t;
|
|
16
|
+
if (super(l), l.type !== C.ATTRIBUTE || l.name !== "style" || ((t = l.strings) == null ? void 0 : t.length) > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
17
17
|
}
|
|
18
|
-
render(
|
|
19
|
-
return Object.keys(
|
|
20
|
-
const
|
|
21
|
-
return
|
|
18
|
+
render(l) {
|
|
19
|
+
return Object.keys(l).reduce((t, e) => {
|
|
20
|
+
const i = l[e];
|
|
21
|
+
return i == null ? t : t + `${e = e.includes("-") ? e : e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${i};`;
|
|
22
22
|
}, "");
|
|
23
23
|
}
|
|
24
|
-
update(
|
|
25
|
-
const { style:
|
|
26
|
-
if (this.ft === void 0) return this.ft = new Set(Object.keys(
|
|
27
|
-
for (const
|
|
28
|
-
for (const
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
this.ft.add(
|
|
32
|
-
const o = typeof
|
|
33
|
-
|
|
24
|
+
update(l, [t]) {
|
|
25
|
+
const { style: e } = l.element;
|
|
26
|
+
if (this.ft === void 0) return this.ft = new Set(Object.keys(t)), this.render(t);
|
|
27
|
+
for (const i of this.ft) t[i] == null && (this.ft.delete(i), i.includes("-") ? e.removeProperty(i) : e[i] = null);
|
|
28
|
+
for (const i in t) {
|
|
29
|
+
const a = t[i];
|
|
30
|
+
if (a != null) {
|
|
31
|
+
this.ft.add(i);
|
|
32
|
+
const o = typeof a == "string" && a.endsWith(M);
|
|
33
|
+
i.includes("-") || o ? e.setProperty(i, o ? a.slice(0, -11) : a, o ? f : "") : e[i] = a;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
return
|
|
36
|
+
return _;
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
var
|
|
40
|
-
for (var
|
|
41
|
-
(
|
|
42
|
-
return
|
|
39
|
+
var S = Object.defineProperty, r = (l, t, e, i) => {
|
|
40
|
+
for (var a = void 0, o = l.length - 1, n; o >= 0; o--)
|
|
41
|
+
(n = l[o]) && (a = n(t, e, a) || a);
|
|
42
|
+
return a && S(t, e, a), a;
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
class s extends A {
|
|
45
45
|
constructor() {
|
|
46
|
-
super(), this.ariaLabel = null, this.ariaLabelledby = null, this.ariaValueText = null, this.ariaLive = "polite", this.id =
|
|
46
|
+
super(), this.ariaLabel = null, this.ariaLabelledby = null, this.ariaValueText = null, this.ariaLive = "polite", this.id = b(), this.role = "progressbar", this.skin = "dark-blue", this.statusPlacement = "following", this.statusType = "none", this.title = "", this.titlePosition = "left", this.valueCurrent = 0, this.valueMax = 100, this.valueMin = 0, this.labelWidth = 0, this.progressbarId = this.id, this.computedAriaLabelledby = null, this.computedAriaValueText = "", this.labelRef = y(), this.progressBarRef = y();
|
|
47
47
|
}
|
|
48
48
|
firstUpdated(t) {
|
|
49
49
|
super.firstUpdated(t), this.setComputedValues(), this.syncAttributes();
|
|
50
50
|
}
|
|
51
51
|
updated(t) {
|
|
52
|
-
super.updated(t), t.has("valueCurrent") && this.labelRef.value && (this.labelWidth = this.labelRef.value.getBoundingClientRect().width || 0), t.has("id") && this.id && (this.progressBarId = this.id), (t.has("statusType") || t.has("id") || t.has("ariaLabelledby")) && (this.progressbarId = this.id ||
|
|
52
|
+
super.updated(t), t.has("valueCurrent") && this.labelRef.value && (this.labelWidth = this.labelRef.value.getBoundingClientRect().width || 0), t.has("id") && this.id && (this.progressBarId = this.id), (t.has("statusType") || t.has("id") || t.has("ariaLabelledby")) && (this.progressbarId = this.id || b(), this.computedAriaLabelledby = this.ariaLabelledby || `${this.progressbarId}-title`), (t.has("ariaValueText") || t.has("valueCurrent") || t.has("valueMax")) && (this.computedAriaValueText = this.statusType === "fraction" && !this.ariaValueText ? `${this.valueCurrent} av ${this.valueMax - this.valueMin}` : this.ariaValueText || ""), this.syncAttributes();
|
|
53
53
|
}
|
|
54
54
|
render() {
|
|
55
|
-
const t = this.statusType !== "none", e = this.valueMax - this.valueMin,
|
|
55
|
+
const t = this.statusType !== "none", e = this.valueMax - this.valueMin, i = this.valueCurrent / e * 100, a = this.statusType === "fraction" ? Math.round(i) : Math.round((this.valueCurrent - this.valueMin) / (this.valueMax - this.valueMin) * 100), o = `${this.valueCurrent} av ${e}`, n = p({
|
|
56
56
|
"pkt-progressbar__bar": !0,
|
|
57
57
|
[`pkt-progressbar__bar--${this.skin}`]: !!this.skin
|
|
58
|
-
}),
|
|
58
|
+
}), v = p({
|
|
59
59
|
"pkt-progressbar__title": !0,
|
|
60
60
|
"pkt-progressbar__title-center": this.titlePosition === "center"
|
|
61
|
-
}),
|
|
61
|
+
}), m = p({
|
|
62
62
|
"pkt-progressbar__status": !0,
|
|
63
63
|
"pkt-progressbar__status--center": this.statusPlacement === "center"
|
|
64
|
-
}),
|
|
64
|
+
}), g = p({
|
|
65
65
|
"pkt-progressbar__status-placement--following": this.statusPlacement === "following",
|
|
66
66
|
"pkt-progressbar__status-placement--center": this.statusPlacement === "center",
|
|
67
67
|
"pkt-progressbar__status-placement--left": this.statusPlacement === "left"
|
|
68
68
|
});
|
|
69
|
-
return
|
|
69
|
+
return d` <div
|
|
70
70
|
class="pkt-progressbar__container"
|
|
71
71
|
.ref=${this.progressBarRef}
|
|
72
|
-
style=${
|
|
72
|
+
style=${L({
|
|
73
73
|
"--pkt-progress-label-width": `${this.labelWidth}px`,
|
|
74
|
-
"--pkt-progress-width": `${
|
|
74
|
+
"--pkt-progress-width": `${a}%`
|
|
75
75
|
})}
|
|
76
76
|
>
|
|
77
|
-
${this.title ?
|
|
77
|
+
${this.title ? d`<p id=${`${this.progressBarId}-title`} class=${v}>${this.title}</p>` : c}
|
|
78
78
|
|
|
79
79
|
<div class="pkt-progressbar__bar-wrapper">
|
|
80
|
-
<div class=${
|
|
80
|
+
<div class=${n}></div>
|
|
81
81
|
</div>
|
|
82
82
|
|
|
83
|
-
${t ?
|
|
84
|
-
<span class=${
|
|
85
|
-
${this.statusType === "percentage" ? `${
|
|
83
|
+
${t ? d`<div class=${m}>
|
|
84
|
+
<span class=${g} ${k(this.labelRef)}>
|
|
85
|
+
${this.statusType === "percentage" ? `${a}%` : o}
|
|
86
86
|
</span>
|
|
87
87
|
</div>` : c}
|
|
88
88
|
</div>`;
|
|
89
89
|
}
|
|
90
90
|
// methods
|
|
91
91
|
setComputedValues() {
|
|
92
|
-
this.progressbarId = this.id ||
|
|
92
|
+
this.progressbarId = this.id || b(), this.computedAriaLabelledby = this.ariaLabelledby || `${this.progressbarId}-title`, this.computedAriaValueText = this.statusType === "fraction" && !this.ariaValueText ? `${this.valueCurrent} av ${this.valueMax - this.valueMin}` : this.ariaValueText || "";
|
|
93
93
|
}
|
|
94
94
|
syncAttributes() {
|
|
95
95
|
this._handleAttribute("aria-live", this.ariaLive), this._handleAttribute("aria-valuenow", this.valueCurrent), this._handleAttribute("aria-valuemin", this.valueMin), this._handleAttribute("aria-valuemax", this.valueMax), this._handleAttribute("aria-valuetext", this.computedAriaValueText), this._handleAttribute("aria-label", this.ariaLabel), this._handleAttribute("role", this.role), this._handleAttribute("aria-atomic", "true"), this._handleAttribute("id", this.progressbarId), this.ariaLabel || this._handleAttribute("aria-labelledby", this.computedAriaLabelledby);
|
|
@@ -97,66 +97,66 @@ let r = class extends _ {
|
|
|
97
97
|
_handleAttribute(t, e) {
|
|
98
98
|
e == null || e === "" ? this.removeAttribute(t) : this.setAttribute(t, String(e));
|
|
99
99
|
}
|
|
100
|
-
}
|
|
101
|
-
|
|
100
|
+
}
|
|
101
|
+
r([
|
|
102
102
|
u({ type: String })
|
|
103
|
-
],
|
|
104
|
-
|
|
103
|
+
], s.prototype, "ariaLabel");
|
|
104
|
+
r([
|
|
105
105
|
u({ type: String, reflect: !0 })
|
|
106
|
-
],
|
|
107
|
-
|
|
106
|
+
], s.prototype, "ariaLabelledby");
|
|
107
|
+
r([
|
|
108
108
|
u({ type: String, reflect: !0 })
|
|
109
|
-
],
|
|
110
|
-
|
|
109
|
+
], s.prototype, "ariaValueText");
|
|
110
|
+
r([
|
|
111
111
|
u({ type: String })
|
|
112
|
-
],
|
|
113
|
-
|
|
112
|
+
], s.prototype, "ariaLive");
|
|
113
|
+
r([
|
|
114
114
|
u({ type: String, reflect: !0 })
|
|
115
|
-
],
|
|
116
|
-
|
|
115
|
+
], s.prototype, "id");
|
|
116
|
+
r([
|
|
117
117
|
u({ type: String })
|
|
118
|
-
],
|
|
119
|
-
|
|
118
|
+
], s.prototype, "role");
|
|
119
|
+
r([
|
|
120
120
|
u({ type: String })
|
|
121
|
-
],
|
|
122
|
-
|
|
121
|
+
], s.prototype, "skin");
|
|
122
|
+
r([
|
|
123
123
|
u({ type: String })
|
|
124
|
-
],
|
|
125
|
-
|
|
124
|
+
], s.prototype, "statusPlacement");
|
|
125
|
+
r([
|
|
126
126
|
u({ type: String })
|
|
127
|
-
],
|
|
128
|
-
|
|
127
|
+
], s.prototype, "statusType");
|
|
128
|
+
r([
|
|
129
129
|
u({ type: String, reflect: !0 })
|
|
130
|
-
],
|
|
131
|
-
|
|
130
|
+
], s.prototype, "title");
|
|
131
|
+
r([
|
|
132
132
|
u({ type: String })
|
|
133
|
-
],
|
|
134
|
-
|
|
133
|
+
], s.prototype, "titlePosition");
|
|
134
|
+
r([
|
|
135
135
|
u({ type: Number, reflect: !0 })
|
|
136
|
-
],
|
|
137
|
-
|
|
136
|
+
], s.prototype, "valueCurrent");
|
|
137
|
+
r([
|
|
138
138
|
u({ type: Number })
|
|
139
|
-
],
|
|
140
|
-
|
|
139
|
+
], s.prototype, "valueMax");
|
|
140
|
+
r([
|
|
141
141
|
u({ type: Number })
|
|
142
|
-
],
|
|
143
|
-
|
|
142
|
+
], s.prototype, "valueMin");
|
|
143
|
+
r([
|
|
144
144
|
h()
|
|
145
|
-
],
|
|
146
|
-
|
|
145
|
+
], s.prototype, "labelWidth");
|
|
146
|
+
r([
|
|
147
147
|
h()
|
|
148
|
-
],
|
|
149
|
-
|
|
148
|
+
], s.prototype, "progressbarId");
|
|
149
|
+
r([
|
|
150
150
|
h()
|
|
151
|
-
],
|
|
152
|
-
|
|
151
|
+
], s.prototype, "computedAriaLabelledby");
|
|
152
|
+
r([
|
|
153
153
|
h()
|
|
154
|
-
],
|
|
155
|
-
|
|
156
|
-
$("pkt-progressbar")
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
], s.prototype, "computedAriaValueText");
|
|
155
|
+
try {
|
|
156
|
+
$("pkt-progressbar")(s);
|
|
157
|
+
} catch {
|
|
158
|
+
console.warn("Forsøker å definere <pkt-progressbar>, men den er allerede definert");
|
|
159
|
+
}
|
|
159
160
|
export {
|
|
160
|
-
|
|
161
|
-
W as a
|
|
161
|
+
s as P
|
|
162
162
|
};
|