OLD | NEW |
| (Empty) |
1 <!-- | |
2 @license | |
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 | |
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 | |
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 | |
9 --> | |
10 <link rel="import" href="../polymer/polymer.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"> | |
13 <link rel="import" href="paper-input-behavior.html"> | |
14 <link rel="import" href="paper-input-container.html"> | |
15 <link rel="import" href="paper-input-error.html"> | |
16 <link rel="import" href="paper-input-char-counter.html"> | |
17 | |
18 <!-- | |
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 | |
39 --> | |
40 | |
41 <dom-module id="paper-input"> | |
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 | |
67 <template> | |
68 | |
69 <paper-input-container no-label-float="[[noLabelFloat]]" always-float-label=
"[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[a
utoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]"> | |
70 | |
71 <label hidden$="[[!label]]">[[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 allowed-pattern="[[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 list$="[[list]]" | |
94 size$="[[size]]" | |
95 autocapitalize$="[[autocapitalize]]" | |
96 autocorrect$="[[autocorrect]]"> | |
97 | |
98 <template is="dom-if" if="[[errorMessage]]"> | |
99 <paper-input-error>[[errorMessage]]</paper-input-error> | |
100 </template> | |
101 | |
102 <template is="dom-if" if="[[charCounter]]"> | |
103 <paper-input-char-counter></paper-input-char-counter> | |
104 </template> | |
105 | |
106 </paper-input-container> | |
107 | |
108 </template> | |
109 | |
110 </dom-module> | |
111 | |
112 <script> | |
113 | |
114 (function() { | |
115 | |
116 Polymer({ | |
117 | |
118 is: 'paper-input', | |
119 | |
120 behaviors: [ | |
121 Polymer.IronFormElementBehavior, | |
122 Polymer.PaperInputBehavior, | |
123 Polymer.IronControlState | |
124 ] | |
125 | |
126 }) | |
127 | |
128 })(); | |
129 | |
130 </script> | |
OLD | NEW |