File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11import {
2+ type ComponentProps ,
23 type ReactElement ,
34 type ReactNode ,
45 cloneElement ,
@@ -143,7 +144,10 @@ const IconFrameSC = styled(Flex)<{
143144 : { } ) ,
144145} ) )
145146
146- const IconFrame = forwardRef < HTMLDivElement , IconFrameProps > (
147+ const IconFrame = forwardRef <
148+ HTMLDivElement ,
149+ IconFrameProps & ComponentProps < typeof IconFrameSC >
150+ > (
147151 (
148152 {
149153 icon,
@@ -154,6 +158,7 @@ const IconFrame = forwardRef<HTMLDivElement, IconFrameProps>(
154158 tooltip,
155159 tooltipProps,
156160 type = 'tertiary' ,
161+ as,
157162 ...props
158163 } ,
159164 ref
@@ -162,6 +167,7 @@ const IconFrame = forwardRef<HTMLDivElement, IconFrameProps>(
162167 if ( tooltip && typeof tooltip === 'boolean' ) {
163168 tooltip = textValue
164169 }
170+ const forwardedAs = as || ( clickable ? ButtonBase : undefined )
165171
166172 let content = (
167173 < IconFrameSC
@@ -172,9 +178,8 @@ const IconFrame = forwardRef<HTMLDivElement, IconFrameProps>(
172178 ref = { ref }
173179 flex = { false }
174180 aria-label = { textValue }
175- forwardedAs = { ( props as any ) . as }
181+ { ... ( forwardedAs ? { forwardedAs } : { } ) }
176182 { ...( clickable && {
177- forwardedAs : ( props as any ) . as || ButtonBase ,
178183 tabIndex : 0 ,
179184 role : 'button' ,
180185 type : 'button' ,
You can’t perform that action at this time.
0 commit comments