@zag-js/tooltip 1.40.0 → 1.41.0
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/tooltip.connect.js
CHANGED
|
@@ -45,11 +45,13 @@ function connect(service, normalize) {
|
|
|
45
45
|
const hasAriaLabel = !!prop("aria-label");
|
|
46
46
|
const open = state.matches("open", "closing");
|
|
47
47
|
const triggerValue = context.get("triggerValue");
|
|
48
|
+
const currentPlacement = context.get("currentPlacement");
|
|
49
|
+
const currentPlacementSide = currentPlacement ? (0, import_popper.getPlacementSide)(currentPlacement) : void 0;
|
|
48
50
|
const contentId = dom.getContentId(scope);
|
|
49
51
|
const disabled = prop("disabled");
|
|
50
52
|
const popperStyles = (0, import_popper.getPlacementStyles)({
|
|
51
53
|
...prop("positioning"),
|
|
52
|
-
placement:
|
|
54
|
+
placement: currentPlacement
|
|
53
55
|
});
|
|
54
56
|
return {
|
|
55
57
|
open,
|
|
@@ -170,7 +172,8 @@ function connect(service, normalize) {
|
|
|
170
172
|
"data-instant": (0, import_dom_query.dataAttr)(instant),
|
|
171
173
|
role: hasAriaLabel ? void 0 : "tooltip",
|
|
172
174
|
id: hasAriaLabel ? void 0 : contentId,
|
|
173
|
-
"data-placement":
|
|
175
|
+
"data-placement": currentPlacement,
|
|
176
|
+
"data-side": currentPlacementSide,
|
|
174
177
|
onPointerEnter() {
|
|
175
178
|
send({ type: "content.pointer.move" });
|
|
176
179
|
},
|
package/dist/tooltip.connect.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/tooltip.connect.ts
|
|
2
2
|
import { dataAttr, isLeftClick } from "@zag-js/dom-query";
|
|
3
3
|
import { isFocusVisible } from "@zag-js/focus-visible";
|
|
4
|
-
import { getPlacementStyles } from "@zag-js/popper";
|
|
4
|
+
import { getPlacementSide, getPlacementStyles } from "@zag-js/popper";
|
|
5
5
|
import { parts } from "./tooltip.anatomy.mjs";
|
|
6
6
|
import * as dom from "./tooltip.dom.mjs";
|
|
7
7
|
import { store } from "./tooltip.store.mjs";
|
|
@@ -11,11 +11,13 @@ function connect(service, normalize) {
|
|
|
11
11
|
const hasAriaLabel = !!prop("aria-label");
|
|
12
12
|
const open = state.matches("open", "closing");
|
|
13
13
|
const triggerValue = context.get("triggerValue");
|
|
14
|
+
const currentPlacement = context.get("currentPlacement");
|
|
15
|
+
const currentPlacementSide = currentPlacement ? getPlacementSide(currentPlacement) : void 0;
|
|
14
16
|
const contentId = dom.getContentId(scope);
|
|
15
17
|
const disabled = prop("disabled");
|
|
16
18
|
const popperStyles = getPlacementStyles({
|
|
17
19
|
...prop("positioning"),
|
|
18
|
-
placement:
|
|
20
|
+
placement: currentPlacement
|
|
19
21
|
});
|
|
20
22
|
return {
|
|
21
23
|
open,
|
|
@@ -136,7 +138,8 @@ function connect(service, normalize) {
|
|
|
136
138
|
"data-instant": dataAttr(instant),
|
|
137
139
|
role: hasAriaLabel ? void 0 : "tooltip",
|
|
138
140
|
id: hasAriaLabel ? void 0 : contentId,
|
|
139
|
-
"data-placement":
|
|
141
|
+
"data-placement": currentPlacement,
|
|
142
|
+
"data-side": currentPlacementSide,
|
|
140
143
|
onPointerEnter() {
|
|
141
144
|
send({ type: "content.pointer.move" });
|
|
142
145
|
},
|
package/dist/tooltip.dom.js
CHANGED
|
@@ -46,9 +46,12 @@ var getTriggerEl = (scope) => scope.getById(getTriggerId(scope));
|
|
|
46
46
|
var getContentEl = (scope) => scope.getById(getContentId(scope));
|
|
47
47
|
var getPositionerEl = (scope) => scope.getById(getPositionerId(scope));
|
|
48
48
|
var getArrowEl = (scope) => scope.getById(getArrowId(scope));
|
|
49
|
-
var getTriggerEls = (scope) => (0, import_dom_query.queryAll)(scope.
|
|
49
|
+
var getTriggerEls = (scope) => (0, import_dom_query.queryAll)(scope.getRootNode(), `[data-scope="tooltip"][data-part="trigger"][data-ownedby="${scope.id}"]`);
|
|
50
50
|
var getActiveTriggerEl = (scope, value) => {
|
|
51
|
-
|
|
51
|
+
if (value == null) {
|
|
52
|
+
return getTriggerEl(scope) ?? getTriggerEls(scope)[0];
|
|
53
|
+
}
|
|
54
|
+
return scope.getById(getTriggerId(scope, value));
|
|
52
55
|
};
|
|
53
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
54
57
|
0 && (module.exports = {
|
package/dist/tooltip.dom.mjs
CHANGED
|
@@ -13,9 +13,12 @@ var getTriggerEl = (scope) => scope.getById(getTriggerId(scope));
|
|
|
13
13
|
var getContentEl = (scope) => scope.getById(getContentId(scope));
|
|
14
14
|
var getPositionerEl = (scope) => scope.getById(getPositionerId(scope));
|
|
15
15
|
var getArrowEl = (scope) => scope.getById(getArrowId(scope));
|
|
16
|
-
var getTriggerEls = (scope) => queryAll(scope.
|
|
16
|
+
var getTriggerEls = (scope) => queryAll(scope.getRootNode(), `[data-scope="tooltip"][data-part="trigger"][data-ownedby="${scope.id}"]`);
|
|
17
17
|
var getActiveTriggerEl = (scope, value) => {
|
|
18
|
-
|
|
18
|
+
if (value == null) {
|
|
19
|
+
return getTriggerEl(scope) ?? getTriggerEls(scope)[0];
|
|
20
|
+
}
|
|
21
|
+
return scope.getById(getTriggerId(scope, value));
|
|
19
22
|
};
|
|
20
23
|
export {
|
|
21
24
|
getActiveTriggerEl,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/tooltip",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.0",
|
|
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": "1.
|
|
30
|
-
"@zag-js/core": "1.
|
|
31
|
-
"@zag-js/popper": "1.
|
|
32
|
-
"@zag-js/focus-visible": "1.
|
|
33
|
-
"@zag-js/dom-query": "1.
|
|
34
|
-
"@zag-js/utils": "1.
|
|
35
|
-
"@zag-js/types": "1.
|
|
29
|
+
"@zag-js/anatomy": "1.41.0",
|
|
30
|
+
"@zag-js/core": "1.41.0",
|
|
31
|
+
"@zag-js/popper": "1.41.0",
|
|
32
|
+
"@zag-js/focus-visible": "1.41.0",
|
|
33
|
+
"@zag-js/dom-query": "1.41.0",
|
|
34
|
+
"@zag-js/utils": "1.41.0",
|
|
35
|
+
"@zag-js/types": "1.41.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"clean-package": "2.2.0"
|