diff --git a/src/app/components/_content.tsx b/src/app/components/_content.tsx index 68e25c8..7169226 100644 --- a/src/app/components/_content.tsx +++ b/src/app/components/_content.tsx @@ -163,7 +163,7 @@ export default function ComponentsContent() { }> Con ícono - {}}> + { }}> Removable @@ -279,15 +279,15 @@ export default function ComponentsContent() { setChecked(e.target.checked)} + isSelected={checked} + onChange={(isSelected) => setChecked(isSelected)} /> {}} + onChange={() => { }} /> @@ -302,8 +302,8 @@ export default function ComponentsContent() { setChecked(e.target.checked)} + isSelected={checked} + onChange={(isSelected) => setChecked(isSelected)} /> , 'type'> { +import React from "react"; +import { + Checkbox as HeroUICheckbox, + Description, + FieldError, +} from "@heroui/react"; + +import { FiCheck, FiMinus } from "react-icons/fi"; + +export interface CheckboxProps + extends Omit< + React.ComponentProps, + "children" | "defaultSelected" | "isDisabled" | "isInvalid" | "isIndeterminate" + > { label?: React.ReactNode; description?: string; errorMessage?: string; + checked?: boolean; + disabled?: boolean; indeterminate?: boolean; + className?: string; } -export const Checkbox = React.forwardRef( - ( - { - label, - description, - errorMessage, - indeterminate = false, - checked, - disabled, - className = '', - id, - name, - ...props - }, - forwardedRef - ) => { - const internalRef = useRef(null); - const resolvedRef = (forwardedRef as React.RefObject) || internalRef; - const checkboxId = id || name || (typeof label === 'string' ? label.toLowerCase().replace(/\s+/g, '-') : undefined); +export const Checkbox = ({ + label, + description, + errorMessage, + indeterminate = false, + checked, + isSelected, + disabled = false, + className = "", + id, + name, + onChange, + ...props +}: CheckboxProps) => { + return ( + + + { - if (resolvedRef.current) { - resolvedRef.current.indeterminate = indeterminate; - } - }, [indeterminate, resolvedRef]); + // Estado normal + "bg-white dark:bg-slate-900", + "border-slate-300 dark:border-slate-700", - const isChecked = Boolean(checked); + // Hover + "group-hover:border-slate-400", + "dark:group-hover:border-slate-500", - return ( -
-