UNPKG

pagamio-frontend-commons-lib

Version:

Pagamio library for Frontend reusable components like the form engine and table container

6 lines (5 loc) 875 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Checkbox, Label } from 'flowbite-react'; import React from 'react'; const CheckboxInput = React.forwardRef(({ field, error, onChange, ...props }, ref) => (_jsxs("div", { className: "flex flex-row items-start space-x-3 space-y-0", children: [_jsx("div", { className: "flex items-center h-4 mt-1", children: _jsx(Checkbox, { id: field.name, disabled: field.disabled, onChange: (e) => onChange(e.target.checked), ref: ref, ...props, color: error ? 'failure' : 'primary' }) }), _jsxs("div", { className: "space-y-1 leading-none", children: [field.label && (_jsx(Label, { htmlFor: field.name, className: "text-sm font-medium text-gray-700 cursor-pointer", children: field.label })), error && _jsx("p", { className: "text-xs text-red-500", children: error.message })] })] }))); export default CheckboxInput;