checkbox.md.scss 6.1KB

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