forked from PolymerElements/paper-input
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaper-input-behavior.d.ts
More file actions
320 lines (276 loc) · 10.9 KB
/
paper-input-behavior.d.ts
File metadata and controls
320 lines (276 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* paper-input-behavior.html
*/
/// <reference path="../polymer/types/polymer.d.ts" />
/// <reference path="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.d.ts" />
/// <reference path="../iron-behaviors/iron-control-state.d.ts" />
declare namespace Polymer {
/**
* Use `Polymer.PaperInputBehavior` to implement inputs with
* `<paper-input-container>`. This behavior is implemented by `<paper-input>`.
* It exposes a number of properties from
* `<paper-input-container>` and `<input is="iron-input">` and they should be
* bound in your template.
*
* The input element can be accessed by the `inputElement` property if you need
* to access properties or methods that are not exposed.
*/
interface PaperInputBehavior extends Polymer.IronControlState, Polymer.IronA11yKeysBehavior {
/**
* Set to true to disable this input. If you're using PaperInputBehavior to
* implement your own paper-input-like element, bind this to
* both the `<paper-input-container>`'s and the input's `disabled` property.
*/
disabled: boolean|null|undefined;
keyBindings: object;
/**
* The label for this input. If you're using PaperInputBehavior to
* implement your own paper-input-like element, bind this to
* `<label>`'s content and `hidden` property, e.g.
* `<label hidden$="[[!label]]">[[label]]</label>` in your `template`
*/
label: string|null|undefined;
/**
* The value for this input. If you're using PaperInputBehavior to
* implement your own paper-input-like element, bind this to
* the `<iron-input>`'s `bindValue`
* property, or the value property of your input that is `notify:true`.
*/
value: any;
/**
* Returns true if the value is invalid. If you're using PaperInputBehavior
* to implement your own paper-input-like element, bind this to both the
* `<paper-input-container>`'s and the input's `invalid` property.
*
* If `autoValidate` is true, the `invalid` attribute is managed
* automatically, which can clobber attempts to manage it manually.
*/
invalid: boolean|null|undefined;
/**
* Set this to specify the pattern allowed by `preventInvalidInput`. If
* you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `allowedPattern`
* property.
*/
allowedPattern: string|null|undefined;
/**
* The type of the input. The supported types are the
* [native input's
* types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_<input>_types).
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the (Polymer 1) `<input is="iron-input">`'s or
* (Polymer 2)
* `<iron-input>`'s `type` property.
*/
type: string|null|undefined;
/**
* The datalist of the input (if any). This should match the id of an
* existing `<datalist>`. If you're using PaperInputBehavior to implement
* your own paper-input-like element, bind this to the `<input
* is="iron-input">`'s `list` property.
*/
list: string|null|undefined;
/**
* A pattern to validate the `input` with. If you're using
* PaperInputBehavior to implement your own paper-input-like element, bind
* this to the `<input is="iron-input">`'s `pattern` property.
*/
pattern: string|null|undefined;
/**
* Set to true to mark the input as required. If you're using
* PaperInputBehavior to implement your own paper-input-like element, bind
* this to the `<input is="iron-input">`'s `required` property.
*/
required: boolean|null|undefined;
/**
* The error message to display when the input is invalid. If you're using
* PaperInputBehavior to implement your own paper-input-like element,
* bind this to the `<paper-input-error>`'s content, if using.
*/
errorMessage: string|null|undefined;
/**
* Set to true to show a character counter.
*/
charCounter: boolean|null|undefined;
/**
* Set to true to disable the floating label. If you're using
* PaperInputBehavior to implement your own paper-input-like element, bind
* this to the `<paper-input-container>`'s `noLabelFloat` property.
*/
noLabelFloat: boolean|null|undefined;
/**
* Set to true to always float the label. If you're using PaperInputBehavior
* to implement your own paper-input-like element, bind this to the
* `<paper-input-container>`'s `alwaysFloatLabel` property.
*/
alwaysFloatLabel: boolean|null|undefined;
/**
* Set to true to auto-validate the input value. If you're using
* PaperInputBehavior to implement your own paper-input-like element, bind
* this to the `<paper-input-container>`'s `autoValidate` property.
*/
autoValidate: boolean|null|undefined;
/**
* Name of the validator to use. If you're using PaperInputBehavior to
* implement your own paper-input-like element, bind this to
* the `<input is="iron-input">`'s `validator` property.
*/
validator: string|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `autocomplete`
* property.
*/
autocomplete: string|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `autofocus`
* property.
*/
autofocus: boolean|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `inputmode`
* property.
*/
inputmode: string|null|undefined;
/**
* The minimum length of the input value.
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `minlength`
* property.
*/
minlength: number|null|undefined;
/**
* The maximum length of the input value.
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `maxlength`
* property.
*/
maxlength: number|null|undefined;
/**
* The minimum (numeric or date-time) input value.
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `min` property.
*/
min: string|null|undefined;
/**
* The maximum (numeric or date-time) input value.
* Can be a String (e.g. `"2000-01-01"`) or a Number (e.g. `2`).
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `max` property.
*/
max: string|null|undefined;
/**
* Limits the numeric or date-time increments.
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `step` property.
*/
step: string|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `name` property.
*/
name: string|null|undefined;
/**
* A placeholder string in addition to the label. If this is set, the label
* will always float.
*/
placeholder: string|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `readonly`
* property.
*/
readonly: boolean|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `size` property.
*/
size: number|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `autocapitalize`
* property.
*/
autocapitalize: string|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `autocorrect`
* property.
*/
autocorrect: string|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `autosave`
* property, used with type=search.
*/
autosave: string|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `results` property,
* used with type=search.
*/
results: number|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the `<input is="iron-input">`'s `accept` property,
* used with type=file.
*/
accept: string|null|undefined;
/**
* If you're using PaperInputBehavior to implement your own paper-input-like
* element, bind this to the`<input is="iron-input">`'s `multiple` property,
* used with type=file.
*/
multiple: boolean|null|undefined;
/**
* Returns a reference to the input element.
*/
readonly inputElement: HTMLElement;
/**
* Returns a reference to the focusable element.
*/
readonly _focusableElement: HTMLElement;
/**
* Forward focus to inputElement. Overriden from IronControlState.
*/
_focusBlurHandler(event: any): void;
attached(): void;
created(): void;
_appendStringWithSpace(str: any, more: any): any;
_onAddonAttached(event: any): void;
/**
* Validates the input element and sets an error style if needed.
*/
validate(): boolean;
/**
* Handler that is called when a shift+tab keypress is detected by the menu.
*
* @param event A key combination event.
*/
_onShiftTabDown(event: CustomEvent|null): void;
/**
* If `autoValidate` is true, then validates the element.
*/
_handleAutoValidate(): void;
/**
* Restores the cursor to its original position after updating the value.
*
* @param newValue The value that should be saved.
*/
updateValueAndPreserveCaret(newValue: string): void;
_computeAlwaysFloatLabel(alwaysFloatLabel: any, placeholder: any): any;
_updateAriaLabelledBy(): void;
_generateInputId(): void;
_onChange(event: any): void;
_autofocusChanged(): void;
}
const PaperInputBehavior: object;
}