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/sharp-papayas-destroy.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Update CounterLabel component to no longer support sx
5 changes: 0 additions & 5 deletions packages/react/src/CounterLabel/CounterLabel.docs.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,11 +27,6 @@
"type": "string",
"description": "Class name(s) for custom styling.",
"defaultValue": ""
},
{
"name": "sx",
"type": "BetterSystemStyleObject",
"deprecated": true
}
],
"subcomponents": []
Expand Down
8 changes: 3 additions & 5 deletions packages/react/src/CounterLabel/CounterLabel.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,16 +2,14 @@ import {clsx} from 'clsx'
import type {HTMLAttributes} from 'react'
import type React from 'react'
import {forwardRef} from 'react'
import type {SxProp} from '../sx'
import {VisuallyHidden} from '../VisuallyHidden'
import classes from './CounterLabel.module.css'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'

export type CounterLabelProps = React.PropsWithChildren<
HTMLAttributes<HTMLSpanElement> & {
scheme?: 'primary' | 'secondary'
className?: string
} & SxProp
}
>

const CounterLabel = forwardRef<HTMLSpanElement, CounterLabelProps>(
Expand All@@ -26,9 +24,9 @@ const CounterLabel = forwardRef<HTMLSpanElement, CounterLabelProps>(

return (
<>
<BoxWithFallback as="span" {...counterProps} className={clsx(className, classes.CounterLabel)}>
<span {...counterProps} className={clsx(className, classes.CounterLabel)}>
{children}
</BoxWithFallback>
</span>
{label}
</>
)
Expand Down
11 changes: 9 additions & 2 deletions packages/styled-react/src/index.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,8 @@ import {
type SxProp,
Checkbox as PrimerCheckbox,
type CheckboxProps as PrimerCheckboxProps,
CounterLabel as PrimerCounterLabel,
type CounterLabelProps as PrimerCounterLabelProps,
StateLabel as PrimerStateLabel,
type StateLabelProps as PrimerStateLabelProps,
SubNav as PrimerSubNav,
Expand DownExpand Up@@ -71,6 +73,12 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(p
return <Box as={PrimerCheckbox} ref={ref} {...props} />
})

type CounterLabelProps = PrimerCounterLabelProps & SxProp

const CounterLabel = forwardRef<HTMLSpanElement, CounterLabelProps>(function CounterLabel(props, ref) {
return <Box as={PrimerCounterLabel} ref={ref} {...props} />
})

type StateLabelProps = PrimerStateLabelProps & SxProp

const StateLabel = forwardRef<HTMLSpanElement, StateLabelProps>(function StateLabel(props, ref) {
Expand DownExpand Up@@ -99,7 +107,7 @@ const ToggleSwitch = forwardRef<HTMLButtonElement, ToggleSwitchProps>(function T
return <Box as={PrimerToggleSwitch} ref={ref} {...props} />
})

export {LinkButton, type LinkButtonProps, Checkbox, SegmentedControl, StateLabel, SubNav, ToggleSwitch}
export {LinkButton, type LinkButtonProps, Checkbox, CounterLabel, SegmentedControl, StateLabel, SubNav, ToggleSwitch}

export {
ActionList,
Expand All@@ -110,7 +118,6 @@ export {
Button,
CheckboxGroup,
CircleBadge,
CounterLabel,
Details,
Dialog,
Flash,
Expand Down
Loading