@zag-js/tooltip 0.1.15 → 0.2.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.ts +4 -0
- package/dist/index.js +101 -28
- package/dist/index.mjs +603 -0
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,10 @@ declare type PublicContext = CommonProperties & {
|
|
|
54
54
|
* The user provided options used to position the popover content
|
|
55
55
|
*/
|
|
56
56
|
positioning: PositioningOptions;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the tooltip is disabled
|
|
59
|
+
*/
|
|
60
|
+
disabled?: boolean;
|
|
57
61
|
};
|
|
58
62
|
declare type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
59
63
|
declare type ComputedContext = Readonly<{
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
|
|
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
connect: () => connect,
|
|
24
|
+
machine: () => machine
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// ../../utilities/dom/dist/index.mjs
|
|
2
29
|
var dataAttr = (guard) => {
|
|
3
30
|
return guard ? "" : void 0;
|
|
4
31
|
};
|
|
@@ -8,12 +35,13 @@ function getCache() {
|
|
|
8
35
|
return g.__styleCache;
|
|
9
36
|
}
|
|
10
37
|
function getComputedStyle(el) {
|
|
38
|
+
var _a;
|
|
11
39
|
if (!el)
|
|
12
40
|
return {};
|
|
13
41
|
const cache = getCache();
|
|
14
42
|
let style = cache.get(el);
|
|
15
43
|
if (!style) {
|
|
16
|
-
const win = (el == null ? void 0 : el.ownerDocument.defaultView)
|
|
44
|
+
const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
17
45
|
style = win.getComputedStyle(el);
|
|
18
46
|
cache.set(el, style);
|
|
19
47
|
}
|
|
@@ -21,15 +49,16 @@ function getComputedStyle(el) {
|
|
|
21
49
|
}
|
|
22
50
|
var runIfFn = (v, ...a) => {
|
|
23
51
|
const res = typeof v === "function" ? v(...a) : v;
|
|
24
|
-
return res
|
|
52
|
+
return res != null ? res : void 0;
|
|
25
53
|
};
|
|
26
54
|
var isArray = (v) => Array.isArray(v);
|
|
27
55
|
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
28
56
|
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
29
57
|
var isDom = () => typeof window !== "undefined";
|
|
30
58
|
function getPlatform() {
|
|
59
|
+
var _a;
|
|
31
60
|
const agent = navigator.userAgentData;
|
|
32
|
-
return (agent == null ? void 0 : agent.platform)
|
|
61
|
+
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
33
62
|
}
|
|
34
63
|
var pt = (v) => isDom() && v.test(getPlatform());
|
|
35
64
|
var vn = (v) => isDom() && v.test(navigator.vendor);
|
|
@@ -42,17 +71,20 @@ function isWindow(value) {
|
|
|
42
71
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
43
72
|
}
|
|
44
73
|
function getDocument(el) {
|
|
74
|
+
var _a;
|
|
45
75
|
if (isWindow(el))
|
|
46
76
|
return el.document;
|
|
47
77
|
if (isDocument(el))
|
|
48
78
|
return el;
|
|
49
|
-
return (el == null ? void 0 : el.ownerDocument)
|
|
79
|
+
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
50
80
|
}
|
|
51
81
|
function getWindow(el) {
|
|
52
|
-
|
|
82
|
+
var _a;
|
|
83
|
+
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
53
84
|
}
|
|
54
85
|
function getNodeName(node) {
|
|
55
|
-
|
|
86
|
+
var _a;
|
|
87
|
+
return isWindow(node) ? "" : (_a = node == null ? void 0 : node.localName) != null ? _a : "";
|
|
56
88
|
}
|
|
57
89
|
function getParent(el) {
|
|
58
90
|
const doc = getDocument(el);
|
|
@@ -63,13 +95,34 @@ function getParent(el) {
|
|
|
63
95
|
function defineDomHelpers(helpers) {
|
|
64
96
|
const dom2 = {
|
|
65
97
|
getRootNode: (ctx) => {
|
|
66
|
-
var _a;
|
|
67
|
-
return ((_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx))
|
|
98
|
+
var _a, _b;
|
|
99
|
+
return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
|
|
68
100
|
},
|
|
69
101
|
getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
|
|
70
|
-
getWin: (ctx) =>
|
|
102
|
+
getWin: (ctx) => {
|
|
103
|
+
var _a;
|
|
104
|
+
return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
|
|
105
|
+
},
|
|
71
106
|
getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
|
|
72
|
-
getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
|
|
107
|
+
getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
|
|
108
|
+
createEmitter: (ctx, target) => {
|
|
109
|
+
const win = dom2.getWin(ctx);
|
|
110
|
+
return function emit(evt, detail, options) {
|
|
111
|
+
const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
|
|
112
|
+
const eventName = `zag:${evt}`;
|
|
113
|
+
const init = { bubbles, cancelable, composed, detail };
|
|
114
|
+
const event = new win.CustomEvent(eventName, init);
|
|
115
|
+
target.dispatchEvent(event);
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
createListener: (target) => {
|
|
119
|
+
return function listen(evt, handler) {
|
|
120
|
+
const eventName = `zag:${evt}`;
|
|
121
|
+
const listener = (e) => handler(e);
|
|
122
|
+
target.addEventListener(eventName, listener);
|
|
123
|
+
return () => target.removeEventListener(eventName, listener);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
73
126
|
};
|
|
74
127
|
return {
|
|
75
128
|
...dom2,
|
|
@@ -102,7 +155,8 @@ function addDomEvent(target, eventName, handler, options) {
|
|
|
102
155
|
};
|
|
103
156
|
}
|
|
104
157
|
function addPointerEvent(target, event, listener, options) {
|
|
105
|
-
|
|
158
|
+
var _a;
|
|
159
|
+
const type = (_a = getEventName(event)) != null ? _a : event;
|
|
106
160
|
return addDomEvent(target, type, wrapHandler(listener, event === "pointerdown"), options);
|
|
107
161
|
}
|
|
108
162
|
function wrapHandler(fn, filter = false) {
|
|
@@ -113,7 +167,8 @@ function wrapHandler(fn, filter = false) {
|
|
|
113
167
|
}
|
|
114
168
|
function filterPrimaryPointer(fn) {
|
|
115
169
|
return (event) => {
|
|
116
|
-
|
|
170
|
+
var _a;
|
|
171
|
+
const win = (_a = event.view) != null ? _a : window;
|
|
117
172
|
const isMouseEvent2 = event instanceof win.MouseEvent;
|
|
118
173
|
const isPrimary = !isMouseEvent2 || isMouseEvent2 && event.button === 0;
|
|
119
174
|
if (isPrimary)
|
|
@@ -191,17 +246,17 @@ var visuallyHiddenStyle = {
|
|
|
191
246
|
};
|
|
192
247
|
|
|
193
248
|
// src/tooltip.connect.ts
|
|
194
|
-
|
|
249
|
+
var import_popper = require("@zag-js/popper");
|
|
195
250
|
|
|
196
251
|
// src/tooltip.dom.ts
|
|
197
252
|
var dom = defineDomHelpers({
|
|
198
253
|
getTriggerId: (ctx) => {
|
|
199
|
-
var _a;
|
|
200
|
-
return ((_a = ctx.ids) == null ? void 0 : _a.trigger)
|
|
254
|
+
var _a, _b;
|
|
255
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.trigger) != null ? _b : `tooltip:${ctx.id}:trigger`;
|
|
201
256
|
},
|
|
202
257
|
getContentId: (ctx) => {
|
|
203
|
-
var _a;
|
|
204
|
-
return ((_a = ctx.ids) == null ? void 0 : _a.content)
|
|
258
|
+
var _a, _b;
|
|
259
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.content) != null ? _b : `tooltip:${ctx.id}:content`;
|
|
205
260
|
},
|
|
206
261
|
getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
|
|
207
262
|
getPositionerId: (ctx) => `tooltip:${ctx.id}:popper`,
|
|
@@ -220,8 +275,8 @@ var dom = defineDomHelpers({
|
|
|
220
275
|
});
|
|
221
276
|
|
|
222
277
|
// src/tooltip.store.ts
|
|
223
|
-
|
|
224
|
-
var store = proxy({
|
|
278
|
+
var import_core = require("@zag-js/core");
|
|
279
|
+
var store = (0, import_core.proxy)({
|
|
225
280
|
id: null,
|
|
226
281
|
prevId: null,
|
|
227
282
|
setId(val) {
|
|
@@ -237,7 +292,8 @@ function connect(state, send, normalize) {
|
|
|
237
292
|
const isOpen = state.hasTag("open");
|
|
238
293
|
const triggerId = dom.getTriggerId(state.context);
|
|
239
294
|
const contentId = dom.getContentId(state.context);
|
|
240
|
-
const
|
|
295
|
+
const isDisabled = state.context.disabled;
|
|
296
|
+
const popperStyles = (0, import_popper.getPlacementStyles)({
|
|
241
297
|
measured: !!state.context.isPlacementComplete,
|
|
242
298
|
placement: state.context.currentPlacement
|
|
243
299
|
});
|
|
@@ -272,17 +328,25 @@ function connect(state, send, normalize) {
|
|
|
272
328
|
}
|
|
273
329
|
},
|
|
274
330
|
onPointerDown() {
|
|
331
|
+
if (isDisabled)
|
|
332
|
+
return;
|
|
275
333
|
if (id === store.id) {
|
|
276
334
|
send("POINTER_DOWN");
|
|
277
335
|
}
|
|
278
336
|
},
|
|
279
337
|
onPointerMove() {
|
|
338
|
+
if (isDisabled)
|
|
339
|
+
return;
|
|
280
340
|
send("POINTER_ENTER");
|
|
281
341
|
},
|
|
282
342
|
onPointerLeave() {
|
|
343
|
+
if (isDisabled)
|
|
344
|
+
return;
|
|
283
345
|
send("POINTER_LEAVE");
|
|
284
346
|
},
|
|
285
347
|
onPointerCancel() {
|
|
348
|
+
if (isDisabled)
|
|
349
|
+
return;
|
|
286
350
|
send("POINTER_LEAVE");
|
|
287
351
|
}
|
|
288
352
|
}),
|
|
@@ -335,10 +399,10 @@ function connect(state, send, normalize) {
|
|
|
335
399
|
}
|
|
336
400
|
|
|
337
401
|
// src/tooltip.machine.ts
|
|
338
|
-
|
|
339
|
-
|
|
402
|
+
var import_core2 = require("@zag-js/core");
|
|
403
|
+
var import_popper2 = require("@zag-js/popper");
|
|
340
404
|
function machine(ctx) {
|
|
341
|
-
return createMachine(
|
|
405
|
+
return (0, import_core2.createMachine)(
|
|
342
406
|
{
|
|
343
407
|
id: "tooltip",
|
|
344
408
|
initial: "unknown",
|
|
@@ -358,6 +422,9 @@ function machine(ctx) {
|
|
|
358
422
|
computed: {
|
|
359
423
|
hasAriaLabel: (ctx2) => !!ctx2["aria-label"]
|
|
360
424
|
},
|
|
425
|
+
watch: {
|
|
426
|
+
disabled: ["closeIfDisabled"]
|
|
427
|
+
},
|
|
361
428
|
on: {
|
|
362
429
|
OPEN: "open",
|
|
363
430
|
CLOSE: "closed"
|
|
@@ -455,7 +522,7 @@ function machine(ctx) {
|
|
|
455
522
|
ctx2.currentPlacement = ctx2.positioning.placement;
|
|
456
523
|
let cleanup;
|
|
457
524
|
raf(() => {
|
|
458
|
-
cleanup = getPlacement(dom.getTriggerEl(ctx2), dom.getPositionerEl(ctx2), {
|
|
525
|
+
cleanup = (0, import_popper2.getPlacement)(dom.getTriggerEl(ctx2), dom.getPositionerEl(ctx2), {
|
|
459
526
|
...ctx2.positioning,
|
|
460
527
|
onComplete(data) {
|
|
461
528
|
ctx2.currentPlacement = data.placement;
|
|
@@ -487,7 +554,7 @@ function machine(ctx) {
|
|
|
487
554
|
};
|
|
488
555
|
},
|
|
489
556
|
trackStore(ctx2, _evt, { send }) {
|
|
490
|
-
return subscribe(store, () => {
|
|
557
|
+
return (0, import_core2.subscribe)(store, () => {
|
|
491
558
|
if (store.id !== ctx2.id) {
|
|
492
559
|
send("FORCE_CLOSE");
|
|
493
560
|
}
|
|
@@ -537,6 +604,11 @@ function machine(ctx) {
|
|
|
537
604
|
if (!omit.includes(evt.type)) {
|
|
538
605
|
(_a = ctx2.onClose) == null ? void 0 : _a.call(ctx2);
|
|
539
606
|
}
|
|
607
|
+
},
|
|
608
|
+
closeIfDisabled(ctx2, _evt, { send }) {
|
|
609
|
+
if (ctx2.disabled) {
|
|
610
|
+
send("CLOSE");
|
|
611
|
+
}
|
|
540
612
|
}
|
|
541
613
|
},
|
|
542
614
|
guards: {
|
|
@@ -552,7 +624,8 @@ function machine(ctx) {
|
|
|
552
624
|
}
|
|
553
625
|
);
|
|
554
626
|
}
|
|
555
|
-
export
|
|
627
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
628
|
+
0 && (module.exports = {
|
|
556
629
|
connect,
|
|
557
630
|
machine
|
|
558
|
-
};
|
|
631
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
// ../../utilities/dom/dist/index.mjs
|
|
2
|
+
var dataAttr = (guard) => {
|
|
3
|
+
return guard ? "" : void 0;
|
|
4
|
+
};
|
|
5
|
+
function getCache() {
|
|
6
|
+
const g = globalThis;
|
|
7
|
+
g.__styleCache = g.__styleCache || /* @__PURE__ */ new WeakMap();
|
|
8
|
+
return g.__styleCache;
|
|
9
|
+
}
|
|
10
|
+
function getComputedStyle(el) {
|
|
11
|
+
var _a;
|
|
12
|
+
if (!el)
|
|
13
|
+
return {};
|
|
14
|
+
const cache = getCache();
|
|
15
|
+
let style = cache.get(el);
|
|
16
|
+
if (!style) {
|
|
17
|
+
const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
18
|
+
style = win.getComputedStyle(el);
|
|
19
|
+
cache.set(el, style);
|
|
20
|
+
}
|
|
21
|
+
return style;
|
|
22
|
+
}
|
|
23
|
+
var runIfFn = (v, ...a) => {
|
|
24
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
25
|
+
return res != null ? res : void 0;
|
|
26
|
+
};
|
|
27
|
+
var isArray = (v) => Array.isArray(v);
|
|
28
|
+
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
29
|
+
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
30
|
+
var isDom = () => typeof window !== "undefined";
|
|
31
|
+
function getPlatform() {
|
|
32
|
+
var _a;
|
|
33
|
+
const agent = navigator.userAgentData;
|
|
34
|
+
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
35
|
+
}
|
|
36
|
+
var pt = (v) => isDom() && v.test(getPlatform());
|
|
37
|
+
var vn = (v) => isDom() && v.test(navigator.vendor);
|
|
38
|
+
var isSafari = () => isApple() && vn(/apple/i);
|
|
39
|
+
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
40
|
+
function isDocument(el) {
|
|
41
|
+
return el.nodeType === Node.DOCUMENT_NODE;
|
|
42
|
+
}
|
|
43
|
+
function isWindow(value) {
|
|
44
|
+
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
45
|
+
}
|
|
46
|
+
function getDocument(el) {
|
|
47
|
+
var _a;
|
|
48
|
+
if (isWindow(el))
|
|
49
|
+
return el.document;
|
|
50
|
+
if (isDocument(el))
|
|
51
|
+
return el;
|
|
52
|
+
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
53
|
+
}
|
|
54
|
+
function getWindow(el) {
|
|
55
|
+
var _a;
|
|
56
|
+
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
57
|
+
}
|
|
58
|
+
function getNodeName(node) {
|
|
59
|
+
var _a;
|
|
60
|
+
return isWindow(node) ? "" : (_a = node == null ? void 0 : node.localName) != null ? _a : "";
|
|
61
|
+
}
|
|
62
|
+
function getParent(el) {
|
|
63
|
+
const doc = getDocument(el);
|
|
64
|
+
if (getNodeName(el) === "html")
|
|
65
|
+
return el;
|
|
66
|
+
return el.assignedSlot || el.parentElement || doc.documentElement;
|
|
67
|
+
}
|
|
68
|
+
function defineDomHelpers(helpers) {
|
|
69
|
+
const dom2 = {
|
|
70
|
+
getRootNode: (ctx) => {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
|
|
73
|
+
},
|
|
74
|
+
getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
|
|
75
|
+
getWin: (ctx) => {
|
|
76
|
+
var _a;
|
|
77
|
+
return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
|
|
78
|
+
},
|
|
79
|
+
getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
|
|
80
|
+
getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
|
|
81
|
+
createEmitter: (ctx, target) => {
|
|
82
|
+
const win = dom2.getWin(ctx);
|
|
83
|
+
return function emit(evt, detail, options) {
|
|
84
|
+
const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
|
|
85
|
+
const eventName = `zag:${evt}`;
|
|
86
|
+
const init = { bubbles, cancelable, composed, detail };
|
|
87
|
+
const event = new win.CustomEvent(eventName, init);
|
|
88
|
+
target.dispatchEvent(event);
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
createListener: (target) => {
|
|
92
|
+
return function listen(evt, handler) {
|
|
93
|
+
const eventName = `zag:${evt}`;
|
|
94
|
+
const listener = (e) => handler(e);
|
|
95
|
+
target.addEventListener(eventName, listener);
|
|
96
|
+
return () => target.removeEventListener(eventName, listener);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
...dom2,
|
|
102
|
+
...helpers
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function isHTMLElement(v) {
|
|
106
|
+
return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
|
|
107
|
+
}
|
|
108
|
+
var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
|
|
109
|
+
var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
|
|
110
|
+
var supportsMouseEvent = () => isDom() && window.onmousedown === null;
|
|
111
|
+
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
|
|
112
|
+
var isRef = (v) => hasProp(v, "current");
|
|
113
|
+
var fallback2 = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
|
|
114
|
+
function extractInfo(event, type = "page") {
|
|
115
|
+
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback2 : event;
|
|
116
|
+
return {
|
|
117
|
+
point: {
|
|
118
|
+
x: point[`${type}X`],
|
|
119
|
+
y: point[`${type}Y`]
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function addDomEvent(target, eventName, handler, options) {
|
|
124
|
+
const node = isRef(target) ? target.current : runIfFn(target);
|
|
125
|
+
node == null ? void 0 : node.addEventListener(eventName, handler, options);
|
|
126
|
+
return () => {
|
|
127
|
+
node == null ? void 0 : node.removeEventListener(eventName, handler, options);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function addPointerEvent(target, event, listener, options) {
|
|
131
|
+
var _a;
|
|
132
|
+
const type = (_a = getEventName(event)) != null ? _a : event;
|
|
133
|
+
return addDomEvent(target, type, wrapHandler(listener, event === "pointerdown"), options);
|
|
134
|
+
}
|
|
135
|
+
function wrapHandler(fn, filter = false) {
|
|
136
|
+
const listener = (event) => {
|
|
137
|
+
fn(event, extractInfo(event));
|
|
138
|
+
};
|
|
139
|
+
return filter ? filterPrimaryPointer(listener) : listener;
|
|
140
|
+
}
|
|
141
|
+
function filterPrimaryPointer(fn) {
|
|
142
|
+
return (event) => {
|
|
143
|
+
var _a;
|
|
144
|
+
const win = (_a = event.view) != null ? _a : window;
|
|
145
|
+
const isMouseEvent2 = event instanceof win.MouseEvent;
|
|
146
|
+
const isPrimary = !isMouseEvent2 || isMouseEvent2 && event.button === 0;
|
|
147
|
+
if (isPrimary)
|
|
148
|
+
fn(event);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
var mouseEventNames = {
|
|
152
|
+
pointerdown: "mousedown",
|
|
153
|
+
pointermove: "mousemove",
|
|
154
|
+
pointerup: "mouseup",
|
|
155
|
+
pointercancel: "mousecancel",
|
|
156
|
+
pointerover: "mouseover",
|
|
157
|
+
pointerout: "mouseout",
|
|
158
|
+
pointerenter: "mouseenter",
|
|
159
|
+
pointerleave: "mouseleave"
|
|
160
|
+
};
|
|
161
|
+
var touchEventNames = {
|
|
162
|
+
pointerdown: "touchstart",
|
|
163
|
+
pointermove: "touchmove",
|
|
164
|
+
pointerup: "touchend",
|
|
165
|
+
pointercancel: "touchcancel"
|
|
166
|
+
};
|
|
167
|
+
function getEventName(evt) {
|
|
168
|
+
if (supportsPointerEvent())
|
|
169
|
+
return evt;
|
|
170
|
+
if (supportsTouchEvent())
|
|
171
|
+
return touchEventNames[evt];
|
|
172
|
+
if (supportsMouseEvent())
|
|
173
|
+
return mouseEventNames[evt];
|
|
174
|
+
return evt;
|
|
175
|
+
}
|
|
176
|
+
function raf(fn) {
|
|
177
|
+
const id = globalThis.requestAnimationFrame(fn);
|
|
178
|
+
return function cleanup() {
|
|
179
|
+
globalThis.cancelAnimationFrame(id);
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function addPointerlockChangeListener(doc, fn) {
|
|
183
|
+
return addDomEvent(doc, "pointerlockchange", fn, false);
|
|
184
|
+
}
|
|
185
|
+
function isScrollParent(el) {
|
|
186
|
+
const { overflow, overflowX, overflowY } = getComputedStyle(el);
|
|
187
|
+
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
188
|
+
}
|
|
189
|
+
function getScrollParent(el) {
|
|
190
|
+
if (["html", "body", "#document"].includes(getNodeName(el))) {
|
|
191
|
+
return getDocument(el).body;
|
|
192
|
+
}
|
|
193
|
+
if (isHTMLElement(el) && isScrollParent(el)) {
|
|
194
|
+
return el;
|
|
195
|
+
}
|
|
196
|
+
return getScrollParent(getParent(el));
|
|
197
|
+
}
|
|
198
|
+
function getScrollParents(el, list = []) {
|
|
199
|
+
const scrollParent = getScrollParent(el);
|
|
200
|
+
const isBody = scrollParent === getDocument(el).body;
|
|
201
|
+
const win = getWindow(scrollParent);
|
|
202
|
+
const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
203
|
+
const parents = list.concat(target);
|
|
204
|
+
if (isBody)
|
|
205
|
+
return parents;
|
|
206
|
+
return parents.concat(getScrollParents(getParent(target)));
|
|
207
|
+
}
|
|
208
|
+
var visuallyHiddenStyle = {
|
|
209
|
+
border: "0",
|
|
210
|
+
clip: "rect(0 0 0 0)",
|
|
211
|
+
height: "1px",
|
|
212
|
+
margin: "-1px",
|
|
213
|
+
overflow: "hidden",
|
|
214
|
+
padding: "0",
|
|
215
|
+
position: "absolute",
|
|
216
|
+
width: "1px",
|
|
217
|
+
whiteSpace: "nowrap",
|
|
218
|
+
wordWrap: "normal"
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// src/tooltip.connect.ts
|
|
222
|
+
import { getPlacementStyles } from "@zag-js/popper";
|
|
223
|
+
|
|
224
|
+
// src/tooltip.dom.ts
|
|
225
|
+
var dom = defineDomHelpers({
|
|
226
|
+
getTriggerId: (ctx) => {
|
|
227
|
+
var _a, _b;
|
|
228
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.trigger) != null ? _b : `tooltip:${ctx.id}:trigger`;
|
|
229
|
+
},
|
|
230
|
+
getContentId: (ctx) => {
|
|
231
|
+
var _a, _b;
|
|
232
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.content) != null ? _b : `tooltip:${ctx.id}:content`;
|
|
233
|
+
},
|
|
234
|
+
getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
|
|
235
|
+
getPositionerId: (ctx) => `tooltip:${ctx.id}:popper`,
|
|
236
|
+
portalId: "tooltip-portal",
|
|
237
|
+
getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
|
|
238
|
+
getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
|
|
239
|
+
getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
|
|
240
|
+
getArrowEl: (ctx) => dom.getById(ctx, dom.getArrowId(ctx)),
|
|
241
|
+
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx)),
|
|
242
|
+
getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.portalId),
|
|
243
|
+
createPortalEl: (ctx) => {
|
|
244
|
+
const portal = dom.getDoc(ctx).createElement(dom.portalId);
|
|
245
|
+
portal.id = dom.portalId;
|
|
246
|
+
return portal;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// src/tooltip.store.ts
|
|
251
|
+
import { proxy } from "@zag-js/core";
|
|
252
|
+
var store = proxy({
|
|
253
|
+
id: null,
|
|
254
|
+
prevId: null,
|
|
255
|
+
setId(val) {
|
|
256
|
+
this.prevId = this.id;
|
|
257
|
+
this.id = val;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// src/tooltip.connect.ts
|
|
262
|
+
function connect(state, send, normalize) {
|
|
263
|
+
const id = state.context.id;
|
|
264
|
+
const hasAriaLabel = state.context.hasAriaLabel;
|
|
265
|
+
const isOpen = state.hasTag("open");
|
|
266
|
+
const triggerId = dom.getTriggerId(state.context);
|
|
267
|
+
const contentId = dom.getContentId(state.context);
|
|
268
|
+
const isDisabled = state.context.disabled;
|
|
269
|
+
const popperStyles = getPlacementStyles({
|
|
270
|
+
measured: !!state.context.isPlacementComplete,
|
|
271
|
+
placement: state.context.currentPlacement
|
|
272
|
+
});
|
|
273
|
+
return {
|
|
274
|
+
isOpen,
|
|
275
|
+
open() {
|
|
276
|
+
send("OPEN");
|
|
277
|
+
},
|
|
278
|
+
close() {
|
|
279
|
+
send("CLOSE");
|
|
280
|
+
},
|
|
281
|
+
getAnimationState() {
|
|
282
|
+
return {
|
|
283
|
+
enter: store.prevId === null && id === store.id,
|
|
284
|
+
exit: store.id === null
|
|
285
|
+
};
|
|
286
|
+
},
|
|
287
|
+
triggerProps: normalize.button({
|
|
288
|
+
"data-part": "trigger",
|
|
289
|
+
id: triggerId,
|
|
290
|
+
"data-expanded": dataAttr(isOpen),
|
|
291
|
+
"aria-describedby": isOpen ? contentId : void 0,
|
|
292
|
+
onClick() {
|
|
293
|
+
send("CLICK");
|
|
294
|
+
},
|
|
295
|
+
onFocus() {
|
|
296
|
+
send("FOCUS");
|
|
297
|
+
},
|
|
298
|
+
onBlur() {
|
|
299
|
+
if (id === store.id) {
|
|
300
|
+
send("BLUR");
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
onPointerDown() {
|
|
304
|
+
if (isDisabled)
|
|
305
|
+
return;
|
|
306
|
+
if (id === store.id) {
|
|
307
|
+
send("POINTER_DOWN");
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
onPointerMove() {
|
|
311
|
+
if (isDisabled)
|
|
312
|
+
return;
|
|
313
|
+
send("POINTER_ENTER");
|
|
314
|
+
},
|
|
315
|
+
onPointerLeave() {
|
|
316
|
+
if (isDisabled)
|
|
317
|
+
return;
|
|
318
|
+
send("POINTER_LEAVE");
|
|
319
|
+
},
|
|
320
|
+
onPointerCancel() {
|
|
321
|
+
if (isDisabled)
|
|
322
|
+
return;
|
|
323
|
+
send("POINTER_LEAVE");
|
|
324
|
+
}
|
|
325
|
+
}),
|
|
326
|
+
arrowProps: normalize.element({
|
|
327
|
+
id: dom.getArrowId(state.context),
|
|
328
|
+
"data-part": "arrow",
|
|
329
|
+
style: popperStyles.arrow
|
|
330
|
+
}),
|
|
331
|
+
innerArrowProps: normalize.element({
|
|
332
|
+
"data-part": "arrow-inner",
|
|
333
|
+
style: popperStyles.innerArrow
|
|
334
|
+
}),
|
|
335
|
+
positionerProps: normalize.element({
|
|
336
|
+
id: dom.getPositionerId(state.context),
|
|
337
|
+
"data-part": "positioner",
|
|
338
|
+
style: popperStyles.floating
|
|
339
|
+
}),
|
|
340
|
+
contentProps: normalize.element({
|
|
341
|
+
"data-part": "content",
|
|
342
|
+
role: hasAriaLabel ? void 0 : "tooltip",
|
|
343
|
+
id: hasAriaLabel ? void 0 : contentId,
|
|
344
|
+
"data-placement": state.context.currentPlacement,
|
|
345
|
+
onPointerEnter() {
|
|
346
|
+
send("TOOLTIP_POINTER_ENTER");
|
|
347
|
+
},
|
|
348
|
+
onPointerLeave() {
|
|
349
|
+
send("TOOLTIP_POINTER_LEAVE");
|
|
350
|
+
},
|
|
351
|
+
style: {
|
|
352
|
+
pointerEvents: state.context.interactive ? "auto" : "none"
|
|
353
|
+
}
|
|
354
|
+
}),
|
|
355
|
+
labelProps: normalize.element({
|
|
356
|
+
"data-part": "label",
|
|
357
|
+
id: contentId,
|
|
358
|
+
role: "tooltip",
|
|
359
|
+
style: visuallyHiddenStyle,
|
|
360
|
+
children: state.context["aria-label"]
|
|
361
|
+
}),
|
|
362
|
+
createPortal() {
|
|
363
|
+
const doc = dom.getDoc(state.context);
|
|
364
|
+
const exist = dom.getPortalEl(state.context);
|
|
365
|
+
if (exist)
|
|
366
|
+
return exist;
|
|
367
|
+
const portal = dom.createPortalEl(state.context);
|
|
368
|
+
doc.body.appendChild(portal);
|
|
369
|
+
return portal;
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// src/tooltip.machine.ts
|
|
375
|
+
import { createMachine, subscribe } from "@zag-js/core";
|
|
376
|
+
import { getPlacement } from "@zag-js/popper";
|
|
377
|
+
function machine(ctx) {
|
|
378
|
+
return createMachine(
|
|
379
|
+
{
|
|
380
|
+
id: "tooltip",
|
|
381
|
+
initial: "unknown",
|
|
382
|
+
context: {
|
|
383
|
+
openDelay: 1e3,
|
|
384
|
+
closeDelay: 500,
|
|
385
|
+
closeOnPointerDown: true,
|
|
386
|
+
closeOnEsc: true,
|
|
387
|
+
interactive: true,
|
|
388
|
+
currentPlacement: void 0,
|
|
389
|
+
...ctx,
|
|
390
|
+
positioning: {
|
|
391
|
+
placement: "bottom",
|
|
392
|
+
...ctx.positioning
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
computed: {
|
|
396
|
+
hasAriaLabel: (ctx2) => !!ctx2["aria-label"]
|
|
397
|
+
},
|
|
398
|
+
watch: {
|
|
399
|
+
disabled: ["closeIfDisabled"]
|
|
400
|
+
},
|
|
401
|
+
on: {
|
|
402
|
+
OPEN: "open",
|
|
403
|
+
CLOSE: "closed"
|
|
404
|
+
},
|
|
405
|
+
states: {
|
|
406
|
+
unknown: {
|
|
407
|
+
on: {
|
|
408
|
+
SETUP: "closed"
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
closed: {
|
|
412
|
+
tags: ["closed"],
|
|
413
|
+
entry: ["clearGlobalId", "invokeOnClose"],
|
|
414
|
+
on: {
|
|
415
|
+
FOCUS: "open",
|
|
416
|
+
POINTER_ENTER: [
|
|
417
|
+
{
|
|
418
|
+
guard: "noVisibleTooltip",
|
|
419
|
+
target: "opening"
|
|
420
|
+
},
|
|
421
|
+
{ target: "open" }
|
|
422
|
+
]
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
opening: {
|
|
426
|
+
tags: ["closed"],
|
|
427
|
+
activities: ["trackScroll", "trackPointerlockChange"],
|
|
428
|
+
after: {
|
|
429
|
+
OPEN_DELAY: "open"
|
|
430
|
+
},
|
|
431
|
+
on: {
|
|
432
|
+
POINTER_LEAVE: "closed",
|
|
433
|
+
BLUR: "closed",
|
|
434
|
+
SCROLL: "closed",
|
|
435
|
+
POINTER_LOCK_CHANGE: "closed",
|
|
436
|
+
POINTER_DOWN: {
|
|
437
|
+
guard: "closeOnPointerDown",
|
|
438
|
+
target: "closed"
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
open: {
|
|
443
|
+
tags: ["open"],
|
|
444
|
+
activities: [
|
|
445
|
+
"trackEscapeKey",
|
|
446
|
+
"trackDisabledTriggerOnSafari",
|
|
447
|
+
"trackScroll",
|
|
448
|
+
"trackPointerlockChange",
|
|
449
|
+
"computePlacement"
|
|
450
|
+
],
|
|
451
|
+
entry: ["setGlobalId", "invokeOnOpen"],
|
|
452
|
+
on: {
|
|
453
|
+
POINTER_LEAVE: [
|
|
454
|
+
{
|
|
455
|
+
guard: "isVisible",
|
|
456
|
+
target: "closing"
|
|
457
|
+
},
|
|
458
|
+
{ target: "closed" }
|
|
459
|
+
],
|
|
460
|
+
BLUR: "closed",
|
|
461
|
+
ESCAPE: "closed",
|
|
462
|
+
SCROLL: "closed",
|
|
463
|
+
POINTER_LOCK_CHANGE: "closed",
|
|
464
|
+
TOOLTIP_POINTER_LEAVE: {
|
|
465
|
+
guard: "isInteractive",
|
|
466
|
+
target: "closing"
|
|
467
|
+
},
|
|
468
|
+
POINTER_DOWN: {
|
|
469
|
+
guard: "closeOnPointerDown",
|
|
470
|
+
target: "closed"
|
|
471
|
+
},
|
|
472
|
+
CLICK: "closed"
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
closing: {
|
|
476
|
+
tags: ["open"],
|
|
477
|
+
activities: ["trackStore", "computePlacement"],
|
|
478
|
+
after: {
|
|
479
|
+
CLOSE_DELAY: "closed"
|
|
480
|
+
},
|
|
481
|
+
on: {
|
|
482
|
+
FORCE_CLOSE: "closed",
|
|
483
|
+
POINTER_ENTER: "open",
|
|
484
|
+
TOOLTIP_POINTER_ENTER: {
|
|
485
|
+
guard: "isInteractive",
|
|
486
|
+
target: "open"
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
activities: {
|
|
494
|
+
computePlacement(ctx2) {
|
|
495
|
+
ctx2.currentPlacement = ctx2.positioning.placement;
|
|
496
|
+
let cleanup;
|
|
497
|
+
raf(() => {
|
|
498
|
+
cleanup = getPlacement(dom.getTriggerEl(ctx2), dom.getPositionerEl(ctx2), {
|
|
499
|
+
...ctx2.positioning,
|
|
500
|
+
onComplete(data) {
|
|
501
|
+
ctx2.currentPlacement = data.placement;
|
|
502
|
+
ctx2.isPlacementComplete = true;
|
|
503
|
+
},
|
|
504
|
+
onCleanup() {
|
|
505
|
+
ctx2.currentPlacement = void 0;
|
|
506
|
+
ctx2.isPlacementComplete = false;
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
});
|
|
510
|
+
return cleanup;
|
|
511
|
+
},
|
|
512
|
+
trackPointerlockChange(ctx2, _evt, { send }) {
|
|
513
|
+
return addPointerlockChangeListener(dom.getDoc(ctx2), () => {
|
|
514
|
+
send("POINTER_LOCK_CHANGE");
|
|
515
|
+
});
|
|
516
|
+
},
|
|
517
|
+
trackScroll(ctx2, _evt, { send }) {
|
|
518
|
+
const trigger = dom.getTriggerEl(ctx2);
|
|
519
|
+
if (!trigger)
|
|
520
|
+
return;
|
|
521
|
+
const cleanups = getScrollParents(trigger).map((el) => {
|
|
522
|
+
const opts = { passive: true, capture: true };
|
|
523
|
+
return addDomEvent(el, "scroll", () => send("SCROLL"), opts);
|
|
524
|
+
});
|
|
525
|
+
return () => {
|
|
526
|
+
cleanups.forEach((fn) => fn == null ? void 0 : fn());
|
|
527
|
+
};
|
|
528
|
+
},
|
|
529
|
+
trackStore(ctx2, _evt, { send }) {
|
|
530
|
+
return subscribe(store, () => {
|
|
531
|
+
if (store.id !== ctx2.id) {
|
|
532
|
+
send("FORCE_CLOSE");
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
},
|
|
536
|
+
trackDisabledTriggerOnSafari(ctx2, _evt, { send }) {
|
|
537
|
+
if (!isSafari())
|
|
538
|
+
return;
|
|
539
|
+
const doc = dom.getDoc(ctx2);
|
|
540
|
+
return addPointerEvent(doc, "pointermove", (event) => {
|
|
541
|
+
const selector = "[data-part=trigger][data-expanded]";
|
|
542
|
+
if (isHTMLElement(event.target) && event.target.closest(selector))
|
|
543
|
+
return;
|
|
544
|
+
send("POINTER_LEAVE");
|
|
545
|
+
});
|
|
546
|
+
},
|
|
547
|
+
trackEscapeKey(ctx2, _evt, { send }) {
|
|
548
|
+
if (!ctx2.closeOnEsc)
|
|
549
|
+
return;
|
|
550
|
+
const doc = dom.getDoc(ctx2);
|
|
551
|
+
return addDomEvent(doc, "keydown", (event) => {
|
|
552
|
+
if (event.key === "Escape") {
|
|
553
|
+
send("ESCAPE");
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
actions: {
|
|
559
|
+
setGlobalId(ctx2) {
|
|
560
|
+
store.setId(ctx2.id);
|
|
561
|
+
},
|
|
562
|
+
clearGlobalId(ctx2) {
|
|
563
|
+
if (ctx2.id === store.id) {
|
|
564
|
+
store.setId(null);
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
invokeOnOpen(ctx2, evt) {
|
|
568
|
+
var _a;
|
|
569
|
+
const omit = ["TOOLTIP_POINTER_ENTER", "POINTER_ENTER"];
|
|
570
|
+
if (!omit.includes(evt.type)) {
|
|
571
|
+
(_a = ctx2.onOpen) == null ? void 0 : _a.call(ctx2);
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
invokeOnClose(ctx2, evt) {
|
|
575
|
+
var _a;
|
|
576
|
+
const omit = ["SETUP"];
|
|
577
|
+
if (!omit.includes(evt.type)) {
|
|
578
|
+
(_a = ctx2.onClose) == null ? void 0 : _a.call(ctx2);
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
closeIfDisabled(ctx2, _evt, { send }) {
|
|
582
|
+
if (ctx2.disabled) {
|
|
583
|
+
send("CLOSE");
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
guards: {
|
|
588
|
+
closeOnPointerDown: (ctx2) => ctx2.closeOnPointerDown,
|
|
589
|
+
noVisibleTooltip: () => store.id === null,
|
|
590
|
+
isVisible: (ctx2) => ctx2.id === store.id,
|
|
591
|
+
isInteractive: (ctx2) => ctx2.interactive
|
|
592
|
+
},
|
|
593
|
+
delays: {
|
|
594
|
+
OPEN_DELAY: (ctx2) => ctx2.openDelay,
|
|
595
|
+
CLOSE_DELAY: (ctx2) => ctx2.closeDelay
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
export {
|
|
601
|
+
connect,
|
|
602
|
+
machine
|
|
603
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"type": "module",
|
|
3
2
|
"name": "@zag-js/tooltip",
|
|
4
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
5
4
|
"description": "Core logic for the tooltip widget implemented as a state machine",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
6
8
|
"keywords": [
|
|
7
9
|
"js",
|
|
8
10
|
"machine",
|
|
@@ -15,8 +17,6 @@
|
|
|
15
17
|
"author": "Segun Adebayo <sage@adebayosegun.com>",
|
|
16
18
|
"homepage": "https://github.com/chakra-ui/zag#readme",
|
|
17
19
|
"license": "MIT",
|
|
18
|
-
"main": "dist/index.js",
|
|
19
|
-
"types": "dist/index.d.ts",
|
|
20
20
|
"repository": "https://github.com/chakra-ui/zag/tree/main/packages/tooltip",
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"files": [
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "0.
|
|
33
|
-
"@zag-js/popper": "0.
|
|
34
|
-
"@zag-js/types": "0.
|
|
32
|
+
"@zag-js/core": "0.2.0",
|
|
33
|
+
"@zag-js/popper": "0.2.0",
|
|
34
|
+
"@zag-js/types": "0.3.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@zag-js/dom-utils": "0.
|
|
38
|
-
"@zag-js/utils": "0.
|
|
37
|
+
"@zag-js/dom-utils": "0.2.0",
|
|
38
|
+
"@zag-js/utils": "0.2.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build-fast": "tsup src/index.ts --format=esm",
|
|
41
|
+
"build-fast": "tsup src/index.ts --format=esm,cjs",
|
|
42
42
|
"start": "pnpm build --watch",
|
|
43
|
-
"build": "tsup src/index.ts --format=esm --dts",
|
|
43
|
+
"build": "tsup src/index.ts --format=esm,cjs --dts",
|
|
44
44
|
"test": "jest --config ../../../jest.config.js --rootDir . --passWithNoTests",
|
|
45
45
|
"lint": "eslint src --ext .ts,.tsx",
|
|
46
46
|
"test-ci": "pnpm test --ci --runInBand",
|