"use client"; import * as React from "react"; import { cn } from "./lib/utils"; export interface PaymentMethod { id: string; label: string; description?: string; icon: "card" | "bank" | "cash" | "wallet"; } export interface PaymentMethodsProps extends React.HTMLAttributes { methods: PaymentMethod[]; value?: string; defaultValue?: string; onValueChange?: (id: string) => void; } const ICONS: Record = { card: <>, bank: <>, cash: <>, wallet: <>, }; /** Payment method selector: card / bank / on-delivery / wallet tiles. */ export function PaymentMethods({ methods, value, defaultValue, onValueChange, className, ...props }: PaymentMethodsProps) { const [internal, setInternal] = React.useState(defaultValue ?? methods[0]?.id); const active = value ?? internal; return (
{methods.map((m, idx) => { const selected = active === m.id; return ( ); })}
); }