mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-24 04:15:54 +08:00
feat(textarea): add component
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import Input from './input'
|
||||
import Textarea from '../textarea'
|
||||
|
||||
Input.Textarea = Textarea
|
||||
|
||||
export default Input
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user