@huin-core/react-tooltip 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +68 -75
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +68 -75
- package/dist/index.mjs.map +3 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { Portal } from '@huin-core/react-portal';
|
|
4
4
|
import * as PopperPrimitive from '@huin-core/react-popper';
|
|
@@ -11,7 +11,7 @@ interface TooltipTriggerProps extends PrimitiveButtonProps {
|
|
|
11
11
|
declare const TooltipTrigger: React__default.ForwardRefExoticComponent<TooltipTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
|
|
13
13
|
interface TooltipProps {
|
|
14
|
-
children?: React
|
|
14
|
+
children?: React.ReactNode;
|
|
15
15
|
open?: boolean;
|
|
16
16
|
defaultOpen?: boolean;
|
|
17
17
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -27,12 +27,12 @@ interface TooltipProps {
|
|
|
27
27
|
*/
|
|
28
28
|
disableHoverableContent?: boolean;
|
|
29
29
|
}
|
|
30
|
-
declare const Tooltip: React
|
|
31
|
-
declare const Root: React
|
|
30
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
31
|
+
declare const Root: React.FC<TooltipProps>;
|
|
32
32
|
|
|
33
|
-
type PortalProps =
|
|
33
|
+
type PortalProps = React__default.ComponentPropsWithoutRef<typeof Portal>;
|
|
34
34
|
interface TooltipPortalProps {
|
|
35
|
-
children?:
|
|
35
|
+
children?: React__default.ReactNode;
|
|
36
36
|
/**
|
|
37
37
|
* Specify a container element to portal the content into.
|
|
38
38
|
*/
|
|
@@ -43,7 +43,7 @@ interface TooltipPortalProps {
|
|
|
43
43
|
*/
|
|
44
44
|
forceMount?: true;
|
|
45
45
|
}
|
|
46
|
-
declare const TooltipPortal:
|
|
46
|
+
declare const TooltipPortal: React__default.FC<TooltipPortalProps>;
|
|
47
47
|
|
|
48
48
|
interface TooltipContentProps extends TooltipContentImplProps {
|
|
49
49
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { Portal } from '@huin-core/react-portal';
|
|
4
4
|
import * as PopperPrimitive from '@huin-core/react-popper';
|
|
@@ -11,7 +11,7 @@ interface TooltipTriggerProps extends PrimitiveButtonProps {
|
|
|
11
11
|
declare const TooltipTrigger: React__default.ForwardRefExoticComponent<TooltipTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
|
|
13
13
|
interface TooltipProps {
|
|
14
|
-
children?: React
|
|
14
|
+
children?: React.ReactNode;
|
|
15
15
|
open?: boolean;
|
|
16
16
|
defaultOpen?: boolean;
|
|
17
17
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -27,12 +27,12 @@ interface TooltipProps {
|
|
|
27
27
|
*/
|
|
28
28
|
disableHoverableContent?: boolean;
|
|
29
29
|
}
|
|
30
|
-
declare const Tooltip: React
|
|
31
|
-
declare const Root: React
|
|
30
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
31
|
+
declare const Root: React.FC<TooltipProps>;
|
|
32
32
|
|
|
33
|
-
type PortalProps =
|
|
33
|
+
type PortalProps = React__default.ComponentPropsWithoutRef<typeof Portal>;
|
|
34
34
|
interface TooltipPortalProps {
|
|
35
|
-
children?:
|
|
35
|
+
children?: React__default.ReactNode;
|
|
36
36
|
/**
|
|
37
37
|
* Specify a container element to portal the content into.
|
|
38
38
|
*/
|
|
@@ -43,7 +43,7 @@ interface TooltipPortalProps {
|
|
|
43
43
|
*/
|
|
44
44
|
forceMount?: true;
|
|
45
45
|
}
|
|
46
|
-
declare const TooltipPortal:
|
|
46
|
+
declare const TooltipPortal: React__default.FC<TooltipPortalProps>;
|
|
47
47
|
|
|
48
48
|
interface TooltipContentProps extends TooltipContentImplProps {
|
|
49
49
|
/**
|
package/dist/index.js
CHANGED
|
@@ -52,7 +52,6 @@ var import_react_use_controllable_state = require("@huin-core/react-use-controll
|
|
|
52
52
|
var import_react_context = require("@huin-core/react-context");
|
|
53
53
|
var import_react_popper = require("@huin-core/react-popper");
|
|
54
54
|
var import_react = __toESM(require("react"));
|
|
55
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
56
55
|
var [createTooltipContext, createTooltipScope] = (0, import_react_context.createContextScope)(
|
|
57
56
|
"Tooltip",
|
|
58
57
|
[import_react_popper.createPopperScope]
|
|
@@ -75,7 +74,7 @@ var TooltipProvider = (props) => {
|
|
|
75
74
|
const skipDelayTimer = skipDelayTimerRef.current;
|
|
76
75
|
return () => window.clearTimeout(skipDelayTimer);
|
|
77
76
|
}, []);
|
|
78
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
79
78
|
TooltipProviderContextProvider,
|
|
80
79
|
{
|
|
81
80
|
scope: __scopeTooltip,
|
|
@@ -96,15 +95,14 @@ var TooltipProvider = (props) => {
|
|
|
96
95
|
onPointerInTransitChange: import_react.default.useCallback((inTransit) => {
|
|
97
96
|
isPointerInTransitRef.current = inTransit;
|
|
98
97
|
}, []),
|
|
99
|
-
disableHoverableContent
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
disableHoverableContent
|
|
99
|
+
},
|
|
100
|
+
children
|
|
102
101
|
);
|
|
103
102
|
};
|
|
104
103
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
105
104
|
|
|
106
105
|
// packages/react/tooltip/src/Tooltip.tsx
|
|
107
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
108
106
|
var usePopperScope = (0, import_react_popper2.createPopperScope)();
|
|
109
107
|
var TOOLTIP_OPEN = "tooltip.open";
|
|
110
108
|
var TOOLTIP_NAME = "Tooltip";
|
|
@@ -165,7 +163,7 @@ var Tooltip = (props) => {
|
|
|
165
163
|
React2.useEffect(() => {
|
|
166
164
|
return () => window.clearTimeout(openTimerRef.current);
|
|
167
165
|
}, []);
|
|
168
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ React2.createElement(PopperPrimitive.Root, { ...popperScope }, /* @__PURE__ */ React2.createElement(
|
|
169
167
|
TooltipContextProvider,
|
|
170
168
|
{
|
|
171
169
|
scope: __scopeTooltip,
|
|
@@ -187,18 +185,18 @@ var Tooltip = (props) => {
|
|
|
187
185
|
}, [handleClose, disableHoverableContent]),
|
|
188
186
|
onOpen: handleOpen,
|
|
189
187
|
onClose: handleClose,
|
|
190
|
-
disableHoverableContent
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)
|
|
188
|
+
disableHoverableContent
|
|
189
|
+
},
|
|
190
|
+
children
|
|
191
|
+
));
|
|
194
192
|
};
|
|
195
193
|
Tooltip.displayName = TOOLTIP_NAME;
|
|
196
194
|
var Root2 = Tooltip;
|
|
197
195
|
|
|
198
196
|
// packages/react/tooltip/src/TooltipPortal.tsx
|
|
197
|
+
var import_react2 = __toESM(require("react"));
|
|
199
198
|
var import_react_presence = require("@huin-core/react-presence");
|
|
200
199
|
var import_react_portal = require("@huin-core/react-portal");
|
|
201
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
202
200
|
var PORTAL_NAME = "TooltipPortal";
|
|
203
201
|
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
204
202
|
forceMount: void 0
|
|
@@ -206,43 +204,42 @@ var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
|
206
204
|
var TooltipPortal = (props) => {
|
|
207
205
|
const { __scopeTooltip, forceMount, children, container } = props;
|
|
208
206
|
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
|
|
209
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ import_react2.default.createElement(PortalProvider, { scope: __scopeTooltip, forceMount }, /* @__PURE__ */ import_react2.default.createElement(import_react_presence.Presence, { present: forceMount || context.open }, /* @__PURE__ */ import_react2.default.createElement(import_react_portal.Portal, { asChild: true, container }, children)));
|
|
210
208
|
};
|
|
211
209
|
TooltipPortal.displayName = PORTAL_NAME;
|
|
212
210
|
|
|
213
211
|
// packages/react/tooltip/src/TooltipContent.tsx
|
|
214
|
-
var
|
|
212
|
+
var import_react3 = __toESM(require("react"));
|
|
215
213
|
var import_react_presence2 = require("@huin-core/react-presence");
|
|
216
214
|
var import_react_compose_refs = require("@huin-core/react-compose-refs");
|
|
217
215
|
var import_react_slot = require("@huin-core/react-slot");
|
|
218
216
|
var VisuallyHiddenPrimitive = __toESM(require("@huin-core/react-visually-hidden"));
|
|
219
217
|
var PopperPrimitive2 = __toESM(require("@huin-core/react-popper"));
|
|
220
218
|
var import_react_dismissable_layer = require("@huin-core/react-dismissable-layer");
|
|
221
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
222
219
|
var CONTENT_NAME = "TooltipContent";
|
|
223
|
-
var TooltipContent =
|
|
220
|
+
var TooltipContent = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
224
221
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
225
222
|
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
226
223
|
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
227
|
-
return /* @__PURE__ */
|
|
224
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react_presence2.Presence, { present: forceMount || context.open }, context.disableHoverableContent ? /* @__PURE__ */ import_react3.default.createElement(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ import_react3.default.createElement(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }));
|
|
228
225
|
});
|
|
229
|
-
var TooltipContentHoverable =
|
|
226
|
+
var TooltipContentHoverable = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
230
227
|
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
231
228
|
const providerContext = useTooltipProviderContext(
|
|
232
229
|
CONTENT_NAME,
|
|
233
230
|
props.__scopeTooltip
|
|
234
231
|
);
|
|
235
|
-
const ref =
|
|
232
|
+
const ref = import_react3.default.useRef(null);
|
|
236
233
|
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
237
|
-
const [pointerGraceArea, setPointerGraceArea] =
|
|
234
|
+
const [pointerGraceArea, setPointerGraceArea] = import_react3.default.useState(null);
|
|
238
235
|
const { trigger, onClose } = context;
|
|
239
236
|
const content = ref.current;
|
|
240
237
|
const { onPointerInTransitChange } = providerContext;
|
|
241
|
-
const handleRemoveGraceArea =
|
|
238
|
+
const handleRemoveGraceArea = import_react3.default.useCallback(() => {
|
|
242
239
|
setPointerGraceArea(null);
|
|
243
240
|
onPointerInTransitChange(false);
|
|
244
241
|
}, [onPointerInTransitChange]);
|
|
245
|
-
const handleCreateGraceArea =
|
|
242
|
+
const handleCreateGraceArea = import_react3.default.useCallback(
|
|
246
243
|
(event, hoverTarget) => {
|
|
247
244
|
const currentTarget = event.currentTarget;
|
|
248
245
|
const exitPoint = { x: event.clientX, y: event.clientY };
|
|
@@ -260,10 +257,10 @@ var TooltipContentHoverable = import_react2.default.forwardRef((props, forwarded
|
|
|
260
257
|
},
|
|
261
258
|
[onPointerInTransitChange]
|
|
262
259
|
);
|
|
263
|
-
|
|
260
|
+
import_react3.default.useEffect(() => {
|
|
264
261
|
return () => handleRemoveGraceArea();
|
|
265
262
|
}, [handleRemoveGraceArea]);
|
|
266
|
-
|
|
263
|
+
import_react3.default.useEffect(() => {
|
|
267
264
|
if (trigger && content) {
|
|
268
265
|
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
269
266
|
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
@@ -275,7 +272,7 @@ var TooltipContentHoverable = import_react2.default.forwardRef((props, forwarded
|
|
|
275
272
|
};
|
|
276
273
|
}
|
|
277
274
|
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
|
|
278
|
-
|
|
275
|
+
import_react3.default.useEffect(() => {
|
|
279
276
|
if (pointerGraceArea) {
|
|
280
277
|
const handleTrackPointerGrace = (event) => {
|
|
281
278
|
const target = event.target;
|
|
@@ -296,13 +293,13 @@ var TooltipContentHoverable = import_react2.default.forwardRef((props, forwarded
|
|
|
296
293
|
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
297
294
|
}
|
|
298
295
|
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
299
|
-
return /* @__PURE__ */
|
|
296
|
+
return /* @__PURE__ */ import_react3.default.createElement(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
300
297
|
});
|
|
301
298
|
var [
|
|
302
299
|
VisuallyHiddenContentContextProvider,
|
|
303
300
|
useVisuallyHiddenContentContext
|
|
304
301
|
] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
305
|
-
var TooltipContentImpl =
|
|
302
|
+
var TooltipContentImpl = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
306
303
|
const {
|
|
307
304
|
__scopeTooltip,
|
|
308
305
|
children,
|
|
@@ -314,11 +311,11 @@ var TooltipContentImpl = import_react2.default.forwardRef((props, forwardedRef)
|
|
|
314
311
|
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
315
312
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
316
313
|
const { onClose } = context;
|
|
317
|
-
|
|
314
|
+
import_react3.default.useEffect(() => {
|
|
318
315
|
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
319
316
|
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
320
317
|
}, [onClose]);
|
|
321
|
-
|
|
318
|
+
import_react3.default.useEffect(() => {
|
|
322
319
|
if (context.trigger) {
|
|
323
320
|
const handleScroll = (event) => {
|
|
324
321
|
const target = event.target;
|
|
@@ -328,7 +325,7 @@ var TooltipContentImpl = import_react2.default.forwardRef((props, forwardedRef)
|
|
|
328
325
|
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
329
326
|
}
|
|
330
327
|
}, [context.trigger, onClose]);
|
|
331
|
-
return /* @__PURE__ */
|
|
328
|
+
return /* @__PURE__ */ import_react3.default.createElement(
|
|
332
329
|
import_react_dismissable_layer.DismissableLayer,
|
|
333
330
|
{
|
|
334
331
|
asChild: true,
|
|
@@ -336,39 +333,37 @@ var TooltipContentImpl = import_react2.default.forwardRef((props, forwardedRef)
|
|
|
336
333
|
onEscapeKeyDown,
|
|
337
334
|
onPointerDownOutside,
|
|
338
335
|
onFocusOutside: (event) => event.preventDefault(),
|
|
339
|
-
onDismiss: onClose
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
children: [
|
|
359
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_slot.Slottable, { children }),
|
|
360
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
361
|
-
VisuallyHiddenContentContextProvider,
|
|
362
|
-
{
|
|
363
|
-
scope: __scopeTooltip,
|
|
364
|
-
isInside: true,
|
|
365
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VisuallyHiddenPrimitive.Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children })
|
|
366
|
-
}
|
|
367
|
-
)
|
|
368
|
-
]
|
|
336
|
+
onDismiss: onClose
|
|
337
|
+
},
|
|
338
|
+
/* @__PURE__ */ import_react3.default.createElement(
|
|
339
|
+
PopperPrimitive2.Content,
|
|
340
|
+
{
|
|
341
|
+
"data-state": context.stateAttribute,
|
|
342
|
+
...popperScope,
|
|
343
|
+
...contentProps,
|
|
344
|
+
ref: forwardedRef,
|
|
345
|
+
style: {
|
|
346
|
+
...contentProps.style,
|
|
347
|
+
// re-namespace exposed content custom properties
|
|
348
|
+
...{
|
|
349
|
+
"--huin-core-tooltip-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
|
350
|
+
"--huin-core-tooltip-content-available-width": "var(--huin-core-popper-available-width)",
|
|
351
|
+
"--huin-core-tooltip-content-available-height": "var(--huin-core-popper-available-height)",
|
|
352
|
+
"--huin-core-tooltip-trigger-width": "var(--huin-core-popper-anchor-width)",
|
|
353
|
+
"--huin-core-tooltip-trigger-height": "var(--huin-core-popper-anchor-height)"
|
|
354
|
+
}
|
|
369
355
|
}
|
|
356
|
+
},
|
|
357
|
+
/* @__PURE__ */ import_react3.default.createElement(import_react_slot.Slottable, null, children),
|
|
358
|
+
/* @__PURE__ */ import_react3.default.createElement(
|
|
359
|
+
VisuallyHiddenContentContextProvider,
|
|
360
|
+
{
|
|
361
|
+
scope: __scopeTooltip,
|
|
362
|
+
isInside: true
|
|
363
|
+
},
|
|
364
|
+
/* @__PURE__ */ import_react3.default.createElement(VisuallyHiddenPrimitive.Root, { id: context.contentId, role: "tooltip" }, ariaLabel || children)
|
|
370
365
|
)
|
|
371
|
-
|
|
366
|
+
)
|
|
372
367
|
);
|
|
373
368
|
});
|
|
374
369
|
TooltipContent.displayName = CONTENT_NAME;
|
|
@@ -489,14 +484,13 @@ function getHullPresorted(points) {
|
|
|
489
484
|
}
|
|
490
485
|
|
|
491
486
|
// packages/react/tooltip/src/TooltipTrigger.tsx
|
|
492
|
-
var
|
|
487
|
+
var import_react4 = __toESM(require("react"));
|
|
493
488
|
var import_react_primitive = require("@huin-core/react-primitive");
|
|
494
489
|
var PopperPrimitive3 = __toESM(require("@huin-core/react-popper"));
|
|
495
490
|
var import_react_compose_refs2 = require("@huin-core/react-compose-refs");
|
|
496
491
|
var import_primitive = require("@huin-core/primitive");
|
|
497
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
498
492
|
var TRIGGER_NAME = "TooltipTrigger";
|
|
499
|
-
var TooltipTrigger =
|
|
493
|
+
var TooltipTrigger = import_react4.default.forwardRef((props, forwardedRef) => {
|
|
500
494
|
const { __scopeTooltip, ...triggerProps } = props;
|
|
501
495
|
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
502
496
|
const providerContext = useTooltipProviderContext(
|
|
@@ -504,22 +498,22 @@ var TooltipTrigger = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
|
504
498
|
__scopeTooltip
|
|
505
499
|
);
|
|
506
500
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
507
|
-
const ref =
|
|
501
|
+
const ref = import_react4.default.useRef(null);
|
|
508
502
|
const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(
|
|
509
503
|
forwardedRef,
|
|
510
504
|
ref,
|
|
511
505
|
context.onTriggerChange
|
|
512
506
|
);
|
|
513
|
-
const isPointerDownRef =
|
|
514
|
-
const hasPointerMoveOpenedRef =
|
|
515
|
-
const handlePointerUp =
|
|
507
|
+
const isPointerDownRef = import_react4.default.useRef(false);
|
|
508
|
+
const hasPointerMoveOpenedRef = import_react4.default.useRef(false);
|
|
509
|
+
const handlePointerUp = import_react4.default.useCallback(
|
|
516
510
|
() => isPointerDownRef.current = false,
|
|
517
511
|
[]
|
|
518
512
|
);
|
|
519
|
-
|
|
513
|
+
import_react4.default.useEffect(() => {
|
|
520
514
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
521
515
|
}, [handlePointerUp]);
|
|
522
|
-
return /* @__PURE__ */
|
|
516
|
+
return /* @__PURE__ */ import_react4.default.createElement(PopperPrimitive3.Anchor, { asChild: true, ...popperScope }, /* @__PURE__ */ import_react4.default.createElement(
|
|
523
517
|
import_react_primitive.Primitive.button,
|
|
524
518
|
{
|
|
525
519
|
"aria-describedby": context.open ? context.contentId : void 0,
|
|
@@ -549,16 +543,15 @@ var TooltipTrigger = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
|
549
543
|
onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, context.onClose),
|
|
550
544
|
onClick: (0, import_primitive.composeEventHandlers)(props.onClick, context.onClose)
|
|
551
545
|
}
|
|
552
|
-
)
|
|
546
|
+
));
|
|
553
547
|
});
|
|
554
548
|
TooltipTrigger.displayName = TRIGGER_NAME;
|
|
555
549
|
|
|
556
550
|
// packages/react/tooltip/src/TooltipArrow.tsx
|
|
557
551
|
var PopperPrimitive4 = __toESM(require("@huin-core/react-popper"));
|
|
558
|
-
var
|
|
559
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
552
|
+
var import_react5 = __toESM(require("react"));
|
|
560
553
|
var ARROW_NAME = "TooltipArrow";
|
|
561
|
-
var TooltipArrow =
|
|
554
|
+
var TooltipArrow = import_react5.default.forwardRef(
|
|
562
555
|
(props, forwardedRef) => {
|
|
563
556
|
const { __scopeTooltip, ...arrowProps } = props;
|
|
564
557
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
@@ -566,7 +559,7 @@ var TooltipArrow = import_react4.default.forwardRef(
|
|
|
566
559
|
ARROW_NAME,
|
|
567
560
|
__scopeTooltip
|
|
568
561
|
);
|
|
569
|
-
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */
|
|
562
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ import_react5.default.createElement(
|
|
570
563
|
PopperPrimitive4.Arrow,
|
|
571
564
|
{
|
|
572
565
|
...popperScope,
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/Tooltip.tsx", "../src/TooltipProvider.tsx", "../src/TooltipPortal.tsx", "../src/TooltipContent.tsx", "../src/TooltipTrigger.tsx", "../src/TooltipArrow.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\";\nexport { Tooltip, Root } from \"./Tooltip\";\nexport { TooltipPortal } from \"./TooltipPortal\";\nexport { TooltipContent } from \"./TooltipContent\";\nexport { TooltipProvider } from \"./TooltipProvider\";\nexport { TooltipTrigger } from \"./TooltipTrigger\";\nexport { TooltipArrow } from \"./TooltipArrow\";\n\nexport type { TooltipProps } from \"./Tooltip\";\nexport type { TooltipPortalProps } from \"./TooltipPortal\";\nexport type { TooltipContentProps } from \"./TooltipContent\";\nexport type { TooltipProviderProps } from \"./TooltipProvider\";\nexport type { TooltipTriggerProps } from \"./TooltipTrigger\";\nexport type { TooltipArrowProps } from \"./TooltipArrow\";\n", "import * as React from \"react\";\nimport { useId } from \"@huin-core/react-id\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { createPopperScope } from \"@huin-core/react-popper\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport { TooltipTriggerElement } from \"./TooltipTrigger\";\nimport { createTooltipContext, ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\n\nexport const usePopperScope = createPopperScope();\nexport const TOOLTIP_OPEN = \"tooltip.open\";\n\n/* -------------------------------------------------------------------------------------------------\n * Tooltip\n * -----------------------------------------------------------------------------------------------*/\n\nexport const 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\nexport const [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(\n TOOLTIP_NAME,\n props.__scopeTooltip\n );\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\n ? wasOpenDelayedRef.current\n ? \"delayed-open\"\n : \"instant-open\"\n : \"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\nconst Root = Tooltip;\n\nexport { Tooltip, Root };\nexport type { TooltipProps };\n", "import { createContextScope, Scope } from \"@huin-core/react-context\";\nimport { createPopperScope } from \"@huin-core/react-popper\";\nimport React from \"react\";\n\n\nexport type ScopedProps<P = {}> = P & { __scopeTooltip?: Scope };\nexport const [createTooltipContext, createTooltipScope] = createContextScope(\n \"Tooltip\",\n [createPopperScope]\n);\nconst PROVIDER_NAME = \"TooltipProvider\";\nconst DEFAULT_DELAY_DURATION = 700;\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\nexport const [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\nexport { TooltipProvider };\nexport type { TooltipProviderProps };\n", "import { Presence } from \"@huin-core/react-presence\";\nimport { useTooltipContext } from \"./Tooltip\";\nimport { Portal as PortalPrimitive } from \"@huin-core/react-portal\";\nimport { createTooltipContext, ScopedProps } from \"./TooltipProvider\";\n\nconst PORTAL_NAME = \"TooltipPortal\";\n\ntype PortalContextValue = { forceMount?: true };\nexport const [PortalProvider, usePortalContext] =\n createTooltipContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n });\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface TooltipPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps[\"container\"];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst TooltipPortal: React.FC<TooltipPortalProps> = (\n props: ScopedProps<TooltipPortalProps>\n) => {\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\nexport { TooltipPortal };\nexport type { TooltipPortalProps };\n", "import React from \"react\";\nimport {\n TOOLTIP_NAME,\n TOOLTIP_OPEN,\n usePopperScope,\n useTooltipContext,\n} from \"./Tooltip\";\nimport { usePortalContext } from \"./TooltipPortal\";\nimport { Presence } from \"@huin-core/react-presence\";\nimport { createTooltipContext, ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport { Slottable } from \"@huin-core/react-slot\";\nimport * as VisuallyHiddenPrimitive from \"@huin-core/react-visually-hidden\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { DismissableLayer } from \"@huin-core/react-dismissable-layer\";\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<\n TooltipContentElement,\n 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\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(\n CONTENT_NAME,\n props.__scopeTooltip\n );\n const ref = React.useRef<TooltipContentHoverableElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [pointerGraceArea, setPointerGraceArea] =\n 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(\n exitPoint,\n currentTarget.getBoundingClientRect()\n );\n const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);\n const hoverTargetPoints = getPointsFromRect(\n hoverTarget.getBoundingClientRect()\n );\n const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);\n setPointerGraceArea(graceArea);\n onPointerInTransitChange(true);\n },\n [onPointerInTransitChange]\n );\n\n React.useEffect(() => {\n return () => handleRemoveGraceArea();\n }, [handleRemoveGraceArea]);\n\n React.useEffect(() => {\n if (trigger && content) {\n const handleTriggerLeave = (event: PointerEvent) =>\n handleCreateGraceArea(event, content);\n const handleContentLeave = (event: PointerEvent) =>\n 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 =\n trigger?.contains(target) || content?.contains(target);\n const isPointerOutsideGraceArea = !isPointInPolygon(\n pointerPosition,\n pointerGraceArea\n );\n\n if (hasEnteredTarget) {\n handleRemoveGraceArea();\n } else if (isPointerOutsideGraceArea) {\n handleRemoveGraceArea();\n onClose();\n }\n };\n document.addEventListener(\"pointermove\", handleTrackPointerGrace);\n return () =>\n document.removeEventListener(\"pointermove\", handleTrackPointerGrace);\n }\n }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);\n\n return <TooltipContentImpl {...props} ref={composedRefs} />;\n});\n\nexport const [\n VisuallyHiddenContentContextProvider,\n useVisuallyHiddenContentContext,\n] = createTooltipContext(TOOLTIP_NAME, { isInside: false });\n\ntype TooltipContentImplElement = React.ElementRef<\n typeof PopperPrimitive.Content\n>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<\n typeof DismissableLayer\n>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<\n typeof PopperPrimitive.Content\n>;\ninterface TooltipContentImplProps extends Omit<PopperContentProps, \"onPlaced\"> {\n /**\n * A more descriptive label for accessibility purpose\n */\n \"aria-label\"?: string;\n\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps[\"onEscapeKeyDown\"];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `Tooltip`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps[\"onPointerDownOutside\"];\n}\n\nconst TooltipContentImpl = React.forwardRef<\n TooltipContentImplElement,\n 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 () =>\n window.removeEventListener(\"scroll\", handleScroll, { capture: true });\n }\n }, [context.trigger, onClose]);\n\n return (\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={(event) => event.preventDefault()}\n onDismiss={onClose}\n >\n <PopperPrimitive.Content\n data-state={context.stateAttribute}\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n \"--huin-core-tooltip-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-tooltip-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-tooltip-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-tooltip-trigger-width\": \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-tooltip-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n >\n <Slottable>{children}</Slottable>\n <VisuallyHiddenContentContextProvider\n scope={__scopeTooltip}\n isInside={true}\n >\n <VisuallyHiddenPrimitive.Root id={context.contentId} role=\"tooltip\">\n {ariaLabel || children}\n </VisuallyHiddenPrimitive.Root>\n </VisuallyHiddenContentContextProvider>\n </PopperPrimitive.Content>\n </DismissableLayer>\n );\n});\n\nTooltipContent.displayName = CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype Side = NonNullable<TooltipContentProps[\"side\"]>;\n\nfunction getExitSideFromRect(point: Point, rect: DOMRect): Side {\n const top = Math.abs(rect.top - point.y);\n const bottom = Math.abs(rect.bottom - point.y);\n const right = Math.abs(rect.right - point.x);\n const left = Math.abs(rect.left - point.x);\n\n switch (Math.min(top, bottom, right, left)) {\n case left:\n return \"left\";\n case right:\n return \"right\";\n case top:\n return \"top\";\n case bottom:\n return \"bottom\";\n default:\n throw new Error(\"unreachable\");\n }\n}\n\nfunction getPaddedExitPoints(exitPoint: Point, exitSide: Side, padding = 5) {\n const paddedExitPoints: Point[] = [];\n switch (exitSide) {\n case \"top\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y + padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case \"bottom\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y - padding }\n );\n break;\n case \"left\":\n paddedExitPoints.push(\n { x: exitPoint.x + padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case \"right\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x - padding, y: exitPoint.y + padding }\n );\n break;\n }\n return paddedExitPoints;\n}\n\nfunction getPointsFromRect(rect: DOMRect) {\n const { top, right, bottom, left } = rect;\n return [\n { x: left, y: top },\n { x: right, y: top },\n { x: right, y: bottom },\n { x: left, y: bottom },\n ];\n}\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\n// Returns a new array of points representing the convex hull of the given set of points.\n// https://www.nayuki.io/page/convex-hull-algorithm\nfunction getHull<P extends Point>(points: Readonly<Array<P>>): Array<P> {\n const newPoints: Array<P> = points.slice();\n newPoints.sort((a: Point, b: Point) => {\n if (a.x < b.x) return -1;\n else if (a.x > b.x) return +1;\n else if (a.y < b.y) return -1;\n else if (a.y > b.y) return +1;\n else return 0;\n });\n return getHullPresorted(newPoints);\n}\n\n// Returns the convex hull, assuming that each points[i] <= points[i + 1]. Runs in O(n) time.\nfunction getHullPresorted<P extends Point>(\n points: Readonly<Array<P>>\n): 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))\n 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))\n 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\nexport { TooltipContent };\nexport type { TooltipContentProps };\n", "import React from \"react\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { usePopperScope, useTooltipContext } from \"./Tooltip\";\nimport { ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst TRIGGER_NAME = \"TooltipTrigger\";\n\nexport type TooltipTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<\n typeof Primitive.button\n>;\ninterface TooltipTriggerProps extends PrimitiveButtonProps {}\n\nconst TooltipTrigger = React.forwardRef<\n TooltipTriggerElement,\n TooltipTriggerProps\n>((props: ScopedProps<TooltipTriggerProps>, forwardedRef) => {\n const { __scopeTooltip, ...triggerProps } = props;\n const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);\n const providerContext = useTooltipProviderContext(\n TRIGGER_NAME,\n __scopeTooltip\n );\n const popperScope = usePopperScope(__scopeTooltip);\n const ref = React.useRef<TooltipTriggerElement>(null);\n const composedRefs = useComposedRefs(\n forwardedRef,\n ref,\n context.onTriggerChange\n );\n const isPointerDownRef = React.useRef(false);\n const hasPointerMoveOpenedRef = React.useRef(false);\n const handlePointerUp = React.useCallback(\n () => (isPointerDownRef.current = false),\n []\n );\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, {\n once: true,\n });\n })}\n onFocus={composeEventHandlers(props.onFocus, () => {\n if (!isPointerDownRef.current) context.onOpen();\n })}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n onClick={composeEventHandlers(props.onClick, context.onClose)}\n />\n </PopperPrimitive.Anchor>\n );\n});\n\nTooltipTrigger.displayName = TRIGGER_NAME;\n\nexport { TooltipTrigger };\nexport type { TooltipTriggerProps };\n", "import * as PopperPrimitive from \"@huin-core/react-popper\";\nimport React from \"react\";\nimport { usePopperScope } from \"./Tooltip\";\nimport { useVisuallyHiddenContentContext } from \"./TooltipContent\";\nimport { ScopedProps } from \"./TooltipProvider\";\n\nconst ARROW_NAME = \"TooltipArrow\";\n\ntype TooltipArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<\n typeof PopperPrimitive.Arrow\n>;\ninterface TooltipArrowProps extends PopperArrowProps {}\n\nconst TooltipArrow = React.forwardRef<TooltipArrowElement, TooltipArrowProps>(\n (props: ScopedProps<TooltipArrowProps>, forwardedRef) => {\n const { __scopeTooltip, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeTooltip);\n const visuallyHiddenContentContext = useVisuallyHiddenContentContext(\n ARROW_NAME,\n __scopeTooltip\n );\n // if the arrow is inside the `VisuallyHidden`, we don't want to render it all to\n // prevent issues in positioning the arrow due to the duplicate\n return visuallyHiddenContentContext.isInside ? null : (\n <PopperPrimitive.Arrow\n {...popperScope}\n {...arrowProps}\n ref={forwardedRef}\n />\n );\n }\n);\n\nTooltipArrow.displayName = ARROW_NAME;\n\nexport { TooltipArrow };\nexport type { TooltipArrowProps };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,cAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAC,SAAuB;AACvB,sBAAsB;AACtB,sBAAiC;AACjC,IAAAC,uBAAkC;AAClC,0CAAqC;;;ACJrC,2BAA0C;AAC1C,0BAAkC;AAClC,mBAAkB;AA+Dd;AA3DG,IAAM,CAAC,sBAAsB,kBAAkB,QAAI;AAAA,EACxD;AAAA,EACA,CAAC,qCAAiB;AACpB;AACA,IAAM,gBAAgB;AACtB,IAAM,yBAAyB;AAYxB,IAAM,CAAC,gCAAgC,yBAAyB,IACrE,qBAAkD,aAAa;AAqBjE,IAAM,kBAAkD,CACtD,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,IAC1B;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,eAAe,gBAAgB,IAAI,aAAAC,QAAM,SAAS,IAAI;AAC7D,QAAM,wBAAwB,aAAAA,QAAM,OAAO,KAAK;AAChD,QAAM,oBAAoB,aAAAA,QAAM,OAAO,CAAC;AAExC,eAAAA,QAAM,UAAU,MAAM;AACpB,UAAM,iBAAiB,kBAAkB;AACzC,WAAO,MAAM,OAAO,aAAa,cAAc;AAAA,EACjD,GAAG,CAAC,CAAC;AAEL,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AM;AAC/D,gBAAQ,eAAe;AACvB,gCAAwB,UAAU;AAAA,MACpC,CAAC;AAAA,MACD,mBAAe,uCAAqB,MAAM,eAAe,MAAM;AAC7D,yBAAiB,UAAU;AAC3B,iBAAS,iBAAiB,aAAa,iBAAiB;AAAA,UACtD,MAAM;AAAA,QACR,CAAC;AAAA,MACH,CAAC;AAAA,MACD,aAAS,uCAAqB,MAAM,SAAS,MAAM;AACjD,YAAI,CAAC,iBAAiB,QAAS,SAAQ,OAAO;AAAA,MAChD,CAAC;AAAA,MACD,YAAQ,uCAAqB,MAAM,QAAQ,QAAQ,OAAO;AAAA,MAC1D,aAAS,uCAAqB,MAAM,SAAS,QAAQ,OAAO;AAAA;AAAA,EAC9D,GACF;AAEJ,CAAC;AAED,eAAe,cAAc;;;ACnF7B,IAAAC,mBAAiC;AACjC,IAAAC,gBAAkB;AAwBZ,IAAAC,sBAAA;AAnBN,IAAM,aAAa;AAQnB,IAAM,eAAe,cAAAC,QAAM;AAAA,EACzB,CAAC,OAAuC,iBAAiB;AACvD,UAAM,EAAE,gBAAgB,GAAG,WAAW,IAAI;AAC1C,UAAM,cAAc,eAAe,cAAc;AACjD,UAAM,+BAA+B;AAAA,MACnC;AAAA,MACA;AAAA,IACF;AAGA,WAAO,6BAA6B,WAAW,OAC7C;AAAA,MAAiB;AAAA,MAAhB;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACJ,KAAK;AAAA;AAAA,IACP;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;",
|
|
6
|
-
"names": ["Root", "React", "import_react_popper", "React", "
|
|
4
|
+
"sourcesContent": ["\"use client\";\nexport { Tooltip, Root } from \"./Tooltip\";\nexport { TooltipPortal } from \"./TooltipPortal\";\nexport { TooltipContent } from \"./TooltipContent\";\nexport { TooltipProvider } from \"./TooltipProvider\";\nexport { TooltipTrigger } from \"./TooltipTrigger\";\nexport { TooltipArrow } from \"./TooltipArrow\";\n\nexport type { TooltipProps } from \"./Tooltip\";\nexport type { TooltipPortalProps } from \"./TooltipPortal\";\nexport type { TooltipContentProps } from \"./TooltipContent\";\nexport type { TooltipProviderProps } from \"./TooltipProvider\";\nexport type { TooltipTriggerProps } from \"./TooltipTrigger\";\nexport type { TooltipArrowProps } from \"./TooltipArrow\";\n", "import * as React from \"react\";\nimport { useId } from \"@huin-core/react-id\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { createPopperScope } from \"@huin-core/react-popper\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport { TooltipTriggerElement } from \"./TooltipTrigger\";\nimport { createTooltipContext, ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\n\nexport const usePopperScope = createPopperScope();\nexport const TOOLTIP_OPEN = \"tooltip.open\";\n\n/* -------------------------------------------------------------------------------------------------\n * Tooltip\n * -----------------------------------------------------------------------------------------------*/\n\nexport const 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\nexport const [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(\n TOOLTIP_NAME,\n props.__scopeTooltip\n );\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\n ? wasOpenDelayedRef.current\n ? \"delayed-open\"\n : \"instant-open\"\n : \"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\nconst Root = Tooltip;\n\nexport { Tooltip, Root };\nexport type { TooltipProps };\n", "import { createContextScope, Scope } from \"@huin-core/react-context\";\nimport { createPopperScope } from \"@huin-core/react-popper\";\nimport React from \"react\";\n\n\nexport type ScopedProps<P = {}> = P & { __scopeTooltip?: Scope };\nexport const [createTooltipContext, createTooltipScope] = createContextScope(\n \"Tooltip\",\n [createPopperScope]\n);\nconst PROVIDER_NAME = \"TooltipProvider\";\nconst DEFAULT_DELAY_DURATION = 700;\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\nexport const [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\nexport { TooltipProvider };\nexport type { TooltipProviderProps };\n", "import React from \"react\";\nimport { Presence } from \"@huin-core/react-presence\";\nimport { useTooltipContext } from \"./Tooltip\";\nimport { Portal as PortalPrimitive } from \"@huin-core/react-portal\";\nimport { createTooltipContext, ScopedProps } from \"./TooltipProvider\";\n\nconst PORTAL_NAME = \"TooltipPortal\";\n\ntype PortalContextValue = { forceMount?: true };\nexport const [PortalProvider, usePortalContext] =\n createTooltipContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n });\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface TooltipPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps[\"container\"];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst TooltipPortal: React.FC<TooltipPortalProps> = (\n props: ScopedProps<TooltipPortalProps>\n) => {\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\nexport { TooltipPortal };\nexport type { TooltipPortalProps };\n", "import React from \"react\";\nimport {\n TOOLTIP_NAME,\n TOOLTIP_OPEN,\n usePopperScope,\n useTooltipContext,\n} from \"./Tooltip\";\nimport { usePortalContext } from \"./TooltipPortal\";\nimport { Presence } from \"@huin-core/react-presence\";\nimport { createTooltipContext, ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport { Slottable } from \"@huin-core/react-slot\";\nimport * as VisuallyHiddenPrimitive from \"@huin-core/react-visually-hidden\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { DismissableLayer } from \"@huin-core/react-dismissable-layer\";\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<\n TooltipContentElement,\n 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\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(\n CONTENT_NAME,\n props.__scopeTooltip\n );\n const ref = React.useRef<TooltipContentHoverableElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [pointerGraceArea, setPointerGraceArea] =\n 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(\n exitPoint,\n currentTarget.getBoundingClientRect()\n );\n const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);\n const hoverTargetPoints = getPointsFromRect(\n hoverTarget.getBoundingClientRect()\n );\n const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);\n setPointerGraceArea(graceArea);\n onPointerInTransitChange(true);\n },\n [onPointerInTransitChange]\n );\n\n React.useEffect(() => {\n return () => handleRemoveGraceArea();\n }, [handleRemoveGraceArea]);\n\n React.useEffect(() => {\n if (trigger && content) {\n const handleTriggerLeave = (event: PointerEvent) =>\n handleCreateGraceArea(event, content);\n const handleContentLeave = (event: PointerEvent) =>\n 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 =\n trigger?.contains(target) || content?.contains(target);\n const isPointerOutsideGraceArea = !isPointInPolygon(\n pointerPosition,\n pointerGraceArea\n );\n\n if (hasEnteredTarget) {\n handleRemoveGraceArea();\n } else if (isPointerOutsideGraceArea) {\n handleRemoveGraceArea();\n onClose();\n }\n };\n document.addEventListener(\"pointermove\", handleTrackPointerGrace);\n return () =>\n document.removeEventListener(\"pointermove\", handleTrackPointerGrace);\n }\n }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);\n\n return <TooltipContentImpl {...props} ref={composedRefs} />;\n});\n\nexport const [\n VisuallyHiddenContentContextProvider,\n useVisuallyHiddenContentContext,\n] = createTooltipContext(TOOLTIP_NAME, { isInside: false });\n\ntype TooltipContentImplElement = React.ElementRef<\n typeof PopperPrimitive.Content\n>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<\n typeof DismissableLayer\n>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<\n typeof PopperPrimitive.Content\n>;\ninterface TooltipContentImplProps extends Omit<PopperContentProps, \"onPlaced\"> {\n /**\n * A more descriptive label for accessibility purpose\n */\n \"aria-label\"?: string;\n\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps[\"onEscapeKeyDown\"];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `Tooltip`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps[\"onPointerDownOutside\"];\n}\n\nconst TooltipContentImpl = React.forwardRef<\n TooltipContentImplElement,\n 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 () =>\n window.removeEventListener(\"scroll\", handleScroll, { capture: true });\n }\n }, [context.trigger, onClose]);\n\n return (\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={(event) => event.preventDefault()}\n onDismiss={onClose}\n >\n <PopperPrimitive.Content\n data-state={context.stateAttribute}\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n \"--huin-core-tooltip-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-tooltip-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-tooltip-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-tooltip-trigger-width\": \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-tooltip-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n >\n <Slottable>{children}</Slottable>\n <VisuallyHiddenContentContextProvider\n scope={__scopeTooltip}\n isInside={true}\n >\n <VisuallyHiddenPrimitive.Root id={context.contentId} role=\"tooltip\">\n {ariaLabel || children}\n </VisuallyHiddenPrimitive.Root>\n </VisuallyHiddenContentContextProvider>\n </PopperPrimitive.Content>\n </DismissableLayer>\n );\n});\n\nTooltipContent.displayName = CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype Side = NonNullable<TooltipContentProps[\"side\"]>;\n\nfunction getExitSideFromRect(point: Point, rect: DOMRect): Side {\n const top = Math.abs(rect.top - point.y);\n const bottom = Math.abs(rect.bottom - point.y);\n const right = Math.abs(rect.right - point.x);\n const left = Math.abs(rect.left - point.x);\n\n switch (Math.min(top, bottom, right, left)) {\n case left:\n return \"left\";\n case right:\n return \"right\";\n case top:\n return \"top\";\n case bottom:\n return \"bottom\";\n default:\n throw new Error(\"unreachable\");\n }\n}\n\nfunction getPaddedExitPoints(exitPoint: Point, exitSide: Side, padding = 5) {\n const paddedExitPoints: Point[] = [];\n switch (exitSide) {\n case \"top\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y + padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case \"bottom\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y - padding }\n );\n break;\n case \"left\":\n paddedExitPoints.push(\n { x: exitPoint.x + padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case \"right\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x - padding, y: exitPoint.y + padding }\n );\n break;\n }\n return paddedExitPoints;\n}\n\nfunction getPointsFromRect(rect: DOMRect) {\n const { top, right, bottom, left } = rect;\n return [\n { x: left, y: top },\n { x: right, y: top },\n { x: right, y: bottom },\n { x: left, y: bottom },\n ];\n}\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\n// Returns a new array of points representing the convex hull of the given set of points.\n// https://www.nayuki.io/page/convex-hull-algorithm\nfunction getHull<P extends Point>(points: Readonly<Array<P>>): Array<P> {\n const newPoints: Array<P> = points.slice();\n newPoints.sort((a: Point, b: Point) => {\n if (a.x < b.x) return -1;\n else if (a.x > b.x) return +1;\n else if (a.y < b.y) return -1;\n else if (a.y > b.y) return +1;\n else return 0;\n });\n return getHullPresorted(newPoints);\n}\n\n// Returns the convex hull, assuming that each points[i] <= points[i + 1]. Runs in O(n) time.\nfunction getHullPresorted<P extends Point>(\n points: Readonly<Array<P>>\n): 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))\n 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))\n 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\nexport { TooltipContent };\nexport type { TooltipContentProps };\n", "import React from \"react\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { usePopperScope, useTooltipContext } from \"./Tooltip\";\nimport { ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst TRIGGER_NAME = \"TooltipTrigger\";\n\nexport type TooltipTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<\n typeof Primitive.button\n>;\ninterface TooltipTriggerProps extends PrimitiveButtonProps {}\n\nconst TooltipTrigger = React.forwardRef<\n TooltipTriggerElement,\n TooltipTriggerProps\n>((props: ScopedProps<TooltipTriggerProps>, forwardedRef) => {\n const { __scopeTooltip, ...triggerProps } = props;\n const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);\n const providerContext = useTooltipProviderContext(\n TRIGGER_NAME,\n __scopeTooltip\n );\n const popperScope = usePopperScope(__scopeTooltip);\n const ref = React.useRef<TooltipTriggerElement>(null);\n const composedRefs = useComposedRefs(\n forwardedRef,\n ref,\n context.onTriggerChange\n );\n const isPointerDownRef = React.useRef(false);\n const hasPointerMoveOpenedRef = React.useRef(false);\n const handlePointerUp = React.useCallback(\n () => (isPointerDownRef.current = false),\n []\n );\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, {\n once: true,\n });\n })}\n onFocus={composeEventHandlers(props.onFocus, () => {\n if (!isPointerDownRef.current) context.onOpen();\n })}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n onClick={composeEventHandlers(props.onClick, context.onClose)}\n />\n </PopperPrimitive.Anchor>\n );\n});\n\nTooltipTrigger.displayName = TRIGGER_NAME;\n\nexport { TooltipTrigger };\nexport type { TooltipTriggerProps };\n", "import * as PopperPrimitive from \"@huin-core/react-popper\";\nimport React from \"react\";\nimport { usePopperScope } from \"./Tooltip\";\nimport { useVisuallyHiddenContentContext } from \"./TooltipContent\";\nimport { ScopedProps } from \"./TooltipProvider\";\n\nconst ARROW_NAME = \"TooltipArrow\";\n\ntype TooltipArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<\n typeof PopperPrimitive.Arrow\n>;\ninterface TooltipArrowProps extends PopperArrowProps {}\n\nconst TooltipArrow = React.forwardRef<TooltipArrowElement, TooltipArrowProps>(\n (props: ScopedProps<TooltipArrowProps>, forwardedRef) => {\n const { __scopeTooltip, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeTooltip);\n const visuallyHiddenContentContext = useVisuallyHiddenContentContext(\n ARROW_NAME,\n __scopeTooltip\n );\n // if the arrow is inside the `VisuallyHidden`, we don't want to render it all to\n // prevent issues in positioning the arrow due to the duplicate\n return visuallyHiddenContentContext.isInside ? null : (\n <PopperPrimitive.Arrow\n {...popperScope}\n {...arrowProps}\n ref={forwardedRef}\n />\n );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BAAiB,aAAa,iBAAiB;AAAA,UACtD,MAAM;AAAA,QACR,CAAC;AAAA,MACH,CAAC;AAAA,MACD,aAAS,uCAAqB,MAAM,SAAS,MAAM;AACjD,YAAI,CAAC,iBAAiB,QAAS,SAAQ,OAAO;AAAA,MAChD,CAAC;AAAA,MACD,YAAQ,uCAAqB,MAAM,QAAQ,QAAQ,OAAO;AAAA,MAC1D,aAAS,uCAAqB,MAAM,SAAS,QAAQ,OAAO;AAAA;AAAA,EAC9D,CACF;AAEJ,CAAC;AAED,eAAe,cAAc;;;ACnF7B,IAAAC,mBAAiC;AACjC,IAAAC,gBAAkB;AAKlB,IAAM,aAAa;AAQnB,IAAM,eAAe,cAAAC,QAAM;AAAA,EACzB,CAAC,OAAuC,iBAAiB;AACvD,UAAM,EAAE,gBAAgB,GAAG,WAAW,IAAI;AAC1C,UAAM,cAAc,eAAe,cAAc;AACjD,UAAM,+BAA+B;AAAA,MACnC;AAAA,MACA;AAAA,IACF;AAGA,WAAO,6BAA6B,WAAW,OAC7C,8BAAAA,QAAA;AAAA,MAAiB;AAAA,MAAhB;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACJ,KAAK;AAAA;AAAA,IACP;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;",
|
|
6
|
+
"names": ["Root", "React", "import_react_popper", "React", "open", "Root", "import_react", "React", "PortalPrimitive", "import_react", "import_react_presence", "PopperPrimitive", "React", "import_react", "PopperPrimitive", "import_react_compose_refs", "React", "PopperPrimitive", "import_react", "React"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,6 @@ import { useControllableState } from "@huin-core/react-use-controllable-state";
|
|
|
11
11
|
import { createContextScope } from "@huin-core/react-context";
|
|
12
12
|
import { createPopperScope } from "@huin-core/react-popper";
|
|
13
13
|
import React from "react";
|
|
14
|
-
import { jsx } from "react/jsx-runtime";
|
|
15
14
|
var [createTooltipContext, createTooltipScope] = createContextScope(
|
|
16
15
|
"Tooltip",
|
|
17
16
|
[createPopperScope]
|
|
@@ -34,7 +33,7 @@ var TooltipProvider = (props) => {
|
|
|
34
33
|
const skipDelayTimer = skipDelayTimerRef.current;
|
|
35
34
|
return () => window.clearTimeout(skipDelayTimer);
|
|
36
35
|
}, []);
|
|
37
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ React.createElement(
|
|
38
37
|
TooltipProviderContextProvider,
|
|
39
38
|
{
|
|
40
39
|
scope: __scopeTooltip,
|
|
@@ -55,15 +54,14 @@ var TooltipProvider = (props) => {
|
|
|
55
54
|
onPointerInTransitChange: React.useCallback((inTransit) => {
|
|
56
55
|
isPointerInTransitRef.current = inTransit;
|
|
57
56
|
}, []),
|
|
58
|
-
disableHoverableContent
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
disableHoverableContent
|
|
58
|
+
},
|
|
59
|
+
children
|
|
61
60
|
);
|
|
62
61
|
};
|
|
63
62
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
64
63
|
|
|
65
64
|
// packages/react/tooltip/src/Tooltip.tsx
|
|
66
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
67
65
|
var usePopperScope = createPopperScope2();
|
|
68
66
|
var TOOLTIP_OPEN = "tooltip.open";
|
|
69
67
|
var TOOLTIP_NAME = "Tooltip";
|
|
@@ -124,7 +122,7 @@ var Tooltip = (props) => {
|
|
|
124
122
|
React2.useEffect(() => {
|
|
125
123
|
return () => window.clearTimeout(openTimerRef.current);
|
|
126
124
|
}, []);
|
|
127
|
-
return /* @__PURE__ */
|
|
125
|
+
return /* @__PURE__ */ React2.createElement(PopperPrimitive.Root, { ...popperScope }, /* @__PURE__ */ React2.createElement(
|
|
128
126
|
TooltipContextProvider,
|
|
129
127
|
{
|
|
130
128
|
scope: __scopeTooltip,
|
|
@@ -146,18 +144,18 @@ var Tooltip = (props) => {
|
|
|
146
144
|
}, [handleClose, disableHoverableContent]),
|
|
147
145
|
onOpen: handleOpen,
|
|
148
146
|
onClose: handleClose,
|
|
149
|
-
disableHoverableContent
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
)
|
|
147
|
+
disableHoverableContent
|
|
148
|
+
},
|
|
149
|
+
children
|
|
150
|
+
));
|
|
153
151
|
};
|
|
154
152
|
Tooltip.displayName = TOOLTIP_NAME;
|
|
155
153
|
var Root2 = Tooltip;
|
|
156
154
|
|
|
157
155
|
// packages/react/tooltip/src/TooltipPortal.tsx
|
|
156
|
+
import React3 from "react";
|
|
158
157
|
import { Presence } from "@huin-core/react-presence";
|
|
159
158
|
import { Portal as PortalPrimitive } from "@huin-core/react-portal";
|
|
160
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
161
159
|
var PORTAL_NAME = "TooltipPortal";
|
|
162
160
|
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
163
161
|
forceMount: void 0
|
|
@@ -165,43 +163,42 @@ var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
|
165
163
|
var TooltipPortal = (props) => {
|
|
166
164
|
const { __scopeTooltip, forceMount, children, container } = props;
|
|
167
165
|
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
|
|
168
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ React3.createElement(PortalProvider, { scope: __scopeTooltip, forceMount }, /* @__PURE__ */ React3.createElement(Presence, { present: forceMount || context.open }, /* @__PURE__ */ React3.createElement(PortalPrimitive, { asChild: true, container }, children)));
|
|
169
167
|
};
|
|
170
168
|
TooltipPortal.displayName = PORTAL_NAME;
|
|
171
169
|
|
|
172
170
|
// packages/react/tooltip/src/TooltipContent.tsx
|
|
173
|
-
import
|
|
171
|
+
import React4 from "react";
|
|
174
172
|
import { Presence as Presence2 } from "@huin-core/react-presence";
|
|
175
173
|
import { useComposedRefs } from "@huin-core/react-compose-refs";
|
|
176
174
|
import { Slottable } from "@huin-core/react-slot";
|
|
177
175
|
import * as VisuallyHiddenPrimitive from "@huin-core/react-visually-hidden";
|
|
178
176
|
import * as PopperPrimitive2 from "@huin-core/react-popper";
|
|
179
177
|
import { DismissableLayer } from "@huin-core/react-dismissable-layer";
|
|
180
|
-
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
181
178
|
var CONTENT_NAME = "TooltipContent";
|
|
182
|
-
var TooltipContent =
|
|
179
|
+
var TooltipContent = React4.forwardRef((props, forwardedRef) => {
|
|
183
180
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
184
181
|
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
185
182
|
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
186
|
-
return /* @__PURE__ */
|
|
183
|
+
return /* @__PURE__ */ React4.createElement(Presence2, { present: forceMount || context.open }, context.disableHoverableContent ? /* @__PURE__ */ React4.createElement(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ React4.createElement(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }));
|
|
187
184
|
});
|
|
188
|
-
var TooltipContentHoverable =
|
|
185
|
+
var TooltipContentHoverable = React4.forwardRef((props, forwardedRef) => {
|
|
189
186
|
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
190
187
|
const providerContext = useTooltipProviderContext(
|
|
191
188
|
CONTENT_NAME,
|
|
192
189
|
props.__scopeTooltip
|
|
193
190
|
);
|
|
194
|
-
const ref =
|
|
191
|
+
const ref = React4.useRef(null);
|
|
195
192
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
196
|
-
const [pointerGraceArea, setPointerGraceArea] =
|
|
193
|
+
const [pointerGraceArea, setPointerGraceArea] = React4.useState(null);
|
|
197
194
|
const { trigger, onClose } = context;
|
|
198
195
|
const content = ref.current;
|
|
199
196
|
const { onPointerInTransitChange } = providerContext;
|
|
200
|
-
const handleRemoveGraceArea =
|
|
197
|
+
const handleRemoveGraceArea = React4.useCallback(() => {
|
|
201
198
|
setPointerGraceArea(null);
|
|
202
199
|
onPointerInTransitChange(false);
|
|
203
200
|
}, [onPointerInTransitChange]);
|
|
204
|
-
const handleCreateGraceArea =
|
|
201
|
+
const handleCreateGraceArea = React4.useCallback(
|
|
205
202
|
(event, hoverTarget) => {
|
|
206
203
|
const currentTarget = event.currentTarget;
|
|
207
204
|
const exitPoint = { x: event.clientX, y: event.clientY };
|
|
@@ -219,10 +216,10 @@ var TooltipContentHoverable = React3.forwardRef((props, forwardedRef) => {
|
|
|
219
216
|
},
|
|
220
217
|
[onPointerInTransitChange]
|
|
221
218
|
);
|
|
222
|
-
|
|
219
|
+
React4.useEffect(() => {
|
|
223
220
|
return () => handleRemoveGraceArea();
|
|
224
221
|
}, [handleRemoveGraceArea]);
|
|
225
|
-
|
|
222
|
+
React4.useEffect(() => {
|
|
226
223
|
if (trigger && content) {
|
|
227
224
|
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
228
225
|
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
@@ -234,7 +231,7 @@ var TooltipContentHoverable = React3.forwardRef((props, forwardedRef) => {
|
|
|
234
231
|
};
|
|
235
232
|
}
|
|
236
233
|
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
|
|
237
|
-
|
|
234
|
+
React4.useEffect(() => {
|
|
238
235
|
if (pointerGraceArea) {
|
|
239
236
|
const handleTrackPointerGrace = (event) => {
|
|
240
237
|
const target = event.target;
|
|
@@ -255,13 +252,13 @@ var TooltipContentHoverable = React3.forwardRef((props, forwardedRef) => {
|
|
|
255
252
|
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
256
253
|
}
|
|
257
254
|
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
258
|
-
return /* @__PURE__ */
|
|
255
|
+
return /* @__PURE__ */ React4.createElement(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
259
256
|
});
|
|
260
257
|
var [
|
|
261
258
|
VisuallyHiddenContentContextProvider,
|
|
262
259
|
useVisuallyHiddenContentContext
|
|
263
260
|
] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
264
|
-
var TooltipContentImpl =
|
|
261
|
+
var TooltipContentImpl = React4.forwardRef((props, forwardedRef) => {
|
|
265
262
|
const {
|
|
266
263
|
__scopeTooltip,
|
|
267
264
|
children,
|
|
@@ -273,11 +270,11 @@ var TooltipContentImpl = React3.forwardRef((props, forwardedRef) => {
|
|
|
273
270
|
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
274
271
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
275
272
|
const { onClose } = context;
|
|
276
|
-
|
|
273
|
+
React4.useEffect(() => {
|
|
277
274
|
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
278
275
|
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
279
276
|
}, [onClose]);
|
|
280
|
-
|
|
277
|
+
React4.useEffect(() => {
|
|
281
278
|
if (context.trigger) {
|
|
282
279
|
const handleScroll = (event) => {
|
|
283
280
|
const target = event.target;
|
|
@@ -287,7 +284,7 @@ var TooltipContentImpl = React3.forwardRef((props, forwardedRef) => {
|
|
|
287
284
|
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
288
285
|
}
|
|
289
286
|
}, [context.trigger, onClose]);
|
|
290
|
-
return /* @__PURE__ */
|
|
287
|
+
return /* @__PURE__ */ React4.createElement(
|
|
291
288
|
DismissableLayer,
|
|
292
289
|
{
|
|
293
290
|
asChild: true,
|
|
@@ -295,39 +292,37 @@ var TooltipContentImpl = React3.forwardRef((props, forwardedRef) => {
|
|
|
295
292
|
onEscapeKeyDown,
|
|
296
293
|
onPointerDownOutside,
|
|
297
294
|
onFocusOutside: (event) => event.preventDefault(),
|
|
298
|
-
onDismiss: onClose
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
children: [
|
|
318
|
-
/* @__PURE__ */ jsx4(Slottable, { children }),
|
|
319
|
-
/* @__PURE__ */ jsx4(
|
|
320
|
-
VisuallyHiddenContentContextProvider,
|
|
321
|
-
{
|
|
322
|
-
scope: __scopeTooltip,
|
|
323
|
-
isInside: true,
|
|
324
|
-
children: /* @__PURE__ */ jsx4(VisuallyHiddenPrimitive.Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children })
|
|
325
|
-
}
|
|
326
|
-
)
|
|
327
|
-
]
|
|
295
|
+
onDismiss: onClose
|
|
296
|
+
},
|
|
297
|
+
/* @__PURE__ */ React4.createElement(
|
|
298
|
+
PopperPrimitive2.Content,
|
|
299
|
+
{
|
|
300
|
+
"data-state": context.stateAttribute,
|
|
301
|
+
...popperScope,
|
|
302
|
+
...contentProps,
|
|
303
|
+
ref: forwardedRef,
|
|
304
|
+
style: {
|
|
305
|
+
...contentProps.style,
|
|
306
|
+
// re-namespace exposed content custom properties
|
|
307
|
+
...{
|
|
308
|
+
"--huin-core-tooltip-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
|
309
|
+
"--huin-core-tooltip-content-available-width": "var(--huin-core-popper-available-width)",
|
|
310
|
+
"--huin-core-tooltip-content-available-height": "var(--huin-core-popper-available-height)",
|
|
311
|
+
"--huin-core-tooltip-trigger-width": "var(--huin-core-popper-anchor-width)",
|
|
312
|
+
"--huin-core-tooltip-trigger-height": "var(--huin-core-popper-anchor-height)"
|
|
313
|
+
}
|
|
328
314
|
}
|
|
315
|
+
},
|
|
316
|
+
/* @__PURE__ */ React4.createElement(Slottable, null, children),
|
|
317
|
+
/* @__PURE__ */ React4.createElement(
|
|
318
|
+
VisuallyHiddenContentContextProvider,
|
|
319
|
+
{
|
|
320
|
+
scope: __scopeTooltip,
|
|
321
|
+
isInside: true
|
|
322
|
+
},
|
|
323
|
+
/* @__PURE__ */ React4.createElement(VisuallyHiddenPrimitive.Root, { id: context.contentId, role: "tooltip" }, ariaLabel || children)
|
|
329
324
|
)
|
|
330
|
-
|
|
325
|
+
)
|
|
331
326
|
);
|
|
332
327
|
});
|
|
333
328
|
TooltipContent.displayName = CONTENT_NAME;
|
|
@@ -448,14 +443,13 @@ function getHullPresorted(points) {
|
|
|
448
443
|
}
|
|
449
444
|
|
|
450
445
|
// packages/react/tooltip/src/TooltipTrigger.tsx
|
|
451
|
-
import
|
|
446
|
+
import React5 from "react";
|
|
452
447
|
import { Primitive } from "@huin-core/react-primitive";
|
|
453
448
|
import * as PopperPrimitive3 from "@huin-core/react-popper";
|
|
454
449
|
import { useComposedRefs as useComposedRefs2 } from "@huin-core/react-compose-refs";
|
|
455
450
|
import { composeEventHandlers } from "@huin-core/primitive";
|
|
456
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
457
451
|
var TRIGGER_NAME = "TooltipTrigger";
|
|
458
|
-
var TooltipTrigger =
|
|
452
|
+
var TooltipTrigger = React5.forwardRef((props, forwardedRef) => {
|
|
459
453
|
const { __scopeTooltip, ...triggerProps } = props;
|
|
460
454
|
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
461
455
|
const providerContext = useTooltipProviderContext(
|
|
@@ -463,22 +457,22 @@ var TooltipTrigger = React4.forwardRef((props, forwardedRef) => {
|
|
|
463
457
|
__scopeTooltip
|
|
464
458
|
);
|
|
465
459
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
466
|
-
const ref =
|
|
460
|
+
const ref = React5.useRef(null);
|
|
467
461
|
const composedRefs = useComposedRefs2(
|
|
468
462
|
forwardedRef,
|
|
469
463
|
ref,
|
|
470
464
|
context.onTriggerChange
|
|
471
465
|
);
|
|
472
|
-
const isPointerDownRef =
|
|
473
|
-
const hasPointerMoveOpenedRef =
|
|
474
|
-
const handlePointerUp =
|
|
466
|
+
const isPointerDownRef = React5.useRef(false);
|
|
467
|
+
const hasPointerMoveOpenedRef = React5.useRef(false);
|
|
468
|
+
const handlePointerUp = React5.useCallback(
|
|
475
469
|
() => isPointerDownRef.current = false,
|
|
476
470
|
[]
|
|
477
471
|
);
|
|
478
|
-
|
|
472
|
+
React5.useEffect(() => {
|
|
479
473
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
480
474
|
}, [handlePointerUp]);
|
|
481
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ React5.createElement(PopperPrimitive3.Anchor, { asChild: true, ...popperScope }, /* @__PURE__ */ React5.createElement(
|
|
482
476
|
Primitive.button,
|
|
483
477
|
{
|
|
484
478
|
"aria-describedby": context.open ? context.contentId : void 0,
|
|
@@ -508,16 +502,15 @@ var TooltipTrigger = React4.forwardRef((props, forwardedRef) => {
|
|
|
508
502
|
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
509
503
|
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
510
504
|
}
|
|
511
|
-
)
|
|
505
|
+
));
|
|
512
506
|
});
|
|
513
507
|
TooltipTrigger.displayName = TRIGGER_NAME;
|
|
514
508
|
|
|
515
509
|
// packages/react/tooltip/src/TooltipArrow.tsx
|
|
516
510
|
import * as PopperPrimitive4 from "@huin-core/react-popper";
|
|
517
|
-
import
|
|
518
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
511
|
+
import React6 from "react";
|
|
519
512
|
var ARROW_NAME = "TooltipArrow";
|
|
520
|
-
var TooltipArrow =
|
|
513
|
+
var TooltipArrow = React6.forwardRef(
|
|
521
514
|
(props, forwardedRef) => {
|
|
522
515
|
const { __scopeTooltip, ...arrowProps } = props;
|
|
523
516
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
@@ -525,7 +518,7 @@ var TooltipArrow = React5.forwardRef(
|
|
|
525
518
|
ARROW_NAME,
|
|
526
519
|
__scopeTooltip
|
|
527
520
|
);
|
|
528
|
-
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */
|
|
521
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ React6.createElement(
|
|
529
522
|
PopperPrimitive4.Arrow,
|
|
530
523
|
{
|
|
531
524
|
...popperScope,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/Tooltip.tsx", "../src/TooltipProvider.tsx", "../src/TooltipPortal.tsx", "../src/TooltipContent.tsx", "../src/TooltipTrigger.tsx", "../src/TooltipArrow.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from \"react\";\nimport { useId } from \"@huin-core/react-id\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { createPopperScope } from \"@huin-core/react-popper\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport { TooltipTriggerElement } from \"./TooltipTrigger\";\nimport { createTooltipContext, ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\n\nexport const usePopperScope = createPopperScope();\nexport const TOOLTIP_OPEN = \"tooltip.open\";\n\n/* -------------------------------------------------------------------------------------------------\n * Tooltip\n * -----------------------------------------------------------------------------------------------*/\n\nexport const 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\nexport const [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(\n TOOLTIP_NAME,\n props.__scopeTooltip\n );\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\n ? wasOpenDelayedRef.current\n ? \"delayed-open\"\n : \"instant-open\"\n : \"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\nconst Root = Tooltip;\n\nexport { Tooltip, Root };\nexport type { TooltipProps };\n", "import { createContextScope, Scope } from \"@huin-core/react-context\";\nimport { createPopperScope } from \"@huin-core/react-popper\";\nimport React from \"react\";\n\n\nexport type ScopedProps<P = {}> = P & { __scopeTooltip?: Scope };\nexport const [createTooltipContext, createTooltipScope] = createContextScope(\n \"Tooltip\",\n [createPopperScope]\n);\nconst PROVIDER_NAME = \"TooltipProvider\";\nconst DEFAULT_DELAY_DURATION = 700;\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\nexport const [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\nexport { TooltipProvider };\nexport type { TooltipProviderProps };\n", "import { Presence } from \"@huin-core/react-presence\";\nimport { useTooltipContext } from \"./Tooltip\";\nimport { Portal as PortalPrimitive } from \"@huin-core/react-portal\";\nimport { createTooltipContext, ScopedProps } from \"./TooltipProvider\";\n\nconst PORTAL_NAME = \"TooltipPortal\";\n\ntype PortalContextValue = { forceMount?: true };\nexport const [PortalProvider, usePortalContext] =\n createTooltipContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n });\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface TooltipPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps[\"container\"];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst TooltipPortal: React.FC<TooltipPortalProps> = (\n props: ScopedProps<TooltipPortalProps>\n) => {\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\nexport { TooltipPortal };\nexport type { TooltipPortalProps };\n", "import React from \"react\";\nimport {\n TOOLTIP_NAME,\n TOOLTIP_OPEN,\n usePopperScope,\n useTooltipContext,\n} from \"./Tooltip\";\nimport { usePortalContext } from \"./TooltipPortal\";\nimport { Presence } from \"@huin-core/react-presence\";\nimport { createTooltipContext, ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport { Slottable } from \"@huin-core/react-slot\";\nimport * as VisuallyHiddenPrimitive from \"@huin-core/react-visually-hidden\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { DismissableLayer } from \"@huin-core/react-dismissable-layer\";\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<\n TooltipContentElement,\n 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\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(\n CONTENT_NAME,\n props.__scopeTooltip\n );\n const ref = React.useRef<TooltipContentHoverableElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [pointerGraceArea, setPointerGraceArea] =\n 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(\n exitPoint,\n currentTarget.getBoundingClientRect()\n );\n const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);\n const hoverTargetPoints = getPointsFromRect(\n hoverTarget.getBoundingClientRect()\n );\n const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);\n setPointerGraceArea(graceArea);\n onPointerInTransitChange(true);\n },\n [onPointerInTransitChange]\n );\n\n React.useEffect(() => {\n return () => handleRemoveGraceArea();\n }, [handleRemoveGraceArea]);\n\n React.useEffect(() => {\n if (trigger && content) {\n const handleTriggerLeave = (event: PointerEvent) =>\n handleCreateGraceArea(event, content);\n const handleContentLeave = (event: PointerEvent) =>\n 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 =\n trigger?.contains(target) || content?.contains(target);\n const isPointerOutsideGraceArea = !isPointInPolygon(\n pointerPosition,\n pointerGraceArea\n );\n\n if (hasEnteredTarget) {\n handleRemoveGraceArea();\n } else if (isPointerOutsideGraceArea) {\n handleRemoveGraceArea();\n onClose();\n }\n };\n document.addEventListener(\"pointermove\", handleTrackPointerGrace);\n return () =>\n document.removeEventListener(\"pointermove\", handleTrackPointerGrace);\n }\n }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);\n\n return <TooltipContentImpl {...props} ref={composedRefs} />;\n});\n\nexport const [\n VisuallyHiddenContentContextProvider,\n useVisuallyHiddenContentContext,\n] = createTooltipContext(TOOLTIP_NAME, { isInside: false });\n\ntype TooltipContentImplElement = React.ElementRef<\n typeof PopperPrimitive.Content\n>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<\n typeof DismissableLayer\n>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<\n typeof PopperPrimitive.Content\n>;\ninterface TooltipContentImplProps extends Omit<PopperContentProps, \"onPlaced\"> {\n /**\n * A more descriptive label for accessibility purpose\n */\n \"aria-label\"?: string;\n\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps[\"onEscapeKeyDown\"];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `Tooltip`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps[\"onPointerDownOutside\"];\n}\n\nconst TooltipContentImpl = React.forwardRef<\n TooltipContentImplElement,\n 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 () =>\n window.removeEventListener(\"scroll\", handleScroll, { capture: true });\n }\n }, [context.trigger, onClose]);\n\n return (\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={(event) => event.preventDefault()}\n onDismiss={onClose}\n >\n <PopperPrimitive.Content\n data-state={context.stateAttribute}\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n \"--huin-core-tooltip-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-tooltip-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-tooltip-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-tooltip-trigger-width\": \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-tooltip-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n >\n <Slottable>{children}</Slottable>\n <VisuallyHiddenContentContextProvider\n scope={__scopeTooltip}\n isInside={true}\n >\n <VisuallyHiddenPrimitive.Root id={context.contentId} role=\"tooltip\">\n {ariaLabel || children}\n </VisuallyHiddenPrimitive.Root>\n </VisuallyHiddenContentContextProvider>\n </PopperPrimitive.Content>\n </DismissableLayer>\n );\n});\n\nTooltipContent.displayName = CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype Side = NonNullable<TooltipContentProps[\"side\"]>;\n\nfunction getExitSideFromRect(point: Point, rect: DOMRect): Side {\n const top = Math.abs(rect.top - point.y);\n const bottom = Math.abs(rect.bottom - point.y);\n const right = Math.abs(rect.right - point.x);\n const left = Math.abs(rect.left - point.x);\n\n switch (Math.min(top, bottom, right, left)) {\n case left:\n return \"left\";\n case right:\n return \"right\";\n case top:\n return \"top\";\n case bottom:\n return \"bottom\";\n default:\n throw new Error(\"unreachable\");\n }\n}\n\nfunction getPaddedExitPoints(exitPoint: Point, exitSide: Side, padding = 5) {\n const paddedExitPoints: Point[] = [];\n switch (exitSide) {\n case \"top\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y + padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case \"bottom\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y - padding }\n );\n break;\n case \"left\":\n paddedExitPoints.push(\n { x: exitPoint.x + padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case \"right\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x - padding, y: exitPoint.y + padding }\n );\n break;\n }\n return paddedExitPoints;\n}\n\nfunction getPointsFromRect(rect: DOMRect) {\n const { top, right, bottom, left } = rect;\n return [\n { x: left, y: top },\n { x: right, y: top },\n { x: right, y: bottom },\n { x: left, y: bottom },\n ];\n}\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\n// Returns a new array of points representing the convex hull of the given set of points.\n// https://www.nayuki.io/page/convex-hull-algorithm\nfunction getHull<P extends Point>(points: Readonly<Array<P>>): Array<P> {\n const newPoints: Array<P> = points.slice();\n newPoints.sort((a: Point, b: Point) => {\n if (a.x < b.x) return -1;\n else if (a.x > b.x) return +1;\n else if (a.y < b.y) return -1;\n else if (a.y > b.y) return +1;\n else return 0;\n });\n return getHullPresorted(newPoints);\n}\n\n// Returns the convex hull, assuming that each points[i] <= points[i + 1]. Runs in O(n) time.\nfunction getHullPresorted<P extends Point>(\n points: Readonly<Array<P>>\n): 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))\n 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))\n 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\nexport { TooltipContent };\nexport type { TooltipContentProps };\n", "import React from \"react\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { usePopperScope, useTooltipContext } from \"./Tooltip\";\nimport { ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst TRIGGER_NAME = \"TooltipTrigger\";\n\nexport type TooltipTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<\n typeof Primitive.button\n>;\ninterface TooltipTriggerProps extends PrimitiveButtonProps {}\n\nconst TooltipTrigger = React.forwardRef<\n TooltipTriggerElement,\n TooltipTriggerProps\n>((props: ScopedProps<TooltipTriggerProps>, forwardedRef) => {\n const { __scopeTooltip, ...triggerProps } = props;\n const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);\n const providerContext = useTooltipProviderContext(\n TRIGGER_NAME,\n __scopeTooltip\n );\n const popperScope = usePopperScope(__scopeTooltip);\n const ref = React.useRef<TooltipTriggerElement>(null);\n const composedRefs = useComposedRefs(\n forwardedRef,\n ref,\n context.onTriggerChange\n );\n const isPointerDownRef = React.useRef(false);\n const hasPointerMoveOpenedRef = React.useRef(false);\n const handlePointerUp = React.useCallback(\n () => (isPointerDownRef.current = false),\n []\n );\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, {\n once: true,\n });\n })}\n onFocus={composeEventHandlers(props.onFocus, () => {\n if (!isPointerDownRef.current) context.onOpen();\n })}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n onClick={composeEventHandlers(props.onClick, context.onClose)}\n />\n </PopperPrimitive.Anchor>\n );\n});\n\nTooltipTrigger.displayName = TRIGGER_NAME;\n\nexport { TooltipTrigger };\nexport type { TooltipTriggerProps };\n", "import * as PopperPrimitive from \"@huin-core/react-popper\";\nimport React from \"react\";\nimport { usePopperScope } from \"./Tooltip\";\nimport { useVisuallyHiddenContentContext } from \"./TooltipContent\";\nimport { ScopedProps } from \"./TooltipProvider\";\n\nconst ARROW_NAME = \"TooltipArrow\";\n\ntype TooltipArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<\n typeof PopperPrimitive.Arrow\n>;\ninterface TooltipArrowProps extends PopperArrowProps {}\n\nconst TooltipArrow = React.forwardRef<TooltipArrowElement, TooltipArrowProps>(\n (props: ScopedProps<TooltipArrowProps>, forwardedRef) => {\n const { __scopeTooltip, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeTooltip);\n const visuallyHiddenContentContext = useVisuallyHiddenContentContext(\n ARROW_NAME,\n __scopeTooltip\n );\n // if the arrow is inside the `VisuallyHidden`, we don't want to render it all to\n // prevent issues in positioning the arrow due to the duplicate\n return visuallyHiddenContentContext.isInside ? null : (\n <PopperPrimitive.Arrow\n {...popperScope}\n {...arrowProps}\n ref={forwardedRef}\n />\n );\n }\n);\n\nTooltipArrow.displayName = ARROW_NAME;\n\nexport { TooltipArrow };\nexport type { TooltipArrowProps };\n"],
|
|
5
|
-
"mappings": ";;;AAAA,YAAYA,YAAW;AACvB,SAAS,aAAa;AACtB,YAAY,qBAAqB;AACjC,SAAS,qBAAAC,0BAAyB;AAClC,SAAS,4BAA4B;;;ACJrC,SAAS,0BAAiC;AAC1C,SAAS,yBAAyB;AAClC,OAAO,WAAW;AA+Dd;AA3DG,IAAM,CAAC,sBAAsB,kBAAkB,IAAI;AAAA,EACxD;AAAA,EACA,CAAC,iBAAiB;AACpB;AACA,IAAM,gBAAgB;AACtB,IAAM,yBAAyB;AAYxB,IAAM,CAAC,gCAAgC,yBAAyB,IACrE,qBAAkD,aAAa;AAqBjE,IAAM,kBAAkD,CACtD,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,IAC1B;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,eAAe,gBAAgB,IAAI,MAAM,SAAS,IAAI;AAC7D,QAAM,wBAAwB,MAAM,OAAO,KAAK;AAChD,QAAM,oBAAoB,MAAM,OAAO,CAAC;AAExC,QAAM,UAAU,MAAM;AACpB,UAAM,iBAAiB,kBAAkB;AACzC,WAAO,MAAM,OAAO,aAAa,cAAc;AAAA,EACjD,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,QAAQ,MAAM,YAAY,MAAM;AAC9B,eAAO,aAAa,kBAAkB,OAAO;AAC7C,yBAAiB,KAAK;AAAA,MACxB,GAAG,CAAC,CAAC;A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AiB,UAAU;AAC3B,iBAAS,iBAAiB,aAAa,iBAAiB;AAAA,UACtD,MAAM;AAAA,QACR,CAAC;AAAA,MACH,CAAC;AAAA,MACD,SAAS,qBAAqB,MAAM,SAAS,MAAM;AACjD,YAAI,CAAC,iBAAiB,QAAS,SAAQ,OAAO;AAAA,MAChD,CAAC;AAAA,MACD,QAAQ,qBAAqB,MAAM,QAAQ,QAAQ,OAAO;AAAA,MAC1D,SAAS,qBAAqB,MAAM,SAAS,QAAQ,OAAO;AAAA;AAAA,EAC9D,GACF;AAEJ,CAAC;AAED,eAAe,cAAc;;;ACnF7B,YAAYE,sBAAqB;AACjC,OAAOC,YAAW;AAwBZ,gBAAAC,YAAA;AAnBN,IAAM,aAAa;AAQnB,IAAM,eAAeC,OAAM;AAAA,EACzB,CAAC,OAAuC,iBAAiB;AACvD,UAAM,EAAE,gBAAgB,GAAG,WAAW,IAAI;AAC1C,UAAM,cAAc,eAAe,cAAc;AACjD,UAAM,+BAA+B;AAAA,MACnC;AAAA,MACA;AAAA,IACF;AAGA,WAAO,6BAA6B,WAAW,OAC7C,gBAAAD;AAAA,MAAiB;AAAA,MAAhB;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACJ,KAAK;AAAA;AAAA,IACP;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;",
|
|
6
|
-
"names": ["React", "createPopperScope", "
|
|
4
|
+
"sourcesContent": ["import * as React from \"react\";\nimport { useId } from \"@huin-core/react-id\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { createPopperScope } from \"@huin-core/react-popper\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport { TooltipTriggerElement } from \"./TooltipTrigger\";\nimport { createTooltipContext, ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\n\nexport const usePopperScope = createPopperScope();\nexport const TOOLTIP_OPEN = \"tooltip.open\";\n\n/* -------------------------------------------------------------------------------------------------\n * Tooltip\n * -----------------------------------------------------------------------------------------------*/\n\nexport const 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\nexport const [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(\n TOOLTIP_NAME,\n props.__scopeTooltip\n );\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\n ? wasOpenDelayedRef.current\n ? \"delayed-open\"\n : \"instant-open\"\n : \"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\nconst Root = Tooltip;\n\nexport { Tooltip, Root };\nexport type { TooltipProps };\n", "import { createContextScope, Scope } from \"@huin-core/react-context\";\nimport { createPopperScope } from \"@huin-core/react-popper\";\nimport React from \"react\";\n\n\nexport type ScopedProps<P = {}> = P & { __scopeTooltip?: Scope };\nexport const [createTooltipContext, createTooltipScope] = createContextScope(\n \"Tooltip\",\n [createPopperScope]\n);\nconst PROVIDER_NAME = \"TooltipProvider\";\nconst DEFAULT_DELAY_DURATION = 700;\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\nexport const [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\nexport { TooltipProvider };\nexport type { TooltipProviderProps };\n", "import React from \"react\";\nimport { Presence } from \"@huin-core/react-presence\";\nimport { useTooltipContext } from \"./Tooltip\";\nimport { Portal as PortalPrimitive } from \"@huin-core/react-portal\";\nimport { createTooltipContext, ScopedProps } from \"./TooltipProvider\";\n\nconst PORTAL_NAME = \"TooltipPortal\";\n\ntype PortalContextValue = { forceMount?: true };\nexport const [PortalProvider, usePortalContext] =\n createTooltipContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n });\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface TooltipPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps[\"container\"];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst TooltipPortal: React.FC<TooltipPortalProps> = (\n props: ScopedProps<TooltipPortalProps>\n) => {\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\nexport { TooltipPortal };\nexport type { TooltipPortalProps };\n", "import React from \"react\";\nimport {\n TOOLTIP_NAME,\n TOOLTIP_OPEN,\n usePopperScope,\n useTooltipContext,\n} from \"./Tooltip\";\nimport { usePortalContext } from \"./TooltipPortal\";\nimport { Presence } from \"@huin-core/react-presence\";\nimport { createTooltipContext, ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport { Slottable } from \"@huin-core/react-slot\";\nimport * as VisuallyHiddenPrimitive from \"@huin-core/react-visually-hidden\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { DismissableLayer } from \"@huin-core/react-dismissable-layer\";\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<\n TooltipContentElement,\n 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\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(\n CONTENT_NAME,\n props.__scopeTooltip\n );\n const ref = React.useRef<TooltipContentHoverableElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [pointerGraceArea, setPointerGraceArea] =\n 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(\n exitPoint,\n currentTarget.getBoundingClientRect()\n );\n const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);\n const hoverTargetPoints = getPointsFromRect(\n hoverTarget.getBoundingClientRect()\n );\n const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);\n setPointerGraceArea(graceArea);\n onPointerInTransitChange(true);\n },\n [onPointerInTransitChange]\n );\n\n React.useEffect(() => {\n return () => handleRemoveGraceArea();\n }, [handleRemoveGraceArea]);\n\n React.useEffect(() => {\n if (trigger && content) {\n const handleTriggerLeave = (event: PointerEvent) =>\n handleCreateGraceArea(event, content);\n const handleContentLeave = (event: PointerEvent) =>\n 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 =\n trigger?.contains(target) || content?.contains(target);\n const isPointerOutsideGraceArea = !isPointInPolygon(\n pointerPosition,\n pointerGraceArea\n );\n\n if (hasEnteredTarget) {\n handleRemoveGraceArea();\n } else if (isPointerOutsideGraceArea) {\n handleRemoveGraceArea();\n onClose();\n }\n };\n document.addEventListener(\"pointermove\", handleTrackPointerGrace);\n return () =>\n document.removeEventListener(\"pointermove\", handleTrackPointerGrace);\n }\n }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);\n\n return <TooltipContentImpl {...props} ref={composedRefs} />;\n});\n\nexport const [\n VisuallyHiddenContentContextProvider,\n useVisuallyHiddenContentContext,\n] = createTooltipContext(TOOLTIP_NAME, { isInside: false });\n\ntype TooltipContentImplElement = React.ElementRef<\n typeof PopperPrimitive.Content\n>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<\n typeof DismissableLayer\n>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<\n typeof PopperPrimitive.Content\n>;\ninterface TooltipContentImplProps extends Omit<PopperContentProps, \"onPlaced\"> {\n /**\n * A more descriptive label for accessibility purpose\n */\n \"aria-label\"?: string;\n\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps[\"onEscapeKeyDown\"];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `Tooltip`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps[\"onPointerDownOutside\"];\n}\n\nconst TooltipContentImpl = React.forwardRef<\n TooltipContentImplElement,\n 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 () =>\n window.removeEventListener(\"scroll\", handleScroll, { capture: true });\n }\n }, [context.trigger, onClose]);\n\n return (\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={(event) => event.preventDefault()}\n onDismiss={onClose}\n >\n <PopperPrimitive.Content\n data-state={context.stateAttribute}\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n \"--huin-core-tooltip-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-tooltip-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-tooltip-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-tooltip-trigger-width\": \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-tooltip-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n >\n <Slottable>{children}</Slottable>\n <VisuallyHiddenContentContextProvider\n scope={__scopeTooltip}\n isInside={true}\n >\n <VisuallyHiddenPrimitive.Root id={context.contentId} role=\"tooltip\">\n {ariaLabel || children}\n </VisuallyHiddenPrimitive.Root>\n </VisuallyHiddenContentContextProvider>\n </PopperPrimitive.Content>\n </DismissableLayer>\n );\n});\n\nTooltipContent.displayName = CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype Side = NonNullable<TooltipContentProps[\"side\"]>;\n\nfunction getExitSideFromRect(point: Point, rect: DOMRect): Side {\n const top = Math.abs(rect.top - point.y);\n const bottom = Math.abs(rect.bottom - point.y);\n const right = Math.abs(rect.right - point.x);\n const left = Math.abs(rect.left - point.x);\n\n switch (Math.min(top, bottom, right, left)) {\n case left:\n return \"left\";\n case right:\n return \"right\";\n case top:\n return \"top\";\n case bottom:\n return \"bottom\";\n default:\n throw new Error(\"unreachable\");\n }\n}\n\nfunction getPaddedExitPoints(exitPoint: Point, exitSide: Side, padding = 5) {\n const paddedExitPoints: Point[] = [];\n switch (exitSide) {\n case \"top\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y + padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case \"bottom\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y - padding }\n );\n break;\n case \"left\":\n paddedExitPoints.push(\n { x: exitPoint.x + padding, y: exitPoint.y - padding },\n { x: exitPoint.x + padding, y: exitPoint.y + padding }\n );\n break;\n case \"right\":\n paddedExitPoints.push(\n { x: exitPoint.x - padding, y: exitPoint.y - padding },\n { x: exitPoint.x - padding, y: exitPoint.y + padding }\n );\n break;\n }\n return paddedExitPoints;\n}\n\nfunction getPointsFromRect(rect: DOMRect) {\n const { top, right, bottom, left } = rect;\n return [\n { x: left, y: top },\n { x: right, y: top },\n { x: right, y: bottom },\n { x: left, y: bottom },\n ];\n}\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\n// Returns a new array of points representing the convex hull of the given set of points.\n// https://www.nayuki.io/page/convex-hull-algorithm\nfunction getHull<P extends Point>(points: Readonly<Array<P>>): Array<P> {\n const newPoints: Array<P> = points.slice();\n newPoints.sort((a: Point, b: Point) => {\n if (a.x < b.x) return -1;\n else if (a.x > b.x) return +1;\n else if (a.y < b.y) return -1;\n else if (a.y > b.y) return +1;\n else return 0;\n });\n return getHullPresorted(newPoints);\n}\n\n// Returns the convex hull, assuming that each points[i] <= points[i + 1]. Runs in O(n) time.\nfunction getHullPresorted<P extends Point>(\n points: Readonly<Array<P>>\n): 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))\n 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))\n 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\nexport { TooltipContent };\nexport type { TooltipContentProps };\n", "import React from \"react\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport * as PopperPrimitive from \"@huin-core/react-popper\";\nimport { usePopperScope, useTooltipContext } from \"./Tooltip\";\nimport { ScopedProps, useTooltipProviderContext } from \"./TooltipProvider\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst TRIGGER_NAME = \"TooltipTrigger\";\n\nexport type TooltipTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<\n typeof Primitive.button\n>;\ninterface TooltipTriggerProps extends PrimitiveButtonProps {}\n\nconst TooltipTrigger = React.forwardRef<\n TooltipTriggerElement,\n TooltipTriggerProps\n>((props: ScopedProps<TooltipTriggerProps>, forwardedRef) => {\n const { __scopeTooltip, ...triggerProps } = props;\n const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);\n const providerContext = useTooltipProviderContext(\n TRIGGER_NAME,\n __scopeTooltip\n );\n const popperScope = usePopperScope(__scopeTooltip);\n const ref = React.useRef<TooltipTriggerElement>(null);\n const composedRefs = useComposedRefs(\n forwardedRef,\n ref,\n context.onTriggerChange\n );\n const isPointerDownRef = React.useRef(false);\n const hasPointerMoveOpenedRef = React.useRef(false);\n const handlePointerUp = React.useCallback(\n () => (isPointerDownRef.current = false),\n []\n );\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, {\n once: true,\n });\n })}\n onFocus={composeEventHandlers(props.onFocus, () => {\n if (!isPointerDownRef.current) context.onOpen();\n })}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n onClick={composeEventHandlers(props.onClick, context.onClose)}\n />\n </PopperPrimitive.Anchor>\n );\n});\n\nTooltipTrigger.displayName = TRIGGER_NAME;\n\nexport { TooltipTrigger };\nexport type { TooltipTriggerProps };\n", "import * as PopperPrimitive from \"@huin-core/react-popper\";\nimport React from \"react\";\nimport { usePopperScope } from \"./Tooltip\";\nimport { useVisuallyHiddenContentContext } from \"./TooltipContent\";\nimport { ScopedProps } from \"./TooltipProvider\";\n\nconst ARROW_NAME = \"TooltipArrow\";\n\ntype TooltipArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<\n typeof PopperPrimitive.Arrow\n>;\ninterface TooltipArrowProps extends PopperArrowProps {}\n\nconst TooltipArrow = React.forwardRef<TooltipArrowElement, TooltipArrowProps>(\n (props: ScopedProps<TooltipArrowProps>, forwardedRef) => {\n const { __scopeTooltip, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeTooltip);\n const visuallyHiddenContentContext = useVisuallyHiddenContentContext(\n ARROW_NAME,\n __scopeTooltip\n );\n // if the arrow is inside the `VisuallyHidden`, we don't want to render it all to\n // prevent issues in positioning the arrow due to the duplicate\n return visuallyHiddenContentContext.isInside ? null : (\n <PopperPrimitive.Arrow\n {...popperScope}\n {...arrowProps}\n ref={forwardedRef}\n />\n );\n }\n);\n\nTooltipArrow.displayName = ARROW_NAME;\n\nexport { TooltipArrow };\nexport type { TooltipArrowProps };\n"],
|
|
5
|
+
"mappings": ";;;AAAA,YAAYA,YAAW;AACvB,SAAS,aAAa;AACtB,YAAY,qBAAqB;AACjC,SAAS,qBAAAC,0BAAyB;AAClC,SAAS,4BAA4B;;;ACJrC,SAAS,0BAAiC;AAC1C,SAAS,yBAAyB;AAClC,OAAO,WAAW;AAIX,IAAM,CAAC,sBAAsB,kBAAkB,IAAI;AAAA,EACxD;AAAA,EACA,CAAC,iBAAiB;AACpB;AACA,IAAM,gBAAgB;AACtB,IAAM,yBAAyB;AAYxB,IAAM,CAAC,gCAAgC,yBAAyB,IACrE,qBAAkD,aAAa;AAqBjE,IAAM,kBAAkD,CACtD,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA,gBAAgB;A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QACJ,KAAK;AAAA;AAAA,IACP;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;",
|
|
6
|
+
"names": ["React", "createPopperScope", "createPopperScope", "open", "Root", "React", "React", "React", "Presence", "PopperPrimitive", "React", "Presence", "React", "PopperPrimitive", "useComposedRefs", "React", "PopperPrimitive", "React", "React"]
|
|
7
7
|
}
|