UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

88 lines 3.65 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 IconIndicatorType } from '../_common/IconIndicatorWrapper'; import { type HtmlAttributes } from '../_common/types'; type SideNavProps = { /** Content displayed inside the side navigation */ children?: React.ReactNode; /** Aria label for the side navigation. Needed for menubar accessibility. */ ariaLabel: string; /** Whether the side navigation is expanded */ isExpanded?: boolean; /** Whether the side navigation expands on hover/focus when not pinned or compact */ shouldOverlayOnInteraction?: boolean; /** Callback function triggered when the pin button is clicked */ onPinButtonClick?: () => void; /** Width used when expanded. Accepts any valid CSS width value or a number */ expandedWidth?: React.CSSProperties['width']; }; type SideNavListItemProps = { /** Content displayed inside the side navigation list item */ children?: React.ReactNode; }; type BaseItemProps = { /** Icon displayed inside the side navigation item */ icon?: React.ReactNode; /** Text label of the side navigation item */ label?: string; /** Whether the side navigation item is selected */ isActive?: boolean; /** Badge displayed inside the side navigation item. Represented by an object with a number and a type (e.g., 'info', 'warning', 'danger'). */ badge?: ItemBadgeProps; }; type NavItemProps = BaseItemProps & { /** Element displayed on the leading side of the side navigation item (e.g., counter) */ trailingElement?: React.ReactNode; } & ({ as: 'button'; /** Event handler for when the button is clicked. Only applicable if `as` is `'button'`. */ onClick?: HtmlAttributes<'button'>['onClick']; } | { /** What HTML element to render the root element as. */ as?: React.ElementType; } | { as: 'a'; /** The href of the link. Only applicable if `as` is `'a'`. */ href?: HtmlAttributes<'a'>['href']; /** The target of the link. Only applicable if `as` is `'a'`. */ target?: HtmlAttributes<'a'>['target']; }); type CategoryItemProps = BaseItemProps & { /** Content displayed inside the submenu popover. Typically a list of `SideNavigation.NavItem`. */ children?: React.ReactNode; /** * If true, the menu will be open. Otherwise, the menu will open and close * based on the user hovering the item. */ isMenuOpen?: boolean; }; type CategoryHeaderProps = { /** Content displayed inside the side navigation category header */ children?: React.ReactNode; }; type ItemBadgeProps = { /** Number displayed inside the side navigation item badge */ number: number; /** Type of the side navigation item badge */ type: IconIndicatorType; }; export type { SideNavProps, SideNavListItemProps, NavItemProps, CategoryItemProps, CategoryHeaderProps, ItemBadgeProps, }; //# sourceMappingURL=side-navigation-types.d.ts.map