@micromag/element-share-incentive 0.3.306 → 0.3.308
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/assets/css/styles.css +1 -1
- package/es/index.js +16 -3
- package/lib/index.js +15 -2
- package/package.json +4 -4
package/assets/css/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.micromag-element-share-incentive-box{display:inline-block}
|
|
1
|
+
.micromag-element-share-incentive-box{display:inline-block;position:relative}.micromag-element-share-incentive-tip{position:absolute;bottom:100%;left:20px;width:30px;height:auto}
|
package/es/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import classNames from 'classnames';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
7
|
-
import { getStyleFromBox } from '@micromag/core/utils';
|
|
7
|
+
import { getColorAsString, getStyleFromBox } from '@micromag/core/utils';
|
|
8
8
|
import Text from '@micromag/element-text';
|
|
9
9
|
|
|
10
|
-
var styles = {"box":"micromag-element-share-incentive-box"};
|
|
10
|
+
var styles = {"box":"micromag-element-share-incentive-box","tip":"micromag-element-share-incentive-tip"};
|
|
11
11
|
|
|
12
12
|
var propTypes = {
|
|
13
13
|
className: PropTypes.string,
|
|
@@ -24,12 +24,25 @@ var ShareIncentive = function ShareIncentive(_ref) {
|
|
|
24
24
|
var className = _ref.className,
|
|
25
25
|
label = _ref.label,
|
|
26
26
|
boxStyle = _ref.boxStyle;
|
|
27
|
+
|
|
28
|
+
var _ref2 = boxStyle || {},
|
|
29
|
+
_ref2$backgroundColor = _ref2.backgroundColor,
|
|
30
|
+
backgroundColor = _ref2$backgroundColor === void 0 ? null : _ref2$backgroundColor;
|
|
31
|
+
|
|
32
|
+
var bgColor = getColorAsString(backgroundColor);
|
|
27
33
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
34
|
className: classNames([styles.container, _defineProperty({}, className, className !== null)])
|
|
29
35
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30
36
|
className: styles.box,
|
|
31
37
|
style: _objectSpread({}, getStyleFromBox(boxStyle))
|
|
32
|
-
}, /*#__PURE__*/React.createElement(
|
|
38
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
39
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
40
|
+
viewBox: "0 0 10 10",
|
|
41
|
+
className: styles.tip,
|
|
42
|
+
fill: bgColor
|
|
43
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
44
|
+
points: "0,0 0,10 10,10"
|
|
45
|
+
})), /*#__PURE__*/React.createElement(Text, Object.assign({
|
|
33
46
|
className: styles.text
|
|
34
47
|
}, label))));
|
|
35
48
|
};
|
package/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
18
18
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
19
|
var Text__default = /*#__PURE__*/_interopDefaultLegacy(Text);
|
|
20
20
|
|
|
21
|
-
var styles = {"box":"micromag-element-share-incentive-box"};
|
|
21
|
+
var styles = {"box":"micromag-element-share-incentive-box","tip":"micromag-element-share-incentive-tip"};
|
|
22
22
|
|
|
23
23
|
var propTypes = {
|
|
24
24
|
className: PropTypes__default["default"].string,
|
|
@@ -35,12 +35,25 @@ var ShareIncentive = function ShareIncentive(_ref) {
|
|
|
35
35
|
var className = _ref.className,
|
|
36
36
|
label = _ref.label,
|
|
37
37
|
boxStyle = _ref.boxStyle;
|
|
38
|
+
|
|
39
|
+
var _ref2 = boxStyle || {},
|
|
40
|
+
_ref2$backgroundColor = _ref2.backgroundColor,
|
|
41
|
+
backgroundColor = _ref2$backgroundColor === void 0 ? null : _ref2$backgroundColor;
|
|
42
|
+
|
|
43
|
+
var bgColor = utils.getColorAsString(backgroundColor);
|
|
38
44
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
39
45
|
className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)])
|
|
40
46
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
41
47
|
className: styles.box,
|
|
42
48
|
style: _objectSpread__default["default"]({}, utils.getStyleFromBox(boxStyle))
|
|
43
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
49
|
+
}, /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
50
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
51
|
+
viewBox: "0 0 10 10",
|
|
52
|
+
className: styles.tip,
|
|
53
|
+
fill: bgColor
|
|
54
|
+
}, /*#__PURE__*/React__default["default"].createElement("polygon", {
|
|
55
|
+
points: "0,0 0,10 10,10"
|
|
56
|
+
})), /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({
|
|
44
57
|
className: styles.text
|
|
45
58
|
}, label))));
|
|
46
59
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-share-incentive",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.308",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@babel/runtime": "^7.13.10",
|
|
52
|
-
"@micromag/core": "^0.3.
|
|
53
|
-
"@micromag/element-text": "^0.3.
|
|
52
|
+
"@micromag/core": "^0.3.307",
|
|
53
|
+
"@micromag/element-text": "^0.3.307",
|
|
54
54
|
"classnames": "^2.2.6",
|
|
55
55
|
"prop-types": "^15.7.2",
|
|
56
56
|
"react-intl": "^5.12.1",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "20027b12d7b8d33d0a78995641de71aae4c26376"
|
|
63
63
|
}
|