@sia.soul/sia-react-ui 0.1.142 → 0.1.143

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 (47) hide show
  1. package/dist/{Button-BiL3Wjsd.d.ts → Button-C8W8ZHWV.d.ts} +1 -1
  2. package/dist/{Button-O_pNB3SQ.d.cts → Button-CxKBjLda.d.cts} +1 -1
  3. package/dist/{Select-DeD4O8FL.d.ts → Select-CTSd8zum.d.ts} +14 -10
  4. package/dist/{Select-Y0e9kaxE.d.cts → Select-bKLket9n.d.cts} +14 -10
  5. package/dist/chart.cjs +1051 -335
  6. package/dist/chart.js +5 -5
  7. package/dist/chunk-4OHS7RXE.js +1004 -0
  8. package/dist/{chunk-WIRIEIRO.js → chunk-4TYHSAR3.js} +5 -5
  9. package/dist/{chunk-TUGCP3GB.js → chunk-566S64IP.js} +5 -5
  10. package/dist/{chunk-CZ2ITBRW.js → chunk-7SEGBB6V.js} +34 -5
  11. package/dist/{chunk-KY6A5IJH.js → chunk-ETQJ2DQ2.js} +1 -1
  12. package/dist/{chunk-WD56MJO2.js → chunk-F52O2MOV.js} +7 -3
  13. package/dist/{chunk-PQBCD54U.js → chunk-JRXYM5YH.js} +167 -64
  14. package/dist/{chunk-SCEHVGKV.js → chunk-LKLPCYEP.js} +2 -2
  15. package/dist/{chunk-3KYG7IU7.js → chunk-MD4CGSOR.js} +105 -61
  16. package/dist/{chunk-PGP4TEPP.js → chunk-ORSQAJ22.js} +154 -494
  17. package/dist/{chunk-SO7IJZIR.js → chunk-PD3K5U5Y.js} +2 -2
  18. package/dist/{chunk-UVHC6OEX.js → chunk-WCYVBO2N.js} +342 -123
  19. package/dist/{core-DYo5C4Si.d.cts → core-COaZfusa.d.cts} +51 -24
  20. package/dist/{core-sWwvVAmP.d.ts → core-CvfsQGuT.d.ts} +51 -24
  21. package/dist/core.cjs +1996 -1250
  22. package/dist/core.css +413 -344
  23. package/dist/core.d.cts +3 -3
  24. package/dist/core.d.ts +3 -3
  25. package/dist/core.js +18 -9
  26. package/dist/game.cjs +1984 -1169
  27. package/dist/game.css +182 -177
  28. package/dist/game.d.cts +1 -1
  29. package/dist/game.d.ts +1 -1
  30. package/dist/game.js +8 -3
  31. package/dist/index.cjs +4654 -3541
  32. package/dist/index.css +413 -344
  33. package/dist/index.d.cts +77 -80
  34. package/dist/index.d.ts +77 -80
  35. package/dist/index.js +1075 -713
  36. package/dist/markdown-editor.cjs +727 -40
  37. package/dist/markdown-editor.js +8 -3
  38. package/dist/rich-text-editor.cjs +1265 -308
  39. package/dist/rich-text-editor.js +12 -7
  40. package/dist/{select-date-range-X6a9Y-Te.d.ts → select-date-range-C8cacfmb.d.ts} +1 -1
  41. package/dist/{select-date-range-DiBQQ0Rn.d.cts → select-date-range-Dad0IdD4.d.cts} +1 -1
  42. package/dist/select-date-range.cjs +1277 -806
  43. package/dist/select-date-range.d.cts +3 -3
  44. package/dist/select-date-range.d.ts +3 -3
  45. package/dist/select-date-range.js +13 -8
  46. package/package.json +9 -2
  47. package/dist/chunk-NZMUW5XI.js +0 -292
@@ -1,47 +1,206 @@
1
1
  import {
2
2
  TextArea
3
- } from "./chunk-SCEHVGKV.js";
3
+ } from "./chunk-LKLPCYEP.js";
4
4
  import {
5
5
  Icon,
6
6
  Modal
7
- } from "./chunk-PQBCD54U.js";
7
+ } from "./chunk-JRXYM5YH.js";
8
8
  import {
9
9
  Button
10
- } from "./chunk-CZ2ITBRW.js";
10
+ } from "./chunk-7SEGBB6V.js";
11
11
  import {
12
12
  PopupPortal,
13
+ hasFloatingScrollbarInteraction,
14
+ resolveFloatingScrollbarTarget,
13
15
  useControlSize,
14
16
  useControllableState,
15
17
  usePlaceholderMode,
16
18
  withTitleTooltip
17
- } from "./chunk-NZMUW5XI.js";
19
+ } from "./chunk-4OHS7RXE.js";
18
20
 
19
21
  // src/components/Navigation.tsx
20
- import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
22
+ import { useEffect, useId, useLayoutEffect as useLayoutEffect3, useMemo, useRef as useRef3, useState } from "react";
21
23
 
22
- // src/components/floatingScrollbarOwnership.ts
23
- var targets = /* @__PURE__ */ new Map();
24
- function registerFloatingScrollbar(track, target) {
25
- targets.set(track, { target, dragging: false });
26
- return () => {
27
- targets.delete(track);
28
- };
29
- }
30
- function setFloatingScrollbarDragging(track, dragging) {
31
- const entry = targets.get(track);
32
- if (entry) entry.dragging = dragging;
33
- }
34
- function resolveFloatingScrollbarTarget(target) {
35
- const track = target instanceof Element ? target.closest(".sia-floating-scrollbar") : null;
36
- return track && targets.get(track)?.target || target;
24
+ // src/components/MenuSelectionMotion.tsx
25
+ import { useLayoutEffect, useRef } from "react";
26
+ import { jsx } from "react/jsx-runtime";
27
+ function MenuSelectionMotion({ rootRef, enabled }) {
28
+ const indicatorRef = useRef(null);
29
+ const previous = useRef();
30
+ const animation = useRef();
31
+ useLayoutEffect(() => {
32
+ const indicator = indicatorRef.current;
33
+ const root = rootRef.current ?? indicator?.parentElement;
34
+ if (!root || !indicator) return;
35
+ let frame = 0;
36
+ const media = window.matchMedia("(prefers-reduced-motion: reduce)");
37
+ const update = () => {
38
+ const candidates = [...root.querySelectorAll(".sia-menu__entry.is-selected > .sia-menu__item")].filter((button) => button.closest(".sia-menu-motion-surface") === root && !button.closest('[aria-hidden="true"]') && button.getClientRects().length > 0);
39
+ const target = enabled && candidates.length === 1 ? candidates[0] : void 0;
40
+ root.querySelectorAll("[data-sia-menu-highlight]").forEach((button) => {
41
+ if (button !== target && button.closest(".sia-menu-motion-surface") === root) button.removeAttribute("data-sia-menu-highlight");
42
+ });
43
+ if (!target || root.offsetWidth === 0) {
44
+ animation.current?.cancel();
45
+ indicator.style.display = "none";
46
+ previous.current = void 0;
47
+ return;
48
+ }
49
+ const bounds = root.getBoundingClientRect();
50
+ const scaleX = bounds.width / root.offsetWidth || 1;
51
+ const scaleY = bounds.height / root.offsetHeight || 1;
52
+ const box = (node) => {
53
+ const rect = node.getBoundingClientRect();
54
+ return { x: (rect.left - bounds.left) / scaleX + root.scrollLeft - root.clientLeft, y: (rect.top - bounds.top) / scaleY + root.scrollTop - root.clientTop, width: rect.width / scaleX, height: rect.height / scaleY };
55
+ };
56
+ const next = { ...box(target), key: target.dataset.menuKey ?? "" };
57
+ if (!target.hasAttribute("data-sia-menu-highlight")) target.dataset.siaMenuHighlight = "";
58
+ indicator.style.borderRadius = getComputedStyle(target).borderRadius;
59
+ indicator.style.opacity = target.parentElement ? getComputedStyle(target.parentElement).opacity : "1";
60
+ const last = previous.current;
61
+ if (last && last.key === next.key && ["x", "y", "width", "height"].every((key) => Math.abs(last[key] - next[key]) < 0.5)) return;
62
+ const from = animation.current?.playState === "running" ? box(indicator) : last;
63
+ animation.current?.cancel();
64
+ indicator.style.display = "block";
65
+ indicator.style.width = `${next.width}px`;
66
+ indicator.style.height = `${next.height}px`;
67
+ indicator.style.transform = `translate(${next.x}px, ${next.y}px)`;
68
+ previous.current = next;
69
+ if (from && last?.key !== next.key && !media.matches && indicator.animate) {
70
+ const running = indicator.animate([
71
+ { transform: `translate(${from.x}px, ${from.y}px) scale(${from.width / next.width}, ${from.height / next.height})` },
72
+ { transform: `translate(${next.x}px, ${next.y}px) scale(1)` }
73
+ ], { duration: 260, easing: "cubic-bezier(.22,.8,.25,1)" });
74
+ animation.current = running;
75
+ running.finished.then(() => {
76
+ if (animation.current === running) {
77
+ running.cancel();
78
+ animation.current = void 0;
79
+ }
80
+ }, () => {
81
+ });
82
+ }
83
+ };
84
+ const schedule = () => {
85
+ if (!frame) frame = requestAnimationFrame(() => {
86
+ frame = 0;
87
+ update();
88
+ });
89
+ };
90
+ const reduceMotion = () => {
91
+ animation.current?.cancel();
92
+ update();
93
+ };
94
+ update();
95
+ const observer = new ResizeObserver(schedule);
96
+ observer.observe(root);
97
+ root.querySelectorAll(".sia-menu__item").forEach((button) => observer.observe(button));
98
+ root.addEventListener("transitionend", schedule);
99
+ media.addEventListener("change", reduceMotion);
100
+ return () => {
101
+ observer.disconnect();
102
+ cancelAnimationFrame(frame);
103
+ root.removeEventListener("transitionend", schedule);
104
+ media.removeEventListener("change", reduceMotion);
105
+ };
106
+ });
107
+ useLayoutEffect(() => () => {
108
+ animation.current?.cancel();
109
+ }, []);
110
+ return /* @__PURE__ */ jsx("li", { ref: indicatorRef, className: "sia-menu__selection", role: "presentation", "aria-hidden": "true" });
37
111
  }
38
- function hasFloatingScrollbarInteraction(container) {
39
- if (!container) return false;
40
- return [...targets].some(([track, entry]) => container.contains(entry.target) && (entry.dragging || track.matches(":hover")));
112
+
113
+ // src/components/SegmentedSelectionMotion.tsx
114
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef2 } from "react";
115
+ import { jsx as jsx2 } from "react/jsx-runtime";
116
+ function SegmentedSelectionMotion({ rootRef, enabled }) {
117
+ const indicatorRef = useRef2(null);
118
+ const previous = useRef2();
119
+ const animation = useRef2();
120
+ useLayoutEffect2(() => {
121
+ const root = rootRef.current;
122
+ const indicator = indicatorRef.current;
123
+ if (!root || !indicator) return;
124
+ let frame = 0;
125
+ const media = window.matchMedia("(prefers-reduced-motion: reduce)");
126
+ const update = () => {
127
+ const candidates = [...root.querySelectorAll(":scope > button.is-selected")].filter((button) => button.parentElement === root && !button.closest('[aria-hidden="true"]') && button.getClientRects().length > 0);
128
+ const target = enabled && candidates.length === 1 ? candidates[0] : void 0;
129
+ root.querySelectorAll("[data-sia-segmented-highlight]").forEach((button) => {
130
+ if (button !== target && button.parentElement === root) button.removeAttribute("data-sia-segmented-highlight");
131
+ });
132
+ if (!target || root.offsetWidth === 0) {
133
+ animation.current?.cancel();
134
+ indicator.style.display = "none";
135
+ previous.current = void 0;
136
+ return;
137
+ }
138
+ const bounds = root.getBoundingClientRect();
139
+ const scaleX = bounds.width / root.offsetWidth || 1;
140
+ const scaleY = bounds.height / root.offsetHeight || 1;
141
+ const box = (node) => {
142
+ const rect = node.getBoundingClientRect();
143
+ return { x: (rect.left - bounds.left) / scaleX + root.scrollLeft - root.clientLeft, y: (rect.top - bounds.top) / scaleY + root.scrollTop - root.clientTop, width: rect.width / scaleX, height: rect.height / scaleY };
144
+ };
145
+ const next = { ...box(target), key: target.dataset.segmentedKey ?? "" };
146
+ if (!target.hasAttribute("data-sia-segmented-highlight")) target.dataset.siaSegmentedHighlight = "";
147
+ indicator.style.borderRadius = getComputedStyle(target).borderRadius;
148
+ indicator.style.opacity = target.disabled ? ".5" : "1";
149
+ const last = previous.current;
150
+ if (last && last.key === next.key && ["x", "y", "width", "height"].every((key) => Math.abs(last[key] - next[key]) < 0.5)) return;
151
+ const from = animation.current && ["running", "paused"].includes(animation.current.playState) ? box(indicator) : last;
152
+ animation.current?.cancel();
153
+ indicator.style.display = "block";
154
+ indicator.style.width = `${next.width}px`;
155
+ indicator.style.height = `${next.height}px`;
156
+ indicator.style.transform = `translate(${next.x}px, ${next.y}px)`;
157
+ previous.current = next;
158
+ if (from && last?.key !== next.key && !media.matches && indicator.animate) {
159
+ const running = indicator.animate([
160
+ { transform: `translate(${from.x}px, ${from.y}px) scale(${from.width / next.width}, ${from.height / next.height})` },
161
+ { transform: `translate(${next.x}px, ${next.y}px) scale(1)` }
162
+ ], { duration: 260, easing: "cubic-bezier(.22,.8,.25,1)" });
163
+ animation.current = running;
164
+ running.finished.then(() => {
165
+ if (animation.current === running) {
166
+ running.cancel();
167
+ animation.current = void 0;
168
+ }
169
+ }, () => {
170
+ });
171
+ }
172
+ };
173
+ const schedule = () => {
174
+ if (!frame) frame = requestAnimationFrame(() => {
175
+ frame = 0;
176
+ update();
177
+ });
178
+ };
179
+ const reduceMotion = () => {
180
+ animation.current?.cancel();
181
+ update();
182
+ };
183
+ update();
184
+ const observer = new ResizeObserver(schedule);
185
+ observer.observe(root);
186
+ root.querySelectorAll(":scope > button").forEach((button) => observer.observe(button));
187
+ root.addEventListener("transitionend", schedule);
188
+ media.addEventListener("change", reduceMotion);
189
+ return () => {
190
+ observer.disconnect();
191
+ cancelAnimationFrame(frame);
192
+ root.removeEventListener("transitionend", schedule);
193
+ media.removeEventListener("change", reduceMotion);
194
+ };
195
+ });
196
+ useLayoutEffect2(() => () => {
197
+ animation.current?.cancel();
198
+ }, []);
199
+ return /* @__PURE__ */ jsx2("span", { ref: indicatorRef, className: "sia-segmented__selection", role: "presentation", "aria-hidden": "true" });
41
200
  }
42
201
 
43
202
  // src/components/Navigation.tsx
44
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
203
+ import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
45
204
  import { createElement } from "react";
46
205
  function MenuPopup({
47
206
  anchorRef,
@@ -51,35 +210,28 @@ function MenuPopup({
51
210
  placement,
52
211
  menuId,
53
212
  theme,
213
+ multiple,
54
214
  children,
55
215
  onMouseEnter,
56
216
  onMouseLeave
57
217
  }) {
58
- const [mounted, setMounted] = useState(open);
218
+ const listRef = useRef3(null);
59
219
  const [fontSize, setFontSize] = useState();
60
- useLayoutEffect(() => {
220
+ useLayoutEffect3(() => {
61
221
  const anchor = anchorRef.current;
62
- if (!mounted || !anchor) return;
222
+ if (!open || !anchor) return;
63
223
  const syncFontSize = () => setFontSize(getComputedStyle(anchor).fontSize);
64
224
  syncFontSize();
65
225
  const observer = new ResizeObserver(syncFontSize);
66
226
  observer.observe(anchor);
67
227
  return () => observer.disconnect();
68
- });
69
- useEffect(() => {
70
- if (open) {
71
- setMounted(true);
72
- return void 0;
73
- }
74
- const timer = window.setTimeout(() => setMounted(false), 160);
75
- return () => window.clearTimeout(timer);
76
- }, [open]);
77
- return /* @__PURE__ */ jsx(
228
+ }, [open, anchorRef, children]);
229
+ return /* @__PURE__ */ jsx3(
78
230
  PopupPortal,
79
231
  {
80
232
  ref: popupRef,
81
233
  anchorRef,
82
- open: mounted,
234
+ open,
83
235
  placement,
84
236
  offset: placement.startsWith("right") || placement.startsWith("left") ? 16 : 4,
85
237
  className: `sia-menu__popup sia-menu--${theme}${open ? " is-open" : " is-closing"}`,
@@ -88,7 +240,10 @@ function MenuPopup({
88
240
  "data-sia-menu-path": JSON.stringify(keyPath),
89
241
  onMouseEnter,
90
242
  onMouseLeave,
91
- children: /* @__PURE__ */ jsx("ul", { className: "sia-menu__popup-list", role: "menu", children })
243
+ children: /* @__PURE__ */ jsxs("ul", { ref: listRef, className: "sia-menu__popup-list sia-menu-motion-surface", role: "menu", children: [
244
+ children,
245
+ /* @__PURE__ */ jsx3(MenuSelectionMotion, { rootRef: listRef, enabled: !multiple })
246
+ ] })
92
247
  }
93
248
  );
94
249
  }
@@ -99,11 +254,12 @@ function MenuEntry({
99
254
  props,
100
255
  reserveIcon
101
256
  }) {
102
- const anchorRef = useRef(null);
103
- const popupRef = useRef(null);
104
- const closeTimerRef = useRef(void 0);
105
- const toggleRef = useRef(props.toggle);
106
- useLayoutEffect(() => {
257
+ const anchorRef = useRef3(null);
258
+ const popupRef = useRef3(null);
259
+ const submenuRef = useRef3(null);
260
+ const closeTimerRef = useRef3(void 0);
261
+ const toggleRef = useRef3(props.toggle);
262
+ useLayoutEffect3(() => {
107
263
  toggleRef.current = props.toggle;
108
264
  });
109
265
  const hasChildren = Boolean(item.children?.length);
@@ -112,6 +268,23 @@ function MenuEntry({
112
268
  const path = [item.key, ...parents];
113
269
  const collapsed = props.inlineCollapsed && level === 0;
114
270
  const inlineSubmenu = props.mode === "inline" && !collapsed;
271
+ useLayoutEffect3(() => {
272
+ const submenu2 = submenuRef.current;
273
+ if (!inlineSubmenu || !submenu2) return;
274
+ const measure = () => {
275
+ const children = [...submenu2.children].filter((child) => !child.classList.contains("sia-menu__selection"));
276
+ const first = children[0], last = children.at(-1);
277
+ if (!first || !last) return;
278
+ const height = `${Math.ceil(last.offsetTop + last.offsetHeight - first.offsetTop + parseFloat(getComputedStyle(first).marginTop) + parseFloat(getComputedStyle(last).marginBottom) + 8)}px`;
279
+ if (submenu2.style.getPropertyValue("--sia-menu-submenu-height") !== height)
280
+ submenu2.style.setProperty("--sia-menu-submenu-height", height);
281
+ };
282
+ measure();
283
+ const observer = new ResizeObserver(measure);
284
+ for (const child of submenu2.children)
285
+ if (child.classList.contains("sia-menu__entry") || child.classList.contains("sia-menu__group")) observer.observe(child);
286
+ return () => observer.disconnect();
287
+ }, [inlineSubmenu, item.children, isOpen]);
115
288
  useEffect(() => () => {
116
289
  if (closeTimerRef.current !== void 0) window.clearTimeout(closeTimerRef.current);
117
290
  }, []);
@@ -133,7 +306,7 @@ function MenuEntry({
133
306
  }, 100);
134
307
  }
135
308
  const hover = props.triggerSubMenuAction === "hover" && hasChildren && !inlineSubmenu;
136
- const submenu = hasChildren ? /* @__PURE__ */ jsx(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [item.key, ...parents], props }) : null;
309
+ const submenu = hasChildren ? /* @__PURE__ */ jsx3(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [item.key, ...parents], props }) : null;
137
310
  const popupPlacement = props.mode === "horizontal" && level === 0 ? "bottom-start" : "right-start";
138
311
  return /* @__PURE__ */ jsxs(
139
312
  "li",
@@ -155,21 +328,25 @@ function MenuEntry({
155
328
  style: { paddingInlineStart: props.mode === "inline" && !props.inlineCollapsed ? 12 + level * props.inlineIndent : void 0 },
156
329
  ...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
157
330
  disabled: item.disabled,
331
+ "aria-label": collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : void 0,
158
332
  "aria-current": isSelected ? "page" : void 0,
159
333
  "data-menu-key": item.key,
160
334
  "data-applied": item.applied || void 0,
161
335
  "aria-expanded": hasChildren ? isOpen : void 0,
162
336
  onClick: (event) => hasChildren ? props.toggle(item.key) : props.select(item, path, event),
163
337
  children: [
164
- reserveIcon ? /* @__PURE__ */ jsx("span", { className: "sia-menu__icon", style: item.iconSize ? { width: item.iconSize, height: item.iconSize, flexBasis: item.iconSize } : void 0, "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
165
- item.applied ? /* @__PURE__ */ jsx("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ jsx(Icon, { name: "circle-check", variant: "filled", size: 32 }) }) : null,
166
- !collapsed ? /* @__PURE__ */ jsx("span", { className: "sia-menu__label", children: item.label }) : null,
167
- !collapsed && item.extra ? /* @__PURE__ */ jsx("span", { className: "sia-menu__extra", children: item.extra }) : null,
168
- !collapsed && hasChildren ? /* @__PURE__ */ jsx(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
338
+ reserveIcon ? /* @__PURE__ */ jsx3("span", { className: "sia-menu__icon", style: item.iconSize ? { width: item.iconSize, height: item.iconSize, flexBasis: item.iconSize } : void 0, "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
339
+ item.applied ? /* @__PURE__ */ jsx3("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ jsx3(Icon, { name: "circle-check", variant: "filled", size: 32 }) }) : null,
340
+ !collapsed ? /* @__PURE__ */ jsx3("span", { className: "sia-menu__label", children: item.label }) : null,
341
+ !collapsed && item.extra ? /* @__PURE__ */ jsx3("span", { className: "sia-menu__extra", children: item.extra }) : null,
342
+ !collapsed && hasChildren ? /* @__PURE__ */ jsx3(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
169
343
  ]
170
344
  }
171
345
  ),
172
- hasChildren ? inlineSubmenu ? /* @__PURE__ */ jsx("ul", { className: "sia-menu__submenu", role: "menu", "aria-hidden": !isOpen, children: submenu }) : /* @__PURE__ */ jsx(
346
+ hasChildren ? inlineSubmenu ? /* @__PURE__ */ jsxs("ul", { ref: submenuRef, className: "sia-menu__submenu sia-menu-motion-surface", role: "menu", "aria-hidden": !isOpen, children: [
347
+ submenu,
348
+ /* @__PURE__ */ jsx3(MenuSelectionMotion, { rootRef: submenuRef, enabled: !props.multiple })
349
+ ] }) : /* @__PURE__ */ jsx3(
173
350
  MenuPopup,
174
351
  {
175
352
  anchorRef,
@@ -179,6 +356,7 @@ function MenuEntry({
179
356
  placement: popupPlacement,
180
357
  menuId: props.menuId,
181
358
  theme: props.theme,
359
+ multiple: props.multiple,
182
360
  onMouseEnter: hover ? cancelClose : void 0,
183
361
  onMouseLeave: hover ? scheduleClose : void 0,
184
362
  children: submenu
@@ -198,13 +376,13 @@ function MenuLevel({
198
376
  props,
199
377
  reserveIcon = hasMenuIcon(items)
200
378
  }) {
201
- return /* @__PURE__ */ jsx(Fragment, { children: items.map((item, index) => {
202
- if (item.type === "divider") return /* @__PURE__ */ jsx("li", { className: "sia-menu__divider", role: "separator" }, item.key || `divider-${index}`);
379
+ return /* @__PURE__ */ jsx3(Fragment, { children: items.map((item, index) => {
380
+ if (item.type === "divider") return /* @__PURE__ */ jsx3("li", { className: "sia-menu__divider", role: "separator" }, item.key || `divider-${index}`);
203
381
  if (item.type === "group") return /* @__PURE__ */ jsxs("li", { className: "sia-menu__group", children: [
204
- /* @__PURE__ */ jsx("div", { className: "sia-menu__group-title", children: item.label }),
205
- /* @__PURE__ */ jsx("ul", { role: "group", children: /* @__PURE__ */ jsx(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [...parents, item.key], props, reserveIcon }) })
382
+ /* @__PURE__ */ jsx3("div", { className: "sia-menu__group-title", children: item.label }),
383
+ /* @__PURE__ */ jsx3("ul", { role: "group", children: /* @__PURE__ */ jsx3(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [...parents, item.key], props, reserveIcon }) })
206
384
  ] }, item.key);
207
- return /* @__PURE__ */ jsx(MenuEntry, { item, level, parents, props, reserveIcon }, item.key);
385
+ return /* @__PURE__ */ jsx3(MenuEntry, { item, level, parents, props, reserveIcon }, item.key);
208
386
  }) });
209
387
  }
210
388
  function Menu({
@@ -232,11 +410,11 @@ function Menu({
232
410
  ...rest
233
411
  }) {
234
412
  const menuId = useId();
235
- const rootRef = useRef(null);
413
+ const rootRef = useRef3(null);
236
414
  const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
237
415
  const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
238
- const pendingOpenRef = useRef(open);
239
- useLayoutEffect(() => {
416
+ const pendingOpenRef = useRef3(open);
417
+ useLayoutEffect3(() => {
240
418
  pendingOpenRef.current = open;
241
419
  });
242
420
  const popupPaths = useMemo(() => {
@@ -251,9 +429,9 @@ function Menu({
251
429
  visit(items, []);
252
430
  return paths;
253
431
  }, [items]);
254
- const revealedKey = useRef();
432
+ const revealedKey = useRef3();
255
433
  const firstSelected = selected[0];
256
- useLayoutEffect(() => {
434
+ useLayoutEffect3(() => {
257
435
  if (!autoScrollSelected || firstSelected === void 0) {
258
436
  revealedKey.current = void 0;
259
437
  return;
@@ -262,9 +440,12 @@ function Menu({
262
440
  if (!root || revealedKey.current === firstSelected || mode === "horizontal") return;
263
441
  const reveal = () => {
264
442
  if (revealedKey.current === firstSelected || root.clientHeight === 0) return;
265
- const target = Array.from(root.querySelectorAll(".sia-menu__item")).find((element) => element.dataset.menuKey === firstSelected && element.getBoundingClientRect().height > 0);
443
+ const target = Array.from(root.querySelectorAll(".sia-menu__item")).find((element) => element.dataset.menuKey === firstSelected && element.getBoundingClientRect().height > 0 && !element.closest('[aria-hidden="true"]'));
266
444
  if (!target) return;
267
445
  const bounds = root.getBoundingClientRect(), item = target.getBoundingClientRect();
446
+ for (let parent = target.parentElement; parent && parent !== root; parent = parent.parentElement) {
447
+ if (parent.classList.contains("sia-menu__submenu") && item.bottom > parent.getBoundingClientRect().bottom + 1) return;
448
+ }
268
449
  const top = bounds.top + root.clientTop, bottom = top + root.clientHeight;
269
450
  if (item.top < top || item.bottom > bottom)
270
451
  root.scrollTop += item.top - top - Math.max(0, (root.clientHeight - item.height) / 2);
@@ -273,8 +454,9 @@ function Menu({
273
454
  reveal();
274
455
  const observer = new ResizeObserver(reveal);
275
456
  observer.observe(root);
457
+ root.querySelectorAll(".sia-menu__submenu").forEach((submenu) => observer.observe(submenu));
276
458
  return () => observer.disconnect();
277
- }, [autoScrollSelected, firstSelected, items, mode]);
459
+ }, [autoScrollSelected, firstSelected, items, mode, open]);
278
460
  useEffect(() => {
279
461
  if (mode === "inline" || !open.length) return void 0;
280
462
  const closeOutside = (event) => {
@@ -307,37 +489,82 @@ function Menu({
307
489
  else onSelect?.({ ...info, selectedKeys: [...next] });
308
490
  if (mode !== "inline") setOpen([]);
309
491
  }
492
+ function handleMenuKeyDown(event) {
493
+ rest.onKeyDown?.(event);
494
+ if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;
495
+ const target = event.target instanceof Element ? event.target : null;
496
+ const button = target?.closest("button.sia-menu__item");
497
+ const level = button?.closest('ul[role="menu"]') ?? rootRef.current;
498
+ if (!level) return;
499
+ const enabled = Array.from(level.querySelectorAll("button.sia-menu__item:not(:disabled)")).filter((item) => item.closest('ul[role="menu"]') === level && item.getClientRects().length > 0);
500
+ const index = button ? enabled.indexOf(button) : -1;
501
+ if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
502
+ event.preventDefault();
503
+ event.stopPropagation();
504
+ const next = event.key === "Home" ? 0 : event.key === "End" ? enabled.length - 1 : event.key === "ArrowDown" ? index + 1 : (index < 0 ? enabled.length : index) - 1;
505
+ enabled[(next + enabled.length) % enabled.length]?.focus();
506
+ return;
507
+ }
508
+ if (event.key === "ArrowRight" && button?.hasAttribute("aria-expanded")) {
509
+ event.preventDefault();
510
+ event.stopPropagation();
511
+ const key = button.dataset.menuKey;
512
+ toggle(key, true);
513
+ requestAnimationFrame(() => {
514
+ const popup = [...document.querySelectorAll(".sia-menu__popup[data-sia-menu-owner]")].find((node) => node.dataset.siaMenuOwner === menuId && JSON.parse(node.dataset.siaMenuPath ?? "[]")[0] === key);
515
+ const inline = button.parentElement?.querySelector(":scope > .sia-menu__submenu");
516
+ (popup ?? inline)?.querySelector("button.sia-menu__item:not(:disabled)")?.focus();
517
+ });
518
+ return;
519
+ }
520
+ if (event.key === "ArrowLeft" || event.key === "Escape") {
521
+ const popup = button?.closest(".sia-menu__popup");
522
+ const parentKey = popup ? JSON.parse(popup.dataset.siaMenuPath ?? "[]")[0] : level.classList.contains("sia-menu__submenu") ? level.parentElement?.querySelector(":scope > button")?.dataset.menuKey : void 0;
523
+ if (!parentKey) return;
524
+ event.preventDefault();
525
+ event.stopPropagation();
526
+ toggle(parentKey, false);
527
+ const roots = [rootRef.current, ...document.querySelectorAll(".sia-menu__popup[data-sia-menu-owner]")].filter((node) => node && (node === rootRef.current || node.dataset.siaMenuOwner === menuId));
528
+ roots.flatMap((node) => [...node.querySelectorAll("button.sia-menu__item")]).find((item) => item.dataset.menuKey === parentKey)?.focus();
529
+ }
530
+ }
310
531
  const gridStyle = mode === "grid" ? { "--sia-menu-grid-columns": gridColumns === "auto" ? "repeat(auto-fill, minmax(88px, 1fr))" : `repeat(${Number.isFinite(gridColumns) ? Math.max(1, Math.floor(Number(gridColumns))) : 2}, minmax(0, 1fr))` } : {};
311
- return /* @__PURE__ */ jsx("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), style: { ...gridStyle, ...style }, "data-sia-menu-owner": menuId, children: /* @__PURE__ */ jsx(MenuLevel, { items, level: 0, parents: [], props: { interactionCursor, menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
532
+ return /* @__PURE__ */ jsxs("ul", { ref: rootRef, className: `sia-menu sia-menu-motion-surface sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), onKeyDown: handleMenuKeyDown, style: { ...gridStyle, ...style }, "data-sia-menu-owner": menuId, children: [
533
+ /* @__PURE__ */ jsx3(MenuLevel, { items, level: 0, parents: [], props: { interactionCursor, menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }),
534
+ /* @__PURE__ */ jsx3(MenuSelectionMotion, { rootRef, enabled: !multiple })
535
+ ] });
312
536
  }
313
537
  function Steps({ items, current = 0, initial = 0, direction = "horizontal", labelPlacement = "vertical", type = "default", size = "default", status = "process", progressDot = false, onChange, className = "", ...props }) {
314
- return /* @__PURE__ */ jsx("div", { className: `sia-steps sia-steps--${direction} sia-steps--${type} sia-steps--${size} sia-steps--label-${labelPlacement} ${className}`.trim(), ...withTitleTooltip(props), children: items.map((item, rawIndex) => {
538
+ return /* @__PURE__ */ jsx3("div", { className: `sia-steps sia-steps--${direction} sia-steps--${type} sia-steps--${size} sia-steps--label-${labelPlacement} ${className}`.trim(), ...withTitleTooltip(props), children: items.map((item, rawIndex) => {
315
539
  const index = rawIndex + initial;
316
540
  const itemStatus = item.status ?? (index < current ? "finish" : index === current ? status : "wait");
317
- const dot = /* @__PURE__ */ jsx("span", { className: "sia-steps__dot" });
318
- const icon = progressDot ? typeof progressDot === "function" ? progressDot(dot, { index, status: itemStatus, title: item.title, description: item.description }) : dot : item.icon ?? (itemStatus === "finish" ? /* @__PURE__ */ jsx(Icon, { name: "check", size: 15 }) : itemStatus === "error" ? /* @__PURE__ */ jsx(Icon, { name: "close", size: 14 }) : index + 1);
541
+ const dot = /* @__PURE__ */ jsx3("span", { className: "sia-steps__dot" });
542
+ const icon = progressDot ? typeof progressDot === "function" ? progressDot(dot, { index, status: itemStatus, title: item.title, description: item.description }) : dot : item.icon ?? (itemStatus === "finish" ? /* @__PURE__ */ jsx3(Icon, { name: "check", size: 15 }) : itemStatus === "error" ? /* @__PURE__ */ jsx3(Icon, { name: "close", size: 14 }) : index + 1);
319
543
  return /* @__PURE__ */ jsxs("button", { type: "button", className: `sia-steps__item sia-steps__item--${itemStatus}`, disabled: item.disabled || !onChange, onClick: () => onChange?.(index), children: [
320
544
  /* @__PURE__ */ jsxs("span", { className: "sia-steps__head", children: [
321
- /* @__PURE__ */ jsx("span", { className: "sia-steps__icon", children: icon }),
322
- /* @__PURE__ */ jsx("span", { className: "sia-steps__tail" })
545
+ /* @__PURE__ */ jsx3("span", { className: "sia-steps__icon", children: icon }),
546
+ /* @__PURE__ */ jsx3("span", { className: "sia-steps__tail" })
323
547
  ] }),
324
548
  /* @__PURE__ */ jsxs("span", { className: "sia-steps__content", children: [
325
549
  /* @__PURE__ */ jsxs("span", { className: "sia-steps__title", children: [
326
550
  item.title,
327
- item.subTitle ? /* @__PURE__ */ jsx("small", { children: item.subTitle }) : null
551
+ item.subTitle ? /* @__PURE__ */ jsx3("small", { children: item.subTitle }) : null
328
552
  ] }),
329
- item.description ? /* @__PURE__ */ jsx("span", { className: "sia-steps__description", children: item.description }) : null
553
+ item.description ? /* @__PURE__ */ jsx3("span", { className: "sia-steps__description", children: item.description }) : null
330
554
  ] }),
331
- direction === "horizontal" && labelPlacement === "horizontal" ? /* @__PURE__ */ jsx("span", { className: "sia-steps__tail sia-steps__inline-tail" }) : null
555
+ direction === "horizontal" && labelPlacement === "horizontal" ? /* @__PURE__ */ jsx3("span", { className: "sia-steps__tail sia-steps__inline-tail" }) : null
332
556
  ] }, index);
333
557
  }) });
334
558
  }
335
559
  function Segmented({ options, value, defaultValue, variant = "default", shape = "capsule", size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
336
560
  const size = useControlSize(sizeProp);
561
+ const rootRef = useRef3(null);
337
562
  const normalized = useMemo(() => options.map((option) => typeof option === "object" ? option : { label: option, value: option }), [options]);
563
+ const zigzag = variant === "zigzag" && !vertical && normalized.length === 2;
338
564
  const [current, setCurrent] = useControllableState({ value, defaultValue: defaultValue ?? normalized[0]?.value, onChange: (next) => next !== void 0 && onChange?.(next) });
339
565
  function keyboard(event) {
340
566
  onKeyDown?.(event);
567
+ if (event.defaultPrevented || disabled) return;
341
568
  if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(event.key)) return;
342
569
  event.preventDefault();
343
570
  const enabled = normalized.filter((option) => !option.disabled);
@@ -345,12 +572,15 @@ function Segmented({ options, value, defaultValue, variant = "default", shape =
345
572
  const next = event.key === "ArrowRight" || event.key === "ArrowDown" ? enabled[(index + 1) % enabled.length] : enabled[(index - 1 + enabled.length) % enabled.length];
346
573
  if (next) setCurrent(next.value);
347
574
  }
348
- return /* @__PURE__ */ jsx("div", { className: `sia-segmented sia-segmented--${size}${variant === "zigzag" && !vertical && normalized.length === 2 ? ` sia-segmented--zigzag sia-segmented--shape-${shape}` : ""}${block ? " sia-segmented--block" : ""}${vertical ? " sia-segmented--vertical" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", onKeyDown: keyboard, ...withTitleTooltip(props), children: normalized.map((option) => /* @__PURE__ */ createElement("button", { type: "button", role: "radio", "aria-checked": option.value === current, ...withTitleTooltip({ title: option.title }), className: option.value === current ? "is-selected" : "", disabled: disabled || option.disabled, key: option.value, onClick: () => setCurrent(option.value) }, option.icon, /* @__PURE__ */ jsx("span", { children: option.label ?? option.value }))) });
575
+ return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: `sia-segmented sia-segmented--${size}${zigzag ? ` sia-segmented--zigzag sia-segmented--shape-${shape}` : ""}${block ? " sia-segmented--block" : ""}${vertical ? " sia-segmented--vertical" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", onKeyDown: keyboard, ...withTitleTooltip(props), children: [
576
+ normalized.map((option) => /* @__PURE__ */ createElement("button", { "data-segmented-key": JSON.stringify(option.value), type: "button", role: "radio", "aria-checked": option.value === current, ...withTitleTooltip({ title: option.title }), className: option.value === current ? "is-selected" : "", disabled: disabled || option.disabled, key: option.value, onClick: () => setCurrent(option.value) }, option.icon, /* @__PURE__ */ jsx3("span", { children: option.label ?? option.value }))),
577
+ !zigzag && /* @__PURE__ */ jsx3(SegmentedSelectionMotion, { rootRef, enabled: true })
578
+ ] });
349
579
  }
350
580
 
351
581
  // src/components/Dropdown.tsx
352
- import { cloneElement, isValidElement, useEffect as useEffect2, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
353
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
582
+ import { cloneElement, isValidElement, useEffect as useEffect2, useLayoutEffect as useLayoutEffect4, useRef as useRef4, useState as useState2 } from "react";
583
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
354
584
  var placementMap = {
355
585
  bottomLeft: "bottom-start",
356
586
  bottomRight: "bottom-end",
@@ -383,19 +613,18 @@ function DropdownInternal({
383
613
  onKeyDown,
384
614
  ...props
385
615
  }) {
386
- const rootRef = useRef2(null);
387
- const contextAnchorRef = useRef2(null);
388
- const popupRef = useRef2(null);
389
- const openTimerRef = useRef2(void 0);
390
- const closeTimerRef = useRef2(void 0);
616
+ const rootRef = useRef4(null);
617
+ const contextAnchorRef = useRef4(null);
618
+ const popupRef = useRef4(null);
619
+ const openTimerRef = useRef4(void 0);
620
+ const closeTimerRef = useRef4(void 0);
391
621
  const [internalOpen, setInternalOpen] = useState2(defaultOpen);
392
- const [mounted, setMounted] = useState2(open ?? defaultOpen);
393
622
  const [contextPoint, setContextPoint] = useState2();
394
623
  const visible = open ?? internalOpen;
395
624
  const triggerSet = new Set(trigger);
396
625
  const pointAtCenter = typeof arrow === "object" && arrow.pointAtCenter;
397
626
  const [triggerFontSize, setTriggerFontSize] = useState2();
398
- useLayoutEffect2(() => {
627
+ useLayoutEffect4(() => {
399
628
  if (!visible || !rootRef.current) return;
400
629
  const root = rootRef.current;
401
630
  const target = root.querySelector("button, [role='button'], a") ?? (root.firstElementChild !== contextAnchorRef.current ? root.firstElementChild : null) ?? root;
@@ -404,7 +633,7 @@ function DropdownInternal({
404
633
  const observer = new ResizeObserver(syncFontSize);
405
634
  observer.observe(target);
406
635
  return () => observer.disconnect();
407
- });
636
+ }, [visible, children]);
408
637
  function clearTimer(ref) {
409
638
  if (ref.current === void 0) return;
410
639
  window.clearTimeout(ref.current);
@@ -430,17 +659,6 @@ function DropdownInternal({
430
659
  clearTimer(closeTimerRef);
431
660
  closeTimerRef.current = window.setTimeout(() => updateOpen(false, "trigger"), Math.max(0, closeDelay));
432
661
  }
433
- useEffect2(() => {
434
- if (visible) {
435
- setMounted(true);
436
- return void 0;
437
- }
438
- const timer = window.setTimeout(() => setMounted(false), 160);
439
- return () => window.clearTimeout(timer);
440
- }, [visible]);
441
- useEffect2(() => {
442
- if (!visible && !mounted) setContextPoint(void 0);
443
- }, [mounted, visible]);
444
662
  useEffect2(() => () => clearTimers(), []);
445
663
  useEffect2(() => {
446
664
  if (!visible) return void 0;
@@ -473,14 +691,14 @@ function DropdownInternal({
473
691
  };
474
692
  }, [visible]);
475
693
  useEffect2(() => {
476
- if (!visible || !mounted || !autoFocus) return void 0;
694
+ if (!visible || !autoFocus) return void 0;
477
695
  const frame = window.requestAnimationFrame(() => {
478
696
  popupRef.current?.querySelector(
479
697
  "[data-sia-dropdown-autofocus], input:not(:disabled), textarea:not(:disabled), .sia-menu__item:not(:disabled)"
480
698
  )?.focus();
481
699
  });
482
700
  return () => window.cancelAnimationFrame(frame);
483
- }, [autoFocus, mounted, visible]);
701
+ }, [autoFocus, visible]);
484
702
  function handleMenuClick(info) {
485
703
  info.domEvent.stopPropagation();
486
704
  menu.onClick?.(info);
@@ -521,7 +739,7 @@ function DropdownInternal({
521
739
  updateOpen(true, "trigger");
522
740
  }
523
741
  }
524
- const menuNode = /* @__PURE__ */ jsx2(
742
+ const menuNode = /* @__PURE__ */ jsx4(
525
743
  Menu,
526
744
  {
527
745
  mode: "vertical",
@@ -540,7 +758,7 @@ function DropdownInternal({
540
758
  );
541
759
  const triggerNode = showTriggerIcon && isValidElement(children) && children.type === Button && children.props.children !== void 0 && children.props.children !== null ? cloneElement(children, {}, /* @__PURE__ */ jsxs2("span", { className: "sia-dropdown__trigger-content", children: [
542
760
  children.props.children,
543
- /* @__PURE__ */ jsx2(Icon, { name: "chevron-down", size: 14, className: "sia-dropdown__trigger-icon" })
761
+ /* @__PURE__ */ jsx4(Icon, { name: "chevron-down", size: 14, className: "sia-dropdown__trigger-icon" })
544
762
  ] })) : children;
545
763
  return /* @__PURE__ */ jsxs2(
546
764
  "span",
@@ -558,7 +776,7 @@ function DropdownInternal({
558
776
  ...withTitleTooltip(props),
559
777
  children: [
560
778
  triggerNode,
561
- /* @__PURE__ */ jsx2(
779
+ /* @__PURE__ */ jsx4(
562
780
  "span",
563
781
  {
564
782
  ref: contextAnchorRef,
@@ -567,12 +785,15 @@ function DropdownInternal({
567
785
  "aria-hidden": "true"
568
786
  }
569
787
  ),
570
- /* @__PURE__ */ jsx2(
788
+ /* @__PURE__ */ jsx4(
571
789
  PopupPortal,
572
790
  {
573
791
  ref: popupRef,
574
792
  anchorRef: contextPoint ? contextAnchorRef : popupAnchorRef ?? rootRef,
575
- open: mounted,
793
+ open: visible,
794
+ afterOpenChange: (nextOpen) => {
795
+ if (!nextOpen) setContextPoint(void 0);
796
+ },
576
797
  placement: contextPoint ? "bottom-start" : placementMap[placement],
577
798
  offset: contextPoint ? 2 : 6,
578
799
  className: `sia-dropdown__popup${visible ? " is-open" : " is-closing"}${arrow ? " sia-dropdown__popup--arrow" : ""}${pointAtCenter ? " sia-dropdown__popup--arrow-center" : ""} ${popupClassName}`.trim(),
@@ -594,7 +815,7 @@ function DropdownInternal({
594
815
  );
595
816
  }
596
817
  function DropdownRoot(props) {
597
- return /* @__PURE__ */ jsx2(DropdownInternal, { ...props });
818
+ return /* @__PURE__ */ jsx4(DropdownInternal, { ...props });
598
819
  }
599
820
  function DropdownButton({
600
821
  children,
@@ -607,16 +828,16 @@ function DropdownButton({
607
828
  trigger = ["click"],
608
829
  ...dropdownProps
609
830
  }) {
610
- const groupRef = useRef2(null);
831
+ const groupRef = useRef4(null);
611
832
  return /* @__PURE__ */ jsxs2("span", { ref: groupRef, className: `sia-dropdown-button ${className}`.trim(), children: [
612
- /* @__PURE__ */ jsx2(Button, { ...buttonProps, disabled: disabled || buttonDisabled, onClick, children }),
613
- /* @__PURE__ */ jsx2(DropdownInternal, { ...dropdownProps, popupAnchorRef: groupRef, disabled: disabled || dropdownDisabled, trigger, showTriggerIcon: false, children: /* @__PURE__ */ jsx2(
833
+ /* @__PURE__ */ jsx4(Button, { ...buttonProps, disabled: disabled || buttonDisabled, onClick, children }),
834
+ /* @__PURE__ */ jsx4(DropdownInternal, { ...dropdownProps, popupAnchorRef: groupRef, disabled: disabled || dropdownDisabled, trigger, showTriggerIcon: false, children: /* @__PURE__ */ jsx4(
614
835
  Button,
615
836
  {
616
837
  ...buttonProps,
617
838
  className: `sia-dropdown-button__arrow ${buttonProps?.className ?? ""}`.trim(),
618
839
  disabled: disabled || dropdownDisabled,
619
- icon: /* @__PURE__ */ jsx2(Icon, { name: "chevron-down", size: 14 }),
840
+ icon: /* @__PURE__ */ jsx4(Icon, { name: "chevron-down", size: 14 }),
620
841
  "aria-label": "\u5C55\u5F00\u4E0B\u62C9\u83DC\u5355"
621
842
  }
622
843
  ) })
@@ -628,8 +849,8 @@ var Dropdown = Object.assign(DropdownRoot, {
628
849
  });
629
850
 
630
851
  // src/components/Input.tsx
631
- import { forwardRef, useId as useId2, useRef as useRef3, useState as useState3 } from "react";
632
- import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
852
+ import { forwardRef, useId as useId2, useRef as useRef5, useState as useState3 } from "react";
853
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
633
854
  var Input = forwardRef(function Input2({
634
855
  label,
635
856
  hint,
@@ -655,7 +876,7 @@ var Input = forwardRef(function Input2({
655
876
  const size = useControlSize(sizeProp);
656
877
  const fallbackId = useId2();
657
878
  const inputId = id ?? fallbackId;
658
- const localRef = useRef3(null);
879
+ const localRef = useRef5(null);
659
880
  const [uncontrolledValue, setUncontrolledValue] = useState3(() => defaultValue === void 0 ? "" : String(defaultValue));
660
881
  const currentText = value !== void 0 ? String(value) : uncontrolledValue;
661
882
  const hasValue = currentText.length > 0;
@@ -696,7 +917,7 @@ var Input = forwardRef(function Input2({
696
917
  event.preventDefault();
697
918
  localRef.current?.focus({ preventScroll: true });
698
919
  }
699
- const input = /* @__PURE__ */ jsx3(
920
+ const input = /* @__PURE__ */ jsx5(
700
921
  "input",
701
922
  {
702
923
  ...withTitleTooltip(props),
@@ -714,14 +935,14 @@ var Input = forwardRef(function Input2({
714
935
  }
715
936
  );
716
937
  const control = /* @__PURE__ */ jsxs3("span", { onMouseDown: handleControlMouseDown, className: `sia-input-control sia-input-control--${size} sia-input-control--${status}${floatingPlaceholder ? " sia-input-control--floating" : ""}${floatingPlaceholder && hasValue ? " is-filled" : ""}${disabled ? " is-disabled" : ""}`, children: [
717
- prefix ? /* @__PURE__ */ jsx3("span", { className: "sia-input-control__affix", children: prefix }) : null,
938
+ prefix ? /* @__PURE__ */ jsx5("span", { className: "sia-input-control__affix", children: prefix }) : null,
718
939
  floatingPlaceholder ? /* @__PURE__ */ jsxs3("span", { className: "sia-input-control__input-wrap", children: [
719
940
  input,
720
- /* @__PURE__ */ jsx3("span", { className: "sia-input-control__floating-placeholder", "aria-hidden": "true", children: placeholder })
941
+ /* @__PURE__ */ jsx5("span", { className: "sia-input-control__floating-placeholder", "aria-hidden": "true", children: placeholder })
721
942
  ] }) : input,
722
- allowClear && hasValue && !disabled ? /* @__PURE__ */ jsx3("button", { className: "sia-input-control__clear", type: "button", "aria-label": "\u6E05\u7A7A\u8F93\u5165", onClick: clearValue, children: /* @__PURE__ */ jsx3(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
723
- suffix ? /* @__PURE__ */ jsx3("span", { className: "sia-input-control__affix", children: suffix }) : null,
724
- expandable && !disabled && !props.readOnly && (!props.type || props.type === "text") ? /* @__PURE__ */ jsx3(
943
+ allowClear && hasValue && !disabled ? /* @__PURE__ */ jsx5("button", { className: "sia-input-control__clear", type: "button", "aria-label": "\u6E05\u7A7A\u8F93\u5165", onClick: clearValue, children: /* @__PURE__ */ jsx5(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
944
+ suffix ? /* @__PURE__ */ jsx5("span", { className: "sia-input-control__affix", children: suffix }) : null,
945
+ expandable && !disabled && !props.readOnly && (!props.type || props.type === "text") ? /* @__PURE__ */ jsx5(
725
946
  "button",
726
947
  {
727
948
  type: "button",
@@ -733,7 +954,7 @@ var Input = forwardRef(function Input2({
733
954
  setExpandedDraft(currentText);
734
955
  setExpanded(true);
735
956
  },
736
- children: /* @__PURE__ */ jsx3(Icon, { name: "expand", size: 15 })
957
+ children: /* @__PURE__ */ jsx5(Icon, { name: "expand", size: 15 })
737
958
  }
738
959
  ) : null,
739
960
  showCount ? /* @__PURE__ */ jsxs3("span", { className: `sia-input-control__count${maxLength !== void 0 && currentText.length >= maxLength ? " is-limit" : ""}`, "aria-live": "polite", children: [
@@ -741,7 +962,7 @@ var Input = forwardRef(function Input2({
741
962
  maxLength !== void 0 ? `/${maxLength}` : null
742
963
  ] }) : null
743
964
  ] });
744
- const editor = expandable ? /* @__PURE__ */ jsx3(
965
+ const editor = expandable ? /* @__PURE__ */ jsx5(
745
966
  Modal,
746
967
  {
747
968
  open: expanded,
@@ -762,7 +983,7 @@ var Input = forwardRef(function Input2({
762
983
  setUncontrolledValue(next);
763
984
  setExpanded(false);
764
985
  },
765
- children: /* @__PURE__ */ jsx3(
986
+ children: /* @__PURE__ */ jsx5(
766
987
  TextArea,
767
988
  {
768
989
  "aria-label": "\u5C55\u5F00\u7F16\u8F91\u5185\u5BB9",
@@ -779,22 +1000,20 @@ var Input = forwardRef(function Input2({
779
1000
  }
780
1001
  ) : null;
781
1002
  if (!label && !hint) return /* @__PURE__ */ jsxs3(Fragment2, { children: [
782
- /* @__PURE__ */ jsx3("span", { className: `sia-field ${className}`.trim(), children: control }),
1003
+ /* @__PURE__ */ jsx5("span", { className: `sia-field ${className}`.trim(), children: control }),
783
1004
  editor
784
1005
  ] });
785
1006
  return /* @__PURE__ */ jsxs3(Fragment2, { children: [
786
1007
  /* @__PURE__ */ jsxs3("span", { className: `sia-field ${className}`.trim(), children: [
787
- label ? /* @__PURE__ */ jsx3("label", { className: "sia-field__label", htmlFor: inputId, children: label }) : null,
1008
+ label ? /* @__PURE__ */ jsx5("label", { className: "sia-field__label", htmlFor: inputId, children: label }) : null,
788
1009
  control,
789
- hint ? /* @__PURE__ */ jsx3("span", { id: hintId, className: `sia-field__hint sia-field__hint--${status}`, children: hint }) : null
1010
+ hint ? /* @__PURE__ */ jsx5("span", { id: hintId, className: `sia-field__hint sia-field__hint--${status}`, children: hint }) : null
790
1011
  ] }),
791
1012
  editor
792
1013
  ] });
793
1014
  });
794
1015
 
795
1016
  export {
796
- registerFloatingScrollbar,
797
- setFloatingScrollbarDragging,
798
1017
  Menu,
799
1018
  Steps,
800
1019
  Segmented,