@oslokommune/punkt-elements 13.6.12 → 13.7.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.
Files changed (147) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/{accordionitem-B_h5XGCo.js → accordionitem-C_URrDjP.js} +4 -4
  3. package/dist/{accordionitem-BOmnm80g.cjs → accordionitem-DCZrHVNR.cjs} +1 -1
  4. package/dist/{alert-ZP5-fqlt.cjs → alert-Ci7WvRXi.cjs} +1 -1
  5. package/dist/{alert-CTTm6ugp.js → alert-Dh1YhaBq.js} +13 -26
  6. package/dist/{backlink-BT7DO6rV.cjs → backlink-BzEvli8m.cjs} +1 -1
  7. package/dist/{backlink-Bq8O2bt8.js → backlink-CI_jMGzZ.js} +3 -3
  8. package/dist/{button-x6Xw-5w0.js → button-CCFAUJa0.js} +5 -5
  9. package/dist/{button-BfqxLnMT.cjs → button-CXJQ_Wgl.cjs} +1 -1
  10. package/dist/calendar-BaMrdMDZ.cjs +115 -0
  11. package/dist/{calendar-CodWwTHM.js → calendar-DtJh7UYD.js} +532 -480
  12. package/dist/{card-B9RPShvV.cjs → card-Cf-UcGAP.cjs} +1 -1
  13. package/dist/{card-en2KhOPO.js → card-M1X36b6i.js} +8 -26
  14. package/dist/{checkbox-CH8xeK-0.cjs → checkbox-CTxc8wQe.cjs} +1 -1
  15. package/dist/{checkbox-DSAcMC-D.js → checkbox-_5LbXU7N.js} +4 -4
  16. package/dist/class-map-C_erArZz.cjs +5 -0
  17. package/dist/{class-map-Dw6Wrxwi.js → class-map-wy7PUk0P.js} +3 -3
  18. package/dist/{combobox-BFOjlFIj.cjs → combobox-BJ1gA0f0.cjs} +1 -1
  19. package/dist/{combobox-DaiEdUKx.js → combobox-Ct0NNY1p.js} +12 -16
  20. package/dist/{consent-CXp0bLvg.js → consent-B2hIQh4b.js} +3 -3
  21. package/dist/{consent-DFrsiYGQ.cjs → consent-BeOjxQdR.cjs} +1 -1
  22. package/dist/datepicker-B8mifBAm.js +1374 -0
  23. package/dist/datepicker-DVqmQAOe.cjs +289 -0
  24. package/dist/directive-helpers-4oOjKnGY.cjs +5 -0
  25. package/dist/directive-helpers-BzAtj9by.js +38 -0
  26. package/dist/{element-D62wHiNU.cjs → element-CJ_QKaki.cjs} +6 -6
  27. package/dist/{element-DJZPsA_J.js → element-CRDRygXu.js} +47 -132
  28. package/dist/{heading-H_FWjo2k.cjs → heading--JKFppLS.cjs} +1 -1
  29. package/dist/{heading-DQ0R34j4.js → heading-Cs5yGnJg.js} +1 -1
  30. package/dist/{helptext-D1fkGmfT.cjs → helptext-CVQP3pis.cjs} +1 -1
  31. package/dist/{helptext-8ykxyegi.js → helptext-DuvVSH7d.js} +6 -6
  32. package/dist/icon-1dy7UZcu.js +89 -0
  33. package/dist/icon-BGuizDwk.cjs +9 -0
  34. package/dist/{if-defined-D3lgJqT7.js → if-defined-BWZGb3bh.js} +1 -1
  35. package/dist/{if-defined-CkVc_RJD.cjs → if-defined-Bc9-_I01.cjs} +1 -1
  36. package/dist/index.d.ts +98 -6
  37. package/dist/input-element-BcFmygSF.js +707 -0
  38. package/dist/input-element-j9znzLWz.cjs +1 -0
  39. package/dist/{input-wrapper-DVjNwf8-.cjs → input-wrapper-BsQ7oFMd.cjs} +1 -1
  40. package/dist/input-wrapper-CDgenrYA.js +6 -0
  41. package/dist/{input-wrapper-CQzXG44g.js → input-wrapper-CKJU0QWG.js} +8 -8
  42. package/dist/{link-CyiVlb-7.cjs → link-Da3pZ_CW.cjs} +1 -1
  43. package/dist/{link-DSSJYrtn.js → link-DzZCw8j2.js} +9 -16
  44. package/dist/{linkcard-fH9uydjS.cjs → linkcard-BM23gzhS.cjs} +1 -1
  45. package/dist/{linkcard-g8JtooPU.js → linkcard-RIK5xqbd.js} +4 -4
  46. package/dist/{listbox-L-iOSF7M.cjs → listbox-CsGiqzD0.cjs} +1 -1
  47. package/dist/{listbox-n4wjlLqD.js → listbox-DlJevu8O.js} +5 -5
  48. package/dist/{loader-Bzf1sPSg.js → loader-BVvBzaPI.js} +5 -5
  49. package/dist/{loader-C-3l7kb9.cjs → loader-Bo8RCbCJ.cjs} +1 -1
  50. package/dist/{messagebox---xPIAwR.cjs → messagebox-C76IcXTl.cjs} +1 -1
  51. package/dist/{messagebox-okJLeSpj.js → messagebox-DwdMXoAe.js} +6 -16
  52. package/dist/{modal-pohCsr_x.js → modal-BGXk3f9u.js} +6 -16
  53. package/dist/{modal-IjDRQfX1.cjs → modal-Cdz9JcCX.cjs} +1 -1
  54. package/dist/pkt-accordion.cjs +1 -1
  55. package/dist/pkt-accordion.js +2 -2
  56. package/dist/pkt-alert.cjs +1 -1
  57. package/dist/pkt-alert.js +1 -1
  58. package/dist/pkt-backlink.cjs +1 -1
  59. package/dist/pkt-backlink.js +1 -1
  60. package/dist/pkt-button.cjs +1 -1
  61. package/dist/pkt-button.js +1 -1
  62. package/dist/pkt-calendar.cjs +1 -1
  63. package/dist/pkt-calendar.js +1 -1
  64. package/dist/pkt-card.cjs +1 -1
  65. package/dist/pkt-card.js +1 -1
  66. package/dist/pkt-checkbox.cjs +1 -1
  67. package/dist/pkt-checkbox.js +1 -1
  68. package/dist/pkt-combobox.cjs +1 -1
  69. package/dist/pkt-combobox.js +1 -1
  70. package/dist/pkt-consent.cjs +1 -1
  71. package/dist/pkt-consent.js +1 -1
  72. package/dist/pkt-datepicker.cjs +1 -1
  73. package/dist/pkt-datepicker.js +8 -4
  74. package/dist/pkt-heading.cjs +1 -1
  75. package/dist/pkt-heading.js +1 -1
  76. package/dist/pkt-helptext.cjs +1 -1
  77. package/dist/pkt-helptext.js +1 -1
  78. package/dist/pkt-icon.cjs +1 -1
  79. package/dist/pkt-icon.js +1 -1
  80. package/dist/pkt-index.cjs +1 -1
  81. package/dist/pkt-index.js +29 -29
  82. package/dist/pkt-input-wrapper.cjs +1 -1
  83. package/dist/pkt-input-wrapper.js +1 -1
  84. package/dist/pkt-link.cjs +1 -1
  85. package/dist/pkt-link.js +1 -1
  86. package/dist/pkt-linkcard.cjs +1 -1
  87. package/dist/pkt-linkcard.js +1 -1
  88. package/dist/pkt-listbox.cjs +1 -1
  89. package/dist/pkt-listbox.js +1 -1
  90. package/dist/pkt-loader.cjs +1 -1
  91. package/dist/pkt-loader.js +1 -1
  92. package/dist/pkt-messagebox.cjs +1 -1
  93. package/dist/pkt-messagebox.js +1 -1
  94. package/dist/pkt-modal.cjs +1 -1
  95. package/dist/pkt-modal.js +1 -1
  96. package/dist/pkt-progressbar.cjs +1 -1
  97. package/dist/pkt-progressbar.js +2 -2
  98. package/dist/pkt-radiobutton.cjs +1 -1
  99. package/dist/pkt-radiobutton.js +1 -1
  100. package/dist/pkt-select.cjs +1 -1
  101. package/dist/pkt-select.js +1 -1
  102. package/dist/pkt-tag.cjs +1 -1
  103. package/dist/pkt-tag.js +1 -1
  104. package/dist/pkt-textarea.cjs +1 -1
  105. package/dist/pkt-textarea.js +1 -1
  106. package/dist/pkt-textinput.cjs +1 -1
  107. package/dist/pkt-textinput.js +1 -1
  108. package/dist/{progressbar-DjsupQ7Y.js → progressbar-BbVei20_.js} +7 -7
  109. package/dist/{progressbar-DJzEC7cx.cjs → progressbar-CazcIzVT.cjs} +2 -2
  110. package/dist/{radiobutton-DEboKECm.cjs → radiobutton-D1fihs8R.cjs} +1 -1
  111. package/dist/{radiobutton-Bz_qApF3.js → radiobutton-DODROIBF.js} +5 -5
  112. package/dist/{ref-BfgcOXko.cjs → ref-BFa5Utho.cjs} +1 -1
  113. package/dist/{ref-BCGCor-j.js → ref-Xa5dbh--.js} +2 -2
  114. package/dist/repeat-BZb41H64.cjs +5 -0
  115. package/dist/{repeat-B6qPUgAq.js → repeat-CJ79egkN.js} +8 -8
  116. package/dist/{select-DKkoxmgj.js → select-BG2MBQbh.js} +6 -6
  117. package/dist/{select-DynzsPo0.cjs → select-D-m1PhpA.cjs} +1 -1
  118. package/dist/{state-CPQXJ4Ct.js → state-DS_kr2Fy.js} +1 -1
  119. package/dist/{state-BkE_Rxl7.cjs → state-DSjcvzDN.cjs} +1 -1
  120. package/dist/{tag-NZ5oeGfw.js → tag-CqMgt01I.js} +7 -20
  121. package/dist/{tag-BKq07hGI.cjs → tag-EFUKrc8q.cjs} +2 -2
  122. package/dist/{textarea-COG1CH_s.js → textarea-DCKKhs1B.js} +9 -9
  123. package/dist/{textarea-BS1tgktz.cjs → textarea-aUG3S7C2.cjs} +1 -1
  124. package/dist/{textinput-CTOtfcTR.js → textinput-B5Ai5R8L.js} +8 -8
  125. package/dist/{textinput-CCK8ti2y.cjs → textinput-mUERucRy.cjs} +1 -1
  126. package/package.json +15 -7
  127. package/src/components/combobox/combobox.ts +1 -1
  128. package/src/components/datepicker/datepicker-multiple.ts +202 -0
  129. package/src/components/datepicker/datepicker-range.ts +281 -0
  130. package/src/components/datepicker/datepicker-single.ts +198 -0
  131. package/src/components/datepicker/datepicker-utils.ts +9 -1
  132. package/src/components/datepicker/datepicker.ts +141 -213
  133. package/src/components/datepicker/index.ts +5 -1
  134. package/src/components/icon/icon.ts +16 -7
  135. package/src/components/select/select.ts +1 -1
  136. package/dist/calendar-DH-fCGyW.cjs +0 -115
  137. package/dist/class-map-CG3vIaNm.cjs +0 -5
  138. package/dist/datepicker-C244h82t.cjs +0 -190
  139. package/dist/datepicker-DwOkktaP.js +0 -859
  140. package/dist/directive-helpers-_qHew-gi.cjs +0 -5
  141. package/dist/directive-helpers-cAOIHg9K.js +0 -45
  142. package/dist/icon-B1-mkmwB.js +0 -88
  143. package/dist/icon-__Hjt2XZ.cjs +0 -9
  144. package/dist/input-element-DQOVrqUZ.js +0 -703
  145. package/dist/input-element-Y8sdrq9C.cjs +0 -1
  146. package/dist/input-wrapper-8iKEzDRZ.js +0 -40
  147. package/dist/repeat-DzibMwhi.cjs +0 -5
@@ -1,703 +0,0 @@
1
- import { P as ke, t as g, n as d } from "./element-DJZPsA_J.js";
2
- import { r as Ve } from "./state-CPQXJ4Ct.js";
3
- import { u as Fe } from "./stringutils-DJjRa8dG.js";
4
- import { s as Ce } from "./input-wrapper-8iKEzDRZ.js";
5
- (function() {
6
- (function(M) {
7
- 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(), C = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), L = {
8
- ariaAtomic: "aria-atomic",
9
- ariaAutoComplete: "aria-autocomplete",
10
- ariaBusy: "aria-busy",
11
- ariaChecked: "aria-checked",
12
- ariaColCount: "aria-colcount",
13
- ariaColIndex: "aria-colindex",
14
- ariaColIndexText: "aria-colindextext",
15
- ariaColSpan: "aria-colspan",
16
- ariaCurrent: "aria-current",
17
- ariaDescription: "aria-description",
18
- ariaDisabled: "aria-disabled",
19
- ariaExpanded: "aria-expanded",
20
- ariaHasPopup: "aria-haspopup",
21
- ariaHidden: "aria-hidden",
22
- ariaInvalid: "aria-invalid",
23
- ariaKeyShortcuts: "aria-keyshortcuts",
24
- ariaLabel: "aria-label",
25
- ariaLevel: "aria-level",
26
- ariaLive: "aria-live",
27
- ariaModal: "aria-modal",
28
- ariaMultiLine: "aria-multiline",
29
- ariaMultiSelectable: "aria-multiselectable",
30
- ariaOrientation: "aria-orientation",
31
- ariaPlaceholder: "aria-placeholder",
32
- ariaPosInSet: "aria-posinset",
33
- ariaPressed: "aria-pressed",
34
- ariaReadOnly: "aria-readonly",
35
- ariaRelevant: "aria-relevant",
36
- ariaRequired: "aria-required",
37
- ariaRoleDescription: "aria-roledescription",
38
- ariaRowCount: "aria-rowcount",
39
- ariaRowIndex: "aria-rowindex",
40
- ariaRowIndexText: "aria-rowindextext",
41
- ariaRowSpan: "aria-rowspan",
42
- ariaSelected: "aria-selected",
43
- ariaSetSize: "aria-setsize",
44
- ariaSort: "aria-sort",
45
- ariaValueMax: "aria-valuemax",
46
- ariaValueMin: "aria-valuemin",
47
- ariaValueNow: "aria-valuenow",
48
- ariaValueText: "aria-valuetext",
49
- role: "role"
50
- }, oe = (t, e) => {
51
- for (let i in L) {
52
- e[i] = null;
53
- let a = null;
54
- const r = L[i];
55
- Object.defineProperty(e, i, {
56
- get() {
57
- return a;
58
- },
59
- set(n) {
60
- a = n, t.isConnected ? k(t, r, n) : F.set(t, e);
61
- }
62
- });
63
- }
64
- };
65
- function K(t) {
66
- const e = u.get(t), { form: i } = e;
67
- Y(t, i, e), X(t, e.labels);
68
- }
69
- const j = (t, e = !1) => {
70
- const i = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, {
71
- acceptNode(n) {
72
- return u.has(n) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
73
- }
74
- });
75
- let a = i.nextNode();
76
- const r = !e || t.disabled;
77
- for (; a; )
78
- a.formDisabledCallback && r && W(a, t.disabled), a = i.nextNode();
79
- }, G = { attributes: !0, attributeFilter: ["disabled", "name"] }, N = D() ? new MutationObserver((t) => {
80
- for (const e of t) {
81
- const i = e.target;
82
- if (e.attributeName === "disabled" && (i.constructor.formAssociated ? W(i, i.hasAttribute("disabled")) : i.localName === "fieldset" && j(i)), e.attributeName === "name" && i.constructor.formAssociated) {
83
- const a = u.get(i), r = T.get(i);
84
- a.setFormValue(r);
85
- }
86
- }
87
- }) : {};
88
- function P(t) {
89
- t.forEach((e) => {
90
- const { addedNodes: i, removedNodes: a } = e, r = Array.from(i), n = Array.from(a);
91
- r.forEach((o) => {
92
- var m;
93
- if (u.has(o) && o.constructor.formAssociated && K(o), F.has(o)) {
94
- const f = F.get(o);
95
- Object.keys(L).filter((v) => f[v] !== null).forEach((v) => {
96
- k(o, L[v], f[v]);
97
- }), F.delete(o);
98
- }
99
- if (I.has(o)) {
100
- const f = I.get(o);
101
- 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);
102
- }
103
- if (o.localName === "form") {
104
- const f = b.get(o), E = document.createTreeWalker(o, NodeFilter.SHOW_ELEMENT, {
105
- acceptNode($) {
106
- return u.has($) && $.constructor.formAssociated && !(f && f.has($)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
107
- }
108
- });
109
- let v = E.nextNode();
110
- for (; v; )
111
- K(v), v = E.nextNode();
112
- }
113
- o.localName === "fieldset" && ((m = N.observe) === null || m === void 0 || m.call(N, o, G), j(o, !0));
114
- }), n.forEach((o) => {
115
- const m = u.get(o);
116
- m && p.get(m) && J(m), C.has(o) && C.get(o).disconnect();
117
- });
118
- });
119
- }
120
- function le(t) {
121
- t.forEach((e) => {
122
- const { removedNodes: i } = e;
123
- i.forEach((a) => {
124
- const r = U.get(e.target);
125
- u.has(a) && ee(a), r.disconnect();
126
- });
127
- });
128
- }
129
- const ce = (t) => {
130
- var e, i;
131
- const a = new MutationObserver(le);
132
- !((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 }), U.set(t, a);
133
- };
134
- D() && new MutationObserver(P);
135
- const H = {
136
- childList: !0,
137
- subtree: !0
138
- }, k = (t, e, i) => {
139
- t.getAttribute(e) !== i && t.setAttribute(e, i);
140
- }, W = (t, e) => {
141
- t.toggleAttribute("internals-disabled", e), e ? k(t, "aria-disabled", "true") : t.removeAttribute("aria-disabled"), t.formDisabledCallback && t.formDisabledCallback.apply(t, [e]);
142
- }, J = (t) => {
143
- p.get(t).forEach((i) => {
144
- i.remove();
145
- }), p.set(t, []);
146
- }, Q = (t, e) => {
147
- const i = document.createElement("input");
148
- return i.type = "hidden", i.name = t.getAttribute("name"), t.after(i), p.get(e).push(i), i;
149
- }, de = (t, e) => {
150
- var i;
151
- p.set(e, []), (i = N.observe) === null || i === void 0 || i.call(N, t, G);
152
- }, X = (t, e) => {
153
- if (e.length) {
154
- Array.from(e).forEach((a) => a.addEventListener("click", t.click.bind(t)));
155
- let i = e[0].id;
156
- e[0].id || (i = `${e[0].htmlFor}_Label`, e[0].id = i), k(t, "aria-labelledby", i);
157
- }
158
- }, R = (t) => {
159
- 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);
160
- t.toggleAttribute("internals-invalid", r), t.toggleAttribute("internals-valid", !r);
161
- }, he = (t) => {
162
- R(O(t.target));
163
- }, ue = (t) => {
164
- R(O(t.target));
165
- }, fe = (t) => {
166
- 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(",");
167
- t.addEventListener("click", (i) => {
168
- if (i.target.closest(e)) {
169
- const r = b.get(t);
170
- if (t.noValidate)
171
- return;
172
- r.size && Array.from(r).reverse().map((m) => u.get(m).reportValidity()).includes(!1) && i.preventDefault();
173
- }
174
- });
175
- }, pe = (t) => {
176
- const e = b.get(t.target);
177
- e && e.size && e.forEach((i) => {
178
- i.constructor.formAssociated && i.formResetCallback && i.formResetCallback.apply(i);
179
- });
180
- }, Y = (t, e, i) => {
181
- if (e) {
182
- const a = b.get(e);
183
- if (a)
184
- a.add(t);
185
- else {
186
- const r = /* @__PURE__ */ new Set();
187
- r.add(t), b.set(e, r), fe(e), e.addEventListener("reset", pe), e.addEventListener("input", he), e.addEventListener("change", ue);
188
- }
189
- V.set(e, { ref: t, internals: i }), t.constructor.formAssociated && t.formAssociatedCallback && setTimeout(() => {
190
- t.formAssociatedCallback.apply(t, [e]);
191
- }, 0), R(e);
192
- }
193
- }, O = (t) => {
194
- let e = t.parentNode;
195
- return e && e.tagName !== "FORM" && (e = O(e)), e;
196
- }, w = (t, e, i = DOMException) => {
197
- if (!t.constructor.formAssociated)
198
- throw new i(e);
199
- }, Z = (t, e, i) => {
200
- const a = b.get(t);
201
- return a && a.size && a.forEach((r) => {
202
- u.get(r)[i]() || (e = !1);
203
- }), e;
204
- }, ee = (t) => {
205
- if (t.constructor.formAssociated) {
206
- const e = u.get(t), { labels: i, form: a } = e;
207
- X(t, i), Y(t, a, e);
208
- }
209
- };
210
- function D() {
211
- return typeof MutationObserver < "u";
212
- }
213
- class me {
214
- constructor() {
215
- 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);
216
- }
217
- }
218
- const ye = (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), ge = (t, e, i) => (t.valid = be(e), Object.keys(e).forEach((a) => t[a] = e[a]), i && R(i), t), be = (t) => {
219
- let e = !0;
220
- for (let i in t)
221
- i !== "valid" && t[i] !== !1 && (e = !1);
222
- return e;
223
- }, B = /* @__PURE__ */ new WeakMap();
224
- function te(t, e) {
225
- t.toggleAttribute(e, !0), t.part && t.part.add(e);
226
- }
227
- class _ extends Set {
228
- static get isPolyfilled() {
229
- return !0;
230
- }
231
- constructor(e) {
232
- if (super(), !e || !e.tagName || e.tagName.indexOf("-") === -1)
233
- throw new TypeError("Illegal constructor");
234
- B.set(this, e);
235
- }
236
- add(e) {
237
- if (!/^--/.test(e) || typeof e != "string")
238
- throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);
239
- const i = super.add(e), a = B.get(this), r = `state${e}`;
240
- return a.isConnected ? te(a, r) : setTimeout(() => {
241
- te(a, r);
242
- }), i;
243
- }
244
- clear() {
245
- for (let [e] of this.entries())
246
- this.delete(e);
247
- super.clear();
248
- }
249
- delete(e) {
250
- const i = super.delete(e), a = B.get(this);
251
- return a.isConnected ? (a.toggleAttribute(`state${e}`, !1), a.part && a.part.remove(`state${e}`)) : setTimeout(() => {
252
- a.toggleAttribute(`state${e}`, !1), a.part && a.part.remove(`state${e}`);
253
- }), i;
254
- }
255
- }
256
- function ie(t, e, i, a) {
257
- if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
258
- return i === "m" ? a : i === "a" ? a.call(t) : a ? a.value : e.get(t);
259
- }
260
- function ve(t, e, i, a, r) {
261
- 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");
262
- return e.set(t, i), i;
263
- }
264
- var x;
265
- class we {
266
- constructor(e) {
267
- x.set(this, void 0), ve(this, x, e);
268
- for (let i = 0; i < e.length; i++) {
269
- let a = e[i];
270
- this[i] = a, a.hasAttribute("name") && (this[a.getAttribute("name")] = a);
271
- }
272
- Object.freeze(this);
273
- }
274
- get length() {
275
- return ie(this, x, "f").length;
276
- }
277
- [(x = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() {
278
- return ie(this, x, "f")[Symbol.iterator]();
279
- }
280
- item(e) {
281
- return this[e] == null ? null : this[e];
282
- }
283
- namedItem(e) {
284
- return this[e] == null ? null : this[e];
285
- }
286
- }
287
- function Ee() {
288
- const t = HTMLFormElement.prototype.checkValidity;
289
- HTMLFormElement.prototype.checkValidity = i;
290
- const e = HTMLFormElement.prototype.reportValidity;
291
- HTMLFormElement.prototype.reportValidity = a;
292
- function i(...n) {
293
- let o = t.apply(this, n);
294
- return Z(this, o, "checkValidity");
295
- }
296
- function a(...n) {
297
- let o = e.apply(this, n);
298
- return Z(this, o, "reportValidity");
299
- }
300
- const { get: r } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
301
- Object.defineProperty(HTMLFormElement.prototype, "elements", {
302
- get(...n) {
303
- const o = r.call(this, ...n), m = Array.from(b.get(this) || []);
304
- if (m.length === 0)
305
- return o;
306
- const f = Array.from(o).concat(m).sort((E, v) => E.compareDocumentPosition ? E.compareDocumentPosition(v) & 2 ? 1 : -1 : 0);
307
- return new we(f);
308
- }
309
- });
310
- }
311
- class ae {
312
- static get isPolyfilled() {
313
- return !0;
314
- }
315
- constructor(e) {
316
- if (!e || !e.tagName || e.tagName.indexOf("-") === -1)
317
- throw new TypeError("Illegal constructor");
318
- const i = e.getRootNode(), a = new me();
319
- this.states = new _(e), s.set(this, e), h.set(this, a), u.set(e, this), oe(e, this), de(e, this), Object.seal(this), i instanceof DocumentFragment && ce(i);
320
- }
321
- checkValidity() {
322
- const e = s.get(this);
323
- if (w(e, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
324
- return !0;
325
- const i = h.get(this);
326
- if (!i.valid) {
327
- const a = new Event("invalid", {
328
- bubbles: !1,
329
- cancelable: !0,
330
- composed: !1
331
- });
332
- e.dispatchEvent(a);
333
- }
334
- return i.valid;
335
- }
336
- get form() {
337
- const e = s.get(this);
338
- w(e, "Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");
339
- let i;
340
- return e.constructor.formAssociated === !0 && (i = O(e)), i;
341
- }
342
- get labels() {
343
- const e = s.get(this);
344
- w(e, "Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");
345
- const i = e.getAttribute("id"), a = e.getRootNode();
346
- return a && i ? a.querySelectorAll(`[for="${i}"]`) : [];
347
- }
348
- reportValidity() {
349
- const e = s.get(this);
350
- if (w(e, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
351
- return !0;
352
- const i = this.checkValidity(), a = A.get(this);
353
- if (a && !e.constructor.formAssociated)
354
- throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");
355
- return !i && a && (e.focus(), a.focus()), i;
356
- }
357
- setFormValue(e) {
358
- const i = s.get(this);
359
- 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)) {
360
- if (i.getAttribute("name")) {
361
- const a = Q(i, this);
362
- a.value = e;
363
- }
364
- } else e != null && e instanceof FormData && Array.from(e).reverse().forEach(([a, r]) => {
365
- if (typeof r == "string") {
366
- const n = Q(i, this);
367
- n.name = a, n.value = r;
368
- }
369
- });
370
- T.set(i, e);
371
- }
372
- setValidity(e, i, a) {
373
- const r = s.get(this);
374
- if (w(r, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !e)
375
- throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");
376
- A.set(this, a);
377
- const n = h.get(this), o = {};
378
- for (const E in e)
379
- o[E] = e[E];
380
- Object.keys(o).length === 0 && ye(n);
381
- const m = Object.assign(Object.assign({}, n), o);
382
- delete m.valid;
383
- const { valid: f } = ge(n, m, this.form);
384
- if (!f && !i)
385
- 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.");
386
- 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);
387
- }
388
- get shadowRoot() {
389
- const e = s.get(this), i = S.get(e);
390
- return i || null;
391
- }
392
- get validationMessage() {
393
- const e = s.get(this);
394
- return w(e, "Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."), y.get(this);
395
- }
396
- get validity() {
397
- const e = s.get(this);
398
- return w(e, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), h.get(this);
399
- }
400
- get willValidate() {
401
- const e = s.get(this);
402
- 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"));
403
- }
404
- }
405
- function Me() {
406
- if (typeof window > "u" || !window.ElementInternals || !HTMLElement.prototype.attachInternals)
407
- return !1;
408
- class t extends HTMLElement {
409
- constructor() {
410
- super(), this.internals = this.attachInternals();
411
- }
412
- }
413
- const e = `element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g, "")}`;
414
- customElements.define(e, t);
415
- const i = new t();
416
- return [
417
- "shadowRoot",
418
- "form",
419
- "willValidate",
420
- "validity",
421
- "validationMessage",
422
- "labels",
423
- "setFormValue",
424
- "setValidity",
425
- "checkValidity",
426
- "reportValidity"
427
- ].every((a) => a in i.internals);
428
- }
429
- let se = !1, re = !1;
430
- function q(t) {
431
- re || (re = !0, window.CustomStateSet = _, t && (HTMLElement.prototype.attachInternals = function(...e) {
432
- const i = t.call(this, e);
433
- return i.states = new _(this), i;
434
- }));
435
- }
436
- function ne(t = !0) {
437
- if (!se) {
438
- if (se = !0, typeof window < "u" && (window.ElementInternals = ae), typeof CustomElementRegistry < "u") {
439
- const e = CustomElementRegistry.prototype.define;
440
- CustomElementRegistry.prototype.define = function(i, a, r) {
441
- if (a.formAssociated) {
442
- const n = a.prototype.connectedCallback;
443
- a.prototype.connectedCallback = function() {
444
- z.has(this) || (z.set(this, !0), this.hasAttribute("disabled") && W(this, !0)), n != null && n.apply(this), ee(this);
445
- };
446
- }
447
- e.call(this, i, a, r);
448
- };
449
- }
450
- if (typeof HTMLElement < "u" && (HTMLElement.prototype.attachInternals = function() {
451
- if (this.tagName) {
452
- if (this.tagName.indexOf("-") === -1)
453
- throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.");
454
- } else return {};
455
- if (u.has(this))
456
- throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");
457
- return new ae(this);
458
- }), typeof Element < "u") {
459
- let e = function(...a) {
460
- const r = i.apply(this, a);
461
- if (S.set(this, r), D()) {
462
- const n = new MutationObserver(P);
463
- window.ShadyDOM ? n.observe(this, H) : n.observe(r, H), C.set(this, n);
464
- }
465
- return r;
466
- };
467
- const i = Element.prototype.attachShadow;
468
- Element.prototype.attachShadow = e;
469
- }
470
- D() && typeof document < "u" && new MutationObserver(P).observe(document.documentElement, H), typeof HTMLFormElement < "u" && Ee(), (t || typeof window < "u" && !window.CustomStateSet) && q();
471
- }
472
- }
473
- return !!customElements.polyfillWrapFlushCallback || (Me() ? typeof window < "u" && !window.CustomStateSet && q(HTMLElement.prototype.attachInternals) : ne(!1)), M.forceCustomStateSetPolyfill = q, M.forceElementInternalsPolyfill = ne, Object.defineProperty(M, "__esModule", { value: !0 }), M;
474
- })({});
475
- })();
476
- var Te = Object.defineProperty, l = (M, s, h, p) => {
477
- for (var u = void 0, y = M.length - 1, V; y >= 0; y--)
478
- (V = M[y]) && (u = V(s, h, u) || u);
479
- return u && Te(s, h, u), u;
480
- };
481
- class c extends ke {
482
- constructor() {
483
- 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 = Fe(), 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 = Ce.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();
484
- }
485
- static get formAssociated() {
486
- return !0;
487
- }
488
- manageValidity(s) {
489
- var h, p, u, y, V, C, b, T, F, S, A;
490
- 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(
491
- { patternMismatch: !0 },
492
- g.forms.messages.invalidPattern,
493
- s
494
- ) : (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) : (C = s.validity) != null && C.rangeUnderflow ? this.internals.setValidity(
495
- { rangeUnderflow: !0 },
496
- this.min ? g.forms.messages.rangeUnderflowMin.replace("{min}", (b = this.min) == null ? void 0 : b.toString()) : g.forms.messages.rangeUnderflow,
497
- s
498
- ) : (T = s.validity) != null && T.stepMismatch ? this.internals.setValidity({ stepMismatch: !0 }, g.forms.messages.invalid, s) : (F = s.validity) != null && F.rangeOverflow ? this.internals.setValidity(
499
- { rangeOverflow: !0 },
500
- this.max ? g.forms.messages.rangeOverflowMax.replace("{max}", (S = this.max) == null ? void 0 : S.toString()) : g.forms.messages.rangeOverflow,
501
- s
502
- ) : (A = s.validity) != null && A.customError ? this.internals.setValidity({ customError: !0 }, s.validationMessage, s) : this.internals.setValidity({}));
503
- }
504
- setFormValue(s) {
505
- if (this.internals)
506
- if (Array.isArray(s)) {
507
- const h = new FormData();
508
- s.forEach((p) => {
509
- h.append(this.name, p);
510
- }), this.internals.setFormValue(h);
511
- } else
512
- this.internals.setFormValue(s);
513
- }
514
- // Trigger this when you want to set the value of the *radio or checkbox* input out to the form
515
- // Do not use valueChanged or onChange for radios and checkboxes!
516
- valueChecked(s) {
517
- if (!this.touched) return;
518
- const h = this.internals.form || this.closest("form"), p = h ? new FormData(h) : null;
519
- h && h.querySelectorAll(
520
- `pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`
521
- ).forEach((u) => {
522
- const y = u;
523
- y.name === this.name && y.value !== this.value && y.checked && (y.checked = !1);
524
- }), 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(
525
- new CustomEvent("value-change", {
526
- detail: this.checked,
527
- bubbles: !0,
528
- composed: !0
529
- })
530
- ), this.internals.reportValidity();
531
- }
532
- valueChanged(s, h) {
533
- (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()));
534
- }
535
- // When input goes from content to no content
536
- clearInputValue() {
537
- const s = this.multiple || this.range ? [] : "";
538
- this.value = s, this.internals.setFormValue(s), this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), this.dispatchEvent(
539
- new CustomEvent("value-change", {
540
- detail: s,
541
- bubbles: !0,
542
- composed: !0
543
- })
544
- );
545
- }
546
- // When user enters the input, we need to push that event out to the form
547
- onFocus() {
548
- this.dispatchEvent(new FocusEvent("focus", { bubbles: !0, composed: !0 }));
549
- }
550
- // And also when the user leaves the input...
551
- onBlur() {
552
- this.dispatchEvent(new FocusEvent("blur", { bubbles: !0, composed: !0 }));
553
- }
554
- // Trigger this when user types in the input
555
- onInput() {
556
- this.dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0 }));
557
- }
558
- // Trigger this when you want to set the value of the input out to the form
559
- onChange(s) {
560
- if (!this.touched) {
561
- this.touched = !0, s && this.setFormValue(s);
562
- return;
563
- }
564
- 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(
565
- new CustomEvent("value-change", {
566
- detail: s,
567
- bubbles: !0,
568
- composed: !0
569
- })
570
- ));
571
- }
572
- formResetCallback() {
573
- this.touched = !1, this._options && this._options.length && this._options.forEach((s) => {
574
- s.selected = !1;
575
- }), 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;
576
- }
577
- updated(s) {
578
- 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")));
579
- }
580
- firstUpdated(s) {
581
- if (super.firstUpdated(s), !this.form) {
582
- const h = this.internals.form || this.closest("form");
583
- this.form = h;
584
- }
585
- 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) {
586
- const h = this.checked === "" || this.checked === "true" || this.checked === !0;
587
- this.internals.ariaChecked = h, this.internals.setFormValue(
588
- h ? this.value || "on" : "",
589
- h ? this.value || "on" : ""
590
- );
591
- } else
592
- this.internals.setFormValue(this.value);
593
- 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));
594
- }
595
- }
596
- l([
597
- d()
598
- ], c.prototype, "defaultValue");
599
- l([
600
- d({ type: Boolean, reflect: !0 })
601
- ], c.prototype, "disabled");
602
- l([
603
- d({ type: Boolean, reflect: !0 })
604
- ], c.prototype, "readonly");
605
- l([
606
- d({ type: Boolean, reflect: !0 })
607
- ], c.prototype, "required");
608
- l([
609
- d({ type: Number, reflect: !0 })
610
- ], c.prototype, "max");
611
- l([
612
- d({ type: Number, reflect: !0 })
613
- ], c.prototype, "maxlength");
614
- l([
615
- d({ type: Number, reflect: !0 })
616
- ], c.prototype, "min");
617
- l([
618
- d({ type: Number, reflect: !0 })
619
- ], c.prototype, "minlength");
620
- l([
621
- d({ type: Number, reflect: !0 })
622
- ], c.prototype, "step");
623
- l([
624
- d({ type: String })
625
- ], c.prototype, "ariaDescribedBy");
626
- l([
627
- d({ type: String })
628
- ], c.prototype, "ariaLabelledby");
629
- l([
630
- d({ type: String, reflect: !0 })
631
- ], c.prototype, "name");
632
- l([
633
- d({ type: String, reflect: !0 })
634
- ], c.prototype, "pattern");
635
- l([
636
- d({ type: String, reflect: !0 })
637
- ], c.prototype, "placeholder");
638
- l([
639
- d({ type: String, reflect: !0 })
640
- ], c.prototype, "id");
641
- l([
642
- d({ type: Boolean })
643
- ], c.prototype, "counter");
644
- l([
645
- d({ type: Boolean })
646
- ], c.prototype, "hasError");
647
- l([
648
- d({ type: Boolean })
649
- ], c.prototype, "inline");
650
- l([
651
- d({ type: Boolean })
652
- ], c.prototype, "hasFieldset");
653
- l([
654
- d({ type: Boolean })
655
- ], c.prototype, "optionalTag");
656
- l([
657
- d({ type: Boolean })
658
- ], c.prototype, "requiredTag");
659
- l([
660
- d({ type: Boolean })
661
- ], c.prototype, "skipForwardTestid");
662
- l([
663
- d({ type: Boolean, reflect: !1 })
664
- ], c.prototype, "useWrapper");
665
- l([
666
- d({ type: Boolean, reflect: !0 })
667
- ], c.prototype, "fullwidth");
668
- l([
669
- d({ type: Number })
670
- ], c.prototype, "counterMaxLength");
671
- l([
672
- d({ type: String })
673
- ], c.prototype, "errorMessage");
674
- l([
675
- d({ type: String })
676
- ], c.prototype, "helptext");
677
- l([
678
- d({ type: String })
679
- ], c.prototype, "helptextDropdown");
680
- l([
681
- d({ type: String, reflect: !1 })
682
- ], c.prototype, "helptextDropdownButton");
683
- l([
684
- d({ type: String })
685
- ], c.prototype, "label");
686
- l([
687
- d({ type: String, reflect: !1 })
688
- ], c.prototype, "optionalText");
689
- l([
690
- d({ type: String, reflect: !1 })
691
- ], c.prototype, "requiredText");
692
- l([
693
- d({ type: String, reflect: !1 })
694
- ], c.prototype, "tagText");
695
- l([
696
- d({ type: String, attribute: "data-testid" })
697
- ], c.prototype, "dataTestid");
698
- l([
699
- Ve()
700
- ], c.prototype, "touched");
701
- export {
702
- c as P
703
- };