@thecb/components 9.0.2 → 9.0.3-beta.11
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 +40 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +40 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +49322 -0
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/.DS_Store +0 -0
- package/src/components/molecules/radio-section/RadioSection.js +28 -12
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +12 -3
- /package/src/components/atoms/icons/{ExternalLinkicon.js → ExternalLinkIcon.js} +0 -0
package/package.json
CHANGED
package/src/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -5,10 +5,9 @@ import { fallbackValues } from "./RadioSection.theme";
|
|
|
5
5
|
import { AnimatePresence } from "framer-motion";
|
|
6
6
|
import RadioButton from "./radio-button/RadioButton";
|
|
7
7
|
import { Box, Cluster, Stack, Motion } from "../../atoms/layouts";
|
|
8
|
-
import { noop } from "../../../util/general";
|
|
8
|
+
import { createIdFromString, noop } from "../../../util/general";
|
|
9
9
|
import Text from "../../atoms/text";
|
|
10
10
|
import { CHARADE_GREY } from "../../../constants/colors";
|
|
11
|
-
import { createIdFromString } from "../../../util/general";
|
|
12
11
|
/*
|
|
13
12
|
Takes an array of section objects, each object should look like:
|
|
14
13
|
{
|
|
@@ -32,6 +31,11 @@ import { createIdFromString } from "../../../util/general";
|
|
|
32
31
|
|
|
33
32
|
*/
|
|
34
33
|
|
|
34
|
+
const computeSectionId = section =>
|
|
35
|
+
typeof section.title === "string"
|
|
36
|
+
? createIdFromString(section.title)
|
|
37
|
+
: section.id;
|
|
38
|
+
|
|
35
39
|
const RadioSection = ({
|
|
36
40
|
themeValues,
|
|
37
41
|
isMobile,
|
|
@@ -43,10 +47,11 @@ const RadioSection = ({
|
|
|
43
47
|
initiallyOpen = true,
|
|
44
48
|
openHeight = "auto",
|
|
45
49
|
containerStyles = "",
|
|
46
|
-
ariaDescribedBy
|
|
50
|
+
ariaDescribedBy,
|
|
51
|
+
rightIconsLabel = null
|
|
47
52
|
}) => {
|
|
48
53
|
const handleKeyDown = (id, e) => {
|
|
49
|
-
if (e?.keyCode === 13) {
|
|
54
|
+
if (e?.keyCode === 13 || e?.keyCode === 32) {
|
|
50
55
|
toggleOpenSection(id);
|
|
51
56
|
}
|
|
52
57
|
};
|
|
@@ -101,7 +106,7 @@ const RadioSection = ({
|
|
|
101
106
|
borderRadius="4px"
|
|
102
107
|
extraStyles={containerStyles}
|
|
103
108
|
>
|
|
104
|
-
<Stack childGap="0">
|
|
109
|
+
<Stack childGap="0" role="radiogroup">
|
|
105
110
|
{sections
|
|
106
111
|
.filter(section => !section.hidden)
|
|
107
112
|
.map(section => (
|
|
@@ -117,6 +122,8 @@ const RadioSection = ({
|
|
|
117
122
|
initial={initiallyOpen ? "open" : "closed"}
|
|
118
123
|
key={`item-${section.id}`}
|
|
119
124
|
extraStyles={borderStyles}
|
|
125
|
+
role="radio"
|
|
126
|
+
aria-checked={openSection === section.id}
|
|
120
127
|
>
|
|
121
128
|
<Stack childGap="0">
|
|
122
129
|
<Box
|
|
@@ -159,12 +166,12 @@ const RadioSection = ({
|
|
|
159
166
|
{!section.hideRadioButton && (
|
|
160
167
|
<Box padding="0">
|
|
161
168
|
<RadioButton
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
? createIdFromString(section.title)
|
|
165
|
-
: section.id
|
|
166
|
-
}
|
|
169
|
+
id={computeSectionId(section)}
|
|
170
|
+
name={computeSectionId(section)}
|
|
167
171
|
ariaDescribedBy={ariaDescribedBy}
|
|
172
|
+
ariaLabelledBy={`radio-input-${computeSectionId(
|
|
173
|
+
section
|
|
174
|
+
)}`}
|
|
168
175
|
radioOn={openSection === section.id}
|
|
169
176
|
radioFocused={focused === section.id}
|
|
170
177
|
toggleRadio={
|
|
@@ -180,13 +187,22 @@ const RadioSection = ({
|
|
|
180
187
|
<Cluster align="center">{section.titleIcon}</Cluster>
|
|
181
188
|
)}
|
|
182
189
|
<Box padding={section.titleIcon ? "0 0 0 8px" : "0"}>
|
|
183
|
-
<Text
|
|
190
|
+
<Text
|
|
191
|
+
as="label"
|
|
192
|
+
color={CHARADE_GREY}
|
|
193
|
+
htmlFor={`radio-input-${computeSectionId(section)}`}
|
|
194
|
+
>
|
|
184
195
|
{section.title}
|
|
185
196
|
</Text>
|
|
186
197
|
</Box>
|
|
187
198
|
</Cluster>
|
|
188
199
|
{section.rightIcons && (
|
|
189
|
-
<Cluster
|
|
200
|
+
<Cluster
|
|
201
|
+
childGap="0.5rem"
|
|
202
|
+
{...(rightIconsLabel !== null
|
|
203
|
+
? { "aria-label": rightIconsLabel }
|
|
204
|
+
: {})}
|
|
205
|
+
>
|
|
190
206
|
{section.rightIcons.map(icon => (
|
|
191
207
|
<RightIcon
|
|
192
208
|
src={icon.img}
|
|
@@ -17,7 +17,9 @@ const RadioButton = ({
|
|
|
17
17
|
name,
|
|
18
18
|
disabled = false,
|
|
19
19
|
ariaDescribedBy = "",
|
|
20
|
-
themeValues
|
|
20
|
+
themeValues,
|
|
21
|
+
ariaLabelledBy = "",
|
|
22
|
+
ariaLabel = null
|
|
21
23
|
}) => {
|
|
22
24
|
const buttonBorder = {
|
|
23
25
|
onFocused: {
|
|
@@ -60,6 +62,12 @@ const RadioButton = ({
|
|
|
60
62
|
width: "0px"
|
|
61
63
|
}
|
|
62
64
|
};
|
|
65
|
+
const extraProps = {};
|
|
66
|
+
if (ariaLabelledBy && ariaLabelledBy.length) {
|
|
67
|
+
extraProps["aria-labelledby"] = ariaLabelledBy;
|
|
68
|
+
} else if (ariaLabel && ariaLabel !== null) {
|
|
69
|
+
extraProps["aria-label"] = ariaLabel;
|
|
70
|
+
}
|
|
63
71
|
|
|
64
72
|
return (
|
|
65
73
|
<Motion
|
|
@@ -77,12 +85,13 @@ const RadioButton = ({
|
|
|
77
85
|
}
|
|
78
86
|
>
|
|
79
87
|
<HiddenRadioButton
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
type="radio"
|
|
89
|
+
id={`radio-${name}`}
|
|
82
90
|
disabled={disabled}
|
|
83
91
|
onClick={toggleRadio}
|
|
84
92
|
aria-describedby={ariaDescribedBy}
|
|
85
93
|
tabIndex="-1"
|
|
94
|
+
{...extraProps}
|
|
86
95
|
/>
|
|
87
96
|
<Motion
|
|
88
97
|
borderWidth="1px"
|
|
File without changes
|