import _ from 'lodash' ; import { ThemedStyledComponentsModule } from 'styled-components' ; import styledComponents , { createGlobalStyle as styledCreateGlobalStyle , css as styledCss , keyframes as styledKeyframes , ThemeProvider as StyledThemeProvider , withTheme as styledWithTheme , } from 'styled-components/macro' ; import ITheme from 'styled/theme' ; declare module 'styled-components' { interface DefaultTheme extends ITheme { } } /**
 * Themed styled-components.
 */ const { default : styled , createGlobalStyle , css , keyframes , ThemeProvider , withTheme , } = { default : styledComponents , createGlobalStyle : styledCreateGlobalStyle , css : styledCss , keyframes : styledKeyframes , ThemeProvider : StyledThemeProvider , withTheme : styledWithTheme , } as ThemedStyledComponentsModule < ITheme > ; /**
 * withTheme HOC props interface.
 */ export interface ThemeProps { theme : ITheme ; } /**
 * Re-exports styled-components with our theme interface.
 */ export { createGlobalStyle , css , keyframes , ThemeProvider , withTheme } ; export default styled ; param path return export function prop ( path ) { return < Props > ( props ) => _ . get ( props , path ) as any ; } param path return export function theme ( path ) { return < Props , Theme > ( props ) => _ . get ( props , `theme.${ path }` ) as string | number ; } param pathAndUnit param mutation return export function size ( pathAndUnit , mutation = 0 ) { const [ path , unit = 'px' ] = pathAndUnit . split ( ':' ) ; return < Props , Theme > ( props ) => { let value = _ . get ( props , `theme.${ path }` ) ; if ( mutation === 'double' ) { value *= 2 ; } else { value += mutation ; } return `${ value }${ unit }` ; } ; } param needle param pass param fail return export function ifProp < Props extends object , Pass , Fail > ( needle , pass , fail ) { return ( props ) => { const result = _ . isString ( needle ) ? _ . get ( props , needle ) : ! _ . difference ( _ . at ( props , _ . keys ( needle ) as Array < keyof Props > ) , _ . values ( needle ) ) . length ; return result ? pass : fail ; } ; }