Sha256: dd112cb554ce55c8f59029bdcbc3b41026a98b65032dfc820551f6d4f2f72e26

Contents?: true

Size: 1.29 KB

Versions: 30

Compression:

Stored size: 1.29 KB

Contents

/* @flow */
/*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */

import React from 'react'
import Body from '../pb_body/_body.jsx'

type RadioProps = {
  className?: String,
  data?: String,
  error?: Boolean,
  id?: String,
  label: String,
  name: String,
  value: String,
  checked?: Boolean,
  dark?: Boolean,
  text: String,
  children?: Node,
  onChange: (Boolean)=>void,
}

const Radio = (props: RadioProps) => {
  const {
    checked = false,
    children,
    className = '',
    dark = false,
    data,
    error = false,
    id,
    label,
    name,
    value,
    text,
    onChange = () => {},
  } = props

  const errorClass = error ? 'error' : ''

  return (
    <label
        className={'pb_radio_kit' + (dark === true ? '_dark ' : ' ') + errorClass + ' ' + className}
        htmlFor={id}
    >
      <If condition={children}>
        {children}
        <Else />
        <input
            checked={checked}
            data={data}
            name={name}
            onChange={onChange}
            text={text}
            type="radio"
            value={value}
        />
      </If>
      <span className="pb_radio_button" />
      <Body
          dark={dark}
          status={error ? 'negative' : null}
          text={label}
      />
    </label>
  )
}

export default Radio

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
playbook_ui-4.13.1 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.13.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.12.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.11.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.10.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.10.0.pre.alpha1 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.9.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.8.2 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.8.1 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.7.1 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.7.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.6.1 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.6.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.5.2 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.5.1 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.5.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.4.1 app/pb_kits/playbook/pb_radio/_radio.jsx