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    
@skava/ui / dist / forms / input / plugins / Special / AutoSuggestInput.js
Size: Mime:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

const tslib_1 = require("tslib");

const react_1 = tslib_1.__importDefault(require("react"));

const TextBox_1 = tslib_1.__importDefault(require("../../../../inputs/TextBox"));
/**
 * @todo missing this
 */
// import { AutoSuggest } from 'organisms/GoogleAutoComplete'


const isValid_1 = require("../../../deps/isValid");

const InputChain_1 = require("../../InputChain");
/**
 * @todo 1. split to address plugin + autosuggest google plugin
 * @todo @see https://www.the-art-of-web.com/html/html5-form-validation/ (price, long-lat)
 * @see @wcag https://www.w3.org/WAI/tutorials/forms/validation/
 *
 * https://css-tricks.com/form-validation-ux-html-css/
 * ## parse & validate
 * https://github.com/mkoryak/address-validator
 * https://github.com/DamonOehlman/addressit note - this one is similar to what we did in bootstrapper/google/ originally
 * https://www.htmlgoodies.com/beyond/javascript/parsing-building-and-street-fields-from-an-address-using-regular-expressions.html
 */


class AutoSuggestInput extends InputChain_1.InputChain {
  static isSatisfiedByProps(props) {
    return props.type === 'googleAutoSugggest';
  }

  validate() {
    console.dev('AutoSuggestInput_validate');
    const state = this.get('state'); // @@todo when w hav
    // this.isValid = validators.isValid(state.value, state.validationType)

    this.isValid = isValid_1.isValid(state.value, state.validationType);
  }

  render() {
    const state = this.get('state');
    const props = this.get('props');
    console.log('AutoSuggestInput_render', props); // this should be moved as part of the component

    const attributes = Object.assign({}, props, {
      state,
      onChange: value => {
        state.value = value;
      },
      onBlur: value => {
        this.validate();
      }
    });
    return react_1.default.createElement(TextBox_1.default, Object.assign({}, attributes)); // return AutoSuggest once it is fixed
    // return <AutoSuggest {...attributes} />
  }

}

exports.AutoSuggestInput = AutoSuggestInput;
exports.default = AutoSuggestInput; //# sourceMappingURL=AutoSuggestInput.js.map