@cloudflare/component-tooltip 5.1.0 → 5.1.1

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/CHANGELOG.md CHANGED
@@ -1,10 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 5.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - db8427aad9: This changeset is in attempts to fix an issue with Tooltip KV registry where 5.1.0 didn't get the code it should have
8
+
3
9
  ## 5.1.0
4
10
 
5
11
  ### Minor Changes
6
12
 
7
13
  - 0a4b7280c9: Fix bug where multiple tooltips on one page with delay do not dismiss correctly
14
+ - efc3f4a27d: Fix Tooltip to clear internal timers on unmount
8
15
 
9
16
  ## 5.0.0
10
17
 
package/es/Tooltip.js CHANGED
@@ -68,6 +68,7 @@ class Tooltip extends React.PureComponent {
68
68
  super(props);
69
69
  this.id = uniqueId('cf_component_tooltip_');
70
70
  this.escFunction = this.escFunction.bind(this);
71
+ this.delayTimer = null;
71
72
  }
72
73
 
73
74
  escFunction(event) {
@@ -95,6 +96,7 @@ class Tooltip extends React.PureComponent {
95
96
  document.removeEventListener('keydown', this.escFunction, {
96
97
  capture: true
97
98
  });
99
+ clearTimeout(this.delayTimer);
98
100
  }
99
101
 
100
102
  render() {
@@ -119,7 +121,6 @@ class Tooltip extends React.PureComponent {
119
121
  componentRef
120
122
  } = this.props;
121
123
  var id = this.props.id ? this.props.id : this.id;
122
- var timer;
123
124
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReactTooltip, {
124
125
  id: id,
125
126
  disable: disable,
@@ -162,7 +163,7 @@ class Tooltip extends React.PureComponent {
162
163
  },
163
164
  onMouseOver: () => {
164
165
  if (delayShow) {
165
- timer = setTimeout(() => {
166
+ this.delayTimer = setTimeout(() => {
166
167
  ReactTooltip.show(this.tooltipElement);
167
168
  }, DELAY_SHOW_MILLIS);
168
169
  } else {
@@ -170,7 +171,7 @@ class Tooltip extends React.PureComponent {
170
171
  }
171
172
  },
172
173
  onMouseOut: () => {
173
- clearTimeout(timer);
174
+ clearTimeout(this.delayTimer);
174
175
  ReactTooltip.hide(this.tooltipElement);
175
176
  },
176
177
  "aria-controls": id,
package/lib/Tooltip.js CHANGED
@@ -113,6 +113,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
113
113
  _this = _super.call(this, props);
114
114
  _this.id = (0, _lodash.default)('cf_component_tooltip_');
115
115
  _this.escFunction = _this.escFunction.bind(_assertThisInitialized(_this));
116
+ _this.delayTimer = null;
116
117
  return _this;
117
118
  }
118
119
 
@@ -151,6 +152,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
151
152
  document.removeEventListener('keydown', this.escFunction, {
152
153
  capture: true
153
154
  });
155
+ clearTimeout(this.delayTimer);
154
156
  }
155
157
  }, {
156
158
  key: "render",
@@ -178,7 +180,6 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
178
180
  Component = _this$props$Component === void 0 ? _elements.Button : _this$props$Component,
179
181
  componentRef = _this$props.componentRef;
180
182
  var id = this.props.id ? this.props.id : this.id;
181
- var timer;
182
183
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactTooltip.default, {
183
184
  id: id,
184
185
  disable: disable,
@@ -227,7 +228,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
227
228
  },
228
229
  onMouseOver: function onMouseOver() {
229
230
  if (delayShow) {
230
- timer = setTimeout(function () {
231
+ _this3.delayTimer = setTimeout(function () {
231
232
  _reactTooltip.default.show(_this3.tooltipElement);
232
233
  }, DELAY_SHOW_MILLIS);
233
234
  } else {
@@ -235,7 +236,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
235
236
  }
236
237
  },
237
238
  onMouseOut: function onMouseOut() {
238
- clearTimeout(timer);
239
+ clearTimeout(_this3.delayTimer);
239
240
 
240
241
  _reactTooltip.default.hide(_this3.tooltipElement);
241
242
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudflare/component-tooltip",
3
3
  "description": "Cloudflare Tooltip Component",
4
- "version": "5.1.0",
4
+ "version": "5.1.1",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
7
  "author": "James Kyle <jkyle@cloudflare.com>",