@zag-js/tooltip 0.1.14 → 0.1.16
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 +17 -0
- package/dist/index.mjs +17 -0
- package/package.json +9 -9
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
|
@@ -264,6 +264,7 @@ function connect(state, send, normalize) {
|
|
|
264
264
|
const isOpen = state.hasTag("open");
|
|
265
265
|
const triggerId = dom.getTriggerId(state.context);
|
|
266
266
|
const contentId = dom.getContentId(state.context);
|
|
267
|
+
const isDisabled = state.context.disabled;
|
|
267
268
|
const popperStyles = (0, import_popper.getPlacementStyles)({
|
|
268
269
|
measured: !!state.context.isPlacementComplete,
|
|
269
270
|
placement: state.context.currentPlacement
|
|
@@ -299,17 +300,25 @@ function connect(state, send, normalize) {
|
|
|
299
300
|
}
|
|
300
301
|
},
|
|
301
302
|
onPointerDown() {
|
|
303
|
+
if (isDisabled)
|
|
304
|
+
return;
|
|
302
305
|
if (id === store.id) {
|
|
303
306
|
send("POINTER_DOWN");
|
|
304
307
|
}
|
|
305
308
|
},
|
|
306
309
|
onPointerMove() {
|
|
310
|
+
if (isDisabled)
|
|
311
|
+
return;
|
|
307
312
|
send("POINTER_ENTER");
|
|
308
313
|
},
|
|
309
314
|
onPointerLeave() {
|
|
315
|
+
if (isDisabled)
|
|
316
|
+
return;
|
|
310
317
|
send("POINTER_LEAVE");
|
|
311
318
|
},
|
|
312
319
|
onPointerCancel() {
|
|
320
|
+
if (isDisabled)
|
|
321
|
+
return;
|
|
313
322
|
send("POINTER_LEAVE");
|
|
314
323
|
}
|
|
315
324
|
}),
|
|
@@ -385,6 +394,9 @@ function machine(ctx) {
|
|
|
385
394
|
computed: {
|
|
386
395
|
hasAriaLabel: (ctx2) => !!ctx2["aria-label"]
|
|
387
396
|
},
|
|
397
|
+
watch: {
|
|
398
|
+
disabled: ["closeIfDisabled"]
|
|
399
|
+
},
|
|
388
400
|
on: {
|
|
389
401
|
OPEN: "open",
|
|
390
402
|
CLOSE: "closed"
|
|
@@ -564,6 +576,11 @@ function machine(ctx) {
|
|
|
564
576
|
if (!omit.includes(evt.type)) {
|
|
565
577
|
(_a = ctx2.onClose) == null ? void 0 : _a.call(ctx2);
|
|
566
578
|
}
|
|
579
|
+
},
|
|
580
|
+
closeIfDisabled(ctx2, _evt, { send }) {
|
|
581
|
+
if (ctx2.disabled) {
|
|
582
|
+
send("CLOSE");
|
|
583
|
+
}
|
|
567
584
|
}
|
|
568
585
|
},
|
|
569
586
|
guards: {
|
package/dist/index.mjs
CHANGED
|
@@ -237,6 +237,7 @@ function connect(state, send, normalize) {
|
|
|
237
237
|
const isOpen = state.hasTag("open");
|
|
238
238
|
const triggerId = dom.getTriggerId(state.context);
|
|
239
239
|
const contentId = dom.getContentId(state.context);
|
|
240
|
+
const isDisabled = state.context.disabled;
|
|
240
241
|
const popperStyles = getPlacementStyles({
|
|
241
242
|
measured: !!state.context.isPlacementComplete,
|
|
242
243
|
placement: state.context.currentPlacement
|
|
@@ -272,17 +273,25 @@ function connect(state, send, normalize) {
|
|
|
272
273
|
}
|
|
273
274
|
},
|
|
274
275
|
onPointerDown() {
|
|
276
|
+
if (isDisabled)
|
|
277
|
+
return;
|
|
275
278
|
if (id === store.id) {
|
|
276
279
|
send("POINTER_DOWN");
|
|
277
280
|
}
|
|
278
281
|
},
|
|
279
282
|
onPointerMove() {
|
|
283
|
+
if (isDisabled)
|
|
284
|
+
return;
|
|
280
285
|
send("POINTER_ENTER");
|
|
281
286
|
},
|
|
282
287
|
onPointerLeave() {
|
|
288
|
+
if (isDisabled)
|
|
289
|
+
return;
|
|
283
290
|
send("POINTER_LEAVE");
|
|
284
291
|
},
|
|
285
292
|
onPointerCancel() {
|
|
293
|
+
if (isDisabled)
|
|
294
|
+
return;
|
|
286
295
|
send("POINTER_LEAVE");
|
|
287
296
|
}
|
|
288
297
|
}),
|
|
@@ -358,6 +367,9 @@ function machine(ctx) {
|
|
|
358
367
|
computed: {
|
|
359
368
|
hasAriaLabel: (ctx2) => !!ctx2["aria-label"]
|
|
360
369
|
},
|
|
370
|
+
watch: {
|
|
371
|
+
disabled: ["closeIfDisabled"]
|
|
372
|
+
},
|
|
361
373
|
on: {
|
|
362
374
|
OPEN: "open",
|
|
363
375
|
CLOSE: "closed"
|
|
@@ -537,6 +549,11 @@ function machine(ctx) {
|
|
|
537
549
|
if (!omit.includes(evt.type)) {
|
|
538
550
|
(_a = ctx2.onClose) == null ? void 0 : _a.call(ctx2);
|
|
539
551
|
}
|
|
552
|
+
},
|
|
553
|
+
closeIfDisabled(ctx2, _evt, { send }) {
|
|
554
|
+
if (ctx2.disabled) {
|
|
555
|
+
send("CLOSE");
|
|
556
|
+
}
|
|
540
557
|
}
|
|
541
558
|
},
|
|
542
559
|
guards: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/tooltip",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
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",
|
|
5
8
|
"keywords": [
|
|
6
9
|
"js",
|
|
7
10
|
"machine",
|
|
@@ -14,9 +17,6 @@
|
|
|
14
17
|
"author": "Segun Adebayo <sage@adebayosegun.com>",
|
|
15
18
|
"homepage": "https://github.com/chakra-ui/zag#readme",
|
|
16
19
|
"license": "MIT",
|
|
17
|
-
"main": "dist/index.js",
|
|
18
|
-
"types": "dist/index.d.ts",
|
|
19
|
-
"module": "dist/index.mjs",
|
|
20
20
|
"repository": "https://github.com/chakra-ui/zag/tree/main/packages/tooltip",
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"files": [
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "0.1.
|
|
33
|
-
"@zag-js/popper": "0.1.
|
|
34
|
-
"@zag-js/types": "0.2.
|
|
32
|
+
"@zag-js/core": "0.1.12",
|
|
33
|
+
"@zag-js/popper": "0.1.13",
|
|
34
|
+
"@zag-js/types": "0.2.7"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@zag-js/dom-utils": "0.1.
|
|
38
|
-
"@zag-js/utils": "0.1.
|
|
37
|
+
"@zag-js/dom-utils": "0.1.13",
|
|
38
|
+
"@zag-js/utils": "0.1.6"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build-fast": "tsup src/index.ts --format=esm,cjs",
|