-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy path_list-group.scss
More file actions
264 lines (223 loc) · 9.3 KB
/
_list-group.scss
File metadata and controls
264 lines (223 loc) · 9.3 KB
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
// Base class
//
// Easily usable on <ul>, <ol>, or <div>.
.list-group {
// scss-docs-start list-group-css-vars
--#{$prefix}list-group-color: #{$list-group-color};
--#{$prefix}list-group-bg: #{$list-group-bg};
--#{$prefix}list-group-font-weight: #{$list-group-font-weight}; // OUDS mod
--#{$prefix}list-group-border-color: #{$list-group-border-color};
--#{$prefix}list-group-border-width: #{$list-group-border-width};
--#{$prefix}list-group-border-radius: #{$list-group-border-radius};
--#{$prefix}list-group-item-padding-x: #{$list-group-item-padding-x};
--#{$prefix}list-group-item-padding-y: #{$list-group-item-padding-y};
--#{$prefix}list-group-item-icon-margin-x: #{$list-group-item-icon-margin-x}; // OUDS mod
--#{$prefix}list-group-item-icon-size: #{$list-group-item-icon-size}; // OUDS mod
--#{$prefix}list-group-action-color: #{$list-group-action-color};
--#{$prefix}list-group-action-hover-color: #{$list-group-action-hover-color};
--#{$prefix}list-group-action-hover-bg: #{$list-group-hover-bg};
--#{$prefix}list-group-action-active-color: #{$list-group-action-active-color};
--#{$prefix}list-group-action-active-bg: #{$list-group-action-active-bg};
--#{$prefix}list-group-disabled-color: #{$list-group-disabled-color};
--#{$prefix}list-group-disabled-bg: #{$list-group-disabled-bg};
--#{$prefix}list-group-active-color: #{$list-group-active-color};
--#{$prefix}list-group-active-bg: #{$list-group-active-bg};
--#{$prefix}list-group-active-border-color: #{$list-group-active-border-color};
// scss-docs-end list-group-css-vars
display: flex;
flex-direction: column;
// No need to set list-style: none; since .list-group-item is block level
padding-left: 0; // reset padding because ul and ol
margin-bottom: 0;
background-color: transparent; // OUDS mod
@include border-radius(var(--#{$prefix}list-group-border-radius));
// OUDS mod
.badge {
--#{$prefix}badge-padding: .125rem .375rem;
--#{$prefix}badge-font-size: .875rem;
}
// End mod
}
.list-group-numbered {
list-style-type: none;
counter-reset: section;
// OUDS mod
> .list-group-item {
display: flex;
}
// End mod
> .list-group-item::before {
margin-right: $list-group-numbered-item-margin-end; // OUDS mod
// Increments only this instance of the section counter
content: counters(section, ".") ". ";
counter-increment: section;
}
}
// Interactive list items
//
// Use anchor or button elements instead of `li`s or `div`s to create interactive
// list items. Includes an extra `.active` modifier class for selected items.
.list-group-item-action {
width: 100%; // For `<button>`s (anchors become 100% by default though)
color: var(--#{$prefix}list-group-action-color);
text-align: inherit; // For `<button>`s (anchors inherit)
// OUDS mod: default focus
// Hover state
&:hover{
z-index: 1; // Place hover/focus items above their siblings for proper border styling
color: var(--#{$prefix}list-group-action-hover-color);
text-decoration: none;
background-color: var(--#{$prefix}list-group-action-hover-bg);
}
&:active {
color: var(--#{$prefix}list-group-action-active-color);
background: var(--#{$prefix}list-group-action-active-bg); // OUDS mod: instead of `background-color`
}
}
// Individual list items
//
// Use on `li`s or `div`s within the `.list-group` parent.
.list-group-item {
position: relative;
display: block;
padding: var(--#{$prefix}list-group-item-padding-y) var(--#{$prefix}list-group-item-padding-x);
font-weight: var(--#{$prefix}list-group-font-weight); // OUDS mod
color: var(--#{$prefix}list-group-color);
text-decoration: if($link-decoration == none, null, none);
background-color: var(--#{$prefix}list-group-bg);
border: var(--#{$prefix}list-group-border-width) solid var(--#{$prefix}list-group-border-color);
border-bottom-width: $list-group-divider-size; // OUDS mod
&:first-child {
@include border-top-radius(inherit);
}
&:last-child {
border-bottom-width: var(--#{$prefix}list-group-border-width); // OUDS mod
@include border-bottom-radius(inherit);
}
&.disabled,
&:disabled {
color: var(--#{$prefix}list-group-disabled-color);
pointer-events: none;
background-color: var(--#{$prefix}list-group-disabled-bg);
}
// Include both here for `<a>`s and `<button>`s
&.active {
z-index: 2; // Place active items above their siblings for proper border styling
color: var(--#{$prefix}list-group-active-color);
background: var(--#{$prefix}list-group-active-bg); // OUDS mod: `background` instead of `background-color`
border-color: var(--#{$prefix}list-group-active-border-color);
}
// stylelint-disable-next-line scss/selector-no-redundant-nesting-selector
& + .list-group-item {
border-top-width: 0;
&.active {
// stylelint-disable-next-line function-disallowed-list
margin-top: calc(-1 * #{$list-group-divider-size}); // OUDS mod: instead of `calc(-1 * var(--#{$prefix}list-group-border-width))`
border-top-width: $list-group-divider-size; // OUDS mod: instead of `var(--#{$prefix}list-group-border-width)`
}
}
// OUDS mod: focus
&:focus {
&[data-focus-visible-added] {
outline-offset: subtract(-$focus-visible-outer-width, var(--#{$prefix}list-group-border-width));
box-shadow: inset 0 0 0 add($focus-visible-inner-width, $focus-visible-outer-width) var(--#{$prefix}color-border-focus-inset);
&.active {
outline-color: var(--#{$prefix}color-border-focus-inset);
box-shadow: inset 0 0 0 add($focus-visible-inner-width, $focus-visible-outer-width) var(--#{$prefix}color-border-focus);
}
}
}
// End mod
}
// Horizontal
//
// Change the layout of list group items from vertical (default) to horizontal.
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
.list-group-horizontal#{$infix} {
flex-direction: row;
> .list-group-item {
// OUDS mod: remove default border width
border-right-width: $list-group-divider-size;
border-bottom-width: var(--#{$prefix}list-group-border-width);
// End mod
&:first-child {
@include border-bottom-start-radius(var(--#{$prefix}list-group-border-radius));
@include border-top-end-radius(0);
}
&:last-child {
border-right-width: var(--#{$prefix}list-group-border-width); // OUDS mod
@include border-top-end-radius(var(--#{$prefix}list-group-border-radius));
@include border-bottom-start-radius(0);
}
&.active {
margin-top: 0;
}
+ .list-group-item {
border-top-width: var(--#{$prefix}list-group-border-width);
border-left-width: 0;
&.active {
// stylelint-disable-next-line function-disallowed-list
margin-left: calc(-1 * #{$list-group-divider-size}); // OUDS mod: instead of `calc(-1 * var(--#{$prefix}list-group-border-width))`
border-left-width: $list-group-divider-size; // OUDS mod: instead of `var(--#{$prefix}list-group-border-width)`
}
}
}
}
}
}
// Flush list items
//
// Remove borders and border-radius to keep list group items edge-to-edge. Most
// useful within other components (e.g., cards).
.list-group-flush {
border-top: $list-group-divider-size solid var(--#{$prefix}list-group-border-color); // OUDS mod
@include border-radius(0);
> .list-group-item {
border-width: 0 0 $list-group-divider-size; // OUDS mod: instead of `0 0 var(--#{$prefix}list-group-border-width)`
&:last-child {
border-bottom-width: 0;
}
}
}
//
// OUDS mod: the variants apply contextual icons when needed
//
// scss-docs-start list-group-modifiers
// List group contextual variants
//
// Add modifier classes to add icon on individual items.
// Organizationally, this must come after the `:hover` states.
@each $state, $value in $list-group-icons { // OUDS mod: instead of `@each $state in map-keys($theme-colors)`
.list-group-item-#{$state} {
// OUDS mod: no `--#{$prefix}list-group-color`
// OUDS mod: no `--#{$prefix}list-group-bg`
// OUDS mod: no `--#{$prefix}list-group-border-color`
// OUDS mod: no `--#{$prefix}list-group-action-hover-color`
// OUDS mod: no `--#{$prefix}list-group-action-hover-bg`
// OUDS mod: no `--#{$prefix}list-group-action-active-color`
// OUDS mod: no `--#{$prefix}list-group-action-active-bg`
// OUDS mod: no `--#{$prefix}list-group-active-color`
// OUDS mod: no `--#{$prefix}list-group-active-bg`
// OUDS mod: no `--#{$prefix}list-group-active-border-color`
// OUDS mod
padding-right: calc(var(--#{$prefix}list-group-item-icon-margin-x) * 2 + var(--#{$prefix}list-group-item-icon-size)); // stylelint-disable-line function-disallowed-list
&::after {
position: absolute;
top: add(var(--#{$prefix}list-group-item-padding-y), 1px);
right: var(--#{$prefix}list-group-item-icon-margin-x);
width: var(--#{$prefix}list-group-item-icon-size);
height: var(--#{$prefix}list-group-item-icon-size);
content: "";
background-color: currentcolor;
mask: no-repeat $value;
}
// End mod
}
}
// scss-docs-end list-group-modifiers
.card .list-group {
--#{$prefix}list-group-item-padding-x: #{var(--#{$prefix}card-spacer-x)};
}
// End mod