import { CheckOutlined, CloseOutlined } from '@unif/react-native-icons'; import React from 'react'; import { View } from 'react-native'; import { r, useColors } from '../../../theme'; import { PulseDot } from '../Pulse'; import { paletteFor, styles } from './styles'; import type { StatusDotProps } from './types'; /** * 任务列表 / 推理链通用的状态圆点。 * done = 绿底 + 白勾;error = 红底 + 白叉;active = 边框 + 内部 PulseDot;pending = 仅边框。 */ // status 派生默认 a11y label —— 不传时 SR 仍能播报状态语义。 const DEFAULT_A11Y: Record = { pending: 'pending', active: 'active', done: 'done', error: 'error', }; export function StatusDot({ status, size = r(16), tone = 'flat', accessibilityLabel, style, testID, }: StatusDotProps): React.JSX.Element { const c = useColors(); const { bg, border } = paletteFor(status, tone, c); // [L-14] 优先用 caller 传入值;空字符串表示由容器负责播报,不派生默认。 const a11yLabel = accessibilityLabel !== undefined ? accessibilityLabel || undefined : DEFAULT_A11Y[status]; return ( {status === 'done' ? ( ) : status === 'error' ? ( ) : status === 'active' ? ( // [L-13] size 随外圈等比派生(系数 0.375 ≈ 6/16),视觉居中且不溢出。 ) : null} ); }