99import { css , keyframes } from '@emotion/react' ;
1010
1111import { UseEuiTheme , tint , shade , transparentize } from '../../services' ;
12- import {
13- euiBackgroundColor ,
14- logicalCSS ,
15- mathWithUnits ,
16- } from '../../global_styling' ;
12+ import { euiBackgroundColor , logicalCSS } from '../../global_styling' ;
1713import { euiShadow } from '../../themes/amsterdam/global_styling/mixins' ;
1814
15+ import { euiTableVariables } from './table.styles' ;
16+
1917export const euiTableRowStyles = ( euiThemeContext : UseEuiTheme ) => {
2018 const { euiTheme } = euiThemeContext ;
2119
2220 const rowColors = _rowColorVariables ( euiThemeContext ) ;
2321 const expandedAnimationCss = _expandedRowAnimation ( euiThemeContext ) ;
2422
25- const cellContentPadding = euiTheme . size . s ;
26- const mobileColumns = {
27- actions : {
28- width : euiTheme . size . xxl ,
29- offset : mathWithUnits ( cellContentPadding , ( x ) => x * 2 ) ,
30- } ,
31- checkbox : {
32- width : mathWithUnits (
33- [ euiTheme . size . xl , euiTheme . size . xs ] ,
34- ( x , y ) => x + y
35- ) ,
36- offset : mathWithUnits ( cellContentPadding , ( x ) => x / 2 ) ,
37- } ,
38- } ;
23+ const { cellContentPadding, mobileSizes } =
24+ euiTableVariables ( euiThemeContext ) ;
3925
4026 return {
4127 euiTableRow : css `` ,
@@ -97,26 +83,26 @@ export const euiTableRowStyles = (euiThemeContext: UseEuiTheme) => {
9783 * Used for selection checkbox
9884 */
9985 selectable : css `
100- ${ logicalCSS ( 'padding-left' , mobileColumns . checkbox . width ) }
86+ ${ logicalCSS ( 'padding-left' , mobileSizes . checkbox . width ) }
10187
10288 .euiTableRowCellCheckbox {
10389 position : absolute;
10490 ${ logicalCSS ( 'top' , cellContentPadding ) }
105- ${ logicalCSS ( 'left' , mobileColumns . checkbox . offset ) }
91+ ${ logicalCSS ( 'left' , mobileSizes . checkbox . offset ) }
10692 }
10793 ` ,
10894 /**
10995 * Right column styles + border
11096 * Used for cell actions and row expander arrow
11197 */
11298 hasRightColumn : css `
113- ${ logicalCSS ( 'padding-right' , mobileColumns . actions . width ) }
99+ ${ logicalCSS ( 'padding-right' , mobileSizes . actions . width ) }
114100
115101 & ::after {
116102 content : '' ;
117103 position : absolute;
118104 ${ logicalCSS ( 'vertical' , 0 ) }
119- ${ logicalCSS ( 'right' , mobileColumns . actions . width ) }
105+ ${ logicalCSS ( 'right' , mobileSizes . actions . width ) }
120106 ${ logicalCSS ( 'width' , euiTheme . border . width . thin ) }
121107 background-color : ${ euiTheme . border . color } ;
122108 }
@@ -126,7 +112,7 @@ export const euiTableRowStyles = (euiThemeContext: UseEuiTheme) => {
126112 ${ logicalCSS ( 'right' , 0 ) }
127113 /* TODO: remove !important once euiTableRowCell is converted to Emotion */
128114 ${ logicalCSS ( 'min-width' , '0 !important' ) }
129- ${ logicalCSS ( 'width' , mobileColumns . actions . width ) }
115+ ${ logicalCSS ( 'width' , mobileSizes . actions . width ) }
130116
131117 .euiTableCellContent {
132118 display: flex;
@@ -140,23 +126,23 @@ export const euiTableRowStyles = (euiThemeContext: UseEuiTheme) => {
140126 return css `
141127 .euiTableRowCell--hasActions {
142128 ${ this . rightColumnContent }
143- ${ logicalCSS ( 'top' , mobileColumns . actions . offset ) }
129+ ${ logicalCSS ( 'top' , mobileSizes . actions . offset ) }
144130 }
145131 ` ;
146132 } ,
147133 get expandable ( ) {
148134 return css `
149135 .euiTableRowCell--isExpander {
150136 ${ this . rightColumnContent }
151- ${ logicalCSS ( 'bottom' , mobileColumns . actions . offset ) }
137+ ${ logicalCSS ( 'bottom' , mobileSizes . actions . offset ) }
152138 }
153139 ` ;
154140 } ,
155141 /**
156142 * Bottom of card - expanded rows
157143 */
158144 expanded : css `
159- ${ logicalCSS ( 'margin-top' , `-${ mobileColumns . actions . offset } ` ) }
145+ ${ logicalCSS ( 'margin-top' , `-${ mobileSizes . actions . offset } ` ) }
160146 /* Padding accounting for the checkbox is already applied via the content */
161147 ${ logicalCSS ( 'padding-left' , cellContentPadding ) }
162148
0 commit comments