(props: CheckboxProps)
| 50 | } |
| 51 | |
| 52 | export function Checkbox(props: CheckboxProps) { |
| 53 | return ( |
| 54 | <CheckboxField {...props} className="flex flex-col gap-1 group"> |
| 55 | <CheckboxButton |
| 56 | className={composeRenderProps(props.className, (className, renderProps) => |
| 57 | checkboxStyles({...renderProps, className}) |
| 58 | )}> |
| 59 | {composeRenderProps( |
| 60 | props.children, |
| 61 | (children, {isSelected, isIndeterminate, ...renderProps}) => ( |
| 62 | <> |
| 63 | <div |
| 64 | className={boxStyles({isSelected: isSelected || isIndeterminate, ...renderProps})}> |
| 65 | {isIndeterminate ? ( |
| 66 | <Minus aria-hidden className={iconStyles} /> |
| 67 | ) : isSelected ? ( |
| 68 | <Check aria-hidden className={iconStyles} /> |
| 69 | ) : null} |
| 70 | </div> |
| 71 | {children} |
| 72 | </> |
| 73 | ) |
| 74 | )} |
| 75 | </CheckboxButton> |
| 76 | {props.description && <Description className="ms-6.5">{props.description}</Description>} |
| 77 | <FieldError className="ms-6.5">{props.errorMessage}</FieldError> |
| 78 | </CheckboxField> |
| 79 | ); |
| 80 | } |
nothing calls this directly
no test coverage detected