@thecb/components 9.2.4-beta.3 → 9.2.4-beta.5
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 +4 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +4 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/radio-section/RadioSection.js +135 -124
- package/src/components/molecules/radio-section/RadioSection.stories.js +6 -1
package/package.json
CHANGED
|
@@ -106,139 +106,150 @@ const RadioSection = ({
|
|
|
106
106
|
borderRadius="4px"
|
|
107
107
|
extraStyles={containerStyles}
|
|
108
108
|
>
|
|
109
|
-
<Stack childGap="0" role="radiogroup" required={isRequired}>
|
|
109
|
+
<Stack childGap="0" role="radiogroup" required={isRequired} id="cristin">
|
|
110
110
|
{sections
|
|
111
111
|
.filter(section => !section.hidden)
|
|
112
|
-
.map(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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"
|
|
112
|
+
.map(
|
|
113
|
+
section =>
|
|
114
|
+
console.log("section", section) || (
|
|
115
|
+
<Motion
|
|
116
|
+
tabIndex={
|
|
117
|
+
section.hideRadioButton || section.disabled ? "-1" : "0"
|
|
134
118
|
}
|
|
135
|
-
|
|
136
|
-
section.disabled
|
|
137
|
-
? themeValues.headingDisabledColor
|
|
138
|
-
: themeValues.headingBackgroundColor
|
|
119
|
+
onKeyDown={e =>
|
|
120
|
+
!section.disabled && handleKeyDown(section.id, e)
|
|
139
121
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
122
|
+
onFocus={() => !section.disabled && setFocused(section.id)}
|
|
123
|
+
onBlur={() => !section.disabled && setFocused(null)}
|
|
124
|
+
hoverStyles={themeValues.focusStyles}
|
|
125
|
+
animate={openSection === section.id ? "open" : "closed"}
|
|
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)
|
|
144
133
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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}
|
|
134
|
+
aria-checked={openSection === section.id}
|
|
135
|
+
aria-disabled={section.disabled}
|
|
136
|
+
required={section?.required}
|
|
160
137
|
>
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
htmlFor={`radio-input-${idString(section)}`}
|
|
193
|
-
color={CHARADE_GREY}
|
|
194
|
-
>
|
|
195
|
-
{section.title}
|
|
196
|
-
</Text>
|
|
197
|
-
</Box>
|
|
198
|
-
</Cluster>
|
|
199
|
-
{section.rightIcons && (
|
|
138
|
+
<Stack childGap="0">
|
|
139
|
+
<Box
|
|
140
|
+
padding={
|
|
141
|
+
section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem"
|
|
142
|
+
}
|
|
143
|
+
background={
|
|
144
|
+
section.disabled
|
|
145
|
+
? themeValues.headingDisabledColor
|
|
146
|
+
: themeValues.headingBackgroundColor
|
|
147
|
+
}
|
|
148
|
+
onClick={
|
|
149
|
+
(isMobile && supportsTouch) || section.disabled
|
|
150
|
+
? noop
|
|
151
|
+
: () => toggleOpenSection(section.id)
|
|
152
|
+
}
|
|
153
|
+
onTouchEnd={
|
|
154
|
+
isMobile && supportsTouch && !section.disabled
|
|
155
|
+
? () => toggleOpenSection(section.id)
|
|
156
|
+
: noop
|
|
157
|
+
}
|
|
158
|
+
key={`header-${section.id}`}
|
|
159
|
+
borderSize="0px"
|
|
160
|
+
borderColor={themeValues.borderColor}
|
|
161
|
+
borderWidthOverride={
|
|
162
|
+
openSection === section.id && !!section.content
|
|
163
|
+
? `0px 0px 1px 0px`
|
|
164
|
+
: ``
|
|
165
|
+
}
|
|
166
|
+
extraStyles={!section.disabled ? "cursor: pointer;" : ""}
|
|
167
|
+
dataQa={section.dataQa ? section.dataQa : section.id}
|
|
168
|
+
>
|
|
200
169
|
<Cluster
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
170
|
+
justify="space-between"
|
|
171
|
+
align="center"
|
|
172
|
+
childGap="1px"
|
|
173
|
+
nowrap
|
|
204
174
|
>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
175
|
+
<Cluster justify="flex-start" align="center" nowrap>
|
|
176
|
+
{!section.hideRadioButton && (
|
|
177
|
+
<Box padding="0">
|
|
178
|
+
<RadioButton
|
|
179
|
+
id={`radio-input-${idString(section)}`}
|
|
180
|
+
name={idString(section)}
|
|
181
|
+
ariaDescribedBy={ariaDescribedBy}
|
|
182
|
+
radioOn={openSection === section.id}
|
|
183
|
+
radioFocused={focused === section.id}
|
|
184
|
+
toggleRadio={
|
|
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
|
+
)}
|
|
215
230
|
</Cluster>
|
|
216
|
-
|
|
217
|
-
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
</AnimatePresence>
|
|
239
|
-
</Stack>
|
|
240
|
-
</Motion>
|
|
241
|
-
))}
|
|
231
|
+
</Box>
|
|
232
|
+
<AnimatePresence initial={false}>
|
|
233
|
+
{openSection === section.id && (
|
|
234
|
+
<Motion
|
|
235
|
+
key={`content-${section.id}`}
|
|
236
|
+
padding="0"
|
|
237
|
+
background={themeValues.bodyBackgroundColor}
|
|
238
|
+
layoutTransition
|
|
239
|
+
initial="closed"
|
|
240
|
+
animate="open"
|
|
241
|
+
exit="closed"
|
|
242
|
+
variants={wrapper}
|
|
243
|
+
extraStyles={`transform-origin: 100% 0;`}
|
|
244
|
+
>
|
|
245
|
+
{section.content}
|
|
246
|
+
</Motion>
|
|
247
|
+
)}
|
|
248
|
+
</AnimatePresence>
|
|
249
|
+
</Stack>
|
|
250
|
+
</Motion>
|
|
251
|
+
)
|
|
252
|
+
)}
|
|
242
253
|
</Stack>
|
|
243
254
|
</Box>
|
|
244
255
|
);
|
|
@@ -52,7 +52,12 @@ const sections = [
|
|
|
52
52
|
rightIcons: cardIcons,
|
|
53
53
|
required: true
|
|
54
54
|
},
|
|
55
|
-
{
|
|
55
|
+
{
|
|
56
|
+
id: "new-bank-account-section",
|
|
57
|
+
title: "New Bank Account",
|
|
58
|
+
content: <div>Content 1</div>,
|
|
59
|
+
required: true
|
|
60
|
+
},
|
|
56
61
|
{ id: "baz", title: "Baz", content: <div>Content 2</div> }
|
|
57
62
|
];
|
|
58
63
|
|