@uncinc/uncinc-react-kitchen-sink 2.14.2 → 2.14.3
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.
|
@@ -7,7 +7,7 @@ import { Link } from 'react-router-dom';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import gtm from '../../helpers/gtm';
|
|
10
|
-
import { isExternalLink } from '../../helpers/link';
|
|
10
|
+
import { isExternalLink, isHashLink } from '../../helpers/link';
|
|
11
11
|
import withMapping from '../../Context/withMapping';
|
|
12
12
|
import './style.scss';
|
|
13
13
|
export var Button = function Button(_ref) {
|
|
@@ -54,15 +54,29 @@ export var Button = function Button(_ref) {
|
|
|
54
54
|
}), children)
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
if (isExternalLink(href)) {
|
|
58
|
+
return /*#__PURE__*/React.createElement("a", _extends({
|
|
59
|
+
className: classes,
|
|
60
|
+
href: href,
|
|
61
|
+
target: "_blank",
|
|
62
|
+
rel: "noreferrer noopener"
|
|
63
|
+
}, props, {
|
|
64
|
+
ref: forwardRef,
|
|
65
|
+
onClick: onClick
|
|
66
|
+
}), children);
|
|
67
|
+
}
|
|
68
|
+
if (isHashLink(href)) {
|
|
69
|
+
return /*#__PURE__*/React.createElement("a", _extends({
|
|
70
|
+
className: classes,
|
|
71
|
+
href: href,
|
|
72
|
+
target: target,
|
|
73
|
+
rel: "noreferrer noopener"
|
|
74
|
+
}, props, {
|
|
75
|
+
ref: forwardRef,
|
|
76
|
+
onClick: onClick
|
|
77
|
+
}), children);
|
|
78
|
+
}
|
|
79
|
+
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
66
80
|
to: href,
|
|
67
81
|
className: classes,
|
|
68
82
|
target: target
|
package/dist/helpers/link.d.ts
CHANGED
package/dist/helpers/link.js
CHANGED
|
@@ -7,6 +7,14 @@ export function isExternalLink() {
|
|
|
7
7
|
}
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
|
+
export function isHashLink() {
|
|
11
|
+
var uri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
12
|
+
var value = uri.trim().replace(/\/$/, '');
|
|
13
|
+
if (/^#/g.test(value)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
10
18
|
export function normalizeLink(link) {
|
|
11
19
|
var API_URL = config.get('API_URL');
|
|
12
20
|
if (/^\//g.test(link)) {
|