@sia.soul/sia-react-ui 0.1.10 → 0.1.12

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/index.js CHANGED
@@ -79,7 +79,7 @@ import {
79
79
  Watermark,
80
80
  message,
81
81
  notification
82
- } from "./chunk-6HP6IIT4.js";
82
+ } from "./chunk-MOOMDRAN.js";
83
83
  import {
84
84
  TextArea
85
85
  } from "./chunk-WHARTF2I.js";
@@ -94,7 +94,7 @@ import {
94
94
  DatePicker,
95
95
  SelectDateRange,
96
96
  TimePanel
97
- } from "./chunk-T2X6WK6Z.js";
97
+ } from "./chunk-RLTG3IK7.js";
98
98
  import {
99
99
  Checkbox,
100
100
  Modal,
@@ -107,7 +107,7 @@ import {
107
107
  Tooltip,
108
108
  Tree,
109
109
  useOverlayLifecycle
110
- } from "./chunk-SGJLZN23.js";
110
+ } from "./chunk-BUMS62NO.js";
111
111
  import {
112
112
  Dropdown,
113
113
  FILLED_ICON_NAMES,
@@ -829,7 +829,7 @@ function SplitterRoot({
829
829
  var Splitter = Object.assign(SplitterRoot, { Panel: SplitterPanel });
830
830
 
831
831
  // src/components/ToolPanel.tsx
832
- import { useState as useState5 } from "react";
832
+ import { useId, useLayoutEffect, useRef as useRef3, useState as useState5 } from "react";
833
833
  import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
834
834
  function clamp2(value, min, max) {
835
835
  return Math.min(max, Math.max(min, value));
@@ -837,6 +837,10 @@ function clamp2(value, min, max) {
837
837
  function ToolPanel({
838
838
  title,
839
839
  icon,
840
+ items,
841
+ activeKey,
842
+ defaultActiveKey,
843
+ onActiveKeyChange,
840
844
  placement = "left",
841
845
  open,
842
846
  defaultOpen = true,
@@ -851,9 +855,56 @@ function ToolPanel({
851
855
  children,
852
856
  ...props
853
857
  }) {
858
+ const panelId = useId();
859
+ const [internalActiveKey, setInternalActiveKey] = useState5(defaultActiveKey);
854
860
  const [internalOpen, setInternalOpen] = useState5(defaultOpen);
855
861
  const [size, setSize] = useState5(() => clamp2(defaultSize, minSize, maxSize));
856
- const isOpen = open ?? internalOpen;
862
+ const panels = items ?? [{ key: "single", title, icon, children }];
863
+ const requestedKey = activeKey ?? internalActiveKey;
864
+ const activePanel = panels.find((item) => item.key === requestedKey && !item.disabled) ?? panels.find((item) => !item.disabled);
865
+ const isOpen = (open ?? internalOpen) && Boolean(activePanel);
866
+ const railRef = useRef3(null);
867
+ const indicatorRef = useRef3(null);
868
+ useLayoutEffect(() => {
869
+ const rail2 = railRef.current;
870
+ const indicator = indicatorRef.current;
871
+ if (!rail2 || !indicator) return;
872
+ function updateIndicator() {
873
+ if (!rail2 || !indicator) return;
874
+ const active = rail2.querySelector(".sia-tool-panel__activity.is-active");
875
+ if (!active) {
876
+ indicator.style.visibility = "hidden";
877
+ delete indicator.dataset.ready;
878
+ return;
879
+ }
880
+ const railRect = rail2.getBoundingClientRect();
881
+ const rect = active.getBoundingClientRect();
882
+ const x = rect.left - railRect.left - rail2.clientLeft + rail2.scrollLeft + (placement === "left" ? rect.width - 3 : 0);
883
+ const y = rect.top - railRect.top - rail2.clientTop + rail2.scrollTop;
884
+ indicator.style.transform = `translate(${x}px, ${y}px)`;
885
+ indicator.style.height = `${rect.height}px`;
886
+ indicator.style.visibility = "visible";
887
+ if (!indicator.dataset.ready) {
888
+ indicator.getBoundingClientRect();
889
+ indicator.dataset.ready = "true";
890
+ }
891
+ }
892
+ updateIndicator();
893
+ const observer = new ResizeObserver(updateIndicator);
894
+ observer.observe(rail2);
895
+ rail2.querySelectorAll(".sia-tool-panel__activity").forEach((item) => observer.observe(item));
896
+ return () => observer.disconnect();
897
+ }, [isOpen, activePanel?.key, items, title, icon, placement]);
898
+ function activatePanel(item) {
899
+ if (item.disabled) return;
900
+ if (item.key === activePanel?.key) {
901
+ setOpen(!isOpen);
902
+ } else {
903
+ if (activeKey === void 0) setInternalActiveKey(item.key);
904
+ onActiveKeyChange?.(item.key);
905
+ if (!isOpen) setOpen(true);
906
+ }
907
+ }
857
908
  function setOpen(nextOpen) {
858
909
  if (open === void 0) setInternalOpen(nextOpen);
859
910
  onOpenChange?.(nextOpen);
@@ -892,23 +943,45 @@ function ToolPanel({
892
943
  const direction = event.key === "ArrowRight" ? 1 : -1;
893
944
  resize(size + (placement === "left" ? direction : -direction) * 12, true);
894
945
  }
895
- const titleText = typeof title === "string" ? title : "\u5DE5\u5177";
896
- const rail = /* @__PURE__ */ jsx6("div", { className: "sia-tool-panel__rail", children: /* @__PURE__ */ jsxs6(
897
- "button",
946
+ const titleText = typeof activePanel?.title === "string" ? activePanel.title : "\u5DE5\u5177";
947
+ const rail = /* @__PURE__ */ jsxs6("div", { ref: railRef, className: "sia-tool-panel__rail", children: [
948
+ /* @__PURE__ */ jsx6("span", { ref: indicatorRef, className: "sia-tool-panel__indicator", "aria-hidden": "true" }),
949
+ panels.map((item, index) => {
950
+ const expanded = isOpen && item.key === activePanel?.key;
951
+ const label = typeof item.title === "string" ? item.title : "\u5DE5\u5177";
952
+ return /* @__PURE__ */ jsxs6(
953
+ "button",
954
+ {
955
+ id: `${panelId}-activity-${index}`,
956
+ type: "button",
957
+ className: `sia-tool-panel__activity${expanded ? " is-active" : ""}`,
958
+ "aria-expanded": expanded,
959
+ "aria-controls": `${panelId}-content-${index}`,
960
+ "aria-label": `${expanded ? "\u6536\u8D77" : "\u5C55\u5F00"}${label}\u9762\u677F`,
961
+ title: typeof item.title === "string" ? item.title : void 0,
962
+ disabled: item.disabled,
963
+ onClick: () => activatePanel(item),
964
+ children: [
965
+ item.icon ? /* @__PURE__ */ jsx6("span", { className: "sia-tool-panel__activity-icon", children: item.icon }) : null,
966
+ /* @__PURE__ */ jsx6("span", { className: "sia-tool-panel__activity-label", children: item.title })
967
+ ]
968
+ },
969
+ item.key
970
+ );
971
+ })
972
+ ] });
973
+ const content = /* @__PURE__ */ jsx6("div", { className: "sia-tool-panel__content", hidden: !isOpen, "aria-hidden": !isOpen, children: panels.map((item, index) => /* @__PURE__ */ jsx6(
974
+ "div",
898
975
  {
899
- type: "button",
900
- className: `sia-tool-panel__activity${isOpen ? " is-active" : ""}`,
901
- "aria-expanded": isOpen,
902
- "aria-label": `${isOpen ? "\u6536\u8D77" : "\u5C55\u5F00"}${titleText}\u9762\u677F`,
903
- title: typeof title === "string" ? title : void 0,
904
- onClick: () => setOpen(!isOpen),
905
- children: [
906
- icon ? /* @__PURE__ */ jsx6("span", { className: "sia-tool-panel__activity-icon", children: icon }) : null,
907
- /* @__PURE__ */ jsx6("span", { className: "sia-tool-panel__activity-label", children: title })
908
- ]
909
- }
910
- ) });
911
- const content = /* @__PURE__ */ jsx6("div", { className: "sia-tool-panel__content", hidden: !isOpen, "aria-hidden": !isOpen, children });
976
+ id: `${panelId}-content-${index}`,
977
+ className: "sia-tool-panel__pane",
978
+ role: "region",
979
+ "aria-labelledby": `${panelId}-activity-${index}`,
980
+ hidden: !isOpen || item.key !== activePanel?.key,
981
+ children: item.children
982
+ },
983
+ item.key
984
+ )) });
912
985
  const resizeHandle = /* @__PURE__ */ jsx6(
913
986
  "div",
914
987
  {
@@ -1109,7 +1182,7 @@ function WindowTitleBar({
1109
1182
  }
1110
1183
 
1111
1184
  // src/components/Drawer.tsx
1112
- import { createContext, forwardRef, useCallback, useContext, useEffect as useEffect2, useId, useMemo as useMemo3, useRef as useRef3, useState as useState6 } from "react";
1185
+ import { createContext, forwardRef, useCallback, useContext, useEffect as useEffect2, useId as useId2, useMemo as useMemo3, useRef as useRef4, useState as useState6 } from "react";
1113
1186
  import { createRoot } from "react-dom/client";
1114
1187
  import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1115
1188
  var drawerHandles = /* @__PURE__ */ new Set();
@@ -1145,12 +1218,12 @@ var DrawerRoot = forwardRef(function Drawer({
1145
1218
  style,
1146
1219
  ...props
1147
1220
  }, forwardedRef) {
1148
- const localRef = useRef3(null);
1149
- const titleId = useId();
1150
- const drawerId = useId();
1221
+ const localRef = useRef4(null);
1222
+ const titleId = useId2();
1223
+ const drawerId = useId2();
1151
1224
  const parentStack = useContext(DrawerStackContext);
1152
- const afterOpenRef = useRef3(afterOpen);
1153
- const afterCloseRef = useRef3(afterClose);
1225
+ const afterOpenRef = useRef4(afterOpen);
1226
+ const afterCloseRef = useRef4(afterClose);
1154
1227
  afterOpenRef.current = afterOpen;
1155
1228
  afterCloseRef.current = afterClose;
1156
1229
  const [rendered, setRendered] = useState6(open);
@@ -1310,7 +1383,7 @@ var Drawer2 = Object.assign(DrawerRoot, {
1310
1383
  });
1311
1384
 
1312
1385
  // src/components/Form.tsx
1313
- import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef2, isValidElement as isValidElement2, useContext as useContext2, useEffect as useEffect3, useId as useId2, useMemo as useMemo4, useRef as useRef4, useSyncExternalStore } from "react";
1386
+ import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef2, isValidElement as isValidElement2, useContext as useContext2, useEffect as useEffect3, useId as useId3, useMemo as useMemo4, useRef as useRef5, useSyncExternalStore } from "react";
1314
1387
  import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1315
1388
  var Switch = forwardRef2(function Switch2({
1316
1389
  label,
@@ -1531,7 +1604,7 @@ var FormStore = class {
1531
1604
  };
1532
1605
  var FormContext = createContext2(null);
1533
1606
  function useForm(form) {
1534
- const ref = useRef4(form ?? new FormStore());
1607
+ const ref = useRef5(form ?? new FormStore());
1535
1608
  return [ref.current];
1536
1609
  }
1537
1610
  function FormRoot({
@@ -1589,8 +1662,8 @@ function FormItem({
1589
1662
  className = ""
1590
1663
  }) {
1591
1664
  const form = useContext2(FormContext);
1592
- const id = useId2();
1593
- const itemRef = useRef4(null);
1665
+ const id = useId3();
1666
+ const itemRef = useRef5(null);
1594
1667
  if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
1595
1668
  useSyncExternalStore(form.subscribe, form.getSnapshot, form.getSnapshot);
1596
1669
  const path = name === void 0 ? void 0 : pathArray(name);
@@ -1710,12 +1783,12 @@ var Form = Object.assign(FormRoot, {
1710
1783
  });
1711
1784
 
1712
1785
  // src/components/Radio.tsx
1713
- import { createContext as createContext3, forwardRef as forwardRef3, useContext as useContext3, useId as useId3, useMemo as useMemo5 } from "react";
1786
+ import { createContext as createContext3, forwardRef as forwardRef3, useContext as useContext3, useId as useId4, useMemo as useMemo5 } from "react";
1714
1787
  import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1715
1788
  var RadioContext = createContext3(null);
1716
1789
  var RadioRoot = forwardRef3(function Radio({ value, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
1717
1790
  const group = useContext3(RadioContext);
1718
- const fallbackId = useId3();
1791
+ const fallbackId = useId4();
1719
1792
  const grouped = group !== null;
1720
1793
  const currentChecked = grouped ? group.value === value : checked;
1721
1794
  return /* @__PURE__ */ jsxs10("label", { className: `sia-radio${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
@@ -1757,7 +1830,7 @@ function RadioGroup({
1757
1830
  children,
1758
1831
  onChange
1759
1832
  }) {
1760
- const fallbackName = useId3();
1833
+ const fallbackName = useId4();
1761
1834
  const [currentValue, setValue2] = useControllableState({
1762
1835
  value,
1763
1836
  defaultValue,
@@ -1902,7 +1975,7 @@ function Slider({
1902
1975
  }
1903
1976
 
1904
1977
  // src/components/ColorPicker.tsx
1905
- import { useEffect as useEffect4, useRef as useRef5, useState as useState8 } from "react";
1978
+ import { useEffect as useEffect4, useRef as useRef6, useState as useState8 } from "react";
1906
1979
  import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
1907
1980
  var DEFAULT_MODES = ["solid", "gradient"];
1908
1981
  var gradientStopSeed = 0;
@@ -1991,9 +2064,9 @@ function ColorPicker({
1991
2064
  onClear,
1992
2065
  ...props
1993
2066
  }) {
1994
- const rootRef = useRef5(null);
1995
- const popupRef = useRef5(null);
1996
- const lastEmittedValue = useRef5();
2067
+ const rootRef = useRef6(null);
2068
+ const popupRef = useRef6(null);
2069
+ const lastEmittedValue = useRef6();
1997
2070
  const initialGradient = parseGradient(value ?? defaultValue);
1998
2071
  const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
1999
2072
  const [open, setOpen] = useState8(false);
@@ -2216,7 +2289,7 @@ function ColorPicker({
2216
2289
  }
2217
2290
 
2218
2291
  // src/components/TimePicker.tsx
2219
- import { useEffect as useEffect5, useId as useId4, useRef as useRef6, useState as useState9 } from "react";
2292
+ import { useEffect as useEffect5, useId as useId5, useRef as useRef7, useState as useState9 } from "react";
2220
2293
  import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
2221
2294
  function seconds(value) {
2222
2295
  const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
@@ -2245,11 +2318,11 @@ function TimePicker({
2245
2318
  step,
2246
2319
  ...props
2247
2320
  }) {
2248
- const id = useId4();
2249
- const rootRef = useRef6(null);
2250
- const inputRef = useRef6(null);
2251
- const popupRef = useRef6(null);
2252
- const focusPanel = useRef6(false);
2321
+ const id = useId5();
2322
+ const rootRef = useRef7(null);
2323
+ const inputRef = useRef7(null);
2324
+ const popupRef = useRef7(null);
2325
+ const focusPanel = useRef7(false);
2253
2326
  const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
2254
2327
  const [open, setOpen] = useState9(false);
2255
2328
  const [draft, setDraft] = useState9("00:00:00");
@@ -2388,7 +2461,7 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
2388
2461
  })(TimePicker || (TimePicker = {}));
2389
2462
 
2390
2463
  // src/components/TreeSelect.tsx
2391
- import { useEffect as useEffect6, useMemo as useMemo6, useRef as useRef7, useState as useState10 } from "react";
2464
+ import { useEffect as useEffect6, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
2392
2465
  import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
2393
2466
  function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
2394
2467
  const result = [];
@@ -2450,8 +2523,8 @@ function TreeSelect({
2450
2523
  onDeselect,
2451
2524
  ...props
2452
2525
  }) {
2453
- const rootRef = useRef7(null);
2454
- const popupRef = useRef7(null);
2526
+ const rootRef = useRef8(null);
2527
+ const popupRef = useRef8(null);
2455
2528
  const nodeIndex = useMemo6(() => {
2456
2529
  const index = /* @__PURE__ */ new Map();
2457
2530
  const visit = (nodes) => nodes.forEach((node) => {
@@ -2706,7 +2779,7 @@ function buildFlatTree(items, options = {}) {
2706
2779
  }
2707
2780
 
2708
2781
  // src/components/Editor.tsx
2709
- import { useEffect as useEffect7, useId as useId5, useRef as useRef8, useState as useState11 } from "react";
2782
+ import { useEffect as useEffect7, useId as useId6, useRef as useRef9, useState as useState11 } from "react";
2710
2783
  import EditorWorker from "monaco-editor/editor/editor.worker.js?worker";
2711
2784
 
2712
2785
  // src/components/jsonLanguage.ts
@@ -3194,28 +3267,28 @@ function Editor({
3194
3267
  ariaLabel = "\u4EE3\u7801\u7F16\u8F91\u5668",
3195
3268
  loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
3196
3269
  }) {
3197
- const generatedId = useId5();
3198
- const containerRef = useRef8(null);
3199
- const rangeHighlightRef = useRef8(null);
3200
- const editorRef = useRef8(null);
3201
- const modelRef = useRef8(null);
3202
- const apiRef = useRef8(null);
3203
- const applyingControlledValueRef = useRef8(false);
3204
- const updateHighlightRef = useRef8(() => void 0);
3205
- const changeHandlerRef = useRef8(onChange);
3206
- const readyHandlerRef = useRef8(onReady);
3207
- const selectionHandlerRef = useRef8(onSelectionChange);
3208
- const keyDownHandlerRef = useRef8(onKeyDown);
3209
- const highlightRangeRef = useRef8(highlightRange);
3210
- const markersRef = useRef8(markers);
3211
- const contextMenuItemsRef = useRef8(contextMenuItems);
3212
- const completionProviderRef = useRef8(completionProvider);
3213
- const refreshSuggestionOnSpaceRef = useRef8(refreshSuggestionOnSpace);
3214
- const initialValueRef = useRef8(value);
3215
- const initialLanguageRef = useRef8(language);
3216
- const initialPathRef = useRef8(path);
3217
- const initialThemeRef = useRef8(theme);
3218
- const initialOptionsRef = useRef8(options);
3270
+ const generatedId = useId6();
3271
+ const containerRef = useRef9(null);
3272
+ const rangeHighlightRef = useRef9(null);
3273
+ const editorRef = useRef9(null);
3274
+ const modelRef = useRef9(null);
3275
+ const apiRef = useRef9(null);
3276
+ const applyingControlledValueRef = useRef9(false);
3277
+ const updateHighlightRef = useRef9(() => void 0);
3278
+ const changeHandlerRef = useRef9(onChange);
3279
+ const readyHandlerRef = useRef9(onReady);
3280
+ const selectionHandlerRef = useRef9(onSelectionChange);
3281
+ const keyDownHandlerRef = useRef9(onKeyDown);
3282
+ const highlightRangeRef = useRef9(highlightRange);
3283
+ const markersRef = useRef9(markers);
3284
+ const contextMenuItemsRef = useRef9(contextMenuItems);
3285
+ const completionProviderRef = useRef9(completionProvider);
3286
+ const refreshSuggestionOnSpaceRef = useRef9(refreshSuggestionOnSpace);
3287
+ const initialValueRef = useRef9(value);
3288
+ const initialLanguageRef = useRef9(language);
3289
+ const initialPathRef = useRef9(path);
3290
+ const initialThemeRef = useRef9(theme);
3291
+ const initialOptionsRef = useRef9(options);
3219
3292
  const [loading, setLoading] = useState11(true);
3220
3293
  const [, setSelectionVersion] = useState11(0);
3221
3294
  initialValueRef.current = value;
@@ -3753,12 +3826,12 @@ function Editor({
3753
3826
  }
3754
3827
 
3755
3828
  // src/components/Markdown.tsx
3756
- import { useEffect as useEffect8, useMemo as useMemo7, useRef as useRef9, useState as useState12 } from "react";
3829
+ import { useEffect as useEffect8, useMemo as useMemo7, useRef as useRef10, useState as useState12 } from "react";
3757
3830
  import DOMPurify from "dompurify";
3758
3831
  import { marked } from "marked";
3759
3832
  import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
3760
3833
  function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
3761
- const rootRef = useRef9(null);
3834
+ const rootRef = useRef10(null);
3762
3835
  const [previewImage, setPreviewImage] = useState12(null);
3763
3836
  const html = useMemo7(() => {
3764
3837
  const rendered = marked.parse(content, { breaks: true, gfm: true });
@@ -3833,7 +3906,7 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
3833
3906
  }
3834
3907
 
3835
3908
  // src/components/InputNumber.tsx
3836
- import { forwardRef as forwardRef4, useEffect as useEffect9, useId as useId6, useRef as useRef10, useState as useState13 } from "react";
3909
+ import { forwardRef as forwardRef4, useEffect as useEffect9, useId as useId7, useRef as useRef11, useState as useState13 } from "react";
3837
3910
  import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
3838
3911
  function formatValue(value, precision) {
3839
3912
  if (value === null || !Number.isFinite(value)) return "";
@@ -3862,9 +3935,9 @@ var InputNumber = forwardRef4(function InputNumber2({
3862
3935
  onKeyDown,
3863
3936
  ...props
3864
3937
  }, forwardedRef) {
3865
- const fallbackId = useId6();
3938
+ const fallbackId = useId7();
3866
3939
  const inputId = id ?? fallbackId;
3867
- const localRef = useRef10(null);
3940
+ const localRef = useRef11(null);
3868
3941
  const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
3869
3942
  const [text, setText] = useState13(() => formatValue(currentValue, precision));
3870
3943
  useEffect9(() => {
@@ -3959,7 +4032,7 @@ var InputNumber = forwardRef4(function InputNumber2({
3959
4032
  });
3960
4033
 
3961
4034
  // src/components/Treemap.tsx
3962
- import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef11, useState as useState14 } from "react";
4035
+ import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef12, useState as useState14 } from "react";
3963
4036
  import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
3964
4037
  function positiveValue(value) {
3965
4038
  return Number.isFinite(value) && value > 0 ? value : 1;
@@ -4246,7 +4319,7 @@ function Treemap({
4246
4319
  style,
4247
4320
  ...props
4248
4321
  }) {
4249
- const containerRef = useRef11(null);
4322
+ const containerRef = useRef12(null);
4250
4323
  const [size, setSize] = useState14({ width: 0, height: 0 });
4251
4324
  const [internalExpandedKeys, setInternalExpandedKeys] = useState14(() => [...defaultExpandedKeys]);
4252
4325
  const [internalFocusedKey, setInternalFocusedKey] = useState14(defaultFocusedKey);
@@ -4460,13 +4533,13 @@ function useScrollbarProximity() {
4460
4533
  }
4461
4534
 
4462
4535
  // src/components/Table/TableCellContent.tsx
4463
- import { useLayoutEffect, useRef as useRef12, useState as useState15 } from "react";
4536
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef13, useState as useState15 } from "react";
4464
4537
  import { jsx as jsx19 } from "react/jsx-runtime";
4465
4538
  function TableCellContent({ children, ellipsis, title }) {
4466
- const ref = useRef12(null);
4539
+ const ref = useRef13(null);
4467
4540
  const [overflowing, setOverflowing] = useState15(false);
4468
4541
  const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
4469
- useLayoutEffect(() => {
4542
+ useLayoutEffect2(() => {
4470
4543
  const element = ref.current;
4471
4544
  if (!element || !ellipsis || !customContent) return;
4472
4545
  const layouts = [];
@@ -4498,10 +4571,10 @@ function TableCellContent({ children, ellipsis, title }) {
4498
4571
  }
4499
4572
 
4500
4573
  // src/components/Table/Table.tsx
4501
- import { Fragment as Fragment7, forwardRef as forwardRef5, memo, useCallback as useCallback2, useEffect as useEffect13, useImperativeHandle, useMemo as useMemo9, useRef as useRef14, useState as useState17 } from "react";
4574
+ import { Fragment as Fragment7, forwardRef as forwardRef5, memo, useCallback as useCallback2, useEffect as useEffect13, useImperativeHandle, useMemo as useMemo9, useRef as useRef15, useState as useState17 } from "react";
4502
4575
 
4503
4576
  // src/components/Table/plugins.tsx
4504
- import { isValidElement as isValidElement3, useEffect as useEffect12, useRef as useRef13, useState as useState16 } from "react";
4577
+ import { isValidElement as isValidElement3, useEffect as useEffect12, useRef as useRef14, useState as useState16 } from "react";
4505
4578
 
4506
4579
  // src/components/Table/utils.ts
4507
4580
  var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
@@ -5518,11 +5591,11 @@ function EditableTableCell({
5518
5591
  const config = typeof editable === "object" ? editable : { type: "input" };
5519
5592
  const [editValue, setEditValue] = useState16(value);
5520
5593
  const [saving, setSaving] = useState16(false);
5521
- const inputRef = useRef13(null);
5522
- const editorRef = useRef13(null);
5523
- const editValueRef = useRef13(value);
5524
- const savingRef = useRef13(false);
5525
- const saveRef = useRef13(async () => {
5594
+ const inputRef = useRef14(null);
5595
+ const editorRef = useRef14(null);
5596
+ const editValueRef = useRef14(value);
5597
+ const savingRef = useRef14(false);
5598
+ const saveRef = useRef14(async () => {
5526
5599
  });
5527
5600
  useEffect12(() => {
5528
5601
  if (!active) return;
@@ -5715,7 +5788,7 @@ function applyColumnSettingsToTree(columns, items) {
5715
5788
  }
5716
5789
  function ColumnSettingPanel({ open, items, columns, onClose, onApply }) {
5717
5790
  const [draft, setDraft] = useState16(items);
5718
- const dragIndex = useRef13(null);
5791
+ const dragIndex = useRef14(null);
5719
5792
  useEffect12(() => {
5720
5793
  if (open) setDraft(items);
5721
5794
  }, [items, open]);
@@ -5829,11 +5902,21 @@ function createColumnSettingPlugin(options = {}) {
5829
5902
  disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
5830
5903
  }))
5831
5904
  ];
5832
- return /* @__PURE__ */ jsx20(Dropdown, { trigger: ["hover", "click"], placement: "bottomRight", popupClassName: "sia-table__settings-dropdown", menu: { items, onClick: ({ key }) => {
5905
+ return /* @__PURE__ */ jsx20(Dropdown, { disabled: options.buttonProps?.disabled || options.buttonProps?.loading, trigger: ["hover", "click"], placement: "bottomRight", popupClassName: "sia-table__settings-dropdown", menu: { items, onClick: ({ key }) => {
5833
5906
  if (key === "builtin:export") void exportApi().download();
5834
5907
  else if (key === "builtin:columns") context.setState((state) => ({ ...state, open: true }));
5835
5908
  else void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
5836
- } }, children: /* @__PURE__ */ jsx20(Button, { size: "small", variant: "text", className: "sia-table__toolbar-icon", icon: /* @__PURE__ */ jsx20(Icon, { name: "settings", size: 16 }), "aria-label": "\u8868\u683C\u8BBE\u7F6E" }) });
5909
+ } }, children: /* @__PURE__ */ jsx20(
5910
+ Button,
5911
+ {
5912
+ size: "small",
5913
+ variant: "text",
5914
+ icon: /* @__PURE__ */ jsx20(Icon, { name: "settings", size: 16 }),
5915
+ "aria-label": "\u8868\u683C\u8BBE\u7F6E",
5916
+ ...options.buttonProps,
5917
+ className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
5918
+ }
5919
+ ) });
5837
5920
  },
5838
5921
  renderOverlay: (context) => /* @__PURE__ */ jsx20(ColumnSettingPanel, { open: context.state.open, items: currentItems(context), columns: context.baseColumns, onClose: () => context.setState((state) => ({ ...state, open: false })), onApply: (items) => apply(items, context) }),
5839
5922
  getApi: (context) => ({ open: () => context.setState((state) => ({ ...state, open: true })), close: () => context.setState((state) => ({ ...state, open: false })), getSettings: () => currentItems(context), apply: (items) => apply(items, context) })
@@ -6156,11 +6239,11 @@ function TableInner(props, ref) {
6156
6239
  style,
6157
6240
  ...htmlProps
6158
6241
  } = props;
6159
- const rootRef = useRef14(null);
6160
- const scrollRef = useRef14(null);
6161
- const tableRef = useRef14(null);
6242
+ const rootRef = useRef15(null);
6243
+ const scrollRef = useRef15(null);
6244
+ const tableRef = useRef15(null);
6162
6245
  useScrollbarProximity();
6163
- const scrollbarDragRef = useRef14(null);
6246
+ const scrollbarDragRef = useRef15(null);
6164
6247
  const [internalLoading, setInternalLoading] = useState17(false);
6165
6248
  const [scrollTop, setScrollTop] = useState17(0);
6166
6249
  const [viewportHeight, setViewportHeight] = useState17(420);
@@ -6176,14 +6259,14 @@ function TableInner(props, ref) {
6176
6259
  return plugins;
6177
6260
  }, [builtInHighlightPlugin, builtInResizePlugin, providedPlugins, resizable]);
6178
6261
  const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
6179
- const pluginsByIdRef = useRef14(/* @__PURE__ */ new Map());
6262
+ const pluginsByIdRef = useRef15(/* @__PURE__ */ new Map());
6180
6263
  pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
6181
6264
  const [pluginStates, setPluginStates] = useState17(() => Object.fromEntries(
6182
6265
  sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
6183
6266
  ));
6184
- const pluginApisRef = useRef14({});
6185
- const contextsRef = useRef14(/* @__PURE__ */ new Map());
6186
- const mountedPluginsRef = useRef14(/* @__PURE__ */ new Map());
6267
+ const pluginApisRef = useRef15({});
6268
+ const contextsRef = useRef15(/* @__PURE__ */ new Map());
6269
+ const mountedPluginsRef = useRef15(/* @__PURE__ */ new Map());
6187
6270
  const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
6188
6271
  const nextApis = {};
6189
6272
  const contexts = /* @__PURE__ */ new Map();
@@ -7096,7 +7179,7 @@ function applySiaTheme(mode, target = document.documentElement) {
7096
7179
  }
7097
7180
 
7098
7181
  // src/components/InputSelect.tsx
7099
- import { forwardRef as forwardRef7, useEffect as useEffect15, useRef as useRef15, useState as useState18 } from "react";
7182
+ import { forwardRef as forwardRef7, useEffect as useEffect15, useRef as useRef16, useState as useState18 } from "react";
7100
7183
  import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
7101
7184
  var InputSelect = forwardRef7(function InputSelect2({
7102
7185
  options,
@@ -7136,9 +7219,9 @@ var InputSelect = forwardRef7(function InputSelect2({
7136
7219
  const [modalOpen, setModalOpen] = useState18(false);
7137
7220
  const [modalValues, setModalValues] = useState18([]);
7138
7221
  const [selectedOnly, setSelectedOnly] = useState18(false);
7139
- const rootRef = useRef15(null);
7140
- const popupRef = useRef15(null);
7141
- const inputRef = useRef15(null);
7222
+ const rootRef = useRef16(null);
7223
+ const popupRef = useRef16(null);
7224
+ const inputRef = useRef16(null);
7142
7225
  const config = typeof enableModal === "object" ? enableModal : {};
7143
7226
  function changeOpen(next) {
7144
7227
  if (next && (disabled || loading)) return;
@@ -2756,6 +2756,7 @@ var Select = (0, import_react14.forwardRef)(function Select2({
2756
2756
  optionHeight = showValue ? 54 : 34,
2757
2757
  disabled,
2758
2758
  className = "",
2759
+ style,
2759
2760
  id,
2760
2761
  notFoundContent = "\u6682\u65E0\u6570\u636E",
2761
2762
  onKeyDown,
@@ -2986,7 +2987,7 @@ var Select = (0, import_react14.forwardRef)(function Select2({
2986
2987
  setModalValues([...modalValues.filter((value2) => !editable.has(value2)), ...modalEnabled.filter((option) => operation === "all" || operation === "invert" && !modalValues.includes(option.value)).map((option) => option.value)]);
2987
2988
  }
2988
2989
  const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: hasValue, active: open });
2989
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ref: rootRef, className: `sia-select sia-select--${size} sia-select--${status}${open ? " is-open" : ""}${disabled ? " is-disabled" : ""}${multiple ? " sia-select--multiple" : ""} ${className}`.trim(), children: [
2990
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ref: rootRef, className: `sia-select sia-select--${size} sia-select--${status}${open ? " is-open" : ""}${disabled ? " is-disabled" : ""}${multiple ? " sia-select--multiple" : ""} ${className}`.trim(), style, children: [
2990
2991
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2991
2992
  "button",
2992
2993
  {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SelectDateRange
3
- } from "./chunk-T2X6WK6Z.js";
4
- import "./chunk-SGJLZN23.js";
3
+ } from "./chunk-RLTG3IK7.js";
4
+ import "./chunk-BUMS62NO.js";
5
5
  import "./chunk-JJVD2ITI.js";
6
6
  import "./chunk-MBS2HXLZ.js";
7
7
  import "./chunk-EJDPRAU2.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",