"use strict";

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

var _css2 = require("@emotion/css");

var _css3 = _interopRequireDefault(_css2);

var _core = require("@emotion/core");

var _propTypes = require("prop-types");

var _propTypes2 = _interopRequireDefault(_propTypes);

var _presets = require("../../utils/presets");

var _input = require("../../theme/styles/input");

var _input2 = _interopRequireDefault(_input);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

// import searchInputBg from "./assets/searchInputBg.svg"
var TextInput = function TextInput(_ref) {
  var _jsx;

  var id = _ref.id,
      placeholder = _ref.placeholder,
      _ref$type = _ref.type,
      type = _ref$type === void 0 ? "text" : _ref$type,
      defaultValue = _ref.defaultValue,
      value = _ref.value,
      disabled = _ref.disabled,
      onChange = _ref.onChange,
      _ref$variant = _ref.variant,
      variant = _ref$variant === void 0 ? "DEFAULT" : _ref$variant;
  var inputStyles = {
    SECONDARY: {
      // backgroundImage: `url(${searchInputBg})`,
      backgroundPosition: "left 0.4rem center",
      backgroundRepeat: "no-repeat",
      backgroundSize: "1.3rem 1.3rem",
      paddingLeft: _presets.spaces.xl,
      position: "relative"
    }
  };
  return (0, _core.jsx)("input", (_jsx = {
    type: type,
    id: id,
    placeholder: placeholder
  }, _defineProperty(_jsx, "type", type), _defineProperty(_jsx, "value", value), _defineProperty(_jsx, "defaultValue", defaultValue), _defineProperty(_jsx, "onChange", onChange), _defineProperty(_jsx, "disabled", disabled), _defineProperty(_jsx, "css",
  /*#__PURE__*/
  (0, _css3["default"])(_objectSpread({}, _input2["default"], {}, inputStyles[variant]), "label:TextInput;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL1RleHRJbnB1dC9UZXh0SW5wdXQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBc0NNIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9jb21wb25lbnRzL1RleHRJbnB1dC9UZXh0SW5wdXQuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IGpzeCB9IGZyb20gXCJAZW1vdGlvbi9jb3JlXCJcbmltcG9ydCBQcm9wVHlwZXMgZnJvbSBcInByb3AtdHlwZXNcIlxuXG5pbXBvcnQgeyBzcGFjZXMgfSBmcm9tIFwiLi4vLi4vdXRpbHMvcHJlc2V0c1wiXG5pbXBvcnQgaW5wdXQgZnJvbSBcIi4uLy4uL3RoZW1lL3N0eWxlcy9pbnB1dFwiXG4vLyBpbXBvcnQgc2VhcmNoSW5wdXRCZyBmcm9tIFwiLi9hc3NldHMvc2VhcmNoSW5wdXRCZy5zdmdcIlxuXG5jb25zdCBUZXh0SW5wdXQgPSAoe1xuICBpZCxcbiAgcGxhY2Vob2xkZXIsXG4gIHR5cGUgPSBgdGV4dGAsXG4gIGRlZmF1bHRWYWx1ZSxcbiAgdmFsdWUsXG4gIGRpc2FibGVkLFxuICBvbkNoYW5nZSxcbiAgdmFyaWFudCA9IGBERUZBVUxUYCxcb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ZXMuYm9vbCxcbiAgb25DaGFuZ2U6IFByb3BUeXBlcy5mdW5jLFxuICB2YXJpYW50OiBQcm9wVHlwZXMub25lT2YoW2BERUZBVUxUYCwgYFNFQ09OREFSWWBdKSxcbn1cblxuZXhwb3J0IGRlZmF1bHQgVGV4dElucHV0XG4iXX0= */"))), _jsx));
};

TextInput.propTypes = {
  id: _propTypes2["default"].string,
  placeholder: _propTypes2["default"].string,
  type: _propTypes2["default"].string,
  defaultValue: _propTypes2["default"].string,
  value: _propTypes2["default"].string,
  disabled: _propTypes2["default"].bool,
  onChange: _propTypes2["default"].func,
  variant: _propTypes2["default"].oneOf(["DEFAULT", "SECONDARY"])
};
exports["default"] = TextInput;