checkbox.ios.scss 5.3KB

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