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

@@ -1,3 +1,4 @@
import Slider from './slider'
export type { SliderProps, SliderTypes } from './slider'
export default Slider

View File

@@ -15,10 +15,11 @@ import { getColors } from './styles'
import { NormalTypes } from '../utils/prop-types'
import useScaleable, { withScaleable } from '../use-scaleable'
export type SliderTypes = NormalTypes
interface Props {
hideValue?: boolean
value?: number
type?: NormalTypes
type?: SliderTypes
initialValue?: number
step?: number
max?: number
@@ -31,7 +32,7 @@ interface Props {
const defaultProps = {
hideValue: false,
type: 'default' as NormalTypes,
type: 'default' as SliderTypes,
initialValue: 0,
step: 1,
min: 0,
@@ -92,11 +93,10 @@ const SliderComponent: React.FC<React.PropsWithChildren<SliderProps>> = ({
const sliderRef = useRef<HTMLDivElement>(null)
const dotRef = useRef<HTMLDivElement>(null)
const currentRatio = useMemo(() => ((value - min) / (max - min)) * 100, [
value,
max,
min,
])
const currentRatio = useMemo(
() => ((value - min) / (max - min)) * 100,
[value, max, min],
)
const setLastOffsetManually = (val: number) => {
const width = getRefWidth(sliderRef)