@thecb/components 9.6.0-beta.2 → 10.0.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 +3259 -3116
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +3259 -3117
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.js +2 -4
- package/src/components/atoms/icons/MultiCartIcon.d.ts +1 -0
- package/src/components/atoms/icons/MultiCartIcon.js +26 -0
- package/src/components/atoms/icons/icons.stories.js +3 -1
- package/src/components/atoms/icons/index.d.ts +1 -0
- package/src/components/atoms/icons/index.js +3 -1
- package/src/components/atoms/jumbo/Jumbo.js +7 -1
- package/src/components/atoms/labeled-amount/LabeledAmount.js +7 -32
- package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +13 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.theme.js +7 -1
- package/src/components/atoms/labeled-amount/LabeledAmountV1.js +37 -0
- package/src/components/atoms/labeled-amount/LabeledAmountV2.js +34 -0
- package/src/components/atoms/line-item/LineItem.js +21 -35
- package/src/components/atoms/line-item/LineItem.theme.js +2 -2
- package/src/components/atoms/searchable-select/SearchableSelect.js +15 -7
- package/src/components/atoms/searchable-select/SearchableSelect.stories.js +5 -4
- package/src/components/molecules/editable-list/EditableList.js +3 -1
- package/src/components/molecules/editable-list/EditableList.stories.js +31 -0
- package/src/components/molecules/modal/Modal.js +3 -3
- package/src/components/molecules/partial-amount-form/PartialAmountForm.js +8 -2
- package/src/components/molecules/payment-details/PaymentDetails.js +14 -13
- package/src/components/molecules/payment-details/PaymentDetails.stories.js +36 -0
- package/src/components/molecules/payment-details/PaymentDetails.theme.js +2 -2
- package/src/components/molecules/radio-section/InnerRadioSection.js +210 -0
- package/src/components/molecules/radio-section/RadioSection.js +87 -210
- package/src/components/molecules/radio-section/RadioSection.stories.js +92 -15
- package/src/components/molecules/radio-section/RadioSection.theme.js +2 -2
|
@@ -46,6 +46,42 @@ const payment = {
|
|
|
46
46
|
description: "0034 Bednar Mission Unit: 79",
|
|
47
47
|
quantity: 1,
|
|
48
48
|
subDescription: "PIN: 71-83-630-216-0724"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
amount: 42042,
|
|
52
|
+
customAttributes: [
|
|
53
|
+
{
|
|
54
|
+
key: "parcel_id",
|
|
55
|
+
value: "71-83-630-216-0724"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: "property_city",
|
|
59
|
+
value: "North Breana"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: "property_class",
|
|
63
|
+
value: "7-91"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "property_secondary_address",
|
|
67
|
+
value: "79"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: "property_street_address",
|
|
71
|
+
value: "0034 Bednar Mission"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: "property_zip_code",
|
|
75
|
+
value: "80326-6917"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: "tax_rate",
|
|
79
|
+
value: "7.076"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
description: "42 Bednar Mission Unit: 42",
|
|
83
|
+
quantity: 1,
|
|
84
|
+
subDescription: "PIN: 71-83-630-216-0724"
|
|
49
85
|
}
|
|
50
86
|
],
|
|
51
87
|
subtotal: 77294,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const backgroundColor = { default: "transparent", small: "transparent" };
|
|
2
2
|
const lineItem = { default: "default", small: "small" };
|
|
3
|
-
const labeledAmountSubtotal = { default: "
|
|
4
|
-
const labeledAmountTotal = { default: "
|
|
3
|
+
const labeledAmountSubtotal = { default: "regular", small: "small" };
|
|
4
|
+
const labeledAmountTotal = { default: "large", small: "small" };
|
|
5
5
|
|
|
6
6
|
export const fallbackValues = {
|
|
7
7
|
backgroundColor,
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { AnimatePresence } from "framer-motion";
|
|
4
|
+
import RadioButton from "./radio-button/RadioButton";
|
|
5
|
+
import { Box, Cluster, Stack, Motion } from "../../atoms/layouts";
|
|
6
|
+
import { createIdFromString, noop } from "../../../util/general";
|
|
7
|
+
import Text from "../../atoms/text";
|
|
8
|
+
import { CHARADE_GREY } from "../../../constants/colors";
|
|
9
|
+
import { MANATEE_GREY } from "../../../constants/colors";
|
|
10
|
+
|
|
11
|
+
const idString = section =>
|
|
12
|
+
typeof section.title === "string"
|
|
13
|
+
? createIdFromString(section.title)
|
|
14
|
+
: section.id;
|
|
15
|
+
|
|
16
|
+
const InnerRadioSection = ({
|
|
17
|
+
themeValues,
|
|
18
|
+
isMobile,
|
|
19
|
+
supportsTouch,
|
|
20
|
+
section,
|
|
21
|
+
sectionIndex,
|
|
22
|
+
openSection = "",
|
|
23
|
+
toggleOpenSection,
|
|
24
|
+
staggeredAnimation = false,
|
|
25
|
+
initiallyOpen = true,
|
|
26
|
+
openHeight = "auto",
|
|
27
|
+
ariaDescribedBy,
|
|
28
|
+
focused,
|
|
29
|
+
setFocused,
|
|
30
|
+
sectionRefs,
|
|
31
|
+
ariaLabelledBy,
|
|
32
|
+
isLastGroupedItemInSection,
|
|
33
|
+
onKeyDown = noop
|
|
34
|
+
}) => {
|
|
35
|
+
const wrapper = {
|
|
36
|
+
open: {
|
|
37
|
+
height: openHeight,
|
|
38
|
+
opacity: 1,
|
|
39
|
+
transition: {
|
|
40
|
+
duration: 0.3,
|
|
41
|
+
ease: [0.04, 0.62, 0.23, 0.98],
|
|
42
|
+
staggerChildren: staggeredAnimation ? 0.15 : 0
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
closed: {
|
|
46
|
+
height: 0,
|
|
47
|
+
opacity: 0,
|
|
48
|
+
transition: {
|
|
49
|
+
duration: 0.3,
|
|
50
|
+
ease: [0.04, 0.62, 0.23, 0.98],
|
|
51
|
+
staggerChildren: staggeredAnimation ? 0.15 : 0,
|
|
52
|
+
staggerDirection: -1
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const borderStyles = `
|
|
58
|
+
border-width: 0 0 1px 0;
|
|
59
|
+
border-color: ${
|
|
60
|
+
isLastGroupedItemInSection ? MANATEE_GREY : themeValues.borderColor
|
|
61
|
+
};
|
|
62
|
+
border-style: solid;
|
|
63
|
+
border-radius: 0px;
|
|
64
|
+
transform-origin: 100% 0;
|
|
65
|
+
|
|
66
|
+
&:last-child {
|
|
67
|
+
border-width: 0;
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
const RightIcon = styled.img`
|
|
72
|
+
height: ${({ isMobile }) => (isMobile ? "14px" : "18px")};
|
|
73
|
+
width: ${({ isMobile }) => (isMobile ? "22px" : "28px")};
|
|
74
|
+
${({ fade }) => fade && "opacity: 0.4;"}
|
|
75
|
+
transition: opacity 0.3s ease;
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Motion
|
|
80
|
+
tabIndex={section.hideRadioButton || section.disabled ? "-1" : "0"}
|
|
81
|
+
ref={sectionRefs.current[sectionIndex]}
|
|
82
|
+
onBlur={() => !section.disabled && setFocused(null)}
|
|
83
|
+
onFocus={() => !section.disabled && setFocused(section.id)}
|
|
84
|
+
onKeyDown={onKeyDown}
|
|
85
|
+
hoverStyles={themeValues.focusStyles}
|
|
86
|
+
animate={openSection === section.id ? "open" : "closed"}
|
|
87
|
+
initial={initiallyOpen ? "open" : "closed"}
|
|
88
|
+
key={`item-${section.id}`}
|
|
89
|
+
extraStyles={borderStyles}
|
|
90
|
+
role="radio"
|
|
91
|
+
aria-checked={openSection === section.id}
|
|
92
|
+
aria-disabled={section.disabled}
|
|
93
|
+
aria-required={section.required}
|
|
94
|
+
aria-labelledby={ariaLabelledBy}
|
|
95
|
+
aria-describedby={ariaDescribedBy}
|
|
96
|
+
onClick={
|
|
97
|
+
(isMobile && supportsTouch) || section.disabled
|
|
98
|
+
? noop
|
|
99
|
+
: () => toggleOpenSection(section.id)
|
|
100
|
+
}
|
|
101
|
+
onTouchEnd={
|
|
102
|
+
isMobile && supportsTouch && !section.disabled
|
|
103
|
+
? () => toggleOpenSection(section.id)
|
|
104
|
+
: noop
|
|
105
|
+
}
|
|
106
|
+
id={`inner-radio-section-${sectionIndex}`}
|
|
107
|
+
data-qa={
|
|
108
|
+
section.dataQa
|
|
109
|
+
? section.dataQa
|
|
110
|
+
: section.id || `inner-radio-section-${sectionIndex}`
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
<Stack childGap="0">
|
|
114
|
+
<Box
|
|
115
|
+
padding={section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem"}
|
|
116
|
+
background={
|
|
117
|
+
section.disabled
|
|
118
|
+
? themeValues.headingDisabledColor
|
|
119
|
+
: themeValues.headingBackgroundColor
|
|
120
|
+
}
|
|
121
|
+
key={`header-${section.id}`}
|
|
122
|
+
borderSize="0px"
|
|
123
|
+
borderColor={themeValues.borderColor}
|
|
124
|
+
borderWidthOverride={
|
|
125
|
+
openSection === section.id && !!section.content
|
|
126
|
+
? `0px 0px 1px 0px`
|
|
127
|
+
: ``
|
|
128
|
+
}
|
|
129
|
+
extraStyles={!section.disabled ? "cursor: pointer;" : ""}
|
|
130
|
+
>
|
|
131
|
+
<Cluster justify="space-between" align="center" childGap="1px" nowrap>
|
|
132
|
+
<Cluster justify="flex-start" align="center" nowrap>
|
|
133
|
+
{!section.hideRadioButton && (
|
|
134
|
+
<Box padding="0">
|
|
135
|
+
<RadioButton
|
|
136
|
+
id={`radio-input-${idString(section)}`}
|
|
137
|
+
name={idString(section)}
|
|
138
|
+
ariaDescribedBy={ariaDescribedBy}
|
|
139
|
+
radioOn={openSection === section.id}
|
|
140
|
+
radioFocused={focused === section.id}
|
|
141
|
+
toggleRadio={
|
|
142
|
+
section.disabled
|
|
143
|
+
? noop
|
|
144
|
+
: () => toggleOpenSection(section.id)
|
|
145
|
+
}
|
|
146
|
+
tabIndex="-1"
|
|
147
|
+
isRequired={section.required}
|
|
148
|
+
/>
|
|
149
|
+
</Box>
|
|
150
|
+
)}
|
|
151
|
+
{section.titleIcon && (
|
|
152
|
+
<Cluster align="center">{section.titleIcon}</Cluster>
|
|
153
|
+
)}
|
|
154
|
+
<Box padding={section.titleIcon ? "0 0 0 8px" : "0"}>
|
|
155
|
+
<Text
|
|
156
|
+
as="label"
|
|
157
|
+
htmlFor={`radio-input-${idString(section)}`}
|
|
158
|
+
color={CHARADE_GREY}
|
|
159
|
+
>
|
|
160
|
+
{section.title}
|
|
161
|
+
</Text>
|
|
162
|
+
</Box>
|
|
163
|
+
</Cluster>
|
|
164
|
+
{section.rightIcons && (
|
|
165
|
+
<Cluster
|
|
166
|
+
id={`right-icons-${idString(section)}`}
|
|
167
|
+
childGap="0.5rem"
|
|
168
|
+
aria-label={section.rightIconsLabel || null}
|
|
169
|
+
role={section.rightIconsRole || null}
|
|
170
|
+
>
|
|
171
|
+
{section.rightIcons.map(icon => (
|
|
172
|
+
<RightIcon
|
|
173
|
+
src={icon.img}
|
|
174
|
+
key={icon.img}
|
|
175
|
+
fade={!icon.enabled}
|
|
176
|
+
isMobile={isMobile}
|
|
177
|
+
alt={icon.altText}
|
|
178
|
+
aria-disabled={!icon.enabled}
|
|
179
|
+
/>
|
|
180
|
+
))}
|
|
181
|
+
</Cluster>
|
|
182
|
+
)}
|
|
183
|
+
{section.rightTitleContent && (
|
|
184
|
+
<Fragment>{section.rightTitleContent}</Fragment>
|
|
185
|
+
)}
|
|
186
|
+
</Cluster>
|
|
187
|
+
</Box>
|
|
188
|
+
<AnimatePresence initial={false}>
|
|
189
|
+
{openSection === section.id && (
|
|
190
|
+
<Motion
|
|
191
|
+
key={`content-${section.id}`}
|
|
192
|
+
padding="0"
|
|
193
|
+
background={themeValues.bodyBackgroundColor}
|
|
194
|
+
layoutTransition
|
|
195
|
+
initial="closed"
|
|
196
|
+
animate="open"
|
|
197
|
+
exit="closed"
|
|
198
|
+
variants={wrapper}
|
|
199
|
+
extraStyles={`transform-origin: 100% 0; border-top: 0;`}
|
|
200
|
+
>
|
|
201
|
+
{section.content}
|
|
202
|
+
</Motion>
|
|
203
|
+
)}
|
|
204
|
+
</AnimatePresence>
|
|
205
|
+
</Stack>
|
|
206
|
+
</Motion>
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export default InnerRadioSection;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import React, { createRef, Fragment, useRef, useState } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
2
|
import { themeComponent } from "../../../util/themeUtils";
|
|
4
3
|
import { fallbackValues } from "./RadioSection.theme";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { createIdFromString, noop, wrapIndex } from "../../../util/general";
|
|
9
|
-
import Text from "../../atoms/text";
|
|
10
|
-
import { CHARADE_GREY } from "../../../constants/colors";
|
|
4
|
+
import SolidDivider from "../../atoms/solid-divider/SolidDivider";
|
|
5
|
+
import { Box, Stack } from "../../atoms/layouts";
|
|
6
|
+
import { createIdFromString, wrapIndex } from "../../../util/general";
|
|
11
7
|
import {
|
|
12
8
|
ARROW_DOWN,
|
|
13
9
|
ARROW_LEFT,
|
|
@@ -16,27 +12,31 @@ import {
|
|
|
16
12
|
ENTER,
|
|
17
13
|
SPACEBAR
|
|
18
14
|
} from "../../../constants/keyboard";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
title: <React Component(s)>,
|
|
23
|
-
id: <String> "identifier of section",
|
|
24
|
-
disabled: boolean, (displays section and grayed out radio but disables interaction)
|
|
25
|
-
hideRadioButton: boolean, (keeps section displayed but hides radio and disables open/close function),
|
|
26
|
-
hidden: boolean, (hides section entirely)
|
|
27
|
-
dataQa: string,
|
|
28
|
-
content: <React Component(s)> e.g.: <Box><Stack>cool content stuff</Stack></Box> (any collection of components will work),
|
|
29
|
-
rightTitleContent: <React Component(s)> (rendered on the very right of the title section, use to supplement "rightIcons" with text, as in expired CC status, or render other custom content)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
Also takes an "openSection" which should equal the id of the section that should be open
|
|
33
|
-
And a toggleOpenSection. RadioSection will call this function with the id of the section
|
|
34
|
-
that it is in. It is up to the user to store the open section value in state up from the component
|
|
35
|
-
using a useState() hook, or reducer.
|
|
36
|
-
|
|
37
|
-
The section itself comes with some motion to open/close. To add more motion to the content,
|
|
38
|
-
wrap your content with a Motion layout primitive and provide appropriate props.
|
|
15
|
+
import InnerRadioSection from "./InnerRadioSection";
|
|
16
|
+
import { MANATEE_GREY } from "../../../constants/colors";
|
|
39
17
|
|
|
18
|
+
/**
|
|
19
|
+
- The RadioSection component takes either a flat array (via the 'sections'
|
|
20
|
+
prop) of section objects or a multidimensional array (via the 'groupedSections' prop) of section objects. Note that if using a multidimensional array, the nesting cannot exceed 2 levels deep.
|
|
21
|
+
- Each 'section' object should look like:
|
|
22
|
+
{
|
|
23
|
+
title: <React Component(s)>,
|
|
24
|
+
id: <String> "identifier of section",
|
|
25
|
+
disabled: boolean, (displays section and grayed out radio but disables interaction)
|
|
26
|
+
hideRadioButton: boolean, (keeps section displayed but hides radio and disables open/close function),
|
|
27
|
+
hidden: boolean, (hides section entirely)
|
|
28
|
+
dataQa: string,
|
|
29
|
+
content: <React Component(s)> e.g.: <Box><Stack>cool content stuff</Stack></Box> (any collection of components will work),
|
|
30
|
+
rightTitleContent: <React Component(s)> (rendered on the very right of the title section, use to supplement "rightIcons" with text, as in expired CC status, or render other custom content)
|
|
31
|
+
}
|
|
32
|
+
- It also takes an "openSection" which should equal the id of the section that
|
|
33
|
+
should be open, along with "toggleOpenSection"
|
|
34
|
+
- RadioSection will call "toggleOpenSection" with the id of the section
|
|
35
|
+
that it is in.
|
|
36
|
+
- It is up to the engineer to store the open section value in state up from the
|
|
37
|
+
component using a useState() hook or a reducer.
|
|
38
|
+
- The section itself comes with some motion to open/close. To add more motion
|
|
39
|
+
to the content, wrap your content with a Motion layout primitive and provide appropriate props.
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
42
|
const idString = section =>
|
|
@@ -57,9 +57,11 @@ const RadioSection = ({
|
|
|
57
57
|
containerStyles = "",
|
|
58
58
|
ariaDescribedBy,
|
|
59
59
|
isSectionRequired = false,
|
|
60
|
+
groupedSections,
|
|
60
61
|
...rest
|
|
61
62
|
}) => {
|
|
62
63
|
const [focused, setFocused] = useState(null);
|
|
64
|
+
|
|
63
65
|
const sectionRefs = useRef(
|
|
64
66
|
[...Array(sections.length)].map(() => createRef())
|
|
65
67
|
);
|
|
@@ -93,198 +95,73 @@ const RadioSection = ({
|
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
97
|
|
|
96
|
-
const wrapper = {
|
|
97
|
-
open: {
|
|
98
|
-
height: openHeight,
|
|
99
|
-
opacity: 1,
|
|
100
|
-
transition: {
|
|
101
|
-
duration: 0.3,
|
|
102
|
-
ease: [0.04, 0.62, 0.23, 0.98],
|
|
103
|
-
staggerChildren: staggeredAnimation ? 0.15 : 0
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
closed: {
|
|
107
|
-
height: 0,
|
|
108
|
-
opacity: 0,
|
|
109
|
-
transition: {
|
|
110
|
-
duration: 0.3,
|
|
111
|
-
ease: [0.04, 0.62, 0.23, 0.98],
|
|
112
|
-
staggerChildren: staggeredAnimation ? 0.15 : 0,
|
|
113
|
-
staggerDirection: -1
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const borderStyles = `
|
|
119
|
-
border-width: 0 0 1px 0;
|
|
120
|
-
border-color: ${themeValues.borderColor};
|
|
121
|
-
border-style: solid;
|
|
122
|
-
border-radius: 0px;
|
|
123
|
-
transform-origin: 100% 0;
|
|
124
|
-
|
|
125
|
-
&:last-child {
|
|
126
|
-
border-width: 0;
|
|
127
|
-
}
|
|
128
|
-
`;
|
|
129
|
-
|
|
130
|
-
const RightIcon = styled.img`
|
|
131
|
-
height: ${({ isMobile }) => (isMobile ? "14px" : "18px")};
|
|
132
|
-
width: ${({ isMobile }) => (isMobile ? "22px" : "28px")};
|
|
133
|
-
${({ fade }) => fade && "opacity: 0.4;"}
|
|
134
|
-
transition: opacity 0.3s ease;
|
|
135
|
-
`;
|
|
136
|
-
|
|
137
98
|
return (
|
|
138
99
|
<Box
|
|
139
100
|
padding="1px"
|
|
140
101
|
border={`1px solid ${themeValues.borderColor}`}
|
|
141
102
|
borderRadius="4px"
|
|
142
103
|
extraStyles={containerStyles}
|
|
104
|
+
role="radiogroup"
|
|
105
|
+
aria-required={isSectionRequired}
|
|
106
|
+
{...rest}
|
|
143
107
|
>
|
|
144
|
-
<Stack
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
hoverStyles={themeValues.focusStyles}
|
|
164
|
-
animate={openSection === section.id ? "open" : "closed"}
|
|
165
|
-
initial={initiallyOpen ? "open" : "closed"}
|
|
166
|
-
key={`item-${section.id}`}
|
|
167
|
-
extraStyles={borderStyles}
|
|
168
|
-
role="radio"
|
|
169
|
-
aria-checked={openSection === section.id}
|
|
170
|
-
aria-disabled={section.disabled}
|
|
171
|
-
aria-required={section.required}
|
|
172
|
-
aria-labelledby={section.id}
|
|
173
|
-
aria-describedby={`right-icons-${idString(section)}`}
|
|
174
|
-
>
|
|
175
|
-
<Stack childGap="0">
|
|
176
|
-
<Box
|
|
177
|
-
padding={
|
|
178
|
-
section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem"
|
|
179
|
-
}
|
|
180
|
-
background={
|
|
181
|
-
section.disabled
|
|
182
|
-
? themeValues.headingDisabledColor
|
|
183
|
-
: themeValues.headingBackgroundColor
|
|
184
|
-
}
|
|
185
|
-
onClick={
|
|
186
|
-
(isMobile && supportsTouch) || section.disabled
|
|
187
|
-
? noop
|
|
188
|
-
: () => toggleOpenSection(section.id)
|
|
108
|
+
<Stack childGap="0">
|
|
109
|
+
{!!sections &&
|
|
110
|
+
sections
|
|
111
|
+
.filter(section => !section.hidden)
|
|
112
|
+
.map((section, i) => (
|
|
113
|
+
<Fragment key={`radio-section-${i}`}>
|
|
114
|
+
<InnerRadioSection
|
|
115
|
+
themeValues={themeValues}
|
|
116
|
+
sectionIndex={i}
|
|
117
|
+
section={section}
|
|
118
|
+
sectionRefs={sectionRefs}
|
|
119
|
+
focused={focused}
|
|
120
|
+
setFocused={setFocused}
|
|
121
|
+
openHeight={openHeight}
|
|
122
|
+
openSection={openSection}
|
|
123
|
+
toggleOpenSection={toggleOpenSection}
|
|
124
|
+
onKeyDown={e =>
|
|
125
|
+
!section.disabled && handleKeyDown(section.id, e, i)
|
|
189
126
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
: () => toggleOpenSection(section.id)
|
|
225
|
-
}
|
|
226
|
-
tabIndex="-1"
|
|
227
|
-
isRequired={section.required}
|
|
228
|
-
/>
|
|
229
|
-
</Box>
|
|
230
|
-
)}
|
|
231
|
-
{section.titleIcon && (
|
|
232
|
-
<Cluster align="center">{section.titleIcon}</Cluster>
|
|
233
|
-
)}
|
|
234
|
-
<Box padding={section.titleIcon ? "0 0 0 8px" : "0"}>
|
|
235
|
-
<Text
|
|
236
|
-
as="label"
|
|
237
|
-
htmlFor={`radio-input-${idString(section)}`}
|
|
238
|
-
color={CHARADE_GREY}
|
|
239
|
-
>
|
|
240
|
-
{section.title}
|
|
241
|
-
</Text>
|
|
242
|
-
</Box>
|
|
243
|
-
</Cluster>
|
|
244
|
-
{section.rightIcons && (
|
|
245
|
-
<Cluster
|
|
246
|
-
id={`right-icons-${idString(section)}`}
|
|
247
|
-
childGap="0.5rem"
|
|
248
|
-
aria-label={section.rightIconsLabel || null}
|
|
249
|
-
role={section.rightIconsRole || null}
|
|
250
|
-
>
|
|
251
|
-
{section.rightIcons.map(icon => (
|
|
252
|
-
<RightIcon
|
|
253
|
-
src={icon.img}
|
|
254
|
-
key={icon.img}
|
|
255
|
-
fade={!icon.enabled}
|
|
256
|
-
isMobile={isMobile}
|
|
257
|
-
alt={icon.altText}
|
|
258
|
-
aria-disabled={!icon.enabled}
|
|
259
|
-
/>
|
|
260
|
-
))}
|
|
261
|
-
</Cluster>
|
|
262
|
-
)}
|
|
263
|
-
{section.rightTitleContent && (
|
|
264
|
-
<Fragment>{section.rightTitleContent}</Fragment>
|
|
127
|
+
ariaLabelledBy={section.id}
|
|
128
|
+
ariaDescribedBy={`right-icons-${idString(section)}`}
|
|
129
|
+
isLastGroupedItemInSection={false}
|
|
130
|
+
/>
|
|
131
|
+
</Fragment>
|
|
132
|
+
))}
|
|
133
|
+
{!!groupedSections &&
|
|
134
|
+
groupedSections.map((sectionGroup, sectionGroupIndex) =>
|
|
135
|
+
sectionGroup
|
|
136
|
+
.filter(unfilteredSection => !unfilteredSection.hidden)
|
|
137
|
+
.map((section, sectionIndex) => (
|
|
138
|
+
<Fragment key={`key-${sectionGroupIndex}-${sectionIndex}`}>
|
|
139
|
+
<InnerRadioSection
|
|
140
|
+
themeValues={themeValues}
|
|
141
|
+
sectionIndex={`${sectionGroupIndex}-${sectionIndex}`}
|
|
142
|
+
section={section}
|
|
143
|
+
sectionRefs={sectionRefs}
|
|
144
|
+
focused={focused}
|
|
145
|
+
setFocused={setFocused}
|
|
146
|
+
openHeight={openHeight}
|
|
147
|
+
ariaLabelledBy={section.id}
|
|
148
|
+
ariaDescribedBy={`right-icons-${idString(section)}`}
|
|
149
|
+
openSection={openSection}
|
|
150
|
+
toggleOpenSection={toggleOpenSection}
|
|
151
|
+
isLastGroupedItemInSection={
|
|
152
|
+
sectionIndex === sectionGroup.length - 1
|
|
153
|
+
}
|
|
154
|
+
/>
|
|
155
|
+
{sectionIndex === sectionGroup.length - 1 &&
|
|
156
|
+
sectionGroupIndex !== groupedSections.length - 1 && (
|
|
157
|
+
<SolidDivider
|
|
158
|
+
borderSize="1px"
|
|
159
|
+
borderColor={MANATEE_GREY}
|
|
160
|
+
/>
|
|
265
161
|
)}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
{openSection === section.id && (
|
|
270
|
-
<Motion
|
|
271
|
-
key={`content-${section.id}`}
|
|
272
|
-
padding="0"
|
|
273
|
-
background={themeValues.bodyBackgroundColor}
|
|
274
|
-
layoutTransition
|
|
275
|
-
initial="closed"
|
|
276
|
-
animate="open"
|
|
277
|
-
exit="closed"
|
|
278
|
-
variants={wrapper}
|
|
279
|
-
extraStyles={`transform-origin: 100% 0;`}
|
|
280
|
-
>
|
|
281
|
-
{section.content}
|
|
282
|
-
</Motion>
|
|
283
|
-
)}
|
|
284
|
-
</AnimatePresence>
|
|
285
|
-
</Stack>
|
|
286
|
-
</Motion>
|
|
287
|
-
))}
|
|
162
|
+
</Fragment>
|
|
163
|
+
))
|
|
164
|
+
)}
|
|
288
165
|
</Stack>
|
|
289
166
|
</Box>
|
|
290
167
|
);
|