Socket
Socket
Sign inDemoInstall

@zag-js/tooltip

Package Overview
Dependencies
Maintainers
0
Versions
1021
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/tooltip - npm Package Compare versions

Comparing version 0.68.1 to 0.69.0

22

dist/index.js

@@ -38,2 +38,3 @@ "use strict";

var import_dom_query2 = require("@zag-js/dom-query");
var import_focus_visible = require("@zag-js/focus-visible");
var import_popper = require("@zag-js/popper");

@@ -104,2 +105,3 @@

if (state.event.src === "trigger.pointerdown") return;
if (!(0, import_focus_visible.isFocusVisible)()) return;
send({ type: "OPEN", src: "trigger.focus" });

@@ -188,2 +190,3 @@ },

var import_dom_query3 = require("@zag-js/dom-query");
var import_focus_visible2 = require("@zag-js/focus-visible");
var import_popper2 = require("@zag-js/popper");

@@ -198,2 +201,3 @@ var import_utils = require("@zag-js/utils");

initial: ctx.open ? "open" : "closed",
activities: ["trackFocusVisible"],
context: {

@@ -378,2 +382,5 @@ openDelay: 1e3,

activities: {
trackFocusVisible(ctx2) {
return (0, import_focus_visible2.trackFocusVisible)({ root: dom.getRootNode(ctx2) });
},
trackPositioning(ctx2) {

@@ -418,8 +425,9 @@ ctx2.currentPlacement = ctx2.positioning.placement;

if (!ctx2.closeOnEscape) return;
const doc = dom.getDoc(ctx2);
return (0, import_dom_event.addDomEvent)(doc, "keydown", (event) => {
if (event.key === "Escape") {
send({ type: "CLOSE", src: "keydown.escape" });
}
});
const onKeyDown = (event) => {
if ((0, import_dom_query3.isComposingEvent)(event)) return;
if (event.key !== "Escape") return;
event.stopPropagation();
send({ type: "CLOSE", src: "keydown.escape" });
};
return (0, import_dom_event.addDomEvent)(dom.getDoc(ctx2), "keydown", onKeyDown, true);
}

@@ -444,3 +452,3 @@ },

if (!ctx2.disabled) return;
send({ type: "CLOSE", src: "disabled:change" });
send({ type: "CLOSE", src: "disabled.change" });
},

@@ -447,0 +455,0 @@ reposition(ctx2, evt) {

{
"name": "@zag-js/tooltip",
"version": "0.68.1",
"version": "0.69.0",
"description": "Core logic for the tooltip widget implemented as a state machine",

@@ -30,9 +30,10 @@ "keywords": [

"dependencies": {
"@zag-js/anatomy": "0.68.1",
"@zag-js/core": "0.68.1",
"@zag-js/popper": "0.68.1",
"@zag-js/dom-query": "0.68.1",
"@zag-js/dom-event": "0.68.1",
"@zag-js/utils": "0.68.1",
"@zag-js/types": "0.68.1"
"@zag-js/anatomy": "0.69.0",
"@zag-js/core": "0.69.0",
"@zag-js/popper": "0.69.0",
"@zag-js/focus-visible": "0.69.0",
"@zag-js/dom-query": "0.69.0",
"@zag-js/dom-event": "0.69.0",
"@zag-js/utils": "0.69.0",
"@zag-js/types": "0.69.0"
},

@@ -39,0 +40,0 @@ "devDependencies": {

import { dataAttr } from "@zag-js/dom-query"
import { isFocusVisible } from "@zag-js/focus-visible"
import { getPlacementStyles } from "@zag-js/popper"

@@ -53,2 +54,3 @@ import type { NormalizeProps, PropTypes } from "@zag-js/types"

if (state.event.src === "trigger.pointerdown") return
if (!isFocusVisible()) return
send({ type: "OPEN", src: "trigger.focus" })

@@ -55,0 +57,0 @@ },

import { createMachine, guards, subscribe } from "@zag-js/core"
import { addDomEvent } from "@zag-js/dom-event"
import { getOverflowAncestors } from "@zag-js/dom-query"
import { getOverflowAncestors, isComposingEvent } from "@zag-js/dom-query"
import { trackFocusVisible } from "@zag-js/focus-visible"
import { getPlacement } from "@zag-js/popper"

@@ -19,2 +20,4 @@ import { compact } from "@zag-js/utils"

activities: ["trackFocusVisible"],
context: {

@@ -205,2 +208,5 @@ openDelay: 1000,

activities: {
trackFocusVisible(ctx) {
return trackFocusVisible({ root: dom.getRootNode(ctx) })
},
trackPositioning(ctx) {

@@ -249,8 +255,11 @@ ctx.currentPlacement = ctx.positioning.placement

if (!ctx.closeOnEscape) return
const doc = dom.getDoc(ctx)
return addDomEvent(doc, "keydown", (event) => {
if (event.key === "Escape") {
send({ type: "CLOSE", src: "keydown.escape" })
}
})
const onKeyDown = (event: KeyboardEvent) => {
if (isComposingEvent(event)) return
if (event.key !== "Escape") return
event.stopPropagation()
send({ type: "CLOSE", src: "keydown.escape" })
}
return addDomEvent(dom.getDoc(ctx), "keydown", onKeyDown, true)
},

@@ -275,3 +284,3 @@ },

if (!ctx.disabled) return
send({ type: "CLOSE", src: "disabled:change" })
send({ type: "CLOSE", src: "disabled.change" })
},

@@ -278,0 +287,0 @@ reposition(ctx, evt) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc