@react-hive/honey-layout 9.15.0 → 10.0.0
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/hooks/use-honey-synthetic-scroll-x.d.ts +17 -0
- package/dist/hooks/use-honey-synthetic-scroll-y.d.ts +17 -0
- package/dist/hooks/use-honey-synthetic-scroll.d.ts +33 -4
- package/dist/index.cjs +13 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +109 -51
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
import type { UseHoneySyntheticScrollOptions } from './use-honey-synthetic-scroll';
|
|
2
|
+
/**
|
|
3
|
+
* Enables synthetic horizontal (X-axis) scrolling for a container element
|
|
4
|
+
* using pointer-based drag interactions.
|
|
5
|
+
*
|
|
6
|
+
* This is a convenience wrapper around {@link useHoneySyntheticScroll} with
|
|
7
|
+
* the axis fixed to `'x'`.
|
|
8
|
+
*
|
|
9
|
+
* All behavior, boundaries, and lifecycle guarantees are identical to the
|
|
10
|
+
* base hook, but limited to horizontal movement only.
|
|
11
|
+
*
|
|
12
|
+
* @template Element - The HTML element type of the scrollable container.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Configuration options forwarded to
|
|
15
|
+
* {@link useHoneySyntheticScroll}, excluding the `axis` option.
|
|
16
|
+
*
|
|
17
|
+
* @returns A ref that must be attached to the scrollable container element.
|
|
18
|
+
*/
|
|
2
19
|
export declare const useHoneySyntheticScrollX: <Element extends HTMLElement>(options?: Omit<UseHoneySyntheticScrollOptions<Element>, "axis">) => import("react").RefObject<import("..").Nullable<Element>>;
|
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
import type { UseHoneySyntheticScrollOptions } from './use-honey-synthetic-scroll';
|
|
2
|
+
/**
|
|
3
|
+
* Enables synthetic vertical (Y-axis) scrolling for a container element
|
|
4
|
+
* using pointer-based drag interactions.
|
|
5
|
+
*
|
|
6
|
+
* This is a convenience wrapper around {@link useHoneySyntheticScroll} with
|
|
7
|
+
* the axis fixed to `'y'`.
|
|
8
|
+
*
|
|
9
|
+
* All behavior, boundaries, and lifecycle guarantees are identical to the
|
|
10
|
+
* base hook, but limited to vertical movement only.
|
|
11
|
+
*
|
|
12
|
+
* @template Element - The HTML element type of the scrollable container.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Configuration options forwarded to
|
|
15
|
+
* {@link useHoneySyntheticScroll}, excluding the `axis` option.
|
|
16
|
+
*
|
|
17
|
+
* @returns A ref that must be attached to the scrollable container element.
|
|
18
|
+
*/
|
|
2
19
|
export declare const useHoneySyntheticScrollY: <Element extends HTMLElement>(options?: Omit<UseHoneySyntheticScrollOptions<Element>, "axis">) => import("react").RefObject<import("..").Nullable<Element>>;
|
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
import type { Nullable } from '../types';
|
|
3
3
|
import type { HoneyDragHandlers } from './use-honey-drag';
|
|
4
|
-
type
|
|
4
|
+
type Axis = 'x' | 'y' | 'both';
|
|
5
|
+
interface ApplyAxisScrollParams {
|
|
6
|
+
/**
|
|
7
|
+
* Drag delta for the axis (deltaX or deltaY).
|
|
8
|
+
*/
|
|
9
|
+
delta: number;
|
|
10
|
+
/**
|
|
11
|
+
* Current translate value for the axis.
|
|
12
|
+
*/
|
|
13
|
+
currentTranslate: number;
|
|
14
|
+
/**
|
|
15
|
+
* Visible container size for the axis (width or height).
|
|
16
|
+
*/
|
|
17
|
+
containerSize: number;
|
|
18
|
+
/**
|
|
19
|
+
* Overflow size for the axis.
|
|
20
|
+
*/
|
|
21
|
+
overflowSize: number;
|
|
22
|
+
/**
|
|
23
|
+
* Overscroll window percentage.
|
|
24
|
+
*/
|
|
25
|
+
overscrollPct: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Calculates the next translate value for a single scroll axis
|
|
29
|
+
* and determines whether movement is allowed within bounds.
|
|
30
|
+
*
|
|
31
|
+
* @returns The next translate value, or `null` if movement is not allowed.
|
|
32
|
+
*/
|
|
33
|
+
export declare const applyAxisScroll: ({ delta, currentTranslate, containerSize, overflowSize, overscrollPct, }: ApplyAxisScrollParams) => Nullable<number>;
|
|
5
34
|
export interface UseHoneySyntheticScrollOptions<Element extends HTMLElement> extends Pick<HoneyDragHandlers<Element>, 'onStartDrag' | 'onEndDrag'> {
|
|
6
35
|
/**
|
|
7
36
|
* Axis along which synthetic scrolling is enabled.
|
|
@@ -12,7 +41,7 @@ export interface UseHoneySyntheticScrollOptions<Element extends HTMLElement> ext
|
|
|
12
41
|
*
|
|
13
42
|
* @default 'both'
|
|
14
43
|
*/
|
|
15
|
-
axis?:
|
|
44
|
+
axis?: Axis;
|
|
16
45
|
/**
|
|
17
46
|
* Percentage of the container size used as an overscroll buffer
|
|
18
47
|
* on each enabled axis.
|
|
@@ -24,7 +53,7 @@ export interface UseHoneySyntheticScrollOptions<Element extends HTMLElement> ext
|
|
|
24
53
|
*
|
|
25
54
|
* @default 0
|
|
26
55
|
*/
|
|
27
|
-
|
|
56
|
+
overscrollPct?: number;
|
|
28
57
|
/**
|
|
29
58
|
* Whether to clear any applied translation transforms when the window resizes.
|
|
30
59
|
*
|
|
@@ -56,5 +85,5 @@ export interface UseHoneySyntheticScrollOptions<Element extends HTMLElement> ext
|
|
|
56
85
|
*
|
|
57
86
|
* @returns A ref that must be attached to the scrollable container element.
|
|
58
87
|
*/
|
|
59
|
-
export declare const useHoneySyntheticScroll: <Element extends HTMLElement>({ axis,
|
|
88
|
+
export declare const useHoneySyntheticScroll: <Element extends HTMLElement>({ axis, overscrollPct, onStartDrag, onEndDrag, resetOnResize, }?: UseHoneySyntheticScrollOptions<Element>) => RefObject<Nullable<Element>>;
|
|
60
89
|
export {};
|