@codecademy/gamut
73.6.173.6.2-alpha.3e37cd.0
dist/Toggle/utils.js~
dist/Toggle/utils.jsModified+5
Index: package/dist/Toggle/utils.js
===================================================================
--- package/dist/Toggle/utils.js
+++ package/dist/Toggle/utils.js
@@ -2,8 +2,9 @@
ariaLabel,
as,
checked,
disabled,
+ inputProps,
label,
onChange,
onClick
}) => {
@@ -14,13 +15,17 @@
checked,
id,
disabled
};
+ // inputProps spreads first so Toggle's own wiring - checked/id/type/role/
+ // aria-checked - always wins over anything a consumer passes in.
return as === 'input' ? {
+ ...inputProps,
...sharedProps,
type: 'checkbox',
onChange
} : {
+ ...inputProps,
...sharedProps,
role: 'switch',
'aria-checked': checked,
onClick,