_form-adv-checkbox.scss 2.41 KB
.checkbox-adv {
	font-size: $font-size;
	line-height: $line-height;
	[class^="circle"] {
		display: block;
		height: $font-size;
		position: absolute;
			top: (($line-height - $font-size) / 2 - 1);
			left: 0;
		width: $font-size;
	}
	.circle {
		border: 2px solid $black-sec;
		@include transition(border-color 0.3s $timing);
	}
	&.disabled,
	fieldset[disabled] & {
		.circle {
			border-color: $black-hint !important;
		}
	}
	input.access-hide:focus ~ .circle {
		border-color: $black-text;
	}
	input.access-hide:checked ~ .circle {
		border-color: $brand-color;
	}
	.circle-check {
		background-color: transparent;
		@include transform(scale(0));
		@include transition(all 0.3s $timing);
		-webkit-transition-property: background-color, -webkit-transform;
		        transition-property: background-color, transform;
		&:after {
			background-color: $brand-color;
			border-radius: 50%;
			content: "";
			display: block;
			height: ($font-size * 5);
			position: absolute;
				top: ($font-size * -2);
				left: ($font-size * -2);
			width: ($font-size * 5);
			@include opacity(0);
		}
	}
	&.disabled,
	fieldset[disabled] & {
		.circle-check:after {
			background-color: $black-hint;
		}
	}
	input.access-hide:checked ~ .circle-check {
		@include transform(scale(0.5));
		&:after {
			@include animation(circle-check 0.6s);
		}
	}
	.circle-icon {
		background-color: transparent;
		color: transparent;
		@include transform(scale(0.5));
		@include transition(all 0.3s $timing);
		-webkit-transition-property: background-color, color, -webkit-transform;
		        transition-property: background-color, color, transform;
		&:before {
			// position
				top: auto;
		}
	}
	input.access-hide:checked ~ .circle-icon {
		background-color: $brand-color;
		color: $white;
		@include transform(scale(1));
	}
	&.disabled,
	fieldset[disabled] & {
		input.access-hide:checked ~ .circle-icon {
			background-color: $black-hint;
		}
	}
}

.radio-adv {
	@extend .checkbox-adv;
	[class^="circle"] {
		border-radius: 50%;
	}
	input.access-hide:checked ~ .circle-check {
		background-color: $brand-color;
	}
	&.disabled,
	fieldset[disabled] & {
		input.access-hide:checked ~ .circle-check {
			background-color: $black-hint;
		}
	}
}

// animation
	@-webkit-keyframes circle-check {
		0% {
			opacity: 0;
		}
		25% {
			opacity: 0.25;
		}
		100% {
			opacity: 0;
		}
	}

	@keyframes circle-check {
		0% {
			opacity: 0;
		}
		25% {
			opacity: 0.25;
		}
		100% {
			opacity: 0;
		}
	}