@zag-js/tooltip 1.47.0 → 1.48.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/index.d.mts +6 -9
- package/dist/index.d.ts +6 -9
- package/dist/index.js +12 -38
- package/dist/index.mjs +2 -7
- package/dist/tooltip.anatomy.d.mts +2 -6
- package/dist/tooltip.anatomy.d.ts +2 -6
- package/dist/tooltip.anatomy.js +8 -33
- package/dist/tooltip.anatomy.mjs +4 -7
- package/dist/tooltip.connect.d.mts +4 -8
- package/dist/tooltip.connect.d.ts +4 -8
- package/dist/tooltip.connect.js +179 -186
- package/dist/tooltip.connect.mjs +173 -149
- package/dist/tooltip.dom.d.mts +11 -14
- package/dist/tooltip.dom.d.ts +11 -14
- package/dist/tooltip.dom.js +31 -65
- package/dist/tooltip.dom.mjs +17 -30
- package/dist/tooltip.machine.d.mts +2 -8
- package/dist/tooltip.machine.d.ts +2 -8
- package/dist/tooltip.machine.js +423 -465
- package/dist/tooltip.machine.mjs +416 -427
- package/dist/tooltip.props.d.mts +3 -9
- package/dist/tooltip.props.d.ts +3 -9
- package/dist/tooltip.props.js +29 -54
- package/dist/tooltip.props.mjs +25 -28
- package/dist/tooltip.store.d.mts +5 -9
- package/dist/tooltip.store.d.ts +5 -9
- package/dist/tooltip.store.js +9 -33
- package/dist/tooltip.store.mjs +6 -8
- package/dist/tooltip.types.d.mts +146 -149
- package/dist/tooltip.types.d.ts +146 -149
- package/dist/tooltip.types.js +4 -18
- package/dist/tooltip.types.mjs +1 -0
- package/package.json +10 -10
package/dist/tooltip.connect.mjs
CHANGED
|
@@ -1,154 +1,178 @@
|
|
|
1
|
-
|
|
1
|
+
import { parts } from "./tooltip.anatomy.mjs";
|
|
2
|
+
import { getArrowId, getContentId, getPositionerId, getTriggerId } from "./tooltip.dom.mjs";
|
|
3
|
+
import { store } from "./tooltip.store.mjs";
|
|
2
4
|
import { dataAttr, getByOwnerId, isLeftClick } from "@zag-js/dom-query";
|
|
3
5
|
import { isFocusVisible } from "@zag-js/focus-visible";
|
|
4
6
|
import { getPlacementSide, getPlacementStyles } from "@zag-js/popper";
|
|
5
|
-
|
|
6
|
-
import * as dom from "./tooltip.dom.mjs";
|
|
7
|
-
import { store } from "./tooltip.store.mjs";
|
|
7
|
+
// src/tooltip.connect.ts
|
|
8
8
|
function connect(service, normalize) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
9
|
+
const { state, context, send, scope, prop, event: _event } = service;
|
|
10
|
+
const id = prop("id");
|
|
11
|
+
const open = state.matches("open", "closing");
|
|
12
|
+
const triggerValue = context.get("triggerValue");
|
|
13
|
+
const currentPlacement = context.get("currentPlacement");
|
|
14
|
+
const currentPlacementSide = currentPlacement ? getPlacementSide(currentPlacement) : void 0;
|
|
15
|
+
const contentId = getContentId(scope);
|
|
16
|
+
const disabled = prop("disabled");
|
|
17
|
+
const popperStyles = getPlacementStyles({
|
|
18
|
+
...prop("positioning"),
|
|
19
|
+
placement: currentPlacement
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
open,
|
|
23
|
+
setOpen(nextOpen) {
|
|
24
|
+
send({
|
|
25
|
+
type: nextOpen ? "open" : "close",
|
|
26
|
+
replaces: "open"
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
triggerValue,
|
|
30
|
+
setTriggerValue(value) {
|
|
31
|
+
send({
|
|
32
|
+
type: "triggerValue.set",
|
|
33
|
+
value: value ?? void 0
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
reposition(options = {}) {
|
|
37
|
+
send({
|
|
38
|
+
type: "positioning.set",
|
|
39
|
+
options
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
getTriggerProps(props = {}) {
|
|
43
|
+
const { value } = props;
|
|
44
|
+
const current = value == null ? false : triggerValue === value;
|
|
45
|
+
const triggerId = getTriggerId(scope, value);
|
|
46
|
+
return normalize.button({
|
|
47
|
+
...parts.trigger.attrs,
|
|
48
|
+
id: triggerId,
|
|
49
|
+
"data-ownedby": scope.id,
|
|
50
|
+
"data-value": value,
|
|
51
|
+
"data-current": dataAttr(current),
|
|
52
|
+
dir: prop("dir"),
|
|
53
|
+
"data-expanded": dataAttr(open),
|
|
54
|
+
"data-state": open ? "open" : "closed",
|
|
55
|
+
"aria-describedby": open ? contentId : void 0,
|
|
56
|
+
onClick(event) {
|
|
57
|
+
if (event.defaultPrevented) return;
|
|
58
|
+
if (disabled) return;
|
|
59
|
+
if (!prop("closeOnClick")) return;
|
|
60
|
+
send({
|
|
61
|
+
type: open && value != null && !current ? "triggerValue.set" : "close",
|
|
62
|
+
src: "trigger.click",
|
|
63
|
+
value,
|
|
64
|
+
triggerId
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
onFocus(event) {
|
|
68
|
+
if (event.defaultPrevented) return;
|
|
69
|
+
if (disabled) return;
|
|
70
|
+
if (!isFocusVisible()) return;
|
|
71
|
+
send({
|
|
72
|
+
type: open && value != null && !current ? "triggerValue.set" : "open",
|
|
73
|
+
src: "trigger.focus",
|
|
74
|
+
value,
|
|
75
|
+
triggerId
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
onBlur(event) {
|
|
79
|
+
if (event.defaultPrevented) return;
|
|
80
|
+
if (disabled) return;
|
|
81
|
+
if (id !== store.get("id")) return;
|
|
82
|
+
if (!((event.relatedTarget ?? scope.getDoc().activeElement)?.closest(getByOwnerId(scope.id)) != null)) send({
|
|
83
|
+
type: "close",
|
|
84
|
+
src: "trigger.blur",
|
|
85
|
+
value,
|
|
86
|
+
triggerId
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
onPointerDown(event) {
|
|
90
|
+
if (event.defaultPrevented) return;
|
|
91
|
+
if (disabled) return;
|
|
92
|
+
if (!isLeftClick(event)) return;
|
|
93
|
+
if (!prop("closeOnPointerDown")) return;
|
|
94
|
+
if (id === store.get("id")) send({
|
|
95
|
+
type: "close",
|
|
96
|
+
src: "trigger.pointerdown",
|
|
97
|
+
value,
|
|
98
|
+
triggerId
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
onPointerMove(event) {
|
|
102
|
+
if (event.defaultPrevented) return;
|
|
103
|
+
if (disabled) return;
|
|
104
|
+
if (event.pointerType === "touch") return;
|
|
105
|
+
send({
|
|
106
|
+
type: open && value != null && !current ? "triggerValue.set" : "pointer.move",
|
|
107
|
+
value,
|
|
108
|
+
triggerId
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
onPointerOver(event) {
|
|
112
|
+
if (event.defaultPrevented) return;
|
|
113
|
+
if (disabled) return;
|
|
114
|
+
if (event.pointerType === "touch") return;
|
|
115
|
+
send({
|
|
116
|
+
type: "pointer.move",
|
|
117
|
+
value,
|
|
118
|
+
triggerId
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
onPointerLeave() {
|
|
122
|
+
send({ type: "pointer.leave" });
|
|
123
|
+
},
|
|
124
|
+
onPointerCancel() {
|
|
125
|
+
send({ type: "pointer.leave" });
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
getArrowProps() {
|
|
130
|
+
return normalize.element({
|
|
131
|
+
id: getArrowId(scope),
|
|
132
|
+
...parts.arrow.attrs,
|
|
133
|
+
dir: prop("dir"),
|
|
134
|
+
style: popperStyles.arrow
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
getArrowTipProps() {
|
|
138
|
+
return normalize.element({
|
|
139
|
+
...parts.arrowTip.attrs,
|
|
140
|
+
dir: prop("dir"),
|
|
141
|
+
style: popperStyles.arrowTip
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
getPositionerProps() {
|
|
145
|
+
return normalize.element({
|
|
146
|
+
id: getPositionerId(scope),
|
|
147
|
+
...parts.positioner.attrs,
|
|
148
|
+
dir: prop("dir"),
|
|
149
|
+
style: popperStyles.floating
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
getContentProps() {
|
|
153
|
+
const isCurrentTooltip = store.get("id") === id;
|
|
154
|
+
const isPrevTooltip = store.get("prevId") === id;
|
|
155
|
+
const instant = store.get("instant") && (open && isCurrentTooltip || isPrevTooltip);
|
|
156
|
+
return normalize.element({
|
|
157
|
+
...parts.content.attrs,
|
|
158
|
+
dir: prop("dir"),
|
|
159
|
+
hidden: !open,
|
|
160
|
+
"data-state": open ? "open" : "closed",
|
|
161
|
+
"data-instant": dataAttr(instant),
|
|
162
|
+
role: "tooltip",
|
|
163
|
+
id: contentId,
|
|
164
|
+
"aria-label": prop("aria-label"),
|
|
165
|
+
"data-placement": currentPlacement,
|
|
166
|
+
"data-side": currentPlacementSide,
|
|
167
|
+
onPointerEnter() {
|
|
168
|
+
send({ type: "content.pointer.move" });
|
|
169
|
+
},
|
|
170
|
+
onPointerLeave() {
|
|
171
|
+
send({ type: "content.pointer.leave" });
|
|
172
|
+
},
|
|
173
|
+
style: { pointerEvents: prop("interactive") ? "auto" : "none" }
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
};
|
|
151
177
|
}
|
|
152
|
-
export {
|
|
153
|
-
connect
|
|
154
|
-
};
|
|
178
|
+
export { connect };
|
package/dist/tooltip.dom.d.mts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { Scope } from
|
|
2
|
-
|
|
3
|
-
declare const
|
|
4
|
-
declare const
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
7
|
-
declare const
|
|
8
|
-
declare const
|
|
9
|
-
declare const
|
|
10
|
-
declare const
|
|
11
|
-
declare const
|
|
12
|
-
declare const getActiveTriggerEl: (scope: Scope, value: string | null) => HTMLElement | null;
|
|
13
|
-
|
|
14
|
-
export { getActiveTriggerEl, getArrowEl, getArrowId, getContentEl, getContentId, getPositionerEl, getPositionerId, getTriggerEl, getTriggerEls, getTriggerId };
|
|
1
|
+
import { Scope } from "@zag-js/core";
|
|
2
|
+
export declare const getTriggerId: (scope: Scope, value?: string) => any;
|
|
3
|
+
export declare const getContentId: (scope: Scope) => any;
|
|
4
|
+
export declare const getArrowId: (scope: Scope) => any;
|
|
5
|
+
export declare const getPositionerId: (scope: Scope) => any;
|
|
6
|
+
export declare const getTriggerEl: (scope: Scope) => HTMLElement | null;
|
|
7
|
+
export declare const getContentEl: (scope: Scope) => HTMLElement | null;
|
|
8
|
+
export declare const getPositionerEl: (scope: Scope) => HTMLElement | null;
|
|
9
|
+
export declare const getArrowEl: (scope: Scope) => HTMLElement | null;
|
|
10
|
+
export declare const getTriggerEls: (scope: Scope) => HTMLElement[];
|
|
11
|
+
export declare const getActiveTriggerEl: (scope: Scope, value: string | null) => HTMLElement | null;
|
package/dist/tooltip.dom.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { Scope } from
|
|
2
|
-
|
|
3
|
-
declare const
|
|
4
|
-
declare const
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
7
|
-
declare const
|
|
8
|
-
declare const
|
|
9
|
-
declare const
|
|
10
|
-
declare const
|
|
11
|
-
declare const
|
|
12
|
-
declare const getActiveTriggerEl: (scope: Scope, value: string | null) => HTMLElement | null;
|
|
13
|
-
|
|
14
|
-
export { getActiveTriggerEl, getArrowEl, getArrowId, getContentEl, getContentId, getPositionerEl, getPositionerId, getTriggerEl, getTriggerEls, getTriggerId };
|
|
1
|
+
import { Scope } from "@zag-js/core";
|
|
2
|
+
export declare const getTriggerId: (scope: Scope, value?: string) => any;
|
|
3
|
+
export declare const getContentId: (scope: Scope) => any;
|
|
4
|
+
export declare const getArrowId: (scope: Scope) => any;
|
|
5
|
+
export declare const getPositionerId: (scope: Scope) => any;
|
|
6
|
+
export declare const getTriggerEl: (scope: Scope) => HTMLElement | null;
|
|
7
|
+
export declare const getContentEl: (scope: Scope) => HTMLElement | null;
|
|
8
|
+
export declare const getPositionerEl: (scope: Scope) => HTMLElement | null;
|
|
9
|
+
export declare const getArrowEl: (scope: Scope) => HTMLElement | null;
|
|
10
|
+
export declare const getTriggerEls: (scope: Scope) => HTMLElement[];
|
|
11
|
+
export declare const getActiveTriggerEl: (scope: Scope, value: string | null) => HTMLElement | null;
|
package/dist/tooltip.dom.js
CHANGED
|
@@ -1,68 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/tooltip.dom.ts
|
|
21
|
-
var tooltip_dom_exports = {};
|
|
22
|
-
__export(tooltip_dom_exports, {
|
|
23
|
-
getActiveTriggerEl: () => getActiveTriggerEl,
|
|
24
|
-
getArrowEl: () => getArrowEl,
|
|
25
|
-
getArrowId: () => getArrowId,
|
|
26
|
-
getContentEl: () => getContentEl,
|
|
27
|
-
getContentId: () => getContentId,
|
|
28
|
-
getPositionerEl: () => getPositionerEl,
|
|
29
|
-
getPositionerId: () => getPositionerId,
|
|
30
|
-
getTriggerEl: () => getTriggerEl,
|
|
31
|
-
getTriggerEls: () => getTriggerEls,
|
|
32
|
-
getTriggerId: () => getTriggerId
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
33
4
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
5
|
+
let _zag_js_dom_query = require("@zag-js/dom-query");
|
|
6
|
+
let _zag_js_utils = require("@zag-js/utils");
|
|
7
|
+
// src/tooltip.dom.ts
|
|
8
|
+
const getTriggerId = (scope, value) => {
|
|
9
|
+
const customId = scope.ids?.trigger;
|
|
10
|
+
if (customId != null) return (0, _zag_js_utils.isFunction)(customId) ? customId(value) : customId;
|
|
11
|
+
return value ? `tooltip:${scope.id}:trigger:${value}` : `tooltip:${scope.id}:trigger`;
|
|
41
12
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return scope.getById(getTriggerId(scope, value));
|
|
13
|
+
const getContentId = (scope) => scope.ids?.content ?? `tooltip:${scope.id}:content`;
|
|
14
|
+
const getArrowId = (scope) => scope.ids?.arrow ?? `tooltip:${scope.id}:arrow`;
|
|
15
|
+
const getPositionerId = (scope) => scope.ids?.positioner ?? `tooltip:${scope.id}:popper`;
|
|
16
|
+
const getTriggerEl = (scope) => scope.getById(getTriggerId(scope));
|
|
17
|
+
const getContentEl = (scope) => scope.getById(getContentId(scope));
|
|
18
|
+
const getPositionerEl = (scope) => scope.getById(getPositionerId(scope));
|
|
19
|
+
const getArrowEl = (scope) => scope.getById(getArrowId(scope));
|
|
20
|
+
const getTriggerEls = (scope) => (0, _zag_js_dom_query.queryAll)(scope.getRootNode(), `[data-scope="tooltip"][data-part="trigger"]${(0, _zag_js_dom_query.getByOwnerId)(scope.id)}`);
|
|
21
|
+
const getActiveTriggerEl = (scope, value) => {
|
|
22
|
+
if (value == null) return getTriggerEl(scope) ?? getTriggerEls(scope)[0];
|
|
23
|
+
return scope.getById(getTriggerId(scope, value));
|
|
55
24
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
getTriggerEls,
|
|
67
|
-
getTriggerId
|
|
68
|
-
});
|
|
25
|
+
exports.getActiveTriggerEl = getActiveTriggerEl;
|
|
26
|
+
exports.getArrowEl = getArrowEl;
|
|
27
|
+
exports.getArrowId = getArrowId;
|
|
28
|
+
exports.getContentEl = getContentEl;
|
|
29
|
+
exports.getContentId = getContentId;
|
|
30
|
+
exports.getPositionerEl = getPositionerEl;
|
|
31
|
+
exports.getPositionerId = getPositionerId;
|
|
32
|
+
exports.getTriggerEl = getTriggerEl;
|
|
33
|
+
exports.getTriggerEls = getTriggerEls;
|
|
34
|
+
exports.getTriggerId = getTriggerId;
|
package/dist/tooltip.dom.mjs
CHANGED
|
@@ -1,34 +1,21 @@
|
|
|
1
|
-
// src/tooltip.dom.ts
|
|
2
1
|
import { getByOwnerId, queryAll } from "@zag-js/dom-query";
|
|
3
2
|
import { isFunction } from "@zag-js/utils";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
var getContentId = (scope) => scope.ids?.content ?? `tooltip:${scope.id}:content`;
|
|
10
|
-
var getArrowId = (scope) => scope.ids?.arrow ?? `tooltip:${scope.id}:arrow`;
|
|
11
|
-
var getPositionerId = (scope) => scope.ids?.positioner ?? `tooltip:${scope.id}:popper`;
|
|
12
|
-
var getTriggerEl = (scope) => scope.getById(getTriggerId(scope));
|
|
13
|
-
var getContentEl = (scope) => scope.getById(getContentId(scope));
|
|
14
|
-
var getPositionerEl = (scope) => scope.getById(getPositionerId(scope));
|
|
15
|
-
var getArrowEl = (scope) => scope.getById(getArrowId(scope));
|
|
16
|
-
var getTriggerEls = (scope) => queryAll(scope.getRootNode(), `[data-scope="tooltip"][data-part="trigger"]${getByOwnerId(scope.id)}`);
|
|
17
|
-
var getActiveTriggerEl = (scope, value) => {
|
|
18
|
-
if (value == null) {
|
|
19
|
-
return getTriggerEl(scope) ?? getTriggerEls(scope)[0];
|
|
20
|
-
}
|
|
21
|
-
return scope.getById(getTriggerId(scope, value));
|
|
3
|
+
// src/tooltip.dom.ts
|
|
4
|
+
const getTriggerId = (scope, value) => {
|
|
5
|
+
const customId = scope.ids?.trigger;
|
|
6
|
+
if (customId != null) return isFunction(customId) ? customId(value) : customId;
|
|
7
|
+
return value ? `tooltip:${scope.id}:trigger:${value}` : `tooltip:${scope.id}:trigger`;
|
|
22
8
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
const getContentId = (scope) => scope.ids?.content ?? `tooltip:${scope.id}:content`;
|
|
10
|
+
const getArrowId = (scope) => scope.ids?.arrow ?? `tooltip:${scope.id}:arrow`;
|
|
11
|
+
const getPositionerId = (scope) => scope.ids?.positioner ?? `tooltip:${scope.id}:popper`;
|
|
12
|
+
const getTriggerEl = (scope) => scope.getById(getTriggerId(scope));
|
|
13
|
+
const getContentEl = (scope) => scope.getById(getContentId(scope));
|
|
14
|
+
const getPositionerEl = (scope) => scope.getById(getPositionerId(scope));
|
|
15
|
+
const getArrowEl = (scope) => scope.getById(getArrowId(scope));
|
|
16
|
+
const getTriggerEls = (scope) => queryAll(scope.getRootNode(), `[data-scope="tooltip"][data-part="trigger"]${getByOwnerId(scope.id)}`);
|
|
17
|
+
const getActiveTriggerEl = (scope, value) => {
|
|
18
|
+
if (value == null) return getTriggerEl(scope) ?? getTriggerEls(scope)[0];
|
|
19
|
+
return scope.getById(getTriggerId(scope, value));
|
|
34
20
|
};
|
|
21
|
+
export { getActiveTriggerEl, getArrowEl, getArrowId, getContentEl, getContentId, getPositionerEl, getPositionerId, getTriggerEl, getTriggerEls, getTriggerId };
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import '@zag-js/popper';
|
|
4
|
-
import '@zag-js/types';
|
|
5
|
-
|
|
6
|
-
declare const machine: _zag_js_core.Machine<TooltipSchema>;
|
|
7
|
-
|
|
8
|
-
export { machine };
|
|
1
|
+
import { TooltipSchema } from "./tooltip.types.mjs";
|
|
2
|
+
export declare const machine: import("@zag-js/core").Machine<TooltipSchema>;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import '@zag-js/popper';
|
|
4
|
-
import '@zag-js/types';
|
|
5
|
-
|
|
6
|
-
declare const machine: _zag_js_core.Machine<TooltipSchema>;
|
|
7
|
-
|
|
8
|
-
export { machine };
|
|
1
|
+
import { TooltipSchema } from "./tooltip.types.js";
|
|
2
|
+
export declare const machine: import("@zag-js/core").Machine<TooltipSchema>;
|