/** * Copyright 2022, SumUp Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { type ReactNode } from 'react'; type OnBack = () => void; type OnClose = () => void | Promise; export type ChildrenRenderProps = { onBack?: OnBack; onClose?: OnClose; }; export type SidePanelHookProps = { /** * The headline of the side panel. */ headline: string; /** * Text label for the back button for screen readers. * Important for accessibility. */ backButtonLabel?: string; /** * The side panel content. Use a render function when you need access to the * `onBack` and `onClose` functions to close the side panel programmatically. */ children: ReactNode | ((props: ChildrenRenderProps) => ReactNode); /** * Text label for the close button for screen readers. * Important for accessibility. */ closeButtonLabel?: string; /** * Callback function that is called when the stacked side panel is closed. */ onBack?: OnBack; /** * Callback function that is called when the side panel is closed. */ onClose?: OnClose; /** * The group of the side panel. Opening a second side panel in * the same group will replace the content and close all side panels * stacked on top of it. Only panels in different groups stack one on top of the other. */ group?: string; }; type SetSidePanel = (props: SidePanelHookProps) => void; type UpdateSidePanel = (props: Partial) => void; type RemoveSidePanel = (group?: SidePanelHookProps['group']) => void; type UseSidePanelHook = () => { setSidePanel: SetSidePanel; updateSidePanel: UpdateSidePanel; removeSidePanel: RemoveSidePanel; isPrimaryContentResized: boolean; transitionDuration: number; }; export declare const useSidePanel: UseSidePanelHook; export {};