UNPKG

5.89 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2016 Google Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23import { MDCComponent } from '@material/base/component';
24import { MDCFloatingLabelFactory } from '@material/floating-label/component';
25import { MDCLineRippleFactory } from '@material/line-ripple/component';
26import { MDCNotchedOutlineFactory } from '@material/notched-outline/component';
27import { MDCRipple, MDCRippleFactory } from '@material/ripple/component';
28import { MDCRippleCapableSurface } from '@material/ripple/types';
29import { MDCTextFieldCharacterCounterFactory } from './character-counter/component';
30import { MDCTextFieldFoundation } from './foundation';
31import { MDCTextFieldHelperTextFactory } from './helper-text/component';
32import { MDCTextFieldIconFactory } from './icon/component';
33export declare class MDCTextField extends MDCComponent<MDCTextFieldFoundation> implements MDCRippleCapableSurface {
34 static attachTo(root: Element): MDCTextField;
35 ripple: MDCRipple | null;
36 private input;
37 private characterCounter;
38 private helperText;
39 private label;
40 private leadingIcon;
41 private lineRipple;
42 private outline;
43 private trailingIcon;
44 private prefix;
45 private suffix;
46 initialize(rippleFactory?: MDCRippleFactory, lineRippleFactory?: MDCLineRippleFactory, helperTextFactory?: MDCTextFieldHelperTextFactory, characterCounterFactory?: MDCTextFieldCharacterCounterFactory, iconFactory?: MDCTextFieldIconFactory, labelFactory?: MDCFloatingLabelFactory, outlineFactory?: MDCNotchedOutlineFactory): void;
47 destroy(): void;
48 /**
49 * Initializes the Text Field's internal state based on the environment's
50 * state.
51 */
52 initialSyncWithDOM(): void;
53 get value(): string;
54 /**
55 * @param value The value to set on the input.
56 */
57 set value(value: string);
58 get disabled(): boolean;
59 /**
60 * @param disabled Sets the Text Field disabled or enabled.
61 */
62 set disabled(disabled: boolean);
63 get valid(): boolean;
64 /**
65 * @param valid Sets the Text Field valid or invalid.
66 */
67 set valid(valid: boolean);
68 get required(): boolean;
69 /**
70 * @param required Sets the Text Field to required.
71 */
72 set required(required: boolean);
73 get pattern(): string;
74 /**
75 * @param pattern Sets the input element's validation pattern.
76 */
77 set pattern(pattern: string);
78 get minLength(): number;
79 /**
80 * @param minLength Sets the input element's minLength.
81 */
82 set minLength(minLength: number);
83 get maxLength(): number;
84 /**
85 * @param maxLength Sets the input element's maxLength.
86 */
87 set maxLength(maxLength: number);
88 get min(): string;
89 /**
90 * @param min Sets the input element's min.
91 */
92 set min(min: string);
93 get max(): string;
94 /**
95 * @param max Sets the input element's max.
96 */
97 set max(max: string);
98 get step(): string;
99 /**
100 * @param step Sets the input element's step.
101 */
102 set step(step: string);
103 /**
104 * Sets the helper text element content.
105 */
106 set helperTextContent(content: string);
107 /**
108 * Sets the aria label of the leading icon.
109 */
110 set leadingIconAriaLabel(label: string);
111 /**
112 * Sets the text content of the leading icon.
113 */
114 set leadingIconContent(content: string);
115 /**
116 * Sets the aria label of the trailing icon.
117 */
118 set trailingIconAriaLabel(label: string);
119 /**
120 * Sets the text content of the trailing icon.
121 */
122 set trailingIconContent(content: string);
123 /**
124 * Enables or disables the use of native validation. Use this for custom validation.
125 * @param useNativeValidation Set this to false to ignore native input validation.
126 */
127 set useNativeValidation(useNativeValidation: boolean);
128 /**
129 * Gets the text content of the prefix, or null if it does not exist.
130 */
131 get prefixText(): string | null;
132 /**
133 * Sets the text content of the prefix, if it exists.
134 */
135 set prefixText(prefixText: string | null);
136 /**
137 * Gets the text content of the suffix, or null if it does not exist.
138 */
139 get suffixText(): string | null;
140 /**
141 * Sets the text content of the suffix, if it exists.
142 */
143 set suffixText(suffixText: string | null);
144 /**
145 * Focuses the input element.
146 */
147 focus(): void;
148 /**
149 * Recomputes the outline SVG path for the outline element.
150 */
151 layout(): void;
152 getDefaultFoundation(): MDCTextFieldFoundation;
153 private getRootAdapterMethods;
154 private getInputAdapterMethods;
155 private getLabelAdapterMethods;
156 private getLineRippleAdapterMethods;
157 private getOutlineAdapterMethods;
158 /**
159 * @return A map of all subcomponents to subfoundations.
160 */
161 private getFoundationMap;
162 private createRipple;
163}