// src/features/legislativas/provinciales/BancasWidget.tsx (Corregido)
import { useState, useEffect, useMemo } from 'react';
import { useQuery } from '@tanstack/react-query';
import Select from 'react-select'; // --- CAMBIO: Importar react-select ---
import { getBancasPorSeccion, getSeccionesElectoralesConCargos } from '../../../apiService';
import type { ProyeccionBancas, MunicipioSimple } from '../../../types/types';
import { Tooltip } from 'react-tooltip';
import './BancasWidget.css';
import type { Property } from 'csstype';
type CamaraType = 'diputados' | 'senadores';
// --- CAMBIO: Estilos para el nuevo selector ---
const customSelectStyles = {
    control: (base: any) => ({ ...base, minWidth: '200px', border: '1px solid #ced4da', boxShadow: 'none', '&:hover': { borderColor: '#86b7fe' } }),
    menu: (base: any) => ({ ...base, zIndex: 10 }),
};
const WaffleDisplay = ({ data }: { data: ProyeccionBancas['proyeccion'] }) => {
    // El componente WaffleDisplay no necesita cambios en su lógica
    return (
        
            {data.map(partido => (
                partido.bancas > 0 && (
                    
                        {Array.from({ length: partido.bancas }).map((_, index) => (
                            
                        ))}
                    
                )
            ))}
        
            
                
Bancas Proyectadas: {totalBancasEnJuego}
                
            
                
                
            
            
                
                    {isLoading ? 
Cargando...
 :
                        errorMessage ? 
{errorMessage}
 :
                            totalBancasEnJuego > 0 ? 
 :
                                
No hay bancas proyectadas para mostrar.
                    }
                
                    
                        {leyendaData.map(partido => (
                            - 
                                
                                
                                    {partido.nombreCorto || partido.agrupacionNombre}
                                
                                {partido.bancas}
                            ))}
 
             
            
         
    );
};