@zag-js/tooltip 1.34.1 → 1.35.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/dist/index.d.mts +8 -129
- package/dist/index.d.ts +8 -129
- package/dist/index.js +36 -533
- package/dist/index.mjs +10 -530
- package/dist/tooltip.anatomy.d.mts +6 -0
- package/dist/tooltip.anatomy.d.ts +6 -0
- package/dist/tooltip.anatomy.js +34 -0
- package/dist/tooltip.anatomy.mjs +8 -0
- package/dist/tooltip.connect.d.mts +8 -0
- package/dist/tooltip.connect.d.ts +8 -0
- package/dist/tooltip.connect.js +177 -0
- package/dist/tooltip.connect.mjs +142 -0
- package/dist/tooltip.dom.d.mts +12 -0
- package/dist/tooltip.dom.d.ts +12 -0
- package/dist/tooltip.dom.js +51 -0
- package/dist/tooltip.dom.mjs +19 -0
- package/dist/tooltip.machine.d.mts +8 -0
- package/dist/tooltip.machine.d.ts +8 -0
- package/dist/tooltip.machine.js +396 -0
- package/dist/tooltip.machine.mjs +361 -0
- package/dist/tooltip.props.d.mts +9 -0
- package/dist/tooltip.props.d.ts +9 -0
- package/dist/tooltip.props.js +53 -0
- package/dist/tooltip.props.mjs +27 -0
- package/dist/tooltip.store.d.mts +9 -0
- package/dist/tooltip.store.d.ts +9 -0
- package/dist/tooltip.store.js +35 -0
- package/dist/tooltip.store.mjs +10 -0
- package/dist/tooltip.types.d.mts +119 -0
- package/dist/tooltip.types.d.ts +119 -0
- package/dist/tooltip.types.js +18 -0
- package/dist/tooltip.types.mjs +0 -0
- package/package.json +19 -9
package/dist/index.js
CHANGED
|
@@ -1,536 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
20
|
|
|
15
|
-
// src/
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var getPositionerEl = (scope) => scope.getById(getPositionerId(scope));
|
|
22
|
-
var store = utils.createStore({
|
|
23
|
-
id: null,
|
|
24
|
-
prevId: null,
|
|
25
|
-
instant: false
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
anatomy: () => import_tooltip.anatomy,
|
|
25
|
+
connect: () => import_tooltip2.connect,
|
|
26
|
+
machine: () => import_tooltip3.machine
|
|
26
27
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
...prop("positioning"),
|
|
39
|
-
placement: context.get("currentPlacement")
|
|
40
|
-
});
|
|
41
|
-
return {
|
|
42
|
-
open,
|
|
43
|
-
setOpen(nextOpen) {
|
|
44
|
-
const open2 = state.matches("open", "closing");
|
|
45
|
-
if (open2 === nextOpen) return;
|
|
46
|
-
send({ type: nextOpen ? "open" : "close" });
|
|
47
|
-
},
|
|
48
|
-
reposition(options = {}) {
|
|
49
|
-
send({ type: "positioning.set", options });
|
|
50
|
-
},
|
|
51
|
-
getTriggerProps() {
|
|
52
|
-
return normalize.button({
|
|
53
|
-
...parts.trigger.attrs,
|
|
54
|
-
id: triggerId,
|
|
55
|
-
dir: prop("dir"),
|
|
56
|
-
"data-expanded": domQuery.dataAttr(open),
|
|
57
|
-
"data-state": open ? "open" : "closed",
|
|
58
|
-
"aria-describedby": open ? contentId : void 0,
|
|
59
|
-
onClick(event) {
|
|
60
|
-
if (event.defaultPrevented) return;
|
|
61
|
-
if (disabled) return;
|
|
62
|
-
if (!prop("closeOnClick")) return;
|
|
63
|
-
send({ type: "close", src: "trigger.click" });
|
|
64
|
-
},
|
|
65
|
-
onFocus(event) {
|
|
66
|
-
queueMicrotask(() => {
|
|
67
|
-
if (event.defaultPrevented) return;
|
|
68
|
-
if (disabled) return;
|
|
69
|
-
if (_event.src === "trigger.pointerdown") return;
|
|
70
|
-
if (!focusVisible.isFocusVisible()) return;
|
|
71
|
-
send({ type: "open", src: "trigger.focus" });
|
|
72
|
-
});
|
|
73
|
-
},
|
|
74
|
-
onBlur(event) {
|
|
75
|
-
if (event.defaultPrevented) return;
|
|
76
|
-
if (disabled) return;
|
|
77
|
-
if (id === store.get("id")) {
|
|
78
|
-
send({ type: "close", src: "trigger.blur" });
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
onPointerDown(event) {
|
|
82
|
-
if (event.defaultPrevented) return;
|
|
83
|
-
if (disabled) return;
|
|
84
|
-
if (!domQuery.isLeftClick(event)) return;
|
|
85
|
-
if (!prop("closeOnPointerDown")) return;
|
|
86
|
-
if (id === store.get("id")) {
|
|
87
|
-
send({ type: "close", src: "trigger.pointerdown" });
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
onPointerMove(event) {
|
|
91
|
-
if (event.defaultPrevented) return;
|
|
92
|
-
if (disabled) return;
|
|
93
|
-
if (event.pointerType === "touch") return;
|
|
94
|
-
send({ type: "pointer.move" });
|
|
95
|
-
},
|
|
96
|
-
onPointerOver(event) {
|
|
97
|
-
if (event.defaultPrevented) return;
|
|
98
|
-
if (disabled) return;
|
|
99
|
-
if (event.pointerType === "touch") return;
|
|
100
|
-
send({ type: "pointer.move" });
|
|
101
|
-
},
|
|
102
|
-
onPointerLeave() {
|
|
103
|
-
if (disabled) return;
|
|
104
|
-
send({ type: "pointer.leave" });
|
|
105
|
-
},
|
|
106
|
-
onPointerCancel() {
|
|
107
|
-
if (disabled) return;
|
|
108
|
-
send({ type: "pointer.leave" });
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
},
|
|
112
|
-
getArrowProps() {
|
|
113
|
-
return normalize.element({
|
|
114
|
-
id: getArrowId(scope),
|
|
115
|
-
...parts.arrow.attrs,
|
|
116
|
-
dir: prop("dir"),
|
|
117
|
-
style: popperStyles.arrow
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
getArrowTipProps() {
|
|
121
|
-
return normalize.element({
|
|
122
|
-
...parts.arrowTip.attrs,
|
|
123
|
-
dir: prop("dir"),
|
|
124
|
-
style: popperStyles.arrowTip
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
getPositionerProps() {
|
|
128
|
-
return normalize.element({
|
|
129
|
-
id: getPositionerId(scope),
|
|
130
|
-
...parts.positioner.attrs,
|
|
131
|
-
dir: prop("dir"),
|
|
132
|
-
style: popperStyles.floating
|
|
133
|
-
});
|
|
134
|
-
},
|
|
135
|
-
getContentProps() {
|
|
136
|
-
const isCurrentTooltip = store.get("id") === id;
|
|
137
|
-
const isPrevTooltip = store.get("prevId") === id;
|
|
138
|
-
const instant = store.get("instant") && (open && isCurrentTooltip || isPrevTooltip);
|
|
139
|
-
return normalize.element({
|
|
140
|
-
...parts.content.attrs,
|
|
141
|
-
dir: prop("dir"),
|
|
142
|
-
hidden: !open,
|
|
143
|
-
"data-state": open ? "open" : "closed",
|
|
144
|
-
"data-instant": domQuery.dataAttr(instant),
|
|
145
|
-
role: hasAriaLabel ? void 0 : "tooltip",
|
|
146
|
-
id: hasAriaLabel ? void 0 : contentId,
|
|
147
|
-
"data-placement": context.get("currentPlacement"),
|
|
148
|
-
onPointerEnter() {
|
|
149
|
-
send({ type: "content.pointer.move" });
|
|
150
|
-
},
|
|
151
|
-
onPointerLeave() {
|
|
152
|
-
send({ type: "content.pointer.leave" });
|
|
153
|
-
},
|
|
154
|
-
style: {
|
|
155
|
-
pointerEvents: prop("interactive") ? "auto" : "none"
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
var { and, not } = core.createGuards();
|
|
162
|
-
var machine = core.createMachine({
|
|
163
|
-
initialState: ({ prop }) => {
|
|
164
|
-
const open = prop("open") || prop("defaultOpen");
|
|
165
|
-
return open ? "open" : "closed";
|
|
166
|
-
},
|
|
167
|
-
props({ props: props2 }) {
|
|
168
|
-
utils.ensureProps(props2, ["id"]);
|
|
169
|
-
const closeOnClick = props2.closeOnClick ?? true;
|
|
170
|
-
const closeOnPointerDown = props2.closeOnPointerDown ?? closeOnClick;
|
|
171
|
-
return {
|
|
172
|
-
openDelay: 400,
|
|
173
|
-
closeDelay: 150,
|
|
174
|
-
closeOnEscape: true,
|
|
175
|
-
interactive: false,
|
|
176
|
-
closeOnScroll: true,
|
|
177
|
-
disabled: false,
|
|
178
|
-
...props2,
|
|
179
|
-
closeOnPointerDown,
|
|
180
|
-
closeOnClick,
|
|
181
|
-
positioning: {
|
|
182
|
-
placement: "bottom",
|
|
183
|
-
...props2.positioning
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
},
|
|
187
|
-
effects: ["trackFocusVisible", "trackStore"],
|
|
188
|
-
context: ({ bindable }) => ({
|
|
189
|
-
currentPlacement: bindable(() => ({ defaultValue: void 0 })),
|
|
190
|
-
hasPointerMoveOpened: bindable(() => ({ defaultValue: false }))
|
|
191
|
-
}),
|
|
192
|
-
watch({ track, action, prop }) {
|
|
193
|
-
track([() => prop("disabled")], () => {
|
|
194
|
-
action(["closeIfDisabled"]);
|
|
195
|
-
});
|
|
196
|
-
track([() => prop("open")], () => {
|
|
197
|
-
action(["toggleVisibility"]);
|
|
198
|
-
});
|
|
199
|
-
},
|
|
200
|
-
states: {
|
|
201
|
-
closed: {
|
|
202
|
-
entry: ["clearGlobalId"],
|
|
203
|
-
on: {
|
|
204
|
-
"controlled.open": {
|
|
205
|
-
target: "open"
|
|
206
|
-
},
|
|
207
|
-
open: [
|
|
208
|
-
{
|
|
209
|
-
guard: "isOpenControlled",
|
|
210
|
-
actions: ["invokeOnOpen"]
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
target: "open",
|
|
214
|
-
actions: ["invokeOnOpen"]
|
|
215
|
-
}
|
|
216
|
-
],
|
|
217
|
-
"pointer.leave": {
|
|
218
|
-
actions: ["clearPointerMoveOpened"]
|
|
219
|
-
},
|
|
220
|
-
"pointer.move": [
|
|
221
|
-
{
|
|
222
|
-
guard: and("noVisibleTooltip", not("hasPointerMoveOpened")),
|
|
223
|
-
target: "opening"
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
guard: not("hasPointerMoveOpened"),
|
|
227
|
-
target: "open",
|
|
228
|
-
actions: ["setPointerMoveOpened", "invokeOnOpen"]
|
|
229
|
-
}
|
|
230
|
-
]
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
opening: {
|
|
234
|
-
effects: ["trackScroll", "trackPointerlockChange", "waitForOpenDelay"],
|
|
235
|
-
on: {
|
|
236
|
-
"after.openDelay": [
|
|
237
|
-
{
|
|
238
|
-
guard: "isOpenControlled",
|
|
239
|
-
actions: ["setPointerMoveOpened", "invokeOnOpen"]
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
target: "open",
|
|
243
|
-
actions: ["setPointerMoveOpened", "invokeOnOpen"]
|
|
244
|
-
}
|
|
245
|
-
],
|
|
246
|
-
"controlled.open": {
|
|
247
|
-
target: "open"
|
|
248
|
-
},
|
|
249
|
-
"controlled.close": {
|
|
250
|
-
target: "closed"
|
|
251
|
-
},
|
|
252
|
-
open: [
|
|
253
|
-
{
|
|
254
|
-
guard: "isOpenControlled",
|
|
255
|
-
actions: ["invokeOnOpen"]
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
target: "open",
|
|
259
|
-
actions: ["invokeOnOpen"]
|
|
260
|
-
}
|
|
261
|
-
],
|
|
262
|
-
"pointer.leave": [
|
|
263
|
-
{
|
|
264
|
-
guard: "isOpenControlled",
|
|
265
|
-
// We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
|
|
266
|
-
actions: ["clearPointerMoveOpened", "invokeOnClose", "toggleVisibility"]
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
target: "closed",
|
|
270
|
-
actions: ["clearPointerMoveOpened", "invokeOnClose"]
|
|
271
|
-
}
|
|
272
|
-
],
|
|
273
|
-
close: [
|
|
274
|
-
{
|
|
275
|
-
guard: "isOpenControlled",
|
|
276
|
-
// We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
|
|
277
|
-
actions: ["invokeOnClose", "toggleVisibility"]
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
target: "closed",
|
|
281
|
-
actions: ["invokeOnClose"]
|
|
282
|
-
}
|
|
283
|
-
]
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
open: {
|
|
287
|
-
effects: ["trackEscapeKey", "trackScroll", "trackPointerlockChange", "trackPositioning"],
|
|
288
|
-
entry: ["setGlobalId"],
|
|
289
|
-
on: {
|
|
290
|
-
"controlled.close": {
|
|
291
|
-
target: "closed"
|
|
292
|
-
},
|
|
293
|
-
close: [
|
|
294
|
-
{
|
|
295
|
-
guard: "isOpenControlled",
|
|
296
|
-
actions: ["invokeOnClose"]
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
target: "closed",
|
|
300
|
-
actions: ["invokeOnClose"]
|
|
301
|
-
}
|
|
302
|
-
],
|
|
303
|
-
"pointer.leave": [
|
|
304
|
-
{
|
|
305
|
-
guard: "isVisible",
|
|
306
|
-
target: "closing",
|
|
307
|
-
actions: ["clearPointerMoveOpened"]
|
|
308
|
-
},
|
|
309
|
-
// == group ==
|
|
310
|
-
{
|
|
311
|
-
guard: "isOpenControlled",
|
|
312
|
-
actions: ["clearPointerMoveOpened", "invokeOnClose"]
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
target: "closed",
|
|
316
|
-
actions: ["clearPointerMoveOpened", "invokeOnClose"]
|
|
317
|
-
}
|
|
318
|
-
],
|
|
319
|
-
"content.pointer.leave": {
|
|
320
|
-
guard: "isInteractive",
|
|
321
|
-
target: "closing"
|
|
322
|
-
},
|
|
323
|
-
"positioning.set": {
|
|
324
|
-
actions: ["reposition"]
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
closing: {
|
|
329
|
-
effects: ["trackPositioning", "waitForCloseDelay"],
|
|
330
|
-
on: {
|
|
331
|
-
"after.closeDelay": [
|
|
332
|
-
{
|
|
333
|
-
guard: "isOpenControlled",
|
|
334
|
-
actions: ["invokeOnClose"]
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
target: "closed",
|
|
338
|
-
actions: ["invokeOnClose"]
|
|
339
|
-
}
|
|
340
|
-
],
|
|
341
|
-
"controlled.close": {
|
|
342
|
-
target: "closed"
|
|
343
|
-
},
|
|
344
|
-
"controlled.open": {
|
|
345
|
-
target: "open"
|
|
346
|
-
},
|
|
347
|
-
close: [
|
|
348
|
-
{
|
|
349
|
-
guard: "isOpenControlled",
|
|
350
|
-
actions: ["invokeOnClose"]
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
target: "closed",
|
|
354
|
-
actions: ["invokeOnClose"]
|
|
355
|
-
}
|
|
356
|
-
],
|
|
357
|
-
"pointer.move": [
|
|
358
|
-
{
|
|
359
|
-
guard: "isOpenControlled",
|
|
360
|
-
// We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
|
|
361
|
-
actions: ["setPointerMoveOpened", "invokeOnOpen", "toggleVisibility"]
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
target: "open",
|
|
365
|
-
actions: ["setPointerMoveOpened", "invokeOnOpen"]
|
|
366
|
-
}
|
|
367
|
-
],
|
|
368
|
-
"content.pointer.move": {
|
|
369
|
-
guard: "isInteractive",
|
|
370
|
-
target: "open"
|
|
371
|
-
},
|
|
372
|
-
"positioning.set": {
|
|
373
|
-
actions: ["reposition"]
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
implementations: {
|
|
379
|
-
guards: {
|
|
380
|
-
noVisibleTooltip: () => store.get("id") === null,
|
|
381
|
-
isVisible: ({ prop }) => prop("id") === store.get("id"),
|
|
382
|
-
isInteractive: ({ prop }) => !!prop("interactive"),
|
|
383
|
-
hasPointerMoveOpened: ({ context }) => context.get("hasPointerMoveOpened"),
|
|
384
|
-
isOpenControlled: ({ prop }) => prop("open") !== void 0
|
|
385
|
-
},
|
|
386
|
-
actions: {
|
|
387
|
-
setGlobalId: ({ prop }) => {
|
|
388
|
-
const prevId = store.get("id");
|
|
389
|
-
const isInstant = prevId !== null && prevId !== prop("id");
|
|
390
|
-
store.update({ id: prop("id"), prevId: isInstant ? prevId : null, instant: isInstant });
|
|
391
|
-
},
|
|
392
|
-
clearGlobalId: ({ prop }) => {
|
|
393
|
-
if (prop("id") === store.get("id")) {
|
|
394
|
-
store.update({ id: null, prevId: null, instant: false });
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
invokeOnOpen: ({ prop }) => {
|
|
398
|
-
prop("onOpenChange")?.({ open: true });
|
|
399
|
-
},
|
|
400
|
-
invokeOnClose: ({ prop }) => {
|
|
401
|
-
prop("onOpenChange")?.({ open: false });
|
|
402
|
-
},
|
|
403
|
-
closeIfDisabled: ({ prop, send }) => {
|
|
404
|
-
if (!prop("disabled")) return;
|
|
405
|
-
send({ type: "close", src: "disabled.change" });
|
|
406
|
-
},
|
|
407
|
-
reposition: ({ context, event, prop, scope }) => {
|
|
408
|
-
if (event.type !== "positioning.set") return;
|
|
409
|
-
const getPositionerEl2 = () => getPositionerEl(scope);
|
|
410
|
-
return popper.getPlacement(getTriggerEl(scope), getPositionerEl2, {
|
|
411
|
-
...prop("positioning"),
|
|
412
|
-
...event.options,
|
|
413
|
-
defer: true,
|
|
414
|
-
listeners: false,
|
|
415
|
-
onComplete(data) {
|
|
416
|
-
context.set("currentPlacement", data.placement);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
},
|
|
420
|
-
toggleVisibility: ({ prop, event, send }) => {
|
|
421
|
-
queueMicrotask(() => {
|
|
422
|
-
send({
|
|
423
|
-
type: prop("open") ? "controlled.open" : "controlled.close",
|
|
424
|
-
previousEvent: event
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
},
|
|
428
|
-
setPointerMoveOpened: ({ context }) => {
|
|
429
|
-
context.set("hasPointerMoveOpened", true);
|
|
430
|
-
},
|
|
431
|
-
clearPointerMoveOpened: ({ context }) => {
|
|
432
|
-
context.set("hasPointerMoveOpened", false);
|
|
433
|
-
}
|
|
434
|
-
},
|
|
435
|
-
effects: {
|
|
436
|
-
trackFocusVisible: ({ scope }) => {
|
|
437
|
-
return focusVisible.trackFocusVisible({ root: scope.getRootNode?.() });
|
|
438
|
-
},
|
|
439
|
-
trackPositioning: ({ context, prop, scope }) => {
|
|
440
|
-
if (!context.get("currentPlacement")) {
|
|
441
|
-
context.set("currentPlacement", prop("positioning").placement);
|
|
442
|
-
}
|
|
443
|
-
const getPositionerEl2 = () => getPositionerEl(scope);
|
|
444
|
-
return popper.getPlacement(getTriggerEl(scope), getPositionerEl2, {
|
|
445
|
-
...prop("positioning"),
|
|
446
|
-
defer: true,
|
|
447
|
-
onComplete(data) {
|
|
448
|
-
context.set("currentPlacement", data.placement);
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
},
|
|
452
|
-
trackPointerlockChange: ({ send, scope }) => {
|
|
453
|
-
const doc = scope.getDoc();
|
|
454
|
-
const onChange = () => send({ type: "close", src: "pointerlock:change" });
|
|
455
|
-
return domQuery.addDomEvent(doc, "pointerlockchange", onChange, false);
|
|
456
|
-
},
|
|
457
|
-
trackScroll: ({ send, prop, scope }) => {
|
|
458
|
-
if (!prop("closeOnScroll")) return;
|
|
459
|
-
const triggerEl = getTriggerEl(scope);
|
|
460
|
-
if (!triggerEl) return;
|
|
461
|
-
const overflowParents = domQuery.getOverflowAncestors(triggerEl);
|
|
462
|
-
const cleanups = overflowParents.map((overflowParent) => {
|
|
463
|
-
const onScroll = () => {
|
|
464
|
-
send({ type: "close", src: "scroll" });
|
|
465
|
-
};
|
|
466
|
-
return domQuery.addDomEvent(overflowParent, "scroll", onScroll, {
|
|
467
|
-
passive: true,
|
|
468
|
-
capture: true
|
|
469
|
-
});
|
|
470
|
-
});
|
|
471
|
-
return () => {
|
|
472
|
-
cleanups.forEach((fn) => fn?.());
|
|
473
|
-
};
|
|
474
|
-
},
|
|
475
|
-
trackStore: ({ prop, send }) => {
|
|
476
|
-
let cleanup;
|
|
477
|
-
queueMicrotask(() => {
|
|
478
|
-
cleanup = store.subscribe(() => {
|
|
479
|
-
if (store.get("id") !== prop("id")) {
|
|
480
|
-
send({ type: "close", src: "id.change" });
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
});
|
|
484
|
-
return () => cleanup?.();
|
|
485
|
-
},
|
|
486
|
-
trackEscapeKey: ({ send, prop }) => {
|
|
487
|
-
if (!prop("closeOnEscape")) return;
|
|
488
|
-
const onKeyDown = (event) => {
|
|
489
|
-
if (domQuery.isComposingEvent(event)) return;
|
|
490
|
-
if (event.key !== "Escape") return;
|
|
491
|
-
event.stopPropagation();
|
|
492
|
-
send({ type: "close", src: "keydown.escape" });
|
|
493
|
-
};
|
|
494
|
-
return domQuery.addDomEvent(document, "keydown", onKeyDown, true);
|
|
495
|
-
},
|
|
496
|
-
waitForOpenDelay: ({ send, prop }) => {
|
|
497
|
-
const id = setTimeout(() => {
|
|
498
|
-
send({ type: "after.openDelay" });
|
|
499
|
-
}, prop("openDelay"));
|
|
500
|
-
return () => clearTimeout(id);
|
|
501
|
-
},
|
|
502
|
-
waitForCloseDelay: ({ send, prop }) => {
|
|
503
|
-
const id = setTimeout(() => {
|
|
504
|
-
send({ type: "after.closeDelay" });
|
|
505
|
-
}, prop("closeDelay"));
|
|
506
|
-
return () => clearTimeout(id);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
var import_tooltip = require("./tooltip.anatomy.cjs");
|
|
30
|
+
var import_tooltip2 = require("./tooltip.connect.cjs");
|
|
31
|
+
var import_tooltip3 = require("./tooltip.machine.cjs");
|
|
32
|
+
__reExport(index_exports, require("./tooltip.props.cjs"), module.exports);
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
anatomy,
|
|
36
|
+
connect,
|
|
37
|
+
machine,
|
|
38
|
+
...require("./tooltip.props.cjs")
|
|
510
39
|
});
|
|
511
|
-
var props = types.createProps()([
|
|
512
|
-
"aria-label",
|
|
513
|
-
"closeDelay",
|
|
514
|
-
"closeOnEscape",
|
|
515
|
-
"closeOnPointerDown",
|
|
516
|
-
"closeOnScroll",
|
|
517
|
-
"closeOnClick",
|
|
518
|
-
"dir",
|
|
519
|
-
"disabled",
|
|
520
|
-
"getRootNode",
|
|
521
|
-
"id",
|
|
522
|
-
"ids",
|
|
523
|
-
"interactive",
|
|
524
|
-
"onOpenChange",
|
|
525
|
-
"defaultOpen",
|
|
526
|
-
"open",
|
|
527
|
-
"openDelay",
|
|
528
|
-
"positioning"
|
|
529
|
-
]);
|
|
530
|
-
var splitProps = utils.createSplitProps(props);
|
|
531
|
-
|
|
532
|
-
exports.anatomy = anatomy;
|
|
533
|
-
exports.connect = connect;
|
|
534
|
-
exports.machine = machine;
|
|
535
|
-
exports.props = props;
|
|
536
|
-
exports.splitProps = splitProps;
|