@aokiapp/rjsf-mantine-theme
Version:
Mantine theme, fields and widgets for react-jsonschema-form
67 lines (62 loc) • 1.47 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
var react = require('react');
var utils = require('@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 } = utils.getUiOptions(uiSchema);
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
const label = uiTitle ?? title ?? name;
const Widget = utils.getWidget(schema, widget, widgets);
react.useEffect(() => {
if (formData === void 0) {
onChange(null);
}
}, [formData, onChange]);
return /* @__PURE__ */ jsxRuntime.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
}
);
}
exports.default = NullField;
//# sourceMappingURL=NullField.cjs.map