linear-react-components-ui 0.4.76-rc.0 → 0.4.76-rc.4

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.
@@ -76,7 +76,7 @@ var withTooltip = function withTooltip(WrappedComponent) {
76
76
  var targetElement = (0, _react.useRef)();
77
77
 
78
78
  var onMouseOver = function onMouseOver(e) {
79
- if (targetElement.current.contains(e.target)) {
79
+ if (targetElement && targetElement.current && targetElement.current.contains(e.target)) {
80
80
  setShowTooltip(true);
81
81
  } else setShowTooltip(false);
82
82
  };
@@ -116,6 +116,7 @@ var withTooltip = function withTooltip(WrappedComponent) {
116
116
  height = tooltipDimensions.height;
117
117
  var targetDimensions = targetElement.current.getBoundingClientRect();
118
118
  var targetVerticalCenter = (targetDimensions.top + targetDimensions.bottom) / 2;
119
+ var formattedWidth = typeof width === 'string' ? Number(width.slice(0, -2)) : width;
119
120
  var style = "width: ".concat(width, "px");
120
121
  var left = targetDimensions.left + targetDimensions.width / 2 - width / 2;
121
122
  left = Math.min(left, document.body.clientWidth - width - space);
@@ -141,17 +142,17 @@ var withTooltip = function withTooltip(WrappedComponent) {
141
142
  break;
142
143
 
143
144
  case 'left':
144
- if (targetDimensions.left < width) {
145
+ if (targetDimensions.left < formattedWidth) {
145
146
  setTooltipPosition('right');
146
147
  } else {
147
148
  style += "; top: ".concat(targetVerticalCenter + window.scrollY - height / 2, "px");
148
- style += "; left: ".concat(targetDimensions.left - width - 6, "px");
149
+ style += "; left: ".concat(targetDimensions.left - formattedWidth - 6, "px");
149
150
  }
150
151
 
151
152
  break;
152
153
 
153
154
  case 'right':
154
- if (window.innerWidth - targetDimensions.right < width) {
155
+ if (window.innerWidth - targetDimensions.right < formattedWidth) {
155
156
  setTooltipPosition('left');
156
157
  } else {
157
158
  style += "; top: ".concat(targetVerticalCenter + window.scrollY - height / 2, "px");
@@ -42,8 +42,8 @@ var Tooltip = function Tooltip(props) {
42
42
  var tooltipEl = document.querySelector("div#".concat(tooltipComponent.current.id));
43
43
  var width = tooltipEl.offsetWidth;
44
44
 
45
- if (tooltipDimensions.width) {
46
- width = tooltipDimensions.width;
45
+ if (tooltipDimensions.width && tooltipDimensions.width !== 'auto') {
46
+ width = typeof tooltipDimensions.width === 'string' ? Number(tooltipDimensions.width.slice(0, -2)) : tooltipDimensions.width;
47
47
  }
48
48
 
49
49
  var height = tooltipEl.offsetHeight;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "0.4.76-rc.0",
3
+ "version": "0.4.76-rc.4",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {