Repository URL to install this package:
Version:
0.9.5 ▾
|
import React from 'react'
import { omit } from '@skava/modules/___dist/utils/omit'
import { defaultProps, omitKeys } from './fixture'
import { TextAreaProps, PassThroughTextAreaProps, StandardTextAreaProps } from './typings'
import { TextAreaWrap } from './styled'
export function toPlaceholder(props: TextAreaProps): string {
return props.placeholder || props.placeHolder
}
export function toPassThrough(props: TextAreaProps) {
return omit(props, omitKeys)
}
export function toAttributes(props: TextAreaProps) {
const remaining = toPassThrough(props)
const placeholder = toPlaceholder(props)
const Wrap = toWrap(props)
return {
...remaining,
Wrap,
placeholder,
}
}
// @todo renderWrap too or render for textarea
export function toWrap(props: TextAreaProps) {
return props.nowrap === true ? React.Fragment : TextAreaWrap
}