import { PencilSimpleRegularIcon } from "alouette-icons/phosphor-icons/PencilSimple";
import type { ReactNode } from "react";
import type { Accent } from "../../core/AlouetteConfig";
import type { IconButtonProps } from "../actions/IconButton";
import { IconButton } from "../actions/IconButton";
import type { SVGIconElement } from "../primitives/Icon";
import { Text } from "../primitives/Text";
import { View } from "../primitives/View";
export interface EditableItemProps {
label: string;
/** Current value shown next to the label — a Badge, a Text, anything short. */
summary?: ReactNode;
/** Muted helper text under the label. */
details?: ReactNode;
/** Names the edit button for assistive tech — it has no visible text. */
editAriaLabel: string;
editIcon?: SVGIconElement;
variant?: IconButtonProps["variant"];
accent?: Accent;
disabled?: boolean;
onEdit: () => void;
/** Rendered under the row, when the value is too large for `summary`. */
children?: ReactNode;
}
/**
* A labelled value with an edit affordance. Owns no editor: pair it with
* FormEditableItem for a react-hook-form modal, or compose your own Modal
* from `onEdit`.
*/
export function EditableItem({
label,
summary,
details,
editAriaLabel,
editIcon = ,
variant,
accent,
disabled,
onEdit,
children,
}: EditableItemProps): ReactNode {
return (
{label}
{summary}
{details ? (
{details}
) : null}
{children}
);
}