import { MouseEvent } from 'react'; import { CardProps } from '../../../components/Card'; import { PassThroughProps } from '../../../types/PassThroughProps'; /** * Props for the wrapper div element. * Contains the group role and aria-label for screen readers. * Can also include className, style, data attributes, and other div props. */ export type WrapperProps = Omit, "onClick" | "children" | "role"> & { /** * ARIA label for the group wrapper. * Describes what the card contains. * @example "Kitchen Measurement 2 card" */ "aria-label": string; }; /** * Props for the action element when rendered as a button. * Includes standard button props (disabled, data attributes, etc.) via PassThroughProps. * Styling and layout are handled internally. */ export type ActionButtonProps = Omit, "children" | "type" | "href" | "className" | "style"> & { /** * ARIA label for the interactive action. * Describes the action that will be taken when clicked. * @example "Expand Kitchen Measurement 2" */ "aria-label": string; /** * Click handler for the card button. * Handles mouse clicks, keyboard activation (Enter/Space), and touch events. */ onClick: (e: MouseEvent) => void; }; /** * Props for the action element when rendered as a link. * Includes standard anchor props (target, rel, data attributes, etc.) via PassThroughProps. * Styling and layout are handled internally. */ export type ActionLinkProps = Omit, "children" | "disabled" | "type" | "className" | "style"> & { /** * ARIA label for the interactive action. * Describes the action that will be taken when clicked. * @example "Navigate to Kitchen Measurement 2" */ "aria-label": string; /** * URL for the card to navigate to. * When provided, the card renders as an anchor element. */ href: string; }; /** * Props for the content layer (Card element). * Includes all Card props for styling and layout (padding, background, gap, etc.). */ export type ContentProps = Omit; /** * Base props shared by both button and link variants of InteractiveCard. */ type InteractiveCardBaseProps = { /** * Props for the wrapper div element. * Includes required aria-label and optional data attributes. */ wrapperProps: WrapperProps; /** * Props for the content layer (Card element). * Controls padding, background, gap, and other Card styling. */ contentProps?: ContentProps; /** * Content to render inside the card. */ children: CardProps["children"]; }; /** * Props for InteractiveCard with button action. */ export type InteractiveCardWithButtonProps = InteractiveCardBaseProps & { /** * Props for the button action element. */ actionProps: ActionButtonProps; }; /** * Props for InteractiveCard with link action. */ export type InteractiveCardWithLinkProps = InteractiveCardBaseProps & { /** * Props for the link action element. */ actionProps: ActionLinkProps; }; /** * Props for the InteractiveCard component. * Can be used as either a button or link variant based on actionProps. * @extends CardProps */ export type InteractiveCardProps = InteractiveCardWithButtonProps | InteractiveCardWithLinkProps; export {};