UNPKG

11.6 kBTypeScriptView Raw
1// Generated by dts-bundle v0.7.3
2// Dependencies for this module:
3// ../../@material/base/types
4// ../../@material/base/component
5// ../../@material/base/foundation
6
7declare module '@material/floating-label' {
8 /**
9 * @license
10 * Copyright 2019 Google Inc.
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a copy
13 * of this software and associated documentation files (the "Software"), to deal
14 * in the Software without restriction, including without limitation the rights
15 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 * copies of the Software, and to permit persons to whom the Software is
17 * furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be included in
20 * all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 * THE SOFTWARE.
29 */
30 export * from '@material/floating-label/adapter';
31 export * from '@material/floating-label/component';
32 export * from '@material/floating-label/constants';
33 export * from '@material/floating-label/foundation';
34}
35
36declare module '@material/floating-label/adapter' {
37 /**
38 * @license
39 * Copyright 2017 Google Inc.
40 *
41 * Permission is hereby granted, free of charge, to any person obtaining a copy
42 * of this software and associated documentation files (the "Software"), to deal
43 * in the Software without restriction, including without limitation the rights
44 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45 * copies of the Software, and to permit persons to whom the Software is
46 * furnished to do so, subject to the following conditions:
47 *
48 * The above copyright notice and this permission notice shall be included in
49 * all copies or substantial portions of the Software.
50 *
51 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
57 * THE SOFTWARE.
58 */
59 import { EventType, SpecificEventListener } from '@material/base/types';
60 /**
61 * Defines the shape of the adapter expected by the foundation.
62 * Implement this adapter for your framework of choice to delegate updates to
63 * the component in your framework of choice. See architecture documentation
64 * for more details.
65 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
66 */
67 export interface MDCFloatingLabelAdapter {
68 /**
69 * Adds a class to the label element.
70 */
71 addClass(className: string): void;
72 /**
73 * Removes a class from the label element.
74 */
75 removeClass(className: string): void;
76 /**
77 * Returns the width of the label element.
78 */
79 getWidth(): number;
80 /**
81 * Registers an event listener on the root element for a given event.
82 */
83 registerInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void;
84 /**
85 * Deregisters an event listener on the root element for a given event.
86 */
87 deregisterInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void;
88 }
89}
90
91declare module '@material/floating-label/component' {
92 /**
93 * @license
94 * Copyright 2016 Google Inc.
95 *
96 * Permission is hereby granted, free of charge, to any person obtaining a copy
97 * of this software and associated documentation files (the "Software"), to deal
98 * in the Software without restriction, including without limitation the rights
99 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
100 * copies of the Software, and to permit persons to whom the Software is
101 * furnished to do so, subject to the following conditions:
102 *
103 * The above copyright notice and this permission notice shall be included in
104 * all copies or substantial portions of the Software.
105 *
106 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
107 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
108 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
109 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
110 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
111 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
112 * THE SOFTWARE.
113 */
114 import { MDCComponent } from '@material/base/component';
115 import { MDCFloatingLabelFoundation } from '@material/floating-label/foundation';
116 export type MDCFloatingLabelFactory = (el: Element, foundation?: MDCFloatingLabelFoundation) => MDCFloatingLabel;
117 export class MDCFloatingLabel extends MDCComponent<MDCFloatingLabelFoundation> {
118 static attachTo(root: Element): MDCFloatingLabel;
119 /**
120 * Styles the label to produce the label shake for errors.
121 * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
122 */
123 shake(shouldShake: boolean): void;
124 /**
125 * Styles the label to float/dock.
126 * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
127 */
128 float(shouldFloat: boolean): void;
129 /**
130 * Styles the label as required.
131 * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
132 */
133 setRequired(isRequired: boolean): void;
134 getWidth(): number;
135 getDefaultFoundation(): MDCFloatingLabelFoundation;
136 }
137}
138
139declare module '@material/floating-label/constants' {
140 /**
141 * @license
142 * Copyright 2016 Google Inc.
143 *
144 * Permission is hereby granted, free of charge, to any person obtaining a copy
145 * of this software and associated documentation files (the "Software"), to deal
146 * in the Software without restriction, including without limitation the rights
147 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
148 * copies of the Software, and to permit persons to whom the Software is
149 * furnished to do so, subject to the following conditions:
150 *
151 * The above copyright notice and this permission notice shall be included in
152 * all copies or substantial portions of the Software.
153 *
154 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
155 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
156 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
157 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
158 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
159 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
160 * THE SOFTWARE.
161 */
162 export const cssClasses: {
163 LABEL_FLOAT_ABOVE: string;
164 LABEL_REQUIRED: string;
165 LABEL_SHAKE: string;
166 ROOT: string;
167 };
168}
169
170declare module '@material/floating-label/foundation' {
171 /**
172 * @license
173 * Copyright 2016 Google Inc.
174 *
175 * Permission is hereby granted, free of charge, to any person obtaining a copy
176 * of this software and associated documentation files (the "Software"), to deal
177 * in the Software without restriction, including without limitation the rights
178 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
179 * copies of the Software, and to permit persons to whom the Software is
180 * furnished to do so, subject to the following conditions:
181 *
182 * The above copyright notice and this permission notice shall be included in
183 * all copies or substantial portions of the Software.
184 *
185 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
186 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
187 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
188 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
189 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
190 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
191 * THE SOFTWARE.
192 */
193 import { MDCFoundation } from '@material/base/foundation';
194 import { MDCFloatingLabelAdapter } from '@material/floating-label/adapter';
195 export class MDCFloatingLabelFoundation extends MDCFoundation<MDCFloatingLabelAdapter> {
196 static get cssClasses(): {
197 LABEL_FLOAT_ABOVE: string;
198 LABEL_REQUIRED: string;
199 LABEL_SHAKE: string;
200 ROOT: string;
201 };
202 /**
203 * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
204 */
205 static get defaultAdapter(): MDCFloatingLabelAdapter;
206 constructor(adapter?: Partial<MDCFloatingLabelAdapter>);
207 init(): void;
208 destroy(): void;
209 /**
210 * Returns the width of the label element.
211 */
212 getWidth(): number;
213 /**
214 * Styles the label to produce a shake animation to indicate an error.
215 * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
216 */
217 shake(shouldShake: boolean): void;
218 /**
219 * Styles the label to float or dock.
220 * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
221 */
222 float(shouldFloat: boolean): void;
223 /**
224 * Styles the label as required.
225 * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
226 */
227 setRequired(isRequired: boolean): void;
228 }
229 export default MDCFloatingLabelFoundation;
230}
231