mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-05-10 07:14:37 +02:00
42 lines
866 B
TypeScript
42 lines
866 B
TypeScript
import * as React from 'react';
|
|
import { Ref } from 'react';
|
|
import { HTMLFieldProps, connectField, filterDOMProps } from 'uniforms';
|
|
|
|
export type LongTextFieldProps = HTMLFieldProps<
|
|
string,
|
|
HTMLDivElement,
|
|
{ inputRef?: Ref<HTMLTextAreaElement> }
|
|
>;
|
|
|
|
function LongText({
|
|
disabled,
|
|
id,
|
|
inputRef,
|
|
label,
|
|
name,
|
|
onChange,
|
|
placeholder,
|
|
readOnly,
|
|
value,
|
|
...props
|
|
}: LongTextFieldProps) {
|
|
return (
|
|
<div {...filterDOMProps(props)}>
|
|
{label && <label htmlFor={id}>{label}</label>}
|
|
|
|
<textarea
|
|
disabled={disabled}
|
|
id={id}
|
|
name={name}
|
|
onChange={event => onChange(event.target.value)}
|
|
placeholder={placeholder}
|
|
readOnly={readOnly}
|
|
ref={inputRef}
|
|
value={value ?? ''}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default connectField<LongTextFieldProps>(LongText, { kind: 'leaf' });
|