'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var styled = require('styled-components');
var index = require('../../../../utils/index.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);

const Wrapper = styled__default['default'].div.withConfig({
    shouldForwardProp: index.convertToTransientProps([
        'isInRange',
        'isStartDay',
        'isEndDay',
        'disabled',
    ]),
}) `
  display: flex;
  justify-content: center;
  align-items: center;
  ${index.getFontSize('size16')};
  cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
  margin: ${index.getSpacing('s02', 's00')};
  padding: 0 1px;

  ${({ isInRange, isStartDay, isEndDay }) => styled.css `
      background: ${isInRange || (isStartDay && !isEndDay)
    ? index.getColorAlias('interactiveSecondary')
    : 'transparent'};
      border-bottom-right-radius: ${isEndDay ? '20px' : '0'};
      border-top-right-radius: ${isEndDay ? '20px' : '0'};
      border-bottom-left-radius: ${isStartDay ? '20px' : '0'};
      border-top-left-radius: ${isStartDay ? '20px' : '0'};
    `}
`;
function getBackgroundColor(isToday, isStartEndDay, disabled) {
    if (isToday && disabled)
        return index.getColorAlias('backgroundDefault');
    if (isStartEndDay)
        return index.getColorAlias('interactivePrimary');
    if (isToday)
        return index.getColorAlias('containerStrong');
    return 'transparent';
}
function getColor(isStartEndDay, isCurrentMonth, disabled) {
    if (disabled)
        return index.getColorAlias('disabled01');
    if (isStartEndDay)
        return index.getColorAlias('contentInteractivePrimary');
    if (!isCurrentMonth)
        return index.getColorAlias('contentDisabled');
    return index.getColorAlias('contentInteractiveTertiary');
}
const DayNum = styled__default['default'].div.withConfig({
    shouldForwardProp: index.convertToTransientProps([
        'isStartEndDay',
        'isToday',
        'isCurrentMonth',
        'width',
    ]),
}) `
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: ${(props) => props.width}px;
  height: ${(props) => props.width}px;
  font-weight: ${(props) => props.isToday
    ? props.theme.font.weightExtrabold
    : props.theme.font.weightRegular};
  color: ${(props) => getColor(props.isStartEndDay, props.isCurrentMonth, props.disabled)};
  border-radius: ${(props) => props.isToday || props.isStartEndDay
    ? props.theme.radius.roundedE
    : props.theme.radius.roundedNone};
  background: ${(props) => getBackgroundColor(props.isToday, props.isStartEndDay, props.disabled)};
  position: relative;

  &:focus {
    border-radius: ${(props) => props.theme.radius.roundedE};
  }

  @media (max-width: 325px) {
    padding: 1px 3px;
  }
`;
const Event = styled__default['default'].div `
  height: 4px;
  width: 4px;
  background-color: ${index.getColorAlias('interactiveBrand')};
  border-radius: ${(props) => props.theme.radius.roundedE};
  position: absolute;
  top: min(30px, 85%);
`;

exports.DayNum = DayNum;
exports.Event = Event;
exports.Wrapper = Wrapper;
