@micromag/element-link 0.3.541 → 0.3.569
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/package.json +4 -5
- package/lib/index.js +0 -77
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-link",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.569",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -30,11 +30,10 @@
|
|
|
30
30
|
}
|
|
31
31
|
],
|
|
32
32
|
"license": "ISC",
|
|
33
|
-
"
|
|
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.
|
|
62
|
+
"@micromag/core": "^0.3.569",
|
|
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": "
|
|
72
|
+
"gitHead": "ceb71f23a32ab8df4a1563a1e5cd5598e539de4d"
|
|
74
73
|
}
|
package/lib/index.js
DELETED
|
@@ -1,77 +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 utils = require('@micromag/core/utils');
|
|
11
|
-
|
|
12
|
-
var styles = {"container":"micromag-element-link-container"};
|
|
13
|
-
|
|
14
|
-
var propTypes = {
|
|
15
|
-
url: PropTypes.string,
|
|
16
|
-
target: PropTypes.string,
|
|
17
|
-
rel: PropTypes.string,
|
|
18
|
-
external: PropTypes.bool,
|
|
19
|
-
margin: core.PropTypes.margin,
|
|
20
|
-
className: PropTypes.string,
|
|
21
|
-
children: PropTypes.node,
|
|
22
|
-
focusable: PropTypes.bool
|
|
23
|
-
};
|
|
24
|
-
var defaultProps = {
|
|
25
|
-
url: null,
|
|
26
|
-
target: null,
|
|
27
|
-
rel: null,
|
|
28
|
-
external: true,
|
|
29
|
-
margin: null,
|
|
30
|
-
className: null,
|
|
31
|
-
children: null,
|
|
32
|
-
focusable: true
|
|
33
|
-
};
|
|
34
|
-
var Link = function Link(_ref) {
|
|
35
|
-
var url = _ref.url,
|
|
36
|
-
linkTarget = _ref.target,
|
|
37
|
-
linkRel = _ref.rel,
|
|
38
|
-
external = _ref.external,
|
|
39
|
-
margin = _ref.margin,
|
|
40
|
-
className = _ref.className,
|
|
41
|
-
children = _ref.children,
|
|
42
|
-
focusable = _ref.focusable;
|
|
43
|
-
var finalStyle = null;
|
|
44
|
-
if (margin !== null) {
|
|
45
|
-
finalStyle = _objectSpread(_objectSpread({}, finalStyle), utils.getStyleFromMargin(margin));
|
|
46
|
-
}
|
|
47
|
-
var id = React.useMemo(function () {
|
|
48
|
-
return finalStyle !== null ? "link-component-".concat(uuid.v1()) : null;
|
|
49
|
-
}, [finalStyle !== null]);
|
|
50
|
-
var _ref2 = external ? {
|
|
51
|
-
target: '_blank',
|
|
52
|
-
rel: 'noopener noreferer'
|
|
53
|
-
} : {
|
|
54
|
-
target: linkTarget,
|
|
55
|
-
rel: linkRel
|
|
56
|
-
},
|
|
57
|
-
target = _ref2.target,
|
|
58
|
-
rel = _ref2.rel;
|
|
59
|
-
return url ? /*#__PURE__*/React.createElement("a", {
|
|
60
|
-
id: id,
|
|
61
|
-
className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
|
|
62
|
-
style: finalStyle,
|
|
63
|
-
href: url,
|
|
64
|
-
target: target,
|
|
65
|
-
rel: rel,
|
|
66
|
-
tabIndex: focusable ? '0' : '-1'
|
|
67
|
-
}, children) : /*#__PURE__*/React.createElement("div", {
|
|
68
|
-
id: id,
|
|
69
|
-
className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
|
|
70
|
-
style: finalStyle
|
|
71
|
-
}, children);
|
|
72
|
-
};
|
|
73
|
-
Link.propTypes = propTypes;
|
|
74
|
-
Link.defaultProps = defaultProps;
|
|
75
|
-
var Link$1 = Link;
|
|
76
|
-
|
|
77
|
-
module.exports = Link$1;
|