import type { CSSProperties } from 'react'; import type { BaseTextInputProps } from '@pisell/utils'; /** * Mailto 邮件参数配置类型 */ export interface MailtoOptions { /** * 邮件主题 * @example '产品咨询' */ subject?: string; /** * 邮件正文 * @example '您好,我想咨询...' */ body?: string; /** * 抄送地址 * @example 'cc@example.com' */ cc?: string; /** * 密送地址 * @example 'bcc@example.com' */ bcc?: string; } /** * PisellEmail 组件 Props 类型定义 * * 继承 BaseTextInputProps,添加邮箱特有的配置 */ export interface PisellEmailProps extends BaseTextInputProps { /** * 状态模式 * @default 'edit' */ mode?: 'read' | 'edit'; /** * 是否禁用 * @default false */ disabled?: boolean; /** * 是否使用严格校验(RFC 5322) * @default false */ strictValidation?: boolean; /** * 白名单域名列表(仅允许指定域名) * @example ['company.com', 'partner.com'] */ allowedDomains?: string[]; /** * 黑名单域名列表(禁止某些域名) * @example ['tempmail.com', '10minutemail.com'] */ blockedDomains?: string[]; /** * 是否启用域名自动补全 * @default true */ enableAutoComplete?: boolean; /** * 自定义补全域名列表 * @example ['gmail.com', 'company.com', 'custom.com'] */ autoCompleteDomains?: string[]; /** * 是否显示所有建议(不过滤) * @default false */ showAllSuggestions?: boolean; /** * 选择补全建议回调 * @param value 选中的邮箱地址 */ onSelect?: (value: string) => void; /** * 是否启用 mailto(只读态) * @default true */ enableMailto?: boolean; /** * 是否显示邮件图标 * @default false */ showEmailIcon?: boolean; /** * mailto 默认参数 */ mailtoOptions?: MailtoOptions; /** * 发送邮件回调 * @param email 邮箱地址 */ onMailto?: (email: string) => void; /** * 是否隐藏域名(只读态) * @default false */ hideDomain?: boolean; /** * 脱敏模式 * - partial: 部分隐藏(u***@gmail.com) * - full: 完全隐藏(user@***) * @default 'partial' */ maskPattern?: 'partial' | 'full'; /** * 是否显示为链接(只读态) * @default true */ displayAsLink?: boolean; /** * 字号 * @example '14px' 或 14 * @default 16 */ fontSize?: string | number; /** * 字重 * @example 'bold' 或 600 * @default 500 */ fontWeight?: string | number; /** * 文本颜色 * @example '#000000' * @default '#101828' */ color?: string; /** * 链接颜色(只读态) * @example '#1890ff' * @default '#7F56DA' */ linkColor?: string; /** * 占位文本 * @default '请输入邮箱地址' */ placeholder?: string; /** * 最大长度(RFC 5321) * @default 254 */ maxLength?: number; /** * 是否显示清空按钮 * @default false */ allowClear?: boolean; /** * 是否自动聚焦 * @default false */ autoFocus?: boolean; /** * 自定义类名 */ className?: string; /** * 自定义样式 */ style?: CSSProperties; /** * ARIA 标签 */ 'aria-label'?: string; /** * ARIA 描述 */ 'aria-describedby'?: string; } export type { DisplayState, ValidationResult, TextInputState } from '@pisell/utils';