@react-hive/honey-layout 1.0.0-beta
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/components/HoneyBox.d.ts +6 -0
- package/dist/components/HoneyGrid/HoneyGrid.d.ts +22 -0
- package/dist/components/HoneyGrid/HoneyGrid.styled.d.ts +859 -0
- package/dist/components/HoneyGrid/hooks/index.d.ts +1 -0
- package/dist/components/HoneyGrid/hooks/useCurrentHoneyGrid.d.ts +5 -0
- package/dist/components/HoneyGrid/index.d.ts +2 -0
- package/dist/components/HoneyGridColumn/HoneyGridColumn.d.ts +3 -0
- package/dist/components/HoneyGridColumn/HoneyGridColumn.styled.d.ts +866 -0
- package/dist/components/HoneyGridColumn/HoneyGridColumn.types.d.ts +2 -0
- package/dist/components/HoneyGridColumn/index.d.ts +3 -0
- package/dist/components/HoneyLazyContent.d.ts +30 -0
- package/dist/components/HoneyList/HoneyList.d.ts +12 -0
- package/dist/components/HoneyList/HoneyList.helpers.d.ts +2 -0
- package/dist/components/HoneyList/HoneyList.types.d.ts +3 -0
- package/dist/components/HoneyList/index.d.ts +3 -0
- package/dist/components/HoneyLoopingList/HoneyLoopingList.d.ts +12 -0
- package/dist/components/HoneyLoopingList/index.d.ts +1 -0
- package/dist/components/HoneyStatusContent.d.ts +6 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/constants.d.ts +5 -0
- package/dist/helpers.d.ts +905 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/use-honey-drag.d.ts +71 -0
- package/dist/hooks/use-honey-infinite-scroll.d.ts +7 -0
- package/dist/hooks/use-honey-media-query.d.ts +18 -0
- package/dist/hooks/use-honey-synthetic-scrollable-container.d.ts +23 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1826 -0
- package/dist/providers/HoneyThemeProvider.d.ts +14 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/types.d.ts +419 -0
- package/dist/utils.d.ts +121 -0
- package/package.json +84 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { Nullable } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* The handler that is triggered when dragging starts.
|
|
5
|
+
*
|
|
6
|
+
* - The handler can return `false` to prevent the drag from starting.
|
|
7
|
+
* - If the handler returns `void` or `true`, the drag will proceed.
|
|
8
|
+
*/
|
|
9
|
+
export type HoneyDragOnStartHandler<Element extends HTMLElement> = (draggableElement: Element) => void | boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Context provided to the move handler, containing information about the drag's movement.
|
|
12
|
+
*
|
|
13
|
+
* Note:
|
|
14
|
+
* - `deltaX` and `deltaY` represent the movement since the last frame.
|
|
15
|
+
* - `distanceX` and `distanceY` represent the total movement from the starting position.
|
|
16
|
+
* - `euclideanDistance` is the straight-line distance from the start position to the current position.
|
|
17
|
+
*/
|
|
18
|
+
type HoneyDragMoveContext = {
|
|
19
|
+
deltaX: number;
|
|
20
|
+
deltaY: number;
|
|
21
|
+
distanceX: number;
|
|
22
|
+
distanceY: number;
|
|
23
|
+
euclideanDistance: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The handler that is triggered during dragging.
|
|
27
|
+
* It accepts the draggable element and returns a function that is called on every move event with the context as its argument.
|
|
28
|
+
* If this function returns `false`, the drag is stopped immediately.
|
|
29
|
+
*/
|
|
30
|
+
export type HoneyDragOnMoveHandler<Element extends HTMLElement> = (draggableElement: Element) => (context: HoneyDragMoveContext) => void | false;
|
|
31
|
+
/**
|
|
32
|
+
* Context provided to the end handler, containing information about the drag's end state.
|
|
33
|
+
*
|
|
34
|
+
* Note:
|
|
35
|
+
* - `deltaX` and `deltaY` represent the total movement from the start position to the end position.
|
|
36
|
+
* - `movingSpeedX` and `movingSpeedY` represent the speed of movement in the X and Y directions, respectively.
|
|
37
|
+
*/
|
|
38
|
+
type HoneyDragEndContext = {
|
|
39
|
+
deltaX: number;
|
|
40
|
+
deltaY: number;
|
|
41
|
+
movingSpeedX: number;
|
|
42
|
+
movingSpeedY: number;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The handler that is triggered when dragging ends.
|
|
46
|
+
* It accepts the end context and the draggable element.
|
|
47
|
+
*/
|
|
48
|
+
export type HoneyDragOnEndHandler<Element extends HTMLElement> = (context: HoneyDragEndContext, draggableElement: Element) => void;
|
|
49
|
+
/**
|
|
50
|
+
* The set of handlers that can be passed to the hook.
|
|
51
|
+
*
|
|
52
|
+
* Note:
|
|
53
|
+
* - `onStartDrag` is optional and handles the start of the drag.
|
|
54
|
+
* - `onMoveDrag` is required and handles the drag movement.
|
|
55
|
+
* - `onEndDrag` is optional and handles the end of the drag.
|
|
56
|
+
*/
|
|
57
|
+
export type HoneyDragHandlers<Element extends HTMLElement> = {
|
|
58
|
+
onStartDrag?: HoneyDragOnStartHandler<Element>;
|
|
59
|
+
onMoveDrag: HoneyDragOnMoveHandler<Element>;
|
|
60
|
+
onEndDrag?: HoneyDragOnEndHandler<Element>;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* A hook that provides touch and mouse-based dragging functionality for an element.
|
|
64
|
+
* It tracks touch and mouse events, calculates dragging speed and distances during the drag,
|
|
65
|
+
* and exposes `onStart`, `onMove`, and `onEnd` callbacks to handle various stages of dragging.
|
|
66
|
+
*
|
|
67
|
+
* @param {MutableRefObject<Element>} draggableElementRef - A `ref` to the element that should be made draggable.
|
|
68
|
+
* @param {HoneyDragHandlers<Element>} handlers - An object containing the callback functions for different dragging stages.
|
|
69
|
+
*/
|
|
70
|
+
export declare const useHoneyDrag: <Element extends HTMLElement>(draggableElementRef: MutableRefObject<Nullable<Element>>, { onMoveDrag, onStartDrag, onEndDrag }: HoneyDragHandlers<Element>) => void;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { Nullable } from '../types';
|
|
3
|
+
export type UseHoneyInfiniteScrollOnFetchMoreItems = () => void;
|
|
4
|
+
export declare const useHoneyInfiniteScroll: <ScrollableContainerElement extends HTMLElement, TargetElement extends HTMLElement>(containerRef: MutableRefObject<Nullable<ScrollableContainerElement>> | undefined, onFetchMoreItems: UseHoneyInfiniteScrollOnFetchMoreItems) => {
|
|
5
|
+
scrollableContainerRef: (scrollableContainer: Nullable<ScrollableContainerElement>) => void;
|
|
6
|
+
targetRef: (target: Nullable<TargetElement>) => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HoneyScreenState } from '../types';
|
|
2
|
+
type UseHoneyMediaQueryOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* The delay in milliseconds before the resize event is processed.
|
|
5
|
+
*
|
|
6
|
+
* @default 0
|
|
7
|
+
*/
|
|
8
|
+
delay?: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A hook for tracking the current screen state based on media queries defined in the theme.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Optional configuration.
|
|
14
|
+
*
|
|
15
|
+
* @returns The current screen state.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useHoneyMediaQuery: ({ delay }?: UseHoneyMediaQueryOptions) => HoneyScreenState;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { Nullable } from '../types';
|
|
3
|
+
import { HoneyDragHandlers } from './use-honey-drag';
|
|
4
|
+
type SyntheticScrollableContainerOptions<Element extends HTMLElement> = Pick<HoneyDragHandlers<Element>, 'onStartDrag' | 'onEndDrag'> & {
|
|
5
|
+
/**
|
|
6
|
+
* The percentage of the window width and height within which dragging is allowed.
|
|
7
|
+
*
|
|
8
|
+
* @default 0
|
|
9
|
+
*/
|
|
10
|
+
availableWindowPercentage?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A hook that enables synthetic scrolling behavior for a container element.
|
|
14
|
+
* It allows horizontal and vertical dragging within a specified window percentage when the content overflows.
|
|
15
|
+
* The hook handles touch and mouse events for dragging and resets the scroll position upon window resize.
|
|
16
|
+
*
|
|
17
|
+
* @param {MutableRefObject<Nullable<Element>>} scrollableContainerRef - A ref to the scrollable container element to be assigned to the target element.
|
|
18
|
+
* @param {SyntheticScrollableContainerOptions<Element>} options - Options for configuring the synthetic scrollable container.
|
|
19
|
+
*
|
|
20
|
+
* @returns {MutableRefObject<Nullable<Element>>} - A ref to the scrollable container element that should be assigned to the target element.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useHoneySyntheticScrollableContainer: <Element extends HTMLElement>(scrollableContainerRef: MutableRefObject<Nullable<Element>>, { availableWindowPercentage, onStartDrag, onEndDrag, }?: SyntheticScrollableContainerOptions<Element>) => MutableRefObject<Nullable<Element>>;
|
|
23
|
+
export {};
|