/** * External dependencies */ import clsx from 'clsx'; import { useInstanceId } from '@wordpress/compose'; import { useMemo } from '@wordpress/element'; /** * Internal dependencies */ import RadioControlOption from './option'; import type { RadioControlProps } from './types'; import './style.scss'; const RadioControl = ( { className = '', id, selected = '', onChange, options = [], disabled = false, highlightChecked = false, }: RadioControlProps ): JSX.Element | null => { const instanceId = useInstanceId( RadioControl ); const radioControlId = id || instanceId; const selectedOptionNumber = useMemo( () => { return options.findIndex( ( option ) => option.value === selected ); }, [ options, selected ] ); if ( ! options.length ) { return null; } return (