var _excluded = ["item"];

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

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; }

/*
Copyright (c) Uber Technologies, Inc.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import { styled, withWrapper } from '../styles';
import { OPTION_LIST_SIZE } from './constants';
export var StyledList = styled('ul', function (_ref) {
  var $theme = _ref.$theme,
      $isFocusVisible = _ref.$isFocusVisible;
  return {
    backgroundColor: $theme.colors.menuFill,
    position: 'relative',
    marginTop: 0,
    marginBottom: 0,
    marginLeft: 0,
    marginRight: 0,
    paddingTop: $theme.sizing.scale300,
    paddingBottom: $theme.sizing.scale300,
    paddingLeft: 0,
    paddingRight: 0,
    borderTopLeftRadius: $theme.borders.popoverBorderRadius,
    borderTopRightRadius: $theme.borders.popoverBorderRadius,
    borderBottomRightRadius: $theme.borders.popoverBorderRadius,
    borderBottomLeftRadius: $theme.borders.popoverBorderRadius,
    boxShadow: $theme.lighting.shadow600,
    overflow: 'auto',
    ':focus': {
      outline: $isFocusVisible ? "3px solid ".concat($theme.colors.borderAccent) : 'none'
    }
  };
});
StyledList.displayName = "StyledList";
StyledList.displayName = 'StyledList'; // @ts-ignore

function getFontColor(props) {
  if (props.$disabled) {
    return props.$theme.colors.menuFontDisabled;
  }

  if (props.$isHighlighted && props.$isFocused) {
    return props.$theme.colors.menuFontHighlighted;
  }

  if (props.$isHighlighted && !props.$isFocused) {
    return props.$theme.colors.menuFontSelected;
  }

  return props.$theme.colors.menuFontDefault;
} // @ts-ignore


function getBackgroundColor(props) {
  if (props.$disabled) {
    return 'transparent';
  }

  if (props.$isHighlighted) {
    return props.$theme.colors.menuFillHover;
  }

  return 'transparent';
}

export var StyledEmptyState = styled('li', function (props) {
  var $theme = props.$theme,
      $size = props.$size;
  return _objectSpread(_objectSpread({}, $size === OPTION_LIST_SIZE.compact ? $theme.typography.font100 : $theme.typography.font200), {}, {
    position: 'relative',
    display: 'block',
    color: $theme.colors.menuFontDisabled,
    textAlign: 'center',
    cursor: 'not-allowed',
    backgroundColor: 'transparent',
    marginBottom: 0,
    paddingTop: $theme.sizing.scale800,
    paddingBottom: $theme.sizing.scale800,
    paddingRight: $theme.sizing.scale800,
    paddingLeft: $theme.sizing.scale800
  });
});
StyledEmptyState.displayName = "StyledEmptyState";
StyledEmptyState.displayName = 'StyledEmptyState';
export var StyledOptgroupHeader = styled('li', function (props) {
  var paddingX = props.$theme.sizing.scale300;
  var paddingY = props.$theme.sizing.scale200;
  return _objectSpread(_objectSpread({}, props.$theme.typography.font250), {}, {
    color: props.$theme.colors.contentPrimary,
    paddingTop: paddingY,
    paddingBottom: paddingY,
    paddingRight: paddingX,
    paddingLeft: paddingX
  });
});
StyledOptgroupHeader.displayName = "StyledOptgroupHeader";
StyledOptgroupHeader.displayName = 'StyledOptgroupHeader';
export var StyledListItemAnchor = styled('a', function (props) {
  return {
    display: 'block',
    color: getFontColor(props)
  };
});
StyledListItemAnchor.displayName = "StyledListItemAnchor";
StyledListItemAnchor.displayName = 'StyledListItemAnchor';
export var StyledListItemElement = styled('li', function (props) {
  var $disabled = props.$disabled,
      $theme = props.$theme,
      $size = props.$size;
  return _objectSpread(_objectSpread({}, $size === OPTION_LIST_SIZE.compact ? $theme.typography.font100 : $theme.typography.font200), {}, {
    boxSizing: 'border-box',
    position: 'relative',
    display: 'block',
    color: getFontColor(props),
    cursor: $disabled ? 'not-allowed' : 'pointer',
    backgroundColor: getBackgroundColor(props),
    transitionProperty: 'color, background-color',
    transitionDuration: $theme.animation.timing200,
    transitionTimingFunction: $theme.animation.easeOutCurve,
    marginBottom: 0,
    paddingTop: $size === OPTION_LIST_SIZE.compact ? $theme.sizing.scale100 : $theme.sizing.scale300,
    paddingBottom: $size === OPTION_LIST_SIZE.compact ? $theme.sizing.scale100 : $theme.sizing.scale300,
    paddingRight: $size === OPTION_LIST_SIZE.compact ? $theme.sizing.scale900 : $theme.sizing.scale600,
    paddingLeft: $size === OPTION_LIST_SIZE.compact ? $theme.sizing.scale900 : $theme.sizing.scale600,
    ':focus': {
      outline: 'none'
    }
  });
});
StyledListItemElement.displayName = "StyledListItemElement";
StyledListItemElement.displayName = 'StyledListItemElement'; // @ts-ignore

export var StyledListItem = withWrapper(StyledListItemElement, function (Styled) {
  return (// eslint-disable-next-line @typescript-eslint/no-unused-vars
    function StyledListItem(_ref2) {
      var item = _ref2.item,
          restProps = _objectWithoutProperties(_ref2, _excluded);

      return /*#__PURE__*/React.createElement(Styled, restProps);
    }
  );
});
export var StyledListItemProfile = styled('li', function (_ref3) {
  var $theme = _ref3.$theme;
  return {
    position: 'relative',
    display: 'flex',
    alignItems: 'center',
    cursor: 'pointer',
    paddingTop: $theme.sizing.scale300,
    paddingBottom: $theme.sizing.scale300,
    paddingRight: $theme.sizing.scale800,
    paddingLeft: $theme.sizing.scale800,
    transitionProperty: 'color, background-color',
    transitionDuration: $theme.animation.timing200,
    transitionTimingFunction: $theme.animation.easeOutCurve,
    ':hover': {
      backgroundColor: $theme.colors.menuFillHover
    }
  };
});
StyledListItemProfile.displayName = "StyledListItemProfile";
StyledListItemProfile.displayName = 'StyledListItemProfile';
export var StyledProfileImgContainer = styled('div', {
  width: '60px',
  height: '60px',
  display: 'flex',
  justifyContent: 'center',
  alignItems: 'center'
});
StyledProfileImgContainer.displayName = "StyledProfileImgContainer";
StyledProfileImgContainer.displayName = 'StyledProfileImgContainer';
export var StyledProfileImg = styled('img', {
  width: '100%',
  height: '100%',
  borderTopLeftRadius: '50%',
  borderTopRightRadius: '50%',
  borderBottomRightRadius: '50%',
  borderBottomLeftRadius: '50%'
});
StyledProfileImg.displayName = "StyledProfileImg";
StyledProfileImg.displayName = 'StyledProfileImg';
export var StyledProfileLabelsContainer = styled('div', function (_ref4) {
  var _ref4$$theme = _ref4.$theme,
      direction = _ref4$$theme.direction,
      sizing = _ref4$$theme.sizing;
  return _objectSpread({
    alignSelf: direction === 'rtl' ? 'flex-end' : 'flex-start',
    display: 'flex',
    flexDirection: 'column'
  }, direction === 'rtl' ? {
    marginRight: sizing.scale600
  } : {
    marginLeft: sizing.scale600
  });
});
StyledProfileLabelsContainer.displayName = "StyledProfileLabelsContainer";
StyledProfileLabelsContainer.displayName = 'StyledProfileLabelsContainer';
export var StyledProfileTitle = styled('h6', function (_ref5) {
  var $theme = _ref5.$theme;
  return _objectSpread(_objectSpread({}, $theme.typography.font350), {}, {
    color: $theme.colors.contentPrimary,
    marginTop: 0,
    marginBottom: 0,
    marginLeft: 0,
    marginRight: 0
  });
});
StyledProfileTitle.displayName = "StyledProfileTitle";
StyledProfileTitle.displayName = 'StyledProfileTitle';
export var StyledProfileSubtitle = styled('p', function (_ref6) {
  var $theme = _ref6.$theme;
  return _objectSpread(_objectSpread({}, $theme.typography.font200), {}, {
    color: $theme.colors.contentPrimary,
    marginTop: 0,
    marginBottom: 0,
    marginLeft: 0,
    marginRight: 0
  });
});
StyledProfileSubtitle.displayName = "StyledProfileSubtitle";
StyledProfileSubtitle.displayName = 'StyledProfileSubtitle';
export var StyledProfileBody = styled('p', function (_ref7) {
  var $theme = _ref7.$theme;
  return _objectSpread(_objectSpread({}, $theme.typography.font100), {}, {
    color: $theme.colors.contentPrimary,
    marginTop: 0,
    marginBottom: 0,
    marginLeft: 0,
    marginRight: 0
  });
});
StyledProfileBody.displayName = "StyledProfileBody";
StyledProfileBody.displayName = 'StyledProfileBody';
export var StyledMenuDivider = styled('li', function (_ref8) {
  var $theme = _ref8.$theme;
  return {
    color: $theme.colors.contentPrimary,
    borderBottomWidth: $theme.borders.border300.borderWidth,
    borderBottomStyle: $theme.borders.border300.borderStyle,
    borderBottomColor: $theme.borders.border300.borderColor,
    marginTop: $theme.sizing.scale100,
    marginBottom: $theme.sizing.scale100,
    marginLeft: $theme.sizing.scale500,
    marginRight: $theme.sizing.scale500,
    listStyle: 'none',
    height: 0
  };
});
StyledMenuDivider.displayName = "StyledMenuDivider";
StyledProfileBody.displayName = 'StyledMenuDivider';