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-autogrow-textarea/iron-autogrow-textarea.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-textarea>` is a multi-line text field with Material Design styling. | |
20 | |
21 <paper-textarea label="Textarea label"></paper-textarea> | |
22 | |
23 See `Polymer.PaperInputBehavior` for more API docs. | |
24 | |
25 ### Validation | |
26 | |
27 Currently only `required` and `maxlength` validation is supported. | |
28 | |
29 ### Styling | |
30 | |
31 See `Polymer.PaperInputContainer` for a list of custom properties used to | |
32 style this element. | |
33 --> | |
34 | |
35 <dom-module id="paper-textarea"> | |
36 <template> | |
37 | |
38 <paper-input-container no-label-float$="[[noLabelFloat]]" auto-validate$="[[
autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]"> | |
39 | |
40 <label hidden$="[[!label]]">[[label]]</label> | |
41 | |
42 <iron-autogrow-textarea id="input" class="paper-input-input" | |
43 bind-value="{{value}}" | |
44 required$="[[required]]" | |
45 maxlength$="[[maxlength]]"></iron-autogrow-textarea> | |
46 | |
47 <template is="dom-if" if="[[errorMessage]]"> | |
48 <paper-input-error>[[errorMessage]]</paper-input-error> | |
49 </template> | |
50 | |
51 <template is="dom-if" if="[[charCounter]]"> | |
52 <paper-input-char-counter></paper-input-char-counter> | |
53 </template> | |
54 | |
55 </paper-input-container> | |
56 | |
57 </template> | |
58 | |
59 </dom-module> | |
60 | |
61 <script> | |
62 | |
63 (function() { | |
64 | |
65 Polymer({ | |
66 | |
67 is: 'paper-textarea', | |
68 | |
69 behaviors: [ | |
70 Polymer.PaperInputBehavior, | |
71 Polymer.IronFormElementBehavior | |
72 ], | |
73 | |
74 properties: { | |
75 | |
76 _ariaLabelledBy: { | |
77 observer: '_ariaLabelledByChanged', | |
78 type: String | |
79 }, | |
80 | |
81 _ariaDescribedBy: { | |
82 observer: '_ariaDescribedByChanged', | |
83 type: String | |
84 } | |
85 | |
86 }, | |
87 | |
88 _ariaLabelledByChanged: function(ariaLabelledBy) { | |
89 this.$.input.textarea.setAttribute('aria-labelledby', ariaLabelledBy); | |
90 }, | |
91 | |
92 _ariaDescribedByChanged: function(ariaDescribedBy) { | |
93 this.$.input.textarea.setAttribute('aria-describedby', ariaDescribedBy); | |
94 } | |
95 | |
96 }); | |
97 | |
98 })(); | |
99 | |
100 </script> | |
OLD | NEW |