Sha256: 5697d9ee84625c27b92b7983ed4d712334b10fd2bb2433eb49d46de3bf30f85a
Contents?: true
Size: 1.68 KB
Versions: 16
Compression:
Stored size: 1.68 KB
Contents
/* @flow */ /*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 } from '../utilities/props' import { globalProps } from '../utilities/globalProps' type RadioProps = { aria?: object, alignment?: String, checked?: Boolean, children?: Node, className?: String, dark?: boolean, data?: object, error?: Boolean, id?: String, label: String, name: String, value: String, text: String, onChange: (Boolean)=>void, } const Radio = ({ aria = {}, alignment = '', children, className, dark = false, data = {}, error = false, id, label, name = 'radio_name', text = 'Radio Text', value = 'radio_text', onChange = () => {}, ...props }: RadioProps, ref) => { const ariaProps = buildAriaProps(aria) const dataProps = buildDataProps(data) const classes = classnames(buildCss('pb_radio_kit'), { error }, { dark }, globalProps(props), alignment, className) return ( <label {...ariaProps} {...dataProps} className={classes} htmlFor={id} > <If condition={children}> {children} <Else /> <input {...props} id={id} name={name} onChange={onChange} ref={ref} text={text} type="radio" value={value} /> </If> <span className="pb_radio_button" /> <Body dark={dark} status={error ? 'negative' : null} text={label} /> </label> ) } export default forwardRef(Radio)
Version data entries
16 entries across 16 versions & 1 rubygems