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:
@@ -1,47 +1,26 @@
|
||||
import * as React from "react"
|
||||
import { cn } from "../core/cn"
|
||||
import * as React from 'react'
|
||||
import { Textarea as MantineTextarea } from '@mantine/core'
|
||||
|
||||
interface TextareaProps extends React.ComponentPropsWithoutRef<"textarea"> {
|
||||
interface TextareaProps extends Omit<React.ComponentProps<typeof MantineTextarea>, 'autosize'> {
|
||||
autoResize?: boolean
|
||||
}
|
||||
|
||||
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
({ className, autoResize = false, onChange, ...props }, ref) => {
|
||||
const internalRef = React.useRef<HTMLTextAreaElement>(null)
|
||||
const resolvedRef = (ref as React.RefObject<HTMLTextAreaElement>) ?? internalRef
|
||||
|
||||
const handleChange = React.useCallback(
|
||||
(e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
||||
if (autoResize && resolvedRef.current) {
|
||||
resolvedRef.current.style.height = "auto"
|
||||
resolvedRef.current.style.height = `${resolvedRef.current.scrollHeight}px`
|
||||
}
|
||||
onChange?.(e)
|
||||
},
|
||||
[autoResize, onChange, resolvedRef]
|
||||
)
|
||||
|
||||
({ className, autoResize = false, ...props }, ref) => {
|
||||
return (
|
||||
<textarea
|
||||
ref={resolvedRef}
|
||||
<MantineTextarea
|
||||
ref={ref}
|
||||
data-slot="textarea"
|
||||
className={cn(
|
||||
"min-h-[80px] w-full rounded-lg border border-input bg-transparent px-3 py-2 text-sm transition-colors outline-none",
|
||||
"placeholder:text-muted-foreground",
|
||||
"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
|
||||
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50",
|
||||
"aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20",
|
||||
"dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
||||
autoResize && "resize-none overflow-hidden",
|
||||
className
|
||||
)}
|
||||
onChange={handleChange}
|
||||
autosize={autoResize}
|
||||
minRows={autoResize ? 2 : undefined}
|
||||
size="sm"
|
||||
className={className}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
)
|
||||
Textarea.displayName = "Textarea"
|
||||
Textarea.displayName = 'Textarea'
|
||||
|
||||
export { Textarea }
|
||||
export type { TextareaProps }
|
||||
|
||||
Reference in New Issue
Block a user