"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MenuSelector = void 0;
var _react = _interopRequireWildcard(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _Styles = require("./Styles");
var _Input = require("../Input");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
var MenuSelector = exports.MenuSelector = function MenuSelector(_ref) {
  var defaultValue = _ref.defaultValue,
    children = _ref.children,
    placeholder = _ref.placeholder,
    onChange = _ref.onChange,
    onBack = _ref.onBack,
    onEdit = _ref.onEdit,
    _ref$autoFocus = _ref.autoFocus,
    autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
    className = _ref.className,
    onFocus = _ref.onFocus,
    onBlur = _ref.onBlur,
    _ref$autoComplete = _ref.autoComplete,
    autoComplete = _ref$autoComplete === void 0 ? false : _ref$autoComplete;
  var handleChange = (0, _react.useCallback)(function (e) {
    if (typeof onChange === "function") {
      onChange(e.target.value);
    }
  }, [onChange]);
  return /*#__PURE__*/_react.default.createElement(_Styles.StyledMenuSelector, {
    className: (0, _classnames.default)("c-menu-selector", className)
  }, /*#__PURE__*/_react.default.createElement(_Styles.StyledMenuSelectorInner, null, typeof onBack === "function" ? /*#__PURE__*/_react.default.createElement(_Styles.StyledMenuSelectorBack, {
    onClick: onBack,
    width: "16px",
    height: "16px"
  }) : null, /*#__PURE__*/_react.default.createElement(_Input.Input, {
    onChange: handleChange,
    placeholder: placeholder,
    autoFocus: autoFocus,
    defaultValue: defaultValue,
    onFocus: onFocus,
    onBlur: onBlur,
    autoComplete: autoComplete ? "on" : "off"
  }), typeof onEdit === "function" ? /*#__PURE__*/_react.default.createElement(_Styles.StyledMenuSelectorDots, {
    onClick: onEdit
  }) : null), children);
};
MenuSelector.displayName = "MenuSelector";
//# sourceMappingURL=MenuSelector.js.map