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

73 lines (72 loc) 3.69 kB
import { Fragment, jsx, jsxs } from "react/jsx-runtime"; import external_AdvancedSearchDropdownItem_mjs_default from "./AdvancedSearchDropdownItem.mjs"; import { Dropdown, DropdownBody, DropdownContent, DropdownItem, DropdownSeparator, DropdownTrigger } from "../radix/Dropdown.mjs"; import Button_mjs_default from "../radix/Button.mjs"; import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline"; import { useI18n } from "../../context/I18nContext.mjs"; const AdvancedSearchDropdown = ({ resource, schema, onAddBlock, showBranching = true, trigger })=>{ const { t } = useI18n(); return /*#__PURE__*/ jsxs(Dropdown, { children: [ /*#__PURE__*/ jsx(DropdownTrigger, { asChild: true, children: trigger || /*#__PURE__*/ jsxs(Button_mjs_default, { variant: "ghost", className: "dark:border-dark-nextadmin-border-strong justify-between gap-2 border", children: [ /*#__PURE__*/ jsxs("div", { className: "flex items-center gap-2", children: [ /*#__PURE__*/ jsx(PlusIcon, { className: "h-4 w-4", "aria-hidden": "true" }), t("search.advanced.add") ] }), /*#__PURE__*/ jsx(ChevronDownIcon, { className: "h-4 w-4", "aria-hidden": "true" }) ] }) }), /*#__PURE__*/ jsx(DropdownBody, { children: /*#__PURE__*/ jsxs(DropdownContent, { className: "z-[999] max-h-[300px] w-[max(var(--radix-dropdown-menu-trigger-width),_300px)] overflow-y-auto p-2", avoidCollisions: true, sideOffset: 4, align: "start", children: [ showBranching && /*#__PURE__*/ jsxs(Fragment, { children: [ /*#__PURE__*/ jsx(DropdownItem, { className: "cursor-pointer rounded-md p-2", onClick: ()=>{ onAddBlock({ type: "and", children: [], id: crypto.randomUUID() }); }, children: t("search.advanced.and_or_group") }), /*#__PURE__*/ jsx(DropdownSeparator, { className: "my-0.5" }) ] }), Object.keys(schema.definitions[resource].properties).map((property)=>/*#__PURE__*/ jsx(external_AdvancedSearchDropdownItem_mjs_default, { property: property, schema: schema, resource: resource, onAddBlock: onAddBlock }, property)) ] }) }) ] }); }; const advancedSearch_AdvancedSearchDropdown = AdvancedSearchDropdown; export { advancedSearch_AdvancedSearchDropdown as default };