From ee5d593349212b68bc076c271c2f7d63ba47eabb Mon Sep 17 00:00:00 2001 From: Tyler Jones Date: Fri, 14 Feb 2025 14:41:00 -0500 Subject: [PATCH 1/3] Remove the sx! --- packages/react/src/Radio/Radio.tsx | 50 ++---------------------------- 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/packages/react/src/Radio/Radio.tsx b/packages/react/src/Radio/Radio.tsx index be740965bc7..ba15b5e06d7 100644 --- a/packages/react/src/Radio/Radio.tsx +++ b/packages/react/src/Radio/Radio.tsx @@ -1,13 +1,9 @@ import type {ChangeEventHandler, InputHTMLAttributes, ReactElement} from 'react' import React, {useContext} from 'react' -import type {SxProp} from '../sx' -import type {FormValidationStatus} from '../utils/types/FormValidationStatus' import {RadioGroupContext} from '../RadioGroup/RadioGroup' import {clsx} from 'clsx' import classes from './Radio.module.css' import sharedClasses from '../Checkbox/shared.module.css' -import {defaultSxProp} from '../utils/defaultSxProp' -import Box from '../Box' export type RadioProps = { /** @@ -35,30 +31,14 @@ export type RadioProps = { * Indicates whether the radio button must be checked before the form can be submitted */ required?: boolean - /** - * Only used to inform ARIA attributes. Individual radio inputs do not have validation styles. - */ - validationStatus?: FormValidationStatus -} & InputHTMLAttributes & - SxProp +} & InputHTMLAttributes /** * An accessible, native radio component for selecting one option from a list. */ const Radio = React.forwardRef( ( - { - checked, - disabled, - name: nameProp, - onChange, - sx: sxProp = defaultSxProp, - required, - validationStatus, - value, - className, - ...rest - }: RadioProps, + {checked, disabled, name: nameProp, onChange, required, value, className, ...rest}: RadioProps, ref, ): ReactElement => { const radioGroupContext = useContext(RadioGroupContext) @@ -75,31 +55,7 @@ const Radio = React.forwardRef( ) } - if (sxProp !== defaultSxProp) { - return ( - // eslint-disable-next-line github/a11y-role-supports-aria-props - - ) - } - return ( - // eslint-disable-next-line github/a11y-role-supports-aria-props ( checked={checked} aria-checked={checked ? 'true' : 'false'} required={required} - aria-required={required ? 'true' : 'false'} - aria-invalid={validationStatus === 'error' ? 'true' : 'false'} onChange={handleOnChange} className={clsx(className, sharedClasses.Input, classes.Radio)} {...rest} From 06cfd67324f72242594140543f32124b274a8071 Mon Sep 17 00:00:00 2001 From: Tyler Jones Date: Fri, 14 Feb 2025 14:44:29 -0500 Subject: [PATCH 2/3] Remove dev story --- packages/react/src/Radio/Radio.dev.stories.tsx | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 packages/react/src/Radio/Radio.dev.stories.tsx diff --git a/packages/react/src/Radio/Radio.dev.stories.tsx b/packages/react/src/Radio/Radio.dev.stories.tsx deleted file mode 100644 index 56dcf214241..00000000000 --- a/packages/react/src/Radio/Radio.dev.stories.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react' -import {Box, FormControl, Radio} from '..' - -export default { - title: 'Components/Radio/Dev', - component: Radio, -} - -export const SxProp = () => { - return ( - - - - Label - - - ) -} From c7eef8d5d6314cf64579c2e52edde6886cfe6066 Mon Sep 17 00:00:00 2001 From: Tyler Jones Date: Fri, 14 Feb 2025 18:43:50 -0500 Subject: [PATCH 3/3] Remove unneeded test --- packages/react/src/__tests__/Radio.test.tsx | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/packages/react/src/__tests__/Radio.test.tsx b/packages/react/src/__tests__/Radio.test.tsx index 194d0f744c2..820e97e4ae8 100644 --- a/packages/react/src/__tests__/Radio.test.tsx +++ b/packages/react/src/__tests__/Radio.test.tsx @@ -151,23 +151,6 @@ describe('Radio', () => { expect(radio).toHaveAttribute('aria-checked', 'true') }) - it('renders an invalid aria state when validation prop indicates an error', () => { - const handleChange = jest.fn() - const {getByRole, rerender} = render() - - const radio = getByRole('radio') as HTMLInputElement - - expect(radio).toHaveAttribute('aria-invalid', 'false') - - rerender() - - expect(radio).toHaveAttribute('aria-invalid', 'false') - - rerender() - - expect(radio).toHaveAttribute('aria-invalid', 'true') - }) - it('renders an aria state indicating the field is required', () => { const handleChange = jest.fn() const {getByRole, rerender} = render()