@thecb/components 8.3.1-beta.7 → 8.3.1-beta.9
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/dist/index.cjs.js +8 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +9 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/button-with-link/ButtonWithLink.js +4 -3
- package/src/components/atoms/link/InternalLink.styled.js +1 -1
- /package/src/components/atoms/icons/{ExternalLinkicon.js → ExternalLinkIcon.js} +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { createContext, createElement, PureComponent, forwardRef, Component, cloneElement, Children, useContext, Fragment as Fragment$1, useRef, useState, useLayoutEffect, memo, useEffect as useEffect$1, useMemo, useCallback, isValidElement, createRef } from 'react';
|
|
2
2
|
import styled, { ThemeContext, css, ThemeProvider, keyframes as keyframes$3 } from 'styled-components';
|
|
3
3
|
import theme from 'styled-theming';
|
|
4
|
-
import { Link,
|
|
4
|
+
import { Link, useNavigate, useLocation } from 'react-router-dom';
|
|
5
5
|
import reactDom from 'react-dom';
|
|
6
6
|
|
|
7
7
|
function ownKeys(object, enumerableOnly) {
|
|
@@ -19845,8 +19845,8 @@ var StyledInternalLink = styled( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
19845
19845
|
var margin = _ref7.margin;
|
|
19846
19846
|
return margin;
|
|
19847
19847
|
}, function (_ref8) {
|
|
19848
|
-
var
|
|
19849
|
-
return
|
|
19848
|
+
var matchesCurrentRoute = _ref8.matchesCurrentRoute;
|
|
19849
|
+
return matchesCurrentRoute ? INFO_BLUE : 'transparent';
|
|
19850
19850
|
}, function (_ref9) {
|
|
19851
19851
|
var hoverColor = _ref9.hoverColor;
|
|
19852
19852
|
return hoverColor;
|
|
@@ -21505,11 +21505,13 @@ _curry2(function test(pattern, str) {
|
|
|
21505
21505
|
|
|
21506
21506
|
var URL_TEST = /(([a-z]{3,6}:\/\/)|(^|\s))([a-zA-Z0-9\-]+\.)+[a-z]{2,13}[\.\?\=\&\%\/\w\-]*\b([^@]|$)/;
|
|
21507
21507
|
|
|
21508
|
-
var _excluded$m = ["url", "disabled", "fileLink", "extraStyles", "linkExtraStyles", "newTab", "dataQa"];
|
|
21508
|
+
var _excluded$m = ["url", "matchesCurrentRoute", "disabled", "fileLink", "extraStyles", "linkExtraStyles", "newTab", "dataQa"];
|
|
21509
21509
|
|
|
21510
21510
|
var ButtonWithLink = function ButtonWithLink(_ref) {
|
|
21511
21511
|
var _ref$url = _ref.url,
|
|
21512
21512
|
url = _ref$url === void 0 ? "/" : _ref$url,
|
|
21513
|
+
_ref$matchesCurrentRo = _ref.matchesCurrentRoute,
|
|
21514
|
+
matchesCurrentRoute = _ref$matchesCurrentRo === void 0 ? false : _ref$matchesCurrentRo,
|
|
21513
21515
|
_ref$disabled = _ref.disabled,
|
|
21514
21516
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
21515
21517
|
_ref$fileLink = _ref.fileLink,
|
|
@@ -21524,12 +21526,11 @@ var ButtonWithLink = function ButtonWithLink(_ref) {
|
|
|
21524
21526
|
var ButtonWithLinkWrapper = function ButtonWithLinkWrapper(_ref2) {
|
|
21525
21527
|
var children = _ref2.children,
|
|
21526
21528
|
url = _ref2.url,
|
|
21529
|
+
matchesCurrentRoute = _ref2.matchesCurrentRoute,
|
|
21527
21530
|
disabled = _ref2.disabled,
|
|
21528
21531
|
newTab = _ref2.newTab,
|
|
21529
21532
|
dataQa = _ref2.dataQa,
|
|
21530
21533
|
extraStyles = _ref2.extraStyles;
|
|
21531
|
-
var match = useMatch(url);
|
|
21532
|
-
console.log("🚀 ~ file: ButtonWithLink.js:32 ~ match:", match);
|
|
21533
21534
|
|
|
21534
21535
|
if (disabled) {
|
|
21535
21536
|
return safeChildren(children, /*#__PURE__*/React.createElement("span", null));
|
|
@@ -21543,7 +21544,7 @@ var ButtonWithLink = function ButtonWithLink(_ref) {
|
|
|
21543
21544
|
dataQa: dataQa
|
|
21544
21545
|
}, safeChildren(children, /*#__PURE__*/React.createElement("span", null))) : /*#__PURE__*/React.createElement(InternalLink, {
|
|
21545
21546
|
to: url,
|
|
21546
|
-
|
|
21547
|
+
matchesCurrentRoute: matchesCurrentRoute,
|
|
21547
21548
|
tabIndex: "-1",
|
|
21548
21549
|
dataQa: dataQa,
|
|
21549
21550
|
extraStyles: extraStyles
|
|
@@ -21551,6 +21552,7 @@ var ButtonWithLink = function ButtonWithLink(_ref) {
|
|
|
21551
21552
|
};
|
|
21552
21553
|
|
|
21553
21554
|
return /*#__PURE__*/React.createElement(ButtonWithLinkWrapper, {
|
|
21555
|
+
matchesCurrentRoute: matchesCurrentRoute,
|
|
21554
21556
|
url: url,
|
|
21555
21557
|
disabled: disabled,
|
|
21556
21558
|
newTab: newTab,
|