import React, { useMemo, forwardRef, ReactNode, type JSX } from 'react' import { useClassNames } from '../../_lib/useClassNames' import './index.css' export type ClickableProps = { children?: ReactNode /** * The component used for root element. * @type T extends React.ElementType = 'button' */ component?: T } & Omit, 'children'> const Clickable = forwardRef(function Clickable( { component, ...props }: ClickableProps, ref: React.ForwardedRef, ) { const className = useClassNames('charcoal-clickable', props.className) const Component = useMemo(() => component ?? 'button', [component]) return }) as ( p: ClickableProps, ) => JSX.Element export default Clickable /** * @deprecated * remained for v3 compatibility and will be removed in the future */ export type ClickableElement = HTMLButtonElement & HTMLAnchorElement