Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <link rel="import" href="chrome://resources/html/polymer.html"> | 1 <link rel="import" href="chrome://resources/html/polymer.html"> |
| 2 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html "> | 2 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html "> |
| 3 | 3 |
| 4 <dom-module id="md-select"> | 4 <dom-module id="md-select"> |
| 5 <template> | 5 <template> |
| 6 <style> | 6 <style> |
| 7 .md-select, | |
| 8 .md-select-underline { | |
| 9 --md-side-padding: 12px; | |
| 10 } | |
| 11 | |
| 7 .md-select { | 12 .md-select { |
| 8 --md-arrow-width: 0.9em; | 13 --md-arrow-width: 0.9em; |
| 9 -webkit-appearance: none; | 14 -webkit-appearance: none; |
| 10 /* Ensure that the text does not overlap with the down arrow. */ | 15 /* Ensure that the text does not overlap with the down arrow. */ |
| 11 -webkit-padding-end: calc(var(--md-arrow-width) * 1.8); | 16 -webkit-padding-end: calc(var(--md-side-padding) + var(--md-arrow-width) * 1.8); |
| 17 -webkit-padding-start: var(--md-side-padding); | |
| 12 background: url( | 18 background: url( |
| 13 chrome://resources/images/arrow_down.svg) 97% center no-repeat; | 19 chrome://resources/images/arrow_down.svg) calc(97% - var(--md-side-pad ding)) center no-repeat; |
|
Dan Beam
2017/04/11 21:24:29
wrap at 80 cols
dpapad
2017/04/11 21:51:40
Done.
| |
| 14 background-size: var(--md-arrow-width); | 20 background-size: var(--md-arrow-width); |
| 15 border-bottom: 1px solid var(--paper-grey-300); | 21 border: none; |
| 16 border-left: none; | |
| 17 /* Override Mac's default border-radius */ | |
| 18 border-radius: 0; | |
| 19 border-right: none; | |
| 20 border-top: none; | |
| 21 color: var(--primary-text-color); | 22 color: var(--primary-text-color); |
| 22 cursor: pointer; | 23 cursor: pointer; |
| 23 font-family: inherit; | 24 font-family: inherit; |
| 24 font-size: inherit; | 25 font-size: inherit; |
| 25 outline: none; | 26 outline: none; |
| 26 padding-bottom: 3px; | 27 padding-bottom: 4px; |
| 27 padding-top: 3px; | 28 padding-top: 3px; |
| 28 width: var(--md-select-width, 200px); | 29 width: var(--md-select-width, 200px); |
| 29 } | 30 } |
| 30 | 31 |
| 31 /* Mirroring paper-dropdown-menu disabled style. */ | 32 /* Mirroring paper-dropdown-menu disabled style. */ |
| 32 .md-select[disabled] { | 33 .md-select[disabled] { |
| 33 border-bottom: 1px dashed var(--secondary-text-color); | 34 border-bottom: 1px dashed var(--secondary-text-color); |
| 34 color: var(--secondary-text-color); | 35 color: var(--secondary-text-color); |
| 35 opacity: 0.65; | 36 opacity: 0.65; |
| 36 pointer-events: none; | 37 pointer-events: none; |
| 37 } | 38 } |
| 38 | 39 |
| 39 :host-context([dir=rtl]) .md-select { | 40 :host-context([dir=rtl]) .md-select { |
| 40 background-position-x: 3%; | 41 background-position-x: calc(var(--md-side-padding) + 3%); |
| 41 } | 42 } |
| 42 | 43 |
| 44 /* Persistent underline */ | |
| 43 .md-select-underline { | 45 .md-select-underline { |
| 46 border-top: 1px solid var(--paper-grey-300); | |
| 47 display: block; | |
| 48 margin: 0 var(--md-side-padding); | |
| 49 } | |
| 50 | |
| 51 /* Focus underline */ | |
| 52 .md-select-underline::after { | |
| 44 border-top: 2px solid var(--google-blue-500); | 53 border-top: 2px solid var(--google-blue-500); |
| 54 content: ''; | |
| 45 display: block; | 55 display: block; |
| 56 transform: scale3d(0, 1, 1); | |
| 57 transition: transform 200ms ease-in; | |
| 58 } | |
| 59 | |
| 60 /* Force the thicker "focus" underline to be properly overlapping with the | |
| 61 "persistent" underline, and also make it visible by 1px while the | |
| 62 <select> is expanded. */ | |
|
Dan Beam
2017/04/11 21:24:29
nit: asterisk at beginning of lines
/* Force the
dpapad
2017/04/11 21:51:40
Done.
| |
| 63 .md-select-underline, | |
| 64 .md-select-underline::after { | |
| 46 position: relative; | 65 position: relative; |
| 47 top: -1px; | 66 top: -1px; |
| 48 transform: scale3d(0, 1, 1); | |
| 49 transition: transform 200ms ease-in; | |
| 50 width: 100%; | |
| 51 } | 67 } |
| 52 | 68 |
| 53 .md-select:focus + .md-select-underline { | 69 .md-select:focus + .md-select-underline::after { |
| 54 transform: scale3d(1, 1, 1); | 70 transform: scale3d(1, 1, 1); |
| 55 transition: transform 200ms ease-out; | 71 transition: transform 200ms ease-out; |
| 56 } | 72 } |
| 57 | 73 |
| 58 .md-select-wrapper { | 74 .md-select-wrapper { |
| 59 display: inline-block; | 75 display: inline-block; |
| 60 max-width: 100%; | 76 max-width: 100%; |
| 61 } | 77 } |
| 62 </style> | 78 </style> |
| 63 </template> | 79 </template> |
| 64 </dom-module> | 80 </dom-module> |
| OLD | NEW |