UNPKG

@undermuz/react-json-form

Version:
51 lines (50 loc) 885 B
// src/inputs/inputWIdget.tsx import { useCallback } from "react"; import JsonForm from "../JsonForm.mjs"; import { jsx } from "react/jsx-runtime"; var DEF_SETTINGS = { scheme: [], multiple: false }; var InputWidget = (props) => { const { name = "unknown", value, title = "", settings = DEF_SETTINGS, children, onRef, onChange, onError } = props; const _onError = useCallback( (e) => { onError?.([e]); }, [onError] ); const ref = useCallback( (ref2) => { onRef?.({ id: name, ref: ref2 }); }, [onRef] ); return /* @__PURE__ */ jsx( JsonForm, { id: name, value, title, primary: false, ...settings, ref, onChange, onError: _onError, children } ); }; var inputWIdget_default = InputWidget; export { inputWIdget_default as default };