@zag-js/tooltip
Advanced tools
Comparing version 0.70.0 to 0.71.0
@@ -1,44 +0,16 @@ | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
'use strict'; | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
anatomy: () => anatomy, | ||
connect: () => connect, | ||
machine: () => machine, | ||
props: () => props, | ||
splitProps: () => splitProps | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var anatomy$1 = require('@zag-js/anatomy'); | ||
var domQuery = require('@zag-js/dom-query'); | ||
var focusVisible = require('@zag-js/focus-visible'); | ||
var popper = require('@zag-js/popper'); | ||
var core = require('@zag-js/core'); | ||
var domEvent = require('@zag-js/dom-event'); | ||
var utils = require('@zag-js/utils'); | ||
var types = require('@zag-js/types'); | ||
// src/tooltip.anatomy.ts | ||
var import_anatomy = require("@zag-js/anatomy"); | ||
var anatomy = (0, import_anatomy.createAnatomy)("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "content"); | ||
var anatomy = anatomy$1.createAnatomy("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "content"); | ||
var parts = anatomy.build(); | ||
// src/tooltip.connect.ts | ||
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"); | ||
// src/tooltip.dom.ts | ||
var import_dom_query = require("@zag-js/dom-query"); | ||
var dom = (0, import_dom_query.createScope)({ | ||
var dom = domQuery.createScope({ | ||
getTriggerId: (ctx) => ctx.ids?.trigger ?? `tooltip:${ctx.id}:trigger`, | ||
@@ -53,6 +25,3 @@ getContentId: (ctx) => ctx.ids?.content ?? `tooltip:${ctx.id}:content`, | ||
}); | ||
// src/tooltip.store.ts | ||
var import_core = require("@zag-js/core"); | ||
var store = (0, import_core.proxy)({ | ||
var store = core.proxy({ | ||
id: null, | ||
@@ -74,3 +43,3 @@ prevId: null, | ||
const disabled = state.context.disabled; | ||
const popperStyles = (0, import_popper.getPlacementStyles)({ | ||
const popperStyles = popper.getPlacementStyles({ | ||
...state.context.positioning, | ||
@@ -93,3 +62,3 @@ placement: state.context.currentPlacement | ||
dir: state.context.dir, | ||
"data-expanded": (0, import_dom_query2.dataAttr)(open), | ||
"data-expanded": domQuery.dataAttr(open), | ||
"data-state": open ? "open" : "closed", | ||
@@ -107,3 +76,3 @@ "aria-describedby": open ? contentId : void 0, | ||
if (state.event.src === "trigger.pointerdown") return; | ||
if (!(0, import_focus_visible.isFocusVisible)()) return; | ||
if (!focusVisible.isFocusVisible()) return; | ||
send({ type: "OPEN", src: "trigger.focus" }); | ||
@@ -187,14 +156,6 @@ }, | ||
} | ||
// src/tooltip.machine.ts | ||
var import_core2 = require("@zag-js/core"); | ||
var import_dom_event = require("@zag-js/dom-event"); | ||
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"); | ||
var import_utils = require("@zag-js/utils"); | ||
var { and, not } = import_core2.guards; | ||
var { and, not } = core.guards; | ||
function machine(userContext) { | ||
const ctx = (0, import_utils.compact)(userContext); | ||
return (0, import_core2.createMachine)( | ||
const ctx = utils.compact(userContext); | ||
return core.createMachine( | ||
{ | ||
@@ -384,3 +345,3 @@ id: "tooltip", | ||
trackFocusVisible(ctx2) { | ||
return (0, import_focus_visible2.trackFocusVisible)({ root: dom.getRootNode(ctx2) }); | ||
return focusVisible.trackFocusVisible({ root: dom.getRootNode(ctx2) }); | ||
}, | ||
@@ -390,3 +351,3 @@ trackPositioning(ctx2) { | ||
const getPositionerEl = () => dom.getPositionerEl(ctx2); | ||
return (0, import_popper2.getPlacement)(dom.getTriggerEl(ctx2), getPositionerEl, { | ||
return popper.getPlacement(dom.getTriggerEl(ctx2), getPositionerEl, { | ||
...ctx2.positioning, | ||
@@ -401,3 +362,3 @@ defer: true, | ||
const onChange = () => send({ type: "CLOSE", src: "pointerlock:change" }); | ||
return (0, import_dom_event.addDomEvent)(dom.getDoc(ctx2), "pointerlockchange", onChange, false); | ||
return domEvent.addDomEvent(dom.getDoc(ctx2), "pointerlockchange", onChange, false); | ||
}, | ||
@@ -408,3 +369,3 @@ trackScroll(ctx2, _evt, { send }) { | ||
if (!triggerEl) return; | ||
const overflowParents = (0, import_dom_query3.getOverflowAncestors)(triggerEl); | ||
const overflowParents = domQuery.getOverflowAncestors(triggerEl); | ||
const cleanups = overflowParents.map((overflowParent) => { | ||
@@ -414,3 +375,3 @@ const onScroll = () => { | ||
}; | ||
return (0, import_dom_event.addDomEvent)(overflowParent, "scroll", onScroll, { passive: true, capture: true }); | ||
return domEvent.addDomEvent(overflowParent, "scroll", onScroll, { passive: true, capture: true }); | ||
}); | ||
@@ -422,3 +383,3 @@ return () => { | ||
trackStore(ctx2, _evt, { send }) { | ||
return (0, import_core2.subscribe)(store, () => { | ||
return core.subscribe(store, () => { | ||
if (store.id !== ctx2.id) { | ||
@@ -432,3 +393,3 @@ send({ type: "CLOSE", src: "id.change" }); | ||
const onKeyDown = (event) => { | ||
if ((0, import_dom_query3.isComposingEvent)(event)) return; | ||
if (domQuery.isComposingEvent(event)) return; | ||
if (event.key !== "Escape") return; | ||
@@ -438,3 +399,3 @@ event.stopPropagation(); | ||
}; | ||
return (0, import_dom_event.addDomEvent)(dom.getDoc(ctx2), "keydown", onKeyDown, true); | ||
return domEvent.addDomEvent(dom.getDoc(ctx2), "keydown", onKeyDown, true); | ||
} | ||
@@ -463,3 +424,3 @@ }, | ||
const getPositionerEl = () => dom.getPositionerEl(ctx2); | ||
(0, import_popper2.getPlacement)(dom.getTriggerEl(ctx2), getPositionerEl, { | ||
popper.getPlacement(dom.getTriggerEl(ctx2), getPositionerEl, { | ||
...ctx2.positioning, | ||
@@ -498,7 +459,3 @@ ...evt.options, | ||
} | ||
// src/tooltip.props.ts | ||
var import_types = require("@zag-js/types"); | ||
var import_utils2 = require("@zag-js/utils"); | ||
var props = (0, import_types.createProps)()([ | ||
var props = types.createProps()([ | ||
"aria-label", | ||
@@ -522,11 +479,8 @@ "closeDelay", | ||
]); | ||
var splitProps = (0, import_utils2.createSplitProps)(props); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
anatomy, | ||
connect, | ||
machine, | ||
props, | ||
splitProps | ||
}); | ||
//# sourceMappingURL=index.js.map | ||
var splitProps = utils.createSplitProps(props); | ||
exports.anatomy = anatomy; | ||
exports.connect = connect; | ||
exports.machine = machine; | ||
exports.props = props; | ||
exports.splitProps = splitProps; |
{ | ||
"name": "@zag-js/tooltip", | ||
"version": "0.70.0", | ||
"version": "0.71.0", | ||
"description": "Core logic for the tooltip widget implemented as a state machine", | ||
@@ -20,4 +20,3 @@ "keywords": [ | ||
"files": [ | ||
"dist", | ||
"src" | ||
"dist" | ||
], | ||
@@ -31,10 +30,10 @@ "publishConfig": { | ||
"dependencies": { | ||
"@zag-js/anatomy": "0.70.0", | ||
"@zag-js/core": "0.70.0", | ||
"@zag-js/popper": "0.70.0", | ||
"@zag-js/focus-visible": "0.70.0", | ||
"@zag-js/dom-query": "0.70.0", | ||
"@zag-js/dom-event": "0.70.0", | ||
"@zag-js/utils": "0.70.0", | ||
"@zag-js/types": "0.70.0" | ||
"@zag-js/anatomy": "0.71.0", | ||
"@zag-js/core": "0.71.0", | ||
"@zag-js/popper": "0.71.0", | ||
"@zag-js/focus-visible": "0.71.0", | ||
"@zag-js/dom-query": "0.71.0", | ||
"@zag-js/dom-event": "0.71.0", | ||
"@zag-js/utils": "0.71.0", | ||
"@zag-js/types": "0.71.0" | ||
}, | ||
@@ -41,0 +40,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41276
7
1058
+ Added@zag-js/anatomy@0.71.0(transitive)
+ Added@zag-js/core@0.71.0(transitive)
+ Added@zag-js/dom-event@0.71.0(transitive)
+ Added@zag-js/dom-query@0.71.0(transitive)
+ Added@zag-js/focus-visible@0.71.0(transitive)
+ Added@zag-js/popper@0.71.0(transitive)
+ Added@zag-js/store@0.71.0(transitive)
+ Added@zag-js/text-selection@0.71.0(transitive)
+ Added@zag-js/types@0.71.0(transitive)
+ Added@zag-js/utils@0.71.0(transitive)
- Removed@zag-js/anatomy@0.70.0(transitive)
- Removed@zag-js/core@0.70.0(transitive)
- Removed@zag-js/dom-event@0.70.0(transitive)
- Removed@zag-js/dom-query@0.70.0(transitive)
- Removed@zag-js/focus-visible@0.70.0(transitive)
- Removed@zag-js/popper@0.70.0(transitive)
- Removed@zag-js/store@0.70.0(transitive)
- Removed@zag-js/text-selection@0.70.0(transitive)
- Removed@zag-js/types@0.70.0(transitive)
- Removed@zag-js/utils@0.70.0(transitive)
Updated@zag-js/anatomy@0.71.0
Updated@zag-js/core@0.71.0
Updated@zag-js/dom-event@0.71.0
Updated@zag-js/dom-query@0.71.0
Updated@zag-js/focus-visible@0.71.0
Updated@zag-js/popper@0.71.0
Updated@zag-js/types@0.71.0
Updated@zag-js/utils@0.71.0