@sia.soul/sia-react-ui 0.1.22 → 0.1.24

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.
Files changed (44) hide show
  1. package/dist/Select-O_yY51vc.d.ts +307 -0
  2. package/dist/Select-W_xpkpOW.d.cts +307 -0
  3. package/dist/chart.cjs +1401 -1160
  4. package/dist/chart.css +21 -0
  5. package/dist/chart.js +4 -4
  6. package/dist/{chunk-3TRRBMXY.js → chunk-6R7JY7IY.js} +44 -21
  7. package/dist/{chunk-TZGUBGA4.js → chunk-6WBABNAX.js} +4 -3
  8. package/dist/{chunk-OKP4DIQH.js → chunk-GUXAWU63.js} +29 -26
  9. package/dist/{chunk-QJ4OQNQ4.js → chunk-LA7O3PN4.js} +4 -3
  10. package/dist/{chunk-7RNS52YG.js → chunk-LIYCU2GU.js} +349 -278
  11. package/dist/{chunk-KLI65JVD.js → chunk-LRPQ5FGE.js} +68 -186
  12. package/dist/chunk-NSSPGXNM.js +284 -0
  13. package/dist/{chunk-YT6E3X2K.js → chunk-OH6YILJW.js} +4 -3
  14. package/dist/{chunk-RWGSZW32.js → chunk-RGXVPS37.js} +7 -6
  15. package/dist/{chunk-VN6PIPP7.js → chunk-T2QIW4OO.js} +8 -7
  16. package/dist/{core-DeZknKwc.d.ts → core-BOzLwiXG.d.ts} +40 -158
  17. package/dist/{core-C5OnrCi4.d.cts → core-tbb9ZiBY.d.cts} +40 -158
  18. package/dist/core.cjs +1656 -1443
  19. package/dist/core.css +60 -0
  20. package/dist/core.d.cts +2 -2
  21. package/dist/core.d.ts +2 -2
  22. package/dist/core.js +8 -6
  23. package/dist/index.cjs +3801 -3580
  24. package/dist/index.css +60 -0
  25. package/dist/index.d.cts +33 -16
  26. package/dist/index.d.ts +33 -16
  27. package/dist/index.js +94 -85
  28. package/dist/markdown-editor.cjs +269 -28
  29. package/dist/markdown-editor.css +20 -0
  30. package/dist/markdown-editor.js +2 -2
  31. package/dist/rich-text-editor.cjs +1156 -1031
  32. package/dist/rich-text-editor.css +20 -0
  33. package/dist/rich-text-editor.js +4 -4
  34. package/dist/{select-date-range-CGRb3-W8.d.ts → select-date-range-BjqFUeU6.d.ts} +1 -1
  35. package/dist/{select-date-range-DDmYGDD4.d.cts → select-date-range-C9w8z3G8.d.cts} +1 -1
  36. package/dist/select-date-range.cjs +1209 -1061
  37. package/dist/select-date-range.css +20 -0
  38. package/dist/select-date-range.d.cts +2 -2
  39. package/dist/select-date-range.d.ts +2 -2
  40. package/dist/select-date-range.js +5 -5
  41. package/package.json +2 -2
  42. package/dist/Select-4hGJt3RJ.d.cts +0 -142
  43. package/dist/Select-BNSE67xn.d.ts +0 -142
  44. package/dist/chunk-3VJ4CZDQ.js +0 -43
package/dist/chart.css CHANGED
@@ -1034,3 +1034,24 @@
1034
1034
  .sia-chart__mark:focus > .sia-chart__mixed-hollow-symbol {
1035
1035
  stroke-width: 4;
1036
1036
  }
1037
+
1038
+ /* src/title-tooltip.css */
1039
+ body > .sia-title-tooltip[data-sia-popup-layer] {
1040
+ position: fixed;
1041
+ z-index: 1800;
1042
+ display: block;
1043
+ box-sizing: border-box;
1044
+ width: max-content;
1045
+ max-width: min(320px, calc(100vw - 16px));
1046
+ max-height: calc(100vh - 16px);
1047
+ padding: 7px 10px;
1048
+ color: var(--sia-color-text, #1f2329);
1049
+ background: var(--sia-color-surface, #fff);
1050
+ border: 1px solid var(--sia-color-border, #d9d9d9);
1051
+ border-radius: var(--sia-radius, 6px);
1052
+ box-shadow: var(--sia-shadow-popup, 0 4px 16px rgb(0 0 0 / 12%));
1053
+ font: 400 13px/1.5 system-ui, sans-serif;
1054
+ pointer-events: none;
1055
+ overflow-wrap: anywhere;
1056
+ white-space: pre-wrap;
1057
+ }
package/dist/chart.js CHANGED
@@ -56,10 +56,10 @@ import {
56
56
  smoothSvgPath,
57
57
  svgArcPath,
58
58
  transferCompositeValue
59
- } from "./chunk-OKP4DIQH.js";
60
- import "./chunk-YT6E3X2K.js";
61
- import "./chunk-TZGUBGA4.js";
62
- import "./chunk-3VJ4CZDQ.js";
59
+ } from "./chunk-GUXAWU63.js";
60
+ import "./chunk-OH6YILJW.js";
61
+ import "./chunk-6WBABNAX.js";
62
+ import "./chunk-NSSPGXNM.js";
63
63
  export {
64
64
  BarChart,
65
65
  CHART_VIEWBOX_HEIGHT,
@@ -1,18 +1,19 @@
1
1
  import {
2
2
  Dropdown,
3
3
  Icon,
4
- Input,
5
- PopupPortal
6
- } from "./chunk-KLI65JVD.js";
4
+ Input
5
+ } from "./chunk-LRPQ5FGE.js";
7
6
  import {
8
7
  Button
9
- } from "./chunk-TZGUBGA4.js";
8
+ } from "./chunk-6WBABNAX.js";
10
9
  import {
11
10
  ControlSizeContext,
11
+ PopupPortal,
12
12
  useControlSize,
13
13
  useControllableState,
14
- useFloatingPlaceholder
15
- } from "./chunk-3VJ4CZDQ.js";
14
+ useFloatingPlaceholder,
15
+ withTitleTooltip
16
+ } from "./chunk-NSSPGXNM.js";
16
17
 
17
18
  // src/components/Checkbox.tsx
18
19
  import { createContext, forwardRef, useContext, useEffect, useId, useMemo, useRef } from "react";
@@ -37,7 +38,7 @@ var CheckboxRoot = forwardRef(function Checkbox({ value, size: sizeProp, indeter
37
38
  /* @__PURE__ */ jsx(
38
39
  "input",
39
40
  {
40
- ...props,
41
+ ...withTitleTooltip(props),
41
42
  ref: setRef,
42
43
  id: props.id ?? fallbackId,
43
44
  className: "sia-checkbox__input",
@@ -289,7 +290,7 @@ function Popover({ title, content, trigger = "click", overlayClassName = "", ...
289
290
  function Timeline({ items = [], mode = "left", pending = false, pendingDot, reverse = false, className = "", ...props }) {
290
291
  const values = [...items, ...pending ? [{ children: pending === true ? "\u52A0\u8F7D\u4E2D..." : pending, dot: pendingDot ?? /* @__PURE__ */ jsx2(Icon, { name: "loader", className: "sia-spin-icon" }) }] : []];
291
292
  if (reverse) values.reverse();
292
- return /* @__PURE__ */ jsx2("ul", { className: `sia-timeline sia-timeline--${mode} ${className}`.trim(), ...props, children: values.map((item, index) => {
293
+ return /* @__PURE__ */ jsx2("ul", { className: `sia-timeline sia-timeline--${mode} ${className}`.trim(), ...withTitleTooltip(props), children: values.map((item, index) => {
293
294
  const position = item.position ?? (mode === "alternate" ? index % 2 ? "right" : "left" : mode);
294
295
  return /* @__PURE__ */ jsxs2("li", { className: `sia-timeline__item sia-timeline__item--${position}`, children: [
295
296
  item.label ? /* @__PURE__ */ jsx2("span", { className: "sia-timeline__label", children: item.label }) : null,
@@ -478,7 +479,7 @@ function Tree({
478
479
  /* @__PURE__ */ jsx2(
479
480
  "div",
480
481
  {
481
- ...rowProps,
482
+ ...withTitleTooltip(rowProps),
482
483
  className: `sia-tree__row${blockNode ? " sia-tree__row--block" : ""}${sticky ? " sia-tree__row--sticky" : ""} ${rowClassName}`.trim(),
483
484
  style: {
484
485
  ...rowStyle,
@@ -538,7 +539,7 @@ function Tree({
538
539
  ] }, node.key);
539
540
  });
540
541
  }
541
- return /* @__PURE__ */ jsx2("div", { className: `sia-tree${showLine ? " sia-tree--line" : ""}${stickyAncestors ? " sia-tree--sticky-ancestors" : ""} ${className}`.trim(), role: "tree", "aria-multiselectable": multiple || void 0, ...props, children: render(treeData) });
542
+ return /* @__PURE__ */ jsx2("div", { className: `sia-tree${showLine ? " sia-tree--line" : ""}${stickyAncestors ? " sia-tree--sticky-ancestors" : ""} ${className}`.trim(), role: "tree", "aria-multiselectable": multiple || void 0, ...withTitleTooltip(props), children: render(treeData) });
542
543
  }
543
544
 
544
545
  // src/components/Modal.tsx
@@ -653,6 +654,7 @@ var ModalRoot = forwardRef2(function Modal({
653
654
  keyboard = true,
654
655
  centered = false,
655
656
  width = 520,
657
+ height,
656
658
  zIndex = 1e3,
657
659
  getContainer,
658
660
  onOk,
@@ -728,6 +730,7 @@ var ModalRoot = forwardRef2(function Modal({
728
730
  useOverlayLifecycle(rendered, localRef, requestClose, keyboard);
729
731
  if (!rendered) return null;
730
732
  const mergedStyle = {
733
+ ...height !== void 0 ? { display: "flex", flexDirection: "column", height, maxHeight: "calc(100dvh - 48px)" } : {},
731
734
  ...style,
732
735
  "--sia-modal-width": typeof width === "number" ? `${width}px` : width
733
736
  };
@@ -755,17 +758,17 @@ var ModalRoot = forwardRef2(function Modal({
755
758
  "aria-modal": "true",
756
759
  "aria-labelledby": title ? titleId : void 0,
757
760
  tabIndex: -1,
758
- ...props,
761
+ ...withTitleTooltip(props),
759
762
  children: [
760
- /* @__PURE__ */ jsxs3("div", { className: "sia-modal__header", children: [
763
+ /* @__PURE__ */ jsxs3("div", { className: "sia-modal__header", style: height !== void 0 ? { flexShrink: 0 } : void 0, children: [
761
764
  /* @__PURE__ */ jsxs3("div", { className: "sia-modal__heading", children: [
762
765
  typeIcons[type] ? /* @__PURE__ */ jsx3("span", { className: "sia-modal__type-icon", "aria-hidden": "true", children: typeIcons[type] }) : null,
763
766
  title ? /* @__PURE__ */ jsx3("strong", { id: titleId, children: title }) : null
764
767
  ] }),
765
768
  closable ? /* @__PURE__ */ jsx3("button", { type: "button", className: "sia-modal__close", "aria-label": "\u5173\u95ED\u5BF9\u8BDD\u6846", onClick: requestClose, children: /* @__PURE__ */ jsx3(Icon, { name: "close", size: 17 }) }) : null
766
769
  ] }),
767
- children !== void 0 ? /* @__PURE__ */ jsx3("div", { className: "sia-modal__body", children }) : null,
768
- footer !== null ? /* @__PURE__ */ jsxs3("div", { className: "sia-modal__footer", children: [
770
+ children !== void 0 ? /* @__PURE__ */ jsx3("div", { className: "sia-modal__body", style: height !== void 0 ? { flex: 1, minHeight: 0, overflow: "auto" } : void 0, children }) : null,
771
+ footer !== null ? /* @__PURE__ */ jsxs3("div", { className: "sia-modal__footer", style: height !== void 0 ? { flexShrink: 0 } : void 0, children: [
769
772
  footer === void 0 && footerExtra != null ? /* @__PURE__ */ jsx3("div", { style: { marginRight: "auto" }, children: footerExtra }) : null,
770
773
  footer ?? defaultFooter
771
774
  ] }) : null
@@ -1521,6 +1524,8 @@ var Select = forwardRef3(function Select2({
1521
1524
  const [openedMode, setOpenedMode] = useState5(automaticMode);
1522
1525
  const popupMode = open ? openedMode : automaticMode;
1523
1526
  const [modalValues, setModalValues] = useState5([]);
1527
+ const [modalSubmitting, setModalSubmitting] = useState5(false);
1528
+ const modalSubmitLock = useRef7(false);
1524
1529
  const [selectedOnly, setSelectedOnly] = useState5(false);
1525
1530
  const [query, setQuery] = useState5("");
1526
1531
  const [activeIndex, setActiveIndex] = useState5(-1);
@@ -1541,9 +1546,10 @@ var Select = forwardRef3(function Select2({
1541
1546
  }
1542
1547
  });
1543
1548
  const selectedValues = useMemo4(() => {
1549
+ if (currentValue == null || currentValue === "" && !options.some((option) => option.value === "")) return [];
1544
1550
  if (mode === "multiple") return Array.isArray(currentValue) ? currentValue : currentValue === null ? [] : [currentValue];
1545
1551
  return Array.isArray(currentValue) ? currentValue.slice(0, 1) : currentValue === null ? [] : [currentValue];
1546
- }, [currentValue, mode]);
1552
+ }, [currentValue, mode, options]);
1547
1553
  const selectedValueSet = useMemo4(() => new Set(selectedValues), [selectedValues]);
1548
1554
  const availableOptions = useMemo4(() => {
1549
1555
  if (!allowInput) return options;
@@ -1589,6 +1595,24 @@ var Select = forwardRef3(function Select2({
1589
1595
  setQuery("");
1590
1596
  setScrollTop(0);
1591
1597
  }
1598
+ async function confirmModalSelection() {
1599
+ if (disabled || loading || modalSubmitLock.current) return;
1600
+ modalSubmitLock.current = true;
1601
+ const nextValue = multiple ? [...modalValues] : modalValues[0] ?? null;
1602
+ const selected = modalValues.map((selectedValue) => availableOptions.find((option) => option.value === selectedValue) ?? (allowInput ? { value: selectedValue, label: String(selectedValue) } : void 0)).filter((option) => option !== void 0);
1603
+ const extraValues = { ...modalConfig?.extraValues };
1604
+ setModalSubmitting(true);
1605
+ try {
1606
+ const result = await modalConfig?.onConfirm?.(nextValue, multiple ? selected : selected[0] ?? null, extraValues);
1607
+ if (result === false) return;
1608
+ setCurrentValue(nextValue);
1609
+ closeDropdown();
1610
+ } catch {
1611
+ } finally {
1612
+ modalSubmitLock.current = false;
1613
+ setModalSubmitting(false);
1614
+ }
1615
+ }
1592
1616
  function openDropdown() {
1593
1617
  if (disabled || loading) return;
1594
1618
  setOpenedMode(automaticMode);
@@ -1742,7 +1766,7 @@ var Select = forwardRef3(function Select2({
1742
1766
  /* @__PURE__ */ jsxs6(
1743
1767
  "button",
1744
1768
  {
1745
- ...props,
1769
+ ...withTitleTooltip(props),
1746
1770
  ref: forwardedRef,
1747
1771
  className: `sia-select__trigger${floating.className}`,
1748
1772
  id: selectId,
@@ -1813,6 +1837,7 @@ var Select = forwardRef3(function Select2({
1813
1837
  open,
1814
1838
  title: modalConfig?.title ?? placeholder,
1815
1839
  width: modalConfig?.width ?? 900,
1840
+ confirmLoading: modalSubmitting,
1816
1841
  onOpenChange: (next) => {
1817
1842
  if (!next) closeDropdown();
1818
1843
  },
@@ -1820,14 +1845,12 @@ var Select = forwardRef3(function Select2({
1820
1845
  footer: /* @__PURE__ */ jsxs6("div", { className: "sia-select-modal__footer", children: [
1821
1846
  /* @__PURE__ */ jsx6("div", { children: modalConfig?.footerExtra }),
1822
1847
  /* @__PURE__ */ jsxs6("div", { children: [
1823
- /* @__PURE__ */ jsx6(Button, { onClick: closeDropdown, children: "\u53D6\u6D88" }),
1824
- /* @__PURE__ */ jsx6(Button, { variant: "primary", disabled: disabled || loading, onClick: () => {
1825
- setCurrentValue(multiple ? modalValues : modalValues[0] ?? null);
1826
- closeDropdown();
1827
- }, children: "\u786E\u5B9A" })
1848
+ /* @__PURE__ */ jsx6(Button, { disabled: modalSubmitting, onClick: closeDropdown, children: "\u53D6\u6D88" }),
1849
+ /* @__PURE__ */ jsx6(Button, { variant: "primary", loading: modalSubmitting, disabled: disabled || loading, onClick: confirmModalSelection, children: "\u786E\u5B9A" })
1828
1850
  ] })
1829
1851
  ] }),
1830
1852
  children: open ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
1853
+ modalConfig?.headerExtra != null && modalConfig.headerExtra !== false ? /* @__PURE__ */ jsx6("div", { className: "sia-select-modal__header-extra", children: modalConfig.headerExtra }) : null,
1831
1854
  /* @__PURE__ */ jsxs6("div", { className: "sia-select-modal__heading", children: [
1832
1855
  /* @__PURE__ */ jsxs6("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
1833
1856
  /* @__PURE__ */ jsx6(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
@@ -1,6 +1,7 @@
1
1
  import {
2
- useControlSize
3
- } from "./chunk-3VJ4CZDQ.js";
2
+ useControlSize,
3
+ withTitleTooltip
4
+ } from "./chunk-NSSPGXNM.js";
4
5
 
5
6
  // src/components/Button.tsx
6
7
  import { forwardRef, useRef } from "react";
@@ -49,7 +50,7 @@ var Button = forwardRef(function Button2({
49
50
  disabled: disabled || loading,
50
51
  onClick: handleClick,
51
52
  style: mergedStyle,
52
- ...props,
53
+ ...withTitleTooltip(props),
53
54
  children: [
54
55
  loading ? /* @__PURE__ */ jsx("span", { className: "sia-button__spinner", "aria-hidden": "true" }) : icon && iconPosition === "start" ? /* @__PURE__ */ jsx("span", { className: "sia-button__icon", children: icon }) : null,
55
56
  children !== void 0 && children !== null ? /* @__PURE__ */ jsx("span", { children }) : null,
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  TextArea
3
- } from "./chunk-YT6E3X2K.js";
3
+ } from "./chunk-OH6YILJW.js";
4
4
  import {
5
5
  Button
6
- } from "./chunk-TZGUBGA4.js";
6
+ } from "./chunk-6WBABNAX.js";
7
+ import {
8
+ withTitleTooltip
9
+ } from "./chunk-NSSPGXNM.js";
7
10
 
8
11
  // src/components/ChartWhirlingLoading.tsx
9
12
  import { useEffect, useState } from "react";
@@ -73,7 +76,7 @@ function ChartBrush({ bounds, onSelect, onCancel, selectionShape = "band", selec
73
76
  tabIndex: 0,
74
77
  role: "group",
75
78
  "aria-label": "\u62D6\u52A8\u6846\u9009\u7F29\u653E\uFF0CEscape\u53D6\u6D88",
76
- ...bounds,
79
+ ...withTitleTooltip(bounds),
77
80
  fill: "transparent",
78
81
  style: { cursor: "crosshair", touchAction: "none", pointerEvents: "all" },
79
82
  onKeyDown: (event) => {
@@ -327,27 +330,27 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
327
330
  return nearestTimelineIndex(ratios, (p.x - start) / (end - start));
328
331
  };
329
332
  return /* @__PURE__ */ jsxs3("g", { "data-chart-node-timeline": "", "aria-label": "\u56FE\u8868\u65F6\u95F4\u8F74", fontSize: 12, fill: "#666", children: [
330
- /* @__PURE__ */ jsxs3("g", { role: "button", tabIndex: 0, "aria-label": "\u4E0A\u4E00\u5E74", ...activate(() => step(-1)), children: [
333
+ /* @__PURE__ */ jsxs3("g", { role: "button", tabIndex: 0, "aria-label": "\u4E0A\u4E00\u5E74", ...withTitleTooltip(activate(() => step(-1))), children: [
331
334
  /* @__PURE__ */ jsx4("rect", { x, y: y - 14, width: 24, height: 28, fill: "transparent" }),
332
335
  /* @__PURE__ */ jsx4("path", { d: `M${x + 17} ${y - 7} L${x + 7} ${y} L${x + 17} ${y + 7}`, fill: "none", stroke: "#666", strokeWidth: 2 })
333
336
  ] }),
334
- /* @__PURE__ */ jsxs3("g", { role: "button", tabIndex: 0, "aria-label": playing ? "\u6682\u505C\u65F6\u95F4\u8F74" : "\u64AD\u653E\u65F6\u95F4\u8F74", ...activate(() => {
337
+ /* @__PURE__ */ jsxs3("g", { role: "button", tabIndex: 0, "aria-label": playing ? "\u6682\u505C\u65F6\u95F4\u8F74" : "\u64AD\u653E\u65F6\u95F4\u8F74", ...withTitleTooltip(activate(() => {
335
338
  cancelPending();
336
339
  if (playing) setPlaying(false);
337
340
  else {
338
341
  onChange((shown + 1) % labels.length);
339
342
  setPlaying(true);
340
343
  }
341
- }), children: [
344
+ })), children: [
342
345
  /* @__PURE__ */ jsx4("rect", { x: x + 30, y: y - 14, width: 24, height: 28, fill: "transparent" }),
343
346
  playing ? /* @__PURE__ */ jsx4("path", { d: `M${x + 37} ${y - 7} V${y + 7} M${x + 47} ${y - 7} V${y + 7}`, fill: "none", stroke: "#666", strokeWidth: 3 }) : /* @__PURE__ */ jsx4("path", { d: `M${x + 36} ${y - 8} L${x + 50} ${y} L${x + 36} ${y + 8} Z` })
344
347
  ] }),
345
- /* @__PURE__ */ jsxs3("g", { role: "button", tabIndex: 0, "aria-label": "\u4E0B\u4E00\u5E74", ...activate(() => step(1)), children: [
348
+ /* @__PURE__ */ jsxs3("g", { role: "button", tabIndex: 0, "aria-label": "\u4E0B\u4E00\u5E74", ...withTitleTooltip(activate(() => step(1))), children: [
346
349
  /* @__PURE__ */ jsx4("rect", { x: x + 60, y: y - 14, width: 24, height: 28, fill: "transparent" }),
347
350
  /* @__PURE__ */ jsx4("path", { d: `M${x + 67} ${y - 7} L${x + 77} ${y} L${x + 67} ${y + 7}`, fill: "none", stroke: "#666", strokeWidth: 2 })
348
351
  ] }),
349
352
  /* @__PURE__ */ jsx4("line", { x1: start, x2: end, y1: y, y2: y, stroke: "#666", strokeWidth: 1, strokeDasharray: "5 5" }),
350
- labels.map((label, index) => /* @__PURE__ */ jsxs3("g", { role: "button", tabIndex: 0, "aria-label": `\u5E74\u4EFD ${label}`, "aria-pressed": value === index, ...activate(() => select(index)), children: [
353
+ labels.map((label, index) => /* @__PURE__ */ jsxs3("g", { role: "button", tabIndex: 0, "aria-label": `\u5E74\u4EFD ${label}`, "aria-pressed": value === index, ...withTitleTooltip(activate(() => select(index))), children: [
351
354
  /* @__PURE__ */ jsx4("rect", { x: position(index) - 20, y: y - 12, width: 40, height: 40, fill: "transparent" }),
352
355
  /* @__PURE__ */ jsx4("path", { "data-timeline-node": index, d: `M${position(index)} ${y - 4} L${position(index) + 4} ${y} L${position(index)} ${y + 4} L${position(index) - 4} ${y} Z`, fill: "#fff", stroke: "#666" }),
353
356
  /* @__PURE__ */ jsx4("text", { x: position(index), y: y + 24, textAnchor: "middle", children: label })
@@ -489,10 +492,10 @@ function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range,
489
492
  /* @__PURE__ */ jsx5("text", { x, y: y - 5, children: endLabels?.[1] ?? max }),
490
493
  /* @__PURE__ */ jsx5("rect", { x, y, width: thickness, height: Math.max(0, position(high) - y), fill: "#ccc", pointerEvents: "none" }),
491
494
  /* @__PURE__ */ jsx5("rect", { x, y: position(low), width: thickness, height: Math.max(0, y + length - position(low)), fill: "#ccc", pointerEvents: "none" }),
492
- /* @__PURE__ */ jsx5("rect", { "data-range-selection": "", x, y: position(high), width: thickness, height: Math.max(0, position(low) - position(high)), fill: "transparent", style: { cursor: readOnly ? "default" : "move" }, ...handlers(2) }),
495
+ /* @__PURE__ */ jsx5("rect", { "data-range-selection": "", x, y: position(high), width: thickness, height: Math.max(0, position(low) - position(high)), fill: "transparent", style: { cursor: readOnly ? "default" : "move" }, ...withTitleTooltip(handlers(2)) }),
493
496
  !readOnly && [0, 1].map((index) => {
494
497
  const value = index === 0 ? low : high, py = position(value), direction = index === 0 ? 1 : -1;
495
- return /* @__PURE__ */ jsxs4("g", { role: "slider", "aria-label": `\u503C\u57DF${index === 0 ? "\u4E0B\u9650" : "\u4E0A\u9650"}`, "aria-valuemin": index === 0 ? min : low, "aria-valuemax": index === 0 ? high : max, "aria-valuenow": value, "aria-orientation": "vertical", tabIndex: 0, style: { cursor: "ns-resize", pointerEvents: "all" }, ...handlers(index), onKeyDown: (event) => {
498
+ return /* @__PURE__ */ jsxs4("g", { role: "slider", "aria-label": `\u503C\u57DF${index === 0 ? "\u4E0B\u9650" : "\u4E0A\u9650"}`, "aria-valuemin": index === 0 ? min : low, "aria-valuemax": index === 0 ? high : max, "aria-valuenow": value, "aria-orientation": "vertical", tabIndex: 0, style: { cursor: "ns-resize", pointerEvents: "all" }, ...withTitleTooltip(handlers(index)), onKeyDown: (event) => {
496
499
  const step = span / 100;
497
500
  const next = event.key === "Home" ? min : event.key === "End" ? max : ["ArrowUp", "ArrowRight"].includes(event.key) ? value + step : ["ArrowDown", "ArrowLeft"].includes(event.key) ? value - step : void 0;
498
501
  if (next !== void 0) {
@@ -579,10 +582,10 @@ function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range
579
582
  /* @__PURE__ */ jsx6("text", { x: x + length + 10, y: y + thickness / 2, dominantBaseline: "central", children: endLabels?.[0] ?? min }),
580
583
  /* @__PURE__ */ jsx6("rect", { x, y, width: Math.max(0, position(high) - x), height: thickness, fill: "#ccc", pointerEvents: "none" }),
581
584
  /* @__PURE__ */ jsx6("rect", { x: position(low), y, width: Math.max(0, x + length - position(low)), height: thickness, fill: "#ccc", pointerEvents: "none" }),
582
- /* @__PURE__ */ jsx6("rect", { "data-range-selection": "", x: position(high), y, width: Math.max(0, position(low) - position(high)), height: thickness, fill: "transparent", style: { cursor: "move" }, ...handlers(2) }),
585
+ /* @__PURE__ */ jsx6("rect", { "data-range-selection": "", x: position(high), y, width: Math.max(0, position(low) - position(high)), height: thickness, fill: "transparent", style: { cursor: "move" }, ...withTitleTooltip(handlers(2)) }),
583
586
  [0, 1].map((index) => {
584
587
  const value = index === 0 ? low : high, px = position(value), direction = index === 0 ? 1 : -1;
585
- return /* @__PURE__ */ jsxs5("g", { role: "slider", "aria-label": "\u503C\u57DF" + (index === 0 ? "\u4E0B\u9650" : "\u4E0A\u9650"), "aria-valuemin": index === 0 ? min : low, "aria-valuemax": index === 0 ? high : max, "aria-valuenow": value, "aria-orientation": "horizontal", tabIndex: 0, style: { cursor: "ew-resize", pointerEvents: "all" }, ...handlers(index), onKeyDown: (event) => {
588
+ return /* @__PURE__ */ jsxs5("g", { role: "slider", "aria-label": "\u503C\u57DF" + (index === 0 ? "\u4E0B\u9650" : "\u4E0A\u9650"), "aria-valuemin": index === 0 ? min : low, "aria-valuemax": index === 0 ? high : max, "aria-valuenow": value, "aria-orientation": "horizontal", tabIndex: 0, style: { cursor: "ew-resize", pointerEvents: "all" }, ...withTitleTooltip(handlers(index)), onKeyDown: (event) => {
586
589
  const step = span / 100, next = event.key === "Home" ? min : event.key === "End" ? max : ["ArrowUp", "ArrowLeft"].includes(event.key) ? value + step : ["ArrowDown", "ArrowRight"].includes(event.key) ? value - step : void 0;
587
590
  if (next !== void 0) {
588
591
  event.preventDefault();
@@ -744,7 +747,7 @@ function toCssSize(value, fallback) {
744
747
  var ChartComposite = forwardRef(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
745
748
  const host = useRef6(null);
746
749
  useImperativeHandle(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
747
- return /* @__PURE__ */ jsx7("div", { ...props, ref: host, className: `sia-chart-composite${className ? ` ${className}` : ""}`, style: { ...style, width: toCssSize(width, "100%"), height: toCssSize(height, "320px") }, role: "group", "aria-label": ariaLabel, children: layers.map((layer, index) => /* @__PURE__ */ jsx7("div", { className: "sia-chart-composite__layer", style: { left: layer.left ?? 0, top: layer.top ?? 0, width: layer.width ?? "100%", height: layer.height ?? "100%", zIndex: layer.zIndex ?? index, pointerEvents: layer.pointerEvents }, children: layer.content }, layer.key ?? index)) });
750
+ return /* @__PURE__ */ jsx7("div", { ...withTitleTooltip(props), ref: host, className: `sia-chart-composite${className ? ` ${className}` : ""}`, style: { ...style, width: toCssSize(width, "100%"), height: toCssSize(height, "320px") }, role: "group", "aria-label": ariaLabel, children: layers.map((layer, index) => /* @__PURE__ */ jsx7("div", { className: "sia-chart-composite__layer", style: { left: layer.left ?? 0, top: layer.top ?? 0, width: layer.width ?? "100%", height: layer.height ?? "100%", zIndex: layer.zIndex ?? index, pointerEvents: layer.pointerEvents }, children: layer.content }, layer.key ?? index)) });
748
751
  });
749
752
  var useTooltipLayoutEffect = typeof window === "undefined" ? useEffect6 : useLayoutEffect;
750
753
  function ChartTooltip({ open, left, top, children, enterable = false, inheritTextStyle = false, placement = "above", className = "", style, ...props }) {
@@ -767,7 +770,7 @@ function ChartTooltip({ open, left, top, children, enterable = false, inheritTex
767
770
  return /* @__PURE__ */ jsx7(
768
771
  "div",
769
772
  {
770
- ...props,
773
+ ...withTitleTooltip(props),
771
774
  ref: elementRef,
772
775
  className: `sia-chart__tooltip${inheritTextStyle ? " sia-chart__tooltip--inherit-text" : ""}${className ? ` ${className}` : ""}`,
773
776
  role: "tooltip",
@@ -846,7 +849,7 @@ function ChartToolbox({
846
849
  {
847
850
  type: "button",
848
851
  className: "sia-chart-toolbox__button",
849
- title: TOOLBOX_LABELS[feature],
852
+ ...withTitleTooltip({ title: TOOLBOX_LABELS[feature] }),
850
853
  "aria-label": TOOLBOX_LABELS[feature],
851
854
  "aria-pressed": feature === "mark" ? markActive : feature === "dataZoom" ? zoomActive : void 0,
852
855
  onClick: featureActions[feature],
@@ -854,9 +857,9 @@ function ChartToolbox({
854
857
  }
855
858
  ),
856
859
  feature === "mark" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
857
- /* @__PURE__ */ jsx7("button", { type: "button", className: "sia-chart-toolbox__button", "aria-label": "\u64A4\u9500\u6807\u7EBF", title: "\u64A4\u9500\u6807\u7EBF", disabled: !markCount, onClick: onMarkUndo, children: /* @__PURE__ */ jsx7(ToolboxIcon, { children: /* @__PURE__ */ jsx7("path", { d: "M4 8h10a6 6 0 0 1 0 12M4 8l5-5M4 8l5 5" }) }) }),
858
- /* @__PURE__ */ jsx7("button", { type: "button", className: "sia-chart-toolbox__button", "aria-label": "\u6E05\u7A7A\u6807\u7EBF", title: "\u6E05\u7A7A\u6807\u7EBF", disabled: !markCount, onClick: onMarkClear, children: /* @__PURE__ */ jsx7(ToolboxIcon, { children: /* @__PURE__ */ jsx7("path", { d: "M4 6h16M9 6V3h6v3M6 6l1 15h10l1-15M10 10v7M14 10v7" }) }) })
859
- ] }) : feature === "dataZoom" && onZoomBack ? /* @__PURE__ */ jsx7("button", { type: "button", className: "sia-chart-toolbox__button", "aria-label": "\u533A\u57DF\u7F29\u653E\u540E\u9000", title: "\u533A\u57DF\u7F29\u653E\u540E\u9000", disabled: zoomBackDisabled, onClick: onZoomBack, children: /* @__PURE__ */ jsx7(ToolboxIcon, { children: /* @__PURE__ */ jsx7("path", { d: "M4 8h10a6 6 0 0 1 0 12M4 8l5-5M4 8l5 5" }) }) }) : null
860
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "sia-chart-toolbox__button", "aria-label": "\u64A4\u9500\u6807\u7EBF", ...withTitleTooltip({ title: "\u64A4\u9500\u6807\u7EBF" }), disabled: !markCount, onClick: onMarkUndo, children: /* @__PURE__ */ jsx7(ToolboxIcon, { children: /* @__PURE__ */ jsx7("path", { d: "M4 8h10a6 6 0 0 1 0 12M4 8l5-5M4 8l5 5" }) }) }),
861
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "sia-chart-toolbox__button", "aria-label": "\u6E05\u7A7A\u6807\u7EBF", ...withTitleTooltip({ title: "\u6E05\u7A7A\u6807\u7EBF" }), disabled: !markCount, onClick: onMarkClear, children: /* @__PURE__ */ jsx7(ToolboxIcon, { children: /* @__PURE__ */ jsx7("path", { d: "M4 6h16M9 6V3h6v3M6 6l1 15h10l1-15M10 10v7M14 10v7" }) }) })
862
+ ] }) : feature === "dataZoom" && onZoomBack ? /* @__PURE__ */ jsx7("button", { type: "button", className: "sia-chart-toolbox__button", "aria-label": "\u533A\u57DF\u7F29\u653E\u540E\u9000", ...withTitleTooltip({ title: "\u533A\u57DF\u7F29\u653E\u540E\u9000" }), disabled: zoomBackDisabled, onClick: onZoomBack, children: /* @__PURE__ */ jsx7(ToolboxIcon, { children: /* @__PURE__ */ jsx7("path", { d: "M4 8h10a6 6 0 0 1 0 12M4 8l5-5M4 8l5 5" }) }) }) : null
860
863
  ] }, feature)),
861
864
  magicTypes.map((type) => /* @__PURE__ */ jsx7(
862
865
  "button",
@@ -865,7 +868,7 @@ function ChartToolbox({
865
868
  className: "sia-chart-toolbox__button sia-chart-toolbox__magic",
866
869
  "aria-pressed": activeMagicTypes ? activeMagicTypes.includes(type) : activeMagicType === type,
867
870
  "aria-label": `\u5207\u6362\u4E3A${{ line: "\u6298\u7EBF\u56FE", bar: "\u67F1\u72B6\u56FE", stack: "\u5806\u79EF", tiled: "\u5E73\u94FA" }[type] ?? type}`,
868
- title: `\u5207\u6362\u4E3A${type}`,
871
+ ...withTitleTooltip({ title: `\u5207\u6362\u4E3A${type}` }),
869
872
  onClick: () => onMagicTypeChange?.(type),
870
873
  children: ["line", "bar", "stack", "tiled"].includes(type) ? /* @__PURE__ */ jsx7(ToolboxIcon, { children: type === "line" ? /* @__PURE__ */ jsx7("path", { d: "M3 3v18h18M5 16l4-9 5 6 6-10" }) : type === "bar" ? /* @__PURE__ */ jsx7("path", { d: "M3 3v18h18M7 18V10h2v8M12 18V5h2v13M17 18V8h2v10" }) : type === "stack" ? /* @__PURE__ */ jsx7("path", { d: "M4 4h16v4H4zM4 10h16v4H4zM4 16h16v4H4z" }) : /* @__PURE__ */ jsx7("path", { d: "M4 4h4v16H4zM10 4h4v16h-4zM16 4h4v16h-4z" }) }) : type
871
874
  },
@@ -1034,7 +1037,7 @@ var SiaChart = forwardRef(function SiaChart2({
1034
1037
  return /* @__PURE__ */ jsx7(ChartContext.Provider, { value: context, children: /* @__PURE__ */ jsxs6(
1035
1038
  "div",
1036
1039
  {
1037
- ...rest,
1040
+ ...withTitleTooltip(rest),
1038
1041
  ref: hostRef,
1039
1042
  className: `sia-chart${loading ? " sia-chart--loading" : ""}${animation ? " sia-chart--animated" : ""}${className ? ` ${className}` : ""}`,
1040
1043
  style: rootStyle,
@@ -1043,7 +1046,7 @@ var SiaChart = forwardRef(function SiaChart2({
1043
1046
  /* @__PURE__ */ jsxs6(
1044
1047
  "svg",
1045
1048
  {
1046
- ...svgProps,
1049
+ ...withTitleTooltip(svgProps),
1047
1050
  ref: svgRef,
1048
1051
  className: `sia-chart__svg${svgProps?.className ? ` ${svgProps.className}` : ""}`,
1049
1052
  viewBox: `0 0 ${viewBoxSize[0]} ${viewBoxSize[1]}`,
@@ -1187,7 +1190,7 @@ function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave
1187
1190
  return /* @__PURE__ */ jsx7(
1188
1191
  "g",
1189
1192
  {
1190
- ...props,
1193
+ ...withTitleTooltip(props),
1191
1194
  className: `sia-chart__mark${props.className ? ` ${props.className}` : ""}`,
1192
1195
  tabIndex: props.tabIndex ?? 0,
1193
1196
  role: "graphics-symbol",
@@ -1456,7 +1459,7 @@ function ChartTimeline({ labels, value, onChange, autoPlay = false, playInterval
1456
1459
  }, Math.max(120, playInterval));
1457
1460
  return () => window.clearInterval(timer);
1458
1461
  }, [labels.length, loop, onChange, playInterval, playing, value]);
1459
- return /* @__PURE__ */ jsxs6("div", { ...props, className: `sia-chart-timeline${className ? ` ${className}` : ""}`, children: [
1462
+ return /* @__PURE__ */ jsxs6("div", { ...withTitleTooltip(props), className: `sia-chart-timeline${className ? ` ${className}` : ""}`, children: [
1460
1463
  /* @__PURE__ */ jsx7("button", { type: "button", "aria-label": playing ? "\u6682\u505C\u65F6\u95F4\u8F74" : "\u64AD\u653E\u65F6\u95F4\u8F74", onClick: () => setPlaying((current) => !current), children: playing ? "\u2161" : "\u25B6" }),
1461
1464
  /* @__PURE__ */ jsx7("input", { "aria-label": "\u56FE\u8868\u65F6\u95F4\u8F74", type: "range", min: 0, max: Math.max(0, labels.length - 1), value: Math.min(value, Math.max(0, labels.length - 1)), onChange: (event) => onChange(Number(event.target.value)) }),
1462
1465
  /* @__PURE__ */ jsx7("output", { children: labels[value] ?? "" })
@@ -1828,7 +1831,7 @@ function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = d
1828
1831
  const scale = Math.min(width / map.width, height / map.height), left = x + (width - map.width * scale) / 2, top = y + (height - map.height * scale) / 2;
1829
1832
  const project = (point) => [left + (point[0] - map.x) * scale, top + (point[1] - map.y) * scale];
1830
1833
  const markColor = (value) => chartColorRamp(colors, (Math.max(domain[0], Math.min(domain[1], value)) - domain[0]) / Math.max(1, domain[1] - domain[0]));
1831
- return /* @__PURE__ */ jsxs9("g", { ref: control.host, ...control.handlers, "data-svg-map": name, tabIndex: roam ? 0 : void 0, role: "group", "aria-label": `${name}\u6F2B\u6E38`, style: { touchAction: "none" }, children: [
1834
+ return /* @__PURE__ */ jsxs9("g", { ref: control.host, ...withTitleTooltip(control.handlers), "data-svg-map": name, tabIndex: roam ? 0 : void 0, role: "group", "aria-label": `${name}\u6F2B\u6E38`, style: { touchAction: "none" }, children: [
1832
1835
  roam ? /* @__PURE__ */ jsx12("rect", { x, y, width, height, fill: "transparent" }) : null,
1833
1836
  /* @__PURE__ */ jsxs9("g", { "data-svg-map-transform": "", transform: `translate(${control.view.x} ${control.view.y}) scale(${control.view.scale})`, children: [
1834
1837
  /* @__PURE__ */ jsxs9("g", { transform: `translate(${left} ${top}) scale(${scale}) translate(${-map.x} ${-map.y})`, children: [
@@ -4290,7 +4293,7 @@ var LineChart = forwardRef2(function LineChart2({ calculableMode = "resize", onT
4290
4293
  const PLOT2 = plot;
4291
4294
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
4292
4295
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
4293
- const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ jsx30("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...zoomControlBounds, children: /* @__PURE__ */ jsx30(ChartDataZoom, { handleLabels: [categories[Math.min(categories.length - 1, Math.floor(Math.min(...zoomValue) / 100 * categories.length))] ?? "", categories[Math.max(0, Math.ceil(Math.max(...zoomValue) / 100 * categories.length) - 1)] ?? ""], shadowBounds: zoomControlBounds, panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), onChange: setZoomValue }) }) : null;
4296
+ const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ jsx30("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...withTitleTooltip(zoomControlBounds), children: /* @__PURE__ */ jsx30(ChartDataZoom, { handleLabels: [categories[Math.min(categories.length - 1, Math.floor(Math.min(...zoomValue) / 100 * categories.length))] ?? "", categories[Math.max(0, Math.ceil(Math.max(...zoomValue) / 100 * categories.length) - 1)] ?? ""], shadowBounds: zoomControlBounds, panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), onChange: setZoomValue }) }) : null;
4294
4297
  const [zoomBrushActive, setZoomBrushActive] = useState28(false);
4295
4298
  const [zoomHistory, setZoomHistory] = useState28(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
4296
4299
  const zoomBrush = dataZoom && zoomBrushActive ? { minSelectionSize: zoomMinSelectionSize, selectionStyle: zoomSelectionStyle, selectionShape: zoomSelectionShape, bounds: PLOT2, onCancel: () => setZoomBrushActive(false), onSelect: (range) => {
@@ -5917,7 +5920,7 @@ var MapChart = forwardRef2(function MapChart2({ overlayProjection, bundledLines,
5917
5920
  ];
5918
5921
  };
5919
5922
  return /* @__PURE__ */ jsxs21(SiaChart, { ...props, ref, toolbox: chartToolbox, empty: !collection?.features.length && !overlayProjection, ariaLabel: props.ariaLabel ?? "\u5730\u56FE", children: [
5920
- /* @__PURE__ */ jsxs21("g", { ref: roamControl.host, ...roamControl.handlers, "data-map-viewport": true, tabIndex: roam ? 0 : void 0, role: roam ? "group" : void 0, "aria-label": roam ? "\u5730\u56FE\u6F2B\u6E38\uFF1A\u62D6\u52A8\u5E73\u79FB\u3001\u6EDA\u8F6E\u7F29\u653E\u3001Home \u8FD8\u539F" : void 0, style: { touchAction: roam ? "none" : void 0 }, children: [
5923
+ /* @__PURE__ */ jsxs21("g", { ref: roamControl.host, ...withTitleTooltip(roamControl.handlers), "data-map-viewport": true, tabIndex: roam ? 0 : void 0, role: roam ? "group" : void 0, "aria-label": roam ? "\u5730\u56FE\u6F2B\u6E38\uFF1A\u62D6\u52A8\u5E73\u79FB\u3001\u6EDA\u8F6E\u7F29\u653E\u3001Home \u8FD8\u539F" : void 0, style: { touchAction: roam ? "none" : void 0 }, children: [
5921
5924
  roam ? /* @__PURE__ */ jsx30("rect", { x: 0, y: 0, width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, fill: "transparent", className: "sia-chart__map-roam-surface" }) : null,
5922
5925
  /* @__PURE__ */ jsxs21("g", { "data-map-transform": true, style: { display: showMap ? void 0 : "none" }, transform: `translate(${view.x} ${view.y}) scale(${view.scale})`, children: [
5923
5926
  collection?.features.map((feature, featureIndex) => {
@@ -1,6 +1,7 @@
1
1
  import {
2
- useFloatingPlaceholder
3
- } from "./chunk-3VJ4CZDQ.js";
2
+ useFloatingPlaceholder,
3
+ withTitleTooltip
4
+ } from "./chunk-NSSPGXNM.js";
4
5
 
5
6
  // src/components/MarkdownEditor.tsx
6
7
  import { useEffect, useRef, useState } from "react";
@@ -378,7 +379,7 @@ function MarkdownEditor({
378
379
  className: ["sia-markdown-editor", floating.className, disabled ? "is-disabled" : "", className].filter(Boolean).join(" "),
379
380
  style: editorStyle,
380
381
  "data-ready": ready ? "true" : "false",
381
- ...props,
382
+ ...withTitleTooltip(props),
382
383
  onBlurCapture: (event) => {
383
384
  props.onBlurCapture?.(event);
384
385
  const current = editorRef.current?.getValue();