"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.StyledRoot = exports.StyledListItem = exports.StyledListBox = exports.StyledInputContainer = void 0;

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

var _styles = require("../styles");

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(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; }

var StyledRoot = (0, _styles.styled)('div', {});
exports.StyledRoot = StyledRoot;
StyledRoot.displayName = "StyledRoot";
var StyledInputContainer = (0, _styles.styled)('div', {});
exports.StyledInputContainer = StyledInputContainer;
StyledInputContainer.displayName = "StyledInputContainer";
var StyledListBox = (0, _styles.styled)('ul', function (_ref) {
  var $theme = _ref.$theme,
      $width = _ref.$width;
  return {
    backgroundColor: $theme.colors.backgroundPrimary,
    marginBlockStart: 'unset',
    marginBlockEnd: 'unset',
    maxHeight: '200px',
    overflowY: 'auto',
    outline: 'none',
    paddingInlineStart: 'unset',
    width: $width
  };
});
exports.StyledListBox = StyledListBox;
StyledListBox.displayName = "StyledListBox";

function buildStylesForSize(size, theme) {
  var paddingDir = theme.direction === 'rtl' ? 'paddingRight' : 'paddingLeft';

  switch (size) {
    case _input.SIZE.mini:
      return _objectSpread(_objectSpread({}, theme.typography.ParagraphXSmall), {}, _defineProperty({
        height: '30px'
      }, paddingDir, theme.sizing.scale200));

    case _input.SIZE.compact:
      return _objectSpread(_objectSpread({}, theme.typography.ParagraphSmall), {}, _defineProperty({
        height: '36px'
      }, paddingDir, theme.sizing.scale400));

    case _input.SIZE.large:
      return _objectSpread(_objectSpread({}, theme.typography.ParagraphLarge), {}, _defineProperty({
        height: '56px'
      }, paddingDir, theme.sizing.scale650));

    case _input.SIZE.default:
    default:
      return _objectSpread(_objectSpread({}, theme.typography.ParagraphMedium), {}, _defineProperty({
        height: '48px'
      }, paddingDir, theme.sizing.scale550));
  }
}

var StyledListItem = (0, _styles.styled)('li', function (_ref2) {
  var $isSelected = _ref2.$isSelected,
      $theme = _ref2.$theme,
      $size = _ref2.$size;
  return _objectSpread(_objectSpread({}, buildStylesForSize($size, $theme)), {}, {
    alignItems: 'center',
    backgroundColor: $isSelected ? $theme.colors.comboboxListItemFocus : null,
    cursor: 'default',
    display: 'flex',
    listStyle: 'none',
    ':hover': {
      backgroundColor: $isSelected ? null : $theme.colors.comboboxListItemHover
    }
  });
});
exports.StyledListItem = StyledListItem;
StyledListItem.displayName = "StyledListItem";