@huin-core/react-tooltip 1.0.5 → 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 +76 -82
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +76 -82
- 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
|
@@ -43,15 +43,19 @@ module.exports = __toCommonJS(src_exports);
|
|
|
43
43
|
|
|
44
44
|
// packages/react/tooltip/src/Tooltip.tsx
|
|
45
45
|
var React2 = __toESM(require("react"));
|
|
46
|
-
var import_react_context = require("@huin-core/react-context");
|
|
47
46
|
var import_react_id = require("@huin-core/react-id");
|
|
48
47
|
var PopperPrimitive = __toESM(require("@huin-core/react-popper"));
|
|
49
|
-
var
|
|
48
|
+
var import_react_popper2 = require("@huin-core/react-popper");
|
|
50
49
|
var import_react_use_controllable_state = require("@huin-core/react-use-controllable-state");
|
|
51
50
|
|
|
52
51
|
// packages/react/tooltip/src/TooltipProvider.tsx
|
|
52
|
+
var import_react_context = require("@huin-core/react-context");
|
|
53
|
+
var import_react_popper = require("@huin-core/react-popper");
|
|
53
54
|
var import_react = __toESM(require("react"));
|
|
54
|
-
var
|
|
55
|
+
var [createTooltipContext, createTooltipScope] = (0, import_react_context.createContextScope)(
|
|
56
|
+
"Tooltip",
|
|
57
|
+
[import_react_popper.createPopperScope]
|
|
58
|
+
);
|
|
55
59
|
var PROVIDER_NAME = "TooltipProvider";
|
|
56
60
|
var DEFAULT_DELAY_DURATION = 700;
|
|
57
61
|
var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
|
|
@@ -70,7 +74,7 @@ var TooltipProvider = (props) => {
|
|
|
70
74
|
const skipDelayTimer = skipDelayTimerRef.current;
|
|
71
75
|
return () => window.clearTimeout(skipDelayTimer);
|
|
72
76
|
}, []);
|
|
73
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
74
78
|
TooltipProviderContextProvider,
|
|
75
79
|
{
|
|
76
80
|
scope: __scopeTooltip,
|
|
@@ -91,20 +95,15 @@ var TooltipProvider = (props) => {
|
|
|
91
95
|
onPointerInTransitChange: import_react.default.useCallback((inTransit) => {
|
|
92
96
|
isPointerInTransitRef.current = inTransit;
|
|
93
97
|
}, []),
|
|
94
|
-
disableHoverableContent
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
disableHoverableContent
|
|
99
|
+
},
|
|
100
|
+
children
|
|
97
101
|
);
|
|
98
102
|
};
|
|
99
103
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
100
104
|
|
|
101
105
|
// packages/react/tooltip/src/Tooltip.tsx
|
|
102
|
-
var
|
|
103
|
-
var [createTooltipContext, createTooltipScope] = (0, import_react_context.createContextScope)(
|
|
104
|
-
"Tooltip",
|
|
105
|
-
[import_react_popper.createPopperScope]
|
|
106
|
-
);
|
|
107
|
-
var usePopperScope = (0, import_react_popper.createPopperScope)();
|
|
106
|
+
var usePopperScope = (0, import_react_popper2.createPopperScope)();
|
|
108
107
|
var TOOLTIP_OPEN = "tooltip.open";
|
|
109
108
|
var TOOLTIP_NAME = "Tooltip";
|
|
110
109
|
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
|
|
@@ -164,7 +163,7 @@ var Tooltip = (props) => {
|
|
|
164
163
|
React2.useEffect(() => {
|
|
165
164
|
return () => window.clearTimeout(openTimerRef.current);
|
|
166
165
|
}, []);
|
|
167
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ React2.createElement(PopperPrimitive.Root, { ...popperScope }, /* @__PURE__ */ React2.createElement(
|
|
168
167
|
TooltipContextProvider,
|
|
169
168
|
{
|
|
170
169
|
scope: __scopeTooltip,
|
|
@@ -186,18 +185,18 @@ var Tooltip = (props) => {
|
|
|
186
185
|
}, [handleClose, disableHoverableContent]),
|
|
187
186
|
onOpen: handleOpen,
|
|
188
187
|
onClose: handleClose,
|
|
189
|
-
disableHoverableContent
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
)
|
|
188
|
+
disableHoverableContent
|
|
189
|
+
},
|
|
190
|
+
children
|
|
191
|
+
));
|
|
193
192
|
};
|
|
194
193
|
Tooltip.displayName = TOOLTIP_NAME;
|
|
195
194
|
var Root2 = Tooltip;
|
|
196
195
|
|
|
197
196
|
// packages/react/tooltip/src/TooltipPortal.tsx
|
|
197
|
+
var import_react2 = __toESM(require("react"));
|
|
198
198
|
var import_react_presence = require("@huin-core/react-presence");
|
|
199
199
|
var import_react_portal = require("@huin-core/react-portal");
|
|
200
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
201
200
|
var PORTAL_NAME = "TooltipPortal";
|
|
202
201
|
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
203
202
|
forceMount: void 0
|
|
@@ -205,43 +204,42 @@ var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
|
205
204
|
var TooltipPortal = (props) => {
|
|
206
205
|
const { __scopeTooltip, forceMount, children, container } = props;
|
|
207
206
|
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
|
|
208
|
-
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)));
|
|
209
208
|
};
|
|
210
209
|
TooltipPortal.displayName = PORTAL_NAME;
|
|
211
210
|
|
|
212
211
|
// packages/react/tooltip/src/TooltipContent.tsx
|
|
213
|
-
var
|
|
212
|
+
var import_react3 = __toESM(require("react"));
|
|
214
213
|
var import_react_presence2 = require("@huin-core/react-presence");
|
|
215
214
|
var import_react_compose_refs = require("@huin-core/react-compose-refs");
|
|
216
215
|
var import_react_slot = require("@huin-core/react-slot");
|
|
217
216
|
var VisuallyHiddenPrimitive = __toESM(require("@huin-core/react-visually-hidden"));
|
|
218
217
|
var PopperPrimitive2 = __toESM(require("@huin-core/react-popper"));
|
|
219
218
|
var import_react_dismissable_layer = require("@huin-core/react-dismissable-layer");
|
|
220
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
221
219
|
var CONTENT_NAME = "TooltipContent";
|
|
222
|
-
var TooltipContent =
|
|
220
|
+
var TooltipContent = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
223
221
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
224
222
|
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
225
223
|
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
226
|
-
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 }));
|
|
227
225
|
});
|
|
228
|
-
var TooltipContentHoverable =
|
|
226
|
+
var TooltipContentHoverable = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
229
227
|
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
230
228
|
const providerContext = useTooltipProviderContext(
|
|
231
229
|
CONTENT_NAME,
|
|
232
230
|
props.__scopeTooltip
|
|
233
231
|
);
|
|
234
|
-
const ref =
|
|
232
|
+
const ref = import_react3.default.useRef(null);
|
|
235
233
|
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
236
|
-
const [pointerGraceArea, setPointerGraceArea] =
|
|
234
|
+
const [pointerGraceArea, setPointerGraceArea] = import_react3.default.useState(null);
|
|
237
235
|
const { trigger, onClose } = context;
|
|
238
236
|
const content = ref.current;
|
|
239
237
|
const { onPointerInTransitChange } = providerContext;
|
|
240
|
-
const handleRemoveGraceArea =
|
|
238
|
+
const handleRemoveGraceArea = import_react3.default.useCallback(() => {
|
|
241
239
|
setPointerGraceArea(null);
|
|
242
240
|
onPointerInTransitChange(false);
|
|
243
241
|
}, [onPointerInTransitChange]);
|
|
244
|
-
const handleCreateGraceArea =
|
|
242
|
+
const handleCreateGraceArea = import_react3.default.useCallback(
|
|
245
243
|
(event, hoverTarget) => {
|
|
246
244
|
const currentTarget = event.currentTarget;
|
|
247
245
|
const exitPoint = { x: event.clientX, y: event.clientY };
|
|
@@ -259,10 +257,10 @@ var TooltipContentHoverable = import_react2.default.forwardRef((props, forwarded
|
|
|
259
257
|
},
|
|
260
258
|
[onPointerInTransitChange]
|
|
261
259
|
);
|
|
262
|
-
|
|
260
|
+
import_react3.default.useEffect(() => {
|
|
263
261
|
return () => handleRemoveGraceArea();
|
|
264
262
|
}, [handleRemoveGraceArea]);
|
|
265
|
-
|
|
263
|
+
import_react3.default.useEffect(() => {
|
|
266
264
|
if (trigger && content) {
|
|
267
265
|
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
268
266
|
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
@@ -274,7 +272,7 @@ var TooltipContentHoverable = import_react2.default.forwardRef((props, forwarded
|
|
|
274
272
|
};
|
|
275
273
|
}
|
|
276
274
|
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
|
|
277
|
-
|
|
275
|
+
import_react3.default.useEffect(() => {
|
|
278
276
|
if (pointerGraceArea) {
|
|
279
277
|
const handleTrackPointerGrace = (event) => {
|
|
280
278
|
const target = event.target;
|
|
@@ -295,13 +293,13 @@ var TooltipContentHoverable = import_react2.default.forwardRef((props, forwarded
|
|
|
295
293
|
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
296
294
|
}
|
|
297
295
|
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
298
|
-
return /* @__PURE__ */
|
|
296
|
+
return /* @__PURE__ */ import_react3.default.createElement(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
299
297
|
});
|
|
300
298
|
var [
|
|
301
299
|
VisuallyHiddenContentContextProvider,
|
|
302
300
|
useVisuallyHiddenContentContext
|
|
303
301
|
] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
304
|
-
var TooltipContentImpl =
|
|
302
|
+
var TooltipContentImpl = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
305
303
|
const {
|
|
306
304
|
__scopeTooltip,
|
|
307
305
|
children,
|
|
@@ -313,11 +311,11 @@ var TooltipContentImpl = import_react2.default.forwardRef((props, forwardedRef)
|
|
|
313
311
|
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
314
312
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
315
313
|
const { onClose } = context;
|
|
316
|
-
|
|
314
|
+
import_react3.default.useEffect(() => {
|
|
317
315
|
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
318
316
|
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
319
317
|
}, [onClose]);
|
|
320
|
-
|
|
318
|
+
import_react3.default.useEffect(() => {
|
|
321
319
|
if (context.trigger) {
|
|
322
320
|
const handleScroll = (event) => {
|
|
323
321
|
const target = event.target;
|
|
@@ -327,7 +325,7 @@ var TooltipContentImpl = import_react2.default.forwardRef((props, forwardedRef)
|
|
|
327
325
|
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
328
326
|
}
|
|
329
327
|
}, [context.trigger, onClose]);
|
|
330
|
-
return /* @__PURE__ */
|
|
328
|
+
return /* @__PURE__ */ import_react3.default.createElement(
|
|
331
329
|
import_react_dismissable_layer.DismissableLayer,
|
|
332
330
|
{
|
|
333
331
|
asChild: true,
|
|
@@ -335,39 +333,37 @@ var TooltipContentImpl = import_react2.default.forwardRef((props, forwardedRef)
|
|
|
335
333
|
onEscapeKeyDown,
|
|
336
334
|
onPointerDownOutside,
|
|
337
335
|
onFocusOutside: (event) => event.preventDefault(),
|
|
338
|
-
onDismiss: onClose
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
children: [
|
|
358
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_slot.Slottable, { children }),
|
|
359
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
360
|
-
VisuallyHiddenContentContextProvider,
|
|
361
|
-
{
|
|
362
|
-
scope: __scopeTooltip,
|
|
363
|
-
isInside: true,
|
|
364
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VisuallyHiddenPrimitive.Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children })
|
|
365
|
-
}
|
|
366
|
-
)
|
|
367
|
-
]
|
|
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
|
+
}
|
|
368
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)
|
|
369
365
|
)
|
|
370
|
-
|
|
366
|
+
)
|
|
371
367
|
);
|
|
372
368
|
});
|
|
373
369
|
TooltipContent.displayName = CONTENT_NAME;
|
|
@@ -488,14 +484,13 @@ function getHullPresorted(points) {
|
|
|
488
484
|
}
|
|
489
485
|
|
|
490
486
|
// packages/react/tooltip/src/TooltipTrigger.tsx
|
|
491
|
-
var
|
|
487
|
+
var import_react4 = __toESM(require("react"));
|
|
492
488
|
var import_react_primitive = require("@huin-core/react-primitive");
|
|
493
489
|
var PopperPrimitive3 = __toESM(require("@huin-core/react-popper"));
|
|
494
490
|
var import_react_compose_refs2 = require("@huin-core/react-compose-refs");
|
|
495
491
|
var import_primitive = require("@huin-core/primitive");
|
|
496
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
497
492
|
var TRIGGER_NAME = "TooltipTrigger";
|
|
498
|
-
var TooltipTrigger =
|
|
493
|
+
var TooltipTrigger = import_react4.default.forwardRef((props, forwardedRef) => {
|
|
499
494
|
const { __scopeTooltip, ...triggerProps } = props;
|
|
500
495
|
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
501
496
|
const providerContext = useTooltipProviderContext(
|
|
@@ -503,22 +498,22 @@ var TooltipTrigger = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
|
503
498
|
__scopeTooltip
|
|
504
499
|
);
|
|
505
500
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
506
|
-
const ref =
|
|
501
|
+
const ref = import_react4.default.useRef(null);
|
|
507
502
|
const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(
|
|
508
503
|
forwardedRef,
|
|
509
504
|
ref,
|
|
510
505
|
context.onTriggerChange
|
|
511
506
|
);
|
|
512
|
-
const isPointerDownRef =
|
|
513
|
-
const hasPointerMoveOpenedRef =
|
|
514
|
-
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(
|
|
515
510
|
() => isPointerDownRef.current = false,
|
|
516
511
|
[]
|
|
517
512
|
);
|
|
518
|
-
|
|
513
|
+
import_react4.default.useEffect(() => {
|
|
519
514
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
520
515
|
}, [handlePointerUp]);
|
|
521
|
-
return /* @__PURE__ */
|
|
516
|
+
return /* @__PURE__ */ import_react4.default.createElement(PopperPrimitive3.Anchor, { asChild: true, ...popperScope }, /* @__PURE__ */ import_react4.default.createElement(
|
|
522
517
|
import_react_primitive.Primitive.button,
|
|
523
518
|
{
|
|
524
519
|
"aria-describedby": context.open ? context.contentId : void 0,
|
|
@@ -548,16 +543,15 @@ var TooltipTrigger = import_react3.default.forwardRef((props, forwardedRef) => {
|
|
|
548
543
|
onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, context.onClose),
|
|
549
544
|
onClick: (0, import_primitive.composeEventHandlers)(props.onClick, context.onClose)
|
|
550
545
|
}
|
|
551
|
-
)
|
|
546
|
+
));
|
|
552
547
|
});
|
|
553
548
|
TooltipTrigger.displayName = TRIGGER_NAME;
|
|
554
549
|
|
|
555
550
|
// packages/react/tooltip/src/TooltipArrow.tsx
|
|
556
551
|
var PopperPrimitive4 = __toESM(require("@huin-core/react-popper"));
|
|
557
|
-
var
|
|
558
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
552
|
+
var import_react5 = __toESM(require("react"));
|
|
559
553
|
var ARROW_NAME = "TooltipArrow";
|
|
560
|
-
var TooltipArrow =
|
|
554
|
+
var TooltipArrow = import_react5.default.forwardRef(
|
|
561
555
|
(props, forwardedRef) => {
|
|
562
556
|
const { __scopeTooltip, ...arrowProps } = props;
|
|
563
557
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
@@ -565,7 +559,7 @@ var TooltipArrow = import_react4.default.forwardRef(
|
|
|
565
559
|
ARROW_NAME,
|
|
566
560
|
__scopeTooltip
|
|
567
561
|
);
|
|
568
|
-
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */
|
|
562
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ import_react5.default.createElement(
|
|
569
563
|
PopperPrimitive4.Arrow,
|
|
570
564
|
{
|
|
571
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 { createContextScope } from \"@huin-core/react-context\";\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 type { Scope } from \"@huin-core/react-context\";\nimport { TooltipTriggerElement } from \"./TooltipTrigger\";\nimport { useTooltipProviderContext } from \"./TooltipProvider\";\n\nexport type ScopedProps<P = {}> = P & { __scopeTooltip?: Scope };\nexport const [createTooltipContext, createTooltipScope] = createContextScope(\n \"Tooltip\",\n [createPopperScope]\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 React from \"react\";\nimport { createTooltipContext, ScopedProps } from \"./Tooltip\";\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 { createTooltipContext, ScopedProps, useTooltipContext } from \"./Tooltip\";\nimport { Portal as PortalPrimitive } from \"@huin-core/react-portal\";\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 createTooltipContext,\n ScopedProps,\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 { 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 { ScopedProps, usePopperScope, useTooltipContext } from \"./Tooltip\";\nimport { 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 { ScopedProps, usePopperScope } from \"./Tooltip\";\nimport { useVisuallyHiddenContentContext } from \"./TooltipContent\";\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,2BAAmC;AACnC,sBAAsB;AACtB,sBAAiC;AACjC,0BAAkC;AAClC,0CAAqC;;;ACLrC,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C,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", "
|
|
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 );\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;AAIX,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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O,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
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
// packages/react/tooltip/src/Tooltip.tsx
|
|
4
4
|
import * as React2 from "react";
|
|
5
|
-
import { createContextScope } from "@huin-core/react-context";
|
|
6
5
|
import { useId } from "@huin-core/react-id";
|
|
7
6
|
import * as PopperPrimitive from "@huin-core/react-popper";
|
|
8
|
-
import { createPopperScope } from "@huin-core/react-popper";
|
|
7
|
+
import { createPopperScope as createPopperScope2 } from "@huin-core/react-popper";
|
|
9
8
|
import { useControllableState } from "@huin-core/react-use-controllable-state";
|
|
10
9
|
|
|
11
10
|
// packages/react/tooltip/src/TooltipProvider.tsx
|
|
11
|
+
import { createContextScope } from "@huin-core/react-context";
|
|
12
|
+
import { createPopperScope } from "@huin-core/react-popper";
|
|
12
13
|
import React from "react";
|
|
13
|
-
|
|
14
|
+
var [createTooltipContext, createTooltipScope] = createContextScope(
|
|
15
|
+
"Tooltip",
|
|
16
|
+
[createPopperScope]
|
|
17
|
+
);
|
|
14
18
|
var PROVIDER_NAME = "TooltipProvider";
|
|
15
19
|
var DEFAULT_DELAY_DURATION = 700;
|
|
16
20
|
var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
|
|
@@ -29,7 +33,7 @@ var TooltipProvider = (props) => {
|
|
|
29
33
|
const skipDelayTimer = skipDelayTimerRef.current;
|
|
30
34
|
return () => window.clearTimeout(skipDelayTimer);
|
|
31
35
|
}, []);
|
|
32
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ React.createElement(
|
|
33
37
|
TooltipProviderContextProvider,
|
|
34
38
|
{
|
|
35
39
|
scope: __scopeTooltip,
|
|
@@ -50,20 +54,15 @@ var TooltipProvider = (props) => {
|
|
|
50
54
|
onPointerInTransitChange: React.useCallback((inTransit) => {
|
|
51
55
|
isPointerInTransitRef.current = inTransit;
|
|
52
56
|
}, []),
|
|
53
|
-
disableHoverableContent
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
disableHoverableContent
|
|
58
|
+
},
|
|
59
|
+
children
|
|
56
60
|
);
|
|
57
61
|
};
|
|
58
62
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
59
63
|
|
|
60
64
|
// packages/react/tooltip/src/Tooltip.tsx
|
|
61
|
-
|
|
62
|
-
var [createTooltipContext, createTooltipScope] = createContextScope(
|
|
63
|
-
"Tooltip",
|
|
64
|
-
[createPopperScope]
|
|
65
|
-
);
|
|
66
|
-
var usePopperScope = createPopperScope();
|
|
65
|
+
var usePopperScope = createPopperScope2();
|
|
67
66
|
var TOOLTIP_OPEN = "tooltip.open";
|
|
68
67
|
var TOOLTIP_NAME = "Tooltip";
|
|
69
68
|
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
|
|
@@ -123,7 +122,7 @@ var Tooltip = (props) => {
|
|
|
123
122
|
React2.useEffect(() => {
|
|
124
123
|
return () => window.clearTimeout(openTimerRef.current);
|
|
125
124
|
}, []);
|
|
126
|
-
return /* @__PURE__ */
|
|
125
|
+
return /* @__PURE__ */ React2.createElement(PopperPrimitive.Root, { ...popperScope }, /* @__PURE__ */ React2.createElement(
|
|
127
126
|
TooltipContextProvider,
|
|
128
127
|
{
|
|
129
128
|
scope: __scopeTooltip,
|
|
@@ -145,18 +144,18 @@ var Tooltip = (props) => {
|
|
|
145
144
|
}, [handleClose, disableHoverableContent]),
|
|
146
145
|
onOpen: handleOpen,
|
|
147
146
|
onClose: handleClose,
|
|
148
|
-
disableHoverableContent
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
)
|
|
147
|
+
disableHoverableContent
|
|
148
|
+
},
|
|
149
|
+
children
|
|
150
|
+
));
|
|
152
151
|
};
|
|
153
152
|
Tooltip.displayName = TOOLTIP_NAME;
|
|
154
153
|
var Root2 = Tooltip;
|
|
155
154
|
|
|
156
155
|
// packages/react/tooltip/src/TooltipPortal.tsx
|
|
156
|
+
import React3 from "react";
|
|
157
157
|
import { Presence } from "@huin-core/react-presence";
|
|
158
158
|
import { Portal as PortalPrimitive } from "@huin-core/react-portal";
|
|
159
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
160
159
|
var PORTAL_NAME = "TooltipPortal";
|
|
161
160
|
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
162
161
|
forceMount: void 0
|
|
@@ -164,43 +163,42 @@ var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
|
164
163
|
var TooltipPortal = (props) => {
|
|
165
164
|
const { __scopeTooltip, forceMount, children, container } = props;
|
|
166
165
|
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
|
|
167
|
-
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)));
|
|
168
167
|
};
|
|
169
168
|
TooltipPortal.displayName = PORTAL_NAME;
|
|
170
169
|
|
|
171
170
|
// packages/react/tooltip/src/TooltipContent.tsx
|
|
172
|
-
import
|
|
171
|
+
import React4 from "react";
|
|
173
172
|
import { Presence as Presence2 } from "@huin-core/react-presence";
|
|
174
173
|
import { useComposedRefs } from "@huin-core/react-compose-refs";
|
|
175
174
|
import { Slottable } from "@huin-core/react-slot";
|
|
176
175
|
import * as VisuallyHiddenPrimitive from "@huin-core/react-visually-hidden";
|
|
177
176
|
import * as PopperPrimitive2 from "@huin-core/react-popper";
|
|
178
177
|
import { DismissableLayer } from "@huin-core/react-dismissable-layer";
|
|
179
|
-
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
180
178
|
var CONTENT_NAME = "TooltipContent";
|
|
181
|
-
var TooltipContent =
|
|
179
|
+
var TooltipContent = React4.forwardRef((props, forwardedRef) => {
|
|
182
180
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
183
181
|
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
184
182
|
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
185
|
-
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 }));
|
|
186
184
|
});
|
|
187
|
-
var TooltipContentHoverable =
|
|
185
|
+
var TooltipContentHoverable = React4.forwardRef((props, forwardedRef) => {
|
|
188
186
|
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
189
187
|
const providerContext = useTooltipProviderContext(
|
|
190
188
|
CONTENT_NAME,
|
|
191
189
|
props.__scopeTooltip
|
|
192
190
|
);
|
|
193
|
-
const ref =
|
|
191
|
+
const ref = React4.useRef(null);
|
|
194
192
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
195
|
-
const [pointerGraceArea, setPointerGraceArea] =
|
|
193
|
+
const [pointerGraceArea, setPointerGraceArea] = React4.useState(null);
|
|
196
194
|
const { trigger, onClose } = context;
|
|
197
195
|
const content = ref.current;
|
|
198
196
|
const { onPointerInTransitChange } = providerContext;
|
|
199
|
-
const handleRemoveGraceArea =
|
|
197
|
+
const handleRemoveGraceArea = React4.useCallback(() => {
|
|
200
198
|
setPointerGraceArea(null);
|
|
201
199
|
onPointerInTransitChange(false);
|
|
202
200
|
}, [onPointerInTransitChange]);
|
|
203
|
-
const handleCreateGraceArea =
|
|
201
|
+
const handleCreateGraceArea = React4.useCallback(
|
|
204
202
|
(event, hoverTarget) => {
|
|
205
203
|
const currentTarget = event.currentTarget;
|
|
206
204
|
const exitPoint = { x: event.clientX, y: event.clientY };
|
|
@@ -218,10 +216,10 @@ var TooltipContentHoverable = React3.forwardRef((props, forwardedRef) => {
|
|
|
218
216
|
},
|
|
219
217
|
[onPointerInTransitChange]
|
|
220
218
|
);
|
|
221
|
-
|
|
219
|
+
React4.useEffect(() => {
|
|
222
220
|
return () => handleRemoveGraceArea();
|
|
223
221
|
}, [handleRemoveGraceArea]);
|
|
224
|
-
|
|
222
|
+
React4.useEffect(() => {
|
|
225
223
|
if (trigger && content) {
|
|
226
224
|
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
227
225
|
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
@@ -233,7 +231,7 @@ var TooltipContentHoverable = React3.forwardRef((props, forwardedRef) => {
|
|
|
233
231
|
};
|
|
234
232
|
}
|
|
235
233
|
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
|
|
236
|
-
|
|
234
|
+
React4.useEffect(() => {
|
|
237
235
|
if (pointerGraceArea) {
|
|
238
236
|
const handleTrackPointerGrace = (event) => {
|
|
239
237
|
const target = event.target;
|
|
@@ -254,13 +252,13 @@ var TooltipContentHoverable = React3.forwardRef((props, forwardedRef) => {
|
|
|
254
252
|
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
255
253
|
}
|
|
256
254
|
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
257
|
-
return /* @__PURE__ */
|
|
255
|
+
return /* @__PURE__ */ React4.createElement(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
258
256
|
});
|
|
259
257
|
var [
|
|
260
258
|
VisuallyHiddenContentContextProvider,
|
|
261
259
|
useVisuallyHiddenContentContext
|
|
262
260
|
] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
263
|
-
var TooltipContentImpl =
|
|
261
|
+
var TooltipContentImpl = React4.forwardRef((props, forwardedRef) => {
|
|
264
262
|
const {
|
|
265
263
|
__scopeTooltip,
|
|
266
264
|
children,
|
|
@@ -272,11 +270,11 @@ var TooltipContentImpl = React3.forwardRef((props, forwardedRef) => {
|
|
|
272
270
|
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
273
271
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
274
272
|
const { onClose } = context;
|
|
275
|
-
|
|
273
|
+
React4.useEffect(() => {
|
|
276
274
|
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
277
275
|
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
278
276
|
}, [onClose]);
|
|
279
|
-
|
|
277
|
+
React4.useEffect(() => {
|
|
280
278
|
if (context.trigger) {
|
|
281
279
|
const handleScroll = (event) => {
|
|
282
280
|
const target = event.target;
|
|
@@ -286,7 +284,7 @@ var TooltipContentImpl = React3.forwardRef((props, forwardedRef) => {
|
|
|
286
284
|
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
287
285
|
}
|
|
288
286
|
}, [context.trigger, onClose]);
|
|
289
|
-
return /* @__PURE__ */
|
|
287
|
+
return /* @__PURE__ */ React4.createElement(
|
|
290
288
|
DismissableLayer,
|
|
291
289
|
{
|
|
292
290
|
asChild: true,
|
|
@@ -294,39 +292,37 @@ var TooltipContentImpl = React3.forwardRef((props, forwardedRef) => {
|
|
|
294
292
|
onEscapeKeyDown,
|
|
295
293
|
onPointerDownOutside,
|
|
296
294
|
onFocusOutside: (event) => event.preventDefault(),
|
|
297
|
-
onDismiss: onClose
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
children: [
|
|
317
|
-
/* @__PURE__ */ jsx4(Slottable, { children }),
|
|
318
|
-
/* @__PURE__ */ jsx4(
|
|
319
|
-
VisuallyHiddenContentContextProvider,
|
|
320
|
-
{
|
|
321
|
-
scope: __scopeTooltip,
|
|
322
|
-
isInside: true,
|
|
323
|
-
children: /* @__PURE__ */ jsx4(VisuallyHiddenPrimitive.Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children })
|
|
324
|
-
}
|
|
325
|
-
)
|
|
326
|
-
]
|
|
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
|
+
}
|
|
327
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)
|
|
328
324
|
)
|
|
329
|
-
|
|
325
|
+
)
|
|
330
326
|
);
|
|
331
327
|
});
|
|
332
328
|
TooltipContent.displayName = CONTENT_NAME;
|
|
@@ -447,14 +443,13 @@ function getHullPresorted(points) {
|
|
|
447
443
|
}
|
|
448
444
|
|
|
449
445
|
// packages/react/tooltip/src/TooltipTrigger.tsx
|
|
450
|
-
import
|
|
446
|
+
import React5 from "react";
|
|
451
447
|
import { Primitive } from "@huin-core/react-primitive";
|
|
452
448
|
import * as PopperPrimitive3 from "@huin-core/react-popper";
|
|
453
449
|
import { useComposedRefs as useComposedRefs2 } from "@huin-core/react-compose-refs";
|
|
454
450
|
import { composeEventHandlers } from "@huin-core/primitive";
|
|
455
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
456
451
|
var TRIGGER_NAME = "TooltipTrigger";
|
|
457
|
-
var TooltipTrigger =
|
|
452
|
+
var TooltipTrigger = React5.forwardRef((props, forwardedRef) => {
|
|
458
453
|
const { __scopeTooltip, ...triggerProps } = props;
|
|
459
454
|
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
460
455
|
const providerContext = useTooltipProviderContext(
|
|
@@ -462,22 +457,22 @@ var TooltipTrigger = React4.forwardRef((props, forwardedRef) => {
|
|
|
462
457
|
__scopeTooltip
|
|
463
458
|
);
|
|
464
459
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
465
|
-
const ref =
|
|
460
|
+
const ref = React5.useRef(null);
|
|
466
461
|
const composedRefs = useComposedRefs2(
|
|
467
462
|
forwardedRef,
|
|
468
463
|
ref,
|
|
469
464
|
context.onTriggerChange
|
|
470
465
|
);
|
|
471
|
-
const isPointerDownRef =
|
|
472
|
-
const hasPointerMoveOpenedRef =
|
|
473
|
-
const handlePointerUp =
|
|
466
|
+
const isPointerDownRef = React5.useRef(false);
|
|
467
|
+
const hasPointerMoveOpenedRef = React5.useRef(false);
|
|
468
|
+
const handlePointerUp = React5.useCallback(
|
|
474
469
|
() => isPointerDownRef.current = false,
|
|
475
470
|
[]
|
|
476
471
|
);
|
|
477
|
-
|
|
472
|
+
React5.useEffect(() => {
|
|
478
473
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
479
474
|
}, [handlePointerUp]);
|
|
480
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ React5.createElement(PopperPrimitive3.Anchor, { asChild: true, ...popperScope }, /* @__PURE__ */ React5.createElement(
|
|
481
476
|
Primitive.button,
|
|
482
477
|
{
|
|
483
478
|
"aria-describedby": context.open ? context.contentId : void 0,
|
|
@@ -507,16 +502,15 @@ var TooltipTrigger = React4.forwardRef((props, forwardedRef) => {
|
|
|
507
502
|
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
508
503
|
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
509
504
|
}
|
|
510
|
-
)
|
|
505
|
+
));
|
|
511
506
|
});
|
|
512
507
|
TooltipTrigger.displayName = TRIGGER_NAME;
|
|
513
508
|
|
|
514
509
|
// packages/react/tooltip/src/TooltipArrow.tsx
|
|
515
510
|
import * as PopperPrimitive4 from "@huin-core/react-popper";
|
|
516
|
-
import
|
|
517
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
511
|
+
import React6 from "react";
|
|
518
512
|
var ARROW_NAME = "TooltipArrow";
|
|
519
|
-
var TooltipArrow =
|
|
513
|
+
var TooltipArrow = React6.forwardRef(
|
|
520
514
|
(props, forwardedRef) => {
|
|
521
515
|
const { __scopeTooltip, ...arrowProps } = props;
|
|
522
516
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
@@ -524,7 +518,7 @@ var TooltipArrow = React5.forwardRef(
|
|
|
524
518
|
ARROW_NAME,
|
|
525
519
|
__scopeTooltip
|
|
526
520
|
);
|
|
527
|
-
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */
|
|
521
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ React6.createElement(
|
|
528
522
|
PopperPrimitive4.Arrow,
|
|
529
523
|
{
|
|
530
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 { createContextScope } from \"@huin-core/react-context\";\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 type { Scope } from \"@huin-core/react-context\";\nimport { TooltipTriggerElement } from \"./TooltipTrigger\";\nimport { useTooltipProviderContext } from \"./TooltipProvider\";\n\nexport type ScopedProps<P = {}> = P & { __scopeTooltip?: Scope };\nexport const [createTooltipContext, createTooltipScope] = createContextScope(\n \"Tooltip\",\n [createPopperScope]\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 React from \"react\";\nimport { createTooltipContext, ScopedProps } from \"./Tooltip\";\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 { createTooltipContext, ScopedProps, useTooltipContext } from \"./Tooltip\";\nimport { Portal as PortalPrimitive } from \"@huin-core/react-portal\";\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 createTooltipContext,\n ScopedProps,\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 { 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 { ScopedProps, usePopperScope, useTooltipContext } from \"./Tooltip\";\nimport { 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 { ScopedProps, usePopperScope } from \"./Tooltip\";\nimport { useVisuallyHiddenContentContext } from \"./TooltipContent\";\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,0BAA0B;AACnC,SAAS,aAAa;AACtB,YAAY,qBAAqB;AACjC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;;;ACLrC,OAAO,WAAW;AA0Dd;AAvDJ,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;AAAA,MACL,SAAS,MAAM,YAAY,MAAM;AAC/B,eAAO,aAAa,kBAAkB,OAAO;AAC7C,0BAAkB,UAAU,OAAO;AAAA,UACjC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AiB,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;AAuBZ,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", "
|
|
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;AAAA,IAChB,oBAAoB;AAAA,IACpB,0BAA0B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J;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
|
}
|