@micromag/element-text 0.3.420 → 0.3.429
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/index.js +1 -2
- package/lib/index.js +15 -24
- package/package.json +9 -3
package/es/index.js
CHANGED
|
@@ -38,7 +38,6 @@ var defaultProps = {
|
|
|
38
38
|
refText: null
|
|
39
39
|
};
|
|
40
40
|
var Text = function Text(_ref) {
|
|
41
|
-
var _ref3;
|
|
42
41
|
var body = _ref.body,
|
|
43
42
|
textStyle = _ref.textStyle,
|
|
44
43
|
linksStyle = _ref.linksStyle,
|
|
@@ -75,7 +74,7 @@ var Text = function Text(_ref) {
|
|
|
75
74
|
}, [needsId]);
|
|
76
75
|
var tagProps = {
|
|
77
76
|
id: id,
|
|
78
|
-
className: classNames([styles.container, (
|
|
77
|
+
className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.withLineClamp, lineClamp !== null), styles.showEmpty, showEmpty), emptyClassName, showEmpty && emptyClassName !== null), className, className !== null)]),
|
|
79
78
|
style: finalStyle,
|
|
80
79
|
dangerouslySetInnerHTML: {
|
|
81
80
|
__html: body
|
package/lib/index.js
CHANGED
|
@@ -10,28 +10,20 @@ var core = require('@micromag/core');
|
|
|
10
10
|
var components = require('@micromag/core/components');
|
|
11
11
|
var utils = require('@micromag/core/utils');
|
|
12
12
|
|
|
13
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
16
|
-
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
17
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
18
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
19
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
|
-
|
|
21
13
|
var styles = {"container":"micromag-element-text-container","showEmpty":"micromag-element-text-showEmpty","withLineClamp":"micromag-element-text-withLineClamp"};
|
|
22
14
|
|
|
23
15
|
var propTypes = {
|
|
24
|
-
body:
|
|
16
|
+
body: PropTypes.string,
|
|
25
17
|
textStyle: core.PropTypes.textStyle,
|
|
26
18
|
linksStyle: core.PropTypes.textStyle,
|
|
27
19
|
margin: core.PropTypes.margin,
|
|
28
|
-
lineClamp:
|
|
29
|
-
showEmpty:
|
|
30
|
-
className:
|
|
31
|
-
emptyClassName:
|
|
32
|
-
inline:
|
|
33
|
-
refText:
|
|
34
|
-
current:
|
|
20
|
+
lineClamp: PropTypes.number,
|
|
21
|
+
showEmpty: PropTypes.bool,
|
|
22
|
+
className: PropTypes.string,
|
|
23
|
+
emptyClassName: PropTypes.string,
|
|
24
|
+
inline: PropTypes.bool,
|
|
25
|
+
refText: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
26
|
+
current: PropTypes.any // eslint-disable-line
|
|
35
27
|
})])
|
|
36
28
|
};
|
|
37
29
|
|
|
@@ -48,7 +40,6 @@ var defaultProps = {
|
|
|
48
40
|
refText: null
|
|
49
41
|
};
|
|
50
42
|
var Text = function Text(_ref) {
|
|
51
|
-
var _ref3;
|
|
52
43
|
var body = _ref.body,
|
|
53
44
|
textStyle = _ref.textStyle,
|
|
54
45
|
linksStyle = _ref.linksStyle,
|
|
@@ -68,16 +59,16 @@ var Text = function Text(_ref) {
|
|
|
68
59
|
var finalLinkStyle = linkStyle !== null ? utils.getStyleFromLink(linkStyle) : null;
|
|
69
60
|
var finalHighlightStyle = highlightStyle !== null ? utils.getStyleFromHighlight(highlightStyle) : null;
|
|
70
61
|
if (textStyle !== null) {
|
|
71
|
-
finalStyle =
|
|
62
|
+
finalStyle = _objectSpread(_objectSpread({}, finalStyle), utils.getStyleFromText(textStyle));
|
|
72
63
|
}
|
|
73
64
|
if (lineClamp !== null) {
|
|
74
65
|
finalStyle.WebkitLineClamp = lineClamp;
|
|
75
66
|
}
|
|
76
67
|
if (margin !== null) {
|
|
77
|
-
finalStyle =
|
|
68
|
+
finalStyle = _objectSpread(_objectSpread({}, finalStyle), utils.getStyleFromMargin(margin));
|
|
78
69
|
}
|
|
79
70
|
if (linksStyle !== null) {
|
|
80
|
-
finalLinkStyle =
|
|
71
|
+
finalLinkStyle = _objectSpread(_objectSpread({}, finalLinkStyle), utils.getStyleFromText(linksStyle));
|
|
81
72
|
}
|
|
82
73
|
var needsId = finalLinkStyle !== null || highlightStyle !== null;
|
|
83
74
|
var id = React.useMemo(function () {
|
|
@@ -85,7 +76,7 @@ var Text = function Text(_ref) {
|
|
|
85
76
|
}, [needsId]);
|
|
86
77
|
var tagProps = {
|
|
87
78
|
id: id,
|
|
88
|
-
className:
|
|
79
|
+
className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.withLineClamp, lineClamp !== null), styles.showEmpty, showEmpty), emptyClassName, showEmpty && emptyClassName !== null), className, className !== null)]),
|
|
89
80
|
style: finalStyle,
|
|
90
81
|
dangerouslySetInnerHTML: {
|
|
91
82
|
__html: body
|
|
@@ -93,13 +84,13 @@ var Text = function Text(_ref) {
|
|
|
93
84
|
ref: refText
|
|
94
85
|
};
|
|
95
86
|
var Tag = "".concat(inline ? 'span' : 'div');
|
|
96
|
-
return /*#__PURE__*/
|
|
87
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, finalLinkStyle !== null ? /*#__PURE__*/React.createElement(components.LinkStyle, {
|
|
97
88
|
selector: "#".concat(id),
|
|
98
89
|
style: finalLinkStyle
|
|
99
|
-
}) : null, finalHighlightStyle !== null ? /*#__PURE__*/
|
|
90
|
+
}) : null, finalHighlightStyle !== null ? /*#__PURE__*/React.createElement(components.HighlightStyle, {
|
|
100
91
|
selector: "#".concat(id),
|
|
101
92
|
style: finalHighlightStyle
|
|
102
|
-
}) : null, /*#__PURE__*/
|
|
93
|
+
}) : null, /*#__PURE__*/React.createElement(Tag, tagProps));
|
|
103
94
|
};
|
|
104
95
|
Text.propTypes = propTypes;
|
|
105
96
|
Text.defaultProps = defaultProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-text",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.429",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"main": "lib/index.js",
|
|
34
34
|
"module": "es/index.js",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"require": "./lib/index.js",
|
|
38
|
+
"import": "./es/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
35
41
|
"files": [
|
|
36
42
|
"lib",
|
|
37
43
|
"es",
|
|
@@ -50,7 +56,7 @@
|
|
|
50
56
|
},
|
|
51
57
|
"dependencies": {
|
|
52
58
|
"@babel/runtime": "^7.13.10",
|
|
53
|
-
"@micromag/core": "^0.3.
|
|
59
|
+
"@micromag/core": "^0.3.429",
|
|
54
60
|
"classnames": "^2.2.6",
|
|
55
61
|
"prop-types": "^15.7.2",
|
|
56
62
|
"react-intl": "^5.12.1",
|
|
@@ -60,5 +66,5 @@
|
|
|
60
66
|
"access": "public",
|
|
61
67
|
"registry": "https://registry.npmjs.org/"
|
|
62
68
|
},
|
|
63
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f15e72b88ecfda4c54b87626513149b58572c52b"
|
|
64
70
|
}
|