@sia.soul/sia-react-ui 0.1.138 → 0.1.139
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-4KNFPQEV.js → chunk-AL46WYJF.js} +37 -6
- package/dist/{core-Bkk7-59o.d.ts → core-Cmeyc0TI.d.ts} +3 -1
- package/dist/{core-lZIzt-an.d.cts → core-CwcgYFnO.d.cts} +3 -1
- package/dist/core.cjs +37 -6
- package/dist/core.css +13 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/game.css +3 -0
- package/dist/index.cjs +48 -8
- package/dist/index.css +13 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -3
- package/package.json +1 -1
|
@@ -255,6 +255,7 @@ function Tabs({
|
|
|
255
255
|
onAfterChange,
|
|
256
256
|
deferContent = false,
|
|
257
257
|
type = "line",
|
|
258
|
+
indicatorMotion = type === "line" || type === "underline" ? "stretch" : "slide",
|
|
258
259
|
size = "medium",
|
|
259
260
|
tabPosition,
|
|
260
261
|
orientation = "horizontal",
|
|
@@ -281,6 +282,7 @@ function Tabs({
|
|
|
281
282
|
const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
|
|
282
283
|
const listRef = useRef2(null);
|
|
283
284
|
const indicatorRef = useRef2(null);
|
|
285
|
+
const indicatorTargetRef = useRef2();
|
|
284
286
|
const moreRef = useRef2(null);
|
|
285
287
|
const [overflow, setOverflow] = useState3({ count: items.length, width: 0 });
|
|
286
288
|
const [moreOpen, setMoreOpen] = useState3(false);
|
|
@@ -333,13 +335,21 @@ function Tabs({
|
|
|
333
335
|
if (!list || !indicator) return;
|
|
334
336
|
const active = list.querySelector('[role="tab"][aria-selected="true"]');
|
|
335
337
|
if (!active || active.closest('[data-tab-hidden="true"]')) {
|
|
338
|
+
indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
336
339
|
indicator.style.visibility = "hidden";
|
|
340
|
+
indicatorTargetRef.current = void 0;
|
|
337
341
|
return;
|
|
338
342
|
}
|
|
339
343
|
const listRect = list.getBoundingClientRect();
|
|
340
344
|
const rect = active.getBoundingClientRect();
|
|
341
|
-
const
|
|
342
|
-
|
|
345
|
+
const x = rect.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
346
|
+
const y = rect.top - listRect.top - list.clientTop + list.scrollTop;
|
|
347
|
+
const previous = indicatorTargetRef.current;
|
|
348
|
+
const sameTarget = previous?.node === indicator && previous.key === selectedKey && previous.position === resolvedPosition && Math.abs(previous.x - x) < 0.5 && Math.abs(previous.y - y) < 0.5 && Math.abs(previous.width - rect.width) < 0.5 && Math.abs(previous.height - rect.height) < 0.5;
|
|
349
|
+
if (indicatorMotion === "stretch" && sameTarget) return;
|
|
350
|
+
const current = indicator.getBoundingClientRect();
|
|
351
|
+
if (indicatorMotion === "stretch") indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
352
|
+
indicator.style.transform = `translate(${x}px, ${y}px)`;
|
|
343
353
|
indicator.style.width = `${rect.width}px`;
|
|
344
354
|
indicator.style.height = `${rect.height}px`;
|
|
345
355
|
indicator.style.visibility = "visible";
|
|
@@ -347,13 +357,34 @@ function Tabs({
|
|
|
347
357
|
indicator.getBoundingClientRect();
|
|
348
358
|
indicator.dataset.ready = "true";
|
|
349
359
|
}
|
|
360
|
+
if (indicatorMotion === "stretch" && previous?.node === indicator && previous.key !== selectedKey && previous.position === resolvedPosition && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
361
|
+
const fromX = current.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
362
|
+
const fromY = current.top - listRect.top - list.clientTop + list.scrollTop;
|
|
363
|
+
const vertical = resolvedOrientation === "vertical";
|
|
364
|
+
const start = vertical ? Math.min(fromY, y) : Math.min(fromX, x);
|
|
365
|
+
const end = vertical ? Math.max(fromY + current.height, y + rect.height) : Math.max(fromX + current.width, x + rect.width);
|
|
366
|
+
indicator.animate([
|
|
367
|
+
{ transform: `translate(${fromX}px, ${fromY}px)`, width: `${current.width}px`, height: `${current.height}px`, offset: 0 },
|
|
368
|
+
{ transform: `translate(${vertical ? x : start}px, ${vertical ? start : y}px)`, width: `${vertical ? rect.width : end - start}px`, height: `${vertical ? end - start : rect.height}px`, offset: 0.45 },
|
|
369
|
+
{ transform: `translate(${x}px, ${y}px)`, width: `${rect.width}px`, height: `${rect.height}px`, offset: 1 }
|
|
370
|
+
], { duration: 300, easing: "cubic-bezier(.4, 0, .2, 1)" });
|
|
371
|
+
}
|
|
372
|
+
indicatorTargetRef.current = { node: indicator, key: selectedKey, position: resolvedPosition, x, y, width: rect.width, height: rect.height };
|
|
350
373
|
}
|
|
351
374
|
updateIndicator();
|
|
352
375
|
const observer = new ResizeObserver(updateIndicator);
|
|
353
376
|
observer.observe(list);
|
|
354
377
|
list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
|
|
355
|
-
|
|
356
|
-
|
|
378
|
+
const motionPreference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
379
|
+
const stopMotion = () => {
|
|
380
|
+
if (motionPreference.matches) indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
381
|
+
};
|
|
382
|
+
motionPreference.addEventListener("change", stopMotion);
|
|
383
|
+
return () => {
|
|
384
|
+
observer.disconnect();
|
|
385
|
+
motionPreference.removeEventListener("change", stopMotion);
|
|
386
|
+
};
|
|
387
|
+
}, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount, indicatorMotion]);
|
|
357
388
|
useEffect(() => {
|
|
358
389
|
let cancelled = false;
|
|
359
390
|
let frame = 0;
|
|
@@ -378,7 +409,7 @@ function Tabs({
|
|
|
378
409
|
cancelled = true;
|
|
379
410
|
cancelAnimationFrame(frame);
|
|
380
411
|
};
|
|
381
|
-
}, [selectedKey, type, deferContent]);
|
|
412
|
+
}, [selectedKey, type, deferContent, indicatorMotion]);
|
|
382
413
|
const contentKey = deferContent && items.some((item) => item.key === settledContentKey) ? settledContentKey : selectedKey;
|
|
383
414
|
useLayoutEffect2(() => {
|
|
384
415
|
if (deferContent && contentKey !== settledContentKey) setSettledContentKey(contentKey);
|
|
@@ -422,7 +453,7 @@ function Tabs({
|
|
|
422
453
|
type === "tech-line" ? /* @__PURE__ */ jsx4("svg", { className: "sia-tabs__title-connector", viewBox: "0 0 32 40", "aria-hidden": "true", children: /* @__PURE__ */ jsx4("path", { d: "M0 39.25 H5 Q8 39.25 10 35.25 L28 3.75 Q29 1.75 32 1.75", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinejoin: "round" }) }) : null
|
|
423
454
|
] }) : null,
|
|
424
455
|
/* @__PURE__ */ jsxs4("div", { ref: listRef, style: resolvedOrientation === "horizontal" && overflow.width ? { width: overflow.width } : void 0, className: `sia-tabs__list${sliding ? " sia-tabs__list--sliding" : ""}`, role: "tablist", "aria-orientation": resolvedOrientation, children: [
|
|
425
|
-
sliding ? /* @__PURE__ */ jsx4("span", { ref: indicatorRef, className: `sia-tabs__indicator${type === "capsule" ? " sia-tabs__capsule-indicator" : ""}`, "aria-hidden": "true", children: type === "tech-line" ? /* @__PURE__ */ jsx4("span", { className: "sia-tabs__indicator-shape", "aria-hidden": "true" }) : null }, type) : null,
|
|
456
|
+
sliding ? /* @__PURE__ */ jsx4("span", { ref: indicatorRef, className: `sia-tabs__indicator${indicatorMotion === "stretch" ? " sia-tabs__indicator--stretch" : ""}${type === "capsule" ? " sia-tabs__capsule-indicator" : ""}`, "aria-hidden": "true", children: type === "tech-line" ? /* @__PURE__ */ jsx4("span", { className: "sia-tabs__indicator-shape", "aria-hidden": "true" }) : null }, `${type}-${indicatorMotion}`) : null,
|
|
426
457
|
items.map((item, index) => {
|
|
427
458
|
const selected = item.key === selectedKey;
|
|
428
459
|
const canClose = item.closable ?? closable;
|
|
@@ -797,6 +797,8 @@ interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
|
797
797
|
* @defaultValue "line"
|
|
798
798
|
*/
|
|
799
799
|
type?: TabsType;
|
|
800
|
+
/** 选中指示器的切换动效:stretch 朝目标方向先拉长再收拢,slide 同步平移并调整尺寸。line、underline 默认 stretch,其余样式默认 slide;card、pill 无独立指示器,不受此项影响。stretch 时长 300ms,首次定位及系统减少动态效果时不播放;支持四个方向,连续切换从当前显示位置续接。 */
|
|
801
|
+
indicatorMotion?: "slide" | "stretch";
|
|
800
802
|
/**
|
|
801
803
|
* 组件尺寸;用于调整控件高度、字号和间距。
|
|
802
804
|
* @defaultValue "medium"
|
|
@@ -839,7 +841,7 @@ interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
|
839
841
|
onTabContextMenuClick?: (info: TabsContextMenuClickInfo) => void;
|
|
840
842
|
}
|
|
841
843
|
/** 选项卡组件;默认仅挂载首次激活的面板,切走后隐藏并保留,显式设置 destroyInactiveTabPane=true 可在切走后卸载。横向空间不足时,剩余标签收起到末尾的更多菜单,支持悬停或点击展开。设置确定高度或由父级弹性布局分配高度时,内容面板占满导航之外的剩余空间;未限定高度时按内容自然撑开。 */
|
|
842
|
-
declare function Tabs({ items, activeKey, defaultActiveKey, onChange, onAfterChange, deferContent, type, size, tabPosition, orientation, centered, tabBarTitle, tabBarExtraContent, contentGap, destroyInactiveTabPane, closable, onEdit, tabContextMenu, onTabContextMenuClick, className, ...props }: TabsProps): react.JSX.Element;
|
|
844
|
+
declare function Tabs({ items, activeKey, defaultActiveKey, onChange, onAfterChange, deferContent, type, indicatorMotion, size, tabPosition, orientation, centered, tabBarTitle, tabBarExtraContent, contentGap, destroyInactiveTabPane, closable, onEdit, tabContextMenu, onTabContextMenuClick, className, ...props }: TabsProps): react.JSX.Element;
|
|
843
845
|
|
|
844
846
|
/** 打开下拉菜单的触发方式。 */
|
|
845
847
|
type DropdownTrigger = "click" | "hover" | "contextMenu";
|
|
@@ -797,6 +797,8 @@ interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
|
797
797
|
* @defaultValue "line"
|
|
798
798
|
*/
|
|
799
799
|
type?: TabsType;
|
|
800
|
+
/** 选中指示器的切换动效:stretch 朝目标方向先拉长再收拢,slide 同步平移并调整尺寸。line、underline 默认 stretch,其余样式默认 slide;card、pill 无独立指示器,不受此项影响。stretch 时长 300ms,首次定位及系统减少动态效果时不播放;支持四个方向,连续切换从当前显示位置续接。 */
|
|
801
|
+
indicatorMotion?: "slide" | "stretch";
|
|
800
802
|
/**
|
|
801
803
|
* 组件尺寸;用于调整控件高度、字号和间距。
|
|
802
804
|
* @defaultValue "medium"
|
|
@@ -839,7 +841,7 @@ interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
|
839
841
|
onTabContextMenuClick?: (info: TabsContextMenuClickInfo) => void;
|
|
840
842
|
}
|
|
841
843
|
/** 选项卡组件;默认仅挂载首次激活的面板,切走后隐藏并保留,显式设置 destroyInactiveTabPane=true 可在切走后卸载。横向空间不足时,剩余标签收起到末尾的更多菜单,支持悬停或点击展开。设置确定高度或由父级弹性布局分配高度时,内容面板占满导航之外的剩余空间;未限定高度时按内容自然撑开。 */
|
|
842
|
-
declare function Tabs({ items, activeKey, defaultActiveKey, onChange, onAfterChange, deferContent, type, size, tabPosition, orientation, centered, tabBarTitle, tabBarExtraContent, contentGap, destroyInactiveTabPane, closable, onEdit, tabContextMenu, onTabContextMenuClick, className, ...props }: TabsProps): react.JSX.Element;
|
|
844
|
+
declare function Tabs({ items, activeKey, defaultActiveKey, onChange, onAfterChange, deferContent, type, indicatorMotion, size, tabPosition, orientation, centered, tabBarTitle, tabBarExtraContent, contentGap, destroyInactiveTabPane, closable, onEdit, tabContextMenu, onTabContextMenuClick, className, ...props }: TabsProps): react.JSX.Element;
|
|
843
845
|
|
|
844
846
|
/** 打开下拉菜单的触发方式。 */
|
|
845
847
|
type DropdownTrigger = "click" | "hover" | "contextMenu";
|
package/dist/core.cjs
CHANGED
|
@@ -2384,6 +2384,7 @@ function Tabs({
|
|
|
2384
2384
|
onAfterChange,
|
|
2385
2385
|
deferContent = false,
|
|
2386
2386
|
type = "line",
|
|
2387
|
+
indicatorMotion = type === "line" || type === "underline" ? "stretch" : "slide",
|
|
2387
2388
|
size = "medium",
|
|
2388
2389
|
tabPosition,
|
|
2389
2390
|
orientation = "horizontal",
|
|
@@ -2410,6 +2411,7 @@ function Tabs({
|
|
|
2410
2411
|
const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
|
|
2411
2412
|
const listRef = (0, import_react11.useRef)(null);
|
|
2412
2413
|
const indicatorRef = (0, import_react11.useRef)(null);
|
|
2414
|
+
const indicatorTargetRef = (0, import_react11.useRef)();
|
|
2413
2415
|
const moreRef = (0, import_react11.useRef)(null);
|
|
2414
2416
|
const [overflow, setOverflow] = (0, import_react11.useState)({ count: items.length, width: 0 });
|
|
2415
2417
|
const [moreOpen, setMoreOpen] = (0, import_react11.useState)(false);
|
|
@@ -2462,13 +2464,21 @@ function Tabs({
|
|
|
2462
2464
|
if (!list || !indicator) return;
|
|
2463
2465
|
const active = list.querySelector('[role="tab"][aria-selected="true"]');
|
|
2464
2466
|
if (!active || active.closest('[data-tab-hidden="true"]')) {
|
|
2467
|
+
indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
2465
2468
|
indicator.style.visibility = "hidden";
|
|
2469
|
+
indicatorTargetRef.current = void 0;
|
|
2466
2470
|
return;
|
|
2467
2471
|
}
|
|
2468
2472
|
const listRect = list.getBoundingClientRect();
|
|
2469
2473
|
const rect = active.getBoundingClientRect();
|
|
2470
|
-
const
|
|
2471
|
-
|
|
2474
|
+
const x = rect.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
2475
|
+
const y = rect.top - listRect.top - list.clientTop + list.scrollTop;
|
|
2476
|
+
const previous = indicatorTargetRef.current;
|
|
2477
|
+
const sameTarget = previous?.node === indicator && previous.key === selectedKey && previous.position === resolvedPosition && Math.abs(previous.x - x) < 0.5 && Math.abs(previous.y - y) < 0.5 && Math.abs(previous.width - rect.width) < 0.5 && Math.abs(previous.height - rect.height) < 0.5;
|
|
2478
|
+
if (indicatorMotion === "stretch" && sameTarget) return;
|
|
2479
|
+
const current = indicator.getBoundingClientRect();
|
|
2480
|
+
if (indicatorMotion === "stretch") indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
2481
|
+
indicator.style.transform = `translate(${x}px, ${y}px)`;
|
|
2472
2482
|
indicator.style.width = `${rect.width}px`;
|
|
2473
2483
|
indicator.style.height = `${rect.height}px`;
|
|
2474
2484
|
indicator.style.visibility = "visible";
|
|
@@ -2476,13 +2486,34 @@ function Tabs({
|
|
|
2476
2486
|
indicator.getBoundingClientRect();
|
|
2477
2487
|
indicator.dataset.ready = "true";
|
|
2478
2488
|
}
|
|
2489
|
+
if (indicatorMotion === "stretch" && previous?.node === indicator && previous.key !== selectedKey && previous.position === resolvedPosition && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
2490
|
+
const fromX = current.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
2491
|
+
const fromY = current.top - listRect.top - list.clientTop + list.scrollTop;
|
|
2492
|
+
const vertical = resolvedOrientation === "vertical";
|
|
2493
|
+
const start = vertical ? Math.min(fromY, y) : Math.min(fromX, x);
|
|
2494
|
+
const end = vertical ? Math.max(fromY + current.height, y + rect.height) : Math.max(fromX + current.width, x + rect.width);
|
|
2495
|
+
indicator.animate([
|
|
2496
|
+
{ transform: `translate(${fromX}px, ${fromY}px)`, width: `${current.width}px`, height: `${current.height}px`, offset: 0 },
|
|
2497
|
+
{ transform: `translate(${vertical ? x : start}px, ${vertical ? start : y}px)`, width: `${vertical ? rect.width : end - start}px`, height: `${vertical ? end - start : rect.height}px`, offset: 0.45 },
|
|
2498
|
+
{ transform: `translate(${x}px, ${y}px)`, width: `${rect.width}px`, height: `${rect.height}px`, offset: 1 }
|
|
2499
|
+
], { duration: 300, easing: "cubic-bezier(.4, 0, .2, 1)" });
|
|
2500
|
+
}
|
|
2501
|
+
indicatorTargetRef.current = { node: indicator, key: selectedKey, position: resolvedPosition, x, y, width: rect.width, height: rect.height };
|
|
2479
2502
|
}
|
|
2480
2503
|
updateIndicator();
|
|
2481
2504
|
const observer = new ResizeObserver(updateIndicator);
|
|
2482
2505
|
observer.observe(list);
|
|
2483
2506
|
list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
|
|
2484
|
-
|
|
2485
|
-
|
|
2507
|
+
const motionPreference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2508
|
+
const stopMotion = () => {
|
|
2509
|
+
if (motionPreference.matches) indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
2510
|
+
};
|
|
2511
|
+
motionPreference.addEventListener("change", stopMotion);
|
|
2512
|
+
return () => {
|
|
2513
|
+
observer.disconnect();
|
|
2514
|
+
motionPreference.removeEventListener("change", stopMotion);
|
|
2515
|
+
};
|
|
2516
|
+
}, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount, indicatorMotion]);
|
|
2486
2517
|
(0, import_react11.useEffect)(() => {
|
|
2487
2518
|
let cancelled = false;
|
|
2488
2519
|
let frame = 0;
|
|
@@ -2507,7 +2538,7 @@ function Tabs({
|
|
|
2507
2538
|
cancelled = true;
|
|
2508
2539
|
cancelAnimationFrame(frame);
|
|
2509
2540
|
};
|
|
2510
|
-
}, [selectedKey, type, deferContent]);
|
|
2541
|
+
}, [selectedKey, type, deferContent, indicatorMotion]);
|
|
2511
2542
|
const contentKey = deferContent && items.some((item) => item.key === settledContentKey) ? settledContentKey : selectedKey;
|
|
2512
2543
|
(0, import_react11.useLayoutEffect)(() => {
|
|
2513
2544
|
if (deferContent && contentKey !== settledContentKey) setSettledContentKey(contentKey);
|
|
@@ -2551,7 +2582,7 @@ function Tabs({
|
|
|
2551
2582
|
type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { className: "sia-tabs__title-connector", viewBox: "0 0 32 40", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M0 39.25 H5 Q8 39.25 10 35.25 L28 3.75 Q29 1.75 32 1.75", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinejoin: "round" }) }) : null
|
|
2552
2583
|
] }) : null,
|
|
2553
2584
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { ref: listRef, style: resolvedOrientation === "horizontal" && overflow.width ? { width: overflow.width } : void 0, className: `sia-tabs__list${sliding ? " sia-tabs__list--sliding" : ""}`, role: "tablist", "aria-orientation": resolvedOrientation, children: [
|
|
2554
|
-
sliding ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { ref: indicatorRef, className: `sia-tabs__indicator${type === "capsule" ? " sia-tabs__capsule-indicator" : ""}`, "aria-hidden": "true", children: type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sia-tabs__indicator-shape", "aria-hidden": "true" }) : null }, type) : null,
|
|
2585
|
+
sliding ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { ref: indicatorRef, className: `sia-tabs__indicator${indicatorMotion === "stretch" ? " sia-tabs__indicator--stretch" : ""}${type === "capsule" ? " sia-tabs__capsule-indicator" : ""}`, "aria-hidden": "true", children: type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sia-tabs__indicator-shape", "aria-hidden": "true" }) : null }, `${type}-${indicatorMotion}`) : null,
|
|
2555
2586
|
items.map((item, index) => {
|
|
2556
2587
|
const selected = item.key === selectedKey;
|
|
2557
2588
|
const canClose = item.closable ?? closable;
|
package/dist/core.css
CHANGED
|
@@ -5053,6 +5053,9 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
5053
5053
|
width 180ms cubic-bezier(.4, 0, .2, 1),
|
|
5054
5054
|
height 180ms cubic-bezier(.4, 0, .2, 1);
|
|
5055
5055
|
}
|
|
5056
|
+
.sia-tabs > .sia-tabs__header .sia-tabs__indicator--stretch[data-ready=true] {
|
|
5057
|
+
transition: none;
|
|
5058
|
+
}
|
|
5056
5059
|
.sia-tabs--line > .sia-tabs__header .sia-tabs__tab[aria-selected=true]::after {
|
|
5057
5060
|
display: none;
|
|
5058
5061
|
}
|
|
@@ -8121,10 +8124,20 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
8121
8124
|
font-size: 12px;
|
|
8122
8125
|
line-height: 1.45;
|
|
8123
8126
|
}
|
|
8127
|
+
.sia-floating__overlay.sia-form-item__error-popover {
|
|
8128
|
+
opacity: 1;
|
|
8129
|
+
animation: none;
|
|
8130
|
+
transition: opacity 160ms ease;
|
|
8131
|
+
}
|
|
8124
8132
|
.sia-floating__overlay.sia-form-item__error-popover--obscured {
|
|
8125
8133
|
opacity: 0;
|
|
8126
8134
|
animation: none;
|
|
8127
8135
|
}
|
|
8136
|
+
@media (prefers-reduced-motion: reduce) {
|
|
8137
|
+
.sia-floating__overlay.sia-form-item__error-popover {
|
|
8138
|
+
transition: none;
|
|
8139
|
+
}
|
|
8140
|
+
}
|
|
8128
8141
|
.sia-form-item__error-content {
|
|
8129
8142
|
display: flex;
|
|
8130
8143
|
align-items: center;
|
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, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-
|
|
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, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-CwcgYFnO.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-Y0e9kaxE.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, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-
|
|
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, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-Cmeyc0TI.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-DeD4O8FL.js';
|
|
4
4
|
import 'react';
|
package/dist/core.js
CHANGED
package/dist/game.css
CHANGED
|
@@ -5062,6 +5062,9 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
5062
5062
|
width 180ms cubic-bezier(.4, 0, .2, 1),
|
|
5063
5063
|
height 180ms cubic-bezier(.4, 0, .2, 1);
|
|
5064
5064
|
}
|
|
5065
|
+
.sia-tabs > .sia-tabs__header .sia-tabs__indicator--stretch[data-ready=true] {
|
|
5066
|
+
transition: none;
|
|
5067
|
+
}
|
|
5065
5068
|
.sia-tabs--line > .sia-tabs__header .sia-tabs__tab[aria-selected=true]::after {
|
|
5066
5069
|
display: none;
|
|
5067
5070
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -7672,6 +7672,8 @@ function FormItem({
|
|
|
7672
7672
|
const itemRef = (0, import_react34.useRef)(null);
|
|
7673
7673
|
const errorContentRef = (0, import_react34.useRef)(null);
|
|
7674
7674
|
const [errorObscured, setErrorObscured] = (0, import_react34.useState)(false);
|
|
7675
|
+
const [errorPreview, setErrorPreview] = (0, import_react34.useState)(false);
|
|
7676
|
+
const [errorHovered, setErrorHovered] = (0, import_react34.useState)(false);
|
|
7675
7677
|
if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
|
|
7676
7678
|
(0, import_react34.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
|
|
7677
7679
|
const path = name === void 0 ? void 0 : pathArray(name);
|
|
@@ -7683,6 +7685,13 @@ function FormItem({
|
|
|
7683
7685
|
const labelId = label && !noStyle ? `${id}-label` : void 0;
|
|
7684
7686
|
const errorId = `${id}-error`;
|
|
7685
7687
|
const hasError = status === "error" && Boolean(helpContent);
|
|
7688
|
+
const errorVersion = errors.length ? errors : void 0;
|
|
7689
|
+
(0, import_react34.useEffect)(() => {
|
|
7690
|
+
setErrorPreview(hasError && !noStyle);
|
|
7691
|
+
if (!hasError || noStyle) return;
|
|
7692
|
+
const timer = window.setTimeout(() => setErrorPreview(false), 2e3);
|
|
7693
|
+
return () => window.clearTimeout(timer);
|
|
7694
|
+
}, [hasError, noStyle, errorVersion, helpContent]);
|
|
7686
7695
|
(0, import_react34.useEffect)(() => {
|
|
7687
7696
|
setErrorObscured(false);
|
|
7688
7697
|
if (!hasError || noStyle) return void 0;
|
|
@@ -7779,7 +7788,7 @@ function FormItem({
|
|
|
7779
7788
|
}
|
|
7780
7789
|
}
|
|
7781
7790
|
if (noStyle) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: content });
|
|
7782
|
-
const inputWrap = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "sia-form-item__input-wrap", children: content });
|
|
7791
|
+
const inputWrap = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "sia-form-item__input-wrap", onMouseEnter: () => setErrorHovered(true), onMouseLeave: () => setErrorHovered(false), children: content });
|
|
7783
7792
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
|
|
7784
7793
|
label ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "sia-form-item__label-content", children: [
|
|
7785
7794
|
ruleRequired ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
|
|
@@ -7798,7 +7807,7 @@ function FormItem({
|
|
|
7798
7807
|
open: hasError,
|
|
7799
7808
|
role: "alert",
|
|
7800
7809
|
color: "var(--sia-color-error)",
|
|
7801
|
-
overlayClassName: `sia-form-item__error-popover${errorObscured ? " sia-form-item__error-popover--obscured" : ""}`,
|
|
7810
|
+
overlayClassName: `sia-form-item__error-popover${errorObscured || !errorPreview && !errorHovered ? " sia-form-item__error-popover--obscured" : ""}`,
|
|
7802
7811
|
children: inputWrap
|
|
7803
7812
|
}
|
|
7804
7813
|
),
|
|
@@ -12716,6 +12725,7 @@ function Tabs({
|
|
|
12716
12725
|
onAfterChange,
|
|
12717
12726
|
deferContent = false,
|
|
12718
12727
|
type = "line",
|
|
12728
|
+
indicatorMotion = type === "line" || type === "underline" ? "stretch" : "slide",
|
|
12719
12729
|
size = "medium",
|
|
12720
12730
|
tabPosition,
|
|
12721
12731
|
orientation = "horizontal",
|
|
@@ -12742,6 +12752,7 @@ function Tabs({
|
|
|
12742
12752
|
const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
|
|
12743
12753
|
const listRef = (0, import_react49.useRef)(null);
|
|
12744
12754
|
const indicatorRef = (0, import_react49.useRef)(null);
|
|
12755
|
+
const indicatorTargetRef = (0, import_react49.useRef)();
|
|
12745
12756
|
const moreRef = (0, import_react49.useRef)(null);
|
|
12746
12757
|
const [overflow, setOverflow] = (0, import_react49.useState)({ count: items.length, width: 0 });
|
|
12747
12758
|
const [moreOpen, setMoreOpen] = (0, import_react49.useState)(false);
|
|
@@ -12794,13 +12805,21 @@ function Tabs({
|
|
|
12794
12805
|
if (!list || !indicator) return;
|
|
12795
12806
|
const active = list.querySelector('[role="tab"][aria-selected="true"]');
|
|
12796
12807
|
if (!active || active.closest('[data-tab-hidden="true"]')) {
|
|
12808
|
+
indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
12797
12809
|
indicator.style.visibility = "hidden";
|
|
12810
|
+
indicatorTargetRef.current = void 0;
|
|
12798
12811
|
return;
|
|
12799
12812
|
}
|
|
12800
12813
|
const listRect = list.getBoundingClientRect();
|
|
12801
12814
|
const rect = active.getBoundingClientRect();
|
|
12802
|
-
const
|
|
12803
|
-
|
|
12815
|
+
const x = rect.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
12816
|
+
const y = rect.top - listRect.top - list.clientTop + list.scrollTop;
|
|
12817
|
+
const previous = indicatorTargetRef.current;
|
|
12818
|
+
const sameTarget = previous?.node === indicator && previous.key === selectedKey && previous.position === resolvedPosition && Math.abs(previous.x - x) < 0.5 && Math.abs(previous.y - y) < 0.5 && Math.abs(previous.width - rect.width) < 0.5 && Math.abs(previous.height - rect.height) < 0.5;
|
|
12819
|
+
if (indicatorMotion === "stretch" && sameTarget) return;
|
|
12820
|
+
const current = indicator.getBoundingClientRect();
|
|
12821
|
+
if (indicatorMotion === "stretch") indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
12822
|
+
indicator.style.transform = `translate(${x}px, ${y}px)`;
|
|
12804
12823
|
indicator.style.width = `${rect.width}px`;
|
|
12805
12824
|
indicator.style.height = `${rect.height}px`;
|
|
12806
12825
|
indicator.style.visibility = "visible";
|
|
@@ -12808,13 +12827,34 @@ function Tabs({
|
|
|
12808
12827
|
indicator.getBoundingClientRect();
|
|
12809
12828
|
indicator.dataset.ready = "true";
|
|
12810
12829
|
}
|
|
12830
|
+
if (indicatorMotion === "stretch" && previous?.node === indicator && previous.key !== selectedKey && previous.position === resolvedPosition && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
12831
|
+
const fromX = current.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
12832
|
+
const fromY = current.top - listRect.top - list.clientTop + list.scrollTop;
|
|
12833
|
+
const vertical = resolvedOrientation === "vertical";
|
|
12834
|
+
const start = vertical ? Math.min(fromY, y) : Math.min(fromX, x);
|
|
12835
|
+
const end = vertical ? Math.max(fromY + current.height, y + rect.height) : Math.max(fromX + current.width, x + rect.width);
|
|
12836
|
+
indicator.animate([
|
|
12837
|
+
{ transform: `translate(${fromX}px, ${fromY}px)`, width: `${current.width}px`, height: `${current.height}px`, offset: 0 },
|
|
12838
|
+
{ transform: `translate(${vertical ? x : start}px, ${vertical ? start : y}px)`, width: `${vertical ? rect.width : end - start}px`, height: `${vertical ? end - start : rect.height}px`, offset: 0.45 },
|
|
12839
|
+
{ transform: `translate(${x}px, ${y}px)`, width: `${rect.width}px`, height: `${rect.height}px`, offset: 1 }
|
|
12840
|
+
], { duration: 300, easing: "cubic-bezier(.4, 0, .2, 1)" });
|
|
12841
|
+
}
|
|
12842
|
+
indicatorTargetRef.current = { node: indicator, key: selectedKey, position: resolvedPosition, x, y, width: rect.width, height: rect.height };
|
|
12811
12843
|
}
|
|
12812
12844
|
updateIndicator();
|
|
12813
12845
|
const observer = new ResizeObserver(updateIndicator);
|
|
12814
12846
|
observer.observe(list);
|
|
12815
12847
|
list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
|
|
12816
|
-
|
|
12817
|
-
|
|
12848
|
+
const motionPreference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
12849
|
+
const stopMotion = () => {
|
|
12850
|
+
if (motionPreference.matches) indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
12851
|
+
};
|
|
12852
|
+
motionPreference.addEventListener("change", stopMotion);
|
|
12853
|
+
return () => {
|
|
12854
|
+
observer.disconnect();
|
|
12855
|
+
motionPreference.removeEventListener("change", stopMotion);
|
|
12856
|
+
};
|
|
12857
|
+
}, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount, indicatorMotion]);
|
|
12818
12858
|
(0, import_react49.useEffect)(() => {
|
|
12819
12859
|
let cancelled = false;
|
|
12820
12860
|
let frame = 0;
|
|
@@ -12839,7 +12879,7 @@ function Tabs({
|
|
|
12839
12879
|
cancelled = true;
|
|
12840
12880
|
cancelAnimationFrame(frame);
|
|
12841
12881
|
};
|
|
12842
|
-
}, [selectedKey, type, deferContent]);
|
|
12882
|
+
}, [selectedKey, type, deferContent, indicatorMotion]);
|
|
12843
12883
|
const contentKey = deferContent && items.some((item) => item.key === settledContentKey) ? settledContentKey : selectedKey;
|
|
12844
12884
|
(0, import_react49.useLayoutEffect)(() => {
|
|
12845
12885
|
if (deferContent && contentKey !== settledContentKey) setSettledContentKey(contentKey);
|
|
@@ -12883,7 +12923,7 @@ function Tabs({
|
|
|
12883
12923
|
type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("svg", { className: "sia-tabs__title-connector", viewBox: "0 0 32 40", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "M0 39.25 H5 Q8 39.25 10 35.25 L28 3.75 Q29 1.75 32 1.75", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinejoin: "round" }) }) : null
|
|
12884
12924
|
] }) : null,
|
|
12885
12925
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { ref: listRef, style: resolvedOrientation === "horizontal" && overflow.width ? { width: overflow.width } : void 0, className: `sia-tabs__list${sliding ? " sia-tabs__list--sliding" : ""}`, role: "tablist", "aria-orientation": resolvedOrientation, children: [
|
|
12886
|
-
sliding ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { ref: indicatorRef, className: `sia-tabs__indicator${type === "capsule" ? " sia-tabs__capsule-indicator" : ""}`, "aria-hidden": "true", children: type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "sia-tabs__indicator-shape", "aria-hidden": "true" }) : null }, type) : null,
|
|
12926
|
+
sliding ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { ref: indicatorRef, className: `sia-tabs__indicator${indicatorMotion === "stretch" ? " sia-tabs__indicator--stretch" : ""}${type === "capsule" ? " sia-tabs__capsule-indicator" : ""}`, "aria-hidden": "true", children: type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "sia-tabs__indicator-shape", "aria-hidden": "true" }) : null }, `${type}-${indicatorMotion}`) : null,
|
|
12887
12927
|
items.map((item, index) => {
|
|
12888
12928
|
const selected = item.key === selectedKey;
|
|
12889
12929
|
const canClose = item.closable ?? closable;
|
package/dist/index.css
CHANGED
|
@@ -5053,6 +5053,9 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
5053
5053
|
width 180ms cubic-bezier(.4, 0, .2, 1),
|
|
5054
5054
|
height 180ms cubic-bezier(.4, 0, .2, 1);
|
|
5055
5055
|
}
|
|
5056
|
+
.sia-tabs > .sia-tabs__header .sia-tabs__indicator--stretch[data-ready=true] {
|
|
5057
|
+
transition: none;
|
|
5058
|
+
}
|
|
5056
5059
|
.sia-tabs--line > .sia-tabs__header .sia-tabs__tab[aria-selected=true]::after {
|
|
5057
5060
|
display: none;
|
|
5058
5061
|
}
|
|
@@ -8121,10 +8124,20 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
8121
8124
|
font-size: 12px;
|
|
8122
8125
|
line-height: 1.45;
|
|
8123
8126
|
}
|
|
8127
|
+
.sia-floating__overlay.sia-form-item__error-popover {
|
|
8128
|
+
opacity: 1;
|
|
8129
|
+
animation: none;
|
|
8130
|
+
transition: opacity 160ms ease;
|
|
8131
|
+
}
|
|
8124
8132
|
.sia-floating__overlay.sia-form-item__error-popover--obscured {
|
|
8125
8133
|
opacity: 0;
|
|
8126
8134
|
animation: none;
|
|
8127
8135
|
}
|
|
8136
|
+
@media (prefers-reduced-motion: reduce) {
|
|
8137
|
+
.sia-floating__overlay.sia-form-item__error-popover {
|
|
8138
|
+
transition: none;
|
|
8139
|
+
}
|
|
8140
|
+
}
|
|
8128
8141
|
.sia-form-item__error-content {
|
|
8129
8142
|
display: flex;
|
|
8130
8143
|
align-items: center;
|
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 ImagePreviewGroup, S as ImagePreviewGroupProps, U as ImagePreviewProps, V as ImageProps, W as Input, X as InputProps, Y as Menu, Z as MenuClickInfo, _ as MenuItem, $ as MenuMode, a0 as MenuProps, a1 as MenuTheme, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, a6 as NotificationConfig, a7 as NotificationPlacement, a8 as NotificationType, a9 as Popconfirm, aa as PopconfirmProps, ab as Popover, ac as PopoverProps, ad as Progress, ae as ProgressProps, af as ProgressStatus, ag as Rate, ah as RateProps, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, ap as Spin, aq as SpinProps, ar as StepItem, as as StepStatus, at as Steps, au as StepsProps, av as TabItem, aw as Tabs, ax as TabsContextMenuClickInfo, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, aF as TagVariant, aG as Timeline, aH as TimelineItem, aI as TimelineProps, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aM as Tooltip, aN as TooltipProps, aO as Tour, aP as TourProps, aQ as TourStep, aR as Tree, aS as TreeDropPosition, aT as TreeKey, aU as TreeNode, aV as TreeProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b4 as UploadHttpRequest, b5 as UploadItemActions, b6 as UploadProps, b7 as UploadRef, b8 as UploadRejectInfo, b9 as UploadRequestHandle, ba as UploadRequestOptions, bb as Watermark, bc as WatermarkFont, bd as WatermarkProps, be as message, bf as notification } from './core-
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-CwcgYFnO.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 ImagePreviewGroup, S as ImagePreviewGroupProps, U as ImagePreviewProps, V as ImageProps, W as Input, X as InputProps, Y as Menu, Z as MenuClickInfo, _ as MenuItem, $ as MenuMode, a0 as MenuProps, a1 as MenuTheme, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, a6 as NotificationConfig, a7 as NotificationPlacement, a8 as NotificationType, a9 as Popconfirm, aa as PopconfirmProps, ab as Popover, ac as PopoverProps, ad as Progress, ae as ProgressProps, af as ProgressStatus, ag as Rate, ah as RateProps, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, ap as Spin, aq as SpinProps, ar as StepItem, as as StepStatus, at as Steps, au as StepsProps, av as TabItem, aw as Tabs, ax as TabsContextMenuClickInfo, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, aF as TagVariant, aG as Timeline, aH as TimelineItem, aI as TimelineProps, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aM as Tooltip, aN as TooltipProps, aO as Tour, aP as TourProps, aQ as TourStep, aR as Tree, aS as TreeDropPosition, aT as TreeKey, aU as TreeNode, aV as TreeProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b4 as UploadHttpRequest, b5 as UploadItemActions, b6 as UploadProps, b7 as UploadRef, b8 as UploadRejectInfo, b9 as UploadRequestHandle, ba as UploadRequestOptions, bb as Watermark, bc as WatermarkFont, bd as WatermarkProps, be as message, bf as notification } from './core-CwcgYFnO.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';
|
|
@@ -887,7 +887,7 @@ interface FormItemProps {
|
|
|
887
887
|
required?: boolean;
|
|
888
888
|
/** 主体之外的补充内容或操作区。 */
|
|
889
889
|
extra?: ReactNode;
|
|
890
|
-
/**
|
|
890
|
+
/** 字段下方的辅助说明或校验提示;错误气泡在校验失败或设置错误后显示 2 秒并渐隐,之后悬停控件时显示、移开时渐隐。再次校验失败会重新计时;手动错误状态或提示变化时也重新提示。保留错误边框、错误文本及无障碍关联;气泡遮挡其他控件时仍暂时避让。 */
|
|
891
891
|
help?: ReactNode;
|
|
892
892
|
/** 手动指定字段校验状态。 */
|
|
893
893
|
validateStatus?: "success" | "warning" | "error" | "validating";
|
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 ImagePreviewGroup, S as ImagePreviewGroupProps, U as ImagePreviewProps, V as ImageProps, W as Input, X as InputProps, Y as Menu, Z as MenuClickInfo, _ as MenuItem, $ as MenuMode, a0 as MenuProps, a1 as MenuTheme, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, a6 as NotificationConfig, a7 as NotificationPlacement, a8 as NotificationType, a9 as Popconfirm, aa as PopconfirmProps, ab as Popover, ac as PopoverProps, ad as Progress, ae as ProgressProps, af as ProgressStatus, ag as Rate, ah as RateProps, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, ap as Spin, aq as SpinProps, ar as StepItem, as as StepStatus, at as Steps, au as StepsProps, av as TabItem, aw as Tabs, ax as TabsContextMenuClickInfo, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, aF as TagVariant, aG as Timeline, aH as TimelineItem, aI as TimelineProps, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aM as Tooltip, aN as TooltipProps, aO as Tour, aP as TourProps, aQ as TourStep, aR as Tree, aS as TreeDropPosition, aT as TreeKey, aU as TreeNode, aV as TreeProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b4 as UploadHttpRequest, b5 as UploadItemActions, b6 as UploadProps, b7 as UploadRef, b8 as UploadRejectInfo, b9 as UploadRequestHandle, ba as UploadRequestOptions, bb as Watermark, bc as WatermarkFont, bd as WatermarkProps, be as message, bf as notification } from './core-
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-Cmeyc0TI.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 ImagePreviewGroup, S as ImagePreviewGroupProps, U as ImagePreviewProps, V as ImageProps, W as Input, X as InputProps, Y as Menu, Z as MenuClickInfo, _ as MenuItem, $ as MenuMode, a0 as MenuProps, a1 as MenuTheme, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, a6 as NotificationConfig, a7 as NotificationPlacement, a8 as NotificationType, a9 as Popconfirm, aa as PopconfirmProps, ab as Popover, ac as PopoverProps, ad as Progress, ae as ProgressProps, af as ProgressStatus, ag as Rate, ah as RateProps, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, ap as Spin, aq as SpinProps, ar as StepItem, as as StepStatus, at as Steps, au as StepsProps, av as TabItem, aw as Tabs, ax as TabsContextMenuClickInfo, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, aF as TagVariant, aG as Timeline, aH as TimelineItem, aI as TimelineProps, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aM as Tooltip, aN as TooltipProps, aO as Tour, aP as TourProps, aQ as TourStep, aR as Tree, aS as TreeDropPosition, aT as TreeKey, aU as TreeNode, aV as TreeProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b4 as UploadHttpRequest, b5 as UploadItemActions, b6 as UploadProps, b7 as UploadRef, b8 as UploadRejectInfo, b9 as UploadRequestHandle, ba as UploadRequestOptions, bb as Watermark, bc as WatermarkFont, bd as WatermarkProps, be as message, bf as notification } from './core-Cmeyc0TI.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';
|
|
@@ -887,7 +887,7 @@ interface FormItemProps {
|
|
|
887
887
|
required?: boolean;
|
|
888
888
|
/** 主体之外的补充内容或操作区。 */
|
|
889
889
|
extra?: ReactNode;
|
|
890
|
-
/**
|
|
890
|
+
/** 字段下方的辅助说明或校验提示;错误气泡在校验失败或设置错误后显示 2 秒并渐隐,之后悬停控件时显示、移开时渐隐。再次校验失败会重新计时;手动错误状态或提示变化时也重新提示。保留错误边框、错误文本及无障碍关联;气泡遮挡其他控件时仍暂时避让。 */
|
|
891
891
|
help?: ReactNode;
|
|
892
892
|
/** 手动指定字段校验状态。 */
|
|
893
893
|
validateStatus?: "success" | "warning" | "error" | "validating";
|
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
Watermark,
|
|
83
83
|
message,
|
|
84
84
|
notification
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-AL46WYJF.js";
|
|
86
86
|
import "./chunk-RX242MUO.js";
|
|
87
87
|
import {
|
|
88
88
|
MarkdownEditor
|
|
@@ -2061,6 +2061,8 @@ function FormItem({
|
|
|
2061
2061
|
const itemRef = useRef8(null);
|
|
2062
2062
|
const errorContentRef = useRef8(null);
|
|
2063
2063
|
const [errorObscured, setErrorObscured] = useState9(false);
|
|
2064
|
+
const [errorPreview, setErrorPreview] = useState9(false);
|
|
2065
|
+
const [errorHovered, setErrorHovered] = useState9(false);
|
|
2064
2066
|
if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
|
|
2065
2067
|
useSyncExternalStore(form.subscribe, form.getSnapshot, form.getSnapshot);
|
|
2066
2068
|
const path = name === void 0 ? void 0 : pathArray(name);
|
|
@@ -2072,6 +2074,13 @@ function FormItem({
|
|
|
2072
2074
|
const labelId = label && !noStyle ? `${id}-label` : void 0;
|
|
2073
2075
|
const errorId = `${id}-error`;
|
|
2074
2076
|
const hasError = status === "error" && Boolean(helpContent);
|
|
2077
|
+
const errorVersion = errors.length ? errors : void 0;
|
|
2078
|
+
useEffect6(() => {
|
|
2079
|
+
setErrorPreview(hasError && !noStyle);
|
|
2080
|
+
if (!hasError || noStyle) return;
|
|
2081
|
+
const timer = window.setTimeout(() => setErrorPreview(false), 2e3);
|
|
2082
|
+
return () => window.clearTimeout(timer);
|
|
2083
|
+
}, [hasError, noStyle, errorVersion, helpContent]);
|
|
2075
2084
|
useEffect6(() => {
|
|
2076
2085
|
setErrorObscured(false);
|
|
2077
2086
|
if (!hasError || noStyle) return void 0;
|
|
@@ -2168,7 +2177,7 @@ function FormItem({
|
|
|
2168
2177
|
}
|
|
2169
2178
|
}
|
|
2170
2179
|
if (noStyle) return /* @__PURE__ */ jsx11(Fragment4, { children: content });
|
|
2171
|
-
const inputWrap = /* @__PURE__ */ jsx11("div", { className: "sia-form-item__input-wrap", children: content });
|
|
2180
|
+
const inputWrap = /* @__PURE__ */ jsx11("div", { className: "sia-form-item__input-wrap", onMouseEnter: () => setErrorHovered(true), onMouseLeave: () => setErrorHovered(false), children: content });
|
|
2172
2181
|
return /* @__PURE__ */ jsxs11("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
|
|
2173
2182
|
label ? /* @__PURE__ */ jsx11("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsxs11("span", { className: "sia-form-item__label-content", children: [
|
|
2174
2183
|
ruleRequired ? /* @__PURE__ */ jsx11("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
|
|
@@ -2187,7 +2196,7 @@ function FormItem({
|
|
|
2187
2196
|
open: hasError,
|
|
2188
2197
|
role: "alert",
|
|
2189
2198
|
color: "var(--sia-color-error)",
|
|
2190
|
-
overlayClassName: `sia-form-item__error-popover${errorObscured ? " sia-form-item__error-popover--obscured" : ""}`,
|
|
2199
|
+
overlayClassName: `sia-form-item__error-popover${errorObscured || !errorPreview && !errorHovered ? " sia-form-item__error-popover--obscured" : ""}`,
|
|
2191
2200
|
children: inputWrap
|
|
2192
2201
|
}
|
|
2193
2202
|
),
|