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

157 lines (156 loc) 8.14 kB
"use strict"; 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: ()=>AdvancedSearchInput }); const jsx_runtime_namespaceObject = require("react/jsx-runtime"); const outline_namespaceObject = require("@heroicons/react/24/outline"); const BaseInput_js_namespaceObject = require("../inputs/BaseInput.js"); var BaseInput_js_default = /*#__PURE__*/ __webpack_require__.n(BaseInput_js_namespaceObject); const Button_js_namespaceObject = require("../radix/Button.js"); var Button_js_default = /*#__PURE__*/ __webpack_require__.n(Button_js_namespaceObject); const Checkbox_js_namespaceObject = require("../radix/Checkbox.js"); var Checkbox_js_default = /*#__PURE__*/ __webpack_require__.n(Checkbox_js_namespaceObject); const Dropdown_js_namespaceObject = require("../radix/Dropdown.js"); const Switch_js_namespaceObject = require("../radix/Switch.js"); const external_AdvancedSearchContext_js_namespaceObject = require("./AdvancedSearchContext.js"); const AdvancedSearchInput_AdvancedSearchInput = ({ uiBlock })=>{ const { updateUiBlock } = (0, external_AdvancedSearchContext_js_namespaceObject.useAdvancedSearchContext)(); if ("filter" !== uiBlock.type || "nnull" === uiBlock.condition || "null" === uiBlock.condition) return null; const onChange = (evt)=>{ let value = evt.target.value; updateUiBlock({ ...uiBlock, value }); }; if ("boolean" === uiBlock.contentType) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Switch_js_namespaceObject.SwitchRoot, { checked: uiBlock.value, onCheckedChange: (checked)=>{ updateUiBlock({ ...uiBlock, value: checked }); }, children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Switch_js_namespaceObject.SwitchThumb, {}) }); if ("enum" === uiBlock.contentType) { const selectedValues = uiBlock.value.split(",").map((val)=>val.trim()).filter(Boolean); return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Dropdown_js_namespaceObject.Dropdown, { children: [ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dropdown_js_namespaceObject.DropdownTrigger, { asChild: true, children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Button_js_default(), { variant: "ghost", className: "dark:border-dark-nextadmin-border-strong justify-between gap-2 border", children: [ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", { className: "flex items-center gap-2", children: selectedValues.join(", ") }), /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(outline_namespaceObject.ChevronDownIcon, { className: "h-4 w-4", "aria-hidden": "true" }) ] }) }), /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dropdown_js_namespaceObject.DropdownBody, { children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dropdown_js_namespaceObject.DropdownContent, { className: "z-[999] max-h-[300px] w-[max(var(--radix-dropdown-menu-trigger-width),_200px)] overflow-y-auto p-2", avoidCollisions: true, sideOffset: 4, align: "start", children: [ "equals", "not" ].includes(uiBlock.condition) ? uiBlock.enum?.map((value)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Dropdown_js_namespaceObject.DropdownItem, { className: "cursor-pointer rounded-md p-2", defaultChecked: uiBlock.defaultValue === value, onClick: ()=>{ updateUiBlock({ ...uiBlock, value }); }, children: value }, value)) : uiBlock.enum?.map((value)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Dropdown_js_namespaceObject.DropdownItem, { className: "flex cursor-pointer items-center gap-2 rounded-md p-2", onClick: (e)=>{ e.preventDefault(); }, children: [ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Checkbox_js_default(), { id: value, name: value, checked: selectedValues?.includes(value), onCheckedChange: (checked)=>{ updateUiBlock({ ...uiBlock, value: checked ? [ ...selectedValues, value ].join(",") : selectedValues.filter((v)=>v !== value).join(",") }); } }), /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("label", { htmlFor: value, onClick: (e)=>e.stopPropagation(), className: "flex-1 cursor-pointer select-none", children: value }) ] }, value)) }) }) ] }); } return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(BaseInput_js_default(), { type: "datetime" === uiBlock.contentType ? "datetime-local" : uiBlock.contentType, className: "bg-nextadmin-background-default dark:bg-dark-nextadmin-background-default flex w-auto max-w-[100px] md:max-w-[160px]", onChange: onChange, value: uiBlock.value ?? "" }); }; const AdvancedSearchInput = AdvancedSearchInput_AdvancedSearchInput; 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 });