88
99import { css , keyframes } from '@emotion/react' ;
1010
11- import { logicalCSS , euiCantAnimate } from '../../global_styling' ;
11+ import {
12+ logicalCSS ,
13+ euiCantAnimate ,
14+ highContrastModeStyles ,
15+ preventForcedColors ,
16+ } from '../../global_styling' ;
1217import { UseEuiTheme } from '../../services' ;
1318
1419const tableLoadingLine = keyframes `
@@ -33,23 +38,40 @@ const tableLoadingLine = keyframes`
3338 }
3439` ;
3540
36- export const euiBasicTableBodyLoading = ( { euiTheme } : UseEuiTheme ) => css `
37- position: relative;
38- overflow: hidden;
39-
40- & ::before {
41- position : absolute;
42- content : '' ;
43- ${ logicalCSS ( 'width' , '100%' ) }
44- ${ logicalCSS ( 'height' , euiTheme . border . width . thick ) }
45- background-color : ${ euiTheme . colors . primary } ;
46- animation : ${ tableLoadingLine } 1s linear infinite;
47-
48- ${ euiCantAnimate } {
49- animation-duration : 2s ;
41+ export const euiBasicTableBodyLoading = ( euiThemeContext : UseEuiTheme ) => {
42+ const { euiTheme } = euiThemeContext ;
43+
44+ return css `
45+ position: relative;
46+ overflow: hidden;
47+
48+ & ::before {
49+ position : absolute;
50+ content : '' ;
51+ ${ logicalCSS ( 'width' , '100%' ) }
52+ ${ logicalCSS ( 'height' , euiTheme . border . width . thick ) }
53+ background-color : ${ euiTheme . colors . primary } ;
54+ animation : ${ tableLoadingLine } 1s linear infinite;
55+
56+ ${ euiCantAnimate } {
57+ animation : none;
58+ background : repeating-linear-gradient (
59+ -45deg ,
60+ ${ euiTheme . colors . backgroundBasePlain } ,
61+ ${ euiTheme . colors . backgroundBasePlain } ${ euiTheme . size . xs } ,
62+ ${ euiTheme . colors . primary } ${ euiTheme . size . xs } ,
63+ ${ euiTheme . colors . primary } ${ euiTheme . size . s }
64+ );
65+
66+ ${ highContrastModeStyles ( euiThemeContext , {
67+ forced : `
68+ ${ preventForcedColors ( euiThemeContext ) }
69+ ` ,
70+ } ) }
71+ }
5072 }
51- }
52- ` ;
73+ ` ;
74+ } ;
5375
5476// Fix to make the loading indicator position correctly in Safari
5577// For whatever annoying reason, Safari doesn't respect `position: relative;`
0 commit comments