@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
450 lines (379 loc) • 9.66 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 {
--calcite-alert-dismiss-progress-background: rgba(255, 255, 255, 0.8);
}
:host([theme=dark]) {
--calcite-alert-dismiss-progress-background: rgba(43, 43, 43, 0.8);
}
:host([scale=s]) {
--calcite-alert-width: 40em;
--calcite-alert-spacing-token-small: 0.75rem;
--calcite-alert-spacing-token-large: 1rem;
}
:host([scale=s]) slot[name=alert-title]::slotted(*),
:host([scale=s]) *::slotted([slot=alert-title]) {
font-size: 0.875rem;
line-height: 1.5;
}
:host([scale=s]) slot[name=alert-message]::slotted(*),
:host([scale=s]) *::slotted([slot=alert-message]) {
font-size: 0.8125rem;
line-height: 1.5;
}
:host([scale=s]) ::slotted(calcite-link) {
font-size: 0.8125rem;
line-height: 1.5;
}
:host([scale=m]) {
--calcite-alert-width: 50em;
--calcite-alert-spacing-token-small: 1rem;
--calcite-alert-spacing-token-large: 1.5rem;
}
:host([scale=m]) slot[name=alert-title]::slotted(*),
:host([scale=m]) *::slotted([slot=alert-title]) {
font-size: 0.9375rem;
line-height: 1.5;
}
:host([scale=m]) slot[name=alert-message]::slotted(*),
:host([scale=m]) *::slotted([slot=alert-message]) {
font-size: 0.875rem;
line-height: 1.5;
}
:host([scale=m]) ::slotted(calcite-link) {
font-size: 0.875rem;
line-height: 1.5;
}
:host([scale=l]) {
--calcite-alert-width: 60em;
--calcite-alert-spacing-token-small: 1.2rem;
--calcite-alert-spacing-token-large: 1.875rem;
}
:host([scale=l]) slot[name=alert-title]::slotted(*),
:host([scale=l]) *::slotted([slot=alert-title]) {
font-size: 1rem;
line-height: 1.5;
}
:host([scale=l]) slot[name=alert-message]::slotted(*),
:host([scale=l]) *::slotted([slot=alert-message]) {
font-size: 0.9375rem;
line-height: 1.5;
}
:host([scale=l]) ::slotted(calcite-link) {
font-size: 0.9375rem;
line-height: 1.5;
}
:host {
box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);
display: flex;
position: fixed;
justify-content: center;
align-items: center;
pointer-events: none;
margin: 0 auto;
width: var(--calcite-alert-width);
max-width: 90%;
max-height: 0;
background-color: var(--calcite-ui-foreground-1);
border-radius: var(--calcite-border-radius);
opacity: 0;
left: 0;
right: 0;
bottom: 0;
pointer-events: none;
z-index: 101;
transform: translate3d(0, 1.5rem, 0);
transition: 300ms cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity 300ms cubic-bezier(0.215, 0.44, 0.42, 0.88), all 0.15s ease-in-out;
border-top: 0px solid transparent;
}
@media only screen and (max-width: 860px) {
:host {
width: 100%;
max-width: 100%;
border-radius: var(--calcite-border-radius) var(--calcite-border-radius) 0 0;
}
}
.alert-close {
outline-offset: 0;
outline-color: transparent;
transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
}
.alert-close:focus {
outline: 2px solid var(--calcite-ui-blue-1);
outline-offset: -2px;
}
:host([active]:not([queued])) {
opacity: 1;
max-height: 100%;
transform: translate3d(0, -1.5rem, 0);
pointer-events: initial;
border-top-width: 3px;
}
@media only screen and (max-width: 860px) {
:host([active]:not([queued])) {
transform: translate3d(0, 0, 0);
}
}
slot[name=alert-title]::slotted(*),
*::slotted([slot=alert-title]) {
font-size: 1rem;
line-height: 1.5;
color: var(--calcite-ui-text-1);
margin: 0;
font-weight: 500;
}
slot[name=alert-message]::slotted(*),
*::slotted([slot=alert-message]) {
display: inline;
margin: 0;
margin-right: 0.75rem;
font-weight: 400;
font-size: 0.9375rem;
line-height: 1.5;
color: var(--calcite-ui-text-2);
}
:host([dir=rtl]) slot[name=alert-message]::slotted(*),
:host([dir=rtl]) *::slotted([slot=alert-message]) {
margin-right: unset;
margin-left: 0.75rem;
}
.alert-content {
padding: var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large);
flex: 0 0 auto;
transition: all 0.15s ease-in-out;
flex: 1 1 auto;
min-width: 0;
word-wrap: break-word;
padding: var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-small) 0;
}
@media only screen and (max-width: 860px) {
.alert-content {
padding: 1.5rem;
}
}
.alert-content:first-of-type:not(:only-child) {
padding-left: var(--calcite-alert-spacing-token-large);
}
.alert-content:only-child {
padding: var(--calcite-alert-spacing-token-small);
}
@media only screen and (max-width: 860px) {
.alert-content {
padding: var(--calcite-alert-spacing-token-large) var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large) 0;
}
}
:host([dir=rtl]) .alert-content {
padding: var(--calcite-alert-spacing-token-small) 0 var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-small);
}
:host([dir=rtl]) .alert-content:first-of-type:not(:only-child) {
padding-right: var(--calcite-alert-spacing-token-large);
}
@media only screen and (max-width: 860px) {
:host([dir=rtl]) .alert-content {
padding: var(--calcite-alert-spacing-token-large) 0 var(--calcite-alert-spacing-token-large) var(--calcite-alert-spacing-token-small);
}
}
.alert-icon {
padding: var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large);
flex: 0 0 auto;
transition: all 0.15s ease-in-out;
padding-top: 0;
padding-bottom: 0;
display: flex;
align-self: stretch;
align-items: center;
}
@media only screen and (max-width: 860px) {
.alert-icon {
padding: 1.5rem;
}
}
.alert-close {
padding: var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large);
flex: 0 0 auto;
transition: all 0.15s ease-in-out;
padding-top: 0;
padding-bottom: 0;
align-self: stretch;
background-color: transparent;
-webkit-appearance: none;
border: none;
outline: none;
cursor: pointer;
color: var(--calcite-ui-text-3);
overflow: hidden;
border-radius: 0 0 var(--calcite-border-radius) 0;
}
@media only screen and (max-width: 860px) {
.alert-close {
padding: 1.5rem;
}
}
.alert-close:hover, .alert-close:focus {
background-color: var(--calcite-ui-foreground-2);
}
.alert-close:active {
background-color: var(--calcite-ui-foreground-3);
}
@media only screen and (max-width: 860px) {
.alert-close {
border-radius: 0;
}
}
:host([dir=rtl]) .alert-close {
border-radius: 0 0 0 var(--calcite-border-radius);
}
.alert-queue-count {
font-size: 0.875rem;
line-height: 1.5;
display: flex;
align-items: center;
justify-content: space-around;
align-self: stretch;
overflow: hidden;
width: 0;
visibility: hidden;
font-weight: 500;
text-align: center;
color: var(--calcite-ui-text-2);
opacity: 0;
border-left: 0px solid transparent;
border-right: 0px solid transparent;
cursor: default;
transition: all 0.15s ease-in-out;
overflow: hidden;
}
.alert-queue-count.active {
visibility: visible;
opacity: 1;
padding: 0 0.375rem;
width: 3rem;
border-left: 1px solid var(--calcite-ui-border-3);
border-right: 1px solid var(--calcite-ui-border-3);
}
@media only screen and (max-width: 860px) {
.alert-queue-count {
border-radius: 0;
}
}
:host([auto-dismiss]) > .alert-queue-count {
border-right: 0px solid transparent;
}
:host([auto-dismiss][dir=rtl]) > .alert-queue-count {
border-left: 0px solid transparent;
}
.alert-dismiss-progress {
display: block;
position: absolute;
left: 0;
right: 0;
top: -3px;
width: 100%;
height: 3px;
z-index: 103;
overflow: hidden;
border-radius: var(--calcite-border-radius) var(--calcite-border-radius) 0 0;
}
.alert-dismiss-progress:after {
height: 3px;
top: 0;
right: 0;
display: block;
position: absolute;
content: "";
background-color: var(--calcite-alert-dismiss-progress-background);
z-index: 104;
}
:host([dir=rtl]) .alert-dismiss-progress:after {
left: 0;
right: initial;
}
:host([color=blue]) {
border-top-color: var(--calcite-ui-blue-1);
}
:host([color=blue]) .alert-icon {
color: var(--calcite-ui-blue-1);
}
:host([color=red]) {
border-top-color: var(--calcite-ui-red-1);
}
:host([color=red]) .alert-icon {
color: var(--calcite-ui-red-1);
}
:host([color=yellow]) {
border-top-color: var(--calcite-ui-yellow-1);
}
:host([color=yellow]) .alert-icon {
color: var(--calcite-ui-yellow-1);
}
:host([color=green]) {
border-top-color: var(--calcite-ui-green-1);
}
:host([color=green]) .alert-icon {
color: var(--calcite-ui-green-1);
}
:host([auto-dismiss-duration=fast]) .alert-dismiss-progress:after {
animation: dismissProgress 6000ms ease-out;
}
:host([auto-dismiss-duration=medium]) .alert-dismiss-progress:after {
animation: dismissProgress 10000ms ease-out;
}
:host([auto-dismiss-duration=slow]) .alert-dismiss-progress:after {
animation: dismissProgress 14000ms ease-out;
}
@keyframes dismissProgress {
0% {
width: 0;
opacity: 0.8;
}
100% {
width: 100%;
opacity: 1;
}
}