Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions src/Components/Inputs/Composed/RangeSlider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ $slider-hover: $g17-whisper;
background: $slider-hover-border;
}

&:focus {
outline: none;
}
// &:focus {
// outline: none;
// }
Comment on lines +31 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused code should be removed not commented.


&::-webkit-slider-runnable-track {
height: $slider-track-height;
Expand All @@ -51,10 +51,15 @@ $slider-hover: $g17-whisper;
border-radius: $cf-radius;
background: $slider-handle;
margin-top: -(($slider-handle-height*0.5) - ($slider-track-height*0.5));

&:hover,
cursor:pointer;
box-shadow: 0 0 0 0 rgba($g7-graphite,.3);
transition: box-shadow .05s ease;
&:active{
box-shadow: 0 0 0 20px rgba($g7-graphite,.35);
}
&:focus {
background: $slider-handle-focus;
box-shadow: 0 0 0 10px rgba($g7-graphite,.25);
}
}

Expand All @@ -71,10 +76,16 @@ $slider-hover: $g17-whisper;
width: $slider-handle-height;
border-radius: $cf-radius;
background: $slider-handle;

cursor:pointer;
box-shadow: 0 0 0 0 rgba($g7-graphite,.3);
transition: box-shadow .05s ease;
&:active{
box-shadow: 0 0 0 20px rgba($g7-graphite,.35);
}
&:hover,
&:focus {
background: $slider-handle-focus;
box-shadow: 0 0 0 10px rgba($g7-graphite,.25);
}
}

Expand All @@ -100,10 +111,16 @@ $slider-hover: $g17-whisper;
width: $slider-handle-height;
border-radius: $cf-radius;
background: $slider-handle;

cursor:pointer;
box-shadow: 0 0 0 0 rgba($g7-graphite,.3);
transition: box-shadow .05s ease;
&:active{
box-shadow: 0 0 0 20px rgba($g7-graphite,.35);
}
&:hover,
&:focus {
background: $slider-handle-focus;
box-shadow: 0 0 0 10px rgba($g7-graphite,.25);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Components/Inputs/Composed/RangeSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export interface RangeSliderProps extends StandardFunctionProps {
color?: ComponentColor
/** Fill the track before the handle to indicate percentage */
fill?: boolean
/** Add a subtle gradient effect */
gradient?: boolean
/** Displays the min and max values below the slider */
hideLabels?: boolean
/** Adds a prefix to labels */
Expand All @@ -68,6 +70,7 @@ export const RangeSlider = forwardRef<RangeSliderRef, RangeSliderProps>(
min = 0,
max = 100,
fill = false,
gradient= true,
size = ComponentSize.Small,
step,
style,
Expand Down Expand Up @@ -109,6 +112,7 @@ export const RangeSlider = forwardRef<RangeSliderRef, RangeSliderProps>(

const inputStyle = generateRangeSliderTrackFillStyle(
fill,
gradient,
min,
max,
value,
Expand Down
1 change: 1 addition & 0 deletions src/Components/Inputs/Documentation/Inputs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ inputsComposedStories.add(
labelPrefix={text('labelPrefix', '')}
labelSuffix={text('labelSuffix', '')}
fill={boolean('fill', true)}
gradient={boolean('gradient', true)}
hideLabels={boolean('hide labels', false)}
style={object('style', exampleRangeSliderStyle)}
status={
Expand Down
1 change: 1 addition & 0 deletions src/Components/Inputs/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export const Input = forwardRef<InputRef, InputProps>(
style={inputStyle}
required={required}
pattern={pattern}
aria-label={testID}
/>
{clearElement}
{type === InputType.Checkbox && <div className={inputCheckboxClass} />}
Expand Down
5 changes: 4 additions & 1 deletion src/Utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export const generateTechnoSpinnerStyle = (

export const generateRangeSliderTrackFillStyle = (
fill: boolean,
gradient: boolean,
min: number,
max: number,
value: number,
Expand All @@ -182,9 +183,11 @@ export const generateRangeSliderTrackFillStyle = (

const pos = ((value - minVal) / (maxVal - minVal)) * 100

const fillColorModified = gradient ? chroma(fillColor[color]).darken(2).saturate(2).hex() : fillColor[color]

if (fill) {
return {
background: `linear-gradient(to right, ${fillColor[color]} 0%, ${fillColor[color]} ${pos}%, ${InfluxColors.Pepper} ${pos}%, ${InfluxColors.Pepper} 100%)`,
background: `linear-gradient(to right, ${fillColorModified} 0%, ${fillColor[color]} ${pos}%, ${InfluxColors.Pepper} ${pos}%, ${InfluxColors.Pepper} 100%)`,
}
}

Expand Down