feat(textarea): add component

This commit is contained in:
unix
2020-03-29 08:32:26 +08:00
parent c22ec2acc6
commit 1f52f14370
6 changed files with 258 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
import Input from './input'
import Textarea from '../textarea'
Input.Textarea = Textarea
export default Input

View File

@@ -1,9 +1,9 @@
import React, { useEffect, useMemo, useState } from 'react'
import withDefaults from '../utils/with-defaults'
import useTheme from '../styles/use-theme'
import InputLabel from './input-label'
import InputIcon from './input-icon'
import InputClearIcon from './input-icon-clear'
import Textarea from '../textarea/textarea'
import { getSizes, getColors } from './styles'
import { NormalSizes, NormalTypes } from '../utils/prop-types'
@@ -193,4 +193,12 @@ const Input: React.FC<InputProps> = ({
)
}
export default withDefaults(Input, defaultProps)
type InputComponent<P = {}> = React.FC<P> & {
Textarea: typeof Textarea
}
type ComponentProps = Partial<typeof defaultProps> & Omit<Props, keyof typeof defaultProps>
(Input as InputComponent<ComponentProps>).defaultProps = defaultProps
export default Input as InputComponent<ComponentProps>