@sia.soul/sia-react-ui 0.1.116 → 0.1.118
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-XY7CXJS6.js → chunk-6MGFX7B2.js} +24 -2
- package/dist/{chunk-MKCU5S77.js → chunk-AOWWHL5Z.js} +2 -2
- package/dist/{chunk-D2H37DUL.js → chunk-BEVCKS5J.js} +5 -3
- package/dist/{chunk-7PPE6DJO.js → chunk-BQIARYZB.js} +48 -18
- package/dist/{chunk-SATXB6X4.js → chunk-GKFFFHHU.js} +4 -2
- package/dist/{chunk-CVIFJLW6.js → chunk-QBBIBJXW.js} +2 -2
- package/dist/{core-CJnRQZkv.d.ts → core-PlVXb05e.d.ts} +13 -3
- package/dist/{core-CCb4CoSP.d.cts → core-mmHC4SGJ.d.cts} +13 -3
- package/dist/core.cjs +169 -119
- package/dist/core.css +7 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +4 -4
- package/dist/game.cjs +9 -2
- package/dist/game.css +4 -0
- package/dist/game.js +1 -1
- package/dist/index.cjs +105 -26
- package/dist/index.css +7 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +41 -14
- package/dist/rich-text-editor.cjs +12 -3
- package/dist/rich-text-editor.js +3 -3
- package/dist/select-date-range.cjs +65 -17
- package/dist/select-date-range.js +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1608,9 +1608,10 @@ var filledIconPaths = {
|
|
|
1608
1608
|
var FILLED_ICON_NAMES = Object.freeze(Object.keys(filledIconPaths));
|
|
1609
1609
|
var normalizedOutlinePaths = normalizeIconPaths(iconPaths, outlineIconBounds);
|
|
1610
1610
|
var normalizedFilledPaths = normalizeIconPaths(filledIconPaths, filledIconBounds);
|
|
1611
|
-
var Icon = (0, import_react3.forwardRef)(function Icon2({ name, size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
|
|
1611
|
+
var Icon = (0, import_react3.forwardRef)(function Icon2({ name, tone = "inherit", size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
|
|
1612
1612
|
const resolvedSize = typeof size === "number" ? `${size}px` : size;
|
|
1613
|
-
const
|
|
1613
|
+
const toneColor = tone === "inherit" ? void 0 : `var(--sia-color-${tone === "danger" ? "error" : tone === "primary" ? "primary-text" : tone})`;
|
|
1614
|
+
const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, color: toneColor, ...style };
|
|
1614
1615
|
const animationClass = spin ? " sia-icon--spin" : pulse ? " sia-icon--pulse" : "";
|
|
1615
1616
|
const filledPath = filledIconPaths[name];
|
|
1616
1617
|
const resolvedVariant = variant === "filled" && filledPath ? "filled" : "outline";
|
|
@@ -1718,6 +1719,21 @@ var import_react_dom2 = require("react-dom");
|
|
|
1718
1719
|
var bodyLockCount = 0;
|
|
1719
1720
|
var previousBodyOverflow = "";
|
|
1720
1721
|
var overlayStack = [];
|
|
1722
|
+
var overlayPanels = /* @__PURE__ */ new Map();
|
|
1723
|
+
var overlayListeners = /* @__PURE__ */ new Set();
|
|
1724
|
+
function subscribeOverlayLayers(listener) {
|
|
1725
|
+
overlayListeners.add(listener);
|
|
1726
|
+
return () => {
|
|
1727
|
+
overlayListeners.delete(listener);
|
|
1728
|
+
};
|
|
1729
|
+
}
|
|
1730
|
+
function isAnchorBehindOverlay(anchor) {
|
|
1731
|
+
const top = overlayStack.at(-1);
|
|
1732
|
+
const panel = top ? overlayPanels.get(top)?.current : void 0;
|
|
1733
|
+
if (!panel) return false;
|
|
1734
|
+
const root = panel.closest(".sia-modal-root, .sia-drawer-root");
|
|
1735
|
+
return root ? anchor.closest(".sia-modal-root, .sia-drawer-root") !== root : !panel.contains(anchor);
|
|
1736
|
+
}
|
|
1721
1737
|
function lockBodyScroll() {
|
|
1722
1738
|
if (bodyLockCount === 0) {
|
|
1723
1739
|
previousBodyOverflow = document.body.style.overflow;
|
|
@@ -1743,6 +1759,8 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
1743
1759
|
const overlayId = overlayIdRef.current;
|
|
1744
1760
|
const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
1745
1761
|
overlayStack.push(overlayId);
|
|
1762
|
+
overlayPanels.set(overlayId, panelRef);
|
|
1763
|
+
overlayListeners.forEach((listener) => listener());
|
|
1746
1764
|
const unlockBody = lockBodyScroll();
|
|
1747
1765
|
const focusTimer = window.setTimeout(() => {
|
|
1748
1766
|
const panel = panelRef.current;
|
|
@@ -1780,6 +1798,8 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
1780
1798
|
document.removeEventListener("keydown", handleKeyDown);
|
|
1781
1799
|
const index = overlayStack.lastIndexOf(overlayId);
|
|
1782
1800
|
if (index >= 0) overlayStack.splice(index, 1);
|
|
1801
|
+
overlayPanels.delete(overlayId);
|
|
1802
|
+
overlayListeners.forEach((listener) => listener());
|
|
1783
1803
|
unlockBody();
|
|
1784
1804
|
previouslyFocused?.focus({ preventScroll: true });
|
|
1785
1805
|
};
|
|
@@ -2138,10 +2158,20 @@ function Image2({ fallback, placeholder, preview = true, rootClassName = "", cla
|
|
|
2138
2158
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2139
2159
|
function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, followPointer = true, showHotspot = false, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerEnter, onPointerMove, onPointerLeave, ...props }) {
|
|
2140
2160
|
const rootRef = (0, import_react8.useRef)(null);
|
|
2141
|
-
const [bounds, setBounds] = (0, import_react8.useState)({ width: 0, height: 0 });
|
|
2161
|
+
const [bounds, setBounds] = (0, import_react8.useState)({ width: 0, height: 0, left: 0, top: 0 });
|
|
2142
2162
|
const [hovered, setHovered] = (0, import_react8.useState)(false);
|
|
2143
2163
|
const [index, setIndex] = (0, import_react8.useState)(0);
|
|
2144
2164
|
const [point, setPoint] = (0, import_react8.useState)(null);
|
|
2165
|
+
const moveFrame = (0, import_react8.useRef)(0);
|
|
2166
|
+
const latestPointer = (0, import_react8.useRef)({ x: 0, y: 0 });
|
|
2167
|
+
const cancelMove = () => {
|
|
2168
|
+
if (moveFrame.current) cancelAnimationFrame(moveFrame.current);
|
|
2169
|
+
moveFrame.current = 0;
|
|
2170
|
+
};
|
|
2171
|
+
(0, import_react8.useEffect)(() => {
|
|
2172
|
+
if (!followPointer) setPoint(null);
|
|
2173
|
+
return cancelMove;
|
|
2174
|
+
}, [followPointer]);
|
|
2145
2175
|
const [reduced, setReduced] = (0, import_react8.useState)(false);
|
|
2146
2176
|
const [failed, setFailed] = (0, import_react8.useState)(false);
|
|
2147
2177
|
const [density, setDensity] = (0, import_react8.useState)(() => typeof window === "undefined" ? 1 : window.devicePixelRatio || 1);
|
|
@@ -2168,12 +2198,20 @@ function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, fo
|
|
|
2168
2198
|
(0, import_react8.useLayoutEffect)(() => {
|
|
2169
2199
|
const root = rootRef.current;
|
|
2170
2200
|
if (!showHotspot && sizeUnit !== "device" || !root) return;
|
|
2171
|
-
const measure = () =>
|
|
2201
|
+
const measure = () => {
|
|
2202
|
+
const rect = root.getBoundingClientRect();
|
|
2203
|
+
const next = { width: root.clientWidth, height: root.clientHeight, left: rect.left, top: rect.top };
|
|
2204
|
+
setBounds((previous) => Object.keys(next).every((key) => previous[key] === next[key]) ? previous : next);
|
|
2205
|
+
};
|
|
2172
2206
|
measure();
|
|
2173
2207
|
const observer = new ResizeObserver(measure);
|
|
2174
2208
|
observer.observe(root);
|
|
2175
|
-
|
|
2176
|
-
|
|
2209
|
+
window.addEventListener("scroll", measure, true);
|
|
2210
|
+
return () => {
|
|
2211
|
+
observer.disconnect();
|
|
2212
|
+
window.removeEventListener("scroll", measure, true);
|
|
2213
|
+
};
|
|
2214
|
+
}, [showHotspot, sizeUnit, density, hovered]);
|
|
2177
2215
|
(0, import_react8.useEffect)(() => {
|
|
2178
2216
|
setIndex(0);
|
|
2179
2217
|
}, [frames]);
|
|
@@ -2191,14 +2229,22 @@ function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, fo
|
|
|
2191
2229
|
return () => window.clearTimeout(timer);
|
|
2192
2230
|
}, [playing, reduced, frames, index, frame]);
|
|
2193
2231
|
function move(event) {
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2232
|
+
if (followPointer && event.pointerType !== "touch") {
|
|
2233
|
+
latestPointer.current = { x: event.clientX, y: event.clientY };
|
|
2234
|
+
if (!moveFrame.current) moveFrame.current = requestAnimationFrame(() => {
|
|
2235
|
+
moveFrame.current = 0;
|
|
2236
|
+
const root = rootRef.current;
|
|
2237
|
+
if (!root) return;
|
|
2238
|
+
const rect = root.getBoundingClientRect();
|
|
2239
|
+
setHovered(true);
|
|
2240
|
+
setPoint({ x: latestPointer.current.x - rect.left, y: latestPointer.current.y - rect.top, left: rect.left, top: rect.top });
|
|
2241
|
+
});
|
|
2242
|
+
} else if (event.pointerType !== "touch" && showHotspot) setHovered(true);
|
|
2197
2243
|
onPointerMove?.(event);
|
|
2198
2244
|
}
|
|
2199
2245
|
const following = !!point && followPointer && !!frame && !failed;
|
|
2200
2246
|
const offset = (value) => Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * safeSize;
|
|
2201
|
-
const origin =
|
|
2247
|
+
const origin = following ? point : bounds;
|
|
2202
2248
|
const snap = (value, base) => sizeUnit === "device" ? Math.round((value + base) * density) / density - base : value;
|
|
2203
2249
|
const bitmapX = snap(following ? point.x - offset(frame.hotspotX) : (bounds.width - safeSize) / 2, origin?.left ?? 0);
|
|
2204
2250
|
const bitmapY = snap(following ? point.y - offset(frame.hotspotY) : (bounds.height - safeSize) / 2, origin?.top ?? 0);
|
|
@@ -2221,6 +2267,7 @@ function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, fo
|
|
|
2221
2267
|
},
|
|
2222
2268
|
onPointerMove: move,
|
|
2223
2269
|
onPointerLeave: (event) => {
|
|
2270
|
+
cancelMove();
|
|
2224
2271
|
setHovered(false);
|
|
2225
2272
|
setPoint(null);
|
|
2226
2273
|
onPointerLeave?.(event);
|
|
@@ -2447,6 +2494,7 @@ function MenuEntry({
|
|
|
2447
2494
|
ref: anchorRef,
|
|
2448
2495
|
type: "button",
|
|
2449
2496
|
className: "sia-menu__item",
|
|
2497
|
+
"data-sia-interaction-cursor": props.interactionCursor,
|
|
2450
2498
|
style: { paddingInlineStart: props.mode === "inline" && !props.inlineCollapsed ? 12 + level * props.inlineIndent : void 0 },
|
|
2451
2499
|
...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
|
|
2452
2500
|
disabled: item.disabled,
|
|
@@ -2504,6 +2552,7 @@ function Menu({
|
|
|
2504
2552
|
items,
|
|
2505
2553
|
mode = "vertical",
|
|
2506
2554
|
gridColumns = 2,
|
|
2555
|
+
interactionCursor = "pointer",
|
|
2507
2556
|
theme = "light",
|
|
2508
2557
|
selectedKeys,
|
|
2509
2558
|
autoScrollSelected = false,
|
|
@@ -2578,7 +2627,7 @@ function Menu({
|
|
|
2578
2627
|
if (mode !== "inline") setOpen([]);
|
|
2579
2628
|
}
|
|
2580
2629
|
const gridStyle = mode === "grid" ? { "--sia-menu-grid-columns": gridColumns === "auto" ? "repeat(auto-fill, minmax(88px, 1fr))" : `repeat(${Number.isFinite(gridColumns) ? Math.max(1, Math.floor(Number(gridColumns))) : 2}, minmax(0, 1fr))` } : {};
|
|
2581
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), style: { ...gridStyle, ...style }, "data-sia-menu-owner": menuId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
|
|
2630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), style: { ...gridStyle, ...style }, "data-sia-menu-owner": menuId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuLevel, { items, level: 0, parents: [], props: { interactionCursor, menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
|
|
2582
2631
|
}
|
|
2583
2632
|
function Steps({ items, current = 0, initial: initial3 = 0, direction = "horizontal", type = "default", size = "default", status = "process", progressDot = false, onChange, className = "", ...props }) {
|
|
2584
2633
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `sia-steps sia-steps--${direction} sia-steps--${type} sia-steps--${size} ${className}`.trim(), ...withTitleTooltip(props), children: items.map((item, rawIndex) => {
|
|
@@ -3782,6 +3831,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
3782
3831
|
const entries = /* @__PURE__ */ new Map();
|
|
3783
3832
|
let scanFrame = 0;
|
|
3784
3833
|
let updateFrame = 0;
|
|
3834
|
+
const dirtyStyles = /* @__PURE__ */ new Set();
|
|
3835
|
+
let fullScan = true;
|
|
3785
3836
|
const setEntryVisible = (entry, visible) => {
|
|
3786
3837
|
entry.horizontalTrack.classList.toggle("sia-floating-scrollbar--visible", visible);
|
|
3787
3838
|
entry.verticalTrack.classList.toggle("sia-floating-scrollbar--visible", visible);
|
|
@@ -3981,13 +4032,17 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
3981
4032
|
const scanTargets = () => {
|
|
3982
4033
|
scanFrame = 0;
|
|
3983
4034
|
const managedSelector = ".sia-table__viewport, [data-sia-native-scrollbar], .sia-scrollbar-track, .sia-floating-scrollbar-layer";
|
|
3984
|
-
const discovered =
|
|
4035
|
+
const discovered = /* @__PURE__ */ new Set();
|
|
3985
4036
|
if (!targetRef) {
|
|
3986
|
-
const
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
4037
|
+
const roots = fullScan ? [document.body] : [...dirtyStyles].filter((node) => node.isConnected);
|
|
4038
|
+
for (const root of roots) {
|
|
4039
|
+
const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
|
|
4040
|
+
acceptNode: (node) => node.matches(managedSelector) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
|
|
4041
|
+
});
|
|
4042
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
4043
|
+
if (node instanceof HTMLElement) discovered.add(node);
|
|
4044
|
+
}
|
|
4045
|
+
for (let node = root; node; node = node.parentElement) discovered.add(node);
|
|
3991
4046
|
}
|
|
3992
4047
|
}
|
|
3993
4048
|
const candidates = (targetRef ? [targetRef.current] : [document.scrollingElement, ...discovered]).filter((target) => target instanceof HTMLElement);
|
|
@@ -3999,28 +4054,48 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
3999
4054
|
}
|
|
4000
4055
|
});
|
|
4001
4056
|
entries.forEach((_entry, target) => {
|
|
4002
|
-
if (!target.isConnected || !nextTargets.has(target)) removeTarget(target);
|
|
4057
|
+
if (!target.isConnected || (fullScan || candidates.includes(target)) && !nextTargets.has(target)) removeTarget(target);
|
|
4003
4058
|
else updateEntry(_entry);
|
|
4004
4059
|
});
|
|
4060
|
+
dirtyStyles.clear();
|
|
4061
|
+
fullScan = false;
|
|
4005
4062
|
};
|
|
4006
|
-
const scheduleScan = () => {
|
|
4063
|
+
const scheduleScan = (complete = true) => {
|
|
4064
|
+
fullScan ||= complete;
|
|
4007
4065
|
if (scanFrame) return;
|
|
4008
4066
|
scanFrame = window.requestAnimationFrame(scanTargets);
|
|
4009
4067
|
};
|
|
4068
|
+
const previousStyle = document.createElement("div").style;
|
|
4069
|
+
const positionProperties = /* @__PURE__ */ new Set(["left", "top", "transform"]);
|
|
4010
4070
|
const mutationObserver = new MutationObserver((mutations) => {
|
|
4011
|
-
|
|
4071
|
+
let relevant = false;
|
|
4072
|
+
for (const mutation of mutations) {
|
|
4012
4073
|
const target = mutation.target instanceof Element ? mutation.target : mutation.target.parentElement;
|
|
4013
|
-
|
|
4014
|
-
|
|
4074
|
+
if (!target || layer.contains(target) || target.closest(".sia-table__viewport, [data-sia-native-scrollbar], .sia-scrollbar-track")) continue;
|
|
4075
|
+
relevant = true;
|
|
4076
|
+
let positionOnly = false;
|
|
4077
|
+
if (mutation.type === "attributes" && mutation.attributeName === "style" && target instanceof HTMLElement) {
|
|
4078
|
+
previousStyle.cssText = mutation.oldValue ?? "";
|
|
4079
|
+
const keys = /* @__PURE__ */ new Set([...Array.from(previousStyle), ...Array.from(target.style)]);
|
|
4080
|
+
const changed = [...keys].filter((key) => previousStyle.getPropertyValue(key) !== target.style.getPropertyValue(key) || previousStyle.getPropertyPriority(key) !== target.style.getPropertyPriority(key));
|
|
4081
|
+
if (!changed.length) continue;
|
|
4082
|
+
const fixedSize = target.style.width.endsWith("px") && target.style.height.endsWith("px");
|
|
4083
|
+
positionOnly = fixedSize && changed.every((key) => positionProperties.has(key)) && ["absolute", "fixed"].includes(getComputedStyle(target).position);
|
|
4084
|
+
}
|
|
4085
|
+
if (positionOnly && target instanceof HTMLElement) dirtyStyles.add(target);
|
|
4086
|
+
else fullScan = true;
|
|
4087
|
+
}
|
|
4088
|
+
if (relevant) scheduleScan(false);
|
|
4015
4089
|
});
|
|
4016
|
-
mutationObserver.observe(document.documentElement, { subtree: true, childList: true, attributes: true, attributeFilter: ["class", "style", "hidden"] });
|
|
4017
|
-
|
|
4090
|
+
mutationObserver.observe(document.documentElement, { subtree: true, childList: true, attributes: true, attributeOldValue: true, attributeFilter: ["class", "style", "hidden"] });
|
|
4091
|
+
const onResize = () => scheduleScan();
|
|
4092
|
+
window.addEventListener("resize", onResize);
|
|
4018
4093
|
window.addEventListener("scroll", scheduleUpdateAll, true);
|
|
4019
4094
|
scheduleScan();
|
|
4020
4095
|
return () => {
|
|
4021
4096
|
mutationObserver.disconnect();
|
|
4022
4097
|
resizeObserver.disconnect();
|
|
4023
|
-
window.removeEventListener("resize",
|
|
4098
|
+
window.removeEventListener("resize", onResize);
|
|
4024
4099
|
window.removeEventListener("scroll", scheduleUpdateAll, true);
|
|
4025
4100
|
if (scanFrame) window.cancelAnimationFrame(scanFrame);
|
|
4026
4101
|
if (updateFrame) window.cancelAnimationFrame(updateFrame);
|
|
@@ -4187,11 +4262,12 @@ function Floating({
|
|
|
4187
4262
|
if (anchor2) {
|
|
4188
4263
|
const rect = anchor2.getBoundingClientRect();
|
|
4189
4264
|
const next = resolveFloatingPosition(rect, overlayRef.current.getBoundingClientRect(), placement, typeof arrow === "object" && !!arrow.pointAtCenter, autoAdjustOverflow);
|
|
4190
|
-
next.hidden = isFloatingAnchorHidden(anchor2, rect);
|
|
4265
|
+
next.hidden = isFloatingAnchorHidden(anchor2, rect) || isAnchorBehindOverlay(anchor2);
|
|
4191
4266
|
setPosition(next);
|
|
4192
4267
|
}
|
|
4193
4268
|
};
|
|
4194
4269
|
update();
|
|
4270
|
+
const unsubscribeLayers = subscribeOverlayLayers(update);
|
|
4195
4271
|
window.addEventListener("resize", update);
|
|
4196
4272
|
window.addEventListener("scroll", update, true);
|
|
4197
4273
|
window.addEventListener("animationend", update, true);
|
|
@@ -4207,6 +4283,7 @@ function Floating({
|
|
|
4207
4283
|
window.removeEventListener("animationend", update, true);
|
|
4208
4284
|
window.removeEventListener("transitionend", update, true);
|
|
4209
4285
|
observer.disconnect();
|
|
4286
|
+
unsubscribeLayers();
|
|
4210
4287
|
};
|
|
4211
4288
|
}, [children, content, placement, visible, portalContainer, autoAdjustOverflow, typeof arrow === "object" && arrow.pointAtCenter]);
|
|
4212
4289
|
(0, import_react21.useEffect)(() => () => {
|
|
@@ -6030,6 +6107,7 @@ function Card({
|
|
|
6030
6107
|
description,
|
|
6031
6108
|
extra,
|
|
6032
6109
|
selectable = false,
|
|
6110
|
+
interactionCursor = "pointer",
|
|
6033
6111
|
selected,
|
|
6034
6112
|
showSelectedIndicator = true,
|
|
6035
6113
|
defaultSelected = false,
|
|
@@ -6082,6 +6160,7 @@ function Card({
|
|
|
6082
6160
|
{
|
|
6083
6161
|
className: `sia-card${fill ? " sia-card--fill" : ""}${fill && bodyHeight !== void 0 ? " sia-card--body-height" : ""}${!bordered ? " sia-card--borderless" : ""}${isCollapsed ? " sia-card--collapsed" : ""}${selectable ? " sia-card--selectable" : ""}${actionable ? " sia-card--actionable" : ""}${selectable && isSelected ? " sia-card--selected" : ""}${hoverActions ? " sia-card--hover-actions" : ""} ${className}`.trim(),
|
|
6084
6162
|
style: mergedStyle,
|
|
6163
|
+
"data-sia-interaction-cursor": interactionCursor,
|
|
6085
6164
|
role: selectable ? "checkbox" : actionable ? "button" : void 0,
|
|
6086
6165
|
"aria-checked": selectable ? isSelected : void 0,
|
|
6087
6166
|
"aria-disabled": selectable || actionable ? disabled : void 0,
|
package/dist/index.css
CHANGED
|
@@ -2614,6 +2614,10 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2614
2614
|
.sia-card--actionable {
|
|
2615
2615
|
cursor: pointer;
|
|
2616
2616
|
}
|
|
2617
|
+
.sia-card--selectable[data-sia-interaction-cursor=default],
|
|
2618
|
+
.sia-card--actionable[data-sia-interaction-cursor=default] {
|
|
2619
|
+
cursor: default;
|
|
2620
|
+
}
|
|
2617
2621
|
.sia-card--actionable[aria-disabled=true] {
|
|
2618
2622
|
cursor: default;
|
|
2619
2623
|
}
|
|
@@ -8223,6 +8227,9 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
8223
8227
|
.sia-menu__item:hover {
|
|
8224
8228
|
background: var(--sia-color-control-hover);
|
|
8225
8229
|
}
|
|
8230
|
+
.sia-menu__item[data-sia-interaction-cursor=default] {
|
|
8231
|
+
cursor: default;
|
|
8232
|
+
}
|
|
8226
8233
|
.sia-menu__entry.is-selected > .sia-menu__item {
|
|
8227
8234
|
color: var(--sia-color-primary-text);
|
|
8228
8235
|
background: var(--sia-color-primary-light);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
4
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-mmHC4SGJ.cjs';
|
|
4
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-mmHC4SGJ.cjs';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
|
|
6
6
|
import { B as ButtonProps, a as ButtonSize } from './Button-O_pNB3SQ.cjs';
|
|
7
7
|
export { b as Button, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
|
|
@@ -35,7 +35,7 @@ interface CursorPreviewProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
35
35
|
sizeUnit?: 'css' | 'device';
|
|
36
36
|
/** 是否循环播放;false 显示第一帧。系统偏好减少动态效果时也显示第一帧。@defaultValue true */
|
|
37
37
|
playing?: boolean;
|
|
38
|
-
/**
|
|
38
|
+
/** 移入区域后隐藏原生指针,按显示帧跟随最新鼠标热点;移出后回到中央。图片加载失败时保留原生指针;onPointerMove 仍逐事件调用。@defaultValue true */
|
|
39
39
|
followPointer?: boolean;
|
|
40
40
|
/** 鼠标未移入且图片有效时,用折线和“指针点”标出当前帧真实热点;移入后立即隐藏,移出恢复。不依赖 followPointer,业务可仅在正常选择角色启用。@defaultValue false */
|
|
41
41
|
showHotspot?: boolean;
|
|
@@ -3001,7 +3001,7 @@ interface FloatingScrollbarProviderProps {
|
|
|
3001
3001
|
/** 仅接管指定容器;不传时接管页面中的滚动容器。 */
|
|
3002
3002
|
targetRef?: RefObject<HTMLElement | null>;
|
|
3003
3003
|
}
|
|
3004
|
-
/**
|
|
3004
|
+
/** 为页面或指定容器接入浮动滚动条;布局变化重新发现滚动容器,定尺寸脱离文档流元素的定位变化仅复核相关子树与祖先。 */
|
|
3005
3005
|
declare function FloatingScrollbarProvider({ disabled, targetRef }: FloatingScrollbarProviderProps): null;
|
|
3006
3006
|
|
|
3007
3007
|
/** SiaTheme的模式类型。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
4
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-PlVXb05e.js';
|
|
4
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-PlVXb05e.js';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.js';
|
|
6
6
|
import { B as ButtonProps, a as ButtonSize } from './Button-BiL3Wjsd.js';
|
|
7
7
|
export { b as Button, c as ButtonVariant } from './Button-BiL3Wjsd.js';
|
|
@@ -35,7 +35,7 @@ interface CursorPreviewProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
35
35
|
sizeUnit?: 'css' | 'device';
|
|
36
36
|
/** 是否循环播放;false 显示第一帧。系统偏好减少动态效果时也显示第一帧。@defaultValue true */
|
|
37
37
|
playing?: boolean;
|
|
38
|
-
/**
|
|
38
|
+
/** 移入区域后隐藏原生指针,按显示帧跟随最新鼠标热点;移出后回到中央。图片加载失败时保留原生指针;onPointerMove 仍逐事件调用。@defaultValue true */
|
|
39
39
|
followPointer?: boolean;
|
|
40
40
|
/** 鼠标未移入且图片有效时,用折线和“指针点”标出当前帧真实热点;移入后立即隐藏,移出恢复。不依赖 followPointer,业务可仅在正常选择角色启用。@defaultValue false */
|
|
41
41
|
showHotspot?: boolean;
|
|
@@ -3001,7 +3001,7 @@ interface FloatingScrollbarProviderProps {
|
|
|
3001
3001
|
/** 仅接管指定容器;不传时接管页面中的滚动容器。 */
|
|
3002
3002
|
targetRef?: RefObject<HTMLElement | null>;
|
|
3003
3003
|
}
|
|
3004
|
-
/**
|
|
3004
|
+
/** 为页面或指定容器接入浮动滚动条;布局变化重新发现滚动容器,定尺寸脱离文档流元素的定位变化仅复核相关子树与祖先。 */
|
|
3005
3005
|
declare function FloatingScrollbarProvider({ disabled, targetRef }: FloatingScrollbarProviderProps): null;
|
|
3006
3006
|
|
|
3007
3007
|
/** SiaTheme的模式类型。 */
|
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
Watermark,
|
|
82
82
|
message,
|
|
83
83
|
notification
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-BEVCKS5J.js";
|
|
85
85
|
import "./chunk-RX242MUO.js";
|
|
86
86
|
import {
|
|
87
87
|
MarkdownEditor
|
|
@@ -89,12 +89,12 @@ import {
|
|
|
89
89
|
import {
|
|
90
90
|
RichTextContent,
|
|
91
91
|
RichTextEditor
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-QBBIBJXW.js";
|
|
93
93
|
import {
|
|
94
94
|
DatePicker,
|
|
95
95
|
SelectDateRange,
|
|
96
96
|
TimePanel
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-AOWWHL5Z.js";
|
|
98
98
|
import {
|
|
99
99
|
Checkbox,
|
|
100
100
|
FloatingScrollbarProvider,
|
|
@@ -106,14 +106,14 @@ import {
|
|
|
106
106
|
Tooltip,
|
|
107
107
|
Tree,
|
|
108
108
|
useScrollbarProximity
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-BQIARYZB.js";
|
|
110
110
|
import {
|
|
111
111
|
Dropdown,
|
|
112
112
|
Input,
|
|
113
113
|
Menu,
|
|
114
114
|
Segmented,
|
|
115
115
|
Steps
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-GKFFFHHU.js";
|
|
117
117
|
import {
|
|
118
118
|
TextArea
|
|
119
119
|
} from "./chunk-SCEHVGKV.js";
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
Modal,
|
|
125
125
|
OverlayPortal,
|
|
126
126
|
useOverlayLifecycle
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-6MGFX7B2.js";
|
|
128
128
|
import {
|
|
129
129
|
Button
|
|
130
130
|
} from "./chunk-CZ2ITBRW.js";
|
|
@@ -146,10 +146,20 @@ import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
|
146
146
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
147
147
|
function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, followPointer = true, showHotspot = false, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerEnter, onPointerMove, onPointerLeave, ...props }) {
|
|
148
148
|
const rootRef = useRef(null);
|
|
149
|
-
const [bounds, setBounds] = useState({ width: 0, height: 0 });
|
|
149
|
+
const [bounds, setBounds] = useState({ width: 0, height: 0, left: 0, top: 0 });
|
|
150
150
|
const [hovered, setHovered] = useState(false);
|
|
151
151
|
const [index, setIndex] = useState(0);
|
|
152
152
|
const [point, setPoint] = useState(null);
|
|
153
|
+
const moveFrame = useRef(0);
|
|
154
|
+
const latestPointer = useRef({ x: 0, y: 0 });
|
|
155
|
+
const cancelMove = () => {
|
|
156
|
+
if (moveFrame.current) cancelAnimationFrame(moveFrame.current);
|
|
157
|
+
moveFrame.current = 0;
|
|
158
|
+
};
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
if (!followPointer) setPoint(null);
|
|
161
|
+
return cancelMove;
|
|
162
|
+
}, [followPointer]);
|
|
153
163
|
const [reduced, setReduced] = useState(false);
|
|
154
164
|
const [failed, setFailed] = useState(false);
|
|
155
165
|
const [density, setDensity] = useState(() => typeof window === "undefined" ? 1 : window.devicePixelRatio || 1);
|
|
@@ -176,12 +186,20 @@ function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, fo
|
|
|
176
186
|
useLayoutEffect(() => {
|
|
177
187
|
const root = rootRef.current;
|
|
178
188
|
if (!showHotspot && sizeUnit !== "device" || !root) return;
|
|
179
|
-
const measure = () =>
|
|
189
|
+
const measure = () => {
|
|
190
|
+
const rect = root.getBoundingClientRect();
|
|
191
|
+
const next = { width: root.clientWidth, height: root.clientHeight, left: rect.left, top: rect.top };
|
|
192
|
+
setBounds((previous) => Object.keys(next).every((key) => previous[key] === next[key]) ? previous : next);
|
|
193
|
+
};
|
|
180
194
|
measure();
|
|
181
195
|
const observer = new ResizeObserver(measure);
|
|
182
196
|
observer.observe(root);
|
|
183
|
-
|
|
184
|
-
|
|
197
|
+
window.addEventListener("scroll", measure, true);
|
|
198
|
+
return () => {
|
|
199
|
+
observer.disconnect();
|
|
200
|
+
window.removeEventListener("scroll", measure, true);
|
|
201
|
+
};
|
|
202
|
+
}, [showHotspot, sizeUnit, density, hovered]);
|
|
185
203
|
useEffect(() => {
|
|
186
204
|
setIndex(0);
|
|
187
205
|
}, [frames]);
|
|
@@ -199,14 +217,22 @@ function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, fo
|
|
|
199
217
|
return () => window.clearTimeout(timer);
|
|
200
218
|
}, [playing, reduced, frames, index, frame]);
|
|
201
219
|
function move(event) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
220
|
+
if (followPointer && event.pointerType !== "touch") {
|
|
221
|
+
latestPointer.current = { x: event.clientX, y: event.clientY };
|
|
222
|
+
if (!moveFrame.current) moveFrame.current = requestAnimationFrame(() => {
|
|
223
|
+
moveFrame.current = 0;
|
|
224
|
+
const root = rootRef.current;
|
|
225
|
+
if (!root) return;
|
|
226
|
+
const rect = root.getBoundingClientRect();
|
|
227
|
+
setHovered(true);
|
|
228
|
+
setPoint({ x: latestPointer.current.x - rect.left, y: latestPointer.current.y - rect.top, left: rect.left, top: rect.top });
|
|
229
|
+
});
|
|
230
|
+
} else if (event.pointerType !== "touch" && showHotspot) setHovered(true);
|
|
205
231
|
onPointerMove?.(event);
|
|
206
232
|
}
|
|
207
233
|
const following = !!point && followPointer && !!frame && !failed;
|
|
208
234
|
const offset = (value) => Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * safeSize;
|
|
209
|
-
const origin =
|
|
235
|
+
const origin = following ? point : bounds;
|
|
210
236
|
const snap = (value, base) => sizeUnit === "device" ? Math.round((value + base) * density) / density - base : value;
|
|
211
237
|
const bitmapX = snap(following ? point.x - offset(frame.hotspotX) : (bounds.width - safeSize) / 2, origin?.left ?? 0);
|
|
212
238
|
const bitmapY = snap(following ? point.y - offset(frame.hotspotY) : (bounds.height - safeSize) / 2, origin?.top ?? 0);
|
|
@@ -229,6 +255,7 @@ function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, fo
|
|
|
229
255
|
},
|
|
230
256
|
onPointerMove: move,
|
|
231
257
|
onPointerLeave: (event) => {
|
|
258
|
+
cancelMove();
|
|
232
259
|
setHovered(false);
|
|
233
260
|
setPoint(null);
|
|
234
261
|
onPointerLeave?.(event);
|
|
@@ -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";
|
|
@@ -1671,6 +1672,7 @@ function MenuEntry({
|
|
|
1671
1672
|
ref: anchorRef,
|
|
1672
1673
|
type: "button",
|
|
1673
1674
|
className: "sia-menu__item",
|
|
1675
|
+
"data-sia-interaction-cursor": props.interactionCursor,
|
|
1674
1676
|
style: { paddingInlineStart: props.mode === "inline" && !props.inlineCollapsed ? 12 + level * props.inlineIndent : void 0 },
|
|
1675
1677
|
...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
|
|
1676
1678
|
disabled: item.disabled,
|
|
@@ -1728,6 +1730,7 @@ function Menu({
|
|
|
1728
1730
|
items,
|
|
1729
1731
|
mode = "vertical",
|
|
1730
1732
|
gridColumns = 2,
|
|
1733
|
+
interactionCursor = "pointer",
|
|
1731
1734
|
theme = "light",
|
|
1732
1735
|
selectedKeys,
|
|
1733
1736
|
autoScrollSelected = false,
|
|
@@ -1802,7 +1805,7 @@ function Menu({
|
|
|
1802
1805
|
if (mode !== "inline") setOpen([]);
|
|
1803
1806
|
}
|
|
1804
1807
|
const gridStyle = mode === "grid" ? { "--sia-menu-grid-columns": gridColumns === "auto" ? "repeat(auto-fill, minmax(88px, 1fr))" : `repeat(${Number.isFinite(gridColumns) ? Math.max(1, Math.floor(Number(gridColumns))) : 2}, minmax(0, 1fr))` } : {};
|
|
1805
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), style: { ...gridStyle, ...style }, "data-sia-menu-owner": menuId, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
|
|
1808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), style: { ...gridStyle, ...style }, "data-sia-menu-owner": menuId, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuLevel, { items, level: 0, parents: [], props: { interactionCursor, menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
|
|
1806
1809
|
}
|
|
1807
1810
|
|
|
1808
1811
|
// src/components/Dropdown.tsx
|
|
@@ -2096,6 +2099,8 @@ var import_react_dom2 = require("react-dom");
|
|
|
2096
2099
|
var bodyLockCount = 0;
|
|
2097
2100
|
var previousBodyOverflow = "";
|
|
2098
2101
|
var overlayStack = [];
|
|
2102
|
+
var overlayPanels = /* @__PURE__ */ new Map();
|
|
2103
|
+
var overlayListeners = /* @__PURE__ */ new Set();
|
|
2099
2104
|
function lockBodyScroll() {
|
|
2100
2105
|
if (bodyLockCount === 0) {
|
|
2101
2106
|
previousBodyOverflow = document.body.style.overflow;
|
|
@@ -2121,6 +2126,8 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
2121
2126
|
const overlayId = overlayIdRef.current;
|
|
2122
2127
|
const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
2123
2128
|
overlayStack.push(overlayId);
|
|
2129
|
+
overlayPanels.set(overlayId, panelRef);
|
|
2130
|
+
overlayListeners.forEach((listener) => listener());
|
|
2124
2131
|
const unlockBody = lockBodyScroll();
|
|
2125
2132
|
const focusTimer = window.setTimeout(() => {
|
|
2126
2133
|
const panel = panelRef.current;
|
|
@@ -2158,6 +2165,8 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
2158
2165
|
document.removeEventListener("keydown", handleKeyDown);
|
|
2159
2166
|
const index = overlayStack.lastIndexOf(overlayId);
|
|
2160
2167
|
if (index >= 0) overlayStack.splice(index, 1);
|
|
2168
|
+
overlayPanels.delete(overlayId);
|
|
2169
|
+
overlayListeners.forEach((listener) => listener());
|
|
2161
2170
|
unlockBody();
|
|
2162
2171
|
previouslyFocused?.focus({ preventScroll: true });
|
|
2163
2172
|
};
|
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-QBBIBJXW.js";
|
|
5
|
+
import "./chunk-GKFFFHHU.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-6MGFX7B2.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|
|
9
9
|
import "./chunk-KY6A5IJH.js";
|
|
10
10
|
import "./chunk-NZMUW5XI.js";
|