Skip to content

Commit

Permalink
Allow sliders to go overflow (#15750)
Browse files Browse the repository at this point in the history
  • Loading branch information
deltakosh authored Oct 29, 2024
1 parent cc75bbb commit 14f4d2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ $line-padding-left: 2px;
opacity: 0.7;
transition: opacity 0.2s;
}

.range::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
Expand Down Expand Up @@ -1081,6 +1082,10 @@ $line-padding-left: 2px;
outline: none;
opacity: 0.7;
transition: opacity 0.2s;

&.overflow {
background-color: red;
}
}

.range:hover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface ISliderLineComponentProps {
iconLabel?: string;
lockObject: LockObject;
unit?: React.ReactNode;
allowOverflow?: boolean;
}

export class SliderLineComponent extends React.Component<ISliderLineComponentProps, { value: number }> {
Expand Down Expand Up @@ -154,8 +155,8 @@ export class SliderLineComponent extends React.Component<ISliderLineComponentPro
target={this.state}
digits={this.props.decimalCount === undefined ? 4 : this.props.decimalCount}
propertyName="value"
min={this.props.minimum}
max={this.props.maximum}
min={this.props.allowOverflow ? undefined : this.props.minimum}
max={this.props.allowOverflow ? undefined : this.props.maximum}
onEnter={() => {
const changed = this.prepareDataToRead(this.state.value);
this.onChange(changed);
Expand All @@ -169,7 +170,7 @@ export class SliderLineComponent extends React.Component<ISliderLineComponentPro
/>
<div className="slider">
<input
className="range"
className={"range" + (this.props.allowOverflow && (this.state.value > this.props.maximum || this.state.value < this.props.minimum) ? " overflow" : "")}
type="range"
step={this.props.step}
min={this.prepareDataToRead(this.props.minimum)}
Expand Down

0 comments on commit 14f4d2e

Please sign in to comment.