@radix-ui/react-tooltip 0.0.0-20250116175529
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/README.md +13 -0
- package/dist/index.d.mts +101 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +533 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +501 -0
- package/dist/index.mjs.map +7 -0
- package/package.json +65 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// packages/react/tooltip/src/index.ts
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
Arrow: () => Arrow2,
|
|
35
|
+
Content: () => Content2,
|
|
36
|
+
Portal: () => Portal,
|
|
37
|
+
Provider: () => Provider,
|
|
38
|
+
Root: () => Root3,
|
|
39
|
+
Tooltip: () => Tooltip,
|
|
40
|
+
TooltipArrow: () => TooltipArrow,
|
|
41
|
+
TooltipContent: () => TooltipContent,
|
|
42
|
+
TooltipPortal: () => TooltipPortal,
|
|
43
|
+
TooltipProvider: () => TooltipProvider,
|
|
44
|
+
TooltipTrigger: () => TooltipTrigger,
|
|
45
|
+
Trigger: () => Trigger,
|
|
46
|
+
createTooltipScope: () => createTooltipScope
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(src_exports);
|
|
49
|
+
|
|
50
|
+
// packages/react/tooltip/src/Tooltip.tsx
|
|
51
|
+
var React = __toESM(require("react"));
|
|
52
|
+
var import_primitive = require("@radix-ui/primitive");
|
|
53
|
+
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
54
|
+
var import_react_context = require("@radix-ui/react-context");
|
|
55
|
+
var import_react_dismissable_layer = require("@radix-ui/react-dismissable-layer");
|
|
56
|
+
var import_react_id = require("@radix-ui/react-id");
|
|
57
|
+
var PopperPrimitive = __toESM(require("@radix-ui/react-popper"));
|
|
58
|
+
var import_react_popper = require("@radix-ui/react-popper");
|
|
59
|
+
var import_react_portal = require("@radix-ui/react-portal");
|
|
60
|
+
var import_react_presence = require("@radix-ui/react-presence");
|
|
61
|
+
var import_react_primitive = require("@radix-ui/react-primitive");
|
|
62
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
63
|
+
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
|
|
64
|
+
var VisuallyHiddenPrimitive = __toESM(require("@radix-ui/react-visually-hidden"));
|
|
65
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
66
|
+
var [createTooltipContext, createTooltipScope] = (0, import_react_context.createContextScope)("Tooltip", [
|
|
67
|
+
import_react_popper.createPopperScope
|
|
68
|
+
]);
|
|
69
|
+
var usePopperScope = (0, import_react_popper.createPopperScope)();
|
|
70
|
+
var PROVIDER_NAME = "TooltipProvider";
|
|
71
|
+
var DEFAULT_DELAY_DURATION = 700;
|
|
72
|
+
var TOOLTIP_OPEN = "tooltip.open";
|
|
73
|
+
var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
|
|
74
|
+
var TooltipProvider = (props) => {
|
|
75
|
+
const {
|
|
76
|
+
__scopeTooltip,
|
|
77
|
+
delayDuration = DEFAULT_DELAY_DURATION,
|
|
78
|
+
skipDelayDuration = 300,
|
|
79
|
+
disableHoverableContent = false,
|
|
80
|
+
children
|
|
81
|
+
} = props;
|
|
82
|
+
const [isOpenDelayed, setIsOpenDelayed] = React.useState(true);
|
|
83
|
+
const isPointerInTransitRef = React.useRef(false);
|
|
84
|
+
const skipDelayTimerRef = React.useRef(0);
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
const skipDelayTimer = skipDelayTimerRef.current;
|
|
87
|
+
return () => window.clearTimeout(skipDelayTimer);
|
|
88
|
+
}, []);
|
|
89
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
+
TooltipProviderContextProvider,
|
|
91
|
+
{
|
|
92
|
+
scope: __scopeTooltip,
|
|
93
|
+
isOpenDelayed,
|
|
94
|
+
delayDuration,
|
|
95
|
+
onOpen: React.useCallback(() => {
|
|
96
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
97
|
+
setIsOpenDelayed(false);
|
|
98
|
+
}, []),
|
|
99
|
+
onClose: React.useCallback(() => {
|
|
100
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
101
|
+
skipDelayTimerRef.current = window.setTimeout(
|
|
102
|
+
() => setIsOpenDelayed(true),
|
|
103
|
+
skipDelayDuration
|
|
104
|
+
);
|
|
105
|
+
}, [skipDelayDuration]),
|
|
106
|
+
isPointerInTransitRef,
|
|
107
|
+
onPointerInTransitChange: React.useCallback((inTransit) => {
|
|
108
|
+
isPointerInTransitRef.current = inTransit;
|
|
109
|
+
}, []),
|
|
110
|
+
disableHoverableContent,
|
|
111
|
+
children
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
TooltipProvider.displayName = PROVIDER_NAME;
|
|
116
|
+
var TOOLTIP_NAME = "Tooltip";
|
|
117
|
+
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
|
|
118
|
+
var Tooltip = (props) => {
|
|
119
|
+
const {
|
|
120
|
+
__scopeTooltip,
|
|
121
|
+
children,
|
|
122
|
+
open: openProp,
|
|
123
|
+
defaultOpen = false,
|
|
124
|
+
onOpenChange,
|
|
125
|
+
disableHoverableContent: disableHoverableContentProp,
|
|
126
|
+
delayDuration: delayDurationProp
|
|
127
|
+
} = props;
|
|
128
|
+
const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
|
|
129
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
130
|
+
const [trigger, setTrigger] = React.useState(null);
|
|
131
|
+
const contentId = (0, import_react_id.useId)();
|
|
132
|
+
const openTimerRef = React.useRef(0);
|
|
133
|
+
const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
|
|
134
|
+
const delayDuration = delayDurationProp ?? providerContext.delayDuration;
|
|
135
|
+
const wasOpenDelayedRef = React.useRef(false);
|
|
136
|
+
const [open = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
|
137
|
+
prop: openProp,
|
|
138
|
+
defaultProp: defaultOpen,
|
|
139
|
+
onChange: (open2) => {
|
|
140
|
+
if (open2) {
|
|
141
|
+
providerContext.onOpen();
|
|
142
|
+
document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
|
|
143
|
+
} else {
|
|
144
|
+
providerContext.onClose();
|
|
145
|
+
}
|
|
146
|
+
onOpenChange?.(open2);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
const stateAttribute = React.useMemo(() => {
|
|
150
|
+
return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
|
|
151
|
+
}, [open]);
|
|
152
|
+
const handleOpen = React.useCallback(() => {
|
|
153
|
+
window.clearTimeout(openTimerRef.current);
|
|
154
|
+
openTimerRef.current = 0;
|
|
155
|
+
wasOpenDelayedRef.current = false;
|
|
156
|
+
setOpen(true);
|
|
157
|
+
}, [setOpen]);
|
|
158
|
+
const handleClose = React.useCallback(() => {
|
|
159
|
+
window.clearTimeout(openTimerRef.current);
|
|
160
|
+
openTimerRef.current = 0;
|
|
161
|
+
setOpen(false);
|
|
162
|
+
}, [setOpen]);
|
|
163
|
+
const handleDelayedOpen = React.useCallback(() => {
|
|
164
|
+
window.clearTimeout(openTimerRef.current);
|
|
165
|
+
openTimerRef.current = window.setTimeout(() => {
|
|
166
|
+
wasOpenDelayedRef.current = true;
|
|
167
|
+
setOpen(true);
|
|
168
|
+
openTimerRef.current = 0;
|
|
169
|
+
}, delayDuration);
|
|
170
|
+
}, [delayDuration, setOpen]);
|
|
171
|
+
React.useEffect(() => {
|
|
172
|
+
return () => {
|
|
173
|
+
if (openTimerRef.current) {
|
|
174
|
+
window.clearTimeout(openTimerRef.current);
|
|
175
|
+
openTimerRef.current = 0;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}, []);
|
|
179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
180
|
+
TooltipContextProvider,
|
|
181
|
+
{
|
|
182
|
+
scope: __scopeTooltip,
|
|
183
|
+
contentId,
|
|
184
|
+
open,
|
|
185
|
+
stateAttribute,
|
|
186
|
+
trigger,
|
|
187
|
+
onTriggerChange: setTrigger,
|
|
188
|
+
onTriggerEnter: React.useCallback(() => {
|
|
189
|
+
if (providerContext.isOpenDelayed) handleDelayedOpen();
|
|
190
|
+
else handleOpen();
|
|
191
|
+
}, [providerContext.isOpenDelayed, handleDelayedOpen, handleOpen]),
|
|
192
|
+
onTriggerLeave: React.useCallback(() => {
|
|
193
|
+
if (disableHoverableContent) {
|
|
194
|
+
handleClose();
|
|
195
|
+
} else {
|
|
196
|
+
window.clearTimeout(openTimerRef.current);
|
|
197
|
+
openTimerRef.current = 0;
|
|
198
|
+
}
|
|
199
|
+
}, [handleClose, disableHoverableContent]),
|
|
200
|
+
onOpen: handleOpen,
|
|
201
|
+
onClose: handleClose,
|
|
202
|
+
disableHoverableContent,
|
|
203
|
+
children
|
|
204
|
+
}
|
|
205
|
+
) });
|
|
206
|
+
};
|
|
207
|
+
Tooltip.displayName = TOOLTIP_NAME;
|
|
208
|
+
var TRIGGER_NAME = "TooltipTrigger";
|
|
209
|
+
var TooltipTrigger = React.forwardRef(
|
|
210
|
+
(props, forwardedRef) => {
|
|
211
|
+
const { __scopeTooltip, ...triggerProps } = props;
|
|
212
|
+
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
213
|
+
const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
|
|
214
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
215
|
+
const ref = React.useRef(null);
|
|
216
|
+
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref, context.onTriggerChange);
|
|
217
|
+
const isPointerDownRef = React.useRef(false);
|
|
218
|
+
const hasPointerMoveOpenedRef = React.useRef(false);
|
|
219
|
+
const handlePointerUp = React.useCallback(() => isPointerDownRef.current = false, []);
|
|
220
|
+
React.useEffect(() => {
|
|
221
|
+
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
222
|
+
}, [handlePointerUp]);
|
|
223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
224
|
+
import_react_primitive.Primitive.button,
|
|
225
|
+
{
|
|
226
|
+
"aria-describedby": context.open ? context.contentId : void 0,
|
|
227
|
+
"data-state": context.stateAttribute,
|
|
228
|
+
...triggerProps,
|
|
229
|
+
ref: composedRefs,
|
|
230
|
+
onPointerMove: (0, import_primitive.composeEventHandlers)(props.onPointerMove, (event) => {
|
|
231
|
+
if (event.pointerType === "touch") return;
|
|
232
|
+
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
|
|
233
|
+
context.onTriggerEnter();
|
|
234
|
+
hasPointerMoveOpenedRef.current = true;
|
|
235
|
+
}
|
|
236
|
+
}),
|
|
237
|
+
onPointerLeave: (0, import_primitive.composeEventHandlers)(props.onPointerLeave, () => {
|
|
238
|
+
context.onTriggerLeave();
|
|
239
|
+
hasPointerMoveOpenedRef.current = false;
|
|
240
|
+
}),
|
|
241
|
+
onPointerDown: (0, import_primitive.composeEventHandlers)(props.onPointerDown, () => {
|
|
242
|
+
isPointerDownRef.current = true;
|
|
243
|
+
document.addEventListener("pointerup", handlePointerUp, { once: true });
|
|
244
|
+
}),
|
|
245
|
+
onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, () => {
|
|
246
|
+
if (!isPointerDownRef.current) context.onOpen();
|
|
247
|
+
}),
|
|
248
|
+
onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, context.onClose),
|
|
249
|
+
onClick: (0, import_primitive.composeEventHandlers)(props.onClick, context.onClose)
|
|
250
|
+
}
|
|
251
|
+
) });
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
TooltipTrigger.displayName = TRIGGER_NAME;
|
|
255
|
+
var PORTAL_NAME = "TooltipPortal";
|
|
256
|
+
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
257
|
+
forceMount: void 0
|
|
258
|
+
});
|
|
259
|
+
var TooltipPortal = (props) => {
|
|
260
|
+
const { __scopeTooltip, forceMount, children, container } = props;
|
|
261
|
+
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
|
|
262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_portal.Portal, { asChild: true, container, children }) }) });
|
|
263
|
+
};
|
|
264
|
+
TooltipPortal.displayName = PORTAL_NAME;
|
|
265
|
+
var CONTENT_NAME = "TooltipContent";
|
|
266
|
+
var TooltipContent = React.forwardRef(
|
|
267
|
+
(props, forwardedRef) => {
|
|
268
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
269
|
+
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
270
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
var TooltipContentHoverable = React.forwardRef((props, forwardedRef) => {
|
|
275
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
276
|
+
const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
|
|
277
|
+
const ref = React.useRef(null);
|
|
278
|
+
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
279
|
+
const [pointerGraceArea, setPointerGraceArea] = React.useState(null);
|
|
280
|
+
const { trigger, onClose } = context;
|
|
281
|
+
const content = ref.current;
|
|
282
|
+
const { onPointerInTransitChange } = providerContext;
|
|
283
|
+
const handleRemoveGraceArea = React.useCallback(() => {
|
|
284
|
+
setPointerGraceArea(null);
|
|
285
|
+
onPointerInTransitChange(false);
|
|
286
|
+
}, [onPointerInTransitChange]);
|
|
287
|
+
const handleCreateGraceArea = React.useCallback(
|
|
288
|
+
(event, hoverTarget) => {
|
|
289
|
+
const currentTarget = event.currentTarget;
|
|
290
|
+
const exitPoint = { x: event.clientX, y: event.clientY };
|
|
291
|
+
const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
|
|
292
|
+
const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
|
|
293
|
+
const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
|
|
294
|
+
const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
|
|
295
|
+
setPointerGraceArea(graceArea);
|
|
296
|
+
onPointerInTransitChange(true);
|
|
297
|
+
},
|
|
298
|
+
[onPointerInTransitChange]
|
|
299
|
+
);
|
|
300
|
+
React.useEffect(() => {
|
|
301
|
+
return () => handleRemoveGraceArea();
|
|
302
|
+
}, [handleRemoveGraceArea]);
|
|
303
|
+
React.useEffect(() => {
|
|
304
|
+
if (trigger && content) {
|
|
305
|
+
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
306
|
+
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
307
|
+
trigger.addEventListener("pointerleave", handleTriggerLeave);
|
|
308
|
+
content.addEventListener("pointerleave", handleContentLeave);
|
|
309
|
+
return () => {
|
|
310
|
+
trigger.removeEventListener("pointerleave", handleTriggerLeave);
|
|
311
|
+
content.removeEventListener("pointerleave", handleContentLeave);
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
|
|
315
|
+
React.useEffect(() => {
|
|
316
|
+
if (pointerGraceArea) {
|
|
317
|
+
const handleTrackPointerGrace = (event) => {
|
|
318
|
+
const target = event.target;
|
|
319
|
+
const pointerPosition = { x: event.clientX, y: event.clientY };
|
|
320
|
+
const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
|
|
321
|
+
const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
|
|
322
|
+
if (hasEnteredTarget) {
|
|
323
|
+
handleRemoveGraceArea();
|
|
324
|
+
} else if (isPointerOutsideGraceArea) {
|
|
325
|
+
handleRemoveGraceArea();
|
|
326
|
+
onClose();
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
document.addEventListener("pointermove", handleTrackPointerGrace);
|
|
330
|
+
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
331
|
+
}
|
|
332
|
+
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
334
|
+
});
|
|
335
|
+
var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
336
|
+
var TooltipContentImpl = React.forwardRef(
|
|
337
|
+
(props, forwardedRef) => {
|
|
338
|
+
const {
|
|
339
|
+
__scopeTooltip,
|
|
340
|
+
children,
|
|
341
|
+
"aria-label": ariaLabel,
|
|
342
|
+
onEscapeKeyDown,
|
|
343
|
+
onPointerDownOutside,
|
|
344
|
+
...contentProps
|
|
345
|
+
} = props;
|
|
346
|
+
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
347
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
348
|
+
const { onClose } = context;
|
|
349
|
+
React.useEffect(() => {
|
|
350
|
+
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
351
|
+
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
352
|
+
}, [onClose]);
|
|
353
|
+
React.useEffect(() => {
|
|
354
|
+
if (context.trigger) {
|
|
355
|
+
const handleScroll = (event) => {
|
|
356
|
+
const target = event.target;
|
|
357
|
+
if (target?.contains(context.trigger)) onClose();
|
|
358
|
+
};
|
|
359
|
+
window.addEventListener("scroll", handleScroll, { capture: true });
|
|
360
|
+
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
361
|
+
}
|
|
362
|
+
}, [context.trigger, onClose]);
|
|
363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
364
|
+
import_react_dismissable_layer.DismissableLayer,
|
|
365
|
+
{
|
|
366
|
+
asChild: true,
|
|
367
|
+
disableOutsidePointerEvents: false,
|
|
368
|
+
onEscapeKeyDown,
|
|
369
|
+
onPointerDownOutside,
|
|
370
|
+
onFocusOutside: (event) => event.preventDefault(),
|
|
371
|
+
onDismiss: onClose,
|
|
372
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
373
|
+
PopperPrimitive.Content,
|
|
374
|
+
{
|
|
375
|
+
"data-state": context.stateAttribute,
|
|
376
|
+
...popperScope,
|
|
377
|
+
...contentProps,
|
|
378
|
+
ref: forwardedRef,
|
|
379
|
+
style: {
|
|
380
|
+
...contentProps.style,
|
|
381
|
+
// re-namespace exposed content custom properties
|
|
382
|
+
...{
|
|
383
|
+
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
384
|
+
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
385
|
+
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
386
|
+
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
387
|
+
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
children: [
|
|
391
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children }),
|
|
392
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VisuallyHiddenPrimitive.Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
);
|
|
400
|
+
TooltipContent.displayName = CONTENT_NAME;
|
|
401
|
+
var ARROW_NAME = "TooltipArrow";
|
|
402
|
+
var TooltipArrow = React.forwardRef(
|
|
403
|
+
(props, forwardedRef) => {
|
|
404
|
+
const { __scopeTooltip, ...arrowProps } = props;
|
|
405
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
406
|
+
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
|
|
407
|
+
ARROW_NAME,
|
|
408
|
+
__scopeTooltip
|
|
409
|
+
);
|
|
410
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
TooltipArrow.displayName = ARROW_NAME;
|
|
414
|
+
function getExitSideFromRect(point, rect) {
|
|
415
|
+
const top = Math.abs(rect.top - point.y);
|
|
416
|
+
const bottom = Math.abs(rect.bottom - point.y);
|
|
417
|
+
const right = Math.abs(rect.right - point.x);
|
|
418
|
+
const left = Math.abs(rect.left - point.x);
|
|
419
|
+
switch (Math.min(top, bottom, right, left)) {
|
|
420
|
+
case left:
|
|
421
|
+
return "left";
|
|
422
|
+
case right:
|
|
423
|
+
return "right";
|
|
424
|
+
case top:
|
|
425
|
+
return "top";
|
|
426
|
+
case bottom:
|
|
427
|
+
return "bottom";
|
|
428
|
+
default:
|
|
429
|
+
throw new Error("unreachable");
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
|
|
433
|
+
const paddedExitPoints = [];
|
|
434
|
+
switch (exitSide) {
|
|
435
|
+
case "top":
|
|
436
|
+
paddedExitPoints.push(
|
|
437
|
+
{ x: exitPoint.x - padding, y: exitPoint.y + padding },
|
|
438
|
+
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
439
|
+
);
|
|
440
|
+
break;
|
|
441
|
+
case "bottom":
|
|
442
|
+
paddedExitPoints.push(
|
|
443
|
+
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
444
|
+
{ x: exitPoint.x + padding, y: exitPoint.y - padding }
|
|
445
|
+
);
|
|
446
|
+
break;
|
|
447
|
+
case "left":
|
|
448
|
+
paddedExitPoints.push(
|
|
449
|
+
{ x: exitPoint.x + padding, y: exitPoint.y - padding },
|
|
450
|
+
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
451
|
+
);
|
|
452
|
+
break;
|
|
453
|
+
case "right":
|
|
454
|
+
paddedExitPoints.push(
|
|
455
|
+
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
456
|
+
{ x: exitPoint.x - padding, y: exitPoint.y + padding }
|
|
457
|
+
);
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
return paddedExitPoints;
|
|
461
|
+
}
|
|
462
|
+
function getPointsFromRect(rect) {
|
|
463
|
+
const { top, right, bottom, left } = rect;
|
|
464
|
+
return [
|
|
465
|
+
{ x: left, y: top },
|
|
466
|
+
{ x: right, y: top },
|
|
467
|
+
{ x: right, y: bottom },
|
|
468
|
+
{ x: left, y: bottom }
|
|
469
|
+
];
|
|
470
|
+
}
|
|
471
|
+
function isPointInPolygon(point, polygon) {
|
|
472
|
+
const { x, y } = point;
|
|
473
|
+
let inside = false;
|
|
474
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
475
|
+
const xi = polygon[i].x;
|
|
476
|
+
const yi = polygon[i].y;
|
|
477
|
+
const xj = polygon[j].x;
|
|
478
|
+
const yj = polygon[j].y;
|
|
479
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
480
|
+
if (intersect) inside = !inside;
|
|
481
|
+
}
|
|
482
|
+
return inside;
|
|
483
|
+
}
|
|
484
|
+
function getHull(points) {
|
|
485
|
+
const newPoints = points.slice();
|
|
486
|
+
newPoints.sort((a, b) => {
|
|
487
|
+
if (a.x < b.x) return -1;
|
|
488
|
+
else if (a.x > b.x) return 1;
|
|
489
|
+
else if (a.y < b.y) return -1;
|
|
490
|
+
else if (a.y > b.y) return 1;
|
|
491
|
+
else return 0;
|
|
492
|
+
});
|
|
493
|
+
return getHullPresorted(newPoints);
|
|
494
|
+
}
|
|
495
|
+
function getHullPresorted(points) {
|
|
496
|
+
if (points.length <= 1) return points.slice();
|
|
497
|
+
const upperHull = [];
|
|
498
|
+
for (let i = 0; i < points.length; i++) {
|
|
499
|
+
const p = points[i];
|
|
500
|
+
while (upperHull.length >= 2) {
|
|
501
|
+
const q = upperHull[upperHull.length - 1];
|
|
502
|
+
const r = upperHull[upperHull.length - 2];
|
|
503
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
|
|
504
|
+
else break;
|
|
505
|
+
}
|
|
506
|
+
upperHull.push(p);
|
|
507
|
+
}
|
|
508
|
+
upperHull.pop();
|
|
509
|
+
const lowerHull = [];
|
|
510
|
+
for (let i = points.length - 1; i >= 0; i--) {
|
|
511
|
+
const p = points[i];
|
|
512
|
+
while (lowerHull.length >= 2) {
|
|
513
|
+
const q = lowerHull[lowerHull.length - 1];
|
|
514
|
+
const r = lowerHull[lowerHull.length - 2];
|
|
515
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
|
|
516
|
+
else break;
|
|
517
|
+
}
|
|
518
|
+
lowerHull.push(p);
|
|
519
|
+
}
|
|
520
|
+
lowerHull.pop();
|
|
521
|
+
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
|
|
522
|
+
return upperHull;
|
|
523
|
+
} else {
|
|
524
|
+
return upperHull.concat(lowerHull);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
var Provider = TooltipProvider;
|
|
528
|
+
var Root3 = Tooltip;
|
|
529
|
+
var Trigger = TooltipTrigger;
|
|
530
|
+
var Portal = TooltipPortal;
|
|
531
|
+
var Content2 = TooltipContent;
|
|
532
|
+
var Arrow2 = TooltipArrow;
|
|
533
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts", "../src/Tooltip.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\nexport {\n createTooltipScope,\n //\n TooltipProvider,\n Tooltip,\n TooltipTrigger,\n TooltipPortal,\n TooltipContent,\n TooltipArrow,\n //\n Provider,\n Root,\n Trigger,\n Portal,\n Content,\n Arrow,\n} from './Tooltip';\nexport type {\n TooltipProviderProps,\n TooltipProps,\n TooltipTriggerProps,\n TooltipPortalProps,\n TooltipContentProps,\n TooltipArrowProps,\n} from './Tooltip';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slottable } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as VisuallyHiddenPrimitive from '@radix-ui/react-visually-hidden';\n\nimport type { Scope } from '@radix-ui/react-context';\n\ntype ScopedProps<P = {}> = P & { __scopeTooltip?: Scope };\nconst [createTooltipContext, createTooltipScope] = createContextScope('Tooltip', [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\n/* -------------------------------------------------------------------------------------------------\n * TooltipProvider\n * -----------------------------------------------------------------------------------------------*/\n\nconst PROVIDER_NAME = 'TooltipProvider';\nconst DEFAULT_DELAY_DURATION = 700;\nconst TOOLTIP_OPEN = 'tooltip.open';\n\ntype TooltipProviderContextValue = {\n isOpenDelayed: boolean;\n delayDuration: number;\n onOpen(): void;\n onClose(): void;\n onPointerInTransitChange(inTransit: boolean): void;\n isPointerInTransitRef: React.MutableRefObject<boolean>;\n disableHoverableContent: boolean;\n};\n\nconst [TooltipProviderContextProvider, useTooltipProviderContext] =\n createTooltipContext<TooltipProviderContextValue>(PROVIDER_NAME);\n\ninterface TooltipProviderProps {\n children: React.ReactNode;\n /**\n * The duration from when the pointer enters the trigger until the tooltip gets opened.\n * @defaultValue 700\n */\n delayDuration?: number;\n /**\n * How much time a user has to enter another trigger without incurring a delay again.\n * @defaultValue 300\n */\n skipDelayDuration?: number;\n /**\n * When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger.\n * @defaultValue false\n */\n disableHoverableContent?: boolean;\n}\n\nconst TooltipProvider: React.FC<TooltipProviderProps> = (\n props: ScopedProps<TooltipProviderProps>\n) => {\n const {\n __scopeTooltip,\n delayDuration = DEFAULT_DELAY_DURATION,\n skipDelayDuration = 300,\n disableHoverableContent = false,\n children,\n } = props;\n const [isOpenDelayed, setIsOpenDelayed] = React.useState(true);\n const isPointerInTransitRef = React.useRef(false);\n const skipDelayTimerRef = React.useRef(0);\n\n React.useEffect(() => {\n const skipDelayTimer = skipDelayTimerRef.current;\n return () => window.clearTimeout(skipDelayTimer);\n }, []);\n\n return (\n <TooltipProviderContextProvider\n scope={__scopeTooltip}\n isOpenDelayed={isOpenDelayed}\n delayDuration={delayDuration}\n onOpen={React.useCallback(() => {\n window.clearTimeout(skipDelayTimerRef.current);\n setIsOpenDelayed(false);\n }, [])}\n onClose={React.useCallback(() => {\n window.clearTimeout(skipDelayTimerRef.current);\n skipDelayTimerRef.current = window.setTimeout(\n () => setIsOpenDelayed(true),\n skipDelayDuration\n );\n }, [skipDelayDuration])}\n isPointerInTransitRef={isPointerInTransitRef}\n onPointerInTransitChange={React.useCallback((inTransit: boolean) => {\n isPointerInTransitRef.current = inTransit;\n }, [])}\n disableHoverableContent={disableHoverableContent}\n >\n {children}\n </TooltipProviderContextProvider>\n );\n};\n\nTooltipProvider.displayName = PROVIDER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Tooltip\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOOLTIP_NAME = 'Tooltip';\n\ntype TooltipContextValue = {\n contentId: string;\n open: boolean;\n stateAttribute: 'closed' | 'delayed-open' | 'instant-open';\n trigger: TooltipTriggerElement | null;\n onTriggerChange(trigger: TooltipTriggerElement | null): void;\n onTriggerEnter(): void;\n onTriggerLeave(): void;\n onOpen(): void;\n onClose(): void;\n disableHoverableContent: boolean;\n};\n\nconst [TooltipContextProvider, useTooltipContext] =\n createTooltipContext<TooltipContextValue>(TOOLTIP_NAME);\n\ninterface TooltipProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * The duration from when the pointer enters the trigger until the tooltip gets opened. This will\n * override the prop with the same name passed to Provider.\n * @defaultValue 700\n */\n delayDuration?: number;\n /**\n * When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger.\n * @defaultValue false\n */\n disableHoverableContent?: boolean;\n}\n\nconst Tooltip: React.FC<TooltipProps> = (props: ScopedProps<TooltipProps>) => {\n const {\n __scopeTooltip,\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n disableHoverableContent: disableHoverableContentProp,\n delayDuration: delayDurationProp,\n } = props;\n const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);\n const popperScope = usePopperScope(__scopeTooltip);\n const [trigger, setTrigger] = React.useState<HTMLButtonElement | null>(null);\n const contentId = useId();\n const openTimerRef = React.useRef(0);\n const disableHoverableContent =\n disableHoverableContentProp ?? providerContext.disableHoverableContent;\n const delayDuration = delayDurationProp ?? providerContext.delayDuration;\n const wasOpenDelayedRef = React.useRef(false);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: (open) => {\n if (open) {\n providerContext.onOpen();\n\n // as `onChange` is called within a lifecycle method we\n // avoid dispatching via `dispatchDiscreteCustomEvent`.\n document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));\n } else {\n providerContext.onClose();\n }\n onOpenChange?.(open);\n },\n });\n const stateAttribute = React.useMemo(() => {\n return open ? (wasOpenDelayedRef.current ? 'delayed-open' : 'instant-open') : 'closed';\n }, [open]);\n\n const handleOpen = React.useCallback(() => {\n window.clearTimeout(openTimerRef.current);\n openTimerRef.current = 0;\n wasOpenDelayedRef.current = false;\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = React.useCallback(() => {\n window.clearTimeout(openTimerRef.current);\n openTimerRef.current = 0;\n setOpen(false);\n }, [setOpen]);\n\n const handleDelayedOpen = React.useCallback(() => {\n window.clearTimeout(openTimerRef.current);\n openTimerRef.current = window.setTimeout(() => {\n wasOpenDelayedRef.current = true;\n setOpen(true);\n openTimerRef.current = 0;\n }, delayDuration);\n }, [delayDuration, setOpen]);\n\n React.useEffect(() => {\n return () => {\n if (openTimerRef.current) {\n window.clearTimeout(openTimerRef.current);\n openTimerRef.current = 0;\n }\n };\n }, []);\n\n return (\n <PopperPrimitive.Root {...popperScope}>\n <TooltipContextProvider\n scope={__scopeTooltip}\n contentId={contentId}\n open={open}\n stateAttribute={stateAttribute}\n trigger={trigger}\n onTriggerChange={setTrigger}\n onTriggerEnter={React.useCallback(() => {\n if (providerContext.isOpenDelayed) handleDelayedOpen();\n else handleOpen();\n }, [providerContext.isOpenDelayed, handleDelayedOpen, handleOpen])}\n onTriggerLeave={React.useCallback(() => {\n if (disableHoverableContent) {\n handleClose();\n } else {\n // Clear the timer in case the pointer leaves the trigger before the tooltip is opened.\n window.clearTimeout(openTimerRef.current);\n openTimerRef.current = 0;\n }\n }, [handleClose, disableHoverableContent])}\n onOpen={handleOpen}\n onClose={handleClose}\n disableHoverableContent={disableHoverableContent}\n >\n {children}\n </TooltipContextProvider>\n </PopperPrimitive.Root>\n );\n};\n\nTooltip.displayName = TOOLTIP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * TooltipTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'TooltipTrigger';\n\ntype TooltipTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface TooltipTriggerProps extends PrimitiveButtonProps {}\n\nconst TooltipTrigger = React.forwardRef<TooltipTriggerElement, TooltipTriggerProps>(\n (props: ScopedProps<TooltipTriggerProps>, forwardedRef) => {\n const { __scopeTooltip, ...triggerProps } = props;\n const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);\n const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);\n const popperScope = usePopperScope(__scopeTooltip);\n const ref = React.useRef<TooltipTriggerElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);\n const isPointerDownRef = React.useRef(false);\n const hasPointerMoveOpenedRef = React.useRef(false);\n const handlePointerUp = React.useCallback(() => (isPointerDownRef.current = false), []);\n\n React.useEffect(() => {\n return () => document.removeEventListener('pointerup', handlePointerUp);\n }, [handlePointerUp]);\n\n return (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n <Primitive.button\n // We purposefully avoid adding `type=button` here because tooltip triggers are also\n // commonly anchors and the anchor `type` attribute signifies MIME type.\n aria-describedby={context.open ? context.contentId : undefined}\n data-state={context.stateAttribute}\n {...triggerProps}\n ref={composedRefs}\n onPointerMove={composeEventHandlers(props.onPointerMove, (event) => {\n if (event.pointerType === 'touch') return;\n if (\n !hasPointerMoveOpenedRef.current &&\n !providerContext.isPointerInTransitRef.current\n ) {\n context.onTriggerEnter();\n hasPointerMoveOpenedRef.current = true;\n }\n })}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, () => {\n context.onTriggerLeave();\n hasPointerMoveOpenedRef.current = false;\n })}\n onPointerDown={composeEventHandlers(props.onPointerDown, () => {\n isPointerDownRef.current = true;\n document.addEventListener('pointerup', handlePointerUp, { once: true });\n })}\n onFocus={composeEventHandlers(props.onFocus, () => {\n if (!isPointerDownRef.current) context.onOpen();\n })}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n onClick={composeEventHandlers(props.onClick, context.onClose)}\n />\n </PopperPrimitive.Anchor>\n );\n }\n);\n\nTooltipTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * TooltipPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'TooltipPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createTooltipContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface TooltipPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst TooltipPortal: React.FC<TooltipPortalProps> = (props: ScopedProps<TooltipPortalProps>) => {\n const { __scopeTooltip, forceMount, children, container } = props;\n const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);\n return (\n <PortalProvider scope={__scopeTooltip} forceMount={forceMount}>\n <Presence present={forceMount || context.open}>\n <PortalPrimitive asChild container={container}>\n {children}\n </PortalPrimitive>\n </Presence>\n </PortalProvider>\n );\n};\n\nTooltipPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * TooltipContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'TooltipContent';\n\ntype TooltipContentElement = TooltipContentImplElement;\ninterface TooltipContentProps extends TooltipContentImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst TooltipContent = React.forwardRef<TooltipContentElement, TooltipContentProps>(\n (props: ScopedProps<TooltipContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);\n const { forceMount = portalContext.forceMount, side = 'top', ...contentProps } = props;\n const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);\n\n return (\n <Presence present={forceMount || context.open}>\n {context.disableHoverableContent ? (\n <TooltipContentImpl side={side} {...contentProps} ref={forwardedRef} />\n ) : (\n <TooltipContentHoverable side={side} {...contentProps} ref={forwardedRef} />\n )}\n </Presence>\n );\n }\n);\n\ntype Point = { x: number; y: number };\ntype Polygon = Point[];\n\ntype TooltipContentHoverableElement = TooltipContentImplElement;\ninterface TooltipContentHoverableProps extends TooltipContentImplProps {}\n\nconst TooltipContentHoverable = React.forwardRef<\n TooltipContentHoverableElement,\n TooltipContentHoverableProps\n>((props: ScopedProps<TooltipContentHoverableProps>, forwardedRef) => {\n const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);\n const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);\n const ref = React.useRef<TooltipContentHoverableElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [pointerGraceArea, setPointerGraceArea] = React.useState<Polygon | null>(null);\n\n const { trigger, onClose } = context;\n const content = ref.current;\n\n const { onPointerInTransitChange } = providerContext;\n\n const handleRemoveGraceArea = React.useCallback(() => {\n setPointerGraceArea(null);\n onPointerInTransitChange(false);\n }, [onPointerInTransitChange]);\n\n const handleCreateGraceArea = React.useCallback(\n (event: PointerEvent, hoverTarget: HTMLElement) => {\n const currentTarget = event.currentTarget as HTMLElement;\n const exitPoint = { x: event.clientX, y: event.clientY };\n const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());\n const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);\n const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());\n const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);\n setPointerGraceArea(graceArea);\n onPointerInTransitChange(true);\n },\n [onPointerInTransitChange]\n );\n\n React.useEffect(() => {\n return () => handleRemoveGraceArea();\n }, [handleRemoveGraceArea]);\n\n React.useEffect(() => {\n if (trigger && content) {\n const handleTriggerLeave = (event: PointerEvent) => handleCreateGraceArea(event, content);\n const handleContentLeave = (event: PointerEvent) => handleCreateGraceArea(event, trigger);\n\n trigger.addEventListener('pointerleave', handleTriggerLeave);\n content.addEventListener('pointerleave', handleContentLeave);\n return () => {\n trigger.removeEventListener('pointerleave', handleTriggerLeave);\n content.removeEventListener('pointerleave', handleContentLeave);\n };\n }\n }, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);\n\n React.useEffect(() => {\n if (pointerGraceArea) {\n const handleTrackPointerGrace = (event: PointerEvent) => {\n const target = event.target as HTMLElement;\n const pointerPosition = { x: event.clientX, y: event.clientY };\n const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);\n const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);\n\n if (hasEnteredTarget) {\n handleRemoveGraceArea();\n } else if (isPointerOutsideGraceArea) {\n handleRemoveGraceArea();\n onClose();\n }\n };\n document.addEventListener('pointermove', handleTrackPointerGrace);\n return () => document.removeEventListener('pointermove', handleTrackPointerGrace);\n }\n }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);\n\n return <TooltipContentImpl {...props} ref={composedRefs} />;\n});\n\nconst [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] =\n createTooltipContext(TOOLTIP_NAME, { isInside: false });\n\ntype TooltipContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface TooltipContentImplProps extends Omit<PopperContentProps, 'onPlaced'> {\n /**\n * A more descriptive label for accessibility purpose\n */\n 'aria-label'?: string;\n\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `Tooltip`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n}\n\nconst TooltipContentImpl = React.forwardRef<TooltipContentImplElement, TooltipContentImplProps>(\n (props: ScopedProps<TooltipContentImplProps>, forwardedRef) => {\n const {\n __scopeTooltip,\n children,\n 'aria-label': ariaLabel,\n onEscapeKeyDown,\n onPointerDownOutside,\n ...contentProps\n } = props;\n const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);\n const popperScope = usePopperScope(__scopeTooltip);\n const { onClose } = context;\n\n // Close this tooltip if another one opens\n React.useEffect(() => {\n document.addEventListener(TOOLTIP_OPEN, onClose);\n return () => document.removeEventListener(TOOLTIP_OPEN, onClose);\n }, [onClose]);\n\n // Close the tooltip if the trigger is scrolled\n React.useEffect(() => {\n if (context.trigger) {\n const handleScroll = (event: Event) => {\n const target = event.target as HTMLElement;\n if (target?.contains(context.trigger)) onClose();\n };\n window.addEventListener('scroll', handleScroll, { capture: true });\n return () => window.removeEventListener('scroll', handleScroll, { capture: true });\n }\n }, [context.trigger, onClose]);\n\n return (\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={(event) => event.preventDefault()}\n onDismiss={onClose}\n >\n <PopperPrimitive.Content\n data-state={context.stateAttribute}\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-tooltip-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-tooltip-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-tooltip-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-tooltip-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-tooltip-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n >\n <Slottable>{children}</Slottable>\n <VisuallyHiddenContentContextProvider scope={__scopeTooltip} isInside={true}>\n <VisuallyHiddenPrimitive.Root id={context.contentId} role=\"tooltip\">\n {ariaLabel || children}\n </VisuallyHiddenPrimitive.Root>\n </VisuallyHiddenContentContextProvider>\n </PopperPrimitive.Content>\n </DismissableLayer>\n );\n }\n);\n\nTooltipContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * TooltipArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'TooltipArrow';\n\ntype TooltipArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface TooltipArrowProps extends PopperArrowProps {}\n\nconst TooltipArrow = React.forwardRef<TooltipArrowElement, TooltipArrowProps>(\n (props: ScopedProps<TooltipArrowProps>, forwardedRef) => {\n const { __scopeTooltip, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeTooltip);\n const visuallyHiddenContentContext = useVisuallyHiddenContentContext(\n ARROW_NAME,\n __scopeTooltip\n );\n // if the arrow is inside the `VisuallyHidden`, we don't want to render it all to\n // prevent issues in positioning the arrow due to the duplicate\n return visuallyHiddenContentContext.isInside ? null : (\n <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />\n );\n }\n);\n\nTooltipArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype Side = NonNullable<TooltipContentProps['side']>;\n\nfunction getExitSideFromRect(point: Point, rect: DOMRect): Side {\n const top = Math.abs(rect.top - point.y);\n const bottom = Math.abs(rect.bottom - point.y);\n const right = Math.abs(rect.right - point.x);\n const left = Math.abs(rect.left - point.x);\n\n switch (Math.min(top, bottom, right, left)) {\n case left:\n return 'left';\n case right:\n return 'right';\n case top:\n return 'top';\n case bottom:\n return 'bottom';\n default:\n throw new Error('unreachable');\n }\n}\n\nfunction getPaddedExitPoints(exitPoint: Point, exitSide: Side, padding = 5) {\n const paddedExitPoints: Point[] = [];\n switch (exitSide) {\n case 'top':\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y + padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case 'bottom':\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y - padding }\n );\n break;\n case 'left':\n paddedExitPoints.push(\n { x: exitPoint.x + padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case 'right':\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x - padding, y: exitPoint.y + padding }\n );\n break;\n }\n return paddedExitPoints;\n}\n\nfunction getPointsFromRect(rect: DOMRect) {\n const { top, right, bottom, left } = rect;\n return [\n { x: left, y: top },\n { x: right, y: top },\n { x: right, y: bottom },\n { x: left, y: bottom },\n ];\n}\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\n// Returns a new array of points representing the convex hull of the given set of points.\n// https://www.nayuki.io/page/convex-hull-algorithm\nfunction getHull<P extends Point>(points: Readonly<Array<P>>): Array<P> {\n const newPoints: Array<P> = points.slice();\n newPoints.sort((a: Point, b: Point) => {\n if (a.x < b.x) return -1;\n else if (a.x > b.x) return +1;\n else if (a.y < b.y) return -1;\n else if (a.y > b.y) return +1;\n else return 0;\n });\n return getHullPresorted(newPoints);\n}\n\n// Returns the convex hull, assuming that each points[i] <= points[i + 1]. Runs in O(n) time.\nfunction getHullPresorted<P extends Point>(points: Readonly<Array<P>>): Array<P> {\n if (points.length <= 1) return points.slice();\n\n const upperHull: Array<P> = [];\n for (let i = 0; i < points.length; i++) {\n const p = points[i];\n while (upperHull.length >= 2) {\n const q = upperHull[upperHull.length - 1];\n const r = upperHull[upperHull.length - 2];\n if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();\n else break;\n }\n upperHull.push(p);\n }\n upperHull.pop();\n\n const lowerHull: Array<P> = [];\n for (let i = points.length - 1; i >= 0; i--) {\n const p = points[i];\n while (lowerHull.length >= 2) {\n const q = lowerHull[lowerHull.length - 1];\n const r = lowerHull[lowerHull.length - 2];\n if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();\n else break;\n }\n lowerHull.push(p);\n }\n lowerHull.pop();\n\n if (\n upperHull.length === 1 &&\n lowerHull.length === 1 &&\n upperHull[0].x === lowerHull[0].x &&\n upperHull[0].y === lowerHull[0].y\n ) {\n return upperHull;\n } else {\n return upperHull.concat(lowerHull);\n }\n}\n\nconst Provider = TooltipProvider;\nconst Root = Tooltip;\nconst Trigger = TooltipTrigger;\nconst Portal = TooltipPortal;\nconst Content = TooltipContent;\nconst Arrow = TooltipArrow;\n\nexport {\n createTooltipScope,\n //\n TooltipProvider,\n Tooltip,\n TooltipTrigger,\n TooltipPortal,\n TooltipContent,\n TooltipArrow,\n //\n Provider,\n Root,\n Trigger,\n Portal,\n Content,\n Arrow,\n};\nexport type {\n TooltipProviderProps,\n TooltipProps,\n TooltipTriggerProps,\n TooltipPortalProps,\n TooltipContentProps,\n TooltipArrowProps,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,eAAAA;AAAA,EAAA,eAAAC;AAAA,EAAA;AAAA;AAAA,cAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,gCAAgC;AAChC,2BAAmC;AACnC,qCAAiC;AACjC,sBAAsB;AACtB,sBAAiC;AACjC,0BAAkC;AAClC,0BAA0C;AAC1C,4BAAyB;AACzB,6BAA0B;AAC1B,wBAA0B;AAC1B,0CAAqC;AACrC,8BAAyC;AAsErC;AAjEJ,IAAM,CAAC,sBAAsB,kBAAkB,QAAI,yCAAmB,WAAW;AAAA,EAC/E;AACF,CAAC;AACD,IAAM,qBAAiB,uCAAkB;AAMzC,IAAM,gBAAgB;AACtB,IAAM,yBAAyB;AAC/B,IAAM,eAAe;AAYrB,IAAM,CAAC,gCAAgC,yBAAyB,IAC9D,qBAAkD,aAAa;AAqBjE,IAAM,kBAAkD,CACtD,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,IAC1B;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,eAAe,gBAAgB,IAAU,eAAS,IAAI;AAC7D,QAAM,wBAA8B,aAAO,KAAK;AAChD,QAAM,oBAA0B,aAAO,CAAC;AAExC,EAAM,gBAAU,MAAM;AACpB,UAAM,iBAAiB,kBAAkB;AACzC,WAAO,MAAM,OAAO,aAAa,cAAc;AAAA,EACjD,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,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