@oslokommune/punkt-elements 14.1.1 → 14.2.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/booleanish-BKVonob4.cjs +1 -0
- package/dist/booleanish-C9R0tdXH.js +11 -0
- package/dist/{checkbox-BP5zOlPy.cjs → checkbox-C0TPnShf.cjs} +1 -1
- package/dist/{checkbox-CfXOh6Lw.js → checkbox-CnhA52o_.js} +1 -1
- package/dist/{combobox-BWsCkPH2.cjs → combobox-C1xwAju5.cjs} +1 -1
- package/dist/{combobox-BMznle0M.js → combobox-Dcp_fHcL.js} +2 -2
- package/dist/{datepicker-2s6FUxdi.js → datepicker-Bjb9GK1E.js} +2 -2
- package/dist/{datepicker-D1c9oP-2.cjs → datepicker-COIRRau0.cjs} +1 -1
- package/dist/index.d.ts +45 -160
- package/dist/{input-element-B0VPRK_E.js → input-element-B8M8Nppd.js} +77 -84
- package/dist/input-element-D697OAJo.cjs +1 -0
- package/dist/{input-wrapper-CAwzMR9o.js → input-wrapper-1PCXqtiu.js} +42 -49
- package/dist/{input-wrapper-DXg2N3wx.cjs → input-wrapper-CtBiAb04.cjs} +20 -20
- 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 +2 -2
- package/dist/pkt-header.cjs +11 -11
- package/dist/pkt-header.js +42 -48
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +8 -8
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.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-BuKXgQm_.cjs → radiobutton-BkqaqO5E.cjs} +1 -1
- package/dist/{radiobutton-C_MzK8dE.js → radiobutton-Caq8-GhM.js} +1 -1
- package/dist/{select-Ds4Ws1_6.cjs → select-3dwlk22G.cjs} +1 -1
- package/dist/{select-CteaDnzz.js → select-_C-yztI0.js} +2 -2
- package/dist/{textarea-zeFp1hxO.cjs → textarea-DyUy8u7X.cjs} +1 -1
- package/dist/{textarea-D4T9yqw7.js → textarea-a6T4aJJU.js} +2 -2
- package/dist/{textinput-Cddq4eF_.js → textinput-DIuM70dd.js} +2 -2
- package/dist/{textinput-DFFL5v-U.cjs → textinput-IN3b0nSH.cjs} +1 -1
- package/package.json +2 -2
- package/src/components/accordion/accordion.ts +2 -1
- package/src/components/alert/alert.ts +2 -2
- package/src/components/button/button.ts +2 -3
- package/src/components/card/card.ts +2 -3
- package/src/components/header/types.ts +17 -78
- package/src/components/heading/heading.ts +4 -3
- package/src/components/input-wrapper/input-wrapper.ts +2 -16
- package/src/components/messagebox/messagebox.ts +2 -1
- package/src/components/progressbar/progressbar.ts +1 -1
- package/src/components/tag/tag.ts +2 -2
- package/dist/input-element-BmXkhljw.cjs +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { P as Ce, t as
|
|
1
|
+
import { P as Ce, t as g, n as d } from "./element-CRDRygXu.js";
|
|
2
2
|
import { r as Fe } from "./state-DS_kr2Fy.js";
|
|
3
3
|
import { u as Te } from "./utils-DznhwRXm.js";
|
|
4
|
+
import { b as Se } from "./booleanish-C9R0tdXH.js";
|
|
4
5
|
import { s as Ae } from "./input-wrapper-CDgenrYA.js";
|
|
5
6
|
var oe = {}, le;
|
|
6
|
-
function
|
|
7
|
+
function xe() {
|
|
7
8
|
return le || (le = 1, (function() {
|
|
8
|
-
(function(
|
|
9
|
-
const s = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(),
|
|
9
|
+
(function(M) {
|
|
10
|
+
const s = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), L = {
|
|
10
11
|
ariaAtomic: "aria-atomic",
|
|
11
12
|
ariaAutoComplete: "aria-autocomplete",
|
|
12
13
|
ariaBusy: "aria-busy",
|
|
@@ -91,31 +92,31 @@ function Se() {
|
|
|
91
92
|
t.forEach((e) => {
|
|
92
93
|
const { addedNodes: i, removedNodes: a } = e, r = Array.from(i), n = Array.from(a);
|
|
93
94
|
r.forEach((o) => {
|
|
94
|
-
var
|
|
95
|
+
var m;
|
|
95
96
|
if (u.has(o) && o.constructor.formAssociated && K(o), C.has(o)) {
|
|
96
|
-
const
|
|
97
|
-
Object.keys(L).filter((
|
|
98
|
-
k(o, L[
|
|
97
|
+
const f = C.get(o);
|
|
98
|
+
Object.keys(L).filter((v) => f[v] !== null).forEach((v) => {
|
|
99
|
+
k(o, L[v], f[v]);
|
|
99
100
|
}), C.delete(o);
|
|
100
101
|
}
|
|
101
102
|
if (I.has(o)) {
|
|
102
|
-
const
|
|
103
|
-
k(o, "internals-valid",
|
|
103
|
+
const f = I.get(o);
|
|
104
|
+
k(o, "internals-valid", f.validity.valid.toString()), k(o, "internals-invalid", (!f.validity.valid).toString()), k(o, "aria-invalid", (!f.validity.valid).toString()), I.delete(o);
|
|
104
105
|
}
|
|
105
106
|
if (o.localName === "form") {
|
|
106
|
-
const
|
|
107
|
+
const f = b.get(o), E = document.createTreeWalker(o, NodeFilter.SHOW_ELEMENT, {
|
|
107
108
|
acceptNode($) {
|
|
108
|
-
return u.has($) && $.constructor.formAssociated && !(
|
|
109
|
+
return u.has($) && $.constructor.formAssociated && !(f && f.has($)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
|
-
let
|
|
112
|
-
for (;
|
|
113
|
-
K(
|
|
112
|
+
let v = E.nextNode();
|
|
113
|
+
for (; v; )
|
|
114
|
+
K(v), v = E.nextNode();
|
|
114
115
|
}
|
|
115
|
-
o.localName === "fieldset" && ((
|
|
116
|
+
o.localName === "fieldset" && ((m = N.observe) === null || m === void 0 || m.call(N, o, G), j(o, !0));
|
|
116
117
|
}), n.forEach((o) => {
|
|
117
|
-
const
|
|
118
|
-
|
|
118
|
+
const m = u.get(o);
|
|
119
|
+
m && p.get(m) && J(m), F.has(o) && F.get(o).disconnect();
|
|
119
120
|
});
|
|
120
121
|
});
|
|
121
122
|
}
|
|
@@ -142,15 +143,15 @@ function Se() {
|
|
|
142
143
|
}, W = (t, e) => {
|
|
143
144
|
t.toggleAttribute("internals-disabled", e), e ? k(t, "aria-disabled", "true") : t.removeAttribute("aria-disabled"), t.formDisabledCallback && t.formDisabledCallback.apply(t, [e]);
|
|
144
145
|
}, J = (t) => {
|
|
145
|
-
|
|
146
|
+
p.get(t).forEach((i) => {
|
|
146
147
|
i.remove();
|
|
147
|
-
}),
|
|
148
|
+
}), p.set(t, []);
|
|
148
149
|
}, Q = (t, e) => {
|
|
149
150
|
const i = document.createElement("input");
|
|
150
|
-
return i.type = "hidden", i.name = t.getAttribute("name"), t.after(i),
|
|
151
|
+
return i.type = "hidden", i.name = t.getAttribute("name"), t.after(i), p.get(e).push(i), i;
|
|
151
152
|
}, ue = (t, e) => {
|
|
152
153
|
var i;
|
|
153
|
-
|
|
154
|
+
p.set(e, []), (i = N.observe) === null || i === void 0 || i.call(N, t, G);
|
|
154
155
|
}, X = (t, e) => {
|
|
155
156
|
if (e.length) {
|
|
156
157
|
Array.from(e).forEach((a) => a.addEventListener("click", t.click.bind(t)));
|
|
@@ -158,7 +159,7 @@ function Se() {
|
|
|
158
159
|
e[0].id || (i = `${e[0].htmlFor}_Label`, e[0].id = i), k(t, "aria-labelledby", i);
|
|
159
160
|
}
|
|
160
161
|
}, R = (t) => {
|
|
161
|
-
const e = Array.from(t.elements).filter((n) => !n.tagName.includes("-") && n.validity).map((n) => n.validity.valid), i =
|
|
162
|
+
const e = Array.from(t.elements).filter((n) => !n.tagName.includes("-") && n.validity).map((n) => n.validity.valid), i = b.get(t) || [], a = Array.from(i).filter((n) => n.isConnected).map((n) => u.get(n).validity.valid), r = [...e, ...a].includes(!1);
|
|
162
163
|
t.toggleAttribute("internals-invalid", r), t.toggleAttribute("internals-valid", !r);
|
|
163
164
|
}, fe = (t) => {
|
|
164
165
|
R(O(t.target));
|
|
@@ -168,25 +169,25 @@ function Se() {
|
|
|
168
169
|
const e = ["button[type=submit]", "input[type=submit]", "button:not([type])"].map((i) => `${i}:not([disabled])`).map((i) => `${i}:not([form])${t.id ? `,${i}[form='${t.id}']` : ""}`).join(",");
|
|
169
170
|
t.addEventListener("click", (i) => {
|
|
170
171
|
if (i.target.closest(e)) {
|
|
171
|
-
const r =
|
|
172
|
+
const r = b.get(t);
|
|
172
173
|
if (t.noValidate)
|
|
173
174
|
return;
|
|
174
|
-
r.size && Array.from(r).reverse().map((
|
|
175
|
+
r.size && Array.from(r).reverse().map((m) => u.get(m).reportValidity()).includes(!1) && i.preventDefault();
|
|
175
176
|
}
|
|
176
177
|
});
|
|
177
178
|
}, ye = (t) => {
|
|
178
|
-
const e =
|
|
179
|
+
const e = b.get(t.target);
|
|
179
180
|
e && e.size && e.forEach((i) => {
|
|
180
181
|
i.constructor.formAssociated && i.formResetCallback && i.formResetCallback.apply(i);
|
|
181
182
|
});
|
|
182
183
|
}, Y = (t, e, i) => {
|
|
183
184
|
if (e) {
|
|
184
|
-
const a =
|
|
185
|
+
const a = b.get(e);
|
|
185
186
|
if (a)
|
|
186
187
|
a.add(t);
|
|
187
188
|
else {
|
|
188
189
|
const r = /* @__PURE__ */ new Set();
|
|
189
|
-
r.add(t),
|
|
190
|
+
r.add(t), b.set(e, r), me(e), e.addEventListener("reset", ye), e.addEventListener("input", fe), e.addEventListener("change", pe);
|
|
190
191
|
}
|
|
191
192
|
V.set(e, { ref: t, internals: i }), t.constructor.formAssociated && t.formAssociatedCallback && setTimeout(() => {
|
|
192
193
|
t.formAssociatedCallback.apply(t, [e]);
|
|
@@ -195,11 +196,11 @@ function Se() {
|
|
|
195
196
|
}, O = (t) => {
|
|
196
197
|
let e = t.parentNode;
|
|
197
198
|
return e && e.tagName !== "FORM" && (e = O(e)), e;
|
|
198
|
-
},
|
|
199
|
+
}, w = (t, e, i = DOMException) => {
|
|
199
200
|
if (!t.constructor.formAssociated)
|
|
200
201
|
throw new i(e);
|
|
201
202
|
}, Z = (t, e, i) => {
|
|
202
|
-
const a =
|
|
203
|
+
const a = b.get(t);
|
|
203
204
|
return a && a.size && a.forEach((r) => {
|
|
204
205
|
u.get(r)[i]() || (e = !1);
|
|
205
206
|
}), e;
|
|
@@ -302,11 +303,11 @@ function Se() {
|
|
|
302
303
|
const { get: r } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
|
|
303
304
|
Object.defineProperty(HTMLFormElement.prototype, "elements", {
|
|
304
305
|
get(...n) {
|
|
305
|
-
const o = r.call(this, ...n),
|
|
306
|
-
if (
|
|
306
|
+
const o = r.call(this, ...n), m = Array.from(b.get(this) || []);
|
|
307
|
+
if (m.length === 0)
|
|
307
308
|
return o;
|
|
308
|
-
const
|
|
309
|
-
return new Me(
|
|
309
|
+
const f = Array.from(o).concat(m).sort((E, v) => E.compareDocumentPosition ? E.compareDocumentPosition(v) & 2 ? 1 : -1 : 0);
|
|
310
|
+
return new Me(f);
|
|
310
311
|
}
|
|
311
312
|
});
|
|
312
313
|
}
|
|
@@ -322,7 +323,7 @@ function Se() {
|
|
|
322
323
|
}
|
|
323
324
|
checkValidity() {
|
|
324
325
|
const e = s.get(this);
|
|
325
|
-
if (
|
|
326
|
+
if (w(e, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
|
|
326
327
|
return !0;
|
|
327
328
|
const i = h.get(this);
|
|
328
329
|
if (!i.valid) {
|
|
@@ -337,28 +338,28 @@ function Se() {
|
|
|
337
338
|
}
|
|
338
339
|
get form() {
|
|
339
340
|
const e = s.get(this);
|
|
340
|
-
|
|
341
|
+
w(e, "Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");
|
|
341
342
|
let i;
|
|
342
343
|
return e.constructor.formAssociated === !0 && (i = O(e)), i;
|
|
343
344
|
}
|
|
344
345
|
get labels() {
|
|
345
346
|
const e = s.get(this);
|
|
346
|
-
|
|
347
|
+
w(e, "Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");
|
|
347
348
|
const i = e.getAttribute("id"), a = e.getRootNode();
|
|
348
349
|
return a && i ? a.querySelectorAll(`[for="${i}"]`) : [];
|
|
349
350
|
}
|
|
350
351
|
reportValidity() {
|
|
351
352
|
const e = s.get(this);
|
|
352
|
-
if (
|
|
353
|
+
if (w(e, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
|
|
353
354
|
return !0;
|
|
354
|
-
const i = this.checkValidity(), a =
|
|
355
|
+
const i = this.checkValidity(), a = A.get(this);
|
|
355
356
|
if (a && !e.constructor.formAssociated)
|
|
356
357
|
throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");
|
|
357
358
|
return !i && a && (e.focus(), a.focus()), i;
|
|
358
359
|
}
|
|
359
360
|
setFormValue(e) {
|
|
360
361
|
const i = s.get(this);
|
|
361
|
-
if (
|
|
362
|
+
if (w(i, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), J(this), e != null && !(e instanceof FormData)) {
|
|
362
363
|
if (i.getAttribute("name")) {
|
|
363
364
|
const a = Q(i, this);
|
|
364
365
|
a.value = e;
|
|
@@ -373,35 +374,35 @@ function Se() {
|
|
|
373
374
|
}
|
|
374
375
|
setValidity(e, i, a) {
|
|
375
376
|
const r = s.get(this);
|
|
376
|
-
if (
|
|
377
|
+
if (w(r, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !e)
|
|
377
378
|
throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");
|
|
378
|
-
|
|
379
|
+
A.set(this, a);
|
|
379
380
|
const n = h.get(this), o = {};
|
|
380
|
-
for (const
|
|
381
|
-
o[
|
|
381
|
+
for (const E in e)
|
|
382
|
+
o[E] = e[E];
|
|
382
383
|
Object.keys(o).length === 0 && be(n);
|
|
383
|
-
const
|
|
384
|
-
delete
|
|
385
|
-
const { valid:
|
|
386
|
-
if (!
|
|
384
|
+
const m = Object.assign(Object.assign({}, n), o);
|
|
385
|
+
delete m.valid;
|
|
386
|
+
const { valid: f } = ve(n, m, this.form);
|
|
387
|
+
if (!f && !i)
|
|
387
388
|
throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");
|
|
388
|
-
|
|
389
|
+
y.set(this, f ? "" : i), r.isConnected ? (r.toggleAttribute("internals-invalid", !f), r.toggleAttribute("internals-valid", f), k(r, "aria-invalid", `${!f}`)) : I.set(r, this);
|
|
389
390
|
}
|
|
390
391
|
get shadowRoot() {
|
|
391
|
-
const e = s.get(this), i =
|
|
392
|
+
const e = s.get(this), i = S.get(e);
|
|
392
393
|
return i || null;
|
|
393
394
|
}
|
|
394
395
|
get validationMessage() {
|
|
395
396
|
const e = s.get(this);
|
|
396
|
-
return
|
|
397
|
+
return w(e, "Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."), y.get(this);
|
|
397
398
|
}
|
|
398
399
|
get validity() {
|
|
399
400
|
const e = s.get(this);
|
|
400
|
-
return
|
|
401
|
+
return w(e, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), h.get(this);
|
|
401
402
|
}
|
|
402
403
|
get willValidate() {
|
|
403
404
|
const e = s.get(this);
|
|
404
|
-
return
|
|
405
|
+
return w(e, "Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."), !(e.disabled || e.hasAttribute("disabled") || e.hasAttribute("readonly"));
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
408
|
function Ve() {
|
|
@@ -460,7 +461,7 @@ function Se() {
|
|
|
460
461
|
}), typeof Element < "u") {
|
|
461
462
|
let e = function(...a) {
|
|
462
463
|
const r = i.apply(this, a);
|
|
463
|
-
if (
|
|
464
|
+
if (S.set(this, r), D()) {
|
|
464
465
|
const n = new MutationObserver(P);
|
|
465
466
|
window.ShadyDOM ? n.observe(this, H) : n.observe(r, H), F.set(this, n);
|
|
466
467
|
}
|
|
@@ -472,53 +473,45 @@ function Se() {
|
|
|
472
473
|
D() && typeof document < "u" && new MutationObserver(P).observe(document.documentElement, H), typeof HTMLFormElement < "u" && ke(), (t || typeof window < "u" && !window.CustomStateSet) && q();
|
|
473
474
|
}
|
|
474
475
|
}
|
|
475
|
-
return !!customElements.polyfillWrapFlushCallback || (Ve() ? typeof window < "u" && !window.CustomStateSet && q(HTMLElement.prototype.attachInternals) : ne(!1)),
|
|
476
|
+
return !!customElements.polyfillWrapFlushCallback || (Ve() ? typeof window < "u" && !window.CustomStateSet && q(HTMLElement.prototype.attachInternals) : ne(!1)), M.forceCustomStateSetPolyfill = q, M.forceElementInternalsPolyfill = ne, Object.defineProperty(M, "__esModule", { value: !0 }), M;
|
|
476
477
|
})({});
|
|
477
478
|
})()), oe;
|
|
478
479
|
}
|
|
479
|
-
|
|
480
|
-
var
|
|
481
|
-
for (var u = void 0,
|
|
482
|
-
(V =
|
|
483
|
-
return u &&
|
|
484
|
-
};
|
|
485
|
-
const Ie = {
|
|
486
|
-
fromAttribute(f) {
|
|
487
|
-
return f == null ? !1 : f === "" || f === "true" || f === !0 ? !0 : f === "false" || f === !1 ? !1 : !!f;
|
|
488
|
-
},
|
|
489
|
-
toAttribute(f) {
|
|
490
|
-
return f ? "true" : "false";
|
|
491
|
-
}
|
|
480
|
+
xe();
|
|
481
|
+
var Ie = Object.defineProperty, l = (M, s, h, p) => {
|
|
482
|
+
for (var u = void 0, y = M.length - 1, V; y >= 0; y--)
|
|
483
|
+
(V = M[y]) && (u = V(s, h, u) || u);
|
|
484
|
+
return u && Ie(s, h, u), u;
|
|
492
485
|
};
|
|
493
486
|
class c extends Ce {
|
|
494
487
|
constructor() {
|
|
495
|
-
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.step = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = Te(), 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 = Ae.props.helptextDropdownButton.default, this.label = null, this.optionalText =
|
|
488
|
+
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.step = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = Te(), 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 = Ae.props.helptextDropdownButton.default, this.label = null, this.optionalText = g.forms.labels.optional, this.requiredText = g.forms.labels.required, this.tagText = null, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
|
|
496
489
|
}
|
|
497
490
|
static get formAssociated() {
|
|
498
491
|
return !0;
|
|
499
492
|
}
|
|
500
493
|
manageValidity(s) {
|
|
501
|
-
var h,
|
|
502
|
-
s && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 },
|
|
494
|
+
var h, p, u, y, V, F, b, T, C, S, A;
|
|
495
|
+
s && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, g.forms.messages.required, s) : (h = s.validity) != null && h.typeMismatch || (p = s.validity) != null && p.badInput ? this.internals.setValidity({ typeMismatch: !0 }, g.forms.messages.invalid, s) : (u = s.validity) != null && u.patternMismatch ? this.internals.setValidity(
|
|
503
496
|
{ patternMismatch: !0 },
|
|
504
|
-
|
|
497
|
+
g.forms.messages.invalidPattern,
|
|
505
498
|
s
|
|
506
|
-
) : (
|
|
499
|
+
) : (y = s.validity) != null && y.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, g.forms.messages.tooShort, s) : (V = s.validity) != null && V.tooLong || this.maxlength && this.maxlength > 0 && this.value.length > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, g.forms.messages.tooLong, s) : (F = s.validity) != null && F.rangeUnderflow ? this.internals.setValidity(
|
|
507
500
|
{ rangeUnderflow: !0 },
|
|
508
|
-
this.min ?
|
|
501
|
+
this.min ? g.forms.messages.rangeUnderflowMin.replace("{min}", (b = this.min) == null ? void 0 : b.toString()) : g.forms.messages.rangeUnderflow,
|
|
509
502
|
s
|
|
510
|
-
) : (T = s.validity) != null && T.stepMismatch ? this.internals.setValidity({ stepMismatch: !0 },
|
|
503
|
+
) : (T = s.validity) != null && T.stepMismatch ? this.internals.setValidity({ stepMismatch: !0 }, g.forms.messages.invalid, s) : (C = s.validity) != null && C.rangeOverflow ? this.internals.setValidity(
|
|
511
504
|
{ rangeOverflow: !0 },
|
|
512
|
-
this.max ?
|
|
505
|
+
this.max ? g.forms.messages.rangeOverflowMax.replace("{max}", (S = this.max) == null ? void 0 : S.toString()) : g.forms.messages.rangeOverflow,
|
|
513
506
|
s
|
|
514
|
-
) : (
|
|
507
|
+
) : (A = s.validity) != null && A.customError ? this.internals.setValidity({ customError: !0 }, s.validationMessage, s) : this.internals.setValidity({}));
|
|
515
508
|
}
|
|
516
509
|
setFormValue(s) {
|
|
517
510
|
if (this.internals)
|
|
518
511
|
if (Array.isArray(s)) {
|
|
519
512
|
const h = new FormData();
|
|
520
|
-
s.forEach((
|
|
521
|
-
h.append(this.name,
|
|
513
|
+
s.forEach((p) => {
|
|
514
|
+
h.append(this.name, p);
|
|
522
515
|
}), this.internals.setFormValue(h);
|
|
523
516
|
} else
|
|
524
517
|
this.internals.setFormValue(s);
|
|
@@ -527,13 +520,13 @@ class c extends Ce {
|
|
|
527
520
|
// Do not use valueChanged or onChange for radios and checkboxes!
|
|
528
521
|
valueChecked(s) {
|
|
529
522
|
if (!this.touched) return;
|
|
530
|
-
const h = this.internals.form || this.closest("form"),
|
|
523
|
+
const h = this.internals.form || this.closest("form"), p = h ? new FormData(h) : null;
|
|
531
524
|
h && h.querySelectorAll(
|
|
532
525
|
`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`
|
|
533
526
|
).forEach((u) => {
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
}), typeof s == "string" ? (this.checked = s === "true", this.internals.ariaChecked = s === "true") : typeof s == "boolean" && (this.checked = s, this.internals.ariaChecked = s), this.checked ? (this.internals.setFormValue(this.value || "on", this.value || "on"),
|
|
527
|
+
const y = u;
|
|
528
|
+
y.name === this.name && y.value !== this.value && y.checked && (y.checked = !1);
|
|
529
|
+
}), typeof s == "string" ? (this.checked = s === "true", this.internals.ariaChecked = s === "true") : typeof s == "boolean" && (this.checked = s, this.internals.ariaChecked = s), this.checked ? (this.internals.setFormValue(this.value || "on", this.value || "on"), p && p.append(this.name, this.value || "on"), this.internals.states.add("--checked")) : (this.internals.setFormValue(null, null), p && p.delete(this.name), this.internals.states.delete("--checked")), this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), this.dispatchEvent(
|
|
537
530
|
new CustomEvent("value-change", {
|
|
538
531
|
detail: this.checked,
|
|
539
532
|
bubbles: !0,
|
|
@@ -672,7 +665,7 @@ l([
|
|
|
672
665
|
d({ type: Boolean })
|
|
673
666
|
], c.prototype, "skipForwardTestid");
|
|
674
667
|
l([
|
|
675
|
-
d({ type: Boolean, reflect: !0, converter:
|
|
668
|
+
d({ type: Boolean, reflect: !0, converter: Se })
|
|
676
669
|
], c.prototype, "useWrapper");
|
|
677
670
|
l([
|
|
678
671
|
d({ type: Boolean, reflect: !0 })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("./element-CJ_QKaki.cjs"),Ve=require("./state-DSjcvzDN.cjs"),Ce=require("./utils-byXsEz1u.cjs"),Fe=require("./booleanish-BKVonob4.cjs"),Te=require("./input-wrapper-EoSAbU-U.cjs");var ne={},oe;function Se(){return oe||(oe=1,(function(){(function(E){const s=new WeakMap,h=new WeakMap,p=new WeakMap,u=new WeakMap,y=new WeakMap,k=new WeakMap,C=new WeakMap,g=new WeakMap,F=new WeakMap,V=new WeakMap,T=new WeakMap,S=new WeakMap,$=new WeakMap,U=new WeakMap,x=new WeakMap,I={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},le=(t,e)=>{for(let i in I){e[i]=null;let a=null;const n=I[i];Object.defineProperty(e,i,{get(){return a},set(o){a=o,t.isConnected?M(t,n,o):V.set(t,e)}})}};function z(t){const e=u.get(t),{form:i}=e;X(t,i,e),Q(t,e.labels)}const K=(t,e=!1)=>{const i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(o){return u.has(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a=i.nextNode();const n=!e||t.disabled;for(;a;)a.formDisabledCallback&&n&&W(a,t.disabled),a=i.nextNode()},j={attributes:!0,attributeFilter:["disabled","name"]},L=O()?new MutationObserver(t=>{for(const e of t){const i=e.target;if(e.attributeName==="disabled"&&(i.constructor.formAssociated?W(i,i.hasAttribute("disabled")):i.localName==="fieldset"&&K(i)),e.attributeName==="name"&&i.constructor.formAssociated){const a=u.get(i),n=F.get(i);a.setFormValue(n)}}}):{};function D(t){t.forEach(e=>{const{addedNodes:i,removedNodes:a}=e,n=Array.from(i),o=Array.from(a);n.forEach(l=>{var m;if(u.has(l)&&l.constructor.formAssociated&&z(l),V.has(l)){const f=V.get(l);Object.keys(I).filter(b=>f[b]!==null).forEach(b=>{M(l,I[b],f[b])}),V.delete(l)}if(x.has(l)){const f=x.get(l);M(l,"internals-valid",f.validity.valid.toString()),M(l,"internals-invalid",(!f.validity.valid).toString()),M(l,"aria-invalid",(!f.validity.valid).toString()),x.delete(l)}if(l.localName==="form"){const f=g.get(l),w=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT,{acceptNode(_){return u.has(_)&&_.constructor.formAssociated&&!(f&&f.has(_))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let b=w.nextNode();for(;b;)z(b),b=w.nextNode()}l.localName==="fieldset"&&((m=L.observe)===null||m===void 0||m.call(L,l,j),K(l,!0))}),o.forEach(l=>{const m=u.get(l);m&&p.get(m)&&G(m),C.has(l)&&C.get(l).disconnect()})})}function ce(t){t.forEach(e=>{const{removedNodes:i}=e;i.forEach(a=>{const n=$.get(e.target);u.has(a)&&Z(a),n.disconnect()})})}const de=t=>{var e,i;const a=new MutationObserver(ce);!((e=window==null?void 0:window.ShadyDOM)===null||e===void 0)&&e.inUse&&t.mode&&t.host&&(t=t.host),(i=a.observe)===null||i===void 0||i.call(a,t,{childList:!0}),$.set(t,a)};O()&&new MutationObserver(D);const P={childList:!0,subtree:!0},M=(t,e,i)=>{t.getAttribute(e)!==i&&t.setAttribute(e,i)},W=(t,e)=>{t.toggleAttribute("internals-disabled",e),e?M(t,"aria-disabled","true"):t.removeAttribute("aria-disabled"),t.formDisabledCallback&&t.formDisabledCallback.apply(t,[e])},G=t=>{p.get(t).forEach(i=>{i.remove()}),p.set(t,[])},J=(t,e)=>{const i=document.createElement("input");return i.type="hidden",i.name=t.getAttribute("name"),t.after(i),p.get(e).push(i),i},he=(t,e)=>{var i;p.set(e,[]),(i=L.observe)===null||i===void 0||i.call(L,t,j)},Q=(t,e)=>{if(e.length){Array.from(e).forEach(a=>a.addEventListener("click",t.click.bind(t)));let i=e[0].id;e[0].id||(i=`${e[0].htmlFor}_Label`,e[0].id=i),M(t,"aria-labelledby",i)}},N=t=>{const e=Array.from(t.elements).filter(o=>!o.tagName.includes("-")&&o.validity).map(o=>o.validity.valid),i=g.get(t)||[],a=Array.from(i).filter(o=>o.isConnected).map(o=>u.get(o).validity.valid),n=[...e,...a].includes(!1);t.toggleAttribute("internals-invalid",n),t.toggleAttribute("internals-valid",!n)},ue=t=>{N(R(t.target))},fe=t=>{N(R(t.target))},pe=t=>{const e=["button[type=submit]","input[type=submit]","button:not([type])"].map(i=>`${i}:not([disabled])`).map(i=>`${i}:not([form])${t.id?`,${i}[form='${t.id}']`:""}`).join(",");t.addEventListener("click",i=>{if(i.target.closest(e)){const n=g.get(t);if(t.noValidate)return;n.size&&Array.from(n).reverse().map(m=>u.get(m).reportValidity()).includes(!1)&&i.preventDefault()}})},me=t=>{const e=g.get(t.target);e&&e.size&&e.forEach(i=>{i.constructor.formAssociated&&i.formResetCallback&&i.formResetCallback.apply(i)})},X=(t,e,i)=>{if(e){const a=g.get(e);if(a)a.add(t);else{const n=new Set;n.add(t),g.set(e,n),pe(e),e.addEventListener("reset",me),e.addEventListener("input",ue),e.addEventListener("change",fe)}k.set(e,{ref:t,internals:i}),t.constructor.formAssociated&&t.formAssociatedCallback&&setTimeout(()=>{t.formAssociatedCallback.apply(t,[e])},0),N(e)}},R=t=>{let e=t.parentNode;return e&&e.tagName!=="FORM"&&(e=R(e)),e},v=(t,e,i=DOMException)=>{if(!t.constructor.formAssociated)throw new i(e)},Y=(t,e,i)=>{const a=g.get(t);return a&&a.size&&a.forEach(n=>{u.get(n)[i]()||(e=!1)}),e},Z=t=>{if(t.constructor.formAssociated){const e=u.get(t),{labels:i,form:a}=e;Q(t,i),X(t,a,e)}};function O(){return typeof MutationObserver<"u"}class ye{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const ge=t=>(t.badInput=!1,t.customError=!1,t.patternMismatch=!1,t.rangeOverflow=!1,t.rangeUnderflow=!1,t.stepMismatch=!1,t.tooLong=!1,t.tooShort=!1,t.typeMismatch=!1,t.valid=!0,t.valueMissing=!1,t),be=(t,e,i)=>(t.valid=ve(e),Object.keys(e).forEach(a=>t[a]=e[a]),i&&N(i),t),ve=t=>{let e=!0;for(let i in t)i!=="valid"&&t[i]!==!1&&(e=!1);return e},q=new WeakMap;function ee(t,e){t.toggleAttribute(e,!0),t.part&&t.part.add(e)}class H extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");q.set(this,e)}add(e){if(!/^--/.test(e)||typeof e!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);const i=super.add(e),a=q.get(this),n=`state${e}`;return a.isConnected?ee(a,n):setTimeout(()=>{ee(a,n)}),i}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){const i=super.delete(e),a=q.get(this);return a.isConnected?(a.toggleAttribute(`state${e}`,!1),a.part&&a.part.remove(`state${e}`)):setTimeout(()=>{a.toggleAttribute(`state${e}`,!1),a.part&&a.part.remove(`state${e}`)}),i}}function te(t,e,i,a){if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(t):a?a.value:e.get(t)}function we(t,e,i,a,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var A;class Ee{constructor(e){A.set(this,void 0),we(this,A,e);for(let i=0;i<e.length;i++){let a=e[i];this[i]=a,a.hasAttribute("name")&&(this[a.getAttribute("name")]=a)}Object.freeze(this)}get length(){return te(this,A,"f").length}[(A=new WeakMap,Symbol.iterator)](){return te(this,A,"f")[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}}function Me(){const t=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=i;const e=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=a;function i(...o){let l=t.apply(this,o);return Y(this,l,"checkValidity")}function a(...o){let l=e.apply(this,o);return Y(this,l,"reportValidity")}const{get:n}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...o){const l=n.call(this,...o),m=Array.from(g.get(this)||[]);if(m.length===0)return l;const f=Array.from(l).concat(m).sort((w,b)=>w.compareDocumentPosition?w.compareDocumentPosition(b)&2?1:-1:0);return new Ee(f)}})}class ie{static get isPolyfilled(){return!0}constructor(e){if(!e||!e.tagName||e.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const i=e.getRootNode(),a=new ye;this.states=new H(e),s.set(this,e),h.set(this,a),u.set(e,this),le(e,this),he(e,this),Object.seal(this),i instanceof DocumentFragment&&de(i)}checkValidity(){const e=s.get(this);if(v(e,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=h.get(this);if(!i.valid){const a=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});e.dispatchEvent(a)}return i.valid}get form(){const e=s.get(this);v(e,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let i;return e.constructor.formAssociated===!0&&(i=R(e)),i}get labels(){const e=s.get(this);v(e,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const i=e.getAttribute("id"),a=e.getRootNode();return a&&i?a.querySelectorAll(`[for="${i}"]`):[]}reportValidity(){const e=s.get(this);if(v(e,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=this.checkValidity(),a=S.get(this);if(a&&!e.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!i&&a&&(e.focus(),a.focus()),i}setFormValue(e){const i=s.get(this);if(v(i,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),G(this),e!=null&&!(e instanceof FormData)){if(i.getAttribute("name")){const a=J(i,this);a.value=e}}else e!=null&&e instanceof FormData&&Array.from(e).reverse().forEach(([a,n])=>{if(typeof n=="string"){const o=J(i,this);o.name=a,o.value=n}});F.set(i,e)}setValidity(e,i,a){const n=s.get(this);if(v(n,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!e)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");S.set(this,a);const o=h.get(this),l={};for(const w in e)l[w]=e[w];Object.keys(l).length===0&&ge(o);const m=Object.assign(Object.assign({},o),l);delete m.valid;const{valid:f}=be(o,m,this.form);if(!f&&!i)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");y.set(this,f?"":i),n.isConnected?(n.toggleAttribute("internals-invalid",!f),n.toggleAttribute("internals-valid",f),M(n,"aria-invalid",`${!f}`)):x.set(n,this)}get shadowRoot(){const e=s.get(this),i=T.get(e);return i||null}get validationMessage(){const e=s.get(this);return v(e,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),y.get(this)}get validity(){const e=s.get(this);return v(e,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),h.get(this)}get willValidate(){const e=s.get(this);return v(e,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(e.disabled||e.hasAttribute("disabled")||e.hasAttribute("readonly"))}}function ke(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class t extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const e=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(e,t);const i=new t;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(a=>a in i.internals)}let ae=!1,se=!1;function B(t){se||(se=!0,window.CustomStateSet=H,t&&(HTMLElement.prototype.attachInternals=function(...e){const i=t.call(this,e);return i.states=new H(this),i}))}function re(t=!0){if(!ae){if(ae=!0,typeof window<"u"&&(window.ElementInternals=ie),typeof CustomElementRegistry<"u"){const e=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(i,a,n){if(a.formAssociated){const o=a.prototype.connectedCallback;a.prototype.connectedCallback=function(){U.has(this)||(U.set(this,!0),this.hasAttribute("disabled")&&W(this,!0)),o!=null&&o.apply(this),Z(this)}}e.call(this,i,a,n)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(u.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new ie(this)}),typeof Element<"u"){let e=function(...a){const n=i.apply(this,a);if(T.set(this,n),O()){const o=new MutationObserver(D);window.ShadyDOM?o.observe(this,P):o.observe(n,P),C.set(this,o)}return n};const i=Element.prototype.attachShadow;Element.prototype.attachShadow=e}O()&&typeof document<"u"&&new MutationObserver(D).observe(document.documentElement,P),typeof HTMLFormElement<"u"&&Me(),(t||typeof window<"u"&&!window.CustomStateSet)&&B()}}return!!customElements.polyfillWrapFlushCallback||(ke()?typeof window<"u"&&!window.CustomStateSet&&B(HTMLElement.prototype.attachInternals):re(!1)),E.forceCustomStateSetPolyfill=B,E.forceElementInternalsPolyfill=re,Object.defineProperty(E,"__esModule",{value:!0}),E})({})})()),ne}Se();var Ae=Object.defineProperty,d=(E,s,h,p)=>{for(var u=void 0,y=E.length-1,k;y>=0;y--)(k=E[y])&&(u=k(s,h,u)||u);return u&&Ae(s,h,u),u};class c extends r.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.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=Ce.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=Te.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=r.translations.forms.labels.optional,this.requiredText=r.translations.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(s){var h,p,u,y,k,C,g,F,V,T,S;s&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},r.translations.forms.messages.required,s):(h=s.validity)!=null&&h.typeMismatch||(p=s.validity)!=null&&p.badInput?this.internals.setValidity({typeMismatch:!0},r.translations.forms.messages.invalid,s):(u=s.validity)!=null&&u.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.translations.forms.messages.invalidPattern,s):(y=s.validity)!=null&&y.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},r.translations.forms.messages.tooShort,s):(k=s.validity)!=null&&k.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},r.translations.forms.messages.tooLong,s):(C=s.validity)!=null&&C.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?r.translations.forms.messages.rangeUnderflowMin.replace("{min}",(g=this.min)==null?void 0:g.toString()):r.translations.forms.messages.rangeUnderflow,s):(F=s.validity)!=null&&F.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.translations.forms.messages.invalid,s):(V=s.validity)!=null&&V.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?r.translations.forms.messages.rangeOverflowMax.replace("{max}",(T=this.max)==null?void 0:T.toString()):r.translations.forms.messages.rangeOverflow,s):(S=s.validity)!=null&&S.customError?this.internals.setValidity({customError:!0},s.validationMessage,s):this.internals.setValidity({}))}setFormValue(s){if(this.internals)if(Array.isArray(s)){const h=new FormData;s.forEach(p=>{h.append(this.name,p)}),this.internals.setFormValue(h)}else this.internals.setFormValue(s)}valueChecked(s){if(!this.touched)return;const h=this.internals.form||this.closest("form"),p=h?new FormData(h):null;h&&h.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(u=>{const y=u;y.name===this.name&&y.value!==this.value&&y.checked&&(y.checked=!1)}),typeof s=="string"?(this.checked=s==="true",this.internals.ariaChecked=s==="true"):typeof s=="boolean"&&(this.checked=s,this.internals.ariaChecked=s),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),p&&p.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),p&&p.delete(this.name),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(s,h){(h!==this.value||h!==this._value)&&(typeof s=="string"?((this.multiple||this.range)&&s.includes(",")&&(s=s.split(",")),this.value=s,this._value=Array.isArray(s)?s:[s]):Array.isArray(s)?(this.value=this.multiple||this.range?s:s[0],this._value=s):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&h&&h.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(h==null?void 0:h.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const s=this.multiple||this.range?[]:"";this.value=s,this.internals.setFormValue(s),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}onChange(s){if(!this.touched){this.touched=!0,s&&this.setFormValue(s);return}typeof s!="string"&&!Array.isArray(s)||((this.range||this.multiple)&&!Array.isArray(s)&&s.includes(",")&&(s=s.split(",")),!this.multiple&&!this.range&&Array.isArray(s)&&(s=s[0]),this.setFormValue(s),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0})))}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(s=>{"selected"in s&&(s.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(s){super.updated(s),s.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(s){if(super.firstUpdated(s),!this.form){const h=this.internals.form||this.closest("form");this.form=h}if(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 h=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=h,this.internals.setFormValue(h?this.value||"on":"",h?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))}}d([r.n()],c.prototype,"defaultValue");d([r.n({type:Boolean,reflect:!0})],c.prototype,"disabled");d([r.n({type:Boolean,reflect:!0})],c.prototype,"readonly");d([r.n({type:Boolean,reflect:!0})],c.prototype,"required");d([r.n({type:Number,reflect:!0})],c.prototype,"max");d([r.n({type:Number,reflect:!0})],c.prototype,"maxlength");d([r.n({type:Number,reflect:!0})],c.prototype,"min");d([r.n({type:Number,reflect:!0})],c.prototype,"minlength");d([r.n({type:Number,reflect:!0})],c.prototype,"step");d([r.n({type:String})],c.prototype,"ariaDescribedBy");d([r.n({type:String})],c.prototype,"ariaLabelledby");d([r.n({type:String,reflect:!0})],c.prototype,"name");d([r.n({type:String,reflect:!0})],c.prototype,"pattern");d([r.n({type:String,reflect:!0})],c.prototype,"placeholder");d([r.n({type:String,reflect:!0})],c.prototype,"id");d([r.n({type:Boolean})],c.prototype,"counter");d([r.n({type:Boolean})],c.prototype,"hasError");d([r.n({type:Boolean})],c.prototype,"inline");d([r.n({type:Boolean})],c.prototype,"hasFieldset");d([r.n({type:Boolean})],c.prototype,"optionalTag");d([r.n({type:Boolean})],c.prototype,"requiredTag");d([r.n({type:Boolean})],c.prototype,"skipForwardTestid");d([r.n({type:Boolean,reflect:!0,converter:Fe.booleanishConverter})],c.prototype,"useWrapper");d([r.n({type:Boolean,reflect:!0})],c.prototype,"fullwidth");d([r.n({type:Number})],c.prototype,"counterMaxLength");d([r.n({type:String})],c.prototype,"errorMessage");d([r.n({type:String})],c.prototype,"helptext");d([r.n({type:String})],c.prototype,"helptextDropdown");d([r.n({type:String,reflect:!1})],c.prototype,"helptextDropdownButton");d([r.n({type:String})],c.prototype,"label");d([r.n({type:String,reflect:!1})],c.prototype,"optionalText");d([r.n({type:String,reflect:!1})],c.prototype,"requiredText");d([r.n({type:String,reflect:!1})],c.prototype,"tagText");d([r.n({type:String,attribute:"data-testid"})],c.prototype,"dataTestid");d([Ve.r()],c.prototype,"touched");exports.PktInputElement=c;
|
|
@@ -1,104 +1,97 @@
|
|
|
1
|
-
import { P as x, E as
|
|
1
|
+
import { P as x, E as s, x as o, n as r, a as m } from "./element-CRDRygXu.js";
|
|
2
2
|
import { P as k } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
3
|
-
import { e as
|
|
3
|
+
import { e as g, n as y } from "./ref-Xa5dbh--.js";
|
|
4
4
|
import { o as w } from "./if-defined-BWZGb3bh.js";
|
|
5
|
-
import { o as
|
|
6
|
-
import { e as
|
|
7
|
-
import { u as
|
|
8
|
-
import {
|
|
5
|
+
import { o as v } from "./icon-BB7e5iQN.js";
|
|
6
|
+
import { e as T } from "./class-map-wy7PUk0P.js";
|
|
7
|
+
import { u as E } from "./utils-DznhwRXm.js";
|
|
8
|
+
import { b as S } from "./booleanish-C9R0tdXH.js";
|
|
9
|
+
import { s as p } from "./input-wrapper-CDgenrYA.js";
|
|
9
10
|
import "./helptext-Bn17Picx.js";
|
|
10
11
|
import "./alert-UFQFbbzZ.js";
|
|
11
|
-
var
|
|
12
|
-
for (var
|
|
13
|
-
(u =
|
|
14
|
-
return h &&
|
|
15
|
-
};
|
|
16
|
-
const _ = {
|
|
17
|
-
fromAttribute(o) {
|
|
18
|
-
return o == null ? !1 : o === "" || o === "true" || o === !0 ? !0 : o === "false" || o === !1 ? !1 : !!o;
|
|
19
|
-
},
|
|
20
|
-
toAttribute(o) {
|
|
21
|
-
return o ? "true" : "false";
|
|
22
|
-
}
|
|
12
|
+
var D = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, e = (l, a, n, h) => {
|
|
13
|
+
for (var i = h > 1 ? void 0 : h ? _(a, n) : a, d = l.length - 1, u; d >= 0; d--)
|
|
14
|
+
(u = l[d]) && (i = (h ? u(a, n, i) : u(i)) || i);
|
|
15
|
+
return h && i && D(a, n, i), i;
|
|
23
16
|
};
|
|
24
17
|
let t = class extends x {
|
|
25
18
|
constructor() {
|
|
26
|
-
super(), this.defaultSlot =
|
|
19
|
+
super(), this.defaultSlot = g(), this.helptextSlot = g(), this.forId = E(), this.label = "", this.helptext = null, this.helptextDropdown = null, this.helptextDropdownButton = null, this.counter = p.props.counter.default, this.counterCurrent = 0, this.counterMaxLength = 0, this.counterError = null, this.counterPosition = "bottom", this.optionalTag = p.props.optionalTag.default, this.optionalText = p.props.optionalText.default, this.requiredTag = p.props.requiredTag.default, this.requiredText = p.props.requiredText.default, this.tagText = null, this.hasError = p.props.hasError.default, this.errorMessage = "", this.disabled = p.props.disabled.default, this.inline = p.props.inline.default, this.ariaDescribedby = void 0, this.hasFieldset = p.props.hasFieldset.default, this.role = "group", this.useWrapper = p.props.useWrapper.default, this.slotController = new k(this, this.defaultSlot, this.helptextSlot);
|
|
27
20
|
}
|
|
28
|
-
updated(
|
|
29
|
-
super.updated(
|
|
21
|
+
updated(l) {
|
|
22
|
+
super.updated(l);
|
|
30
23
|
}
|
|
31
24
|
render() {
|
|
32
|
-
const
|
|
25
|
+
const l = {
|
|
33
26
|
"pkt-inputwrapper": !0,
|
|
34
27
|
"pkt-inputwrapper--error": this.hasError,
|
|
35
28
|
"pkt-inputwrapper--disabled": this.disabled,
|
|
36
29
|
"pkt-inputwrapper--inline": this.inline
|
|
37
|
-
}, a = "pkt-tag pkt-tag--small pkt-tag--thin-text", n = this.ariaDescribedby ? this.ariaDescribedby : this.helptext ? `${this.forId}-helptext` :
|
|
38
|
-
${this.tagText ?
|
|
39
|
-
${this.optionalTag ?
|
|
40
|
-
${this.requiredTag ?
|
|
41
|
-
`,
|
|
30
|
+
}, a = "pkt-tag pkt-tag--small pkt-tag--thin-text", n = this.ariaDescribedby ? this.ariaDescribedby : this.helptext ? `${this.forId}-helptext` : s, h = () => o`
|
|
31
|
+
${this.tagText ? o`<span class=${a + " pkt-tag--gray"}>${this.tagText}</span>` : s}
|
|
32
|
+
${this.optionalTag ? o`<span class=${a + " pkt-tag--blue-light"}>${this.optionalText}</span>` : s}
|
|
33
|
+
${this.requiredTag ? o`<span class=${a + " pkt-tag--beige"}>${this.requiredText}</span>` : s}
|
|
34
|
+
`, i = () => this.useWrapper ? this.hasFieldset ? o`<legend
|
|
42
35
|
class="pkt-inputwrapper__legend"
|
|
43
36
|
id="${this.forId}-label"
|
|
44
37
|
@click=${this.handleLabelClick}
|
|
45
38
|
>
|
|
46
39
|
${this.label} ${h()}
|
|
47
|
-
</legend>` :
|
|
40
|
+
</legend>` : o`<label
|
|
48
41
|
class="pkt-inputwrapper__label"
|
|
49
42
|
for="${this.forId}"
|
|
50
43
|
aria-describedby="${n}"
|
|
51
44
|
id="${this.forId}-label"
|
|
52
45
|
@click=${this.handleLabelClick}
|
|
53
46
|
>${this.label}${h()}</label
|
|
54
|
-
>` :
|
|
47
|
+
>` : o`<label
|
|
55
48
|
for="${this.forId}"
|
|
56
49
|
class="pkt-sr-only"
|
|
57
50
|
aria-describedby="${n}"
|
|
58
51
|
id="${this.forId}-label"
|
|
59
52
|
>
|
|
60
53
|
${this.label}
|
|
61
|
-
</label>`, d = () =>
|
|
54
|
+
</label>`, d = () => o`
|
|
62
55
|
<pkt-helptext
|
|
63
56
|
class="${w(this.useWrapper ? void 0 : "pkt-hide")}"
|
|
64
57
|
.forId=${this.forId}
|
|
65
58
|
.helptext=${this.helptext}
|
|
66
59
|
.helptextDropdown=${this.helptextDropdown}
|
|
67
|
-
.helptextDropdownButton=${this.helptextDropdownButton ||
|
|
60
|
+
.helptextDropdownButton=${this.helptextDropdownButton || p.props.helptextDropdownButton.default}
|
|
68
61
|
@toggleHelpText=${($) => {
|
|
69
62
|
this.toggleDropdown($);
|
|
70
63
|
}}
|
|
71
|
-
${
|
|
64
|
+
${y(this.helptextSlot)}
|
|
72
65
|
name="helptext"
|
|
73
66
|
></pkt-helptext>
|
|
74
|
-
`, u = () => this.counter ?
|
|
75
|
-
${this.counterError ? this.counterError :
|
|
76
|
-
${this.counterMaxLength ? `/${this.counterMaxLength}` :
|
|
77
|
-
</div>` :
|
|
67
|
+
`, u = () => this.counter ? o`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
68
|
+
${this.counterError ? this.counterError : s} ${this.counterCurrent || 0}
|
|
69
|
+
${this.counterMaxLength ? `/${this.counterMaxLength}` : s}
|
|
70
|
+
</div>` : s, b = () => this.hasError && this.errorMessage ? o`<pkt-alert
|
|
78
71
|
skin="error"
|
|
79
72
|
compact
|
|
80
73
|
id=${`${this.forId}-error`}
|
|
81
74
|
aria-live="assertive"
|
|
82
75
|
aria-atomic="true"
|
|
83
76
|
>
|
|
84
|
-
${
|
|
85
|
-
</pkt-alert>` :
|
|
86
|
-
${
|
|
77
|
+
${v(this.errorMessage)}
|
|
78
|
+
</pkt-alert>` : s, c = () => o`
|
|
79
|
+
${i()}
|
|
87
80
|
${d()}
|
|
88
|
-
${this.counterPosition === "top" ? u() :
|
|
89
|
-
<div class="pkt-contents" ${
|
|
90
|
-
${this.counterPosition === "bottom" ? u() :
|
|
91
|
-
${
|
|
92
|
-
`,
|
|
81
|
+
${this.counterPosition === "top" ? u() : s}
|
|
82
|
+
<div class="pkt-contents" ${y(this.defaultSlot)}></div>
|
|
83
|
+
${this.counterPosition === "bottom" ? u() : s}
|
|
84
|
+
${b()}
|
|
85
|
+
`, f = () => this.hasFieldset ? o`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${n}">
|
|
93
86
|
${c()}
|
|
94
|
-
</fieldset>` :
|
|
95
|
-
return
|
|
87
|
+
</fieldset>` : o`<div class="pkt-inputwrapper__fieldset">${c()}</div>`;
|
|
88
|
+
return o`<div class=${T(l)}>${f()}</div> `;
|
|
96
89
|
}
|
|
97
|
-
toggleDropdown(
|
|
90
|
+
toggleDropdown(l) {
|
|
98
91
|
this.dispatchEvent(
|
|
99
92
|
new CustomEvent("toggleHelpText", {
|
|
100
93
|
bubbles: !1,
|
|
101
|
-
detail: { isOpen:
|
|
94
|
+
detail: { isOpen: l.detail.isOpen }
|
|
102
95
|
})
|
|
103
96
|
);
|
|
104
97
|
}
|
|
@@ -179,7 +172,7 @@ e([
|
|
|
179
172
|
r({ type: String, reflect: !0 })
|
|
180
173
|
], t.prototype, "role", 2);
|
|
181
174
|
e([
|
|
182
|
-
r({ type: Boolean, reflect: !0, converter:
|
|
175
|
+
r({ type: Boolean, reflect: !0, converter: S })
|
|
183
176
|
], t.prototype, "useWrapper", 2);
|
|
184
177
|
t = e([
|
|
185
178
|
m("pkt-input-wrapper")
|