@cloudflare/component-tooltip 2.7.179 → 4.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/es/Tooltip.js CHANGED
@@ -5,57 +5,60 @@ import { createComponent } from '@cloudflare/style-container';
5
5
  import ReactTooltip from 'react-tooltip';
6
6
  import uniqueId from 'lodash.uniqueid';
7
7
 
8
- const getBackgroundColor = (theme, type) => {
8
+ var getBackgroundColor = (theme, type) => {
9
9
  if (type === 'dark') {
10
- return `${theme.colors.gray[2]} !important`;
10
+ return "".concat(theme.colors.gray[2], " !important");
11
11
  }
12
12
 
13
13
  if (type === 'success') {
14
- return `${theme.colors.green[6]} !important`;
14
+ return "".concat(theme.colors.green[6], " !important");
15
15
  }
16
16
 
17
17
  return 'inherit';
18
18
  };
19
19
 
20
- export const tooltipStyles = ({
21
- theme,
22
- type,
23
- place
24
- }) => ({
25
- '&:after': {
26
- borderTopColor: place === 'top' ? getBackgroundColor(theme, type) : 'inherit',
27
- borderRightColor: place === 'right' ? getBackgroundColor(theme, type) : 'inherit',
28
- borderLeftColor: place === 'left' ? getBackgroundColor(theme, type) : 'inherit',
29
- borderBottomColor: place === 'bottom' ? getBackgroundColor(theme, type) : 'inherit'
30
- },
31
- color: `${theme.colors.white} !important`,
32
- backgroundColor: getBackgroundColor(theme, type),
33
- opacity: '1!important',
34
- fontSize: `${theme.fontSizes[1]}px!important`,
35
- borderRadius: '2px!important',
36
- maxWidth: '21rem!important',
37
- paddingLeft: `${theme.space[3]}px!important`,
38
- paddingRight: `${theme.space[3]}px!important`,
39
- paddingTop: `${theme.space[2]}px!important`,
40
- paddingBottom: `${theme.space[2]}px!important`,
41
- fontWeight: 'normal!important',
42
- lineHeight: '1.5!important',
43
- pointerEvents: 'auto !important',
44
- verticalAlign: 'baseline!important',
45
- whiteSpace: 'normal',
46
- zIndex: '1300',
47
- '&:hover': {
48
- visibility: 'visible!important',
49
- opacity: '1!important'
50
- },
51
- '& a': {
52
- color: theme.colors.white,
53
- textDecoration: 'underline',
54
- ':hover': {
55
- textDecoration: 'none'
20
+ export var tooltipStyles = _ref => {
21
+ var {
22
+ theme,
23
+ type,
24
+ place
25
+ } = _ref;
26
+ return {
27
+ '&:after': {
28
+ borderTopColor: place === 'top' ? getBackgroundColor(theme, type) : 'inherit',
29
+ borderRightColor: place === 'right' ? getBackgroundColor(theme, type) : 'inherit',
30
+ borderLeftColor: place === 'left' ? getBackgroundColor(theme, type) : 'inherit',
31
+ borderBottomColor: place === 'bottom' ? getBackgroundColor(theme, type) : 'inherit'
32
+ },
33
+ color: "".concat(theme.colors.white, " !important"),
34
+ backgroundColor: getBackgroundColor(theme, type),
35
+ opacity: '1!important',
36
+ fontSize: "".concat(theme.fontSizes[1], "px!important"),
37
+ borderRadius: '2px!important',
38
+ maxWidth: '21rem!important',
39
+ paddingLeft: "".concat(theme.space[3], "px!important"),
40
+ paddingRight: "".concat(theme.space[3], "px!important"),
41
+ paddingTop: "".concat(theme.space[2], "px!important"),
42
+ paddingBottom: "".concat(theme.space[2], "px!important"),
43
+ fontWeight: 'normal!important',
44
+ lineHeight: '1.5!important',
45
+ pointerEvents: 'auto !important',
46
+ verticalAlign: 'baseline!important',
47
+ whiteSpace: 'normal',
48
+ zIndex: '1300',
49
+ '&:hover': {
50
+ visibility: 'visible!important',
51
+ opacity: '1!important'
52
+ },
53
+ '& a': {
54
+ color: theme.colors.white,
55
+ textDecoration: 'underline',
56
+ ':hover': {
57
+ textDecoration: 'none'
58
+ }
56
59
  }
57
- }
58
- });
60
+ };
61
+ };
59
62
 
60
63
  class Tooltip extends React.PureComponent {
61
64
  constructor(props) {
@@ -88,22 +91,23 @@ class Tooltip extends React.PureComponent {
88
91
  }
89
92
 
90
93
  render() {
91
- const _this$props = this.props,
92
- disable = _this$props.disable,
93
- place = _this$props.place,
94
- message = _this$props.message,
95
- children = _this$props.children,
96
- className = _this$props.className,
97
- delayHide = _this$props.delayHide,
98
- afterHide = _this$props.afterHide,
99
- afterShow = _this$props.afterShow,
100
- getContent = _this$props.getContent,
101
- type = _this$props.type,
102
- anchored = _this$props.anchored,
103
- isCapture = _this$props.isCapture,
104
- display = _this$props.display,
105
- ariaLabel = _this$props.ariaLabel;
106
- const id = this.props.id ? this.props.id : this.id;
94
+ var {
95
+ disable,
96
+ place,
97
+ message,
98
+ children,
99
+ className,
100
+ delayHide,
101
+ afterHide,
102
+ afterShow,
103
+ getContent,
104
+ type,
105
+ anchored,
106
+ isCapture,
107
+ display,
108
+ ariaLabel
109
+ } = this.props;
110
+ var id = this.props.id ? this.props.id : this.id;
107
111
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReactTooltip, {
108
112
  id: id,
109
113
  disable: disable,
package/lib/Tooltip.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = exports.tooltipStyles = void 0;
8
+ exports.tooltipStyles = exports.default = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
@@ -25,18 +25,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
25
25
 
26
26
  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); } }
27
27
 
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
28
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
29
 
30
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
30
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
31
 
32
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
32
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
33
 
34
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
34
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
35
35
 
36
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
36
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
37
37
 
38
38
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
39
 
40
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
+
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
+
40
44
  var getBackgroundColor = function getBackgroundColor(theme, type) {
41
45
  if (type === 'dark') {
42
46
  return "".concat(theme.colors.gray[2], " !important");
@@ -95,14 +99,16 @@ exports.tooltipStyles = tooltipStyles;
95
99
  var Tooltip = /*#__PURE__*/function (_React$PureComponent) {
96
100
  _inherits(Tooltip, _React$PureComponent);
97
101
 
102
+ var _super = _createSuper(Tooltip);
103
+
98
104
  function Tooltip(props) {
99
105
  var _this;
100
106
 
101
107
  _classCallCheck(this, Tooltip);
102
108
 
103
- _this = _possibleConstructorReturn(this, _getPrototypeOf(Tooltip).call(this, props));
109
+ _this = _super.call(this, props);
104
110
  _this.id = (0, _lodash.default)('cf_component_tooltip_');
105
- _this.escFunction = _this.escFunction.bind(_assertThisInitialized(_assertThisInitialized(_this)));
111
+ _this.escFunction = _this.escFunction.bind(_assertThisInitialized(_this));
106
112
  return _this;
107
113
  }
108
114
 
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -20,6 +20,6 @@ Object.defineProperty(exports, "tooltipStyles", {
20
20
 
21
21
  var _Tooltip = _interopRequireWildcard(require("./Tooltip"));
22
22
 
23
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
23
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
24
 
25
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
package/package.json CHANGED
@@ -1,23 +1,24 @@
1
1
  {
2
2
  "name": "@cloudflare/component-tooltip",
3
3
  "description": "Cloudflare Tooltip Component",
4
- "version": "2.7.179",
4
+ "version": "4.0.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
7
  "author": "James Kyle <jkyle@cloudflare.com>",
8
8
  "license": "BSD-3-Clause",
9
9
  "publishConfig": {
10
- "registry": "https://registry.npmjs.org/",
11
- "access": "public"
10
+ "access": "public",
11
+ "main": "lib/index.js",
12
+ "module": "es/index.js"
12
13
  },
13
14
  "dependencies": {
14
- "@cloudflare/elements": "^1.12.7",
15
- "@cloudflare/style-container": "^7.8.45",
15
+ "@cloudflare/elements": "^3.0.0",
16
16
  "lodash.uniqueid": "^4.0.1",
17
17
  "prop-types": "^15.6.0",
18
18
  "react-tooltip": "^3.11.6"
19
19
  },
20
20
  "peerDependencies": {
21
+ "@cloudflare/style-container": "^7.10.0",
21
22
  "react": "^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0"
22
23
  },
23
24
  "stratus": {
@@ -30,6 +31,5 @@
30
31
  "test": "stratus test",
31
32
  "test-coverage": "stratus test --coverage",
32
33
  "test-watch": "stratus test --watch"
33
- },
34
- "gitHead": "216f13f248dedfe1b8ec6c4de0dae0244c7cfaa6"
35
- }
34
+ }
35
+ }