@vavt/react-ui 1.2.3 → 1.3.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/README.md +1 -1
- package/dist/Announcement-BUvNHscy.cjs +1 -0
- package/dist/Announcement-CznCpx2T.js +174 -0
- package/dist/Badge-BkqoSV-F.cjs +1 -0
- package/dist/Badge-FzXPw1qS.js +72 -0
- package/dist/{Cron-C3yEuafY.js → Cron-C3S1XI-J.js} +18 -18
- package/dist/{Cron-DyBHGiUj.cjs → Cron-CIZ9GKm0.cjs} +1 -1
- package/dist/{DatePicker-3DRaRPjg.cjs → DatePicker-B5uYQlzy.cjs} +1 -1
- package/dist/{DatePicker-IFns1yBl.js → DatePicker-DhRxFPCj.js} +1 -1
- package/dist/{DateTimePicker-DnXBZTg0.js → DateTimePicker-BjDD15Av.js} +1 -1
- package/dist/{DateTimePicker-Bml1FgyN.cjs → DateTimePicker-Bve5qoeh.cjs} +1 -1
- package/dist/Drawer-DNZCj--j.js +113 -0
- package/dist/{Drawer-NyC3NpBR.cjs → Drawer-YWO6-KLG.cjs} +1 -1
- package/dist/{Dropdown-CI_C-qdP.js → Dropdown-BcT4uaQT.js} +13 -13
- package/dist/Dropdown-CPW-aSTx.cjs +1 -0
- package/dist/Form-LuUPwJc2.cjs +1 -0
- package/dist/Form-rXq9r3N-.js +442 -0
- package/dist/{Loading-CL0wUgYK.js → Loading-BAKnIASq.js} +4 -4
- package/dist/{Loading-C2pY-4fA.cjs → Loading-BSqhKOle.cjs} +1 -1
- package/dist/{MessageBox-BeEgyiwR.js → MessageBox-C35_ifsL.js} +1 -1
- package/dist/{MessageBox-70-7jPWP.cjs → MessageBox-C6NLihE1.cjs} +1 -1
- package/dist/{Modal-DWKzYEN8.js → Modal-6kNs-9QU.js} +7 -7
- package/dist/{Modal-BYKseLTT.cjs → Modal-BKvRyCXZ.cjs} +1 -1
- package/dist/{Pagination-Bi6z9CZE.cjs → Pagination-BRxRbWlU.cjs} +1 -1
- package/dist/{Pagination-CXJBTKHs.js → Pagination-DTRhw83o.js} +1 -1
- package/dist/Select-B9umyfKd.cjs +1 -0
- package/dist/{Select-DaIhlOMK.js → Select-DDsgKaDL.js} +13 -13
- package/dist/{Table-DVb-ByCJ.cjs → Table-B1BEfBJC.cjs} +1 -1
- package/dist/{Table-8KkwnZom.js → Table-DdWKhZAZ.js} +1 -1
- package/dist/{TimePicker-TtKzEbBJ.js → TimePicker-77L1Vyxn.js} +12 -12
- package/dist/{TimePicker-CZAlhs_F.cjs → TimePicker-CsaiM5CQ.cjs} +1 -1
- package/dist/{Tooltip-BtUDTfMB.js → Tooltip-DH3oc4Wa.js} +18 -18
- package/dist/{Tooltip-C4CuAEie.cjs → Tooltip-DP2yxQpo.cjs} +1 -1
- package/dist/base.css +1 -1
- package/dist/cjs/Announcement.cjs +1 -1
- package/dist/cjs/Badge.cjs +1 -0
- package/dist/cjs/Cron.cjs +1 -1
- package/dist/cjs/DatePicker.cjs +1 -1
- package/dist/cjs/DateTimePicker.cjs +1 -1
- package/dist/cjs/Drawer.cjs +1 -1
- package/dist/cjs/Dropdown.cjs +1 -1
- package/dist/cjs/Form.cjs +1 -1
- package/dist/cjs/Loading.cjs +1 -1
- package/dist/cjs/MessageBox.cjs +1 -1
- package/dist/cjs/Modal.cjs +1 -1
- package/dist/cjs/Pagination.cjs +1 -1
- package/dist/cjs/Select.cjs +1 -1
- package/dist/cjs/Table.cjs +1 -1
- package/dist/cjs/TimePicker.cjs +1 -1
- package/dist/cjs/Tooltip.cjs +1 -1
- package/dist/cjs/global.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/register.cjs +1 -1
- package/dist/css/Announcement.css +1 -1
- package/dist/css/Badge.css +1 -0
- package/dist/css/Form.css +1 -1
- package/dist/date-picker-CIAVlMqv.cjs +1 -0
- package/dist/{date-picker-tq5q60JP.js → date-picker-Co0ySn01.js} +14 -14
- package/dist/es/Announcement.mjs +1 -1
- package/dist/es/Badge.mjs +3 -0
- package/dist/es/Cron.mjs +1 -1
- package/dist/es/DatePicker.mjs +1 -1
- package/dist/es/DateTimePicker.mjs +1 -1
- package/dist/es/Drawer.mjs +1 -1
- package/dist/es/Dropdown.mjs +1 -1
- package/dist/es/Form.mjs +1 -1
- package/dist/es/Loading.mjs +1 -1
- package/dist/es/MessageBox.mjs +1 -1
- package/dist/es/Modal.mjs +1 -1
- package/dist/es/Pagination.mjs +1 -1
- package/dist/es/Select.mjs +1 -1
- package/dist/es/Table.mjs +1 -1
- package/dist/es/TimePicker.mjs +1 -1
- package/dist/es/Tooltip.mjs +1 -1
- package/dist/es/global.mjs +1 -1
- package/dist/es/index.mjs +41 -40
- package/dist/es/register.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/registry-Chcx2tDO.cjs +1 -0
- package/dist/registry-DbMCy1-n.js +87 -0
- package/dist/style/Badge.cjs +8 -0
- package/dist/style/Badge.mjs +8 -0
- package/dist/types/Announcement/type.d.cts +2 -2
- package/dist/types/Announcement/type.d.ts +2 -2
- package/dist/types/Badge/Badge.d.cts +3 -0
- package/dist/types/Badge/Badge.d.ts +3 -0
- package/dist/types/Badge/index.d.cts +5 -0
- package/dist/types/Badge/index.d.ts +5 -0
- package/dist/types/Badge/type.d.cts +31 -0
- package/dist/types/Badge/type.d.ts +31 -0
- package/dist/types/Form/FormItem.d.cts +1 -1
- package/dist/types/Form/FormItem.d.ts +1 -1
- package/dist/types/Form/context.d.cts +4 -2
- package/dist/types/Form/context.d.ts +4 -2
- package/dist/types/Form/index.d.cts +2 -2
- package/dist/types/Form/index.d.ts +2 -2
- package/dist/types/global.d.cts +2 -0
- package/dist/types/global.d.ts +2 -0
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/registry.d.cts +2 -1
- package/dist/types/registry.d.ts +2 -1
- package/package.json +1 -1
- package/dist/Announcement-D0hZE2sM.cjs +0 -1
- package/dist/Announcement-DzzaTvcO.js +0 -212
- package/dist/Drawer-B4vSd2iq.js +0 -113
- package/dist/Dropdown-DPY4QNdT.cjs +0 -1
- package/dist/Form-BMXJJ8bX.cjs +0 -1
- package/dist/Form-BvCSJ23z.js +0 -449
- package/dist/Select-YUrncvbr.cjs +0 -1
- package/dist/date-picker-Yq0xV3y8.cjs +0 -1
- package/dist/registry-BmoI_ib1.js +0 -85
- package/dist/registry-DtJjJt6v.cjs +0 -1
- package/dist/types/Announcement/host.d.cts +0 -12
- package/dist/types/Announcement/host.d.ts +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./Alert-tPSJmCXK.cjs"),t=require("./Anchor-CmuV1Ump.cjs"),n=require("./Announcement-BUvNHscy.cjs"),r=require("./Transition-X_89ga-e.cjs"),i=require("./Badge-BkqoSV-F.cjs"),a=require("./Button-qURrKHQ0.cjs"),o=require("./Card-BkZhLXQ5.cjs"),s=require("./Checkbox-CzNGP2tH.cjs"),c=require("./Col-qcq7T83y.cjs"),l=require("./Input-C9ESmbJ7.cjs"),u=require("./Tabs-BZ0Zc0bL.cjs"),d=require("./NumberInput-Dp1vTDkW.cjs"),f=require("./Cron-CIZ9GKm0.cjs"),p=require("./Dropdown-CPW-aSTx.cjs"),m=require("./DatePicker-B5uYQlzy.cjs"),h=require("./DateTimePicker-Bve5qoeh.cjs"),g=require("./Divider-BnmUNmy2.cjs"),_=require("./Drawer-YWO6-KLG.cjs"),v=require("./Empty-Dny96c3p.cjs"),y=require("./Form-LuUPwJc2.cjs"),b=require("./Tooltip-DP2yxQpo.cjs"),x=require("./Loading-BSqhKOle.cjs"),S=require("./Scrollbar-CEQT6Ao_.cjs"),C=require("./Modal-BKvRyCXZ.cjs"),w=require("./MessageBox-C6NLihE1.cjs"),T=require("./Notification-D6m4qHKz.cjs"),E=require("./Select-B9umyfKd.cjs"),D=require("./Pagination-BRxRbWlU.cjs"),O=require("./Progress-DTAjlgwZ.cjs"),k=require("./cjs/Radio.cjs"),A=require("./cjs/Row.cjs"),j=require("./Sidebar-BPXVnP7y.cjs"),M=require("./Slider-CU9OS2HB.cjs"),N=require("./Space-DJGRG2rt.cjs"),P=require("./Switch-CpXDMcPW.cjs"),F=require("./Table-B1BEfBJC.cjs"),I=require("./Tag-4iZGcfrg.cjs"),L=require("./Textarea-CEhAvE10.cjs"),R=require("./Timeline-ROggEQnD.cjs"),z=require("./TimePicker-CsaiM5CQ.cjs"),B=require("./Upload-wHEEoe1c.cjs");var V={VlAlert:e.n,VlAnchor:t.n,VlAnnouncement:n.n,VlBadge:i.n,VlButton:a.n,VlCard:o.n,VlCheckbox:s.n,VlCol:c.n,VlCron:f.n,VlDatePicker:m.n,VlDateTimePicker:h.n,VlDivider:g.n,VlDrawer:_.n,VlDropdown:p.n,VlEmpty:v.n,VlForm:y.t,VlInput:l.n,VlLoading:x.n,VlMessageBox:w.t,VlModal:C.n,VlNotification:T.t,VlNumberInput:d.n,VlPagination:D.n,VlProgress:O.n,VlRadio:k.VlRadio,VlRow:A.VlRow,VlScrollbar:S.n,VlSelect:E.n,VlSidebar:j.n,VlSlider:M.n,VlSpace:N.n,VlSwitch:P.n,VlTable:F.n,VlTabs:u.n,VlTag:I.n,VlTextarea:L.n,VlTimeline:R.n,VlTimePicker:z.n,VlTooltip:b.n,VlTransition:r.n,VlUpload:B.n},H=(e=globalThis)=>(Object.assign(e,V),V);Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return V}});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { n as e } from "./Alert-BGyLKuv0.js";
|
|
2
|
+
import { n as t } from "./Anchor-CAZPkv56.js";
|
|
3
|
+
import { n } from "./Announcement-CznCpx2T.js";
|
|
4
|
+
import { n as r } from "./Transition-DiO4GsP3.js";
|
|
5
|
+
import { n as i } from "./Badge-FzXPw1qS.js";
|
|
6
|
+
import { n as a } from "./Button-CwkWSWau.js";
|
|
7
|
+
import { n as o } from "./Card-DCLfLn1x.js";
|
|
8
|
+
import { n as s } from "./Checkbox-bHOjYdMp.js";
|
|
9
|
+
import { n as c } from "./Col-CZjR94ac.js";
|
|
10
|
+
import { n as l } from "./Input-BRy5Xuwy.js";
|
|
11
|
+
import { n as u } from "./Tabs-HWLkyrQR.js";
|
|
12
|
+
import { n as d } from "./NumberInput-CB-nKZgs.js";
|
|
13
|
+
import { n as f } from "./Cron-C3S1XI-J.js";
|
|
14
|
+
import { n as p } from "./Dropdown-BcT4uaQT.js";
|
|
15
|
+
import { n as m } from "./DatePicker-DhRxFPCj.js";
|
|
16
|
+
import { n as h } from "./DateTimePicker-BjDD15Av.js";
|
|
17
|
+
import { n as g } from "./Divider-BXNZyvHY.js";
|
|
18
|
+
import { n as _ } from "./Drawer-DNZCj--j.js";
|
|
19
|
+
import { n as v } from "./Empty-MmxZitR8.js";
|
|
20
|
+
import { t as y } from "./Form-rXq9r3N-.js";
|
|
21
|
+
import { n as b } from "./Tooltip-DH3oc4Wa.js";
|
|
22
|
+
import { n as x } from "./Loading-BAKnIASq.js";
|
|
23
|
+
import { n as S } from "./Scrollbar-BdMGZrYi.js";
|
|
24
|
+
import { n as C } from "./Modal-6kNs-9QU.js";
|
|
25
|
+
import { t as w } from "./MessageBox-C35_ifsL.js";
|
|
26
|
+
import { t as T } from "./Notification-CJraaZIi.js";
|
|
27
|
+
import { n as E } from "./Select-DDsgKaDL.js";
|
|
28
|
+
import { n as D } from "./Pagination-DTRhw83o.js";
|
|
29
|
+
import { n as O } from "./Progress-D2C6LCml.js";
|
|
30
|
+
import { VlRadio as k } from "./es/Radio.mjs";
|
|
31
|
+
import { VlRow as A } from "./es/Row.mjs";
|
|
32
|
+
import { n as j } from "./Sidebar-u980T-QB.js";
|
|
33
|
+
import { n as M } from "./Slider-CKU03SsT.js";
|
|
34
|
+
import { n as N } from "./Space-gnVH7rEt.js";
|
|
35
|
+
import { n as P } from "./Switch-CqTFvp-k.js";
|
|
36
|
+
import { n as F } from "./Table-DdWKhZAZ.js";
|
|
37
|
+
import { n as I } from "./Tag-TeYTDdHt.js";
|
|
38
|
+
import { n as L } from "./Textarea-CA6Vzu7t.js";
|
|
39
|
+
import { n as R } from "./Timeline-euWvUS4e.js";
|
|
40
|
+
import { n as z } from "./TimePicker-77L1Vyxn.js";
|
|
41
|
+
import { n as B } from "./Upload-DZ6VaM7r.js";
|
|
42
|
+
//#region components/registry.ts
|
|
43
|
+
var V = {
|
|
44
|
+
VlAlert: e,
|
|
45
|
+
VlAnchor: t,
|
|
46
|
+
VlAnnouncement: n,
|
|
47
|
+
VlBadge: i,
|
|
48
|
+
VlButton: a,
|
|
49
|
+
VlCard: o,
|
|
50
|
+
VlCheckbox: s,
|
|
51
|
+
VlCol: c,
|
|
52
|
+
VlCron: f,
|
|
53
|
+
VlDatePicker: m,
|
|
54
|
+
VlDateTimePicker: h,
|
|
55
|
+
VlDivider: g,
|
|
56
|
+
VlDrawer: _,
|
|
57
|
+
VlDropdown: p,
|
|
58
|
+
VlEmpty: v,
|
|
59
|
+
VlForm: y,
|
|
60
|
+
VlInput: l,
|
|
61
|
+
VlLoading: x,
|
|
62
|
+
VlMessageBox: w,
|
|
63
|
+
VlModal: C,
|
|
64
|
+
VlNotification: T,
|
|
65
|
+
VlNumberInput: d,
|
|
66
|
+
VlPagination: D,
|
|
67
|
+
VlProgress: O,
|
|
68
|
+
VlRadio: k,
|
|
69
|
+
VlRow: A,
|
|
70
|
+
VlScrollbar: S,
|
|
71
|
+
VlSelect: E,
|
|
72
|
+
VlSidebar: j,
|
|
73
|
+
VlSlider: M,
|
|
74
|
+
VlSpace: N,
|
|
75
|
+
VlSwitch: P,
|
|
76
|
+
VlTable: F,
|
|
77
|
+
VlTabs: u,
|
|
78
|
+
VlTag: I,
|
|
79
|
+
VlTextarea: L,
|
|
80
|
+
VlTimeline: R,
|
|
81
|
+
VlTimePicker: z,
|
|
82
|
+
VlTooltip: b,
|
|
83
|
+
VlTransition: r,
|
|
84
|
+
VlUpload: B
|
|
85
|
+
}, H = (e = globalThis) => (Object.assign(e, V), V);
|
|
86
|
+
//#endregion
|
|
87
|
+
export { H as n, V as t };
|
|
@@ -36,13 +36,13 @@ export interface AnnouncementProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
36
36
|
defaultOpen?: boolean;
|
|
37
37
|
/** 是否开启多条轮播自动播放,默认为 true */
|
|
38
38
|
autoPlay?: boolean;
|
|
39
|
-
/** 轮播切换时间间隔(毫秒),默认为
|
|
39
|
+
/** 轮播切换时间间隔(毫秒),默认为 5000 */
|
|
40
40
|
interval?: number;
|
|
41
41
|
/** 鼠标悬停在公告上时是否暂停轮播,默认为 true */
|
|
42
42
|
pauseOnHover?: boolean;
|
|
43
43
|
/** 焦点进入公告内部元素时是否暂停轮播,默认为 true */
|
|
44
44
|
pauseOnFocus?: boolean;
|
|
45
|
-
/**
|
|
45
|
+
/** 轻量语义提示,仅影响图标与文字强调色,不代表 Alert 阻断状态 */
|
|
46
46
|
status?: AnnouncementStatus;
|
|
47
47
|
/** 兼容扩展:传入 null 可隐藏默认公告图标 */
|
|
48
48
|
icon?: DecorativeIcon | null;
|
|
@@ -36,13 +36,13 @@ export interface AnnouncementProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
36
36
|
defaultOpen?: boolean;
|
|
37
37
|
/** 是否开启多条轮播自动播放,默认为 true */
|
|
38
38
|
autoPlay?: boolean;
|
|
39
|
-
/** 轮播切换时间间隔(毫秒),默认为
|
|
39
|
+
/** 轮播切换时间间隔(毫秒),默认为 5000 */
|
|
40
40
|
interval?: number;
|
|
41
41
|
/** 鼠标悬停在公告上时是否暂停轮播,默认为 true */
|
|
42
42
|
pauseOnHover?: boolean;
|
|
43
43
|
/** 焦点进入公告内部元素时是否暂停轮播,默认为 true */
|
|
44
44
|
pauseOnFocus?: boolean;
|
|
45
|
-
/**
|
|
45
|
+
/** 轻量语义提示,仅影响图标与文字强调色,不代表 Alert 阻断状态 */
|
|
46
46
|
status?: AnnouncementStatus;
|
|
47
47
|
/** 兼容扩展:传入 null 可隐藏默认公告图标 */
|
|
48
48
|
icon?: DecorativeIcon | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Badge from './Badge.cjs';
|
|
2
|
+
/** Badge 徽章组件。 */
|
|
3
|
+
export declare const VlBadge: import("react").ForwardRefExoticComponent<import("./type.cjs").BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
4
|
+
export type { BadgeProps, BadgeRef, BadgeStatus, BadgeSize } from './type.cjs';
|
|
5
|
+
export default Badge;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Badge from './Badge.js';
|
|
2
|
+
/** Badge 徽章组件。 */
|
|
3
|
+
export declare const VlBadge: import("react").ForwardRefExoticComponent<import("./type.js").BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
4
|
+
export type { BadgeProps, BadgeRef, BadgeStatus, BadgeSize } from './type.js';
|
|
5
|
+
export default Badge;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/** 徽章语义颜色,与 Tag、Progress 共用状态命名。 */
|
|
3
|
+
export type BadgeStatus = 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info';
|
|
4
|
+
/** 徽章尺寸:小 | 中等 | 大。 */
|
|
5
|
+
export type BadgeSize = 'sm' | 'md' | 'lg';
|
|
6
|
+
/** Badge 始终转发到根 span,显隐不会替换根节点或被包裹的内容。 */
|
|
7
|
+
export type BadgeRef = HTMLSpanElement;
|
|
8
|
+
/**
|
|
9
|
+
* 徽章由外部属性控制,不维护计数或显示状态。
|
|
10
|
+
* children 是被标记的内容;省略 children 时,标记和 text 在普通流中独立展示。
|
|
11
|
+
*/
|
|
12
|
+
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
13
|
+
/** 数字计数或短文字;数字 0 默认隐藏,字符串不会转换为数字。 */
|
|
14
|
+
count?: number | string;
|
|
15
|
+
/** 数字显示上限,默认 99;超出时显示 max+,无效值回退为 99。 */
|
|
16
|
+
max?: number;
|
|
17
|
+
/** 是否显示数字 0,默认 false。 */
|
|
18
|
+
showZero?: boolean;
|
|
19
|
+
/** 是否用圆点替代计数,默认 false;优先于 count。 */
|
|
20
|
+
dot?: boolean;
|
|
21
|
+
/** 是否显示徽章,默认 true;不会隐藏或卸载 children。 */
|
|
22
|
+
show?: boolean;
|
|
23
|
+
/** 语义颜色;计数和普通圆点默认 error,状态模式默认 default。 */
|
|
24
|
+
status?: BadgeStatus;
|
|
25
|
+
/** 独立展示时位于标记右侧的说明;附着模式不展示该文字。 */
|
|
26
|
+
text?: ReactNode;
|
|
27
|
+
/** 尺寸档位,默认 md。 */
|
|
28
|
+
size?: BadgeSize;
|
|
29
|
+
/** 附着模式下的像素偏移 [x, y],正值向右、向下;默认 [0, 0]。 */
|
|
30
|
+
offset?: [number, number];
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/** 徽章语义颜色,与 Tag、Progress 共用状态命名。 */
|
|
3
|
+
export type BadgeStatus = 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info';
|
|
4
|
+
/** 徽章尺寸:小 | 中等 | 大。 */
|
|
5
|
+
export type BadgeSize = 'sm' | 'md' | 'lg';
|
|
6
|
+
/** Badge 始终转发到根 span,显隐不会替换根节点或被包裹的内容。 */
|
|
7
|
+
export type BadgeRef = HTMLSpanElement;
|
|
8
|
+
/**
|
|
9
|
+
* 徽章由外部属性控制,不维护计数或显示状态。
|
|
10
|
+
* children 是被标记的内容;省略 children 时,标记和 text 在普通流中独立展示。
|
|
11
|
+
*/
|
|
12
|
+
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
13
|
+
/** 数字计数或短文字;数字 0 默认隐藏,字符串不会转换为数字。 */
|
|
14
|
+
count?: number | string;
|
|
15
|
+
/** 数字显示上限,默认 99;超出时显示 max+,无效值回退为 99。 */
|
|
16
|
+
max?: number;
|
|
17
|
+
/** 是否显示数字 0,默认 false。 */
|
|
18
|
+
showZero?: boolean;
|
|
19
|
+
/** 是否用圆点替代计数,默认 false;优先于 count。 */
|
|
20
|
+
dot?: boolean;
|
|
21
|
+
/** 是否显示徽章,默认 true;不会隐藏或卸载 children。 */
|
|
22
|
+
show?: boolean;
|
|
23
|
+
/** 语义颜色;计数和普通圆点默认 error,状态模式默认 default。 */
|
|
24
|
+
status?: BadgeStatus;
|
|
25
|
+
/** 独立展示时位于标记右侧的说明;附着模式不展示该文字。 */
|
|
26
|
+
text?: ReactNode;
|
|
27
|
+
/** 尺寸档位,默认 md。 */
|
|
28
|
+
size?: BadgeSize;
|
|
29
|
+
/** 附着模式下的像素偏移 [x, y],正值向右、向下;默认 [0, 0]。 */
|
|
30
|
+
offset?: [number, number];
|
|
31
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FormItemProps } from './type.cjs';
|
|
2
|
-
declare const FormItem: import("react").
|
|
2
|
+
declare const FormItem: import("react").ForwardRefExoticComponent<FormItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
3
|
export default FormItem;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FormItemProps } from './type.js';
|
|
2
|
-
declare const FormItem: import("react").
|
|
2
|
+
declare const FormItem: import("react").ForwardRefExoticComponent<FormItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
3
|
export default FormItem;
|
|
@@ -59,12 +59,14 @@ export interface FormContextValue {
|
|
|
59
59
|
}
|
|
60
60
|
export declare const FormActionProvider: import("react").Provider<FormActionContextValue | null>;
|
|
61
61
|
export declare const useFormActionContext: () => FormActionContextValue | null;
|
|
62
|
+
export declare const FormControlledValuesProvider: import("react").Provider<FormValues | null>;
|
|
63
|
+
export declare const useFormControlledValues: () => FormValues | null;
|
|
62
64
|
export declare const FormProvider: import("react").Provider<FormContextValue | null>;
|
|
63
65
|
export declare const useFormContext: () => FormContextValue | null;
|
|
64
66
|
/**
|
|
65
67
|
* 精确订阅单个字段状态的 Hook。
|
|
66
68
|
*
|
|
67
|
-
* 基于 useSyncExternalStore
|
|
68
|
-
*
|
|
69
|
+
* 基于 useSyncExternalStore 实现:非受控 value、errors、isValidating 变化时才产生新快照。
|
|
70
|
+
* 受控值由 FormItem 的渲染上下文直接传入,不再等待提交后的订阅通知。
|
|
69
71
|
*/
|
|
70
72
|
export declare const useFormField: (name: string | undefined) => FormFieldState;
|
|
@@ -59,12 +59,14 @@ export interface FormContextValue {
|
|
|
59
59
|
}
|
|
60
60
|
export declare const FormActionProvider: import("react").Provider<FormActionContextValue | null>;
|
|
61
61
|
export declare const useFormActionContext: () => FormActionContextValue | null;
|
|
62
|
+
export declare const FormControlledValuesProvider: import("react").Provider<FormValues | null>;
|
|
63
|
+
export declare const useFormControlledValues: () => FormValues | null;
|
|
62
64
|
export declare const FormProvider: import("react").Provider<FormContextValue | null>;
|
|
63
65
|
export declare const useFormContext: () => FormContextValue | null;
|
|
64
66
|
/**
|
|
65
67
|
* 精确订阅单个字段状态的 Hook。
|
|
66
68
|
*
|
|
67
|
-
* 基于 useSyncExternalStore
|
|
68
|
-
*
|
|
69
|
+
* 基于 useSyncExternalStore 实现:非受控 value、errors、isValidating 变化时才产生新快照。
|
|
70
|
+
* 受控值由 FormItem 的渲染上下文直接传入,不再等待提交后的订阅通知。
|
|
69
71
|
*/
|
|
70
72
|
export declare const useFormField: (name: string | undefined) => FormFieldState;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Form 表单组件(含 Form.Item 静态挂载) */
|
|
2
2
|
export declare const VlForm: import("./type.cjs").FormComponent & {
|
|
3
|
-
Item: import("react").
|
|
3
|
+
Item: import("react").ForwardRefExoticComponent<import("./type.cjs").FormItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
4
|
};
|
|
5
5
|
/** FormItem 表单项组件 */
|
|
6
|
-
export declare const VlFormItem: import("react").
|
|
6
|
+
export declare const VlFormItem: import("react").ForwardRefExoticComponent<import("./type.cjs").FormItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
7
|
export type { FormComponent, FormErrors, FormItemProps, FormLayout, FormProps, FormRef, FormRule, FormRuleType, FormValidateTrigger, FormValidationResult, FormValues } from './type.cjs';
|
|
8
8
|
export default VlForm;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Form 表单组件(含 Form.Item 静态挂载) */
|
|
2
2
|
export declare const VlForm: import("./type.js").FormComponent & {
|
|
3
|
-
Item: import("react").
|
|
3
|
+
Item: import("react").ForwardRefExoticComponent<import("./type.js").FormItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
4
|
};
|
|
5
5
|
/** FormItem 表单项组件 */
|
|
6
|
-
export declare const VlFormItem: import("react").
|
|
6
|
+
export declare const VlFormItem: import("react").ForwardRefExoticComponent<import("./type.js").FormItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
7
|
export type { FormComponent, FormErrors, FormItemProps, FormLayout, FormProps, FormRef, FormRule, FormRuleType, FormValidateTrigger, FormValidationResult, FormValues } from './type.js';
|
|
8
8
|
export default VlForm;
|
package/dist/types/global.d.cts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type { VlAlert as VlAlertComponent } from './Alert/index.cjs';
|
|
6
6
|
import type { VlAnchor as VlAnchorComponent } from './Anchor/index.cjs';
|
|
7
7
|
import type { VlAnnouncement as VlAnnouncementComponent } from './Announcement/index.cjs';
|
|
8
|
+
import type { VlBadge as VlBadgeComponent } from './Badge/index.cjs';
|
|
8
9
|
import type { VlButton as VlButtonComponent } from './Button/index.cjs';
|
|
9
10
|
import type { VlCard as VlCardComponent } from './Card/index.cjs';
|
|
10
11
|
import type { VlCheckbox as VlCheckboxComponent } from './Checkbox/index.cjs';
|
|
@@ -52,6 +53,7 @@ declare global {
|
|
|
52
53
|
const VlAlert: typeof VlAlertComponent;
|
|
53
54
|
const VlAnchor: typeof VlAnchorComponent;
|
|
54
55
|
const VlAnnouncement: typeof VlAnnouncementComponent;
|
|
56
|
+
const VlBadge: typeof VlBadgeComponent;
|
|
55
57
|
const VlButton: typeof VlButtonComponent;
|
|
56
58
|
const VlCard: typeof VlCardComponent;
|
|
57
59
|
const VlCheckbox: typeof VlCheckboxComponent;
|
package/dist/types/global.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type { VlAlert as VlAlertComponent } from './Alert/index.js';
|
|
6
6
|
import type { VlAnchor as VlAnchorComponent } from './Anchor/index.js';
|
|
7
7
|
import type { VlAnnouncement as VlAnnouncementComponent } from './Announcement/index.js';
|
|
8
|
+
import type { VlBadge as VlBadgeComponent } from './Badge/index.js';
|
|
8
9
|
import type { VlButton as VlButtonComponent } from './Button/index.js';
|
|
9
10
|
import type { VlCard as VlCardComponent } from './Card/index.js';
|
|
10
11
|
import type { VlCheckbox as VlCheckboxComponent } from './Checkbox/index.js';
|
|
@@ -52,6 +53,7 @@ declare global {
|
|
|
52
53
|
const VlAlert: typeof VlAlertComponent;
|
|
53
54
|
const VlAnchor: typeof VlAnchorComponent;
|
|
54
55
|
const VlAnnouncement: typeof VlAnnouncementComponent;
|
|
56
|
+
const VlBadge: typeof VlBadgeComponent;
|
|
55
57
|
const VlButton: typeof VlButtonComponent;
|
|
56
58
|
const VlCard: typeof VlCardComponent;
|
|
57
59
|
const VlCheckbox: typeof VlCheckboxComponent;
|
package/dist/types/index.d.cts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './registry.cjs';
|
|
|
6
6
|
export * from './Alert/index.cjs';
|
|
7
7
|
export * from './Anchor/index.cjs';
|
|
8
8
|
export * from './Announcement/index.cjs';
|
|
9
|
+
export * from './Badge/index.cjs';
|
|
9
10
|
export * from './Button/index.cjs';
|
|
10
11
|
export * from './Card/index.cjs';
|
|
11
12
|
export * from './Checkbox/index.cjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './registry.js';
|
|
|
6
6
|
export * from './Alert/index.js';
|
|
7
7
|
export * from './Anchor/index.js';
|
|
8
8
|
export * from './Announcement/index.js';
|
|
9
|
+
export * from './Badge/index.js';
|
|
9
10
|
export * from './Button/index.js';
|
|
10
11
|
export * from './Card/index.js';
|
|
11
12
|
export * from './Checkbox/index.js';
|
|
@@ -12,6 +12,7 @@ export declare const globalComponents: {
|
|
|
12
12
|
readonly VlAlert: import("react").ForwardRefExoticComponent<import("./Alert/index.cjs").AlertProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
13
|
readonly VlAnchor: import("react").ForwardRefExoticComponent<import("./Anchor/index.cjs").AnchorProps & import("react").RefAttributes<import("./Anchor/index.cjs").AnchorRef>>;
|
|
14
14
|
readonly VlAnnouncement: import("react").ForwardRefExoticComponent<import("./Announcement/index.cjs").AnnouncementProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
readonly VlBadge: import("react").ForwardRefExoticComponent<import("./Badge/index.cjs").BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
15
16
|
readonly VlButton: import("react").ForwardRefExoticComponent<import("./Button/index.cjs").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
16
17
|
readonly VlCard: <T extends import("react").ElementType = "div">(props: import("./Card/index.cjs").CardProps<T> & import("react").RefAttributes<import("react").ComponentRef<T>>) => import("react").ReactElement | null;
|
|
17
18
|
readonly VlCheckbox: import("react").ForwardRefExoticComponent<import("./Checkbox/index.cjs").CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -24,7 +25,7 @@ export declare const globalComponents: {
|
|
|
24
25
|
readonly VlDropdown: import("react").ForwardRefExoticComponent<import("./Dropdown/index.cjs").DropdownProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
25
26
|
readonly VlEmpty: import("react").ForwardRefExoticComponent<import("./Empty/index.cjs").EmptyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
27
|
readonly VlForm: import("./Form/index.cjs").FormComponent & {
|
|
27
|
-
Item: import("react").
|
|
28
|
+
Item: import("react").ForwardRefExoticComponent<import("./Form/index.cjs").FormItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
29
|
};
|
|
29
30
|
readonly VlInput: import("react").ForwardRefExoticComponent<import("./Input/index.cjs").InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
30
31
|
readonly VlLoading: import("react").ForwardRefExoticComponent<import("./Loading/index.cjs").LoadingProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/types/registry.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const globalComponents: {
|
|
|
12
12
|
readonly VlAlert: import("react").ForwardRefExoticComponent<import("./Alert/index.js").AlertProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
13
|
readonly VlAnchor: import("react").ForwardRefExoticComponent<import("./Anchor/index.js").AnchorProps & import("react").RefAttributes<import("./Anchor/index.js").AnchorRef>>;
|
|
14
14
|
readonly VlAnnouncement: import("react").ForwardRefExoticComponent<import("./Announcement/index.js").AnnouncementProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
readonly VlBadge: import("react").ForwardRefExoticComponent<import("./Badge/index.js").BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
15
16
|
readonly VlButton: import("react").ForwardRefExoticComponent<import("./Button/index.js").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
16
17
|
readonly VlCard: <T extends import("react").ElementType = "div">(props: import("./Card/index.js").CardProps<T> & import("react").RefAttributes<import("react").ComponentRef<T>>) => import("react").ReactElement | null;
|
|
17
18
|
readonly VlCheckbox: import("react").ForwardRefExoticComponent<import("./Checkbox/index.js").CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -24,7 +25,7 @@ export declare const globalComponents: {
|
|
|
24
25
|
readonly VlDropdown: import("react").ForwardRefExoticComponent<import("./Dropdown/index.js").DropdownProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
25
26
|
readonly VlEmpty: import("react").ForwardRefExoticComponent<import("./Empty/index.js").EmptyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
27
|
readonly VlForm: import("./Form/index.js").FormComponent & {
|
|
27
|
-
Item: import("react").
|
|
28
|
+
Item: import("react").ForwardRefExoticComponent<import("./Form/index.js").FormItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
29
|
};
|
|
29
30
|
readonly VlInput: import("react").ForwardRefExoticComponent<import("./Input/index.js").InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
30
31
|
readonly VlLoading: import("react").ForwardRefExoticComponent<import("./Loading/index.js").LoadingProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./icon-DRLyKu8p.cjs"),t=require("./effect-BpNxm_06.cjs"),n=require("./state-BuUx1onZ.cjs"),r=require("./client-BkoqeUs3.cjs"),ee=require("./refs-DCqd87V8.cjs");let te=require("lucide-react"),i=require("react"),a=require("react/jsx-runtime"),ne=require("react-dom");var o=new Set,s=new Map,c=null,l=0,u=null,d=()=>o.forEach(e=>e()),f=()=>{let e=null,t=-1/0;return s.forEach((n,r)=>{n>=t&&(e=r,t=n)}),e},re=()=>++l,ie=(e,t=0)=>{s.delete(e),s.set(e,t);let n=c===null?-1/0:s.get(c)??-1/0;(c===null||t>=n)&&(c=e),d()},ae=e=>{s.delete(e),c===e&&(c=f(),d())},oe=e=>(0,i.useSyncExternalStore)(e=>(o.add(e),()=>o.delete(e)),()=>c===e,()=>!1),se=()=>typeof document>`u`?null:((!u||!document.body.contains(u))&&(u=document.createElement(`div`),u.className=`vl-announcement-host`,document.body.appendChild(u)),u),ce=()=>{s.size>0||!u||(u.remove(),u=null)},le=280,ue=`data-vl-announcement-global`,de=()=>{let[e,t]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener?.(`change`,n),()=>e.removeEventListener?.(`change`,n)},[]),e},p=(0,i.forwardRef)((o,s)=>{let{items:c,activeKey:l,defaultActiveKey:u,open:d,defaultOpen:f=!0,autoPlay:p=!0,interval:m=5e3,pauseOnHover:h=!0,pauseOnFocus:fe=!0,status:g=`info`,icon:_=te.Megaphone,closable:v=!1,renderItem:y,className:b,role:pe=`region`,tabIndex:me,"aria-label":he=`公告`,"aria-live":ge,onMouseEnter:_e,onMouseLeave:ve,onFocusCapture:ye,onBlurCapture:be,onActiveChange:xe,onOpenChange:Se,onClose:Ce,onItemClick:x,...S}=o,C=S[ue]===`true`,[w]=(0,i.useState)(re),T=(0,i.useRef)(null),E=(0,i.useRef)(null),we=r.t(),Te=(0,i.useMemo)(()=>ee.n(E,s),[s]),[D,Ee]=(0,i.useState)(null),[O,k]=(0,i.useState)(0),A=oe(w),j=n.t(o,`activeKey`),De=n.t(o,`open`),[M,N]=n.n({value:l,defaultValue:u??c[0]?.key,controlled:j,onChange:e=>{let t=c.findIndex(t=>t.key===e),n=c[t];n&&xe?.(n.key,n,t)}}),[P,Oe]=n.n({value:!!d,defaultValue:f,controlled:De,onChange:Se}),[ke,F]=(0,i.useState)(!1),[Ae,I]=(0,i.useState)(!1),[je,Me]=(0,i.useState)(()=>typeof document>`u`||!document.hidden),[Ne,L]=(0,i.useState)(void 0),[Pe,R]=(0,i.useState)(!1),z=(0,i.useRef)(void 0),B=(0,i.useRef)(void 0),V=(0,i.useRef)(void 0),H=de(),U=c.findIndex(e=>e.key===M),W=U>=0?U:c.length?0:-1,G=W>=0?c[W]:void 0,K=G?.key,q=c.findIndex(e=>e.key===Ne),J=q>=0?c[q]:void 0,Fe=!je||h&&ke||fe&&Ae,Y=A&&P&&p&&m>0&&c.length>1&&!Fe,Ie=(0,i.useMemo)(()=>[`vl-announcement`,`is-${g}`,b||``].filter(Boolean).join(` `),[b,g]),X=(0,i.useCallback)(e=>{N(e.key)},[N]);(0,i.useEffect)(()=>{K!==void 0&&K!==M&&X(G)},[G,M,K,X]),(0,i.useEffect)(()=>{let e=se();if(e)return Ee(e),ie(w,+!!C),()=>{ae(w),ce()}},[w,C]),(0,i.useEffect)(()=>{if(!A||!P||!E.current||!T.current){k(0);return}let e=()=>k(E.current?.getBoundingClientRect().height??0);if(e(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e);return t.observe(E.current),()=>t.disconnect()},[A,P,K,_,v,y]),(0,i.useEffect)(()=>{let e=()=>Me(!document.hidden);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,i.useEffect)(()=>{if(!Y||!G)return;let e=window.setTimeout(()=>{let e=c[(W+1)%c.length];e&&X(e)},m);return()=>window.clearTimeout(e)},[G,m,c,W,X,Y]);let Z=(0,i.useCallback)(()=>{B.current!==void 0&&window.cancelAnimationFrame(B.current),V.current!==void 0&&window.clearTimeout(V.current),B.current=void 0,V.current=void 0,R(!1),L(void 0)},[]);t.t(()=>{if(K===void 0){z.current=void 0,Z();return}let e=z.current;if(z.current=K,e===void 0||e===K||H){Z();return}if(!c.some(t=>t.key===e)){Z();return}Z(),L(e),B.current=window.requestAnimationFrame(()=>{R(!0),V.current=window.setTimeout(Z,le)})},[Z,c,H,K]),(0,i.useEffect)(()=>Z,[Z]);let Le=()=>{Oe(!1),Ce?.()},Re=e=>{I(!0),ye?.(e)},ze=e=>{e.currentTarget.contains(e.relatedTarget)||I(!1),be?.(e)},Q=(e,t)=>{let n=y?y(e,t):e.content,r=n=>{x?.(e,t,n)};if(e.href){let t=e.rel??(e.target===`_blank`?`noopener noreferrer`:void 0);return(0,a.jsx)(`a`,{className:`vl-announcement__link`,href:e.href,target:e.target,rel:t,onClick:r,children:n})}return x?(0,a.jsx)(`button`,{type:`button`,className:`vl-announcement__link`,onClick:r,children:n}):(0,a.jsx)(`span`,{className:`vl-announcement__text`,children:n})};if(!P||!G)return null;let Be=me??(p&&c.length>1?0:void 0),$=(0,a.jsxs)(`div`,{ref:Te,className:Ie,role:pe,tabIndex:Be,"aria-label":he,onMouseEnter:e=>{F(!0),_e?.(e)},onMouseLeave:e=>{F(!1),ve?.(e)},onFocusCapture:Re,onBlurCapture:ze,...S,children:[_?e.t(_,`vl-announcement__icon`):null,(0,a.jsx)(`div`,{className:`vl-announcement__viewport`,"aria-live":ge??(Y&&!j?`off`:`polite`),"aria-atomic":`true`,children:(0,a.jsxs)(`div`,{className:[`vl-announcement__track`,Pe?`is-animating`:``].filter(Boolean).join(` `),children:[J?(0,a.jsx)(`div`,{className:`vl-announcement__item is-outgoing`,"aria-hidden":`true`,children:Q(J,q)}):null,(0,a.jsx)(`div`,{className:`vl-announcement__item${J?` is-incoming`:``}`,onTransitionEnd:Z,children:Q(G,W)},`${typeof G.key}-${G.key}`)]})}),v?(0,a.jsx)(`button`,{type:`button`,className:`vl-announcement__close`,"aria-label":`关闭公告`,onClick:Le,children:(0,a.jsx)(te.X,{"aria-hidden":`true`})}):null]});return we?(0,a.jsxs)(a.Fragment,{children:[A?(0,a.jsx)(`div`,{ref:T,className:`vl-announcement-placeholder`,"aria-hidden":`true`,style:{blockSize:O?`${O}px`:void 0}}):null,A&&D?(0,ne.createPortal)($,D):null]}):$});p.displayName=`VlAnnouncement`;var m=p,h=p;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./icon-Cbvuv4yF.js";
|
|
2
|
-
import { t } from "./effect-nifYL_rH.js";
|
|
3
|
-
import { n, t as r } from "./state-BSDh-Ob2.js";
|
|
4
|
-
import { t as ee } from "./client-pj_wzx28.js";
|
|
5
|
-
import { n as te } from "./refs-D5IYOBaf.js";
|
|
6
|
-
import { Megaphone as ne, X as re } from "lucide-react";
|
|
7
|
-
import { forwardRef as i, useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l, useSyncExternalStore as u } from "react";
|
|
8
|
-
import { Fragment as ie, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
-
import { createPortal as ae } from "react-dom";
|
|
10
|
-
//#region components/Announcement/host.ts
|
|
11
|
-
var p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Map(), h = null, g = 0, _ = null, v = () => p.forEach((e) => e()), y = () => {
|
|
12
|
-
let e = null, t = -Infinity;
|
|
13
|
-
return m.forEach((n, r) => {
|
|
14
|
-
n >= t && (e = r, t = n);
|
|
15
|
-
}), e;
|
|
16
|
-
}, oe = () => ++g, se = (e, t = 0) => {
|
|
17
|
-
m.delete(e), m.set(e, t);
|
|
18
|
-
let n = h === null ? -Infinity : m.get(h) ?? -Infinity;
|
|
19
|
-
(h === null || t >= n) && (h = e), v();
|
|
20
|
-
}, ce = (e) => {
|
|
21
|
-
m.delete(e), h === e && (h = y(), v());
|
|
22
|
-
}, le = (e) => u((e) => (p.add(e), () => p.delete(e)), () => h === e, () => !1), ue = () => typeof document > "u" ? null : ((!_ || !document.body.contains(_)) && (_ = document.createElement("div"), _.className = "vl-announcement-host", document.body.appendChild(_)), _), de = () => {
|
|
23
|
-
m.size > 0 || !_ || (_.remove(), _ = null);
|
|
24
|
-
}, fe = 280, pe = "data-vl-announcement-global", me = () => {
|
|
25
|
-
let [e, t] = l(!1);
|
|
26
|
-
return o(() => {
|
|
27
|
-
let e = window.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
28
|
-
if (!e) return;
|
|
29
|
-
let n = () => t(e.matches);
|
|
30
|
-
return n(), e.addEventListener?.("change", n), () => e.removeEventListener?.("change", n);
|
|
31
|
-
}, []), e;
|
|
32
|
-
}, b = i((i, u) => {
|
|
33
|
-
let { items: p, activeKey: m, defaultActiveKey: h, open: g, defaultOpen: _ = !0, autoPlay: v = !0, interval: y = 5e3, pauseOnHover: b = !0, pauseOnFocus: x = !0, status: S = "info", icon: C = ne, closable: he = !1, renderItem: w, className: T, role: ge = "region", tabIndex: _e, "aria-label": ve = "公告", "aria-live": ye, onMouseEnter: be, onMouseLeave: xe, onFocusCapture: Se, onBlurCapture: Ce, onActiveChange: we, onOpenChange: Te, onClose: Ee, onItemClick: E, ...D } = i, O = D[pe] === "true", [k] = l(oe), A = c(null), j = c(null), De = ee(), Oe = s(() => te(j, u), [u]), [M, ke] = l(null), [Ae, je] = l(0), N = le(k), Me = r(i, "activeKey"), Ne = r(i, "open"), [P, F] = n({
|
|
34
|
-
value: m,
|
|
35
|
-
defaultValue: h ?? p[0]?.key,
|
|
36
|
-
controlled: Me,
|
|
37
|
-
onChange: (e) => {
|
|
38
|
-
let t = p.findIndex((t) => t.key === e), n = p[t];
|
|
39
|
-
n && we?.(n.key, n, t);
|
|
40
|
-
}
|
|
41
|
-
}), [I, Pe] = n({
|
|
42
|
-
value: !!g,
|
|
43
|
-
defaultValue: _,
|
|
44
|
-
controlled: Ne,
|
|
45
|
-
onChange: Te
|
|
46
|
-
}), [Fe, L] = l(!1), [Ie, R] = l(!1), [Le, Re] = l(() => typeof document > "u" || !document.hidden), [ze, z] = l(void 0), [Be, B] = l(!1), V = c(void 0), H = c(void 0), U = c(void 0), W = me(), G = p.findIndex((e) => e.key === P), K = G >= 0 ? G : p.length ? 0 : -1, q = K >= 0 ? p[K] : void 0, J = q?.key, Y = p.findIndex((e) => e.key === ze), X = Y >= 0 ? p[Y] : void 0, Ve = !Le || b && Fe || x && Ie, Z = N && I && v && y > 0 && p.length > 1 && !Ve, He = s(() => [
|
|
47
|
-
"vl-announcement",
|
|
48
|
-
`is-${S}`,
|
|
49
|
-
T || ""
|
|
50
|
-
].filter(Boolean).join(" "), [T, S]), Q = a((e) => {
|
|
51
|
-
F(e.key);
|
|
52
|
-
}, [F]);
|
|
53
|
-
o(() => {
|
|
54
|
-
J !== void 0 && J !== P && Q(q);
|
|
55
|
-
}, [
|
|
56
|
-
q,
|
|
57
|
-
P,
|
|
58
|
-
J,
|
|
59
|
-
Q
|
|
60
|
-
]), o(() => {
|
|
61
|
-
let e = ue();
|
|
62
|
-
if (e) return ke(e), se(k, +!!O), () => {
|
|
63
|
-
ce(k), de();
|
|
64
|
-
};
|
|
65
|
-
}, [k, O]), o(() => {
|
|
66
|
-
if (!N || !I || !j.current || !A.current) {
|
|
67
|
-
je(0);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
let e = () => je(j.current?.getBoundingClientRect().height ?? 0);
|
|
71
|
-
if (e(), typeof ResizeObserver > "u") return;
|
|
72
|
-
let t = new ResizeObserver(e);
|
|
73
|
-
return t.observe(j.current), () => t.disconnect();
|
|
74
|
-
}, [
|
|
75
|
-
N,
|
|
76
|
-
I,
|
|
77
|
-
J,
|
|
78
|
-
C,
|
|
79
|
-
he,
|
|
80
|
-
w
|
|
81
|
-
]), o(() => {
|
|
82
|
-
let e = () => Re(!document.hidden);
|
|
83
|
-
return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
|
|
84
|
-
}, []), o(() => {
|
|
85
|
-
if (!Z || !q) return;
|
|
86
|
-
let e = window.setTimeout(() => {
|
|
87
|
-
let e = p[(K + 1) % p.length];
|
|
88
|
-
e && Q(e);
|
|
89
|
-
}, y);
|
|
90
|
-
return () => window.clearTimeout(e);
|
|
91
|
-
}, [
|
|
92
|
-
q,
|
|
93
|
-
y,
|
|
94
|
-
p,
|
|
95
|
-
K,
|
|
96
|
-
Q,
|
|
97
|
-
Z
|
|
98
|
-
]);
|
|
99
|
-
let $ = a(() => {
|
|
100
|
-
H.current !== void 0 && window.cancelAnimationFrame(H.current), U.current !== void 0 && window.clearTimeout(U.current), H.current = void 0, U.current = void 0, B(!1), z(void 0);
|
|
101
|
-
}, []);
|
|
102
|
-
t(() => {
|
|
103
|
-
if (J === void 0) {
|
|
104
|
-
V.current = void 0, $();
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
let e = V.current;
|
|
108
|
-
if (V.current = J, e === void 0 || e === J || W) {
|
|
109
|
-
$();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (!p.some((t) => t.key === e)) {
|
|
113
|
-
$();
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
$(), z(e), H.current = window.requestAnimationFrame(() => {
|
|
117
|
-
B(!0), U.current = window.setTimeout($, fe);
|
|
118
|
-
});
|
|
119
|
-
}, [
|
|
120
|
-
$,
|
|
121
|
-
p,
|
|
122
|
-
W,
|
|
123
|
-
J
|
|
124
|
-
]), o(() => $, [$]);
|
|
125
|
-
let Ue = () => {
|
|
126
|
-
Pe(!1), Ee?.();
|
|
127
|
-
}, We = (e) => {
|
|
128
|
-
R(!0), Se?.(e);
|
|
129
|
-
}, Ge = (e) => {
|
|
130
|
-
e.currentTarget.contains(e.relatedTarget) || R(!1), Ce?.(e);
|
|
131
|
-
}, Ke = (e, t) => {
|
|
132
|
-
let n = w ? w(e, t) : e.content, r = (n) => {
|
|
133
|
-
E?.(e, t, n);
|
|
134
|
-
};
|
|
135
|
-
if (e.href) {
|
|
136
|
-
let t = e.rel ?? (e.target === "_blank" ? "noopener noreferrer" : void 0);
|
|
137
|
-
return /* @__PURE__ */ d("a", {
|
|
138
|
-
className: "vl-announcement__link",
|
|
139
|
-
href: e.href,
|
|
140
|
-
target: e.target,
|
|
141
|
-
rel: t,
|
|
142
|
-
onClick: r,
|
|
143
|
-
children: n
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
return E ? /* @__PURE__ */ d("button", {
|
|
147
|
-
type: "button",
|
|
148
|
-
className: "vl-announcement__link",
|
|
149
|
-
onClick: r,
|
|
150
|
-
children: n
|
|
151
|
-
}) : /* @__PURE__ */ d("span", {
|
|
152
|
-
className: "vl-announcement__text",
|
|
153
|
-
children: n
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
if (!I || !q) return null;
|
|
157
|
-
let qe = _e ?? (v && p.length > 1 ? 0 : void 0), Je = /* @__PURE__ */ f("div", {
|
|
158
|
-
ref: Oe,
|
|
159
|
-
className: He,
|
|
160
|
-
role: ge,
|
|
161
|
-
tabIndex: qe,
|
|
162
|
-
"aria-label": ve,
|
|
163
|
-
onMouseEnter: (e) => {
|
|
164
|
-
L(!0), be?.(e);
|
|
165
|
-
},
|
|
166
|
-
onMouseLeave: (e) => {
|
|
167
|
-
L(!1), xe?.(e);
|
|
168
|
-
},
|
|
169
|
-
onFocusCapture: We,
|
|
170
|
-
onBlurCapture: Ge,
|
|
171
|
-
...D,
|
|
172
|
-
children: [
|
|
173
|
-
C ? e(C, "vl-announcement__icon") : null,
|
|
174
|
-
/* @__PURE__ */ d("div", {
|
|
175
|
-
className: "vl-announcement__viewport",
|
|
176
|
-
"aria-live": ye ?? (Z && !Me ? "off" : "polite"),
|
|
177
|
-
"aria-atomic": "true",
|
|
178
|
-
children: /* @__PURE__ */ f("div", {
|
|
179
|
-
className: ["vl-announcement__track", Be ? "is-animating" : ""].filter(Boolean).join(" "),
|
|
180
|
-
children: [X ? /* @__PURE__ */ d("div", {
|
|
181
|
-
className: "vl-announcement__item is-outgoing",
|
|
182
|
-
"aria-hidden": "true",
|
|
183
|
-
children: Ke(X, Y)
|
|
184
|
-
}) : null, /* @__PURE__ */ d("div", {
|
|
185
|
-
className: `vl-announcement__item${X ? " is-incoming" : ""}`,
|
|
186
|
-
onTransitionEnd: $,
|
|
187
|
-
children: Ke(q, K)
|
|
188
|
-
}, `${typeof q.key}-${q.key}`)]
|
|
189
|
-
})
|
|
190
|
-
}),
|
|
191
|
-
he ? /* @__PURE__ */ d("button", {
|
|
192
|
-
type: "button",
|
|
193
|
-
className: "vl-announcement__close",
|
|
194
|
-
"aria-label": "关闭公告",
|
|
195
|
-
onClick: Ue,
|
|
196
|
-
children: /* @__PURE__ */ d(re, { "aria-hidden": "true" })
|
|
197
|
-
}) : null
|
|
198
|
-
]
|
|
199
|
-
});
|
|
200
|
-
return De ? /* @__PURE__ */ f(ie, { children: [N ? /* @__PURE__ */ d("div", {
|
|
201
|
-
ref: A,
|
|
202
|
-
className: "vl-announcement-placeholder",
|
|
203
|
-
"aria-hidden": "true",
|
|
204
|
-
style: { blockSize: Ae ? `${Ae}px` : void 0 }
|
|
205
|
-
}) : null, N && M ? ae(Je, M) : null] }) : Je;
|
|
206
|
-
});
|
|
207
|
-
b.displayName = "VlAnnouncement";
|
|
208
|
-
//#endregion
|
|
209
|
-
//#region components/Announcement/index.ts
|
|
210
|
-
var x = b, S = b;
|
|
211
|
-
//#endregion
|
|
212
|
-
export { x as n, S as t };
|