import { JSXInterface } from '../jsx'; import { CSSResultGroup, FormFieldElement, PropertyValues, TemplateResult } from '@refinitiv-ui/core'; import { TemplateMap } from '@refinitiv-ui/core/directives/template-map.js'; import '../icon/index.js'; /** * Form control element for text. * * @fires value-changed - Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically. * @fires error-changed - Fired when the user inputs an invalid value. The event is not triggered if `error` property is changed programmatically. * @fires icon-click - Fired when the user taps on icon added into control's slot. * * @attr {boolean} disabled - Set disabled state * @prop {boolean} [disabled=false] - Set disabled state * * @attr {boolean} error - Set error state * @prop {boolean} [error=false] - Set error state * * @attr {string} placeholder - Set placeholder text * @prop {string} [placeholder=""] - Set placeholder text * * @attr {boolean} readonly - Set readonly state * @prop {boolean} [readonly=false] - Set readonly state * * @attr {boolean} transparent - Disables all other states and border/background styles. * @prop {boolean} [transparent=false] - Disables all other states and border/background styles. * * @attr {boolean} warning - Set warning state * @prop {boolean} [warning=false] - Set warning state * * @attr {string} value - Input's value * @prop {string} [value=""] - Input's value * * @attr {boolean} clears - Show clears button * @prop {boolean} [clears=false] - Show clears button */ export declare class TextField extends FormFieldElement { /** * Element version number * @returns version number */ static get version(): string; /** * A `CSSResultGroup` that will be used to style the host, * slotted children and the internal template of the element. * @returns CSS template */ static get styles(): CSSResultGroup; /** * Set regular expression for input validation */ pattern: string | null; /** * Specify icon to display in input. Value can be icon name */ icon: string | null; /** * Specify when icon need to be clickable */ iconHasAction: boolean; /** * Set character max limit */ maxLength: number | null; /** * Set character min limit */ minLength: number | null; /** * Called after the component is first rendered * @param changedProperties Properties which have changed * @returns {void} */ protected firstUpdated(changedProperties: PropertyValues): void; /** * Updates the element * @param changedProperties Properties that has changed * @returns {void} */ protected update(changedProperties: PropertyValues): void; /** * Called when the element’s DOM has been updated and rendered * @param changedProperties Properties that has changed * @returns shouldUpdate */ protected updated(changedProperties: PropertyValues): void; /** * Returns whether input of the element should be validated or not based on the existence of validation constraints * @returns true if there is at least one validation constraint */ protected shouldValidate(): boolean; /** * Returns `true` if the element input is valid; otherwise, returns `false`. * @returns element input validity */ checkValidity(): boolean; /** * Validate the element input and mark it as error if its input is invalid. * @returns `true` if the element input is valid; otherwise, returns `false`. */ reportValidity(): boolean; /** * Check if input value should be synchronised with component value * @param changedProperties Properties that has changed * @returns True if input should be synchronised */ protected shouldSyncInputValue(changedProperties: PropertyValues): boolean; /** * Synchronise input value with value. * Override the method if value and input value are not the same * @param changedProperties Properties that has changed * @returns {void} */ protected syncInputValue(): void; /** * Runs on input element `input` event * @param event `input` event * @returns {void} */ protected onInputInput(event: InputEvent): void; /** * Runs on input element `change` event * @param event `change` event * @returns {void} */ protected onInputChange(event: InputEvent): void; /** * Check if value is changed and fire event * @returns {void} */ protected onPossibleValueChange(event: InputEvent): void; /** * Fires event on `icon` click * @returns {void} */ protected iconClick(): void; /** * Decorate `` element with common properties extended from form field element: * type="text" - always `text` * part="input" - always "input", used for styling * maxlength - calculated from `this.maxLength` * minlength - calculated from `this.minLength` * pattern - calculated from `this.pattern` * @returns template map */ protected get decorateInputMap(): TemplateMap; /** * Renders icon element if property present * @returns {void} */ protected renderIcon(): TemplateResult | null; /** * A `TemplateResult` that will be used * to render the updated internal template. * @return Render template */ protected render(): TemplateResult; } declare global { interface HTMLElementTagNameMap { 'ef-text-field': TextField; } } declare global { interface HTMLElementTagNameMap { 'ef-text-field': TextField; } namespace JSX { interface IntrinsicElements { 'ef-text-field': Partial | JSXInterface.HTMLAttributes; } } } export {};