diff options
| author | Bobby <[email protected]> | 2024-08-16 20:47:33 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-16 20:47:33 -0400 |
| commit | 6b28433d9cfde435be8ec2bd6cf91e6324d08865 (patch) | |
| tree | 8343c27b8b95ff5639233e81cf157f92e5688466 /scss/_tables.scss | |
| parent | d53094ec16ba385faae2973ddee648698b32ab24 (diff) | |
| parent | 048f56f51460df75e92a2f7b472e1c56baeb68f7 (diff) | |
| download | bootstrap-6b28433d9cfde435be8ec2bd6cf91e6324d08865.tar.xz bootstrap-6b28433d9cfde435be8ec2bd6cf91e6324d08865.zip | |
Diffstat (limited to 'scss/_tables.scss')
| -rw-r--r-- | scss/_tables.scss | 66 |
1 files changed, 40 insertions, 26 deletions
diff --git a/scss/_tables.scss b/scss/_tables.scss index 30e898b58..276521a38 100644 --- a/scss/_tables.scss +++ b/scss/_tables.scss @@ -3,22 +3,27 @@ // .table { - --#{$variable-prefix}table-color: #{$table-color}; - --#{$variable-prefix}table-bg: #{$table-bg}; - --#{$variable-prefix}table-border-color: #{$table-border-color}; - --#{$variable-prefix}table-accent-bg: #{$table-accent-bg}; - --#{$variable-prefix}table-striped-color: #{$table-striped-color}; - --#{$variable-prefix}table-striped-bg: #{$table-striped-bg}; - --#{$variable-prefix}table-active-color: #{$table-active-color}; - --#{$variable-prefix}table-active-bg: #{$table-active-bg}; - --#{$variable-prefix}table-hover-color: #{$table-hover-color}; - --#{$variable-prefix}table-hover-bg: #{$table-hover-bg}; + // Reset needed for nesting tables + --#{$prefix}table-color-type: initial; + --#{$prefix}table-bg-type: initial; + --#{$prefix}table-color-state: initial; + --#{$prefix}table-bg-state: initial; + // End of reset + --#{$prefix}table-color: #{$table-color}; + --#{$prefix}table-bg: #{$table-bg}; + --#{$prefix}table-border-color: #{$table-border-color}; + --#{$prefix}table-accent-bg: #{$table-accent-bg}; + --#{$prefix}table-striped-color: #{$table-striped-color}; + --#{$prefix}table-striped-bg: #{$table-striped-bg}; + --#{$prefix}table-active-color: #{$table-active-color}; + --#{$prefix}table-active-bg: #{$table-active-bg}; + --#{$prefix}table-hover-color: #{$table-hover-color}; + --#{$prefix}table-hover-bg: #{$table-hover-bg}; width: 100%; margin-bottom: $spacer; - color: var(--#{$variable-prefix}table-color); vertical-align: $table-cell-vertical-align; - border-color: var(--#{$variable-prefix}table-border-color); + border-color: var(--#{$prefix}table-border-color); // Target th & td // We need the child combinator to prevent styles leaking to nested tables which doesn't have a `.table` class. @@ -27,9 +32,11 @@ // stylelint-disable-next-line selector-max-universal > :not(caption) > * > * { padding: $table-cell-padding-y $table-cell-padding-x; - background-color: var(--#{$variable-prefix}table-bg); + // Following the precept of cascades: https://codepen.io/miriamsuzanne/full/vYNgodb + color: var(--#{$prefix}table-color-state, var(--#{$prefix}table-color-type, var(--#{$prefix}table-color))); + background-color: var(--#{$prefix}table-bg); border-bottom-width: $table-border-width; - box-shadow: inset 0 0 0 9999px var(--#{$variable-prefix}table-accent-bg); + box-shadow: inset 0 0 0 9999px var(--#{$prefix}table-bg-state, var(--#{$prefix}table-bg-type, var(--#{$prefix}table-accent-bg))); } > tbody { @@ -39,13 +46,11 @@ > thead { vertical-align: bottom; } - - // Highlight border color between thead, tbody and tfoot. - > :not(:first-child) { - border-top: (2 * $table-border-width) solid $table-group-separator-color; - } } +.table-group-divider { + border-top: calc(#{$table-border-width} * 2) solid $table-group-separator-color; // stylelint-disable-line function-disallowed-list +} // // Change placement of captions with a class @@ -74,7 +79,7 @@ // // When borders are added on all sides of the cells, the corners can render odd when // these borders do not have the same color or if they are semi-transparent. -// Therefor we add top and border bottoms to the `tr`s and left and right borders +// Therefore we add top and border bottoms to the `tr`s and left and right borders // to the `td`s or `th`s .table-bordered { @@ -103,10 +108,19 @@ // // Default zebra-stripe styles (alternating gray and transparent backgrounds) +// For rows .table-striped { > tbody > tr:nth-of-type(#{$table-striped-order}) > * { - --#{$variable-prefix}table-accent-bg: var(--#{$variable-prefix}table-striped-bg); - color: var(--#{$variable-prefix}table-striped-color); + --#{$prefix}table-color-type: var(--#{$prefix}table-striped-color); + --#{$prefix}table-bg-type: var(--#{$prefix}table-striped-bg); + } +} + +// For columns +.table-striped-columns { + > :not(caption) > tr > :nth-child(#{$table-striped-columns-order}) { + --#{$prefix}table-color-type: var(--#{$prefix}table-striped-color); + --#{$prefix}table-bg-type: var(--#{$prefix}table-striped-bg); } } @@ -115,8 +129,8 @@ // The `.table-active` class can be added to highlight rows or cells .table-active { - --#{$variable-prefix}table-accent-bg: var(--#{$variable-prefix}table-active-bg); - color: var(--#{$variable-prefix}table-active-color); + --#{$prefix}table-color-state: var(--#{$prefix}table-active-color); + --#{$prefix}table-bg-state: var(--#{$prefix}table-active-bg); } // Hover effect @@ -125,8 +139,8 @@ .table-hover { > tbody > tr:hover > * { - --#{$variable-prefix}table-accent-bg: var(--#{$variable-prefix}table-hover-bg); - color: var(--#{$variable-prefix}table-hover-color); + --#{$prefix}table-color-state: var(--#{$prefix}table-hover-color); + --#{$prefix}table-bg-state: var(--#{$prefix}table-hover-bg); } } |
