@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
503 lines (423 loc) • 9.2 kB
CSS
/* mixins & extensions */
@keyframes in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes in-down {
0% {
opacity: 0;
transform: translate3D(0, -5px, 0);
}
100% {
opacity: 1;
transform: translate3D(0, 0, 0);
}
}
@keyframes in-up {
0% {
opacity: 0;
transform: translate3D(0, 5px, 0);
}
100% {
opacity: 1;
transform: translate3D(0, 0, 0);
}
}
@keyframes in-scale {
0% {
opacity: 0;
transform: scale3D(0.95, 0.95, 1);
}
100% {
opacity: 1;
transform: scale3D(1, 1, 1);
}
}
/**
* Currently only used in Checkbox.
*/
:root {
--calcite-popper-transition: 150ms ease-in-out;
}
:host([hidden]) {
display: none;
}
:host {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
overflow-y: hidden;
color: var(--calcite-ui-text-2);
opacity: 0;
visibility: hidden ;
transition: visibility 0ms linear 300ms, opacity 300ms cubic-bezier(0.215, 0.44, 0.42, 0.88);
z-index: 101;
}
:host([scale=s]) {
--calcite-modal-padding: 0.75rem;
--calcite-modal-padding-large: 1rem;
--calcite-modal-title-text: var(--calcite-font-size-1);
--calcite-modal-content-text: var(--calcite-font-size--1);
}
:host([scale=m]) {
--calcite-modal-padding: 1rem;
--calcite-modal-padding-large: 1.25rem;
--calcite-modal-title-text: var(--calcite-font-size-2);
--calcite-modal-content-text: var(--calcite-font-size-0);
}
:host([scale=l]) {
--calcite-modal-padding: 1.25rem;
--calcite-modal-padding-large: 1.5rem;
--calcite-modal-title-text: var(--calcite-font-size-3);
--calcite-modal-content-text: var(--calcite-font-size-1);
}
.scrim {
--calcite-scrim-background: rgba(0, 0, 0, 0.75);
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
overflow-y: hidden;
}
.modal {
display: flex;
flex-direction: column;
box-shadow: 0 2px 12px -4px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.16);
box-sizing: border-box;
float: none;
margin: 1.5rem;
border-radius: 0.25rem;
background-color: var(--calcite-ui-foreground-1);
width: 100%;
opacity: 0;
pointer-events: none;
overflow: hidden;
z-index: 102;
-webkit-overflow-scrolling: touch;
visibility: hidden;
transition: transform 300ms cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear 300ms, opacity 300ms cubic-bezier(0.215, 0.44, 0.42, 0.88);
transform: translate3d(0, 20px, 0);
}
:host([active]) {
opacity: 1;
visibility: visible ;
transition-delay: 0ms;
}
:host([active]) .modal {
opacity: 1;
pointer-events: auto;
visibility: visible;
transform: translate3d(0, 0, 0);
transition: transform 300ms cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear, opacity 300ms cubic-bezier(0.215, 0.44, 0.42, 0.88), max-width 300ms cubic-bezier(0.215, 0.44, 0.42, 0.88), max-height 300ms cubic-bezier(0.215, 0.44, 0.42, 0.88);
transition-delay: 0ms;
}
/**
* Header
*/
.header {
display: flex;
max-width: 100%;
min-width: 0;
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem;
background-color: var(--calcite-ui-foreground-1);
border-width: 0;
border-bottom-width: 1px;
border-style: solid;
border-color: var(--calcite-ui-border-3);
flex: 0 0 auto;
z-index: 2;
}
.close {
margin: 0;
-webkit-appearance: none;
appearance: none;
border-style: none;
color: var(--calcite-ui-text-1);
order: 2;
cursor: pointer;
border-top-right-radius: 0.25rem;
background-color: transparent;
outline-offset: 0;
outline-color: transparent;
transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
padding: var(--calcite-modal-padding);
flex: 0 0 auto;
transition: all 0.15s ease-in-out;
}
.close calcite-icon {
pointer-events: none;
vertical-align: -2px;
}
.close:focus {
outline: 2px solid var(--calcite-ui-brand);
outline-offset: -2px;
}
.close:hover, .close:focus {
background-color: var(--calcite-ui-foreground-2);
}
.close:active {
background-color: var(--calcite-ui-foreground-2);
}
.calcite--rtl .close {
border-top-left-radius: 0.25rem;
border-top-right-radius: 0;
}
.title {
display: flex;
align-items: center;
order: 1;
min-width: 0;
flex: 1 1 auto;
padding: var(--calcite-modal-padding) var(--calcite-modal-padding-large);
}
slot[name=header]::slotted(*),
*::slotted([slot=header]) {
margin: 0;
font-weight: var(--calcite-font-weight-normal);
color: var(--calcite-ui-text-1);
font-size: var(--calcite-modal-title-text);
}
/**
* Content area
*/
.content {
position: relative;
padding: 0;
height: 100%;
overflow: auto;
display: block;
background-color: var(--calcite-ui-foreground-1);
box-sizing: border-box;
max-height: calc(100vh - 12rem);
z-index: 1;
}
.content--spaced {
padding: var(--calcite-modal-padding) var(--calcite-modal-padding-large);
}
.content--no-footer {
border-bottom-right-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
}
slot[name=content]::slotted(*),
*::slotted([slot=content]) {
font-size: var(--calcite-modal-content-text);
}
:host([background-color=grey]) .content {
background-color: var(--calcite-ui-background);
}
/**
* Footer
*/
.footer {
display: flex;
justify-content: space-between;
margin-top: auto;
box-sizing: border-box;
border-bottom-right-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
width: 100%;
background-color: var(--calcite-ui-foreground-1);
border-width: 0;
border-top-width: 1px;
border-style: solid;
border-color: var(--calcite-ui-border-3);
flex: 0 0 auto;
padding: var(--calcite-modal-padding) var(--calcite-modal-padding-large);
z-index: 2;
}
.footer--hide-back .back,
.footer--hide-secondary .secondary {
display: none;
}
.back {
display: block;
margin-right: auto;
}
.calcite--rtl .back {
margin-left: auto;
margin-right: 0;
}
.secondary {
display: block;
margin-left: 0.25rem;
margin-right: 0.25rem;
}
slot[name=primary] {
display: block;
}
/**
* Sizes
*/
:host([width=small]) .modal {
width: auto;
}
:host([width=s]) .modal {
max-width: 32rem;
}
@media screen and (max-width: 35rem) {
:host([width=s]) .modal {
height: 100%;
max-height: 100%;
width: 100%;
max-width: 100%;
margin: 0;
border-radius: 0;
}
:host([width=s]) .content {
flex: 1 1 auto;
max-height: unset;
}
:host([width=s][docked]) {
align-items: flex-end;
}
}
:host([width=m]) .modal {
max-width: 48rem;
}
@media screen and (max-width: 51rem) {
:host([width=m]) .modal {
height: 100%;
max-height: 100%;
width: 100%;
max-width: 100%;
margin: 0;
border-radius: 0;
}
:host([width=m]) .content {
flex: 1 1 auto;
max-height: unset;
}
:host([width=m][docked]) {
align-items: flex-end;
}
}
:host([width=l]) .modal {
max-width: 94rem;
}
@media screen and (max-width: 97rem) {
:host([width=l]) .modal {
height: 100%;
max-height: 100%;
width: 100%;
max-width: 100%;
margin: 0;
border-radius: 0;
}
:host([width=l]) .content {
flex: 1 1 auto;
max-height: unset;
}
:host([width=l][docked]) {
align-items: flex-end;
}
}
/**
* Fullscreen
*/
:host([fullscreen]) {
background-color: transparent;
}
:host([fullscreen]) .modal {
height: 100%;
max-height: 100%;
width: 100%;
max-width: 100%;
margin: 0;
transform: translate3D(0, 20px, 0) scale(0.95);
}
:host([fullscreen]) .content {
max-height: 100%;
flex: 1 1 auto;
}
:host([active][fullscreen]) .modal {
transform: translate3D(0, 0, 0) scale(1);
}
:host([active][fullscreen]) .header {
border-radius: 0;
}
:host([active][fullscreen]) .footer {
border-radius: 0;
}
/**
* Docked
*/
:host([docked]) .modal {
height: auto;
}
:host([docked]) .content {
height: auto;
flex: 1 1 auto;
}
@media screen and (max-width: 860px) {
:host([docked]) .modal {
border-radius: var(--calcite-border-radius) var(--calcite-border-radius) 0 0;
}
:host([docked]) .close {
border-radius: 0 var(--calcite-border-radius) 0 0;
}
}
@media screen and (max-width: 860px) {
:host([docked]) .calcite--rtl .close {
border-radius: var(--calcite-border-radius) var(--calcite-border-radius) 0 0;
}
}
/**
* Colors
*/
:host([color=red]) .modal {
border-color: var(--calcite-ui-danger);
}
:host([color=blue]) .modal {
border-color: var(--calcite-ui-info);
}
:host([color=red]) .modal,
:host([color=blue]) .modal {
border-width: 0;
border-top-width: 4px;
border-style: solid;
}
:host([color=red]) .header,
:host([color=blue]) .header {
border-radius: 0.25rem;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
/**
* Tablet
*/
@media screen and (max-width: 860px) {
slot[name=header]::slotted(*),
*::slotted([slot=header]) {
font-size: var(--calcite-font-size-1);
}
.footer {
position: sticky;
bottom: 0;
}
}
/**
* Mobile
*/
@media screen and (max-width: 480px) {
.footer {
flex-direction: column;
}
.calcite--rtl .back,
.back,
.secondary {
margin: 0;
margin-bottom: 0.25rem;
}
}