"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.makeLocationFieldLocation = makeLocationFieldLocation;
exports.PlaceLocationField = void 0;

var _locationField = _interopRequireDefault(require("@opentripplanner/location-field"));

var _styled = require("@opentripplanner/location-field/lib/styled");

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _connectLocationField = _interopRequireDefault(require("../../form/connect-location-field"));

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

/**
 * Create a LocationField location object from a persisted user location object.
 */
function makeLocationFieldLocation(favoriteLocation) {
  const {
    address,
    lat,
    lon
  } = favoriteLocation;
  return {
    lat,
    lon,
    name: address
  };
} // Style and connect LocationField to redux store.


const StyledLocationField = (0, _styledComponents.default)(_locationField.default)`
  margin-bottom: 0;
  width: 100%;
  ${_styled.DropdownContainer} {
    width: 0;
    & > button {
      display: none;
    }
  }
  ${_styled.FormGroup} {
    display: block;
  }
  ${_styled.Input} {
    display: table-cell;
    font-size: 100%;
    line-height: 20px;
    padding: 0;
    width: 100%;

    ::placeholder {
      color: #676767;
    }
  }
  ${_styled.InputGroup} {
    border: none;
    width: 100%;
  }
  ${_styled.InputGroupAddon} {
    display: none;
  }
  ${_styled.MenuItemList} {
    position: absolute;
    ${props => props.static ? 'width: 100%;' : ''}
  }
  ${_styled.MenuItemA} {
    &:focus, &:hover {
      color: inherit;
      text-decoration: none;
    }
  }
  ${_styled.MenuItemA}, ${_styled.MenuItemHeader}, ${_styled.MenuItemLi} {
    ${props => props.static ? 'padding-left: 0; padding-right: 0;' : ''}
  }
`;
/**
 * Styled LocationField for setting a favorite place locations using the geocoder.
 */

const PlaceLocationField = (0, _connectLocationField.default)(StyledLocationField);
exports.PlaceLocationField = PlaceLocationField;

//# sourceMappingURL=place-location-field.js