@sia.soul/sia-react-ui 0.1.141 → 0.1.143

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.
Files changed (47) hide show
  1. package/dist/{Button-BiL3Wjsd.d.ts → Button-C8W8ZHWV.d.ts} +1 -1
  2. package/dist/{Button-O_pNB3SQ.d.cts → Button-CxKBjLda.d.cts} +1 -1
  3. package/dist/{Select-DeD4O8FL.d.ts → Select-CTSd8zum.d.ts} +14 -10
  4. package/dist/{Select-Y0e9kaxE.d.cts → Select-bKLket9n.d.cts} +14 -10
  5. package/dist/chart.cjs +1051 -335
  6. package/dist/chart.js +5 -5
  7. package/dist/chunk-4OHS7RXE.js +1004 -0
  8. package/dist/{chunk-WIRIEIRO.js → chunk-4TYHSAR3.js} +5 -5
  9. package/dist/{chunk-L2S7IPSM.js → chunk-566S64IP.js} +5 -5
  10. package/dist/{chunk-CZ2ITBRW.js → chunk-7SEGBB6V.js} +34 -5
  11. package/dist/{chunk-KY6A5IJH.js → chunk-ETQJ2DQ2.js} +1 -1
  12. package/dist/{chunk-WD56MJO2.js → chunk-F52O2MOV.js} +7 -3
  13. package/dist/{chunk-PQBCD54U.js → chunk-JRXYM5YH.js} +167 -64
  14. package/dist/{chunk-SCEHVGKV.js → chunk-LKLPCYEP.js} +2 -2
  15. package/dist/{chunk-DIRPOUVX.js → chunk-MD4CGSOR.js} +105 -61
  16. package/dist/{chunk-436QH6XH.js → chunk-ORSQAJ22.js} +160 -497
  17. package/dist/{chunk-SO7IJZIR.js → chunk-PD3K5U5Y.js} +2 -2
  18. package/dist/{chunk-UVHC6OEX.js → chunk-WCYVBO2N.js} +342 -123
  19. package/dist/{core-DYo5C4Si.d.cts → core-COaZfusa.d.cts} +51 -24
  20. package/dist/{core-sWwvVAmP.d.ts → core-CvfsQGuT.d.ts} +51 -24
  21. package/dist/core.cjs +2000 -1251
  22. package/dist/core.css +416 -344
  23. package/dist/core.d.cts +3 -3
  24. package/dist/core.d.ts +3 -3
  25. package/dist/core.js +18 -9
  26. package/dist/game.cjs +1984 -1169
  27. package/dist/game.css +182 -177
  28. package/dist/game.d.cts +1 -1
  29. package/dist/game.d.ts +1 -1
  30. package/dist/game.js +8 -3
  31. package/dist/index.cjs +4658 -3542
  32. package/dist/index.css +416 -344
  33. package/dist/index.d.cts +84 -81
  34. package/dist/index.d.ts +84 -81
  35. package/dist/index.js +1075 -713
  36. package/dist/markdown-editor.cjs +727 -40
  37. package/dist/markdown-editor.js +8 -3
  38. package/dist/rich-text-editor.cjs +1265 -308
  39. package/dist/rich-text-editor.js +12 -7
  40. package/dist/{select-date-range-X6a9Y-Te.d.ts → select-date-range-C8cacfmb.d.ts} +1 -1
  41. package/dist/{select-date-range-DiBQQ0Rn.d.cts → select-date-range-Dad0IdD4.d.cts} +1 -1
  42. package/dist/select-date-range.cjs +1281 -807
  43. package/dist/select-date-range.d.cts +3 -3
  44. package/dist/select-date-range.d.ts +3 -3
  45. package/dist/select-date-range.js +13 -8
  46. package/package.json +9 -2
  47. package/dist/chunk-NZMUW5XI.js +0 -292
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  Dropdown,
3
3
  Input
4
- } from "./chunk-UVHC6OEX.js";
4
+ } from "./chunk-WCYVBO2N.js";
5
5
  import {
6
6
  Icon
7
- } from "./chunk-PQBCD54U.js";
7
+ } from "./chunk-JRXYM5YH.js";
8
8
  import {
9
9
  Button
10
- } from "./chunk-CZ2ITBRW.js";
10
+ } from "./chunk-7SEGBB6V.js";
11
11
  import {
12
12
  useFloatingPlaceholder
13
- } from "./chunk-KY6A5IJH.js";
13
+ } from "./chunk-ETQJ2DQ2.js";
14
14
  import {
15
15
  withTitleTooltip
16
- } from "./chunk-NZMUW5XI.js";
16
+ } from "./chunk-4OHS7RXE.js";
17
17
 
18
18
  // src/components/RichTextEditor.tsx
19
19
  import { useEffect, useMemo, useRef, useState } from "react";
@@ -1,19 +1,19 @@
1
1
  import {
2
- FloatingScrollbarProvider,
3
2
  Select
4
- } from "./chunk-436QH6XH.js";
3
+ } from "./chunk-ORSQAJ22.js";
5
4
  import {
6
5
  Icon
7
- } from "./chunk-PQBCD54U.js";
6
+ } from "./chunk-JRXYM5YH.js";
8
7
  import {
9
8
  useFloatingPlaceholder
10
- } from "./chunk-KY6A5IJH.js";
9
+ } from "./chunk-ETQJ2DQ2.js";
11
10
  import {
11
+ FloatingScrollbarProvider,
12
12
  PopupPortal,
13
13
  useControlSize,
14
14
  useControllableState,
15
15
  withTitleTooltip
16
- } from "./chunk-NZMUW5XI.js";
16
+ } from "./chunk-4OHS7RXE.js";
17
17
 
18
18
  // src/components/DatePicker.tsx
19
19
  import { useEffect, useId, useLayoutEffect as useLayoutEffect2, useMemo, useRef as useRef2, useState } from "react";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  useControlSize,
3
3
  withTitleTooltip
4
- } from "./chunk-NZMUW5XI.js";
4
+ } from "./chunk-4OHS7RXE.js";
5
5
 
6
6
  // src/components/Button.tsx
7
- import { forwardRef, useRef } from "react";
7
+ import { forwardRef, useEffect, useRef } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  var Button = forwardRef(function Button2({
10
10
  variant = "default",
@@ -23,6 +23,32 @@ var Button = forwardRef(function Button2({
23
23
  }, forwardedRef) {
24
24
  const size = useControlSize(sizeProp);
25
25
  const localRef = useRef(null);
26
+ const bounceRef = useRef(null);
27
+ const waveTimerRef = useRef();
28
+ useEffect(() => () => {
29
+ bounceRef.current?.cancel();
30
+ window.clearTimeout(waveTimerRef.current);
31
+ }, []);
32
+ function playBounce(button) {
33
+ if (!button.animate || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
34
+ const current = getComputedStyle(button).scale;
35
+ bounceRef.current?.cancel();
36
+ const base = getComputedStyle(button).scale;
37
+ const [x = 1, y = x] = base === "none" ? [] : base.split(/\s+/).map(Number);
38
+ const scaled = (factor) => `${x * factor} ${y * factor}`;
39
+ const animation = button.animate([
40
+ { scale: current === "none" ? "1" : current, offset: 0 },
41
+ // 宽按钮保持等比缩放,以更明显的过冲表现弹性但不改变布局占位。
42
+ { scale: scaled(0.9), offset: 0.2 },
43
+ { scale: scaled(1.09), offset: 0.52 },
44
+ { scale: scaled(0.96), offset: 0.78 },
45
+ { scale: scaled(1), offset: 1 }
46
+ ], { duration: 320, easing: "cubic-bezier(.3, 0, .25, 1)" });
47
+ bounceRef.current = animation;
48
+ animation.onfinish = () => {
49
+ if (bounceRef.current === animation) bounceRef.current = null;
50
+ };
51
+ }
26
52
  function setRef(node) {
27
53
  localRef.current = node;
28
54
  if (typeof forwardedRef === "function") forwardedRef(node);
@@ -30,12 +56,15 @@ var Button = forwardRef(function Button2({
30
56
  }
31
57
  function handleClick(event) {
32
58
  const button = localRef.current;
59
+ if (disabled || loading) return;
60
+ if (button) playBounce(button);
33
61
  if (button && variant === "primary") {
34
62
  const rect = button.getBoundingClientRect();
35
- button.style.setProperty("--sia-wave-x", `${event.clientX - rect.left}px`);
36
- button.style.setProperty("--sia-wave-y", `${event.clientY - rect.top}px`);
63
+ button.style.setProperty("--sia-wave-x", `${event.detail === 0 ? button.offsetWidth / 2 : (event.clientX - rect.left) * button.offsetWidth / rect.width}px`);
64
+ button.style.setProperty("--sia-wave-y", `${event.detail === 0 ? button.offsetHeight / 2 : (event.clientY - rect.top) * button.offsetHeight / rect.height}px`);
37
65
  button.dataset.wave = "active";
38
- window.setTimeout(() => delete button.dataset.wave, 360);
66
+ window.clearTimeout(waveTimerRef.current);
67
+ waveTimerRef.current = window.setTimeout(() => delete button.dataset.wave, 360);
39
68
  }
40
69
  onClick?.(event);
41
70
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  usePlaceholderMode
3
- } from "./chunk-NZMUW5XI.js";
3
+ } from "./chunk-4OHS7RXE.js";
4
4
 
5
5
  // src/components/FloatingPlaceholder.tsx
6
6
  import { jsx } from "react/jsx-runtime";
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  TextArea
3
- } from "./chunk-SCEHVGKV.js";
3
+ } from "./chunk-LKLPCYEP.js";
4
4
  import {
5
5
  Button
6
- } from "./chunk-CZ2ITBRW.js";
6
+ } from "./chunk-7SEGBB6V.js";
7
7
  import {
8
+ initializeDefaultScrollbars,
8
9
  withTitleTooltip
9
- } from "./chunk-NZMUW5XI.js";
10
+ } from "./chunk-4OHS7RXE.js";
10
11
 
11
12
  // src/components/ChartWhirlingLoading.tsx
12
13
  import { useEffect, useState } from "react";
@@ -7288,6 +7289,9 @@ function createBaiduMapHost(element, sdk, options) {
7288
7289
  };
7289
7290
  }
7290
7291
 
7292
+ // src/chart.ts
7293
+ initializeDefaultScrollbars();
7294
+
7291
7295
  export {
7292
7296
  ChartWhirlingLoading,
7293
7297
  serializeChartStack,
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  Button
3
- } from "./chunk-CZ2ITBRW.js";
3
+ } from "./chunk-7SEGBB6V.js";
4
4
  import {
5
+ useOverlayMotion,
5
6
  withTitleTooltip
6
- } from "./chunk-NZMUW5XI.js";
7
+ } from "./chunk-4OHS7RXE.js";
7
8
 
8
9
  // src/components/Icon.tsx
9
10
  import { forwardRef } from "react";
@@ -1179,12 +1180,126 @@ var Icon = forwardRef(function Icon2({ name, tone = "inherit", size = "1em", str
1179
1180
  );
1180
1181
  });
1181
1182
 
1183
+ // src/components/Skeleton.tsx
1184
+ import { jsx as jsx4 } from "react/jsx-runtime";
1185
+ function Skeleton({ rows = 6, columns = 2, rowHeight = 30, gap = 16, className = "", style, ...props }) {
1186
+ const count = (value, fallback, min, max) => Number.isFinite(value) ? Math.min(max, Math.max(min, Math.floor(value))) : fallback;
1187
+ const rowCount = count(rows, 6, 1, 30);
1188
+ const columnCount = count(columns, 2, 1, 4);
1189
+ return /* @__PURE__ */ jsx4("div", { role: "status", "aria-label": "\u6B63\u5728\u51C6\u5907\u5185\u5BB9", className: `sia-skeleton ${className}`.trim(), style: { display: "grid", gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`, gap: count(gap, 16, 0, 64), ...style }, ...withTitleTooltip(props), children: Array.from({ length: rowCount * columnCount }, (_, index) => /* @__PURE__ */ jsx4("span", { className: "sia-skeleton__block", "aria-hidden": "true", style: { height: count(rowHeight, 30, 8, 200) } }, index)) });
1190
+ }
1191
+
1192
+ // src/components/OverlayContentSkeleton.tsx
1193
+ import { jsx as jsx5 } from "react/jsx-runtime";
1194
+ var controlSelector = '.sia-input-control, .sia-textarea-control, .sia-input-number, .sia-select__trigger, .sia-switch-wrap, .sia-checkbox, .sia-radio, input, textarea, select, button, img, svg, canvas, video, [role="combobox"], [role="checkbox"], [role="radio"], [role="switch"], [contenteditable="true"], .sia-table';
1195
+ function captureOverlaySkeleton(body) {
1196
+ const bounds = body.getBoundingClientRect();
1197
+ const scaleX = body.offsetWidth ? bounds.width / body.offsetWidth : 1;
1198
+ const scaleY = body.offsetHeight ? bounds.height / body.offsetHeight : 1;
1199
+ const css = getComputedStyle(body);
1200
+ const paddingLeft = parseFloat(css.paddingLeft) || 0;
1201
+ const paddingTop = parseFloat(css.paddingTop) || 0;
1202
+ const width = Math.max(0, body.clientWidth - paddingLeft - (parseFloat(css.paddingRight) || 0));
1203
+ const height = Math.max(0, body.clientHeight - paddingTop - (parseFloat(css.paddingBottom) || 0));
1204
+ const blocks = [];
1205
+ const addRect = (rect, radius) => {
1206
+ const x = (rect.left - bounds.left) / (scaleX || 1) - body.clientLeft - paddingLeft;
1207
+ const y = (rect.top - bounds.top) / (scaleY || 1) - body.clientTop - paddingTop;
1208
+ const left = Math.max(0, x), top = Math.max(0, y);
1209
+ const right = Math.min(width, x + rect.width / (scaleX || 1));
1210
+ const bottom = Math.min(height, y + rect.height / (scaleY || 1));
1211
+ if (right - left < 2 || bottom - top < 2 || blocks.length >= 80) return;
1212
+ blocks.push({ position: "absolute", left, top, width: right - left, height: bottom - top, borderRadius: radius });
1213
+ };
1214
+ const pending = [];
1215
+ for (let index = Math.min(body.childNodes.length, 600) - 1; index >= 0; index--) pending.push(body.childNodes[index]);
1216
+ let inspected = 0;
1217
+ while (pending.length && inspected++ < 600 && blocks.length < 80) {
1218
+ const node = pending.pop();
1219
+ if (node instanceof Element) {
1220
+ if (node.matches("script, style, [hidden], .sia-skeleton, .sia-scrollbar-track")) continue;
1221
+ const style = getComputedStyle(node);
1222
+ if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0") continue;
1223
+ if (node.matches(controlSelector)) {
1224
+ addRect(node.getBoundingClientRect(), style.borderRadius || "4px");
1225
+ continue;
1226
+ }
1227
+ for (let index = Math.min(node.childNodes.length, 600 - inspected - pending.length) - 1; index >= 0; index--) pending.push(node.childNodes[index]);
1228
+ } else if (node.nodeType === Node.TEXT_NODE && node.textContent?.trim()) {
1229
+ const range = document.createRange();
1230
+ range.selectNodeContents(node);
1231
+ for (const rect of Array.from(range.getClientRects()).slice(0, 3)) addRect(rect, "4px");
1232
+ }
1233
+ }
1234
+ return { height, blocks };
1235
+ }
1236
+ function OverlayContentSkeleton({ layout }) {
1237
+ return /* @__PURE__ */ jsx5("div", { className: "sia-skeleton sia-overlay-content-skeleton", "aria-hidden": "true", style: { position: "relative", height: layout.height, overflow: "hidden" }, children: layout.blocks.map((style, index) => /* @__PURE__ */ jsx5("span", { className: "sia-skeleton__block", style }, index)) });
1238
+ }
1239
+
1240
+ // src/components/useOverlayExitPlaceholder.ts
1241
+ import { useLayoutEffect, useRef } from "react";
1242
+ function useOverlayExitPlaceholder(open, present, panelRef, bodyRef, captureContent) {
1243
+ const layout = useRef();
1244
+ const dimensions = useRef({ panelHeight: 0, bodyHeight: 0 });
1245
+ useLayoutEffect(() => {
1246
+ if (!open || !present) {
1247
+ if (present && bodyRef.current) bodyRef.current.scrollTop = bodyRef.current.scrollLeft = 0;
1248
+ return;
1249
+ }
1250
+ if (!captureContent) layout.current = void 0;
1251
+ const panel = panelRef.current;
1252
+ const body = bodyRef.current;
1253
+ if (!panel) return;
1254
+ const measure = () => {
1255
+ dimensions.current = { panelHeight: panel.offsetHeight, bodyHeight: body?.offsetHeight ?? 0 };
1256
+ if (captureContent && body) layout.current = captureOverlaySkeleton(body);
1257
+ };
1258
+ let frame = 0;
1259
+ const schedule = () => {
1260
+ if (!frame) frame = requestAnimationFrame(() => {
1261
+ frame = 0;
1262
+ measure();
1263
+ });
1264
+ };
1265
+ measure();
1266
+ const observer = new ResizeObserver(measure);
1267
+ observer.observe(panel);
1268
+ if (body) observer.observe(body);
1269
+ const mutations = new MutationObserver(schedule);
1270
+ const beforePointerAction = (event) => {
1271
+ if (event.target instanceof Element && event.target.closest('button, [role="button"]')) measure();
1272
+ };
1273
+ const beforeKeyboardAction = (event) => {
1274
+ if (event.key === "Escape") measure();
1275
+ };
1276
+ if (captureContent && body) {
1277
+ mutations.observe(body, { subtree: true, childList: true, characterData: true, attributes: true, attributeFilter: ["style", "class", "hidden"] });
1278
+ body.addEventListener("scroll", schedule, { passive: true });
1279
+ panel.addEventListener("pointerdown", beforePointerAction, true);
1280
+ panel.addEventListener("keydown", beforeKeyboardAction, true);
1281
+ }
1282
+ return () => {
1283
+ observer.disconnect();
1284
+ mutations.disconnect();
1285
+ if (frame) cancelAnimationFrame(frame);
1286
+ body?.removeEventListener("scroll", schedule);
1287
+ panel.removeEventListener("pointerdown", beforePointerAction, true);
1288
+ panel.removeEventListener("keydown", beforeKeyboardAction, true);
1289
+ };
1290
+ });
1291
+ const closing = !open && present;
1292
+ const panelStyle = closing && dimensions.current.panelHeight > 0 ? { height: dimensions.current.panelHeight, boxSizing: "border-box", overflow: "hidden" } : void 0;
1293
+ const bodyStyle = closing && dimensions.current.bodyHeight > 0 ? { height: dimensions.current.bodyHeight, flex: "0 0 auto", boxSizing: "border-box" } : void 0;
1294
+ return { panelStyle, bodyStyle, layout: layout.current, hadBody: dimensions.current.bodyHeight > 0 };
1295
+ }
1296
+
1182
1297
  // src/components/Modal.tsx
1183
- import { forwardRef as forwardRef2, useEffect as useEffect2, useId, useRef as useRef2, useState } from "react";
1298
+ import { forwardRef as forwardRef2, useEffect as useEffect2, useId, useRef as useRef3, useState } from "react";
1184
1299
  import { createRoot } from "react-dom/client";
1185
1300
 
1186
1301
  // src/components/Overlay.tsx
1187
- import { useEffect, useRef } from "react";
1302
+ import { useEffect, useRef as useRef2 } from "react";
1188
1303
  import { createPortal } from "react-dom";
1189
1304
  var bodyLockCount = 0;
1190
1305
  var previousBodyOverflow = "";
@@ -1227,9 +1342,9 @@ function firstModalInput(panel) {
1227
1342
  );
1228
1343
  return [...candidates ?? []].find((element) => (element.tabIndex >= 0 || element.isContentEditable && !element.hasAttribute("tabindex")) && !element.matches(":disabled, [readonly], [aria-readonly='true']") && !element.closest('[hidden], [inert], [aria-hidden="true"], [aria-disabled="true"]') && element.getClientRects().length > 0 && getComputedStyle(element).visibility === "visible");
1229
1344
  }
1230
- function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false) {
1231
- const overlayIdRef = useRef(/* @__PURE__ */ Symbol("sia-overlay"));
1232
- const closeRef = useRef(onRequestClose);
1345
+ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false, contentReady = true) {
1346
+ const overlayIdRef = useRef2(/* @__PURE__ */ Symbol("sia-overlay"));
1347
+ const closeRef = useRef2(onRequestClose);
1233
1348
  closeRef.current = onRequestClose;
1234
1349
  useEffect(() => {
1235
1350
  if (!open || typeof document === "undefined") return void 0;
@@ -1239,14 +1354,6 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, au
1239
1354
  overlayPanels.set(overlayId, panelRef);
1240
1355
  overlayListeners.forEach((listener) => listener());
1241
1356
  const unlockBody = lockBodyScroll();
1242
- const focusTimer = window.setTimeout(() => {
1243
- const panel = panelRef.current;
1244
- if (!panel || overlayStack.at(-1) !== overlayId) return;
1245
- if (panel.contains(document.activeElement) && document.activeElement !== panel) return;
1246
- const [firstFocusable] = focusableElements(panel);
1247
- const input = autoFocusInput ? firstModalInput(panel) : void 0;
1248
- (input ?? firstFocusable ?? panel).focus({ preventScroll: true });
1249
- }, 0);
1250
1357
  function handleKeyDown(event) {
1251
1358
  if (overlayStack.at(-1) !== overlayId) return;
1252
1359
  if (event.key === "Escape" && keyboard) {
@@ -1273,7 +1380,6 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, au
1273
1380
  }
1274
1381
  document.addEventListener("keydown", handleKeyDown);
1275
1382
  return () => {
1276
- window.clearTimeout(focusTimer);
1277
1383
  document.removeEventListener("keydown", handleKeyDown);
1278
1384
  const index = overlayStack.lastIndexOf(overlayId);
1279
1385
  if (index >= 0) overlayStack.splice(index, 1);
@@ -1283,6 +1389,17 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, au
1283
1389
  previouslyFocused?.focus({ preventScroll: true });
1284
1390
  };
1285
1391
  }, [keyboard, open, panelRef, autoFocusInput]);
1392
+ useEffect(() => {
1393
+ if (!open) return;
1394
+ const timer = window.setTimeout(() => {
1395
+ const panel = panelRef.current;
1396
+ if (!panel || overlayStack.at(-1) !== overlayIdRef.current) return;
1397
+ if (panel.contains(document.activeElement) && document.activeElement !== panel) return;
1398
+ const first = contentReady ? (autoFocusInput ? firstModalInput(panel) : void 0) ?? focusableElements(panel)[0] : void 0;
1399
+ (first ?? panel).focus({ preventScroll: true });
1400
+ }, 0);
1401
+ return () => window.clearTimeout(timer);
1402
+ }, [open, panelRef, autoFocusInput, contentReady]);
1286
1403
  }
1287
1404
  function OverlayPortal({ children, container }) {
1288
1405
  if (typeof document === "undefined") return null;
@@ -1291,18 +1408,19 @@ function OverlayPortal({ children, container }) {
1291
1408
  }
1292
1409
 
1293
1410
  // src/components/Modal.tsx
1294
- import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1411
+ import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
1295
1412
  var modalHandles = /* @__PURE__ */ new Set();
1296
- var MODAL_MOTION_DURATION = 220;
1297
1413
  var typeIcons = {
1298
- info: /* @__PURE__ */ jsx4(Icon, { name: "info", size: 23, variant: "filled" }),
1299
- success: /* @__PURE__ */ jsx4(Icon, { name: "circle-check", size: 23, variant: "filled" }),
1300
- warning: /* @__PURE__ */ jsx4(Icon, { name: "warning", size: 23, variant: "filled" }),
1301
- error: /* @__PURE__ */ jsx4(Icon, { name: "circle-close", size: 23, variant: "filled" }),
1302
- confirm: /* @__PURE__ */ jsx4(Icon, { name: "question", size: 23, variant: "filled" })
1414
+ info: /* @__PURE__ */ jsx6(Icon, { name: "info", size: 23, variant: "filled" }),
1415
+ success: /* @__PURE__ */ jsx6(Icon, { name: "circle-check", size: 23, variant: "filled" }),
1416
+ warning: /* @__PURE__ */ jsx6(Icon, { name: "warning", size: 23, variant: "filled" }),
1417
+ error: /* @__PURE__ */ jsx6(Icon, { name: "circle-close", size: 23, variant: "filled" }),
1418
+ confirm: /* @__PURE__ */ jsx6(Icon, { name: "question", size: 23, variant: "filled" })
1303
1419
  };
1304
1420
  var ModalRoot = forwardRef2(function Modal({
1305
1421
  open,
1422
+ deferContent = false,
1423
+ loadingFallback,
1306
1424
  autoFocus = true,
1307
1425
  title,
1308
1426
  children,
@@ -1331,34 +1449,15 @@ var ModalRoot = forwardRef2(function Modal({
1331
1449
  style,
1332
1450
  ...props
1333
1451
  }, forwardedRef) {
1334
- const localRef = useRef2(null);
1452
+ const localRef = useRef3(null);
1453
+ const bodyRef = useRef3(null);
1335
1454
  const titleId = useId();
1336
1455
  const [submitting, setSubmitting] = useState(false);
1337
- const [rendered, setRendered] = useState(open);
1338
- const [closing, setClosing] = useState(false);
1339
- const afterOpenChangeRef = useRef2(afterOpenChange);
1340
- afterOpenChangeRef.current = afterOpenChange;
1341
- const submitLock = useRef2(false);
1342
- useEffect2(() => {
1343
- if (!open || !rendered) return void 0;
1344
- const timer = window.setTimeout(() => afterOpenChangeRef.current?.(true), MODAL_MOTION_DURATION);
1345
- return () => window.clearTimeout(timer);
1346
- }, [open, rendered]);
1347
- useEffect2(() => {
1348
- if (open) {
1349
- setRendered(true);
1350
- setClosing(false);
1351
- return void 0;
1352
- }
1353
- if (!rendered) return void 0;
1354
- setClosing(true);
1355
- const timer = window.setTimeout(() => {
1356
- setRendered(false);
1357
- setClosing(false);
1358
- afterOpenChangeRef.current?.(false);
1359
- }, MODAL_MOTION_DURATION);
1360
- return () => window.clearTimeout(timer);
1361
- }, [open, rendered]);
1456
+ const motion = useOverlayMotion(open, localRef, "modal", "bottom", true, afterOpenChange);
1457
+ const { present: rendered, closing } = motion;
1458
+ const bodyReady = !closing && (!deferContent || motion.settled);
1459
+ const exitPlaceholder = useOverlayExitPlaceholder(open, rendered, localRef, bodyRef, bodyReady && loadingFallback === void 0);
1460
+ const submitLock = useRef3(false);
1362
1461
  function setRef(node) {
1363
1462
  localRef.current = node;
1364
1463
  if (typeof forwardedRef === "function") forwardedRef(node);
@@ -1370,7 +1469,7 @@ var ModalRoot = forwardRef2(function Modal({
1370
1469
  onOpenChange?.(false);
1371
1470
  }
1372
1471
  async function handleOk() {
1373
- if (submitLock.current || confirmLoading) return;
1472
+ if (!bodyReady || submitLock.current || confirmLoading) return;
1374
1473
  submitLock.current = true;
1375
1474
  if (!onOk) {
1376
1475
  onOpenChange?.(false);
@@ -1393,23 +1492,24 @@ var ModalRoot = forwardRef2(function Modal({
1393
1492
  setSubmitting(false);
1394
1493
  }
1395
1494
  }
1396
- useOverlayLifecycle(rendered, localRef, requestClose, keyboard, autoFocus);
1495
+ useOverlayLifecycle(rendered, localRef, requestClose, keyboard, autoFocus, bodyReady);
1397
1496
  if (!rendered) return null;
1398
1497
  const mergedStyle = {
1399
1498
  ...height !== void 0 ? { display: "flex", flexDirection: "column", height, maxHeight: "calc(100dvh - 48px)" } : {},
1400
1499
  ...style,
1401
1500
  "--sia-modal-width": typeof width === "number" ? `${width}px` : width
1402
1501
  };
1403
- const loading = submitting || confirmLoading;
1502
+ const loading = submitting || confirmLoading || !bodyReady;
1404
1503
  const defaultFooter = /* @__PURE__ */ jsxs3(Fragment3, { children: [
1405
- showCancel ? /* @__PURE__ */ jsx4(Button, { ...cancelButtonProps, onClick: requestClose, disabled: loading || cancelButtonProps?.disabled, children: cancelText }) : null,
1406
- /* @__PURE__ */ jsx4(Button, { variant: "primary", ...okButtonProps, onClick: handleOk, loading, children: okText })
1504
+ showCancel ? /* @__PURE__ */ jsx6(Button, { ...cancelButtonProps, onClick: requestClose, disabled: loading || cancelButtonProps?.disabled, children: cancelText }) : null,
1505
+ /* @__PURE__ */ jsx6(Button, { variant: "primary", ...okButtonProps, onClick: handleOk, loading, children: okText })
1407
1506
  ] });
1408
- return /* @__PURE__ */ jsx4(OverlayPortal, { container: getContainer, children: /* @__PURE__ */ jsx4(
1507
+ return /* @__PURE__ */ jsx6(OverlayPortal, { container: getContainer, children: /* @__PURE__ */ jsx6(
1409
1508
  "div",
1410
1509
  {
1411
1510
  className: `sia-modal-root${centered ? " sia-modal-root--centered" : ""}`,
1412
1511
  "data-state": closing ? "closing" : "open",
1512
+ "data-content-pending": !bodyReady || void 0,
1413
1513
  style: { zIndex },
1414
1514
  onMouseDown: (event) => {
1415
1515
  if (event.target === event.currentTarget && maskClosable) requestClose();
@@ -1419,7 +1519,7 @@ var ModalRoot = forwardRef2(function Modal({
1419
1519
  {
1420
1520
  ref: setRef,
1421
1521
  className: `sia-modal sia-modal--${type} ${className}`.trim(),
1422
- style: mergedStyle,
1522
+ style: { ...mergedStyle, ...exitPlaceholder.panelStyle, animation: "none" },
1423
1523
  role: "dialog",
1424
1524
  "aria-modal": "true",
1425
1525
  "aria-labelledby": title ? titleId : void 0,
@@ -1428,14 +1528,14 @@ var ModalRoot = forwardRef2(function Modal({
1428
1528
  children: [
1429
1529
  /* @__PURE__ */ jsxs3("div", { className: "sia-modal__header", style: height !== void 0 ? { flexShrink: 0 } : void 0, children: [
1430
1530
  /* @__PURE__ */ jsxs3("div", { className: "sia-modal__heading", children: [
1431
- typeIcons[type] ? /* @__PURE__ */ jsx4("span", { className: "sia-modal__type-icon", "aria-hidden": "true", children: typeIcons[type] }) : null,
1432
- title ? /* @__PURE__ */ jsx4("strong", { id: titleId, children: title }) : null
1531
+ typeIcons[type] ? /* @__PURE__ */ jsx6("span", { className: "sia-modal__type-icon", "aria-hidden": "true", children: typeIcons[type] }) : null,
1532
+ title ? /* @__PURE__ */ jsx6("strong", { id: titleId, children: title }) : null
1433
1533
  ] }),
1434
- closable ? /* @__PURE__ */ jsx4("button", { type: "button", className: "sia-modal__close", "aria-label": "\u5173\u95ED\u5BF9\u8BDD\u6846", onClick: requestClose, children: /* @__PURE__ */ jsx4(Icon, { name: "close", size: 17 }) }) : null
1534
+ closable ? /* @__PURE__ */ jsx6("button", { type: "button", className: "sia-modal__close", "aria-label": "\u5173\u95ED\u5BF9\u8BDD\u6846", onClick: requestClose, children: /* @__PURE__ */ jsx6(Icon, { name: "close", size: 17 }) }) : null
1435
1535
  ] }),
1436
- children !== void 0 ? /* @__PURE__ */ jsx4("div", { className: "sia-modal__body", style: height !== void 0 ? { flex: 1, minHeight: 0, overflow: "auto" } : void 0, children }) : null,
1437
- footer !== null ? /* @__PURE__ */ jsxs3("div", { className: "sia-modal__footer", style: height !== void 0 ? { flexShrink: 0 } : void 0, children: [
1438
- footer === void 0 && footerExtra != null ? /* @__PURE__ */ jsx4("div", { style: { marginRight: "auto" }, children: footerExtra }) : null,
1536
+ children !== void 0 || closing && exitPlaceholder.hadBody ? /* @__PURE__ */ jsx6("div", { ref: bodyRef, className: `sia-modal__body${deferContent && bodyReady ? " sia-overlay-body--ready" : ""}`, "aria-busy": !bodyReady, style: { ...height !== void 0 ? { flex: 1, minHeight: 0, overflow: "auto" } : {}, ...exitPlaceholder.bodyStyle }, children: bodyReady ? children : loadingFallback !== void 0 ? loadingFallback : closing && exitPlaceholder.layout ? /* @__PURE__ */ jsx6(OverlayContentSkeleton, { layout: exitPlaceholder.layout }) : /* @__PURE__ */ jsx6(Skeleton, {}) }) : null,
1537
+ footer !== null && (bodyReady || closing && motion.entered || footer === void 0) ? /* @__PURE__ */ jsxs3("div", { className: "sia-modal__footer", style: height !== void 0 ? { flexShrink: 0 } : void 0, children: [
1538
+ footer === void 0 && footerExtra != null ? /* @__PURE__ */ jsx6("div", { style: { marginRight: "auto" }, children: footerExtra }) : null,
1439
1539
  footer ?? defaultFooter
1440
1540
  ] }) : null
1441
1541
  ]
@@ -1473,7 +1573,7 @@ function openModal(config) {
1473
1573
  mounted = true;
1474
1574
  if (!currentOpen) render();
1475
1575
  }, []);
1476
- return /* @__PURE__ */ jsx4(ModalRoot, { ...currentConfig, open: !mounted || currentOpen, onOpenChange: (nextOpen) => {
1576
+ return /* @__PURE__ */ jsx6(ModalRoot, { ...currentConfig, open: !mounted || currentOpen, onOpenChange: (nextOpen) => {
1477
1577
  currentConfig.onOpenChange?.(nextOpen);
1478
1578
  if (!nextOpen) closeWithMotion();
1479
1579
  }, afterOpenChange: (nextOpen) => {
@@ -1485,7 +1585,7 @@ function openModal(config) {
1485
1585
  } });
1486
1586
  }
1487
1587
  function render() {
1488
- root.render(/* @__PURE__ */ jsx4(ModalInstance, {}));
1588
+ root.render(/* @__PURE__ */ jsx6(ModalInstance, {}));
1489
1589
  }
1490
1590
  const handle = {
1491
1591
  destroy: closeWithMotion,
@@ -1533,9 +1633,12 @@ export {
1533
1633
  ICON_NAMES,
1534
1634
  FILLED_ICON_NAMES,
1535
1635
  Icon,
1636
+ Skeleton,
1536
1637
  subscribeOverlayLayers,
1537
1638
  isAnchorBehindOverlay,
1538
1639
  useOverlayLifecycle,
1539
1640
  OverlayPortal,
1641
+ OverlayContentSkeleton,
1642
+ useOverlayExitPlaceholder,
1540
1643
  Modal2 as Modal
1541
1644
  };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  useFloatingPlaceholder
3
- } from "./chunk-KY6A5IJH.js";
3
+ } from "./chunk-ETQJ2DQ2.js";
4
4
  import {
5
5
  useControlSize,
6
6
  withTitleTooltip
7
- } from "./chunk-NZMUW5XI.js";
7
+ } from "./chunk-4OHS7RXE.js";
8
8
 
9
9
  // src/components/TextArea.tsx
10
10
  import { forwardRef, useId, useState } from "react";