import { backdropClasses } from '@mui/material/Backdrop';
import MuiDialog from '@mui/material/Dialog';
import { dialogActionsClassnames } from '../DialogActions';
import { dialogContentClassnames } from '../DialogContent';
import { styled } from '../styled';
import { DIALOG_SIZES, dialogClassnames } from './constants';
const getSize = (size) => {
    return DIALOG_SIZES[size] || DIALOG_SIZES.md;
};
export const StyledDialog = styled(MuiDialog, {
    shouldForwardProp: (prop) => !['$size'].includes(prop),
}) `
  &.${dialogClassnames.root} .${backdropClasses.root} {
    background-color: ${({ theme }) => theme.palette.background.modalShadow};
  }

  &.${dialogClassnames.withoutTitle} {
    & .${dialogContentClassnames.root} {
      padding-top: ${({ theme }) => theme.spacing(6)};
    }
  }

  .${dialogClassnames.paper} {
    min-width: ${({ $size }) => getSize($size).minWidth};
    max-width: ${({ $size }) => getSize($size).maxWidth};

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

  /* Причина игнора: Не критично для отображения */
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
  &:not(:has(.${dialogActionsClassnames.root})) .${dialogContentClassnames.root} {
    padding-bottom:  ${({ theme }) => theme.spacing(6)};
  }
`;
