You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
4.3 KiB

3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //
  2. // Basic Bootstrap table
  3. //
  4. .table {
  5. --#{$prefix}table-color: #{$table-color};
  6. --#{$prefix}table-bg: #{$table-bg};
  7. --#{$prefix}table-border-color: #{$table-border-color};
  8. --#{$prefix}table-accent-bg: #{$table-accent-bg};
  9. --#{$prefix}table-striped-color: #{$table-striped-color};
  10. --#{$prefix}table-striped-bg: #{$table-striped-bg};
  11. --#{$prefix}table-active-color: #{$table-active-color};
  12. --#{$prefix}table-active-bg: #{$table-active-bg};
  13. --#{$prefix}table-hover-color: #{$table-hover-color};
  14. --#{$prefix}table-hover-bg: #{$table-hover-bg};
  15. width: 100%;
  16. margin-bottom: $spacer;
  17. color: var(--#{$prefix}table-color);
  18. vertical-align: $table-cell-vertical-align;
  19. border-color: var(--#{$prefix}table-border-color);
  20. // Target th & td
  21. // We need the child combinator to prevent styles leaking to nested tables which doesn't have a `.table` class.
  22. // We use the universal selectors here to simplify the selector (else we would need 6 different selectors).
  23. // Another advantage is that this generates less code and makes the selector less specific making it easier to override.
  24. // stylelint-disable-next-line selector-max-universal
  25. > :not(caption) > * > * {
  26. padding: $table-cell-padding-y $table-cell-padding-x;
  27. background-color: var(--#{$prefix}table-bg);
  28. border-bottom-width: $table-border-width;
  29. box-shadow: inset 0 0 0 9999px var(--#{$prefix}table-accent-bg);
  30. }
  31. > tbody {
  32. vertical-align: inherit;
  33. }
  34. > thead {
  35. vertical-align: bottom;
  36. }
  37. }
  38. .table-group-divider {
  39. border-top: ($table-border-width * 2) solid $table-group-separator-color;
  40. }
  41. //
  42. // Change placement of captions with a class
  43. //
  44. .caption-top {
  45. caption-side: top;
  46. }
  47. //
  48. // Condensed table w/ half padding
  49. //
  50. .table-sm {
  51. // stylelint-disable-next-line selector-max-universal
  52. > :not(caption) > * > * {
  53. padding: $table-cell-padding-y-sm $table-cell-padding-x-sm;
  54. }
  55. }
  56. // Border versions
  57. //
  58. // Add or remove borders all around the table and between all the columns.
  59. //
  60. // When borders are added on all sides of the cells, the corners can render odd when
  61. // these borders do not have the same color or if they are semi-transparent.
  62. // Therefor we add top and border bottoms to the `tr`s and left and right borders
  63. // to the `td`s or `th`s
  64. .table-bordered {
  65. > :not(caption) > * {
  66. border-width: $table-border-width 0;
  67. // stylelint-disable-next-line selector-max-universal
  68. > * {
  69. border-width: 0 $table-border-width;
  70. }
  71. }
  72. }
  73. .table-borderless {
  74. // stylelint-disable-next-line selector-max-universal
  75. > :not(caption) > * > * {
  76. border-bottom-width: 0;
  77. }
  78. > :not(:first-child) {
  79. border-top-width: 0;
  80. }
  81. }
  82. // Zebra-striping
  83. //
  84. // Default zebra-stripe styles (alternating gray and transparent backgrounds)
  85. // For rows
  86. .table-striped {
  87. > tbody > tr:nth-of-type(#{$table-striped-order}) > * {
  88. --#{$prefix}table-accent-bg: var(--#{$prefix}table-striped-bg);
  89. color: var(--#{$prefix}table-striped-color);
  90. }
  91. }
  92. // For columns
  93. .table-striped-columns {
  94. > :not(caption) > tr > :nth-child(#{$table-striped-columns-order}) {
  95. --#{$prefix}table-accent-bg: var(--#{$prefix}table-striped-bg);
  96. color: var(--#{$prefix}table-striped-color);
  97. }
  98. }
  99. // Active table
  100. //
  101. // The `.table-active` class can be added to highlight rows or cells
  102. .table-active {
  103. --#{$prefix}table-accent-bg: var(--#{$prefix}table-active-bg);
  104. color: var(--#{$prefix}table-active-color);
  105. }
  106. // Hover effect
  107. //
  108. // Placed here since it has to come after the potential zebra striping
  109. .table-hover {
  110. > tbody > tr:hover > * {
  111. --#{$prefix}table-accent-bg: var(--#{$prefix}table-hover-bg);
  112. color: var(--#{$prefix}table-hover-color);
  113. }
  114. }
  115. // Table variants
  116. //
  117. // Table variants set the table cell backgrounds, border colors
  118. // and the colors of the striped, hovered & active tables
  119. @each $color, $value in $table-variants {
  120. @include table-variant($color, $value);
  121. }
  122. // Responsive tables
  123. //
  124. // Generate series of `.table-responsive-*` classes for configuring the screen
  125. // size of where your table will overflow.
  126. @each $breakpoint in map-keys($grid-breakpoints) {
  127. $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
  128. @include media-breakpoint-down($breakpoint) {
  129. .table-responsive#{$infix} {
  130. overflow-x: auto;
  131. -webkit-overflow-scrolling: touch;
  132. }
  133. }
  134. }