react-tooltip
Advanced tools
Comparing version 5.22.0-beta.1109.1 to 5.22.0
@@ -52,35 +52,21 @@ import React, { ElementType, ReactNode, CSSProperties, PropsWithChildren } from 'react'; | ||
interface TooltipImperativeOpenOptions { | ||
anchorSelect?: string | ||
position?: IPosition | ||
place?: PlacesType | ||
content?: ChildrenType | ||
/** | ||
* @description Delay (in ms) before opening the tooltip. | ||
*/ | ||
delay?: number | ||
type AnchorOpenEvents = { | ||
mouseenter?: boolean | ||
focus?: boolean | ||
click?: boolean | ||
dblclick?: boolean | ||
mousedown?: boolean | ||
} | ||
interface TooltipImperativeCloseOptions { | ||
/** | ||
* @description Delay (in ms) before closing the tooltip. | ||
*/ | ||
delay?: number | ||
type AnchorCloseEvents = { | ||
mouseleave?: boolean | ||
blur?: boolean | ||
click?: boolean | ||
dblclick?: boolean | ||
mouseup?: boolean | ||
} | ||
interface TooltipImperativeProps { | ||
open: (options?: TooltipImperativeOpenOptions) => void | ||
close: (options?: TooltipImperativeCloseOptions) => void | ||
/** | ||
* @readonly | ||
*/ | ||
activeAnchor: HTMLElement | null | ||
/** | ||
* @readonly | ||
*/ | ||
place: PlacesType | ||
/** | ||
* @readonly | ||
*/ | ||
isOpen: boolean | ||
type GlobalCloseEvents = { | ||
escape?: boolean | ||
scroll?: boolean | ||
resize?: boolean | ||
clickOutsideAnchor?: boolean | ||
} | ||
@@ -110,3 +96,3 @@ | ||
/** | ||
* @deprecated Use `openOnClick` instead. | ||
* @deprecated Use `openOnClick` or `openEvents`/`closeEvents` instead. | ||
*/ | ||
@@ -124,13 +110,25 @@ events?: EventsType[] | ||
/** | ||
* @todo refactor to `hideOnEsc` for naming consistency | ||
* @deprecated Use `globalCloseEvents={{ escape: true }}` instead. | ||
*/ | ||
closeOnEsc?: boolean | ||
/** | ||
* @todo refactor to `hideOnScroll` for naming consistency | ||
* @deprecated Use `globalCloseEvents={{ scroll: true }}` instead. | ||
*/ | ||
closeOnScroll?: boolean | ||
/** | ||
* @todo refactor to `hideOnResize` for naming consistency | ||
* @deprecated Use `globalCloseEvents={{ resize: true }}` instead. | ||
*/ | ||
closeOnResize?: boolean | ||
/** | ||
* @description The events to be listened on anchor elements to open the tooltip. | ||
*/ | ||
openEvents?: AnchorOpenEvents | ||
/** | ||
* @description The events to be listened on anchor elements to close the tooltip. | ||
*/ | ||
closeEvents?: AnchorCloseEvents | ||
/** | ||
* @description The global events listened to close the tooltip. | ||
*/ | ||
globalCloseEvents?: GlobalCloseEvents | ||
style?: CSSProperties | ||
@@ -196,3 +194,3 @@ position?: IPosition | ||
declare const TooltipController: React.ForwardRefExoticComponent<ITooltipController & React.RefAttributes<TooltipImperativeProps>>; | ||
declare const TooltipController: ({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant, place, offset, wrapper, children, events, openOnClick, positionStrategy, middlewares, delayShow, delayHide, float, hidden, noArrow, clickable, closeOnEsc, closeOnScroll, closeOnResize, openEvents, closeEvents, globalCloseEvents, style, position, isOpen, disableStyleInjection, border, opacity, arrowColor, setIsOpen, afterShow, afterHide, }: ITooltipController) => React.JSX.Element; | ||
@@ -220,2 +218,2 @@ /** | ||
export { ChildrenType, DataAttribute, EventsType, IPosition, ITooltipController as ITooltip, ITooltipWrapper, Middleware, PlacesType, PositionStrategy, TooltipController as Tooltip, TooltipProvider, TooltipImperativeProps as TooltipRefProps, TooltipWrapper, VariantType, WrapperType, removeStyle }; | ||
export { ChildrenType, DataAttribute, EventsType, IPosition, ITooltipController as ITooltip, ITooltipWrapper, Middleware, PlacesType, PositionStrategy, TooltipController as Tooltip, TooltipProvider, TooltipWrapper, VariantType, WrapperType, removeStyle }; |
@@ -328,3 +328,3 @@ | ||
var coreStyles = {"tooltip":"core-styles-module_tooltip__3vRRp","fixed":"core-styles-module_fixed__pcSol","arrow":"core-styles-module_arrow__cvMwQ","noArrow":"core-styles-module_noArrow__xock6","clickable":"core-styles-module_clickable__ZuTTB","show":"core-styles-module_show__Nt9eE"}; | ||
var coreStyles = {"tooltip":"core-styles-module_tooltip__3vRRp","fixed":"core-styles-module_fixed__pcSol","arrow":"core-styles-module_arrow__cvMwQ","noArrow":"core-styles-module_noArrow__xock6","clickable":"core-styles-module_clickable__ZuTTB","show":"core-styles-module_show__Nt9eE","closing":"core-styles-module_closing__sGnxF"}; | ||
@@ -335,6 +335,5 @@ var styles = {"tooltip":"styles-module_tooltip__mnnfp","arrow":"styles-module_arrow__K0L3T","dark":"styles-module_dark__xNqje","light":"styles-module_light__Z6W-X","success":"styles-module_success__A2AKt","warning":"styles-module_warning__SCK0X","error":"styles-module_error__JvumD","info":"styles-module_info__BWdHW"}; | ||
// props | ||
forwardRef, id, className, classNameArrow, variant = 'dark', anchorId, anchorSelect, place = 'top', offset = 10, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, style: externalStyles, position, afterShow, afterHide, | ||
id, className, classNameArrow, variant = 'dark', anchorId, anchorSelect, place = 'top', offset = 10, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, openEvents, closeEvents, globalCloseEvents, style: externalStyles, position, afterShow, afterHide, | ||
// props handled by controller | ||
content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, border, opacity, arrowColor, }) => { | ||
var _a; | ||
const tooltipRef = React.useRef(null); | ||
@@ -349,3 +348,2 @@ const tooltipArrowRef = React.useRef(null); | ||
const [rendered, setRendered] = React.useState(false); | ||
const [imperativeOptions, setImperativeOptions] = React.useState(null); | ||
const wasShowing = React.useRef(false); | ||
@@ -360,3 +358,44 @@ const lastFloatPosition = React.useRef(null); | ||
const mounted = React.useRef(false); | ||
/** | ||
* @todo Update when deprecated stuff gets removed. | ||
*/ | ||
const shouldOpenOnClick = openOnClick || events.includes('click'); | ||
const hasClickEvent = shouldOpenOnClick || (openEvents === null || openEvents === void 0 ? void 0 : openEvents.click) || (openEvents === null || openEvents === void 0 ? void 0 : openEvents.dblclick) || (openEvents === null || openEvents === void 0 ? void 0 : openEvents.mousedown); | ||
const actualOpenEvents = openEvents | ||
? { ...openEvents } | ||
: { | ||
mouseenter: true, | ||
focus: true, | ||
click: false, | ||
dblclick: false, | ||
mousedown: false, | ||
}; | ||
if (!openEvents && shouldOpenOnClick) { | ||
Object.assign(actualOpenEvents, { | ||
mouseenter: false, | ||
focus: false, | ||
click: true, | ||
}); | ||
} | ||
const actualCloseEvents = closeEvents | ||
? { ...closeEvents } | ||
: { | ||
mouseleave: true, | ||
blur: true, | ||
click: false, | ||
}; | ||
if (!closeEvents && shouldOpenOnClick) { | ||
Object.assign(actualCloseEvents, { | ||
mouseleave: false, | ||
blur: false, | ||
}); | ||
} | ||
const actualGlobalCloseEvents = globalCloseEvents | ||
? { ...globalCloseEvents } | ||
: { | ||
escape: closeOnEsc || false, | ||
scroll: closeOnScroll || false, | ||
resize: closeOnResize || false, | ||
clickOutsideAnchor: hasClickEvent || false, | ||
}; | ||
/** | ||
@@ -373,19 +412,2 @@ * useLayoutEffect runs before useEffect, | ||
}, []); | ||
React.useEffect(() => { | ||
if (!show) { | ||
/** | ||
* this fixes weird behavior when switching between two anchor elements very quickly | ||
* remove the timeout and switch quickly between two adjancent anchor elements to see it | ||
* | ||
* in practice, this means the tooltip is not immediately removed from the DOM on hide | ||
*/ | ||
const timeout = setTimeout(() => { | ||
setRendered(false); | ||
}, 150); | ||
return () => { | ||
clearTimeout(timeout); | ||
}; | ||
} | ||
return () => null; | ||
}, [show]); | ||
const handleShow = (value) => { | ||
@@ -439,7 +461,6 @@ if (!mounted.current) { | ||
else { | ||
setImperativeOptions(null); | ||
afterHide === null || afterHide === void 0 ? void 0 : afterHide(); | ||
} | ||
}, [show]); | ||
const handleShowTooltipDelayed = (delay = delayShow) => { | ||
const handleShowTooltipDelayed = () => { | ||
if (tooltipShowDelayTimerRef.current) { | ||
@@ -450,3 +471,3 @@ clearTimeout(tooltipShowDelayTimerRef.current); | ||
handleShow(true); | ||
}, delay); | ||
}, delayShow); | ||
}; | ||
@@ -507,3 +528,2 @@ const handleHideTooltipDelayed = (delay = delayHide) => { | ||
const handleTooltipPosition = ({ x, y }) => { | ||
var _a; | ||
const virtualElement = { | ||
@@ -524,3 +544,3 @@ getBoundingClientRect() { | ||
computeTooltipPosition({ | ||
place: (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.place) !== null && _a !== void 0 ? _a : place, | ||
place, | ||
offset, | ||
@@ -555,13 +575,4 @@ elementReference: virtualElement, | ||
}; | ||
const handleClickTooltipAnchor = (event) => { | ||
handleShowTooltip(event); | ||
if (delayHide) { | ||
handleHideTooltipDelayed(); | ||
} | ||
}; | ||
const handleClickOutsideAnchors = (event) => { | ||
var _a; | ||
if (!show) { | ||
return; | ||
} | ||
const anchorById = document.querySelector(`[id='${anchorId}']`); | ||
@@ -585,7 +596,5 @@ const anchors = [anchorById, ...anchorsBySelect]; | ||
const updateTooltipPosition = React.useCallback(() => { | ||
var _a, _b; | ||
const actualPosition = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.position) !== null && _a !== void 0 ? _a : position; | ||
if (actualPosition) { | ||
if (position) { | ||
// if `position` is set, override regular and `float` positioning | ||
handleTooltipPosition(actualPosition); | ||
handleTooltipPosition(position); | ||
return; | ||
@@ -611,3 +620,3 @@ } | ||
computeTooltipPosition({ | ||
place: (_b = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.place) !== null && _b !== void 0 ? _b : place, | ||
place, | ||
offset, | ||
@@ -639,7 +648,5 @@ elementReference: activeAnchor, | ||
place, | ||
imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.place, | ||
offset, | ||
positionStrategy, | ||
position, | ||
imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.position, | ||
float, | ||
@@ -662,3 +669,3 @@ ]); | ||
const tooltipScrollParent = getScrollParent(tooltipRef.current); | ||
if (closeOnScroll) { | ||
if (actualGlobalCloseEvents.scroll) { | ||
window.addEventListener('scroll', handleScrollResize); | ||
@@ -669,3 +676,3 @@ anchorScrollParent === null || anchorScrollParent === void 0 ? void 0 : anchorScrollParent.addEventListener('scroll', handleScrollResize); | ||
let updateTooltipCleanup = null; | ||
if (closeOnResize) { | ||
if (actualGlobalCloseEvents.resize) { | ||
window.addEventListener('resize', handleScrollResize); | ||
@@ -686,18 +693,52 @@ } | ||
}; | ||
if (closeOnEsc) { | ||
if (actualGlobalCloseEvents.escape) { | ||
window.addEventListener('keydown', handleEsc); | ||
} | ||
const enabledEvents = []; | ||
if (shouldOpenOnClick) { | ||
if (actualGlobalCloseEvents.clickOutsideAnchor) { | ||
window.addEventListener('click', handleClickOutsideAnchors); | ||
enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor }); | ||
} | ||
else { | ||
enabledEvents.push({ event: 'mouseenter', listener: debouncedHandleShowTooltip }, { event: 'mouseleave', listener: debouncedHandleHideTooltip }, { event: 'focus', listener: debouncedHandleShowTooltip }, { event: 'blur', listener: debouncedHandleHideTooltip }); | ||
if (float) { | ||
enabledEvents.push({ | ||
event: 'mousemove', | ||
listener: handleMouseMove, | ||
}); | ||
const enabledEvents = []; | ||
const handleClickOpenTooltipAnchor = (event) => { | ||
if (show) { | ||
return; | ||
} | ||
handleShowTooltip(event); | ||
}; | ||
const handleClickCloseTooltipAnchor = () => { | ||
if (!show) { | ||
return; | ||
} | ||
handleHideTooltip(); | ||
}; | ||
const regularEvents = ['mouseenter', 'mouseleave', 'focus', 'blur']; | ||
const clickEvents = ['click', 'dblclick', 'mousedown', 'mouseup']; | ||
Object.entries(actualOpenEvents).forEach(([event, enabled]) => { | ||
if (!enabled) { | ||
return; | ||
} | ||
if (regularEvents.includes(event)) { | ||
enabledEvents.push({ event, listener: debouncedHandleShowTooltip }); | ||
} | ||
else if (clickEvents.includes(event)) { | ||
enabledEvents.push({ event, listener: handleClickOpenTooltipAnchor }); | ||
} | ||
else ; | ||
}); | ||
Object.entries(actualCloseEvents).forEach(([event, enabled]) => { | ||
if (!enabled) { | ||
return; | ||
} | ||
if (regularEvents.includes(event)) { | ||
enabledEvents.push({ event, listener: debouncedHandleHideTooltip }); | ||
} | ||
else if (clickEvents.includes(event)) { | ||
enabledEvents.push({ event, listener: handleClickCloseTooltipAnchor }); | ||
} | ||
else ; | ||
}); | ||
if (float) { | ||
enabledEvents.push({ | ||
event: 'mousemove', | ||
listener: handleMouseMove, | ||
}); | ||
} | ||
@@ -711,3 +752,5 @@ const handleMouseEnterTooltip = () => { | ||
}; | ||
if (clickable && !shouldOpenOnClick) { | ||
if (clickable && !hasClickEvent) { | ||
// used to keep the tooltip open when hovering content. | ||
// not needed if using click events. | ||
(_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', handleMouseEnterTooltip); | ||
@@ -724,3 +767,3 @@ (_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', handleMouseLeaveTooltip); | ||
var _a, _b; | ||
if (closeOnScroll) { | ||
if (actualGlobalCloseEvents.scroll) { | ||
window.removeEventListener('scroll', handleScrollResize); | ||
@@ -730,3 +773,3 @@ anchorScrollParent === null || anchorScrollParent === void 0 ? void 0 : anchorScrollParent.removeEventListener('scroll', handleScrollResize); | ||
} | ||
if (closeOnResize) { | ||
if (actualGlobalCloseEvents.resize) { | ||
window.removeEventListener('resize', handleScrollResize); | ||
@@ -737,9 +780,9 @@ } | ||
} | ||
if (shouldOpenOnClick) { | ||
if (actualGlobalCloseEvents.clickOutsideAnchor) { | ||
window.removeEventListener('click', handleClickOutsideAnchors); | ||
} | ||
if (closeOnEsc) { | ||
if (actualGlobalCloseEvents.escape) { | ||
window.removeEventListener('keydown', handleEsc); | ||
} | ||
if (clickable && !shouldOpenOnClick) { | ||
if (clickable && !hasClickEvent) { | ||
(_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', handleMouseEnterTooltip); | ||
@@ -765,8 +808,10 @@ (_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', handleMouseLeaveTooltip); | ||
anchorsBySelect, | ||
closeOnEsc, | ||
events, | ||
// the effect uses the `actual*Events` objects, but this should work | ||
openEvents, | ||
closeEvents, | ||
globalCloseEvents, | ||
shouldOpenOnClick, | ||
]); | ||
React.useEffect(() => { | ||
var _a, _b; | ||
let selector = (_b = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect) !== null && _a !== void 0 ? _a : anchorSelect) !== null && _b !== void 0 ? _b : ''; | ||
let selector = anchorSelect !== null && anchorSelect !== void 0 ? anchorSelect : ''; | ||
if (!selector && id) { | ||
@@ -844,3 +889,3 @@ selector = `[data-tooltip-id='${id}']`; | ||
setAnchorsBySelect((anchors) => [ | ||
...anchors.filter((anchor) => removedAnchors.includes(anchor)), | ||
...anchors.filter((anchor) => !removedAnchors.includes(anchor)), | ||
...newAnchors, | ||
@@ -861,3 +906,3 @@ ]); | ||
}; | ||
}, [id, anchorSelect, imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect, activeAnchor]); | ||
}, [id, anchorSelect, activeAnchor]); | ||
React.useEffect(() => { | ||
@@ -902,4 +947,3 @@ updateTooltipPosition(); | ||
React.useEffect(() => { | ||
var _a; | ||
let selector = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect) !== null && _a !== void 0 ? _a : anchorSelect; | ||
let selector = anchorSelect; | ||
if (!selector && id) { | ||
@@ -915,49 +959,18 @@ selector = `[data-tooltip-id='${id}']`; | ||
} | ||
catch (_b) { | ||
catch (_a) { | ||
// warning was already issued in the controller | ||
setAnchorsBySelect([]); | ||
} | ||
}, [id, anchorSelect, imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect]); | ||
const actualContent = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.content) !== null && _a !== void 0 ? _a : content; | ||
const canShow = Boolean(!hidden && actualContent && show && Object.keys(inlineStyles).length > 0); | ||
React.useImperativeHandle(forwardRef, () => ({ | ||
open: (options) => { | ||
if (options === null || options === void 0 ? void 0 : options.anchorSelect) { | ||
try { | ||
document.querySelector(options.anchorSelect); | ||
} | ||
catch (_a) { | ||
{ | ||
// eslint-disable-next-line no-console | ||
console.warn(`[react-tooltip] "${options.anchorSelect}" is not a valid CSS selector`); | ||
} | ||
return; | ||
} | ||
}, [id, anchorSelect]); | ||
const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0; | ||
return rendered ? (React__default["default"].createElement(WrapperElement, { id: id, role: "tooltip", className: classNames__default["default"]('react-tooltip', coreStyles['tooltip'], styles['tooltip'], styles[variant], className, `react-tooltip__place-${actualPlacement}`, coreStyles[canShow ? 'show' : 'closing'], canShow ? 'react-tooltip__show' : 'react-tooltip__closing', positionStrategy === 'fixed' && coreStyles['fixed'], clickable && coreStyles['clickable']), onTransitionEnd: (event) => { | ||
/** | ||
* @warning if `--rt-transition-closing-delay` is set to 0, | ||
* the tooltip will be stuck (but not visible) on the DOM | ||
*/ | ||
if (show || event.propertyName !== 'opacity') { | ||
return; | ||
} | ||
setImperativeOptions(options !== null && options !== void 0 ? options : null); | ||
if (options === null || options === void 0 ? void 0 : options.delay) { | ||
handleShowTooltipDelayed(options.delay); | ||
} | ||
else { | ||
handleShow(true); | ||
} | ||
}, | ||
close: (options) => { | ||
if (options === null || options === void 0 ? void 0 : options.delay) { | ||
handleHideTooltipDelayed(options.delay); | ||
} | ||
else { | ||
handleShow(false); | ||
} | ||
}, | ||
activeAnchor, | ||
place: actualPlacement, | ||
isOpen: rendered && canShow, | ||
})); | ||
return rendered ? (React__default["default"].createElement(WrapperElement, { id: id, role: "tooltip", className: classNames__default["default"]('react-tooltip', coreStyles['tooltip'], styles['tooltip'], styles[variant], className, `react-tooltip__place-${actualPlacement}`, { | ||
'react-tooltip__show': canShow, | ||
[coreStyles['show']]: canShow, | ||
[coreStyles['fixed']]: positionStrategy === 'fixed', | ||
[coreStyles['clickable']]: clickable, | ||
}), style: { | ||
setRendered(false); | ||
}, style: { | ||
...externalStyles, | ||
@@ -967,10 +980,4 @@ ...inlineStyles, | ||
}, ref: tooltipRef }, | ||
actualContent, | ||
React__default["default"].createElement(WrapperElement, { className: classNames__default["default"]('react-tooltip-arrow', coreStyles['arrow'], styles['arrow'], classNameArrow, { | ||
/** | ||
* changed from dash `no-arrow` to camelcase because of: | ||
* https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42 | ||
*/ | ||
[coreStyles['noArrow']]: noArrow, | ||
}), style: { | ||
content, | ||
React__default["default"].createElement(WrapperElement, { className: classNames__default["default"]('react-tooltip-arrow', coreStyles['arrow'], styles['arrow'], classNameArrow, noArrow && coreStyles['noArrow']), style: { | ||
...inlineArrowStyles, | ||
@@ -988,3 +995,3 @@ background: arrowColor | ||
const TooltipController = React__default["default"].forwardRef(({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, style, position, isOpen, disableStyleInjection = false, border, opacity, arrowColor, setIsOpen, afterShow, afterHide, }, ref) => { | ||
const TooltipController = ({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, openEvents, closeEvents, globalCloseEvents, style, position, isOpen, disableStyleInjection = false, border, opacity, arrowColor, setIsOpen, afterShow, afterHide, }) => { | ||
const [tooltipContent, setTooltipContent] = React.useState(content); | ||
@@ -1213,3 +1220,2 @@ const [tooltipHtml, setTooltipHtml] = React.useState(html); | ||
const props = { | ||
forwardRef: ref, | ||
id, | ||
@@ -1239,2 +1245,5 @@ anchorId, | ||
closeOnResize, | ||
openEvents, | ||
closeEvents, | ||
globalCloseEvents, | ||
style, | ||
@@ -1253,3 +1262,3 @@ position, | ||
return React__default["default"].createElement(Tooltip, { ...props }); | ||
}); | ||
}; | ||
@@ -1265,6 +1274,7 @@ // those content will be replaced in build time with the `react-tooltip.css` builded content | ||
--rt-opacity: 0.9; | ||
--rt-transition-show-delay: 0.15s; | ||
--rt-transition-closing-delay: 0.15s; | ||
} | ||
.core-styles-module_tooltip__3vRRp { | ||
visibility: hidden; | ||
position: absolute; | ||
@@ -1275,4 +1285,3 @@ top: 0; | ||
opacity: 0; | ||
transition: opacity 0.3s ease-out; | ||
will-change: opacity, visibility; | ||
will-change: opacity; | ||
} | ||
@@ -1298,6 +1307,11 @@ | ||
.core-styles-module_show__Nt9eE { | ||
visibility: visible; | ||
opacity: var(--rt-opacity); | ||
transition: opacity var(--rt-transition-show-delay) ease-out; | ||
} | ||
.core-styles-module_closing__sGnxF { | ||
opacity: 0; | ||
transition: opacity var(--rt-transition-closing-delay) ease-in; | ||
} | ||
`; | ||
@@ -1304,0 +1318,0 @@ const TooltipStyles = ` |
@@ -7,3 +7,3 @@ /* | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/dom"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/dom","classnames"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactTooltip={},e.React,e.FloatingUIDOM,e.classNames)}(this,(function(e,t,o,r){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(t),c=l(r);const s="react-tooltip-core-styles",a="react-tooltip-base-styles",i={core:!1,base:!1};function u({css:e,id:t=a,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||i[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=s),r||(r={});const{insertAt:c}=r;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const u=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.id=t,d.type="text/css","top"===c&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),i[o]=!0}const d=(e,t,o)=>{let r=null;return function(...l){const n=()=>{r=null,o||e.apply(this,l)};o&&!r&&(e.apply(this,l),r=setTimeout(n,t)),o||(r&&clearTimeout(r),r=setTimeout(n,t))}},p="DEFAULT_TOOLTIP_ID",f={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},v={getTooltipData:()=>f},m=t.createContext(v);function y(e=p){return t.useContext(m).getTooltipData(e)}const h="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,w=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const o=t.getPropertyValue(e);return"auto"===o||"scroll"===o}))},S=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(w(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},E=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:r=null,place:l="top",offset:n=10,strategy:c="absolute",middlewares:s=[o.offset(Number(n)),o.flip(),o.shift({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const i=s;return r?(i.push(o.arrow({element:r,padding:5})),o.computePosition(e,t,{placement:l,strategy:c,middleware:i}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const c={left:`${e}px`,top:`${t}px`,border:a},{x:s,y:i}=null!==(l=r.arrow)&&void 0!==l?l:{x:0,y:0},u=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==n?n:"bottom",d=a&&{borderBottom:a,borderRight:a};let p=0;if(a){const e=`${a}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:c,tooltipArrowStyles:{left:null!=s?`${s}px`:"",top:null!=i?`${i}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):o.computePosition(e,t,{placement:"bottom",strategy:c,middleware:i}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))};var b="core-styles-module_tooltip__3vRRp",g="core-styles-module_fixed__pcSol",_="core-styles-module_arrow__cvMwQ",A="core-styles-module_noArrow__xock6",T="core-styles-module_clickable__ZuTTB",R="core-styles-module_show__Nt9eE",O={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const L=({forwardRef:e,id:r,className:l,classNameArrow:s,variant:a="dark",anchorId:i,anchorSelect:u,place:p="top",offset:f=10,events:v=["hover"],openOnClick:m=!1,positionStrategy:w="absolute",middlewares:L,wrapper:C,delayShow:x=0,delayHide:k=0,float:N=!1,hidden:$=!1,noArrow:I=!1,clickable:j=!1,closeOnEsc:B=!1,closeOnScroll:q=!1,closeOnResize:D=!1,style:H,position:M,afterShow:z,afterHide:P,content:W,contentWrapperRef:U,isOpen:F,setIsOpen:K,activeAnchor:X,setActiveAnchor:Y,border:V,opacity:Z,arrowColor:G})=>{var J;const Q=t.useRef(null),ee=t.useRef(null),te=t.useRef(null),oe=t.useRef(null),[re,le]=t.useState(p),[ne,ce]=t.useState({}),[se,ae]=t.useState({}),[ie,ue]=t.useState(!1),[de,pe]=t.useState(!1),[fe,ve]=t.useState(null),me=t.useRef(!1),ye=t.useRef(null),{anchorRefs:he,setActiveAnchor:we}=y(r),Se=t.useRef(!1),[Ee,be]=t.useState([]),ge=t.useRef(!1),_e=m||v.includes("click");h((()=>(ge.current=!0,()=>{ge.current=!1})),[]),t.useEffect((()=>{if(!ie){const e=setTimeout((()=>{pe(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ie]);const Ae=e=>{ge.current&&(e&&pe(!0),setTimeout((()=>{ge.current&&(null==K||K(e),void 0===F&&ue(e))}),10))};t.useEffect((()=>{if(void 0===F)return()=>null;F&&pe(!0);const e=setTimeout((()=>{ue(F)}),10);return()=>{clearTimeout(e)}}),[F]),t.useEffect((()=>{ie!==me.current&&(me.current=ie,ie?null==z||z():(ve(null),null==P||P()))}),[ie]);const Te=(e=x)=>{te.current&&clearTimeout(te.current),te.current=setTimeout((()=>{Ae(!0)}),e)},Re=(e=k)=>{oe.current&&clearTimeout(oe.current),oe.current=setTimeout((()=>{Se.current||Ae(!1)}),e)},Oe=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return Y(null),void we({current:null});x?Te():Ae(!0),Y(o),we({current:o}),oe.current&&clearTimeout(oe.current)},Le=()=>{j?Re(k||100):k?Re():Ae(!1),te.current&&clearTimeout(te.current)},Ce=({x:e,y:t})=>{var o;const r={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};E({place:null!==(o=null==fe?void 0:fe.place)&&void 0!==o?o:p,offset:f,elementReference:r,tooltipReference:Q.current,tooltipArrowReference:ee.current,strategy:w,middlewares:L,border:V}).then((e=>{Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),le(e.place)}))},xe=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};Ce(o),ye.current=o},ke=e=>{Oe(e),k&&Re()},Ne=e=>{var t;if(!ie)return;[document.querySelector(`[id='${i}']`),...Ee].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=Q.current)||void 0===t?void 0:t.contains(e.target))||(Ae(!1),te.current&&clearTimeout(te.current))},$e=d(Oe,50,!0),Ie=d(Le,50,!0),je=t.useCallback((()=>{var e,t;const o=null!==(e=null==fe?void 0:fe.position)&&void 0!==e?e:M;o?Ce(o):N?ye.current&&Ce(ye.current):(null==X?void 0:X.isConnected)&&E({place:null!==(t=null==fe?void 0:fe.place)&&void 0!==t?t:p,offset:f,elementReference:X,tooltipReference:Q.current,tooltipArrowReference:ee.current,strategy:w,middlewares:L,border:V}).then((e=>{ge.current&&(Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),le(e.place))}))}),[ie,X,W,H,p,null==fe?void 0:fe.place,f,w,M,null==fe?void 0:fe.position,N]);t.useEffect((()=>{var e,t;const r=new Set(he);Ee.forEach((e=>{r.add({current:e})}));const l=document.querySelector(`[id='${i}']`);l&&r.add({current:l});const n=()=>{Ae(!1)},c=S(X),s=S(Q.current);q&&(window.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n));let a=null;D?window.addEventListener("resize",n):X&&Q.current&&(a=o.autoUpdate(X,Q.current,je,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&Ae(!1)};B&&window.addEventListener("keydown",u);const d=[];_e?(window.addEventListener("click",Ne),d.push({event:"click",listener:ke})):(d.push({event:"mouseenter",listener:$e},{event:"mouseleave",listener:Ie},{event:"focus",listener:$e},{event:"blur",listener:Ie}),N&&d.push({event:"mousemove",listener:xe}));const p=()=>{Se.current=!0},f=()=>{Se.current=!1,Le()};return j&&!_e&&(null===(e=Q.current)||void 0===e||e.addEventListener("mouseenter",p),null===(t=Q.current)||void 0===t||t.addEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.addEventListener(e,t)}))})),()=>{var e,t;q&&(window.removeEventListener("scroll",n),null==c||c.removeEventListener("scroll",n),null==s||s.removeEventListener("scroll",n)),D?window.removeEventListener("resize",n):null==a||a(),_e&&window.removeEventListener("click",Ne),B&&window.removeEventListener("keydown",u),j&&!_e&&(null===(e=Q.current)||void 0===e||e.removeEventListener("mouseenter",p),null===(t=Q.current)||void 0===t||t.removeEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[X,je,de,he,Ee,B,v]),t.useEffect((()=>{var e,t;let o=null!==(t=null!==(e=null==fe?void 0:fe.anchorSelect)&&void 0!==e?e:u)&&void 0!==t?t:"";!o&&r&&(o=`[data-tooltip-id='${r}']`);const l=new MutationObserver((e=>{const t=[],l=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName){e.target.getAttribute("data-tooltip-id")===r&&t.push(e.target)}if("childList"===e.type){if(X){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(o)try{l.push(...t.filter((e=>e.matches(o)))),l.push(...t.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,X))&&(pe(!1),Ae(!1),Y(null),te.current&&clearTimeout(te.current),oe.current&&clearTimeout(oe.current),!0)}))}if(o)try{const r=[...e.addedNodes].filter((e=>1===e.nodeType));t.push(...r.filter((e=>e.matches(o)))),t.push(...r.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}}})),(t.length||l.length)&&be((e=>[...e.filter((e=>l.includes(e))),...t]))}));return l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{l.disconnect()}}),[r,u,null==fe?void 0:fe.anchorSelect,X]),t.useEffect((()=>{je()}),[je]),t.useEffect((()=>{if(!(null==U?void 0:U.current))return()=>null;const e=new ResizeObserver((()=>{je()}));return e.observe(U.current),()=>{e.disconnect()}}),[W,null==U?void 0:U.current]),t.useEffect((()=>{var e;const t=document.querySelector(`[id='${i}']`),o=[...Ee,t];X&&o.includes(X)||Y(null!==(e=Ee[0])&&void 0!==e?e:t)}),[i,Ee,X]),t.useEffect((()=>()=>{te.current&&clearTimeout(te.current),oe.current&&clearTimeout(oe.current)}),[]),t.useEffect((()=>{var e;let t=null!==(e=null==fe?void 0:fe.anchorSelect)&&void 0!==e?e:u;if(!t&&r&&(t=`[data-tooltip-id='${r}']`),t)try{const e=Array.from(document.querySelectorAll(t));be(e)}catch(e){be([])}}),[r,u,null==fe?void 0:fe.anchorSelect]);const Be=null!==(J=null==fe?void 0:fe.content)&&void 0!==J?J:W,qe=Boolean(!$&&Be&&ie&&Object.keys(ne).length>0);return t.useImperativeHandle(e,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}ve(null!=e?e:null),(null==e?void 0:e.delay)?Te(e.delay):Ae(!0)},close:e=>{(null==e?void 0:e.delay)?Re(e.delay):Ae(!1)},activeAnchor:X,place:re,isOpen:de&&qe}))),de?n.default.createElement(C,{id:r,role:"tooltip",className:c.default("react-tooltip",b,O.tooltip,O[a],l,`react-tooltip__place-${re}`,{"react-tooltip__show":qe,[R]:qe,[g]:"fixed"===w,[T]:j}),style:{...H,...ne,opacity:void 0!==Z&&qe?Z:void 0},ref:Q},Be,n.default.createElement(C,{className:c.default("react-tooltip-arrow",_,O.arrow,s,{[A]:I}),style:{...se,background:G?`linear-gradient(to right bottom, transparent 50%, ${G} 50%)`:void 0},ref:ee})):null},C=({content:e})=>n.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),x=n.default.forwardRef((({id:e,anchorId:o,anchorSelect:r,content:l,html:c,render:s,className:a,classNameArrow:i,variant:u="dark",place:d="top",offset:p=10,wrapper:f="div",children:v=null,events:m=["hover"],openOnClick:h=!1,positionStrategy:w="absolute",middlewares:S,delayShow:E=0,delayHide:b=0,float:g=!1,hidden:_=!1,noArrow:A=!1,clickable:T=!1,closeOnEsc:R=!1,closeOnScroll:O=!1,closeOnResize:x=!1,style:k,position:N,isOpen:$,disableStyleInjection:I=!1,border:j,opacity:B,arrowColor:q,setIsOpen:D,afterShow:H,afterHide:M},z)=>{const[P,W]=t.useState(l),[U,F]=t.useState(c),[K,X]=t.useState(d),[Y,V]=t.useState(u),[Z,G]=t.useState(p),[J,Q]=t.useState(E),[ee,te]=t.useState(b),[oe,re]=t.useState(g),[le,ne]=t.useState(_),[ce,se]=t.useState(f),[ae,ie]=t.useState(m),[ue,de]=t.useState(w),[pe,fe]=t.useState(null),ve=t.useRef(I),{anchorRefs:me,activeAnchor:ye}=y(e),he=e=>null==e?void 0:e.getAttributeNames().reduce(((t,o)=>{var r;if(o.startsWith("data-tooltip-")){t[o.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(o))&&void 0!==r?r:null}return t}),{}),we=e=>{const t={place:e=>{var t;X(null!==(t=e)&&void 0!==t?t:d)},content:e=>{W(null!=e?e:l)},html:e=>{F(null!=e?e:c)},variant:e=>{var t;V(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{G(null===e?p:Number(e))},wrapper:e=>{var t;se(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ie(null!=t?t:m)},"position-strategy":e=>{var t;de(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{Q(null===e?E:Number(e))},"delay-hide":e=>{te(null===e?b:Number(e))},float:e=>{re(null===e?g:"true"===e)},hidden:e=>{ne(null===e?_:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,o])=>{var r;null===(r=t[e])||void 0===r||r.call(t,o)}))};t.useEffect((()=>{W(l)}),[l]),t.useEffect((()=>{F(c)}),[c]),t.useEffect((()=>{X(d)}),[d]),t.useEffect((()=>{V(u)}),[u]),t.useEffect((()=>{G(p)}),[p]),t.useEffect((()=>{Q(E)}),[E]),t.useEffect((()=>{te(b)}),[b]),t.useEffect((()=>{re(g)}),[g]),t.useEffect((()=>{ne(_)}),[_]),t.useEffect((()=>{de(w)}),[w]),t.useEffect((()=>{ve.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),t.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===I,disableBase:I}}))}),[]),t.useEffect((()=>{var t;const l=new Set(me);let n=r;if(!n&&e&&(n=`[data-tooltip-id='${e}']`),n)try{document.querySelectorAll(n).forEach((e=>{l.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${n}" is not a valid CSS selector`)}const c=document.querySelector(`[id='${o}']`);if(c&&l.add({current:c}),!l.size)return()=>null;const s=null!==(t=null!=pe?pe:c)&&void 0!==t?t:ye.current,a=new MutationObserver((e=>{e.forEach((e=>{var t;if(!s||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=he(s);we(o)}))})),i={attributes:!0,childList:!1,subtree:!1};if(s){const e=he(s);we(e),a.observe(s,i)}return()=>{a.disconnect()}}),[me,ye,pe,o,r]),t.useEffect((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),j&&!CSS.supports("border",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),B&&!CSS.supports("opacity",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`opacity\`.`)}),[]);let Se=v;const Ee=t.useRef(null);if(s){const e=s({content:null!=P?P:null,activeAnchor:pe});Se=e?n.default.createElement("div",{ref:Ee,className:"react-tooltip-content-wrapper"},e):null}else P&&(Se=P);U&&(Se=n.default.createElement(C,{content:U}));const be={forwardRef:z,id:e,anchorId:o,anchorSelect:r,className:a,classNameArrow:i,content:Se,contentWrapperRef:Ee,place:K,variant:Y,offset:Z,wrapper:ce,events:ae,openOnClick:h,positionStrategy:ue,middlewares:S,delayShow:J,delayHide:ee,float:oe,hidden:le,noArrow:A,clickable:T,closeOnEsc:R,closeOnScroll:O,closeOnResize:x,style:k,position:N,isOpen:$,border:j,opacity:B,arrowColor:q,setIsOpen:D,afterShow:H,afterHide:M,activeAnchor:pe,setActiveAnchor:e=>fe(e)};return n.default.createElement(L,{...be})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||u({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||u({css:` | ||
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})})),e.Tooltip=x,e.TooltipProvider=({children:e})=>{const[o,r]=t.useState({[p]:new Set}),[l,c]=t.useState({[p]:{current:null}}),s=(e,...t)=>{r((o=>{var r;const l=null!==(r=o[e])&&void 0!==r?r:new Set;return t.forEach((e=>l.add(e))),{...o,[e]:new Set(l)}}))},a=(e,...t)=>{r((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},i=t.useCallback(((e=p)=>{var t,r;return{anchorRefs:null!==(t=o[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=l[e])&&void 0!==r?r:{current:null},attach:(...t)=>s(e,...t),detach:(...t)=>a(e,...t),setActiveAnchor:t=>((e,t)=>{c((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[o,l,s,a]),u=t.useMemo((()=>({getTooltipData:i})),[i]);return n.default.createElement(m.Provider,{value:u},e)},e.TooltipWrapper=({tooltipId:e,children:o,className:r,place:l,content:s,html:a,variant:i,offset:u,wrapper:d,events:p,positionStrategy:f,delayShow:v,delayHide:m})=>{const{attach:h,detach:w}=y(e),S=t.useRef(null);return t.useEffect((()=>(h(S),()=>{w(S)})),[]),n.default.createElement("span",{ref:S,className:c.default("react-tooltip-wrapper",r),"data-tooltip-place":l,"data-tooltip-content":s,"data-tooltip-html":a,"data-tooltip-variant":i,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":f,"data-tooltip-delay-show":v,"data-tooltip-delay-hide":m},o)},e.removeStyle=function({type:e="base",id:t=a}={}){if(!i[e])return;"core"===e&&(t=s);const o=document.getElementById(t);"style"===(null==o?void 0:o.tagName)?null==o||o.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),i[e]=!1},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/dom"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/dom","classnames"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactTooltip={},e.React,e.FloatingUIDOM,e.classNames)}(this,(function(e,t,o,r){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(t),s=l(r);const c="react-tooltip-core-styles",i="react-tooltip-base-styles",a={core:!1,base:!1};function u({css:e,id:t=i,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||a[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=c),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const u=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.id=t,d.type="text/css","top"===s&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),a[o]=!0}const d=(e,t,o)=>{let r=null;return function(...l){const n=()=>{r=null,o||e.apply(this,l)};o&&!r&&(e.apply(this,l),r=setTimeout(n,t)),o||(r&&clearTimeout(r),r=setTimeout(n,t))}},p="DEFAULT_TOOLTIP_ID",f={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},v={getTooltipData:()=>f},m=t.createContext(v);function y(e=p){return t.useContext(m).getTooltipData(e)}const h="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,w=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const o=t.getPropertyValue(e);return"auto"===o||"scroll"===o}))},E=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(w(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},S=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:r=null,place:l="top",offset:n=10,strategy:s="absolute",middlewares:c=[o.offset(Number(n)),o.flip(),o.shift({padding:5})],border:i})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const a=c;return r?(a.push(o.arrow({element:r,padding:5})),o.computePosition(e,t,{placement:l,strategy:s,middleware:a}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const s={left:`${e}px`,top:`${t}px`,border:i},{x:c,y:a}=null!==(l=r.arrow)&&void 0!==l?l:{x:0,y:0},u=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==n?n:"bottom",d=i&&{borderBottom:i,borderRight:i};let p=0;if(i){const e=`${i}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:s,tooltipArrowStyles:{left:null!=c?`${c}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):o.computePosition(e,t,{placement:"bottom",strategy:s,middleware:a}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))};var b={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},g={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const _=({id:e,className:r,classNameArrow:l,variant:c="dark",anchorId:i,anchorSelect:a,place:u="top",offset:p=10,events:f=["hover"],openOnClick:v=!1,positionStrategy:m="absolute",middlewares:w,wrapper:_,delayShow:A=0,delayHide:T=0,float:O=!1,hidden:R=!1,noArrow:k=!1,clickable:L=!1,closeOnEsc:C=!1,closeOnScroll:x=!1,closeOnResize:N=!1,openEvents:$,closeEvents:j,globalCloseEvents:I,style:B,position:D,afterShow:q,afterHide:z,content:H,contentWrapperRef:M,isOpen:P,setIsOpen:W,activeAnchor:F,setActiveAnchor:U,border:K,opacity:X,arrowColor:Y})=>{const G=t.useRef(null),V=t.useRef(null),Z=t.useRef(null),J=t.useRef(null),[Q,ee]=t.useState(u),[te,oe]=t.useState({}),[re,le]=t.useState({}),[ne,se]=t.useState(!1),[ce,ie]=t.useState(!1),ae=t.useRef(!1),ue=t.useRef(null),{anchorRefs:de,setActiveAnchor:pe}=y(e),fe=t.useRef(!1),[ve,me]=t.useState([]),ye=t.useRef(!1),he=v||f.includes("click"),we=he||(null==$?void 0:$.click)||(null==$?void 0:$.dblclick)||(null==$?void 0:$.mousedown),Ee=$?{...$}:{mouseenter:!0,focus:!0,click:!1,dblclick:!1,mousedown:!1};!$&&he&&Object.assign(Ee,{mouseenter:!1,focus:!1,click:!0});const Se=j?{...j}:{mouseleave:!0,blur:!0,click:!1};!j&&he&&Object.assign(Se,{mouseleave:!1,blur:!1});const be=I?{...I}:{escape:C||!1,scroll:x||!1,resize:N||!1,clickOutsideAnchor:we||!1};h((()=>(ye.current=!0,()=>{ye.current=!1})),[]);const ge=e=>{ye.current&&(e&&ie(!0),setTimeout((()=>{ye.current&&(null==W||W(e),void 0===P&&se(e))}),10))};t.useEffect((()=>{if(void 0===P)return()=>null;P&&ie(!0);const e=setTimeout((()=>{se(P)}),10);return()=>{clearTimeout(e)}}),[P]),t.useEffect((()=>{ne!==ae.current&&(ae.current=ne,ne?null==q||q():null==z||z())}),[ne]);const _e=(e=T)=>{J.current&&clearTimeout(J.current),J.current=setTimeout((()=>{fe.current||ge(!1)}),e)},Ae=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return U(null),void pe({current:null});A?(Z.current&&clearTimeout(Z.current),Z.current=setTimeout((()=>{ge(!0)}),A)):ge(!0),U(o),pe({current:o}),J.current&&clearTimeout(J.current)},Te=()=>{L?_e(T||100):T?_e():ge(!1),Z.current&&clearTimeout(Z.current)},Oe=({x:e,y:t})=>{S({place:u,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:G.current,tooltipArrowReference:V.current,strategy:m,middlewares:w,border:K}).then((e=>{Object.keys(e.tooltipStyles).length&&oe(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&le(e.tooltipArrowStyles),ee(e.place)}))},Re=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};Oe(o),ue.current=o},ke=e=>{var t;[document.querySelector(`[id='${i}']`),...ve].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=G.current)||void 0===t?void 0:t.contains(e.target))||(ge(!1),Z.current&&clearTimeout(Z.current))},Le=d(Ae,50,!0),Ce=d(Te,50,!0),xe=t.useCallback((()=>{D?Oe(D):O?ue.current&&Oe(ue.current):(null==F?void 0:F.isConnected)&&S({place:u,offset:p,elementReference:F,tooltipReference:G.current,tooltipArrowReference:V.current,strategy:m,middlewares:w,border:K}).then((e=>{ye.current&&(Object.keys(e.tooltipStyles).length&&oe(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&le(e.tooltipArrowStyles),ee(e.place))}))}),[ne,F,H,B,u,p,m,D,O]);t.useEffect((()=>{var e,t;const r=new Set(de);ve.forEach((e=>{r.add({current:e})}));const l=document.querySelector(`[id='${i}']`);l&&r.add({current:l});const n=()=>{ge(!1)},s=E(F),c=E(G.current);be.scroll&&(window.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n));let a=null;be.resize?window.addEventListener("resize",n):F&&G.current&&(a=o.autoUpdate(F,G.current,xe,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&ge(!1)};be.escape&&window.addEventListener("keydown",u),be.clickOutsideAnchor&&window.addEventListener("click",ke);const d=[],p=e=>{ne||Ae(e)},f=()=>{ne&&Te()},v=["mouseenter","mouseleave","focus","blur"],m=["click","dblclick","mousedown","mouseup"];Object.entries(Ee).forEach((([e,t])=>{t&&(v.includes(e)?d.push({event:e,listener:Le}):m.includes(e)&&d.push({event:e,listener:p}))})),Object.entries(Se).forEach((([e,t])=>{t&&(v.includes(e)?d.push({event:e,listener:Ce}):m.includes(e)&&d.push({event:e,listener:f}))})),O&&d.push({event:"mousemove",listener:Re});const y=()=>{fe.current=!0},h=()=>{fe.current=!1,Te()};return L&&!we&&(null===(e=G.current)||void 0===e||e.addEventListener("mouseenter",y),null===(t=G.current)||void 0===t||t.addEventListener("mouseleave",h)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.addEventListener(e,t)}))})),()=>{var e,t;be.scroll&&(window.removeEventListener("scroll",n),null==s||s.removeEventListener("scroll",n),null==c||c.removeEventListener("scroll",n)),be.resize?window.removeEventListener("resize",n):null==a||a(),be.clickOutsideAnchor&&window.removeEventListener("click",ke),be.escape&&window.removeEventListener("keydown",u),L&&!we&&(null===(e=G.current)||void 0===e||e.removeEventListener("mouseenter",y),null===(t=G.current)||void 0===t||t.removeEventListener("mouseleave",h)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[F,xe,ce,de,ve,$,j,I,he]),t.useEffect((()=>{let t=null!=a?a:"";!t&&e&&(t=`[data-tooltip-id='${e}']`);const o=new MutationObserver((o=>{const r=[],l=[];o.forEach((o=>{if("attributes"===o.type&&"data-tooltip-id"===o.attributeName){o.target.getAttribute("data-tooltip-id")===e&&r.push(o.target)}if("childList"===o.type){if(F){const e=[...o.removedNodes].filter((e=>1===e.nodeType));if(t)try{l.push(...e.filter((e=>e.matches(t)))),l.push(...e.flatMap((e=>[...e.querySelectorAll(t)])))}catch(e){}e.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,F))&&(ie(!1),ge(!1),U(null),Z.current&&clearTimeout(Z.current),J.current&&clearTimeout(J.current),!0)}))}if(t)try{const e=[...o.addedNodes].filter((e=>1===e.nodeType));r.push(...e.filter((e=>e.matches(t)))),r.push(...e.flatMap((e=>[...e.querySelectorAll(t)])))}catch(e){}}})),(r.length||l.length)&&me((e=>[...e.filter((e=>!l.includes(e))),...r]))}));return o.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{o.disconnect()}}),[e,a,F]),t.useEffect((()=>{xe()}),[xe]),t.useEffect((()=>{if(!(null==M?void 0:M.current))return()=>null;const e=new ResizeObserver((()=>{xe()}));return e.observe(M.current),()=>{e.disconnect()}}),[H,null==M?void 0:M.current]),t.useEffect((()=>{var e;const t=document.querySelector(`[id='${i}']`),o=[...ve,t];F&&o.includes(F)||U(null!==(e=ve[0])&&void 0!==e?e:t)}),[i,ve,F]),t.useEffect((()=>()=>{Z.current&&clearTimeout(Z.current),J.current&&clearTimeout(J.current)}),[]),t.useEffect((()=>{let t=a;if(!t&&e&&(t=`[data-tooltip-id='${e}']`),t)try{const e=Array.from(document.querySelectorAll(t));me(e)}catch(e){me([])}}),[e,a]);const Ne=!R&&H&&ne&&Object.keys(te).length>0;return ce?n.default.createElement(_,{id:e,role:"tooltip",className:s.default("react-tooltip",b.tooltip,g.tooltip,g[c],r,`react-tooltip__place-${Q}`,b[Ne?"show":"closing"],Ne?"react-tooltip__show":"react-tooltip__closing","fixed"===m&&b.fixed,L&&b.clickable),onTransitionEnd:e=>{ne||"opacity"!==e.propertyName||ie(!1)},style:{...B,...te,opacity:void 0!==X&&Ne?X:void 0},ref:G},H,n.default.createElement(_,{className:s.default("react-tooltip-arrow",b.arrow,g.arrow,l,k&&b.noArrow),style:{...re,background:Y?`linear-gradient(to right bottom, transparent 50%, ${Y} 50%)`:void 0},ref:V})):null},A=({content:e})=>n.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}});"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||u({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}`,type:"core"}),e.detail.disableBase||u({css:` | ||
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})})),e.Tooltip=({id:e,anchorId:o,anchorSelect:r,content:l,html:s,render:c,className:i,classNameArrow:a,variant:u="dark",place:d="top",offset:p=10,wrapper:f="div",children:v=null,events:m=["hover"],openOnClick:h=!1,positionStrategy:w="absolute",middlewares:E,delayShow:S=0,delayHide:b=0,float:g=!1,hidden:T=!1,noArrow:O=!1,clickable:R=!1,closeOnEsc:k=!1,closeOnScroll:L=!1,closeOnResize:C=!1,openEvents:x,closeEvents:N,globalCloseEvents:$,style:j,position:I,isOpen:B,disableStyleInjection:D=!1,border:q,opacity:z,arrowColor:H,setIsOpen:M,afterShow:P,afterHide:W})=>{const[F,U]=t.useState(l),[K,X]=t.useState(s),[Y,G]=t.useState(d),[V,Z]=t.useState(u),[J,Q]=t.useState(p),[ee,te]=t.useState(S),[oe,re]=t.useState(b),[le,ne]=t.useState(g),[se,ce]=t.useState(T),[ie,ae]=t.useState(f),[ue,de]=t.useState(m),[pe,fe]=t.useState(w),[ve,me]=t.useState(null),ye=t.useRef(D),{anchorRefs:he,activeAnchor:we}=y(e),Ee=e=>null==e?void 0:e.getAttributeNames().reduce(((t,o)=>{var r;if(o.startsWith("data-tooltip-")){t[o.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(o))&&void 0!==r?r:null}return t}),{}),Se=e=>{const t={place:e=>{var t;G(null!==(t=e)&&void 0!==t?t:d)},content:e=>{U(null!=e?e:l)},html:e=>{X(null!=e?e:s)},variant:e=>{var t;Z(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{Q(null===e?p:Number(e))},wrapper:e=>{var t;ae(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");de(null!=t?t:m)},"position-strategy":e=>{var t;fe(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{te(null===e?S:Number(e))},"delay-hide":e=>{re(null===e?b:Number(e))},float:e=>{ne(null===e?g:"true"===e)},hidden:e=>{ce(null===e?T:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,o])=>{var r;null===(r=t[e])||void 0===r||r.call(t,o)}))};t.useEffect((()=>{U(l)}),[l]),t.useEffect((()=>{X(s)}),[s]),t.useEffect((()=>{G(d)}),[d]),t.useEffect((()=>{Z(u)}),[u]),t.useEffect((()=>{Q(p)}),[p]),t.useEffect((()=>{te(S)}),[S]),t.useEffect((()=>{re(b)}),[b]),t.useEffect((()=>{ne(g)}),[g]),t.useEffect((()=>{ce(T)}),[T]),t.useEffect((()=>{fe(w)}),[w]),t.useEffect((()=>{ye.current!==D&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[D]),t.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===D,disableBase:D}}))}),[]),t.useEffect((()=>{var t;const l=new Set(he);let n=r;if(!n&&e&&(n=`[data-tooltip-id='${e}']`),n)try{document.querySelectorAll(n).forEach((e=>{l.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${n}" is not a valid CSS selector`)}const s=document.querySelector(`[id='${o}']`);if(s&&l.add({current:s}),!l.size)return()=>null;const c=null!==(t=null!=ve?ve:s)&&void 0!==t?t:we.current,i=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=Ee(c);Se(o)}))})),a={attributes:!0,childList:!1,subtree:!1};if(c){const e=Ee(c);Se(e),i.observe(c,a)}return()=>{i.disconnect()}}),[he,we,ve,o,r]),t.useEffect((()=>{(null==j?void 0:j.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),q&&!CSS.supports("border",`${q}`)&&console.warn(`[react-tooltip] "${q}" is not a valid \`border\`.`),(null==j?void 0:j.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),z&&!CSS.supports("opacity",`${z}`)&&console.warn(`[react-tooltip] "${z}" is not a valid \`opacity\`.`)}),[]);let be=v;const ge=t.useRef(null);if(c){const e=c({content:null!=F?F:null,activeAnchor:ve});be=e?n.default.createElement("div",{ref:ge,className:"react-tooltip-content-wrapper"},e):null}else F&&(be=F);K&&(be=n.default.createElement(A,{content:K}));const _e={id:e,anchorId:o,anchorSelect:r,className:i,classNameArrow:a,content:be,contentWrapperRef:ge,place:Y,variant:V,offset:J,wrapper:ie,events:ue,openOnClick:h,positionStrategy:pe,middlewares:E,delayShow:ee,delayHide:oe,float:le,hidden:se,noArrow:O,clickable:R,closeOnEsc:k,closeOnScroll:L,closeOnResize:C,openEvents:x,closeEvents:N,globalCloseEvents:$,style:j,position:I,isOpen:B,border:q,opacity:z,arrowColor:H,setIsOpen:M,afterShow:P,afterHide:W,activeAnchor:ve,setActiveAnchor:e=>me(e)};return n.default.createElement(_,{..._e})},e.TooltipProvider=({children:e})=>{const[o,r]=t.useState({[p]:new Set}),[l,s]=t.useState({[p]:{current:null}}),c=(e,...t)=>{r((o=>{var r;const l=null!==(r=o[e])&&void 0!==r?r:new Set;return t.forEach((e=>l.add(e))),{...o,[e]:new Set(l)}}))},i=(e,...t)=>{r((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},a=t.useCallback(((e=p)=>{var t,r;return{anchorRefs:null!==(t=o[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=l[e])&&void 0!==r?r:{current:null},attach:(...t)=>c(e,...t),detach:(...t)=>i(e,...t),setActiveAnchor:t=>((e,t)=>{s((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[o,l,c,i]),u=t.useMemo((()=>({getTooltipData:a})),[a]);return n.default.createElement(m.Provider,{value:u},e)},e.TooltipWrapper=({tooltipId:e,children:o,className:r,place:l,content:c,html:i,variant:a,offset:u,wrapper:d,events:p,positionStrategy:f,delayShow:v,delayHide:m})=>{const{attach:h,detach:w}=y(e),E=t.useRef(null);return t.useEffect((()=>(h(E),()=>{w(E)})),[]),n.default.createElement("span",{ref:E,className:s.default("react-tooltip-wrapper",r),"data-tooltip-place":l,"data-tooltip-content":c,"data-tooltip-html":i,"data-tooltip-variant":a,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":f,"data-tooltip-delay-show":v,"data-tooltip-delay-hide":m},o)},e.removeStyle=function({type:e="base",id:t=i}={}){if(!a[e])return;"core"===e&&(t=c);const o=document.getElementById(t);"style"===(null==o?void 0:o.tagName)?null==o||o.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),a[e]=!1},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "react-tooltip", | ||
"version": "5.22.0-beta.1109.1", | ||
"version": "5.22.0", | ||
"description": "react tooltip component", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4773
2
756216