@mixin ng-deep($enableNgDeep: true) { @if $enableNgDeep { ::ng-deep { @content; } } @else { @content; } } @mixin rounded($radius: 2px) { -webkit-border-radius: $radius; -moz-border-radius: $radius; border-radius: $radius; } $enableNgDeep: true !default; $handleActiveColor: #451aff !default; $handleHoverColor: #fff !default; $labelTextColor: #55637d !default; $handleBgColor: #0db9f0 !default; $handleInnerColor: #fff !default; $handleDisabledColor: #d8e0f3 !default; $limitLabelTextColor: $labelTextColor !default; $barFillColor: $handleBgColor !default; $barDisabledFillColor: #8b91a2 !default; $barNormalColor: #d8e0f3 !default; $barLeftOutSelectionColor: #df002d !default; $barRightOutSelectionColor: #03a688 !default; $ticksColor: $barNormalColor !default; $selectedTicksColor: $barFillColor !default; $ticksWidth: 10px !default; $ticksHeight: 10px !default; $ticksValuePosition: -34px !default; $ticksLegendPosition: 24px !default; $ticksValuePositionOnVertical: 24px !default; $tickLegendMaxWidth: 50px !default; $handleSize: 32px !default; $handlePointerSize: 8px !default; $bubblePaddingVertical: 1px !default; $bubblePaddingHorizontal: 3px !default; $labelFontSize: 16px !default; $barDimension: 4px !default; $withLegendMargin: 40px !default; $sliderMargin: 15px !default; $sliderMarginWithLabel: 35px !default; $sliderVerticalMargin: 20px !default; $animationDuration: 0.3s !default; @include ng-deep($enableNgDeep) { .ng5-slider { display: inline-block; position: relative; height: $barDimension; width: 100%; margin: $sliderMarginWithLabel 0 $sliderMargin 0; vertical-align: middle; user-select: none; touch-action: pan-y; &.with-legend { margin-bottom: $withLegendMargin; } &[disabled] { cursor: not-allowed; .ng5-slider-pointer { cursor: not-allowed; background-color: $handleDisabledColor; } .ng5-slider-draggable { cursor: not-allowed; } .ng5-slider-selection { background: $barDisabledFillColor; } .ng5-slider-tick { cursor: not-allowed; &.ng5-slider-selected { background: $barDisabledFillColor; } } } .ng5-slider-span { white-space: nowrap; position: absolute; display: inline-block; } .ng5-slider-base { width: 100%; height: 100%; padding: 0; } .ng5-slider-bar-wrapper { left: 0; box-sizing: border-box; margin-top: -$handleSize / 2; padding-top: $handleSize / 2; width: 100%; height: $handleSize; z-index: 1; } .ng5-slider-draggable { cursor: move; } .ng5-slider-bar { left: 0; width: 100%; height: $barDimension; z-index: 1; background: $barNormalColor; @include rounded($barDimension / 2); } .ng5-slider-bar-wrapper.ng5-slider-transparent .ng5-slider-bar { background: transparent; } .ng5-slider-bar-wrapper.ng5-slider-left-out-selection .ng5-slider-bar { background: $barLeftOutSelectionColor; } .ng5-slider-bar-wrapper.ng5-slider-right-out-selection .ng5-slider-bar { background: $barRightOutSelectionColor; } .ng5-slider-selection { z-index: 2; background: $barFillColor; @include rounded($barDimension / 2); } .ng5-slider-pointer { cursor: pointer; width: $handleSize; height: $handleSize; top: -$handleSize / 2 + $barDimension / 2; background-color: $handleBgColor; z-index: 3; @include rounded($handleSize / 2); &:after { content: ''; width: $handlePointerSize; height: $handlePointerSize; position: absolute; top: $handleSize / 2 - $handlePointerSize / 2; left: $handleSize / 2 - $handlePointerSize / 2; @include rounded($handlePointerSize / 2); background: $handleInnerColor; } &:hover:after { background-color: $handleHoverColor; } &.ng5-slider-active { z-index: 4; &:after { background-color: $handleActiveColor; } } } .ng5-slider-bubble { cursor: default; bottom: $handleSize / 2; padding: $bubblePaddingVertical $bubblePaddingHorizontal; color: $labelTextColor; font-size: $labelFontSize; &.ng5-slider-limit { color: $limitLabelTextColor; } } .ng5-slider-ticks { box-sizing: border-box; width: 100%; height: 0; position: absolute; left: 0; top: -($ticksHeight - $barDimension) / 2; margin: 0; z-index: 1; list-style: none; } .ng5-slider-ticks-values-under { .ng5-slider-tick-value { top: auto; bottom: $ticksValuePosition - 2; } } .ng5-slider-tick { text-align: center; cursor: pointer; width: $ticksWidth; height: $ticksHeight; background: $ticksColor; border-radius: 50%; position: absolute; top: 0; left: 0; margin-left: $handleSize / 2 - $ticksWidth / 2; // for centering &.ng5-slider-selected { background: $selectedTicksColor; } } .ng5-slider-tick-value { position: absolute; top: $ticksValuePosition; transform: translate(-50%, 0); } .ng5-slider-tick-legend { position: absolute; top: $ticksLegendPosition; transform: translate(-50%, 0); max-width: $tickLegendMaxWidth; white-space: normal; } &.vertical { position: relative; width: $barDimension; height: 100%; margin: 0 $sliderVerticalMargin; padding: 0; vertical-align: baseline; touch-action: pan-x; .ng5-slider-base { width: 100%; height: 100%; padding: 0; } .ng5-slider-bar-wrapper { top: auto; left: 0; margin: 0 0 0 (-$handleSize / 2); padding: 0 0 0 $handleSize / 2; height: 100%; width: $handleSize; } .ng5-slider-bar { bottom: 0; left: auto; width: $barDimension; height: 100%; } .ng5-slider-pointer { left: -$handleSize / 2 + $barDimension / 2 !important; top: auto; bottom: 0; } .ng5-slider-bubble { left: $handleSize / 2 !important; bottom: 0; } .ng5-slider-ticks { height: 100%; width: 0; left: -($ticksHeight - $barDimension) / 2; top: 0; z-index: 1; } .ng5-slider-tick { vertical-align: middle; margin-left: auto; margin-top: $handleSize / 2 - $ticksWidth / 2; // for centering } .ng5-slider-tick-value { left: $ticksValuePositionOnVertical; top: auto; transform: translate(0, -28%); } .ng5-slider-tick-legend { top: auto; right: $ticksLegendPosition; transform: translate(0, -28%); max-width: none; white-space: nowrap; } .ng5-slider-ticks-values-under { .ng5-slider-tick-value { bottom: auto; left: auto; right: $ticksValuePositionOnVertical; } } } * { transition: none; } &.animate { .ng5-slider-bar-wrapper { transition: all linear $animationDuration; } .ng5-slider-selection { transition: background-color linear $animationDuration; } .ng5-slider-pointer { transition: all linear $animationDuration; } .ng5-slider-bubble { transition: all linear $animationDuration; &.ng5-slider-limit { transition: opacity linear $animationDuration; } &.ng5-slider-combined { transition: opacity linear $animationDuration; } } .ng5-slider-tick { transition: background-color linear $animationDuration; } } } } .ng5-slider-inner-tooltip { height: 100%; }