@helpdice/ui 2.2.7 → 2.3.2
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/circular-progress/Path.d.ts +1 -2
- package/dist/circular-progress/index.js +4 -3
- package/dist/form/index.js +6 -6
- package/dist/html-renderer/index.js +8 -2
- package/dist/index.js +1596 -1445
- package/dist/notetip/index.js +69 -58
- package/dist/notetip/note-tip.d.ts +1 -1
- package/dist/placeholder/empty.d.ts +1 -1
- package/dist/placeholder/index.js +6 -2
- package/dist/popover/index.js +143 -13
- package/dist/table/index.js +190 -58
- package/dist/tooltip/helper.d.ts +2 -2
- package/dist/tooltip/index.js +140 -10
- package/dist/tooltip/tooltip-content.d.ts +2 -2
- package/esm/circular-progress/Path.d.ts +1 -2
- package/esm/circular-progress/Path.js +1 -1
- package/esm/notetip/note-tip.d.ts +1 -1
- package/esm/notetip/note-tip.js +70 -59
- package/esm/placeholder/empty.d.ts +1 -1
- package/esm/placeholder/empty.js +4 -2
- package/esm/popover/popover.js +3 -3
- package/esm/table/table-body.js +2 -4
- package/esm/table/table-head.js +4 -4
- package/esm/table/table.js +1 -0
- package/esm/tooltip/helper.d.ts +2 -2
- package/esm/tooltip/helper.js +19 -1
- package/esm/tooltip/placement.js +102 -0
- package/esm/tooltip/tooltip-content.d.ts +2 -2
- package/esm/tooltip/tooltip-content.js +12 -1
- package/esm/tooltip/tooltip.js +6 -9
- package/package.json +12 -12
package/dist/notetip/index.js
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var reactDom = require('
|
|
6
|
+
var reactDom = require('react-dom');
|
|
7
7
|
var theme = require('@helpdice/theme');
|
|
8
|
-
var reactDom$1 = require('react-dom');
|
|
9
8
|
|
|
10
9
|
function _arrayLikeToArray(r, a) {
|
|
11
10
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -596,6 +595,7 @@ function requireStyle () {
|
|
|
596
595
|
var styleExports = requireStyle();
|
|
597
596
|
var _JSXStyle = /*@__PURE__*/getDefaultExportFromCjs(styleExports);
|
|
598
597
|
|
|
598
|
+
var OFFSET = 8;
|
|
599
599
|
var Notetip = function Notetip(_ref) {
|
|
600
600
|
var children = _ref.children,
|
|
601
601
|
text = _ref.text,
|
|
@@ -608,6 +608,8 @@ var Notetip = function Notetip(_ref) {
|
|
|
608
608
|
_ref$animation = _ref.animation,
|
|
609
609
|
animation = _ref$animation === void 0 ? 'fade' : _ref$animation;
|
|
610
610
|
var theme$1 = theme.useTheme();
|
|
611
|
+
var referenceRef = React.useRef(null);
|
|
612
|
+
var tooltipRef = React.useRef(null);
|
|
611
613
|
var _useState = React.useState(false),
|
|
612
614
|
_useState2 = _slicedToArray(_useState, 2),
|
|
613
615
|
open = _useState2[0],
|
|
@@ -616,75 +618,84 @@ var Notetip = function Notetip(_ref) {
|
|
|
616
618
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
617
619
|
show = _useState4[0],
|
|
618
620
|
setShow = _useState4[1];
|
|
619
|
-
var
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
middleware: [reactDom.offset(8), reactDom.flip(), reactDom.shift({
|
|
623
|
-
padding: 5
|
|
624
|
-
}), reactDom.arrow({
|
|
625
|
-
element: arrowRef
|
|
626
|
-
})]
|
|
621
|
+
var _useState5 = React.useState({
|
|
622
|
+
top: 0,
|
|
623
|
+
left: 0
|
|
627
624
|
}),
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
strategy = _useFloating.strategy;
|
|
625
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
626
|
+
coords = _useState6[0],
|
|
627
|
+
setCoords = _useState6[1];
|
|
632
628
|
React.useEffect(function () {
|
|
633
629
|
var timer;
|
|
634
|
-
if (open) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}, delay);
|
|
638
|
-
} else {
|
|
639
|
-
setShow(false);
|
|
640
|
-
}
|
|
630
|
+
if (open) timer = setTimeout(function () {
|
|
631
|
+
return setShow(true);
|
|
632
|
+
}, delay);else setShow(false);
|
|
641
633
|
return function () {
|
|
642
634
|
return clearTimeout(timer);
|
|
643
635
|
};
|
|
644
636
|
}, [open, delay]);
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
637
|
+
React.useLayoutEffect(function () {
|
|
638
|
+
if (!show || !referenceRef.current || !tooltipRef.current) return;
|
|
639
|
+
var refRect = referenceRef.current.getBoundingClientRect();
|
|
640
|
+
var tipRect = tooltipRef.current.getBoundingClientRect();
|
|
641
|
+
var top = 0;
|
|
642
|
+
var left = 0;
|
|
643
|
+
switch (placement) {
|
|
644
|
+
case 'top':
|
|
645
|
+
top = refRect.top - tipRect.height - OFFSET;
|
|
646
|
+
left = refRect.left + refRect.width / 2 - tipRect.width / 2;
|
|
647
|
+
break;
|
|
648
|
+
case 'bottom':
|
|
649
|
+
top = refRect.bottom + OFFSET;
|
|
650
|
+
left = refRect.left + refRect.width / 2 - tipRect.width / 2;
|
|
651
|
+
break;
|
|
652
|
+
case 'left':
|
|
653
|
+
top = refRect.top + refRect.height / 2 - tipRect.height / 2;
|
|
654
|
+
left = refRect.left - tipRect.width - OFFSET;
|
|
655
|
+
break;
|
|
656
|
+
case 'right':
|
|
657
|
+
top = refRect.top + refRect.height / 2 - tipRect.height / 2;
|
|
658
|
+
left = refRect.right + OFFSET;
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
664
661
|
|
|
662
|
+
// Viewport collision handling
|
|
663
|
+
var padding = 5;
|
|
664
|
+
top = Math.max(padding, Math.min(top, window.innerHeight - tipRect.height - padding));
|
|
665
|
+
left = Math.max(padding, Math.min(left, window.innerWidth - tipRect.width - padding));
|
|
666
|
+
setCoords({
|
|
667
|
+
top: top,
|
|
668
|
+
left: left
|
|
669
|
+
});
|
|
670
|
+
}, [show, placement]);
|
|
665
671
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
666
|
-
ref:
|
|
667
|
-
onMouseEnter:
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
672
|
+
ref: referenceRef,
|
|
673
|
+
onMouseEnter: function onMouseEnter() {
|
|
674
|
+
return setOpen(true);
|
|
675
|
+
},
|
|
676
|
+
onMouseLeave: function onMouseLeave() {
|
|
677
|
+
return setOpen(false);
|
|
678
|
+
},
|
|
679
|
+
onTouchStart: function onTouchStart() {
|
|
680
|
+
setOpen(true);
|
|
681
|
+
setTimeout(function () {
|
|
682
|
+
return setOpen(false);
|
|
683
|
+
}, 2000);
|
|
684
|
+
},
|
|
685
|
+
className: _JSXStyle.dynamic([["633836393", [theme$1.palette.accents_1, duration, duration, duration]]])
|
|
686
|
+
}, children), show && /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React.createElement("div", {
|
|
687
|
+
ref: tooltipRef,
|
|
673
688
|
style: {
|
|
674
|
-
position:
|
|
675
|
-
top:
|
|
676
|
-
left:
|
|
677
|
-
zIndex: 9999,
|
|
678
|
-
// opacity: show ? 1 : 0,
|
|
679
|
-
// visibility: x == null || y == null ? 'hidden' : 'visible',
|
|
680
|
-
transitionProperty: 'opacity, transform',
|
|
689
|
+
position: 'fixed',
|
|
690
|
+
top: coords.top,
|
|
691
|
+
left: coords.left,
|
|
681
692
|
transitionDuration: "".concat(duration, "ms")
|
|
682
693
|
},
|
|
683
|
-
className: _JSXStyle.dynamic([["
|
|
684
|
-
}, text), document.body)
|
|
685
|
-
id: "
|
|
694
|
+
className: _JSXStyle.dynamic([["633836393", [theme$1.palette.accents_1, duration, duration, duration]]]) + " " + "tooltip-box ".concat(animation)
|
|
695
|
+
}, text), document.body), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
696
|
+
id: "633836393",
|
|
686
697
|
dynamic: [theme$1.palette.accents_1, duration, duration, duration]
|
|
687
|
-
}, ".tooltip-box.__jsx-style-dynamic-selector{background:".concat(theme$1.palette.accents_1, ";padding:4px 10px;border-radius:4px;font-size:12px;white-space:nowrap;z-index:9999;opacity:0;}.fade.__jsx-style-dynamic-selector{-webkit-animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}
|
|
698
|
+
}, ".tooltip-box.__jsx-style-dynamic-selector{background:".concat(theme$1.palette.accents_1, ";padding:4px 10px;border-radius:4px;font-size:12px;white-space:nowrap;z-index:9999;opacity:0;}.fade.__jsx-style-dynamic-selector{-webkit-animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}.scale.__jsx-style-dynamic-selector{-webkit-animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}.slide.__jsx-style-dynamic-selector{-webkit-animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes fadeIn-__jsx-style-dynamic-selector{to{opacity:1;}}@keyframes fadeIn-__jsx-style-dynamic-selector{to{opacity:1;}}@-webkit-keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@-webkit-keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}@keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}")));
|
|
688
699
|
};
|
|
689
700
|
|
|
690
701
|
exports.default = Notetip;
|
|
@@ -108,6 +108,9 @@ function _iterableToArrayLimit(r, l) {
|
|
|
108
108
|
function _nonIterableRest() {
|
|
109
109
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
110
110
|
}
|
|
111
|
+
function _objectDestructuringEmpty(t) {
|
|
112
|
+
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
113
|
+
}
|
|
111
114
|
function ownKeys(e, r) {
|
|
112
115
|
var t = Object.keys(e);
|
|
113
116
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -174,7 +177,8 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
179
|
|
|
177
|
-
function Empty() {
|
|
180
|
+
var Empty = function Empty(_ref) {
|
|
181
|
+
_objectDestructuringEmpty(_ref);
|
|
178
182
|
return /*#__PURE__*/React.createElement("svg", {
|
|
179
183
|
xmlns: "http://www.w3.org/2000/svg",
|
|
180
184
|
width: "10em",
|
|
@@ -473,7 +477,7 @@ function Empty() {
|
|
|
473
477
|
opacity: "0.2",
|
|
474
478
|
transform: "translate(-95.23 -55.03)"
|
|
475
479
|
}));
|
|
476
|
-
}
|
|
480
|
+
};
|
|
477
481
|
|
|
478
482
|
function getDefaultExportFromCjs (x) {
|
|
479
483
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
package/dist/popover/index.js
CHANGED
|
@@ -893,6 +893,108 @@ var getPosition = function getPosition(placement, rect, offset) {
|
|
|
893
893
|
};
|
|
894
894
|
return positions[placement] || positions.top;
|
|
895
895
|
};
|
|
896
|
+
|
|
897
|
+
// export const getPosition = (
|
|
898
|
+
// placement: Placement,
|
|
899
|
+
// rect: ParentDomRect,
|
|
900
|
+
// offset: number,
|
|
901
|
+
// ): TooltipPosition => {
|
|
902
|
+
// // console.log(rect);
|
|
903
|
+
// if (
|
|
904
|
+
// !rect ||
|
|
905
|
+
// rect.width <= 0 ||
|
|
906
|
+
// rect.height <= 0 ||
|
|
907
|
+
// Number.isNaN(rect.top) ||
|
|
908
|
+
// Number.isNaN(rect.left)
|
|
909
|
+
// ) {
|
|
910
|
+
// return {
|
|
911
|
+
// top: '0px',
|
|
912
|
+
// left: '0px',
|
|
913
|
+
// // move tooltip out of viewport safely until rect is valid
|
|
914
|
+
// transform: 'translate(-9999px, -9999px)',
|
|
915
|
+
// }
|
|
916
|
+
// }
|
|
917
|
+
|
|
918
|
+
// const viewportWidth = window.innerWidth
|
|
919
|
+
// const viewportHeight = window.innerHeight
|
|
920
|
+
|
|
921
|
+
// const clamp = (value: number, min: number, max: number) =>
|
|
922
|
+
// Math.min(Math.max(value, min), max)
|
|
923
|
+
|
|
924
|
+
// const centerX = rect.left + rect.width / 2
|
|
925
|
+
// const centerY = rect.top + rect.height / 2
|
|
926
|
+
|
|
927
|
+
// const safeTop = clamp(rect.top, 8, viewportHeight - 8)
|
|
928
|
+
// const safeBottom = clamp(rect.bottom, 8, viewportHeight - 8)
|
|
929
|
+
// const safeLeft = clamp(rect.left, 8, viewportWidth - 8)
|
|
930
|
+
// const safeRight = clamp(rect.right, 8, viewportWidth - 8)
|
|
931
|
+
|
|
932
|
+
// const positions: Record<Placement, TooltipPosition> = {
|
|
933
|
+
// top: {
|
|
934
|
+
// top: `${clamp(rect.top - offset, 8, viewportHeight - 8)}px`,
|
|
935
|
+
// left: `${clamp(centerX, 8, viewportWidth - 8)}px`,
|
|
936
|
+
// transform: 'translate(-50%, -100%)',
|
|
937
|
+
// },
|
|
938
|
+
// topStart: {
|
|
939
|
+
// top: `${clamp(rect.top - offset, 8, viewportHeight - 8)}px`,
|
|
940
|
+
// left: `${safeLeft}px`,
|
|
941
|
+
// transform: 'translate(0, -100%)',
|
|
942
|
+
// },
|
|
943
|
+
// topEnd: {
|
|
944
|
+
// top: `${clamp(rect.top - offset, 8, viewportHeight - 8)}px`,
|
|
945
|
+
// left: `${safeRight}px`,
|
|
946
|
+
// transform: 'translate(-100%, -100%)',
|
|
947
|
+
// },
|
|
948
|
+
// bottom: {
|
|
949
|
+
// top: `${clamp(rect.bottom + offset, 8, viewportHeight - 8)}px`,
|
|
950
|
+
// left: `${clamp(centerX, 8, viewportWidth - 8)}px`,
|
|
951
|
+
// transform: 'translate(-50%, 0)',
|
|
952
|
+
// },
|
|
953
|
+
// bottomStart: {
|
|
954
|
+
// top: `${clamp(rect.bottom + offset, 8, viewportHeight - 8)}px`,
|
|
955
|
+
// left: `${safeLeft}px`,
|
|
956
|
+
// transform: 'translate(0, 0)',
|
|
957
|
+
// },
|
|
958
|
+
// bottomEnd: {
|
|
959
|
+
// top: `${clamp(rect.bottom + offset, 8, viewportHeight - 8)}px`,
|
|
960
|
+
// left: `${safeRight}px`,
|
|
961
|
+
// transform: 'translate(-100%, 0)',
|
|
962
|
+
// },
|
|
963
|
+
// left: {
|
|
964
|
+
// top: `${clamp(centerY, 8, viewportHeight - 8)}px`,
|
|
965
|
+
// left: `${clamp(rect.left - offset, 8, viewportWidth - 8)}px`,
|
|
966
|
+
// transform: 'translate(-100%, -50%)',
|
|
967
|
+
// },
|
|
968
|
+
// leftStart: {
|
|
969
|
+
// top: `${safeTop}px`,
|
|
970
|
+
// left: `${clamp(rect.left - offset, 8, viewportWidth - 8)}px`,
|
|
971
|
+
// transform: 'translate(-100%, 0)',
|
|
972
|
+
// },
|
|
973
|
+
// leftEnd: {
|
|
974
|
+
// top: `${safeBottom}px`,
|
|
975
|
+
// left: `${clamp(rect.left - offset, 8, viewportWidth - 8)}px`,
|
|
976
|
+
// transform: 'translate(-100%, -100%)',
|
|
977
|
+
// },
|
|
978
|
+
// right: {
|
|
979
|
+
// top: `${clamp(centerY, 8, viewportHeight - 8)}px`,
|
|
980
|
+
// left: `${clamp(rect.right + offset, 8, viewportWidth - 8)}px`,
|
|
981
|
+
// transform: 'translate(0, -50%)',
|
|
982
|
+
// },
|
|
983
|
+
// rightStart: {
|
|
984
|
+
// top: `${safeTop}px`,
|
|
985
|
+
// left: `${clamp(rect.right + offset, 8, viewportWidth - 8)}px`,
|
|
986
|
+
// transform: 'translate(0, 0)',
|
|
987
|
+
// },
|
|
988
|
+
// rightEnd: {
|
|
989
|
+
// top: `${safeBottom}px`,
|
|
990
|
+
// left: `${clamp(rect.right + offset, 8, viewportWidth - 8)}px`,
|
|
991
|
+
// transform: 'translate(0, -100%)',
|
|
992
|
+
// },
|
|
993
|
+
// }
|
|
994
|
+
|
|
995
|
+
// return positions[placement] || positions.top
|
|
996
|
+
// }
|
|
997
|
+
|
|
896
998
|
var getIconPosition = function getIconPosition(placement, offsetX, offsetY) {
|
|
897
999
|
var offsetAbsolute = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '3px';
|
|
898
1000
|
var positions = {
|
|
@@ -1091,7 +1193,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
|
1091
1193
|
return getAllScaleProps;
|
|
1092
1194
|
};
|
|
1093
1195
|
|
|
1094
|
-
var _excluded$
|
|
1196
|
+
var _excluded$2 = ["children"];
|
|
1095
1197
|
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
1096
1198
|
if (scale === 1) return scale;
|
|
1097
1199
|
var diff = Math.abs((scale - 1) / 2);
|
|
@@ -1101,7 +1203,7 @@ var withScale = function withScale(Render) {
|
|
|
1101
1203
|
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1102
1204
|
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31;
|
|
1103
1205
|
var children = _ref.children,
|
|
1104
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1206
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1105
1207
|
var _useTheme = theme.useTheme(),
|
|
1106
1208
|
layout = _useTheme.layout;
|
|
1107
1209
|
var paddingLeft = props.paddingLeft,
|
|
@@ -1205,6 +1307,24 @@ var getRect = function getRect(ref) {
|
|
|
1205
1307
|
});
|
|
1206
1308
|
};
|
|
1207
1309
|
|
|
1310
|
+
// export const getRect = (
|
|
1311
|
+
// ref: RefObject<HTMLElement | null>
|
|
1312
|
+
// ): ReactiveDomReact => {
|
|
1313
|
+
// console.log('Parent Current', ref?.current);
|
|
1314
|
+
// if (!ref?.current) return defaultRect
|
|
1315
|
+
|
|
1316
|
+
// const rect = ref.current.getBoundingClientRect()
|
|
1317
|
+
|
|
1318
|
+
// return {
|
|
1319
|
+
// top: rect.top,
|
|
1320
|
+
// left: rect.left,
|
|
1321
|
+
// right: rect.right,
|
|
1322
|
+
// bottom: rect.bottom,
|
|
1323
|
+
// width: rect.width,
|
|
1324
|
+
// height: rect.height,
|
|
1325
|
+
// }
|
|
1326
|
+
// }
|
|
1327
|
+
|
|
1208
1328
|
var TooltipContent = function TooltipContent(_ref) {
|
|
1209
1329
|
var children = _ref.children,
|
|
1210
1330
|
parent = _ref.parent,
|
|
@@ -1229,6 +1349,9 @@ var TooltipContent = function TooltipContent(_ref) {
|
|
|
1229
1349
|
}, [type, theme$1.palette]);
|
|
1230
1350
|
var hasShadow = type === 'default';
|
|
1231
1351
|
var classes = theme.useClasses('tooltip-content', className);
|
|
1352
|
+
|
|
1353
|
+
// console.log('Having Parent', parent);
|
|
1354
|
+
|
|
1232
1355
|
if (!parent) return null;
|
|
1233
1356
|
var updateRect = function updateRect() {
|
|
1234
1357
|
var position = getPosition(placement, getRect(parent), offset);
|
|
@@ -1239,7 +1362,15 @@ var TooltipContent = function TooltipContent(_ref) {
|
|
|
1239
1362
|
return updateRect();
|
|
1240
1363
|
});
|
|
1241
1364
|
React.useEffect(function () {
|
|
1242
|
-
updateRect
|
|
1365
|
+
window.addEventListener('scroll', updateRect, true);
|
|
1366
|
+
return function () {
|
|
1367
|
+
return window.removeEventListener('scroll', updateRect, true);
|
|
1368
|
+
};
|
|
1369
|
+
}, []);
|
|
1370
|
+
React.useEffect(function () {
|
|
1371
|
+
if (visible && parent !== null && parent !== void 0 && parent.current) {
|
|
1372
|
+
updateRect();
|
|
1373
|
+
}
|
|
1243
1374
|
}, [visible]);
|
|
1244
1375
|
var preventHandler = function preventHandler(event) {
|
|
1245
1376
|
event.stopPropagation();
|
|
@@ -1283,7 +1414,6 @@ var useClickAway = function useClickAway(ref, handler) {
|
|
|
1283
1414
|
}, [ref]);
|
|
1284
1415
|
};
|
|
1285
1416
|
|
|
1286
|
-
var _excluded$2 = ["children", "initialVisible", "text", "offset", "placement", "portalClassName", "enterDelay", "leaveDelay", "trigger", "type", "className", "onVisibleChange", "hideArrow", "visible"];
|
|
1287
1417
|
var TooltipComponent = function TooltipComponent(_ref) {
|
|
1288
1418
|
var children = _ref.children,
|
|
1289
1419
|
_ref$initialVisible = _ref.initialVisible,
|
|
@@ -1309,8 +1439,7 @@ var TooltipComponent = function TooltipComponent(_ref) {
|
|
|
1309
1439
|
onVisibleChange = _ref$onVisibleChange === void 0 ? function () {} : _ref$onVisibleChange,
|
|
1310
1440
|
_ref$hideArrow = _ref.hideArrow,
|
|
1311
1441
|
hideArrow = _ref$hideArrow === void 0 ? false : _ref$hideArrow,
|
|
1312
|
-
customVisible = _ref.visible
|
|
1313
|
-
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1442
|
+
customVisible = _ref.visible;
|
|
1314
1443
|
var timer = React.useRef(undefined);
|
|
1315
1444
|
var ref = React.useRef(null);
|
|
1316
1445
|
var _useState = React.useState(initialVisible),
|
|
@@ -1373,7 +1502,7 @@ var TooltipComponent = function TooltipComponent(_ref) {
|
|
|
1373
1502
|
if (customVisible === undefined) return;
|
|
1374
1503
|
changeVisible(customVisible);
|
|
1375
1504
|
}, [customVisible]);
|
|
1376
|
-
return /*#__PURE__*/React.createElement("div",
|
|
1505
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1377
1506
|
ref: ref,
|
|
1378
1507
|
onClick: clickEventHandler,
|
|
1379
1508
|
onMouseEnter: function onMouseEnter() {
|
|
@@ -1382,9 +1511,10 @@ var TooltipComponent = function TooltipComponent(_ref) {
|
|
|
1382
1511
|
onMouseLeave: function onMouseLeave() {
|
|
1383
1512
|
return mouseEventHandler(false);
|
|
1384
1513
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1514
|
+
// {...props}
|
|
1515
|
+
,
|
|
1516
|
+
className: "jsx-418573366" + " " + (theme.useClasses('tooltip', className) || "")
|
|
1517
|
+
}, children, /*#__PURE__*/React.createElement(TooltipContent, contentProps, text), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1388
1518
|
id: "418573366"
|
|
1389
1519
|
}, ".tooltip.jsx-418573366{width:-webkit-max-content;width:-moz-max-content;width:max-content;display:inline-block;}"));
|
|
1390
1520
|
};
|
|
@@ -1469,9 +1599,9 @@ var PopoverComponent = function PopoverComponent(_ref) {
|
|
|
1469
1599
|
visible: visible,
|
|
1470
1600
|
onVisibleChange: onPopoverVisibleChange
|
|
1471
1601
|
}, props), children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1472
|
-
id: "
|
|
1473
|
-
dynamic: [SCALES.pt(0.
|
|
1474
|
-
}, ".tooltip-content.popover > .inner{padding:".concat(SCALES.pt(0.
|
|
1602
|
+
id: "3577605772",
|
|
1603
|
+
dynamic: [SCALES.pt(0.5), SCALES.pr(0), SCALES.pb(0.5), SCALES.pl(0)]
|
|
1604
|
+
}, ".tooltip-content.popover > .inner{padding:".concat(SCALES.pt(0.5), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0.5), " ").concat(SCALES.pl(0), ";}"))));
|
|
1475
1605
|
};
|
|
1476
1606
|
PopoverComponent.displayName = 'Popover';
|
|
1477
1607
|
var Popover = withScale(PopoverComponent);
|