quirk-ui 0.1.209 → 0.1.211
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/dist/core/components/Modal/Modal.test.cjs +4 -4
- package/dist/core/components/Modal/Modal.test.mjs +106 -101
- package/dist/core/components/Modal/index.cjs +1 -1
- package/dist/core/components/Modal/index.mjs +75 -79
- package/dist/core.d.ts +0 -2
- package/dist/index38.css +1 -1
- package/dist/main.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
-
import { j as Q, d as
|
|
3
|
-
import { Modal as
|
|
2
|
+
import { j as Q, d as U, b as sn, i as C, r as I, s as y, g as w, w as fe, v as Je } from "../../../react.esm-DKyXDL7m.js";
|
|
3
|
+
import { Modal as _ } from "./index.mjs";
|
|
4
4
|
import "../../../index-DPGXWTtt.js";
|
|
5
5
|
function a(e, t, n) {
|
|
6
6
|
return e.namespaceURI && e.namespaceURI !== "http://www.w3.org/1999/xhtml" || (t = Array.isArray(t) ? t : [
|
|
@@ -315,11 +315,11 @@ function ye(e) {
|
|
|
315
315
|
function yn(e) {
|
|
316
316
|
return e.nodeType === 1 ? e : e.parentElement;
|
|
317
317
|
}
|
|
318
|
-
var
|
|
318
|
+
var _t = /* @__PURE__ */ function(e) {
|
|
319
319
|
return e.button = "button", e.color = "color", e.file = "file", e.image = "image", e.reset = "reset", e.submit = "submit", e.checkbox = "checkbox", e.radio = "radio", e;
|
|
320
|
-
}(
|
|
321
|
-
function
|
|
322
|
-
return a(e, "button") || a(e, "input") && e.type in
|
|
320
|
+
}(_t || {});
|
|
321
|
+
function St(e) {
|
|
322
|
+
return a(e, "button") || a(e, "input") && e.type in _t;
|
|
323
323
|
}
|
|
324
324
|
function ne(e) {
|
|
325
325
|
return Ot(e) && !e.readOnly || Y(e);
|
|
@@ -334,7 +334,7 @@ function P(e) {
|
|
|
334
334
|
return At(e) && Ot(e);
|
|
335
335
|
}
|
|
336
336
|
function mn(e) {
|
|
337
|
-
return At(e) &&
|
|
337
|
+
return At(e) && St(e);
|
|
338
338
|
}
|
|
339
339
|
function At(e) {
|
|
340
340
|
return e.nodeType === 1;
|
|
@@ -401,7 +401,7 @@ function Mt(e) {
|
|
|
401
401
|
function In(e) {
|
|
402
402
|
return e[Me];
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function _n(e, t) {
|
|
405
405
|
e[M] = t;
|
|
406
406
|
}
|
|
407
407
|
function ue(e, { focusOffset: t, anchorOffset: n = t }, i = "replace") {
|
|
@@ -431,10 +431,10 @@ function me(e) {
|
|
|
431
431
|
endOffset: Math.max(r.anchorOffset, r.focusOffset)
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Sn(e) {
|
|
435
435
|
return !!e[M];
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function Se(e) {
|
|
438
438
|
e[M] = void 0;
|
|
439
439
|
}
|
|
440
440
|
const De = globalThis.parseInt;
|
|
@@ -457,18 +457,18 @@ function Dt(e, t) {
|
|
|
457
457
|
const n = e.cloneNode();
|
|
458
458
|
return n.value = t, n.value === t;
|
|
459
459
|
}
|
|
460
|
-
var
|
|
460
|
+
var xt = /* @__PURE__ */ function(e) {
|
|
461
461
|
return e.email = "email", e.password = "password", e.search = "search", e.telephone = "telephone", e.text = "text", e.url = "url", e;
|
|
462
|
-
}(
|
|
462
|
+
}(xt || {});
|
|
463
463
|
function On(e) {
|
|
464
464
|
var t;
|
|
465
465
|
const n = (t = e.getAttribute("maxlength")) !== null && t !== void 0 ? t : "";
|
|
466
466
|
return /^\d+$/.test(n) && Number(n) >= 0 ? Number(n) : void 0;
|
|
467
467
|
}
|
|
468
468
|
function An(e) {
|
|
469
|
-
return a(e, "textarea") || a(e, "input") && e.type in
|
|
469
|
+
return a(e, "textarea") || a(e, "input") && e.type in xt;
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function Ut(e, t, n, i) {
|
|
472
472
|
if (Pe(e) && t + n >= 0 && t + n <= e.nodeValue.length)
|
|
473
473
|
return {
|
|
474
474
|
node: e,
|
|
@@ -538,7 +538,7 @@ function Dn(e, t, n) {
|
|
|
538
538
|
var i;
|
|
539
539
|
const r = e[`${t}Sibling`];
|
|
540
540
|
if (r) {
|
|
541
|
-
if (e =
|
|
541
|
+
if (e = xn(r, t === "next" ? "first" : "last"), n(e))
|
|
542
542
|
return e;
|
|
543
543
|
} else if (e.parentNode && (!qe(e.parentNode) || !Y(e.parentNode) && e.parentNode !== ((i = e.ownerDocument) === null || i === void 0 ? void 0 : i.body)))
|
|
544
544
|
e = e.parentNode;
|
|
@@ -546,17 +546,17 @@ function Dn(e, t, n) {
|
|
|
546
546
|
break;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function xn(e, t) {
|
|
550
550
|
for (; e.hasChildNodes(); )
|
|
551
551
|
e = e[`${t}Child`];
|
|
552
552
|
return e;
|
|
553
553
|
}
|
|
554
554
|
const Ee = Symbol("Track programmatic changes for React workaround");
|
|
555
|
-
function
|
|
555
|
+
function Un(e) {
|
|
556
556
|
return Object.getOwnPropertyNames(e).some((t) => t.startsWith("__react")) && T(e).REACT_VERSION === 17;
|
|
557
557
|
}
|
|
558
558
|
function Nn(e) {
|
|
559
|
-
|
|
559
|
+
Un(e) && (e[Ee] = {
|
|
560
560
|
previousValue: String(e.value),
|
|
561
561
|
tracked: []
|
|
562
562
|
});
|
|
@@ -573,7 +573,7 @@ function Ln(e, t) {
|
|
|
573
573
|
if (e[Ee] = void 0, !(!(i == null || (n = i.tracked) === null || n === void 0) && n.length))
|
|
574
574
|
return;
|
|
575
575
|
const r = i.tracked.length === 2 && i.tracked[0] === i.previousValue && i.tracked[1] === e.value;
|
|
576
|
-
r || We(e),
|
|
576
|
+
r || We(e), Sn(e) && ue(e, {
|
|
577
577
|
focusOffset: r ? t : e.value.length
|
|
578
578
|
});
|
|
579
579
|
}
|
|
@@ -632,7 +632,7 @@ function Rn(e, t, n, i, r) {
|
|
|
632
632
|
"deleteContentBackward",
|
|
633
633
|
"deleteContentForward"
|
|
634
634
|
].includes(r)) {
|
|
635
|
-
const s =
|
|
635
|
+
const s = Ut(n.startContainer, n.startOffset, r === "deleteContentBackward" ? -1 : 1, r);
|
|
636
636
|
if (s) {
|
|
637
637
|
o = !0;
|
|
638
638
|
const u = n.cloneRange();
|
|
@@ -764,7 +764,7 @@ function nt(e, t) {
|
|
|
764
764
|
if (!(n != null && n.focusNode))
|
|
765
765
|
return;
|
|
766
766
|
if (n.isCollapsed) {
|
|
767
|
-
const i =
|
|
767
|
+
const i = Ut(n.focusNode, n.focusOffset, t);
|
|
768
768
|
i && J({
|
|
769
769
|
focusNode: i.node,
|
|
770
770
|
focusOffset: i.offset
|
|
@@ -948,7 +948,7 @@ $.keyup = (e, t, n) => {
|
|
|
948
948
|
};
|
|
949
949
|
const rt = {
|
|
950
950
|
" ": (e, t, n) => {
|
|
951
|
-
if (
|
|
951
|
+
if (St(t))
|
|
952
952
|
return () => n.dispatchUIEvent(t, "click");
|
|
953
953
|
}
|
|
954
954
|
};
|
|
@@ -1291,8 +1291,8 @@ function ti(e) {
|
|
|
1291
1291
|
var b;
|
|
1292
1292
|
const v = (b = e.UIEvent) !== null && b !== void 0 ? b : class extends n {
|
|
1293
1293
|
};
|
|
1294
|
-
var
|
|
1295
|
-
const ce = (
|
|
1294
|
+
var x;
|
|
1295
|
+
const ce = (x = e.CompositionEvent) !== null && x !== void 0 ? x : class extends v {
|
|
1296
1296
|
};
|
|
1297
1297
|
var R;
|
|
1298
1298
|
const de = (R = e.FocusEvent) !== null && R !== void 0 ? R : class extends v {
|
|
@@ -1309,8 +1309,8 @@ function ti(e) {
|
|
|
1309
1309
|
var G;
|
|
1310
1310
|
const nn = (G = e.DragEvent) !== null && G !== void 0 ? G : class extends H {
|
|
1311
1311
|
};
|
|
1312
|
-
var
|
|
1313
|
-
const rn = (
|
|
1312
|
+
var Ue;
|
|
1313
|
+
const rn = (Ue = e.PointerEvent) !== null && Ue !== void 0 ? Ue : class extends H {
|
|
1314
1314
|
};
|
|
1315
1315
|
var Ne;
|
|
1316
1316
|
const on = (Ne = e.TouchEvent) !== null && Ne !== void 0 ? Ne : class extends v {
|
|
@@ -1554,22 +1554,22 @@ function li(e) {
|
|
|
1554
1554
|
Number(n),
|
|
1555
1555
|
...i
|
|
1556
1556
|
],
|
|
1557
|
-
then: () => r ? void 0 :
|
|
1557
|
+
then: () => r ? void 0 : Se(e)
|
|
1558
1558
|
};
|
|
1559
1559
|
}), Z(e, "selectionStart", function(n) {
|
|
1560
1560
|
return {
|
|
1561
1561
|
realArgs: n,
|
|
1562
|
-
then: () =>
|
|
1562
|
+
then: () => Se(e)
|
|
1563
1563
|
};
|
|
1564
1564
|
}), Z(e, "selectionEnd", function(n) {
|
|
1565
1565
|
return {
|
|
1566
1566
|
realArgs: n,
|
|
1567
|
-
then: () =>
|
|
1567
|
+
then: () => Se(e)
|
|
1568
1568
|
};
|
|
1569
1569
|
}), Z(e, "select", function() {
|
|
1570
1570
|
return {
|
|
1571
1571
|
realArgs: [],
|
|
1572
|
-
then: () =>
|
|
1572
|
+
then: () => _n(e, {
|
|
1573
1573
|
anchorOffset: 0,
|
|
1574
1574
|
focusOffset: O(e).length
|
|
1575
1575
|
})
|
|
@@ -1581,7 +1581,7 @@ function ai(e) {
|
|
|
1581
1581
|
return {
|
|
1582
1582
|
realArgs: n,
|
|
1583
1583
|
then: () => {
|
|
1584
|
-
We(e),
|
|
1584
|
+
We(e), Se(e);
|
|
1585
1585
|
}
|
|
1586
1586
|
};
|
|
1587
1587
|
});
|
|
@@ -1614,7 +1614,7 @@ function fi(e) {
|
|
|
1614
1614
|
function pi(e) {
|
|
1615
1615
|
return e.nodeType === 9;
|
|
1616
1616
|
}
|
|
1617
|
-
var
|
|
1617
|
+
var k = /* @__PURE__ */ function(e) {
|
|
1618
1618
|
return e[e.Trigger = 2] = "Trigger", e[e.Call = 1] = "Call", e;
|
|
1619
1619
|
}({});
|
|
1620
1620
|
function be(e, t) {
|
|
@@ -1642,7 +1642,7 @@ function X(e, t, n) {
|
|
|
1642
1642
|
writable: !0
|
|
1643
1643
|
}) : e[t] = n, e;
|
|
1644
1644
|
}
|
|
1645
|
-
var
|
|
1645
|
+
var S = /* @__PURE__ */ function(e) {
|
|
1646
1646
|
return e[e.STANDARD = 0] = "STANDARD", e[e.LEFT = 1] = "LEFT", e[e.RIGHT = 2] = "RIGHT", e[e.NUMPAD = 3] = "NUMPAD", e;
|
|
1647
1647
|
}({});
|
|
1648
1648
|
const hi = [
|
|
@@ -1793,52 +1793,52 @@ const vi = [
|
|
|
1793
1793
|
{
|
|
1794
1794
|
code: "AltLeft",
|
|
1795
1795
|
key: "Alt",
|
|
1796
|
-
location:
|
|
1796
|
+
location: S.LEFT
|
|
1797
1797
|
},
|
|
1798
1798
|
{
|
|
1799
1799
|
code: "AltRight",
|
|
1800
1800
|
key: "Alt",
|
|
1801
|
-
location:
|
|
1801
|
+
location: S.RIGHT
|
|
1802
1802
|
},
|
|
1803
1803
|
{
|
|
1804
1804
|
code: "ShiftLeft",
|
|
1805
1805
|
key: "Shift",
|
|
1806
|
-
location:
|
|
1806
|
+
location: S.LEFT
|
|
1807
1807
|
},
|
|
1808
1808
|
{
|
|
1809
1809
|
code: "ShiftRight",
|
|
1810
1810
|
key: "Shift",
|
|
1811
|
-
location:
|
|
1811
|
+
location: S.RIGHT
|
|
1812
1812
|
},
|
|
1813
1813
|
{
|
|
1814
1814
|
code: "ControlLeft",
|
|
1815
1815
|
key: "Control",
|
|
1816
|
-
location:
|
|
1816
|
+
location: S.LEFT
|
|
1817
1817
|
},
|
|
1818
1818
|
{
|
|
1819
1819
|
code: "ControlRight",
|
|
1820
1820
|
key: "Control",
|
|
1821
|
-
location:
|
|
1821
|
+
location: S.RIGHT
|
|
1822
1822
|
},
|
|
1823
1823
|
{
|
|
1824
1824
|
code: "MetaLeft",
|
|
1825
1825
|
key: "Meta",
|
|
1826
|
-
location:
|
|
1826
|
+
location: S.LEFT
|
|
1827
1827
|
},
|
|
1828
1828
|
{
|
|
1829
1829
|
code: "MetaRight",
|
|
1830
1830
|
key: "Meta",
|
|
1831
|
-
location:
|
|
1831
|
+
location: S.RIGHT
|
|
1832
1832
|
},
|
|
1833
1833
|
{
|
|
1834
1834
|
code: "OSLeft",
|
|
1835
1835
|
key: "OS",
|
|
1836
|
-
location:
|
|
1836
|
+
location: S.LEFT
|
|
1837
1837
|
},
|
|
1838
1838
|
{
|
|
1839
1839
|
code: "OSRight",
|
|
1840
1840
|
key: "OS",
|
|
1841
|
-
location:
|
|
1841
|
+
location: S.RIGHT
|
|
1842
1842
|
},
|
|
1843
1843
|
{
|
|
1844
1844
|
code: "ContextMenu",
|
|
@@ -2150,8 +2150,8 @@ function Ci(e, { document: t, target: n, node: i, offset: r }) {
|
|
|
2150
2150
|
}
|
|
2151
2151
|
}
|
|
2152
2152
|
function Xt(e, t) {
|
|
2153
|
-
var n, i, r, o, s, u, c, d, l, f, h, b, v,
|
|
2154
|
-
return e.target !== t.target || ((n = e.coords) === null || n === void 0 ? void 0 : n.x) !== ((i = t.coords) === null || i === void 0 ? void 0 : i.x) || ((r = e.coords) === null || r === void 0 ? void 0 : r.y) !== ((o = t.coords) === null || o === void 0 ? void 0 : o.y) || ((s = e.coords) === null || s === void 0 ? void 0 : s.clientX) !== ((u = t.coords) === null || u === void 0 ? void 0 : u.clientX) || ((c = e.coords) === null || c === void 0 ? void 0 : c.clientY) !== ((d = t.coords) === null || d === void 0 ? void 0 : d.clientY) || ((l = e.coords) === null || l === void 0 ? void 0 : l.offsetX) !== ((f = t.coords) === null || f === void 0 ? void 0 : f.offsetX) || ((h = e.coords) === null || h === void 0 ? void 0 : h.offsetY) !== ((b = t.coords) === null || b === void 0 ? void 0 : b.offsetY) || ((v = e.coords) === null || v === void 0 ? void 0 : v.pageX) !== ((
|
|
2153
|
+
var n, i, r, o, s, u, c, d, l, f, h, b, v, x, ce, R, de, V, le, K, ae, j, H, G;
|
|
2154
|
+
return e.target !== t.target || ((n = e.coords) === null || n === void 0 ? void 0 : n.x) !== ((i = t.coords) === null || i === void 0 ? void 0 : i.x) || ((r = e.coords) === null || r === void 0 ? void 0 : r.y) !== ((o = t.coords) === null || o === void 0 ? void 0 : o.y) || ((s = e.coords) === null || s === void 0 ? void 0 : s.clientX) !== ((u = t.coords) === null || u === void 0 ? void 0 : u.clientX) || ((c = e.coords) === null || c === void 0 ? void 0 : c.clientY) !== ((d = t.coords) === null || d === void 0 ? void 0 : d.clientY) || ((l = e.coords) === null || l === void 0 ? void 0 : l.offsetX) !== ((f = t.coords) === null || f === void 0 ? void 0 : f.offsetX) || ((h = e.coords) === null || h === void 0 ? void 0 : h.offsetY) !== ((b = t.coords) === null || b === void 0 ? void 0 : b.offsetY) || ((v = e.coords) === null || v === void 0 ? void 0 : v.pageX) !== ((x = t.coords) === null || x === void 0 ? void 0 : x.pageX) || ((ce = e.coords) === null || ce === void 0 ? void 0 : ce.pageY) !== ((R = t.coords) === null || R === void 0 ? void 0 : R.pageY) || ((de = e.coords) === null || de === void 0 ? void 0 : de.screenX) !== ((V = t.coords) === null || V === void 0 ? void 0 : V.screenX) || ((le = e.coords) === null || le === void 0 ? void 0 : le.screenY) !== ((K = t.coords) === null || K === void 0 ? void 0 : K.screenY) || ((ae = e.caret) === null || ae === void 0 ? void 0 : ae.node) !== ((j = t.caret) === null || j === void 0 ? void 0 : j.node) || ((H = e.caret) === null || H === void 0 ? void 0 : H.offset) !== ((G = t.caret) === null || G === void 0 ? void 0 : G.offset);
|
|
2155
2155
|
}
|
|
2156
2156
|
function W(e, t, n) {
|
|
2157
2157
|
return t in e ? Object.defineProperty(e, t, {
|
|
@@ -2273,11 +2273,11 @@ class Ii {
|
|
|
2273
2273
|
}());
|
|
2274
2274
|
}
|
|
2275
2275
|
}
|
|
2276
|
-
function
|
|
2276
|
+
function xe(e, t) {
|
|
2277
2277
|
var n;
|
|
2278
2278
|
return ((n = Wt(e, t)) === null || n === void 0 ? void 0 : n.pointerEvents) !== "none";
|
|
2279
2279
|
}
|
|
2280
|
-
function
|
|
2280
|
+
function _i(e) {
|
|
2281
2281
|
const t = T(e);
|
|
2282
2282
|
for (let n = e, i = []; n != null && n.ownerDocument; n = n.parentElement) {
|
|
2283
2283
|
i.push(n);
|
|
@@ -2295,12 +2295,12 @@ function Si(e) {
|
|
|
2295
2295
|
const pt = Symbol("Last check for pointer-events");
|
|
2296
2296
|
function Wt(e, t) {
|
|
2297
2297
|
const n = t[pt];
|
|
2298
|
-
if (!(e.config.pointerEventsCheck !== Oe.Never && (!n || ht(e.config.pointerEventsCheck, Oe.EachApiCall) && n[
|
|
2298
|
+
if (!(e.config.pointerEventsCheck !== Oe.Never && (!n || ht(e.config.pointerEventsCheck, Oe.EachApiCall) && n[k.Call] !== Ie(e, k.Call) || ht(e.config.pointerEventsCheck, Oe.EachTrigger) && n[k.Trigger] !== Ie(e, k.Trigger))))
|
|
2299
2299
|
return n == null ? void 0 : n.result;
|
|
2300
|
-
const r =
|
|
2300
|
+
const r = _i(t);
|
|
2301
2301
|
return t[pt] = {
|
|
2302
|
-
[
|
|
2303
|
-
[
|
|
2302
|
+
[k.Call]: Ie(e, k.Call),
|
|
2303
|
+
[k.Trigger]: Ie(e, k.Trigger),
|
|
2304
2304
|
result: r
|
|
2305
2305
|
}, r;
|
|
2306
2306
|
}
|
|
@@ -2310,11 +2310,11 @@ function ge(e, t) {
|
|
|
2310
2310
|
throw new Error([
|
|
2311
2311
|
`Unable to perform pointer interaction as the element ${n.tree.length > 1 ? "inherits" : "has"} \`pointer-events: none\`:`,
|
|
2312
2312
|
"",
|
|
2313
|
-
|
|
2313
|
+
Si(n.tree)
|
|
2314
2314
|
].join(`
|
|
2315
2315
|
`));
|
|
2316
2316
|
}
|
|
2317
|
-
function
|
|
2317
|
+
function Si(e) {
|
|
2318
2318
|
return e.reverse().map((t, n) => [
|
|
2319
2319
|
"".padEnd(n),
|
|
2320
2320
|
t.tagName,
|
|
@@ -2376,7 +2376,7 @@ class Oi {
|
|
|
2376
2376
|
const o = this.getTarget(t), s = this.getEventInit(-1), [u, c] = ve(r, o);
|
|
2377
2377
|
return {
|
|
2378
2378
|
leave: () => {
|
|
2379
|
-
|
|
2379
|
+
xe(t, r) && r !== o && (t.dispatchUIEvent(r, "pointerout", s), u.forEach((d) => t.dispatchUIEvent(d, "pointerleave", s)));
|
|
2380
2380
|
},
|
|
2381
2381
|
enter: () => {
|
|
2382
2382
|
ge(t, o), r !== o && (t.dispatchUIEvent(o, "pointerover", s), c.forEach((d) => t.dispatchUIEvent(d, "pointerenter", s)));
|
|
@@ -2400,7 +2400,7 @@ class Oi {
|
|
|
2400
2400
|
}
|
|
2401
2401
|
release(t) {
|
|
2402
2402
|
const n = this.getTarget(t), [i] = ve(n, null), r = this.getEventInit();
|
|
2403
|
-
|
|
2403
|
+
xe(t, n) && (t.dispatchUIEvent(n, "pointerout", r), i.forEach((o) => t.dispatchUIEvent(o, "pointerleave", r))), this.isCancelled = !0;
|
|
2404
2404
|
}
|
|
2405
2405
|
getTarget(t) {
|
|
2406
2406
|
var n;
|
|
@@ -2550,7 +2550,7 @@ async function Di(e) {
|
|
|
2550
2550
|
"[MouseLeft][MouseLeft]"
|
|
2551
2551
|
]);
|
|
2552
2552
|
}
|
|
2553
|
-
async function
|
|
2553
|
+
async function xi(e) {
|
|
2554
2554
|
return this.pointer([
|
|
2555
2555
|
{
|
|
2556
2556
|
target: e
|
|
@@ -2558,7 +2558,7 @@ async function Ui(e) {
|
|
|
2558
2558
|
"[MouseLeft][MouseLeft][MouseLeft]"
|
|
2559
2559
|
]);
|
|
2560
2560
|
}
|
|
2561
|
-
async function
|
|
2561
|
+
async function Ui(e) {
|
|
2562
2562
|
return this.pointer({
|
|
2563
2563
|
target: e
|
|
2564
2564
|
});
|
|
@@ -2777,7 +2777,7 @@ async function Yi(e, t) {
|
|
|
2777
2777
|
offset: (d = t.offset) !== null && d !== void 0 ? d : vt(t) || o == null || (i = o.caret) === null || i === void 0 ? void 0 : i.offset
|
|
2778
2778
|
}
|
|
2779
2779
|
};
|
|
2780
|
-
"keyDef" in t ? (e.system.pointer.isKeyPressed(t.keyDef) && (be(e,
|
|
2780
|
+
"keyDef" in t ? (e.system.pointer.isKeyPressed(t.keyDef) && (be(e, k.Trigger), await e.system.pointer.release(e, t.keyDef, l)), t.releasePrevious || (be(e, k.Trigger), await e.system.pointer.press(e, t.keyDef, l), t.releaseSelf && (be(e, k.Trigger), await e.system.pointer.release(e, t.keyDef, l)))) : (be(e, k.Trigger), await e.system.pointer.move(e, r, l));
|
|
2781
2781
|
}
|
|
2782
2782
|
function vt(e) {
|
|
2783
2783
|
var t, n;
|
|
@@ -2830,11 +2830,11 @@ async function Zt(e, t, n) {
|
|
|
2830
2830
|
if (a(t, "select"))
|
|
2831
2831
|
if (t.multiple)
|
|
2832
2832
|
for (const u of o) {
|
|
2833
|
-
const c = this.config.pointerEventsCheck === 0 ? !0 :
|
|
2833
|
+
const c = this.config.pointerEventsCheck === 0 ? !0 : xe(this, u);
|
|
2834
2834
|
c && (this.dispatchUIEvent(u, "pointerover"), this.dispatchUIEvent(t, "pointerenter"), this.dispatchUIEvent(u, "mouseover"), this.dispatchUIEvent(t, "mouseenter"), this.dispatchUIEvent(u, "pointermove"), this.dispatchUIEvent(u, "mousemove"), this.dispatchUIEvent(u, "pointerdown"), this.dispatchUIEvent(u, "mousedown")), L(t), c && (this.dispatchUIEvent(u, "pointerup"), this.dispatchUIEvent(u, "mouseup")), s(u), c && this.dispatchUIEvent(u, "click"), await se(this.config);
|
|
2835
2835
|
}
|
|
2836
2836
|
else if (o.length === 1) {
|
|
2837
|
-
const u = this.config.pointerEventsCheck === 0 ? !0 :
|
|
2837
|
+
const u = this.config.pointerEventsCheck === 0 ? !0 : xe(this, t);
|
|
2838
2838
|
u ? await this.click(t) : L(t), s(o[0]), u && (this.dispatchUIEvent(t, "pointerover"), this.dispatchUIEvent(t, "pointerenter"), this.dispatchUIEvent(t, "mouseover"), this.dispatchUIEvent(t, "mouseenter"), this.dispatchUIEvent(t, "pointerup"), this.dispatchUIEvent(t, "mouseup"), this.dispatchUIEvent(t, "click")), await se(this.config);
|
|
2839
2839
|
} else
|
|
2840
2840
|
throw Q().getElementError("Cannot select multiple options on a non-multiple select", t);
|
|
@@ -2904,7 +2904,7 @@ async function ir(e, t) {
|
|
|
2904
2904
|
};
|
|
2905
2905
|
n.addEventListener("fileDialog", r), await this.click(e), n.removeEventListener("fileDialog", r);
|
|
2906
2906
|
}
|
|
2907
|
-
function
|
|
2907
|
+
function _e(e) {
|
|
2908
2908
|
return e.toLowerCase().replace(/(\.|\/)jpg\b/g, "$1jpeg");
|
|
2909
2909
|
}
|
|
2910
2910
|
function rr(e, t) {
|
|
@@ -2915,13 +2915,13 @@ function rr(e, t) {
|
|
|
2915
2915
|
"image/*",
|
|
2916
2916
|
"video/*"
|
|
2917
2917
|
];
|
|
2918
|
-
return
|
|
2918
|
+
return _e(t).trim().split(/\s*,\s*/).some((i) => i.startsWith(".") ? _e(e.name).endsWith(i) : n.includes(i) ? _e(e.type).startsWith(i.replace("*", "")) : _e(e.type) === i);
|
|
2919
2919
|
}
|
|
2920
2920
|
const mt = {
|
|
2921
2921
|
click: Mi,
|
|
2922
2922
|
dblClick: Di,
|
|
2923
|
-
tripleClick:
|
|
2924
|
-
hover:
|
|
2923
|
+
tripleClick: xi,
|
|
2924
|
+
hover: Ui,
|
|
2925
2925
|
unhover: Ni,
|
|
2926
2926
|
tab: Bi,
|
|
2927
2927
|
keyboard: Vi,
|
|
@@ -2991,7 +2991,7 @@ function cr(e) {
|
|
|
2991
2991
|
}
|
|
2992
2992
|
function dr(e, t) {
|
|
2993
2993
|
function n(...i) {
|
|
2994
|
-
return be(e,
|
|
2994
|
+
return be(e, k.Call), or(() => t.apply(e, i).then(async (r) => (await se(e.config), r)));
|
|
2995
2995
|
}
|
|
2996
2996
|
return Object.defineProperty(n, "name", {
|
|
2997
2997
|
get: () => t.name
|
|
@@ -3071,10 +3071,10 @@ function Cr(e, t = {}) {
|
|
|
3071
3071
|
function Ir(e, t, n = {}) {
|
|
3072
3072
|
return m(n).api.upload(e, t);
|
|
3073
3073
|
}
|
|
3074
|
-
function
|
|
3074
|
+
function _r(e = {}) {
|
|
3075
3075
|
return m().api.tab(e);
|
|
3076
3076
|
}
|
|
3077
|
-
const
|
|
3077
|
+
const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3078
3078
|
__proto__: null,
|
|
3079
3079
|
clear: ar,
|
|
3080
3080
|
click: fr,
|
|
@@ -3087,73 +3087,78 @@ const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3087
3087
|
paste: Er,
|
|
3088
3088
|
pointer: mr,
|
|
3089
3089
|
selectOptions: wr,
|
|
3090
|
-
tab:
|
|
3090
|
+
tab: _r,
|
|
3091
3091
|
tripleClick: kr,
|
|
3092
3092
|
type: Tr,
|
|
3093
3093
|
unhover: Cr,
|
|
3094
3094
|
upload: Ir
|
|
3095
3095
|
}, Symbol.toStringTag, { value: "Module" })), q = {
|
|
3096
|
-
...
|
|
3096
|
+
...Sr,
|
|
3097
3097
|
setup: ur
|
|
3098
3098
|
};
|
|
3099
|
-
|
|
3099
|
+
U("Modal", () => {
|
|
3100
3100
|
sn(() => {
|
|
3101
|
-
document.body.innerHTML = ""
|
|
3102
|
-
|
|
3103
|
-
|
|
3101
|
+
document.body.innerHTML = "";
|
|
3102
|
+
const e = document.createElement("div");
|
|
3103
|
+
e.id = "__next", document.body.appendChild(e);
|
|
3104
|
+
}), U("Scroll lock", () => {
|
|
3105
|
+
C("sets inert on app root when modal opens", async () => {
|
|
3104
3106
|
const e = q.setup();
|
|
3105
3107
|
I(
|
|
3106
|
-
/* @__PURE__ */ p(
|
|
3107
|
-
), await e.click(y.getByRole("button", { name: "Open" }))
|
|
3108
|
-
|
|
3108
|
+
/* @__PURE__ */ p(_, { content: /* @__PURE__ */ p("div", { children: "Content" }), trigger: /* @__PURE__ */ p("button", { children: "Open" }) })
|
|
3109
|
+
), await e.click(y.getByRole("button", { name: "Open" }));
|
|
3110
|
+
const t = document.getElementById("__next");
|
|
3111
|
+
w(t).toHaveAttribute("inert"), w(t == null ? void 0 : t.style.overflow).toBe("hidden");
|
|
3112
|
+
}), C("removes inert from app root when modal closes", async () => {
|
|
3109
3113
|
const e = q.setup();
|
|
3110
3114
|
I(
|
|
3111
|
-
/* @__PURE__ */ p(
|
|
3115
|
+
/* @__PURE__ */ p(_, { content: /* @__PURE__ */ p("div", { children: "Content" }), trigger: /* @__PURE__ */ p("button", { children: "Open" }) })
|
|
3112
3116
|
), await e.click(y.getByRole("button", { name: "Open" })), await e.click(y.getByRole("button", { name: /close/i })), await fe(() => {
|
|
3113
|
-
|
|
3117
|
+
const t = document.getElementById("__next");
|
|
3118
|
+
w(t).not.toHaveAttribute("inert"), w(t == null ? void 0 : t.style.overflow).toBe("");
|
|
3114
3119
|
});
|
|
3115
3120
|
});
|
|
3116
|
-
}),
|
|
3121
|
+
}), U("Rendering", () => {
|
|
3117
3122
|
C("renders the trigger button", () => {
|
|
3118
3123
|
I(
|
|
3119
3124
|
/* @__PURE__ */ p(
|
|
3120
|
-
|
|
3125
|
+
_,
|
|
3121
3126
|
{
|
|
3122
3127
|
content: /* @__PURE__ */ p("div", { children: "Modal Content" }),
|
|
3123
3128
|
trigger: /* @__PURE__ */ p("button", { children: "Open Modal" })
|
|
3124
3129
|
}
|
|
3125
3130
|
)
|
|
3126
|
-
),
|
|
3131
|
+
), w(
|
|
3127
3132
|
y.getByRole("button", { name: "Open Modal" })
|
|
3128
3133
|
).toBeInTheDocument();
|
|
3129
3134
|
}), C("does not render modal content initially", () => {
|
|
3130
3135
|
I(
|
|
3131
3136
|
/* @__PURE__ */ p(
|
|
3132
|
-
|
|
3137
|
+
_,
|
|
3133
3138
|
{
|
|
3134
3139
|
content: /* @__PURE__ */ p("div", { children: "Modal Content" }),
|
|
3135
3140
|
trigger: /* @__PURE__ */ p("button", { children: "Open Modal" })
|
|
3136
3141
|
}
|
|
3137
3142
|
)
|
|
3138
|
-
),
|
|
3143
|
+
), w(y.queryByText("Modal Content")).not.toBeInTheDocument();
|
|
3139
3144
|
}), C("renders modal content when trigger is clicked", async () => {
|
|
3140
3145
|
const e = q.setup();
|
|
3141
3146
|
I(
|
|
3142
3147
|
/* @__PURE__ */ p(
|
|
3143
|
-
|
|
3148
|
+
_,
|
|
3144
3149
|
{
|
|
3145
3150
|
content: /* @__PURE__ */ p("div", { children: "Modal Content" }),
|
|
3146
3151
|
trigger: /* @__PURE__ */ p("button", { children: "Open Modal" })
|
|
3147
3152
|
}
|
|
3148
3153
|
)
|
|
3149
|
-
), await e.click(y.getByRole("button", { name: "Open Modal" })),
|
|
3154
|
+
), await e.click(y.getByRole("button", { name: "Open Modal" })), w(y.getByText("Modal Content")).toBeInTheDocument();
|
|
3150
3155
|
});
|
|
3151
|
-
}),
|
|
3156
|
+
}), U("Form render prop", () => {
|
|
3152
3157
|
C("renders form via renderForm when formData provided", () => {
|
|
3153
3158
|
const e = { _id: "form-1", heading: "Contact" }, t = Je.fn(() => /* @__PURE__ */ p("form", { "data-testid": "the-form" }));
|
|
3154
3159
|
I(
|
|
3155
3160
|
/* @__PURE__ */ p(
|
|
3156
|
-
|
|
3161
|
+
_,
|
|
3157
3162
|
{
|
|
3158
3163
|
trigger: /* @__PURE__ */ p("button", { children: "Open" }),
|
|
3159
3164
|
isOpen: !0,
|
|
@@ -3161,29 +3166,29 @@ x("Modal", () => {
|
|
|
3161
3166
|
renderForm: t
|
|
3162
3167
|
}
|
|
3163
3168
|
)
|
|
3164
|
-
),
|
|
3169
|
+
), w(t).toHaveBeenCalledWith(e), w(y.getByTestId("the-form")).toBeInTheDocument();
|
|
3165
3170
|
});
|
|
3166
|
-
}),
|
|
3171
|
+
}), U("Close Button", () => {
|
|
3167
3172
|
C("closes modal when close button is clicked", async () => {
|
|
3168
3173
|
const e = q.setup();
|
|
3169
3174
|
I(
|
|
3170
3175
|
/* @__PURE__ */ p(
|
|
3171
|
-
|
|
3176
|
+
_,
|
|
3172
3177
|
{
|
|
3173
3178
|
content: /* @__PURE__ */ p("div", { children: "Modal Content" }),
|
|
3174
3179
|
trigger: /* @__PURE__ */ p("button", { children: "Open Modal" })
|
|
3175
3180
|
}
|
|
3176
3181
|
)
|
|
3177
|
-
), await e.click(y.getByRole("button", { name: "Open Modal" })),
|
|
3178
|
-
|
|
3182
|
+
), await e.click(y.getByRole("button", { name: "Open Modal" })), w(y.getByText("Modal Content")).toBeInTheDocument(), await e.click(y.getByRole("button", { name: /close/i })), await fe(() => {
|
|
3183
|
+
w(y.queryByText("Modal Content")).not.toBeInTheDocument();
|
|
3179
3184
|
});
|
|
3180
3185
|
});
|
|
3181
|
-
}),
|
|
3186
|
+
}), U("Overlay Click", () => {
|
|
3182
3187
|
C("closes modal when clicking overlay by default", async () => {
|
|
3183
3188
|
const e = q.setup();
|
|
3184
3189
|
I(
|
|
3185
3190
|
/* @__PURE__ */ p(
|
|
3186
|
-
|
|
3191
|
+
_,
|
|
3187
3192
|
{
|
|
3188
3193
|
content: /* @__PURE__ */ p("div", { children: "Modal Content" }),
|
|
3189
3194
|
trigger: /* @__PURE__ */ p("button", { children: "Open Modal" })
|
|
@@ -3192,30 +3197,30 @@ x("Modal", () => {
|
|
|
3192
3197
|
), await e.click(y.getByRole("button", { name: "Open Modal" }));
|
|
3193
3198
|
const t = document.querySelector(".overlay");
|
|
3194
3199
|
t && await e.click(t), await fe(() => {
|
|
3195
|
-
|
|
3200
|
+
w(y.queryByText("Modal Content")).not.toBeInTheDocument();
|
|
3196
3201
|
});
|
|
3197
3202
|
});
|
|
3198
|
-
}),
|
|
3203
|
+
}), U("Escape Key", () => {
|
|
3199
3204
|
C("closes modal on Escape key by default", async () => {
|
|
3200
3205
|
const e = q.setup();
|
|
3201
3206
|
I(
|
|
3202
3207
|
/* @__PURE__ */ p(
|
|
3203
|
-
|
|
3208
|
+
_,
|
|
3204
3209
|
{
|
|
3205
3210
|
content: /* @__PURE__ */ p("div", { children: "Modal Content" }),
|
|
3206
3211
|
trigger: /* @__PURE__ */ p("button", { children: "Open Modal" })
|
|
3207
3212
|
}
|
|
3208
3213
|
)
|
|
3209
3214
|
), await e.click(y.getByRole("button", { name: "Open Modal" })), await e.keyboard("{Escape}"), await fe(() => {
|
|
3210
|
-
|
|
3215
|
+
w(y.queryByText("Modal Content")).not.toBeInTheDocument();
|
|
3211
3216
|
});
|
|
3212
3217
|
});
|
|
3213
|
-
}),
|
|
3218
|
+
}), U("Controlled Mode", () => {
|
|
3214
3219
|
C("calls onClose when close button is clicked in controlled mode", async () => {
|
|
3215
3220
|
const e = q.setup(), t = Je.fn();
|
|
3216
3221
|
I(
|
|
3217
3222
|
/* @__PURE__ */ p(
|
|
3218
|
-
|
|
3223
|
+
_,
|
|
3219
3224
|
{
|
|
3220
3225
|
content: /* @__PURE__ */ p("div", { children: "Content" }),
|
|
3221
3226
|
trigger: /* @__PURE__ */ p("button", { children: "Open" }),
|
|
@@ -3224,7 +3229,7 @@ x("Modal", () => {
|
|
|
3224
3229
|
}
|
|
3225
3230
|
)
|
|
3226
3231
|
), await e.click(y.getByRole("button", { name: /close/i })), await fe(() => {
|
|
3227
|
-
|
|
3232
|
+
w(t).toHaveBeenCalled();
|
|
3228
3233
|
});
|
|
3229
3234
|
});
|
|
3230
3235
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index38.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index38.css');const t=require("react/jsx-runtime"),i=require("react"),M=require("react-dom"),P=require("../../../x-Dft9NVe_.cjs"),F="_overlay_1pts1_2",K="_fadeIn_1pts1_1",X="_fadeOut_1pts1_1",G="_closing_1pts1_14",H="_container_1pts1_20",J="_modal_1pts1_50",Q="_slideUp_1pts1_1",V="_closeButton_1pts1_61",W="_content_1pts1_86",Y="_intro_1pts1_105",Z="_title_1pts1_112",O="_trigger_1pts1_122",ee="_slideUpSheet_1pts1_1",te="_slideDownSheet_1pts1_1",s={overlay:F,fadeIn:K,fadeOut:X,closing:G,container:H,"size-sm":"_size-sm_1pts1_27","size-md":"_size-md_1pts1_31","size-lg":"_size-lg_1pts1_35","size-xl":"_size-xl_1pts1_39","size-full":"_size-full_1pts1_43",modal:J,slideUp:Q,closeButton:V,content:W,intro:Y,title:Z,trigger:O,slideUpSheet:ee,slideDownSheet:te};function se({content:p,trigger:w,isOpen:v,onOpen:l,onClose:c,size:k="md",closeOnEscape:g=!0,closeOnOverlayClick:S=!0,showCloseButton:$=!0,className:j,overlayClassName:I,style:T,formData:y,renderForm:h}){const[B,b]=i.useState(!1),[_,x]=i.useState(!1),f=i.useRef(null),z=i.useRef(null),m=v!==void 0,n=m?v:B,R=n||_,q=()=>{z.current=document.activeElement,m||b(!0),l==null||l()},d=()=>{x(!0),setTimeout(()=>{var e;x(!1),m||b(!1),c==null||c(),(e=z.current)==null||e.focus()},300)},N=()=>n?d():q(),U=()=>{S&&d()};i.useEffect(()=>{if(!g||!n)return;const e=r=>{r.key==="Escape"&&d()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n,g]),i.useEffect(()=>{if(typeof document>"u")return;const e=document.getElementById("__next")??document.getElementById("root")??document.body.firstElementChild;if(!(!e||e===document.body))return n?(e.setAttribute("inert",""),e.style.overflow="hidden"):(e.removeAttribute("inert"),e.style.overflow=""),()=>{e.removeAttribute("inert"),e.style.overflow=""}},[n]),i.useEffect(()=>{if(!n||!f.current)return;const e=f.current;e.scrollTop=0;const r=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),o=r[0],a=r[r.length-1],E=u=>{u.key==="Tab"&&(u.shiftKey?document.activeElement===o&&(u.preventDefault(),a==null||a.focus()):document.activeElement===a&&(u.preventDefault(),o==null||o.focus()))};e.addEventListener("keydown",E);const L=setTimeout(()=>o==null?void 0:o.focus(),50);return()=>{e.removeEventListener("keydown",E),clearTimeout(L)}},[n]);const D=s[`size-${k}`]??"",A=p!==void 0?p:t.jsx(t.Fragment,{children:y&&h?h(y):null}),C=R?t.jsx("div",{className:`${s.overlay} ${_?s.closing:""} ${I??""}`.trim(),onClick:U,role:"dialog","aria-modal":"true",children:t.jsxs("div",{className:`${D} ${s.container} ${_?s.closing:""}`,children:[$&&t.jsx("button",{"aria-label":"Close",className:s.closeButton,onClick:d,type:"button",children:t.jsx(P.X,{size:20})}),t.jsx("div",{ref:f,className:`${s.modal} ${j??""}`.trim(),style:T,onClick:e=>e.stopPropagation(),children:t.jsx("div",{className:s.content,children:A})})]})}):null;return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:s.trigger,onClick:N,children:w}),typeof window<"u"&&M.createPortal(C,document.body)]})}exports.Modal=se;
|