import { AnchorHTMLAttributes, HTMLAttributes, MouseEventHandler, default as React } from 'react'; import { SelectedAriaAttributes } from '../../types'; import { ActionCardAriaAttributes } from './ActionCard.utils'; export interface ActionCardProps extends HTMLAttributes { /** ARIA attributes to ensure accessibility. 'aria-labelledby' OR 'aria-label' is required. * * `{'aria-label'? string;` * `'aria-labelledby'?: string;}` * */ aria: SelectedAriaAttributes; /** Child areas to render within the card. */ children: React.ReactNode; /** Additional class name to apply to the content wrapper element. */ classNameContentWrapper?: string; /** * Sets the orientation of the card. * @default 'vertical' */ orientation?: 'vertical' | 'horizontal'; /** * Sets the padding for the content inside the card. * @default 'medium' */ padding?: 'small' | 'medium'; /** * Sets the visual style of the card. * - `'outlined'`: Subtle border, ideal for grids and dense layouts. * - `'elevated'`: Drop shadow for visual emphasis or background separation. * @default 'outlined' */ variant?: 'outlined' | 'elevated'; } /** Props for any "slot" component */ export interface ActionCardSlotProps { children: React.ReactNode; className?: string; } /** * Props for the PrimaryAction slot when used as a link or button. * Supports links (href) and buttons (onClick), as well as custom link components * (e.g., react-router Link) via the linkComponent prop. */ export interface PrimaryActionInteractiveProps extends Omit, 'onClick' | 'children'> { /** * Accessible label for the primary action. This is visually hidden but read by screen readers. * Should describe where the link/button navigates to or what action it performs. */ children: React.ReactNode; /** Additional class name for styling. */ className?: string; /** Not applicable for link/button primary actions. */ control?: never; /** URL for the primary action when used as a link. */ href?: string; /** * Custom link component (e.g., react-router Link, Next.js Link). * When provided, `href` is ignored and the linkComponent handles navigation. */ linkComponent?: React.ReactElement & React.RefAttributes & { onClick?: () => void; to?: string; }>; /** Click handler when used as a button. If provided without href, renders as a button. */ onClick?: MouseEventHandler; } /** * Props for the PrimaryAction slot when used as a checkbox selection control. * Renders a checkbox and turns the whole card into a single selectable control, * reusing the card's overlay, hover and focus behaviour. It works standalone and * inside a `DSActionCardGroup` with `control='checkbox'`, which then supplies the * shared `name` and the group's disabled/invalid state. */ export interface PrimaryActionCheckboxProps { /** * Renders a selection control as the card's primary action. * The entire card becomes the click target for the control. */ control: 'checkbox'; /** Accessible label for the selection control. Visually hidden but read by screen readers. */ label: string; /** * Whether the control is checked (controlled mode). * @default false */ checked?: boolean; /** Additional class name applied to the selection control. */ className?: string; /** * Initial checked state (uncontrolled mode). * @default false */ defaultChecked?: boolean; /** * Disables the control and prevents card selection. * @default false */ disabled?: boolean; /** Unique id for the control. Auto-generated when omitted. */ id?: string; /** * Sets the control to an indeterminate state. * @default false */ indeterminate?: boolean; /** * Marks the control as invalid, typically used for form validation. * @default false */ invalid?: boolean; /** Value submitted when this card is checked. Only relevant inside a `DSActionCardGroup`, which supplies the shared form field `name`. */ value?: string; /** Callback fired when the selection state changes. */ onChange?: (event: React.ChangeEvent) => void; } /** * Props for the PrimaryAction slot when used as a radio selection control. * Must be used inside a `DSActionCardGroup`, which supplies the shared radio * `name`, the currently selected value and the group's disabled/invalid state. * Selecting a card fires the group's `onChange`. */ export interface PrimaryActionRadioProps { /** * Renders a radio selection control as the card's primary action. * The entire card becomes the click target for the control. */ control: 'radio'; /** Accessible label for the radio control. Visually hidden but read by screen readers. */ label: string; /** Value submitted when this card is selected. Must be unique within the group. */ value: string; /** Additional class name applied to the selection control. */ className?: string; /** * Disables this card and prevents its selection. * @default false */ disabled?: boolean; /** Unique id for the control. Auto-generated when omitted. */ id?: string; } /** * Props for the PrimaryAction slot when used as a selection control * (checkbox or radio). */ export type PrimaryActionSelectionProps = PrimaryActionCheckboxProps | PrimaryActionRadioProps; /** * Props for the PrimaryAction slot. * Either an interactive link/button action or a selection control. */ export type PrimaryActionSlotProps = PrimaryActionInteractiveProps | PrimaryActionSelectionProps; /** Compound type for ActionCard with its static slots */ interface ActionCardComponent extends React.FC { Header: React.FC; Footer: React.FC; Media: React.FC; PrimaryAction: React.FC; Supplementary: React.FC; } /** * A flexible card component that can display various types of content and media. It renders a semantic `
` element as non-clickable container that groups interactive and non-interactive elements. * * - Slot-based structure: configurable slots (media, header, footer, supplementary, and primary action) that can be customized. * - Optional card-level interaction: use the `PrimaryAction` slot to make the entire card clickable while keeping other interactive elements (buttons, checkboxes) accessible. * - Internal interactions only: interactive elements (e.g. CTAs) inside the card are clickable and focusable, even when PrimaryAction is used. * - Slot components only: children that are not one of the card's slot components are not rendered. In development, a console warning lists any ignored children. * * Design in Figma: [Action Card](https://www.figma.com/design/qXldpLO6gxHJNLdcXIPxYt/Core-Components-%F0%9F%92%A0?node-id=47366-6210) * *
Looking for Selectable Card or Product Card? Both are based on DSActionCard and are not separate components. The Selectable Card is documented in the Selectable card section below and in DSActionCardGroup. Ready-to-use patterns are under Templates: Selectable Card, Selectable Card Group, Action Card Responsive and the Product Card templates in Grid, List and in Carousel.
*/ export declare const DSActionCard: ActionCardComponent; export {};