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,48 +1,43 @@
import React from 'react'
import { Text } from '../index.js'
import type { Theme } from './theme-types.js'
import React from 'react';
import { Text } from '../index.js';
import type { Theme } from './theme-types.js';
type Props = {
/**
* How much progress to display, between 0 and 1 inclusive
*/
ratio: number // [0, 1]
ratio: number; // [0, 1]
/**
* How many characters wide to draw the progress bar
*/
width: number // how many characters wide
width: number; // how many characters wide
/**
* Optional color for the filled portion of the bar
*/
fillColor?: keyof Theme
fillColor?: keyof Theme;
/**
* Optional color for the empty portion of the bar
*/
emptyColor?: keyof Theme
}
emptyColor?: keyof Theme;
};
const BLOCKS = [' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉', '█']
const BLOCKS = [' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉', '█'];
export function ProgressBar({
ratio: inputRatio,
width,
fillColor,
emptyColor,
}: Props): React.ReactNode {
const ratio = Math.min(1, Math.max(0, inputRatio))
const whole = Math.floor(ratio * width)
const segments = [BLOCKS[BLOCKS.length - 1]!.repeat(whole)]
export function ProgressBar({ ratio: inputRatio, width, fillColor, emptyColor }: Props): React.ReactNode {
const ratio = Math.min(1, Math.max(0, inputRatio));
const whole = Math.floor(ratio * width);
const segments = [BLOCKS[BLOCKS.length - 1]!.repeat(whole)];
if (whole < width) {
const remainder = ratio * width - whole
const middle = Math.floor(remainder * BLOCKS.length)
segments.push(BLOCKS[middle]!)
const remainder = ratio * width - whole;
const middle = Math.floor(remainder * BLOCKS.length);
segments.push(BLOCKS[middle]!);
const empty = width - whole - 1
const empty = width - whole - 1;
if (empty > 0) {
segments.push(BLOCKS[0]!.repeat(empty))
segments.push(BLOCKS[0]!.repeat(empty));
}
}
@@ -50,5 +45,5 @@ export function ProgressBar({
<Text color={fillColor} backgroundColor={emptyColor}>
{segments.join('')}
</Text>
)
);
}