@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
115 lines (114 loc) • 5.84 kB
JavaScript
;
var __webpack_require__ = {};
(()=>{
__webpack_require__.n = (module)=>{
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
__webpack_require__.d(getter, {
a: getter
});
return getter;
};
})();
(()=>{
__webpack_require__.d = (exports1, definition)=>{
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
enumerable: true,
get: definition[key]
});
};
})();
(()=>{
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
__webpack_require__.r = (exports1)=>{
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
value: 'Module'
});
Object.defineProperty(exports1, '__esModule', {
value: true
});
};
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
default: ()=>components_ActionsDropdown
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const react_namespaceObject = require("@headlessui/react");
const outline_namespaceObject = require("@heroicons/react/24/outline");
const external_react_namespaceObject = require("react");
const I18nContext_js_namespaceObject = require("../context/I18nContext.js");
const external_ActionDropdownItem_js_namespaceObject = require("./ActionDropdownItem.js");
var external_ActionDropdownItem_js_default = /*#__PURE__*/ __webpack_require__.n(external_ActionDropdownItem_js_namespaceObject);
const Dropdown_js_namespaceObject = require("./radix/Dropdown.js");
const ActionsDropdown = ({ actions, selectedIds, resource, selectedCount })=>{
const { t } = (0, I18nContext_js_namespaceObject.useI18n)();
const [isOpen, setIsOpen] = (0, external_react_namespaceObject.useState)(false);
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Dropdown_js_namespaceObject.Dropdown, {
onOpenChange: setIsOpen,
children: [
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dropdown_js_namespaceObject.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__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
type: "button",
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
className: "flex gap-1",
children: [
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
className: "hidden md:block",
children: [
t("actions.label"),
" ",
(selectedCount ?? 0) > 1 ? `(${selectedCount})` : ""
]
}),
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(outline_namespaceObject.ChevronDownIcon, {
className: "hidden h-5 w-5 md:block",
"aria-hidden": "true"
}),
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(outline_namespaceObject.EllipsisVerticalIcon, {
className: "block h-5 w-5 md:hidden",
"aria-hidden": "true"
})
]
})
})
}),
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dropdown_js_namespaceObject.DropdownBody, {
forceMount: true,
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.Transition, {
show: isOpen,
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.TransitionChild, {
as: Dropdown_js_namespaceObject.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__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ActionDropdownItem_js_default(), {
action: action,
resourceIds: selectedIds,
resource: resource
}, action.id))
})
})
})
]
});
};
const components_ActionsDropdown = ActionsDropdown;
exports["default"] = __webpack_exports__["default"];
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
"default"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
value: true
});