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 --><html><head><link rel="import" href="../polymer/polymer.html"> | 9 --><html><head><link rel="import" href="../polymer/polymer.html"> |
10 <link rel="import" href="../paper-styles/paper-styles.html"> | 10 <link rel="import" href="../paper-styles/paper-styles.html"> |
| 11 <link rel="import" href="paper-input-addon-behavior.html"> |
11 | 12 |
12 <!-- | 13 <!-- |
13 `<paper-input-error>` is an error message for use with `<paper-input-container>`
. | 14 `<paper-input-error>` is an error message for use with `<paper-input-container>`
. The error is |
| 15 displayed when the `<paper-input-container>` is `invalid`. |
| 16 |
| 17 <paper-input-container> |
| 18 <input is="iron-input" pattern="[0-9]*"> |
| 19 <paper-input-error>Only numbers are allowed!</paper-input-error> |
| 20 </paper-input-container> |
| 21 |
| 22 ### Styling |
| 23 |
| 24 The following custom properties and mixins are available for styling: |
| 25 |
| 26 Custom property | Description | Default |
| 27 ----------------|-------------|---------- |
| 28 `--paper-input-container-invalid-color` | The foreground color of the error | `-
-google-red-500` |
| 29 `--paper-input-error` | Mixin applied to the error | `{
}` |
14 --> | 30 --> |
15 </head><body><dom-module id="paper-input-error"> | 31 </head><body><dom-module id="paper-input-error"> |
16 | 32 |
17 <style> | 33 <style> |
18 | 34 |
19 :host { | 35 :host { |
20 /* need to use display: none for role="alert" */ | 36 /* need to use display: none for role="alert" */ |
21 display: none; | 37 display: none; |
22 float: left; | 38 float: left; |
23 | 39 |
24 color: var(--paper-input-container-invalid-color); | 40 color: var(--paper-input-container-invalid-color, --google-red-500); |
25 | 41 |
26 mixin(--paper-input-container-add-on); | 42 @apply(--paper-font-caption); |
27 mixin(--paper-input-container-add-on-font); | 43 @apply(--paper-input-error); |
28 | |
29 mixin(--paper-input-error); | |
30 } | 44 } |
31 | 45 |
32 :host([invalid]) { | 46 :host([invalid]) { |
33 display: inline-block; | 47 display: inline-block; |
34 }; | 48 }; |
35 | 49 |
36 </style> | 50 </style> |
37 | 51 |
38 <template> | 52 <template> |
39 | 53 |
40 <content></content> | 54 <content></content> |
41 | 55 |
42 </template> | 56 </template> |
43 | 57 |
44 </dom-module> | 58 </dom-module> |
45 | 59 |
46 <script src="paper-input-error-extracted.js"></script></body></html> | 60 <script src="paper-input-error-extracted.js"></script></body></html> |
OLD | NEW |