<commit_before>/* eslint-disable react/display-name */

import React from 'react';
import PropTypes from 'prop-types';
import { storiesOf, action } from '@kadira/storybook';
import { shape } from 'airbnb-prop-types';

import RadioGroup from '../../components/radio-group';
import Radio from '../../components/radio-group/radio';
import Icon from '../../components/icon';

import { RADIO_GROUP } from '../../utilities/constants';

class RadioGroupExample extends React.Component {

	constructor (props) {
		super(props);
		this.state = {};
		this.onChange = this.onChange.bind(this);
	}

	onChange (event) {
		this.setState({ checked: event.target.value });
		action('onChange')(event);
	}

	render () {
		const values = ['Radio Label One', 'Radio Label Two'];
		return (
			<div>
				<h1 className="slds-text-title_caps slds-p-vertical--medium">
					{this.props.heading}
				</h1>
				<RadioGroup
					labels={this.props.labels}
					onChange={this.onChange}
					disabled={this.props.disabled}
					required={this.props.required}
				>
					{values.map((value) =>
						<Radio
							key={value}
							id={value}
							label={value}
							value={value}
							checked={this.state.checked === value}
							variant="base"
						/>)}
				</RadioGroup>
			</div>
		);
	}

}

RadioGroupExample.propTypes = {
	labels: shape({
		error: PropTypes.string,
		label: PropTypes.string
	}),
	disabled: PropTypes.bool,
	required: PropTypes.bool,
	heading: PropTypes.string
};

RadioGroupExample.defaultProps = {
	labels: { label: 'Radio Group Label' }
};

storiesOf(RADIO_GROUP, module)
	.addDecorator((getStory) => <div className="slds-p-around--medium">{getStory()}</div>)
	.add('Base', () => <RadioGroupExample heading="Base" />)
	.add('Disabled', () => <RadioGroupExample heading="Disabled" disabled />)
	.add('Required', () => <RadioGroupExample heading="Required" required />)
	.add('Error', () => <RadioGroupExample heading="Error" labels={{ label: 'Radio Group Label', error: 'There is an error' }} />);
<commit_msg>update storybook import to @storybook/react in radio-group example<commit_after>/* eslint-disable react/display-name */

import React from 'react';
import PropTypes from 'prop-types';
import { storiesOf, action } from '@storybook/react';
import { shape } from 'airbnb-prop-types';

import RadioGroup from '../../components/radio-group';
import Radio from '../../components/radio-group/radio';
import Icon from '../../components/icon';

import { RADIO_GROUP } from '../../utilities/constants';

class RadioGroupExample extends React.Component {

	constructor (props) {
		super(props);
		this.state = {};
		this.onChange = this.onChange.bind(this);
	}

	onChange (event) {
		this.setState({ checked: event.target.value });
		action('onChange')(event);
	}

	render () {
		const values = ['Radio Label One', 'Radio Label Two'];
		return (
			<div>
				<h1 className="slds-text-title_caps slds-p-vertical--medium">
					{this.props.heading}
				</h1>
				<RadioGroup
					labels={this.props.labels}
					onChange={this.onChange}
					disabled={this.props.disabled}
					required={this.props.required}
				>
					{values.map((value) => (
						<Radio
							key={value}
							id={value}
							label={value}
							value={value}
							checked={this.state.checked === value}
							variant="base"
						/>
					))}
				</RadioGroup>
			</div>
		);
	}
}

RadioGroupExample.propTypes = {
	labels: shape({
		error: PropTypes.string,
		label: PropTypes.string
	}),
	disabled: PropTypes.bool,
	required: PropTypes.bool,
	heading: PropTypes.string
};

RadioGroupExample.defaultProps = {
	labels: { label: 'Radio Group Label' }
};

storiesOf(RADIO_GROUP, module)
	.addDecorator((getStory) => <div className="slds-p-around--medium">{getStory()}</div>)
	.add('Base', () => <RadioGroupExample heading="Base" />)
	.add('Disabled', () => <RadioGroupExample heading="Disabled" disabled />)
	.add('Required', () => <RadioGroupExample heading="Required" required />)
	.add('Error', () => <RadioGroupExample heading="Error" labels={{ label: 'Radio Group Label', error: 'There is an error' }} />);
{'fraction_non_alphanumeric': 0.1747738939134686, 'fraction_numerical': 0.0009777560498655585, 'mean_word_length': 3.6659064994298745, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5694500', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1298, 'n_words': 271}