@micromag/element-heading 0.3.531 → 0.3.547

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.
Files changed (2) hide show
  1. package/package.json +4 -5
  2. package/lib/index.js +0 -89
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-heading",
3
- "version": "0.3.531",
3
+ "version": "0.3.547",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -30,11 +30,10 @@
30
30
  }
31
31
  ],
32
32
  "license": "ISC",
33
- "main": "lib/index.js",
33
+ "type": "module",
34
34
  "module": "es/index.js",
35
35
  "exports": {
36
36
  ".": {
37
- "require": "./lib/index.js",
38
37
  "import": "./es/index.js"
39
38
  },
40
39
  "./assets/css/styles": "./assets/css/styles.css",
@@ -60,7 +59,7 @@
60
59
  },
61
60
  "dependencies": {
62
61
  "@babel/runtime": "^7.13.10",
63
- "@micromag/core": "^0.3.531",
62
+ "@micromag/core": "^0.3.547",
64
63
  "classnames": "^2.2.6",
65
64
  "prop-types": "^15.7.2",
66
65
  "react-intl": "^6.6.4",
@@ -70,5 +69,5 @@
70
69
  "access": "public",
71
70
  "registry": "https://registry.npmjs.org/"
72
71
  },
73
- "gitHead": "e3a59c467ad33528b38eb4badd78b6ed0e38a3a6"
72
+ "gitHead": "3c2f5904ce61fcfa61f673c38c2a5ec56e9e2b07"
74
73
  }
package/lib/index.js DELETED
@@ -1,89 +0,0 @@
1
- 'use strict';
2
-
3
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
- var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
5
- var classNames = require('classnames');
6
- var PropTypes = require('prop-types');
7
- var React = require('react');
8
- var uuid = require('uuid');
9
- var core = require('@micromag/core');
10
- var components = require('@micromag/core/components');
11
- var utils = require('@micromag/core/utils');
12
-
13
- var styles = {"container":"micromag-element-heading-container"};
14
-
15
- var propTypes = {
16
- size: PropTypes.oneOf([1, 2, 3, 4, 5, 6]),
17
- body: PropTypes.string,
18
- textStyle: core.PropTypes.textStyle,
19
- linksStyle: core.PropTypes.textStyle,
20
- margin: core.PropTypes.margin,
21
- className: PropTypes.string,
22
- headingRef: PropTypes.shape({})
23
- };
24
- var defaultProps = {
25
- size: 1,
26
- body: null,
27
- textStyle: null,
28
- linksStyle: null,
29
- margin: null,
30
- className: null,
31
- headingRef: null
32
- };
33
- var Heading = function Heading(_ref) {
34
- var size = _ref.size,
35
- body = _ref.body,
36
- textStyle = _ref.textStyle,
37
- linksStyle = _ref.linksStyle,
38
- margin = _ref.margin,
39
- className = _ref.className,
40
- headingRef = _ref.headingRef;
41
- var HeadingComponent = "h".concat(size);
42
- var _ref2 = textStyle || {},
43
- _ref2$link = _ref2.link,
44
- linkStyle = _ref2$link === void 0 ? null : _ref2$link,
45
- _ref2$highlight = _ref2.highlight,
46
- highlightStyle = _ref2$highlight === void 0 ? null : _ref2$highlight;
47
- var finalStyle = null;
48
- var finalLinkStyle = linkStyle !== null ? utils.getStyleFromLink(linkStyle) : null;
49
- var finalHighlightStyle = highlightStyle !== null ? utils.getStyleFromHighlight(highlightStyle) : null;
50
- if (textStyle !== null) {
51
- finalStyle = _objectSpread(_objectSpread({}, finalStyle), utils.getStyleFromText(textStyle));
52
- }
53
- if (margin !== null) {
54
- finalStyle = _objectSpread(_objectSpread({}, finalStyle), utils.getStyleFromMargin(margin));
55
- }
56
- if (linksStyle !== null) {
57
- finalLinkStyle = _objectSpread(_objectSpread({}, finalLinkStyle), utils.getStyleFromText(linksStyle));
58
- }
59
- var needsId = finalLinkStyle !== null || highlightStyle !== null;
60
- var id = React.useMemo(function () {
61
- return needsId ? "text-component-".concat(uuid.v1()) : null;
62
- }, [needsId]);
63
- return /*#__PURE__*/React.createElement(React.Fragment, null, finalLinkStyle !== null ? /*#__PURE__*/React.createElement(components.LinkStyle, {
64
- selector: "#".concat(id),
65
- style: finalLinkStyle
66
- }) : null, finalHighlightStyle !== null ? /*#__PURE__*/React.createElement(components.HighlightStyle, {
67
- selector: "#".concat(id),
68
- style: finalHighlightStyle
69
- }) : null, /*#__PURE__*/React.createElement(HeadingComponent, {
70
- id: id,
71
- className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
72
- style: finalStyle,
73
- dangerouslySetInnerHTML: {
74
- __html: body
75
- },
76
- ref: headingRef
77
- }));
78
- };
79
- Heading.propTypes = propTypes;
80
- Heading.defaultProps = defaultProps;
81
-
82
- // eslint-disable-next-line react/jsx-props-no-spreading
83
- var Heading$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
84
- return /*#__PURE__*/React.createElement(Heading, Object.assign({
85
- headingRef: ref
86
- }, props));
87
- });
88
-
89
- module.exports = Heading$1;