5 A generic list component that can accomodate a variety of styles and controls.
\r
13 - Checkbox/radio inputs
\r
16 /// @Foundation.settings
\r
18 $blocklist-background: #fff !default;
\r
19 $blocklist-fullbleed: true !default;
\r
20 $blocklist-fontsize: 1rem !default;
\r
22 $blocklist-item-padding: 0.8rem 1rem !default;
\r
23 $blocklist-item-color: isitlight($blocklist-background, #000, #fff) !default;
\r
24 $blocklist-item-background-hover: smartscale($blocklist-background, 4.5%) !default;
\r
25 $blocklist-item-color-disabled: #999 !default;
\r
26 $blocklist-item-border: 1px solid smartscale($blocklist-background, 18.5%) !default;
\r
28 $blocklist-item-label-color: scale-color($blocklist-item-color, $lightness: 60%) !default;
\r
29 $blocklist-item-icon-size: 0.8 !default;
\r
31 $blocklist-header-fontsize: 0.8em !default;
\r
32 $blocklist-header-color: smartscale($blocklist-item-color, 40%) !default;
\r
33 $blocklist-header-uppercase: true;
\r
35 $blocklist-check-icons: true !default;
\r
39 Adds styles for a block list container.
\r
41 $font-size: global font size for the list.
\r
42 $full-bleed: when "true", the margins of the list invert to line it up with the edge of a padded element.
\r
44 %block-list-container {
\r
45 margin-bottom: 1rem;
\r
50 list-style-type: none;
\r
56 @mixin block-list-container(
\r
57 $font-size: $blocklist-fontsize,
\r
58 $full-bleed: $blocklist-fullbleed
\r
60 @extend %block-list-container;
\r
61 font-size: $font-size;
\r
64 margin-left: -$global-padding;
\r
65 margin-right: -$global-padding;
\r
70 Styles block list headers on the selector you include this mixin in (normally a <header>).
\r
72 $color - color of the header.
\r
73 $font-size - font size of the header.
\r
74 $offset - left margin to add to the header, to line it up with the list items.
\r
76 @mixin block-list-header(
\r
77 $color: $blocklist-header-color,
\r
78 $font-size: $blocklist-header-fontsize,
\r
79 $uppercase: $blocklist-header-uppercase,
\r
80 $offset: get-side($blocklist-item-padding, left)
\r
85 margin-bottom: 0.5em;
\r
86 margin-left: $offset;
\r
87 font-size: $font-size;
\r
89 @if $uppercase { text-transform: uppercase; }
\r
93 Styles block list items on the selector you include this mixin in (normally an <li>).
\r
95 $color - color of items.
\r
96 $color-hover - color of items on hover.
\r
97 $background - background of items.
\r
98 $background-hover - background of items on hover.
\r
99 $border - border between items.
\r
100 $padding - padding on items.
\r
102 @mixin block-list-item(
\r
103 $color: $blocklist-item-color,
\r
104 $color-hover: $blocklist-item-color,
\r
105 $color-disabled: $blocklist-item-color-disabled,
\r
106 $background: transparent,
\r
107 $background-hover: $blocklist-item-background-hover,
\r
108 $border: $blocklist-item-border,
\r
109 $padding: $blocklist-item-padding
\r
111 position: relative;
\r
113 @if hasvalue($border) {
\r
114 border-bottom: $border;
\r
116 border-top: $border;
\r
120 // Inner elements share the same basic styles
\r
121 > a, > span, > label {
\r
124 padding-left: get-side($padding, left);
\r
135 color: $color-hover;
\r
138 > a, > label, select {
\r
140 background: $background-hover;
\r
144 // Coloring classes
\r
146 &, &:hover { color: $alert-color; }
\r
150 &, &:hover { color: $color-disabled; }
\r
151 &:hover { background: transparent; }
\r
156 Adds label styles to the class you include this mixin in.
\r
158 $color - color of the label.
\r
159 $left-class - extra class to flip the orientation of the label.
\r
160 $left-padding - left padding to use for left-hand labels.
\r
162 @mixin block-list-label(
\r
163 $color: $blocklist-item-label-color,
\r
164 $left-class: 'left',
\r
165 $left-padding: get-side($blocklist-item-padding, top)
\r
167 display: inline-block;
\r
171 pointer-events: none;
\r
174 margin-left: $left-padding;
\r
180 Adds support for chevrons, which appear on the right-hand side of the item.
\r
182 $color - color of the chevron.
\r
183 $padding - include the global padding of block list items here.
\r
185 @mixin block-list-chevron(
\r
186 $color: $blocklist-header-color,
\r
187 $padding: $blocklist-item-padding,
\r
188 $label-class: 'block-list-label'
\r
190 // Chevrons are a pseudo-element
\r
194 position: absolute;
\r
195 right: get-side($padding, right);
\r
197 transform: translateY(-50%);
\r
203 // Labels next to links move over to make room for the chevron
\r
204 // TODO: this selector needs to be customiable, but adding a setting just for it might be weird
\r
206 padding-right: get-side($padding, right) * 1.5;
\r
211 Adds icon styles. Call this mixin on a block list container.
\r
213 $size - size of the icon as a percentage (decimal) of the list item's height.
\r
214 $item-selector - overrides the 'li' selector used for list items.
\r
216 @mixin block-list-icons(
\r
217 $size: $blocklist-item-icon-size,
\r
218 $item-selector: 'li'
\r
220 // PH - need a better solution
\r
222 $blocklist-fontsize
\r
223 + get-side($blocklist-item-padding, top)
\r
224 + get-side($blocklist-item-padding, top);
\r
226 $icon-height: $item-height * $blocklist-item-icon-size;
\r
227 $icon-offset: ($item-height - $icon-height) / 2;
\r
229 #{$item-selector} {
\r
230 > a, > span, > label {
\r
231 padding-left: (get-side($blocklist-item-padding, left) * 2) + $blocklist-item-icon-size;
\r
234 position: absolute;
\r
236 left: $icon-offset;
\r
237 width: $icon-height;
\r
238 height: $icon-height;
\r
239 border-radius: 8px;
\r
240 pointer-events: none;
\r
246 Adds support for text fields, select menus, and checkbox/radio groups in block lists.
\r
248 $color - color of select menu arrow.
\r
249 $background-hover - color of select menu when hovered over.
\r
250 $padding - include the global padding of block list items here.
\r
251 $dropdown-class - class to use for list items that contain a dropdown.
\r
252 $switch-class - class to use for switches inside list items.
\r
254 @mixin block-list-inputs(
\r
255 $color: $blocklist-item-color,
\r
256 $background: $blocklist-background,
\r
257 $background-hover: $blocklist-item-background-hover,
\r
258 $padding: $blocklist-item-padding,
\r
259 $icons: $blocklist-check-icons,
\r
260 $dropdown-class: 'with-dropdown',
\r
261 $switch-class: 'switch'
\r
264 #{$text-input-selectors} {
\r
278 li > input[type="checkbox"], li > input[type="radio"] {
\r
279 position: absolute;
\r
284 font-size: $blocklist-fontsize;
\r
288 @if $icons == true {
\r
289 &:checked + label {
\r
291 @include image-checkmark($color);
\r
293 background-size: 100% 100%;
\r
296 color: $primary-color;
\r
298 pointer-events: none;
\r
299 margin-top: -0.25em;
\r
306 .#{$dropdown-class} {
\r
310 // Reset pesky <select> styles
\r
311 -webkit-appearance: none;
\r
312 -moz-appearance: none;
\r
319 font-size: 1em; // Same size as its parent
\r
322 background-color: transparent;
\r
327 .#{$switch-class} {
\r
328 position: absolute;
\r
330 right: get-side($padding, right);
\r
331 transform: translateY(-50%);
\r
335 @include exports(block-list) {
\r
337 @include block-list-container;
\r
338 @include block-list-inputs;
\r
340 &.with-icons { @include block-list-icons; }
\r
341 header { @include block-list-header; }
\r
344 @include block-list-item;
\r
346 &.with-chevron { @include block-list-chevron; }
\r
347 .block-list-label { @include block-list-label; }
\r