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

Side by Side Diff: lib/src/paper-input/paper-input-container.html

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month 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 --> 9 -->
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 The following custom properties and mixins are available for styling: 69 The following custom properties and mixins are available for styling:
70 70
71 Custom property | Description | Default 71 Custom property | Description | Default
72 ----------------|-------------|---------- 72 ----------------|-------------|----------
73 `--paper-input-container-color` | Label and underline color when the input is no t focused | `--secondary-text-color` 73 `--paper-input-container-color` | Label and underline color when the input is no t focused | `--secondary-text-color`
74 `--paper-input-container-focus-color` | Label and underline color when the input is focused | `--default-primary-color` 74 `--paper-input-container-focus-color` | Label and underline color when the input is focused | `--default-primary-color`
75 `--paper-input-container-invalid-color` | Label and underline color when the inp ut is is invalid | `--google-red-500` 75 `--paper-input-container-invalid-color` | Label and underline color when the inp ut is is invalid | `--google-red-500`
76 `--paper-input-container-input-color` | Input foreground color | `--primary-text -color` 76 `--paper-input-container-input-color` | Input foreground color | `--primary-text -color`
77 `--paper-input-container` | Mixin applied to the container | `{}` 77 `--paper-input-container` | Mixin applied to the container | `{}`
78 `--paper-input-container-disabled` | Mixin applied to the container when it's di sabled | `{}`
78 `--paper-input-container-label` | Mixin applied to the label | `{}` 79 `--paper-input-container-label` | Mixin applied to the label | `{}`
79 `--paper-input-container-label-focus` | Mixin applied to the label when the inpu t is focused | `{}` 80 `--paper-input-container-label-focus` | Mixin applied to the label when the inpu t is focused | `{}`
80 `--paper-input-container-input` | Mixin applied to the input | `{}` 81 `--paper-input-container-input` | Mixin applied to the input | `{}`
81 `--paper-input-container-input-disabled` | Mixin applied to the input when it's disabled | `{}`
82 `--paper-input-container-prefix` | Mixin applied to the input prefix | `{}`
83 `--paper-input-container-suffix` | Mixin applied to the input suffix | `{}`
84 `--paper-input-container-underline` | Mixin applied to the underline | `{}` 82 `--paper-input-container-underline` | Mixin applied to the underline | `{}`
85 `--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 | `{}`
86 `--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 | `{}`
85 `--paper-input-prefix` | Mixin applied to the input prefix | `{}`
86 `--paper-input-suffix` | Mixin applied to the input suffix | `{}`
87 87
88 This element is `display:block` by default, but you can set the `inline` attribu te to make it 88 This element is `display:block` by default, but you can set the `inline` attribu te to make it
89 `display:inline-block`. 89 `display:inline-block`.
90 --> 90 -->
91 <dom-module id="paper-input-container"> 91 <dom-module id="paper-input-container">
92 <template> 92 <template>
93 93
94 <style> 94 <style>
95 :host { 95 :host {
96 display: block; 96 display: block;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 .input-content ::content label, 180 .input-content ::content label,
181 .input-content ::content .paper-input-label { 181 .input-content ::content .paper-input-label {
182 position: absolute; 182 position: absolute;
183 top: 0; 183 top: 0;
184 right: 0; 184 right: 0;
185 left: 0; 185 left: 0;
186 font: inherit; 186 font: inherit;
187 color: var(--paper-input-container-color, --secondary-text-color); 187 color: var(--paper-input-container-color, --secondary-text-color);
188 188
189 @apply(--paper-font-common-nowrap);
189 @apply(--paper-font-subhead); 190 @apply(--paper-font-subhead);
190 @apply(--paper-input-container-label); 191 @apply(--paper-input-container-label);
191 } 192 }
192 193
193 .input-content.label-is-floating ::content label, 194 .input-content.label-is-floating ::content label,
194 .input-content.label-is-floating ::content .paper-input-label { 195 .input-content.label-is-floating ::content .paper-input-label {
195 -webkit-transform: translate3d(0, -75%, 0) scale(0.75); 196 -webkit-transform: translateY(-75%) scale(0.75);
196 transform: translate3d(0, -75%, 0) scale(0.75); 197 transform: translateY(-75%) scale(0.75);
197 -webkit-transform-origin: left top; 198 -webkit-transform-origin: left top;
198 transform-origin: left top; 199 transform-origin: left top;
199 -webkit-transition: -webkit-transform 0.25s; 200 -webkit-transition: -webkit-transform 0.25s;
200 transition: transform 0.25s; 201 transition: transform 0.25s;
201 202
203 /* Since we scale to 75/100 of the size, we actually have 100/75 of the
204 original space now available */
205 width: 133%;
206
202 @apply(--paper-transition-easing); 207 @apply(--paper-transition-easing);
203 } 208 }
204 209
205 .input-content.label-is-highlighted ::content label, 210 .input-content.label-is-highlighted ::content label,
206 .input-content.label-is-highlighted ::content .paper-input-label { 211 .input-content.label-is-highlighted ::content .paper-input-label {
207 color: var(--paper-input-container-focus-color, --default-primary-color) ; 212 color: var(--paper-input-container-focus-color, --default-primary-color) ;
208 213
209 @apply(--paper-input-container-label-focus); 214 @apply(--paper-input-container-label-focus);
210 } 215 }
211 216
(...skipping 12 matching lines...) Expand all
224 .input-content ::content iron-autogrow-textarea, 229 .input-content ::content iron-autogrow-textarea,
225 .input-content ::content .paper-input-input { 230 .input-content ::content .paper-input-input {
226 position: relative; /* to make a stacking context */ 231 position: relative; /* to make a stacking context */
227 outline: none; 232 outline: none;
228 box-shadow: none; 233 box-shadow: none;
229 padding: 0; 234 padding: 0;
230 width: 100%; 235 width: 100%;
231 background: transparent; 236 background: transparent;
232 border: none; 237 border: none;
233 color: var(--paper-input-container-input-color, --primary-text-color); 238 color: var(--paper-input-container-input-color, --primary-text-color);
239 -webkit-appearance: none;
234 240
235 @apply(--paper-font-subhead); 241 @apply(--paper-font-subhead);
236 @apply(--paper-input-container-input); 242 @apply(--paper-input-container-input);
237 } 243 }
238 244
239 ::content [prefix] { 245 ::content [prefix] {
240 @apply(--paper-font-subhead); 246 @apply(--paper-font-subhead);
241 @apply(--paper-input-prefix); 247 @apply(--paper-input-prefix);
242 } 248 }
243 249
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 /** 327 /**
322 * Set to true to auto-validate the input value when it changes. 328 * Set to true to auto-validate the input value when it changes.
323 */ 329 */
324 autoValidate: { 330 autoValidate: {
325 type: Boolean, 331 type: Boolean,
326 value: false 332 value: false
327 }, 333 },
328 334
329 /** 335 /**
330 * True if the input is invalid. This property is set automatically when t he input value 336 * True if the input is invalid. This property is set automatically when t he input value
331 * changes if auto-validating, or when the `iron-input-valid` event is hea rd from a child. 337 * changes if auto-validating, or when the `iron-input-validate` event is heard from a child.
332 */ 338 */
333 invalid: { 339 invalid: {
334 observer: '_invalidChanged', 340 observer: '_invalidChanged',
335 type: Boolean, 341 type: Boolean,
336 value: false 342 value: false
337 }, 343 },
338 344
339 /** 345 /**
340 * True if the input has focus. 346 * True if the input has focus.
341 */ 347 */
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 530
525 if (alwaysFloatLabel || _inputHasContent) { 531 if (alwaysFloatLabel || _inputHasContent) {
526 cls += ' label-is-floating'; 532 cls += ' label-is-floating';
527 if (invalid) { 533 if (invalid) {
528 cls += ' is-invalid'; 534 cls += ' is-invalid';
529 } else if (focused) { 535 } else if (focused) {
530 cls += " label-is-highlighted"; 536 cls += " label-is-highlighted";
531 } 537 }
532 // The label might have a horizontal offset if a prefix element exists 538 // The label might have a horizontal offset if a prefix element exists
533 // which needs to be undone when displayed as a floating label. 539 // which needs to be undone when displayed as a floating label.
534 if (this.$.prefix && label && label.offsetParent && 540 if (Polymer.dom(this.$.prefix).getDistributedNodes().length > 0 &&
535 Polymer.dom(this.$.prefix).getDistributedNodes().length > 0) { 541 label && label.offsetParent) {
536 label.style.left = -label.offsetParent.offsetLeft + 'px'; 542 label.style.left = -label.offsetParent.offsetLeft + 'px';
537 } 543 }
538 } else { 544 } else {
539 // When the label is not floating, it should overlap the input element . 545 // When the label is not floating, it should overlap the input element .
540 if (label) { 546 if (label) {
541 label.style.left = 0; 547 label.style.left = 0;
542 } 548 }
543 } 549 }
544 } else { 550 } else {
545 if (_inputHasContent) { 551 if (_inputHasContent) {
546 cls += ' label-is-hidden'; 552 cls += ' label-is-hidden';
(...skipping 16 matching lines...) Expand all
563 var cls = 'add-on-content'; 569 var cls = 'add-on-content';
564 if (invalid) { 570 if (invalid) {
565 cls += ' is-invalid'; 571 cls += ' is-invalid';
566 } else if (focused) { 572 } else if (focused) {
567 cls += ' is-highlighted' 573 cls += ' is-highlighted'
568 } 574 }
569 return cls; 575 return cls;
570 } 576 }
571 }); 577 });
572 </script> 578 </script>
OLDNEW
« no previous file with comments | « lib/src/paper-input/paper-input-behavior.html ('k') | lib/src/paper-input/paper-input-error.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698