@ug666/ui-react 0.1.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.
- package/dist/chunk-MGXIF756.js +313 -0
- package/dist/chunk-MGXIF756.js.map +1 -0
- package/dist/hooks/index.cjs +351 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +232 -0
- package/dist/hooks/index.d.ts +232 -0
- package/dist/hooks/index.js +31 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +3799 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1363 -0
- package/dist/index.d.ts +1363 -0
- package/dist/index.js +3383 -0
- package/dist/index.js.map +1 -0
- package/dist/tokens.css +9 -0
- package/package.json +53 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1363 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FormEvent, ReactElement, HTMLAttributes, LabelHTMLAttributes, ImgHTMLAttributes } from 'react';
|
|
3
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import { LucideIcon } from 'lucide-react';
|
|
7
|
+
export { cn } from '@ug666/ui-utils';
|
|
8
|
+
export { SetLocalStorageValue, UseCopyToClipboardReturn, UseFormErrors, UseFormReturn, UseHotkeysOptions, UseLocalStorageReturn, UsePaginationOptions, UsePaginationReturn, UseToggleReturn, useClickOutside, useCopyToClipboard, useDebounce, useEventListener, useForm, useHotkeys, useInterval, useLocalStorage, useMediaQuery, useMounted, usePagination, useTimeout, useToggle } from './hooks/index.cjs';
|
|
9
|
+
|
|
10
|
+
declare const buttonVariants: (props?: ({
|
|
11
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
12
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
13
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
14
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
15
|
+
/** 是否处于加载状态,加载时显示旋转图标并禁用点击 */
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 通用按钮组件
|
|
20
|
+
* @example
|
|
21
|
+
* <Button variant="default" size="lg" onClick={handleClick}>确认</Button>
|
|
22
|
+
* <Button variant="destructive" loading>删除中...</Button>
|
|
23
|
+
* <Button variant="outline" size="sm">取消</Button>
|
|
24
|
+
*/
|
|
25
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
26
|
+
|
|
27
|
+
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
28
|
+
/** 输入框标签文本 */
|
|
29
|
+
label?: string;
|
|
30
|
+
/** 错误提示文本,有值时边框变红 */
|
|
31
|
+
error?: string;
|
|
32
|
+
/** 帮助说明文本 */
|
|
33
|
+
helperText?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 通用输入框组件
|
|
37
|
+
* @example
|
|
38
|
+
* <Input label="用户名" placeholder="请输入用户名" />
|
|
39
|
+
* <Input label="邮箱" error="邮箱格式不正确" value={email} onChange={handleChange} />
|
|
40
|
+
* <Input label="备注" helperText="最多 200 字" />
|
|
41
|
+
*/
|
|
42
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
43
|
+
|
|
44
|
+
interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
45
|
+
/** 是否为必填项,显示红色星号 */
|
|
46
|
+
required?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 通用标签组件
|
|
50
|
+
* @example
|
|
51
|
+
* <Label htmlFor="email">邮箱</Label>
|
|
52
|
+
* <Label htmlFor="name" required>姓名</Label>
|
|
53
|
+
*/
|
|
54
|
+
declare const Label: react.ForwardRefExoticComponent<LabelProps & react.RefAttributes<HTMLLabelElement>>;
|
|
55
|
+
|
|
56
|
+
type CardProps = React.HTMLAttributes<HTMLDivElement>;
|
|
57
|
+
type CardHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
58
|
+
type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
|
|
59
|
+
type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
60
|
+
type CardContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
61
|
+
type CardFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
62
|
+
/**
|
|
63
|
+
* 卡片容器
|
|
64
|
+
* @example
|
|
65
|
+
* <Card>
|
|
66
|
+
* <CardHeader>
|
|
67
|
+
* <CardTitle>标题</CardTitle>
|
|
68
|
+
* <CardDescription>描述文字</CardDescription>
|
|
69
|
+
* </CardHeader>
|
|
70
|
+
* <CardContent>内容区域</CardContent>
|
|
71
|
+
* <CardFooter>底部操作</CardFooter>
|
|
72
|
+
* </Card>
|
|
73
|
+
*/
|
|
74
|
+
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>>;
|
|
75
|
+
declare const CardHeader: react.ForwardRefExoticComponent<CardHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
76
|
+
declare const CardTitle: react.ForwardRefExoticComponent<CardTitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
77
|
+
declare const CardDescription: react.ForwardRefExoticComponent<CardDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
78
|
+
declare const CardContent: react.ForwardRefExoticComponent<CardContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
79
|
+
declare const CardFooter: react.ForwardRefExoticComponent<CardFooterProps & react.RefAttributes<HTMLDivElement>>;
|
|
80
|
+
|
|
81
|
+
declare const badgeVariants: (props?: ({
|
|
82
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "success" | "warning" | null | undefined;
|
|
83
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
84
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 徽标组件
|
|
88
|
+
* @example
|
|
89
|
+
* <Badge variant="default">新品</Badge>
|
|
90
|
+
* <Badge variant="success">已完成</Badge>
|
|
91
|
+
* <Badge variant="destructive">已删除</Badge>
|
|
92
|
+
* <Badge variant="warning">待审核</Badge>
|
|
93
|
+
*/
|
|
94
|
+
declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
95
|
+
|
|
96
|
+
declare const tagVariants: (props?: ({
|
|
97
|
+
variant?: "default" | "destructive" | "outline" | "success" | "warning" | "primary" | null | undefined;
|
|
98
|
+
size?: "default" | "sm" | null | undefined;
|
|
99
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
100
|
+
interface TagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'>, VariantProps<typeof tagVariants> {
|
|
101
|
+
/** 是否显示关闭按钮 */
|
|
102
|
+
closable?: boolean;
|
|
103
|
+
/** 是否禁用 */
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
/** 自定义背景色(覆盖 variant 颜色) */
|
|
106
|
+
color?: string;
|
|
107
|
+
/** 关闭按钮点击回调 */
|
|
108
|
+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 标签组件(可交互,支持关闭)
|
|
112
|
+
* @example
|
|
113
|
+
* <Tag>默认标签</Tag>
|
|
114
|
+
* <Tag variant="success">已完成</Tag>
|
|
115
|
+
* <Tag variant="primary" closable onClose={() => console.log('关闭')}>可关闭</Tag>
|
|
116
|
+
* <Tag variant="warning" disabled>禁用状态</Tag>
|
|
117
|
+
* <Tag color="#8b5cf6">自定义颜色</Tag>
|
|
118
|
+
*/
|
|
119
|
+
declare const Tag: react.ForwardRefExoticComponent<TagProps & react.RefAttributes<HTMLSpanElement>>;
|
|
120
|
+
|
|
121
|
+
interface ModalProps {
|
|
122
|
+
/** 是否显示 */
|
|
123
|
+
open: boolean;
|
|
124
|
+
/** 关闭回调 */
|
|
125
|
+
onClose: () => void;
|
|
126
|
+
/** 子内容 */
|
|
127
|
+
children: React.ReactNode;
|
|
128
|
+
/** 额外类名 */
|
|
129
|
+
className?: string;
|
|
130
|
+
}
|
|
131
|
+
interface ModalContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
132
|
+
/** 最大宽度,默认 max-w-lg */
|
|
133
|
+
maxWidth?: string;
|
|
134
|
+
}
|
|
135
|
+
type ModalHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
136
|
+
type ModalTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
|
|
137
|
+
type ModalFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
138
|
+
interface ModalCloseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 对话框组件
|
|
142
|
+
* @example
|
|
143
|
+
* <Modal open={isOpen} onClose={() => setIsOpen(false)}>
|
|
144
|
+
* <ModalContent>
|
|
145
|
+
* <ModalHeader>
|
|
146
|
+
* <ModalTitle>确认删除</ModalTitle>
|
|
147
|
+
* </ModalHeader>
|
|
148
|
+
* <p className="px-6 pb-4 text-sm text-slate-600">此操作不可撤销。</p>
|
|
149
|
+
* <ModalFooter>
|
|
150
|
+
* <Button variant="outline" onClick={() => setIsOpen(false)}>取消</Button>
|
|
151
|
+
* <Button variant="destructive">删除</Button>
|
|
152
|
+
* </ModalFooter>
|
|
153
|
+
* </ModalContent>
|
|
154
|
+
* </Modal>
|
|
155
|
+
*/
|
|
156
|
+
declare const Modal: react.ForwardRefExoticComponent<ModalProps & react.RefAttributes<HTMLDivElement>>;
|
|
157
|
+
declare const ModalContent: react.ForwardRefExoticComponent<ModalContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
158
|
+
declare const ModalHeader: react.ForwardRefExoticComponent<ModalHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
159
|
+
declare const ModalTitle: react.ForwardRefExoticComponent<ModalTitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
160
|
+
declare const ModalFooter: react.ForwardRefExoticComponent<ModalFooterProps & react.RefAttributes<HTMLDivElement>>;
|
|
161
|
+
/** 独立关闭按钮,可放在 ModalHeader 右侧 */
|
|
162
|
+
declare const ModalCloseButton: react.ForwardRefExoticComponent<ModalCloseButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
163
|
+
|
|
164
|
+
/** Dialog 变体类型 */
|
|
165
|
+
type DialogVariant = 'default' | 'destructive';
|
|
166
|
+
interface DialogProps {
|
|
167
|
+
/** 是否显示 */
|
|
168
|
+
open: boolean;
|
|
169
|
+
/** 打开/关闭状态变化回调 */
|
|
170
|
+
onOpenChange: (open: boolean) => void;
|
|
171
|
+
/** 对话框标题 */
|
|
172
|
+
title: string;
|
|
173
|
+
/** 对话框描述文字 */
|
|
174
|
+
description?: string;
|
|
175
|
+
/** 变体:default(默认蓝色确认)或 destructive(红色危险确认) */
|
|
176
|
+
variant?: DialogVariant;
|
|
177
|
+
/** 取消按钮文案,默认"取消" */
|
|
178
|
+
cancelText?: string;
|
|
179
|
+
/** 确认按钮文案,默认"确认" */
|
|
180
|
+
confirmText?: string;
|
|
181
|
+
/** 点击确认回调 */
|
|
182
|
+
onConfirm?: () => void;
|
|
183
|
+
/** 点击取消回调 */
|
|
184
|
+
onCancel?: () => void;
|
|
185
|
+
/** 额外类名 */
|
|
186
|
+
className?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* 确认对话框组件(AlertDialog 模式)
|
|
190
|
+
*
|
|
191
|
+
* 与 Modal 不同:Dialog 固定为"取消 + 确认"双按钮结构,专用于需要用户确认的操作。
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```tsx
|
|
195
|
+
* // 普通确认
|
|
196
|
+
* <Dialog
|
|
197
|
+
* open={isOpen}
|
|
198
|
+
* onOpenChange={setIsOpen}
|
|
199
|
+
* title="提交订单"
|
|
200
|
+
* description="确认提交后无法修改,是否继续?"
|
|
201
|
+
* onConfirm={handleSubmit}
|
|
202
|
+
* />
|
|
203
|
+
*
|
|
204
|
+
* // 危险操作(红色确认按钮)
|
|
205
|
+
* <Dialog
|
|
206
|
+
* open={isOpen}
|
|
207
|
+
* onOpenChange={setIsOpen}
|
|
208
|
+
* title="删除账号"
|
|
209
|
+
* description="此操作不可撤销,所有数据将被永久删除。"
|
|
210
|
+
* variant="destructive"
|
|
211
|
+
* confirmText="永久删除"
|
|
212
|
+
* onConfirm={handleDelete}
|
|
213
|
+
* />
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare const Dialog: react.ForwardRefExoticComponent<DialogProps & react.RefAttributes<HTMLDivElement>>;
|
|
217
|
+
|
|
218
|
+
/** 抽屉滑出方向 */
|
|
219
|
+
type DrawerSide = 'left' | 'right' | 'top' | 'bottom';
|
|
220
|
+
interface DrawerProps {
|
|
221
|
+
/** 是否显示 */
|
|
222
|
+
open: boolean;
|
|
223
|
+
/** 状态变更回调 */
|
|
224
|
+
onOpenChange: (open: boolean) => void;
|
|
225
|
+
/** 滑出方向,默认 right */
|
|
226
|
+
side?: DrawerSide;
|
|
227
|
+
/** 子内容 */
|
|
228
|
+
children?: React.ReactNode;
|
|
229
|
+
}
|
|
230
|
+
interface DrawerContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
231
|
+
}
|
|
232
|
+
type DrawerHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
233
|
+
type DrawerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
|
|
234
|
+
type DrawerDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
235
|
+
type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
236
|
+
interface DrawerCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 抽屉容器
|
|
240
|
+
* @example
|
|
241
|
+
* <Drawer open={isOpen} onOpenChange={setIsOpen} side="right">
|
|
242
|
+
* <DrawerContent>
|
|
243
|
+
* <DrawerHeader>
|
|
244
|
+
* <DrawerTitle>标题</DrawerTitle>
|
|
245
|
+
* <DrawerDescription>描述文字</DrawerDescription>
|
|
246
|
+
* </DrawerHeader>
|
|
247
|
+
* <p className="px-6 py-4 text-sm text-slate-600">抽屉内容</p>
|
|
248
|
+
* <DrawerFooter>
|
|
249
|
+
* <DrawerClose onClick={() => setIsOpen(false)}>关闭</DrawerClose>
|
|
250
|
+
* </DrawerFooter>
|
|
251
|
+
* </DrawerContent>
|
|
252
|
+
* </Drawer>
|
|
253
|
+
*/
|
|
254
|
+
declare const Drawer: {
|
|
255
|
+
({ open, onOpenChange, side, children }: DrawerProps): react_jsx_runtime.JSX.Element;
|
|
256
|
+
displayName: string;
|
|
257
|
+
};
|
|
258
|
+
/** 抽屉内容面板,通过 createPortal 渲染到 body */
|
|
259
|
+
declare const DrawerContent: react.ForwardRefExoticComponent<DrawerContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
260
|
+
/** 抽屉头部区域 */
|
|
261
|
+
declare const DrawerHeader: react.ForwardRefExoticComponent<DrawerHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
262
|
+
/** 抽屉标题 */
|
|
263
|
+
declare const DrawerTitle: react.ForwardRefExoticComponent<DrawerTitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
264
|
+
/** 抽屉描述 */
|
|
265
|
+
declare const DrawerDescription: react.ForwardRefExoticComponent<DrawerDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
266
|
+
/** 抽屉底部区域 */
|
|
267
|
+
declare const DrawerFooter: react.ForwardRefExoticComponent<DrawerFooterProps & react.RefAttributes<HTMLDivElement>>;
|
|
268
|
+
/** 关闭按钮 */
|
|
269
|
+
declare const DrawerClose: react.ForwardRefExoticComponent<DrawerCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
270
|
+
|
|
271
|
+
type TableProps = React.HTMLAttributes<HTMLTableElement>;
|
|
272
|
+
type TableHeaderProps = React.HTMLAttributes<HTMLTableSectionElement>;
|
|
273
|
+
type TableBodyProps = React.HTMLAttributes<HTMLTableSectionElement>;
|
|
274
|
+
type TableRowProps = React.HTMLAttributes<HTMLTableRowElement>;
|
|
275
|
+
type TableHeadProps = React.ThHTMLAttributes<HTMLTableCellElement>;
|
|
276
|
+
type TableCellProps = React.TdHTMLAttributes<HTMLTableCellElement>;
|
|
277
|
+
/**
|
|
278
|
+
* 表格组件
|
|
279
|
+
* @example
|
|
280
|
+
* <Table>
|
|
281
|
+
* <TableHeader>
|
|
282
|
+
* <TableRow>
|
|
283
|
+
* <TableHead>姓名</TableHead>
|
|
284
|
+
* <TableHead>邮箱</TableHead>
|
|
285
|
+
* </TableRow>
|
|
286
|
+
* </TableHeader>
|
|
287
|
+
* <TableBody>
|
|
288
|
+
* <TableRow>
|
|
289
|
+
* <TableCell>张三</TableCell>
|
|
290
|
+
* <TableCell>zhangsan@example.com</TableCell>
|
|
291
|
+
* </TableRow>
|
|
292
|
+
* </TableBody>
|
|
293
|
+
* </Table>
|
|
294
|
+
*/
|
|
295
|
+
declare const Table: react.ForwardRefExoticComponent<TableProps & react.RefAttributes<HTMLTableElement>>;
|
|
296
|
+
declare const TableHeader: react.ForwardRefExoticComponent<TableHeaderProps & react.RefAttributes<HTMLTableSectionElement>>;
|
|
297
|
+
declare const TableBody: react.ForwardRefExoticComponent<TableBodyProps & react.RefAttributes<HTMLTableSectionElement>>;
|
|
298
|
+
declare const TableRow: react.ForwardRefExoticComponent<TableRowProps & react.RefAttributes<HTMLTableRowElement>>;
|
|
299
|
+
declare const TableHead: react.ForwardRefExoticComponent<TableHeadProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
300
|
+
declare const TableCell: react.ForwardRefExoticComponent<TableCellProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
301
|
+
|
|
302
|
+
type ToastType = 'success' | 'error' | 'info';
|
|
303
|
+
interface ToastItem {
|
|
304
|
+
id: string;
|
|
305
|
+
message: string;
|
|
306
|
+
type: ToastType;
|
|
307
|
+
}
|
|
308
|
+
/** toast 调用接口 */
|
|
309
|
+
declare const toast: {
|
|
310
|
+
success: (message: string) => void;
|
|
311
|
+
error: (message: string) => void;
|
|
312
|
+
info: (message: string) => void;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Toaster 组件,放在应用根布局中一次即可
|
|
316
|
+
* @example
|
|
317
|
+
* // 在 layout 或 App 中:
|
|
318
|
+
* <Toaster />
|
|
319
|
+
*
|
|
320
|
+
* // 在任意组件中调用:
|
|
321
|
+
* toast.success('保存成功')
|
|
322
|
+
* toast.error('网络异常,请重试')
|
|
323
|
+
* toast.info('请先登录')
|
|
324
|
+
*/
|
|
325
|
+
declare const Toaster: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
326
|
+
|
|
327
|
+
interface SidebarItem {
|
|
328
|
+
label: string;
|
|
329
|
+
href: string;
|
|
330
|
+
icon: LucideIcon;
|
|
331
|
+
active?: boolean;
|
|
332
|
+
}
|
|
333
|
+
type SidebarVariant = 'primary' | 'dark';
|
|
334
|
+
interface SidebarProps {
|
|
335
|
+
/** 导航菜单项 */
|
|
336
|
+
items: SidebarItem[];
|
|
337
|
+
/** 视觉变体:primary 品牌色(默认),dark 深灰色(推荐后台管理) */
|
|
338
|
+
variant?: SidebarVariant;
|
|
339
|
+
/** 是否折叠,折叠时只显示图标 */
|
|
340
|
+
collapsed?: boolean;
|
|
341
|
+
/** 底部插槽,用于退出登录等操作 */
|
|
342
|
+
footer?: React.ReactNode;
|
|
343
|
+
/** 额外类名 */
|
|
344
|
+
className?: string;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* 侧边栏布局组件
|
|
348
|
+
* @example
|
|
349
|
+
* <Sidebar variant="dark" items={navItems} footer={<LogoutButton />} />
|
|
350
|
+
*/
|
|
351
|
+
declare const Sidebar: react.ForwardRefExoticComponent<SidebarProps & react.RefAttributes<HTMLElement>>;
|
|
352
|
+
|
|
353
|
+
interface PaginationProps {
|
|
354
|
+
/** 当前页码,从 1 开始 */
|
|
355
|
+
page: number;
|
|
356
|
+
/** 总页数 */
|
|
357
|
+
totalPages: number;
|
|
358
|
+
/** 页码变化回调 */
|
|
359
|
+
onPageChange: (page: number) => void;
|
|
360
|
+
/** 额外类名 */
|
|
361
|
+
className?: string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* 分页组件
|
|
365
|
+
* @example
|
|
366
|
+
* <Pagination page={currentPage} totalPages={20} onPageChange={setCurrentPage} />
|
|
367
|
+
*/
|
|
368
|
+
declare const Pagination: react.ForwardRefExoticComponent<PaginationProps & react.RefAttributes<HTMLDivElement>>;
|
|
369
|
+
|
|
370
|
+
interface SelectOption {
|
|
371
|
+
label: string;
|
|
372
|
+
value: string | number;
|
|
373
|
+
}
|
|
374
|
+
interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
375
|
+
/** 标签文本 */
|
|
376
|
+
label?: string;
|
|
377
|
+
/** 错误提示,有值时边框变红 */
|
|
378
|
+
error?: string;
|
|
379
|
+
/** 帮助说明文本 */
|
|
380
|
+
helperText?: string;
|
|
381
|
+
/** 选项列表 */
|
|
382
|
+
options: SelectOption[];
|
|
383
|
+
/** 占位提示,渲染为禁用的首选项 */
|
|
384
|
+
placeholder?: string;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* 下拉选择组件
|
|
388
|
+
* @example
|
|
389
|
+
* <Select
|
|
390
|
+
* label="状态"
|
|
391
|
+
* placeholder="请选择状态"
|
|
392
|
+
* options={[
|
|
393
|
+
* { label: '启用', value: 'active' },
|
|
394
|
+
* { label: '禁用', value: 'inactive' },
|
|
395
|
+
* ]}
|
|
396
|
+
* value={status}
|
|
397
|
+
* onChange={(e) => setStatus(e.target.value)}
|
|
398
|
+
* />
|
|
399
|
+
*/
|
|
400
|
+
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLSelectElement>>;
|
|
401
|
+
|
|
402
|
+
declare const spinnerVariants: (props?: ({
|
|
403
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
404
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
405
|
+
interface SpinnerProps extends React.HTMLAttributes<SVGSVGElement>, VariantProps<typeof spinnerVariants> {
|
|
406
|
+
/** 无障碍标签 */
|
|
407
|
+
label?: string;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* 加载旋转动画
|
|
411
|
+
* @example
|
|
412
|
+
* <Spinner />
|
|
413
|
+
* <Spinner size="sm" />
|
|
414
|
+
* <Spinner size="lg" className="text-blue-500" />
|
|
415
|
+
*/
|
|
416
|
+
declare const Spinner: react.ForwardRefExoticComponent<SpinnerProps & react.RefAttributes<SVGSVGElement>>;
|
|
417
|
+
|
|
418
|
+
declare const checkboxVariants: (props?: ({
|
|
419
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
420
|
+
state?: "checked" | "unchecked" | "indeterminate" | null | undefined;
|
|
421
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
422
|
+
interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'type'>, Pick<VariantProps<typeof checkboxVariants>, 'size'> {
|
|
423
|
+
/** 是否选中(受控) */
|
|
424
|
+
checked?: boolean;
|
|
425
|
+
/** 半选中状态(优先级高于 checked) */
|
|
426
|
+
indeterminate?: boolean;
|
|
427
|
+
/** 选中状态变化回调 */
|
|
428
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
429
|
+
/** 同行标签文案,有值时整块可点击 */
|
|
430
|
+
label?: React.ReactNode;
|
|
431
|
+
/** 标签额外 class */
|
|
432
|
+
labelClassName?: string;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* 通用复选框组件
|
|
436
|
+
* @example
|
|
437
|
+
* <Checkbox checked={isOpen} onCheckedChange={setIsOpen} label="启用通知" />
|
|
438
|
+
* <Checkbox indeterminate />
|
|
439
|
+
* <Checkbox size="lg" disabled />
|
|
440
|
+
*/
|
|
441
|
+
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
442
|
+
|
|
443
|
+
declare const radioVariants: (props?: ({
|
|
444
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
445
|
+
checked?: boolean | null | undefined;
|
|
446
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
447
|
+
interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'type' | 'checked'>, Pick<VariantProps<typeof radioVariants>, 'size'> {
|
|
448
|
+
/** 单选框的值(必需) */
|
|
449
|
+
value: string;
|
|
450
|
+
/** 是否选中(受控,被 RadioGroup 包裹时由 Group 控制) */
|
|
451
|
+
checked?: boolean;
|
|
452
|
+
/** 是否禁用 */
|
|
453
|
+
disabled?: boolean;
|
|
454
|
+
/** 单选框旁边的标签文案 */
|
|
455
|
+
label?: React.ReactNode;
|
|
456
|
+
/** 所属 group 的 name(被 RadioGroup 包裹时由 Group 覆盖) */
|
|
457
|
+
name?: string;
|
|
458
|
+
/** 选中回调(被 RadioGroup 包裹时由 Group 覆盖) */
|
|
459
|
+
onChange?: (value: string) => void;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* 单选框组件,可单独使用或配合 RadioGroup 使用
|
|
463
|
+
* @example
|
|
464
|
+
* // 独立使用
|
|
465
|
+
* <Radio value="option1" checked={selected === 'option1'} onChange={setSelected} label="选项一" />
|
|
466
|
+
*
|
|
467
|
+
* // 配合 RadioGroup 使用
|
|
468
|
+
* <RadioGroup value={val} onValueChange={setVal}>
|
|
469
|
+
* <Radio value="a" label="选项 A" />
|
|
470
|
+
* <Radio value="b" label="选项 B" />
|
|
471
|
+
* </RadioGroup>
|
|
472
|
+
*/
|
|
473
|
+
declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
|
|
474
|
+
interface RadioGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
475
|
+
/** 当前选中值(受控) */
|
|
476
|
+
value?: string;
|
|
477
|
+
/** 初始选中值(非受控) */
|
|
478
|
+
defaultValue?: string;
|
|
479
|
+
/** 选中值变化回调 */
|
|
480
|
+
onValueChange?: (value: string) => void;
|
|
481
|
+
/** 是否整组禁用 */
|
|
482
|
+
disabled?: boolean;
|
|
483
|
+
/** 表单 name 属性,共享给子 Radio */
|
|
484
|
+
name?: string;
|
|
485
|
+
/** 排列方向,默认垂直 */
|
|
486
|
+
orientation?: 'horizontal' | 'vertical';
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* 单选框组,管理一组 Radio 的选中状态
|
|
490
|
+
* @example
|
|
491
|
+
* <RadioGroup value={plan} onValueChange={setPlan} orientation="horizontal">
|
|
492
|
+
* <Radio value="free" label="免费版" />
|
|
493
|
+
* <Radio value="pro" label="专业版" />
|
|
494
|
+
* <Radio value="enterprise" label="企业版" />
|
|
495
|
+
* </RadioGroup>
|
|
496
|
+
*/
|
|
497
|
+
declare const RadioGroup: react.ForwardRefExoticComponent<RadioGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
498
|
+
|
|
499
|
+
interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'> {
|
|
500
|
+
/** 当前值(受控) */
|
|
501
|
+
value?: number;
|
|
502
|
+
/** 初始值(非受控) */
|
|
503
|
+
defaultValue?: number;
|
|
504
|
+
/** 最小值,默认 0 */
|
|
505
|
+
min?: number;
|
|
506
|
+
/** 最大值,默认 100 */
|
|
507
|
+
max?: number;
|
|
508
|
+
/** 步进值,默认 1 */
|
|
509
|
+
step?: number;
|
|
510
|
+
/** 是否禁用 */
|
|
511
|
+
disabled?: boolean;
|
|
512
|
+
/** 是否在滑块上方显示当前值,默认 false */
|
|
513
|
+
showValue?: boolean;
|
|
514
|
+
/** 值变化回调 */
|
|
515
|
+
onValueChange?: (value: number) => void;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* 数值滑块组件
|
|
519
|
+
* @example
|
|
520
|
+
* // 非受控用法
|
|
521
|
+
* <Slider defaultValue={30} min={0} max={100} step={5} showValue />
|
|
522
|
+
*
|
|
523
|
+
* // 受控用法
|
|
524
|
+
* const [vol, setVol] = useState(50)
|
|
525
|
+
* <Slider value={vol} onValueChange={setVol} min={0} max={100} />
|
|
526
|
+
*
|
|
527
|
+
* // 禁用状态
|
|
528
|
+
* <Slider value={60} disabled />
|
|
529
|
+
*/
|
|
530
|
+
declare const Slider: react.ForwardRefExoticComponent<SliderProps & react.RefAttributes<HTMLInputElement>>;
|
|
531
|
+
|
|
532
|
+
declare const numberInputVariants: (props?: ({
|
|
533
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
534
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
535
|
+
interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'value' | 'defaultValue' | 'onChange' | 'type'>, VariantProps<typeof numberInputVariants> {
|
|
536
|
+
/** 当前值(受控) */
|
|
537
|
+
value?: number;
|
|
538
|
+
/** 初始值(非受控) */
|
|
539
|
+
defaultValue?: number;
|
|
540
|
+
/** 最小值 */
|
|
541
|
+
min?: number;
|
|
542
|
+
/** 最大值 */
|
|
543
|
+
max?: number;
|
|
544
|
+
/** 步进值,默认 1 */
|
|
545
|
+
step?: number;
|
|
546
|
+
/** 小数位数,默认 0 */
|
|
547
|
+
precision?: number;
|
|
548
|
+
/** 是否禁用 */
|
|
549
|
+
disabled?: boolean;
|
|
550
|
+
/** 占位文本 */
|
|
551
|
+
placeholder?: string;
|
|
552
|
+
/** 值变化回调 */
|
|
553
|
+
onValueChange?: (value: number) => void;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* 数字步进输入框组件
|
|
557
|
+
* @example
|
|
558
|
+
* // 基础用法
|
|
559
|
+
* <NumberInput defaultValue={1} min={1} max={99} step={1} />
|
|
560
|
+
*
|
|
561
|
+
* // 受控用法
|
|
562
|
+
* const [qty, setQty] = useState(10)
|
|
563
|
+
* <NumberInput value={qty} onValueChange={setQty} min={0} max={100} size="lg" />
|
|
564
|
+
*
|
|
565
|
+
* // 带小数精度
|
|
566
|
+
* <NumberInput defaultValue={1.5} step={0.1} precision={2} min={0} max={10} />
|
|
567
|
+
*/
|
|
568
|
+
declare const NumberInput: react.ForwardRefExoticComponent<NumberInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
569
|
+
|
|
570
|
+
interface OTPInputProps {
|
|
571
|
+
/** 当前验证码值(受控) */
|
|
572
|
+
value: string;
|
|
573
|
+
/** 值变化回调 */
|
|
574
|
+
onValueChange: (value: string) => void;
|
|
575
|
+
/** 验证码位数,默认 6 */
|
|
576
|
+
length?: number;
|
|
577
|
+
/** 是否禁用 */
|
|
578
|
+
disabled?: boolean;
|
|
579
|
+
/** 输入完整时的回调 */
|
|
580
|
+
onComplete?: (value: string) => void;
|
|
581
|
+
/** 额外类名(作用于容器) */
|
|
582
|
+
className?: string;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* 一次性验证码(OTP)输入组件
|
|
586
|
+
*
|
|
587
|
+
* 渲染 N 个独立小方框,支持逐位输入数字、左右方向键切换焦点、
|
|
588
|
+
* Backspace 清除并返回上一格,以及粘贴完整验证码自动填充。
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```tsx
|
|
592
|
+
* const [code, setCode] = useState('')
|
|
593
|
+
*
|
|
594
|
+
* <OTPInput
|
|
595
|
+
* value={code}
|
|
596
|
+
* onValueChange={setCode}
|
|
597
|
+
* length={6}
|
|
598
|
+
* onComplete={(val) => console.log('验证码:', val)}
|
|
599
|
+
* />
|
|
600
|
+
* ```
|
|
601
|
+
*/
|
|
602
|
+
declare const OTPInput: react.ForwardRefExoticComponent<OTPInputProps & react.RefAttributes<HTMLDivElement>>;
|
|
603
|
+
|
|
604
|
+
interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
|
|
605
|
+
/** 表单提交回调,已阻止默认行为 */
|
|
606
|
+
onSubmit?: (event: FormEvent<HTMLFormElement>) => void;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* 表单根容器,阻止默认提交行为后调用 onSubmit
|
|
610
|
+
* @example
|
|
611
|
+
* <Form onSubmit={handleSubmit} className="space-y-4">
|
|
612
|
+
* ...
|
|
613
|
+
* </Form>
|
|
614
|
+
*/
|
|
615
|
+
declare const Form: react.ForwardRefExoticComponent<FormProps & react.RefAttributes<HTMLFormElement>>;
|
|
616
|
+
interface FormFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
617
|
+
/** 字段名称,用于关联 label/message */
|
|
618
|
+
name: string;
|
|
619
|
+
/** 字段错误信息,有值时 FormMessage 显示红色提示 */
|
|
620
|
+
error?: string;
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* 字段容器,通过 Context 向子组件提供 { name, error, id }
|
|
624
|
+
* @example
|
|
625
|
+
* <FormField name="email" error={errors.email}>
|
|
626
|
+
* <FormItem>
|
|
627
|
+
* <FormLabel>邮箱</FormLabel>
|
|
628
|
+
* <FormControl><Input /></FormControl>
|
|
629
|
+
* <FormMessage />
|
|
630
|
+
* </FormItem>
|
|
631
|
+
* </FormField>
|
|
632
|
+
*/
|
|
633
|
+
declare const FormField: react.ForwardRefExoticComponent<FormFieldProps & react.RefAttributes<HTMLDivElement>>;
|
|
634
|
+
interface FormItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* 字段垂直布局容器,提供 flex-col gap-1.5 间距
|
|
638
|
+
* @example
|
|
639
|
+
* <FormItem>
|
|
640
|
+
* <FormLabel>用户名</FormLabel>
|
|
641
|
+
* <FormControl><Input /></FormControl>
|
|
642
|
+
* <FormMessage />
|
|
643
|
+
* </FormItem>
|
|
644
|
+
*/
|
|
645
|
+
declare const FormItem: react.ForwardRefExoticComponent<FormItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
646
|
+
interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
647
|
+
/** 是否为必填项,显示红色星号 */
|
|
648
|
+
required?: boolean;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* 表单字段标签,自动关联 FormField 生成的控件 id,支持 required 红星
|
|
652
|
+
* @example
|
|
653
|
+
* <FormLabel required>邮箱地址</FormLabel>
|
|
654
|
+
*/
|
|
655
|
+
declare const FormLabel: react.ForwardRefExoticComponent<FormLabelProps & react.RefAttributes<HTMLLabelElement>>;
|
|
656
|
+
interface FormControlProps {
|
|
657
|
+
/** 单个表单控件子元素 */
|
|
658
|
+
children: ReactElement;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* 向子控件注入 id、aria-describedby 与 aria-invalid,实现无障碍关联
|
|
662
|
+
* @example
|
|
663
|
+
* <FormControl>
|
|
664
|
+
* <Input placeholder="请输入邮箱" />
|
|
665
|
+
* </FormControl>
|
|
666
|
+
*/
|
|
667
|
+
declare function FormControl({ children }: FormControlProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
668
|
+
declare namespace FormControl {
|
|
669
|
+
var displayName: string;
|
|
670
|
+
}
|
|
671
|
+
interface FormDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* 字段说明文字,灰色小字
|
|
675
|
+
* @example
|
|
676
|
+
* <FormDescription>请输入有效的电子邮箱地址</FormDescription>
|
|
677
|
+
*/
|
|
678
|
+
declare const FormDescription: react.ForwardRefExoticComponent<FormDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
679
|
+
interface FormMessageProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
680
|
+
/** 手动传入错误文本,优先级低于 FormField error prop */
|
|
681
|
+
children?: React.ReactNode;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* 字段错误提示,当 FormField 存在 error 时显示红色小字,无错误不渲染
|
|
685
|
+
* @example
|
|
686
|
+
* <FormMessage />
|
|
687
|
+
*/
|
|
688
|
+
declare const FormMessage: react.ForwardRefExoticComponent<FormMessageProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
689
|
+
|
|
690
|
+
interface TabsProps {
|
|
691
|
+
/** 当前激活的标签值 */
|
|
692
|
+
value: string;
|
|
693
|
+
/** 切换标签回调 */
|
|
694
|
+
onValueChange: (value: string) => void;
|
|
695
|
+
/** 子内容 */
|
|
696
|
+
children: React.ReactNode;
|
|
697
|
+
/** 额外类名 */
|
|
698
|
+
className?: string;
|
|
699
|
+
}
|
|
700
|
+
interface TabsListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
701
|
+
}
|
|
702
|
+
interface TabsTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
703
|
+
/** 对应的标签值 */
|
|
704
|
+
value: string;
|
|
705
|
+
}
|
|
706
|
+
interface TabsContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
707
|
+
/** 对应的标签值 */
|
|
708
|
+
value: string;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* 标签页容器
|
|
712
|
+
* @example
|
|
713
|
+
* <Tabs value={tab} onValueChange={setTab}>
|
|
714
|
+
* <TabsList>
|
|
715
|
+
* <TabsTrigger value="tab1">基本信息</TabsTrigger>
|
|
716
|
+
* <TabsTrigger value="tab2">高级设置</TabsTrigger>
|
|
717
|
+
* </TabsList>
|
|
718
|
+
* <TabsContent value="tab1">内容一</TabsContent>
|
|
719
|
+
* <TabsContent value="tab2">内容二</TabsContent>
|
|
720
|
+
* </Tabs>
|
|
721
|
+
*/
|
|
722
|
+
declare const Tabs: react.ForwardRefExoticComponent<TabsProps & react.RefAttributes<HTMLDivElement>>;
|
|
723
|
+
/** 标签列表容器 */
|
|
724
|
+
declare const TabsList: react.ForwardRefExoticComponent<TabsListProps & react.RefAttributes<HTMLDivElement>>;
|
|
725
|
+
/** 单个标签触发器 */
|
|
726
|
+
declare const TabsTrigger: react.ForwardRefExoticComponent<TabsTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
727
|
+
/** 标签内容面板 */
|
|
728
|
+
declare const TabsContent: react.ForwardRefExoticComponent<TabsContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
729
|
+
|
|
730
|
+
/** 手风琴展开类型 */
|
|
731
|
+
type AccordionType = 'single' | 'multiple';
|
|
732
|
+
interface AccordionSingleProps {
|
|
733
|
+
type: 'single';
|
|
734
|
+
/** 受控:当前展开项 */
|
|
735
|
+
value?: string;
|
|
736
|
+
/** 非受控:默认展开项 */
|
|
737
|
+
defaultValue?: string;
|
|
738
|
+
/** 状态变更回调 */
|
|
739
|
+
onValueChange?: (value: string) => void;
|
|
740
|
+
/** 是否允许折叠已展开项 */
|
|
741
|
+
collapsible?: boolean;
|
|
742
|
+
children?: React.ReactNode;
|
|
743
|
+
className?: string;
|
|
744
|
+
}
|
|
745
|
+
interface AccordionMultipleProps {
|
|
746
|
+
type: 'multiple';
|
|
747
|
+
/** 受控:当前展开的多个项 */
|
|
748
|
+
value?: string[];
|
|
749
|
+
/** 非受控:默认展开的多个项 */
|
|
750
|
+
defaultValue?: string[];
|
|
751
|
+
/** 状态变更回调 */
|
|
752
|
+
onValueChange?: (value: string[]) => void;
|
|
753
|
+
children?: React.ReactNode;
|
|
754
|
+
className?: string;
|
|
755
|
+
}
|
|
756
|
+
type AccordionProps = AccordionSingleProps | AccordionMultipleProps;
|
|
757
|
+
interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
758
|
+
/** 唯一标识 */
|
|
759
|
+
value: string;
|
|
760
|
+
}
|
|
761
|
+
type AccordionTriggerProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
762
|
+
type AccordionContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
763
|
+
/**
|
|
764
|
+
* 手风琴容器
|
|
765
|
+
* @example
|
|
766
|
+
* // 单选模式
|
|
767
|
+
* <Accordion type="single" collapsible defaultValue="item-1">
|
|
768
|
+
* <AccordionItem value="item-1">
|
|
769
|
+
* <AccordionTrigger>章节一</AccordionTrigger>
|
|
770
|
+
* <AccordionContent>章节一的内容</AccordionContent>
|
|
771
|
+
* </AccordionItem>
|
|
772
|
+
* <AccordionItem value="item-2">
|
|
773
|
+
* <AccordionTrigger>章节二</AccordionTrigger>
|
|
774
|
+
* <AccordionContent>章节二的内容</AccordionContent>
|
|
775
|
+
* </AccordionItem>
|
|
776
|
+
* </Accordion>
|
|
777
|
+
*/
|
|
778
|
+
declare const Accordion: react.ForwardRefExoticComponent<AccordionProps & react.RefAttributes<HTMLDivElement>>;
|
|
779
|
+
/** 手风琴子项 */
|
|
780
|
+
declare const AccordionItem: react.ForwardRefExoticComponent<AccordionItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
781
|
+
/** 手风琴触发器,点击展开/收起 */
|
|
782
|
+
declare const AccordionTrigger: react.ForwardRefExoticComponent<AccordionTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
783
|
+
/** 手风琴内容区域 */
|
|
784
|
+
declare const AccordionContent: react.ForwardRefExoticComponent<AccordionContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
785
|
+
|
|
786
|
+
interface StepItem {
|
|
787
|
+
/** 步骤标题 */
|
|
788
|
+
title: string;
|
|
789
|
+
/** 步骤描述(可选) */
|
|
790
|
+
description?: string;
|
|
791
|
+
/** 自定义图标(可选,仅在未完成且非当前时生效) */
|
|
792
|
+
icon?: React.ReactNode;
|
|
793
|
+
}
|
|
794
|
+
interface StepsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
795
|
+
/** 当前激活步骤下标(0-based) */
|
|
796
|
+
current: number;
|
|
797
|
+
/** 步骤列表 */
|
|
798
|
+
items: StepItem[];
|
|
799
|
+
/** 排列方向 */
|
|
800
|
+
direction?: 'horizontal' | 'vertical';
|
|
801
|
+
/** 当前步骤状态 */
|
|
802
|
+
status?: 'process' | 'finish' | 'error';
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* 步骤条组件,展示流程进度
|
|
806
|
+
* @example
|
|
807
|
+
* <Steps
|
|
808
|
+
* current={1}
|
|
809
|
+
* items={[
|
|
810
|
+
* { title: '填写信息', description: '输入基本资料' },
|
|
811
|
+
* { title: '确认订单', description: '核对下单内容' },
|
|
812
|
+
* { title: '完成支付' },
|
|
813
|
+
* ]}
|
|
814
|
+
* />
|
|
815
|
+
*/
|
|
816
|
+
declare const Steps: react.ForwardRefExoticComponent<StepsProps & react.RefAttributes<HTMLDivElement>>;
|
|
817
|
+
|
|
818
|
+
interface DropdownMenuProps {
|
|
819
|
+
children: React.ReactNode;
|
|
820
|
+
className?: string;
|
|
821
|
+
}
|
|
822
|
+
interface DropdownTriggerProps {
|
|
823
|
+
children: React.ReactNode;
|
|
824
|
+
className?: string;
|
|
825
|
+
}
|
|
826
|
+
interface DropdownContentProps {
|
|
827
|
+
children: React.ReactNode;
|
|
828
|
+
className?: string;
|
|
829
|
+
/** 对齐方向 */
|
|
830
|
+
align?: 'start' | 'end';
|
|
831
|
+
}
|
|
832
|
+
interface DropdownItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
833
|
+
/** 是否为危险操作样式 */
|
|
834
|
+
destructive?: boolean;
|
|
835
|
+
}
|
|
836
|
+
type DropdownSeparatorProps = React.HTMLAttributes<HTMLDivElement>;
|
|
837
|
+
/**
|
|
838
|
+
* 下拉菜单容器
|
|
839
|
+
* @example
|
|
840
|
+
* <DropdownMenu>
|
|
841
|
+
* <DropdownTrigger><Button>操作</Button></DropdownTrigger>
|
|
842
|
+
* <DropdownContent align="end">
|
|
843
|
+
* <DropdownItem onClick={handleEdit}>编辑</DropdownItem>
|
|
844
|
+
* <DropdownSeparator />
|
|
845
|
+
* <DropdownItem destructive onClick={handleDelete}>删除</DropdownItem>
|
|
846
|
+
* </DropdownContent>
|
|
847
|
+
* </DropdownMenu>
|
|
848
|
+
*/
|
|
849
|
+
declare const DropdownMenu: react.ForwardRefExoticComponent<DropdownMenuProps & react.RefAttributes<HTMLDivElement>>;
|
|
850
|
+
/** 触发器包装器 */
|
|
851
|
+
declare const DropdownTrigger: react.ForwardRefExoticComponent<DropdownTriggerProps & react.RefAttributes<HTMLDivElement>>;
|
|
852
|
+
/** 下拉内容面板,通过 createPortal 渲染到 body */
|
|
853
|
+
declare const DropdownContent: react.ForwardRefExoticComponent<DropdownContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
854
|
+
/** 菜单项 */
|
|
855
|
+
declare const DropdownItem: react.ForwardRefExoticComponent<DropdownItemProps & react.RefAttributes<HTMLButtonElement>>;
|
|
856
|
+
/** 分隔线 */
|
|
857
|
+
declare const DropdownSeparator: react.ForwardRefExoticComponent<DropdownSeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
858
|
+
|
|
859
|
+
/** 浮层显示方向 */
|
|
860
|
+
type PopoverSide = 'top' | 'right' | 'bottom' | 'left';
|
|
861
|
+
/** 浮层对齐方式 */
|
|
862
|
+
type PopoverAlign = 'start' | 'center' | 'end';
|
|
863
|
+
interface PopoverProps {
|
|
864
|
+
/** 受控:是否显示 */
|
|
865
|
+
open?: boolean;
|
|
866
|
+
/** 非受控:默认是否显示 */
|
|
867
|
+
defaultOpen?: boolean;
|
|
868
|
+
/** 状态变更回调 */
|
|
869
|
+
onOpenChange?: (open: boolean) => void;
|
|
870
|
+
/** 子内容 */
|
|
871
|
+
children?: React.ReactNode;
|
|
872
|
+
}
|
|
873
|
+
interface PopoverTriggerProps {
|
|
874
|
+
children: React.ReactNode;
|
|
875
|
+
className?: string;
|
|
876
|
+
}
|
|
877
|
+
interface PopoverContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
878
|
+
/** 浮层方向,默认 bottom */
|
|
879
|
+
side?: PopoverSide;
|
|
880
|
+
/** 对齐方式,默认 center */
|
|
881
|
+
align?: PopoverAlign;
|
|
882
|
+
/** 与触发器的间距,默认 4 */
|
|
883
|
+
sideOffset?: number;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Popover 容器
|
|
887
|
+
* @example
|
|
888
|
+
* <Popover>
|
|
889
|
+
* <PopoverTrigger><Button>点击打开</Button></PopoverTrigger>
|
|
890
|
+
* <PopoverContent side="bottom" align="center">
|
|
891
|
+
* <p className="text-sm text-slate-700">浮层内容,可放复杂组件</p>
|
|
892
|
+
* </PopoverContent>
|
|
893
|
+
* </Popover>
|
|
894
|
+
*/
|
|
895
|
+
declare const Popover: {
|
|
896
|
+
({ open: controlledOpen, defaultOpen, onOpenChange, children }: PopoverProps): react_jsx_runtime.JSX.Element;
|
|
897
|
+
displayName: string;
|
|
898
|
+
};
|
|
899
|
+
/** Popover 触发器 */
|
|
900
|
+
declare const PopoverTrigger: react.ForwardRefExoticComponent<PopoverTriggerProps & react.RefAttributes<HTMLDivElement>>;
|
|
901
|
+
/** Popover 内容浮层,通过 createPortal 渲染到 body */
|
|
902
|
+
declare const PopoverContent: react.ForwardRefExoticComponent<PopoverContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
903
|
+
|
|
904
|
+
interface ContextMenuProps {
|
|
905
|
+
children: React.ReactNode;
|
|
906
|
+
className?: string;
|
|
907
|
+
}
|
|
908
|
+
interface ContextMenuTriggerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
909
|
+
}
|
|
910
|
+
interface ContextMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
911
|
+
}
|
|
912
|
+
interface ContextMenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
913
|
+
/** 是否为危险操作样式 */
|
|
914
|
+
destructive?: boolean;
|
|
915
|
+
}
|
|
916
|
+
type ContextMenuSeparatorProps = React.HTMLAttributes<HTMLDivElement>;
|
|
917
|
+
/**
|
|
918
|
+
* 右键菜单根容器
|
|
919
|
+
* @example
|
|
920
|
+
* <ContextMenu>
|
|
921
|
+
* <ContextMenuTrigger>
|
|
922
|
+
* <div className="border p-8 rounded">在此区域右键</div>
|
|
923
|
+
* </ContextMenuTrigger>
|
|
924
|
+
* <ContextMenuContent>
|
|
925
|
+
* <ContextMenuItem onClick={handleCopy}>复制</ContextMenuItem>
|
|
926
|
+
* <ContextMenuItem onClick={handlePaste}>粘贴</ContextMenuItem>
|
|
927
|
+
* <ContextMenuSeparator />
|
|
928
|
+
* <ContextMenuItem destructive onClick={handleDelete}>删除</ContextMenuItem>
|
|
929
|
+
* </ContextMenuContent>
|
|
930
|
+
* </ContextMenu>
|
|
931
|
+
*/
|
|
932
|
+
declare const ContextMenu: react.ForwardRefExoticComponent<ContextMenuProps & react.RefAttributes<HTMLDivElement>>;
|
|
933
|
+
/** 右键触发区域包裹元素 */
|
|
934
|
+
declare const ContextMenuTrigger: react.ForwardRefExoticComponent<ContextMenuTriggerProps & react.RefAttributes<HTMLDivElement>>;
|
|
935
|
+
/** 右键菜单内容面板,fixed 定位到鼠标位置 */
|
|
936
|
+
declare const ContextMenuContent: react.ForwardRefExoticComponent<ContextMenuContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
937
|
+
/** 右键菜单项 */
|
|
938
|
+
declare const ContextMenuItem: react.ForwardRefExoticComponent<ContextMenuItemProps & react.RefAttributes<HTMLButtonElement>>;
|
|
939
|
+
/** 右键菜单分隔线 */
|
|
940
|
+
declare const ContextMenuSeparator: react.ForwardRefExoticComponent<ContextMenuSeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
941
|
+
|
|
942
|
+
interface NavigationMenuProps extends React.HTMLAttributes<HTMLElement> {
|
|
943
|
+
}
|
|
944
|
+
interface NavigationMenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
945
|
+
}
|
|
946
|
+
interface NavigationMenuLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
947
|
+
/** 是否为当前激活页 */
|
|
948
|
+
active?: boolean;
|
|
949
|
+
}
|
|
950
|
+
interface NavigationMenuTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
951
|
+
}
|
|
952
|
+
interface NavigationMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* 顶部横向导航菜单根容器
|
|
956
|
+
* @example
|
|
957
|
+
* <NavigationMenu>
|
|
958
|
+
* <NavigationMenuItem>
|
|
959
|
+
* <NavigationMenuLink href="/">首页</NavigationMenuLink>
|
|
960
|
+
* </NavigationMenuItem>
|
|
961
|
+
* <NavigationMenuItem>
|
|
962
|
+
* <NavigationMenuTrigger>产品</NavigationMenuTrigger>
|
|
963
|
+
* <NavigationMenuContent>
|
|
964
|
+
* <NavigationMenuLink href="/products/a">产品 A</NavigationMenuLink>
|
|
965
|
+
* <NavigationMenuLink href="/products/b">产品 B</NavigationMenuLink>
|
|
966
|
+
* </NavigationMenuContent>
|
|
967
|
+
* </NavigationMenuItem>
|
|
968
|
+
* </NavigationMenu>
|
|
969
|
+
*/
|
|
970
|
+
declare const NavigationMenu: react.ForwardRefExoticComponent<NavigationMenuProps & react.RefAttributes<HTMLElement>>;
|
|
971
|
+
/** 导航菜单项容器,可包含 Link 或 Trigger + Content */
|
|
972
|
+
declare const NavigationMenuItem: react.ForwardRefExoticComponent<NavigationMenuItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
973
|
+
/** 直接跳转的导航链接 */
|
|
974
|
+
declare const NavigationMenuLink: react.ForwardRefExoticComponent<NavigationMenuLinkProps & react.RefAttributes<HTMLAnchorElement>>;
|
|
975
|
+
/** 带下拉面板的触发器按钮 */
|
|
976
|
+
declare const NavigationMenuTrigger: react.ForwardRefExoticComponent<NavigationMenuTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
977
|
+
/** 下拉面板内容 */
|
|
978
|
+
declare const NavigationMenuContent: react.ForwardRefExoticComponent<NavigationMenuContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
979
|
+
|
|
980
|
+
declare const avatarVariants: (props?: ({
|
|
981
|
+
size?: "sm" | "lg" | "md" | "xl" | null | undefined;
|
|
982
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
983
|
+
interface AvatarProps extends HTMLAttributes<HTMLSpanElement>, VariantProps<typeof avatarVariants> {
|
|
984
|
+
}
|
|
985
|
+
interface AvatarImageProps extends ImgHTMLAttributes<HTMLImageElement> {
|
|
986
|
+
/** 图片 URL */
|
|
987
|
+
src: string;
|
|
988
|
+
/** alt 文本 */
|
|
989
|
+
alt?: string;
|
|
990
|
+
}
|
|
991
|
+
type AvatarFallbackProps = HTMLAttributes<HTMLSpanElement>;
|
|
992
|
+
/**
|
|
993
|
+
* 头像容器,提供图片加载状态 Context
|
|
994
|
+
* @example
|
|
995
|
+
* <Avatar size="lg">
|
|
996
|
+
* <AvatarImage src="/user.png" alt="用户头像" />
|
|
997
|
+
* <AvatarFallback>张</AvatarFallback>
|
|
998
|
+
* </Avatar>
|
|
999
|
+
*/
|
|
1000
|
+
declare const Avatar: react.ForwardRefExoticComponent<AvatarProps & react.RefAttributes<HTMLSpanElement>>;
|
|
1001
|
+
/** 头像图片 — 加载中、失败时不渲染(由 AvatarFallback 接管),加载成功后才显示 */
|
|
1002
|
+
declare const AvatarImage: react.ForwardRefExoticComponent<AvatarImageProps & react.RefAttributes<HTMLImageElement>>;
|
|
1003
|
+
/** 回退内容 — 仅在图片未加载完成时显示,加载成功后自动隐藏 */
|
|
1004
|
+
declare const AvatarFallback: react.ForwardRefExoticComponent<AvatarFallbackProps & react.RefAttributes<HTMLSpanElement>>;
|
|
1005
|
+
|
|
1006
|
+
type AvatarGroupSize = 'sm' | 'default' | 'lg';
|
|
1007
|
+
interface AvatarGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1008
|
+
/** 最多显示的头像数量,超出用 +N 展示,默认 5 */
|
|
1009
|
+
max?: number;
|
|
1010
|
+
/** 头像尺寸 */
|
|
1011
|
+
size?: AvatarGroupSize;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* 头像堆叠组,超出 max 时末尾显示 +N 灰底圆
|
|
1015
|
+
* @example
|
|
1016
|
+
* <AvatarGroup max={3} size="default">
|
|
1017
|
+
* <Avatar><AvatarImage src="/a.png" alt="用户A" /></Avatar>
|
|
1018
|
+
* <Avatar><AvatarImage src="/b.png" alt="用户B" /><AvatarFallback>B</AvatarFallback></Avatar>
|
|
1019
|
+
* <Avatar><AvatarFallback>张</AvatarFallback></Avatar>
|
|
1020
|
+
* <Avatar><AvatarFallback>李</AvatarFallback></Avatar>
|
|
1021
|
+
* </AvatarGroup>
|
|
1022
|
+
*/
|
|
1023
|
+
declare const AvatarGroup: react.ForwardRefExoticComponent<AvatarGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
1024
|
+
|
|
1025
|
+
interface TooltipProps {
|
|
1026
|
+
children: React.ReactNode;
|
|
1027
|
+
className?: string;
|
|
1028
|
+
}
|
|
1029
|
+
interface TooltipTriggerProps {
|
|
1030
|
+
children: React.ReactNode;
|
|
1031
|
+
className?: string;
|
|
1032
|
+
}
|
|
1033
|
+
interface TooltipContentProps {
|
|
1034
|
+
children: React.ReactNode;
|
|
1035
|
+
/** 显示方向 */
|
|
1036
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
1037
|
+
className?: string;
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Tooltip 容器
|
|
1041
|
+
* @example
|
|
1042
|
+
* <Tooltip>
|
|
1043
|
+
* <TooltipTrigger><Button>悬停我</Button></TooltipTrigger>
|
|
1044
|
+
* <TooltipContent side="top">这是提示文字</TooltipContent>
|
|
1045
|
+
* </Tooltip>
|
|
1046
|
+
*/
|
|
1047
|
+
declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLSpanElement>>;
|
|
1048
|
+
/** Tooltip 触发器 */
|
|
1049
|
+
declare const TooltipTrigger: react.ForwardRefExoticComponent<TooltipTriggerProps & react.RefAttributes<HTMLSpanElement>>;
|
|
1050
|
+
/** Tooltip 内容气泡 */
|
|
1051
|
+
declare const TooltipContent: react.ForwardRefExoticComponent<TooltipContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
1052
|
+
|
|
1053
|
+
declare const alertVariants: (props?: ({
|
|
1054
|
+
variant?: "default" | "destructive" | "success" | "warning" | "info" | null | undefined;
|
|
1055
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1056
|
+
interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {
|
|
1057
|
+
}
|
|
1058
|
+
type AlertTitleProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
1059
|
+
type AlertDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
1060
|
+
/**
|
|
1061
|
+
* 提示横幅组件
|
|
1062
|
+
* @example
|
|
1063
|
+
* <Alert variant="success">
|
|
1064
|
+
* <AlertTitle>操作成功</AlertTitle>
|
|
1065
|
+
* <AlertDescription>文件已成功上传。</AlertDescription>
|
|
1066
|
+
* </Alert>
|
|
1067
|
+
*/
|
|
1068
|
+
declare const Alert: react.ForwardRefExoticComponent<AlertProps & react.RefAttributes<HTMLDivElement>>;
|
|
1069
|
+
/** 提示标题 */
|
|
1070
|
+
declare const AlertTitle: react.ForwardRefExoticComponent<AlertTitleProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
1071
|
+
/** 提示描述 */
|
|
1072
|
+
declare const AlertDescription: react.ForwardRefExoticComponent<AlertDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
1073
|
+
|
|
1074
|
+
type BreadcrumbProps = React.HTMLAttributes<HTMLElement>;
|
|
1075
|
+
type BreadcrumbItemProps = React.HTMLAttributes<HTMLLIElement>;
|
|
1076
|
+
interface BreadcrumbLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
1077
|
+
/** 是否为当前页(当前页无链接,样式不同) */
|
|
1078
|
+
current?: boolean;
|
|
1079
|
+
}
|
|
1080
|
+
type BreadcrumbSeparatorProps = React.HTMLAttributes<HTMLLIElement>;
|
|
1081
|
+
/**
|
|
1082
|
+
* 面包屑导航
|
|
1083
|
+
* @example
|
|
1084
|
+
* <Breadcrumb>
|
|
1085
|
+
* <BreadcrumbItem>
|
|
1086
|
+
* <BreadcrumbLink href="/">首页</BreadcrumbLink>
|
|
1087
|
+
* <BreadcrumbSeparator />
|
|
1088
|
+
* </BreadcrumbItem>
|
|
1089
|
+
* <BreadcrumbItem>
|
|
1090
|
+
* <BreadcrumbLink href="/settings">设置</BreadcrumbLink>
|
|
1091
|
+
* <BreadcrumbSeparator />
|
|
1092
|
+
* </BreadcrumbItem>
|
|
1093
|
+
* <BreadcrumbItem>
|
|
1094
|
+
* <BreadcrumbLink current>个人资料</BreadcrumbLink>
|
|
1095
|
+
* </BreadcrumbItem>
|
|
1096
|
+
* </Breadcrumb>
|
|
1097
|
+
*/
|
|
1098
|
+
declare const Breadcrumb: react.ForwardRefExoticComponent<BreadcrumbProps & react.RefAttributes<HTMLElement>>;
|
|
1099
|
+
/** 面包屑项,包裹 BreadcrumbLink 和可选的 BreadcrumbSeparator */
|
|
1100
|
+
declare const BreadcrumbItem: react.ForwardRefExoticComponent<BreadcrumbItemProps & react.RefAttributes<HTMLLIElement>>;
|
|
1101
|
+
/** 面包屑链接,current=true 时渲染为非链接的当前页标识 */
|
|
1102
|
+
declare const BreadcrumbLink: react.ForwardRefExoticComponent<BreadcrumbLinkProps & react.RefAttributes<HTMLAnchorElement>>;
|
|
1103
|
+
/** 分隔符,默认使用 ChevronRight 图标 */
|
|
1104
|
+
declare const BreadcrumbSeparator: react.ForwardRefExoticComponent<BreadcrumbSeparatorProps & react.RefAttributes<HTMLLIElement>>;
|
|
1105
|
+
|
|
1106
|
+
interface SwitchProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
|
|
1107
|
+
/** 是否选中 */
|
|
1108
|
+
checked: boolean;
|
|
1109
|
+
/** 切换回调 */
|
|
1110
|
+
onCheckedChange: (checked: boolean) => void;
|
|
1111
|
+
/** 是否禁用 */
|
|
1112
|
+
disabled?: boolean;
|
|
1113
|
+
/** 标签文本 */
|
|
1114
|
+
label?: string;
|
|
1115
|
+
/** 标签位置 */
|
|
1116
|
+
labelPlacement?: 'left' | 'right';
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* 开关组件
|
|
1120
|
+
* @example
|
|
1121
|
+
* <Switch checked={enabled} onCheckedChange={setEnabled} label="启用通知" />
|
|
1122
|
+
* <Switch checked={dark} onCheckedChange={setDark} label="深色模式" labelPlacement="left" disabled />
|
|
1123
|
+
*/
|
|
1124
|
+
declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLButtonElement>>;
|
|
1125
|
+
|
|
1126
|
+
interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
1127
|
+
/** 标签文本 */
|
|
1128
|
+
label?: string;
|
|
1129
|
+
/** 错误提示文本,有值时边框变红 */
|
|
1130
|
+
error?: string;
|
|
1131
|
+
/** 帮助说明文本 */
|
|
1132
|
+
helperText?: string;
|
|
1133
|
+
/** 默认行数 */
|
|
1134
|
+
rows?: number;
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* 多行文本输入框
|
|
1138
|
+
* @example
|
|
1139
|
+
* <Textarea label="描述" placeholder="请输入描述..." rows={5} />
|
|
1140
|
+
* <Textarea label="备注" error="内容不能为空" value={text} onChange={handleChange} />
|
|
1141
|
+
* <Textarea label="简介" helperText="最多 500 字" rows={4} />
|
|
1142
|
+
*/
|
|
1143
|
+
declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
1144
|
+
|
|
1145
|
+
declare const skeletonVariants: (props?: ({
|
|
1146
|
+
variant?: "text" | "circle" | "rect" | null | undefined;
|
|
1147
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1148
|
+
interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof skeletonVariants> {
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* 骨架屏占位组件
|
|
1152
|
+
* @example
|
|
1153
|
+
* <Skeleton variant="text" className="w-40" />
|
|
1154
|
+
* <Skeleton variant="circle" className="h-10 w-10" />
|
|
1155
|
+
* <Skeleton variant="rect" className="h-32 w-full" />
|
|
1156
|
+
*/
|
|
1157
|
+
declare const Skeleton: react.ForwardRefExoticComponent<SkeletonProps & react.RefAttributes<HTMLDivElement>>;
|
|
1158
|
+
|
|
1159
|
+
interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1160
|
+
/** 当前进度值 0-100 */
|
|
1161
|
+
value: number;
|
|
1162
|
+
/** 最大值,默认 100 */
|
|
1163
|
+
max?: number;
|
|
1164
|
+
/** 是否显示百分比文本 */
|
|
1165
|
+
showLabel?: boolean;
|
|
1166
|
+
/** 进度条颜色,Tailwind bg-* 类名 */
|
|
1167
|
+
color?: string;
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* 进度条组件
|
|
1171
|
+
* @example
|
|
1172
|
+
* <Progress value={60} showLabel />
|
|
1173
|
+
* <Progress value={80} color="bg-green-500" />
|
|
1174
|
+
* <Progress value={30} max={200} showLabel />
|
|
1175
|
+
*/
|
|
1176
|
+
declare const Progress: react.ForwardRefExoticComponent<ProgressProps & react.RefAttributes<HTMLDivElement>>;
|
|
1177
|
+
|
|
1178
|
+
interface SheetProps {
|
|
1179
|
+
/** 是否显示 */
|
|
1180
|
+
open: boolean;
|
|
1181
|
+
/** 关闭回调 */
|
|
1182
|
+
onClose: () => void;
|
|
1183
|
+
/** 滑入方向 */
|
|
1184
|
+
side?: 'left' | 'right';
|
|
1185
|
+
/** 抽屉标题 */
|
|
1186
|
+
title?: string;
|
|
1187
|
+
/** 子内容 */
|
|
1188
|
+
children?: React.ReactNode;
|
|
1189
|
+
/** 额外类名 */
|
|
1190
|
+
className?: string;
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* 侧边抽屉组件
|
|
1194
|
+
* @example
|
|
1195
|
+
* <Sheet open={isOpen} onClose={() => setIsOpen(false)} title="筛选条件" side="right">
|
|
1196
|
+
* <p>抽屉内容</p>
|
|
1197
|
+
* </Sheet>
|
|
1198
|
+
*/
|
|
1199
|
+
declare const Sheet: react.ForwardRefExoticComponent<SheetProps & react.RefAttributes<HTMLDivElement>>;
|
|
1200
|
+
|
|
1201
|
+
interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1202
|
+
/** Lucide 图标组件 */
|
|
1203
|
+
icon?: LucideIcon;
|
|
1204
|
+
/** 标题文字 */
|
|
1205
|
+
title: string;
|
|
1206
|
+
/** 描述文字 */
|
|
1207
|
+
description?: string;
|
|
1208
|
+
/** 操作区域(如按钮) */
|
|
1209
|
+
action?: React.ReactNode;
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* 空状态占位组件
|
|
1213
|
+
* @example
|
|
1214
|
+
* <EmptyState
|
|
1215
|
+
* icon={Inbox}
|
|
1216
|
+
* title="暂无数据"
|
|
1217
|
+
* description="当前列表为空,请先添加内容"
|
|
1218
|
+
* action={<Button onClick={handleAdd}>新增</Button>}
|
|
1219
|
+
* />
|
|
1220
|
+
*/
|
|
1221
|
+
declare const EmptyState: react.ForwardRefExoticComponent<EmptyStateProps & react.RefAttributes<HTMLDivElement>>;
|
|
1222
|
+
|
|
1223
|
+
/** 分割线方向 */
|
|
1224
|
+
type SeparatorOrientation = 'horizontal' | 'vertical';
|
|
1225
|
+
interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1226
|
+
/** 方向,默认 horizontal */
|
|
1227
|
+
orientation?: SeparatorOrientation;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* 分割线
|
|
1231
|
+
* @example
|
|
1232
|
+
* // 水平分割线
|
|
1233
|
+
* <Separator />
|
|
1234
|
+
*
|
|
1235
|
+
* // 垂直分割线(父容器需设定高度)
|
|
1236
|
+
* <div className="flex h-8 items-center gap-4">
|
|
1237
|
+
* <span>左侧文字</span>
|
|
1238
|
+
* <Separator orientation="vertical" />
|
|
1239
|
+
* <span>右侧文字</span>
|
|
1240
|
+
* </div>
|
|
1241
|
+
*/
|
|
1242
|
+
declare const Separator: react.ForwardRefExoticComponent<SeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
1243
|
+
|
|
1244
|
+
type DescriptionsSize = 'sm' | 'default' | 'lg';
|
|
1245
|
+
interface DescriptionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
1246
|
+
/** 列数,默认 2 */
|
|
1247
|
+
column?: 1 | 2 | 3 | 4;
|
|
1248
|
+
/** 是否显示边框,类似表格样式 */
|
|
1249
|
+
bordered?: boolean;
|
|
1250
|
+
/** 尺寸 */
|
|
1251
|
+
size?: DescriptionsSize;
|
|
1252
|
+
/** 标题 */
|
|
1253
|
+
title?: React.ReactNode;
|
|
1254
|
+
}
|
|
1255
|
+
interface DescriptionsItemProps {
|
|
1256
|
+
/** 标签(必需) */
|
|
1257
|
+
label: React.ReactNode;
|
|
1258
|
+
/** 占几列,默认 1 */
|
|
1259
|
+
span?: number;
|
|
1260
|
+
/** 子内容 */
|
|
1261
|
+
children?: React.ReactNode;
|
|
1262
|
+
/** 额外类名 */
|
|
1263
|
+
className?: string;
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* 详情描述列表条目
|
|
1267
|
+
* @example
|
|
1268
|
+
* <DescriptionsItem label="姓名">张三</DescriptionsItem>
|
|
1269
|
+
* <DescriptionsItem label="地址" span={2}>北京市朝阳区</DescriptionsItem>
|
|
1270
|
+
*/
|
|
1271
|
+
declare const DescriptionsItem: react.ForwardRefExoticComponent<DescriptionsItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
1272
|
+
/**
|
|
1273
|
+
* 详情描述列表容器
|
|
1274
|
+
* @example
|
|
1275
|
+
* <Descriptions column={2} bordered title="用户信息">
|
|
1276
|
+
* <DescriptionsItem label="姓名">张三</DescriptionsItem>
|
|
1277
|
+
* <DescriptionsItem label="年龄">28</DescriptionsItem>
|
|
1278
|
+
* <DescriptionsItem label="地址" span={2}>北京市朝阳区</DescriptionsItem>
|
|
1279
|
+
* </Descriptions>
|
|
1280
|
+
*/
|
|
1281
|
+
declare const Descriptions: react.ForwardRefExoticComponent<DescriptionsProps & react.RefAttributes<HTMLDivElement>>;
|
|
1282
|
+
|
|
1283
|
+
type StatisticSize = 'sm' | 'default' | 'lg';
|
|
1284
|
+
type StatisticTrend = 'up' | 'down' | 'flat';
|
|
1285
|
+
interface StatisticProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'prefix'> {
|
|
1286
|
+
/** 标题文案 */
|
|
1287
|
+
title?: React.ReactNode;
|
|
1288
|
+
/** 统计数值(数字会自动格式化,字符串原样展示) */
|
|
1289
|
+
value: number | string;
|
|
1290
|
+
/** 小数位数,仅 value 为 number 时生效 */
|
|
1291
|
+
precision?: number;
|
|
1292
|
+
/** 数值前缀,如图标 */
|
|
1293
|
+
prefix?: React.ReactNode;
|
|
1294
|
+
/** 数值后缀,如单位文字 */
|
|
1295
|
+
suffix?: React.ReactNode;
|
|
1296
|
+
/** 趋势方向 */
|
|
1297
|
+
trend?: StatisticTrend;
|
|
1298
|
+
/** 趋势说明文案,如 "+12%" */
|
|
1299
|
+
change?: string;
|
|
1300
|
+
/** 尺寸 */
|
|
1301
|
+
size?: StatisticSize;
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* 统计数字卡片组件
|
|
1305
|
+
* @example
|
|
1306
|
+
* <Statistic title="今日订单" value={1234} suffix="单" trend="up" change="+12%" />
|
|
1307
|
+
* <Statistic title="总收入" value={98765.5} precision={2} prefix={<DollarSign size={20} />} />
|
|
1308
|
+
* <Statistic title="退单率" value={3.2} precision={1} suffix="%" trend="down" change="-0.5%" size="lg" />
|
|
1309
|
+
*/
|
|
1310
|
+
declare const Statistic: react.ForwardRefExoticComponent<StatisticProps & react.RefAttributes<HTMLDivElement>>;
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* @description: 主题配置 — 定义颜色、圆角、字体等设计令牌
|
|
1314
|
+
* @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。
|
|
1315
|
+
* @date: 2026-04-15
|
|
1316
|
+
*/
|
|
1317
|
+
declare const theme: {
|
|
1318
|
+
readonly colors: {
|
|
1319
|
+
readonly primary: {
|
|
1320
|
+
readonly DEFAULT: "#6366f1";
|
|
1321
|
+
readonly hover: "#4f46e5";
|
|
1322
|
+
readonly light: "#eef2ff";
|
|
1323
|
+
};
|
|
1324
|
+
readonly secondary: {
|
|
1325
|
+
readonly DEFAULT: "#64748b";
|
|
1326
|
+
readonly hover: "#475569";
|
|
1327
|
+
readonly light: "#f1f5f9";
|
|
1328
|
+
};
|
|
1329
|
+
readonly destructive: {
|
|
1330
|
+
readonly DEFAULT: "#ef4444";
|
|
1331
|
+
readonly hover: "#dc2626";
|
|
1332
|
+
readonly light: "#fef2f2";
|
|
1333
|
+
};
|
|
1334
|
+
readonly success: {
|
|
1335
|
+
readonly DEFAULT: "#22c55e";
|
|
1336
|
+
readonly hover: "#16a34a";
|
|
1337
|
+
readonly light: "#f0fdf4";
|
|
1338
|
+
};
|
|
1339
|
+
readonly warning: {
|
|
1340
|
+
readonly DEFAULT: "#f59e0b";
|
|
1341
|
+
readonly hover: "#d97706";
|
|
1342
|
+
readonly light: "#fffbeb";
|
|
1343
|
+
};
|
|
1344
|
+
readonly background: "#ffffff";
|
|
1345
|
+
readonly foreground: "#0f172a";
|
|
1346
|
+
readonly muted: "#f1f5f9";
|
|
1347
|
+
readonly border: "#e2e8f0";
|
|
1348
|
+
readonly ring: "#6366f1";
|
|
1349
|
+
};
|
|
1350
|
+
readonly radius: {
|
|
1351
|
+
readonly sm: "0.375rem";
|
|
1352
|
+
readonly md: "0.5rem";
|
|
1353
|
+
readonly lg: "0.75rem";
|
|
1354
|
+
readonly full: "9999px";
|
|
1355
|
+
};
|
|
1356
|
+
readonly fontFamily: {
|
|
1357
|
+
readonly sans: "system-ui, -apple-system, sans-serif";
|
|
1358
|
+
readonly mono: "ui-monospace, monospace";
|
|
1359
|
+
};
|
|
1360
|
+
};
|
|
1361
|
+
type Theme = typeof theme;
|
|
1362
|
+
|
|
1363
|
+
export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionMultipleProps, type AccordionProps, type AccordionSingleProps, AccordionTrigger, type AccordionTriggerProps, type AccordionType, Alert, AlertDescription, type AlertDescriptionProps, type AlertProps, AlertTitle, type AlertTitleProps, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarGroup, type AvatarGroupProps, type AvatarGroupSize, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, BreadcrumbSeparator, type BreadcrumbSeparatorProps, Button, type ButtonProps, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, ContextMenu, ContextMenuContent, type ContextMenuContentProps, ContextMenuItem, type ContextMenuItemProps, type ContextMenuProps, ContextMenuSeparator, type ContextMenuSeparatorProps, ContextMenuTrigger, type ContextMenuTriggerProps, Descriptions, DescriptionsItem, type DescriptionsItemProps, type DescriptionsProps, type DescriptionsSize, Dialog, type DialogProps, type DialogVariant, Drawer, DrawerClose, type DrawerCloseProps, DrawerContent, type DrawerContentProps, DrawerDescription, type DrawerDescriptionProps, DrawerFooter, type DrawerFooterProps, DrawerHeader, type DrawerHeaderProps, type DrawerProps, type DrawerSide, DrawerTitle, type DrawerTitleProps, DropdownContent, type DropdownContentProps, DropdownItem, type DropdownItemProps, DropdownMenu, type DropdownMenuProps, DropdownSeparator, type DropdownSeparatorProps, DropdownTrigger, type DropdownTriggerProps, EmptyState, type EmptyStateProps, Form, FormControl, type FormControlProps, FormDescription, type FormDescriptionProps, FormField, type FormFieldProps, FormItem, type FormItemProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, type FormProps, Input, type InputProps, Label, type LabelProps, Modal, ModalCloseButton, type ModalCloseButtonProps, ModalContent, type ModalContentProps, ModalFooter, type ModalFooterProps, ModalHeader, type ModalHeaderProps, type ModalProps, ModalTitle, type ModalTitleProps, NavigationMenu, NavigationMenuContent, type NavigationMenuContentProps, NavigationMenuItem, type NavigationMenuItemProps, NavigationMenuLink, type NavigationMenuLinkProps, type NavigationMenuProps, NavigationMenuTrigger, type NavigationMenuTriggerProps, NumberInput, type NumberInputProps, OTPInput, type OTPInputProps, Pagination, type PaginationProps, Popover, type PopoverAlign, PopoverContent, type PopoverContentProps, type PopoverProps, type PopoverSide, PopoverTrigger, type PopoverTriggerProps, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, type SelectOption, type SelectProps, Separator, type SeparatorOrientation, type SeparatorProps, Sheet, type SheetProps, Sidebar, type SidebarItem, type SidebarProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, Statistic, type StatisticProps, type StatisticSize, type StatisticTrend, type StepItem, Steps, type StepsProps, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, Tag, type TagProps, Textarea, type TextareaProps, type Theme, type ToastItem, type ToastType, Toaster, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipTrigger, type TooltipTriggerProps, badgeVariants, buttonVariants, checkboxVariants, numberInputVariants, tagVariants, theme, toast };
|