react-tooltip 5.9.1-beta.0 → 5.10.0-beta.0
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/react-tooltip.cjs.js +41 -32
- package/dist/react-tooltip.cjs.js.map +4 -4
- package/dist/react-tooltip.cjs.min.js +1 -1
- package/dist/react-tooltip.cjs.min.js.map +4 -4
- package/dist/react-tooltip.d.ts +5 -1
- package/dist/react-tooltip.esm.js +40 -31
- package/dist/react-tooltip.esm.js.map +4 -4
- package/dist/react-tooltip.esm.min.js +1 -1
- package/dist/react-tooltip.esm.min.js.map +4 -4
- package/dist/react-tooltip.iife.js +41 -32
- package/dist/react-tooltip.iife.js.map +4 -4
- package/dist/react-tooltip.iife.min.js +1 -1
- package/dist/react-tooltip.iife.min.js.map +4 -4
- package/dist/react-tooltip.min.js +1 -1
- package/dist/react-tooltip.min.js.map +4 -4
- package/package.json +1 -1
|
@@ -100,13 +100,6 @@ var debounce = (func, wait, immediate) => {
|
|
|
100
100
|
};
|
|
101
101
|
var debounce_default = debounce;
|
|
102
102
|
|
|
103
|
-
// src/components/TooltipContent/TooltipContent.tsx
|
|
104
|
-
import { jsx } from "react/jsx-runtime";
|
|
105
|
-
var TooltipContent = ({ content }) => {
|
|
106
|
-
return /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
107
|
-
};
|
|
108
|
-
var TooltipContent_default = TooltipContent;
|
|
109
|
-
|
|
110
103
|
// src/components/TooltipProvider/TooltipProvider.tsx
|
|
111
104
|
import {
|
|
112
105
|
createContext,
|
|
@@ -115,7 +108,7 @@ import {
|
|
|
115
108
|
useMemo,
|
|
116
109
|
useState
|
|
117
110
|
} from "react";
|
|
118
|
-
import { jsx
|
|
111
|
+
import { jsx } from "react/jsx-runtime";
|
|
119
112
|
var DEFAULT_TOOLTIP_ID = "DEFAULT_TOOLTIP_ID";
|
|
120
113
|
var DEFAULT_CONTEXT_DATA = {
|
|
121
114
|
anchorRefs: /* @__PURE__ */ new Set(),
|
|
@@ -183,7 +176,7 @@ var TooltipProvider = ({ children }) => {
|
|
|
183
176
|
getTooltipData
|
|
184
177
|
};
|
|
185
178
|
}, [getTooltipData]);
|
|
186
|
-
return /* @__PURE__ */
|
|
179
|
+
return /* @__PURE__ */ jsx(TooltipContext.Provider, { value: context, children });
|
|
187
180
|
};
|
|
188
181
|
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
189
182
|
return useContext(TooltipContext).getTooltipData(tooltipId);
|
|
@@ -193,7 +186,7 @@ var TooltipProvider_default = TooltipProvider;
|
|
|
193
186
|
// src/components/TooltipProvider/TooltipWrapper.tsx
|
|
194
187
|
var import_classnames = __toESM(require_classnames());
|
|
195
188
|
import { useEffect, useRef } from "react";
|
|
196
|
-
import { jsx as
|
|
189
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
197
190
|
var TooltipWrapper = ({
|
|
198
191
|
tooltipId,
|
|
199
192
|
children,
|
|
@@ -217,7 +210,7 @@ var TooltipWrapper = ({
|
|
|
217
210
|
detach(anchorRef);
|
|
218
211
|
};
|
|
219
212
|
}, []);
|
|
220
|
-
return /* @__PURE__ */
|
|
213
|
+
return /* @__PURE__ */ jsx2(
|
|
221
214
|
"span",
|
|
222
215
|
{
|
|
223
216
|
ref: anchorRef,
|
|
@@ -709,7 +702,7 @@ var computeTooltipPosition = async ({
|
|
|
709
702
|
var styles_module_default = { "arrow": "react-tooltip__arrow_KtSkBq", "clickable": "react-tooltip__clickable_KtSkBq", "dark": "react-tooltip__dark_KtSkBq", "error": "react-tooltip__error_KtSkBq", "fixed": "react-tooltip__fixed_KtSkBq", "info": "react-tooltip__info_KtSkBq", "light": "react-tooltip__light_KtSkBq", "noArrow": "react-tooltip__no-arrow_KtSkBq", "show": "react-tooltip__show_KtSkBq", "success": "react-tooltip__success_KtSkBq", "tooltip": "react-tooltip__tooltip_KtSkBq", "warning": "react-tooltip__warning_KtSkBq" };
|
|
710
703
|
|
|
711
704
|
// src/components/Tooltip/Tooltip.tsx
|
|
712
|
-
import { jsx as
|
|
705
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
713
706
|
var Tooltip = ({
|
|
714
707
|
// props
|
|
715
708
|
id,
|
|
@@ -724,7 +717,6 @@ var Tooltip = ({
|
|
|
724
717
|
positionStrategy = "absolute",
|
|
725
718
|
middlewares,
|
|
726
719
|
wrapper: WrapperElement,
|
|
727
|
-
children = null,
|
|
728
720
|
delayShow = 0,
|
|
729
721
|
delayHide = 0,
|
|
730
722
|
float = false,
|
|
@@ -737,7 +729,6 @@ var Tooltip = ({
|
|
|
737
729
|
afterHide,
|
|
738
730
|
// props handled by controller
|
|
739
731
|
content,
|
|
740
|
-
html,
|
|
741
732
|
isOpen,
|
|
742
733
|
setIsOpen,
|
|
743
734
|
activeAnchor,
|
|
@@ -1096,7 +1087,7 @@ var Tooltip = ({
|
|
|
1096
1087
|
}
|
|
1097
1088
|
setActualPlacement(computedStylesData.place);
|
|
1098
1089
|
});
|
|
1099
|
-
}, [show, activeAnchor, content,
|
|
1090
|
+
}, [show, activeAnchor, content, place, offset, positionStrategy, position]);
|
|
1100
1091
|
useEffect3(() => {
|
|
1101
1092
|
var _a;
|
|
1102
1093
|
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
@@ -1130,27 +1121,29 @@ var Tooltip = ({
|
|
|
1130
1121
|
setAnchorsBySelect([]);
|
|
1131
1122
|
}
|
|
1132
1123
|
}, [id, anchorSelect]);
|
|
1133
|
-
const
|
|
1134
|
-
const canShow = hasContentOrChildren && show && Object.keys(inlineStyles).length > 0;
|
|
1124
|
+
const canShow = content && show && Object.keys(inlineStyles).length > 0;
|
|
1135
1125
|
return rendered ? /* @__PURE__ */ jsxs(
|
|
1136
1126
|
WrapperElement,
|
|
1137
1127
|
{
|
|
1138
1128
|
id,
|
|
1139
1129
|
role: "tooltip",
|
|
1140
|
-
className: (0, import_classnames2.default)(
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1130
|
+
className: (0, import_classnames2.default)(
|
|
1131
|
+
"react-tooltip",
|
|
1132
|
+
styles_module_default["tooltip"],
|
|
1133
|
+
styles_module_default[variant],
|
|
1134
|
+
className,
|
|
1135
|
+
`react-tooltip__place-${actualPlacement}`,
|
|
1136
|
+
{
|
|
1137
|
+
[styles_module_default["show"]]: canShow,
|
|
1138
|
+
[styles_module_default["fixed"]]: positionStrategy === "fixed",
|
|
1139
|
+
[styles_module_default["clickable"]]: clickable
|
|
1140
|
+
}
|
|
1141
|
+
),
|
|
1149
1142
|
style: { ...externalStyles, ...inlineStyles },
|
|
1150
1143
|
ref: tooltipRef,
|
|
1151
1144
|
children: [
|
|
1152
|
-
|
|
1153
|
-
/* @__PURE__ */
|
|
1145
|
+
content,
|
|
1146
|
+
/* @__PURE__ */ jsx3(
|
|
1154
1147
|
WrapperElement,
|
|
1155
1148
|
{
|
|
1156
1149
|
className: (0, import_classnames2.default)("react-tooltip-arrow", styles_module_default["arrow"], classNameArrow, {
|
|
@@ -1170,6 +1163,13 @@ var Tooltip = ({
|
|
|
1170
1163
|
};
|
|
1171
1164
|
var Tooltip_default = Tooltip;
|
|
1172
1165
|
|
|
1166
|
+
// src/components/TooltipContent/TooltipContent.tsx
|
|
1167
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1168
|
+
var TooltipContent = ({ content }) => {
|
|
1169
|
+
return /* @__PURE__ */ jsx4("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
1170
|
+
};
|
|
1171
|
+
var TooltipContent_default = TooltipContent;
|
|
1172
|
+
|
|
1173
1173
|
// src/components/TooltipController/TooltipController.tsx
|
|
1174
1174
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1175
1175
|
var TooltipController = ({
|
|
@@ -1178,6 +1178,7 @@ var TooltipController = ({
|
|
|
1178
1178
|
anchorSelect,
|
|
1179
1179
|
content,
|
|
1180
1180
|
html,
|
|
1181
|
+
render,
|
|
1181
1182
|
className,
|
|
1182
1183
|
classNameArrow,
|
|
1183
1184
|
variant = "dark",
|
|
@@ -1325,14 +1326,22 @@ var TooltipController = ({
|
|
|
1325
1326
|
observer.disconnect();
|
|
1326
1327
|
};
|
|
1327
1328
|
}, [anchorRefs, providerActiveAnchor, activeAnchor, anchorId, anchorSelect]);
|
|
1329
|
+
let renderedContent = children;
|
|
1330
|
+
if (render) {
|
|
1331
|
+
renderedContent = render({ content: tooltipContent != null ? tooltipContent : null, activeAnchor });
|
|
1332
|
+
} else if (tooltipContent) {
|
|
1333
|
+
renderedContent = tooltipContent;
|
|
1334
|
+
}
|
|
1335
|
+
if (tooltipHtml) {
|
|
1336
|
+
renderedContent = /* @__PURE__ */ jsx5(TooltipContent_default, { content: tooltipHtml });
|
|
1337
|
+
}
|
|
1328
1338
|
const props = {
|
|
1329
1339
|
id,
|
|
1330
1340
|
anchorId,
|
|
1331
1341
|
anchorSelect,
|
|
1332
1342
|
className,
|
|
1333
1343
|
classNameArrow,
|
|
1334
|
-
content:
|
|
1335
|
-
html: tooltipHtml,
|
|
1344
|
+
content: renderedContent,
|
|
1336
1345
|
place: tooltipPlace,
|
|
1337
1346
|
variant: tooltipVariant,
|
|
1338
1347
|
offset: tooltipOffset,
|
|
@@ -1355,7 +1364,7 @@ var TooltipController = ({
|
|
|
1355
1364
|
activeAnchor,
|
|
1356
1365
|
setActiveAnchor: (anchor) => setActiveAnchor(anchor)
|
|
1357
1366
|
};
|
|
1358
|
-
return
|
|
1367
|
+
return /* @__PURE__ */ jsx5(Tooltip_default, { ...props });
|
|
1359
1368
|
};
|
|
1360
1369
|
var TooltipController_default = TooltipController;
|
|
1361
1370
|
export {
|