Sha256: bf2fd7f91b4945ceb19427cd123ead7fdb2af38c6f0e2ed8ac50a23793fee7d4

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 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 = ({
  checked = false,
  children,
  className = '',
  dark = false,
  data,
  error = false,
  id,
  label,
  name,
  value,
  text,
  onChange = () => {},
  ...props
}: RadioProps) => {
  const errorClass = error ? 'error' : ''

  return (
    <label
        className={'pb_radio_kit' + (dark === true ? '_dark ' : ' ') + errorClass + ' ' + className}
        htmlFor={id}
    >
      <If condition={children}>
        {children}
        <Else />
        <input
            {...props}
            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

5 entries across 5 versions & 1 rubygems

Version Path
playbook_ui-4.17.0.pre.alpha1 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.16.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.15.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.14.0 app/pb_kits/playbook/pb_radio/_radio.jsx
playbook_ui-4.15.1.alpha1 app/pb_kits/playbook/pb_radio/_radio.jsx