refactor: migrate frontend from shadcn/Tailwind to Mantine v9
Reescribe todos los componentes UI para usar Mantine v9 en lugar de shadcn/Tailwind. Elimina cn(), CVA, components.json, theme_provider custom y globals.css con Tailwind. Añade 25+ componentes nuevos (AppShell, AuthForm, DatePickerInput, Dropzone, etc.) y MantineProvider como wrapper estándar del sistema de temas. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,67 +3,104 @@ name: select
|
||||
kind: component
|
||||
lang: ts
|
||||
domain: ui
|
||||
version: "1.0.0"
|
||||
version: "2.0.0"
|
||||
purity: impure
|
||||
signature: "Select<T>(props: SelectRootProps<T>): JSX.Element"
|
||||
description: "Select genérico accesible con grupos, separadores y animaciones. Base-UI primitive con posicionamiento automático."
|
||||
tags: [select, form, dropdown, component, ui, interactive]
|
||||
uses_functions: [cn_ts_core]
|
||||
signature: "Select(props: SelectProps): JSX.Element"
|
||||
description: "Select dropdown con búsqueda, grupos y accesibilidad. Wrapper sobre Mantine Select con API declarativa via prop data."
|
||||
tags: [select, form, dropdown, component, ui, interactive, mantine]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: ["@base-ui/react", lucide-react, react]
|
||||
output: "Componente Select que renderiza dropdown genérico accesible con grupos, separadores y posicionamiento automático"
|
||||
imports: ["@mantine/core"]
|
||||
output: "Componente Select que renderiza dropdown searchable con soporte para opciones planas, agrupadas y custom render"
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "frontend/functions/ui/select.tsx"
|
||||
props:
|
||||
- name: data
|
||||
type: "string[] | { value: string; label: string; disabled?: boolean }[] | { group: string; items: ... }[]"
|
||||
required: true
|
||||
description: "Opciones del select — strings, objetos {value,label}, o grupos"
|
||||
- name: value
|
||||
type: "T"
|
||||
type: "string | null"
|
||||
required: false
|
||||
description: "Valor seleccionado (controlled)"
|
||||
- name: onValueChange
|
||||
type: "(value: T) => void"
|
||||
- name: onChange
|
||||
type: "(value: string | null) => void"
|
||||
required: false
|
||||
description: "Callback al cambiar selección"
|
||||
- name: defaultValue
|
||||
type: "T"
|
||||
type: "string | null"
|
||||
required: false
|
||||
description: "Valor inicial (uncontrolled)"
|
||||
- name: placeholder
|
||||
type: "string"
|
||||
required: false
|
||||
description: "Texto cuando no hay selección"
|
||||
- name: label
|
||||
type: "string"
|
||||
required: false
|
||||
description: "Label del campo"
|
||||
- name: searchable
|
||||
type: "boolean"
|
||||
required: false
|
||||
description: "Permite buscar entre opciones"
|
||||
- name: clearable
|
||||
type: "boolean"
|
||||
required: false
|
||||
description: "Permite limpiar la selección"
|
||||
- name: disabled
|
||||
type: "boolean"
|
||||
required: false
|
||||
description: "Deshabilitar el select"
|
||||
emits: [onValueChange]
|
||||
- name: size
|
||||
type: "'xs' | 'sm' | 'md' | 'lg' | 'xl'"
|
||||
required: false
|
||||
description: "Tamaño del componente"
|
||||
emits: [onChange]
|
||||
has_state: true
|
||||
framework: react
|
||||
variant: [default]
|
||||
source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/Bl4cksmith/Frontend_Library"
|
||||
source_license: "MIT"
|
||||
source_file: "frontend/src/components/ui/select.tsx"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```tsx
|
||||
<Select>
|
||||
<SelectTrigger><SelectValue placeholder="Elegir..." /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectGroupLabel>Frutas</SelectGroupLabel>
|
||||
<SelectItem value="apple">Manzana</SelectItem>
|
||||
<SelectItem value="banana">Banana</SelectItem>
|
||||
</SelectGroup>
|
||||
<SelectSeparator />
|
||||
<SelectItem value="other">Otro</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
import { Select } from '@fn_library'
|
||||
|
||||
// Opciones simples (strings)
|
||||
<Select
|
||||
label="Tu librería favorita"
|
||||
placeholder="Elige una"
|
||||
data={['React', 'Angular', 'Vue', 'Svelte']}
|
||||
/>
|
||||
|
||||
// Opciones con value/label
|
||||
<Select
|
||||
value={selected}
|
||||
onChange={setSelected}
|
||||
data={[
|
||||
{ value: 'react', label: 'React' },
|
||||
{ value: 'vue', label: 'Vue' },
|
||||
]}
|
||||
/>
|
||||
|
||||
// Con grupos
|
||||
<Select
|
||||
searchable
|
||||
data={[
|
||||
{ group: 'Frontend', items: [{ value: 'react', label: 'React' }] },
|
||||
{ group: 'Backend', items: [{ value: 'node', label: 'Node.js' }] },
|
||||
]}
|
||||
/>
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Exporta 9 subcomponentes composables: Select, SelectTrigger, SelectValue, SelectPortal, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator.
|
||||
Genérico sobre el tipo de valor T — TypeScript infiere el tipo desde el prop value/defaultValue.
|
||||
Depende de @base-ui/react y lucide-react.
|
||||
- Wrapper directo sobre `Select` de `@mantine/core` v9. Todas las props de Mantine Select son válidas.
|
||||
- Soporta `searchable` para filtrar opciones, `clearable` para limpiar, `allowDeselect` para deseleccionar.
|
||||
- Data acepta: `string[]`, `{ value, label }[]`, o `{ group, items }[]`.
|
||||
- Reemplaza al antiguo `select.tsx` basado en NativeSelect con sub-componentes stub.
|
||||
|
||||
Reference in New Issue
Block a user