/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import { FloatingPortal } from '@floating-ui/react';
import { type ResizableProps } from 're-resizable';
import type React from 'react';
import { type ComponentProps } from 'react';
import { type HtmlAttributes, type PolymorphicCommonProps } from '../_common/types';
type DrawerPosition = 'left' | 'right';
type DrawerType = 'overlay' | 'push' | 'modal';
type DrawerProps = {
/** Controls whether the drawer is open (expanded) or closed (collapsed). */
isExpanded: boolean;
/** Callback fired when the drawer's expanded state changes (close button, Escape, click outside, or programmatic change). */
onExpandedChange?: (expanded: boolean) => void;
/** Position where the drawer appears on screen. By default, it appears from the left. */
position?: DrawerPosition;
/** How the drawer affects the layout of sibling content. By default, it overlays content. */
type?: DrawerType;
/** Enables horizontal resizing of the drawer, by default it is not resizable. */
isResizeable?: boolean;
/** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable
* The property enable has default values set for bottom, bottomLeft etc based on the position prop.
*/
resizeableProps?: ResizableProps;
/** Whether a close button (X) is displayed in the drawer. */
isCloseable?: boolean;
/** Whether to portal the content. Only applies when type is "overlay". Type "modal" is always portaled.*/
isPortaled?: boolean;
/**
* Whether pressing Escape closes the drawer. Should be set to true for overlay drawers.
* - When type is "modal", this defaults to true.
* - When type is "overlay", this defaults to false.
* - When type is "push", no effect.
*/
closeOnEscape?: boolean;
/**
* When type is "overlay", whether clicking outside the drawer closes it. Should be set to true for overlay drawers.
* - When type is "overlay" or "modal", this defaults to false.
* - When type is "push", no effect.
*/
closeOnClickOutside?: boolean;
/**
* @deprecated overlay are now focus trapped by default, this prop has no effect anymore.
*/
closeOnFocusOut?: boolean;
/** The content to display within the drawer. */
children: React.ReactNode;
/**
* Props to pass to the portal from @floating-ui/react FloatingPortal
* Only applies when type is "overlay" and isPortaled is true, or if type is "modal".
* @see https://floating-ui.com/docs/floatingportal
*/
portalProps?: ComponentProps;
} & ({
type: 'modal';
/** The aria-label to apply to the drawer. Required for accessibility when type is "modal" or "overlay".*/
ariaLabel: string;
} | {
type?: 'push' | 'overlay';
ariaLabel?: string;
});
type DrawerHeaderProps = {
children: React.ReactNode;
className?: string;
htmlAttributes?: HtmlAttributes<'h5'>;
};
type DrawerActionsProps = {
children: React.ReactNode;
className?: string;
htmlAttributes?: HtmlAttributes<'div'>;
};
type DrawerBodyProps = {
children: React.ReactNode;
className?: string;
htmlAttributes?: HtmlAttributes<'div'>;
};
declare const Drawer: {
({ children, className, isExpanded, onExpandedChange, position, type, isResizeable, resizeableProps, isCloseable, isPortaled, portalProps, closeOnEscape, closeOnClickOutside, ariaLabel, htmlAttributes, style, ref, as, ...restProps }: PolymorphicCommonProps): import("react/jsx-runtime").JSX.Element;
displayName: string;
} & {
Actions: ({ children, className, htmlAttributes, ...restProps }: DrawerActionsProps) => import("react/jsx-runtime").JSX.Element;
Body: ({ children, className, htmlAttributes, ...restProps }: DrawerBodyProps) => import("react/jsx-runtime").JSX.Element;
Header: ({ children, className, htmlAttributes, ...restProps }: DrawerHeaderProps) => import("react/jsx-runtime").JSX.Element;
};
export { Drawer };
//# sourceMappingURL=Drawer.d.ts.map