style: 格式化 packages/@ant/ 下所有文件以通过 biome ci

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-05-01 21:55:51 +08:00
parent c32f26cf21
commit 9ea9859dce
92 changed files with 5903 additions and 5188 deletions

View File

@@ -1,39 +1,39 @@
import React, { useCallback, useLayoutEffect, useRef, useState } from 'react'
import { useTerminalSize } from '../hooks/useTerminalSize.js'
import { useTerminalViewport } from '../hooks/use-terminal-viewport.js'
import { Box, type DOMElement, measureElement } from '../index.js'
import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
import { useTerminalSize } from '../hooks/useTerminalSize.js';
import { useTerminalViewport } from '../hooks/use-terminal-viewport.js';
import { Box, type DOMElement, measureElement } from '../index.js';
type Props = {
children: React.ReactNode
lock?: 'always' | 'offscreen'
}
children: React.ReactNode;
lock?: 'always' | 'offscreen';
};
export function Ratchet({ children, lock = 'always' }: Props): React.ReactNode {
const [viewportRef, { isVisible }] = useTerminalViewport()
const { rows } = useTerminalSize()
const innerRef = useRef<DOMElement | null>(null)
const maxHeight = useRef(0)
const [minHeight, setMinHeight] = useState(0)
const [viewportRef, { isVisible }] = useTerminalViewport();
const { rows } = useTerminalSize();
const innerRef = useRef<DOMElement | null>(null);
const maxHeight = useRef(0);
const [minHeight, setMinHeight] = useState(0);
const outerRef = useCallback(
(el: DOMElement | null) => {
viewportRef(el)
viewportRef(el);
},
[viewportRef],
)
);
const engaged = lock === 'always' || !isVisible
const engaged = lock === 'always' || !isVisible;
useLayoutEffect(() => {
if (!innerRef.current) {
return
return;
}
const { height } = measureElement(innerRef.current)
const { height } = measureElement(innerRef.current);
if (height > maxHeight.current) {
maxHeight.current = Math.min(height, rows)
setMinHeight(maxHeight.current)
maxHeight.current = Math.min(height, rows);
setMinHeight(maxHeight.current);
}
})
});
return (
<Box minHeight={engaged ? minHeight : undefined} ref={outerRef}>
@@ -41,5 +41,5 @@ export function Ratchet({ children, lock = 'always' }: Props): React.ReactNode {
{children}
</Box>
</Box>
)
);
}