@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
|
@@ -1582,10 +1582,25 @@ var Icon = (0, import_react5.forwardRef)(function Icon2({ name, tone = "inherit"
|
|
|
1582
1582
|
|
|
1583
1583
|
// src/components/Navigation.tsx
|
|
1584
1584
|
var import_react6 = require("react");
|
|
1585
|
+
|
|
1586
|
+
// src/components/floatingScrollbarOwnership.ts
|
|
1587
|
+
var targets = /* @__PURE__ */ new Map();
|
|
1588
|
+
function resolveFloatingScrollbarTarget(target) {
|
|
1589
|
+
const track = target instanceof Element ? target.closest(".sia-floating-scrollbar") : null;
|
|
1590
|
+
return track && targets.get(track)?.target || target;
|
|
1591
|
+
}
|
|
1592
|
+
function hasFloatingScrollbarInteraction(container) {
|
|
1593
|
+
if (!container) return false;
|
|
1594
|
+
return [...targets].some(([track, entry]) => container.contains(entry.target) && (entry.dragging || track.matches(":hover")));
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
// src/components/Navigation.tsx
|
|
1585
1598
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1586
1599
|
var import_react7 = require("react");
|
|
1587
1600
|
function MenuPopup({
|
|
1588
1601
|
anchorRef,
|
|
1602
|
+
popupRef,
|
|
1603
|
+
keyPath,
|
|
1589
1604
|
open,
|
|
1590
1605
|
placement,
|
|
1591
1606
|
menuId,
|
|
@@ -1616,13 +1631,15 @@ function MenuPopup({
|
|
|
1616
1631
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1617
1632
|
PopupPortal,
|
|
1618
1633
|
{
|
|
1634
|
+
ref: popupRef,
|
|
1619
1635
|
anchorRef,
|
|
1620
1636
|
open: mounted,
|
|
1621
1637
|
placement,
|
|
1622
|
-
offset: 4,
|
|
1638
|
+
offset: placement.startsWith("right") || placement.startsWith("left") ? 16 : 4,
|
|
1623
1639
|
className: `sia-menu__popup sia-menu--${theme}${open ? " is-open" : " is-closing"}`,
|
|
1624
1640
|
style: { fontSize },
|
|
1625
1641
|
"data-sia-menu-owner": menuId,
|
|
1642
|
+
"data-sia-menu-path": JSON.stringify(keyPath),
|
|
1626
1643
|
onMouseEnter,
|
|
1627
1644
|
onMouseLeave,
|
|
1628
1645
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "sia-menu__popup-list", role: "menu", children })
|
|
@@ -1637,7 +1654,12 @@ function MenuEntry({
|
|
|
1637
1654
|
reserveIcon
|
|
1638
1655
|
}) {
|
|
1639
1656
|
const anchorRef = (0, import_react6.useRef)(null);
|
|
1657
|
+
const popupRef = (0, import_react6.useRef)(null);
|
|
1640
1658
|
const closeTimerRef = (0, import_react6.useRef)(void 0);
|
|
1659
|
+
const toggleRef = (0, import_react6.useRef)(props.toggle);
|
|
1660
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
1661
|
+
toggleRef.current = props.toggle;
|
|
1662
|
+
});
|
|
1641
1663
|
const hasChildren = Boolean(item.children?.length);
|
|
1642
1664
|
const isOpen = props.open.includes(item.key);
|
|
1643
1665
|
const isSelected = props.selected.includes(item.key);
|
|
@@ -1655,7 +1677,14 @@ function MenuEntry({
|
|
|
1655
1677
|
}
|
|
1656
1678
|
function scheduleClose() {
|
|
1657
1679
|
cancelClose();
|
|
1658
|
-
closeTimerRef.current = window.setTimeout(() =>
|
|
1680
|
+
closeTimerRef.current = window.setTimeout(() => {
|
|
1681
|
+
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));
|
|
1682
|
+
if (interacting) {
|
|
1683
|
+
scheduleClose();
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
toggleRef.current(item.key, false);
|
|
1687
|
+
}, 100);
|
|
1659
1688
|
}
|
|
1660
1689
|
const hover = props.triggerSubMenuAction === "hover" && hasChildren && !inlineSubmenu;
|
|
1661
1690
|
const submenu = hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [item.key, ...parents], props }) : null;
|
|
@@ -1698,6 +1727,8 @@ function MenuEntry({
|
|
|
1698
1727
|
MenuPopup,
|
|
1699
1728
|
{
|
|
1700
1729
|
anchorRef,
|
|
1730
|
+
popupRef,
|
|
1731
|
+
keyPath: path,
|
|
1701
1732
|
open: isOpen,
|
|
1702
1733
|
placement: popupPlacement,
|
|
1703
1734
|
menuId: props.menuId,
|
|
@@ -1758,6 +1789,22 @@ function Menu({
|
|
|
1758
1789
|
const rootRef = (0, import_react6.useRef)(null);
|
|
1759
1790
|
const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
|
|
1760
1791
|
const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
|
|
1792
|
+
const pendingOpenRef = (0, import_react6.useRef)(open);
|
|
1793
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
1794
|
+
pendingOpenRef.current = open;
|
|
1795
|
+
});
|
|
1796
|
+
const popupPaths = (0, import_react6.useMemo)(() => {
|
|
1797
|
+
const paths = /* @__PURE__ */ new Map();
|
|
1798
|
+
const visit = (entries, parents) => {
|
|
1799
|
+
for (const entry of entries) {
|
|
1800
|
+
const path = [...parents, entry.key];
|
|
1801
|
+
paths.set(entry.key, path);
|
|
1802
|
+
if (entry.children) visit(entry.children, path);
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
visit(items, []);
|
|
1806
|
+
return paths;
|
|
1807
|
+
}, [items]);
|
|
1761
1808
|
const revealedKey = (0, import_react6.useRef)();
|
|
1762
1809
|
const firstSelected = selected[0];
|
|
1763
1810
|
(0, import_react6.useLayoutEffect)(() => {
|
|
@@ -1785,7 +1832,7 @@ function Menu({
|
|
|
1785
1832
|
(0, import_react6.useEffect)(() => {
|
|
1786
1833
|
if (mode === "inline" || !open.length) return void 0;
|
|
1787
1834
|
const closeOutside = (event) => {
|
|
1788
|
-
const target = event.target;
|
|
1835
|
+
const target = resolveFloatingScrollbarTarget(event.target);
|
|
1789
1836
|
if (rootRef.current?.contains(target)) return;
|
|
1790
1837
|
const owner = target instanceof Element ? target.closest("[data-sia-menu-owner]")?.getAttribute("data-sia-menu-owner") : null;
|
|
1791
1838
|
if (owner !== menuId) setOpen([]);
|
|
@@ -1794,8 +1841,14 @@ function Menu({
|
|
|
1794
1841
|
return () => document.removeEventListener("pointerdown", closeOutside);
|
|
1795
1842
|
}, [menuId, mode, open.length, setOpen]);
|
|
1796
1843
|
function toggle(key, force) {
|
|
1797
|
-
const
|
|
1798
|
-
|
|
1844
|
+
const current = pendingOpenRef.current;
|
|
1845
|
+
const shouldOpen = force ?? !current.includes(key);
|
|
1846
|
+
if (shouldOpen === current.includes(key)) return;
|
|
1847
|
+
const cascading = mode !== "inline" || inlineCollapsed;
|
|
1848
|
+
const branch = popupPaths.get(key) ?? [key];
|
|
1849
|
+
const next = shouldOpen ? [...current.filter((item) => !cascading || branch.includes(item)), key] : current.filter((item) => item !== key && (!cascading || !popupPaths.get(item)?.includes(key)));
|
|
1850
|
+
pendingOpenRef.current = next;
|
|
1851
|
+
setOpen(next);
|
|
1799
1852
|
}
|
|
1800
1853
|
function select(item, keyPath, domEvent) {
|
|
1801
1854
|
const info = { key: item.key, keyPath, domEvent, item };
|
package/dist/rich-text-editor.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RichTextContent,
|
|
3
3
|
RichTextEditor
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-WIRIEIRO.js";
|
|
5
|
+
import "./chunk-UVHC6OEX.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
7
|
import "./chunk-PQBCD54U.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|
|
@@ -1565,6 +1565,19 @@ function useScrollbarProximity() {
|
|
|
1565
1565
|
}, []);
|
|
1566
1566
|
}
|
|
1567
1567
|
|
|
1568
|
+
// src/components/floatingScrollbarOwnership.ts
|
|
1569
|
+
var targets = /* @__PURE__ */ new Map();
|
|
1570
|
+
function registerFloatingScrollbar(track, target) {
|
|
1571
|
+
targets.set(track, { target, dragging: false });
|
|
1572
|
+
return () => {
|
|
1573
|
+
targets.delete(track);
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
function setFloatingScrollbarDragging(track, dragging) {
|
|
1577
|
+
const entry = targets.get(track);
|
|
1578
|
+
if (entry) entry.dragging = dragging;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1568
1581
|
// src/components/FloatingScrollbarProvider.tsx
|
|
1569
1582
|
var scrollableOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
|
|
1570
1583
|
var clippingOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay", "hidden", "clip"]);
|
|
@@ -1724,6 +1737,7 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
1724
1737
|
event.preventDefault();
|
|
1725
1738
|
event.stopPropagation();
|
|
1726
1739
|
entry.dragging = true;
|
|
1740
|
+
setFloatingScrollbarDragging(track, true);
|
|
1727
1741
|
showEntry(entry);
|
|
1728
1742
|
thumb.setPointerCapture(event.pointerId);
|
|
1729
1743
|
const startPointer = axis === "vertical" ? event.clientY : event.clientX;
|
|
@@ -1744,6 +1758,7 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
1744
1758
|
const onPointerUp = (upEvent) => {
|
|
1745
1759
|
if (upEvent.pointerId !== event.pointerId) return;
|
|
1746
1760
|
entry.dragging = false;
|
|
1761
|
+
setFloatingScrollbarDragging(track, false);
|
|
1747
1762
|
thumb.releasePointerCapture(event.pointerId);
|
|
1748
1763
|
window.removeEventListener("pointermove", onPointerMove);
|
|
1749
1764
|
window.removeEventListener("pointerup", onPointerUp);
|
|
@@ -1775,6 +1790,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
1775
1790
|
if (entries.has(target)) return;
|
|
1776
1791
|
const horizontal = createTrack("horizontal");
|
|
1777
1792
|
const vertical = createTrack("vertical");
|
|
1793
|
+
const releaseHorizontalOwner = registerFloatingScrollbar(horizontal.track, target);
|
|
1794
|
+
const releaseVerticalOwner = registerFloatingScrollbar(vertical.track, target);
|
|
1778
1795
|
layer.append(horizontal.track, vertical.track);
|
|
1779
1796
|
const onPointerEnter = () => {
|
|
1780
1797
|
const entry2 = entries.get(target);
|
|
@@ -1816,6 +1833,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
1816
1833
|
if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
|
|
1817
1834
|
cleanupHorizontal();
|
|
1818
1835
|
cleanupVertical();
|
|
1836
|
+
releaseHorizontalOwner();
|
|
1837
|
+
releaseVerticalOwner();
|
|
1819
1838
|
target.removeEventListener("pointerenter", onPointerEnter);
|
|
1820
1839
|
target.removeEventListener("pointerleave", onPointerLeave);
|
|
1821
1840
|
target.removeEventListener("scroll", onScroll);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectDateRange
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-L2S7IPSM.js";
|
|
4
|
+
import "./chunk-436QH6XH.js";
|
|
5
|
+
import "./chunk-UVHC6OEX.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
7
|
import "./chunk-PQBCD54U.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|