import { Card as SurfaceCard } from '@ankhorage/surface';
import React from 'react';
import type { CardProps } from '../../../../types/card';
import { View } from '../../../layout/public';
import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
import { useZoraThemeRecipe } from '../../../theme/composition/useZoraThemeRecipe';
import { Heading } from '../../../typography/public';
import { Text } from '../../../typography/public';
import { resolveCardThemeRecipe } from '../../utils/resolveCardThemeRecipe';
import { resolveCardVariant } from '../../utils/resolveCardVariant';
/***
* Structured content container with built-in heading, description, actions, and footer slots.
*
* Use `Card` for reusable content blocks that should inherit ZORA spacing,
* radius, tone, and responsive header layout without hand-assembling primitives.
*
* @example Content card
* ```tsx
* ...
* ```
*/
export const Card = withZoraThemeScope(CardInner);
function CardInner({
themeId: _themeId,
mode: _mode,
children,
title,
description,
eyebrow,
actions,
footer,
tone,
compact,
padding,
radius,
onPress,
interactionPolicy,
...props
}: CardProps) {
const themeFields = useZoraThemeRecipe('Card');
const recipe = resolveCardThemeRecipe({ tone, compact, padding, radius, themeFields });
const hasHeader = [eyebrow, title, description, actions].some((item) => item != null);
const hasFooter = footer !== undefined;
const gap = recipe.compact ? 's' : 'm';
const isInteractive = Boolean(onPress) && !actions;
const passive = interactionPolicy === 'passive';
return (
{hasHeader ? (
{eyebrow ? (
{eyebrow}
) : null}
{title ? {title} : null}
{description ? (
{description}
) : null}
{actions ? {actions} : null}
) : null}
{children ? {children} : null}
{hasFooter ? {footer} : null}
);
}