// * Packages import { usePage } from "@inertiajs/react"; import { useState } from "react"; // * Components shadcn import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; // * Other import InputError from "@/back/Components/InputError"; import { AppEnv, Model, TranslationField } from "@/back/types/global"; import { cn } from "@/lib/utils"; type SimpleSelectProps = { name: string; label: string; placeholder?: string; options: Array; field: string; required?: boolean; disabled?: boolean; selected?: string; // eslint-disable-next-line no-unused-vars setData: (name: string, value: string) => void; }; export default function SimpleSelect({ name, label, placeholder = "ex: Administrateur", options = [], field = "label", selected = "", required = true, disabled = false, setData, }: SimpleSelectProps) { const { locale } = usePage().props.appEnv as AppEnv; const { errors } = usePage().props; const [selectedValue, setSelected] = useState(selected); const updateData = (name: string, value: string) => { setSelected(value); setData(name, value); } return (
); }