"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useFormContext = exports.FormProvider = exports.FormContext = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const useFormFields_1 = require("./useFormFields.js");
exports.FormContext = React.createContext(null);
const FormProvider = ({ children, formFields, onChange }) => {
    const value = (0, useFormFields_1.useFormFields)({ initialFields: formFields, onChange });
    return (0, jsx_runtime_1.jsx)(exports.FormContext.Provider, { value: value, children: children });
};
exports.FormProvider = FormProvider;
const useFormContext = () => {
    const context = React.useContext(exports.FormContext);
    if (!context) {
        throw new Error('useFormContext must be used within a FormProvider');
    }
    return context;
};
exports.useFormContext = useFormContext;
//# sourceMappingURL=FormContext.js.map
