fix(Progress): clamp bar width and improve propTypes check for progress prop #4332
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.
Fix some inconsistencies in
Progress
bar width and invalid prop combos.bar width:
progress='value'
andvalue > total
e.g.
<Progress progress='value' value={51} total={50} />
Expected Result: progress bar with text
51
and width clamped to 100% to match behavior with any other value forprogress
Actual Result: progress bar with text
51
and width 102%bar width:
value
withouttotal
e.g.
<Progress value={50} />
Expected Result: progress bar with width 50% to match behavior with
progress='value'
Actual Result: progress bar with min width
bad prop combo:
progress='ratio
withoutvalue
ortotal
e.g.
<Progress progress="ratio" />
Expected Result:
propTypes
errorActual Result: no
propTypes
error, progress bar with textundefined/undefined
bad prop combo:
progress='value'
withoutvalue
e.g.
<Progress progress="value" />
Expected Result:
propTypes
errorActual Result: no
propTypes
errorVersion
2.1.1
Testcase
https://codesandbox.io/s/progress-problem-with-progress-value-odipb?file=/index.js