@oslokommune/punkt-elements 12.37.0 → 12.37.2
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 +34 -0
- package/dist/{accordionitem-cvsySqgK.cjs → accordionitem-RFwXQC_0.cjs} +1 -1
- package/dist/{accordionitem-Db-3WiJS.js → accordionitem-vmwqD9rr.js} +1 -1
- package/dist/{alert-DWIElKEZ.cjs → alert-C2EPmB0W.cjs} +1 -1
- package/dist/{alert-B5lVS6Qs.js → alert-C33z1kBf.js} +1 -1
- package/dist/{button-BNdVIhUp.cjs → button-jdMbbn-e.cjs} +1 -1
- package/dist/{button-B6uRE7uT.js → button-sf_Yzx3X.js} +2 -2
- package/dist/{card-B5zTEmH1.js → card-Cyww1yKr.js} +2 -2
- package/dist/{card-BDcr3PII.cjs → card-DH-3qNgp.cjs} +1 -1
- package/dist/{checkbox-CyYfA2fu.js → checkbox-Cz3sIWt0.js} +1 -1
- package/dist/{checkbox-CqatE-eX.cjs → checkbox-U8aPrLjG.cjs} +1 -1
- package/dist/{combobox-CELUAZxF.js → combobox-CFH5-Ioh.js} +5 -5
- package/dist/{combobox-D9NKnao2.cjs → combobox-ChFttX7F.cjs} +1 -1
- package/dist/{consent-jXR0vKAu.cjs → consent-BNY1XvpV.cjs} +1 -1
- package/dist/{consent-Baktq_-1.js → consent-CTX9zf81.js} +6 -6
- package/dist/{datepicker-CpkTwszH.js → datepicker-hetVXVX4.js} +118 -105
- package/dist/{datepicker-cR9MtXOh.cjs → datepicker-mhQrHoNJ.cjs} +16 -16
- package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +1 -0
- package/dist/dialog-polyfill.esm-CbjBMXAG.js +395 -0
- package/dist/{heading-CP3NaeWE.cjs → heading-BnJhJDMD.cjs} +1 -1
- package/dist/{heading-BkC05ohM.js → heading-DNLQdsXY.js} +1 -1
- package/dist/{helptext-BLHAJ1aC.js → helptext-DcSUjjEq.js} +1 -1
- package/dist/{helptext-CCnYxYA9.cjs → helptext-bMgnhZ1R.cjs} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/input-element-XmmyUZmB.cjs +1 -0
- package/dist/{input-element-Bic-t96S.js → input-element-aQDMXDVQ.js} +31 -26
- package/dist/{input-wrapper-Cn929YTV.cjs → input-wrapper-B-f_SotM.cjs} +1 -1
- package/dist/{input-wrapper-CeeNYbDA.js → input-wrapper-BdeoMGnk.js} +2 -2
- package/dist/{link-BYI8VNGd.js → link-B748tCGi.js} +1 -1
- package/dist/{link-CnibgS3c.cjs → link-BrDbM3GT.cjs} +1 -1
- package/dist/{linkcard--zuuAt_v.js → linkcard-Bt-Qa_SP.js} +1 -1
- package/dist/{linkcard-DPGX1kb1.cjs → linkcard-s9yoOq90.cjs} +1 -1
- package/dist/{loader-BN4q8pSl.cjs → loader-Bk4XPiOY.cjs} +1 -1
- package/dist/{loader-DgIiyYBl.js → loader-C9EtX_mK.js} +1 -1
- package/dist/{messagebox-BWJr42m9.cjs → messagebox-B0kgftoP.cjs} +1 -1
- package/dist/{messagebox-cme5VbUM.js → messagebox-DZDP8XZt.js} +1 -1
- package/dist/modal-4aQZVxGl.cjs +33 -0
- package/dist/{modal-DIwagdAc.js → modal-m--Sfj_1.js} +14 -9
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +22 -22
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/{pkt-options-controller-TJ1apYGF.cjs → pkt-options-controller-Ay9ELZTV.cjs} +1 -1
- package/dist/{pkt-options-controller-CFmzX4xL.js → pkt-options-controller-DepYQBqb.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-slot-controller-Da-RgXfS.cjs +1 -0
- package/dist/{pkt-slot-controller-DFrc5O93.js → pkt-slot-controller-DtDaD9q_.js} +19 -19
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/{radiobutton-CIW0FvT8.cjs → radiobutton-DtL-nc1b.cjs} +1 -1
- package/dist/{radiobutton-DtHuz7qn.js → radiobutton-DtpGqoci.js} +1 -1
- package/dist/{select-DbRLz-7l.js → select-CNK8uoVi.js} +4 -4
- package/dist/{select-BJziJVde.cjs → select-s98KeDqQ.cjs} +1 -1
- package/dist/{tag-CgkUxA5D.cjs → tag-B9kFYxHg.cjs} +1 -1
- package/dist/{tag-CGnj4c1Z.js → tag-Cu8afZy8.js} +1 -1
- package/dist/{textarea-CiA4IzMs.js → textarea-C9Kj6gGv.js} +3 -3
- package/dist/{textarea-qX4Inr1X.cjs → textarea-CeUz6coA.cjs} +1 -1
- package/dist/{textinput-BlsgLNwW.cjs → textinput-BArDDwC2.cjs} +4 -3
- package/dist/{textinput-CrxjZNEq.js → textinput-Dj6R0L45.js} +33 -26
- package/package.json +4 -3
- package/src/components/button/button.ts +1 -0
- package/src/components/consent/consent.ts +1 -1
- package/src/components/datepicker/datepicker.ts +36 -4
- package/src/components/modal/modal.ts +14 -2
- package/src/components/textinput/textinput.ts +10 -0
- package/dist/input-element-C9ma8cdz.cjs +0 -1
- package/dist/modal-OC0efchb.cjs +0 -33
- package/dist/pkt-slot-controller-plQxXRvV.cjs +0 -1
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
var d = window.CustomEvent;
|
|
2
|
+
(!d || typeof d == "object") && (d = function(t, o) {
|
|
3
|
+
o = o || {};
|
|
4
|
+
var i = document.createEvent("CustomEvent");
|
|
5
|
+
return i.initCustomEvent(t, !!o.bubbles, !!o.cancelable, o.detail || null), i;
|
|
6
|
+
}, d.prototype = window.Event.prototype);
|
|
7
|
+
function g(e, t) {
|
|
8
|
+
var o = "on" + t.type.toLowerCase();
|
|
9
|
+
return typeof e[o] == "function" && e[o](t), e.dispatchEvent(t);
|
|
10
|
+
}
|
|
11
|
+
function E(e) {
|
|
12
|
+
for (; e && e !== document.body; ) {
|
|
13
|
+
var t = window.getComputedStyle(e), o = function(i, a) {
|
|
14
|
+
return !(t[i] === void 0 || t[i] === a);
|
|
15
|
+
};
|
|
16
|
+
if (t.opacity < 1 || o("zIndex", "auto") || o("transform", "none") || o("mixBlendMode", "normal") || o("filter", "none") || o("perspective", "none") || t.isolation === "isolate" || t.position === "fixed" || t.webkitOverflowScrolling === "touch")
|
|
17
|
+
return !0;
|
|
18
|
+
e = e.parentElement;
|
|
19
|
+
}
|
|
20
|
+
return !1;
|
|
21
|
+
}
|
|
22
|
+
function c(e) {
|
|
23
|
+
for (; e; ) {
|
|
24
|
+
if (e.localName === "dialog")
|
|
25
|
+
return (
|
|
26
|
+
/** @type {HTMLDialogElement} */
|
|
27
|
+
e
|
|
28
|
+
);
|
|
29
|
+
e.parentElement ? e = e.parentElement : e.parentNode ? e = e.parentNode.host : e = null;
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
function b(e) {
|
|
34
|
+
for (; e && e.shadowRoot && e.shadowRoot.activeElement; )
|
|
35
|
+
e = e.shadowRoot.activeElement;
|
|
36
|
+
e && e.blur && e !== document.body && e.blur();
|
|
37
|
+
}
|
|
38
|
+
function M(e, t) {
|
|
39
|
+
for (var o = 0; o < e.length; ++o)
|
|
40
|
+
if (e[o] === t)
|
|
41
|
+
return !0;
|
|
42
|
+
return !1;
|
|
43
|
+
}
|
|
44
|
+
function h(e) {
|
|
45
|
+
return !e || !e.hasAttribute("method") ? !1 : e.getAttribute("method").toLowerCase() === "dialog";
|
|
46
|
+
}
|
|
47
|
+
function v(e) {
|
|
48
|
+
var t = ["button", "input", "keygen", "select", "textarea"], o = t.map(function(s) {
|
|
49
|
+
return s + ":not([disabled])";
|
|
50
|
+
});
|
|
51
|
+
o.push('[tabindex]:not([disabled]):not([tabindex=""])');
|
|
52
|
+
var i = e.querySelector(o.join(", "));
|
|
53
|
+
if (!i && "attachShadow" in Element.prototype)
|
|
54
|
+
for (var a = e.querySelectorAll("*"), r = 0; r < a.length && !(a[r].tagName && a[r].shadowRoot && (i = v(a[r].shadowRoot), i)); r++)
|
|
55
|
+
;
|
|
56
|
+
return i;
|
|
57
|
+
}
|
|
58
|
+
function m(e) {
|
|
59
|
+
return e.isConnected || document.body.contains(e);
|
|
60
|
+
}
|
|
61
|
+
function y(e) {
|
|
62
|
+
if (e.submitter)
|
|
63
|
+
return e.submitter;
|
|
64
|
+
var t = e.target;
|
|
65
|
+
if (!(t instanceof HTMLFormElement))
|
|
66
|
+
return null;
|
|
67
|
+
var o = n.formSubmitter;
|
|
68
|
+
if (!o) {
|
|
69
|
+
var i = e.target, a = "getRootNode" in i && i.getRootNode() || document;
|
|
70
|
+
o = a.activeElement;
|
|
71
|
+
}
|
|
72
|
+
return !o || o.form !== t ? null : o;
|
|
73
|
+
}
|
|
74
|
+
function D(e) {
|
|
75
|
+
if (!e.defaultPrevented) {
|
|
76
|
+
var t = (
|
|
77
|
+
/** @type {!HTMLFormElement} */
|
|
78
|
+
e.target
|
|
79
|
+
), o = n.imagemapUseValue, i = y(e);
|
|
80
|
+
o === null && i && (o = i.value);
|
|
81
|
+
var a = c(t);
|
|
82
|
+
if (a) {
|
|
83
|
+
var r = i && i.getAttribute("formmethod") || t.getAttribute("method");
|
|
84
|
+
r === "dialog" && (e.preventDefault(), o != null ? a.close(o) : a.close());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function _(e) {
|
|
89
|
+
if (this.dialog_ = e, this.replacedStyleTop_ = !1, this.openAsModal_ = !1, e.hasAttribute("role") || e.setAttribute("role", "dialog"), e.show = this.show.bind(this), e.showModal = this.showModal.bind(this), e.close = this.close.bind(this), e.addEventListener("submit", D, !1), "returnValue" in e || (e.returnValue = ""), "MutationObserver" in window) {
|
|
90
|
+
var t = new MutationObserver(this.maybeHideModal.bind(this));
|
|
91
|
+
t.observe(e, { attributes: !0, attributeFilter: ["open"] });
|
|
92
|
+
} else {
|
|
93
|
+
var o = !1, i = (function() {
|
|
94
|
+
o ? this.downgradeModal() : this.maybeHideModal(), o = !1;
|
|
95
|
+
}).bind(this), a, r = function(s) {
|
|
96
|
+
if (s.target === e) {
|
|
97
|
+
var u = "DOMNodeRemoved";
|
|
98
|
+
o |= s.type.substr(0, u.length) === u, window.clearTimeout(a), a = window.setTimeout(i, 0);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
["DOMAttrModified", "DOMNodeRemoved", "DOMNodeRemovedFromDocument"].forEach(function(s) {
|
|
102
|
+
e.addEventListener(s, r);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
Object.defineProperty(e, "open", {
|
|
106
|
+
set: this.setOpen.bind(this),
|
|
107
|
+
get: e.hasAttribute.bind(e, "open")
|
|
108
|
+
}), this.backdrop_ = document.createElement("div"), this.backdrop_.className = "backdrop", this.backdrop_.addEventListener("mouseup", this.backdropMouseEvent_.bind(this)), this.backdrop_.addEventListener("mousedown", this.backdropMouseEvent_.bind(this)), this.backdrop_.addEventListener("click", this.backdropMouseEvent_.bind(this));
|
|
109
|
+
}
|
|
110
|
+
_.prototype = /** @type {HTMLDialogElement.prototype} */
|
|
111
|
+
{
|
|
112
|
+
get dialog() {
|
|
113
|
+
return this.dialog_;
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* Maybe remove this dialog from the modal top layer. This is called when
|
|
117
|
+
* a modal dialog may no longer be tenable, e.g., when the dialog is no
|
|
118
|
+
* longer open or is no longer part of the DOM.
|
|
119
|
+
*/
|
|
120
|
+
maybeHideModal: function() {
|
|
121
|
+
this.dialog_.hasAttribute("open") && m(this.dialog_) || this.downgradeModal();
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* Remove this dialog from the modal top layer, leaving it as a non-modal.
|
|
125
|
+
*/
|
|
126
|
+
downgradeModal: function() {
|
|
127
|
+
this.openAsModal_ && (this.openAsModal_ = !1, this.dialog_.style.zIndex = "", this.replacedStyleTop_ && (this.dialog_.style.top = "", this.replacedStyleTop_ = !1), this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_), n.dm.removeDialog(this));
|
|
128
|
+
},
|
|
129
|
+
/**
|
|
130
|
+
* @param {boolean} value whether to open or close this dialog
|
|
131
|
+
*/
|
|
132
|
+
setOpen: function(e) {
|
|
133
|
+
e ? this.dialog_.hasAttribute("open") || this.dialog_.setAttribute("open", "") : (this.dialog_.removeAttribute("open"), this.maybeHideModal());
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Handles mouse events ('mouseup', 'mousedown', 'click') on the fake .backdrop element, redirecting them as if
|
|
137
|
+
* they were on the dialog itself.
|
|
138
|
+
*
|
|
139
|
+
* @param {!Event} e to redirect
|
|
140
|
+
*/
|
|
141
|
+
backdropMouseEvent_: function(e) {
|
|
142
|
+
if (this.dialog_.hasAttribute("tabindex"))
|
|
143
|
+
this.dialog_.focus();
|
|
144
|
+
else {
|
|
145
|
+
var t = document.createElement("div");
|
|
146
|
+
this.dialog_.insertBefore(t, this.dialog_.firstChild), t.tabIndex = -1, t.focus(), this.dialog_.removeChild(t);
|
|
147
|
+
}
|
|
148
|
+
var o = document.createEvent("MouseEvents");
|
|
149
|
+
o.initMouseEvent(
|
|
150
|
+
e.type,
|
|
151
|
+
e.bubbles,
|
|
152
|
+
e.cancelable,
|
|
153
|
+
window,
|
|
154
|
+
e.detail,
|
|
155
|
+
e.screenX,
|
|
156
|
+
e.screenY,
|
|
157
|
+
e.clientX,
|
|
158
|
+
e.clientY,
|
|
159
|
+
e.ctrlKey,
|
|
160
|
+
e.altKey,
|
|
161
|
+
e.shiftKey,
|
|
162
|
+
e.metaKey,
|
|
163
|
+
e.button,
|
|
164
|
+
e.relatedTarget
|
|
165
|
+
), this.dialog_.dispatchEvent(o), e.stopPropagation();
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Focuses on the first focusable element within the dialog. This will always blur the current
|
|
169
|
+
* focus, even if nothing within the dialog is found.
|
|
170
|
+
*/
|
|
171
|
+
focus_: function() {
|
|
172
|
+
var e = this.dialog_.querySelector("[autofocus]:not([disabled])");
|
|
173
|
+
!e && this.dialog_.tabIndex >= 0 && (e = this.dialog_), e || (e = v(this.dialog_)), b(document.activeElement), e && e.focus();
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Sets the zIndex for the backdrop and dialog.
|
|
177
|
+
*
|
|
178
|
+
* @param {number} dialogZ
|
|
179
|
+
* @param {number} backdropZ
|
|
180
|
+
*/
|
|
181
|
+
updateZIndex: function(e, t) {
|
|
182
|
+
if (e < t)
|
|
183
|
+
throw new Error("dialogZ should never be < backdropZ");
|
|
184
|
+
this.dialog_.style.zIndex = e, this.backdrop_.style.zIndex = t;
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* Shows the dialog. If the dialog is already open, this does nothing.
|
|
188
|
+
*/
|
|
189
|
+
show: function() {
|
|
190
|
+
this.dialog_.open || (this.setOpen(!0), this.focus_());
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* Show this dialog modally.
|
|
194
|
+
*/
|
|
195
|
+
showModal: function() {
|
|
196
|
+
if (this.dialog_.hasAttribute("open"))
|
|
197
|
+
throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");
|
|
198
|
+
if (!m(this.dialog_))
|
|
199
|
+
throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");
|
|
200
|
+
if (!n.dm.pushDialog(this))
|
|
201
|
+
throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");
|
|
202
|
+
E(this.dialog_.parentElement) && console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"), this.setOpen(!0), this.openAsModal_ = !0, n.needsCentering(this.dialog_) ? (n.reposition(this.dialog_), this.replacedStyleTop_ = !0) : this.replacedStyleTop_ = !1, this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling), this.focus_();
|
|
203
|
+
},
|
|
204
|
+
/**
|
|
205
|
+
* Closes this HTMLDialogElement. This is optional vs clearing the open
|
|
206
|
+
* attribute, however this fires a 'close' event.
|
|
207
|
+
*
|
|
208
|
+
* @param {string=} opt_returnValue to use as the returnValue
|
|
209
|
+
*/
|
|
210
|
+
close: function(e) {
|
|
211
|
+
if (!this.dialog_.hasAttribute("open"))
|
|
212
|
+
throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");
|
|
213
|
+
this.setOpen(!1), e !== void 0 && (this.dialog_.returnValue = e);
|
|
214
|
+
var t = new d("close", {
|
|
215
|
+
bubbles: !1,
|
|
216
|
+
cancelable: !1
|
|
217
|
+
});
|
|
218
|
+
g(this.dialog_, t);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
var n = {};
|
|
222
|
+
n.reposition = function(e) {
|
|
223
|
+
var t = document.body.scrollTop || document.documentElement.scrollTop, o = t + (window.innerHeight - e.offsetHeight) / 2;
|
|
224
|
+
e.style.top = Math.max(t, o) + "px";
|
|
225
|
+
};
|
|
226
|
+
n.isInlinePositionSetByStylesheet = function(e) {
|
|
227
|
+
for (var t = 0; t < document.styleSheets.length; ++t) {
|
|
228
|
+
var o = document.styleSheets[t], i = null;
|
|
229
|
+
try {
|
|
230
|
+
i = o.cssRules;
|
|
231
|
+
} catch {
|
|
232
|
+
}
|
|
233
|
+
if (i)
|
|
234
|
+
for (var a = 0; a < i.length; ++a) {
|
|
235
|
+
var r = i[a], s = null;
|
|
236
|
+
try {
|
|
237
|
+
s = document.querySelectorAll(r.selectorText);
|
|
238
|
+
} catch {
|
|
239
|
+
}
|
|
240
|
+
if (!(!s || !M(s, e))) {
|
|
241
|
+
var u = r.style.getPropertyValue("top"), f = r.style.getPropertyValue("bottom");
|
|
242
|
+
if (u && u !== "auto" || f && f !== "auto")
|
|
243
|
+
return !0;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return !1;
|
|
248
|
+
};
|
|
249
|
+
n.needsCentering = function(e) {
|
|
250
|
+
var t = window.getComputedStyle(e);
|
|
251
|
+
return t.position !== "absolute" || e.style.top !== "auto" && e.style.top !== "" || e.style.bottom !== "auto" && e.style.bottom !== "" ? !1 : !n.isInlinePositionSetByStylesheet(e);
|
|
252
|
+
};
|
|
253
|
+
n.forceRegisterDialog = function(e) {
|
|
254
|
+
if ((window.HTMLDialogElement || e.showModal) && console.warn("This browser already supports <dialog>, the polyfill may not work correctly", e), e.localName !== "dialog")
|
|
255
|
+
throw new Error("Failed to register dialog: The element is not a dialog.");
|
|
256
|
+
new _(
|
|
257
|
+
/** @type {!HTMLDialogElement} */
|
|
258
|
+
e
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
n.registerDialog = function(e) {
|
|
262
|
+
e.showModal || n.forceRegisterDialog(e);
|
|
263
|
+
};
|
|
264
|
+
n.DialogManager = function() {
|
|
265
|
+
this.pendingDialogStack = [];
|
|
266
|
+
var e = this.checkDOM_.bind(this);
|
|
267
|
+
this.overlay = document.createElement("div"), this.overlay.className = "_dialog_overlay", this.overlay.addEventListener("click", (function(t) {
|
|
268
|
+
this.forwardTab_ = void 0, t.stopPropagation(), e([]);
|
|
269
|
+
}).bind(this)), this.handleKey_ = this.handleKey_.bind(this), this.handleFocus_ = this.handleFocus_.bind(this), this.zIndexLow_ = 1e5, this.zIndexHigh_ = 100150, this.forwardTab_ = void 0, "MutationObserver" in window && (this.mo_ = new MutationObserver(function(t) {
|
|
270
|
+
var o = [];
|
|
271
|
+
t.forEach(function(i) {
|
|
272
|
+
for (var a = 0, r; r = i.removedNodes[a]; ++a) {
|
|
273
|
+
if (r instanceof Element)
|
|
274
|
+
r.localName === "dialog" && o.push(r);
|
|
275
|
+
else continue;
|
|
276
|
+
o = o.concat(r.querySelectorAll("dialog"));
|
|
277
|
+
}
|
|
278
|
+
}), o.length && e(o);
|
|
279
|
+
}));
|
|
280
|
+
};
|
|
281
|
+
n.DialogManager.prototype.blockDocument = function() {
|
|
282
|
+
document.documentElement.addEventListener("focus", this.handleFocus_, !0), document.addEventListener("keydown", this.handleKey_), this.mo_ && this.mo_.observe(document, { childList: !0, subtree: !0 });
|
|
283
|
+
};
|
|
284
|
+
n.DialogManager.prototype.unblockDocument = function() {
|
|
285
|
+
document.documentElement.removeEventListener("focus", this.handleFocus_, !0), document.removeEventListener("keydown", this.handleKey_), this.mo_ && this.mo_.disconnect();
|
|
286
|
+
};
|
|
287
|
+
n.DialogManager.prototype.updateStacking = function() {
|
|
288
|
+
for (var e = this.zIndexHigh_, t = 0, o; o = this.pendingDialogStack[t]; ++t)
|
|
289
|
+
o.updateZIndex(--e, --e), t === 0 && (this.overlay.style.zIndex = --e);
|
|
290
|
+
var i = this.pendingDialogStack[0];
|
|
291
|
+
if (i) {
|
|
292
|
+
var a = i.dialog.parentNode || document.body;
|
|
293
|
+
a.appendChild(this.overlay);
|
|
294
|
+
} else this.overlay.parentNode && this.overlay.parentNode.removeChild(this.overlay);
|
|
295
|
+
};
|
|
296
|
+
n.DialogManager.prototype.containedByTopDialog_ = function(e) {
|
|
297
|
+
for (; e = c(e); ) {
|
|
298
|
+
for (var t = 0, o; o = this.pendingDialogStack[t]; ++t)
|
|
299
|
+
if (o.dialog === e)
|
|
300
|
+
return t === 0;
|
|
301
|
+
e = e.parentElement;
|
|
302
|
+
}
|
|
303
|
+
return !1;
|
|
304
|
+
};
|
|
305
|
+
n.DialogManager.prototype.handleFocus_ = function(e) {
|
|
306
|
+
var t = e.composedPath ? e.composedPath()[0] : e.target;
|
|
307
|
+
if (!this.containedByTopDialog_(t) && document.activeElement !== document.documentElement && (e.preventDefault(), e.stopPropagation(), b(
|
|
308
|
+
/** @type {Element} */
|
|
309
|
+
t
|
|
310
|
+
), this.forwardTab_ !== void 0)) {
|
|
311
|
+
var o = this.pendingDialogStack[0], i = o.dialog, a = i.compareDocumentPosition(t);
|
|
312
|
+
return a & Node.DOCUMENT_POSITION_PRECEDING && (this.forwardTab_ ? o.focus_() : t !== document.documentElement && document.documentElement.focus()), !1;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
n.DialogManager.prototype.handleKey_ = function(e) {
|
|
316
|
+
if (this.forwardTab_ = void 0, e.keyCode === 27) {
|
|
317
|
+
e.preventDefault(), e.stopPropagation();
|
|
318
|
+
var t = new d("cancel", {
|
|
319
|
+
bubbles: !1,
|
|
320
|
+
cancelable: !0
|
|
321
|
+
}), o = this.pendingDialogStack[0];
|
|
322
|
+
o && g(o.dialog, t) && o.dialog.close();
|
|
323
|
+
} else e.keyCode === 9 && (this.forwardTab_ = !e.shiftKey);
|
|
324
|
+
};
|
|
325
|
+
n.DialogManager.prototype.checkDOM_ = function(e) {
|
|
326
|
+
var t = this.pendingDialogStack.slice();
|
|
327
|
+
t.forEach(function(o) {
|
|
328
|
+
e.indexOf(o.dialog) !== -1 ? o.downgradeModal() : o.maybeHideModal();
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
n.DialogManager.prototype.pushDialog = function(e) {
|
|
332
|
+
var t = (this.zIndexHigh_ - this.zIndexLow_) / 2 - 1;
|
|
333
|
+
return this.pendingDialogStack.length >= t ? !1 : (this.pendingDialogStack.unshift(e) === 1 && this.blockDocument(), this.updateStacking(), !0);
|
|
334
|
+
};
|
|
335
|
+
n.DialogManager.prototype.removeDialog = function(e) {
|
|
336
|
+
var t = this.pendingDialogStack.indexOf(e);
|
|
337
|
+
t !== -1 && (this.pendingDialogStack.splice(t, 1), this.pendingDialogStack.length === 0 && this.unblockDocument(), this.updateStacking());
|
|
338
|
+
};
|
|
339
|
+
n.dm = new n.DialogManager();
|
|
340
|
+
n.formSubmitter = null;
|
|
341
|
+
n.imagemapUseValue = null;
|
|
342
|
+
if (window.HTMLDialogElement === void 0) {
|
|
343
|
+
var p = document.createElement("form");
|
|
344
|
+
if (p.setAttribute("method", "dialog"), p.method !== "dialog") {
|
|
345
|
+
var l = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "method");
|
|
346
|
+
if (l) {
|
|
347
|
+
var k = l.get;
|
|
348
|
+
l.get = function() {
|
|
349
|
+
return h(this) ? "dialog" : k.call(this);
|
|
350
|
+
};
|
|
351
|
+
var S = l.set;
|
|
352
|
+
l.set = function(e) {
|
|
353
|
+
return typeof e == "string" && e.toLowerCase() === "dialog" ? this.setAttribute("method", e) : S.call(this, e);
|
|
354
|
+
}, Object.defineProperty(HTMLFormElement.prototype, "method", l);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
document.addEventListener("click", function(e) {
|
|
358
|
+
if (n.formSubmitter = null, n.imagemapUseValue = null, !e.defaultPrevented) {
|
|
359
|
+
var t = (
|
|
360
|
+
/** @type {Element} */
|
|
361
|
+
e.target
|
|
362
|
+
);
|
|
363
|
+
if ("composedPath" in e) {
|
|
364
|
+
var o = e.composedPath();
|
|
365
|
+
t = o.shift() || t;
|
|
366
|
+
}
|
|
367
|
+
if (!(!t || !h(t.form))) {
|
|
368
|
+
var i = t.type === "submit" && ["button", "input"].indexOf(t.localName) > -1;
|
|
369
|
+
if (!i) {
|
|
370
|
+
if (!(t.localName === "input" && t.type === "image"))
|
|
371
|
+
return;
|
|
372
|
+
n.imagemapUseValue = e.offsetX + "," + e.offsetY;
|
|
373
|
+
}
|
|
374
|
+
var a = c(t);
|
|
375
|
+
a && (n.formSubmitter = t);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}, !1), document.addEventListener("submit", function(e) {
|
|
379
|
+
var t = e.target, o = c(t);
|
|
380
|
+
if (!o) {
|
|
381
|
+
var i = y(e), a = i && i.getAttribute("formmethod") || t.getAttribute("method");
|
|
382
|
+
a === "dialog" && e.preventDefault();
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
var T = HTMLFormElement.prototype.submit, x = function() {
|
|
386
|
+
if (!h(this))
|
|
387
|
+
return T.call(this);
|
|
388
|
+
var e = c(this);
|
|
389
|
+
e && e.close();
|
|
390
|
+
};
|
|
391
|
+
HTMLFormElement.prototype.submit = x;
|
|
392
|
+
}
|
|
393
|
+
export {
|
|
394
|
+
n as default
|
|
395
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./element-BSypUpzA.cjs"),c=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const e=require("./element-BSypUpzA.cjs"),c=require("./pkt-slot-controller-Da-RgXfS.cjs"),l=require("./class-map-DCyaICmy.cjs"),n=require("./ref-BvbyvXRH.cjs");var p=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(a,t,o,i)=>{for(var s=i>1?void 0:i?d(t,o):t,h=a.length-1,u;h>=0;h--)(u=a[h])&&(s=(i?u(t,o,s):u(s))||s);return i&&s&&p(t,o,s),s};exports.PktHeading=class extends e.PktElement{constructor(){super(),this.defaultSlot=n.e(),this.size="medium",this.level=2,this.noSpacing=!0,this.visuallyHidden=!1,this.align="start",this.slotController=new c.PktSlotController(this,this.defaultSlot)}render(){const t={"pkt-heading":!0,[`pkt-heading--${this.size}`]:this.size,"pkt-heading--noSpacing":this.noSpacing,"pkt-sr-only":this.visuallyHidden,[`pkt-heading--${this.align}`]:this.align};switch(this.level){case 2:return e.x`<h2 class=${l.e(t)} ${n.n(this.defaultSlot)}></h2>`;case 3:return e.x`<h3 class=${l.e(t)} ${n.n(this.defaultSlot)}></h3>`;case 4:return e.x`<h4 class=${l.e(t)} ${n.n(this.defaultSlot)}></h4>`;case 5:return e.x`<h5 class=${l.e(t)} ${n.n(this.defaultSlot)}></h5>`;case 6:return e.x`<h6 class=${l.e(t)} ${n.n(this.defaultSlot)}></h6>`;case 1:default:return e.x`<h1 class=${l.e(t)} ${n.n(this.defaultSlot)}></h1>`}}};r([e.n({type:String,reflect:!0})],exports.PktHeading.prototype,"size",2);r([e.n({type:Number,reflect:!0})],exports.PktHeading.prototype,"level",2);r([e.n({type:Boolean,reflect:!0})],exports.PktHeading.prototype,"noSpacing",2);r([e.n({type:Boolean,reflect:!0})],exports.PktHeading.prototype,"visuallyHidden",2);r([e.n({type:String,reflect:!0})],exports.PktHeading.prototype,"align",2);exports.PktHeading=r([e.t("pkt-heading")],exports.PktHeading);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as f, x as l, n as o, a as d } from "./element-DjjF_tEh.js";
|
|
2
|
-
import { P as g } from "./pkt-slot-controller-
|
|
2
|
+
import { P as g } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
3
3
|
import { e as r } from "./class-map-KyMqi0fa.js";
|
|
4
4
|
import { e as $, n as i } from "./ref-iIffqQAI.js";
|
|
5
5
|
var S = Object.defineProperty, y = Object.getOwnPropertyDescriptor, a = (t, n, p, h) => {
|
|
@@ -5,7 +5,7 @@ import { e as _ } from "./class-map-KyMqi0fa.js";
|
|
|
5
5
|
import { r as w } from "./state-BtbpSrdV.js";
|
|
6
6
|
import { u as v } from "./stringutils-DJjRa8dG.js";
|
|
7
7
|
import { s as k } from "./input-wrapper-8iKEzDRZ.js";
|
|
8
|
-
import { P as b } from "./pkt-slot-controller-
|
|
8
|
+
import { P as b } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
9
9
|
var D = Object.defineProperty, O = Object.getOwnPropertyDescriptor, n = (r, o, s, t) => {
|
|
10
10
|
for (var e = t > 1 ? void 0 : t ? O(o, s) : o, l = r.length - 1, h; l >= 0; l--)
|
|
11
11
|
(h = r[l]) && (e = (t ? h(o, s, e) : h(e)) || e);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./element-BSypUpzA.cjs"),x=require("./ref-BvbyvXRH.cjs"),h=require("./icon-BnKGwYjj.cjs"),u=require("./class-map-DCyaICmy.cjs"),c=require("./state-B5KCNjEd.cjs"),a=require("./stringutils-CkVRq4jP.cjs"),d=require("./input-wrapper-EoSAbU-U.cjs"),k=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const e=require("./element-BSypUpzA.cjs"),x=require("./ref-BvbyvXRH.cjs"),h=require("./icon-BnKGwYjj.cjs"),u=require("./class-map-DCyaICmy.cjs"),c=require("./state-B5KCNjEd.cjs"),a=require("./stringutils-CkVRq4jP.cjs"),d=require("./input-wrapper-EoSAbU-U.cjs"),k=require("./pkt-slot-controller-Da-RgXfS.cjs");var _=Object.defineProperty,w=Object.getOwnPropertyDescriptor,r=(s,p,l,n)=>{for(var t=n>1?void 0:n?w(p,l):p,o=s.length-1,i;o>=0;o--)(i=s[o])&&(t=(n?i(p,l,t):i(t))||t);return n&&t&&_(p,l,t),t};exports.PktHelptext=class extends e.PktElement{constructor(){super(),this.defaultSlot=x.e(),this.forId=a.uuidish(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=d.specs.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.slotController=new k.PktSlotController(this,this.defaultSlot)}render(){const p=()=>{const t=!this.isHelpTextOpen;this.isHelpTextOpen=t,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:t}}))},l=()=>this.helptextDropdown?e.x`<div class="pkt-inputwrapper__helptext-expandable">
|
|
2
2
|
<button
|
|
3
3
|
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
4
4
|
type="button"
|
package/dist/index.d.ts
CHANGED
|
@@ -751,6 +751,7 @@ declare class PktInputElement<T = {}> extends PktElement<Props_2 & T> {
|
|
|
751
751
|
protected onBlur(): void;
|
|
752
752
|
protected onInput(): void;
|
|
753
753
|
protected onChange(value: string | string[]): void;
|
|
754
|
+
protected formResetCallback(): void;
|
|
754
755
|
protected updated(_changedProperties: PropertyValues): void;
|
|
755
756
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
756
757
|
}
|
|
@@ -907,6 +908,7 @@ export declare class PktModal extends PktElement implements IPktModal {
|
|
|
907
908
|
constructor();
|
|
908
909
|
connectedCallback(): Promise<void>;
|
|
909
910
|
disconnectedCallback(): void;
|
|
911
|
+
protected firstUpdated(_changedProperties: PropertyValues): Promise<void>;
|
|
910
912
|
private handleKeyDown;
|
|
911
913
|
private handleBackdropClick;
|
|
912
914
|
private isElementInViewport;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./element-BSypUpzA.cjs"),f=require("./state-B5KCNjEd.cjs"),c=require("./stringutils-CkVRq4jP.cjs"),y=require("./input-wrapper-EoSAbU-U.cjs");var m=Object.defineProperty,s=(o,t,a,n)=>{for(var r=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(r=h(t,a,r)||r);return r&&m(t,a,r),r};class i extends e.PktElement{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=c.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=y.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.translations.forms.labels.optional,this.requiredText=e.translations.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){var a,n,r,l,h,u,p,d;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.translations.forms.messages.required,t):(a=t.validity)!=null&&a.typeMismatch||(n=t.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},e.translations.forms.messages.invalid,t):(r=t.validity)!=null&&r.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.translations.forms.messages.invalidPattern,t):(l=t.validity)!=null&&l.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.translations.forms.messages.tooShort,t):(h=t.validity)!=null&&h.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.translations.forms.messages.tooLong,t):(u=t.validity)!=null&&u.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.translations.forms.messages.rangeUnderflow,t):(p=t.validity)!=null&&p.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.translations.forms.messages.rangeOverflow,t):(d=t.validity)!=null&&d.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({}))}setFormValue(t){if(this.internals)if(Array.isArray(t)){const a=new FormData;t.forEach(n=>{a.append(this.name,n)}),this.internals.setFormValue(a)}else this.internals.setFormValue(t)}valueChecked(t){if(!this.touched)return;const a=this.internals.form||this.closest("form");a&&a.querySelectorAll(`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`).forEach(n=>{const r=n;r.name===this.name&&r.value!==this.value&&r.checked&&(r.checked=!1)}),typeof t=="string"?(this.checked=t==="true",this.internals.ariaChecked=t==="true"):typeof t=="boolean"&&(this.checked=t,this.internals.ariaChecked=t),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue("",""),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(t,a){(a!==this.value||a!==this._value)&&(typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=this.multiple||this.range?t:t[0],this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&a&&a.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(a==null?void 0:a.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}onChange(t){if(!this.touched){this.touched=!0,t&&this.setFormValue(t);return}typeof t!="string"&&!Array.isArray(t)||((this.range||this.multiple)&&!Array.isArray(t)&&t.includes(",")&&(t=t.split(",")),!this.multiple&&!this.range&&Array.isArray(t)&&(t=t[0]),this.setFormValue(t),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})),this.internals.reportValidity())}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{t.selected=!1}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}updated(t){super.updated(t),t.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(t){if(super.firstUpdated(t),this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const a=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=a,this.internals.setFormValue(a?this.value||"on":"",a?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}s([e.n()],i.prototype,"defaultValue");s([e.n({type:Boolean,reflect:!0})],i.prototype,"disabled");s([e.n({type:Boolean,reflect:!0})],i.prototype,"readonly");s([e.n({type:Boolean,reflect:!0})],i.prototype,"required");s([e.n({type:Number,reflect:!0})],i.prototype,"max");s([e.n({type:Number,reflect:!0})],i.prototype,"maxlength");s([e.n({type:Number,reflect:!0})],i.prototype,"min");s([e.n({type:Number,reflect:!0})],i.prototype,"minlength");s([e.n({type:String})],i.prototype,"ariaDescribedBy");s([e.n({type:String})],i.prototype,"ariaLabelledby");s([e.n({type:String,reflect:!0})],i.prototype,"name");s([e.n({type:String,reflect:!0})],i.prototype,"pattern");s([e.n({type:String,reflect:!0})],i.prototype,"placeholder");s([e.n({type:String,reflect:!0})],i.prototype,"id");s([e.n({type:Boolean})],i.prototype,"counter");s([e.n({type:Boolean})],i.prototype,"hasError");s([e.n({type:Boolean})],i.prototype,"inline");s([e.n({type:Boolean})],i.prototype,"hasFieldset");s([e.n({type:Boolean})],i.prototype,"optionalTag");s([e.n({type:Boolean})],i.prototype,"requiredTag");s([e.n({type:Boolean})],i.prototype,"skipForwardTestid");s([e.n({type:Boolean,reflect:!1})],i.prototype,"useWrapper");s([e.n({type:Boolean,reflect:!0})],i.prototype,"fullwidth");s([e.n({type:Number})],i.prototype,"counterMaxLength");s([e.n({type:String})],i.prototype,"errorMessage");s([e.n({type:String})],i.prototype,"helptext");s([e.n({type:String})],i.prototype,"helptextDropdown");s([e.n({type:String,reflect:!1})],i.prototype,"helptextDropdownButton");s([e.n({type:String})],i.prototype,"label");s([e.n({type:String,reflect:!1})],i.prototype,"optionalText");s([e.n({type:String,reflect:!1})],i.prototype,"requiredText");s([e.n({type:String,attribute:"data-testid"})],i.prototype,"dataTestid");s([f.r()],i.prototype,"touched");exports.PktInputElement=i;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import { r as
|
|
1
|
+
import { P as c, t as l, n as s } from "./element-DjjF_tEh.js";
|
|
2
|
+
import { r as y } from "./state-BtbpSrdV.js";
|
|
3
3
|
import { u as m } from "./stringutils-DJjRa8dG.js";
|
|
4
4
|
import { s as g } from "./input-wrapper-8iKEzDRZ.js";
|
|
5
|
-
var v = Object.defineProperty, e = (
|
|
6
|
-
for (var
|
|
7
|
-
(o =
|
|
8
|
-
return
|
|
5
|
+
var v = Object.defineProperty, e = (u, t, a, h) => {
|
|
6
|
+
for (var r = void 0, n = u.length - 1, o; n >= 0; n--)
|
|
7
|
+
(o = u[n]) && (r = o(t, a, r) || r);
|
|
8
|
+
return r && v(t, a, r), r;
|
|
9
9
|
};
|
|
10
|
-
class i extends
|
|
10
|
+
class i extends c {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(), this.defaultValue = null, this.disabled = !1, this.readonly = !1, this.required = !1, this.max = null, this.maxlength = null, this.min = null, this.minlength = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = m(), this.counter = !1, this.hasError = !1, this.inline = !1, this.hasFieldset = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = g.props.helptextDropdownButton.default, this.label = null, this.optionalText = l.forms.labels.optional, this.requiredText = l.forms.labels.required, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
|
|
13
13
|
}
|
|
@@ -15,12 +15,12 @@ class i extends y {
|
|
|
15
15
|
return !0;
|
|
16
16
|
}
|
|
17
17
|
manageValidity(t) {
|
|
18
|
-
var
|
|
19
|
-
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, l.forms.messages.required, t) : (
|
|
18
|
+
var a, h, r, n, o, p, d, f;
|
|
19
|
+
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, l.forms.messages.required, t) : (a = t.validity) != null && a.typeMismatch || (h = t.validity) != null && h.badInput ? this.internals.setValidity({ typeMismatch: !0 }, l.forms.messages.invalid, t) : (r = t.validity) != null && r.patternMismatch ? this.internals.setValidity(
|
|
20
20
|
{ patternMismatch: !0 },
|
|
21
21
|
l.forms.messages.invalidPattern,
|
|
22
22
|
t
|
|
23
|
-
) : (
|
|
23
|
+
) : (n = t.validity) != null && n.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, l.forms.messages.tooShort, t) : (o = t.validity) != null && o.tooLong || this.maxlength && this.maxlength > 0 && this.value.length > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, l.forms.messages.tooLong, t) : (p = t.validity) != null && p.rangeUnderflow ? this.internals.setValidity(
|
|
24
24
|
{ rangeUnderflow: !0 },
|
|
25
25
|
l.forms.messages.rangeUnderflow,
|
|
26
26
|
t
|
|
@@ -33,10 +33,10 @@ class i extends y {
|
|
|
33
33
|
setFormValue(t) {
|
|
34
34
|
if (this.internals)
|
|
35
35
|
if (Array.isArray(t)) {
|
|
36
|
-
const
|
|
37
|
-
t.forEach((
|
|
38
|
-
|
|
39
|
-
}), this.internals.setFormValue(
|
|
36
|
+
const a = new FormData();
|
|
37
|
+
t.forEach((h) => {
|
|
38
|
+
a.append(this.name, h);
|
|
39
|
+
}), this.internals.setFormValue(a);
|
|
40
40
|
} else
|
|
41
41
|
this.internals.setFormValue(t);
|
|
42
42
|
}
|
|
@@ -44,12 +44,12 @@ class i extends y {
|
|
|
44
44
|
// Do not use valueChanged or onChange for radios and checkboxes!
|
|
45
45
|
valueChecked(t) {
|
|
46
46
|
if (!this.touched) return;
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const a = this.internals.form || this.closest("form");
|
|
48
|
+
a && a.querySelectorAll(
|
|
49
49
|
`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`
|
|
50
|
-
).forEach((
|
|
51
|
-
const
|
|
52
|
-
|
|
50
|
+
).forEach((h) => {
|
|
51
|
+
const r = h;
|
|
52
|
+
r.name === this.name && r.value !== this.value && r.checked && (r.checked = !1);
|
|
53
53
|
}), typeof t == "string" ? (this.checked = t === "true", this.internals.ariaChecked = t === "true") : typeof t == "boolean" && (this.checked = t, this.internals.ariaChecked = t), this.checked ? (this.internals.setFormValue(this.value || "on", this.value || "on"), this.internals.states.add("--checked")) : (this.internals.setFormValue("", ""), this.internals.states.delete("--checked")), this.dispatchEvent(new Event("change")), this.dispatchEvent(
|
|
54
54
|
new CustomEvent("value-change", {
|
|
55
55
|
detail: this.checked,
|
|
@@ -58,8 +58,8 @@ class i extends y {
|
|
|
58
58
|
})
|
|
59
59
|
), this.internals.reportValidity();
|
|
60
60
|
}
|
|
61
|
-
valueChanged(t,
|
|
62
|
-
(
|
|
61
|
+
valueChanged(t, a) {
|
|
62
|
+
(a !== this.value || a !== this._value) && (typeof t == "string" ? ((this.multiple || this.range) && t.includes(",") && (t = t.split(",")), this.value = t, this._value = Array.isArray(t) ? t : [t]) : Array.isArray(t) ? (this.value = this.multiple || this.range ? t : t[0], this._value = t) : (this.value = "", this._value = []), (!this.value || this.value.length === 0) && a && a.length !== 0 ? this.clearInputValue() : this.value && this.value.toString() !== (a == null ? void 0 : a.toString()) && this.onChange(this.value), this.updateComplete.then(() => this.requestUpdate()));
|
|
63
63
|
}
|
|
64
64
|
// When input goes from content to no content
|
|
65
65
|
clearInputValue() {
|
|
@@ -98,15 +98,20 @@ class i extends y {
|
|
|
98
98
|
})
|
|
99
99
|
), this.internals.reportValidity());
|
|
100
100
|
}
|
|
101
|
+
formResetCallback() {
|
|
102
|
+
this.touched = !1, this._options && this._options.length && this._options.forEach((t) => {
|
|
103
|
+
t.selected = !1;
|
|
104
|
+
}), this.checked !== void 0 ? (this.checked = !1, this.internals.ariaChecked = !1, this.internals.setFormValue("", ""), this.inputRef.value.checked = !1, this.valueChecked(this.checked)) : (this.internals.setFormValue(""), this.value = this.defaultValue || (this.multiple || this.range ? [] : ""), this._value = this.value, this.valueChanged(this.value, null)), this.internals.ariaInvalid = !1;
|
|
105
|
+
}
|
|
101
106
|
updated(t) {
|
|
102
107
|
super.updated(t), t.has("dataTestid") && this.dataTestid && this.inputRef.value && (this.skipForwardTestid ? this.hasAttribute("data-testid") || this.setAttribute("data-testid", this.dataTestid) : (this.inputRef.value.dataset.testid = this.dataTestid, this.removeAttribute("data-testid")));
|
|
103
108
|
}
|
|
104
109
|
firstUpdated(t) {
|
|
105
110
|
if (super.firstUpdated(t), this.value && this.defaultValue !== null && (this.defaultValue = this.value), this.defaultValue !== null && !this.value && this.valueChanged(this.defaultValue, null), this.defaultChecked && (this.internals.ariaChecked = !0, this.checked = !0), this.required && (this.internals.ariaRequired = !0), this.disabled && (this.internals.ariaDisabled = !0), this.id && !this.name && (this.name = this.id), this.checked !== void 0) {
|
|
106
|
-
const
|
|
107
|
-
this.internals.ariaChecked =
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
const a = this.checked === "" || this.checked === "true" || this.checked === !0;
|
|
112
|
+
this.internals.ariaChecked = a, this.internals.setFormValue(
|
|
113
|
+
a ? this.value || "on" : "",
|
|
114
|
+
a ? this.value || "on" : ""
|
|
110
115
|
);
|
|
111
116
|
} else
|
|
112
117
|
this.internals.setFormValue(this.value);
|
|
@@ -210,7 +215,7 @@ e([
|
|
|
210
215
|
s({ type: String, attribute: "data-testid" })
|
|
211
216
|
], i.prototype, "dataTestid");
|
|
212
217
|
e([
|
|
213
|
-
|
|
218
|
+
y()
|
|
214
219
|
], i.prototype, "touched");
|
|
215
220
|
export {
|
|
216
221
|
i as P
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-BSypUpzA.cjs"),b=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const t=require("./element-BSypUpzA.cjs"),b=require("./pkt-slot-controller-Da-RgXfS.cjs"),a=require("./ref-BvbyvXRH.cjs"),y=require("./icon-BnKGwYjj.cjs"),c=require("./class-map-DCyaICmy.cjs"),f=require("./state-B5KCNjEd.cjs"),$=require("./stringutils-CkVRq4jP.cjs"),p=require("./input-wrapper-EoSAbU-U.cjs");require("./helptext-bMgnhZ1R.cjs");var I=Object.defineProperty,P=Object.getOwnPropertyDescriptor,e=(u,r,i,o)=>{for(var s=o>1?void 0:o?P(r,i):r,n=u.length-1,l;n>=0;n--)(l=u[n])&&(s=(o?l(r,i,s):l(s))||s);return o&&s&&I(r,i,s),s};exports.PktInputWrapper=class extends t.PktElement{constructor(){super(),this.defaultSlot=a.e(),this.helptextSlot=a.e(),this.hasHelptextSlot=!0,this.forId=$.uuidish(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=p.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=p.specs.props.optionalTag.default,this.optionalText=p.specs.props.optionalText.default,this.requiredTag=p.specs.props.requiredTag.default,this.requiredText=p.specs.props.requiredText.default,this.hasError=p.specs.props.hasError.default,this.errorMessage="",this.disabled=p.specs.props.disabled.default,this.inline=p.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=p.specs.props.hasFieldset.default,this.useWrapper=p.specs.props.useWrapper.default,this.role="group",this.slotController=new b.PktSlotController(this,this.defaultSlot,this.helptextSlot)}updateSlots(r){this.hasHelptextSlot=r.has("helptext"),this.requestUpdate()}updated(r){super.updated(r)}render(){const r={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},i={"pkt-tag":!0,"pkt-tag--small":!0,"pkt-tag--thin-text":!0,"pkt-tag--blue-light":this.optionalTag,"pkt-tag--beige":!this.optionalTag&&this.requiredTag},o=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:t.E,s=()=>this.optionalTag||this.requiredTag?t.x`<span class=${c.e(i)}
|
|
2
2
|
>${this.optionalTag?this.optionalText:this.requiredTag?this.requiredText:t.E}</span
|
|
3
3
|
>`:t.E,n=()=>this.useWrapper?this.hasFieldset?t.x`<legend
|
|
4
4
|
class="pkt-inputwrapper__legend"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { P as m, E as s, x as p, n as r, a as k } from "./element-DjjF_tEh.js";
|
|
2
|
-
import { P as v } from "./pkt-slot-controller-
|
|
2
|
+
import { P as v } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
3
3
|
import { e as f, n as g } from "./ref-iIffqQAI.js";
|
|
4
4
|
import { o as w } from "./icon-Beoxup8E.js";
|
|
5
5
|
import { e as b } from "./class-map-KyMqi0fa.js";
|
|
6
6
|
import { r as S } from "./state-BtbpSrdV.js";
|
|
7
7
|
import { u as T } from "./stringutils-DJjRa8dG.js";
|
|
8
8
|
import { s as i } from "./input-wrapper-8iKEzDRZ.js";
|
|
9
|
-
import "./helptext-
|
|
9
|
+
import "./helptext-DcSUjjEq.js";
|
|
10
10
|
var E = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, e = (o, h, a, n) => {
|
|
11
11
|
for (var l = n > 1 ? void 0 : n ? _(h, a) : h, u = o.length - 1, d; u >= 0; u--)
|
|
12
12
|
(d = o[u]) && (l = (n ? d(h, a, l) : d(l)) || l);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as f, E as u, x as h, n as i, a as k } from "./element-DjjF_tEh.js";
|
|
2
|
-
import { P as m } from "./pkt-slot-controller-
|
|
2
|
+
import { P as m } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
3
3
|
import { e as d, n as P } from "./ref-iIffqQAI.js";
|
|
4
4
|
import { e as g } from "./class-map-KyMqi0fa.js";
|
|
5
5
|
import "./icon-Beoxup8E.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-BSypUpzA.cjs"),k=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const t=require("./element-BSypUpzA.cjs"),k=require("./pkt-slot-controller-Da-RgXfS.cjs"),p=require("./ref-BvbyvXRH.cjs"),h=require("./class-map-DCyaICmy.cjs");require("./icon-BnKGwYjj.cjs");const f={href:{default:"#"},target:{default:"_self"},external:{default:!1}},a={props:f};var u=Object.defineProperty,P=Object.getOwnPropertyDescriptor,n=(o,i,s,r)=>{for(var e=r>1?void 0:r?P(i,s):i,l=o.length-1,c;l>=0;l--)(c=o[l])&&(e=(r?c(i,s,e):c(e))||e);return r&&e&&u(i,s,e),e};exports.PktLink=class extends t.PktElement{constructor(){super(),this.defaultSlot=p.e(),this.href=a.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=a.props.external.default,this.target=a.props.target.default,this.slotController=new k.PktSlotController(this,this.defaultSlot)}render(){const i={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return t.x`<a
|
|
2
2
|
class=${h.e(i)}
|
|
3
3
|
href=${this.href}
|
|
4
4
|
@click=${this.handleClick}
|