-
-
Notifications
You must be signed in to change notification settings - Fork 204
/
_layout.scss
168 lines (148 loc) · 3.87 KB
/
_layout.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// basic
.select2-container {
display: block;
*:focus {
outline: 0;
}
}
// input-group
.input-group .select2-container--bootstrap4 {
flex-grow: 1;
}
// for prepended input
.input-group-prepend ~ .select2-container--bootstrap4 .select2-selection {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
// for appended input
.input-group > .select2-container--bootstrap4:not(:last-child) .select2-selection {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.select2-container--bootstrap4 {
// input box
.select2-selection {
width: 100%;
background-color: $input-bg;
border: $input-border-width solid $input-border-color;
@include border-radius($input-border-radius);
@include box-shadow($input-box-shadow);
@include transition($input-transition);
}
// focused input box
&.select2-container--focus {
.select2-selection {
border-color: $input-focus-border-color;
box-shadow: $input-focus-box-shadow;
}
// when open, hide bottom border
&.select2-container--open .select2-selection {
border-bottom: none;
@include border-bottom-radius(0);
}
}
// open input box
&.select2-container--open {
&.select2-container--above {
.select2-selection {
@include border-top-radius(0);
}
}
&.select2-container--below {
.select2-selection {
@include border-bottom-radius(0);
}
}
}
// disabled input box
&.select2-container--disabled,
&.select2-container--disabled.select2-container--focus {
.select2-selection {
cursor: not-allowed;
background-color: $input-disabled-bg;
border-color: $input-border-color;
box-shadow: none;
}
.select2-search__field {
background-color: transparent;
}
}
// validated input box
// stylelint-disable selector-no-qualifying-type
select.is-invalid ~ & .select2-selection,
form.was-validated select:invalid ~ & .select2-selection {
border-color: $danger;
}
select.is-valid ~ & .select2-selection,
form.was-validated select:valid ~ & .select2-selection {
border-color: $success;
}
// stylelint-enable selector-no-qualifying-type
// fixes placeholder width
.select2-search {
width: 100%;
}
// dropdown
.select2-dropdown {
border-color: $input-border-color;
border-radius: 0; // overwrite select2.css
// dropdown opened below
&.select2-dropdown--below {
border-top: none;
@include border-bottom-radius($input-border-radius);
}
// dropdown opened above
&.select2-dropdown--above {
border-top: 1px solid $input-border-color;
@include border-top-radius($input-border-radius);
}
// selected item
.select2-results__option[aria-selected="true"] {
color: color-yiq(darken($input-bg, 5%));
background-color: darken($input-bg, 5%);
}
}
// mouse hovered item
.select2-results__option--highlighted,
.select2-results__option--highlighted.select2-results__option[aria-selected="true"] {
color: color-yiq($primary);
background-color: $primary;
}
// for <optgroup>
.select2-results__option[role="group"] {
padding: 0;
.select2-results__options--nested .select2-results__option {
padding-left: 1em;
}
}
.select2-results__option {
padding: $input-padding-y $input-padding-x;
}
// fixes vertical overflow
.select2-results > .select2-results__options {
max-height: 15em;
overflow-y: auto;
}
.select2-results__group {
display: list-item;
padding: 6px;
color: $secondary;
}
// all clear button
.select2-selection__clear {
$bg: #c8c8c8;
float: right;
width: .9em;
height: .9em;
padding-left: .15em;
margin-top: .7em;
margin-right: .3em;
line-height: .75em;
color: $light;
background-color: $bg;
border-radius: 100%;
&:hover {
background-color: darken($bg, 10%);
}
}
}