@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
469 lines (425 loc) • 12.2 kB
CSS
@charset "UTF-8";
/* 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;
}
.scale--s {
--calcite-slider-handle-size: 0.625rem;
--calcite-slider-handle-extension-height: 0.4rem;
--calcite-slider-container-font-size: var(--calcite-font-size--3);
}
.scale--s .handle__label,
.scale--s .tick__label{
line-height: .75rem;
}
.scale--m {
--calcite-slider-handle-size: 0.875rem;
--calcite-slider-handle-extension-height: 0.5rem;
--calcite-slider-container-font-size: var(--calcite-font-size--2);
}
.scale--m .handle__label,
.scale--m .tick__label{
line-height: 1rem;
}
.scale--l {
--calcite-slider-handle-size: 1rem;
--calcite-slider-handle-extension-height: 0.65rem;
--calcite-slider-container-font-size: var(--calcite-font-size--1);
}
.scale--l .handle__label,
.scale--l .tick__label{
line-height: 1rem;
}
.handle__label,
.tick__label{
font-weight: var(--calcite-font-weight-medium);
color: var(--calcite-ui-text-2);
font-size: var(--calcite-slider-container-font-size);
}
:host{
display: block;
}
.container{
position: relative;
display: block;
overflow-wrap: normal;
word-break: normal;
padding-inline: calc(var(--calcite-slider-handle-size) * 0.5);
padding-block: calc(var(--calcite-slider-handle-size) * 0.5);
margin-block: calc(var(--calcite-slider-handle-size) * 0.5);
margin-inline: 0;
--calcite-slider-full-handle-height: calc(
var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height)
);
touch-action: none;
}
:host([disabled]) .track__range,
:host([disabled]) .tick--active {
background-color: var(--calcite-ui-text-3);
}
:host([disabled]) ::slotted([calcite-hydrated][disabled]),
:host([disabled]) [calcite-hydrated][disabled] {
/* prevent opacity stacking */
opacity: 1;
}
.scale--s .thumb:not(.thumb--precise) {
--calcite-slider-thumb-y-offset: -0.375rem;
}
.scale--m .thumb:not(.thumb--precise) {
--calcite-slider-thumb-y-offset: -0.5rem;
}
.scale--l .thumb:not(.thumb--precise) {
--calcite-slider-thumb-y-offset: -0.55rem;
}
:host([precise]:not([has-histogram])) .container .thumb--value {
--calcite-slider-thumb-y-offset: calc(var(--calcite-slider-full-handle-height) * -1);
}
.thumb-container{
position: relative;
max-inline-size: 100%;
}
.thumb {
--calcite-slider-thumb-x-offset: calc(var(--calcite-slider-handle-size) * 0.5);
position: absolute;
margin: 0px;
display: flex;
cursor: pointer;
flex-direction: column;
align-items: center;
border-style: none;
background-color: transparent;
padding: 0px;
font-family: inherit;
outline: 2px solid transparent;
outline-offset: 2px;
transform: translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset));
}
.thumb .handle__label.static, .thumb .handle__label.transformed{
position: absolute;
inset-block: 0px;
opacity: 0;
}
.thumb .handle__label.hyphen::after {
content: "—";
display: inline-block;
inline-size: 1em;
}
.thumb .handle__label.hyphen--wrap {
display: flex;
}
.thumb .handle{
box-sizing: border-box;
border-radius: 9999px;
background-color: var(--calcite-ui-foreground-1);
outline-color: transparent;
block-size: var(--calcite-slider-handle-size);
inline-size: var(--calcite-slider-handle-size);
box-shadow: 0 0 0 2px var(--calcite-ui-text-3) inset;
transition: border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease;
}
.thumb .handle-extension{
inline-size: 0.125rem;
block-size: var(--calcite-slider-handle-extension-height);
background-color: var(--calcite-ui-text-3);
}
.thumb:hover .handle {
box-shadow: 0 0 0 3px var(--calcite-ui-brand) inset;
}
.thumb:hover .handle-extension{
background-color: var(--calcite-ui-brand);
}
.thumb:focus .handle{
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
)
)
);
}
.thumb:focus .handle-extension{
background-color: var(--calcite-ui-brand);
}
.thumb.thumb--minValue {
transform: translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset));
}
.thumb.thumb--precise {
--calcite-slider-thumb-y-offset: -0.125rem;
}
:host([label-handles]) .thumb {
--calcite-slider-thumb-x-offset: 50%;
}
:host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise) {
--calcite-slider-thumb-y-offset: -1.4375rem;
}
:host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise) {
--calcite-slider-thumb-y-offset: -1.875rem;
}
:host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise) {
--calcite-slider-thumb-y-offset: -2rem;
}
:host([has-histogram][label-handles]) .handle__label,
:host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label {
margin-block-start: 0.5em;
}
:host(:not([has-histogram]):not([precise])) .handle__label,
:host([label-handles]:not([has-histogram])) .thumb--value .handle__label {
margin-block-end: 0.5em;
}
:host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value {
--calcite-slider-thumb-y-offset: -2.075rem;
}
:host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value {
--calcite-slider-thumb-y-offset: -2.75rem;
}
:host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value {
--calcite-slider-thumb-y-offset: -3.0625rem;
}
.thumb:focus .handle,
.thumb--active .handle{
background-color: var(--calcite-ui-brand);
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.16);
}
.thumb:hover.thumb--precise:after,
.thumb:focus.thumb--precise:after,
.thumb--active.thumb--precise:after{
background-color: var(--calcite-ui-brand);
}
.track{
position: relative;
block-size: 0.125rem;
border-radius: 0px;
background-color: var(--calcite-ui-border-2);
transition: all var(--calcite-internal-animation-timing-medium) ease-in;
}
.track__range{
position: absolute;
inset-block-start: 0px;
block-size: 0.125rem;
background-color: var(--calcite-ui-brand);
}
.container--range .track__range:hover {
cursor: ew-resize;
}
.container--range .track__range:after{
position: absolute;
inline-size: 100%;
content: "";
inset-block-start: calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);
block-size: calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height));
}
@media (forced-colors: active) {
.thumb {
outline-width: 0;
outline-offset: 0;
}
.handle{
outline: 2px solid transparent;
outline-offset: 2px;
}
.thumb:focus .handle,
.thumb .handle-extension,
.thumb:hover .handle-extension,
.thumb:focus .handle-extension,
.thumb:active .handle-extension {
background-color: canvasText;
}
.track {
background-color: canvasText;
}
.track__range {
background-color: highlight;
}
}
.tick{
position: absolute;
block-size: 0.25rem;
inline-size: 0.125rem;
border-width: 1px;
border-style: solid;
background-color: var(--calcite-ui-border-input);
border-color: var(--calcite-ui-foreground-1);
inset-block-start: -2px;
pointer-events: none;
margin-inline-start: calc(-1 * 0.125rem);
}
.tick--active{
background-color: var(--calcite-ui-brand);
}
.tick__label{
pointer-events: none;
margin-block-start: 0.875rem;
display: flex;
justify-content: center;
}
.tick__label--min {
transition: opacity var(--calcite-animation-timing);
}
.tick__label--max {
transition: opacity var(--calcite-internal-animation-timing-fast);
}
:host([has-histogram][label-handles]) .tick__label--min,
:host([has-histogram][label-handles]) .tick__label--max,
:host([has-histogram][precise]) .tick__label--min,
:host([has-histogram][precise]) .tick__label--max{
font-weight: var(--calcite-font-weight-normal);
color: var(--calcite-ui-text-3);
}
.graph {
color: var(--calcite-ui-foreground-3);
block-size: 48px;
}
:host([label-ticks][ticks]) .container {
padding-block-end: calc(0.875rem + var(--calcite-slider-container-font-size));
}
:host([has-histogram]):host([precise][label-handles]) .container {
padding-block-end: calc(var(--calcite-slider-full-handle-height) + 1em);
}
:host([has-histogram]):host([label-handles]:not([precise])) .container {
padding-block-end: calc(var(--calcite-slider-handle-size) * 0.5 + 1em);
}
:host([has-histogram]):host([precise]:not([label-handles])) .container {
padding-block-end: var(--calcite-slider-full-handle-height);
}
:host(:not([has-histogram])):host([precise]:not([label-handles])) .container {
padding-block-start: var(--calcite-slider-full-handle-height);
}
:host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range {
padding-block-end: var(--calcite-slider-full-handle-height);
}
:host(:not([has-histogram])):host([label-handles]:not([precise])) .container {
padding-block-start: calc(var(--calcite-slider-full-handle-height) + 4px);
}
:host(:not([has-histogram])):host([label-handles][precise]) .container {
padding-block-start: calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px);
}
:host(:not([has-histogram])):host([label-handles][precise]) .container--range {
padding-block-end: calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px);
}
::slotted(input[slot=hidden-form-input]) {
margin: 0 ;
opacity: 0 ;
outline: none ;
padding: 0 ;
position: absolute ;
inset: 0 ;
transform: none ;
-webkit-appearance: none ;
z-index: -1 ;
}