mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2025-02-19 21:20:40 +03:00
parent
9596517540
commit
f45e39bc1c
|
@ -49,7 +49,13 @@ const BaseSelection = (($) => {
|
||||||
// protected
|
// protected
|
||||||
|
|
||||||
decorateMarkup() {
|
decorateMarkup() {
|
||||||
this.$element.after(this.config.template)
|
const $decorator = $(this.config.template);
|
||||||
|
this.$element.after($decorator)
|
||||||
|
|
||||||
|
// initialize ripples after decorator has been inserted into DOM
|
||||||
|
if (this.config.ripples !== false) {
|
||||||
|
$decorator.bmdRipples()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Demarcation element (e.g. first child of a form-group)
|
// Demarcation element (e.g. first child of a form-group)
|
||||||
|
|
|
@ -18,7 +18,7 @@ const Radio = (($) => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
template: `<span class='bmd-radio-outer-circle'></span><span class='bmd-radio-inner-circle'></span>`
|
template: `<span class='bmd-radio'></span>`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,7 +48,7 @@ const Ripples = (($) => {
|
||||||
constructor($element, config) {
|
constructor($element, config) {
|
||||||
this.$element = $element
|
this.$element = $element
|
||||||
|
|
||||||
//console.log(`Adding ripples to ${Util.describe(this.$element)}`) // eslint-disable-line no-console
|
// console.log(`Adding ripples to ${Util.describe(this.$element)}`) // eslint-disable-line no-console
|
||||||
this.config = $.extend(true, {}, Default, config)
|
this.config = $.extend(true, {}, Default, config)
|
||||||
|
|
||||||
// attach initial listener
|
// attach initial listener
|
||||||
|
|
|
@ -2,28 +2,16 @@
|
||||||
.checkbox label,
|
.checkbox label,
|
||||||
label.checkbox-inline {
|
label.checkbox-inline {
|
||||||
padding-left: $bmd-checkbox-size + $bmd-checkbox-label-padding; // absolutely positioned so add the radio size
|
padding-left: $bmd-checkbox-size + $bmd-checkbox-label-padding; // absolutely positioned so add the radio size
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
.checkbox-decorator {
|
.checkbox-decorator {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0.125rem;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
|
padding: 1em;
|
||||||
|
margin: -1em;
|
||||||
|
line-height: .7;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
cursor: pointer;
|
||||||
&::before { // FIXME: document why this is necessary (doesn't seem to be on chrome)
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
z-index: 1;
|
|
||||||
display: block;
|
|
||||||
width: $bmd-checkbox-size;
|
|
||||||
height: $bmd-checkbox-size;
|
|
||||||
margin: 0;
|
|
||||||
content: "";
|
|
||||||
background-color: rgba($black, .84);
|
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
opacity: 0;
|
|
||||||
transform: scale3d(2.3, 2.3, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.check {
|
.check {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -63,7 +51,6 @@ label.checkbox-inline {
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=checkbox] {
|
input[type=checkbox] {
|
||||||
|
|
||||||
// Hide native checkbox
|
// Hide native checkbox
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
@ -80,7 +67,6 @@ label.checkbox-inline {
|
||||||
}
|
}
|
||||||
|
|
||||||
&:checked {
|
&:checked {
|
||||||
|
|
||||||
// FIXME: once working - combine further to reduce code
|
// FIXME: once working - combine further to reduce code
|
||||||
+ .checkbox-decorator .check {
|
+ .checkbox-decorator .check {
|
||||||
color: $bmd-checkbox-checked-color;
|
color: $bmd-checkbox-checked-color;
|
||||||
|
@ -97,33 +83,6 @@ label.checkbox-inline {
|
||||||
20px -12px 0 11px;
|
20px -12px 0 11px;
|
||||||
animation: checkbox-on $bmd-checkbox-animation-check forwards;
|
animation: checkbox-on $bmd-checkbox-animation-check forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ .checkbox-decorator::before {
|
|
||||||
animation: rippleOn;
|
|
||||||
.is-focused & {
|
|
||||||
// Prevent checkbox animation and ripple effect on page load
|
|
||||||
animation: rippleOn $bmd-checkbox-animation-ripple;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ .checkbox-decorator .check::after {
|
|
||||||
//background-color: $brand-success; // FIXME: seems like tho wrong color, test and make sure it can be removed
|
|
||||||
animation: rippleOn $bmd-checkbox-animation-ripple forwards; // Ripple effect on check
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:not(:checked) {
|
|
||||||
+ .checkbox-decorator::before {
|
|
||||||
animation: rippleOff;
|
|
||||||
.is-focused & {
|
|
||||||
// Prevent checkbox animation and ripple effect on page load
|
|
||||||
animation: rippleOff $bmd-checkbox-animation-ripple;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ .checkbox-decorator .check::after {
|
|
||||||
animation: rippleOff $bmd-checkbox-animation-ripple forwards; // Ripple effect on uncheck
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&[disabled],
|
&[disabled],
|
||||||
|
@ -137,6 +96,10 @@ label.checkbox-inline {
|
||||||
.check {
|
.check {
|
||||||
border-color: $bmd-checkbox-border-color-disabled;
|
border-color: $bmd-checkbox-border-color-disabled;
|
||||||
}
|
}
|
||||||
|
// No ripple on disabled checkboxes
|
||||||
|
+ .checkbox-decorator .ripple-container {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,27 +193,3 @@ label.checkbox-inline {
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rippleOn {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
opacity: 0.2;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes rippleOff {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
opacity: 0.2;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,45 +3,36 @@ label.radio-inline {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-left: $bmd-radio-size + $bmd-radio-label-padding; // absolutely positioned so add the radio size
|
padding-left: $bmd-radio-size + $bmd-radio-label-padding; // absolutely positioned so add the radio size
|
||||||
|
|
||||||
.bmd-radio-outer-circle, // don't use generic span, it may conflict with span in user markup #693
|
.bmd-radio {
|
||||||
.bmd-radio-inner-circle {
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: calc-top($line-height-base, $font-size-base, $bmd-radio-size); // vertical center of line-height
|
|
||||||
left: 0;
|
left: 0;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 1em;
|
||||||
|
margin: -1em;
|
||||||
|
line-height: .7;
|
||||||
|
border-radius: 100%;
|
||||||
|
|
||||||
|
&::after {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: $bmd-radio-size;
|
width: $bmd-radio-size;
|
||||||
height: $bmd-radio-size;
|
height: $bmd-radio-size;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition-duration: 0.2s;
|
content: "";
|
||||||
|
|
||||||
&.bmd-radio-outer-circle {
|
|
||||||
border: $bmd-radio-border solid $bmd-radio-color-off;
|
border: $bmd-radio-border solid $bmd-radio-color-off;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
transition: border-color ease .28s;
|
transition: border-color ease .28s;
|
||||||
|
transition-duration: 0.2s;
|
||||||
}
|
}
|
||||||
&.bmd-radio-inner-circle {
|
&::before {
|
||||||
|
position: absolute;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
width: $bmd-radio-size;
|
||||||
|
height: $bmd-radio-size;
|
||||||
|
content: "";
|
||||||
background-color: $bmd-radio-color-on;
|
background-color: $bmd-radio-color-on;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
transition: transform ease .28s;
|
transition: transform ease .28s;
|
||||||
transform: scale3d(0, 0, 0);
|
transform: scale3d(0, 0, 0);
|
||||||
|
|
||||||
// focus/press ripple
|
|
||||||
&::after {
|
|
||||||
position: absolute;
|
|
||||||
top: -#{$bmd-radio-ripple-offset};
|
|
||||||
left: -#{$bmd-radio-ripple-offset};
|
|
||||||
z-index: 1;
|
|
||||||
display: block;
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
margin: 0;
|
|
||||||
content: "";
|
|
||||||
background-color: $gray-dark;
|
|
||||||
border-radius: 100%;
|
|
||||||
opacity: 0;
|
|
||||||
transform: scale3d(1.5, 1.5, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,63 +48,30 @@ label.radio-inline {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
&:checked {
|
&:checked ~ .bmd-radio {
|
||||||
@include bmd-radio-color($bmd-radio-color-on);
|
@include bmd-radio-color($bmd-radio-color-on);
|
||||||
|
|
||||||
~ .bmd-radio-inner-circle {
|
&::before {
|
||||||
transform: scale3d(0.55, 0.55, 1);
|
transform: scale3d(0.55, 0.55, 1);
|
||||||
&::after {
|
|
||||||
animation: rippleOn;
|
|
||||||
|
|
||||||
.is-focused & {
|
|
||||||
// Prevent ripple effect on page load
|
|
||||||
animation: rippleOn 500ms;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:not(:checked) ~ .bmd-radio-inner-circle::after {
|
|
||||||
animation: rippleOff 500ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
&[disabled],
|
&[disabled],
|
||||||
&:disabled,
|
&:disabled,
|
||||||
fieldset[disabled] & {
|
fieldset[disabled] & {
|
||||||
|
+ .bmd-radio {
|
||||||
+ .bmd-radio-outer-circle {
|
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
@include bmd-radio-color($bmd-radio-color-disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@include bmd-radio-color($bmd-radio-color-disabled);
|
// No ripple on disabled radios
|
||||||
|
+ .bmd-radio .ripple-container {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.bg-inverse & {
|
.bg-inverse & + .bmd-radio {
|
||||||
@include bmd-radio-color($bmd-radio-color-disabled-inverse);
|
@include bmd-radio-color($bmd-radio-color-disabled-inverse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rippleOn {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
opacity: 0.2;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes rippleOff {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
opacity: 0.2;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// Support for SnackbarJS plugin
|
// Support for SnackbarJS plugin
|
||||||
// https://github.com/FezVrasta/snackbarjs
|
// https://github.com/FezVrasta/snackbarjs
|
||||||
|
|
||||||
|
// scss-lint:disable IdSelector
|
||||||
|
|
||||||
#snackbar-container {
|
#snackbar-container {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
|
@ -53,14 +53,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin bmd-radio-color($color) {
|
@mixin bmd-radio-color($color) {
|
||||||
|
&::after {
|
||||||
~ .bmd-radio-inner-circle {
|
|
||||||
background-color: $color;
|
|
||||||
}
|
|
||||||
|
|
||||||
~ .bmd-radio-outer-circle {
|
|
||||||
border-color: $color;
|
border-color: $color;
|
||||||
}
|
}
|
||||||
|
&::before {
|
||||||
|
background-color: $color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin bmd-form-color($label-color, $label-color-focus, $border-color) {
|
@mixin bmd-form-color($label-color, $label-color-focus, $border-color) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user