@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
- return isExternalLink(href) ? /*#__PURE__*/React.createElement("a", _extends({
58
- className: classes,
59
- href: href,
60
- target: "_blank",
61
- rel: "noreferrer noopener"
62
- }, props, {
63
- ref: forwardRef,
64
- onClick: onClick
65
- }), children) : /*#__PURE__*/React.createElement(Link, _extends({
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,2 +1,3 @@
1
1
  export function isExternalLink(uri?: string): boolean;
2
+ export function isHashLink(uri?: string): boolean;
2
3
  export function normalizeLink(link: any): any;
@@ -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)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.14.2",
3
+ "version": "2.14.3",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",