@baishuyun/ui-base 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Card/Card-DMXtN2pu.js +74 -0
- package/dist/Card/index.js +4 -0
- package/dist/ColorPicker/ColorPicker-CpPLwHR2.js +253 -0
- package/dist/ColorPicker/index.js +5 -0
- package/dist/Icon/Icon-C0bjP9U6.js +24 -0
- package/dist/Icon/index.js +4 -0
- package/dist/InputTag/index.js +137 -0
- package/dist/Modal/Modal-C1LEJ6Y0.js +80 -0
- package/dist/Modal/index.js +4 -0
- package/dist/animations/index.d.ts +118 -0
- package/dist/components/Card/Card.d.ts +4 -0
- package/dist/components/Card/Card.type.d.ts +42 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPalettes.d.ts +15 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +3 -0
- package/dist/components/ColorPicker/ColorPicker.type.d.ts +25 -0
- package/dist/components/ColorPicker/constants.d.ts +2 -0
- package/dist/components/ColorPicker/index.d.ts +3 -0
- package/dist/components/ColorPicker/useFloatingColorPicker.d.ts +25 -0
- package/dist/components/DropDown/interface.d.ts +121 -0
- package/dist/components/Icon/Icon.d.ts +24 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/InputTag/InputTag.d.ts +3 -0
- package/dist/components/InputTag/constants.d.ts +7 -0
- package/dist/components/InputTag/index.d.ts +2 -0
- package/dist/components/InputTag/interface.d.ts +32 -0
- package/dist/components/Modal/Modal.d.ts +4 -0
- package/dist/components/Modal/Modal.type.d.ts +22 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/hooks/useDropdownSearch.d.ts +17 -0
- package/dist/hooks/useFloatingPortal.d.ts +20 -0
- package/dist/hooks/useLocale.d.ts +12 -0
- package/dist/hooks/useTagScrollWidth.d.ts +3 -0
- package/dist/index.js +61 -0
- package/dist/locale/LocaleContext.d.ts +9 -0
- package/dist/locale/LocaleProvider.d.ts +6 -0
- package/dist/locale/index.d.ts +1 -0
- package/dist/locale/lang/en-US.json.d.ts +64 -0
- package/dist/locale/lang/zh-CN.json.d.ts +64 -0
- package/dist/style.css +1 -0
- package/dist/utils/color.d.ts +9 -0
- package/dist/vendors/clsx-OuTLNxxd.js +16 -0
- package/dist/vendors/fuse.js-l0sNRNKZ.js +1 -0
- package/dist/vendors/lexical-Bz4mqKs6.js +3 -0
- package/dist/vendors/lodash-es-DP1ViCXF.js +262 -0
- package/dist/vendors/simplebar-react-svBEsTVC.js +408 -0
- package/dist/vendors/tinycolor2-Begv3Jc8.js +711 -0
- package/dist/vite-env.d.ts +3 -0
- package/package.json +102 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 公共动画配置
|
|
3
|
+
* 用于各种浮层、下拉菜单等组件的进入退出动画
|
|
4
|
+
*/
|
|
5
|
+
export declare const PANEL_ANIMATION: {
|
|
6
|
+
readonly initial: {
|
|
7
|
+
readonly opacity: 0;
|
|
8
|
+
readonly scale: 0.95;
|
|
9
|
+
readonly y: -4;
|
|
10
|
+
};
|
|
11
|
+
readonly animate: {
|
|
12
|
+
readonly opacity: 1;
|
|
13
|
+
readonly scale: 1;
|
|
14
|
+
readonly y: 0;
|
|
15
|
+
};
|
|
16
|
+
readonly exit: {
|
|
17
|
+
readonly opacity: 0;
|
|
18
|
+
readonly scale: 0.95;
|
|
19
|
+
readonly y: -4;
|
|
20
|
+
};
|
|
21
|
+
readonly transition: {
|
|
22
|
+
readonly duration: 0.2;
|
|
23
|
+
readonly ease: "easeOut";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const ICON_ANIMATION: {
|
|
27
|
+
readonly initial: {
|
|
28
|
+
readonly opacity: 0;
|
|
29
|
+
readonly scale: 0.8;
|
|
30
|
+
};
|
|
31
|
+
readonly animate: {
|
|
32
|
+
readonly opacity: 1;
|
|
33
|
+
readonly scale: 1;
|
|
34
|
+
};
|
|
35
|
+
readonly exit: {
|
|
36
|
+
readonly opacity: 0;
|
|
37
|
+
readonly scale: 0.8;
|
|
38
|
+
};
|
|
39
|
+
readonly transition: {
|
|
40
|
+
readonly duration: 0.2;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare const FADE_ANIMATION: {
|
|
44
|
+
readonly initial: {
|
|
45
|
+
readonly opacity: 0;
|
|
46
|
+
};
|
|
47
|
+
readonly animate: {
|
|
48
|
+
readonly opacity: 1;
|
|
49
|
+
};
|
|
50
|
+
readonly exit: {
|
|
51
|
+
readonly opacity: 0;
|
|
52
|
+
};
|
|
53
|
+
readonly transition: {
|
|
54
|
+
readonly duration: 0.2;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare const SLIDE_DOWN_ANIMATION: {
|
|
58
|
+
readonly initial: {
|
|
59
|
+
readonly opacity: 0;
|
|
60
|
+
readonly y: -10;
|
|
61
|
+
};
|
|
62
|
+
readonly animate: {
|
|
63
|
+
readonly opacity: 1;
|
|
64
|
+
readonly y: 0;
|
|
65
|
+
};
|
|
66
|
+
readonly exit: {
|
|
67
|
+
readonly opacity: 0;
|
|
68
|
+
readonly y: -10;
|
|
69
|
+
};
|
|
70
|
+
readonly transition: {
|
|
71
|
+
readonly duration: 0.2;
|
|
72
|
+
readonly ease: "easeOut";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export declare const SLIDE_UP_ANIMATION: {
|
|
76
|
+
readonly initial: {
|
|
77
|
+
readonly opacity: 0;
|
|
78
|
+
readonly y: 10;
|
|
79
|
+
};
|
|
80
|
+
readonly animate: {
|
|
81
|
+
readonly opacity: 1;
|
|
82
|
+
readonly y: 0;
|
|
83
|
+
};
|
|
84
|
+
readonly exit: {
|
|
85
|
+
readonly opacity: 0;
|
|
86
|
+
readonly y: 10;
|
|
87
|
+
};
|
|
88
|
+
readonly transition: {
|
|
89
|
+
readonly duration: 0.2;
|
|
90
|
+
readonly ease: "easeOut";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export declare const TOAST_ANIMATION: {
|
|
94
|
+
readonly initial: {
|
|
95
|
+
readonly opacity: 0;
|
|
96
|
+
readonly y: -50;
|
|
97
|
+
readonly scale: 0.8;
|
|
98
|
+
};
|
|
99
|
+
readonly animate: {
|
|
100
|
+
readonly opacity: 1;
|
|
101
|
+
readonly y: 0;
|
|
102
|
+
readonly scale: 1;
|
|
103
|
+
};
|
|
104
|
+
readonly exit: {
|
|
105
|
+
readonly opacity: 0;
|
|
106
|
+
readonly y: -50;
|
|
107
|
+
readonly scale: 0.8;
|
|
108
|
+
readonly transition: {
|
|
109
|
+
readonly duration: 0.3;
|
|
110
|
+
readonly ease: "easeOut";
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
readonly transition: {
|
|
114
|
+
readonly type: "spring";
|
|
115
|
+
readonly damping: 20;
|
|
116
|
+
readonly stiffness: 220;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Card组件的属性接口
|
|
4
|
+
*/
|
|
5
|
+
export interface CardProps {
|
|
6
|
+
/**
|
|
7
|
+
* 卡片标题
|
|
8
|
+
*/
|
|
9
|
+
title: string;
|
|
10
|
+
/**
|
|
11
|
+
* 卡片内容
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* 卡片最小宽度,默认240px
|
|
16
|
+
* @default 240
|
|
17
|
+
*/
|
|
18
|
+
minWidth?: number;
|
|
19
|
+
/**
|
|
20
|
+
* 是否默认展开
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
defaultExpanded?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 自定义类名
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 自定义样式
|
|
30
|
+
*/
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
styles?: {
|
|
33
|
+
/**
|
|
34
|
+
* 自定义头样式
|
|
35
|
+
*/
|
|
36
|
+
header?: React.CSSProperties;
|
|
37
|
+
/**
|
|
38
|
+
* 自定义内容样式
|
|
39
|
+
*/
|
|
40
|
+
body?: React.CSSProperties;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 预设颜色网格组件
|
|
3
|
+
*/
|
|
4
|
+
interface PresetColorsProps {
|
|
5
|
+
/** 当前选中的颜色 */
|
|
6
|
+
currentColor: string;
|
|
7
|
+
/** 颜色选择回调 */
|
|
8
|
+
onColorSelect: (color: string) => void;
|
|
9
|
+
/** 颜色选项 */
|
|
10
|
+
options: string[];
|
|
11
|
+
/** 网格样式 */
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
declare const ColorPalettes: React.FC<PresetColorsProps>;
|
|
15
|
+
export default ColorPalettes;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 颜色选择器的属性接口
|
|
4
|
+
*/
|
|
5
|
+
export interface ColorPickerProps {
|
|
6
|
+
/** 子元素,作为触发器 */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** 当前选中的颜色值(受控模式) */
|
|
9
|
+
value?: string;
|
|
10
|
+
/** 默认颜色值(非受控模式) */
|
|
11
|
+
/** @default '#0265ff' */
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
/** 颜色变化时的回调函数 */
|
|
14
|
+
onChange?: (color: string) => void;
|
|
15
|
+
/** 浮层的放置位置 */
|
|
16
|
+
/** @default 'bottom-start' */
|
|
17
|
+
placement?: 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'bottom-start';
|
|
18
|
+
/** 是否禁用 */
|
|
19
|
+
/** @default false */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 预设颜色
|
|
23
|
+
*/
|
|
24
|
+
presetColors?: string[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReferenceType } from '@floating-ui/react';
|
|
2
|
+
import { ColorPickerProps } from './ColorPicker.type';
|
|
3
|
+
import { CSSProperties, Dispatch, SetStateAction } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* useFloatingColorPicker 的返回类型
|
|
6
|
+
*/
|
|
7
|
+
interface UseFloatingColorPickerReturn {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
refs: {
|
|
10
|
+
setReference: (node: ReferenceType | null) => void;
|
|
11
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
12
|
+
reference: React.MutableRefObject<ReferenceType | null>;
|
|
13
|
+
floating: React.MutableRefObject<HTMLElement | null>;
|
|
14
|
+
};
|
|
15
|
+
floatingStyles: CSSProperties;
|
|
16
|
+
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
|
|
17
|
+
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
18
|
+
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 使用浮层颜色选择器的 hook
|
|
22
|
+
* 集成了 floating-ui 的完整功能
|
|
23
|
+
*/
|
|
24
|
+
declare const useFloatingColorPicker: (placement?: ColorPickerProps["placement"]) => UseFloatingColorPickerReturn;
|
|
25
|
+
export default useFloatingColorPicker;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 浮层偏移量接口
|
|
6
|
+
*/
|
|
7
|
+
export interface OffsetType {
|
|
8
|
+
/**
|
|
9
|
+
* x 轴偏移量
|
|
10
|
+
* @default 0
|
|
11
|
+
*/
|
|
12
|
+
x: number;
|
|
13
|
+
/**
|
|
14
|
+
* y 轴偏移量
|
|
15
|
+
* @default 0
|
|
16
|
+
*/
|
|
17
|
+
y: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 下拉菜单项接口
|
|
22
|
+
*/
|
|
23
|
+
export interface MenuItemType {
|
|
24
|
+
/**
|
|
25
|
+
* 菜单项的唯一标识
|
|
26
|
+
*/
|
|
27
|
+
key: string;
|
|
28
|
+
/**
|
|
29
|
+
* 菜单项的显示内容,可以是字符串或 React 节点
|
|
30
|
+
*/
|
|
31
|
+
label: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* 菜单项的图标
|
|
34
|
+
*/
|
|
35
|
+
icon?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* 是否禁用该菜单项
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 是否是系统字段
|
|
44
|
+
* @description 系统字段的颜色会比较突出,和其他字段仅文字样式的不同
|
|
45
|
+
*/
|
|
46
|
+
systemField?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 允许任意额外字段,用于自定义搜索或其他用途
|
|
49
|
+
*/
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 下拉组件的属性接口
|
|
55
|
+
*/
|
|
56
|
+
export interface DropDownProps {
|
|
57
|
+
/**
|
|
58
|
+
* 触发器子元素
|
|
59
|
+
*/
|
|
60
|
+
children: ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* 下拉菜单的菜单项列表
|
|
63
|
+
*/
|
|
64
|
+
menus: MenuItemType[];
|
|
65
|
+
/**
|
|
66
|
+
* 菜单项点击时的回调函数
|
|
67
|
+
*/
|
|
68
|
+
onClick?: (menuItem: MenuItemType) => void;
|
|
69
|
+
/**
|
|
70
|
+
* 下拉菜单打开/关闭状态变化时的回调函数
|
|
71
|
+
*/
|
|
72
|
+
onOpenChange?: (open: boolean) => void;
|
|
73
|
+
/**
|
|
74
|
+
* 控制下拉菜单的显示隐藏状态(受控模式)
|
|
75
|
+
* @description 当传入此属性时,组件将变为受控模式
|
|
76
|
+
*/
|
|
77
|
+
visible?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* 搜索框的占位符文本
|
|
80
|
+
* @default '搜索'
|
|
81
|
+
*/
|
|
82
|
+
searchPlaceholder?: string;
|
|
83
|
+
/**
|
|
84
|
+
* 搜索值变化时的回调函数
|
|
85
|
+
*/
|
|
86
|
+
onSearch?: (searchValue: string) => void;
|
|
87
|
+
/**
|
|
88
|
+
* 用于搜索的字段名
|
|
89
|
+
* @default 'label'
|
|
90
|
+
*/
|
|
91
|
+
searchKey?: string;
|
|
92
|
+
/**
|
|
93
|
+
* 是否显示搜索框
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
showSearch?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* 选择菜单项后是否关闭面板
|
|
99
|
+
* @default true
|
|
100
|
+
*/
|
|
101
|
+
closeOnSelect?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* 浮层偏移量
|
|
104
|
+
* @default { x: 0, y: 0 }
|
|
105
|
+
*/
|
|
106
|
+
offset?: OffsetType;
|
|
107
|
+
/**
|
|
108
|
+
* 自定义下拉菜单的样式
|
|
109
|
+
*/
|
|
110
|
+
style?: React.CSSProperties;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 下拉面板浮层的 z-index
|
|
114
|
+
*/
|
|
115
|
+
zIndex?: number;
|
|
116
|
+
/**
|
|
117
|
+
* 高亮的菜单项 key 数组
|
|
118
|
+
* @description 指定哪些菜单项应该被高亮显示
|
|
119
|
+
*/
|
|
120
|
+
activeKey?: string[];
|
|
121
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface IconProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
/**
|
|
3
|
+
* 图标名称
|
|
4
|
+
*/
|
|
5
|
+
name: string;
|
|
6
|
+
/**
|
|
7
|
+
* 图标样式
|
|
8
|
+
*/
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
/**
|
|
11
|
+
* 图标颜色
|
|
12
|
+
*/
|
|
13
|
+
color?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 图标类名
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 图标大小
|
|
20
|
+
*/
|
|
21
|
+
size?: number;
|
|
22
|
+
}
|
|
23
|
+
declare const Icon: React.FC<IconProps>;
|
|
24
|
+
export { Icon };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Icon as default } from './Icon';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type InputTagProps = {
|
|
2
|
+
/**
|
|
3
|
+
* 标签值,对象数组格式
|
|
4
|
+
*/
|
|
5
|
+
value?: string[];
|
|
6
|
+
/**
|
|
7
|
+
* 标签值变化回调
|
|
8
|
+
*/
|
|
9
|
+
onChange?: (value: string[]) => void;
|
|
10
|
+
/**
|
|
11
|
+
* 默认标签值
|
|
12
|
+
*/
|
|
13
|
+
defaultValue?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* 是否启用点击高亮功能
|
|
16
|
+
*/
|
|
17
|
+
enableActive?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 当前激活的标签索引(受控模式)
|
|
20
|
+
*/
|
|
21
|
+
activeIndex?: number;
|
|
22
|
+
/**
|
|
23
|
+
* 默认激活的标签索引(非受控模式)
|
|
24
|
+
*/
|
|
25
|
+
defaultActiveIndex?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 激活标签索引变化回调
|
|
28
|
+
*/
|
|
29
|
+
onActiveIndexChange?: (index: number, text: string) => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type { InputTagProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ModalProps {
|
|
2
|
+
/**
|
|
3
|
+
* 标题
|
|
4
|
+
*/
|
|
5
|
+
title?: string;
|
|
6
|
+
/**
|
|
7
|
+
* 是否打开
|
|
8
|
+
*/
|
|
9
|
+
open?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 打开状态变化
|
|
12
|
+
*/
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
/**
|
|
15
|
+
* 宽度
|
|
16
|
+
*/
|
|
17
|
+
width?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 是否全屏和默认宽度切换
|
|
20
|
+
*/
|
|
21
|
+
fullSwitch?: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Modal as default } from './Modal';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MenuItemType } from '../components/DropDown/interface';
|
|
2
|
+
interface UseDropdownSearchProps {
|
|
3
|
+
menus: MenuItemType[];
|
|
4
|
+
searchValue: string;
|
|
5
|
+
enableInternalFilter: boolean;
|
|
6
|
+
searchKey: string;
|
|
7
|
+
}
|
|
8
|
+
interface UseDropdownSearchReturn {
|
|
9
|
+
filteredMenus: MenuItemType[];
|
|
10
|
+
hasNoResults: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* DropDown 搜索 hook
|
|
14
|
+
* 提供基于 fuse.js 的模糊搜索功能
|
|
15
|
+
*/
|
|
16
|
+
export declare const useDropdownSearch: ({ menus, searchValue, enableInternalFilter, searchKey, }: UseDropdownSearchProps) => UseDropdownSearchReturn;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UseFloatingReturn, UseInteractionsReturn } from '@floating-ui/react';
|
|
2
|
+
type FloatingPortalProps = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
close: () => void;
|
|
5
|
+
showMask?: boolean;
|
|
6
|
+
zIndex?: number;
|
|
7
|
+
zIndexMask?: number;
|
|
8
|
+
offset?: {
|
|
9
|
+
x?: number;
|
|
10
|
+
y?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @description 自定义浮层宽度,如果不传则使用参考元素宽度
|
|
14
|
+
*/
|
|
15
|
+
popupMinWidth?: number | string;
|
|
16
|
+
};
|
|
17
|
+
declare const useFloatingPortal: (props: FloatingPortalProps) => Pick<UseFloatingReturn, "refs" | "floatingStyles" | "context"> & Pick<UseInteractionsReturn, "getReferenceProps" | "getFloatingProps"> & {
|
|
18
|
+
referenceStyle: React.CSSProperties;
|
|
19
|
+
};
|
|
20
|
+
export default useFloatingPortal;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as zhCN } from '../locale/lang/zh-CN.json';
|
|
2
|
+
type FlattenObjectKeys<T, K extends keyof T = keyof T> = K extends string ? T[K] extends object ? `${K}.${FlattenObjectKeys<T[K]>}` : `${K}` : never;
|
|
3
|
+
export type LocaleKeys = FlattenObjectKeys<typeof zhCN>;
|
|
4
|
+
interface ILocaleContext {
|
|
5
|
+
locale: string;
|
|
6
|
+
t: (key: LocaleKeys) => string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 获取当前语言
|
|
10
|
+
*/
|
|
11
|
+
export declare const useLocale: () => ILocaleContext;
|
|
12
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { I as W } from "./Icon/Icon-C0bjP9U6.js";
|
|
2
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as o, useCallback as u } from "react";
|
|
4
|
+
import { z as s, L as f } from "./ColorPicker/ColorPicker-CpPLwHR2.js";
|
|
5
|
+
import { C as Y } from "./ColorPicker/ColorPicker-CpPLwHR2.js";
|
|
6
|
+
import { C as _ } from "./Card/Card-DMXtN2pu.js";
|
|
7
|
+
import { M as te } from "./Modal/Modal-C1LEJ6Y0.js";
|
|
8
|
+
const C = "Please select", U = "search", I = "No search data", L = "Select All", k = "Please enter the content", A = "No Data", P = "No Data Found", S = "Data Searching...", h = "Select All by Search", y = "Left Align", N = "Center Align", x = "Right Align", R = "Underline", F = "Link", v = "Hyper Link", z = "Show Content", w = "Link Address", D = "Open in New Tab", M = "Confirm", b = "Cancel", E = "Cancel Link", O = "preset color", T = { linkTip: "Support https://link or @form alias", bold: "Bold", italic: "Italic", fontSize: "Font Size", fontColor: "Font Color", fill: "fill", alignment: "Alignment", centerAlign: "Center Align", rightAlign: "Right Align", uploadImage: "Upload Image", imageUrl: "Image URL", imageUrlPlaceholder: "Please enter image URL", imageUrlRequired: "Please enter image URL", imageUrlInvalid: "Please enter a valid image URL", imageUrlNote: "Note: Enter image URL to insert image", inputImageUrl: "Enter Image URL", uploadImageNote: "Note: Single image size cannot exceed 1MB", uploadImageText: "Click or drag to upload image", previewImage: "Preview Image", underline: "Underline", imageFormatOnly: "Only image formats are supported", uploadImageFirst: "Please upload image first", imageAddSuccess: "Image added successfully", operationFailed: "Operation failed", onlyImageFormatsSupported: "Only image formats are supported", pleaseUploadImageFirst: "Please upload image first", imageSizeNote: "Image size cannot exceed 1MB", clickOrDragToUpload: "Click or drag to upload image", enterImageUrl: "Enter image URL", pleaseEnterImageUrl: "Please enter image URL", pleaseEnterValidImageUrl: "Please enter a valid image URL", linkAddressEmpty: "Link address cannot be empty" }, B = "Picture", V = "Custom Color", j = "Add Picture", q = {
|
|
9
|
+
select: C,
|
|
10
|
+
search: U,
|
|
11
|
+
noFindData: I,
|
|
12
|
+
allSelect: L,
|
|
13
|
+
context: k,
|
|
14
|
+
noData: A,
|
|
15
|
+
noDataFound: P,
|
|
16
|
+
dataSearching: S,
|
|
17
|
+
allSelectedBySearch: h,
|
|
18
|
+
leftAlign: y,
|
|
19
|
+
centerAlign: N,
|
|
20
|
+
rightAlign: x,
|
|
21
|
+
underline: R,
|
|
22
|
+
link: F,
|
|
23
|
+
hyperLink: v,
|
|
24
|
+
showContent: z,
|
|
25
|
+
linkAddress: w,
|
|
26
|
+
openInNewTab: D,
|
|
27
|
+
confirm: M,
|
|
28
|
+
cancel: b,
|
|
29
|
+
cancelLink: E,
|
|
30
|
+
presetColors: O,
|
|
31
|
+
editor: T,
|
|
32
|
+
picture: B,
|
|
33
|
+
customColor: V,
|
|
34
|
+
addPicture: j
|
|
35
|
+
}, J = ({ children: c, locale: t = "zh-CN", messages: a = {} }) => {
|
|
36
|
+
const r = o(() => ({ "zh-CN": s, "en-US": q, ...a }), [a]), l = o(() => r[t] || s, [t, r]), i = u(
|
|
37
|
+
(n) => {
|
|
38
|
+
const m = n.split(".");
|
|
39
|
+
let e = l;
|
|
40
|
+
for (const d of m)
|
|
41
|
+
if (e = e[d], !e)
|
|
42
|
+
return console.warn(`[LocaleProvider] Cannot find translation for key: ${n}`), n;
|
|
43
|
+
return typeof e == "string" ? e : n;
|
|
44
|
+
},
|
|
45
|
+
[l]
|
|
46
|
+
), g = o(
|
|
47
|
+
() => ({
|
|
48
|
+
locale: t,
|
|
49
|
+
t: i
|
|
50
|
+
}),
|
|
51
|
+
[t, i]
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ p(f.Provider, { value: g, children: c });
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
_ as Card,
|
|
57
|
+
Y as ColorPicker,
|
|
58
|
+
W as Icon,
|
|
59
|
+
J as LocaleProvider,
|
|
60
|
+
te as Modal
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Locale = 'zh-CN' | 'en-US';
|