@react-hive/honey-layout 6.5.2 → 8.1.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/components/HoneyBox/HoneyBox.d.ts +3 -3
- package/dist/components/HoneyFlexBox.d.ts +1 -1
- package/dist/components/HoneyGrid/HoneyGrid.d.ts +2 -2
- package/dist/components/HoneyGrid/HoneyGridContext.d.ts +1 -1
- package/dist/components/HoneyGrid/HoneyGridStyled.d.ts +1 -1
- package/dist/components/HoneyGridColumn/HoneyGridColumnStyled.d.ts +1 -1
- package/dist/components/HoneyList/HoneyListStyled.d.ts +1 -1
- package/dist/components/HoneyPopup/HoneyPopupStyled.d.ts +1 -1
- package/dist/contexts/HoneyLayoutContext.d.ts +2 -41
- package/dist/helpers/helpers.d.ts +3 -94
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1280 -1392
- package/dist/providers/HoneyLayoutProvider.d.ts +3 -3
- package/dist/types/css.types.d.ts +4 -77
- package/dist/utils/index.d.ts +0 -1
- package/package.json +15 -14
- package/dist/constants.d.ts +0 -3
- package/dist/utils/utils.d.ts +0 -72
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { HoneyStyleProviderProps } from '@react-hive/honey-style';
|
|
3
3
|
import { UseHoneyMediaQueryOptions } from '../hooks';
|
|
4
|
-
interface HoneyLayoutProviderProps extends
|
|
4
|
+
interface HoneyLayoutProviderProps extends HoneyStyleProviderProps {
|
|
5
5
|
mediaQueryOptions?: UseHoneyMediaQueryOptions;
|
|
6
6
|
}
|
|
7
|
-
export declare const HoneyLayoutProvider: ({ children, theme, mediaQueryOptions, }: PropsWithChildren<HoneyLayoutProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const HoneyLayoutProvider: ({ children, theme, mediaQueryOptions, ...props }: PropsWithChildren<HoneyLayoutProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HoneyBreakpointName, HoneyStyledContext, HoneyColor, HoneyCSSSpacingValue, HoneyCSSColorProperty, HoneyCSSSpacingProperty, HoneyCSSShorthandSpacingProperty, HoneyRawCSSSpacingValue } from '@react-hive/honey-style';
|
|
2
2
|
/**
|
|
3
3
|
* The types for handling CSS properties and values, focusing on dimensions, colors, media queries, and other essential CSS concepts.
|
|
4
4
|
*/
|
|
5
5
|
import * as CSS from 'csstype';
|
|
6
|
-
/**
|
|
7
|
-
* Represents a tuple of 2 to 4 values using standard CSS shorthand conventions.
|
|
8
|
-
*
|
|
9
|
-
* This type models how properties like `margin`, `padding`, `gap`, and `borderRadius`
|
|
10
|
-
* can accept multiple values to control different sides or axes.
|
|
11
|
-
*
|
|
12
|
-
* Value interpretation follows CSS shorthand behavior:
|
|
13
|
-
* - `[T, T]` → [top & bottom, left & right]
|
|
14
|
-
* - `[T, T, T]` → [top, left & right, bottom]
|
|
15
|
-
* - `[T, T, T, T]` → [top, right, bottom, left]
|
|
16
|
-
*
|
|
17
|
-
* @template T - The type of each spacing value (e.g., number, string, or token).
|
|
18
|
-
*/
|
|
19
|
-
export type HoneyCSSShorthandTuple<T> = [T, T] | [T, T, T] | [T, T, T, T];
|
|
20
|
-
/**
|
|
21
|
-
* Represents a CSS layout value that can be a single value or a shorthand array of values.
|
|
22
|
-
*
|
|
23
|
-
* Useful for properties like `margin`, `padding`, or `borderRadius`, which allow:
|
|
24
|
-
* - A single value (applied to all sides)
|
|
25
|
-
* - A tuple of 2–4 values using standard CSS shorthand behavior
|
|
26
|
-
*
|
|
27
|
-
* Examples:
|
|
28
|
-
* - `'8px'`
|
|
29
|
-
* - `['8px', '12px']`
|
|
30
|
-
* - `['8px', '12px', '16px', '20px']`
|
|
31
|
-
*
|
|
32
|
-
* @template T - The type of each individual value.
|
|
33
|
-
*/
|
|
34
|
-
export type HoneyCSSMultiValue<T> = T | HoneyCSSShorthandTuple<T>;
|
|
35
6
|
/**
|
|
36
7
|
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function/steps#step-position
|
|
37
8
|
*/
|
|
@@ -40,56 +11,12 @@ type HoneyCSSStepFunctionPosition = 'jump-start' | 'jump-end' | 'jump-none' | 'j
|
|
|
40
11
|
* Defining the allowed timing functions for the transition
|
|
41
12
|
*/
|
|
42
13
|
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})`;
|
|
43
|
-
/**
|
|
44
|
-
* Represents CSS properties related to spacing and positioning.
|
|
45
|
-
*/
|
|
46
|
-
export type HoneyCSSSpacingProperty = keyof Pick<CSS.Properties, 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'top' | 'right' | 'bottom' | 'left' | 'gap' | 'rowGap' | 'columnGap'>;
|
|
47
|
-
/**
|
|
48
|
-
* Represents shorthand spacing properties that support multi-value arrays.
|
|
49
|
-
*
|
|
50
|
-
* These properties accept 2–4 space-separated values
|
|
51
|
-
* to control spacing on multiple sides (e.g., top, right, bottom, left).
|
|
52
|
-
*/
|
|
53
|
-
export type HoneyCSSShorthandSpacingProperty = keyof Pick<CSS.Properties, 'margin' | 'padding' | 'gap'>;
|
|
54
|
-
/**
|
|
55
|
-
* Represents a subset of CSS properties that define color-related styles.
|
|
56
|
-
*/
|
|
57
|
-
export type HoneyCSSColorProperty = keyof Pick<CSS.Properties, 'color' | 'backgroundColor' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'outlineColor' | 'textDecorationColor' | 'fill' | 'stroke'>;
|
|
58
|
-
/**
|
|
59
|
-
* Represents a spacing value used in layout-related CSS properties.
|
|
60
|
-
*
|
|
61
|
-
* Can be:
|
|
62
|
-
* - A single numeric value (e.g., `8`)
|
|
63
|
-
* - A single dimension string (e.g., `'1rem'`)
|
|
64
|
-
* - A shorthand array of 2–4 values (e.g., `[8, 12]` or `['1rem', '2rem', '1.5rem']`)
|
|
65
|
-
*
|
|
66
|
-
* Commonly used for properties like `margin`, `padding`, `gap`, etc.
|
|
67
|
-
*/
|
|
68
|
-
export type HoneyCSSSpacingValue = HoneyCSSMultiValue<number | HoneyCSSDimensionValue>;
|
|
69
|
-
/**
|
|
70
|
-
* Converts a tuple of spacing values into a valid CSS shorthand string using a consistent unit.
|
|
71
|
-
*
|
|
72
|
-
* Acts as a type-level converter that transforms 2–4 spacing values (e.g., `[8, 12]`) into a space-separated
|
|
73
|
-
* CSS string (e.g., `'8px 12px'`), suitable for shorthand-compatible properties like `margin`, `padding`, or `gap`.
|
|
74
|
-
*
|
|
75
|
-
* This type enforces unit consistency across all values and is useful for generating precise, typed spacing strings.
|
|
76
|
-
*
|
|
77
|
-
* Example outputs:
|
|
78
|
-
* - `'8px 12px'` for `[8, 12]`
|
|
79
|
-
* - `'1rem 2rem 1.5rem'` for `[1, 2, 1.5]`
|
|
80
|
-
* - `'4px 8px 12px 16px'` for `[4, 8, 12, 16]`
|
|
81
|
-
*
|
|
82
|
-
* @template Tuple - A tuple of 2 to 4 values to be converted into a CSS shorthand string.
|
|
83
|
-
* @template Unit - The CSS unit to apply to each value (e.g., `'px'`, `'rem'`, `'%'`).
|
|
84
|
-
*/
|
|
85
|
-
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;
|
|
86
14
|
/**
|
|
87
15
|
* A type representing a function that returns a value for a specific CSS property based on the provided theme.
|
|
88
16
|
*
|
|
89
17
|
* @template CSSProperty - The CSS property this function will generate a value for.
|
|
90
18
|
*/
|
|
91
19
|
type HoneyCSSPropertyValueFn<CSSProperty extends keyof CSS.Properties> = (context: HoneyStyledContext<object>) => CSS.Properties[CSSProperty];
|
|
92
|
-
type HoneyRawCSSSpacingValue = number | HoneyCSSDimensionValue | CSS.Globals;
|
|
93
20
|
/**
|
|
94
21
|
* Represents a non-responsive (raw) CSS property value for a specific CSS property.
|
|
95
22
|
*
|
|
@@ -134,7 +61,7 @@ export type HoneyCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = Ho
|
|
|
134
61
|
*
|
|
135
62
|
* @template CSSProperty - The string type representing a CSS property name.
|
|
136
63
|
*/
|
|
137
|
-
export type
|
|
64
|
+
export type Honey$PrefixedCSSProperty<CSSProperty extends keyof CSS.Properties = keyof CSS.Properties> = `$${CSSProperty}`;
|
|
138
65
|
/**
|
|
139
66
|
* Represents an object where each key is a prefixed CSS property (with a `$` prefix).
|
|
140
67
|
*
|
|
@@ -146,7 +73,7 @@ export type HoneyPrefixedCSSProperty<CSSProperty extends keyof CSS.Properties =
|
|
|
146
73
|
* };
|
|
147
74
|
* ```
|
|
148
75
|
*/
|
|
149
|
-
export type
|
|
150
|
-
[CSSProperty in keyof CSS.Properties as
|
|
76
|
+
export type Honey$PrefixedCSSProperties = {
|
|
77
|
+
[CSSProperty in keyof CSS.Properties as Honey$PrefixedCSSProperty<CSSProperty>]?: HoneyCSSPropertyValue<CSSProperty>;
|
|
151
78
|
};
|
|
152
79
|
export {};
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-hive/honey-layout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,22 +33,23 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@react-hive/honey-style": "^
|
|
36
|
+
"@react-hive/honey-style": "^2.7.0",
|
|
37
37
|
"react": "^19.0.0",
|
|
38
38
|
"react-dom": "^19.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@floating-ui/dom": "1.7.
|
|
42
|
-
"@floating-ui/react": "0.27.
|
|
41
|
+
"@floating-ui/dom": "1.7.2",
|
|
42
|
+
"@floating-ui/react": "0.27.13",
|
|
43
43
|
"@mdx-js/react": "3.1.0",
|
|
44
|
+
"@react-hive/honey-utils": "1.2.0",
|
|
44
45
|
"csstype": "3.1.3",
|
|
45
46
|
"highlight.js": "11.11.1",
|
|
46
47
|
"lodash.merge": "4.6.2",
|
|
47
48
|
"lodash.throttle": "4.1.1",
|
|
48
|
-
"react-router-dom": "6.30.
|
|
49
|
+
"react-router-dom": "6.30.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@eslint/js": "9.
|
|
52
|
+
"@eslint/js": "9.31.0",
|
|
52
53
|
"@mdx-js/rollup": "3.1.0",
|
|
53
54
|
"@testing-library/jest-dom": "6.6.3",
|
|
54
55
|
"@testing-library/react": "16.3.0",
|
|
@@ -56,22 +57,22 @@
|
|
|
56
57
|
"@types/lodash.merge": "4.6.9",
|
|
57
58
|
"@types/lodash.throttle": "4.1.9",
|
|
58
59
|
"@types/mdx": "2.0.13",
|
|
59
|
-
"@types/node": "22.
|
|
60
|
+
"@types/node": "22.16.4",
|
|
60
61
|
"@types/react": "^19.1.8",
|
|
61
62
|
"@types/react-dom": "^19.1.6",
|
|
62
|
-
"@vitejs/plugin-react": "4.
|
|
63
|
-
"eslint": "9.
|
|
63
|
+
"@vitejs/plugin-react": "4.6.0",
|
|
64
|
+
"eslint": "9.31.0",
|
|
64
65
|
"eslint-plugin-react": "7.37.5",
|
|
65
66
|
"husky": "9.1.7",
|
|
66
67
|
"jest": "29.7.0",
|
|
67
68
|
"jest-environment-jsdom": "29.7.0",
|
|
68
|
-
"prettier": "3.
|
|
69
|
-
"ts-jest": "29.
|
|
69
|
+
"prettier": "3.6.2",
|
|
70
|
+
"ts-jest": "29.4.0",
|
|
70
71
|
"tsx": "4.20.3",
|
|
71
72
|
"typescript": "5.8.3",
|
|
72
|
-
"typescript-eslint": "8.
|
|
73
|
-
"vite": "
|
|
74
|
-
"vite-plugin-checker": "0.
|
|
73
|
+
"typescript-eslint": "8.37.0",
|
|
74
|
+
"vite": "7.0.5",
|
|
75
|
+
"vite-plugin-checker": "0.10.0",
|
|
75
76
|
"vite-plugin-dts": "4.5.4"
|
|
76
77
|
},
|
|
77
78
|
"jest": {
|
package/dist/constants.d.ts
DELETED
package/dist/utils/utils.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { HoneyHEXColor } from '@react-hive/honey-style';
|
|
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
|
-
interface HTMLElementTransformationValues {
|
|
61
|
-
translateX: number;
|
|
62
|
-
translateY: number;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get various transformation values from the transformation matrix of an element.
|
|
66
|
-
*
|
|
67
|
-
* @param element - The element with a transformation applied.
|
|
68
|
-
*
|
|
69
|
-
* @returns An object containing transformation values.
|
|
70
|
-
*/
|
|
71
|
-
export declare const getTransformationValues: (element: HTMLElement) => HTMLElementTransformationValues;
|
|
72
|
-
export {};
|