diff --git a/packages/components/docs/sass.md b/packages/components/docs/sass.md index bd5911cadad3..d6c7bfb4d0d9 100644 --- a/packages/components/docs/sass.md +++ b/packages/components/docs/sass.md @@ -3691,7 +3691,6 @@ $spacing-03: $carbon--spacing-03; - [snippet [mixin]](#snippet-mixin) - [data-table-v2-action [mixin]](#data-table-v2-action-mixin) - [data-table-core [mixin]](#data-table-core-mixin) - - [data-table-expandable [mixin]](#data-table-expandable-mixin) - [data-table-sort [mixin]](#data-table-sort-mixin) - [modal [mixin]](#modal-mixin) - [select [mixin]](#select-mixin) @@ -15776,7 +15775,7 @@ Data table core styles .#{$prefix}--data-table th, .#{$prefix}--data-table td { - vertical-align: top; + vertical-align: middle; text-align: left; } @@ -15797,8 +15796,8 @@ Data table core styles } .#{$prefix}--data-table .#{$prefix}--table-header-label { - display: block; - padding: rem(14px) $spacing-05; + padding-left: $spacing-05; + padding-right: $spacing-05; text-align: left; } @@ -15808,8 +15807,8 @@ Data table core styles color: $text-02; border-top: 1px solid $ui-01; border-bottom: 1px solid $ui-03; - padding: rem(14px) $spacing-05; - padding-bottom: rem(13px); + padding-left: $spacing-05; + padding-right: $spacing-05; + td:first-of-type { padding-left: $spacing-04; @@ -15948,22 +15947,33 @@ Data table core styles // Do not use `position: relative`, as its behavior is undefined for many table elements: https://www.w3.org/TR/CSS21/visuren.html#propdef-position position: static; background: $ui-03; - padding: rem(12px) $spacing-03 0 $spacing-05; + padding-left: $spacing-05; + padding-right: $spacing-05; width: rem( 44px ); // 16px padding left + 8px padding right + 20px checkbox width transition: background-color $duration--fast-01 motion(entrance, productive); } - .#{$prefix}--data-table td.#{$prefix}--table-column-checkbox { - padding-top: rem(11px); - padding-bottom: 0; + .#{$prefix}--data-table--tall .#{$prefix}--table-column-checkbox { + padding-top: rem(13px); + } + + .#{$prefix}--data-table--tall .#{$prefix}--table-column-radio { + padding-top: $spacing-05; } .#{$prefix}--date-table tbody th.#{$prefix}--table-column-checkbox:hover { background: $data-table-column-hover; } + //---------------------------------------------------------------------------- + // Radio + //---------------------------------------------------------------------------- + .#{$prefix}--table-column-radio { + width: 48px; + } + // default selected row + zebra select - even child .#{$prefix}--data-table--zebra tbody @@ -16120,13 +16130,13 @@ Data table core styles padding-top: 1rem; } - .#{$prefix}--data-table--cell-secondary-text { - @include type-style('label-01'); + .#{$prefix}--data-table--tall th, + .#{$prefix}--data-table--tall td { + vertical-align: top; } - .#{$prefix}--data-table.#{$prefix}--data-table--tall - .#{$prefix}--table-column-checkbox { - padding-top: rem(12px); + .#{$prefix}--data-table--cell-secondary-text { + @include type-style('label-01'); } //---------------------------------------------------------------------------- @@ -16358,7 +16368,7 @@ Data table expandable styles } tr.#{$prefix}--parent-row.#{$prefix}--expandable-row:hover td:first-of-type { - border-bottom: 1px solid transparent; // first td doesn't have a visible border + border-bottom: 1px solid $hover-ui; // first td doesn't have a visible border } // child row when hovering on expanded parent @@ -16398,12 +16408,20 @@ Data table expandable styles .#{$prefix}--data-table td.#{$prefix}--table-expand { width: 2.5rem; min-width: 2.5rem; - height: 3rem; - vertical-align: top; - padding: 0; border-bottom: 1px solid $ui-03; } + .#{$prefix}--data-table td.#{$prefix}--table-expand, + th.#{$prefix}--table-expand { + padding: 0 $spacing-05; + } + + .#{$prefix}--data-table--tall td.#{$prefix}--table-expand, + .#{$prefix}--data-table--tall th.#{$prefix}--table-expand { + padding-top: rem(16px); + padding-bottom: rem(16px); + } + .#{$prefix}--data-table td.#{$prefix}--table-expand[data-previous-value='collapsed'] { border-bottom: 1px solid transparent; @@ -16417,15 +16435,8 @@ Data table expandable styles .#{$prefix}--table-expand__button { @include button-reset('false'); - display: flex; - justify-content: space-around; - align-items: center; - height: 100%; - width: 100%; - } - - .#{$prefix}--data-table--short .#{$prefix}--table-expand__button { - height: auto; + height: rem(16px); + vertical-align: inherit; } .#{$prefix}--table-expand__button:focus { @@ -16442,17 +16453,6 @@ Data table expandable styles transition: transform $duration--moderate-01 motion(standard, productive); } - th.#{$prefix}--table-expand { - position: relative; - vertical-align: middle; - padding-left: $spacing-05; - padding-right: $spacing-05; - } - - th.#{$prefix}--table-expand + th.#{$prefix}--table-column-checkbox { - padding-left: $spacing-03; - } - // fix expanded parent separating border length tr.#{$prefix}--parent-row.#{$prefix}--expandable-row td.#{$prefix}--table-expand @@ -16624,7 +16624,6 @@ Data table expandable styles - [text-01 [variable]](#text-01-variable) - [focus [variable]](#focus-variable) - [ui-05 [variable]](#ui-05-variable) - - [spacing-03 [variable]](#spacing-03-variable) - [ui-01 [variable]](#ui-01-variable) - [hover-field [variable]](#hover-field-variable) - [selected-ui [variable]](#selected-ui-variable) diff --git a/packages/components/src/components/data-table/_data-table-core.scss b/packages/components/src/components/data-table/_data-table-core.scss index e426067f4fe3..6470f18c9a0e 100644 --- a/packages/components/src/components/data-table/_data-table-core.scss +++ b/packages/components/src/components/data-table/_data-table-core.scss @@ -87,7 +87,7 @@ .#{$prefix}--data-table th, .#{$prefix}--data-table td { - vertical-align: top; + vertical-align: middle; text-align: left; } @@ -108,8 +108,8 @@ } .#{$prefix}--data-table .#{$prefix}--table-header-label { - display: block; - padding: rem(14px) $spacing-05; + padding-left: $spacing-05; + padding-right: $spacing-05; text-align: left; } @@ -119,8 +119,8 @@ color: $text-02; border-top: 1px solid $ui-01; border-bottom: 1px solid $ui-03; - padding: rem(14px) $spacing-05; - padding-bottom: rem(13px); + padding-left: $spacing-05; + padding-right: $spacing-05; + td:first-of-type { padding-left: $spacing-04; @@ -259,22 +259,33 @@ // Do not use `position: relative`, as its behavior is undefined for many table elements: https://www.w3.org/TR/CSS21/visuren.html#propdef-position position: static; background: $ui-03; - padding: rem(12px) $spacing-03 0 $spacing-05; + padding-left: $spacing-05; + padding-right: $spacing-05; width: rem( 44px ); // 16px padding left + 8px padding right + 20px checkbox width transition: background-color $duration--fast-01 motion(entrance, productive); } - .#{$prefix}--data-table td.#{$prefix}--table-column-checkbox { - padding-top: rem(11px); - padding-bottom: 0; + .#{$prefix}--data-table--tall .#{$prefix}--table-column-checkbox { + padding-top: rem(13px); + } + + .#{$prefix}--data-table--tall .#{$prefix}--table-column-radio { + padding-top: $spacing-05; } .#{$prefix}--date-table tbody th.#{$prefix}--table-column-checkbox:hover { background: $data-table-column-hover; } + //---------------------------------------------------------------------------- + // Radio + //---------------------------------------------------------------------------- + .#{$prefix}--table-column-radio { + width: 48px; + } + // default selected row + zebra select - even child .#{$prefix}--data-table--zebra tbody @@ -431,13 +442,13 @@ padding-top: 1rem; } - .#{$prefix}--data-table--cell-secondary-text { - @include type-style('label-01'); + .#{$prefix}--data-table--tall th, + .#{$prefix}--data-table--tall td { + vertical-align: top; } - .#{$prefix}--data-table.#{$prefix}--data-table--tall - .#{$prefix}--table-column-checkbox { - padding-top: rem(12px); + .#{$prefix}--data-table--cell-secondary-text { + @include type-style('label-01'); } //---------------------------------------------------------------------------- diff --git a/packages/components/src/components/data-table/_data-table-expandable.scss b/packages/components/src/components/data-table/_data-table-expandable.scss index b659c039d901..4fd88e227a37 100644 --- a/packages/components/src/components/data-table/_data-table-expandable.scss +++ b/packages/components/src/components/data-table/_data-table-expandable.scss @@ -120,7 +120,7 @@ } tr.#{$prefix}--parent-row.#{$prefix}--expandable-row:hover td:first-of-type { - border-bottom: 1px solid transparent; // first td doesn't have a visible border + border-bottom: 1px solid $hover-ui; // first td doesn't have a visible border } // child row when hovering on expanded parent @@ -160,12 +160,20 @@ .#{$prefix}--data-table td.#{$prefix}--table-expand { width: 2.5rem; min-width: 2.5rem; - height: 3rem; - vertical-align: top; - padding: 0; border-bottom: 1px solid $ui-03; } + .#{$prefix}--data-table td.#{$prefix}--table-expand, + th.#{$prefix}--table-expand { + padding: 0 $spacing-05; + } + + .#{$prefix}--data-table--tall td.#{$prefix}--table-expand, + .#{$prefix}--data-table--tall th.#{$prefix}--table-expand { + padding-top: rem(16px); + padding-bottom: rem(16px); + } + .#{$prefix}--data-table td.#{$prefix}--table-expand[data-previous-value='collapsed'] { border-bottom: 1px solid transparent; @@ -179,15 +187,8 @@ .#{$prefix}--table-expand__button { @include button-reset('false'); - display: flex; - justify-content: space-around; - align-items: center; - height: 100%; - width: 100%; - } - - .#{$prefix}--data-table--short .#{$prefix}--table-expand__button { - height: auto; + height: rem(16px); + vertical-align: inherit; } .#{$prefix}--table-expand__button:focus { @@ -204,17 +205,6 @@ transition: transform $duration--moderate-01 motion(standard, productive); } - th.#{$prefix}--table-expand { - position: relative; - vertical-align: middle; - padding-left: $spacing-05; - padding-right: $spacing-05; - } - - th.#{$prefix}--table-expand + th.#{$prefix}--table-column-checkbox { - padding-left: $spacing-03; - } - // fix expanded parent separating border length tr.#{$prefix}--parent-row.#{$prefix}--expandable-row td.#{$prefix}--table-expand diff --git a/packages/react/src/components/DataTable/TableHeader.js b/packages/react/src/components/DataTable/TableHeader.js index d0575959f471..3670e09e63cf 100644 --- a/packages/react/src/components/DataTable/TableHeader.js +++ b/packages/react/src/components/DataTable/TableHeader.js @@ -70,7 +70,7 @@ const TableHeader = React.forwardRef(function TableHeader( scope={scope} colSpan={colSpan} ref={ref}> - {children} +
{children}
); } @@ -92,7 +92,7 @@ const TableHeader = React.forwardRef(function TableHeader( ref={ref} scope={scope}>