Skip to content

Commit

Permalink
[Progress] Assume indeterminate value (#2947)
Browse files Browse the repository at this point in the history
* Default to indeterminate progress

* Track versions
  • Loading branch information
vladmoroz committed Jun 11, 2024
1 parent c59662f commit d716c48
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .yarn/versions/c9fc51b8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
releases:
"@radix-ui/react-progress": minor

declined:
- primitives
4 changes: 2 additions & 2 deletions packages/react/progress/src/Progress.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Chromatic = () => (
</Progress.Root>

<h1>Indeterminate</h1>
<Progress.Root className={rootClass()} value={null}>
<Progress.Root className={rootClass()}>
<Progress.Indicator className={chromaticIndicatorClass()}>/</Progress.Indicator>
</Progress.Root>

Expand All @@ -54,7 +54,7 @@ export const Chromatic = () => (
</Progress.Root>

<h2>Indeterminate</h2>
<Progress.Root className={rootAttrClass()} value={null}>
<Progress.Root className={rootAttrClass()}>
<Progress.Indicator className={indicatorAttrClass()}>/</Progress.Indicator>
</Progress.Root>

Expand Down
4 changes: 2 additions & 2 deletions packages/react/progress/src/Progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Progress = React.forwardRef<ProgressElement, ProgressProps>(
(props: ScopedProps<ProgressProps>, forwardedRef) => {
const {
__scopeProgress,
value: valueProp,
value: valueProp = null,
max: maxProp,
getValueLabel = defaultGetValueLabel,
...progressProps
Expand Down Expand Up @@ -140,7 +140,7 @@ function getInvalidValueError(propValue: string, componentName: string) {
return `Invalid prop \`value\` of value \`${propValue}\` supplied to \`${componentName}\`. The \`value\` prop must be:
- a positive number
- less than the value passed to \`max\` (or ${DEFAULT_MAX} if no \`max\` prop is set)
- \`null\` if the progress is indeterminate.
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`;
}
Expand Down

0 comments on commit d716c48

Please sign in to comment.