@sheetxl/utils-react 0.7.10 → 0.7.11

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sheetxl/utils-react",
3
3
  "description": "Utils React - Utilities for React capabilities needed for all SheetXL components.",
4
- "version": "0.7.10",
4
+ "version": "0.7.11",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -40,7 +40,7 @@
40
40
  "react"
41
41
  ],
42
42
  "dependencies": {
43
- "@sheetxl/utils": "^0.7.10",
43
+ "@sheetxl/utils": "^0.7.11",
44
44
  "clsx": "^2.1.1",
45
45
  "detect-it": "^4.0.1",
46
46
  "react-merge-refs": "^3.0.2",
package/types/index.d.ts CHANGED
@@ -789,7 +789,7 @@ export declare type IconPath = {
789
789
  className?: string;
790
790
  fill?: string;
791
791
  stroke?: string;
792
- opacity?: number;
792
+ opacity?: number | string;
793
793
  fillRule?: "nonzero" | "evenodd";
794
794
  clipRule?: "nonzero" | "evenodd";
795
795
  };
@@ -1210,6 +1210,12 @@ export declare interface ScrollbarProps extends default_2.HTMLAttributes<HTMLEle
1210
1210
  * @defaultValue 24
1211
1211
  */
1212
1212
  minThumbSize?: number;
1213
+ /**
1214
+ * The maximum size of the thumb in pixels.
1215
+ *
1216
+ * @defaultValue undefined (no maximum size)
1217
+ */
1218
+ maxThumbSize?: number;
1213
1219
  /**
1214
1220
  * The amount to increment the scroll position when the scroll button is clicked.
1215
1221
  * This can be a fixed number or a function that takes the current offset, viewport size,
@@ -1473,6 +1479,44 @@ export declare type UrlInput = {
1473
1479
  src: string;
1474
1480
  } | string;
1475
1481
 
1482
+ /**
1483
+ * Enhanced version of useMeasure that provides real-time measurements during animations.
1484
+ *
1485
+ * Use for components that don't sit within the component hierarchy but could be animated.
1486
+ * (for examples portal elements; menus, tooltips)
1487
+ *
1488
+ * Unlike the standard useMeasure hook which relies on ResizeObserver (which doesn't trigger
1489
+ * during CSS transform animations), this hook actively monitors element bounds using
1490
+ * requestAnimationFrame and CSS animation/transition events.
1491
+ *
1492
+ * @remarks
1493
+ * - Monitors all bounds properties: x, y, width, height, top, left, right, bottom
1494
+ * - Detects animations on the element itself and all parent elements
1495
+ * - Uses both position polling and event-based detection for optimal performance
1496
+ * - Automatically stops monitoring when animations complete to save resources
1497
+ *
1498
+ * @example
1499
+ * ```tsx
1500
+ * const [ref, bounds] = useAnimatedMeasure<HTMLDivElement>();
1501
+ *
1502
+ * return (
1503
+ * <div ref={ref} style={{ transform: 'translateX(100px)' }}>
1504
+ * Position: {bounds?.x}, {bounds?.y}
1505
+ * </div>
1506
+ * );
1507
+ * ```
1508
+ */
1509
+ export declare function useAnimatedMeasure<T extends Element = HTMLDivElement>(options?: UseAnimatedMeasureOptions): readonly [(node: T | null) => void, UseMeasureRect];
1510
+
1511
+ export declare interface UseAnimatedMeasureOptions {
1512
+ /** Threshold in pixels for detecting bounds changes (default: 0.1) */
1513
+ threshold?: number;
1514
+ /** Number of frames without movement to consider animation stopped (default: 3) */
1515
+ stillnessThreshold?: number;
1516
+ /** Maximum parent elements to monitor for animations (default: 50) */
1517
+ maxHierarchyDepth?: number;
1518
+ }
1519
+
1476
1520
  /**
1477
1521
  * This is a callback hook that is similar to useCallback except in
1478
1522
  * one important way. When it's dependencies change it does
@@ -1537,6 +1581,8 @@ export declare const useId: any;
1537
1581
 
1538
1582
  export declare function useImperativeElement<R extends T, A = any, T = HTMLElement & A>(refForwarded: React.Ref<R>, attributeFn?: () => Partial<A>, deps?: DependencyList): React.RefObject<R>;
1539
1583
 
1584
+ declare type UseMeasureRect = Pick<DOMRectReadOnly, 'x' | 'y' | 'top' | 'left' | 'right' | 'bottom' | 'height' | 'width'>;
1585
+
1540
1586
  /**
1541
1587
  * Simple hook that calls onMouseDown at intervals until mouse is up.
1542
1588
  *