@cloudflare/component-tooltip 4.0.0 → 4.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 +6 -2
- package/index.d.ts +2 -0
- package/lib/Tooltip.js +6 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/es/Tooltip.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import PropTypes from 'prop-types';
|
|
3
5
|
import { Button } from '@cloudflare/elements';
|
|
@@ -103,6 +105,7 @@ class Tooltip extends React.PureComponent {
|
|
|
103
105
|
getContent,
|
|
104
106
|
type,
|
|
105
107
|
anchored,
|
|
108
|
+
buttonProps,
|
|
106
109
|
isCapture,
|
|
107
110
|
display,
|
|
108
111
|
ariaLabel
|
|
@@ -123,7 +126,7 @@ class Tooltip extends React.PureComponent {
|
|
|
123
126
|
onClick: this.props.onClick,
|
|
124
127
|
event: "click",
|
|
125
128
|
role: "status"
|
|
126
|
-
}), /*#__PURE__*/React.createElement(Button, {
|
|
129
|
+
}), /*#__PURE__*/React.createElement(Button, _extends({
|
|
127
130
|
innerRef: ref => this.tooltipElement = ref,
|
|
128
131
|
display: display ? display : 'flex',
|
|
129
132
|
pointerEvents: "bounding-box",
|
|
@@ -143,7 +146,7 @@ class Tooltip extends React.PureComponent {
|
|
|
143
146
|
onMouseOut: () => ReactTooltip.hide(this.tooltipElement),
|
|
144
147
|
"aria-controls": id,
|
|
145
148
|
"aria-label": ariaLabel
|
|
146
|
-
}, children));
|
|
149
|
+
}, buttonProps), children));
|
|
147
150
|
}
|
|
148
151
|
|
|
149
152
|
}
|
|
@@ -161,6 +164,7 @@ Tooltip.propTypes = {
|
|
|
161
164
|
delayHide: PropTypes.number,
|
|
162
165
|
afterHide: PropTypes.func,
|
|
163
166
|
afterShow: PropTypes.func,
|
|
167
|
+
buttonProps: PropTypes.object,
|
|
164
168
|
getContent: PropTypes.func,
|
|
165
169
|
forceRebuild: PropTypes.bool,
|
|
166
170
|
onClick: PropTypes.func,
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Button } from '@cloudflare/component-button';
|
|
2
3
|
import { TfelaMProps } from '@cloudflare/types';
|
|
3
4
|
|
|
4
5
|
interface TooltipProps extends React.CSSProperties, TfelaMProps {
|
|
@@ -16,6 +17,7 @@ interface TooltipProps extends React.CSSProperties, TfelaMProps {
|
|
|
16
17
|
forceRebuild?: boolean;
|
|
17
18
|
onClick?: (...args: any[]) => void;
|
|
18
19
|
ariaLabel?: string;
|
|
20
|
+
buttonProps?: React.ComponentProps<typeof Button>;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export const Tooltip: React.FC<TooltipProps>;
|
package/lib/Tooltip.js
CHANGED
|
@@ -21,6 +21,8 @@ var _lodash = _interopRequireDefault(require("lodash.uniqueid"));
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
+
|
|
24
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
27
|
|
|
26
28
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -161,6 +163,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
161
163
|
getContent = _this$props.getContent,
|
|
162
164
|
type = _this$props.type,
|
|
163
165
|
anchored = _this$props.anchored,
|
|
166
|
+
buttonProps = _this$props.buttonProps,
|
|
164
167
|
isCapture = _this$props.isCapture,
|
|
165
168
|
display = _this$props.display,
|
|
166
169
|
ariaLabel = _this$props.ariaLabel;
|
|
@@ -182,7 +185,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
182
185
|
onClick: this.props.onClick,
|
|
183
186
|
event: "click",
|
|
184
187
|
role: "status"
|
|
185
|
-
}), /*#__PURE__*/_react.default.createElement(_elements.Button, {
|
|
188
|
+
}), /*#__PURE__*/_react.default.createElement(_elements.Button, _extends({
|
|
186
189
|
innerRef: function innerRef(ref) {
|
|
187
190
|
return _this3.tooltipElement = ref;
|
|
188
191
|
},
|
|
@@ -210,7 +213,7 @@ var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
210
213
|
},
|
|
211
214
|
"aria-controls": id,
|
|
212
215
|
"aria-label": ariaLabel
|
|
213
|
-
}, children));
|
|
216
|
+
}, buttonProps), children));
|
|
214
217
|
}
|
|
215
218
|
}]);
|
|
216
219
|
|
|
@@ -230,6 +233,7 @@ Tooltip.propTypes = {
|
|
|
230
233
|
delayHide: _propTypes.default.number,
|
|
231
234
|
afterHide: _propTypes.default.func,
|
|
232
235
|
afterShow: _propTypes.default.func,
|
|
236
|
+
buttonProps: _propTypes.default.object,
|
|
233
237
|
getContent: _propTypes.default.func,
|
|
234
238
|
forceRebuild: _propTypes.default.bool,
|
|
235
239
|
onClick: _propTypes.default.func,
|
package/package.json
CHANGED