-
Notifications
You must be signed in to change notification settings - Fork 79
feat(slider): allow configuring fill behavior #9170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
93ff1ca
6524568
8095847
d2834f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,8 +82,7 @@ export class Slider | |
* | ||
* When not set, the component will be associated with its ancestor form element, if any. | ||
*/ | ||
@Prop({ reflect: true }) | ||
form: string; | ||
@Prop({ reflect: true }) form: string; | ||
|
||
/** | ||
* When `true`, number values are displayed with a group separator corresponding to the language and country format. | ||
|
@@ -93,6 +92,13 @@ export class Slider | |
/** When `true`, indicates a histogram is present. */ | ||
@Prop({ reflect: true, mutable: true }) hasHistogram = false; | ||
|
||
/** | ||
* Used to configure where the highlight is placed along the slider track. | ||
* | ||
* **Note**: range mode will always display range between min and max handles. | ||
*/ | ||
@Prop({ reflect: true }) highlightMode: "default" | "none" | "mirrored" = "default"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment: Is there a better name for "default"? Otherwise, default doesn't really mean anything other than its the default whereas the others have some meaning to them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "start" (default) / "end" / "none" ? There is also the separate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Went with |
||
|
||
/** | ||
* A list of the histogram's x,y coordinates within the component's `min` and `max`. Displays above the component's track. | ||
* | ||
|
@@ -281,6 +287,24 @@ export class Slider | |
mirror, | ||
}); | ||
|
||
const { highlightMode } = this; | ||
const trackRangePlacementStyles = | ||
highlightMode === "none" | ||
? { | ||
left: `unset`, | ||
right: `unset`, | ||
} | ||
: highlightMode === "mirrored" | ||
? { | ||
left: `${mirror ? minInterval : maxInterval}%`, | ||
right: `${mirror ? maxInterval : minInterval}%`, | ||
} | ||
: /* default */ | ||
{ | ||
left: `${mirror ? 100 - maxInterval : minInterval}%`, | ||
right: `${mirror ? minInterval : 100 - maxInterval}%`, | ||
}; | ||
|
||
return ( | ||
<Host id={id} onKeyDown={this.handleKeyDown} onTouchStart={this.handleTouchStart}> | ||
<InteractiveContainer disabled={this.disabled}> | ||
|
@@ -301,10 +325,7 @@ export class Slider | |
<div | ||
class={CSS.trackRange} | ||
onPointerDown={this.onTrackPointerDown} | ||
style={{ | ||
left: `${mirror ? 100 - maxInterval : minInterval}%`, | ||
right: `${mirror ? minInterval : 100 - maxInterval}%`, | ||
}} | ||
style={trackRangePlacementStyles} | ||
/> | ||
<div class={CSS.ticks}> | ||
{this.tickValues.map((tick) => { | ||
|
Uh oh!
There was an error while loading. Please reload this page.