react-tooltip 5.30.0-beta.1263.rc.1 → 5.30.0-beta.1263.rc.3
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 +63 -18
- package/dist/react-tooltip.cjs.map +1 -1
- package/dist/react-tooltip.css +20 -7
- package/dist/react-tooltip.min.cjs +2 -2
- package/dist/react-tooltip.min.cjs.map +1 -1
- package/dist/react-tooltip.min.css +1 -1
- package/dist/react-tooltip.min.mjs +2 -2
- package/dist/react-tooltip.min.mjs.map +1 -1
- package/dist/react-tooltip.mjs +63 -18
- package/dist/react-tooltip.mjs.map +1 -1
- package/dist/react-tooltip.umd.js +63 -18
- package/dist/react-tooltip.umd.js.map +1 -1
- package/dist/react-tooltip.umd.min.js +2 -2
- package/dist/react-tooltip.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/react-tooltip.cjs
CHANGED
|
@@ -136,10 +136,6 @@ const computeTooltipPosition = async ({ elementReference = null, tooltipReferenc
|
|
|
136
136
|
left: 'right',
|
|
137
137
|
}[placement.split('-')[0]]) !== null && _b !== void 0 ? _b : 'bottom';
|
|
138
138
|
/* c8 ignore end */
|
|
139
|
-
const borderSide = border && {
|
|
140
|
-
borderBottom: border,
|
|
141
|
-
borderRight: border,
|
|
142
|
-
};
|
|
143
139
|
let borderWidth = 0;
|
|
144
140
|
if (border) {
|
|
145
141
|
const match = `${border}`.match(/(\d+)px/);
|
|
@@ -160,8 +156,10 @@ const computeTooltipPosition = async ({ elementReference = null, tooltipReferenc
|
|
|
160
156
|
top: arrowY != null ? `${arrowY}px` : '',
|
|
161
157
|
right: '',
|
|
162
158
|
bottom: '',
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
// Keep the arrow tucked under the tooltip body. When the tooltip has a
|
|
160
|
+
// border, offset by that width, but do not draw a separate arrow border:
|
|
161
|
+
// the rotated/clipped element cannot render that seam cleanly.
|
|
162
|
+
[staticSide]: `-${arrowSize * 0.5 + borderWidth}px`,
|
|
165
163
|
};
|
|
166
164
|
/* c8 ignore end */
|
|
167
165
|
return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle, place: placement };
|
|
@@ -295,6 +293,36 @@ const clearTimeoutRef = (ref) => {
|
|
|
295
293
|
}
|
|
296
294
|
};
|
|
297
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Extract the width token from a CSS border shorthand so arrow styles can
|
|
298
|
+
* reuse the same thickness as the tooltip border.
|
|
299
|
+
*/
|
|
300
|
+
const getBorderWidth = (border) => {
|
|
301
|
+
var _a;
|
|
302
|
+
if (!border) {
|
|
303
|
+
return '0px';
|
|
304
|
+
}
|
|
305
|
+
const match = `${border}`.match(/(\d+px)/);
|
|
306
|
+
return (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : '1px';
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Extract the color token from a CSS border shorthand so the arrow border/fill
|
|
310
|
+
* can stay visually aligned with the tooltip border.
|
|
311
|
+
*/
|
|
312
|
+
const getBorderColor = (border) => {
|
|
313
|
+
if (!border) {
|
|
314
|
+
return undefined;
|
|
315
|
+
}
|
|
316
|
+
const parts = `${border}`.trim().split(/\s+/);
|
|
317
|
+
if (parts.length >= 3) {
|
|
318
|
+
return parts.slice(2).join(' ');
|
|
319
|
+
}
|
|
320
|
+
if (parts.length === 2) {
|
|
321
|
+
return parts[1];
|
|
322
|
+
}
|
|
323
|
+
return parts[0];
|
|
324
|
+
};
|
|
325
|
+
|
|
298
326
|
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
299
327
|
const DEFAULT_CONTEXT_DATA = {
|
|
300
328
|
anchorRefs: new Set(),
|
|
@@ -393,7 +421,7 @@ const TooltipWrapper = ({ tooltipId, children, className, place, content, html,
|
|
|
393
421
|
return (React__default["default"].createElement("span", { ref: anchorRef, className: classNames__default["default"]('react-tooltip-wrapper', className), "data-tooltip-place": place, "data-tooltip-content": content, "data-tooltip-html": html, "data-tooltip-variant": variant, "data-tooltip-offset": offset, "data-tooltip-wrapper": wrapper, "data-tooltip-events": events, "data-tooltip-position-strategy": positionStrategy, "data-tooltip-delay-show": delayShow, "data-tooltip-delay-hide": delayHide }, children));
|
|
394
422
|
};
|
|
395
423
|
|
|
396
|
-
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"};
|
|
424
|
+
var coreStyles = {"tooltip":"core-styles-module_tooltip__3vRRp","fixed":"core-styles-module_fixed__pcSol","arrow":"core-styles-module_arrow__cvMwQ","arrowInner":"core-styles-module_arrowInner__HNPYi","noArrow":"core-styles-module_noArrow__xock6","clickable":"core-styles-module_clickable__ZuTTB","show":"core-styles-module_show__Nt9eE","closing":"core-styles-module_closing__sGnxF"};
|
|
397
425
|
|
|
398
426
|
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"};
|
|
399
427
|
|
|
@@ -425,6 +453,9 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, previousAc
|
|
|
425
453
|
const hoveringTooltip = React.useRef(false);
|
|
426
454
|
const [anchorsBySelect, setAnchorsBySelect] = React.useState([]);
|
|
427
455
|
const mounted = React.useRef(false);
|
|
456
|
+
const arrowBorderWidth = getBorderWidth(border);
|
|
457
|
+
const arrowBorderColor = getBorderColor(border);
|
|
458
|
+
const arrowBackground = border && arrowBorderColor ? arrowBorderColor : (arrowColor !== null && arrowColor !== void 0 ? arrowColor : 'var(--rt-tooltip-background)');
|
|
428
459
|
/**
|
|
429
460
|
* @todo Update when deprecated stuff gets removed.
|
|
430
461
|
*/
|
|
@@ -1187,11 +1218,12 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, previousAc
|
|
|
1187
1218
|
actualContent,
|
|
1188
1219
|
React__default["default"].createElement(WrapperElement, { className: classNames__default["default"]('react-tooltip-arrow', coreStyles['arrow'], styles['arrow'], classNameArrow, noArrow && coreStyles['noArrow']), style: {
|
|
1189
1220
|
...computedPosition.tooltipArrowStyles,
|
|
1190
|
-
background: arrowColor
|
|
1191
|
-
? `linear-gradient(to right bottom, transparent 50%, ${arrowColor} 50%)`
|
|
1192
|
-
: undefined,
|
|
1193
1221
|
'--rt-arrow-size': `${arrowSize}px`,
|
|
1194
|
-
|
|
1222
|
+
'--rt-arrow-background': arrowBackground,
|
|
1223
|
+
'--rt-arrow-border-width': arrowBorderColor ? arrowBorderWidth : '0px',
|
|
1224
|
+
'--rt-arrow-border-color': arrowBorderColor,
|
|
1225
|
+
}, ref: tooltipArrowRef },
|
|
1226
|
+
React__default["default"].createElement(WrapperElement, { className: coreStyles['arrowInner'] })))) : null;
|
|
1195
1227
|
};
|
|
1196
1228
|
|
|
1197
1229
|
/* eslint-disable react/no-danger */
|
|
@@ -1519,9 +1551,16 @@ const TooltipCoreStyles = `:root {
|
|
|
1519
1551
|
|
|
1520
1552
|
.core-styles-module_arrow__cvMwQ {
|
|
1521
1553
|
position: absolute;
|
|
1522
|
-
background: inherit;
|
|
1523
1554
|
z-index: -1;
|
|
1524
1555
|
clip-path: polygon(0% 100%, 100% 0%, 100% 100%);
|
|
1556
|
+
background: var(--rt-arrow-border-color, var(--rt-arrow-background));
|
|
1557
|
+
overflow: hidden;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
.core-styles-module_arrowInner__HNPYi {
|
|
1561
|
+
position: absolute;
|
|
1562
|
+
inset: var(--rt-arrow-border-width, 0px);
|
|
1563
|
+
background: var(--rt-arrow-background);
|
|
1525
1564
|
}
|
|
1526
1565
|
|
|
1527
1566
|
.core-styles-module_noArrow__xock6 {
|
|
@@ -1575,32 +1614,38 @@ const TooltipStyles = `
|
|
|
1575
1614
|
|
|
1576
1615
|
/** Types variant **/
|
|
1577
1616
|
.styles-module_dark__xNqje {
|
|
1578
|
-
background: var(--rt-color-dark);
|
|
1617
|
+
--rt-tooltip-background: var(--rt-color-dark);
|
|
1618
|
+
background: var(--rt-tooltip-background);
|
|
1579
1619
|
color: var(--rt-color-white);
|
|
1580
1620
|
}
|
|
1581
1621
|
|
|
1582
1622
|
.styles-module_light__Z6W-X {
|
|
1583
|
-
background
|
|
1623
|
+
--rt-tooltip-background: var(--rt-color-white);
|
|
1624
|
+
background-color: var(--rt-tooltip-background);
|
|
1584
1625
|
color: var(--rt-color-dark);
|
|
1585
1626
|
}
|
|
1586
1627
|
|
|
1587
1628
|
.styles-module_success__A2AKt {
|
|
1588
|
-
background
|
|
1629
|
+
--rt-tooltip-background: var(--rt-color-success);
|
|
1630
|
+
background-color: var(--rt-tooltip-background);
|
|
1589
1631
|
color: var(--rt-color-white);
|
|
1590
1632
|
}
|
|
1591
1633
|
|
|
1592
1634
|
.styles-module_warning__SCK0X {
|
|
1593
|
-
background
|
|
1635
|
+
--rt-tooltip-background: var(--rt-color-warning);
|
|
1636
|
+
background-color: var(--rt-tooltip-background);
|
|
1594
1637
|
color: var(--rt-color-white);
|
|
1595
1638
|
}
|
|
1596
1639
|
|
|
1597
1640
|
.styles-module_error__JvumD {
|
|
1598
|
-
background
|
|
1641
|
+
--rt-tooltip-background: var(--rt-color-error);
|
|
1642
|
+
background-color: var(--rt-tooltip-background);
|
|
1599
1643
|
color: var(--rt-color-white);
|
|
1600
1644
|
}
|
|
1601
1645
|
|
|
1602
1646
|
.styles-module_info__BWdHW {
|
|
1603
|
-
background
|
|
1647
|
+
--rt-tooltip-background: var(--rt-color-info);
|
|
1648
|
+
background-color: var(--rt-tooltip-background);
|
|
1604
1649
|
color: var(--rt-color-white);
|
|
1605
1650
|
}
|
|
1606
1651
|
`;
|