-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
RangeControls: Improve UI + UX #19916
Merged
Merged
Changes from 17 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
a05b713
Start with new RangeControl component
8f11bca
Add tooltipPosition to RangeControl
78d2813
Improve styles and interactions for new RangeControl
99e409d
Add custom marks support
9ae09dd
Updated UI for Ranger Control
bbb0398
Improve layout rendering of RangeControl
40fac8c
Add wrapper for legacy/next RangeControl.
0687ac9
Adjusting range-control styles
327dbcb
Update RangeControl UI and snapshots
7b21afc
Darken thumb color
f6aefdf
Consolidate legacy/next implementation. Update styles
8deb219
Update snapshot + remove RangeControlNext test
7afa6db
Update README for RangeControl
165f4d5
Add RTL support
be4847b
Update storybook snapshots
704e4f6
Remove unused Range Control SCSS
66c86e6
Remove color prop and shadow. Improve focus interaction
dbbbbcc
Formatted RangeControl files
f064832
Merge branch 'master' into try/range-controls-ui-update
19a0c50
Update storybook snapshot
5a79f68
Format rail.js file
3c29316
Reduce component public API to adjust aesthetics / interactions
25aeca1
Add RTL knob for RangeControl story
36ea3d8
Update Storybook snapshot
63e8329
Add RTL renderer (cssjanus) and style mixins
0d571e8
Replace Dashicon with @wordpress/icons. Update RTL usage in Component
2acb222
Update rtl rendering in RangeControl styles
0e23ded
Fix styling for ActionRightWrapper
3c405af
Remove unnecessary RTL. Adjust RTL in ThumbWrapper
3fbd9c7
Restore Dashicon with RangeControl
baff972
Add style fix for RangeControl x FontSizePicker
2cad85d
Migrate on RangeControl styles to FontSizePicker
4d3c112
Replace cssjanus with basic rtl solution
110831f
Fix e2e test for FontSizePicker
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,6 +152,14 @@ If this property is true, a button to reset the the slider is rendered. | |
- Required: No | ||
- Platform: Web | Mobile | ||
|
||
#### disabled | ||
|
||
Disables the `input`, preventing new values from being applied. | ||
|
||
- Type: `Boolean` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### initialPosition | ||
|
||
If no value exists this prop contains the slider starting position. | ||
|
@@ -160,13 +168,41 @@ If no value exists this prop contains the slider starting position. | |
- Required: No | ||
- Platform: Web | Mobile | ||
|
||
#### value | ||
|
||
The current value of the range slider. | ||
#### marks | ||
|
||
- Type: `Number` | ||
- Required: Yes | ||
- Platform: Web | Mobile | ||
Renders a visual representation of `step` ticks. Custom mark indicators can be provided by an `Array`. | ||
|
||
Example: | ||
|
||
```jsx | ||
const marks = [ | ||
{ | ||
value: 0, | ||
label: '0', | ||
}, | ||
{ | ||
value: 1, | ||
label: '1', | ||
}, | ||
{ | ||
value: 8, | ||
label: '8', | ||
}, | ||
{ | ||
value: 10, | ||
label: '10', | ||
}, | ||
]; | ||
|
||
const MyRangeControl() { | ||
return (<RangeControl marks={ marks } min={ 0 } max={ 10 } step={ 1 } />) | ||
} | ||
``` | ||
|
||
- Type: `Array|Boolean` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### onChange | ||
|
||
|
@@ -193,6 +229,86 @@ The maximum value accepted. If higher values are inserted onChange will not be c | |
- Required: No | ||
- Platform: Web | Mobile | ||
|
||
#### renderTooltipContent | ||
|
||
A way to customize the rendered UI of the value. Example: | ||
|
||
```jsx | ||
const customTooltipContent = value => `${value}%` | ||
|
||
const MyRangeControl() { | ||
return (<RangeControl renderTooltipContent={ customTooltipContent } />) | ||
} | ||
``` | ||
|
||
- Type: `Function` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### showTooltip | ||
|
||
Forcing the Tooltip UI to show or hide. | ||
|
||
- Type: `Boolean` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### step | ||
|
||
The stepping interval between `min` and `max` values. Step is used both for user interface and validation purposes. | ||
|
||
- Type: `Number` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### tooltipPosition | ||
|
||
Determines the render position of the Tooltip. Either `auto` (default), `top`, or `bottom`. | ||
|
||
- Type: `String` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### tooltipTimeout | ||
|
||
Determines the `timeout` (ms) to hide the Tooltip based on mouse movements. | ||
|
||
- Type: `Number` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### tooltipZIndex | ||
|
||
Determines the CSS `z-index` property of the Tooltip. | ||
|
||
- Type: `Number` | ||
- Required: No | ||
- Platform: Web | ||
youknowriad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### value | ||
|
||
The current value of the range slider. | ||
|
||
- Type: `Number` | ||
- Required: Yes | ||
- Platform: Web | Mobile | ||
|
||
#### width | ||
youknowriad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The width to render the Component. | ||
|
||
- Type: `Number|String` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### withInputField | ||
|
||
Determines if the `input` number field will render next to the RangeControl. | ||
|
||
- Type: `Boolean` | ||
- Required: No | ||
- Platform: Web | ||
Comment on lines
+276
to
+278
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. Would be good to describe the default here, since it might be unexpected that the default is |
||
|
||
#### icon | ||
|
||
An icon to be shown above the slider next to it's container title. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's a common use case that the label would be the same as value, could we make it optional and fall back to a stringified
value
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's common yet :).
I can see cases where you may want to render
'10%'
instead