@zag-js/tooltip 0.0.0-dev-20230201190914 → 0.0.0-dev-20230201193101
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/{chunk-XEL7WA6Q.mjs → chunk-ILEFGJ44.mjs} +4 -12
- package/dist/{chunk-3Z7L2VAC.mjs → chunk-V3RC3IDL.mjs} +2 -11
- package/dist/{chunk-6ELBRNM7.mjs → chunk-W5WZYXHV.mjs} +1 -8
- package/dist/index.js +5 -29
- package/dist/index.mjs +3 -3
- package/dist/tooltip.connect.d.ts +0 -1
- package/dist/tooltip.connect.js +7 -23
- package/dist/tooltip.connect.mjs +2 -2
- package/dist/tooltip.dom.d.ts +0 -3
- package/dist/tooltip.dom.js +1 -8
- package/dist/tooltip.dom.mjs +1 -1
- package/dist/tooltip.machine.js +4 -19
- package/dist/tooltip.machine.mjs +2 -2
- package/dist/tooltip.types.d.ts +1 -1
- package/package.json +7 -7
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
dom,
|
|
3
3
|
getScrollParents,
|
|
4
4
|
isHTMLElement
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-W5WZYXHV.mjs";
|
|
6
6
|
import {
|
|
7
7
|
store
|
|
8
8
|
} from "./chunk-GQYNO326.mjs";
|
|
@@ -131,7 +131,7 @@ function machine(userContext) {
|
|
|
131
131
|
return createMachine(
|
|
132
132
|
{
|
|
133
133
|
id: "tooltip",
|
|
134
|
-
initial: "
|
|
134
|
+
initial: "closed",
|
|
135
135
|
context: {
|
|
136
136
|
openDelay: 1e3,
|
|
137
137
|
closeDelay: 500,
|
|
@@ -156,11 +156,6 @@ function machine(userContext) {
|
|
|
156
156
|
CLOSE: "closed"
|
|
157
157
|
},
|
|
158
158
|
states: {
|
|
159
|
-
unknown: {
|
|
160
|
-
on: {
|
|
161
|
-
SETUP: "closed"
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
159
|
closed: {
|
|
165
160
|
tags: ["closed"],
|
|
166
161
|
entry: ["clearGlobalId", "invokeOnClose"],
|
|
@@ -323,11 +318,8 @@ function machine(userContext) {
|
|
|
323
318
|
ctx2.onOpen?.();
|
|
324
319
|
}
|
|
325
320
|
},
|
|
326
|
-
invokeOnClose(ctx2
|
|
327
|
-
|
|
328
|
-
if (!omit.includes(evt.type)) {
|
|
329
|
-
ctx2.onClose?.();
|
|
330
|
-
}
|
|
321
|
+
invokeOnClose(ctx2) {
|
|
322
|
+
ctx2.onClose?.();
|
|
331
323
|
},
|
|
332
324
|
closeIfDisabled(ctx2, _evt, { send }) {
|
|
333
325
|
if (ctx2.disabled) {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-RRQRIZBA.mjs";
|
|
4
4
|
import {
|
|
5
5
|
dom
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-W5WZYXHV.mjs";
|
|
7
7
|
import {
|
|
8
8
|
store
|
|
9
9
|
} from "./chunk-GQYNO326.mjs";
|
|
@@ -129,16 +129,7 @@ function connect(state, send, normalize) {
|
|
|
129
129
|
role: "tooltip",
|
|
130
130
|
style: visuallyHiddenStyle,
|
|
131
131
|
children: state.context["aria-label"]
|
|
132
|
-
})
|
|
133
|
-
createPortal() {
|
|
134
|
-
const doc = dom.getDoc(state.context);
|
|
135
|
-
const exist = dom.getPortalEl(state.context);
|
|
136
|
-
if (exist)
|
|
137
|
-
return exist;
|
|
138
|
-
const portal = dom.createPortalEl(state.context);
|
|
139
|
-
doc.body.appendChild(portal);
|
|
140
|
-
return portal;
|
|
141
|
-
}
|
|
132
|
+
})
|
|
142
133
|
};
|
|
143
134
|
}
|
|
144
135
|
|
|
@@ -91,18 +91,11 @@ var dom = defineDomHelpers({
|
|
|
91
91
|
getContentId: (ctx) => ctx.ids?.content ?? `tooltip:${ctx.id}:content`,
|
|
92
92
|
getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
|
|
93
93
|
getPositionerId: (ctx) => `tooltip:${ctx.id}:popper`,
|
|
94
|
-
portalId: "tooltip-portal",
|
|
95
94
|
getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
|
|
96
95
|
getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
|
|
97
96
|
getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
|
|
98
97
|
getArrowEl: (ctx) => dom.getById(ctx, dom.getArrowId(ctx)),
|
|
99
|
-
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
100
|
-
getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.portalId),
|
|
101
|
-
createPortalEl: (ctx) => {
|
|
102
|
-
const portal = dom.getDoc(ctx).createElement(dom.portalId);
|
|
103
|
-
portal.id = dom.portalId;
|
|
104
|
-
return portal;
|
|
105
|
-
}
|
|
98
|
+
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
106
99
|
});
|
|
107
100
|
|
|
108
101
|
export {
|
package/dist/index.js
CHANGED
|
@@ -260,18 +260,11 @@ var dom = defineDomHelpers({
|
|
|
260
260
|
getContentId: (ctx) => ctx.ids?.content ?? `tooltip:${ctx.id}:content`,
|
|
261
261
|
getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
|
|
262
262
|
getPositionerId: (ctx) => `tooltip:${ctx.id}:popper`,
|
|
263
|
-
portalId: "tooltip-portal",
|
|
264
263
|
getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
|
|
265
264
|
getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
|
|
266
265
|
getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
|
|
267
266
|
getArrowEl: (ctx) => dom.getById(ctx, dom.getArrowId(ctx)),
|
|
268
|
-
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
269
|
-
getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.portalId),
|
|
270
|
-
createPortalEl: (ctx) => {
|
|
271
|
-
const portal = dom.getDoc(ctx).createElement(dom.portalId);
|
|
272
|
-
portal.id = dom.portalId;
|
|
273
|
-
return portal;
|
|
274
|
-
}
|
|
267
|
+
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
275
268
|
});
|
|
276
269
|
|
|
277
270
|
// src/tooltip.store.ts
|
|
@@ -386,16 +379,7 @@ function connect(state, send, normalize) {
|
|
|
386
379
|
role: "tooltip",
|
|
387
380
|
style: visuallyHiddenStyle,
|
|
388
381
|
children: state.context["aria-label"]
|
|
389
|
-
})
|
|
390
|
-
createPortal() {
|
|
391
|
-
const doc = dom.getDoc(state.context);
|
|
392
|
-
const exist = dom.getPortalEl(state.context);
|
|
393
|
-
if (exist)
|
|
394
|
-
return exist;
|
|
395
|
-
const portal = dom.createPortalEl(state.context);
|
|
396
|
-
doc.body.appendChild(portal);
|
|
397
|
-
return portal;
|
|
398
|
-
}
|
|
382
|
+
})
|
|
399
383
|
};
|
|
400
384
|
}
|
|
401
385
|
|
|
@@ -407,7 +391,7 @@ function machine(userContext) {
|
|
|
407
391
|
return (0, import_core2.createMachine)(
|
|
408
392
|
{
|
|
409
393
|
id: "tooltip",
|
|
410
|
-
initial: "
|
|
394
|
+
initial: "closed",
|
|
411
395
|
context: {
|
|
412
396
|
openDelay: 1e3,
|
|
413
397
|
closeDelay: 500,
|
|
@@ -432,11 +416,6 @@ function machine(userContext) {
|
|
|
432
416
|
CLOSE: "closed"
|
|
433
417
|
},
|
|
434
418
|
states: {
|
|
435
|
-
unknown: {
|
|
436
|
-
on: {
|
|
437
|
-
SETUP: "closed"
|
|
438
|
-
}
|
|
439
|
-
},
|
|
440
419
|
closed: {
|
|
441
420
|
tags: ["closed"],
|
|
442
421
|
entry: ["clearGlobalId", "invokeOnClose"],
|
|
@@ -599,11 +578,8 @@ function machine(userContext) {
|
|
|
599
578
|
ctx2.onOpen?.();
|
|
600
579
|
}
|
|
601
580
|
},
|
|
602
|
-
invokeOnClose(ctx2
|
|
603
|
-
|
|
604
|
-
if (!omit.includes(evt.type)) {
|
|
605
|
-
ctx2.onClose?.();
|
|
606
|
-
}
|
|
581
|
+
invokeOnClose(ctx2) {
|
|
582
|
+
ctx2.onClose?.();
|
|
607
583
|
},
|
|
608
584
|
closeIfDisabled(ctx2, _evt, { send }) {
|
|
609
585
|
if (ctx2.disabled) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
connect
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-V3RC3IDL.mjs";
|
|
4
4
|
import {
|
|
5
5
|
anatomy
|
|
6
6
|
} from "./chunk-RRQRIZBA.mjs";
|
|
7
7
|
import {
|
|
8
8
|
machine
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-ILEFGJ44.mjs";
|
|
10
|
+
import "./chunk-W5WZYXHV.mjs";
|
|
11
11
|
import "./chunk-GQYNO326.mjs";
|
|
12
12
|
export {
|
|
13
13
|
anatomy,
|
package/dist/tooltip.connect.js
CHANGED
|
@@ -120,24 +120,22 @@ var visuallyHiddenStyle = {
|
|
|
120
120
|
// src/tooltip.connect.ts
|
|
121
121
|
var import_popper = require("@zag-js/popper");
|
|
122
122
|
|
|
123
|
+
// src/tooltip.anatomy.ts
|
|
124
|
+
var import_anatomy = require("@zag-js/anatomy");
|
|
125
|
+
var anatomy = (0, import_anatomy.createAnatomy)("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "content", "label");
|
|
126
|
+
var parts = anatomy.build();
|
|
127
|
+
|
|
123
128
|
// src/tooltip.dom.ts
|
|
124
129
|
var dom = defineDomHelpers({
|
|
125
130
|
getTriggerId: (ctx) => ctx.ids?.trigger ?? `tooltip:${ctx.id}:trigger`,
|
|
126
131
|
getContentId: (ctx) => ctx.ids?.content ?? `tooltip:${ctx.id}:content`,
|
|
127
132
|
getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
|
|
128
133
|
getPositionerId: (ctx) => `tooltip:${ctx.id}:popper`,
|
|
129
|
-
portalId: "tooltip-portal",
|
|
130
134
|
getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
|
|
131
135
|
getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
|
|
132
136
|
getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
|
|
133
137
|
getArrowEl: (ctx) => dom.getById(ctx, dom.getArrowId(ctx)),
|
|
134
|
-
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
135
|
-
getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.portalId),
|
|
136
|
-
createPortalEl: (ctx) => {
|
|
137
|
-
const portal = dom.getDoc(ctx).createElement(dom.portalId);
|
|
138
|
-
portal.id = dom.portalId;
|
|
139
|
-
return portal;
|
|
140
|
-
}
|
|
138
|
+
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
141
139
|
});
|
|
142
140
|
|
|
143
141
|
// src/tooltip.store.ts
|
|
@@ -151,11 +149,6 @@ var store = (0, import_core.proxy)({
|
|
|
151
149
|
}
|
|
152
150
|
});
|
|
153
151
|
|
|
154
|
-
// src/tooltip.anatomy.ts
|
|
155
|
-
var import_anatomy = require("@zag-js/anatomy");
|
|
156
|
-
var anatomy = (0, import_anatomy.createAnatomy)("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "content", "label");
|
|
157
|
-
var parts = anatomy.build();
|
|
158
|
-
|
|
159
152
|
// src/tooltip.connect.ts
|
|
160
153
|
function connect(state, send, normalize) {
|
|
161
154
|
const id = state.context.id;
|
|
@@ -257,16 +250,7 @@ function connect(state, send, normalize) {
|
|
|
257
250
|
role: "tooltip",
|
|
258
251
|
style: visuallyHiddenStyle,
|
|
259
252
|
children: state.context["aria-label"]
|
|
260
|
-
})
|
|
261
|
-
createPortal() {
|
|
262
|
-
const doc = dom.getDoc(state.context);
|
|
263
|
-
const exist = dom.getPortalEl(state.context);
|
|
264
|
-
if (exist)
|
|
265
|
-
return exist;
|
|
266
|
-
const portal = dom.createPortalEl(state.context);
|
|
267
|
-
doc.body.appendChild(portal);
|
|
268
|
-
return portal;
|
|
269
|
-
}
|
|
253
|
+
})
|
|
270
254
|
};
|
|
271
255
|
}
|
|
272
256
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/tooltip.connect.mjs
CHANGED
package/dist/tooltip.dom.d.ts
CHANGED
|
@@ -24,14 +24,11 @@ declare const dom: {
|
|
|
24
24
|
getContentId: (ctx: MachineContext) => string;
|
|
25
25
|
getArrowId: (ctx: MachineContext) => string;
|
|
26
26
|
getPositionerId: (ctx: MachineContext) => string;
|
|
27
|
-
portalId: string;
|
|
28
27
|
getTriggerEl: (ctx: MachineContext) => HTMLElement | null;
|
|
29
28
|
getContentEl: (ctx: MachineContext) => HTMLElement | null;
|
|
30
29
|
getPositionerEl: (ctx: MachineContext) => HTMLElement | null;
|
|
31
30
|
getArrowEl: (ctx: MachineContext) => HTMLElement | null;
|
|
32
31
|
getScrollParent: (ctx: MachineContext) => HTMLElement;
|
|
33
|
-
getPortalEl: (ctx: MachineContext) => HTMLElement | null;
|
|
34
|
-
createPortalEl: (ctx: MachineContext) => HTMLElement;
|
|
35
32
|
};
|
|
36
33
|
|
|
37
34
|
export { dom };
|
package/dist/tooltip.dom.js
CHANGED
|
@@ -104,18 +104,11 @@ var dom = defineDomHelpers({
|
|
|
104
104
|
getContentId: (ctx) => ctx.ids?.content ?? `tooltip:${ctx.id}:content`,
|
|
105
105
|
getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
|
|
106
106
|
getPositionerId: (ctx) => `tooltip:${ctx.id}:popper`,
|
|
107
|
-
portalId: "tooltip-portal",
|
|
108
107
|
getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
|
|
109
108
|
getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
|
|
110
109
|
getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
|
|
111
110
|
getArrowEl: (ctx) => dom.getById(ctx, dom.getArrowId(ctx)),
|
|
112
|
-
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
113
|
-
getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.portalId),
|
|
114
|
-
createPortalEl: (ctx) => {
|
|
115
|
-
const portal = dom.getDoc(ctx).createElement(dom.portalId);
|
|
116
|
-
portal.id = dom.portalId;
|
|
117
|
-
return portal;
|
|
118
|
-
}
|
|
111
|
+
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
119
112
|
});
|
|
120
113
|
// Annotate the CommonJS export names for ESM import in node:
|
|
121
114
|
0 && (module.exports = {
|
package/dist/tooltip.dom.mjs
CHANGED
package/dist/tooltip.machine.js
CHANGED
|
@@ -235,18 +235,11 @@ var dom = defineDomHelpers({
|
|
|
235
235
|
getContentId: (ctx) => ctx.ids?.content ?? `tooltip:${ctx.id}:content`,
|
|
236
236
|
getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
|
|
237
237
|
getPositionerId: (ctx) => `tooltip:${ctx.id}:popper`,
|
|
238
|
-
portalId: "tooltip-portal",
|
|
239
238
|
getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
|
|
240
239
|
getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
|
|
241
240
|
getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
|
|
242
241
|
getArrowEl: (ctx) => dom.getById(ctx, dom.getArrowId(ctx)),
|
|
243
|
-
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
244
|
-
getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.portalId),
|
|
245
|
-
createPortalEl: (ctx) => {
|
|
246
|
-
const portal = dom.getDoc(ctx).createElement(dom.portalId);
|
|
247
|
-
portal.id = dom.portalId;
|
|
248
|
-
return portal;
|
|
249
|
-
}
|
|
242
|
+
getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
|
|
250
243
|
});
|
|
251
244
|
|
|
252
245
|
// src/tooltip.store.ts
|
|
@@ -266,7 +259,7 @@ function machine(userContext) {
|
|
|
266
259
|
return (0, import_core2.createMachine)(
|
|
267
260
|
{
|
|
268
261
|
id: "tooltip",
|
|
269
|
-
initial: "
|
|
262
|
+
initial: "closed",
|
|
270
263
|
context: {
|
|
271
264
|
openDelay: 1e3,
|
|
272
265
|
closeDelay: 500,
|
|
@@ -291,11 +284,6 @@ function machine(userContext) {
|
|
|
291
284
|
CLOSE: "closed"
|
|
292
285
|
},
|
|
293
286
|
states: {
|
|
294
|
-
unknown: {
|
|
295
|
-
on: {
|
|
296
|
-
SETUP: "closed"
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
287
|
closed: {
|
|
300
288
|
tags: ["closed"],
|
|
301
289
|
entry: ["clearGlobalId", "invokeOnClose"],
|
|
@@ -458,11 +446,8 @@ function machine(userContext) {
|
|
|
458
446
|
ctx2.onOpen?.();
|
|
459
447
|
}
|
|
460
448
|
},
|
|
461
|
-
invokeOnClose(ctx2
|
|
462
|
-
|
|
463
|
-
if (!omit.includes(evt.type)) {
|
|
464
|
-
ctx2.onClose?.();
|
|
465
|
-
}
|
|
449
|
+
invokeOnClose(ctx2) {
|
|
450
|
+
ctx2.onClose?.();
|
|
466
451
|
},
|
|
467
452
|
closeIfDisabled(ctx2, _evt, { send }) {
|
|
468
453
|
if (ctx2.disabled) {
|
package/dist/tooltip.machine.mjs
CHANGED
package/dist/tooltip.types.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ type ComputedContext = Readonly<{
|
|
|
68
68
|
type PrivateContext = RootProperties & {};
|
|
69
69
|
type MachineContext = PublicContext & ComputedContext & PrivateContext;
|
|
70
70
|
type MachineState = {
|
|
71
|
-
value: "
|
|
71
|
+
value: "opening" | "open" | "closing" | "closed";
|
|
72
72
|
tags: "open" | "closed";
|
|
73
73
|
};
|
|
74
74
|
type State = StateMachine.State<MachineContext, MachineState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/tooltip",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230201193101",
|
|
4
4
|
"description": "Core logic for the tooltip widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@zag-js/anatomy": "0.0.0-dev-
|
|
30
|
-
"@zag-js/core": "0.0.0-dev-
|
|
31
|
-
"@zag-js/popper": "0.0.0-dev-
|
|
32
|
-
"@zag-js/types": "0.0.0-dev-
|
|
29
|
+
"@zag-js/anatomy": "0.0.0-dev-20230201193101",
|
|
30
|
+
"@zag-js/core": "0.0.0-dev-20230201193101",
|
|
31
|
+
"@zag-js/popper": "0.0.0-dev-20230201193101",
|
|
32
|
+
"@zag-js/types": "0.0.0-dev-20230201193101"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"clean-package": "2.2.0",
|
|
36
|
-
"@zag-js/dom-utils": "0.0.0-dev-
|
|
37
|
-
"@zag-js/utils": "0.0.0-dev-
|
|
36
|
+
"@zag-js/dom-utils": "0.0.0-dev-20230201193101",
|
|
37
|
+
"@zag-js/utils": "0.0.0-dev-20230201193101"
|
|
38
38
|
},
|
|
39
39
|
"clean-package": "../../../clean-package.config.json",
|
|
40
40
|
"main": "dist/index.js",
|