formstone
Version:
Library of modular front end components.
308 lines (237 loc) • 4.48 kB
text/less
/**
* @component
* @name Range
*/
@import "imports/utils.less";
// Config
@fs-range-track-background-color: #ddd;
@fs-range-track-height: 10px;
@fs-range-fill-background-color: #aaa;
@fs-range-marker-size: 20px;
@fs-range-marker-background-color: #666;
// Vertical
@fs-range-vertical-height: 300px;
@fs-range-vertical-track-width: 10px;
// Disabled
@fs-range-disabled-opacity: 0.5;
/**
* @class
* @name .fs-range-element
* @type element
* @description Target elmement
*/
/**
* @class
* @name .fs-range
* @type element
* @description Base widget class
*/
/**
* @class
* @name .fs-range.fs-range-focus
* @type modifier
* @description Indicates focused state
*/
/**
* @class
* @name .fs-range.fs-range-disabled
* @type modifier
* @description Indicates disabled state
*/
/**
* @class
* @name .fs-range.fs-range-labels
* @type modifier
* @description Indicates label display
*/
/**
* @class
* @name .fs-range.fs-range-vertical
* @type modifier
* @description Indicates vertical display
*/
.fs-range {
width: 100%;
height: (@fs-range-marker-size * 2);
position: relative;
display: flex;
flex-wrap: nowrap;
&,
&:after,
&:before,
*,
*:after,
*:before {
box-sizing: border-box;
transition: none;
user-select: none ;
}
&-element {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
opacity: 0;
pointer-events: none;
}
/**
* @class
* @name .fs-range-track
* @type element
* @description Track elmement
*/
&-track {
width: 100%;
height: @fs-range-track-height;
position: relative;
background: @fs-range-track-background-color;
flex-grow: 1;
margin: (@fs-range-marker-size / 2) 0;
}
/**
* @class
* @name .fs-range-fill
* @type element
* @description Fill elmement
*/
&-fill {
width: 1px;
height: 100%;
position: absolute;
top: 0;
right: auto;
bottom: 0;
left: 0;
z-index: 1;
background: @fs-range-fill-background-color;
}
/**
* @class
* @name .fs-range-handle
* @type element
* @description Handle elmement
*/
&-handle {
width: 1px;
height: 100%;
position: absolute;
top: 0;
left: 0;
bottom: 0;
z-index: 2;
display: block;
overflow: visible;
}
/**
* @class
* @name .fs-range-marker
* @type element
* @description Marker elmement
*/
&-marker {
width: @fs-range-marker-size;
height: @fs-range-marker-size;
background: @fs-range-marker-background-color;
cursor: pointer;
display: block;
margin: -(@fs-range-marker-size / 4) 0 0 -(@fs-range-marker-size / 2);
}
// Hover
.no-touch &:hover &-track {
}
.no-touch &:hover &-marker {
}
// Focus
&-focus &-track {
}
&-focus &-marker {
}
// Labels
&-labels &-track {
width: 80%;
}
/**
* @class
* @name .fs-range-label
* @type element
* @description Label elmement
*/
&-label {
width: 8%;
display: block;
line-height: (@fs-range-track-height + @fs-range-marker-size);
}
/**
* @class
* @name .fs-range-label_min
* @type element
* @description Minimum label elmement
*/
&-label_min {
margin: 0 2% 0 0;
text-align: right;
}
/**
* @class
* @name .fs-range-label_max
* @type element
* @description Maximum label elmement
*/
&-label_max {
margin: 0 0 0 2%;
text-align: left;
}
// Vertical
&-vertical {
width: (@fs-range-marker-size * 2);
height: @fs-range-vertical-height;
flex-direction: column;
}
&-vertical &-track {
width: @fs-range-vertical-track-width;
height: 75%;
margin: 0 auto;
}
&-vertical &-fill {
width: 100%;
height: 1px;
top: auto;
right: 0;
bottom: 0;
left: 0;
}
&-vertical &-handle {
width: 100%;
height: 1px;
top: auto;
right: 0;
bottom: 0;
left: 0;
}
&-vertical &-marker {
margin: -(@fs-range-marker-size / 2) 0 0 -(@fs-range-marker-size / 4);
}
&-vertical &-label {
height: 10%;
width: 100%;
line-height: 30px;
margin: 0;
text-align: center;
}
&-vertical &-label_min {
padding: 0;
}
&-vertical &-label_max {
padding: 0;
}
// Disabled
&-disabled {
cursor: default;
opacity: @fs-range-disabled-opacity;
}
&-disabled &-marker {
cursor: default;
}
}