ktongue's picture
download
raw
1.17 kB
import * as React from 'react'
import isPropValid from '@emotion/is-prop-valid'
import { StyledOptions, ElementType } from './types'
const testOmitPropsOnStringTag = isPropValid
const testOmitPropsOnComponent = (key: string) => key !== 'theme'
export const getDefaultShouldForwardProp = (tag: React.ElementType) =>
typeof tag === 'string' &&
// 96 is one less than the char code
// for "a" so this is checking that
// it's a lowercase character
tag.charCodeAt(0) > 96
? testOmitPropsOnStringTag
: testOmitPropsOnComponent
export const composeShouldForwardProps = (
tag: ElementType,
options: StyledOptions | undefined,
isReal: boolean
) => {
let shouldForwardProp
if (options) {
const optionsShouldForwardProp = options.shouldForwardProp
shouldForwardProp =
tag.__emotion_forwardProp && optionsShouldForwardProp
? (propName: string) =>
tag.__emotion_forwardProp!(propName) &&
optionsShouldForwardProp(propName)
: optionsShouldForwardProp
}
if (typeof shouldForwardProp !== 'function' && isReal) {
shouldForwardProp = tag.__emotion_forwardProp
}
return shouldForwardProp
}

Xet Storage Details

Size:
1.17 kB
·
Xet hash:
dd8bdf26927544cb331c21921202b65ba2132b057b8a25ab43f4ace33a646074

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.