|
| 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.github.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/CONTRIBUTORS.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/PATENTS.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-radio-button-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" recenters></paper-ripple> |
| 93 | + </div> |
| 94 | + </template> |
| 95 | + |
| 96 | + <script> |
| 97 | + |
| 98 | + Polymer({ |
| 99 | + |
| 100 | + behaviors: [ |
| 101 | + Polymer.PaperRadioButtonBehavior |
| 102 | + ], |
| 103 | + |
| 104 | + ready: function() { |
| 105 | + this.toggles = true; |
| 106 | + } |
| 107 | + |
| 108 | + }); |
| 109 | + |
| 110 | + </script> |
| 111 | + |
| 112 | +</dom-module> |
0 commit comments