This commit is contained in:
2026-05-25 17:08:18 +08:00
parent df501f6151
commit f1259b71b5
9178 changed files with 1626125 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
"use client";
import * as React from 'react';
import { useRef } from 'react';
import raf from "@rc-component/util/es/raf";
import { composeRef } from "@rc-component/util/es/ref";
import Tooltip from '../tooltip';
const SliderTooltip = /*#__PURE__*/React.forwardRef((props, ref) => {
const {
open,
draggingDelete,
value
} = props;
const innerRef = useRef(null);
const mergedOpen = open && !draggingDelete;
const rafRef = useRef(null);
function cancelKeepAlign() {
raf.cancel(rafRef.current);
rafRef.current = null;
}
function keepAlign() {
rafRef.current = raf(() => {
innerRef.current?.forceAlign();
rafRef.current = null;
});
}
React.useEffect(() => {
if (mergedOpen) {
keepAlign();
} else {
cancelKeepAlign();
}
return cancelKeepAlign;
}, [mergedOpen, props.title, value]);
return /*#__PURE__*/React.createElement(Tooltip, {
ref: composeRef(innerRef, ref),
...props,
open: mergedOpen
});
});
if (process.env.NODE_ENV !== 'production') {
SliderTooltip.displayName = 'SliderTooltip';
}
export default SliderTooltip;