|
| 1 | +@import "default-theme"; |
| 2 | + |
| 3 | +$md-radio-width: 20px !default; |
| 4 | + |
| 5 | +// Top-level host container. |
| 6 | +md-radio-button { |
| 7 | + display: inline-block; |
| 8 | +} |
| 9 | + |
| 10 | +// Inner label container, wrapping entire element. |
| 11 | +// Enables focus by click. |
| 12 | +.md-radio-label { |
| 13 | + cursor: pointer; |
| 14 | + display: block; |
| 15 | + padding: 8px; |
| 16 | + white-space: nowrap; |
| 17 | +} |
| 18 | + |
| 19 | +// Container for radio circles and ripple. |
| 20 | +.md-radio-container { |
| 21 | + box-sizing: border-box; |
| 22 | + display: inline-block; |
| 23 | + height: $md-radio-width; |
| 24 | + position: relative; |
| 25 | + top: 2px; |
| 26 | + width: $md-radio-width; |
| 27 | +} |
| 28 | + |
| 29 | +// TODO(mtlin): Replace when ink ripple component is implemented. |
| 30 | +// A placeholder ink ripple, shown when keyboard focused. |
| 31 | +.md-ink-ripple { |
| 32 | + background-color: md-color($md-accent); |
| 33 | + border-radius: 50%; |
| 34 | + height: 48px; |
| 35 | + left: 10px; |
| 36 | + opacity: 0; |
| 37 | + pointer-events: none; |
| 38 | + position: absolute; |
| 39 | + top: 10px; |
| 40 | + transform: translate(-50%,-50%); |
| 41 | + transition: opacity ease 0.28s, background-color ease 0.28s; |
| 42 | + width: 48px; |
| 43 | + overflow: hidden; |
| 44 | + |
| 45 | + // Fade in when radio focused. |
| 46 | + .md-radio-focused & { |
| 47 | + opacity: 0.1; |
| 48 | + } |
| 49 | + |
| 50 | + // TODO(mtlin): This corresponds to disabled focus state, but it's unclear how to enter into |
| 51 | + // this state. |
| 52 | + .md-radio-disabled & { |
| 53 | + background: #000; |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +// The outer circle for the radio, always present. |
| 58 | +.md-radio-outer-circle { |
| 59 | + border-color: md-color($md-foreground, secondary-text); |
| 60 | + border: solid 2px; |
| 61 | + border-radius: 50%; |
| 62 | + box-sizing: border-box; |
| 63 | + height: $md-radio-width; |
| 64 | + left: 0; |
| 65 | + position: absolute; |
| 66 | + top: 0; |
| 67 | + transition: border-color ease 0.28s; |
| 68 | + width: $md-radio-width; |
| 69 | + |
| 70 | + .md-radio-checked & { |
| 71 | + border-color: md-color($md-accent); |
| 72 | + } |
| 73 | + |
| 74 | + .md-radio-disabled & { |
| 75 | + border-color: md-color($md-foreground, disabled); |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +// The inner circle for the radio, shown when checked. |
| 80 | +.md-radio-inner-circle { |
| 81 | + background-color: md-color($md-accent); |
| 82 | + border-radius: 50%; |
| 83 | + box-sizing: border-box; |
| 84 | + height: $md-radio-width; |
| 85 | + left: 0; |
| 86 | + position: absolute; |
| 87 | + top: 0; |
| 88 | + transition: transform ease 0.28s, background-color ease 0.28s; |
| 89 | + transform: scale(0); |
| 90 | + width: $md-radio-width; |
| 91 | + |
| 92 | + .md-radio-checked & { |
| 93 | + transform: scale(0.5); |
| 94 | + } |
| 95 | + |
| 96 | + .md-radio-disabled & { |
| 97 | + background-color: md-color($md-foreground, disabled); |
| 98 | + } |
| 99 | +} |
| 100 | + |
| 101 | +// Text label next to radio. |
| 102 | +.md-radio-label-content { |
| 103 | + display: inline-block; |
| 104 | + float: right; |
| 105 | + line-height: 24px; |
| 106 | + // Equal padding on both sides, for RTL. |
| 107 | + padding-left: 8px; |
| 108 | + padding-right: 8px; |
| 109 | + position: relative; |
| 110 | + vertical-align: top; |
| 111 | +} |
| 112 | + |
| 113 | +// Underlying native input element. |
| 114 | +// Visually hidden but still able to respond to focus. |
| 115 | +.md-radio-input { |
| 116 | + position: absolute; |
| 117 | + width: 0; |
| 118 | + height: 0; |
| 119 | + margin: 0; |
| 120 | + padding: 0; |
| 121 | + opacity: 0; |
| 122 | + appearance: none; |
| 123 | + border: none; |
| 124 | +} |
| 125 | + |
| 126 | +// Basic disabled state. |
| 127 | +.md-radio-disabled, .md-radio-disabled .md-radio-label { |
| 128 | + cursor: default; |
| 129 | +} |
0 commit comments