haiku-react-ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,177 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+ import * as React from 'react';
4
+ import React__default from 'react';
5
+ import { VariantProps } from 'class-variance-authority';
6
+
7
+ declare const buttonVariants: (props?: {
8
+ variant?: "primary" | "default" | "dashed" | "filled" | "text" | "link";
9
+ color?: "primary" | "default" | "danger" | "info" | "success" | "warning";
10
+ size?: "default" | "sm" | "lg";
11
+ shape?: "default" | "rounded" | "square";
12
+ } & class_variance_authority_types.ClassProp) => string;
13
+ interface ButtonOwnProps {
14
+ color?: "default" | "primary" | "danger" | "info" | "success" | "warning";
15
+ loading?: boolean;
16
+ icon?: React.ReactNode | string;
17
+ disabled?: boolean;
18
+ }
19
+ type ButtonBaseProps = VariantProps<typeof buttonVariants> & ButtonOwnProps;
20
+ type ButtonAsButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & ButtonBaseProps & {
21
+ as?: "button";
22
+ };
23
+ type ButtonAsLabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & ButtonBaseProps & {
24
+ as?: "label";
25
+ };
26
+ type ButtonProps = ButtonAsButtonProps | ButtonAsLabelProps;
27
+ declare function Button({ className, variant, size, color, shape, loading, disabled, children, icon, as, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
28
+
29
+ declare const avatarVariants: (props?: {
30
+ variant?: "primary" | "default" | "danger" | "info" | "success" | "warning" | "ghost";
31
+ shape?: "rounded" | "square";
32
+ size?: "sm" | "lg" | "md";
33
+ } & class_variance_authority_types.ClassProp) => string;
34
+ interface AvatarProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof avatarVariants> {
35
+ alt?: string;
36
+ icon?: React__default.ReactNode | string;
37
+ url?: string;
38
+ }
39
+ declare function Avatar({ alt, icon, shape, size, variant, className, url, ...props }: AvatarProps): react_jsx_runtime.JSX.Element;
40
+
41
+ type PlayBoardProps = React.HTMLAttributes<HTMLDivElement> & {
42
+ icon?: React.ReactNode;
43
+ heading?: React.ReactNode;
44
+ description?: React.ReactNode;
45
+ actions?: React.ReactNode;
46
+ code?: string;
47
+ defaultExpanded?: boolean;
48
+ previewClassName?: string;
49
+ };
50
+ declare function PlayBoard({ icon, heading, description, actions, code, defaultExpanded, previewClassName, className, children, ...props }: PlayBoardProps): react_jsx_runtime.JSX.Element;
51
+
52
+ type BubbleTypingConfig = {
53
+ effect?: "typing" | "fade-in";
54
+ step?: number | [number, number];
55
+ interval?: number;
56
+ keepPrefix?: boolean;
57
+ };
58
+
59
+ type BubblePlacement = "start" | "end";
60
+ type BubbleVariant = "filled" | "outlined" | "shadow" | "borderless";
61
+ type BubbleShape = "default" | "round" | "corner";
62
+ type BubbleInfo = {
63
+ key?: string | number;
64
+ status?: string;
65
+ extraInfo?: Record<string, unknown>;
66
+ };
67
+ type BubbleSlot<ContentType extends React.ReactNode> = React.ReactNode | ((content: ContentType, info: BubbleInfo) => React.ReactNode);
68
+ type BubbleProps<ContentType extends React.ReactNode = React.ReactNode> = Omit<React.HTMLAttributes<HTMLDivElement>, "content"> & {
69
+ content: ContentType;
70
+ info?: BubbleInfo;
71
+ placement?: BubblePlacement;
72
+ variant?: BubbleVariant;
73
+ shape?: BubbleShape;
74
+ header?: BubbleSlot<ContentType>;
75
+ footer?: BubbleSlot<ContentType>;
76
+ avatar?: BubbleSlot<ContentType>;
77
+ extra?: BubbleSlot<ContentType>;
78
+ contentRender?: (content: ContentType, info: BubbleInfo) => React.ReactNode;
79
+ typing?: boolean | BubbleTypingConfig | ((content: ContentType, info: BubbleInfo) => boolean | BubbleTypingConfig);
80
+ typingCursor?: string;
81
+ streaming?: boolean;
82
+ loading?: boolean;
83
+ loadingRender?: () => React.ReactNode;
84
+ onTyping?: (renderedContent: string, currentContent: string) => void;
85
+ onTypingComplete?: (content: string) => void;
86
+ };
87
+ declare const bubbleContentVariants: (props?: {
88
+ variant?: "filled" | "outlined" | "shadow" | "borderless";
89
+ shape?: "default" | "round" | "corner";
90
+ placement?: "start" | "end";
91
+ } & class_variance_authority_types.ClassProp) => string;
92
+ declare function Bubble<ContentType extends React.ReactNode = React.ReactNode>({ content, info, placement, variant, shape, header, footer, avatar, extra, contentRender, typing, typingCursor, streaming, loading, loadingRender, onTyping, onTypingComplete, className, ...props }: BubbleProps<ContentType> & VariantProps<typeof bubbleContentVariants>): react_jsx_runtime.JSX.Element;
93
+
94
+ /** 上传状态类型 */
95
+ type UploadStatus = "idle" | "uploading" | "success" | "error";
96
+ /** 上传模式类型 */
97
+ type UploadMode = 'button' | 'image' | 'dragger';
98
+ /** 上传变体类型 */
99
+ type UploadVariant = 'default' | 'dashed';
100
+ /** 上传尺寸类型 */
101
+ type UploadSize = 'sm' | 'md' | 'lg';
102
+ /** 上传形状类型 */
103
+ type UploadShape = 'rounded' | 'square';
104
+ /** 文件接受类型 - 预定义类型或自定义 MIME 类型/扩展名 */
105
+ type UploadAcceptType = 'image/*' | 'video/*' | 'audio/*' | 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'application/pdf' | 'application/msword' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'application/vnd.ms-excel' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | 'application/zip' | 'application/x-rar-compressed' | 'text/*' | `.${string}`;
106
+ /** 文件接受类型 - 支持多个类型组合 */
107
+ type UploadAccept = UploadAcceptType | `${UploadAcceptType},${string}` | string;
108
+ /** 上传错误类型 */
109
+ type UploadErrorType = 'FILE_TYPE_MISMATCH' | 'FILE_SIZE_EXCEEDED' | 'FILE_COUNT_EXCEEDED' | 'NETWORK_ERROR' | 'SERVER_ERROR' | 'ABORT_ERROR' | 'UNKNOWN_ERROR';
110
+ /** 上传错误接口 */
111
+ interface UploadError {
112
+ type: UploadErrorType;
113
+ message: string;
114
+ file?: File;
115
+ originalError?: Error;
116
+ }
117
+ /** 文件项接口 */
118
+ interface UploadFile {
119
+ id: string;
120
+ file: File;
121
+ status: UploadStatus;
122
+ progress: number;
123
+ response?: string;
124
+ error?: UploadError;
125
+ }
126
+ /** 统一的上传配置接口 */
127
+ interface UploadConfig {
128
+ /** 上传模式:button-按钮 | image-图片 | dragger-拖拽 */
129
+ mode?: UploadMode;
130
+ /** 上传模式:auto-选择后自动上传, manual-手动触发 */
131
+ autoUpload?: boolean;
132
+ /** 是否显示文件列表 */
133
+ showFileList?: boolean;
134
+ /** 是否允许上传目录(使用 webkitdirectory) */
135
+ directory?: boolean;
136
+ /** 允许的文件类型,支持预定义类型或自定义字符串 */
137
+ accept?: UploadAccept;
138
+ /** 限制文件最大大小(字节) */
139
+ maxSize?: number;
140
+ /** 限制文件最小大小(字节) */
141
+ minSize?: number;
142
+ /** 允许的最大文件数 */
143
+ maxCount?: number;
144
+ /** 样式变体:default-默认 | dashed-虚线 */
145
+ variant?: UploadVariant;
146
+ /** 尺寸:sm-小 | md-中 | lg-大 */
147
+ size?: UploadSize;
148
+ /** 形状:rounded-圆角 | square-方形 */
149
+ shape?: UploadShape;
150
+ /** 上传地址 URL */
151
+ action: string;
152
+ /** HTTP 请求方法,默认 post */
153
+ method?: 'get' | 'post' | 'put';
154
+ /** 请求头 */
155
+ headers?: Record<string, string>;
156
+ /** 自定义请求体数据 */
157
+ data?: Record<string, unknown>;
158
+ /** 请求体字段名,默认 "file" */
159
+ name?: string;
160
+ /** 文件变化回调 */
161
+ onChange?: (files: UploadFile[]) => void;
162
+ /** 上传进度回调 */
163
+ onProgress?: (progress: number, file: File) => void;
164
+ /** 单个文件上传成功回调 */
165
+ onSuccess?: (response: string, file: File) => void;
166
+ /** 单个文件上传失败回调 */
167
+ onError?: (error: UploadError, file: File) => void;
168
+ /** 所有文件上传完成回调 */
169
+ onComplete?: (files: UploadFile[]) => void;
170
+ }
171
+
172
+ /**
173
+ * 上传组件
174
+ */
175
+ declare function Upload(config: UploadConfig): react_jsx_runtime.JSX.Element;
176
+
177
+ export { Avatar, Bubble, Button, PlayBoard, Upload };