@oslokommune/punkt-react 16.21.0 → 16.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,315 +0,0 @@
1
-
2
- if (typeof HTMLElement === 'undefined') { globalThis.HTMLElement = function() {} };
3
- if (typeof document === 'undefined') {
4
- globalThis.document = {
5
- createTreeWalker: function() {
6
- return {
7
- currentNode: null,
8
- nextNode: function() { return null; },
9
- previousNode: function() { return null; },
10
- parentNode: function() { return null; },
11
- firstChild: function() { return null; },
12
- lastChild: function() { return null; },
13
- previousSibling: function() { return null; },
14
- nextSibling: function() { return null; }
15
- };
16
- },
17
- getElementsByTagName: function() { return []; },
18
- querySelectorAll: function() { return []; },
19
- querySelector: function() {
20
- return {
21
- querySelectorAll: function() { return []; },
22
- getElementsByTagName: function() { return []; }
23
- };
24
- },
25
- }
26
- };
27
- if (typeof customElements === 'undefined') { globalThis.customElements = { define: function() {} }; }
28
- if (typeof window === 'undefined') { globalThis.window = globalThis; }
29
- if (typeof SVGElement === 'undefined') { globalThis.SVGElement = function() {} };
30
- if (typeof Element === 'undefined') {
31
- globalThis.Element = function() {};
32
- globalThis.Element.prototype.querySelectorAll = function() {
33
- return [];
34
- };
35
- }
36
- //#region ../elements/dist/dialog-polyfill.esm-0dVT8G1o.js
37
- var e = window.CustomEvent;
38
- (!e || typeof e == "object") && (e = function(e, t) {
39
- t ||= {};
40
- var n = document.createEvent("CustomEvent");
41
- return n.initCustomEvent(e, !!t.bubbles, !!t.cancelable, t.detail || null), n;
42
- }, e.prototype = window.Event.prototype);
43
- function t(e, t) {
44
- var n = "on" + t.type.toLowerCase();
45
- return typeof e[n] == "function" && e[n](t), e.dispatchEvent(t);
46
- }
47
- function n(e) {
48
- for (; e && e !== document.body;) {
49
- var t = window.getComputedStyle(e), n = function(e, n) {
50
- return !(t[e] === void 0 || t[e] === n);
51
- };
52
- if (t.opacity < 1 || n("zIndex", "auto") || n("transform", "none") || n("mixBlendMode", "normal") || n("filter", "none") || n("perspective", "none") || t.isolation === "isolate" || t.position === "fixed" || t.webkitOverflowScrolling === "touch") return !0;
53
- e = e.parentElement;
54
- }
55
- return !1;
56
- }
57
- function r(e) {
58
- for (; e;) {
59
- if (e.localName === "dialog") return e;
60
- e = e.parentElement ? e.parentElement : e.parentNode ? e.parentNode.host : null;
61
- }
62
- return null;
63
- }
64
- function i(e) {
65
- for (; e && e.shadowRoot && e.shadowRoot.activeElement;) e = e.shadowRoot.activeElement;
66
- e && e.blur && e !== document.body && e.blur();
67
- }
68
- function a(e, t) {
69
- for (var n = 0; n < e.length; ++n) if (e[n] === t) return !0;
70
- return !1;
71
- }
72
- function o(e) {
73
- return !e || !e.hasAttribute("method") ? !1 : e.getAttribute("method").toLowerCase() === "dialog";
74
- }
75
- function s(e) {
76
- var t = [
77
- "button",
78
- "input",
79
- "keygen",
80
- "select",
81
- "textarea"
82
- ].map(function(e) {
83
- return e + ":not([disabled])";
84
- });
85
- t.push("[tabindex]:not([disabled]):not([tabindex=\"\"])");
86
- var n = e.querySelector(t.join(", "));
87
- if (!n && "attachShadow" in Element.prototype) for (var r = e.querySelectorAll("*"), i = 0; i < r.length && !(r[i].tagName && r[i].shadowRoot && (n = s(r[i].shadowRoot), n)); i++);
88
- return n;
89
- }
90
- function c(e) {
91
- return e.isConnected || document.body.contains(e);
92
- }
93
- function l(e) {
94
- if (e.submitter) return e.submitter;
95
- var t = e.target;
96
- if (!(t instanceof HTMLFormElement)) return null;
97
- var n = f.formSubmitter;
98
- if (!n) {
99
- var r = e.target;
100
- n = ("getRootNode" in r && r.getRootNode() || document).activeElement;
101
- }
102
- return !n || n.form !== t ? null : n;
103
- }
104
- function u(e) {
105
- if (!e.defaultPrevented) {
106
- var t = e.target, n = f.imagemapUseValue, i = l(e);
107
- n === null && i && (n = i.value);
108
- var a = r(t);
109
- a && (i && i.getAttribute("formmethod") || t.getAttribute("method")) === "dialog" && (e.preventDefault(), n == null ? a.close() : a.close(n));
110
- }
111
- }
112
- function d(e) {
113
- 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", u, !1), "returnValue" in e || (e.returnValue = ""), "MutationObserver" in window) new MutationObserver(this.maybeHideModal.bind(this)).observe(e, {
114
- attributes: !0,
115
- attributeFilter: ["open"]
116
- });
117
- else {
118
- var t = !1, n = function() {
119
- t ? this.downgradeModal() : this.maybeHideModal(), t = !1;
120
- }.bind(this), r, i = function(i) {
121
- if (i.target === e) {
122
- var a = "DOMNodeRemoved";
123
- t |= i.type.substr(0, a.length) === a, window.clearTimeout(r), r = window.setTimeout(n, 0);
124
- }
125
- };
126
- [
127
- "DOMAttrModified",
128
- "DOMNodeRemoved",
129
- "DOMNodeRemovedFromDocument"
130
- ].forEach(function(t) {
131
- e.addEventListener(t, i);
132
- });
133
- }
134
- Object.defineProperty(e, "open", {
135
- set: this.setOpen.bind(this),
136
- get: e.hasAttribute.bind(e, "open")
137
- }), 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));
138
- }
139
- d.prototype = {
140
- get dialog() {
141
- return this.dialog_;
142
- },
143
- maybeHideModal: function() {
144
- this.dialog_.hasAttribute("open") && c(this.dialog_) || this.downgradeModal();
145
- },
146
- downgradeModal: function() {
147
- this.openAsModal_ && (this.openAsModal_ = !1, this.dialog_.style.zIndex = "", this.replacedStyleTop_ &&= (this.dialog_.style.top = "", !1), this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_), f.dm.removeDialog(this));
148
- },
149
- setOpen: function(e) {
150
- e ? this.dialog_.hasAttribute("open") || this.dialog_.setAttribute("open", "") : (this.dialog_.removeAttribute("open"), this.maybeHideModal());
151
- },
152
- backdropMouseEvent_: function(e) {
153
- if (this.dialog_.hasAttribute("tabindex")) this.dialog_.focus();
154
- else {
155
- var t = document.createElement("div");
156
- this.dialog_.insertBefore(t, this.dialog_.firstChild), t.tabIndex = -1, t.focus(), this.dialog_.removeChild(t);
157
- }
158
- var n = document.createEvent("MouseEvents");
159
- n.initMouseEvent(e.type, e.bubbles, e.cancelable, window, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget), this.dialog_.dispatchEvent(n), e.stopPropagation();
160
- },
161
- focus_: function() {
162
- var e = this.dialog_.querySelector("[autofocus]:not([disabled])");
163
- !e && this.dialog_.tabIndex >= 0 && (e = this.dialog_), e ||= s(this.dialog_), i(document.activeElement), e && e.focus();
164
- },
165
- updateZIndex: function(e, t) {
166
- if (e < t) throw Error("dialogZ should never be < backdropZ");
167
- this.dialog_.style.zIndex = e, this.backdrop_.style.zIndex = t;
168
- },
169
- show: function() {
170
- this.dialog_.open || (this.setOpen(!0), this.focus_());
171
- },
172
- showModal: function() {
173
- if (this.dialog_.hasAttribute("open")) throw Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");
174
- if (!c(this.dialog_)) throw Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");
175
- if (!f.dm.pushDialog(this)) throw Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");
176
- n(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, f.needsCentering(this.dialog_) ? (f.reposition(this.dialog_), this.replacedStyleTop_ = !0) : this.replacedStyleTop_ = !1, this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling), this.focus_();
177
- },
178
- close: function(n) {
179
- if (!this.dialog_.hasAttribute("open")) throw Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");
180
- this.setOpen(!1), n !== void 0 && (this.dialog_.returnValue = n);
181
- var r = new e("close", {
182
- bubbles: !1,
183
- cancelable: !1
184
- });
185
- t(this.dialog_, r);
186
- }
187
- };
188
- var f = {};
189
- if (f.reposition = function(e) {
190
- var t = document.body.scrollTop || document.documentElement.scrollTop, n = t + (window.innerHeight - e.offsetHeight) / 2;
191
- e.style.top = Math.max(t, n) + "px";
192
- }, f.isInlinePositionSetByStylesheet = function(e) {
193
- for (var t = 0; t < document.styleSheets.length; ++t) {
194
- var n = document.styleSheets[t], r = null;
195
- try {
196
- r = n.cssRules;
197
- } catch {}
198
- if (r) for (var i = 0; i < r.length; ++i) {
199
- var o = r[i], s = null;
200
- try {
201
- s = document.querySelectorAll(o.selectorText);
202
- } catch {}
203
- if (!(!s || !a(s, e))) {
204
- var c = o.style.getPropertyValue("top"), l = o.style.getPropertyValue("bottom");
205
- if (c && c !== "auto" || l && l !== "auto") return !0;
206
- }
207
- }
208
- }
209
- return !1;
210
- }, f.needsCentering = function(e) {
211
- return window.getComputedStyle(e).position !== "absolute" || e.style.top !== "auto" && e.style.top !== "" || e.style.bottom !== "auto" && e.style.bottom !== "" ? !1 : !f.isInlinePositionSetByStylesheet(e);
212
- }, f.forceRegisterDialog = function(e) {
213
- if ((window.HTMLDialogElement || e.showModal) && console.warn("This browser already supports <dialog>, the polyfill may not work correctly", e), e.localName !== "dialog") throw Error("Failed to register dialog: The element is not a dialog.");
214
- new d(e);
215
- }, f.registerDialog = function(e) {
216
- e.showModal || f.forceRegisterDialog(e);
217
- }, f.DialogManager = function() {
218
- this.pendingDialogStack = [];
219
- var e = this.checkDOM_.bind(this);
220
- this.overlay = document.createElement("div"), this.overlay.className = "_dialog_overlay", this.overlay.addEventListener("click", function(t) {
221
- this.forwardTab_ = void 0, t.stopPropagation(), e([]);
222
- }.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) {
223
- var n = [];
224
- t.forEach(function(e) {
225
- for (var t = 0, r; r = e.removedNodes[t]; ++t) {
226
- if (r instanceof Element) r.localName === "dialog" && n.push(r);
227
- else continue;
228
- n = n.concat(r.querySelectorAll("dialog"));
229
- }
230
- }), n.length && e(n);
231
- }));
232
- }, f.DialogManager.prototype.blockDocument = function() {
233
- document.documentElement.addEventListener("focus", this.handleFocus_, !0), document.addEventListener("keydown", this.handleKey_), this.mo_ && this.mo_.observe(document, {
234
- childList: !0,
235
- subtree: !0
236
- });
237
- }, f.DialogManager.prototype.unblockDocument = function() {
238
- document.documentElement.removeEventListener("focus", this.handleFocus_, !0), document.removeEventListener("keydown", this.handleKey_), this.mo_ && this.mo_.disconnect();
239
- }, f.DialogManager.prototype.updateStacking = function() {
240
- for (var e = this.zIndexHigh_, t = 0, n; n = this.pendingDialogStack[t]; ++t) n.updateZIndex(--e, --e), t === 0 && (this.overlay.style.zIndex = --e);
241
- var r = this.pendingDialogStack[0];
242
- r ? (r.dialog.parentNode || document.body).appendChild(this.overlay) : this.overlay.parentNode && this.overlay.parentNode.removeChild(this.overlay);
243
- }, f.DialogManager.prototype.containedByTopDialog_ = function(e) {
244
- for (; e = r(e);) {
245
- for (var t = 0, n; n = this.pendingDialogStack[t]; ++t) if (n.dialog === e) return t === 0;
246
- e = e.parentElement;
247
- }
248
- return !1;
249
- }, f.DialogManager.prototype.handleFocus_ = function(e) {
250
- var t = e.composedPath ? e.composedPath()[0] : e.target;
251
- if (!this.containedByTopDialog_(t) && document.activeElement !== document.documentElement && (e.preventDefault(), e.stopPropagation(), i(t), this.forwardTab_ !== void 0)) {
252
- var n = this.pendingDialogStack[0];
253
- return n.dialog.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_PRECEDING && (this.forwardTab_ ? n.focus_() : t !== document.documentElement && document.documentElement.focus()), !1;
254
- }
255
- }, f.DialogManager.prototype.handleKey_ = function(n) {
256
- if (this.forwardTab_ = void 0, n.keyCode === 27) {
257
- n.preventDefault(), n.stopPropagation();
258
- var r = new e("cancel", {
259
- bubbles: !1,
260
- cancelable: !0
261
- }), i = this.pendingDialogStack[0];
262
- i && t(i.dialog, r) && i.dialog.close();
263
- } else n.keyCode === 9 && (this.forwardTab_ = !n.shiftKey);
264
- }, f.DialogManager.prototype.checkDOM_ = function(e) {
265
- this.pendingDialogStack.slice().forEach(function(t) {
266
- e.indexOf(t.dialog) === -1 ? t.maybeHideModal() : t.downgradeModal();
267
- });
268
- }, f.DialogManager.prototype.pushDialog = function(e) {
269
- var t = (this.zIndexHigh_ - this.zIndexLow_) / 2 - 1;
270
- return this.pendingDialogStack.length >= t ? !1 : (this.pendingDialogStack.unshift(e) === 1 && this.blockDocument(), this.updateStacking(), !0);
271
- }, f.DialogManager.prototype.removeDialog = function(e) {
272
- var t = this.pendingDialogStack.indexOf(e);
273
- t !== -1 && (this.pendingDialogStack.splice(t, 1), this.pendingDialogStack.length === 0 && this.unblockDocument(), this.updateStacking());
274
- }, f.dm = new f.DialogManager(), f.formSubmitter = null, f.imagemapUseValue = null, window.HTMLDialogElement === void 0) {
275
- var p = document.createElement("form");
276
- if (p.setAttribute("method", "dialog"), p.method !== "dialog") {
277
- var m = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "method");
278
- if (m) {
279
- var h = m.get;
280
- m.get = function() {
281
- return o(this) ? "dialog" : h.call(this);
282
- };
283
- var g = m.set;
284
- m.set = function(e) {
285
- return typeof e == "string" && e.toLowerCase() === "dialog" ? this.setAttribute("method", e) : g.call(this, e);
286
- }, Object.defineProperty(HTMLFormElement.prototype, "method", m);
287
- }
288
- }
289
- document.addEventListener("click", function(e) {
290
- if (f.formSubmitter = null, f.imagemapUseValue = null, !e.defaultPrevented) {
291
- var t = e.target;
292
- if ("composedPath" in e && (t = e.composedPath().shift() || t), !(!t || !o(t.form))) {
293
- if (!(t.type === "submit" && ["button", "input"].indexOf(t.localName) > -1)) {
294
- if (!(t.localName === "input" && t.type === "image")) return;
295
- f.imagemapUseValue = e.offsetX + "," + e.offsetY;
296
- }
297
- r(t) && (f.formSubmitter = t);
298
- }
299
- }
300
- }, !1), document.addEventListener("submit", function(e) {
301
- var t = e.target;
302
- if (!r(t)) {
303
- var n = l(e);
304
- (n && n.getAttribute("formmethod") || t.getAttribute("method")) === "dialog" && e.preventDefault();
305
- }
306
- });
307
- var _ = HTMLFormElement.prototype.submit, v = function() {
308
- if (!o(this)) return _.call(this);
309
- var e = r(this);
310
- e && e.close();
311
- };
312
- HTMLFormElement.prototype.submit = v;
313
- }
314
- //#endregion
315
- export { f as default };