"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = exports.addressInputItemBuilder = void 0;
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _ListItemSelect = _interopRequireDefault(require("../ListItemSelect"));
var _Text = _interopRequireDefault(require("../Text"));
var _Box = _interopRequireDefault(require("../Box"));
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _AddressInputItemSt = require("./AddressInputItem.st.css.js");
var _IconThemeContext = require("../WixDesignSystemIconThemeProvider/IconThemeContext");
var _excluded = ["selected", "hovered"];
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/AddressInputItem/AddressInputItem.tsx";
/** This component is used to display an address item mainly in <AddressInput/> component. */
class AddressInputItem extends _react.default.PureComponent {
  render() {
    var {
      dataHook,
      className,
      secondaryLabel,
      optionLayout,
      mainLabel,
      suffix,
      prefix,
      disabled,
      selected,
      highlighted,
      onClick
    } = this.props;
    var textProps = {
      tagName: 'div',
      ellipsis: true,
      skin: disabled ? 'disabled' : 'standard',
      light: selected
    };
    return /*#__PURE__*/_react.default.createElement(_IconThemeContext.IconThemeContext.Consumer, {
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 44,
        columnNumber: 7
      }
    }, _ref => {
      var _icons$AddressInputIt;
      var {
        icons = {}
      } = _ref;
      var LocationIcon = ((_icons$AddressInputIt = icons.AddressInputItem) == null ? void 0 : _icons$AddressInputIt.Location) || _wixUiIconsCommon.Location;
      var defaultPrefix = prefix !== undefined ? prefix : /*#__PURE__*/_react.default.createElement(LocationIcon, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 48,
          columnNumber: 45
        }
      });
      return /*#__PURE__*/_react.default.createElement(_ListItemSelect.default, {
        dataHook: dataHook,
        className: (0, _AddressInputItemSt.st)(_AddressInputItemSt.classes.root, {
          optionLayout
        }, className),
        subtitle: secondaryLabel,
        title: /*#__PURE__*/_react.default.createElement(_Text.default, (0, _extends2.default)({}, textProps, {
          __self: this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 55,
            columnNumber: 22
          }
        }), mainLabel),
        suffix: /*#__PURE__*/_react.default.createElement(_Box.default, {
          __self: this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 56,
            columnNumber: 23
          }
        }, suffix),
        prefix: /*#__PURE__*/_react.default.createElement(_Box.default, {
          __self: this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 57,
            columnNumber: 23
          }
        }, defaultPrefix),
        ellipsis: true,
        disabled: disabled,
        selected: selected,
        highlighted: highlighted,
        onClick: onClick,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 51,
          columnNumber: 13
        }
      });
    });
  }
}
AddressInputItem.displayName = 'AddressInputItem';
AddressInputItem.defaultProps = {
  optionLayout: 'single-line'
};
var addressInputItemBuilder = _ref2 => {
  var {
    id,
    className,
    prefix,
    mainLabel,
    secondaryLabel,
    suffix,
    disabled,
    dataHook,
    optionLayout,
    onClick,
    displayLabel
  } = _ref2;
  return {
    id,
    disabled,
    overrideOptionStyle: true,
    label: displayLabel,
    value: _ref3 => {
      var {
          selected,
          hovered
        } = _ref3,
        rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
      return /*#__PURE__*/_react.default.createElement(AddressInputItem, (0, _extends2.default)({
        optionLayout: optionLayout,
        dataHook: dataHook,
        className: className,
        prefix: prefix,
        mainLabel: mainLabel,
        secondaryLabel: secondaryLabel,
        suffix: suffix,
        selected: selected,
        highlighted: hovered,
        onClick: onClick
      }, rest, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 89,
          columnNumber: 5
        }
      }));
    }
  };
};
exports.addressInputItemBuilder = addressInputItemBuilder;
var _default = exports.default = AddressInputItem;
//# sourceMappingURL=AddressInputItem.js.map