"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Inner = exports.Wrapper = void 0;
const react_toastify_next_1 = require("react-toastify-next");
const styled_1 = require("../../styled");
const constants_1 = require("../constants");
const leaveIn = (0, styled_1.keyframes) `
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0px);
  }
`;
const leaveOut = (0, styled_1.keyframes) `
  from {
    transform: translateX(0px);
  }
  to {
    transform: translateX(100%);
    visibility: hidden;
  }
`;
const leaveInMobile = (0, styled_1.keyframes) `
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0px);
  }
`;
// используем дополнительный враппер,
// потому что styled для ToastContainer не умеет работать с theme внутри
// использовать бэм классы для стилизации пришлось,
// потому что react-toastify не предоставляет,
// достаточно контейнеров для стилизации через styled,
// к примеру добраться до прогресс бара можно только через цсс классы
exports.Wrapper = (0, styled_1.styled)('div', {
    shouldForwardProp: (prop) => !['$isBanner'].includes(prop),
}) `
  ${({ theme }) => theme.breakpoints.up('sm')} {
    ${({ $isBanner, theme }) => $isBanner &&
    `
        position: fixed;
        z-index: ${theme.zIndex.snackbar};
        right: 0;
        bottom: 0;
        width: 432px;
      `}
  }

  .Toastify__toast-container {
    ${({ theme }) => theme.breakpoints.down('sm')} {
      padding: ${({ theme }) => theme.spacing(4)};
    }
  }

  .${constants_1.notifyClassnames.animationIn} {
    animation: ${leaveIn} ease-in-out ${({ theme }) => theme.transitions.duration.standard}ms;
    animation-fill-mode: both;

    ${({ theme }) => theme.breakpoints.down('sm')} {
      animation: ${leaveInMobile} ease-in-out ${({ theme }) => theme.transitions.duration.standard}ms;
      animation-fill-mode: both;
    }
  }

  .${constants_1.notifyClassnames.animationOut} {
    animation: ${leaveOut} ease-in-out ${({ theme }) => theme.transitions.duration.standard}ms;
    animation-fill-mode: both;
  }

  .${constants_1.notifyClassnames.root} {
    margin-bottom: ${({ theme }) => theme.spacing(1)};
    padding: 0;

    border-radius: ${({ theme }) => theme.shape.medium};
    box-shadow: ${({ theme }) => theme.elevation[300]};

    &::after {
      content: '';

      position: absolute;
      top: 0;
      left: 0;

      display: block;

      width: 100%;
      height: 3px;
    }
      ${({ theme }) => theme.breakpoints.up('sm')} {
      min-height: ${constants_1.NOTIFY_HEIGHT};
    }
    ${({ theme }) => theme.breakpoints.down('sm')} {
      min-height: ${constants_1.NOTIFY_HEIGHT_MOBILE};
    }

    ${({ theme }) => theme.breakpoints.down('sm')} {
      margin-bottom: ${({ theme }) => theme.spacing(3)};
    }

    .Toastify__progress-bar--wrp {
      top: 0;

      height: 3px;
    }
    
    .Toastify__progress-bar {
      opacity: 1;
    }

    &--${constants_1.NotificationVariantTypes.Info} {
      --toastify-color-progress-light: ${({ theme }) => theme.palette.primary[800]};
    }
    &--${constants_1.NotificationVariantTypes.Success} {
      --toastify-color-progress-light: ${({ theme }) => theme.palette.success[800]};
    }
    &--${constants_1.NotificationVariantTypes.Warning} {
      --toastify-color-progress-light: ${({ theme }) => theme.palette.warning[800]};
    }
    &--${constants_1.NotificationVariantTypes.Error} {
      --toastify-color-progress-light: ${({ theme }) => theme.palette.error[800]};
    }

    &__body {
      margin: 0;
      padding: 0;
    }

    &__progress {
      top: 0;
      bottom: auto;

      height: 3px;
    }
  }
`;
exports.Inner = (0, styled_1.styled)(react_toastify_next_1.ToastContainer, {
    shouldForwardProp: (prop) => !['$isBanner'].includes(prop),
}) `
  min-width: 400px;
  ${({ theme }) => theme.breakpoints.up('sm')} {
    ${({ $isBanner, theme }) => $isBanner &&
    `
        position: relative !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100%;
        max-width: 432px;
        padding-bottom: 0 !important;
        padding-left: ${theme.spacing(3)} !important;
      `}
  }

  ${({ theme }) => theme.breakpoints.down('sm')} {
    width: 100%;
    min-width: unset;
    max-width: unset;
    padding: ${({ theme }) => theme.spacing(2, 4, 0, 4)};
  }
`;
