@ionic/core
Version:
Base components for Ionic
159 lines (148 loc) • 3.88 kB
CSS
:host {
/**
* @prop --background: Background of the modal content
*
* @prop --border-color: Border color of the modal content
* @prop --border-radius: Border radius of the modal content
* @prop --border-width: Border width of the modal content
* @prop --border-style: Border style of the modal content
*
* @prop --min-width: Minimum width of the modal
* @prop --width: Width of the modal
* @prop --max-width: Maximum width of the modal
*
* @prop --min-height: Minimum height of the modal
* @prop --height: Height of the modal
* @prop --max-height: Maximum height of the modal
*
* @prop --backdrop-opacity: Opacity of the backdrop
*/
--width: 100%;
--min-width: auto;
--max-width: auto;
--height: 100%;
--min-height: auto;
--max-height: auto;
--overflow: hidden;
--border-radius: 0;
--border-width: 0;
--border-style: none;
--border-color: transparent;
--background: var(--ion-background-color, #fff);
--box-shadow: none;
--backdrop-opacity: 0;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
position: absolute;
align-items: center;
justify-content: center;
outline: none;
contain: strict;
}
:host(.overlay-hidden) {
display: none;
}
.modal-wrapper,
.modal-shadow {
border-radius: var(--border-radius);
width: var(--width);
min-width: var(--min-width);
max-width: var(--max-width);
height: var(--height);
min-height: var(--min-height);
max-height: var(--max-height);
border-width: var(--border-width);
border-style: var(--border-style);
border-color: var(--border-color);
background: var(--background);
box-shadow: var(--box-shadow);
overflow: var(--overflow);
z-index: 10;
}
.modal-shadow {
position: absolute;
background: transparent;
}
@media only screen and (min-width: 768px) and (min-height: 600px) {
:host {
--width: 600px;
--height: 500px;
--ion-safe-area-top: 0px;
--ion-safe-area-bottom: 0px;
--ion-safe-area-right: 0px;
--ion-safe-area-left: 0px;
}
}
@media only screen and (min-width: 768px) and (min-height: 768px) {
:host {
--width: 600px;
--height: 600px;
}
}
:host:first-of-type {
--backdrop-opacity: var(--ion-backdrop-opacity, 0.4);
}
@media only screen and (min-width: 768px) and (min-height: 600px) {
:host {
--border-radius: 10px;
}
}
.modal-wrapper {
transform: translate3d(0, 100%, 0);
}
@media screen and (max-width: 767px) {
@supports (width: max(0px, 1px)) {
:host(.modal-card) {
--height: calc(100% - max(30px, var(--ion-safe-area-top)) - 10px);
}
}
@supports not (width: max(0px, 1px)) {
:host(.modal-card) {
--height: calc(100% - 40px);
}
}
:host(.modal-card) .modal-wrapper {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
:host-context([dir=rtl]):host(.modal-card) .modal-wrapper, :host-context([dir=rtl]).modal-card .modal-wrapper {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
:host(.modal-card) {
--backdrop-opacity: 0;
--width: 100%;
align-items: flex-end;
}
:host(.modal-card) .modal-shadow {
display: none;
}
:host(.modal-card) ion-backdrop {
pointer-events: none;
}
}
@media screen and (min-width: 768px) {
:host(.modal-card) {
--width: calc(100% - 120px);
--height: calc(100% - (120px + var(--ion-safe-area-top) + var(--ion-safe-area-bottom)));
--max-width: 720px;
--max-height: 1000px;
}
:host(.modal-card) {
--backdrop-opacity: 0;
transition: all 0.5s ease-in-out;
}
:host(.modal-card):first-of-type {
--backdrop-opacity: 0.18;
}
:host(.modal-card) .modal-shadow {
box-shadow: 0px 0px 30px 10px rgba(0, 0, 0, 0.1);
}
}