@cloudflare/component-tooltip 5.0.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 +13 -0
- package/es/Tooltip.js +15 -3
- package/lib/Tooltip.js +12 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
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
|
+
|
|
9
|
+
## 5.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
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
|
|
15
|
+
|
|
3
16
|
## 5.0.0
|
|
4
17
|
|
|
5
18
|
### Major Changes
|
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() {
|
|
@@ -128,7 +130,6 @@ class Tooltip extends React.PureComponent {
|
|
|
128
130
|
className: className,
|
|
129
131
|
isCapture: isCapture,
|
|
130
132
|
delayHide: delayHide ? delayHide : null,
|
|
131
|
-
delayShow: delayShow ? DELAY_SHOW_MILLIS : null,
|
|
132
133
|
afterShow: afterShow,
|
|
133
134
|
afterHide: afterHide,
|
|
134
135
|
getContent: [() => message || getContent()],
|
|
@@ -160,8 +161,19 @@ class Tooltip extends React.PureComponent {
|
|
|
160
161
|
onClick: e => {
|
|
161
162
|
e.stopPropagation();
|
|
162
163
|
},
|
|
163
|
-
onMouseOver: () =>
|
|
164
|
-
|
|
164
|
+
onMouseOver: () => {
|
|
165
|
+
if (delayShow) {
|
|
166
|
+
this.delayTimer = setTimeout(() => {
|
|
167
|
+
ReactTooltip.show(this.tooltipElement);
|
|
168
|
+
}, DELAY_SHOW_MILLIS);
|
|
169
|
+
} else {
|
|
170
|
+
ReactTooltip.show(this.tooltipElement);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
onMouseOut: () => {
|
|
174
|
+
clearTimeout(this.delayTimer);
|
|
175
|
+
ReactTooltip.hide(this.tooltipElement);
|
|
176
|
+
},
|
|
165
177
|
"aria-controls": id,
|
|
166
178
|
"aria-label": ariaLabel,
|
|
167
179
|
"aria-describedby": 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",
|
|
@@ -187,7 +189,6 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
187
189
|
className: className,
|
|
188
190
|
isCapture: isCapture,
|
|
189
191
|
delayHide: delayHide ? delayHide : null,
|
|
190
|
-
delayShow: delayShow ? DELAY_SHOW_MILLIS : null,
|
|
191
192
|
afterShow: afterShow,
|
|
192
193
|
afterHide: afterHide,
|
|
193
194
|
getContent: [function () {
|
|
@@ -226,10 +227,18 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
226
227
|
e.stopPropagation();
|
|
227
228
|
},
|
|
228
229
|
onMouseOver: function onMouseOver() {
|
|
229
|
-
|
|
230
|
+
if (delayShow) {
|
|
231
|
+
_this3.delayTimer = setTimeout(function () {
|
|
232
|
+
_reactTooltip.default.show(_this3.tooltipElement);
|
|
233
|
+
}, DELAY_SHOW_MILLIS);
|
|
234
|
+
} else {
|
|
235
|
+
_reactTooltip.default.show(_this3.tooltipElement);
|
|
236
|
+
}
|
|
230
237
|
},
|
|
231
238
|
onMouseOut: function onMouseOut() {
|
|
232
|
-
|
|
239
|
+
clearTimeout(_this3.delayTimer);
|
|
240
|
+
|
|
241
|
+
_reactTooltip.default.hide(_this3.tooltipElement);
|
|
233
242
|
},
|
|
234
243
|
"aria-controls": id,
|
|
235
244
|
"aria-label": ariaLabel,
|
package/package.json
CHANGED