radio.scss 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /**Variable**/
  2. @import './helpers/mixin.scss';
  3. @import './base/common.scss';
  4. @import './base/checked.scss';
  5. /*radio-group*/
  6. .vxe-radio-group {
  7. display: inline-block;
  8. vertical-align: middle;
  9. line-height: 1;
  10. font-size: 0;
  11. &+.vxe-radio-group {
  12. margin-left: 10px;
  13. }
  14. }
  15. /*radio*/
  16. .vxe-radio {
  17. @extend %XERadioIcon;
  18. display: inline-block;
  19. vertical-align: middle;
  20. white-space: nowrap;
  21. line-height: 1;
  22. > input {
  23. &[type="radio"] {
  24. position: absolute;
  25. width: 0;
  26. height: 0;
  27. border: 0;
  28. appearance: none;
  29. }
  30. }
  31. .vxe-radio--label {
  32. vertical-align: middle;
  33. display: inline-block;
  34. max-width: 50em;
  35. @extend %TextEllipsis;
  36. }
  37. &:not(.is--disabled) {
  38. > input {
  39. &:focus+.vxe-radio--icon {
  40. color: $vxe-primary-color;
  41. }
  42. }
  43. }
  44. &:not(.vxe-radio-button) {
  45. &+.vxe-radio {
  46. margin-left: 10px;
  47. }
  48. }
  49. }
  50. .vxe-radio-button {
  51. .vxe-radio--label {
  52. background-color: $vxe-radio-button-default-background-color;
  53. }
  54. &:first-child {
  55. .vxe-radio--label {
  56. border-left: 1px solid $vxe-input-border-color;
  57. border-radius: $vxe-border-radius 0 0 $vxe-border-radius;
  58. }
  59. }
  60. &:last-child {
  61. .vxe-radio--label {
  62. border-radius: 0 $vxe-border-radius $vxe-border-radius 0;
  63. }
  64. }
  65. > input {
  66. &:checked+.vxe-radio--label {
  67. color: #fff;
  68. background-color: $vxe-primary-color;
  69. border-color: $vxe-primary-color;
  70. }
  71. }
  72. .vxe-radio--label {
  73. padding: 0 1em;
  74. line-height: $vxe-button-height-default - 2;
  75. display: inline-block;
  76. border-style: solid;
  77. border-color: $vxe-input-border-color;
  78. border-width: 1px 1px 1px 0;
  79. max-width: 50em;
  80. @extend %TextEllipsis;
  81. }
  82. &.is--disabled {
  83. cursor: not-allowed;
  84. > input {
  85. &:not(:checked) {
  86. &+.vxe-radio--label {
  87. color: $vxe-input-disabled-color;
  88. }
  89. }
  90. &:checked {
  91. &+.vxe-radio--label {
  92. border-color: lighten($vxe-primary-color, 20%);
  93. background-color: lighten($vxe-primary-color, 20%);
  94. }
  95. }
  96. }
  97. }
  98. &:not(.is--disabled) {
  99. & > input {
  100. &:focus {
  101. &+.vxe-radio--label {
  102. border-color: $vxe-primary-color;
  103. box-shadow: 0 0 0.2em 0 $vxe-primary-color;
  104. }
  105. }
  106. }
  107. &:hover {
  108. > input {
  109. &:not(:checked) {
  110. &+.vxe-radio--label {
  111. color: $vxe-primary-color;
  112. }
  113. }
  114. }
  115. }
  116. }
  117. &.size--medium {
  118. .vxe-radio--label {
  119. line-height: $vxe-button-height-medium - 2;
  120. }
  121. }
  122. &.size--small {
  123. .vxe-radio--label {
  124. line-height: $vxe-button-height-small - 2;
  125. }
  126. }
  127. &.size--mini {
  128. .vxe-radio--label {
  129. line-height: $vxe-button-height-mini - 2;
  130. }
  131. }
  132. }
  133. .vxe-radio {
  134. font-size: $vxe-font-size;
  135. &.size--medium {
  136. font-size: $vxe-font-size-medium;
  137. }
  138. &.size--small {
  139. font-size: $vxe-font-size-small;
  140. }
  141. &.size--mini {
  142. font-size: $vxe-font-size-mini;
  143. }
  144. }