UNPKG

@rjsf/core

Version:

A simple React component capable of building HTML forms out of a JSON schema.

20 lines (19 loc) 873 B
import { jsx as _jsx } from "react/jsx-runtime"; import { forwardRef } from 'react'; import Form from './components/Form.js'; /** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */ export default function withTheme(themeProps) { return forwardRef(({ fields, widgets, templates, ...directProps }, ref) => { fields = { ...themeProps?.fields, ...fields }; widgets = { ...themeProps?.widgets, ...widgets }; templates = { ...themeProps?.templates, ...templates, ButtonTemplates: { ...themeProps?.templates?.ButtonTemplates, ...templates?.ButtonTemplates, }, }; return (_jsx(Form, { ...themeProps, ...directProps, fields: fields, widgets: widgets, templates: templates, ref: ref })); }); }