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

71 lines (70 loc) 3.64 kB
import { jsx, jsxs } from "react/jsx-runtime"; import { Transition, TransitionChild } from "@headlessui/react"; import { ChevronDownIcon, EllipsisVerticalIcon } from "@heroicons/react/24/outline"; import { useState } from "react"; import { useI18n } from "../context/I18nContext.mjs"; import external_ActionDropdownItem_mjs_default from "./ActionDropdownItem.mjs"; import { Dropdown, DropdownBody, DropdownContent, DropdownTrigger } from "./radix/Dropdown.mjs"; const ActionsDropdown = ({ actions, selectedIds, resource, selectedCount })=>{ const { t } = useI18n(); const [isOpen, setIsOpen] = useState(false); return /*#__PURE__*/ jsxs(Dropdown, { onOpenChange: setIsOpen, children: [ /*#__PURE__*/ jsx(DropdownTrigger, { asChild: true, className: "text-nextadmin-content-inverted dark:text-dark-nextadmin-brand-inverted border-nextadmin-border-default dark:border-dark-nextadmin-border-default dark:bg-dark-nextadmin-background-subtle flex min-w-fit items-center gap-x-2 rounded-md border bg-transparent px-3 py-2 text-sm", "data-testid": "actions-dropdown", children: /*#__PURE__*/ jsx("button", { type: "button", children: /*#__PURE__*/ jsxs("div", { className: "flex gap-1", children: [ /*#__PURE__*/ jsxs("span", { className: "hidden md:block", children: [ t("actions.label"), " ", (selectedCount ?? 0) > 1 ? `(${selectedCount})` : "" ] }), /*#__PURE__*/ jsx(ChevronDownIcon, { className: "hidden h-5 w-5 md:block", "aria-hidden": "true" }), /*#__PURE__*/ jsx(EllipsisVerticalIcon, { className: "block h-5 w-5 md:hidden", "aria-hidden": "true" }) ] }) }) }), /*#__PURE__*/ jsx(DropdownBody, { forceMount: true, children: /*#__PURE__*/ jsx(Transition, { show: isOpen, children: /*#__PURE__*/ jsx(TransitionChild, { as: DropdownContent, className: "min-w-[10rem] p-2", sideOffset: 4, "data-testid": "actions-dropdown-content", enter: "transition-all ease-out", enterFrom: "opacity-0 -translate-y-1", enterTo: "opacity-100 translate-y-0", leave: "transition-all ease-in", leaveFrom: "opacity-100 translate-y-0", leaveTo: "opacity-0 -translate-y-1", children: actions?.map((action)=>/*#__PURE__*/ jsx(external_ActionDropdownItem_mjs_default, { action: action, resourceIds: selectedIds, resource: resource }, action.id)) }) }) }) ] }); }; const components_ActionsDropdown = ActionsDropdown; export { components_ActionsDropdown as default };