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

33 lines (32 loc) 1.71 kB
import { jsx, jsxs } from "react/jsx-runtime"; import { XMarkIcon } from "@heroicons/react/24/outline"; import Link_mjs_default from "../../common/Link.mjs"; import { useConfig } from "../../../context/ConfigContext.mjs"; import { slugify } from "../../../utils/tools.mjs"; const MultiSelectItem = ({ item, onRemoveClick, schema, deletable = true })=>{ const { basePath } = useConfig(); const relationModel = item?.data?.modelName ?? schema.items?.relation; return /*#__PURE__*/ jsxs("div", { className: "py border-nextadmin-border-default dark:border-dark-nextadmin-border-strong text-nextadmin-content-inverted dark:text-dark-nextadmin-content-inverted dark:hover:bg-dark-nextadmin-background-muted/50 hover:bg-nextadmin-background-muted relative z-10 flex cursor-default items-center justify-center rounded-md border px-2 text-sm", children: [ relationModel ? /*#__PURE__*/ jsx(Link_mjs_default, { href: `${basePath}/${slugify(relationModel)}/${item.value}`, children: item.label }) : item.label, deletable && /*#__PURE__*/ jsx("button", { type: "button", className: "ml-1 flex-shrink-0 cursor-pointer text-gray-400 hover:text-gray-500", onClick: (e)=>{ e.preventDefault(); e.stopPropagation(); onRemoveClick(item.value); }, children: /*#__PURE__*/ jsx(XMarkIcon, { className: "h-4 w-4" }) }) ] }); }; const MultiSelect_MultiSelectItem = MultiSelectItem; export { MultiSelect_MultiSelectItem as default };