@react-hive/honey-layout 1.1.0 → 2.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.
- package/dist/components/HoneyBox.d.ts +4 -830
- package/dist/components/HoneyFlexBox.d.ts +5 -0
- package/dist/components/HoneyGrid/HoneyGrid.d.ts +40 -4
- package/dist/components/HoneyGrid/HoneyGrid.styled.d.ts +9 -1669
- package/dist/components/HoneyGrid/hooks/use-current-honey-grid.d.ts +2 -1
- package/dist/components/HoneyGridColumn/HoneyGridColumn.styled.d.ts +16 -1672
- package/dist/components/HoneyGridColumn/HoneyGridColumn.types.d.ts +1 -1
- package/dist/components/HoneyList/HoneyList.d.ts +7 -5
- package/dist/components/HoneyLoopingList/HoneyLoopingList.d.ts +5 -829
- package/dist/components/index.d.ts +1 -0
- package/dist/constants.d.ts +2 -2
- package/dist/helpers.d.ts +36 -21
- package/dist/hooks/use-honey-media-query.d.ts +9 -2
- package/dist/index.js +854 -814
- package/dist/providers/HoneyLayoutProvider.d.ts +7 -5
- package/dist/providers/HoneyLayoutThemeOverride.d.ts +4 -2
- package/dist/types/component.types.d.ts +47 -0
- package/dist/types/css.types.d.ts +73 -0
- package/dist/types/data.types.d.ts +33 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/state.types.d.ts +22 -0
- package/dist/{types.d.ts → types/types.d.ts} +24 -179
- package/dist/types/utility.types.d.ts +72 -0
- package/dist/utils.d.ts +73 -26
- package/package.json +13 -13
package/dist/constants.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { HoneyCSSColorProperty, HoneyCSSDimensionProperty } from './types';
|
|
2
|
-
export declare const CSS_DIMENSION_PROPERTIES: HoneyCSSDimensionProperty[];
|
|
3
|
-
export declare const CSS_COLOR_PROPERTIES: HoneyCSSColorProperty[];
|
|
2
|
+
export declare const CSS_DIMENSION_PROPERTIES: readonly HoneyCSSDimensionProperty[];
|
|
3
|
+
export declare const CSS_COLOR_PROPERTIES: readonly HoneyCSSColorProperty[];
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { HoneyBreakpointName, HoneyCSSArrayValue, HoneyCSSDimensionShortHandValue, HoneyCSSDimensionUnit, HoneyCSSMultiValue, HoneyCSSMediaRule, HoneySpacings,
|
|
2
|
+
import { ExecutionContext, StyleFunction, css } from 'styled-components';
|
|
3
|
+
import { Nullable, HoneyBreakpointName, HoneyCSSArrayValue, HoneyCSSDimensionShortHandValue, HoneyCSSDimensionUnit, HoneyCSSMultiValue, HoneyCSSMediaRule, HoneySpacings, HoneyColorKey, HoneyFontName, HoneyCSSColor, HoneyDimensionName, HoneyPrefixedCSSProperties, HoneyBreakpoints, HoneyScreenState, HoneyCSSDimensionValue } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Conditional type to determine the return type of the `resolveSpacing` function.
|
|
6
6
|
*
|
|
@@ -23,48 +23,54 @@ export type ResolveSpacingResult<MultiValue extends HoneyCSSMultiValue<number>,
|
|
|
23
23
|
* @param {keyof HoneySpacings} [type='base'] - The type of spacing to use from the theme. Determines which base spacing
|
|
24
24
|
* value to use for calculations (e.g., 'base', 'small', 'large'). Defaults to 'base'.
|
|
25
25
|
*
|
|
26
|
-
* @returns {(
|
|
26
|
+
* @returns {(context: ExecutionContext) => ResolveSpacingResult<MultiValue, Unit>} - A function that takes `ExecutionContext`
|
|
27
27
|
* (containing the theme object) and returns the resolved spacing value(s). The result is either:
|
|
28
28
|
* - A single calculated value (e.g., '16px') if the input is a single number.
|
|
29
29
|
* - A string of space-separated values (e.g., '8px 16px 24px 32px') if the input is an array of numbers.
|
|
30
30
|
*/
|
|
31
|
-
export declare const resolveSpacing: <MultiValue extends HoneyCSSMultiValue<number>, Unit extends Nullable<HoneyCSSDimensionUnit> = "px">(value: MultiValue, unit?: Unit, type?: keyof HoneySpacings) => ((
|
|
31
|
+
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>);
|
|
32
32
|
/**
|
|
33
33
|
* Resolves a color value based on the provided color key and optional alpha value.
|
|
34
34
|
*
|
|
35
35
|
* @param colorKey - The key representing the color to be resolved. This key is a string in the format 'colorType.colorName'.
|
|
36
|
-
* @param alpha - Optional. The alpha transparency value between 0 (fully transparent) and 1 (fully opaque).
|
|
36
|
+
* @param alpha - Optional. The alpha transparency value between 0 (fully transparent) and 1 (fully opaque). Default to `undefined`.
|
|
37
37
|
*
|
|
38
38
|
* @returns The resolved color value from the theme, either in HEX format or in 8-character HEX with alpha format.
|
|
39
39
|
*
|
|
40
40
|
* @throws Will throw an error if the provided alpha value is not within the valid range (0 to 1).
|
|
41
41
|
* @throws Will throw an error if the color format is invalid.
|
|
42
42
|
*/
|
|
43
|
-
export declare const resolveColor: (colorKey: HoneyColorKey, alpha?: number) => ({ theme }:
|
|
43
|
+
export declare const resolveColor: (colorKey: HoneyColorKey, alpha?: number) => ({ theme }: ExecutionContext) => HoneyCSSColor;
|
|
44
44
|
/**
|
|
45
45
|
* Resolves the font styles based on the provided font name from the theme.
|
|
46
46
|
*
|
|
47
|
-
* @param fontName - The name of the font to be resolved from the theme.
|
|
47
|
+
* @param {HoneyFontName} fontName - The name of the font to be resolved from the theme.
|
|
48
48
|
*
|
|
49
|
-
* @returns A function that takes
|
|
49
|
+
* @returns A style function that takes a theme object and returns the CSS styles for the specified font.
|
|
50
50
|
*/
|
|
51
|
-
export declare const resolveFont: (fontName: HoneyFontName) => ({ theme }:
|
|
51
|
+
export declare const resolveFont: (fontName: HoneyFontName) => ({ theme }: ExecutionContext) => import('styled-components').RuleSet<object>;
|
|
52
52
|
/**
|
|
53
53
|
* Resolves a specific dimension value from the theme configuration.
|
|
54
54
|
*
|
|
55
55
|
* @param {HoneyDimensionName} dimensionName - The name of the dimension to resolve.
|
|
56
56
|
*
|
|
57
|
-
* @returns A function that takes the theme and returns the resolved dimension value from the theme.
|
|
57
|
+
* @returns A style function that takes the theme and returns the resolved dimension value from the theme.
|
|
58
58
|
*/
|
|
59
|
-
export declare const resolveDimension: (dimensionName: HoneyDimensionName) => ({ theme }:
|
|
59
|
+
export declare const resolveDimension: (dimensionName: HoneyDimensionName) => ({ theme }: ExecutionContext) => HoneyCSSDimensionValue;
|
|
60
60
|
/**
|
|
61
|
-
* Generates CSS styles based on the provided breakpoint and
|
|
62
|
-
* Filters the
|
|
63
|
-
*
|
|
61
|
+
* Generates CSS styles based on the provided breakpoint and properties.
|
|
62
|
+
* Filters the properties to include only those that match the specified breakpoint.
|
|
63
|
+
* Converts the property names from camelCase to dash-case and retrieves their values.
|
|
64
64
|
*
|
|
65
|
-
* @
|
|
65
|
+
* @template Props - The type representing HTML attributes and Honey-prefixed CSS properties.
|
|
66
|
+
*
|
|
67
|
+
* @param {HoneyBreakpointName} breakpoint - The name of the breakpoint to filter properties by.
|
|
68
|
+
*
|
|
69
|
+
* @returns {(context: ExecutionContext & Props) => ReturnType<typeof css>} -
|
|
70
|
+
* A function that takes an execution context and properties, and returns a CSS block
|
|
71
|
+
* with styles generated for the specified breakpoint.
|
|
66
72
|
*/
|
|
67
|
-
export declare const
|
|
73
|
+
export declare const createStyles: <Props extends HTMLAttributes<HTMLElement> & HoneyPrefixedCSSProperties>(breakpoint: HoneyBreakpointName) => ((context: ExecutionContext & Props) => ReturnType<typeof css>);
|
|
68
74
|
/**
|
|
69
75
|
* Utility function that returns functions for generating media queries for the specified breakpoint.
|
|
70
76
|
* The down function creates a media query for screen sizes smaller than the breakpoint,
|
|
@@ -73,16 +79,25 @@ export declare const generateStyles: <Props extends HTMLAttributes<HTMLElement>>
|
|
|
73
79
|
* @param {HoneyBreakpointName} breakpoint - The name of the breakpoint.
|
|
74
80
|
* @param {HoneyCSSMediaRule} [ruleOptions={}] - Additional options for the media rule.
|
|
75
81
|
*
|
|
76
|
-
* @returns
|
|
82
|
+
* @returns Styled functions for generating media queries.
|
|
77
83
|
*/
|
|
78
84
|
export declare const bpMedia: (breakpoint: HoneyBreakpointName, ruleOptions?: Omit<HoneyCSSMediaRule, "width" | "minWidth" | "maxWidth">) => {
|
|
79
|
-
down:
|
|
80
|
-
up:
|
|
85
|
+
down: StyleFunction<object>;
|
|
86
|
+
up: StyleFunction<object>;
|
|
81
87
|
};
|
|
82
88
|
/**
|
|
83
|
-
*
|
|
89
|
+
* Applies CSS styles wrapped in a media query for the specified breakpoint based on the provided properties.
|
|
90
|
+
* If no styles are found for the specified breakpoint or if the breakpoint configuration is missing,
|
|
91
|
+
* it returns `null`. Otherwise, it generates media query styles using the `createStyles` function.
|
|
92
|
+
*
|
|
93
|
+
* @template Props - The type representing HTML attributes and Honey-prefixed CSS properties.
|
|
94
|
+
*
|
|
95
|
+
* @param {HoneyBreakpointName} breakpoint - The name of the breakpoint to apply media query styles for.
|
|
96
|
+
*
|
|
97
|
+
* @returns {(context: ExecutionContext & Props) => Nullable<ReturnType<typeof css>>} - A function that takes context and properties
|
|
98
|
+
* and returns a CSS block wrapped in a media query if styles exist for the specified breakpoint; otherwise, returns `null`.
|
|
84
99
|
*/
|
|
85
|
-
export declare const
|
|
100
|
+
export declare const applyBreakpointStyles: <Props extends HTMLAttributes<HTMLElement> & HoneyPrefixedCSSProperties>(breakpoint: HoneyBreakpointName) => ((context: ExecutionContext & Props) => Nullable<ReturnType<typeof css>>);
|
|
86
101
|
/**
|
|
87
102
|
* Resolves the current screen state based on the window's dimensions and the breakpoints provided in the theme.
|
|
88
103
|
*
|
|
@@ -6,9 +6,16 @@ export type UseHoneyMediaQueryOptions = {
|
|
|
6
6
|
* @default 0
|
|
7
7
|
*/
|
|
8
8
|
delay?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Manually override screen state properties like isXs, isPortrait, etc.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* These values are only set once on initialization and will not dynamically update the state.
|
|
14
|
+
*/
|
|
15
|
+
overrideScreenState?: Partial<HoneyScreenState>;
|
|
9
16
|
};
|
|
10
17
|
/**
|
|
11
|
-
*
|
|
18
|
+
* The hook that tracks the current screen state based on the theme's media breakpoints.
|
|
12
19
|
* It updates the state on window resize and orientation change.
|
|
13
20
|
*
|
|
14
21
|
* @param options - Optional configuration object.
|
|
@@ -16,4 +23,4 @@ export type UseHoneyMediaQueryOptions = {
|
|
|
16
23
|
* @returns The current screen state, indicating the orientation (portrait or landscape)
|
|
17
24
|
* and the active breakpoint (xs, sm, md, lg, xl).
|
|
18
25
|
*/
|
|
19
|
-
export declare const useHoneyMediaQuery: ({ delay }?: UseHoneyMediaQueryOptions) => HoneyScreenState;
|
|
26
|
+
export declare const useHoneyMediaQuery: ({ delay, overrideScreenState, }?: UseHoneyMediaQueryOptions) => HoneyScreenState;
|