UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

79 lines 3.66 kB
/** * * 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 <http://www.gnu.org/licenses/>. */ 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'; type DrawerProps = { /** Controls whether the drawer is open (expanded) or closed (collapsed). */ isExpanded: boolean; /** Callback functions fired when the drawer's expanded state changes. */ 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 */ resizeableProps?: ResizableProps; /** Whether a close button (X) is displayed in the drawer. */ isCloseable?: boolean; /** Whether to portal the content */ isPortaled?: boolean; /** The content to display within the drawer. */ children: React.ReactNode; /** Additional CSS classes to apply to the drawer container. */ className?: string; /** * Props to pass to the portal from @floating-ui/react FloatingPortal * @see https://floating-ui.com/docs/floatingportal */ portalProps?: ComponentProps<typeof FloatingPortal>; }; 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: { <T extends React.ElementType = "div">({ children, className, isExpanded, onExpandedChange, position, type, isResizeable, resizeableProps, isCloseable, isPortaled, portalProps, htmlAttributes, style, ref, as, ...restProps }: PolymorphicCommonProps<T, DrawerProps>): 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