@vavt/react-ui 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Cron-vQ7RSsws.cjs → Cron-2avclmKf.cjs} +1 -1
- package/dist/{Cron-HRBggBRO.js → Cron-BVMn9OXM.js} +3 -3
- package/dist/{DatePicker-B0f4Nh8h.js → DatePicker-3wbkApMJ.js} +1 -1
- package/dist/{DatePicker-DFTqHT8i.cjs → DatePicker-B3mA7BzE.cjs} +1 -1
- package/dist/{DateTimePicker-BzkWgjkq.js → DateTimePicker--A4EWUe-.js} +1 -1
- package/dist/{DateTimePicker-McwH-cWl.cjs → DateTimePicker-C1bggaBl.cjs} +1 -1
- package/dist/Drawer-D1elCS8V.js +109 -0
- package/dist/Drawer-DbH5rUvZ.cjs +1 -0
- package/dist/{Dropdown-CyVxoFAH.js → Dropdown-CYo0Ckcg.js} +3 -3
- package/dist/{Dropdown-Chx8SZPS.cjs → Dropdown-DlT_kSLw.cjs} +1 -1
- package/dist/{Form-Fe4b1pS1.js → Form-DiYdJJNH.js} +1 -1
- package/dist/{Form-CyCbST4e.cjs → Form-X98FSlHG.cjs} +1 -1
- package/dist/MessageBox-Bp-3oqz4.cjs +1 -0
- package/dist/MessageBox-C0dCtUie.js +145 -0
- package/dist/Modal-BfHARuVJ.cjs +1 -0
- package/dist/Modal-UWOcLzA6.js +250 -0
- package/dist/{Pagination-BrG1pKYw.js → Pagination-BGbiLFtp.js} +1 -1
- package/dist/{Pagination-D3ok8N9k.cjs → Pagination-CtnBykzs.cjs} +1 -1
- package/dist/{Select-GleCzXQB.js → Select-BBw595_R.js} +3 -3
- package/dist/{Select-Rx6AHue2.cjs → Select-CcuSjVhm.cjs} +1 -1
- package/dist/{Table-ClWg25Wn.js → Table-CpyEziz5.js} +1 -1
- package/dist/{Table-Dv2qxs8q.cjs → Table-uBqeNSnm.cjs} +1 -1
- package/dist/{TimePicker-BCU7D6uD.cjs → TimePicker-BtorXdZv.cjs} +1 -1
- package/dist/{TimePicker-BVZbkBvJ.js → TimePicker-DxDA8bbO.js} +3 -3
- package/dist/{Tooltip-BbbIT5nt.js → Tooltip-2-mZgyai.js} +3 -3
- package/dist/{Tooltip-z6u7ChKj.cjs → Tooltip-BCH9SOnY.cjs} +1 -1
- 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/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/Modal.css +1 -1
- package/dist/{date-picker-Dp0BXURF.cjs → date-picker-BrlkzTx6.cjs} +1 -1
- package/dist/{date-picker-BKXFZDN2.js → date-picker-DBzPbLf2.js} +4 -4
- package/dist/dialog-shell-DqKDnSak.js +207 -0
- package/dist/dialog-shell-WCsdja9-.cjs +1 -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/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 +14 -14
- package/dist/es/register.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/{layer-C1yCY0MO.js → layer-CWiOhvXF.js} +1 -1
- package/dist/{layer-DL1xVbJT.cjs → layer-DfWO72Y-.cjs} +1 -1
- package/dist/{registry-C-Mo3vuy.cjs → registry-7LU6RUh_.cjs} +1 -1
- package/dist/{registry-BXGVMimF.js → registry-BYt8u6us.js} +13 -13
- package/dist/types/Drawer/type.d.cts +1 -1
- package/dist/types/Drawer/type.d.ts +1 -1
- package/dist/types/Modal/type.d.cts +3 -3
- package/dist/types/Modal/type.d.ts +3 -3
- package/dist/types/_shared/dialog-layer.d.cts +51 -0
- package/dist/types/_shared/dialog-layer.d.ts +51 -0
- package/dist/types/_shared/dialog.d.cts +3 -7
- package/dist/types/_shared/dialog.d.ts +3 -7
- package/package.json +1 -1
- package/dist/Drawer-DNZCj--j.js +0 -113
- package/dist/Drawer-YWO6-KLG.cjs +0 -1
- package/dist/MessageBox-C35_ifsL.js +0 -166
- package/dist/MessageBox-C6NLihE1.cjs +0 -1
- package/dist/Modal-6kNs-9QU.js +0 -240
- package/dist/Modal-BKvRyCXZ.cjs +0 -1
- package/dist/dialog-shell-B7mE8A1p.cjs +0 -1
- package/dist/dialog-shell-FS5nSlBm.js +0 -118
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=require("react"),t=require("react/jsx-runtime");var n=(0,e.createContext)(null),r={dropdown:`var(--vl-z-dropdown)`,popover:`var(--vl-z-popover)`,tooltip:`var(--vl-z-tooltip)`,modal:`var(--vl-z-modal)`},i={[r.dropdown]:1e3,[r.popover]:1100,[r.tooltip]:1e3,[r.modal]:1200},a=e=>typeof e==`string`?i[e]:void 0,o=({base:e,offset:t})=>t===0?e:typeof e==`number`?e+t:`calc(${e} ${t>0?`+`:`-`} ${Math.abs(t)})`,s=(e,t)=>o({...e,offset:e.offset+t}),c=({defaultZIndex:t,zIndex:r,withMask:i=!1})=>{let c=(0,e.useContext)(n),l=(0,e.useMemo)(()=>{if(r!==void 0)return{base:r,offset:0};let e=a(t);if(c){let t=i?2:1,n=c.offset+t,r=c.rank;if(!(e!==void 0&&r!==void 0&&e>r+n))return{base:c.base,offset:n,rank:r}}return{base:t,offset:0,rank:e}},[t,c,i,r]),u=r===void 0&&l.offset===0&&l.base===t?void 0:o(l);return{layer:l,zIndex:u,maskZIndex:u===void 0?void 0:s(l,-1)}},l=({layer:e,children:r})=>(0,t.jsx)(n.Provider,{value:e,children:r});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return
|
|
1
|
+
let e=require("react"),t=require("react/jsx-runtime");var n=(0,e.createContext)(null),r={dropdown:`var(--vl-z-dropdown)`,popover:`var(--vl-z-popover)`,tooltip:`var(--vl-z-tooltip)`,modal:`var(--vl-z-modal)`},i={[r.dropdown]:1e3,[r.popover]:1100,[r.tooltip]:1e3,[r.modal]:1200},a=e=>typeof e==`string`?i[e]:void 0,o=({base:e,offset:t})=>t===0?e:typeof e==`number`?e+t:`calc(${e} ${t>0?`+`:`-`} ${Math.abs(t)})`,s=(e,t)=>o({...e,offset:e.offset+t}),c=({defaultZIndex:t,zIndex:r,withMask:i=!1})=>{let c=(0,e.useContext)(n),l=(0,e.useMemo)(()=>{if(r!==void 0)return{base:r,offset:0};let e=a(t);if(c){let t=i?2:1,n=c.offset+t,r=c.rank;if(!(e!==void 0&&r!==void 0&&e>r+n))return{base:c.base,offset:n,rank:r}}return{base:t,offset:0,rank:e}},[t,c,i,r]),u=r===void 0&&l.offset===0&&l.base===t?void 0:o(l);return{layer:l,zIndex:u,maskZIndex:u===void 0?void 0:s(l,-1)}},l=({layer:e,children:r})=>(0,t.jsx)(n.Provider,{value:e,children:r});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -1 +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-CvoVGKUn.cjs"),l=require("./Input-BbJ4Q_xu.cjs"),u=require("./Tabs-BZ0Zc0bL.cjs"),d=require("./NumberInput-Dp1vTDkW.cjs"),f=require("./Cron-
|
|
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-CvoVGKUn.cjs"),l=require("./Input-BbJ4Q_xu.cjs"),u=require("./Tabs-BZ0Zc0bL.cjs"),d=require("./NumberInput-Dp1vTDkW.cjs"),f=require("./Cron-2avclmKf.cjs"),p=require("./Dropdown-DlT_kSLw.cjs"),m=require("./DatePicker-B3mA7BzE.cjs"),h=require("./DateTimePicker-C1bggaBl.cjs"),g=require("./Divider-BnmUNmy2.cjs"),_=require("./Drawer-DbH5rUvZ.cjs"),v=require("./Empty-Dny96c3p.cjs"),y=require("./Form-X98FSlHG.cjs"),b=require("./Tooltip-BCH9SOnY.cjs"),x=require("./Loading-BSqhKOle.cjs"),S=require("./Scrollbar-CEQT6Ao_.cjs"),C=require("./Modal-BfHARuVJ.cjs"),w=require("./MessageBox-Bp-3oqz4.cjs"),T=require("./Notification-D6m4qHKz.cjs"),E=require("./Select-CcuSjVhm.cjs"),D=require("./Pagination-CtnBykzs.cjs"),O=require("./Progress-DTAjlgwZ.cjs"),k=require("./cjs/Radio.cjs"),A=require("./cjs/Row.cjs"),j=require("./Sidebar-2KVVRUEM.cjs"),M=require("./Slider-CU9OS2HB.cjs"),N=require("./Space-DJGRG2rt.cjs"),P=require("./Switch-CpXDMcPW.cjs"),F=require("./Table-uBqeNSnm.cjs"),I=require("./Tag-4iZGcfrg.cjs"),L=require("./Textarea-CEhAvE10.cjs"),R=require("./Timeline-ROggEQnD.cjs"),z=require("./TimePicker-BtorXdZv.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}});
|
|
@@ -10,22 +10,22 @@ import { n as c } from "./Col-BZdKuXbj.js";
|
|
|
10
10
|
import { n as l } from "./Input-DpoSxIdb.js";
|
|
11
11
|
import { n as u } from "./Tabs-HWLkyrQR.js";
|
|
12
12
|
import { n as d } from "./NumberInput-CB-nKZgs.js";
|
|
13
|
-
import { n as f } from "./Cron-
|
|
14
|
-
import { n as p } from "./Dropdown-
|
|
15
|
-
import { n as m } from "./DatePicker-
|
|
16
|
-
import { n as h } from "./DateTimePicker
|
|
13
|
+
import { n as f } from "./Cron-BVMn9OXM.js";
|
|
14
|
+
import { n as p } from "./Dropdown-CYo0Ckcg.js";
|
|
15
|
+
import { n as m } from "./DatePicker-3wbkApMJ.js";
|
|
16
|
+
import { n as h } from "./DateTimePicker--A4EWUe-.js";
|
|
17
17
|
import { n as g } from "./Divider-BXNZyvHY.js";
|
|
18
|
-
import { n as _ } from "./Drawer-
|
|
18
|
+
import { n as _ } from "./Drawer-D1elCS8V.js";
|
|
19
19
|
import { n as v } from "./Empty-MmxZitR8.js";
|
|
20
|
-
import { t as y } from "./Form-
|
|
21
|
-
import { n as b } from "./Tooltip-
|
|
20
|
+
import { t as y } from "./Form-DiYdJJNH.js";
|
|
21
|
+
import { n as b } from "./Tooltip-2-mZgyai.js";
|
|
22
22
|
import { n as x } from "./Loading-BAKnIASq.js";
|
|
23
23
|
import { n as S } from "./Scrollbar-BdMGZrYi.js";
|
|
24
|
-
import { n as C } from "./Modal-
|
|
25
|
-
import { t as w } from "./MessageBox-
|
|
24
|
+
import { n as C } from "./Modal-UWOcLzA6.js";
|
|
25
|
+
import { t as w } from "./MessageBox-C0dCtUie.js";
|
|
26
26
|
import { t as T } from "./Notification-CJraaZIi.js";
|
|
27
|
-
import { n as E } from "./Select-
|
|
28
|
-
import { n as D } from "./Pagination-
|
|
27
|
+
import { n as E } from "./Select-BBw595_R.js";
|
|
28
|
+
import { n as D } from "./Pagination-BGbiLFtp.js";
|
|
29
29
|
import { n as O } from "./Progress-D2C6LCml.js";
|
|
30
30
|
import { VlRadio as k } from "./es/Radio.mjs";
|
|
31
31
|
import { VlRow as A } from "./es/Row.mjs";
|
|
@@ -33,11 +33,11 @@ import { n as j } from "./Sidebar-ByLinOVm.js";
|
|
|
33
33
|
import { n as M } from "./Slider-CKU03SsT.js";
|
|
34
34
|
import { n as N } from "./Space-gnVH7rEt.js";
|
|
35
35
|
import { n as P } from "./Switch-CqTFvp-k.js";
|
|
36
|
-
import { n as F } from "./Table-
|
|
36
|
+
import { n as F } from "./Table-CpyEziz5.js";
|
|
37
37
|
import { n as I } from "./Tag-TeYTDdHt.js";
|
|
38
38
|
import { n as L } from "./Textarea-CA6Vzu7t.js";
|
|
39
39
|
import { n as R } from "./Timeline-euWvUS4e.js";
|
|
40
|
-
import { n as z } from "./TimePicker-
|
|
40
|
+
import { n as z } from "./TimePicker-DxDA8bbO.js";
|
|
41
41
|
import { n as B } from "./Upload-DZ6VaM7r.js";
|
|
42
42
|
//#region components/registry.ts
|
|
43
43
|
var V = {
|
|
@@ -35,7 +35,7 @@ export interface DrawerProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange
|
|
|
35
35
|
lockScroll?: boolean;
|
|
36
36
|
/** 关闭后是否销毁子节点 DOM,默认为 false */
|
|
37
37
|
destroyOnClose?: boolean;
|
|
38
|
-
/** 抽屉 z-index
|
|
38
|
+
/** 抽屉 z-index 最低基线;不足以覆盖此前打开的弹层时自动抬升,优先于数字 style.zIndex */
|
|
39
39
|
zIndex?: number;
|
|
40
40
|
/** 抽屉打开/关闭状态发生变化时的回调函数 */
|
|
41
41
|
onChange?: (value: boolean) => void;
|
|
@@ -35,7 +35,7 @@ export interface DrawerProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange
|
|
|
35
35
|
lockScroll?: boolean;
|
|
36
36
|
/** 关闭后是否销毁子节点 DOM,默认为 false */
|
|
37
37
|
destroyOnClose?: boolean;
|
|
38
|
-
/** 抽屉 z-index
|
|
38
|
+
/** 抽屉 z-index 最低基线;不足以覆盖此前打开的弹层时自动抬升,优先于数字 style.zIndex */
|
|
39
39
|
zIndex?: number;
|
|
40
40
|
/** 抽屉打开/关闭状态发生变化时的回调函数 */
|
|
41
41
|
onChange?: (value: boolean) => void;
|
|
@@ -11,9 +11,9 @@ export interface ModalProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'
|
|
|
11
11
|
title?: ReactNode;
|
|
12
12
|
/** 弹窗宽度(如 520 或 `'520px'`),默认为 520 */
|
|
13
13
|
width?: number | string;
|
|
14
|
-
/**
|
|
14
|
+
/** 相对默认位置的垂直偏移(px 或 vh);负值向上,正值向下,默认位置为剩余视口高度的 25% */
|
|
15
15
|
offsetY?: number | string;
|
|
16
|
-
/**
|
|
16
|
+
/** 是否按剩余高度的 50% 严格垂直居中,并居中展示内容和底部按钮,默认为 false */
|
|
17
17
|
center?: boolean;
|
|
18
18
|
/** 是否展示背景半透明遮罩层,默认为 true */
|
|
19
19
|
mask?: boolean;
|
|
@@ -31,7 +31,7 @@ export interface ModalProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'
|
|
|
31
31
|
draggable?: boolean;
|
|
32
32
|
/** 是否以全屏模态形态展示,默认为 false */
|
|
33
33
|
fullscreen?: boolean;
|
|
34
|
-
/** 弹窗 z-index
|
|
34
|
+
/** 弹窗 z-index 最低基线;不足以覆盖此前打开的弹层时自动抬升,优先于数字 style.zIndex */
|
|
35
35
|
zIndex?: number;
|
|
36
36
|
/** 自定义整个头部区域节点 */
|
|
37
37
|
header?: ReactNode;
|
|
@@ -11,9 +11,9 @@ export interface ModalProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'
|
|
|
11
11
|
title?: ReactNode;
|
|
12
12
|
/** 弹窗宽度(如 520 或 `'520px'`),默认为 520 */
|
|
13
13
|
width?: number | string;
|
|
14
|
-
/**
|
|
14
|
+
/** 相对默认位置的垂直偏移(px 或 vh);负值向上,正值向下,默认位置为剩余视口高度的 25% */
|
|
15
15
|
offsetY?: number | string;
|
|
16
|
-
/**
|
|
16
|
+
/** 是否按剩余高度的 50% 严格垂直居中,并居中展示内容和底部按钮,默认为 false */
|
|
17
17
|
center?: boolean;
|
|
18
18
|
/** 是否展示背景半透明遮罩层,默认为 true */
|
|
19
19
|
mask?: boolean;
|
|
@@ -31,7 +31,7 @@ export interface ModalProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'
|
|
|
31
31
|
draggable?: boolean;
|
|
32
32
|
/** 是否以全屏模态形态展示,默认为 false */
|
|
33
33
|
fullscreen?: boolean;
|
|
34
|
-
/** 弹窗 z-index
|
|
34
|
+
/** 弹窗 z-index 最低基线;不足以覆盖此前打开的弹层时自动抬升,优先于数字 style.zIndex */
|
|
35
35
|
zIndex?: number;
|
|
36
36
|
/** 自定义整个头部区域节点 */
|
|
37
37
|
header?: ReactNode;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { OverlayLayer } from './layer.cjs';
|
|
3
|
+
interface DialogLevel {
|
|
4
|
+
tokenOffset?: number;
|
|
5
|
+
absolute?: number;
|
|
6
|
+
}
|
|
7
|
+
interface DialogEntry {
|
|
8
|
+
order: number;
|
|
9
|
+
open: boolean;
|
|
10
|
+
reserved: boolean;
|
|
11
|
+
phase: 'reserved' | 'active' | 'leaving' | 'closed';
|
|
12
|
+
zIndex?: number;
|
|
13
|
+
level: DialogLevel;
|
|
14
|
+
layer: OverlayLayer;
|
|
15
|
+
}
|
|
16
|
+
interface DialogScope {
|
|
17
|
+
entry: DialogEntry;
|
|
18
|
+
active: boolean;
|
|
19
|
+
zIndex?: number;
|
|
20
|
+
parent: DialogScope | null;
|
|
21
|
+
}
|
|
22
|
+
export declare const DialogReservationContext: import("react").Context<DialogEntry | null>;
|
|
23
|
+
/** 栈变化同时通知层级渲染和焦点协调,保证二者始终使用同一打开顺序。 */
|
|
24
|
+
export declare const subscribeDialogStack: (listener: () => void) => () => void;
|
|
25
|
+
/** 命令式 createRoot 提交前就预留顺序,实际 Modal 挂载时复用该登记项。 */
|
|
26
|
+
export declare const reserveDialogLayer: (zIndex?: number) => DialogEntry;
|
|
27
|
+
/** 离场结束或卸载后释放视觉占位;保留 open/order 以支持 StrictMode 的同实例重新连接。 */
|
|
28
|
+
export declare const releaseDialogLayer: (entry: DialogEntry) => void;
|
|
29
|
+
/** 登记发生在提交阶段,渲染只订阅快照;未提交的并发 render 不会占用层级。 */
|
|
30
|
+
export declare const useDialogLayer: ({ active, zIndex }: {
|
|
31
|
+
active: boolean;
|
|
32
|
+
zIndex?: number;
|
|
33
|
+
}) => {
|
|
34
|
+
scope: {
|
|
35
|
+
entry: DialogEntry;
|
|
36
|
+
active: boolean;
|
|
37
|
+
zIndex: number | undefined;
|
|
38
|
+
parent: DialogScope | null;
|
|
39
|
+
};
|
|
40
|
+
layer: OverlayLayer;
|
|
41
|
+
isTopLayer: () => boolean;
|
|
42
|
+
onAfterLeave: () => void;
|
|
43
|
+
zIndex: ("auto" | (string & {}) | "inherit" | "-moz-initial" | "initial" | "revert" | "revert-layer" | "unset" | (number & {})) | undefined;
|
|
44
|
+
maskZIndex: ("auto" | (string & {}) | "inherit" | "-moz-initial" | "initial" | "revert" | "revert-layer" | "unset" | (number & {})) | undefined;
|
|
45
|
+
};
|
|
46
|
+
/** 普通 Portal 浮层继承最终视觉层级,嵌套 Modal 则创建自己的登记,不能重复消费命令式预留。 */
|
|
47
|
+
export declare const DialogLayerProvider: ({ value, children }: {
|
|
48
|
+
value: ReturnType<typeof useDialogLayer>;
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
}) => import("react").JSX.Element;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { OverlayLayer } from './layer.js';
|
|
3
|
+
interface DialogLevel {
|
|
4
|
+
tokenOffset?: number;
|
|
5
|
+
absolute?: number;
|
|
6
|
+
}
|
|
7
|
+
interface DialogEntry {
|
|
8
|
+
order: number;
|
|
9
|
+
open: boolean;
|
|
10
|
+
reserved: boolean;
|
|
11
|
+
phase: 'reserved' | 'active' | 'leaving' | 'closed';
|
|
12
|
+
zIndex?: number;
|
|
13
|
+
level: DialogLevel;
|
|
14
|
+
layer: OverlayLayer;
|
|
15
|
+
}
|
|
16
|
+
interface DialogScope {
|
|
17
|
+
entry: DialogEntry;
|
|
18
|
+
active: boolean;
|
|
19
|
+
zIndex?: number;
|
|
20
|
+
parent: DialogScope | null;
|
|
21
|
+
}
|
|
22
|
+
export declare const DialogReservationContext: import("react").Context<DialogEntry | null>;
|
|
23
|
+
/** 栈变化同时通知层级渲染和焦点协调,保证二者始终使用同一打开顺序。 */
|
|
24
|
+
export declare const subscribeDialogStack: (listener: () => void) => () => void;
|
|
25
|
+
/** 命令式 createRoot 提交前就预留顺序,实际 Modal 挂载时复用该登记项。 */
|
|
26
|
+
export declare const reserveDialogLayer: (zIndex?: number) => DialogEntry;
|
|
27
|
+
/** 离场结束或卸载后释放视觉占位;保留 open/order 以支持 StrictMode 的同实例重新连接。 */
|
|
28
|
+
export declare const releaseDialogLayer: (entry: DialogEntry) => void;
|
|
29
|
+
/** 登记发生在提交阶段,渲染只订阅快照;未提交的并发 render 不会占用层级。 */
|
|
30
|
+
export declare const useDialogLayer: ({ active, zIndex }: {
|
|
31
|
+
active: boolean;
|
|
32
|
+
zIndex?: number;
|
|
33
|
+
}) => {
|
|
34
|
+
scope: {
|
|
35
|
+
entry: DialogEntry;
|
|
36
|
+
active: boolean;
|
|
37
|
+
zIndex: number | undefined;
|
|
38
|
+
parent: DialogScope | null;
|
|
39
|
+
};
|
|
40
|
+
layer: OverlayLayer;
|
|
41
|
+
isTopLayer: () => boolean;
|
|
42
|
+
onAfterLeave: () => void;
|
|
43
|
+
zIndex: ("auto" | (string & {}) | "inherit" | "-moz-initial" | "initial" | "revert" | "revert-layer" | "unset" | (number & {})) | undefined;
|
|
44
|
+
maskZIndex: ("auto" | (string & {}) | "inherit" | "-moz-initial" | "initial" | "revert" | "revert-layer" | "unset" | (number & {})) | undefined;
|
|
45
|
+
};
|
|
46
|
+
/** 普通 Portal 浮层继承最终视觉层级,嵌套 Modal 则创建自己的登记,不能重复消费命令式预留。 */
|
|
47
|
+
export declare const DialogLayerProvider: ({ value, children }: {
|
|
48
|
+
value: ReturnType<typeof useDialogLayer>;
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
}) => import("react").JSX.Element;
|
|
51
|
+
export {};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
import
|
|
3
|
-
/** 命令式弹层跨越 React root,用已打开面板的层级快照补回无法继承的 Context。 */
|
|
4
|
-
export declare const getActiveDialogLayers: () => OverlayLayer[];
|
|
2
|
+
import { useDialogLayer } from './dialog-layer.cjs';
|
|
5
3
|
/** 拖拽期间禁止文本选择;使用引用计数以兼容嵌套弹层或同时结束的拖拽清理。 */
|
|
6
4
|
export declare const acquireBodyUserSelectLock: () => () => void;
|
|
7
5
|
export interface DialogInteractionOptions {
|
|
8
6
|
active: boolean;
|
|
9
|
-
|
|
7
|
+
zIndex?: number;
|
|
10
8
|
containerRef: RefObject<HTMLElement | null>;
|
|
11
9
|
closeOnPressEscape: boolean;
|
|
12
10
|
lockScroll: boolean;
|
|
@@ -19,6 +17,4 @@ export interface DialogInteractionOptions {
|
|
|
19
17
|
* 当上层弹层关闭时,订阅栈变化的父层会重新确认焦点是否仍在自身内部。最终卸载会恢复打开前焦点;
|
|
20
18
|
* 若仍有父弹层存在,其 focusin 陷阱会自然把焦点约束回父层,因此无需在这里感知具体父子关系。
|
|
21
19
|
*/
|
|
22
|
-
export declare const useDialogInteraction: ({ active,
|
|
23
|
-
isTopLayer: () => boolean;
|
|
24
|
-
};
|
|
20
|
+
export declare const useDialogInteraction: ({ active, zIndex, containerRef, closeOnPressEscape, lockScroll, onRequestClose }: DialogInteractionOptions) => ReturnType<typeof useDialogLayer>;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
import
|
|
3
|
-
/** 命令式弹层跨越 React root,用已打开面板的层级快照补回无法继承的 Context。 */
|
|
4
|
-
export declare const getActiveDialogLayers: () => OverlayLayer[];
|
|
2
|
+
import { useDialogLayer } from './dialog-layer.js';
|
|
5
3
|
/** 拖拽期间禁止文本选择;使用引用计数以兼容嵌套弹层或同时结束的拖拽清理。 */
|
|
6
4
|
export declare const acquireBodyUserSelectLock: () => () => void;
|
|
7
5
|
export interface DialogInteractionOptions {
|
|
8
6
|
active: boolean;
|
|
9
|
-
|
|
7
|
+
zIndex?: number;
|
|
10
8
|
containerRef: RefObject<HTMLElement | null>;
|
|
11
9
|
closeOnPressEscape: boolean;
|
|
12
10
|
lockScroll: boolean;
|
|
@@ -19,6 +17,4 @@ export interface DialogInteractionOptions {
|
|
|
19
17
|
* 当上层弹层关闭时,订阅栈变化的父层会重新确认焦点是否仍在自身内部。最终卸载会恢复打开前焦点;
|
|
20
18
|
* 若仍有父弹层存在,其 focusin 陷阱会自然把焦点约束回父层,因此无需在这里感知具体父子关系。
|
|
21
19
|
*/
|
|
22
|
-
export declare const useDialogInteraction: ({ active,
|
|
23
|
-
isTopLayer: () => boolean;
|
|
24
|
-
};
|
|
20
|
+
export declare const useDialogInteraction: ({ active, zIndex, containerRef, closeOnPressEscape, lockScroll, onRequestClose }: DialogInteractionOptions) => ReturnType<typeof useDialogLayer>;
|
package/package.json
CHANGED
package/dist/Drawer-DNZCj--j.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./state-BSDh-Ob2.js";
|
|
2
|
-
import { n } from "./refs-D5IYOBaf.js";
|
|
3
|
-
import { t as r } from "./content-Dllrr-7G.js";
|
|
4
|
-
import { t as i } from "./client-pj_wzx28.js";
|
|
5
|
-
import { n as a } from "./number-BN2jHM6Z.js";
|
|
6
|
-
import { t as o } from "./id-CHixuHb7.js";
|
|
7
|
-
import { a as s, r as c, t as ee } from "./layer-C1yCY0MO.js";
|
|
8
|
-
import { i as l, t as u } from "./dialog-shell-FS5nSlBm.js";
|
|
9
|
-
import { X as d } from "lucide-react";
|
|
10
|
-
import { forwardRef as f, useCallback as te, useEffect as p, useMemo as m, useRef as h } from "react";
|
|
11
|
-
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
12
|
-
//#region components/Drawer/Drawer.tsx
|
|
13
|
-
var v = f((f, v) => {
|
|
14
|
-
let { open: y, defaultOpen: b = !1, title: x, header: S, footer: C, placement: w = "right", width: ne = 360, height: re = 320, mask: ie = !0, closeOnClickOverlay: ae = !0, closeOnPressEscape: oe = !0, showClose: T = !0, lockScroll: E = !0, destroyOnClose: D = !1, zIndex: O, className: k, style: A, children: j, onClick: M, onChange: N, onOpen: P, onClose: F, "aria-label": I, "aria-labelledby": L, "aria-describedby": R, ...z } = f, B = i(), V = typeof A?.zIndex == "number" ? A.zIndex : void 0, H = s({
|
|
15
|
-
defaultZIndex: c.modal,
|
|
16
|
-
zIndex: O ?? V,
|
|
17
|
-
withMask: !0
|
|
18
|
-
}), U = h(null), W = m(() => n(U, v), [v]), G = h(!1), K = t(f, "open"), [q, J] = e({
|
|
19
|
-
value: !!y,
|
|
20
|
-
defaultValue: b,
|
|
21
|
-
controlled: K,
|
|
22
|
-
onChange: N
|
|
23
|
-
}), Y = te(() => J(!1), [J]), { isTopLayer: se } = l({
|
|
24
|
-
active: B && q,
|
|
25
|
-
layer: H.layer,
|
|
26
|
-
containerRef: U,
|
|
27
|
-
closeOnPressEscape: oe,
|
|
28
|
-
lockScroll: E,
|
|
29
|
-
onRequestClose: Y
|
|
30
|
-
}), X = o("vl-drawer-title");
|
|
31
|
-
p(() => {
|
|
32
|
-
let e = G.current;
|
|
33
|
-
q && !e ? P?.() : !q && e && F?.(), G.current = q;
|
|
34
|
-
}, [
|
|
35
|
-
q,
|
|
36
|
-
P,
|
|
37
|
-
F
|
|
38
|
-
]);
|
|
39
|
-
let ce = () => {
|
|
40
|
-
ae && se() && Y();
|
|
41
|
-
}, le = (e) => {
|
|
42
|
-
e.stopPropagation(), M?.(e);
|
|
43
|
-
}, ue = [
|
|
44
|
-
"vl-drawer",
|
|
45
|
-
`is-${w}`,
|
|
46
|
-
k || ""
|
|
47
|
-
].filter(Boolean).join(" "), Z = { ...A };
|
|
48
|
-
H.zIndex !== void 0 && (Z.zIndex = H.zIndex), w === "left" || w === "right" ? (Z.width = a(ne) ?? "360px", Z.height = "100vh") : (Z.height = a(re) ?? "320px", Z.width = "100vw");
|
|
49
|
-
let Q = S ?? (x ? /* @__PURE__ */ g("div", {
|
|
50
|
-
id: X,
|
|
51
|
-
className: "vl-drawer__title",
|
|
52
|
-
children: x
|
|
53
|
-
}) : null), $ = L ?? (!S && x ? X : void 0), de = I ?? ($ ? void 0 : typeof x == "string" ? x : "抽屉");
|
|
54
|
-
return /* @__PURE__ */ g(ee, {
|
|
55
|
-
layer: H.layer,
|
|
56
|
-
children: /* @__PURE__ */ _(u, {
|
|
57
|
-
clientReady: B,
|
|
58
|
-
open: q,
|
|
59
|
-
mask: ie,
|
|
60
|
-
destroyOnClose: D,
|
|
61
|
-
maskUnmountOnExit: D,
|
|
62
|
-
maskTransitionName: "vl-drawer-mask",
|
|
63
|
-
transitionName: `vl-drawer-${w}`,
|
|
64
|
-
maskClassName: "vl-drawer__mask",
|
|
65
|
-
panelClassName: ue,
|
|
66
|
-
panelStyle: Z,
|
|
67
|
-
maskStyle: H.maskZIndex === void 0 ? void 0 : { zIndex: H.maskZIndex },
|
|
68
|
-
panelRef: W,
|
|
69
|
-
role: "dialog",
|
|
70
|
-
ariaLabel: de,
|
|
71
|
-
ariaLabelledBy: $,
|
|
72
|
-
ariaDescribedBy: R,
|
|
73
|
-
onMaskClick: ce,
|
|
74
|
-
onPanelClick: le,
|
|
75
|
-
panelProps: z,
|
|
76
|
-
children: [
|
|
77
|
-
r(Q) || T ? /* @__PURE__ */ g("div", {
|
|
78
|
-
className: "vl-drawer__header",
|
|
79
|
-
children: /* @__PURE__ */ _("div", {
|
|
80
|
-
className: "vl-drawer__headerInner",
|
|
81
|
-
children: [/* @__PURE__ */ g("div", {
|
|
82
|
-
className: "vl-drawer__headerMain",
|
|
83
|
-
children: Q
|
|
84
|
-
}), T ? /* @__PURE__ */ g("button", {
|
|
85
|
-
type: "button",
|
|
86
|
-
className: "vl-drawer__close",
|
|
87
|
-
"aria-label": "关闭抽屉",
|
|
88
|
-
onClick: Y,
|
|
89
|
-
children: /* @__PURE__ */ g(d, {
|
|
90
|
-
size: 20,
|
|
91
|
-
"aria-hidden": "true"
|
|
92
|
-
})
|
|
93
|
-
}) : null]
|
|
94
|
-
})
|
|
95
|
-
}) : null,
|
|
96
|
-
/* @__PURE__ */ g("div", {
|
|
97
|
-
className: "vl-drawer__body",
|
|
98
|
-
children: j
|
|
99
|
-
}),
|
|
100
|
-
r(C) ? /* @__PURE__ */ g("div", {
|
|
101
|
-
className: "vl-drawer__footer",
|
|
102
|
-
children: C
|
|
103
|
-
}) : null
|
|
104
|
-
]
|
|
105
|
-
})
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
v.displayName = "VlDrawer";
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region components/Drawer/index.ts
|
|
111
|
-
var y = v, b = v;
|
|
112
|
-
//#endregion
|
|
113
|
-
export { y as n, b as t };
|
package/dist/Drawer-YWO6-KLG.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./state-BuUx1onZ.cjs"),t=require("./refs-DCqd87V8.cjs"),n=require("./content-DCGQZQp8.cjs"),r=require("./client-BkoqeUs3.cjs"),i=require("./number-B7qJF_ZY.cjs"),ee=require("./id-CF0zOP1G.cjs"),a=require("./layer-DL1xVbJT.cjs"),o=require("./dialog-shell-B7mE8A1p.cjs");let s=require("lucide-react"),c=require("react"),l=require("react/jsx-runtime");var u=(0,c.forwardRef)((u,d)=>{let{open:f,defaultOpen:p=!1,title:m,header:h,footer:g,placement:_=`right`,width:v=360,height:y=320,mask:b=!0,closeOnClickOverlay:x=!0,closeOnPressEscape:S=!0,showClose:C=!0,lockScroll:w=!0,destroyOnClose:T=!1,zIndex:E,className:D,style:O,children:te,onClick:ne,onChange:k,onOpen:A,onClose:j,"aria-label":M,"aria-labelledby":N,"aria-describedby":P,...F}=u,I=r.t(),L=typeof O?.zIndex==`number`?O.zIndex:void 0,R=a.a({defaultZIndex:a.r.modal,zIndex:E??L,withMask:!0}),z=(0,c.useRef)(null),B=(0,c.useMemo)(()=>t.n(z,d),[d]),V=(0,c.useRef)(!1),H=e.t(u,`open`),[U,W]=e.n({value:!!f,defaultValue:p,controlled:H,onChange:k}),G=(0,c.useCallback)(()=>W(!1),[W]),{isTopLayer:K}=o.i({active:I&&U,layer:R.layer,containerRef:z,closeOnPressEscape:S,lockScroll:w,onRequestClose:G}),q=ee.t(`vl-drawer-title`);(0,c.useEffect)(()=>{let e=V.current;U&&!e?A?.():!U&&e&&j?.(),V.current=U},[U,A,j]);let J=()=>{x&&K()&&G()},Y=e=>{e.stopPropagation(),ne?.(e)},X=[`vl-drawer`,`is-${_}`,D||``].filter(Boolean).join(` `),Z={...O};R.zIndex!==void 0&&(Z.zIndex=R.zIndex),_===`left`||_===`right`?(Z.width=i.n(v)??`360px`,Z.height=`100vh`):(Z.height=i.n(y)??`320px`,Z.width=`100vw`);let Q=h??(m?(0,l.jsx)(`div`,{id:q,className:`vl-drawer__title`,children:m}):null),$=N??(!h&&m?q:void 0),re=M??($?void 0:typeof m==`string`?m:`抽屉`);return(0,l.jsx)(a.t,{layer:R.layer,children:(0,l.jsxs)(o.t,{clientReady:I,open:U,mask:b,destroyOnClose:T,maskUnmountOnExit:T,maskTransitionName:`vl-drawer-mask`,transitionName:`vl-drawer-${_}`,maskClassName:`vl-drawer__mask`,panelClassName:X,panelStyle:Z,maskStyle:R.maskZIndex===void 0?void 0:{zIndex:R.maskZIndex},panelRef:B,role:`dialog`,ariaLabel:re,ariaLabelledBy:$,ariaDescribedBy:P,onMaskClick:J,onPanelClick:Y,panelProps:F,children:[n.t(Q)||C?(0,l.jsx)(`div`,{className:`vl-drawer__header`,children:(0,l.jsxs)(`div`,{className:`vl-drawer__headerInner`,children:[(0,l.jsx)(`div`,{className:`vl-drawer__headerMain`,children:Q}),C?(0,l.jsx)(`button`,{type:`button`,className:`vl-drawer__close`,"aria-label":`关闭抽屉`,onClick:G,children:(0,l.jsx)(s.X,{size:20,"aria-hidden":`true`})}):null]})}):null,(0,l.jsx)(`div`,{className:`vl-drawer__body`,children:te}),n.t(g)?(0,l.jsx)(`div`,{className:`vl-drawer__footer`,children:g}):null]})})});u.displayName=`VlDrawer`;var d=u,f=u;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./state-BSDh-Ob2.js";
|
|
2
|
-
import { t as n } from "./Button-CwkWSWau.js";
|
|
3
|
-
import { i as r, n as i, r as a, t as o } from "./layer-C1yCY0MO.js";
|
|
4
|
-
import { t as s } from "./focus-BDDJyKk3.js";
|
|
5
|
-
import { r as c } from "./dialog-shell-FS5nSlBm.js";
|
|
6
|
-
import { t as l } from "./Modal-6kNs-9QU.js";
|
|
7
|
-
import { CircleAlert as u, CircleCheck as d, CircleX as f, Info as p, X as m } from "lucide-react";
|
|
8
|
-
import { forwardRef as h, useRef as g, useState as _ } from "react";
|
|
9
|
-
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
10
|
-
import { createRoot as b } from "react-dom/client";
|
|
11
|
-
//#region components/MessageBox/MessageBox.tsx
|
|
12
|
-
var x = {
|
|
13
|
-
info: p,
|
|
14
|
-
success: d,
|
|
15
|
-
warning: u,
|
|
16
|
-
error: f
|
|
17
|
-
}, S = {
|
|
18
|
-
info: "primary",
|
|
19
|
-
success: "success",
|
|
20
|
-
warning: "warning",
|
|
21
|
-
error: "error"
|
|
22
|
-
}, C = { [s]: !0 }, w = (e) => (typeof e == "object" || typeof e == "function") && e !== null && "then" in e && typeof e.then == "function", T = h((r, i) => {
|
|
23
|
-
let { open: a, defaultOpen: o = !1, title: s = "提示", type: c = "info", showCancelButton: u = !1, confirmButtonText: d = "确定", confirmButtonLoadingText: f, cancelButtonText: p = "取消", width: h = 420, closeOnClickOverlay: b = !1, closeOnPressEscape: T = !0, showClose: E = !0, draggable: D = !1, className: O, children: k, onChange: A, onConfirm: j, onCancel: M, onClose: N, onConfirmError: P, ...F } = r, I = t(r, "open"), [L, R] = e({
|
|
24
|
-
value: !!a,
|
|
25
|
-
defaultValue: o,
|
|
26
|
-
controlled: I,
|
|
27
|
-
onChange: A
|
|
28
|
-
}), [z, B] = _(!1), V = g(!1), H = (e) => {
|
|
29
|
-
V.current || (e === "cancel" ? M?.() : N?.(), R(!1));
|
|
30
|
-
}, U = async () => {
|
|
31
|
-
if (!V.current) try {
|
|
32
|
-
let e = j?.();
|
|
33
|
-
w(e) && (V.current = !0, B(!0), await e), R(!1);
|
|
34
|
-
} catch (e) {
|
|
35
|
-
P?.(e);
|
|
36
|
-
} finally {
|
|
37
|
-
V.current = !1, B(!1);
|
|
38
|
-
}
|
|
39
|
-
}, W = x[c], G = [
|
|
40
|
-
"vl-message-box",
|
|
41
|
-
`is-${c}`,
|
|
42
|
-
O || ""
|
|
43
|
-
].filter(Boolean).join(" ");
|
|
44
|
-
return /* @__PURE__ */ v(l, {
|
|
45
|
-
...F,
|
|
46
|
-
ref: i,
|
|
47
|
-
open: L,
|
|
48
|
-
title: s,
|
|
49
|
-
width: h,
|
|
50
|
-
draggable: D,
|
|
51
|
-
closeOnClickOverlay: !z && b,
|
|
52
|
-
closeOnPressEscape: !z && T,
|
|
53
|
-
showClose: !1,
|
|
54
|
-
className: G,
|
|
55
|
-
header: /* @__PURE__ */ y("div", {
|
|
56
|
-
className: "vl-message-box__header",
|
|
57
|
-
children: [/* @__PURE__ */ v("div", {
|
|
58
|
-
className: "vl-message-box__title",
|
|
59
|
-
children: s
|
|
60
|
-
}), E ? /* @__PURE__ */ v("button", {
|
|
61
|
-
type: "button",
|
|
62
|
-
className: "vl-modal__close",
|
|
63
|
-
"aria-label": "关闭消息框",
|
|
64
|
-
disabled: z,
|
|
65
|
-
onClick: () => H("close"),
|
|
66
|
-
children: /* @__PURE__ */ v(m, {
|
|
67
|
-
size: 20,
|
|
68
|
-
"aria-hidden": "true"
|
|
69
|
-
})
|
|
70
|
-
}) : null]
|
|
71
|
-
}),
|
|
72
|
-
footer: /* @__PURE__ */ y("div", {
|
|
73
|
-
className: "vl-message-box__actions",
|
|
74
|
-
children: [u ? /* @__PURE__ */ v(n, {
|
|
75
|
-
disabled: z,
|
|
76
|
-
onClick: () => H("cancel"),
|
|
77
|
-
children: p
|
|
78
|
-
}) : null, /* @__PURE__ */ v(n, {
|
|
79
|
-
...C,
|
|
80
|
-
status: S[c],
|
|
81
|
-
variant: "solid",
|
|
82
|
-
loading: z,
|
|
83
|
-
loadingText: f,
|
|
84
|
-
onClick: U,
|
|
85
|
-
children: d
|
|
86
|
-
})]
|
|
87
|
-
}),
|
|
88
|
-
onChange: (e) => {
|
|
89
|
-
e || H("close");
|
|
90
|
-
},
|
|
91
|
-
children: /* @__PURE__ */ y("div", {
|
|
92
|
-
className: "vl-message-box__content",
|
|
93
|
-
children: [/* @__PURE__ */ v(W, {
|
|
94
|
-
className: "vl-message-box__icon",
|
|
95
|
-
"aria-hidden": "true"
|
|
96
|
-
}), /* @__PURE__ */ v("div", {
|
|
97
|
-
className: "vl-message-box__message",
|
|
98
|
-
children: k
|
|
99
|
-
})]
|
|
100
|
-
})
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
T.displayName = "VlMessageBox";
|
|
104
|
-
//#endregion
|
|
105
|
-
//#region components/MessageBox/service.tsx
|
|
106
|
-
var E = /* @__PURE__ */ new Set(), D = (e, t = {}, n) => typeof document > "u" ? Promise.reject(/* @__PURE__ */ Error("VlMessageBox imperative APIs are only available in a browser environment.")) : new Promise((s, l) => {
|
|
107
|
-
let u = /* @__PURE__ */ new Map();
|
|
108
|
-
for (let e of [...c(), ...E]) {
|
|
109
|
-
let t = u.get(e.base);
|
|
110
|
-
(!t || e.offset > t.offset) && u.set(e.base, e);
|
|
111
|
-
}
|
|
112
|
-
let d = [...u.values()], f = d.length > 1 ? {
|
|
113
|
-
base: `max(${d.map(r).join(", ")})`,
|
|
114
|
-
offset: 0
|
|
115
|
-
} : d[0], p = t.zIndex ?? (typeof t.style?.zIndex == "number" ? t.style.zIndex : void 0), m = p === void 0 ? f ? {
|
|
116
|
-
...f,
|
|
117
|
-
offset: f.offset + 2
|
|
118
|
-
} : {
|
|
119
|
-
base: a.modal,
|
|
120
|
-
offset: 0,
|
|
121
|
-
rank: i[a.modal]
|
|
122
|
-
} : {
|
|
123
|
-
base: p,
|
|
124
|
-
offset: 0
|
|
125
|
-
};
|
|
126
|
-
E.add(m);
|
|
127
|
-
let h = document.createElement("div");
|
|
128
|
-
h.className = "vl-message-box-container", document.body.appendChild(h);
|
|
129
|
-
let g = b(h), y = () => {
|
|
130
|
-
let [r, i] = _(!0);
|
|
131
|
-
return /* @__PURE__ */ v(T, {
|
|
132
|
-
...t,
|
|
133
|
-
open: r,
|
|
134
|
-
showCancelButton: n,
|
|
135
|
-
onChange: i,
|
|
136
|
-
onConfirm: async () => {
|
|
137
|
-
await t.onConfirm?.(), s("confirm");
|
|
138
|
-
},
|
|
139
|
-
onCancel: () => {
|
|
140
|
-
t.onCancel?.(), l("cancel");
|
|
141
|
-
},
|
|
142
|
-
onClose: () => {
|
|
143
|
-
t.onClose?.(), l("close");
|
|
144
|
-
},
|
|
145
|
-
onAfterClose: () => {
|
|
146
|
-
try {
|
|
147
|
-
t.onAfterClose?.();
|
|
148
|
-
} finally {
|
|
149
|
-
queueMicrotask(() => {
|
|
150
|
-
g.unmount(), h.remove(), E.delete(m);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
children: e
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
g.render(f ? /* @__PURE__ */ v(o, {
|
|
158
|
-
layer: f,
|
|
159
|
-
children: /* @__PURE__ */ v(y, {})
|
|
160
|
-
}) : /* @__PURE__ */ v(y, {}));
|
|
161
|
-
}), O = Object.assign(T, {
|
|
162
|
-
alert: (e, t) => D(e, t, !1),
|
|
163
|
-
confirm: (e, t) => D(e, t, !0)
|
|
164
|
-
});
|
|
165
|
-
//#endregion
|
|
166
|
-
export { O as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./state-BuUx1onZ.cjs"),t=require("./Button-qURrKHQ0.cjs"),n=require("./layer-DL1xVbJT.cjs"),r=require("./focus-D-h8CbGr.cjs"),i=require("./dialog-shell-B7mE8A1p.cjs"),a=require("./Modal-BKvRyCXZ.cjs");let o=require("lucide-react"),s=require("react"),c=require("react/jsx-runtime"),l=require("react-dom/client");var u={info:o.Info,success:o.CircleCheck,warning:o.CircleAlert,error:o.CircleX},d={info:`primary`,success:`success`,warning:`warning`,error:`error`},f={[r.t]:!0},p=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,m=(0,s.forwardRef)((n,r)=>{let{open:i,defaultOpen:l=!1,title:m=`提示`,type:h=`info`,showCancelButton:g=!1,confirmButtonText:_=`确定`,confirmButtonLoadingText:v,cancelButtonText:y=`取消`,width:b=420,closeOnClickOverlay:x=!1,closeOnPressEscape:S=!0,showClose:C=!0,draggable:w=!1,className:T,children:E,onChange:D,onConfirm:O,onCancel:k,onClose:A,onConfirmError:j,...M}=n,N=e.t(n,`open`),[P,F]=e.n({value:!!i,defaultValue:l,controlled:N,onChange:D}),[I,L]=(0,s.useState)(!1),R=(0,s.useRef)(!1),z=e=>{R.current||(e===`cancel`?k?.():A?.(),F(!1))},B=async()=>{if(!R.current)try{let e=O?.();p(e)&&(R.current=!0,L(!0),await e),F(!1)}catch(e){j?.(e)}finally{R.current=!1,L(!1)}},V=u[h],H=[`vl-message-box`,`is-${h}`,T||``].filter(Boolean).join(` `);return(0,c.jsx)(a.t,{...M,ref:r,open:P,title:m,width:b,draggable:w,closeOnClickOverlay:!I&&x,closeOnPressEscape:!I&&S,showClose:!1,className:H,header:(0,c.jsxs)(`div`,{className:`vl-message-box__header`,children:[(0,c.jsx)(`div`,{className:`vl-message-box__title`,children:m}),C?(0,c.jsx)(`button`,{type:`button`,className:`vl-modal__close`,"aria-label":`关闭消息框`,disabled:I,onClick:()=>z(`close`),children:(0,c.jsx)(o.X,{size:20,"aria-hidden":`true`})}):null]}),footer:(0,c.jsxs)(`div`,{className:`vl-message-box__actions`,children:[g?(0,c.jsx)(t.t,{disabled:I,onClick:()=>z(`cancel`),children:y}):null,(0,c.jsx)(t.t,{...f,status:d[h],variant:`solid`,loading:I,loadingText:v,onClick:B,children:_})]}),onChange:e=>{e||z(`close`)},children:(0,c.jsxs)(`div`,{className:`vl-message-box__content`,children:[(0,c.jsx)(V,{className:`vl-message-box__icon`,"aria-hidden":`true`}),(0,c.jsx)(`div`,{className:`vl-message-box__message`,children:E})]})})});m.displayName=`VlMessageBox`;var h=new Set,g=(e,t={},r)=>typeof document>`u`?Promise.reject(Error(`VlMessageBox imperative APIs are only available in a browser environment.`)):new Promise((a,o)=>{let u=new Map;for(let e of[...i.r(),...h]){let t=u.get(e.base);(!t||e.offset>t.offset)&&u.set(e.base,e)}let d=[...u.values()],f=d.length>1?{base:`max(${d.map(n.i).join(`, `)})`,offset:0}:d[0],p=t.zIndex??(typeof t.style?.zIndex==`number`?t.style.zIndex:void 0),g=p===void 0?f?{...f,offset:f.offset+2}:{base:n.r.modal,offset:0,rank:n.n[n.r.modal]}:{base:p,offset:0};h.add(g);let _=document.createElement(`div`);_.className=`vl-message-box-container`,document.body.appendChild(_);let v=(0,l.createRoot)(_),y=()=>{let[n,i]=(0,s.useState)(!0);return(0,c.jsx)(m,{...t,open:n,showCancelButton:r,onChange:i,onConfirm:async()=>{await t.onConfirm?.(),a(`confirm`)},onCancel:()=>{t.onCancel?.(),o(`cancel`)},onClose:()=>{t.onClose?.(),o(`close`)},onAfterClose:()=>{try{t.onAfterClose?.()}finally{queueMicrotask(()=>{v.unmount(),_.remove(),h.delete(g)})}},children:e})};v.render(f?(0,c.jsx)(n.t,{layer:f,children:(0,c.jsx)(y,{})}):(0,c.jsx)(y,{}))}),_=Object.assign(m,{alert:(e,t)=>g(e,t,!1),confirm:(e,t)=>g(e,t,!0)});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
|