UNPKG

@appbuckets/react-ui-forms

Version:

An utilities package to manage and create Form using AppBuckets ReactUI

25 lines (22 loc) 804 B
import { __assign } from '../_virtual/_tslib.js'; import * as React from 'react'; import { useHookedFormContext } from '../context/HookedForm.context.js'; /* -------- * Component Definition * -------- */ var HookedFormContent = function (props) { var children = props.children; /** Get the Wrapper Component */ var Wrapper = useHookedFormContext().contentWrapper; /** No Wrapper, no Party */ if (!Wrapper) { return null; } /** Omit props on React.Fragment, they are not allowed */ var wrapperProps = Wrapper === React.Fragment ? undefined : { className: 'form-content' }; /** Return the Component */ return React.createElement(Wrapper, __assign({}, wrapperProps), children); }; HookedFormContent.displayName = 'HookedFormContent'; export { HookedFormContent as default };