@thecb/components 11.10.1-beta.0 → 11.10.1-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.10.1-beta.0",
3
+ "version": "11.10.1-beta.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -10,11 +10,11 @@ import { TOOLTIP_THEME_SOURCE, fallbackValues } from "./Tooltip.theme";
10
10
  const Tooltip = ({
11
11
  tooltipID,
12
12
  children,
13
+ hasCustomTrigger = false,
13
14
  triggerText = "",
14
15
  containerExtraStyles = "",
15
16
  triggerButtonVariant = "smallGhost",
16
17
  content = "",
17
- contentBackgroundColor = fallbackValues.borderColor,
18
18
  contentExtraStyles = "",
19
19
  minWidth = "250px",
20
20
  maxWidth = "100%",
@@ -31,7 +31,8 @@ const Tooltip = ({
31
31
  arrowRight: "10px",
32
32
  arrowBottom: "-8px",
33
33
  arrowLeft: "auto"
34
- }
34
+ },
35
+ arrowColor
35
36
  }) => {
36
37
  const closeTimeoutRef = useRef(null);
37
38
  const [tooltipOpen, setTooltipOpen] = useState(false);
@@ -80,7 +81,7 @@ const Tooltip = ({
80
81
  }, []);
81
82
 
82
83
  const renderTrigger = () => {
83
- if (children) {
84
+ if (hasCustomTrigger && children) {
84
85
  return React.cloneElement(React.Children.only(children), {
85
86
  "aria-describedby": tooltipID,
86
87
  onFocus: () => handleToggleTooltip(true),
@@ -103,7 +104,7 @@ const Tooltip = ({
103
104
  extraStyles={`
104
105
  color: ${themeValues.linkColor};
105
106
  &:hover { color: ${themeValues.hoverColor}; text-decoration: none;}
106
- &:active, &:focus { color: ${themeValues.activeColor}; text-decoration: none;}
107
+ &:active, &:focus { color: ${themeValues.activeColor};text-decoration: none;}
107
108
  button, span, &:hover span { text-decoration: none; }
108
109
  `}
109
110
  />
@@ -153,7 +154,11 @@ const Tooltip = ({
153
154
  content: "";
154
155
  width: 0;
155
156
  height: 0;
156
- ${arrowBorder(themeValues.borderColor, arrowDirection, "8px")};
157
+ ${arrowBorder(
158
+ arrowColor || themeValues.borderColor,
159
+ arrowDirection,
160
+ "8px"
161
+ )};
157
162
  filter: drop-shadow(2px 8px 14px black);
158
163
  bottom: ${arrowBottom};
159
164
  right: ${arrowRight};
@@ -1,5 +1,9 @@
1
1
  import React from "react";
2
2
  import Tooltip from "./Tooltip";
3
+ import Text from "../../atoms/text/Text";
4
+ import AutopayOnIcon from "../../atoms/icons/AutopayOnIcon";
5
+ import Box from "../../atoms/layouts/Box";
6
+ import { SEA_GREEN } from "../../../constants/colors";
3
7
 
4
8
  const meta = {
5
9
  title: "Molecules/Tooltip",
@@ -165,6 +169,7 @@ export const Basic = {
165
169
  export const WithChildren = {
166
170
  args: {
167
171
  tooltipID: "tooltip-children",
172
+ hasCustomTrigger: true,
168
173
  content: "Extra information about this label.",
169
174
  contentPosition: {
170
175
  top: "-84px",
@@ -175,7 +180,15 @@ export const WithChildren = {
175
180
  },
176
181
  render: args => (
177
182
  <Tooltip {...args}>
178
- <button type="button">Custom trigger</button>
183
+ <Box padding="0" extraStyles="white-space: nowrap;">
184
+ <AutopayOnIcon />
185
+ <Text
186
+ color={SEA_GREEN}
187
+ extraStyles="margin-left: 5px; white-space: nowrap;"
188
+ >
189
+ Custom trigger
190
+ </Text>
191
+ </Box>
179
192
  </Tooltip>
180
193
  )
181
194
  };
@@ -183,8 +196,9 @@ export const WithChildren = {
183
196
  export const RichTooltipContent = {
184
197
  args: {
185
198
  tooltipID: "tooltip-node-content",
186
- contentBackgroundColor: "#ffffff",
199
+ contentExtraStyles: "background-color: #000000; color: #ffffff;",
187
200
  triggerText: "Rich content",
201
+ arrowColor: "black",
188
202
  contentPosition: {
189
203
  top: "-126px",
190
204
  right: "auto",