/*! * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. * * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ /* * Input Range Customization by browser */ // The following code is inspired by... // Github: https://github.com/darlanrod/input-range-sass // Author: Darlan Rod https://github.com/darlanrod // Version 1.4.1 // MIT License // It has been modified to fit the styling patterns of Kibana and // to be more easily maintained / themeable going forward. .ouiRangeSlider { height: $ouiFormControlHeight; appearance: none; background: transparent; // Otherwise white in Chrome width: 100%; // ensures the slider expands to fill flex display position: relative; cursor: pointer; // Keep cursor to full range bounds z-index: 1; // higher than .ouiRangeHighlight that is 0 &:disabled { cursor: not-allowed; // sass-lint:disable-block mixins-before-declarations @include ouiRangeThumbPerBrowser { cursor: not-allowed; border-color: $ouiRangeThumbBorderColor; background-color: $ouiRangeThumbBorderColor; box-shadow: none; } ~ .ouiRangeThumb { cursor: not-allowed; border-color: $ouiRangeThumbBorderColor; background-color: $ouiRangeThumbBorderColor; box-shadow: none; } } @include ouiRangeThumbPerBrowser { @include ouiCustomControl($type: 'round'); @include ouiRangeThumbStyle; } @include ouiRangeTrackPerBrowser { @include ouiRangeTrackSize; background: $ouiRangeTrackColor; border: $ouiRangeTrackBorderWidth solid $ouiRangeTrackBorderColor; border-radius: $ouiRangeTrackRadius; } &:focus { outline: none; } &:focus-visible, &--hasFocus { @include ouiRangeThumbPerBrowser { box-shadow: 0 0 0 $ouiFocusRingSize $ouiFocusRingColor; } ~ .ouiRangeThumb { border-color: $ouiRangeThumbBorderColor; } @include ouiRangeTrackPerBrowser { background-color: $ouiColorPrimary; border-color: $ouiColorPrimary; } ~ .ouiRangeHighlight .ouiRangeHighlight__progress { background-color: $ouiColorPrimary; } ~ .ouiRangeTooltip .ouiRangeTooltip__value { @include ouiBottomShadowMedium; &.ouiRangeTooltip__value--right, &.ouiRangeTooltip__value--left { transform: translateX(0) translateY(-50%) scale(1.1); } } } // Resets // Disable linter for these very unique vendor controls // sass-lint:disable-block no-vendor-prefixes &::-webkit-slider-thumb { -webkit-appearance: none; margin-top: ((-$ouiRangeTrackBorderWidth * 2 + $ouiRangeTrackHeight) / 2) - ($ouiRangeThumbHeight / 2); } &::-ms-thumb { margin-top: 0; } &::-moz-focus-outer { border: none; } &::-ms-track { @include ouiRangeTrackSize; background: transparent; border-color: transparent; border-width: ($ouiRangeThumbHeight / 2) 0; color: transparent; } // States &--hasTicks { height: $ouiFormControlHeight / 2; // Adjust vertical alignment based on extras } &--compressed { height: $ouiFormControlCompressedHeight; &.ouiRangeSlider--hasTicks { height: $ouiFormControlCompressedHeight / 2; } } } // Lighten the track when showing the range .ouiRangeSlider--hasRange { @include ouiRangeTrackPerBrowser { background-color: transparentize($ouiRangeTrackColor, .6); border-color: transparentize($ouiRangeTrackBorderColor, .6); } }