@sia.soul/sia-react-ui 0.1.115 → 0.1.116
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-KPOK4HIQ.js → chunk-7PPE6DJO.js} +1 -1
- package/dist/{chunk-MDU5EONC.js → chunk-CVIFJLW6.js} +1 -1
- package/dist/{chunk-GNOZYUIH.js → chunk-D2H37DUL.js} +2 -2
- package/dist/{chunk-6XQ2LDGT.js → chunk-MKCU5S77.js} +1 -1
- package/dist/{chunk-SPIQSYWQ.js → chunk-SATXB6X4.js} +27 -1
- package/dist/{core-O6oDXbkG.d.cts → core-CCb4CoSP.d.cts} +9 -2
- package/dist/{core-uVaNwjTO.d.ts → core-CJnRQZkv.d.ts} +9 -2
- package/dist/core.cjs +27 -1
- package/dist/core.css +15 -2
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +3 -3
- package/dist/game.css +13 -0
- package/dist/index.cjs +791 -713
- package/dist/index.css +15 -2
- package/dist/index.d.cts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +196 -144
- package/dist/rich-text-editor.cjs +27 -1
- package/dist/rich-text-editor.js +2 -2
- package/dist/select-date-range.js +3 -3
- package/package.json +1 -1
|
@@ -1675,12 +1675,13 @@ function MenuEntry({
|
|
|
1675
1675
|
...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
|
|
1676
1676
|
disabled: item.disabled,
|
|
1677
1677
|
"aria-current": isSelected ? "page" : void 0,
|
|
1678
|
+
"data-menu-key": item.key,
|
|
1678
1679
|
"data-applied": item.applied || void 0,
|
|
1679
1680
|
"aria-expanded": hasChildren ? isOpen : void 0,
|
|
1680
1681
|
onClick: (event) => hasChildren ? props.toggle(item.key) : props.select(item, path, event),
|
|
1681
1682
|
children: [
|
|
1682
1683
|
reserveIcon ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__icon", style: item.iconSize ? { width: item.iconSize, height: item.iconSize, flexBasis: item.iconSize } : void 0, "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
|
|
1683
|
-
item.applied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "circle-check", size: 32 }) }) : null,
|
|
1684
|
+
item.applied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "circle-check", variant: "filled", size: 32 }) }) : null,
|
|
1684
1685
|
!collapsed ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__label", children: item.label }) : null,
|
|
1685
1686
|
!collapsed && item.extra ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__extra", children: item.extra }) : null,
|
|
1686
1687
|
!collapsed && hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
|
|
@@ -1729,6 +1730,7 @@ function Menu({
|
|
|
1729
1730
|
gridColumns = 2,
|
|
1730
1731
|
theme = "light",
|
|
1731
1732
|
selectedKeys,
|
|
1733
|
+
autoScrollSelected = false,
|
|
1732
1734
|
defaultSelectedKeys = [],
|
|
1733
1735
|
openKeys,
|
|
1734
1736
|
defaultOpenKeys = [],
|
|
@@ -1749,6 +1751,30 @@ function Menu({
|
|
|
1749
1751
|
const rootRef = (0, import_react6.useRef)(null);
|
|
1750
1752
|
const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
|
|
1751
1753
|
const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
|
|
1754
|
+
const revealedKey = (0, import_react6.useRef)();
|
|
1755
|
+
const firstSelected = selected[0];
|
|
1756
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
1757
|
+
if (!autoScrollSelected || firstSelected === void 0) {
|
|
1758
|
+
revealedKey.current = void 0;
|
|
1759
|
+
return;
|
|
1760
|
+
}
|
|
1761
|
+
const root = rootRef.current;
|
|
1762
|
+
if (!root || revealedKey.current === firstSelected || mode === "horizontal") return;
|
|
1763
|
+
const reveal = () => {
|
|
1764
|
+
if (revealedKey.current === firstSelected || root.clientHeight === 0) return;
|
|
1765
|
+
const target = Array.from(root.querySelectorAll(".sia-menu__item")).find((element) => element.dataset.menuKey === firstSelected && element.getBoundingClientRect().height > 0);
|
|
1766
|
+
if (!target) return;
|
|
1767
|
+
const bounds = root.getBoundingClientRect(), item = target.getBoundingClientRect();
|
|
1768
|
+
const top = bounds.top + root.clientTop, bottom = top + root.clientHeight;
|
|
1769
|
+
if (item.top < top || item.bottom > bottom)
|
|
1770
|
+
root.scrollTop += item.top - top - Math.max(0, (root.clientHeight - item.height) / 2);
|
|
1771
|
+
revealedKey.current = firstSelected;
|
|
1772
|
+
};
|
|
1773
|
+
reveal();
|
|
1774
|
+
const observer = new ResizeObserver(reveal);
|
|
1775
|
+
observer.observe(root);
|
|
1776
|
+
return () => observer.disconnect();
|
|
1777
|
+
}, [autoScrollSelected, firstSelected, items, mode]);
|
|
1752
1778
|
(0, import_react6.useEffect)(() => {
|
|
1753
1779
|
if (mode === "inline" || !open.length) return void 0;
|
|
1754
1780
|
const closeOutside = (event) => {
|
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-CVIFJLW6.js";
|
|
5
|
+
import "./chunk-SATXB6X4.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
7
|
import "./chunk-XY7CXJS6.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectDateRange
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-MKCU5S77.js";
|
|
4
|
+
import "./chunk-7PPE6DJO.js";
|
|
5
|
+
import "./chunk-SATXB6X4.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
7
|
import "./chunk-XY7CXJS6.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|