245 lines
6.5 KiB
JavaScript
245 lines
6.5 KiB
JavaScript
import {
|
|
form_control_styles_default
|
|
} from "./chunk.2VV6AF6A.js";
|
|
import {
|
|
component_styles_default
|
|
} from "./chunk.K23QWHWK.js";
|
|
import {
|
|
i
|
|
} from "./chunk.CXZZ2LVK.js";
|
|
|
|
// src/components/range/range.styles.ts
|
|
var range_styles_default = i`
|
|
${component_styles_default}
|
|
${form_control_styles_default}
|
|
|
|
:host {
|
|
--thumb-size: 20px;
|
|
--tooltip-offset: 10px;
|
|
--track-color-active: var(--sl-color-neutral-200);
|
|
--track-color-inactive: var(--sl-color-neutral-200);
|
|
--track-active-offset: 0%;
|
|
--track-height: 6px;
|
|
|
|
display: block;
|
|
}
|
|
|
|
.range {
|
|
position: relative;
|
|
}
|
|
|
|
.range__control {
|
|
--percent: 0%;
|
|
-webkit-appearance: none;
|
|
border-radius: 3px;
|
|
width: 100%;
|
|
height: var(--track-height);
|
|
background: transparent;
|
|
line-height: var(--sl-input-height-medium);
|
|
vertical-align: middle;
|
|
margin: 0;
|
|
|
|
background-image: linear-gradient(
|
|
to right,
|
|
var(--track-color-inactive) 0%,
|
|
var(--track-color-inactive) min(var(--percent), var(--track-active-offset)),
|
|
var(--track-color-active) min(var(--percent), var(--track-active-offset)),
|
|
var(--track-color-active) max(var(--percent), var(--track-active-offset)),
|
|
var(--track-color-inactive) max(var(--percent), var(--track-active-offset)),
|
|
var(--track-color-inactive) 100%
|
|
);
|
|
}
|
|
|
|
.range--rtl .range__control {
|
|
background-image: linear-gradient(
|
|
to left,
|
|
var(--track-color-inactive) 0%,
|
|
var(--track-color-inactive) min(var(--percent), var(--track-active-offset)),
|
|
var(--track-color-active) min(var(--percent), var(--track-active-offset)),
|
|
var(--track-color-active) max(var(--percent), var(--track-active-offset)),
|
|
var(--track-color-inactive) max(var(--percent), var(--track-active-offset)),
|
|
var(--track-color-inactive) 100%
|
|
);
|
|
}
|
|
|
|
/* Webkit */
|
|
.range__control::-webkit-slider-runnable-track {
|
|
width: 100%;
|
|
height: var(--track-height);
|
|
border-radius: 3px;
|
|
border: none;
|
|
}
|
|
|
|
.range__control::-webkit-slider-thumb {
|
|
border: none;
|
|
width: var(--thumb-size);
|
|
height: var(--thumb-size);
|
|
border-radius: 50%;
|
|
background-color: var(--sl-color-primary-600);
|
|
border: solid var(--sl-input-border-width) var(--sl-color-primary-600);
|
|
-webkit-appearance: none;
|
|
margin-top: calc(var(--thumb-size) / -2 + var(--track-height) / 2);
|
|
cursor: pointer;
|
|
}
|
|
|
|
.range__control:enabled::-webkit-slider-thumb:hover {
|
|
background-color: var(--sl-color-primary-500);
|
|
border-color: var(--sl-color-primary-500);
|
|
}
|
|
|
|
.range__control:enabled:focus-visible::-webkit-slider-thumb {
|
|
outline: var(--sl-focus-ring);
|
|
outline-offset: var(--sl-focus-ring-offset);
|
|
}
|
|
|
|
.range__control:enabled::-webkit-slider-thumb:active {
|
|
background-color: var(--sl-color-primary-500);
|
|
border-color: var(--sl-color-primary-500);
|
|
cursor: grabbing;
|
|
}
|
|
|
|
/* Firefox */
|
|
.range__control::-moz-focus-outer {
|
|
border: 0;
|
|
}
|
|
|
|
.range__control::-moz-range-progress {
|
|
background-color: var(--track-color-active);
|
|
border-radius: 3px;
|
|
height: var(--track-height);
|
|
}
|
|
|
|
.range__control::-moz-range-track {
|
|
width: 100%;
|
|
height: var(--track-height);
|
|
background-color: var(--track-color-inactive);
|
|
border-radius: 3px;
|
|
border: none;
|
|
}
|
|
|
|
.range__control::-moz-range-thumb {
|
|
border: none;
|
|
height: var(--thumb-size);
|
|
width: var(--thumb-size);
|
|
border-radius: 50%;
|
|
background-color: var(--sl-color-primary-600);
|
|
border-color: var(--sl-color-primary-600);
|
|
transition:
|
|
var(--sl-transition-fast) border-color,
|
|
var(--sl-transition-fast) background-color,
|
|
var(--sl-transition-fast) color,
|
|
var(--sl-transition-fast) box-shadow;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.range__control:enabled::-moz-range-thumb:hover {
|
|
background-color: var(--sl-color-primary-500);
|
|
border-color: var(--sl-color-primary-500);
|
|
}
|
|
|
|
.range__control:enabled:focus-visible::-moz-range-thumb {
|
|
outline: var(--sl-focus-ring);
|
|
outline-offset: var(--sl-focus-ring-offset);
|
|
}
|
|
|
|
.range__control:enabled::-moz-range-thumb:active {
|
|
background-color: var(--sl-color-primary-500);
|
|
border-color: var(--sl-color-primary-500);
|
|
cursor: grabbing;
|
|
}
|
|
|
|
/* States */
|
|
.range__control:focus-visible {
|
|
outline: none;
|
|
}
|
|
|
|
.range__control:disabled {
|
|
opacity: 0.5;
|
|
}
|
|
|
|
.range__control:disabled::-webkit-slider-thumb {
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.range__control:disabled::-moz-range-thumb {
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Tooltip output */
|
|
.range__tooltip {
|
|
position: absolute;
|
|
z-index: var(--sl-z-index-tooltip);
|
|
left: 0;
|
|
border-radius: var(--sl-tooltip-border-radius);
|
|
background-color: var(--sl-tooltip-background-color);
|
|
font-family: var(--sl-tooltip-font-family);
|
|
font-size: var(--sl-tooltip-font-size);
|
|
font-weight: var(--sl-tooltip-font-weight);
|
|
line-height: var(--sl-tooltip-line-height);
|
|
color: var(--sl-tooltip-color);
|
|
opacity: 0;
|
|
padding: var(--sl-tooltip-padding);
|
|
transition: var(--sl-transition-fast) opacity;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.range__tooltip:after {
|
|
content: '';
|
|
position: absolute;
|
|
width: 0;
|
|
height: 0;
|
|
left: 50%;
|
|
translate: calc(-1 * var(--sl-tooltip-arrow-size));
|
|
}
|
|
|
|
.range--tooltip-visible .range__tooltip {
|
|
opacity: 1;
|
|
}
|
|
|
|
/* Tooltip on top */
|
|
.range--tooltip-top .range__tooltip {
|
|
top: calc(-1 * var(--thumb-size) - var(--tooltip-offset));
|
|
}
|
|
|
|
.range--tooltip-top .range__tooltip:after {
|
|
border-top: var(--sl-tooltip-arrow-size) solid var(--sl-tooltip-background-color);
|
|
border-left: var(--sl-tooltip-arrow-size) solid transparent;
|
|
border-right: var(--sl-tooltip-arrow-size) solid transparent;
|
|
top: 100%;
|
|
}
|
|
|
|
/* Tooltip on bottom */
|
|
.range--tooltip-bottom .range__tooltip {
|
|
bottom: calc(-1 * var(--thumb-size) - var(--tooltip-offset));
|
|
}
|
|
|
|
.range--tooltip-bottom .range__tooltip:after {
|
|
border-bottom: var(--sl-tooltip-arrow-size) solid var(--sl-tooltip-background-color);
|
|
border-left: var(--sl-tooltip-arrow-size) solid transparent;
|
|
border-right: var(--sl-tooltip-arrow-size) solid transparent;
|
|
bottom: 100%;
|
|
}
|
|
|
|
@media (forced-colors: active) {
|
|
.range__control,
|
|
.range__tooltip {
|
|
border: solid 1px transparent;
|
|
}
|
|
|
|
.range__control::-webkit-slider-thumb {
|
|
border: solid 1px transparent;
|
|
}
|
|
|
|
.range__control::-moz-range-thumb {
|
|
border: solid 1px transparent;
|
|
}
|
|
|
|
.range__tooltip:after {
|
|
display: none;
|
|
}
|
|
}
|
|
`;
|
|
|
|
export {
|
|
range_styles_default
|
|
};
|