/*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */ import React, { forwardRef } from 'react' import Body from '../pb_body/_body' import classnames from 'classnames' import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props' import { globalProps, GlobalProps } from '../utilities/globalProps' type RadioProps = { aria?: {[key: string]: string}, alignment?: string, checked?: boolean, children?: React.ReactChild[] | React.ReactChild, className?: string, dark?: boolean, data?: {[key: string]: string}, error?: boolean, htmlOptions?: {[key: string]: string | number | boolean | Function}, id?: string, label: string, name?: string, value?: string, text?: string, onChange: (event: React.FormEvent | null)=>void, } & GlobalProps const Radio = ({ aria = {}, alignment, children, className, dark = false, data = {}, error = false, htmlOptions = {}, id, label, name = 'radio_name', text = 'Radio Text', value = 'radio_text', onChange = () => { void 0 }, ...props }: RadioProps, ref: any) => { const ariaProps = buildAriaProps(aria) const dataProps = buildDataProps(data) const htmlProps = buildHtmlProps(htmlOptions) const classes = classnames( buildCss('pb_radio_kit', alignment ), dark ? 'dark': null, error ? 'error': null, globalProps(props), className) const displayRadio = (props: RadioProps & any) => { if (children) return (children) else return ( )} return ( ) } export default forwardRef(Radio)