@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
138 lines (137 loc) • 7.21 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_ClientActionDialog
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const react_namespaceObject = require("@headlessui/react");
const external_clsx_namespaceObject = require("clsx");
var external_clsx_default = /*#__PURE__*/ __webpack_require__.n(external_clsx_namespaceObject);
const external_react_namespaceObject = require("react");
const external_tailwind_merge_namespaceObject = require("tailwind-merge");
const Loader_js_namespaceObject = require("../assets/icons/Loader.js");
var Loader_js_default = /*#__PURE__*/ __webpack_require__.n(Loader_js_namespaceObject);
const ConfigContext_js_namespaceObject = require("../context/ConfigContext.js");
const tools_js_namespaceObject = require("../utils/tools.js");
const Dialog_js_namespaceObject = require("./radix/Dialog.js");
const VisuallyHidden_js_namespaceObject = require("./radix/VisuallyHidden.js");
const react19_compat_js_namespaceObject = require("../utils/react19-compat.js");
const ClientActionDialog = ({ resource, resourceIds, onClose, action })=>{
const [isLoading, setIsLoading] = (0, external_react_namespaceObject.useState)(false);
const [data, setData] = (0, external_react_namespaceObject.useState)(null);
const { apiBasePath } = (0, ConfigContext_js_namespaceObject.useConfig)();
(0, external_react_namespaceObject.useEffect)(()=>{
setIsLoading(true);
const params = new URLSearchParams();
params.set("ids", resourceIds.join(","));
if (action.depth) params.set("depth", Math.max(1, action.depth).toString());
fetch(`${apiBasePath}/${(0, tools_js_namespaceObject.slugify)(resource)}/raw?${params.toString()}`).then((res)=>res.json()).then(setData).finally(()=>{
setIsLoading(false);
});
}, [
resource,
resourceIds
]);
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dialog_js_namespaceObject.DialogRoot, {
open: true,
onOpenChange: (open)=>{
if (!open) onClose();
},
modal: true,
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dialog_js_namespaceObject.DialogPortal, {
forceMount: true,
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(react_namespaceObject.Transition, {
show: true,
as: "div",
children: [
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.TransitionChild, {
as: external_react_namespaceObject.Fragment,
enter: "transition-opacity ease-in-out duration-300",
enterFrom: "opacity-0",
enterTo: "opacity-100",
leaveFrom: "opacity-100",
leaveTo: "opacity-0",
leave: "transition-opacity ease-in-out duration-300",
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dialog_js_namespaceObject.DialogOverlay, {
forceMount: true
})
}),
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.TransitionChild, {
as: external_react_namespaceObject.Fragment,
enter: "transition-opacity ease-in-out duration-300",
enterFrom: "opacity-0",
enterTo: "opacity-100",
leaveFrom: "opacity-100",
leaveTo: "opacity-0",
leave: "transition-opacity ease-in-out duration-300",
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Dialog_js_namespaceObject.DialogContent, {
className: (0, external_tailwind_merge_namespaceObject.twMerge)(external_clsx_default()("max-h-[90vh] max-w-screen-md max-w-xl overflow-y-auto outline-none md:left-[50%] md:top-[50%]", action?.className)),
forceMount: true,
"aria-describedby": void 0,
children: [
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VisuallyHidden_js_namespaceObject.VisuallyHiddenRoot, {
asChild: true,
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dialog_js_namespaceObject.DialogTitle, {
children: action.title
})
}),
isLoading && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
className: "flex items-center justify-center",
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Loader_js_default(), {
className: "stroke-nextadmin-content-default dark:stroke-dark-nextadmin-content-default h-6 w-6 animate-spin dark:stroke-gray-300"
})
}),
data && /*#__PURE__*/ (0, external_react_namespaceObject.cloneElement)((0, react19_compat_js_namespaceObject.getClonableElement)(action.component), {
data: data,
resource,
resourceIds,
onClose
})
]
})
})
]
})
})
});
};
const components_ClientActionDialog = ClientActionDialog;
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
});