import { forwardRef, type ButtonHTMLAttributes, type ForwardedRef } from 'react'
import {
getIconButtonProps,
getIconProps,
splitClassNameProp,
} from '@pluralsight/headless-styles'
import type { IconButtonOptions } from '@pluralsight/headless-styles/types'
import type { UsesIconProps } from './shared/types.ts'
interface IconButtonProps
extends IconButtonOptions,
Required,
ButtonHTMLAttributes {}
function IconButtonEl(
props: IconButtonProps,
ref: ForwardedRef
) {
const { ariaLabel, sentiment, size, usage, icon, ...nativeProps } = props
const pandoProps = getIconButtonProps({
ariaLabel,
classNames: splitClassNameProp(nativeProps.className),
disabled: nativeProps.disabled,
sentiment,
size,
usage,
})
const Icon = icon ?? null
return (
)
}
export const IconButton = forwardRef(
IconButtonEl
)