feat: export all types related to components (#562)

* feat: export all types related to components

fix(tooltip): fix the vertical offset of the arrow

* refactor: optimize events of all popup related components

* test: append testcases for popup base component

* test: add testcase for visible events

* test: update snapshots
This commit is contained in:
witt
2021-06-23 23:05:59 +08:00
committed by unix
parent 7facec3849
commit de0c8fee97
117 changed files with 1062 additions and 586 deletions

View File

@@ -18,6 +18,8 @@ import { pickChild } from '../utils/collections'
import useCurrentState from '../utils/use-current-state'
import useScaleable, { filterScaleableProps, withScaleable } from '../use-scaleable'
export type AutoCompleteTypes = NormalTypes
export type AutoCompleteOption = {
label: string
value: string
@@ -29,7 +31,7 @@ export type AutoCompleteOptions = Array<
interface Props {
options?: AutoCompleteOptions
type?: NormalTypes
type?: AutoCompleteTypes
initialValue?: string
value?: string
onChange?: (value: string) => void
@@ -50,7 +52,7 @@ const defaultProps = {
initialValue: '',
disabled: false,
clearable: false,
type: 'default' as NormalTypes,
type: 'default' as AutoCompleteTypes,
disableMatchWidth: false,
disableFreeSolo: false,
className: '',
@@ -135,10 +137,10 @@ const AutoCompleteComponent = React.forwardRef<
}
return childrenToOptionsNode(options as Array<AutoCompleteOption>)
}, [searching, options])
const showClearIcon = useMemo(() => clearable && searching === undefined, [
clearable,
searching,
])
const showClearIcon = useMemo(
() => clearable && searching === undefined,
[clearable, searching],
)
const updateValue = (val: string) => {
if (disabled) return

View File

@@ -14,4 +14,10 @@ export type AutoCompleteComponentType = typeof AutoComplete & {
;(AutoComplete as AutoCompleteComponentType).Searching = AutoCompleteSearching
;(AutoComplete as AutoCompleteComponentType).Empty = AutoCompleteEmpty
export type {
AutoCompleteOption,
AutoCompleteOptions,
AutoCompleteProps,
AutoCompleteTypes,
} from './auto-complete'
export default AutoComplete as AutoCompleteComponentType