<commit_before>import React from 'react'
import ReactDOM from 'react-dom'
import { Form, Field } from 'src'

const FieldWrap = props => {
  const { label, ...rest } = props

  return (
    <Field {...rest}>
      {(inputProps, fieldState, formState) => {
        return (
          <div className="field-wrap">
            <label>{label}</label>
            <div className="input">
              <input {...inputProps} />
            </div>
            <div className="error">
              {fieldState.error}
            </div>
          </div>
        )
      }}
    </Field>
  )
}

class Example extends React.Component {

  validate(values) {
    const errors = {}
    if (!/^[\w\d\.]+@[\w\d]+\.[\w]{2,9}$/.test(values.email)) errors.email = "Invalid Email"
    if (!/^[\w\d]{6,20}$/.test(values.password)) errors.password = "<PASSWORD>"
    return errors
  }

  render() {
    const initialValues = { email: '<EMAIL>', password: '<PASSWORD>' }

    return (
      <Form validate={this.validate} initialValues={initialValues}>
        <FieldWrap label="Email" name="email"  />
        <FieldWrap label="Password" name="password" type="password" />
        <button type="submit">Submit</button>
      </Form>
    )
  }
}

ReactDOM.render(<Example />, document.getElementById('root'))<commit_msg>implied return jsx<commit_after>import React from 'react'
import ReactDOM from 'react-dom'
import { Form, Field } from 'src'

const FieldWrap = props => {
  const { label, ...rest } = props

  return (
    <Field {...rest}>
      {(inputProps, fieldState, formState) => (
        <div className="field-wrap">
          <label>{label}</label>
          <div className="input">
            <input {...inputProps} />
          </div>
          <div className="error">
            {fieldState.error}
          </div>
        </div>
      )}
    </Field>
  )
}

class Example extends React.Component {

  validate(values) {
    const errors = {}
    if (!/^[\w\d\.]+@[\w\d]+\.[\w]{2,9}$/.test(values.email)) errors.email = "Invalid Email"
    if (!/^[\w\d]{6,20}$/.test(values.password)) errors.password = "<PASSWORD>"
    return errors
  }

  onSubmit(values) {
    console.log('Submit Values', values)
    return Promise.resolve()
  }

  render() {
    const initialValues = { email: '<EMAIL>', password: '<PASSWORD>' }

    return (
      <Form validate={this.validate} onSubmit={this.onSubmit} initialValues={initialValues}>
        <FieldWrap label="Email" name="email"  />
        <FieldWrap label="Password" name="password" type="password" />
        <button type="submit">Submit</button>
      </Form>
    )
  }
}

ReactDOM.render(<Example />, document.getElementById('root'))
{'fraction_non_alphanumeric': 0.18117295480014942, 'fraction_numerical': 0.0037355248412401943, 'mean_word_length': 2.437740693196406, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 49, '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': '7193096', 'n_tokens_mistral': 832, 'n_tokens_neox': 818, 'n_words': 171}