@vustcc/react 0.1.0-alpha.1

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/README.md +85 -0
  4. package/dist/components/VustActionMenu/VustActionMenu.d.ts +20 -0
  5. package/dist/components/VustAlert/VustAlert.d.ts +20 -0
  6. package/dist/components/VustBreadcrumb/VustBreadcrumb.d.ts +7 -0
  7. package/dist/components/VustBreadcrumbItem/VustBreadcrumbItem.d.ts +6 -0
  8. package/dist/components/VustButton/VustButton.d.ts +10 -0
  9. package/dist/components/VustCard/VustCard.d.ts +16 -0
  10. package/dist/components/VustCheckbox/VustCheckbox.d.ts +16 -0
  11. package/dist/components/VustDateTimeRangePicker/VustDateTimeRangePicker.d.ts +44 -0
  12. package/dist/components/VustDescriptions/VustDescriptions.d.ts +23 -0
  13. package/dist/components/VustDialog/VustDialog.d.ts +20 -0
  14. package/dist/components/VustDrawer/VustDrawer.d.ts +18 -0
  15. package/dist/components/VustEmpty/VustEmpty.d.ts +14 -0
  16. package/dist/components/VustFormItem/VustFormItem.d.ts +15 -0
  17. package/dist/components/VustIcon/VustIcon.d.ts +10 -0
  18. package/dist/components/VustInput/VustInput.d.ts +40 -0
  19. package/dist/components/VustLoading/VustLoading.d.ts +10 -0
  20. package/dist/components/VustMenu/VustMenu.d.ts +19 -0
  21. package/dist/components/VustModal/VustModal.d.ts +20 -0
  22. package/dist/components/VustPagination/VustPagination.d.ts +15 -0
  23. package/dist/components/VustSelect/VustSelect.d.ts +33 -0
  24. package/dist/components/VustSelectionBar/VustSelectionBar.d.ts +18 -0
  25. package/dist/components/VustSwitch/VustSwitch.d.ts +8 -0
  26. package/dist/components/VustTable/VustTable.d.ts +59 -0
  27. package/dist/components/VustTabs/VustTabs.d.ts +15 -0
  28. package/dist/components/VustTag/VustTag.d.ts +8 -0
  29. package/dist/components/VustToast/VustToast.d.ts +16 -0
  30. package/dist/components/VustTooltip/VustTooltip.d.ts +15 -0
  31. package/dist/index.d.ts +54 -0
  32. package/dist/index.js +1513 -0
  33. package/dist/internal/floating-position.d.ts +15 -0
  34. package/dist/internal/modal-lifecycle.d.ts +1 -0
  35. package/dist/style.css +2 -0
  36. package/package.json +50 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ 格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),并遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
4
+
5
+ ## [0.1.0-alpha.1] - 2026-09-10
6
+
7
+ ### Added
8
+
9
+ - 首次发布 `@vustcc/react` React 19 基础组件库。
10
+ - 提供按钮、输入、选择、开关、复选框、日期范围和表单组件。
11
+ - 提供表格、分页、标签、描述列表、卡片和空状态组件。
12
+ - 提供弹窗、抽屉、模态框、菜单、标签页和面包屑组件。
13
+ - 提供提示、通知、加载、告警和统一 SVG 图标组件。
14
+ - 所有组件使用 `Vust*` 导出名和 VDL Token。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 gwj
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # @vustcc/react
2
+
3
+ VUST React 19 基础组件库,实现 VUST Design Language(VDL)的通用交互和视觉规范。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm add @vustcc/react @vustcc/icons @vustcc/tokens
9
+ ```
10
+
11
+ 项目需要安装 React 19:
12
+
13
+ ```bash
14
+ pnpm add react react-dom
15
+ ```
16
+
17
+ ## 样式
18
+
19
+ 在全局样式入口导入主题变量和组件样式:
20
+
21
+ ```css
22
+ @import "@vustcc/tokens/index.css";
23
+ @import "@vustcc/react/style.css";
24
+ ```
25
+
26
+ ## 使用
27
+
28
+ 组件采用按需导入:
29
+
30
+ ```tsx
31
+ import { useState } from "react";
32
+ import { VustButton, VustFormItem, VustIcon, VustInput } from "@vustcc/react";
33
+
34
+ export default function SearchPanel() {
35
+ const [keyword, setKeyword] = useState("");
36
+
37
+ return (
38
+ <div>
39
+ <VustFormItem
40
+ label="关键词"
41
+ htmlFor="search-keyword"
42
+ labelId="search-keyword-label"
43
+ hint="输入名称或标识"
44
+ hintId="search-keyword-hint"
45
+ >
46
+ <VustInput
47
+ id="search-keyword"
48
+ value={keyword}
49
+ name="keyword"
50
+ ariaLabelledby="search-keyword-label"
51
+ ariaDescribedby="search-keyword-hint"
52
+ onChange={setKeyword}
53
+ placeholder="搜索"
54
+ />
55
+ </VustFormItem>
56
+ <VustButton type="primary">
57
+ <VustIcon name="search" size={16} />
58
+ 查询
59
+ </VustButton>
60
+ </div>
61
+ );
62
+ }
63
+ ```
64
+
65
+ `VustInput`、`VustCheckbox` 和 `VustSelect` 未提供 `id` 时会自动生成;参与原生表单提交时应提供 `name`。复杂控件可通过 `ariaLabelledby` 和 `ariaDescribedby` 显式关联 `VustFormItem` 的标签、提示与错误节点。
66
+
67
+ 受控组件的 `value`(Checkbox 为 `checked`)为必填,变化统一通过 `onChange` 返回。React DOM 属性使用 `readOnly`、`maxLength`、`autoComplete`、`htmlFor` 和 `className` 等惯用名称,不提供小写兼容别名;业务参数、默认值及配置对象字段与 Vue 契约保持一致。
68
+
69
+ ## 组件范围
70
+
71
+ - 操作:按钮、操作菜单
72
+ - 输入:输入框、选择器、开关、复选框、日期时间范围
73
+ - 数据:表格、分页、标签、描述列表
74
+ - 容器:卡片、对话框、抽屉、模态框
75
+ - 反馈:告警、通知、加载、空状态、提示
76
+ - 导航:菜单、标签页、面包屑
77
+
78
+ 完整用途、交互、无障碍语义及跨框架映射参见[共享组件契约](https://github.com/vustcc/vust-ui/tree/dev/docs/components)。实际 Props、事件和类型声明以发布包中的 TypeScript 类型为准。
79
+
80
+ ## 约束
81
+
82
+ - 组件不依赖业务 API、任何全局状态管理库或路由。
83
+ - 视觉变量由 `@vustcc/tokens` 提供。
84
+ - 图标由 `@vustcc/icons` 提供。
85
+ - `react` 和 `react-dom` 是 peer dependencies,不会被组件库重复打包。
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ export interface VustAction {
3
+ label: string;
4
+ className?: string;
5
+ icon?: string;
6
+ disabled?: boolean;
7
+ tooltip?: string;
8
+ handler: () => void;
9
+ }
10
+ export interface VustActionMenuProps extends React.HTMLAttributes<HTMLDivElement> {
11
+ /** 操作列表 */
12
+ actions: VustAction[];
13
+ /** 按钮文案 */
14
+ label?: string;
15
+ /** 是否禁用菜单入口 */
16
+ disabled?: boolean;
17
+ /** 菜单项默认图标 */
18
+ defaultIcon?: string;
19
+ }
20
+ export declare const VustActionMenu: React.FC<VustActionMenuProps>;
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ export interface VustAlertProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** 警告标题 */
4
+ title?: string;
5
+ /** 警告描述 (如果有 title, 则在下方显示) */
6
+ description?: string;
7
+ /** 警告类型 */
8
+ type?: "success" | "warning" | "error" | "info";
9
+ /** 是否显示图标 */
10
+ showIcon?: boolean;
11
+ /** 是否可关闭 */
12
+ closable?: boolean;
13
+ /** 关闭事件 */
14
+ onClose?: () => void;
15
+ /** 关闭按钮的无障碍标签 */
16
+ closeLabel?: string;
17
+ /** 子元素,将作为 description 渲染 */
18
+ children?: React.ReactNode;
19
+ }
20
+ export declare const VustAlert: React.FC<VustAlertProps>;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ export declare const BreadcrumbContext: React.Context<string>;
3
+ export interface VustBreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
4
+ /** 分隔符 */
5
+ separator?: string;
6
+ }
7
+ export declare const VustBreadcrumb: React.FC<VustBreadcrumbProps>;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export interface VustBreadcrumbItemProps extends React.HTMLAttributes<HTMLSpanElement> {
3
+ /** 子元素,面包屑项内容 */
4
+ children?: React.ReactNode;
5
+ }
6
+ export declare const VustBreadcrumbItem: React.FC<VustBreadcrumbItemProps>;
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ export interface VustButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type"> {
3
+ type?: "primary" | "secondary" | "danger" | "warning" | "info";
4
+ size?: "small" | "default" | "large";
5
+ disabled?: boolean;
6
+ loading?: boolean;
7
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
8
+ children?: React.ReactNode;
9
+ }
10
+ export declare const VustButton: React.FC<VustButtonProps>;
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ export interface VustCardProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** 阴影显示时机 */
4
+ shadow?: "always" | "hover" | "never";
5
+ /** 内容区自定义样式 */
6
+ contentStyle?: React.CSSProperties;
7
+ /** 默认插槽容器语义 */
8
+ contentRole?: "content" | "header";
9
+ /** 内容区是否撑满高度 (用于包含滚动表格的场景) */
10
+ fullHeight?: boolean;
11
+ /** 头部内容 */
12
+ header?: React.ReactNode;
13
+ /** 子元素,卡片内容 */
14
+ children?: React.ReactNode;
15
+ }
16
+ export declare const VustCard: React.FC<VustCardProps>;
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ export interface VustCheckboxProps extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, "onChange" | "id" | "aria-label" | "aria-labelledby" | "aria-describedby"> {
3
+ /** 绑定值 */
4
+ checked: boolean;
5
+ /** 禁用状态 */
6
+ disabled?: boolean;
7
+ /** 改变事件 */
8
+ onChange?: (checked: boolean) => void;
9
+ indeterminate?: boolean;
10
+ id?: string;
11
+ name?: string;
12
+ ariaLabel?: string;
13
+ ariaLabelledby?: string;
14
+ ariaDescribedby?: string;
15
+ }
16
+ export declare const VustCheckbox: React.FC<VustCheckboxProps>;
@@ -0,0 +1,44 @@
1
+ import { default as React } from 'react';
2
+ export interface DateTimeRangeValue {
3
+ startAt: number | null;
4
+ endAt: number | null;
5
+ }
6
+ export interface ShortcutOption {
7
+ label: string;
8
+ value: "15m" | "1h" | "24h" | "7d" | "today";
9
+ }
10
+ export interface VustDateTimeRangePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
11
+ /** 绑定的时间范围,使用 Unix epoch milliseconds */
12
+ value: DateTimeRangeValue;
13
+ /** 占位文案 */
14
+ placeholder?: string;
15
+ /** 起始端标签 */
16
+ startLabel?: string;
17
+ /** 结束端标签 */
18
+ endLabel?: string;
19
+ /** 快捷范围标题 */
20
+ shortcutsLabel?: string;
21
+ /** 日历标题 */
22
+ calendarLabel?: string;
23
+ /** 时间标题 */
24
+ timeLabel?: string;
25
+ /** 清空按钮文案 */
26
+ clearLabel?: string;
27
+ /** 确认按钮文案 */
28
+ confirmLabel?: string;
29
+ /** 取消按钮文案 */
30
+ cancelLabel?: string;
31
+ /** 当前应用语言 */
32
+ locale?: string;
33
+ /** 星期标题,长度为 7 */
34
+ weekDays?: string[];
35
+ /** 快捷范围选项 */
36
+ shortcuts?: ShortcutOption[];
37
+ /** 是否禁用 */
38
+ disabled?: boolean;
39
+ /** 改变值时的回调 */
40
+ onChange?: (value: DateTimeRangeValue) => void;
41
+ /** 点击确认应用时的回调 */
42
+ onApply?: (value: DateTimeRangeValue) => void;
43
+ }
44
+ export declare const VustDateTimeRangePicker: React.FC<VustDateTimeRangePickerProps>;
@@ -0,0 +1,23 @@
1
+ import { default as React } from 'react';
2
+ export interface DescriptionItem {
3
+ label: string;
4
+ value?: React.ReactNode;
5
+ slot?: string;
6
+ span?: number;
7
+ render?: (item: DescriptionItem, data?: any) => React.ReactNode;
8
+ }
9
+ export interface VustDescriptionsProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ /** 标题 */
11
+ title?: string;
12
+ /** 列表项配置 */
13
+ items: DescriptionItem[];
14
+ /** 原始数据对象 (用于插槽渲染) */
15
+ data?: Record<string, any>;
16
+ /** 列数 */
17
+ column?: number;
18
+ /** 是否显示边框 */
19
+ border?: boolean;
20
+ /** 插槽渲染器,对应 Vue 的 slot */
21
+ slots?: Record<string, (item: DescriptionItem, data?: any) => React.ReactNode>;
22
+ }
23
+ export declare const VustDescriptions: React.FC<VustDescriptionsProps>;
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ export interface VustDialogProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** 对话框是否显示 */
4
+ visible: boolean;
5
+ /** 对话框标题 */
6
+ title: string;
7
+ /** 自定义宽度,支持 px 或百分比,默认值为 500px */
8
+ width?: string;
9
+ /** 点击遮罩层是否允许自动关闭对话框,默认为 true */
10
+ closeOnClickOverlay?: boolean;
11
+ /** 对话框遮罩层级,默认使用 VDL modal 层级 */
12
+ zIndex?: number | string;
13
+ /** 关闭回调 */
14
+ onClose?: () => void;
15
+ /** 底部渲染插槽 */
16
+ footer?: React.ReactNode;
17
+ /** 对话框内容 */
18
+ children?: React.ReactNode;
19
+ }
20
+ export declare const VustDialog: React.FC<VustDialogProps>;
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ export interface VustDrawerProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** 抽屉是否显示 */
4
+ visible: boolean;
5
+ /** 抽屉标题 */
6
+ title?: string;
7
+ /** 自定义宽度,支持 px 或百分比,默认值为 420px */
8
+ width?: string;
9
+ /** 点击遮罩层是否允许自动关闭抽屉,默认为 true */
10
+ closeOnOverlay?: boolean;
11
+ /** 关闭回调 */
12
+ onClose?: () => void;
13
+ /** 底部操作按钮栏 */
14
+ footer?: React.ReactNode;
15
+ /** 抽屉主体内容 */
16
+ children?: React.ReactNode;
17
+ }
18
+ export declare const VustDrawer: React.FC<VustDrawerProps>;
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ export interface VustEmptyProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** 描述文字 */
4
+ description?: string;
5
+ /** VDL 图标名称 */
6
+ icon?: string;
7
+ /** 自定义图标节点,会覆盖 icon 属性 */
8
+ iconNode?: React.ReactNode;
9
+ /** 额外内容 */
10
+ extra?: React.ReactNode;
11
+ /** 子元素,将作为 description 渲染 */
12
+ children?: React.ReactNode;
13
+ }
14
+ export declare const VustEmpty: React.FC<VustEmptyProps>;
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ export interface VustFormItemProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** 标签文本 */
4
+ label?: string;
5
+ /** 是否必填 (显示红星) */
6
+ required?: boolean;
7
+ /** 提示文本 */
8
+ hint?: string;
9
+ htmlFor?: string;
10
+ error?: string;
11
+ labelId?: string;
12
+ hintId?: string;
13
+ errorId?: string;
14
+ }
15
+ export declare const VustFormItem: React.FC<VustFormItemProps>;
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { IconNamespace } from '@vustcc/icons';
3
+ export interface VustIconProps extends React.HTMLAttributes<HTMLSpanElement> {
4
+ name?: string | null;
5
+ namespace?: IconNamespace;
6
+ size?: number | string;
7
+ label?: string;
8
+ decorative?: boolean;
9
+ }
10
+ export declare const VustIcon: React.FC<VustIconProps>;
@@ -0,0 +1,40 @@
1
+ import { default as React } from 'react';
2
+ export interface VustInputProps<T extends string | number | null = string> extends Omit<React.HTMLAttributes<HTMLDivElement>, "value" | "onChange" | "onFocus" | "onBlur" | "id" | "aria-label" | "aria-labelledby" | "aria-describedby"> {
3
+ /** 绑定值 */
4
+ value: T;
5
+ /** 输入类型 */
6
+ type?: "text" | "password" | "textarea" | "number" | "datetime-local";
7
+ /** 占位符 */
8
+ placeholder?: string;
9
+ /** 是否禁用 */
10
+ disabled?: boolean;
11
+ /** 是否只读 */
12
+ readOnly?: boolean;
13
+ /** 最大长度 */
14
+ maxLength?: number;
15
+ /** 行数 (仅 textarea 有效) */
16
+ rows?: number;
17
+ /** 是否显示密码切换按钮 */
18
+ showPassword?: boolean;
19
+ /** 最小值 (仅 number 有效) */
20
+ min?: number | string;
21
+ /** 最大值 (仅 number 有效) */
22
+ max?: number | string;
23
+ /** 步长 (仅 number 有效) */
24
+ step?: number | string;
25
+ /** 自动填充属性 */
26
+ autoComplete?: string;
27
+ /** 值改变事件 */
28
+ onChange?: (value: T) => void;
29
+ invalid?: boolean;
30
+ id?: string;
31
+ name?: string;
32
+ ariaLabel?: string;
33
+ ariaLabelledby?: string;
34
+ ariaDescribedby?: string;
35
+ /** focus 事件 */
36
+ onFocus?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
37
+ /** blur 事件 */
38
+ onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
39
+ }
40
+ export declare function VustInput<T extends string | number | null = string>({ value, type, placeholder, disabled, readOnly, maxLength, rows, showPassword, min, max, step, autoComplete, onChange, onFocus, onBlur, invalid, id, name, ariaLabel, ariaLabelledby, ariaDescribedby, className, ...rest }: VustInputProps<T>): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ export interface VustLoadingProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** 是否显示加载中 */
4
+ loading: boolean;
5
+ /** 提示文字 */
6
+ text?: string;
7
+ /** 是否覆盖父容器 */
8
+ cover?: boolean;
9
+ }
10
+ export declare const VustLoading: React.FC<VustLoadingProps>;
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ export interface MenuItem {
3
+ key: string;
4
+ label: string;
5
+ }
6
+ export interface MenuCategory {
7
+ key: string;
8
+ label: string;
9
+ children: MenuItem[];
10
+ }
11
+ export interface VustMenuProps extends Omit<React.HTMLAttributes<HTMLElement>, "onChange" | "onSelect"> {
12
+ /** 当前选中的菜单项 key */
13
+ value: string;
14
+ /** 菜单项列表 (带分组) */
15
+ items: MenuCategory[];
16
+ /** 绑定值改变事件 */
17
+ onChange?: (key: string) => void;
18
+ }
19
+ export declare const VustMenu: React.FC<VustMenuProps>;
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ export interface VustModalProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** 是否可见 */
4
+ visible: boolean;
5
+ /** 标题 */
6
+ title: string;
7
+ /** 消息内容 */
8
+ message: string;
9
+ /** 确认按钮文案 */
10
+ confirmText?: string;
11
+ /** 取消按钮文案 */
12
+ cancelText?: string;
13
+ /** 确认按钮类型 */
14
+ type?: "primary" | "danger" | "warning";
15
+ /** 确认回调 */
16
+ onConfirm?: () => void;
17
+ /** 取消回调 */
18
+ onCancel?: () => void;
19
+ }
20
+ export declare const VustModal: React.FC<VustModalProps>;
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ export interface VustPaginationProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** 当前页码 (从 1 开始) */
4
+ currentPage: number;
5
+ /** 总页数 */
6
+ totalPages: number;
7
+ /** 最大可见页码数,默认为 5 */
8
+ maxVisibleButtons?: number;
9
+ /** 页码改变时的回调 */
10
+ onPageChange?: (page: number) => void;
11
+ ariaLabel?: string;
12
+ previousLabel?: string;
13
+ nextLabel?: string;
14
+ }
15
+ export declare const VustPagination: React.FC<VustPaginationProps>;
@@ -0,0 +1,33 @@
1
+ import { default as React } from 'react';
2
+ export interface VustSelectOption {
3
+ value: string | number;
4
+ label: string;
5
+ disabled?: boolean;
6
+ hint?: string;
7
+ }
8
+ export interface VustSelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "value" | "onChange" | "id" | "aria-label" | "aria-labelledby" | "aria-describedby"> {
9
+ /** 绑定值 */
10
+ value: string | number | null;
11
+ /** 选项列表 */
12
+ options: VustSelectOption[];
13
+ /** 占位符 */
14
+ placeholder?: string;
15
+ /** 是否禁用 */
16
+ disabled?: boolean;
17
+ id?: string;
18
+ name?: string;
19
+ ariaLabel?: string;
20
+ ariaLabelledby?: string;
21
+ ariaDescribedby?: string;
22
+ /** 改变值时的回调 */
23
+ onChange?: (value: string | number | null) => void;
24
+ /** 禁用选项被点击时的回调 */
25
+ onOptionDisabled?: (option: VustSelectOption) => void;
26
+ /** 下拉列表滚动时的回调 */
27
+ onDropdownScroll?: (event: React.UIEvent<HTMLUListElement>) => void;
28
+ /** 下拉列表滚动到底部附近时的回调 */
29
+ onDropdownReachBottom?: (event: React.UIEvent<HTMLUListElement>) => void;
30
+ /** 下拉列表底部内容 */
31
+ dropdownFooter?: React.ReactNode;
32
+ }
33
+ export declare const VustSelect: React.FC<VustSelectProps>;
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ export interface VustSelectionBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "aria-label"> {
3
+ /** 已选择项目数量。 */
4
+ count: number;
5
+ /** 数量前的本地化说明,例如“已选择”。 */
6
+ label: string;
7
+ /** 清除选择按钮文案;不传时隐藏按钮。 */
8
+ clearLabel?: string;
9
+ /** 是否禁止清除选择。 */
10
+ clearDisabled?: boolean;
11
+ /** 选择摘要的无障碍名称。 */
12
+ ariaLabel?: string;
13
+ /** 清除选择回调。 */
14
+ onClear?: () => void;
15
+ /** 批量操作。 */
16
+ children?: React.ReactNode;
17
+ }
18
+ export declare const VustSelectionBar: React.FC<VustSelectionBarProps>;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export interface VustSwitchProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "value"> {
3
+ value: boolean;
4
+ onChange?: (value: boolean) => void;
5
+ activeText?: string;
6
+ disabled?: boolean;
7
+ }
8
+ export declare const VustSwitch: React.FC<VustSwitchProps>;
@@ -0,0 +1,59 @@
1
+ import { default as React } from 'react';
2
+ export interface VustTableColumn<T = any> {
3
+ prop?: string;
4
+ label: string;
5
+ width?: string | number;
6
+ minWidth?: string | number;
7
+ align?: "left" | "center" | "right";
8
+ headerAlign?: "left" | "center" | "right";
9
+ slot?: string;
10
+ headerSlot?: string;
11
+ renderCell?: (row: T, column: VustTableColumn<T>, index: number) => React.ReactNode;
12
+ renderHeader?: (column: VustTableColumn<T>, index: number) => React.ReactNode;
13
+ fixed?: "left" | "right";
14
+ }
15
+ export interface VustTableProps<T> extends React.HTMLAttributes<HTMLDivElement> {
16
+ /** 表格数据 */
17
+ data: T[];
18
+ /** 列配置 */
19
+ columns: VustTableColumn<T>[];
20
+ /** 是否显示全网格边框 */
21
+ border?: boolean;
22
+ /** 无数据时显示的占位文案 */
23
+ emptyText?: string;
24
+ rowKey?: keyof T | ((row: T) => React.Key);
25
+ /** 插槽映射 (对应 Vue 中的 scoped slots) */
26
+ slots?: Record<string, (scope: {
27
+ row: T;
28
+ column: VustTableColumn<T>;
29
+ index: number;
30
+ }) => React.ReactNode>;
31
+ /** 表头插槽映射 */
32
+ headerSlots?: Record<string, (scope: {
33
+ column: VustTableColumn<T>;
34
+ index: number;
35
+ }) => React.ReactNode>;
36
+ /** 自定义空数据占位 */
37
+ emptySlot?: React.ReactNode;
38
+ /** 鼠标悬浮行回调 */
39
+ onRowMouseEnter?: (row: T, event: React.MouseEvent<HTMLTableRowElement>, index: number) => void;
40
+ /** 右键行回调 */
41
+ onRowContextMenu?: (row: T, event: React.MouseEvent<HTMLTableRowElement>, index: number) => void;
42
+ /** 是否显示内置选择列。 */
43
+ selectable?: boolean;
44
+ /** 当前选中的稳定行键。 */
45
+ selectedRowKeys?: React.Key[];
46
+ /** 更新受控选择状态。 */
47
+ onSelectedRowKeysChange?: (keys: React.Key[]) => void;
48
+ /** 选择状态变化回调。 */
49
+ onSelectionChange?: (keys: React.Key[]) => void;
50
+ /** 判断一行是否允许选择。 */
51
+ rowSelectable?: (row: T, index: number) => boolean;
52
+ /** 全选复选框的无障碍名称。 */
53
+ selectAllLabel?: string;
54
+ /** 行复选框的无障碍名称或计算函数。 */
55
+ selectRowLabel?: string | ((row: T, index: number) => string);
56
+ /** 选择列宽度。 */
57
+ selectionColumnWidth?: number;
58
+ }
59
+ export declare function VustTable<T extends Record<string, any>>({ data, columns, border, emptyText, rowKey, slots, headerSlots, emptySlot, onRowMouseEnter, onRowContextMenu, selectable, selectedRowKeys, onSelectedRowKeysChange, onSelectionChange, rowSelectable, selectAllLabel, selectRowLabel, selectionColumnWidth, className, ...rest }: VustTableProps<T>): React.JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ export interface TabItem {
3
+ label: string;
4
+ name: string;
5
+ disabled?: boolean;
6
+ }
7
+ export interface VustTabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
8
+ /** 当前选中的标签页 name */
9
+ value: string;
10
+ /** 标签页列表 */
11
+ tabs: TabItem[];
12
+ /** 绑定值改变事件 */
13
+ onChange?: (name: string) => void;
14
+ }
15
+ export declare const VustTabs: React.FC<VustTabsProps>;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export interface VustTagProps extends React.HTMLAttributes<HTMLSpanElement> {
3
+ /** 标签类型 */
4
+ type?: "primary" | "success" | "warning" | "danger" | "info" | "default";
5
+ /** 主题风格 */
6
+ effect?: "light" | "plain" | "dark";
7
+ }
8
+ export declare const VustTag: React.FC<VustTagProps>;