@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
197 lines (195 loc) • 3.99 kB
CSS
/*
* Modal component
*
*/
/*
* Utilities
*/
/*
* Modal component
*
*/
@keyframes show-modal {
from {
opacity: 0.1;
transform: translate3d(0, -1rem, 0);
}
to {
transform: translate3d(0, 0, 0);
opacity: 1;
}
}
@keyframes hide-modal {
from {
transform: translate3d(0, 0, 0);
opacity: 1;
}
to {
transform: translate3d(0, 1rem, 0);
opacity: 0;
}
}
@keyframes show-drawer {
to {
transform: translate3d(0, 0, 0);
opacity: 1;
}
}
@keyframes hide-drawer-left {
from {
transform: translate3d(0, 0, 0);
opacity: 1;
}
to {
transform: translate3d(-20rem, 0, 0);
opacity: 0;
}
}
@keyframes hide-drawer-top {
from {
transform: translate3d(0, 0, 0);
opacity: 1;
}
to {
transform: translate3d(0, -20rem, 0);
opacity: 0;
}
}
@keyframes hide-drawer-bottom {
from {
transform: translate3d(0, 0, 0);
opacity: 1;
}
to {
transform: translate3d(0, 20rem, 0);
opacity: 0;
}
}
@keyframes hide-drawer-right {
from {
transform: translate3d(0, 0, 0);
opacity: 1;
}
to {
transform: translate3d(20rem, 0, 0);
opacity: 0;
}
}
@keyframes show-modal-overlay {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes hide-modal-overlay {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
:root {
--modal-z-index: 3000;
--modal-animation-duration: 300ms;
}
html[data-dnb-modal-active] {
-webkit-user-select: none;
user-select: none;
}
html[data-dnb-modal-active] .eufemia-portal-root {
-webkit-user-select: text;
user-select: text;
}
.dnb-modal__content {
position: fixed;
top: 0;
left: 0;
z-index: calc(var(--modal-z-index) + 1);
display: flex;
align-items: center;
justify-content: center;
max-width: 100vw;
width: 100%;
height: 100%;
}
@media screen and (max-width: 40em) {
.dnb-modal__content--auto-fullscreen {
height: auto;
}
}
.dnb-modal__content--fullscreen {
align-items: flex-start;
justify-content: flex-start;
}
.dnb-modal__content--fullscreen .dnb-modal__content__content {
height: auto;
}
.dnb-modal__content--left, .dnb-modal__content--top {
align-items: flex-start;
justify-content: flex-start;
}
.dnb-modal__content--right {
align-items: flex-start;
justify-content: flex-end;
}
.dnb-modal__content--bottom {
align-items: flex-end;
justify-content: flex-start;
}
.dnb-modal__vertical-alignment--top {
padding-top: 5vh;
align-items: flex-start;
}
.dnb-modal__overlay {
position: fixed;
z-index: var(--modal-z-index);
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.dnb-modal-root__inner .dnb-modal__overlay {
animation: hide-modal-overlay var(--modal-animation-duration) ease-out forwards;
}
.dnb-modal-root__inner:last-of-type .dnb-modal__overlay {
animation: show-modal-overlay var(--modal-animation-duration) ease-out;
}
.dnb-modal-root__inner:last-of-type .dnb-modal__overlay--hide {
animation: hide-modal-overlay var(--modal-animation-duration) ease-out forwards;
}
.dnb-modal {
/* stylelint-disable-next-line */
}
html[data-visual-test] .dnb-modal__overlay, .dnb-modal__overlay--no-animation {
animation-delay: 0ms ;
animation-duration: 0ms ;
}
@media (prefers-reduced-motion: reduce) {
.dnb-modal__overlay {
animation-duration: 0.01ms ;
}
}
.dnb-modal-root__inner {
position: relative;
z-index: calc(var(--modal-z-index) + 1);
}
.dnb-modal-root__inner ~ .dnb-modal-root__inner {
z-index: calc(var(--modal-z-index) + 2);
}
.dnb-modal-root__inner ~ .dnb-modal-root__inner ~ .dnb-modal-root__inner {
z-index: calc(var(--modal-z-index) + 3);
}
.dnb-modal-root__inner ~ .dnb-modal-root__inner ~ .dnb-modal-root__inner ~ .dnb-modal-root__inner {
z-index: calc(var(--modal-z-index) + 4);
}
.dnb-modal__close-button {
z-index: calc(var(--modal-z-index) + 1);
}
.dnb-modal__header__bar.dnb-section {
display: flex;
flex-direction: row;
justify-content: space-between;
}