| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * `cr-input` is a single-line text field for user input. It is a convenience | |
| 8 * element wrapping `paper-input`. | |
| 9 * | |
| 10 * Example: | |
| 11 * | |
| 12 * <cr-input></cr-input> | |
| 13 * | |
| 14 * @group Chrome Elements | |
| 15 * @element cr-input | |
| 16 */ | |
| 17 Polymer({ | |
| 18 is: 'cr-input', | |
| 19 | |
| 20 properties: { | |
| 21 /** | |
| 22 * The label for this input. It normally appears as grey text inside | |
| 23 * the text input and disappears once the user enters text. | |
| 24 */ | |
| 25 label: { | |
| 26 type: String, | |
| 27 value: '' | |
| 28 }, | |
| 29 | |
| 30 /** | |
| 31 * Propagate the no-label-float property. | |
| 32 */ | |
| 33 noLabelFloat: { | |
| 34 type: Boolean, | |
| 35 value: false | |
| 36 }, | |
| 37 | |
| 38 /** | |
| 39 * Set to true to mark the input as required. | |
| 40 */ | |
| 41 required: { | |
| 42 type: Boolean, | |
| 43 value: false | |
| 44 }, | |
| 45 | |
| 46 /** | |
| 47 * Set to true to disable editing the input. | |
| 48 */ | |
| 49 disabled: { | |
| 50 type: Boolean, | |
| 51 value: false, | |
| 52 reflectToAttribute: true | |
| 53 }, | |
| 54 | |
| 55 /** | |
| 56 * The current value of the input. | |
| 57 */ | |
| 58 value: { | |
| 59 type: String, | |
| 60 value: '', | |
| 61 notify: true, | |
| 62 }, | |
| 63 | |
| 64 /** | |
| 65 * The validation pattern for the input. | |
| 66 */ | |
| 67 pattern: String, | |
| 68 | |
| 69 /** | |
| 70 * The type of the input (password, date, etc.). | |
| 71 */ | |
| 72 type: String, | |
| 73 | |
| 74 /** | |
| 75 * The message to display if the input value fails validation. If this | |
| 76 * is unset or the empty string, a default message is displayed depending | |
| 77 * on the type of validation error. | |
| 78 */ | |
| 79 errorMessage: { | |
| 80 type: String, | |
| 81 value: '', | |
| 82 }, | |
| 83 }, | |
| 84 | |
| 85 /** | |
| 86 * Focuses the 'input' element. | |
| 87 */ | |
| 88 focus: function() { | |
| 89 this.$.input.inputElement.focus(); | |
| 90 }, | |
| 91 | |
| 92 /** @override */ | |
| 93 ready: function() { | |
| 94 this.$.events.forward(this.$.input, ['change']); | |
| 95 }, | |
| 96 }); | |
| OLD | NEW |