bulma/sass/elements/table.sass

151 lines
4.9 KiB
Sass
Raw Normal View History

2020-08-15 23:40:51 +00:00
$table-color: var(--text-strong, #{$text-strong}) !default
$table-background-color: var(--scheme-main, #{$scheme-main}) !default
2016-09-24 15:04:53 +00:00
2020-08-15 23:40:51 +00:00
$table-cell-border: 1px solid var(--border, #{$border}) !default
2017-07-28 20:05:15 +00:00
$table-cell-border-width: 0 0 1px !default
$table-cell-padding: 0.5em 0.75em !default
2020-08-15 23:40:51 +00:00
$table-cell-heading-color: var(--text-strong, #{$text-strong}) !default
2016-09-24 15:04:53 +00:00
2017-07-28 20:05:15 +00:00
$table-head-cell-border-width: 0 0 2px !default
2020-08-15 23:40:51 +00:00
$table-head-cell-color: var(--text-strong, #{$text-strong}) !default
2017-07-28 20:05:15 +00:00
$table-foot-cell-border-width: 2px 0 0 !default
2020-08-15 23:40:51 +00:00
$table-foot-cell-color: var(--text-strong, #{$text-strong}) !default
2017-04-15 16:08:30 +00:00
$table-head-background-color: transparent !default
$table-body-background-color: transparent !default
$table-foot-background-color: transparent !default
2020-08-15 23:40:51 +00:00
$table-row-hover-background-color: var(--scheme-main-bis, #{$scheme-main-bis}) !default
2017-04-15 16:08:30 +00:00
2020-08-15 23:40:51 +00:00
$table-row-active-background-color: var(--primary, #{$primary}) !default
$table-row-active-color: var(--primary-invert, #{$primary-invert}) !default
2017-07-28 20:05:15 +00:00
2020-08-15 23:40:51 +00:00
$table-striped-row-even-background-color: var(--scheme-main-bis, #{$scheme-main-bis}) !default
$table-striped-row-even-hover-background-color: var(--scheme-main-ter, #{$scheme-main-ter}) !default
2016-09-24 15:04:53 +00:00
$table-colors: $colors !default
2016-01-24 00:03:43 +00:00
.table
2020-08-15 23:40:51 +00:00
--table-body-background-color: #{$table-body-background-color}
--table-color: #{$table-color}
--table-cell-border-width: #{$table-cell-border-width}
--table-cell-border: #{$table-cell-border}
--table-cell-heading-color: #{$table-cell-heading-color}
--table-cell-padding: #{$table-cell-padding}
--table-foot-background-color: #{$table-foot-background-color}
--table-foot-cell-border-width: #{$table-foot-cell-border-width}
--table-foot-cell-color: #{$table-foot-cell-color}
--table-head-background-color: #{$table-head-background-color}
--table-head-cell-border-width: #{$table-head-cell-border-width}
--table-head-cell-color: #{$table-head-cell-color}
--table-row-active-background-color: #{$table-row-active-background-color}
--table-row-active-color: #{$table-row-active-color}
--table-row-hover-background-color: #{$table-row-hover-background-color}
--table-row-hover-background-color: #{$table-row-hover-background-color}
--table-striped-row-even-background-color: #{$table-striped-row-even-background-color}
--table-striped-row-even-hover-background-color: #{$table-striped-row-even-hover-background-color}
2018-09-04 13:24:50 +00:00
@extend %block
2020-08-15 23:40:51 +00:00
background-color: var(--table-body-background-color)
color: var(--table-color)
2016-04-10 15:27:27 +00:00
td,
th
2020-08-15 23:40:51 +00:00
border: var(--table-cell-border)
border-width: var(--table-cell-border-width)
padding: var(--table-cell-padding)
2016-01-24 00:03:43 +00:00
vertical-align: top
2017-07-31 16:42:53 +00:00
// Colors
@each $name, $pair in $table-colors
2017-07-31 16:42:53 +00:00
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
2020-08-15 23:40:51 +00:00
background-color: var(--#{$name}, #{$color})
border-color: var(--#{$name}, #{$color})
color: var(--#{$name}-invert, #{$color-invert})
2016-04-10 15:27:27 +00:00
// Modifiers
2016-04-18 20:50:59 +00:00
&.is-narrow
2016-01-24 00:03:43 +00:00
white-space: nowrap
width: 1%
&.is-selected
2020-08-15 23:40:51 +00:00
background-color: var(--table-row-active-background-color)
color: var(--table-row-active-color)
a,
strong
color: currentColor
&.is-vcentered
vertical-align: middle
2016-01-24 00:03:43 +00:00
th
2020-08-15 23:40:51 +00:00
color: var(--table-cell-heading-color)
&:not([align])
2020-01-20 19:39:09 +00:00
text-align: inherit
2016-01-24 00:03:43 +00:00
tr
2017-04-15 16:08:30 +00:00
&.is-selected
2020-08-15 23:40:51 +00:00
background-color: var(--table-row-active-background-color)
color: var(--table-row-active-color)
2017-04-15 16:08:30 +00:00
a,
strong
color: currentColor
td,
th
2020-08-15 23:40:51 +00:00
border-color: var(--table-row-active-color)
2017-04-15 16:08:30 +00:00
color: currentColor
2016-01-24 00:03:43 +00:00
thead
2020-08-15 23:40:51 +00:00
background-color: var(--table-head-background-color)
2016-04-10 15:27:27 +00:00
td,
th
2020-08-15 23:40:51 +00:00
border-width: var(--table-head-cell-border-width)
color: var(--table-head-cell-color)
2016-10-30 14:59:46 +00:00
tfoot
2020-08-15 23:40:51 +00:00
background-color: var(--table-foot-background-color)
2016-10-30 14:59:46 +00:00
td,
th
2020-08-15 23:40:51 +00:00
border-width: var(--table-foot-cell-border-width)
color: var(--table-foot-cell-color)
2016-04-10 15:27:27 +00:00
tbody
2020-08-15 23:40:51 +00:00
background-color: var(--table-body-background-color)
2016-04-10 15:27:27 +00:00
tr
&:last-child
td,
th
border-bottom-width: 0
// Modifiers
2016-01-24 00:03:43 +00:00
&.is-bordered
2016-04-10 15:27:27 +00:00
td,
th
2016-01-24 00:03:43 +00:00
border-width: 1px
tr
2016-04-10 15:27:27 +00:00
&:last-child
td,
th
border-bottom-width: 1px
2017-07-28 21:57:51 +00:00
&.is-fullwidth
width: 100%
2017-10-07 15:57:19 +00:00
&.is-hoverable
tbody
tr:not(.is-selected)
2017-10-07 15:57:19 +00:00
&:hover
2020-08-15 23:40:51 +00:00
background-color: var(--table-row-hover-background-color)
2017-10-07 15:57:19 +00:00
&.is-striped
tbody
tr:not(.is-selected)
&:hover
2020-08-15 23:40:51 +00:00
background-color: var(--table-row-hover-background-color)
&:nth-child(even)
2020-08-15 23:40:51 +00:00
background-color: var(--table-striped-row-even-hover-background-color)
2016-01-24 00:03:43 +00:00
&.is-narrow
2016-04-10 15:27:27 +00:00
td,
th
2016-10-30 12:20:51 +00:00
padding: 0.25em 0.5em
2016-01-24 00:03:43 +00:00
&.is-striped
tbody
2017-05-05 10:08:53 +00:00
tr:not(.is-selected)
2016-09-24 15:04:53 +00:00
&:nth-child(even)
2020-08-15 23:40:51 +00:00
background-color: var(--table-striped-row-even-background-color)
2018-03-26 14:33:31 +00:00
.table-container
2018-09-04 13:24:50 +00:00
@extend %block
2018-03-26 14:33:31 +00:00
+overflow-touch
overflow: auto
overflow-y: hidden
2018-04-09 13:15:31 +00:00
max-width: 100%