@ariakit/test 0.3.15 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/cjs/__chunks/{LBY37VXL.cjs → 4TS37S3Q.cjs} +34 -35
- package/cjs/__chunks/{LG7B6NOG.cjs → 6LDGWG7T.cjs} +2 -2
- package/cjs/__chunks/{CYMYDRLS.cjs → 6UE2XSIU.cjs} +8 -11
- package/cjs/__chunks/AGLSU3Q2.cjs +68 -0
- package/cjs/__chunks/{BXOTZFAK.cjs → AV5N3TNH.cjs} +7 -14
- package/cjs/__chunks/{VD3ERVOF.cjs → ELVRZW56.cjs} +3 -3
- package/cjs/__chunks/{3BQXN3A5.cjs → GFFCFEOC.cjs} +13 -14
- package/cjs/__chunks/{IWPK655Z.cjs → JFCVJ4KU.cjs} +20 -24
- package/cjs/__chunks/{BIB7E6LN.cjs → KRKGFFBK.cjs} +10 -16
- package/cjs/__chunks/{QCXNVFD7.cjs → LJ2IERQF.cjs} +8 -10
- package/cjs/__chunks/{22RRPVHJ.cjs → QOXIFOCW.cjs} +2 -2
- package/cjs/__chunks/{ZNASNKOZ.cjs → QRXZHH5L.cjs} +22 -29
- package/cjs/__chunks/{DJWEA66K.cjs → RKZYK2KK.cjs} +30 -34
- package/cjs/__chunks/WO6I3N3U.cjs +20 -0
- package/cjs/__chunks/{IZMYJH6V.cjs → Z3RYFL2T.cjs} +7 -9
- package/cjs/blur.cjs +5 -5
- package/cjs/click.cjs +11 -11
- package/cjs/dispatch.cjs +4 -4
- package/cjs/focus.cjs +5 -5
- package/cjs/hover.cjs +6 -6
- package/cjs/index.cjs +17 -17
- package/cjs/mouse-down.cjs +7 -7
- package/cjs/mouse-up.cjs +5 -5
- package/cjs/playwright.cjs +2 -2
- package/cjs/press.cjs +9 -9
- package/cjs/press.d.cts +15 -15
- package/cjs/press.d.ts +15 -15
- package/cjs/query.cjs +3 -3
- package/cjs/query.d.cts +33 -32
- package/cjs/query.d.ts +33 -32
- package/cjs/react.cjs +39 -29
- package/cjs/react.d.cts +5 -2
- package/cjs/react.d.ts +5 -2
- package/cjs/select.cjs +11 -11
- package/cjs/sleep.cjs +4 -4
- package/cjs/tap.cjs +12 -12
- package/cjs/type.cjs +7 -7
- package/cjs/wait-for.cjs +4 -4
- package/esm/__chunks/{AVTGTEGG.js → 2TPVB4MR.js} +7 -8
- package/esm/__chunks/{JIRMKL2I.js → 7NQ5CXYI.js} +1 -1
- package/esm/__chunks/{7Y66O5SI.js → DHZBG4QM.js} +18 -19
- package/esm/__chunks/{3EIGH73D.js → DZ24E43J.js} +1 -1
- package/esm/__chunks/{QDVGEIL5.js → EMPG4BYT.js} +11 -15
- package/esm/__chunks/{6GDQHEBE.js → G32GEXRJ.js} +7 -13
- package/esm/__chunks/{7I2TICIC.js → HFG3HB6M.js} +7 -14
- package/esm/__chunks/{QE2YCTHV.js → HI4LQVNU.js} +5 -8
- package/esm/__chunks/{VD2VFA32.js → HO5N5GTX.js} +4 -6
- package/esm/__chunks/{MLBZISHH.js → NSFKY4TP.js} +1 -1
- package/esm/__chunks/{G2JU2LVB.js → SB7WYA2U.js} +1 -1
- package/esm/__chunks/{VVYOYAEF.js → UQRVXJ7Z.js} +13 -20
- package/esm/__chunks/{LRKW54RD.js → VMVRY4TL.js} +5 -6
- package/esm/__chunks/{DMIPXMWG.js → W46IR3LA.js} +11 -15
- package/esm/__chunks/{V36IYEJN.js → ZPXIP5WW.js} +5 -7
- package/esm/blur.js +4 -4
- package/esm/click.js +10 -10
- package/esm/dispatch.js +3 -3
- package/esm/focus.js +4 -4
- package/esm/hover.js +5 -5
- package/esm/index.js +16 -16
- package/esm/mouse-down.js +6 -6
- package/esm/mouse-up.js +4 -4
- package/esm/playwright.js +1 -1
- package/esm/press.d.ts +15 -15
- package/esm/press.js +8 -8
- package/esm/query.d.ts +33 -32
- package/esm/query.js +2 -2
- package/esm/react.d.ts +5 -2
- package/esm/react.js +35 -25
- package/esm/select.js +10 -10
- package/esm/sleep.js +3 -3
- package/esm/tap.js +11 -11
- package/esm/type.js +6 -6
- package/esm/wait-for.js +3 -3
- package/package.json +5 -5
- package/.eslintignore +0 -6
- package/cjs/__chunks/HQ3KUD6F.cjs +0 -20
- package/cjs/__chunks/UWCNB4SR.cjs +0 -69
- /package/cjs/__chunks/{OVN5OYWK.cjs → DOXEES2I.cjs} +0 -0
- /package/esm/__chunks/{Q65FZOE2.js → SM5ASDQ3.js} +0 -0
package/cjs/wait-for.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./__chunks/
|
|
6
|
-
require('./__chunks/
|
|
4
|
+
var _6LDGWG7Tcjs = require('./__chunks/6LDGWG7T.cjs');
|
|
5
|
+
require('./__chunks/AV5N3TNH.cjs');
|
|
6
|
+
require('./__chunks/DOXEES2I.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.waitFor =
|
|
9
|
+
exports.waitFor = _6LDGWG7Tcjs.waitFor;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
blur
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./HI4LQVNU.js";
|
|
5
5
|
import {
|
|
6
6
|
focus
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./HO5N5GTX.js";
|
|
8
8
|
import {
|
|
9
9
|
dispatch
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./7NQ5CXYI.js";
|
|
11
11
|
import {
|
|
12
12
|
wrapAsync
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./HFG3HB6M.js";
|
|
14
14
|
import {
|
|
15
15
|
__spreadValues
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./SM5ASDQ3.js";
|
|
17
17
|
|
|
18
18
|
// src/mouse-down.ts
|
|
19
19
|
import { getDocument, isVisible } from "@ariakit/core/utils/dom";
|
|
@@ -22,8 +22,7 @@ import { invariant } from "@ariakit/core/utils/misc";
|
|
|
22
22
|
function mouseDown(element, options) {
|
|
23
23
|
return wrapAsync(async () => {
|
|
24
24
|
invariant(element, "Unable to mouseDown on null element");
|
|
25
|
-
if (!isVisible(element))
|
|
26
|
-
return;
|
|
25
|
+
if (!isVisible(element)) return;
|
|
27
26
|
const { disabled } = element;
|
|
28
27
|
let defaultAllowed = await dispatch.pointerDown(element, options);
|
|
29
28
|
if (!disabled) {
|
|
@@ -33,7 +32,7 @@ function mouseDown(element, options) {
|
|
|
33
32
|
}
|
|
34
33
|
if (defaultAllowed) {
|
|
35
34
|
const selection = getDocument(element).getSelection();
|
|
36
|
-
if (selection
|
|
35
|
+
if (selection == null ? void 0 : selection.rangeCount) {
|
|
37
36
|
const range = selection.getRangeAt(0);
|
|
38
37
|
if (!range.collapsed) {
|
|
39
38
|
selection.removeAllRanges();
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
mouseUp
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./ZPXIP5WW.js";
|
|
5
5
|
import {
|
|
6
6
|
mouseDown
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./2TPVB4MR.js";
|
|
8
8
|
import {
|
|
9
9
|
hover
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./VMVRY4TL.js";
|
|
11
11
|
import {
|
|
12
12
|
focus
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./HO5N5GTX.js";
|
|
14
14
|
import {
|
|
15
15
|
dispatch
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./7NQ5CXYI.js";
|
|
17
17
|
import {
|
|
18
18
|
sleep
|
|
19
|
-
} from "./
|
|
19
|
+
} from "./DZ24E43J.js";
|
|
20
20
|
import {
|
|
21
21
|
wrapAsync
|
|
22
|
-
} from "./
|
|
22
|
+
} from "./HFG3HB6M.js";
|
|
23
23
|
import {
|
|
24
24
|
__spreadValues
|
|
25
|
-
} from "./
|
|
25
|
+
} from "./SM5ASDQ3.js";
|
|
26
26
|
|
|
27
27
|
// src/click.ts
|
|
28
28
|
import { isVisible } from "@ariakit/core/utils/dom";
|
|
@@ -66,16 +66,18 @@ async function clickOption(element, eventOptions) {
|
|
|
66
66
|
}
|
|
67
67
|
if (select.multiple) {
|
|
68
68
|
const options = Array.from(select.options);
|
|
69
|
-
const resetOptions = () =>
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const resetOptions = () => {
|
|
70
|
+
for (const option of options) {
|
|
71
|
+
setSelected(option, false);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
72
74
|
const selectRange = (a, b) => {
|
|
73
75
|
const from = Math.min(a, b);
|
|
74
76
|
const to = Math.max(a, b) + 1;
|
|
75
77
|
const selectedOptions = options.slice(from, to);
|
|
76
|
-
|
|
78
|
+
for (const option of selectedOptions) {
|
|
77
79
|
setSelected(option, true);
|
|
78
|
-
}
|
|
80
|
+
}
|
|
79
81
|
};
|
|
80
82
|
if (eventOptions == null ? void 0 : eventOptions.shiftKey) {
|
|
81
83
|
const elementIndex = options.indexOf(element);
|
|
@@ -103,13 +105,11 @@ async function clickOption(element, eventOptions) {
|
|
|
103
105
|
function click(element, options, tap = false) {
|
|
104
106
|
return wrapAsync(async () => {
|
|
105
107
|
invariant(element, "Unable to click on null element");
|
|
106
|
-
if (!isVisible(element))
|
|
107
|
-
return;
|
|
108
|
+
if (!isVisible(element)) return;
|
|
108
109
|
await hover(element, options);
|
|
109
110
|
await mouseDown(element, options);
|
|
110
111
|
while (!isVisible(element)) {
|
|
111
|
-
if (!element.parentElement)
|
|
112
|
-
return;
|
|
112
|
+
if (!element.parentElement) return;
|
|
113
113
|
element = element.parentElement;
|
|
114
114
|
}
|
|
115
115
|
if (!tap) {
|
|
@@ -117,8 +117,7 @@ function click(element, options, tap = false) {
|
|
|
117
117
|
}
|
|
118
118
|
await mouseUp(element, options);
|
|
119
119
|
const { disabled } = element;
|
|
120
|
-
if (disabled)
|
|
121
|
-
return;
|
|
120
|
+
if (disabled) return;
|
|
122
121
|
const label = getClosestLabel(element);
|
|
123
122
|
if (label) {
|
|
124
123
|
await clickLabel(label, __spreadValues({ detail: 1 }, options));
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
mouseUp
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./ZPXIP5WW.js";
|
|
5
5
|
import {
|
|
6
6
|
mouseDown
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./2TPVB4MR.js";
|
|
8
8
|
import {
|
|
9
9
|
hover
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./VMVRY4TL.js";
|
|
11
11
|
import {
|
|
12
12
|
dispatch
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./7NQ5CXYI.js";
|
|
14
14
|
import {
|
|
15
15
|
sleep
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./DZ24E43J.js";
|
|
17
17
|
import {
|
|
18
18
|
wrapAsync
|
|
19
|
-
} from "./
|
|
19
|
+
} from "./HFG3HB6M.js";
|
|
20
20
|
import {
|
|
21
21
|
__spreadValues
|
|
22
|
-
} from "./
|
|
22
|
+
} from "./SM5ASDQ3.js";
|
|
23
23
|
|
|
24
24
|
// src/select.ts
|
|
25
25
|
import { isVisible } from "@ariakit/core/utils/dom";
|
|
@@ -28,8 +28,7 @@ function select(text, element = document.body, options) {
|
|
|
28
28
|
return wrapAsync(async () => {
|
|
29
29
|
var _a, _b;
|
|
30
30
|
invariant(element, "Unable to select text on null element");
|
|
31
|
-
if (!isVisible(element))
|
|
32
|
-
return;
|
|
31
|
+
if (!isVisible(element)) return;
|
|
33
32
|
const document2 = element.ownerDocument;
|
|
34
33
|
await hover(element, options);
|
|
35
34
|
await mouseDown(element, options);
|
|
@@ -60,11 +59,9 @@ function select(text, element = document.body, options) {
|
|
|
60
59
|
let endOffset = -1;
|
|
61
60
|
while (index >= 0 && index < endIndex && charCount < endIndex && (node = iterator.nextNode())) {
|
|
62
61
|
const textContent = node.textContent;
|
|
63
|
-
if (!textContent)
|
|
64
|
-
continue;
|
|
62
|
+
if (!textContent) continue;
|
|
65
63
|
charCount += textContent.length;
|
|
66
|
-
if (index > charCount)
|
|
67
|
-
continue;
|
|
64
|
+
if (index > charCount) continue;
|
|
68
65
|
if (!startContainer) {
|
|
69
66
|
startContainer = node;
|
|
70
67
|
startOffset = index - charCount + textContent.length;
|
|
@@ -73,8 +70,7 @@ function select(text, element = document.body, options) {
|
|
|
73
70
|
endOffset = endIndex - charCount + textContent.length;
|
|
74
71
|
index++;
|
|
75
72
|
}
|
|
76
|
-
if (!startContainer || !endContainer)
|
|
77
|
-
continue;
|
|
73
|
+
if (!startContainer || !endContainer) continue;
|
|
78
74
|
await hover(element, options);
|
|
79
75
|
range.setStart(startContainer, startOffset);
|
|
80
76
|
range.setEnd(endContainer, endOffset);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
__spreadProps,
|
|
7
7
|
__spreadValues
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./SM5ASDQ3.js";
|
|
9
9
|
|
|
10
10
|
// src/query.ts
|
|
11
11
|
import { invariant } from "@ariakit/core/utils/misc";
|
|
@@ -18,8 +18,7 @@ function createQueries(container = document.body) {
|
|
|
18
18
|
}
|
|
19
19
|
var documentQueries = createQueries();
|
|
20
20
|
function matchName(name, accessibleName) {
|
|
21
|
-
if (accessibleName == null)
|
|
22
|
-
return false;
|
|
21
|
+
if (accessibleName == null) return false;
|
|
23
22
|
if (typeof name === "string") {
|
|
24
23
|
return accessibleName === name;
|
|
25
24
|
}
|
|
@@ -27,22 +26,17 @@ function matchName(name, accessibleName) {
|
|
|
27
26
|
}
|
|
28
27
|
function getNameOption(name, includesHidden) {
|
|
29
28
|
return (accessibleName, element) => {
|
|
30
|
-
if (!includesHidden && element.closest("[inert]"))
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
if (matchName(name, accessibleName))
|
|
35
|
-
return true;
|
|
36
|
-
if (element.getAttribute("aria-label"))
|
|
37
|
-
return false;
|
|
29
|
+
if (!includesHidden && element.closest("[inert]")) return false;
|
|
30
|
+
if (!name) return true;
|
|
31
|
+
if (matchName(name, accessibleName)) return true;
|
|
32
|
+
if (element.getAttribute("aria-label")) return false;
|
|
38
33
|
const labeledBy = element.getAttribute("aria-labelledby");
|
|
39
34
|
if (!labeledBy) {
|
|
40
35
|
const content = "placeholder" in element && element.placeholder != null ? element.placeholder : element.textContent;
|
|
41
36
|
return matchName(name, content);
|
|
42
37
|
}
|
|
43
38
|
const label = document.getElementById(labeledBy);
|
|
44
|
-
if (!(label == null ? void 0 : label.textContent))
|
|
45
|
-
return false;
|
|
39
|
+
if (!(label == null ? void 0 : label.textContent)) return false;
|
|
46
40
|
return matchName(name, label.textContent);
|
|
47
41
|
};
|
|
48
42
|
}
|
|
@@ -22,30 +22,23 @@ function setActEnvironment(value) {
|
|
|
22
22
|
return restoreActEnvironment;
|
|
23
23
|
}
|
|
24
24
|
function applyBrowserPolyfills() {
|
|
25
|
-
if (isBrowser)
|
|
26
|
-
return noop;
|
|
25
|
+
if (isBrowser) return noop;
|
|
27
26
|
const originalFocus = HTMLElement.prototype.focus;
|
|
28
27
|
HTMLElement.prototype.focus = function focus(options) {
|
|
29
|
-
if (!isFocusable(this))
|
|
30
|
-
return;
|
|
28
|
+
if (!isFocusable(this)) return;
|
|
31
29
|
return originalFocus.call(this, options);
|
|
32
30
|
};
|
|
33
31
|
const originalGetClientRects = Element.prototype.getClientRects;
|
|
34
32
|
Element.prototype.getClientRects = function getClientRects() {
|
|
35
33
|
const isHidden = (element) => {
|
|
36
|
-
if (!element.isConnected)
|
|
37
|
-
|
|
38
|
-
if (element
|
|
39
|
-
|
|
40
|
-
if (!(element instanceof HTMLElement))
|
|
41
|
-
return false;
|
|
42
|
-
if (element.hidden)
|
|
43
|
-
return true;
|
|
34
|
+
if (!element.isConnected) return true;
|
|
35
|
+
if (element.parentElement && isHidden(element.parentElement)) return true;
|
|
36
|
+
if (!(element instanceof HTMLElement)) return false;
|
|
37
|
+
if (element.hidden) return true;
|
|
44
38
|
const style = getComputedStyle(element);
|
|
45
39
|
return style.display === "none" || style.visibility === "hidden";
|
|
46
40
|
};
|
|
47
|
-
if (isHidden(this))
|
|
48
|
-
return [];
|
|
41
|
+
if (isHidden(this)) return [];
|
|
49
42
|
return [{ width: 1, height: 1 }];
|
|
50
43
|
};
|
|
51
44
|
if (!Element.prototype.scrollIntoView) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
dispatch
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./7NQ5CXYI.js";
|
|
5
5
|
import {
|
|
6
6
|
flushMicrotasks,
|
|
7
7
|
wrapAsync
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./HFG3HB6M.js";
|
|
9
9
|
|
|
10
10
|
// src/blur.ts
|
|
11
11
|
import { getActiveElement } from "@ariakit/core/utils/dom";
|
|
@@ -14,12 +14,9 @@ function blur(element) {
|
|
|
14
14
|
if (element == null) {
|
|
15
15
|
element = document.activeElement;
|
|
16
16
|
}
|
|
17
|
-
if (!element)
|
|
18
|
-
|
|
19
|
-
if (element
|
|
20
|
-
return;
|
|
21
|
-
if (getActiveElement(element) !== element)
|
|
22
|
-
return;
|
|
17
|
+
if (!element) return;
|
|
18
|
+
if (element.tagName === "BODY") return;
|
|
19
|
+
if (getActiveElement(element) !== element) return;
|
|
23
20
|
if (element.dirty) {
|
|
24
21
|
await dispatch.change(element);
|
|
25
22
|
element.dirty = false;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
dispatch
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./7NQ5CXYI.js";
|
|
5
5
|
import {
|
|
6
6
|
flushMicrotasks,
|
|
7
7
|
wrapAsync
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./HFG3HB6M.js";
|
|
9
9
|
|
|
10
10
|
// src/focus.ts
|
|
11
11
|
import { getActiveElement } from "@ariakit/core/utils/dom";
|
|
@@ -14,10 +14,8 @@ import { invariant } from "@ariakit/core/utils/misc";
|
|
|
14
14
|
function focus(element) {
|
|
15
15
|
return wrapAsync(async () => {
|
|
16
16
|
invariant(element, "Unable to focus on null element");
|
|
17
|
-
if (getActiveElement(element) === element)
|
|
18
|
-
|
|
19
|
-
if (!isFocusable(element))
|
|
20
|
-
return;
|
|
17
|
+
if (getActiveElement(element) === element) return;
|
|
18
|
+
if (!isFocusable(element)) return;
|
|
21
19
|
const htmlElement = element;
|
|
22
20
|
const activeElement = getActiveElement(
|
|
23
21
|
htmlElement
|
|
@@ -1,39 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
focus
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./HO5N5GTX.js";
|
|
5
5
|
import {
|
|
6
6
|
dispatch
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./7NQ5CXYI.js";
|
|
8
8
|
import {
|
|
9
9
|
sleep
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./DZ24E43J.js";
|
|
11
11
|
import {
|
|
12
12
|
wrapAsync
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./HFG3HB6M.js";
|
|
14
14
|
import {
|
|
15
15
|
__spreadValues
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./SM5ASDQ3.js";
|
|
17
17
|
|
|
18
18
|
// src/type.ts
|
|
19
19
|
import { getActiveElement, isTextField } from "@ariakit/core/utils/dom";
|
|
20
20
|
import { isFocusable } from "@ariakit/core/utils/focus";
|
|
21
21
|
function getKeyFromChar(key) {
|
|
22
|
-
if (key === "\x7F")
|
|
23
|
-
|
|
24
|
-
if (key === "\
|
|
25
|
-
|
|
26
|
-
if (key === "\n")
|
|
27
|
-
return "Enter";
|
|
28
|
-
if (key === " ")
|
|
29
|
-
return "Tab";
|
|
22
|
+
if (key === "\x7F") return "Delete";
|
|
23
|
+
if (key === "\b") return "Backspace";
|
|
24
|
+
if (key === "\n") return "Enter";
|
|
25
|
+
if (key === " ") return "Tab";
|
|
30
26
|
return key;
|
|
31
27
|
}
|
|
32
28
|
function workAroundEmailInput(element) {
|
|
33
29
|
const input = element;
|
|
34
|
-
if (input.tagName !== "INPUT" || input.type !== "email")
|
|
35
|
-
|
|
36
|
-
};
|
|
30
|
+
if (input.tagName !== "INPUT" || input.type !== "email") return () => {
|
|
31
|
+
};
|
|
37
32
|
input.type = "text";
|
|
38
33
|
return () => {
|
|
39
34
|
input.type = "email";
|
|
@@ -45,10 +40,8 @@ function type(text, element, options = {}) {
|
|
|
45
40
|
if (element == null) {
|
|
46
41
|
element = document.activeElement;
|
|
47
42
|
}
|
|
48
|
-
if (!element)
|
|
49
|
-
|
|
50
|
-
if (!isFocusable(element))
|
|
51
|
-
return;
|
|
43
|
+
if (!element) return;
|
|
44
|
+
if (!isFocusable(element)) return;
|
|
52
45
|
await focus(element);
|
|
53
46
|
element.dirty = true;
|
|
54
47
|
const restoreEmailInput = workAroundEmailInput(element);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
dispatch
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./7NQ5CXYI.js";
|
|
5
5
|
import {
|
|
6
6
|
sleep
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./DZ24E43J.js";
|
|
8
8
|
import {
|
|
9
9
|
wrapAsync
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./HFG3HB6M.js";
|
|
11
11
|
import {
|
|
12
12
|
__spreadProps,
|
|
13
13
|
__spreadValues
|
|
14
|
-
} from "./
|
|
14
|
+
} from "./SM5ASDQ3.js";
|
|
15
15
|
|
|
16
16
|
// src/hover.ts
|
|
17
17
|
import { isVisible } from "@ariakit/core/utils/dom";
|
|
@@ -22,8 +22,7 @@ function isPointerEventsEnabled(element) {
|
|
|
22
22
|
function hover(element, options) {
|
|
23
23
|
return wrapAsync(async () => {
|
|
24
24
|
invariant(element, "Unable to hover on null element");
|
|
25
|
-
if (!isVisible(element))
|
|
26
|
-
return;
|
|
25
|
+
if (!isVisible(element)) return;
|
|
27
26
|
const document = element.ownerDocument;
|
|
28
27
|
const { lastHovered } = document;
|
|
29
28
|
const { disabled } = element;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
type
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./UQRVXJ7Z.js";
|
|
5
5
|
import {
|
|
6
6
|
blur
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./HI4LQVNU.js";
|
|
8
8
|
import {
|
|
9
9
|
focus
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./HO5N5GTX.js";
|
|
11
11
|
import {
|
|
12
12
|
dispatch
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./7NQ5CXYI.js";
|
|
14
14
|
import {
|
|
15
15
|
sleep
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./DZ24E43J.js";
|
|
17
17
|
import {
|
|
18
18
|
wrapAsync
|
|
19
|
-
} from "./
|
|
19
|
+
} from "./HFG3HB6M.js";
|
|
20
20
|
import {
|
|
21
21
|
__spreadValues
|
|
22
|
-
} from "./
|
|
22
|
+
} from "./SM5ASDQ3.js";
|
|
23
23
|
|
|
24
24
|
// src/press.ts
|
|
25
25
|
import { isTextField, setSelectionRange } from "@ariakit/core/utils/dom";
|
|
@@ -38,8 +38,7 @@ var clickableInputTypes = [
|
|
|
38
38
|
];
|
|
39
39
|
async function submitFormByPressingEnterOn(element, options) {
|
|
40
40
|
const { form } = element;
|
|
41
|
-
if (!form)
|
|
42
|
-
return;
|
|
41
|
+
if (!form) return;
|
|
43
42
|
const elements = Array.from(form.elements);
|
|
44
43
|
const validInputs = elements.filter(
|
|
45
44
|
(el) => el instanceof HTMLInputElement && isTextField(el)
|
|
@@ -58,8 +57,7 @@ async function incrementNumberInput(element, by = 1) {
|
|
|
58
57
|
const value = +element.value + by;
|
|
59
58
|
const max = element.max ? +element.max : Number.MAX_SAFE_INTEGER;
|
|
60
59
|
const min = element.min ? +element.min : Number.MIN_SAFE_INTEGER;
|
|
61
|
-
if (value > max || value < min)
|
|
62
|
-
return;
|
|
60
|
+
if (value > max || value < min) return;
|
|
63
61
|
element.value = value.toString();
|
|
64
62
|
await dispatch.input(element);
|
|
65
63
|
await dispatch.change(element);
|
|
@@ -177,10 +175,8 @@ function press(key, element, options = {}) {
|
|
|
177
175
|
if (element == null) {
|
|
178
176
|
element = document.activeElement || document.body;
|
|
179
177
|
}
|
|
180
|
-
if (!element)
|
|
181
|
-
|
|
182
|
-
if (!isFocusable(element) && element.tagName !== "BODY")
|
|
183
|
-
return;
|
|
178
|
+
if (!element) return;
|
|
179
|
+
if (!isFocusable(element) && element.tagName !== "BODY") return;
|
|
184
180
|
if (isTextField(element)) {
|
|
185
181
|
if (key.length === 1) {
|
|
186
182
|
return type(key, element, options);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
dispatch
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./7NQ5CXYI.js";
|
|
5
5
|
import {
|
|
6
6
|
wrapAsync
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./HFG3HB6M.js";
|
|
8
8
|
import {
|
|
9
9
|
__spreadValues
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./SM5ASDQ3.js";
|
|
11
11
|
|
|
12
12
|
// src/mouse-up.ts
|
|
13
13
|
import { isVisible } from "@ariakit/core/utils/dom";
|
|
@@ -15,12 +15,10 @@ import { invariant } from "@ariakit/core/utils/misc";
|
|
|
15
15
|
function mouseUp(element, options) {
|
|
16
16
|
return wrapAsync(async () => {
|
|
17
17
|
invariant(element, "Unable to mouseUp on null element");
|
|
18
|
-
if (!isVisible(element))
|
|
19
|
-
return;
|
|
18
|
+
if (!isVisible(element)) return;
|
|
20
19
|
const { disabled } = element;
|
|
21
20
|
await dispatch.pointerUp(element, options);
|
|
22
|
-
if (disabled)
|
|
23
|
-
return;
|
|
21
|
+
if (disabled) return;
|
|
24
22
|
await dispatch.mouseUp(element, __spreadValues({ detail: 1 }, options));
|
|
25
23
|
});
|
|
26
24
|
}
|
package/esm/blur.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
blur
|
|
4
|
-
} from "./__chunks/
|
|
5
|
-
import "./__chunks/
|
|
6
|
-
import "./__chunks/
|
|
7
|
-
import "./__chunks/
|
|
4
|
+
} from "./__chunks/HI4LQVNU.js";
|
|
5
|
+
import "./__chunks/7NQ5CXYI.js";
|
|
6
|
+
import "./__chunks/HFG3HB6M.js";
|
|
7
|
+
import "./__chunks/SM5ASDQ3.js";
|
|
8
8
|
export {
|
|
9
9
|
blur
|
|
10
10
|
};
|
package/esm/click.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
click
|
|
4
|
-
} from "./__chunks/
|
|
5
|
-
import "./__chunks/
|
|
6
|
-
import "./__chunks/
|
|
7
|
-
import "./__chunks/
|
|
8
|
-
import "./__chunks/
|
|
9
|
-
import "./__chunks/
|
|
10
|
-
import "./__chunks/
|
|
11
|
-
import "./__chunks/
|
|
12
|
-
import "./__chunks/
|
|
13
|
-
import "./__chunks/
|
|
4
|
+
} from "./__chunks/DHZBG4QM.js";
|
|
5
|
+
import "./__chunks/ZPXIP5WW.js";
|
|
6
|
+
import "./__chunks/2TPVB4MR.js";
|
|
7
|
+
import "./__chunks/VMVRY4TL.js";
|
|
8
|
+
import "./__chunks/HI4LQVNU.js";
|
|
9
|
+
import "./__chunks/HO5N5GTX.js";
|
|
10
|
+
import "./__chunks/7NQ5CXYI.js";
|
|
11
|
+
import "./__chunks/DZ24E43J.js";
|
|
12
|
+
import "./__chunks/HFG3HB6M.js";
|
|
13
|
+
import "./__chunks/SM5ASDQ3.js";
|
|
14
14
|
export {
|
|
15
15
|
click
|
|
16
16
|
};
|
package/esm/dispatch.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
dispatch
|
|
4
|
-
} from "./__chunks/
|
|
5
|
-
import "./__chunks/
|
|
6
|
-
import "./__chunks/
|
|
4
|
+
} from "./__chunks/7NQ5CXYI.js";
|
|
5
|
+
import "./__chunks/HFG3HB6M.js";
|
|
6
|
+
import "./__chunks/SM5ASDQ3.js";
|
|
7
7
|
export {
|
|
8
8
|
dispatch
|
|
9
9
|
};
|
package/esm/focus.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
focus
|
|
4
|
-
} from "./__chunks/
|
|
5
|
-
import "./__chunks/
|
|
6
|
-
import "./__chunks/
|
|
7
|
-
import "./__chunks/
|
|
4
|
+
} from "./__chunks/HO5N5GTX.js";
|
|
5
|
+
import "./__chunks/7NQ5CXYI.js";
|
|
6
|
+
import "./__chunks/HFG3HB6M.js";
|
|
7
|
+
import "./__chunks/SM5ASDQ3.js";
|
|
8
8
|
export {
|
|
9
9
|
focus
|
|
10
10
|
};
|