UNPKG

@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

40 lines (39 loc) 1.76 kB
import { jsx, jsxs } from "react/jsx-runtime"; import { CheckIcon, MinusIcon } from "@heroicons/react/24/outline"; import { Indicator, Root } from "@radix-ui/react-checkbox"; import external_clsx_default from "clsx"; import { useMemo } from "react"; const Checkbox = ({ indeterminate, className, checked, onChange, ...props })=>{ const status = useMemo(()=>{ if (indeterminate) return "indeterminate"; return checked; }, [ indeterminate, checked ]); return /*#__PURE__*/ jsx(Root, { checked: status, onCheckedChange: (checked)=>{ onChange?.({ target: { checked: "indeterminate" === checked ? false : checked, indeterminate: "indeterminate" === checked } }); }, className: external_clsx_default("outline-nextadmin-primary-500 flex h-4 w-4 items-center justify-center rounded border text-white focus:outline focus:outline-1 focus:outline-offset-2", (true === status || "indeterminate" === status) && "border-nextadmin-primary-500 bg-nextadmin-primary-500", false === status && "border-nextadmin-border-default dark:border-dark-nextadmin-border-default bg-nextadmin-background-default dark:bg-dark-nextadmin-background-default", className), ...props, children: /*#__PURE__*/ jsxs(Indicator, { children: [ indeterminate && /*#__PURE__*/ jsx(MinusIcon, { className: "h-4 w-4" }), true === status && /*#__PURE__*/ jsx(CheckIcon, { className: "h-4 w-4" }) ] }) }); }; const radix_Checkbox = Checkbox; export { radix_Checkbox as default };