@ariakit/test 0.2.5 → 0.3.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.
- package/CHANGELOG.md +36 -0
- package/cjs/__chunks/2KXSRUIV.cjs +205 -0
- package/cjs/__chunks/747HORQZ.cjs +30 -0
- package/cjs/__chunks/A5IFXY4J.cjs +33 -0
- package/cjs/__chunks/DAHHEUOU.cjs +95 -0
- package/cjs/__chunks/{2V5PIRJZ.cjs → ESE7QHAQ.cjs} +71 -70
- package/cjs/__chunks/FU2U6RZL.cjs +57 -0
- package/cjs/__chunks/I2BROIQW.cjs +1 -0
- package/cjs/__chunks/KVNENCXT.cjs +36 -0
- package/cjs/__chunks/LYOKT276.cjs +69 -0
- package/cjs/__chunks/NIEATM7R.cjs +20 -0
- package/cjs/__chunks/{PKWBCPZU.cjs → OVN5OYWK.cjs} +2 -1
- package/cjs/__chunks/{LUIPCXQX.cjs → PJWPDIUX.cjs} +48 -44
- package/cjs/__chunks/SDUGTL2N.cjs +13 -0
- package/cjs/__chunks/SEWCIANI.cjs +14 -0
- package/cjs/__chunks/T5KVOIJT.cjs +58 -0
- package/cjs/__chunks/VZINRVVH.cjs +126 -0
- package/cjs/__chunks/ZMMVJ3OT.cjs +72 -0
- package/cjs/__tests__/use-all-events.d.cts +1 -0
- package/cjs/__utils.d.cts +11 -0
- package/cjs/__utils.d.ts +6 -3
- package/cjs/blur.cjs +7 -8
- package/cjs/blur.d.cts +2 -0
- package/cjs/blur.d.ts +1 -2
- package/cjs/click.cjs +13 -14
- package/cjs/click.d.cts +1 -0
- package/cjs/click.d.ts +1 -2
- package/cjs/dispatch.cjs +9 -0
- package/cjs/dispatch.d.cts +9 -0
- package/cjs/dispatch.d.ts +9 -0
- package/cjs/focus.cjs +7 -8
- package/cjs/focus.d.cts +1 -0
- package/cjs/focus.d.ts +1 -2
- package/cjs/hover.cjs +8 -9
- package/cjs/hover.d.cts +1 -0
- package/cjs/hover.d.ts +1 -2
- package/cjs/index.cjs +19 -76
- package/cjs/index.d.cts +14 -0
- package/cjs/index.d.ts +2 -5
- package/cjs/mouse-down.cjs +9 -10
- package/cjs/mouse-down.d.cts +1 -0
- package/cjs/mouse-down.d.ts +1 -2
- package/cjs/mouse-up.cjs +7 -7
- package/cjs/mouse-up.d.cts +1 -0
- package/cjs/mouse-up.d.ts +1 -2
- package/cjs/press.cjs +11 -12
- package/cjs/press.d.cts +18 -0
- package/cjs/press.d.ts +0 -1
- package/cjs/query.cjs +10 -0
- package/cjs/query.d.cts +3989 -0
- package/cjs/query.d.ts +3989 -0
- package/cjs/react.cjs +90 -0
- package/cjs/react.d.cts +7 -0
- package/cjs/react.d.ts +7 -0
- package/cjs/select.cjs +13 -14
- package/cjs/select.d.cts +1 -0
- package/cjs/select.d.ts +1 -2
- package/cjs/sleep.cjs +6 -6
- package/cjs/sleep.d.cts +1 -0
- package/cjs/tap.cjs +14 -15
- package/cjs/tap.d.cts +1 -0
- package/cjs/tap.d.ts +1 -2
- package/cjs/type.cjs +9 -10
- package/cjs/type.d.cts +2 -0
- package/cjs/type.d.ts +0 -1
- package/cjs/wait-for.cjs +6 -4
- package/cjs/wait-for.d.cts +2 -0
- package/cjs/wait-for.d.ts +2 -1
- package/dispatch/package.json +8 -0
- package/esm/__chunks/{SWUQE4WB.js → 5DPK2YAQ.js} +48 -44
- package/esm/__chunks/7JP5HWUW.js +57 -0
- package/esm/__chunks/ANPGABTJ.js +69 -0
- package/esm/__chunks/H3BXHZTZ.js +95 -0
- package/esm/__chunks/HUBUFZ3U.js +205 -0
- package/esm/__chunks/HVRX3U4O.js +126 -0
- package/esm/__chunks/LHKK7Y5F.js +72 -0
- package/esm/__chunks/LSH2PT34.js +30 -0
- package/esm/__chunks/MKNCAN2F.js +13 -0
- package/esm/__chunks/{6XO5G2QR.js → Q65FZOE2.js} +1 -0
- package/esm/__chunks/RG2JKALK.js +58 -0
- package/esm/__chunks/RHBNMDK4.js +1 -0
- package/esm/__chunks/{6PY4HXVO.js → UJCT5GXS.js} +71 -70
- package/esm/__chunks/WAYMNUAF.js +33 -0
- package/esm/__chunks/WLDGXXGP.js +14 -0
- package/esm/__chunks/YNAZUNNE.js +20 -0
- package/esm/__chunks/ZIWQZF7I.js +36 -0
- package/esm/__utils.d.ts +6 -3
- package/esm/blur.d.ts +1 -2
- package/esm/blur.js +5 -6
- package/esm/click.d.ts +1 -2
- package/esm/click.js +11 -12
- package/esm/dispatch.d.ts +9 -0
- package/esm/dispatch.js +9 -0
- package/esm/focus.d.ts +1 -2
- package/esm/focus.js +5 -6
- package/esm/hover.d.ts +1 -2
- package/esm/hover.js +6 -7
- package/esm/index.d.ts +2 -5
- package/esm/index.js +31 -88
- package/esm/mouse-down.d.ts +1 -2
- package/esm/mouse-down.js +7 -8
- package/esm/mouse-up.d.ts +1 -2
- package/esm/mouse-up.js +5 -5
- package/esm/press.d.ts +0 -1
- package/esm/press.js +9 -10
- package/esm/query.d.ts +3989 -0
- package/esm/query.js +10 -0
- package/esm/react.d.ts +7 -0
- package/esm/react.js +90 -0
- package/esm/select.d.ts +1 -2
- package/esm/select.js +11 -12
- package/esm/sleep.js +4 -4
- package/esm/tap.d.ts +1 -2
- package/esm/tap.js +12 -13
- package/esm/type.d.ts +0 -1
- package/esm/type.js +7 -8
- package/esm/wait-for.d.ts +2 -1
- package/esm/wait-for.js +4 -2
- package/package.json +85 -40
- package/query/package.json +8 -0
- package/react/package.json +8 -0
- package/act/package.json +0 -8
- package/cjs/__chunks/3NIZQX5J.cjs +0 -6
- package/cjs/__chunks/3WW644T7.cjs +0 -20
- package/cjs/__chunks/5F5PNQCC.cjs +0 -22
- package/cjs/__chunks/7BZFO6FC.cjs +0 -12
- package/cjs/__chunks/7RUXTAPP.cjs +0 -16
- package/cjs/__chunks/AYRPODWR.cjs +0 -1
- package/cjs/__chunks/B4VP2LEU.cjs +0 -28
- package/cjs/__chunks/BHNBCXUN.cjs +0 -33
- package/cjs/__chunks/EGF4KWUK.cjs +0 -64
- package/cjs/__chunks/HGTTGPFK.cjs +0 -54
- package/cjs/__chunks/JY5DGPUE.cjs +0 -14
- package/cjs/__chunks/KRQVK4KQ.cjs +0 -38
- package/cjs/__chunks/LFNIGEB6.cjs +0 -50
- package/cjs/__chunks/MQA5IB4L.cjs +0 -6
- package/cjs/__chunks/Q7PN3HIB.cjs +0 -121
- package/cjs/__chunks/SYQ5J5KP.cjs +0 -32
- package/cjs/__chunks/VIKUJSTX.cjs +0 -83
- package/cjs/act.cjs +0 -8
- package/cjs/act.d.ts +0 -1
- package/cjs/fire-event.cjs +0 -9
- package/cjs/fire-event.d.ts +0 -3
- package/cjs/polyfills.cjs +0 -3
- package/cjs/render.cjs +0 -9
- package/cjs/render.d.ts +0 -5
- package/cjs/screen.cjs +0 -55
- package/cjs/screen.d.ts +0 -26
- package/cjs/tsconfig.build.tsbuildinfo +0 -1
- package/cjs/within.cjs +0 -7
- package/cjs/within.d.ts +0 -1
- package/esm/__chunks/2OZA4WAZ.js +0 -50
- package/esm/__chunks/2RHTJFSK.js +0 -38
- package/esm/__chunks/3C72DPE2.js +0 -54
- package/esm/__chunks/4A3YKZRA.js +0 -121
- package/esm/__chunks/5JPM5LQX.js +0 -6
- package/esm/__chunks/5PINJ4MD.js +0 -16
- package/esm/__chunks/AEOE57TZ.js +0 -33
- package/esm/__chunks/EVYPE6ZJ.js +0 -32
- package/esm/__chunks/EX5WPJOU.js +0 -64
- package/esm/__chunks/JTFRQL3H.js +0 -83
- package/esm/__chunks/LJWZLI6L.js +0 -14
- package/esm/__chunks/OQYWQML5.js +0 -12
- package/esm/__chunks/OSCTTZUZ.js +0 -28
- package/esm/__chunks/PNBZ5NXH.js +0 -0
- package/esm/__chunks/QA3ZS6S2.js +0 -6
- package/esm/__chunks/R7IYW63J.js +0 -22
- package/esm/__chunks/ZEO5Q6UD.js +0 -20
- package/esm/act.d.ts +0 -1
- package/esm/act.js +0 -8
- package/esm/fire-event.d.ts +0 -3
- package/esm/fire-event.js +0 -9
- package/esm/polyfills.d.ts +0 -1
- package/esm/polyfills.js +0 -3
- package/esm/render.d.ts +0 -5
- package/esm/render.js +0 -9
- package/esm/screen.d.ts +0 -26
- package/esm/screen.js +0 -55
- package/esm/tsconfig.build.tsbuildinfo +0 -1
- package/esm/within.d.ts +0 -1
- package/esm/within.js +0 -7
- package/fire-event/package.json +0 -8
- package/polyfills/package.json +0 -8
- package/render/package.json +0 -8
- package/screen/package.json +0 -8
- package/within/package.json +0 -8
- /package/cjs/{polyfills.d.ts → __tests__/blur-test.d.cts} +0 -0
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
type
|
|
3
|
-
} from "./
|
|
4
|
+
} from "./HVRX3U4O.js";
|
|
4
5
|
import {
|
|
5
6
|
blur
|
|
6
|
-
} from "./
|
|
7
|
+
} from "./ZIWQZF7I.js";
|
|
7
8
|
import {
|
|
8
9
|
focus
|
|
9
|
-
} from "./
|
|
10
|
+
} from "./WAYMNUAF.js";
|
|
10
11
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./
|
|
12
|
+
dispatch
|
|
13
|
+
} from "./7JP5HWUW.js";
|
|
13
14
|
import {
|
|
14
15
|
sleep
|
|
15
|
-
} from "./
|
|
16
|
+
} from "./YNAZUNNE.js";
|
|
16
17
|
import {
|
|
17
|
-
|
|
18
|
-
} from "./
|
|
18
|
+
wrapAsync
|
|
19
|
+
} from "./LHKK7Y5F.js";
|
|
19
20
|
import {
|
|
20
21
|
__spreadValues
|
|
21
|
-
} from "./
|
|
22
|
+
} from "./Q65FZOE2.js";
|
|
22
23
|
|
|
23
24
|
// src/press.ts
|
|
24
25
|
import { isTextField } from "@ariakit/core/utils/dom";
|
|
@@ -35,7 +36,7 @@ var clickableInputTypes = [
|
|
|
35
36
|
"reset",
|
|
36
37
|
"submit"
|
|
37
38
|
];
|
|
38
|
-
function submitFormByPressingEnterOn(element, options) {
|
|
39
|
+
async function submitFormByPressingEnterOn(element, options) {
|
|
39
40
|
const { form } = element;
|
|
40
41
|
if (!form)
|
|
41
42
|
return;
|
|
@@ -47,40 +48,40 @@ function submitFormByPressingEnterOn(element, options) {
|
|
|
47
48
|
(el) => (el instanceof HTMLInputElement || el instanceof HTMLButtonElement) && el.type === "submit"
|
|
48
49
|
);
|
|
49
50
|
if (validInputs.length === 1 || submitButton) {
|
|
50
|
-
|
|
51
|
+
await dispatch.submit(form, options);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
function isNumberInput(element) {
|
|
54
55
|
return element instanceof HTMLInputElement && element.type === "number";
|
|
55
56
|
}
|
|
56
|
-
function incrementNumberInput(element, by = 1) {
|
|
57
|
+
async function incrementNumberInput(element, by = 1) {
|
|
57
58
|
const value = +element.value + by;
|
|
58
59
|
const max = element.max ? +element.max : Number.MAX_SAFE_INTEGER;
|
|
59
60
|
const min = element.min ? +element.min : Number.MIN_SAFE_INTEGER;
|
|
60
61
|
if (value > max || value < min)
|
|
61
62
|
return;
|
|
62
63
|
element.value = value.toString();
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
await dispatch.input(element);
|
|
65
|
+
await dispatch.change(element);
|
|
65
66
|
}
|
|
66
67
|
var keyDownMap = {
|
|
67
|
-
Tab(_, { shiftKey }) {
|
|
68
|
+
async Tab(_, { shiftKey }) {
|
|
68
69
|
const nextElement = shiftKey ? getPreviousTabbable() : getNextTabbable();
|
|
69
70
|
if (nextElement) {
|
|
70
|
-
focus(nextElement);
|
|
71
|
+
await focus(nextElement);
|
|
71
72
|
}
|
|
72
73
|
},
|
|
73
|
-
Enter(element, options) {
|
|
74
|
+
async Enter(element, options) {
|
|
74
75
|
const nonSubmittableTypes = [...clickableInputTypes, "hidden"];
|
|
75
76
|
const isClickable = element.tagName === "BUTTON" || element instanceof HTMLInputElement && clickableInputTypes.includes(element.type);
|
|
76
77
|
const isSubmittable = element instanceof HTMLInputElement && !nonSubmittableTypes.includes(element.type);
|
|
77
78
|
if (isClickable) {
|
|
78
|
-
|
|
79
|
+
await dispatch.click(element, options);
|
|
79
80
|
} else if (isSubmittable) {
|
|
80
|
-
submitFormByPressingEnterOn(element, options);
|
|
81
|
+
await submitFormByPressingEnterOn(element, options);
|
|
81
82
|
}
|
|
82
83
|
},
|
|
83
|
-
ArrowLeft(element, { shiftKey }) {
|
|
84
|
+
async ArrowLeft(element, { shiftKey }) {
|
|
84
85
|
if (isTextField(element)) {
|
|
85
86
|
const { value, selectionStart, selectionEnd, selectionDirection } = element;
|
|
86
87
|
const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
|
|
@@ -94,7 +95,7 @@ var keyDownMap = {
|
|
|
94
95
|
);
|
|
95
96
|
}
|
|
96
97
|
},
|
|
97
|
-
ArrowRight(element, { shiftKey }) {
|
|
98
|
+
async ArrowRight(element, { shiftKey }) {
|
|
98
99
|
if (isTextField(element)) {
|
|
99
100
|
const { value, selectionStart, selectionEnd, selectionDirection } = element;
|
|
100
101
|
const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
|
|
@@ -108,7 +109,7 @@ var keyDownMap = {
|
|
|
108
109
|
);
|
|
109
110
|
}
|
|
110
111
|
},
|
|
111
|
-
ArrowUp(element, { shiftKey }) {
|
|
112
|
+
async ArrowUp(element, { shiftKey }) {
|
|
112
113
|
if (isTextField(element)) {
|
|
113
114
|
if (!shiftKey) {
|
|
114
115
|
return element.setSelectionRange(0, 0);
|
|
@@ -122,10 +123,10 @@ var keyDownMap = {
|
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
} else if (isNumberInput(element)) {
|
|
125
|
-
incrementNumberInput(element);
|
|
126
|
+
await incrementNumberInput(element);
|
|
126
127
|
}
|
|
127
128
|
},
|
|
128
|
-
ArrowDown(element, { shiftKey }) {
|
|
129
|
+
async ArrowDown(element, { shiftKey }) {
|
|
129
130
|
if (isTextField(element)) {
|
|
130
131
|
const length = element.value.length;
|
|
131
132
|
if (!shiftKey) {
|
|
@@ -140,65 +141,65 @@ var keyDownMap = {
|
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
} else if (isNumberInput(element)) {
|
|
143
|
-
incrementNumberInput(element, -1);
|
|
144
|
+
await incrementNumberInput(element, -1);
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
};
|
|
147
148
|
var keyUpMap = {
|
|
148
149
|
// Space
|
|
149
|
-
" ": (element, options) => {
|
|
150
|
+
" ": async (element, options) => {
|
|
150
151
|
const spaceableTypes = [...clickableInputTypes, "checkbox", "radio"];
|
|
151
152
|
const isSpaceable = element.tagName === "BUTTON" || element instanceof HTMLInputElement && spaceableTypes.includes(element.type);
|
|
152
153
|
if (isSpaceable) {
|
|
153
|
-
|
|
154
|
+
await dispatch.click(element, options);
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
element
|
|
161
|
-
|
|
162
|
-
if (!element)
|
|
163
|
-
return;
|
|
164
|
-
if (!isFocusable(element) && element.tagName !== "BODY")
|
|
165
|
-
return;
|
|
166
|
-
if (isTextField(element)) {
|
|
167
|
-
if (key.length === 1) {
|
|
168
|
-
return type(key, element, options);
|
|
169
|
-
} else if (key === "Delete") {
|
|
170
|
-
return type("\x7F", element, options);
|
|
171
|
-
} else if (key === "Backspace") {
|
|
172
|
-
return type("\b", element, options);
|
|
173
|
-
} else if (key === "Enter" && element.tagName === "TEXTAREA") {
|
|
174
|
-
return type("\n", element, options);
|
|
158
|
+
function press(key, element, options = {}) {
|
|
159
|
+
return wrapAsync(async () => {
|
|
160
|
+
var _a, _b, _c, _d;
|
|
161
|
+
if (element == null) {
|
|
162
|
+
element = document.activeElement || document.body;
|
|
175
163
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (element.tagName
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
164
|
+
if (!element)
|
|
165
|
+
return;
|
|
166
|
+
if (!isFocusable(element) && element.tagName !== "BODY")
|
|
167
|
+
return;
|
|
168
|
+
if (isTextField(element)) {
|
|
169
|
+
if (key.length === 1) {
|
|
170
|
+
return type(key, element, options);
|
|
171
|
+
} else if (key === "Delete") {
|
|
172
|
+
return type("\x7F", element, options);
|
|
173
|
+
} else if (key === "Backspace") {
|
|
174
|
+
return type("\b", element, options);
|
|
175
|
+
} else if (key === "Enter" && element.tagName === "TEXTAREA") {
|
|
176
|
+
return type("\n", element, options);
|
|
177
|
+
}
|
|
182
178
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
(
|
|
200
|
-
|
|
201
|
-
|
|
179
|
+
if (((_a = element.ownerDocument) == null ? void 0 : _a.activeElement) !== element) {
|
|
180
|
+
if (element.tagName === "BODY") {
|
|
181
|
+
await blur();
|
|
182
|
+
} else {
|
|
183
|
+
await focus(element);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
await sleep();
|
|
187
|
+
let defaultAllowed = await dispatch.keyDown(element, __spreadValues({ key }, options));
|
|
188
|
+
if (defaultAllowed && key in keyDownMap && !options.metaKey) {
|
|
189
|
+
await ((_b = keyDownMap[key]) == null ? void 0 : _b.call(keyDownMap, element, options));
|
|
190
|
+
}
|
|
191
|
+
await sleep();
|
|
192
|
+
if (((_c = element.ownerDocument) == null ? void 0 : _c.activeElement) !== element) {
|
|
193
|
+
element = element.ownerDocument.activeElement;
|
|
194
|
+
}
|
|
195
|
+
if (!await dispatch.keyUp(element, __spreadValues({ key }, options))) {
|
|
196
|
+
defaultAllowed = false;
|
|
197
|
+
}
|
|
198
|
+
if (defaultAllowed && key in keyUpMap && !options.metaKey) {
|
|
199
|
+
await ((_d = keyUpMap[key]) == null ? void 0 : _d.call(keyUpMap, element, options));
|
|
200
|
+
}
|
|
201
|
+
await sleep();
|
|
202
|
+
});
|
|
202
203
|
}
|
|
203
204
|
function createPress(key, defaultOptions = {}) {
|
|
204
205
|
return (element, options = {}) => press(key, element, __spreadValues(__spreadValues({}, defaultOptions), options));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
dispatch
|
|
4
|
+
} from "./7JP5HWUW.js";
|
|
5
|
+
import {
|
|
6
|
+
flushMicrotasks,
|
|
7
|
+
wrapAsync
|
|
8
|
+
} from "./LHKK7Y5F.js";
|
|
9
|
+
|
|
10
|
+
// src/focus.ts
|
|
11
|
+
import { getActiveElement } from "@ariakit/core/utils/dom";
|
|
12
|
+
import { isFocusable } from "@ariakit/core/utils/focus";
|
|
13
|
+
import { invariant } from "@ariakit/core/utils/misc";
|
|
14
|
+
function focus(element) {
|
|
15
|
+
return wrapAsync(async () => {
|
|
16
|
+
invariant(element, "Unable to focus on null element");
|
|
17
|
+
if (getActiveElement(element) === element)
|
|
18
|
+
return;
|
|
19
|
+
if (!isFocusable(element))
|
|
20
|
+
return;
|
|
21
|
+
const activeElement = getActiveElement(element);
|
|
22
|
+
if (activeElement == null ? void 0 : activeElement.dirty) {
|
|
23
|
+
await dispatch.change(activeElement);
|
|
24
|
+
activeElement.dirty = false;
|
|
25
|
+
}
|
|
26
|
+
element.focus();
|
|
27
|
+
await flushMicrotasks();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
focus
|
|
33
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
wrapAsync
|
|
4
|
+
} from "./LHKK7Y5F.js";
|
|
5
|
+
|
|
6
|
+
// src/wait-for.ts
|
|
7
|
+
import * as DOMTestingLibrary from "@testing-library/dom";
|
|
8
|
+
function waitFor2(callback, options) {
|
|
9
|
+
return wrapAsync(() => DOMTestingLibrary.waitFor(callback, options));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
waitFor2 as waitFor
|
|
14
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
isBrowser,
|
|
4
|
+
nextFrame,
|
|
5
|
+
wrapAsync
|
|
6
|
+
} from "./LHKK7Y5F.js";
|
|
7
|
+
|
|
8
|
+
// src/sleep.ts
|
|
9
|
+
var defaultMs = isBrowser ? 150 : 10;
|
|
10
|
+
function sleep(ms = defaultMs) {
|
|
11
|
+
return wrapAsync(async () => {
|
|
12
|
+
await nextFrame();
|
|
13
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
14
|
+
await nextFrame();
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
sleep
|
|
20
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
dispatch
|
|
4
|
+
} from "./7JP5HWUW.js";
|
|
5
|
+
import {
|
|
6
|
+
flushMicrotasks,
|
|
7
|
+
wrapAsync
|
|
8
|
+
} from "./LHKK7Y5F.js";
|
|
9
|
+
|
|
10
|
+
// src/blur.ts
|
|
11
|
+
import { getActiveElement } from "@ariakit/core/utils/dom";
|
|
12
|
+
function blur(element) {
|
|
13
|
+
return wrapAsync(async () => {
|
|
14
|
+
if (element == null) {
|
|
15
|
+
element = document.activeElement;
|
|
16
|
+
}
|
|
17
|
+
if (!element)
|
|
18
|
+
return;
|
|
19
|
+
if (element.tagName === "BODY")
|
|
20
|
+
return;
|
|
21
|
+
if (getActiveElement(element) !== element)
|
|
22
|
+
return;
|
|
23
|
+
if (element.dirty) {
|
|
24
|
+
await dispatch.change(element);
|
|
25
|
+
element.dirty = false;
|
|
26
|
+
}
|
|
27
|
+
if (element instanceof HTMLElement || element instanceof SVGElement) {
|
|
28
|
+
element.blur();
|
|
29
|
+
await flushMicrotasks();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
blur
|
|
36
|
+
};
|
package/esm/__utils.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { noop } from "@ariakit/core/utils/misc";
|
|
1
2
|
export type DirtiableElement = Element & {
|
|
2
3
|
dirty?: boolean;
|
|
3
4
|
};
|
|
4
5
|
export type TextField = HTMLInputElement | HTMLTextAreaElement;
|
|
5
6
|
export declare const isBrowser: boolean;
|
|
6
|
-
export declare
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
7
|
+
export declare function flushMicrotasks(): Promise<void>;
|
|
8
|
+
export declare function nextFrame(): Promise<number>;
|
|
9
|
+
export declare function setActEnvironment(value: boolean): () => void;
|
|
10
|
+
export declare function applyBrowserPolyfills(): typeof noop;
|
|
11
|
+
export declare function wrapAsync<T>(fn: () => Promise<T>): Promise<T>;
|
package/esm/blur.d.ts
CHANGED
package/esm/blur.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
blur
|
|
3
|
-
} from "./__chunks/
|
|
4
|
-
import "./__chunks/
|
|
5
|
-
import "./__chunks/
|
|
6
|
-
import "./__chunks/
|
|
7
|
-
import "./__chunks/ZEO5Q6UD.js";
|
|
8
|
-
import "./__chunks/6XO5G2QR.js";
|
|
4
|
+
} from "./__chunks/ZIWQZF7I.js";
|
|
5
|
+
import "./__chunks/7JP5HWUW.js";
|
|
6
|
+
import "./__chunks/LHKK7Y5F.js";
|
|
7
|
+
import "./__chunks/Q65FZOE2.js";
|
|
9
8
|
export {
|
|
10
9
|
blur
|
|
11
10
|
};
|
package/esm/click.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function click(element: Element, options?: MouseEventInit, tap?: boolean): Promise<void>;
|
|
1
|
+
export declare function click(element: Element | null, options?: MouseEventInit, tap?: boolean): Promise<void>;
|
package/esm/click.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
click
|
|
3
|
-
} from "./__chunks/
|
|
4
|
-
import "./__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/ZEO5Q6UD.js";
|
|
14
|
-
import "./__chunks/6XO5G2QR.js";
|
|
4
|
+
} from "./__chunks/5DPK2YAQ.js";
|
|
5
|
+
import "./__chunks/LSH2PT34.js";
|
|
6
|
+
import "./__chunks/RG2JKALK.js";
|
|
7
|
+
import "./__chunks/ANPGABTJ.js";
|
|
8
|
+
import "./__chunks/ZIWQZF7I.js";
|
|
9
|
+
import "./__chunks/WAYMNUAF.js";
|
|
10
|
+
import "./__chunks/7JP5HWUW.js";
|
|
11
|
+
import "./__chunks/YNAZUNNE.js";
|
|
12
|
+
import "./__chunks/LHKK7Y5F.js";
|
|
13
|
+
import "./__chunks/Q65FZOE2.js";
|
|
15
14
|
export {
|
|
16
15
|
click
|
|
17
16
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EventType } from "@testing-library/dom";
|
|
2
|
+
type Target = Document | Window | Node | Element | null;
|
|
3
|
+
type EventFunction = (element: Target, options?: object) => Promise<boolean>;
|
|
4
|
+
type EventsObject = {
|
|
5
|
+
[K in EventType]: EventFunction;
|
|
6
|
+
};
|
|
7
|
+
declare function baseDispatch(element: Target, event: Event): Promise<boolean>;
|
|
8
|
+
export declare const dispatch: typeof baseDispatch & EventsObject;
|
|
9
|
+
export {};
|
package/esm/dispatch.js
ADDED
package/esm/focus.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function focus(element: Element): void;
|
|
1
|
+
export declare function focus(element: Element | null): Promise<void>;
|
package/esm/focus.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
focus
|
|
3
|
-
} from "./__chunks/
|
|
4
|
-
import "./__chunks/
|
|
5
|
-
import "./__chunks/
|
|
6
|
-
import "./__chunks/
|
|
7
|
-
import "./__chunks/ZEO5Q6UD.js";
|
|
8
|
-
import "./__chunks/6XO5G2QR.js";
|
|
4
|
+
} from "./__chunks/WAYMNUAF.js";
|
|
5
|
+
import "./__chunks/7JP5HWUW.js";
|
|
6
|
+
import "./__chunks/LHKK7Y5F.js";
|
|
7
|
+
import "./__chunks/Q65FZOE2.js";
|
|
9
8
|
export {
|
|
10
9
|
focus
|
|
11
10
|
};
|
package/esm/hover.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function hover(element: Element, options?: MouseEventInit): Promise<void>;
|
|
1
|
+
export declare function hover(element: Element | null, options?: MouseEventInit): Promise<void>;
|
package/esm/hover.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
hover
|
|
3
|
-
} from "./__chunks/
|
|
4
|
-
import "./__chunks/
|
|
5
|
-
import "./__chunks/
|
|
6
|
-
import "./__chunks/
|
|
7
|
-
import "./__chunks/
|
|
8
|
-
import "./__chunks/ZEO5Q6UD.js";
|
|
9
|
-
import "./__chunks/6XO5G2QR.js";
|
|
4
|
+
} from "./__chunks/ANPGABTJ.js";
|
|
5
|
+
import "./__chunks/7JP5HWUW.js";
|
|
6
|
+
import "./__chunks/YNAZUNNE.js";
|
|
7
|
+
import "./__chunks/LHKK7Y5F.js";
|
|
8
|
+
import "./__chunks/Q65FZOE2.js";
|
|
10
9
|
export {
|
|
11
10
|
hover
|
|
12
11
|
};
|
package/esm/index.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
export * from "./act.js";
|
|
2
1
|
export * from "./blur.js";
|
|
3
2
|
export * from "./click.js";
|
|
4
|
-
export * from "./
|
|
3
|
+
export * from "./dispatch.js";
|
|
5
4
|
export * from "./focus.js";
|
|
6
5
|
export * from "./hover.js";
|
|
7
6
|
export * from "./mouse-down.js";
|
|
8
7
|
export * from "./mouse-up.js";
|
|
9
8
|
export * from "./press.js";
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./screen.js";
|
|
9
|
+
export * from "./query.js";
|
|
12
10
|
export * from "./select.js";
|
|
13
11
|
export * from "./sleep.js";
|
|
14
12
|
export * from "./tap.js";
|
|
15
13
|
export * from "./type.js";
|
|
16
14
|
export * from "./wait-for.js";
|
|
17
|
-
export * from "./within.js";
|
package/esm/index.js
CHANGED
|
@@ -1,121 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
} from "./__chunks/6PY4HXVO.js";
|
|
4
|
-
import {
|
|
5
|
-
within
|
|
6
|
-
} from "./__chunks/QA3ZS6S2.js";
|
|
1
|
+
"use client";
|
|
2
|
+
import "./__chunks/RHBNMDK4.js";
|
|
7
3
|
import {
|
|
8
4
|
waitFor
|
|
9
|
-
} from "./__chunks/
|
|
10
|
-
import {
|
|
11
|
-
type
|
|
12
|
-
} from "./__chunks/4A3YKZRA.js";
|
|
5
|
+
} from "./__chunks/WLDGXXGP.js";
|
|
13
6
|
import {
|
|
14
7
|
tap
|
|
15
|
-
} from "./__chunks/
|
|
8
|
+
} from "./__chunks/MKNCAN2F.js";
|
|
16
9
|
import {
|
|
17
10
|
click
|
|
18
|
-
} from "./__chunks/
|
|
11
|
+
} from "./__chunks/5DPK2YAQ.js";
|
|
19
12
|
import {
|
|
20
13
|
select
|
|
21
|
-
} from "./__chunks/
|
|
14
|
+
} from "./__chunks/H3BXHZTZ.js";
|
|
22
15
|
import {
|
|
23
16
|
mouseUp
|
|
24
|
-
} from "./__chunks/
|
|
17
|
+
} from "./__chunks/LSH2PT34.js";
|
|
25
18
|
import {
|
|
26
19
|
mouseDown
|
|
27
|
-
} from "./__chunks/
|
|
28
|
-
import {
|
|
29
|
-
blur
|
|
30
|
-
} from "./__chunks/AEOE57TZ.js";
|
|
20
|
+
} from "./__chunks/RG2JKALK.js";
|
|
31
21
|
import {
|
|
32
22
|
hover
|
|
33
|
-
} from "./__chunks/
|
|
23
|
+
} from "./__chunks/ANPGABTJ.js";
|
|
34
24
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
q,
|
|
26
|
+
query
|
|
27
|
+
} from "./__chunks/HUBUFZ3U.js";
|
|
37
28
|
import {
|
|
38
|
-
|
|
39
|
-
} from "./__chunks/
|
|
29
|
+
press
|
|
30
|
+
} from "./__chunks/UJCT5GXS.js";
|
|
40
31
|
import {
|
|
41
|
-
|
|
42
|
-
} from "./__chunks/
|
|
43
|
-
import
|
|
32
|
+
type
|
|
33
|
+
} from "./__chunks/HVRX3U4O.js";
|
|
34
|
+
import {
|
|
35
|
+
blur
|
|
36
|
+
} from "./__chunks/ZIWQZF7I.js";
|
|
44
37
|
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
findAllByRole,
|
|
48
|
-
findAllByText,
|
|
49
|
-
findByLabelText,
|
|
50
|
-
findByPlaceholderText,
|
|
51
|
-
findByRole,
|
|
52
|
-
findByText,
|
|
53
|
-
getAllByLabelText,
|
|
54
|
-
getAllByPlaceholderText,
|
|
55
|
-
getAllByRole,
|
|
56
|
-
getAllByText,
|
|
57
|
-
getByLabelText,
|
|
58
|
-
getByPlaceholderText,
|
|
59
|
-
getByRole,
|
|
60
|
-
getByText,
|
|
61
|
-
queryAllByLabelText,
|
|
62
|
-
queryAllByPlaceholderText,
|
|
63
|
-
queryAllByRole,
|
|
64
|
-
queryAllByText,
|
|
65
|
-
queryByLabelText,
|
|
66
|
-
queryByPlaceholderText,
|
|
67
|
-
queryByRole,
|
|
68
|
-
queryByText,
|
|
69
|
-
screen
|
|
70
|
-
} from "./__chunks/3C72DPE2.js";
|
|
38
|
+
focus
|
|
39
|
+
} from "./__chunks/WAYMNUAF.js";
|
|
71
40
|
import {
|
|
72
|
-
|
|
73
|
-
} from "./__chunks/
|
|
74
|
-
import "./__chunks/EVYPE6ZJ.js";
|
|
41
|
+
dispatch
|
|
42
|
+
} from "./__chunks/7JP5HWUW.js";
|
|
75
43
|
import {
|
|
76
|
-
|
|
77
|
-
} from "./__chunks/
|
|
78
|
-
import "./__chunks/
|
|
44
|
+
sleep
|
|
45
|
+
} from "./__chunks/YNAZUNNE.js";
|
|
46
|
+
import "./__chunks/LHKK7Y5F.js";
|
|
47
|
+
import "./__chunks/Q65FZOE2.js";
|
|
79
48
|
export {
|
|
80
|
-
act,
|
|
81
49
|
blur,
|
|
82
50
|
click,
|
|
83
|
-
|
|
84
|
-
findAllByPlaceholderText,
|
|
85
|
-
findAllByRole,
|
|
86
|
-
findAllByText,
|
|
87
|
-
findByLabelText,
|
|
88
|
-
findByPlaceholderText,
|
|
89
|
-
findByRole,
|
|
90
|
-
findByText,
|
|
91
|
-
fireEvent,
|
|
51
|
+
dispatch,
|
|
92
52
|
focus,
|
|
93
|
-
getAllByLabelText,
|
|
94
|
-
getAllByPlaceholderText,
|
|
95
|
-
getAllByRole,
|
|
96
|
-
getAllByText,
|
|
97
|
-
getByLabelText,
|
|
98
|
-
getByPlaceholderText,
|
|
99
|
-
getByRole,
|
|
100
|
-
getByText,
|
|
101
53
|
hover,
|
|
102
54
|
mouseDown,
|
|
103
55
|
mouseUp,
|
|
104
56
|
press,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
queryAllByRole,
|
|
108
|
-
queryAllByText,
|
|
109
|
-
queryByLabelText,
|
|
110
|
-
queryByPlaceholderText,
|
|
111
|
-
queryByRole,
|
|
112
|
-
queryByText,
|
|
113
|
-
customRender as render,
|
|
114
|
-
screen,
|
|
57
|
+
q,
|
|
58
|
+
query,
|
|
115
59
|
select,
|
|
116
60
|
sleep,
|
|
117
61
|
tap,
|
|
118
62
|
type,
|
|
119
|
-
waitFor
|
|
120
|
-
within
|
|
63
|
+
waitFor
|
|
121
64
|
};
|
package/esm/mouse-down.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function mouseDown(element: Element, options?: MouseEventInit): void;
|
|
1
|
+
export declare function mouseDown(element: Element | null, options?: MouseEventInit): Promise<void>;
|