@sia.soul/sia-react-ui 0.1.132 → 0.1.134
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/{chunk-NYU3DJVZ.js → chunk-436QH6XH.js} +10 -2
- package/dist/{chunk-OHIBJFX5.js → chunk-4KNFPQEV.js} +2 -2
- package/dist/{chunk-J3RX7GCZ.js → chunk-L2S7IPSM.js} +1 -1
- package/dist/{chunk-EWEDQ3VJ.js → chunk-UVHC6OEX.js} +70 -5
- package/dist/{chunk-RC5MXFLI.js → chunk-WIRIEIRO.js} +1 -1
- package/dist/{core-DoyeSoBN.d.ts → core-Bkk7-59o.d.ts} +3 -3
- package/dist/{core-DUmn3A2b.d.cts → core-lZIzt-an.d.cts} +3 -3
- package/dist/core.cjs +74 -5
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +3 -3
- package/dist/index.cjs +142 -23
- package/dist/index.css +27 -23
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +68 -18
- package/dist/rich-text-editor.cjs +58 -5
- package/dist/rich-text-editor.js +2 -2
- package/dist/select-date-range.cjs +19 -0
- package/dist/select-date-range.js +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Dropdown,
|
|
3
|
-
Input
|
|
4
|
-
|
|
3
|
+
Input,
|
|
4
|
+
registerFloatingScrollbar,
|
|
5
|
+
setFloatingScrollbarDragging
|
|
6
|
+
} from "./chunk-UVHC6OEX.js";
|
|
5
7
|
import {
|
|
6
8
|
Icon,
|
|
7
9
|
Modal,
|
|
@@ -332,6 +334,7 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
332
334
|
event.preventDefault();
|
|
333
335
|
event.stopPropagation();
|
|
334
336
|
entry.dragging = true;
|
|
337
|
+
setFloatingScrollbarDragging(track, true);
|
|
335
338
|
showEntry(entry);
|
|
336
339
|
thumb.setPointerCapture(event.pointerId);
|
|
337
340
|
const startPointer = axis === "vertical" ? event.clientY : event.clientX;
|
|
@@ -352,6 +355,7 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
352
355
|
const onPointerUp = (upEvent) => {
|
|
353
356
|
if (upEvent.pointerId !== event.pointerId) return;
|
|
354
357
|
entry.dragging = false;
|
|
358
|
+
setFloatingScrollbarDragging(track, false);
|
|
355
359
|
thumb.releasePointerCapture(event.pointerId);
|
|
356
360
|
window.removeEventListener("pointermove", onPointerMove);
|
|
357
361
|
window.removeEventListener("pointerup", onPointerUp);
|
|
@@ -383,6 +387,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
383
387
|
if (entries.has(target)) return;
|
|
384
388
|
const horizontal = createTrack("horizontal");
|
|
385
389
|
const vertical = createTrack("vertical");
|
|
390
|
+
const releaseHorizontalOwner = registerFloatingScrollbar(horizontal.track, target);
|
|
391
|
+
const releaseVerticalOwner = registerFloatingScrollbar(vertical.track, target);
|
|
386
392
|
layer.append(horizontal.track, vertical.track);
|
|
387
393
|
const onPointerEnter = () => {
|
|
388
394
|
const entry2 = entries.get(target);
|
|
@@ -424,6 +430,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
424
430
|
if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
|
|
425
431
|
cleanupHorizontal();
|
|
426
432
|
cleanupVertical();
|
|
433
|
+
releaseHorizontalOwner();
|
|
434
|
+
releaseVerticalOwner();
|
|
427
435
|
target.removeEventListener("pointerenter", onPointerEnter);
|
|
428
436
|
target.removeEventListener("pointerleave", onPointerLeave);
|
|
429
437
|
target.removeEventListener("scroll", onScroll);
|
|
@@ -18,10 +18,35 @@ import {
|
|
|
18
18
|
|
|
19
19
|
// src/components/Navigation.tsx
|
|
20
20
|
import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
21
|
+
|
|
22
|
+
// src/components/floatingScrollbarOwnership.ts
|
|
23
|
+
var targets = /* @__PURE__ */ new Map();
|
|
24
|
+
function registerFloatingScrollbar(track, target) {
|
|
25
|
+
targets.set(track, { target, dragging: false });
|
|
26
|
+
return () => {
|
|
27
|
+
targets.delete(track);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function setFloatingScrollbarDragging(track, dragging) {
|
|
31
|
+
const entry = targets.get(track);
|
|
32
|
+
if (entry) entry.dragging = dragging;
|
|
33
|
+
}
|
|
34
|
+
function resolveFloatingScrollbarTarget(target) {
|
|
35
|
+
const track = target instanceof Element ? target.closest(".sia-floating-scrollbar") : null;
|
|
36
|
+
return track && targets.get(track)?.target || target;
|
|
37
|
+
}
|
|
38
|
+
function hasFloatingScrollbarInteraction(container) {
|
|
39
|
+
if (!container) return false;
|
|
40
|
+
return [...targets].some(([track, entry]) => container.contains(entry.target) && (entry.dragging || track.matches(":hover")));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// src/components/Navigation.tsx
|
|
21
44
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
22
45
|
import { createElement } from "react";
|
|
23
46
|
function MenuPopup({
|
|
24
47
|
anchorRef,
|
|
48
|
+
popupRef,
|
|
49
|
+
keyPath,
|
|
25
50
|
open,
|
|
26
51
|
placement,
|
|
27
52
|
menuId,
|
|
@@ -52,13 +77,15 @@ function MenuPopup({
|
|
|
52
77
|
return /* @__PURE__ */ jsx(
|
|
53
78
|
PopupPortal,
|
|
54
79
|
{
|
|
80
|
+
ref: popupRef,
|
|
55
81
|
anchorRef,
|
|
56
82
|
open: mounted,
|
|
57
83
|
placement,
|
|
58
|
-
offset: 4,
|
|
84
|
+
offset: placement.startsWith("right") || placement.startsWith("left") ? 16 : 4,
|
|
59
85
|
className: `sia-menu__popup sia-menu--${theme}${open ? " is-open" : " is-closing"}`,
|
|
60
86
|
style: { fontSize },
|
|
61
87
|
"data-sia-menu-owner": menuId,
|
|
88
|
+
"data-sia-menu-path": JSON.stringify(keyPath),
|
|
62
89
|
onMouseEnter,
|
|
63
90
|
onMouseLeave,
|
|
64
91
|
children: /* @__PURE__ */ jsx("ul", { className: "sia-menu__popup-list", role: "menu", children })
|
|
@@ -73,7 +100,12 @@ function MenuEntry({
|
|
|
73
100
|
reserveIcon
|
|
74
101
|
}) {
|
|
75
102
|
const anchorRef = useRef(null);
|
|
103
|
+
const popupRef = useRef(null);
|
|
76
104
|
const closeTimerRef = useRef(void 0);
|
|
105
|
+
const toggleRef = useRef(props.toggle);
|
|
106
|
+
useLayoutEffect(() => {
|
|
107
|
+
toggleRef.current = props.toggle;
|
|
108
|
+
});
|
|
77
109
|
const hasChildren = Boolean(item.children?.length);
|
|
78
110
|
const isOpen = props.open.includes(item.key);
|
|
79
111
|
const isSelected = props.selected.includes(item.key);
|
|
@@ -91,7 +123,14 @@ function MenuEntry({
|
|
|
91
123
|
}
|
|
92
124
|
function scheduleClose() {
|
|
93
125
|
cancelClose();
|
|
94
|
-
closeTimerRef.current = window.setTimeout(() =>
|
|
126
|
+
closeTimerRef.current = window.setTimeout(() => {
|
|
127
|
+
const interacting = hasFloatingScrollbarInteraction(popupRef.current) || [...document.querySelectorAll(".sia-menu__popup[data-sia-menu-owner]")].some((popup) => popup.dataset.siaMenuOwner === props.menuId && JSON.parse(popup.dataset.siaMenuPath ?? "[]").includes(item.key) && hasFloatingScrollbarInteraction(popup));
|
|
128
|
+
if (interacting) {
|
|
129
|
+
scheduleClose();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
toggleRef.current(item.key, false);
|
|
133
|
+
}, 100);
|
|
95
134
|
}
|
|
96
135
|
const hover = props.triggerSubMenuAction === "hover" && hasChildren && !inlineSubmenu;
|
|
97
136
|
const submenu = hasChildren ? /* @__PURE__ */ jsx(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [item.key, ...parents], props }) : null;
|
|
@@ -134,6 +173,8 @@ function MenuEntry({
|
|
|
134
173
|
MenuPopup,
|
|
135
174
|
{
|
|
136
175
|
anchorRef,
|
|
176
|
+
popupRef,
|
|
177
|
+
keyPath: path,
|
|
137
178
|
open: isOpen,
|
|
138
179
|
placement: popupPlacement,
|
|
139
180
|
menuId: props.menuId,
|
|
@@ -194,6 +235,22 @@ function Menu({
|
|
|
194
235
|
const rootRef = useRef(null);
|
|
195
236
|
const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
|
|
196
237
|
const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
|
|
238
|
+
const pendingOpenRef = useRef(open);
|
|
239
|
+
useLayoutEffect(() => {
|
|
240
|
+
pendingOpenRef.current = open;
|
|
241
|
+
});
|
|
242
|
+
const popupPaths = useMemo(() => {
|
|
243
|
+
const paths = /* @__PURE__ */ new Map();
|
|
244
|
+
const visit = (entries, parents) => {
|
|
245
|
+
for (const entry of entries) {
|
|
246
|
+
const path = [...parents, entry.key];
|
|
247
|
+
paths.set(entry.key, path);
|
|
248
|
+
if (entry.children) visit(entry.children, path);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
visit(items, []);
|
|
252
|
+
return paths;
|
|
253
|
+
}, [items]);
|
|
197
254
|
const revealedKey = useRef();
|
|
198
255
|
const firstSelected = selected[0];
|
|
199
256
|
useLayoutEffect(() => {
|
|
@@ -221,7 +278,7 @@ function Menu({
|
|
|
221
278
|
useEffect(() => {
|
|
222
279
|
if (mode === "inline" || !open.length) return void 0;
|
|
223
280
|
const closeOutside = (event) => {
|
|
224
|
-
const target = event.target;
|
|
281
|
+
const target = resolveFloatingScrollbarTarget(event.target);
|
|
225
282
|
if (rootRef.current?.contains(target)) return;
|
|
226
283
|
const owner = target instanceof Element ? target.closest("[data-sia-menu-owner]")?.getAttribute("data-sia-menu-owner") : null;
|
|
227
284
|
if (owner !== menuId) setOpen([]);
|
|
@@ -230,8 +287,14 @@ function Menu({
|
|
|
230
287
|
return () => document.removeEventListener("pointerdown", closeOutside);
|
|
231
288
|
}, [menuId, mode, open.length, setOpen]);
|
|
232
289
|
function toggle(key, force) {
|
|
233
|
-
const
|
|
234
|
-
|
|
290
|
+
const current = pendingOpenRef.current;
|
|
291
|
+
const shouldOpen = force ?? !current.includes(key);
|
|
292
|
+
if (shouldOpen === current.includes(key)) return;
|
|
293
|
+
const cascading = mode !== "inline" || inlineCollapsed;
|
|
294
|
+
const branch = popupPaths.get(key) ?? [key];
|
|
295
|
+
const next = shouldOpen ? [...current.filter((item) => !cascading || branch.includes(item)), key] : current.filter((item) => item !== key && (!cascading || !popupPaths.get(item)?.includes(key)));
|
|
296
|
+
pendingOpenRef.current = next;
|
|
297
|
+
setOpen(next);
|
|
235
298
|
}
|
|
236
299
|
function select(item, keyPath, domEvent) {
|
|
237
300
|
const info = { key: item.key, keyPath, domEvent, item };
|
|
@@ -730,6 +793,8 @@ var Input = forwardRef(function Input2({
|
|
|
730
793
|
});
|
|
731
794
|
|
|
732
795
|
export {
|
|
796
|
+
registerFloatingScrollbar,
|
|
797
|
+
setFloatingScrollbarDragging,
|
|
733
798
|
Menu,
|
|
734
799
|
Steps,
|
|
735
800
|
Segmented,
|
|
@@ -568,7 +568,7 @@ interface MenuProps extends Omit<HTMLAttributes<HTMLUListElement>, "onClick" | "
|
|
|
568
568
|
* @defaultValue []
|
|
569
569
|
*/
|
|
570
570
|
defaultSelectedKeys?: readonly string[];
|
|
571
|
-
/**
|
|
571
|
+
/** 当前展开的子菜单标识集合;传入后须在 onOpenChange 中更新。弹出模式的交互只保留当前分支与祖先,展开的内嵌模式允许多分支。 */
|
|
572
572
|
openKeys?: readonly string[];
|
|
573
573
|
/**
|
|
574
574
|
* 初始展开的子菜单标识集合。
|
|
@@ -612,10 +612,10 @@ interface MenuProps extends Omit<HTMLAttributes<HTMLUListElement>, "onClick" | "
|
|
|
612
612
|
/** 当前选中项目的标识集合;传入后由外部控制。 */
|
|
613
613
|
selectedKeys: string[];
|
|
614
614
|
}) => void;
|
|
615
|
-
/**
|
|
615
|
+
/** 子菜单交互改变展开状态时触发,参数为完整的展开键集合;弹出模式切换兄弟目录时同时移除旧分支及后代。受控时应将该集合写回 openKeys。 */
|
|
616
616
|
onOpenChange?: (keys: string[]) => void;
|
|
617
617
|
}
|
|
618
|
-
/**
|
|
618
|
+
/** 菜单组件;弹出子菜单切换时只保留当前分支及其祖先,内嵌模式允许多分支展开;操作浮动滚动条时保持对应菜单展开。侧向子菜单距父菜单项水平偏移 16px,上下弹出偏移 4px,空间不足时自动翻转方向。 */
|
|
619
619
|
declare function Menu({ items, mode, gridColumns, interactionCursor, theme, selectedKeys, autoScrollSelected, defaultSelectedKeys, openKeys, defaultOpenKeys, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, onClick, onSelect, onDeselect, onOpenChange, className, style, ...rest }: MenuProps): react.JSX.Element;
|
|
620
620
|
/** Step的状态类型。 */
|
|
621
621
|
type StepStatus = "wait" | "process" | "finish" | "error";
|
|
@@ -568,7 +568,7 @@ interface MenuProps extends Omit<HTMLAttributes<HTMLUListElement>, "onClick" | "
|
|
|
568
568
|
* @defaultValue []
|
|
569
569
|
*/
|
|
570
570
|
defaultSelectedKeys?: readonly string[];
|
|
571
|
-
/**
|
|
571
|
+
/** 当前展开的子菜单标识集合;传入后须在 onOpenChange 中更新。弹出模式的交互只保留当前分支与祖先,展开的内嵌模式允许多分支。 */
|
|
572
572
|
openKeys?: readonly string[];
|
|
573
573
|
/**
|
|
574
574
|
* 初始展开的子菜单标识集合。
|
|
@@ -612,10 +612,10 @@ interface MenuProps extends Omit<HTMLAttributes<HTMLUListElement>, "onClick" | "
|
|
|
612
612
|
/** 当前选中项目的标识集合;传入后由外部控制。 */
|
|
613
613
|
selectedKeys: string[];
|
|
614
614
|
}) => void;
|
|
615
|
-
/**
|
|
615
|
+
/** 子菜单交互改变展开状态时触发,参数为完整的展开键集合;弹出模式切换兄弟目录时同时移除旧分支及后代。受控时应将该集合写回 openKeys。 */
|
|
616
616
|
onOpenChange?: (keys: string[]) => void;
|
|
617
617
|
}
|
|
618
|
-
/**
|
|
618
|
+
/** 菜单组件;弹出子菜单切换时只保留当前分支及其祖先,内嵌模式允许多分支展开;操作浮动滚动条时保持对应菜单展开。侧向子菜单距父菜单项水平偏移 16px,上下弹出偏移 4px,空间不足时自动翻转方向。 */
|
|
619
619
|
declare function Menu({ items, mode, gridColumns, interactionCursor, theme, selectedKeys, autoScrollSelected, defaultSelectedKeys, openKeys, defaultOpenKeys, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, onClick, onSelect, onDeselect, onOpenChange, className, style, ...rest }: MenuProps): react.JSX.Element;
|
|
620
620
|
/** Step的状态类型。 */
|
|
621
621
|
type StepStatus = "wait" | "process" | "finish" | "error";
|
package/dist/core.cjs
CHANGED
|
@@ -1565,10 +1565,35 @@ var Icon = (0, import_react5.forwardRef)(function Icon2({ name, tone = "inherit"
|
|
|
1565
1565
|
|
|
1566
1566
|
// src/components/Navigation.tsx
|
|
1567
1567
|
var import_react6 = require("react");
|
|
1568
|
+
|
|
1569
|
+
// src/components/floatingScrollbarOwnership.ts
|
|
1570
|
+
var targets = /* @__PURE__ */ new Map();
|
|
1571
|
+
function registerFloatingScrollbar(track, target) {
|
|
1572
|
+
targets.set(track, { target, dragging: false });
|
|
1573
|
+
return () => {
|
|
1574
|
+
targets.delete(track);
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
function setFloatingScrollbarDragging(track, dragging) {
|
|
1578
|
+
const entry = targets.get(track);
|
|
1579
|
+
if (entry) entry.dragging = dragging;
|
|
1580
|
+
}
|
|
1581
|
+
function resolveFloatingScrollbarTarget(target) {
|
|
1582
|
+
const track = target instanceof Element ? target.closest(".sia-floating-scrollbar") : null;
|
|
1583
|
+
return track && targets.get(track)?.target || target;
|
|
1584
|
+
}
|
|
1585
|
+
function hasFloatingScrollbarInteraction(container) {
|
|
1586
|
+
if (!container) return false;
|
|
1587
|
+
return [...targets].some(([track, entry]) => container.contains(entry.target) && (entry.dragging || track.matches(":hover")));
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
// src/components/Navigation.tsx
|
|
1568
1591
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1569
1592
|
var import_react7 = require("react");
|
|
1570
1593
|
function MenuPopup({
|
|
1571
1594
|
anchorRef,
|
|
1595
|
+
popupRef,
|
|
1596
|
+
keyPath,
|
|
1572
1597
|
open,
|
|
1573
1598
|
placement,
|
|
1574
1599
|
menuId,
|
|
@@ -1599,13 +1624,15 @@ function MenuPopup({
|
|
|
1599
1624
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1600
1625
|
PopupPortal,
|
|
1601
1626
|
{
|
|
1627
|
+
ref: popupRef,
|
|
1602
1628
|
anchorRef,
|
|
1603
1629
|
open: mounted,
|
|
1604
1630
|
placement,
|
|
1605
|
-
offset: 4,
|
|
1631
|
+
offset: placement.startsWith("right") || placement.startsWith("left") ? 16 : 4,
|
|
1606
1632
|
className: `sia-menu__popup sia-menu--${theme}${open ? " is-open" : " is-closing"}`,
|
|
1607
1633
|
style: { fontSize },
|
|
1608
1634
|
"data-sia-menu-owner": menuId,
|
|
1635
|
+
"data-sia-menu-path": JSON.stringify(keyPath),
|
|
1609
1636
|
onMouseEnter,
|
|
1610
1637
|
onMouseLeave,
|
|
1611
1638
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "sia-menu__popup-list", role: "menu", children })
|
|
@@ -1620,7 +1647,12 @@ function MenuEntry({
|
|
|
1620
1647
|
reserveIcon
|
|
1621
1648
|
}) {
|
|
1622
1649
|
const anchorRef = (0, import_react6.useRef)(null);
|
|
1650
|
+
const popupRef = (0, import_react6.useRef)(null);
|
|
1623
1651
|
const closeTimerRef = (0, import_react6.useRef)(void 0);
|
|
1652
|
+
const toggleRef = (0, import_react6.useRef)(props.toggle);
|
|
1653
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
1654
|
+
toggleRef.current = props.toggle;
|
|
1655
|
+
});
|
|
1624
1656
|
const hasChildren = Boolean(item.children?.length);
|
|
1625
1657
|
const isOpen = props.open.includes(item.key);
|
|
1626
1658
|
const isSelected = props.selected.includes(item.key);
|
|
@@ -1638,7 +1670,14 @@ function MenuEntry({
|
|
|
1638
1670
|
}
|
|
1639
1671
|
function scheduleClose() {
|
|
1640
1672
|
cancelClose();
|
|
1641
|
-
closeTimerRef.current = window.setTimeout(() =>
|
|
1673
|
+
closeTimerRef.current = window.setTimeout(() => {
|
|
1674
|
+
const interacting = hasFloatingScrollbarInteraction(popupRef.current) || [...document.querySelectorAll(".sia-menu__popup[data-sia-menu-owner]")].some((popup) => popup.dataset.siaMenuOwner === props.menuId && JSON.parse(popup.dataset.siaMenuPath ?? "[]").includes(item.key) && hasFloatingScrollbarInteraction(popup));
|
|
1675
|
+
if (interacting) {
|
|
1676
|
+
scheduleClose();
|
|
1677
|
+
return;
|
|
1678
|
+
}
|
|
1679
|
+
toggleRef.current(item.key, false);
|
|
1680
|
+
}, 100);
|
|
1642
1681
|
}
|
|
1643
1682
|
const hover = props.triggerSubMenuAction === "hover" && hasChildren && !inlineSubmenu;
|
|
1644
1683
|
const submenu = hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [item.key, ...parents], props }) : null;
|
|
@@ -1681,6 +1720,8 @@ function MenuEntry({
|
|
|
1681
1720
|
MenuPopup,
|
|
1682
1721
|
{
|
|
1683
1722
|
anchorRef,
|
|
1723
|
+
popupRef,
|
|
1724
|
+
keyPath: path,
|
|
1684
1725
|
open: isOpen,
|
|
1685
1726
|
placement: popupPlacement,
|
|
1686
1727
|
menuId: props.menuId,
|
|
@@ -1741,6 +1782,22 @@ function Menu({
|
|
|
1741
1782
|
const rootRef = (0, import_react6.useRef)(null);
|
|
1742
1783
|
const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
|
|
1743
1784
|
const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
|
|
1785
|
+
const pendingOpenRef = (0, import_react6.useRef)(open);
|
|
1786
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
1787
|
+
pendingOpenRef.current = open;
|
|
1788
|
+
});
|
|
1789
|
+
const popupPaths = (0, import_react6.useMemo)(() => {
|
|
1790
|
+
const paths = /* @__PURE__ */ new Map();
|
|
1791
|
+
const visit = (entries, parents) => {
|
|
1792
|
+
for (const entry of entries) {
|
|
1793
|
+
const path = [...parents, entry.key];
|
|
1794
|
+
paths.set(entry.key, path);
|
|
1795
|
+
if (entry.children) visit(entry.children, path);
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
visit(items, []);
|
|
1799
|
+
return paths;
|
|
1800
|
+
}, [items]);
|
|
1744
1801
|
const revealedKey = (0, import_react6.useRef)();
|
|
1745
1802
|
const firstSelected = selected[0];
|
|
1746
1803
|
(0, import_react6.useLayoutEffect)(() => {
|
|
@@ -1768,7 +1825,7 @@ function Menu({
|
|
|
1768
1825
|
(0, import_react6.useEffect)(() => {
|
|
1769
1826
|
if (mode === "inline" || !open.length) return void 0;
|
|
1770
1827
|
const closeOutside = (event) => {
|
|
1771
|
-
const target = event.target;
|
|
1828
|
+
const target = resolveFloatingScrollbarTarget(event.target);
|
|
1772
1829
|
if (rootRef.current?.contains(target)) return;
|
|
1773
1830
|
const owner = target instanceof Element ? target.closest("[data-sia-menu-owner]")?.getAttribute("data-sia-menu-owner") : null;
|
|
1774
1831
|
if (owner !== menuId) setOpen([]);
|
|
@@ -1777,8 +1834,14 @@ function Menu({
|
|
|
1777
1834
|
return () => document.removeEventListener("pointerdown", closeOutside);
|
|
1778
1835
|
}, [menuId, mode, open.length, setOpen]);
|
|
1779
1836
|
function toggle(key, force) {
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1837
|
+
const current = pendingOpenRef.current;
|
|
1838
|
+
const shouldOpen = force ?? !current.includes(key);
|
|
1839
|
+
if (shouldOpen === current.includes(key)) return;
|
|
1840
|
+
const cascading = mode !== "inline" || inlineCollapsed;
|
|
1841
|
+
const branch = popupPaths.get(key) ?? [key];
|
|
1842
|
+
const next = shouldOpen ? [...current.filter((item) => !cascading || branch.includes(item)), key] : current.filter((item) => item !== key && (!cascading || !popupPaths.get(item)?.includes(key)));
|
|
1843
|
+
pendingOpenRef.current = next;
|
|
1844
|
+
setOpen(next);
|
|
1782
1845
|
}
|
|
1783
1846
|
function select(item, keyPath, domEvent) {
|
|
1784
1847
|
const info = { key: item.key, keyPath, domEvent, item };
|
|
@@ -2906,6 +2969,7 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
2906
2969
|
event.preventDefault();
|
|
2907
2970
|
event.stopPropagation();
|
|
2908
2971
|
entry.dragging = true;
|
|
2972
|
+
setFloatingScrollbarDragging(track, true);
|
|
2909
2973
|
showEntry(entry);
|
|
2910
2974
|
thumb.setPointerCapture(event.pointerId);
|
|
2911
2975
|
const startPointer = axis === "vertical" ? event.clientY : event.clientX;
|
|
@@ -2926,6 +2990,7 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
2926
2990
|
const onPointerUp = (upEvent) => {
|
|
2927
2991
|
if (upEvent.pointerId !== event.pointerId) return;
|
|
2928
2992
|
entry.dragging = false;
|
|
2993
|
+
setFloatingScrollbarDragging(track, false);
|
|
2929
2994
|
thumb.releasePointerCapture(event.pointerId);
|
|
2930
2995
|
window.removeEventListener("pointermove", onPointerMove);
|
|
2931
2996
|
window.removeEventListener("pointerup", onPointerUp);
|
|
@@ -2957,6 +3022,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
2957
3022
|
if (entries.has(target)) return;
|
|
2958
3023
|
const horizontal = createTrack("horizontal");
|
|
2959
3024
|
const vertical = createTrack("vertical");
|
|
3025
|
+
const releaseHorizontalOwner = registerFloatingScrollbar(horizontal.track, target);
|
|
3026
|
+
const releaseVerticalOwner = registerFloatingScrollbar(vertical.track, target);
|
|
2960
3027
|
layer.append(horizontal.track, vertical.track);
|
|
2961
3028
|
const onPointerEnter = () => {
|
|
2962
3029
|
const entry2 = entries.get(target);
|
|
@@ -2998,6 +3065,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
2998
3065
|
if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
|
|
2999
3066
|
cleanupHorizontal();
|
|
3000
3067
|
cleanupVertical();
|
|
3068
|
+
releaseHorizontalOwner();
|
|
3069
|
+
releaseVerticalOwner();
|
|
3001
3070
|
target.removeEventListener("pointerenter", onPointerEnter);
|
|
3002
3071
|
target.removeEventListener("pointerleave", onPointerLeave);
|
|
3003
3072
|
target.removeEventListener("scroll", onScroll);
|
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-
|
|
1
|
+
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-lZIzt-an.cjs';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
|
|
3
3
|
export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-Y0e9kaxE.cjs';
|
|
4
4
|
import 'react';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-
|
|
1
|
+
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-Bkk7-59o.js';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-BiL3Wjsd.js';
|
|
3
3
|
export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-DeD4O8FL.js';
|
|
4
4
|
import 'react';
|
package/dist/core.js
CHANGED
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
Typography,
|
|
12
12
|
Upload,
|
|
13
13
|
message
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4KNFPQEV.js";
|
|
15
15
|
import "./chunk-RX242MUO.js";
|
|
16
16
|
import {
|
|
17
17
|
Select
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-436QH6XH.js";
|
|
19
19
|
import {
|
|
20
20
|
Input,
|
|
21
21
|
Segmented
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-UVHC6OEX.js";
|
|
23
23
|
import "./chunk-SCEHVGKV.js";
|
|
24
24
|
import {
|
|
25
25
|
Icon,
|