@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/core.cjs CHANGED
@@ -1535,9 +1535,10 @@ var filledIconPaths = {
1535
1535
  var FILLED_ICON_NAMES = Object.freeze(Object.keys(filledIconPaths));
1536
1536
  var normalizedOutlinePaths = normalizeIconPaths(iconPaths, outlineIconBounds);
1537
1537
  var normalizedFilledPaths = normalizeIconPaths(filledIconPaths, filledIconBounds);
1538
- 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) {
1538
+ 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) {
1539
1539
  const resolvedSize = typeof size === "number" ? `${size}px` : size;
1540
- const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, ...style };
1540
+ const toneColor = tone === "inherit" ? void 0 : `var(--sia-color-${tone === "danger" ? "error" : tone === "primary" ? "primary-text" : tone})`;
1541
+ const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, color: toneColor, ...style };
1541
1542
  const animationClass = spin ? " sia-icon--spin" : pulse ? " sia-icon--pulse" : "";
1542
1543
  const filledPath = filledIconPaths[name];
1543
1544
  const resolvedVariant = variant === "filled" && filledPath ? "filled" : "outline";
@@ -1654,6 +1655,7 @@ function MenuEntry({
1654
1655
  ref: anchorRef,
1655
1656
  type: "button",
1656
1657
  className: "sia-menu__item",
1658
+ "data-sia-interaction-cursor": props.interactionCursor,
1657
1659
  style: { paddingInlineStart: props.mode === "inline" && !props.inlineCollapsed ? 12 + level * props.inlineIndent : void 0 },
1658
1660
  ...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
1659
1661
  disabled: item.disabled,
@@ -1711,6 +1713,7 @@ function Menu({
1711
1713
  items,
1712
1714
  mode = "vertical",
1713
1715
  gridColumns = 2,
1716
+ interactionCursor = "pointer",
1714
1717
  theme = "light",
1715
1718
  selectedKeys,
1716
1719
  autoScrollSelected = false,
@@ -1785,7 +1788,7 @@ function Menu({
1785
1788
  if (mode !== "inline") setOpen([]);
1786
1789
  }
1787
1790
  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))` } : {};
1788
- return /* @__PURE__ */ (0, import_jsx_runtime7.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_runtime7.jsx)(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
1791
+ return /* @__PURE__ */ (0, import_jsx_runtime7.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_runtime7.jsx)(MenuLevel, { items, level: 0, parents: [], props: { interactionCursor, menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
1789
1792
  }
1790
1793
  function Segmented({ options, value, defaultValue, variant = "default", shape = "capsule", size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
1791
1794
  const size = useControlSize(sizeProp);
@@ -2158,6 +2161,7 @@ function Card({
2158
2161
  description,
2159
2162
  extra,
2160
2163
  selectable = false,
2164
+ interactionCursor = "pointer",
2161
2165
  selected,
2162
2166
  showSelectedIndicator = true,
2163
2167
  defaultSelected = false,
@@ -2210,6 +2214,7 @@ function Card({
2210
2214
  {
2211
2215
  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(),
2212
2216
  style: mergedStyle,
2217
+ "data-sia-interaction-cursor": interactionCursor,
2213
2218
  role: selectable ? "checkbox" : actionable ? "button" : void 0,
2214
2219
  "aria-checked": selectable ? isSelected : void 0,
2215
2220
  "aria-disabled": selectable || actionable ? disabled : void 0,
@@ -2571,13 +2576,13 @@ function Tabs({
2571
2576
  }
2572
2577
 
2573
2578
  // src/components/Feedback.tsx
2574
- var import_react17 = require("react");
2575
- var import_react_dom3 = require("react-dom");
2579
+ var import_react18 = require("react");
2580
+ var import_react_dom4 = require("react-dom");
2576
2581
  var import_client2 = require("react-dom/client");
2577
2582
 
2578
2583
  // src/components/FloatingDisplay.tsx
2579
- var import_react16 = require("react");
2580
- var import_react_dom2 = require("react-dom");
2584
+ var import_react17 = require("react");
2585
+ var import_react_dom3 = require("react-dom");
2581
2586
 
2582
2587
  // src/components/Checkbox.tsx
2583
2588
  var import_react13 = require("react");
@@ -2803,6 +2808,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
2803
2808
  const entries = /* @__PURE__ */ new Map();
2804
2809
  let scanFrame = 0;
2805
2810
  let updateFrame = 0;
2811
+ const dirtyStyles = /* @__PURE__ */ new Set();
2812
+ let fullScan = true;
2806
2813
  const setEntryVisible = (entry, visible) => {
2807
2814
  entry.horizontalTrack.classList.toggle("sia-floating-scrollbar--visible", visible);
2808
2815
  entry.verticalTrack.classList.toggle("sia-floating-scrollbar--visible", visible);
@@ -3002,13 +3009,17 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
3002
3009
  const scanTargets = () => {
3003
3010
  scanFrame = 0;
3004
3011
  const managedSelector = ".sia-table__viewport, [data-sia-native-scrollbar], .sia-scrollbar-track, .sia-floating-scrollbar-layer";
3005
- const discovered = [];
3012
+ const discovered = /* @__PURE__ */ new Set();
3006
3013
  if (!targetRef) {
3007
- const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, {
3008
- acceptNode: (node) => node.matches(managedSelector) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
3009
- });
3010
- for (let node = walker.nextNode(); node; node = walker.nextNode()) {
3011
- if (node instanceof HTMLElement) discovered.push(node);
3014
+ const roots = fullScan ? [document.body] : [...dirtyStyles].filter((node) => node.isConnected);
3015
+ for (const root of roots) {
3016
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
3017
+ acceptNode: (node) => node.matches(managedSelector) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
3018
+ });
3019
+ for (let node = walker.nextNode(); node; node = walker.nextNode()) {
3020
+ if (node instanceof HTMLElement) discovered.add(node);
3021
+ }
3022
+ for (let node = root; node; node = node.parentElement) discovered.add(node);
3012
3023
  }
3013
3024
  }
3014
3025
  const candidates = (targetRef ? [targetRef.current] : [document.scrollingElement, ...discovered]).filter((target) => target instanceof HTMLElement);
@@ -3020,28 +3031,48 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
3020
3031
  }
3021
3032
  });
3022
3033
  entries.forEach((_entry, target) => {
3023
- if (!target.isConnected || !nextTargets.has(target)) removeTarget(target);
3034
+ if (!target.isConnected || (fullScan || candidates.includes(target)) && !nextTargets.has(target)) removeTarget(target);
3024
3035
  else updateEntry(_entry);
3025
3036
  });
3037
+ dirtyStyles.clear();
3038
+ fullScan = false;
3026
3039
  };
3027
- const scheduleScan = () => {
3040
+ const scheduleScan = (complete = true) => {
3041
+ fullScan ||= complete;
3028
3042
  if (scanFrame) return;
3029
3043
  scanFrame = window.requestAnimationFrame(scanTargets);
3030
3044
  };
3045
+ const previousStyle = document.createElement("div").style;
3046
+ const positionProperties = /* @__PURE__ */ new Set(["left", "top", "transform"]);
3031
3047
  const mutationObserver = new MutationObserver((mutations) => {
3032
- if (mutations.some((mutation) => {
3048
+ let relevant = false;
3049
+ for (const mutation of mutations) {
3033
3050
  const target = mutation.target instanceof Element ? mutation.target : mutation.target.parentElement;
3034
- return target && !layer.contains(target) && !target.closest(".sia-table__viewport, [data-sia-native-scrollbar], .sia-scrollbar-track");
3035
- })) scheduleScan();
3051
+ if (!target || layer.contains(target) || target.closest(".sia-table__viewport, [data-sia-native-scrollbar], .sia-scrollbar-track")) continue;
3052
+ relevant = true;
3053
+ let positionOnly = false;
3054
+ if (mutation.type === "attributes" && mutation.attributeName === "style" && target instanceof HTMLElement) {
3055
+ previousStyle.cssText = mutation.oldValue ?? "";
3056
+ const keys = /* @__PURE__ */ new Set([...Array.from(previousStyle), ...Array.from(target.style)]);
3057
+ const changed = [...keys].filter((key) => previousStyle.getPropertyValue(key) !== target.style.getPropertyValue(key) || previousStyle.getPropertyPriority(key) !== target.style.getPropertyPriority(key));
3058
+ if (!changed.length) continue;
3059
+ const fixedSize = target.style.width.endsWith("px") && target.style.height.endsWith("px");
3060
+ positionOnly = fixedSize && changed.every((key) => positionProperties.has(key)) && ["absolute", "fixed"].includes(getComputedStyle(target).position);
3061
+ }
3062
+ if (positionOnly && target instanceof HTMLElement) dirtyStyles.add(target);
3063
+ else fullScan = true;
3064
+ }
3065
+ if (relevant) scheduleScan(false);
3036
3066
  });
3037
- mutationObserver.observe(document.documentElement, { subtree: true, childList: true, attributes: true, attributeFilter: ["class", "style", "hidden"] });
3038
- window.addEventListener("resize", scheduleScan);
3067
+ mutationObserver.observe(document.documentElement, { subtree: true, childList: true, attributes: true, attributeOldValue: true, attributeFilter: ["class", "style", "hidden"] });
3068
+ const onResize = () => scheduleScan();
3069
+ window.addEventListener("resize", onResize);
3039
3070
  window.addEventListener("scroll", scheduleUpdateAll, true);
3040
3071
  scheduleScan();
3041
3072
  return () => {
3042
3073
  mutationObserver.disconnect();
3043
3074
  resizeObserver.disconnect();
3044
- window.removeEventListener("resize", scheduleScan);
3075
+ window.removeEventListener("resize", onResize);
3045
3076
  window.removeEventListener("scroll", scheduleUpdateAll, true);
3046
3077
  if (scanFrame) window.cancelAnimationFrame(scanFrame);
3047
3078
  if (updateFrame) window.cancelAnimationFrame(updateFrame);
@@ -3053,6 +3084,104 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
3053
3084
  return null;
3054
3085
  }
3055
3086
 
3087
+ // src/components/Overlay.tsx
3088
+ var import_react16 = require("react");
3089
+ var import_react_dom2 = require("react-dom");
3090
+ var bodyLockCount = 0;
3091
+ var previousBodyOverflow = "";
3092
+ var overlayStack = [];
3093
+ var overlayPanels = /* @__PURE__ */ new Map();
3094
+ var overlayListeners = /* @__PURE__ */ new Set();
3095
+ function subscribeOverlayLayers(listener) {
3096
+ overlayListeners.add(listener);
3097
+ return () => {
3098
+ overlayListeners.delete(listener);
3099
+ };
3100
+ }
3101
+ function isAnchorBehindOverlay(anchor) {
3102
+ const top = overlayStack.at(-1);
3103
+ const panel = top ? overlayPanels.get(top)?.current : void 0;
3104
+ if (!panel) return false;
3105
+ const root = panel.closest(".sia-modal-root, .sia-drawer-root");
3106
+ return root ? anchor.closest(".sia-modal-root, .sia-drawer-root") !== root : !panel.contains(anchor);
3107
+ }
3108
+ function lockBodyScroll() {
3109
+ if (bodyLockCount === 0) {
3110
+ previousBodyOverflow = document.body.style.overflow;
3111
+ document.body.style.overflow = "hidden";
3112
+ }
3113
+ bodyLockCount += 1;
3114
+ return () => {
3115
+ bodyLockCount = Math.max(0, bodyLockCount - 1);
3116
+ if (bodyLockCount === 0) document.body.style.overflow = previousBodyOverflow;
3117
+ };
3118
+ }
3119
+ function focusableElements(container) {
3120
+ return [...container.querySelectorAll(
3121
+ 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
3122
+ )].filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
3123
+ }
3124
+ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
3125
+ const overlayIdRef = (0, import_react16.useRef)(/* @__PURE__ */ Symbol("sia-overlay"));
3126
+ const closeRef = (0, import_react16.useRef)(onRequestClose);
3127
+ closeRef.current = onRequestClose;
3128
+ (0, import_react16.useEffect)(() => {
3129
+ if (!open || typeof document === "undefined") return void 0;
3130
+ const overlayId = overlayIdRef.current;
3131
+ const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
3132
+ overlayStack.push(overlayId);
3133
+ overlayPanels.set(overlayId, panelRef);
3134
+ overlayListeners.forEach((listener) => listener());
3135
+ const unlockBody = lockBodyScroll();
3136
+ const focusTimer = window.setTimeout(() => {
3137
+ const panel = panelRef.current;
3138
+ if (!panel) return;
3139
+ const [firstFocusable] = focusableElements(panel);
3140
+ (firstFocusable ?? panel).focus({ preventScroll: true });
3141
+ }, 0);
3142
+ function handleKeyDown(event) {
3143
+ if (overlayStack.at(-1) !== overlayId) return;
3144
+ if (event.key === "Escape" && keyboard) {
3145
+ event.preventDefault();
3146
+ closeRef.current();
3147
+ return;
3148
+ }
3149
+ if (event.key !== "Tab" || !panelRef.current) return;
3150
+ const focusable = focusableElements(panelRef.current);
3151
+ if (focusable.length === 0) {
3152
+ event.preventDefault();
3153
+ panelRef.current.focus();
3154
+ return;
3155
+ }
3156
+ const first = focusable[0];
3157
+ const last = focusable.at(-1);
3158
+ if (event.shiftKey && document.activeElement === first) {
3159
+ event.preventDefault();
3160
+ last.focus();
3161
+ } else if (!event.shiftKey && document.activeElement === last) {
3162
+ event.preventDefault();
3163
+ first.focus();
3164
+ }
3165
+ }
3166
+ document.addEventListener("keydown", handleKeyDown);
3167
+ return () => {
3168
+ window.clearTimeout(focusTimer);
3169
+ document.removeEventListener("keydown", handleKeyDown);
3170
+ const index = overlayStack.lastIndexOf(overlayId);
3171
+ if (index >= 0) overlayStack.splice(index, 1);
3172
+ overlayPanels.delete(overlayId);
3173
+ overlayListeners.forEach((listener) => listener());
3174
+ unlockBody();
3175
+ previouslyFocused?.focus({ preventScroll: true });
3176
+ };
3177
+ }, [keyboard, open, panelRef]);
3178
+ }
3179
+ function OverlayPortal({ children, container }) {
3180
+ if (typeof document === "undefined") return null;
3181
+ const target = typeof container === "function" ? container() : container ?? document.body;
3182
+ return (0, import_react_dom2.createPortal)(children, target);
3183
+ }
3184
+
3056
3185
  // src/components/FloatingDisplay.tsx
3057
3186
  var import_jsx_runtime14 = require("react/jsx-runtime");
3058
3187
  var FLOATING_GAP = 9;
@@ -3139,23 +3268,23 @@ function Floating({
3139
3268
  role = "tooltip",
3140
3269
  onOpenChange
3141
3270
  }) {
3142
- const rootRef = (0, import_react16.useRef)(null);
3143
- const triggerElementRef = (0, import_react16.useRef)(null);
3144
- const overlayRef = (0, import_react16.useRef)(null);
3145
- const enterTimer = (0, import_react16.useRef)();
3146
- const leaveTimer = (0, import_react16.useRef)();
3147
- const contentId = (0, import_react16.useId)();
3271
+ const rootRef = (0, import_react17.useRef)(null);
3272
+ const triggerElementRef = (0, import_react17.useRef)(null);
3273
+ const overlayRef = (0, import_react17.useRef)(null);
3274
+ const enterTimer = (0, import_react17.useRef)();
3275
+ const leaveTimer = (0, import_react17.useRef)();
3276
+ const contentId = (0, import_react17.useId)();
3148
3277
  const triggers = Array.isArray(trigger) ? trigger : [trigger];
3149
3278
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
3150
- const [position, setPosition] = (0, import_react16.useState)();
3151
- const [portalContainer, setPortalContainer] = (0, import_react16.useState)(null);
3152
- (0, import_react16.useLayoutEffect)(() => {
3279
+ const [position, setPosition] = (0, import_react17.useState)();
3280
+ const [portalContainer, setPortalContainer] = (0, import_react17.useState)(null);
3281
+ (0, import_react17.useLayoutEffect)(() => {
3153
3282
  if (!visible) return;
3154
3283
  setPortalContainer(rootRef.current?.closest(".sia-modal-root, .sia-drawer-root") ?? document.body);
3155
3284
  });
3156
- const setVisibleRef = (0, import_react16.useRef)(setVisible);
3285
+ const setVisibleRef = (0, import_react17.useRef)(setVisible);
3157
3286
  setVisibleRef.current = setVisible;
3158
- const closeSelfRef = (0, import_react16.useRef)();
3287
+ const closeSelfRef = (0, import_react17.useRef)();
3159
3288
  if (!closeSelfRef.current) closeSelfRef.current = () => setVisibleRef.current(false);
3160
3289
  const exclusiveTooltip = role === "tooltip" && triggers.includes("hover");
3161
3290
  function openNow() {
@@ -3183,7 +3312,7 @@ function Floating({
3183
3312
  if (delay <= 0) closeNow();
3184
3313
  else leaveTimer.current = window.setTimeout(closeNow, delay * 1e3);
3185
3314
  }
3186
- (0, import_react16.useEffect)(() => {
3315
+ (0, import_react17.useEffect)(() => {
3187
3316
  if (!visible || !triggers.includes("click")) return;
3188
3317
  const close = (event) => {
3189
3318
  const target = event.target;
@@ -3192,7 +3321,7 @@ function Floating({
3192
3321
  document.addEventListener("pointerdown", close);
3193
3322
  return () => document.removeEventListener("pointerdown", close);
3194
3323
  }, [triggers.join("|"), visible]);
3195
- (0, import_react16.useLayoutEffect)(() => {
3324
+ (0, import_react17.useLayoutEffect)(() => {
3196
3325
  if (!visible) {
3197
3326
  setPosition(void 0);
3198
3327
  return;
@@ -3208,11 +3337,12 @@ function Floating({
3208
3337
  if (anchor2) {
3209
3338
  const rect = anchor2.getBoundingClientRect();
3210
3339
  const next = resolveFloatingPosition(rect, overlayRef.current.getBoundingClientRect(), placement, typeof arrow === "object" && !!arrow.pointAtCenter, autoAdjustOverflow);
3211
- next.hidden = isFloatingAnchorHidden(anchor2, rect);
3340
+ next.hidden = isFloatingAnchorHidden(anchor2, rect) || isAnchorBehindOverlay(anchor2);
3212
3341
  setPosition(next);
3213
3342
  }
3214
3343
  };
3215
3344
  update();
3345
+ const unsubscribeLayers = subscribeOverlayLayers(update);
3216
3346
  window.addEventListener("resize", update);
3217
3347
  window.addEventListener("scroll", update, true);
3218
3348
  window.addEventListener("animationend", update, true);
@@ -3228,13 +3358,14 @@ function Floating({
3228
3358
  window.removeEventListener("animationend", update, true);
3229
3359
  window.removeEventListener("transitionend", update, true);
3230
3360
  observer.disconnect();
3361
+ unsubscribeLayers();
3231
3362
  };
3232
3363
  }, [children, content, placement, visible, portalContainer, autoAdjustOverflow, typeof arrow === "object" && arrow.pointAtCenter]);
3233
- (0, import_react16.useEffect)(() => () => {
3364
+ (0, import_react17.useEffect)(() => () => {
3234
3365
  clearTimers();
3235
3366
  if (activeTooltipClose === closeSelfRef.current) activeTooltipClose = void 0;
3236
3367
  }, []);
3237
- const child = (0, import_react16.cloneElement)(children, {
3368
+ const child = (0, import_react17.cloneElement)(children, {
3238
3369
  ...triggers.includes("hover") ? { onMouseEnter: (event) => {
3239
3370
  triggerElementRef.current = event.currentTarget;
3240
3371
  children.props.onMouseEnter?.(event);
@@ -3259,7 +3390,7 @@ function Floating({
3259
3390
  } } : {},
3260
3391
  "aria-describedby": visible ? contentId : void 0
3261
3392
  });
3262
- const overlay = visible && content !== null && content !== void 0 && typeof document !== "undefined" ? (0, import_react_dom2.createPortal)(
3393
+ const overlay = visible && content !== null && content !== void 0 && typeof document !== "undefined" ? (0, import_react_dom3.createPortal)(
3263
3394
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3264
3395
  "span",
3265
3396
  {
@@ -3344,87 +3475,6 @@ function Progress({
3344
3475
  // src/components/DataDisplay.tsx
3345
3476
  var import_react19 = require("react");
3346
3477
  var import_react_dom5 = require("react-dom");
3347
-
3348
- // src/components/Overlay.tsx
3349
- var import_react18 = require("react");
3350
- var import_react_dom4 = require("react-dom");
3351
- var bodyLockCount = 0;
3352
- var previousBodyOverflow = "";
3353
- var overlayStack = [];
3354
- function lockBodyScroll() {
3355
- if (bodyLockCount === 0) {
3356
- previousBodyOverflow = document.body.style.overflow;
3357
- document.body.style.overflow = "hidden";
3358
- }
3359
- bodyLockCount += 1;
3360
- return () => {
3361
- bodyLockCount = Math.max(0, bodyLockCount - 1);
3362
- if (bodyLockCount === 0) document.body.style.overflow = previousBodyOverflow;
3363
- };
3364
- }
3365
- function focusableElements(container) {
3366
- return [...container.querySelectorAll(
3367
- 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
3368
- )].filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
3369
- }
3370
- function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
3371
- const overlayIdRef = (0, import_react18.useRef)(/* @__PURE__ */ Symbol("sia-overlay"));
3372
- const closeRef = (0, import_react18.useRef)(onRequestClose);
3373
- closeRef.current = onRequestClose;
3374
- (0, import_react18.useEffect)(() => {
3375
- if (!open || typeof document === "undefined") return void 0;
3376
- const overlayId = overlayIdRef.current;
3377
- const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
3378
- overlayStack.push(overlayId);
3379
- const unlockBody = lockBodyScroll();
3380
- const focusTimer = window.setTimeout(() => {
3381
- const panel = panelRef.current;
3382
- if (!panel) return;
3383
- const [firstFocusable] = focusableElements(panel);
3384
- (firstFocusable ?? panel).focus({ preventScroll: true });
3385
- }, 0);
3386
- function handleKeyDown(event) {
3387
- if (overlayStack.at(-1) !== overlayId) return;
3388
- if (event.key === "Escape" && keyboard) {
3389
- event.preventDefault();
3390
- closeRef.current();
3391
- return;
3392
- }
3393
- if (event.key !== "Tab" || !panelRef.current) return;
3394
- const focusable = focusableElements(panelRef.current);
3395
- if (focusable.length === 0) {
3396
- event.preventDefault();
3397
- panelRef.current.focus();
3398
- return;
3399
- }
3400
- const first = focusable[0];
3401
- const last = focusable.at(-1);
3402
- if (event.shiftKey && document.activeElement === first) {
3403
- event.preventDefault();
3404
- last.focus();
3405
- } else if (!event.shiftKey && document.activeElement === last) {
3406
- event.preventDefault();
3407
- first.focus();
3408
- }
3409
- }
3410
- document.addEventListener("keydown", handleKeyDown);
3411
- return () => {
3412
- window.clearTimeout(focusTimer);
3413
- document.removeEventListener("keydown", handleKeyDown);
3414
- const index = overlayStack.lastIndexOf(overlayId);
3415
- if (index >= 0) overlayStack.splice(index, 1);
3416
- unlockBody();
3417
- previouslyFocused?.focus({ preventScroll: true });
3418
- };
3419
- }, [keyboard, open, panelRef]);
3420
- }
3421
- function OverlayPortal({ children, container }) {
3422
- if (typeof document === "undefined") return null;
3423
- const target = typeof container === "function" ? container() : container ?? document.body;
3424
- return (0, import_react_dom4.createPortal)(children, target);
3425
- }
3426
-
3427
- // src/components/DataDisplay.tsx
3428
3478
  var import_jsx_runtime16 = require("react/jsx-runtime");
3429
3479
  function BadgeRibbon({ text, color, placement = "end", className = "", children, ...props }) {
3430
3480
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `sia-ribbon-wrap ${className}`.trim(), ...withTitleTooltip(props), children: [
package/dist/core.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/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, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, 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, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-CCb4CoSP.cjs';
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, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, 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, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-mmHC4SGJ.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-BAFXKVZB.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, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, 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, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-CJnRQZkv.js';
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, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, 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, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-PlVXb05e.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-vjX7B63I.js';
4
4
  import 'react';
package/dist/core.js CHANGED
@@ -11,20 +11,20 @@ import {
11
11
  Typography,
12
12
  Upload,
13
13
  message
14
- } from "./chunk-D2H37DUL.js";
14
+ } from "./chunk-BEVCKS5J.js";
15
15
  import "./chunk-RX242MUO.js";
16
16
  import {
17
17
  Select
18
- } from "./chunk-7PPE6DJO.js";
18
+ } from "./chunk-BQIARYZB.js";
19
19
  import {
20
20
  Input,
21
21
  Segmented
22
- } from "./chunk-SATXB6X4.js";
22
+ } from "./chunk-GKFFFHHU.js";
23
23
  import "./chunk-SCEHVGKV.js";
24
24
  import {
25
25
  Icon,
26
26
  Modal
27
- } from "./chunk-XY7CXJS6.js";
27
+ } from "./chunk-6MGFX7B2.js";
28
28
  import {
29
29
  Button
30
30
  } from "./chunk-CZ2ITBRW.js";
package/dist/game.cjs CHANGED
@@ -2237,9 +2237,10 @@ var filledIconPaths = {
2237
2237
  var FILLED_ICON_NAMES = Object.freeze(Object.keys(filledIconPaths));
2238
2238
  var normalizedOutlinePaths = normalizeIconPaths(iconPaths, outlineIconBounds);
2239
2239
  var normalizedFilledPaths = normalizeIconPaths(filledIconPaths, filledIconBounds);
2240
- var Icon = (0, import_react6.forwardRef)(function Icon2({ name, size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
2240
+ var Icon = (0, import_react6.forwardRef)(function Icon2({ name, tone = "inherit", size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
2241
2241
  const resolvedSize = typeof size === "number" ? `${size}px` : size;
2242
- const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, ...style };
2242
+ const toneColor = tone === "inherit" ? void 0 : `var(--sia-color-${tone === "danger" ? "error" : tone === "primary" ? "primary-text" : tone})`;
2243
+ const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, color: toneColor, ...style };
2243
2244
  const animationClass = spin ? " sia-icon--spin" : pulse ? " sia-icon--pulse" : "";
2244
2245
  const filledPath = filledIconPaths[name];
2245
2246
  const resolvedVariant = variant === "filled" && filledPath ? "filled" : "outline";
@@ -2266,6 +2267,8 @@ var import_react_dom2 = require("react-dom");
2266
2267
  var bodyLockCount = 0;
2267
2268
  var previousBodyOverflow = "";
2268
2269
  var overlayStack = [];
2270
+ var overlayPanels = /* @__PURE__ */ new Map();
2271
+ var overlayListeners = /* @__PURE__ */ new Set();
2269
2272
  function lockBodyScroll() {
2270
2273
  if (bodyLockCount === 0) {
2271
2274
  previousBodyOverflow = document.body.style.overflow;
@@ -2291,6 +2294,8 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
2291
2294
  const overlayId = overlayIdRef.current;
2292
2295
  const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
2293
2296
  overlayStack.push(overlayId);
2297
+ overlayPanels.set(overlayId, panelRef);
2298
+ overlayListeners.forEach((listener) => listener());
2294
2299
  const unlockBody = lockBodyScroll();
2295
2300
  const focusTimer = window.setTimeout(() => {
2296
2301
  const panel = panelRef.current;
@@ -2328,6 +2333,8 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
2328
2333
  document.removeEventListener("keydown", handleKeyDown);
2329
2334
  const index = overlayStack.lastIndexOf(overlayId);
2330
2335
  if (index >= 0) overlayStack.splice(index, 1);
2336
+ overlayPanels.delete(overlayId);
2337
+ overlayListeners.forEach((listener) => listener());
2331
2338
  unlockBody();
2332
2339
  previouslyFocused?.focus({ preventScroll: true });
2333
2340
  };
package/dist/game.css CHANGED
@@ -2623,6 +2623,10 @@ fieldset:disabled .sia-input-number__floating-placeholder {
2623
2623
  .sia-card--actionable {
2624
2624
  cursor: pointer;
2625
2625
  }
2626
+ .sia-card--selectable[data-sia-interaction-cursor=default],
2627
+ .sia-card--actionable[data-sia-interaction-cursor=default] {
2628
+ cursor: default;
2629
+ }
2626
2630
  .sia-card--actionable[aria-disabled=true] {
2627
2631
  cursor: default;
2628
2632
  }
package/dist/game.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./chunk-RX242MUO.js";
2
2
  import {
3
3
  Modal
4
- } from "./chunk-XY7CXJS6.js";
4
+ } from "./chunk-6MGFX7B2.js";
5
5
  import {
6
6
  Button
7
7
  } from "./chunk-CZ2ITBRW.js";