|
| 1 | +// Switch |
| 2 | + |
| 3 | +.k-switch { |
| 4 | + border-radius: @switch-border-radius; |
| 5 | + cursor: pointer; |
| 6 | + width: @switch-size; |
| 7 | + background: none; |
| 8 | + border: 0; |
| 9 | + outline: 0; |
| 10 | + box-shadow: none; |
| 11 | + display: inline-flex; |
| 12 | + overflow: hidden; |
| 13 | + vertical-align: middle; |
| 14 | + font-size: @switch-font-size; |
| 15 | + user-select: none; |
| 16 | + text-align: left; |
| 17 | + |
| 18 | + [type='checkbox'] { |
| 19 | + display: none; |
| 20 | + } |
| 21 | +} |
| 22 | + |
| 23 | +.k-switch, |
| 24 | +.k-switch-container, |
| 25 | +.k-switch-handle { |
| 26 | + box-sizing: border-box; |
| 27 | +} |
| 28 | + |
| 29 | +.k-switch-container { |
| 30 | + border-radius: @switch-border-radius; |
| 31 | + padding: @switch-container-padding-y @switch-container-padding-x; |
| 32 | + border-width: @switch-container-border-width; |
| 33 | + border-style: solid; |
| 34 | + flex: 1 0 auto; |
| 35 | + position: relative; |
| 36 | + outline: 0; |
| 37 | + transition: background-color 200ms ease-out 0s; |
| 38 | +} |
| 39 | + |
| 40 | +.k-switch-handle { |
| 41 | + border-radius: @switch-handle-border-radius; |
| 42 | + width: @switch-handle-size; |
| 43 | + height: @switch-handle-size; |
| 44 | + border-width: @switch-handle-border-width; |
| 45 | + border-style: solid; |
| 46 | + background-position: 50%; |
| 47 | + display: inline-block; |
| 48 | + vertical-align: middle; |
| 49 | + position: relative; |
| 50 | + left: 0; |
| 51 | + transition: left 200ms ease-out 0s; |
| 52 | + |
| 53 | + .k-ie11 & { |
| 54 | + display: block; |
| 55 | + } |
| 56 | +} |
| 57 | + |
| 58 | +.k-switch-on .k-switch-handle { |
| 59 | + left: @switch-on-left-x; |
| 60 | + |
| 61 | + .k-ie &, |
| 62 | + .k-edge & { |
| 63 | + left: 100%; |
| 64 | + margin-left: -@switch-handle-size; |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +.k-switch-off .k-switch-handle { |
| 69 | + left: 0; |
| 70 | +} |
| 71 | + |
| 72 | +.k-switch-label-on, |
| 73 | +.k-switch-label-off { |
| 74 | + display: @switch-label-display; |
| 75 | + width: @switch-label-width; |
| 76 | + position: absolute; |
| 77 | + top: 50%; |
| 78 | + transform: translateY(-50%); |
| 79 | + text-shadow: none; |
| 80 | + line-height: @switch-handle-size; |
| 81 | + overflow: hidden; |
| 82 | +} |
| 83 | + |
| 84 | +.k-switch-label-on { |
| 85 | + text-align: left; |
| 86 | + left: @switch-label-position; |
| 87 | +} |
| 88 | + |
| 89 | +.k-switch-label-off { |
| 90 | + text-align: right; |
| 91 | + right: @switch-label-position; |
| 92 | +} |
| 93 | + |
| 94 | +.k-switch when not (@switch-track-size = null) { |
| 95 | + overflow: visible; |
| 96 | + |
| 97 | + .k-switch-container { |
| 98 | + height: @switch-track-size; |
| 99 | + } |
| 100 | + |
| 101 | + .k-switch-handle { |
| 102 | + top: calc((@switch-track-size - @switch-handle-size - @switch-container-border-width * 2) * .5); |
| 103 | + } |
| 104 | +} |
| 105 | + |
| 106 | +.k-rtl .k-switch, |
| 107 | +.k-switch[dir = "rtl"] { |
| 108 | + &.k-switch-on .k-switch-handle { |
| 109 | + left: 0; |
| 110 | + } |
| 111 | + |
| 112 | + &.k-switch-off .k-switch-handle { |
| 113 | + left: @switch-on-left-x; |
| 114 | + } |
| 115 | + .k-switch-label-on { |
| 116 | + text-align: right; |
| 117 | + left: initial; |
| 118 | + right: @switch-label-position; |
| 119 | + } |
| 120 | + .k-switch-label-off { |
| 121 | + text-align: left; |
| 122 | + left: @switch-label-position; |
| 123 | + right: initial; |
| 124 | + } |
| 125 | +} |
0 commit comments