@ldkj/web-ui 0.12.0 → 0.14.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/LICENSE +21 -21
- package/README.md +27 -27
- package/components/data-display/avatar/Avatar.d.ts +42 -0
- package/components/data-display/avatar/index.d.ts +1 -0
- package/components/data-display/skeleton/Skeleton.d.ts +72 -0
- package/components/data-display/skeleton/index.d.ts +2 -0
- package/components/form/checkbox/CheckboxGroup.d.ts +2 -2
- package/components/form/checkbox/context.d.ts +12 -0
- package/components/form/label/Label.d.ts +41 -0
- package/components/form/label/index.d.ts +1 -0
- package/components/form/radio/Radio.d.ts +15 -0
- package/components/form/radio/RadioGroup.d.ts +38 -0
- package/components/form/radio/index.d.ts +2 -0
- package/components/form/select/Select.d.ts +107 -0
- package/components/form/select/index.d.ts +1 -0
- package/components/form/switch/Switch.d.ts +37 -0
- package/components/form/switch/index.d.ts +1 -0
- package/components/interact/button/Button.d.ts +3 -3
- package/components/interact/dialog/Dialog.d.ts +121 -0
- package/components/interact/dialog/index.d.ts +2 -0
- package/components/interact/modal/Modal.d.ts +32 -0
- package/components/interact/modal/index.d.ts +2 -0
- package/components/interact/popover/Popover.d.ts +119 -0
- package/components/interact/popover/index.d.ts +1 -0
- package/components/interact/tooltip/Tooltip.d.ts +93 -0
- package/components/interact/tooltip/index.d.ts +1 -0
- package/index.cjs +47 -7
- package/index.d.ts +10 -0
- package/index.js +9748 -3868
- package/package.json +9 -1
- package/style.css +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SxProps } from "@/styling";
|
|
3
|
+
export type ModalBlur = boolean | number | string;
|
|
4
|
+
export type ModalProps = Omit<React.HTMLAttributes<HTMLDivElement>, "className" | "style" | "onClose" | "onOpen"> & {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
destroyOnClose?: boolean;
|
|
7
|
+
closeOnMaskClick?: boolean;
|
|
8
|
+
scrollable?: boolean;
|
|
9
|
+
alpha?: number;
|
|
10
|
+
blur?: ModalBlur;
|
|
11
|
+
x?: string;
|
|
12
|
+
y?: string;
|
|
13
|
+
translateX?: string;
|
|
14
|
+
translateY?: string;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
onOpen?: () => void;
|
|
17
|
+
className?: string;
|
|
18
|
+
class?: string;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
sx?: SxProps;
|
|
21
|
+
contentClassName?: string;
|
|
22
|
+
contentClass?: string;
|
|
23
|
+
contentStyle?: React.CSSProperties;
|
|
24
|
+
contentSx?: SxProps;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Modal 全屏遮罩容器,适用于轻量弹层和临时聚焦内容。
|
|
28
|
+
*/
|
|
29
|
+
export declare function Modal(props: ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
30
|
+
export declare namespace Modal {
|
|
31
|
+
var displayName: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
import { type Rounded } from "@/components/shared/rounded";
|
|
4
|
+
import { type Shadow } from "@/components/shared/shadow";
|
|
5
|
+
import { type SxProps } from "@/styling";
|
|
6
|
+
type RadixPopoverContentProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>;
|
|
7
|
+
type RadixPopoverTriggerProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>;
|
|
8
|
+
type RadixPopoverCloseProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Close>;
|
|
9
|
+
type PopoverWrapperProps<TProps> = Omit<TProps, "className" | "style"> & {
|
|
10
|
+
className?: string;
|
|
11
|
+
class?: string;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
sx?: SxProps;
|
|
14
|
+
};
|
|
15
|
+
export type PopoverTriggerProps = PopoverWrapperProps<RadixPopoverTriggerProps>;
|
|
16
|
+
export type PopoverCloseProps = PopoverWrapperProps<RadixPopoverCloseProps>;
|
|
17
|
+
/**
|
|
18
|
+
* Popover 根组件,管理弹层的打开状态。
|
|
19
|
+
*
|
|
20
|
+
* 该组件保留 Radix Popover Root 的完整能力,支持非受控与受控两种用法。
|
|
21
|
+
*/
|
|
22
|
+
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
23
|
+
/**
|
|
24
|
+
* Popover 触发器。
|
|
25
|
+
*
|
|
26
|
+
* 使用 `asChild` 时会由本组件生成一层触发容器,业务子组件无需转发 ref。
|
|
27
|
+
*/
|
|
28
|
+
declare const PopoverTrigger: React.ForwardRefExoticComponent<Omit<Omit<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref">, "className" | "style"> & {
|
|
29
|
+
className?: string;
|
|
30
|
+
class?: string;
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
sx?: SxProps;
|
|
33
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
34
|
+
/**
|
|
35
|
+
* Popover 锚点。
|
|
36
|
+
*
|
|
37
|
+
* 当弹层定位目标与触发器不是同一个元素时,可以使用 Anchor 明确定位参考元素。
|
|
38
|
+
*/
|
|
39
|
+
declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
/**
|
|
41
|
+
* Popover 关闭按钮。
|
|
42
|
+
*
|
|
43
|
+
* 使用 `asChild` 时会由本组件生成一层关闭容器,业务子组件无需转发 ref。
|
|
44
|
+
*/
|
|
45
|
+
declare const PopoverClose: React.ForwardRefExoticComponent<Omit<Omit<PopoverPrimitive.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>, "ref">, "className" | "style"> & {
|
|
46
|
+
className?: string;
|
|
47
|
+
class?: string;
|
|
48
|
+
style?: React.CSSProperties;
|
|
49
|
+
sx?: SxProps;
|
|
50
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
51
|
+
/**
|
|
52
|
+
* PopoverContent 的属性。
|
|
53
|
+
*/
|
|
54
|
+
export type PopoverContentProps = Omit<RadixPopoverContentProps, "className" | "style"> & {
|
|
55
|
+
/**
|
|
56
|
+
* 弹层宽度。传入数字时自动转换为 px。
|
|
57
|
+
*
|
|
58
|
+
* @default 288
|
|
59
|
+
*/
|
|
60
|
+
width?: number | string;
|
|
61
|
+
/**
|
|
62
|
+
* 弹层圆角,支持本库圆角预设或任意 CSS border-radius 值。
|
|
63
|
+
*
|
|
64
|
+
* @default "lg"
|
|
65
|
+
*/
|
|
66
|
+
rounded?: Rounded;
|
|
67
|
+
/**
|
|
68
|
+
* 弹层阴影,支持本库阴影预设或任意 CSS box-shadow 值。
|
|
69
|
+
*
|
|
70
|
+
* @default "md"
|
|
71
|
+
*/
|
|
72
|
+
shadow?: Shadow;
|
|
73
|
+
/**
|
|
74
|
+
* 本库 sx 样式入口,支持对象、数组、函数与嵌套选择器。
|
|
75
|
+
*/
|
|
76
|
+
sx?: SxProps;
|
|
77
|
+
/**
|
|
78
|
+
* 兼容历史 class 写法。
|
|
79
|
+
*/
|
|
80
|
+
class?: string;
|
|
81
|
+
className?: string;
|
|
82
|
+
style?: React.CSSProperties;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Popover 内容面板。
|
|
86
|
+
*
|
|
87
|
+
* 默认通过 Portal 渲染到 body,并保留 Radix Content 的定位、碰撞检测与焦点管理能力。
|
|
88
|
+
*/
|
|
89
|
+
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref">, "className" | "style"> & {
|
|
90
|
+
/**
|
|
91
|
+
* 弹层宽度。传入数字时自动转换为 px。
|
|
92
|
+
*
|
|
93
|
+
* @default 288
|
|
94
|
+
*/
|
|
95
|
+
width?: number | string;
|
|
96
|
+
/**
|
|
97
|
+
* 弹层圆角,支持本库圆角预设或任意 CSS border-radius 值。
|
|
98
|
+
*
|
|
99
|
+
* @default "lg"
|
|
100
|
+
*/
|
|
101
|
+
rounded?: Rounded;
|
|
102
|
+
/**
|
|
103
|
+
* 弹层阴影,支持本库阴影预设或任意 CSS box-shadow 值。
|
|
104
|
+
*
|
|
105
|
+
* @default "md"
|
|
106
|
+
*/
|
|
107
|
+
shadow?: Shadow;
|
|
108
|
+
/**
|
|
109
|
+
* 本库 sx 样式入口,支持对象、数组、函数与嵌套选择器。
|
|
110
|
+
*/
|
|
111
|
+
sx?: SxProps;
|
|
112
|
+
/**
|
|
113
|
+
* 兼容历史 class 写法。
|
|
114
|
+
*/
|
|
115
|
+
class?: string;
|
|
116
|
+
className?: string;
|
|
117
|
+
style?: React.CSSProperties;
|
|
118
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
119
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Popover";
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
export type TooltipTone = "dark" | "light" | "primary";
|
|
5
|
+
type WithStyleProps = {
|
|
6
|
+
className?: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
sx?: SxProps;
|
|
9
|
+
};
|
|
10
|
+
export type TooltipTriggerProps = Omit<React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>, "className" | "style"> & WithStyleProps & {
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
/**
|
|
13
|
+
* 当 `asChild` 为 true 时,指定用于包裹 children 的元素或组件。
|
|
14
|
+
*
|
|
15
|
+
* @default "span"
|
|
16
|
+
*/
|
|
17
|
+
asChildWrapper?: React.ElementType;
|
|
18
|
+
};
|
|
19
|
+
export type TooltipContentProps = React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & WithStyleProps & {
|
|
20
|
+
/**
|
|
21
|
+
* 控制 Tooltip 内容的视觉语气。
|
|
22
|
+
*
|
|
23
|
+
* @default "dark"
|
|
24
|
+
*/
|
|
25
|
+
tone?: TooltipTone;
|
|
26
|
+
/**
|
|
27
|
+
* 是否显示指向触发元素的箭头。
|
|
28
|
+
*
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
arrow?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type TooltipArrowProps = React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow> & WithStyleProps & {
|
|
34
|
+
/**
|
|
35
|
+
* 箭头颜色语气;通常与 TooltipContent 的 tone 保持一致。
|
|
36
|
+
*
|
|
37
|
+
* @default "dark"
|
|
38
|
+
*/
|
|
39
|
+
tone?: TooltipTone;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* TooltipProvider 用于配置当前 React 子树内 Tooltip 的延迟和跳过延迟行为。
|
|
43
|
+
*/
|
|
44
|
+
declare const TooltipProvider: ({ delayDuration, ...props }: React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider>) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
/**
|
|
46
|
+
* Tooltip 是 Radix Tooltip Root 的组件库导出,用于包裹单个提示实例。
|
|
47
|
+
*/
|
|
48
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
49
|
+
/**
|
|
50
|
+
* TooltipPortal 用于将 TooltipContent 渲染到独立 Portal 容器。
|
|
51
|
+
*/
|
|
52
|
+
declare const TooltipPortal: React.FC<TooltipPrimitive.TooltipPortalProps>;
|
|
53
|
+
/**
|
|
54
|
+
* TooltipTrigger 用于声明 Tooltip 的触发元素,支持 `asChild` 组合业务组件。
|
|
55
|
+
*/
|
|
56
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<Omit<Omit<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref">, "className" | "style"> & WithStyleProps & {
|
|
57
|
+
style?: React.CSSProperties;
|
|
58
|
+
/**
|
|
59
|
+
* 当 `asChild` 为 true 时,指定用于包裹 children 的元素或组件。
|
|
60
|
+
*
|
|
61
|
+
* @default "span"
|
|
62
|
+
*/
|
|
63
|
+
asChildWrapper?: React.ElementType;
|
|
64
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
65
|
+
/**
|
|
66
|
+
* TooltipArrow 渲染 Tooltip 的箭头,可单独用于自定义 Content 结构。
|
|
67
|
+
*/
|
|
68
|
+
declare const TooltipArrow: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipArrowProps & React.RefAttributes<SVGSVGElement>, "ref"> & WithStyleProps & {
|
|
69
|
+
/**
|
|
70
|
+
* 箭头颜色语气;通常与 TooltipContent 的 tone 保持一致。
|
|
71
|
+
*
|
|
72
|
+
* @default "dark"
|
|
73
|
+
*/
|
|
74
|
+
tone?: TooltipTone;
|
|
75
|
+
} & React.RefAttributes<SVGSVGElement>>;
|
|
76
|
+
/**
|
|
77
|
+
* TooltipContent 渲染提示内容,内置基础动画、tone 语气和可选 arrow。
|
|
78
|
+
*/
|
|
79
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & WithStyleProps & {
|
|
80
|
+
/**
|
|
81
|
+
* 控制 Tooltip 内容的视觉语气。
|
|
82
|
+
*
|
|
83
|
+
* @default "dark"
|
|
84
|
+
*/
|
|
85
|
+
tone?: TooltipTone;
|
|
86
|
+
/**
|
|
87
|
+
* 是否显示指向触发元素的箭头。
|
|
88
|
+
*
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
arrow?: boolean;
|
|
92
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
+
export { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent, TooltipPortal, TooltipArrow, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tooltip";
|