@oslokommune/punkt-elements 20.1.2 → 20.1.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 +23 -0
- package/dist/{calendar-xYEsKilS.cjs → calendar-KZlln5k8.cjs} +2 -2
- package/dist/{calendar-CkAAgviq.js → calendar-T_iFl5mR.js} +2 -2
- package/dist/{checkbox-Cg7wnn8U.cjs → checkbox-BS0iHeSP.cjs} +1 -1
- package/dist/{checkbox-XvlUQmg5.js → checkbox-DCaSNEjy.js} +1 -1
- package/dist/{checkbox-group-BF29zyLd.cjs → checkbox-group-BZhrLn4e.cjs} +1 -1
- package/dist/{checkbox-group-CRIV5CX0.js → checkbox-group-GsfZSfMs.js} +2 -2
- package/dist/{combobox-otZu39eS.cjs → combobox-DoUwp_6k.cjs} +1 -1
- package/dist/{combobox-CLVwmqkY.js → combobox-_2jd4CHR.js} +3 -3
- package/dist/components/datepicker/datepicker-popup.d.ts +0 -1
- package/dist/components/datepicker/datepicker-utils.d.ts +2 -13
- package/dist/components/datepicker/datepicker.d.ts +32 -4
- package/dist/components/datepicker/index.d.ts +1 -0
- package/dist/{datepicker-DHdFA8Dx.js → datepicker-D60fq9D5.js} +227 -472
- package/dist/datepicker-DErgngTf.cjs +286 -0
- package/dist/{fileupload-Cjde62AR.cjs → fileupload-Cn7CvQtX.cjs} +1 -1
- package/dist/{fileupload-BQw5nlzQ.js → fileupload-dmzxRqGF.js} +4 -4
- package/dist/{header-YbbGgmsD.cjs → header-BQCGdOPT.cjs} +1 -1
- package/dist/{header-CZnKVVt4.js → header-Djjhqu7w.js} +2 -2
- package/dist/{helptext-CQaNvbiv.cjs → helptext-4xBIABJJ.cjs} +1 -1
- package/dist/{helptext-kKmVQkwo.js → helptext-CNg695BI.js} +1 -1
- package/dist/{input-element-CfZIyfon.cjs → input-element-BPzDBWdd.cjs} +1 -1
- package/dist/{input-element-DE0FzjgP.js → input-element-DsWlt-6T.js} +1 -1
- package/dist/{input-wrapper-DYg1VHPv.js → input-wrapper-BBUcHEKx.js} +2 -2
- package/dist/{input-wrapper-CbYMk21W.cjs → input-wrapper-EKGhSUKU.cjs} +1 -1
- package/dist/{listbox-df8gHweY.js → listbox-BcJbeoAT.js} +1 -1
- package/dist/{listbox-Du8llYth.cjs → listbox-gjzS_z0P.cjs} +1 -1
- package/dist/{modal-SBJ8aGvM.js → modal-CvqH9R3w.js} +1 -1
- package/dist/{modal-B3rnE83a.cjs → modal-Du-2AmLz.cjs} +1 -1
- package/dist/{option-group-element-dN0ntPZk.cjs → option-group-element-DgqdU9HX.cjs} +1 -1
- package/dist/{option-group-element-DtSw52Dr.js → option-group-element-Dr2FR6v7.js} +2 -2
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.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-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +18 -18
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +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-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-Wyq_Q1Ur.cjs → progressbar-BKA9zFnE.cjs} +1 -1
- package/dist/{progressbar-DlbkKRgP.js → progressbar-aKjj5VZg.js} +1 -1
- package/dist/{radio-group-u1IH7g-4.cjs → radio-group-BLVe7aMS.cjs} +1 -1
- package/dist/{radio-group-bRF8fnPW.js → radio-group-DDymupLt.js} +2 -2
- package/dist/{radiobutton-Bf6aFfYt.js → radiobutton-CnExI3Vj.js} +1 -1
- package/dist/{radiobutton-86ZvvDmJ.cjs → radiobutton-XX3zhblA.cjs} +1 -1
- package/dist/{searchinput-D5l64Mkb.cjs → searchinput-C8UHexyf.cjs} +1 -1
- package/dist/{searchinput-DN8kDZQ1.js → searchinput-DUJlxKHH.js} +1 -1
- package/dist/{select-CXIEM2qY.js → select-C4RDEc9h.js} +2 -2
- package/dist/{select-C7kAlSxs.cjs → select-CbVmSYmi.cjs} +1 -1
- package/dist/shared-types/datepicker.d.ts +76 -0
- package/dist/shared-types/index.d.ts +2 -2
- package/dist/shared-utils/datepicker-utils.d.ts +18 -0
- package/dist/shared-utils/forms/focus-within.d.ts +13 -0
- package/dist/{textarea-CRcSfWgX.cjs → textarea-D4yCdiFY.cjs} +1 -1
- package/dist/{textarea-12le8b4I.js → textarea-WktT3N3w.js} +2 -2
- package/dist/{textinput-CC0zxUBT.js → textinput-BPrC2neL.js} +2 -2
- package/dist/{textinput-Dooq2n8W.cjs → textinput-C6AcbxnQ.cjs} +1 -1
- package/dist/{timepicker-Cz81VQu3.js → timepicker-D77gssQg.js} +2 -2
- package/dist/{timepicker-BM4I5w-i.cjs → timepicker-DaqrwM-g.cjs} +1 -1
- package/dist/{utils-Dn5ykFtS.js → utils-BtXhdgpe.js} +2 -2
- package/dist/utils-dl1XA5EE.cjs +1 -0
- package/package.json +2 -2
- package/src/components/calendar/calendar.selection.test.ts +16 -0
- package/src/components/calendar/calendar.ts +4 -3
- package/src/components/datepicker/datepicker-multiple.ts +2 -6
- package/src/components/datepicker/datepicker-popup.ts +3 -6
- package/src/components/datepicker/datepicker-utils.test.ts +40 -203
- package/src/components/datepicker/datepicker-utils.ts +3 -94
- package/src/components/datepicker/datepicker.accessibility.test.ts +2 -2
- package/src/components/datepicker/datepicker.core.test.ts +236 -0
- package/src/components/datepicker/datepicker.ts +179 -115
- package/src/components/datepicker/index.ts +1 -0
- package/dist/datepicker-Cnrbqm62.cjs +0 -294
- package/dist/utils-63cRpWut.cjs +0 -1
|
@@ -1,346 +1,76 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, l as r, n as i,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import "./calendar-CkAAgviq.js";
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, t as a, u as o } from "./element-Bwc-likm.js";
|
|
2
|
+
import { t as s } from "./class-map-C9n5CNC8.js";
|
|
3
|
+
import { n as c } from "./element-with-slot-47quDZRt.js";
|
|
4
|
+
import "./shared-types-BvRk9kiK.js";
|
|
6
5
|
import "./icon-CZDw42U7.js";
|
|
7
|
-
import "./input-wrapper-
|
|
8
|
-
import { t as b } from "./class-map-C9n5CNC8.js";
|
|
9
|
-
import { t as x } from "./repeat-c2P6osbb.js";
|
|
6
|
+
import "./input-wrapper-BBUcHEKx.js";
|
|
10
7
|
import "./tag-HXcXopyA.js";
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
13
|
-
import { n as
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
import { i as l, r as u } from "./calendar-T_iFl5mR.js";
|
|
9
|
+
import { t as d } from "./if-defined-B3pYog2C.js";
|
|
10
|
+
import { n as f, t as p } from "./ref-qE1RBrI7.js";
|
|
11
|
+
import { a as ee, c as m, d as h, h as g, i as _, m as v, n as y, r as b, s as x, t as S, u as te } from "./converters-v_GK06o3.js";
|
|
12
|
+
import { t as ne } from "./repeat-c2P6osbb.js";
|
|
13
|
+
import { t as re } from "./utils-BtXhdgpe.js";
|
|
14
|
+
import { t as ie } from "./input-element-DsWlt-6T.js";
|
|
15
|
+
// ../../shared-types/datepicker.ts
|
|
16
|
+
var C = {
|
|
17
|
+
dateformat: "dd.MM.yyyy",
|
|
18
|
+
multiple: !1,
|
|
19
|
+
range: !1,
|
|
20
|
+
showRangeLabels: !1,
|
|
21
|
+
weeknumbers: !1,
|
|
22
|
+
withcontrols: !1,
|
|
23
|
+
calendarOpen: !1,
|
|
24
|
+
required: !1,
|
|
25
|
+
requiredTag: !1,
|
|
26
|
+
optionalTag: !1,
|
|
27
|
+
hasError: !1,
|
|
28
|
+
disabled: !1,
|
|
29
|
+
inline: !1,
|
|
30
|
+
fullwidth: !1,
|
|
31
|
+
useWrapper: !0,
|
|
32
|
+
inputSize: "medium"
|
|
33
|
+
}, w = class extends a {
|
|
16
34
|
constructor(...e) {
|
|
17
|
-
super(...e), this.dates = [], this.dateformat = "dd.MM.yyyy", this.className = "pkt-datepicker__tags", this.idBase =
|
|
35
|
+
super(...e), this.dates = [], this.dateformat = "dd.MM.yyyy", this.className = "pkt-datepicker__tags", this.idBase = re();
|
|
18
36
|
}
|
|
19
37
|
render() {
|
|
20
38
|
return this.classes = {
|
|
21
39
|
"pkt-date-tags": !0,
|
|
22
40
|
[this.className]: !0
|
|
23
41
|
}, e`
|
|
24
|
-
<div class=${
|
|
25
|
-
${Array.isArray(this.dates) && this.dates[0] ?
|
|
42
|
+
<div class=${s(this.classes)} aria-live="polite">
|
|
43
|
+
${Array.isArray(this.dates) && this.dates[0] ? ne(g((this.dates ?? []).filter(Boolean)), (e) => e, (t) => e` <pkt-tag
|
|
26
44
|
id=${this.idBase + t + "-tag"}
|
|
27
45
|
closeTag
|
|
28
46
|
@close=${() => {
|
|
29
47
|
this.dispatchEvent(new CustomEvent("date-tag-removed", { detail: t }));
|
|
30
48
|
}}
|
|
31
|
-
.ariaLabel=${`${this.pktStrings.get("datepicker").deleteDate} ${
|
|
49
|
+
.ariaLabel=${`${this.pktStrings.get("datepicker").deleteDate} ${m(t, this.dateformat)}`}
|
|
32
50
|
>
|
|
33
|
-
<time datetime=${t}>${
|
|
51
|
+
<time datetime=${t}>${m(t, this.dateformat)}</time>
|
|
34
52
|
</pkt-tag>`) : n}
|
|
35
53
|
</div>
|
|
36
54
|
`;
|
|
37
55
|
}
|
|
38
56
|
};
|
|
39
|
-
i([
|
|
57
|
+
i([o({ type: Array })], w.prototype, "dates", void 0), i([o({ type: String })], w.prototype, "dateformat", void 0), i([o({
|
|
40
58
|
type: String,
|
|
41
59
|
attribute: "class"
|
|
42
|
-
})],
|
|
60
|
+
})], w.prototype, "className", void 0), i([o({
|
|
43
61
|
type: String,
|
|
44
62
|
attribute: "id-base"
|
|
45
|
-
})],
|
|
63
|
+
})], w.prototype, "idBase", void 0);
|
|
46
64
|
try {
|
|
47
|
-
t("pkt-date-tags")(
|
|
65
|
+
t("pkt-date-tags")(w);
|
|
48
66
|
} catch {
|
|
49
67
|
console.warn("Forsøker å definere <pkt-date-tags>, men den er allerede definert");
|
|
50
68
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
react: "PktDatepicker",
|
|
54
|
-
"css-class": "pkt-datepicker",
|
|
55
|
-
isElement: !0,
|
|
56
|
-
isPureReact: !0,
|
|
57
|
-
"dark-mode": !0,
|
|
58
|
-
props: {
|
|
59
|
-
name: {
|
|
60
|
-
type: "string",
|
|
61
|
-
name: "Navn for innsending",
|
|
62
|
-
category: "tech"
|
|
63
|
-
},
|
|
64
|
-
form: {
|
|
65
|
-
name: "Skjema",
|
|
66
|
-
description: "ID-en til skjemaet feltet hører til, når feltet ligger utenfor skjemaet",
|
|
67
|
-
type: "string",
|
|
68
|
-
required: !1,
|
|
69
|
-
category: "tech"
|
|
70
|
-
},
|
|
71
|
-
label: {
|
|
72
|
-
type: "string",
|
|
73
|
-
name: "Tekst/label",
|
|
74
|
-
category: "contents"
|
|
75
|
-
},
|
|
76
|
-
helptext: {
|
|
77
|
-
type: "string",
|
|
78
|
-
name: "Hjelpetekst",
|
|
79
|
-
category: "contents"
|
|
80
|
-
},
|
|
81
|
-
helptextDropdown: {
|
|
82
|
-
type: "string",
|
|
83
|
-
name: "Utvidet hjelpetekst",
|
|
84
|
-
description: "Hjelpetekst som vises i en lukket boks man kan åpne",
|
|
85
|
-
category: "contents"
|
|
86
|
-
},
|
|
87
|
-
helptextDropdownButton: {
|
|
88
|
-
type: "string",
|
|
89
|
-
name: "Knappetekst for utvidet hjelpetekst",
|
|
90
|
-
default: "Les mer",
|
|
91
|
-
category: "contents"
|
|
92
|
-
},
|
|
93
|
-
dateformat: {
|
|
94
|
-
name: "Datoformat for tags i flervalg",
|
|
95
|
-
type: "string",
|
|
96
|
-
default: "dd.MM.yyyy",
|
|
97
|
-
category: "tech"
|
|
98
|
-
},
|
|
99
|
-
currentmonth: {
|
|
100
|
-
name: "Måned som vises i datovelgeren",
|
|
101
|
-
type: "ISOdatestring",
|
|
102
|
-
category: "tech"
|
|
103
|
-
},
|
|
104
|
-
value: {
|
|
105
|
-
name: "Verdi (kommaseparert ved flervalg)",
|
|
106
|
-
type: "ISOdatestring",
|
|
107
|
-
variant: "multiple",
|
|
108
|
-
category: "tech"
|
|
109
|
-
},
|
|
110
|
-
excludeweekdays: {
|
|
111
|
-
name: "Utelat ukedager",
|
|
112
|
-
type: "string",
|
|
113
|
-
description: "Kommaseparert liste over ukedager (1-7) som skal ekskluderes",
|
|
114
|
-
category: "functionality"
|
|
115
|
-
},
|
|
116
|
-
excludedates: {
|
|
117
|
-
name: "Utelat datoer (Kommaseparerte ISO-datoer)",
|
|
118
|
-
type: "ISOdatestring",
|
|
119
|
-
variant: "multiple",
|
|
120
|
-
category: "functionality"
|
|
121
|
-
},
|
|
122
|
-
min: {
|
|
123
|
-
name: "Tidligst tillatte dato",
|
|
124
|
-
type: "ISOdatestring",
|
|
125
|
-
default: null,
|
|
126
|
-
category: "functionality"
|
|
127
|
-
},
|
|
128
|
-
max: {
|
|
129
|
-
name: "Senest tillatte dato",
|
|
130
|
-
type: "ISOdatestring",
|
|
131
|
-
default: null,
|
|
132
|
-
category: "functionality"
|
|
133
|
-
},
|
|
134
|
-
weeknumbers: {
|
|
135
|
-
name: "Vis ukenummer",
|
|
136
|
-
type: "boolean",
|
|
137
|
-
reflect: !0,
|
|
138
|
-
default: !1,
|
|
139
|
-
category: "ui"
|
|
140
|
-
},
|
|
141
|
-
withcontrols: {
|
|
142
|
-
name: "Med velgere for måned/år",
|
|
143
|
-
type: "boolean",
|
|
144
|
-
reflect: !0,
|
|
145
|
-
default: !1,
|
|
146
|
-
category: "ui"
|
|
147
|
-
},
|
|
148
|
-
multiple: {
|
|
149
|
-
name: "Flervalg",
|
|
150
|
-
type: "boolean",
|
|
151
|
-
reflect: !0,
|
|
152
|
-
default: !1,
|
|
153
|
-
category: "functionality",
|
|
154
|
-
exclusiveGroup: "selectionMode"
|
|
155
|
-
},
|
|
156
|
-
maxlength: {
|
|
157
|
-
name: "Maks antall datoer i flervalg",
|
|
158
|
-
type: "number",
|
|
159
|
-
category: "functionality",
|
|
160
|
-
showIf: { multiple: !0 }
|
|
161
|
-
},
|
|
162
|
-
range: {
|
|
163
|
-
name: "Datotidsrom (fra og til)",
|
|
164
|
-
type: "boolean",
|
|
165
|
-
reflect: !0,
|
|
166
|
-
default: !1,
|
|
167
|
-
category: "functionality",
|
|
168
|
-
exclusiveGroup: "selectionMode"
|
|
169
|
-
},
|
|
170
|
-
showRangeLabels: {
|
|
171
|
-
attribute: "show-range-labels",
|
|
172
|
-
name: "Vis fra/til-etiketter",
|
|
173
|
-
type: "boolean",
|
|
174
|
-
default: !1,
|
|
175
|
-
category: "ui",
|
|
176
|
-
showIf: { range: !0 }
|
|
177
|
-
},
|
|
178
|
-
today: {
|
|
179
|
-
name: "Dagens dato (overstyring)",
|
|
180
|
-
type: "ISOdatestring",
|
|
181
|
-
description: "ISO-datostreng som overstyrer dagens dato i kalenderen. Nyttig for snapshot-tester.",
|
|
182
|
-
category: "tech"
|
|
183
|
-
},
|
|
184
|
-
calendarOpen: {
|
|
185
|
-
attribute: "calendar-open",
|
|
186
|
-
name: "Kalender åpen",
|
|
187
|
-
type: "boolean",
|
|
188
|
-
reflect: !0,
|
|
189
|
-
default: !1,
|
|
190
|
-
category: "ui"
|
|
191
|
-
},
|
|
192
|
-
hasError: {
|
|
193
|
-
type: "boolean",
|
|
194
|
-
name: "Feil",
|
|
195
|
-
default: !1,
|
|
196
|
-
category: "ui"
|
|
197
|
-
},
|
|
198
|
-
errorMessage: {
|
|
199
|
-
type: "string",
|
|
200
|
-
name: "Feilmelding ved feil",
|
|
201
|
-
category: "contents"
|
|
202
|
-
},
|
|
203
|
-
disabled: {
|
|
204
|
-
type: "boolean",
|
|
205
|
-
name: "Deaktivert",
|
|
206
|
-
default: !1,
|
|
207
|
-
reflect: !0,
|
|
208
|
-
category: "tech"
|
|
209
|
-
},
|
|
210
|
-
fullwidth: {
|
|
211
|
-
type: "boolean",
|
|
212
|
-
name: "Full bredde",
|
|
213
|
-
default: !1,
|
|
214
|
-
reflect: !0,
|
|
215
|
-
category: "ui"
|
|
216
|
-
},
|
|
217
|
-
inputSize: {
|
|
218
|
-
attribute: "input-size",
|
|
219
|
-
name: "Størrelse",
|
|
220
|
-
description: "Størrelsen på komponenten",
|
|
221
|
-
type: [
|
|
222
|
-
"medium",
|
|
223
|
-
"small",
|
|
224
|
-
"xsmall"
|
|
225
|
-
],
|
|
226
|
-
default: "medium",
|
|
227
|
-
category: "ui"
|
|
228
|
-
},
|
|
229
|
-
required: {
|
|
230
|
-
type: "boolean",
|
|
231
|
-
name: "Påkrevd",
|
|
232
|
-
default: !1,
|
|
233
|
-
reflect: !0,
|
|
234
|
-
category: "tech"
|
|
235
|
-
},
|
|
236
|
-
requiredTag: {
|
|
237
|
-
type: "boolean",
|
|
238
|
-
name: "Vise påkrevd-merking",
|
|
239
|
-
default: !1,
|
|
240
|
-
category: "ui"
|
|
241
|
-
},
|
|
242
|
-
requiredText: {
|
|
243
|
-
type: "string",
|
|
244
|
-
name: "Påkrevd-tekst",
|
|
245
|
-
default: "Må fylles ut",
|
|
246
|
-
category: "contents"
|
|
247
|
-
},
|
|
248
|
-
optionalTag: {
|
|
249
|
-
type: "boolean",
|
|
250
|
-
name: "Vise valgfritt-merking",
|
|
251
|
-
default: !1,
|
|
252
|
-
category: "ui"
|
|
253
|
-
},
|
|
254
|
-
optionalText: {
|
|
255
|
-
type: "string",
|
|
256
|
-
name: "Valgfritt-tekst",
|
|
257
|
-
default: "Valgfritt",
|
|
258
|
-
category: "contents"
|
|
259
|
-
},
|
|
260
|
-
tagText: {
|
|
261
|
-
type: "string",
|
|
262
|
-
name: "Tag-tekst",
|
|
263
|
-
description: "Tekst som vises i en tag ved siden av label",
|
|
264
|
-
category: "ui"
|
|
265
|
-
},
|
|
266
|
-
useWrapper: {
|
|
267
|
-
type: "boolean",
|
|
268
|
-
name: "Bruk wrapper",
|
|
269
|
-
description: "Indikerer at feltet skal ha synlig label og hjelpetekst",
|
|
270
|
-
displayAsFalse: !0,
|
|
271
|
-
default: !0,
|
|
272
|
-
category: "ui"
|
|
273
|
-
},
|
|
274
|
-
id: {
|
|
275
|
-
type: "string",
|
|
276
|
-
name: "ID",
|
|
277
|
-
description: "Unik identifikasjon for datovelgeren",
|
|
278
|
-
category: "tech"
|
|
279
|
-
},
|
|
280
|
-
ariaDescribedby: {
|
|
281
|
-
attribute: "aria-describedby",
|
|
282
|
-
name: "aria-describedby",
|
|
283
|
-
description: "Spesifiserer ID-en til elementet som beskriver feltet.",
|
|
284
|
-
type: "string",
|
|
285
|
-
category: "accessibility"
|
|
286
|
-
},
|
|
287
|
-
inline: {
|
|
288
|
-
name: "Inline",
|
|
289
|
-
type: "boolean",
|
|
290
|
-
required: !1,
|
|
291
|
-
default: !1,
|
|
292
|
-
description: "Angir om feltet skal flyte med teksten",
|
|
293
|
-
category: "ui"
|
|
294
|
-
},
|
|
295
|
-
hasFieldset: {
|
|
296
|
-
name: "Bruk fieldset",
|
|
297
|
-
type: "boolean",
|
|
298
|
-
required: !1,
|
|
299
|
-
default: null,
|
|
300
|
-
description: "Bruk fieldset og legend i stedet for label. Utledes automatisk når feltet består av flere kontroller.",
|
|
301
|
-
category: "ui"
|
|
302
|
-
},
|
|
303
|
-
counter: {
|
|
304
|
-
name: "Teller",
|
|
305
|
-
type: "boolean",
|
|
306
|
-
required: !1,
|
|
307
|
-
default: null,
|
|
308
|
-
description: "Viser teller under feltet. Slås på av seg selv når det finnes en grense å telle mot; sett til false for å skru den av.",
|
|
309
|
-
category: "ui"
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
events: {
|
|
313
|
-
change: {
|
|
314
|
-
type: "Event",
|
|
315
|
-
name: "change (Elements)",
|
|
316
|
-
description: "Returnerer valgt dato som streng i ISO-format. I range-modus utløses kun når begge datoer er valgt."
|
|
317
|
-
},
|
|
318
|
-
"value-change": {
|
|
319
|
-
type: "CustomEvent",
|
|
320
|
-
name: "value-change (Elements)",
|
|
321
|
-
description: "Returnerer en <code>array</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt."
|
|
322
|
-
},
|
|
323
|
-
toggleHelpText: {
|
|
324
|
-
type: "CustomEvent",
|
|
325
|
-
description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
|
|
326
|
-
},
|
|
327
|
-
onChange: {
|
|
328
|
-
type: "Event",
|
|
329
|
-
name: "onChange (React)",
|
|
330
|
-
reactOnly: !0,
|
|
331
|
-
description: "Utløses når en dato velges. <code>e.target.value</code> inneholder kommaseparerte ISO-datoer. I range-modus utløses kun når begge datoer er valgt."
|
|
332
|
-
},
|
|
333
|
-
onValueChange: {
|
|
334
|
-
type: "string[]",
|
|
335
|
-
name: "onValueChange (React)",
|
|
336
|
-
reactOnly: !0,
|
|
337
|
-
description: "Returnerer en <code>string[]</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt."
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}, O = () => {
|
|
69
|
+
// ../../shared-utils/device-utils.ts
|
|
70
|
+
var T = () => {
|
|
341
71
|
let e = navigator.userAgent;
|
|
342
72
|
return !!(/iP(hone|od|ad)/.test(e) || /Macintosh/.test(e) && "ontouchend" in document);
|
|
343
|
-
},
|
|
73
|
+
}, E = () => T() ? "text" : "date", D = (e) => !e || e.length !== 2 || te(e[0], e[1]), O = (e) => g(e), k = (e, t, n, r, i) => _(e, t, n, r, i), A = (e, t, n, r, i, a, o = "medium") => ({
|
|
344
74
|
"pkt-input": !0,
|
|
345
75
|
"pkt-datepicker__input": !0,
|
|
346
76
|
[`pkt-input--${o}`]: !0,
|
|
@@ -349,20 +79,28 @@ var D = {
|
|
|
349
79
|
"pkt-datepicker--multiple": n,
|
|
350
80
|
"pkt-datepicker--range": r,
|
|
351
81
|
"ios-readonly-hack": i === !1 && a === "text"
|
|
352
|
-
}),
|
|
82
|
+
}), ae = (e = "medium") => ({
|
|
353
83
|
"pkt-input-icon": !0,
|
|
354
84
|
"pkt-btn": !0,
|
|
355
85
|
"pkt-btn--icon-only": !0,
|
|
356
86
|
"pkt-btn--tertiary": !0,
|
|
357
87
|
[`pkt-btn--${e}`]: !0,
|
|
358
88
|
"pkt-datepicker__calendar-button": !0
|
|
359
|
-
}),
|
|
89
|
+
}), j = (e, t, n) => e ?? (t && !!n && n > 0), M = (e, t) => !!e && e > 0 && t >= e, N = (e, t, n = [], r = []) => {
|
|
90
|
+
if (!t || e.length !== 1 || e[0] > t) return e;
|
|
91
|
+
let [i, a] = u([e[0], t]);
|
|
92
|
+
return l(a, [i], u(n), r) ? [e[0], t] : e;
|
|
93
|
+
}, P = (e, t) => e ? t && t >= e ? [e, t] : [e] : [], F = (e) => ({
|
|
360
94
|
"pkt-input-prefix": e,
|
|
361
95
|
"pkt-hide": !e
|
|
362
96
|
}), I = (e, t, n) => !t && !n ? Array.isArray(e) ? e[0] || "" : e : Array.isArray(e) ? e.join(",") : e, L = (e, t, n = !1) => {
|
|
363
97
|
if (!e || !t) return;
|
|
364
|
-
let r = t.parentElement?.getBoundingClientRect() || t.getBoundingClientRect(), i = n ? r.height + 30 : r.height, a = e.getBoundingClientRect().height, o = n ? "calc(100% - 30px)" : "100%";
|
|
365
|
-
|
|
98
|
+
let r = t.parentElement?.getBoundingClientRect() || t.getBoundingClientRect(), i = n ? r.height + 30 : r.height, a = e.getBoundingClientRect().height, o = e instanceof Element && parseFloat(getComputedStyle(e).marginTop) || 0, s = n ? "calc(100% - 30px)" : "100%";
|
|
99
|
+
if (typeof window < "u") {
|
|
100
|
+
let e = r.top + r.height + o + a <= window.innerHeight, t = r.top - o - a >= 0;
|
|
101
|
+
!e && t && (s = `calc(100% - ${i}px - ${a}px - ${2 * o}px)`);
|
|
102
|
+
}
|
|
103
|
+
e.style.top = s;
|
|
366
104
|
}, R = (e, t, n, r, i, a) => {
|
|
367
105
|
let { key: o } = e;
|
|
368
106
|
o === "," && (e.preventDefault(), a ? a(e) : i && i()), (o === "Space" || o === " ") && (e.preventDefault(), t(e)), o === "Enter" && (e.preventDefault(), n ? n() : r ? r() : i && i());
|
|
@@ -370,10 +108,10 @@ var D = {
|
|
|
370
108
|
let { key: n } = e;
|
|
371
109
|
(n === "Enter" || n === " " || n === "Space") && (e.preventDefault(), t(e));
|
|
372
110
|
}, B = {
|
|
373
|
-
validateRangeOrder:
|
|
374
|
-
sortDates:
|
|
375
|
-
filterSelectableDates:
|
|
376
|
-
}, V = { getInputType:
|
|
111
|
+
validateRangeOrder: D,
|
|
112
|
+
sortDates: O,
|
|
113
|
+
filterSelectableDates: k
|
|
114
|
+
}, V = { getInputType: E }, H = {
|
|
377
115
|
submitForm(e) {
|
|
378
116
|
let t = e.internals?.form;
|
|
379
117
|
t && t.requestSubmit();
|
|
@@ -381,49 +119,32 @@ var D = {
|
|
|
381
119
|
submitFormOrFallback(e, t) {
|
|
382
120
|
let n = e?.form;
|
|
383
121
|
n ? n.requestSubmit() : t();
|
|
384
|
-
},
|
|
385
|
-
validateDateInput(e, t, n, r, i) {
|
|
386
|
-
let o = e.value;
|
|
387
|
-
if (!o) return;
|
|
388
|
-
let s = {
|
|
389
|
-
...a.validation,
|
|
390
|
-
...i
|
|
391
|
-
};
|
|
392
|
-
n && n > o ? t.setValidity({ rangeUnderflow: !0 }, s.dateUnderflow, e) : r && r < o && t.setValidity({ rangeOverflow: !0 }, s.dateOverflow, e);
|
|
393
122
|
}
|
|
394
123
|
}, U = {
|
|
395
124
|
addToSelected(e, t, n, r) {
|
|
396
125
|
let i = e.target;
|
|
397
126
|
if (!i.value) return;
|
|
398
|
-
let a = n ?
|
|
127
|
+
let a = n ? h(n) : null, o = r ? h(r) : null, s = h(i.value.split(",")[0]);
|
|
399
128
|
s && !isNaN(s.getTime()) && (!a || s >= a) && (!o || s <= o) && t.value && t.value.handleDateSelect(s), i.value = "";
|
|
400
129
|
},
|
|
401
130
|
handleCalendarPosition(e, t, n = !1) {
|
|
402
131
|
L(e.value ?? null, t.value ?? null, n);
|
|
403
132
|
}
|
|
404
133
|
}, W = {
|
|
405
|
-
getInputClasses:
|
|
406
|
-
getButtonClasses:
|
|
134
|
+
getInputClasses: A,
|
|
135
|
+
getButtonClasses: ae,
|
|
407
136
|
getRangeLabelClasses: F
|
|
408
137
|
}, G = {
|
|
409
138
|
processDateSelection: I,
|
|
410
139
|
updateInputValues(e, t, n, r, i, a) {
|
|
411
140
|
e.value && (r && t?.value ? (e.value.value = n[0] ?? "", t.value.value = n[1] ?? "", a(e.value), a(t.value)) : i || (e.value.value = n.length ? n[0] : "", a(e.value)));
|
|
412
|
-
},
|
|
413
|
-
processRangeBlur(e, t, n, r, i) {
|
|
414
|
-
let a = e.target;
|
|
415
|
-
if (a.value) {
|
|
416
|
-
i(a);
|
|
417
|
-
let e = h(a.value);
|
|
418
|
-
e && n?.value?.handleDateSelect(e);
|
|
419
|
-
} else t[0] && r();
|
|
420
141
|
}
|
|
421
142
|
}, K = {
|
|
422
143
|
handleInputKeydown: R,
|
|
423
144
|
handleButtonKeydown: z
|
|
424
|
-
}, q = class extends
|
|
145
|
+
}, q = class extends a {
|
|
425
146
|
constructor(...e) {
|
|
426
|
-
super(...e), this.open = !1, this.multiple = !1, this.range = !1, this.weeknumbers = !1, this.withcontrols = !1, this.maxMultiple = null, this.selected = [], this.earliest = null, this.latest = null, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.today = null, this._hasBeenOpened = !1, this.popupRef =
|
|
147
|
+
super(...e), this.open = !1, this.multiple = !1, this.range = !1, this.weeknumbers = !1, this.withcontrols = !1, this.maxMultiple = null, this.selected = [], this.earliest = null, this.latest = null, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.today = null, this._hasBeenOpened = !1, this.popupRef = p(), this.calendarRef = p(), this.handleDocumentClick = (e) => {
|
|
427
148
|
if (!this.open) return;
|
|
428
149
|
let t = e.composedPath(), n = this.parentElement, r = this.popupRef.value;
|
|
429
150
|
t.includes(this) || t.includes(r) || n && t.includes(n) || (this.hide(), this.dispatchEvent(new CustomEvent("close", {
|
|
@@ -437,9 +158,6 @@ var D = {
|
|
|
437
158
|
})));
|
|
438
159
|
};
|
|
439
160
|
}
|
|
440
|
-
firstUpdated() {
|
|
441
|
-
this.calRef = this.calendarRef;
|
|
442
|
-
}
|
|
443
161
|
willUpdate(e) {
|
|
444
162
|
super.willUpdate(e), e.has("open") && this.open && (this._hasBeenOpened = !0);
|
|
445
163
|
}
|
|
@@ -469,13 +187,13 @@ var D = {
|
|
|
469
187
|
if (this.calendarRef.value && typeof U.addToSelected == "function") return U.addToSelected(e, this.calendarRef, t, n);
|
|
470
188
|
let r = e.target;
|
|
471
189
|
if (!r.value) return;
|
|
472
|
-
let i = t ?
|
|
190
|
+
let i = t ? h(t) : null, a = n ? h(n) : null, o = h(r.value.split(",")[0]);
|
|
473
191
|
o && !isNaN(o.getTime()) && (!i || o >= i) && (!a || o <= a) && this.handleDateSelect(o), r.value = "";
|
|
474
192
|
}
|
|
475
193
|
handleDateSelect(e) {
|
|
476
194
|
let t = this.calendarRef.value;
|
|
477
195
|
if (t && typeof t.handleDateSelect == "function") return t.handleDateSelect(e);
|
|
478
|
-
let n =
|
|
196
|
+
let n = ee(e), r = this.selected.indexOf(n) >= 0 ? this.selected.filter((e) => e !== n) : [...this.selected, n];
|
|
479
197
|
this.selected = r, this.dispatchEvent(new CustomEvent("date-selected", {
|
|
480
198
|
detail: r,
|
|
481
199
|
bubbles: !0,
|
|
@@ -490,14 +208,14 @@ var D = {
|
|
|
490
208
|
};
|
|
491
209
|
return e`
|
|
492
210
|
<div
|
|
493
|
-
class="${
|
|
494
|
-
${
|
|
211
|
+
class="${s(t)}"
|
|
212
|
+
${f(this.popupRef)}
|
|
495
213
|
id="date-popup"
|
|
496
214
|
?hidden=${!this.open}
|
|
497
215
|
aria-hidden="${!this.open}"
|
|
498
216
|
>
|
|
499
217
|
${this.open || this._hasBeenOpened ? e`<pkt-calendar
|
|
500
|
-
${
|
|
218
|
+
${f(this.calendarRef)}
|
|
501
219
|
?multiple=${this.multiple}
|
|
502
220
|
?range=${this.range}
|
|
503
221
|
?weeknumbers=${this.weeknumbers}
|
|
@@ -511,14 +229,14 @@ var D = {
|
|
|
511
229
|
.currentmonth=${this.currentmonth}
|
|
512
230
|
.today=${this.today}
|
|
513
231
|
@date-selected=${(e) => {
|
|
514
|
-
this.selected = e.detail, this.dispatchEvent(new CustomEvent("date-selected", {
|
|
232
|
+
e.stopPropagation(), this.selected = e.detail, this.dispatchEvent(new CustomEvent("date-selected", {
|
|
515
233
|
detail: e.detail,
|
|
516
234
|
bubbles: !0,
|
|
517
235
|
composed: !0
|
|
518
236
|
}));
|
|
519
237
|
}}
|
|
520
|
-
@close=${() => {
|
|
521
|
-
this.hide(), this.dispatchEvent(new CustomEvent("close", {
|
|
238
|
+
@close=${(e) => {
|
|
239
|
+
e.stopPropagation(), this.hide(), this.dispatchEvent(new CustomEvent("close", {
|
|
522
240
|
bubbles: !0,
|
|
523
241
|
composed: !0
|
|
524
242
|
}));
|
|
@@ -528,19 +246,19 @@ var D = {
|
|
|
528
246
|
`;
|
|
529
247
|
}
|
|
530
248
|
};
|
|
531
|
-
i([
|
|
249
|
+
i([o({
|
|
532
250
|
type: Boolean,
|
|
533
251
|
reflect: !0
|
|
534
|
-
})], q.prototype, "open", void 0), i([
|
|
252
|
+
})], q.prototype, "open", void 0), i([o({ type: Boolean })], q.prototype, "multiple", void 0), i([o({ type: Boolean })], q.prototype, "range", void 0), i([o({ type: Boolean })], q.prototype, "weeknumbers", void 0), i([o({ type: Boolean })], q.prototype, "withcontrols", void 0), i([o({ type: Number })], q.prototype, "maxMultiple", void 0), i([o({ type: Array })], q.prototype, "selected", void 0), i([o({ type: String })], q.prototype, "earliest", void 0), i([o({ type: String })], q.prototype, "latest", void 0), i([o({ type: Array })], q.prototype, "excludedates", void 0), i([o({ type: Array })], q.prototype, "excludeweekdays", void 0), i([o({ type: String })], q.prototype, "currentmonth", void 0), i([o({ type: String })], q.prototype, "today", void 0), i([r()], q.prototype, "_hasBeenOpened", void 0);
|
|
535
253
|
try {
|
|
536
254
|
t("pkt-datepicker-popup")(q);
|
|
537
255
|
} catch {
|
|
538
256
|
console.warn("Forsøker å definere <pkt-datepicker-popup>, men den er allerede definert");
|
|
539
257
|
}
|
|
540
258
|
// src/components/datepicker/datepicker-base.ts
|
|
541
|
-
var J = class extends
|
|
259
|
+
var J = class extends a {
|
|
542
260
|
constructor(...e) {
|
|
543
|
-
super(...e), this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.inputClasses = {}, this.inputSize = "medium", this.hasError = !1, this.hasHelptext = !1, this.inputRef =
|
|
261
|
+
super(...e), this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.inputClasses = {}, this.inputSize = "medium", this.hasError = !1, this.hasHelptext = !1, this.inputRef = p(), this.btnRef = p();
|
|
544
262
|
}
|
|
545
263
|
get describedBy() {
|
|
546
264
|
return this.hasHelptext ? `${this.id}-input-helptext` : void 0;
|
|
@@ -594,7 +312,7 @@ var J = class extends o {
|
|
|
594
312
|
renderCalendarButton() {
|
|
595
313
|
return e`
|
|
596
314
|
<button
|
|
597
|
-
class="${
|
|
315
|
+
class="${s(W.getButtonClasses(this.inputSize))}"
|
|
598
316
|
type="button"
|
|
599
317
|
@click=${(e) => this.dispatchToggleCalendar(e)}
|
|
600
318
|
@keydown=${(e) => {
|
|
@@ -613,7 +331,7 @@ var J = class extends o {
|
|
|
613
331
|
return this;
|
|
614
332
|
}
|
|
615
333
|
};
|
|
616
|
-
i([
|
|
334
|
+
i([o({ type: String })], J.prototype, "inputType", void 0), i([o({ type: String })], J.prototype, "id", void 0), i([o({ type: String })], J.prototype, "min", void 0), i([o({ type: String })], J.prototype, "max", void 0), i([o({ type: String })], J.prototype, "placeholder", void 0), i([o({ type: Boolean })], J.prototype, "readonly", void 0), i([o({ type: Boolean })], J.prototype, "disabled", void 0), i([o({ type: Object })], J.prototype, "inputClasses", void 0), i([o({ type: String })], J.prototype, "inputSize", void 0), i([o({ type: Object })], J.prototype, "internals", void 0), i([o({ type: Boolean })], J.prototype, "hasError", void 0), i([o({ type: Boolean })], J.prototype, "hasHelptext", void 0);
|
|
617
335
|
// src/components/datepicker/datepicker-single.ts
|
|
618
336
|
var Y = class extends J {
|
|
619
337
|
constructor(...e) {
|
|
@@ -630,17 +348,17 @@ var Y = class extends J {
|
|
|
630
348
|
return e`
|
|
631
349
|
<div class="pkt-input__container">
|
|
632
350
|
<input
|
|
633
|
-
class="${
|
|
351
|
+
class="${s(this.inputClasses)}"
|
|
634
352
|
.type=${this.inputType}
|
|
635
353
|
id="${this.id}-input"
|
|
636
354
|
.value=${this.value}
|
|
637
|
-
min=${
|
|
638
|
-
max=${
|
|
639
|
-
placeholder=${
|
|
355
|
+
min=${d(this.min)}
|
|
356
|
+
max=${d(this.max)}
|
|
357
|
+
placeholder=${d(this.placeholder)}
|
|
640
358
|
?readonly=${this.isInputReadonly}
|
|
641
|
-
aria-describedby=${
|
|
359
|
+
aria-describedby=${d(this.describedBy)}
|
|
642
360
|
aria-invalid=${this.hasError}
|
|
643
|
-
aria-errormessage=${
|
|
361
|
+
aria-errormessage=${d(this.errorMessageId)}
|
|
644
362
|
@click=${(e) => {
|
|
645
363
|
e.preventDefault(), this.dispatchToggleCalendar(e);
|
|
646
364
|
}}
|
|
@@ -653,7 +371,7 @@ var Y = class extends J {
|
|
|
653
371
|
this.dispatchInput(e), e.stopImmediatePropagation();
|
|
654
372
|
}}
|
|
655
373
|
@focus=${() => {
|
|
656
|
-
this.dispatchFocus(),
|
|
374
|
+
this.dispatchFocus(), T() && this.dispatchToggleCalendar(new Event("focus"));
|
|
657
375
|
}}
|
|
658
376
|
@blur=${(e) => {
|
|
659
377
|
this.dispatchBlur(e), this.dispatchManageValidity(e.target), this.dispatchEvent(new CustomEvent("value-change", {
|
|
@@ -665,14 +383,14 @@ var Y = class extends J {
|
|
|
665
383
|
@change=${(e) => {
|
|
666
384
|
this.dispatchChange(e), e.stopImmediatePropagation();
|
|
667
385
|
}}
|
|
668
|
-
${
|
|
386
|
+
${f(this.inputRef)}
|
|
669
387
|
/>
|
|
670
388
|
${this.renderCalendarButton()}
|
|
671
389
|
</div>
|
|
672
390
|
`;
|
|
673
391
|
}
|
|
674
392
|
};
|
|
675
|
-
i([
|
|
393
|
+
i([o({ type: String })], Y.prototype, "value", void 0);
|
|
676
394
|
try {
|
|
677
395
|
t("pkt-datepicker-single")(Y);
|
|
678
396
|
} catch {
|
|
@@ -681,7 +399,7 @@ try {
|
|
|
681
399
|
// src/components/datepicker/datepicker-range.ts
|
|
682
400
|
var X = class extends J {
|
|
683
401
|
constructor(...e) {
|
|
684
|
-
super(...e), this.value = [], this.label = "", this.showRangeLabels = !1, this.inputRefTo =
|
|
402
|
+
super(...e), this.value = [], this.label = "", this.showRangeLabels = !1, this.inputRefTo = p();
|
|
685
403
|
}
|
|
686
404
|
get inputElementTo() {
|
|
687
405
|
return this.inputRefTo.value;
|
|
@@ -692,17 +410,17 @@ var X = class extends J {
|
|
|
692
410
|
<div class="pkt-input__container">
|
|
693
411
|
${this.showRangeLabels ? e` <div class="pkt-input-prefix">${this.pktStrings.get("generic").from}</div> ` : n}
|
|
694
412
|
<input
|
|
695
|
-
aria-describedby=${
|
|
413
|
+
aria-describedby=${d(this.describedBy)}
|
|
696
414
|
aria-invalid=${this.hasError}
|
|
697
|
-
aria-errormessage=${
|
|
698
|
-
class=${
|
|
415
|
+
aria-errormessage=${d(this.errorMessageId)}
|
|
416
|
+
class=${s(this.inputClasses)}
|
|
699
417
|
.type=${this.inputType}
|
|
700
418
|
id="${this.id}-input"
|
|
701
419
|
aria-label="${this.label} ${this.pktStrings.get("generic").from}"
|
|
702
420
|
.value=${this.value[0] ?? ""}
|
|
703
|
-
min=${
|
|
704
|
-
max=${
|
|
705
|
-
placeholder=${
|
|
421
|
+
min=${d(this.min)}
|
|
422
|
+
max=${d(this.max)}
|
|
423
|
+
placeholder=${d(this.placeholder)}
|
|
706
424
|
?readonly=${this.isInputReadonly}
|
|
707
425
|
?disabled=${this.disabled}
|
|
708
426
|
@click=${(e) => {
|
|
@@ -716,7 +434,7 @@ var X = class extends J {
|
|
|
716
434
|
this.dispatchInput(e), e.stopImmediatePropagation();
|
|
717
435
|
}}
|
|
718
436
|
@focus=${() => {
|
|
719
|
-
this.dispatchFocus(),
|
|
437
|
+
this.dispatchFocus(), T() && this.dispatchToggleCalendar(new Event("focus"));
|
|
720
438
|
}}
|
|
721
439
|
@blur=${(e) => {
|
|
722
440
|
this.dispatchBlur(e), this.dispatchEvent(new CustomEvent("range-blur", {
|
|
@@ -732,24 +450,24 @@ var X = class extends J {
|
|
|
732
450
|
@change=${(e) => {
|
|
733
451
|
this.dispatchChange(e), e.stopImmediatePropagation();
|
|
734
452
|
}}
|
|
735
|
-
${
|
|
453
|
+
${f(this.inputRef)}
|
|
736
454
|
/>
|
|
737
|
-
<div class="${
|
|
455
|
+
<div class="${s(t)}" id="${this.id}-to-label">
|
|
738
456
|
${this.pktStrings.get("generic").to}
|
|
739
457
|
</div>
|
|
740
458
|
${this.showRangeLabels ? n : e` <div class="pkt-input-separator">–</div> `}
|
|
741
459
|
<input
|
|
742
|
-
aria-describedby=${
|
|
460
|
+
aria-describedby=${d(this.describedBy)}
|
|
743
461
|
aria-invalid=${this.hasError}
|
|
744
|
-
aria-errormessage=${
|
|
745
|
-
class=${
|
|
462
|
+
aria-errormessage=${d(this.errorMessageId)}
|
|
463
|
+
class=${s(this.inputClasses)}
|
|
746
464
|
.type=${this.inputType}
|
|
747
465
|
id="${this.id}-to"
|
|
748
466
|
aria-label="${this.label} ${this.pktStrings.get("generic").to}"
|
|
749
467
|
.value=${this.value[1] ?? ""}
|
|
750
|
-
min=${
|
|
751
|
-
max=${
|
|
752
|
-
placeholder=${
|
|
468
|
+
min=${d(this.min)}
|
|
469
|
+
max=${d(this.max)}
|
|
470
|
+
placeholder=${d(this.placeholder)}
|
|
753
471
|
?readonly=${this.isInputReadonly}
|
|
754
472
|
?disabled=${this.disabled}
|
|
755
473
|
@click=${(e) => {
|
|
@@ -763,7 +481,7 @@ var X = class extends J {
|
|
|
763
481
|
this.dispatchInput(e), e.stopImmediatePropagation();
|
|
764
482
|
}}
|
|
765
483
|
@focus=${() => {
|
|
766
|
-
this.dispatchFocus(),
|
|
484
|
+
this.dispatchFocus(), T() && this.dispatchToggleCalendar(new Event("focus"));
|
|
767
485
|
}}
|
|
768
486
|
@blur=${(e) => {
|
|
769
487
|
this.dispatchBlur(e), this.dispatchEvent(new CustomEvent("range-blur", {
|
|
@@ -779,14 +497,14 @@ var X = class extends J {
|
|
|
779
497
|
@change=${(e) => {
|
|
780
498
|
this.dispatchChange(e), e.stopImmediatePropagation();
|
|
781
499
|
}}
|
|
782
|
-
${
|
|
500
|
+
${f(this.inputRefTo)}
|
|
783
501
|
/>
|
|
784
502
|
${this.renderCalendarButton()}
|
|
785
503
|
</div>
|
|
786
504
|
`;
|
|
787
505
|
}
|
|
788
506
|
};
|
|
789
|
-
i([
|
|
507
|
+
i([o({ type: Array })], X.prototype, "value", void 0), i([o({ type: String })], X.prototype, "label", void 0), i([o({ type: Boolean })], X.prototype, "showRangeLabels", void 0);
|
|
790
508
|
try {
|
|
791
509
|
t("pkt-datepicker-range")(X);
|
|
792
510
|
} catch {
|
|
@@ -798,7 +516,7 @@ var Z = class extends J {
|
|
|
798
516
|
super(...e), this.value = [];
|
|
799
517
|
}
|
|
800
518
|
get isInputDisabled() {
|
|
801
|
-
return this.disabled || this.maxlength
|
|
519
|
+
return this.disabled || M(this.maxlength, this.value.length);
|
|
802
520
|
}
|
|
803
521
|
dispatchAddToSelected(e) {
|
|
804
522
|
this.dispatchEvent(new CustomEvent("add-to-selected", {
|
|
@@ -811,15 +529,15 @@ var Z = class extends J {
|
|
|
811
529
|
return e`
|
|
812
530
|
<div class="pkt-input__container">
|
|
813
531
|
<input
|
|
814
|
-
aria-describedby=${
|
|
532
|
+
aria-describedby=${d(this.describedBy)}
|
|
815
533
|
aria-invalid=${this.hasError}
|
|
816
|
-
aria-errormessage=${
|
|
817
|
-
class=${
|
|
534
|
+
aria-errormessage=${d(this.errorMessageId)}
|
|
535
|
+
class=${s(this.inputClasses)}
|
|
818
536
|
.type=${this.inputType}
|
|
819
537
|
id="${this.id}-input"
|
|
820
|
-
min=${
|
|
821
|
-
max=${
|
|
822
|
-
placeholder=${
|
|
538
|
+
min=${d(this.min)}
|
|
539
|
+
max=${d(this.max)}
|
|
540
|
+
placeholder=${d(this.placeholder)}
|
|
823
541
|
?readonly=${this.isInputReadonly}
|
|
824
542
|
?disabled=${this.isInputDisabled}
|
|
825
543
|
@click=${(e) => {
|
|
@@ -835,32 +553,48 @@ var Z = class extends J {
|
|
|
835
553
|
this.dispatchInput(e), e.stopImmediatePropagation();
|
|
836
554
|
}}
|
|
837
555
|
@focus=${() => {
|
|
838
|
-
this.dispatchFocus(),
|
|
556
|
+
this.dispatchFocus(), T() && this.dispatchToggleCalendar(new Event("focus"));
|
|
839
557
|
}}
|
|
840
558
|
@keydown=${(e) => K.handleInputKeydown(e, (e) => this.dispatchToggleCalendar(e), () => H.submitFormOrFallback(this.internals, () => this.inputRef.value?.blur()), void 0, void 0, (e) => this.dispatchAddToSelected(e))}
|
|
841
559
|
@change=${(e) => {
|
|
842
560
|
this.dispatchChange(e), e.stopImmediatePropagation();
|
|
843
561
|
}}
|
|
844
|
-
${
|
|
562
|
+
${f(this.inputRef)}
|
|
845
563
|
/>
|
|
846
564
|
${this.renderCalendarButton()}
|
|
847
565
|
</div>
|
|
848
566
|
`;
|
|
849
567
|
}
|
|
850
568
|
};
|
|
851
|
-
i([
|
|
569
|
+
i([o({ type: Array })], Z.prototype, "value", void 0), i([o({ type: Number })], Z.prototype, "maxlength", void 0);
|
|
852
570
|
try {
|
|
853
571
|
t("pkt-datepicker-multiple")(Z);
|
|
854
572
|
} catch {
|
|
855
573
|
console.warn("Forsøker å definere <pkt-datepicker-multiple>, men den er allerede definert");
|
|
856
574
|
}
|
|
857
|
-
//
|
|
858
|
-
var
|
|
575
|
+
// ../../shared-utils/forms/focus-within.ts
|
|
576
|
+
var oe = (e, t) => {
|
|
577
|
+
let n = !1, r = (t) => typeof Node < "u" && t instanceof Node && t.isConnected && e(t);
|
|
578
|
+
return {
|
|
579
|
+
focusin(e) {
|
|
580
|
+
n || r(e) ? n = !0 : (n = !0, t("focus", e));
|
|
581
|
+
},
|
|
582
|
+
focusout(e) {
|
|
583
|
+
r(e) || (n = !1, t("blur", e));
|
|
584
|
+
},
|
|
585
|
+
reset() {
|
|
586
|
+
n = !1;
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
}, Q, $ = class t extends ie {
|
|
859
590
|
constructor(...e) {
|
|
860
|
-
super(...e), this._valueProperty = "", this.datepickerPopupRef =
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
591
|
+
super(...e), this._valueProperty = "", this.datepickerPopupRef = p(), this._value = [], this.label = "Datovelger", this.dateformat = C.dateformat, this.multiple = C.multiple, this.maxlength = null, this.range = C.range, this.showRangeLabels = C.showRangeLabels, this.min = null, this.max = null, this.weeknumbers = C.weeknumbers, this.withcontrols = C.withcontrols, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.today = null, this.calendarOpen = C.calendarOpen, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.toWithoutFrom = null, this.editedRangeFields = null, this.focusTracker = oe((e) => this.contains(e), (e, t) => {
|
|
592
|
+
e === "blur" && this.dropToWithoutFrom(), this.dispatchEvent(new FocusEvent(e, {
|
|
593
|
+
bubbles: !0,
|
|
594
|
+
composed: !0,
|
|
595
|
+
relatedTarget: t
|
|
596
|
+
}));
|
|
597
|
+
}), this.lastCalendarSelected = [], this.handleFocusIn = (e) => this.focusTracker.focusin(e.relatedTarget), this.handleFocusOut = (e) => this.focusTracker.focusout(e.relatedTarget), this.popupRef = p(), this.singleInputRef = p(), this.rangeInputRef = p(), this.multipleInputRef = p(), this.addToSelected = (e) => this.datepickerPopupRef.value?.addToSelected(e, this.min, this.max);
|
|
864
598
|
}
|
|
865
599
|
get value() {
|
|
866
600
|
return this._valueProperty;
|
|
@@ -872,11 +606,50 @@ var Q, $ = class t extends te {
|
|
|
872
606
|
get inputType() {
|
|
873
607
|
return V.getInputType();
|
|
874
608
|
}
|
|
609
|
+
get hasCounter() {
|
|
610
|
+
return j(this.counter, this.multiple, this.maxlength);
|
|
611
|
+
}
|
|
875
612
|
connectedCallback() {
|
|
876
|
-
super.connectedCallback(), this.timezone && this.timezone !== window.pktTz && (window.pktTz = this.timezone);
|
|
613
|
+
super.connectedCallback(), this.timezone && this.timezone !== window.pktTz && (window.pktTz = this.timezone), this.addEventListener("focusin", this.handleFocusIn), this.addEventListener("focusout", this.handleFocusOut);
|
|
877
614
|
}
|
|
878
615
|
disconnectedCallback() {
|
|
879
|
-
super.disconnectedCallback();
|
|
616
|
+
super.disconnectedCallback(), this.removeEventListener("focusin", this.handleFocusIn), this.removeEventListener("focusout", this.handleFocusOut), this.focusTracker.reset();
|
|
617
|
+
}
|
|
618
|
+
get rangeFieldValues() {
|
|
619
|
+
return this._value[0] ? this._value : ["", this.toWithoutFrom ?? ""];
|
|
620
|
+
}
|
|
621
|
+
get calendarSelected() {
|
|
622
|
+
if (!this.range) return this._value;
|
|
623
|
+
let [e, t] = this.editedRangeFields ?? this._value, n = P(e, t);
|
|
624
|
+
return y(n) !== y(this.lastCalendarSelected) && (this.lastCalendarSelected = n), this.lastCalendarSelected;
|
|
625
|
+
}
|
|
626
|
+
trackRangeFields() {
|
|
627
|
+
this.editedRangeFields = [this.currentInputElement?.value ?? "", this.currentInputElementTo?.value ?? ""];
|
|
628
|
+
}
|
|
629
|
+
syncRangeFromFields(e) {
|
|
630
|
+
let t = this.currentInputElement, n = this.currentInputElementTo;
|
|
631
|
+
if (!t || !n) return;
|
|
632
|
+
let r = t.value;
|
|
633
|
+
r && n.value && r > n.value && (n.value = "");
|
|
634
|
+
let i = n.value;
|
|
635
|
+
this.toWithoutFrom = r ? null : i || null, this.editedRangeFields = null, e.target instanceof HTMLInputElement && e.target.value && this.manageValidity(e.target), this.value = r ? [r, i].filter(Boolean).join(",") : "";
|
|
636
|
+
}
|
|
637
|
+
dropToWithoutFrom() {
|
|
638
|
+
let e = this.currentInputElementTo;
|
|
639
|
+
this.range && e && !this.currentInputElement?.value && (e.value = ""), this.toWithoutFrom = null, this.editedRangeFields = null;
|
|
640
|
+
}
|
|
641
|
+
formResetCallback() {
|
|
642
|
+
this.toWithoutFrom = null, this.editedRangeFields = null, super.formResetCallback();
|
|
643
|
+
}
|
|
644
|
+
setFormValue(e) {
|
|
645
|
+
super.setFormValue(this.multiple || this.range ? b(e) : e);
|
|
646
|
+
}
|
|
647
|
+
focusField() {
|
|
648
|
+
this.currentInputElement?.focus();
|
|
649
|
+
}
|
|
650
|
+
get focusIsInPopup() {
|
|
651
|
+
let e = this.datepickerPopupRef.value?.popupRef.value;
|
|
652
|
+
return !!e && e.contains(document.activeElement);
|
|
880
653
|
}
|
|
881
654
|
onInput() {
|
|
882
655
|
this.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
@@ -885,11 +658,15 @@ var Q, $ = class t extends te {
|
|
|
885
658
|
e !== t && (this.value = e ?? "", this.deriveValue(t));
|
|
886
659
|
}
|
|
887
660
|
deriveValue(e) {
|
|
888
|
-
let t =
|
|
889
|
-
this.range && !B.validateRangeOrder(n) ? (this._valueProperty = "", this.getAttribute("value") && this.setAttribute("value", ""), super.valueChanged("", e), this._value = []) : (this._valueProperty =
|
|
661
|
+
let t = b(this._valueProperty), n = this.multiple && t.length > 1 ? B.filterSelectableDates(t, this.min, this.max, this.excludedates, this.excludeweekdays) : t;
|
|
662
|
+
this.range && !B.validateRangeOrder(n) ? (this._valueProperty = "", this.getAttribute("value") && this.setAttribute("value", ""), super.valueChanged("", e), this._value = []) : (this._valueProperty = y(n), this.range && n.length === 1 ? (this.setFormValue(this._valueProperty), this.hasUpdated && this._valueProperty !== e && this.dispatchEvent(new CustomEvent("value-change", {
|
|
663
|
+
detail: n,
|
|
664
|
+
bubbles: !0,
|
|
665
|
+
composed: !0
|
|
666
|
+
}))) : super.valueChanged(this._valueProperty, e), this._value = n);
|
|
890
667
|
}
|
|
891
668
|
attributeChangedCallback(e, t, n) {
|
|
892
|
-
e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates =
|
|
669
|
+
e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = b(n || "")), e === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = b(n || "")), super.attributeChangedCallback(e, t, n);
|
|
893
670
|
}
|
|
894
671
|
willUpdate(e) {
|
|
895
672
|
if (super.willUpdate(e), t.DERIVED_FROM.some((t) => e.has(t))) {
|
|
@@ -898,7 +675,7 @@ var Q, $ = class t extends te {
|
|
|
898
675
|
}
|
|
899
676
|
}
|
|
900
677
|
updated(e) {
|
|
901
|
-
this.classList.add("pkt-datepicker"), this.classList.toggle("pkt-datepicker--fullwidth", this.fullwidth), this.classList.toggle("pkt-datepicker--medium", this.inputSize === "medium"), this.classList.toggle("pkt-datepicker--small", this.inputSize === "small"), this.classList.toggle("pkt-datepicker--xsmall", this.inputSize === "xsmall"), super.updated(e);
|
|
678
|
+
this.classList.add("pkt-datepicker"), this.classList.toggle("pkt-datepicker--fullwidth", this.fullwidth), this.classList.toggle("pkt-datepicker--medium", this.inputSize === "medium"), this.classList.toggle("pkt-datepicker--small", this.inputSize === "small"), this.classList.toggle("pkt-datepicker--xsmall", this.inputSize === "xsmall"), super.updated(e), this.calendarOpen && t.POSITIONED_BY.some((t) => e.has(t)) && this.positionOpenCalendar();
|
|
902
679
|
}
|
|
903
680
|
get inputRef() {
|
|
904
681
|
return { value: this.currentInputElement };
|
|
@@ -937,10 +714,6 @@ var Q, $ = class t extends te {
|
|
|
937
714
|
.strings=${this.strings}
|
|
938
715
|
@toggle-calendar=${(e) => this.toggleCalendar(e.detail)}
|
|
939
716
|
@input-change=${() => this.onInput()}
|
|
940
|
-
@input-focus=${() => this.onFocus()}
|
|
941
|
-
@input-blur=${(e) => {
|
|
942
|
-
this.calRef.value?.contains(e.detail.relatedTarget) || this.onBlur();
|
|
943
|
-
}}
|
|
944
717
|
@manage-validity=${(e) => this.manageValidity(e.detail)}
|
|
945
718
|
@value-change=${(e) => {
|
|
946
719
|
this.value = e.detail;
|
|
@@ -948,14 +721,14 @@ var Q, $ = class t extends te {
|
|
|
948
721
|
@input-changed=${() => {
|
|
949
722
|
this.touched = !0;
|
|
950
723
|
}}
|
|
951
|
-
${
|
|
724
|
+
${f(this.singleInputRef)}
|
|
952
725
|
></pkt-datepicker-single>
|
|
953
726
|
`;
|
|
954
727
|
}
|
|
955
728
|
renderRangeInput() {
|
|
956
729
|
return e`
|
|
957
730
|
<pkt-datepicker-range
|
|
958
|
-
.value=${this.
|
|
731
|
+
.value=${this.rangeFieldValues}
|
|
959
732
|
.inputType=${this.inputType}
|
|
960
733
|
.id=${this.id}
|
|
961
734
|
.label=${this.label}
|
|
@@ -972,38 +745,15 @@ var Q, $ = class t extends te {
|
|
|
972
745
|
.hasHelptext=${!!(this.helptext || this.helptextDropdown || this.hasSlotContent("helptext"))}
|
|
973
746
|
.strings=${this.strings}
|
|
974
747
|
@toggle-calendar=${(e) => this.toggleCalendar(e.detail)}
|
|
975
|
-
@input-change=${() =>
|
|
976
|
-
|
|
977
|
-
@input-blur=${(e) => {
|
|
978
|
-
this.calRef.value?.contains(e.detail.relatedTarget) || this.onBlur();
|
|
979
|
-
}}
|
|
980
|
-
@range-blur=${(e) => {
|
|
981
|
-
let t = this.currentInputElement, n = this.currentInputElementTo;
|
|
982
|
-
if (t && n) {
|
|
983
|
-
let e = t.value, r = n.value;
|
|
984
|
-
if (e && r && e > r) n.value = "", this._value = [e], this.value = e;
|
|
985
|
-
else {
|
|
986
|
-
let t = [e, r].filter(Boolean);
|
|
987
|
-
t.length > 0 && (t[0] !== this._value[0] || t[1] !== this._value[1]) && (this._value = t, this.value = t.join(","));
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
G.processRangeBlur(e.detail.event, e.detail.values, this.calRef, () => this.clearInputValue(), (e) => this.manageValidity(e));
|
|
748
|
+
@input-change=${() => {
|
|
749
|
+
this.trackRangeFields(), this.onInput();
|
|
991
750
|
}}
|
|
751
|
+
@range-blur=${(e) => this.syncRangeFromFields(e.detail.event)}
|
|
992
752
|
@manage-validity=${(e) => this.manageValidity(e.detail)}
|
|
993
|
-
@validate-date-input=${(e) => {
|
|
994
|
-
H.validateDateInput(e.detail, this.internals, this.min, this.max, this.pktStrings.get("validation"));
|
|
995
|
-
}}
|
|
996
|
-
@handle-date-select=${(e) => {
|
|
997
|
-
let t = h(e.detail);
|
|
998
|
-
if (t) {
|
|
999
|
-
let e = c(t);
|
|
1000
|
-
this._value[0] !== e && this._value[1] !== e && this.calRef?.value?.handleDateSelect(t);
|
|
1001
|
-
}
|
|
1002
|
-
}}
|
|
1003
753
|
@input-changed=${() => {
|
|
1004
754
|
this.touched = !0;
|
|
1005
755
|
}}
|
|
1006
|
-
${
|
|
756
|
+
${f(this.rangeInputRef)}
|
|
1007
757
|
></pkt-datepicker-range>
|
|
1008
758
|
`;
|
|
1009
759
|
}
|
|
@@ -1027,15 +777,11 @@ var Q, $ = class t extends te {
|
|
|
1027
777
|
.strings=${this.strings}
|
|
1028
778
|
@toggle-calendar=${(e) => this.toggleCalendar(e.detail)}
|
|
1029
779
|
@input-change=${() => this.onInput()}
|
|
1030
|
-
@input-focus=${() => this.onFocus()}
|
|
1031
|
-
@input-blur=${(e) => {
|
|
1032
|
-
this.calRef.value?.contains(e.detail.relatedTarget) || this.onBlur();
|
|
1033
|
-
}}
|
|
1034
780
|
@add-to-selected=${(e) => this.addToSelected(e.detail)}
|
|
1035
781
|
@input-changed=${() => {
|
|
1036
782
|
this.touched = !0;
|
|
1037
783
|
}}
|
|
1038
|
-
${
|
|
784
|
+
${f(this.multipleInputRef)}
|
|
1039
785
|
></pkt-datepicker-multiple>
|
|
1040
786
|
`;
|
|
1041
787
|
}
|
|
@@ -1049,31 +795,32 @@ var Q, $ = class t extends te {
|
|
|
1049
795
|
?weeknumbers=${this.weeknumbers}
|
|
1050
796
|
?withcontrols=${this.withcontrols}
|
|
1051
797
|
.maxMultiple=${this.maxlength}
|
|
1052
|
-
.selected=${this.
|
|
798
|
+
.selected=${this.calendarSelected}
|
|
1053
799
|
.earliest=${this.min}
|
|
1054
800
|
.latest=${this.max}
|
|
1055
801
|
.excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
|
|
1056
802
|
.excludeweekdays=${this.excludeweekdays}
|
|
1057
|
-
.currentmonth=${this.currentmonth ?
|
|
803
|
+
.currentmonth=${this.currentmonth ? v(this.currentmonth) : null}
|
|
1058
804
|
.today=${this.today}
|
|
1059
805
|
@date-selected=${(e) => {
|
|
1060
|
-
this.
|
|
806
|
+
let t = this.range ? N(e.detail, this._value[0] ? null : this.toWithoutFrom, b(this.excludedates), this.excludeweekdays) : e.detail;
|
|
807
|
+
this.toWithoutFrom = null, this.editedRangeFields = null, this.value = G.processDateSelection(t, this.multiple, this.range), this._value = t, G.updateInputValues(this.inputRef, this.inputRefTo, this._value, this.range, this.multiple, (e) => this.manageValidity(e)), this.multiple || this.range && this._value.length !== 2 || this.focusField(), t !== e.detail && this.hideCalendar();
|
|
1061
808
|
}}
|
|
1062
809
|
@close=${() => {
|
|
1063
|
-
this.
|
|
810
|
+
this.focusIsInPopup && this.focusField(), this.hideCalendar();
|
|
1064
811
|
}}
|
|
1065
|
-
${
|
|
812
|
+
${f(this.datepickerPopupRef)}
|
|
1066
813
|
></pkt-datepicker-popup>
|
|
1067
814
|
`;
|
|
1068
815
|
}
|
|
1069
816
|
render() {
|
|
1070
817
|
return this.inputClasses = W.getInputClasses(this.fullwidth, this.showRangeLabels, this.multiple, this.range, this.readonly, this.inputType, this.inputSize), e`
|
|
1071
818
|
<pkt-input-wrapper
|
|
1072
|
-
${
|
|
819
|
+
${c(this, ["helptext"])}
|
|
1073
820
|
.strings=${this.strings}
|
|
1074
821
|
label="${this.label}"
|
|
1075
822
|
forId="${this.id}-input"
|
|
1076
|
-
?counter=${this.
|
|
823
|
+
?counter=${this.hasCounter}
|
|
1077
824
|
.counterCurrent=${this.value ? this._value.length : 0}
|
|
1078
825
|
.counterMaxLength=${this.maxlength}
|
|
1079
826
|
?disabled=${this.isDisabled}
|
|
@@ -1100,8 +847,8 @@ var Q, $ = class t extends te {
|
|
|
1100
847
|
strings=${this.strings}
|
|
1101
848
|
id-base=${this.id}
|
|
1102
849
|
@date-tag-removed=${(e) => {
|
|
1103
|
-
let t =
|
|
1104
|
-
t &&
|
|
850
|
+
let t = x(e.detail);
|
|
851
|
+
t && this.datepickerPopupRef.value?.handleDateSelect(t);
|
|
1105
852
|
}}
|
|
1106
853
|
></pkt-date-tags>` : n}
|
|
1107
854
|
<div class="pkt-datepicker__inputs ${this.range ? "pkt-input__range-inputs" : ""}">
|
|
@@ -1112,12 +859,15 @@ var Q, $ = class t extends te {
|
|
|
1112
859
|
`;
|
|
1113
860
|
}
|
|
1114
861
|
handleCalendarPosition() {
|
|
1115
|
-
|
|
1116
|
-
|
|
862
|
+
L(this.datepickerPopupRef.value?.popupRef.value ?? null, this.currentInputElement ?? null, this.hasCounter);
|
|
863
|
+
}
|
|
864
|
+
async positionOpenCalendar() {
|
|
865
|
+
let e = this.datepickerPopupRef.value;
|
|
866
|
+
await e?.updateComplete, await e?.calendarRef.value?.updateComplete, this.calendarOpen && this.handleCalendarPosition();
|
|
1117
867
|
}
|
|
1118
868
|
async showCalendar() {
|
|
1119
869
|
let e = this.datepickerPopupRef.value;
|
|
1120
|
-
this.calendarOpen = !0, e &&
|
|
870
|
+
this.calendarOpen = !0, e && (e.show(), T() && e.focusOnCurrentDate());
|
|
1121
871
|
}
|
|
1122
872
|
hideCalendar() {
|
|
1123
873
|
let e = this.datepickerPopupRef.value;
|
|
@@ -1150,41 +900,46 @@ Q = $, Q.DERIVED_FROM = [
|
|
|
1150
900
|
"max",
|
|
1151
901
|
"excludedates",
|
|
1152
902
|
"excludeweekdays"
|
|
1153
|
-
],
|
|
903
|
+
], Q.POSITIONED_BY = [
|
|
904
|
+
"calendarOpen",
|
|
905
|
+
"counter",
|
|
906
|
+
"multiple",
|
|
907
|
+
"maxlength"
|
|
908
|
+
], i([o({
|
|
1154
909
|
type: String,
|
|
1155
910
|
reflect: !0
|
|
1156
|
-
})], $.prototype, "value", null), i([r()], $.prototype, "_value", void 0), i([
|
|
911
|
+
})], $.prototype, "value", null), i([r()], $.prototype, "_value", void 0), i([o({
|
|
1157
912
|
type: String,
|
|
1158
913
|
reflect: !0
|
|
1159
|
-
})], $.prototype, "label", void 0), i([
|
|
914
|
+
})], $.prototype, "label", void 0), i([o({ type: String })], $.prototype, "dateformat", void 0), i([o({
|
|
1160
915
|
type: Boolean,
|
|
1161
916
|
reflect: !0
|
|
1162
|
-
})], $.prototype, "multiple", void 0), i([
|
|
917
|
+
})], $.prototype, "multiple", void 0), i([o({
|
|
1163
918
|
type: Number,
|
|
1164
919
|
reflect: !0
|
|
1165
|
-
})], $.prototype, "maxlength", void 0), i([
|
|
920
|
+
})], $.prototype, "maxlength", void 0), i([o({
|
|
1166
921
|
type: Boolean,
|
|
1167
922
|
reflect: !0
|
|
1168
|
-
})], $.prototype, "range", void 0), i([
|
|
923
|
+
})], $.prototype, "range", void 0), i([o({
|
|
1169
924
|
type: Boolean,
|
|
1170
925
|
attribute: "show-range-labels"
|
|
1171
|
-
})], $.prototype, "showRangeLabels", void 0), i([
|
|
926
|
+
})], $.prototype, "showRangeLabels", void 0), i([o({
|
|
1172
927
|
type: String,
|
|
1173
928
|
reflect: !0
|
|
1174
|
-
})], $.prototype, "min", void 0), i([
|
|
929
|
+
})], $.prototype, "min", void 0), i([o({
|
|
1175
930
|
type: String,
|
|
1176
931
|
reflect: !0
|
|
1177
|
-
})], $.prototype, "max", void 0), i([
|
|
932
|
+
})], $.prototype, "max", void 0), i([o({ type: Boolean })], $.prototype, "weeknumbers", void 0), i([o({
|
|
1178
933
|
type: Boolean,
|
|
1179
934
|
reflect: !0
|
|
1180
|
-
})], $.prototype, "withcontrols", void 0), i([
|
|
935
|
+
})], $.prototype, "withcontrols", void 0), i([o({ converter: S.csvToArray })], $.prototype, "excludedates", void 0), i([o({ converter: S.csvToArray })], $.prototype, "excludeweekdays", void 0), i([o({ type: String })], $.prototype, "currentmonth", void 0), i([o({ type: String })], $.prototype, "today", void 0), i([o({
|
|
1181
936
|
type: Boolean,
|
|
1182
937
|
reflect: !0,
|
|
1183
938
|
attribute: "calendar-open"
|
|
1184
|
-
})], $.prototype, "calendarOpen", void 0), i([
|
|
939
|
+
})], $.prototype, "calendarOpen", void 0), i([o({ type: String })], $.prototype, "timezone", void 0), i([r()], $.prototype, "inputClasses", void 0), i([r()], $.prototype, "toWithoutFrom", void 0), i([r()], $.prototype, "editedRangeFields", void 0);
|
|
1185
940
|
try {
|
|
1186
941
|
t("pkt-datepicker")($);
|
|
1187
942
|
} catch {
|
|
1188
943
|
console.warn("Forsøker å definere <pkt-datepicker>, men den er allerede definert");
|
|
1189
944
|
}
|
|
1190
|
-
export {
|
|
945
|
+
export { w as a, Y as i, Z as n, X as r, $ as t };
|