@aokiapp/rjsf-mantine-theme
Version:
Mantine theme, fields and widgets for react-jsonschema-form
55 lines (52 loc) • 1.4 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import { labelValue, ariaDescribedByIds } from '@rjsf/utils';
import { Textarea } from '@mantine/core';
import { createErrors } from '../utils/createErrors.mjs';
function TextareaWidget(props) {
const {
id,
placeholder,
value,
required,
disabled,
autofocus,
label,
hideLabel,
readonly,
onBlur,
onFocus,
onChange,
options,
rawErrors,
hideError,
schema
} = props;
const description = options.description || schema.description;
const _onChange = ({ target: { value: value2 } }) => onChange && onChange(value2 === "" ? options.emptyValue : value2);
const _onBlur = () => onBlur && onBlur(id, value);
const _onFocus = () => onFocus && onFocus(id, value);
return /* @__PURE__ */ jsx(
Textarea,
{
id,
name: id,
className: "armt-widget-textarea",
label: labelValue(label || void 0, hideLabel, false),
placeholder,
autoFocus: autofocus,
required,
disabled: disabled || readonly,
value: value || "",
error: createErrors(rawErrors, hideError),
rows: options.rows || 5,
onChange: _onChange,
onBlur: _onBlur,
onFocus: _onFocus,
"aria-describedby": ariaDescribedByIds(id),
description
},
id
);
}
export { TextareaWidget as default };
//# sourceMappingURL=TextareaWidget.mjs.map