UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

79 lines (78 loc) 3.35 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 PolymorphicForwardRefExoticComponent } from '../_common/types'; export type DrawerPosition = 'left' | 'right'; export type DrawerType = 'overlay' | 'push'; export interface DrawerProps { /** If the component is expanded or hidden. */ isExpanded: boolean; /** What to do on expanded change. */ onExpandedChange?: (expanded: boolean) => void; /** Which position the component will appear. */ position?: DrawerPosition; /** How the component affects sibling content. */ type?: DrawerType; /** The drawer can be resized. */ 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; /** Is closeable. */ isCloseable?: boolean; /** Whether to portal the content */ isPortaled?: boolean; children: React.ReactNode; className?: string; /** * Props to pass to the portal from @floating-ui/react FloatingPortal * @see https://floating-ui.com/docs/floatingportal */ portalProps?: ComponentProps<typeof FloatingPortal>; } export declare const DrawerComponent: PolymorphicForwardRefExoticComponent<'div', DrawerProps>; 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: Omit<React.ForwardRefExoticComponent<DrawerProps & { [key: string]: unknown; }>, "$$typeof"> & Omit<React.ExoticComponent<DrawerProps & { [key: string]: unknown; }>, never> & (<InstanceT extends React.ElementType = "div">(props: import("../_common/types").PolymorphicPropsWithRef<InstanceT, DrawerProps>) => React.ReactElement | null) & { Header: ({ children, className, ...restProps }: DrawerHeaderProps) => import("react/jsx-runtime").JSX.Element; Actions: ({ children, className, ...restProps }: DrawerActionsProps) => import("react/jsx-runtime").JSX.Element; Body: ({ children, className, ...restProps }: DrawerBodyProps) => import("react/jsx-runtime").JSX.Element; }; export { Drawer };