@sheetxl/grid-react 0.4.22 → 0.5.1

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/grid-react",
3
3
  "description": "Grid React - Advanced grid component for React",
4
- "version": "0.4.22",
4
+ "version": "0.5.1",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -30,8 +30,8 @@
30
30
  "table"
31
31
  ],
32
32
  "dependencies": {
33
- "@sheetxl/utils": "^0.4.22",
34
- "@sheetxl/utils-react": "^0.4.22",
33
+ "@sheetxl/utils": "^0.5.1",
34
+ "@sheetxl/utils-react": "^0.5.1",
35
35
  "clsx": "^2.1.1",
36
36
  "react-merge-refs": "^3.0.2",
37
37
  "react-use": "^17.6.0",
package/types/index.d.ts CHANGED
@@ -1063,7 +1063,7 @@ export declare interface TextStyle extends PaintStyle {
1063
1063
  /**
1064
1064
  * TouchSelectHandle component
1065
1065
  */
1066
- export declare const TouchSelectHandle: default_2.FC<TouchSelectHandleRefProps>;
1066
+ export declare const TouchSelectHandle: default_2.NamedExoticComponent<TouchSelectHandleProps & default_2.RefAttributes<TouchSelectHandleElement>>;
1067
1067
 
1068
1068
  export declare interface TouchSelectHandleAttributes {
1069
1069
  }
@@ -1111,6 +1111,44 @@ export declare type TouchSelectHandleRefAttribute = {
1111
1111
  export declare interface TouchSelectHandleRefProps extends TouchSelectHandleProps, TouchSelectHandleRefAttribute {
1112
1112
  }
1113
1113
 
1114
+ /**
1115
+ * Enhanced version of useMeasure that provides real-time measurements during animations.
1116
+ *
1117
+ * Use for components that don't sit within the component hierarchy but could be animated.
1118
+ * (for examples portal elements; menus, tooltips)
1119
+ *
1120
+ * Unlike the standard useMeasure hook which relies on ResizeObserver (which doesn't trigger
1121
+ * during CSS transform animations), this hook actively monitors element bounds using
1122
+ * requestAnimationFrame and CSS animation/transition events.
1123
+ *
1124
+ * @remarks
1125
+ * - Monitors all bounds properties: x, y, width, height, top, left, right, bottom
1126
+ * - Detects animations on the element itself and all parent elements
1127
+ * - Uses both position polling and event-based detection for optimal performance
1128
+ * - Automatically stops monitoring when animations complete to save resources
1129
+ *
1130
+ * @example
1131
+ * ```tsx
1132
+ * const [ref, bounds] = useAnimatedMeasure<HTMLDivElement>();
1133
+ *
1134
+ * return (
1135
+ * <div ref={ref} style={{ transform: 'translateX(100px)' }}>
1136
+ * Position: {bounds?.x}, {bounds?.y}
1137
+ * </div>
1138
+ * );
1139
+ * ```
1140
+ */
1141
+ export declare function useAnimatedMeasure<T extends Element = HTMLDivElement>(options?: UseAnimatedMeasureOptions): readonly [(node: T | null) => void, UseMeasureRect];
1142
+
1143
+ export declare interface UseAnimatedMeasureOptions {
1144
+ /** Threshold in pixels for detecting bounds changes (default: 0.1) */
1145
+ threshold?: number;
1146
+ /** Number of frames without movement to consider animation stopped (default: 3) */
1147
+ stillnessThreshold?: number;
1148
+ /** Maximum parent elements to monitor for animations (default: 50) */
1149
+ maxHierarchyDepth?: number;
1150
+ }
1151
+
1114
1152
  export declare const useCellLayout: (props: UseCellLayoutProps | null) => CellLayout;
1115
1153
 
1116
1154
  export declare interface UseCellLayoutProps {
@@ -1307,6 +1345,8 @@ export declare interface useKeyboardEditorOverlayOptions {
1307
1345
  alignment?: HorizontalAlignment;
1308
1346
  }
1309
1347
 
1348
+ declare type UseMeasureRect = Pick<DOMRectReadOnly, 'x' | 'y' | 'top' | 'left' | 'right' | 'bottom' | 'height' | 'width'>;
1349
+
1310
1350
  export declare const useSelection: ({ gridRef, commands, layout, selection: propSelection, onSelectionChange: propOnSelectionChange, onSelectionDragStart: propOnSelectionDragStart, onSelectionDragEnd: propOnSelectionDragEnd, selectionPolicy, newSelectionMode, allowDeselectSelection, onFillPreview: propOnFillPreview, onFillCancel: propOnFillCancel, onFillDone: propOnFillDone, onFill: propOnFill, disableFillDrag, fillHandleBorderColor, hiddenRowsAt: propHiddenRowsAt, hiddenColumnsAt: propHiddenColumnsAt, isContentfulCell: propsIsContentfulCell, contentfulCellFinder: propContentfulCellFinder, getDataCoords, alwaysScrollToActiveCoords, selectionBounds: propSelectionBounds, pointerDownInterceptor, pointerMoveInterceptor, mergedRanges, canSelectionSpanMergedCells, onMoveDragStart: propOnMoveDragStart, onMoveDragUpdate: propOnMoveDragUpdate, onMoveDragEnd: propOnMoveDragEnd, onMoveDragDone: propOnMoveDragDone, selectionRenderer: propSelectionRenderer, disableMoveDrag, getCellCoordsAsRangeCoords, moveDragHitSize, moveDragOutlineSize, selectionBackgroundColor, selectionBorderColor, selectionRemoveBorderColor, selectionRemoveBackgroundColor, disableTouchSelection, touchSelectHandleProps, }: UseSelectionOptions) => SelectionResults;
1311
1351
 
1312
1352
  export declare interface UseSelectionOptions {