@radix-ui/react-tooltip 0.1.8-rc.47 → 0.1.8-rc.48
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.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +248 -38
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +248 -38
- package/dist/index.module.js.map +1 -1
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ interface TooltipProviderProps {
|
|
|
17
17
|
* @defaultValue 300
|
|
18
18
|
*/
|
|
19
19
|
skipDelayDuration?: number;
|
|
20
|
+
/**
|
|
21
|
+
* When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger.
|
|
22
|
+
* @defaultValue false
|
|
23
|
+
*/
|
|
24
|
+
disableHoverableContent?: boolean;
|
|
20
25
|
}
|
|
21
26
|
export const TooltipProvider: React.FC<TooltipProviderProps>;
|
|
22
27
|
export interface TooltipProps {
|
|
@@ -30,6 +35,11 @@ export interface TooltipProps {
|
|
|
30
35
|
* @defaultValue 700
|
|
31
36
|
*/
|
|
32
37
|
delayDuration?: number;
|
|
38
|
+
/**
|
|
39
|
+
* When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger.
|
|
40
|
+
* @defaultValue false
|
|
41
|
+
*/
|
|
42
|
+
disableHoverableContent?: boolean;
|
|
33
43
|
}
|
|
34
44
|
export const Tooltip: React.FC<TooltipProps>;
|
|
35
45
|
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAmBA,OAAA,yFAEE,CAAC;
|
|
1
|
+
{"mappings":";;;;;;AAmBA,OAAA,yFAEE,CAAC;AAwBH;IACE,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;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IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,eAAe,CAAC,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;IAC3D;;;OAGG;IACH,oBAAoB,CAAC,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;CACtE;AA0ED,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,kCAA4B,SAAQ,gBAAgB;CAAG;AAEvD,OAAA,MAAM,qGAML,CAAC;AA+GF,OAAA,MAAM,wCAA0B,CAAC;AACjC,OAAA,MAAM,4BAAc,CAAC;AACrB,OAAA,MAAM,sGAAwB,CAAC;AAC/B,OAAA,MAAM,oCAAsB,CAAC;AAC7B,OAAA,MAAM,mGAAwB,CAAC;AAC/B,OAAA,MAAM,8FAAoB,CAAC","sources":["packages/react/tooltip/src/packages/react/tooltip/src/Tooltip.tsx","packages/react/tooltip/src/packages/react/tooltip/src/index.ts","packages/react/tooltip/src/index.ts"],"sourcesContent":[null,null,"export {\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 TooltipProps,\n TooltipTriggerProps,\n TooltipPortalProps,\n TooltipContentProps,\n TooltipArrowProps,\n} from './Tooltip';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -57,15 +57,11 @@ const $c34afbc43c90cc6f$var$usePopperScope = $iVrL9$radixuireactpopper.createPop
|
|
|
57
57
|
* -----------------------------------------------------------------------------------------------*/ const $c34afbc43c90cc6f$var$PROVIDER_NAME = 'TooltipProvider';
|
|
58
58
|
const $c34afbc43c90cc6f$var$DEFAULT_DELAY_DURATION = 700;
|
|
59
59
|
const $c34afbc43c90cc6f$var$TOOLTIP_OPEN = 'tooltip.open';
|
|
60
|
-
const [$c34afbc43c90cc6f$var$TooltipProviderContextProvider, $c34afbc43c90cc6f$var$useTooltipProviderContext] = $c34afbc43c90cc6f$var$createTooltipContext($c34afbc43c90cc6f$var$PROVIDER_NAME
|
|
61
|
-
isOpenDelayed: true,
|
|
62
|
-
delayDuration: $c34afbc43c90cc6f$var$DEFAULT_DELAY_DURATION,
|
|
63
|
-
onOpen: ()=>{},
|
|
64
|
-
onClose: ()=>{}
|
|
65
|
-
});
|
|
60
|
+
const [$c34afbc43c90cc6f$var$TooltipProviderContextProvider, $c34afbc43c90cc6f$var$useTooltipProviderContext] = $c34afbc43c90cc6f$var$createTooltipContext($c34afbc43c90cc6f$var$PROVIDER_NAME);
|
|
66
61
|
const $c34afbc43c90cc6f$export$f78649fb9ca566b8 = (props)=>{
|
|
67
|
-
const { __scopeTooltip: __scopeTooltip , delayDuration: delayDuration = $c34afbc43c90cc6f$var$DEFAULT_DELAY_DURATION , skipDelayDuration: skipDelayDuration = 300 , children: children } = props;
|
|
62
|
+
const { __scopeTooltip: __scopeTooltip , delayDuration: delayDuration = $c34afbc43c90cc6f$var$DEFAULT_DELAY_DURATION , skipDelayDuration: skipDelayDuration = 300 , disableHoverableContent: disableHoverableContent = false , children: children } = props;
|
|
68
63
|
const [isOpenDelayed, setIsOpenDelayed] = $iVrL9$react.useState(true);
|
|
64
|
+
const isPointerInTransitRef = $iVrL9$react.useRef(false);
|
|
69
65
|
const skipDelayTimerRef = $iVrL9$react.useRef(0);
|
|
70
66
|
$iVrL9$react.useEffect(()=>{
|
|
71
67
|
const skipDelayTimer = skipDelayTimerRef.current;
|
|
@@ -86,7 +82,12 @@ const $c34afbc43c90cc6f$export$f78649fb9ca566b8 = (props)=>{
|
|
|
86
82
|
, skipDelayDuration);
|
|
87
83
|
}, [
|
|
88
84
|
skipDelayDuration
|
|
89
|
-
])
|
|
85
|
+
]),
|
|
86
|
+
isPointerInTransitRef: isPointerInTransitRef,
|
|
87
|
+
onPointerInTransitChange: $iVrL9$react.useCallback((inTransit)=>{
|
|
88
|
+
isPointerInTransitRef.current = inTransit;
|
|
89
|
+
}, []),
|
|
90
|
+
disableHoverableContent: disableHoverableContent
|
|
90
91
|
}, children);
|
|
91
92
|
};
|
|
92
93
|
/*#__PURE__*/ Object.assign($c34afbc43c90cc6f$export$f78649fb9ca566b8, {
|
|
@@ -97,28 +98,24 @@ const $c34afbc43c90cc6f$export$f78649fb9ca566b8 = (props)=>{
|
|
|
97
98
|
* -----------------------------------------------------------------------------------------------*/ const $c34afbc43c90cc6f$var$TOOLTIP_NAME = 'Tooltip';
|
|
98
99
|
const [$c34afbc43c90cc6f$var$TooltipContextProvider, $c34afbc43c90cc6f$var$useTooltipContext] = $c34afbc43c90cc6f$var$createTooltipContext($c34afbc43c90cc6f$var$TOOLTIP_NAME);
|
|
99
100
|
const $c34afbc43c90cc6f$export$28c660c63b792dea = (props)=>{
|
|
100
|
-
const { __scopeTooltip: __scopeTooltip , children: children , open: openProp , defaultOpen: defaultOpen = false , onOpenChange: onOpenChange , delayDuration: delayDurationProp } = props;
|
|
101
|
-
const
|
|
101
|
+
const { __scopeTooltip: __scopeTooltip , children: children , open: openProp , defaultOpen: defaultOpen = false , onOpenChange: onOpenChange , disableHoverableContent: disableHoverableContentProp , delayDuration: delayDurationProp } = props;
|
|
102
|
+
const providerContext = $c34afbc43c90cc6f$var$useTooltipProviderContext($c34afbc43c90cc6f$var$TOOLTIP_NAME, props.__scopeTooltip);
|
|
102
103
|
const popperScope = $c34afbc43c90cc6f$var$usePopperScope(__scopeTooltip);
|
|
103
104
|
const [trigger, setTrigger] = $iVrL9$react.useState(null);
|
|
104
105
|
const contentId = $iVrL9$radixuireactid.useId();
|
|
105
106
|
const openTimerRef = $iVrL9$react.useRef(0);
|
|
106
|
-
const
|
|
107
|
+
const disableHoverableContent = disableHoverableContentProp !== null && disableHoverableContentProp !== void 0 ? disableHoverableContentProp : providerContext.disableHoverableContent;
|
|
108
|
+
const delayDuration = delayDurationProp !== null && delayDurationProp !== void 0 ? delayDurationProp : providerContext.delayDuration;
|
|
107
109
|
const wasOpenDelayedRef = $iVrL9$react.useRef(false);
|
|
108
|
-
const { onOpen: onOpen , onClose: onClose } = context;
|
|
109
110
|
const [open1 = false, setOpen] = $iVrL9$radixuireactusecontrollablestate.useControllableState({
|
|
110
111
|
prop: openProp,
|
|
111
112
|
defaultProp: defaultOpen,
|
|
112
113
|
onChange: (open)=>{
|
|
113
114
|
if (open) {
|
|
114
|
-
//
|
|
115
|
-
// ensure other tooltips are aware of this one opening.
|
|
116
|
-
//
|
|
117
|
-
// as `onChange` is called within a lifecycle method we
|
|
115
|
+
providerContext.onOpen(); // as `onChange` is called within a lifecycle method we
|
|
118
116
|
// avoid dispatching via `dispatchDiscreteCustomEvent`.
|
|
119
117
|
document.dispatchEvent(new CustomEvent($c34afbc43c90cc6f$var$TOOLTIP_OPEN));
|
|
120
|
-
|
|
121
|
-
}
|
|
118
|
+
} else providerContext.onClose();
|
|
122
119
|
onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
|
|
123
120
|
}
|
|
124
121
|
});
|
|
@@ -134,6 +131,12 @@ const $c34afbc43c90cc6f$export$28c660c63b792dea = (props)=>{
|
|
|
134
131
|
}, [
|
|
135
132
|
setOpen
|
|
136
133
|
]);
|
|
134
|
+
const handleClose = $iVrL9$react.useCallback(()=>{
|
|
135
|
+
window.clearTimeout(openTimerRef.current);
|
|
136
|
+
setOpen(false);
|
|
137
|
+
}, [
|
|
138
|
+
setOpen
|
|
139
|
+
]);
|
|
137
140
|
const handleDelayedOpen = $iVrL9$react.useCallback(()=>{
|
|
138
141
|
window.clearTimeout(openTimerRef.current);
|
|
139
142
|
openTimerRef.current = window.setTimeout(()=>{
|
|
@@ -156,24 +159,24 @@ const $c34afbc43c90cc6f$export$28c660c63b792dea = (props)=>{
|
|
|
156
159
|
trigger: trigger,
|
|
157
160
|
onTriggerChange: setTrigger,
|
|
158
161
|
onTriggerEnter: $iVrL9$react.useCallback(()=>{
|
|
159
|
-
if (
|
|
162
|
+
if (providerContext.isOpenDelayed) handleDelayedOpen();
|
|
160
163
|
else handleOpen();
|
|
161
164
|
}, [
|
|
162
|
-
|
|
165
|
+
providerContext.isOpenDelayed,
|
|
163
166
|
handleDelayedOpen,
|
|
164
167
|
handleOpen
|
|
165
168
|
]),
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
onClose: $iVrL9$react.useCallback(()=>{
|
|
169
|
+
onTriggerLeave: $iVrL9$react.useCallback(()=>{
|
|
170
|
+
if (disableHoverableContent) handleClose();
|
|
171
|
+
else // Clear the timer in case the pointer leaves the trigger before the tooltip is opened.
|
|
170
172
|
window.clearTimeout(openTimerRef.current);
|
|
171
|
-
setOpen(false);
|
|
172
|
-
onClose();
|
|
173
173
|
}, [
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
])
|
|
174
|
+
handleClose,
|
|
175
|
+
disableHoverableContent
|
|
176
|
+
]),
|
|
177
|
+
onOpen: handleOpen,
|
|
178
|
+
onClose: handleClose,
|
|
179
|
+
disableHoverableContent: disableHoverableContent
|
|
177
180
|
}, children));
|
|
178
181
|
};
|
|
179
182
|
/*#__PURE__*/ Object.assign($c34afbc43c90cc6f$export$28c660c63b792dea, {
|
|
@@ -185,9 +188,12 @@ const $c34afbc43c90cc6f$export$28c660c63b792dea = (props)=>{
|
|
|
185
188
|
const $c34afbc43c90cc6f$export$8c610744efcf8a1d = /*#__PURE__*/ $iVrL9$react.forwardRef((props, forwardedRef)=>{
|
|
186
189
|
const { __scopeTooltip: __scopeTooltip , ...triggerProps } = props;
|
|
187
190
|
const context = $c34afbc43c90cc6f$var$useTooltipContext($c34afbc43c90cc6f$var$TRIGGER_NAME, __scopeTooltip);
|
|
191
|
+
const providerContext = $c34afbc43c90cc6f$var$useTooltipProviderContext($c34afbc43c90cc6f$var$TRIGGER_NAME, __scopeTooltip);
|
|
188
192
|
const popperScope = $c34afbc43c90cc6f$var$usePopperScope(__scopeTooltip);
|
|
189
|
-
const
|
|
193
|
+
const ref = $iVrL9$react.useRef(null);
|
|
194
|
+
const composedRefs = $iVrL9$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref, context.onTriggerChange);
|
|
190
195
|
const isPointerDownRef = $iVrL9$react.useRef(false);
|
|
196
|
+
const hasPointerMoveOpenedRef = $iVrL9$react.useRef(false);
|
|
191
197
|
const handlePointerUp = $iVrL9$react.useCallback(()=>isPointerDownRef.current = false
|
|
192
198
|
, []);
|
|
193
199
|
$iVrL9$react.useEffect(()=>{
|
|
@@ -204,11 +210,18 @@ const $c34afbc43c90cc6f$export$8c610744efcf8a1d = /*#__PURE__*/ $iVrL9$react.for
|
|
|
204
210
|
"aria-describedby": context.open ? context.contentId : undefined,
|
|
205
211
|
"data-state": context.stateAttribute
|
|
206
212
|
}, triggerProps, {
|
|
207
|
-
ref:
|
|
208
|
-
|
|
209
|
-
if (event.pointerType
|
|
213
|
+
ref: composedRefs,
|
|
214
|
+
onPointerMove: $iVrL9$radixuiprimitive.composeEventHandlers(props.onPointerMove, (event)=>{
|
|
215
|
+
if (event.pointerType === 'touch') return;
|
|
216
|
+
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
|
|
217
|
+
context.onTriggerEnter();
|
|
218
|
+
hasPointerMoveOpenedRef.current = true;
|
|
219
|
+
}
|
|
220
|
+
}),
|
|
221
|
+
onPointerLeave: $iVrL9$radixuiprimitive.composeEventHandlers(props.onPointerLeave, ()=>{
|
|
222
|
+
context.onTriggerLeave();
|
|
223
|
+
hasPointerMoveOpenedRef.current = false;
|
|
210
224
|
}),
|
|
211
|
-
onPointerLeave: $iVrL9$radixuiprimitive.composeEventHandlers(props.onPointerLeave, context.onClose),
|
|
212
225
|
onPointerDown: $iVrL9$radixuiprimitive.composeEventHandlers(props.onPointerDown, ()=>{
|
|
213
226
|
isPointerDownRef.current = true;
|
|
214
227
|
document.addEventListener('pointerup', handlePointerUp, {
|
|
@@ -257,13 +270,116 @@ const $c34afbc43c90cc6f$export$7b36b8f925ab7497 = (props)=>{
|
|
|
257
270
|
* -----------------------------------------------------------------------------------------------*/ const $c34afbc43c90cc6f$var$CONTENT_NAME = 'TooltipContent';
|
|
258
271
|
const $c34afbc43c90cc6f$export$e9003e2be37ec060 = /*#__PURE__*/ $iVrL9$react.forwardRef((props, forwardedRef)=>{
|
|
259
272
|
const portalContext = $c34afbc43c90cc6f$var$usePortalContext($c34afbc43c90cc6f$var$CONTENT_NAME, props.__scopeTooltip);
|
|
260
|
-
const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props;
|
|
273
|
+
const { forceMount: forceMount = portalContext.forceMount , side: side = 'top' , ...contentProps } = props;
|
|
261
274
|
const context = $c34afbc43c90cc6f$var$useTooltipContext($c34afbc43c90cc6f$var$CONTENT_NAME, props.__scopeTooltip);
|
|
262
275
|
return /*#__PURE__*/ $iVrL9$react.createElement($iVrL9$radixuireactpresence.Presence, {
|
|
263
276
|
present: forceMount || context.open
|
|
264
|
-
}, /*#__PURE__*/ $iVrL9$react.createElement($c34afbc43c90cc6f$var$TooltipContentImpl, ($parcel$interopDefault($iVrL9$babelruntimehelpersextends))({
|
|
277
|
+
}, context.disableHoverableContent ? /*#__PURE__*/ $iVrL9$react.createElement($c34afbc43c90cc6f$var$TooltipContentImpl, ($parcel$interopDefault($iVrL9$babelruntimehelpersextends))({
|
|
278
|
+
side: side
|
|
279
|
+
}, contentProps, {
|
|
280
|
+
ref: forwardedRef
|
|
281
|
+
})) : /*#__PURE__*/ $iVrL9$react.createElement($c34afbc43c90cc6f$var$TooltipContentHoverable, ($parcel$interopDefault($iVrL9$babelruntimehelpersextends))({
|
|
282
|
+
side: side
|
|
283
|
+
}, contentProps, {
|
|
265
284
|
ref: forwardedRef
|
|
266
|
-
}
|
|
285
|
+
})));
|
|
286
|
+
});
|
|
287
|
+
const $c34afbc43c90cc6f$var$TooltipContentHoverable = /*#__PURE__*/ $iVrL9$react.forwardRef((props, forwardedRef)=>{
|
|
288
|
+
const context = $c34afbc43c90cc6f$var$useTooltipContext($c34afbc43c90cc6f$var$CONTENT_NAME, props.__scopeTooltip);
|
|
289
|
+
const providerContext = $c34afbc43c90cc6f$var$useTooltipProviderContext($c34afbc43c90cc6f$var$CONTENT_NAME, props.__scopeTooltip);
|
|
290
|
+
const ref = $iVrL9$react.useRef(null);
|
|
291
|
+
const composedRefs = $iVrL9$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
|
|
292
|
+
const [pointerGraceArea, setPointerGraceArea] = $iVrL9$react.useState(null);
|
|
293
|
+
const { trigger: trigger , onClose: onClose } = context;
|
|
294
|
+
const content = ref.current;
|
|
295
|
+
const { onPointerInTransitChange: onPointerInTransitChange } = providerContext;
|
|
296
|
+
const handleRemoveGraceArea = $iVrL9$react.useCallback(()=>{
|
|
297
|
+
setPointerGraceArea(null);
|
|
298
|
+
onPointerInTransitChange(false);
|
|
299
|
+
}, [
|
|
300
|
+
onPointerInTransitChange
|
|
301
|
+
]);
|
|
302
|
+
const handleCreateGraceArea = $iVrL9$react.useCallback((event, hoverTarget)=>{
|
|
303
|
+
const currentTarget = event.currentTarget;
|
|
304
|
+
const exitPoint = {
|
|
305
|
+
x: event.clientX,
|
|
306
|
+
y: event.clientY
|
|
307
|
+
};
|
|
308
|
+
const exitSide = $c34afbc43c90cc6f$var$getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
|
|
309
|
+
const bleed = exitSide === 'right' || exitSide === 'bottom' ? -5 : 5;
|
|
310
|
+
const isXAxis = exitSide === 'right' || exitSide === 'left';
|
|
311
|
+
const startPoint = isXAxis ? {
|
|
312
|
+
x: event.clientX + bleed,
|
|
313
|
+
y: event.clientY
|
|
314
|
+
} : {
|
|
315
|
+
x: event.clientX,
|
|
316
|
+
y: event.clientY + bleed
|
|
317
|
+
};
|
|
318
|
+
const hoverTargetPoints = $c34afbc43c90cc6f$var$getPointsFromRect(hoverTarget.getBoundingClientRect());
|
|
319
|
+
const graceArea = $c34afbc43c90cc6f$var$getHull([
|
|
320
|
+
startPoint,
|
|
321
|
+
...hoverTargetPoints
|
|
322
|
+
]);
|
|
323
|
+
setPointerGraceArea(graceArea);
|
|
324
|
+
onPointerInTransitChange(true);
|
|
325
|
+
}, [
|
|
326
|
+
onPointerInTransitChange
|
|
327
|
+
]);
|
|
328
|
+
$iVrL9$react.useEffect(()=>{
|
|
329
|
+
return ()=>handleRemoveGraceArea()
|
|
330
|
+
;
|
|
331
|
+
}, [
|
|
332
|
+
handleRemoveGraceArea
|
|
333
|
+
]);
|
|
334
|
+
$iVrL9$react.useEffect(()=>{
|
|
335
|
+
if (trigger && content) {
|
|
336
|
+
const handleTriggerLeave = (event)=>handleCreateGraceArea(event, content)
|
|
337
|
+
;
|
|
338
|
+
const handleContentLeave = (event)=>handleCreateGraceArea(event, trigger)
|
|
339
|
+
;
|
|
340
|
+
trigger.addEventListener('pointerleave', handleTriggerLeave);
|
|
341
|
+
content.addEventListener('pointerleave', handleContentLeave);
|
|
342
|
+
return ()=>{
|
|
343
|
+
trigger.removeEventListener('pointerleave', handleTriggerLeave);
|
|
344
|
+
content.removeEventListener('pointerleave', handleContentLeave);
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
}, [
|
|
348
|
+
trigger,
|
|
349
|
+
content,
|
|
350
|
+
handleCreateGraceArea,
|
|
351
|
+
handleRemoveGraceArea
|
|
352
|
+
]);
|
|
353
|
+
$iVrL9$react.useEffect(()=>{
|
|
354
|
+
if (pointerGraceArea) {
|
|
355
|
+
const handleTrackPointerGrace = (event)=>{
|
|
356
|
+
const target = event.target;
|
|
357
|
+
const pointerPosition = {
|
|
358
|
+
x: event.clientX,
|
|
359
|
+
y: event.clientY
|
|
360
|
+
};
|
|
361
|
+
const hasEnteredTarget = (trigger === null || trigger === void 0 ? void 0 : trigger.contains(target)) || (content === null || content === void 0 ? void 0 : content.contains(target));
|
|
362
|
+
const isPointerOutsideGraceArea = !$c34afbc43c90cc6f$var$isPointInPolygon(pointerPosition, pointerGraceArea);
|
|
363
|
+
if (hasEnteredTarget) handleRemoveGraceArea();
|
|
364
|
+
else if (isPointerOutsideGraceArea) {
|
|
365
|
+
handleRemoveGraceArea();
|
|
366
|
+
onClose();
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
document.addEventListener('pointermove', handleTrackPointerGrace);
|
|
370
|
+
return ()=>document.removeEventListener('pointermove', handleTrackPointerGrace)
|
|
371
|
+
;
|
|
372
|
+
}
|
|
373
|
+
}, [
|
|
374
|
+
trigger,
|
|
375
|
+
content,
|
|
376
|
+
pointerGraceArea,
|
|
377
|
+
onClose,
|
|
378
|
+
handleRemoveGraceArea
|
|
379
|
+
]);
|
|
380
|
+
return /*#__PURE__*/ $iVrL9$react.createElement($c34afbc43c90cc6f$var$TooltipContentImpl, ($parcel$interopDefault($iVrL9$babelruntimehelpersextends))({}, props, {
|
|
381
|
+
ref: composedRefs
|
|
382
|
+
}));
|
|
267
383
|
});
|
|
268
384
|
const $c34afbc43c90cc6f$var$TooltipContentImpl = /*#__PURE__*/ $iVrL9$react.forwardRef((props, forwardedRef)=>{
|
|
269
385
|
const { __scopeTooltip: __scopeTooltip , children: children , 'aria-label': ariaLabel , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , ...contentProps } = props;
|
|
@@ -333,7 +449,101 @@ const $c34afbc43c90cc6f$export$c27ee0ad710f7559 = /*#__PURE__*/ $iVrL9$react.for
|
|
|
333
449
|
/*#__PURE__*/ Object.assign($c34afbc43c90cc6f$export$c27ee0ad710f7559, {
|
|
334
450
|
displayName: $c34afbc43c90cc6f$var$ARROW_NAME
|
|
335
451
|
});
|
|
336
|
-
/* -----------------------------------------------------------------------------------------------*/
|
|
452
|
+
/* -----------------------------------------------------------------------------------------------*/ function $c34afbc43c90cc6f$var$getExitSideFromRect(point, rect) {
|
|
453
|
+
const top = Math.abs(rect.top - point.y);
|
|
454
|
+
const bottom = Math.abs(rect.bottom - point.y);
|
|
455
|
+
const right = Math.abs(rect.right - point.x);
|
|
456
|
+
const left = Math.abs(rect.left - point.x);
|
|
457
|
+
switch(Math.min(top, bottom, right, left)){
|
|
458
|
+
case left:
|
|
459
|
+
return 'left';
|
|
460
|
+
case right:
|
|
461
|
+
return 'right';
|
|
462
|
+
case top:
|
|
463
|
+
return 'top';
|
|
464
|
+
case bottom:
|
|
465
|
+
return 'bottom';
|
|
466
|
+
default:
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
function $c34afbc43c90cc6f$var$getPointsFromRect(rect) {
|
|
471
|
+
const { top: top , right: right , bottom: bottom , left: left } = rect;
|
|
472
|
+
return [
|
|
473
|
+
{
|
|
474
|
+
x: left,
|
|
475
|
+
y: top
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
x: right,
|
|
479
|
+
y: top
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
x: right,
|
|
483
|
+
y: bottom
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
x: left,
|
|
487
|
+
y: bottom
|
|
488
|
+
}
|
|
489
|
+
];
|
|
490
|
+
} // Determine if a point is inside of a polygon.
|
|
491
|
+
// Based on https://github.com/substack/point-in-polygon
|
|
492
|
+
function $c34afbc43c90cc6f$var$isPointInPolygon(point, polygon) {
|
|
493
|
+
const { x: x , y: y } = point;
|
|
494
|
+
let inside = false;
|
|
495
|
+
for(let i = 0, j = polygon.length - 1; i < polygon.length; j = i++){
|
|
496
|
+
const xi = polygon[i].x;
|
|
497
|
+
const yi = polygon[i].y;
|
|
498
|
+
const xj = polygon[j].x;
|
|
499
|
+
const yj = polygon[j].y; // prettier-ignore
|
|
500
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
501
|
+
if (intersect) inside = !inside;
|
|
502
|
+
}
|
|
503
|
+
return inside;
|
|
504
|
+
} // Returns a new array of points representing the convex hull of the given set of points.
|
|
505
|
+
// https://www.nayuki.io/page/convex-hull-algorithm
|
|
506
|
+
function $c34afbc43c90cc6f$var$getHull(points) {
|
|
507
|
+
const newPoints = points.slice();
|
|
508
|
+
newPoints.sort((a, b)=>{
|
|
509
|
+
if (a.x < b.x) return -1;
|
|
510
|
+
else if (a.x > b.x) return 1;
|
|
511
|
+
else if (a.y < b.y) return -1;
|
|
512
|
+
else if (a.y > b.y) return 1;
|
|
513
|
+
else return 0;
|
|
514
|
+
});
|
|
515
|
+
return $c34afbc43c90cc6f$var$getHullPresorted(newPoints);
|
|
516
|
+
} // Returns the convex hull, assuming that each points[i] <= points[i + 1]. Runs in O(n) time.
|
|
517
|
+
function $c34afbc43c90cc6f$var$getHullPresorted(points) {
|
|
518
|
+
if (points.length <= 1) return points.slice();
|
|
519
|
+
const upperHull = [];
|
|
520
|
+
for(let i = 0; i < points.length; i++){
|
|
521
|
+
const p = points[i];
|
|
522
|
+
while(upperHull.length >= 2){
|
|
523
|
+
const q = upperHull[upperHull.length - 1];
|
|
524
|
+
const r = upperHull[upperHull.length - 2];
|
|
525
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
|
|
526
|
+
else break;
|
|
527
|
+
}
|
|
528
|
+
upperHull.push(p);
|
|
529
|
+
}
|
|
530
|
+
upperHull.pop();
|
|
531
|
+
const lowerHull = [];
|
|
532
|
+
for(let i1 = points.length - 1; i1 >= 0; i1--){
|
|
533
|
+
const p = points[i1];
|
|
534
|
+
while(lowerHull.length >= 2){
|
|
535
|
+
const q = lowerHull[lowerHull.length - 1];
|
|
536
|
+
const r = lowerHull[lowerHull.length - 2];
|
|
537
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
|
|
538
|
+
else break;
|
|
539
|
+
}
|
|
540
|
+
lowerHull.push(p);
|
|
541
|
+
}
|
|
542
|
+
lowerHull.pop();
|
|
543
|
+
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) return upperHull;
|
|
544
|
+
else return upperHull.concat(lowerHull);
|
|
545
|
+
}
|
|
546
|
+
const $c34afbc43c90cc6f$export$2881499e37b75b9a = $c34afbc43c90cc6f$export$f78649fb9ca566b8;
|
|
337
547
|
const $c34afbc43c90cc6f$export$be92b6f5f03c0fe9 = $c34afbc43c90cc6f$export$28c660c63b792dea;
|
|
338
548
|
const $c34afbc43c90cc6f$export$41fb9f06171c75f4 = $c34afbc43c90cc6f$export$8c610744efcf8a1d;
|
|
339
549
|
const $c34afbc43c90cc6f$export$602eac185826482c = $c34afbc43c90cc6f$export$7b36b8f925ab7497;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;ACmBA,MAAM,CAAC2B,0CAAD,EAAuB3B,yCAAvB,CAAA,GAA6CgB,6CAAkB,CAAC,SAAD,EAAY;IAC/EI,2CAD+E;CAAZ,CAArE,AAAA;AAGA,MAAMQ,oCAAc,GAAGR,2CAAiB,EAAxC,AAAA;AAEA;;oGAEA,CAEA,MAAMS,mCAAa,GAAG,iBAAtB,AAAA;AACA,MAAMC,4CAAsB,GAAG,GAA/B,AAAA;AACA,MAAMC,kCAAY,GAAG,cAArB,AAAA;AASA,MAAM,CAACC,oDAAD,EAAiCC,+CAAjC,CAAA,GACJN,0CAAoB,CAA8BE,mCAA9B,EAA6C;IAC/DK,aAAa,EAAE,IADgD;IAE/DC,aAAa,EAAEL,4CAFgD;IAG/DM,MAAM,EAAE,IAAM,EAHiD;IAI/DC,OAAO,EAAE,IAAM,EAAfA;CAJkB,CADtB,AACmE;AAqBnE,MAAMpC,yCAA+C,GACnDqC,CAAAA,KADsD,GAEnD;IACH,MAAM,E,gBACJC,cADI,CAAA,iBAEJJ,aAAa,GAAGL,4CAFZ,sBAGJU,iBAAiB,GAAG,GAHhB,G,UAIJC,QAAAA,CAAAA,EAJI,GAKFH,KALJ,A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CAAA,0BAAA,CAAC,+BAAD,EAAA,2DAAA,CAAA,EAAA,EAA2BuB,WAA3B,EAA4C2D,UAA5C,EAAP;QAA+D,GAAG,EAAExC,YAAL;KAAxD,CAAA,CAAP,CAAO;CAJU,CAArB,AAKG;AAGH,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA;IAAA,WAAA,EAAA,gCAAA;CAAA,CAAA,CAAA;AAEA,oGAAA,CAEA,MAAM1E,yCAAQ,GAAGN,yCAAjB,AAAA;AACA,MAAMO,yCAAI,GAAGN,yCAAb,AAAA;AACA,MAAMO,yCAAO,GAAGN,yCAAhB,AAAA;AACA,MAAMO,yCAAM,GAAGN,yCAAf,AAAA;AACA,MAAMO,yCAAO,GAAGN,yCAAhB,AAAA;AACA,MAAMO,yCAAK,GAAGN,yCAAd,AAAA;;ADvcA","sources":["packages/react/tooltip/src/index.ts","packages/react/tooltip/src/Tooltip.tsx"],"sourcesContent":["export {\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 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 * as Radix from '@radix-ui/react-primitive';\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};\n\nconst [TooltipProviderContextProvider, useTooltipProviderContext] =\n createTooltipContext<TooltipProviderContextValue>(PROVIDER_NAME, {\n isOpenDelayed: true,\n delayDuration: DEFAULT_DELAY_DURATION,\n onOpen: () => {},\n onClose: () => {},\n });\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\nconst TooltipProvider: React.FC<TooltipProviderProps> = (\n props: ScopedProps<TooltipProviderProps>\n) => {\n const {\n __scopeTooltip,\n delayDuration = DEFAULT_DELAY_DURATION,\n skipDelayDuration = 300,\n children,\n } = props;\n const [isOpenDelayed, setIsOpenDelayed] = React.useState(true);\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 >\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 onOpen(): void;\n onClose(): void;\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 /**\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\nconst Tooltip: React.FC<TooltipProps> = (props: ScopedProps<TooltipProps>) => {\n const {\n __scopeTooltip,\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n delayDuration: delayDurationProp,\n } = props;\n const context = useTooltipProviderContext(TOOLTIP_NAME, __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 delayDuration = delayDurationProp ?? context.delayDuration;\n const wasOpenDelayedRef = React.useRef(false);\n const { onOpen, onClose } = context;\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: (open) => {\n if (open) {\n // we dispatch here so `TooltipProvider` isn't required to\n // ensure other tooltips are aware of this one opening.\n //\n // as `onChange` is called within a lifecycle method we\n // avoid dispatching via `dispatchDiscreteCustomEvent`.\n document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));\n onOpen();\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 wasOpenDelayedRef.current = false;\n setOpen(true);\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 }, delayDuration);\n }, [delayDuration, setOpen]);\n\n React.useEffect(() => {\n return () => window.clearTimeout(openTimerRef.current);\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 (context.isOpenDelayed) handleDelayedOpen();\n else handleOpen();\n }, [context.isOpenDelayed, handleDelayedOpen, handleOpen])}\n onOpen={React.useCallback(handleOpen, [handleOpen])}\n onClose={React.useCallback(() => {\n window.clearTimeout(openTimerRef.current);\n setOpen(false);\n onClose();\n }, [setOpen, onClose])}\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 = Radix.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 popperScope = usePopperScope(__scopeTooltip);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.onTriggerChange);\n const isPointerDownRef = 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={composedTriggerRef}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, (event) => {\n if (event.pointerType !== 'touch') context.onTriggerEnter();\n })}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, context.onClose)}\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, (event) => {\n // keyboard click will occur under different conditions for different node\n // types so we use `onClick` instead of `onKeyDown` to respect that\n const isKeyboardClick = event.detail === 0;\n if (isKeyboardClick) context.onClose();\n })}\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 extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\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, ...contentProps } = props;\n const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);\n return (\n <Presence present={forceMount || context.open}>\n <TooltipContentImpl ref={forwardedRef} {...contentProps} />\n </Presence>\n );\n }\n);\n\ntype TooltipContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface TooltipContentImplProps extends PopperContentProps {\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 property\n ['--radix-tooltip-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n }}\n >\n <Slottable>{children}</Slottable>\n <VisuallyHiddenPrimitive.Root id={context.contentId} role=\"tooltip\">\n {ariaLabel || children}\n </VisuallyHiddenPrimitive.Root>\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 = Radix.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 return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nTooltipArrow.displayName = ARROW_NAME;\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 TooltipProps,\n TooltipTriggerProps,\n TooltipPortalProps,\n TooltipContentProps,\n TooltipArrowProps,\n};\n"],"names":["createTooltipScope","TooltipProvider","Tooltip","TooltipTrigger","TooltipPortal","TooltipContent","TooltipArrow","Provider","Root","Trigger","Portal","Content","Arrow","React","composeEventHandlers","useComposedRefs","createContextScope","DismissableLayer","useId","PopperPrimitive","createPopperScope","PortalPrimitive","Presence","Primitive","Slottable","useControllableState","VisuallyHiddenPrimitive","createTooltipContext","usePopperScope","PROVIDER_NAME","DEFAULT_DELAY_DURATION","TOOLTIP_OPEN","TooltipProviderContextProvider","useTooltipProviderContext","isOpenDelayed","delayDuration","onOpen","onClose","props","__scopeTooltip","skipDelayDuration","children","setIsOpenDelayed","useState","skipDelayTimerRef","useRef","useEffect","skipDelayTimer","current","window","clearTimeout","useCallback","setTimeout","TOOLTIP_NAME","TooltipContextProvider","useTooltipContext","open","openProp","defaultOpen","onOpenChange","delayDurationProp","context","popperScope","trigger","setTrigger","contentId","openTimerRef","wasOpenDelayedRef","setOpen","prop","defaultProp","onChange","document","dispatchEvent","CustomEvent","stateAttribute","useMemo","handleOpen","handleDelayedOpen","TRIGGER_NAME","forwardRef","forwardedRef","triggerProps","composedTriggerRef","onTriggerChange","isPointerDownRef","handlePointerUp","removeEventListener","undefined","onPointerEnter","event","pointerType","onTriggerEnter","onPointerLeave","onPointerDown","addEventListener","once","onFocus","onBlur","onClick","isKeyboardClick","detail","PORTAL_NAME","PortalProvider","usePortalContext","forceMount","container","CONTENT_NAME","portalContext","contentProps","TooltipContentImpl","ariaLabel","onEscapeKeyDown","onPointerDownOutside","handleScroll","target","contains","capture","preventDefault","style","ARROW_NAME","arrowProps"],"version":3,"file":"index.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;ACmBA,MAAM,CAAC2B,0CAAD,EAAuB3B,yCAAvB,CAAA,GAA6CgB,6CAAkB,CAAC,SAAD,EAAY;IAC/EI,2CAD+E;CAAZ,CAArE,AAAA;AAGA,MAAMQ,oCAAc,GAAGR,2CAAiB,EAAxC,AAAA;AAEA;;oGAEA,CAEA,MAAMS,mCAAa,GAAG,iBAAtB,AAAA;AACA,MAAMC,4CAAsB,GAAG,GAA/B,AAAA;AACA,MAAMC,kCAAY,GAAG,cAArB,AAAA;AAYA,MAAM,CAACC,oDAAD,EAAiCC,+CAAjC,CAAA,GACJN,0CAAoB,CAA8BE,mCAA9B,CADtB,AAAA;AAsBA,MAAM5B,yCAA+C,GACnDiC,CAAAA,KADsD,GAEnD;IACH,MAAM,E,gBACJC,cADI,CAAA,iBAEJC,aAAa,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CAAA;CAEH;AAED,MAAM5L,yCAAQ,GAAGN,yCAAjB,AAAA;AACA,MAAMO,yCAAI,GAAGN,yCAAb,AAAA;AACA,MAAMO,yCAAO,GAAGN,yCAAhB,AAAA;AACA,MAAMO,yCAAM,GAAGN,yCAAf,AAAA;AACA,MAAMO,yCAAO,GAAGN,yCAAhB,AAAA;AACA,MAAMO,yCAAK,GAAGN,yCAAd,AAAA;;ADrrBA","sources":["packages/react/tooltip/src/index.ts","packages/react/tooltip/src/Tooltip.tsx"],"sourcesContent":["export {\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 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 * as Radix from '@radix-ui/react-primitive';\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 wasOpenDelayedRef.current = false;\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = React.useCallback(() => {\n window.clearTimeout(openTimerRef.current);\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 }, delayDuration);\n }, [delayDuration, setOpen]);\n\n React.useEffect(() => {\n return () => window.clearTimeout(openTimerRef.current);\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 }\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 = Radix.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, (event) => {\n // keyboard click will occur under different conditions for different node\n // types so we use `onClick` instead of `onKeyDown` to respect that\n const isKeyboardClick = event.detail === 0;\n if (isKeyboardClick) context.onClose();\n })}\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 extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\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\n const bleed = exitSide === 'right' || exitSide === 'bottom' ? -5 : 5;\n const isXAxis = exitSide === 'right' || exitSide === 'left';\n const startPoint = isXAxis\n ? { x: event.clientX + bleed, y: event.clientY }\n : { x: event.clientX, y: event.clientY + bleed };\n\n const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());\n const graceArea = getHull([startPoint, ...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\ntype TooltipContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface TooltipContentImplProps extends PopperContentProps {\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 property\n ['--radix-tooltip-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n }}\n >\n <Slottable>{children}</Slottable>\n <VisuallyHiddenPrimitive.Root id={context.contentId} role=\"tooltip\">\n {ariaLabel || children}\n </VisuallyHiddenPrimitive.Root>\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 = Radix.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 return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nTooltipArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getExitSideFromRect(point: Point, rect: DOMRect) {\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 return null;\n }\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 TooltipProps,\n TooltipTriggerProps,\n TooltipPortalProps,\n TooltipContentProps,\n TooltipArrowProps,\n};\n"],"names":["createTooltipScope","TooltipProvider","Tooltip","TooltipTrigger","TooltipPortal","TooltipContent","TooltipArrow","Provider","Root","Trigger","Portal","Content","Arrow","React","composeEventHandlers","useComposedRefs","createContextScope","DismissableLayer","useId","PopperPrimitive","createPopperScope","PortalPrimitive","Presence","Primitive","Slottable","useControllableState","VisuallyHiddenPrimitive","createTooltipContext","usePopperScope","PROVIDER_NAME","DEFAULT_DELAY_DURATION","TOOLTIP_OPEN","TooltipProviderContextProvider","useTooltipProviderContext","props","__scopeTooltip","delayDuration","skipDelayDuration","disableHoverableContent","children","isOpenDelayed","setIsOpenDelayed","useState","isPointerInTransitRef","useRef","skipDelayTimerRef","useEffect","skipDelayTimer","current","window","clearTimeout","useCallback","setTimeout","inTransit","TOOLTIP_NAME","TooltipContextProvider","useTooltipContext","open","openProp","defaultOpen","onOpenChange","disableHoverableContentProp","delayDurationProp","providerContext","popperScope","trigger","setTrigger","contentId","openTimerRef","wasOpenDelayedRef","setOpen","prop","defaultProp","onChange","onOpen","document","dispatchEvent","CustomEvent","onClose","stateAttribute","useMemo","handleOpen","handleClose","handleDelayedOpen","TRIGGER_NAME","forwardRef","forwardedRef","triggerProps","context","ref","composedRefs","onTriggerChange","isPointerDownRef","hasPointerMoveOpenedRef","handlePointerUp","removeEventListener","undefined","onPointerMove","event","pointerType","onTriggerEnter","onPointerLeave","onTriggerLeave","onPointerDown","addEventListener","once","onFocus","onBlur","onClick","isKeyboardClick","detail","PORTAL_NAME","PortalProvider","usePortalContext","forceMount","container","CONTENT_NAME","portalContext","side","contentProps","TooltipContentHoverable","pointerGraceArea","setPointerGraceArea","content","onPointerInTransitChange","handleRemoveGraceArea","handleCreateGraceArea","hoverTarget","currentTarget","exitPoint","x","clientX","y","clientY","exitSide","getExitSideFromRect","getBoundingClientRect","bleed","isXAxis","startPoint","hoverTargetPoints","getPointsFromRect","graceArea","getHull","handleTriggerLeave","handleContentLeave","handleTrackPointerGrace","target","pointerPosition","hasEnteredTarget","contains","isPointerOutsideGraceArea","isPointInPolygon","TooltipContentImpl","ariaLabel","onEscapeKeyDown","onPointerDownOutside","handleScroll","capture","preventDefault","style","ARROW_NAME","arrowProps","point","rect","top","Math","abs","bottom","right","left","min","polygon","inside","i","j","length","xi","yi","xj","yj","intersect","points","newPoints","slice","sort","a","b","getHullPresorted","upperHull","p","q","r","pop","push","lowerHull","concat"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -37,15 +37,11 @@ const $a093c7e1ec25a057$var$usePopperScope = $8wepK$createPopperScope();
|
|
|
37
37
|
* -----------------------------------------------------------------------------------------------*/ const $a093c7e1ec25a057$var$PROVIDER_NAME = 'TooltipProvider';
|
|
38
38
|
const $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION = 700;
|
|
39
39
|
const $a093c7e1ec25a057$var$TOOLTIP_OPEN = 'tooltip.open';
|
|
40
|
-
const [$a093c7e1ec25a057$var$TooltipProviderContextProvider, $a093c7e1ec25a057$var$useTooltipProviderContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$PROVIDER_NAME
|
|
41
|
-
isOpenDelayed: true,
|
|
42
|
-
delayDuration: $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION,
|
|
43
|
-
onOpen: ()=>{},
|
|
44
|
-
onClose: ()=>{}
|
|
45
|
-
});
|
|
40
|
+
const [$a093c7e1ec25a057$var$TooltipProviderContextProvider, $a093c7e1ec25a057$var$useTooltipProviderContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$PROVIDER_NAME);
|
|
46
41
|
const $a093c7e1ec25a057$export$f78649fb9ca566b8 = (props)=>{
|
|
47
|
-
const { __scopeTooltip: __scopeTooltip , delayDuration: delayDuration = $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION , skipDelayDuration: skipDelayDuration = 300 , children: children } = props;
|
|
42
|
+
const { __scopeTooltip: __scopeTooltip , delayDuration: delayDuration = $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION , skipDelayDuration: skipDelayDuration = 300 , disableHoverableContent: disableHoverableContent = false , children: children } = props;
|
|
48
43
|
const [isOpenDelayed, setIsOpenDelayed] = $8wepK$useState(true);
|
|
44
|
+
const isPointerInTransitRef = $8wepK$useRef(false);
|
|
49
45
|
const skipDelayTimerRef = $8wepK$useRef(0);
|
|
50
46
|
$8wepK$useEffect(()=>{
|
|
51
47
|
const skipDelayTimer = skipDelayTimerRef.current;
|
|
@@ -66,7 +62,12 @@ const $a093c7e1ec25a057$export$f78649fb9ca566b8 = (props)=>{
|
|
|
66
62
|
, skipDelayDuration);
|
|
67
63
|
}, [
|
|
68
64
|
skipDelayDuration
|
|
69
|
-
])
|
|
65
|
+
]),
|
|
66
|
+
isPointerInTransitRef: isPointerInTransitRef,
|
|
67
|
+
onPointerInTransitChange: $8wepK$useCallback((inTransit)=>{
|
|
68
|
+
isPointerInTransitRef.current = inTransit;
|
|
69
|
+
}, []),
|
|
70
|
+
disableHoverableContent: disableHoverableContent
|
|
70
71
|
}, children);
|
|
71
72
|
};
|
|
72
73
|
/*#__PURE__*/ Object.assign($a093c7e1ec25a057$export$f78649fb9ca566b8, {
|
|
@@ -77,28 +78,24 @@ const $a093c7e1ec25a057$export$f78649fb9ca566b8 = (props)=>{
|
|
|
77
78
|
* -----------------------------------------------------------------------------------------------*/ const $a093c7e1ec25a057$var$TOOLTIP_NAME = 'Tooltip';
|
|
78
79
|
const [$a093c7e1ec25a057$var$TooltipContextProvider, $a093c7e1ec25a057$var$useTooltipContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$TOOLTIP_NAME);
|
|
79
80
|
const $a093c7e1ec25a057$export$28c660c63b792dea = (props)=>{
|
|
80
|
-
const { __scopeTooltip: __scopeTooltip , children: children , open: openProp , defaultOpen: defaultOpen = false , onOpenChange: onOpenChange , delayDuration: delayDurationProp } = props;
|
|
81
|
-
const
|
|
81
|
+
const { __scopeTooltip: __scopeTooltip , children: children , open: openProp , defaultOpen: defaultOpen = false , onOpenChange: onOpenChange , disableHoverableContent: disableHoverableContentProp , delayDuration: delayDurationProp } = props;
|
|
82
|
+
const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$TOOLTIP_NAME, props.__scopeTooltip);
|
|
82
83
|
const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
|
|
83
84
|
const [trigger, setTrigger] = $8wepK$useState(null);
|
|
84
85
|
const contentId = $8wepK$useId();
|
|
85
86
|
const openTimerRef = $8wepK$useRef(0);
|
|
86
|
-
const
|
|
87
|
+
const disableHoverableContent = disableHoverableContentProp !== null && disableHoverableContentProp !== void 0 ? disableHoverableContentProp : providerContext.disableHoverableContent;
|
|
88
|
+
const delayDuration = delayDurationProp !== null && delayDurationProp !== void 0 ? delayDurationProp : providerContext.delayDuration;
|
|
87
89
|
const wasOpenDelayedRef = $8wepK$useRef(false);
|
|
88
|
-
const { onOpen: onOpen , onClose: onClose } = context;
|
|
89
90
|
const [open1 = false, setOpen] = $8wepK$useControllableState({
|
|
90
91
|
prop: openProp,
|
|
91
92
|
defaultProp: defaultOpen,
|
|
92
93
|
onChange: (open)=>{
|
|
93
94
|
if (open) {
|
|
94
|
-
//
|
|
95
|
-
// ensure other tooltips are aware of this one opening.
|
|
96
|
-
//
|
|
97
|
-
// as `onChange` is called within a lifecycle method we
|
|
95
|
+
providerContext.onOpen(); // as `onChange` is called within a lifecycle method we
|
|
98
96
|
// avoid dispatching via `dispatchDiscreteCustomEvent`.
|
|
99
97
|
document.dispatchEvent(new CustomEvent($a093c7e1ec25a057$var$TOOLTIP_OPEN));
|
|
100
|
-
|
|
101
|
-
}
|
|
98
|
+
} else providerContext.onClose();
|
|
102
99
|
onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
|
|
103
100
|
}
|
|
104
101
|
});
|
|
@@ -114,6 +111,12 @@ const $a093c7e1ec25a057$export$28c660c63b792dea = (props)=>{
|
|
|
114
111
|
}, [
|
|
115
112
|
setOpen
|
|
116
113
|
]);
|
|
114
|
+
const handleClose = $8wepK$useCallback(()=>{
|
|
115
|
+
window.clearTimeout(openTimerRef.current);
|
|
116
|
+
setOpen(false);
|
|
117
|
+
}, [
|
|
118
|
+
setOpen
|
|
119
|
+
]);
|
|
117
120
|
const handleDelayedOpen = $8wepK$useCallback(()=>{
|
|
118
121
|
window.clearTimeout(openTimerRef.current);
|
|
119
122
|
openTimerRef.current = window.setTimeout(()=>{
|
|
@@ -136,24 +139,24 @@ const $a093c7e1ec25a057$export$28c660c63b792dea = (props)=>{
|
|
|
136
139
|
trigger: trigger,
|
|
137
140
|
onTriggerChange: setTrigger,
|
|
138
141
|
onTriggerEnter: $8wepK$useCallback(()=>{
|
|
139
|
-
if (
|
|
142
|
+
if (providerContext.isOpenDelayed) handleDelayedOpen();
|
|
140
143
|
else handleOpen();
|
|
141
144
|
}, [
|
|
142
|
-
|
|
145
|
+
providerContext.isOpenDelayed,
|
|
143
146
|
handleDelayedOpen,
|
|
144
147
|
handleOpen
|
|
145
148
|
]),
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
onClose: $8wepK$useCallback(()=>{
|
|
149
|
+
onTriggerLeave: $8wepK$useCallback(()=>{
|
|
150
|
+
if (disableHoverableContent) handleClose();
|
|
151
|
+
else // Clear the timer in case the pointer leaves the trigger before the tooltip is opened.
|
|
150
152
|
window.clearTimeout(openTimerRef.current);
|
|
151
|
-
setOpen(false);
|
|
152
|
-
onClose();
|
|
153
153
|
}, [
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
])
|
|
154
|
+
handleClose,
|
|
155
|
+
disableHoverableContent
|
|
156
|
+
]),
|
|
157
|
+
onOpen: handleOpen,
|
|
158
|
+
onClose: handleClose,
|
|
159
|
+
disableHoverableContent: disableHoverableContent
|
|
157
160
|
}, children));
|
|
158
161
|
};
|
|
159
162
|
/*#__PURE__*/ Object.assign($a093c7e1ec25a057$export$28c660c63b792dea, {
|
|
@@ -165,9 +168,12 @@ const $a093c7e1ec25a057$export$28c660c63b792dea = (props)=>{
|
|
|
165
168
|
const $a093c7e1ec25a057$export$8c610744efcf8a1d = /*#__PURE__*/ $8wepK$forwardRef((props, forwardedRef)=>{
|
|
166
169
|
const { __scopeTooltip: __scopeTooltip , ...triggerProps } = props;
|
|
167
170
|
const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$TRIGGER_NAME, __scopeTooltip);
|
|
171
|
+
const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$TRIGGER_NAME, __scopeTooltip);
|
|
168
172
|
const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
|
|
169
|
-
const
|
|
173
|
+
const ref = $8wepK$useRef(null);
|
|
174
|
+
const composedRefs = $8wepK$useComposedRefs(forwardedRef, ref, context.onTriggerChange);
|
|
170
175
|
const isPointerDownRef = $8wepK$useRef(false);
|
|
176
|
+
const hasPointerMoveOpenedRef = $8wepK$useRef(false);
|
|
171
177
|
const handlePointerUp = $8wepK$useCallback(()=>isPointerDownRef.current = false
|
|
172
178
|
, []);
|
|
173
179
|
$8wepK$useEffect(()=>{
|
|
@@ -184,11 +190,18 @@ const $a093c7e1ec25a057$export$8c610744efcf8a1d = /*#__PURE__*/ $8wepK$forwardRe
|
|
|
184
190
|
"aria-describedby": context.open ? context.contentId : undefined,
|
|
185
191
|
"data-state": context.stateAttribute
|
|
186
192
|
}, triggerProps, {
|
|
187
|
-
ref:
|
|
188
|
-
|
|
189
|
-
if (event.pointerType
|
|
193
|
+
ref: composedRefs,
|
|
194
|
+
onPointerMove: $8wepK$composeEventHandlers(props.onPointerMove, (event)=>{
|
|
195
|
+
if (event.pointerType === 'touch') return;
|
|
196
|
+
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
|
|
197
|
+
context.onTriggerEnter();
|
|
198
|
+
hasPointerMoveOpenedRef.current = true;
|
|
199
|
+
}
|
|
200
|
+
}),
|
|
201
|
+
onPointerLeave: $8wepK$composeEventHandlers(props.onPointerLeave, ()=>{
|
|
202
|
+
context.onTriggerLeave();
|
|
203
|
+
hasPointerMoveOpenedRef.current = false;
|
|
190
204
|
}),
|
|
191
|
-
onPointerLeave: $8wepK$composeEventHandlers(props.onPointerLeave, context.onClose),
|
|
192
205
|
onPointerDown: $8wepK$composeEventHandlers(props.onPointerDown, ()=>{
|
|
193
206
|
isPointerDownRef.current = true;
|
|
194
207
|
document.addEventListener('pointerup', handlePointerUp, {
|
|
@@ -237,13 +250,116 @@ const $a093c7e1ec25a057$export$7b36b8f925ab7497 = (props)=>{
|
|
|
237
250
|
* -----------------------------------------------------------------------------------------------*/ const $a093c7e1ec25a057$var$CONTENT_NAME = 'TooltipContent';
|
|
238
251
|
const $a093c7e1ec25a057$export$e9003e2be37ec060 = /*#__PURE__*/ $8wepK$forwardRef((props, forwardedRef)=>{
|
|
239
252
|
const portalContext = $a093c7e1ec25a057$var$usePortalContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
|
|
240
|
-
const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props;
|
|
253
|
+
const { forceMount: forceMount = portalContext.forceMount , side: side = 'top' , ...contentProps } = props;
|
|
241
254
|
const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
|
|
242
255
|
return /*#__PURE__*/ $8wepK$createElement($8wepK$Presence, {
|
|
243
256
|
present: forceMount || context.open
|
|
244
|
-
}, /*#__PURE__*/ $8wepK$createElement($a093c7e1ec25a057$var$TooltipContentImpl, $8wepK$babelruntimehelpersesmextends({
|
|
257
|
+
}, context.disableHoverableContent ? /*#__PURE__*/ $8wepK$createElement($a093c7e1ec25a057$var$TooltipContentImpl, $8wepK$babelruntimehelpersesmextends({
|
|
258
|
+
side: side
|
|
259
|
+
}, contentProps, {
|
|
260
|
+
ref: forwardedRef
|
|
261
|
+
})) : /*#__PURE__*/ $8wepK$createElement($a093c7e1ec25a057$var$TooltipContentHoverable, $8wepK$babelruntimehelpersesmextends({
|
|
262
|
+
side: side
|
|
263
|
+
}, contentProps, {
|
|
245
264
|
ref: forwardedRef
|
|
246
|
-
}
|
|
265
|
+
})));
|
|
266
|
+
});
|
|
267
|
+
const $a093c7e1ec25a057$var$TooltipContentHoverable = /*#__PURE__*/ $8wepK$forwardRef((props, forwardedRef)=>{
|
|
268
|
+
const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
|
|
269
|
+
const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
|
|
270
|
+
const ref = $8wepK$useRef(null);
|
|
271
|
+
const composedRefs = $8wepK$useComposedRefs(forwardedRef, ref);
|
|
272
|
+
const [pointerGraceArea, setPointerGraceArea] = $8wepK$useState(null);
|
|
273
|
+
const { trigger: trigger , onClose: onClose } = context;
|
|
274
|
+
const content = ref.current;
|
|
275
|
+
const { onPointerInTransitChange: onPointerInTransitChange } = providerContext;
|
|
276
|
+
const handleRemoveGraceArea = $8wepK$useCallback(()=>{
|
|
277
|
+
setPointerGraceArea(null);
|
|
278
|
+
onPointerInTransitChange(false);
|
|
279
|
+
}, [
|
|
280
|
+
onPointerInTransitChange
|
|
281
|
+
]);
|
|
282
|
+
const handleCreateGraceArea = $8wepK$useCallback((event, hoverTarget)=>{
|
|
283
|
+
const currentTarget = event.currentTarget;
|
|
284
|
+
const exitPoint = {
|
|
285
|
+
x: event.clientX,
|
|
286
|
+
y: event.clientY
|
|
287
|
+
};
|
|
288
|
+
const exitSide = $a093c7e1ec25a057$var$getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
|
|
289
|
+
const bleed = exitSide === 'right' || exitSide === 'bottom' ? -5 : 5;
|
|
290
|
+
const isXAxis = exitSide === 'right' || exitSide === 'left';
|
|
291
|
+
const startPoint = isXAxis ? {
|
|
292
|
+
x: event.clientX + bleed,
|
|
293
|
+
y: event.clientY
|
|
294
|
+
} : {
|
|
295
|
+
x: event.clientX,
|
|
296
|
+
y: event.clientY + bleed
|
|
297
|
+
};
|
|
298
|
+
const hoverTargetPoints = $a093c7e1ec25a057$var$getPointsFromRect(hoverTarget.getBoundingClientRect());
|
|
299
|
+
const graceArea = $a093c7e1ec25a057$var$getHull([
|
|
300
|
+
startPoint,
|
|
301
|
+
...hoverTargetPoints
|
|
302
|
+
]);
|
|
303
|
+
setPointerGraceArea(graceArea);
|
|
304
|
+
onPointerInTransitChange(true);
|
|
305
|
+
}, [
|
|
306
|
+
onPointerInTransitChange
|
|
307
|
+
]);
|
|
308
|
+
$8wepK$useEffect(()=>{
|
|
309
|
+
return ()=>handleRemoveGraceArea()
|
|
310
|
+
;
|
|
311
|
+
}, [
|
|
312
|
+
handleRemoveGraceArea
|
|
313
|
+
]);
|
|
314
|
+
$8wepK$useEffect(()=>{
|
|
315
|
+
if (trigger && content) {
|
|
316
|
+
const handleTriggerLeave = (event)=>handleCreateGraceArea(event, content)
|
|
317
|
+
;
|
|
318
|
+
const handleContentLeave = (event)=>handleCreateGraceArea(event, trigger)
|
|
319
|
+
;
|
|
320
|
+
trigger.addEventListener('pointerleave', handleTriggerLeave);
|
|
321
|
+
content.addEventListener('pointerleave', handleContentLeave);
|
|
322
|
+
return ()=>{
|
|
323
|
+
trigger.removeEventListener('pointerleave', handleTriggerLeave);
|
|
324
|
+
content.removeEventListener('pointerleave', handleContentLeave);
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
}, [
|
|
328
|
+
trigger,
|
|
329
|
+
content,
|
|
330
|
+
handleCreateGraceArea,
|
|
331
|
+
handleRemoveGraceArea
|
|
332
|
+
]);
|
|
333
|
+
$8wepK$useEffect(()=>{
|
|
334
|
+
if (pointerGraceArea) {
|
|
335
|
+
const handleTrackPointerGrace = (event)=>{
|
|
336
|
+
const target = event.target;
|
|
337
|
+
const pointerPosition = {
|
|
338
|
+
x: event.clientX,
|
|
339
|
+
y: event.clientY
|
|
340
|
+
};
|
|
341
|
+
const hasEnteredTarget = (trigger === null || trigger === void 0 ? void 0 : trigger.contains(target)) || (content === null || content === void 0 ? void 0 : content.contains(target));
|
|
342
|
+
const isPointerOutsideGraceArea = !$a093c7e1ec25a057$var$isPointInPolygon(pointerPosition, pointerGraceArea);
|
|
343
|
+
if (hasEnteredTarget) handleRemoveGraceArea();
|
|
344
|
+
else if (isPointerOutsideGraceArea) {
|
|
345
|
+
handleRemoveGraceArea();
|
|
346
|
+
onClose();
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
document.addEventListener('pointermove', handleTrackPointerGrace);
|
|
350
|
+
return ()=>document.removeEventListener('pointermove', handleTrackPointerGrace)
|
|
351
|
+
;
|
|
352
|
+
}
|
|
353
|
+
}, [
|
|
354
|
+
trigger,
|
|
355
|
+
content,
|
|
356
|
+
pointerGraceArea,
|
|
357
|
+
onClose,
|
|
358
|
+
handleRemoveGraceArea
|
|
359
|
+
]);
|
|
360
|
+
return /*#__PURE__*/ $8wepK$createElement($a093c7e1ec25a057$var$TooltipContentImpl, $8wepK$babelruntimehelpersesmextends({}, props, {
|
|
361
|
+
ref: composedRefs
|
|
362
|
+
}));
|
|
247
363
|
});
|
|
248
364
|
const $a093c7e1ec25a057$var$TooltipContentImpl = /*#__PURE__*/ $8wepK$forwardRef((props, forwardedRef)=>{
|
|
249
365
|
const { __scopeTooltip: __scopeTooltip , children: children , 'aria-label': ariaLabel , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , ...contentProps } = props;
|
|
@@ -313,7 +429,101 @@ const $a093c7e1ec25a057$export$c27ee0ad710f7559 = /*#__PURE__*/ $8wepK$forwardRe
|
|
|
313
429
|
/*#__PURE__*/ Object.assign($a093c7e1ec25a057$export$c27ee0ad710f7559, {
|
|
314
430
|
displayName: $a093c7e1ec25a057$var$ARROW_NAME
|
|
315
431
|
});
|
|
316
|
-
/* -----------------------------------------------------------------------------------------------*/
|
|
432
|
+
/* -----------------------------------------------------------------------------------------------*/ function $a093c7e1ec25a057$var$getExitSideFromRect(point, rect) {
|
|
433
|
+
const top = Math.abs(rect.top - point.y);
|
|
434
|
+
const bottom = Math.abs(rect.bottom - point.y);
|
|
435
|
+
const right = Math.abs(rect.right - point.x);
|
|
436
|
+
const left = Math.abs(rect.left - point.x);
|
|
437
|
+
switch(Math.min(top, bottom, right, left)){
|
|
438
|
+
case left:
|
|
439
|
+
return 'left';
|
|
440
|
+
case right:
|
|
441
|
+
return 'right';
|
|
442
|
+
case top:
|
|
443
|
+
return 'top';
|
|
444
|
+
case bottom:
|
|
445
|
+
return 'bottom';
|
|
446
|
+
default:
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
function $a093c7e1ec25a057$var$getPointsFromRect(rect) {
|
|
451
|
+
const { top: top , right: right , bottom: bottom , left: left } = rect;
|
|
452
|
+
return [
|
|
453
|
+
{
|
|
454
|
+
x: left,
|
|
455
|
+
y: top
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
x: right,
|
|
459
|
+
y: top
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
x: right,
|
|
463
|
+
y: bottom
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
x: left,
|
|
467
|
+
y: bottom
|
|
468
|
+
}
|
|
469
|
+
];
|
|
470
|
+
} // Determine if a point is inside of a polygon.
|
|
471
|
+
// Based on https://github.com/substack/point-in-polygon
|
|
472
|
+
function $a093c7e1ec25a057$var$isPointInPolygon(point, polygon) {
|
|
473
|
+
const { x: x , y: y } = point;
|
|
474
|
+
let inside = false;
|
|
475
|
+
for(let i = 0, j = polygon.length - 1; i < polygon.length; j = i++){
|
|
476
|
+
const xi = polygon[i].x;
|
|
477
|
+
const yi = polygon[i].y;
|
|
478
|
+
const xj = polygon[j].x;
|
|
479
|
+
const yj = polygon[j].y; // prettier-ignore
|
|
480
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
481
|
+
if (intersect) inside = !inside;
|
|
482
|
+
}
|
|
483
|
+
return inside;
|
|
484
|
+
} // Returns a new array of points representing the convex hull of the given set of points.
|
|
485
|
+
// https://www.nayuki.io/page/convex-hull-algorithm
|
|
486
|
+
function $a093c7e1ec25a057$var$getHull(points) {
|
|
487
|
+
const newPoints = points.slice();
|
|
488
|
+
newPoints.sort((a, b)=>{
|
|
489
|
+
if (a.x < b.x) return -1;
|
|
490
|
+
else if (a.x > b.x) return 1;
|
|
491
|
+
else if (a.y < b.y) return -1;
|
|
492
|
+
else if (a.y > b.y) return 1;
|
|
493
|
+
else return 0;
|
|
494
|
+
});
|
|
495
|
+
return $a093c7e1ec25a057$var$getHullPresorted(newPoints);
|
|
496
|
+
} // Returns the convex hull, assuming that each points[i] <= points[i + 1]. Runs in O(n) time.
|
|
497
|
+
function $a093c7e1ec25a057$var$getHullPresorted(points) {
|
|
498
|
+
if (points.length <= 1) return points.slice();
|
|
499
|
+
const upperHull = [];
|
|
500
|
+
for(let i = 0; i < points.length; i++){
|
|
501
|
+
const p = points[i];
|
|
502
|
+
while(upperHull.length >= 2){
|
|
503
|
+
const q = upperHull[upperHull.length - 1];
|
|
504
|
+
const r = upperHull[upperHull.length - 2];
|
|
505
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
|
|
506
|
+
else break;
|
|
507
|
+
}
|
|
508
|
+
upperHull.push(p);
|
|
509
|
+
}
|
|
510
|
+
upperHull.pop();
|
|
511
|
+
const lowerHull = [];
|
|
512
|
+
for(let i1 = points.length - 1; i1 >= 0; i1--){
|
|
513
|
+
const p = points[i1];
|
|
514
|
+
while(lowerHull.length >= 2){
|
|
515
|
+
const q = lowerHull[lowerHull.length - 1];
|
|
516
|
+
const r = lowerHull[lowerHull.length - 2];
|
|
517
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
|
|
518
|
+
else break;
|
|
519
|
+
}
|
|
520
|
+
lowerHull.push(p);
|
|
521
|
+
}
|
|
522
|
+
lowerHull.pop();
|
|
523
|
+
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) return upperHull;
|
|
524
|
+
else return upperHull.concat(lowerHull);
|
|
525
|
+
}
|
|
526
|
+
const $a093c7e1ec25a057$export$2881499e37b75b9a = $a093c7e1ec25a057$export$f78649fb9ca566b8;
|
|
317
527
|
const $a093c7e1ec25a057$export$be92b6f5f03c0fe9 = $a093c7e1ec25a057$export$28c660c63b792dea;
|
|
318
528
|
const $a093c7e1ec25a057$export$41fb9f06171c75f4 = $a093c7e1ec25a057$export$8c610744efcf8a1d;
|
|
319
529
|
const $a093c7e1ec25a057$export$602eac185826482c = $a093c7e1ec25a057$export$7b36b8f925ab7497;
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;ACmBA,MAAM,CAAC2B,0CAAD,EAAuB3B,yCAAvB,CAAA,GAA6CgB,yBAAkB,CAAC,SAAD,EAAY;IAC/EI,wBAD+E;CAAZ,CAArE,AAAA;AAGA,MAAMQ,oCAAc,GAAGR,wBAAiB,EAAxC,AAAA;AAEA;;oGAEA,CAEA,MAAMS,mCAAa,GAAG,iBAAtB,AAAA;AACA,MAAMC,4CAAsB,GAAG,GAA/B,AAAA;AACA,MAAMC,kCAAY,GAAG,cAArB,AAAA;AASA,MAAM,CAACC,oDAAD,EAAiCC,+CAAjC,CAAA,GACJN,0CAAoB,CAA8BE,mCAA9B,EAA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,CAAA;AAEA;;oGAEA,CAEA,MAAM+E,gCAAU,GAAG,cAAnB,AAAA;AAMA,MAAMlH,yCAAY,GAAA,aAAGO,CAAAA,iBAAA,CACnB,CAACyB,KAAD,EAAwC2C,YAAxC,GAAyD;IACvD,MAAM,E,gBAAE1C,cAAF,CAAA,EAAkB,GAAGkF,UAAH,EAAlB,GAAoCnF,KAA1C,AAAM;IACN,MAAMwB,WAAW,GAAGlC,oCAAc,CAACW,cAAD,CAAlC,AAAA;IACA,OAAA,aAAO,CAAA,oBAAA,CAAC,YAAD,EAAA,oCAAA,CAAA,EAAA,EAA2BuB,WAA3B,EAA4C2D,UAA5C,EAAP;QAA+D,GAAG,EAAExC,YAAL;KAAxD,CAAA,CAAP,CAAO;CAJU,CAArB,AAKG;AAGH,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA;IAAA,WAAA,EAAA,gCAAA;CAAA,CAAA,CAAA;AAEA,oGAAA,CAEA,MAAM1E,yCAAQ,GAAGN,yCAAjB,AAAA;AACA,MAAMO,yCAAI,GAAGN,yCAAb,AAAA;AACA,MAAMO,yCAAO,GAAGN,yCAAhB,AAAA;AACA,MAAMO,yCAAM,GAAGN,yCAAf,AAAA;AACA,MAAMO,yCAAO,GAAGN,yCAAhB,AAAA;AACA,MAAMO,yCAAK,GAAGN,yCAAd,AAAA;;ADvcA","sources":["packages/react/tooltip/src/index.ts","packages/react/tooltip/src/Tooltip.tsx"],"sourcesContent":["export {\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 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 * as Radix from '@radix-ui/react-primitive';\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};\n\nconst [TooltipProviderContextProvider, useTooltipProviderContext] =\n createTooltipContext<TooltipProviderContextValue>(PROVIDER_NAME, {\n isOpenDelayed: true,\n delayDuration: DEFAULT_DELAY_DURATION,\n onOpen: () => {},\n onClose: () => {},\n });\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\nconst TooltipProvider: React.FC<TooltipProviderProps> = (\n props: ScopedProps<TooltipProviderProps>\n) => {\n const {\n __scopeTooltip,\n delayDuration = DEFAULT_DELAY_DURATION,\n skipDelayDuration = 300,\n children,\n } = props;\n const [isOpenDelayed, setIsOpenDelayed] = React.useState(true);\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 >\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 onOpen(): void;\n onClose(): void;\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 /**\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\nconst Tooltip: React.FC<TooltipProps> = (props: ScopedProps<TooltipProps>) => {\n const {\n __scopeTooltip,\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n delayDuration: delayDurationProp,\n } = props;\n const context = useTooltipProviderContext(TOOLTIP_NAME, __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 delayDuration = delayDurationProp ?? context.delayDuration;\n const wasOpenDelayedRef = React.useRef(false);\n const { onOpen, onClose } = context;\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: (open) => {\n if (open) {\n // we dispatch here so `TooltipProvider` isn't required to\n // ensure other tooltips are aware of this one opening.\n //\n // as `onChange` is called within a lifecycle method we\n // avoid dispatching via `dispatchDiscreteCustomEvent`.\n document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));\n onOpen();\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 wasOpenDelayedRef.current = false;\n setOpen(true);\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 }, delayDuration);\n }, [delayDuration, setOpen]);\n\n React.useEffect(() => {\n return () => window.clearTimeout(openTimerRef.current);\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 (context.isOpenDelayed) handleDelayedOpen();\n else handleOpen();\n }, [context.isOpenDelayed, handleDelayedOpen, handleOpen])}\n onOpen={React.useCallback(handleOpen, [handleOpen])}\n onClose={React.useCallback(() => {\n window.clearTimeout(openTimerRef.current);\n setOpen(false);\n onClose();\n }, [setOpen, onClose])}\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 = Radix.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 popperScope = usePopperScope(__scopeTooltip);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.onTriggerChange);\n const isPointerDownRef = 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={composedTriggerRef}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, (event) => {\n if (event.pointerType !== 'touch') context.onTriggerEnter();\n })}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, context.onClose)}\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, (event) => {\n // keyboard click will occur under different conditions for different node\n // types so we use `onClick` instead of `onKeyDown` to respect that\n const isKeyboardClick = event.detail === 0;\n if (isKeyboardClick) context.onClose();\n })}\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 extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\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, ...contentProps } = props;\n const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);\n return (\n <Presence present={forceMount || context.open}>\n <TooltipContentImpl ref={forwardedRef} {...contentProps} />\n </Presence>\n );\n }\n);\n\ntype TooltipContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface TooltipContentImplProps extends PopperContentProps {\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 property\n ['--radix-tooltip-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n }}\n >\n <Slottable>{children}</Slottable>\n <VisuallyHiddenPrimitive.Root id={context.contentId} role=\"tooltip\">\n {ariaLabel || children}\n </VisuallyHiddenPrimitive.Root>\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 = Radix.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 return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nTooltipArrow.displayName = ARROW_NAME;\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 TooltipProps,\n TooltipTriggerProps,\n TooltipPortalProps,\n TooltipContentProps,\n TooltipArrowProps,\n};\n"],"names":["createTooltipScope","TooltipProvider","Tooltip","TooltipTrigger","TooltipPortal","TooltipContent","TooltipArrow","Provider","Root","Trigger","Portal","Content","Arrow","React","composeEventHandlers","useComposedRefs","createContextScope","DismissableLayer","useId","PopperPrimitive","createPopperScope","PortalPrimitive","Presence","Primitive","Slottable","useControllableState","VisuallyHiddenPrimitive","createTooltipContext","usePopperScope","PROVIDER_NAME","DEFAULT_DELAY_DURATION","TOOLTIP_OPEN","TooltipProviderContextProvider","useTooltipProviderContext","isOpenDelayed","delayDuration","onOpen","onClose","props","__scopeTooltip","skipDelayDuration","children","setIsOpenDelayed","useState","skipDelayTimerRef","useRef","useEffect","skipDelayTimer","current","window","clearTimeout","useCallback","setTimeout","TOOLTIP_NAME","TooltipContextProvider","useTooltipContext","open","openProp","defaultOpen","onOpenChange","delayDurationProp","context","popperScope","trigger","setTrigger","contentId","openTimerRef","wasOpenDelayedRef","setOpen","prop","defaultProp","onChange","document","dispatchEvent","CustomEvent","stateAttribute","useMemo","handleOpen","handleDelayedOpen","TRIGGER_NAME","forwardRef","forwardedRef","triggerProps","composedTriggerRef","onTriggerChange","isPointerDownRef","handlePointerUp","removeEventListener","undefined","onPointerEnter","event","pointerType","onTriggerEnter","onPointerLeave","onPointerDown","addEventListener","once","onFocus","onBlur","onClick","isKeyboardClick","detail","PORTAL_NAME","PortalProvider","usePortalContext","forceMount","container","CONTENT_NAME","portalContext","contentProps","TooltipContentImpl","ariaLabel","onEscapeKeyDown","onPointerDownOutside","handleScroll","target","contains","capture","preventDefault","style","ARROW_NAME","arrowProps"],"version":3,"file":"index.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;ACmBA,MAAM,CAAC2B,0CAAD,EAAuB3B,yCAAvB,CAAA,GAA6CgB,yBAAkB,CAAC,SAAD,EAAY;IAC/EI,wBAD+E;CAAZ,CAArE,AAAA;AAGA,MAAMQ,oCAAc,GAAGR,wBAAiB,EAAxC,AAAA;AAEA;;oGAEA,CAEA,MAAM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ADrB,IAEAa,SAAS,CAAC,CAAD,CAAT,CAAa3D,CAAb,KAAmBiE,SAAS,CAAC,CAAD,CAAT,CAAajE,CAFhC,IAGA2D,SAAS,CAAC,CAAD,CAAT,CAAazD,CAAb,KAAmB+D,SAAS,CAAC,CAAD,CAAT,CAAa/D,CAJlC,EAME,OAAOyD,SAAP,CAAA;SAEA,OAAOA,SAAS,CAACO,MAAV,CAAiBD,SAAjB,CAAP,CAAA;CAEH;AAED,MAAM5L,yCAAQ,GAAGN,yCAAjB,AAAA;AACA,MAAMO,yCAAI,GAAGN,yCAAb,AAAA;AACA,MAAMO,yCAAO,GAAGN,yCAAhB,AAAA;AACA,MAAMO,yCAAM,GAAGN,yCAAf,AAAA;AACA,MAAMO,yCAAO,GAAGN,yCAAhB,AAAA;AACA,MAAMO,yCAAK,GAAGN,yCAAd,AAAA;;ADrrBA","sources":["packages/react/tooltip/src/index.ts","packages/react/tooltip/src/Tooltip.tsx"],"sourcesContent":["export {\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 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 * as Radix from '@radix-ui/react-primitive';\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 wasOpenDelayedRef.current = false;\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = React.useCallback(() => {\n window.clearTimeout(openTimerRef.current);\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 }, delayDuration);\n }, [delayDuration, setOpen]);\n\n React.useEffect(() => {\n return () => window.clearTimeout(openTimerRef.current);\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 }\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 = Radix.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, (event) => {\n // keyboard click will occur under different conditions for different node\n // types so we use `onClick` instead of `onKeyDown` to respect that\n const isKeyboardClick = event.detail === 0;\n if (isKeyboardClick) context.onClose();\n })}\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 extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\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\n const bleed = exitSide === 'right' || exitSide === 'bottom' ? -5 : 5;\n const isXAxis = exitSide === 'right' || exitSide === 'left';\n const startPoint = isXAxis\n ? { x: event.clientX + bleed, y: event.clientY }\n : { x: event.clientX, y: event.clientY + bleed };\n\n const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());\n const graceArea = getHull([startPoint, ...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\ntype TooltipContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface TooltipContentImplProps extends PopperContentProps {\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 property\n ['--radix-tooltip-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n }}\n >\n <Slottable>{children}</Slottable>\n <VisuallyHiddenPrimitive.Root id={context.contentId} role=\"tooltip\">\n {ariaLabel || children}\n </VisuallyHiddenPrimitive.Root>\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 = Radix.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 return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nTooltipArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getExitSideFromRect(point: Point, rect: DOMRect) {\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 return null;\n }\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 TooltipProps,\n TooltipTriggerProps,\n TooltipPortalProps,\n TooltipContentProps,\n TooltipArrowProps,\n};\n"],"names":["createTooltipScope","TooltipProvider","Tooltip","TooltipTrigger","TooltipPortal","TooltipContent","TooltipArrow","Provider","Root","Trigger","Portal","Content","Arrow","React","composeEventHandlers","useComposedRefs","createContextScope","DismissableLayer","useId","PopperPrimitive","createPopperScope","PortalPrimitive","Presence","Primitive","Slottable","useControllableState","VisuallyHiddenPrimitive","createTooltipContext","usePopperScope","PROVIDER_NAME","DEFAULT_DELAY_DURATION","TOOLTIP_OPEN","TooltipProviderContextProvider","useTooltipProviderContext","props","__scopeTooltip","delayDuration","skipDelayDuration","disableHoverableContent","children","isOpenDelayed","setIsOpenDelayed","useState","isPointerInTransitRef","useRef","skipDelayTimerRef","useEffect","skipDelayTimer","current","window","clearTimeout","useCallback","setTimeout","inTransit","TOOLTIP_NAME","TooltipContextProvider","useTooltipContext","open","openProp","defaultOpen","onOpenChange","disableHoverableContentProp","delayDurationProp","providerContext","popperScope","trigger","setTrigger","contentId","openTimerRef","wasOpenDelayedRef","setOpen","prop","defaultProp","onChange","onOpen","document","dispatchEvent","CustomEvent","onClose","stateAttribute","useMemo","handleOpen","handleClose","handleDelayedOpen","TRIGGER_NAME","forwardRef","forwardedRef","triggerProps","context","ref","composedRefs","onTriggerChange","isPointerDownRef","hasPointerMoveOpenedRef","handlePointerUp","removeEventListener","undefined","onPointerMove","event","pointerType","onTriggerEnter","onPointerLeave","onTriggerLeave","onPointerDown","addEventListener","once","onFocus","onBlur","onClick","isKeyboardClick","detail","PORTAL_NAME","PortalProvider","usePortalContext","forceMount","container","CONTENT_NAME","portalContext","side","contentProps","TooltipContentHoverable","pointerGraceArea","setPointerGraceArea","content","onPointerInTransitChange","handleRemoveGraceArea","handleCreateGraceArea","hoverTarget","currentTarget","exitPoint","x","clientX","y","clientY","exitSide","getExitSideFromRect","getBoundingClientRect","bleed","isXAxis","startPoint","hoverTargetPoints","getPointsFromRect","graceArea","getHull","handleTriggerLeave","handleContentLeave","handleTrackPointerGrace","target","pointerPosition","hasEnteredTarget","contains","isPointerOutsideGraceArea","isPointInPolygon","TooltipContentImpl","ariaLabel","onEscapeKeyDown","onPointerDownOutside","handleScroll","capture","preventDefault","style","ARROW_NAME","arrowProps","point","rect","top","Math","abs","bottom","right","left","min","polygon","inside","i","j","length","xi","yi","xj","yj","intersect","points","newPoints","slice","sort","a","b","getHullPresorted","upperHull","p","q","r","pop","push","lowerHull","concat"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-tooltip",
|
|
3
|
-
"version": "0.1.8-rc.
|
|
3
|
+
"version": "0.1.8-rc.48",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.13.10",
|
|
20
|
-
"@radix-ui/primitive": "0.1.1-rc.
|
|
21
|
-
"@radix-ui/react-compose-refs": "0.1.1-rc.
|
|
22
|
-
"@radix-ui/react-context": "0.1.2-rc.
|
|
23
|
-
"@radix-ui/react-dismissable-layer": "0.1.6-rc.
|
|
24
|
-
"@radix-ui/react-id": "0.1.6-rc.
|
|
25
|
-
"@radix-ui/react-popper": "0.1.5-rc.
|
|
26
|
-
"@radix-ui/react-portal": "0.1.5-rc.
|
|
27
|
-
"@radix-ui/react-presence": "0.1.3-rc.
|
|
28
|
-
"@radix-ui/react-primitive": "0.1.5-rc.
|
|
29
|
-
"@radix-ui/react-slot": "0.1.3-rc.
|
|
30
|
-
"@radix-ui/react-use-controllable-state": "0.1.1-rc.
|
|
31
|
-
"@radix-ui/react-visually-hidden": "0.1.5-rc.
|
|
20
|
+
"@radix-ui/primitive": "0.1.1-rc.3",
|
|
21
|
+
"@radix-ui/react-compose-refs": "0.1.1-rc.43",
|
|
22
|
+
"@radix-ui/react-context": "0.1.2-rc.43",
|
|
23
|
+
"@radix-ui/react-dismissable-layer": "0.1.6-rc.43",
|
|
24
|
+
"@radix-ui/react-id": "0.1.6-rc.43",
|
|
25
|
+
"@radix-ui/react-popper": "0.1.5-rc.43",
|
|
26
|
+
"@radix-ui/react-portal": "0.1.5-rc.43",
|
|
27
|
+
"@radix-ui/react-presence": "0.1.3-rc.43",
|
|
28
|
+
"@radix-ui/react-primitive": "0.1.5-rc.43",
|
|
29
|
+
"@radix-ui/react-slot": "0.1.3-rc.43",
|
|
30
|
+
"@radix-ui/react-use-controllable-state": "0.1.1-rc.43",
|
|
31
|
+
"@radix-ui/react-visually-hidden": "0.1.5-rc.43"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "^16.8 || ^17.0 || ^18.0",
|