<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { validProps } from '../../../utils/ether';
import { StyledCheckableInput, StyledCheckableInputWrapper } from './checkable-input.style';
import FormField from '../form-field';
import HiddenCheckableInput from './hidden-checkable-input.component';
import guid from '../../../utils/helpers/guid';

const CheckableInput = (props) => {
  const inputId = guid();

  const formFieldProps = {
    ...validProps({ propTypes: CheckableInput.propTypes, safeProps: ['fieldHelpInline'], props }),
    labelFor: inputId,
    labelHelpIcon: 'info',
    reverse: !props.reverse
  };

  const {
    children, fieldHelp, labelHelp, ...inputProps
  } = {
    ...validProps({ propTypes: CheckableInput.propTypes, safeProps: ['disabled', 'onChange', 'type'], props }),
    id: inputId
  };

  return (
    <StyledCheckableInputWrapper>
      <FormField { ...formFieldProps }>
        <StyledCheckableInput>
          <HiddenCheckableInput { ...inputProps } />
          {props.children}
        </StyledCheckableInput>
      </FormField>
    </StyledCheckableInputWrapper>
  );
};

CheckableInput.propTypes = {
  /** Set the value of the CheckableInput */<commit_msg>Fix GUID bug by re-writing as class. Fix label / name prop<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { validProps } from '../../../utils/ether';
import { StyledCheckableInput, StyledCheckableInputWrapper } from './checkable-input.style';
import FormField from '../form-field';
import HiddenCheckableInput from './hidden-checkable-input.component';
import guid from '../../../utils/helpers/guid';

class CheckableInput extends React.Component {
  constructor(props) {
    super(props);
    this.inputId = guid();
  }

  formFieldProps = (props) => {
    return {
      ...validProps(this, 'fieldHelpInline'),
      name: this.inputId,
      labelHelpIcon: 'info',
      reverse: !props.reverse
    };
  }

  inputProps = () => {
    const {
      children, fieldHelp, labelHelp, ...inputProps
    } = {
      ...validProps(this, ['disabled', 'onChange', 'type']),
      id: this.inputId
    };

    return inputProps;
  };

  render() {
    return (
      <StyledCheckableInputWrapper>
        <FormField { ...this.formFieldProps(this.props) }>
          <StyledCheckableInput>
            <HiddenCheckableInput { ...this.inputProps(this.props) } />
            {this.props.children}
          </StyledCheckableInput>
        </FormField>
      </StyledCheckableInputWrapper>
    );
  }
}

CheckableInput.propTypes = {
  /** Set the value of the CheckableInput */
{'fraction_non_alphanumeric': 0.14800759013282733, 'fraction_numerical': 0.0, 'mean_word_length': 3.0060790273556233, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 20, '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': '3439105', 'n_tokens_mistral': 784, 'n_tokens_neox': 774, 'n_words': 173}