import type { CSSProperties, ReactNode } from 'react'; import type { BaseTextInputProps } from '@pisell/utils'; /** * PisellSingleLineText 组件 Props 类型定义 * * 继承 BaseTextInputProps,添加单行文本特有的配置 */ export interface PisellSingleLineTextProps extends BaseTextInputProps { /** * 状态模式 * @default 'edit' */ mode?: 'read' | 'edit'; /** * 是否禁用 * @default false */ disabled?: boolean; /** * 展示样式变体 * - text: 普通文本(默认) * - link: 超链接样式 * - badge: 徽标样式 * - tag: 标签样式 * @default 'text' */ displayVariant?: 'text' | 'link' | 'badge' | 'tag'; /** * 超链接点击回调(displayVariant='link' 时有效) */ onLinkClick?: () => void; /** * 徽标状态(displayVariant='badge' 时有效) */ badgeStatus?: 'success' | 'processing' | 'default' | 'error' | 'warning'; /** * 标签颜色(displayVariant='tag' 时有效) */ tagColor?: string; /** * 标签是否可关闭(displayVariant='tag' 时有效) */ tagClosable?: boolean; /** * 标签关闭回调(displayVariant='tag' 时有效) */ onTagClose?: () => void; /** * 超出是否省略 * @default true */ ellipsis?: boolean; /** * 悬停是否显示完整内容(Tooltip) * @default true */ showTooltip?: boolean; /** * 字号 * @example '14px' 或 14 */ fontSize?: string | number; /** * 字重 * @example 'bold' 或 600 */ fontWeight?: string | number; /** * 文本颜色 * @example '#000000' */ color?: string; /** * 文本对齐方式 * @default 'left' */ textAlign?: 'left' | 'center' | 'right'; /** * 占位文本 */ placeholder?: string; /** * 最大长度(字符数) */ maxLength?: number; /** * 是否显示字数统计 * @default false */ showCount?: boolean; /** * 是否显示清空按钮 * @default false */ allowClear?: boolean; /** * 是否自动聚焦 * @default false */ autoFocus?: boolean; /** * 前缀图标或文本 */ prefix?: ReactNode; /** * 后缀图标或文本 */ suffix?: ReactNode; /** * 前置标签 */ addonBefore?: ReactNode; /** * 后置标签 */ addonAfter?: ReactNode; /** * 回车键回调 * @param value 当前值 */ onPressEnter?: (value: string) => void; /** * 自定义类名 */ className?: string; /** * 自定义样式 */ style?: CSSProperties; /** * ARIA 标签 */ 'aria-label'?: string; /** * ARIA 描述 */ 'aria-describedby'?: string; } export type { DisplayState, ValidationResult, TextInputState } from '@pisell/utils';