@oslokommune/punkt-elements 12.36.2 → 12.37.1
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 +35 -0
- package/dist/{button-B6uRE7uT.js → button-BYZHwPtW.js} +1 -1
- package/dist/{button-BNdVIhUp.cjs → button-iCBnadXj.cjs} +1 -1
- package/dist/{checkbox-CyYfA2fu.js → checkbox-Cz3sIWt0.js} +1 -1
- package/dist/{checkbox-CqatE-eX.cjs → checkbox-U8aPrLjG.cjs} +1 -1
- package/dist/{combobox-D9NKnao2.cjs → combobox-AbD1tkKx.cjs} +1 -1
- package/dist/{combobox-CELUAZxF.js → combobox-Bsaj6Z6Y.js} +1 -1
- package/dist/consent-B888aPfK.js +161 -0
- package/dist/consent-CFgCfRsF.cjs +11 -0
- package/dist/consent.d.ts +1 -0
- package/dist/{datepicker-cR9MtXOh.cjs → datepicker-BAn16Z8U.cjs} +16 -16
- package/dist/{datepicker-CpkTwszH.js → datepicker-cNYYOtBI.js} +116 -103
- package/dist/index.d.ts +24 -1
- package/dist/input-element-XmmyUZmB.cjs +1 -0
- package/dist/{input-element-Bic-t96S.js → input-element-aQDMXDVQ.js} +31 -26
- package/dist/{modal-B-varrJT.js → modal-DIwagdAc.js} +1 -1
- package/dist/modal-OC0efchb.cjs +33 -0
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -0
- package/dist/pkt-consent.js +6 -0
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +3 -3
- package/dist/pkt-index.js +42 -40
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-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/{radiobutton-CIW0FvT8.cjs → radiobutton-DtL-nc1b.cjs} +1 -1
- package/dist/{radiobutton-DtHuz7qn.js → radiobutton-DtpGqoci.js} +1 -1
- package/dist/{select-DbRLz-7l.js → select-BO7s0ym6.js} +1 -1
- package/dist/{select-BJziJVde.cjs → select-CsrHon8V.cjs} +1 -1
- package/dist/{textarea-CiA4IzMs.js → textarea-BdjszjRh.js} +1 -1
- package/dist/{textarea-qX4Inr1X.cjs → textarea-vr4tUfJ3.cjs} +1 -1
- package/dist/{textinput-CrxjZNEq.js → textinput-D-hYhwtS.js} +31 -24
- package/dist/{textinput-BlsgLNwW.cjs → textinput-DTKG8h7M.cjs} +4 -3
- package/package.json +5 -4
- package/src/components/button/button.ts +1 -0
- package/src/components/consent/consent.ts +146 -0
- package/src/components/consent/index.ts +6 -0
- package/src/components/consent/strings.ts +125 -0
- package/src/components/datepicker/datepicker.ts +36 -4
- package/src/components/index.ts +3 -0
- package/src/components/modal/modal.ts +1 -1
- package/src/components/textinput/textinput.ts +10 -0
- package/dist/input-element-C9ma8cdz.cjs +0 -1
- package/dist/modal-cPcTJriW.cjs +0 -33
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { e as f } from "./class-map-KyMqi0fa.js";
|
|
2
2
|
import { o } from "./if-defined-BErSJCeJ.js";
|
|
3
|
-
import { x as
|
|
4
|
-
import { r as
|
|
5
|
-
import { n as
|
|
6
|
-
import { P as C } from "./input-element-
|
|
7
|
-
import { e as
|
|
8
|
-
import { c as
|
|
3
|
+
import { x as u, E as g, n as r, a as w } from "./element-DjjF_tEh.js";
|
|
4
|
+
import { r as k } from "./state-BtbpSrdV.js";
|
|
5
|
+
import { n as v, f as $, a as R, b as y, d as x } from "./calendar-KDcOWD6V.js";
|
|
6
|
+
import { P as C } from "./input-element-aQDMXDVQ.js";
|
|
7
|
+
import { e as m, n as p } from "./ref-iIffqQAI.js";
|
|
8
|
+
import { c as T } from "./repeat-D4kMediE.js";
|
|
9
9
|
import "./icon-Beoxup8E.js";
|
|
10
10
|
import "./input-wrapper-CeeNYbDA.js";
|
|
11
11
|
import "./tag-CGnj4c1Z.js";
|
|
12
|
-
import { P as
|
|
13
|
-
const
|
|
12
|
+
import { P as _ } from "./pkt-slot-controller-DFrc5O93.js";
|
|
13
|
+
const S = {
|
|
14
14
|
dateformat: {
|
|
15
15
|
default: "dd.MM.yyyy"
|
|
16
16
|
},
|
|
@@ -33,33 +33,33 @@ const D = {
|
|
|
33
33
|
default: !1
|
|
34
34
|
}
|
|
35
35
|
}, c = {
|
|
36
|
-
props:
|
|
36
|
+
props: S
|
|
37
37
|
};
|
|
38
|
-
var
|
|
39
|
-
for (var s =
|
|
40
|
-
(d = t[h]) && (s = (
|
|
41
|
-
return
|
|
38
|
+
var D = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (t, e, i, a) => {
|
|
39
|
+
for (var s = a > 1 ? void 0 : a ? I(e, i) : e, h = t.length - 1, d; h >= 0; h--)
|
|
40
|
+
(d = t[h]) && (s = (a ? d(e, i, s) : d(s)) || s);
|
|
41
|
+
return a && s && D(e, i, s), s;
|
|
42
42
|
};
|
|
43
|
-
const
|
|
44
|
-
let
|
|
43
|
+
const b = (t) => new Promise((e) => setTimeout(e, t));
|
|
44
|
+
let l = class extends C {
|
|
45
45
|
/**
|
|
46
46
|
* Housekeeping / lifecycle methods
|
|
47
47
|
*/
|
|
48
48
|
constructor() {
|
|
49
|
-
super(), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], 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 =
|
|
49
|
+
super(), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], 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 ?
|
|
53
|
-
s && !isNaN(s.getTime()) && (!i || s >= i) && (!
|
|
54
|
-
}, this.slotController = new
|
|
52
|
+
const i = this.min ? v(this.min) : null, a = this.max ? v(this.max) : null, s = v(e.value.split(",")[0]);
|
|
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 _(this, this.helptextSlot);
|
|
55
55
|
}
|
|
56
56
|
async connectedCallback() {
|
|
57
57
|
super.connectedCallback();
|
|
58
58
|
const t = navigator.userAgent, e = /iP(hone|od|ad)/.test(t);
|
|
59
59
|
this.inputType = e ? "text" : "date", document && document.body.addEventListener("click", (i) => {
|
|
60
|
-
var
|
|
61
|
-
(
|
|
62
|
-
}), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), 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
|
|
60
|
+
var a, s;
|
|
61
|
+
(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
|
+
}), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), 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 b(20), this.handleCalendarPosition());
|
|
63
63
|
}
|
|
64
64
|
disconnectedCallback() {
|
|
65
65
|
super.disconnectedCallback(), document && document.body.removeEventListener("click", (t) => {
|
|
@@ -85,7 +85,7 @@ let a = class extends C {
|
|
|
85
85
|
* Rendering
|
|
86
86
|
*/
|
|
87
87
|
renderInput() {
|
|
88
|
-
return
|
|
88
|
+
return u`
|
|
89
89
|
<input
|
|
90
90
|
class="${f(this.inputClasses)}"
|
|
91
91
|
.type=${this.inputType}
|
|
@@ -98,8 +98,11 @@ let a = class extends C {
|
|
|
98
98
|
}}
|
|
99
99
|
?disabled=${this.disabled}
|
|
100
100
|
@keydown=${(t) => {
|
|
101
|
-
var e;
|
|
102
|
-
(t.key === ","
|
|
101
|
+
var e, i;
|
|
102
|
+
if (t.key === "," && ((e = this.inputRef.value) == null || e.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t)), t.key === "Enter") {
|
|
103
|
+
const a = this.internals.form;
|
|
104
|
+
a ? a.requestSubmit() : (i = this.inputRef.value) == null || i.blur();
|
|
105
|
+
}
|
|
103
106
|
}}
|
|
104
107
|
@input=${(t) => {
|
|
105
108
|
this.onInput(), t.stopImmediatePropagation();
|
|
@@ -114,7 +117,7 @@ let a = class extends C {
|
|
|
114
117
|
@change=${(t) => {
|
|
115
118
|
t.stopImmediatePropagation();
|
|
116
119
|
}}
|
|
117
|
-
${
|
|
120
|
+
${p(this.inputRef)}
|
|
118
121
|
/>
|
|
119
122
|
`;
|
|
120
123
|
}
|
|
@@ -123,8 +126,8 @@ let a = class extends C {
|
|
|
123
126
|
"pkt-input-prefix": this.showRangeLabels,
|
|
124
127
|
"pkt-hide": !this.showRangeLabels
|
|
125
128
|
};
|
|
126
|
-
return
|
|
127
|
-
${this.showRangeLabels ?
|
|
129
|
+
return u`
|
|
130
|
+
${this.showRangeLabels ? u` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : g}
|
|
128
131
|
<input
|
|
129
132
|
class=${f(this.inputClasses)}
|
|
130
133
|
.type=${this.inputType}
|
|
@@ -137,8 +140,11 @@ let a = class extends C {
|
|
|
137
140
|
e.preventDefault(), this.showCalendar();
|
|
138
141
|
}}
|
|
139
142
|
@keydown=${(e) => {
|
|
140
|
-
var i;
|
|
141
|
-
(e.key === ","
|
|
143
|
+
var i, a;
|
|
144
|
+
if (e.key === "," && ((i = this.inputRef.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e)), e.key === "Enter") {
|
|
145
|
+
const s = this.internals.form;
|
|
146
|
+
s ? s.requestSubmit() : (a = this.inputRefTo.value) == null || a.focus();
|
|
147
|
+
}
|
|
142
148
|
}}
|
|
143
149
|
@input=${(e) => {
|
|
144
150
|
this.onInput(), e.stopImmediatePropagation();
|
|
@@ -147,22 +153,22 @@ let a = class extends C {
|
|
|
147
153
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
148
154
|
}}
|
|
149
155
|
@blur=${(e) => {
|
|
150
|
-
var i,
|
|
156
|
+
var i, a;
|
|
151
157
|
if (e.target.value) {
|
|
152
158
|
this.manageValidity(e.target);
|
|
153
|
-
const s =
|
|
154
|
-
s && this._value[0] !== e.target.value && this._value[1] && (this.clearInputValue(), (
|
|
159
|
+
const s = $(e.target.value);
|
|
160
|
+
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));
|
|
155
161
|
} else this._value[0] && this.clearInputValue();
|
|
156
162
|
}}
|
|
157
163
|
@change=${(e) => {
|
|
158
164
|
e.stopImmediatePropagation();
|
|
159
165
|
}}
|
|
160
|
-
${
|
|
166
|
+
${p(this.inputRef)}
|
|
161
167
|
/>
|
|
162
168
|
<div class="${f(t)}" id="${this.id}-to-label">
|
|
163
169
|
${this.strings.generic.to}
|
|
164
170
|
</div>
|
|
165
|
-
${this.showRangeLabels ?
|
|
171
|
+
${this.showRangeLabels ? g : u` <div class="pkt-input-separator">–</div> `}
|
|
166
172
|
<input
|
|
167
173
|
class=${f(this.inputClasses)}
|
|
168
174
|
.type=${this.inputType}
|
|
@@ -176,8 +182,11 @@ let a = class extends C {
|
|
|
176
182
|
e.preventDefault(), this.showCalendar();
|
|
177
183
|
}}
|
|
178
184
|
@keydown=${(e) => {
|
|
179
|
-
var i;
|
|
180
|
-
(e.key === ","
|
|
185
|
+
var i, a;
|
|
186
|
+
if (e.key === "," && ((i = this.inputRefTo.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e)), e.key === "Enter") {
|
|
187
|
+
const s = this.internals.form;
|
|
188
|
+
s ? s.requestSubmit() : (a = this.inputRefTo.value) == null || a.blur();
|
|
189
|
+
}
|
|
181
190
|
}}
|
|
182
191
|
@input=${(e) => {
|
|
183
192
|
this.onInput(), e.stopImmediatePropagation();
|
|
@@ -186,7 +195,7 @@ let a = class extends C {
|
|
|
186
195
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
187
196
|
}}
|
|
188
197
|
@blur=${(e) => {
|
|
189
|
-
var i,
|
|
198
|
+
var i, a, s;
|
|
190
199
|
if ((i = this.calRef.value) != null && i.contains(e.relatedTarget) || this.onBlur(), e.target.value) {
|
|
191
200
|
this.manageValidity(e.target);
|
|
192
201
|
const h = e.target.value;
|
|
@@ -199,19 +208,19 @@ let a = class extends C {
|
|
|
199
208
|
this.strings.forms.messages.rangeOverflow,
|
|
200
209
|
e.target
|
|
201
210
|
);
|
|
202
|
-
const d =
|
|
203
|
-
d && this._value[1] !== R(d) && ((s = (
|
|
211
|
+
const d = $(e.target.value);
|
|
212
|
+
d && this._value[1] !== R(d) && ((s = (a = this.calRef) == null ? void 0 : a.value) == null || s.handleDateSelect(d));
|
|
204
213
|
}
|
|
205
214
|
}}
|
|
206
215
|
@change=${(e) => {
|
|
207
216
|
e.stopImmediatePropagation();
|
|
208
217
|
}}
|
|
209
|
-
${
|
|
218
|
+
${p(this.inputRefTo)}
|
|
210
219
|
/>
|
|
211
220
|
`;
|
|
212
221
|
}
|
|
213
222
|
renderMultipleInput() {
|
|
214
|
-
return
|
|
223
|
+
return u`
|
|
215
224
|
<input
|
|
216
225
|
class=${f(this.inputClasses)}
|
|
217
226
|
.type=${this.inputType}
|
|
@@ -233,22 +242,26 @@ let a = class extends C {
|
|
|
233
242
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
234
243
|
}}
|
|
235
244
|
@keydown=${(t) => {
|
|
236
|
-
|
|
245
|
+
var e;
|
|
246
|
+
if (t.key === "," && (t.preventDefault(), this.addToSelected(t)), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t)), t.key === "Enter") {
|
|
247
|
+
const i = this.internals.form;
|
|
248
|
+
i ? i.requestSubmit() : (e = this.inputRef.value) == null || e.blur();
|
|
249
|
+
}
|
|
237
250
|
}}
|
|
238
251
|
@change=${(t) => {
|
|
239
252
|
t.stopImmediatePropagation();
|
|
240
253
|
}}
|
|
241
|
-
${
|
|
254
|
+
${p(this.inputRef)}
|
|
242
255
|
/>
|
|
243
256
|
`;
|
|
244
257
|
}
|
|
245
258
|
renderTags() {
|
|
246
|
-
return
|
|
259
|
+
return u`
|
|
247
260
|
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
248
|
-
${this._value[0] ?
|
|
261
|
+
${this._value[0] ? T(
|
|
249
262
|
this._value ?? [],
|
|
250
263
|
(t) => t,
|
|
251
|
-
(t) =>
|
|
264
|
+
(t) => u`
|
|
252
265
|
<pkt-tag
|
|
253
266
|
.id="${this.id + t + "-tag"}"
|
|
254
267
|
closeTag
|
|
@@ -258,23 +271,23 @@ let a = class extends C {
|
|
|
258
271
|
)}"
|
|
259
272
|
@close=${() => {
|
|
260
273
|
var e;
|
|
261
|
-
return (e = this.calRef.value) == null ? void 0 : e.handleDateSelect(
|
|
274
|
+
return (e = this.calRef.value) == null ? void 0 : e.handleDateSelect($(t));
|
|
262
275
|
}}
|
|
263
276
|
><time datetime="${t}">${y(t, this.dateformat)}</time></pkt-tag
|
|
264
277
|
>
|
|
265
278
|
`
|
|
266
|
-
) :
|
|
279
|
+
) : g}
|
|
267
280
|
</div>
|
|
268
281
|
`;
|
|
269
282
|
}
|
|
270
283
|
renderCalendar() {
|
|
271
|
-
return
|
|
284
|
+
return u`<div
|
|
272
285
|
class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
|
|
273
286
|
@focusout=${(t) => {
|
|
274
287
|
this.calendarOpen && this.handleFocusOut(t);
|
|
275
288
|
}}
|
|
276
289
|
id="${this.id}-popup"
|
|
277
|
-
${
|
|
290
|
+
${p(this.popupRef)}
|
|
278
291
|
>
|
|
279
292
|
<pkt-calendar
|
|
280
293
|
id="${this.id}-calendar"
|
|
@@ -288,14 +301,14 @@ let a = class extends C {
|
|
|
288
301
|
.latest=${this.max}
|
|
289
302
|
.excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
|
|
290
303
|
.excludeweekdays=${this.excludeweekdays}
|
|
291
|
-
.currentmonth=${this.currentmonth ?
|
|
304
|
+
.currentmonth=${this.currentmonth ? v(this.currentmonth) : null}
|
|
292
305
|
@date-selected=${(t) => {
|
|
293
306
|
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] : ""));
|
|
294
307
|
}}
|
|
295
308
|
@close=${() => {
|
|
296
309
|
this.onBlur(), this.hideCalendar();
|
|
297
310
|
}}
|
|
298
|
-
${
|
|
311
|
+
${p(this.calRef)}
|
|
299
312
|
></pkt-calendar>
|
|
300
313
|
</div>`;
|
|
301
314
|
}
|
|
@@ -312,7 +325,7 @@ let a = class extends C {
|
|
|
312
325
|
"pkt-btn": !0,
|
|
313
326
|
"pkt-btn--icon-only": !0,
|
|
314
327
|
"pkt-btn--tertiary": !0
|
|
315
|
-
},
|
|
328
|
+
}, u`
|
|
316
329
|
<pkt-input-wrapper
|
|
317
330
|
label="${this.label}"
|
|
318
331
|
forId="${this.id}-input"
|
|
@@ -336,8 +349,8 @@ let a = class extends C {
|
|
|
336
349
|
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
337
350
|
class="pkt-datepicker"
|
|
338
351
|
>
|
|
339
|
-
<div class="pkt-contents" ${
|
|
340
|
-
${this.multiple ? this.renderTags() :
|
|
352
|
+
<div class="pkt-contents" ${p(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
353
|
+
${this.multiple ? this.renderTags() : g}
|
|
341
354
|
<div
|
|
342
355
|
class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
|
|
343
356
|
>
|
|
@@ -348,7 +361,7 @@ let a = class extends C {
|
|
|
348
361
|
type="button"
|
|
349
362
|
@click=${this.toggleCalendar}
|
|
350
363
|
?disabled=${this.disabled}
|
|
351
|
-
${
|
|
364
|
+
${p(this.btnRef)}
|
|
352
365
|
>
|
|
353
366
|
<pkt-icon name="calendar"></pkt-icon>
|
|
354
367
|
<span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
|
|
@@ -365,9 +378,9 @@ let a = class extends C {
|
|
|
365
378
|
handleCalendarPosition() {
|
|
366
379
|
var t;
|
|
367
380
|
if (this.popupRef.value && this.inputRef.value) {
|
|
368
|
-
const e = this.multiple && !!this.maxlength, i = ((t = this.inputRef.value.parentElement) == null ? void 0 : t.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(),
|
|
381
|
+
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;
|
|
369
382
|
let h = e ? "calc(100% - 30px)" : "100%";
|
|
370
|
-
i && i.top + s > window.innerHeight && i.top - s > 0 && (h = `calc(100% - ${
|
|
383
|
+
i && i.top + s > window.innerHeight && i.top - s > 0 && (h = `calc(100% - ${a}px - ${s}px)`), this.popupRef.value.style.top = h;
|
|
371
384
|
}
|
|
372
385
|
}
|
|
373
386
|
handleFocusOut(t) {
|
|
@@ -375,7 +388,7 @@ let a = class extends C {
|
|
|
375
388
|
}
|
|
376
389
|
async showCalendar() {
|
|
377
390
|
var t;
|
|
378
|
-
this.calendarOpen = !0, await
|
|
391
|
+
this.calendarOpen = !0, await b(20), this.handleCalendarPosition(), this.isMobileSafari && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
|
|
379
392
|
}
|
|
380
393
|
hideCalendar() {
|
|
381
394
|
this.calendarOpen = !1;
|
|
@@ -384,66 +397,66 @@ let a = class extends C {
|
|
|
384
397
|
t.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
|
|
385
398
|
}
|
|
386
399
|
};
|
|
387
|
-
|
|
400
|
+
n([
|
|
388
401
|
r({ type: String, reflect: !0 })
|
|
389
|
-
],
|
|
390
|
-
|
|
402
|
+
], l.prototype, "value", 2);
|
|
403
|
+
n([
|
|
391
404
|
r({ type: Array })
|
|
392
|
-
],
|
|
393
|
-
|
|
405
|
+
], l.prototype, "_value", 2);
|
|
406
|
+
n([
|
|
394
407
|
r({ type: String, reflect: !0 })
|
|
395
|
-
],
|
|
396
|
-
|
|
408
|
+
], l.prototype, "label", 2);
|
|
409
|
+
n([
|
|
397
410
|
r({ type: String })
|
|
398
|
-
],
|
|
399
|
-
|
|
411
|
+
], l.prototype, "dateformat", 2);
|
|
412
|
+
n([
|
|
400
413
|
r({ type: Boolean, reflect: !0 })
|
|
401
|
-
],
|
|
402
|
-
|
|
414
|
+
], l.prototype, "multiple", 2);
|
|
415
|
+
n([
|
|
403
416
|
r({ type: Number, reflect: !0 })
|
|
404
|
-
],
|
|
405
|
-
|
|
417
|
+
], l.prototype, "maxlength", 2);
|
|
418
|
+
n([
|
|
406
419
|
r({ type: Boolean, reflect: !0 })
|
|
407
|
-
],
|
|
408
|
-
|
|
420
|
+
], l.prototype, "range", 2);
|
|
421
|
+
n([
|
|
409
422
|
r({ type: Boolean })
|
|
410
|
-
],
|
|
411
|
-
|
|
423
|
+
], l.prototype, "showRangeLabels", 2);
|
|
424
|
+
n([
|
|
412
425
|
r({ type: String, reflect: !0 })
|
|
413
|
-
],
|
|
414
|
-
|
|
426
|
+
], l.prototype, "min", 2);
|
|
427
|
+
n([
|
|
415
428
|
r({ type: String, reflect: !0 })
|
|
416
|
-
],
|
|
417
|
-
|
|
429
|
+
], l.prototype, "max", 2);
|
|
430
|
+
n([
|
|
418
431
|
r({ type: Boolean })
|
|
419
|
-
],
|
|
420
|
-
|
|
432
|
+
], l.prototype, "weeknumbers", 2);
|
|
433
|
+
n([
|
|
421
434
|
r({ type: Boolean, reflect: !0 })
|
|
422
|
-
],
|
|
423
|
-
|
|
435
|
+
], l.prototype, "withcontrols", 2);
|
|
436
|
+
n([
|
|
424
437
|
r({ converter: x.csvToArray })
|
|
425
|
-
],
|
|
426
|
-
|
|
438
|
+
], l.prototype, "excludedates", 2);
|
|
439
|
+
n([
|
|
427
440
|
r({ converter: x.csvToArray })
|
|
428
|
-
],
|
|
429
|
-
|
|
441
|
+
], l.prototype, "excludeweekdays", 2);
|
|
442
|
+
n([
|
|
430
443
|
r({ type: String })
|
|
431
|
-
],
|
|
432
|
-
|
|
444
|
+
], l.prototype, "currentmonth", 2);
|
|
445
|
+
n([
|
|
433
446
|
r({ type: Boolean, reflect: !0 })
|
|
434
|
-
],
|
|
435
|
-
|
|
447
|
+
], l.prototype, "calendarOpen", 2);
|
|
448
|
+
n([
|
|
436
449
|
r({ type: String })
|
|
437
|
-
],
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
],
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
],
|
|
444
|
-
|
|
450
|
+
], l.prototype, "timezone", 2);
|
|
451
|
+
n([
|
|
452
|
+
k()
|
|
453
|
+
], l.prototype, "inputClasses", 2);
|
|
454
|
+
n([
|
|
455
|
+
k()
|
|
456
|
+
], l.prototype, "buttonClasses", 2);
|
|
457
|
+
l = n([
|
|
445
458
|
w("pkt-datepicker")
|
|
446
|
-
],
|
|
459
|
+
], l);
|
|
447
460
|
export {
|
|
448
|
-
|
|
461
|
+
l as P
|
|
449
462
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -156,6 +156,13 @@ export declare interface IPktComboboxOption {
|
|
|
156
156
|
value: string;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
export declare interface IPktConsent {
|
|
160
|
+
hotjarId?: string | null;
|
|
161
|
+
googleAnalyticsId?: string | null;
|
|
162
|
+
triggerType?: 'button' | 'link' | 'footerlink' | 'icon' | null;
|
|
163
|
+
triggerText?: string | null;
|
|
164
|
+
}
|
|
165
|
+
|
|
159
166
|
export declare interface IPktHeading {
|
|
160
167
|
size?: TPktHeadingSize;
|
|
161
168
|
level?: TPktHeadingLevel;
|
|
@@ -552,6 +559,21 @@ export declare class PktComponent extends PktElement {
|
|
|
552
559
|
private handleGreeting;
|
|
553
560
|
}
|
|
554
561
|
|
|
562
|
+
export declare class PktConsent extends PktElement<IPktConsent> implements IPktConsent {
|
|
563
|
+
hotjarId: string | null;
|
|
564
|
+
googleAnalyticsId: string | null;
|
|
565
|
+
triggerType: 'button' | 'link' | 'footerlink' | 'icon' | null;
|
|
566
|
+
triggerText: string | null;
|
|
567
|
+
i18nLanguage: string;
|
|
568
|
+
constructor();
|
|
569
|
+
connectedCallback(): void;
|
|
570
|
+
emitCookieConsents(consent: any): void;
|
|
571
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
572
|
+
triggerInit(): void;
|
|
573
|
+
openModal(e: Event): void;
|
|
574
|
+
render(): TemplateResult<1>;
|
|
575
|
+
}
|
|
576
|
+
|
|
555
577
|
export declare class PktDatepicker extends PktInputElement {
|
|
556
578
|
/**
|
|
557
579
|
* Element attributes and properties
|
|
@@ -729,6 +751,7 @@ declare class PktInputElement<T = {}> extends PktElement<Props_2 & T> {
|
|
|
729
751
|
protected onBlur(): void;
|
|
730
752
|
protected onInput(): void;
|
|
731
753
|
protected onChange(value: string | string[]): void;
|
|
754
|
+
protected formResetCallback(): void;
|
|
732
755
|
protected updated(_changedProperties: PropertyValues): void;
|
|
733
756
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
734
757
|
}
|
|
@@ -889,7 +912,7 @@ export declare class PktModal extends PktElement implements IPktModal {
|
|
|
889
912
|
private handleBackdropClick;
|
|
890
913
|
private isElementInViewport;
|
|
891
914
|
close: (event: Event, bypassNativeClose?: boolean) => void;
|
|
892
|
-
showModal: (event
|
|
915
|
+
showModal: (event?: Event | null) => void;
|
|
893
916
|
render(): TemplateResult<1>;
|
|
894
917
|
}
|
|
895
918
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./element-BSypUpzA.cjs"),f=require("./state-B5KCNjEd.cjs"),c=require("./stringutils-CkVRq4jP.cjs"),y=require("./input-wrapper-EoSAbU-U.cjs");var m=Object.defineProperty,s=(o,t,a,n)=>{for(var r=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(r=h(t,a,r)||r);return r&&m(t,a,r),r};class i extends e.PktElement{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=c.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=y.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.translations.forms.labels.optional,this.requiredText=e.translations.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){var a,n,r,l,h,u,p,d;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.translations.forms.messages.required,t):(a=t.validity)!=null&&a.typeMismatch||(n=t.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},e.translations.forms.messages.invalid,t):(r=t.validity)!=null&&r.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.translations.forms.messages.invalidPattern,t):(l=t.validity)!=null&&l.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.translations.forms.messages.tooShort,t):(h=t.validity)!=null&&h.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.translations.forms.messages.tooLong,t):(u=t.validity)!=null&&u.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.translations.forms.messages.rangeUnderflow,t):(p=t.validity)!=null&&p.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.translations.forms.messages.rangeOverflow,t):(d=t.validity)!=null&&d.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({}))}setFormValue(t){if(this.internals)if(Array.isArray(t)){const a=new FormData;t.forEach(n=>{a.append(this.name,n)}),this.internals.setFormValue(a)}else this.internals.setFormValue(t)}valueChecked(t){if(!this.touched)return;const a=this.internals.form||this.closest("form");a&&a.querySelectorAll(`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`).forEach(n=>{const r=n;r.name===this.name&&r.value!==this.value&&r.checked&&(r.checked=!1)}),typeof t=="string"?(this.checked=t==="true",this.internals.ariaChecked=t==="true"):typeof t=="boolean"&&(this.checked=t,this.internals.ariaChecked=t),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue("",""),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(t,a){(a!==this.value||a!==this._value)&&(typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=this.multiple||this.range?t:t[0],this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&a&&a.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(a==null?void 0:a.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}onChange(t){if(!this.touched){this.touched=!0,t&&this.setFormValue(t);return}typeof t!="string"&&!Array.isArray(t)||((this.range||this.multiple)&&!Array.isArray(t)&&t.includes(",")&&(t=t.split(",")),!this.multiple&&!this.range&&Array.isArray(t)&&(t=t[0]),this.setFormValue(t),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})),this.internals.reportValidity())}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{t.selected=!1}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}updated(t){super.updated(t),t.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(t){if(super.firstUpdated(t),this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const a=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=a,this.internals.setFormValue(a?this.value||"on":"",a?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}s([e.n()],i.prototype,"defaultValue");s([e.n({type:Boolean,reflect:!0})],i.prototype,"disabled");s([e.n({type:Boolean,reflect:!0})],i.prototype,"readonly");s([e.n({type:Boolean,reflect:!0})],i.prototype,"required");s([e.n({type:Number,reflect:!0})],i.prototype,"max");s([e.n({type:Number,reflect:!0})],i.prototype,"maxlength");s([e.n({type:Number,reflect:!0})],i.prototype,"min");s([e.n({type:Number,reflect:!0})],i.prototype,"minlength");s([e.n({type:String})],i.prototype,"ariaDescribedBy");s([e.n({type:String})],i.prototype,"ariaLabelledby");s([e.n({type:String,reflect:!0})],i.prototype,"name");s([e.n({type:String,reflect:!0})],i.prototype,"pattern");s([e.n({type:String,reflect:!0})],i.prototype,"placeholder");s([e.n({type:String,reflect:!0})],i.prototype,"id");s([e.n({type:Boolean})],i.prototype,"counter");s([e.n({type:Boolean})],i.prototype,"hasError");s([e.n({type:Boolean})],i.prototype,"inline");s([e.n({type:Boolean})],i.prototype,"hasFieldset");s([e.n({type:Boolean})],i.prototype,"optionalTag");s([e.n({type:Boolean})],i.prototype,"requiredTag");s([e.n({type:Boolean})],i.prototype,"skipForwardTestid");s([e.n({type:Boolean,reflect:!1})],i.prototype,"useWrapper");s([e.n({type:Boolean,reflect:!0})],i.prototype,"fullwidth");s([e.n({type:Number})],i.prototype,"counterMaxLength");s([e.n({type:String})],i.prototype,"errorMessage");s([e.n({type:String})],i.prototype,"helptext");s([e.n({type:String})],i.prototype,"helptextDropdown");s([e.n({type:String,reflect:!1})],i.prototype,"helptextDropdownButton");s([e.n({type:String})],i.prototype,"label");s([e.n({type:String,reflect:!1})],i.prototype,"optionalText");s([e.n({type:String,reflect:!1})],i.prototype,"requiredText");s([e.n({type:String,attribute:"data-testid"})],i.prototype,"dataTestid");s([f.r()],i.prototype,"touched");exports.PktInputElement=i;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import { r as
|
|
1
|
+
import { P as c, t as l, n as s } from "./element-DjjF_tEh.js";
|
|
2
|
+
import { r as y } from "./state-BtbpSrdV.js";
|
|
3
3
|
import { u as m } from "./stringutils-DJjRa8dG.js";
|
|
4
4
|
import { s as g } from "./input-wrapper-8iKEzDRZ.js";
|
|
5
|
-
var v = Object.defineProperty, e = (
|
|
6
|
-
for (var
|
|
7
|
-
(o =
|
|
8
|
-
return
|
|
5
|
+
var v = Object.defineProperty, e = (u, t, a, h) => {
|
|
6
|
+
for (var r = void 0, n = u.length - 1, o; n >= 0; n--)
|
|
7
|
+
(o = u[n]) && (r = o(t, a, r) || r);
|
|
8
|
+
return r && v(t, a, r), r;
|
|
9
9
|
};
|
|
10
|
-
class i extends
|
|
10
|
+
class i extends c {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(), this.defaultValue = null, this.disabled = !1, this.readonly = !1, this.required = !1, this.max = null, this.maxlength = null, this.min = null, this.minlength = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = m(), this.counter = !1, this.hasError = !1, this.inline = !1, this.hasFieldset = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = g.props.helptextDropdownButton.default, this.label = null, this.optionalText = l.forms.labels.optional, this.requiredText = l.forms.labels.required, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
|
|
13
13
|
}
|
|
@@ -15,12 +15,12 @@ class i extends y {
|
|
|
15
15
|
return !0;
|
|
16
16
|
}
|
|
17
17
|
manageValidity(t) {
|
|
18
|
-
var
|
|
19
|
-
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, l.forms.messages.required, t) : (
|
|
18
|
+
var a, h, r, n, o, p, d, f;
|
|
19
|
+
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, l.forms.messages.required, t) : (a = t.validity) != null && a.typeMismatch || (h = t.validity) != null && h.badInput ? this.internals.setValidity({ typeMismatch: !0 }, l.forms.messages.invalid, t) : (r = t.validity) != null && r.patternMismatch ? this.internals.setValidity(
|
|
20
20
|
{ patternMismatch: !0 },
|
|
21
21
|
l.forms.messages.invalidPattern,
|
|
22
22
|
t
|
|
23
|
-
) : (
|
|
23
|
+
) : (n = t.validity) != null && n.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, l.forms.messages.tooShort, t) : (o = t.validity) != null && o.tooLong || this.maxlength && this.maxlength > 0 && this.value.length > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, l.forms.messages.tooLong, t) : (p = t.validity) != null && p.rangeUnderflow ? this.internals.setValidity(
|
|
24
24
|
{ rangeUnderflow: !0 },
|
|
25
25
|
l.forms.messages.rangeUnderflow,
|
|
26
26
|
t
|
|
@@ -33,10 +33,10 @@ class i extends y {
|
|
|
33
33
|
setFormValue(t) {
|
|
34
34
|
if (this.internals)
|
|
35
35
|
if (Array.isArray(t)) {
|
|
36
|
-
const
|
|
37
|
-
t.forEach((
|
|
38
|
-
|
|
39
|
-
}), this.internals.setFormValue(
|
|
36
|
+
const a = new FormData();
|
|
37
|
+
t.forEach((h) => {
|
|
38
|
+
a.append(this.name, h);
|
|
39
|
+
}), this.internals.setFormValue(a);
|
|
40
40
|
} else
|
|
41
41
|
this.internals.setFormValue(t);
|
|
42
42
|
}
|
|
@@ -44,12 +44,12 @@ class i extends y {
|
|
|
44
44
|
// Do not use valueChanged or onChange for radios and checkboxes!
|
|
45
45
|
valueChecked(t) {
|
|
46
46
|
if (!this.touched) return;
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const a = this.internals.form || this.closest("form");
|
|
48
|
+
a && a.querySelectorAll(
|
|
49
49
|
`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`
|
|
50
|
-
).forEach((
|
|
51
|
-
const
|
|
52
|
-
|
|
50
|
+
).forEach((h) => {
|
|
51
|
+
const r = h;
|
|
52
|
+
r.name === this.name && r.value !== this.value && r.checked && (r.checked = !1);
|
|
53
53
|
}), typeof t == "string" ? (this.checked = t === "true", this.internals.ariaChecked = t === "true") : typeof t == "boolean" && (this.checked = t, this.internals.ariaChecked = t), this.checked ? (this.internals.setFormValue(this.value || "on", this.value || "on"), this.internals.states.add("--checked")) : (this.internals.setFormValue("", ""), this.internals.states.delete("--checked")), this.dispatchEvent(new Event("change")), this.dispatchEvent(
|
|
54
54
|
new CustomEvent("value-change", {
|
|
55
55
|
detail: this.checked,
|
|
@@ -58,8 +58,8 @@ class i extends y {
|
|
|
58
58
|
})
|
|
59
59
|
), this.internals.reportValidity();
|
|
60
60
|
}
|
|
61
|
-
valueChanged(t,
|
|
62
|
-
(
|
|
61
|
+
valueChanged(t, a) {
|
|
62
|
+
(a !== this.value || a !== this._value) && (typeof t == "string" ? ((this.multiple || this.range) && t.includes(",") && (t = t.split(",")), this.value = t, this._value = Array.isArray(t) ? t : [t]) : Array.isArray(t) ? (this.value = this.multiple || this.range ? t : t[0], this._value = t) : (this.value = "", this._value = []), (!this.value || this.value.length === 0) && a && a.length !== 0 ? this.clearInputValue() : this.value && this.value.toString() !== (a == null ? void 0 : a.toString()) && this.onChange(this.value), this.updateComplete.then(() => this.requestUpdate()));
|
|
63
63
|
}
|
|
64
64
|
// When input goes from content to no content
|
|
65
65
|
clearInputValue() {
|
|
@@ -98,15 +98,20 @@ class i extends y {
|
|
|
98
98
|
})
|
|
99
99
|
), this.internals.reportValidity());
|
|
100
100
|
}
|
|
101
|
+
formResetCallback() {
|
|
102
|
+
this.touched = !1, this._options && this._options.length && this._options.forEach((t) => {
|
|
103
|
+
t.selected = !1;
|
|
104
|
+
}), this.checked !== void 0 ? (this.checked = !1, this.internals.ariaChecked = !1, this.internals.setFormValue("", ""), this.inputRef.value.checked = !1, this.valueChecked(this.checked)) : (this.internals.setFormValue(""), this.value = this.defaultValue || (this.multiple || this.range ? [] : ""), this._value = this.value, this.valueChanged(this.value, null)), this.internals.ariaInvalid = !1;
|
|
105
|
+
}
|
|
101
106
|
updated(t) {
|
|
102
107
|
super.updated(t), t.has("dataTestid") && this.dataTestid && this.inputRef.value && (this.skipForwardTestid ? this.hasAttribute("data-testid") || this.setAttribute("data-testid", this.dataTestid) : (this.inputRef.value.dataset.testid = this.dataTestid, this.removeAttribute("data-testid")));
|
|
103
108
|
}
|
|
104
109
|
firstUpdated(t) {
|
|
105
110
|
if (super.firstUpdated(t), this.value && this.defaultValue !== null && (this.defaultValue = this.value), this.defaultValue !== null && !this.value && this.valueChanged(this.defaultValue, null), this.defaultChecked && (this.internals.ariaChecked = !0, this.checked = !0), this.required && (this.internals.ariaRequired = !0), this.disabled && (this.internals.ariaDisabled = !0), this.id && !this.name && (this.name = this.id), this.checked !== void 0) {
|
|
106
|
-
const
|
|
107
|
-
this.internals.ariaChecked =
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
const a = this.checked === "" || this.checked === "true" || this.checked === !0;
|
|
112
|
+
this.internals.ariaChecked = a, this.internals.setFormValue(
|
|
113
|
+
a ? this.value || "on" : "",
|
|
114
|
+
a ? this.value || "on" : ""
|
|
110
115
|
);
|
|
111
116
|
} else
|
|
112
117
|
this.internals.setFormValue(this.value);
|
|
@@ -210,7 +215,7 @@ e([
|
|
|
210
215
|
s({ type: String, attribute: "data-testid" })
|
|
211
216
|
], i.prototype, "dataTestid");
|
|
212
217
|
e([
|
|
213
|
-
|
|
218
|
+
y()
|
|
214
219
|
], i.prototype, "touched");
|
|
215
220
|
export {
|
|
216
221
|
i as P
|
|
@@ -32,7 +32,7 @@ let l = class extends f {
|
|
|
32
32
|
o && !this.isElementInViewport(o) && o.scrollIntoView({ behavior: "smooth", block: "nearest" }), this.dispatchEvent(
|
|
33
33
|
new CustomEvent("close", { detail: { origin: t }, bubbles: !0, composed: !0 })
|
|
34
34
|
), e || (s = this.dialogRef.value) == null || s.close(), this.requestUpdate();
|
|
35
|
-
}, this.showModal = (t) => {
|
|
35
|
+
}, this.showModal = (t = null) => {
|
|
36
36
|
var o;
|
|
37
37
|
this._isOpen = !0, (o = this.dialogRef.value) == null || o.showModal();
|
|
38
38
|
const e = document.querySelector(".pkt-modal");
|