@@ -18,6 +18,7 @@ import {
1818 SegmentedControl as PrimerSegmentedControl ,
1919 type SegmentedControlButtonProps as PrimerSegmentedControlButtonProps ,
2020 type SegmentedControlIconButtonProps as PrimerSegmentedControlIconButtonProps ,
21+ sx ,
2122} from '@primer/react'
2223import React , { forwardRef , type PropsWithChildren } from 'react'
2324import type { ForwardRefComponent } from './polymorphic'
@@ -33,6 +34,7 @@ import type {
3334 SpaceProps ,
3435 TypographyProps ,
3536} from 'styled-system'
37+ import styled from 'styled-components'
3638
3739type StyledProps = SxProp &
3840 SpaceProps &
@@ -139,10 +141,11 @@ const ToggleSwitch = forwardRef<HTMLButtonElement, ToggleSwitchProps>(function T
139141
140142type TruncateProps = PropsWithChildren < PrimerTruncateProps > & SxProp
141143
142- const Truncate = forwardRef < HTMLDivElement , TruncateProps > ( function Truncate ( props , ref ) {
143- // @ts -ignore - PrimerTruncate is polymorphic and functionally compatible with Box's as prop
144- return < Box as = { PrimerTruncate } ref = { ref } { ...props } />
145- } ) as ForwardRefComponent < 'div' , TruncateProps >
144+ const Truncate : ForwardRefComponent < 'div' , TruncateProps > = styled ( PrimerTruncate ) . withConfig < TruncateProps > ( {
145+ shouldForwardProp : prop => prop !== 'sx' ,
146+ } ) `
147+ ${ sx }
148+ `
146149
147150export { RadioGroup , SegmentedControl , StateLabel , SubNav , ToggleSwitch , Truncate }
148151
0 commit comments