@zag-js/tooltip 0.81.0 → 0.81.2

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.js CHANGED
@@ -164,6 +164,7 @@ function machine(userContext) {
164
164
  interactive: false,
165
165
  closeOnScroll: true,
166
166
  closeOnClick: true,
167
+ disabled: false,
167
168
  ...ctx,
168
169
  currentPlacement: void 0,
169
170
  hasPointerMoveOpened: false,
@@ -185,10 +186,16 @@ function machine(userContext) {
185
186
  entry: ["clearGlobalId"],
186
187
  on: {
187
188
  "CONTROLLED.OPEN": "open",
188
- OPEN: {
189
- target: "open",
190
- actions: ["invokeOnOpen"]
191
- },
189
+ OPEN: [
190
+ {
191
+ guard: "isOpenControlled",
192
+ actions: ["invokeOnOpen"]
193
+ },
194
+ {
195
+ target: "open",
196
+ actions: ["invokeOnOpen"]
197
+ }
198
+ ],
192
199
  POINTER_LEAVE: {
193
200
  actions: ["clearPointerMoveOpened"]
194
201
  },
@@ -236,17 +243,25 @@ function machine(userContext) {
236
243
  POINTER_LEAVE: [
237
244
  {
238
245
  guard: "isOpenControlled",
239
- actions: ["clearPointerMoveOpened", "invokeOnClose"]
246
+ // We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
247
+ actions: ["clearPointerMoveOpened", "invokeOnClose", "toggleVisibility"]
240
248
  },
241
249
  {
242
250
  target: "closed",
243
251
  actions: ["clearPointerMoveOpened", "invokeOnClose"]
244
252
  }
245
253
  ],
246
- CLOSE: {
247
- target: "closed",
248
- actions: ["invokeOnClose"]
249
- }
254
+ CLOSE: [
255
+ {
256
+ guard: "isOpenControlled",
257
+ // We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
258
+ actions: ["invokeOnClose", "toggleVisibility"]
259
+ },
260
+ {
261
+ target: "closed",
262
+ actions: ["invokeOnClose"]
263
+ }
264
+ ]
250
265
  }
251
266
  },
252
267
  open: {
@@ -255,10 +270,16 @@ function machine(userContext) {
255
270
  entry: ["setGlobalId"],
256
271
  on: {
257
272
  "CONTROLLED.CLOSE": "closed",
258
- CLOSE: {
259
- target: "closed",
260
- actions: ["invokeOnClose"]
261
- },
273
+ CLOSE: [
274
+ {
275
+ guard: "isOpenControlled",
276
+ actions: ["invokeOnClose"]
277
+ },
278
+ {
279
+ target: "closed",
280
+ actions: ["invokeOnClose"]
281
+ }
282
+ ],
262
283
  POINTER_LEAVE: [
263
284
  {
264
285
  guard: "isVisible",
@@ -315,7 +336,8 @@ function machine(userContext) {
315
336
  POINTER_MOVE: [
316
337
  {
317
338
  guard: "isOpenControlled",
318
- actions: ["setPointerMoveOpened", "invokeOnOpen"]
339
+ // We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
340
+ actions: ["setPointerMoveOpened", "invokeOnOpen", "toggleVisibility"]
319
341
  },
320
342
  {
321
343
  target: "open",
@@ -418,7 +440,9 @@ function machine(userContext) {
418
440
  });
419
441
  },
420
442
  toggleVisibility(ctx2, evt, { send }) {
421
- send({ type: ctx2.open ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE", previousEvent: evt });
443
+ queueMicrotask(() => {
444
+ send({ type: ctx2.open ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE", previousEvent: evt });
445
+ });
422
446
  },
423
447
  setPointerMoveOpened(ctx2) {
424
448
  ctx2.hasPointerMoveOpened = true;
package/dist/index.mjs CHANGED
@@ -162,6 +162,7 @@ function machine(userContext) {
162
162
  interactive: false,
163
163
  closeOnScroll: true,
164
164
  closeOnClick: true,
165
+ disabled: false,
165
166
  ...ctx,
166
167
  currentPlacement: void 0,
167
168
  hasPointerMoveOpened: false,
@@ -183,10 +184,16 @@ function machine(userContext) {
183
184
  entry: ["clearGlobalId"],
184
185
  on: {
185
186
  "CONTROLLED.OPEN": "open",
186
- OPEN: {
187
- target: "open",
188
- actions: ["invokeOnOpen"]
189
- },
187
+ OPEN: [
188
+ {
189
+ guard: "isOpenControlled",
190
+ actions: ["invokeOnOpen"]
191
+ },
192
+ {
193
+ target: "open",
194
+ actions: ["invokeOnOpen"]
195
+ }
196
+ ],
190
197
  POINTER_LEAVE: {
191
198
  actions: ["clearPointerMoveOpened"]
192
199
  },
@@ -234,17 +241,25 @@ function machine(userContext) {
234
241
  POINTER_LEAVE: [
235
242
  {
236
243
  guard: "isOpenControlled",
237
- actions: ["clearPointerMoveOpened", "invokeOnClose"]
244
+ // We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
245
+ actions: ["clearPointerMoveOpened", "invokeOnClose", "toggleVisibility"]
238
246
  },
239
247
  {
240
248
  target: "closed",
241
249
  actions: ["clearPointerMoveOpened", "invokeOnClose"]
242
250
  }
243
251
  ],
244
- CLOSE: {
245
- target: "closed",
246
- actions: ["invokeOnClose"]
247
- }
252
+ CLOSE: [
253
+ {
254
+ guard: "isOpenControlled",
255
+ // We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
256
+ actions: ["invokeOnClose", "toggleVisibility"]
257
+ },
258
+ {
259
+ target: "closed",
260
+ actions: ["invokeOnClose"]
261
+ }
262
+ ]
248
263
  }
249
264
  },
250
265
  open: {
@@ -253,10 +268,16 @@ function machine(userContext) {
253
268
  entry: ["setGlobalId"],
254
269
  on: {
255
270
  "CONTROLLED.CLOSE": "closed",
256
- CLOSE: {
257
- target: "closed",
258
- actions: ["invokeOnClose"]
259
- },
271
+ CLOSE: [
272
+ {
273
+ guard: "isOpenControlled",
274
+ actions: ["invokeOnClose"]
275
+ },
276
+ {
277
+ target: "closed",
278
+ actions: ["invokeOnClose"]
279
+ }
280
+ ],
260
281
  POINTER_LEAVE: [
261
282
  {
262
283
  guard: "isVisible",
@@ -313,7 +334,8 @@ function machine(userContext) {
313
334
  POINTER_MOVE: [
314
335
  {
315
336
  guard: "isOpenControlled",
316
- actions: ["setPointerMoveOpened", "invokeOnOpen"]
337
+ // We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
338
+ actions: ["setPointerMoveOpened", "invokeOnOpen", "toggleVisibility"]
317
339
  },
318
340
  {
319
341
  target: "open",
@@ -416,7 +438,9 @@ function machine(userContext) {
416
438
  });
417
439
  },
418
440
  toggleVisibility(ctx2, evt, { send }) {
419
- send({ type: ctx2.open ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE", previousEvent: evt });
441
+ queueMicrotask(() => {
442
+ send({ type: ctx2.open ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE", previousEvent: evt });
443
+ });
420
444
  },
421
445
  setPointerMoveOpened(ctx2) {
422
446
  ctx2.hasPointerMoveOpened = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/tooltip",
3
- "version": "0.81.0",
3
+ "version": "0.81.2",
4
4
  "description": "Core logic for the tooltip widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,13 +26,13 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/anatomy": "0.81.0",
30
- "@zag-js/core": "0.81.0",
31
- "@zag-js/popper": "0.81.0",
32
- "@zag-js/focus-visible": "0.81.0",
33
- "@zag-js/dom-query": "0.81.0",
34
- "@zag-js/utils": "0.81.0",
35
- "@zag-js/types": "0.81.0"
29
+ "@zag-js/anatomy": "0.81.2",
30
+ "@zag-js/core": "0.81.2",
31
+ "@zag-js/popper": "0.81.2",
32
+ "@zag-js/focus-visible": "0.81.2",
33
+ "@zag-js/dom-query": "0.81.2",
34
+ "@zag-js/utils": "0.81.2",
35
+ "@zag-js/types": "0.81.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "clean-package": "2.2.0"