@loadsmart/miranda-wc
Version:
Miranda Web Components component library
195 lines (194 loc) • 7.5 kB
TypeScript
import type { PropertyValues } from 'lit';
import { FormComponent } from '../component';
import type { FormComponentProps } from '../component';
export interface TextAreaProps extends FormComponentProps {
autosize?: boolean;
autocomplete?: 'off' | 'on';
cols?: number;
initialValue?: string;
dirname?: string;
maxLength?: number;
minLength?: number;
placeholder?: string;
resize?: 'none' | 'both' | 'horizontal' | 'vertical' | 'block' | 'inline';
readOnly?: boolean;
rows?: number;
spellCheck?: boolean | 'default';
value?: string;
wrap?: 'hard' | 'soft';
textarea: HTMLTextAreaElement | null;
onchange?: GlobalEventHandlers['onchange'];
oninput?: GlobalEventHandlers['oninput'];
}
export declare class TextArea extends FormComponent implements TextAreaProps {
#private;
static styles: import("lit").CSSResult[];
static get properties(): {
autocomplete: {
type: BooleanConstructor;
};
autofocus: {
type: BooleanConstructor;
};
autosize: {
type: BooleanConstructor;
};
cols: {
type: NumberConstructor;
};
initialValue: {
type: StringConstructor;
attribute: string;
reflect: boolean;
};
dirname: {
type: StringConstructor;
};
maxLength: {
type: NumberConstructor;
reflect: boolean;
attribute: string;
};
minLength: {
type: NumberConstructor;
reflect: boolean;
attribute: string;
};
placeholder: {
type: StringConstructor;
};
readOnly: {
type: BooleanConstructor;
reflect: boolean;
attribute: string;
};
resize: {
type: StringConstructor;
reflect: boolean;
};
rows: {
type: NumberConstructor;
};
spellcheck: {
type: BooleanConstructor;
reflect: boolean;
attribute: string;
};
value: {
type: StringConstructor;
reflect: boolean;
};
wrap: {
type: StringConstructor;
};
};
/**
* This attribute indicates whether the textarea height should automatically adjust to its content.
*/
autosize: TextAreaProps['autosize'];
/**
* This attribute indicates whether the value of the control can be automatically
* completed by the browser. Possible values are:
* - `off`: The user must explicitly enter a value into this field for every use,
* or the document provides its own auto-completion method; the browser does
* not automatically complete the entry.
* - `on`: The browser can automatically complete the value based on values that
* the user has entered during previous uses.
*
* If the `autocomplete` attribute is not specified on a `<textarea>` element, then the
* browser uses the `autocomplete` attribute value of the `<textarea>` element's
* form owner. The form owner is either the [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
* element that this `<textarea>` element is a descendant of or the form element
* whose `id` is specified by the `form` attribute of the input element. For more
* information, see the [`autocomplete`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#autocomplete)
* attribute in [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form).
*/
autocomplete: TextAreaProps['autocomplete'];
/**
* The visible width of the text control, in average character widths. If it is
* specified, it must be a positive integer. If it is not specified, the default
* value is `40`.
*/
cols: TextAreaProps['cols'];
/**
* This attribute is used to indicate the text directionality of the element contents
* similar to the [`dirname`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#dirname)
* attribute of the `<input>` element. For more information, see the
* [`dirname` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/dirname).
*/
dirname: TextAreaProps['dirname'];
/**
* The maximum string length (measured in UTF-16 code units) that the user can enter. If this value
* isn't specified, the user can enter an unlimited number of characters.
*/
maxLength: TextAreaProps['maxLength'];
/**
* The minimum string length (measured in UTF-16 code units) required that the user should enter.
*/
minLength: TextAreaProps['minLength'];
/**
* A hint to the user of what can be entered in the control. Carriage returns or line-feeds within the
* placeholder text must be treated as line breaks when rendering the hint.
*/
placeholder: TextAreaProps['placeholder'];
/**
* This Boolean attribute indicates that the user cannot modify the value of the control. Unlike the
* `disabled` attribute, the `readonly` attribute does not prevent the user from clicking or selecting
* in the control. The value of a read-only control is still submitted with the form.
*/
readOnly: TextAreaProps['readOnly'];
/**
* Determines whether an element is resizable, and if so, in which directions.
*
* https://developer.mozilla.org/en-US/docs/Web/CSS/resize
*/
resize: TextAreaProps['resize'];
/**
* The number of visible text lines for the control. If it is specified, it must be a positive
* integer. If it is not specified, the default value is 6
*/
rows: TextAreaProps['rows'];
/**
* Text area default value.
*/
initialValue?: TextAreaProps['initialValue'];
/**
* Indicates how the control should wrap the value for form submission. Possible values are:
* - `hard`: The browser automatically inserts line breaks (CR+LF) so that each line is no longer than
* the width of the control; the [`cols`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#cols)
* attribute must be specified for this to take effect
* - `soft`: The browser ensures that all line breaks in the entered value are a `CR+LF` pair, but no additional
* line breaks are added to the value.
*
* If this attribute is not specified, soft is its default value.
*/
wrap: TextAreaProps['wrap'];
/**
* We use this private variable to store the pending value
* when the internal textarea hasn't been rendered yet.
*/
private pendingValue;
static define(): void;
constructor();
createRenderRoot(): DocumentFragment | HTMLElement;
connectedCallback(): Promise<void>;
disconnectedCallback(): void;
update(changedProperties: PropertyValues<this>): void;
protected updated(changedProperties: PropertyValues<this>): void;
render(): import("lit-html").TemplateResult<1>;
get textarea(): HTMLTextAreaElement | null;
/**
* Textarea value.
*/
set value(value: string);
get value(): string;
focus(): void;
formResetCallback(): void;
formStateRestoreCallback(state: string): void;
formDisabledCallback(disabled: boolean): void;
}
declare global {
interface HTMLElementTagNameMap {
'm-text-area': TextArea;
}
}