@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.cjs CHANGED
@@ -2905,6 +2905,7 @@ var Select = (0, import_react15.forwardRef)(function Select2({
2905
2905
  optionHeight = showValue ? 54 : 34,
2906
2906
  disabled,
2907
2907
  className = "",
2908
+ style,
2908
2909
  id,
2909
2910
  notFoundContent = "\u6682\u65E0\u6570\u636E",
2910
2911
  onKeyDown,
@@ -3135,7 +3136,7 @@ var Select = (0, import_react15.forwardRef)(function Select2({
3135
3136
  setModalValues([...modalValues.filter((value2) => !editable.has(value2)), ...modalEnabled.filter((option) => operation === "all" || operation === "invert" && !modalValues.includes(option.value)).map((option) => option.value)]);
3136
3137
  }
3137
3138
  const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: hasValue, active: open });
3138
- return /* @__PURE__ */ (0, import_jsx_runtime15.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: [
3139
+ return /* @__PURE__ */ (0, import_jsx_runtime15.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: [
3139
3140
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3140
3141
  "button",
3141
3142
  {
@@ -4517,6 +4518,10 @@ function clamp3(value, min, max) {
4517
4518
  function ToolPanel({
4518
4519
  title,
4519
4520
  icon,
4521
+ items,
4522
+ activeKey,
4523
+ defaultActiveKey,
4524
+ onActiveKeyChange,
4520
4525
  placement = "left",
4521
4526
  open,
4522
4527
  defaultOpen = true,
@@ -4531,9 +4536,56 @@ function ToolPanel({
4531
4536
  children,
4532
4537
  ...props
4533
4538
  }) {
4539
+ const panelId = (0, import_react23.useId)();
4540
+ const [internalActiveKey, setInternalActiveKey] = (0, import_react23.useState)(defaultActiveKey);
4534
4541
  const [internalOpen, setInternalOpen] = (0, import_react23.useState)(defaultOpen);
4535
4542
  const [size, setSize] = (0, import_react23.useState)(() => clamp3(defaultSize, minSize, maxSize));
4536
- const isOpen = open ?? internalOpen;
4543
+ const panels = items ?? [{ key: "single", title, icon, children }];
4544
+ const requestedKey = activeKey ?? internalActiveKey;
4545
+ const activePanel = panels.find((item) => item.key === requestedKey && !item.disabled) ?? panels.find((item) => !item.disabled);
4546
+ const isOpen = (open ?? internalOpen) && Boolean(activePanel);
4547
+ const railRef = (0, import_react23.useRef)(null);
4548
+ const indicatorRef = (0, import_react23.useRef)(null);
4549
+ (0, import_react23.useLayoutEffect)(() => {
4550
+ const rail2 = railRef.current;
4551
+ const indicator = indicatorRef.current;
4552
+ if (!rail2 || !indicator) return;
4553
+ function updateIndicator() {
4554
+ if (!rail2 || !indicator) return;
4555
+ const active = rail2.querySelector(".sia-tool-panel__activity.is-active");
4556
+ if (!active) {
4557
+ indicator.style.visibility = "hidden";
4558
+ delete indicator.dataset.ready;
4559
+ return;
4560
+ }
4561
+ const railRect = rail2.getBoundingClientRect();
4562
+ const rect = active.getBoundingClientRect();
4563
+ const x = rect.left - railRect.left - rail2.clientLeft + rail2.scrollLeft + (placement === "left" ? rect.width - 3 : 0);
4564
+ const y = rect.top - railRect.top - rail2.clientTop + rail2.scrollTop;
4565
+ indicator.style.transform = `translate(${x}px, ${y}px)`;
4566
+ indicator.style.height = `${rect.height}px`;
4567
+ indicator.style.visibility = "visible";
4568
+ if (!indicator.dataset.ready) {
4569
+ indicator.getBoundingClientRect();
4570
+ indicator.dataset.ready = "true";
4571
+ }
4572
+ }
4573
+ updateIndicator();
4574
+ const observer = new ResizeObserver(updateIndicator);
4575
+ observer.observe(rail2);
4576
+ rail2.querySelectorAll(".sia-tool-panel__activity").forEach((item) => observer.observe(item));
4577
+ return () => observer.disconnect();
4578
+ }, [isOpen, activePanel?.key, items, title, icon, placement]);
4579
+ function activatePanel(item) {
4580
+ if (item.disabled) return;
4581
+ if (item.key === activePanel?.key) {
4582
+ setOpen(!isOpen);
4583
+ } else {
4584
+ if (activeKey === void 0) setInternalActiveKey(item.key);
4585
+ onActiveKeyChange?.(item.key);
4586
+ if (!isOpen) setOpen(true);
4587
+ }
4588
+ }
4537
4589
  function setOpen(nextOpen) {
4538
4590
  if (open === void 0) setInternalOpen(nextOpen);
4539
4591
  onOpenChange?.(nextOpen);
@@ -4572,23 +4624,45 @@ function ToolPanel({
4572
4624
  const direction = event.key === "ArrowRight" ? 1 : -1;
4573
4625
  resize(size + (placement === "left" ? direction : -direction) * 12, true);
4574
4626
  }
4575
- const titleText = typeof title === "string" ? title : "\u5DE5\u5177";
4576
- const rail = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "sia-tool-panel__rail", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4577
- "button",
4627
+ const titleText = typeof activePanel?.title === "string" ? activePanel.title : "\u5DE5\u5177";
4628
+ const rail = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { ref: railRef, className: "sia-tool-panel__rail", children: [
4629
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { ref: indicatorRef, className: "sia-tool-panel__indicator", "aria-hidden": "true" }),
4630
+ panels.map((item, index) => {
4631
+ const expanded = isOpen && item.key === activePanel?.key;
4632
+ const label = typeof item.title === "string" ? item.title : "\u5DE5\u5177";
4633
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4634
+ "button",
4635
+ {
4636
+ id: `${panelId}-activity-${index}`,
4637
+ type: "button",
4638
+ className: `sia-tool-panel__activity${expanded ? " is-active" : ""}`,
4639
+ "aria-expanded": expanded,
4640
+ "aria-controls": `${panelId}-content-${index}`,
4641
+ "aria-label": `${expanded ? "\u6536\u8D77" : "\u5C55\u5F00"}${label}\u9762\u677F`,
4642
+ title: typeof item.title === "string" ? item.title : void 0,
4643
+ disabled: item.disabled,
4644
+ onClick: () => activatePanel(item),
4645
+ children: [
4646
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sia-tool-panel__activity-icon", children: item.icon }) : null,
4647
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sia-tool-panel__activity-label", children: item.title })
4648
+ ]
4649
+ },
4650
+ item.key
4651
+ );
4652
+ })
4653
+ ] });
4654
+ const content = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "sia-tool-panel__content", hidden: !isOpen, "aria-hidden": !isOpen, children: panels.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4655
+ "div",
4578
4656
  {
4579
- type: "button",
4580
- className: `sia-tool-panel__activity${isOpen ? " is-active" : ""}`,
4581
- "aria-expanded": isOpen,
4582
- "aria-label": `${isOpen ? "\u6536\u8D77" : "\u5C55\u5F00"}${titleText}\u9762\u677F`,
4583
- title: typeof title === "string" ? title : void 0,
4584
- onClick: () => setOpen(!isOpen),
4585
- children: [
4586
- icon ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sia-tool-panel__activity-icon", children: icon }) : null,
4587
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sia-tool-panel__activity-label", children: title })
4588
- ]
4589
- }
4590
- ) });
4591
- const content = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "sia-tool-panel__content", hidden: !isOpen, "aria-hidden": !isOpen, children });
4657
+ id: `${panelId}-content-${index}`,
4658
+ className: "sia-tool-panel__pane",
4659
+ role: "region",
4660
+ "aria-labelledby": `${panelId}-activity-${index}`,
4661
+ hidden: !isOpen || item.key !== activePanel?.key,
4662
+ children: item.children
4663
+ },
4664
+ item.key
4665
+ )) });
4592
4666
  const resizeHandle = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4593
4667
  "div",
4594
4668
  {
@@ -9535,6 +9609,38 @@ function Tabs({
9535
9609
  const enabledItems = (0, import_react40.useMemo)(() => items.filter((item) => !item.disabled), [items]);
9536
9610
  const resolvedPosition = tabPosition ?? (orientation === "vertical" ? "left" : "top");
9537
9611
  const resolvedOrientation = resolvedPosition === "left" || resolvedPosition === "right" ? "vertical" : "horizontal";
9612
+ const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
9613
+ const listRef = (0, import_react40.useRef)(null);
9614
+ const indicatorRef = (0, import_react40.useRef)(null);
9615
+ (0, import_react40.useLayoutEffect)(() => {
9616
+ if (!sliding) return;
9617
+ const list = listRef.current;
9618
+ const indicator = indicatorRef.current;
9619
+ if (!list || !indicator) return;
9620
+ function updateIndicator() {
9621
+ if (!list || !indicator) return;
9622
+ const active = list.querySelector('[role="tab"][aria-selected="true"]');
9623
+ if (!active) {
9624
+ indicator.style.visibility = "hidden";
9625
+ return;
9626
+ }
9627
+ const listRect = list.getBoundingClientRect();
9628
+ const rect = active.getBoundingClientRect();
9629
+ indicator.style.transform = `translate(${rect.left - listRect.left - list.clientLeft + list.scrollLeft}px, ${rect.top - listRect.top - list.clientTop + list.scrollTop}px)`;
9630
+ indicator.style.width = `${rect.width}px`;
9631
+ indicator.style.height = `${rect.height}px`;
9632
+ indicator.style.visibility = "visible";
9633
+ if (!indicator.dataset.ready) {
9634
+ indicator.getBoundingClientRect();
9635
+ indicator.dataset.ready = "true";
9636
+ }
9637
+ }
9638
+ updateIndicator();
9639
+ const observer = new ResizeObserver(updateIndicator);
9640
+ observer.observe(list);
9641
+ list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
9642
+ return () => observer.disconnect();
9643
+ }, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable]);
9538
9644
  function selectTab(key) {
9539
9645
  if (key === selectedKey) return;
9540
9646
  if (activeKey === void 0) setInternalActiveKey(key);
@@ -9560,7 +9666,7 @@ function Tabs({
9560
9666
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9561
9667
  "div",
9562
9668
  {
9563
- className: `sia-tabs sia-tabs--${type} sia-tabs--${size} sia-tabs--${resolvedOrientation} sia-tabs--${resolvedPosition}${centered ? " sia-tabs--centered" : ""} ${className}`.trim(),
9669
+ className: `sia-tabs sia-tabs--${type}${type === "underline" ? " sia-tabs--line" : ""} sia-tabs--${size} sia-tabs--${resolvedOrientation} sia-tabs--${resolvedPosition}${centered ? " sia-tabs--centered" : ""} ${className}`.trim(),
9564
9670
  ...props,
9565
9671
  children: [
9566
9672
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "sia-tabs__header", children: [
@@ -9568,77 +9674,96 @@ function Tabs({
9568
9674
  tabBarTitle,
9569
9675
  type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("svg", { className: "sia-tabs__title-connector", viewBox: "0 0 32 40", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("path", { d: "M0 39 H5 Q8 39 10 35 L28 3 Q29 1 32 1", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }) }) : null
9570
9676
  ] }) : null,
9571
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "sia-tabs__list", role: "tablist", "aria-orientation": resolvedOrientation, children: items.map((item) => {
9572
- const selected = item.key === selectedKey;
9573
- const canClose = item.closable ?? closable;
9574
- const tabNode = /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, children: [
9575
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9576
- "button",
9677
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { ref: listRef, className: `sia-tabs__list${sliding ? " sia-tabs__list--sliding" : ""}`, role: "tablist", "aria-orientation": resolvedOrientation, children: [
9678
+ sliding ? /* @__PURE__ */ (0, import_jsx_runtime44.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_runtime44.jsxs)("svg", { className: "sia-tabs__indicator-shape", viewBox: "0 0 100 34", preserveAspectRatio: "none", "aria-hidden": "true", children: [
9679
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("linearGradient", { id: `${baseId}-tab-fill-indicator`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
9680
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("stop", { offset: "0", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" }),
9681
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("stop", { offset: ".53", stopColor: "var(--sia-tabs-line-fill-center, var(--sia-tabs-line-fill))" }),
9682
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("stop", { offset: "1", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" })
9683
+ ] }) }),
9684
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9685
+ "path",
9577
9686
  {
9578
- id: `${baseId}-tab-${item.key}`,
9579
- type: "button",
9580
- className: "sia-tabs__tab",
9581
- role: "tab",
9582
- "aria-selected": selected,
9583
- "aria-controls": hasPanels ? `${baseId}-panel-${item.key}` : void 0,
9584
- tabIndex: selected ? 0 : -1,
9585
- disabled: item.disabled,
9586
- onClick: () => selectTab(item.key),
9587
- onKeyDown: (event) => handleKeyDown(event, item.key),
9588
- children: [
9589
- type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("svg", { className: "sia-tabs__tab-shape", viewBox: "0 0 100 34", preserveAspectRatio: "none", "aria-hidden": "true", children: [
9590
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("linearGradient", { id: `${baseId}-tab-fill-${item.key}`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
9591
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("stop", { offset: "0", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" }),
9592
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("stop", { offset: ".53", stopColor: "var(--sia-tabs-line-fill-center, var(--sia-tabs-line-fill))" }),
9593
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("stop", { offset: "1", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" })
9594
- ] }) }),
9595
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9596
- "path",
9597
- {
9598
- 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",
9599
- fill: `url(#${baseId}-tab-fill-${item.key})`,
9600
- stroke: "currentColor",
9601
- strokeWidth: "1.5",
9602
- vectorEffect: "non-scaling-stroke"
9603
- }
9604
- )
9605
- ] }) : null,
9606
- item.icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "sia-tabs__icon", children: item.icon }) : null,
9607
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: item.label })
9608
- ]
9687
+ 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",
9688
+ fill: `url(#${baseId}-tab-fill-indicator)`,
9689
+ stroke: "currentColor",
9690
+ strokeWidth: "1.5",
9691
+ vectorEffect: "non-scaling-stroke"
9609
9692
  }
9610
- ),
9611
- canClose ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9612
- "button",
9693
+ )
9694
+ ] }) : null }, type) : null,
9695
+ items.map((item) => {
9696
+ const selected = item.key === selectedKey;
9697
+ const canClose = item.closable ?? closable;
9698
+ const tabNode = /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, children: [
9699
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9700
+ "button",
9701
+ {
9702
+ id: `${baseId}-tab-${item.key}`,
9703
+ type: "button",
9704
+ className: "sia-tabs__tab",
9705
+ role: "tab",
9706
+ "aria-selected": selected,
9707
+ "aria-controls": hasPanels ? `${baseId}-panel-${item.key}` : void 0,
9708
+ tabIndex: selected ? 0 : -1,
9709
+ disabled: item.disabled,
9710
+ onClick: () => selectTab(item.key),
9711
+ onKeyDown: (event) => handleKeyDown(event, item.key),
9712
+ children: [
9713
+ type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("svg", { className: "sia-tabs__tab-shape", viewBox: "0 0 100 34", preserveAspectRatio: "none", "aria-hidden": "true", children: [
9714
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("linearGradient", { id: `${baseId}-tab-fill-${item.key}`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
9715
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("stop", { offset: "0", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" }),
9716
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("stop", { offset: ".53", stopColor: "var(--sia-tabs-line-fill-center, var(--sia-tabs-line-fill))" }),
9717
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("stop", { offset: "1", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" })
9718
+ ] }) }),
9719
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9720
+ "path",
9721
+ {
9722
+ 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",
9723
+ fill: `url(#${baseId}-tab-fill-${item.key})`,
9724
+ stroke: "currentColor",
9725
+ strokeWidth: "1.5",
9726
+ vectorEffect: "non-scaling-stroke"
9727
+ }
9728
+ )
9729
+ ] }) : null,
9730
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "sia-tabs__icon", children: item.icon }) : null,
9731
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: item.label })
9732
+ ]
9733
+ }
9734
+ ),
9735
+ canClose ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9736
+ "button",
9737
+ {
9738
+ type: "button",
9739
+ className: "sia-tabs__close",
9740
+ "aria-label": `\u5173\u95ED${typeof item.label === "string" ? item.label : "\u6807\u7B7E\u9875"}`,
9741
+ disabled: item.disabled,
9742
+ onClick: () => onEdit?.(item.key, "remove"),
9743
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: "close", size: 12 })
9744
+ }
9745
+ ) : null
9746
+ ] }, item.key);
9747
+ const contextMenuItems = typeof tabContextMenu === "function" ? tabContextMenu(item) : tabContextMenu;
9748
+ if (!contextMenuItems?.length) return tabNode;
9749
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9750
+ Dropdown,
9613
9751
  {
9614
- type: "button",
9615
- className: "sia-tabs__close",
9616
- "aria-label": `\u5173\u95ED${typeof item.label === "string" ? item.label : "\u6807\u7B7E\u9875"}`,
9617
- disabled: item.disabled,
9618
- onClick: () => onEdit?.(item.key, "remove"),
9619
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: "close", size: 12 })
9620
- }
9621
- ) : null
9622
- ] }, item.key);
9623
- const contextMenuItems = typeof tabContextMenu === "function" ? tabContextMenu(item) : tabContextMenu;
9624
- if (!contextMenuItems?.length) return tabNode;
9625
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9626
- Dropdown,
9627
- {
9628
- className: "sia-tabs__tab-context-trigger",
9629
- popupClassName: "sia-tabs__tab-context-menu",
9630
- trigger: ["contextMenu"],
9631
- tabIndex: -1,
9632
- menu: {
9633
- items: contextMenuItems,
9634
- selectable: false,
9635
- onClick: (info) => onTabContextMenuClick?.({ ...info, tabKey: item.key, tab: item })
9752
+ className: "sia-tabs__tab-context-trigger",
9753
+ popupClassName: "sia-tabs__tab-context-menu",
9754
+ trigger: ["contextMenu"],
9755
+ tabIndex: -1,
9756
+ menu: {
9757
+ items: contextMenuItems,
9758
+ selectable: false,
9759
+ onClick: (info) => onTabContextMenuClick?.({ ...info, tabKey: item.key, tab: item })
9760
+ },
9761
+ children: tabNode
9636
9762
  },
9637
- children: tabNode
9638
- },
9639
- item.key
9640
- );
9641
- }) }),
9763
+ item.key
9764
+ );
9765
+ })
9766
+ ] }),
9642
9767
  tabBarExtraContent ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "sia-tabs__extra", children: tabBarExtraContent }) : null
9643
9768
  ] }),
9644
9769
  hasPanels ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "sia-tabs__panels", children: items.map((item) => {
@@ -11534,11 +11659,21 @@ function createColumnSettingPlugin(options = {}) {
11534
11659
  disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
11535
11660
  }))
11536
11661
  ];
11537
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Dropdown, { trigger: ["hover", "click"], placement: "bottomRight", popupClassName: "sia-table__settings-dropdown", menu: { items, onClick: ({ key }) => {
11662
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Dropdown, { disabled: options.buttonProps?.disabled || options.buttonProps?.loading, trigger: ["hover", "click"], placement: "bottomRight", popupClassName: "sia-table__settings-dropdown", menu: { items, onClick: ({ key }) => {
11538
11663
  if (key === "builtin:export") void exportApi().download();
11539
11664
  else if (key === "builtin:columns") context.setState((state) => ({ ...state, open: true }));
11540
11665
  else void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
11541
- } }, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { size: "small", variant: "text", className: "sia-table__toolbar-icon", icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: "settings", size: 16 }), "aria-label": "\u8868\u683C\u8BBE\u7F6E" }) });
11666
+ } }, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11667
+ Button,
11668
+ {
11669
+ size: "small",
11670
+ variant: "text",
11671
+ icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: "settings", size: 16 }),
11672
+ "aria-label": "\u8868\u683C\u8BBE\u7F6E",
11673
+ ...options.buttonProps,
11674
+ className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
11675
+ }
11676
+ ) });
11542
11677
  },
11543
11678
  renderOverlay: (context) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ColumnSettingPanel, { open: context.state.open, items: currentItems(context), columns: context.baseColumns, onClose: () => context.setState((state) => ({ ...state, open: false })), onApply: (items) => apply(items, context) }),
11544
11679
  getApi: (context) => ({ open: () => context.setState((state) => ({ ...state, open: true })), close: () => context.setState((state) => ({ ...state, open: false })), getSettings: () => currentItems(context), apply: (items) => apply(items, context) })
package/dist/index.css CHANGED
@@ -4121,12 +4121,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4121
4121
  }
4122
4122
  }
4123
4123
  .sia-table__settings-dropdown .sia-menu__item {
4124
- min-height: 44px;
4125
- padding: 10px 16px;
4126
- gap: 12px;
4124
+ min-height: 34px;
4125
+ padding: 4px 12px;
4126
+ gap: 10px;
4127
+ font-size: 14px;
4128
+ line-height: 24px;
4127
4129
  }
4128
4130
  .sia-table__settings-dropdown .sia-menu__divider {
4129
- margin: 8px 12px;
4131
+ margin: 4px 8px;
4130
4132
  }
4131
4133
  .sia-table--borderless-toolbar {
4132
4134
  border: 0;
@@ -4263,6 +4265,184 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4263
4265
  white-space: nowrap;
4264
4266
  text-overflow: ellipsis;
4265
4267
  }
4268
+ .sia-tabs--capsule,
4269
+ .sia-tabs--underline {
4270
+ --sia-tabs-accent: var(--sia-color-primary);
4271
+ --sia-tabs-selection-bg: var(--sia-color-primary-light);
4272
+ }
4273
+ .sia-tabs--capsule .sia-tabs__list {
4274
+ position: relative;
4275
+ isolation: isolate;
4276
+ flex: 0 1 auto;
4277
+ gap: 4px;
4278
+ padding: 5px;
4279
+ border: 1px solid var(--sia-color-border);
4280
+ border-radius: 999px;
4281
+ background: var(--sia-color-surface);
4282
+ box-shadow: 0 3px 7px -3px rgb(0 0 0 / 24%);
4283
+ }
4284
+ .sia-tabs--capsule .sia-tabs__tab {
4285
+ height: 34px;
4286
+ padding-inline: 22px;
4287
+ border-radius: 999px;
4288
+ transition: background-color 240ms ease, color 240ms ease;
4289
+ }
4290
+ .sia-tabs--capsule .sia-tabs__tab[aria-selected=true] {
4291
+ color: var(--sia-tabs-accent);
4292
+ background: transparent;
4293
+ font-weight: 500;
4294
+ }
4295
+ .sia-tabs--capsule.sia-tabs--small .sia-tabs__tab {
4296
+ height: 26px;
4297
+ padding-inline: 16px;
4298
+ }
4299
+ .sia-tabs--capsule.sia-tabs--large .sia-tabs__tab {
4300
+ height: 42px;
4301
+ padding-inline: 26px;
4302
+ }
4303
+ .sia-tabs--capsule.sia-tabs--centered .sia-tabs__header {
4304
+ justify-content: center;
4305
+ }
4306
+ .sia-tabs--capsule.sia-tabs--vertical .sia-tabs__list {
4307
+ border-radius: 24px;
4308
+ }
4309
+ .sia-tabs--underline .sia-tabs__list {
4310
+ gap: 0;
4311
+ }
4312
+ .sia-tabs--underline .sia-tabs__tab {
4313
+ padding-inline: 22px;
4314
+ transition: color 240ms ease;
4315
+ }
4316
+ .sia-tabs--underline .sia-tabs__tab[aria-selected=true] {
4317
+ color: var(--sia-tabs-accent);
4318
+ font-weight: 500;
4319
+ }
4320
+ .sia-tabs--underline .sia-tabs__tab[aria-selected=true]::after {
4321
+ background: var(--sia-tabs-accent);
4322
+ }
4323
+ .sia-tabs--underline .sia-tabs__tab .sia-badge {
4324
+ margin-inline-end: 8px;
4325
+ }
4326
+ .sia-tabs--capsule .sia-tabs__tab:focus-visible,
4327
+ .sia-tabs--underline .sia-tabs__tab:focus-visible {
4328
+ outline: 2px solid var(--sia-tabs-accent);
4329
+ outline-offset: -2px;
4330
+ }
4331
+ @media (prefers-reduced-motion: reduce) {
4332
+ .sia-tabs--capsule .sia-tabs__tab,
4333
+ .sia-tabs--underline .sia-tabs__tab {
4334
+ transition: none;
4335
+ }
4336
+ }
4337
+ .sia-tabs__capsule-indicator {
4338
+ position: absolute;
4339
+ top: 0;
4340
+ left: 0;
4341
+ z-index: -1;
4342
+ visibility: hidden;
4343
+ border-radius: 999px;
4344
+ background: var(--sia-tabs-selection-bg);
4345
+ pointer-events: none;
4346
+ }
4347
+ .sia-tabs__capsule-indicator[data-ready=true] {
4348
+ transition:
4349
+ transform 240ms ease,
4350
+ width 240ms ease,
4351
+ height 240ms ease;
4352
+ }
4353
+ @media (prefers-reduced-motion: reduce) {
4354
+ .sia-tabs__capsule-indicator[data-ready=true] {
4355
+ transition: none;
4356
+ }
4357
+ }
4358
+ .sia-tabs__list--sliding {
4359
+ position: relative;
4360
+ isolation: isolate;
4361
+ }
4362
+ .sia-tabs__indicator {
4363
+ position: absolute;
4364
+ top: 0;
4365
+ left: 0;
4366
+ z-index: -1;
4367
+ visibility: hidden;
4368
+ pointer-events: none;
4369
+ }
4370
+ .sia-tabs__indicator[data-ready=true] {
4371
+ transition:
4372
+ transform 240ms ease,
4373
+ width 240ms ease,
4374
+ height 240ms ease;
4375
+ }
4376
+ .sia-tabs--line .sia-tabs__tab[aria-selected=true]::after {
4377
+ display: none;
4378
+ }
4379
+ .sia-tabs--line .sia-tabs__indicator::after {
4380
+ position: absolute;
4381
+ content: "";
4382
+ background: var(--sia-tabs-accent, var(--sia-color-primary));
4383
+ }
4384
+ .sia-tabs--line.sia-tabs--top .sia-tabs__indicator::after {
4385
+ bottom: -1px;
4386
+ left: 0;
4387
+ right: 0;
4388
+ height: 2px;
4389
+ border-radius: 2px 2px 0 0;
4390
+ }
4391
+ .sia-tabs--line.sia-tabs--bottom .sia-tabs__indicator::after {
4392
+ top: -1px;
4393
+ left: 0;
4394
+ right: 0;
4395
+ height: 2px;
4396
+ border-radius: 0 0 2px 2px;
4397
+ }
4398
+ .sia-tabs--line.sia-tabs--left .sia-tabs__indicator::after {
4399
+ top: 0;
4400
+ bottom: 0;
4401
+ right: -1px;
4402
+ width: 2px;
4403
+ }
4404
+ .sia-tabs--line.sia-tabs--right .sia-tabs__indicator::after {
4405
+ top: 0;
4406
+ bottom: 0;
4407
+ left: -1px;
4408
+ width: 2px;
4409
+ }
4410
+ .sia-tabs--tech .sia-tabs__tab[aria-selected=true]::before,
4411
+ .sia-tabs--tech .sia-tabs__tab[aria-selected=true]::after {
4412
+ display: none;
4413
+ }
4414
+ .sia-tabs--tech .sia-tabs__indicator::before,
4415
+ .sia-tabs--tech .sia-tabs__indicator::after {
4416
+ position: absolute;
4417
+ content: "";
4418
+ clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
4419
+ }
4420
+ .sia-tabs--tech .sia-tabs__indicator::before {
4421
+ inset: 1px 0;
4422
+ background: var(--sia-tabs-tech-accent);
4423
+ }
4424
+ .sia-tabs--tech .sia-tabs__indicator::after {
4425
+ inset: 2px 1px;
4426
+ background: var(--sia-tabs-tech-selection);
4427
+ }
4428
+ .sia-tabs--tech-line .sia-tabs__tab[aria-selected=true] .sia-tabs__tab-shape {
4429
+ visibility: hidden;
4430
+ }
4431
+ .sia-tabs__indicator-shape {
4432
+ display: block;
4433
+ width: 100%;
4434
+ height: 100%;
4435
+ color: var(--sia-tabs-line-accent);
4436
+ }
4437
+ [data-sia-theme=dark] .sia-tabs--tech-line .sia-tabs__indicator {
4438
+ --sia-tabs-line-fill-edge: var(--sia-tabs-line-surface);
4439
+ --sia-tabs-line-fill-center: var(--sia-color-primary);
4440
+ }
4441
+ @media (prefers-reduced-motion: reduce) {
4442
+ .sia-tabs__indicator[data-ready=true] {
4443
+ transition: none;
4444
+ }
4445
+ }
4266
4446
 
4267
4447
  /* src/components-extra.css */
4268
4448
  .sia-flex {
@@ -4634,11 +4814,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4634
4814
  width: calc(var(--sia-tool-panel-rail-size) + var(--sia-tool-panel-size) + var(--sia-tool-panel-handle-size));
4635
4815
  }
4636
4816
  .sia-tool-panel__rail {
4817
+ position: relative;
4637
4818
  display: flex;
4819
+ flex-direction: column;
4638
4820
  align-items: flex-start;
4639
4821
  flex: 0 0 var(--sia-tool-panel-rail-size);
4640
4822
  width: var(--sia-tool-panel-rail-size);
4641
4823
  min-width: 0;
4824
+ overflow-y: auto;
4642
4825
  background: var(--sia-color-surface);
4643
4826
  }
4644
4827
  .sia-tool-panel--left:not(.is-open) .sia-tool-panel__rail {
@@ -4668,16 +4851,38 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4668
4851
  background: var(--sia-color-control-hover);
4669
4852
  }
4670
4853
  .sia-tool-panel__activity:focus-visible {
4671
- outline: none;
4854
+ outline: 2px solid var(--sia-color-primary);
4855
+ outline-offset: -2px;
4856
+ }
4857
+ .sia-tool-panel__activity {
4858
+ flex-shrink: 0;
4859
+ }
4860
+ .sia-tool-panel__activity:disabled {
4861
+ cursor: not-allowed;
4862
+ opacity: .45;
4863
+ background: transparent;
4864
+ color: var(--sia-color-text-secondary);
4672
4865
  }
4673
4866
  .sia-tool-panel__activity.is-active {
4674
4867
  color: var(--sia-color-primary-text);
4675
4868
  }
4676
- .sia-tool-panel--left .sia-tool-panel__activity.is-active {
4677
- box-shadow: inset -3px 0 0 var(--sia-color-primary);
4869
+ .sia-tool-panel__indicator {
4870
+ position: absolute;
4871
+ top: 0;
4872
+ left: 0;
4873
+ z-index: 1;
4874
+ width: 3px;
4875
+ visibility: hidden;
4876
+ background: var(--sia-color-primary);
4877
+ pointer-events: none;
4678
4878
  }
4679
- .sia-tool-panel--right .sia-tool-panel__activity.is-active {
4680
- box-shadow: inset 3px 0 0 var(--sia-color-primary);
4879
+ .sia-tool-panel__indicator[data-ready=true] {
4880
+ transition: transform 240ms ease, height 240ms ease;
4881
+ }
4882
+ @media (prefers-reduced-motion: reduce) {
4883
+ .sia-tool-panel__indicator[data-ready=true] {
4884
+ transition: none;
4885
+ }
4681
4886
  }
4682
4887
  .sia-tool-panel__activity-icon {
4683
4888
  display: inline-flex;
@@ -4699,6 +4904,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4699
4904
  .sia-tool-panel__content[hidden] {
4700
4905
  display: none;
4701
4906
  }
4907
+ .sia-tool-panel__pane {
4908
+ height: 100%;
4909
+ min-height: 0;
4910
+ overflow: auto;
4911
+ }
4912
+ .sia-tool-panel__pane[hidden] {
4913
+ display: none;
4914
+ }
4702
4915
  .sia-tool-panel__resize-handle {
4703
4916
  position: relative;
4704
4917
  z-index: 2;