diff --git a/src/components/IconFrame.tsx b/src/components/IconFrame.tsx index 75323ae0..cc87429b 100644 --- a/src/components/IconFrame.tsx +++ b/src/components/IconFrame.tsx @@ -1,4 +1,5 @@ import { + type ComponentProps, type ReactElement, type ReactNode, cloneElement, @@ -143,7 +144,10 @@ const IconFrameSC = styled(Flex)<{ : {}), })) -const IconFrame = forwardRef( +const IconFrame = forwardRef< + HTMLDivElement, + IconFrameProps & ComponentProps +>( ( { icon, @@ -154,6 +158,7 @@ const IconFrame = forwardRef( tooltip, tooltipProps, type = 'tertiary', + as, ...props }, ref @@ -162,6 +167,7 @@ const IconFrame = forwardRef( if (tooltip && typeof tooltip === 'boolean') { tooltip = textValue } + const forwardedAs = as || (clickable ? ButtonBase : undefined) let content = ( ( ref={ref} flex={false} aria-label={textValue} - forwardedAs={(props as any).as} + {...(forwardedAs ? { forwardedAs } : {})} {...(clickable && { - forwardedAs: (props as any).as || ButtonBase, tabIndex: 0, role: 'button', type: 'button',