@thecb/components 11.11.0-beta.1 → 11.11.0-beta.10
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/README.md +8 -4
- package/dist/index.cjs.js +237 -124
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +237 -124
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/card-type/CardType.js +10 -2
- package/src/components/atoms/form-layouts/FormInput.js +9 -16
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.js +2 -2
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.theme.js +2 -2
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +12 -9
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.theme.js +2 -2
- package/src/components/atoms/icons/AmExSmallIcon.js +2 -0
- package/src/components/atoms/icons/DiscoverSmallIcon.js +2 -0
- package/src/components/atoms/icons/GenericCardLarge.js +1 -1
- package/src/components/atoms/icons/GenericSmallIcon.js +2 -0
- package/src/components/atoms/icons/MasterCardSmallIcon.js +2 -0
- package/src/components/atoms/icons/VisaSmallIcon.js +2 -0
- package/src/components/molecules/editable-list/EditableList.js +3 -0
- package/src/components/molecules/email-form/EmailForm.js +2 -1
- package/src/components/molecules/email-form/EmailForm.stories.js +210 -0
- package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +2 -1
- package/src/components/molecules/login-form/LoginForm.js +2 -1
- package/src/components/molecules/radio-section/InnerRadioSection.js +3 -3
- package/src/components/molecules/radio-section/RadioSection.stories.js +142 -0
- package/src/components/molecules/registration-form/RegistrationForm.js +2 -1
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +1 -1
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +110 -0
- package/src/components/molecules/tooltip/Tooltip.js +163 -96
- package/src/components/molecules/tooltip/Tooltip.mdx +12 -2
- package/src/components/molecules/tooltip/Tooltip.stories.js +113 -63
- package/src/components/molecules/tooltip/Tooltip.theme.js +13 -4
- package/src/components/molecules/tooltip/index.d.ts +8 -8
- package/src/util/formats.js +6 -3
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Tooltip from "./Tooltip";
|
|
3
|
-
import
|
|
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, WHITE } from "../../../constants/colors";
|
|
4
7
|
|
|
5
8
|
const meta = {
|
|
6
9
|
title: "Molecules/Tooltip",
|
|
@@ -18,11 +21,8 @@ const meta = {
|
|
|
18
21
|
],
|
|
19
22
|
args: {
|
|
20
23
|
tooltipID: "tooltip-id",
|
|
21
|
-
hasIconTrigger: false,
|
|
22
|
-
IconTrigger: WarningIconXS,
|
|
23
|
-
iconHelpText: "Open the tooltip",
|
|
24
24
|
triggerText: "Hover me",
|
|
25
|
-
|
|
25
|
+
content: "This is the tooltip content.",
|
|
26
26
|
contentPosition: {
|
|
27
27
|
top: "-110px",
|
|
28
28
|
right: "auto",
|
|
@@ -40,71 +40,81 @@ const meta = {
|
|
|
40
40
|
maxWidth: "300px",
|
|
41
41
|
height: "auto",
|
|
42
42
|
containerExtraStyles: "",
|
|
43
|
-
triggerExtraStyles: "",
|
|
44
|
-
triggerButtonVariant: "smallGhost",
|
|
45
|
-
contentBackgroundColor: "",
|
|
46
43
|
contentExtraStyles: ""
|
|
47
44
|
},
|
|
48
45
|
argTypes: {
|
|
49
|
-
|
|
46
|
+
hasCustomTrigger: {
|
|
50
47
|
description:
|
|
51
|
-
"
|
|
48
|
+
"When true, the component uses the children prop as the trigger element instead of the default ButtonWithAction.",
|
|
49
|
+
control: { type: "boolean" },
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: "boolean" },
|
|
52
|
+
defaultValue: { summary: false }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
customTriggerRole: {
|
|
56
|
+
description:
|
|
57
|
+
"Role for the custom trigger element for accessibility purposes. Defaults to undefined.",
|
|
58
|
+
control: { type: "text" },
|
|
52
59
|
table: {
|
|
53
60
|
type: { summary: "string" },
|
|
54
61
|
defaultValue: { summary: undefined }
|
|
55
62
|
}
|
|
56
63
|
},
|
|
57
|
-
|
|
64
|
+
children: {
|
|
58
65
|
description:
|
|
59
|
-
"When
|
|
60
|
-
control: { type: "boolean" },
|
|
66
|
+
"Optional trigger element. When provided, it replaces the default ButtonWithAction trigger. The child element will receive aria-describedby, focus, blur, and keydown handlers.",
|
|
61
67
|
table: {
|
|
62
|
-
type: { summary: "
|
|
63
|
-
defaultValue: { summary:
|
|
68
|
+
type: { summary: "React.ReactNode" },
|
|
69
|
+
defaultValue: { summary: undefined }
|
|
64
70
|
}
|
|
65
71
|
},
|
|
66
|
-
|
|
72
|
+
content: {
|
|
67
73
|
description:
|
|
68
|
-
"
|
|
74
|
+
"The content displayed inside the tooltip. Can be a string or a React node/element.",
|
|
69
75
|
table: {
|
|
70
|
-
type: { summary: "React
|
|
71
|
-
defaultValue: { summary: "
|
|
76
|
+
type: { summary: "string | React.ReactNode" },
|
|
77
|
+
defaultValue: { summary: '""' }
|
|
72
78
|
}
|
|
73
79
|
},
|
|
74
|
-
|
|
75
|
-
description:
|
|
80
|
+
tooltipID: {
|
|
81
|
+
description:
|
|
82
|
+
"Unique ID for the tooltip content element. Used as the aria-describedby value on the trigger.",
|
|
76
83
|
table: {
|
|
77
84
|
type: { summary: "string" },
|
|
78
|
-
defaultValue: { summary:
|
|
85
|
+
defaultValue: { summary: undefined }
|
|
79
86
|
}
|
|
80
87
|
},
|
|
81
88
|
triggerText: {
|
|
82
89
|
description:
|
|
83
|
-
"Text
|
|
90
|
+
"Text shown in the default ButtonWithAction trigger. Not needed when children are provided.",
|
|
84
91
|
table: {
|
|
85
|
-
type: { summary: "string
|
|
86
|
-
defaultValue: { summary: "
|
|
92
|
+
type: { summary: "string" },
|
|
93
|
+
defaultValue: { summary: '""' }
|
|
87
94
|
}
|
|
88
95
|
},
|
|
89
|
-
|
|
90
|
-
description:
|
|
96
|
+
triggerButtonVariant: {
|
|
97
|
+
description:
|
|
98
|
+
"Variant passed to the default ButtonWithAction trigger. Has no effect when a custom trigger is used.",
|
|
91
99
|
table: {
|
|
92
100
|
type: { summary: "string" },
|
|
93
|
-
defaultValue: { summary: "
|
|
101
|
+
defaultValue: { summary: '"smallGhost"' }
|
|
94
102
|
}
|
|
95
103
|
},
|
|
96
104
|
contentPosition: {
|
|
97
105
|
description:
|
|
98
|
-
"CSS position values (top, right, bottom, left) for the tooltip content box relative to the trigger",
|
|
106
|
+
"CSS position values (top, right, bottom, left) for the tooltip content box relative to the trigger.",
|
|
99
107
|
table: {
|
|
100
108
|
type: { summary: "object" },
|
|
101
109
|
defaultValue: {
|
|
102
|
-
summary:
|
|
110
|
+
summary:
|
|
111
|
+
'{ top: "-110px", right: "auto", bottom: "auto", left: "-225px" }'
|
|
103
112
|
}
|
|
104
113
|
}
|
|
105
114
|
},
|
|
106
115
|
arrowDirection: {
|
|
107
|
-
description:
|
|
116
|
+
description:
|
|
117
|
+
"Direction the tooltip arrow points (up, down, left, right).",
|
|
108
118
|
control: { type: "select" },
|
|
109
119
|
options: ["up", "down", "left", "right"],
|
|
110
120
|
table: {
|
|
@@ -114,30 +124,31 @@ const meta = {
|
|
|
114
124
|
},
|
|
115
125
|
arrowPosition: {
|
|
116
126
|
description:
|
|
117
|
-
"CSS position values (arrowTop, arrowRight, arrowBottom, arrowLeft) for the arrow element",
|
|
127
|
+
"CSS position values (arrowTop, arrowRight, arrowBottom, arrowLeft) for the arrow element.",
|
|
118
128
|
table: {
|
|
119
129
|
type: { summary: "object" },
|
|
120
130
|
defaultValue: {
|
|
121
|
-
summary:
|
|
131
|
+
summary:
|
|
132
|
+
'{ arrowTop: "auto", arrowRight: "10px", arrowBottom: "-8px", arrowLeft: "auto" }'
|
|
122
133
|
}
|
|
123
134
|
}
|
|
124
135
|
},
|
|
125
136
|
minWidth: {
|
|
126
|
-
description: "Minimum width of the tooltip content box",
|
|
137
|
+
description: "Minimum width of the tooltip content box.",
|
|
127
138
|
table: {
|
|
128
139
|
type: { summary: "string" },
|
|
129
140
|
defaultValue: { summary: "250px" }
|
|
130
141
|
}
|
|
131
142
|
},
|
|
132
143
|
maxWidth: {
|
|
133
|
-
description: "Maximum width of the tooltip content box",
|
|
144
|
+
description: "Maximum width of the tooltip content box.",
|
|
134
145
|
table: {
|
|
135
146
|
type: { summary: "string" },
|
|
136
|
-
defaultValue: { summary: "
|
|
147
|
+
defaultValue: { summary: "100%" }
|
|
137
148
|
}
|
|
138
149
|
},
|
|
139
150
|
height: {
|
|
140
|
-
description: "Height of the tooltip content box",
|
|
151
|
+
description: "Height of the tooltip content box.",
|
|
141
152
|
table: {
|
|
142
153
|
type: { summary: "string" },
|
|
143
154
|
defaultValue: { summary: "auto" }
|
|
@@ -145,25 +156,26 @@ const meta = {
|
|
|
145
156
|
},
|
|
146
157
|
containerExtraStyles: {
|
|
147
158
|
description:
|
|
148
|
-
"Additional CSS string applied to the tooltip container element",
|
|
159
|
+
"Additional CSS string applied to the tooltip container element.",
|
|
149
160
|
table: {
|
|
150
161
|
type: { summary: "string" },
|
|
151
162
|
defaultValue: { summary: '""' }
|
|
152
163
|
}
|
|
153
164
|
},
|
|
154
|
-
|
|
155
|
-
description:
|
|
165
|
+
contentExtraStyles: {
|
|
166
|
+
description:
|
|
167
|
+
"Additional CSS string applied to the tooltip content element.",
|
|
156
168
|
table: {
|
|
157
169
|
type: { summary: "string" },
|
|
158
170
|
defaultValue: { summary: '""' }
|
|
159
171
|
}
|
|
160
172
|
},
|
|
161
|
-
|
|
173
|
+
backgroundColor: {
|
|
162
174
|
description:
|
|
163
|
-
"
|
|
175
|
+
"Override backgroundColor for the tooltip arrow. Defaults to WHITE when not provided.",
|
|
164
176
|
table: {
|
|
165
177
|
type: { summary: "string" },
|
|
166
|
-
defaultValue: { summary:
|
|
178
|
+
defaultValue: { summary: WHITE }
|
|
167
179
|
}
|
|
168
180
|
}
|
|
169
181
|
}
|
|
@@ -174,15 +186,69 @@ export default meta;
|
|
|
174
186
|
export const Basic = {
|
|
175
187
|
args: {
|
|
176
188
|
tooltipID: "tooltip-basic",
|
|
177
|
-
triggerText: "
|
|
178
|
-
|
|
189
|
+
triggerText: "What is this?",
|
|
190
|
+
content:
|
|
179
191
|
"This is a detailed explanation of a feature or term that the user may need more context about."
|
|
180
192
|
}
|
|
181
193
|
};
|
|
182
194
|
|
|
195
|
+
export const WithChildren = {
|
|
196
|
+
args: {
|
|
197
|
+
tooltipID: "tooltip-children",
|
|
198
|
+
hasCustomTrigger: true,
|
|
199
|
+
content: "Extra information about this label.",
|
|
200
|
+
contentPosition: {
|
|
201
|
+
top: "-84px",
|
|
202
|
+
right: "auto",
|
|
203
|
+
bottom: "auto",
|
|
204
|
+
left: "-225px"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
render: args => (
|
|
208
|
+
<Tooltip {...args}>
|
|
209
|
+
<Box padding="0" extraStyles="white-space: nowrap;">
|
|
210
|
+
<AutopayOnIcon />
|
|
211
|
+
<Text
|
|
212
|
+
color={SEA_GREEN}
|
|
213
|
+
extraStyles="margin-left: 5px; white-space: nowrap;"
|
|
214
|
+
>
|
|
215
|
+
Custom trigger
|
|
216
|
+
</Text>
|
|
217
|
+
</Box>
|
|
218
|
+
</Tooltip>
|
|
219
|
+
)
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const RichTooltipContent = {
|
|
223
|
+
args: {
|
|
224
|
+
tooltipID: "tooltip-node-content",
|
|
225
|
+
contentExtraStyles: "background-color: #000000; color: #ffffff;",
|
|
226
|
+
triggerText: "Rich content",
|
|
227
|
+
backgroundColor: "black",
|
|
228
|
+
contentPosition: {
|
|
229
|
+
top: "-126px",
|
|
230
|
+
right: "auto",
|
|
231
|
+
bottom: "auto",
|
|
232
|
+
left: "-225px"
|
|
233
|
+
},
|
|
234
|
+
content: React.createElement("div", { style: { padding: "8px" } }, [
|
|
235
|
+
React.createElement("strong", null, "Bold title"),
|
|
236
|
+
React.createElement(
|
|
237
|
+
"p",
|
|
238
|
+
null,
|
|
239
|
+
"With ",
|
|
240
|
+
React.createElement("em", null, "an italic text detail"),
|
|
241
|
+
" below."
|
|
242
|
+
)
|
|
243
|
+
])
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
183
247
|
export const TooltipBelow = {
|
|
184
248
|
args: {
|
|
185
249
|
tooltipID: "tooltip-below",
|
|
250
|
+
triggerText: "Hover for info",
|
|
251
|
+
content: "This tooltip appears below the trigger.",
|
|
186
252
|
contentPosition: {
|
|
187
253
|
top: "50px",
|
|
188
254
|
right: "auto",
|
|
@@ -202,6 +268,8 @@ export const TooltipBelow = {
|
|
|
202
268
|
export const TooltipRight = {
|
|
203
269
|
args: {
|
|
204
270
|
tooltipID: "tooltip-right",
|
|
271
|
+
triggerText: "Hover for info",
|
|
272
|
+
content: "This tooltip appears to the right.",
|
|
205
273
|
contentPosition: {
|
|
206
274
|
top: "-40px",
|
|
207
275
|
right: "auto",
|
|
@@ -217,21 +285,3 @@ export const TooltipRight = {
|
|
|
217
285
|
}
|
|
218
286
|
}
|
|
219
287
|
};
|
|
220
|
-
|
|
221
|
-
export const CustomContent = {
|
|
222
|
-
args: {
|
|
223
|
-
tooltipID: "tooltip-custom-content",
|
|
224
|
-
triggerText: "What is this?",
|
|
225
|
-
tooltipContent:
|
|
226
|
-
"This is a detailed explanation of a feature or term that the user may need more context about."
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
export const CustomWidth = {
|
|
231
|
-
args: {
|
|
232
|
-
tooltipID: "tooltip-custom-width",
|
|
233
|
-
minWidth: "150px",
|
|
234
|
-
maxWidth: "200px",
|
|
235
|
-
tooltipContent: "A narrower tooltip."
|
|
236
|
-
}
|
|
237
|
-
};
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
ROYAL_BLUE_VIVID,
|
|
3
|
+
ROYAL_BLUE,
|
|
4
|
+
CONGRESS_BLUE,
|
|
5
|
+
CHARADE_GREY
|
|
6
|
+
} from "../../../constants/colors";
|
|
7
|
+
|
|
8
|
+
const hoverColor = ROYAL_BLUE;
|
|
9
|
+
const activeColor = CONGRESS_BLUE;
|
|
10
|
+
const linkColor = ROYAL_BLUE_VIVID;
|
|
11
|
+
const textColor = CHARADE_GREY;
|
|
4
12
|
|
|
5
13
|
export const fallbackValues = {
|
|
14
|
+
linkColor,
|
|
6
15
|
hoverColor,
|
|
7
16
|
activeColor,
|
|
8
|
-
|
|
17
|
+
textColor
|
|
9
18
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Expand from "../../../util/expand";
|
|
3
|
+
|
|
3
4
|
export interface TooltipProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
content: React.ReactNode;
|
|
4
7
|
tooltipID: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
triggerText?: string | JSX.Element;
|
|
9
|
-
tooltipContent: string;
|
|
8
|
+
hasCustomTrigger?: boolean;
|
|
9
|
+
triggerText?: string;
|
|
10
|
+
triggerButtonVariant?: string;
|
|
10
11
|
contentPosition?: {
|
|
11
12
|
top: string;
|
|
12
13
|
right: string;
|
|
@@ -24,10 +25,9 @@ export interface TooltipProps {
|
|
|
24
25
|
maxWidth?: string;
|
|
25
26
|
height?: string;
|
|
26
27
|
containerExtraStyles?: string;
|
|
27
|
-
triggerExtraStyles?: string;
|
|
28
|
-
triggerButtonVariant?: string;
|
|
29
28
|
contentExtraStyles?: string;
|
|
30
|
-
|
|
29
|
+
backgroundColor?: string;
|
|
30
|
+
customTriggerRole?: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export const Tooltip: React.FC<Expand<TooltipProps> &
|
package/src/util/formats.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { createFormat } from "formatted-input";
|
|
3
3
|
import Text from "../components/atoms/text";
|
|
4
|
-
import { ASH_GREY, FIRE_YELLOW } from "../constants/colors";
|
|
4
|
+
import { ASH_GREY, FIRE_YELLOW, STORM_GREY } from "../constants/colors";
|
|
5
5
|
export const formatDelimiter = "_";
|
|
6
6
|
|
|
7
7
|
export const phoneFormats = [
|
|
@@ -101,7 +101,8 @@ export const renderCardStatus = (
|
|
|
101
101
|
<Text
|
|
102
102
|
as={as}
|
|
103
103
|
variant="pXS"
|
|
104
|
-
|
|
104
|
+
fontSize=".75rem"
|
|
105
|
+
color={STORM_GREY}
|
|
105
106
|
extraStyles={`text-align: ${textAlign}; margin: ${textMargin};`}
|
|
106
107
|
>
|
|
107
108
|
Exp Date {expireDate}
|
|
@@ -112,6 +113,7 @@ export const renderCardStatus = (
|
|
|
112
113
|
<Text
|
|
113
114
|
as={as}
|
|
114
115
|
variant="pXS"
|
|
116
|
+
fontSize=".75rem"
|
|
115
117
|
color={FIRE_YELLOW}
|
|
116
118
|
extraStyles={`text-align: ${textAlign}; margin: ${textMargin};`}
|
|
117
119
|
>
|
|
@@ -123,7 +125,8 @@ export const renderCardStatus = (
|
|
|
123
125
|
<Text
|
|
124
126
|
as={as}
|
|
125
127
|
variant="pXS"
|
|
126
|
-
|
|
128
|
+
fontSize=".75rem"
|
|
129
|
+
color={STORM_GREY}
|
|
127
130
|
extraStyles={`text-align: ${textAlign}; margin: ${textMargin};`}
|
|
128
131
|
>
|
|
129
132
|
Expired
|