@react-hive/honey-layout 5.2.0-beta → 5.6.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/dist/__mocks__/index.d.ts +1 -0
- package/dist/__mocks__/theme-mock.d.ts +2 -0
- package/dist/components/HoneyBox/HoneyBox.d.ts +8 -0
- package/dist/components/HoneyBox/index.d.ts +1 -0
- package/dist/components/HoneyContextMenu/HoneyContextMenu.d.ts +3 -2
- package/dist/components/HoneyContextMenu/HoneyContextMenu.types.d.ts +1 -1
- package/dist/components/HoneyContextMenu/HoneyContextMenuContent.d.ts +3 -2
- package/dist/components/HoneyContextMenu/HoneyContextMenuContentOption.d.ts +2 -3
- package/dist/components/HoneyFlexBox.d.ts +3 -2
- package/dist/components/HoneyGrid/HoneyGrid.d.ts +1 -4
- package/dist/components/HoneyGrid/HoneyGridStyled.d.ts +2 -3
- package/dist/components/HoneyGridColumn/HoneyGridColumn.d.ts +2 -2
- package/dist/components/HoneyGridColumn/HoneyGridColumn.types.d.ts +2 -1
- package/dist/components/HoneyGridColumn/HoneyGridColumnStyled.d.ts +4 -4
- package/dist/components/HoneyLazyContent/index.d.ts +1 -0
- package/dist/components/HoneyList/HoneyList.d.ts +3 -8
- package/dist/components/HoneyList/HoneyListStyled.d.ts +3 -1
- package/dist/components/HoneyOverlay.d.ts +21 -9
- package/dist/components/HoneyPopup/HoneyPopup.d.ts +4 -9
- package/dist/components/HoneyPopup/HoneyPopupStyled.d.ts +2 -4
- package/dist/components/HoneyPopup/hooks/use-honey-popup-interactions.d.ts +2 -1
- package/dist/components/HoneyPopup/hooks/use-honey-popup.d.ts +40 -6
- package/dist/components/index.d.ts +0 -1
- package/dist/constants.d.ts +2 -2
- package/dist/contexts/HoneyLayoutContext.d.ts +4 -4
- package/dist/helpers/helpers.d.ts +37 -25
- package/dist/hooks/index.d.ts +1 -2
- package/dist/hooks/use-honey-document-key-up-handler.d.ts +30 -9
- package/dist/hooks/use-honey-drag.d.ts +36 -18
- package/dist/hooks/use-honey-layout.d.ts +2 -3
- package/dist/hooks/use-honey-on-change.d.ts +27 -0
- package/dist/hooks/use-honey-overlay.d.ts +10 -5
- package/dist/index.js +2251 -2273
- package/dist/providers/HoneyLayoutProvider.d.ts +2 -2
- package/dist/types/css.types.d.ts +140 -31
- package/dist/types/dom.types.d.ts +6 -2
- package/dist/{utils.d.ts → utils/data-utils.d.ts} +1 -80
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/utils.d.ts +80 -0
- package/package.json +19 -15
- package/dist/components/HoneyBox.d.ts +0 -10
- package/dist/components/HoneyLoopingList/HoneyLoopingList.d.ts +0 -12
- package/dist/components/HoneyLoopingList/index.d.ts +0 -1
- package/dist/hooks/use-honey-infinite-scroll.d.ts +0 -6
- package/dist/hooks/use-honey-synthetic-scrollable-container.d.ts +0 -21
- /package/dist/components/{HoneyLazyContent.d.ts → HoneyLazyContent/HoneyLazyContent.d.ts} +0 -0
|
@@ -4,8 +4,8 @@ import { UseHoneyMediaQueryOptions } from '../hooks';
|
|
|
4
4
|
interface HoneyLayoutProviderContentProps {
|
|
5
5
|
mediaQueryOptions?: UseHoneyMediaQueryOptions;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
interface HoneyLayoutProviderProps extends HoneyLayoutProviderContentProps {
|
|
8
8
|
theme: DefaultTheme;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
export declare const HoneyLayoutProvider: ({ theme, ...props }: PropsWithChildren<HoneyLayoutProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,63 +1,167 @@
|
|
|
1
1
|
import { ExecutionContext } from 'styled-components';
|
|
2
2
|
import { HoneyBreakpointName, HoneyColorKey } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The types for handling CSS properties and values, focusing on dimensions, colors, media queries, and other essential CSS concepts.
|
|
5
|
+
*/
|
|
3
6
|
import * as CSS from 'csstype';
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Represents the possible values for media query orientation.
|
|
9
|
+
*
|
|
10
|
+
* Used in responsive styles to target specific device orientations.
|
|
11
|
+
*
|
|
12
|
+
* - `'landscape'` – Width is greater than height.
|
|
13
|
+
* - `'portrait'` – Height is greater than width.
|
|
14
|
+
*/
|
|
6
15
|
export type HoneyCSSMediaOrientation = 'landscape' | 'portrait';
|
|
7
|
-
|
|
8
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Represents a hexadecimal color value.
|
|
18
|
+
*
|
|
19
|
+
* Examples:
|
|
20
|
+
* - `'#ffffff'`
|
|
21
|
+
* - `'#123abc'`
|
|
22
|
+
* - `'#000'`
|
|
23
|
+
*/
|
|
9
24
|
export type HoneyHEXColor = `#${string}`;
|
|
25
|
+
/**
|
|
26
|
+
* Represents any valid CSS color, either a named color (like `'red'`, `'blue'`)
|
|
27
|
+
* or a hexadecimal color code (like `'#ff0000'`).
|
|
28
|
+
*/
|
|
10
29
|
export type HoneyCSSColor = CSS.DataType.NamedColor | HoneyHEXColor;
|
|
11
30
|
/**
|
|
12
|
-
* Represents
|
|
31
|
+
* Represents absolute CSS dimension units.
|
|
32
|
+
*
|
|
33
|
+
* These units are fixed in physical measurements.
|
|
34
|
+
*
|
|
35
|
+
* - `'px'` — pixels
|
|
36
|
+
* - `'cm'` — centimeters
|
|
37
|
+
* - `'mm'` — millimeters
|
|
38
|
+
* - `'in'` — inches
|
|
39
|
+
* - `'pt'` — points
|
|
40
|
+
* - `'pc'` — picas
|
|
41
|
+
*/
|
|
42
|
+
type HoneyCSSAbsoluteDimensionUnit = 'px' | 'cm' | 'mm' | 'in' | 'pt' | 'pc';
|
|
43
|
+
/**
|
|
44
|
+
* Represents relative CSS dimension units.
|
|
45
|
+
*
|
|
46
|
+
* These units scale depending on the context.
|
|
47
|
+
*
|
|
48
|
+
* - `'em'` — relative to the font-size of the element
|
|
49
|
+
* - `'rem'` — relative to the font-size of the root element
|
|
50
|
+
* - `'%'` — percentage of the parent element
|
|
51
|
+
* - `'vh'` — 1% of the viewport height
|
|
52
|
+
* - `'vw'` — 1% of the viewport width
|
|
53
|
+
* - `'vmin'` — 1% of the smaller dimension of the viewport
|
|
54
|
+
* - `'vmax'` — 1% of the larger dimension of the viewport
|
|
55
|
+
*/
|
|
56
|
+
type HoneyCSSRelativeDimensionUnit = 'em' | 'rem' | '%' | 'vh' | 'vw' | 'vmin' | 'vmax';
|
|
57
|
+
/**
|
|
58
|
+
* Represents any valid CSS dimension unit, including both absolute and relative types.
|
|
13
59
|
*/
|
|
14
60
|
export type HoneyCSSDimensionUnit = HoneyCSSAbsoluteDimensionUnit | HoneyCSSRelativeDimensionUnit;
|
|
15
61
|
/**
|
|
16
|
-
* Represents
|
|
62
|
+
* Represents CSS resolution units typically used in media queries.
|
|
17
63
|
*
|
|
18
|
-
*
|
|
64
|
+
* - `'dpi'` — dots per inch
|
|
65
|
+
* - `'dpcm'` — dots per centimeter
|
|
66
|
+
* - `'dppx'` — dots per pixel (e.g., 2dppx for Retina displays)
|
|
67
|
+
* - `'x'` — resolution multiplier (e.g., 1x, 2x)
|
|
19
68
|
*/
|
|
20
|
-
export type
|
|
69
|
+
export type HoneyCSSResolutionUnit = 'dpi' | 'dpcm' | 'dppx' | 'x';
|
|
70
|
+
/**
|
|
71
|
+
* Represents a CSS resolution value, such as `'300dpi'`, `'2x'`, or `'1.5dppx'`.
|
|
72
|
+
*/
|
|
73
|
+
export type HoneyCSSResolutionValue = `${number}${HoneyCSSResolutionUnit}`;
|
|
74
|
+
/**
|
|
75
|
+
* Represents a tuple of 2 to 4 values using standard CSS shorthand conventions.
|
|
76
|
+
*
|
|
77
|
+
* This type models how properties like `margin`, `padding`, `gap`, and `borderRadius`
|
|
78
|
+
* can accept multiple values to control different sides or axes.
|
|
79
|
+
*
|
|
80
|
+
* Value interpretation follows CSS shorthand behavior:
|
|
81
|
+
* - `[T, T]` → [top & bottom, left & right]
|
|
82
|
+
* - `[T, T, T]` → [top, left & right, bottom]
|
|
83
|
+
* - `[T, T, T, T]` → [top, right, bottom, left]
|
|
84
|
+
*
|
|
85
|
+
* @template T - The type of each spacing value (e.g., number, string, or token).
|
|
86
|
+
*/
|
|
87
|
+
export type HoneyCSSShorthandTuple<T> = [T, T] | [T, T, T] | [T, T, T, T];
|
|
21
88
|
/**
|
|
22
|
-
* Represents a CSS value that can be
|
|
89
|
+
* Represents a CSS layout value that can be a single value or a shorthand array of values.
|
|
23
90
|
*
|
|
24
|
-
*
|
|
91
|
+
* Useful for properties like `margin`, `padding`, or `borderRadius`, which allow:
|
|
92
|
+
* - A single value (applied to all sides)
|
|
93
|
+
* - A tuple of 2–4 values using standard CSS shorthand behavior
|
|
94
|
+
*
|
|
95
|
+
* Examples:
|
|
96
|
+
* - `'8px'`
|
|
97
|
+
* - `['8px', '12px']`
|
|
98
|
+
* - `['8px', '12px', '16px', '20px']`
|
|
99
|
+
*
|
|
100
|
+
* @template T - The type of each individual value.
|
|
101
|
+
*/
|
|
102
|
+
export type HoneyCSSMultiValue<T> = T | HoneyCSSShorthandTuple<T>;
|
|
103
|
+
/**
|
|
104
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function/steps#step-position
|
|
25
105
|
*/
|
|
26
|
-
export type HoneyCSSMultiValue<T> = T | HoneyCSSArrayValue<T>;
|
|
27
106
|
type HoneyCSSStepFunctionPosition = 'jump-start' | 'jump-end' | 'jump-none' | 'jump-both' | 'start' | 'end';
|
|
28
107
|
/**
|
|
29
108
|
* Defining the allowed timing functions for the transition
|
|
30
109
|
*/
|
|
31
110
|
export type HoneyCSSTimingFunction = 'ease' | 'linear' | `linear(${string})` | `cubic-bezier(${number}, ${number}, ${number}, ${number})` | 'ease-in' | 'ease-out' | 'ease-in-out' | 'step-start' | 'step-end' | `steps(${number})` | `steps(${number}, ${HoneyCSSStepFunctionPosition})`;
|
|
32
111
|
/**
|
|
33
|
-
*
|
|
112
|
+
* Represents CSS properties related to spacing and positioning.
|
|
113
|
+
*/
|
|
114
|
+
export type HoneyCSSSpacingProperty = keyof Pick<CSS.Properties, 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'top' | 'right' | 'bottom' | 'left' | 'gap' | 'rowGap' | 'columnGap'>;
|
|
115
|
+
/**
|
|
116
|
+
* Represents shorthand spacing properties that support multi-value arrays.
|
|
117
|
+
*
|
|
118
|
+
* These properties accept 2–4 space-separated values
|
|
119
|
+
* to control spacing on multiple sides (e.g., top, right, bottom, left).
|
|
34
120
|
*/
|
|
35
|
-
export type
|
|
121
|
+
export type HoneyCSSShorthandSpacingProperty = keyof Pick<CSS.Properties, 'margin' | 'padding' | 'gap'>;
|
|
36
122
|
/**
|
|
37
123
|
* Represents a subset of CSS properties that define color-related styles.
|
|
38
124
|
*/
|
|
39
125
|
export type HoneyCSSColorProperty = keyof Pick<CSS.Properties, 'color' | 'backgroundColor' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'outlineColor' | 'textDecorationColor' | 'fill' | 'stroke'>;
|
|
40
126
|
/**
|
|
41
|
-
* Represents a
|
|
127
|
+
* Represents a numeric CSS dimension value with an optional specific unit.
|
|
128
|
+
*
|
|
129
|
+
* This type can represent:
|
|
130
|
+
* - A value with a specific CSS unit, such as `'8px'`, `'1.5rem'`, or `'100%'`.
|
|
131
|
+
* - A number without a unit, such as `'16'` (representing a unitless value).
|
|
132
|
+
* - The special value `'auto'` commonly used for flexible layout values.
|
|
133
|
+
*
|
|
134
|
+
* @template Unit - The CSS unit to use (e.g., `'px'`, `'em'`, `'rem'`).
|
|
42
135
|
*/
|
|
43
|
-
export type HoneyCSSDimensionValue<Unit extends HoneyCSSDimensionUnit = HoneyCSSDimensionUnit> = `${number}${Unit}
|
|
136
|
+
export type HoneyCSSDimensionValue<Unit extends HoneyCSSDimensionUnit = HoneyCSSDimensionUnit> = `${number}${Unit}` | `${number}` | 'auto';
|
|
44
137
|
/**
|
|
45
|
-
*
|
|
138
|
+
* Represents a spacing value used in layout-related CSS properties.
|
|
46
139
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
140
|
+
* Can be:
|
|
141
|
+
* - A single numeric value (e.g., `8`)
|
|
142
|
+
* - A single dimension string (e.g., `'1rem'`)
|
|
143
|
+
* - A shorthand array of 2–4 values (e.g., `[8, 12]` or `['1rem', '2rem', '1.5rem']`)
|
|
50
144
|
*
|
|
51
|
-
*
|
|
145
|
+
* Commonly used for properties like `margin`, `padding`, `gap`, etc.
|
|
52
146
|
*/
|
|
53
|
-
export type
|
|
147
|
+
export type HoneyCSSSpacingValue = HoneyCSSMultiValue<number | HoneyCSSDimensionValue>;
|
|
54
148
|
/**
|
|
55
|
-
*
|
|
149
|
+
* Converts a tuple of spacing values into a valid CSS shorthand string using a consistent unit.
|
|
150
|
+
*
|
|
151
|
+
* Acts as a type-level converter that transforms 2–4 spacing values (e.g., `[8, 12]`) into a space-separated
|
|
152
|
+
* CSS string (e.g., `'8px 12px'`), suitable for shorthand-compatible properties like `margin`, `padding`, or `gap`.
|
|
153
|
+
*
|
|
154
|
+
* This type enforces unit consistency across all values and is useful for generating precise, typed spacing strings.
|
|
56
155
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
156
|
+
* Example outputs:
|
|
157
|
+
* - `'8px 12px'` for `[8, 12]`
|
|
158
|
+
* - `'1rem 2rem 1.5rem'` for `[1, 2, 1.5]`
|
|
159
|
+
* - `'4px 8px 12px 16px'` for `[4, 8, 12, 16]`
|
|
160
|
+
*
|
|
161
|
+
* @template Tuple - A tuple of 2 to 4 values to be converted into a CSS shorthand string.
|
|
162
|
+
* @template Unit - The CSS unit to apply to each value (e.g., `'px'`, `'rem'`, `'%'`).
|
|
59
163
|
*/
|
|
60
|
-
export type
|
|
164
|
+
export type HoneyCSSShorthandDimensionOutput<Tuple extends HoneyCSSShorthandTuple<unknown>, Unit extends HoneyCSSDimensionUnit> = Tuple extends [unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : Tuple extends [unknown, unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : Tuple extends [unknown, unknown, unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : never;
|
|
61
165
|
/**
|
|
62
166
|
* A type representing a function that returns a value for a specific CSS property based on the provided theme.
|
|
63
167
|
*
|
|
@@ -65,13 +169,18 @@ export type HoneyCSSDimensionShortHandValue<Value, Unit extends HoneyCSSDimensio
|
|
|
65
169
|
*/
|
|
66
170
|
type HoneyCSSPropertyValueFn<CSSProperty extends keyof CSS.Properties> = (context: ExecutionContext) => CSS.Properties[CSSProperty];
|
|
67
171
|
/**
|
|
68
|
-
*
|
|
172
|
+
* Represents a non-responsive (raw) CSS property value for a specific CSS property.
|
|
69
173
|
*
|
|
70
|
-
* This type
|
|
174
|
+
* This type adapts based on the nature of the property:
|
|
71
175
|
*
|
|
72
|
-
*
|
|
176
|
+
* - For color-related properties, it accepts theme tokens or raw color values.
|
|
177
|
+
* - For shorthand spacing properties (`margin`, `padding`), it supports multi-value arrays.
|
|
178
|
+
* - For other spacing-related properties, it allows numeric or token-based values.
|
|
179
|
+
* - For all other properties, it falls back to the standard CSS value type.
|
|
180
|
+
*
|
|
181
|
+
* @template CSSProperty - The name of the CSS property.
|
|
73
182
|
*/
|
|
74
|
-
type
|
|
183
|
+
type HoneyRawCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = CSSProperty extends HoneyCSSColorProperty ? HoneyCSSColor | HoneyColorKey : CSSProperty extends HoneyCSSShorthandSpacingProperty ? HoneyCSSSpacingValue : CSSProperty extends HoneyCSSSpacingProperty ? number | HoneyCSSDimensionValue | CSS.Globals : CSS.Properties[CSSProperty];
|
|
75
184
|
/**
|
|
76
185
|
* Represents a responsive CSS property value for a specific CSS property.
|
|
77
186
|
*
|
|
@@ -83,7 +192,7 @@ type HoneyCSSColorValue<CSSProperty extends keyof CSS.Properties> = CSSProperty
|
|
|
83
192
|
*
|
|
84
193
|
* @template CSSProperty - The key of a CSS property for which values are defined.
|
|
85
194
|
*/
|
|
86
|
-
type HoneyResponsiveCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = Partial<Record<HoneyBreakpointName,
|
|
195
|
+
type HoneyResponsiveCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = Partial<Record<HoneyBreakpointName, HoneyRawCSSPropertyValue<CSSProperty> | HoneyCSSPropertyValueFn<CSSProperty>>>;
|
|
87
196
|
/**
|
|
88
197
|
* Represents a CSS property value that can be either a single value or a responsive value.
|
|
89
198
|
*
|
|
@@ -95,7 +204,7 @@ type HoneyResponsiveCSSPropertyValue<CSSProperty extends keyof CSS.Properties> =
|
|
|
95
204
|
*
|
|
96
205
|
* @template CSSProperty - The key of a CSS property to check.
|
|
97
206
|
*/
|
|
98
|
-
export type HoneyCSSPropertyValue<CSSProperty extends keyof CSS.Properties> =
|
|
207
|
+
export type HoneyCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = HoneyRawCSSPropertyValue<CSSProperty> | HoneyCSSPropertyValueFn<CSSProperty> | HoneyResponsiveCSSPropertyValue<CSSProperty>;
|
|
99
208
|
/**
|
|
100
209
|
* A utility type to add a `$` prefix to a given CSS property name.
|
|
101
210
|
*
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A union type representing commonly used keyboard key codes.
|
|
3
|
-
* These
|
|
3
|
+
* These codes follow the `KeyboardEvent.code` specification, not `key`.
|
|
4
|
+
*
|
|
5
|
+
* These key codes are useful for identifying specific keyboard inputs during event handling.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
|
|
4
8
|
*/
|
|
5
|
-
export type HoneyKeyboardEventCode = 'Escape' | '
|
|
9
|
+
export type HoneyKeyboardEventCode = 'Escape' | 'Tab' | 'CapsLock' | 'ShiftLeft' | 'ShiftRight' | 'ControlLeft' | 'ControlRight' | 'AltLeft' | 'AltRight' | 'MetaLeft' | 'MetaRight' | 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'Home' | 'End' | 'PageUp' | 'PageDown' | 'Enter' | 'NumpadEnter' | 'Backspace' | 'Delete' | 'Insert' | 'Space' | 'F1' | 'F2' | 'F3' | 'F4' | 'F5' | 'F6' | 'F7' | 'F8' | 'F9' | 'F10' | 'F11' | 'F12' | 'KeyA' | 'KeyB' | 'KeyC' | 'KeyD' | 'KeyE' | 'KeyF' | 'KeyG' | 'KeyH' | 'KeyI' | 'KeyJ' | 'KeyK' | 'KeyL' | 'KeyM' | 'KeyN' | 'KeyO' | 'KeyP' | 'KeyQ' | 'KeyR' | 'KeyS' | 'KeyT' | 'KeyU' | 'KeyV' | 'KeyW' | 'KeyX' | 'KeyY' | 'KeyZ' | 'Digit0' | 'Digit1' | 'Digit2' | 'Digit3' | 'Digit4' | 'Digit5' | 'Digit6' | 'Digit7' | 'Digit8' | 'Digit9' | 'Numpad0' | 'Numpad1' | 'Numpad2' | 'Numpad3' | 'Numpad4' | 'Numpad5' | 'Numpad6' | 'Numpad7' | 'Numpad8' | 'Numpad9' | 'NumpadAdd' | 'NumpadSubtract' | 'NumpadMultiply' | 'NumpadDivide' | 'NumpadDecimal' | 'Minus' | 'Equal' | 'BracketLeft' | 'BracketRight' | 'Backslash' | 'Semicolon' | 'Quote' | 'Backquote' | 'Comma' | 'Period' | 'Slash';
|
|
@@ -1,82 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const camelToDashCase: (inputString: string) => string;
|
|
3
|
-
/**
|
|
4
|
-
* Splits a string into an array of filtered from redundant spaces words.
|
|
5
|
-
*
|
|
6
|
-
* @param inputString - The input string to be split.
|
|
7
|
-
*
|
|
8
|
-
* @returns An array of words from the input string.
|
|
9
|
-
*/
|
|
10
|
-
export declare const splitStringIntoWords: (inputString: string) => string[];
|
|
11
|
-
/**
|
|
12
|
-
* Converts a pixel value to rem.
|
|
13
|
-
*
|
|
14
|
-
* @param px - The pixel value to be converted to rem.
|
|
15
|
-
* @param base - The base value for conversion. Default is 16, which is the typical root font size.
|
|
16
|
-
*
|
|
17
|
-
* @returns The value in rem as a string.
|
|
18
|
-
*/
|
|
19
|
-
export declare const pxToRem: (px: number, base?: number) => string;
|
|
20
|
-
/**
|
|
21
|
-
* Calculates the Euclidean distance between two points in 2D space.
|
|
22
|
-
*
|
|
23
|
-
* @param startX - The X coordinate of the starting point.
|
|
24
|
-
* @param startY - The Y coordinate of the starting point.
|
|
25
|
-
* @param endX - The X coordinate of the ending point.
|
|
26
|
-
* @param endY - The Y coordinate of the ending point.
|
|
27
|
-
*
|
|
28
|
-
* @returns The Euclidean distance between the two points.
|
|
29
|
-
*/
|
|
30
|
-
export declare const calculateEuclideanDistance: (startX: number, startY: number, endX: number, endY: number) => number;
|
|
31
|
-
/**
|
|
32
|
-
* Calculates the moving speed.
|
|
33
|
-
*
|
|
34
|
-
* @param delta - The change in position (distance).
|
|
35
|
-
* @param elapsedTime - The time taken to move the distance.
|
|
36
|
-
*
|
|
37
|
-
* @returns The calculated speed, which is the absolute value of delta divided by elapsed time.
|
|
38
|
-
*/
|
|
39
|
-
export declare const calculateMovingSpeed: (delta: number, elapsedTime: number) => number;
|
|
40
|
-
/**
|
|
41
|
-
* Calculates the specified percentage of a given value.
|
|
42
|
-
*
|
|
43
|
-
* @param value - The value to calculate the percentage of.
|
|
44
|
-
* @param percentage - The percentage to calculate.
|
|
45
|
-
*
|
|
46
|
-
* @returns The calculated percentage of the value.
|
|
47
|
-
*/
|
|
48
|
-
export declare const calculatePercentage: (value: number, percentage: number) => number;
|
|
49
|
-
/**
|
|
50
|
-
* Converts a 3-character or 6-character HEX color code to an 8-character HEX with alpha (RRGGBBAA) format.
|
|
51
|
-
*
|
|
52
|
-
* @param hex - The 3-character or 6-character HEX color code (e.g., "#RGB" or "#RRGGBB" or "RGB" or "RRGGBB").
|
|
53
|
-
* @param alpha - The alpha transparency value between 0 (fully transparent) and 1 (fully opaque).
|
|
54
|
-
*
|
|
55
|
-
* @throws {Error} If alpha value is not between 0 and 1, or if the hex code is invalid.
|
|
56
|
-
*
|
|
57
|
-
* @returns The 8-character HEX with alpha (RRGGBBAA) format color code, or null if input is invalid.
|
|
58
|
-
*/
|
|
59
|
-
export declare const convertHexToHexWithAlpha: (hex: string, alpha: number) => HoneyHEXColor;
|
|
60
|
-
/**
|
|
61
|
-
* Builds a media query string based on the provided options.
|
|
62
|
-
*
|
|
63
|
-
* @param rules - Conditions for the media query.
|
|
64
|
-
*
|
|
65
|
-
* @returns The generated media query string.
|
|
66
|
-
*/
|
|
67
|
-
export declare const media: (rules: HoneyCSSMediaRule[]) => string;
|
|
68
|
-
interface HTMLElementTransformationValues {
|
|
69
|
-
translateX: number;
|
|
70
|
-
translateY: number;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get various transformation values from the transformation matrix of an element.
|
|
74
|
-
*
|
|
75
|
-
* @param element - The element with a transformation applied.
|
|
76
|
-
*
|
|
77
|
-
* @returns An object containing transformation values.
|
|
78
|
-
*/
|
|
79
|
-
export declare const getTransformationValues: (element: HTMLElement) => HTMLElementTransformationValues;
|
|
1
|
+
import { HoneyFlattenedItem, KeysWithArrayValues, KeysWithNonArrayValues, KeysWithStringValues } from '../types';
|
|
80
2
|
/**
|
|
81
3
|
* Recursively converts a nested list structure into a flat list. It excludes the nested list key from the result
|
|
82
4
|
* while adding hierarchical metadata, such as `depthLevel`, `parentId`, and `totalNestedItems` to each flattened item.
|
|
@@ -167,4 +89,3 @@ export declare const filterFlattenedItems: <OriginItem extends object, NestedLis
|
|
|
167
89
|
* ```
|
|
168
90
|
*/
|
|
169
91
|
export declare const searchFlattenedItems: <OriginItem extends object, NestedListKey extends string>(flattenedItems: HoneyFlattenedItem<OriginItem, NestedListKey>[], itemIdKey: KeysWithNonArrayValues<OriginItem>, valueKey: KeysWithStringValues<OriginItem>, searchQuery: string) => HoneyFlattenedItem<OriginItem, NestedListKey>[];
|
|
170
|
-
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { HoneyCSSMediaRule, HoneyHEXColor } from '../types';
|
|
2
|
+
export declare const camelToDashCase: (inputString: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Splits a string into an array of filtered from redundant spaces words.
|
|
5
|
+
*
|
|
6
|
+
* @param inputString - The input string to be split.
|
|
7
|
+
*
|
|
8
|
+
* @returns An array of words from the input string.
|
|
9
|
+
*/
|
|
10
|
+
export declare const splitStringIntoWords: (inputString: string) => string[];
|
|
11
|
+
/**
|
|
12
|
+
* Converts a pixel value to rem.
|
|
13
|
+
*
|
|
14
|
+
* @param px - The pixel value to be converted to rem.
|
|
15
|
+
* @param base - The base value for conversion. Default is 16, which is the typical root font size.
|
|
16
|
+
*
|
|
17
|
+
* @returns The value in rem as a string.
|
|
18
|
+
*/
|
|
19
|
+
export declare const pxToRem: (px: number, base?: number) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Calculates the Euclidean distance between two points in 2D space.
|
|
22
|
+
*
|
|
23
|
+
* @param startX - The X coordinate of the starting point.
|
|
24
|
+
* @param startY - The Y coordinate of the starting point.
|
|
25
|
+
* @param endX - The X coordinate of the ending point.
|
|
26
|
+
* @param endY - The Y coordinate of the ending point.
|
|
27
|
+
*
|
|
28
|
+
* @returns The Euclidean distance between the two points.
|
|
29
|
+
*/
|
|
30
|
+
export declare const calculateEuclideanDistance: (startX: number, startY: number, endX: number, endY: number) => number;
|
|
31
|
+
/**
|
|
32
|
+
* Calculates the moving speed.
|
|
33
|
+
*
|
|
34
|
+
* @param delta - The change in position (distance).
|
|
35
|
+
* @param elapsedTime - The time taken to move the distance.
|
|
36
|
+
*
|
|
37
|
+
* @returns The calculated speed, which is the absolute value of delta divided by elapsed time.
|
|
38
|
+
*/
|
|
39
|
+
export declare const calculateMovingSpeed: (delta: number, elapsedTime: number) => number;
|
|
40
|
+
/**
|
|
41
|
+
* Calculates the specified percentage of a given value.
|
|
42
|
+
*
|
|
43
|
+
* @param value - The value to calculate the percentage of.
|
|
44
|
+
* @param percentage - The percentage to calculate.
|
|
45
|
+
*
|
|
46
|
+
* @returns The calculated percentage of the value.
|
|
47
|
+
*/
|
|
48
|
+
export declare const calculatePercentage: (value: number, percentage: number) => number;
|
|
49
|
+
/**
|
|
50
|
+
* Converts a 3-character or 6-character HEX color code to an 8-character HEX with alpha (RRGGBBAA) format.
|
|
51
|
+
*
|
|
52
|
+
* @param hex - The 3-character or 6-character HEX color code (e.g., "#RGB" or "#RRGGBB" or "RGB" or "RRGGBB").
|
|
53
|
+
* @param alpha - The alpha transparency value between 0 (fully transparent) and 1 (fully opaque).
|
|
54
|
+
*
|
|
55
|
+
* @throws {Error} If alpha value is not between 0 and 1, or if the hex code is invalid.
|
|
56
|
+
*
|
|
57
|
+
* @returns The 8-character HEX with alpha (RRGGBBAA) format color code, or null if input is invalid.
|
|
58
|
+
*/
|
|
59
|
+
export declare const convertHexToHexWithAlpha: (hex: string, alpha: number) => HoneyHEXColor;
|
|
60
|
+
/**
|
|
61
|
+
* Builds a media query string based on the provided options.
|
|
62
|
+
*
|
|
63
|
+
* @param rules - Conditions for the media query.
|
|
64
|
+
*
|
|
65
|
+
* @returns The generated media query string.
|
|
66
|
+
*/
|
|
67
|
+
export declare const media: (rules: HoneyCSSMediaRule[]) => string;
|
|
68
|
+
interface HTMLElementTransformationValues {
|
|
69
|
+
translateX: number;
|
|
70
|
+
translateY: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get various transformation values from the transformation matrix of an element.
|
|
74
|
+
*
|
|
75
|
+
* @param element - The element with a transformation applied.
|
|
76
|
+
*
|
|
77
|
+
* @returns An object containing transformation values.
|
|
78
|
+
*/
|
|
79
|
+
export declare const getTransformationValues: (element: HTMLElement) => HTMLElementTransformationValues;
|
|
80
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-hive/honey-layout",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0-beta",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,46 +33,50 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "^19.0.0",
|
|
35
35
|
"react-dom": "^19.0.0",
|
|
36
|
-
"react-router-dom": "^6.0.0",
|
|
37
36
|
"styled-components": "^6.0.0"
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
39
|
"@emotion/is-prop-valid": "1.3.1",
|
|
41
|
-
"@floating-ui/react": "0.27.
|
|
40
|
+
"@floating-ui/react": "0.27.7",
|
|
42
41
|
"@mdx-js/react": "3.1.0",
|
|
43
42
|
"csstype": "3.1.3",
|
|
44
43
|
"highlight.js": "11.11.1",
|
|
45
44
|
"lodash.merge": "4.6.2",
|
|
46
|
-
"lodash.throttle": "4.1.1"
|
|
45
|
+
"lodash.throttle": "4.1.1",
|
|
46
|
+
"react-router-dom": "6.30.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@eslint/js": "9.
|
|
49
|
+
"@eslint/js": "9.24.0",
|
|
50
50
|
"@mdx-js/rollup": "3.1.0",
|
|
51
|
-
"@testing-library/
|
|
51
|
+
"@testing-library/jest-dom": "6.6.3",
|
|
52
|
+
"@testing-library/react": "16.3.0",
|
|
52
53
|
"@types/jest": "29.5.14",
|
|
53
54
|
"@types/lodash.merge": "4.6.9",
|
|
54
55
|
"@types/lodash.throttle": "4.1.9",
|
|
55
56
|
"@types/mdx": "2.0.13",
|
|
56
|
-
"@types/react": "^19.
|
|
57
|
-
"@types/react-dom": "^19.
|
|
57
|
+
"@types/react": "^19.0.0",
|
|
58
|
+
"@types/react-dom": "^19.0.0",
|
|
58
59
|
"@vitejs/plugin-react": "4.3.4",
|
|
59
|
-
"eslint": "9.
|
|
60
|
-
"eslint-plugin-react": "7.37.
|
|
60
|
+
"eslint": "9.24.0",
|
|
61
|
+
"eslint-plugin-react": "7.37.5",
|
|
61
62
|
"jest": "29.7.0",
|
|
62
63
|
"jest-environment-jsdom": "29.7.0",
|
|
63
64
|
"prettier": "3.5.3",
|
|
64
|
-
"ts-jest": "29.3.
|
|
65
|
-
"typescript": "5.8.
|
|
66
|
-
"typescript-eslint": "8.
|
|
67
|
-
"vite": "6.2.
|
|
65
|
+
"ts-jest": "29.3.2",
|
|
66
|
+
"typescript": "5.8.3",
|
|
67
|
+
"typescript-eslint": "8.30.0",
|
|
68
|
+
"vite": "6.2.6",
|
|
68
69
|
"vite-plugin-checker": "0.9.1",
|
|
69
70
|
"vite-plugin-dts": "4.5.3"
|
|
70
71
|
},
|
|
71
72
|
"jest": {
|
|
72
73
|
"preset": "ts-jest",
|
|
73
74
|
"testEnvironment": "jsdom",
|
|
75
|
+
"setupFilesAfterEnv": [
|
|
76
|
+
"<rootDir>/jest-setup.ts"
|
|
77
|
+
],
|
|
74
78
|
"testMatch": [
|
|
75
|
-
"**/src/**/__tests__/**/*.
|
|
79
|
+
"**/src/**/__tests__/**/*.spec.ts?(x)"
|
|
76
80
|
]
|
|
77
81
|
},
|
|
78
82
|
"browserslist": [
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
|
-
import { StyledTarget } from 'styled-components/dist/types';
|
|
3
|
-
import { HoneyPrefixedCSSProperties, HoneyEffectResultFn } from '../types';
|
|
4
|
-
export interface HoneyBoxProps extends HoneyPrefixedCSSProperties {
|
|
5
|
-
as?: StyledTarget<'web'>;
|
|
6
|
-
effects?: HoneyEffectResultFn<object>[];
|
|
7
|
-
}
|
|
8
|
-
type HoneyBoxInnerProps = HTMLAttributes<HTMLDivElement> & HoneyBoxProps;
|
|
9
|
-
export declare const HoneyBox: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, HoneyBoxInnerProps>> & string;
|
|
10
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { HoneyBoxProps } from '../HoneyBox';
|
|
3
|
-
import { HoneyListItem, HoneyListGenericProps } from '../HoneyList';
|
|
4
|
-
type HoneyLoopingListDirection = 'vertical' | 'horizontal';
|
|
5
|
-
export declare const HoneyLoopingListStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | keyof HoneyBoxProps> & React.HTMLAttributes<HTMLDivElement> & HoneyBoxProps, never>> & string;
|
|
6
|
-
export declare const HoneyLoopingListItemStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
-
interface HoneyLoopingListProps<Item extends HoneyListItem> extends HoneyBoxProps, HoneyListGenericProps<Item> {
|
|
8
|
-
activeItemIndex: number;
|
|
9
|
-
direction?: HoneyLoopingListDirection;
|
|
10
|
-
}
|
|
11
|
-
export declare const HoneyLoopingList: <Item extends HoneyListItem>({ children, items: originalItems, itemKey, activeItemIndex, direction, ...props }: HoneyLoopingListProps<Item>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './HoneyLoopingList';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Nullable } from '../types';
|
|
2
|
-
export type UseHoneyInfiniteScrollOnFetchMoreItems = () => void;
|
|
3
|
-
export declare const useHoneyInfiniteScroll: <ScrollableContainerElement extends HTMLElement, TargetElement extends HTMLElement>(containerElement: Nullable<ScrollableContainerElement>, onFetchMoreItems: UseHoneyInfiniteScrollOnFetchMoreItems) => {
|
|
4
|
-
scrollableContainerRef: (scrollableContainer: Nullable<ScrollableContainerElement>) => void;
|
|
5
|
-
targetRef: (target: Nullable<TargetElement>) => void;
|
|
6
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import { Nullable } from '../types';
|
|
3
|
-
import { HoneyDragHandlers } from './use-honey-drag';
|
|
4
|
-
interface SyntheticScrollableContainerOptions<Element extends HTMLElement> extends 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 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
|
-
*/
|
|
20
|
-
export declare const useHoneySyntheticScrollableContainer: <Element extends HTMLElement>(scrollableContainerRef: RefObject<Nullable<Element>>, { availableWindowPercentage, onStartDrag, onEndDrag, }?: SyntheticScrollableContainerOptions<Element>) => void;
|
|
21
|
-
export {};
|
|
File without changes
|