@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
68 lines (67 loc) • 2.85 kB
TypeScript
/**
*
* 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 type React from 'react';
import { type CommonProps, type PolymorphicCommonProps } from '../_common/types';
/**
*
*
* Types
*
*
*/
type BannerCommonProps = {
/** Shows a status icon. The icon is based on the value of the `variant` prop */
hasIcon?: boolean;
/** Content to be shown in the banner. */
children?: React.ReactNode;
/** Sets the role to alert or alertdialog, based on the value of `isCloseable` */
isAlert?: boolean;
/** How the banner is used. */
usage?: 'inline' | 'global';
/** The variant of the banner */
variant?: BannerVariant;
};
type CloseableBannerProps = {
/** If the banner is closeable. Renders an icon button in the top right corner */
isCloseable: true;
/** Event handler for when the close icon is clicked */
onClose: (e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
};
type NonCloseableBannerProps = {
isCloseable?: false;
onClose?: never;
};
type BannerCloseProps = CloseableBannerProps | NonCloseableBannerProps;
type BannerProps = BannerCommonProps & BannerCloseProps;
type BannerVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';
declare const Banner: (<T extends React.ElementType = "section">({ as, variant, hasIcon, onClose, className, children, isCloseable, usage, htmlAttributes, isAlert, ref, ...restProps }: PolymorphicCommonProps<T, BannerProps>) => import("react/jsx-runtime").JSX.Element) & {
Actions: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", {
children: React.ReactNode;
}>) => import("react/jsx-runtime").JSX.Element;
Description: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", {
children: React.ReactNode;
}>) => import("react/jsx-runtime").JSX.Element;
Header: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"span", {
children: React.ReactNode;
}>) => import("react/jsx-runtime").JSX.Element;
};
export { Banner };
//# sourceMappingURL=Banner.d.ts.map