Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
5 lars 1
/*! Select2 Bootstrap Theme v0.1.0-beta.4 | MIT License | github.com/select2/select2-bootstrap-theme */
2
 
3
//
4
// Variables
5
// --------------------------------------------------
6
 
7
@import "../../../../../sass/global/variables";
8
 
9
// Bootstrap defaults not available as pre-defined variables
10
// These should not be overridden.
11
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_forms.scss#L127
12
 
13
$form-control-default-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
14
 
15
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/mixins/_forms.scss#L43
16
$form-control-focus-box-shadow: $form-control-default-box-shadow, 0 0 8px rgba($input-border-focus, 0.6);
17
 
18
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_forms.scss#L128
19
$form-control-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
20
 
21
// Custom variables
22
// -------------------------
23
 
24
$dropdown-arrow-color: $input-color-placeholder !default;
25
$dropdown-box-shadow: 0 6px 12px rgba(0,0,0,.175) !default;
26
$clear-selection-color: $dropdown-arrow-color !default;
27
 
28
//
29
// Mixins
30
// --------------------------------------------------
31
 
32
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_forms.scss#L115
33
@mixin bootstrap-input-defaults {
34
    @include box-shadow($form-control-default-box-shadow);
35
    background-color: $input-bg;
36
    border: 1px solid $input-border;
37
    border-radius: $input-border-radius;
38
    color: $input-color;
39
    font-family: $font-family-base;
40
    font-size: $font-size-base;
41
}
42
 
43
// @see http://getbootstrap.com/css/#forms-control-validation
44
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_forms.scss#L388
45
@mixin validation-state-focus($color) {
46
    $shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten($color, 20%);
47
 
48
    .select2-dropdown,
49
    .select2-selection {
50
        border-color: $color;
51
    }
52
 
53
    .select2-container--focus .select2-selection,
54
    .select2-container--open .select2-selection {
55
        @include box-shadow($shadow);
56
        border-color: darken($color, 10%);
57
    }
58
 
59
    &.select2-drop-active {
60
        border-color: darken($color, 10%);
61
 
62
        &.select2-drop.select2-drop-above {
63
            border-top-color: darken($color, 10%);
64
        }
65
    }
66
}
67
 
68
// dropdown arrow when dropdown is open
69
@mixin dropdown-arrow {
70
        .select2-selection--single {
71
        /**
72
         * Make the dropdown arrow point up while the dropdown is visible.
73
         */
74
 
75
        .select2-selection__arrow b {
76
            border-color: transparent transparent $dropdown-arrow-color transparent;
77
            border-width: 0 $caret-width-large $caret-width-large $caret-width-large;
78
        }
79
    }
80
}
81
 
82
 
83
 
84
 
85
 
86
.select2-container--bootstrap {
87
    display: block;
88
 
89
 
90
 
91
 
92
 
93
    /*------------------------------------*\
94
            #COMMON STYLES
95
    \*------------------------------------*/
96
 
97
    .select2-selection {
98
        @include bootstrap-input-defaults;
99
        outline: 0;
100
    }
101
 
102
    /**
103
     * Search field in the Select2 dropdown.
104
     */
105
 
106
    .select2-search--dropdown {
107
        .select2-search__field {
108
            @include bootstrap-input-defaults;
109
        }
110
    }
111
 
112
    /**
113
     * No outline for all search fields - in the dropdown
114
     * and inline in multi Select2s.
115
     */
116
 
117
    .select2-search__field {
118
        outline: 0;
119
 
120
        &::-webkit-input-placeholder {
121
            color: $input-color-placeholder;
122
        }
123
 
124
        /* Firefox 18- */
125
        &:-moz-placeholder {
126
            color: $input-color-placeholder;
127
        }
128
 
129
        /**
130
         * Firefox 19+
131
         *
132
         * @see http://stackoverflow.com/questions/24236240/color-for-styled-placeholder-text-is-muted-in-firefox
133
         */
134
        &::-moz-placeholder {
135
            color: $input-color-placeholder;
136
            opacity: 1;
137
        }
138
 
139
        &:-ms-input-placeholder {
140
            color: $input-color-placeholder;
141
        }
142
    }
143
 
144
    /**
145
     * Adjust Select2's choices hover and selected styles to match
146
     * Bootstrap 3's default dropdown styles.
147
     *
148
     * @see http://getbootstrap.com/components/#dropdowns
149
     */
150
 
151
    .select2-results__option {
152
 
153
        &[role=group] {
154
            padding: 0;
155
        }
156
 
157
        /**
158
         * Disabled results.
159
         *
160
         * @see https://select2.github.io/examples.html#disabled-results
161
         */
162
 
163
        &[aria-disabled=true] {
164
            color: $dropdown-link-disabled-color;
165
            cursor: $cursor-disabled;
166
        }
167
 
168
        /**
169
         * Hover state.
170
         */
171
 
172
        &[aria-selected=true] {
173
            background-color: $dropdown-link-hover-bg;
174
            color: $dropdown-link-hover-color;
175
        }
176
 
177
        /**
178
         * Selected state.
179
         */
180
 
181
        &--highlighted[aria-selected] {
182
            background-color: $dropdown-link-active-bg;
183
            color: $dropdown-link-active-color;
184
        }
185
 
186
        .select2-results__option {
187
            padding: $padding-base-vertical $padding-base-horizontal;
188
 
189
            .select2-results__group {
190
                padding-left: 0;
191
            }
192
 
193
            .select2-results__option {
194
                margin-left: -$padding-base-horizontal;
195
                padding-left: $padding-base-horizontal*2;
196
 
197
                .select2-results__option {
198
                    margin-left: -$padding-base-horizontal*2;
199
                    padding-left: $padding-base-horizontal*3;
200
 
201
                    .select2-results__option {
202
                        margin-left: -$padding-base-horizontal*3;
203
                        padding-left: $padding-base-horizontal*4;
204
 
205
                        .select2-results__option {
206
                            margin-left: -$padding-base-horizontal*4;
207
                            padding-left: $padding-base-horizontal*5;
208
 
209
                            .select2-results__option {
210
                                margin-left: -$padding-base-horizontal*5;
211
                                padding-left: $padding-base-horizontal*6;
212
                            }
213
                        }
214
                    }
215
                }
216
            }
217
        }
218
    }
219
 
220
    .select2-results__group {
221
        color: $dropdown-header-color;
222
        display: block;
223
        padding: $padding-base-vertical $padding-base-horizontal;
224
        font-size: $font-size-small;
225
        line-height: $line-height-base;
226
        white-space: nowrap;
227
    }
228
 
229
    &.select2-container--focus,
230
    &.select2-container--open {
231
        .select2-selection {
232
            @include box-shadow($form-control-focus-box-shadow);
233
            @include transition($form-control-transition);
234
            border-color: $input-border-focus;
235
        }
236
    }
237
 
238
    &.select2-container--open {
239
        /**
240
         * Make the dropdown arrow point up while the dropdown is visible.
241
         */
242
 
243
        .select2-selection .select2-selection__arrow b {
244
            border-color: transparent transparent $dropdown-arrow-color transparent;
245
            border-width: 0 $caret-width-base $caret-width-base $caret-width-base;
246
        }
247
 
248
        /**
249
         * Handle border radii of the container when the dropdown is showing.
250
         */
251
 
252
        &.select2-container--below {
253
            .select2-selection {
254
                @include border-bottom-radius(0);
255
                border-bottom-color: transparent;
256
            }
257
        }
258
 
259
        &.select2-container--above {
260
            .select2-selection {
261
                @include border-top-radius(0);
262
                border-top-color: transparent;
263
            }
264
        }
265
    }
266
 
267
    /**
268
     * Clear the selection.
269
     */
270
 
271
    .select2-selection__clear {
272
        color: $clear-selection-color;
273
        cursor: pointer;
274
        float: right;
275
        font-weight: bold;
276
        margin-right: 10px;
277
 
278
        &:hover {
279
            color: #333;
280
        }
281
    }
282
 
283
    /**
284
     * Address disabled Select2 styles.
285
     *
286
     * @see https://select2.github.io/examples.html#disabled
287
     * @see http://getbootstrap.com/css/#forms-control-disabled
288
     */
289
 
290
    &.select2-container--disabled {
291
 
292
        .select2-selection {
293
            border-color: $input-border;
294
            @include box-shadow(none);
295
        }
296
 
297
        .select2-selection,
298
        .select2-search__field {
299
            cursor: $cursor-disabled;
300
        }
301
 
302
        .select2-selection,
303
        .select2-selection--multiple .select2-selection__choice {
304
            background-color: $input-bg-disabled;
305
        }
306
 
307
        .select2-selection__clear,
308
        .select2-selection--multiple .select2-selection__choice__remove {
309
            display: none;
310
        }
311
    }
312
 
313
 
314
 
315
 
316
 
317
    /*------------------------------------*\
318
            #DROPDOWN
319
    \*------------------------------------*/
320
 
321
    /**
322
     * Dropdown border color and box-shadow.
323
     */
324
 
325
    .select2-dropdown {
326
        @include box-shadow($dropdown-box-shadow);
327
        border-color: $input-border-focus;
328
        overflow-x: hidden;
329
        margin-top: -1px;
330
        &--above {
331
            margin-top: 1px;
332
        }
333
    }
334
 
335
    /**
336
     * Limit the dropdown height.
337
     */
338
 
339
    .select2-results > .select2-results__options {
340
        max-height: 200px;
341
        overflow-y: auto;
342
    }
343
 
344
 
345
 
346
 
347
 
348
    /*------------------------------------*\
349
            #SINGLE SELECT2
350
    \*------------------------------------*/
351
 
352
    .select2-selection--single {
353
        height: $input-height-base;
354
        line-height: $line-height-base;
355
        padding: $padding-base-vertical $padding-base-horizontal + $caret-width-base*3 $padding-base-vertical $padding-base-horizontal;
356
 
357
        /**
358
         * Adjust the single Select2's dropdown arrow button appearance.
359
         */
360
 
361
        .select2-selection__arrow {
362
            position: absolute;
363
            bottom: 0;
364
            right: $padding-base-horizontal;
365
            top: 0;
366
            width: $caret-width-base;
367
 
368
            b {
369
                border-color: $dropdown-arrow-color transparent transparent transparent;
370
                border-style: solid;
371
                border-width: $caret-width-base $caret-width-base 0 $caret-width-base;
372
                height: 0;
373
                left: 0;
374
                margin-left: -$caret-width-base;
375
                margin-top: -$caret-width-base/2;
376
                position: absolute;
377
                top: 50%;
378
                width: 0;
379
            }
380
        }
381
 
382
        .select2-selection__rendered {
383
            color: $input-color;
384
            padding: 0;
385
        }
386
 
387
        .select2-selection__placeholder {
388
            color: $input-color-placeholder;
389
        }
390
    }
391
 
392
 
393
 
394
 
395
 
396
    /*------------------------------------*\
397
        #MULTIPLE SELECT2
398
    \*------------------------------------*/
399
 
400
    .select2-selection--multiple {
401
        min-height: $input-height-base;
402
 
403
        .select2-selection__rendered {
404
            box-sizing: border-box;
405
            display: block;
406
            line-height: $line-height-base;
407
            list-style: none;
408
            margin: 0;
409
            overflow: hidden;
410
            padding: 0;
411
            width: 100%;
412
            text-overflow: ellipsis;
413
            white-space: nowrap;
414
        }
415
 
416
        .select2-selection__placeholder {
417
            color: $input-color-placeholder;
418
            float: left;
419
            margin-top: 5px;
420
        }
421
 
422
        /**
423
         * Make Multi Select2's choices match Bootstrap 3's default button styles.
424
         */
425
 
426
        .select2-selection__choice {
427
            color: $input-color;
428
            background: $btn-default-bg;
429
            border: 1px solid $btn-default-border;
430
            border-radius: 4px;
431
            cursor: default;
432
            float: left;
433
            margin: ($padding-base-vertical - 1) 0 0 $padding-base-horizontal/2;
434
            padding: 0 $padding-base-vertical;
435
        }
436
 
437
        /**
438
         * Minus 2px borders.
439
         */
440
 
441
        .select2-search--inline {
442
            .select2-search__field {
443
                background: transparent;
444
                padding: 0 $padding-base-horizontal;
445
                height: $input-height-base - 2;
446
                line-height: $line-height-base;
447
                margin-top: 0;
448
                min-width: 5em;
449
            }
450
        }
451
 
452
        .select2-selection__choice__remove {
453
            color: #999;
454
            cursor: pointer;
455
            display: inline-block;
456
            font-weight: bold;
457
            margin-right: $padding-base-vertical / 2;
458
 
459
            &:hover {
460
                color: #333;
461
            }
462
        }
463
 
464
        /**
465
         * Clear the selection.
466
         */
467
 
468
        .select2-selection__clear {
469
            margin-top: $padding-base-vertical;
470
        }
471
    }
472
 
473
 
474
 
475
 
476
 
477
    /**
478
     * Address Bootstrap control sizing classes
479
     *
480
     * 1. Reset Bootstrap defaults.
481
     * 2. Adjust the dropdown arrow button icon position.
482
     *
483
     * @see http://getbootstrap.com/css/#forms-control-sizes
484
     */
485
 
486
    /* 1 */
487
    &.input-sm,
488
    &.input-lg {
489
        border-radius: 0;
490
        font-size: 12px;
491
        height: auto;
492
        line-height: 1;
493
        padding: 0;
494
    }
495
 
496
    &.input-sm,
497
    .input-group-sm &,
498
    .form-group-sm & {
499
        .select2-selection--single {
500
            border-radius: $border-radius-small;
501
            font-size: $font-size-small;
502
            height: $input-height-small;
503
            line-height: $line-height-small;
504
            padding: $padding-small-vertical $padding-small-horizontal + $caret-width-base*3 $padding-small-vertical $padding-small-horizontal;
505
 
506
            /* 2 */
507
            .select2-selection__arrow b {
508
                margin-left: -$padding-small-vertical;
509
            }
510
        }
511
 
512
        .select2-selection--multiple {
513
            min-height: $input-height-small;
514
 
515
            .select2-selection__choice {
516
                font-size: $font-size-small;
517
                line-height: $line-height-small;
518
                margin: ($padding-small-vertical - 1) 0 0 $padding-small-horizontal/2;
519
                padding: 0 $padding-small-vertical;
520
            }
521
 
522
            .select2-search--inline .select2-search__field {
523
                padding: 0 $padding-small-horizontal;
524
                font-size: $font-size-small;
525
                height: $input-height-small - 2;
526
                line-height: $line-height-small;
527
            }
528
 
529
            .select2-selection__clear {
530
                margin-top: $padding-small-vertical;
531
            }
532
        }
533
    }
534
 
535
    &.input-lg,
536
    .input-group-lg &,
537
    .form-group-lg & {
538
        .select2-selection--single {
539
            border-radius: $border-radius-large;
540
            font-size: $font-size-large;
541
            height: $input-height-large;
542
            line-height: $line-height-large;
543
            padding: $padding-large-vertical $padding-large-horizontal + $caret-width-large*3 $padding-large-vertical $padding-large-horizontal;
544
 
545
            /* 1 */
546
            .select2-selection__arrow {
547
                width: $caret-width-large;
548
 
549
                b {
550
                    border-width: $caret-width-large $caret-width-large 0 $caret-width-large;
551
                    margin-left: -$caret-width-large;
552
                    margin-left: -$padding-large-vertical;
553
                    margin-top: -$caret-width-large/2;
554
                }
555
            }
556
        }
557
 
558
        .select2-selection--multiple {
559
            min-height: $input-height-large;
560
 
561
            .select2-selection__choice {
562
                font-size: $font-size-large;
563
                line-height: $line-height-large;
564
                border-radius: 4px;
565
                margin: ($padding-large-vertical - 1) 0 0 $padding-large-horizontal/2;
566
                padding: 0 $padding-large-vertical;
567
            }
568
 
569
            .select2-search--inline .select2-search__field {
570
                padding: 0 $padding-large-horizontal;
571
                font-size: $font-size-large;
572
                height: $input-height-large - 2;
573
                line-height: $line-height-large;
574
            }
575
 
576
            .select2-selection__clear {
577
                margin-top: $padding-large-vertical;
578
            }
579
        }
580
    }
581
 
582
    &.input-lg.select2-container--open {
583
        @include dropdown-arrow;
584
    }
585
 
586
    .input-group-lg & {
587
        &.select2-container--open {
588
            @include dropdown-arrow;
589
        }
590
    }
591
 
592
 
593
 
594
 
595
 
596
    /*------------------------------------*\
597
        #RTL SUPPORT
598
    \*------------------------------------*/
599
 
600
    &[dir="rtl"] {
601
 
602
        /**
603
         * Single Select2
604
         *
605
         * 1. Makes sure that .select2-selection__placeholder is positioned
606
         *    correctly.
607
         */
608
 
609
        .select2-selection--single {
610
            padding-left: $padding-base-horizontal + $caret-width-base*3;
611
            padding-right: $padding-base-horizontal;
612
            .select2-selection__rendered {
613
                padding-right: 0;
614
                padding-left: 0;
615
                text-align: right; /* 1 */
616
            }
617
 
618
            .select2-selection__clear {
619
                float: left;
620
            }
621
 
622
            .select2-selection__arrow {
623
                left: $padding-base-horizontal;
624
                right: auto;
625
 
626
                b {
627
                    margin-left: 0;
628
                }
629
            }
630
        }
631
 
632
        /**
633
         * Multiple Select2
634
         */
635
 
636
        .select2-selection--multiple {
637
            .select2-selection__choice,
638
            .select2-selection__placeholder {
639
                float: right;
640
            }
641
 
642
            .select2-selection__choice {
643
                margin-left: 0;
644
                margin-right: $padding-base-horizontal/2;
645
            }
646
 
647
            .select2-selection__choice__remove {
648
                margin-left: 2px;
649
                margin-right: auto;
650
            }
651
        }
652
    }
653
}
654
 
655
 
656
 
657
 
658
 
659
/*------------------------------------*\
660
    #ADDITIONAL GOODIES
661
\*------------------------------------*/
662
 
663
/**
664
 * Address Bootstrap's validation states
665
 *
666
 * If a Select2 widget parent has one of Bootstrap's validation state modifier
667
 * classes, adjust Select2's border colors and focus states accordingly.
668
 * You may apply said classes to the Select2 dropdown (body > .select2-container)
669
 * via JavaScript match Bootstraps' to make its styles match.
670
 *
671
 * @see http://getbootstrap.com/css/#forms-control-validation
672
 */
673
 
674
.has-warning {
675
    @include validation-state-focus($state-warning-text);
676
}
677
 
678
.has-error {
679
    @include validation-state-focus($state-danger-text);
680
}
681
 
682
.has-success {
683
    @include validation-state-focus($state-success-text);
684
}
685
 
686
/**
687
 * Select2 widgets in Bootstrap Input Groups
688
 *
689
 * When Select2 widgets are combined with other elements using Bootstraps
690
 * "Input Group" component, we don't want specific edges of the Select2
691
 * container to have a border-radius.
692
 *
693
 * Use .select2-bootstrap-prepend and .select2-bootstrap-append on
694
 * a Bootstrap 3 .input-group to let the contained Select2 widget know which
695
 * edges should not be rounded as they are directly followed by another element.
696
 *
697
 * @see http://getbootstrap.com/components/#input-groups
698
 */
699
 
700
/**
701
 * Mimick Bootstraps .input-group .form-control styles.
702
 *
703
 * @see https://github.com/twbs/bootstrap/blob/master/less/input-groups.less
704
 */
705
 
706
.input-group .select2-container--bootstrap {
707
    display: table;
708
    table-layout: fixed;
709
    position: relative;
710
    z-index: 2;
711
    float: left;
712
    width: 100%;
713
    margin-bottom: 0;
714
}
715
 
716
.input-group.select2-bootstrap-prepend .select2-container--bootstrap {
717
    .select2-selection {
718
        @include border-left-radius(0);
719
    }
720
}
721
 
722
.input-group.select2-bootstrap-append .select2-container--bootstrap {
723
    .select2-selection {
724
        @include border-right-radius(0);
725
    }
726
}
727
 
728
/**
729
 * Adjust alignment of Bootstrap buttons in Bootstrap Input Groups to address
730
 * Multi Select2's height which - depending on how many elements have been selected -
731
 * may grow taller than its initial size.
732
 *
733
 * @see http://getbootstrap.com/components/#input-groups
734
 */
735
 
736
.select2-bootstrap-append,
737
.select2-bootstrap-prepend {
738
    .select2-container--bootstrap,
739
    .input-group-btn,
740
    .input-group-btn .btn {
741
        vertical-align: top;
742
    }
743
}
744
 
745
/**
746
 * Temporary fix for https://github.com/select2/select2-bootstrap-theme/issues/9
747
 *
748
 * Provides `!important` for certain properties of the class applied to the
749
 * original `<select>` element to hide it.
750
 *
751
 * @see https://github.com/select2/select2/pull/3301
752
 * @see https://github.com/fk/select2/commit/31830c7b32cb3d8e1b12d5b434dee40a6e753ada
753
 */
754
 
755
.form-control.select2-hidden-accessible {
756
    position: absolute !important;
757
    width: 1px !important;
758
}
759
 
760
/**
761
 * Display override for inline forms
762
*/
763
 
764
.form-inline .select2-container--bootstrap {
765
    display: inline-block;
766
}