@react-hive/honey-layout 4.0.0 → 4.2.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.
Files changed (30) hide show
  1. package/dist/components/HoneyBox.d.ts +5 -6
  2. package/dist/components/HoneyFlexBox.d.ts +2 -8
  3. package/dist/components/HoneyGrid/HoneyGrid.d.ts +3 -25
  4. package/dist/components/HoneyGrid/HoneyGridStyled.d.ts +4 -10
  5. package/dist/components/HoneyGridColumn/HoneyGridColumn.types.d.ts +1 -1
  6. package/dist/components/HoneyGridColumn/HoneyGridColumnStyled.d.ts +4 -10
  7. package/dist/components/HoneyLazyContent.d.ts +2 -2
  8. package/dist/components/HoneyList/HoneyList.d.ts +2 -3
  9. package/dist/components/HoneyList/HoneyList.types.d.ts +6 -10
  10. package/dist/components/HoneyList/HoneyListStyled.d.ts +4 -16
  11. package/dist/components/HoneyLoopingList/HoneyLoopingList.d.ts +3 -6
  12. package/dist/components/HoneyOverlay.d.ts +5 -5
  13. package/dist/components/HoneyStatusContent.d.ts +2 -2
  14. package/dist/contexts/HoneyLayoutContext.d.ts +13 -13
  15. package/dist/effects.d.ts +4 -4
  16. package/dist/helpers/helpers.d.ts +32 -31
  17. package/dist/hooks/use-honey-drag.d.ts +11 -11
  18. package/dist/hooks/use-honey-media-query.d.ts +2 -2
  19. package/dist/hooks/use-honey-overlay.d.ts +2 -2
  20. package/dist/hooks/use-honey-synthetic-scrollable-container.d.ts +4 -4
  21. package/dist/hooks/use-register-honey-overlay.d.ts +3 -3
  22. package/dist/index.js +350 -349
  23. package/dist/providers/HoneyLayoutProvider.d.ts +2 -2
  24. package/dist/providers/HoneyLayoutThemeOverride.d.ts +3 -3
  25. package/dist/types/css.types.d.ts +2 -2
  26. package/dist/types/data.types.d.ts +11 -14
  27. package/dist/types/state.types.d.ts +2 -2
  28. package/dist/types/types.d.ts +8 -8
  29. package/dist/utils.d.ts +20 -20
  30. package/package.json +10 -10
@@ -17,33 +17,35 @@ export type ResolveSpacingResult<MultiValue extends HoneyCSSMultiValue<number>,
17
17
  * @template MultiValue - Represents the spacing value(s), which could be a single number or an array of numbers (e.g., [1, 2, 3, 4]).
18
18
  * @template Unit - The CSS unit used for the resolved spacing value, e.g., 'px', 'em'. Defaults to 'px'.
19
19
  *
20
- * @param {MultiValue} value - The spacing factor(s) to be applied. It can be:
21
- * - A single number representing a multiplier for the base spacing value.
22
- * - An array of numbers representing multiple multipliers for base spacing values (e.g., for margins or padding).
23
- * @param {Unit} [unit='px'] - The CSS unit to use for the calculated value. If `null` or `undefined`, no unit is applied.
24
- * Defaults to 'px'.
25
- * @param {keyof HoneySpacings} [type='base'] - The type of spacing to use from the theme. Determines which base spacing
26
- * value to use for calculations (e.g., 'base', 'small', 'large'). Defaults to 'base'.
27
- *
28
- * @returns {(context: ExecutionContext) => ResolveSpacingResult<MultiValue, Unit>} - A function that takes `ExecutionContext`
29
- * (containing the theme object) and returns the resolved spacing value(s). The result is either:
30
- * - A single calculated value (e.g., '16px') if the input is a single number.
31
- * - A string of space-separated values (e.g., '8px 16px 24px 32px') if the input is an array of numbers.
20
+ * @param value - The spacing factor(s) to be applied. It can be:
21
+ * - A single number representing a multiplier for the base spacing value.
22
+ * - An array of numbers representing multiple multipliers for base spacing values (e.g., for margins or padding).
23
+ * @param [unit='px'] - The CSS unit to use for the calculated value. If `null` or `undefined`, no unit is applied.
24
+ * Defaults to 'px'.
25
+ * @param [type='base'] - The type of spacing to use from the theme. Determines which base spacing
26
+ * value to use for calculations (e.g., 'base', 'small', 'large'). Defaults to 'base'.
27
+ *
28
+ * @returns A function that takes `ExecutionContext` (containing the theme object) and returns the resolved spacing value(s).
29
+ * The result is either:
30
+ * - A single calculated value (e.g., '16px') if the input is a single number.
31
+ * - A string of space-separated values (e.g., '8px 16px 24px 32px') if the input is an array of numbers.
32
32
  */
33
33
  export declare const resolveSpacing: <MultiValue extends HoneyCSSMultiValue<number>, Unit extends Nullable<HoneyCSSDimensionUnit> = "px">(value: MultiValue, unit?: Unit, type?: keyof HoneySpacings) => ((context: ExecutionContext) => ResolveSpacingResult<MultiValue, Unit>);
34
34
  /**
35
35
  * Resolves a color value from the theme or returns the input color directly if it's a standalone color name or HEX value.
36
36
  *
37
- * @param colorKey - A string representing the color to resolve. This can be:
38
- * - A theme key in the format 'colorType.colorName'.
39
- * - A standalone color name (e.g., "red", "blue").
40
- * - A HEX color value (e.g., "#RRGGBB").
41
- * @param alpha - Optional. The alpha transparency value between 0 (fully transparent) and 1 (fully opaque). Default to `undefined`.
37
+ * @param colorKey - A string representing the color to resolve.
38
+ * This can be:
39
+ * - A theme key in the format 'colorType.colorName'.
40
+ * - A standalone color name (e.g., "red", "blue").
41
+ * - A HEX color value (e.g., "#RRGGBB").
42
+ * @param [alpha] - The alpha transparency value between 0 (fully transparent) and 1 (fully opaque).
43
+ * Default to `undefined`.
42
44
  *
43
45
  * @returns A function that takes an `ExecutionContext` with a `theme` and resolves the color value:
44
- * - A HEX color string from the theme (e.g., "#RRGGBB").
45
- * - A HEX color string with alpha (e.g., "#RRGGBBAA") if `alpha` is provided.
46
- * - The input `colorKey` value directly if it's a standalone color name or HEX value.
46
+ * - A HEX color string from the theme (e.g., "#RRGGBB").
47
+ * - A HEX color string with alpha (e.g., "#RRGGBBAA") if `alpha` is provided.
48
+ * - The input `colorKey` value directly if it's a standalone color name or HEX value.
47
49
  *
48
50
  * @throws Will throw an error if the provided alpha value is not within the valid range (0 to 1).
49
51
  * @throws Will throw an error if the color format is invalid.
@@ -52,7 +54,7 @@ export declare const resolveColor: (colorKey: HoneyColorKey | HoneyCSSColor, alp
52
54
  /**
53
55
  * Resolves the font styles based on the provided font name from the theme.
54
56
  *
55
- * @param {HoneyFontName} fontName - The name of the font to be resolved from the theme.
57
+ * @param fontName - The name of the font to be resolved from the theme.
56
58
  *
57
59
  * @returns A style function that takes a theme object and returns the CSS styles for the specified font.
58
60
  */
@@ -60,7 +62,7 @@ export declare const resolveFont: (fontName: HoneyFontName) => ({ theme }: Execu
60
62
  /**
61
63
  * Resolves a specific dimension value from the theme configuration.
62
64
  *
63
- * @param {HoneyDimensionName} dimensionName - The name of the dimension to resolve.
65
+ * @param dimensionName - The name of the dimension to resolve.
64
66
  *
65
67
  * @returns A style function that takes the theme and returns the resolved dimension value from the theme.
66
68
  */
@@ -72,11 +74,10 @@ export declare const resolveDimension: (dimensionName: HoneyDimensionName) => ({
72
74
  *
73
75
  * @template Props - The type representing HTML attributes and Honey-prefixed CSS properties.
74
76
  *
75
- * @param {HoneyBreakpointName} breakpoint - The name of the breakpoint to filter properties by.
77
+ * @param breakpoint - The name of the breakpoint to filter properties by.
76
78
  *
77
- * @returns {(context: ExecutionContext & Props) => ReturnType<typeof css>} -
78
- * A function that takes an execution context and properties, and returns a CSS block
79
- * with styles generated for the specified breakpoint.
79
+ * @returns A function that takes an execution context and properties, and returns a CSS block
80
+ * with styles generated for the specified breakpoint.
80
81
  */
81
82
  export declare const createStyles: <Props extends HTMLAttributes<HTMLElement> & HoneyPrefixedCSSProperties>(breakpoint: HoneyBreakpointName) => ((context: ExecutionContext & Props) => ReturnType<typeof css>);
82
83
  /**
@@ -84,8 +85,8 @@ export declare const createStyles: <Props extends HTMLAttributes<HTMLElement> &
84
85
  * The down function creates a media query for screen sizes smaller than the breakpoint,
85
86
  * while the up function creates a media query for screen sizes larger than the breakpoint.
86
87
  *
87
- * @param {HoneyBreakpointName} breakpoint - The name of the breakpoint.
88
- * @param {HoneyCSSMediaRule} [ruleOptions={}] - Additional options for the media rule.
88
+ * @param breakpoint - The name of the breakpoint.
89
+ * @param [ruleOptions={}] - Additional options for the media rule.
89
90
  *
90
91
  * @returns Styled functions for generating media queries.
91
92
  */
@@ -100,10 +101,10 @@ export declare const bpMedia: (breakpoint: HoneyBreakpointName, ruleOptions?: Om
100
101
  *
101
102
  * @template Props - The type representing HTML attributes and Honey-prefixed CSS properties.
102
103
  *
103
- * @param {HoneyBreakpointName} breakpoint - The name of the breakpoint to apply media query styles for.
104
+ * @param breakpoint - The name of the breakpoint to apply media query styles for.
104
105
  *
105
- * @returns {(context: ExecutionContext & Props) => Nullable<ReturnType<typeof css>>} - A function that takes context and properties
106
- * and returns a CSS block wrapped in a media query if styles exist for the specified breakpoint; otherwise, returns `null`.
106
+ * @returns A function that takes context and properties and returns a CSS block wrapped in a media query
107
+ * if styles exist for the specified breakpoint; otherwise, returns `null`.
107
108
  */
108
109
  export declare const applyBreakpointStyles: <Props extends HTMLAttributes<HTMLElement> & HoneyPrefixedCSSProperties>(breakpoint: HoneyBreakpointName) => ((context: ExecutionContext & Props) => Nullable<ReturnType<typeof css>>);
109
110
  /**
@@ -15,7 +15,7 @@ export type HoneyDragOnStartHandler<Element extends HTMLElement> = (draggableEle
15
15
  /**
16
16
  * Context provided to the move handler, containing information about the drag's movement.
17
17
  */
18
- type HoneyDragMoveContext = {
18
+ interface HoneyDragMoveContext {
19
19
  /**
20
20
  * The horizontal distance has moved since the last frame.
21
21
  */
@@ -36,7 +36,7 @@ type HoneyDragMoveContext = {
36
36
  * The straight-line distance from the starting position to the current position.
37
37
  */
38
38
  euclideanDistance: number;
39
- };
39
+ }
40
40
  /**
41
41
  * Handler triggered during a drag operation.
42
42
  *
@@ -59,7 +59,7 @@ export type HoneyDragOnMoveHandler<Element extends HTMLElement> = (draggableElem
59
59
  /**
60
60
  * Context provided to the end handler, containing information about the drag's end state.
61
61
  */
62
- type HoneyDragEndContext = {
62
+ interface HoneyDragEndContext {
63
63
  /**
64
64
  * The total horizontal movement from the starting position to the ending position.
65
65
  */
@@ -76,7 +76,7 @@ type HoneyDragEndContext = {
76
76
  * The speed of movement in the vertical direction (Y axis).
77
77
  */
78
78
  movingSpeedY: number;
79
- };
79
+ }
80
80
  /**
81
81
  * Handler triggered when a drag operation ends.
82
82
  *
@@ -93,7 +93,7 @@ export type HoneyDragOnEndHandler<Element extends HTMLElement> = (context: Honey
93
93
  * Object containing the handlers for various stages of the drag operation.
94
94
  * These handlers can be customized to manage the behavior of the drag process.
95
95
  */
96
- export type HoneyDragHandlers<Element extends HTMLElement> = {
96
+ export interface HoneyDragHandlers<Element extends HTMLElement> {
97
97
  /**
98
98
  * Optional handler triggered when the drag operation starts.
99
99
  * This can be used to capture the initial state or perform setup actions.
@@ -109,27 +109,27 @@ export type HoneyDragHandlers<Element extends HTMLElement> = {
109
109
  * This can be used for cleanup or finalizing the state after the drag ends.
110
110
  */
111
111
  onEndDrag?: HoneyDragOnEndHandler<Element>;
112
- };
112
+ }
113
113
  /**
114
114
  * Options passed to the `useHoneyDrag` hook.
115
115
  */
116
- export type HoneyDragOptions = {
116
+ export interface HoneyDragOptions {
117
117
  /**
118
118
  * Determines whether the drag functionality is enabled or not.
119
119
  *
120
120
  * @default true
121
121
  */
122
122
  isEnabled?: boolean;
123
- };
123
+ }
124
124
  /**
125
125
  * A hook that provides touch and mouse-based dragging functionality for an element.
126
126
  * It tracks the movement of the element during the drag process and exposes handlers for each stage of the drag operation.
127
127
  *
128
128
  * @template Element - The type of the HTML element that is being dragged.
129
129
  *
130
- * @param {MutableRefObject<Nullable<Element>>} draggableElementRef - A reference to the element that can be dragged.
131
- * @param {HoneyDragHandlers<Element>} handlers - The drag event handlers for different stages of the drag operation (start, move, end).
132
- * @param {HoneyDragOptions} options - Configuration options.
130
+ * @param draggableElementRef - A reference to the element that can be dragged.
131
+ * @param handlers - The drag event handlers for different stages of the drag operation (start, move, end).
132
+ * @param options - Configuration options.
133
133
  */
134
134
  export declare const useHoneyDrag: <Element extends HTMLElement>(draggableElementRef: MutableRefObject<Nullable<Element>>, { onMoveDrag, onStartDrag, onEndDrag }: HoneyDragHandlers<Element>, { isEnabled }?: HoneyDragOptions) => void;
135
135
  export {};
@@ -1,5 +1,5 @@
1
1
  import { HoneyScreenState } from '../types';
2
- export type UseHoneyMediaQueryOptions = {
2
+ export interface UseHoneyMediaQueryOptions {
3
3
  /**
4
4
  * Throttle interval (in milliseconds) for the resize event handler.
5
5
  * This limits how often the handler runs during continuous resize events.
@@ -14,7 +14,7 @@ export type UseHoneyMediaQueryOptions = {
14
14
  * These values are only set once on initialization and will not dynamically update the state.
15
15
  */
16
16
  overrideScreenState?: Partial<HoneyScreenState>;
17
- };
17
+ }
18
18
  /**
19
19
  * The hook that tracks the current screen state based on the theme's media breakpoints.
20
20
  * It updates the state on window resize and orientation change.
@@ -1,7 +1,7 @@
1
1
  import { HoneyOverlayId, HoneyOverlayEventListenerHandler } from '../types';
2
- type UseHoneyOverlayOptions = {
2
+ interface UseHoneyOverlayOptions {
3
3
  onKeyUp?: HoneyOverlayEventListenerHandler;
4
- };
4
+ }
5
5
  /**
6
6
  * Hook to interact with a specific overlay managed by the `HoneyLayoutProvider`.
7
7
  *
@@ -1,21 +1,21 @@
1
1
  import { MutableRefObject } from 'react';
2
2
  import { Nullable } from '../types';
3
3
  import { HoneyDragHandlers } from './use-honey-drag';
4
- type SyntheticScrollableContainerOptions<Element extends HTMLElement> = Pick<HoneyDragHandlers<Element>, 'onStartDrag' | 'onEndDrag'> & {
4
+ interface SyntheticScrollableContainerOptions<Element extends HTMLElement> extends Pick<HoneyDragHandlers<Element>, 'onStartDrag' | 'onEndDrag'> {
5
5
  /**
6
6
  * The percentage of the window width and height within which dragging is allowed.
7
7
  *
8
8
  * @default 0
9
9
  */
10
10
  availableWindowPercentage?: number;
11
- };
11
+ }
12
12
  /**
13
13
  * A hook that enables synthetic scrolling behavior for a container element.
14
14
  * It allows horizontal and vertical dragging within a specified window percentage when the content overflows.
15
15
  * The hook handles touch and mouse events for dragging and resets the scroll position upon window resize.
16
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.
17
+ * @param scrollableContainerRef - A ref to the scrollable container element to be assigned to the target element.
18
+ * @param options - Options for configuring the synthetic scrollable container.
19
19
  */
20
20
  export declare const useHoneySyntheticScrollableContainer: <Element extends HTMLElement>(scrollableContainerRef: MutableRefObject<Nullable<Element>>, { availableWindowPercentage, onStartDrag, onEndDrag, }?: SyntheticScrollableContainerOptions<Element>) => void;
21
21
  export {};
@@ -2,9 +2,9 @@ import { HoneyActiveOverlay, HoneyOverlayConfig, Nullable } from '../types';
2
2
  /**
3
3
  * A hook for registering and managing an overlay in the layout system.
4
4
  *
5
- * @param {boolean} isRegister - A flag indicating whether the overlay should be registered.
6
- * @param {HoneyOverlayConfig} overlayConfig - Configuration object specifying overlay behavior.
5
+ * @param isRegister - A flag indicating whether the overlay should be registered.
6
+ * @param overlayConfig - Configuration object specifying overlay behavior.
7
7
  *
8
- * @returns {Nullable<HoneyActiveOverlay>} - The registered overlay instance, or null if not registered.
8
+ * @returns The registered overlay instance, or null if not registered.
9
9
  */
10
10
  export declare const useRegisterHoneyOverlay: (isRegister: boolean, overlayConfig: HoneyOverlayConfig) => Nullable<HoneyActiveOverlay>;