import { useQuery } from "@tanstack/react-query"; import { cn } from "@/lib/utils"; import { api } from "@/services/api"; import { Loader2, AlertCircle } from "lucide-react"; import * as React from "react"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@edr/ui-common"; export interface DynamicSelectProps { code: string; placeholder?: string; value?: string; onValueChange?: (value: string) => void; disabled?: boolean; className?: string; } export function DynamicSelect({ code, placeholder, value, onValueChange, disabled, className, }: DynamicSelectProps) { const { data, isLoading, isError } = useQuery( api.dropdownSettings.getByCode.queryOptions({ input: { code } }), ); if (isLoading) { return (