Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container.html

Issue 1287713002: [MD settings] merge polymer 1.0.11; hack for settings checkbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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">
(...skipping 14 matching lines...) Expand all
25 25
26 By default, it listens for changes on the `bind-value` attribute on its children nodes and perform 26 By default, it listens for changes on the `bind-value` attribute on its children nodes and perform
27 tasks such as auto-validating and label styling when the `bind-value` changes. Y ou can configure 27 tasks such as auto-validating and label styling when the `bind-value` changes. Y ou can configure
28 the attribute it listens to with the `attr-for-value` attribute. 28 the attribute it listens to with the `attr-for-value` attribute.
29 29
30 ### Using a custom input element 30 ### Using a custom input element
31 31
32 You can use a custom input element in a `<paper-input-container>`, for example t o implement a 32 You can use a custom input element in a `<paper-input-container>`, for example t o implement a
33 compound input field like a social security number input. The custom input eleme nt should have the 33 compound input field like a social security number input. The custom input eleme nt should have the
34 `paper-input-input` class, have a `notify:true` value property and optionally im plements 34 `paper-input-input` class, have a `notify:true` value property and optionally im plements
35 `Polymer.IronValidatableBehavior` if it is validatble. 35 `Polymer.IronValidatableBehavior` if it is validatable.
36 36
37 <paper-input-container attr-for-value="ssn-value"> 37 <paper-input-container attr-for-value="ssn-value">
38 <label>Social security number</label> 38 <label>Social security number</label>
39 <ssn-input class="paper-input-input"></ssn-input> 39 <ssn-input class="paper-input-input"></ssn-input>
40 </paper-input-container> 40 </paper-input-container>
41 41
42 ### Validation 42 ### Validation
43 43
44 If the `auto-validate` attribute is set, the input container will validate the i nput and update 44 If the `auto-validate` attribute is set, the input container will validate the i nput and update
45 the container styling when the input value changes. 45 the container styling when the input value changes.
46 46
47 ### Add-ons 47 ### Add-ons
48 48
49 Add-ons are child elements of a `<paper-input-container>` with the `add-on` attr ibute and 49 Add-ons are child elements of a `<paper-input-container>` with the `add-on` attr ibute and
50 implements the `Polymer.PaperInputAddonBehavior` behavior. They are notified whe n the input value 50 implements the `Polymer.PaperInputAddonBehavior` behavior. They are notified whe n the input value
51 or validity changes, and may implement functionality such as error messages or c haracter counters. 51 or validity changes, and may implement functionality such as error messages or c haracter counters.
52 They appear at the bottom of the input. 52 They appear at the bottom of the input.
53 53
54 ### Prefixes and suffixes
55 These are child elements of a `<paper-input-container>` with the `prefix`
56 or `suffix` attribute, and are displayed inline with the input, before or after.
57
58 <paper-input-container>
59 <div prefix>$</div>
60 <label>Total</label>
61 <input is="iron-input">
62 <paper-icon-button suffix icon="clear"></paper-icon-button>
63 </paper-input-container>
64
54 ### Styling 65 ### Styling
55 66
56 The following custom properties and mixins are available for styling: 67 The following custom properties and mixins are available for styling:
57 68
58 Custom property | Description | Default 69 Custom property | Description | Default
59 ----------------|-------------|---------- 70 ----------------|-------------|----------
60 `--paper-input-container-color` | Label and underline color when the input is no t focused | `--secondary-text-color` 71 `--paper-input-container-color` | Label and underline color when the input is no t focused | `--secondary-text-color`
61 `--paper-input-container-focus-color` | Label and underline color when the input is focused | `--default-primary-color` 72 `--paper-input-container-focus-color` | Label and underline color when the input is focused | `--default-primary-color`
62 `--paper-input-container-invalid-color` | Label and underline color when the inp ut is focused | `--google-red-500` 73 `--paper-input-container-invalid-color` | Label and underline color when the inp ut is is invalid | `--google-red-500`
63 `--paper-input-container-input-color` | Input foreground color | `--primary-text -color` 74 `--paper-input-container-input-color` | Input foreground color | `--primary-text -color`
64 `--paper-input-container` | Mixin applied to the container | `{}` 75 `--paper-input-container` | Mixin applied to the container | `{}`
65 `--paper-input-container-label` | Mixin applied to the label | `{}` 76 `--paper-input-container-label` | Mixin applied to the label | `{}`
66 `--paper-input-container-label-focus` | Mixin applied to the label when the inpu t is focused | `{}` 77 `--paper-input-container-label-focus` | Mixin applied to the label when the inpu t is focused | `{}`
67 `--paper-input-container-input` | Mixin applied to the input | `{}` 78 `--paper-input-container-input` | Mixin applied to the input | `{}`
79 `--paper-input-container-input-disabled` | Mixin applied to the input when it's disabled | `{}`
80 `--paper-input-container-prefix` | Mixin applied to the input prefix | `{}`
81 `--paper-input-container-suffix` | Mixin applied to the input suffix | `{}`
68 `--paper-input-container-underline` | Mixin applied to the underline | `{}` 82 `--paper-input-container-underline` | Mixin applied to the underline | `{}`
69 `--paper-input-container-underline-focus` | Mixin applied to the underline when the input is focued | `{}` 83 `--paper-input-container-underline-focus` | Mixin applied to the underline when the input is focued | `{}`
70 `--paper-input-container-underline-disabled` | Mixin applied to the underline wh en the input is disabled | `{}` 84 `--paper-input-container-underline-disabled` | Mixin applied to the underline wh en the input is disabled | `{}`
71 85
72 This element is `display:block` by default, but you can set the `inline` attribu te to make it 86 This element is `display:block` by default, but you can set the `inline` attribu te to make it
73 `display:inline-block`. 87 `display:inline-block`.
74 --> 88 -->
75 </head><body><dom-module id="paper-input-container"> 89 </head><body><dom-module id="paper-input-container">
76 90
77 <style> 91 <style>
78 92
79 :host { 93 :host {
80 display: block; 94 display: block;
81 padding: 8px 0; 95 padding: 8px 0;
82 96
83 @apply(--paper-input-container); 97 @apply(--paper-input-container);
84 } 98 }
85 99
86 :host[inline] { 100 :host[inline] {
87 display: inline-block; 101 display: inline-block;
88 } 102 }
89 103
90 :host([disabled]) { 104 :host([disabled]) {
91 pointer-events: none; 105 pointer-events: none;
92 opacity: 0.33; 106 opacity: 0.33;
107
108 @apply(--paper-input-container-disabled);
93 } 109 }
94 110
95 .floated-label-placeholder { 111 .floated-label-placeholder {
96 @apply(--paper-font-caption); 112 @apply(--paper-font-caption);
97 } 113 }
98 114
99 .underline { 115 .underline {
100 position: relative; 116 position: relative;
101 } 117 }
102 118
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 157 }
142 158
143 :host([disabled]) .unfocused-line { 159 :host([disabled]) .unfocused-line {
144 border-bottom: 1px dashed; 160 border-bottom: 1px dashed;
145 border-color: var(--paper-input-container-color, --secondary-text-color); 161 border-color: var(--paper-input-container-color, --secondary-text-color);
146 background: transparent; 162 background: transparent;
147 163
148 @apply(--paper-input-container-underline-disabled); 164 @apply(--paper-input-container-underline-disabled);
149 } 165 }
150 166
167 .label-and-input-container {
168 @apply(--layout-flex);
169 @apply(--layout-relative);
170 }
171
151 .input-content { 172 .input-content {
152 position: relative; 173 position: relative;
174 @apply(--layout-horizontal);
175 @apply(--layout-end);
153 } 176 }
154 177
155 .input-content ::content label, 178 .input-content ::content label,
156 .input-content ::content .paper-input-label { 179 .input-content ::content .paper-input-label {
157 position: absolute; 180 position: absolute;
158 top: 0; 181 top: 0;
159 right: 0; 182 right: 0;
160 left: 0; 183 left: 0;
161 font: inherit; 184 font: inherit;
162 color: var(--paper-input-container-color, --secondary-text-color); 185 color: var(--paper-input-container-color, --secondary-text-color);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 padding: 0; 227 padding: 0;
205 width: 100%; 228 width: 100%;
206 background: transparent; 229 background: transparent;
207 border: none; 230 border: none;
208 color: var(--paper-input-container-input-color, --primary-text-color); 231 color: var(--paper-input-container-input-color, --primary-text-color);
209 232
210 @apply(--paper-font-subhead); 233 @apply(--paper-font-subhead);
211 @apply(--paper-input-container-input); 234 @apply(--paper-input-container-input);
212 } 235 }
213 236
237 ::content [prefix] {
238 @apply(--paper-font-subhead);
239 @apply(--paper-input-prefix);
240 }
241
242 ::content [suffix] {
243 @apply(--paper-font-subhead);
244 @apply(--paper-input-suffix);
245 }
246
214 /* Firefox sets a min-width on the input, which can cause layout issues */ 247 /* Firefox sets a min-width on the input, which can cause layout issues */
215 .input-content ::content input { 248 .input-content ::content input {
216 min-width: 0; 249 min-width: 0;
217 } 250 }
218 251
219 .input-content ::content textarea { 252 .input-content ::content textarea {
220 resize: none; 253 resize: none;
221 } 254 }
222 255
223 .add-on-content.is-invalid ::content * { 256 .add-on-content.is-invalid ::content * {
224 color: var(--paper-input-container-invalid-color, --google-red-500); 257 color: var(--paper-input-container-invalid-color, --google-red-500);
225 } 258 }
226 259
227 .add-on-content.is-highlighted ::content * { 260 .add-on-content.is-highlighted ::content * {
228 color: var(--paper-input-container-focus-color, --default-primary-color); 261 color: var(--paper-input-container-focus-color, --default-primary-color);
229 } 262 }
230 263
231 </style> 264 </style>
232 265
233 <template> 266 <template>
234 267
235 <template is="dom-if" if="[[!noLabelFloat]]"> 268 <template is="dom-if" if="[[!noLabelFloat]]">
236 <div class="floated-label-placeholder">&nbsp;</div> 269 <div class="floated-label-placeholder">&nbsp;</div>
237 </template> 270 </template>
238 271
239 <div class$="[[_computeInputContentClass(noLabelFloat,alwaysFloatLabel,focus ed,invalid,_inputHasContent)]]"> 272 <div class$="[[_computeInputContentClass(noLabelFloat,alwaysFloatLabel,focus ed,invalid,_inputHasContent)]]">
240 <content select=":not([add-on])"></content> 273 <content select="[prefix]" id="prefix"></content>
274 <div class="label-and-input-container">
275 <content select=":not([add-on]):not([prefix]):not([suffix])"></content>
276 </div>
277 <content select="[suffix]"></content>
241 </div> 278 </div>
242 279
243 <div class$="[[_computeUnderlineClass(focused,invalid)]]"> 280 <div class$="[[_computeUnderlineClass(focused,invalid)]]">
244 <div class="unfocused-line fit"></div> 281 <div class="unfocused-line fit"></div>
245 <div class="focused-line fit"></div> 282 <div class="focused-line fit"></div>
246 </div> 283 </div>
247 284
248 <div class$="[[_computeAddOnContentClass(focused,invalid)]]"> 285 <div class$="[[_computeAddOnContentClass(focused,invalid)]]">
249 <content id="addOnContent" select="[add-on]"></content> 286 <content id="addOnContent" select="[add-on]"></content>
250 </div> 287 </div>
251 288
252 </template> 289 </template>
253 290
254 </dom-module> 291 </dom-module>
255 292
256 <script src="paper-input-container-extracted.js"></script></body></html> 293 <script src="paper-input-container-extracted.js"></script></body></html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698