953f598b9b
Componentes React reutilizables: card, dialog, tabs, select, alert, badge, button, input, label, skeleton, tooltip, progress_bar, page_header, form_field, settings_page, crud_page, analytics_page, dashboard_layout. Charts: area, bar, line, sparkline, kpi_card, chart_container. Hooks Wails: use_wails_query, use_wails_mutation, use_wails_stream, use_wails_event, use_animated_canvas. Funciones core: cn, format_compact, chart_colors, get_series_color, wails_cache, theme_config_to_colors. Tipos: chart_series, wails_ipc, theme_config, component_variants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import * as React from "react"
|
|
import { Input as InputPrimitive } from "@base-ui/react/input"
|
|
import { cn } from "../core/cn"
|
|
|
|
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
return (
|
|
<InputPrimitive
|
|
type={type}
|
|
data-slot="input"
|
|
className={cn(
|
|
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground 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 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
"group-has-[data-slot=input-icon-start]/input-group:pl-9",
|
|
"group-has-[data-slot=input-icon-end]/input-group:pr-9",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
interface InputGroupProps {
|
|
children: React.ReactNode
|
|
className?: string
|
|
}
|
|
|
|
function InputGroup({ children, className }: InputGroupProps) {
|
|
return (
|
|
<div data-slot="input-group" className={cn("group/input-group relative", className)}>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
interface InputIconProps {
|
|
children: React.ReactNode
|
|
position: "start" | "end"
|
|
className?: string
|
|
}
|
|
|
|
function InputIcon({ children, position, className }: InputIconProps) {
|
|
return (
|
|
<span
|
|
data-slot={`input-icon-${position}`}
|
|
className={cn(
|
|
"pointer-events-none absolute top-1/2 -translate-y-1/2 text-muted-foreground [&_svg]:size-4",
|
|
position === "start" && "left-2.5",
|
|
position === "end" && "right-2.5",
|
|
className
|
|
)}
|
|
>
|
|
{children}
|
|
</span>
|
|
)
|
|
}
|
|
|
|
export { Input, InputGroup, InputIcon }
|