@sia.soul/sia-react-ui 0.1.115 → 0.1.117
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-SPIQSYWQ.js → chunk-6DFAX43X.js} +28 -2
- package/dist/{chunk-GNOZYUIH.js → chunk-CKP3SNVH.js} +3 -3
- package/dist/{chunk-MDU5EONC.js → chunk-HHPZOBY3.js} +2 -2
- package/dist/{chunk-XY7CXJS6.js → chunk-KIQSPAAQ.js} +3 -2
- package/dist/{chunk-6XQ2LDGT.js → chunk-RYNEJ6LD.js} +2 -2
- package/dist/{chunk-KPOK4HIQ.js → chunk-SB53UBFV.js} +2 -2
- package/dist/{core-uVaNwjTO.d.ts → core-De9MXbF6.d.ts} +15 -2
- package/dist/{core-O6oDXbkG.d.cts → core-DlngVjmf.d.cts} +15 -2
- package/dist/core.cjs +30 -3
- package/dist/core.css +15 -2
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +4 -4
- package/dist/game.cjs +3 -2
- package/dist/game.css +13 -0
- package/dist/game.js +1 -1
- package/dist/index.cjs +794 -715
- package/dist/index.css +15 -2
- package/dist/index.d.cts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +197 -145
- package/dist/rich-text-editor.cjs +30 -3
- package/dist/rich-text-editor.js +3 -3
- package/dist/select-date-range.cjs +3 -2
- package/dist/select-date-range.js +4 -4
- package/package.json +1 -1
|
@@ -1552,9 +1552,10 @@ var filledIconPaths = {
|
|
|
1552
1552
|
var FILLED_ICON_NAMES = Object.freeze(Object.keys(filledIconPaths));
|
|
1553
1553
|
var normalizedOutlinePaths = normalizeIconPaths(iconPaths, outlineIconBounds);
|
|
1554
1554
|
var normalizedFilledPaths = normalizeIconPaths(filledIconPaths, filledIconBounds);
|
|
1555
|
-
var Icon = (0, import_react5.forwardRef)(function Icon2({ name, size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
|
|
1555
|
+
var Icon = (0, import_react5.forwardRef)(function Icon2({ name, tone = "inherit", size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
|
|
1556
1556
|
const resolvedSize = typeof size === "number" ? `${size}px` : size;
|
|
1557
|
-
const
|
|
1557
|
+
const toneColor = tone === "inherit" ? void 0 : `var(--sia-color-${tone === "danger" ? "error" : tone === "primary" ? "primary-text" : tone})`;
|
|
1558
|
+
const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, color: toneColor, ...style };
|
|
1558
1559
|
const animationClass = spin ? " sia-icon--spin" : pulse ? " sia-icon--pulse" : "";
|
|
1559
1560
|
const filledPath = filledIconPaths[name];
|
|
1560
1561
|
const resolvedVariant = variant === "filled" && filledPath ? "filled" : "outline";
|
|
@@ -1675,12 +1676,13 @@ function MenuEntry({
|
|
|
1675
1676
|
...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
|
|
1676
1677
|
disabled: item.disabled,
|
|
1677
1678
|
"aria-current": isSelected ? "page" : void 0,
|
|
1679
|
+
"data-menu-key": item.key,
|
|
1678
1680
|
"data-applied": item.applied || void 0,
|
|
1679
1681
|
"aria-expanded": hasChildren ? isOpen : void 0,
|
|
1680
1682
|
onClick: (event) => hasChildren ? props.toggle(item.key) : props.select(item, path, event),
|
|
1681
1683
|
children: [
|
|
1682
1684
|
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,
|
|
1685
|
+
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
1686
|
!collapsed ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__label", children: item.label }) : null,
|
|
1685
1687
|
!collapsed && item.extra ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__extra", children: item.extra }) : null,
|
|
1686
1688
|
!collapsed && hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
|
|
@@ -1729,6 +1731,7 @@ function Menu({
|
|
|
1729
1731
|
gridColumns = 2,
|
|
1730
1732
|
theme = "light",
|
|
1731
1733
|
selectedKeys,
|
|
1734
|
+
autoScrollSelected = false,
|
|
1732
1735
|
defaultSelectedKeys = [],
|
|
1733
1736
|
openKeys,
|
|
1734
1737
|
defaultOpenKeys = [],
|
|
@@ -1749,6 +1752,30 @@ function Menu({
|
|
|
1749
1752
|
const rootRef = (0, import_react6.useRef)(null);
|
|
1750
1753
|
const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
|
|
1751
1754
|
const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
|
|
1755
|
+
const revealedKey = (0, import_react6.useRef)();
|
|
1756
|
+
const firstSelected = selected[0];
|
|
1757
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
1758
|
+
if (!autoScrollSelected || firstSelected === void 0) {
|
|
1759
|
+
revealedKey.current = void 0;
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1762
|
+
const root = rootRef.current;
|
|
1763
|
+
if (!root || revealedKey.current === firstSelected || mode === "horizontal") return;
|
|
1764
|
+
const reveal = () => {
|
|
1765
|
+
if (revealedKey.current === firstSelected || root.clientHeight === 0) return;
|
|
1766
|
+
const target = Array.from(root.querySelectorAll(".sia-menu__item")).find((element) => element.dataset.menuKey === firstSelected && element.getBoundingClientRect().height > 0);
|
|
1767
|
+
if (!target) return;
|
|
1768
|
+
const bounds = root.getBoundingClientRect(), item = target.getBoundingClientRect();
|
|
1769
|
+
const top = bounds.top + root.clientTop, bottom = top + root.clientHeight;
|
|
1770
|
+
if (item.top < top || item.bottom > bottom)
|
|
1771
|
+
root.scrollTop += item.top - top - Math.max(0, (root.clientHeight - item.height) / 2);
|
|
1772
|
+
revealedKey.current = firstSelected;
|
|
1773
|
+
};
|
|
1774
|
+
reveal();
|
|
1775
|
+
const observer = new ResizeObserver(reveal);
|
|
1776
|
+
observer.observe(root);
|
|
1777
|
+
return () => observer.disconnect();
|
|
1778
|
+
}, [autoScrollSelected, firstSelected, items, mode]);
|
|
1752
1779
|
(0, import_react6.useEffect)(() => {
|
|
1753
1780
|
if (mode === "inline" || !open.length) return void 0;
|
|
1754
1781
|
const closeOutside = (event) => {
|
package/dist/rich-text-editor.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RichTextContent,
|
|
3
3
|
RichTextEditor
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-HHPZOBY3.js";
|
|
5
|
+
import "./chunk-6DFAX43X.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-KIQSPAAQ.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|
|
9
9
|
import "./chunk-KY6A5IJH.js";
|
|
10
10
|
import "./chunk-NZMUW5XI.js";
|
|
@@ -1469,9 +1469,10 @@ var filledIconPaths = {
|
|
|
1469
1469
|
var FILLED_ICON_NAMES = Object.freeze(Object.keys(filledIconPaths));
|
|
1470
1470
|
var normalizedOutlinePaths = normalizeIconPaths(iconPaths, outlineIconBounds);
|
|
1471
1471
|
var normalizedFilledPaths = normalizeIconPaths(filledIconPaths, filledIconBounds);
|
|
1472
|
-
var Icon = (0, import_react4.forwardRef)(function Icon2({ name, size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
|
|
1472
|
+
var Icon = (0, import_react4.forwardRef)(function Icon2({ name, tone = "inherit", size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
|
|
1473
1473
|
const resolvedSize = typeof size === "number" ? `${size}px` : size;
|
|
1474
|
-
const
|
|
1474
|
+
const toneColor = tone === "inherit" ? void 0 : `var(--sia-color-${tone === "danger" ? "error" : tone === "primary" ? "primary-text" : tone})`;
|
|
1475
|
+
const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, color: toneColor, ...style };
|
|
1475
1476
|
const animationClass = spin ? " sia-icon--spin" : pulse ? " sia-icon--pulse" : "";
|
|
1476
1477
|
const filledPath = filledIconPaths[name];
|
|
1477
1478
|
const resolvedVariant = variant === "filled" && filledPath ? "filled" : "outline";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectDateRange
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-RYNEJ6LD.js";
|
|
4
|
+
import "./chunk-SB53UBFV.js";
|
|
5
|
+
import "./chunk-6DFAX43X.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-KIQSPAAQ.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|
|
9
9
|
import "./chunk-KY6A5IJH.js";
|
|
10
10
|
import "./chunk-NZMUW5XI.js";
|