@micromag/element-heading 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/lib/index.js +13 -21
- package/package.json +9 -3
package/lib/index.js
CHANGED
|
@@ -10,24 +10,16 @@ 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-heading-container"};
|
|
22
14
|
|
|
23
15
|
var propTypes = {
|
|
24
|
-
size:
|
|
25
|
-
body:
|
|
16
|
+
size: PropTypes.oneOf([1, 2, 3, 4, 5, 6]),
|
|
17
|
+
body: PropTypes.string,
|
|
26
18
|
textStyle: core.PropTypes.textStyle,
|
|
27
19
|
linksStyle: core.PropTypes.textStyle,
|
|
28
20
|
margin: core.PropTypes.margin,
|
|
29
|
-
className:
|
|
30
|
-
headingRef:
|
|
21
|
+
className: PropTypes.string,
|
|
22
|
+
headingRef: PropTypes.shape({})
|
|
31
23
|
};
|
|
32
24
|
var defaultProps = {
|
|
33
25
|
size: 1,
|
|
@@ -56,27 +48,27 @@ var Heading = function Heading(_ref) {
|
|
|
56
48
|
var finalLinkStyle = linkStyle !== null ? utils.getStyleFromLink(linkStyle) : null;
|
|
57
49
|
var finalHighlightStyle = highlightStyle !== null ? utils.getStyleFromHighlight(highlightStyle) : null;
|
|
58
50
|
if (textStyle !== null) {
|
|
59
|
-
finalStyle =
|
|
51
|
+
finalStyle = _objectSpread(_objectSpread({}, finalStyle), utils.getStyleFromText(textStyle));
|
|
60
52
|
}
|
|
61
53
|
if (margin !== null) {
|
|
62
|
-
finalStyle =
|
|
54
|
+
finalStyle = _objectSpread(_objectSpread({}, finalStyle), utils.getStyleFromMargin(margin));
|
|
63
55
|
}
|
|
64
56
|
if (linksStyle !== null) {
|
|
65
|
-
finalLinkStyle =
|
|
57
|
+
finalLinkStyle = _objectSpread(_objectSpread({}, finalLinkStyle), utils.getStyleFromText(linksStyle));
|
|
66
58
|
}
|
|
67
59
|
var needsId = finalLinkStyle !== null || highlightStyle !== null;
|
|
68
60
|
var id = React.useMemo(function () {
|
|
69
61
|
return needsId ? "text-component-".concat(uuid.v1()) : null;
|
|
70
62
|
}, [needsId]);
|
|
71
|
-
return /*#__PURE__*/
|
|
63
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, finalLinkStyle !== null ? /*#__PURE__*/React.createElement(components.LinkStyle, {
|
|
72
64
|
selector: "#".concat(id),
|
|
73
65
|
style: finalLinkStyle
|
|
74
|
-
}) : null, finalHighlightStyle !== null ? /*#__PURE__*/
|
|
66
|
+
}) : null, finalHighlightStyle !== null ? /*#__PURE__*/React.createElement(components.HighlightStyle, {
|
|
75
67
|
selector: "#".concat(id),
|
|
76
68
|
style: finalHighlightStyle
|
|
77
|
-
}) : null, /*#__PURE__*/
|
|
69
|
+
}) : null, /*#__PURE__*/React.createElement(HeadingComponent, {
|
|
78
70
|
id: id,
|
|
79
|
-
className:
|
|
71
|
+
className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
|
|
80
72
|
style: finalStyle,
|
|
81
73
|
dangerouslySetInnerHTML: {
|
|
82
74
|
__html: body
|
|
@@ -88,8 +80,8 @@ Heading.propTypes = propTypes;
|
|
|
88
80
|
Heading.defaultProps = defaultProps;
|
|
89
81
|
|
|
90
82
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
91
|
-
var Heading$1 = /*#__PURE__*/
|
|
92
|
-
return /*#__PURE__*/
|
|
83
|
+
var Heading$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
84
|
+
return /*#__PURE__*/React.createElement(Heading, Object.assign({
|
|
93
85
|
headingRef: ref
|
|
94
86
|
}, props));
|
|
95
87
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-heading",
|
|
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
|
}
|