Source: components/inputs/Input.js

// Generated by github.com/steida/coffee2closure 0.1.12
goog.provide('spark.components.Input');
goog.require('spark.components.Field');

/**
  Input component of Spark Framework.
 */

/**
  @constructor
  @export
  @param   {Object=} options Class options.
  @param   {*=} data Class data
  @extends {spark.components.Field}
 */
spark.components.Input = function(options, data) {
  if (options == null) {
    options = {};
  }
  options.type || (options.type = options['type'] || 'text');
  options.placeholder || (options.placeholder = options['placeholder'] || null);
  spark.components.Input.superClass_.constructor.call(this, options, data);
  if (options.placeholder) {
    this.setPlaceholder(options.placeholder);
  }
  this.on('focus', (function(_this) {
    return function() {
      return _this.addClass('focus');
    };
  })(this));
  this.on('blur', (function(_this) {
    return function() {
      return _this.removeClass('focus');
    };
  })(this));
}
goog.inherits(spark.components.Input, spark.components.Field);

/**
  Sets placeholder attribute.
  @export
  @param {!string} value Placeholder value.
 */
spark.components.Input.prototype.setPlaceholder = function(value) {
  return this.setAttribute('placeholder', value);
};

/**
  Clears placeholder attribute.
  @export
 */
spark.components.Input.prototype.clearPlaceholder = function() {
  return this.removeAttribute('placeholder');
};

/**
  Focus input.
  @export
 */
spark.components.Input.prototype.focus = function() {
  this.getElement().focus();
  return this.addClass('focus');
};
Spark Framework by Fatih Acet
Copyright © 2014 - Fatih Acet
Documentation generated by JSDoc 3.2.2 on 2015-07-19T22:09:29+00:00 using the DocStrap template.