@react-hive/honey-layout 2.6.1 → 2.7.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/HoneyOverlay.d.ts +26 -8
- package/dist/index.js +5 -2
- package/package.json +1 -1
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
2
|
import { HoneyActiveOverlay, HoneyOverlayId, Nullable } from '../types';
|
|
3
3
|
import { HoneyBoxProps } from './HoneyBox';
|
|
4
|
-
|
|
4
|
+
type OverlayContext = {
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
6
|
+
* The current overlay instance, including methods and metadata for managing the overlay.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
overlay: Nullable<HoneyActiveOverlay>;
|
|
9
|
+
/**
|
|
10
|
+
* Function to deactivate the overlay. Typically, triggers the `onDeactivate` callback.
|
|
11
|
+
*/
|
|
12
|
+
deactivateOverlay: () => void;
|
|
13
|
+
};
|
|
14
|
+
export type HoneyOverlayProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & HoneyBoxProps & {
|
|
15
|
+
/**
|
|
16
|
+
* The content of the overlay, either as static nodes or a function that receives the object
|
|
17
|
+
* with the current overlay state and helper methods.
|
|
18
|
+
*/
|
|
19
|
+
children: ReactNode | ((overlayContext: OverlayContext) => ReactNode);
|
|
9
20
|
/**
|
|
10
21
|
* Determines whether the overlay is currently active.
|
|
11
22
|
*/
|
|
@@ -15,13 +26,20 @@ export type HoneyOverlayProps = HTMLAttributes<HTMLDivElement> & HoneyBoxProps &
|
|
|
15
26
|
*/
|
|
16
27
|
overlayId?: HoneyOverlayId;
|
|
17
28
|
/**
|
|
18
|
-
* Callback invoked when the overlay is
|
|
29
|
+
* Callback function invoked when the overlay is deactivated.
|
|
30
|
+
* Typically called when the "Escape" key is pressed or another user-defined action triggers deactivation.
|
|
19
31
|
*/
|
|
20
|
-
|
|
32
|
+
onDeactivate: () => void;
|
|
21
33
|
};
|
|
22
34
|
/**
|
|
23
|
-
*
|
|
35
|
+
* A reusable overlay component that manages active states and keyboard interactions.
|
|
36
|
+
*
|
|
37
|
+
* The `HoneyOverlay` component integrates with the `useRegisterHoneyOverlay` hook to:
|
|
38
|
+
* - Automatically register/deregister the overlay.
|
|
39
|
+
* - Handle keyboard events, such as closing the overlay with the "Escape" key.
|
|
40
|
+
* - Provide a context to dynamically manage overlay content and state.
|
|
24
41
|
*
|
|
25
|
-
* @param {HoneyOverlayProps} props - The properties
|
|
42
|
+
* @param {HoneyOverlayProps} props - The properties used to configure the overlay.
|
|
26
43
|
*/
|
|
27
|
-
export declare const HoneyOverlay: ({ children, isActive, overlayId,
|
|
44
|
+
export declare const HoneyOverlay: ({ children, isActive, overlayId, onDeactivate, ...props }: HoneyOverlayProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1371,7 +1371,7 @@ const Mn = /* @__PURE__ */ Er(Dn), Fn = ({
|
|
|
1371
1371
|
children: n,
|
|
1372
1372
|
isActive: o,
|
|
1373
1373
|
overlayId: i,
|
|
1374
|
-
|
|
1374
|
+
onDeactivate: s,
|
|
1375
1375
|
...f
|
|
1376
1376
|
}) => {
|
|
1377
1377
|
const c = Wn(o, {
|
|
@@ -1383,7 +1383,10 @@ const Mn = /* @__PURE__ */ Er(Dn), Fn = ({
|
|
|
1383
1383
|
[s]
|
|
1384
1384
|
)
|
|
1385
1385
|
});
|
|
1386
|
-
return /* @__PURE__ */ G.jsx(St, { ref: c == null ? void 0 : c.setContainerRef, "aria-hidden": !o, ...f, children: typeof n == "function" ? n(
|
|
1386
|
+
return /* @__PURE__ */ G.jsx(St, { ref: c == null ? void 0 : c.setContainerRef, "aria-hidden": !o, ...f, children: typeof n == "function" ? n({
|
|
1387
|
+
overlay: c,
|
|
1388
|
+
deactivateOverlay: s
|
|
1389
|
+
}) : n });
|
|
1387
1390
|
}, Yn = () => {
|
|
1388
1391
|
const [n, o] = xt([]);
|
|
1389
1392
|
pe(() => {
|