@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
86 lines (85 loc) • 3.52 kB
JavaScript
"use client";
;
var __webpack_require__ = {};
(()=>{
__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__, {
ColorSchemeProvider: ()=>ColorSchemeProvider,
useColorScheme: ()=>useColorScheme
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const outline_namespaceObject = require("@heroicons/react/24/outline");
const external_next_themes_namespaceObject = require("next-themes");
const external_react_namespaceObject = require("react");
const external_types_js_namespaceObject = require("../types.js");
const basicColorSchemeIcons = {
light: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(outline_namespaceObject.SunIcon, {
className: "h-4 w-4"
}),
dark: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(outline_namespaceObject.MoonIcon, {
className: "h-4 w-4"
}),
system: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(outline_namespaceObject.ComputerDesktopIcon, {
className: "h-4 w-4"
})
};
const ColorSchemeContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)({
colorScheme: "system",
colorSchemeIcon: void 0,
setColorScheme: ()=>{},
toggleColorScheme: ()=>{}
});
const ColorSchemeProvider = ({ children })=>{
const { theme: colorScheme, setTheme: setColorScheme } = (0, external_next_themes_namespaceObject.useTheme)();
const [colorSchemeIcon, setColorSchemeIcon] = (0, external_react_namespaceObject.useState)(()=>basicColorSchemeIcons[colorScheme]);
(0, external_react_namespaceObject.useEffect)(()=>{
setColorSchemeIcon(basicColorSchemeIcons[colorScheme]);
}, [
colorScheme
]);
const toggleColorScheme = ()=>{
const index = external_types_js_namespaceObject.colorSchemes.indexOf(colorScheme);
const nextIndex = (index + 1) % external_types_js_namespaceObject.colorSchemes.length;
setColorScheme(external_types_js_namespaceObject.colorSchemes[nextIndex]);
};
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ColorSchemeContext.Provider, {
value: {
colorScheme: colorScheme,
colorSchemeIcon,
setColorScheme,
toggleColorScheme
},
children: children
});
};
const useColorScheme = ()=>(0, external_react_namespaceObject.useContext)(ColorSchemeContext);
exports.ColorSchemeProvider = __webpack_exports__.ColorSchemeProvider;
exports.useColorScheme = __webpack_exports__.useColorScheme;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
"ColorSchemeProvider",
"useColorScheme"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
value: true
});