radio.md.scss 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. @import "../../themes/ionic.globals.md";
  2. // Material Design Radio
  3. // --------------------------------------------------
  4. /// @prop - Color of the checked radio
  5. $radio-md-color-on: color($colors-md, primary) !default;
  6. /// @prop - Color of the unchecked radio
  7. $radio-md-color-off: darken($list-md-border-color, 40%) !default;
  8. /// @prop - Width of the radio icon
  9. $radio-md-icon-width: 16px !default;
  10. /// @prop - Height of the radio icon
  11. $radio-md-icon-height: 16px !default;
  12. /// @prop - Border width of the radio icon
  13. $radio-md-icon-border-width: 2px !default;
  14. /// @prop - Border style of the radio icon
  15. $radio-md-icon-border-style: solid !default;
  16. /// @prop - Border radius of the radio icon
  17. $radio-md-icon-border-radius: 50% !default;
  18. /// @prop - Transition duration of the radio
  19. $radio-md-transition-duration: 280ms !default;
  20. /// @prop - Transition easing of the radio
  21. $radio-md-transition-easing: cubic-bezier(.4, 0, .2, 1) !default;
  22. /// @prop - Opacity of the disabled radio
  23. $radio-md-disabled-opacity: .3 !default;
  24. // deprecated
  25. $radio-md-item-left-margin: null !default;
  26. /// @prop - Margin top of the item-start in a radio
  27. $radio-md-item-start-margin-top: 11px !default;
  28. /// @prop - Margin end of the item-start in a radio
  29. $radio-md-item-start-margin-end: 36px !default;
  30. /// @prop - Margin bottom of the item-start in a radio
  31. $radio-md-item-start-margin-bottom: 10px !default;
  32. /// @prop - Margin start of the item-start in a radio
  33. $radio-md-item-start-margin-start: 4px !default;
  34. // deprecated
  35. $radio-md-item-right-margin: null !default;
  36. /// @prop - Margin top of the item-end in a radio
  37. $radio-md-item-end-margin-top: $item-md-padding-media-top !default;
  38. /// @prop - Margin end of the item-end in a radio
  39. $radio-md-item-end-margin-end: 10px !default;
  40. /// @prop - Margin bottom of the item-end in a radio
  41. $radio-md-item-end-margin-bottom: $item-md-padding-media-bottom !default;
  42. /// @prop - Margin start of the item-end in a radio
  43. $radio-md-item-end-margin-start: 0 !default;
  44. .radio-md {
  45. position: relative;
  46. display: inline-block;
  47. }
  48. // Material Design Radio Outer Circle: Unchecked
  49. // -----------------------------------------
  50. .radio-md .radio-icon {
  51. @include position(0, null, null, 0);
  52. @include margin(0);
  53. @include border-radius($radio-md-icon-border-radius);
  54. position: relative;
  55. display: block;
  56. width: $radio-md-icon-width;
  57. height: $radio-md-icon-height;
  58. border-width: $radio-md-icon-border-width;
  59. border-style: $radio-md-icon-border-style;
  60. border-color: $radio-md-color-off;
  61. }
  62. // Material Design Radio Inner Circle: Unchecked
  63. // -----------------------------------------
  64. .radio-md .radio-inner {
  65. @include position($radio-md-icon-border-width, null, null, $radio-md-icon-border-width);
  66. @include border-radius(50%);
  67. position: absolute;
  68. width: $radio-md-icon-width - $radio-md-icon-border-width * 4;
  69. height: $radio-md-icon-height - $radio-md-icon-border-width * 4;
  70. background-color: $radio-md-color-on;
  71. transform: scale3d(0, 0, 0);
  72. transition: transform $radio-md-transition-duration $radio-md-transition-easing;
  73. }
  74. // Material Design Radio Outer Circle: Checked
  75. // -----------------------------------------
  76. .radio-md .radio-checked {
  77. border-color: $radio-md-color-on;
  78. }
  79. // Material Design Radio Inner Circle: Checked
  80. // -----------------------------------------
  81. .radio-md .radio-checked .radio-inner {
  82. transform: scale3d(1, 1, 1);
  83. }
  84. // Material Design Radio: Disabled
  85. // -----------------------------------------
  86. .radio-md.radio-disabled,
  87. .item-md.item-radio-disabled ion-label {
  88. opacity: $radio-md-disabled-opacity;
  89. pointer-events: none;
  90. }
  91. // Material Design Radio Within An Item
  92. // -----------------------------------------
  93. .item-md .radio-md {
  94. position: static;
  95. display: block;
  96. @include deprecated-variable(margin, $radio-md-item-right-margin) {
  97. @include margin($radio-md-item-end-margin-top, $radio-md-item-end-margin-end, $radio-md-item-end-margin-bottom, $radio-md-item-end-margin-start);
  98. }
  99. &[item-left], // deprecated
  100. &[item-start] {
  101. @include deprecated-variable(margin, $radio-md-item-left-margin) {
  102. @include margin($radio-md-item-start-margin-top, $radio-md-item-start-margin-end, $radio-md-item-start-margin-bottom, $radio-md-item-start-margin-start);
  103. }
  104. }
  105. }
  106. .item-radio.item-md ion-label {
  107. @include margin-horizontal(0, null);
  108. }
  109. // Material Design Radio Item Label: Checked
  110. // -----------------------------------------
  111. .item-radio-checked.item-md ion-label {
  112. color: $radio-md-color-on;
  113. }
  114. // Material Design Radio Color Mixin
  115. // --------------------------------------------------
  116. @mixin radio-theme-md($color-name, $color-base, $color-contrast) {
  117. .item-radio-md-#{$color-name}.item-radio-checked ion-label {
  118. color: $color-base;
  119. }
  120. .radio-md-#{$color-name} .radio-checked {
  121. border-color: $color-base;
  122. }
  123. .radio-md-#{$color-name} .radio-inner {
  124. background-color: $color-base;
  125. }
  126. }
  127. // Generate Material Design Radio Colors
  128. // --------------------------------------------------
  129. @each $color-name, $color-base, $color-contrast in get-colors($colors-md) {
  130. @include radio-theme-md($color-name, $color-base, $color-contrast);
  131. }