@uncinc/uncinc-react-kitchen-sink 2.14.1 → 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
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
name:
|
|
5
|
-
|
|
6
|
-
}): React.JSX.Element;
|
|
7
|
-
declare namespace Icon {
|
|
8
|
-
namespace defaultProps {
|
|
9
|
-
let flair: string;
|
|
10
|
-
let className: string;
|
|
11
|
-
}
|
|
12
|
-
namespace propTypes {
|
|
13
|
-
export let name: PropTypes.Validator<string>;
|
|
14
|
-
let flair_1: PropTypes.Requireable<string>;
|
|
15
|
-
export { flair_1 as flair };
|
|
16
|
-
let className_1: PropTypes.Requireable<string>;
|
|
17
|
-
export { className_1 as className };
|
|
18
|
-
}
|
|
1
|
+
import React, { type HTMLAttributes } from 'react';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
interface IconProps extends React.HTMLProps<HTMLAttributes<HTMLDivElement>> {
|
|
4
|
+
name: string;
|
|
5
|
+
flair?: string;
|
|
19
6
|
}
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
declare const Icon: React.FC<IconProps>;
|
|
8
|
+
export default Icon;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import c from 'classnames';
|
|
4
3
|
import './style.scss';
|
|
5
4
|
var Icon = function Icon(_ref) {
|
|
6
|
-
var
|
|
5
|
+
var name = _ref.name,
|
|
6
|
+
_ref$flair = _ref.flair,
|
|
7
7
|
flair = _ref$flair === void 0 ? '' : _ref$flair,
|
|
8
|
-
name = _ref.name,
|
|
9
8
|
className = _ref.className;
|
|
10
9
|
var flairPostFix = flair && flair.length > 0 ? '-' : '';
|
|
11
10
|
var classNames = c('Icon', "Icon-".concat(flair).concat(flairPostFix).concat(name), className);
|
|
@@ -13,13 +12,4 @@ var Icon = function Icon(_ref) {
|
|
|
13
12
|
className: classNames
|
|
14
13
|
});
|
|
15
14
|
};
|
|
16
|
-
Icon.defaultProps = {
|
|
17
|
-
flair: '',
|
|
18
|
-
className: ''
|
|
19
|
-
};
|
|
20
|
-
Icon.propTypes = {
|
|
21
|
-
name: PropTypes.string.isRequired,
|
|
22
|
-
flair: PropTypes.string,
|
|
23
|
-
className: PropTypes.string
|
|
24
|
-
};
|
|
25
15
|
export default Icon;
|
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)) {
|