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

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 +4660 -3541
  32. package/dist/index.css +413 -344
  33. package/dist/index.d.cts +78 -81
  34. package/dist/index.d.ts +78 -81
  35. package/dist/index.js +1083 -715
  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,42 +1,80 @@
1
1
  import {
2
2
  Dropdown,
3
- Input,
4
- registerFloatingScrollbar,
5
- setFloatingScrollbarDragging
6
- } from "./chunk-UVHC6OEX.js";
3
+ Input
4
+ } from "./chunk-WCYVBO2N.js";
7
5
  import {
8
6
  Icon,
9
7
  Modal,
10
8
  isAnchorBehindOverlay,
11
9
  subscribeOverlayLayers
12
- } from "./chunk-PQBCD54U.js";
10
+ } from "./chunk-JRXYM5YH.js";
13
11
  import {
14
12
  Button
15
- } from "./chunk-CZ2ITBRW.js";
13
+ } from "./chunk-7SEGBB6V.js";
16
14
  import {
17
15
  useFloatingPlaceholder
18
- } from "./chunk-KY6A5IJH.js";
16
+ } from "./chunk-ETQJ2DQ2.js";
19
17
  import {
20
18
  ControlSizeContext,
19
+ FloatingScrollbarProvider,
21
20
  PopupPortal,
22
21
  useControlSize,
23
22
  useControllableState,
23
+ useOverlayMotion,
24
24
  withTitleTooltip
25
- } from "./chunk-NZMUW5XI.js";
25
+ } from "./chunk-4OHS7RXE.js";
26
+
27
+ // src/components/usePressFeedback.ts
28
+ import { useEffect, useRef } from "react";
29
+ function usePressFeedback() {
30
+ const running = useRef();
31
+ const cleanup = useRef();
32
+ useEffect(() => () => cleanup.current?.(), []);
33
+ return (node, compact = true) => {
34
+ if (!node?.animate) return;
35
+ const media = window.matchMedia("(prefers-reduced-motion: reduce)");
36
+ if (media.matches) return;
37
+ const from = getComputedStyle(node).scale;
38
+ cleanup.current?.();
39
+ const animation = node.animate([
40
+ { scale: from === "none" ? "1" : from, offset: 0 },
41
+ // 小控件放大过冲和二次回收,避免十几像素的图形回弹难以察觉。
42
+ { scale: compact ? ".68" : ".92", offset: 0.18 },
43
+ { scale: compact ? "1.34" : "1.08", offset: 0.46 },
44
+ { scale: compact ? ".88" : ".96", offset: 0.7 },
45
+ { scale: compact ? "1.08" : "1.025", offset: 0.86 },
46
+ { scale: "1", offset: 1 }
47
+ ], { duration: compact ? 360 : 320, easing: "cubic-bezier(.3,0,.25,1)" });
48
+ running.current = animation;
49
+ const stop = () => {
50
+ animation.cancel();
51
+ media.removeEventListener("change", stop);
52
+ if (running.current === animation) {
53
+ running.current = void 0;
54
+ cleanup.current = void 0;
55
+ }
56
+ };
57
+ cleanup.current = stop;
58
+ media.addEventListener("change", stop, { once: true });
59
+ animation.onfinish = stop;
60
+ };
61
+ }
26
62
 
27
63
  // src/components/Checkbox.tsx
28
- import { createContext, forwardRef, useContext, useEffect, useId, useMemo, useRef } from "react";
64
+ import { createContext, forwardRef, useContext, useEffect as useEffect2, useId, useMemo, useRef as useRef2 } from "react";
29
65
  import { jsx, jsxs } from "react/jsx-runtime";
30
66
  var CheckboxGroupContext = createContext(null);
31
67
  var CheckboxRoot = forwardRef(function Checkbox({ value, size: sizeProp, shape: shapeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
32
68
  const size = useControlSize(sizeProp);
33
69
  const group = useContext(CheckboxGroupContext);
34
70
  const shape = shapeProp ?? group?.shape ?? "square";
35
- const localRef = useRef(null);
71
+ const localRef = useRef2(null);
72
+ const controlRef = useRef2(null);
73
+ const press = usePressFeedback();
36
74
  const fallbackId = useId();
37
75
  const grouped = group !== null && value !== void 0;
38
76
  const currentChecked = grouped ? group.values.includes(value) : checked;
39
- useEffect(() => {
77
+ useEffect2(() => {
40
78
  if (localRef.current) localRef.current.indeterminate = indeterminate;
41
79
  }, [indeterminate]);
42
80
  function setRef(node) {
@@ -57,6 +95,10 @@ var CheckboxRoot = forwardRef(function Checkbox({ value, size: sizeProp, shape:
57
95
  disabled: disabled || group?.disabled,
58
96
  checked: currentChecked,
59
97
  defaultChecked: grouped ? void 0 : defaultChecked,
98
+ onClick: (event) => {
99
+ props.onClick?.(event);
100
+ if (!event.defaultPrevented && !event.currentTarget.disabled) press(controlRef.current);
101
+ },
60
102
  "aria-checked": indeterminate ? "mixed" : currentChecked,
61
103
  onChange: (event) => {
62
104
  if (grouped) group.toggle(value, event.currentTarget.checked);
@@ -64,7 +106,7 @@ var CheckboxRoot = forwardRef(function Checkbox({ value, size: sizeProp, shape:
64
106
  }
65
107
  }
66
108
  ),
67
- /* @__PURE__ */ jsx("span", { className: "sia-checkbox__control", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", {}) }),
109
+ /* @__PURE__ */ jsx("span", { ref: controlRef, className: "sia-checkbox__control", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", {}) }),
68
110
  children !== void 0 ? /* @__PURE__ */ jsx("span", { className: "sia-checkbox__label", children }) : null
69
111
  ] });
70
112
  });
@@ -113,426 +155,6 @@ var Checkbox2 = Object.assign(CheckboxRoot, {
113
155
  Group: CheckboxGroup
114
156
  });
115
157
 
116
- // src/components/FloatingScrollbarProvider.tsx
117
- import { useEffect as useEffect3 } from "react";
118
-
119
- // src/components/useScrollbarProximity.ts
120
- import { useEffect as useEffect2 } from "react";
121
- var users = 0;
122
- var cleanup;
123
- function useScrollbarProximity() {
124
- useEffect2(() => {
125
- if (users++ === 0) {
126
- let frame = 0;
127
- let x = -Infinity;
128
- let y = -Infinity;
129
- const nearby = /* @__PURE__ */ new Set();
130
- const clear = () => {
131
- nearby.forEach((track) => track.removeAttribute("data-scrollbar-near"));
132
- nearby.clear();
133
- };
134
- const update = () => {
135
- frame = 0;
136
- const next = /* @__PURE__ */ new Set();
137
- document.querySelectorAll(".sia-scrollbar-track").forEach((track) => {
138
- const rect = track.getBoundingClientRect();
139
- const proximity = Number.parseFloat(getComputedStyle(track).getPropertyValue("--sia-scrollbar-proximity")) || 16;
140
- if (rect.width && rect.height && x >= rect.left - proximity && x <= rect.right + proximity && y >= rect.top - proximity && y <= rect.bottom + proximity) {
141
- next.add(track);
142
- if (!nearby.has(track)) track.setAttribute("data-scrollbar-near", "true");
143
- }
144
- });
145
- nearby.forEach((track) => {
146
- if (!next.has(track)) track.removeAttribute("data-scrollbar-near");
147
- });
148
- nearby.clear();
149
- next.forEach((track) => nearby.add(track));
150
- };
151
- const move = (event) => {
152
- if (event.pointerType === "touch") return;
153
- x = event.clientX;
154
- y = event.clientY;
155
- if (!frame) frame = requestAnimationFrame(update);
156
- };
157
- const leave = () => {
158
- x = y = -Infinity;
159
- clear();
160
- };
161
- document.addEventListener("pointermove", move, { passive: true });
162
- document.documentElement.addEventListener("pointerleave", leave);
163
- window.addEventListener("blur", leave);
164
- cleanup = () => {
165
- if (frame) cancelAnimationFrame(frame);
166
- document.removeEventListener("pointermove", move);
167
- document.documentElement.removeEventListener("pointerleave", leave);
168
- window.removeEventListener("blur", leave);
169
- clear();
170
- };
171
- }
172
- return () => {
173
- if (--users === 0) {
174
- cleanup?.();
175
- cleanup = void 0;
176
- }
177
- };
178
- }, []);
179
- }
180
-
181
- // src/components/FloatingScrollbarProvider.tsx
182
- var scrollableOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
183
- var clippingOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay", "hidden", "clip"]);
184
- function isRootScroller(target) {
185
- return target === document.scrollingElement || target === document.documentElement;
186
- }
187
- function canScroll(target, axis) {
188
- if (target.matches(".sia-table__viewport, [data-sia-native-scrollbar]")) return false;
189
- if (isRootScroller(target)) {
190
- return axis === "horizontal" ? target.scrollWidth > target.clientWidth + 1 : target.scrollHeight > target.clientHeight + 1;
191
- }
192
- const style = getComputedStyle(target);
193
- const overflow = axis === "horizontal" ? style.overflowX : style.overflowY;
194
- const hasOverflow = axis === "horizontal" ? target.scrollWidth > target.clientWidth + 1 : target.scrollHeight > target.clientHeight + 1;
195
- return hasOverflow && scrollableOverflow.has(overflow);
196
- }
197
- function visibleRect(target) {
198
- if (isRootScroller(target)) {
199
- return { top: 0, right: window.innerWidth, bottom: window.innerHeight, left: 0, width: window.innerWidth, height: window.innerHeight };
200
- }
201
- const ownRect = target.getBoundingClientRect();
202
- let top = Math.max(0, ownRect.top);
203
- let right = Math.min(window.innerWidth, ownRect.right);
204
- let bottom = Math.min(window.innerHeight, ownRect.bottom);
205
- let left = Math.max(0, ownRect.left);
206
- let parent = target.parentElement;
207
- while (parent && parent !== document.body && parent !== document.documentElement) {
208
- const style = getComputedStyle(parent);
209
- const clipX = clippingOverflow.has(style.overflowX);
210
- const clipY = clippingOverflow.has(style.overflowY);
211
- if (clipX || clipY) {
212
- const rect = parent.getBoundingClientRect();
213
- if (clipX) {
214
- left = Math.max(left, rect.left);
215
- right = Math.min(right, rect.right);
216
- }
217
- if (clipY) {
218
- top = Math.max(top, rect.top);
219
- bottom = Math.min(bottom, rect.bottom);
220
- }
221
- }
222
- parent = parent.parentElement;
223
- }
224
- return {
225
- top,
226
- right,
227
- bottom,
228
- left,
229
- width: Math.max(0, right - left),
230
- height: Math.max(0, bottom - top)
231
- };
232
- }
233
- function createTrack(axis) {
234
- const track = document.createElement("div");
235
- const thumb = document.createElement("div");
236
- track.className = `sia-scrollbar-track sia-floating-scrollbar sia-floating-scrollbar--${axis}`;
237
- thumb.className = "sia-floating-scrollbar__thumb";
238
- track.dataset.axis = axis;
239
- track.setAttribute("aria-hidden", "true");
240
- track.append(thumb);
241
- return { track, thumb };
242
- }
243
- function FloatingScrollbarProvider({ disabled = false, targetRef }) {
244
- useScrollbarProximity();
245
- useEffect3(() => {
246
- if (disabled) return;
247
- const layer = document.createElement("div");
248
- layer.className = "sia-floating-scrollbar-layer";
249
- layer.setAttribute("aria-hidden", "true");
250
- document.body.append(layer);
251
- const entries = /* @__PURE__ */ new Map();
252
- let scanFrame = 0;
253
- let updateFrame = 0;
254
- const dirtyStyles = /* @__PURE__ */ new Set();
255
- let fullScan = true;
256
- const setEntryVisible = (entry, visible) => {
257
- entry.horizontalTrack.classList.toggle("sia-floating-scrollbar--visible", visible);
258
- entry.verticalTrack.classList.toggle("sia-floating-scrollbar--visible", visible);
259
- };
260
- const showEntry = (entry) => {
261
- if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
262
- entry.hideTimer = null;
263
- setEntryVisible(entry, true);
264
- };
265
- const scheduleHide = (entry, delay = 500) => {
266
- if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
267
- entry.hideTimer = window.setTimeout(() => {
268
- entry.hideTimer = null;
269
- if (!entry.hoveringTarget && !entry.hoveringTrack && !entry.dragging) setEntryVisible(entry, false);
270
- }, delay);
271
- };
272
- const updateEntry = (entry) => {
273
- const { target, horizontalTrack, horizontalThumb, verticalTrack, verticalThumb } = entry;
274
- const hasHorizontal = canScroll(target, "horizontal");
275
- const hasVertical = canScroll(target, "vertical");
276
- const rect = visibleRect(target);
277
- const thickness = 10;
278
- horizontalTrack.hidden = !hasHorizontal || rect.width <= thickness || rect.height <= 0;
279
- verticalTrack.hidden = !hasVertical || rect.height <= thickness || rect.width <= 0;
280
- if (!horizontalTrack.hidden) {
281
- const trackWidth = Math.max(0, rect.width - (hasVertical ? thickness : 0));
282
- const thumbWidth = Math.max(24, Math.min(trackWidth, trackWidth * target.clientWidth / target.scrollWidth));
283
- const travel = Math.max(0, trackWidth - thumbWidth);
284
- const maxScroll = Math.max(1, target.scrollWidth - target.clientWidth);
285
- horizontalTrack.style.left = `${rect.left}px`;
286
- horizontalTrack.style.top = `${rect.bottom - thickness}px`;
287
- horizontalTrack.style.width = `${trackWidth}px`;
288
- horizontalTrack.style.height = `${thickness}px`;
289
- horizontalThumb.style.width = `${thumbWidth}px`;
290
- horizontalThumb.style.transform = `translate3d(${travel * target.scrollLeft / maxScroll}px, 0, 0)`;
291
- }
292
- if (!verticalTrack.hidden) {
293
- const trackHeight = Math.max(0, rect.height - (hasHorizontal ? thickness : 0));
294
- const thumbHeight = Math.max(24, Math.min(trackHeight, trackHeight * target.clientHeight / target.scrollHeight));
295
- const travel = Math.max(0, trackHeight - thumbHeight);
296
- const maxScroll = Math.max(1, target.scrollHeight - target.clientHeight);
297
- verticalTrack.style.left = `${rect.right - thickness}px`;
298
- verticalTrack.style.top = `${rect.top}px`;
299
- verticalTrack.style.width = `${thickness}px`;
300
- verticalTrack.style.height = `${trackHeight}px`;
301
- verticalThumb.style.height = `${thumbHeight}px`;
302
- verticalThumb.style.transform = `translate3d(0, ${travel * target.scrollTop / maxScroll}px, 0)`;
303
- }
304
- };
305
- const scheduleUpdateAll = () => {
306
- if (updateFrame) return;
307
- updateFrame = window.requestAnimationFrame(() => {
308
- updateFrame = 0;
309
- entries.forEach(updateEntry);
310
- });
311
- };
312
- const bindTrackDrag = (entry, axis, track, thumb) => {
313
- const target = entry.target;
314
- const onTrackPointerEnter = () => {
315
- entry.hoveringTrack = true;
316
- showEntry(entry);
317
- };
318
- const onTrackPointerLeave = () => {
319
- entry.hoveringTrack = false;
320
- scheduleHide(entry);
321
- };
322
- const onTrackPointerDown = (event) => {
323
- if (event.target === thumb || event.button !== 0) return;
324
- event.preventDefault();
325
- event.stopPropagation();
326
- const trackRect = track.getBoundingClientRect();
327
- const thumbRect = thumb.getBoundingClientRect();
328
- const trackLength = axis === "vertical" ? trackRect.height : trackRect.width;
329
- const thumbLength = axis === "vertical" ? thumbRect.height : thumbRect.width;
330
- const pointer = axis === "vertical" ? event.clientY - trackRect.top : event.clientX - trackRect.left;
331
- const ratio = Math.max(0, Math.min(1, (pointer - thumbLength / 2) / Math.max(1, trackLength - thumbLength)));
332
- if (axis === "vertical") target.scrollTop = ratio * (target.scrollHeight - target.clientHeight);
333
- else target.scrollLeft = ratio * (target.scrollWidth - target.clientWidth);
334
- };
335
- const onThumbPointerDown = (event) => {
336
- if (event.button !== 0) return;
337
- event.preventDefault();
338
- event.stopPropagation();
339
- entry.dragging = true;
340
- setFloatingScrollbarDragging(track, true);
341
- showEntry(entry);
342
- thumb.setPointerCapture(event.pointerId);
343
- const startPointer = axis === "vertical" ? event.clientY : event.clientX;
344
- const startScroll = axis === "vertical" ? target.scrollTop : target.scrollLeft;
345
- const trackRect = track.getBoundingClientRect();
346
- const thumbRect = thumb.getBoundingClientRect();
347
- const trackLength = axis === "vertical" ? trackRect.height : trackRect.width;
348
- const thumbLength = axis === "vertical" ? thumbRect.height : thumbRect.width;
349
- const maxScroll = axis === "vertical" ? target.scrollHeight - target.clientHeight : target.scrollWidth - target.clientWidth;
350
- const travel = Math.max(1, trackLength - thumbLength);
351
- const onPointerMove = (moveEvent) => {
352
- if (moveEvent.pointerId !== event.pointerId) return;
353
- const pointer = axis === "vertical" ? moveEvent.clientY : moveEvent.clientX;
354
- const nextScroll = startScroll + (pointer - startPointer) * maxScroll / travel;
355
- if (axis === "vertical") target.scrollTop = nextScroll;
356
- else target.scrollLeft = nextScroll;
357
- };
358
- const onPointerUp = (upEvent) => {
359
- if (upEvent.pointerId !== event.pointerId) return;
360
- entry.dragging = false;
361
- setFloatingScrollbarDragging(track, false);
362
- thumb.releasePointerCapture(event.pointerId);
363
- window.removeEventListener("pointermove", onPointerMove);
364
- window.removeEventListener("pointerup", onPointerUp);
365
- window.removeEventListener("pointercancel", onPointerUp);
366
- scheduleHide(entry);
367
- };
368
- window.addEventListener("pointermove", onPointerMove);
369
- window.addEventListener("pointerup", onPointerUp);
370
- window.addEventListener("pointercancel", onPointerUp);
371
- };
372
- track.addEventListener("pointerenter", onTrackPointerEnter);
373
- track.addEventListener("pointerleave", onTrackPointerLeave);
374
- track.addEventListener("pointerdown", onTrackPointerDown);
375
- thumb.addEventListener("pointerdown", onThumbPointerDown);
376
- return () => {
377
- track.removeEventListener("pointerenter", onTrackPointerEnter);
378
- track.removeEventListener("pointerleave", onTrackPointerLeave);
379
- track.removeEventListener("pointerdown", onTrackPointerDown);
380
- thumb.removeEventListener("pointerdown", onThumbPointerDown);
381
- };
382
- };
383
- const resizeObserver = new ResizeObserver((observedEntries) => {
384
- observedEntries.forEach(({ target }) => {
385
- const entry = entries.get(target);
386
- if (entry) updateEntry(entry);
387
- });
388
- });
389
- const addTarget = (target) => {
390
- if (entries.has(target)) return;
391
- const horizontal = createTrack("horizontal");
392
- const vertical = createTrack("vertical");
393
- const releaseHorizontalOwner = registerFloatingScrollbar(horizontal.track, target);
394
- const releaseVerticalOwner = registerFloatingScrollbar(vertical.track, target);
395
- layer.append(horizontal.track, vertical.track);
396
- const onPointerEnter = () => {
397
- const entry2 = entries.get(target);
398
- if (!entry2) return;
399
- entry2.hoveringTarget = true;
400
- showEntry(entry2);
401
- };
402
- const onPointerLeave = () => {
403
- const entry2 = entries.get(target);
404
- if (!entry2) return;
405
- entry2.hoveringTarget = false;
406
- scheduleHide(entry2);
407
- };
408
- const onScroll = () => {
409
- const entry2 = entries.get(target);
410
- if (!entry2) return;
411
- updateEntry(entry2);
412
- showEntry(entry2);
413
- scheduleHide(entry2, 700);
414
- };
415
- target.addEventListener("pointerenter", onPointerEnter);
416
- target.addEventListener("pointerleave", onPointerLeave);
417
- target.addEventListener("scroll", onScroll, { passive: true });
418
- const entry = {
419
- target,
420
- horizontalTrack: horizontal.track,
421
- horizontalThumb: horizontal.thumb,
422
- verticalTrack: vertical.track,
423
- verticalThumb: vertical.thumb,
424
- hideTimer: null,
425
- hoveringTarget: target.matches(":hover"),
426
- hoveringTrack: false,
427
- dragging: false,
428
- cleanup: () => void 0
429
- };
430
- const cleanupHorizontal = bindTrackDrag(entry, "horizontal", horizontal.track, horizontal.thumb);
431
- const cleanupVertical = bindTrackDrag(entry, "vertical", vertical.track, vertical.thumb);
432
- entry.cleanup = () => {
433
- if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
434
- cleanupHorizontal();
435
- cleanupVertical();
436
- releaseHorizontalOwner();
437
- releaseVerticalOwner();
438
- target.removeEventListener("pointerenter", onPointerEnter);
439
- target.removeEventListener("pointerleave", onPointerLeave);
440
- target.removeEventListener("scroll", onScroll);
441
- resizeObserver.unobserve(target);
442
- target.removeAttribute("data-sia-floating-scrollbar");
443
- horizontal.track.remove();
444
- vertical.track.remove();
445
- };
446
- entries.set(target, entry);
447
- target.setAttribute("data-sia-floating-scrollbar", "");
448
- resizeObserver.observe(target);
449
- updateEntry(entry);
450
- if (entry.hoveringTarget) showEntry(entry);
451
- };
452
- const removeTarget = (target) => {
453
- const entry = entries.get(target);
454
- if (!entry) return;
455
- entry.cleanup();
456
- entries.delete(target);
457
- };
458
- const scanTargets = () => {
459
- scanFrame = 0;
460
- const managedSelector = ".sia-table__viewport, [data-sia-native-scrollbar], .sia-scrollbar-track, .sia-floating-scrollbar-layer";
461
- const discovered = /* @__PURE__ */ new Set();
462
- if (!targetRef) {
463
- const roots = fullScan ? [document.body] : [...dirtyStyles].filter((node) => node.isConnected);
464
- for (const root of roots) {
465
- const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
466
- acceptNode: (node) => node.matches(managedSelector) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
467
- });
468
- for (let node = walker.nextNode(); node; node = walker.nextNode()) {
469
- if (node instanceof HTMLElement) discovered.add(node);
470
- }
471
- for (let node = root; node; node = node.parentElement) discovered.add(node);
472
- }
473
- }
474
- const candidates = (targetRef ? [targetRef.current] : [document.scrollingElement, ...discovered]).filter((target) => target instanceof HTMLElement);
475
- const nextTargets = /* @__PURE__ */ new Set();
476
- candidates.forEach((target) => {
477
- if (canScroll(target, "horizontal") || canScroll(target, "vertical")) {
478
- nextTargets.add(target);
479
- if (entries.has(target) || !target.hasAttribute("data-sia-floating-scrollbar")) addTarget(target);
480
- }
481
- });
482
- entries.forEach((_entry, target) => {
483
- if (!target.isConnected || (fullScan || candidates.includes(target)) && !nextTargets.has(target)) removeTarget(target);
484
- else updateEntry(_entry);
485
- });
486
- dirtyStyles.clear();
487
- fullScan = false;
488
- };
489
- const scheduleScan = (complete = true) => {
490
- fullScan ||= complete;
491
- if (scanFrame) return;
492
- scanFrame = window.requestAnimationFrame(scanTargets);
493
- };
494
- const previousStyle = document.createElement("div").style;
495
- const positionProperties = /* @__PURE__ */ new Set(["left", "top", "transform"]);
496
- const mutationObserver = new MutationObserver((mutations) => {
497
- let relevant = false;
498
- for (const mutation of mutations) {
499
- const target = mutation.target instanceof Element ? mutation.target : mutation.target.parentElement;
500
- if (!target || layer.contains(target) || target.closest(".sia-table__viewport, [data-sia-native-scrollbar], .sia-scrollbar-track")) continue;
501
- relevant = true;
502
- let positionOnly = false;
503
- if (mutation.type === "attributes" && mutation.attributeName === "style" && target instanceof HTMLElement) {
504
- previousStyle.cssText = mutation.oldValue ?? "";
505
- const keys = /* @__PURE__ */ new Set([...Array.from(previousStyle), ...Array.from(target.style)]);
506
- const changed = [...keys].filter((key) => previousStyle.getPropertyValue(key) !== target.style.getPropertyValue(key) || previousStyle.getPropertyPriority(key) !== target.style.getPropertyPriority(key));
507
- if (!changed.length) continue;
508
- const fixedSize = target.style.width.endsWith("px") && target.style.height.endsWith("px");
509
- positionOnly = fixedSize && changed.every((key) => positionProperties.has(key)) && ["absolute", "fixed"].includes(getComputedStyle(target).position);
510
- }
511
- if (positionOnly && target instanceof HTMLElement) dirtyStyles.add(target);
512
- else fullScan = true;
513
- }
514
- if (relevant) scheduleScan(false);
515
- });
516
- mutationObserver.observe(document.documentElement, { subtree: true, childList: true, attributes: true, attributeOldValue: true, attributeFilter: ["class", "style", "hidden"] });
517
- const onResize = () => scheduleScan();
518
- window.addEventListener("resize", onResize);
519
- window.addEventListener("scroll", scheduleUpdateAll, true);
520
- scheduleScan();
521
- return () => {
522
- mutationObserver.disconnect();
523
- resizeObserver.disconnect();
524
- window.removeEventListener("resize", onResize);
525
- window.removeEventListener("scroll", scheduleUpdateAll, true);
526
- if (scanFrame) window.cancelAnimationFrame(scanFrame);
527
- if (updateFrame) window.cancelAnimationFrame(updateFrame);
528
- entries.forEach((entry) => entry.cleanup());
529
- entries.clear();
530
- layer.remove();
531
- };
532
- }, [disabled, targetRef]);
533
- return null;
534
- }
535
-
536
158
  // src/components/treeCheckState.ts
537
159
  function affectedKeys(node) {
538
160
  if (node.disabled || node.disableCheckbox) return [];
@@ -589,7 +211,7 @@ function toggleTreeCheck(nodes, keys, node, strictly = false) {
589
211
  }
590
212
 
591
213
  // src/components/FloatingDisplay.tsx
592
- import { cloneElement, useEffect as useEffect4, useId as useId2, useLayoutEffect, useMemo as useMemo2, useRef as useRef2, useState } from "react";
214
+ import { cloneElement, useEffect as useEffect3, useId as useId2, useLayoutEffect, useMemo as useMemo2, useRef as useRef3, useState } from "react";
593
215
  import { createPortal } from "react-dom";
594
216
  import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
595
217
  var FLOATING_GAP = 9;
@@ -676,23 +298,24 @@ function Floating({
676
298
  role = "tooltip",
677
299
  onOpenChange
678
300
  }) {
679
- const rootRef = useRef2(null);
680
- const triggerElementRef = useRef2(null);
681
- const overlayRef = useRef2(null);
682
- const enterTimer = useRef2();
683
- const leaveTimer = useRef2();
301
+ const rootRef = useRef3(null);
302
+ const triggerElementRef = useRef3(null);
303
+ const overlayRef = useRef3(null);
304
+ const enterTimer = useRef3();
305
+ const leaveTimer = useRef3();
684
306
  const contentId = useId2();
685
307
  const triggers = Array.isArray(trigger) ? trigger : [trigger];
686
308
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
687
309
  const [position, setPosition] = useState();
310
+ const motion = useOverlayMotion(!!visible, overlayRef, "tooltip", "bottom", !!position, void 0, !overlayClassName.includes("sia-form-item__error-popover"));
688
311
  const [portalContainer, setPortalContainer] = useState(null);
689
312
  useLayoutEffect(() => {
690
- if (!visible) return;
313
+ if (!motion.present) return;
691
314
  setPortalContainer(rootRef.current?.closest(".sia-modal-root, .sia-drawer-root") ?? document.body);
692
315
  });
693
- const setVisibleRef = useRef2(setVisible);
316
+ const setVisibleRef = useRef3(setVisible);
694
317
  setVisibleRef.current = setVisible;
695
- const closeSelfRef = useRef2();
318
+ const closeSelfRef = useRef3();
696
319
  if (!closeSelfRef.current) closeSelfRef.current = () => setVisibleRef.current(false);
697
320
  const exclusiveTooltip = role === "tooltip" && triggers.includes("hover");
698
321
  function openNow() {
@@ -720,7 +343,7 @@ function Floating({
720
343
  if (delay <= 0) closeNow();
721
344
  else leaveTimer.current = window.setTimeout(closeNow, delay * 1e3);
722
345
  }
723
- useEffect4(() => {
346
+ useEffect3(() => {
724
347
  if (!visible || !triggers.includes("click")) return;
725
348
  const close = (event) => {
726
349
  const target = event.target;
@@ -730,7 +353,7 @@ function Floating({
730
353
  return () => document.removeEventListener("pointerdown", close);
731
354
  }, [triggers.join("|"), visible]);
732
355
  useLayoutEffect(() => {
733
- if (!visible) {
356
+ if (!motion.present) {
734
357
  setPosition(void 0);
735
358
  return;
736
359
  }
@@ -744,32 +367,42 @@ function Floating({
744
367
  const anchor2 = getAnchor();
745
368
  if (anchor2) {
746
369
  const rect = anchor2.getBoundingClientRect();
747
- const next = resolveFloatingPosition(rect, overlayRef.current.getBoundingClientRect(), placement, typeof arrow === "object" && !!arrow.pointAtCenter, autoAdjustOverflow);
370
+ const next = resolveFloatingPosition(rect, { width: overlayRef.current.offsetWidth, height: overlayRef.current.offsetHeight }, placement, typeof arrow === "object" && !!arrow.pointAtCenter, autoAdjustOverflow);
748
371
  next.hidden = isFloatingAnchorHidden(anchor2, rect) || isAnchorBehindOverlay(anchor2);
749
- setPosition(next);
372
+ setPosition((current) => current && current.top === next.top && current.left === next.left && current.placement === next.placement && current.hidden === next.hidden && current.arrowX === next.arrowX && current.arrowY === next.arrowY ? current : next);
750
373
  }
751
374
  };
752
375
  update();
753
- const unsubscribeLayers = subscribeOverlayLayers(update);
754
- window.addEventListener("resize", update);
755
- window.addEventListener("scroll", update, true);
756
- window.addEventListener("animationend", update, true);
757
- window.addEventListener("transitionend", update, true);
758
- const observer = new ResizeObserver(update);
376
+ let frame = 0;
377
+ const schedule = () => {
378
+ if (!frame) frame = requestAnimationFrame(() => {
379
+ frame = 0;
380
+ update();
381
+ });
382
+ };
383
+ const unsubscribeLayers = subscribeOverlayLayers(schedule);
384
+ window.addEventListener("resize", schedule);
385
+ window.addEventListener("scroll", schedule, true);
386
+ window.addEventListener("animationend", schedule, true);
387
+ window.addEventListener("transitionend", schedule, true);
388
+ window.addEventListener("sia-overlay-motion-end", schedule);
389
+ const observer = new ResizeObserver(schedule);
759
390
  if (rootRef.current) observer.observe(rootRef.current);
760
391
  const anchor = getAnchor();
761
392
  if (anchor) observer.observe(anchor);
762
393
  if (overlayRef.current) observer.observe(overlayRef.current);
763
394
  return () => {
764
- window.removeEventListener("resize", update);
765
- window.removeEventListener("scroll", update, true);
766
- window.removeEventListener("animationend", update, true);
767
- window.removeEventListener("transitionend", update, true);
395
+ window.removeEventListener("resize", schedule);
396
+ window.removeEventListener("scroll", schedule, true);
397
+ window.removeEventListener("animationend", schedule, true);
398
+ window.removeEventListener("transitionend", schedule, true);
399
+ window.removeEventListener("sia-overlay-motion-end", schedule);
400
+ cancelAnimationFrame(frame);
768
401
  observer.disconnect();
769
402
  unsubscribeLayers();
770
403
  };
771
- }, [children, content, placement, visible, portalContainer, autoAdjustOverflow, typeof arrow === "object" && arrow.pointAtCenter]);
772
- useEffect4(() => () => {
404
+ }, [children, content, placement, motion.present, portalContainer, autoAdjustOverflow, typeof arrow === "object" && arrow.pointAtCenter]);
405
+ useEffect3(() => () => {
773
406
  clearTimers();
774
407
  if (activeTooltipClose === closeSelfRef.current) activeTooltipClose = void 0;
775
408
  }, []);
@@ -798,13 +431,15 @@ function Floating({
798
431
  } } : {},
799
432
  "aria-describedby": visible ? contentId : void 0
800
433
  });
801
- const overlay = visible && content !== null && content !== void 0 && typeof document !== "undefined" ? createPortal(
434
+ const overlay = motion.present && content !== null && content !== void 0 && typeof document !== "undefined" ? createPortal(
802
435
  /* @__PURE__ */ jsxs2(
803
436
  "span",
804
437
  {
805
438
  ref: overlayRef,
806
439
  id: contentId,
807
440
  role,
441
+ "data-state": motion.closing ? "closing" : "open",
442
+ "aria-hidden": motion.closing || void 0,
808
443
  "data-custom-color": color ? "" : void 0,
809
444
  className: `sia-floating__overlay sia-floating__overlay--${position?.placement ?? normalizeFloatingPlacement(placement)} ${overlayClassName}`.trim(),
810
445
  style: {
@@ -813,7 +448,9 @@ function Floating({
813
448
  "--sia-floating-arrow-y": position?.arrowY == null ? void 0 : `${position.arrowY}px`,
814
449
  top: position?.top ?? 0,
815
450
  left: position?.left ?? 0,
816
- visibility: position && !position.hidden ? "visible" : "hidden"
451
+ visibility: position && !position.hidden ? "visible" : "hidden",
452
+ animation: "none",
453
+ pointerEvents: motion.closing ? "none" : void 0
817
454
  },
818
455
  onMouseEnter: triggers.includes("hover") ? () => show() : void 0,
819
456
  onMouseLeave: triggers.includes("hover") ? () => hide(mouseLeaveDelay) : void 0,
@@ -901,7 +538,7 @@ function Tree({
901
538
  className = "",
902
539
  ...props
903
540
  }) {
904
- const scrollRef = useRef2(null);
541
+ const scrollRef = useRef3(null);
905
542
  const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
906
543
  const [expanded, setExpanded] = useControllableState({ value: expandedKeys, defaultValue: defaultExpandAll ? collectKeys(treeData, true) : defaultExpandedKeys });
907
544
  const [checked, setChecked] = useControllableState({ value: checkedKeys, defaultValue: defaultCheckedKeys });
@@ -966,9 +603,9 @@ function Tree({
966
603
  visit(treeData, []);
967
604
  return ancestors;
968
605
  }, [selectedKeySet, treeData]);
969
- const dragNodeRef = useRef2();
970
- const pointerDragRef = useRef2();
971
- const suppressClickRef = useRef2(false);
606
+ const dragNodeRef = useRef3();
607
+ const pointerDragRef = useRef3();
608
+ const suppressClickRef = useRef3(false);
972
609
  const [dragOver, setDragOver] = useState();
973
610
  const normalizedSwitcherWidth = Math.max(0, switcherWidth);
974
611
  async function toggleExpand(node) {
@@ -1195,11 +832,19 @@ function Tree({
1195
832
  }
1196
833
 
1197
834
  // src/components/SelectionPanel.tsx
1198
- import { useEffect as useEffect5, useId as useId3, useMemo as useMemo3, useRef as useRef3, useState as useState2 } from "react";
835
+ import { useEffect as useEffect4, useId as useId3, useMemo as useMemo3, useRef as useRef4, useState as useState2 } from "react";
836
+
837
+ // src/components/selectionValues.ts
838
+ function normalizeSelectionValues(values, options) {
839
+ const known = new Set(options.filter((option) => option.optionType !== "divider").map((option) => option.value));
840
+ return values.filter((value) => typeof value === "number" || value.trim().length > 0 || known.has(value));
841
+ }
842
+
843
+ // src/components/SelectionPanel.tsx
1199
844
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1200
845
  function SelectionPanel({
1201
846
  options,
1202
- value,
847
+ value: rawValue,
1203
848
  onChange,
1204
849
  multiple = false,
1205
850
  allowDeselect = false,
@@ -1218,13 +863,14 @@ function SelectionPanel({
1218
863
  autoFocusSearch = false,
1219
864
  groupCheckable = false
1220
865
  }) {
866
+ const value = useMemo3(() => normalizeSelectionValues(rawValue, options), [rawValue, options]);
1221
867
  const [localSearch, setLocalSearch] = useState2("");
1222
868
  const search = searchValue ?? localSearch;
1223
869
  const [scrollTop, setScrollTop] = useState2(0);
1224
870
  const [active, setActive] = useState2();
1225
871
  const [keyboardActive, setKeyboardActive] = useState2(false);
1226
872
  const [deselectedHover, setDeselectedHover] = useState2();
1227
- const listRef = useRef3(null);
873
+ const listRef = useRef4(null);
1228
874
  const id = useId3();
1229
875
  const selected = useMemo3(() => new Set(value), [value]);
1230
876
  const count = Math.max(1, Math.floor(columns));
@@ -1263,7 +909,7 @@ function SelectionPanel({
1263
909
  const virtual = filtered.length > 100;
1264
910
  const renderedRows = virtual ? rows.filter((row) => row.top + row.height >= scrollTop - 100 && row.top <= scrollTop + maxHeight + 100) : rows;
1265
911
  const enabled = filtered.filter((option) => !option.disabled && option.optionType !== "divider");
1266
- useEffect5(() => {
912
+ useEffect4(() => {
1267
913
  setScrollTop(0);
1268
914
  if (listRef.current) listRef.current.scrollTop = 0;
1269
915
  setActive(void 0);
@@ -1430,16 +1076,16 @@ function SelectionPanel({
1430
1076
  }
1431
1077
 
1432
1078
  // src/components/Select.tsx
1433
- import { forwardRef as forwardRef2, useDeferredValue, useEffect as useEffect6, useId as useId4, useLayoutEffect as useLayoutEffect3, useMemo as useMemo4, useRef as useRef5, useState as useState4 } from "react";
1079
+ import { forwardRef as forwardRef2, useDeferredValue, useEffect as useEffect5, useId as useId4, useLayoutEffect as useLayoutEffect3, useMemo as useMemo4, useRef as useRef6, useState as useState4 } from "react";
1434
1080
 
1435
1081
  // src/components/OverflowTags.tsx
1436
- import { useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState3 } from "react";
1082
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState3 } from "react";
1437
1083
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1438
- function OverflowTags({ items, maxCount, className = "", tagClassName, restClassName = "" }) {
1439
- const rootRef = useRef4(null);
1440
- const measureRef = useRef4(null);
1084
+ function OverflowTags({ items, maxCount, expandToFit = false, className = "", tagClassName, restClassName = "" }) {
1085
+ const rootRef = useRef5(null);
1086
+ const measureRef = useRef5(null);
1441
1087
  const limit = Math.min(items.length, Math.max(0, Math.floor(maxCount) || 0));
1442
- const [visibleCount, setVisibleCount] = useState3(0);
1088
+ const [layout, setLayout] = useState3({ count: 0, minimumWidths: [] });
1443
1089
  useLayoutEffect2(() => {
1444
1090
  const root = rootRef.current;
1445
1091
  const measure = measureRef.current;
@@ -1454,17 +1100,29 @@ function OverflowTags({ items, maxCount, className = "", tagClassName, restClass
1454
1100
  const rest = count2 < items.length ? gap + widths[limit + count2] : 0;
1455
1101
  if (used + rest <= root.clientWidth) fitting = count2;
1456
1102
  }
1457
- setVisibleCount((previous) => previous === fitting ? previous : fitting);
1103
+ const minimumWidths = Array.from({ length: fitting }, (_, index) => {
1104
+ const tag = measure.children[index];
1105
+ return expandToFit && tag.scrollWidth > tag.clientWidth ? widths[index] : 0;
1106
+ });
1107
+ setLayout((previous) => previous.count === fitting && minimumWidths.every((width, index) => previous.minimumWidths[index] === width) ? previous : { count: fitting, minimumWidths });
1458
1108
  };
1459
1109
  update();
1460
1110
  const observer = new ResizeObserver(update);
1461
1111
  observer.observe(root);
1462
1112
  for (const child of measure.children) observer.observe(child);
1463
1113
  return () => observer.disconnect();
1464
- }, [items, limit]);
1465
- const count = Math.min(visibleCount, limit);
1114
+ }, [items, limit, expandToFit]);
1115
+ const count = Math.min(layout.count, limit);
1466
1116
  return /* @__PURE__ */ jsxs4("span", { ref: rootRef, className: `sia-overflow-tags ${className}`.trim(), children: [
1467
- items.slice(0, count).map((item) => /* @__PURE__ */ jsx4("span", { className: tagClassName, children: item.label }, item.key)),
1117
+ items.slice(0, count).map((item, index) => /* @__PURE__ */ jsx4(
1118
+ "span",
1119
+ {
1120
+ className: tagClassName,
1121
+ style: expandToFit && layout.minimumWidths[index] ? { flex: "0 1 auto", minWidth: layout.minimumWidths[index], maxWidth: "none" } : void 0,
1122
+ children: item.label
1123
+ },
1124
+ item.key
1125
+ )),
1468
1126
  items.length > count ? /* @__PURE__ */ jsxs4("span", { className: `${tagClassName} sia-overflow-tags__rest ${restClassName}`.trim(), children: [
1469
1127
  "+",
1470
1128
  items.length - count
@@ -1504,12 +1162,12 @@ var Select = forwardRef2(function Select2({
1504
1162
  showValue = false,
1505
1163
  allowInput = false,
1506
1164
  inputMaxLength,
1507
- searchPlaceholder = "\u641C\u7D22\u9009\u9879",
1165
+ searchPlaceholder = allowInput ? "\u8F93\u5165\u6216\u641C\u7D22" : "\u641C\u7D22\u9009\u9879",
1508
1166
  onSearch,
1509
1167
  filterOption = defaultFilterOption,
1510
1168
  showSelectAll = true,
1511
1169
  showActions = mode === "multiple",
1512
- maxTagCount = 2,
1170
+ maxTagCount,
1513
1171
  virtual = true,
1514
1172
  virtualThreshold = 100,
1515
1173
  listHeight = 256,
@@ -1527,23 +1185,23 @@ var Select = forwardRef2(function Select2({
1527
1185
  const fallbackId = useId4();
1528
1186
  const selectId = id ?? fallbackId;
1529
1187
  const listboxId = `${selectId}-listbox`;
1530
- const rootRef = useRef5(null);
1531
- const popupRef = useRef5(null);
1532
- const searchRef = useRef5(null);
1533
- const listRef = useRef5(null);
1188
+ const rootRef = useRef6(null);
1189
+ const popupRef = useRef6(null);
1190
+ const searchRef = useRef6(null);
1191
+ const listRef = useRef6(null);
1534
1192
  const [open, setOpen] = useState4(false);
1535
1193
  const automaticMode = popupModeProp ?? (options.length > modalThreshold ? "modal" : "dropdown");
1536
1194
  const [openedMode, setOpenedMode] = useState4(automaticMode);
1537
1195
  const popupMode = open ? openedMode : automaticMode;
1538
1196
  const [modalValues, setModalValues] = useState4([]);
1539
1197
  const [modalSubmitting, setModalSubmitting] = useState4(false);
1540
- const modalSubmitLock = useRef5(false);
1198
+ const modalSubmitLock = useRef6(false);
1541
1199
  const [selectedOnly, setSelectedOnly] = useState4(false);
1542
1200
  const [query, setQuery] = useState4("");
1543
1201
  const [activeIndex, setActiveIndex] = useState4(-1);
1544
1202
  const [scrollTop, setScrollTop] = useState4(0);
1545
1203
  const [dropdownFontSize, setDropdownFontSize] = useState4();
1546
- const pendingSelectedScroll = useRef5(false);
1204
+ const pendingSelectedScroll = useRef6(false);
1547
1205
  const deferredQuery = useDeferredValue(query.trim());
1548
1206
  const initialValue = defaultValue === void 0 ? mode === "multiple" ? [] : null : defaultValue;
1549
1207
  const [currentValue, setCurrentValue] = useControllableState({
@@ -1586,7 +1244,7 @@ var Select = forwardRef2(function Select2({
1586
1244
  const renderedOptions = virtualEnabled ? filteredOptions.slice(virtualStart, virtualEnd) : filteredOptions;
1587
1245
  const enabledFilteredOptions = filteredOptions.filter((option) => !option.disabled);
1588
1246
  const allFilteredSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => selectedValueSet.has(option.value));
1589
- useEffect6(() => {
1247
+ useEffect5(() => {
1590
1248
  if (!open || popupMode === "modal") return void 0;
1591
1249
  function closeFromOutside(event) {
1592
1250
  const target = event.target;
@@ -1595,13 +1253,15 @@ var Select = forwardRef2(function Select2({
1595
1253
  document.addEventListener("mousedown", closeFromOutside);
1596
1254
  return () => document.removeEventListener("mousedown", closeFromOutside);
1597
1255
  }, [open, popupMode]);
1598
- useEffect6(() => {
1599
- if (open && (showSearch || allowInput)) searchRef.current?.focus();
1600
- }, [allowInput, open, showSearch]);
1601
- useEffect6(() => {
1256
+ useEffect5(() => {
1257
+ if (!open || popupMode !== "dropdown" || !(showSearch || allowInput)) return;
1258
+ const frame = requestAnimationFrame(() => searchRef.current?.focus({ preventScroll: true }));
1259
+ return () => cancelAnimationFrame(frame);
1260
+ }, [allowInput, open, popupMode, showSearch]);
1261
+ useEffect5(() => {
1602
1262
  if (disabled || loading) closeDropdown();
1603
1263
  }, [disabled, loading]);
1604
- useEffect6(() => {
1264
+ useEffect5(() => {
1605
1265
  if (!open || popupMode !== "dropdown" || !pendingSelectedScroll.current || query) return;
1606
1266
  const index = filteredOptions.findIndex((option) => selectedValueSet.has(option.value));
1607
1267
  if (index < 0) return;
@@ -1824,7 +1484,7 @@ var Select = forwardRef2(function Select2({
1824
1484
  onClick: () => open ? closeDropdown() : openDropdown(),
1825
1485
  onKeyDown: handleTriggerKeyDown,
1826
1486
  children: [
1827
- multiple && hasValue ? /* @__PURE__ */ jsx5(OverflowTags, { className: "sia-select__tags", tagClassName: "sia-select__tag", restClassName: "sia-select__tag--rest", maxCount: maxTagCount, items: selectedOptions.map((option) => ({ key: `${typeof option.value}-${option.value}`, label: option.label })) }) : /* @__PURE__ */ jsx5("span", { className: `sia-select__value${hasValue ? "" : " is-placeholder"}`, children: selectedOptions[0]?.label ?? placeholder }),
1487
+ multiple && hasValue ? /* @__PURE__ */ jsx5(OverflowTags, { expandToFit: true, className: "sia-select__tags", tagClassName: "sia-select__tag", restClassName: "sia-select__tag--rest", maxCount: maxTagCount ?? selectedOptions.length, items: selectedOptions.map((option) => ({ key: `${typeof option.value}-${option.value}`, label: option.label })) }) : /* @__PURE__ */ jsx5("span", { className: `sia-select__value${hasValue ? "" : " is-placeholder"}`, children: selectedOptions[0]?.label ?? placeholder }),
1828
1488
  loading ? /* @__PURE__ */ jsx5("span", { className: "sia-select__spinner", "aria-hidden": "true" }) : null,
1829
1489
  floating.label,
1830
1490
  /* @__PURE__ */ jsx5(Icon, { className: "sia-select__arrow", name: "chevron-down", size: 15 })
@@ -1965,13 +1625,13 @@ var Select = forwardRef2(function Select2({
1965
1625
  });
1966
1626
 
1967
1627
  export {
1628
+ usePressFeedback,
1968
1629
  Checkbox2 as Checkbox,
1969
- useScrollbarProximity,
1970
- FloatingScrollbarProvider,
1971
1630
  Tooltip,
1972
1631
  Popover,
1973
1632
  Timeline,
1974
1633
  Tree,
1634
+ normalizeSelectionValues,
1975
1635
  SelectionPanel,
1976
1636
  OverflowTags,
1977
1637
  Select