/*
Copyright (c) 2018-2019 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 { SIZE } from './constants.js';
import { styled, withStyle } from '../styles/index.js';
import { StyledList } from '../menu/index.js';
import { StyledDropdownListItem, StyledRoot as SelectStyledRoot } from '../select/index.js';
import defaultProps from '../select/default-props.js';
export const StyledFlagContainer = styled('span', ({
  $size = SIZE.default,
  $theme: {
    sizing
  }
}) => {
  const sizeToFont = {
    [SIZE.compact]: sizing.scale800,
    [SIZE.default]: sizing.scale900,
    [SIZE.large]: sizing.scale1000
  };
  return {
    fontSize: sizeToFont[$size]
  };
});
StyledFlagContainer.displayName = "StyledFlagContainer";
export const StyledRoot = withStyle(SelectStyledRoot, props => {
  // hard coded widths for the flag dropdown anchor
  const sizeToWidth = {
    [SIZE.compact]: '60px',
    [SIZE.default]: '70px',
    [SIZE.large]: '80px'
  };
  return {
    width: sizeToWidth[props.$size || SIZE.default]
  };
});
StyledRoot.displayName = "StyledRoot";
export const StyledDialCode = styled('div', ({
  $theme: {
    sizing
  }
}) => ({
  marginLeft: sizing.scale100
}));
StyledDialCode.displayName = "StyledDialCode";
export const StyledCountrySelectContainer = styled('div', {
  display: 'flex',
  alignItems: 'center'
});
StyledCountrySelectContainer.displayName = "StyledCountrySelectContainer";
export const StyledCountrySelectDropdownContainer = withStyle(StyledList, props => {
  const {
    $height = defaultProps.maxDropdownHeight
  } = props;
  return {
    height: $height,
    paddingTop: 0,
    paddingBottom: 0
  };
});
StyledCountrySelectDropdownContainer.displayName = "StyledCountrySelectDropdownContainer";
export const StyledCountrySelectDropdownListItem = withStyle(StyledDropdownListItem, {
  paddingTop: 0,
  paddingBottom: 0,
  paddingLeft: 0,
  paddingRight: 0,
  display: 'flex',
  alignItems: 'center',
  height: '42px'
});
StyledCountrySelectDropdownListItem.displayName = "StyledCountrySelectDropdownListItem";
export const StyledCountrySelectDropdownFlagColumn = styled('div', ({
  $theme: {
    sizing
  }
}) => {
  return {
    paddingLeft: sizing.scale600,
    display: 'flex',
    alignItems: 'center'
  };
});
StyledCountrySelectDropdownFlagColumn.displayName = "StyledCountrySelectDropdownFlagColumn";
export const StyledCountrySelectDropdownNameColumn = styled('div', ({
  $theme: {
    sizing
  }
}) => {
  return {
    paddingLeft: sizing.scale600
  };
});
StyledCountrySelectDropdownNameColumn.displayName = "StyledCountrySelectDropdownNameColumn";
export const StyledCountrySelectDropdownDialcodeColumn = styled('div', ({
  $theme: {
    sizing
  }
}) => {
  return {
    paddingRight: sizing.scale600,
    marginLeft: 'auto'
  };
});
StyledCountrySelectDropdownDialcodeColumn.displayName = "StyledCountrySelectDropdownDialcodeColumn";