{"dependencies":[{"name":"babel-runtime/helpers/extends","loc":{"line":7,"column":24}},{"name":"babel-runtime/helpers/objectWithoutProperties","loc":{"line":11,"column":40}},{"name":"babel-runtime/core-js/object/get-prototype-of","loc":{"line":15,"column":30}},{"name":"babel-runtime/helpers/classCallCheck","loc":{"line":19,"column":31}},{"name":"babel-runtime/helpers/createClass","loc":{"line":23,"column":28}},{"name":"babel-runtime/helpers/possibleConstructorReturn","loc":{"line":27,"column":42}},{"name":"babel-runtime/helpers/inherits","loc":{"line":31,"column":25}},{"name":"simple-assign","loc":{"line":35,"column":28}},{"name":"react","loc":{"line":39,"column":21}},{"name":"prop-types","loc":{"line":43,"column":25}},{"name":"react-dom","loc":{"line":47,"column":24}},{"name":"recompose/shallowEqual","loc":{"line":51,"column":28}},{"name":"../styles/transitions","loc":{"line":55,"column":27}},{"name":"./EnhancedTextarea","loc":{"line":59,"column":32}},{"name":"./TextFieldHint","loc":{"line":63,"column":29}},{"name":"./TextFieldLabel","loc":{"line":67,"column":30}},{"name":"./TextFieldUnderline","loc":{"line":71,"column":34}},{"name":"warning","loc":{"line":75,"column":23}}],"generated":{"js":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _extends2 = require('babel-runtime/helpers/extends');\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');\n\nvar _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);\n\nvar _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _simpleAssign = require('simple-assign');\n\nvar _simpleAssign2 = _interopRequireDefault(_simpleAssign);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _reactDom = require('react-dom');\n\nvar _reactDom2 = _interopRequireDefault(_reactDom);\n\nvar _shallowEqual = require('recompose/shallowEqual');\n\nvar _shallowEqual2 = _interopRequireDefault(_shallowEqual);\n\nvar _transitions = require('../styles/transitions');\n\nvar _transitions2 = _interopRequireDefault(_transitions);\n\nvar _EnhancedTextarea = require('./EnhancedTextarea');\n\nvar _EnhancedTextarea2 = _interopRequireDefault(_EnhancedTextarea);\n\nvar _TextFieldHint = require('./TextFieldHint');\n\nvar _TextFieldHint2 = _interopRequireDefault(_TextFieldHint);\n\nvar _TextFieldLabel = require('./TextFieldLabel');\n\nvar _TextFieldLabel2 = _interopRequireDefault(_TextFieldLabel);\n\nvar _TextFieldUnderline = require('./TextFieldUnderline');\n\nvar _TextFieldUnderline2 = _interopRequireDefault(_TextFieldUnderline);\n\nvar _warning = require('warning');\n\nvar _warning2 = _interopRequireDefault(_warning);\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\nvar getStyles = function getStyles(props, context, state) {\n  var _context$muiTheme = context.muiTheme,\n      baseTheme = _context$muiTheme.baseTheme,\n      _context$muiTheme$tex = _context$muiTheme.textField,\n      floatingLabelColor = _context$muiTheme$tex.floatingLabelColor,\n      focusColor = _context$muiTheme$tex.focusColor,\n      textColor = _context$muiTheme$tex.textColor,\n      disabledTextColor = _context$muiTheme$tex.disabledTextColor,\n      backgroundColor = _context$muiTheme$tex.backgroundColor,\n      errorColor = _context$muiTheme$tex.errorColor;\n\n  var styles = {\n    root: {\n      fontSize: 16,\n      lineHeight: '24px',\n      width: props.fullWidth ? '100%' : 256,\n      height: (props.rows - 1) * 24 + (props.floatingLabelText ? 72 : 48),\n      display: 'inline-block',\n      position: 'relative',\n      backgroundColor: backgroundColor,\n      fontFamily: baseTheme.fontFamily,\n      transition: _transitions2.default.easeOut('200ms', 'height'),\n      cursor: props.disabled ? 'not-allowed' : 'auto'\n    },\n    error: {\n      position: 'relative',\n      bottom: 2,\n      fontSize: 12,\n      lineHeight: '12px',\n      color: errorColor,\n      transition: _transitions2.default.easeOut()\n    },\n    floatingLabel: {\n      color: props.disabled ? disabledTextColor : floatingLabelColor,\n      pointerEvents: 'none'\n    },\n    input: {\n      padding: 0,\n      position: 'relative',\n      width: '100%',\n      border: 'none',\n      outline: 'none',\n      backgroundColor: 'rgba(0,0,0,0)',\n      color: props.disabled ? disabledTextColor : textColor,\n      cursor: 'inherit',\n      font: 'inherit',\n      WebkitOpacity: 1,\n      WebkitTapHighlightColor: 'rgba(0,0,0,0)' // Remove mobile color flashing (deprecated style).\n    },\n    inputNative: {\n      appearance: 'textfield' // Improve type search style.\n    }\n  };\n\n  styles.textarea = (0, _simpleAssign2.default)({}, styles.input, {\n    marginTop: props.floatingLabelText ? 36 : 12,\n    marginBottom: props.floatingLabelText ? -36 : -12,\n    boxSizing: 'border-box',\n    font: 'inherit'\n  });\n\n  // Do not assign a height to the textarea as he handles it on his own.\n  styles.input.height = '100%';\n\n  if (state.isFocused) {\n    styles.floatingLabel.color = focusColor;\n  }\n\n  if (props.floatingLabelText) {\n    styles.input.boxSizing = 'border-box';\n\n    if (!props.multiLine) {\n      styles.input.marginTop = 14;\n    }\n\n    if (state.errorText) {\n      styles.error.bottom = !props.multiLine ? styles.error.fontSize + 3 : 3;\n    }\n  }\n\n  if (state.errorText) {\n    if (state.isFocused) {\n      styles.floatingLabel.color = styles.error.color;\n    }\n  }\n\n  return styles;\n};\n\n/**\n * Check if a value is valid to be displayed inside an input.\n *\n * @param The value to check.\n * @returns True if the string provided is valid, false otherwise.\n */\nfunction isValid(value) {\n  return value !== '' && value !== undefined && value !== null && !(Array.isArray(value) && value.length === 0);\n}\n\nvar TextField = function (_Component) {\n  (0, _inherits3.default)(TextField, _Component);\n\n  function TextField() {\n    var _ref;\n\n    var _temp, _this, _ret;\n\n    (0, _classCallCheck3.default)(this, TextField);\n\n    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n      args[_key] = arguments[_key];\n    }\n\n    return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = TextField.__proto__ || (0, _getPrototypeOf2.default)(TextField)).call.apply(_ref, [this].concat(args))), _this), _this.state = {\n      isFocused: false,\n      errorText: undefined,\n      hasValue: false\n    }, _this.handleInputBlur = function (event) {\n      _this.setState({ isFocused: false });\n      if (_this.props.onBlur) {\n        _this.props.onBlur(event);\n      }\n    }, _this.handleInputChange = function (event) {\n      if (!_this.props.hasOwnProperty('value')) {\n        _this.setState({ hasValue: isValid(event.target.value) });\n      }\n      if (_this.props.onChange) {\n        _this.props.onChange(event, event.target.value);\n      }\n    }, _this.handleInputFocus = function (event) {\n      if (_this.props.disabled) {\n        return;\n      }\n      _this.setState({ isFocused: true });\n      if (_this.props.onFocus) {\n        _this.props.onFocus(event);\n      }\n    }, _this.handleHeightChange = function (event, height) {\n      var newHeight = height + 24;\n      if (_this.props.floatingLabelText) {\n        newHeight += 24;\n      }\n      _reactDom2.default.findDOMNode(_this).style.height = newHeight + 'px';\n    }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);\n  }\n\n  (0, _createClass3.default)(TextField, [{\n    key: 'componentWillMount',\n    value: function componentWillMount() {\n      var _props = this.props,\n          children = _props.children,\n          name = _props.name,\n          hintText = _props.hintText,\n          floatingLabelText = _props.floatingLabelText,\n          id = _props.id;\n\n      var propsLeaf = children ? children.props : this.props;\n\n      this.setState({\n        errorText: this.props.errorText,\n        hasValue: isValid(propsLeaf.value) || isValid(propsLeaf.defaultValue)\n      });\n\n      \"development\" !== \"production\" ? (0, _warning2.default)(name || hintText || floatingLabelText || id, 'Material-UI: We don\\'t have enough information\\n      to build a robust unique id for the TextField component. Please provide an id or a name.') : void 0;\n\n      var uniqueId = name + '-' + hintText + '-' + floatingLabelText + '-' + Math.floor(Math.random() * 0xFFFF);\n      this.uniqueId = uniqueId.replace(/[^A-Za-z0-9-]/gi, '');\n    }\n  }, {\n    key: 'componentWillReceiveProps',\n    value: function componentWillReceiveProps(nextProps) {\n      if (nextProps.disabled && !this.props.disabled) {\n        this.setState({\n          isFocused: false\n        });\n      }\n\n      if (nextProps.errorText !== this.props.errorText) {\n        this.setState({\n          errorText: nextProps.errorText\n        });\n      }\n\n      if (nextProps.children && nextProps.children.props) {\n        nextProps = nextProps.children.props;\n      }\n\n      if (nextProps.hasOwnProperty('value')) {\n        var hasValue = isValid(nextProps.value);\n\n        this.setState({\n          hasValue: hasValue\n        });\n      }\n    }\n  }, {\n    key: 'shouldComponentUpdate',\n    value: function shouldComponentUpdate(nextProps, nextState, nextContext) {\n      return !(0, _shallowEqual2.default)(this.props, nextProps) || !(0, _shallowEqual2.default)(this.state, nextState) || !(0, _shallowEqual2.default)(this.context, nextContext);\n    }\n  }, {\n    key: 'blur',\n    value: function blur() {\n      if (this.input) {\n        this.getInputNode().blur();\n      }\n    }\n  }, {\n    key: 'focus',\n    value: function focus() {\n      if (this.input) {\n        this.getInputNode().focus();\n      }\n    }\n  }, {\n    key: 'select',\n    value: function select() {\n      if (this.input) {\n        this.getInputNode().select();\n      }\n    }\n  }, {\n    key: 'getValue',\n    value: function getValue() {\n      return this.input ? this.getInputNode().value : undefined;\n    }\n  }, {\n    key: 'getInputNode',\n    value: function getInputNode() {\n      return this.props.children || this.props.multiLine ? this.input.getInputNode() : _reactDom2.default.findDOMNode(this.input);\n    }\n  }, {\n    key: '_isControlled',\n    value: function _isControlled() {\n      return this.props.hasOwnProperty('value');\n    }\n  }, {\n    key: 'render',\n    value: function render() {\n      var _this2 = this;\n\n      var _props2 = this.props,\n          children = _props2.children,\n          className = _props2.className,\n          disabled = _props2.disabled,\n          errorStyle = _props2.errorStyle,\n          errorText = _props2.errorText,\n          floatingLabelFixed = _props2.floatingLabelFixed,\n          floatingLabelFocusStyle = _props2.floatingLabelFocusStyle,\n          floatingLabelShrinkStyle = _props2.floatingLabelShrinkStyle,\n          floatingLabelStyle = _props2.floatingLabelStyle,\n          floatingLabelText = _props2.floatingLabelText,\n          fullWidth = _props2.fullWidth,\n          hintText = _props2.hintText,\n          hintStyle = _props2.hintStyle,\n          id = _props2.id,\n          inputStyle = _props2.inputStyle,\n          multiLine = _props2.multiLine,\n          onBlur = _props2.onBlur,\n          onChange = _props2.onChange,\n          onFocus = _props2.onFocus,\n          style = _props2.style,\n          type = _props2.type,\n          underlineDisabledStyle = _props2.underlineDisabledStyle,\n          underlineFocusStyle = _props2.underlineFocusStyle,\n          underlineShow = _props2.underlineShow,\n          underlineStyle = _props2.underlineStyle,\n          rows = _props2.rows,\n          rowsMax = _props2.rowsMax,\n          textareaStyle = _props2.textareaStyle,\n          other = (0, _objectWithoutProperties3.default)(_props2, ['children', 'className', 'disabled', 'errorStyle', 'errorText', 'floatingLabelFixed', 'floatingLabelFocusStyle', 'floatingLabelShrinkStyle', 'floatingLabelStyle', 'floatingLabelText', 'fullWidth', 'hintText', 'hintStyle', 'id', 'inputStyle', 'multiLine', 'onBlur', 'onChange', 'onFocus', 'style', 'type', 'underlineDisabledStyle', 'underlineFocusStyle', 'underlineShow', 'underlineStyle', 'rows', 'rowsMax', 'textareaStyle']);\n      var prepareStyles = this.context.muiTheme.prepareStyles;\n\n      var styles = getStyles(this.props, this.context, this.state);\n      var inputId = id || this.uniqueId;\n\n      var errorTextElement = this.state.errorText && _react2.default.createElement('div', { style: prepareStyles((0, _simpleAssign2.default)(styles.error, errorStyle)) }, this.state.errorText);\n\n      var floatingLabelTextElement = floatingLabelText && _react2.default.createElement(_TextFieldLabel2.default, {\n        muiTheme: this.context.muiTheme,\n        style: (0, _simpleAssign2.default)(styles.floatingLabel, floatingLabelStyle, this.state.isFocused ? floatingLabelFocusStyle : null),\n        shrinkStyle: floatingLabelShrinkStyle,\n        htmlFor: inputId,\n        shrink: this.state.hasValue || this.state.isFocused || floatingLabelFixed,\n        disabled: disabled\n      }, floatingLabelText);\n\n      var inputProps = {\n        id: inputId,\n        ref: function ref(elem) {\n          return _this2.input = elem;\n        },\n        disabled: this.props.disabled,\n        onBlur: this.handleInputBlur,\n        onChange: this.handleInputChange,\n        onFocus: this.handleInputFocus\n      };\n\n      var childStyleMerged = (0, _simpleAssign2.default)(styles.input, inputStyle);\n\n      var inputElement = void 0;\n      if (children) {\n        inputElement = _react2.default.cloneElement(children, (0, _extends3.default)({}, inputProps, children.props, {\n          style: (0, _simpleAssign2.default)(childStyleMerged, children.props.style)\n        }));\n      } else {\n        inputElement = multiLine ? _react2.default.createElement(_EnhancedTextarea2.default, (0, _extends3.default)({\n          style: childStyleMerged,\n          textareaStyle: (0, _simpleAssign2.default)(styles.textarea, styles.inputNative, textareaStyle),\n          rows: rows,\n          rowsMax: rowsMax,\n          hintText: hintText\n        }, other, inputProps, {\n          onHeightChange: this.handleHeightChange\n        })) : _react2.default.createElement('input', (0, _extends3.default)({\n          type: type,\n          style: prepareStyles((0, _simpleAssign2.default)(styles.inputNative, childStyleMerged))\n        }, other, inputProps));\n      }\n\n      var rootProps = {};\n\n      if (children) {\n        rootProps = other;\n      }\n\n      return _react2.default.createElement('div', (0, _extends3.default)({}, rootProps, {\n        className: className,\n        style: prepareStyles((0, _simpleAssign2.default)(styles.root, style))\n      }), floatingLabelTextElement, hintText ? _react2.default.createElement(_TextFieldHint2.default, {\n        muiTheme: this.context.muiTheme,\n        show: !(this.state.hasValue || floatingLabelText && !this.state.isFocused) || !this.state.hasValue && floatingLabelText && floatingLabelFixed && !this.state.isFocused,\n        style: hintStyle,\n        text: hintText\n      }) : null, inputElement, underlineShow ? _react2.default.createElement(_TextFieldUnderline2.default, {\n        disabled: disabled,\n        disabledStyle: underlineDisabledStyle,\n        error: !!this.state.errorText,\n        errorStyle: errorStyle,\n        focus: this.state.isFocused,\n        focusStyle: underlineFocusStyle,\n        muiTheme: this.context.muiTheme,\n        style: underlineStyle\n      }) : null, errorTextElement);\n    }\n  }]);\n  return TextField;\n}(_react.Component);\n\nTextField.defaultProps = {\n  disabled: false,\n  floatingLabelFixed: false,\n  multiLine: false,\n  fullWidth: false,\n  type: 'text',\n  underlineShow: true,\n  rows: 1\n};\nTextField.contextTypes = {\n  muiTheme: _propTypes2.default.object.isRequired\n};\nTextField.propTypes = \"development\" !== \"production\" ? {\n  children: _propTypes2.default.node,\n  /**\n   * The css class name of the root element.\n   */\n  className: _propTypes2.default.string,\n  /**\n   * The text string to use for the default value.\n   */\n  defaultValue: _propTypes2.default.any,\n  /**\n   * Disables the text field if set to true.\n   */\n  disabled: _propTypes2.default.bool,\n  /**\n   * The style object to use to override error styles.\n   */\n  errorStyle: _propTypes2.default.object,\n  /**\n   * The error content to display.\n   */\n  errorText: _propTypes2.default.node,\n  /**\n   * If true, the floating label will float even when there is no value.\n   */\n  floatingLabelFixed: _propTypes2.default.bool,\n  /**\n   * The style object to use to override floating label styles when focused.\n   */\n  floatingLabelFocusStyle: _propTypes2.default.object,\n  /**\n   * The style object to use to override floating label styles when shrunk.\n   */\n  floatingLabelShrinkStyle: _propTypes2.default.object,\n  /**\n   * The style object to use to override floating label styles.\n   */\n  floatingLabelStyle: _propTypes2.default.object,\n  /**\n   * The content to use for the floating label element.\n   */\n  floatingLabelText: _propTypes2.default.node,\n  /**\n   * If true, the field receives the property width 100%.\n   */\n  fullWidth: _propTypes2.default.bool,\n  /**\n   * Override the inline-styles of the TextField's hint text element.\n   */\n  hintStyle: _propTypes2.default.object,\n  /**\n   * The hint content to display.\n   */\n  hintText: _propTypes2.default.node,\n  /**\n   * The id prop for the text field.\n   */\n  id: _propTypes2.default.string,\n  /**\n   * Override the inline-styles of the TextField's input element.\n   * When multiLine is false: define the style of the input element.\n   * When multiLine is true: define the style of the container of the textarea.\n   */\n  inputStyle: _propTypes2.default.object,\n  /**\n   * If true, a textarea element will be rendered.\n   * The textarea also grows and shrinks according to the number of lines.\n   */\n  multiLine: _propTypes2.default.bool,\n  /**\n   * Name applied to the input.\n   */\n  name: _propTypes2.default.string,\n  /** @ignore */\n  onBlur: _propTypes2.default.func,\n  /**\n   * Callback function that is fired when the textfield's value changes.\n   *\n   * @param {object} event Change event targeting the text field.\n   * @param {string} newValue The new value of the text field.\n   */\n  onChange: _propTypes2.default.func,\n  /** @ignore */\n  onFocus: _propTypes2.default.func,\n  /**\n   * Number of rows to display when multiLine option is set to true.\n   */\n  rows: _propTypes2.default.number,\n  /**\n   * Maximum number of rows to display when\n   * multiLine option is set to true.\n   */\n  rowsMax: _propTypes2.default.number,\n  /**\n   * Override the inline-styles of the root element.\n   */\n  style: _propTypes2.default.object,\n  /**\n   * Override the inline-styles of the TextField's textarea element.\n   * The TextField use either a textarea or an input,\n   * this property has effects only when multiLine is true.\n   */\n  textareaStyle: _propTypes2.default.object,\n  /**\n   * Specifies the type of input to display\n   * such as \"password\" or \"text\".\n   */\n  type: _propTypes2.default.string,\n  /**\n   * Override the inline-styles of the\n   * TextField's underline element when disabled.\n   */\n  underlineDisabledStyle: _propTypes2.default.object,\n  /**\n   * Override the inline-styles of the TextField's\n   * underline element when focussed.\n   */\n  underlineFocusStyle: _propTypes2.default.object,\n  /**\n   * If true, shows the underline for the text field.\n   */\n  underlineShow: _propTypes2.default.bool,\n  /**\n   * Override the inline-styles of the TextField's underline element.\n   */\n  underlineStyle: _propTypes2.default.object,\n  /**\n   * The value of the text field.\n   */\n  value: _propTypes2.default.any\n} : {};\nexports.default = TextField;"},"hash":"b49dd5dfbbc585cef0950bddf9f270e5"}