import { ListItem as SurfaceListItem } from '@ankhorage/surface';
import React from 'react';
import type { ListItemProps, ListItemVariant } from '../../../../types/list';
import { View } from '../../../layout/public';
import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
import { Text } from '../../../typography/public';
import { resolveListItemTitleLineCount } from '../../utils/resolveListItemTitleLineCount';
function ListItemInner({
themeId: _themeId,
mode: _mode,
testID,
interactionPolicy,
title,
description,
meta,
leading,
trailing,
action,
onPress,
selected = false,
disabled = false,
compact = false,
variant = 'divider',
}: ListItemProps) {
const { theme } = useZoraTheme();
const trailingContent = renderTrailing(trailing, action);
return (
{title}
{description ? (
{description}
) : null}
{meta ? (
{meta}
) : null}
);
}
function resolveRadius(variant: ListItemVariant) {
return variant === 'card' ? ('l' as const) : ('m' as const);
}
function renderTrailing(trailing: React.ReactNode, action: React.ReactNode) {
if (!trailing && !action) return undefined;
return (
{trailing}
{action}
);
}
/*** Opinionated list item built on the Surface list-item interaction and geometry boundary. */
export const ListItem = withZoraThemeScope(ListItemInner);