@aokiapp/rjsf-mantine-theme
Version:
Mantine theme, fields and widgets for react-jsonschema-form
17 lines • 1.37 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { ariaDescribedByIds, labelValue, } from '@rjsf/utils';
import { Textarea } from '@mantine/core';
import { createErrors } from '../utils/createErrors';
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
*
* @param props - The `WidgetProps` for this component
*/
export default 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 } }) => onChange && onChange(value === '' ? options.emptyValue : value);
const _onBlur = () => onBlur && onBlur(id, value);
const _onFocus = () => onFocus && onFocus(id, value);
return (_jsx(Textarea, { id: id, name: id, className: 'armt-widget-textarea', label: labelValue(label || undefined, hideLabel, false), placeholder: placeholder, autoFocus: autofocus, required: 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: description }, id));
}
//# sourceMappingURL=TextareaWidget.js.map