@oslokommune/punkt-elements 13.4.2 → 13.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/calendar-32W9p9uc.cjs +115 -0
- package/dist/{calendar-DevQhOup.js → calendar-CJSxvwAq.js} +353 -340
- package/dist/{datepicker-CYOn3tRm.js → datepicker-BJKJBoy_.js} +102 -59
- package/dist/datepicker-CmTrG5GE.cjs +164 -0
- package/dist/index.d.ts +6 -2
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +3 -3
- package/package.json +3 -3
- package/src/components/calendar/calendar.accessibility.test.ts +111 -0
- package/src/components/calendar/calendar.constraints.test.ts +110 -0
- package/src/components/calendar/calendar.core.test.ts +367 -0
- package/src/components/calendar/calendar.interaction.test.ts +139 -0
- package/src/components/calendar/calendar.selection.test.ts +273 -0
- package/src/components/calendar/calendar.ts +74 -42
- package/src/components/card/card.test.ts +19 -5
- package/src/components/datepicker/datepicker.accessibility.test.ts +193 -0
- package/src/components/datepicker/datepicker.core.test.ts +322 -0
- package/src/components/datepicker/datepicker.input.test.ts +268 -0
- package/src/components/datepicker/datepicker.selection.test.ts +286 -0
- package/src/components/datepicker/datepicker.ts +121 -19
- package/src/components/datepicker/datepicker.validation.test.ts +176 -0
- package/dist/calendar-BZe2D4Sr.cjs +0 -108
- package/dist/datepicker-B9rhz_AF.cjs +0 -154
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { e as f } from "./class-map-BpTj9gtz.js";
|
|
2
2
|
import { o } from "./if-defined-CmuO4Vz9.js";
|
|
3
|
-
import { x as
|
|
4
|
-
import { r as
|
|
5
|
-
import { n as
|
|
6
|
-
import { P as
|
|
7
|
-
import { e as m, n as
|
|
8
|
-
import { c as
|
|
3
|
+
import { x as p, E as g, n as r, a as R } from "./element-CgEWt74-.js";
|
|
4
|
+
import { r as x } from "./state-Bo2bck5_.js";
|
|
5
|
+
import { n as y, f as $, a as C, b, p as _, d as w } from "./calendar-CJSxvwAq.js";
|
|
6
|
+
import { P as S } from "./input-element-NnrDmp4r.js";
|
|
7
|
+
import { e as m, n as d } from "./ref-BBYSqgeW.js";
|
|
8
|
+
import { c as T } from "./repeat-C8BeHwYx.js";
|
|
9
9
|
import "./icon-CC1js8eR.js";
|
|
10
10
|
import "./input-wrapper-Dr__Sxql.js";
|
|
11
11
|
import "./tag-DyXzTY68.js";
|
|
12
|
-
import { P as
|
|
13
|
-
const
|
|
12
|
+
import { P as D } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
13
|
+
const I = {
|
|
14
14
|
dateformat: {
|
|
15
15
|
default: "dd.MM.yyyy"
|
|
16
16
|
},
|
|
@@ -33,25 +33,32 @@ const S = {
|
|
|
33
33
|
default: !1
|
|
34
34
|
}
|
|
35
35
|
}, c = {
|
|
36
|
-
props:
|
|
36
|
+
props: I
|
|
37
37
|
};
|
|
38
|
-
var
|
|
39
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
40
|
-
(
|
|
41
|
-
return a && s &&
|
|
38
|
+
var P = Object.defineProperty, B = Object.getOwnPropertyDescriptor, n = (t, e, i, a) => {
|
|
39
|
+
for (var s = a > 1 ? void 0 : a ? B(e, i) : e, h = t.length - 1, u; h >= 0; h--)
|
|
40
|
+
(u = t[h]) && (s = (a ? u(e, i, s) : u(s)) || s);
|
|
41
|
+
return a && s && P(e, i, s), s;
|
|
42
42
|
};
|
|
43
|
-
const
|
|
44
|
-
let l = class extends
|
|
43
|
+
const k = (t) => new Promise((e) => setTimeout(e, t));
|
|
44
|
+
let l = class extends S {
|
|
45
45
|
/**
|
|
46
46
|
* Housekeeping / lifecycle methods
|
|
47
47
|
*/
|
|
48
48
|
constructor() {
|
|
49
|
-
super(), this.
|
|
49
|
+
super(), this._valueProperty = "", this._value = [], this.label = "Datovelger", this.dateformat = c.props.dateformat.default, this.multiple = c.props.multiple.default, this.maxlength = null, this.range = c.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = c.props.weeknumbers.default, this.withcontrols = c.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.buttonClasses = {}, this.inputRef = m(), this.inputRefTo = m(), this.btnRef = m(), this.calRef = m(), this.popupRef = m(), this.helptextSlot = m(), this.addToSelected = (t) => {
|
|
50
50
|
const e = t.target;
|
|
51
51
|
if (!e.value) return;
|
|
52
|
-
const i = this.min ?
|
|
52
|
+
const i = this.min ? y(this.min) : null, a = this.max ? y(this.max) : null, s = y(e.value.split(",")[0]);
|
|
53
53
|
s && !isNaN(s.getTime()) && (!i || s >= i) && (!a || s <= a) && this.calRef.value && this.calRef.value.handleDateSelect(s), e.value = "";
|
|
54
|
-
}, this.slotController = new
|
|
54
|
+
}, this.slotController = new D(this, this.helptextSlot);
|
|
55
|
+
}
|
|
56
|
+
get value() {
|
|
57
|
+
return this._valueProperty;
|
|
58
|
+
}
|
|
59
|
+
set value(t) {
|
|
60
|
+
const e = this._valueProperty;
|
|
61
|
+
this._valueProperty = Array.isArray(t) ? t.join(",") : t || "", this.valueChanged(this._valueProperty, e), this.requestUpdate("value", e);
|
|
55
62
|
}
|
|
56
63
|
async connectedCallback() {
|
|
57
64
|
super.connectedCallback();
|
|
@@ -59,7 +66,9 @@ let l = class extends C {
|
|
|
59
66
|
this.inputType = e ? "text" : "date", document && document.body.addEventListener("click", (i) => {
|
|
60
67
|
var a, s;
|
|
61
68
|
(a = this.inputRef) != null && a.value && ((s = this.btnRef) != null && s.value) && !this.inputRef.value.contains(i.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(i.target)) && !this.btnRef.value.contains(i.target) && !i.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
|
|
62
|
-
}),
|
|
69
|
+
}), document && document.body.addEventListener("keydown", (i) => {
|
|
70
|
+
i.key === "Escape" && this.calendarOpen && this.hideCalendar();
|
|
71
|
+
}), this.value && (this._value = Array.isArray(this.value) ? this.value.filter(Boolean) : this.value.split(",").filter(Boolean)), this.min = this.min || c.props.min.default, this.max = this.max || c.props.max.default, typeof this.excludedates == "string" && (this.excludedates = this.excludedates.split(",")), typeof this.excludeweekdays == "string" && (this.excludeweekdays = this.excludeweekdays.split(",")), (this.multiple || this.range) && this.name && !this.name.endsWith("[]") && (this.name = this.name + "[]"), this.calendarOpen && (await k(20), this.handleCalendarPosition());
|
|
63
72
|
}
|
|
64
73
|
disconnectedCallback() {
|
|
65
74
|
super.disconnectedCallback(), document && document.body.removeEventListener("click", (t) => {
|
|
@@ -67,21 +76,39 @@ let l = class extends C {
|
|
|
67
76
|
(e = this.inputRef) != null && e.value && ((i = this.btnRef) != null && i.value) && !this.inputRef.value.contains(t.target) && !this.btnRef.value.contains(t.target) && this.hideCalendar();
|
|
68
77
|
});
|
|
69
78
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
onInput() {
|
|
80
|
+
this.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
81
|
+
}
|
|
82
|
+
valueChanged(t, e) {
|
|
83
|
+
if (t !== e) {
|
|
84
|
+
let i = [];
|
|
85
|
+
if (t && (typeof t == "string" ? i = t.split(",").filter(Boolean) : i = String(t).split(",").filter(Boolean)), this.min || this.max) {
|
|
86
|
+
const s = this.min ? new Date(this.min) : null, h = this.max ? new Date(this.max) : null;
|
|
87
|
+
i = i.filter((u) => {
|
|
88
|
+
const v = new Date(u);
|
|
89
|
+
return !(isNaN(v.getTime()) || s && v < s || h && v > h);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
this._value = i;
|
|
93
|
+
const a = i.join(",");
|
|
94
|
+
this._valueProperty !== a && (this._valueProperty = a), super.valueChanged(a, e);
|
|
74
95
|
}
|
|
75
|
-
|
|
96
|
+
}
|
|
97
|
+
attributeChangedCallback(t, e, i) {
|
|
98
|
+
t === "value" && this.value !== e && this.valueChanged(i, e), t === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = (i == null ? void 0 : i.split(",")) ?? []), t === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = (i == null ? void 0 : i.split(",")) ?? []), super.attributeChangedCallback(t, e, i);
|
|
76
99
|
}
|
|
77
100
|
updated(t) {
|
|
78
|
-
t.has("
|
|
101
|
+
if (t.has("value")) {
|
|
102
|
+
const e = Array.isArray(this.value) ? this.value.join(",") : this.value, i = t.get("value"), a = Array.isArray(i) ? i.join(",") : i;
|
|
103
|
+
this.valueChanged(e, a);
|
|
104
|
+
}
|
|
105
|
+
t.has("multiple") && (this.multiple && !Array.isArray(this._value) ? this._value = typeof this.value == "string" ? this.value ? this.value.split(",").filter(Boolean) : [] : [] : !this.multiple && Array.isArray(this._value) && (this._value = this._value.filter(Boolean)), !this.multiple && !this.range && Array.isArray(this._value) && (this._value = [this._value[0] ?? ""])), super.updated(t);
|
|
79
106
|
}
|
|
80
107
|
/**
|
|
81
108
|
* Rendering
|
|
82
109
|
*/
|
|
83
110
|
renderInput() {
|
|
84
|
-
return
|
|
111
|
+
return p`
|
|
85
112
|
<input
|
|
86
113
|
class="${f(this.inputClasses)}"
|
|
87
114
|
.type=${this.inputType}
|
|
@@ -89,6 +116,9 @@ let l = class extends C {
|
|
|
89
116
|
.value=${this._value[0] ?? ""}
|
|
90
117
|
min=${o(this.min)}
|
|
91
118
|
max=${o(this.max)}
|
|
119
|
+
placeholder=${o(this.placeholder)}
|
|
120
|
+
?readonly=${this.readonly}
|
|
121
|
+
aria-describedby="${this.id}-helptext"
|
|
92
122
|
@click=${(t) => {
|
|
93
123
|
t.preventDefault(), this.showCalendar();
|
|
94
124
|
}}
|
|
@@ -113,7 +143,7 @@ let l = class extends C {
|
|
|
113
143
|
@change=${(t) => {
|
|
114
144
|
this.touched = !0, t.stopImmediatePropagation();
|
|
115
145
|
}}
|
|
116
|
-
${
|
|
146
|
+
${d(this.inputRef)}
|
|
117
147
|
/>
|
|
118
148
|
`;
|
|
119
149
|
}
|
|
@@ -122,8 +152,8 @@ let l = class extends C {
|
|
|
122
152
|
"pkt-input-prefix": this.showRangeLabels,
|
|
123
153
|
"pkt-hide": !this.showRangeLabels
|
|
124
154
|
};
|
|
125
|
-
return
|
|
126
|
-
${this.showRangeLabels ?
|
|
155
|
+
return p`
|
|
156
|
+
${this.showRangeLabels ? p` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : g}
|
|
127
157
|
<input
|
|
128
158
|
class=${f(this.inputClasses)}
|
|
129
159
|
.type=${this.inputType}
|
|
@@ -131,6 +161,8 @@ let l = class extends C {
|
|
|
131
161
|
.value=${this._value[0] ?? ""}
|
|
132
162
|
min=${o(this.min)}
|
|
133
163
|
max=${o(this.max)}
|
|
164
|
+
placeholder=${o(this.placeholder)}
|
|
165
|
+
?readonly=${this.readonly}
|
|
134
166
|
?disabled=${this.disabled}
|
|
135
167
|
@click=${(e) => {
|
|
136
168
|
e.preventDefault(), this.showCalendar();
|
|
@@ -159,12 +191,12 @@ let l = class extends C {
|
|
|
159
191
|
@change=${(e) => {
|
|
160
192
|
e.stopImmediatePropagation();
|
|
161
193
|
}}
|
|
162
|
-
${
|
|
194
|
+
${d(this.inputRef)}
|
|
163
195
|
/>
|
|
164
196
|
<div class="${f(t)}" id="${this.id}-to-label">
|
|
165
197
|
${this.strings.generic.to}
|
|
166
198
|
</div>
|
|
167
|
-
${this.showRangeLabels ? g :
|
|
199
|
+
${this.showRangeLabels ? g : p` <div class="pkt-input-separator">–</div> `}
|
|
168
200
|
<input
|
|
169
201
|
class=${f(this.inputClasses)}
|
|
170
202
|
.type=${this.inputType}
|
|
@@ -173,6 +205,8 @@ let l = class extends C {
|
|
|
173
205
|
.value=${this._value[1] ?? ""}
|
|
174
206
|
min=${o(this.min)}
|
|
175
207
|
max=${o(this.max)}
|
|
208
|
+
placeholder=${o(this.placeholder)}
|
|
209
|
+
?readonly=${this.readonly}
|
|
176
210
|
?disabled=${this.disabled}
|
|
177
211
|
@click=${(e) => {
|
|
178
212
|
e.preventDefault(), this.showCalendar();
|
|
@@ -204,25 +238,27 @@ let l = class extends C {
|
|
|
204
238
|
this.strings.forms.messages.rangeOverflow,
|
|
205
239
|
e.target
|
|
206
240
|
);
|
|
207
|
-
const
|
|
208
|
-
|
|
241
|
+
const u = $(e.target.value);
|
|
242
|
+
u && this._value[1] !== C(u) && ((s = (a = this.calRef) == null ? void 0 : a.value) == null || s.handleDateSelect(u));
|
|
209
243
|
}
|
|
210
244
|
}}
|
|
211
245
|
@change=${(e) => {
|
|
212
246
|
this.touched = !0, e.stopImmediatePropagation();
|
|
213
247
|
}}
|
|
214
|
-
${
|
|
248
|
+
${d(this.inputRefTo)}
|
|
215
249
|
/>
|
|
216
250
|
`;
|
|
217
251
|
}
|
|
218
252
|
renderMultipleInput() {
|
|
219
|
-
return
|
|
253
|
+
return p`
|
|
220
254
|
<input
|
|
221
255
|
class=${f(this.inputClasses)}
|
|
222
256
|
.type=${this.inputType}
|
|
223
257
|
id="${this.id}-input"
|
|
224
258
|
min=${o(this.min)}
|
|
225
259
|
max=${o(this.max)}
|
|
260
|
+
placeholder=${o(this.placeholder)}
|
|
261
|
+
?readonly=${this.readonly}
|
|
226
262
|
?disabled=${this.disabled || this.maxlength && this._value.length >= this.maxlength}
|
|
227
263
|
@click=${(t) => {
|
|
228
264
|
t.preventDefault(), this.showCalendar();
|
|
@@ -247,21 +283,21 @@ let l = class extends C {
|
|
|
247
283
|
@change=${(t) => {
|
|
248
284
|
this.touched = !0, t.stopImmediatePropagation();
|
|
249
285
|
}}
|
|
250
|
-
${
|
|
286
|
+
${d(this.inputRef)}
|
|
251
287
|
/>
|
|
252
288
|
`;
|
|
253
289
|
}
|
|
254
290
|
renderTags() {
|
|
255
|
-
return
|
|
291
|
+
return p`
|
|
256
292
|
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
257
|
-
${this._value[0] ?
|
|
258
|
-
(this._value ?? []).filter(Boolean),
|
|
293
|
+
${this._value[0] ? T(
|
|
294
|
+
(this._value ?? []).filter(Boolean).sort(),
|
|
259
295
|
(t) => t,
|
|
260
|
-
(t) =>
|
|
296
|
+
(t) => p`
|
|
261
297
|
<pkt-tag
|
|
262
298
|
.id="${this.id + t + "-tag"}"
|
|
263
299
|
closeTag
|
|
264
|
-
ariaLabel="${this.strings.calendar.deleteDate} ${
|
|
300
|
+
ariaLabel="${this.strings.calendar.deleteDate} ${b(
|
|
265
301
|
t,
|
|
266
302
|
this.dateformat
|
|
267
303
|
)}"
|
|
@@ -269,7 +305,7 @@ let l = class extends C {
|
|
|
269
305
|
var e;
|
|
270
306
|
return (e = this.calRef.value) == null ? void 0 : e.handleDateSelect($(t));
|
|
271
307
|
}}
|
|
272
|
-
><time datetime="${t}">${
|
|
308
|
+
><time datetime="${t}">${b(t, this.dateformat)}</time></pkt-tag
|
|
273
309
|
>
|
|
274
310
|
`
|
|
275
311
|
) : g}
|
|
@@ -277,13 +313,13 @@ let l = class extends C {
|
|
|
277
313
|
`;
|
|
278
314
|
}
|
|
279
315
|
renderCalendar() {
|
|
280
|
-
return
|
|
316
|
+
return p`<div
|
|
281
317
|
class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
|
|
282
318
|
@focusout=${(t) => {
|
|
283
319
|
this.calendarOpen && this.handleFocusOut(t);
|
|
284
320
|
}}
|
|
285
321
|
id="${this.id}-popup"
|
|
286
|
-
${
|
|
322
|
+
${d(this.popupRef)}
|
|
287
323
|
>
|
|
288
324
|
<pkt-calendar
|
|
289
325
|
id="${this.id}-calendar"
|
|
@@ -297,19 +333,19 @@ let l = class extends C {
|
|
|
297
333
|
.latest=${this.max}
|
|
298
334
|
.excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
|
|
299
335
|
.excludeweekdays=${this.excludeweekdays}
|
|
300
|
-
.currentmonth=${this.currentmonth ?
|
|
336
|
+
.currentmonth=${this.currentmonth ? _(this.currentmonth) : null}
|
|
301
337
|
@date-selected=${(t) => {
|
|
302
|
-
this.value = !this.multiple && !this.range ? t.detail[0] : t.detail, this._value = t.detail, this.inputRef.value && (this.range && this.inputRefTo.value ? (this.inputRef.value.value = this._value[0] ?? "", this.inputRefTo.value.value = this._value[1] ?? "") : this.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : ""));
|
|
338
|
+
this.value = !this.multiple && !this.range ? t.detail[0] : Array.isArray(t.detail) ? t.detail.join(",") : t.detail, this._value = t.detail, this.inputRef.value && (this.range && this.inputRefTo.value ? (this.inputRef.value.value = this._value[0] ?? "", this.inputRefTo.value.value = this._value[1] ?? "", this.manageValidity(this.inputRef.value), this.manageValidity(this.inputRefTo.value)) : this.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : "", this.manageValidity(this.inputRef.value)));
|
|
303
339
|
}}
|
|
304
340
|
@close=${() => {
|
|
305
341
|
this.onBlur(), this.hideCalendar();
|
|
306
342
|
}}
|
|
307
|
-
${
|
|
343
|
+
${d(this.calRef)}
|
|
308
344
|
></pkt-calendar>
|
|
309
345
|
</div>`;
|
|
310
346
|
}
|
|
311
347
|
render() {
|
|
312
|
-
return
|
|
348
|
+
return this.inputClasses = {
|
|
313
349
|
"pkt-input": !0,
|
|
314
350
|
"pkt-datepicker__input": !0,
|
|
315
351
|
"pkt-input--fullwidth": this.fullwidth,
|
|
@@ -320,8 +356,9 @@ let l = class extends C {
|
|
|
320
356
|
"pkt-input-icon": !0,
|
|
321
357
|
"pkt-btn": !0,
|
|
322
358
|
"pkt-btn--icon-only": !0,
|
|
323
|
-
"pkt-btn--tertiary": !0
|
|
324
|
-
|
|
359
|
+
"pkt-btn--tertiary": !0,
|
|
360
|
+
"pkt-datepicker__calendar-button": !0
|
|
361
|
+
}, p`
|
|
325
362
|
<pkt-input-wrapper
|
|
326
363
|
label="${this.label}"
|
|
327
364
|
forId="${this.id}-input"
|
|
@@ -346,7 +383,7 @@ let l = class extends C {
|
|
|
346
383
|
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
347
384
|
class="pkt-datepicker"
|
|
348
385
|
>
|
|
349
|
-
<div class="pkt-contents" ${
|
|
386
|
+
<div class="pkt-contents" ${d(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
350
387
|
${this.multiple ? this.renderTags() : g}
|
|
351
388
|
<div
|
|
352
389
|
class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
|
|
@@ -357,8 +394,11 @@ let l = class extends C {
|
|
|
357
394
|
class="${f(this.buttonClasses)}"
|
|
358
395
|
type="button"
|
|
359
396
|
@click=${this.toggleCalendar}
|
|
397
|
+
@keydown=${(t) => {
|
|
398
|
+
(t.key === "Enter" || t.key === " " || t.key === "Space") && (t.preventDefault(), this.toggleCalendar(t));
|
|
399
|
+
}}
|
|
360
400
|
?disabled=${this.disabled}
|
|
361
|
-
${
|
|
401
|
+
${d(this.btnRef)}
|
|
362
402
|
>
|
|
363
403
|
<pkt-icon name="calendar"></pkt-icon>
|
|
364
404
|
<span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
|
|
@@ -385,7 +425,7 @@ let l = class extends C {
|
|
|
385
425
|
}
|
|
386
426
|
async showCalendar() {
|
|
387
427
|
var t;
|
|
388
|
-
this.calendarOpen = !0, await
|
|
428
|
+
this.calendarOpen = !0, await k(20), this.handleCalendarPosition(), this.isMobileSafari && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
|
|
389
429
|
}
|
|
390
430
|
hideCalendar() {
|
|
391
431
|
this.calendarOpen = !1;
|
|
@@ -393,10 +433,13 @@ let l = class extends C {
|
|
|
393
433
|
async toggleCalendar(t) {
|
|
394
434
|
t.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
|
|
395
435
|
}
|
|
436
|
+
clearInputValue() {
|
|
437
|
+
this._value = [], this.value = "";
|
|
438
|
+
}
|
|
396
439
|
};
|
|
397
440
|
n([
|
|
398
441
|
r({ type: String, reflect: !0 })
|
|
399
|
-
], l.prototype, "value",
|
|
442
|
+
], l.prototype, "value", 1);
|
|
400
443
|
n([
|
|
401
444
|
r({ type: Array })
|
|
402
445
|
], l.prototype, "_value", 2);
|
|
@@ -431,10 +474,10 @@ n([
|
|
|
431
474
|
r({ type: Boolean, reflect: !0 })
|
|
432
475
|
], l.prototype, "withcontrols", 2);
|
|
433
476
|
n([
|
|
434
|
-
r({ converter:
|
|
477
|
+
r({ converter: w.csvToArray })
|
|
435
478
|
], l.prototype, "excludedates", 2);
|
|
436
479
|
n([
|
|
437
|
-
r({ converter:
|
|
480
|
+
r({ converter: w.csvToArray })
|
|
438
481
|
], l.prototype, "excludeweekdays", 2);
|
|
439
482
|
n([
|
|
440
483
|
r({ type: String })
|
|
@@ -446,13 +489,13 @@ n([
|
|
|
446
489
|
r({ type: String })
|
|
447
490
|
], l.prototype, "timezone", 2);
|
|
448
491
|
n([
|
|
449
|
-
|
|
492
|
+
x()
|
|
450
493
|
], l.prototype, "inputClasses", 2);
|
|
451
494
|
n([
|
|
452
|
-
|
|
495
|
+
x()
|
|
453
496
|
], l.prototype, "buttonClasses", 2);
|
|
454
497
|
l = n([
|
|
455
|
-
|
|
498
|
+
R("pkt-datepicker")
|
|
456
499
|
], l);
|
|
457
500
|
export {
|
|
458
501
|
l as P
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";const d=require("./class-map-BBG2gMX4.cjs"),u=require("./if-defined-Cni-RHLS.cjs"),l=require("./element-6DBpyGQm.cjs"),v=require("./state-DPobt-Yz.cjs"),o=require("./calendar-32W9p9uc.cjs"),y=require("./input-element-C4xJoM-X.cjs"),r=require("./ref-iJtiv3o2.cjs"),k=require("./repeat-CDsZqct8.cjs");require("./icon-B_ryAy4Q.cjs");require("./input-wrapper-CZ-a00V7.cjs");require("./tag-Bbs0U_Au.cjs");const $=require("./pkt-slot-controller-BzddBp7z.cjs"),b={dateformat:{default:"dd.MM.yyyy"},min:{default:null},max:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},p={props:b};var x=Object.defineProperty,w=Object.getOwnPropertyDescriptor,n=(c,t,e,i)=>{for(var a=i>1?void 0:i?w(t,e):t,s=c.length-1,h;s>=0;s--)(h=c[s])&&(a=(i?h(t,e,a):h(a))||a);return i&&a&&x(t,e,a),a};const m=c=>new Promise(t=>setTimeout(t,c));exports.PktDatepicker=class extends y.PktInputElement{constructor(){super(),this._valueProperty="",this._value=[],this.label="Datovelger",this.dateformat=p.props.dateformat.default,this.multiple=p.props.multiple.default,this.maxlength=null,this.range=p.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=p.props.weeknumbers.default,this.withcontrols=p.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.buttonClasses={},this.inputRef=r.e(),this.inputRefTo=r.e(),this.btnRef=r.e(),this.calRef=r.e(),this.popupRef=r.e(),this.helptextSlot=r.e(),this.addToSelected=t=>{const e=t.target;if(!e.value)return;const i=this.min?o.newDate(this.min):null,a=this.max?o.newDate(this.max):null,s=o.newDate(e.value.split(",")[0]);s&&!isNaN(s.getTime())&&(!i||s>=i)&&(!a||s<=a)&&this.calRef.value&&this.calRef.value.handleDateSelect(s),e.value=""},this.slotController=new $.PktSlotController(this,this.helptextSlot)}get value(){return this._valueProperty}set value(t){const e=this._valueProperty;this._valueProperty=Array.isArray(t)?t.join(","):t||"",this.valueChanged(this._valueProperty,e),this.requestUpdate("value",e)}async connectedCallback(){super.connectedCallback();const t=navigator.userAgent,e=/iP(hone|od|ad)/.test(t);this.inputType=e?"text":"date",document&&document.body.addEventListener("click",i=>{var a,s;(a=this.inputRef)!=null&&a.value&&((s=this.btnRef)!=null&&s.value)&&!this.inputRef.value.contains(i.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(i.target))&&!this.btnRef.value.contains(i.target)&&!i.target.closest(".pkt-calendar-popup")&&this.calendarOpen&&(this.onBlur(),this.hideCalendar())}),document&&document.body.addEventListener("keydown",i=>{i.key==="Escape"&&this.calendarOpen&&this.hideCalendar()}),this.value&&(this._value=Array.isArray(this.value)?this.value.filter(Boolean):this.value.split(",").filter(Boolean)),this.min=this.min||p.props.min.default,this.max=this.max||p.props.max.default,typeof this.excludedates=="string"&&(this.excludedates=this.excludedates.split(",")),typeof this.excludeweekdays=="string"&&(this.excludeweekdays=this.excludeweekdays.split(",")),(this.multiple||this.range)&&this.name&&!this.name.endsWith("[]")&&(this.name=this.name+"[]"),this.calendarOpen&&(await m(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",t=>{var e,i;(e=this.inputRef)!=null&&e.value&&((i=this.btnRef)!=null&&i.value)&&!this.inputRef.value.contains(t.target)&&!this.btnRef.value.contains(t.target)&&this.hideCalendar()})}onInput(){this.dispatchEvent(new Event("input",{bubbles:!0}))}valueChanged(t,e){if(t!==e){let i=[];if(t&&(typeof t=="string"?i=t.split(",").filter(Boolean):i=String(t).split(",").filter(Boolean)),this.min||this.max){const s=this.min?new Date(this.min):null,h=this.max?new Date(this.max):null;i=i.filter(f=>{const g=new Date(f);return!(isNaN(g.getTime())||s&&g<s||h&&g>h)})}this._value=i;const a=i.join(",");this._valueProperty!==a&&(this._valueProperty=a),super.valueChanged(a,e)}}attributeChangedCallback(t,e,i){t==="value"&&this.value!==e&&this.valueChanged(i,e),t==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(i==null?void 0:i.split(","))??[]),t==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(i==null?void 0:i.split(","))??[]),super.attributeChangedCallback(t,e,i)}updated(t){if(t.has("value")){const e=Array.isArray(this.value)?this.value.join(","):this.value,i=t.get("value"),a=Array.isArray(i)?i.join(","):i;this.valueChanged(e,a)}t.has("multiple")&&(this.multiple&&!Array.isArray(this._value)?this._value=typeof this.value=="string"?this.value?this.value.split(",").filter(Boolean):[]:[]:!this.multiple&&Array.isArray(this._value)&&(this._value=this._value.filter(Boolean)),!this.multiple&&!this.range&&Array.isArray(this._value)&&(this._value=[this._value[0]??""])),super.updated(t)}renderInput(){return l.x`
|
|
2
|
+
<input
|
|
3
|
+
class="${d.e(this.inputClasses)}"
|
|
4
|
+
.type=${this.inputType}
|
|
5
|
+
id="${this.id}-input"
|
|
6
|
+
.value=${this._value[0]??""}
|
|
7
|
+
min=${u.o(this.min)}
|
|
8
|
+
max=${u.o(this.max)}
|
|
9
|
+
placeholder=${u.o(this.placeholder)}
|
|
10
|
+
?readonly=${this.readonly}
|
|
11
|
+
aria-describedby="${this.id}-helptext"
|
|
12
|
+
@click=${t=>{t.preventDefault(),this.showCalendar()}}
|
|
13
|
+
?disabled=${this.disabled}
|
|
14
|
+
@keydown=${t=>{var e,i;if(t.key===","&&((e=this.inputRef.value)==null||e.blur()),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t)),t.key==="Enter"){const a=this.internals.form;a?a.requestSubmit():(i=this.inputRef.value)==null||i.blur()}}}
|
|
15
|
+
@input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
|
|
16
|
+
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
17
|
+
@blur=${t=>{var e;(e=this.calRef.value)!=null&&e.contains(t.relatedTarget)||this.onBlur(),this.manageValidity(t.target),this.value=t.target.value}}
|
|
18
|
+
@change=${t=>{this.touched=!0,t.stopImmediatePropagation()}}
|
|
19
|
+
${r.n(this.inputRef)}
|
|
20
|
+
/>
|
|
21
|
+
`}renderRangeInput(){const t={"pkt-input-prefix":this.showRangeLabels,"pkt-hide":!this.showRangeLabels};return l.x`
|
|
22
|
+
${this.showRangeLabels?l.x` <div class="pkt-input-prefix">${this.strings.generic.from}</div> `:l.E}
|
|
23
|
+
<input
|
|
24
|
+
class=${d.e(this.inputClasses)}
|
|
25
|
+
.type=${this.inputType}
|
|
26
|
+
id="${this.id}-input"
|
|
27
|
+
.value=${this._value[0]??""}
|
|
28
|
+
min=${u.o(this.min)}
|
|
29
|
+
max=${u.o(this.max)}
|
|
30
|
+
placeholder=${u.o(this.placeholder)}
|
|
31
|
+
?readonly=${this.readonly}
|
|
32
|
+
?disabled=${this.disabled}
|
|
33
|
+
@click=${e=>{e.preventDefault(),this.showCalendar()}}
|
|
34
|
+
@keydown=${e=>{var i,a;if(e.key===","&&((i=this.inputRef.value)==null||i.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e)),e.key==="Enter"){const s=this.internals.form;s?s.requestSubmit():(a=this.inputRefTo.value)==null||a.focus()}}}
|
|
35
|
+
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
36
|
+
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
37
|
+
@blur=${e=>{var i,a;if(e.target.value){this.manageValidity(e.target);const s=o.fromISOToDate(e.target.value);s&&this._value[0]!==e.target.value&&this._value[1]&&(this.clearInputValue(),(a=(i=this.calRef)==null?void 0:i.value)==null||a.handleDateSelect(s))}else this._value[0]&&this.clearInputValue()}}
|
|
38
|
+
@change=${e=>{e.stopImmediatePropagation()}}
|
|
39
|
+
${r.n(this.inputRef)}
|
|
40
|
+
/>
|
|
41
|
+
<div class="${d.e(t)}" id="${this.id}-to-label">
|
|
42
|
+
${this.strings.generic.to}
|
|
43
|
+
</div>
|
|
44
|
+
${this.showRangeLabels?l.E:l.x` <div class="pkt-input-separator">–</div> `}
|
|
45
|
+
<input
|
|
46
|
+
class=${d.e(this.inputClasses)}
|
|
47
|
+
.type=${this.inputType}
|
|
48
|
+
id="${this.id}-to"
|
|
49
|
+
aria-labelledby="${this.id}-to-label"
|
|
50
|
+
.value=${this._value[1]??""}
|
|
51
|
+
min=${u.o(this.min)}
|
|
52
|
+
max=${u.o(this.max)}
|
|
53
|
+
placeholder=${u.o(this.placeholder)}
|
|
54
|
+
?readonly=${this.readonly}
|
|
55
|
+
?disabled=${this.disabled}
|
|
56
|
+
@click=${e=>{e.preventDefault(),this.showCalendar()}}
|
|
57
|
+
@keydown=${e=>{var i,a;if(e.key===","&&((i=this.inputRefTo.value)==null||i.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e)),e.key==="Enter"){const s=this.internals.form;s?s.requestSubmit():(a=this.inputRefTo.value)==null||a.blur()}}}
|
|
58
|
+
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
59
|
+
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
60
|
+
@blur=${e=>{var i,a,s;if((i=this.calRef.value)!=null&&i.contains(e.relatedTarget)||this.onBlur(),e.target.value){this.manageValidity(e.target);const h=e.target.value;this.min&&this.min>h?this.internals.setValidity({rangeUnderflow:!0},this.strings.forms.messages.rangeUnderflow,e.target):this.max&&this.max<h&&this.internals.setValidity({rangeOverflow:!0},this.strings.forms.messages.rangeOverflow,e.target);const f=o.fromISOToDate(e.target.value);f&&this._value[1]!==o.formatISODate(f)&&((s=(a=this.calRef)==null?void 0:a.value)==null||s.handleDateSelect(f))}}}
|
|
61
|
+
@change=${e=>{this.touched=!0,e.stopImmediatePropagation()}}
|
|
62
|
+
${r.n(this.inputRefTo)}
|
|
63
|
+
/>
|
|
64
|
+
`}renderMultipleInput(){return l.x`
|
|
65
|
+
<input
|
|
66
|
+
class=${d.e(this.inputClasses)}
|
|
67
|
+
.type=${this.inputType}
|
|
68
|
+
id="${this.id}-input"
|
|
69
|
+
min=${u.o(this.min)}
|
|
70
|
+
max=${u.o(this.max)}
|
|
71
|
+
placeholder=${u.o(this.placeholder)}
|
|
72
|
+
?readonly=${this.readonly}
|
|
73
|
+
?disabled=${this.disabled||this.maxlength&&this._value.length>=this.maxlength}
|
|
74
|
+
@click=${t=>{t.preventDefault(),this.showCalendar()}}
|
|
75
|
+
@blur=${t=>{var e;(e=this.calRef.value)!=null&&e.contains(t.relatedTarget)||this.onBlur(),this.addToSelected(t)}}
|
|
76
|
+
@input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
|
|
77
|
+
@focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
|
|
78
|
+
@keydown=${t=>{var e;if(t.key===","&&(t.preventDefault(),this.addToSelected(t)),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t)),t.key==="Enter"){const i=this.internals.form;i?i.requestSubmit():(e=this.inputRef.value)==null||e.blur()}}}
|
|
79
|
+
@change=${t=>{this.touched=!0,t.stopImmediatePropagation()}}
|
|
80
|
+
${r.n(this.inputRef)}
|
|
81
|
+
/>
|
|
82
|
+
`}renderTags(){return l.x`
|
|
83
|
+
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
84
|
+
${this._value[0]?k.c((this._value??[]).filter(Boolean).sort(),t=>t,t=>l.x`
|
|
85
|
+
<pkt-tag
|
|
86
|
+
.id="${this.id+t+"-tag"}"
|
|
87
|
+
closeTag
|
|
88
|
+
ariaLabel="${this.strings.calendar.deleteDate} ${o.fromISOtoLocal(t,this.dateformat)}"
|
|
89
|
+
@close=${()=>{var e;return(e=this.calRef.value)==null?void 0:e.handleDateSelect(o.fromISOToDate(t))}}
|
|
90
|
+
><time datetime="${t}">${o.fromISOtoLocal(t,this.dateformat)}</time></pkt-tag
|
|
91
|
+
>
|
|
92
|
+
`):l.E}
|
|
93
|
+
</div>
|
|
94
|
+
`}renderCalendar(){return l.x`<div
|
|
95
|
+
class="pkt-calendar-popup pkt-${this.calendarOpen?"show":"hide"}"
|
|
96
|
+
@focusout=${t=>{this.calendarOpen&&this.handleFocusOut(t)}}
|
|
97
|
+
id="${this.id}-popup"
|
|
98
|
+
${r.n(this.popupRef)}
|
|
99
|
+
>
|
|
100
|
+
<pkt-calendar
|
|
101
|
+
id="${this.id}-calendar"
|
|
102
|
+
?multiple=${this.multiple}
|
|
103
|
+
?range=${this.range}
|
|
104
|
+
?weeknumbers=${this.weeknumbers}
|
|
105
|
+
?withcontrols=${this.withcontrols}
|
|
106
|
+
.maxMultiple=${this.maxlength}
|
|
107
|
+
.selected=${this._value}
|
|
108
|
+
.earliest=${this.min}
|
|
109
|
+
.latest=${this.max}
|
|
110
|
+
.excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(",")}
|
|
111
|
+
.excludeweekdays=${this.excludeweekdays}
|
|
112
|
+
.currentmonth=${this.currentmonth?o.parseISODateString(this.currentmonth):null}
|
|
113
|
+
@date-selected=${t=>{this.value=!this.multiple&&!this.range?t.detail[0]:Array.isArray(t.detail)?t.detail.join(","):t.detail,this._value=t.detail,this.inputRef.value&&(this.range&&this.inputRefTo.value?(this.inputRef.value.value=this._value[0]??"",this.inputRefTo.value.value=this._value[1]??"",this.manageValidity(this.inputRef.value),this.manageValidity(this.inputRefTo.value)):this.multiple||(this.inputRef.value.value=this._value.length?this._value[0]:"",this.manageValidity(this.inputRef.value)))}}
|
|
114
|
+
@close=${()=>{this.onBlur(),this.hideCalendar()}}
|
|
115
|
+
${r.n(this.calRef)}
|
|
116
|
+
></pkt-calendar>
|
|
117
|
+
</div>`}render(){return this.inputClasses={"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-datepicker--hasrangelabels":this.showRangeLabels,"pkt-datepicker--multiple":this.multiple,"pkt-datepicker--range":this.range},this.buttonClasses={"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0},l.x`
|
|
118
|
+
<pkt-input-wrapper
|
|
119
|
+
label="${this.label}"
|
|
120
|
+
forId="${this.id}-input"
|
|
121
|
+
?counter=${this.multiple&&!!this.maxlength}
|
|
122
|
+
.counterCurrent=${this.value?this._value.length:0}
|
|
123
|
+
.counterMaxLength=${this.maxlength}
|
|
124
|
+
?disabled=${this.disabled}
|
|
125
|
+
?hasError=${this.hasError}
|
|
126
|
+
?hasFieldset=${this.hasFieldset}
|
|
127
|
+
?inline=${this.inline}
|
|
128
|
+
?required=${this.required}
|
|
129
|
+
?optionalTag=${this.optionalTag}
|
|
130
|
+
?requiredTag=${this.requiredTag}
|
|
131
|
+
?useWrapper=${this.useWrapper}
|
|
132
|
+
.optionalText=${this.optionalText}
|
|
133
|
+
.requiredText=${this.requiredText}
|
|
134
|
+
.tagText=${this.tagText}
|
|
135
|
+
.errorMessage=${this.errorMessage}
|
|
136
|
+
.helptext=${this.helptext}
|
|
137
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
138
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
139
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
140
|
+
class="pkt-datepicker"
|
|
141
|
+
>
|
|
142
|
+
<div class="pkt-contents" ${r.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
143
|
+
${this.multiple?this.renderTags():l.E}
|
|
144
|
+
<div
|
|
145
|
+
class="pkt-datepicker__inputs ${this.range&&this.showRangeLabels?"pkt-input__range-inputs":""}"
|
|
146
|
+
>
|
|
147
|
+
<div class="pkt-input__container">
|
|
148
|
+
${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
|
|
149
|
+
<button
|
|
150
|
+
class="${d.e(this.buttonClasses)}"
|
|
151
|
+
type="button"
|
|
152
|
+
@click=${this.toggleCalendar}
|
|
153
|
+
@keydown=${t=>{(t.key==="Enter"||t.key===" "||t.key==="Space")&&(t.preventDefault(),this.toggleCalendar(t))}}
|
|
154
|
+
?disabled=${this.disabled}
|
|
155
|
+
${r.n(this.btnRef)}
|
|
156
|
+
>
|
|
157
|
+
<pkt-icon name="calendar"></pkt-icon>
|
|
158
|
+
<span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
|
|
159
|
+
</button>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</pkt-input-wrapper>
|
|
163
|
+
${this.renderCalendar()}
|
|
164
|
+
`}handleCalendarPosition(){var t;if(this.popupRef.value&&this.inputRef.value){const e=this.multiple&&!!this.maxlength,i=((t=this.inputRef.value.parentElement)==null?void 0:t.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),a=e?i.height+30:i.height,s=this.popupRef.value.getBoundingClientRect().height;let h=e?"calc(100% - 30px)":"100%";i&&i.top+s>window.innerHeight&&i.top-s>0&&(h=`calc(100% - ${a}px - ${s}px)`),this.popupRef.value.style.top=h}}handleFocusOut(t){this.contains(t.target)||(this.onBlur(),this.hideCalendar())}async showCalendar(){var t;this.calendarOpen=!0,await m(20),this.handleCalendarPosition(),this.isMobileSafari&&((t=this.calRef.value)==null||t.focusOnCurrentDate())}hideCalendar(){this.calendarOpen=!1}async toggleCalendar(t){t.preventDefault(),this.calendarOpen?this.hideCalendar():this.showCalendar()}clearInputValue(){this._value=[],this.value=""}};n([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",1);n([l.n({type:Array})],exports.PktDatepicker.prototype,"_value",2);n([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"label",2);n([l.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);n([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);n([l.n({type:Number,reflect:!0})],exports.PktDatepicker.prototype,"maxlength",2);n([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);n([l.n({type:Boolean})],exports.PktDatepicker.prototype,"showRangeLabels",2);n([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"min",2);n([l.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"max",2);n([l.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);n([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"withcontrols",2);n([l.n({converter:o.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);n([l.n({converter:o.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);n([l.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);n([l.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"calendarOpen",2);n([l.n({type:String})],exports.PktDatepicker.prototype,"timezone",2);n([v.r()],exports.PktDatepicker.prototype,"inputClasses",2);n([v.r()],exports.PktDatepicker.prototype,"buttonClasses",2);exports.PktDatepicker=n([l.t("pkt-datepicker")],exports.PktDatepicker);
|
package/dist/index.d.ts
CHANGED
|
@@ -456,7 +456,6 @@ export declare class PktCalendar extends PktElement {
|
|
|
456
456
|
isNextMonthAllowed(): boolean;
|
|
457
457
|
private nextMonth;
|
|
458
458
|
private changeMonth;
|
|
459
|
-
private isInRange;
|
|
460
459
|
private isRangeAllowed;
|
|
461
460
|
private emptySelected;
|
|
462
461
|
addToSelected(selectedDate: Date): void;
|
|
@@ -661,7 +660,9 @@ export declare class PktDatepicker extends PktInputElement {
|
|
|
661
660
|
/**
|
|
662
661
|
* Element attributes and properties
|
|
663
662
|
*/
|
|
664
|
-
|
|
663
|
+
private _valueProperty;
|
|
664
|
+
get value(): string;
|
|
665
|
+
set value(newValue: string | string[]);
|
|
665
666
|
_value: string[];
|
|
666
667
|
label: string;
|
|
667
668
|
dateformat: string;
|
|
@@ -686,6 +687,8 @@ export declare class PktDatepicker extends PktInputElement {
|
|
|
686
687
|
constructor();
|
|
687
688
|
connectedCallback(): Promise<void>;
|
|
688
689
|
disconnectedCallback(): void;
|
|
690
|
+
onInput(): void;
|
|
691
|
+
valueChanged(newValue: string | null, oldValue: string | null): void;
|
|
689
692
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
690
693
|
updated(changedProperties: PropertyValues): void;
|
|
691
694
|
/**
|
|
@@ -715,6 +718,7 @@ export declare class PktDatepicker extends PktInputElement {
|
|
|
715
718
|
showCalendar(): Promise<void>;
|
|
716
719
|
hideCalendar(): void;
|
|
717
720
|
toggleCalendar(e: Event): Promise<void>;
|
|
721
|
+
clearInputValue(): void;
|
|
718
722
|
}
|
|
719
723
|
|
|
720
724
|
/**
|
package/dist/pkt-calendar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calendar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calendar-32W9p9uc.cjs"),t=e.PktCalendar;Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});exports.default=t;
|
package/dist/pkt-calendar.js
CHANGED
package/dist/pkt-datepicker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-CmTrG5GE.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});exports.default=t;
|
package/dist/pkt-datepicker.js
CHANGED
package/dist/pkt-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-DQNBDKjT.cjs"),l=require("./accordionitem-Csh7iSVG.cjs"),d=require("./backlink-JbBNi3qg.cjs"),b=require("./button-B8rdtaHB.cjs"),k=require("./calendar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-DQNBDKjT.cjs"),l=require("./accordionitem-Csh7iSVG.cjs"),d=require("./backlink-JbBNi3qg.cjs"),b=require("./button-B8rdtaHB.cjs"),k=require("./calendar-32W9p9uc.cjs"),m=require("./card-BUITGoqX.cjs"),g=require("./combobox-DjO0RMUB.cjs"),h=require("./consent-hYeFWNFr.cjs"),f=require("./checkbox-Gn7Wtk9h.cjs"),t=require("./element-6DBpyGQm.cjs"),y=require("./pkt-slot-controller-BzddBp7z.cjs"),s=require("./ref-iJtiv3o2.cjs"),O=require("./class-map-BBG2gMX4.cjs"),j=require("./datepicker-CmTrG5GE.cjs"),q=require("./helptext-CzQX6YVE.cjs"),x=require("./heading-BRE_iFtR.cjs"),C=require("./icon-B_ryAy4Q.cjs"),v=require("./input-wrapper-CZ-a00V7.cjs"),S=require("./link-Cjl0xwSq.cjs"),$=require("./linkcard-BlMhPNry.cjs"),L=require("./loader-CHPxY9c6.cjs"),_=require("./messagebox-CqUBJs_D.cjs"),A=require("./modal-CRtxhCaP.cjs"),B=require("./progressbar-DhMBXkww.cjs"),p=require("./radiobutton-CdT6v1oq.cjs"),T=require("./tag-Bbs0U_Au.cjs"),I=require("./textarea-CPXsMFUq.cjs"),M=require("./textinput-aNI5kibM.cjs"),R=require("./select-Dkl0KhGW.cjs");var H=Object.defineProperty,w=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?w(e,r):e,u=a.length-1,c;u>=0;u--)(c=a[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&H(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=s.e(),this.namedSlot=s.e(),this.slotController=new y.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
|
|
2
2
|
<div class="${O.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|