@sia.soul/sia-react-ui 0.1.31 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-DwsFTbqh.cjs';
1
+ export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-CzO_tc34.cjs';
2
2
  export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-YJbT-MF1.cjs';
3
3
  import 'react';
4
4
  import './shared-Bx4B28Wh.cjs';
package/dist/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-C89ubkwU.js';
1
+ export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-CIXKpA9Z.js';
2
2
  export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-CCrPqULn.js';
3
3
  import 'react';
4
4
  import './shared-Bx4B28Wh.js';
package/dist/core.js CHANGED
@@ -10,21 +10,21 @@ import {
10
10
  Typography,
11
11
  Upload,
12
12
  message
13
- } from "./chunk-NDJSNM54.js";
14
- import "./chunk-YQDHCORW.js";
13
+ } from "./chunk-Z63VYNCR.js";
14
+ import "./chunk-SMCYEPBL.js";
15
15
  import {
16
16
  Modal,
17
17
  Select
18
- } from "./chunk-AHBC5UXJ.js";
18
+ } from "./chunk-QAVQEBIS.js";
19
19
  import {
20
20
  Icon,
21
21
  Input,
22
22
  Segmented
23
- } from "./chunk-YF2I6SDB.js";
23
+ } from "./chunk-HOU5JLNJ.js";
24
24
  import {
25
25
  Button
26
- } from "./chunk-IYNS423D.js";
27
- import "./chunk-RAO3JHDL.js";
26
+ } from "./chunk-IKAMZNCK.js";
27
+ import "./chunk-H7IAG72O.js";
28
28
  export {
29
29
  Breadcrumb,
30
30
  Button,
package/dist/index.cjs CHANGED
@@ -323,6 +323,7 @@ function installTitleTooltips(doc) {
323
323
  documents.add(doc);
324
324
  let hovered = null;
325
325
  let focused = null;
326
+ let keyboardFocus = true;
326
327
  let active = null;
327
328
  let pending = null;
328
329
  let timer;
@@ -413,19 +414,30 @@ function installTitleTooltips(doc) {
413
414
  else show(hovered ?? focused);
414
415
  }, true);
415
416
  doc.addEventListener("focusin", (event) => {
416
- focused = candidate(event.target);
417
+ focused = keyboardFocus ? candidate(event.target) : null;
417
418
  if (hasExplicitTooltip(event.target)) hide();
418
- else show(focused ?? hovered);
419
+ else if (keyboardFocus) show(focused ?? hovered);
419
420
  }, true);
420
421
  doc.addEventListener("focusout", (event) => {
421
- focused = candidate(event.relatedTarget);
422
+ focused = keyboardFocus ? candidate(event.relatedTarget) : null;
422
423
  show(hovered ?? focused);
423
424
  }, true);
424
- doc.addEventListener("pointerdown", hide, true);
425
+ doc.addEventListener("pointerdown", () => {
426
+ keyboardFocus = false;
427
+ focused = null;
428
+ hide();
429
+ }, true);
425
430
  doc.addEventListener("keydown", (event) => {
426
431
  if (event.key === "Escape") hide();
432
+ else if (event.key === "Tab") keyboardFocus = true;
427
433
  }, true);
428
434
  doc.addEventListener("scroll", hide, true);
435
+ doc.addEventListener("visibilitychange", () => {
436
+ if (doc.hidden) {
437
+ hovered = focused = null;
438
+ hide();
439
+ }
440
+ });
429
441
  doc.defaultView?.addEventListener("blur", () => {
430
442
  hovered = focused = null;
431
443
  hide();
@@ -10826,6 +10838,8 @@ function Tabs({
10826
10838
  activeKey,
10827
10839
  defaultActiveKey,
10828
10840
  onChange,
10841
+ onAfterChange,
10842
+ deferContent = false,
10829
10843
  type = "line",
10830
10844
  size = "medium",
10831
10845
  tabPosition,
@@ -10833,6 +10847,7 @@ function Tabs({
10833
10847
  centered = false,
10834
10848
  tabBarTitle,
10835
10849
  tabBarExtraContent,
10850
+ contentGap,
10836
10851
  destroyInactiveTabPane = true,
10837
10852
  closable = false,
10838
10853
  onEdit,
@@ -10852,6 +10867,12 @@ function Tabs({
10852
10867
  const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
10853
10868
  const listRef = (0, import_react45.useRef)(null);
10854
10869
  const indicatorRef = (0, import_react45.useRef)(null);
10870
+ const [contentState, setContentState] = (0, import_react45.useState)(() => ({ key: selectedKey, visited: /* @__PURE__ */ new Set([selectedKey]) }));
10871
+ const settledKeyRef = (0, import_react45.useRef)(selectedKey);
10872
+ const afterChangeRef = (0, import_react45.useRef)(onAfterChange);
10873
+ (0, import_react45.useLayoutEffect)(() => {
10874
+ afterChangeRef.current = onAfterChange;
10875
+ }, [onAfterChange]);
10855
10876
  (0, import_react45.useLayoutEffect)(() => {
10856
10877
  if (!sliding) return;
10857
10878
  const list = listRef.current;
@@ -10881,6 +10902,32 @@ function Tabs({
10881
10902
  list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
10882
10903
  return () => observer.disconnect();
10883
10904
  }, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable]);
10905
+ (0, import_react45.useEffect)(() => {
10906
+ let cancelled = false;
10907
+ let frame = 0;
10908
+ frame = requestAnimationFrame(() => {
10909
+ const indicator = indicatorRef.current;
10910
+ if (indicator) getComputedStyle(indicator).transform;
10911
+ const animations = indicator?.getAnimations() ?? [];
10912
+ const complete = () => {
10913
+ if (cancelled) return;
10914
+ setContentState((previous) => ({ key: selectedKey, visited: new Set([...previous.visited].filter((key) => items.some((item) => item.key === key))).add(selectedKey) }));
10915
+ if (settledKeyRef.current !== selectedKey) {
10916
+ settledKeyRef.current = selectedKey;
10917
+ afterChangeRef.current?.(selectedKey);
10918
+ }
10919
+ };
10920
+ if (!animations.length) complete();
10921
+ else Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {
10922
+ if (!cancelled) frame = requestAnimationFrame(complete);
10923
+ });
10924
+ });
10925
+ return () => {
10926
+ cancelled = true;
10927
+ cancelAnimationFrame(frame);
10928
+ };
10929
+ }, [selectedKey, type, deferContent]);
10930
+ const contentKey = deferContent ? contentState.key : selectedKey;
10884
10931
  function selectTab(key) {
10885
10932
  if (key === selectedKey) return;
10886
10933
  if (activeKey === void 0) setInternalActiveKey(key);
@@ -10912,26 +10959,10 @@ function Tabs({
10912
10959
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "sia-tabs__header", children: [
10913
10960
  tabBarTitle ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "sia-tabs__title", children: [
10914
10961
  tabBarTitle,
10915
- type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("svg", { className: "sia-tabs__title-connector", viewBox: "0 0 32 40", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M0 39 H5 Q8 39 10 35 L28 3 Q29 1 32 1", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }) }) : null
10962
+ type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("svg", { className: "sia-tabs__title-connector", viewBox: "0 0 32 40", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime47.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
10916
10963
  ] }) : null,
10917
10964
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { ref: listRef, className: `sia-tabs__list${sliding ? " sia-tabs__list--sliding" : ""}`, role: "tablist", "aria-orientation": resolvedOrientation, children: [
10918
- sliding ? /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.jsxs)("svg", { className: "sia-tabs__indicator-shape", viewBox: "0 0 100 34", preserveAspectRatio: "none", "aria-hidden": "true", children: [
10919
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("linearGradient", { id: `${baseId}-tab-fill-indicator`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
10920
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "0", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" }),
10921
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: ".53", stopColor: "var(--sia-tabs-line-fill-center, var(--sia-tabs-line-fill))" }),
10922
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "1", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" })
10923
- ] }) }),
10924
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10925
- "path",
10926
- {
10927
- d: "M19 1 H96 Q99 1 97.5 4 L83.5 30 Q82 33 79 33 H4 Q1 33 2.5 30 L16.5 4 Q18 1 19 1 Z",
10928
- fill: `url(#${baseId}-tab-fill-indicator)`,
10929
- stroke: "currentColor",
10930
- strokeWidth: "1.5",
10931
- vectorEffect: "non-scaling-stroke"
10932
- }
10933
- )
10934
- ] }) : null }, type) : null,
10965
+ sliding ? /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.jsx)("span", { className: "sia-tabs__indicator-shape", "aria-hidden": "true" }) : null }, type) : null,
10935
10966
  items.map((item) => {
10936
10967
  const selected = item.key === selectedKey;
10937
10968
  const canClose = item.closable ?? closable;
@@ -10950,23 +10981,7 @@ function Tabs({
10950
10981
  onClick: () => selectTab(item.key),
10951
10982
  onKeyDown: (event) => handleKeyDown(event, item.key),
10952
10983
  children: [
10953
- type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("svg", { className: "sia-tabs__tab-shape", viewBox: "0 0 100 34", preserveAspectRatio: "none", "aria-hidden": "true", children: [
10954
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("linearGradient", { id: `${baseId}-tab-fill-${item.key}`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
10955
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "0", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" }),
10956
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: ".53", stopColor: "var(--sia-tabs-line-fill-center, var(--sia-tabs-line-fill))" }),
10957
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "1", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" })
10958
- ] }) }),
10959
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10960
- "path",
10961
- {
10962
- d: "M19 1 H96 Q99 1 97.5 4 L83.5 30 Q82 33 79 33 H4 Q1 33 2.5 30 L16.5 4 Q18 1 19 1 Z",
10963
- fill: `url(#${baseId}-tab-fill-${item.key})`,
10964
- stroke: "currentColor",
10965
- strokeWidth: "1.5",
10966
- vectorEffect: "non-scaling-stroke"
10967
- }
10968
- )
10969
- ] }) : null,
10984
+ type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sia-tabs__tab-shape", "aria-hidden": "true" }) : null,
10970
10985
  item.icon ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sia-tabs__icon", children: item.icon }) : null,
10971
10986
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: item.label })
10972
10987
  ]
@@ -11006,9 +11021,13 @@ function Tabs({
11006
11021
  ] }),
11007
11022
  tabBarExtraContent ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "sia-tabs__extra", children: tabBarExtraContent }) : null
11008
11023
  ] }),
11009
- hasPanels ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "sia-tabs__panels", children: items.map((item) => {
11010
- const selected = item.key === selectedKey;
11024
+ hasPanels ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "sia-tabs__panels", style: contentGap === void 0 ? void 0 : {
11025
+ // 仅设置面板靠近导航的一侧,保留各方向布局原有的其余边界。
11026
+ [resolvedPosition === "top" ? "paddingTop" : resolvedPosition === "bottom" ? "paddingBottom" : resolvedPosition === "left" ? "paddingLeft" : "paddingRight"]: contentGap
11027
+ }, "aria-busy": deferContent && contentKey !== selectedKey || void 0, children: items.map((item) => {
11028
+ const selected = item.key === contentKey;
11011
11029
  if (destroyInactiveTabPane && !selected) return null;
11030
+ if (deferContent && !selected && !contentState.visited.has(item.key)) return null;
11012
11031
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11013
11032
  "div",
11014
11033
  {