diff --git a/build/scss/AdminLTE-raw.scss b/build/scss/AdminLTE-raw.scss index 1a7f539247bace39ef9f94215d1298c99bb6ecd6..34abdda2077646dad44672ff153bebed92a64dc3 100644 --- a/build/scss/AdminLTE-raw.scss +++ b/build/scss/AdminLTE-raw.scss @@ -63,6 +63,7 @@ // Plugins // --------------------------------------------------- +@import 'plugins/mixins'; @import 'plugins/fullcalendar'; @import 'plugins/select2'; @import 'plugins/bootstrap-slider'; diff --git a/build/scss/AdminLTE.scss b/build/scss/AdminLTE.scss index cc08a3d7ddad7d34206e3e42bae47e01301d26d0..61ca188a81ea2f5d9e67326e3b933515b64a7e51 100644 --- a/build/scss/AdminLTE.scss +++ b/build/scss/AdminLTE.scss @@ -59,6 +59,7 @@ // Plugins // --------------------------------------------------- +@import 'plugins/mixins'; @import 'plugins/fullcalendar'; @import 'plugins/select2'; @import 'plugins/bootstrap-slider'; diff --git a/build/scss/plugins/_mixins.scss b/build/scss/plugins/_mixins.scss new file mode 100644 index 0000000000000000000000000000000000000000..faf66e860f18071a4194f3f2be8d43b16952ef37 --- /dev/null +++ b/build/scss/plugins/_mixins.scss @@ -0,0 +1,64 @@ +// +// General: Mixins +// + +// Select2 Variant +@mixin select2-variant($name, $color) { + .select2-#{$name} { + + .select2-container--default &, + .select2-container--default { + &.select2-dropdown, + .select2-dropdown, + .select2-search--inline { + .select2-search__field { + &:focus { + border: $input-border-width solid lighten($color, 25%); + } + } + } + + .select2-results__option--highlighted { + background-color: $color; + color: color-yiq($color); + + &[aria-selected] { + &, + &:hover { + background-color: darken($color, 3%); + color: color-yiq(darken($color, 3%)); + } + } + } + + //Multiple select + & { + .select2-selection--multiple { + &:focus { + border-color: lighten($color, 25%); + } + } + + &.select2-container--focus .select2-selection--multiple { + border-color: lighten($color, 25%); + } + } + + .select2-selection--multiple { + .select2-selection__choice { + background-color: $color; + border-color: darken($color, 5%); + color: color-yiq($color); + } + + .select2-selection__choice__remove { + color: rgba(color-yiq($color), 0.7); + + &:hover { + color: color-yiq($color); + } + } + } + } + } +} diff --git a/build/scss/plugins/_select2.scss b/build/scss/plugins/_select2.scss index 4b9a850a90cb963eb89bcefe2bee27d7f3d295d7..eedd70465172dff4a5e5a0977deef3aa201bc8dd 100644 --- a/build/scss/plugins/_select2.scss +++ b/build/scss/plugins/_select2.scss @@ -3,36 +3,32 @@ // //Signle select -.select2-container--default, -.select2-selection { - &.select2-container--focus, - &:focus, - &:active { - outline: none; - } +// .select2-container--default, +// .select2-selection { +// &.select2-container--focus, +// &:focus, +// &:active { +// outline: none; +// } +// } + +.select2-container--default { .select2-selection--single { - border: 1px solid $gray-x-light; + border: $input-border-width solid $input-border-color; //border-radius: $input-radius; padding: 6px 12px; height: $input-height; } -} -.select2-container--default { &.select2-container--open { - border-color: theme-color("primary"); + border-color: $primary; } & .select2-dropdown { - border: 1px solid $gray-x-light; + border: $input-border-width solid $input-border-color; //border-radius: $input-radius; } - & .select2-results__option--highlighted[aria-selected] { - background-color: theme-color("primary"); - color: white; - } - & .select2-results__option { padding: 6px 12px; user-select: none; @@ -63,66 +59,130 @@ .select2-dropdown, .select2-search--inline { .select2-search__field { - border: 1px solid $gray-x-light; + border: $input-border-width solid $input-border-color; + &:focus { outline: none; - border: 1px solid theme-color("primary"); + border: $input-border-width solid $input-focus-border-color; } } } - & .select2-results__option[aria-disabled=true] { - color: #999; + .select2-dropdown { + &.select2-dropdown--below { + border-top: 0; + } + + &.select2-dropdown--above { + border-bottom: 0; + } + } + + .select2-results__option { + &[aria-disabled='true'] { + color: $gray-600; + } + + &[aria-selected='true'] { + $color: $gray-300; + + background-color: $color; + + &, + &:hover { + color: color-yiq($color); + } + } } - & .select2-results__option[aria-selected=true] { - background-color: #ddd; - &, - &:hover { - color: #444; + .select2-results__option--highlighted { + $color: $primary; + background-color: $color; + color: color-yiq($color); + + &[aria-selected] { + $color: darken($color, 3%); + + &, + &:hover { + background-color: $color; + color: color-yiq($color); + } } } //Multiple select & { .select2-selection--multiple { - min-height: $input-height; - border: 1px solid $gray-x-light; - //border-radius: $input-radius; + border: $input-border-width solid $input-border-color; + height: $input-height; + &:focus { - border-color: theme-color("primary"); + border-color: $input-focus-border-color; } - .select2-selection__rendered li:first-child.select2-search.select2-search--inline { - width: 100%; + .select2-selection__rendered { + padding: 0 $input-padding-y; + + li:first-child.select2-search.select2-search--inline { + width: 100%; - .select2-search__field { - width: 100% !important; + .select2-search__field { + width: 100% !important; + } + } + + + .select2-search.select2-search--inline { + .select2-search__field { + border: 0; + margin-top: 6px; + } } } } + &.select2-container--focus .select2-selection--multiple { - border-color: $gray-x-light; + border-color: $input-focus-border-color; + + .select2-search__field { + border: 0; + } } } - & .select2-selection--multiple .select2-selection__choice { - background-color: theme-color("primary"); - border-color: darken(theme-color("primary"), 5%); - padding: 0 10px; - color: $white; - } + .select2-selection--multiple { + .select2-selection__choice { + background-color: $primary; + border-color: darken($primary, 5%); + color: color-yiq($primary); + padding: 0 10px; + } - & .select2-selection--multiple .select2-selection__choice__remove { - margin-right: 5px; - color: rgba(255, 255, 255, 0.7); - &:hover { - color: $white; + .select2-selection__choice__remove { + color: rgba(255, 255, 255, 0.7); + float: right; + margin-left: 5px; + margin-right: -2px; + + &:hover { + color: $white; + } } } & .select2-selection--single .select2-selection__rendered li { padding-right: 10px; } +} + + +// Background colors (theme colors) +@each $name, $color in $theme-colors { + @include select2-variant($name, $color); +} +// Background colors (colors) +@each $name, $color in $colors { + @include select2-variant($name, $color); } diff --git a/pages/forms/advanced.html b/pages/forms/advanced.html index e811638561960e3e245a1bbf229a1b76847018d0..d5d50231ee218f3195ddfa3ef3ed4c7e6e15a047 100644 --- a/pages/forms/advanced.html +++ b/pages/forms/advanced.html @@ -714,7 +714,7 @@
-

Select2

+

Select2 (Default Theme)

@@ -756,8 +756,7 @@
- @@ -785,6 +784,128 @@
+ +
Custom Color Variants
+
+
+
+ + +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+ + +
+ + + +
+
+

Select2 (Bootstrap4 Theme)

+ +
+ + +
+
+ +
+
+
+
+ + +
+ +
+ + +
+ +
+ +
+
+ + +
+ +
+ + +
+ +
+ +
+