| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 <link rel="import" href="../polymer/polymer.html"> | 10 <link rel="import" href="../polymer/polymer.html"> |
| 11 <link rel="import" href="../iron-input/iron-input.html"> | 11 <link rel="import" href="../iron-input/iron-input.html"> |
| 12 <link rel="import" href="../iron-form-element-behavior/iron-form-element-behavio
r.html"> |
| 12 <link rel="import" href="paper-input-behavior.html"> | 13 <link rel="import" href="paper-input-behavior.html"> |
| 13 <link rel="import" href="paper-input-container.html"> | 14 <link rel="import" href="paper-input-container.html"> |
| 14 <link rel="import" href="paper-input-error.html"> | 15 <link rel="import" href="paper-input-error.html"> |
| 15 <link rel="import" href="paper-input-char-counter.html"> | 16 <link rel="import" href="paper-input-char-counter.html"> |
| 16 | 17 |
| 17 <!-- | 18 <!-- |
| 18 `<paper-input>` is a text field. | 19 `<paper-input>` is a single-line text field with Material Design styling. |
| 20 |
| 21 <paper-input label="Input label"></paper-input> |
| 22 |
| 23 It may include an optional error message or character counter. |
| 24 |
| 25 <paper-input error-message="Invalid input!" label="Input label"></paper-inpu
t> |
| 26 <paper-input char-counter label="Input label"></paper-input> |
| 27 |
| 28 See `Polymer.PaperInputBehavior` for more API docs. |
| 29 |
| 30 ### Styling |
| 31 |
| 32 See `Polymer.PaperInputContainer` for a list of custom properties used to |
| 33 style this element. |
| 34 |
| 35 @group Paper Elements |
| 36 @element paper-input |
| 37 @hero hero.svg |
| 38 @demo demo/index.html |
| 19 --> | 39 --> |
| 20 | 40 |
| 21 <dom-module id="paper-input"> | 41 <dom-module id="paper-input"> |
| 22 | 42 |
| 43 <style> |
| 44 |
| 45 :host { |
| 46 display: block; |
| 47 } |
| 48 |
| 49 input::-webkit-input-placeholder { |
| 50 color: var(--paper-input-container-color, --secondary-text-color); |
| 51 } |
| 52 |
| 53 input:-moz-placeholder { |
| 54 color: var(--paper-input-container-color, --secondary-text-color); |
| 55 } |
| 56 |
| 57 input::-moz-placeholder { |
| 58 color: var(--paper-input-container-color, --secondary-text-color); |
| 59 } |
| 60 |
| 61 input:-ms-input-placeholder { |
| 62 color: var(--paper-input-container-color, --secondary-text-color); |
| 63 } |
| 64 |
| 65 </style> |
| 66 |
| 23 <template> | 67 <template> |
| 24 | 68 |
| 25 <paper-input-container no-label-float$="[[noLabelFloat]]" auto-validate$="[[
autoValidate]]" disabled$="[[disabled]]"> | 69 <paper-input-container no-label-float="[[noLabelFloat]]" always-float-label=
"[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[a
utoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]"> |
| 26 | 70 |
| 27 <template is="x-if" if="[[label]]"> | 71 <label hidden$="[[!label]]">[[label]]</label> |
| 28 <label>[[parent.label]]</label> | 72 |
| 73 <input is="iron-input" id="input" |
| 74 aria-labelledby$="[[_ariaLabelledBy]]" |
| 75 aria-describedby$="[[_ariaDescribedBy]]" |
| 76 disabled$="[[disabled]]" |
| 77 bind-value="{{value}}" |
| 78 invalid="{{invalid}}" |
| 79 prevent-invalid-input="[[preventInvalidInput]]" |
| 80 allowedPattern="[[allowedPattern]]" |
| 81 validator="[[validator]]" |
| 82 type$="[[type]]" |
| 83 pattern$="[[pattern]]" |
| 84 maxlength$="[[maxlength]]" |
| 85 required$="[[required]]" |
| 86 autocomplete$="[[autocomplete]]" |
| 87 autofocus$="[[autofocus]]" |
| 88 inputmode$="[[inputmode]]" |
| 89 minlength$="[[minlength]]" |
| 90 name$="[[name]]" |
| 91 placeholder$="[[placeholder]]" |
| 92 readonly$="[[readonly]]" |
| 93 size$="[[size]]"> |
| 94 |
| 95 <template is="dom-if" if="[[errorMessage]]"> |
| 96 <paper-input-error>[[errorMessage]]</paper-input-error> |
| 29 </template> | 97 </template> |
| 30 | 98 |
| 31 <input is="iron-input" id="input" bind-value="{{value}}" prevent-invalid-i
nput="[[preventInvalidInput]]" type$="[[type]]" pattern$="[[pattern]]" maxlength
$="[[maxlength]]" required$="[[required]]" disabled$="[[disabled]]"> | 99 <template is="dom-if" if="[[charCounter]]"> |
| 32 | |
| 33 <template is="x-if" if="[[errorMessage]]"> | |
| 34 <paper-input-error>[[parent.errorMessage]]</paper-input-error> | |
| 35 </template> | |
| 36 | |
| 37 <template is="x-if" if="[[charCounter]]"> | |
| 38 <paper-input-char-counter></paper-input-char-counter> | 100 <paper-input-char-counter></paper-input-char-counter> |
| 39 </template> | 101 </template> |
| 40 | 102 |
| 41 </paper-input-container> | 103 </paper-input-container> |
| 42 | 104 |
| 43 </template> | 105 </template> |
| 44 | 106 |
| 45 </dom-module> | 107 </dom-module> |
| 46 | 108 |
| 47 <script> | 109 <script> |
| 48 | 110 |
| 49 (function() { | 111 (function() { |
| 50 | 112 |
| 51 Polymer({ | 113 Polymer({ |
| 52 | 114 |
| 53 is: 'paper-input', | 115 is: 'paper-input', |
| 54 | 116 |
| 55 behaviors: [ | 117 behaviors: [ |
| 56 Polymer.PaperInputBehavior | 118 Polymer.PaperInputBehavior, |
| 119 Polymer.IronFormElementBehavior |
| 57 ] | 120 ] |
| 58 | 121 |
| 59 }) | 122 }) |
| 60 | 123 |
| 61 })(); | 124 })(); |
| 62 | 125 |
| 63 </script> | 126 </script> |
| OLD | NEW |