Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get containsTruncateText () {
let truncateText = false
React.Children.forEach(this.props.children, (child) => {
if (child && matchComponentTypes(child, ['TruncateText'])) {
truncateText = true
}
})
warn( // if display prop is used, warn about icon or TruncateText
!truncateText || this.props.display === undefined,
'[Link] Using the display property with TruncateText may cause layout issues.'
)
return truncateText
}
renderIcon () {
warn( // if display prop is used, warn about icon or TruncateText
this.props.display === undefined,
'[Link] Using the display property with an icon may cause layout issues.'
)
return <span>{callRenderProp(this.props.renderIcon)}</span>
}
hackProps.forEach((hackProp) => {
warn(
(typeof props[hackProp] === 'undefined'),
`[${displayName}] The \`${hackProp}\` prop is a temporary hack and will be removed in a future release. ${message}`
)
})
}
return iframes.map((iframe) => {
let body = null
try {
body = iframe.contentDocument.body
} catch (e) {
warn(false, `[ui-a11y] could not find a document for iframe: ${e}`, iframe)
}
return body
})
.filter(body => body !== null)
getChildContext () {
let theme = this.props.theme || {}
const parentThemeContext = ThemeContext.getThemeContext(this.context) || {}
if (parentThemeContext.immutable && parentThemeContext.theme) {
warn(
!this.props.theme,
'[ApplyTheme] Parent theme is immutable. Cannot apply theme: %O',
this.props.theme
)
theme = parentThemeContext.theme
} else if (parentThemeContext.theme) {
theme = mergeDeep(parentThemeContext.theme, theme)
}
return ThemeContext.makeThemeContext(theme, parentThemeContext.immutable || this.props.immutable)
}
experimentalProps.forEach((experimentalProp) => {
warn(
(typeof props[experimentalProp] === 'undefined'),
`[${displayName}] The \`${experimentalProp}\` prop is experimental and its API could change significantly in a future release. ${message}`
)
})
}
return (props, propName, componentName, ...rest) => {
const isDeprecatedValue = deprecated.includes(props[propName])
const warningMessage = (message && typeof message === 'function') ? message({ props, propName, propValue: props[propName] }) : (
`The '${props[propName]}' value for the \`${propName}\` prop is deprecated. ${message || ''}`
)
warn(!isDeprecatedValue, `[${componentName}] ${warningMessage}`)
return isDeprecatedValue ? null : propType(props, propName, componentName, ...rest)
}
}
React.Children.forEach(children, (child) => {
const icon = child && child.type && typeof child.type.glyphName !== 'undefined'
warn(
!icon,
`[Button] Icons as children is deprecated. Please use the 'icon' prop instead.`
)
})
}
function setTextDirection () {
if (hasRan) return
hasRan = true
if (canUseDOM) {
const dir = document.documentElement.getAttribute('dir')
if (!dir) {
warn(dir,
`[themeable] component styles require setting a 'dir' attribute on the HTML element.
To prevent breaking changes, we'll set it to a default value: 'ltr'.`
)
document.documentElement.setAttribute('dir', 'ltr')
}
}
}
function warnExperimentalComponent (displayName, message = '') {
warn(
false,
`[${displayName}] is experimental and its API could change significantly in a future release. ${message}`
)
}