@thecb/components 11.10.1-beta.2 → 11.11.0-beta.0
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 +23 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +23 -14
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/form-layouts/FormInput.js +1 -1
- package/src/components/molecules/tooltip/Tooltip.js +30 -19
- package/src/components/molecules/tooltip/Tooltip.theme.js +0 -2
package/package.json
CHANGED
|
@@ -148,7 +148,7 @@ const FormInput = ({
|
|
|
148
148
|
<Stack childGap="0.25rem">
|
|
149
149
|
<Box padding="0">
|
|
150
150
|
{helperModal ? (
|
|
151
|
-
<Cluster justify="space-between" align="center">
|
|
151
|
+
<Cluster justify="space-between" align="center" overflow>
|
|
152
152
|
{labelDisplayOverride ? (
|
|
153
153
|
labelDisplayOverride
|
|
154
154
|
) : (
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { createThemeValues } from "../../../util/themeUtils";
|
|
2
|
+
import { createThemeValues, themeComponent } from "../../../util/themeUtils";
|
|
3
3
|
import { ThemeContext } from "styled-components";
|
|
4
4
|
import Text from "../../atoms/text";
|
|
5
5
|
import { Box } from "../../atoms/layouts";
|
|
6
6
|
import ButtonWithAction from "../../atoms/button-with-action";
|
|
7
7
|
import { noop, arrowBorder } from "../../../util/general";
|
|
8
|
-
import {
|
|
8
|
+
import { fallbackValues } from "./Tooltip.theme";
|
|
9
9
|
|
|
10
10
|
const Tooltip = ({
|
|
11
11
|
tooltipID,
|
|
@@ -19,18 +19,19 @@ const Tooltip = ({
|
|
|
19
19
|
minWidth = "250px",
|
|
20
20
|
maxWidth = "100%",
|
|
21
21
|
height = "auto",
|
|
22
|
+
arrowDirection = "down",
|
|
22
23
|
contentPosition = {
|
|
23
|
-
top: "
|
|
24
|
+
top: "auto",
|
|
24
25
|
right: "auto",
|
|
25
|
-
bottom: "
|
|
26
|
-
left: "
|
|
26
|
+
bottom: "calc(100% + 8px)", // always sits above the trigger + 8px gap for arrow
|
|
27
|
+
left: "50%", // anchors to horizontal center of trigger
|
|
28
|
+
transform: "translateX(-50%)" // shifts left by half tooltip's own width → centered
|
|
27
29
|
},
|
|
28
|
-
arrowDirection = "down",
|
|
29
30
|
arrowPosition = {
|
|
30
31
|
arrowTop: "auto",
|
|
31
|
-
arrowRight: "
|
|
32
|
+
arrowRight: "auto",
|
|
32
33
|
arrowBottom: "-8px",
|
|
33
|
-
arrowLeft: "
|
|
34
|
+
arrowLeft: "calc(50% - 8px)" // centers the 0-width arrow element (16px wide border)
|
|
34
35
|
},
|
|
35
36
|
arrowColor
|
|
36
37
|
}) => {
|
|
@@ -40,7 +41,7 @@ const Tooltip = ({
|
|
|
40
41
|
const themeValues = createThemeValues(
|
|
41
42
|
themeContext,
|
|
42
43
|
fallbackValues,
|
|
43
|
-
|
|
44
|
+
"Tooltip"
|
|
44
45
|
);
|
|
45
46
|
|
|
46
47
|
const { top, right, bottom, left } = contentPosition;
|
|
@@ -82,12 +83,21 @@ const Tooltip = ({
|
|
|
82
83
|
|
|
83
84
|
const renderTrigger = () => {
|
|
84
85
|
if (hasCustomTrigger && children) {
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
return (
|
|
87
|
+
<Box
|
|
88
|
+
padding="0"
|
|
89
|
+
extraStyles="cursor: pointer;"
|
|
90
|
+
tabIndex="0"
|
|
91
|
+
role="button"
|
|
92
|
+
data-qa={`tooltip-trigger-${tooltipID}`}
|
|
93
|
+
aria-describedby={tooltipID}
|
|
94
|
+
onFocus={() => handleToggleTooltip(true)}
|
|
95
|
+
onBlur={() => handleToggleTooltip(false)}
|
|
96
|
+
onKeyDown={handleKeyDown}
|
|
97
|
+
>
|
|
98
|
+
{children}
|
|
99
|
+
</Box>
|
|
100
|
+
);
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
return (
|
|
@@ -103,9 +113,10 @@ const Tooltip = ({
|
|
|
103
113
|
text={triggerText}
|
|
104
114
|
extraStyles={`
|
|
105
115
|
color: ${themeValues.linkColor};
|
|
106
|
-
|
|
107
|
-
&:
|
|
108
|
-
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
&:hover { color: ${themeValues.hoverColor}; text-decoration: none; }
|
|
118
|
+
&:active, &:focus { color: ${themeValues.activeColor}; text-decoration: none; }
|
|
119
|
+
button, span, &:hover span { text-decoration: none; }
|
|
109
120
|
`}
|
|
110
121
|
/>
|
|
111
122
|
);
|
|
@@ -171,4 +182,4 @@ const Tooltip = ({
|
|
|
171
182
|
);
|
|
172
183
|
};
|
|
173
184
|
|
|
174
|
-
export default Tooltip;
|
|
185
|
+
export default themeComponent(Tooltip, "Tooltip", fallbackValues);
|