UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

84 lines (83 loc) 3.08 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 type React from 'react'; import { type HtmlAttributes, type PolymorphicForwardRefExoticComponent } from '../_common/types'; type SideNavigationPosition = 'left' | 'right'; type SideNavigationSize = 'small' | 'large'; interface SideNavigationProps { /** True if the menu is expanded. */ isExpanded: boolean; /** What to do on expanded change. */ onExpandedChange?: (isExpanded: boolean) => void; /** True if icons will be used in the menu. */ hasIconMenu?: boolean; /** Position. */ position?: SideNavigationPosition; /** Size of the component */ size?: SideNavigationSize; /** HTML attributes */ htmlAttributes?: HtmlAttributes<'div'>; children?: React.ReactNode; className?: string; } export type SideNavigationListProps = { className?: string; children?: React.ReactNode; /** HTML attributes */ htmlAttributes?: HtmlAttributes<'ul'>; }; export type SideNavigationItemProps = { icon?: React.ReactNode; children?: React.ReactNode; isSelected?: boolean; /** Flag to indicate if the side navigation item can be selected or not */ isSelectable?: boolean; className?: string; style?: React.CSSProperties; } & ({ as: 'button'; onClick: () => void; } | { as?: React.ElementType; }); export interface SideNavigationItemBadgeProps { children?: number; type?: 'info' | 'warning' | 'critical'; /** HTML attributes */ htmlAttributes?: HtmlAttributes<'span'>; className?: string; style?: React.CSSProperties; } export type SideNavigationGroupHeaderProps = { children?: React.ReactNode; className?: string; style?: React.CSSProperties; }; /** * @deprecated Use new SideNavigation from @neo4j-ndl/react/next instead. */ declare const SideNavigation: React.ForwardRefExoticComponent<SideNavigationProps & React.RefAttributes<HTMLDivElement>> & { GroupHeader: PolymorphicForwardRefExoticComponent<"li", SideNavigationGroupHeaderProps>; Item: PolymorphicForwardRefExoticComponent<"a", SideNavigationItemProps>; ItemBadge: React.ForwardRefExoticComponent<SideNavigationItemBadgeProps & React.RefAttributes<HTMLSpanElement>>; List: React.ForwardRefExoticComponent<SideNavigationListProps & React.RefAttributes<HTMLUListElement>>; }; export { SideNavigation };