@thecb/components 9.2.4-beta.5 → 9.2.4-beta.6
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 +50 -112
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +50 -112
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +1 -3
- package/src/components/atoms/checkbox/Checkbox.stories.js +2 -3
- package/src/components/atoms/country-dropdown/CountryDropdown.js +1 -3
- package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +0 -1
- package/src/components/atoms/dropdown/Dropdown.js +3 -7
- package/src/components/atoms/form-layouts/FormInput.js +0 -3
- package/src/components/atoms/form-select/FormSelect.js +9 -22
- package/src/components/atoms/form-select/FormSelect.stories.js +2 -2
- package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.js +7 -12
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +1 -4
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +0 -1
- package/src/components/molecules/address-form/AddressForm.js +0 -6
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +0 -6
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +0 -6
- package/src/components/molecules/radio-group/RadioGroup.js +2 -5
- package/src/components/molecules/radio-group/RadioGroup.stories.js +0 -1
- package/src/components/molecules/radio-section/RadioSection.js +125 -136
- package/src/components/molecules/radio-section/RadioSection.stories.js +2 -7
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +2 -3
|
@@ -48,7 +48,7 @@ const RadioSection = ({
|
|
|
48
48
|
openHeight = "auto",
|
|
49
49
|
containerStyles = "",
|
|
50
50
|
ariaDescribedBy,
|
|
51
|
-
|
|
51
|
+
isSectionRequired = false
|
|
52
52
|
}) => {
|
|
53
53
|
const handleKeyDown = (id, e) => {
|
|
54
54
|
if (e?.keyCode === 13 || e?.keyCode === 32) {
|
|
@@ -106,150 +106,139 @@ const RadioSection = ({
|
|
|
106
106
|
borderRadius="4px"
|
|
107
107
|
extraStyles={containerStyles}
|
|
108
108
|
>
|
|
109
|
-
<Stack childGap="0" role="radiogroup" required={
|
|
109
|
+
<Stack childGap="0" role="radiogroup" required={isSectionRequired}>
|
|
110
110
|
{sections
|
|
111
111
|
.filter(section => !section.hidden)
|
|
112
|
-
.map(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
.map(section => (
|
|
113
|
+
<Motion
|
|
114
|
+
tabIndex={
|
|
115
|
+
section.hideRadioButton || section.disabled ? "-1" : "0"
|
|
116
|
+
}
|
|
117
|
+
onKeyDown={e => !section.disabled && handleKeyDown(section.id, e)}
|
|
118
|
+
onFocus={() => !section.disabled && setFocused(section.id)}
|
|
119
|
+
onBlur={() => !section.disabled && setFocused(null)}
|
|
120
|
+
hoverStyles={themeValues.focusStyles}
|
|
121
|
+
animate={openSection === section.id ? "open" : "closed"}
|
|
122
|
+
initial={initiallyOpen ? "open" : "closed"}
|
|
123
|
+
key={`item-${section.id}`}
|
|
124
|
+
extraStyles={borderStyles}
|
|
125
|
+
role="radio"
|
|
126
|
+
aria-checked={openSection === section.id}
|
|
127
|
+
aria-disabled={section.disabled}
|
|
128
|
+
required={!!section?.required}
|
|
129
|
+
>
|
|
130
|
+
<Stack childGap="0">
|
|
131
|
+
<Box
|
|
132
|
+
padding={
|
|
133
|
+
section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem"
|
|
118
134
|
}
|
|
119
|
-
|
|
120
|
-
|
|
135
|
+
background={
|
|
136
|
+
section.disabled
|
|
137
|
+
? themeValues.headingDisabledColor
|
|
138
|
+
: themeValues.headingBackgroundColor
|
|
121
139
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
initial={initiallyOpen ? "open" : "closed"}
|
|
127
|
-
key={`item-${section.id}`}
|
|
128
|
-
extraStyles={borderStyles}
|
|
129
|
-
role="radio"
|
|
130
|
-
aria-label={
|
|
131
|
-
section.title ||
|
|
132
|
-
console.log("typeof section.title", typeof section.title)
|
|
140
|
+
onClick={
|
|
141
|
+
(isMobile && supportsTouch) || section.disabled
|
|
142
|
+
? noop
|
|
143
|
+
: () => toggleOpenSection(section.id)
|
|
133
144
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
145
|
+
onTouchEnd={
|
|
146
|
+
isMobile && supportsTouch && !section.disabled
|
|
147
|
+
? () => toggleOpenSection(section.id)
|
|
148
|
+
: noop
|
|
149
|
+
}
|
|
150
|
+
key={`header-${section.id}`}
|
|
151
|
+
borderSize="0px"
|
|
152
|
+
borderColor={themeValues.borderColor}
|
|
153
|
+
borderWidthOverride={
|
|
154
|
+
openSection === section.id && !!section.content
|
|
155
|
+
? `0px 0px 1px 0px`
|
|
156
|
+
: ``
|
|
157
|
+
}
|
|
158
|
+
extraStyles={!section.disabled ? "cursor: pointer;" : ""}
|
|
159
|
+
dataQa={section.dataQa ? section.dataQa : section.id}
|
|
137
160
|
>
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
<Cluster
|
|
162
|
+
justify="space-between"
|
|
163
|
+
align="center"
|
|
164
|
+
childGap="1px"
|
|
165
|
+
nowrap
|
|
166
|
+
>
|
|
167
|
+
<Cluster justify="flex-start" align="center" nowrap>
|
|
168
|
+
{!section.hideRadioButton && (
|
|
169
|
+
<Box padding="0">
|
|
170
|
+
<RadioButton
|
|
171
|
+
id={`radio-input-${idString(section)}`}
|
|
172
|
+
name={idString(section)}
|
|
173
|
+
ariaDescribedBy={ariaDescribedBy}
|
|
174
|
+
radioOn={openSection === section.id}
|
|
175
|
+
radioFocused={focused === section.id}
|
|
176
|
+
toggleRadio={
|
|
177
|
+
section.disabled
|
|
178
|
+
? noop
|
|
179
|
+
: () => toggleOpenSection(section.id)
|
|
180
|
+
}
|
|
181
|
+
tabIndex="-1"
|
|
182
|
+
isRequired={!!section?.required}
|
|
183
|
+
/>
|
|
184
|
+
</Box>
|
|
185
|
+
)}
|
|
186
|
+
{section.titleIcon && (
|
|
187
|
+
<Cluster align="center">{section.titleIcon}</Cluster>
|
|
188
|
+
)}
|
|
189
|
+
<Box padding={section.titleIcon ? "0 0 0 8px" : "0"}>
|
|
190
|
+
<Text
|
|
191
|
+
as="label"
|
|
192
|
+
htmlFor={`radio-input-${idString(section)}`}
|
|
193
|
+
color={CHARADE_GREY}
|
|
194
|
+
>
|
|
195
|
+
{section.title}
|
|
196
|
+
</Text>
|
|
197
|
+
</Box>
|
|
198
|
+
</Cluster>
|
|
199
|
+
{section.rightIcons && (
|
|
169
200
|
<Cluster
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
nowrap
|
|
201
|
+
childGap="0.5rem"
|
|
202
|
+
aria-label={section?.rightIconsLabel || null}
|
|
203
|
+
role={section?.rightIconsRole || null}
|
|
174
204
|
>
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
section.disabled
|
|
186
|
-
? noop
|
|
187
|
-
: () => toggleOpenSection(section.id)
|
|
188
|
-
}
|
|
189
|
-
tabIndex="-1"
|
|
190
|
-
required={section?.required}
|
|
191
|
-
/>
|
|
192
|
-
</Box>
|
|
193
|
-
)}
|
|
194
|
-
{section.titleIcon && (
|
|
195
|
-
<Cluster align="center">
|
|
196
|
-
{section.titleIcon}
|
|
197
|
-
</Cluster>
|
|
198
|
-
)}
|
|
199
|
-
<Box padding={section.titleIcon ? "0 0 0 8px" : "0"}>
|
|
200
|
-
<Text
|
|
201
|
-
as="label"
|
|
202
|
-
htmlFor={`radio-input-${idString(section)}`}
|
|
203
|
-
color={CHARADE_GREY}
|
|
204
|
-
>
|
|
205
|
-
{section.title}
|
|
206
|
-
</Text>
|
|
207
|
-
</Box>
|
|
208
|
-
</Cluster>
|
|
209
|
-
{section.rightIcons && (
|
|
210
|
-
<Cluster
|
|
211
|
-
childGap="0.5rem"
|
|
212
|
-
aria-label={section?.rightIconsLabel || null}
|
|
213
|
-
role={section?.rightIconsRole || null}
|
|
214
|
-
>
|
|
215
|
-
{section.rightIcons.map(icon => (
|
|
216
|
-
<RightIcon
|
|
217
|
-
src={icon.img}
|
|
218
|
-
key={icon.img}
|
|
219
|
-
fade={!icon.enabled}
|
|
220
|
-
isMobile={isMobile}
|
|
221
|
-
alt={icon.altText}
|
|
222
|
-
aria-disabled={!icon.enabled}
|
|
223
|
-
/>
|
|
224
|
-
))}
|
|
225
|
-
</Cluster>
|
|
226
|
-
)}
|
|
227
|
-
{section.rightTitleContent && (
|
|
228
|
-
<Fragment>{section.rightTitleContent}</Fragment>
|
|
229
|
-
)}
|
|
205
|
+
{section.rightIcons.map(icon => (
|
|
206
|
+
<RightIcon
|
|
207
|
+
src={icon.img}
|
|
208
|
+
key={icon.img}
|
|
209
|
+
fade={!icon.enabled}
|
|
210
|
+
isMobile={isMobile}
|
|
211
|
+
alt={icon.altText}
|
|
212
|
+
aria-disabled={!icon.enabled}
|
|
213
|
+
/>
|
|
214
|
+
))}
|
|
230
215
|
</Cluster>
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
{
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
216
|
+
)}
|
|
217
|
+
{section.rightTitleContent && (
|
|
218
|
+
<Fragment>{section.rightTitleContent}</Fragment>
|
|
219
|
+
)}
|
|
220
|
+
</Cluster>
|
|
221
|
+
</Box>
|
|
222
|
+
<AnimatePresence initial={false}>
|
|
223
|
+
{openSection === section.id && (
|
|
224
|
+
<Motion
|
|
225
|
+
key={`content-${section.id}`}
|
|
226
|
+
padding="0"
|
|
227
|
+
background={themeValues.bodyBackgroundColor}
|
|
228
|
+
layoutTransition
|
|
229
|
+
initial="closed"
|
|
230
|
+
animate="open"
|
|
231
|
+
exit="closed"
|
|
232
|
+
variants={wrapper}
|
|
233
|
+
extraStyles={`transform-origin: 100% 0;`}
|
|
234
|
+
>
|
|
235
|
+
{section.content}
|
|
236
|
+
</Motion>
|
|
237
|
+
)}
|
|
238
|
+
</AnimatePresence>
|
|
239
|
+
</Stack>
|
|
240
|
+
</Motion>
|
|
241
|
+
))}
|
|
253
242
|
</Stack>
|
|
254
243
|
</Box>
|
|
255
244
|
);
|
|
@@ -52,12 +52,7 @@ const sections = [
|
|
|
52
52
|
rightIcons: cardIcons,
|
|
53
53
|
required: true
|
|
54
54
|
},
|
|
55
|
-
{
|
|
56
|
-
id: "new-bank-account-section",
|
|
57
|
-
title: "New Bank Account",
|
|
58
|
-
content: <div>Content 1</div>,
|
|
59
|
-
required: true
|
|
60
|
-
},
|
|
55
|
+
{ id: "bar", title: "Bar", content: <div>Content 1</div>, required: true },
|
|
61
56
|
{ id: "baz", title: "Baz", content: <div>Content 2</div> }
|
|
62
57
|
];
|
|
63
58
|
|
|
@@ -71,7 +66,7 @@ export const radioSection = () => {
|
|
|
71
66
|
openSection={openSection}
|
|
72
67
|
staggeredAnimation={boolean("staggeredAnimation", false, "props")}
|
|
73
68
|
sections={sections}
|
|
74
|
-
|
|
69
|
+
isSectionRequired={true}
|
|
75
70
|
/>
|
|
76
71
|
);
|
|
77
72
|
};
|
|
@@ -20,7 +20,7 @@ const RadioButton = ({
|
|
|
20
20
|
themeValues,
|
|
21
21
|
ariaLabelledBy = "",
|
|
22
22
|
ariaLabel = null,
|
|
23
|
-
|
|
23
|
+
isRequired = false
|
|
24
24
|
}) => {
|
|
25
25
|
const buttonBorder = {
|
|
26
26
|
onFocused: {
|
|
@@ -91,11 +91,10 @@ const RadioButton = ({
|
|
|
91
91
|
type="radio"
|
|
92
92
|
id={`radio-${name}`}
|
|
93
93
|
disabled={disabled}
|
|
94
|
-
required={required}
|
|
95
|
-
aria-required={required}
|
|
96
94
|
onClick={toggleRadio}
|
|
97
95
|
aria-describedby={ariaDescribedBy}
|
|
98
96
|
tabIndex="-1"
|
|
97
|
+
required={isRequired}
|
|
99
98
|
{...extraProps}
|
|
100
99
|
/>
|
|
101
100
|
<Motion
|