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 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 Custom property | Description | Default | 28 Custom property | Description | Default |
29 ----------------|-------------|---------- | 29 ----------------|-------------|---------- |
30 `--paper-input-container-invalid-color` | The foreground color of the error | `-
-google-red-500` | 30 `--paper-input-container-invalid-color` | The foreground color of the error | `-
-google-red-500` |
31 `--paper-input-error` | Mixin applied to the error | `{
}` | 31 `--paper-input-error` | Mixin applied to the error | `{
}` |
32 --> | 32 --> |
33 <dom-module id="paper-input-error"> | 33 <dom-module id="paper-input-error"> |
34 | 34 |
35 <style> | 35 <style> |
36 | 36 |
37 :host { | 37 :host { |
38 /* need to use display: none for role="alert" */ | 38 display: inline-block; |
39 display: none; | 39 visibility: hidden; |
40 float: left; | 40 float: left; |
41 | 41 |
42 color: var(--paper-input-container-invalid-color, --google-red-500); | 42 color: var(--paper-input-container-invalid-color, --google-red-500); |
43 | 43 |
44 @apply(--paper-font-caption); | 44 @apply(--paper-font-caption); |
45 @apply(--paper-input-error); | 45 @apply(--paper-input-error); |
46 } | 46 } |
47 | 47 |
48 :host([invalid]) { | 48 :host([invalid]) { |
49 display: inline-block; | 49 visibility: visible; |
50 }; | 50 }; |
51 | 51 |
52 </style> | 52 </style> |
53 | 53 |
54 <template> | 54 <template> |
55 | 55 |
56 <content></content> | 56 <content></content> |
57 | 57 |
58 </template> | 58 </template> |
59 | 59 |
60 </dom-module> | 60 </dom-module> |
61 | 61 |
62 <script> | 62 <script> |
63 | 63 |
64 (function() { | 64 (function() { |
65 | 65 |
66 Polymer({ | 66 Polymer({ |
67 | 67 |
68 is: 'paper-input-error', | 68 is: 'paper-input-error', |
69 | 69 |
70 behaviors: [ | 70 behaviors: [ |
71 Polymer.PaperInputAddonBehavior | 71 Polymer.PaperInputAddonBehavior |
72 ], | 72 ], |
73 | 73 |
74 hostAttributes: { | |
75 'role': 'alert' | |
76 }, | |
77 | |
78 properties: { | 74 properties: { |
79 | 75 |
80 /** | 76 /** |
81 * True if the error is showing. | 77 * True if the error is showing. |
82 */ | 78 */ |
83 invalid: { | 79 invalid: { |
84 readOnly: true, | 80 readOnly: true, |
85 reflectToAttribute: true, | 81 reflectToAttribute: true, |
86 type: Boolean | 82 type: Boolean |
87 } | 83 } |
88 | 84 |
89 }, | 85 }, |
90 | 86 |
91 update: function(state) { | 87 update: function(state) { |
92 this._setInvalid(state.invalid); | 88 this._setInvalid(state.invalid); |
93 } | 89 } |
94 | 90 |
95 }) | 91 }) |
96 | 92 |
97 })(); | 93 })(); |
98 | 94 |
99 </script> | 95 </script> |
OLD | NEW |