zod-form-kit
Version:
UI-agnostic form generation library based on Zod schemas with extensible adapter pattern
16 lines (15 loc) • 651 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { createContext, useContext } from 'react';
import { usePluginSystem } from '../hooks/usePluginSystem';
const PluginSystemContext = createContext(undefined);
export function PluginProvider({ children, config: _config }) {
const pluginSystem = usePluginSystem();
return (_jsx(PluginSystemContext.Provider, { value: pluginSystem, children: children }));
}
export function usePluginContext() {
const context = useContext(PluginSystemContext);
if (context === undefined) {
throw new Error('usePluginContext must be used within a PluginProvider');
}
return context;
}