@thecb/components 9.5.0-beta.5 → 9.5.0-beta.7
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 +27 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -36
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/radio-section/InnerRadioSection.js +7 -9
- package/src/components/molecules/radio-section/RadioSection.js +10 -3
- package/src/components/molecules/radio-section/RadioSection.stories.js +9 -3
- package/src/components/molecules/radio-section/RadioSection.theme.js +2 -2
- package/src/components/molecules/radio-section/InnerRadioSection.theme.js +0 -15
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { Fragment } from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import { themeComponent } from "../../../util/themeUtils";
|
|
4
|
-
import { fallbackValues } from "./InnerRadioSection.theme";
|
|
5
3
|
import { AnimatePresence } from "framer-motion";
|
|
6
4
|
import RadioButton from "./radio-button/RadioButton";
|
|
7
5
|
import { Box, Cluster, Stack, Motion } from "../../atoms/layouts";
|
|
8
6
|
import { createIdFromString, noop } from "../../../util/general";
|
|
9
7
|
import Text from "../../atoms/text";
|
|
10
8
|
import { CHARADE_GREY } from "../../../constants/colors";
|
|
9
|
+
import { MANATEE_GREY } from "../../../constants/colors";
|
|
11
10
|
|
|
12
11
|
const idString = section =>
|
|
13
12
|
typeof section.title === "string"
|
|
@@ -30,6 +29,7 @@ const InnerRadioSection = ({
|
|
|
30
29
|
setFocused,
|
|
31
30
|
sectionRefs,
|
|
32
31
|
ariaLabelledBy,
|
|
32
|
+
isLastGroupedItemInSection,
|
|
33
33
|
onKeyDown = noop
|
|
34
34
|
}) => {
|
|
35
35
|
const wrapper = {
|
|
@@ -56,7 +56,9 @@ const InnerRadioSection = ({
|
|
|
56
56
|
|
|
57
57
|
const borderStyles = `
|
|
58
58
|
border-width: 0 0 1px 0;
|
|
59
|
-
border-color: ${
|
|
59
|
+
border-color: ${
|
|
60
|
+
isLastGroupedItemInSection ? MANATEE_GREY : themeValues.borderColor
|
|
61
|
+
};
|
|
60
62
|
border-style: solid;
|
|
61
63
|
border-radius: 0px;
|
|
62
64
|
transform-origin: 100% 0;
|
|
@@ -194,7 +196,7 @@ const InnerRadioSection = ({
|
|
|
194
196
|
animate="open"
|
|
195
197
|
exit="closed"
|
|
196
198
|
variants={wrapper}
|
|
197
|
-
extraStyles={`transform-origin: 100% 0
|
|
199
|
+
extraStyles={`transform-origin: 100% 0; border-top: 1px solid ${themeValues.borderColor}`}
|
|
198
200
|
>
|
|
199
201
|
{section.content}
|
|
200
202
|
</Motion>
|
|
@@ -205,8 +207,4 @@ const InnerRadioSection = ({
|
|
|
205
207
|
);
|
|
206
208
|
};
|
|
207
209
|
|
|
208
|
-
export default
|
|
209
|
-
InnerRadioSection,
|
|
210
|
-
"InnerRadioSection",
|
|
211
|
-
fallbackValues
|
|
212
|
-
);
|
|
210
|
+
export default InnerRadioSection;
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
SPACEBAR
|
|
14
14
|
} from "../../../constants/keyboard";
|
|
15
15
|
import InnerRadioSection from "./InnerRadioSection";
|
|
16
|
+
import { MANATEE_GREY } from "../../../constants/colors";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
- The RadioSection component takes either a flat array (via the 'sections'
|
|
@@ -109,8 +110,9 @@ const RadioSection = ({
|
|
|
109
110
|
sections
|
|
110
111
|
.filter(section => !section.hidden)
|
|
111
112
|
.map((section, i) => (
|
|
112
|
-
<Fragment key={`radio-section-${
|
|
113
|
+
<Fragment key={`radio-section-${i}`}>
|
|
113
114
|
<InnerRadioSection
|
|
115
|
+
themeValues={themeValues}
|
|
114
116
|
sectionIndex={i}
|
|
115
117
|
section={section}
|
|
116
118
|
sectionRefs={sectionRefs}
|
|
@@ -124,6 +126,7 @@ const RadioSection = ({
|
|
|
124
126
|
}
|
|
125
127
|
ariaLabelledBy={section.id}
|
|
126
128
|
ariaDescribedBy={`right-icons-${idString(section)}`}
|
|
129
|
+
isLastGroupedItemInSection={false}
|
|
127
130
|
/>
|
|
128
131
|
</Fragment>
|
|
129
132
|
))}
|
|
@@ -134,6 +137,7 @@ const RadioSection = ({
|
|
|
134
137
|
.map((section, sectionIndex) => (
|
|
135
138
|
<Fragment key={`key-${sectionGroupIndex}-${sectionIndex}`}>
|
|
136
139
|
<InnerRadioSection
|
|
140
|
+
themeValues={themeValues}
|
|
137
141
|
sectionIndex={`${sectionGroupIndex}-${sectionIndex}`}
|
|
138
142
|
section={section}
|
|
139
143
|
sectionRefs={sectionRefs}
|
|
@@ -144,13 +148,16 @@ const RadioSection = ({
|
|
|
144
148
|
ariaDescribedBy={`right-icons-${idString(section)}`}
|
|
145
149
|
openSection={openSection}
|
|
146
150
|
toggleOpenSection={toggleOpenSection}
|
|
151
|
+
isLastGroupedItemInSection={
|
|
152
|
+
sectionGroup.indexOf(section) === sectionGroup.length - 1
|
|
153
|
+
}
|
|
147
154
|
/>
|
|
148
155
|
{sectionGroup.indexOf(section) === sectionGroup.length - 1 &&
|
|
149
156
|
groupedSections.indexOf(sectionGroup) !==
|
|
150
157
|
groupedSections.length - 1 && (
|
|
151
158
|
<SolidDivider
|
|
152
|
-
borderSize="
|
|
153
|
-
|
|
159
|
+
borderSize="1px"
|
|
160
|
+
borderColor={MANATEE_GREY}
|
|
154
161
|
/>
|
|
155
162
|
)}
|
|
156
163
|
</Fragment>
|
|
@@ -60,6 +60,13 @@ const groupedSections = [
|
|
|
60
60
|
title: "Group 1: New Bank Account",
|
|
61
61
|
content: <p>The form to add a credit card would go here.</p>,
|
|
62
62
|
required: true
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
{
|
|
66
|
+
id: "bar4",
|
|
67
|
+
title: "Group 1: Another One",
|
|
68
|
+
content: <div>Content for another section</div>,
|
|
69
|
+
required: true
|
|
63
70
|
}
|
|
64
71
|
],
|
|
65
72
|
[
|
|
@@ -110,7 +117,7 @@ export const radioSection = () => {
|
|
|
110
117
|
<>
|
|
111
118
|
<Box padding="0 1rem" extraStyles="text-align: center;">
|
|
112
119
|
<p>
|
|
113
|
-
Using <b>sections</b
|
|
120
|
+
Using <b>sections</b>
|
|
114
121
|
</p>
|
|
115
122
|
</Box>
|
|
116
123
|
<RadioSection
|
|
@@ -125,8 +132,7 @@ export const radioSection = () => {
|
|
|
125
132
|
<Box />
|
|
126
133
|
<Box padding="0 1rem" extraStyles="text-align: center;">
|
|
127
134
|
<p>
|
|
128
|
-
Using <b>groupedSections</b
|
|
129
|
-
instead of the <b>sections</b> prop.
|
|
135
|
+
Using <b>groupedSections</b>
|
|
130
136
|
</p>
|
|
131
137
|
</Box>
|
|
132
138
|
<RadioSection
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WHITE,
|
|
1
|
+
import { WHITE, GHOST_GREY, ATHENS_GREY } from "../../../constants/colors";
|
|
2
2
|
|
|
3
3
|
const headingBackgroundColor = `${WHITE}`;
|
|
4
4
|
const headingDisabledColor = `${ATHENS_GREY}`;
|
|
5
5
|
const bodyBackgroundColor = "#eeeeee";
|
|
6
|
-
const borderColor = `${
|
|
6
|
+
const borderColor = `${GHOST_GREY}`;
|
|
7
7
|
const focusStyles = `outline: none;`;
|
|
8
8
|
|
|
9
9
|
export const fallbackValues = {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { WHITE, GREY_CHATEAU, ATHENS_GREY } from "../../../constants/colors";
|
|
2
|
-
|
|
3
|
-
const headingBackgroundColor = `${WHITE}`;
|
|
4
|
-
const headingDisabledColor = `${ATHENS_GREY}`;
|
|
5
|
-
const bodyBackgroundColor = "#eeeeee";
|
|
6
|
-
const borderColor = `${GREY_CHATEAU}`;
|
|
7
|
-
const focusStyles = `outline: none;`;
|
|
8
|
-
|
|
9
|
-
export const fallbackValues = {
|
|
10
|
-
headingBackgroundColor,
|
|
11
|
-
headingDisabledColor,
|
|
12
|
-
bodyBackgroundColor,
|
|
13
|
-
borderColor,
|
|
14
|
-
focusStyles
|
|
15
|
-
};
|