Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/three-vans-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Update ProgressBar to no longer support sx
16 changes: 5 additions & 11 deletions packages/react/src/ProgressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, {forwardRef} from 'react'
import type {SxProp} from '../sx'
import {clsx} from 'clsx'
import classes from './ProgressBar.module.css'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'

type ProgressProp = {
className?: string
Expand All @@ -14,13 +12,12 @@ type StyledProgressContainerProps = {
inline?: boolean
barSize?: 'small' | 'default' | 'large'
animated?: boolean
} & SxProp
}

export type ProgressBarItemProps = React.HTMLAttributes<HTMLSpanElement> & {
'aria-label'?: string
className?: string
} & ProgressProp &
SxProp
} & ProgressProp

export const Item = forwardRef<HTMLSpanElement, ProgressBarItemProps>(
(
Expand Down Expand Up @@ -56,14 +53,12 @@ export const Item = forwardRef<HTMLSpanElement, ProgressBarItemProps>(
(bgType && `var(--bgColor-${bgType[0]}-${bgType[1] || 'emphasis'})`) || 'var(--bgColor-success-emphasis)'

return (
<BoxWithFallback
as="span"
<span
className={clsx(className, classes.ProgressBarItem)}
{...rest}
role="progressbar"
aria-label={ariaLabel}
ref={forwardRef}
progress={progress}
style={{...styles, ...style}}
Comment on lines 61 to 62
Copy link

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The progress prop is being removed from the span element props but it's still being passed to the component and may cause React warnings about unknown DOM attributes. Consider filtering it out in the destructuring or rest props.

Copilot uses AI. Check for mistakes.
{...ariaAttributes}
/>
Expand Down Expand Up @@ -105,8 +100,7 @@ export const ProgressBar = forwardRef<HTMLSpanElement, ProgressBarProps>(
const validChildren = React.Children.toArray(children).length

return (
<BoxWithFallback
as="span"
<span
ref={forwardRef}
className={clsx(className, classes.ProgressBarContainer)}
data-progress-display={inline ? 'inline' : 'block'}
Expand All @@ -125,7 +119,7 @@ export const ProgressBar = forwardRef<HTMLSpanElement, ProgressBarProps>(
bg={bg}
/>
)}
</BoxWithFallback>
</span>
)
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ exports[`@primer/styled-react exports 1`] = `
"Overlay",
"PageHeader",
"PageLayout",
"ProgressBar",
"RadioGroup",
"RelativeTime",
"SegmentedControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
Overlay,
PageHeader,
PageLayout,
ProgressBar,
RadioGroup,
RelativeTime,
SegmentedControl,
Expand Down Expand Up @@ -286,16 +285,6 @@ describe('@primer/react', () => {
expect(window.getComputedStyle(container.firstElementChild!).backgroundColor).toBe('rgb(255, 0, 0)')
})

test('ProgressBar supports `sx` prop', () => {
const {container} = render(<ProgressBar data-testid="component" sx={{background: 'red'}} />)
expect(window.getComputedStyle(container.firstElementChild!).backgroundColor).toBe('rgb(255, 0, 0)')
})

test('ProgressBar.Item supports `sx` prop', () => {
const {container} = render(<ProgressBar.Item data-testid="component" sx={{background: 'red'}} />)
expect(window.getComputedStyle(container.firstElementChild!).backgroundColor).toBe('rgb(255, 0, 0)')
})

test('RadioGroup supports `sx` prop', () => {
const {container} = render(
<RadioGroup data-testid="component" name="test" sx={{background: 'red'}}>
Expand Down
1 change: 0 additions & 1 deletion packages/styled-react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ export {
Overlay,
PageHeader,
PageLayout,
ProgressBar,
Select,
Spinner,
Text,
Expand Down
Loading