@sia.soul/sia-react-ui 0.1.138 → 0.1.141
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-DIRPOUVX.js} +45 -8
- package/dist/{core-lZIzt-an.d.cts → core-DYo5C4Si.d.cts} +7 -3
- package/dist/{core-Bkk7-59o.d.ts → core-sWwvVAmP.d.ts} +7 -3
- package/dist/core.cjs +45 -8
- package/dist/core.css +65 -17
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/game.css +55 -17
- package/dist/index.cjs +56 -10
- package/dist/index.css +65 -17
- 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,8 @@ function Tabs({
|
|
|
255
255
|
onAfterChange,
|
|
256
256
|
deferContent = false,
|
|
257
257
|
type = "line",
|
|
258
|
+
indicatorMotion = type === "line" || type === "underline" || type === "rounded" ? "stretch" : "slide",
|
|
259
|
+
indicatorPosition,
|
|
258
260
|
size = "medium",
|
|
259
261
|
tabPosition,
|
|
260
262
|
orientation = "horizontal",
|
|
@@ -278,9 +280,12 @@ function Tabs({
|
|
|
278
280
|
const enabledItems = useMemo(() => items.filter((item) => !item.disabled), [items]);
|
|
279
281
|
const resolvedPosition = tabPosition ?? (orientation === "vertical" ? "left" : "top");
|
|
280
282
|
const resolvedOrientation = resolvedPosition === "left" || resolvedPosition === "right" ? "vertical" : "horizontal";
|
|
281
|
-
const
|
|
283
|
+
const defaultIndicatorPosition = { top: "bottom", bottom: "top", left: "right", right: "left" }[resolvedPosition];
|
|
284
|
+
const resolvedIndicatorPosition = indicatorPosition && (resolvedOrientation === "vertical" ? ["left", "right"] : ["top", "bottom"]).includes(indicatorPosition) ? indicatorPosition : defaultIndicatorPosition;
|
|
285
|
+
const sliding = ["capsule", "line", "underline", "rounded", "tech", "tech-line"].includes(type);
|
|
282
286
|
const listRef = useRef2(null);
|
|
283
287
|
const indicatorRef = useRef2(null);
|
|
288
|
+
const indicatorTargetRef = useRef2();
|
|
284
289
|
const moreRef = useRef2(null);
|
|
285
290
|
const [overflow, setOverflow] = useState3({ count: items.length, width: 0 });
|
|
286
291
|
const [moreOpen, setMoreOpen] = useState3(false);
|
|
@@ -333,13 +338,25 @@ function Tabs({
|
|
|
333
338
|
if (!list || !indicator) return;
|
|
334
339
|
const active = list.querySelector('[role="tab"][aria-selected="true"]');
|
|
335
340
|
if (!active || active.closest('[data-tab-hidden="true"]')) {
|
|
341
|
+
indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
336
342
|
indicator.style.visibility = "hidden";
|
|
343
|
+
indicatorTargetRef.current = void 0;
|
|
337
344
|
return;
|
|
338
345
|
}
|
|
339
346
|
const listRect = list.getBoundingClientRect();
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
|
|
347
|
+
const tabRect = active.getBoundingClientRect();
|
|
348
|
+
const vertical = resolvedOrientation === "vertical";
|
|
349
|
+
const width = type === "rounded" && !vertical ? Math.min(24, tabRect.width) : tabRect.width;
|
|
350
|
+
const height = type === "rounded" && vertical ? Math.min(16, tabRect.height) : tabRect.height;
|
|
351
|
+
const rect = { left: tabRect.left + (tabRect.width - width) / 2, top: tabRect.top + (tabRect.height - height) / 2, width, height };
|
|
352
|
+
const x = rect.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
353
|
+
const y = rect.top - listRect.top - list.clientTop + list.scrollTop;
|
|
354
|
+
const previous = indicatorTargetRef.current;
|
|
355
|
+
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;
|
|
356
|
+
if (indicatorMotion === "stretch" && sameTarget) return;
|
|
357
|
+
const current = indicator.getBoundingClientRect();
|
|
358
|
+
if (indicatorMotion === "stretch") indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
359
|
+
indicator.style.transform = `translate(${x}px, ${y}px)`;
|
|
343
360
|
indicator.style.width = `${rect.width}px`;
|
|
344
361
|
indicator.style.height = `${rect.height}px`;
|
|
345
362
|
indicator.style.visibility = "visible";
|
|
@@ -347,13 +364,33 @@ function Tabs({
|
|
|
347
364
|
indicator.getBoundingClientRect();
|
|
348
365
|
indicator.dataset.ready = "true";
|
|
349
366
|
}
|
|
367
|
+
if (indicatorMotion === "stretch" && previous?.node === indicator && previous.key !== selectedKey && previous.position === resolvedPosition && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
368
|
+
const fromX = current.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
369
|
+
const fromY = current.top - listRect.top - list.clientTop + list.scrollTop;
|
|
370
|
+
const start = vertical ? Math.min(fromY, y) : Math.min(fromX, x);
|
|
371
|
+
const end = vertical ? Math.max(fromY + current.height, y + rect.height) : Math.max(fromX + current.width, x + rect.width);
|
|
372
|
+
indicator.animate([
|
|
373
|
+
{ transform: `translate(${fromX}px, ${fromY}px)`, width: `${current.width}px`, height: `${current.height}px`, offset: 0 },
|
|
374
|
+
{ 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 },
|
|
375
|
+
{ transform: `translate(${x}px, ${y}px)`, width: `${rect.width}px`, height: `${rect.height}px`, offset: 1 }
|
|
376
|
+
], { duration: 300, easing: "cubic-bezier(.4, 0, .2, 1)" });
|
|
377
|
+
}
|
|
378
|
+
indicatorTargetRef.current = { node: indicator, key: selectedKey, position: resolvedPosition, x, y, width: rect.width, height: rect.height };
|
|
350
379
|
}
|
|
351
380
|
updateIndicator();
|
|
352
381
|
const observer = new ResizeObserver(updateIndicator);
|
|
353
382
|
observer.observe(list);
|
|
354
383
|
list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
|
|
355
|
-
|
|
356
|
-
|
|
384
|
+
const motionPreference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
385
|
+
const stopMotion = () => {
|
|
386
|
+
if (motionPreference.matches) indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
387
|
+
};
|
|
388
|
+
motionPreference.addEventListener("change", stopMotion);
|
|
389
|
+
return () => {
|
|
390
|
+
observer.disconnect();
|
|
391
|
+
motionPreference.removeEventListener("change", stopMotion);
|
|
392
|
+
};
|
|
393
|
+
}, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount, indicatorMotion]);
|
|
357
394
|
useEffect(() => {
|
|
358
395
|
let cancelled = false;
|
|
359
396
|
let frame = 0;
|
|
@@ -378,7 +415,7 @@ function Tabs({
|
|
|
378
415
|
cancelled = true;
|
|
379
416
|
cancelAnimationFrame(frame);
|
|
380
417
|
};
|
|
381
|
-
}, [selectedKey, type, deferContent]);
|
|
418
|
+
}, [selectedKey, type, deferContent, indicatorMotion]);
|
|
382
419
|
const contentKey = deferContent && items.some((item) => item.key === settledContentKey) ? settledContentKey : selectedKey;
|
|
383
420
|
useLayoutEffect2(() => {
|
|
384
421
|
if (deferContent && contentKey !== settledContentKey) setSettledContentKey(contentKey);
|
|
@@ -422,7 +459,7 @@ function Tabs({
|
|
|
422
459
|
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
460
|
] }) : null,
|
|
424
461
|
/* @__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,
|
|
462
|
+
sliding ? /* @__PURE__ */ jsx4("span", { ref: indicatorRef, "data-indicator-position": resolvedIndicatorPosition, 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
463
|
items.map((item, index) => {
|
|
427
464
|
const selected = item.key === selectedKey;
|
|
428
465
|
const canClose = item.closable ?? closable;
|
|
@@ -766,7 +766,7 @@ interface TabItem {
|
|
|
766
766
|
closable?: boolean;
|
|
767
767
|
}
|
|
768
768
|
/** 选项卡的类型标识。 */
|
|
769
|
-
type TabsType = "line" | "card" | "pill" | "capsule" | "underline" | "tech" | "tech-line";
|
|
769
|
+
type TabsType = "line" | "card" | "pill" | "capsule" | "underline" | "rounded" | "tech" | "tech-line";
|
|
770
770
|
/** 选项卡沿水平方向或垂直方向排列。 */
|
|
771
771
|
type TabsOrientation = "horizontal" | "vertical";
|
|
772
772
|
/** 选项卡导航相对于内容区的位置。 */
|
|
@@ -793,10 +793,14 @@ interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
|
793
793
|
/** 是否等选中框动画结束后再切换 items[].children,等待期间保留旧面板。默认 false,立即切换;true 时未访问的目标面板在动画结束后首次挂载,连续切换跳过未显示的中间目标。面板是否保留由 destroyInactiveTabPane 决定,与是否延迟无关。不能延迟父组件已执行的同步计算或 onChange 中的渲染,请将外部重内容更新放到 onAfterChange。 */
|
|
794
794
|
deferContent?: boolean;
|
|
795
795
|
/**
|
|
796
|
-
* 标签样式:line 线型、card 卡片、pill 胶囊、capsule 圆角胶囊、underline 紧凑下划线、tech 科技型、tech-line 折线科技型。
|
|
796
|
+
* 标签样式:line 线型、card 卡片、pill 胶囊、capsule 圆角胶囊、underline 紧凑下划线、rounded 圆角矩形背景配短指示线、tech 科技型、tech-line 折线科技型。
|
|
797
797
|
* @defaultValue "line"
|
|
798
798
|
*/
|
|
799
799
|
type?: TabsType;
|
|
800
|
+
/** 选中指示器的切换动效:stretch 朝目标方向先拉长再收拢,slide 同步平移并调整尺寸。line、underline、rounded 默认 stretch,其余样式默认 slide;card、pill 无独立指示器,不受此项影响。stretch 时长 300ms,首次定位及系统减少动态效果时不播放;支持四个方向,连续切换从当前显示位置续接。 */
|
|
801
|
+
indicatorMotion?: "slide" | "stretch";
|
|
802
|
+
/** 指示线位于标签的哪一侧,仅适用于 line、underline、rounded。横向标签可选 top / bottom,纵向标签可选 left / right;未指定或传入与排列方向不符的值时,默认朝向内容区(顶部标签为 bottom、底部为 top、左侧为 right、右侧为 left)。只移动指示线,不改变标签栏位置或分隔线;动态修改立即生效,并保留切换动效。 */
|
|
803
|
+
indicatorPosition?: TabsPosition;
|
|
800
804
|
/**
|
|
801
805
|
* 组件尺寸;用于调整控件高度、字号和间距。
|
|
802
806
|
* @defaultValue "medium"
|
|
@@ -839,7 +843,7 @@ interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
|
839
843
|
onTabContextMenuClick?: (info: TabsContextMenuClickInfo) => void;
|
|
840
844
|
}
|
|
841
845
|
/** 选项卡组件;默认仅挂载首次激活的面板,切走后隐藏并保留,显式设置 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;
|
|
846
|
+
declare function Tabs({ items, activeKey, defaultActiveKey, onChange, onAfterChange, deferContent, type, indicatorMotion, indicatorPosition, size, tabPosition, orientation, centered, tabBarTitle, tabBarExtraContent, contentGap, destroyInactiveTabPane, closable, onEdit, tabContextMenu, onTabContextMenuClick, className, ...props }: TabsProps): react.JSX.Element;
|
|
843
847
|
|
|
844
848
|
/** 打开下拉菜单的触发方式。 */
|
|
845
849
|
type DropdownTrigger = "click" | "hover" | "contextMenu";
|
|
@@ -766,7 +766,7 @@ interface TabItem {
|
|
|
766
766
|
closable?: boolean;
|
|
767
767
|
}
|
|
768
768
|
/** 选项卡的类型标识。 */
|
|
769
|
-
type TabsType = "line" | "card" | "pill" | "capsule" | "underline" | "tech" | "tech-line";
|
|
769
|
+
type TabsType = "line" | "card" | "pill" | "capsule" | "underline" | "rounded" | "tech" | "tech-line";
|
|
770
770
|
/** 选项卡沿水平方向或垂直方向排列。 */
|
|
771
771
|
type TabsOrientation = "horizontal" | "vertical";
|
|
772
772
|
/** 选项卡导航相对于内容区的位置。 */
|
|
@@ -793,10 +793,14 @@ interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
|
793
793
|
/** 是否等选中框动画结束后再切换 items[].children,等待期间保留旧面板。默认 false,立即切换;true 时未访问的目标面板在动画结束后首次挂载,连续切换跳过未显示的中间目标。面板是否保留由 destroyInactiveTabPane 决定,与是否延迟无关。不能延迟父组件已执行的同步计算或 onChange 中的渲染,请将外部重内容更新放到 onAfterChange。 */
|
|
794
794
|
deferContent?: boolean;
|
|
795
795
|
/**
|
|
796
|
-
* 标签样式:line 线型、card 卡片、pill 胶囊、capsule 圆角胶囊、underline 紧凑下划线、tech 科技型、tech-line 折线科技型。
|
|
796
|
+
* 标签样式:line 线型、card 卡片、pill 胶囊、capsule 圆角胶囊、underline 紧凑下划线、rounded 圆角矩形背景配短指示线、tech 科技型、tech-line 折线科技型。
|
|
797
797
|
* @defaultValue "line"
|
|
798
798
|
*/
|
|
799
799
|
type?: TabsType;
|
|
800
|
+
/** 选中指示器的切换动效:stretch 朝目标方向先拉长再收拢,slide 同步平移并调整尺寸。line、underline、rounded 默认 stretch,其余样式默认 slide;card、pill 无独立指示器,不受此项影响。stretch 时长 300ms,首次定位及系统减少动态效果时不播放;支持四个方向,连续切换从当前显示位置续接。 */
|
|
801
|
+
indicatorMotion?: "slide" | "stretch";
|
|
802
|
+
/** 指示线位于标签的哪一侧,仅适用于 line、underline、rounded。横向标签可选 top / bottom,纵向标签可选 left / right;未指定或传入与排列方向不符的值时,默认朝向内容区(顶部标签为 bottom、底部为 top、左侧为 right、右侧为 left)。只移动指示线,不改变标签栏位置或分隔线;动态修改立即生效,并保留切换动效。 */
|
|
803
|
+
indicatorPosition?: TabsPosition;
|
|
800
804
|
/**
|
|
801
805
|
* 组件尺寸;用于调整控件高度、字号和间距。
|
|
802
806
|
* @defaultValue "medium"
|
|
@@ -839,7 +843,7 @@ interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
|
839
843
|
onTabContextMenuClick?: (info: TabsContextMenuClickInfo) => void;
|
|
840
844
|
}
|
|
841
845
|
/** 选项卡组件;默认仅挂载首次激活的面板,切走后隐藏并保留,显式设置 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;
|
|
846
|
+
declare function Tabs({ items, activeKey, defaultActiveKey, onChange, onAfterChange, deferContent, type, indicatorMotion, indicatorPosition, size, tabPosition, orientation, centered, tabBarTitle, tabBarExtraContent, contentGap, destroyInactiveTabPane, closable, onEdit, tabContextMenu, onTabContextMenuClick, className, ...props }: TabsProps): react.JSX.Element;
|
|
843
847
|
|
|
844
848
|
/** 打开下拉菜单的触发方式。 */
|
|
845
849
|
type DropdownTrigger = "click" | "hover" | "contextMenu";
|
package/dist/core.cjs
CHANGED
|
@@ -2384,6 +2384,8 @@ function Tabs({
|
|
|
2384
2384
|
onAfterChange,
|
|
2385
2385
|
deferContent = false,
|
|
2386
2386
|
type = "line",
|
|
2387
|
+
indicatorMotion = type === "line" || type === "underline" || type === "rounded" ? "stretch" : "slide",
|
|
2388
|
+
indicatorPosition,
|
|
2387
2389
|
size = "medium",
|
|
2388
2390
|
tabPosition,
|
|
2389
2391
|
orientation = "horizontal",
|
|
@@ -2407,9 +2409,12 @@ function Tabs({
|
|
|
2407
2409
|
const enabledItems = (0, import_react11.useMemo)(() => items.filter((item) => !item.disabled), [items]);
|
|
2408
2410
|
const resolvedPosition = tabPosition ?? (orientation === "vertical" ? "left" : "top");
|
|
2409
2411
|
const resolvedOrientation = resolvedPosition === "left" || resolvedPosition === "right" ? "vertical" : "horizontal";
|
|
2410
|
-
const
|
|
2412
|
+
const defaultIndicatorPosition = { top: "bottom", bottom: "top", left: "right", right: "left" }[resolvedPosition];
|
|
2413
|
+
const resolvedIndicatorPosition = indicatorPosition && (resolvedOrientation === "vertical" ? ["left", "right"] : ["top", "bottom"]).includes(indicatorPosition) ? indicatorPosition : defaultIndicatorPosition;
|
|
2414
|
+
const sliding = ["capsule", "line", "underline", "rounded", "tech", "tech-line"].includes(type);
|
|
2411
2415
|
const listRef = (0, import_react11.useRef)(null);
|
|
2412
2416
|
const indicatorRef = (0, import_react11.useRef)(null);
|
|
2417
|
+
const indicatorTargetRef = (0, import_react11.useRef)();
|
|
2413
2418
|
const moreRef = (0, import_react11.useRef)(null);
|
|
2414
2419
|
const [overflow, setOverflow] = (0, import_react11.useState)({ count: items.length, width: 0 });
|
|
2415
2420
|
const [moreOpen, setMoreOpen] = (0, import_react11.useState)(false);
|
|
@@ -2462,13 +2467,25 @@ function Tabs({
|
|
|
2462
2467
|
if (!list || !indicator) return;
|
|
2463
2468
|
const active = list.querySelector('[role="tab"][aria-selected="true"]');
|
|
2464
2469
|
if (!active || active.closest('[data-tab-hidden="true"]')) {
|
|
2470
|
+
indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
2465
2471
|
indicator.style.visibility = "hidden";
|
|
2472
|
+
indicatorTargetRef.current = void 0;
|
|
2466
2473
|
return;
|
|
2467
2474
|
}
|
|
2468
2475
|
const listRect = list.getBoundingClientRect();
|
|
2469
|
-
const
|
|
2470
|
-
const
|
|
2471
|
-
|
|
2476
|
+
const tabRect = active.getBoundingClientRect();
|
|
2477
|
+
const vertical = resolvedOrientation === "vertical";
|
|
2478
|
+
const width = type === "rounded" && !vertical ? Math.min(24, tabRect.width) : tabRect.width;
|
|
2479
|
+
const height = type === "rounded" && vertical ? Math.min(16, tabRect.height) : tabRect.height;
|
|
2480
|
+
const rect = { left: tabRect.left + (tabRect.width - width) / 2, top: tabRect.top + (tabRect.height - height) / 2, width, height };
|
|
2481
|
+
const x = rect.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
2482
|
+
const y = rect.top - listRect.top - list.clientTop + list.scrollTop;
|
|
2483
|
+
const previous = indicatorTargetRef.current;
|
|
2484
|
+
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;
|
|
2485
|
+
if (indicatorMotion === "stretch" && sameTarget) return;
|
|
2486
|
+
const current = indicator.getBoundingClientRect();
|
|
2487
|
+
if (indicatorMotion === "stretch") indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
2488
|
+
indicator.style.transform = `translate(${x}px, ${y}px)`;
|
|
2472
2489
|
indicator.style.width = `${rect.width}px`;
|
|
2473
2490
|
indicator.style.height = `${rect.height}px`;
|
|
2474
2491
|
indicator.style.visibility = "visible";
|
|
@@ -2476,13 +2493,33 @@ function Tabs({
|
|
|
2476
2493
|
indicator.getBoundingClientRect();
|
|
2477
2494
|
indicator.dataset.ready = "true";
|
|
2478
2495
|
}
|
|
2496
|
+
if (indicatorMotion === "stretch" && previous?.node === indicator && previous.key !== selectedKey && previous.position === resolvedPosition && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
2497
|
+
const fromX = current.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
2498
|
+
const fromY = current.top - listRect.top - list.clientTop + list.scrollTop;
|
|
2499
|
+
const start = vertical ? Math.min(fromY, y) : Math.min(fromX, x);
|
|
2500
|
+
const end = vertical ? Math.max(fromY + current.height, y + rect.height) : Math.max(fromX + current.width, x + rect.width);
|
|
2501
|
+
indicator.animate([
|
|
2502
|
+
{ transform: `translate(${fromX}px, ${fromY}px)`, width: `${current.width}px`, height: `${current.height}px`, offset: 0 },
|
|
2503
|
+
{ 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 },
|
|
2504
|
+
{ transform: `translate(${x}px, ${y}px)`, width: `${rect.width}px`, height: `${rect.height}px`, offset: 1 }
|
|
2505
|
+
], { duration: 300, easing: "cubic-bezier(.4, 0, .2, 1)" });
|
|
2506
|
+
}
|
|
2507
|
+
indicatorTargetRef.current = { node: indicator, key: selectedKey, position: resolvedPosition, x, y, width: rect.width, height: rect.height };
|
|
2479
2508
|
}
|
|
2480
2509
|
updateIndicator();
|
|
2481
2510
|
const observer = new ResizeObserver(updateIndicator);
|
|
2482
2511
|
observer.observe(list);
|
|
2483
2512
|
list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
|
|
2484
|
-
|
|
2485
|
-
|
|
2513
|
+
const motionPreference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2514
|
+
const stopMotion = () => {
|
|
2515
|
+
if (motionPreference.matches) indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
2516
|
+
};
|
|
2517
|
+
motionPreference.addEventListener("change", stopMotion);
|
|
2518
|
+
return () => {
|
|
2519
|
+
observer.disconnect();
|
|
2520
|
+
motionPreference.removeEventListener("change", stopMotion);
|
|
2521
|
+
};
|
|
2522
|
+
}, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount, indicatorMotion]);
|
|
2486
2523
|
(0, import_react11.useEffect)(() => {
|
|
2487
2524
|
let cancelled = false;
|
|
2488
2525
|
let frame = 0;
|
|
@@ -2507,7 +2544,7 @@ function Tabs({
|
|
|
2507
2544
|
cancelled = true;
|
|
2508
2545
|
cancelAnimationFrame(frame);
|
|
2509
2546
|
};
|
|
2510
|
-
}, [selectedKey, type, deferContent]);
|
|
2547
|
+
}, [selectedKey, type, deferContent, indicatorMotion]);
|
|
2511
2548
|
const contentKey = deferContent && items.some((item) => item.key === settledContentKey) ? settledContentKey : selectedKey;
|
|
2512
2549
|
(0, import_react11.useLayoutEffect)(() => {
|
|
2513
2550
|
if (deferContent && contentKey !== settledContentKey) setSettledContentKey(contentKey);
|
|
@@ -2551,7 +2588,7 @@ function Tabs({
|
|
|
2551
2588
|
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
2589
|
] }) : null,
|
|
2553
2590
|
/* @__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,
|
|
2591
|
+
sliding ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { ref: indicatorRef, "data-indicator-position": resolvedIndicatorPosition, 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
2592
|
items.map((item, index) => {
|
|
2556
2593
|
const selected = item.key === selectedKey;
|
|
2557
2594
|
const canClose = item.closable ?? closable;
|
package/dist/core.css
CHANGED
|
@@ -5053,40 +5053,78 @@ 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
|
}
|
|
5059
|
-
.sia-tabs--line > .sia-tabs__header .sia-tabs__indicator::after {
|
|
5062
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator::after {
|
|
5060
5063
|
position: absolute;
|
|
5061
5064
|
content: "";
|
|
5062
5065
|
background: var(--sia-tabs-accent, var(--sia-color-primary));
|
|
5063
5066
|
}
|
|
5064
|
-
.sia-tabs--line.sia-tabs--
|
|
5065
|
-
|
|
5066
|
-
left: 0;
|
|
5067
|
-
right: 0;
|
|
5067
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=bottom]::after {
|
|
5068
|
+
inset: auto 0 -1px 0;
|
|
5068
5069
|
height: 2px;
|
|
5069
5070
|
border-radius: 2px 2px 0 0;
|
|
5070
5071
|
}
|
|
5071
|
-
.sia-tabs--line.sia-tabs--
|
|
5072
|
-
|
|
5073
|
-
left: 0;
|
|
5074
|
-
right: 0;
|
|
5072
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=top]::after {
|
|
5073
|
+
inset: -1px 0 auto 0;
|
|
5075
5074
|
height: 2px;
|
|
5076
5075
|
border-radius: 0 0 2px 2px;
|
|
5077
5076
|
}
|
|
5078
|
-
.sia-tabs--line.sia-tabs--
|
|
5079
|
-
|
|
5080
|
-
bottom: 0;
|
|
5081
|
-
right: -1px;
|
|
5077
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=right]::after {
|
|
5078
|
+
inset: 0 -1px 0 auto;
|
|
5082
5079
|
width: 2px;
|
|
5083
5080
|
}
|
|
5084
|
-
.sia-tabs--line.sia-tabs--
|
|
5085
|
-
|
|
5086
|
-
bottom: 0;
|
|
5087
|
-
left: -1px;
|
|
5081
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=left]::after {
|
|
5082
|
+
inset: 0 auto 0 -1px;
|
|
5088
5083
|
width: 2px;
|
|
5089
5084
|
}
|
|
5085
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__list {
|
|
5086
|
+
gap: 4px;
|
|
5087
|
+
}
|
|
5088
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab {
|
|
5089
|
+
border-radius: 8px;
|
|
5090
|
+
color: var(--sia-color-text);
|
|
5091
|
+
transition: background-color 160ms ease;
|
|
5092
|
+
}
|
|
5093
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab:hover:not(:disabled) {
|
|
5094
|
+
color: var(--sia-color-text);
|
|
5095
|
+
background: var(--sia-color-control-hover);
|
|
5096
|
+
}
|
|
5097
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab[aria-selected=true] {
|
|
5098
|
+
background: var(--sia-color-control-hover);
|
|
5099
|
+
}
|
|
5100
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab:focus-visible {
|
|
5101
|
+
outline: 2px solid var(--sia-color-primary);
|
|
5102
|
+
outline-offset: -2px;
|
|
5103
|
+
}
|
|
5104
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator {
|
|
5105
|
+
z-index: 1;
|
|
5106
|
+
}
|
|
5107
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=left]::after {
|
|
5108
|
+
left: 4px;
|
|
5109
|
+
border-radius: 2px;
|
|
5110
|
+
}
|
|
5111
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=right]::after {
|
|
5112
|
+
right: 4px;
|
|
5113
|
+
border-radius: 2px;
|
|
5114
|
+
}
|
|
5115
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=top]::after {
|
|
5116
|
+
top: 4px;
|
|
5117
|
+
border-radius: 2px;
|
|
5118
|
+
}
|
|
5119
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=bottom]::after {
|
|
5120
|
+
bottom: 4px;
|
|
5121
|
+
border-radius: 2px;
|
|
5122
|
+
}
|
|
5123
|
+
@media (prefers-reduced-motion: reduce) {
|
|
5124
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab {
|
|
5125
|
+
transition: none;
|
|
5126
|
+
}
|
|
5127
|
+
}
|
|
5090
5128
|
.sia-tabs--tech > .sia-tabs__header .sia-tabs__tab[aria-selected=true]::before,
|
|
5091
5129
|
.sia-tabs--tech > .sia-tabs__header .sia-tabs__tab[aria-selected=true]::after {
|
|
5092
5130
|
display: none;
|
|
@@ -8121,10 +8159,20 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
8121
8159
|
font-size: 12px;
|
|
8122
8160
|
line-height: 1.45;
|
|
8123
8161
|
}
|
|
8162
|
+
.sia-floating__overlay.sia-form-item__error-popover {
|
|
8163
|
+
opacity: 1;
|
|
8164
|
+
animation: none;
|
|
8165
|
+
transition: opacity 160ms ease;
|
|
8166
|
+
}
|
|
8124
8167
|
.sia-floating__overlay.sia-form-item__error-popover--obscured {
|
|
8125
8168
|
opacity: 0;
|
|
8126
8169
|
animation: none;
|
|
8127
8170
|
}
|
|
8171
|
+
@media (prefers-reduced-motion: reduce) {
|
|
8172
|
+
.sia-floating__overlay.sia-form-item__error-popover {
|
|
8173
|
+
transition: none;
|
|
8174
|
+
}
|
|
8175
|
+
}
|
|
8128
8176
|
.sia-form-item__error-content {
|
|
8129
8177
|
display: flex;
|
|
8130
8178
|
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-DYo5C4Si.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-sWwvVAmP.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,40 +5062,78 @@ 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
|
}
|
|
5068
|
-
.sia-tabs--line > .sia-tabs__header .sia-tabs__indicator::after {
|
|
5071
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator::after {
|
|
5069
5072
|
position: absolute;
|
|
5070
5073
|
content: "";
|
|
5071
5074
|
background: var(--sia-tabs-accent, var(--sia-color-primary));
|
|
5072
5075
|
}
|
|
5073
|
-
.sia-tabs--line.sia-tabs--
|
|
5074
|
-
|
|
5075
|
-
left: 0;
|
|
5076
|
-
right: 0;
|
|
5076
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=bottom]::after {
|
|
5077
|
+
inset: auto 0 -1px 0;
|
|
5077
5078
|
height: 2px;
|
|
5078
5079
|
border-radius: 2px 2px 0 0;
|
|
5079
5080
|
}
|
|
5080
|
-
.sia-tabs--line.sia-tabs--
|
|
5081
|
-
|
|
5082
|
-
left: 0;
|
|
5083
|
-
right: 0;
|
|
5081
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=top]::after {
|
|
5082
|
+
inset: -1px 0 auto 0;
|
|
5084
5083
|
height: 2px;
|
|
5085
5084
|
border-radius: 0 0 2px 2px;
|
|
5086
5085
|
}
|
|
5087
|
-
.sia-tabs--line.sia-tabs--
|
|
5088
|
-
|
|
5089
|
-
bottom: 0;
|
|
5090
|
-
right: -1px;
|
|
5086
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=right]::after {
|
|
5087
|
+
inset: 0 -1px 0 auto;
|
|
5091
5088
|
width: 2px;
|
|
5092
5089
|
}
|
|
5093
|
-
.sia-tabs--line.sia-tabs--
|
|
5094
|
-
|
|
5095
|
-
bottom: 0;
|
|
5096
|
-
left: -1px;
|
|
5090
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=left]::after {
|
|
5091
|
+
inset: 0 auto 0 -1px;
|
|
5097
5092
|
width: 2px;
|
|
5098
5093
|
}
|
|
5094
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__list {
|
|
5095
|
+
gap: 4px;
|
|
5096
|
+
}
|
|
5097
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab {
|
|
5098
|
+
border-radius: 8px;
|
|
5099
|
+
color: var(--sia-color-text);
|
|
5100
|
+
transition: background-color 160ms ease;
|
|
5101
|
+
}
|
|
5102
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab:hover:not(:disabled) {
|
|
5103
|
+
color: var(--sia-color-text);
|
|
5104
|
+
background: var(--sia-color-control-hover);
|
|
5105
|
+
}
|
|
5106
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab[aria-selected=true] {
|
|
5107
|
+
background: var(--sia-color-control-hover);
|
|
5108
|
+
}
|
|
5109
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab:focus-visible {
|
|
5110
|
+
outline: 2px solid var(--sia-color-primary);
|
|
5111
|
+
outline-offset: -2px;
|
|
5112
|
+
}
|
|
5113
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator {
|
|
5114
|
+
z-index: 1;
|
|
5115
|
+
}
|
|
5116
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=left]::after {
|
|
5117
|
+
left: 4px;
|
|
5118
|
+
border-radius: 2px;
|
|
5119
|
+
}
|
|
5120
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=right]::after {
|
|
5121
|
+
right: 4px;
|
|
5122
|
+
border-radius: 2px;
|
|
5123
|
+
}
|
|
5124
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=top]::after {
|
|
5125
|
+
top: 4px;
|
|
5126
|
+
border-radius: 2px;
|
|
5127
|
+
}
|
|
5128
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=bottom]::after {
|
|
5129
|
+
bottom: 4px;
|
|
5130
|
+
border-radius: 2px;
|
|
5131
|
+
}
|
|
5132
|
+
@media (prefers-reduced-motion: reduce) {
|
|
5133
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab {
|
|
5134
|
+
transition: none;
|
|
5135
|
+
}
|
|
5136
|
+
}
|
|
5099
5137
|
.sia-tabs--tech > .sia-tabs__header .sia-tabs__tab[aria-selected=true]::before,
|
|
5100
5138
|
.sia-tabs--tech > .sia-tabs__header .sia-tabs__tab[aria-selected=true]::after {
|
|
5101
5139
|
display: none;
|
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,8 @@ function Tabs({
|
|
|
12716
12725
|
onAfterChange,
|
|
12717
12726
|
deferContent = false,
|
|
12718
12727
|
type = "line",
|
|
12728
|
+
indicatorMotion = type === "line" || type === "underline" || type === "rounded" ? "stretch" : "slide",
|
|
12729
|
+
indicatorPosition,
|
|
12719
12730
|
size = "medium",
|
|
12720
12731
|
tabPosition,
|
|
12721
12732
|
orientation = "horizontal",
|
|
@@ -12739,9 +12750,12 @@ function Tabs({
|
|
|
12739
12750
|
const enabledItems = (0, import_react49.useMemo)(() => items.filter((item) => !item.disabled), [items]);
|
|
12740
12751
|
const resolvedPosition = tabPosition ?? (orientation === "vertical" ? "left" : "top");
|
|
12741
12752
|
const resolvedOrientation = resolvedPosition === "left" || resolvedPosition === "right" ? "vertical" : "horizontal";
|
|
12742
|
-
const
|
|
12753
|
+
const defaultIndicatorPosition = { top: "bottom", bottom: "top", left: "right", right: "left" }[resolvedPosition];
|
|
12754
|
+
const resolvedIndicatorPosition = indicatorPosition && (resolvedOrientation === "vertical" ? ["left", "right"] : ["top", "bottom"]).includes(indicatorPosition) ? indicatorPosition : defaultIndicatorPosition;
|
|
12755
|
+
const sliding = ["capsule", "line", "underline", "rounded", "tech", "tech-line"].includes(type);
|
|
12743
12756
|
const listRef = (0, import_react49.useRef)(null);
|
|
12744
12757
|
const indicatorRef = (0, import_react49.useRef)(null);
|
|
12758
|
+
const indicatorTargetRef = (0, import_react49.useRef)();
|
|
12745
12759
|
const moreRef = (0, import_react49.useRef)(null);
|
|
12746
12760
|
const [overflow, setOverflow] = (0, import_react49.useState)({ count: items.length, width: 0 });
|
|
12747
12761
|
const [moreOpen, setMoreOpen] = (0, import_react49.useState)(false);
|
|
@@ -12794,13 +12808,25 @@ function Tabs({
|
|
|
12794
12808
|
if (!list || !indicator) return;
|
|
12795
12809
|
const active = list.querySelector('[role="tab"][aria-selected="true"]');
|
|
12796
12810
|
if (!active || active.closest('[data-tab-hidden="true"]')) {
|
|
12811
|
+
indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
12797
12812
|
indicator.style.visibility = "hidden";
|
|
12813
|
+
indicatorTargetRef.current = void 0;
|
|
12798
12814
|
return;
|
|
12799
12815
|
}
|
|
12800
12816
|
const listRect = list.getBoundingClientRect();
|
|
12801
|
-
const
|
|
12802
|
-
const
|
|
12803
|
-
|
|
12817
|
+
const tabRect = active.getBoundingClientRect();
|
|
12818
|
+
const vertical = resolvedOrientation === "vertical";
|
|
12819
|
+
const width = type === "rounded" && !vertical ? Math.min(24, tabRect.width) : tabRect.width;
|
|
12820
|
+
const height = type === "rounded" && vertical ? Math.min(16, tabRect.height) : tabRect.height;
|
|
12821
|
+
const rect = { left: tabRect.left + (tabRect.width - width) / 2, top: tabRect.top + (tabRect.height - height) / 2, width, height };
|
|
12822
|
+
const x = rect.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
12823
|
+
const y = rect.top - listRect.top - list.clientTop + list.scrollTop;
|
|
12824
|
+
const previous = indicatorTargetRef.current;
|
|
12825
|
+
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;
|
|
12826
|
+
if (indicatorMotion === "stretch" && sameTarget) return;
|
|
12827
|
+
const current = indicator.getBoundingClientRect();
|
|
12828
|
+
if (indicatorMotion === "stretch") indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
12829
|
+
indicator.style.transform = `translate(${x}px, ${y}px)`;
|
|
12804
12830
|
indicator.style.width = `${rect.width}px`;
|
|
12805
12831
|
indicator.style.height = `${rect.height}px`;
|
|
12806
12832
|
indicator.style.visibility = "visible";
|
|
@@ -12808,13 +12834,33 @@ function Tabs({
|
|
|
12808
12834
|
indicator.getBoundingClientRect();
|
|
12809
12835
|
indicator.dataset.ready = "true";
|
|
12810
12836
|
}
|
|
12837
|
+
if (indicatorMotion === "stretch" && previous?.node === indicator && previous.key !== selectedKey && previous.position === resolvedPosition && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
12838
|
+
const fromX = current.left - listRect.left - list.clientLeft + list.scrollLeft;
|
|
12839
|
+
const fromY = current.top - listRect.top - list.clientTop + list.scrollTop;
|
|
12840
|
+
const start = vertical ? Math.min(fromY, y) : Math.min(fromX, x);
|
|
12841
|
+
const end = vertical ? Math.max(fromY + current.height, y + rect.height) : Math.max(fromX + current.width, x + rect.width);
|
|
12842
|
+
indicator.animate([
|
|
12843
|
+
{ transform: `translate(${fromX}px, ${fromY}px)`, width: `${current.width}px`, height: `${current.height}px`, offset: 0 },
|
|
12844
|
+
{ 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 },
|
|
12845
|
+
{ transform: `translate(${x}px, ${y}px)`, width: `${rect.width}px`, height: `${rect.height}px`, offset: 1 }
|
|
12846
|
+
], { duration: 300, easing: "cubic-bezier(.4, 0, .2, 1)" });
|
|
12847
|
+
}
|
|
12848
|
+
indicatorTargetRef.current = { node: indicator, key: selectedKey, position: resolvedPosition, x, y, width: rect.width, height: rect.height };
|
|
12811
12849
|
}
|
|
12812
12850
|
updateIndicator();
|
|
12813
12851
|
const observer = new ResizeObserver(updateIndicator);
|
|
12814
12852
|
observer.observe(list);
|
|
12815
12853
|
list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
|
|
12816
|
-
|
|
12817
|
-
|
|
12854
|
+
const motionPreference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
12855
|
+
const stopMotion = () => {
|
|
12856
|
+
if (motionPreference.matches) indicator.getAnimations().forEach((animation) => animation.cancel());
|
|
12857
|
+
};
|
|
12858
|
+
motionPreference.addEventListener("change", stopMotion);
|
|
12859
|
+
return () => {
|
|
12860
|
+
observer.disconnect();
|
|
12861
|
+
motionPreference.removeEventListener("change", stopMotion);
|
|
12862
|
+
};
|
|
12863
|
+
}, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount, indicatorMotion]);
|
|
12818
12864
|
(0, import_react49.useEffect)(() => {
|
|
12819
12865
|
let cancelled = false;
|
|
12820
12866
|
let frame = 0;
|
|
@@ -12839,7 +12885,7 @@ function Tabs({
|
|
|
12839
12885
|
cancelled = true;
|
|
12840
12886
|
cancelAnimationFrame(frame);
|
|
12841
12887
|
};
|
|
12842
|
-
}, [selectedKey, type, deferContent]);
|
|
12888
|
+
}, [selectedKey, type, deferContent, indicatorMotion]);
|
|
12843
12889
|
const contentKey = deferContent && items.some((item) => item.key === settledContentKey) ? settledContentKey : selectedKey;
|
|
12844
12890
|
(0, import_react49.useLayoutEffect)(() => {
|
|
12845
12891
|
if (deferContent && contentKey !== settledContentKey) setSettledContentKey(contentKey);
|
|
@@ -12883,7 +12929,7 @@ function Tabs({
|
|
|
12883
12929
|
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
12930
|
] }) : null,
|
|
12885
12931
|
/* @__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,
|
|
12932
|
+
sliding ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { ref: indicatorRef, "data-indicator-position": resolvedIndicatorPosition, 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
12933
|
items.map((item, index) => {
|
|
12888
12934
|
const selected = item.key === selectedKey;
|
|
12889
12935
|
const canClose = item.closable ?? closable;
|
package/dist/index.css
CHANGED
|
@@ -5053,40 +5053,78 @@ 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
|
}
|
|
5059
|
-
.sia-tabs--line > .sia-tabs__header .sia-tabs__indicator::after {
|
|
5062
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator::after {
|
|
5060
5063
|
position: absolute;
|
|
5061
5064
|
content: "";
|
|
5062
5065
|
background: var(--sia-tabs-accent, var(--sia-color-primary));
|
|
5063
5066
|
}
|
|
5064
|
-
.sia-tabs--line.sia-tabs--
|
|
5065
|
-
|
|
5066
|
-
left: 0;
|
|
5067
|
-
right: 0;
|
|
5067
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=bottom]::after {
|
|
5068
|
+
inset: auto 0 -1px 0;
|
|
5068
5069
|
height: 2px;
|
|
5069
5070
|
border-radius: 2px 2px 0 0;
|
|
5070
5071
|
}
|
|
5071
|
-
.sia-tabs--line.sia-tabs--
|
|
5072
|
-
|
|
5073
|
-
left: 0;
|
|
5074
|
-
right: 0;
|
|
5072
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=top]::after {
|
|
5073
|
+
inset: -1px 0 auto 0;
|
|
5075
5074
|
height: 2px;
|
|
5076
5075
|
border-radius: 0 0 2px 2px;
|
|
5077
5076
|
}
|
|
5078
|
-
.sia-tabs--line.sia-tabs--
|
|
5079
|
-
|
|
5080
|
-
bottom: 0;
|
|
5081
|
-
right: -1px;
|
|
5077
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=right]::after {
|
|
5078
|
+
inset: 0 -1px 0 auto;
|
|
5082
5079
|
width: 2px;
|
|
5083
5080
|
}
|
|
5084
|
-
.sia-tabs--line.sia-tabs--
|
|
5085
|
-
|
|
5086
|
-
bottom: 0;
|
|
5087
|
-
left: -1px;
|
|
5081
|
+
.sia-tabs:is(.sia-tabs--line, .sia-tabs--rounded) > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=left]::after {
|
|
5082
|
+
inset: 0 auto 0 -1px;
|
|
5088
5083
|
width: 2px;
|
|
5089
5084
|
}
|
|
5085
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__list {
|
|
5086
|
+
gap: 4px;
|
|
5087
|
+
}
|
|
5088
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab {
|
|
5089
|
+
border-radius: 8px;
|
|
5090
|
+
color: var(--sia-color-text);
|
|
5091
|
+
transition: background-color 160ms ease;
|
|
5092
|
+
}
|
|
5093
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab:hover:not(:disabled) {
|
|
5094
|
+
color: var(--sia-color-text);
|
|
5095
|
+
background: var(--sia-color-control-hover);
|
|
5096
|
+
}
|
|
5097
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab[aria-selected=true] {
|
|
5098
|
+
background: var(--sia-color-control-hover);
|
|
5099
|
+
}
|
|
5100
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab:focus-visible {
|
|
5101
|
+
outline: 2px solid var(--sia-color-primary);
|
|
5102
|
+
outline-offset: -2px;
|
|
5103
|
+
}
|
|
5104
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator {
|
|
5105
|
+
z-index: 1;
|
|
5106
|
+
}
|
|
5107
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=left]::after {
|
|
5108
|
+
left: 4px;
|
|
5109
|
+
border-radius: 2px;
|
|
5110
|
+
}
|
|
5111
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=right]::after {
|
|
5112
|
+
right: 4px;
|
|
5113
|
+
border-radius: 2px;
|
|
5114
|
+
}
|
|
5115
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=top]::after {
|
|
5116
|
+
top: 4px;
|
|
5117
|
+
border-radius: 2px;
|
|
5118
|
+
}
|
|
5119
|
+
.sia-tabs.sia-tabs--rounded > .sia-tabs__header .sia-tabs__indicator[data-indicator-position=bottom]::after {
|
|
5120
|
+
bottom: 4px;
|
|
5121
|
+
border-radius: 2px;
|
|
5122
|
+
}
|
|
5123
|
+
@media (prefers-reduced-motion: reduce) {
|
|
5124
|
+
.sia-tabs--rounded > .sia-tabs__header .sia-tabs__tab {
|
|
5125
|
+
transition: none;
|
|
5126
|
+
}
|
|
5127
|
+
}
|
|
5090
5128
|
.sia-tabs--tech > .sia-tabs__header .sia-tabs__tab[aria-selected=true]::before,
|
|
5091
5129
|
.sia-tabs--tech > .sia-tabs__header .sia-tabs__tab[aria-selected=true]::after {
|
|
5092
5130
|
display: none;
|
|
@@ -8121,10 +8159,20 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
8121
8159
|
font-size: 12px;
|
|
8122
8160
|
line-height: 1.45;
|
|
8123
8161
|
}
|
|
8162
|
+
.sia-floating__overlay.sia-form-item__error-popover {
|
|
8163
|
+
opacity: 1;
|
|
8164
|
+
animation: none;
|
|
8165
|
+
transition: opacity 160ms ease;
|
|
8166
|
+
}
|
|
8124
8167
|
.sia-floating__overlay.sia-form-item__error-popover--obscured {
|
|
8125
8168
|
opacity: 0;
|
|
8126
8169
|
animation: none;
|
|
8127
8170
|
}
|
|
8171
|
+
@media (prefers-reduced-motion: reduce) {
|
|
8172
|
+
.sia-floating__overlay.sia-form-item__error-popover {
|
|
8173
|
+
transition: none;
|
|
8174
|
+
}
|
|
8175
|
+
}
|
|
8128
8176
|
.sia-form-item__error-content {
|
|
8129
8177
|
display: flex;
|
|
8130
8178
|
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-DYo5C4Si.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-DYo5C4Si.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-sWwvVAmP.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-sWwvVAmP.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-DIRPOUVX.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
|
),
|