@serendie/ui 2.0.0-dev.202507240128 → 2.0.0-dev.202507240155
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/components/Tooltip/Tooltip.d.ts +14 -0
- package/dist/components/Tooltip/Tooltip.js +70 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -10
- package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow-tip.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-content.js +15 -0
- package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-positioner.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-root.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-trigger.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip-context.js +10 -0
- package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip.js +17 -0
- package/dist/node_modules/@zag-js/dom-query/dist/index.js +236 -231
- package/dist/node_modules/@zag-js/store/dist/index.js +131 -0
- package/dist/node_modules/@zag-js/tooltip/dist/index.js +459 -0
- package/dist/node_modules/proxy-compare/dist/index.js +7 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { markToTrack as z, getUntracked as K } from "../../../proxy-compare/dist/index.js";
|
|
2
|
+
function U() {
|
|
3
|
+
if (typeof globalThis < "u") return globalThis;
|
|
4
|
+
if (typeof self < "u") return self;
|
|
5
|
+
if (typeof window < "u") return window;
|
|
6
|
+
if (typeof global < "u") return global;
|
|
7
|
+
}
|
|
8
|
+
function D(e, l) {
|
|
9
|
+
const i = U();
|
|
10
|
+
return i ? (i[e] || (i[e] = l()), i[e]) : l();
|
|
11
|
+
}
|
|
12
|
+
var O = D("__zag__refSet", () => /* @__PURE__ */ new WeakSet()), $ = (e) => typeof e == "object" && e !== null && "$$typeof" in e && "props" in e, q = (e) => typeof e == "object" && e !== null && "__v_isVNode" in e, B = (e) => typeof e == "object" && e !== null && "nodeType" in e && typeof e.nodeName == "string", k = (e) => $(e) || q(e) || B(e), j = (e) => e !== null && typeof e == "object", V = (e) => j(e) && !O.has(e) && (Array.isArray(e) || !(Symbol.iterator in e)) && !k(e) && !(e instanceof WeakMap) && !(e instanceof WeakSet) && !(e instanceof Error) && !(e instanceof Number) && !(e instanceof Date) && !(e instanceof String) && !(e instanceof RegExp) && !(e instanceof ArrayBuffer) && !(e instanceof Promise), S = () => process.env.NODE_ENV !== "production", g = D("__zag__proxyStateMap", () => /* @__PURE__ */ new WeakMap()), G = (e = Object.is, l = (s, p) => new Proxy(s, p), i = /* @__PURE__ */ new WeakMap(), b = (s, p) => {
|
|
13
|
+
const c = i.get(s);
|
|
14
|
+
if ((c == null ? void 0 : c[0]) === p)
|
|
15
|
+
return c[1];
|
|
16
|
+
const o = Array.isArray(s) ? [] : Object.create(Object.getPrototypeOf(s));
|
|
17
|
+
return z(o, !0), i.set(s, [p, o]), Reflect.ownKeys(s).forEach((w) => {
|
|
18
|
+
const d = Reflect.get(s, w);
|
|
19
|
+
O.has(d) ? (z(d, !1), o[w] = d) : g.has(d) ? o[w] = X(d) : o[w] = d;
|
|
20
|
+
}), Object.freeze(o);
|
|
21
|
+
}, a = /* @__PURE__ */ new WeakMap(), y = [1, 1], _ = (s) => {
|
|
22
|
+
if (!j(s))
|
|
23
|
+
throw new Error("object required");
|
|
24
|
+
const p = a.get(s);
|
|
25
|
+
if (p)
|
|
26
|
+
return p;
|
|
27
|
+
let c = y[0];
|
|
28
|
+
const o = /* @__PURE__ */ new Set(), w = (n, t = ++y[0]) => {
|
|
29
|
+
c !== t && (c = t, o.forEach((r) => r(n, t)));
|
|
30
|
+
};
|
|
31
|
+
let d = y[1];
|
|
32
|
+
const W = (n = ++y[1]) => (d !== n && !o.size && (d = n, u.forEach(([t]) => {
|
|
33
|
+
const r = t[1](n);
|
|
34
|
+
r > c && (c = r);
|
|
35
|
+
})), c), v = (n) => (t, r) => {
|
|
36
|
+
const f = [...t];
|
|
37
|
+
f[1] = [n, ...f[1]], w(f, r);
|
|
38
|
+
}, u = /* @__PURE__ */ new Map(), N = (n, t) => {
|
|
39
|
+
if (S() && u.has(n))
|
|
40
|
+
throw new Error("prop listener already exists");
|
|
41
|
+
if (o.size) {
|
|
42
|
+
const r = t[3](v(n));
|
|
43
|
+
u.set(n, [t, r]);
|
|
44
|
+
} else
|
|
45
|
+
u.set(n, [t]);
|
|
46
|
+
}, L = (n) => {
|
|
47
|
+
var r;
|
|
48
|
+
const t = u.get(n);
|
|
49
|
+
t && (u.delete(n), (r = t[1]) == null || r.call(t));
|
|
50
|
+
}, T = (n) => (o.add(n), o.size === 1 && u.forEach(([r, f], m) => {
|
|
51
|
+
if (S() && f)
|
|
52
|
+
throw new Error("remove already exists");
|
|
53
|
+
const h = r[3](v(m));
|
|
54
|
+
u.set(m, [r, h]);
|
|
55
|
+
}), () => {
|
|
56
|
+
o.delete(n), o.size === 0 && u.forEach(([r, f], m) => {
|
|
57
|
+
f && (f(), u.set(m, [r]));
|
|
58
|
+
});
|
|
59
|
+
}), R = Array.isArray(s) ? [] : Object.create(Object.getPrototypeOf(s)), E = l(R, {
|
|
60
|
+
deleteProperty(n, t) {
|
|
61
|
+
const r = Reflect.get(n, t);
|
|
62
|
+
L(t);
|
|
63
|
+
const f = Reflect.deleteProperty(n, t);
|
|
64
|
+
return f && w(["delete", [t], r]), f;
|
|
65
|
+
},
|
|
66
|
+
set(n, t, r, f) {
|
|
67
|
+
var A;
|
|
68
|
+
const m = Reflect.has(n, t), h = Reflect.get(n, t, f);
|
|
69
|
+
if (m && (e(h, r) || a.has(r) && e(h, a.get(r))))
|
|
70
|
+
return !0;
|
|
71
|
+
L(t), j(r) && (r = K(r) || r);
|
|
72
|
+
let P = r;
|
|
73
|
+
if (!((A = Object.getOwnPropertyDescriptor(n, t)) != null && A.set)) {
|
|
74
|
+
!g.has(r) && V(r) && (P = Q(r));
|
|
75
|
+
const M = !O.has(P) && g.get(P);
|
|
76
|
+
M && N(t, M);
|
|
77
|
+
}
|
|
78
|
+
return Reflect.set(n, t, P, f), w(["set", [t], r, h]), !0;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
a.set(s, E);
|
|
82
|
+
const F = [R, W, b, T];
|
|
83
|
+
return g.set(E, F), Reflect.ownKeys(s).forEach((n) => {
|
|
84
|
+
const t = Object.getOwnPropertyDescriptor(s, n);
|
|
85
|
+
t.get || t.set ? Object.defineProperty(R, n, t) : E[n] = s[n];
|
|
86
|
+
}), E;
|
|
87
|
+
}) => [
|
|
88
|
+
// public functions
|
|
89
|
+
_,
|
|
90
|
+
// shared state
|
|
91
|
+
g,
|
|
92
|
+
O,
|
|
93
|
+
// internal things
|
|
94
|
+
e,
|
|
95
|
+
l,
|
|
96
|
+
V,
|
|
97
|
+
i,
|
|
98
|
+
b,
|
|
99
|
+
a,
|
|
100
|
+
y
|
|
101
|
+
], [J] = G();
|
|
102
|
+
function Q(e = {}) {
|
|
103
|
+
return J(e);
|
|
104
|
+
}
|
|
105
|
+
function I(e, l, i) {
|
|
106
|
+
const b = g.get(e);
|
|
107
|
+
S() && !b && console.warn("Please use proxy object");
|
|
108
|
+
let a;
|
|
109
|
+
const y = [], _ = b[3];
|
|
110
|
+
let s = !1;
|
|
111
|
+
const c = _((o) => {
|
|
112
|
+
y.push(o), a || (a = Promise.resolve().then(() => {
|
|
113
|
+
a = void 0, s && l(y.splice(0));
|
|
114
|
+
}));
|
|
115
|
+
});
|
|
116
|
+
return s = !0, () => {
|
|
117
|
+
s = !1, c();
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function X(e) {
|
|
121
|
+
const l = g.get(e);
|
|
122
|
+
S() && !l && console.warn("Please use proxy object");
|
|
123
|
+
const [i, b, a] = l;
|
|
124
|
+
return a(i, b());
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
D as globalRef,
|
|
128
|
+
Q as proxy,
|
|
129
|
+
X as snapshot,
|
|
130
|
+
I as subscribe
|
|
131
|
+
};
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
import { createAnatomy as M } from "../../anatomy/dist/index.js";
|
|
2
|
+
import { addDomEvent as u, getOverflowAncestors as D, isComposingEvent as E, dataAttr as I, isLeftClick as V } from "../../dom-query/dist/index.js";
|
|
3
|
+
import { trackFocusVisible as T, isFocusVisible as S } from "../../focus-visible/dist/index.js";
|
|
4
|
+
import { getPlacement as k, getPlacementStyles as F } from "../../popper/dist/index.js";
|
|
5
|
+
import { subscribe as A, proxy as G } from "../../store/dist/index.js";
|
|
6
|
+
import { createMachine as K, createGuards as L } from "../../core/dist/index.js";
|
|
7
|
+
import { createProps as $ } from "../../types/dist/index.js";
|
|
8
|
+
var q = M("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "content"), d = q.build(), b = (e) => {
|
|
9
|
+
var t;
|
|
10
|
+
return ((t = e.ids) == null ? void 0 : t.trigger) ?? `tooltip:${e.id}:trigger`;
|
|
11
|
+
}, x = (e) => {
|
|
12
|
+
var t;
|
|
13
|
+
return ((t = e.ids) == null ? void 0 : t.content) ?? `tooltip:${e.id}:content`;
|
|
14
|
+
}, B = (e) => {
|
|
15
|
+
var t;
|
|
16
|
+
return ((t = e.ids) == null ? void 0 : t.arrow) ?? `tooltip:${e.id}:arrow`;
|
|
17
|
+
}, w = (e) => {
|
|
18
|
+
var t;
|
|
19
|
+
return ((t = e.ids) == null ? void 0 : t.positioner) ?? `tooltip:${e.id}:popper`;
|
|
20
|
+
}, v = (e) => e.getById(b(e)), m = (e) => e.getById(w(e)), l = G({ id: null });
|
|
21
|
+
function X(e, t) {
|
|
22
|
+
const { state: o, context: s, send: r, scope: a, prop: n, event: O } = e, f = n("id"), P = !!n("aria-label"), p = o.matches("open", "closing"), h = b(a), y = x(a), c = n("disabled"), g = F({
|
|
23
|
+
...n("positioning"),
|
|
24
|
+
placement: s.get("currentPlacement")
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
open: p,
|
|
28
|
+
setOpen(i) {
|
|
29
|
+
o.matches("open", "closing") !== i && r({ type: i ? "open" : "close" });
|
|
30
|
+
},
|
|
31
|
+
reposition(i = {}) {
|
|
32
|
+
r({ type: "positioning.set", options: i });
|
|
33
|
+
},
|
|
34
|
+
getTriggerProps() {
|
|
35
|
+
return t.button({
|
|
36
|
+
...d.trigger.attrs,
|
|
37
|
+
id: h,
|
|
38
|
+
dir: n("dir"),
|
|
39
|
+
"data-expanded": I(p),
|
|
40
|
+
"data-state": p ? "open" : "closed",
|
|
41
|
+
"aria-describedby": p ? y : void 0,
|
|
42
|
+
onClick(i) {
|
|
43
|
+
i.defaultPrevented || c || n("closeOnClick") && r({ type: "close", src: "trigger.click" });
|
|
44
|
+
},
|
|
45
|
+
onFocus(i) {
|
|
46
|
+
queueMicrotask(() => {
|
|
47
|
+
i.defaultPrevented || c || O.src !== "trigger.pointerdown" && S() && r({ type: "open", src: "trigger.focus" });
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
onBlur(i) {
|
|
51
|
+
i.defaultPrevented || c || f === l.id && r({ type: "close", src: "trigger.blur" });
|
|
52
|
+
},
|
|
53
|
+
onPointerDown(i) {
|
|
54
|
+
i.defaultPrevented || c || V(i) && n("closeOnPointerDown") && f === l.id && r({ type: "close", src: "trigger.pointerdown" });
|
|
55
|
+
},
|
|
56
|
+
onPointerMove(i) {
|
|
57
|
+
i.defaultPrevented || c || i.pointerType !== "touch" && r({ type: "pointer.move" });
|
|
58
|
+
},
|
|
59
|
+
onPointerLeave() {
|
|
60
|
+
c || r({ type: "pointer.leave" });
|
|
61
|
+
},
|
|
62
|
+
onPointerCancel() {
|
|
63
|
+
c || r({ type: "pointer.leave" });
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
getArrowProps() {
|
|
68
|
+
return t.element({
|
|
69
|
+
id: B(a),
|
|
70
|
+
...d.arrow.attrs,
|
|
71
|
+
dir: n("dir"),
|
|
72
|
+
style: g.arrow
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
getArrowTipProps() {
|
|
76
|
+
return t.element({
|
|
77
|
+
...d.arrowTip.attrs,
|
|
78
|
+
dir: n("dir"),
|
|
79
|
+
style: g.arrowTip
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
getPositionerProps() {
|
|
83
|
+
return t.element({
|
|
84
|
+
id: w(a),
|
|
85
|
+
...d.positioner.attrs,
|
|
86
|
+
dir: n("dir"),
|
|
87
|
+
style: g.floating
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
getContentProps() {
|
|
91
|
+
return t.element({
|
|
92
|
+
...d.content.attrs,
|
|
93
|
+
dir: n("dir"),
|
|
94
|
+
hidden: !p,
|
|
95
|
+
"data-state": p ? "open" : "closed",
|
|
96
|
+
role: P ? void 0 : "tooltip",
|
|
97
|
+
id: P ? void 0 : y,
|
|
98
|
+
"data-placement": s.get("currentPlacement"),
|
|
99
|
+
onPointerEnter() {
|
|
100
|
+
r({ type: "content.pointer.move" });
|
|
101
|
+
},
|
|
102
|
+
onPointerLeave() {
|
|
103
|
+
r({ type: "content.pointer.leave" });
|
|
104
|
+
},
|
|
105
|
+
style: {
|
|
106
|
+
pointerEvents: n("interactive") ? "auto" : "none"
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
var { and: N, not: C } = L(), Y = K({
|
|
113
|
+
initialState: ({ prop: e }) => e("open") || e("defaultOpen") ? "open" : "closed",
|
|
114
|
+
props({ props: e }) {
|
|
115
|
+
return {
|
|
116
|
+
id: "x",
|
|
117
|
+
openDelay: 1e3,
|
|
118
|
+
closeDelay: 500,
|
|
119
|
+
closeOnPointerDown: !0,
|
|
120
|
+
closeOnEscape: !0,
|
|
121
|
+
interactive: !1,
|
|
122
|
+
closeOnScroll: !0,
|
|
123
|
+
closeOnClick: !0,
|
|
124
|
+
disabled: !1,
|
|
125
|
+
...e,
|
|
126
|
+
positioning: {
|
|
127
|
+
placement: "bottom",
|
|
128
|
+
...e.positioning
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
effects: ["trackFocusVisible", "trackStore"],
|
|
133
|
+
context: ({ bindable: e }) => ({
|
|
134
|
+
currentPlacement: e(() => ({ defaultValue: void 0 })),
|
|
135
|
+
hasPointerMoveOpened: e(() => ({ defaultValue: !1 }))
|
|
136
|
+
}),
|
|
137
|
+
watch({ track: e, action: t, prop: o }) {
|
|
138
|
+
e([() => o("disabled")], () => {
|
|
139
|
+
t(["closeIfDisabled"]);
|
|
140
|
+
}), e([() => o("open")], () => {
|
|
141
|
+
t(["toggleVisibility"]);
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
states: {
|
|
145
|
+
closed: {
|
|
146
|
+
entry: ["clearGlobalId"],
|
|
147
|
+
on: {
|
|
148
|
+
"controlled.open": {
|
|
149
|
+
target: "open"
|
|
150
|
+
},
|
|
151
|
+
open: [
|
|
152
|
+
{
|
|
153
|
+
guard: "isOpenControlled",
|
|
154
|
+
actions: ["invokeOnOpen"]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
target: "open",
|
|
158
|
+
actions: ["invokeOnOpen"]
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"pointer.leave": {
|
|
162
|
+
actions: ["clearPointerMoveOpened"]
|
|
163
|
+
},
|
|
164
|
+
"pointer.move": [
|
|
165
|
+
{
|
|
166
|
+
guard: N("noVisibleTooltip", C("hasPointerMoveOpened")),
|
|
167
|
+
target: "opening"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
guard: C("hasPointerMoveOpened"),
|
|
171
|
+
target: "open",
|
|
172
|
+
actions: ["setPointerMoveOpened", "invokeOnOpen"]
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
opening: {
|
|
178
|
+
effects: ["trackScroll", "trackPointerlockChange", "waitForOpenDelay"],
|
|
179
|
+
on: {
|
|
180
|
+
"after.openDelay": [
|
|
181
|
+
{
|
|
182
|
+
guard: "isOpenControlled",
|
|
183
|
+
actions: ["setPointerMoveOpened", "invokeOnOpen"]
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
target: "open",
|
|
187
|
+
actions: ["setPointerMoveOpened", "invokeOnOpen"]
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
"controlled.open": {
|
|
191
|
+
target: "open"
|
|
192
|
+
},
|
|
193
|
+
"controlled.close": {
|
|
194
|
+
target: "closed"
|
|
195
|
+
},
|
|
196
|
+
open: [
|
|
197
|
+
{
|
|
198
|
+
guard: "isOpenControlled",
|
|
199
|
+
actions: ["invokeOnOpen"]
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
target: "open",
|
|
203
|
+
actions: ["invokeOnOpen"]
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"pointer.leave": [
|
|
207
|
+
{
|
|
208
|
+
guard: "isOpenControlled",
|
|
209
|
+
// We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
|
|
210
|
+
actions: ["clearPointerMoveOpened", "invokeOnClose", "toggleVisibility"]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
target: "closed",
|
|
214
|
+
actions: ["clearPointerMoveOpened", "invokeOnClose"]
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
close: [
|
|
218
|
+
{
|
|
219
|
+
guard: "isOpenControlled",
|
|
220
|
+
// We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
|
|
221
|
+
actions: ["invokeOnClose", "toggleVisibility"]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
target: "closed",
|
|
225
|
+
actions: ["invokeOnClose"]
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
open: {
|
|
231
|
+
effects: ["trackEscapeKey", "trackScroll", "trackPointerlockChange", "trackPositioning"],
|
|
232
|
+
entry: ["setGlobalId"],
|
|
233
|
+
on: {
|
|
234
|
+
"controlled.close": {
|
|
235
|
+
target: "closed"
|
|
236
|
+
},
|
|
237
|
+
close: [
|
|
238
|
+
{
|
|
239
|
+
guard: "isOpenControlled",
|
|
240
|
+
actions: ["invokeOnClose"]
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
target: "closed",
|
|
244
|
+
actions: ["invokeOnClose"]
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
"pointer.leave": [
|
|
248
|
+
{
|
|
249
|
+
guard: "isVisible",
|
|
250
|
+
target: "closing",
|
|
251
|
+
actions: ["clearPointerMoveOpened"]
|
|
252
|
+
},
|
|
253
|
+
// == group ==
|
|
254
|
+
{
|
|
255
|
+
guard: "isOpenControlled",
|
|
256
|
+
actions: ["clearPointerMoveOpened", "invokeOnClose"]
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
target: "closed",
|
|
260
|
+
actions: ["clearPointerMoveOpened", "invokeOnClose"]
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
"content.pointer.leave": {
|
|
264
|
+
guard: "isInteractive",
|
|
265
|
+
target: "closing"
|
|
266
|
+
},
|
|
267
|
+
"positioning.set": {
|
|
268
|
+
actions: ["reposition"]
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
closing: {
|
|
273
|
+
effects: ["trackPositioning", "waitForCloseDelay"],
|
|
274
|
+
on: {
|
|
275
|
+
"after.closeDelay": [
|
|
276
|
+
{
|
|
277
|
+
guard: "isOpenControlled",
|
|
278
|
+
actions: ["invokeOnClose"]
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
target: "closed",
|
|
282
|
+
actions: ["invokeOnClose"]
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
"controlled.close": {
|
|
286
|
+
target: "closed"
|
|
287
|
+
},
|
|
288
|
+
"controlled.open": {
|
|
289
|
+
target: "open"
|
|
290
|
+
},
|
|
291
|
+
close: [
|
|
292
|
+
{
|
|
293
|
+
guard: "isOpenControlled",
|
|
294
|
+
actions: ["invokeOnClose"]
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
target: "closed",
|
|
298
|
+
actions: ["invokeOnClose"]
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"pointer.move": [
|
|
302
|
+
{
|
|
303
|
+
guard: "isOpenControlled",
|
|
304
|
+
// We trigger toggleVisibility manually since the `ctx.open` has not changed yet (at this point)
|
|
305
|
+
actions: ["setPointerMoveOpened", "invokeOnOpen", "toggleVisibility"]
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
target: "open",
|
|
309
|
+
actions: ["setPointerMoveOpened", "invokeOnOpen"]
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"content.pointer.move": {
|
|
313
|
+
guard: "isInteractive",
|
|
314
|
+
target: "open"
|
|
315
|
+
},
|
|
316
|
+
"positioning.set": {
|
|
317
|
+
actions: ["reposition"]
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
implementations: {
|
|
323
|
+
guards: {
|
|
324
|
+
noVisibleTooltip: () => l.id === null,
|
|
325
|
+
isVisible: ({ prop: e }) => e("id") === l.id,
|
|
326
|
+
isInteractive: ({ prop: e }) => !!e("interactive"),
|
|
327
|
+
hasPointerMoveOpened: ({ context: e }) => e.get("hasPointerMoveOpened"),
|
|
328
|
+
isOpenControlled: ({ prop: e }) => e("open") !== void 0
|
|
329
|
+
},
|
|
330
|
+
actions: {
|
|
331
|
+
setGlobalId: ({ prop: e }) => {
|
|
332
|
+
l.id = e("id");
|
|
333
|
+
},
|
|
334
|
+
clearGlobalId: ({ prop: e }) => {
|
|
335
|
+
e("id") === l.id && (l.id = null);
|
|
336
|
+
},
|
|
337
|
+
invokeOnOpen: ({ prop: e }) => {
|
|
338
|
+
var t;
|
|
339
|
+
(t = e("onOpenChange")) == null || t({ open: !0 });
|
|
340
|
+
},
|
|
341
|
+
invokeOnClose: ({ prop: e }) => {
|
|
342
|
+
var t;
|
|
343
|
+
(t = e("onOpenChange")) == null || t({ open: !1 });
|
|
344
|
+
},
|
|
345
|
+
closeIfDisabled: ({ prop: e, send: t }) => {
|
|
346
|
+
e("disabled") && t({ type: "close", src: "disabled.change" });
|
|
347
|
+
},
|
|
348
|
+
reposition: ({ context: e, event: t, prop: o, scope: s }) => {
|
|
349
|
+
if (t.type !== "positioning.set") return;
|
|
350
|
+
const r = () => m(s);
|
|
351
|
+
return k(v(s), r, {
|
|
352
|
+
...o("positioning"),
|
|
353
|
+
...t.options,
|
|
354
|
+
defer: !0,
|
|
355
|
+
listeners: !1,
|
|
356
|
+
onComplete(a) {
|
|
357
|
+
e.set("currentPlacement", a.placement);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
},
|
|
361
|
+
toggleVisibility: ({ prop: e, event: t, send: o }) => {
|
|
362
|
+
queueMicrotask(() => {
|
|
363
|
+
o({
|
|
364
|
+
type: e("open") ? "controlled.open" : "controlled.close",
|
|
365
|
+
previousEvent: t
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
},
|
|
369
|
+
setPointerMoveOpened: ({ context: e }) => {
|
|
370
|
+
e.set("hasPointerMoveOpened", !0);
|
|
371
|
+
},
|
|
372
|
+
clearPointerMoveOpened: ({ context: e }) => {
|
|
373
|
+
e.set("hasPointerMoveOpened", !1);
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
effects: {
|
|
377
|
+
trackFocusVisible: ({ scope: e }) => {
|
|
378
|
+
var t;
|
|
379
|
+
return T({ root: (t = e.getRootNode) == null ? void 0 : t.call(e) });
|
|
380
|
+
},
|
|
381
|
+
trackPositioning: ({ context: e, prop: t, scope: o }) => {
|
|
382
|
+
e.get("currentPlacement") || e.set("currentPlacement", t("positioning").placement);
|
|
383
|
+
const s = () => m(o);
|
|
384
|
+
return k(v(o), s, {
|
|
385
|
+
...t("positioning"),
|
|
386
|
+
defer: !0,
|
|
387
|
+
onComplete(r) {
|
|
388
|
+
e.set("currentPlacement", r.placement);
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
trackPointerlockChange: ({ send: e, scope: t }) => {
|
|
393
|
+
const o = t.getDoc();
|
|
394
|
+
return u(o, "pointerlockchange", () => e({ type: "close", src: "pointerlock:change" }), !1);
|
|
395
|
+
},
|
|
396
|
+
trackScroll: ({ send: e, prop: t, scope: o }) => {
|
|
397
|
+
if (!t("closeOnScroll")) return;
|
|
398
|
+
const s = v(o);
|
|
399
|
+
if (!s) return;
|
|
400
|
+
const a = D(s).map((n) => u(n, "scroll", () => {
|
|
401
|
+
e({ type: "close", src: "scroll" });
|
|
402
|
+
}, {
|
|
403
|
+
passive: !0,
|
|
404
|
+
capture: !0
|
|
405
|
+
}));
|
|
406
|
+
return () => {
|
|
407
|
+
a.forEach((n) => n == null ? void 0 : n());
|
|
408
|
+
};
|
|
409
|
+
},
|
|
410
|
+
trackStore: ({ prop: e, send: t }) => {
|
|
411
|
+
let o;
|
|
412
|
+
return queueMicrotask(() => {
|
|
413
|
+
o = A(l, () => {
|
|
414
|
+
l.id !== e("id") && t({ type: "close", src: "id.change" });
|
|
415
|
+
});
|
|
416
|
+
}), () => o == null ? void 0 : o();
|
|
417
|
+
},
|
|
418
|
+
trackEscapeKey: ({ send: e, prop: t }) => t("closeOnEscape") ? u(document, "keydown", (s) => {
|
|
419
|
+
E(s) || s.key === "Escape" && (s.stopPropagation(), e({ type: "close", src: "keydown.escape" }));
|
|
420
|
+
}, !0) : void 0,
|
|
421
|
+
waitForOpenDelay: ({ send: e, prop: t }) => {
|
|
422
|
+
const o = setTimeout(() => {
|
|
423
|
+
e({ type: "after.openDelay" });
|
|
424
|
+
}, t("openDelay"));
|
|
425
|
+
return () => clearTimeout(o);
|
|
426
|
+
},
|
|
427
|
+
waitForCloseDelay: ({ send: e, prop: t }) => {
|
|
428
|
+
const o = setTimeout(() => {
|
|
429
|
+
e({ type: "after.closeDelay" });
|
|
430
|
+
}, t("closeDelay"));
|
|
431
|
+
return () => clearTimeout(o);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
$()([
|
|
437
|
+
"aria-label",
|
|
438
|
+
"closeDelay",
|
|
439
|
+
"closeOnEscape",
|
|
440
|
+
"closeOnPointerDown",
|
|
441
|
+
"closeOnScroll",
|
|
442
|
+
"closeOnClick",
|
|
443
|
+
"dir",
|
|
444
|
+
"disabled",
|
|
445
|
+
"getRootNode",
|
|
446
|
+
"id",
|
|
447
|
+
"ids",
|
|
448
|
+
"interactive",
|
|
449
|
+
"onOpenChange",
|
|
450
|
+
"defaultOpen",
|
|
451
|
+
"open",
|
|
452
|
+
"openDelay",
|
|
453
|
+
"positioning"
|
|
454
|
+
]);
|
|
455
|
+
export {
|
|
456
|
+
q as anatomy,
|
|
457
|
+
X as connect,
|
|
458
|
+
Y as machine
|
|
459
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const c = Symbol(), r = Object.getPrototypeOf, e = /* @__PURE__ */ new WeakMap(), n = (t) => t && (e.has(t) ? e.get(t) : r(t) === Object.prototype || r(t) === Array.prototype), s = (t) => n(t) && t[c] || null, a = (t, o = !0) => {
|
|
2
|
+
e.set(t, o);
|
|
3
|
+
};
|
|
4
|
+
export {
|
|
5
|
+
s as getUntracked,
|
|
6
|
+
a as markToTrack
|
|
7
|
+
};
|