@thecb/components 10.7.5-beta.1 → 10.7.5-beta.3
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/package.json
CHANGED
|
@@ -4,10 +4,7 @@ import posed from "react-pose";
|
|
|
4
4
|
import { fallbackValues } from "./ToggleSwitch.theme";
|
|
5
5
|
import { themeComponent } from "../../../util/themeUtils";
|
|
6
6
|
import { Box, Center, Cover, Cluster } from "../layouts";
|
|
7
|
-
import {
|
|
8
|
-
FONT_WEIGHT_SEMIBOLD,
|
|
9
|
-
SCREEN_READER_ONLY
|
|
10
|
-
} from "../../../constants/style_constants";
|
|
7
|
+
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
11
8
|
import { CHARADE_GREY } from "../../../constants/colors";
|
|
12
9
|
import { ENTER } from "../../../constants/keyboard";
|
|
13
10
|
import { noop } from "../../../util/general";
|
|
@@ -59,8 +56,7 @@ const ToggleSwitch = ({
|
|
|
59
56
|
label = null,
|
|
60
57
|
labelLeft = false,
|
|
61
58
|
labelStyles = "",
|
|
62
|
-
labelAs = "
|
|
63
|
-
srOnlyLabel = "",
|
|
59
|
+
labelAs = "label",
|
|
64
60
|
themeValues,
|
|
65
61
|
isMobile,
|
|
66
62
|
dataQa,
|
|
@@ -138,7 +134,7 @@ const ToggleSwitch = ({
|
|
|
138
134
|
|
|
139
135
|
return (
|
|
140
136
|
<Box
|
|
141
|
-
padding="0"
|
|
137
|
+
padding="0.5rem"
|
|
142
138
|
extraStyles={`
|
|
143
139
|
margin: 0 0.5rem;
|
|
144
140
|
${
|
|
@@ -179,6 +175,7 @@ const ToggleSwitch = ({
|
|
|
179
175
|
tabIndex={disabled ? -1 : 0}
|
|
180
176
|
disabled={disabled}
|
|
181
177
|
isMobile={isMobile}
|
|
178
|
+
tabindex="0"
|
|
182
179
|
>
|
|
183
180
|
<ToggleSwitchRing isMobile={isMobile} />
|
|
184
181
|
</VisibleSwitch>
|
|
@@ -187,6 +184,7 @@ const ToggleSwitch = ({
|
|
|
187
184
|
{label && (
|
|
188
185
|
<Box
|
|
189
186
|
as={labelAs}
|
|
187
|
+
aria-label={`${name}: ${label}`}
|
|
190
188
|
extraStyles={`
|
|
191
189
|
font-weight: ${FONT_WEIGHT_SEMIBOLD};
|
|
192
190
|
color: ${CHARADE_GREY};
|
|
@@ -199,9 +197,6 @@ const ToggleSwitch = ({
|
|
|
199
197
|
htmlFor={labelAs === "label" ? nameId : null}
|
|
200
198
|
padding="0"
|
|
201
199
|
>
|
|
202
|
-
{srOnlyLabel && (
|
|
203
|
-
<span style={SCREEN_READER_ONLY}>{srOnlyLabel}</span>
|
|
204
|
-
)}
|
|
205
200
|
{label}
|
|
206
201
|
</Box>
|
|
207
202
|
)}
|