'use strict';

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

var index = require('../../utils/index.js');
var styled = require('styled-components');
var utils = require('../Field/utils.js');
var styles = require('../IconButton/styles.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(['fullWidth']),
}) `
  width: ${(props) => (props.fullWidth ? '100%' : '300px')};
  font-family: ${(props) => props.theme.font.familyPrimary};
`;
const Border = styled__default['default'].div.withConfig({
    shouldForwardProp: index.convertToTransientProps([
        'hasLabel',
        'hasError',
        'stepperVariant',
    ]),
}) `
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: ${(props) => props.disabled &&
    props.stepperVariant &&
    props.stepperVariant.includes('input-form')
    ? index.getColorAlias('disabled01')
    : 'transparent'};
  ${index.getDefaultTransition()};

  &:hover {
    cursor: ${(props) => (props.disabled ? 'not-allowed' : 'auto')};
  }

  ${styles.IconButtonContainer} {
    position: relative;
    top: 0px;
    left: 0px;
  }

  ${(props) => props.stepperVariant === 'input-form' &&
    styled.css `
      border: 1px solid
        ${!props.disabled && props.hasError
        ? index.getColorAlias('contentError')
        : index.getColorAlias('containerDark')};

      border-radius: ${(props) => props.theme.radius.roundedD};

      &:hover {
        background: ${!props.disabled &&
        index.getDarkenColor('hover01', 'backgroundDefault')};
      }
    `}
`;
const NumberField = styled__default['default'].input.withConfig({
    shouldForwardProp: index.convertToTransientProps([
        'hasError',
        'hasLabel',
        'stepperVariant',
        'buttonsDisabled',
        'componentHeight',
    ]),
}) `
  color: ${index.getColorAlias('contentSubdued')};
  font-family: ${(props) => props.theme.font.familyPrimary};
  background: ${({ stepperVariant, buttonsDisabled }) => stepperVariant === 'input' && buttonsDisabled
    ? index.getColorAlias('disabled01')
    : 'transparent'};
  ${(props) => utils.getFieldPadding(props.componentHeight)};
  border: none;
  width: 50%;
  text-align: center;

  ::-webkit-outer-spin-button,
  ::-webkit-inner-spin-button {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    margin: ${index.getSpacing('s00')};
  }

  ${index.getFontSize('size16')};
  ${index.getDefaultTransition()};

  &:hover {
    cursor: ${(props) => (props.buttonsDisabled ? 'not-allowed' : 'auto')};
  }

  ${({ stepperVariant, buttonsDisabled, hasError }) => {
    switch (stepperVariant) {
        case 'high-emphasis-wide': {
            return styled.css `
          font-weight: ${(props) => props.theme.font.weightBold};
          ${index.getFontSize('size24')};
        `;
        }
        case 'high-emphasis-narrow': {
            return styled.css `
          font-weight: ${(props) => props.theme.font.weightBold};
          ${index.getFontSize('size20')};
        `;
        }
        case 'input': {
            return styled.css `
          border: 1px solid
            ${!buttonsDisabled && hasError
                ? index.getColorAlias('contentError')
                : index.getColorAlias('containerDark')};
          margin: ${index.getSpacing('s00', 's02')};
          border-radius: ${(props) => props.theme.radius.roundedD};

          &:hover {
            background: ${!buttonsDisabled &&
                index.getDarkenColor('hover01', 'backgroundDefault')};
          }
        `;
        }
    }
}}
`;
const FocusBorder = styled__default['default'].div `
  margin: 8px 0;
  border-radius: ${(props) => props.theme.radius.roundedD};
  position: relative;
  &:focus-within {
    box-shadow: 0 0 0 2px ${index.getColorAlias('focusOuter')};
  }
`;

exports.Border = Border;
exports.FocusBorder = FocusBorder;
exports.NumberField = NumberField;
exports.Wrapper = Wrapper;
