UNPKG

@aokiapp/rjsf-mantine-theme

Version:

Mantine theme, fields and widgets for react-jsonschema-form

63 lines (60 loc) 1.39 kB
import { jsx } from 'react/jsx-runtime'; import { useEffect } from 'react'; import { getUiOptions, getWidget } from '@rjsf/utils'; function NullField(props) { const { schema, name, uiSchema, idSchema, formData, required, disabled = false, readonly = false, autofocus = false, onChange, onBlur, onFocus, registry, rawErrors, hideError } = props; const { title } = schema; const { widgets, formContext, schemaUtils, globalUiOptions } = registry; const { widget = "NullWidget", placeholder = "", title: uiTitle, ...options } = getUiOptions(uiSchema); const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions); const label = uiTitle ?? title ?? name; const Widget = getWidget(schema, widget, widgets); useEffect(() => { if (formData === void 0) { onChange(null); } }, [formData, onChange]); return /* @__PURE__ */ jsx( Widget, { options, schema, uiSchema, id: idSchema.$id, name, label, hideLabel: !displayLabel, hideError, value: formData, onChange, onBlur, onFocus, required, disabled, readonly, formContext, autofocus, registry, placeholder, rawErrors } ); } export { NullField as default }; //# sourceMappingURL=NullField.mjs.map