@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
499 lines (444 loc) • 16.3 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-right {
0% {
opacity: 0;
transform: translate3D(-5px, 0, 0);
}
100% {
opacity: 1;
transform: translate3D(0, 0, 0);
}
}
@keyframes in-left {
0% {
opacity: 0;
transform: translate3D(5px, 0, 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);
}
}
:root {
--calcite-animation-timing: calc(150ms * var(--calcite-internal-duration-factor));
--calcite-internal-duration-factor: var(--calcite-duration-factor, 1);
--calcite-internal-animation-timing-fast: calc(100ms * var(--calcite-internal-duration-factor));
--calcite-internal-animation-timing-medium: calc(200ms * var(--calcite-internal-duration-factor));
--calcite-internal-animation-timing-slow: calc(300ms * var(--calcite-internal-duration-factor));
}
.calcite-animate {
opacity: 0;
animation-fill-mode: both;
animation-duration: var(--calcite-animation-timing);
}
.calcite-animate__in {
animation-name: in;
}
.calcite-animate__in-down {
animation-name: in-down;
}
.calcite-animate__in-up {
animation-name: in-up;
}
.calcite-animate__in-right {
animation-name: in-right;
}
.calcite-animate__in-left {
animation-name: in-left;
}
.calcite-animate__in-scale {
animation-name: in-scale;
}
@media (prefers-reduced-motion: reduce) {
:root {
--calcite-internal-duration-factor: 0.01;
}
}
/* helper to properly scale internal durations */
/**
* Currently only used in Checkbox.
*/
:root {
--calcite-floating-ui-transition: var(--calcite-animation-timing);
--calcite-floating-ui-z-index: var(--calcite-app-z-index-dropdown);
}
:host([hidden]) {
display: none;
}
:host([disabled]) {
cursor: default;
-webkit-user-select: none;
user-select: none;
opacity: var(--calcite-ui-opacity-disabled);
}
:host([disabled]) *,
:host([disabled]) ::slotted(*) {
pointer-events: none;
}
:host {
display: flex;
cursor: pointer;
color: var(--calcite-ui-text-3);
}
:host([disabled]) ::slotted([calcite-hydrated][disabled]),
:host([disabled]) [calcite-hydrated][disabled] {
/* prevent opacity stacking */
opacity: 1;
}
.day-v-wrapper {
flex: 1 1 auto;
}
.day-wrapper {
display: flex;
flex-direction: column;
align-items: center;
}
.day {
display: flex;
align-items: center;
justify-content: center;
border-radius: 9999px;
font-size: var(--calcite-font-size--2);
line-height: 1rem;
line-height: 1;
color: var(--calcite-ui-text-3);
opacity: var(--calcite-ui-opacity-disabled);
outline-color: transparent;
transition: all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;
background: none;
box-shadow: 0 0 0 2px transparent;
}
.text {
margin-block: 1px 0px;
margin-inline-start: 0px;
}
:host([scale=s]) .day-v-wrapper {
padding-block: 0.125rem;
}
:host([scale=s]) .day-wrapper {
padding: 0px;
}
:host([scale=s]) .day {
block-size: 27px;
inline-size: 27px;
font-size: var(--calcite-font-size--2);
}
:host([scale=m]) .day-v-wrapper {
padding-block: 0.25rem;
}
:host([scale=m]) .day-wrapper {
padding-inline: 0.25rem;
}
:host([scale=m]) .day {
block-size: 33px;
inline-size: 33px;
font-size: var(--calcite-font-size--1);
}
:host([scale=l]) .day-v-wrapper {
padding-block: 0.25rem;
}
:host([scale=l]) .day-wrapper {
padding-inline: 0.25rem;
}
:host([scale=l]) .day {
block-size: 43px;
inline-size: 43px;
font-size: var(--calcite-font-size-0);
}
:host([current-month]) .day {
opacity: 1;
}
:host(:hover:not([disabled])) .day,
:host([active]:not([range])) .day {
background-color: var(--calcite-ui-foreground-2);
color: var(--calcite-ui-text-1);
}
:host(:focus),
:host([active]) {
outline: 2px solid transparent;
outline-offset: 2px;
}
:host(:focus:not([disabled])) .day {
outline: 2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));
outline-offset: calc(
2px *
calc(
1 -
2 * clamp(
0,
var(--calcite-ui-focus-offset-invert),
1
)
)
);
box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}
:host([selected]) .day {
font-weight: var(--calcite-font-weight-medium);
background-color: var(--calcite-ui-brand) ;
color: var(--calcite-ui-foreground-1) ;
}
:host([range][selected]) .day-wrapper {
background-color: var(--calcite-ui-foreground-current);
}
:host([start-of-range]) .day-wrapper {
border-start-start-radius: 40%;
border-end-start-radius: 40%;
}
:host([end-of-range]) .day-wrapper {
border-start-end-radius: 40%;
border-end-end-radius: 40%;
}
:host([start-of-range]) :not(.calcite--rtl) .day-wrapper {
box-shadow: inset 4px 0 var(--calcite-ui-foreground-1);
}
:host([start-of-range]) .calcite--rtl .day-wrapper {
box-shadow: inset -4px 0 var(--calcite-ui-foreground-1);
}
:host([start-of-range]) .day {
opacity: 1;
}
:host([end-of-range]) :not(.calcite--rtl) .day-wrapper {
box-shadow: inset -4px 0 var(--calcite-ui-foreground-1);
}
:host([end-of-range]) .calcite--rtl .day-wrapper {
box-shadow: inset 4px 0 var(--calcite-ui-foreground-1);
}
:host([end-of-range]) .day {
opacity: 1;
}
:host([start-of-range]:not(:focus)) :not(.calcite--rtl) .day,
:host([end-of-range]:not(:focus)) :not(.calcite--rtl) .day {
box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}
:host([start-of-range]:not(:focus)) .calcite--rtl .day,
:host([end-of-range]:not(:focus)) .calcite--rtl .day {
box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}
:host([start-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper {
box-shadow: inset 8px 0 var(--calcite-ui-foreground-1);
}
:host([start-of-range][scale=l]) .calcite--rtl .day-wrapper {
box-shadow: inset -8px 0 var(--calcite-ui-foreground-1);
}
:host([end-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper {
box-shadow: inset -8px 0 var(--calcite-ui-foreground-1);
}
:host([end-of-range][scale=l]) .calcite--rtl .day-wrapper {
box-shadow: inset 8px 0 var(--calcite-ui-foreground-1);
}
:host([highlighted]) .day-wrapper {
background-color: var(--calcite-ui-foreground-current);
}
:host([highlighted]) .day-wrapper .day {
color: var(--calcite-ui-text-1);
}
:host([highlighted]:not([active]:focus)) .day {
color: var(--calcite-ui-text-1);
}
:host([range-hover]:not([selected])) .day-wrapper {
background-color: var(--calcite-ui-foreground-2);
}
:host([range-hover]:not([selected])) .day {
border-radius: 0px;
}
:host([start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper {
background-image: linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
border-radius: 0px;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
:host([start-of-range][range-hover]) .calcite--rtl .day-wrapper {
background-image: linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
border-radius: 0px;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
:host([end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper {
background-image: linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
border-radius: 0px;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
:host([end-of-range][range-hover]) .calcite--rtl .day-wrapper {
background-image: linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
border-radius: 0px;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
:host(:hover[end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,
:host(:hover[start-of-range][range-hover]) .calcite--rtl .day-wrapper {
background-image: linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));
border-radius: 0px;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
:host(:hover[start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,
:host(:hover[end-of-range][range-hover]) .calcite--rtl .day-wrapper {
background-image: linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));
border-radius: 0px;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
:host(:hover[range-hover]:not([selected]).focused--start) :not(.calcite--rtl) .day-wrapper {
background-image: linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
}
:host(:hover[range-hover]:not([selected]).focused--start) .calcite--rtl .day-wrapper {
background-image: linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current));
}
:host(:hover[range-hover]:not([selected]).focused--start) .day {
border-radius: 9999px;
opacity: 1;
box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}
:host(:hover[range-hover]:not([selected]).focused--end) :not(.calcite--rtl) .day-wrapper {
background-image: linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current));
}
:host(:hover[range-hover]:not([selected]).focused--end) .calcite--rtl .day-wrapper {
background-image: linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
}
:host(:hover[range-hover]:not([selected]).focused--end) .day {
border-radius: 9999px;
opacity: 1;
box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}
:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day-wrapper,
:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day-wrapper {
background-image: linear-gradient(to right, var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
}
:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day,
:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day {
border-radius: 9999px;
opacity: 1;
box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}
:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day-wrapper,
:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day-wrapper {
background-image: linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));
}
:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day,
:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day {
border-radius: 9999px;
opacity: 1;
box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}
:host(:hover[start-of-range].hover--inside-range.focused--end) .day-wrapper,
:host(:hover[end-of-range].hover--inside-range.focused--start) .day-wrapper {
background-image: none;
}
:host([start-of-range].hover--inside-range.focused--end) .day-wrapper,
:host([end-of-range].hover--inside-range.focused--start) .day-wrapper {
background-color: var(--calcite-ui-foreground-2);
}
:host([highlighted][range-edge=end]) :not(.calcite--rtl) .day-wrapper,
:host([range-hover][range-edge=end]) :not(.calcite--rtl) .day-wrapper,
:host([highlighted][range-edge=start]) .calcite--rtl .day-wrapper,
:host([range-hover][range-edge=start]) .calcite--rtl .day-wrapper {
box-shadow: inset -4px 0px 0px 0px var(--calcite-ui-foreground-1);
}
:host([highlighted][range-edge=start]) :not(.calcite--rtl) .day-wrapper,
:host([range-hover][range-edge=start]) :not(.calcite--rtl) .day-wrapper,
:host([highlighted][range-edge=end]) .calcite--rtl .day-wrapper,
:host([range-hover][range-edge=end]) .calcite--rtl .day-wrapper {
box-shadow: inset 4px 0px 0px 0px var(--calcite-ui-foreground-1);
}
:host([scale=s][highlighted][range-edge=end]) :not(.calcite--rtl) .day-wrapper,
:host([scale=s][range-hover][range-edge=end]) :not(.calcite--rtl) .day-wrapper,
:host([scale=s][highlighted][range-edge=start]) .calcite--rtl .day-wrapper,
:host([scale=s][range-hover][range-edge=start]) .calcite--rtl .day-wrapper {
box-shadow: inset -1px 0px 0px 0px var(--calcite-ui-foreground-1);
}
:host([scale=s][highlighted][range-edge=start]) :not(.calcite--rtl) .day-wrapper,
:host([scale=s][range-hover][range-edge=start]) :not(.calcite--rtl) .day-wrapper,
:host([scale=s][highlighted][range-edge=end]) .calcite--rtl .day-wrapper,
:host([scale=s][range-hover][range-edge=end]) .calcite--rtl .day-wrapper {
box-shadow: inset 1px 0px 0px 0px var(--calcite-ui-foreground-1);
}
:host([scale=l][highlighted][range-edge=start]) :not(.calcite--rtl) .day-wrapper,
:host([scale=l][range-hover][range-edge=start]) :not(.calcite--rtl) .day-wrapper,
:host([scale=l][highlighted][range-edge=end]) .calcite--rtl .day-wrapper,
:host([scale=l][range-hover][range-edge=end]) .calcite--rtl .day-wrapper {
box-shadow: inset 6px 0px 0px 0px var(--calcite-ui-foreground-1);
}
:host([highlighted][range-edge=start]) .day-wrapper,
:host([range-hover][range-edge=start]) .day-wrapper {
border-start-start-radius: 45%;
border-end-start-radius: 45%;
}
:host([highlighted][range-edge=end]) .day-wrapper,
:host([range-hover][range-edge=end]) .day-wrapper {
border-start-end-radius: 45%;
border-end-end-radius: 45%;
}
:host([scale=l][highlighted][range-edge=end]) :not(.calcite--rtl) .day-wrapper,
:host([scale=l][range-hover][range-edge=end]) :not(.calcite--rtl) .day-wrapper,
:host([scale=l][highlighted][range-edge=start]) .calcite--rtl .day-wrapper,
:host([scale=l][range-hover][range-edge=start]) .calcite--rtl .day-wrapper {
box-shadow: inset -6px 0px 0px 0px var(--calcite-ui-foreground-1);
}
@media (forced-colors: active) {
:host(:hover:not([disabled])) .day,
:host([active]:not([range])) .day {
border-radius: 0px;
}
:host([selected]) {
outline: 2px solid canvasText;
}
:host([selected]) .day {
border-radius: 0px;
background-color: highlight;
}
:host([range][selected]) .day-wrapper,
:host([highlighted]) .day-wrapper,
:host([range-hover]:not([selected])) .day-wrapper {
background-color: highlight;
}
:host([range][selected][start-of-range]) .day-wrapper,
:host([range][selected][end-of-range]) .day-wrapper {
background-color: canvas;
}
}