@cloudflare/component-tooltip 5.0.0 → 5.1.0
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 +6 -0
- package/es/Tooltip.js +14 -3
- package/lib/Tooltip.js +11 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/es/Tooltip.js
CHANGED
|
@@ -119,6 +119,7 @@ class Tooltip extends React.PureComponent {
|
|
|
119
119
|
componentRef
|
|
120
120
|
} = this.props;
|
|
121
121
|
var id = this.props.id ? this.props.id : this.id;
|
|
122
|
+
var timer;
|
|
122
123
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReactTooltip, {
|
|
123
124
|
id: id,
|
|
124
125
|
disable: disable,
|
|
@@ -128,7 +129,6 @@ class Tooltip extends React.PureComponent {
|
|
|
128
129
|
className: className,
|
|
129
130
|
isCapture: isCapture,
|
|
130
131
|
delayHide: delayHide ? delayHide : null,
|
|
131
|
-
delayShow: delayShow ? DELAY_SHOW_MILLIS : null,
|
|
132
132
|
afterShow: afterShow,
|
|
133
133
|
afterHide: afterHide,
|
|
134
134
|
getContent: [() => message || getContent()],
|
|
@@ -160,8 +160,19 @@ class Tooltip extends React.PureComponent {
|
|
|
160
160
|
onClick: e => {
|
|
161
161
|
e.stopPropagation();
|
|
162
162
|
},
|
|
163
|
-
onMouseOver: () =>
|
|
164
|
-
|
|
163
|
+
onMouseOver: () => {
|
|
164
|
+
if (delayShow) {
|
|
165
|
+
timer = setTimeout(() => {
|
|
166
|
+
ReactTooltip.show(this.tooltipElement);
|
|
167
|
+
}, DELAY_SHOW_MILLIS);
|
|
168
|
+
} else {
|
|
169
|
+
ReactTooltip.show(this.tooltipElement);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
onMouseOut: () => {
|
|
173
|
+
clearTimeout(timer);
|
|
174
|
+
ReactTooltip.hide(this.tooltipElement);
|
|
175
|
+
},
|
|
165
176
|
"aria-controls": id,
|
|
166
177
|
"aria-label": ariaLabel,
|
|
167
178
|
"aria-describedby": id
|
package/lib/Tooltip.js
CHANGED
|
@@ -178,6 +178,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
178
178
|
Component = _this$props$Component === void 0 ? _elements.Button : _this$props$Component,
|
|
179
179
|
componentRef = _this$props.componentRef;
|
|
180
180
|
var id = this.props.id ? this.props.id : this.id;
|
|
181
|
+
var timer;
|
|
181
182
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactTooltip.default, {
|
|
182
183
|
id: id,
|
|
183
184
|
disable: disable,
|
|
@@ -187,7 +188,6 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
187
188
|
className: className,
|
|
188
189
|
isCapture: isCapture,
|
|
189
190
|
delayHide: delayHide ? delayHide : null,
|
|
190
|
-
delayShow: delayShow ? DELAY_SHOW_MILLIS : null,
|
|
191
191
|
afterShow: afterShow,
|
|
192
192
|
afterHide: afterHide,
|
|
193
193
|
getContent: [function () {
|
|
@@ -226,10 +226,18 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
226
226
|
e.stopPropagation();
|
|
227
227
|
},
|
|
228
228
|
onMouseOver: function onMouseOver() {
|
|
229
|
-
|
|
229
|
+
if (delayShow) {
|
|
230
|
+
timer = setTimeout(function () {
|
|
231
|
+
_reactTooltip.default.show(_this3.tooltipElement);
|
|
232
|
+
}, DELAY_SHOW_MILLIS);
|
|
233
|
+
} else {
|
|
234
|
+
_reactTooltip.default.show(_this3.tooltipElement);
|
|
235
|
+
}
|
|
230
236
|
},
|
|
231
237
|
onMouseOut: function onMouseOut() {
|
|
232
|
-
|
|
238
|
+
clearTimeout(timer);
|
|
239
|
+
|
|
240
|
+
_reactTooltip.default.hide(_this3.tooltipElement);
|
|
233
241
|
},
|
|
234
242
|
"aria-controls": id,
|
|
235
243
|
"aria-label": ariaLabel,
|
package/package.json
CHANGED