<commit_before>'use strict';
import React, {Component} from "react";

export default
  class RadioSet extends Component {
    static defaultProps = {
      defaultValue: "",
      horizontal: false
    }

    render () {
      let {name, options, defaultValue, horizontal} = this.props;
      let pre = horizontal ? "radioset-horizontal" : "radioset"

      return (
        <ul className={pre}>{
          options.map((o, i) => (
            <li key={`radioset-${name}-${i}`} className={`${pre}__item`}>
              <label htmlFor={`${name}-${o.value}`}>
                <input
                  className={`${pre}__radio`}
                  id={`${name}-${o.value}`}
                  type="radio"
                  name={name}
                  value={o.value}
                  defaultChecked={o.value == defaultValue}/>
                <span className={`${pre}__label-text`}>{o.label}</span><commit_msg>Added onChange prop to RadioSet<commit_after>'use strict';
import React, {Component} from "react";

export default
  class RadioSet extends Component {
    static defaultProps = {
      defaultValue: "",
      horizontal: false,
      onChange: function () {}
    }

    onChange (e) {
      let {name, value} = e.target;

      if (name == this.props.name) {
        this.props.onChange(value);
      }
    }

    render () {
      let {name, options, defaultValue, horizontal} = this.props;
      let pre = horizontal ? "radioset-horizontal" : "radioset"

      return (
        <ul className={pre} onChange={this.onChange.bind(this)}>{
          options.map((o, i) => (
            <li key={`radioset-${name}-${i}`} className={`${pre}__item`}>
              <label htmlFor={`${name}-${o.value}`}>
                <input
                  className={`${pre}__radio`}
                  id={`${name}-${o.value}`}
                  type="radio"
                  name={name}
                  value={o.value}
                  defaultChecked={o.value == defaultValue}/>
                <span className={`${pre}__label-text`}>{o.label}</span>
{'fraction_non_alphanumeric': 0.16390243902439025, 'fraction_numerical': 0.0, 'mean_word_length': 1.9510791366906475, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '2616483', 'n_tokens_mistral': 604, 'n_tokens_neox': 591, 'n_words': 116}