@sheetxl/utils-react 0.7.14 → 0.7.16

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.14",
4
+ "version": "0.7.16",
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.14",
43
+ "@sheetxl/utils": "^0.7.16",
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
@@ -262,7 +262,34 @@ export declare function createDynamicIconService(): {
262
262
  addActiveListener: (cb: (key: IconPackKey) => void) => RemoveListener;
263
263
  };
264
264
 
265
- declare const createSyntheticEvent: <T extends Element, E extends Event>(event: E) => React.SyntheticEvent<T, E>;
265
+ /**
266
+ * Creates a React synthetic event from a native DOM event.
267
+ *
268
+ * @remarks
269
+ * This helper creates a synthetic event wrapper that mimics React's SyntheticEvent behavior,
270
+ * including proper type inference for specific event types (PointerEvent, MouseEvent, etc.).
271
+ *
272
+ * @template T - The element type (extends Element)
273
+ * @template E - The native event type (extends Event)
274
+ *
275
+ * @param event - The native DOM event to wrap
276
+ * @param currentTarget - Optional override for currentTarget (useful for portals/delegated events)
277
+ *
278
+ * @returns A React synthetic event with all standard properties and methods
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * // Basic usage
283
+ * const syntheticEvent = createSyntheticEvent<HTMLDivElement, PointerEvent>(nativePointerEvent);
284
+ *
285
+ * // With custom currentTarget (for portals)
286
+ * const syntheticEvent = createSyntheticEvent<HTMLDivElement, PointerEvent>(
287
+ * nativePointerEvent,
288
+ * portalElement
289
+ * );
290
+ * ```
291
+ */
292
+ declare const createSyntheticEvent: <T extends Element, E extends Event, R extends React.SyntheticEvent<T, E>>(event: E, currentTarget?: EventTarget & T) => R;
266
293
 
267
294
  declare const defaultCreateScrollbar: (props: ScrollbarProps, ref?: React.Ref<HTMLDivElement>) => JSX.Element;
268
295
 
@@ -1115,21 +1142,21 @@ export declare interface PersistenceStore {
1115
1142
  */
1116
1143
  export declare type PointerDownListener = (event: default_2.PointerEvent<Element>) => void;
1117
1144
 
1118
- export declare interface PointerHandlerOptions {
1145
+ export declare interface PointerHandlerOptions<T extends Element = Element> {
1119
1146
  /**
1120
1147
  * If returns false then other events will not be fired
1121
1148
  */
1122
- onPointerDown: (event: default_2.PointerEvent<Element>, modifiers: PointerModifiers) => boolean | void;
1149
+ onPointerDown: (event: default_2.PointerEvent<T>, modifiers: PointerModifiers) => boolean | void;
1123
1150
  /**
1124
1151
  * If the Pointer has moved or it the Pointer was held for a period of timerContinuous.
1125
1152
  */
1126
- onPointerMoveOrWait?: (event: globalThis.PointerEvent, modifiers: PointerModifiers, originalEvent: default_2.PointerEvent<Element>) => void;
1153
+ onPointerMoveOrWait?: (event: default_2.PointerEvent<T>, modifiers: PointerModifiers, originalEvent: default_2.PointerEvent<T>) => void;
1127
1154
  /**
1128
1155
  * Called when Pointer is released. This is different than the regular
1129
1156
  * Pointer up in that it will be called even if the Pointer is released
1130
1157
  * when outside the component.
1131
1158
  */
1132
- onPointerUp?: (event: globalThis.PointerEvent, modifiers: PointerModifiers, originalEvent: default_2.PointerEvent<Element>) => void;
1159
+ onPointerUp?: (event: default_2.PointerEvent<T>, modifiers: PointerModifiers, originalEvent: default_2.PointerEvent<T>) => void;
1133
1160
  timerInitial?: number;
1134
1161
  timerContinuous?: number;
1135
1162
  /**
@@ -1255,6 +1282,8 @@ export declare interface ScrollbarProps extends default_2.HTMLAttributes<HTMLEle
1255
1282
  scrollButtonAdditionalRepeatDelay?: number;
1256
1283
  createScrollStartButton?: (props: ScrollButtonProps, ref?: default_2.Ref<HTMLElement>) => default_2.ReactElement;
1257
1284
  createScrollEndButton?: (props: ScrollButtonProps, ref?: default_2.Ref<HTMLElement>) => default_2.ReactElement;
1285
+ touchThumbProps?: Partial<TouchThumbHandleProps>;
1286
+ thumbProps?: default_2.HTMLAttributes<HTMLElement>;
1258
1287
  }
1259
1288
 
1260
1289
  export declare interface ScrollButtonProps {
@@ -1577,6 +1606,40 @@ declare const toPrettyKeyCode: (key: string) => string;
1577
1606
 
1578
1607
  export declare const toShortcutString: (keyStroke: IKeyStroke, modifierSymbol?: boolean) => string;
1579
1608
 
1609
+ declare interface TouchThumbHandleProps extends default_2.HTMLAttributes<HTMLElement> {
1610
+ /**
1611
+ * The orientation of the scrollbar.
1612
+ */
1613
+ orientation: ScrollbarOrientation;
1614
+ /**
1615
+ * Possible anchors are. If 'l', 't', 'r', or 'b', then it will center along view the view.
1616
+ *
1617
+ * @remarks
1618
+ * Determines not only the position but the event that is fired.
1619
+ */
1620
+ size?: number;
1621
+ borderColor?: string;
1622
+ backgroundColor?: string;
1623
+ borderWidth?: number;
1624
+ fillColor?: string;
1625
+ /**
1626
+ * Indicate that a touch handling is being used
1627
+ */
1628
+ currentTouchAnchor?: string;
1629
+ /**
1630
+ * If provided then touch control will walk the parent hierarchy
1631
+ * to find the absolute scroll position
1632
+ */
1633
+ elementParent?: HTMLElement;
1634
+ /**
1635
+ * Use to add create the portal
1636
+ * @defaultValue document.body
1637
+ */
1638
+ elementRoot?: HTMLElement;
1639
+ key?: string;
1640
+ offset?: number;
1641
+ }
1642
+
1580
1643
  export declare const UncaughtErrorBoundary: default_2.FC<{
1581
1644
  children: default_2.ReactNode;
1582
1645
  }>;