@react-hive/honey-layout 6.3.0 → 6.5.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,11 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { ReferenceType } from '@floating-ui/react';
3
3
  import { FastOmit } from '@react-hive/honey-style';
4
- import { HoneyPopupProps, HoneyPopupChildrenContextProps } from '../HoneyPopup';
4
+ import { HoneyPopupContextValue, HoneyPopupProps } from '../HoneyPopup';
5
5
  import { HoneyContextMenuOption } from './HoneyContextMenu.types';
6
6
  import { HoneyContextMenuContentProps } from './HoneyContextMenuContent';
7
7
  export interface HoneyContextMenuProps<Option extends HoneyContextMenuOption<Context, Reference>, Context, Reference extends ReferenceType, UseAutoSize extends boolean> extends FastOmit<HoneyPopupProps<Context, Reference, UseAutoSize>, 'content'>, Pick<HoneyContextMenuContentProps<Option, Context, Reference, UseAutoSize>, 'options' | 'optionProps'> {
8
- children: ReactNode | ((context: HoneyPopupChildrenContextProps<Reference>) => ReactNode);
8
+ children: ReactNode | ((context: HoneyPopupContextValue<Context, Reference>) => ReactNode);
9
9
  subProps?: FastOmit<HoneyContextMenuContentProps<Option, Context, Reference, UseAutoSize>, 'options' | 'optionProps'>;
10
10
  }
11
11
  export declare const HoneyContextMenu: <Option extends HoneyContextMenuOption<Context, Reference>, Context, Reference extends ReferenceType, UseAutoSize extends boolean>({ children, subProps, options, optionProps, clickOptions, context, ...popupProps }: HoneyContextMenuProps<Option, Context, Reference, UseAutoSize>) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1 @@
1
- import { FloatingContext, ReferenceType } from '@floating-ui/react';
2
- export interface HoneyPopupChildrenContextProps<Reference extends ReferenceType> {
3
- floatingContext: FloatingContext<Reference>;
4
- }
1
+ export {};
@@ -1,20 +1,19 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
2
  import { ReferenceType, FloatingArrowProps, FloatingFocusManagerProps, MiddlewareData } from '@floating-ui/react';
3
3
  import { FastOmit } from '@react-hive/honey-style';
4
- import { HoneyPopupChildrenContextProps } from './HoneyPopup.types';
5
4
  import { HoneyPopupPortalProps } from './HoneyPopupPortal';
6
5
  import { HoneyPopupStyledProps } from './HoneyPopupStyled';
7
- import { HoneyPopupContextProps } from './HoneyPopupContext';
6
+ import { HoneyPopupContextValue } from './HoneyPopupContext';
8
7
  import { UseHoneyPopupOptions } from './hooks';
9
8
  import { HoneyOverlayProps } from '../HoneyOverlay';
10
9
  type InheritedHoneyOverlayProps = FastOmit<HoneyOverlayProps, 'children' | 'active' | 'onDeactivate' | '$position'>;
11
10
  export interface HoneyPopupContentProps<Context, Reference extends ReferenceType, UseAutoSize extends boolean> extends UseHoneyPopupOptions<Reference, UseAutoSize> {
12
- children: ReactNode | ((context: HoneyPopupChildrenContextProps<Reference>) => ReactNode);
11
+ children: ReactNode | ((context: HoneyPopupContextValue<Context, Reference>) => ReactNode);
13
12
  referenceProps?: FastOmit<HoneyPopupStyledProps, 'children' | 'content'>;
14
13
  /**
15
14
  * Content inside the popup.
16
15
  */
17
- content: ReactNode | ((context: HoneyPopupContextProps<Context, Reference>) => ReactNode);
16
+ content: ReactNode | ((context: HoneyPopupContextValue<Context, Reference>) => ReactNode);
18
17
  /**
19
18
  * Additional props for the floating content.
20
19
  */
@@ -1,6 +1,6 @@
1
1
  import { FloatingContext, ReferenceType } from '@floating-ui/react';
2
- export interface HoneyPopupContextProps<Context, Reference extends ReferenceType> {
2
+ export interface HoneyPopupContextValue<Context, Reference extends ReferenceType> {
3
3
  context: Context | undefined;
4
4
  floatingContext: FloatingContext<Reference>;
5
5
  }
6
- export declare const HoneyPopupContext: import('react').Context<HoneyPopupContextProps<any, any> | undefined>;
6
+ export declare const HoneyPopupContext: import('react').Context<HoneyPopupContextValue<any, any> | undefined>;
@@ -1,3 +1,3 @@
1
1
  import { ReferenceType } from '@floating-ui/react';
2
- import { HoneyPopupContextProps } from '../HoneyPopupContext';
3
- export declare const useHoneyPopupContext: <Context, Reference extends ReferenceType = ReferenceType>() => HoneyPopupContextProps<Context, Reference>;
2
+ import { HoneyPopupContextValue } from '../HoneyPopupContext';
3
+ export declare const useHoneyPopupContext: <Context, Reference extends ReferenceType = ReferenceType>() => HoneyPopupContextValue<Context, Reference>;
@@ -1,4 +1,4 @@
1
- import { ElementProps, FloatingContext, UseDismissProps, UseClickProps, UseHoverProps, UseFocusProps, UseClientPointProps, UseRoleProps } from '@floating-ui/react';
1
+ import { ElementProps, ReferenceType, FloatingContext, UseDismissProps, UseClickProps, UseHoverProps, UseFocusProps, UseClientPointProps, UseRoleProps } from '@floating-ui/react';
2
2
  import { FastOmit } from '@react-hive/honey-style';
3
3
  export type HoneyPopupExtraInteraction = <Props extends object>(context: FloatingContext, props?: Props) => ElementProps;
4
4
  /**
@@ -66,4 +66,4 @@ export interface UseHoneyPopupInteractionsOptions {
66
66
  */
67
67
  extraInteractions?: ElementProps[];
68
68
  }
69
- export declare const useHoneyPopupInteractions: (context: FloatingContext, { enabled, event, dismissOptions, clickOptions, hoverOptions, focusOptions, clientPointsOptions, roleOptions, extraInteractions, }: UseHoneyPopupInteractionsOptions) => import('@floating-ui/react').UseInteractionsReturn;
69
+ export declare const useHoneyPopupInteractions: <Reference extends ReferenceType>(context: FloatingContext<Reference>, { enabled, event, dismissOptions, clickOptions, hoverOptions, focusOptions, clientPointsOptions, roleOptions, extraInteractions, }: UseHoneyPopupInteractionsOptions) => import('@floating-ui/react').UseInteractionsReturn;
@@ -4,12 +4,18 @@ import { Derivable } from '@floating-ui/dom';
4
4
  import { FastOmit } from '@react-hive/honey-style';
5
5
  import { Nullable } from '../../../types';
6
6
  import { UseHoneyPopupInteractionsOptions } from './use-honey-popup-interactions';
7
- export interface UseHoneyPopupOptions<Reference extends ReferenceType, UseAutoSize extends boolean = boolean> extends FastOmit<UseHoneyPopupInteractionsOptions, 'extraInteractions'> {
7
+ export interface UseHoneyPopupOptions<Reference extends ReferenceType, UseAutoSize extends boolean = boolean> extends UseHoneyPopupInteractionsOptions {
8
8
  open?: boolean;
9
9
  /**
10
10
  * Options for configuring the floating UI behavior.
11
11
  */
12
12
  floatingOptions?: FastOmit<UseFloatingOptions<Reference>, 'nodeId' | 'open' | 'whileElementsMounted' | 'onOpenChange'>;
13
+ /**
14
+ * Whether to use the offset middleware.
15
+ *
16
+ * @default true
17
+ */
18
+ useOffset?: boolean;
13
19
  /**
14
20
  * Configuration for offset middleware.
15
21
  *
@@ -145,5 +151,5 @@ interface UseHoneyPopupApi<Reference extends ReferenceType> {
145
151
  *
146
152
  * @returns An object containing state and utilities for managing the popup.
147
153
  */
148
- export declare const useHoneyPopup: <Reference extends ReferenceType>({ enabled, event, dismissOptions, clickOptions, hoverOptions, focusOptions, clientPointsOptions, roleOptions, open, floatingOptions, offsetOptions, useFlip, flipOptions, useShift, shiftOptions, useArrow, arrowOptions, transitionOptions, useAutoPlacement, autoPlacementOptions, useAutoUpdate, autoUpdateOptions, useAutoSize, minAcceptableWidth, minAcceptableHeight, maxAcceptableWidth, maxAcceptableHeight, onOpen, onClose, }: UseHoneyPopupOptions<Reference>) => UseHoneyPopupApi<Reference>;
154
+ export declare const useHoneyPopup: <Reference extends ReferenceType>({ enabled, event, dismissOptions, clickOptions, hoverOptions, focusOptions, clientPointsOptions, roleOptions, extraInteractions, open, floatingOptions, useOffset, offsetOptions, useFlip, flipOptions, useShift, shiftOptions, useArrow, arrowOptions, transitionOptions, useAutoPlacement, autoPlacementOptions, useAutoUpdate, autoUpdateOptions, useAutoSize, minAcceptableWidth, minAcceptableHeight, maxAcceptableWidth, maxAcceptableHeight, onOpen, onClose, }: UseHoneyPopupOptions<Reference>) => UseHoneyPopupApi<Reference>;
149
155
  export {};
@@ -1,3 +1,4 @@
1
1
  export * from './HoneyPopup.types';
2
+ export * from './HoneyPopupContext';
2
3
  export * from './HoneyPopup';
3
4
  export * from './hooks';
@@ -1,9 +1,22 @@
1
1
  import { HTMLAttributes } from 'react';
2
- import { FastOmit, HoneyCSSDimensionUnit, HoneyFontName, HoneyColor, HoneyCSSColor, HoneyStyledContext, HoneyStyledFunction, HoneyDimensionName, HoneyBreakpointName, HoneyBreakpoints, HoneySpacings, HoneyCSSDimensionValue } from '@react-hive/honey-style';
3
- import { Nullable, HoneyScreenState, HoneyCSSShorthandTuple, HoneyCSSShorthandDimensionOutput, HoneyCSSSpacingValue, HoneyCSSMediaRule, HoneyPrefixedCSSProperties } from '../types';
2
+ import { FastOmit, HoneyFontName, HoneyColor, HoneyCSSColor, HoneyStyledContext, HoneyStyledFunction, HoneyDimensionName, HoneyBreakpointName, HoneyBreakpoints, HoneySpacings, HoneyCSSDimensionUnit, HoneyCSSDimensionValue, HoneyCSSMediaRule } from '@react-hive/honey-style';
3
+ import { Nullable, HoneyScreenState, HoneyCSSShorthandTuple, HoneyCSSShorthandDimensionOutput, HoneyCSSSpacingValue, HoneyPrefixedCSSProperties } from '../types';
4
4
  export declare const noop: () => void;
5
5
  export declare function assert(condition: any, message: string): asserts condition;
6
6
  export declare const generateUniqueId: () => string;
7
+ /**
8
+ * Invokes the given input if it is a function, passing the provided arguments.
9
+ * Otherwise, returns the input as-is.
10
+ *
11
+ * @template Args - Tuple of argument types to pass to the function.
12
+ * @template Result - Return type of the function or the value.
13
+ *
14
+ * @param input - A function to invoke with `args`, or a direct value of type `Result`.
15
+ * @param args - Arguments to pass if `input` is a function.
16
+ *
17
+ * @returns The result of invoking the function, or the original value if it's not a function.
18
+ */
19
+ export declare const invokeIfFunction: <Args extends any[], Result>(input: ((...args: Args) => Result) | Result, ...args: Args) => Result;
7
20
  /**
8
21
  * Determines the resolved type for spacing values when processed by `resolveSpacing`.
9
22
  *