1 | // stylelint-disable selector-no-qualifying-type */
|
---|
2 |
|
---|
3 | //
|
---|
4 | // Button groups
|
---|
5 | // --------------------------------------------------
|
---|
6 |
|
---|
7 | // Make the div behave like a button
|
---|
8 | .btn-group,
|
---|
9 | .btn-group-vertical {
|
---|
10 | position: relative;
|
---|
11 | display: inline-block;
|
---|
12 | vertical-align: middle; // match .btn alignment given font-size hack above
|
---|
13 | > .btn {
|
---|
14 | position: relative;
|
---|
15 | float: left;
|
---|
16 | // Bring the "active" button to the front
|
---|
17 | &:hover,
|
---|
18 | &:focus,
|
---|
19 | &:active,
|
---|
20 | &.active {
|
---|
21 | z-index: 2;
|
---|
22 | }
|
---|
23 | }
|
---|
24 | }
|
---|
25 |
|
---|
26 | // Prevent double borders when buttons are next to each other
|
---|
27 | .btn-group {
|
---|
28 | .btn + .btn,
|
---|
29 | .btn + .btn-group,
|
---|
30 | .btn-group + .btn,
|
---|
31 | .btn-group + .btn-group {
|
---|
32 | margin-left: -1px;
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | // Optional: Group multiple button groups together for a toolbar
|
---|
37 | .btn-toolbar {
|
---|
38 | margin-left: -5px; // Offset the first child's margin
|
---|
39 | &:extend(.clearfix all);
|
---|
40 |
|
---|
41 | .btn,
|
---|
42 | .btn-group,
|
---|
43 | .input-group {
|
---|
44 | float: left;
|
---|
45 | }
|
---|
46 | > .btn,
|
---|
47 | > .btn-group,
|
---|
48 | > .input-group {
|
---|
49 | margin-left: 5px;
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
|
---|
54 | border-radius: 0;
|
---|
55 | }
|
---|
56 |
|
---|
57 | // Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
|
---|
58 | .btn-group > .btn:first-child {
|
---|
59 | margin-left: 0;
|
---|
60 | &:not(:last-child):not(.dropdown-toggle) {
|
---|
61 | .border-right-radius(0);
|
---|
62 | }
|
---|
63 | }
|
---|
64 | // Need .dropdown-toggle since :last-child doesn't apply, given that a .dropdown-menu is used immediately after it
|
---|
65 | .btn-group > .btn:last-child:not(:first-child),
|
---|
66 | .btn-group > .dropdown-toggle:not(:first-child) {
|
---|
67 | .border-left-radius(0);
|
---|
68 | }
|
---|
69 |
|
---|
70 | // Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
|
---|
71 | .btn-group > .btn-group {
|
---|
72 | float: left;
|
---|
73 | }
|
---|
74 | .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
|
---|
75 | border-radius: 0;
|
---|
76 | }
|
---|
77 | .btn-group > .btn-group:first-child:not(:last-child) {
|
---|
78 | > .btn:last-child,
|
---|
79 | > .dropdown-toggle {
|
---|
80 | .border-right-radius(0);
|
---|
81 | }
|
---|
82 | }
|
---|
83 | .btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
|
---|
84 | .border-left-radius(0);
|
---|
85 | }
|
---|
86 |
|
---|
87 | // On active and open, don't show outline
|
---|
88 | .btn-group .dropdown-toggle:active,
|
---|
89 | .btn-group.open .dropdown-toggle {
|
---|
90 | outline: 0;
|
---|
91 | }
|
---|
92 |
|
---|
93 |
|
---|
94 | // Sizing
|
---|
95 | //
|
---|
96 | // Remix the default button sizing classes into new ones for easier manipulation.
|
---|
97 |
|
---|
98 | .btn-group-xs > .btn { &:extend(.btn-xs); }
|
---|
99 | .btn-group-sm > .btn { &:extend(.btn-sm); }
|
---|
100 | .btn-group-lg > .btn { &:extend(.btn-lg); }
|
---|
101 |
|
---|
102 |
|
---|
103 | // Split button dropdowns
|
---|
104 | // ----------------------
|
---|
105 |
|
---|
106 | // Give the line between buttons some depth
|
---|
107 | .btn-group > .btn + .dropdown-toggle {
|
---|
108 | padding-right: 8px;
|
---|
109 | padding-left: 8px;
|
---|
110 | }
|
---|
111 | .btn-group > .btn-lg + .dropdown-toggle {
|
---|
112 | padding-right: 12px;
|
---|
113 | padding-left: 12px;
|
---|
114 | }
|
---|
115 |
|
---|
116 | // The clickable button for toggling the menu
|
---|
117 | // Remove the gradient and set the same inset shadow as the :active state
|
---|
118 | .btn-group.open .dropdown-toggle {
|
---|
119 | .box-shadow(inset 0 3px 5px rgba(0, 0, 0, .125));
|
---|
120 |
|
---|
121 | // Show no shadow for `.btn-link` since it has no other button styles.
|
---|
122 | &.btn-link {
|
---|
123 | .box-shadow(none);
|
---|
124 | }
|
---|
125 | }
|
---|
126 |
|
---|
127 |
|
---|
128 | // Reposition the caret
|
---|
129 | .btn .caret {
|
---|
130 | margin-left: 0;
|
---|
131 | }
|
---|
132 | // Carets in other button sizes
|
---|
133 | .btn-lg .caret {
|
---|
134 | border-width: @caret-width-large @caret-width-large 0;
|
---|
135 | border-bottom-width: 0;
|
---|
136 | }
|
---|
137 | // Upside down carets for .dropup
|
---|
138 | .dropup .btn-lg .caret {
|
---|
139 | border-width: 0 @caret-width-large @caret-width-large;
|
---|
140 | }
|
---|
141 |
|
---|
142 |
|
---|
143 | // Vertical button groups
|
---|
144 | // ----------------------
|
---|
145 |
|
---|
146 | .btn-group-vertical {
|
---|
147 | > .btn,
|
---|
148 | > .btn-group,
|
---|
149 | > .btn-group > .btn {
|
---|
150 | display: block;
|
---|
151 | float: none;
|
---|
152 | width: 100%;
|
---|
153 | max-width: 100%;
|
---|
154 | }
|
---|
155 |
|
---|
156 | // Clear floats so dropdown menus can be properly placed
|
---|
157 | > .btn-group {
|
---|
158 | &:extend(.clearfix all);
|
---|
159 | > .btn {
|
---|
160 | float: none;
|
---|
161 | }
|
---|
162 | }
|
---|
163 |
|
---|
164 | > .btn + .btn,
|
---|
165 | > .btn + .btn-group,
|
---|
166 | > .btn-group + .btn,
|
---|
167 | > .btn-group + .btn-group {
|
---|
168 | margin-top: -1px;
|
---|
169 | margin-left: 0;
|
---|
170 | }
|
---|
171 | }
|
---|
172 |
|
---|
173 | .btn-group-vertical > .btn {
|
---|
174 | &:not(:first-child):not(:last-child) {
|
---|
175 | border-radius: 0;
|
---|
176 | }
|
---|
177 | &:first-child:not(:last-child) {
|
---|
178 | .border-top-radius(@btn-border-radius-base);
|
---|
179 | .border-bottom-radius(0);
|
---|
180 | }
|
---|
181 | &:last-child:not(:first-child) {
|
---|
182 | .border-top-radius(0);
|
---|
183 | .border-bottom-radius(@btn-border-radius-base);
|
---|
184 | }
|
---|
185 | }
|
---|
186 | .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
|
---|
187 | border-radius: 0;
|
---|
188 | }
|
---|
189 | .btn-group-vertical > .btn-group:first-child:not(:last-child) {
|
---|
190 | > .btn:last-child,
|
---|
191 | > .dropdown-toggle {
|
---|
192 | .border-bottom-radius(0);
|
---|
193 | }
|
---|
194 | }
|
---|
195 | .btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
|
---|
196 | .border-top-radius(0);
|
---|
197 | }
|
---|
198 |
|
---|
199 |
|
---|
200 | // Justified button groups
|
---|
201 | // ----------------------
|
---|
202 |
|
---|
203 | .btn-group-justified {
|
---|
204 | display: table;
|
---|
205 | width: 100%;
|
---|
206 | table-layout: fixed;
|
---|
207 | border-collapse: separate;
|
---|
208 | > .btn,
|
---|
209 | > .btn-group {
|
---|
210 | display: table-cell;
|
---|
211 | float: none;
|
---|
212 | width: 1%;
|
---|
213 | }
|
---|
214 | > .btn-group .btn {
|
---|
215 | width: 100%;
|
---|
216 | }
|
---|
217 |
|
---|
218 | > .btn-group .dropdown-menu {
|
---|
219 | left: auto;
|
---|
220 | }
|
---|
221 | }
|
---|
222 |
|
---|
223 |
|
---|
224 | // Checkbox and radio options
|
---|
225 | //
|
---|
226 | // In order to support the browser's form validation feedback, powered by the
|
---|
227 | // `required` attribute, we have to "hide" the inputs via `clip`. We cannot use
|
---|
228 | // `display: none;` or `visibility: hidden;` as that also hides the popover.
|
---|
229 | // Simply visually hiding the inputs via `opacity` would leave them clickable in
|
---|
230 | // certain cases which is prevented by using `clip` and `pointer-events`.
|
---|
231 | // This way, we ensure a DOM element is visible to position the popover from.
|
---|
232 | //
|
---|
233 | // See https://github.com/twbs/bootstrap/pull/12794 and
|
---|
234 | // https://github.com/twbs/bootstrap/pull/14559 for more information.
|
---|
235 |
|
---|
236 | [data-toggle="buttons"] {
|
---|
237 | > .btn,
|
---|
238 | > .btn-group > .btn {
|
---|
239 | input[type="radio"],
|
---|
240 | input[type="checkbox"] {
|
---|
241 | position: absolute;
|
---|
242 | clip: rect(0, 0, 0, 0);
|
---|
243 | pointer-events: none;
|
---|
244 | }
|
---|
245 | }
|
---|
246 | }
|
---|