Repository URL to install this package:
|
Version:
4.0.61 ▾
|
import React from 'react'
import { omit } from '@skava/utils'
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 Wrapper = toWrap(props)
return {
...remaining,
Wrapper,
placeholder,
}
}
// @todo renderWrap too or render for textarea
export function toWrap(props: TextAreaProps) {
return props.nowrap === true ? React.Fragment : TextAreaWrap
}