@micromag/element-text 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 -98
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-text",
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,98 +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-text-container","showEmpty":"micromag-element-text-showEmpty","withLineClamp":"micromag-element-text-withLineClamp"};
14
-
15
- var propTypes = {
16
- body: PropTypes.string,
17
- textStyle: core.PropTypes.textStyle,
18
- linksStyle: core.PropTypes.textStyle,
19
- margin: core.PropTypes.margin,
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
27
- })])
28
- };
29
- var defaultProps = {
30
- body: null,
31
- textStyle: null,
32
- linksStyle: null,
33
- margin: null,
34
- lineClamp: null,
35
- showEmpty: false,
36
- className: null,
37
- emptyClassName: null,
38
- inline: false,
39
- refText: null
40
- };
41
- var Text = function Text(_ref) {
42
- var body = _ref.body,
43
- textStyle = _ref.textStyle,
44
- linksStyle = _ref.linksStyle,
45
- margin = _ref.margin,
46
- lineClamp = _ref.lineClamp,
47
- showEmpty = _ref.showEmpty,
48
- className = _ref.className,
49
- emptyClassName = _ref.emptyClassName,
50
- inline = _ref.inline,
51
- refText = _ref.refText;
52
- var _ref2 = textStyle || {},
53
- _ref2$link = _ref2.link,
54
- linkStyle = _ref2$link === void 0 ? null : _ref2$link,
55
- _ref2$highlight = _ref2.highlight,
56
- highlightStyle = _ref2$highlight === void 0 ? null : _ref2$highlight;
57
- var finalStyle = {};
58
- var finalLinkStyle = linkStyle !== null ? utils.getStyleFromLink(linkStyle) : null;
59
- var finalHighlightStyle = highlightStyle !== null ? utils.getStyleFromHighlight(highlightStyle) : null;
60
- if (textStyle !== null) {
61
- finalStyle = _objectSpread(_objectSpread({}, finalStyle), utils.getStyleFromText(textStyle));
62
- }
63
- if (lineClamp !== null) {
64
- finalStyle.WebkitLineClamp = lineClamp;
65
- }
66
- if (margin !== null) {
67
- finalStyle = _objectSpread(_objectSpread({}, finalStyle), utils.getStyleFromMargin(margin));
68
- }
69
- if (linksStyle !== null) {
70
- finalLinkStyle = _objectSpread(_objectSpread({}, finalLinkStyle), utils.getStyleFromText(linksStyle));
71
- }
72
- var needsId = finalLinkStyle !== null || highlightStyle !== null;
73
- var id = React.useMemo(function () {
74
- return needsId ? "text-component-".concat(uuid.v1()) : null;
75
- }, [needsId]);
76
- var tagProps = {
77
- id: id,
78
- className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.withLineClamp, lineClamp !== null), styles.showEmpty, showEmpty), emptyClassName, showEmpty && emptyClassName !== null), className, className !== null)]),
79
- style: finalStyle,
80
- dangerouslySetInnerHTML: {
81
- __html: body
82
- },
83
- ref: refText
84
- };
85
- var Tag = "".concat(inline ? 'span' : 'div');
86
- return /*#__PURE__*/React.createElement(React.Fragment, null, finalLinkStyle !== null ? /*#__PURE__*/React.createElement(components.LinkStyle, {
87
- selector: "#".concat(id),
88
- style: finalLinkStyle
89
- }) : null, finalHighlightStyle !== null ? /*#__PURE__*/React.createElement(components.HighlightStyle, {
90
- selector: "#".concat(id),
91
- style: finalHighlightStyle
92
- }) : null, /*#__PURE__*/React.createElement(Tag, tagProps));
93
- };
94
- Text.propTypes = propTypes;
95
- Text.defaultProps = defaultProps;
96
- var Text$1 = Text;
97
-
98
- module.exports = Text$1;