@premieroctet/next-admin
Version:
Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje
34 lines (33 loc) • 1.36 kB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
import { useFormState } from "../../context/FormStateContext.mjs";
import { SwitchRoot, SwitchThumb } from "../radix/Switch.mjs";
const CheckboxWidget_CheckboxWidget = ({ options, onChange, value, disabled, ...props })=>{
const { setFieldDirty } = useFormState();
return /*#__PURE__*/ jsx("div", {
className: "relative flex items-start py-1",
children: /*#__PURE__*/ jsxs("div", {
className: "flex h-5 items-center",
children: [
/*#__PURE__*/ jsx("input", {
id: props.name,
value: value ? "on" : "off",
name: props.name,
className: "absolute inset-0 -z-10 h-full w-full opacity-0",
readOnly: true
}),
/*#__PURE__*/ jsx(SwitchRoot, {
id: props.name,
checked: value,
onCheckedChange: (value)=>{
setFieldDirty(props.name);
onChange(value);
},
disabled: disabled,
children: /*#__PURE__*/ jsx(SwitchThumb, {})
})
]
})
});
};
const CheckboxWidget = CheckboxWidget_CheckboxWidget;
export { CheckboxWidget as default };