<commit_before>/**
 * BooleanControl
 *
 * Renders an input which allows you to modify a certain property of type boolean
 */

import React from 'react';
import Select from '../../../common/Select';
import randomValue from './randomValue';

const BooleanControl = (props) => {
  const { label, value, onUpdate, secondaryLabel } = props;
  return (
    <Select
      label={label}
      secondaryLabel={secondaryLabel}
      onChange={(event) => {
        // Need to eval, because we're getting 'true' and 'false' (strings)
        // instead of true and false (booleans) here
        const newValue = eval(event.target.value); // eslint-disable-line no-eval
        return onUpdate({ value: newValue });
      }}
      value={value}
      options={[
        {
          value: true,
          label: 'true',
        }, {
          value: false,
          label: 'false',
        },
      ]}
      onRandomClick={() => onUpdate({ value: BooleanControl.randomValue(props) })}
    />
  );
};

/**
 * Generates a random boolean value
 */
BooleanControl.randomValue = randomValue;

export default BooleanControl;<commit_msg>fancy BooleanControl<commit_after>/**
 * BooleanControl
 *
 * Renders an input which allows you to modify a certain property of type boolean
 */

import React from 'react';
import randomValue from './randomValue';
import Row from '../../../form/Grid/Row';
import LeftColumn from '../../../form/Grid/LeftColumn';
import RightColumn from '../../../form/Grid/RightColumn';
import AtriumInput from '../../../form/AtriumInput';
import Label from '../../../form/Label';
import BooleanInput from '../../../form/BooleanInput';

const BooleanControl = (props) => {
  const { label, value, onUpdate, secondaryLabel } = props;
  return (
    <Row>
      <LeftColumn>
        <Label
          type={secondaryLabel}
          propKey={label}
        />
      </LeftColumn>
      <RightColumn>
        <div style={{ padding: '0 0.5em' }}>
          <AtriumInput
            value={value}
            fallbackValue=""
            onChange={onUpdate}
            hasRandomButton
            hasSettings
            inputComponent={BooleanInput}
            onRandomButtonClick={() => onUpdate({ value: BooleanControl.randomValue(props) })}
          />
        </div>
      </RightColumn>
    </Row>
  );
};

/**
 * Generates a random boolean value
 */
BooleanControl.randomValue = randomValue;

export default BooleanControl;
{'fraction_non_alphanumeric': 0.1424454508027995, 'fraction_numerical': 0.0012350761630300535, 'mean_word_length': 2.3703190013869624, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 19, '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': '4442952', 'n_tokens_mistral': 649, 'n_tokens_neox': 656, 'n_words': 186}