mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
91 lines
2.3 KiB
SCSS
91 lines
2.3 KiB
SCSS
@import "../../../globals.md";
|
|
|
|
// Material Design Checkbox
|
|
// --------------------------------------------------
|
|
|
|
$checkbox-md-icon-size: 16px !default;
|
|
$checkbox-md-background-color-off: $list-md-background-color !default;
|
|
$checkbox-md-border-width: 2px !default;
|
|
$checkbox-md-border-radius: 2px !default;
|
|
$checkbox-md-border-color-off: darken($list-md-border-color, 40%) !default;
|
|
$checkbox-md-background-color-on: map-get($colors-md, primary) !default;
|
|
$checkbox-md-border-color-on: map-get($colors-md, primary) !default;
|
|
$checkbox-md-checkmark-color-on: $background-md-color !default;
|
|
|
|
|
|
ion-checkbox {
|
|
cursor: pointer;
|
|
@include user-select-none();
|
|
|
|
&.item .item-inner {
|
|
border: none;
|
|
padding-right: 0;
|
|
}
|
|
|
|
ion-item-content {
|
|
border-bottom: 1px solid $list-md-border-color;
|
|
margin: 0;
|
|
padding: $item-md-padding-top ($item-md-padding-right / 2) $item-md-padding-bottom 0;
|
|
}
|
|
|
|
&[aria-checked=true] .checkbox-icon {
|
|
background-color: $checkbox-md-background-color-on;
|
|
border-color: $checkbox-md-border-color-on;
|
|
}
|
|
|
|
&[aria-checked=true] .checkbox-icon:after {
|
|
position: absolute;
|
|
border: 2px solid $checkbox-md-checkmark-color-on;
|
|
top: 0;
|
|
left: 3px;
|
|
width: 4px;
|
|
height: 9px;
|
|
border-left: none;
|
|
border-top: none;
|
|
content: '';
|
|
transform: rotate(45deg);
|
|
}
|
|
|
|
}
|
|
|
|
ion-checkbox[aria-disabled=true] {
|
|
opacity: 0.5;
|
|
color: $subdued-text-md-color;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.media-checkbox {
|
|
// TODO convert these to sass variables
|
|
margin: $item-md-padding-media-top 36px $item-md-padding-media-bottom 4px;
|
|
}
|
|
|
|
.checkbox-icon {
|
|
position: relative;
|
|
width: $checkbox-md-icon-size;
|
|
height: $checkbox-md-icon-size;
|
|
border-radius: $checkbox-md-border-radius;
|
|
border: $checkbox-md-border-width solid $checkbox-md-border-color-off;
|
|
background-color: $checkbox-md-background-color-off;
|
|
}
|
|
|
|
|
|
// Material Design Checkbox Color Mixin
|
|
// --------------------------------------------------
|
|
|
|
@mixin checkbox-theme-md($color-name, $bg-on) {
|
|
|
|
ion-checkbox[#{$color-name}][aria-checked=true] .checkbox-icon {
|
|
background-color: $bg-on;
|
|
border-color: $bg-on;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
// Generate Material Design Checkbox Colors
|
|
// --------------------------------------------------
|
|
|
|
@each $color-name, $color-value in $colors-md {
|
|
@include checkbox-theme-md($color-name, $color-value);
|
|
}
|