@oslokommune/punkt-elements 20.0.3 → 20.1.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 +13 -0
- package/dist/{accordion-5N_ptxrN.cjs → accordion-CSSp30G1.cjs} +1 -1
- package/dist/{accordion-C5cu1xXT.js → accordion-DIjltHSH.js} +11 -14
- package/dist/{alert-DkyTTo7S.cjs → alert-0a5lX0pL.cjs} +12 -12
- package/dist/{alert-CA1fDbyc.js → alert-ZrB-P881.js} +36 -38
- package/dist/{async-directive-DCLIOGR8.cjs → async-directive-Bn7zgxUy.cjs} +1 -1
- package/dist/{async-directive-BcS8rfeC.js → async-directive-Ct3Mrb1M.js} +10 -11
- package/dist/{backlink-CXOxMeyt.cjs → backlink-BAvqdPlG.cjs} +1 -1
- package/dist/{backlink-CDBRcaAu.js → backlink-MBTAhQuD.js} +5 -7
- package/dist/{booleanish-OQJTYSrw.js → booleanish-CBa3Cr2h.js} +1 -2
- package/dist/{breadcrumbs-5oUaCef3.js → breadcrumbs-DtEt1-wn.js} +3 -4
- package/dist/{button-Bswo1C0M.js → button-CJzu0l5A.js} +45 -35
- package/dist/button-DHVRpzpS.cjs +32 -0
- package/dist/{calendar-BOd-9PDd.js → calendar-CkAAgviq.js} +66 -76
- package/dist/calendar-xYEsKilS.cjs +85 -0
- package/dist/{card-CKStAH0Q.js → card-CsEfBJcP.js} +10 -12
- package/dist/{card-BbV4OBqb.cjs → card-XznwedEG.cjs} +1 -1
- package/dist/{checkbox-iMOdzpJ_.cjs → checkbox-Cg7wnn8U.cjs} +1 -1
- package/dist/{checkbox-DIJbuqWm.js → checkbox-XvlUQmg5.js} +8 -10
- package/dist/{checkbox-group-Kua6HuRE.cjs → checkbox-group-BF29zyLd.cjs} +1 -1
- package/dist/{checkbox-group-DLLbWgQb.js → checkbox-group-CRIV5CX0.js} +8 -10
- package/dist/{class-map-BDwVSgLb.js → class-map-C9n5CNC8.js} +2 -3
- package/dist/{classutils-DcYnSgfc.js → classutils-C4jETHHk.js} +1 -2
- package/dist/{combobox-Pxa80TeZ.js → combobox-CDJcIkNJ.js} +63 -66
- package/dist/combobox-DuXavWEY.cjs +139 -0
- package/dist/{consent-UkinU27V.cjs → consent-BOSXNt4Y.cjs} +1 -1
- package/dist/{consent-p-0n2b9x.js → consent-DwppvYBR.js} +5 -7
- package/dist/{consume-Bp12si68.js → consume-C6aWEFx-.js} +4 -8
- package/dist/{converters-CW6SN0TT.cjs → converters-Dp64-kF1.cjs} +1 -1
- package/dist/{converters-CYgQrWVm.js → converters-v_GK06o3.js} +36 -72
- package/dist/{datepicker-Cpiu_Nrf.cjs → datepicker-Cnrbqm62.cjs} +53 -53
- package/dist/{datepicker-BpxUWiIC.js → datepicker-DHdFA8Dx.js} +82 -88
- package/dist/define-component-spec-wHP10r2x.js +5 -0
- package/dist/{dialog-polyfill.esm-D39dWbRt.js → dialog-polyfill.esm-BGBREnq_.js} +2 -3
- package/dist/dialog-polyfill.esm-BPk0-8XP.cjs +1 -0
- package/dist/{directive-helpers-BoDzpPID.js → directive-helpers-KMRvtO9j.js} +2 -3
- package/dist/{element-DLgZkx5L.js → element-Bwc-likm.js} +9 -18
- package/dist/{element-with-slot-mG-h7Sjw.js → element-with-slot-47quDZRt.js} +4 -6
- package/dist/{element-with-slot-CeKuRE3_.cjs → element-with-slot-D_8fAzCW.cjs} +1 -1
- package/dist/{fetch-header-footer-data-Pc32etrk.js → fetch-header-footer-data-CPVt_P8s.js} +3 -6
- package/dist/{fileupload-vPDmtXiM.js → fileupload-BQw5nlzQ.js} +25 -36
- package/dist/{fileupload-DXJtAagE.cjs → fileupload-Cjde62AR.cjs} +1 -1
- package/dist/{focus-modality-controller-Dc2S-KqR.js → focus-modality-controller-DVsT6GeR.js} +1 -2
- package/dist/focus-trap-C-PcFOw6.js +42 -0
- package/dist/focus-trap-C9tsr-xL.cjs +1 -0
- package/dist/{footer-CpE05IW2.cjs → footer-NQaQc2DH.cjs} +9 -9
- package/dist/{footer-D8t0PCPC.js → footer-SbOYv50e.js} +20 -24
- package/dist/{format-BTeSVkED.js → format-DwjTfa9h.js} +1 -2
- package/dist/{header-ChT1hHNA.js → header-CZnKVVt4.js} +22 -26
- package/dist/{header-CiwHNHKD.cjs → header-YbbGgmsD.cjs} +2 -2
- package/dist/{header-menu-Dq9lwNr1.cjs → header-menu-BJMMwrCR.cjs} +1 -1
- package/dist/{header-menu-BrjsNjBH.js → header-menu-k2ACrfOv.js} +9 -11
- package/dist/{heading-DAkjw2Am.cjs → heading-BNlor2MU.cjs} +1 -1
- package/dist/{heading-CMZmPEL9.js → heading-SYKHysr8.js} +19 -21
- package/dist/{helptext-Bse1LpRd.cjs → helptext-CQaNvbiv.cjs} +9 -9
- package/dist/{helptext-BFQzrOw4.js → helptext-kKmVQkwo.js} +20 -22
- package/dist/{icon-C1oCGwEe.js → icon-CZDw42U7.js} +5 -8
- package/dist/if-defined-B3pYog2C.js +4 -0
- package/dist/{input-element-2LHxo0em.cjs → input-element-CfZIyfon.cjs} +1 -1
- package/dist/{input-element-De40zUox.js → input-element-DE0FzjgP.js} +19 -25
- package/dist/{input-wrapper-C_Rzwxx7.cjs → input-wrapper-CbYMk21W.cjs} +1 -1
- package/dist/{input-wrapper-DkpJS1hR.js → input-wrapper-DYg1VHPv.js} +13 -15
- package/dist/{link-DLPpwjq4.js → link-Bc4zf-Dj.js} +19 -22
- package/dist/link-lPrxhYq0.cjs +7 -0
- package/dist/{linkcard-DIG6VYpl.cjs → linkcard-Bih7HS2t.cjs} +1 -1
- package/dist/{linkcard-Dr-r8jBO.js → linkcard-LCFAdVsG.js} +7 -9
- package/dist/{listbox-HrH4JonS.cjs → listbox-Du8llYth.cjs} +10 -10
- package/dist/{listbox-DAvIBH4P.js → listbox-df8gHweY.js} +17 -19
- package/dist/{loader-CFidlqSG.js → loader-C-2b3bGK.js} +9 -12
- package/dist/{loader-DTIrOtTo.cjs → loader-DiQSwWpb.cjs} +1 -1
- package/dist/{messagebox-BLYx3AL7.cjs → messagebox-BiG-fJX9.cjs} +1 -1
- package/dist/{messagebox-B_07P0QA.js → messagebox-CH3bKoJO.js} +9 -11
- package/dist/modal-B3rnE83a.cjs +37 -0
- package/dist/{modal-CA_M2Ix6.js → modal-SBJ8aGvM.js} +33 -35
- package/dist/{option-group-element-DzM8YznZ.js → option-group-element-DtSw52Dr.js} +7 -8
- package/dist/{option-group-element-CVNaBIlP.cjs → option-group-element-dN0ntPZk.cjs} +1 -1
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -1
- 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.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-group.cjs +1 -1
- package/dist/pkt-checkbox-group.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 -3
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -1
- package/dist/pkt-footer.js +1 -1
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- 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.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +37 -37
- 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-CzvBlEPD.js → pkt-options-controller-Dz7DP0wC.js} +2 -3
- package/dist/{pkt-options-controller-9zoH1OBW.cjs → pkt-options-controller-WsHVdPJA.cjs} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radio-group.cjs +1 -1
- package/dist/pkt-radio-group.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.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 +1 -1
- 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 +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{progressbar-CfCc2zhp.js → progressbar-DlbkKRgP.js} +9 -11
- package/dist/{progressbar-BdqIhC1Z.cjs → progressbar-Wyq_Q1Ur.cjs} +1 -1
- package/dist/{provide-_MnlMGnw.js → provide-DFu2tSv_.js} +3 -5
- package/dist/{radio-group-BRY_74od.js → radio-group-bRF8fnPW.js} +8 -10
- package/dist/{radio-group-CsUgnEv0.cjs → radio-group-u1IH7g-4.cjs} +1 -1
- package/dist/{radiobutton-CQhuG2lj.cjs → radiobutton-86ZvvDmJ.cjs} +1 -1
- package/dist/{radiobutton-lHnq8wX_.js → radiobutton-Bf6aFfYt.js} +8 -10
- package/dist/{ref-B6p6mQkO.cjs → ref-C6VUWwmF.cjs} +1 -1
- package/dist/{ref-BAegS9BR.js → ref-qE1RBrI7.js} +3 -4
- package/dist/{repeat-Cy1M16Di.js → repeat-c2P6osbb.js} +3 -4
- package/dist/{scroll-lock-CR-g54ai.js → scroll-lock-C9jzbJ4E.js} +1 -2
- package/dist/{searchinput-TAqMUJ0B.cjs → searchinput-D5l64Mkb.cjs} +7 -7
- package/dist/{searchinput-BLGaXkP6.js → searchinput-DN8kDZQ1.js} +18 -20
- package/dist/{select-Dle67Uwv.cjs → select-C7kAlSxs.cjs} +15 -15
- package/dist/{select-BvtUxW0Q.js → select-CXIEM2qY.js} +15 -18
- package/dist/shared-types/button.d.ts +13 -0
- package/dist/shared-types/index.d.ts +1 -1
- package/dist/shared-types-BvRk9kiK.js +0 -0
- package/dist/{tabs-BmmTUKuC.js → tabs-Cg16Sl3u.js} +57 -60
- package/dist/tabs-n7hQWwyI.cjs +40 -0
- package/dist/{tag-BZdC0voc.cjs → tag-BAikRN2Y.cjs} +1 -1
- package/dist/{tag-Cam7ISOF.js → tag-HXcXopyA.js} +9 -11
- package/dist/{textarea-Djp5L2Zd.js → textarea-12le8b4I.js} +12 -14
- package/dist/{textarea-DSX3jMlI.cjs → textarea-CRcSfWgX.cjs} +1 -1
- package/dist/{textinput-CBrOZcvL.js → textinput-CC0zxUBT.js} +11 -13
- package/dist/{textinput-CN2F3Q3H.cjs → textinput-Dooq2n8W.cjs} +1 -1
- package/dist/{timepicker-CkaJkIGn.cjs → timepicker-BM4I5w-i.cjs} +20 -20
- package/dist/{timepicker-CT4wfrgQ.js → timepicker-Cz81VQu3.js} +27 -28
- package/dist/{utils-BwF4QSrq.js → utils-Dn5ykFtS.js} +1 -2
- package/package.json +10 -10
- package/src/components/button/button.ts +14 -14
- package/dist/button-bVWAX98x.cjs +0 -32
- package/dist/calendar-CDTCgTJn.cjs +0 -85
- package/dist/combobox-CWL8T3UK.cjs +0 -139
- package/dist/define-component-spec-BYOSeplU.js +0 -6
- package/dist/dialog-polyfill.esm-CW51hN2p.cjs +0 -1
- package/dist/focus-trap-DG3pEuyJ.js +0 -60
- package/dist/focus-trap-DSv4Ifqm.cjs +0 -1
- package/dist/if-defined-DiYi2v_Q.js +0 -5
- package/dist/link-pkFJ11Zd.cjs +0 -7
- package/dist/modal-BvTfLfFq.cjs +0 -37
- package/dist/shared-types-A6iGIX-f.js +0 -1
- package/dist/tabs-B96Orh6O.cjs +0 -40
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as s } from "./
|
|
3
|
-
import "./
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { t as e } from "./class-map-C9n5CNC8.js";
|
|
2
|
+
import { _ as t, d as n, h as r, l as i, n as a, t as o, u as s } from "./element-Bwc-likm.js";
|
|
3
|
+
import { _ as c, a as l, b as u, d, f, g as p, l as m, m as h, o as g, p as _, t as v, v as y, y as b } from "./converters-v_GK06o3.js";
|
|
4
|
+
import "./icon-CZDw42U7.js";
|
|
5
|
+
// ../../shared-types/calendar.ts
|
|
6
6
|
var x = {
|
|
7
7
|
multiple: !1,
|
|
8
8
|
maxMultiple: 0,
|
|
@@ -12,14 +12,12 @@ var x = {
|
|
|
12
12
|
weeknumbers: !1,
|
|
13
13
|
withcontrols: !1
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
//#region ../../node_modules/date-fns/addDays.js
|
|
15
|
+
// ../../node_modules/date-fns/addDays.js
|
|
17
16
|
function S(e, t, n) {
|
|
18
17
|
let r = b(e, n?.in);
|
|
19
18
|
return isNaN(t) ? u(n?.in || e, NaN) : (t && r.setDate(r.getDate() + t), r);
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
//#region ../../node_modules/date-fns/_lib/normalizeInterval.js
|
|
20
|
+
// ../../node_modules/date-fns/_lib/normalizeInterval.js
|
|
23
21
|
function C(e, t) {
|
|
24
22
|
let [n, r] = y(e, t.start, t.end);
|
|
25
23
|
return {
|
|
@@ -27,8 +25,7 @@ function C(e, t) {
|
|
|
27
25
|
end: r
|
|
28
26
|
};
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
//#region ../../node_modules/date-fns/eachDayOfInterval.js
|
|
28
|
+
// ../../node_modules/date-fns/eachDayOfInterval.js
|
|
32
29
|
function w(e, t) {
|
|
33
30
|
let { start: n, end: r } = C(t?.in, e), i = +n > +r, a = i ? +n : +r, o = i ? r : n;
|
|
34
31
|
o.setHours(0, 0, 0, 0);
|
|
@@ -39,14 +36,12 @@ function w(e, t) {
|
|
|
39
36
|
for (; +o <= a;) c.push(u(n, o)), o.setDate(o.getDate() + s), o.setHours(0, 0, 0, 0);
|
|
40
37
|
return i ? c.reverse() : c;
|
|
41
38
|
}
|
|
42
|
-
|
|
43
|
-
//#region ../../node_modules/date-fns/getISODay.js
|
|
39
|
+
// ../../node_modules/date-fns/getISODay.js
|
|
44
40
|
function T(e, t) {
|
|
45
41
|
let n = b(e, t?.in).getDay();
|
|
46
42
|
return n === 0 ? 7 : n;
|
|
47
43
|
}
|
|
48
|
-
|
|
49
|
-
//#region ../../shared-utils/calendar/date-validation.ts
|
|
44
|
+
// ../../shared-utils/calendar/date-validation.ts
|
|
50
45
|
function E(e, t) {
|
|
51
46
|
let n = (t.excludedates ?? []).map((e) => typeof e == "string" ? e : l(e));
|
|
52
47
|
return !m(e, t.earliest, t.latest, n, t.excludeweekdays ?? []);
|
|
@@ -77,8 +72,7 @@ function j(e, t, n, r) {
|
|
|
77
72
|
let { startingDay: i, numDays: a } = r;
|
|
78
73
|
return e === 0 && t < i ? "prev-month" : n > a ? "next-month" : "current-month";
|
|
79
74
|
}
|
|
80
|
-
|
|
81
|
-
//#region ../../shared-utils/calendar/selection-manager.ts
|
|
75
|
+
// ../../shared-utils/calendar/selection-manager.ts
|
|
82
76
|
function M(e) {
|
|
83
77
|
return typeof e == "string" && (e = e.split(",")), e.length === 1 && e[0] === "" ? [] : e.map((e) => h(e));
|
|
84
78
|
}
|
|
@@ -125,8 +119,7 @@ function R(e, t, n) {
|
|
|
125
119
|
let r = l(e), i = M(t);
|
|
126
120
|
return t.includes(r) ? t.indexOf(r) === 0 ? [] : I(e, t) : t.length > 1 || t.length === 1 && (!P(e, i, n.excludedates, n.excludeweekdays) || i[0] > e) ? [r] : F(e, t);
|
|
127
121
|
}
|
|
128
|
-
|
|
129
|
-
//#region ../../shared-utils/calendar/keyboard-navigation.ts
|
|
122
|
+
// ../../shared-utils/calendar/keyboard-navigation.ts
|
|
130
123
|
var z = {
|
|
131
124
|
ArrowLeft: -1,
|
|
132
125
|
ArrowRight: 1,
|
|
@@ -147,9 +140,8 @@ function V(e, t, n) {
|
|
|
147
140
|
function H(e) {
|
|
148
141
|
return z[e] ?? null;
|
|
149
142
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
var U = class extends a {
|
|
143
|
+
// src/components/calendar/calendar.ts
|
|
144
|
+
var U = class extends o {
|
|
153
145
|
constructor(...e) {
|
|
154
146
|
super(...e), this.selected = [], this.multiple = x.multiple, this.maxMultiple = x.maxMultiple, this.range = x.range, this.earliest = x.earliest, this.latest = x.latest, this.excludedates = [], this.excludeweekdays = [], this.weeknumbers = x.weeknumbers, this.withcontrols = x.withcontrols, this.currentmonth = null, this.today = null, this._selected = [], this.inRange = {}, this.rangeHovered = null, this.year = 0, this.month = 0, this.currentmonthtouched = !1, this.focusedDate = null, this.selectableDates = [], this.tabIndexSet = 0;
|
|
155
147
|
}
|
|
@@ -204,7 +196,7 @@ var U = class extends a {
|
|
|
204
196
|
}
|
|
205
197
|
}
|
|
206
198
|
render() {
|
|
207
|
-
return
|
|
199
|
+
return t`
|
|
208
200
|
<div
|
|
209
201
|
class="pkt-calendar ${this.weeknumbers ? "pkt-cal-weeknumbers" : ""}"
|
|
210
202
|
@focusout=${this.closeEvent}
|
|
@@ -219,7 +211,7 @@ var U = class extends a {
|
|
|
219
211
|
<table
|
|
220
212
|
class="pkt-cal-days pkt-txt-12-medium pkt-calendar__body"
|
|
221
213
|
role="grid"
|
|
222
|
-
aria-multiselectable=${this.range || this.multiple ? "true" :
|
|
214
|
+
aria-multiselectable=${this.range || this.multiple ? "true" : r}
|
|
223
215
|
>
|
|
224
216
|
<thead>
|
|
225
217
|
${this.renderDayNames()}
|
|
@@ -231,9 +223,9 @@ var U = class extends a {
|
|
|
231
223
|
</div>
|
|
232
224
|
`;
|
|
233
225
|
}
|
|
234
|
-
renderMonthNavButton(
|
|
235
|
-
let
|
|
236
|
-
return
|
|
226
|
+
renderMonthNavButton(e) {
|
|
227
|
+
let n = e === "prev", i = n ? this.isPrevMonthAllowed() : this.isNextMonthAllowed(), { prevMonth: a, nextMonth: o } = this.calendarStrings, s = n ? a : o, c = n ? "chevron-thin-left" : "chevron-thin-right", l = n ? "pkt-calendar__prev-month" : "pkt-calendar__next-month", u = n ? () => this.prevMonth() : () => this.nextMonth();
|
|
228
|
+
return t`<div>
|
|
237
229
|
<button
|
|
238
230
|
type="button"
|
|
239
231
|
aria-label="${s}"
|
|
@@ -242,8 +234,8 @@ var U = class extends a {
|
|
|
242
234
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), i && u());
|
|
243
235
|
}}
|
|
244
236
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${l} ${i ? "" : "pkt-invisible"}"
|
|
245
|
-
data-disabled=${i ?
|
|
246
|
-
aria-disabled=${i ?
|
|
237
|
+
data-disabled=${i ? r : "disabled"}
|
|
238
|
+
aria-disabled=${i ? r : "true"}
|
|
247
239
|
tabindex=${i ? "0" : "-1"}
|
|
248
240
|
>
|
|
249
241
|
<pkt-icon class="pkt-btn__icon" name="${c}"></pkt-icon>
|
|
@@ -252,22 +244,22 @@ var U = class extends a {
|
|
|
252
244
|
</div>`;
|
|
253
245
|
}
|
|
254
246
|
renderDayNames() {
|
|
255
|
-
let
|
|
256
|
-
this.weeknumbers &&
|
|
247
|
+
let e = [];
|
|
248
|
+
this.weeknumbers && e.push(t`<th><div class="pkt-calendar__week-number">${this.calendarStrings.week}</div></th>`);
|
|
257
249
|
let { days: n, daysShort: r } = this.calendarStrings;
|
|
258
|
-
for (let i = 0; i < r.length; i++)
|
|
250
|
+
for (let i = 0; i < r.length; i++) e.push(t`<th>
|
|
259
251
|
<div class="pkt-calendar__day-name" aria-label="${n[i]}">${r[i]}</div>
|
|
260
252
|
</th>`);
|
|
261
|
-
return
|
|
262
|
-
${
|
|
253
|
+
return t`<tr class="pkt-cal-week-row">
|
|
254
|
+
${e}
|
|
263
255
|
</tr>`;
|
|
264
256
|
}
|
|
265
257
|
renderMonthNav() {
|
|
266
|
-
let
|
|
267
|
-
return this.withcontrols ?
|
|
268
|
-
<label for="${this.id}-monthnav" class="pkt-hide">${
|
|
258
|
+
let e = this.pktStrings.get("dates");
|
|
259
|
+
return this.withcontrols ? t`<div class="pkt-cal-month-picker">
|
|
260
|
+
<label for="${this.id}-monthnav" class="pkt-hide">${e.month}</label>
|
|
269
261
|
<select
|
|
270
|
-
aria-label="${
|
|
262
|
+
aria-label="${e.month}"
|
|
271
263
|
class="pkt-input pkt-input-compact"
|
|
272
264
|
id="${this.id}-monthnav"
|
|
273
265
|
@change=${(e) => {
|
|
@@ -276,11 +268,11 @@ var U = class extends a {
|
|
|
276
268
|
this.changeMonth(this.year, parseInt(t.value));
|
|
277
269
|
}}
|
|
278
270
|
>
|
|
279
|
-
${this.calendarStrings.months.map((
|
|
271
|
+
${this.calendarStrings.months.map((e, n) => t`<option value=${n} ?selected=${this.month === n}>${e}</option>`)}
|
|
280
272
|
</select>
|
|
281
|
-
<label for="${this.id}-yearnav" class="pkt-hide">${
|
|
273
|
+
<label for="${this.id}-yearnav" class="pkt-hide">${e.year}</label>
|
|
282
274
|
<input
|
|
283
|
-
aria-label="${
|
|
275
|
+
aria-label="${e.year}"
|
|
284
276
|
class="pkt-input pkt-cal-input-year pkt-input-compact"
|
|
285
277
|
id="${this.id}-yearnav"
|
|
286
278
|
type="number"
|
|
@@ -294,7 +286,7 @@ var U = class extends a {
|
|
|
294
286
|
value=${this.year}
|
|
295
287
|
.value=${this.year}
|
|
296
288
|
/>
|
|
297
|
-
</div>` :
|
|
289
|
+
</div>` : t`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
298
290
|
${this.calendarStrings.months[this.month]} ${this.year}
|
|
299
291
|
</div>`;
|
|
300
292
|
}
|
|
@@ -356,55 +348,55 @@ var U = class extends a {
|
|
|
356
348
|
handleDayFocus(e, t) {
|
|
357
349
|
this.range && !this.isExcluded(e) && this.handleRangeHover(e), this.focusedDate = t;
|
|
358
350
|
}
|
|
359
|
-
renderDayView(
|
|
360
|
-
let
|
|
351
|
+
renderDayView(n, i) {
|
|
352
|
+
let a = this.getDayViewData(n, i), { currentDate: o, currentDateISO: s, isSelected: c, isDisabled: l, ariaLabel: u, tabindex: d } = a;
|
|
361
353
|
this.selectableDates.push({
|
|
362
|
-
currentDateISO:
|
|
354
|
+
currentDateISO: s,
|
|
363
355
|
isDisabled: l,
|
|
364
356
|
tabindex: d
|
|
365
357
|
});
|
|
366
|
-
let f = this.getDayCellClasses(
|
|
367
|
-
return
|
|
358
|
+
let f = this.getDayCellClasses(a), p = this.getDayButtonClasses(a);
|
|
359
|
+
return t`<td class=${e(f)}>
|
|
368
360
|
<button
|
|
369
361
|
type="button"
|
|
370
362
|
aria-pressed=${c ? "true" : "false"}
|
|
371
363
|
?disabled=${l}
|
|
372
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${
|
|
373
|
-
@mouseover=${() => this.range && !this.isExcluded(
|
|
374
|
-
@focus=${() => this.handleDayFocus(
|
|
364
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${e(p)}"
|
|
365
|
+
@mouseover=${() => this.range && !this.isExcluded(o) && this.handleRangeHover(o)}
|
|
366
|
+
@focus=${() => this.handleDayFocus(o, s)}
|
|
375
367
|
aria-label="${u}"
|
|
376
368
|
tabindex=${d}
|
|
377
|
-
data-disabled=${l ? "disabled" :
|
|
378
|
-
data-date=${
|
|
369
|
+
data-disabled=${l ? "disabled" : r}
|
|
370
|
+
data-date=${s}
|
|
379
371
|
@keydown=${(e) => {
|
|
380
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.handleDateSelect(
|
|
372
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.handleDateSelect(o));
|
|
381
373
|
}}
|
|
382
374
|
@click=${(e) => {
|
|
383
|
-
l || (e.preventDefault(), this.handleDateSelect(
|
|
375
|
+
l || (e.preventDefault(), this.handleDateSelect(o));
|
|
384
376
|
}}
|
|
385
377
|
>
|
|
386
|
-
<span class="pkt-btn__text pkt-txt-14-light">${
|
|
378
|
+
<span class="pkt-btn__text pkt-txt-14-light">${n}</span>
|
|
387
379
|
</button>
|
|
388
380
|
</td>`;
|
|
389
381
|
}
|
|
390
382
|
renderEmptyDayCell() {
|
|
391
|
-
return
|
|
383
|
+
return t`<td class="pkt-cal-other"></td>`;
|
|
392
384
|
}
|
|
393
|
-
renderWeekRow(
|
|
394
|
-
return
|
|
395
|
-
${
|
|
385
|
+
renderWeekRow(e) {
|
|
386
|
+
return t`<tr class="pkt-cal-week-row" role="row">
|
|
387
|
+
${e}
|
|
396
388
|
</tr>`;
|
|
397
389
|
}
|
|
398
390
|
renderCalendarBody() {
|
|
399
|
-
let
|
|
391
|
+
let e = this.todayDate, n = A(this.year, this.month);
|
|
400
392
|
this.selectableDates = [], this.tabIndexSet = 0;
|
|
401
393
|
let r = 1, i = n.initialWeek, a = [];
|
|
402
394
|
for (let o = 0; o < n.numRows; o++) {
|
|
403
395
|
let s = [];
|
|
404
|
-
this.weeknumbers && s.push(
|
|
405
|
-
for (let
|
|
406
|
-
let i = j(o,
|
|
407
|
-
i === "current-month" ? (s.push(this.renderDayView(r,
|
|
396
|
+
this.weeknumbers && s.push(t`<td class="pkt-cal-week">${i}</td>`), i++;
|
|
397
|
+
for (let t = 0; t < 7; t++) {
|
|
398
|
+
let i = j(o, t, r, n);
|
|
399
|
+
i === "current-month" ? (s.push(this.renderDayView(r, e)), r++) : (s.push(this.renderEmptyDayCell()), i === "next-month" && r++);
|
|
408
400
|
}
|
|
409
401
|
a.push(this.renderWeekRow(s));
|
|
410
402
|
}
|
|
@@ -488,35 +480,33 @@ var U = class extends a {
|
|
|
488
480
|
}));
|
|
489
481
|
}
|
|
490
482
|
};
|
|
491
|
-
|
|
483
|
+
a([s({ converter: v.csvToArray })], U.prototype, "selected", void 0), a([s({ type: Boolean })], U.prototype, "multiple", void 0), a([s({
|
|
492
484
|
type: Number,
|
|
493
485
|
attribute: "max-multiple"
|
|
494
|
-
})], U.prototype, "maxMultiple", void 0),
|
|
486
|
+
})], U.prototype, "maxMultiple", void 0), a([s({ type: Boolean })], U.prototype, "range", void 0), a([s({ type: String })], U.prototype, "earliest", void 0), a([s({ type: String })], U.prototype, "latest", void 0), a([s({ converter: v.stringsToDate })], U.prototype, "excludedates", void 0), a([s({ converter: v.csvToArray })], U.prototype, "excludeweekdays", void 0), a([s({ type: Boolean })], U.prototype, "weeknumbers", void 0), a([s({ type: Boolean })], U.prototype, "withcontrols", void 0), a([s({ converter: v.stringToDate })], U.prototype, "currentmonth", void 0), a([s({ type: String })], U.prototype, "today", void 0), a([s({
|
|
495
487
|
type: Array,
|
|
496
488
|
attribute: "day-strings"
|
|
497
|
-
})], U.prototype, "dayStrings", void 0),
|
|
489
|
+
})], U.prototype, "dayStrings", void 0), a([s({
|
|
498
490
|
type: Array,
|
|
499
491
|
attribute: "day-strings-long"
|
|
500
|
-
})], U.prototype, "dayStringsLong", void 0),
|
|
492
|
+
})], U.prototype, "dayStringsLong", void 0), a([s({
|
|
501
493
|
type: Array,
|
|
502
494
|
attribute: "month-strings"
|
|
503
|
-
})], U.prototype, "monthStrings", void 0),
|
|
495
|
+
})], U.prototype, "monthStrings", void 0), a([s({
|
|
504
496
|
type: String,
|
|
505
497
|
attribute: "week-string"
|
|
506
|
-
})], U.prototype, "weekString", void 0),
|
|
498
|
+
})], U.prototype, "weekString", void 0), a([s({
|
|
507
499
|
type: String,
|
|
508
500
|
attribute: "prev-month-string"
|
|
509
|
-
})], U.prototype, "prevMonthString", void 0),
|
|
501
|
+
})], U.prototype, "prevMonthString", void 0), a([s({
|
|
510
502
|
type: String,
|
|
511
503
|
attribute: "next-month-string"
|
|
512
|
-
})], U.prototype, "nextMonthString", void 0),
|
|
504
|
+
})], U.prototype, "nextMonthString", void 0), a([s({ type: Array })], U.prototype, "_selected", void 0), a([i()], U.prototype, "inRange", void 0), a([s({ type: Date })], U.prototype, "rangeHovered", void 0), a([s({ type: Number })], U.prototype, "year", void 0), a([s({ type: Number })], U.prototype, "month", void 0), a([i()], U.prototype, "currentmonthtouched", void 0), a([i()], U.prototype, "focusedDate", void 0);
|
|
513
505
|
try {
|
|
514
|
-
|
|
506
|
+
n("pkt-calendar")(U);
|
|
515
507
|
} catch {
|
|
516
508
|
console.warn("Forsøker å definere <pkt-calendar>, men den er allerede definert");
|
|
517
509
|
}
|
|
518
|
-
|
|
519
|
-
//#region src/components/calendar/index.ts
|
|
510
|
+
// src/components/calendar/index.ts
|
|
520
511
|
var W = U;
|
|
521
|
-
//#endregion
|
|
522
512
|
export { U as n, W as t };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const e=require("./class-map-C82GtM1w.cjs"),t=require("./element-CEarCnHH.cjs"),n=require("./converters-Dp64-kF1.cjs");require("./icon-5A378_yh.cjs");var r={multiple:!1,maxMultiple:0,range:!1,earliest:null,latest:null,weeknumbers:!1,withcontrols:!1};function i(e,t,r){let i=n.y(e,r?.in);return isNaN(t)?n.b(r?.in||e,NaN):(t&&i.setDate(i.getDate()+t),i)}function a(e,t){let[r,i]=n.v(e,t.start,t.end);return{start:r,end:i}}function o(e,t){let{start:r,end:i}=a(t?.in,e),o=+r>+i,s=o?+r:+i,c=o?i:r;c.setHours(0,0,0,0);let l=t?.step??1;if(!l)return[];l<0&&(l=-l,o=!o);let u=[];for(;+c<=s;)u.push(n.b(r,c)),c.setDate(c.getDate()+l),c.setHours(0,0,0,0);return o?u.reverse():u}function s(e,t){let r=n.y(e,t?.in).getDay();return r===0?7:r}function c(e,t){let r=(t.excludedates??[]).map(e=>typeof e==`string`?e:n.a(e));return!n.l(e,t.earliest,t.latest,r,t.excludeweekdays??[])}function l(e,t,n,r){return!!(c(e,n)||!t&&r.multiple&&r.maxMultiple>0&&r.selectedCount>=r.maxMultiple)}function u(e,t,r){let i=n.p(e,t,0);return!(r&&n.d(r)>i)}function d(e,t,r){let i=n.p(t===11?e+1:e,t===11?0:t+1,1);return!(r&&n.d(r)<i)}function f(e,t){let r=n.p(e,t,1),i=n.p(e,t+1,0),a=(r.getDay()+6)%7,o=i.getDate();return{firstDayOfMonth:r,lastDayOfMonth:i,startingDay:a,numDays:o,numRows:Math.ceil((o+a)/7),initialWeek:n._(r)}}function p(e,t,n,r){let{startingDay:i,numDays:a}=r;return e===0&&t<i?`prev-month`:n>a?`next-month`:`current-month`}function m(e){return typeof e==`string`&&(e=e.split(`,`)),e.length===1&&e[0]===``?[]:e.map(e=>n.m(e))}function h(e,t){let r=o({start:e,end:t}),i={};if(Array.isArray(r)&&r.length)for(let a=0;a<r.length;a++){let o=r[a],s=o>e&&o<t;i[n.a(o)]=s}return i}function g(e,t,n,r){if(t.length!==1)return!0;let i=o({start:t[0],end:e});if(!Array.isArray(i)||!i.length)return!0;for(let a=0;a<i.length;a++){for(let r of n??[])if(r>t[0]&&r<e)return!1;if((r??[]).includes(s(i[a]).toString()))return!1}return!0}function _(e,t){let r=n.a(e);return t.includes(r)?t:[...t,r]}function v(e,t){let r=n.a(e),i=t.indexOf(r);if(i===-1)return t;if(t.length===1)return[];let a=[...t];return a.splice(i,1),a}function y(e,t,r){let i=n.a(e);return t.includes(i)?v(e,t):r>0&&t.length>=r?t:_(e,t)}function b(e,t,r){let i=n.a(e),a=m(t);return t.includes(i)?t.indexOf(i)===0?[]:v(e,t):t.length>1||t.length===1&&(!g(e,a,r.excludedates,r.excludeweekdays)||a[0]>e)?[i]:_(e,t)}var x={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7};function S(e){let t=e.nodeName;return t===`INPUT`||t===`SELECT`||t===`BUTTON`&&!e.dataset?.date}function C(e,t,r){let a=i(e,t);if(!a)return null;let o=r(`button[data-date="${n.a(a)}"]`);for(;o instanceof HTMLButtonElement&&o.dataset.disabled;)if(a=i(a,t),o=r(`button[data-date="${n.a(a)}"]`),!o)return null;return a}function w(e){return x[e]??null}var T=class extends t.t{constructor(...e){super(...e),this.selected=[],this.multiple=r.multiple,this.maxMultiple=r.maxMultiple,this.range=r.range,this.earliest=r.earliest,this.latest=r.latest,this.excludedates=[],this.excludeweekdays=[],this.weeknumbers=r.weeknumbers,this.withcontrols=r.withcontrols,this.currentmonth=null,this.today=null,this._selected=[],this.inRange={},this.rangeHovered=null,this.year=0,this.month=0,this.currentmonthtouched=!1,this.focusedDate=null,this.selectableDates=[],this.tabIndexSet=0}get calendarStrings(){let e=this.pktStrings.get(`dates`),t=this.pktStrings.get(`calendar`);return{daysShort:this.dayStrings??e.daysShort,days:this.dayStringsLong??e.days,months:this.monthStrings??e.months,week:this.weekString??e.week,prevMonth:this.prevMonthString??t.prevMonth,nextMonth:this.nextMonthString??t.nextMonth}}get todayDate(){return this.today?n.m(this.today):n.g()}firstUpdated(e){this.addEventListener(`keydown`,this.handleKeydown)}disconnectedCallback(){this.removeEventListener(`keydown`,this.handleKeydown),super.disconnectedCallback()}willUpdate(e){super.willUpdate(e),e.has(`selected`)&&this.convertSelected()}convertSelected(){typeof this.selected==`string`&&(this.selected=this.selected.split(`,`)),this.selected.length===1&&this.selected[0]===``&&(this.selected=[]),this._selected=m(this.selected),this.range&&this.selected.length===2&&(this.inRange=h(this._selected[0],this._selected[1])),this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==``){let e=n.m(this.selected[this.selected.length-1]);this.currentmonth=isNaN(e.getTime())?n.f(this.todayDate):e}else this.currentmonth===null&&(this.currentmonth=n.f(this.todayDate));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=n.f(this.todayDate)),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(e){let t=w(e.key);t!==null&&this.handleArrowKey(e,t)}handleArrowKey(e,t){let r=e.target;if(S(r))return;if(e.preventDefault(),!this.focusedDate){this.focusOnCurrentDate();return}let i=C(this.focusedDate?n.d(this.focusedDate):n.p(this.year,this.month,1),t,this.querySelector.bind(this));if(i){let e=this.querySelector(`button[data-date="${n.a(i)}"]`);e instanceof HTMLButtonElement&&!e.dataset.disabled&&(this.focusedDate=n.a(i),e.focus())}}render(){return t._`
|
|
2
|
+
<div
|
|
3
|
+
class="pkt-calendar ${this.weeknumbers?`pkt-cal-weeknumbers`:``}"
|
|
4
|
+
@focusout=${this.closeEvent}
|
|
5
|
+
@keydown=${e=>{e.key===`Escape`&&(e.preventDefault(),this.close())}}
|
|
6
|
+
>
|
|
7
|
+
<nav class="pkt-cal-month-nav">
|
|
8
|
+
${this.renderMonthNavButton(`prev`)} ${this.renderMonthNav()}
|
|
9
|
+
${this.renderMonthNavButton(`next`)}
|
|
10
|
+
</nav>
|
|
11
|
+
<table
|
|
12
|
+
class="pkt-cal-days pkt-txt-12-medium pkt-calendar__body"
|
|
13
|
+
role="grid"
|
|
14
|
+
aria-multiselectable=${this.range||this.multiple?`true`:t.h}
|
|
15
|
+
>
|
|
16
|
+
<thead>
|
|
17
|
+
${this.renderDayNames()}
|
|
18
|
+
</thead>
|
|
19
|
+
<tbody>
|
|
20
|
+
${this.renderCalendarBody()}
|
|
21
|
+
</tbody>
|
|
22
|
+
</table>
|
|
23
|
+
</div>
|
|
24
|
+
`}renderMonthNavButton(e){let n=e===`prev`,r=n?this.isPrevMonthAllowed():this.isNextMonthAllowed(),{prevMonth:i,nextMonth:a}=this.calendarStrings,o=n?i:a,s=n?`chevron-thin-left`:`chevron-thin-right`,c=n?`pkt-calendar__prev-month`:`pkt-calendar__next-month`,l=n?()=>this.prevMonth():()=>this.nextMonth();return t._`<div>
|
|
25
|
+
<button
|
|
26
|
+
type="button"
|
|
27
|
+
aria-label="${o}"
|
|
28
|
+
@click=${()=>r&&l()}
|
|
29
|
+
@keydown=${e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r&&l())}}
|
|
30
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${c} ${r?``:`pkt-invisible`}"
|
|
31
|
+
data-disabled=${r?t.h:`disabled`}
|
|
32
|
+
aria-disabled=${r?t.h:`true`}
|
|
33
|
+
tabindex=${r?`0`:`-1`}
|
|
34
|
+
>
|
|
35
|
+
<pkt-icon class="pkt-btn__icon" name="${s}"></pkt-icon>
|
|
36
|
+
<span class="pkt-btn__text">${o}</span>
|
|
37
|
+
</button>
|
|
38
|
+
</div>`}renderDayNames(){let e=[];this.weeknumbers&&e.push(t._`<th><div class="pkt-calendar__week-number">${this.calendarStrings.week}</div></th>`);let{days:n,daysShort:r}=this.calendarStrings;for(let i=0;i<r.length;i++)e.push(t._`<th>
|
|
39
|
+
<div class="pkt-calendar__day-name" aria-label="${n[i]}">${r[i]}</div>
|
|
40
|
+
</th>`);return t._`<tr class="pkt-cal-week-row">
|
|
41
|
+
${e}
|
|
42
|
+
</tr>`}renderMonthNav(){let e=this.pktStrings.get(`dates`);return this.withcontrols?t._`<div class="pkt-cal-month-picker">
|
|
43
|
+
<label for="${this.id}-monthnav" class="pkt-hide">${e.month}</label>
|
|
44
|
+
<select
|
|
45
|
+
aria-label="${e.month}"
|
|
46
|
+
class="pkt-input pkt-input-compact"
|
|
47
|
+
id="${this.id}-monthnav"
|
|
48
|
+
@change=${e=>{e.stopImmediatePropagation();let t=e.target;this.changeMonth(this.year,parseInt(t.value))}}
|
|
49
|
+
>
|
|
50
|
+
${this.calendarStrings.months.map((e,n)=>t._`<option value=${n} ?selected=${this.month===n}>${e}</option>`)}
|
|
51
|
+
</select>
|
|
52
|
+
<label for="${this.id}-yearnav" class="pkt-hide">${e.year}</label>
|
|
53
|
+
<input
|
|
54
|
+
aria-label="${e.year}"
|
|
55
|
+
class="pkt-input pkt-cal-input-year pkt-input-compact"
|
|
56
|
+
id="${this.id}-yearnav"
|
|
57
|
+
type="number"
|
|
58
|
+
size="4"
|
|
59
|
+
placeholder="0000"
|
|
60
|
+
@change=${e=>{e.stopImmediatePropagation();let t=e.target;this.changeMonth(parseInt(t.value),this.month)}}
|
|
61
|
+
value=${this.year}
|
|
62
|
+
.value=${this.year}
|
|
63
|
+
/>
|
|
64
|
+
</div>`:t._`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
65
|
+
${this.calendarStrings.months[this.month]} ${this.year}
|
|
66
|
+
</div>`}getDayViewData(e,t){let r=n.p(this.year,this.month,e),i=n.a(r),a=i===n.a(t),o=this.selected.includes(i),s=this.isDayDisabled(r,o),c=this.calculateTabIndex(i,s,e);return{currentDate:r,currentDateISO:i,isToday:a,isSelected:o,isDisabled:s,ariaLabel:n.o(r),tabindex:c}}getDateConstraints(){return{earliest:this.earliest,latest:this.latest,excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}}isDayDisabled(e,t){return l(e,t,this.getDateConstraints(),{multiple:this.multiple,maxMultiple:this.maxMultiple,selectedCount:this.selected.length})}calculateTabIndex(e,t,n){return this.focusedDate?this.focusedDate===e&&!t?`0`:`-1`:!t&&this.tabIndexSet===0?(this.tabIndexSet=n,`0`):this.tabIndexSet===n?`0`:`-1`}getDayCellClasses(e){let{currentDateISO:t,isToday:r,isSelected:i}=e,a=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&t===this.selected[0],o=this.range&&this.selected.length===2&&t===this.selected[1];return{"pkt-cal-today":r,"pkt-cal-selected":i,"pkt-cal-in-range":this.inRange[t],"pkt-cal-excluded":this.isExcluded(e.currentDate),"pkt-cal-in-range-first":a,"pkt-cal-in-range-last":o,"pkt-cal-range-hover":this.rangeHovered!==null&&t===n.a(this.rangeHovered)}}getDayButtonClasses(e){let{currentDateISO:t,isToday:r,isSelected:i,isDisabled:a}=e,o=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&t===this.selected[0],s=this.range&&this.selected.length===2&&t===this.selected[1];return{"pkt-calendar__date":!0,"pkt-calendar__date--today":r,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":a,"pkt-calendar__date--in-range":this.inRange[t],"pkt-calendar__date--in-range-hover":this.rangeHovered!==null&&t===n.a(this.rangeHovered),"pkt-calendar__date--range-start":o,"pkt-calendar__date--range-end":s}}handleDayFocus(e,t){this.range&&!this.isExcluded(e)&&this.handleRangeHover(e),this.focusedDate=t}renderDayView(n,r){let i=this.getDayViewData(n,r),{currentDate:a,currentDateISO:o,isSelected:s,isDisabled:c,ariaLabel:l,tabindex:u}=i;this.selectableDates.push({currentDateISO:o,isDisabled:c,tabindex:u});let d=this.getDayCellClasses(i),f=this.getDayButtonClasses(i);return t._`<td class=${e.t(d)}>
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
aria-pressed=${s?`true`:`false`}
|
|
70
|
+
?disabled=${c}
|
|
71
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${e.t(f)}"
|
|
72
|
+
@mouseover=${()=>this.range&&!this.isExcluded(a)&&this.handleRangeHover(a)}
|
|
73
|
+
@focus=${()=>this.handleDayFocus(a,o)}
|
|
74
|
+
aria-label="${l}"
|
|
75
|
+
tabindex=${u}
|
|
76
|
+
data-disabled=${c?`disabled`:t.h}
|
|
77
|
+
data-date=${o}
|
|
78
|
+
@keydown=${e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.handleDateSelect(a))}}
|
|
79
|
+
@click=${e=>{c||(e.preventDefault(),this.handleDateSelect(a))}}
|
|
80
|
+
>
|
|
81
|
+
<span class="pkt-btn__text pkt-txt-14-light">${n}</span>
|
|
82
|
+
</button>
|
|
83
|
+
</td>`}renderEmptyDayCell(){return t._`<td class="pkt-cal-other"></td>`}renderWeekRow(e){return t._`<tr class="pkt-cal-week-row" role="row">
|
|
84
|
+
${e}
|
|
85
|
+
</tr>`}renderCalendarBody(){let e=this.todayDate,n=f(this.year,this.month);this.selectableDates=[],this.tabIndexSet=0;let r=1,i=n.initialWeek,a=[];for(let o=0;o<n.numRows;o++){let s=[];this.weeknumbers&&s.push(t._`<td class="pkt-cal-week">${i}</td>`),i++;for(let t=0;t<7;t++){let i=p(o,t,r,n);i===`current-month`?(s.push(this.renderDayView(r,e)),r++):(s.push(this.renderEmptyDayCell()),i===`next-month`&&r++)}a.push(this.renderWeekRow(s))}return a}isExcluded(e){return c(e,this.getDateConstraints())}isPrevMonthAllowed(){return u(this.year,this.month,this.earliest)}prevMonth(){let e=this.month===0?11:this.month-1,t=this.month===0?this.year-1:this.year;this.changeMonth(t,e)}isNextMonthAllowed(){return d(this.year,this.month,this.latest)}nextMonth(){let e=this.month===11?0:this.month+1,t=this.month===11?this.year+1:this.year;this.changeMonth(t,e)}changeMonth(e,t){this.year=typeof e==`string`?parseInt(e):e,this.month=typeof t==`string`?parseInt(t):t,this.currentmonth=n.f(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}normalizeSelected(){return typeof this.selected==`string`?this.selected.split(`,`):this.selected}addToSelected(e){this.selected=_(e,this.normalizeSelected()),this._selected=m(this.selected),this.range&&this.selected.length===2&&(this.convertSelected(),this.close())}removeFromSelected(e){this.selected=v(e,this.normalizeSelected()),this._selected=m(this.selected)}toggleSelected(e){this.selected=y(e,this.normalizeSelected(),this.maxMultiple),this._selected=m(this.selected)}isRangeAllowed(e){return g(e,this._selected,this.excludedates,this.excludeweekdays)}handleRangeSelect(e){return this.selected=b(e,this.normalizeSelected(),{excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}),this._selected=m(this.selected),this.selected.length===2?(this.convertSelected(),this.close()):this.selected.length===1&&(this.inRange={}),Promise.resolve()}handleRangeHover(e){!this.range||this._selected.length!==1||!this.isRangeAllowed(e)||this._selected[0]>=e?this.rangeHovered=null:(this.rangeHovered=e,this.inRange=h(this._selected[0],e))}handleDateSelect(e){return e&&(this.range?this.handleRangeSelect(e):this.multiple?this.toggleSelected(e):(this.selected.includes(n.a(e))?this.emptySelected():(this.emptySelected(),this.addToSelected(e)),this.close()),this.dispatchEvent(new CustomEvent(`date-selected`,{detail:this.selected,bubbles:!0,composed:!0}))),Promise.resolve()}focusOnCurrentDate(){let e=n.a(n.f(this.todayDate)),t=this.querySelector(`button[data-date="${e}"]`);if(t instanceof HTMLButtonElement){this.focusedDate=e,t.focus();return}let r=this.selectableDates.find(e=>!e.isDisabled);if(r){let e=this.querySelector(`button[data-date="${r.currentDateISO}"]`);e instanceof HTMLButtonElement&&(this.focusedDate=r.currentDateISO,e.focus())}}closeEvent(e){let t=e.target,n=e.relatedTarget;this.contains(n)||t.classList.contains(`pkt-invisible`)||t.closest(`.pkt-cal-month-picker`)||this.close()}close(){this.dispatchEvent(new CustomEvent(`close`,{detail:!0,bubbles:!0,composed:!0}))}};t.n([t.u({converter:n.t.csvToArray})],T.prototype,`selected`,void 0),t.n([t.u({type:Boolean})],T.prototype,`multiple`,void 0),t.n([t.u({type:Number,attribute:`max-multiple`})],T.prototype,`maxMultiple`,void 0),t.n([t.u({type:Boolean})],T.prototype,`range`,void 0),t.n([t.u({type:String})],T.prototype,`earliest`,void 0),t.n([t.u({type:String})],T.prototype,`latest`,void 0),t.n([t.u({converter:n.t.stringsToDate})],T.prototype,`excludedates`,void 0),t.n([t.u({converter:n.t.csvToArray})],T.prototype,`excludeweekdays`,void 0),t.n([t.u({type:Boolean})],T.prototype,`weeknumbers`,void 0),t.n([t.u({type:Boolean})],T.prototype,`withcontrols`,void 0),t.n([t.u({converter:n.t.stringToDate})],T.prototype,`currentmonth`,void 0),t.n([t.u({type:String})],T.prototype,`today`,void 0),t.n([t.u({type:Array,attribute:`day-strings`})],T.prototype,`dayStrings`,void 0),t.n([t.u({type:Array,attribute:`day-strings-long`})],T.prototype,`dayStringsLong`,void 0),t.n([t.u({type:Array,attribute:`month-strings`})],T.prototype,`monthStrings`,void 0),t.n([t.u({type:String,attribute:`week-string`})],T.prototype,`weekString`,void 0),t.n([t.u({type:String,attribute:`prev-month-string`})],T.prototype,`prevMonthString`,void 0),t.n([t.u({type:String,attribute:`next-month-string`})],T.prototype,`nextMonthString`,void 0),t.n([t.u({type:Array})],T.prototype,`_selected`,void 0),t.n([t.l()],T.prototype,`inRange`,void 0),t.n([t.u({type:Date})],T.prototype,`rangeHovered`,void 0),t.n([t.u({type:Number})],T.prototype,`year`,void 0),t.n([t.u({type:Number})],T.prototype,`month`,void 0),t.n([t.l()],T.prototype,`currentmonthtouched`,void 0),t.n([t.l()],T.prototype,`focusedDate`,void 0);try{t.d(`pkt-calendar`)(T)}catch{console.warn(`Forsøker å definere <pkt-calendar>, men den er allerede definert`)}var E=T;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return E}});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, n as r, u as i } from "./element-
|
|
2
|
-
import { t as a } from "./class-map-
|
|
3
|
-
import { n as o } from "./format-
|
|
4
|
-
import { i as s, t as c } from "./element-with-slot-
|
|
5
|
-
import "./shared-types-
|
|
6
|
-
import "./icon-
|
|
7
|
-
import "./tag-
|
|
8
|
-
import { t as l } from "./if-defined-
|
|
9
|
-
|
|
1
|
+
import { _ as e, d as t, h as n, n as r, u as i } from "./element-Bwc-likm.js";
|
|
2
|
+
import { t as a } from "./class-map-C9n5CNC8.js";
|
|
3
|
+
import { n as o } from "./format-DwjTfa9h.js";
|
|
4
|
+
import { i as s, t as c } from "./element-with-slot-47quDZRt.js";
|
|
5
|
+
import "./shared-types-BvRk9kiK.js";
|
|
6
|
+
import "./icon-CZDw42U7.js";
|
|
7
|
+
import "./tag-HXcXopyA.js";
|
|
8
|
+
import { t as l } from "./if-defined-B3pYog2C.js";
|
|
9
|
+
// ../../shared-types/card.ts
|
|
10
10
|
var u = [
|
|
11
11
|
"gray",
|
|
12
12
|
"outlined",
|
|
@@ -179,8 +179,6 @@ try {
|
|
|
179
179
|
} catch {
|
|
180
180
|
console.warn("Forsøker å definere <pkt-card>, men den er allerede definert");
|
|
181
181
|
}
|
|
182
|
-
|
|
183
|
-
//#region src/components/card/index.ts
|
|
182
|
+
// src/components/card/index.ts
|
|
184
183
|
var m = p;
|
|
185
|
-
//#endregion
|
|
186
184
|
export { p as n, m as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-
|
|
1
|
+
const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-D_8fAzCW.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./icon-5A378_yh.cjs"),require("./tag-BAikRN2Y.cjs");const i=require("./if-defined-Ci4ZQsgL.cjs");var a=[`gray`,`outlined`,`transparent`,`white`,`blue`,`green`,`beige`],o=[`white`,`blue`,`green`,`beige`],s={headingLevel:3,layout:`vertical`,skin:`gray`,tagPosition:`top`,openLinkInNewTab:!1,zoom:!1},c=class extends r.t{constructor(...e){super(...e),this.ariaLabel=``,this.metaLead=null,this.zoom=s.zoom,this.imageAspect=null,this.clickCardLink=null,this.metaTrail=null,this.layout=s.layout,this.heading=``,this.headingLevel=s.headingLevel,this.image={src:``,alt:``},this.openLinkInNewTab=s.openLinkInNewTab,this.skin=s.skin,this.subheading=``,this.tagPosition=`top`,this.tags=[]}connectedCallback(){super.connectedCallback()}render(){let n={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.layout}`]:this.layout,"pkt-card--clickable":!!this.clickCardLink,"pkt-card--zoom":this.zoom},r=this.ariaLabel?.trim()||(this.heading?`${this.heading} lenkekort`:`lenkekort`),a=this.ariaLabel?.trim()||(this.heading?this.heading:`kort`);return e._`
|
|
2
2
|
<article
|
|
3
3
|
class=${t.t(n)}
|
|
4
4
|
aria-label=${i.t(this.clickCardLink?r:a)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs");require("./shared-types-BvRk9kiK.cjs");const n=require("./consume-kEjgTrAp.cjs"),r=require("./ref-
|
|
1
|
+
const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs");require("./shared-types-BvRk9kiK.cjs");const n=require("./consume-kEjgTrAp.cjs"),r=require("./ref-C6VUWwmF.cjs"),i=require("./input-element-CfZIyfon.cjs");var a={defaultChecked:!1,indeterminate:!1,hasTile:!1,disabled:!1,hasError:!1,isSwitch:!1,hideLabel:!1,labelPosition:`right`,requiredTag:!1,optionalTag:!1},o=n.n(Symbol(`pkt-checkbox-group-context`)),s=class extends i.t{constructor(...e){super(...e),this.inputRef=r.t(),this.value=``,this.checkHelptext=null,this.defaultChecked=a.defaultChecked,this.hasTile=a.hasTile,this.isSwitch=a.isSwitch,this.labelPosition=a.labelPosition,this.hideLabel=a.hideLabel,this.checked=null,this.indeterminate=a.indeterminate,this.type=`checkbox`,this.inputSize=void 0,this.tagText=null,this.optionalTag=a.optionalTag,this.requiredTag=a.requiredTag}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e===`checked`&&(this.checked=this.checked===``||this.checked===`true`||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),e===`indeterminate`&&(this.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0,this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate)),super.attributeChangedCallback(e,t,n)}firstUpdated(e){this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0),super.firstUpdated(e)}willUpdate(e){super.willUpdate(e),e.has(`defaultChecked`)&&!this.checked&&(this.checked=this.defaultChecked)}updated(e){e.has(`checked`)&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===``||this.checked===`true`||this.checked===!0),e.has(`indeterminate`)&&this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0),super.updated(e)}render(){let n=this.hasTile||!!this.groupContext?.hasTile,i=t.t({"pkt-input-check__input":!0,"pkt-input-check__input--tile":n,"pkt-input-check__input--tile-disabled":this.isDisabled&&n}),a=t.t({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError||!!this.groupContext?.hasError}),o=t.t({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.isDisabled,"pkt-input-check__input-label--left":this.labelPosition===`left`,"pkt-input-check__input-label--right":this.labelPosition===`right`,"pkt-sr-only":this.hideLabel}),s=`pkt-tag pkt-tag--small pkt-tag--thin-text`,c=this.pktStrings.get(`forms`),l=()=>e._`
|
|
2
2
|
${this.tagText?e._`<span class=${s+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
|
|
3
3
|
${this.optionalTag?e._`<span class=${s+` pkt-tag--blue-pale`}
|
|
4
4
|
>${this.optionalText??c.optional}</span
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import "./shared-types-
|
|
4
|
-
import { n as s, t as c } from "./consume-
|
|
5
|
-
import { n as l, t as u } from "./ref-
|
|
6
|
-
import { t as d } from "./input-element-
|
|
7
|
-
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-Bwc-likm.js";
|
|
2
|
+
import { t as o } from "./class-map-C9n5CNC8.js";
|
|
3
|
+
import "./shared-types-BvRk9kiK.js";
|
|
4
|
+
import { n as s, t as c } from "./consume-C6aWEFx-.js";
|
|
5
|
+
import { n as l, t as u } from "./ref-qE1RBrI7.js";
|
|
6
|
+
import { t as d } from "./input-element-DE0FzjgP.js";
|
|
7
|
+
// ../../shared-types/checkbox.ts
|
|
8
8
|
var f = {
|
|
9
9
|
defaultChecked: !1,
|
|
10
10
|
indeterminate: !1,
|
|
@@ -134,8 +134,6 @@ try {
|
|
|
134
134
|
} catch {
|
|
135
135
|
console.warn("Forsøker å definere <pkt-checkbox>, men den er allerede definert");
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
//#region src/components/checkbox/index.ts
|
|
137
|
+
// src/components/checkbox/index.ts
|
|
139
138
|
var h = m;
|
|
140
|
-
//#endregion
|
|
141
139
|
export { m as n, p as r, h as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./
|
|
1
|
+
const e=require("./provide-Cz18sYug.cjs"),t=require("./element-CEarCnHH.cjs"),n=require("./option-group-element-dN0ntPZk.cjs"),r=require("./checkbox-Cg7wnn8U.cjs");var i=class extends n.t{constructor(...e){super(...e),this.optionSelector=`pkt-checkbox`,this.groupContext={name:``,hasTile:!1,hasError:!1},this.storedValue=null,this.validityApplied=!1}get value(){return this.options().filter(e=>n.n(e)&&!n.r(e)).map(n.i)}set value(e){let t=this.value;this.storedValue=Array.isArray(e)?e:e?e.split(`,`):[],this.applyStoredValue(this.options()),this.requestUpdate(`value`,t)}get hasStoredValue(){return this.storedValue!==null}storeCurrentValue(){this.storedValue=this.value}applyStoredValue(e){e.forEach(e=>{let t=!!this.storedValue?.includes(n.i(e));n.n(e)!==t&&(e.checked=t)})}syncValidity(){if(!this.required&&!this.validityApplied)return;this.validityApplied=this.required;let e=this.options(),t=this.required&&!e.some(e=>n.n(e)&&!n.r(e))?this.pktStrings.get(`validation`).checkboxGroupValueMissing:``;e.forEach(e=>e.setGroupValidity?.(t))}};t.n([e.t({context:r.r}),t.l()],i.prototype,`groupContext`,void 0),t.n([t.u({type:String})],i.prototype,`value`,null);try{t.d(`pkt-checkbox-group`)(i)}catch{console.warn(`Forsøker å definere <pkt-checkbox-group>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as i } from "./
|
|
3
|
-
import { i as a, n as o, r as s, t as c } from "./option-group-element-
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { t as e } from "./provide-DFu2tSv_.js";
|
|
2
|
+
import { d as t, l as n, n as r, u as i } from "./element-Bwc-likm.js";
|
|
3
|
+
import { i as a, n as o, r as s, t as c } from "./option-group-element-DtSw52Dr.js";
|
|
4
|
+
import { r as l } from "./checkbox-XvlUQmg5.js";
|
|
5
|
+
// src/components/checkbox-group/checkbox-group.ts
|
|
6
6
|
var u = class extends c {
|
|
7
7
|
constructor(...e) {
|
|
8
8
|
super(...e), this.optionSelector = "pkt-checkbox", this.groupContext = {
|
|
@@ -37,14 +37,12 @@ var u = class extends c {
|
|
|
37
37
|
e.forEach((e) => e.setGroupValidity?.(t));
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
r([e({ context: l }), n()], u.prototype, "groupContext", void 0), r([i({ type: String })], u.prototype, "value", null);
|
|
41
41
|
try {
|
|
42
|
-
|
|
42
|
+
t("pkt-checkbox-group")(u);
|
|
43
43
|
} catch {
|
|
44
44
|
console.warn("Forsøker å definere <pkt-checkbox-group>, men den er allerede definert");
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
//#region src/components/checkbox-group/index.ts
|
|
46
|
+
// src/components/checkbox-group/index.ts
|
|
48
47
|
var d = u;
|
|
49
|
-
//#endregion
|
|
50
48
|
export { u as n, d as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as e, g as t, m as n, p as r } from "./element-
|
|
2
|
-
|
|
1
|
+
import { f as e, g as t, m as n, p as r } from "./element-Bwc-likm.js";
|
|
2
|
+
// ../../node_modules/lit-html/directives/class-map.js
|
|
3
3
|
var i = e(class extends r {
|
|
4
4
|
constructor(e) {
|
|
5
5
|
if (super(e), e.type !== n.ATTRIBUTE || e.name !== "class" || e.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
@@ -22,5 +22,4 @@ var i = e(class extends r {
|
|
|
22
22
|
return t;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
//#endregion
|
|
26
25
|
export { i as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/classutils.ts
|
|
2
2
|
function e(e, t, n) {
|
|
3
3
|
let r = e.getAttribute("class") || "", i = new Set(r.split(/\s+/).filter(Boolean));
|
|
4
4
|
n ? i.add(t) : i.delete(t), e.setAttribute("class", Array.from(i).join(" "));
|
|
5
5
|
}
|
|
6
|
-
//#endregion
|
|
7
6
|
export { e as t };
|