📡 Especificación de Contratos y Firmas de Props (Componentes)

Artefacto Vivo (Perpetuo / Zero-Touch): Define los contratos formales de propiedades (Props) de los componentes migrados a TypeScript. Cada componente debe adherirse a esta especificación para garantizar interoperabilidad inmediata en Homepage, App-Food-Tracker y futuros proyectos.


⚡ 1. Efectos Cinéticos & Primitivas

CountUp

  • Ubicación: src/effects/CountUp.tsx
  • Props:
    • to: number (Valor numérico final objetivo, requerido)
    • from?: number (Valor inicial, default 0)
    • duration?: number (Duración en segundos, default 1.5)
    • delay?: number (Retardo inicial en segundos, default 0)
    • formatter?: (value: number) => string (Formateador personalizado, ej. moneda o miles)
    • className?: string

DecryptedText

  • Ubicación: src/effects/DecryptedText.tsx
  • Props:
    • text: string (Texto a revelar con efecto de descifrado, requerido)
    • speed?: number (Intervalo de cambio de caracteres en ms, default 40)
    • maxIterations?: number (Iteraciones antes de fijar cada caracter, default 10)
    • characters?: string (Juego de caracteres aleatorios)
    • className?: string
    • parentClassName?: string

SpotlightCard

  • Ubicación: src/effects/SpotlightCard.tsx
  • Props:
    • children: React.ReactNode
    • spotlightColor?: string (Color radial RGBA, default rgba(239, 68, 68, 0.15))
    • spotlightSize?: number (Radio en px, default 300)
    • className?: string

MorphButton (Inspirado en Micron + Animate UI)

  • Ubicación: src/primitives/MorphButton.tsx
  • Props:
    • variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive'
    • size?: 'sm' | 'md' | 'lg'
    • isLoading?: boolean
    • isSuccess?: boolean
    • successText?: string
    • icon?: React.ReactNode
    • onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void | Promise<void>
    • className?: string

Accordion (Inspirado en SortUI sobre Radix UI)

  • Ubicación: src/primitives/Accordion.tsx
  • Props:
    • type?: 'single' | 'multiple' (Default 'single')
    • collapsible?: boolean (Default true)
    • defaultValue?: string | string[]
    • value?: string | string[]
    • onValueChange?: (value: any) => void
    • items: AccordionItemData[]
    • className?: string

🗺️ 2. Módulo Geoespacial (Mapcn / MapLibre)

Map

  • Ubicación: src/map/Map.tsx
  • Props:
    • initialViewport?: MapViewport
    • viewport?: MapViewport
    • onViewportChange?: (viewport: MapViewport) => void
    • mapStyle?: string | object (Estilo vectorial oscuro o claro)
    • theme?: 'dark' | 'light'
    • interactive?: boolean (Default true)
    • children?: React.ReactNode (Marcadores y Popups)
    • className?: string

MapMarker

  • Ubicación: src/map/MapMarker.tsx
  • Props:
    • coordinates: [number, number] ([longitud, latitud])
    • children?: React.ReactNode (Renderizado vía createPortal)
    • onClick?: () => void
    • className?: string

📦 3. Tarjetas Bento & Métricas

KpiCard

  • Ubicación: src/cards/KpiCard.tsx
  • Props:
    • metric: KpiMetric
    • icon?: React.ReactNode
    • sparklineData?: number[]
    • donutValue?: number
    • className?: string
    • onClick?: () => void

SegmentedArcGauge

  • Ubicación: src/cards/SegmentedArcGauge.tsx
  • Props:
    • value: number
    • min?: number
    • max?: number
    • segments?: ArcGaugeSegment[]
    • title?: string
    • subtitle?: string
    • unit?: string
    • size?: 'sm' | 'md' | 'lg'
    • className?: string

🗄️ 4. Tablas de Datos Genéricas

DataTable<T>

  • Ubicación: src/tables/DataTable.tsx
  • Props:
    • data: T[]
    • columns: DataTableColumn<T>[]
    • isLoading?: boolean
    • emptyMessage?: string
    • pagination?: DataTablePagination
    • onRowClick?: (item: T) => void
    • className?: string

🌐 5. Endpoints de API y Servicios (Backend / Vertical Slices)

Resource Service

  • Slice: features/resource
  • Ubicación: src/features/resource/resource.route.ts
  • Contratos HTTP:
    • GET /api/resource
      • Descripción: Endpoint canónico de consulta y listado de recursos del ecosistema.
      • Query Params: page?: number, limit?: number, search?: string
      • Respuesta 200 OK: { "status": "success", "data": ResourceItem[] }
      • Respuesta 400 Bad Request: { "error": string }