@react-hive/honey-layout 1.3.0-beta → 2.3.1

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 (31) hide show
  1. package/dist/components/HoneyBox.d.ts +4 -830
  2. package/dist/components/HoneyFlexBox.d.ts +5 -0
  3. package/dist/components/HoneyGrid/HoneyGrid.d.ts +40 -4
  4. package/dist/components/HoneyGrid/HoneyGrid.styled.d.ts +9 -1669
  5. package/dist/components/HoneyGrid/hooks/use-current-honey-grid.d.ts +2 -1
  6. package/dist/components/HoneyGridColumn/HoneyGridColumn.styled.d.ts +16 -1672
  7. package/dist/components/HoneyGridColumn/HoneyGridColumn.types.d.ts +1 -1
  8. package/dist/components/HoneyList/HoneyList.d.ts +12 -10
  9. package/dist/components/HoneyList/HoneyList.types.d.ts +31 -0
  10. package/dist/components/HoneyLoopingList/HoneyLoopingList.d.ts +7 -830
  11. package/dist/components/index.d.ts +1 -0
  12. package/dist/constants.d.ts +2 -2
  13. package/dist/helpers.d.ts +56 -35
  14. package/dist/hooks/use-honey-drag.d.ts +59 -20
  15. package/dist/hooks/use-honey-infinite-scroll.d.ts +1 -2
  16. package/dist/hooks/use-honey-media-query.d.ts +10 -4
  17. package/dist/hooks/use-honey-synthetic-scrollable-container.d.ts +1 -3
  18. package/dist/index.js +997 -933
  19. package/dist/providers/HoneyLayoutProvider.d.ts +69 -0
  20. package/dist/providers/HoneyLayoutThemeOverride.d.ts +15 -0
  21. package/dist/providers/index.d.ts +2 -1
  22. package/dist/types/component.types.d.ts +47 -0
  23. package/dist/types/css.types.d.ts +73 -0
  24. package/dist/types/data.types.d.ts +33 -0
  25. package/dist/types/index.d.ts +6 -0
  26. package/dist/types/state.types.d.ts +22 -0
  27. package/dist/{types.d.ts → types/types.d.ts} +68 -227
  28. package/dist/types/utility.types.d.ts +72 -0
  29. package/dist/utils.d.ts +73 -26
  30. package/package.json +19 -19
  31. package/dist/providers/HoneyThemeProvider.d.ts +0 -15
@@ -0,0 +1,69 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { DefaultTheme, Interpolation } from 'styled-components';
3
+ import { HoneyColorKey, HoneyCSSColor, HoneyCSSDimensionUnit, HoneyCSSDimensionValue, HoneyCSSMultiValue, HoneyDimensionName, HoneyFontName, HoneyScreenState, HoneySpacings, Nullable } from '../types';
4
+ import { ResolveSpacingResult } from '../helpers';
5
+ import { UseHoneyMediaQueryOptions } from '../hooks';
6
+ type HoneyLayoutContextValue = {
7
+ /**
8
+ * Represents the theme object.
9
+ */
10
+ theme: DefaultTheme;
11
+ /**
12
+ * Represents the current state of the screen.
13
+ */
14
+ screenState: HoneyScreenState;
15
+ /**
16
+ * Function to resolve spacing values based on a given theme.
17
+ *
18
+ * @template MultiValue - A type representing the spacing value(s), which could be a single value or an array of values.
19
+ * @template Unit - The CSS unit used for the resolved spacing value, e.g., 'px', 'em'.
20
+ *
21
+ * @param {MultiValue} value - The spacing value(s) to be applied, which could be a single number or an array of numbers.
22
+ * @param {Unit} unit - Optional. The CSS unit to use for the calculated value. Defaults to 'px'.
23
+ * @param {keyof HoneySpacings} type - Optional. The type of spacing to use from the theme (e.g., 'base', 'small', 'large').
24
+ *
25
+ * @returns {ResolveSpacingResult<MultiValue, Unit>} - The resolved spacing value, formatted as a string with the appropriate unit.
26
+ */
27
+ resolveSpacing: <MultiValue extends HoneyCSSMultiValue<number>, Unit extends Nullable<HoneyCSSDimensionUnit> = 'px'>(value: MultiValue, unit?: Unit, type?: keyof HoneySpacings) => ResolveSpacingResult<MultiValue, Unit>;
28
+ /**
29
+ * Function to resolve color values based on the theme.
30
+ *
31
+ * @param {HoneyColorKey} colorKey - The key representing the color in the theme.
32
+ * @param {number} [alpha] - Optional alpha value to apply to the color for transparency.
33
+ *
34
+ * @returns {HoneyCSSColor} - The resolved CSS color, optionally with alpha transparency.
35
+ */
36
+ resolveColor: (colorKey: HoneyColorKey, alpha?: number) => HoneyCSSColor;
37
+ /**
38
+ * Function to resolve font styles based on the theme.
39
+ *
40
+ * @param {HoneyFontName} fontName - The name of the font to resolve from the theme.
41
+ *
42
+ * @returns {Interpolation<object>} - The CSS style rules for the specified font.
43
+ */
44
+ resolveFont: (fontName: HoneyFontName) => Interpolation<object>;
45
+ /**
46
+ * Function to resolve dimension values based on the theme.
47
+ *
48
+ * @param {HoneyDimensionName} dimensionName - The name of the dimension to resolve from the theme.
49
+ *
50
+ * @returns {HoneyCSSDimensionValue} - The resolved CSS dimension value (e.g., width, height).
51
+ */
52
+ resolveDimension: (dimensionName: HoneyDimensionName) => HoneyCSSDimensionValue;
53
+ };
54
+ type HoneyLayoutProviderContentProps = {
55
+ mediaQueryOptions?: UseHoneyMediaQueryOptions;
56
+ };
57
+ type HoneyLayoutProviderProps = HoneyLayoutProviderContentProps & {
58
+ theme: DefaultTheme;
59
+ };
60
+ export declare const HoneyLayoutProvider: ({ theme, ...props }: PropsWithChildren<HoneyLayoutProviderProps>) => import("react/jsx-runtime").JSX.Element;
61
+ /**
62
+ * Custom hook to access the Honey layout context.
63
+ *
64
+ * @throws Will throw an error if the hook is used outside of a `HoneyLayoutProvider` component.
65
+ *
66
+ * @returns {HoneyLayoutContextValue} - The context value providing theming utilities and screen state.
67
+ */
68
+ export declare const useHoneyLayout: () => HoneyLayoutContextValue;
69
+ export {};
@@ -0,0 +1,15 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { DefaultTheme } from 'styled-components';
3
+ type HoneyLayoutThemeOverrideProps = {
4
+ theme: DefaultTheme;
5
+ };
6
+ /**
7
+ * Provides a theme override context to its children.
8
+ * Merges the provided theme with the existing theme from the `ThemeContext`.
9
+ *
10
+ * @param {PropsWithChildren<HoneyLayoutThemeOverrideProps>} props - The props for `HoneyLayoutThemeOverride`.
11
+ *
12
+ * @returns The ThemeProvider with the merged theme applied to its children.
13
+ */
14
+ export declare const HoneyLayoutThemeOverride: ({ theme, ...props }: PropsWithChildren<HoneyLayoutThemeOverrideProps>) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -1 +1,2 @@
1
- export * from './HoneyThemeProvider';
1
+ export * from './HoneyLayoutProvider';
2
+ export * from './HoneyLayoutThemeOverride';
@@ -0,0 +1,47 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Type definition for status content options in a component.
4
+ *
5
+ * This type is used to provide properties for handling different states of a component,
6
+ * such as loading, error, and no content states, along with the content to display in each state.
7
+ *
8
+ * @template T - An optional generic type parameter to extend the type with additional properties.
9
+ */
10
+ export type HoneyStatusContentOptions<T = unknown> = {
11
+ /**
12
+ * A flag indicating whether the component is in a loading state.
13
+ *
14
+ * @default false
15
+ */
16
+ isLoading?: boolean;
17
+ /**
18
+ * A flag indicating whether the component has encountered an error.
19
+ *
20
+ * @default false
21
+ */
22
+ isError?: boolean;
23
+ /**
24
+ * A flag indicating whether the component has no content to display.
25
+ *
26
+ * @default false
27
+ */
28
+ isNoContent?: boolean;
29
+ /**
30
+ * The content to display when the component is in a loading state.
31
+ *
32
+ * @default null
33
+ */
34
+ loadingContent?: ReactNode;
35
+ /**
36
+ * The content to display when the component has encountered an error.
37
+ *
38
+ * @default null
39
+ */
40
+ errorContent?: ReactNode;
41
+ /**
42
+ * The content to display when the component has no content to display.
43
+ *
44
+ * @default null
45
+ */
46
+ noContent?: ReactNode;
47
+ } & T;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The types for handling CSS properties and values, focusing on dimensions, colors, media queries, and other essential CSS concepts.
3
+ */
4
+ import * as CSS from 'csstype';
5
+ export type HoneyCSSResolutionUnit = 'dpi' | 'dpcm' | 'dppx' | 'x';
6
+ export type HoneyCSSResolutionValue = `${number}${HoneyCSSResolutionUnit}`;
7
+ export type HoneyCSSMediaOrientation = 'landscape' | 'portrait';
8
+ type HoneyCSSAbsoluteDimensionUnit = 'px' | 'cm' | 'mm' | 'in' | 'pt' | 'pc';
9
+ type HoneyCSSRelativeDimensionUnit = 'em' | 'rem' | '%' | 'vh' | 'vw' | 'vmin' | 'vmax';
10
+ /**
11
+ * Represents a CSS dimension unit, which can be either an absolute or relative.
12
+ */
13
+ export type HoneyCSSDimensionUnit = HoneyCSSAbsoluteDimensionUnit | HoneyCSSRelativeDimensionUnit;
14
+ /**
15
+ * Represents an array of CSS values, either 2, 3, or 4 values.
16
+ *
17
+ * @template T - Type of the value.
18
+ */
19
+ export type HoneyCSSArrayValue<T> = [T, T] | [T, T, T] | [T, T, T, T];
20
+ /**
21
+ * Represents a CSS value that can be either a single value or an array of values.
22
+ *
23
+ * @template T - Type of the value.
24
+ */
25
+ export type HoneyCSSMultiValue<T> = T | HoneyCSSArrayValue<T>;
26
+ /**
27
+ * Type representing CSS properties related to spacing and positioning.
28
+ */
29
+ export type HoneyCSSDimensionProperty = keyof Pick<CSS.Properties, 'width' | 'height' | 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'top' | 'right' | 'bottom' | 'left' | 'gap' | 'rowGap' | 'columnGap'>;
30
+ /**
31
+ * Represents a subset of CSS properties that define color-related styles.
32
+ */
33
+ export type HoneyCSSColorProperty = keyof Pick<CSS.Properties, 'color' | 'backgroundColor' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'outlineColor' | 'textDecorationColor' | 'fill' | 'stroke'>;
34
+ /**
35
+ * Represents a specific CSS dimension value with a unit.
36
+ */
37
+ export type HoneyCSSDimensionValue<Unit extends HoneyCSSDimensionUnit = HoneyCSSDimensionUnit> = `${number}${Unit}`;
38
+ /**
39
+ * Type representing numeric values for CSS dimension properties.
40
+ *
41
+ * If `CSSProperty` extends `HoneyCSSDimensionProperty`, this type will be a single value or an array of numbers,
42
+ * allowing for spacing properties that can have single or multiple numeric values (e.g., margin, padding).
43
+ * Otherwise, it results in `never`, indicating that non-distance properties are not included.
44
+ *
45
+ * @template CSSProperty - The key of a CSS property to check.
46
+ */
47
+ export type HoneyCSSDimensionNumericValue<CSSProperty extends keyof CSS.Properties> = CSSProperty extends HoneyCSSDimensionProperty ? HoneyCSSMultiValue<number> : never;
48
+ /**
49
+ * Represents a shorthand CSS dimension value for 2, 3, or 4 values with the same unit.
50
+ *
51
+ * @template Value - Type of the value.
52
+ * @template Unit - CSS length unit.
53
+ */
54
+ export type HoneyCSSDimensionShortHandValue<Value, Unit extends HoneyCSSDimensionUnit> = Value extends [unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : Value extends [unknown, unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : Value extends [unknown, unknown, unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : never;
55
+ /**
56
+ * Options for CSS @media at-rule.
57
+ */
58
+ export type HoneyCSSMediaRule = {
59
+ operator?: 'not' | 'only';
60
+ mediaType?: 'all' | 'print' | 'screen' | 'speech';
61
+ width?: HoneyCSSDimensionValue;
62
+ minWidth?: HoneyCSSDimensionValue;
63
+ maxWidth?: HoneyCSSDimensionValue;
64
+ height?: HoneyCSSDimensionValue;
65
+ minHeight?: HoneyCSSDimensionValue;
66
+ maxHeight?: HoneyCSSDimensionValue;
67
+ orientation?: HoneyCSSMediaOrientation;
68
+ resolution?: HoneyCSSResolutionValue;
69
+ minResolution?: HoneyCSSResolutionValue;
70
+ maxResolution?: HoneyCSSResolutionValue;
71
+ update?: 'none' | 'slow' | 'fast';
72
+ };
73
+ export {};
@@ -0,0 +1,33 @@
1
+ import { KeysWithNonArrayValues } from './utility.types';
2
+ /**
3
+ * Represents an item that has been flattened from a hierarchical data structure, with additional
4
+ * properties to support tracking its position and relationships within the hierarchy.
5
+ *
6
+ * This type is particularly useful for scenarios where nested data structures, such as trees or
7
+ * lists with sub-items, need to be transformed into a flat structure while preserving the depth
8
+ * and parent-child relationships.
9
+ *
10
+ * @template OriginItem - The type of the original item from the hierarchical structure.
11
+ * @template NestedListKey - The key within `OriginItem` that contains nested items or lists.
12
+ */
13
+ export type HoneyFlattenedItem<OriginItem extends object, NestedListKey extends string> = Omit<OriginItem, NestedListKey> & {
14
+ /**
15
+ * The optional id of the parent item in the flattened structure. This establishes the parent-child
16
+ * relationship and allows the reconstruction of the original hierarchy if needed.
17
+ */
18
+ parentId: OriginItem[KeysWithNonArrayValues<OriginItem>] | undefined;
19
+ /**
20
+ * The depth level of the item in the flattened structure. This indicates how deep the item is nested
21
+ * within the hierarchy, starting from 0 for top-level items.
22
+ *
23
+ * @default 0
24
+ */
25
+ depthLevel: number;
26
+ /**
27
+ * The total number of nested items that are contained within the current item. This helps to keep
28
+ * track of the overall size of the nested structure for each item.
29
+ *
30
+ * @default 0
31
+ */
32
+ totalNestedItems: number;
33
+ };
@@ -0,0 +1,6 @@
1
+ export * from './utility.types';
2
+ export * from './data.types';
3
+ export * from './state.types';
4
+ export * from './css.types';
5
+ export * from './component.types';
6
+ export * from './types';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Types related to managing application state, React context, or any other state management tools.
3
+ */
4
+ /**
5
+ * Represents the state of the screen layout.
6
+ */
7
+ export type HoneyScreenState = {
8
+ /** Indicates if the screen size is extra-small (xs). */
9
+ isXs: boolean;
10
+ /** Indicates if the screen size is small (sm). */
11
+ isSm: boolean;
12
+ /** Indicates if the screen size is medium (md). */
13
+ isMd: boolean;
14
+ /** Indicates if the screen size is large (lg). */
15
+ isLg: boolean;
16
+ /** Indicates if the screen size is extra-large (xl). */
17
+ isXl: boolean;
18
+ /** Indicates if the screen orientation is portrait. */
19
+ isPortrait: boolean;
20
+ /** Indicates if the screen orientation is landscape. */
21
+ isLandscape: boolean;
22
+ };
@@ -1,78 +1,12 @@
1
- import { ComponentType, ReactNode } from 'react';
2
- import { DefaultTheme, Interpolation } from 'styled-components';
1
+ import { ElementType } from 'react';
2
+ import { ExecutionContext, Interpolation } from 'styled-components';
3
3
  import { DataType } from 'csstype';
4
+ import { HoneyCSSColorProperty, HoneyCSSDimensionNumericValue, HoneyCSSDimensionValue } from './css.types';
4
5
  import * as CSS from 'csstype';
5
6
  export type TimeoutId = ReturnType<typeof setTimeout>;
6
7
  export type Nullable<T> = T | null;
7
- type ExtractKeys<T, Condition> = {
8
- [K in keyof T]: T[K] extends Condition ? K : never;
9
- }[keyof T];
10
- type ExcludeKeys<T, Condition> = {
11
- [K in keyof T]: T[K] extends Condition ? never : K;
12
- }[keyof T];
13
- export type KeysWithStringValues<T> = Extract<ExtractKeys<T, string | null | undefined>, string>;
14
- export type KeysWithArrayValues<T> = Extract<ExtractKeys<T, unknown[] | null | undefined>, string>;
15
- export type KeysWithNonArrayValues<T> = Extract<ExcludeKeys<T, unknown[] | null | undefined>, string>;
16
8
  export type HoneyHEXColor = `#${string}`;
17
- type HoneyCSSAbsoluteDimensionUnit = 'px' | 'cm' | 'mm' | 'in' | 'pt' | 'pc';
18
- type HoneyCSSRelativeDimensionUnit = 'em' | 'rem' | '%' | 'vh' | 'vw' | 'vmin' | 'vmax';
19
- /**
20
- * Type representing CSS properties related to spacing and positioning.
21
- */
22
- export type HoneyCSSDimensionProperty = keyof Pick<CSS.Properties, 'width' | 'height' | 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'top' | 'right' | 'bottom' | 'left' | 'gap' | 'rowGap' | 'columnGap'>;
23
- /**
24
- * Represents a subset of CSS properties that define color-related styles.
25
- */
26
- export type HoneyCSSColorProperty = keyof Pick<CSS.Properties, 'color' | 'backgroundColor' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'outlineColor' | 'textDecorationColor' | 'fill' | 'stroke'>;
27
- /**
28
- * Represents a CSS dimension unit, which can be either an absolute or relative.
29
- */
30
- export type HoneyCSSDimensionUnit = HoneyCSSAbsoluteDimensionUnit | HoneyCSSRelativeDimensionUnit;
31
- export type HoneyCSSResolutionUnit = 'dpi' | 'dpcm' | 'dppx' | 'x';
32
- export type HoneyCSSResolutionValue = `${number}${HoneyCSSResolutionUnit}`;
33
- export type HoneyCSSMediaOrientation = 'landscape' | 'portrait';
34
9
  export type HoneyCSSColor = DataType.NamedColor | HoneyHEXColor;
35
- /**
36
- * Represents a specific CSS dimension value with a unit.
37
- */
38
- export type HoneyCSSDimensionValue<Unit extends HoneyCSSDimensionUnit = HoneyCSSDimensionUnit> = `${number}${Unit}`;
39
- /**
40
- * Represents a shorthand CSS dimension value for 2, 3, or 4 values with the same unit.
41
- *
42
- * @template Value - Type of the value.
43
- * @template Unit - CSS length unit.
44
- */
45
- export type HoneyCSSDimensionShortHandValue<Value, Unit extends HoneyCSSDimensionUnit> = Value extends [unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : Value extends [unknown, unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : Value extends [unknown, unknown, unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : never;
46
- /**
47
- * Represents an array of CSS values, either 2, 3, or 4 values.
48
- *
49
- * @template T - Type of the value.
50
- */
51
- export type HoneyCSSArrayValue<T> = [T, T] | [T, T, T] | [T, T, T, T];
52
- /**
53
- * Represents a CSS value that can be either a single value or an array of values.
54
- *
55
- * @template T - Type of the value.
56
- */
57
- export type HoneyCSSMultiValue<T> = T | HoneyCSSArrayValue<T>;
58
- /**
59
- * Options for CSS @media at-rule.
60
- */
61
- export type HoneyCSSMediaRule = {
62
- operator?: 'not' | 'only';
63
- mediaType?: 'all' | 'print' | 'screen' | 'speech';
64
- width?: HoneyCSSDimensionValue;
65
- minWidth?: HoneyCSSDimensionValue;
66
- maxWidth?: HoneyCSSDimensionValue;
67
- height?: HoneyCSSDimensionValue;
68
- minHeight?: HoneyCSSDimensionValue;
69
- maxHeight?: HoneyCSSDimensionValue;
70
- orientation?: HoneyCSSMediaOrientation;
71
- resolution?: HoneyCSSResolutionValue;
72
- minResolution?: HoneyCSSResolutionValue;
73
- maxResolution?: HoneyCSSResolutionValue;
74
- update?: 'none' | 'slow' | 'fast';
75
- };
76
10
  /**
77
11
  * Represents the breakpoints configuration in pixes for a responsive layout.
78
12
  *
@@ -91,24 +25,53 @@ export type HoneyBreakpoints = {
91
25
  xl: number;
92
26
  };
93
27
  export type HoneyBreakpointName = keyof HoneyBreakpoints;
28
+ export type HoneyContainer = {
29
+ /**
30
+ * Max container width in any CSS distance value.
31
+ */
32
+ maxWidth: HoneyCSSDimensionValue;
33
+ };
94
34
  /**
95
- * A type representing a function that returns a value for a specific CSS property based on the provided theme.
96
- *
97
- * @template CSSProperty - The CSS property this function will generate a value for.
35
+ * Represents the theme configuration.
98
36
  */
99
- type HoneyCSSPropertyValueFn<CSSProperty extends keyof CSS.Properties> = (props: {
100
- theme: DefaultTheme;
101
- }) => CSS.Properties[CSSProperty];
37
+ export interface BaseHoneyTheme {
38
+ /**
39
+ * Breakpoints for responsive design, where keys are breakpoint names and values are breakpoint values.
40
+ */
41
+ breakpoints: Partial<HoneyBreakpoints>;
42
+ /**
43
+ * Configuration for the container.
44
+ */
45
+ container: Partial<HoneyContainer>;
46
+ /**
47
+ * Spacing values used throughout the theme.
48
+ */
49
+ spacings: HoneySpacings;
50
+ /**
51
+ * Font settings used throughout the theme.
52
+ */
53
+ fonts: HoneyFonts;
54
+ /**
55
+ * Color palette used throughout the theme.
56
+ */
57
+ colors: HoneyColors;
58
+ /**
59
+ * Dimension values used throughout the theme.
60
+ */
61
+ dimensions: HoneyDimensions;
62
+ }
63
+ export interface HoneyTheme extends BaseHoneyTheme {
64
+ }
65
+ declare module 'styled-components' {
66
+ interface DefaultTheme extends HoneyTheme {
67
+ }
68
+ }
102
69
  /**
103
- * Type representing numeric values for CSS dimension properties.
104
- *
105
- * If `CSSProperty` extends `HoneyCSSDimensionProperty`, this type will be a single value or an array of numbers,
106
- * allowing for spacing properties that can have single or multiple numeric values (e.g., margin, padding).
107
- * Otherwise, it results in `never`, indicating that non-distance properties are not included.
70
+ * A type representing a function that returns a value for a specific CSS property based on the provided theme.
108
71
  *
109
- * @template CSSProperty - The key of a CSS property to check.
72
+ * @template CSSProperty - The CSS property this function will generate a value for.
110
73
  */
111
- type HoneyCSSDimensionNumericValue<CSSProperty extends keyof CSS.Properties> = CSSProperty extends HoneyCSSDimensionProperty ? HoneyCSSMultiValue<number> : never;
74
+ type HoneyCSSPropertyValueFn<CSSProperty extends keyof CSS.Properties> = (context: ExecutionContext) => CSS.Properties[CSSProperty];
112
75
  /**
113
76
  * Type representing possible values for CSS color properties.
114
77
  *
@@ -142,35 +105,24 @@ type HoneyResponsiveCSSPropertyValue<CSSProperty extends keyof CSS.Properties> =
142
105
  */
143
106
  export type HoneyCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = HoneyCSSColorValue<CSSProperty> | HoneyCSSPropertyValueFn<CSSProperty> | HoneyResponsiveCSSPropertyValue<CSSProperty>;
144
107
  /**
145
- * Defines a type representing a set of CSS properties where each property key is prefixed with a dollar sign ($).
108
+ * A utility type to add a `$` prefix to a given CSS property name.
109
+ *
110
+ * @template CSSProperty - The string type representing a CSS property name.
146
111
  */
147
- export type HoneyCSSProperties = Partial<{
148
- [CSSProperty in keyof CSS.Properties as `$${CSSProperty}`]: HoneyCSSPropertyValue<CSSProperty>;
149
- }>;
112
+ export type HoneyPrefixedCSSProperty<CSSProperty extends keyof CSS.Properties = keyof CSS.Properties> = `$${CSSProperty}`;
150
113
  /**
151
- * Represents the state of the screen layout.
114
+ * Represents an object where each key is a prefixed CSS property (with a `$` prefix),
115
+ *
116
+ * Example:
117
+ * ```
118
+ * const styles: HoneyPrefixedCSSProperties = {
119
+ * $color: 'red',
120
+ * $fontSize: '12px'
121
+ * };
122
+ * ```
152
123
  */
153
- export type HoneyScreenState = {
154
- /** Indicates if the screen size is extra-small (xs). */
155
- isXs: boolean;
156
- /** Indicates if the screen size is small (sm). */
157
- isSm: boolean;
158
- /** Indicates if the screen size is medium (md). */
159
- isMd: boolean;
160
- /** Indicates if the screen size is large (lg). */
161
- isLg: boolean;
162
- /** Indicates if the screen size is extra-large (xl). */
163
- isXl: boolean;
164
- /** Indicates if the screen orientation is portrait. */
165
- isPortrait: boolean;
166
- /** Indicates if the screen orientation is landscape. */
167
- isLandscape: boolean;
168
- };
169
- export type HoneyContainer = {
170
- /**
171
- * Max container width in any CSS distance value.
172
- */
173
- maxWidth: HoneyCSSDimensionValue;
124
+ export type HoneyPrefixedCSSProperties = {
125
+ [CSSProperty in keyof CSS.Properties as HoneyPrefixedCSSProperty<CSSProperty>]?: HoneyCSSPropertyValue<CSSProperty>;
174
126
  };
175
127
  /**
176
128
  * Defines different spacing sizes available in the theme.
@@ -187,7 +139,7 @@ export type HoneySpacings = {
187
139
  /**
188
140
  * Defines the color palette used in the theme.
189
141
  */
190
- export interface BaseHoneyColors {
142
+ interface BaseHoneyColors {
191
143
  /**
192
144
  * Used for elements that require high visibility and emphasis, such as primary buttons, call-to-action elements,
193
145
  * and important elements like headers or titles.
@@ -237,8 +189,8 @@ export interface BaseHoneyColors {
237
189
  * @example
238
190
  * ```typescript
239
191
  * declare module '@react-hive/honey-layout' {
240
- * interface HoneyColors {
241
- * neutral: Record<'charcoalDark' | 'charcoalGray' | 'crimsonRed', HoneyColor>;
192
+ * export interface HoneyColors {
193
+ * neutral: Record<'charcoalDark' | 'charcoalGray' | 'crimsonRed', HoneyCSSColor>;
242
194
  * }
243
195
  * }
244
196
  * ```
@@ -256,8 +208,8 @@ export interface HoneyColors extends BaseHoneyColors {
256
208
  * Given the `HoneyColors` interface:
257
209
  * ```typescript
258
210
  * interface HoneyColors {
259
- * primary: Record<'blue' | 'green', HoneyColor>;
260
- * neutral: Record<'charcoalDark' | 'charcoalGray' | 'crimsonRed', HoneyColor>;
211
+ * primary: Record<'blue' | 'green', HoneyCSSColor>;
212
+ * neutral: Record<'charcoalDark' | 'charcoalGray' | 'crimsonRed', HoneyCSSColor>;
261
213
  * }
262
214
  * ```
263
215
  *
@@ -282,7 +234,7 @@ export type HoneyFont = {
282
234
  * @example
283
235
  * ```typescript
284
236
  * declare module '@react-hive/honey-layout' {
285
- * interface HoneyFonts {
237
+ * export interface HoneyFonts {
286
238
  * body: HoneyFont;
287
239
  * caption: HoneyFont;
288
240
  * }
@@ -300,120 +252,9 @@ export interface HoneyDimensions {
300
252
  [key: string]: HoneyCSSDimensionValue;
301
253
  }
302
254
  export type HoneyDimensionName = keyof HoneyDimensions;
303
- /**
304
- * Represents the theme configuration.
305
- */
306
- export interface BaseHoneyTheme {
307
- /**
308
- * Breakpoints for responsive design, where keys are breakpoint names and values are breakpoint values.
309
- */
310
- breakpoints: Partial<HoneyBreakpoints>;
311
- /**
312
- * Configuration for the container.
313
- */
314
- container: Partial<HoneyContainer>;
315
- /**
316
- * Spacing values used throughout the theme.
317
- */
318
- spacings: HoneySpacings;
319
- /**
320
- * Font settings used throughout the theme.
321
- */
322
- fonts: HoneyFonts;
323
- /**
324
- * Color palette used throughout the theme.
325
- */
326
- colors: HoneyColors;
327
- /**
328
- * Dimension values used throughout the theme.
329
- */
330
- dimensions: HoneyDimensions;
331
- }
332
- export interface HoneyTheme extends BaseHoneyTheme {
333
- }
334
- declare module 'styled-components' {
335
- interface DefaultTheme extends HoneyTheme {
336
- }
337
- }
338
- export type HoneyThemedProps<T = unknown> = {
339
- theme: HoneyTheme;
340
- } & T;
341
255
  export type ComponentWithAs<T, P = object> = {
342
- as?: string | ComponentType<P>;
256
+ as?: ElementType<P>;
343
257
  } & T;
344
- export type HoneyModifierResultFn = () => Interpolation<{
345
- theme: DefaultTheme;
346
- }>;
258
+ export type HoneyModifierResultFn = () => Interpolation<object>;
347
259
  export type HoneyModifier<Config = unknown> = (config?: Config) => HoneyModifierResultFn;
348
- /**
349
- * Type definition for status content options in a component.
350
- *
351
- * This type is used to provide properties for handling different states of a component,
352
- * such as loading, error, and no content states, along with the content to display in each state.
353
- *
354
- * @template T - An optional generic type parameter to extend the type with additional properties.
355
- */
356
- export type HoneyStatusContentOptions<T = unknown> = {
357
- /**
358
- * A flag indicating whether the component is in a loading state.
359
- *
360
- * @default false
361
- */
362
- isLoading?: boolean;
363
- /**
364
- * A flag indicating whether the component has encountered an error.
365
- *
366
- * @default false
367
- */
368
- isError?: boolean;
369
- /**
370
- * A flag indicating whether the component has no content to display.
371
- *
372
- * @default false
373
- */
374
- isNoContent?: boolean;
375
- /**
376
- * The content to display when the component is in a loading state.
377
- *
378
- * @default null
379
- */
380
- loadingContent?: ReactNode;
381
- /**
382
- * The content to display when the component has encountered an error.
383
- *
384
- * @default null
385
- */
386
- errorContent?: ReactNode;
387
- /**
388
- * The content to display when the component has no content to display.
389
- *
390
- * @default null
391
- */
392
- noContent?: ReactNode;
393
- } & T;
394
- /**
395
- * Represents an item that has been flattened with additional properties for hierarchical data structures.
396
- *
397
- * @template OriginItem - The type of the original item.
398
- * @template NestedListKey - The key within `Item` that contains nested items or lists.
399
- */
400
- export type HoneyFlattenedItem<OriginItem extends object, NestedListKey extends string> = Omit<OriginItem, NestedListKey> & {
401
- /**
402
- * Optional id of the parent item in the flattened structure.
403
- * Used to establish parent-child relationships in hierarchical data.
404
- */
405
- parentId: OriginItem[KeysWithNonArrayValues<OriginItem>] | undefined;
406
- /**
407
- * The depth level of the item in the flattened structure.
408
- * Indicates how deep the item is nested within the hierarchy.
409
- */
410
- depthLevel: number;
411
- /**
412
- * The total number of nested items within the current item.
413
- * Helps to keep track of the size of the nested structure.
414
- *
415
- * @default 0
416
- */
417
- totalNestedItems: number;
418
- };
419
260
  export {};