office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
87 lines • 3.54 kB
JavaScript
import { keyframes, getGlobalClassNames, hiddenContentStyle, HighContrastSelector } from '../../Styling';
import { getRTL } from '../../Utilities';
var GlobalClassNames = {
root: 'ms-Shimmer-container',
shimmerWrapper: 'ms-Shimmer-shimmerWrapper',
dataWrapper: 'ms-Shimmer-dataWrapper'
};
var BACKGROUND_OFF_SCREEN_POSITION = '1000%';
var shimmerAnimation = keyframes({
'0%': {
backgroundPosition: "-" + BACKGROUND_OFF_SCREEN_POSITION
},
'100%': {
backgroundPosition: BACKGROUND_OFF_SCREEN_POSITION
}
});
var shimmerAnimationRTL = keyframes({
'100%': {
backgroundPosition: "-" + BACKGROUND_OFF_SCREEN_POSITION
},
'0%': {
backgroundPosition: BACKGROUND_OFF_SCREEN_POSITION
}
});
export function getStyles(props) {
var isDataLoaded = props.isDataLoaded, className = props.className, theme = props.theme, transitionAnimationInterval = props.transitionAnimationInterval;
var palette = theme.palette;
var classNames = getGlobalClassNames(GlobalClassNames, theme);
var isRTL = getRTL();
return {
root: [
classNames.root,
{
position: 'relative',
height: 'auto'
},
className
],
shimmerWrapper: [
classNames.shimmerWrapper,
{
background: palette.neutralLighter + "\n linear-gradient(\n to right,\n " + palette.neutralLighter + " 0%,\n " + palette.neutralLight + " 50%,\n " + palette.neutralLighter + " 100%)\n 0 0 / 90% 100%\n no-repeat",
animationDuration: '2s',
animationTimingFunction: 'ease-in-out',
animationDirection: 'normal',
animationIterationCount: 'infinite',
animationName: isRTL ? shimmerAnimationRTL : shimmerAnimation,
transition: "opacity " + transitionAnimationInterval + "ms",
selectors: (_a = {},
_a[HighContrastSelector] = {
background: "WindowText\n linear-gradient(\n to right,\n transparent 0%,\n Window 50%,\n transparent 100%)\n 0 0 / 90% 100%\n no-repeat"
},
_a)
},
isDataLoaded && {
opacity: '0',
position: 'absolute',
top: '0',
bottom: '0',
left: '0',
right: '0'
}
],
dataWrapper: [
classNames.dataWrapper,
{
position: 'absolute',
top: '0',
bottom: '0',
left: '0',
right: '0',
opacity: '0',
background: 'none',
backgroundColor: 'transparent',
border: 'none',
transition: "opacity " + transitionAnimationInterval + "ms"
},
isDataLoaded && {
opacity: '1',
position: 'static'
}
],
screenReaderText: hiddenContentStyle
};
var _a;
}
//# sourceMappingURL=Shimmer.styles.js.map