@pimolu/react 0.1.0-beta.7 → 0.1.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2290,7 +2290,7 @@ import {
2290
2290
  isValidElement as isValidElement2,
2291
2291
  useEffect as useEffect6,
2292
2292
  useId as useId6,
2293
- useRef as useRef6,
2293
+ useRef as useRef7,
2294
2294
  useState as useState7
2295
2295
  } from "react";
2296
2296
 
@@ -2333,13 +2333,15 @@ var selectVariants = createVariants14({
2333
2333
  // internal/portal.tsx
2334
2334
  import {
2335
2335
  useEffect as useEffect4,
2336
+ useLayoutEffect,
2336
2337
  useState as useState5
2337
2338
  } from "react";
2338
2339
  import { createPortal } from "react-dom";
2339
2340
  function Portal({
2340
2341
  children,
2341
2342
  container,
2342
- anchorRef
2343
+ anchorRef,
2344
+ onMount
2343
2345
  }) {
2344
2346
  const [host, setHost] = useState5(
2345
2347
  null
@@ -2352,13 +2354,18 @@ function Portal({
2352
2354
  container ?? (themed instanceof HTMLElement ? themed : document.body)
2353
2355
  );
2354
2356
  }, [container, anchorRef]);
2357
+ useLayoutEffect(() => {
2358
+ if (host) onMount?.();
2359
+ }, [host, onMount]);
2355
2360
  if (!host) return null;
2356
2361
  return createPortal(children, host);
2357
2362
  }
2358
2363
 
2359
2364
  // internal/use-anchored-position.ts
2360
2365
  import {
2361
- useLayoutEffect,
2366
+ useLayoutEffect as useLayoutEffect2,
2367
+ useCallback as useCallback3,
2368
+ useRef as useRef5,
2362
2369
  useState as useState6
2363
2370
  } from "react";
2364
2371
  function opposite(placement) {
@@ -2381,14 +2388,40 @@ function useAnchoredPosition(anchorRef, floatingRef, open, {
2381
2388
  } = {}) {
2382
2389
  const [style, setStyle] = useState6(void 0);
2383
2390
  const [side, setSide] = useState6(placement);
2384
- useLayoutEffect(() => {
2391
+ const measureRef = useRef5(null);
2392
+ const onMount = useCallback3(() => measureRef.current?.(), []);
2393
+ useLayoutEffect2(() => {
2394
+ if (open && style?.visibility === "hidden" && floatingRef.current) {
2395
+ measureRef.current?.();
2396
+ }
2397
+ }, [open, style, floatingRef]);
2398
+ useLayoutEffect2(() => {
2385
2399
  if (!open) {
2386
2400
  setStyle(void 0);
2387
2401
  return;
2388
2402
  }
2389
- const anchor = anchorRef.current;
2390
- if (!anchor) return;
2391
- const measure = () => {
2403
+ let preparedPanel = null;
2404
+ let observedAnchor = null;
2405
+ let observedPanel = null;
2406
+ let frame = 0;
2407
+ let observer = null;
2408
+ function scheduleMeasure() {
2409
+ if (!frame) frame = requestAnimationFrame(() => {
2410
+ frame = 0;
2411
+ measure();
2412
+ });
2413
+ }
2414
+ function measure() {
2415
+ const anchor = anchorRef.current;
2416
+ if (!anchor) {
2417
+ preparedPanel = null;
2418
+ if (observedAnchor || observedPanel) observer?.disconnect();
2419
+ observedAnchor = observedPanel = null;
2420
+ setStyle((previous) => previous?.visibility === "visible" ? { ...previous, visibility: "hidden" } : previous);
2421
+ scheduleMeasure();
2422
+ return;
2423
+ }
2424
+ if (anchor !== observedAnchor) preparedPanel = null;
2392
2425
  const rect = anchor.getBoundingClientRect();
2393
2426
  const viewportHeight = window.innerHeight || padding * 2;
2394
2427
  const viewportWidth = window.innerWidth || padding * 2;
@@ -2417,7 +2450,8 @@ function useAnchoredPosition(anchorRef, floatingRef, open, {
2417
2450
  const room = Math.max(roomOn(resolved), 0);
2418
2451
  const next = {
2419
2452
  position: "fixed",
2420
- zIndex: 50
2453
+ zIndex: 50,
2454
+ visibility: panel && panel === preparedPanel ? "visible" : "hidden"
2421
2455
  };
2422
2456
  if (vertical) {
2423
2457
  next.maxHeight = Math.round(
@@ -2472,6 +2506,7 @@ function useAnchoredPosition(anchorRef, floatingRef, open, {
2472
2506
  );
2473
2507
  }
2474
2508
  } else {
2509
+ next.maxHeight = Math.round(Math.max(0, Math.min(maxHeight, viewportHeight - padding * 2)));
2475
2510
  next.maxWidth = Math.round(
2476
2511
  Math.max(
2477
2512
  80,
@@ -2500,17 +2535,32 @@ function useAnchoredPosition(anchorRef, floatingRef, open, {
2500
2535
  )
2501
2536
  );
2502
2537
  }
2503
- setStyle(next);
2504
- };
2505
- measure();
2506
- const frame = typeof requestAnimationFrame === "function" ? requestAnimationFrame(measure) : 0;
2507
- const observer = typeof ResizeObserver === "function" && floatingRef.current ? new ResizeObserver(measure) : null;
2508
- if (observer && floatingRef.current) {
2509
- observer.observe(floatingRef.current);
2538
+ setStyle((previous) => {
2539
+ const keys = Object.keys(next);
2540
+ return previous && keys.length === Object.keys(previous).length && keys.every((key) => previous[key] === next[key]) ? previous : next;
2541
+ });
2542
+ if (anchor !== observedAnchor || panel !== observedPanel) {
2543
+ observer?.disconnect();
2544
+ observer?.observe(anchor);
2545
+ if (panel) observer?.observe(panel);
2546
+ observedAnchor = anchor;
2547
+ observedPanel = panel;
2548
+ }
2549
+ preparedPanel = panel;
2550
+ if (!panel || next.visibility === "hidden") {
2551
+ scheduleMeasure();
2552
+ } else if (frame) {
2553
+ cancelAnimationFrame(frame);
2554
+ frame = 0;
2555
+ }
2510
2556
  }
2557
+ observer = typeof ResizeObserver === "function" ? new ResizeObserver(measure) : null;
2558
+ measureRef.current = measure;
2559
+ measure();
2511
2560
  window.addEventListener("resize", measure);
2512
2561
  window.addEventListener("scroll", measure, true);
2513
2562
  return () => {
2563
+ measureRef.current = null;
2514
2564
  if (frame) cancelAnimationFrame(frame);
2515
2565
  observer?.disconnect();
2516
2566
  window.removeEventListener("resize", measure);
@@ -2528,14 +2578,18 @@ function useAnchoredPosition(anchorRef, floatingRef, open, {
2528
2578
  matchWidth,
2529
2579
  align
2530
2580
  ]);
2531
- return { style, side };
2581
+ return {
2582
+ style: open ? style ?? { position: "fixed", visibility: "hidden" } : void 0,
2583
+ side,
2584
+ onMount
2585
+ };
2532
2586
  }
2533
2587
 
2534
2588
  // internal/use-outside-pointer.ts
2535
- import { useEffect as useEffect5, useRef as useRef5 } from "react";
2589
+ import { useEffect as useEffect5, useRef as useRef6 } from "react";
2536
2590
  function useOutsidePointer(target, active, onOutside) {
2537
- const handler = useRef5(onOutside);
2538
- const targets = useRef5(
2591
+ const handler = useRef6(onOutside);
2592
+ const targets = useRef6(
2539
2593
  Array.isArray(target) ? target : [target]
2540
2594
  );
2541
2595
  useEffect5(() => {
@@ -2666,11 +2720,11 @@ var Select = forwardRef14(
2666
2720
  );
2667
2721
  const [open, setOpen] = useState7(false);
2668
2722
  const [activeIndex, setActiveIndex] = useState7(-1);
2669
- const rootRef = useRef6(null);
2670
- const triggerRef = useRef6(null);
2671
- const listboxRef = useRef6(null);
2672
- const nativeRef = useRef6(null);
2673
- const { style: position } = useAnchoredPosition(
2723
+ const rootRef = useRef7(null);
2724
+ const triggerRef = useRef7(null);
2725
+ const listboxRef = useRef7(null);
2726
+ const nativeRef = useRef7(null);
2727
+ const { style: position, onMount } = useAnchoredPosition(
2674
2728
  triggerRef,
2675
2729
  listboxRef,
2676
2730
  open && !native
@@ -2955,7 +3009,7 @@ var Select = forwardRef14(
2955
3009
  }
2956
3010
  )
2957
3011
  ] }),
2958
- open && /* @__PURE__ */ jsx16(Portal, { anchorRef: rootRef, children: /* @__PURE__ */ jsx16(
3012
+ open && /* @__PURE__ */ jsx16(Portal, { anchorRef: rootRef, onMount, children: /* @__PURE__ */ jsx16(
2959
3013
  "div",
2960
3014
  {
2961
3015
  ref: listboxRef,
@@ -3024,11 +3078,11 @@ Select.displayName = "PimoluSelect";
3024
3078
  // combobox/combobox.tsx
3025
3079
  import {
3026
3080
  forwardRef as forwardRef15,
3027
- useCallback as useCallback3,
3081
+ useCallback as useCallback4,
3028
3082
  useEffect as useEffect9,
3029
3083
  useId as useId7,
3030
3084
  useMemo as useMemo2,
3031
- useRef as useRef8,
3085
+ useRef as useRef9,
3032
3086
  useState as useState8
3033
3087
  } from "react";
3034
3088
 
@@ -3095,7 +3149,7 @@ function useCustomValidity(ref, message) {
3095
3149
  // internal/use-dismissable-layer.ts
3096
3150
  import {
3097
3151
  useEffect as useEffect8,
3098
- useRef as useRef7
3152
+ useRef as useRef8
3099
3153
  } from "react";
3100
3154
  function useDismissableLayer({
3101
3155
  open,
@@ -3104,7 +3158,7 @@ function useDismissableLayer({
3104
3158
  closeOnOutside = true,
3105
3159
  closeOnEscape = true
3106
3160
  }) {
3107
- const handler = useRef7(onDismiss);
3161
+ const handler = useRef8(onDismiss);
3108
3162
  useEffect8(() => {
3109
3163
  handler.current = onDismiss;
3110
3164
  }, [onDismiss]);
@@ -3166,10 +3220,10 @@ var Combobox = forwardRef15(function Combobox2({
3166
3220
  const inputId = id ?? `pimolu-combobox-${generatedId}`;
3167
3221
  const listboxId = `${inputId}-listbox`;
3168
3222
  const messageId = helperText || errorMessage ? `${inputId}-message` : void 0;
3169
- const rootRef = useRef8(null);
3170
- const inputRef = useRef8(null);
3171
- const listboxRef = useRef8(null);
3172
- const assignInputRef = useCallback3(
3223
+ const rootRef = useRef9(null);
3224
+ const inputRef = useRef9(null);
3225
+ const listboxRef = useRef9(null);
3226
+ const assignInputRef = useCallback4(
3173
3227
  (node) => {
3174
3228
  inputRef.current = node;
3175
3229
  if (typeof forwardedRef === "function") {
@@ -3298,7 +3352,7 @@ var Combobox = forwardRef15(function Combobox2({
3298
3352
  closeMenu();
3299
3353
  }
3300
3354
  }
3301
- const { style: popupStyle } = useAnchoredPosition(
3355
+ const { style: popupStyle, onMount } = useAnchoredPosition(
3302
3356
  rootRef,
3303
3357
  listboxRef,
3304
3358
  isOpen && !disabled
@@ -3456,7 +3510,7 @@ var Combobox = forwardRef15(function Combobox2({
3456
3510
  )
3457
3511
  }
3458
3512
  ),
3459
- isOpen && !disabled && /* @__PURE__ */ jsx17(Portal, { anchorRef: rootRef, children: /* @__PURE__ */ jsx17(
3513
+ isOpen && !disabled && /* @__PURE__ */ jsx17(Portal, { anchorRef: rootRef, onMount, children: /* @__PURE__ */ jsx17(
3460
3514
  "ul",
3461
3515
  {
3462
3516
  ref: listboxRef,
@@ -3531,11 +3585,11 @@ Combobox.displayName = "PimoluCombobox";
3531
3585
  // multi-select/multi-select.tsx
3532
3586
  import {
3533
3587
  forwardRef as forwardRef16,
3534
- useCallback as useCallback4,
3588
+ useCallback as useCallback5,
3535
3589
  useEffect as useEffect10,
3536
3590
  useId as useId8,
3537
3591
  useMemo as useMemo3,
3538
- useRef as useRef9,
3592
+ useRef as useRef10,
3539
3593
  useState as useState9
3540
3594
  } from "react";
3541
3595
 
@@ -3616,10 +3670,10 @@ var MultiSelect = forwardRef16(function MultiSelect2({
3616
3670
  const instructionsId = `${inputId}-instructions`;
3617
3671
  const message = errorMessage || helperText;
3618
3672
  const messageId = message ? `${inputId}-message` : void 0;
3619
- const rootRef = useRef9(null);
3620
- const inputRef = useRef9(null);
3621
- const listboxRef = useRef9(null);
3622
- const assignRef = useCallback4(
3673
+ const rootRef = useRef10(null);
3674
+ const inputRef = useRef10(null);
3675
+ const listboxRef = useRef10(null);
3676
+ const assignRef = useCallback5(
3623
3677
  (node) => {
3624
3678
  inputRef.current = node;
3625
3679
  if (typeof forwardedRef === "function") {
@@ -3767,7 +3821,7 @@ var MultiSelect = forwardRef16(function MultiSelect2({
3767
3821
  closeMenu();
3768
3822
  }
3769
3823
  }
3770
- const { style: popupStyle } = useAnchoredPosition(
3824
+ const { style: popupStyle, onMount } = useAnchoredPosition(
3771
3825
  rootRef,
3772
3826
  listboxRef,
3773
3827
  isOpen && !disabled
@@ -3971,7 +4025,7 @@ var MultiSelect = forwardRef16(function MultiSelect2({
3971
4025
  },
3972
4026
  selectedValue
3973
4027
  )),
3974
- isOpen && !disabled && /* @__PURE__ */ jsx18(Portal, { anchorRef: rootRef, children: /* @__PURE__ */ jsx18(
4028
+ isOpen && !disabled && /* @__PURE__ */ jsx18(Portal, { anchorRef: rootRef, onMount, children: /* @__PURE__ */ jsx18(
3975
4029
  "ul",
3976
4030
  {
3977
4031
  ref: listboxRef,
@@ -4059,9 +4113,9 @@ MultiSelect.displayName = "PimoluMultiSelect";
4059
4113
  // slider/slider.tsx
4060
4114
  import {
4061
4115
  forwardRef as forwardRef17,
4062
- useCallback as useCallback5,
4116
+ useCallback as useCallback6,
4063
4117
  useId as useId9,
4064
- useRef as useRef10,
4118
+ useRef as useRef11,
4065
4119
  useState as useState10
4066
4120
  } from "react";
4067
4121
 
@@ -4126,13 +4180,13 @@ var Slider = forwardRef17(function Slider2({
4126
4180
  const [partClasses, scopeParts] = usePartClasses("slider", classNames, true);
4127
4181
  const generatedId = useId9();
4128
4182
  const sliderId = id ?? `pimolu-slider-${generatedId}`;
4129
- const inputRef = useRef10(null);
4183
+ const inputRef = useRef11(null);
4130
4184
  const controlled = value !== void 0;
4131
4185
  const [internalValue, setInternalValue] = useState10(
4132
4186
  () => Number(defaultValue ?? min)
4133
4187
  );
4134
4188
  const currentValue = controlled ? Number(value) : internalValue;
4135
- const assignRef = useCallback5(
4189
+ const assignRef = useCallback6(
4136
4190
  (node) => {
4137
4191
  inputRef.current = node;
4138
4192
  if (typeof forwardedRef === "function") {
@@ -4262,7 +4316,7 @@ Slider.displayName = "PimoluSlider";
4262
4316
  import {
4263
4317
  forwardRef as forwardRef18,
4264
4318
  useId as useId10,
4265
- useRef as useRef11,
4319
+ useRef as useRef12,
4266
4320
  useState as useState11
4267
4321
  } from "react";
4268
4322
 
@@ -4340,8 +4394,8 @@ var RangeSlider = forwardRef18(function RangeSlider2({
4340
4394
  const labelId = `${baseId}-label`;
4341
4395
  const minId = `${baseId}-min`;
4342
4396
  const maxId = `${baseId}-max`;
4343
- const lowerRef = useRef11(null);
4344
- const upperRef = useRef11(null);
4397
+ const lowerRef = useRef12(null);
4398
+ const upperRef = useRef12(null);
4345
4399
  const controlled = value !== void 0;
4346
4400
  const safeStep = step > 0 ? step : 1;
4347
4401
  const [initialValue] = useState11(
@@ -4795,7 +4849,7 @@ import {
4795
4849
  isValidElement as isValidElement3,
4796
4850
  useEffect as useEffect11,
4797
4851
  useId as useId12,
4798
- useRef as useRef12,
4852
+ useRef as useRef13,
4799
4853
  useState as useState12
4800
4854
  } from "react";
4801
4855
  import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -4816,13 +4870,13 @@ function Tooltip({
4816
4870
  const [partClasses, scopeParts] = usePartClasses("tooltip", classNames, true);
4817
4871
  const generatedId = useId12();
4818
4872
  const tooltipId = `pimolu-tooltip-${generatedId}`;
4819
- const triggerRef = useRef12(null);
4820
- const panelRef = useRef12(null);
4821
- const openTimer = useRef12(null);
4822
- const closeTimer = useRef12(null);
4873
+ const triggerRef = useRef13(null);
4874
+ const panelRef = useRef13(null);
4875
+ const openTimer = useRef13(null);
4876
+ const closeTimer = useRef13(null);
4823
4877
  const [phase, setPhase] = useState12("closed");
4824
4878
  const visible = phase !== "closed";
4825
- const { style: panelStyle, side } = useAnchoredPosition(
4879
+ const { style: panelStyle, side, onMount } = useAnchoredPosition(
4826
4880
  triggerRef,
4827
4881
  panelRef,
4828
4882
  visible,
@@ -4915,7 +4969,7 @@ function Tooltip({
4915
4969
  };
4916
4970
  return scopeParts(/* @__PURE__ */ jsxs18(Fragment4, { children: [
4917
4971
  cloneElement2(trigger, triggerProps),
4918
- visible && /* @__PURE__ */ jsx23(Portal, { anchorRef: triggerRef, children: /* @__PURE__ */ jsxs18(
4972
+ visible && /* @__PURE__ */ jsx23(Portal, { anchorRef: triggerRef, onMount, children: /* @__PURE__ */ jsxs18(
4919
4973
  "div",
4920
4974
  {
4921
4975
  ref: panelRef,
@@ -4946,7 +5000,7 @@ import {
4946
5000
  isValidElement as isValidElement4,
4947
5001
  useEffect as useEffect12,
4948
5002
  useId as useId13,
4949
- useRef as useRef13,
5003
+ useRef as useRef14,
4950
5004
  useState as useState13
4951
5005
  } from "react";
4952
5006
 
@@ -4983,12 +5037,36 @@ var FOCUSABLE_SELECTOR = [
4983
5037
  "[contenteditable='true']",
4984
5038
  "[tabindex]:not([tabindex='-1'])"
4985
5039
  ].join(",");
4986
- function getFocusable(container) {
5040
+ function getFocusable(container, { includeNegativeTabIndex = false } = {}) {
5041
+ const styles = /* @__PURE__ */ new Map();
5042
+ function computedStyle(element, view) {
5043
+ let style = styles.get(element);
5044
+ if (!style) {
5045
+ style = view.getComputedStyle(element);
5046
+ styles.set(element, style);
5047
+ }
5048
+ return style;
5049
+ }
4987
5050
  return Array.from(
4988
5051
  container.querySelectorAll(
4989
5052
  FOCUSABLE_SELECTOR
4990
5053
  )
4991
- );
5054
+ ).filter((element) => {
5055
+ if (!includeNegativeTabIndex && element.hasAttribute("tabindex") && element.tabIndex < 0 || element.matches(":disabled") || element.closest("[inert]")) return false;
5056
+ const view = element.ownerDocument.defaultView;
5057
+ if (!view) return false;
5058
+ const style = computedStyle(element, view);
5059
+ if (style.visibility === "hidden" || style.visibility === "collapse") return false;
5060
+ for (let ancestor = element; ancestor; ancestor = ancestor.parentElement) {
5061
+ const ancestorStyle = computedStyle(ancestor, view);
5062
+ if (ancestor.hidden || ancestorStyle.display === "none" || ancestorStyle.contentVisibility === "hidden") return false;
5063
+ if (ancestor.tagName === "DETAILS" && !ancestor.hasAttribute("open")) {
5064
+ const summary = Array.from(ancestor.children).find((child) => child.tagName === "SUMMARY");
5065
+ if (!summary?.contains(element)) return false;
5066
+ }
5067
+ }
5068
+ return true;
5069
+ });
4992
5070
  }
4993
5071
 
4994
5072
  // popover/popover.tsx
@@ -5014,10 +5092,10 @@ function PopoverSurface({
5014
5092
  const [partClasses, scopeParts] = usePartClasses("popover", classNames, false);
5015
5093
  useEffect12(() => {
5016
5094
  const panel = surfaceRef.current;
5017
- if (!panel) return;
5095
+ if (!panel || state !== "open" || style?.visibility !== "visible") return;
5018
5096
  const first = getFocusable(panel)[0];
5019
- (first ?? panel).focus();
5020
- }, [surfaceRef]);
5097
+ (first ?? panel).focus({ preventScroll: true });
5098
+ }, [surfaceRef, state, style?.visibility]);
5021
5099
  return scopeParts(/* @__PURE__ */ jsx24(
5022
5100
  "div",
5023
5101
  {
@@ -5056,16 +5134,16 @@ function Popover({
5056
5134
  const [partClasses, scopeParts] = usePartClasses("popover", classNames, true);
5057
5135
  const generatedId = useId13();
5058
5136
  const panelId = `pimolu-popover-${generatedId}`;
5059
- const triggerRef = useRef13(null);
5060
- const panelRef = useRef13(null);
5137
+ const triggerRef = useRef14(null);
5138
+ const panelRef = useRef14(null);
5061
5139
  const isControlled = controlledOpen !== void 0;
5062
5140
  const [uncontrolledOpen, setUncontrolledOpen] = useState13(defaultOpen);
5063
5141
  const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
5064
5142
  const [rendered, setRendered] = useState13(isOpen);
5065
5143
  const [state, setState] = useState13("open");
5066
- const requestedOpen = useRef13(isOpen);
5067
- const closeTimer = useRef13(null);
5068
- const { style: panelStyle, side } = useAnchoredPosition(
5144
+ const requestedOpen = useRef14(isOpen);
5145
+ const closeTimer = useRef14(null);
5146
+ const { style: panelStyle, side, onMount } = useAnchoredPosition(
5069
5147
  triggerRef,
5070
5148
  panelRef,
5071
5149
  rendered,
@@ -5177,7 +5255,7 @@ function Popover({
5177
5255
  };
5178
5256
  return scopeParts(/* @__PURE__ */ jsxs19(Fragment5, { children: [
5179
5257
  cloneElement3(trigger, triggerProps),
5180
- rendered && /* @__PURE__ */ jsx24(Portal, { anchorRef: triggerRef, children: /* @__PURE__ */ jsx24(
5258
+ rendered && /* @__PURE__ */ jsx24(Portal, { anchorRef: triggerRef, onMount, children: /* @__PURE__ */ jsx24(
5181
5259
  PopoverSurface,
5182
5260
  {
5183
5261
  surfaceRef: panelRef,
@@ -5205,12 +5283,12 @@ import {
5205
5283
  cloneElement as cloneElement4,
5206
5284
  createContext as createContext4,
5207
5285
  isValidElement as isValidElement5,
5208
- useCallback as useCallback6,
5286
+ useCallback as useCallback7,
5209
5287
  useContext as useContext4,
5210
5288
  useEffect as useEffect14,
5211
5289
  useId as useId14,
5212
5290
  useMemo as useMemo4,
5213
- useRef as useRef14,
5291
+ useRef as useRef15,
5214
5292
  useState as useState14
5215
5293
  } from "react";
5216
5294
 
@@ -5313,13 +5391,13 @@ function Dialog({
5313
5391
  const [uncontrolledOpen, setUncontrolledOpen] = useState14(defaultOpen);
5314
5392
  const open = isControlled ? controlledOpen : uncontrolledOpen;
5315
5393
  const contentId = `pimolu-dialog-${useId14()}`;
5316
- const scopeRef = useRef14(
5394
+ const scopeRef = useRef15(
5317
5395
  null
5318
5396
  );
5319
- const triggerRef = useRef14(null);
5397
+ const triggerRef = useRef15(null);
5320
5398
  const [titleId, setTitleId] = useState14(null);
5321
5399
  const [descriptionId, setDescriptionId] = useState14(null);
5322
- const setOpen = useCallback6(
5400
+ const setOpen = useCallback7(
5323
5401
  (next) => {
5324
5402
  if (!isControlled) {
5325
5403
  setUncontrolledOpen(next);
@@ -5515,12 +5593,12 @@ function DialogContent({
5515
5593
  scopeRef,
5516
5594
  triggerRef
5517
5595
  } = useDialog("DialogContent");
5518
- const contentRef = useRef14(
5596
+ const contentRef = useRef15(
5519
5597
  null
5520
5598
  );
5521
5599
  const [rendered, setRendered] = useState14(open);
5522
5600
  const [state, setState] = useState14("open");
5523
- const closeTimer = useRef14(null);
5601
+ const closeTimer = useRef15(null);
5524
5602
  function cancelCloseTimer() {
5525
5603
  if (closeTimer.current !== null) {
5526
5604
  clearTimeout(closeTimer.current);
@@ -5702,12 +5780,12 @@ function DialogClose({
5702
5780
  }
5703
5781
 
5704
5782
  // internal/use-sliding-indicator.ts
5705
- import { useCallback as useCallback7, useEffect as useEffect15, useLayoutEffect as useLayoutEffect2, useState as useState15 } from "react";
5706
- var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect15 : useLayoutEffect2;
5783
+ import { useCallback as useCallback8, useEffect as useEffect15, useLayoutEffect as useLayoutEffect3, useState as useState15 } from "react";
5784
+ var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect15 : useLayoutEffect3;
5707
5785
  function useSlidingIndicator(ref, selector, layoutKey) {
5708
5786
  const [indicator, setIndicator] = useState15(null);
5709
5787
  const [ready, setReady] = useState15(false);
5710
- const measure = useCallback7(() => {
5788
+ const measure = useCallback8(() => {
5711
5789
  const selected = ref.current?.querySelector(selector);
5712
5790
  if (!selected || !selected.offsetWidth || !selected.offsetHeight) {
5713
5791
  setIndicator(null);
@@ -5752,12 +5830,12 @@ function useSlidingIndicator(ref, selector, layoutKey) {
5752
5830
  import {
5753
5831
  Children as Children3,
5754
5832
  createContext as createContext5,
5755
- useCallback as useCallback8,
5833
+ useCallback as useCallback9,
5756
5834
  useContext as useContext5,
5757
5835
  useEffect as useEffect16,
5758
5836
  useId as useId15,
5759
5837
  useMemo as useMemo5,
5760
- useRef as useRef15,
5838
+ useRef as useRef16,
5761
5839
  useState as useState16
5762
5840
  } from "react";
5763
5841
 
@@ -5856,7 +5934,7 @@ function Tabs({
5856
5934
  const [uncontrolledValue, setUncontrolledValue] = useState16(defaultValue);
5857
5935
  const value = isControlled ? controlledValue : uncontrolledValue;
5858
5936
  const baseId = `pimolu-tabs-${useId15()}`;
5859
- const setValue = useCallback8(
5937
+ const setValue = useCallback9(
5860
5938
  (next) => {
5861
5939
  if (next === value) return;
5862
5940
  if (!isControlled) {
@@ -5921,7 +5999,7 @@ function TabsList({
5921
5999
  variant,
5922
6000
  size
5923
6001
  } = useTabs("TabsList");
5924
- const listRef = useRef15(null);
6002
+ const listRef = useRef16(null);
5925
6003
  const indicatorLayout = useMemo5(() => ({ value, orientation, variant, size, children }), [value, orientation, variant, size, children]);
5926
6004
  const { indicator, ready: indicatorReady, visible: indicatorVisible } = useSlidingIndicator(
5927
6005
  listRef,
@@ -5934,7 +6012,7 @@ function TabsList({
5934
6012
  start: false,
5935
6013
  end: false
5936
6014
  });
5937
- const updateOverflow = useCallback8(() => {
6015
+ const updateOverflow = useCallback9(() => {
5938
6016
  const list = listRef.current;
5939
6017
  if (!list || !isScrollable) {
5940
6018
  setOverflow(
@@ -6371,7 +6449,7 @@ import {
6371
6449
  forwardRef as forwardRef22,
6372
6450
  useEffect as useEffect17,
6373
6451
  useMemo as useMemo6,
6374
- useRef as useRef16,
6452
+ useRef as useRef17,
6375
6453
  useState as useState19
6376
6454
  } from "react";
6377
6455
 
@@ -6417,7 +6495,7 @@ var SegmentedControl = forwardRef22(function SegmentedControl2({
6417
6495
  const [uncontrolledValue, setUncontrolledValue] = useState19(defaultValue ?? firstEnabled2);
6418
6496
  const isControlled = controlledValue !== void 0;
6419
6497
  const value = isControlled ? controlledValue : uncontrolledValue;
6420
- const groupRef = useRef16(null);
6498
+ const groupRef = useRef17(null);
6421
6499
  const indicatorLayout = useMemo6(() => ({ value, orientation, size, options, disabled }), [value, orientation, size, options, disabled]);
6422
6500
  const { indicator, ready, visible } = useSlidingIndicator(
6423
6501
  groupRef,
@@ -7141,7 +7219,7 @@ function Fieldset({
7141
7219
  }
7142
7220
 
7143
7221
  // internal/use-presence.ts
7144
- import { useEffect as useEffect18, useRef as useRef17, useState as useState20 } from "react";
7222
+ import { useEffect as useEffect18, useRef as useRef18, useState as useState20 } from "react";
7145
7223
  function prefersReducedMotion5() {
7146
7224
  return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
7147
7225
  }
@@ -7150,7 +7228,7 @@ function usePresence(open, exitDuration = 150) {
7150
7228
  const [state, setState] = useState20(
7151
7229
  "open"
7152
7230
  );
7153
- const timer = useRef17(
7231
+ const timer = useRef18(
7154
7232
  null
7155
7233
  );
7156
7234
  function cancel() {
@@ -7187,7 +7265,7 @@ import {
7187
7265
  createContext as createContext8,
7188
7266
  useContext as useContext8,
7189
7267
  useId as useId17,
7190
- useRef as useRef18,
7268
+ useRef as useRef19,
7191
7269
  useState as useState21
7192
7270
  } from "react";
7193
7271
 
@@ -7273,7 +7351,7 @@ function Accordion(props) {
7273
7351
  );
7274
7352
  const value = controlledValue !== void 0 ? controlledValue : multiple ? multipleValue : singleValue;
7275
7353
  const baseId = `pimolu-accordion-${useId17()}`;
7276
- const rootRef = useRef18(null);
7354
+ const rootRef = useRef19(null);
7277
7355
  function isOpen(item) {
7278
7356
  return multiple ? value.includes(item) : value === item;
7279
7357
  }
@@ -7815,11 +7893,11 @@ var navbarVariants = createVariants32({ base: "pimolu-navbar", variants: navbarV
7815
7893
  // navbar/navbar.tsx
7816
7894
  import {
7817
7895
  createContext as createContext11,
7818
- useCallback as useCallback10,
7896
+ useCallback as useCallback11,
7819
7897
  useContext as useContext11,
7820
7898
  useEffect as useEffect21,
7821
7899
  useId as useId19,
7822
- useRef as useRef20,
7900
+ useRef as useRef21,
7823
7901
  useState as useState25
7824
7902
  } from "react";
7825
7903
 
@@ -7828,12 +7906,12 @@ import {
7828
7906
  cloneElement as cloneElement6,
7829
7907
  createContext as createContext10,
7830
7908
  isValidElement as isValidElement7,
7831
- useCallback as useCallback9,
7909
+ useCallback as useCallback10,
7832
7910
  useContext as useContext10,
7833
7911
  useEffect as useEffect20,
7834
7912
  useId as useId18,
7835
7913
  useMemo as useMemo7,
7836
- useRef as useRef19,
7914
+ useRef as useRef20,
7837
7915
  useState as useState24
7838
7916
  } from "react";
7839
7917
 
@@ -7962,13 +8040,13 @@ function Drawer({
7962
8040
  const [uncontrolledOpen, setUncontrolledOpen] = useState24(defaultOpen);
7963
8041
  const open = isControlled ? controlledOpen : uncontrolledOpen;
7964
8042
  const contentId = `pimolu-drawer-${useId18()}`;
7965
- const scopeRef = useRef19(
8043
+ const scopeRef = useRef20(
7966
8044
  null
7967
8045
  );
7968
- const triggerRef = useRef19(null);
8046
+ const triggerRef = useRef20(null);
7969
8047
  const [titleId, setTitleId] = useState24(null);
7970
8048
  const [descriptionId, setDescriptionId] = useState24(null);
7971
- const setOpen = useCallback9(
8049
+ const setOpen = useCallback10(
7972
8050
  (next) => {
7973
8051
  if (!isControlled) {
7974
8052
  setUncontrolledOpen(next);
@@ -8127,7 +8205,7 @@ function DrawerContent({
8127
8205
  scopeRef,
8128
8206
  triggerRef
8129
8207
  } = useDrawer("DrawerContent");
8130
- const contentRef = useRef19(
8208
+ const contentRef = useRef20(
8131
8209
  null
8132
8210
  );
8133
8211
  const { rendered, state } = usePresence(
@@ -8333,8 +8411,8 @@ function Navbar({
8333
8411
  const open = controlledOpen ?? internalOpen;
8334
8412
  const defaultContentId = `pimolu-navbar-${useId19()}-content`;
8335
8413
  const [contentId, setContentId] = useState25(defaultContentId);
8336
- const rootRef = useRef20(null);
8337
- const toggleRef = useRef20(null);
8414
+ const rootRef = useRef21(null);
8415
+ const toggleRef = useRef21(null);
8338
8416
  const [hasMenu, setHasMenu] = useState25(false);
8339
8417
  const [narrow, setNarrow] = useState25(false);
8340
8418
  const overlay = collapsible && hasMenu && narrow;
@@ -8355,7 +8433,7 @@ function Navbar({
8355
8433
  observer.observe(node);
8356
8434
  return () => observer.disconnect();
8357
8435
  }, [hasMenu]);
8358
- const setOpen = useCallback10(
8436
+ const setOpen = useCallback11(
8359
8437
  (next) => {
8360
8438
  if (next === open) return;
8361
8439
  if (controlledOpen === void 0) setInternalOpen(next);
@@ -8364,7 +8442,7 @@ function Navbar({
8364
8442
  [controlledOpen, onOpenChange, open]
8365
8443
  );
8366
8444
  useOutsidePointer(rootRef, collapsible && open && !overlay, () => setOpen(false));
8367
- const wasOverlay = useRef20(overlay);
8445
+ const wasOverlay = useRef21(overlay);
8368
8446
  useEffect21(() => {
8369
8447
  if (wasOverlay.current && !overlay && open) {
8370
8448
  setOpen(false);
@@ -8611,7 +8689,7 @@ import {
8611
8689
  createContext as createContext12,
8612
8690
  useContext as useContext12,
8613
8691
  useEffect as useEffect22,
8614
- useRef as useRef21,
8692
+ useRef as useRef22,
8615
8693
  useState as useState26,
8616
8694
  useSyncExternalStore as useSyncExternalStore2
8617
8695
  } from "react";
@@ -8649,8 +8727,8 @@ function Sidebar({
8649
8727
  const mobile = useSyncExternalStore2(subscribeMobile, mobileSnapshot, () => false);
8650
8728
  const [internalCollapsed, setInternalCollapsed] = useState26(defaultCollapsed);
8651
8729
  const isCollapsed = collapsible && (collapsed ?? internalCollapsed ?? (collapseOnMobile && mobile));
8652
- const sidebarRef = useRef21(null);
8653
- const toggleRef = useRef21(null);
8730
+ const sidebarRef = useRef22(null);
8731
+ const toggleRef = useRef22(null);
8654
8732
  useEffect22(() => {
8655
8733
  const active = sidebarRef.current?.ownerDocument.activeElement;
8656
8734
  if (isCollapsed && active && active !== toggleRef.current && sidebarRef.current?.contains(active)) {
@@ -8845,7 +8923,7 @@ import {
8845
8923
  useContext as useContext13,
8846
8924
  useEffect as useEffect23,
8847
8925
  useId as useId20,
8848
- useRef as useRef22,
8926
+ useRef as useRef23,
8849
8927
  useState as useState27
8850
8928
  } from "react";
8851
8929
  import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
@@ -8899,6 +8977,10 @@ function NavigationMenu({
8899
8977
  classNames,
8900
8978
  children,
8901
8979
  label,
8980
+ openOnHover = false,
8981
+ onPointerEnter,
8982
+ onPointerLeave,
8983
+ onBlur,
8902
8984
  "aria-label": ariaLabel,
8903
8985
  className,
8904
8986
  ...props
@@ -8907,12 +8989,34 @@ function NavigationMenu({
8907
8989
  const [openValue, setOpenValue] = useState27(
8908
8990
  null
8909
8991
  );
8910
- const rootRef = useRef22(null);
8992
+ const rootRef = useRef23(null);
8911
8993
  const baseId = `pimolu-navigation-menu-${useId20()}`;
8994
+ const hoverTimer = useRef23(null);
8995
+ function cancelHover() {
8996
+ if (hoverTimer.current !== null) clearTimeout(hoverTimer.current);
8997
+ hoverTimer.current = null;
8998
+ }
8999
+ function changeOpen(value) {
9000
+ cancelHover();
9001
+ setOpenValue(value);
9002
+ }
9003
+ function hoverItem(value) {
9004
+ if (!openOnHover) return;
9005
+ const trigger = document.getElementById(`${baseId}-trigger-${slug2(value)}`);
9006
+ if (!trigger || trigger.matches(":disabled")) return;
9007
+ cancelHover();
9008
+ hoverTimer.current = setTimeout(() => {
9009
+ if (trigger.isConnected && !trigger.matches(":disabled")) setOpenValue(value);
9010
+ hoverTimer.current = null;
9011
+ }, 100);
9012
+ }
9013
+ useEffect23(() => () => {
9014
+ if (hoverTimer.current !== null) clearTimeout(hoverTimer.current);
9015
+ }, [openOnHover]);
8912
9016
  useOutsidePointer(
8913
9017
  rootRef,
8914
- openValue !== null,
8915
- () => setOpenValue(null)
9018
+ openValue !== null || openOnHover,
9019
+ () => changeOpen(null)
8916
9020
  );
8917
9021
  useEffect23(() => {
8918
9022
  if (openValue === null) return;
@@ -8920,7 +9024,7 @@ function NavigationMenu({
8920
9024
  if (event.key !== "Escape" || openValue === null) return;
8921
9025
  event.preventDefault();
8922
9026
  document.getElementById(`${baseId}-trigger-${slug2(openValue)}`)?.focus();
8923
- setOpenValue(null);
9027
+ changeOpen(null);
8924
9028
  }
8925
9029
  document.addEventListener("keydown", handleKeyDown);
8926
9030
  return () => document.removeEventListener("keydown", handleKeyDown);
@@ -8931,8 +9035,9 @@ function NavigationMenu({
8931
9035
  value: {
8932
9036
  baseId,
8933
9037
  openValue,
8934
- setOpenValue,
8935
- rootRef
9038
+ setOpenValue: changeOpen,
9039
+ rootRef,
9040
+ hoverItem
8936
9041
  },
8937
9042
  children: /* @__PURE__ */ jsx42(
8938
9043
  "nav",
@@ -8940,6 +9045,21 @@ function NavigationMenu({
8940
9045
  ...props,
8941
9046
  ref: rootRef,
8942
9047
  "aria-label": ariaLabel ?? label ?? "Main",
9048
+ onPointerEnter: (event) => {
9049
+ onPointerEnter?.(event);
9050
+ if (openOnHover && event.pointerType === "mouse") cancelHover();
9051
+ },
9052
+ onPointerLeave: (event) => {
9053
+ onPointerLeave?.(event);
9054
+ if (!openOnHover || event.pointerType !== "mouse") return;
9055
+ cancelHover();
9056
+ if (rootRef.current?.contains(document.activeElement)) return;
9057
+ hoverTimer.current = setTimeout(() => changeOpen(null), 180);
9058
+ },
9059
+ onBlur: (event) => {
9060
+ onBlur?.(event);
9061
+ if (openOnHover && !event.currentTarget.contains(event.relatedTarget)) changeOpen(null);
9062
+ },
8943
9063
  className: mergeClasses(classes10(
8944
9064
  "pimolu-navigation-menu",
8945
9065
  className
@@ -8974,6 +9094,7 @@ function NavigationMenuItem({
8974
9094
  value,
8975
9095
  children,
8976
9096
  className,
9097
+ onPointerEnter,
8977
9098
  ...props
8978
9099
  }) {
8979
9100
  const [partClasses, scopeParts] = usePartClasses("navigation-menu", classNames, false);
@@ -8988,6 +9109,10 @@ function NavigationMenuItem({
8988
9109
  "li",
8989
9110
  {
8990
9111
  ...props,
9112
+ onPointerEnter: (event) => {
9113
+ onPointerEnter?.(event);
9114
+ if (!event.defaultPrevented && event.pointerType === "mouse") root.hoverItem(value);
9115
+ },
8991
9116
  className: mergeClasses(classes10(
8992
9117
  "pimolu-navigation-menu__item",
8993
9118
  className
@@ -9157,7 +9282,7 @@ function ScrollArea({
9157
9282
  // tree-view/tree-view.tsx
9158
9283
  import {
9159
9284
  useEffect as useEffect24,
9160
- useRef as useRef23,
9285
+ useRef as useRef24,
9161
9286
  useState as useState28
9162
9287
  } from "react";
9163
9288
  import { jsx as jsx44, jsxs as jsxs33 } from "react/jsx-runtime";
@@ -9220,7 +9345,7 @@ function TreeView({
9220
9345
  const selectedId = isSelectedControlled ? controlledSelected : uncontrolledSelected;
9221
9346
  const visible = flatten(items, expanded);
9222
9347
  const [focusedId, setFocusedId] = useState28(selectedId ?? visible[0]?.item.id);
9223
- const refs = useRef23(/* @__PURE__ */ new Map());
9348
+ const refs = useRef24(/* @__PURE__ */ new Map());
9224
9349
  useEffect24(() => {
9225
9350
  if (focusedId && visible.some((node) => node.item.id === focusedId)) {
9226
9351
  return;
@@ -9607,10 +9732,10 @@ import {
9607
9732
  cloneElement as cloneElement7,
9608
9733
  createContext as createContext14,
9609
9734
  isValidElement as isValidElement8,
9610
- useCallback as useCallback11,
9735
+ useCallback as useCallback12,
9611
9736
  useContext as useContext14,
9612
9737
  useId as useId21,
9613
- useRef as useRef24,
9738
+ useRef as useRef25,
9614
9739
  useState as useState29
9615
9740
  } from "react";
9616
9741
  import { jsx as jsx48, jsxs as jsxs36 } from "react/jsx-runtime";
@@ -9632,7 +9757,7 @@ function DropdownMenu({
9632
9757
  }) {
9633
9758
  const [uncontrolledOpen, setUncontrolledOpen] = useState29(defaultOpen);
9634
9759
  const open = controlledOpen === void 0 ? uncontrolledOpen : controlledOpen;
9635
- const setOpen = useCallback11(
9760
+ const setOpen = useCallback12(
9636
9761
  (next) => {
9637
9762
  if (controlledOpen === void 0) {
9638
9763
  setUncontrolledOpen(next);
@@ -9641,9 +9766,9 @@ function DropdownMenu({
9641
9766
  },
9642
9767
  [controlledOpen, onOpenChange]
9643
9768
  );
9644
- const triggerRef = useRef24(null);
9645
- const contentRef = useRef24(null);
9646
- const scopeRef = useRef24(null);
9769
+ const triggerRef = useRef25(null);
9770
+ const contentRef = useRef25(null);
9771
+ const scopeRef = useRef25(null);
9647
9772
  const contentId = `pimolu-dropdown-${useId21()}`;
9648
9773
  const context = {
9649
9774
  open,
@@ -9706,7 +9831,7 @@ function DropdownMenuContent({
9706
9831
  onDismiss: () => menu.setOpen(false),
9707
9832
  closeOnEscape: false
9708
9833
  });
9709
- const { style } = useAnchoredPosition(
9834
+ const { style, onMount } = useAnchoredPosition(
9710
9835
  menu.triggerRef,
9711
9836
  menu.contentRef,
9712
9837
  rendered,
@@ -9719,14 +9844,14 @@ function DropdownMenuContent({
9719
9844
  maxHeight: 320
9720
9845
  }
9721
9846
  );
9722
- const attachContent = useCallback11((node) => {
9847
+ const attachContent = useCallback12((node) => {
9723
9848
  menu.contentRef.current = node;
9724
- if (node && menu.open) {
9849
+ if (node && menu.open && style?.visibility === "visible") {
9725
9850
  node.querySelector(
9726
9851
  '[role="menuitem"]:not([aria-disabled="true"]):not(:disabled)'
9727
9852
  )?.focus({ preventScroll: true });
9728
9853
  }
9729
- }, [menu.open, menu.contentRef]);
9854
+ }, [menu.open, menu.contentRef, style?.visibility]);
9730
9855
  if (!rendered) return scopeParts(null);
9731
9856
  function handleKeyDown(event) {
9732
9857
  if (event.key === "Escape") {
@@ -9763,7 +9888,7 @@ function DropdownMenuContent({
9763
9888
  event.preventDefault();
9764
9889
  items[nextIndex]?.focus();
9765
9890
  }
9766
- return scopeParts(/* @__PURE__ */ jsx48(Portal, { anchorRef: menu.scopeRef, children: /* @__PURE__ */ jsx48(
9891
+ return scopeParts(/* @__PURE__ */ jsx48(Portal, { anchorRef: menu.scopeRef, onMount, children: /* @__PURE__ */ jsx48(
9767
9892
  "div",
9768
9893
  {
9769
9894
  ref: attachContent,
@@ -10120,12 +10245,12 @@ import {
10120
10245
  cloneElement as cloneElement8,
10121
10246
  createContext as createContext15,
10122
10247
  isValidElement as isValidElement9,
10123
- useCallback as useCallback12,
10248
+ useCallback as useCallback13,
10124
10249
  useContext as useContext15,
10125
10250
  useEffect as useEffect25,
10126
10251
  useId as useId22,
10127
- useLayoutEffect as useLayoutEffect3,
10128
- useRef as useRef25,
10252
+ useLayoutEffect as useLayoutEffect4,
10253
+ useRef as useRef26,
10129
10254
  useState as useState30
10130
10255
  } from "react";
10131
10256
  import { jsx as jsx50, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -10168,7 +10293,7 @@ function clampToViewport(point, width, height, padding) {
10168
10293
  }
10169
10294
  function getEnabledItems(panel) {
10170
10295
  if (!panel) return [];
10171
- return getFocusable(panel).filter(
10296
+ return getFocusable(panel, { includeNegativeTabIndex: true }).filter(
10172
10297
  (node) => node.getAttribute("role") === "menuitem"
10173
10298
  );
10174
10299
  }
@@ -10184,11 +10309,11 @@ function ContextMenu({
10184
10309
  y: 0
10185
10310
  });
10186
10311
  const open = controlledOpen === void 0 ? uncontrolledOpen : controlledOpen;
10187
- const triggerRef = useRef25(null);
10188
- const contentRef = useRef25(null);
10189
- const scopeRef = useRef25(null);
10312
+ const triggerRef = useRef26(null);
10313
+ const contentRef = useRef26(null);
10314
+ const scopeRef = useRef26(null);
10190
10315
  const contentId = `pimolu-context-menu-${useId22()}`;
10191
- const setOpen = useCallback12(
10316
+ const setOpen = useCallback13(
10192
10317
  (next) => {
10193
10318
  if (controlledOpen === void 0) {
10194
10319
  setUncontrolledOpen(next);
@@ -10197,7 +10322,7 @@ function ContextMenu({
10197
10322
  },
10198
10323
  [controlledOpen, onOpenChange]
10199
10324
  );
10200
- const openAt = useCallback12(
10325
+ const openAt = useCallback13(
10201
10326
  (x, y) => {
10202
10327
  setPoint({ x, y });
10203
10328
  if (open) return;
@@ -10269,7 +10394,7 @@ function ContextMenuSurface({
10269
10394
  const [position, setPosition] = useState30(
10270
10395
  () => clampToViewport(menu.point, 0, 0, collisionPadding)
10271
10396
  );
10272
- useLayoutEffect3(() => {
10397
+ useLayoutEffect4(() => {
10273
10398
  if (!menu.open) return;
10274
10399
  const panel = menu.contentRef.current;
10275
10400
  if (!panel) return;
@@ -10476,7 +10601,7 @@ import {
10476
10601
  useContext as useContext16,
10477
10602
  useEffect as useEffect26,
10478
10603
  useId as useId23,
10479
- useRef as useRef26,
10604
+ useRef as useRef27,
10480
10605
  useState as useState31
10481
10606
  } from "react";
10482
10607
  import { jsx as jsx51 } from "react/jsx-runtime";
@@ -10511,13 +10636,13 @@ function HoverCard({
10511
10636
  EXIT_DURATION6
10512
10637
  );
10513
10638
  const contentId = `pimolu-hover-card-${useId23()}`;
10514
- const triggerRef = useRef26(null);
10515
- const contentRef = useRef26(null);
10516
- const openRef = useRef26(false);
10517
- const openTimer = useRef26(null);
10518
- const closeTimer = useRef26(null);
10519
- const skipFocusOpen = useRef26(false);
10520
- const skipFocusReset = useRef26(null);
10639
+ const triggerRef = useRef27(null);
10640
+ const contentRef = useRef27(null);
10641
+ const openRef = useRef27(false);
10642
+ const openTimer = useRef27(null);
10643
+ const closeTimer = useRef27(null);
10644
+ const skipFocusOpen = useRef27(false);
10645
+ const skipFocusReset = useRef27(null);
10521
10646
  function clearOpenTimer() {
10522
10647
  if (openTimer.current !== null) {
10523
10648
  clearTimeout(openTimer.current);
@@ -10735,7 +10860,7 @@ function HoverCardContent({
10735
10860
  }) {
10736
10861
  const [partClasses, scopeParts] = usePartClasses("hover-card", classNames, true);
10737
10862
  const hoverCard = useHoverCard("HoverCardContent");
10738
- const { style, side } = useAnchoredPosition(
10863
+ const { style, side, onMount } = useAnchoredPosition(
10739
10864
  hoverCard.triggerRef,
10740
10865
  hoverCard.contentRef,
10741
10866
  hoverCard.rendered,
@@ -10767,7 +10892,7 @@ function HoverCardContent({
10767
10892
  }
10768
10893
  hoverCard.requestClose();
10769
10894
  }
10770
- return scopeParts(/* @__PURE__ */ jsx51(Portal, { anchorRef: hoverCard.triggerRef, children: /* @__PURE__ */ jsx51(
10895
+ return scopeParts(/* @__PURE__ */ jsx51(Portal, { anchorRef: hoverCard.triggerRef, onMount, children: /* @__PURE__ */ jsx51(
10771
10896
  "div",
10772
10897
  {
10773
10898
  ref: hoverCard.contentRef,
@@ -10793,11 +10918,11 @@ function HoverCardContent({
10793
10918
 
10794
10919
  // command/command.tsx
10795
10920
  import {
10796
- useCallback as useCallback13,
10921
+ useCallback as useCallback14,
10797
10922
  useEffect as useEffect27,
10798
10923
  useId as useId24,
10799
10924
  useMemo as useMemo8,
10800
- useRef as useRef27,
10925
+ useRef as useRef28,
10801
10926
  useState as useState32
10802
10927
  } from "react";
10803
10928
  import { jsx as jsx52, jsxs as jsxs39 } from "react/jsx-runtime";
@@ -10859,8 +10984,8 @@ function Command({
10859
10984
  const [partClasses, scopeParts] = usePartClasses("command", classNames, true);
10860
10985
  const generatedId = useId24();
10861
10986
  const listboxId = `pimolu-command-${generatedId}`;
10862
- const inputRef = useRef27(null);
10863
- const listRef = useRef27(null);
10987
+ const inputRef = useRef28(null);
10988
+ const listRef = useRef28(null);
10864
10989
  const [query, setQuery] = useState32("");
10865
10990
  const [activeId, setActiveId] = useState32(
10866
10991
  () => firstEnabledId(items)
@@ -10898,7 +11023,7 @@ function Command({
10898
11023
  );
10899
11024
  node?.scrollIntoView?.({ block: "nearest" });
10900
11025
  }, [activeId, filteredItems]);
10901
- const selectItem = useCallback13(
11026
+ const selectItem = useCallback14(
10902
11027
  (item) => {
10903
11028
  if (item.disabled) return;
10904
11029
  item.onSelect?.();
@@ -11105,7 +11230,7 @@ function CommandPalette({
11105
11230
  const isControlled = controlledOpen !== void 0;
11106
11231
  const [uncontrolledOpen, setUncontrolledOpen] = useState32(defaultOpen);
11107
11232
  const open = isControlled ? controlledOpen : uncontrolledOpen;
11108
- const setOpen = useCallback13(
11233
+ const setOpen = useCallback14(
11109
11234
  (next) => {
11110
11235
  if (!isControlled) {
11111
11236
  setUncontrolledOpen(next);
@@ -12539,7 +12664,7 @@ function TimelineTime({
12539
12664
  import {
12540
12665
  forwardRef as forwardRef34,
12541
12666
  useId as useId28,
12542
- useRef as useRef28,
12667
+ useRef as useRef29,
12543
12668
  useState as useState34
12544
12669
  } from "react";
12545
12670
  import { jsx as jsx63, jsxs as jsxs49 } from "react/jsx-runtime";
@@ -12585,7 +12710,7 @@ var Rating = forwardRef34(function Rating2({
12585
12710
  const [hovered, setHovered] = useState34(
12586
12711
  null
12587
12712
  );
12588
- const itemRefs = useRef28([]);
12713
+ const itemRefs = useRef29([]);
12589
12714
  const locked = readOnly || disabled;
12590
12715
  const preview = hovered ?? current;
12591
12716
  function commit(next) {
@@ -12732,10 +12857,10 @@ Rating.displayName = "PimoluRating";
12732
12857
  // number-input/number-input.tsx
12733
12858
  import {
12734
12859
  forwardRef as forwardRef35,
12735
- useCallback as useCallback14,
12860
+ useCallback as useCallback15,
12736
12861
  useEffect as useEffect28,
12737
12862
  useId as useId29,
12738
- useRef as useRef29,
12863
+ useRef as useRef30,
12739
12864
  useState as useState35
12740
12865
  } from "react";
12741
12866
  import { jsx as jsx64, jsxs as jsxs50 } from "react/jsx-runtime";
@@ -12818,7 +12943,7 @@ var NumberInput = forwardRef35(function NumberInput2({
12818
12943
  const [partClasses, scopeParts] = usePartClasses("number-input", classNames, true);
12819
12944
  const generatedId = useId29();
12820
12945
  const inputId = id ?? `pimolu-number-input-${generatedId}`;
12821
- const inputRef = useRef29(null);
12946
+ const inputRef = useRef30(null);
12822
12947
  const isControlled = value !== void 0;
12823
12948
  const [internalValue, setInternalValue] = useState35(
12824
12949
  () => finiteOrNull(defaultValue)
@@ -12838,7 +12963,7 @@ var NumberInput = forwardRef35(function NumberInput2({
12838
12963
  formatNumber(currentValue, resolvedPrecision)
12839
12964
  );
12840
12965
  }, [currentValue, focused, resolvedPrecision]);
12841
- const setInputRef = useCallback14(
12966
+ const setInputRef = useCallback15(
12842
12967
  (node) => {
12843
12968
  inputRef.current = node;
12844
12969
  if (typeof forwardedRef === "function") {
@@ -13114,7 +13239,7 @@ import {
13114
13239
  forwardRef as forwardRef36,
13115
13240
  useEffect as useEffect29,
13116
13241
  useId as useId30,
13117
- useRef as useRef30,
13242
+ useRef as useRef31,
13118
13243
  useState as useState36
13119
13244
  } from "react";
13120
13245
  import { jsx as jsx65, jsxs as jsxs51 } from "react/jsx-runtime";
@@ -13162,8 +13287,8 @@ var PinInput = forwardRef36(function PinInput2({
13162
13287
  const isControlled = value !== void 0;
13163
13288
  const [internalValue, setInternalValue] = useState36(() => normalizeCells(defaultValue, count, type));
13164
13289
  const cells = isControlled ? normalizeCells(value, count, type) : normalizeCells(internalValue, count, type);
13165
- const inputsRef = useRef30([]);
13166
- const completedRef = useRef30(cells.every(Boolean));
13290
+ const inputsRef = useRef31([]);
13291
+ const completedRef = useRef31(cells.every(Boolean));
13167
13292
  useEffect29(() => {
13168
13293
  completedRef.current = cells.every(Boolean);
13169
13294
  }, [cells]);
@@ -13392,9 +13517,9 @@ PinInput.displayName = "PimoluPinInput";
13392
13517
  // tags-input/tags-input.tsx
13393
13518
  import {
13394
13519
  forwardRef as forwardRef37,
13395
- useCallback as useCallback15,
13520
+ useCallback as useCallback16,
13396
13521
  useId as useId31,
13397
- useRef as useRef31,
13522
+ useRef as useRef32,
13398
13523
  useState as useState37
13399
13524
  } from "react";
13400
13525
  import { jsx as jsx66, jsxs as jsxs52 } from "react/jsx-runtime";
@@ -13446,8 +13571,8 @@ var TagsInput = forwardRef37(function TagsInput2({
13446
13571
  const [internalTags, setInternalTags] = useState37(() => normalizeTags(defaultValue ?? []));
13447
13572
  const tags = (isControlled ? value ?? [] : internalTags).filter((tag) => tag.trim() !== "");
13448
13573
  const [draft, setDraft] = useState37("");
13449
- const inputRef = useRef31(null);
13450
- const setInputRef = useCallback15(
13574
+ const inputRef = useRef32(null);
13575
+ const setInputRef = useCallback16(
13451
13576
  (node) => {
13452
13577
  inputRef.current = node;
13453
13578
  if (typeof forwardedRef === "function") {
@@ -13682,9 +13807,9 @@ TagsInput.displayName = "PimoluTagsInput";
13682
13807
  // time-picker/time-picker.tsx
13683
13808
  import {
13684
13809
  forwardRef as forwardRef38,
13685
- useCallback as useCallback16,
13810
+ useCallback as useCallback17,
13686
13811
  useId as useId32,
13687
- useRef as useRef32,
13812
+ useRef as useRef33,
13688
13813
  useState as useState38
13689
13814
  } from "react";
13690
13815
  import { jsx as jsx67, jsxs as jsxs53 } from "react/jsx-runtime";
@@ -13725,11 +13850,11 @@ var TimePicker = forwardRef38(function TimePicker2({
13725
13850
  const [partClasses, scopeParts] = usePartClasses("time-picker", classNames, true);
13726
13851
  const generatedId = useId32();
13727
13852
  const inputId = id ?? `pimolu-time-picker-${generatedId}`;
13728
- const inputRef = useRef32(null);
13853
+ const inputRef = useRef33(null);
13729
13854
  const isControlled = value !== void 0;
13730
13855
  const [internalValue, setInternalValue] = useState38(() => normalizeTime(defaultValue));
13731
13856
  const currentValue = isControlled ? normalizeTime(value) : internalValue;
13732
- const setInputRef = useCallback16(
13857
+ const setInputRef = useCallback17(
13733
13858
  (node) => {
13734
13859
  inputRef.current = node;
13735
13860
  if (typeof forwardedRef === "function") {
@@ -13872,7 +13997,7 @@ import {
13872
13997
  useEffect as useEffect30,
13873
13998
  useId as useId33,
13874
13999
  useMemo as useMemo10,
13875
- useRef as useRef33,
14000
+ useRef as useRef34,
13876
14001
  useState as useState39
13877
14002
  } from "react";
13878
14003
  import { jsx as jsx68, jsxs as jsxs54 } from "react/jsx-runtime";
@@ -14025,7 +14150,7 @@ function Calendar({
14025
14150
  const [partClasses, scopeParts] = usePartClasses("calendar", classNames, true);
14026
14151
  const generatedId = useId33();
14027
14152
  const instructionsId = `pimolu-calendar-${generatedId}-instructions`;
14028
- const rootRef = useRef33(null);
14153
+ const rootRef = useRef34(null);
14029
14154
  const monthControlled = month !== void 0;
14030
14155
  const selectedControlled = selected !== void 0;
14031
14156
  const rangeControlled = range !== void 0;
@@ -14043,7 +14168,7 @@ function Calendar({
14043
14168
  const seed = selected ?? range?.from ?? /* @__PURE__ */ new Date();
14044
14169
  return isSameMonth(seed, initialMonth) ? startOfDay(seed) : startOfDay(initialMonth);
14045
14170
  });
14046
- const pendingFocus = useRef33(null);
14171
+ const pendingFocus = useRef34(null);
14047
14172
  const visibleMonthKey = `${visibleMonth.getFullYear()}-${visibleMonth.getMonth()}`;
14048
14173
  const monthFormatter = useMemo10(
14049
14174
  () => new Intl.DateTimeFormat(locale, {
@@ -14408,11 +14533,11 @@ function Calendar({
14408
14533
  // date-picker/date-picker.tsx
14409
14534
  import {
14410
14535
  forwardRef as forwardRef39,
14411
- useCallback as useCallback17,
14536
+ useCallback as useCallback18,
14412
14537
  useEffect as useEffect31,
14413
14538
  useId as useId34,
14414
14539
  useMemo as useMemo11,
14415
- useRef as useRef34,
14540
+ useRef as useRef35,
14416
14541
  useState as useState40
14417
14542
  } from "react";
14418
14543
  import { jsx as jsx69, jsxs as jsxs55 } from "react/jsx-runtime";
@@ -14471,9 +14596,9 @@ var DatePicker = forwardRef39(function DatePicker2({
14471
14596
  const labelId = `${triggerId}-label`;
14472
14597
  const valueId = `${triggerId}-value`;
14473
14598
  const panelId = `${triggerId}-panel`;
14474
- const fieldRef = useRef34(null);
14475
- const triggerRef = useRef34(null);
14476
- const panelRef = useRef34(null);
14599
+ const fieldRef = useRef35(null);
14600
+ const triggerRef = useRef35(null);
14601
+ const panelRef = useRef35(null);
14477
14602
  const isControlled = value !== void 0;
14478
14603
  const [internalValue, setInternalValue] = useState40(defaultValue);
14479
14604
  const [open, setOpen] = useState40(false);
@@ -14482,7 +14607,7 @@ var DatePicker = forwardRef39(function DatePicker2({
14482
14607
  open,
14483
14608
  EXIT_DURATION7
14484
14609
  );
14485
- const { style: panelStyle, side } = useAnchoredPosition(
14610
+ const { style: panelStyle, side, onMount } = useAnchoredPosition(
14486
14611
  triggerRef,
14487
14612
  panelRef,
14488
14613
  rendered,
@@ -14509,7 +14634,7 @@ var DatePicker = forwardRef39(function DatePicker2({
14509
14634
  [locale]
14510
14635
  );
14511
14636
  const formattedValue = currentValue ? dateFormatter.format(currentValue) : null;
14512
- const assignTriggerRef = useCallback17(
14637
+ const assignTriggerRef = useCallback18(
14513
14638
  (node) => {
14514
14639
  triggerRef.current = node;
14515
14640
  if (typeof forwardedRef === "function") {
@@ -14520,16 +14645,16 @@ var DatePicker = forwardRef39(function DatePicker2({
14520
14645
  },
14521
14646
  [forwardedRef]
14522
14647
  );
14523
- const setPanelRef = useCallback17(
14648
+ const setPanelRef = useCallback18(
14524
14649
  (node) => {
14525
14650
  panelRef.current = node;
14526
- if (!node || !open) return;
14651
+ if (!node || !open || panelStyle?.visibility !== "visible") return;
14527
14652
  const target = node.querySelector(
14528
14653
  '[role="gridcell"][tabindex="0"]'
14529
14654
  );
14530
- (target ?? node).focus();
14655
+ (target ?? node).focus({ preventScroll: true });
14531
14656
  },
14532
- [open]
14657
+ [open, panelStyle?.visibility]
14533
14658
  );
14534
14659
  function closeWithFocus() {
14535
14660
  setOpen(false);
@@ -14683,7 +14808,7 @@ var DatePicker = forwardRef39(function DatePicker2({
14683
14808
  disabled
14684
14809
  }
14685
14810
  ),
14686
- rendered && /* @__PURE__ */ jsx69(Portal, { anchorRef: triggerRef, children: /* @__PURE__ */ jsx69(
14811
+ rendered && /* @__PURE__ */ jsx69(Portal, { anchorRef: triggerRef, onMount, children: /* @__PURE__ */ jsx69(
14687
14812
  "div",
14688
14813
  {
14689
14814
  ref: setPanelRef,
@@ -14718,11 +14843,11 @@ DatePicker.displayName = "PimoluDatePicker";
14718
14843
  // date-range-picker/date-range-picker.tsx
14719
14844
  import {
14720
14845
  forwardRef as forwardRef40,
14721
- useCallback as useCallback18,
14846
+ useCallback as useCallback19,
14722
14847
  useEffect as useEffect32,
14723
14848
  useId as useId35,
14724
14849
  useMemo as useMemo12,
14725
- useRef as useRef35,
14850
+ useRef as useRef36,
14726
14851
  useState as useState41
14727
14852
  } from "react";
14728
14853
  import { Fragment as Fragment10, jsx as jsx70, jsxs as jsxs56 } from "react/jsx-runtime";
@@ -14817,9 +14942,9 @@ var DateRangePicker = forwardRef40(function DateRangePicker2({
14817
14942
  const labelId = `${triggerId}-label`;
14818
14943
  const valueId = `${triggerId}-value`;
14819
14944
  const panelId = `${triggerId}-panel`;
14820
- const fieldRef = useRef35(null);
14821
- const triggerRef = useRef35(null);
14822
- const panelRef = useRef35(null);
14945
+ const fieldRef = useRef36(null);
14946
+ const triggerRef = useRef36(null);
14947
+ const panelRef = useRef36(null);
14823
14948
  const isControlled = value !== void 0;
14824
14949
  const [internalRange, setInternalRange] = useState41(
14825
14950
  () => normalizeRange(defaultValue ?? EMPTY_RANGE)
@@ -14832,7 +14957,7 @@ var DateRangePicker = forwardRef40(function DateRangePicker2({
14832
14957
  open,
14833
14958
  EXIT_DURATION8
14834
14959
  );
14835
- const { style: panelStyle, side } = useAnchoredPosition(
14960
+ const { style: panelStyle, side, onMount } = useAnchoredPosition(
14836
14961
  triggerRef,
14837
14962
  panelRef,
14838
14963
  rendered,
@@ -14865,7 +14990,7 @@ var DateRangePicker = forwardRef40(function DateRangePicker2({
14865
14990
  const formattedValue = formattedFrom && formattedTo ? isSameDay2(from, to) ? formattedFrom : `${formattedFrom} \u2013 ${formattedTo}` : formattedFrom ? `From ${formattedFrom}` : formattedTo ? `Until ${formattedTo}` : null;
14866
14991
  const selectedDays = from && to ? daysBetween(from, to) + 1 : 0;
14867
14992
  const summary = from && to ? `${selectedDays} ${selectedDays === 1 ? "day" : "days"} selected` : from ? "Select an end date." : "Select a start date.";
14868
- const assignTriggerRef = useCallback18(
14993
+ const assignTriggerRef = useCallback19(
14869
14994
  (node) => {
14870
14995
  triggerRef.current = node;
14871
14996
  if (typeof forwardedRef === "function") {
@@ -14876,16 +15001,16 @@ var DateRangePicker = forwardRef40(function DateRangePicker2({
14876
15001
  },
14877
15002
  [forwardedRef]
14878
15003
  );
14879
- const setPanelRef = useCallback18(
15004
+ const setPanelRef = useCallback19(
14880
15005
  (node) => {
14881
15006
  panelRef.current = node;
14882
- if (!node || !open) return;
15007
+ if (!node || !open || panelStyle?.visibility !== "visible") return;
14883
15008
  const target = node.querySelector(
14884
15009
  '[role="gridcell"][tabindex="0"]'
14885
15010
  );
14886
- (target ?? node).focus();
15011
+ (target ?? node).focus({ preventScroll: true });
14887
15012
  },
14888
- [open]
15013
+ [open, panelStyle?.visibility]
14889
15014
  );
14890
15015
  function closeWithFocus() {
14891
15016
  setOpen(false);
@@ -15060,7 +15185,7 @@ var DateRangePicker = forwardRef40(function DateRangePicker2({
15060
15185
  }
15061
15186
  )
15062
15187
  ] }),
15063
- rendered && /* @__PURE__ */ jsx70(Portal, { anchorRef: triggerRef, children: /* @__PURE__ */ jsxs56(
15188
+ rendered && /* @__PURE__ */ jsx70(Portal, { anchorRef: triggerRef, onMount, children: /* @__PURE__ */ jsxs56(
15064
15189
  "div",
15065
15190
  {
15066
15191
  ref: setPanelRef,
@@ -15127,7 +15252,7 @@ DateRangePicker.displayName = "PimoluDateRangePicker";
15127
15252
  import {
15128
15253
  forwardRef as forwardRef41,
15129
15254
  useId as useId36,
15130
- useRef as useRef36,
15255
+ useRef as useRef37,
15131
15256
  useState as useState43
15132
15257
  } from "react";
15133
15258
 
@@ -15333,7 +15458,7 @@ var FileUpload = forwardRef41(function FileUpload2({
15333
15458
  const descriptionId = `${inputId}-description`;
15334
15459
  const errorId = `${inputId}-error`;
15335
15460
  const buttonTextId = `${inputId}-button-text`;
15336
- const inputRef = useRef36(null);
15461
+ const inputRef = useRef37(null);
15337
15462
  const isControlled = files !== void 0;
15338
15463
  const [internalFiles, setInternalFiles] = useState43(
15339
15464
  () => defaultFiles ?? []
@@ -15602,7 +15727,7 @@ FileUpload.displayName = "PimoluFileUpload";
15602
15727
  import {
15603
15728
  forwardRef as forwardRef42,
15604
15729
  useId as useId37,
15605
- useRef as useRef37,
15730
+ useRef as useRef38,
15606
15731
  useState as useState44
15607
15732
  } from "react";
15608
15733
  import { jsx as jsx73, jsxs as jsxs59 } from "react/jsx-runtime";
@@ -15735,8 +15860,8 @@ var Dropzone = forwardRef42(function Dropzone2({
15735
15860
  const hintId = `${inputId}-hint`;
15736
15861
  const descriptionId = `${inputId}-description`;
15737
15862
  const errorId = `${inputId}-error`;
15738
- const inputRef = useRef37(null);
15739
- const dragDepth = useRef37(0);
15863
+ const inputRef = useRef38(null);
15864
+ const dragDepth = useRef38(0);
15740
15865
  const [dragging, setDragging] = useState44(false);
15741
15866
  const isControlled = files !== void 0;
15742
15867
  const [internalFiles, setInternalFiles] = useState44(
@@ -16065,7 +16190,7 @@ import {
16065
16190
  forwardRef as forwardRef43,
16066
16191
  useEffect as useEffect34,
16067
16192
  useId as useId38,
16068
- useRef as useRef38,
16193
+ useRef as useRef39,
16069
16194
  useState as useState45
16070
16195
  } from "react";
16071
16196
  import { Fragment as Fragment12, jsx as jsx74, jsxs as jsxs60 } from "react/jsx-runtime";
@@ -16132,7 +16257,7 @@ var ColorPicker = forwardRef43(function ColorPicker2({
16132
16257
  const hexErrorId = `pimolu-color-picker-${generatedId}-hex-error`;
16133
16258
  const hintId = `pimolu-color-picker-${generatedId}-hint`;
16134
16259
  const presetsTitleId = `pimolu-color-picker-${generatedId}-presets-title`;
16135
- const triggerRef = useRef38(null);
16260
+ const triggerRef = useRef39(null);
16136
16261
  const isControlled = value !== void 0;
16137
16262
  const [internalValue, setInternalValue] = useState45(
16138
16263
  () => resolveColor(defaultValue)
@@ -17080,10 +17205,10 @@ VisuallyHidden.displayName = "PimoluVisuallyHidden";
17080
17205
  // focus-scope/focus-scope.tsx
17081
17206
  import {
17082
17207
  forwardRef as forwardRef53,
17083
- useCallback as useCallback19,
17208
+ useCallback as useCallback20,
17084
17209
  useEffect as useEffect35,
17085
17210
  useMemo as useMemo13,
17086
- useRef as useRef39
17211
+ useRef as useRef40
17087
17212
  } from "react";
17088
17213
  import { jsx as jsx84 } from "react/jsx-runtime";
17089
17214
  var FocusScope = forwardRef53(function FocusScope2({
@@ -17100,10 +17225,10 @@ var FocusScope = forwardRef53(function FocusScope2({
17100
17225
  ...props
17101
17226
  }, forwardedRef) {
17102
17227
  const [partClasses, scopeParts] = usePartClasses("focus-scope", classNames, true);
17103
- const containerRef = useRef39(null);
17104
- const restoreFocusRef = useRef39(restoreFocus);
17228
+ const containerRef = useRef40(null);
17229
+ const restoreFocusRef = useRef40(restoreFocus);
17105
17230
  restoreFocusRef.current = restoreFocus;
17106
- const setRef = useCallback19(
17231
+ const setRef = useCallback20(
17107
17232
  (node) => {
17108
17233
  containerRef.current = node;
17109
17234
  if (typeof forwardedRef === "function") {
@@ -17167,9 +17292,9 @@ FocusScope.displayName = "PimoluFocusScope";
17167
17292
  // image/image.tsx
17168
17293
  import {
17169
17294
  forwardRef as forwardRef54,
17170
- useCallback as useCallback20,
17295
+ useCallback as useCallback21,
17171
17296
  useEffect as useEffect36,
17172
- useRef as useRef40,
17297
+ useRef as useRef41,
17173
17298
  useState as useState46
17174
17299
  } from "react";
17175
17300
  import { jsx as jsx85, jsxs as jsxs61 } from "react/jsx-runtime";
@@ -17216,8 +17341,8 @@ var Image2 = forwardRef54(function Image3({
17216
17341
  ...props
17217
17342
  }, ref) {
17218
17343
  const [partClasses, scopeParts] = usePartClasses("image", classNames, true);
17219
- const imageRef = useRef40(null);
17220
- const attachRef = useCallback20((node) => {
17344
+ const imageRef = useRef41(null);
17345
+ const attachRef = useCallback21((node) => {
17221
17346
  imageRef.current = node;
17222
17347
  if (typeof ref === "function") return ref(node);
17223
17348
  if (ref) ref.current = node;
@@ -17314,10 +17439,10 @@ Image2.displayName = "PimoluImage";
17314
17439
  import {
17315
17440
  Children as Children5,
17316
17441
  forwardRef as forwardRef55,
17317
- useCallback as useCallback21,
17442
+ useCallback as useCallback22,
17318
17443
  useEffect as useEffect37,
17319
17444
  useMemo as useMemo14,
17320
- useRef as useRef41,
17445
+ useRef as useRef42,
17321
17446
  useState as useState47
17322
17447
  } from "react";
17323
17448
  import { Fragment as Fragment13, jsx as jsx86, jsxs as jsxs62 } from "react/jsx-runtime";
@@ -17422,18 +17547,18 @@ var Carousel = forwardRef55(function Carousel2({
17422
17547
  count,
17423
17548
  loop
17424
17549
  );
17425
- const currentIndexRef = useRef41(currentIndex);
17550
+ const currentIndexRef = useRef42(currentIndex);
17426
17551
  currentIndexRef.current = currentIndex;
17427
- const trackRef = useRef41(
17552
+ const trackRef = useRef42(
17428
17553
  null
17429
17554
  );
17430
- const scrollTimerRef = useRef41(
17555
+ const scrollTimerRef = useRef42(
17431
17556
  null
17432
17557
  );
17433
17558
  const [interacting, setInteracting] = useState47(false);
17434
17559
  const [stopped, setStopped] = useState47(false);
17435
17560
  const isPaused = autoPlay && (stopped || pauseOnHover && interacting);
17436
- const commit = useCallback21(
17561
+ const commit = useCallback22(
17437
17562
  (next) => {
17438
17563
  const normalized = clampIndex(
17439
17564
  next,
@@ -17686,9 +17811,9 @@ Carousel.displayName = "PimoluCarousel";
17686
17811
  // resizable/resizable.tsx
17687
17812
  import {
17688
17813
  forwardRef as forwardRef56,
17689
- useCallback as useCallback22,
17814
+ useCallback as useCallback23,
17690
17815
  useId as useId39,
17691
- useRef as useRef42,
17816
+ useRef as useRef43,
17692
17817
  useState as useState48
17693
17818
  } from "react";
17694
17819
  import { jsx as jsx87, jsxs as jsxs63 } from "react/jsx-runtime";
@@ -17775,12 +17900,12 @@ var Resizable = forwardRef56(function Resizable2({
17775
17900
  lowerFirst,
17776
17901
  upperFirst
17777
17902
  );
17778
- const rootRef = useRef42(
17903
+ const rootRef = useRef43(
17779
17904
  null
17780
17905
  );
17781
- const dragRef = useRef42(null);
17906
+ const dragRef = useRef43(null);
17782
17907
  const [dragging, setDragging] = useState48(false);
17783
- const assignRootRef = useCallback22(
17908
+ const assignRootRef = useCallback23(
17784
17909
  (node) => {
17785
17910
  rootRef.current = node;
17786
17911
  if (typeof forwardedRef === "function") {
@@ -18179,7 +18304,7 @@ import {
18179
18304
  Fragment as Fragment14,
18180
18305
  useId as useId40,
18181
18306
  useMemo as useMemo15,
18182
- useRef as useRef43,
18307
+ useRef as useRef44,
18183
18308
  useState as useState50
18184
18309
  } from "react";
18185
18310
  import { jsx as jsx90, jsxs as jsxs65 } from "react/jsx-runtime";
@@ -18408,7 +18533,7 @@ function DataGrid({
18408
18533
  const [internalWidths, setInternalWidths] = useState50(() => ({ ...defaultColumnWidths ?? {} }));
18409
18534
  const [collapsedGroups, setCollapsedGroups] = useState50(() => new Set(defaultCollapsedGroups ?? []));
18410
18535
  const [resizingId, setResizingId] = useState50(null);
18411
- const dragRef = useRef43(null);
18536
+ const dragRef = useRef44(null);
18412
18537
  const isFilterControlled = controlledFilter !== void 0;
18413
18538
  const filterValue = isFilterControlled ? controlledFilter : internalFilter;
18414
18539
  const isSortControlled = controlledSort !== void 0;
@@ -19190,7 +19315,7 @@ function ColumnsIcon() {
19190
19315
  import {
19191
19316
  useEffect as useEffect38,
19192
19317
  useMemo as useMemo16,
19193
- useRef as useRef44,
19318
+ useRef as useRef45,
19194
19319
  useState as useState51
19195
19320
  } from "react";
19196
19321
  import { jsx as jsx91, jsxs as jsxs66 } from "react/jsx-runtime";
@@ -19387,7 +19512,7 @@ function TreeTable({
19387
19512
  const [focusedId, setFocusedId] = useState51(
19388
19513
  () => selectedIds[0] ?? nodes.find((node) => !node.disabled)?.id
19389
19514
  );
19390
- const rowRefs = useRef44(
19515
+ const rowRefs = useRef45(
19391
19516
  /* @__PURE__ */ new Map()
19392
19517
  );
19393
19518
  useEffect38(() => {
@@ -19801,7 +19926,7 @@ function Chevron7({ classNames } = {}) {
19801
19926
  import {
19802
19927
  forwardRef as forwardRef58,
19803
19928
  useId as useId41,
19804
- useRef as useRef45,
19929
+ useRef as useRef46,
19805
19930
  useState as useState52,
19806
19931
  useEffect as useEffect39,
19807
19932
  useImperativeHandle
@@ -19844,7 +19969,7 @@ function safeSize(value, fallback) {
19844
19969
  return value != null && Number.isFinite(value) && value > 0 ? value : fallback;
19845
19970
  }
19846
19971
  function useCartesianViewport(width, forwardedRef, responsive) {
19847
- const containerRef = useRef45(null);
19972
+ const containerRef = useRef46(null);
19848
19973
  const [measuredWidth, setMeasuredWidth] = useState52(0);
19849
19974
  useImperativeHandle(forwardedRef, () => containerRef.current, []);
19850
19975
  useEffect39(() => {
@@ -19916,8 +20041,8 @@ function ChartContainer({
19916
20041
  const [partClasses, scopeParts] = usePartClasses("chart", classNames, false);
19917
20042
  const [activeIndex, setActiveIndex] = useState52(null);
19918
20043
  const [keyboard, setKeyboard] = useState52(false);
19919
- const pointerFocus = useRef45(false);
19920
- const dismissedIndex = useRef45(null);
20044
+ const pointerFocus = useRef46(false);
20045
+ const dismissedIndex = useRef46(null);
19921
20046
  const instructionsId = useId41();
19922
20047
  const tooltipId = useId41();
19923
20048
  const active = activeIndex == null ? void 0 : exploration?.items[activeIndex];
@@ -21454,7 +21579,7 @@ import {
21454
21579
  useContext as useContext17,
21455
21580
  useEffect as useEffect40,
21456
21581
  useId as useId42,
21457
- useRef as useRef46,
21582
+ useRef as useRef47,
21458
21583
  useState as useState53
21459
21584
  } from "react";
21460
21585
  import { jsx as jsx93 } from "react/jsx-runtime";
@@ -21503,8 +21628,8 @@ function useForm({
21503
21628
  {}
21504
21629
  );
21505
21630
  const [isSubmitting, setIsSubmitting] = useState53(false);
21506
- const initialValues = useRef46({ ...defaultValues });
21507
- const mounted = useRef46(true);
21631
+ const initialValues = useRef47({ ...defaultValues });
21632
+ const mounted = useRef47(true);
21508
21633
  useEffect40(() => {
21509
21634
  mounted.current = true;
21510
21635
  return () => {
@@ -21709,10 +21834,10 @@ function FormSubmit({
21709
21834
  // masked-input/masked-input.tsx
21710
21835
  import {
21711
21836
  forwardRef as forwardRef59,
21712
- useCallback as useCallback23,
21837
+ useCallback as useCallback24,
21713
21838
  useId as useId43,
21714
- useLayoutEffect as useLayoutEffect4,
21715
- useRef as useRef47,
21839
+ useLayoutEffect as useLayoutEffect5,
21840
+ useRef as useRef48,
21716
21841
  useState as useState54
21717
21842
  } from "react";
21718
21843
  import { jsx as jsx94, jsxs as jsxs68 } from "react/jsx-runtime";
@@ -21843,9 +21968,9 @@ var MaskedInput = forwardRef59(function MaskedInput2({
21843
21968
  const [partClasses, scopeParts] = usePartClasses("masked-input", classNames, true);
21844
21969
  const generatedId = useId43();
21845
21970
  const inputId = id ?? `pimolu-masked-input-${generatedId}`;
21846
- const inputRef = useRef47(null);
21971
+ const inputRef = useRef48(null);
21847
21972
  const tokens = parseMask(mask);
21848
- const format = useCallback23(
21973
+ const format = useCallback24(
21849
21974
  (raw) => formatSlots(collectSlots(raw, tokens), tokens),
21850
21975
  // The mask string is the only meaningful input here.
21851
21976
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -21856,11 +21981,11 @@ var MaskedInput = forwardRef59(function MaskedInput2({
21856
21981
  () => format(String(defaultValue ?? ""))
21857
21982
  );
21858
21983
  const displayValue = isControlled ? format(String(value ?? "")) : localValue;
21859
- const pendingCaret = useRef47(null);
21984
+ const pendingCaret = useRef48(null);
21860
21985
  useFormReset(inputRef, !isControlled, () => {
21861
21986
  setLocalValue(format(String(defaultValue ?? "")));
21862
21987
  });
21863
- const setInputRef = useCallback23(
21988
+ const setInputRef = useCallback24(
21864
21989
  (node) => {
21865
21990
  inputRef.current = node;
21866
21991
  if (typeof forwardedRef === "function") {
@@ -21871,7 +21996,7 @@ var MaskedInput = forwardRef59(function MaskedInput2({
21871
21996
  },
21872
21997
  [forwardedRef]
21873
21998
  );
21874
- useLayoutEffect4(() => {
21999
+ useLayoutEffect5(() => {
21875
22000
  const pending = pendingCaret.current;
21876
22001
  if (pending === null) return;
21877
22002
  pendingCaret.current = null;
@@ -21979,11 +22104,11 @@ MaskedInput.displayName = "PimoluMaskedInput";
21979
22104
  // currency-input/currency-input.tsx
21980
22105
  import {
21981
22106
  forwardRef as forwardRef60,
21982
- useCallback as useCallback24,
22107
+ useCallback as useCallback25,
21983
22108
  useEffect as useEffect41,
21984
22109
  useId as useId44,
21985
22110
  useMemo as useMemo17,
21986
- useRef as useRef48,
22111
+ useRef as useRef49,
21987
22112
  useState as useState55
21988
22113
  } from "react";
21989
22114
  import { jsx as jsx95, jsxs as jsxs69 } from "react/jsx-runtime";
@@ -22109,7 +22234,7 @@ var CurrencyInput = forwardRef60(function CurrencyInput2({
22109
22234
  const [partClasses, scopeParts] = usePartClasses("currency-input", classNames, true);
22110
22235
  const generatedId = useId44();
22111
22236
  const inputId = id ?? `pimolu-currency-input-${generatedId}`;
22112
- const inputRef = useRef48(null);
22237
+ const inputRef = useRef49(null);
22113
22238
  const isControlled = value !== void 0;
22114
22239
  const resolvedDecimals = resolveDecimals(
22115
22240
  locale,
@@ -22163,7 +22288,7 @@ var CurrencyInput = forwardRef60(function CurrencyInput2({
22163
22288
  setInternalValue(initial);
22164
22289
  setDraft(formatCurrency(initial));
22165
22290
  });
22166
- const setInputRef = useCallback24(
22291
+ const setInputRef = useCallback25(
22167
22292
  (node) => {
22168
22293
  inputRef.current = node;
22169
22294
  if (typeof forwardedRef === "function") {
@@ -22296,11 +22421,11 @@ CurrencyInput.displayName = "PimoluCurrencyInput";
22296
22421
  // phone-input/phone-input.tsx
22297
22422
  import {
22298
22423
  forwardRef as forwardRef61,
22299
- useCallback as useCallback25,
22424
+ useCallback as useCallback26,
22300
22425
  useEffect as useEffect42,
22301
22426
  useId as useId45,
22302
- useLayoutEffect as useLayoutEffect5,
22303
- useRef as useRef49,
22427
+ useLayoutEffect as useLayoutEffect6,
22428
+ useRef as useRef50,
22304
22429
  useState as useState56
22305
22430
  } from "react";
22306
22431
  import { jsx as jsx96, jsxs as jsxs70 } from "react/jsx-runtime";
@@ -22550,7 +22675,7 @@ var PhoneInput = forwardRef61(function PhoneInput2({
22550
22675
  const [partClasses, scopeParts] = usePartClasses("phone-input", classNames, true);
22551
22676
  const generatedId = useId45();
22552
22677
  const inputId = id ?? `pimolu-phone-input-${generatedId}`;
22553
- const inputRef = useRef49(null);
22678
+ const inputRef = useRef50(null);
22554
22679
  const countryList = countries && countries.length > 0 ? countries : defaultPhoneCountries;
22555
22680
  const isControlled = value !== void 0;
22556
22681
  const [internalValue, setInternalValue] = useState56(
@@ -22584,7 +22709,7 @@ var PhoneInput = forwardRef61(function PhoneInput2({
22584
22709
  nationalDigits,
22585
22710
  activeCountry.pattern
22586
22711
  );
22587
- const pendingCaret = useRef49(null);
22712
+ const pendingCaret = useRef50(null);
22588
22713
  useEffect42(() => {
22589
22714
  if (country !== void 0 || !parsed.international) return;
22590
22715
  if (parsed.country.code !== internalCountry) {
@@ -22600,7 +22725,7 @@ var PhoneInput = forwardRef61(function PhoneInput2({
22600
22725
  setInternalValue(String(defaultValue ?? ""));
22601
22726
  setInternalCountry(initialCountry.code);
22602
22727
  });
22603
- const setInputRef = useCallback25(
22728
+ const setInputRef = useCallback26(
22604
22729
  (node) => {
22605
22730
  inputRef.current = node;
22606
22731
  if (typeof forwardedRef === "function") {
@@ -22611,7 +22736,7 @@ var PhoneInput = forwardRef61(function PhoneInput2({
22611
22736
  },
22612
22737
  [forwardedRef]
22613
22738
  );
22614
- useLayoutEffect5(() => {
22739
+ useLayoutEffect6(() => {
22615
22740
  const pending = pendingCaret.current;
22616
22741
  if (pending === null) return;
22617
22742
  pendingCaret.current = null;
@@ -22773,11 +22898,11 @@ PhoneInput.displayName = "PimoluPhoneInput";
22773
22898
  // mentions/mentions.tsx
22774
22899
  import {
22775
22900
  forwardRef as forwardRef62,
22776
- useCallback as useCallback26,
22901
+ useCallback as useCallback27,
22777
22902
  useEffect as useEffect43,
22778
22903
  useId as useId46,
22779
22904
  useMemo as useMemo18,
22780
- useRef as useRef50,
22905
+ useRef as useRef51,
22781
22906
  useState as useState57
22782
22907
  } from "react";
22783
22908
  import { jsx as jsx97, jsxs as jsxs71 } from "react/jsx-runtime";
@@ -22830,10 +22955,10 @@ var Mentions = forwardRef62(function Mentions2({
22830
22955
  const inputId = id ?? `pimolu-mentions-${generatedId}`;
22831
22956
  const listboxId = `${inputId}-listbox`;
22832
22957
  const helperId = `${inputId}-helper`;
22833
- const rootRef = useRef50(null);
22834
- const textareaRef = useRef50(null);
22835
- const listboxRef = useRef50(null);
22836
- const assignRef = useCallback26(
22958
+ const rootRef = useRef51(null);
22959
+ const textareaRef = useRef51(null);
22960
+ const listboxRef = useRef51(null);
22961
+ const assignRef = useCallback27(
22837
22962
  (node) => {
22838
22963
  textareaRef.current = node;
22839
22964
  if (typeof forwardedRef === "function") {
@@ -22905,7 +23030,7 @@ var Mentions = forwardRef62(function Mentions2({
22905
23030
  );
22906
23031
  const activeSuggestion = suggestions[safeActiveIndex];
22907
23032
  const activeDescendant = suggestionsOpen && activeSuggestion ? `${listboxId}-option-${safeActiveIndex}` : void 0;
22908
- const commit = useCallback26(
23033
+ const commit = useCallback27(
22909
23034
  (nextText) => {
22910
23035
  if (!isControlled) {
22911
23036
  setInternalValue(nextText);
@@ -22914,7 +23039,7 @@ var Mentions = forwardRef62(function Mentions2({
22914
23039
  },
22915
23040
  [isControlled, onValueChange]
22916
23041
  );
22917
- const closeMenu = useCallback26(() => {
23042
+ const closeMenu = useCallback27(() => {
22918
23043
  setIsOpen(false);
22919
23044
  setContext(null);
22920
23045
  setActiveIndex(0);
@@ -23006,7 +23131,7 @@ var Mentions = forwardRef62(function Mentions2({
23006
23131
  setIsOpen(false);
23007
23132
  }
23008
23133
  }
23009
- const { style: popupStyle } = useAnchoredPosition(
23134
+ const { style: popupStyle, onMount } = useAnchoredPosition(
23010
23135
  rootRef,
23011
23136
  listboxRef,
23012
23137
  suggestionsOpen,
@@ -23121,7 +23246,7 @@ var Mentions = forwardRef62(function Mentions2({
23121
23246
  onKeyDown: handleKeyDown
23122
23247
  }
23123
23248
  ),
23124
- suggestionsOpen && /* @__PURE__ */ jsx97(Portal, { anchorRef: rootRef, children: /* @__PURE__ */ jsx97(
23249
+ suggestionsOpen && /* @__PURE__ */ jsx97(Portal, { anchorRef: rootRef, onMount, children: /* @__PURE__ */ jsx97(
23125
23250
  "ul",
23126
23251
  {
23127
23252
  ref: listboxRef,
@@ -23215,10 +23340,10 @@ Mentions.displayName = "PimoluMentions";
23215
23340
  // cascader/cascader.tsx
23216
23341
  import {
23217
23342
  forwardRef as forwardRef63,
23218
- useCallback as useCallback27,
23343
+ useCallback as useCallback28,
23219
23344
  useEffect as useEffect44,
23220
23345
  useId as useId47,
23221
- useRef as useRef51,
23346
+ useRef as useRef52,
23222
23347
  useState as useState58
23223
23348
  } from "react";
23224
23349
  import { jsx as jsx98, jsxs as jsxs72 } from "react/jsx-runtime";
@@ -23313,11 +23438,11 @@ var Cascader = forwardRef63(function Cascader2({
23313
23438
  const labelId = `${triggerId}-label`;
23314
23439
  const listboxId = `${triggerId}-listbox`;
23315
23440
  const messageId = helperText ? `${triggerId}-message` : void 0;
23316
- const rootRef = useRef51(null);
23317
- const fieldRef = useRef51(null);
23318
- const triggerRef = useRef51(null);
23319
- const listboxRef = useRef51(null);
23320
- const assignRef = useCallback27(
23441
+ const rootRef = useRef52(null);
23442
+ const fieldRef = useRef52(null);
23443
+ const triggerRef = useRef52(null);
23444
+ const listboxRef = useRef52(null);
23445
+ const assignRef = useCallback28(
23321
23446
  (node) => {
23322
23447
  triggerRef.current = node;
23323
23448
  if (typeof forwardedRef === "function") {
@@ -23482,7 +23607,7 @@ var Cascader = forwardRef63(function Cascader2({
23482
23607
  selectOption(activeOption);
23483
23608
  }
23484
23609
  }
23485
- const { style: popupStyle } = useAnchoredPosition(
23610
+ const { style: popupStyle, onMount } = useAnchoredPosition(
23486
23611
  fieldRef,
23487
23612
  listboxRef,
23488
23613
  isOpen && !disabled,
@@ -23605,7 +23730,7 @@ var Cascader = forwardRef63(function Cascader2({
23605
23730
  )
23606
23731
  }
23607
23732
  ),
23608
- isOpen && !disabled && /* @__PURE__ */ jsx98(Portal, { anchorRef: fieldRef, children: /* @__PURE__ */ jsx98(
23733
+ isOpen && !disabled && /* @__PURE__ */ jsx98(Portal, { anchorRef: fieldRef, onMount, children: /* @__PURE__ */ jsx98(
23609
23734
  "div",
23610
23735
  {
23611
23736
  ref: listboxRef,
@@ -24121,9 +24246,9 @@ Transfer.displayName = "PimoluTransfer";
24121
24246
  // video-player/video-player.tsx
24122
24247
  import {
24123
24248
  forwardRef as forwardRef64,
24124
- useCallback as useCallback28,
24249
+ useCallback as useCallback29,
24125
24250
  useEffect as useEffect45,
24126
- useRef as useRef52,
24251
+ useRef as useRef53,
24127
24252
  useState as useState60
24128
24253
  } from "react";
24129
24254
  import { Fragment as Fragment17, jsx as jsx100, jsxs as jsxs74 } from "react/jsx-runtime";
@@ -24241,10 +24366,10 @@ var VideoPlayer = forwardRef64(function VideoPlayer2({
24241
24366
  ...props
24242
24367
  }, forwardedRef) {
24243
24368
  const [partClasses, scopeParts] = usePartClasses("video-player", classNames, true);
24244
- const mediaRef = useRef52(
24369
+ const mediaRef = useRef53(
24245
24370
  null
24246
24371
  );
24247
- const rootRef = useRef52(null);
24372
+ const rootRef = useRef53(null);
24248
24373
  const controlled = controlledPlaying !== void 0;
24249
24374
  const [internalPlaying, setInternalPlaying] = useState60(false);
24250
24375
  const isPlaying = controlled ? controlledPlaying : internalPlaying;
@@ -24260,10 +24385,10 @@ var VideoPlayer = forwardRef64(function VideoPlayer2({
24260
24385
  const [muted, setMuted] = useState60(initialMuted);
24261
24386
  const [canFullscreen, setCanFullscreen] = useState60(false);
24262
24387
  const [fullscreen, setFullscreen] = useState60(false);
24263
- const announcedPlaying = useRef52(
24388
+ const announcedPlaying = useRef53(
24264
24389
  controlledPlaying ?? false
24265
24390
  );
24266
- const commitPlaying = useCallback28(
24391
+ const commitPlaying = useCallback29(
24267
24392
  (next) => {
24268
24393
  if (announcedPlaying.current === next) {
24269
24394
  return;
@@ -24276,7 +24401,7 @@ var VideoPlayer = forwardRef64(function VideoPlayer2({
24276
24401
  },
24277
24402
  [controlled, onPlayingChange]
24278
24403
  );
24279
- const setRootRef = useCallback28(
24404
+ const setRootRef = useCallback29(
24280
24405
  (node) => {
24281
24406
  rootRef.current = node;
24282
24407
  if (typeof forwardedRef === "function") {
@@ -24635,9 +24760,9 @@ VideoPlayer.displayName = "PimoluVideoPlayer";
24635
24760
  // audio-player/audio-player.tsx
24636
24761
  import {
24637
24762
  forwardRef as forwardRef65,
24638
- useCallback as useCallback29,
24763
+ useCallback as useCallback30,
24639
24764
  useEffect as useEffect46,
24640
- useRef as useRef53,
24765
+ useRef as useRef54,
24641
24766
  useState as useState61
24642
24767
  } from "react";
24643
24768
  import { Fragment as Fragment18, jsx as jsx101, jsxs as jsxs75 } from "react/jsx-runtime";
@@ -24737,7 +24862,7 @@ var AudioPlayer = forwardRef65(function AudioPlayer2({
24737
24862
  ...props
24738
24863
  }, forwardedRef) {
24739
24864
  const [partClasses, scopeParts] = usePartClasses("audio-player", classNames, true);
24740
- const mediaRef = useRef53(
24865
+ const mediaRef = useRef54(
24741
24866
  null
24742
24867
  );
24743
24868
  const controlled = controlledPlaying !== void 0;
@@ -24753,10 +24878,10 @@ var AudioPlayer = forwardRef65(function AudioPlayer2({
24753
24878
  )
24754
24879
  );
24755
24880
  const [muted, setMuted] = useState61(initialMuted);
24756
- const announcedPlaying = useRef53(
24881
+ const announcedPlaying = useRef54(
24757
24882
  controlledPlaying ?? false
24758
24883
  );
24759
- const commitPlaying = useCallback29(
24884
+ const commitPlaying = useCallback30(
24760
24885
  (next) => {
24761
24886
  if (announcedPlaying.current === next) {
24762
24887
  return;
@@ -24769,7 +24894,7 @@ var AudioPlayer = forwardRef65(function AudioPlayer2({
24769
24894
  },
24770
24895
  [controlled, onPlayingChange]
24771
24896
  );
24772
- const setRootRef = useCallback29(
24897
+ const setRootRef = useCallback30(
24773
24898
  (node) => {
24774
24899
  if (typeof forwardedRef === "function") {
24775
24900
  forwardedRef(node);
@@ -25059,7 +25184,7 @@ AudioPlayer.displayName = "PimoluAudioPlayer";
25059
25184
 
25060
25185
  // pdf-viewer/pdf-viewer.tsx
25061
25186
  import {
25062
- useRef as useRef54
25187
+ useRef as useRef55
25063
25188
  } from "react";
25064
25189
  import { jsx as jsx102, jsxs as jsxs76 } from "react/jsx-runtime";
25065
25190
  function classes25(...values) {
@@ -25090,7 +25215,7 @@ function PDFViewer({
25090
25215
  "aria-label": ariaLabel
25091
25216
  }) {
25092
25217
  const [partClasses, scopeParts] = usePartClasses("pdf-viewer", classNames, true);
25093
- const toolbarRef = useRef54(
25218
+ const toolbarRef = useRef55(
25094
25219
  null
25095
25220
  );
25096
25221
  const resolvedLabels = {
@@ -25219,10 +25344,10 @@ PDFViewer.displayName = "PimoluPDFViewer";
25219
25344
 
25220
25345
  // lightbox/lightbox.tsx
25221
25346
  import {
25222
- useCallback as useCallback30,
25347
+ useCallback as useCallback31,
25223
25348
  useEffect as useEffect47,
25224
25349
  useId as useId49,
25225
- useRef as useRef55,
25350
+ useRef as useRef56,
25226
25351
  useState as useState62
25227
25352
  } from "react";
25228
25353
  import { Fragment as Fragment19, jsx as jsx103, jsxs as jsxs77 } from "react/jsx-runtime";
@@ -25308,26 +25433,26 @@ function Lightbox({
25308
25433
  count
25309
25434
  );
25310
25435
  const active = isOpen && count > 0;
25311
- const anchorRef = useRef55(
25436
+ const anchorRef = useRef56(
25312
25437
  null
25313
25438
  );
25314
- const panelRef = useRef55(
25439
+ const panelRef = useRef56(
25315
25440
  null
25316
25441
  );
25317
- const closeRef = useRef55(
25442
+ const closeRef = useRef56(
25318
25443
  null
25319
25444
  );
25320
- const previousFocus = useRef55(
25445
+ const previousFocus = useRef56(
25321
25446
  null
25322
25447
  );
25323
25448
  const captionId = `pimolu-lightbox-caption-${useId49()}`;
25324
- const setPanelRef = useCallback30(
25449
+ const setPanelRef = useCallback31(
25325
25450
  (node) => {
25326
25451
  panelRef.current = node;
25327
25452
  },
25328
25453
  []
25329
25454
  );
25330
- const setCloseRef = useCallback30(
25455
+ const setCloseRef = useCallback31(
25331
25456
  (node) => {
25332
25457
  closeRef.current = node;
25333
25458
  if (node) {
@@ -25589,10 +25714,10 @@ Lightbox.displayName = "PimoluLightbox";
25589
25714
 
25590
25715
  // image-cropper/image-cropper.tsx
25591
25716
  import {
25592
- useCallback as useCallback31,
25717
+ useCallback as useCallback32,
25593
25718
  useEffect as useEffect48,
25594
25719
  useId as useId50,
25595
- useRef as useRef56,
25720
+ useRef as useRef57,
25596
25721
  useState as useState63
25597
25722
  } from "react";
25598
25723
  import { jsx as jsx104, jsxs as jsxs78 } from "react/jsx-runtime";
@@ -25891,13 +26016,13 @@ function ImageCropper({
25891
26016
  );
25892
26017
  const [zoom, setZoom] = useState63(safeDefaultZoom);
25893
26018
  const [dragging, setDragging] = useState63(false);
25894
- const stageRef = useRef56(
26019
+ const stageRef = useRef57(
25895
26020
  null
25896
26021
  );
25897
- const imageRef = useRef56(
26022
+ const imageRef = useRef57(
25898
26023
  null
25899
26024
  );
25900
- const dragRef = useRef56(null);
26025
+ const dragRef = useRef57(null);
25901
26026
  useEffect48(() => {
25902
26027
  setIntrinsic(null);
25903
26028
  if (typeof src === "string") {
@@ -25914,7 +26039,7 @@ function ImageCropper({
25914
26039
  URL.revokeObjectURL(url);
25915
26040
  };
25916
26041
  }, [src]);
25917
- const commitCrop = useCallback31(
26042
+ const commitCrop = useCallback32(
25918
26043
  (next) => {
25919
26044
  const normalized = normalizeCrop(
25920
26045
  next,
@@ -27204,7 +27329,7 @@ import {
27204
27329
  useContext as useContext18,
27205
27330
  useEffect as useEffect49,
27206
27331
  useId as useId51,
27207
- useRef as useRef57,
27332
+ useRef as useRef58,
27208
27333
  useState as useState64
27209
27334
  } from "react";
27210
27335
  import { jsx as jsx107 } from "react/jsx-runtime";
@@ -27243,7 +27368,7 @@ function Menubar({
27243
27368
  const [openValue, setOpenValue] = useState64(
27244
27369
  null
27245
27370
  );
27246
- const menubarRef = useRef57(null);
27371
+ const menubarRef = useRef58(null);
27247
27372
  function getTriggers() {
27248
27373
  return Array.from(
27249
27374
  menubarRef.current?.querySelectorAll(
@@ -27368,7 +27493,7 @@ function MenubarMenu({
27368
27493
  const value = valueProp ?? `menu-${generated}`;
27369
27494
  const triggerId = `pimolu-menubar-trigger-${generated}`;
27370
27495
  const contentId = `pimolu-menubar-content-${generated}`;
27371
- const triggerRef = useRef57(
27496
+ const triggerRef = useRef58(
27372
27497
  null
27373
27498
  );
27374
27499
  return scopeParts(/* @__PURE__ */ jsx107(
@@ -27458,12 +27583,12 @@ function MenubarSurface({
27458
27583
  );
27459
27584
  useEffect49(() => {
27460
27585
  const panel = contentRef.current;
27461
- if (!panel) return;
27586
+ if (!panel || style?.visibility !== "visible") return;
27462
27587
  const first = panel.querySelector(
27463
27588
  '[role="menuitem"]:not([aria-disabled="true"]):not(:disabled)'
27464
27589
  );
27465
27590
  (first ?? panel).focus({ preventScroll: true });
27466
- }, [contentRef]);
27591
+ }, [contentRef, style?.visibility]);
27467
27592
  function handleKeyDown(event) {
27468
27593
  if (event.key === "Tab") {
27469
27594
  menubar.setOpenValue(null);
@@ -27524,7 +27649,7 @@ function MenubarContent({
27524
27649
  const menubar = useMenubar("MenubarContent");
27525
27650
  const menu = useMenubarMenu("MenubarContent");
27526
27651
  const open = menubar.openValue === menu.value;
27527
- const contentRef = useRef57(null);
27652
+ const contentRef = useRef58(null);
27528
27653
  useOutsidePointer(
27529
27654
  [menu.triggerRef, contentRef],
27530
27655
  open,
@@ -27625,7 +27750,7 @@ import {
27625
27750
  createContext as createContext19,
27626
27751
  useContext as useContext19,
27627
27752
  useEffect as useEffect50,
27628
- useRef as useRef58,
27753
+ useRef as useRef59,
27629
27754
  useState as useState65
27630
27755
  } from "react";
27631
27756
  import { jsx as jsx108 } from "react/jsx-runtime";
@@ -27670,7 +27795,7 @@ function Toolbar({
27670
27795
  ...props
27671
27796
  }) {
27672
27797
  const [partClasses, scopeParts] = usePartClasses("toolbar", classNames, true);
27673
- const rootRef = useRef58(null);
27798
+ const rootRef = useRef59(null);
27674
27799
  useEffect50(() => {
27675
27800
  const items = getEnabledItems2(rootRef.current);
27676
27801
  if (items.length === 0) return;
@@ -27955,7 +28080,7 @@ import {
27955
28080
  cloneElement as cloneElement10,
27956
28081
  isValidElement as isValidElement13,
27957
28082
  useId as useId52,
27958
- useRef as useRef59,
28083
+ useRef as useRef60,
27959
28084
  useState as useState66
27960
28085
  } from "react";
27961
28086
  import { jsx as jsx109, jsxs as jsxs81 } from "react/jsx-runtime";
@@ -28013,8 +28138,8 @@ function Popconfirm({
28013
28138
  const isControlled = controlledOpen !== void 0;
28014
28139
  const [uncontrolledOpen, setUncontrolledOpen] = useState66(defaultOpen);
28015
28140
  const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
28016
- const triggerRef = useRef59(null);
28017
- const resolved = useRef59(false);
28141
+ const triggerRef = useRef60(null);
28142
+ const resolved = useRef60(false);
28018
28143
  const titleId = `pimolu-popconfirm-title-${useId52()}`;
28019
28144
  function requestOpen(next) {
28020
28145
  if (next) {
@@ -28122,11 +28247,11 @@ Popconfirm.displayName = "PimoluPopconfirm";
28122
28247
 
28123
28248
  // tour/tour.tsx
28124
28249
  import {
28125
- useCallback as useCallback32,
28250
+ useCallback as useCallback33,
28126
28251
  useEffect as useEffect51,
28127
28252
  useId as useId53,
28128
- useLayoutEffect as useLayoutEffect6,
28129
- useRef as useRef60,
28253
+ useLayoutEffect as useLayoutEffect7,
28254
+ useRef as useRef61,
28130
28255
  useState as useState67
28131
28256
  } from "react";
28132
28257
  import { Fragment as Fragment20, jsx as jsx110, jsxs as jsxs82 } from "react/jsx-runtime";
@@ -28135,7 +28260,7 @@ var CARD_HEIGHT = 190;
28135
28260
  var GAP = 12;
28136
28261
  var VIEWPORT_MARGIN = 12;
28137
28262
  var SPOTLIGHT_PADDING = 8;
28138
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect6 : useEffect51;
28263
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect7 : useEffect51;
28139
28264
  function clamp11(value, min, max) {
28140
28265
  return Math.min(Math.max(value, min), max);
28141
28266
  }
@@ -28298,16 +28423,16 @@ function Tour({
28298
28423
  const currentStep = steps[index];
28299
28424
  const targetSpec = currentStep?.target;
28300
28425
  const [target, setTarget] = useState67(null);
28301
- const cardRef = useRef60(null);
28426
+ const cardRef = useRef61(null);
28302
28427
  const [cardMounted, setCardMounted] = useState67(false);
28303
- const setCardRef = useCallback32(
28428
+ const setCardRef = useCallback33(
28304
28429
  (node) => {
28305
28430
  cardRef.current = node;
28306
28431
  setCardMounted(node !== null);
28307
28432
  },
28308
28433
  []
28309
28434
  );
28310
- const scopeRef = useRef60(null);
28435
+ const scopeRef = useRef61(null);
28311
28436
  const titleId = `pimolu-tour-title-${useId53()}`;
28312
28437
  const descriptionId = `pimolu-tour-description-${useId53()}`;
28313
28438
  const [geometry, setGeometry] = useState67(
@@ -28318,7 +28443,7 @@ function Tour({
28318
28443
  CARD_HEIGHT
28319
28444
  )
28320
28445
  );
28321
- const wasOpen = useRef60(isOpen);
28446
+ const wasOpen = useRef61(isOpen);
28322
28447
  function requestOpen(next2) {
28323
28448
  if (!isControlled) {
28324
28449
  setUncontrolledOpen(next2);
@@ -28352,7 +28477,7 @@ function Tour({
28352
28477
  }
28353
28478
  }
28354
28479
  }, [isOpen, index, targetSpec]);
28355
- const updateGeometry = useCallback32(() => {
28480
+ const updateGeometry = useCallback33(() => {
28356
28481
  if (typeof window === "undefined") return;
28357
28482
  const viewportWidth = window.innerWidth || 1024;
28358
28483
  const viewportHeight = window.innerHeight || 768;
@@ -28426,7 +28551,7 @@ function Tour({
28426
28551
  containerRef: cardRef,
28427
28552
  initialFocus: "container"
28428
28553
  });
28429
- const previousIndex = useRef60(index);
28554
+ const previousIndex = useRef61(index);
28430
28555
  useEffect51(() => {
28431
28556
  if (!isOpen) {
28432
28557
  previousIndex.current = index;
@@ -28902,7 +29027,7 @@ import {
28902
29027
  Fragment as Fragment22,
28903
29028
  useEffect as useEffect52,
28904
29029
  useId as useId55,
28905
- useRef as useRef61,
29030
+ useRef as useRef62,
28906
29031
  useState as useState69
28907
29032
  } from "react";
28908
29033
  import { jsx as jsx112, jsxs as jsxs84 } from "react/jsx-runtime";
@@ -29090,10 +29215,10 @@ function KanbanCardView({
29090
29215
  }) {
29091
29216
  const [partClasses, scopeParts] = usePartClasses("kanban", classNames, false);
29092
29217
  const [menuOpen, setMenuOpen] = useState69(false);
29093
- const moveRootRef = useRef61(null);
29094
- const moveTriggerRef = useRef61(null);
29095
- const menuRef = useRef61(null);
29096
- const focusFirstItemRef = useRef61(false);
29218
+ const moveRootRef = useRef62(null);
29219
+ const moveTriggerRef = useRef62(null);
29220
+ const menuRef = useRef62(null);
29221
+ const focusFirstItemRef = useRef62(false);
29097
29222
  useEffect52(() => {
29098
29223
  if (!menuOpen) {
29099
29224
  return;
@@ -29373,7 +29498,7 @@ function Kanban({
29373
29498
  const boardColumns = controlledColumns ?? internalColumns;
29374
29499
  const baseId = `pimolu-kanban-${useId55()}`;
29375
29500
  const instructionsId = `${baseId}-instructions`;
29376
- const rootRef = useRef61(null);
29501
+ const rootRef = useRef62(null);
29377
29502
  const [dragState, setDragState] = useState69(null);
29378
29503
  const [dropTarget, setDropTarget] = useState69(null);
29379
29504
  const [announcement, setAnnouncement] = useState69("");
@@ -29722,7 +29847,7 @@ function Kanban({
29722
29847
  import {
29723
29848
  useEffect as useEffect53,
29724
29849
  useId as useId56,
29725
- useRef as useRef62,
29850
+ useRef as useRef63,
29726
29851
  useState as useState70
29727
29852
  } from "react";
29728
29853
  import { Fragment as Fragment23, jsx as jsx113, jsxs as jsxs85 } from "react/jsx-runtime";
@@ -30024,7 +30149,7 @@ function Chat({
30024
30149
  ...labelOverrides
30025
30150
  };
30026
30151
  const [draft, setDraft] = useState70("");
30027
- const listRef = useRef62(null);
30152
+ const listRef = useRef63(null);
30028
30153
  const inputId = `pimolu-chat-${useId56()}`;
30029
30154
  const lastMessageId = messages.length > 0 ? messages[messages.length - 1]?.id : void 0;
30030
30155
  useEffect53(() => {
@@ -30230,7 +30355,7 @@ function Chat({
30230
30355
  import {
30231
30356
  useEffect as useEffect54,
30232
30357
  useMemo as useMemo21,
30233
- useRef as useRef63,
30358
+ useRef as useRef64,
30234
30359
  useId as useId57,
30235
30360
  useState as useState71
30236
30361
  } from "react";
@@ -30389,7 +30514,7 @@ function Scheduler({
30389
30514
  ),
30390
30515
  [hourCount, minHour]
30391
30516
  );
30392
- const gridRef = useRef63(null);
30517
+ const gridRef = useRef64(null);
30393
30518
  const keyboardHintId = `scheduler-keys-${useId57()}`;
30394
30519
  const [activeCell, setActiveCell] = useState71({ row: 1, column: 0 });
30395
30520
  const [editingCell, setEditingCell] = useState71(null);
@@ -31892,7 +32017,7 @@ function Gantt({
31892
32017
  import {
31893
32018
  Fragment as Fragment24,
31894
32019
  useMemo as useMemo23,
31895
- useRef as useRef64,
32020
+ useRef as useRef65,
31896
32021
  useState as useState73
31897
32022
  } from "react";
31898
32023
  import { Fragment as Fragment25, jsx as jsx116, jsxs as jsxs88 } from "react/jsx-runtime";
@@ -32164,7 +32289,7 @@ function FileManager({
32164
32289
  const resolvedSort = sort ?? internalSort;
32165
32290
  const [anchorId, setAnchorId] = useState73(null);
32166
32291
  const [focusedId, setFocusedId] = useState73(null);
32167
- const itemsRef = useRef64(null);
32292
+ const itemsRef = useRef65(null);
32168
32293
  const currentPath = useMemo23(() => {
32169
32294
  const result = [];
32170
32295
  (path ?? internalPath).forEach((id) => {
@@ -33035,7 +33160,7 @@ TableOfContents.displayName = "PimoluTableOfContents";
33035
33160
  // anchor/anchor.tsx
33036
33161
  import {
33037
33162
  useEffect as useEffect55,
33038
- useRef as useRef65,
33163
+ useRef as useRef66,
33039
33164
  useState as useState74
33040
33165
  } from "react";
33041
33166
  import { jsx as jsx121, jsxs as jsxs93 } from "react/jsx-runtime";
@@ -33062,7 +33187,7 @@ function Anchor({
33062
33187
  }) {
33063
33188
  const [partClasses, scopeParts] = usePartClasses("anchor", classNames, true);
33064
33189
  const [copied, setCopied] = useState74(false);
33065
- const feedbackTimer = useRef65(void 0);
33190
+ const feedbackTimer = useRef66(void 0);
33066
33191
  useEffect55(
33067
33192
  () => () => {
33068
33193
  if (feedbackTimer.current !== void 0) {
@@ -34053,7 +34178,7 @@ CodeBlock.displayName = "PimoluCodeBlock";
34053
34178
  // search-input/search-input.tsx
34054
34179
  import {
34055
34180
  forwardRef as forwardRef69,
34056
- useRef as useRef66,
34181
+ useRef as useRef67,
34057
34182
  useState as useState76
34058
34183
  } from "react";
34059
34184
 
@@ -34108,7 +34233,7 @@ var SearchInput = forwardRef69(function SearchInput2({
34108
34233
  id
34109
34234
  }, forwardedRef) {
34110
34235
  const [partClasses, scopeParts] = usePartClasses("search-input", classNames, true);
34111
- const inputRef = useRef66(null);
34236
+ const inputRef = useRef67(null);
34112
34237
  const isControlled = value !== void 0;
34113
34238
  const [internalValue, setInternalValue] = useState76(
34114
34239
  () => defaultValue ?? ""
@@ -34195,7 +34320,7 @@ import {
34195
34320
  forwardRef as forwardRef70,
34196
34321
  useEffect as useEffect57,
34197
34322
  useId as useId62,
34198
- useRef as useRef67,
34323
+ useRef as useRef68,
34199
34324
  useState as useState77
34200
34325
  } from "react";
34201
34326
 
@@ -34331,7 +34456,7 @@ var ThemeBuilder = forwardRef70(function ThemeBuilder2({
34331
34456
  density,
34332
34457
  "comfortable"
34333
34458
  );
34334
- const presetRefs = useRef67([]);
34459
+ const presetRefs = useRef68([]);
34335
34460
  const presetId = presetState.value;
34336
34461
  const currentTheme = themeState.value;
34337
34462
  const currentBrand = brandState.value;
@@ -34787,15 +34912,15 @@ SplitButton.displayName = "PimoluSplitButton";
34787
34912
  // password-input/password-input.tsx
34788
34913
  import {
34789
34914
  forwardRef as forwardRef73,
34790
- useCallback as useCallback33,
34915
+ useCallback as useCallback34,
34791
34916
  useEffect as useEffect58,
34792
34917
  useId as useId63,
34793
- useLayoutEffect as useLayoutEffect7,
34794
- useRef as useRef68,
34918
+ useLayoutEffect as useLayoutEffect8,
34919
+ useRef as useRef69,
34795
34920
  useState as useState78
34796
34921
  } from "react";
34797
34922
  import { Fragment as Fragment28, jsx as jsx129, jsxs as jsxs99 } from "react/jsx-runtime";
34798
- var useIsomorphicLayoutEffect2 = typeof window !== "undefined" ? useLayoutEffect7 : useEffect58;
34923
+ var useIsomorphicLayoutEffect2 = typeof window !== "undefined" ? useLayoutEffect8 : useEffect58;
34799
34924
  function VisibilityIcon({
34800
34925
  visible
34801
34926
  }) {
@@ -34851,13 +34976,13 @@ var PasswordInput = forwardRef73(function PasswordInput2({
34851
34976
  const [partClasses, scopeParts] = usePartClasses("password-input", classNames, true);
34852
34977
  const generatedId = useId63();
34853
34978
  const inputId = id ?? `pimolu-password-input-${generatedId}`;
34854
- const inputRef = useRef68(null);
34855
- const selectionRef = useRef68(
34979
+ const inputRef = useRef69(null);
34980
+ const selectionRef = useRef69(
34856
34981
  null
34857
34982
  );
34858
34983
  const isControlled = value !== void 0;
34859
34984
  const [visible, setVisible] = useState78(false);
34860
- const setInputRef = useCallback33(
34985
+ const setInputRef = useCallback34(
34861
34986
  (node) => {
34862
34987
  inputRef.current = node;
34863
34988
  if (typeof forwardedRef === "function") {
@@ -35131,10 +35256,10 @@ InputGroupButton.displayName = "PimoluInputGroupButton";
35131
35256
  // tree-select/tree-select.tsx
35132
35257
  import {
35133
35258
  forwardRef as forwardRef75,
35134
- useCallback as useCallback34,
35259
+ useCallback as useCallback35,
35135
35260
  useEffect as useEffect59,
35136
35261
  useId as useId64,
35137
- useRef as useRef69,
35262
+ useRef as useRef70,
35138
35263
  useState as useState79
35139
35264
  } from "react";
35140
35265
  import { jsx as jsx131, jsxs as jsxs100 } from "react/jsx-runtime";
@@ -35234,15 +35359,16 @@ var TreeSelect = forwardRef75(function TreeSelect2({
35234
35359
  const treeId = `${triggerId}-tree`;
35235
35360
  const searchId = `${triggerId}-search`;
35236
35361
  const errorId = error ? `${triggerId}-error` : void 0;
35237
- const rootRef = useRef69(null);
35238
- const fieldRef = useRef69(null);
35239
- const triggerRef = useRef69(null);
35240
- const panelRef = useRef69(null);
35241
- const typeaheadRef = useRef69({
35362
+ const rootRef = useRef70(null);
35363
+ const fieldRef = useRef70(null);
35364
+ const triggerRef = useRef70(null);
35365
+ const panelRef = useRef70(null);
35366
+ const searchRef = useRef70(null);
35367
+ const typeaheadRef = useRef70({
35242
35368
  text: "",
35243
35369
  time: 0
35244
35370
  });
35245
- const assignRef = useCallback34(
35371
+ const assignRef = useCallback35(
35246
35372
  (node) => {
35247
35373
  triggerRef.current = node;
35248
35374
  if (typeof forwardedRef === "function") {
@@ -35279,7 +35405,7 @@ var TreeSelect = forwardRef75(function TreeSelect2({
35279
35405
  (node) => node.option.value === activeValue
35280
35406
  );
35281
35407
  const activeNode = activeIndex >= 0 ? visibleNodes[activeIndex] : void 0;
35282
- const closePanel = useCallback34(
35408
+ const closePanel = useCallback35(
35283
35409
  (restoreFocus = false) => {
35284
35410
  setIsOpen(false);
35285
35411
  setQuery("");
@@ -35291,7 +35417,7 @@ var TreeSelect = forwardRef75(function TreeSelect2({
35291
35417
  },
35292
35418
  []
35293
35419
  );
35294
- const openPanel = useCallback34(() => {
35420
+ const openPanel = useCallback35(() => {
35295
35421
  if (disabled) return;
35296
35422
  typeaheadRef.current = { text: "", time: 0 };
35297
35423
  const path = currentValue !== void 0 ? findPath(options, currentValue) : null;
@@ -35488,7 +35614,7 @@ var TreeSelect = forwardRef75(function TreeSelect2({
35488
35614
  firstEnabled(nodes)?.option.value ?? null
35489
35615
  );
35490
35616
  }
35491
- const { style: popupStyle } = useAnchoredPosition(
35617
+ const { style: popupStyle, onMount } = useAnchoredPosition(
35492
35618
  fieldRef,
35493
35619
  panelRef,
35494
35620
  isOpen && !disabled,
@@ -35506,6 +35632,10 @@ var TreeSelect = forwardRef75(function TreeSelect2({
35506
35632
  onDismiss: () => closePanel(false),
35507
35633
  closeOnEscape: false
35508
35634
  });
35635
+ useEffect59(() => {
35636
+ if (!isOpen || popupStyle?.visibility === "hidden") return;
35637
+ if (searchable) searchRef.current?.focus({ preventScroll: true });
35638
+ }, [isOpen, searchable, popupStyle?.visibility]);
35509
35639
  useEffect59(() => {
35510
35640
  if (!isOpen || !activeValue) return;
35511
35641
  panelRef.current?.querySelector(
@@ -35609,7 +35739,7 @@ var TreeSelect = forwardRef75(function TreeSelect2({
35609
35739
  )
35610
35740
  }
35611
35741
  ),
35612
- isOpen && !disabled && /* @__PURE__ */ jsx131(Portal, { anchorRef: fieldRef, children: /* @__PURE__ */ jsxs100(
35742
+ isOpen && !disabled && /* @__PURE__ */ jsx131(Portal, { anchorRef: fieldRef, onMount, children: /* @__PURE__ */ jsxs100(
35613
35743
  "div",
35614
35744
  {
35615
35745
  ref: panelRef,
@@ -35644,7 +35774,7 @@ var TreeSelect = forwardRef75(function TreeSelect2({
35644
35774
  "aria-controls": treeId,
35645
35775
  "aria-activedescendant": activeDescendant,
35646
35776
  placeholder: "Search options",
35647
- autoFocus: true,
35777
+ ref: searchRef,
35648
35778
  value: query,
35649
35779
  onChange: (event) => handleSearchChange(
35650
35780
  event.currentTarget.value
@@ -35783,15 +35913,15 @@ TreeSelect.displayName = "PimoluTreeSelect";
35783
35913
  // signature/signature.tsx
35784
35914
  import {
35785
35915
  forwardRef as forwardRef76,
35786
- useCallback as useCallback35,
35916
+ useCallback as useCallback36,
35787
35917
  useEffect as useEffect60,
35788
35918
  useId as useId65,
35789
- useLayoutEffect as useLayoutEffect8,
35790
- useRef as useRef70,
35919
+ useLayoutEffect as useLayoutEffect9,
35920
+ useRef as useRef71,
35791
35921
  useState as useState80
35792
35922
  } from "react";
35793
35923
  import { jsx as jsx132, jsxs as jsxs101 } from "react/jsx-runtime";
35794
- var useIsomorphicLayoutEffect3 = typeof window !== "undefined" ? useLayoutEffect8 : useEffect60;
35924
+ var useIsomorphicLayoutEffect3 = typeof window !== "undefined" ? useLayoutEffect9 : useEffect60;
35795
35925
  function clamp14(value, min, max) {
35796
35926
  return Math.min(Math.max(value, min), max);
35797
35927
  }
@@ -35898,16 +36028,16 @@ var Signature = forwardRef76(function Signature2({
35898
36028
  const labelId = label ? `${baseId}-label` : void 0;
35899
36029
  const descriptionId = description ? `${baseId}-description` : void 0;
35900
36030
  const instructionsId = `${baseId}-instructions`;
35901
- const canvasRef = useRef70(null);
35902
- const drawingRef = useRef70(null);
35903
- const actionPressRef = useRef70(null);
35904
- const suppressActionClickRef = useRef70(false);
35905
- const strokesRef = useRef70([]);
35906
- const baseImageRef = useRef70(
36031
+ const canvasRef = useRef71(null);
36032
+ const drawingRef = useRef71(null);
36033
+ const actionPressRef = useRef71(null);
36034
+ const suppressActionClickRef = useRef71(false);
36035
+ const strokesRef = useRef71([]);
36036
+ const baseImageRef = useRef71(
35907
36037
  defaultValue ?? null
35908
36038
  );
35909
- const lastEmittedRef = useRef70(void 0);
35910
- const assignRef = useCallback35(
36039
+ const lastEmittedRef = useRef71(void 0);
36040
+ const assignRef = useCallback36(
35911
36041
  (node) => {
35912
36042
  canvasRef.current = node;
35913
36043
  if (typeof forwardedRef === "function") {