@umbraco-ui/uui-input
Version:
Custom element wrapping the native input element. This is a formAssociated element, meaning it can participate in a native HTMLForm. In browsers other then Chrome it may require a polyfill.
173 lines (172 loc) • 6.4 kB
TypeScript
import { LitElement } from 'lit';
export type InputType = 'text' | 'tel' | 'url' | 'email' | 'password' | 'search' | 'month' | 'week' | 'time' | 'date' | 'datetime-local' | 'number' | 'color';
declare const UUIInputElement_base: (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").UUIFormControlMixinElement<FormDataEntryValue | FormData>) & (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").LabelMixinInterface) & typeof LitElement;
/**
* Custom element wrapping the native input element.This is a formAssociated element, meaning it can participate in a native HTMLForm. A name:value pair will be submitted.
* @element uui-input
* @slot prepend - for components to render to the left of the input.
* @slot append - for components to render to the right of the input.
* @property {boolean} spellcheck - get/set native spellcheck attribute
* @attribute spellcheck - native spellcheck attribute
* @property {string} value - get/set the value of the input
* @attribute value - get/set the value of the input
* @property {string} name - get/set the name of the input
* @attribute name - get/set the name of the input
* @fires UUIInputEvent#change on change
* @fires InputEvent#input on input
* @fires KeyboardEvent#keyup on keyup
* @cssprop --uui-input-height - Height of the element
* @cssprop --uui-input-background-color - Background color of the element
* @cssprop --uui-input-background-color-disabled - Background color when disabled
* @cssprop --uui-input-background-color-readonly - Background color when readonly
* @cssprop --uui-input-border-width - Border width
* @cssprop --uui-input-border-color - Border color
* @cssprop --uui-input-border-color-hover - Border color on hover
* @cssprop --uui-input-border-color-focus - Border color on focus
* @cssprop --uui-input-border-color-disabled - Border color when disabled
* @cssprop --uui-input-border-color-readonly - Border color when readonly
*/
export declare class UUIInputElement extends UUIInputElement_base {
#private;
/**
* This is a static class field indicating that the element is can be used inside a native form and participate in its events. It may require a polyfill, check support here https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals. Read more about form controls here https://web.dev/more-capable-form-controls/
* @type {boolean}
*/
static readonly formAssociated = true;
/**
* Sets the min value of the input.
* Examples: the first date the user may pick in date and datetime-local, or the min numeric value the user can pick in a number input.
* @type {number | string}
* @attr
* @default undefined
*/
min?: number | string;
/**
* Sets the minimum length of the value of the input.
* @type {number}
* @attr
* @default undefined
*/
minlength?: number;
/**
* Minlength validation message.
* @attr minlength-message
* @default
*/
minlengthMessage: string;
/**
* Sets the max value of the input.
* Examples: the last date the user may pick in date and datetime-local, or the max numeric value the user can pick in a number input.
* @type {number | string}
* @attr
* @default undefined
*/
max?: number | string;
/**
* Sets the maximum length of the value of the input.
* @type {number}
* @attr
* @default undefined
*/
maxlength?: number;
/**
* Maxlength validation message.
* @attr maxlength-message
* @default
*/
maxlengthMessage: string;
/**
* Specifies the interval between legal numbers of the input
* @type {number}
* @attr
* @default undefined
*/
step?: number;
/**
* Disables the input.
* @type {boolean}
* @attr
* @default false
*/
disabled: boolean;
/**
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
* @type {boolean}
* @attr
* @default false
*/
readonly: boolean;
/**
* Defines the input placeholder.
* @type {string}
* @attr
* @default ''
*/
placeholder: string;
/**
* Defines the input autocomplete.
* @type {string}
* @attr
* @default undefined
*/
autocomplete?: string;
/**
* Sets the input width to fit the value or placeholder if empty
* @type {boolean}
* @attr auto-width
*/
autoWidth: boolean;
/**
* This property specifies the type of input that will be rendered.
* @type {'text' | 'tel'| 'url'| 'email'| 'password'| 'date'| 'month'| 'week'| 'time'| 'datetime-local'| 'number'| 'color'}
* @attr
* @default text
*/
get type(): InputType;
set type(value: InputType);
/**
* Validates the input based on the Regex pattern
* @type {string}
* @attr
*/
pattern?: string;
/**
* The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode|MDN} for further information
* @type {string}
* @attr
*/
inputMode: string;
_input: HTMLInputElement;
private _type;
constructor();
/**
* Removes focus from the input.
*/
blur(): Promise<void>;
/**
* This method enables <label for="..."> to focus the input
*/
focus(): Promise<void>;
/**
* Selects all the text in the input.
*/
select(): Promise<void>;
protected getFormElement(): HTMLElement;
protected onInput(e: Event): void;
protected onChange(e: Event): void;
protected renderPrepend(): import("lit-html").TemplateResult<1>;
protected renderAppend(): import("lit-html").TemplateResult<1>;
render(): import("lit-html").TemplateResult<1>;
private renderInputWithAutoWidth;
renderInput(): import("lit-html").TemplateResult<1>;
private renderAutoWidthBackground;
private renderText;
static styles: import("lit").CSSResult[];
}
declare global {
interface HTMLElementTagNameMap {
'uui-input': UUIInputElement;
}
}
export {};