| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 @license |
| 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 |
| 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 |
| 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 |
| 9 --> |
| 10 |
| 11 <link rel="import" href="../../polymer/polymer.html"> |
| 12 <link rel="import" href="../../paper-ripple/paper-ripple.html"> |
| 13 <link rel="import" href="../paper-inky-focus-behavior.html"> |
| 14 |
| 15 <dom-module id="paper-radio-button"> |
| 16 |
| 17 <style> |
| 18 :host { |
| 19 display: inline-block; |
| 20 white-space: nowrap; |
| 21 } |
| 22 |
| 23 :host(:focus) { |
| 24 outline: none |
| 25 } |
| 26 |
| 27 #radioContainer { |
| 28 display: inline-block; |
| 29 position: relative; |
| 30 width: 16px; |
| 31 height: 16px; |
| 32 cursor: pointer; |
| 33 vertical-align: middle; |
| 34 } |
| 35 |
| 36 #offRadio { |
| 37 position: absolute; |
| 38 top: 0px; |
| 39 left: 0px; |
| 40 width: 12px; |
| 41 height: 12px; |
| 42 border-radius: 50%; |
| 43 border: solid 2px; |
| 44 border-color: black; |
| 45 transition: border-color 0.28s; |
| 46 } |
| 47 |
| 48 #onRadio { |
| 49 position: absolute; |
| 50 top: 4px; |
| 51 left: 4px; |
| 52 width: 8px; |
| 53 height: 8px; |
| 54 border-radius: 50%; |
| 55 background-color: red; |
| 56 -webkit-transform: scale(0); |
| 57 transform: scale(0); |
| 58 transition: -webkit-transform ease 0.28s; |
| 59 transition: transform ease 0.28s; |
| 60 } |
| 61 |
| 62 :host([disabled]) { |
| 63 opacity: 0.3; |
| 64 pointer-events: none; |
| 65 } |
| 66 |
| 67 :host([pressed]) #offRadio, |
| 68 :host([active]) #offRadio { |
| 69 border-color: red; |
| 70 } |
| 71 |
| 72 :host([pressed]) #onRadio, |
| 73 :host([active]) #onRadio { |
| 74 -webkit-transform: scale(1); |
| 75 transform: scale(1); |
| 76 } |
| 77 |
| 78 #ink { |
| 79 position: absolute; |
| 80 top: -16px; |
| 81 left: -16px; |
| 82 width: 48px; |
| 83 height: 48px; |
| 84 } |
| 85 |
| 86 </style> |
| 87 |
| 88 <template> |
| 89 <div id="radioContainer"> |
| 90 <div id="offRadio"></div> |
| 91 <div id="onRadio"></div> |
| 92 <paper-ripple id="ink" class="circle" center></paper-ripple> |
| 93 </div> |
| 94 </template> |
| 95 |
| 96 <script> |
| 97 |
| 98 Polymer({ |
| 99 |
| 100 behaviors: [ |
| 101 Polymer.PaperInkyFocusBehavior |
| 102 ], |
| 103 |
| 104 hostAttributes: { |
| 105 role: 'radio' |
| 106 }, |
| 107 |
| 108 ready: function() { |
| 109 this.toggles = true; |
| 110 } |
| 111 |
| 112 }); |
| 113 |
| 114 </script> |
| 115 |
| 116 </dom-module> |
| OLD | NEW |