@cloudflare/component-tooltip 4.7.3 → 5.0.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 +12 -0
- package/es/Tooltip.js +6 -1
- package/index.d.ts +1 -0
- package/lib/Tooltip.js +7 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/es/Tooltip.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Button } from '@cloudflare/elements';
|
|
|
6
6
|
import { createComponent } from '@cloudflare/style-container';
|
|
7
7
|
import ReactTooltip from 'react-tooltip';
|
|
8
8
|
import uniqueId from 'lodash.uniqueid';
|
|
9
|
+
var DELAY_SHOW_MILLIS = 400;
|
|
9
10
|
|
|
10
11
|
var getBackgroundColor = (theme, type) => {
|
|
11
12
|
if (type === 'dark') {
|
|
@@ -104,6 +105,7 @@ class Tooltip extends React.PureComponent {
|
|
|
104
105
|
children,
|
|
105
106
|
className,
|
|
106
107
|
delayHide,
|
|
108
|
+
delayShow,
|
|
107
109
|
afterHide,
|
|
108
110
|
afterShow,
|
|
109
111
|
getContent,
|
|
@@ -126,6 +128,7 @@ class Tooltip extends React.PureComponent {
|
|
|
126
128
|
className: className,
|
|
127
129
|
isCapture: isCapture,
|
|
128
130
|
delayHide: delayHide ? delayHide : null,
|
|
131
|
+
delayShow: delayShow ? DELAY_SHOW_MILLIS : null,
|
|
129
132
|
afterShow: afterShow,
|
|
130
133
|
afterHide: afterHide,
|
|
131
134
|
getContent: [() => message || getContent()],
|
|
@@ -178,6 +181,7 @@ Tooltip.propTypes = {
|
|
|
178
181
|
children: PropTypes.node,
|
|
179
182
|
disable: PropTypes.bool,
|
|
180
183
|
delayHide: PropTypes.number,
|
|
184
|
+
delayShow: PropTypes.bool,
|
|
181
185
|
afterHide: PropTypes.func,
|
|
182
186
|
afterShow: PropTypes.func,
|
|
183
187
|
buttonProps: PropTypes.object,
|
|
@@ -197,7 +201,8 @@ Tooltip.defaultProps = {
|
|
|
197
201
|
type: 'dark',
|
|
198
202
|
anchored: true,
|
|
199
203
|
isCapture: true,
|
|
200
|
-
forceRebuild: false
|
|
204
|
+
forceRebuild: false,
|
|
205
|
+
delayShow: true
|
|
201
206
|
};
|
|
202
207
|
Tooltip.displayName = 'Tooltip';
|
|
203
208
|
export default createComponent(tooltipStyles, Tooltip);
|
package/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface TooltipProps extends React.CSSProperties, TfelaMProps {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
disable?: boolean;
|
|
13
13
|
delayHide?: number;
|
|
14
|
+
delayShow?: boolean;
|
|
14
15
|
afterHide?: (...args: any[]) => void;
|
|
15
16
|
afterShow?: (...args: any[]) => void;
|
|
16
17
|
getContent?: (...args: any[]) => void;
|
package/lib/Tooltip.js
CHANGED
|
@@ -43,6 +43,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
43
43
|
|
|
44
44
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
45
|
|
|
46
|
+
var DELAY_SHOW_MILLIS = 400;
|
|
47
|
+
|
|
46
48
|
var getBackgroundColor = function getBackgroundColor(theme, type) {
|
|
47
49
|
if (type === 'dark') {
|
|
48
50
|
return "".concat(theme.colors.gray[2], " !important");
|
|
@@ -162,6 +164,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
162
164
|
children = _this$props.children,
|
|
163
165
|
className = _this$props.className,
|
|
164
166
|
delayHide = _this$props.delayHide,
|
|
167
|
+
delayShow = _this$props.delayShow,
|
|
165
168
|
afterHide = _this$props.afterHide,
|
|
166
169
|
afterShow = _this$props.afterShow,
|
|
167
170
|
getContent = _this$props.getContent,
|
|
@@ -184,6 +187,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
184
187
|
className: className,
|
|
185
188
|
isCapture: isCapture,
|
|
186
189
|
delayHide: delayHide ? delayHide : null,
|
|
190
|
+
delayShow: delayShow ? DELAY_SHOW_MILLIS : null,
|
|
187
191
|
afterShow: afterShow,
|
|
188
192
|
afterHide: afterHide,
|
|
189
193
|
getContent: [function () {
|
|
@@ -248,6 +252,7 @@ Tooltip.propTypes = {
|
|
|
248
252
|
children: _propTypes.default.node,
|
|
249
253
|
disable: _propTypes.default.bool,
|
|
250
254
|
delayHide: _propTypes.default.number,
|
|
255
|
+
delayShow: _propTypes.default.bool,
|
|
251
256
|
afterHide: _propTypes.default.func,
|
|
252
257
|
afterShow: _propTypes.default.func,
|
|
253
258
|
buttonProps: _propTypes.default.object,
|
|
@@ -267,7 +272,8 @@ Tooltip.defaultProps = {
|
|
|
267
272
|
type: 'dark',
|
|
268
273
|
anchored: true,
|
|
269
274
|
isCapture: true,
|
|
270
|
-
forceRebuild: false
|
|
275
|
+
forceRebuild: false,
|
|
276
|
+
delayShow: true
|
|
271
277
|
};
|
|
272
278
|
Tooltip.displayName = 'Tooltip';
|
|
273
279
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/component-tooltip",
|
|
3
3
|
"description": "Cloudflare Tooltip Component",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"author": "James Kyle <jkyle@cloudflare.com>",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"module": "es/index.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@cloudflare/elements": "^3.0.
|
|
15
|
+
"@cloudflare/elements": "^3.0.8",
|
|
16
16
|
"lodash.uniqueid": "^4.0.1",
|
|
17
17
|
"prop-types": "^15.6.0",
|
|
18
18
|
"react-tooltip": "^3.11.6"
|