@ifhover/leaf-ui 0.17.1 → 0.17.2
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/cjs/browser/modules/drawer/drawer.cjs +8 -0
- package/dist/cjs/browser/modules/drawer/drawer.cjs.map +1 -1
- package/dist/cjs/browser/modules/image/viewer.cjs +2 -0
- package/dist/cjs/browser/modules/image/viewer.cjs.map +1 -1
- package/dist/cjs/browser/modules/modal/base.cjs +8 -0
- package/dist/cjs/browser/modules/modal/base.cjs.map +1 -1
- package/dist/cjs/browser/modules/shared/dialog.cjs +74 -2
- package/dist/cjs/browser/modules/shared/dialog.cjs.map +1 -1
- package/dist/cjs/browser/modules/tour/tour.cjs +75 -64
- package/dist/cjs/browser/modules/tour/tour.cjs.map +1 -1
- package/dist/cjs/drawer/drawer.cjs +8 -0
- package/dist/cjs/drawer/drawer.cjs.map +1 -1
- package/dist/cjs/drawer/drawer.d.cts.map +1 -1
- package/dist/cjs/image/viewer.cjs +2 -0
- package/dist/cjs/image/viewer.cjs.map +1 -1
- package/dist/cjs/modal/base.cjs +8 -0
- package/dist/cjs/modal/base.cjs.map +1 -1
- package/dist/cjs/modal/base.d.cts.map +1 -1
- package/dist/cjs/shared/dialog.cjs +74 -2
- package/dist/cjs/shared/dialog.cjs.map +1 -1
- package/dist/cjs/shared/dialog.d.cts +10 -1
- package/dist/cjs/shared/dialog.d.cts.map +1 -1
- package/dist/cjs/styles/components/tour.css +1 -1
- package/dist/cjs/styles/index.css +2 -2
- package/dist/cjs/styles/index.css.map +1 -1
- package/dist/cjs/styles/tour.css +1 -1
- package/dist/cjs/tour/tour.cjs +75 -64
- package/dist/cjs/tour/tour.cjs.map +1 -1
- package/dist/cjs/tour/tour.d.cts.map +1 -1
- package/dist/esm/browser/modules/drawer/drawer.js +9 -1
- package/dist/esm/browser/modules/drawer/drawer.js.map +1 -1
- package/dist/esm/browser/modules/image/viewer.js +3 -1
- package/dist/esm/browser/modules/image/viewer.js.map +1 -1
- package/dist/esm/browser/modules/modal/base.js +9 -1
- package/dist/esm/browser/modules/modal/base.js.map +1 -1
- package/dist/esm/browser/modules/shared/dialog.js +71 -2
- package/dist/esm/browser/modules/shared/dialog.js.map +1 -1
- package/dist/esm/browser/modules/tour/tour.js +76 -65
- package/dist/esm/browser/modules/tour/tour.js.map +1 -1
- package/dist/esm/drawer/drawer.d.ts.map +1 -1
- package/dist/esm/drawer/drawer.js +9 -1
- package/dist/esm/drawer/drawer.js.map +1 -1
- package/dist/esm/image/viewer.js +3 -1
- package/dist/esm/image/viewer.js.map +1 -1
- package/dist/esm/modal/base.d.ts.map +1 -1
- package/dist/esm/modal/base.js +9 -1
- package/dist/esm/modal/base.js.map +1 -1
- package/dist/esm/shared/dialog.d.ts +10 -1
- package/dist/esm/shared/dialog.d.ts.map +1 -1
- package/dist/esm/shared/dialog.js +71 -2
- package/dist/esm/shared/dialog.js.map +1 -1
- package/dist/esm/styles/components/tour.css +1 -1
- package/dist/esm/styles/index.css +2 -2
- package/dist/esm/styles/index.css.map +1 -1
- package/dist/esm/styles/tour.css +1 -1
- package/dist/esm/tour/tour.d.ts.map +1 -1
- package/dist/esm/tour/tour.js +76 -65
- package/dist/esm/tour/tour.js.map +1 -1
- package/package.json +2 -2
|
@@ -29,12 +29,82 @@ var __webpack_require__ = {};
|
|
|
29
29
|
var __webpack_exports__ = {};
|
|
30
30
|
__webpack_require__.r(__webpack_exports__);
|
|
31
31
|
__webpack_require__.d(__webpack_exports__, {
|
|
32
|
-
useDialog: ()=>useDialog
|
|
32
|
+
useDialog: ()=>useDialog,
|
|
33
|
+
useOverlayLayer: ()=>useOverlayLayer
|
|
33
34
|
});
|
|
34
35
|
const external_react_namespaceObject = require("react");
|
|
35
36
|
const external_tabbable_namespaceObject = require("tabbable");
|
|
36
37
|
const external_dom_cjs_namespaceObject = require("./dom.cjs");
|
|
37
38
|
const stack = [];
|
|
39
|
+
const dialog_layers = [];
|
|
40
|
+
const OVERLAY_Z_STEP = 2;
|
|
41
|
+
const useBrowserLayoutEffect = "u" < typeof window ? external_react_namespaceObject.useEffect : external_react_namespaceObject.useLayoutEffect;
|
|
42
|
+
const overlayZIndex = (addend)=>`calc(var(--leaf-z-index-modal, 1100) + ${addend})`;
|
|
43
|
+
function releaseLayer(current) {
|
|
44
|
+
if (current) {
|
|
45
|
+
const index = dialog_layers.indexOf(current);
|
|
46
|
+
if (index >= 0) dialog_layers.splice(index, 1);
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
function useOverlayLayer(present, open = present) {
|
|
51
|
+
const [level, setLevel] = (0, external_react_namespaceObject.useState)(null);
|
|
52
|
+
const entry = (0, external_react_namespaceObject.useRef)(null);
|
|
53
|
+
const wasOpen = (0, external_react_namespaceObject.useRef)(false);
|
|
54
|
+
useBrowserLayoutEffect(()=>{
|
|
55
|
+
const opened = open && !wasOpen.current;
|
|
56
|
+
wasOpen.current = open;
|
|
57
|
+
if (!present) {
|
|
58
|
+
entry.current = releaseLayer(entry.current);
|
|
59
|
+
setLevel(null);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!entry.current || opened) {
|
|
63
|
+
entry.current = releaseLayer(entry.current);
|
|
64
|
+
const next = dialog_layers.length ? Math.max(...dialog_layers.map((item)=>item.level)) + 1 : 0;
|
|
65
|
+
const item = {
|
|
66
|
+
id: Symbol(),
|
|
67
|
+
level: next
|
|
68
|
+
};
|
|
69
|
+
dialog_layers.push(item);
|
|
70
|
+
entry.current = item;
|
|
71
|
+
setLevel(next);
|
|
72
|
+
}
|
|
73
|
+
}, [
|
|
74
|
+
present,
|
|
75
|
+
open
|
|
76
|
+
]);
|
|
77
|
+
useBrowserLayoutEffect(()=>()=>{
|
|
78
|
+
entry.current = releaseLayer(entry.current);
|
|
79
|
+
}, []);
|
|
80
|
+
return (0, external_react_namespaceObject.useMemo)(()=>{
|
|
81
|
+
const offset = null !== level && level > 0 ? level * OVERLAY_Z_STEP : 0;
|
|
82
|
+
if (0 === offset) return {
|
|
83
|
+
level,
|
|
84
|
+
offset: 0,
|
|
85
|
+
maskStyle: void 0,
|
|
86
|
+
popupStyle: void 0,
|
|
87
|
+
floatingStyle: void 0
|
|
88
|
+
};
|
|
89
|
+
const popupValue = overlayZIndex(offset + 1);
|
|
90
|
+
return {
|
|
91
|
+
level,
|
|
92
|
+
offset,
|
|
93
|
+
maskStyle: {
|
|
94
|
+
zIndex: overlayZIndex(offset)
|
|
95
|
+
},
|
|
96
|
+
popupStyle: {
|
|
97
|
+
'--leaf-z-index-popup': popupValue
|
|
98
|
+
},
|
|
99
|
+
floatingStyle: {
|
|
100
|
+
zIndex: popupValue,
|
|
101
|
+
'--leaf-z-index-popup': popupValue
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}, [
|
|
105
|
+
level
|
|
106
|
+
]);
|
|
107
|
+
}
|
|
38
108
|
let savedOverflow = '';
|
|
39
109
|
let scrollLocks = 0;
|
|
40
110
|
function useDialog(open, panel, owner, onClose, keyboard, options = {}, ready = true, modal = true) {
|
|
@@ -111,8 +181,10 @@ function useDialog(open, panel, owner, onClose, keyboard, options = {}, ready =
|
|
|
111
181
|
]);
|
|
112
182
|
}
|
|
113
183
|
exports.useDialog = __webpack_exports__.useDialog;
|
|
184
|
+
exports.useOverlayLayer = __webpack_exports__.useOverlayLayer;
|
|
114
185
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
115
|
-
"useDialog"
|
|
186
|
+
"useDialog",
|
|
187
|
+
"useOverlayLayer"
|
|
116
188
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
117
189
|
Object.defineProperty(exports, '__esModule', {
|
|
118
190
|
value: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared/dialog.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/shared/dialog.ts"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { type RefObject, useEffect, useRef } from 'react';\nimport { tabbable } from 'tabbable';\nimport { composedEventTarget, deepActiveElement } from './dom';\n\nconst stack: HTMLElement[] = [];\nexport type FocusTarget = RefObject<HTMLElement | null> | (() => HTMLElement | null);\nexport interface DialogFocusOptions {\n initialFocus?: FocusTarget;\n returnFocus?: boolean | FocusTarget;\n}\nlet savedOverflow = '';\nlet scrollLocks = 0;\n\n/** Share focus, Escape and scroll ownership between nested dialogs and drawers. */\nexport function useDialog(\n open: boolean,\n panel: RefObject<HTMLDivElement | null>,\n owner: string,\n onClose: () => void,\n keyboard: boolean,\n options: DialogFocusOptions = {},\n ready = true,\n modal = true,\n) {\n const focusOptions = useRef(options);\n focusOptions.current = options;\n const close = useRef(onClose);\n close.current = onClose;\n const keyboardRef = useRef(keyboard);\n keyboardRef.current = keyboard;\n useEffect(() => {\n const node = panel.current;\n if (!open || !node || !ready) return;\n const active = deepActiveElement();\n const previous = active instanceof HTMLElement ? active : null;\n const focusable = () =>\n tabbable(node, { getShadowRoot: (element) => element.shadowRoot ?? undefined });\n if (modal && scrollLocks++ === 0) {\n savedOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n stack.push(node);\n const resolve = (target?: FocusTarget) =>\n typeof target === 'function' ? target() : target?.current;\n (resolve(focusOptions.current.initialFocus) ?? focusable()[0] ?? node).focus();\n const key = (event: KeyboardEvent) => {\n if (stack.at(-1) !== node || event.defaultPrevented) return;\n if (event.key === 'Escape' && keyboardRef.current) {\n event.preventDefault();\n event.stopPropagation();\n close.current();\n }\n if (event.key === 'Tab') {\n if (!modal) return;\n const items = focusable();\n if (!items.length) {\n event.preventDefault();\n node.focus();\n return;\n }\n const index = items.indexOf(deepActiveElement() as HTMLElement);\n if (event.shiftKey && index <= 0) {\n event.preventDefault();\n items.at(-1)?.focus();\n } else if (!event.shiftKey && (index < 0 || index === items.length - 1)) {\n event.preventDefault();\n items[0]?.focus();\n }\n }\n };\n const focus = (event: FocusEvent) => {\n const target = composedEventTarget(event);\n if (\n stack.at(-1) === node &&\n modal &&\n target instanceof HTMLElement &&\n !event.composedPath().includes(node) &&\n target.closest('[data-leaf-owner]')?.getAttribute('data-leaf-owner') !== owner\n )\n (focusable()[0] ?? node).focus();\n };\n document.addEventListener('keydown', key);\n document.addEventListener('focusin', focus);\n return () => {\n document.removeEventListener('keydown', key);\n document.removeEventListener('focusin', focus);\n const wasTop = stack.at(-1) === node;\n const index = stack.indexOf(node);\n if (index >= 0) stack.splice(index, 1);\n if (modal && --scrollLocks === 0) document.body.style.overflow = savedOverflow;\n if (wasTop && focusOptions.current.returnFocus !== false) {\n const destination =\n typeof focusOptions.current.returnFocus === 'object' ||\n typeof focusOptions.current.returnFocus === 'function'\n ? resolve(focusOptions.current.returnFocus)\n : previous;\n if (destination?.isConnected) destination.focus();\n }\n };\n }, [open, panel, owner, ready, modal]);\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","stack","savedOverflow","scrollLocks","useDialog","open","panel","owner","onClose","keyboard","options","ready","modal","focusOptions","useRef","close","keyboardRef","useEffect","node","active","deepActiveElement","previous","HTMLElement","focusable","tabbable","element","undefined","document","resolve","target","event","items","index","focus","composedEventTarget","wasTop","destination"],"mappings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vC"}
|
|
1
|
+
{"version":3,"file":"shared/dialog.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/shared/dialog.ts"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\n type CSSProperties,\n type RefObject,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { tabbable } from 'tabbable';\nimport { composedEventTarget, deepActiveElement } from './dom';\n\nconst stack: HTMLElement[] = [];\nconst layers: { id: symbol; level: number }[] = [];\nconst OVERLAY_Z_STEP = 2;\nconst useBrowserLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\nconst overlayZIndex = (addend: number) => `calc(var(--leaf-z-index-modal, 1100) + ${addend})`;\n\nfunction releaseLayer(current: { id: symbol; level: number } | null) {\n if (current) {\n const index = layers.indexOf(current);\n if (index >= 0) layers.splice(index, 1);\n }\n return null;\n}\n\nexport interface OverlayLayer {\n level: number | null;\n offset: number;\n maskStyle: CSSProperties | undefined;\n popupStyle: CSSProperties | undefined;\n floatingStyle: CSSProperties | undefined;\n}\n\n/** 按浮层实际激活生命周期分配递增叠层,退场期间保留原层级直至完全卸载/隐藏。 */\nexport function useOverlayLayer(present: boolean, open = present): OverlayLayer {\n const [level, setLevel] = useState<number | null>(null);\n const entry = useRef<{ id: symbol; level: number } | null>(null);\n const wasOpen = useRef(false);\n\n useBrowserLayoutEffect(() => {\n const opened = open && !wasOpen.current;\n wasOpen.current = open;\n if (!present) {\n entry.current = releaseLayer(entry.current);\n setLevel(null);\n return;\n }\n // 首次进入展示态,或在关闭动画尚未结束时重新打开,都分配当前最高叠层。\n if (!entry.current || opened) {\n entry.current = releaseLayer(entry.current);\n const next = layers.length ? Math.max(...layers.map((item) => item.level)) + 1 : 0;\n const item = { id: Symbol(), level: next };\n layers.push(item);\n entry.current = item;\n setLevel(next);\n }\n }, [present, open]);\n\n useBrowserLayoutEffect(\n () => () => {\n entry.current = releaseLayer(entry.current);\n },\n [],\n );\n\n return useMemo(() => {\n const offset = level !== null && level > 0 ? level * OVERLAY_Z_STEP : 0;\n if (offset === 0) {\n return {\n level,\n offset: 0,\n maskStyle: undefined,\n popupStyle: undefined,\n floatingStyle: undefined,\n };\n }\n const popupValue = overlayZIndex(offset + 1);\n return {\n level,\n offset,\n maskStyle: { zIndex: overlayZIndex(offset) },\n popupStyle: { '--leaf-z-index-popup': popupValue } as CSSProperties,\n floatingStyle: {\n zIndex: popupValue,\n '--leaf-z-index-popup': popupValue,\n } as CSSProperties,\n };\n }, [level]);\n}\nexport type FocusTarget = RefObject<HTMLElement | null> | (() => HTMLElement | null);\nexport interface DialogFocusOptions {\n initialFocus?: FocusTarget;\n returnFocus?: boolean | FocusTarget;\n}\nlet savedOverflow = '';\nlet scrollLocks = 0;\n\n/** Share focus, Escape and scroll ownership between nested dialogs and drawers. */\nexport function useDialog(\n open: boolean,\n panel: RefObject<HTMLDivElement | null>,\n owner: string,\n onClose: () => void,\n keyboard: boolean,\n options: DialogFocusOptions = {},\n ready = true,\n modal = true,\n) {\n const focusOptions = useRef(options);\n focusOptions.current = options;\n const close = useRef(onClose);\n close.current = onClose;\n const keyboardRef = useRef(keyboard);\n keyboardRef.current = keyboard;\n useEffect(() => {\n const node = panel.current;\n if (!open || !node || !ready) return;\n const active = deepActiveElement();\n const previous = active instanceof HTMLElement ? active : null;\n const focusable = () =>\n tabbable(node, { getShadowRoot: (element) => element.shadowRoot ?? undefined });\n if (modal && scrollLocks++ === 0) {\n savedOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n stack.push(node);\n const resolve = (target?: FocusTarget) =>\n typeof target === 'function' ? target() : target?.current;\n (resolve(focusOptions.current.initialFocus) ?? focusable()[0] ?? node).focus();\n const key = (event: KeyboardEvent) => {\n if (stack.at(-1) !== node || event.defaultPrevented) return;\n if (event.key === 'Escape' && keyboardRef.current) {\n event.preventDefault();\n event.stopPropagation();\n close.current();\n }\n if (event.key === 'Tab') {\n if (!modal) return;\n const items = focusable();\n if (!items.length) {\n event.preventDefault();\n node.focus();\n return;\n }\n const index = items.indexOf(deepActiveElement() as HTMLElement);\n if (event.shiftKey && index <= 0) {\n event.preventDefault();\n items.at(-1)?.focus();\n } else if (!event.shiftKey && (index < 0 || index === items.length - 1)) {\n event.preventDefault();\n items[0]?.focus();\n }\n }\n };\n const focus = (event: FocusEvent) => {\n const target = composedEventTarget(event);\n if (\n stack.at(-1) === node &&\n modal &&\n target instanceof HTMLElement &&\n !event.composedPath().includes(node) &&\n target.closest('[data-leaf-owner]')?.getAttribute('data-leaf-owner') !== owner\n )\n (focusable()[0] ?? node).focus();\n };\n document.addEventListener('keydown', key);\n document.addEventListener('focusin', focus);\n return () => {\n document.removeEventListener('keydown', key);\n document.removeEventListener('focusin', focus);\n const wasTop = stack.at(-1) === node;\n const index = stack.indexOf(node);\n if (index >= 0) stack.splice(index, 1);\n if (modal && --scrollLocks === 0) document.body.style.overflow = savedOverflow;\n if (wasTop && focusOptions.current.returnFocus !== false) {\n const destination =\n typeof focusOptions.current.returnFocus === 'object' ||\n typeof focusOptions.current.returnFocus === 'function'\n ? resolve(focusOptions.current.returnFocus)\n : previous;\n if (destination?.isConnected) destination.focus();\n }\n };\n }, [open, panel, owner, ready, modal]);\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","stack","layers","OVERLAY_Z_STEP","useBrowserLayoutEffect","window","useEffect","useLayoutEffect","overlayZIndex","addend","releaseLayer","current","index","useOverlayLayer","present","open","level","setLevel","useState","entry","useRef","wasOpen","opened","next","Math","item","useMemo","offset","undefined","popupValue","savedOverflow","scrollLocks","useDialog","panel","owner","onClose","keyboard","options","ready","modal","focusOptions","close","keyboardRef","node","active","deepActiveElement","previous","HTMLElement","focusable","tabbable","element","document","resolve","target","event","items","focus","composedEventTarget","wasTop","destination"],"mappings":";;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,IAAGJ,oBAAoB,CAAC,CAACI,MAAME,QAAQ,CAACN,oBAAoB,CAAC,CAAC,UAASM,MACtEC,OAAO,cAAc,CAAC,UAASD,KAAK;gBAAE,YAAY;gBAAM,CAACD,KAAK,EAAED,IAAI,CAACE,IAAI;YAAC;QAG7E;QACAH,OAAOF,SAAS;QAChBE,OAAOD,QAAQ;IAChB;;;ICVAF,oBAAoB,CAAC,GAAG,CAACQ,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFT,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOU,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;ACMA,MAAMI,QAAuB,EAAE;AAC/B,MAAMC,gBAA0C,EAAE;AAClD,MAAMC,iBAAiB;AACvB,MAAMC,yBAAyB,AAAkB,MAAlB,OAAOC,SAAyBC,+BAAAA,SAASA,GAAGC,+BAAAA,eAAeA;AAE1F,MAAMC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GAAG,QAAQ,CAACX,SAC/BU,OAAO,OAAO,CAAC,sBAAsB,aAAa,uBAAuBnB,OAExEc,AAAAA,CAAAA,WAAW,CAAC,EAAE,IAAIL,IAAG,EAAG,KAAK;QAClC;QACAQ,SAAS,gBAAgB,CAAC,WAAWvD;QACrCuD,SAAS,gBAAgB,CAAC,WAAWK;QACrC,OAAO;YACLL,SAAS,mBAAmB,CAAC,WAAWvD;YACxCuD,SAAS,mBAAmB,CAAC,WAAWK;YACxC,MAAME,SAASzD,MAAM,EAAE,CAAC,QAAQ0C;YAChC,MAAM/B,QAAQX,MAAM,OAAO,CAAC0C;YAC5B,IAAI/B,SAAS,GAAGX,MAAM,MAAM,CAACW,OAAO;YACpC,IAAI2B,SAAS,AAAkB,MAAlB,EAAER,aAAmBoB,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAGrB;YACjE,IAAI4B,UAAUlB,AAAqC,UAArCA,aAAa,OAAO,CAAC,WAAW,EAAY;gBACxD,MAAMmB,cACJ,AAA4C,YAA5C,OAAOnB,aAAa,OAAO,CAAC,WAAW,IACvC,AAA4C,cAA5C,OAAOA,aAAa,OAAO,CAAC,WAAW,GACnCY,QAAQZ,aAAa,OAAO,CAAC,WAAW,IACxCM;gBACN,IAAIa,aAAa,aAAaA,YAAY,KAAK;YACjD;QACF;IACF,GAAG;QAAC5C;QAAMkB;QAAOC;QAAOI;QAAOC;KAAM;AACvC"}
|
|
@@ -50,6 +50,10 @@ function TourFocus({ panel, owner, close, modal, open, children }) {
|
|
|
50
50
|
(0, dialog_cjs_namespaceObject.useDialog)(open, panel, owner, close, true, {}, true, modal);
|
|
51
51
|
return children;
|
|
52
52
|
}
|
|
53
|
+
function TourStage({ present, active, children }) {
|
|
54
|
+
const layer = (0, dialog_cjs_namespaceObject.useOverlayLayer)(present, active);
|
|
55
|
+
return children(layer);
|
|
56
|
+
}
|
|
53
57
|
function Tour(rawProps) {
|
|
54
58
|
const { open, steps, current, defaultCurrent = 0, onChange, onClose, onFinish, missingTarget = 'center', mask = true, padding = 8, getPopupContainer } = (0, component_defaults_cjs_namespaceObject.useComponentProps)('Tour', rawProps);
|
|
55
59
|
const t = (0, use_text_cjs_namespaceObject.useText)();
|
|
@@ -178,74 +182,81 @@ function Tour(rawProps) {
|
|
|
178
182
|
});
|
|
179
183
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(scoped_portal_cjs_namespaceObject.ScopedPortal, {
|
|
180
184
|
container: getPopupContainer,
|
|
181
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
children:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
185
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TourStage, {
|
|
186
|
+
present: present,
|
|
187
|
+
active: open && Boolean(step),
|
|
188
|
+
children: (layer)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
189
|
+
ref: root,
|
|
190
|
+
className: "leaf-tour-root",
|
|
191
|
+
style: layer.maskStyle,
|
|
192
|
+
"data-state": open ? 'open' : 'closing',
|
|
193
|
+
"aria-hidden": !open || void 0,
|
|
194
|
+
...(0, inert_cjs_namespaceObject.inertProps)(!open),
|
|
195
|
+
children: [
|
|
196
|
+
mask && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
197
|
+
className: "leaf-tour__mask",
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
children: rect ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
200
|
+
children: [
|
|
201
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
202
|
+
style: {
|
|
203
|
+
inset: "0 0 auto 0",
|
|
204
|
+
height: Math.max(0, rect.top - padding)
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
208
|
+
style: {
|
|
209
|
+
inset: `${rect.bottom + padding}px 0 0 0`
|
|
210
|
+
}
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
213
|
+
style: {
|
|
214
|
+
top: rect.top - padding,
|
|
215
|
+
left: 0,
|
|
216
|
+
width: Math.max(0, rect.left - padding),
|
|
217
|
+
height: rect.height + 2 * padding
|
|
218
|
+
}
|
|
219
|
+
}),
|
|
220
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
221
|
+
style: {
|
|
222
|
+
top: rect.top - padding,
|
|
223
|
+
left: rect.right + padding,
|
|
224
|
+
right: 0,
|
|
225
|
+
height: rect.height + 2 * padding
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
213
230
|
style: {
|
|
214
|
-
|
|
215
|
-
left: rect.right + padding,
|
|
216
|
-
right: 0,
|
|
217
|
-
height: rect.height + 2 * padding
|
|
231
|
+
inset: 0
|
|
218
232
|
}
|
|
219
233
|
})
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
className: "leaf-tour leaf-tour--center",
|
|
246
|
-
children: content
|
|
234
|
+
}),
|
|
235
|
+
rect ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(floating_cjs_namespaceObject.FloatingPanel, {
|
|
236
|
+
open: open,
|
|
237
|
+
triggerRef: target,
|
|
238
|
+
panelRef: panel,
|
|
239
|
+
placement: step.placement ?? 'bottom',
|
|
240
|
+
container: getPopupContainer,
|
|
241
|
+
role: "dialog",
|
|
242
|
+
"aria-modal": mask || void 0,
|
|
243
|
+
"aria-labelledby": `${id}-title`,
|
|
244
|
+
className: "leaf-floating leaf-tour",
|
|
245
|
+
style: layer.floatingStyle,
|
|
246
|
+
tabIndex: -1,
|
|
247
|
+
children: content
|
|
248
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
249
|
+
ref: panel,
|
|
250
|
+
role: "dialog",
|
|
251
|
+
"aria-modal": mask || void 0,
|
|
252
|
+
"aria-labelledby": `${id}-title`,
|
|
253
|
+
tabIndex: -1,
|
|
254
|
+
className: "leaf-tour leaf-tour--center",
|
|
255
|
+
style: layer.floatingStyle,
|
|
256
|
+
children: content
|
|
257
|
+
})
|
|
258
|
+
]
|
|
247
259
|
})
|
|
248
|
-
]
|
|
249
260
|
})
|
|
250
261
|
});
|
|
251
262
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tour/tour.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/tour/tour.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { X } from 'lucide-react';\nimport { type ReactNode, type RefObject, useEffect, useId, useRef, useState } from 'react';\nimport { ButtonControl } from '../button/button';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { useLeafConfig } from '../config-provider/context';\nimport { useDialog } from '../shared/dialog';\nimport { FloatingPanel, type PopupOptions } from '../shared/floating';\nimport { inertProps } from '../shared/inert';\nimport { useContentTransition, usePresence } from '../shared/presence';\nimport { ScopedPortal } from '../shared/scoped-portal';\nimport { useControllable } from '../shared/use-controllable';\nimport { useText } from '../shared/use-text';\nexport interface TourStep {\n key?: string;\n title: ReactNode;\n description?: ReactNode;\n target?: string | (() => HTMLElement | null);\n placement?: PopupOptions['popupPlacement'];\n}\nexport interface TourProps {\n open: boolean;\n steps: readonly TourStep[];\n current?: number;\n defaultCurrent?: number;\n onChange?: (current: number) => void;\n onClose?: () => void;\n onFinish?: () => void;\n missingTarget?: 'center' | 'skip' | 'close';\n mask?: boolean;\n padding?: number;\n getPopupContainer?: PopupOptions['getPopupContainer'];\n}\nfunction TourFocus({\n panel,\n owner,\n close,\n modal,\n open,\n children,\n}: {\n panel: RefObject<HTMLDivElement | null>;\n owner: string;\n close: () => void;\n modal: boolean;\n open: boolean;\n children: ReactNode;\n}) {\n useDialog(open, panel, owner, close, true, {}, true, modal);\n return children;\n}\nexport function Tour(rawProps: TourProps) {\n const {\n open,\n steps,\n current,\n defaultCurrent = 0,\n onChange,\n onClose,\n onFinish,\n missingTarget = 'center',\n mask = true,\n padding = 8,\n getPopupContainer,\n } = useComponentProps('Tour', rawProps);\n const t = useText();\n const { messages } = useLeafConfig();\n const [index, setIndex] = useControllable(current, defaultCurrent, onChange);\n const latestStep = useRef(steps[index]);\n if (open && steps[index]) latestStep.current = steps[index];\n const step = open ? steps[index] : latestStep.current;\n const target = useRef<HTMLElement | null>(null),\n panel = useRef<HTMLDivElement>(null);\n const root = useRef<HTMLDivElement>(null);\n const contentView = useRef<HTMLDivElement>(null);\n const present = usePresence(open && Boolean(step), root);\n useContentTransition(contentView, `${open}:${index}`);\n const id = useId();\n const [rect, setRect] = useState<DOMRect | null>(null);\n const callbacks = useRef({ setIndex, onClose });\n callbacks.current = { setIndex, onClose };\n useEffect(() => {\n if (!open || !step) return;\n let frame = 0;\n const node =\n typeof step.target === 'string'\n ? document.querySelector<HTMLElement>(step.target)\n : step.target?.();\n target.current = node ?? null;\n if (!node) {\n setRect(null);\n if (missingTarget === 'skip' && index < steps.length - 1)\n callbacks.current.setIndex(index + 1);\n else if (missingTarget === 'close' || missingTarget === 'skip') callbacks.current.onClose?.();\n return;\n }\n node.scrollIntoView?.({ block: 'center', behavior: 'instant' });\n const update = () => {\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => setRect(node.getBoundingClientRect()));\n };\n const observer = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(update) : undefined;\n observer?.observe(node);\n window.addEventListener('scroll', update, true);\n window.addEventListener('resize', update);\n update();\n return () => {\n cancelAnimationFrame(frame);\n observer?.disconnect();\n window.removeEventListener('scroll', update, true);\n window.removeEventListener('resize', update);\n };\n }, [open, step, index, missingTarget, steps.length]);\n if (!present || !step) return null;\n const content = (\n <TourFocus panel={panel} owner={id} close={() => onClose?.()} modal={mask} open={open}>\n <div ref={contentView} className=\"leaf-tour__content\">\n <div className=\"leaf-tour__header\">\n <h3 id={`${id}-title`}>{step.title}</h3>\n <ButtonControl\n size=\"sm\"\n variant=\"text\"\n startIcon={<X size={16} />}\n aria-label={messages.common.close}\n onClick={onClose}\n />\n </div>\n <div className=\"leaf-tour__description\">{step.description}</div>\n <div className=\"leaf-tour__footer\">\n <span>\n {index + 1} / {steps.length}\n </span>\n {index > 0 && (\n <ButtonControl size=\"sm\" variant=\"outline\" onClick={() => setIndex(index - 1)}>\n {t('tour.previous')}\n </ButtonControl>\n )}\n <ButtonControl\n size=\"sm\"\n variant=\"solid\"\n onClick={() => {\n if (index < steps.length - 1) setIndex(index + 1);\n else {\n onFinish?.();\n onClose?.();\n }\n }}\n >\n {index === steps.length - 1 ? t('tour.finish') : t('tour.next')}\n </ButtonControl>\n </div>\n </div>\n </TourFocus>\n );\n return (\n <ScopedPortal container={getPopupContainer}>\n <div\n ref={root}\n className=\"leaf-tour-root\"\n data-state={open ? 'open' : 'closing'}\n aria-hidden={!open || undefined}\n {...inertProps(!open)}\n >\n {mask && (\n <div className=\"leaf-tour__mask\" aria-hidden=\"true\">\n {rect ? (\n <>\n <div style={{ inset: `0 0 auto 0`, height: Math.max(0, rect.top - padding) }} />\n <div style={{ inset: `${rect.bottom + padding}px 0 0 0` }} />\n <div\n style={{\n top: rect.top - padding,\n left: 0,\n width: Math.max(0, rect.left - padding),\n height: rect.height + 2 * padding,\n }}\n />\n <div\n style={{\n top: rect.top - padding,\n left: rect.right + padding,\n right: 0,\n height: rect.height + 2 * padding,\n }}\n />\n </>\n ) : (\n <div style={{ inset: 0 }} />\n )}\n </div>\n )}\n {rect ? (\n <FloatingPanel\n open={open}\n triggerRef={target}\n panelRef={panel}\n placement={step.placement ?? 'bottom'}\n container={getPopupContainer}\n role=\"dialog\"\n aria-modal={mask || undefined}\n aria-labelledby={`${id}-title`}\n className=\"leaf-floating leaf-tour\"\n tabIndex={-1}\n >\n {content}\n </FloatingPanel>\n ) : (\n <div\n ref={panel}\n role=\"dialog\"\n aria-modal={mask || undefined}\n aria-labelledby={`${id}-title`}\n tabIndex={-1}\n className=\"leaf-tour leaf-tour--center\"\n >\n {content}\n </div>\n )}\n </div>\n </ScopedPortal>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","TourFocus","panel","owner","close","modal","open","children","useDialog","Tour","rawProps","steps","current","defaultCurrent","onChange","onClose","onFinish","missingTarget","mask","padding","getPopupContainer","useComponentProps","t","useText","messages","useLeafConfig","index","setIndex","useControllable","latestStep","useRef","step","target","root","contentView","present","usePresence","Boolean","useContentTransition","id","useId","rect","setRect","useState","callbacks","useEffect","frame","node","document","update","cancelAnimationFrame","requestAnimationFrame","observer","ResizeObserver","undefined","window","content","ButtonControl","X","ScopedPortal","inertProps","Math","FloatingPanel"],"mappings":";;;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,IAAGJ,oBAAoB,CAAC,CAACI,MAAME,QAAQ,CAACN,oBAAoB,CAAC,CAAC,UAASM,MACtEC,OAAO,cAAc,CAAC,UAASD,KAAK;gBAAE,YAAY;gBAAM,CAACD,KAAK,EAAED,IAAI,CAACE,IAAI;YAAC;QAG7E;QACAH,OAAOF,SAAS;QAChBE,OAAOD,QAAQ;IAChB;;;ICVAF,oBAAoB,CAAC,GAAG,CAACQ,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFT,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOU,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;;AC0BA,SAASI,UAAU,EACjBC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,IAAI,EACJC,QAAQ,EAQT;IACCC,IAAAA,2BAAAA,SAAAA,AAAAA,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UAAU;oBACV,WAAU;8BAETiB;;;;;AAMb"}
|
|
1
|
+
{"version":3,"file":"tour/tour.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../../../src/tour/tour.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { X } from 'lucide-react';\nimport { type ReactNode, type RefObject, useEffect, useId, useRef, useState } from 'react';\nimport { ButtonControl } from '../button/button';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { useLeafConfig } from '../config-provider/context';\nimport { type OverlayLayer, useDialog, useOverlayLayer } from '../shared/dialog';\nimport { FloatingPanel, type PopupOptions } from '../shared/floating';\nimport { inertProps } from '../shared/inert';\nimport { useContentTransition, usePresence } from '../shared/presence';\nimport { ScopedPortal } from '../shared/scoped-portal';\nimport { useControllable } from '../shared/use-controllable';\nimport { useText } from '../shared/use-text';\nexport interface TourStep {\n key?: string;\n title: ReactNode;\n description?: ReactNode;\n target?: string | (() => HTMLElement | null);\n placement?: PopupOptions['popupPlacement'];\n}\nexport interface TourProps {\n open: boolean;\n steps: readonly TourStep[];\n current?: number;\n defaultCurrent?: number;\n onChange?: (current: number) => void;\n onClose?: () => void;\n onFinish?: () => void;\n missingTarget?: 'center' | 'skip' | 'close';\n mask?: boolean;\n padding?: number;\n getPopupContainer?: PopupOptions['getPopupContainer'];\n}\nfunction TourFocus({\n panel,\n owner,\n close,\n modal,\n open,\n children,\n}: {\n panel: RefObject<HTMLDivElement | null>;\n owner: string;\n close: () => void;\n modal: boolean;\n open: boolean;\n children: ReactNode;\n}) {\n useDialog(open, panel, owner, close, true, {}, true, modal);\n return children;\n}\nfunction TourStage({\n present,\n active,\n children,\n}: {\n present: boolean;\n active: boolean;\n children: (layer: OverlayLayer) => ReactNode;\n}) {\n // 在 ScopedPortal 就绪后分配叠层,确保与 Modal/Drawer 同轮挂载时叠层顺序一致。\n const layer = useOverlayLayer(present, active);\n return children(layer);\n}\nexport function Tour(rawProps: TourProps) {\n const {\n open,\n steps,\n current,\n defaultCurrent = 0,\n onChange,\n onClose,\n onFinish,\n missingTarget = 'center',\n mask = true,\n padding = 8,\n getPopupContainer,\n } = useComponentProps('Tour', rawProps);\n const t = useText();\n const { messages } = useLeafConfig();\n const [index, setIndex] = useControllable(current, defaultCurrent, onChange);\n const latestStep = useRef(steps[index]);\n if (open && steps[index]) latestStep.current = steps[index];\n const step = open ? steps[index] : latestStep.current;\n const target = useRef<HTMLElement | null>(null),\n panel = useRef<HTMLDivElement>(null);\n const root = useRef<HTMLDivElement>(null);\n const contentView = useRef<HTMLDivElement>(null);\n const present = usePresence(open && Boolean(step), root);\n useContentTransition(contentView, `${open}:${index}`);\n const id = useId();\n const [rect, setRect] = useState<DOMRect | null>(null);\n const callbacks = useRef({ setIndex, onClose });\n callbacks.current = { setIndex, onClose };\n useEffect(() => {\n if (!open || !step) return;\n let frame = 0;\n const node =\n typeof step.target === 'string'\n ? document.querySelector<HTMLElement>(step.target)\n : step.target?.();\n target.current = node ?? null;\n if (!node) {\n setRect(null);\n if (missingTarget === 'skip' && index < steps.length - 1)\n callbacks.current.setIndex(index + 1);\n else if (missingTarget === 'close' || missingTarget === 'skip') callbacks.current.onClose?.();\n return;\n }\n node.scrollIntoView?.({ block: 'center', behavior: 'instant' });\n const update = () => {\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => setRect(node.getBoundingClientRect()));\n };\n const observer = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(update) : undefined;\n observer?.observe(node);\n window.addEventListener('scroll', update, true);\n window.addEventListener('resize', update);\n update();\n return () => {\n cancelAnimationFrame(frame);\n observer?.disconnect();\n window.removeEventListener('scroll', update, true);\n window.removeEventListener('resize', update);\n };\n }, [open, step, index, missingTarget, steps.length]);\n if (!present || !step) return null;\n const content = (\n <TourFocus panel={panel} owner={id} close={() => onClose?.()} modal={mask} open={open}>\n <div ref={contentView} className=\"leaf-tour__content\">\n <div className=\"leaf-tour__header\">\n <h3 id={`${id}-title`}>{step.title}</h3>\n <ButtonControl\n size=\"sm\"\n variant=\"text\"\n startIcon={<X size={16} />}\n aria-label={messages.common.close}\n onClick={onClose}\n />\n </div>\n <div className=\"leaf-tour__description\">{step.description}</div>\n <div className=\"leaf-tour__footer\">\n <span>\n {index + 1} / {steps.length}\n </span>\n {index > 0 && (\n <ButtonControl size=\"sm\" variant=\"outline\" onClick={() => setIndex(index - 1)}>\n {t('tour.previous')}\n </ButtonControl>\n )}\n <ButtonControl\n size=\"sm\"\n variant=\"solid\"\n onClick={() => {\n if (index < steps.length - 1) setIndex(index + 1);\n else {\n onFinish?.();\n onClose?.();\n }\n }}\n >\n {index === steps.length - 1 ? t('tour.finish') : t('tour.next')}\n </ButtonControl>\n </div>\n </div>\n </TourFocus>\n );\n return (\n <ScopedPortal container={getPopupContainer}>\n <TourStage present={present} active={open && Boolean(step)}>\n {(layer) => (\n <div\n ref={root}\n className=\"leaf-tour-root\"\n style={layer.maskStyle}\n data-state={open ? 'open' : 'closing'}\n aria-hidden={!open || undefined}\n {...inertProps(!open)}\n >\n {mask && (\n <div className=\"leaf-tour__mask\" aria-hidden=\"true\">\n {rect ? (\n <>\n <div style={{ inset: `0 0 auto 0`, height: Math.max(0, rect.top - padding) }} />\n <div style={{ inset: `${rect.bottom + padding}px 0 0 0` }} />\n <div\n style={{\n top: rect.top - padding,\n left: 0,\n width: Math.max(0, rect.left - padding),\n height: rect.height + 2 * padding,\n }}\n />\n <div\n style={{\n top: rect.top - padding,\n left: rect.right + padding,\n right: 0,\n height: rect.height + 2 * padding,\n }}\n />\n </>\n ) : (\n <div style={{ inset: 0 }} />\n )}\n </div>\n )}\n {rect ? (\n <FloatingPanel\n open={open}\n triggerRef={target}\n panelRef={panel}\n placement={step.placement ?? 'bottom'}\n container={getPopupContainer}\n role=\"dialog\"\n aria-modal={mask || undefined}\n aria-labelledby={`${id}-title`}\n className=\"leaf-floating leaf-tour\"\n style={layer.floatingStyle}\n tabIndex={-1}\n >\n {content}\n </FloatingPanel>\n ) : (\n <div\n ref={panel}\n role=\"dialog\"\n aria-modal={mask || undefined}\n aria-labelledby={`${id}-title`}\n tabIndex={-1}\n className=\"leaf-tour leaf-tour--center\"\n style={layer.floatingStyle}\n >\n {content}\n </div>\n )}\n </div>\n )}\n </TourStage>\n </ScopedPortal>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","TourFocus","panel","owner","close","modal","open","children","useDialog","TourStage","present","active","layer","useOverlayLayer","Tour","rawProps","steps","current","defaultCurrent","onChange","onClose","onFinish","missingTarget","mask","padding","getPopupContainer","useComponentProps","t","useText","messages","useLeafConfig","index","setIndex","useControllable","latestStep","useRef","step","target","root","contentView","usePresence","Boolean","useContentTransition","id","useId","rect","setRect","useState","callbacks","useEffect","frame","node","document","update","cancelAnimationFrame","requestAnimationFrame","observer","ResizeObserver","undefined","window","content","ButtonControl","X","ScopedPortal","inertProps","Math","FloatingPanel"],"mappings":";;;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,IAAGJ,oBAAoB,CAAC,CAACI,MAAME,QAAQ,CAACN,oBAAoB,CAAC,CAAC,UAASM,MACtE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AC,GAAGpB,KAAK,GAAG,GAAGrB;wCAAS;;kDAC3E,qCAAC;wCAAI,OAAO;4CAAE,OAAO,GAAGqB,KAAK,MAAM,GAAGrB,QAAQ,QAAQ,CAAC;wCAAC;;kDACxD,qCAAC;wCACC,OAAO;4CACL,KAAKqB,KAAK,GAAG,GAAGrB;4CAChB,MAAM;4CACN,OAAOyC,KAAK,GAAG,CAAC,GAAGpB,KAAK,IAAI,GAAGrB;4CAC/B,QAAQqB,KAAK,MAAM,GAAG,IAAIrB;wCAC5B;;kDAEF,qCAAC;wCACC,OAAO;4CACL,KAAKqB,KAAK,GAAG,GAAGrB;4CAChB,MAAMqB,KAAK,KAAK,GAAGrB;4CACnB,OAAO;4CACP,QAAQqB,KAAK,MAAM,GAAG,IAAIrB;wCAC5B;;;iCAIJ,mDAAC;gCAAI,OAAO;oCAAE,OAAO;gCAAE;;;wBAI5BqB,OACC,AADM,WAAPA,GACC,qCAACqB,6BAAAA,aAAaA,EAAAA;4BACZ,MAAM5D;4BACN,YAAY+B;4BACZ,UAAUnC;4BACV,WAAWkC,KAAK,SAAS,IAAI;4BAC7B,WAAWX;4BACX,MAAK;4BACL,cAAYF,QAAQmC;4BACpB,mBAAiB,GAAGf,GAAG,MAAM,CAAC;4BAC9B,WAAU;4BACV,OAAO/B,MAAM,aAAa;4BAC1B,UAAU;sCAETgD;6BAGH,mDAAC;4BACC,KAAK1D;4BACL,MAAK;4BACL,cAAYqB,QAAQmC;4BACpB,mBAAiB,GAAGf,GAAG,MAAM,CAAC;4BAC9B,UAAU;4BACV,WAAU;4BACV,OAAO/B,MAAM,aAAa;sCAEzBgD;;;;;;AAQjB"}
|
|
@@ -148,6 +148,7 @@ function DrawerSurface({ open, title, description, icon, divided = false, tabs,
|
|
|
148
148
|
const backdrop = (0, external_react_namespaceObject.useRef)(null);
|
|
149
149
|
const content = (0, external_react_namespaceObject.useRef)(null);
|
|
150
150
|
const present = (0, presence_cjs_namespaceObject.usePresence)(open, backdrop);
|
|
151
|
+
const layer = (0, dialog_cjs_namespaceObject.useOverlayLayer)(present, open);
|
|
151
152
|
const hasTabs = Boolean(tabs?.items?.length);
|
|
152
153
|
const hasHeading = null != title || null != description || null != icon;
|
|
153
154
|
const contentRevision = (0, external_react_namespaceObject.useRef)({
|
|
@@ -205,6 +206,7 @@ function DrawerSurface({ open, title, description, icon, divided = false, tabs,
|
|
|
205
206
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
206
207
|
hidden: !present,
|
|
207
208
|
className: (0, classes_cjs_namespaceObject.classes)('leaf-drawer-mask', `leaf-drawer-mask--${placement}`),
|
|
209
|
+
style: layer.maskStyle,
|
|
208
210
|
"data-blur": maskBlur ? void 0 : 'off',
|
|
209
211
|
"data-state": open ? 'open' : 'closing',
|
|
210
212
|
"aria-hidden": !open || void 0,
|
|
@@ -241,6 +243,7 @@ function DrawerSurface({ open, title, description, icon, divided = false, tabs,
|
|
|
241
243
|
height: resized ?? height,
|
|
242
244
|
width: '100%'
|
|
243
245
|
},
|
|
246
|
+
...layer.popupStyle,
|
|
244
247
|
...style
|
|
245
248
|
},
|
|
246
249
|
children: [
|
|
@@ -325,6 +328,11 @@ function DrawerSurface({ open, title, description, icon, divided = false, tabs,
|
|
|
325
328
|
}
|
|
326
329
|
function Drawer(rawProps) {
|
|
327
330
|
const props = (0, component_defaults_cjs_namespaceObject.useComponentProps)('Drawer', rawProps);
|
|
331
|
+
const visited = (0, external_react_namespaceObject.useRef)(false);
|
|
332
|
+
if (props.open || props.forceRender) visited.current = true;
|
|
333
|
+
if (!visited.current) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
334
|
+
hidden: true
|
|
335
|
+
});
|
|
328
336
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(scoped_portal_cjs_namespaceObject.ScopedPortal, {
|
|
329
337
|
container: props.container,
|
|
330
338
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DrawerSurface, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer/drawer.cjs","sources":["webpack://webpack/runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../src/drawer/drawer.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { X } from 'lucide-react';\nimport {\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { useLeafConfig } from '../config-provider/context';\nimport { ScrollbarControl } from '../scrollbar/scrollbar';\nimport { classes } from '../shared/classes';\nimport { type DialogFocusOptions, useDialog } from '../shared/dialog';\nimport { inertProps } from '../shared/inert';\nimport { OverlayOwner } from '../shared/overlay-owner';\nimport { useContentTransition, usePresence } from '../shared/presence';\nimport { ScopedPortal } from '../shared/scoped-portal';\nimport { type TabItem, type TabsProps, useTabsParts } from '../tabs/tabs';\n\nconst emptyTabItems: readonly TabItem[] = [];\n\n/** Tabs controls integrated with the drawer; Drawer fixes the line type and top placement. */\nexport interface DrawerTabsProps extends Omit<TabsProps, 'type' | 'placement' | 'children'> {}\n\nexport interface DrawerProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onResize'>,\n DialogFocusOptions {\n open: boolean;\n title?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n divided?: boolean;\n /** Embedded tabs placed below the heading, or replacing it when no title is supplied. */\n tabs?: DrawerTabsProps;\n footer?: ReactNode;\n extra?: ReactNode;\n placement?: 'left' | 'right' | 'top' | 'bottom';\n width?: number | string;\n height?: number | string;\n closable?: boolean;\n maskClosable?: boolean;\n keyboard?: boolean;\n onClose?: () => void;\n afterClose?: () => void;\n forceRender?: boolean;\n destroyOnClose?: boolean;\n preserve?: boolean;\n container?: Element | DocumentFragment | (() => Element | DocumentFragment);\n push?: boolean | number;\n resizable?: boolean;\n minSize?: number;\n maxSize?: number;\n onResize?: (size: number) => void;\n}\n\ninterface DrawerInnerProps {\n id: string;\n open: boolean;\n title?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n tabs?: DrawerTabsProps;\n extra?: ReactNode;\n footer?: ReactNode;\n closable: boolean;\n onClose?: () => void;\n contentRef: Ref<HTMLDivElement>;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n children?: ReactNode;\n}\n\nfunction DrawerInner({\n id,\n open,\n title,\n description,\n icon,\n tabs,\n extra,\n footer,\n closable,\n onClose,\n contentRef,\n ariaLabel,\n ariaLabelledBy,\n children,\n}: DrawerInnerProps) {\n const { messages } = useLeafConfig();\n const hasTabs = Boolean(tabs?.items?.length);\n const hasHeading = title != null || description != null || icon != null;\n const closeButton = closable ? (\n <button\n type=\"button\"\n className=\"leaf-drawer__close\"\n aria-label={messages.common.close}\n onClick={onClose}\n >\n <X size={16} aria-hidden=\"true\" />\n </button>\n ) : null;\n const extraNode = extra != null ? <div className=\"leaf-drawer__extra\">{extra}</div> : null;\n const tabExtra =\n !hasHeading && (extra != null || closable) ? (\n <div className=\"leaf-dialog-tab-extra leaf-drawer__tab-extra\">\n {tabs?.extra}\n {extraNode}\n {closeButton}\n </div>\n ) : (\n tabs?.extra\n );\n const tabLabel = tabs?.['aria-label'] ?? (typeof title === 'string' ? title : ariaLabel);\n const tabLabelledBy =\n tabs?.['aria-labelledby'] ??\n (tabs?.['aria-label'] == null && title != null\n ? `${id}-title`\n : tabs?.['aria-label'] == null\n ? ariaLabelledBy\n : undefined);\n const parts = useTabsParts({\n ...tabs,\n items: tabs?.items ?? emptyTabItems,\n type: 'line',\n placement: 'top',\n size: tabs?.size ?? 'md',\n 'aria-label': tabLabel,\n 'aria-labelledby': tabLabelledBy,\n extra: tabExtra,\n className: classes(\n 'leaf-dialog-tabs',\n hasHeading && 'leaf-dialog-tabs--headed',\n 'leaf-drawer__tabs',\n tabs?.className,\n ),\n panelsClassName: 'leaf-dialog-panels',\n visibilityKey: open,\n });\n\n return (\n <>\n {(hasHeading || (!hasTabs && (extra != null || closable))) && (\n <div\n className={classes('leaf-drawer__header', !hasHeading && 'leaf-drawer__header--compact')}\n >\n {icon != null && (\n <span className=\"leaf-drawer__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n {(title != null || description != null) && (\n <div className=\"leaf-drawer__heading\">\n {title != null && <h2 id={`${id}-title`}>{title}</h2>}\n {description != null && (\n <div id={`${id}-description`} className=\"leaf-drawer__description\">\n {description}\n </div>\n )}\n </div>\n )}\n {extraNode}\n {closeButton}\n </div>\n )}\n {parts && <div {...parts.rootProps}>{parts.header}</div>}\n <ScrollbarControl\n className=\"leaf-drawer__body\"\n viewportClassName=\"leaf-drawer__viewport\"\n orientation=\"vertical\"\n role={title != null || ariaLabel ? 'region' : 'presentation'}\n aria-labelledby={title != null ? `${id}-title` : undefined}\n aria-label={title == null ? (ariaLabel ?? tabs?.['aria-label']) : undefined}\n >\n <div ref={contentRef} className=\"leaf-drawer__content\">\n {parts?.panels}\n {children}\n </div>\n </ScrollbarControl>\n {footer != null && <div className=\"leaf-drawer__footer\">{footer}</div>}\n </>\n );\n}\n\nfunction DrawerSurface({\n open,\n title,\n description,\n icon,\n divided = false,\n tabs,\n footer,\n extra,\n placement = 'right',\n width = 380,\n height = 300,\n closable = true,\n maskClosable = true,\n keyboard = true,\n onClose,\n afterClose,\n forceRender = false,\n destroyOnClose = false,\n preserve,\n initialFocus,\n returnFocus,\n container: _container,\n push = false,\n resizable = false,\n minSize = 240,\n maxSize = 900,\n onResize,\n children,\n className,\n style,\n ...props\n}: DrawerProps) {\n const { messages, maskBlur } = useLeafConfig();\n const id = useId();\n const panel = useRef<HTMLDivElement>(null);\n const backdrop = useRef<HTMLButtonElement>(null);\n const content = useRef<HTMLDivElement>(null);\n const present = usePresence(open, backdrop);\n const hasTabs = Boolean(tabs?.items?.length);\n const hasHeading = title != null || description != null || icon != null;\n const contentRevision = useRef({ children, revision: 0 });\n if (children !== contentRevision.current.children)\n contentRevision.current = { children, revision: contentRevision.current.revision + 1 };\n useContentTransition(\n content,\n hasTabs ? String(open) : `${open}:${contentRevision.current.revision}`,\n 0,\n true,\n );\n const owner = useContext(OverlayOwner);\n const [resized, setResized] = useState<number>();\n const stopDragging = useRef<(() => void) | undefined>(undefined);\n useEffect(() => () => stopDragging.current?.(), []);\n const horizontal = placement === 'left' || placement === 'right';\n // biome-ignore lint/correctness/useExhaustiveDependencies: Resizing resets when the configured dimensions change.\n useEffect(() => {\n setResized(undefined);\n }, [width, height]);\n useEffect(() => {\n if (!open || !push || !owner) return;\n const parent = document.getElementById(owner);\n if (!parent) return;\n const previous = parent.style.transform;\n const distance = typeof push === 'number' ? push : 40;\n parent.style.transform = `translate${horizontal ? 'X' : 'Y'}(${placement === 'right' || placement === 'bottom' ? -distance : distance}px)`;\n return () => {\n parent.style.transform = previous;\n };\n }, [open, push, owner, placement, horizontal]);\n const previous = useRef(false);\n useEffect(() => {\n if (previous.current && !present) afterClose?.();\n previous.current = present;\n }, [present, afterClose]);\n useDialog(open, panel, id, () => onClose?.(), keyboard, { initialFocus, returnFocus });\n const visited = useRef(false);\n if (open) visited.current = true;\n if (\n !present &&\n !forceRender &&\n ((preserve === undefined ? destroyOnClose : !preserve) || !visited.current)\n )\n return null;\n return (\n <div\n hidden={!present}\n className={classes('leaf-drawer-mask', `leaf-drawer-mask--${placement}`)}\n data-blur={maskBlur ? undefined : 'off'}\n data-state={open ? 'open' : 'closing'}\n aria-hidden={!open || undefined}\n {...inertProps(!open)}\n >\n <button\n ref={backdrop}\n type=\"button\"\n tabIndex={-1}\n className=\"leaf-drawer-backdrop\"\n aria-label={messages.common.close}\n onClick={() => {\n if (maskClosable) onClose?.();\n }}\n />\n <div\n {...props}\n ref={panel}\n id={props.id ?? id}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title != null ? `${id}-title` : props['aria-labelledby']}\n aria-describedby={\n [props['aria-describedby'], description != null && `${id}-description`]\n .filter(Boolean)\n .join(' ') || undefined\n }\n tabIndex={-1}\n className={classes(\n 'leaf-drawer',\n divided && 'leaf-drawer--divided',\n hasTabs && 'leaf-drawer--tabbed',\n hasHeading && 'leaf-drawer--headed',\n className,\n )}\n style={{\n ...(horizontal\n ? { width: resized ?? width, height: '100%' }\n : { height: resized ?? height, width: '100%' }),\n ...style,\n }}\n >\n {resizable && (\n // biome-ignore lint/a11y/useSemanticElements: This is the adjustable ARIA window-splitter handle, not a decorative separator.\n <div\n role=\"separator\"\n tabIndex={0}\n aria-label={messages.tree.expand}\n aria-orientation={horizontal ? 'vertical' : 'horizontal'}\n aria-valuemin={minSize}\n aria-valuemax={maxSize}\n aria-valuenow={\n resized ??\n (typeof (horizontal ? width : height) === 'number'\n ? Number(horizontal ? width : height)\n : undefined)\n }\n className=\"leaf-drawer__resize\"\n onPointerDown={(event) => {\n if (!panel.current) return;\n stopDragging.current?.();\n event.preventDefault();\n event.currentTarget.setPointerCapture(event.pointerId);\n const start = horizontal ? event.clientX : event.clientY;\n const bounds = panel.current.getBoundingClientRect();\n const size = horizontal ? bounds.width : bounds.height;\n const update = (event: PointerEvent) => {\n const next = Math.min(\n maxSize,\n Math.max(\n minSize,\n size +\n ((horizontal ? event.clientX : event.clientY) - start) *\n (placement === 'right' || placement === 'bottom' ? -1 : 1),\n ),\n );\n setResized(next);\n onResize?.(next);\n };\n const end = () => {\n window.removeEventListener('pointermove', update);\n window.removeEventListener('pointerup', end);\n window.removeEventListener('pointercancel', end);\n };\n stopDragging.current = end;\n window.addEventListener('pointermove', update);\n window.addEventListener('pointerup', end, { once: true });\n window.addEventListener('pointercancel', end, { once: true });\n }}\n onKeyDown={(event) => {\n if (!panel.current) return;\n if (!['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)) return;\n event.preventDefault();\n const bounds = panel.current.getBoundingClientRect();\n const size = horizontal ? bounds.width : bounds.height;\n const next = Math.min(\n maxSize,\n Math.max(\n minSize,\n size +\n (['ArrowRight', 'ArrowDown'].includes(event.key) ? 10 : -10) *\n (placement === 'right' || placement === 'bottom' ? -1 : 1),\n ),\n );\n setResized(next);\n onResize?.(next);\n }}\n />\n )}\n <OverlayOwner.Provider value={id}>\n <DrawerInner\n id={id}\n open={open}\n title={title}\n description={description}\n icon={icon}\n tabs={tabs}\n extra={extra}\n footer={footer}\n closable={closable}\n onClose={onClose}\n contentRef={content}\n ariaLabel={props['aria-label']}\n ariaLabelledBy={props['aria-labelledby']}\n >\n {children}\n </DrawerInner>\n </OverlayOwner.Provider>\n </div>\n </div>\n );\n}\nexport function Drawer(rawProps: DrawerProps) {\n const props = useComponentProps('Drawer', rawProps);\n return (\n <ScopedPortal container={props.container}>\n <DrawerSurface {...props} />\n </ScopedPortal>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","emptyTabItems","DrawerInner","id","open","title","description","icon","tabs","extra","footer","closable","onClose","contentRef","ariaLabel","ariaLabelledBy","children","messages","useLeafConfig","hasTabs","Boolean","hasHeading","closeButton","X","extraNode","tabExtra","tabLabel","tabLabelledBy","undefined","parts","useTabsParts","classes","ScrollbarControl","DrawerSurface","divided","placement","width","height","maskClosable","keyboard","afterClose","forceRender","destroyOnClose","preserve","initialFocus","returnFocus","_container","push","resizable","minSize","maxSize","onResize","className","style","props","maskBlur","useId","panel","useRef","backdrop","content","present","usePresence","contentRevision","useContentTransition","String","owner","useContext","OverlayOwner","resized","setResized","useState","stopDragging","useEffect","horizontal","parent","document","previous","distance","useDialog","visited","inertProps","Number","event","start","bounds","size","update","next","Math","end","window","Drawer","rawProps","useComponentProps","ScopedPortal"],"mappings":";;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,IAAGJ,oBAAoB,CAAC,CAACI,MAAME,QAAQ,CAACN,oBAAoB,CAAC,CAAC,UAASM,MACtEC,OAAO,cAAc,CAAC,UAASD,KAAK;gBAAE,YAAY;gBAAM,CAACD,KAAK,EAAED,IAAI,CAACE,IAAI;YAAC;QAG7E;QACAH,OAAOF,SAAS;QAChBE,OAAOD,QAAQ;IAChB;;;ICVAF,oBAAoB,CAAC,GAAG,CAACQ,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFT,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOU,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;ACgBA,MAAMI,gBAAoC,EAAE;AAqD5C,SAASC,YAAY,EACnBC,EAAE,EACFC,IAAI,EACJC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,QAAQ,EACS;IACjB,MAAM,EAAEC,QAAQ,EAAE,GAAGC,AAAAA,IAAAA,4BAAAA,aAAAA,AAAAA;IACrB,MAAMC,UAAUC,QAAQZ,MAAM,OAAO;IACrC,M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runtime/define_property_getters","webpack://webpack/runtime/has_own_property","webpack://webpack/runtime/make_namespace_object","../../../src/drawer/drawer.tsx"],"sourcesContent":["__webpack_require__.d = (exports, getters, values) => {\n\tvar define = (defs, kind) => {\n\t\tfor(var key in defs) {\n\t\t\tif(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });\n\t\t\t}\n\t\t}\n\t};\n\tdefine(getters, \"get\");\n\tdefine(values, \"value\");\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { X } from 'lucide-react';\nimport {\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { useComponentProps } from '../config-provider/component-defaults';\nimport { useLeafConfig } from '../config-provider/context';\nimport { ScrollbarControl } from '../scrollbar/scrollbar';\nimport { classes } from '../shared/classes';\nimport { type DialogFocusOptions, useDialog, useOverlayLayer } from '../shared/dialog';\nimport { inertProps } from '../shared/inert';\nimport { OverlayOwner } from '../shared/overlay-owner';\nimport { useContentTransition, usePresence } from '../shared/presence';\nimport { ScopedPortal } from '../shared/scoped-portal';\nimport { type TabItem, type TabsProps, useTabsParts } from '../tabs/tabs';\n\nconst emptyTabItems: readonly TabItem[] = [];\n\n/** Tabs controls integrated with the drawer; Drawer fixes the line type and top placement. */\nexport interface DrawerTabsProps extends Omit<TabsProps, 'type' | 'placement' | 'children'> {}\n\nexport interface DrawerProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onResize'>,\n DialogFocusOptions {\n open: boolean;\n title?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n divided?: boolean;\n /** Embedded tabs placed below the heading, or replacing it when no title is supplied. */\n tabs?: DrawerTabsProps;\n footer?: ReactNode;\n extra?: ReactNode;\n placement?: 'left' | 'right' | 'top' | 'bottom';\n width?: number | string;\n height?: number | string;\n closable?: boolean;\n maskClosable?: boolean;\n keyboard?: boolean;\n onClose?: () => void;\n afterClose?: () => void;\n forceRender?: boolean;\n destroyOnClose?: boolean;\n preserve?: boolean;\n container?: Element | DocumentFragment | (() => Element | DocumentFragment);\n push?: boolean | number;\n resizable?: boolean;\n minSize?: number;\n maxSize?: number;\n onResize?: (size: number) => void;\n}\n\ninterface DrawerInnerProps {\n id: string;\n open: boolean;\n title?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n tabs?: DrawerTabsProps;\n extra?: ReactNode;\n footer?: ReactNode;\n closable: boolean;\n onClose?: () => void;\n contentRef: Ref<HTMLDivElement>;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n children?: ReactNode;\n}\n\nfunction DrawerInner({\n id,\n open,\n title,\n description,\n icon,\n tabs,\n extra,\n footer,\n closable,\n onClose,\n contentRef,\n ariaLabel,\n ariaLabelledBy,\n children,\n}: DrawerInnerProps) {\n const { messages } = useLeafConfig();\n const hasTabs = Boolean(tabs?.items?.length);\n const hasHeading = title != null || description != null || icon != null;\n const closeButton = closable ? (\n <button\n type=\"button\"\n className=\"leaf-drawer__close\"\n aria-label={messages.common.close}\n onClick={onClose}\n >\n <X size={16} aria-hidden=\"true\" />\n </button>\n ) : null;\n const extraNode = extra != null ? <div className=\"leaf-drawer__extra\">{extra}</div> : null;\n const tabExtra =\n !hasHeading && (extra != null || closable) ? (\n <div className=\"leaf-dialog-tab-extra leaf-drawer__tab-extra\">\n {tabs?.extra}\n {extraNode}\n {closeButton}\n </div>\n ) : (\n tabs?.extra\n );\n const tabLabel = tabs?.['aria-label'] ?? (typeof title === 'string' ? title : ariaLabel);\n const tabLabelledBy =\n tabs?.['aria-labelledby'] ??\n (tabs?.['aria-label'] == null && title != null\n ? `${id}-title`\n : tabs?.['aria-label'] == null\n ? ariaLabelledBy\n : undefined);\n const parts = useTabsParts({\n ...tabs,\n items: tabs?.items ?? emptyTabItems,\n type: 'line',\n placement: 'top',\n size: tabs?.size ?? 'md',\n 'aria-label': tabLabel,\n 'aria-labelledby': tabLabelledBy,\n extra: tabExtra,\n className: classes(\n 'leaf-dialog-tabs',\n hasHeading && 'leaf-dialog-tabs--headed',\n 'leaf-drawer__tabs',\n tabs?.className,\n ),\n panelsClassName: 'leaf-dialog-panels',\n visibilityKey: open,\n });\n\n return (\n <>\n {(hasHeading || (!hasTabs && (extra != null || closable))) && (\n <div\n className={classes('leaf-drawer__header', !hasHeading && 'leaf-drawer__header--compact')}\n >\n {icon != null && (\n <span className=\"leaf-drawer__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n {(title != null || description != null) && (\n <div className=\"leaf-drawer__heading\">\n {title != null && <h2 id={`${id}-title`}>{title}</h2>}\n {description != null && (\n <div id={`${id}-description`} className=\"leaf-drawer__description\">\n {description}\n </div>\n )}\n </div>\n )}\n {extraNode}\n {closeButton}\n </div>\n )}\n {parts && <div {...parts.rootProps}>{parts.header}</div>}\n <ScrollbarControl\n className=\"leaf-drawer__body\"\n viewportClassName=\"leaf-drawer__viewport\"\n orientation=\"vertical\"\n role={title != null || ariaLabel ? 'region' : 'presentation'}\n aria-labelledby={title != null ? `${id}-title` : undefined}\n aria-label={title == null ? (ariaLabel ?? tabs?.['aria-label']) : undefined}\n >\n <div ref={contentRef} className=\"leaf-drawer__content\">\n {parts?.panels}\n {children}\n </div>\n </ScrollbarControl>\n {footer != null && <div className=\"leaf-drawer__footer\">{footer}</div>}\n </>\n );\n}\n\nfunction DrawerSurface({\n open,\n title,\n description,\n icon,\n divided = false,\n tabs,\n footer,\n extra,\n placement = 'right',\n width = 380,\n height = 300,\n closable = true,\n maskClosable = true,\n keyboard = true,\n onClose,\n afterClose,\n forceRender = false,\n destroyOnClose = false,\n preserve,\n initialFocus,\n returnFocus,\n container: _container,\n push = false,\n resizable = false,\n minSize = 240,\n maxSize = 900,\n onResize,\n children,\n className,\n style,\n ...props\n}: DrawerProps) {\n const { messages, maskBlur } = useLeafConfig();\n const id = useId();\n const panel = useRef<HTMLDivElement>(null);\n const backdrop = useRef<HTMLButtonElement>(null);\n const content = useRef<HTMLDivElement>(null);\n const present = usePresence(open, backdrop);\n const layer = useOverlayLayer(present, open);\n const hasTabs = Boolean(tabs?.items?.length);\n const hasHeading = title != null || description != null || icon != null;\n const contentRevision = useRef({ children, revision: 0 });\n if (children !== contentRevision.current.children)\n contentRevision.current = { children, revision: contentRevision.current.revision + 1 };\n useContentTransition(\n content,\n hasTabs ? String(open) : `${open}:${contentRevision.current.revision}`,\n 0,\n true,\n );\n const owner = useContext(OverlayOwner);\n const [resized, setResized] = useState<number>();\n const stopDragging = useRef<(() => void) | undefined>(undefined);\n useEffect(() => () => stopDragging.current?.(), []);\n const horizontal = placement === 'left' || placement === 'right';\n // biome-ignore lint/correctness/useExhaustiveDependencies: Resizing resets when the configured dimensions change.\n useEffect(() => {\n setResized(undefined);\n }, [width, height]);\n useEffect(() => {\n if (!open || !push || !owner) return;\n const parent = document.getElementById(owner);\n if (!parent) return;\n const previous = parent.style.transform;\n const distance = typeof push === 'number' ? push : 40;\n parent.style.transform = `translate${horizontal ? 'X' : 'Y'}(${placement === 'right' || placement === 'bottom' ? -distance : distance}px)`;\n return () => {\n parent.style.transform = previous;\n };\n }, [open, push, owner, placement, horizontal]);\n const previous = useRef(false);\n useEffect(() => {\n if (previous.current && !present) afterClose?.();\n previous.current = present;\n }, [present, afterClose]);\n useDialog(open, panel, id, () => onClose?.(), keyboard, { initialFocus, returnFocus });\n const visited = useRef(false);\n if (open) visited.current = true;\n if (\n !present &&\n !forceRender &&\n ((preserve === undefined ? destroyOnClose : !preserve) || !visited.current)\n )\n return null;\n return (\n <div\n hidden={!present}\n className={classes('leaf-drawer-mask', `leaf-drawer-mask--${placement}`)}\n style={layer.maskStyle}\n data-blur={maskBlur ? undefined : 'off'}\n data-state={open ? 'open' : 'closing'}\n aria-hidden={!open || undefined}\n {...inertProps(!open)}\n >\n <button\n ref={backdrop}\n type=\"button\"\n tabIndex={-1}\n className=\"leaf-drawer-backdrop\"\n aria-label={messages.common.close}\n onClick={() => {\n if (maskClosable) onClose?.();\n }}\n />\n <div\n {...props}\n ref={panel}\n id={props.id ?? id}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title != null ? `${id}-title` : props['aria-labelledby']}\n aria-describedby={\n [props['aria-describedby'], description != null && `${id}-description`]\n .filter(Boolean)\n .join(' ') || undefined\n }\n tabIndex={-1}\n className={classes(\n 'leaf-drawer',\n divided && 'leaf-drawer--divided',\n hasTabs && 'leaf-drawer--tabbed',\n hasHeading && 'leaf-drawer--headed',\n className,\n )}\n style={{\n ...(horizontal\n ? { width: resized ?? width, height: '100%' }\n : { height: resized ?? height, width: '100%' }),\n ...layer.popupStyle,\n ...style,\n }}\n >\n {resizable && (\n // biome-ignore lint/a11y/useSemanticElements: This is the adjustable ARIA window-splitter handle, not a decorative separator.\n <div\n role=\"separator\"\n tabIndex={0}\n aria-label={messages.tree.expand}\n aria-orientation={horizontal ? 'vertical' : 'horizontal'}\n aria-valuemin={minSize}\n aria-valuemax={maxSize}\n aria-valuenow={\n resized ??\n (typeof (horizontal ? width : height) === 'number'\n ? Number(horizontal ? width : height)\n : undefined)\n }\n className=\"leaf-drawer__resize\"\n onPointerDown={(event) => {\n if (!panel.current) return;\n stopDragging.current?.();\n event.preventDefault();\n event.currentTarget.setPointerCapture(event.pointerId);\n const start = horizontal ? event.clientX : event.clientY;\n const bounds = panel.current.getBoundingClientRect();\n const size = horizontal ? bounds.width : bounds.height;\n const update = (event: PointerEvent) => {\n const next = Math.min(\n maxSize,\n Math.max(\n minSize,\n size +\n ((horizontal ? event.clientX : event.clientY) - start) *\n (placement === 'right' || placement === 'bottom' ? -1 : 1),\n ),\n );\n setResized(next);\n onResize?.(next);\n };\n const end = () => {\n window.removeEventListener('pointermove', update);\n window.removeEventListener('pointerup', end);\n window.removeEventListener('pointercancel', end);\n };\n stopDragging.current = end;\n window.addEventListener('pointermove', update);\n window.addEventListener('pointerup', end, { once: true });\n window.addEventListener('pointercancel', end, { once: true });\n }}\n onKeyDown={(event) => {\n if (!panel.current) return;\n if (!['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)) return;\n event.preventDefault();\n const bounds = panel.current.getBoundingClientRect();\n const size = horizontal ? bounds.width : bounds.height;\n const next = Math.min(\n maxSize,\n Math.max(\n minSize,\n size +\n (['ArrowRight', 'ArrowDown'].includes(event.key) ? 10 : -10) *\n (placement === 'right' || placement === 'bottom' ? -1 : 1),\n ),\n );\n setResized(next);\n onResize?.(next);\n }}\n />\n )}\n <OverlayOwner.Provider value={id}>\n <DrawerInner\n id={id}\n open={open}\n title={title}\n description={description}\n icon={icon}\n tabs={tabs}\n extra={extra}\n footer={footer}\n closable={closable}\n onClose={onClose}\n contentRef={content}\n ariaLabel={props['aria-label']}\n ariaLabelledBy={props['aria-labelledby']}\n >\n {children}\n </DrawerInner>\n </OverlayOwner.Provider>\n </div>\n </div>\n );\n}\nexport function Drawer(rawProps: DrawerProps) {\n const props = useComponentProps('Drawer', rawProps);\n const visited = useRef(false);\n // 首次打开或显式 forceRender 前保留行内锚点并延迟挂载 ScopedPortal,避免提前在 body 占位。\n if (props.open || props.forceRender) visited.current = true;\n if (!visited.current) return <span hidden />;\n return (\n <ScopedPortal container={props.container}>\n <DrawerSurface {...props} />\n </ScopedPortal>\n );\n}\n"],"names":["__webpack_require__","getters","values","define","defs","kind","key","Object","obj","prop","Symbol","emptyTabItems","DrawerInner","id","open","title","description","icon","tabs","extra","footer","closable","onClose","contentRef","ariaLabel","ariaLabelledBy","children","messages","useLeafConfig","hasTabs","Boolean","hasHeading","closeButton","X","extraNode","tabExtra","tabLabel","tabLabelledBy","undefined","parts","useTabsParts","classes","ScrollbarControl","DrawerSurface","divided","placement","width","height","maskClosable","keyboard","afterClose","forceRender","destroyOnClose","preserve","initialFocus","returnFocus","_container","push","resizable","minSize","maxSize","onResize","className","style","props","maskBlur","useId","panel","useRef","backdrop","content","present","usePresence","layer","useOverlayLayer","contentRevision","useContentTransition","String","owner","useContext","OverlayOwner","resized","setResized","useState","stopDragging","useEffect","horizontal","parent","document","previous","distance","useDialog","visited","inertProps","Number","event","start","bounds","size","update","next","Math","end","window","Drawer","rawProps","useComponentProps","ScopedPortal"],"mappings":";;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC,SAASC;QAC1C,IAAIC,SAAS,CAACC,MAAMC;YACnB,IAAI,IAAIC,OAAOF,KACd,IAAGJ,oBAAoB,CAAC,CAACI,MAAME,QAAQ,CAACN,oBAAoB,CAAC,CAAC,UAASM,MACtEC,OAAO,cAAc,CAAC,UAASD,KAAK;gBAAE,YAAY;gBAAM,CAACD,KAAK,EAAED,IAAI,CAACE,IAAI;YAAC;QAG7E;QACAH,OAAOF,SAAS;QAChBE,OAAOD,QAAQ;IAChB;;;ICVAF,oBAAoB,CAAC,GAAG,CAACQ,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFT,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOU,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;ACgBA,MAAMI,gBAAoC,EAAE;AAqD5C,SAASC,YAAY,EACnBC,EAAE,EACFC,IAAI,EACJC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,QAAQ,EACS;IACj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AAQ0C,AAAAA,IAAAA,uCAAAA,iBAAAA,AAAAA,EAAkB,UAAUD;IAC1C,MAAMb,UAAUxB,AAAAA,IAAAA,+BAAAA,MAAAA,AAAAA,EAAO;IAEvB,IAAIJ,MAAM,IAAI,IAAIA,MAAM,WAAW,EAAE4B,QAAQ,OAAO,GAAG;IACvD,IAAI,CAACA,QAAQ,OAAO,EAAE,OAAO,WAAP,GAAO,qCAAC;QAAK,QAAM;;IACzC,OACE,AADK,WAAP,GACE,qCAACe,kCAAAA,YAAYA,EAAAA;QAAC,WAAW3C,MAAM,SAAS;kBACtC,mDAACrB,eAAAA;YAAe,GAAGqB,KAAK;;;AAG9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.cts","sourceRoot":"","sources":["../../../src/drawer/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"drawer.d.cts","sourceRoot":"","sources":["../../../src/drawer/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,KAAK,kBAAkB,EAA8B,MAAM,kBAAkB,CAAC;AAKvF,OAAO,EAAgB,KAAK,SAAS,EAAgB,MAAM,cAAc,CAAC;AAI1E,8FAA8F;AAC9F,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,CAAC;CAAG;AAE9F,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,EAChE,kBAAkB;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yFAAyF;IACzF,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IAChD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,GAAG,gBAAgB,GAAG,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC;IAC5E,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAiWD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,WAAW,+BAW3C"}
|
|
@@ -183,6 +183,7 @@ function ViewerHost({ items, open, index = 0, thumbnails = true, downloadable =
|
|
|
183
183
|
initialFocus: root,
|
|
184
184
|
returnFocus: false
|
|
185
185
|
});
|
|
186
|
+
const layer = (0, dialog_cjs_namespaceObject.useOverlayLayer)(present, visible);
|
|
186
187
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
187
188
|
if (present) {
|
|
188
189
|
reportedHidden.current = false;
|
|
@@ -491,6 +492,7 @@ function ViewerHost({ items, open, index = 0, thumbnails = true, downloadable =
|
|
|
491
492
|
"aria-describedby": `${id}-position`,
|
|
492
493
|
tabIndex: -1,
|
|
493
494
|
className: "leaf-image-viewer",
|
|
495
|
+
style: layer.maskStyle,
|
|
494
496
|
"data-state": visible ? 'open' : 'closing',
|
|
495
497
|
"data-motion": motion ? 'on' : 'off',
|
|
496
498
|
onKeyDown: (event)=>{
|