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