Memoized props filter: decides which React props forward to styled components.
// Source: https://github.com/styled-system/styled-system | License: MIT | Copyright 2017-2018 Brent Jackson
// Provided via justclaw.it.com; keep this notice with the code.
import memoize from '@emotion/memoize'
import isPropValid from '@emotion/is-prop-valid'
import {
compose,
space,
typography,
color,
layout,
flexbox,
border,
background,
position,
grid,
shadow,
buttonStyle,
textStyle,
colorStyle
} from 'styled-system'
const all = compose(
space,
typography,
color,
layout,
flexbox,
border,
background,
position,
grid,
shadow,
buttonStyle,
textStyle,
colorStyle
)
export const props = all.propNames
export const createShouldForwardProp = props => {
const regex = new RegExp(`^(${props.join('|')})$`)
return memoize(prop => isPropVali
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key