@react-hive/honey-layout 6.5.2 → 8.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.
@@ -1,8 +1,8 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { HoneyStyleContextValue } from '@react-hive/honey-style';
2
+ import { HoneyStyleProviderProps } from '@react-hive/honey-style';
3
3
  import { UseHoneyMediaQueryOptions } from '../hooks';
4
- interface HoneyLayoutProviderProps extends HoneyStyleContextValue {
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 { HoneyCSSDimensionUnit, HoneyBreakpointName, HoneyCSSDimensionValue, HoneyStyledContext, HoneyColor } from '@react-hive/honey-style';
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
  *
@@ -1,4 +1,3 @@
1
- import { HoneyHEXColor } from '@react-hive/honey-style';
2
1
  export declare const camelToDashCase: (inputString: string) => string;
3
2
  /**
4
3
  * Splits a string into an array of filtered from redundant spaces words.
@@ -8,15 +7,6 @@ export declare const camelToDashCase: (inputString: string) => string;
8
7
  * @returns An array of words from the input string.
9
8
  */
10
9
  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
10
  /**
21
11
  * Calculates the Euclidean distance between two points in 2D space.
22
12
  *
@@ -46,17 +36,6 @@ export declare const calculateMovingSpeed: (delta: number, elapsedTime: number)
46
36
  * @returns The calculated percentage of the value.
47
37
  */
48
38
  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
39
  interface HTMLElementTransformationValues {
61
40
  translateX: number;
62
41
  translateY: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-hive/honey-layout",
3
- "version": "6.5.2",
3
+ "version": "8.0.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "react",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "peerDependencies": {
36
- "@react-hive/honey-style": "^1.6.0",
36
+ "@react-hive/honey-style": "^2.2.0",
37
37
  "react": "^19.0.0",
38
38
  "react-dom": "^19.0.0"
39
39
  },
@@ -56,21 +56,21 @@
56
56
  "@types/lodash.merge": "4.6.9",
57
57
  "@types/lodash.throttle": "4.1.9",
58
58
  "@types/mdx": "2.0.13",
59
- "@types/node": "22.15.32",
59
+ "@types/node": "22.15.33",
60
60
  "@types/react": "^19.1.8",
61
61
  "@types/react-dom": "^19.1.6",
62
- "@vitejs/plugin-react": "4.5.1",
62
+ "@vitejs/plugin-react": "4.6.0",
63
63
  "eslint": "9.29.0",
64
64
  "eslint-plugin-react": "7.37.5",
65
65
  "husky": "9.1.7",
66
66
  "jest": "29.7.0",
67
67
  "jest-environment-jsdom": "29.7.0",
68
- "prettier": "3.5.3",
69
- "ts-jest": "29.3.4",
68
+ "prettier": "3.6.2",
69
+ "ts-jest": "29.4.0",
70
70
  "tsx": "4.20.3",
71
71
  "typescript": "5.8.3",
72
72
  "typescript-eslint": "8.35.0",
73
- "vite": "6.3.5",
73
+ "vite": "7.0.0",
74
74
  "vite-plugin-checker": "0.9.3",
75
75
  "vite-plugin-dts": "4.5.4"
76
76
  },
@@ -1,3 +0,0 @@
1
- import { HoneyCSSColorProperty, HoneyCSSSpacingProperty } from './types';
2
- export declare const CSS_SPACING_PROPERTIES: readonly HoneyCSSSpacingProperty[];
3
- export declare const CSS_COLOR_PROPERTIES: readonly HoneyCSSColorProperty[];