Chromium Code Reviews| 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 composed of a`paper-input-decorator` and a `input is="core-input". | |
|
michaelpg
2015/02/13 00:08:29
missing space: a `paper-input-decorator`
missing c
Jeremy Klein
2015/02/13 00:22:55
Done.
| |
| 9 * | |
| 10 * Example: | |
| 11 * | |
| 12 * <cr-input></cr-input> | |
| 13 * | |
| 14 * @group Chrome Elements | |
| 15 * @element cr-input | |
| 16 */ | |
| 17 Polymer('cr-input', { | |
| 18 publish: { | |
| 19 /** | |
| 20 * The label for this input. It normally appears as grey text inside | |
| 21 * the text input and disappears once the user enters text. | |
| 22 * | |
| 23 * @attribute label | |
| 24 * @type string | |
| 25 * @default '' | |
| 26 */ | |
| 27 label: '', | |
| 28 | |
| 29 /** | |
| 30 * If true, the label will "float" above the text input once the | |
| 31 * user enters text instead of disappearing. | |
| 32 * | |
| 33 * @attribute floatingLabel | |
| 34 * @type boolean | |
| 35 * @default true | |
| 36 */ | |
| 37 floatingLabel: true, | |
| 38 | |
| 39 /** | |
| 40 * Set to true to style the element as disabled. | |
| 41 * | |
| 42 * @attribute disabled | |
| 43 * @type boolean | |
| 44 * @default false | |
| 45 */ | |
| 46 disabled: {value: false, reflect: true}, | |
| 47 | |
| 48 /** | |
| 49 * Set to true to mark the input as required. | |
| 50 * | |
| 51 * @attribute required | |
| 52 * @type boolean | |
| 53 * @default false | |
| 54 */ | |
| 55 required: {value: false, reflect: true}, | |
| 56 | |
| 57 /** | |
| 58 * The current value of the input. | |
| 59 * | |
| 60 * @attribute value | |
| 61 * @type String | |
|
michaelpg
2015/02/13 00:08:29
lower case
Jeremy Klein
2015/02/13 00:22:55
I took this from the Polymer elements docs. Appare
| |
| 62 * @default '' | |
| 63 */ | |
| 64 value: '', | |
| 65 | |
| 66 /** | |
| 67 * The validation pattern for the input. | |
| 68 * | |
| 69 * @attribute pattern | |
| 70 * @type String | |
|
michaelpg
2015/02/13 00:08:29
lower case
Jeremy Klein
2015/02/13 00:22:55
Done.
| |
| 71 * @default '' | |
| 72 */ | |
| 73 pattern: '', | |
| 74 | |
| 75 /** | |
| 76 * The type of the input (password, date, etc.). | |
| 77 * | |
| 78 * @attribute type | |
| 79 * @type String | |
|
michaelpg
2015/02/13 00:08:29
lower case
Jeremy Klein
2015/02/13 00:22:55
Done.
| |
| 80 * @default 'text' | |
| 81 */ | |
| 82 type: 'text', | |
| 83 | |
| 84 /** | |
| 85 * The message to display if the input value fails validation. If this | |
| 86 * is unset or the empty string, a default message is displayed depending | |
| 87 * on the type of validation error. | |
| 88 * | |
| 89 * @attribute error | |
| 90 * @type string | |
| 91 */ | |
| 92 error: '', | |
| 93 | |
| 94 /** | |
| 95 * The most recently committed value of the input. | |
| 96 * | |
| 97 * @attribute committedValue | |
| 98 * @type String | |
|
michaelpg
2015/02/13 00:08:29
lower case
Jeremy Klein
2015/02/13 00:22:55
Done.
| |
| 99 * @default '' | |
| 100 */ | |
| 101 committedValue: '' | |
| 102 }, | |
| 103 | |
| 104 /** | |
| 105 * Focuses the `input`. | |
| 106 * | |
| 107 * @method focus | |
| 108 */ | |
| 109 focus: function() { | |
| 110 this.$.input.focus(); | |
| 111 }, | |
| 112 | |
| 113 valueChanged: function() { | |
| 114 this.$.decorator.updateLabelVisibility(this.value); | |
| 115 }, | |
| 116 | |
| 117 ready: function() { | |
| 118 this.$.events.forward(this.$.input, ['change']); | |
| 119 }, | |
| 120 }); | |
| OLD | NEW |