@oslokommune/punkt-elements 12.37.1 → 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 +17 -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-iCBnadXj.cjs → button-jdMbbn-e.cjs} +1 -1
- package/dist/{button-BYZHwPtW.js → button-sf_Yzx3X.js} +1 -1
- package/dist/{card-B5zTEmH1.js → card-Cyww1yKr.js} +2 -2
- package/dist/{card-BDcr3PII.cjs → card-DH-3qNgp.cjs} +1 -1
- package/dist/{combobox-Bsaj6Z6Y.js → combobox-CFH5-Ioh.js} +4 -4
- package/dist/{combobox-AbD1tkKx.cjs → combobox-ChFttX7F.cjs} +1 -1
- package/dist/{consent-CFgCfRsF.cjs → consent-BNY1XvpV.cjs} +1 -1
- package/dist/{consent-B888aPfK.js → consent-CTX9zf81.js} +6 -6
- package/dist/{datepicker-cNYYOtBI.js → datepicker-hetVXVX4.js} +3 -3
- package/dist/{datepicker-BAn16Z8U.cjs → datepicker-mhQrHoNJ.cjs} +1 -1
- 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 +1 -0
- 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-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 +20 -20
- 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-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/{select-BO7s0ym6.js → select-CNK8uoVi.js} +3 -3
- package/dist/{select-CsrHon8V.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-BdjszjRh.js → textarea-C9Kj6gGv.js} +2 -2
- package/dist/{textarea-vr4tUfJ3.cjs → textarea-CeUz6coA.cjs} +1 -1
- package/dist/{textinput-DTKG8h7M.cjs → textinput-BArDDwC2.cjs} +1 -1
- package/dist/{textinput-D-hYhwtS.js → textinput-Dj6R0L45.js} +2 -2
- package/package.json +4 -3
- package/src/components/consent/consent.ts +1 -1
- package/src/components/modal/modal.ts +14 -2
- 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
|
@@ -908,6 +908,7 @@ export declare class PktModal extends PktElement implements IPktModal {
|
|
|
908
908
|
constructor();
|
|
909
909
|
connectedCallback(): Promise<void>;
|
|
910
910
|
disconnectedCallback(): void;
|
|
911
|
+
protected firstUpdated(_changedProperties: PropertyValues): Promise<void>;
|
|
911
912
|
private handleKeyDown;
|
|
912
913
|
private handleBackdropClick;
|
|
913
914
|
private isElementInViewport;
|
|
@@ -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}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as f, x as c, n, a as h } from "./element-DjjF_tEh.js";
|
|
2
2
|
import { e as k, n as m } from "./ref-iIffqQAI.js";
|
|
3
|
-
import { P as u } from "./pkt-slot-controller-
|
|
3
|
+
import { P as u } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
4
4
|
import "./icon-Beoxup8E.js";
|
|
5
5
|
var _ = Object.defineProperty, d = Object.getOwnPropertyDescriptor, r = (l, i, s, o) => {
|
|
6
6
|
for (var e = o > 1 ? void 0 : o ? d(i, s) : i, a = l.length - 1, p; a >= 0; a--)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-BSypUpzA.cjs"),k=require("./ref-BvbyvXRH.cjs"),p=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const t=require("./element-BSypUpzA.cjs"),k=require("./ref-BvbyvXRH.cjs"),p=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./icon-BnKGwYjj.cjs");var c=Object.defineProperty,h=Object.getOwnPropertyDescriptor,r=(s,n,i,l)=>{for(var e=l>1?void 0:l?h(n,i):n,o=s.length-1,a;o>=0;o--)(a=s[o])&&(e=(l?a(n,i,e):a(e))||e);return l&&e&&c(n,i,e),e};exports.PktLinkCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=k.e(),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal",this.slotController=new p.PktSlotController(this,this.defaultSlot)}render(){const n=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),i=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return t.x`
|
|
2
2
|
<a
|
|
3
3
|
href=${this.href}
|
|
4
4
|
class=${n}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./element-BSypUpzA.cjs"),d=require("./class-map-DCyaICmy.cjs"),u=require("./state-B5KCNjEd.cjs"),p=require("./ref-BvbyvXRH.cjs"),h=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const e=require("./element-BSypUpzA.cjs"),d=require("./class-map-DCyaICmy.cjs"),u=require("./state-B5KCNjEd.cjs"),p=require("./ref-BvbyvXRH.cjs"),h=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./icon-BnKGwYjj.cjs");var c=Object.defineProperty,y=Object.getOwnPropertyDescriptor,s=(o,t,r,i)=>{for(var a=i>1?void 0:i?y(t,r):t,l=o.length-1,n;l>=0;l--)(n=o[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&c(t,r,a),a};exports.PktLoader=class extends e.PktElement{constructor(){super(),this.defaultSlot=p.e(),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size="medium",this.variant="shapes",this._shouldDisplayLoader=!1,this.slotController=new h.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(t){t.has("delay")&&this.setupLoader()}render(){const t=d.e({"pkt-loader":!0,[`pkt-loader--${this.inline?"inline":"box"}`]:!0,[`pkt-loader--${this.size}`]:!0}),r=d.e({"pkt-contents":!0,"pkt-hide":this.isLoading});return e.x`<div role="status" aria-live="polite" .aria-busy=${this.isLoading} class=${t}>
|
|
2
2
|
${this.isLoading&&this._shouldDisplayLoader?e.x`<div class="pkt-loader__spinner">
|
|
3
3
|
<pkt-icon
|
|
4
4
|
name=${this.getVariant(this.variant)}
|
|
@@ -2,7 +2,7 @@ import { P as u, E as y, x as d, n as o, a as c } from "./element-DjjF_tEh.js";
|
|
|
2
2
|
import { e as h } from "./class-map-KyMqi0fa.js";
|
|
3
3
|
import { r as m } from "./state-BtbpSrdV.js";
|
|
4
4
|
import { e as f, n as v } from "./ref-iIffqQAI.js";
|
|
5
|
-
import { P as _ } from "./pkt-slot-controller-
|
|
5
|
+
import { P as _ } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
6
6
|
import "./icon-Beoxup8E.js";
|
|
7
7
|
var g = Object.defineProperty, L = Object.getOwnPropertyDescriptor, s = (e, a, l, r) => {
|
|
8
8
|
for (var i = r > 1 ? void 0 : r ? L(a, l) : a, p = e.length - 1, n; p >= 0; p--)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./element-BSypUpzA.cjs"),u=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const e=require("./element-BSypUpzA.cjs"),u=require("./pkt-slot-controller-Da-RgXfS.cjs"),n=require("./ref-BvbyvXRH.cjs"),b=require("./class-map-DCyaICmy.cjs"),d=require("./state-B5KCNjEd.cjs");require("./icon-BnKGwYjj.cjs");const k=require("./classutils-BwNK82ZQ.cjs"),h={skin:{default:"beige"},compact:{default:!1},closable:{default:!1}},p={props:h};var f=Object.defineProperty,x=Object.getOwnPropertyDescriptor,o=(i,t,a,l)=>{for(var s=l>1?void 0:l?x(t,a):t,r=i.length-1,c;r>=0;r--)(c=i[r])&&(s=(l?c(t,a,s):c(s))||s);return l&&s&&f(t,a,s),s};exports.PktMessagebox=class extends e.PktElement{constructor(){super(),this.defaultSlot=n.e(),this.closable=p.props.closable.default,this.compact=p.props.compact.default,this.title="",this.skin=p.props.skin.default,this._isClosed=!1,this.close=t=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:t},bubbles:!0}))},this.slotController=new u.PktSlotController(this,this.defaultSlot),this._isClosed=!1}updated(t){super.updated(t),t.has("_isClosed")&&k.updateClassAttribute(this,"pkt-hide",this._isClosed)}render(){const t={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return e.x`<div class=${b.e(t)}>
|
|
2
2
|
${this.closable?e.x`<div class="pkt-messagebox__close">
|
|
3
3
|
<button
|
|
4
4
|
@click=${this.close}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as b, E as u, x as n, n as p, a as m } from "./element-DjjF_tEh.js";
|
|
2
|
-
import { P as h } from "./pkt-slot-controller-
|
|
2
|
+
import { P as h } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
3
3
|
import { e as f, n as k } from "./ref-iIffqQAI.js";
|
|
4
4
|
import { e as _ } from "./class-map-KyMqi0fa.js";
|
|
5
5
|
import { r as v } from "./state-BtbpSrdV.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";const d=require("./class-map-DCyaICmy.cjs"),i=require("./element-BSypUpzA.cjs"),h=require("./state-B5KCNjEd.cjs"),k=require("./pkt-slot-controller-Da-RgXfS.cjs"),r=require("./ref-BvbyvXRH.cjs");require("./icon-BnKGwYjj.cjs");const m={hideCloseButton:{default:!1},closeOnBackdropClick:{default:!1},size:{default:"medium"}},p={props:m};var f=Object.defineProperty,v=Object.getOwnPropertyDescriptor,l=(c,e,t,o)=>{for(var s=o>1?void 0:o?v(e,t):e,n=c.length-1,a;n>=0;n--)(a=c[n])&&(s=(o?a(e,t,s):a(s))||s);return o&&s&&f(e,t,s),s};exports.PktModal=class extends i.PktElement{constructor(){super(),this.headingText="",this.removePadding=!1,this.hideCloseButton=p.props.hideCloseButton.default,this.closeOnBackdropClick=p.props.closeOnBackdropClick.default,this.closeButtonSkin="blue",this.size=p.props.size.default,this.defaultSlot=r.e(),this.dialogRef=r.e(),this._isOpen=!1,this.close=(e,t=!1)=>{var s;if(!this._isOpen)return;this._isOpen=!1,document.body.classList.remove("pkt-modal--open");const o=document.activeElement;o&&!this.isElementInViewport(o)&&o.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),t||(s=this.dialogRef.value)==null||s.close(),this.requestUpdate()},this.showModal=(e=null)=>{var o;this._isOpen=!0,(o=this.dialogRef.value)==null||o.showModal();const t=document.querySelector(".pkt-modal");requestAnimationFrame(()=>{var s;this.dialogRef.value&&((s=this.dialogRef.value)==null||s.focus())}),t&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:e},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new k.PktSlotController(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("click",this.handleBackdropClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("click",this.handleBackdropClick)}async firstUpdated(e){super.firstUpdated(e),this.dialogRef.value&&("document"in window&&"createElement"in document&&(await Promise.resolve().then(()=>require("./dialog-polyfill.esm-CPKZe7AL.cjs")).then(o=>o.default)).registerDialog(this.dialogRef.value),this.dialogRef.value.addEventListener("close",()=>{this.close(new Event("close"),!0)}))}handleKeyDown(e){e.key==="Escape"&&this.close(e)}handleBackdropClick(e){var t;this.closeOnBackdropClick&&e.target===((t=this.dialogRef)==null?void 0:t.value)&&this.close(e)}isElementInViewport(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const e={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,[`pkt-modal--${this.size}`]:this.size!==void 0},t={"pkt-modal__headingText":!0,"pkt-txt-24":!0},o={"pkt-modal__content":!0,"pkt-txt-18-light":!0},s=this.closeButtonSkin==="blue",n={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0},a={"pkt-btn":!0,[`pkt-btn--${s?"tertiary":"primary"}`]:!0,"pkt-btn--icon-only":!0,"pkt-btn--medium":!0};return i.x`
|
|
2
|
+
<dialog
|
|
3
|
+
class=${d.e(e)}
|
|
4
|
+
${r.n(this.dialogRef)}
|
|
5
|
+
aria-labelledby="pkt-modal__headingText"
|
|
6
|
+
aria-describedby="pkt-modal__content"
|
|
7
|
+
@close=${u=>this.close(u,!0)}
|
|
8
|
+
>
|
|
9
|
+
<div class="pkt-modal__header">
|
|
10
|
+
<div class="pkt-modal__header-background"></div>
|
|
11
|
+
${this.headingText?i.x`<h1 id="pkt-modal__headingText" class=${d.e(t)}>
|
|
12
|
+
${this.headingText}
|
|
13
|
+
</h1>`:i.E}
|
|
14
|
+
${this.hideCloseButton?i.E:i.x`<div class="${d.e(n)}">
|
|
15
|
+
<pkt-button
|
|
16
|
+
@click=${u=>this.close(u)}
|
|
17
|
+
class=${d.e(a)}
|
|
18
|
+
aria-label="close"
|
|
19
|
+
iconname="close"
|
|
20
|
+
variant="icon-only"
|
|
21
|
+
>
|
|
22
|
+
</pkt-button>
|
|
23
|
+
</div>`}
|
|
24
|
+
</div>
|
|
25
|
+
<div class="pkt-modal__container">
|
|
26
|
+
<div
|
|
27
|
+
id="pkt-modal__content"
|
|
28
|
+
class=${d.e(o)}
|
|
29
|
+
${r.n(this.defaultSlot)}
|
|
30
|
+
></div>
|
|
31
|
+
</div>
|
|
32
|
+
</dialog>
|
|
33
|
+
`}};l([i.n({type:String,reflect:!0})],exports.PktModal.prototype,"headingText",2);l([i.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"removePadding",2);l([i.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"hideCloseButton",2);l([i.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"closeOnBackdropClick",2);l([i.n({type:String,reflect:!0})],exports.PktModal.prototype,"closeButtonSkin",2);l([i.n({type:String,reflect:!0})],exports.PktModal.prototype,"size",2);l([h.r()],exports.PktModal.prototype,"_isOpen",2);exports.PktModal=l([i.t("pkt-modal")],exports.PktModal);
|