import type { VariantProps } from "class-variance-authority"
import type { ButtonProps as ReactAriaButtonProps } from "react-aria-components"

import type { buttonVariants } from "./variants"

export interface ButtonPropsRAC
  extends Omit<ReactAriaButtonProps, "isDisabled" | "onClick">,
    VariantProps<typeof buttonVariants> {
  asChild?: false | undefined | never
  disabled?: ReactAriaButtonProps["isDisabled"]
  onClick?: ReactAriaButtonProps["onPress"]
}

export interface ButtonPropsSlot
  extends React.ButtonHTMLAttributes<HTMLButtonElement>,
    VariantProps<typeof buttonVariants> {
  asChild: true
}

export type ButtonProps = ButtonPropsSlot | ButtonPropsRAC
