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-field.html
More file actions
167 lines (141 loc) · 4.52 KB
/
Copy pathanypoint-text-field.html
File metadata and controls
167 lines (141 loc) · 4.52 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!--
@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>` single line text input styled for the Anypoint platform as a Polymer
powered web component
It may include an optional error message.
```
<anypoint-text-field required error-message="Value is required"></anypoint-text-field>
```
It may include a custom validator(s).
```
<anypoint-text-field validator="my-validator" error-message="Value is required"></anypoint-text-field>
```
See `Anypoint.AnypointValidatableBehavior` for API and examples.
### Styling
See `anypoint-text-container` for styling options.
@group Anypoint Elements
@element anypoint-text-field
@demo demo/index.html
-->
<dom-module id="anypoint-text-field">
<template>
<style>
:host {
display: block;
}
:host {
display: block;
}
:host([focused]) {
outline: none;
}
:host([hidden]) {
display: none !important;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
@apply(--anypoint-text-container-input-webkit-spinner);
}
input::-webkit-clear-button {
@apply(--anypoint-text-container-input-webkit-clear);
}
input::-webkit-input-placeholder {
color: var(--anypoint-text-container-color, --secondary-text-color);
}
input:-moz-placeholder {
color: var(--anypoint-text-container-color, --secondary-text-color);
}
input::-moz-placeholder {
color: var(--anypoint-text-container-color, --secondary-text-color);
}
input:-ms-input-placeholder {
color: var(--anypoint-text-container-color, --secondary-text-color);
}
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="[[noLabelFloat]]"
always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]"
auto-validate$="[[autoValidate]]"
disabled$="[[disabled]]"
invalid="[[invalid]]">
<content select="[prefix]"></content>
<label hidden$="[[!label]]" aria-hidden="true" for="input">[[label]]</label>
<input is="anypoint-input" id="input"
aria-labelledby$="[[_ariaLabelledBy]]"
aria-describedby$="[[_ariaDescribedBy]]"
disabled$="[[disabled]]"
title$="[[title]]"
bind-value="{{value}}"
invalid="{{invalid}}"
prevent-invalid-input="[[preventInvalidInput]]"
allowed-pattern="[[allowedPattern]]"
validator="[[validator]]"
type$="[[type]]"
pattern$="[[pattern]]"
required$="[[required]]"
autocomplete$="[[autocomplete]]"
autofocus$="[[autofocus]]"
inputmode$="[[inputmode]]"
minlength$="[[minlength]]"
maxlength$="[[maxlength]]"
min$="[[min]]"
max$="[[max]]"
step$="[[step]]"
name$="[[name]]"
placeholder$="[[placeholder]]"
readonly$="[[readonly]]"
list$="[[list]]"
size$="[[size]]"
autocapitalize$="[[autocapitalize]]"
autocorrect$="[[autocorrect]]"
on-change="_onChange"
tabindex$="[[tabindex]]"
autosave$="[[autosave]]"
results$="[[results]]"
accept$="[[accept]]"
multiple$="[[multiple]]"
validation-states="{{validationStates}}">
<content select="[suffix]"></content>
<template is="dom-if" if="[[hasValidationMessage]]">
<anypoint-validation-result
aria-live="assertive"
error-message="[[errorMessage]]"
invalid="[[invalid]]"
focused="[[focused]]"
validation-states="{{validationStates}}"
horizontal-align="right"></anypoint-validation-result>
</template>
</anypoint-text-container>
</template>
<script>
Polymer({
is: 'anypoint-text-field',
behaviors: [
Polymer.IronFormElementBehavior,
Anypoint.AnypointTextBehavior
]
});
</script>
</dom-module>