@huibo-ui/react-antd 1.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.
Files changed (125) hide show
  1. package/lib/components/Affix.d.ts +6 -0
  2. package/lib/components/Affix.js +5 -0
  3. package/lib/components/Alert.d.ts +10 -0
  4. package/lib/components/Alert.js +5 -0
  5. package/lib/components/Anchor.d.ts +7 -0
  6. package/lib/components/Anchor.js +5 -0
  7. package/lib/components/App.d.ts +4 -0
  8. package/lib/components/App.js +6 -0
  9. package/lib/components/Avatar.d.ts +8 -0
  10. package/lib/components/Avatar.js +6 -0
  11. package/lib/components/BackTop.d.ts +6 -0
  12. package/lib/components/BackTop.js +5 -0
  13. package/lib/components/Badge.d.ts +9 -0
  14. package/lib/components/Badge.js +5 -0
  15. package/lib/components/Breadcrumb.d.ts +12 -0
  16. package/lib/components/Breadcrumb.js +10 -0
  17. package/lib/components/Button.d.ts +14 -0
  18. package/lib/components/Button.js +7 -0
  19. package/lib/components/Card.d.ts +11 -0
  20. package/lib/components/Card.js +5 -0
  21. package/lib/components/Cascader.d.ts +12 -0
  22. package/lib/components/Cascader.js +5 -0
  23. package/lib/components/Checkbox.d.ts +18 -0
  24. package/lib/components/Checkbox.js +10 -0
  25. package/lib/components/Collapse.d.ts +11 -0
  26. package/lib/components/Collapse.js +7 -0
  27. package/lib/components/ConfigProvider.d.ts +27 -0
  28. package/lib/components/ConfigProvider.js +80 -0
  29. package/lib/components/DatePicker.d.ts +35 -0
  30. package/lib/components/DatePicker.js +15 -0
  31. package/lib/components/Descriptions.d.ts +12 -0
  32. package/lib/components/Descriptions.js +13 -0
  33. package/lib/components/Divider.d.ts +8 -0
  34. package/lib/components/Divider.js +5 -0
  35. package/lib/components/Drawer.d.ts +11 -0
  36. package/lib/components/Drawer.js +6 -0
  37. package/lib/components/Dropdown.d.ts +10 -0
  38. package/lib/components/Dropdown.js +5 -0
  39. package/lib/components/Empty.d.ts +10 -0
  40. package/lib/components/Empty.js +14 -0
  41. package/lib/components/FloatButton.d.ts +8 -0
  42. package/lib/components/FloatButton.js +5 -0
  43. package/lib/components/Form.d.ts +79 -0
  44. package/lib/components/Form.js +97 -0
  45. package/lib/components/Image.d.ts +9 -0
  46. package/lib/components/Image.js +5 -0
  47. package/lib/components/Input.d.ts +39 -0
  48. package/lib/components/Input.js +37 -0
  49. package/lib/components/InputNumber.d.ts +13 -0
  50. package/lib/components/InputNumber.js +5 -0
  51. package/lib/components/Layout.d.ts +46 -0
  52. package/lib/components/Layout.js +85 -0
  53. package/lib/components/Menu.d.ts +39 -0
  54. package/lib/components/Menu.js +32 -0
  55. package/lib/components/Modal.d.ts +26 -0
  56. package/lib/components/Modal.js +76 -0
  57. package/lib/components/PageHeader.d.ts +8 -0
  58. package/lib/components/PageHeader.js +5 -0
  59. package/lib/components/Pagination.d.ts +11 -0
  60. package/lib/components/Pagination.js +5 -0
  61. package/lib/components/Popconfirm.d.ts +10 -0
  62. package/lib/components/Popconfirm.js +5 -0
  63. package/lib/components/Popover.d.ts +8 -0
  64. package/lib/components/Popover.js +5 -0
  65. package/lib/components/Progress.d.ts +10 -0
  66. package/lib/components/Progress.js +5 -0
  67. package/lib/components/QRCode.d.ts +14 -0
  68. package/lib/components/QRCode.js +10 -0
  69. package/lib/components/Radio.d.ts +24 -0
  70. package/lib/components/Radio.js +23 -0
  71. package/lib/components/Rate.d.ts +9 -0
  72. package/lib/components/Rate.js +5 -0
  73. package/lib/components/Result.d.ts +8 -0
  74. package/lib/components/Result.js +5 -0
  75. package/lib/components/Segmented.d.ts +11 -0
  76. package/lib/components/Segmented.js +5 -0
  77. package/lib/components/Select.d.ts +30 -0
  78. package/lib/components/Select.js +43 -0
  79. package/lib/components/Skeleton.d.ts +19 -0
  80. package/lib/components/Skeleton.js +20 -0
  81. package/lib/components/Slider.d.ts +11 -0
  82. package/lib/components/Slider.js +5 -0
  83. package/lib/components/Space.d.ts +12 -0
  84. package/lib/components/Space.js +12 -0
  85. package/lib/components/Spin.d.ts +8 -0
  86. package/lib/components/Spin.js +8 -0
  87. package/lib/components/Statistic.d.ts +9 -0
  88. package/lib/components/Statistic.js +5 -0
  89. package/lib/components/Steps.d.ts +13 -0
  90. package/lib/components/Steps.js +7 -0
  91. package/lib/components/Switch.d.ts +10 -0
  92. package/lib/components/Switch.js +5 -0
  93. package/lib/components/Table.d.ts +55 -0
  94. package/lib/components/Table.js +187 -0
  95. package/lib/components/Tabs.d.ts +21 -0
  96. package/lib/components/Tabs.js +7 -0
  97. package/lib/components/Tag.d.ts +8 -0
  98. package/lib/components/Tag.js +6 -0
  99. package/lib/components/TimePicker.d.ts +11 -0
  100. package/lib/components/TimePicker.js +5 -0
  101. package/lib/components/Timeline.d.ts +7 -0
  102. package/lib/components/Timeline.js +5 -0
  103. package/lib/components/Tooltip.d.ts +7 -0
  104. package/lib/components/Tooltip.js +5 -0
  105. package/lib/components/Tour.d.ts +6 -0
  106. package/lib/components/Tour.js +5 -0
  107. package/lib/components/Tree.d.ts +22 -0
  108. package/lib/components/Tree.js +45 -0
  109. package/lib/components/TreeSelect.d.ts +11 -0
  110. package/lib/components/TreeSelect.js +5 -0
  111. package/lib/components/Typography.d.ts +10 -0
  112. package/lib/components/Typography.js +19 -0
  113. package/lib/components/Upload.d.ts +18 -0
  114. package/lib/components/Upload.js +12 -0
  115. package/lib/components/Watermark.d.ts +13 -0
  116. package/lib/components/Watermark.js +5 -0
  117. package/lib/components/message.d.ts +19 -0
  118. package/lib/components/message.js +32 -0
  119. package/lib/components/notification.d.ts +19 -0
  120. package/lib/components/notification.js +28 -0
  121. package/lib/index.d.ts +219 -0
  122. package/lib/index.js +123 -0
  123. package/lib/utils.d.ts +1 -0
  124. package/lib/utils.js +1 -0
  125. package/package.json +33 -0
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare function Affix(props: {
3
+ offsetTop?: number;
4
+ offsetBottom?: number;
5
+ children?: React.ReactNode;
6
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbAffix } from '@huibo-ui/react';
3
+ export function Affix(props) {
4
+ return _jsx(HbAffix, { top: props.offsetTop, bottom: props.offsetBottom, children: props.children });
5
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export declare function Alert(props: {
3
+ type?: 'success' | 'info' | 'warning' | 'error';
4
+ message?: React.ReactNode;
5
+ description?: React.ReactNode;
6
+ closable?: boolean;
7
+ showIcon?: boolean;
8
+ onClose?: () => void;
9
+ style?: React.CSSProperties;
10
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbAlert } from '@huibo-ui/react';
3
+ export function Alert(props) {
4
+ return _jsx(HbAlert, { type: props.type, title: typeof props.message === 'string' ? props.message : '', closable: props.closable, showIcon: props.showIcon ?? true, onHbClose: () => props.onClose?.(), style: props.style });
5
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare function Anchor(props: {
3
+ items?: any[];
4
+ offsetTop?: number;
5
+ affix?: boolean;
6
+ onClick?: (e: any) => void;
7
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbAnchor } from '@huibo-ui/react';
3
+ export function Anchor(props) {
4
+ return _jsx(HbAnchor, { items: props.items, top: props.offsetTop, affix: props.affix, onHbClick: (e) => props.onClick?.(e.detail) });
5
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare function App({ children }: {
3
+ children?: React.ReactNode;
4
+ }): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ // antd App 组件是一个 Context Provider,huibo-ui 无对应,
3
+ // 透传 children 即可(message/notification 用自己的命令式 API)
4
+ export function App({ children }) {
5
+ return _jsx(_Fragment, { children: children });
6
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare function Avatar(props: {
3
+ src?: string;
4
+ size?: number | 'small' | 'middle' | 'large';
5
+ shape?: 'circle' | 'square';
6
+ children?: React.ReactNode;
7
+ style?: React.CSSProperties;
8
+ }): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbAvatar } from '@huibo-ui/react';
3
+ export function Avatar(props) {
4
+ const sz = props.size === 'middle' ? 'default' : props.size;
5
+ return _jsx(HbAvatar, { size: sz, shape: props.shape, style: props.style, children: props.src ? null : props.children });
6
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare function BackTop(props: {
3
+ visibilityHeight?: number;
4
+ onClick?: () => void;
5
+ children?: React.ReactNode;
6
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbBacktop } from '@huibo-ui/react';
3
+ export function BackTop(props) {
4
+ return _jsx(HbBacktop, { visibilityHeight: props.visibilityHeight, onHbClick: () => props.onClick?.(), children: props.children });
5
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export declare function Badge(props: {
3
+ count?: number;
4
+ overflowCount?: number;
5
+ status?: 'success' | 'processing' | 'error' | 'default' | 'warning';
6
+ dot?: boolean;
7
+ showZero?: boolean;
8
+ children?: React.ReactNode;
9
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbBadge } from '@huibo-ui/react';
3
+ export function Badge(props) {
4
+ return _jsx(HbBadge, { value: props.count ?? 0, max: props.overflowCount ?? 99, type: props.status, dot: props.dot, showZero: props.showZero, children: props.children });
5
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export declare function Breadcrumb(props: {
3
+ items?: {
4
+ title: React.ReactNode;
5
+ href?: string;
6
+ }[];
7
+ separator?: React.ReactNode;
8
+ children?: React.ReactNode;
9
+ }): React.JSX.Element;
10
+ export declare namespace Breadcrumb {
11
+ var Item: any;
12
+ }
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { HbBreadcrumb, HbBreadcrumbItem } from '@huibo-ui/react';
4
+ export function Breadcrumb(props) {
5
+ if (props.items) {
6
+ return _jsx(HbBreadcrumb, { separator: props.separator, children: props.items.map((item, i) => React.createElement(HbBreadcrumbItem, { key: i, href: item.href }, item.title)) });
7
+ }
8
+ return _jsx(HbBreadcrumb, { children: props.children });
9
+ }
10
+ Breadcrumb.Item = function BreadcrumbItem(props) { return React.createElement(HbBreadcrumbItem, props); };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
3
+ type?: 'primary' | 'default' | 'dashed' | 'link' | 'text';
4
+ size?: 'small' | 'middle' | 'large';
5
+ ghost?: boolean;
6
+ danger?: boolean;
7
+ block?: boolean;
8
+ loading?: boolean;
9
+ disabled?: boolean;
10
+ icon?: React.ReactNode;
11
+ children?: React.ReactNode;
12
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
13
+ }
14
+ export declare function Button({ type, size, danger, block, loading, disabled, icon, children, onClick, ...rest }: ButtonProps): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { HbButton } from '@huibo-ui/react';
3
+ export function Button({ type, size, danger, block, loading, disabled, icon, children, onClick, ...rest }) {
4
+ const huiboType = danger ? 'danger' : type || 'default';
5
+ const huiboSize = size === 'middle' ? 'default' : size || 'default';
6
+ return (_jsxs(HbButton, { type: huiboType, size: huiboSize, disabled: disabled, loading: loading, onClick: onClick, children: [icon, children] }));
7
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export declare function Card(props: {
3
+ title?: React.ReactNode;
4
+ bordered?: boolean;
5
+ extra?: React.ReactNode;
6
+ children?: React.ReactNode;
7
+ bodyStyle?: React.CSSProperties;
8
+ style?: React.CSSProperties;
9
+ loading?: boolean;
10
+ hoverable?: boolean;
11
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbCard } from '@huibo-ui/react';
3
+ export function Card(props) {
4
+ return _jsx(HbCard, { header: typeof props.title === 'string' ? props.title : '', border: props.bordered ?? true, bodyStyle: props.bodyStyle, style: props.style, children: props.children });
5
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export declare function Cascader(props: {
3
+ options?: any[];
4
+ value?: any;
5
+ onChange?: (value: any) => void;
6
+ multiple?: boolean;
7
+ placeholder?: string;
8
+ disabled?: boolean;
9
+ allowClear?: boolean;
10
+ showSearch?: boolean;
11
+ style?: React.CSSProperties;
12
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbCascader } from '@huibo-ui/react';
3
+ export function Cascader(props) {
4
+ return _jsx(HbCascader, { options: props.options || [], modelValue: props.value, multiple: props.multiple, placeholder: props.placeholder, disabled: props.disabled, clearable: props.allowClear, filterable: props.showSearch, onHbChange: (e) => props.onChange?.(e.detail), style: props.style });
5
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ export declare function Checkbox(props: {
3
+ checked?: boolean;
4
+ onChange?: (e: any) => void;
5
+ disabled?: boolean;
6
+ children?: React.ReactNode;
7
+ indeterminate?: boolean;
8
+ }): React.JSX.Element;
9
+ export declare namespace Checkbox {
10
+ var Group: any;
11
+ }
12
+ export declare function CheckboxGroup(props: {
13
+ value?: any[];
14
+ onChange?: (value: any[]) => void;
15
+ options?: any[];
16
+ disabled?: boolean;
17
+ children?: React.ReactNode;
18
+ }): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbCheckbox, HbCheckboxGroup } from '@huibo-ui/react';
3
+ export function Checkbox(props) {
4
+ return _jsx(HbCheckbox, { checked: props.checked ?? false, disabled: props.disabled, label: props.children, onHbChange: (e) => props.onChange?.({ target: { checked: e.detail } }), children: props.children });
5
+ }
6
+ export function CheckboxGroup(props) {
7
+ return _jsx(HbCheckboxGroup, { modelValue: props.value ?? [], options: props.options || [], disabled: props.disabled, onHbChange: (e) => props.onChange?.(e.detail), children: props.children });
8
+ }
9
+ // antd 静态子组件:Checkbox.Group
10
+ Checkbox.Group = CheckboxGroup;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export declare function Collapse(props: {
3
+ activeKey?: string[] | string;
4
+ onChange?: (key: any) => void;
5
+ accordion?: boolean;
6
+ children?: React.ReactNode;
7
+ style?: React.CSSProperties;
8
+ }): React.JSX.Element;
9
+ export declare namespace Collapse {
10
+ var Panel: any;
11
+ }
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { HbCollapse, HbCollapseItem } from '@huibo-ui/react';
4
+ export function Collapse(props) {
5
+ return _jsx(HbCollapse, { modelValue: Array.isArray(props.activeKey) ? props.activeKey : props.activeKey ? [props.activeKey] : [], accordion: props.accordion, style: props.style, children: props.children });
6
+ }
7
+ Collapse.Panel = function Panel(props) { return React.createElement(HbCollapseItem, { header: props.header, name: props.key }, props.children); };
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ export interface AntdThemeToken {
3
+ colorPrimary?: string;
4
+ colorSuccess?: string;
5
+ colorWarning?: string;
6
+ colorError?: string;
7
+ colorInfo?: string;
8
+ borderRadius?: number;
9
+ borderRadiusLG?: number;
10
+ borderRadiusSM?: number;
11
+ fontSize?: number;
12
+ colorTextBase?: string;
13
+ colorBgBase?: string;
14
+ fontFamily?: string;
15
+ }
16
+ export interface AntdThemeConfig {
17
+ token?: AntdThemeToken;
18
+ algorithm?: string;
19
+ dark?: boolean;
20
+ }
21
+ export interface ConfigProviderProps {
22
+ theme?: AntdThemeConfig;
23
+ locale?: any;
24
+ componentSize?: 'small' | 'middle' | 'large';
25
+ children?: React.ReactNode;
26
+ }
27
+ export declare function ConfigProvider(props: ConfigProviderProps): React.JSX.Element;
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { HbConfigProvider } from '@huibo-ui/react';
4
+ /**
5
+ * 把 antd 的 ThemeConfig.token 映射到 huibo-ui 的 --hb-* 设计令牌。
6
+ * 写在 document.documentElement(:root) 上,custom property 会穿透 shadow DOM,
7
+ * 所有 hb-* 组件(含 26 个遗留组件迁移后的)都能拿到。
8
+ *
9
+ * 主色:antd 只给一个 colorPrimary,huibo-ui 需要色阶(hover/active/bg/border)。
10
+ * 这里用 color-mix 在 colorPrimary 基础上生成近似色阶(现代浏览器均支持),
11
+ * 覆盖默认橙/蓝色阶——保证任意主色都能得到合理的 hover/active/bg。
12
+ */
13
+ function applyThemeToken(token) {
14
+ const root = document.documentElement;
15
+ if (!token)
16
+ return;
17
+ const style = root.style;
18
+ // 主色 + 派生色阶(color-mix 生成 hover/active/bg/border)
19
+ if (token.colorPrimary) {
20
+ style.setProperty('--hb-color-primary', token.colorPrimary);
21
+ // hover: 提亮 12%;active: 加深 10%;bg: 接近白带主色(主色 8%);border: 主色淡化
22
+ style.setProperty('--hb-color-primary-hover', `color-mix(in srgb, ${token.colorPrimary}, #fff 14%)`);
23
+ style.setProperty('--hb-color-primary-active', `color-mix(in srgb, ${token.colorPrimary}, #000 12%)`);
24
+ style.setProperty('--hb-color-primary-bg', `color-mix(in srgb, ${token.colorPrimary}, #fff 92%)`);
25
+ style.setProperty('--hb-color-primary-border', `color-mix(in srgb, ${token.colorPrimary}, #fff 40%)`);
26
+ }
27
+ // 功能色(antd 直接给主值,huibo 需 hover/bg,用 color-mix 派生)
28
+ const derived = [
29
+ ['colorSuccess', '--hb-color-success'],
30
+ ['colorWarning', '--hb-color-warning'],
31
+ ['colorError', '--hb-color-danger'],
32
+ ['colorInfo', '--hb-color-info'],
33
+ ];
34
+ for (const [tk, hbVar] of derived) {
35
+ const v = token[tk];
36
+ if (v) {
37
+ style.setProperty(hbVar, v);
38
+ style.setProperty(`${hbVar}-hover`, `color-mix(in srgb, ${v}, #000 10%)`);
39
+ style.setProperty(`${hbVar}-bg`, `color-mix(in srgb, ${v}, #fff 88%)`);
40
+ style.setProperty(`${hbVar}-border`, `color-mix(in srgb, ${v}, #fff 50%)`);
41
+ }
42
+ }
43
+ // 圆角:antd borderRadius 是基础值,huibo 派生 xs/sm/base/lg
44
+ if (typeof token.borderRadius === 'number') {
45
+ const r = token.borderRadius;
46
+ style.setProperty('--hb-border-radius-xs', `${Math.max(r - 2, 0)}px`);
47
+ style.setProperty('--hb-border-radius-sm', `${r}px`);
48
+ style.setProperty('--hb-border-radius-base', `${r}px`);
49
+ style.setProperty('--hb-border-radius-lg', `${r + 2}px`);
50
+ style.setProperty('--hb-border-radius-xl', `${r + 4}px`);
51
+ // 组件级圆角令牌也同步(button/input/tag/dialog 等引用 sm/lg)
52
+ style.setProperty('--hb-button-radius', `${r}px`);
53
+ style.setProperty('--hb-input-radius', `${r}px`);
54
+ style.setProperty('--hb-tag-radius', `${r}px`);
55
+ style.setProperty('--hb-dialog-radius', `${r + 2}px`);
56
+ }
57
+ if (typeof token.borderRadiusLG === 'number') {
58
+ style.setProperty('--hb-border-radius-lg', `${token.borderRadiusLG}px`);
59
+ style.setProperty('--hb-dialog-radius', `${token.borderRadiusLG}px`);
60
+ }
61
+ if (typeof token.borderRadiusSM === 'number') {
62
+ style.setProperty('--hb-border-radius-sm', `${token.borderRadiusSM}px`);
63
+ }
64
+ // 字号 / 字体
65
+ if (typeof token.fontSize === 'number') {
66
+ style.setProperty('--hb-font-size-base', `${token.fontSize}px`);
67
+ }
68
+ if (token.fontFamily) {
69
+ style.setProperty('--hb-font-family', token.fontFamily);
70
+ style.setProperty('--hb-p-font-family', token.fontFamily);
71
+ }
72
+ }
73
+ export function ConfigProvider(props) {
74
+ const { theme, children } = props;
75
+ // 应用 theme.token 到 :root(穿透 shadow DOM 生效)
76
+ React.useEffect(() => {
77
+ applyThemeToken(theme?.token);
78
+ }, [theme?.token]);
79
+ return (_jsx(HbConfigProvider, { theme: theme?.dark ? 'dark' : 'light', size: props.componentSize === 'middle' ? 'default' : props.componentSize, locale: props.locale ? 'zh-CN' : 'en-US', children: _jsx("div", { style: { display: 'block', width: '100%', height: '100%' }, children: children }) }));
80
+ }
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ export interface DatePickerProps {
3
+ value?: any;
4
+ onChange?: (value: any, dateString: string) => void;
5
+ picker?: 'date' | 'month' | 'year' | 'week' | 'quarter';
6
+ format?: string;
7
+ allowClear?: boolean;
8
+ disabled?: boolean;
9
+ size?: 'small' | 'middle' | 'large';
10
+ placeholder?: string;
11
+ presets?: any[];
12
+ showTime?: boolean;
13
+ status?: '' | 'error' | 'warning';
14
+ disabledDate?: (date: Date) => boolean;
15
+ style?: React.CSSProperties;
16
+ className?: string;
17
+ }
18
+ export declare function DatePicker(props: DatePickerProps): React.JSX.Element;
19
+ export declare namespace DatePicker {
20
+ var RangePicker: any;
21
+ }
22
+ export interface RangePickerProps {
23
+ value?: any[];
24
+ onChange?: (dates: any[], dateStrings: [string, string]) => void;
25
+ format?: string;
26
+ allowClear?: boolean;
27
+ disabled?: boolean;
28
+ size?: 'small' | 'middle' | 'large';
29
+ showTime?: boolean;
30
+ presets?: any[];
31
+ status?: '' | 'error' | 'warning';
32
+ disabledDate?: (date: Date) => boolean;
33
+ style?: React.CSSProperties;
34
+ className?: string;
35
+ }
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbDatePicker, HbDateRangePicker } from '@huibo-ui/react';
3
+ export function DatePicker(props) {
4
+ return (_jsx(HbDatePicker, { modelValue: props.value, type: props.picker || 'date', format: props.format, clearable: props.allowClear, disabled: props.disabled, size: props.size === 'middle' ? 'default' : props.size, placeholder: props.placeholder, presets: props.presets, showTime: props.showTime, status: props.status, disabledDate: props.disabledDate, style: props.style, className: props.className, onHbChange: (e) => props.onChange?.(e.detail, '') }));
5
+ }
6
+ /**
7
+ * DatePicker.RangePicker —— 范围选择器,走 hb-date-range-picker。
8
+ * value 为 [start, end] 数组;onChange 回调对齐 antd:(dates, [startStr, endStr])。
9
+ */
10
+ DatePicker.RangePicker = function RangePicker(props) {
11
+ return (_jsx(HbDateRangePicker, { modelValue: props.value || [], format: props.format, clearable: props.allowClear, disabled: props.disabled, size: props.size === 'middle' ? 'default' : props.size, showTime: props.showTime, presets: props.presets, status: props.status, disabledDate: props.disabledDate, style: props.style, className: props.className, onHbChange: (e) => {
12
+ const detail = e?.detail || [];
13
+ props.onChange?.(detail, [detail[0]?.format?.() || '', detail[1]?.format?.() || '']);
14
+ } }));
15
+ };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export declare function Descriptions(props: {
3
+ title?: React.ReactNode;
4
+ bordered?: boolean;
5
+ column?: number;
6
+ layout?: 'horizontal' | 'vertical';
7
+ children?: React.ReactNode;
8
+ style?: React.CSSProperties;
9
+ }): React.JSX.Element;
10
+ export declare namespace Descriptions {
11
+ var Item: any;
12
+ }
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { HbDescriptions } from '@huibo-ui/react';
3
+ export function Descriptions(props) {
4
+ return _jsx(HbDescriptions, { title: typeof props.title === 'string' ? props.title : '', border: props.bordered, column: props.column ?? 3, direction: props.layout, style: props.style, children: props.children });
5
+ }
6
+ /**
7
+ * Descriptions.Item —— antd 声明式用法。
8
+ * huibo hb-descriptions 无对齐的 item 子组件,这里渲染成一行「label: children」,
9
+ * 保证内容可见、不崩溃(视觉与原生略有差异)。
10
+ */
11
+ Descriptions.Item = function DescriptionItem(props) {
12
+ return (_jsxs("div", { style: { display: 'flex', gap: 8, padding: '4px 0' }, children: [props.label != null && (_jsx("span", { style: { color: 'rgba(0,0,0,0.45)', minWidth: 80 }, children: props.label })), _jsx("span", { children: props.children })] }));
13
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare function Divider(props: {
3
+ type?: 'horizontal' | 'vertical';
4
+ orientation?: 'left' | 'center' | 'right';
5
+ dashed?: boolean;
6
+ children?: React.ReactNode;
7
+ style?: React.CSSProperties;
8
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbDivider } from '@huibo-ui/react';
3
+ export function Divider(props) {
4
+ return _jsx(HbDivider, { direction: props.type, contentPosition: props.orientation, dashed: props.dashed, style: props.style, children: props.children });
5
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export declare function Drawer(props: {
3
+ open?: boolean;
4
+ title?: React.ReactNode;
5
+ placement?: 'top' | 'right' | 'bottom' | 'left';
6
+ width?: string | number;
7
+ onClose?: () => void;
8
+ maskClosable?: boolean;
9
+ children?: React.ReactNode;
10
+ style?: React.CSSProperties;
11
+ }): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbDrawer } from '@huibo-ui/react';
3
+ export function Drawer(props) {
4
+ const dirMap = { left: 'ltr', right: 'rtl', top: 'ttb', bottom: 'btt' };
5
+ return _jsx(HbDrawer, { modelValue: props.open ?? false, title: typeof props.title === 'string' ? props.title : '', direction: dirMap[props.placement || 'right'], size: props.width ? String(props.width) : undefined, closeOnClickModal: props.maskClosable ?? true, onHbClose: () => props.onClose?.(), children: props.children });
6
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export declare function Dropdown(props: {
3
+ menu?: {
4
+ items: any[];
5
+ onClick?: (info: any) => void;
6
+ };
7
+ trigger?: ('click' | 'hover')[];
8
+ placement?: string;
9
+ children?: React.ReactNode;
10
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbDropdown } from '@huibo-ui/react';
3
+ export function Dropdown(props) {
4
+ return _jsx(HbDropdown, { items: props.menu?.items || [], trigger: (props.trigger?.[0] || 'hover'), placement: props.placement, children: props.children });
5
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export declare function Empty(props: {
3
+ description?: React.ReactNode;
4
+ image?: React.ReactNode;
5
+ style?: React.CSSProperties;
6
+ }): React.JSX.Element;
7
+ export declare namespace Empty {
8
+ var PRESENTED_IMAGE_SIMPLE: any;
9
+ var PRESENTED_IMAGE_DEFAULT: any;
10
+ }
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { HbEmpty } from '@huibo-ui/react';
4
+ export function Empty(props) {
5
+ return _jsx(HbEmpty, { description: typeof props.description === 'string' ? props.description : '暂无数据', style: props.style });
6
+ }
7
+ /**
8
+ * antd Empty.PRESENTED_IMAGE_SIMPLE / _DEFAULT 兼容。
9
+ * antd 这里是 ReactNode(SVG 图)。huibo hb-empty 的 image 只收字符串,
10
+ * 传 ReactNode 会被忽略(组件内部回退到默认插画)。这里返回占位 ReactNode 以满足解构用法,
11
+ * 不改变渲染(hb-empty 自带默认空态插画)。
12
+ */
13
+ Empty.PRESENTED_IMAGE_SIMPLE = React.createElement('span', { 'aria-hidden': true });
14
+ Empty.PRESENTED_IMAGE_DEFAULT = React.createElement('span', { 'aria-hidden': true });
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare function FloatButton(props: {
3
+ type?: 'default' | 'primary';
4
+ icon?: React.ReactNode;
5
+ shape?: 'circle' | 'square';
6
+ onClick?: () => void;
7
+ children?: React.ReactNode;
8
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HbFloatButton } from '@huibo-ui/react';
3
+ export function FloatButton(props) {
4
+ return _jsx(HbFloatButton, { type: props.type, icon: props.icon, shape: props.shape, onHbClick: () => props.onClick?.(), children: props.children });
5
+ }
@@ -0,0 +1,79 @@
1
+ import React from 'react';
2
+ /**
3
+ * antd Form 兼容层。
4
+ *
5
+ * useForm() 返回一个实例,其方法转发到内部 <hb-form> 自定义元素的 @Method
6
+ * (getFieldsValue / setFieldsValue / setFieldValue / getFieldValue /
7
+ * validateFields / validate / resetFields)。
8
+ * 转发通过 ref:useForm 创建一个 ref setter,<HbForm ref={form.__setRef}> 挂载后
9
+ * 把 CE 元素存进闭包,之后实例方法即直接调 CE method。
10
+ * 在 CE 挂载前调用方法会排队等待——与 antd useForm 行为一致。
11
+ */
12
+ export interface FormInstance {
13
+ /** 内部:供 <HbForm ref> 绑定 CE 元素 */
14
+ __setRef: (el: any) => void;
15
+ getFieldValue: (name: string) => Promise<any>;
16
+ getFieldsValue: (nameList?: string[]) => Promise<Record<string, any>>;
17
+ setFieldValue: (name: string, value: any) => Promise<void>;
18
+ setFieldsValue: (values: Record<string, any>) => Promise<void>;
19
+ /** 对齐 antd:通过 resolve(values)/reject(errorFields) */
20
+ validateFields: (nameList?: string[]) => Promise<Record<string, any>>;
21
+ /** 返回布尔,对齐早期用法 */
22
+ validate: (nameList?: string[]) => Promise<boolean>;
23
+ resetFields: (nameList?: string[]) => Promise<void>;
24
+ /** 兼容 antd 上的其它常用方法(简易实现,保持不崩溃) */
25
+ submit: () => void;
26
+ scrollToField: (_name: string) => void;
27
+ getFieldsError: () => any[];
28
+ getFieldError: (_name: string) => string[];
29
+ }
30
+ export interface FormProps {
31
+ form?: FormInstance;
32
+ initialValues?: Record<string, any>;
33
+ onFinish?: (values: any) => void;
34
+ onFinishFailed?: (errorInfo: any) => void;
35
+ onValuesChange?: (changed: any, all: any) => void;
36
+ layout?: 'horizontal' | 'vertical' | 'inline';
37
+ labelCol?: {
38
+ span?: number;
39
+ };
40
+ wrapperCol?: {
41
+ span?: number;
42
+ };
43
+ labelAlign?: 'left' | 'right';
44
+ colon?: boolean;
45
+ requiredMark?: boolean;
46
+ disabled?: boolean;
47
+ children?: React.ReactNode;
48
+ style?: React.CSSProperties;
49
+ className?: string;
50
+ }
51
+ export declare function Form(props: FormProps): React.JSX.Element;
52
+ export declare namespace Form {
53
+ var Item: typeof FormItem;
54
+ var useForm: any;
55
+ var List: any;
56
+ var Provider: any;
57
+ var useWatch: any;
58
+ }
59
+ export interface FormItemProps {
60
+ name?: string | string[];
61
+ label?: React.ReactNode;
62
+ rules?: any[];
63
+ required?: boolean;
64
+ valuePropName?: string;
65
+ initialValue?: any;
66
+ dependencies?: string[];
67
+ labelCol?: {
68
+ span?: number;
69
+ };
70
+ wrapperCol?: {
71
+ span?: number;
72
+ };
73
+ colon?: boolean;
74
+ tooltip?: React.ReactNode;
75
+ style?: React.CSSProperties;
76
+ className?: string;
77
+ children?: React.ReactNode;
78
+ }
79
+ export declare function FormItem(props: FormItemProps): React.JSX.Element;