import { Button } from "@repo/shadcn-ui/components/button";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@repo/shadcn-ui/components/select";
import { PlusIcon } from "lucide-react";
import { ButtonGroup } from "./button-group";
export type SelectOption = { value: string; label: string; disabled?: boolean };
export type SelectAction = { label: string; onClick: () => void; disabled?: boolean };
/** Selección controlada con una acción adyacente; el consumidor gestiona el alta y su contexto. */
export function SelectWithAction({
id,
label,
options,
placeholder,
value,
onValueChange,
disabled = false,
action,
required = false,
invalid = false,
describedBy,
}: {
id: string;
label: string;
options: readonly SelectOption[];
placeholder: string;
value: string;
onValueChange: (value: string) => void;
disabled?: boolean;
action?: SelectAction | undefined;
required?: boolean;
invalid?: boolean;
describedBy?: string | undefined;
}) {
const select = (
);
if (!action) {
return select;
}
return (
{select}
);
}