@thecb/components 11.0.1 → 11.0.2-beta.1
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 +227 -1003
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +227 -1003
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/link/ExternalLink.d.ts +1 -0
- package/src/components/atoms/link/ExternalLink.js +33 -19
- package/src/components/atoms/link/Link.stories.js +8 -0
- package/src/components/molecules/modal/ModalControlV1.js +1 -0
package/package.json
CHANGED
|
Binary file
|
|
@@ -5,6 +5,7 @@ import { createThemeValues } from "../../../util/themeUtils";
|
|
|
5
5
|
import { StyledExternalLink } from "./ExternalLink.styled";
|
|
6
6
|
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
7
7
|
import { safeChildren } from "../../../util/general";
|
|
8
|
+
import { Box } from "../layouts";
|
|
8
9
|
|
|
9
10
|
const ExternalLink = forwardRef(
|
|
10
11
|
(
|
|
@@ -16,6 +17,7 @@ const ExternalLink = forwardRef(
|
|
|
16
17
|
weight = FONT_WEIGHT_REGULAR,
|
|
17
18
|
extraStyles = ``,
|
|
18
19
|
variant = "primary",
|
|
20
|
+
containerTabIndex = "-1",
|
|
19
21
|
tabIndex = "0",
|
|
20
22
|
dataQa,
|
|
21
23
|
ariaLabel,
|
|
@@ -30,27 +32,39 @@ const ExternalLink = forwardRef(
|
|
|
30
32
|
"Link",
|
|
31
33
|
variant
|
|
32
34
|
);
|
|
35
|
+
const handleKeyDown = event => {
|
|
36
|
+
// This is to address an issue on Safari where the link's tab order and Enter key were not being recognized
|
|
37
|
+
if (event.key === "Enter" || event.keyCode === 13) {
|
|
38
|
+
if (newTab) {
|
|
39
|
+
window.open(href, "_blank");
|
|
40
|
+
} else {
|
|
41
|
+
window.location.href = href;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
33
45
|
|
|
34
46
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
<Box padding="0" tabIndex={containerTabIndex} onKeyDown={handleKeyDown}>
|
|
48
|
+
<StyledExternalLink
|
|
49
|
+
href={href}
|
|
50
|
+
target={newTab ? "_blank" : ""}
|
|
51
|
+
color={themeValues.externalLinkColor}
|
|
52
|
+
size={size}
|
|
53
|
+
lineheight={lineHeight}
|
|
54
|
+
weight={weight}
|
|
55
|
+
hovercolor={themeValues.hoverColor}
|
|
56
|
+
activeColor={themeValues.activeColor}
|
|
57
|
+
fontFamily={themeValues.fontFamily}
|
|
58
|
+
tabIndex={tabIndex}
|
|
59
|
+
extrastyles={extraStyles}
|
|
60
|
+
rel={newTab ? "noopener" : ""}
|
|
61
|
+
data-qa={dataQa}
|
|
62
|
+
aria-label={ariaLabel}
|
|
63
|
+
ref={ref}
|
|
64
|
+
>
|
|
65
|
+
{safeChildren(children, <span />)}
|
|
66
|
+
</StyledExternalLink>
|
|
67
|
+
</Box>
|
|
54
68
|
);
|
|
55
69
|
}
|
|
56
70
|
);
|
|
@@ -20,6 +20,7 @@ const meta = {
|
|
|
20
20
|
fontWeight: undefined,
|
|
21
21
|
fontSize: undefined,
|
|
22
22
|
margin: undefined,
|
|
23
|
+
containerTabIndex: undefined,
|
|
23
24
|
tabIndex: undefined,
|
|
24
25
|
extraStyles: undefined,
|
|
25
26
|
dataQa: undefined,
|
|
@@ -100,6 +101,13 @@ const meta = {
|
|
|
100
101
|
defaultValue: { summary: undefined }
|
|
101
102
|
}
|
|
102
103
|
},
|
|
104
|
+
containerTabIndex: {
|
|
105
|
+
description: "Override for tab index value for link's container",
|
|
106
|
+
table: {
|
|
107
|
+
type: { summary: "string" },
|
|
108
|
+
defaultValue: { summary: undefined }
|
|
109
|
+
}
|
|
110
|
+
},
|
|
103
111
|
tabIndex: {
|
|
104
112
|
description: "Override for tab index value for link",
|
|
105
113
|
table: {
|