@zscloud/design 0.2.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.
Files changed (118) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_icon/app-icon.d.ts +8 -0
  3. package/dist/_icon/app-icons-mapping.d.ts +230 -0
  4. package/dist/_icon/icon.d.ts +12 -0
  5. package/dist/_icon/icons-mapping.d.ts +3866 -0
  6. package/dist/_icon/index.d.ts +3 -0
  7. package/dist/_icon/type.d.ts +14 -0
  8. package/dist/_utils.d.ts +17 -0
  9. package/dist/components/biz/app-base/index.d.ts +18 -0
  10. package/dist/components/biz/config/index.d.ts +15 -0
  11. package/dist/components/biz/constant/index.d.ts +8 -0
  12. package/dist/components/biz/copy/index.d.ts +6 -0
  13. package/dist/components/biz/date-value.d.ts +5 -0
  14. package/dist/components/biz/dropdown-action/index.d.ts +16 -0
  15. package/dist/components/biz/field/field-group.d.ts +5 -0
  16. package/dist/components/biz/field/field-operations.d.ts +9 -0
  17. package/dist/components/biz/field/index.d.ts +33 -0
  18. package/dist/components/biz/file-upload/index.d.ts +1 -0
  19. package/dist/components/biz/file-upload/types.d.ts +6 -0
  20. package/dist/components/biz/file-upload/utils/calc-file-hash.d.ts +36 -0
  21. package/dist/components/biz/file-upload/utils/request.d.ts +24 -0
  22. package/dist/components/biz/file-upload/worker/hash.worker.d.ts +0 -0
  23. package/dist/components/biz/file-upload/worker/simple-hash.work.d.ts +0 -0
  24. package/dist/components/biz/header/header-breadcrumb.d.ts +12 -0
  25. package/dist/components/biz/header/header-detail.d.ts +11 -0
  26. package/dist/components/biz/header/header-page.d.ts +8 -0
  27. package/dist/components/biz/header/index.d.ts +3 -0
  28. package/dist/components/biz/helper-doc/index.d.ts +8 -0
  29. package/dist/components/biz/hooks/use-admin-uuid.d.ts +1 -0
  30. package/dist/components/biz/info/index.d.ts +55 -0
  31. package/dist/components/biz/info-popover/index.d.ts +46 -0
  32. package/dist/components/biz/locale-container/index.d.ts +3 -0
  33. package/dist/components/biz/locale-container/type.d.ts +8 -0
  34. package/dist/components/biz/no-data/index.d.ts +12 -0
  35. package/dist/components/biz/panic-fallback/index.d.ts +1 -0
  36. package/dist/components/biz/smart-tip/index.d.ts +90 -0
  37. package/dist/components/biz/state/index.d.ts +25 -0
  38. package/dist/components/primitive/alert-dialog.d.ts +31 -0
  39. package/dist/components/primitive/alert.d.ts +16 -0
  40. package/dist/components/primitive/auto-complete.d.ts +20 -0
  41. package/dist/components/primitive/badge.d.ts +80 -0
  42. package/dist/components/primitive/breadcrumb.d.ts +26 -0
  43. package/dist/components/primitive/button.d.ts +15 -0
  44. package/dist/components/primitive/calendar.d.ts +8 -0
  45. package/dist/components/primitive/card.d.ts +27 -0
  46. package/dist/components/primitive/cascader.d.ts +117 -0
  47. package/dist/components/primitive/chart.d.ts +62 -0
  48. package/dist/components/primitive/checkbox-group.d.ts +14 -0
  49. package/dist/components/primitive/checkbox.d.ts +7 -0
  50. package/dist/components/primitive/code-editor/index.d.ts +67 -0
  51. package/dist/components/primitive/collapse.d.ts +17 -0
  52. package/dist/components/primitive/context-menu.d.ts +48 -0
  53. package/dist/components/primitive/date-picker.d.ts +44 -0
  54. package/dist/components/primitive/dialog.d.ts +66 -0
  55. package/dist/components/primitive/divider.d.ts +14 -0
  56. package/dist/components/primitive/drawer.d.ts +47 -0
  57. package/dist/components/primitive/dropdown-menu.d.ts +55 -0
  58. package/dist/components/primitive/file-upload/file-upload-single.d.ts +11 -0
  59. package/dist/components/primitive/file-upload/index.d.ts +1 -0
  60. package/dist/components/primitive/form.d.ts +32 -0
  61. package/dist/components/primitive/image-reader/index.d.ts +7 -0
  62. package/dist/components/primitive/input-number.d.ts +17 -0
  63. package/dist/components/primitive/input-password.d.ts +19 -0
  64. package/dist/components/primitive/input.d.ts +5 -0
  65. package/dist/components/primitive/json-viewer.d.ts +22 -0
  66. package/dist/components/primitive/label.d.ts +5 -0
  67. package/dist/components/primitive/link.d.ts +11 -0
  68. package/dist/components/primitive/loader.d.ts +3 -0
  69. package/dist/components/primitive/markdown/index.d.ts +30 -0
  70. package/dist/components/primitive/multi-select.d.ts +76 -0
  71. package/dist/components/primitive/pagination/index.d.ts +8 -0
  72. package/dist/components/primitive/pagination/pagination.d.ts +31 -0
  73. package/dist/components/primitive/popover-confirm.d.ts +32 -0
  74. package/dist/components/primitive/popover.d.ts +12 -0
  75. package/dist/components/primitive/progress.d.ts +32 -0
  76. package/dist/components/primitive/radio-group.d.ts +49 -0
  77. package/dist/components/primitive/range-picker.d.ts +18 -0
  78. package/dist/components/primitive/resizable.d.ts +25 -0
  79. package/dist/components/primitive/search-input.d.ts +8 -0
  80. package/dist/components/primitive/select.d.ts +74 -0
  81. package/dist/components/primitive/selection-cancellation.d.ts +9 -0
  82. package/dist/components/primitive/show.d.ts +8 -0
  83. package/dist/components/primitive/slider.d.ts +4 -0
  84. package/dist/components/primitive/spin.d.ts +52 -0
  85. package/dist/components/primitive/status-badge.d.ts +19 -0
  86. package/dist/components/primitive/steps.d.ts +75 -0
  87. package/dist/components/primitive/switch.d.ts +4 -0
  88. package/dist/components/primitive/tabs/hooks/use-persist-tab-store.d.ts +4 -0
  89. package/dist/components/primitive/tabs/interface/tab-memo.d.ts +5 -0
  90. package/dist/components/primitive/tabs/store/page-state-store.d.ts +17 -0
  91. package/dist/components/primitive/tabs/tabs.d.ts +40 -0
  92. package/dist/components/primitive/tabs/use-persist.d.ts +4 -0
  93. package/dist/components/primitive/tabs/use-store.d.ts +25 -0
  94. package/dist/components/primitive/tag-list.d.ts +22 -0
  95. package/dist/components/primitive/tag.d.ts +17 -0
  96. package/dist/components/primitive/text.d.ts +27 -0
  97. package/dist/components/primitive/textarea.d.ts +8 -0
  98. package/dist/components/primitive/time-picker.d.ts +41 -0
  99. package/dist/components/primitive/toast/toast.d.ts +17 -0
  100. package/dist/components/primitive/toast/toaster.d.ts +1 -0
  101. package/dist/components/primitive/toast/use-toast.d.ts +45 -0
  102. package/dist/components/primitive/tooltip/index.d.ts +38 -0
  103. package/dist/components/primitive/tooltip/use-placement.d.ts +4 -0
  104. package/dist/components/primitive/tree/index.d.ts +5 -0
  105. package/dist/components/primitive/tree/tree-node.d.ts +17 -0
  106. package/dist/components/primitive/tree/tree-select.d.ts +21 -0
  107. package/dist/components/primitive/tree/tree.d.ts +24 -0
  108. package/dist/components/primitive/tree/types.d.ts +123 -0
  109. package/dist/i18n/locales/en-US.json.d.ts +76 -0
  110. package/dist/i18n/locales/zh-CN.json.d.ts +76 -0
  111. package/dist/index.d.ts +113 -0
  112. package/dist/style.css +2 -0
  113. package/dist/utils/overlay-context.d.ts +34 -0
  114. package/dist/utils/use-container.d.ts +30 -0
  115. package/dist/utils/use-id.d.ts +1 -0
  116. package/dist/utils/use-overlay.d.ts +34 -0
  117. package/dist/zscloud-design.es.js +33683 -0
  118. package/package.json +116 -0
@@ -0,0 +1,3 @@
1
+ export * from './icon';
2
+ export * from './app-icon';
3
+ export * from './type';
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ import { Color } from './_utils';
3
+ import { Icons } from './icons-mapping';
4
+ export type IconTypes = keyof typeof Icons;
5
+ export interface IIconProps extends React.HTMLAttributes<HTMLSpanElement> {
6
+ type: IconTypes;
7
+ path?: string;
8
+ color?: Color.ISemantic | "neutral";
9
+ colorNumber?: Color.INeutralNumber;
10
+ size?: number;
11
+ mode?: "light" | "dark";
12
+ spin?: boolean;
13
+ state?: "enable" | "disable" | "unknown";
14
+ }
@@ -0,0 +1,17 @@
1
+ export declare function cn(...inputs: Array<string | undefined | null | false | Record<string, boolean>>): string;
2
+ export declare function extractTextFromReactNode(node: React.ReactNode): string;
3
+ export declare const bus: {
4
+ on(event: string, callback: (...args: unknown[]) => void): void;
5
+ off(event: string, callback: (...args: unknown[]) => void): void;
6
+ emit(event: string, ...args: unknown[]): void;
7
+ };
8
+ export declare enum Color {
9
+ Red = "red",
10
+ Green = "green",
11
+ Blue = "blue",
12
+ Yellow = "yellow",
13
+ Orange = "orange",
14
+ Gray = "gray",
15
+ }
16
+ export declare function getSemanticColor(color: string): string;
17
+ export declare function getNeutralColor(color: string): string;
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ import { IConstantMap } from '../config';
3
+ import { ResolvedIntlConfig } from 'react-intl';
4
+ interface AppBaseProps {
5
+ children: React.ReactNode;
6
+ intlConfig: {
7
+ messages: ResolvedIntlConfig["messages"];
8
+ locale: string;
9
+ };
10
+ constant?: IConstantMap;
11
+ }
12
+ interface ConfigWrapperProps {
13
+ children: React.ReactNode;
14
+ constant?: IConstantMap;
15
+ }
16
+ export declare const ConfigWrapper: ({ children, constant }: ConfigWrapperProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const AppBase: React.MemoExoticComponent<({ children, intlConfig, constant }: AppBaseProps) => import("react/jsx-runtime").JSX.Element>;
18
+ export {};
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ import { IStateProps } from '../state';
3
+ export interface IConstantMap {
4
+ constantMap: Map<string, IStateProps>;
5
+ constantGroupMap: Map<string, IStateProps>;
6
+ }
7
+ export interface ConfigProps {
8
+ constant?: IConstantMap;
9
+ }
10
+ export declare const ConfigContext: React.Context<ConfigProps>;
11
+ export declare const ConfigProvider: React.FC<ConfigProps & {
12
+ children: React.ReactNode;
13
+ }> & {
14
+ ConfigContext: typeof ConfigContext;
15
+ };
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { IStateProps } from '../state';
3
+ export interface IConstant extends Partial<IStateProps> {
4
+ value: string;
5
+ enumType?: string;
6
+ }
7
+ export declare const useConstant: (value: string, enumType?: string) => IStateProps;
8
+ export declare const Constant: React.FC<IConstant>;
@@ -0,0 +1,6 @@
1
+ interface CopyProps {
2
+ onClick?: (e: React.MouseEvent) => void;
3
+ className?: string;
4
+ }
5
+ export declare const Copy: (props: CopyProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ interface DateProps {
2
+ children: string;
3
+ }
4
+ export declare const DateValue: ({ children }: DateProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ import { DropdownItem } from '../../primitive/dropdown-menu.tsx';
3
+ interface ActionProps<T> {
4
+ items: DropdownItem[];
5
+ refetch: () => void;
6
+ selectedList: T[];
7
+ handleClickItem?: (key: string | number) => void;
8
+ view?: string;
9
+ postAction?: () => void;
10
+ trigger?: React.ReactNode;
11
+ }
12
+ export declare const MenuButton: {
13
+ <T>({ items, refetch, selectedList, handleClickItem, view, postAction, trigger, }: ActionProps<T>): import("react/jsx-runtime").JSX.Element | null;
14
+ displayName: string;
15
+ };
16
+ export {};
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ export interface FieldGroupProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare const FieldGroup: React.FC<FieldGroupProps>;
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ export type FieldOperationType = "copy" | "edit" | "refresh";
3
+ export type FieldOperationFunc = () => void | Promise<void>;
4
+ export type FieldOperation = [FieldOperationType, React.ReactNode, FieldOperationFunc, boolean?] | FieldOperationType;
5
+ export interface FieldOperationsProps {
6
+ operations: FieldOperation[];
7
+ copy: () => void;
8
+ }
9
+ export declare const FieldOperations: React.FC<FieldOperationsProps>;
@@ -0,0 +1,33 @@
1
+ import { TooltipProps } from '../../primitive/tooltip';
2
+ import { FieldOperation } from './field-operations';
3
+ import { FieldGroup } from './field-group';
4
+ import * as React from "react";
5
+ declare const FieldPlaceholderNone: () => import("react/jsx-runtime").JSX.Element;
6
+ declare const FieldPlaceholderDash: () => import("react/jsx-runtime").JSX.Element;
7
+ type TooltipContent = {
8
+ content: React.ReactNode;
9
+ placement?: TooltipProps["placement"];
10
+ } | React.ReactNode;
11
+ export interface FieldProps {
12
+ children?: React.ReactNode;
13
+ childrenList?: React.ReactNode[];
14
+ className?: string;
15
+ label?: string;
16
+ labelWidth?: number;
17
+ operations?: FieldOperation[];
18
+ tooltip?: TooltipContent;
19
+ placeholder?: "none" | "-";
20
+ type?: "single" | "multi" | "tag";
21
+ colon?: boolean | string;
22
+ wrapperClassName?: string;
23
+ flush?: boolean;
24
+ }
25
+ declare const Field: React.FC<FieldProps> & {
26
+ Group: typeof FieldGroup;
27
+ };
28
+ interface FieldValueProps {
29
+ children: React.ReactNode;
30
+ placeholder?: "none" | "-";
31
+ }
32
+ declare const FieldValue: (props: FieldValueProps) => import("react/jsx-runtime").JSX.Element;
33
+ export { Field, FieldPlaceholderDash, FieldPlaceholderNone, FieldValue };
@@ -0,0 +1 @@
1
+ export declare const UploadFile: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ interface Chunk {
2
+ offset: number;
3
+ current: number;
4
+ count: number;
5
+ size: number;
6
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * 抽样计算hash值 大概是1G文件花费1S的时间
3
+ *
4
+ * 采用抽样hash的方式来计算hash
5
+ * 我们在计算hash的时候,将超大文件以2M进行分割获得到另一个chunks数组,
6
+ * 第一个元素(chunks[0])和最后一个元素(chunks[-1])我们全要了
7
+ * 其他的元素(chunks[1,2,3,4....])我们再次进行一个分割,这个时候的分割是一个超小的大小比如2kb,我们取* 每一个元素的头部,尾部,中间的2kb。
8
+ * 最终将它们组成一个新的文件,我们全量计算这个新的文件的hash值。
9
+ * @param file {File}
10
+ * @returns
11
+ */
12
+ export declare function calcHashSample(file: File): Promise<unknown>;
13
+ /**
14
+ * 使用分片和web-work 全量计算hash值
15
+ * @param file {File}
16
+ * @returns
17
+ */
18
+ export declare function calcHashByWebWorker(file: File): Promise<unknown>;
19
+ /**
20
+ * 分片 web-worker 抽样计算hash值
21
+ * @param file
22
+ * @returns
23
+ */
24
+ export declare function calcHashSampleByWebWorker(file: File): Promise<unknown>;
25
+ /**
26
+ * 全量计算hash值, 最慢,占用主进程
27
+ * @param file
28
+ * @returns
29
+ */
30
+ export declare function calcHashSync(file: File): Promise<unknown>;
31
+ /**
32
+ * 通过时间片的方式来计算hash值
33
+ * @param file {File}
34
+ * @returns
35
+ */
36
+ export declare function calcHashByIdle(file: File): Promise<unknown>;
@@ -0,0 +1,24 @@
1
+ interface IRequest {
2
+ url: string;
3
+ method?: string;
4
+ data?: Document | XMLHttpRequestBodyInit | null | undefined;
5
+ onProgress?: ((e: ProgressEvent) => void) | undefined;
6
+ headers?: {
7
+ [key: string]: string;
8
+ };
9
+ requestList?: XMLHttpRequest[] | undefined;
10
+ }
11
+ export declare function request({ url, method, data, onProgress, headers, requestList, }: IRequest): Promise<unknown>;
12
+ export declare function post(url: string, data: Document | XMLHttpRequestBodyInit | null | undefined | {
13
+ [key: string]: any;
14
+ }): Promise<any>;
15
+ /**
16
+ * 发送get请求
17
+ * @param url
18
+ * @param data
19
+ * @returns
20
+ */
21
+ export declare function get(url: string, data: {
22
+ [key: string]: any;
23
+ }): Promise<any>;
24
+ export {};
@@ -0,0 +1,12 @@
1
+ interface HeaderBreadcrumbProps {
2
+ className?: string;
3
+ /** 资源名称,显示为面包屑的当前页面 */
4
+ resourceName: string;
5
+ /** 资源类型,显示为面包屑的上一级 */
6
+ resourceType: string;
7
+ /** 资源列表页的路径,点击资源类型时导航到此路径 */
8
+ resourcePath: string;
9
+ }
10
+ /** 详情页头部导航栏 */
11
+ export declare const HeaderBreadcrumb: ({ className, resourceName, resourceType, resourcePath, }: HeaderBreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,11 @@
1
+ export interface HeaderDetailProps {
2
+ title: React.ReactNode;
3
+ /** 标记 title,比如 右侧渲染一个 tag */
4
+ extraTitle?: React.ReactNode;
5
+ description: React.ReactNode;
6
+ className?: string;
7
+ children?: React.ReactNode;
8
+ icon: React.ReactNode;
9
+ }
10
+ /** 详情页面页头 */
11
+ export declare const HeaderDetail: ({ title, description, className, icon, extraTitle, children, }: HeaderDetailProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ export interface HeaderPageProps {
2
+ title: React.ReactNode;
3
+ description: React.ReactNode;
4
+ className?: string;
5
+ children?: React.ReactNode;
6
+ }
7
+ /** 主页面页头 */
8
+ export declare const HeaderPage: ({ title, description, className, children, }: HeaderPageProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from './header-detail';
2
+ export * from './header-page';
3
+ export * from './header-breadcrumb';
@@ -0,0 +1,8 @@
1
+ export interface HelperDocProps {
2
+ /** 帮助文档链接 */
3
+ path: string;
4
+ className?: string;
5
+ children?: React.ReactNode;
6
+ }
7
+ /** 唤醒帮助文档按钮,比如:“了解更多” */
8
+ export declare const HelperDoc: ({ path, children, className }: HelperDocProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const useAdminUuid: () => string;
@@ -0,0 +1,55 @@
1
+ import { default as React } from 'react';
2
+ import { InfoPopoverProps } from '../info-popover';
3
+ /**
4
+ * 支持的弹出位置类型,与 Tooltip 组件保持一致
5
+ *
6
+ * 基本方向:top, bottom, left, right
7
+ * 扩展方向:topLeft, topRight, leftTop, leftBottom, rightTop, rightBottom, bottomLeft, bottomRight
8
+ */
9
+ export type InfoPlacement = "top" | "bottom" | "left" | "right" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight";
10
+ export interface InfoProps {
11
+ /** 提示内容 */
12
+ info: React.ReactNode;
13
+ /** 弹出位置,支持 12 种方向 */
14
+ placement?: InfoPlacement;
15
+ /** 自定义图标类名 */
16
+ className?: string;
17
+ /** 标题(可选) */
18
+ title?: string;
19
+ /** 最大宽度 */
20
+ maxWidth?: number;
21
+ /** 最大高度 */
22
+ maxHeight?: number;
23
+ /**
24
+ * 触发模式
25
+ * - "hover": 悬停触发(默认)
26
+ * - "click": 点击触发
27
+ */
28
+ triggerMode?: InfoPopoverProps["triggerMode"];
29
+ }
30
+ /**
31
+ * Info - 信息提示组件
32
+ *
33
+ * 升级后的 Info 组件,底层使用 InfoPopover 实现,支持:
34
+ * - 长内容自动滚动
35
+ * - Hover 或 Click 触发
36
+ * - 符合 WCAG 2.1 标准
37
+ * - 12 种弹出位置,与 Tooltip 组件保持一致
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * // 简单用法
42
+ * <Info info="这是一段提示信息" />
43
+ *
44
+ * // 带标题
45
+ * <Info info="详细说明..." title="操作说明" />
46
+ *
47
+ * // 自定义位置
48
+ * <Info info="提示内容" placement="bottomRight" />
49
+ *
50
+ * // Markdown 内容
51
+ * <Info info={<ReactMarkdown>{markdownContent}</ReactMarkdown>} title="帮助" />
52
+ * ```
53
+ */
54
+ declare const Info: ({ info, placement, className, title, maxWidth, maxHeight, triggerMode, }: InfoProps) => import("react/jsx-runtime").JSX.Element;
55
+ export { Info };
@@ -0,0 +1,46 @@
1
+ import * as React from "react";
2
+ export interface InfoPopoverProps {
3
+ /** 内容,支持 ReactNode */
4
+ content: React.ReactNode;
5
+ /** 标题(可选,显示标题栏) */
6
+ title?: string;
7
+ /** 触发元素,默认为 info 图标按钮 */
8
+ trigger?: React.ReactNode;
9
+ /** 最大宽度,默认 400px */
10
+ maxWidth?: number;
11
+ /** 最大高度,默认 400px */
12
+ maxHeight?: number;
13
+ /** 弹出位置 */
14
+ side?: "top" | "right" | "bottom" | "left";
15
+ /** 对齐方式 */
16
+ align?: "start" | "center" | "end";
17
+ /** 自定义类名 */
18
+ className?: string;
19
+ /** 自定义内容区域类名 */
20
+ contentClassName?: string;
21
+ /** 是否禁用 */
22
+ disabled?: boolean;
23
+ /** 受控模式:打开状态 */
24
+ open?: boolean;
25
+ /** 受控模式:打开状态变化回调 */
26
+ onOpenChange?: (open: boolean) => void;
27
+ /** 自定义 z-index */
28
+ zIndex?: number;
29
+ /** 是否显示关闭按钮,默认 true(有标题时显示) */
30
+ showCloseButton?: boolean;
31
+ /** 触发器 aria-label */
32
+ triggerAriaLabel?: string;
33
+ /**
34
+ * 触发模式
35
+ * - "click": 点击触发
36
+ * - "hover": 悬停触发(默认),支持鼠标移动到内容上(符合 WCAG 1.4.13)
37
+ */
38
+ triggerMode?: "click" | "hover";
39
+ /** hover 模式下,鼠标离开后延迟关闭的时间(毫秒),默认 300ms */
40
+ hoverCloseDelay?: number;
41
+ /** hover 模式下,鼠标进入后延迟打开的时间(毫秒),默认 150ms */
42
+ hoverOpenDelay?: number;
43
+ /** 是否显示箭头,默认 true */
44
+ showArrow?: boolean;
45
+ }
46
+ export declare const InfoPopover: React.FC<InfoPopoverProps>;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { LocaleContainerProps } from './type';
3
+ export declare const LocaleContainer: FC<LocaleContainerProps>;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export type Locale = "zh-CN" | "en-US";
3
+ export type Message = Record<string, string>;
4
+ export interface LocaleContainerProps {
5
+ children: React.ReactNode;
6
+ currentLocale: Locale;
7
+ messages?: Message;
8
+ }
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ declare const NoDataIndicatorLarge: () => import("react/jsx-runtime").JSX.Element;
3
+ interface NoDataCommonLabelProps {
4
+ children?: React.ReactNode;
5
+ }
6
+ declare const NoDataCommonLabel: (props: NoDataCommonLabelProps) => import("react/jsx-runtime").JSX.Element;
7
+ interface NoDataProps {
8
+ children?: React.ReactNode;
9
+ variant?: "large";
10
+ }
11
+ declare const NoData: (props: NoDataProps) => import("react/jsx-runtime").JSX.Element | null;
12
+ export { NoDataIndicatorLarge, NoDataCommonLabel, NoData };
@@ -0,0 +1 @@
1
+ export declare const PanicFallback: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,90 @@
1
+ import * as React from "react";
2
+ /** 内容分析阈值配置 */
3
+ interface ContentThresholds {
4
+ /** 纯文本最大字符数,超过则使用 Popover */
5
+ maxLength: number;
6
+ /** 最大行数,超过则使用 Popover */
7
+ maxLines: number;
8
+ }
9
+ /** 内容分析结果 */
10
+ interface ContentAnalysis {
11
+ /** 是否应该使用 Popover */
12
+ shouldUsePopover: boolean;
13
+ /** 原因说明 */
14
+ reason: "markdown" | "length" | "lines" | "react_node" | "forced" | "short";
15
+ }
16
+ export interface SmartTipProps {
17
+ /** 提示内容(字符串或 ReactNode) */
18
+ content: React.ReactNode | string;
19
+ /** 是否为 Markdown 格式(Markdown 内容强制使用 Popover) */
20
+ markdown?: boolean;
21
+ /** Popover 标题(仅 Popover 模式生效) */
22
+ title?: string;
23
+ /** 触发元素 */
24
+ children: React.ReactNode;
25
+ /** 强制使用 Popover(即使内容很短) */
26
+ forcePopover?: boolean;
27
+ /** 强制使用 Tooltip(即使内容很长,不推荐) */
28
+ forceTooltip?: boolean;
29
+ /** Tooltip 位置 */
30
+ placement?: "top" | "bottom" | "left" | "right" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
31
+ /** Popover 位置 */
32
+ popoverSide?: "top" | "right" | "bottom" | "left";
33
+ /** Popover 对齐方式 */
34
+ popoverAlign?: "start" | "center" | "end";
35
+ /** Popover 最大宽度 */
36
+ popoverMaxWidth?: number;
37
+ /** Popover 最大高度 */
38
+ popoverMaxHeight?: number;
39
+ /** 自定义阈值配置 */
40
+ thresholds?: Partial<ContentThresholds>;
41
+ /** 是否禁用 */
42
+ disabled?: boolean;
43
+ /** 自定义类名(应用于外层容器) */
44
+ className?: string;
45
+ /** Info 图标的显示模式 */
46
+ infoIconMode?: "inline" | "replace";
47
+ /**
48
+ * InfoPopover 的触发模式
49
+ * - "hover": 悬停触发(默认,符合用户习惯,不会导致菜单失焦)
50
+ * - "click": 点击触发
51
+ */
52
+ popoverTriggerMode?: "click" | "hover";
53
+ /**
54
+ * 自定义 z-index
55
+ * 在 Dropdown/Menu 等高层级容器内使用时,需要设置更高的 z-index(如 1080)
56
+ */
57
+ zIndex?: number;
58
+ }
59
+ /**
60
+ * SmartTip - 智能提示组件
61
+ *
62
+ * 根据内容长度和类型自动选择使用 Tooltip 或 InfoPopover:
63
+ * - 短文本(≤80字符,≤3行)→ Tooltip(hover 触发)
64
+ * - 长文本、Markdown、ReactNode → InfoPopover(click 触发)
65
+ *
66
+ * 符合 W3C/WCAG 2.1 规范:
67
+ * - Tooltip 用于简短的补充信息
68
+ * - 长内容使用可交互的 Popover
69
+ * - 支持键盘导航和 Escape 关闭
70
+ *
71
+ * @example
72
+ * ```tsx
73
+ * // 短文本 → 自动使用 Tooltip
74
+ * <SmartTip content="这是一个简短的提示">
75
+ * <Button>Hover me</Button>
76
+ * </SmartTip>
77
+ *
78
+ * // 长文本 → 自动使用 InfoPopover
79
+ * <SmartTip content="这是一段很长的文字,超过80个字符后会自动切换为 Popover 模式...">
80
+ * <Button>Click info icon</Button>
81
+ * </SmartTip>
82
+ *
83
+ * // Markdown 内容 → 强制使用 InfoPopover
84
+ * <SmartTip content="## 标题\n- 列表项1\n- 列表项2" markdown>
85
+ * <span>操作名称</span>
86
+ * </SmartTip>
87
+ * ```
88
+ */
89
+ export declare const SmartTip: React.FC<SmartTipProps>;
90
+ export type { ContentThresholds, ContentAnalysis };
@@ -0,0 +1,25 @@
1
+ import { default as React } from 'react';
2
+ import { Color } from './_utils';
3
+ import { IconName } from '@zstack/icon';
4
+ export type IType = "queue" | "progress" | "success" | "error" | "warning" | "disabled" | "unknown" | "stopped" | "paused" | "maintenance" | "running";
5
+ export type IStateMap = {
6
+ [key in IType]: {
7
+ color: Color.ISemantic;
8
+ icon: IconName;
9
+ };
10
+ };
11
+ export interface IStateProps {
12
+ name: string;
13
+ color?: {
14
+ color: Color.ISemantic | "neutral";
15
+ number?: Color.INeutralNumber | Color.ISemanticNumber;
16
+ };
17
+ type?: IType;
18
+ prefix?: "dot" | "icon";
19
+ suffix?: "icon";
20
+ contentType?: "text" | "tag";
21
+ icon?: IconName;
22
+ className?: string;
23
+ }
24
+ export declare const stateMap: IStateMap;
25
+ export declare const State: React.FC<IStateProps>;
@@ -0,0 +1,31 @@
1
+ import { DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription } from './dialog';
2
+ import { ButtonProps } from './button';
3
+ import * as React from "react";
4
+ declare const AlertDialog: React.FC<import('@radix-ui/react-dialog').DialogProps>;
5
+ declare const AlertDialogTrigger: React.ForwardRefExoticComponent<import('@radix-ui/react-dialog').DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const AlertDialogPortal: React.FC<import('@radix-ui/react-dialog').DialogPortalProps>;
7
+ declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-dialog').DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ export interface AlertDialogContentProps extends React.ComponentPropsWithoutRef<typeof DialogContent> {
9
+ }
10
+ declare const AlertDialogContent: React.ForwardRefExoticComponent<import('./dialog').DialogContentProps & React.RefAttributes<HTMLDivElement>>;
11
+ export interface AlertDialogHeaderProps extends React.ComponentPropsWithoutRef<typeof DialogHeader> {
12
+ }
13
+ declare const AlertDialogHeader: {
14
+ ({ className, variant, ...props }: import('./dialog').DialogHeaderProps): import("react/jsx-runtime").JSX.Element;
15
+ displayName: string;
16
+ };
17
+ export interface AlertDialogFooterProps extends React.ComponentPropsWithoutRef<typeof DialogFooter> {
18
+ }
19
+ declare const AlertDialogFooter: {
20
+ ({ className, variant, ...props }: import('./dialog').DialogFooterProps): import("react/jsx-runtime").JSX.Element;
21
+ displayName: string;
22
+ };
23
+ export interface AlertDialogTitleProps extends React.ComponentPropsWithoutRef<typeof DialogTitle> {
24
+ }
25
+ declare const AlertDialogTitle: React.ForwardRefExoticComponent<import('./dialog').DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
26
+ export interface AlertDialogDescriptionProps extends React.ComponentPropsWithoutRef<typeof DialogDescription> {
27
+ }
28
+ declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-dialog').DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
29
+ declare const AlertDialogAction: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
30
+ declare const AlertDialogCancel: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
31
+ export { AlertDialog, AlertDialogTrigger, AlertDialogPortal, AlertDialogOverlay, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
@@ -0,0 +1,16 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from "react";
3
+ declare const alertVariants: (props?: ({
4
+ variant?: "danger" | "warning" | "info" | "positive" | null | undefined;
5
+ display?: "strong" | "weak" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ export interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {
8
+ children: React.ReactNode;
9
+ closable?: boolean;
10
+ /**
11
+ * 关闭时的回调
12
+ */
13
+ onClose?: () => void;
14
+ }
15
+ declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
16
+ export { Alert };
@@ -0,0 +1,20 @@
1
+ import * as React from "react";
2
+ export interface AutoCompleteOption {
3
+ value: string;
4
+ label: string;
5
+ i18nKey?: string;
6
+ }
7
+ export type TriggerMode = "search" | "focus";
8
+ export interface AutoCompleteProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "onSelect"> {
9
+ options: AutoCompleteOption[];
10
+ onChange?: (value: string) => void;
11
+ onSelect?: (option: AutoCompleteOption) => void;
12
+ /**
13
+ * 控制下拉框的触发方式
14
+ * @default "search" - 只有在用户输入内容时才显示下拉框
15
+ * "focus" - 在输入框获得焦点时就显示下拉框
16
+ */
17
+ triggerMode?: TriggerMode;
18
+ }
19
+ declare const AutoComplete: React.ForwardRefExoticComponent<AutoCompleteProps & React.RefAttributes<HTMLInputElement>>;
20
+ export { AutoComplete };