<commit_before>:doc
  @name UIInputItem
  @prop {Boolean} [multiLine]
  @prop {Boolean} [noTemplate]
  @prop {Boolean} [readonly]
  @prop {Boolean} [required]
  @prop {Boolean} [shouldAutoFocus]
  @prop {Function} [onBlur]
  @prop {Function} [onChange]
  @prop {Function} [onFocus]
  @prop {Function} [onSaveStart]
  @prop {Function} [onSaveFinish]
  @prop {Function} [onSaveError]
  @prop {Number} [maxLength]
  @prop {Number} [minLength]
  @prop {Object} [template]
  @prop {String} [className]
  @prop {String} [defaultValue]
  @prop {String} [type]
  @prop {String} [valueKey]

import {KEY_NAMES} from 'ui-kit/utils/keybinding.js'
import AutoInputSave from 'ui-kit/controls/auto-input-save'
import GrowingInput from '../growing-input'

var.
  componentProps = {
    defaultValue: props.defaultValue,
    maxLength: props.maxLength,
    minLength: props.minLength,
    placeholder: props.placeholder,
    readonly: props.readonly,
    required: props.required,
    shouldAutoFocus: props.shouldAutoFocus,
    style: props.style,
    tabIndex: props.tabIndex,
    type: props.multiLine ? 'textarea' : props.type
  }

var classFn = this.composeClasses('MUIInputItem', {'value': !!state.hasValue, 'multi': componentProps.type === 'textarea', 'labeled': !!props.label, 'focused': state.hasFocus})

var useAutoId = (!!props.label || !!props.labelBlock) && !props.inputId
var inputId = useAutoId ? this.getNextUid('MUIInputItemComponent') : props.inputId
var labelFor = useAutoId ? this.getNextUid('MUIInputItemComponent') : props.inputId
var labelClass = classFn('&-label')
var value = (state.value || state.value === '' ) ? state.value : props.defaultValue

.is-input(className=classFn())
  if props.template
    AutoInputSave(className=classFn('&-auto-save') template=props.template valueKey=props.valueKey onStart=props.onSaveStart onFinish=props.onSaveFinish onError=props.onSaveError)
      block input(savedValue, fns)
        div(className=classFn('&-content'))
          yield actions
          if componentProps.type !== 'textarea' && !props.multiLine
            input(autoFocus=props.shouldAutoFocus name=props.name id=inputId className=classFn('&-input') onKeyDown=this.onKeyDown.bind(null, fns.onChange) onFocus=this.onInputFocus onBlur=this.onInputBlur onChange=this.onChange.bind(null, fns.onChange) value=value)&props(componentProps)
          else
            GrowingInput(name=props.name id=inputId className=classFn('&-input') onKeyDown=this.onKeyDown.bind(null, fns.onChange) onFocus=props.onFocus onBlur=props.onBlur onChange=this.onChange.bind(null, fns.onChange))&props(componentProps)
          if !!props.label
            label(for=labelFor className=labelClass)=props.label
          yield labelBlock(labelFor, labelClass, state) 
        yield icon
  else if props.noTemplate
    div(className=classFn('&-content'))
      yield actions
      if componentProps.type !== 'textarea' && !props.multiLine
        input(autoFocus=props.shouldAutoFocus name=props.name id=inputId className=classFn('&-input') onKeyDown=this.onKeyDown.bind(null, false) onFocus=this.onInputFocus onBlur=this.onInputBlur onChange=this.onChange.bind(null, false) value=value)&props(componentProps)
      else
        GrowingInput(name=props.name id=inputId className=classFn('&-input') onKeyDown=this.onKeyDown.bind(null, onChange) onFocus=props.onFocus onBlur=props.onBlur onChange=this.onChange.bind(null, onChange))&props(componentProps)
      if !!props.label
        label(for=labelFor className=labelClass)=props.label
      yield labelBlock(labelFor, labelClass, state)    
    yield icon

:module
  export var mixins = [require('ui-kit/mixins/compose-classes'), require('unique-id-mixin')]

  export function getDefaultProps () {
    return {
      saveOnChange: true,
      submitOnEnter: true,
      type: 'text',<commit_msg>forgot a couple more removing onchanges<commit_after>:doc
  @name UIInputItem
  @prop {Boolean} [multiLine]
  @prop {Boolean} [noTemplate]
  @prop {Boolean} [readonly]
  @prop {Boolean} [required]
  @prop {Boolean} [shouldAutoFocus]
  @prop {Function} [onBlur]
  @prop {Function} [onChange]
  @prop {Function} [onFocus]
  @prop {Function} [onSaveStart]
  @prop {Function} [onSaveFinish]
  @prop {Function} [onSaveError]
  @prop {Number} [maxLength]
  @prop {Number} [minLength]
  @prop {Object} [template]
  @prop {String} [className]
  @prop {String} [defaultValue]
  @prop {String} [type]
  @prop {String} [valueKey]

import {KEY_NAMES} from 'ui-kit/utils/keybinding.js'
import AutoInputSave from 'ui-kit/controls/auto-input-save'
import GrowingInput from '../growing-input'

var.
  componentProps = {
    defaultValue: props.defaultValue,
    maxLength: props.maxLength,
    minLength: props.minLength,
    placeholder: props.placeholder,
    readonly: props.readonly,
    required: props.required,
    shouldAutoFocus: props.shouldAutoFocus,
    style: props.style,
    tabIndex: props.tabIndex,
    type: props.multiLine ? 'textarea' : props.type
  }

var classFn = this.composeClasses('MUIInputItem', {'value': !!state.hasValue, 'multi': componentProps.type === 'textarea', 'labeled': !!props.label, 'focused': state.hasFocus})

var useAutoId = (!!props.label || !!props.labelBlock) && !props.inputId
var inputId = useAutoId ? this.getNextUid('MUIInputItemComponent') : props.inputId
var labelFor = useAutoId ? this.getNextUid('MUIInputItemComponent') : props.inputId
var labelClass = classFn('&-label')
var value = (state.value || state.value === '' ) ? state.value : props.defaultValue

.is-input(className=classFn())
  if props.template
    AutoInputSave(className=classFn('&-auto-save') template=props.template valueKey=props.valueKey onStart=props.onSaveStart onFinish=props.onSaveFinish onError=props.onSaveError)
      block input(savedValue, fns)
        div(className=classFn('&-content'))
          yield actions
          if componentProps.type !== 'textarea' && !props.multiLine
            input(autoFocus=props.shouldAutoFocus name=props.name id=inputId className=classFn('&-input') onKeyDown=this.onKeyDown.bind(null, fns.onChange) onFocus=this.onInputFocus onBlur=this.onInputBlur onChange=this.onChange.bind(null, fns.onChange) value=value)&props(componentProps)
          else
            GrowingInput(name=props.name id=inputId className=classFn('&-input') onKeyDown=this.onKeyDown.bind(null, fns.onChange) onFocus=props.onFocus onBlur=props.onBlur onChange=this.onChange.bind(null, fns.onChange))&props(componentProps)
          if !!props.label
            label(for=labelFor className=labelClass)=props.label
          yield labelBlock(labelFor, labelClass, state) 
        yield icon
  else if props.noTemplate
    div(className=classFn('&-content'))
      yield actions
      if componentProps.type !== 'textarea' && !props.multiLine
        input(autoFocus=props.shouldAutoFocus name=props.name id=inputId className=classFn('&-input') onKeyDown=this.onKeyDown.bind(null, false) onFocus=this.onInputFocus onBlur=this.onInputBlur onChange=this.onChange.bind(null, false) value=value)&props(componentProps)
      else
        GrowingInput(name=props.name id=inputId className=classFn('&-input') onKeyDown=this.onKeyDown.bind(null, false) onFocus=props.onFocus onBlur=props.onBlur onChange=this.onChange.bind(null, false))&props(componentProps)
      if !!props.label
        label(for=labelFor className=labelClass)=props.label
      yield labelBlock(labelFor, labelClass, state)    
    yield icon

:module
  export var mixins = [require('ui-kit/mixins/compose-classes'), require('unique-id-mixin')]

  export function getDefaultProps () {
    return {
      saveOnChange: true,
      submitOnEnter: true,
      type: 'text',
{'fraction_non_alphanumeric': 0.13215400624349635, 'fraction_numerical': 0.0, 'mean_word_length': 4.695555555555556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2988587', 'n_tokens_mistral': 2446, 'n_tokens_neox': 2411, 'n_words': 476}