<commit_before>import {
  createElement as r,
  HTMLAttributes,
  ReactNode,
  ReactType,
  SFC,
} from 'react'
import SequentialId from 'react-sequential-id'
import { wrapDisplayName } from 'recompose'

export interface ILabeledProps<T> extends HTMLAttributes<T> {
  component?: ReactType
  label?: ReactNode
}

export type LabeledProps<P, T> = ILabeledProps<T> & P

export default function labeled(
  BaseComponent: ReactType,
  LabelComponent = 'label',
) {
  const LabeledComponent: SFC<LabeledProps<any, any>> = ({
    children,
    component = 'p',
    hidden,
    label,
    ...props,
  }) =>
    r(SequentialId, {}, (id: string) =>
      r(
        component,
        { hidden },
        r(LabelComponent, { htmlFor: id }, label || children),
        r(BaseComponent, { id, ...props }),
      ),
    )
  LabeledComponent.displayName = wrapDisplayName(
    BaseComponent as any,
    'labeled',
  )
  return LabeledComponent
}<commit_msg>Set type on LabelComponent<commit_after>import {
  createElement as r,
  HTMLAttributes,
  ReactNode,
  ReactType,
  SFC,
} from 'react'
import SequentialId from 'react-sequential-id'
import { wrapDisplayName } from 'recompose'

export interface ILabeledProps<T> extends HTMLAttributes<T> {
  component?: ReactType
  label?: ReactNode
}

export type LabeledProps<P, T> = ILabeledProps<T> & P

export default function labeled(
  BaseComponent: ReactType,
  LabelComponent: ReactType = 'label',
) {
  const LabeledComponent: SFC<LabeledProps<any, any>> = ({
    children,
    component = 'p',
    hidden,
    label,
    ...props,
  }) =>
    r(SequentialId, {}, (id: string) =>
      r(
        component,
        { hidden },
        r(LabelComponent, { htmlFor: id }, label || children),
        r(BaseComponent, { id, ...props }),
      ),
    )
  LabeledComponent.displayName = wrapDisplayName(
    BaseComponent as any,
    'labeled',
  )
  return LabeledComponent
}
{'fraction_non_alphanumeric': 0.12290794979079497, 'fraction_numerical': 0.0, 'mean_word_length': 3.260579064587973, 'pattern_counts': {'":': 0, '<': 15, '<?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': '3813158', 'n_tokens_mistral': 606, 'n_tokens_neox': 606, 'n_words': 150}