This repository was archived by the owner on Aug 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanypoint-text-textarea.html
More file actions
134 lines (117 loc) · 3.21 KB
/
Copy pathanypoint-text-textarea.html
File metadata and controls
134 lines (117 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!--
@license
Copyright 2017 Mulesoft.
All rights reserved.
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-form-element-behavior/iron-form-element-behavior.html">
<link rel="import" href="../anypoint-input/anypoint-input.html">
<link rel="import" href="anypoint-text-container.html">
<link rel="import" href="anypoint-text-behavior.html">
<link rel="import" href="anypoint-validation-result.html">
<!--
`<anypoint-text-field>` is a mu;lti line text input styled for the Anypoint platform
as a Polymer powered web component
### Example
```
<anypoint-text-textarea></anypoint-text-textarea>
```
### Styling
See `anypoint-text-container` for styling options.
@demo demo/index.html
-->
<dom-module id="anypoint-text-textarea">
<template>
<style>
:host {
display: block;
}
:host {
display: block;
}
:host([hidden]) {
display: none !important;
}
label {
pointer-events: none;
}
anypoint-validation-result {
-webkit-transform-origin: center center;
transform-origin: center center;
-webkit-transition: all .2s ease-out;
transition: all .2s ease-out;
}
:host(:not([focused])) anypoint-validation-result {
transform: translate(2px);
}
</style>
<anypoint-text-container
no-label-float
auto-validate$="[[autoValidate]]"
disabled$="[[disabled]]"
invalid="[[invalid]]">
<textarea id="textarea"
disabled$="[[disabled]]"
title$="[[title]]"
bind-value="{{value}}"
invalid="{{invalid}}"
required$="[[required]]"
autocomplete$="[[autocomplete]]"
autofocus$="[[autofocus]]"
inputmode$="[[inputmode]]"
minlength$="[[minlength]]"
maxlength$="[[maxlength]]"
name$="[[name]]"
placeholder$="[[placeholder]]"
readonly$="[[readonly]]"
autocapitalize$="[[autocapitalize]]"
on-change="_onChange"
rows$="[[rows]]"></textarea>
<template is="dom-if" if="[[hasValidationMessage]]">
<anypoint-validation-result
aria-live="assertive"
error-message="[[errorMessage]]"
invalid="[[invalid]]"
focused="[[focused]]"
horizontal-align="right"></anypoint-validation-result>
</template>
</anypoint-text-container>
</template>
<script>
Polymer({
is: 'anypoint-text-textarea',
behaviors: [
Polymer.IronFormElementBehavior,
Anypoint.AnypointTextBehavior
],
properties: {
_ariaLabelledBy: {
observer: '_ariaLabelledByChanged',
type: String
},
_ariaDescribedBy: {
observer: '_ariaDescribedByChanged',
type: String
},
/**
* The initial number of rows.
*
* @type number
*/
rows: {
type: Number,
value: 3
}
},
_ariaLabelledByChanged: function(ariaLabelledBy) {
this.$.textarea.setAttribute('aria-labelledby', ariaLabelledBy);
},
_ariaDescribedByChanged: function(ariaDescribedBy) {
this.$.textarea.setAttribute('aria-describedby', ariaDescribedBy);
},
get _focusableElement() {
return this.$.textarea;
}
});
</script>
</dom-module>