vxui-react 1.3.5 → 1.3.7
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/README.en.md +82 -5
- package/README.md +84 -5
- package/dist/index.cjs +22 -66
- package/dist/index.js +6527 -5506
- package/dist/src/components/Article.d.ts +72 -0
- package/dist/src/components/Dialog.d.ts +24 -6
- package/dist/src/components/Select.d.ts +8 -1
- package/dist/src/components/Sheet/Sheet.d.ts +30 -0
- package/dist/src/components/Sheet/SheetPanel.d.ts +44 -0
- package/dist/src/components/Sheet/index.d.ts +2 -0
- package/dist/src/components/Sheet/useSheetState.d.ts +34 -0
- package/dist/src/components/mobile/BottomSheet.d.ts +28 -0
- package/dist/src/lib/VXUIProvider.d.ts +29 -0
- package/dist/src/lib/breakpoints.d.ts +63 -0
- package/dist/src/lib/dialogPopover.d.ts +26 -0
- package/dist/src/lib/index.d.ts +23 -8
- package/dist/src/lib/viewport.d.ts +6 -0
- package/dist/vxui-react.css +1 -1
- package/llms.txt +6 -2
- package/package.json +4 -3
- package/dist/src/components/AlertDialog.d.ts +0 -14
- package/dist/src/components/Sheet.d.ts +0 -13
- package/dist/src/components/__tests__/Accordion.test.d.ts +0 -1
- package/dist/src/components/__tests__/ActionSheet.test.d.ts +0 -1
- package/dist/src/components/__tests__/Alert.test.d.ts +0 -1
- package/dist/src/components/__tests__/AlertDialog.test.d.ts +0 -1
- package/dist/src/components/__tests__/AppShell.test.d.ts +0 -1
- package/dist/src/components/__tests__/Avatar.test.d.ts +0 -1
- package/dist/src/components/__tests__/Badge.test.d.ts +0 -1
- package/dist/src/components/__tests__/BottomNav.test.d.ts +0 -1
- package/dist/src/components/__tests__/Breadcrumb.test.d.ts +0 -1
- package/dist/src/components/__tests__/Button.test.d.ts +0 -1
- package/dist/src/components/__tests__/Calendar.test.d.ts +0 -1
- package/dist/src/components/__tests__/Card.test.d.ts +0 -1
- package/dist/src/components/__tests__/Carousel.test.d.ts +0 -1
- package/dist/src/components/__tests__/Checkbox.test.d.ts +0 -1
- package/dist/src/components/__tests__/CodeBlock.test.d.ts +0 -1
- package/dist/src/components/__tests__/ColorPicker.test.d.ts +0 -1
- package/dist/src/components/__tests__/CommandPalette.test.d.ts +0 -1
- package/dist/src/components/__tests__/ContextMenu.test.d.ts +0 -1
- package/dist/src/components/__tests__/DatePicker.test.d.ts +0 -1
- package/dist/src/components/__tests__/Dialog.test.d.ts +0 -1
- package/dist/src/components/__tests__/DialogFormControls.test.d.ts +0 -1
- package/dist/src/components/__tests__/DropdownMenu.test.d.ts +0 -1
- package/dist/src/components/__tests__/EmptyState.test.d.ts +0 -1
- package/dist/src/components/__tests__/FileUpload.test.d.ts +0 -1
- package/dist/src/components/__tests__/Form.test.d.ts +0 -1
- package/dist/src/components/__tests__/Heading.test.d.ts +0 -1
- package/dist/src/components/__tests__/HoverCard.test.d.ts +0 -1
- package/dist/src/components/__tests__/Input.test.d.ts +0 -1
- package/dist/src/components/__tests__/Label.test.d.ts +0 -1
- package/dist/src/components/__tests__/LanguageSwitcher.test.d.ts +0 -1
- package/dist/src/components/__tests__/Menubar.test.d.ts +0 -1
- package/dist/src/components/__tests__/MobileDrawer.test.d.ts +0 -1
- package/dist/src/components/__tests__/MobileList.test.d.ts +0 -1
- package/dist/src/components/__tests__/MultiSelect.test.d.ts +0 -1
- package/dist/src/components/__tests__/NavigationMenu.test.d.ts +0 -1
- package/dist/src/components/__tests__/NumberInput.test.d.ts +0 -1
- package/dist/src/components/__tests__/Pagination.test.d.ts +0 -1
- package/dist/src/components/__tests__/Popover.test.d.ts +0 -1
- package/dist/src/components/__tests__/Progress.test.d.ts +0 -1
- package/dist/src/components/__tests__/Radio.test.d.ts +0 -1
- package/dist/src/components/__tests__/Rating.test.d.ts +0 -1
- package/dist/src/components/__tests__/Resizable.test.d.ts +0 -1
- package/dist/src/components/__tests__/Responsive.test.d.ts +0 -1
- package/dist/src/components/__tests__/ScrollArea.test.d.ts +0 -1
- package/dist/src/components/__tests__/SegmentedControl.test.d.ts +0 -1
- package/dist/src/components/__tests__/Select.test.d.ts +0 -1
- package/dist/src/components/__tests__/Separator.test.d.ts +0 -1
- package/dist/src/components/__tests__/Sheet.test.d.ts +0 -1
- package/dist/src/components/__tests__/Shell.test.d.ts +0 -1
- package/dist/src/components/__tests__/Skeleton.test.d.ts +0 -1
- package/dist/src/components/__tests__/Slider.test.d.ts +0 -1
- package/dist/src/components/__tests__/Spinner.test.d.ts +0 -1
- package/dist/src/components/__tests__/Stepper.test.d.ts +0 -1
- package/dist/src/components/__tests__/Switch.test.d.ts +0 -1
- package/dist/src/components/__tests__/Table.test.d.ts +0 -1
- package/dist/src/components/__tests__/Tabs.test.d.ts +0 -1
- package/dist/src/components/__tests__/TagInput.test.d.ts +0 -1
- package/dist/src/components/__tests__/Text.test.d.ts +0 -1
- package/dist/src/components/__tests__/Textarea.test.d.ts +0 -1
- package/dist/src/components/__tests__/ThemeProvider.test.d.ts +0 -1
- package/dist/src/components/__tests__/TimePicker.test.d.ts +0 -1
- package/dist/src/components/__tests__/Timeline.test.d.ts +0 -1
- package/dist/src/components/__tests__/Toast.test.d.ts +0 -1
- package/dist/src/components/__tests__/Toggle.test.d.ts +0 -1
- package/dist/src/components/__tests__/Tooltip.test.d.ts +0 -1
- package/dist/src/components/__tests__/TreeView.test.d.ts +0 -1
- package/dist/src/lib/__tests__/cx.test.d.ts +0 -1
- package/dist/src/lib/__tests__/viewport.test.d.ts +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface ArticleProps extends HTMLAttributes<HTMLElement> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function Article({ children, className, ...props }: ArticleProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export interface ArticleHeaderProps extends HTMLAttributes<HTMLElement> {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function ArticleHeader({ children, className, ...props }: ArticleHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export interface ArticleTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function ArticleTitle({ children, className, ...props }: ArticleTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export interface ArticleBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare function ArticleBody({ children, className, ...props }: ArticleBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export interface SectionProps extends HTMLAttributes<HTMLElement> {
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/** 章节 id,用于锚点跳转 */
|
|
21
|
+
sectionId?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function Section({ children, className, sectionId, ...props }: SectionProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export interface SectionHeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
/** 锚点链接,如果提供则显示 # 锚点图标 */
|
|
27
|
+
anchor?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function SectionHeading({ children, className, anchor, ...props }: SectionHeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export interface PagerItem {
|
|
31
|
+
label: string;
|
|
32
|
+
onClick: () => void;
|
|
33
|
+
}
|
|
34
|
+
export interface PagerProps {
|
|
35
|
+
/** 上一页,不提供则隐藏 */
|
|
36
|
+
prev?: PagerItem;
|
|
37
|
+
/** 下一页,不提供则隐藏 */
|
|
38
|
+
next?: PagerItem;
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function Pager({ prev, next, className }: PagerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
42
|
+
export interface PropsTableColumn {
|
|
43
|
+
prop: string;
|
|
44
|
+
type: string;
|
|
45
|
+
default?: string;
|
|
46
|
+
description: string;
|
|
47
|
+
required?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface PropsTableProps {
|
|
50
|
+
columns: PropsTableColumn[];
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function PropsTable({ columns, className }: PropsTableProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export interface ArticleEmptyStateProps {
|
|
55
|
+
icon?: ReactNode;
|
|
56
|
+
title: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
action?: ReactNode;
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare function ArticleEmptyState({ icon, title, description, action, className }: ArticleEmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export interface StatItem {
|
|
63
|
+
label: string;
|
|
64
|
+
value: string;
|
|
65
|
+
hint?: string;
|
|
66
|
+
icon?: ReactNode;
|
|
67
|
+
}
|
|
68
|
+
export interface StatsGridProps {
|
|
69
|
+
items: StatItem[];
|
|
70
|
+
className?: string;
|
|
71
|
+
}
|
|
72
|
+
export declare function StatsGrid({ items, className }: StatsGridProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
1
|
+
import { ReactNode, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent } from 'react';
|
|
3
2
|
export type DialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
4
3
|
export type DialogPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
5
4
|
export type DialogPlacement = 'center' | 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-half' | 'right-half' | 'bottom-half' | 'left-half';
|
|
6
|
-
export interface DialogProps
|
|
5
|
+
export interface DialogProps {
|
|
7
6
|
trigger: ReactNode;
|
|
8
7
|
title: string;
|
|
9
8
|
description?: string;
|
|
10
|
-
children
|
|
9
|
+
children?: ReactNode;
|
|
11
10
|
footer?: ReactNode;
|
|
12
11
|
className?: string;
|
|
13
12
|
/** Dialog width preset. Default: 'md' */
|
|
@@ -22,10 +21,29 @@ export interface DialogProps extends Pick<DialogPrimitive.DialogProps, 'defaultO
|
|
|
22
21
|
closable?: boolean;
|
|
23
22
|
/** When true, the dialog will be displayed in fullscreen mode. Default: false */
|
|
24
23
|
fullscreen?: boolean;
|
|
24
|
+
/** Controlled open state */
|
|
25
|
+
open?: boolean;
|
|
26
|
+
/** Default open state for uncontrolled mode */
|
|
27
|
+
defaultOpen?: boolean;
|
|
28
|
+
/** Callback when open state changes */
|
|
29
|
+
onOpenChange?: (open: boolean) => void;
|
|
30
|
+
/** Built-in confirm/cancel buttons — shown when onConfirm is provided (unless footer is also given) */
|
|
31
|
+
onConfirm?: () => void;
|
|
32
|
+
onCancel?: () => void;
|
|
33
|
+
confirmLabel?: string;
|
|
34
|
+
cancelLabel?: string;
|
|
35
|
+
confirmVariant?: 'solid' | 'danger';
|
|
36
|
+
}
|
|
37
|
+
export interface DialogCloseProps {
|
|
38
|
+
asChild?: boolean;
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
onClick?: (e: ReactMouseEvent | ReactKeyboardEvent) => void;
|
|
41
|
+
className?: string;
|
|
42
|
+
[key: string]: unknown;
|
|
25
43
|
}
|
|
26
|
-
export declare function Dialog({ trigger, title, description, children, footer, className, size, padding, placement, scrollable, closable, fullscreen, ...props }: DialogProps): import("react/jsx-runtime").JSX.Element;
|
|
27
44
|
/**
|
|
28
45
|
* Wraps any child element so that clicking it closes the parent Dialog.
|
|
29
46
|
* Usage: <DialogClose asChild><Button>Cancel</Button></DialogClose>
|
|
30
47
|
*/
|
|
31
|
-
export declare
|
|
48
|
+
export declare function DialogClose({ asChild, children, onClick, className, ...rest }: DialogCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare function Dialog({ trigger, title, description, children, footer, className, size, padding, placement, scrollable, closable, fullscreen, open: openProp, defaultOpen, onOpenChange, onConfirm, onCancel, confirmLabel, cancelLabel, confirmVariant, }: DialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
export interface SelectOption {
|
|
2
3
|
value: string;
|
|
3
4
|
label: string;
|
|
@@ -18,5 +19,11 @@ export interface SelectProps {
|
|
|
18
19
|
emptyText?: string;
|
|
19
20
|
searchable?: boolean | number;
|
|
20
21
|
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 自定义移动端选择面板组件。
|
|
24
|
+
* 默认使用 Sheet 组件。传入 null 可禁用移动端面板。
|
|
25
|
+
* 可用于注入自定义的 BottomSheet 实现以解耦依赖。
|
|
26
|
+
*/
|
|
27
|
+
mobileSheet?: ReactNode;
|
|
21
28
|
}
|
|
22
|
-
export declare function Select({ options, value: controlledValue, defaultValue, onChange, placeholder, searchPlaceholder, label, hint, error, disabled, clearable, emptyText, searchable, className, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function Select({ options, value: controlledValue, defaultValue, onChange, placeholder, searchPlaceholder, label, hint, error, disabled, clearable, emptyText, searchable, className, mobileSheet, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SheetActionItem, SheetSide } from './SheetPanel';
|
|
3
|
+
export type { SheetSide } from './SheetPanel';
|
|
4
|
+
export type { SheetActionItemProps } from './SheetPanel';
|
|
5
|
+
export type SheetVariant = 'default' | 'action';
|
|
6
|
+
export interface SheetProps {
|
|
7
|
+
trigger?: ReactNode;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
side?: SheetSide;
|
|
10
|
+
variant?: SheetVariant;
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
header?: ReactNode;
|
|
14
|
+
footer?: ReactNode;
|
|
15
|
+
open?: boolean;
|
|
16
|
+
defaultOpen?: boolean;
|
|
17
|
+
onOpenChange?: (open: boolean) => void;
|
|
18
|
+
showClose?: boolean;
|
|
19
|
+
closeOnOverlayClick?: boolean;
|
|
20
|
+
showConfirm?: boolean;
|
|
21
|
+
confirmText?: string;
|
|
22
|
+
confirmDisabled?: boolean;
|
|
23
|
+
onConfirm?: () => void;
|
|
24
|
+
className?: string;
|
|
25
|
+
width?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function Sheet({ trigger, title, description, side, variant, children, header, footer, className, open: openProp, defaultOpen, onOpenChange, showClose, closeOnOverlayClick, showConfirm, confirmText, confirmDisabled, onConfirm, width, }: SheetProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare namespace Sheet {
|
|
29
|
+
var Item: typeof SheetActionItem;
|
|
30
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { SheetPhase } from './useSheetState';
|
|
3
|
+
export type SheetSide = 'left' | 'right' | 'top' | 'bottom';
|
|
4
|
+
export interface SheetPanelProps {
|
|
5
|
+
side: SheetSide;
|
|
6
|
+
phase: SheetPhase;
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
header?: ReactNode;
|
|
11
|
+
footer?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
showClose?: boolean;
|
|
14
|
+
showConfirm?: boolean;
|
|
15
|
+
confirmText?: string;
|
|
16
|
+
confirmDisabled?: boolean;
|
|
17
|
+
onConfirm?: () => void;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
/** 点击遮罩层关闭 */
|
|
20
|
+
closeOnOverlayClick?: boolean;
|
|
21
|
+
/** action 变体:使用操作列表样式(无关闭按钮、无确认按钮) */
|
|
22
|
+
action?: boolean;
|
|
23
|
+
/** 抽屉宽度(仅 left/right 有效) */
|
|
24
|
+
width?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 统一的 Sheet 面板组件
|
|
28
|
+
*
|
|
29
|
+
* 同时处理桌面端和移动端的所有方向:
|
|
30
|
+
* - left/right:侧边滑入面板
|
|
31
|
+
* - top/bottom:顶部/底部滑入面板
|
|
32
|
+
* - action:底部操作列表(无关闭/确认按钮)
|
|
33
|
+
*
|
|
34
|
+
* 行为统一:
|
|
35
|
+
* - 只能通过关闭按钮或确认按钮关闭,不能点击遮罩
|
|
36
|
+
* - 统一的打开/关闭 animation
|
|
37
|
+
* - 统一的确认按钮
|
|
38
|
+
*/
|
|
39
|
+
export declare function SheetPanel({ side, phase, title, description, children, header, footer, className, showClose, showConfirm, confirmText, confirmDisabled, onConfirm, onClose, closeOnOverlayClick, action, width, }: SheetPanelProps): import('react').ReactPortal | null;
|
|
40
|
+
export interface SheetActionItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
41
|
+
icon?: ReactNode;
|
|
42
|
+
destructive?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare function SheetActionItem({ icon, destructive, className, children, ...props }: SheetActionItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type SheetPhase = 'hidden' | 'visible' | 'exiting';
|
|
2
|
+
export interface UseSheetStateProps {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
defaultOpen?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface UseSheetStateReturn {
|
|
8
|
+
/** 当前是否在视觉上可见 */
|
|
9
|
+
isVisible: boolean;
|
|
10
|
+
/** 当前动画阶段 */
|
|
11
|
+
phase: SheetPhase;
|
|
12
|
+
/** 打开 */
|
|
13
|
+
open: () => void;
|
|
14
|
+
/** 关闭(启动退出动画) */
|
|
15
|
+
close: () => void;
|
|
16
|
+
/** dialog 状态:是否逻辑上已打开 */
|
|
17
|
+
isOpen: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Sheet 状态管理 hook
|
|
21
|
+
*
|
|
22
|
+
* 三阶段:hidden → visible → exiting → hidden
|
|
23
|
+
*
|
|
24
|
+
* - visible: 组件可见,入场 animation 已在挂载时自动播放完毕
|
|
25
|
+
* - exiting: 用户触发关闭,CSS animation 播放退场动画
|
|
26
|
+
* - hidden: 退场动画完成,组件卸载
|
|
27
|
+
*
|
|
28
|
+
* 关闭流程统一由 isOpen 驱动:
|
|
29
|
+
* close() → dialogClose() → isOpen=false → useEffect → setPhase('exiting')
|
|
30
|
+
* → setTimeout → setPhase('hidden')
|
|
31
|
+
*
|
|
32
|
+
* 避免重复触发:使用 ref 标记是否正在退出,防止 isOpen 变化重复触发。
|
|
33
|
+
*/
|
|
34
|
+
export declare function useSheetState(props: UseSheetStateProps): UseSheetStateReturn;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface BottomSheetProps {
|
|
3
|
+
/** 是否打开(上层只能设为 true 来打开,关闭由 BottomSheet 自主控制) */
|
|
4
|
+
open: boolean;
|
|
5
|
+
/** 当 BottomSheet 完成关闭动画后的回调(用于上层清理 open 状态) */
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
/** 标题 */
|
|
8
|
+
title?: ReactNode;
|
|
9
|
+
/** 描述 */
|
|
10
|
+
description?: ReactNode;
|
|
11
|
+
/** 是否显示拖动把手,默认 true */
|
|
12
|
+
draggable?: boolean;
|
|
13
|
+
/** 自定义类名 */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** 内容区域 */
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
/** 是否在 Dialog 内渲染到 dialogContent 中,默认 false */
|
|
18
|
+
inlineInDialog?: boolean;
|
|
19
|
+
/** 是否显示确认按钮,默认 false */
|
|
20
|
+
showConfirm?: boolean;
|
|
21
|
+
/** 确认按钮文字,默认 "确认" */
|
|
22
|
+
confirmText?: string;
|
|
23
|
+
/** 确认按钮是否禁用 */
|
|
24
|
+
confirmDisabled?: boolean;
|
|
25
|
+
/** 用户点击确认按钮的回调 */
|
|
26
|
+
onConfirm?: () => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function BottomSheet({ open, onClose, title, description, draggable, className, children, inlineInDialog, showConfirm, confirmText, confirmDisabled, onConfirm, }: BottomSheetProps): import('react').ReactPortal | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ThemeRegistry } from '../components/ThemeProvider';
|
|
3
|
+
export interface VXUIProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* 主题配置,传递给 ThemeProvider。
|
|
7
|
+
* 包含预设主题和自定义主题。
|
|
8
|
+
*/
|
|
9
|
+
themes?: ThemeRegistry;
|
|
10
|
+
/** 默认主题名称 */
|
|
11
|
+
defaultTheme?: string;
|
|
12
|
+
/** localStorage 存储键名 */
|
|
13
|
+
storageKey?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 组合 Provider,一次性挂载 ThemeProvider、ViewportProvider、ToastProvider。
|
|
17
|
+
*
|
|
18
|
+
* 等价于:
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <ThemeProvider themes={themes} defaultTheme={defaultTheme}>
|
|
21
|
+
* <ViewportProvider>
|
|
22
|
+
* <ToastProvider>
|
|
23
|
+
* {children}
|
|
24
|
+
* </ToastProvider>
|
|
25
|
+
* </ViewportProvider>
|
|
26
|
+
* </ThemeProvider>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function VXUIProvider({ children, themes, defaultTheme, storageKey, }: VXUIProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified breakpoint constants shared between JS and CSS.
|
|
3
|
+
*
|
|
4
|
+
* ── 断点系统说明 ─────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* 本系统有两套断点,用途不同,请勿混淆:
|
|
7
|
+
*
|
|
8
|
+
* 1. CSS 布局断点 (CSS Media Query Breakpoints)
|
|
9
|
+
* ──────────────────────────────────────────
|
|
10
|
+
* 用于控制页面布局在不同视口宽度下的表现。
|
|
11
|
+
* sm: 640px — 手机布局断点
|
|
12
|
+
* md: 768px — 平板布局断点
|
|
13
|
+
* lg: 1000px — 桌面布局断点
|
|
14
|
+
*
|
|
15
|
+
* 这些值必须与 CSS 变量保持一致:
|
|
16
|
+
* --vx-breakpoint-sm: 640px
|
|
17
|
+
* --vx-breakpoint-md: 768px
|
|
18
|
+
* --vx-breakpoint-lg: 1000px
|
|
19
|
+
*
|
|
20
|
+
* 2. 设备检测断点 (Device Detection Breakpoints)
|
|
21
|
+
* ──────────────────────────────────────────
|
|
22
|
+
* 用于 JS 端判断设备类型(phone / tablet / desktop)。
|
|
23
|
+
* 基于物理屏幕尺寸(window.screen.width),而非视口宽度。
|
|
24
|
+
* PHONE_MAX_WIDTH = 1000
|
|
25
|
+
*
|
|
26
|
+
* 为什么设备检测使用 1000px 而不是 640px?
|
|
27
|
+
* - 物理屏幕宽度 ≤ 1000px 的设备可能是手机或平板
|
|
28
|
+
* - 物理屏幕宽度 > 1000px 的肯定是桌面显示器
|
|
29
|
+
* - 手机和平板的区分通过宽高比(aspect ratio)实现
|
|
30
|
+
* - 这样可以避免桌面浏览器窗口缩小时被误判为手机
|
|
31
|
+
*
|
|
32
|
+
* 3. 为什么 CSS 布局断点用 640px 而设备检测用 1000px?
|
|
33
|
+
* ──────────────────────────────────────────
|
|
34
|
+
* CSS 媒体查询基于视口宽度(viewport width),
|
|
35
|
+
* 而设备检测基于物理屏幕宽度(screen.width)。
|
|
36
|
+
* 两者是不同的概念:
|
|
37
|
+
* - 一个 1024px 物理宽度的平板,在分屏模式下视口可能只有 512px
|
|
38
|
+
* - CSS 需要在视口 640px 时就切换到手机布局
|
|
39
|
+
* - 但设备检测仍应识别为平板(物理宽度 > 640px)
|
|
40
|
+
*
|
|
41
|
+
* 因此这两套断点值不同是合理的,不需要强行统一。
|
|
42
|
+
* 关键是要在代码中明确区分它们的用途。
|
|
43
|
+
*
|
|
44
|
+
* ─────────────────────────────────────────────────────────────
|
|
45
|
+
*/
|
|
46
|
+
export declare const BREAKPOINTS: {
|
|
47
|
+
/** CSS 布局断点 - 手机布局 (max-width: 640px) */
|
|
48
|
+
readonly sm: 640;
|
|
49
|
+
/** CSS 布局断点 - 平板布局 (max-width: 768px) */
|
|
50
|
+
readonly md: 768;
|
|
51
|
+
/** CSS 布局断点 - 桌面布局 (min-width: 1000px) */
|
|
52
|
+
readonly lg: 1000;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* 设备检测 - 物理屏幕宽度阈值。
|
|
56
|
+
* 物理宽度 ≤ PHONE_MAX_WIDTH 的设备可能是手机或平板,
|
|
57
|
+
* 具体通过宽高比进一步区分。
|
|
58
|
+
*/
|
|
59
|
+
export declare const PHONE_MAX_WIDTH: 1000;
|
|
60
|
+
/** 宽高比阈值:低于此值判定为手机(窄屏设备) */
|
|
61
|
+
export declare const PHONE_ASPECT_RATIO_THRESHOLD = 0.7;
|
|
62
|
+
/** 宽高比阈值:低于此值且宽度 ≤ PHONE_MAX_WIDTH 判定为手机 */
|
|
63
|
+
export declare const TABLET_ASPECT_RATIO_THRESHOLD = 0.75;
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DialogContentContext — 允许 Dialog 组件将 content ref 传递给子组件,
|
|
3
|
+
* 替代通过 CSS 类名选择器查找 DOM 节点的脆弱方式。
|
|
4
|
+
*
|
|
5
|
+
* Select、MultiSelect、DatePicker 等组件通过此 context 获取 dialog content
|
|
6
|
+
* 元素,将 dropdown 面板 portal 到 dialog 内部以避免 z-index 裁剪问题。
|
|
7
|
+
*/
|
|
8
|
+
export declare const DialogContentContext: import('react').Context<HTMLElement | null>;
|
|
9
|
+
/**
|
|
10
|
+
* 获取 dialog content 元素引用。
|
|
11
|
+
* 优先使用 React Context,回退到 DOM 选择器方式以保持向后兼容。
|
|
12
|
+
*/
|
|
13
|
+
export declare function getDialogContent(node: HTMLElement | null): HTMLElement | null;
|
|
14
|
+
/**
|
|
15
|
+
* Determine if a popover/dropdown should be rendered inline or portaled.
|
|
16
|
+
*
|
|
17
|
+
* On mobile, dropdowns use BottomSheet component which always portals to body,
|
|
18
|
+
* so shouldInline is always false. On desktop, dropdowns use fixed-position
|
|
19
|
+
* popovers that should be portaled into the dialog content if inside a dialog
|
|
20
|
+
* to avoid z-index clipping issues.
|
|
21
|
+
*/
|
|
1
22
|
export declare function getDialogPopoverContext(node: HTMLElement | null): {
|
|
2
23
|
dialogContent: HTMLElement | null;
|
|
3
24
|
shouldInline: boolean;
|
|
4
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Hook for components that need to portal their dropdown into a dialog.
|
|
28
|
+
* Prefer this over getDialogPopoverContext for new code.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useDialogContentRef(): HTMLElement | null;
|
package/dist/src/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { BREAKPOINTS, PHONE_MAX_WIDTH, PHONE_ASPECT_RATIO_THRESHOLD, TABLET_ASPECT_RATIO_THRESHOLD } from './breakpoints';
|
|
2
2
|
export type { ViewportType, ViewportContextValue, ViewportProviderProps } from './viewport';
|
|
3
|
+
export { ViewportProvider, useViewport } from './viewport';
|
|
3
4
|
export { Responsive } from '../components/Responsive';
|
|
4
5
|
export type { ResponsiveProps } from '../components/Responsive';
|
|
6
|
+
export { VXUIProvider } from './VXUIProvider';
|
|
7
|
+
export type { VXUIProviderProps } from './VXUIProvider';
|
|
5
8
|
export { AppShell } from '../components/AppShell';
|
|
6
9
|
export type { AppShellProps, AppShellNavItem, AppShellNavSection } from '../components/AppShell';
|
|
7
10
|
export { Shell, ShellSidebar, ShellNav, ShellNavSection, ShellNavItem, ShellOverlay, ShellMain, ShellTopbar, ShellContent, } from '../components/Shell';
|
|
@@ -63,18 +66,12 @@ export { MobileShell, MobileTopBar, MobileIconButton } from '../components/mobil
|
|
|
63
66
|
export type { MobileShellProps, MobileTopBarProps, MobileIconButtonProps } from '../components/mobile/MobileShell';
|
|
64
67
|
export { BottomNav } from '../components/mobile/BottomNav';
|
|
65
68
|
export type { BottomNavProps, BottomNavItem } from '../components/mobile/BottomNav';
|
|
66
|
-
export { ActionSheet, ActionSheetItem } from '../components/mobile/ActionSheet';
|
|
67
|
-
export type { ActionSheetProps, ActionSheetItemProps } from '../components/mobile/ActionSheet';
|
|
68
69
|
export { MobileList, MobileListSection, MobileListItem } from '../components/mobile/MobileList';
|
|
69
70
|
export type { MobileListSectionProps, MobileListItemProps } from '../components/mobile/MobileList';
|
|
70
|
-
export { MobileDrawer, DrawerNavItem, DrawerNavSection } from '../components/mobile/MobileDrawer';
|
|
71
|
-
export type { MobileDrawerProps, DrawerNavItemProps, DrawerNavSectionProps } from '../components/mobile/MobileDrawer';
|
|
72
71
|
export { Label } from '../components/Label';
|
|
73
72
|
export type { LabelProps } from '../components/Label';
|
|
74
73
|
export { Form, FormField, FormLabel, FormDescription, FormMessage, useFormField } from '../components/Form';
|
|
75
74
|
export type { FormProps, FormFieldProps, FormLabelProps, FormDescriptionProps, FormMessageProps } from '../components/Form';
|
|
76
|
-
export { AlertDialog } from '../components/AlertDialog';
|
|
77
|
-
export type { AlertDialogProps } from '../components/AlertDialog';
|
|
78
75
|
export { NumberInput } from '../components/NumberInput';
|
|
79
76
|
export type { NumberInputProps } from '../components/NumberInput';
|
|
80
77
|
export { Calendar } from '../components/Calendar';
|
|
@@ -88,7 +85,23 @@ export type { TimePickerProps } from '../components/TimePicker';
|
|
|
88
85
|
export { FileUpload } from '../components/FileUpload';
|
|
89
86
|
export type { FileUploadProps, UploadedFile } from '../components/FileUpload';
|
|
90
87
|
export { Sheet } from '../components/Sheet';
|
|
91
|
-
export type { SheetProps, SheetSide } from '../components/Sheet';
|
|
88
|
+
export type { SheetProps, SheetSide, SheetVariant, SheetActionItemProps } from '../components/Sheet';
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated 使用统一的 Sheet 组件替代。
|
|
91
|
+
* ActionSheet 将在下一个 major 版本中移除,请迁移到 Sheet 组件:
|
|
92
|
+
* <Sheet variant="action" side="bottom">
|
|
93
|
+
* @see {@link Sheet} 统一 Sheet 组件
|
|
94
|
+
*/
|
|
95
|
+
export { ActionSheet, ActionSheetItem } from '../components/mobile/ActionSheet';
|
|
96
|
+
export type { ActionSheetProps, ActionSheetItemProps } from '../components/mobile/ActionSheet';
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated 使用统一的 Sheet 组件替代。
|
|
99
|
+
* MobileDrawer 将在下一个 major 版本中移除,请迁移到 Sheet 组件:
|
|
100
|
+
* <Sheet side="left">
|
|
101
|
+
* @see {@link Sheet} 统一 Sheet 组件
|
|
102
|
+
*/
|
|
103
|
+
export { MobileDrawer, DrawerNavItem, DrawerNavSection } from '../components/mobile/MobileDrawer';
|
|
104
|
+
export type { MobileDrawerProps, DrawerNavItemProps, DrawerNavSectionProps } from '../components/mobile/MobileDrawer';
|
|
92
105
|
export { ScrollArea } from '../components/ScrollArea';
|
|
93
106
|
export type { ScrollAreaProps } from '../components/ScrollArea';
|
|
94
107
|
export { Toggle, ToggleGroup } from '../components/Toggle';
|
|
@@ -125,3 +138,5 @@ export { CodeBlock } from '../components/CodeBlock';
|
|
|
125
138
|
export type { CodeBlockProps, CodeBlockLanguage } from '../components/CodeBlock';
|
|
126
139
|
export { LanguageSwitcher } from '../components/LanguageSwitcher';
|
|
127
140
|
export type { LanguageSwitcherProps } from '../components/LanguageSwitcher';
|
|
141
|
+
export { Article, ArticleHeader, ArticleTitle, ArticleBody, Section, SectionHeading, Pager, PropsTable, ArticleEmptyState, StatsGrid, } from '../components/Article';
|
|
142
|
+
export type { ArticleProps, ArticleHeaderProps, ArticleTitleProps, ArticleBodyProps, SectionProps, SectionHeadingProps, PagerProps, PagerItem, PropsTableProps, PropsTableColumn, ArticleEmptyStateProps, StatsGridProps, StatItem, } from '../components/Article';
|
|
@@ -7,6 +7,12 @@ export interface ViewportContextValue {
|
|
|
7
7
|
/** True when the device is in the tablet width range AND screen orientation is portrait */
|
|
8
8
|
isTabletPortrait: boolean;
|
|
9
9
|
isDesktop: boolean;
|
|
10
|
+
/** The actual screen width in CSS pixels */
|
|
11
|
+
screenWidth: number;
|
|
12
|
+
/** The actual screen height in CSS pixels */
|
|
13
|
+
screenHeight: number;
|
|
14
|
+
/** Aspect ratio: width / height (0-1 for portrait, >1 for landscape) */
|
|
15
|
+
aspectRatio: number;
|
|
10
16
|
}
|
|
11
17
|
export interface ViewportProviderProps {
|
|
12
18
|
children: ReactNode;
|