@ariakit/test 0.1.5 → 0.1.6
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 +10 -0
- package/cjs/__chunks/{OZ7WVH2H.cjs → 3SY2LMBF.cjs} +4 -1
- package/cjs/__chunks/{JQOPUXXK.cjs → 4PLCBYAV.cjs} +20 -16
- package/cjs/__chunks/{HNTSACY7.cjs → 5LBBCOE3.cjs} +5 -6
- package/cjs/__chunks/{MRZIZFYG.cjs → 7LXN4GA5.cjs} +2 -2
- package/cjs/__chunks/{XMPFC5C3.cjs → 7WNWDQ4X.cjs} +7 -4
- package/cjs/__chunks/{7JH5O7L2.cjs → APK7YACC.cjs} +2 -2
- package/cjs/__chunks/{DN7DXBEV.cjs → J27GPNPL.cjs} +18 -14
- package/cjs/__chunks/{5W6DSYPH.cjs → K4CITI33.cjs} +6 -2
- package/cjs/__chunks/LDC5CPCY.cjs +24 -0
- package/cjs/__chunks/{JH3LRGOI.cjs → QSY6VHP2.cjs} +24 -20
- package/cjs/__chunks/{FKRMBIQS.cjs → T7IGORAF.cjs} +19 -18
- package/cjs/__chunks/{4XKG4LDQ.cjs → WHLWNNUI.cjs} +6 -2
- package/cjs/act.cjs +1 -0
- package/cjs/blur.cjs +1 -0
- package/cjs/click.cjs +8 -7
- package/cjs/fire-event.cjs +1 -0
- package/cjs/focus.cjs +4 -3
- package/cjs/hover.cjs +3 -2
- package/cjs/index.cjs +13 -12
- package/cjs/mock-get-client-rects.cjs +2 -1
- package/cjs/mouse-down.cjs +5 -4
- package/cjs/mouse-up.cjs +3 -2
- package/cjs/press.cjs +6 -5
- package/cjs/render.cjs +3 -2
- package/cjs/screen.cjs +1 -0
- package/cjs/select.cjs +8 -7
- package/cjs/sleep.cjs +1 -0
- package/cjs/tap.cjs +9 -8
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/cjs/type.cjs +5 -4
- package/cjs/wait-for.cjs +1 -0
- package/cjs/within.cjs +1 -0
- package/esm/__chunks/{EFRHS5TP.js → 2E5JZMOP.js} +13 -9
- package/esm/__chunks/{XT6MJTE4.js → 4AKNUH2A.js} +1 -1
- package/esm/__chunks/{HCJFVOUB.js → 5UPN6XV7.js} +5 -6
- package/esm/__chunks/{RVXNT5Y5.js → DRKLVF57.js} +6 -2
- package/esm/__chunks/{4RXBOOIA.js → JVZDQIPK.js} +1 -1
- package/esm/__chunks/{VZYZVUSK.js → KPOWUSLK.js} +4 -1
- package/esm/__chunks/{XJFAU7OI.js → N3NIS6J5.js} +5 -2
- package/esm/__chunks/{B4PLOQ7F.js → O77EMIKC.js} +5 -1
- package/esm/__chunks/{KIGH65E3.js → S4IIXAAC.js} +17 -16
- package/esm/__chunks/{PLZ4ME4B.js → X23QJEN5.js} +17 -13
- package/esm/__chunks/ZEPQ5W7N.js +24 -0
- package/esm/__chunks/{C5V6WFU6.js → ZUY7UFA4.js} +15 -11
- package/esm/act.js +1 -0
- package/esm/blur.js +1 -0
- package/esm/click.js +7 -6
- package/esm/fire-event.js +1 -0
- package/esm/focus.js +3 -2
- package/esm/hover.js +2 -1
- package/esm/index.js +12 -11
- package/esm/mock-get-client-rects.js +2 -1
- package/esm/mouse-down.js +4 -3
- package/esm/mouse-up.js +2 -1
- package/esm/press.js +5 -4
- package/esm/render.js +2 -1
- package/esm/screen.js +1 -0
- package/esm/select.js +7 -6
- package/esm/sleep.js +1 -0
- package/esm/tap.js +8 -7
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/esm/type.js +4 -3
- package/esm/wait-for.js +1 -0
- package/esm/within.js +1 -0
- package/package.json +2 -2
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mouseUp
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./KPOWUSLK.js";
|
|
4
4
|
import {
|
|
5
5
|
mouseDown
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./N3NIS6J5.js";
|
|
7
7
|
import {
|
|
8
8
|
hover
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./DRKLVF57.js";
|
|
10
10
|
import {
|
|
11
11
|
fireEvent
|
|
12
12
|
} from "./B2UPDCBH.js";
|
|
13
13
|
import {
|
|
14
14
|
sleep
|
|
15
15
|
} from "./5PINJ4MD.js";
|
|
16
|
+
import {
|
|
17
|
+
__spreadValues
|
|
18
|
+
} from "./ZEPQ5W7N.js";
|
|
16
19
|
|
|
17
20
|
// src/select.ts
|
|
18
21
|
async function select(text, element = document.body, options) {
|
|
22
|
+
var _a, _b;
|
|
19
23
|
const document2 = element.ownerDocument;
|
|
20
24
|
await hover(element, options);
|
|
21
25
|
mouseDown(element, options);
|
|
@@ -26,7 +30,7 @@ async function select(text, element = document.body, options) {
|
|
|
26
30
|
composed: false
|
|
27
31
|
})
|
|
28
32
|
);
|
|
29
|
-
const startIndex = element.textContent
|
|
33
|
+
const startIndex = (_b = (_a = element.textContent) == null ? void 0 : _a.indexOf(text)) != null ? _b : -1;
|
|
30
34
|
const selection = document2.getSelection();
|
|
31
35
|
const range = document2.createRange();
|
|
32
36
|
for (let i = 1; i <= text.length; i++) {
|
|
@@ -60,14 +64,14 @@ async function select(text, element = document.body, options) {
|
|
|
60
64
|
await hover(element, options);
|
|
61
65
|
range.setStart(startContainer, startOffset);
|
|
62
66
|
range.setEnd(endContainer, endOffset);
|
|
63
|
-
selection
|
|
64
|
-
selection
|
|
67
|
+
selection == null ? void 0 : selection.removeAllRanges();
|
|
68
|
+
selection == null ? void 0 : selection.addRange(range);
|
|
65
69
|
}
|
|
66
70
|
await sleep();
|
|
67
71
|
mouseUp(element, options);
|
|
68
|
-
fireEvent.click(element, { detail: 1,
|
|
69
|
-
selection
|
|
70
|
-
selection
|
|
72
|
+
fireEvent.click(element, __spreadValues({ detail: 1 }, options));
|
|
73
|
+
selection == null ? void 0 : selection.removeAllRanges();
|
|
74
|
+
selection == null ? void 0 : selection.addRange(range);
|
|
71
75
|
await sleep();
|
|
72
76
|
}
|
|
73
77
|
|
|
@@ -6,15 +6,14 @@ import {
|
|
|
6
6
|
if (!isBrowser && typeof window !== "undefined") {
|
|
7
7
|
window.Element.prototype.getClientRects = function getClientRects() {
|
|
8
8
|
const isHidden = (element) => {
|
|
9
|
-
if (element.
|
|
9
|
+
if (!element.isConnected)
|
|
10
10
|
return true;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
if (element.parentElement && isHidden(element.parentElement))
|
|
12
|
+
return true;
|
|
13
|
+
if (!(element instanceof HTMLElement))
|
|
13
14
|
return false;
|
|
14
|
-
|
|
15
|
-
if (element.hidden) {
|
|
15
|
+
if (element.hidden)
|
|
16
16
|
return true;
|
|
17
|
-
}
|
|
18
17
|
const style = getComputedStyle(element);
|
|
19
18
|
return style.display === "none" || style.visibility === "hidden";
|
|
20
19
|
};
|
|
@@ -7,6 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
queuedMicrotasks
|
|
9
9
|
} from "./ZEO5Q6UD.js";
|
|
10
|
+
import {
|
|
11
|
+
__spreadProps,
|
|
12
|
+
__spreadValues
|
|
13
|
+
} from "./ZEPQ5W7N.js";
|
|
10
14
|
|
|
11
15
|
// src/hover.ts
|
|
12
16
|
function isPointerEventsEnabled(element) {
|
|
@@ -23,7 +27,7 @@ async function hover(element, options) {
|
|
|
23
27
|
if (isPointerEventsEnabled(lastHovered)) {
|
|
24
28
|
const isElementWithinLastHovered = lastHovered.contains(element);
|
|
25
29
|
const relatedTarget = pointerEventsEnabled ? element : null;
|
|
26
|
-
const leaveOptions = {
|
|
30
|
+
const leaveOptions = __spreadProps(__spreadValues({}, options), { relatedTarget });
|
|
27
31
|
fireEvent.pointerOut(lastHovered, leaveOptions);
|
|
28
32
|
if (!isElementWithinLastHovered) {
|
|
29
33
|
fireEvent.pointerLeave(lastHovered, leaveOptions);
|
|
@@ -36,7 +40,7 @@ async function hover(element, options) {
|
|
|
36
40
|
}
|
|
37
41
|
await sleep();
|
|
38
42
|
if (pointerEventsEnabled) {
|
|
39
|
-
const enterOptions = lastHovered ? { relatedTarget: lastHovered,
|
|
43
|
+
const enterOptions = lastHovered ? __spreadValues({ relatedTarget: lastHovered }, options) : options;
|
|
40
44
|
fireEvent.pointerOver(element, enterOptions);
|
|
41
45
|
fireEvent.pointerEnter(element, enterOptions);
|
|
42
46
|
if (!disabled) {
|
|
@@ -14,7 +14,7 @@ function focus(element) {
|
|
|
14
14
|
if (!isFocusable(element))
|
|
15
15
|
return;
|
|
16
16
|
const activeElement = getActiveElement(element);
|
|
17
|
-
if (activeElement
|
|
17
|
+
if (activeElement == null ? void 0 : activeElement.dirty) {
|
|
18
18
|
fireEvent.change(activeElement);
|
|
19
19
|
activeElement.dirty = false;
|
|
20
20
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fireEvent
|
|
3
3
|
} from "./B2UPDCBH.js";
|
|
4
|
+
import {
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "./ZEPQ5W7N.js";
|
|
4
7
|
|
|
5
8
|
// src/mouse-up.ts
|
|
6
9
|
function mouseUp(element, options) {
|
|
@@ -8,7 +11,7 @@ function mouseUp(element, options) {
|
|
|
8
11
|
fireEvent.pointerUp(element, options);
|
|
9
12
|
if (disabled)
|
|
10
13
|
return;
|
|
11
|
-
fireEvent.mouseUp(element, { detail: 1,
|
|
14
|
+
fireEvent.mouseUp(element, __spreadValues({ detail: 1 }, options));
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
export {
|
|
@@ -3,10 +3,13 @@ import {
|
|
|
3
3
|
} from "./GW7B4E2U.js";
|
|
4
4
|
import {
|
|
5
5
|
focus
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./JVZDQIPK.js";
|
|
7
7
|
import {
|
|
8
8
|
fireEvent
|
|
9
9
|
} from "./B2UPDCBH.js";
|
|
10
|
+
import {
|
|
11
|
+
__spreadValues
|
|
12
|
+
} from "./ZEPQ5W7N.js";
|
|
10
13
|
|
|
11
14
|
// src/mouse-down.ts
|
|
12
15
|
import { getDocument } from "@ariakit/core/utils/dom";
|
|
@@ -15,7 +18,7 @@ function mouseDown(element, options) {
|
|
|
15
18
|
const { disabled } = element;
|
|
16
19
|
let defaultAllowed = fireEvent.pointerDown(element, options);
|
|
17
20
|
if (!disabled) {
|
|
18
|
-
if (!fireEvent.mouseDown(element, { detail: 1,
|
|
21
|
+
if (!fireEvent.mouseDown(element, __spreadValues({ detail: 1 }, options))) {
|
|
19
22
|
defaultAllowed = false;
|
|
20
23
|
}
|
|
21
24
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "./ZEPQ5W7N.js";
|
|
4
|
+
|
|
1
5
|
// src/render.ts
|
|
2
6
|
import { StrictMode } from "react";
|
|
3
7
|
import { render } from "@testing-library/react";
|
|
4
8
|
function customRender(ui, options) {
|
|
5
|
-
return render(ui, { wrapper: StrictMode,
|
|
9
|
+
return render(ui, __spreadValues({ wrapper: StrictMode }, options));
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
focus
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./JVZDQIPK.js";
|
|
4
4
|
import {
|
|
5
5
|
fireEvent
|
|
6
6
|
} from "./B2UPDCBH.js";
|
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
queuedMicrotasks
|
|
12
12
|
} from "./ZEO5Q6UD.js";
|
|
13
|
+
import {
|
|
14
|
+
__spreadValues
|
|
15
|
+
} from "./ZEPQ5W7N.js";
|
|
13
16
|
|
|
14
17
|
// src/type.ts
|
|
15
18
|
import { getActiveElement, isTextField } from "@ariakit/core/utils/dom";
|
|
@@ -36,6 +39,7 @@ function workAroundEmailInput(element) {
|
|
|
36
39
|
};
|
|
37
40
|
}
|
|
38
41
|
async function type(text, element, options = {}) {
|
|
42
|
+
var _a, _b;
|
|
39
43
|
if (element == null) {
|
|
40
44
|
element = document.activeElement;
|
|
41
45
|
}
|
|
@@ -48,12 +52,12 @@ async function type(text, element, options = {}) {
|
|
|
48
52
|
const key = getKeyFromChar(char);
|
|
49
53
|
let value = "";
|
|
50
54
|
let inputType = options.isComposing ? "insertCompositionText" : "insertText";
|
|
51
|
-
let defaultAllowed = fireEvent.keyDown(element, { key,
|
|
55
|
+
let defaultAllowed = fireEvent.keyDown(element, __spreadValues({ key }, options));
|
|
52
56
|
await queuedMicrotasks();
|
|
53
57
|
element = getActiveElement(element) || element;
|
|
54
58
|
if (isTextField(element)) {
|
|
55
59
|
const input = element;
|
|
56
|
-
const [start, end] = [input.selectionStart
|
|
60
|
+
const [start, end] = [(_a = input.selectionStart) != null ? _a : 0, (_b = input.selectionEnd) != null ? _b : 0];
|
|
57
61
|
const collapsed = start === end;
|
|
58
62
|
let nextCaretPosition = start;
|
|
59
63
|
if (char === "\x7F") {
|
|
@@ -76,30 +80,27 @@ async function type(text, element, options = {}) {
|
|
|
76
80
|
}
|
|
77
81
|
if (defaultAllowed && !input.readOnly) {
|
|
78
82
|
if (inputType === "insertText") {
|
|
79
|
-
defaultAllowed = fireEvent.keyPress(input, {
|
|
83
|
+
defaultAllowed = fireEvent.keyPress(input, __spreadValues({
|
|
80
84
|
key,
|
|
81
|
-
charCode: key.charCodeAt(0)
|
|
82
|
-
|
|
83
|
-
});
|
|
85
|
+
charCode: key.charCodeAt(0)
|
|
86
|
+
}, options));
|
|
84
87
|
}
|
|
85
88
|
if (inputType === "insertCompositionText") {
|
|
86
|
-
defaultAllowed = fireEvent.compositionUpdate(input, {
|
|
89
|
+
defaultAllowed = fireEvent.compositionUpdate(input, __spreadValues({
|
|
87
90
|
data: char,
|
|
88
|
-
target: { value }
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
+
target: { value }
|
|
92
|
+
}, options));
|
|
91
93
|
}
|
|
92
94
|
if (defaultAllowed) {
|
|
93
|
-
fireEvent.input(input, {
|
|
95
|
+
fireEvent.input(input, __spreadValues({
|
|
94
96
|
data: char,
|
|
95
97
|
target: {
|
|
96
98
|
value,
|
|
97
99
|
selectionStart: nextCaretPosition,
|
|
98
100
|
selectionEnd: nextCaretPosition
|
|
99
101
|
},
|
|
100
|
-
inputType
|
|
101
|
-
|
|
102
|
-
});
|
|
102
|
+
inputType
|
|
103
|
+
}, options));
|
|
103
104
|
if (input.selectionStart !== nextCaretPosition) {
|
|
104
105
|
input.setSelectionRange(nextCaretPosition, nextCaretPosition);
|
|
105
106
|
}
|
|
@@ -107,7 +108,7 @@ async function type(text, element, options = {}) {
|
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
await sleep();
|
|
110
|
-
fireEvent.keyUp(element, { key,
|
|
111
|
+
fireEvent.keyUp(element, __spreadValues({ key }, options));
|
|
111
112
|
await sleep();
|
|
112
113
|
}
|
|
113
114
|
restoreEmailInput();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./S4IIXAAC.js";
|
|
4
4
|
import {
|
|
5
5
|
blur
|
|
6
6
|
} from "./GW7B4E2U.js";
|
|
7
7
|
import {
|
|
8
8
|
focus
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./JVZDQIPK.js";
|
|
10
10
|
import {
|
|
11
11
|
fireEvent
|
|
12
12
|
} from "./B2UPDCBH.js";
|
|
@@ -16,6 +16,9 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
queuedMicrotasks
|
|
18
18
|
} from "./ZEO5Q6UD.js";
|
|
19
|
+
import {
|
|
20
|
+
__spreadValues
|
|
21
|
+
} from "./ZEPQ5W7N.js";
|
|
19
22
|
|
|
20
23
|
// src/press.ts
|
|
21
24
|
import { isTextField } from "@ariakit/core/utils/dom";
|
|
@@ -80,7 +83,7 @@ var keyDownMap = {
|
|
|
80
83
|
ArrowLeft(element, { shiftKey }) {
|
|
81
84
|
if (isTextField(element)) {
|
|
82
85
|
const { value, selectionStart, selectionEnd, selectionDirection } = element;
|
|
83
|
-
const [start, end] = [selectionStart
|
|
86
|
+
const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
|
|
84
87
|
const collapsing = !shiftKey && start !== end;
|
|
85
88
|
const nextStart = Math.max(0, collapsing ? start : start - 1);
|
|
86
89
|
const nextEnd = Math.min(value.length, shiftKey ? end : nextStart);
|
|
@@ -94,7 +97,7 @@ var keyDownMap = {
|
|
|
94
97
|
ArrowRight(element, { shiftKey }) {
|
|
95
98
|
if (isTextField(element)) {
|
|
96
99
|
const { value, selectionStart, selectionEnd, selectionDirection } = element;
|
|
97
|
-
const [start, end] = [selectionStart
|
|
100
|
+
const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
|
|
98
101
|
const collapsing = !shiftKey && start !== end;
|
|
99
102
|
const nextEnd = Math.min(value.length, collapsing ? end : end + 1);
|
|
100
103
|
const nextStart = Math.max(0, shiftKey ? start : nextEnd);
|
|
@@ -111,7 +114,7 @@ var keyDownMap = {
|
|
|
111
114
|
return element.setSelectionRange(0, 0);
|
|
112
115
|
} else {
|
|
113
116
|
const { selectionStart, selectionEnd, selectionDirection } = element;
|
|
114
|
-
const [start, end] = [selectionStart
|
|
117
|
+
const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
|
|
115
118
|
if (selectionDirection === "forward") {
|
|
116
119
|
element.setSelectionRange(start, start);
|
|
117
120
|
} else {
|
|
@@ -129,7 +132,7 @@ var keyDownMap = {
|
|
|
129
132
|
element.setSelectionRange(length, length);
|
|
130
133
|
} else {
|
|
131
134
|
const { selectionStart, selectionEnd, selectionDirection } = element;
|
|
132
|
-
const [start, end] = [selectionStart
|
|
135
|
+
const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
|
|
133
136
|
if (selectionDirection === "backward") {
|
|
134
137
|
element.setSelectionRange(end, end);
|
|
135
138
|
} else {
|
|
@@ -152,6 +155,7 @@ var keyUpMap = {
|
|
|
152
155
|
}
|
|
153
156
|
};
|
|
154
157
|
async function press(key, element, options = {}) {
|
|
158
|
+
var _a, _b, _c, _d;
|
|
155
159
|
if (element == null) {
|
|
156
160
|
element = document.activeElement || document.body;
|
|
157
161
|
}
|
|
@@ -170,7 +174,7 @@ async function press(key, element, options = {}) {
|
|
|
170
174
|
return type("\n", element, options);
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
|
-
if (element.ownerDocument
|
|
177
|
+
if (((_a = element.ownerDocument) == null ? void 0 : _a.activeElement) !== element) {
|
|
174
178
|
if (element.tagName === "BODY") {
|
|
175
179
|
blur();
|
|
176
180
|
} else {
|
|
@@ -178,26 +182,26 @@ async function press(key, element, options = {}) {
|
|
|
178
182
|
}
|
|
179
183
|
}
|
|
180
184
|
await sleep();
|
|
181
|
-
let defaultAllowed = fireEvent.keyDown(element, { key,
|
|
185
|
+
let defaultAllowed = fireEvent.keyDown(element, __spreadValues({ key }, options));
|
|
182
186
|
await queuedMicrotasks();
|
|
183
187
|
if (defaultAllowed && key in keyDownMap && !options.metaKey) {
|
|
184
|
-
keyDownMap[key]
|
|
188
|
+
(_b = keyDownMap[key]) == null ? void 0 : _b.call(keyDownMap, element, options);
|
|
185
189
|
}
|
|
186
190
|
await sleep();
|
|
187
|
-
if (element.ownerDocument
|
|
191
|
+
if (((_c = element.ownerDocument) == null ? void 0 : _c.activeElement) !== element) {
|
|
188
192
|
element = element.ownerDocument.activeElement;
|
|
189
193
|
}
|
|
190
|
-
if (!fireEvent.keyUp(element, { key,
|
|
194
|
+
if (!fireEvent.keyUp(element, __spreadValues({ key }, options))) {
|
|
191
195
|
defaultAllowed = false;
|
|
192
196
|
}
|
|
193
197
|
await queuedMicrotasks();
|
|
194
198
|
if (defaultAllowed && key in keyUpMap && !options.metaKey) {
|
|
195
|
-
keyUpMap[key]
|
|
199
|
+
(_d = keyUpMap[key]) == null ? void 0 : _d.call(keyUpMap, element, options);
|
|
196
200
|
}
|
|
197
201
|
await sleep();
|
|
198
202
|
}
|
|
199
203
|
function createPress(key, defaultOptions = {}) {
|
|
200
|
-
return (element, options = {}) => press(key, element, {
|
|
204
|
+
return (element, options = {}) => press(key, element, __spreadValues(__spreadValues({}, defaultOptions), options));
|
|
201
205
|
}
|
|
202
206
|
press.Escape = createPress("Escape");
|
|
203
207
|
press.Backspace = createPress("Backspace");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
__spreadValues,
|
|
23
|
+
__spreadProps
|
|
24
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mouseUp
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./KPOWUSLK.js";
|
|
4
4
|
import {
|
|
5
5
|
mouseDown
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./N3NIS6J5.js";
|
|
7
7
|
import {
|
|
8
8
|
hover
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./DRKLVF57.js";
|
|
10
10
|
import {
|
|
11
11
|
focus
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./JVZDQIPK.js";
|
|
13
13
|
import {
|
|
14
14
|
fireEvent
|
|
15
15
|
} from "./B2UPDCBH.js";
|
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
queuedMicrotasks
|
|
21
21
|
} from "./ZEO5Q6UD.js";
|
|
22
|
+
import {
|
|
23
|
+
__spreadValues
|
|
24
|
+
} from "./ZEPQ5W7N.js";
|
|
22
25
|
|
|
23
26
|
// src/click.ts
|
|
24
27
|
import { closest, isVisible } from "@ariakit/core/utils/dom";
|
|
@@ -30,12 +33,13 @@ function getClosestLabel(element) {
|
|
|
30
33
|
return null;
|
|
31
34
|
}
|
|
32
35
|
function getInputFromLabel(element) {
|
|
33
|
-
|
|
36
|
+
var _a;
|
|
37
|
+
const input = element.htmlFor ? (_a = element.ownerDocument) == null ? void 0 : _a.getElementById(element.htmlFor) : element.querySelector("input,textarea,select");
|
|
34
38
|
return input;
|
|
35
39
|
}
|
|
36
40
|
function clickLabel(element, options) {
|
|
37
41
|
const input = getInputFromLabel(element);
|
|
38
|
-
const isInputDisabled = Boolean(input
|
|
42
|
+
const isInputDisabled = Boolean(input == null ? void 0 : input.disabled);
|
|
39
43
|
if (input) {
|
|
40
44
|
input.disabled = true;
|
|
41
45
|
}
|
|
@@ -71,7 +75,7 @@ function clickOption(element, eventOptions) {
|
|
|
71
75
|
setSelected(option, true);
|
|
72
76
|
});
|
|
73
77
|
};
|
|
74
|
-
if (eventOptions
|
|
78
|
+
if (eventOptions == null ? void 0 : eventOptions.shiftKey) {
|
|
75
79
|
const elementIndex = options.indexOf(element);
|
|
76
80
|
const referenceOption = select.lastOptionSelectedNotByShiftKey;
|
|
77
81
|
const referenceOptionIndex = referenceOption ? options.indexOf(referenceOption) : -1;
|
|
@@ -80,7 +84,7 @@ function clickOption(element, eventOptions) {
|
|
|
80
84
|
setSelected(element, true);
|
|
81
85
|
} else {
|
|
82
86
|
select.lastOptionSelectedNotByShiftKey = element;
|
|
83
|
-
if (eventOptions
|
|
87
|
+
if (eventOptions == null ? void 0 : eventOptions.ctrlKey) {
|
|
84
88
|
setSelected(element, !element.selected);
|
|
85
89
|
} else {
|
|
86
90
|
resetOptions();
|
|
@@ -114,11 +118,11 @@ async function click(element, options, tap = false) {
|
|
|
114
118
|
return;
|
|
115
119
|
const label = getClosestLabel(element);
|
|
116
120
|
if (label) {
|
|
117
|
-
clickLabel(label, { detail: 1,
|
|
121
|
+
clickLabel(label, __spreadValues({ detail: 1 }, options));
|
|
118
122
|
} else if (element instanceof HTMLOptionElement) {
|
|
119
|
-
clickOption(element, { detail: 1,
|
|
123
|
+
clickOption(element, __spreadValues({ detail: 1 }, options));
|
|
120
124
|
} else {
|
|
121
|
-
fireEvent.click(element, { detail: 1,
|
|
125
|
+
fireEvent.click(element, __spreadValues({ detail: 1 }, options));
|
|
122
126
|
}
|
|
123
127
|
await sleep();
|
|
124
128
|
}
|
package/esm/act.js
CHANGED
package/esm/blur.js
CHANGED
package/esm/click.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
click
|
|
3
|
-
} from "./__chunks/
|
|
4
|
-
import "./__chunks/
|
|
5
|
-
import "./__chunks/
|
|
3
|
+
} from "./__chunks/ZUY7UFA4.js";
|
|
4
|
+
import "./__chunks/KPOWUSLK.js";
|
|
5
|
+
import "./__chunks/N3NIS6J5.js";
|
|
6
6
|
import "./__chunks/GW7B4E2U.js";
|
|
7
|
-
import "./__chunks/
|
|
8
|
-
import "./__chunks/
|
|
9
|
-
import "./__chunks/
|
|
7
|
+
import "./__chunks/DRKLVF57.js";
|
|
8
|
+
import "./__chunks/JVZDQIPK.js";
|
|
9
|
+
import "./__chunks/5UPN6XV7.js";
|
|
10
10
|
import "./__chunks/B2UPDCBH.js";
|
|
11
11
|
import "./__chunks/5PINJ4MD.js";
|
|
12
12
|
import "./__chunks/PNBZ5NXH.js";
|
|
13
13
|
import "./__chunks/ZEO5Q6UD.js";
|
|
14
|
+
import "./__chunks/ZEPQ5W7N.js";
|
|
14
15
|
export {
|
|
15
16
|
click
|
|
16
17
|
};
|
package/esm/fire-event.js
CHANGED
package/esm/focus.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
focus
|
|
3
|
-
} from "./__chunks/
|
|
4
|
-
import "./__chunks/
|
|
3
|
+
} from "./__chunks/JVZDQIPK.js";
|
|
4
|
+
import "./__chunks/5UPN6XV7.js";
|
|
5
5
|
import "./__chunks/B2UPDCBH.js";
|
|
6
6
|
import "./__chunks/PNBZ5NXH.js";
|
|
7
7
|
import "./__chunks/ZEO5Q6UD.js";
|
|
8
|
+
import "./__chunks/ZEPQ5W7N.js";
|
|
8
9
|
export {
|
|
9
10
|
focus
|
|
10
11
|
};
|
package/esm/hover.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hover
|
|
3
|
-
} from "./__chunks/
|
|
3
|
+
} from "./__chunks/DRKLVF57.js";
|
|
4
4
|
import "./__chunks/B2UPDCBH.js";
|
|
5
5
|
import "./__chunks/5PINJ4MD.js";
|
|
6
6
|
import "./__chunks/PNBZ5NXH.js";
|
|
7
7
|
import "./__chunks/ZEO5Q6UD.js";
|
|
8
|
+
import "./__chunks/ZEPQ5W7N.js";
|
|
8
9
|
export {
|
|
9
10
|
hover
|
|
10
11
|
};
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
press
|
|
3
|
-
} from "./__chunks/
|
|
3
|
+
} from "./__chunks/X23QJEN5.js";
|
|
4
4
|
import {
|
|
5
5
|
within
|
|
6
6
|
} from "./__chunks/QA3ZS6S2.js";
|
|
@@ -9,32 +9,32 @@ import {
|
|
|
9
9
|
} from "./__chunks/5JPM5LQX.js";
|
|
10
10
|
import {
|
|
11
11
|
type
|
|
12
|
-
} from "./__chunks/
|
|
12
|
+
} from "./__chunks/S4IIXAAC.js";
|
|
13
13
|
import {
|
|
14
14
|
tap
|
|
15
|
-
} from "./__chunks/
|
|
15
|
+
} from "./__chunks/4AKNUH2A.js";
|
|
16
16
|
import {
|
|
17
17
|
click
|
|
18
|
-
} from "./__chunks/
|
|
18
|
+
} from "./__chunks/ZUY7UFA4.js";
|
|
19
19
|
import {
|
|
20
20
|
select
|
|
21
|
-
} from "./__chunks/
|
|
21
|
+
} from "./__chunks/2E5JZMOP.js";
|
|
22
22
|
import {
|
|
23
23
|
mouseUp
|
|
24
|
-
} from "./__chunks/
|
|
24
|
+
} from "./__chunks/KPOWUSLK.js";
|
|
25
25
|
import {
|
|
26
26
|
mouseDown
|
|
27
|
-
} from "./__chunks/
|
|
27
|
+
} from "./__chunks/N3NIS6J5.js";
|
|
28
28
|
import {
|
|
29
29
|
blur
|
|
30
30
|
} from "./__chunks/GW7B4E2U.js";
|
|
31
31
|
import {
|
|
32
32
|
hover
|
|
33
|
-
} from "./__chunks/
|
|
33
|
+
} from "./__chunks/DRKLVF57.js";
|
|
34
34
|
import {
|
|
35
35
|
focus
|
|
36
|
-
} from "./__chunks/
|
|
37
|
-
import "./__chunks/
|
|
36
|
+
} from "./__chunks/JVZDQIPK.js";
|
|
37
|
+
import "./__chunks/5UPN6XV7.js";
|
|
38
38
|
import {
|
|
39
39
|
fireEvent
|
|
40
40
|
} from "./__chunks/B2UPDCBH.js";
|
|
@@ -74,7 +74,8 @@ import {
|
|
|
74
74
|
} from "./__chunks/3C72DPE2.js";
|
|
75
75
|
import {
|
|
76
76
|
customRender
|
|
77
|
-
} from "./__chunks/
|
|
77
|
+
} from "./__chunks/O77EMIKC.js";
|
|
78
|
+
import "./__chunks/ZEPQ5W7N.js";
|
|
78
79
|
export {
|
|
79
80
|
act,
|
|
80
81
|
blur,
|
package/esm/mouse-down.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mouseDown
|
|
3
|
-
} from "./__chunks/
|
|
3
|
+
} from "./__chunks/N3NIS6J5.js";
|
|
4
4
|
import "./__chunks/GW7B4E2U.js";
|
|
5
|
-
import "./__chunks/
|
|
6
|
-
import "./__chunks/
|
|
5
|
+
import "./__chunks/JVZDQIPK.js";
|
|
6
|
+
import "./__chunks/5UPN6XV7.js";
|
|
7
7
|
import "./__chunks/B2UPDCBH.js";
|
|
8
8
|
import "./__chunks/PNBZ5NXH.js";
|
|
9
9
|
import "./__chunks/ZEO5Q6UD.js";
|
|
10
|
+
import "./__chunks/ZEPQ5W7N.js";
|
|
10
11
|
export {
|
|
11
12
|
mouseDown
|
|
12
13
|
};
|