Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
// import { isSafe } from 'exotic'
// import { observable, extendObservable } from 'xmobx/mobx'
// import { isValid } from 'src/forms/deps'
// import { InputType } from 'src/forms'
// import { fromEventToValue as toValue } from './_deps'
// import { TextBoxState, TextBoxComponent } from './typings'
import { InputState as State } from 'src/forms/input/InputState'

// /**
//  * @todo - should be replaced by uxui form state
//  */
// class State implements TextBoxState {
//   input: TextBoxComponent
//   value: string = ''
//   isFocused: boolean = false
//   hasValidationError: boolean = false
//   isValidInput: boolean = true
//   type: InputType

//   static types = {
//     value: '',
//     isFocused: false,

//     hasValidationError: false,
//     isValidInput: true,
//   }
//   constructor() {
//     extendObservable(this, State.types)
//   }

//   updateFocused(event: Event, instance: any) {
//     if (!event || event.target.value === '') {
//       this.isFocused = !this.isFocused
//     }
//   }
//   // don't think this is as applicable for textbox eh :-D
//   // would make to extend this for DropDown
//   setType(type: InputType) {
//     this.type = type
//   }
//   setIsValid(state: boolean) {
//     this.isValidInput = state
//     return this
//   }
//   validateInput = (event: Event, instance: TextBoxComponent) => {
//     const value = toValue(event)
//     this.isValidInput = isValid(value, this.validationType)
//   }
//   setValue = (value: string) => {
//     if (isSafe(value)) {
//       this.value = value
//     } else {
//       this.value = ''
//     }
//   }
//   setInputReference = dom => {
//     this.input = dom
//   }
// }

console.log('State: ', State)

export { State }
export default State